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; } }
bool CDisplaySettings::OnSettingChanging(const CSetting *setting) { if (setting == NULL) return false; const std::string &settingId = setting->GetId(); if (settingId == CSettings::SETTING_VIDEOSCREEN_RESOLUTION || settingId == CSettings::SETTING_VIDEOSCREEN_SCREEN) { RESOLUTION newRes = RES_DESKTOP; if (settingId == CSettings::SETTING_VIDEOSCREEN_RESOLUTION) newRes = (RESOLUTION)((CSettingInt*)setting)->GetValue(); else if (settingId == CSettings::SETTING_VIDEOSCREEN_SCREEN) { int screen = ((CSettingInt*)setting)->GetValue(); // if triggered by a change of screenmode, screen may not have changed if (screen == GetCurrentDisplayMode()) return true; // get desktop resolution for screen newRes = GetResolutionForScreen(); } std::string screenmode = GetStringFromResolution(newRes); CSettings::Get().SetString(CSettings::SETTING_VIDEOSCREEN_SCREENMODE, screenmode); } if (settingId == CSettings::SETTING_VIDEOSCREEN_SCREENMODE) { RESOLUTION oldRes = GetCurrentResolution(); RESOLUTION newRes = GetResolutionFromString(((CSettingString*)setting)->GetValue()); SetCurrentResolution(newRes, false); g_graphicsContext.SetVideoResolution(newRes); // check if the old or the new resolution was/is windowed // in which case we don't show any prompt to the user if (oldRes != RES_WINDOW && newRes != RES_WINDOW && oldRes != newRes) { if (!m_resolutionChangeAborted) { bool cancelled = false; if (!CGUIDialogYesNo::ShowAndGetInput(CVariant{13110}, CVariant{13111}, cancelled, CVariant{""}, CVariant{""}, 10000)) { m_resolutionChangeAborted = true; return false; } } else m_resolutionChangeAborted = false; } } else if (settingId == CSettings::SETTING_VIDEOSCREEN_MONITOR) { g_Windowing.UpdateResolutions(); RESOLUTION newRes = GetResolutionForScreen(); SetCurrentResolution(newRes, false); g_graphicsContext.SetVideoResolution(newRes, true); if (!m_resolutionChangeAborted) { bool cancelled = false; if (!CGUIDialogYesNo::ShowAndGetInput(CVariant{13110}, CVariant{13111}, cancelled, CVariant{""}, CVariant{""}, 10000)) { m_resolutionChangeAborted = true; return false; } } else m_resolutionChangeAborted = false; return true; } #if defined(HAS_GLX) else if (settingId == CSettings::SETTING_VIDEOSCREEN_BLANKDISPLAYS) { g_Windowing.UpdateResolutions(); } #endif return true; }
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(); }
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); } }
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()); }