Beispiel #1
0
void TExportZone::ResolutionChanged(int32 resizePixels)
{	
	const BRect bounds = Bounds();
	
	// Get start and duration in pixels
	uint32 startTime = m_CueSheetWindow->GetCueSheetView()->GetExportStartTime();
	uint32 stopTime  = m_CueSheetWindow->GetCueSheetView()->GetExportStopTime();
		
	uint32 inPixels 	= TimeToPixels( startTime, GetCurrentTimeFormat(), GetCurrentResolution());
	uint32 outPixels = TimeToPixels( stopTime, GetCurrentTimeFormat(), GetCurrentResolution());

	//	Update slider zones
	m_InRect.left 	= inPixels;
	m_InRect.right 	= m_InRect.left + kExportSliderWidth;

	m_OutRect.right	 = outPixels;
	m_OutRect.left 	 = m_OutRect.right - kExportSliderWidth;
	
	// Update channel zone
	m_ExportChannel.left  = m_InRect.right;
	m_ExportChannel.right = m_OutRect.left;

	// Force redraw
	Invalidate();
}
Beispiel #2
0
void TMIDICue::Init()
{

	// Editor is closed
	fEditorOpen = false;

	// Set up default settings
	fIsLocked                       = false;
	fIsSelected             = false;
	fLowColor                       = kWhite;
	fHighColor              = kBlack;
	fIsPrepared             = false;
	fIsPlaying              = false;
	fIsVisible                      = false;
	fHasDuration            = true;
	fCanLoop                        = true;
	fCanStretch             = true;
	fCanEnvelope            = true;
	fHasEditor              = true;
	fCanWindow                      = true;
	fCanTransition          = false;
	fCanPath                        = false;

	// Default initialization
	TCueView::Init();

	// Create MIDIStore and MIDIEngine
	fMIDIStore = new BMidiStore();
	assert(fMIDIStore);
	fMIDIStore->Import(&fFileRef);
	fMIDIEngine = new TMIDIEngine(fMIDIStore);

	// Set cues fFile to point to the fMIDIFile
	fFile = fMIDIFile;

	// Calcaluate duration
	CalcDuration();

	// Adjust bounds based on cue duration
	int32 newWidth = TimeToPixels(fDuration, GetCurrentTimeFormat(), GetCurrentResolution());
	ResizeBy( newWidth - Bounds().Width(), 0);

	// Add the cue to the cue channel
	if ( fChannel->CanInsertCue(this, fInsertTime, true)) {
		fChannel->InsertCue(this, fInsertTime);
		Select();

		// We are now fully instantiated
		fIsInstantiated = true;
	}

	// Set expanded status
	if (fChannel->IsExpanded()) {
		fIsExpanded = false;
		Expand();
	} else {
		fIsExpanded = true;
		Contract();
	}
}
Beispiel #3
0
void TVideoEditorText::MessageReceived(BMessage* theMessage)
{
	switch( theMessage->what)
	{
	//      Time is inferred from point.  This is used during a mouse over the cue sheet
	case UPDATE_TIMELINE_MSG:
	{
		int64 theTime;

		if ( theMessage->FindInt64("TheTime", &theTime) == B_OK) {

			// Don't allow negative times to slip through
			if (theTime >= 0) {
				TimeToString(theTime, GetCurrentTimeFormat(), fText, false);
				Draw(Bounds());
			}
		}
	}
	break;

	default:
		break;

	}
}
Beispiel #4
0
void TExportZone::TrackOutMarker(BPoint mousePt)
{					
	//	Constrain to out time of cue sheet
	uint32 outPixels = TimeToPixels( Duration() - StartTime(), GetCurrentTimeFormat(), GetCurrentResolution());
	
	if (mousePt.x > outPixels)
		mousePt.x = outPixels;

	//	Don't allow overlap with m_InRect
	if ( (mousePt.x-kExportSliderWidth) < m_InRect.right)
		mousePt.x = m_InRect.right + kExportSliderWidth;

	// Save oldRect for redraw														
	BRect oldRect 	= m_OutRect;	
	m_OutRect.right = mousePt.x;	
	m_OutRect.left = m_OutRect.right - kExportSliderWidth;	
	
	
	// Exit if there is no change in position
	if (oldRect == m_OutRect)
		return;

	//	Update m_ExportChannel
	m_ExportChannel.right = m_OutRect.left;
	
	//	Clean up old position
	BRect updateRect = oldRect;
	
	if (m_OutRect.left <= oldRect.left)
	{
		updateRect.left = m_OutRect.left;		
	}
	else
	{
		updateRect.right  = m_OutRect.right;
	}
	
	Draw(updateRect);
	
	//	Update CueSheet variable
	uint32 newOutTime = StartTime() + PixelsToTime(m_OutRect.right, GetCurrentTimeFormat(), GetCurrentResolution());
	m_CueSheetWindow->GetCueSheetView()->SetExportStopTime(newOutTime);

	//	Update text
	m_CueSheetWindow->GetExportTimeView()->DrawOutText();
	
}
Beispiel #5
0
void TProjectSettings::Init()
{
	// Tell parent we have been constructed
	m_Parent->m_ProjectSettings = true;
		
	// Get dialog items	
	m_RealTimeButton 	= (BRadioButton *)FindView("RealTime");
	m_24FPSButton 		= (BRadioButton *)FindView("24FPS");
	m_25FPSButton 		= (BRadioButton *)FindView("25FPS");
	m_2997FPSButton 	= (BRadioButton *)FindView("2997FPS");
	m_30FPSButton 		= (BRadioButton *)FindView("30FPS");
		
	m_StartTime = (BTextControl *)FindView("StartTime");
	m_Duration 	= (BTextControl *)FindView("Duration");
	m_EndTime 	= (BTextControl *)FindView("EndTime");
	
	// Set up time values
	char timeStr[256];
	TimeToString(m_CueSheet->StartTime(), m_CueSheet->GetTimeFormat(), timeStr, false);
	m_StartTime->SetText(timeStr);
	
	TimeToString(m_CueSheet->Duration(), m_CueSheet->GetTimeFormat(), timeStr, false);
	m_Duration->SetText(timeStr);
	
	TimeToString( m_CueSheet->Duration() - m_CueSheet->StartTime(), m_CueSheet->GetTimeFormat(), timeStr, false);
	m_EndTime->SetText(timeStr);
	
	// Set to current project settings
	m_TimeFormat = GetCurrentTimeFormat();
	switch(m_TimeFormat)
	{
		//case B_TIMECODE_30_DROP_2:
		//	m_RealTimeButton->SetValue(1);
		//	break;
			
		case B_TIMECODE_24:
			m_24FPSButton->SetValue(1);
			break;
			
		case B_TIMECODE_25:
			m_25FPSButton->SetValue(1);
			break;
			
		case B_TIMECODE_30_DROP_2:
			m_2997FPSButton->SetValue(1);
			break;
			
		case B_TIMECODE_30:
			m_30FPSButton->SetValue(1);
			break;
	
		default:
			m_RealTimeButton->SetValue(1);
			break;
	}
		
	m_StartTime->MakeFocus(true);		
}
Beispiel #6
0
void TExportZone::TrackInMarker(BPoint mousePt)
{			
	
	const BRect bounds = Bounds();
		
	//	Constrain to left side view area
	if (mousePt.x < 0)
		mousePt.x = 0;

	//	Don't allow overlap with left side tracker
	if ( (mousePt.x + kExportSliderWidth) >= m_OutRect.left)
		mousePt.x = m_OutRect.left - kExportSliderWidth;
				
	// Save oldRect for redraw														
	BRect oldRect  = m_InRect;
	m_InRect.left  = mousePt.x;
	m_InRect.right = m_InRect.left + kExportSliderWidth;	
	
	// Exit if there is no change in position
	if (oldRect == m_InRect)
		return;

	//	Update m_ExportChannel
	m_ExportChannel.left = m_InRect.right;
	
	//	Clean up old position
	BRect updateRect = oldRect;
	
	if (oldRect.left <= m_InRect.left)
	{
		updateRect.right = m_InRect.right;
	}
	else
	{
		updateRect.left  = m_InRect.left;
	}
		
	Draw(updateRect);
	
	//	Update CueSheet variable
	uint32 newInTime = StartTime() + PixelsToTime(m_InRect.left, GetCurrentTimeFormat(), GetCurrentResolution());
	m_CueSheetWindow->GetCueSheetView()->SetExportStartTime(newInTime);

	//	Update text
	m_CueSheetWindow->GetExportTimeView()->DrawInText();
}
Beispiel #7
0
void TExportZone::HandleDoubleClick(BPoint where)
{
	//	Get window bounds
	const BRect winBounds = Window()->Bounds();
	
	//	Get cue sheet bounds
	const BRect bounds = Bounds();
	
	//	Get total pixel length for bounds checking
	int32 pixelWidth = TimeToPixels( Duration(), GetCurrentTimeFormat(), GetCurrentResolution() );
	
	//	Update tracking rects
	m_InRect.left 	= bounds.left;
	m_InRect.right 	= m_InRect.left + kExportSliderWidth;

	//	Set up out rect.  Check for right side length bounds violation
	int32 outRight = (bounds.left + winBounds.Width()) - kHeaderWidth;
	if (outRight > pixelWidth)
		outRight = pixelWidth;
	
	m_OutRect.right	 = outRight;
	m_OutRect.left 	 = m_OutRect.right - kExportSliderWidth;
	
	//	Update m_ExportChannel
	m_ExportChannel.left  = m_InRect.right;
	m_ExportChannel.right = m_OutRect.left;
	
	//	Update cue sheet variables
	m_CueSheetWindow->GetCueSheetView()->SetExportStartTime( PixelsToTime(m_InRect.left, GetCurrentTimeFormat(), GetCurrentResolution()) );
	m_CueSheetWindow->GetCueSheetView()->SetExportStopTime( PixelsToTime(m_OutRect.right, GetCurrentTimeFormat(), GetCurrentResolution()) );
	
	//	Update text items
	m_CueSheetWindow->GetExportTimeView()->DrawInText();
	m_CueSheetWindow->GetExportTimeView()->DrawOutText();

	//	Redraw
	Invalidate();
}
Beispiel #8
0
void TCueSheetWindow::MessageReceived(BMessage* message)
{
	switch (message->what)
	{
	// These messages come from the transport
	case START_BUTTON_MSG:
	{
		fCueSheetView->SetCurrentTime( StartTime() );

		// Inform Transport
		BMessage* theMessage = new BMessage(UPDATE_TIMELINE_MSG);
		theMessage->AddInt32("TheTime", GetCurrentTime());
		TTransportPalette* theTransport = static_cast<MuseumApp*>(be_app)->GetTransport();
		theTransport->PostMessage(theMessage, theTransport->GetTransportPaletteView());
		delete theMessage;
	}
	break;

	case REWIND_BUTTON_MSG:
		/*{
		        // Calculate new time
		        uint32 increment = 1000 / ( GetFPSValue(GetCurrentTimeFormat())+1);
		        uint32 newTime = GetCurrentTime() - (increment-=2);

		        // Don't allow underflow
		        if (newTime < StartTime())
		                newTime = StartTime();

		        fCueSheetView->SetCurrentTime(newTime);

		        // Inform Transport
		        BMessage *theMessage = new BMessage(UPDATE_TIMELINE_MSG);
		        theMessage->AddInt32("TheTime", GetCurrentTime());
		        TTransportPalette *theTransport = static_cast<MuseumApp *>(be_app)->GetTransport();
		        theTransport->PostMessage(theMessage, theTransport->GetTransportPaletteView());
		        delete theMessage;

		        char textStr[256];
		        TimeToString(GetCurrentTime(), GetCurrentTimeFormat(), textStr, false);
		   }*/
		break;

	case PLAY_BUTTON_MSG:
		break;

	case PAUSE_BUTTON_MSG:
		break;

	case STOP_BUTTON_MSG:
		break;

	case FF_BUTTON_MSG:
		/*{
		        // Calculate new time
		        uint32 increment = 1000 / ( GetFPSValue(GetCurrentTimeFormat()));
		        uint32 newTime = GetCurrentTime() + (increment+=2);

		        // Don't allow overflow
		        if (newTime > StartTime() + Duration())
		                newTime = StartTime() + Duration();

		        fCueSheetView->SetCurrentTime(newTime);

		        // Inform Transport
		        BMessage *theMessage = new BMessage(UPDATE_TIMELINE_MSG);
		        theMessage->AddInt32("TheTime", GetCurrentTime());
		        TTransportPalette *theTransport = static_cast<MuseumApp *>(be_app)->GetTransport();
		        theTransport->PostMessage(theMessage, theTransport->GetTransportPaletteView());
		        delete theMessage;

		        char textStr[256];
		        TimeToString(GetCurrentTime(), GetCurrentTimeFormat(), textStr, false);
		   }*/
		break;

	case END_BUTTON_MSG:
	{
		fCueSheetView->SetCurrentTime(StartTime() + Duration());

		// Inform Transport
		BMessage* theMessage = new BMessage(UPDATE_TIMELINE_MSG);
		theMessage->AddInt32("TheTime", GetCurrentTime());
		TTransportPalette* theTransport = static_cast<MuseumApp*>(be_app)->GetTransport();
		theTransport->PostMessage(theMessage, theTransport->GetTransportPaletteView());
		delete theMessage;
	}
	break;

	case RECORD_BUTTON_MSG:
		break;

	case RESOLUTION_CHANGE_MSG:
	{
		Lock();

		// Get start and duration in pixels
		int32 startPixels        = TimeToPixels( fCueSheetView->StartTime(), GetCurrentTimeFormat(), GetCurrentResolution());
		int32 durationPixels = TimeToPixels( fCueSheetView->Duration(), GetCurrentTimeFormat(), GetCurrentResolution());
		int32 resizePixels       = durationPixels - startPixels;

		fCueSheetView->ResolutionChanged(message);
		fExportZone->ResolutionChanged(resizePixels);
		fTimeline->ResolutionChanged(resizePixels);

		// Update scroll bars
		AdjustScrollBars();

		Unlock();
	}
	break;

	// These messages come from the BFilePanel when saving a cue sheet
	case B_SAVE_REQUESTED:
		Save(message);
		break;

	case B_CANCEL:
		break;

	default:
		BWindow::MessageReceived(message);
		break;
	}
}
void TPictureCueEditorToolbar::Draw(BRect updateRect)
{
	// Setup environment
	PushState();

	BPoint startPt, endPt;

	// Fill background
	SetHighColor(kBlueGrey);
	FillRect(Bounds());

	// Frame it
	SetHighColor(kWhite);
	MovePenTo(Bounds().left, Bounds().top+1);
	endPt.Set( Bounds().right, Bounds().top+1 );
	StrokeLine(endPt);

	SetHighColor(kMediumGrey);
	MovePenTo(Bounds().left, Bounds().bottom-1);
	endPt.Set( Bounds().right, Bounds().bottom-1 );
	StrokeLine(endPt);

	SetHighColor(kBlack);
	MovePenTo(Bounds().left, Bounds().top);
	endPt.Set( Bounds().right, Bounds().top );
	StrokeLine(endPt);
	MovePenTo(Bounds().left, Bounds().bottom);
	endPt.Set( Bounds().right, Bounds().bottom );
	StrokeLine(endPt);

	// Draw text area
	SetHighColor(kBlack);
	FillRect(fDurationRect);
	BRect bounds = fDurationRect;

	SetHighColor(kTextHilite);
	startPt.Set(bounds.right, bounds.top);
	endPt.Set(bounds.right, bounds.bottom);
	StrokeLine(startPt, endPt);
	startPt.Set(bounds.right, bounds.bottom);
	endPt.Set(bounds.left+1, bounds.bottom);
	StrokeLine(startPt, endPt);
	SetHighColor(kTextShadow);
	startPt.Set(bounds.left, bounds.bottom);
	endPt.Set(bounds.left, bounds.top);
	StrokeLine(startPt, endPt);
	startPt.Set(bounds.left, bounds.top);
	endPt.Set(bounds.right-1, bounds.top);
	StrokeLine(startPt, endPt);

	// Draw text
	char durationStr[12];
	SetHighColor(kGreen);
	SetLowColor(kBlack);
	BFont font(be_plain_font);
	font.SetSize(12.0);
	SetFont(&font);
	BPoint textPt(fDurationRect.left+8, fDurationRect.top + (fDurationRect.Height()/2) + 4 );
	TimeToString(fCue->Duration(), GetCurrentTimeFormat(), durationStr, false);
	DrawString(durationStr, textPt);

	// Restore Environment
	PopState();
}
Beispiel #10
0
void TVideoEditorText::ConvertToTime(int16 theCell)
{
	int32 oldVal, delta;
	char textBuf[12];
	char tmpStr[3];
	int16 tmpNum;

	// Fill buffer with current text
	strncpy(textBuf, fText, 12);
	tmpStr[2] = '\n';

	/*
	   // Determine current time format and convert text to time
	   if ( GetCurrentTimeFormat() == kSMPTE30)
	   {
	        char	text[256];
	        bool	changed = false;
	        int16	hours, minutes, seconds, frames;

	        TimeToString(fTime, GetCurrentTimeFormat(), text, false);

	        // Stick the new value (if it changed) into the string and reverse calc the time
	        switch (theCell)
	        {
	                // Hours
	                case 1:
	                        oldVal = ((text[1] - '0') * 10) + (text[2] - '0');
	                        if (textBuf[0] != oldVal)
	                        {
	                                text[1] = textBuf[0] / 10 + '0';
	                                textBuf[0] %= 10;
	                                text[2] = textBuf[0] + '0';
	                                changed = true;
	                        }
	                        break;

	                // Minutes
	                case 2:
	                        oldVal = ((text[4] - '0') * 10) + (text[5] - '0');
	                        if (textBuf[1] != oldVal)
	                        {
	                                text[4] = textBuf[1] / 10 + '0';
	                                textBuf[1] %= 10;
	                                text[5] = textBuf[1] + '0';
	                                changed = true;
	                        }
	                        break;

	                // Seconds
	                case 3:
	                        oldVal = ((text[7] - '0') * 10) + (text[8] - '0');
	                        if (textBuf[2] != oldVal)
	                        {
	                                text[7] = textBuf[2] / 10 + '0';
	                                textBuf[2] %= 10;
	                                text[8] = textBuf[2] + '0';
	                                changed = true;
	                        }
	                        break;

	                // Frames
	                case 4:
	                        oldVal = ((text[10] - '0') * 10) + (text[11] - '0');

	                        if (textBuf[3] < 2 && text[7] == '0' && text[8] == '0' && text[5] != '0')
	                                textBuf[3] = 2;

	                        if (textBuf[3] != oldVal)
	                        {
	                                text[10] = textBuf[3] / 10 + '0';
	                                textBuf[3] %= 10;
	                                text[11] = textBuf[3] + '0';
	                                changed = true;
	                        }
	                        break;
	        }

	        if (changed)
	        {
	                hours = ((text[1] - '0') * 10) + (text[2] - '0');
	                minutes = ((text[4] - '0') * 10) + (text[5] - '0');
	                seconds = ((text[7] - '0') * 10) + (text[8] - '0');
	                frames = ((text[10] - '0') * 10) + (text[11] - '0');

	                fTime = (long)hours * 3600000L;				// Hours
	                fTime += (long)(minutes / 10) * 600000;		// Ten minutes
	                minutes %= 10;

	                if (minutes)
	                {
	                        // First minute
	                        fTime += 60060.066;
	                        fTime += ((double)(minutes - 1) * 59993.326);
	                }

	                if (seconds)
	                {
	                        // First second
	                        if (minutes)
	                                fTime += 934;
	                        else
	                                fTime += 1001;
	                        fTime += (long)(seconds - 1) * 1001;
	                }

	                if (frames >= 2 && !seconds && minutes)
	                        frames -= 2;

	                fTime += ((double)(frames + 0.5) * 33.3667);
	        }

	   }
	   else switch (theCell)
	 */
	switch (theCell)
	{
	// Hours
	case 1:
		oldVal = fTime / 3600000;

		strncpy(tmpStr, &textBuf[0], 2);
		tmpNum = atoi(tmpStr);

		if (tmpNum != oldVal) {
			delta = tmpNum - oldVal;
			fTime += (delta * 3600000);
		}
		break;

	// Minutes
	case 2:
		// Convert time to minutes
		oldVal = fTime % 3600000;
		oldVal /= 60000;

		strncpy(tmpStr, &textBuf[3], 2);
		tmpNum = atoi(tmpStr);

		if (tmpNum != oldVal) {
			delta = tmpNum - oldVal;
			fTime += (delta * 60000);
		}
		break;

	// Seconds
	case 3:
		oldVal = fTime % 3600000;
		oldVal %= 60000;
		oldVal /= 1000;

		strncpy(tmpStr, &textBuf[6], 2);
		tmpNum = atoi(tmpStr);

		if (tmpNum != oldVal) {
			delta = tmpNum - oldVal;
			fTime += (delta * 1000);
		}
		break;

	// Frames/100ths
	case 4:
		fTime /= 1000;
		fTime *= 1000;

		strncpy(tmpStr, &textBuf[9], 2);
		tmpNum = atoi(tmpStr);

		switch (GetCurrentTimeFormat())
		{

		case B_TIMECODE_DEFAULT:
			fTime += (tmpNum * 10);
			break;

		case B_TIMECODE_24:
			fTime += ((tmpNum * 1000 + 12) / 24);
			break;

		case B_TIMECODE_25:
			fTime += ((tmpNum * 1000 + 13) / 25);
			break;

		case B_TIMECODE_30_DROP_2:
		case B_TIMECODE_30:
			fTime += ((tmpNum * 1000 + 15) / 30);
			break;
		default:
			break;
		}
		break;
	}
}
Beispiel #11
0
void TVideoEditorText::CheckLastEdit()
{
	char textBuf[2];
	int32 tmpNum;

	// Check for bad characters and number overflow
	switch(fCurrentCell)
	{
	case kHoursCell:
		strncpy(textBuf, &fText[0], 2);
		break;

	case kMinutesCell:
	{
		strncpy(textBuf, &fText[3], 2);

		tmpNum = atoi(textBuf);

		if (tmpNum > 59)
			strncpy(&fText[3], "59", 2);

		Invalidate(fMinutesRect);
	}
	break;

	case kSecondsCell:
	{
		strncpy(textBuf, &fText[6], 2);

		tmpNum = atoi(textBuf);

		if (tmpNum > 59)
			strncpy(&fText[6], "59", 2);

		Invalidate(fSecondsRect);
	}
	break;

	case kFramesCell:
	{
		strncpy(textBuf, &fText[9], 2);

		tmpNum = atoi(textBuf);

		switch (GetCurrentTimeFormat())
		{
		case B_TIMECODE_DEFAULT:
			if (tmpNum > 100)
				strncpy(&fText[9], "99", 2);
			break;

		case B_TIMECODE_24:
			if (tmpNum > 24)
				strncpy(&fText[9], "24", 2);
			break;

		case B_TIMECODE_25:
			if (tmpNum > 25)
				strncpy(&fText[9], "25", 2);
			break;

		case B_TIMECODE_30_DROP_2:
		case B_TIMECODE_30:
			if (tmpNum > 30)
				strncpy(&fText[9], "30", 2);
			break;
		default:
			break;
		}
		Invalidate(fFramesRect);
	}
	break;

	default:
		break;
	}

	ConvertToTime(fCurrentCell);
}
Beispiel #12
0
void TExportZone::TrackZone(BPoint mousePt)
{		
	//	Set up variables	
	const float width 	= m_ExportChannel.Width();	
	const int32 delta 	= mousePt.x - m_ExportChannel.left;			
	
	//	Save mousePt
	BPoint oldPt = mousePt;

	// Check to see if button is down
	uint32 	buttons = 0;
	GetMouse(&mousePt, &buttons, true);	
	
	//	Track while mouse is down
	while(buttons)
	{						
		if (mousePt.x != oldPt.x)		
		{													
			// Save oldRect for redraw														
			BRect oldRect = m_ExportChannel;
			oldRect.left  -= kExportSliderWidth;
			oldRect.right += kExportSliderWidth;
			
			//	Update m_ExportChannel
			m_ExportChannel.left  += mousePt.x - oldPt.x;
			m_ExportChannel.right = m_ExportChannel.left + width;
			
			//	Correct left side bounds violation
			if ( m_ExportChannel.left - kExportSliderWidth < 0)
			{
				m_ExportChannel.left = 0 + kExportSliderWidth;
				m_ExportChannel.right = m_ExportChannel.left + width;
			}

			//	Correct right side bounds violation
			uint32 outPixels = TimeToPixels( Duration() - StartTime(), GetCurrentTimeFormat(), GetCurrentResolution());
			if ( m_ExportChannel.right + kExportSliderWidth > outPixels)
			{
				m_ExportChannel.right = outPixels - kExportSliderWidth;
				m_ExportChannel.left  = m_ExportChannel.right - width;
			}
			
			//	Update m_InRect and m_InRect
			m_InRect.left 	= m_ExportChannel.left - kExportSliderWidth;
			m_InRect.right 	= m_InRect.left + kExportSliderWidth;
		
			m_OutRect.left 	 = m_ExportChannel.right;
			m_OutRect.right	 = m_OutRect.left + kExportSliderWidth;									
													
			//	Update CueSheet variables
			uint32 newInTime  = StartTime() + PixelsToTime(m_InRect.left, GetCurrentTimeFormat(), GetCurrentResolution());
			uint32 newOutTime = StartTime() + PixelsToTime(m_OutRect.right, GetCurrentTimeFormat(), GetCurrentResolution());			
			m_CueSheetWindow->GetCueSheetView()->SetExportStartTime(newInTime);
			m_CueSheetWindow->GetCueSheetView()->SetExportStopTime(newOutTime);
		
			//	Calculate updateRect
			BRect updateRect = oldRect;
			
			//	Did we move forward
			if (updateRect.left < m_InRect.left)
			{
				updateRect.right = m_OutRect.right;
			}
			//	We moved back
			else
			{
				updateRect.left = m_InRect.left;	
			}
			
			//	Force redraw
			if (oldRect != updateRect)
				Invalidate(updateRect);
			
			//	Save point for future compare
			oldPt = mousePt;
			
			//	Update text items
			m_CueSheetWindow->GetExportTimeView()->DrawInText();
			m_CueSheetWindow->GetExportTimeView()->DrawOutText();
		}
						
		// Get new mouse location and button state
		GetMouse(&mousePt, &buttons, true);
		
		//
		//	Clip mouse
		
		// Constrain mouse x to the m_ExportZone
		if (mousePt.x < 0)
			mousePt.x = 0;
				
		//if (mousePt.x >= m_ExportZone.right)
		//	mousePt.x = m_ExportZone.right - (kExportSliderWidth/2);

	}
}
Beispiel #13
0
void TMovieCue::Init()
{				
	bool retVal;
				
	//	Set up RIFFReader
	m_Reader = new TRIFFReader(m_File);
	
	//	Create audio and video codec
	retVal = InitCodecs();
	
	//	Init current frames
	m_CurrentVideoFrame = 0;
	m_CurrentAudioFrame = 0;
	
	//	Get AVIHeader
	AVIHeader *header = m_Reader->GetAVIHeader();
	
	//	Create offscreen
	BRect movieRect( 0, 0, header->Width-1, header->Height-1); 
	m_Bitmap = new BBitmap(movieRect, B_RGB32);
					
	// Default initialization
	TVisualCue::Init();

	// Set up area rectangles	
	m_CuePosition->Outline(movieRect);

	// Editor is closed
	m_EditorOpen = false;
	
	// Set up default settings	
	m_IsLocked 			= false;	
	m_IsSelected 		= false;	
	m_LowColor 			= kWhite;	
	m_HighColor 		= kBlack;	
	m_IsPrepared 		= false;
	m_IsPlaying 		= false;	
	m_IsVisible			= true;	
	m_HasDuration 		= true;					
	m_CanLoop			= true;
	m_CanStretch		= true;		
	m_CanEnvelope		= true;
	m_HasEditor 		= true;		
	m_CanWindow			= true;
	m_CanTransition		= true;
	m_CanPath			= true;
				
	//	Calculate duration in milliseconds
	m_MSecsPerFrame = header->TimeBetweenFrames / 1000;
	m_Duration 	    = header->TotalNumberOfFrames * m_MSecsPerFrame;

		
	// Add the cue to the cue channel
	if ( m_Channel->CanInsertCue(this, m_InsertTime, true))
	{
		m_Channel->InsertCue(this, m_InsertTime);		
		Select();								
				
		// We are now fully instantiated
		m_IsInstantiated = true;
	}
	
	// Adjust cue length based on duration
	ResizeTo( TimeToPixels(m_Duration, GetCurrentTimeFormat(), GetCurrentResolution()), Bounds().Height());		
}
Beispiel #14
0
void TTimeTextView::CheckLastEdit()
{
	char 	textBuf[2];
	int32	tmpNum;
	
	// Check for bad characters and number overflow
	switch(m_CurrentCell)
	{
		// Hours
		case 1:
			GetText(0, 2, textBuf);
			if (textBuf[1] == ':')
				Insert(0, "0", 1);
			break;
			
		// Minutes
		case 2:
			{
				GetText(3, 2, textBuf);
				if (textBuf[1] == ':')
					Insert(3, "0", 1);		
				
				// Get adjusted text
				GetText(3, 2, textBuf);
				tmpNum = atoi(textBuf);
				
				if (tmpNum > 59)
				{
					Delete(3, 5);
					Insert(3, "59", 2);
				}		
			}
			break;
			
		// Seconds
		case 3:
			{
				GetText(6, 2, textBuf);
				if (textBuf[1] == ':')
					Insert(6, "0", 1);	
					
				// Get adjusted text
				GetText(6, 2, textBuf);
				tmpNum = atoi(textBuf);
				
				if (tmpNum > 59)
				{
					Delete(6, 8);
					Insert(6, "59", 2);
				}
			}			
			break;
					
		case 4:
			{
				GetText(8, 2, textBuf);
				if (textBuf[0] == ':')
					Insert(9, "0", 1);
				
				// Get adjusted text
				GetText(9, 2, textBuf);
				tmpNum = atoi(textBuf);

				switch (GetCurrentTimeFormat())
				{
					case B_TIMECODE_DEFAULT:
						if (tmpNum > 100)
						{
							Delete(9, 12);
							Insert(9, "99", 2);
						}
						break;
					
					case B_TIMECODE_24:
						if (tmpNum > 24)
						{
							Delete(9, 12);
							Insert(9, "24", 2);
						}
						break;
						
					case B_TIMECODE_25:
						if (tmpNum > 25)
						{
							Delete(9, 12);
							Insert(9, "25", 2);
						}
						break;
						
					case B_TIMECODE_30_DROP_2:
					case B_TIMECODE_30:
						if (tmpNum > 30)
						{
							Delete(9, 12);
							Insert(9, "30", 2);
						}
						break;																
				}				
			}
			break;
			
		default:
			break;
	}
	
	ConvertToTime(m_CurrentCell);
}