Exemplo n.º 1
0
void
CodeWindow::removeRevision( CodeRevision * r ) { 
    int ri = findRevision(r);
    if( ri < 0 ) return;
    _revisions.erase( _revisions.begin() + ri );
    if ( _revisions.size() == 0 ) setRevision( new CodeRevision() );
    else ( setRevision ( max ( 0, min(_revisions.size()-1, ri ) ) ) );
} 
Exemplo n.º 2
0
STDMETHODIMP HostUSBDeviceFilterWrap::COMSETTER(Revision)(IN_BSTR aRevision)
{
    LogRelFlow(("{%p} %s: enter aRevision=%ls\n", this, "HostUSBDeviceFilter::setRevision", aRevision));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = setRevision(BSTRInConverter(aRevision).str());
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, "HostUSBDeviceFilter::setRevision", hrc));
    return hrc;
}
Exemplo n.º 3
0
void
CodeWindow::addRevision(CodeRevision * r, bool makeCurrent ) { 
    if ( findRevision(r) < 0 ) { 
        _revisions.push_back(r);
        if ( makeCurrent ) 
            setRevision(r);
    }   
}
Exemplo n.º 4
0
CodeWindow::CodeWindow(CodeRevision * r ) :
    DisplayWindow(), 
    _current(NULL),
    _textcontent(new TextContent())
    {
        initShapes();
        //need a TextContent constructor with buf arguments
        _content = _textcontent;
        //create for existing revision
        setRevision(r);
    }
Exemplo n.º 5
0
CodeWindow::CodeWindow() :
    DisplayWindow(), 
    _current(NULL),
    _textcontent(new TextContent())
    { 
        EM_log( CK_LOG_FINER, "(audicle) CodeWindow base ctor...");
        initShapes();
        //a new window
        _content = _textcontent;
        setRevision(new CodeRevision());
    }
Exemplo n.º 6
0
/* ===========================================================================
	PDF Object Initialization sets the base PDF Object char address to 0, 
	the revision number to 0, the object index to 0 and the parent 
	PDF_Object pointer to NULL
	
	@param	none	desc
	@return	int	0 = no error, -1 = error
	==========================================================================*/
int PDF_Object::init() {

	// init
	setAddress(0);
	setRevision(0);
	setIndex(0);
	setParent(NULL);
	setRenderContent("");
	//scale.setUnits(pt);
	return 0;
}
Exemplo n.º 7
0
void
CodeWindow::handleMouseUI( const InputEvent & e ) { 
    //CodeWindow::handleMouseUI(int button, int state, Point2D pt, uint * stack, uint size ) { 
    //point transformed to window
    //substack

    DisplayWindow::handleMouseUI( e );

    _testButton.handleMouse     ( e );
    _compileButton.handleMouse  ( e );
    _sporkButton.handleMouse    ( e );

    for ( int j = 0 ; j < _revisions.size(); j++ ) { 
        _revisions[j]->handleMouse( e );
        if ( _revisions[j]->selected() ) 
            setRevision(j);
    }

}   
Exemplo n.º 8
0
void
CodeWindow::setRevision(CodeRevision *r ) { 
    int ri = findRevision(r);
    if ( ri >= 0 )   setRevision( ri );
    else addRevision(r, true);
}
Exemplo n.º 9
0
// Brand new clip contents new method.
bool qtractorMidiClip::createMidiFile (
	const QString& sFilename, int iTrackChannel )
{
	closeMidiFile();

	qtractorTrack *pTrack = track();
	if (pTrack == NULL)
		return false;

	qtractorSession *pSession = pTrack->session();
	if (pSession == NULL)
		return false;

#ifdef CONFIG_DEBUG_0
	qDebug("qtractorMidiClip[%p]::createMidiFile(\"%s\", %d)", this,
		sFilename.toUtf8().constData(), iTrackChannel);
#endif

	// Self holds the SMF format,
	const unsigned short iFormat = format();

	// Which SMF format?
	unsigned short iTracks = 1;
	if (iFormat == 0) {
		// SMF format 0 (1 track, 1 channel)
		iTrackChannel = pTrack->midiChannel();
	} else {
		// SMF format 1 (2 tracks, 1 channel)
		iTrackChannel = 1;
		++iTracks;
	}

	// Set local properties...
	setFilename(sFilename);
	setTrackChannel(iTrackChannel);
	setDirty(false);

	// Register file path...
	pSession->files()->addClipItem(qtractorFileList::Midi, this, true);

	// Create and open up the MIDI file...
	m_pFile = new qtractorMidiFile();
	if (!m_pFile->open(sFilename, qtractorMidiFile::Write)) {
		delete m_pFile;
		m_pFile = NULL;
		return false;
	}

	// Initialize MIDI event container...
	m_pKey  = new Key(this);
	m_pData = new Data();
	m_pData->attach(this);

	// Right on then...
	insertHashKey();

	qtractorMidiSequence *pSeq = m_pData->sequence();

	pSeq->clear();
	pSeq->setTicksPerBeat(pSession->ticksPerBeat());
	pSeq->setName(shortClipName(QFileInfo(sFilename).baseName()));
	pSeq->setChannel(pTrack->midiChannel());

	// Make it a brand new revision...
	setRevision(1);

	// Write SMF header...
	if (m_pFile->writeHeader(iFormat, iTracks, pSeq->ticksPerBeat())) {
		// Set initial local properties...
		if (m_pFile->tempoMap()) {
			m_pFile->tempoMap()->fromTimeScale(
				pSession->timeScale(),
				pSession->tickFromFrame(clipStart()));
		}
		// Sure this is a brand new file...
		if (iFormat == 1)
			m_pFile->writeTrack(NULL);
		m_pFile->writeTrack(pSeq);
		m_pFile->close();
	}

	// It's there now.
	delete m_pFile;
	m_pFile = NULL;

	// Clip name should be clear about it all.
	if (clipName().isEmpty())
		setClipName(pSeq->name());
	if (clipName().isEmpty())
		setClipName(shortClipName(QFileInfo(filename()).baseName()));

	// Uh oh...
	m_playCursor.reset(pSeq);
	m_drawCursor.reset(pSeq);

	return true;
}