void TElementsView::FrameResized(float w,float h) { AdjustScrollBars(); DrawDragRect(); BView::FrameResized(w, h); }
void TElementsView::Init() { // Grey background SetViewColor(kBeGrey); // Create Tracker Sorter BRect sorterRect = Bounds(); sorterRect.right -= kScrollWidth+1; sorterRect.bottom -= kScrollHeight+1; fSorter = new TElementsSorter(sorterRect, this); AddChild(fSorter); // // Create scroll bars // // Horizontal BRect scrollRect = Bounds(); scrollRect.Set(scrollRect.left, scrollRect.bottom-kScrollHeight, scrollRect.right-kScrollWidth, scrollRect.bottom); fHScroll = new TElementsScrollBarH(scrollRect, "HElementsScroll", fSorter, 0, 100); AddChild(fHScroll); // Vertical scrollRect = Bounds(); scrollRect.Set(scrollRect.right-kScrollWidth, scrollRect.top, scrollRect.right, scrollRect.bottom-kScrollHeight); fVScroll = new TElementsScrollBarV(scrollRect, "VElementsScroll", fSorter, 0, 100); AddChild(fVScroll); AdjustScrollBars(); }
/* フォーカス移動時の再描画 @date 2001/06/21 asa-o 「スクロールバーの状態を更新する」「カーソル移動」削除 */ void CEditView::RedrawAll() { if( NULL == GetHwnd() ){ return; } if( GetDrawSwitch() ){ // ウィンドウ全体を再描画 PAINTSTRUCT ps; HDC hdc = ::GetDC( GetHwnd() ); ::GetClientRect( GetHwnd(), &ps.rcPaint ); OnPaint( hdc, &ps, FALSE ); ::ReleaseDC( GetHwnd(), hdc ); } // キャレットの表示 GetCaret().ShowEditCaret(); // キャレットの行桁位置を表示する GetCaret().ShowCaretPosInfo(); // 親ウィンドウのタイトルを更新 m_pcEditWnd->UpdateCaption(); // Jul. 9, 2005 genta 選択範囲の情報をステータスバーへ表示 GetSelectionInfo().PrintSelectionInfoMsg(); // スクロールバーの状態を更新する AdjustScrollBars(); }
void ImageView::FrameResized(float width, float height) { AdjustScrollBars(); if (!HasImage()) Invalidate(); }
void CXTPReportControl::ShowFooterRows(BOOL bShow) { m_pSectionFooter->SetVisible(bShow); if (!bShow) GetNavigator()->SetCurrentFocusInFootersRows(FALSE); AdjustLayout(); AdjustScrollBars(); }
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) { KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL(); // Display the same view after canvas switching if( aEnable ) { // Switch to GAL renderer from legacy if( !m_galCanvasActive ) { // Set up viewport double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() ); view->SetScale( zoom ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); } // Set up grid settings gal->SetGridVisibility( IsGridVisible() ); gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) ); // Transfer EDA_DRAW_PANEL settings GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() ); GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); GetGalCanvas()->GetViewControls()->EnableAutoPan( m_canvas->GetEnableAutoPan() ); } else if( m_galCanvasActive ) { // Switch to legacy renderer from GAL double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); // TODO replace it with EDA_DRAW_PANEL_GAL::GetLegacyZoom m_canvas->SetZoom( 1.0 / ( zoomFactor * view->GetScale() ) ); VECTOR2D center = view->GetCenter(); AdjustScrollBars( wxPoint( center.x, center.y ) ); } m_canvas->SetEvtHandlerEnabled( !aEnable ); GetGalCanvas()->SetEvtHandlerEnabled( aEnable ); // Switch panes m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable ); m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.Update(); // Reset current tool on switch(); SetNoToolSelected(); m_galCanvasActive = aEnable; }
void TElementsView::MessageReceived(BMessage* theMessage) { switch( theMessage->what) { // Mouse moved. Send resize message to parent case MW_MOUSE_MOVED: { BPoint mousePt; if ( theMessage->FindPoint("where", &mousePt) == B_OK) { // Conver mousePt to screen coordinate ConvertToScreen(&mousePt); // Get new window bounds BRect frame = Window()->Frame(); frame.right = mousePt.x; frame.bottom = mousePt.y; // Adjust size to keep mouse centered in DragRect frame.right += kDragRectWidth/2; frame.bottom += kDragRectHeight/2; // Resize Window()->ResizeTo(frame.Width(), frame.Height()); } } break; // A sorter is being dragged. Adjust scroll bars... case SORTER_RESIZE_MSG: AdjustScrollBars(); break; case SORTER_SELECT_MSG: case SORTER_INVOKE_MSG: fSorter->MessageReceived(theMessage); break; // Add the ref to our browser case ADD_REF_MSG: fSorter->MessageReceived(theMessage); break; default: BView::MessageReceived(theMessage); break; } }
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) { if( m_galCanvasActive == aEnable ) return; KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL(); double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); BASE_SCREEN* screen = GetScreen(); // Display the same view after canvas switching if( aEnable ) // Switch to GAL rendering { // Set up viewport double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() ); view->SetScale( zoom ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); // Set up grid settings gal->SetGridVisibility( IsGridVisible() ); gal->SetGridSize( VECTOR2D( screen->GetGridSize() ) ); gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) ); } else // Switch to standard rendering { // Change view settings only if GAL was active previously double zoom = 1.0 / ( zoomFactor * view->GetScale() ); m_canvas->SetZoom( zoom ); VECTOR2D center = view->GetCenter(); AdjustScrollBars( wxPoint( center.x, center.y ) ); } m_canvas->SetEvtHandlerEnabled( !aEnable ); GetGalCanvas()->SetEvtHandlerEnabled( aEnable ); // Switch panes m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable ); m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.Update(); // Reset current tool on switch(); SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString ); m_galCanvasActive = aEnable; }
void CXTPReportControl::PinFooterRows(BOOL bPin) { if (bPin) { m_pSectionBody ->SetHeightMode(xtpReportSectionHeightModeAutoShrink); m_pSectionFooter->SetHeightMode(xtpReportSectionHeightModeAutoExpand); //m_pSectionFooter->GetBorder()->GetBorderThickness()->SetTop(0); } else { m_pSectionBody ->SetHeightMode(xtpReportSectionHeightModeExpand); m_pSectionFooter->SetHeightMode(xtpReportSectionHeightModeAuto); //m_pSectionFooter->GetBorder()->GetBorderThickness()->SetTop(1); } m_bPinFooterRows = bPin; AdjustLayout(); AdjustScrollBars(); }
void WinEDA_DrawFrame::Recadre_Trace(bool ToMouse) /**************************************************/ /* Calcule les offsets de trace. Les offsets sont ajustés a un multiple du pas de grille si ToMouse == TRUE, le curseur souris (curseur "systeme") est replace en position curseur graphique (curseur kicad) Note: Mac OS ** do not ** allow moving mouse cursor by program. */ { /* decalages a apporter au trace en coordonnees ecran */ PutOnGrid(& m_CurrentScreen->m_Curseur) ; AdjustScrollBars(); ReDrawPanel(); /* Place le curseur souris sur le curseur SCHEMA*/ if ( ToMouse == TRUE ) DrawPanel->MouseToCursorSchema(); }
void CXTPReportControl::SetFullColumnScrolling(BOOL bSet) { if (bSet) { m_scrollModeH = xtpReportScrollModeBlock; } else { m_scrollModeH = xtpReportScrollModeSmooth; } if (m_hWnd) { CXTPReportControl::OnHScroll(SB_TOP, 0, NULL); RedrawControl(); UpdateWindow(); AdjustScrollBars(); } }
//********************************************************************************** void CBCGPRibbonBackstageViewPanel::OnPageTransitionFinished() { ASSERT_VALID(this); if (m_pNewSelected == NULL) { return; } ASSERT_VALID(m_pNewSelected); if (m_pSelected != NULL) { ASSERT_VALID(m_pSelected); CBCGPBaseRibbonElement* pView = m_pSelected->GetBackstageAttachedView(); if (pView != NULL) { ASSERT_VALID(pView); pView->SetRect(CRect(0, 0, 0, 0)); pView->OnAfterChangeRect(NULL); } m_pSelected->m_bIsChecked = FALSE; RedrawElement(m_pSelected); } m_pSelected = m_pNewSelected; ReposActiveForm(); AdjustScrollBars(); ReposActiveForm(); RedrawElement(m_pSelected); m_pNewSelected = NULL; }
//********************************************************************************** void CBCGPRibbonBackstageViewPanel::SelectView(CBCGPBaseRibbonElement* pElem) { ASSERT_VALID(this); m_pNewSelected = NULL; if (pElem == NULL) { return; } ASSERT_VALID(pElem); if (pElem->IsDisabled()) { return; } if (pElem != m_pSelected && pElem->GetBackstageAttachedView() != NULL) { if (m_pSelected != NULL) { ASSERT_VALID(m_pSelected); if (m_pMainButton->GetParentRibbonBar () != NULL) { ASSERT_VALID (m_pMainButton->GetParentRibbonBar ()); m_PageTransitionEffect = m_pMainButton->GetParentRibbonBar ()->GetBackstagePageTransitionEffect(); m_nPageTransitionTime = m_pMainButton->GetParentRibbonBar ()->GetBackstagePageTransitionTime(); } if (m_bSelectedByMouseClick && m_PageTransitionEffect != BCGPPageTransitionNone && !globalData.IsHighContastMode()) { m_bSelectedByMouseClick = FALSE; CBCGPRibbonBackstageViewItemForm* pForm1 = DYNAMIC_DOWNCAST(CBCGPRibbonBackstageViewItemForm, m_pSelected->GetBackstageAttachedView()); if (pForm1 != NULL && pForm1->m_pWndForm->GetSafeHwnd() != NULL) { HWND hwndPanel = GetParentMenuBar()->GetSafeHwnd(); GetParentMenuBar()->SetRedraw(FALSE); CBCGPRibbonBackstageViewItemForm* pForm2 = DYNAMIC_DOWNCAST(CBCGPRibbonBackstageViewItemForm, pElem->GetBackstageAttachedView()); if (pForm2 != NULL && hwndPanel != NULL) { if (pForm2->m_pWndForm == NULL) { pForm2->m_pWndForm = pForm2->OnCreateFormWnd(); } if (pForm2->m_pWndForm->GetSafeHwnd() != NULL) { m_pNewSelected = pElem; ReposActiveForm(); pForm1->m_pWndForm->ShowWindow(SW_HIDE); pForm2->m_pWndForm->ShowWindow(SW_HIDE); CSize szPageMax(m_rect.Width(), 0); m_clrFillFrame = CBCGPVisualManager::GetInstance()->IsRibbonBackstageWhiteBackground() ? RGB(255, 255, 255) : globalData.clrBarFace; m_pNewSelected->m_bIsChecked = TRUE; m_pSelected->m_bIsChecked = FALSE; if (StartPageTransition(hwndPanel, pForm1->m_pWndForm->GetSafeHwnd(), pForm2->m_pWndForm->GetSafeHwnd(), m_pSelected->GetRect().top > pElem->GetRect().top, CSize(0, 0), szPageMax)) { RedrawElement(m_pSelected); return; } GetParentMenuBar()->SetRedraw(TRUE); } } } } CBCGPBaseRibbonElement* pView = m_pSelected->GetBackstageAttachedView(); if (pView != NULL) { ASSERT_VALID(pView); pView->SetRect(CRect(0, 0, 0, 0)); pView->OnAfterChangeRect(NULL); } m_pSelected->m_bIsChecked = FALSE; RedrawElement(m_pSelected); } m_pSelected = pElem; m_pSelected->m_bIsChecked = TRUE; ReposActiveForm(); AdjustScrollBars(); ReposActiveForm(); RedrawElement(m_pSelected); } }
//******************************************************************************** void CBCGPRibbonBackstageViewPanel::Repos (CDC* pDC, const CRect& rect) { CBCGPRibbonMainPanel::Repos(pDC, rect); if (m_pSelected == NULL && !m_bIsCalcWidth) { CBCGPRibbonPanelMenuBar* pMenuBar = DYNAMIC_DOWNCAST(CBCGPRibbonPanelMenuBar, GetParentWnd()); if (pMenuBar != NULL) { CFrameWnd* pTarget = (CFrameWnd*) pMenuBar->GetCommandTarget (); if (pTarget == NULL || !pTarget->IsFrameWnd()) { pTarget = BCGPGetParentFrame(pMenuBar); } if (pTarget != NULL) { pMenuBar->OnUpdateCmdUI(pTarget, TRUE); } } if (m_pMainButton != NULL) { ASSERT_VALID(m_pMainButton); if (m_pMainButton->GetParentRibbonBar () != NULL) { ASSERT_VALID (m_pMainButton->GetParentRibbonBar ()); int nInitialPage = m_pMainButton->GetParentRibbonBar ()->GetInitialBackstagePage(); int nDefaultPage = m_pMainButton->GetParentRibbonBar ()->GetDefaultBackstagePage(); int nStartPage = (nInitialPage == -1) ? nDefaultPage : nInitialPage; if (nStartPage >= 0) { int nPage = 0; for (int i = 0; i < m_arElements.GetSize (); i++) { CBCGPBaseRibbonElement* pElem = m_arElements [i]; ASSERT_VALID (pElem); if (pElem->GetBackstageAttachedView() != NULL) { if (nPage == nStartPage) { if (!pElem->IsDisabled()) { m_pSelected = pElem; m_pSelected->m_bIsChecked = TRUE; } break; } nPage++; } } } } } if (m_pSelected == NULL) { for (int i = 0; i < m_arElements.GetSize (); i++) { CBCGPBaseRibbonElement* pElem = m_arElements [i]; ASSERT_VALID (pElem); if (!pElem->IsDisabled() && pElem->GetBackstageAttachedView() != NULL) { m_pSelected = pElem; m_pSelected->m_bIsChecked = TRUE; break; } } } if (m_pHighlighted == NULL) { m_pHighlighted = m_pSelected; } } m_rectRight = rect; m_rectRight.left = m_rectMenuElements.right; m_rectRight.top -= m_nScrollOffset; if (m_bIsCalcWidth) { return; } AdjustScrollBars(); ReposActiveForm(); }
bool wxJigsawEditorCanvas::AutoScroll(const wxPoint & currentPos, const wxPoint & scrollPos) { bool res = false; // If mouse is captured set rect coords if inside the image and autoscroll if posible // get image display rectangle wxRect displayRect = GetDisplayRect(scrollPos); wxSize oldSelection(m_TR.x-m_BL.x, m_TR.y-m_BL.y); // check if the current drag position is inside the image - do not allow to draw rectangle out of the image m_TR.x = wxMin(wxMax(currentPos.x, displayRect.GetLeft()), displayRect.GetRight()); m_TR.y = wxMin(wxMax(currentPos.y, displayRect.GetTop()), displayRect.GetBottom()); // Check current drag position and update scroll regularly if(currentPos.x <= 0) { Scroll(wxPoint(wxMax(scrollPos.x - wxJigsawEditorCanvas::ScrollIncrement, 0), -1)); m_BL.x += (scrollPos.x - GetScrollPosition().x); res = true; } if(currentPos.y <= 0) { Scroll(wxPoint(-1,wxMax(scrollPos.y - wxJigsawEditorCanvas::ScrollIncrement, 0))); m_BL.y += (scrollPos.y - GetScrollPosition().y); res = true; } if(currentPos.x >= GetClientSize().GetWidth()) { Scroll(wxPoint(scrollPos.x + wxJigsawEditorCanvas::ScrollIncrement, -1)); m_BL.x -= (GetScrollPosition().x - scrollPos.x); res = true; } if(currentPos.y >= GetClientSize().y) { Scroll(wxPoint(-1, scrollPos.y + wxJigsawEditorCanvas::ScrollIncrement)); m_BL.y -= (GetScrollPosition().y - scrollPos.y); res = true; } m_SelectionRect = wxRect(wxMin(m_TR.x, m_BL.x), wxMin(m_TR.y, m_BL.y), abs(m_TR.x-m_BL.x), abs(m_TR.y-m_BL.y)); if(HasCapture()) { if(m_View && m_View->GetSelectedObject() && (m_Mode == wxJSEC_MODE_DRAGGING)) { /*wxSize offset(m_TR.x-m_BL.x-oldSelection.GetWidth(), m_TR.y-m_BL.y-oldSelection.GetHeight());*/ wxPoint cursorPosOnDiagram = currentPos; cursorPosOnDiagram.x /= m_View->GetScale(); cursorPosOnDiagram.y /= m_View->GetScale(); cursorPosOnDiagram.x -= m_View->GetViewOffset().x; cursorPosOnDiagram.y -= m_View->GetViewOffset().y; m_SelectedObjectOffset.x /= m_View->GetScale(); m_SelectedObjectOffset.y /= m_View->GetScale(); m_View->GetSelectedObject()->Drag(m_DoubleBufferDC, cursorPosOnDiagram, m_SelectedObjectOffset, m_View->GetScale()); GetDocument()->Modify(true); AdjustScrollBars(); } } return res; }
void TCueSheetWindow::Init() { // Init Undo Engine fUndoEngine = new TUndoEngine(); // Member file used for saves fFile = NULL; // Dialog box state fPanelOpen = false; // Create the stage window BRect stageRect(0,0,420,340); fStageWindow = new TStageWindow(stageRect, this); CenterWindow(fStageWindow); // Set up menu bar BRect mbarRect = Bounds(); mbarRect.bottom = mbarRect.top+kMenuHeight; BMenuBar* mbar = new BMenuBar(mbarRect, "MuseumMenu"); // Set up application menus. // Create a new TMuseumMenu object and pass the BMenuBar object in to the constructor. // Then add the individual menu items with the TMuseumMenu object fAppMenu = new TMuseumMenus(mbar); AddChild(mbar); // Set the channel length to an hour duration in milliseconds float channelLength = TimeToPixels( 60 * 60 * 1000L, B_TIMECODE_24, 3); // Create Toolbar. It is always at the top of the window, below the menu. BRect toolRect = Bounds(); toolRect.Set(toolRect.left, kMenuHeight, toolRect.right, kMenuHeight+kToolbarHeight); fToolbar = new TToolbar(toolRect, this); AddChild(fToolbar); fToolbar->Show(); // Create ExportTimeView. It is always located below the toolbar and to the // very left of the cue sheet. It is as wide as the cue sheet headers. BRect exportTimeRect; exportTimeRect.left = fToolbar->Frame().left; exportTimeRect.top = fToolbar->Frame().bottom+1; exportTimeRect.right = exportTimeRect.left + kHeaderWidth; exportTimeRect.bottom = exportTimeRect.top + kExportZoneHeight + 11; fExportTimeView = new TExportTimeView(this, exportTimeRect); AddChild(fExportTimeView); fExportTimeView->Show(); // Create CueSheet Time Zone. It is always located below the toolbar and to the // very left of the cue sheet. It is as wide as the cue sheet headers. BRect zoneRect; zoneRect.left = exportTimeRect.left; zoneRect.top = exportTimeRect.bottom+1; zoneRect.right = zoneRect.left+kHeaderWidth; zoneRect.bottom = zoneRect.top + kTimelineHeight - 11; fTimeZone = new TCueSheetTimeView(this, zoneRect); AddChild(fTimeZone); fTimeZone->Show(); // Create ExportZone. It is always located below the toolbar and to the right // of the TimeZone. This is where the user determines the span of the cue sheet // to preview or export BRect exportRect; exportRect.left = zoneRect.right + 1; exportRect.top = fToolbar->Frame().bottom+1; exportRect.right = Bounds().right; exportRect.bottom = exportRect.top + kExportZoneHeight; fExportZone = new TExportZone(exportRect, this); AddChild(fExportZone); fExportZone->Show(); // Create Timeline. It is always located below the toolbar and to the right // of the TimeZone. This is where the time is indicated and the playback head resides BRect timeRect; timeRect.left = exportRect.left; timeRect.top = exportRect.bottom + 1; timeRect.right = Bounds().right; timeRect.bottom = timeRect.top + kTimelineHeight; fTimeline = new TTimelineView(timeRect, this); AddChild(fTimeline); fTimeline->Show(); // Create Header Container View BRect containerRect = Bounds(); containerRect.top = fTimeline->Frame().bottom; containerRect.right = containerRect.left + kHeaderWidth; containerRect.bottom -= kScrollHeight+1; fHeaderContainer = new THeaderContainerView(containerRect); AddChild(fHeaderContainer); fHeaderContainer->SetViewColor(kMediumGrey); // Create cue sheet view. Add one pixel to left to fix drawing bug with header... BRect bounds = fTimeline->Frame(); bounds.Set(bounds.left, bounds.bottom+1, Bounds().right-(kScrollWidth+1), Bounds().bottom - (kScrollHeight+1)); fCueSheetView = new TCueSheetView(bounds, this); fCueSheetView->SetViewColor(kGrey); // // Create scroll bars // // Horizontal BRect scrollRect = Bounds(); scrollRect.Set(scrollRect.left+kTimeScalerWidth, scrollRect.bottom-kScrollHeight, scrollRect.right-kScrollWidth, scrollRect.bottom); fHScroll = new TCueSheetScrollBarH(this, scrollRect, NULL, 0, channelLength); AddChild(fHScroll); fHScroll->SetSteps(kTickSpacing, kTickSpacing*4); // Vertical scrollRect = Bounds(); scrollRect.Set(scrollRect.right-kScrollWidth, scrollRect.top + (fTimeline->Frame().bottom+1), scrollRect.right, scrollRect.bottom-kScrollHeight); fVScroll = new TCueSheetScrollBarV(this, scrollRect, fCueSheetView, 0, channelLength); AddChild(fVScroll); fVScroll->SetSteps(kTickSpacing, kTickSpacing*4); // Create TimeScaler BRect scalerRect(0, Bounds().bottom-14,kTimeScalerWidth, Bounds().bottom); fTimeScaler = new TTimeScalerView(scalerRect, fCueSheetView); AddChild(fTimeScaler); // Limit the window size SetSizeLimits( 280, 1500, 280, 1500); // Add CueSheetView to frame AddChild(fCueSheetView); // Adjust the scroll bars AdjustScrollBars(); // Add ourself to cue sheet list static_cast<MuseumApp*>(be_app)->GetCueSheetList()->AddItem(this); // Create the video engine fVideoEngine = new TVideoEngine(fCueSheetView); ASSERT(fVideoEngine); // Create audio engine fAudioEngine = new TAudioEngine(); // Set Pulse rate for views that need it SetPulseRate(5000); }
void CCellView::SelectCell(BPoint where) { cell curCell, anchorCell, oldCurCell, tmpCell, prevCurCell; BPoint cPoint; range r, prevSel; BRegion lastSelectionRgn, newSelectionRgn; bool updateBorders = (fSelection.top == 1 && fSelection.bottom == kRowCount) || (fSelection.left == 1 && fSelection.right == kColCount); BMessage * current = Window()->CurrentMessage(); int32 modifiers; FailOSErr(current->FindInt32("modifiers", &modifiers), errMessageMissing); prevSel = fSelection; prevCurCell = fCurCell; StClipCells clip(this); ClearAnts(); cPoint = where; (void)GetCellHitBy(cPoint, curCell); if (!fEntering) HiliteSelection(false, false); if (!fEntering && modifiers & B_SHIFT_KEY) { if (curCell.v < fSelection.top) anchorCell.v = fSelection.bottom; else anchorCell.v = fSelection.top; if (curCell.h < fSelection.left) anchorCell.h = fSelection.right; else anchorCell.h = fSelection.left; fSelection.Set(std::min(anchorCell.h, curCell.h), std::min(anchorCell.v, curCell.v), std::max(anchorCell.h, curCell.h), std::max(anchorCell.v, curCell.v)); } else { anchorCell.h = r.right = r.left = curCell.h; anchorCell.v = r.bottom = r.top = curCell.v; fCurCell = curCell; fSelection = r; } if (!fEntering) HiliteSelection(false, true); DrawStatus(); if (updateBorders) DrawBorders(); oldCurCell = curCell; ulong buttons; GetMouse(&cPoint, &buttons); while (buttons) { (void)GetCellHitBy(cPoint, curCell); SelectionToRegion(lastSelectionRgn); if (curCell.v == anchorCell.v) r.bottom = r.top = curCell.v; else if (curCell.v < anchorCell.v) { r.top = curCell.v; r.bottom = anchorCell.v; } else { r.bottom = curCell.v; r.top = anchorCell.v; } if (curCell.h == anchorCell.h) r.right = r.left = curCell.h; else if (curCell.h < anchorCell.h) { r.left = curCell.h; r.right = anchorCell.h; } else { r.right = curCell.h; r.left = anchorCell.h; } if (fEntering && ((oldCurCell.v != curCell.v) || (oldCurCell.h != curCell.h))) ClearAnts(); fSelection = r; SelectionToRegion(newSelectionRgn); if (!fEntering) ChangeSelection(&lastSelectionRgn, &newSelectionRgn); if (((fCurCell.v != fSelection.top) || (fCurCell.h != fSelection.left)) && !fEntering) ClearAnts(); fCurCell = fSelection.TopLeft(); if (oldCurCell.v != curCell.v || oldCurCell.h != curCell.h) { DrawStatus(); tmpCell = fCurCell; fCurCell = curCell; if (fEntering) fSelection = prevSel; AdjustScrollBars(); ScrollToSelection(); fSelection = r; fCurCell = tmpCell; } MarchAnts(); oldCurCell = curCell; GetMouse(&cPoint, &buttons); } if (fEntering) { ClearAnts(); fEditBox->EnterRange(fSelection); fSelection = prevSel; fCurCell = prevCurCell; } else fCurCell = fSelection.TopLeft(); AdjustScrollBars(); DrawStatus(); }
void ImageView::SetImage(BMessage *pmsg) { // Replace current image with the image // specified in the given BMessage entry_ref ref; if (!pmsg) ref = fcurrentRef; else if (pmsg->FindRef("refs", &ref) != B_OK) // If refs not found, just ignore the message return; StatusCheck chk; try { BFile file(&ref, B_READ_ONLY); chk = file.InitCheck(); BTranslatorRoster roster, *proster; proster = SelectTranslatorRoster(roster); if (!proster) // throw exception chk = B_ERROR; // determine what type the image is translator_info tinfo; BMessage ioExtension; if (ref != fcurrentRef) // if new image, reset to first document fdocumentIndex = 1; chk = ioExtension.AddInt32("/documentIndex", fdocumentIndex); chk = proster->Identify(&file, &ioExtension, &tinfo, 0, NULL, B_TRANSLATOR_BITMAP); // perform the actual translation BBitmapStream outstream; chk = proster->Translate(&file, &tinfo, &ioExtension, &outstream, B_TRANSLATOR_BITMAP); BBitmap *pbitmap = NULL; chk = outstream.DetachBitmap(&pbitmap); delete fpbitmap; fpbitmap = pbitmap; pbitmap = NULL; fcurrentRef = ref; // need to keep the ref around if user wants to switch pages int32 documentCount = 0; if (ioExtension.FindInt32("/documentCount", &documentCount) == B_OK && documentCount > 0) fdocumentCount = documentCount; else fdocumentCount = 1; // Set the name of the Window to reflect the file name BWindow *pwin = Window(); BEntry entry(&ref); BPath path; if (entry.InitCheck() == B_OK) { if (path.SetTo(&entry) == B_OK) pwin->SetTitle(path.Leaf()); else pwin->SetTitle(IMAGEWINDOW_TITLE); } else pwin->SetTitle(IMAGEWINDOW_TITLE); UpdateInfoWindow(path, ioExtension, tinfo, proster); // Resize parent window and set size limits to // reflect the size of the new bitmap float width, height; BMenuBar *pbar = pwin->KeyMenuBar(); width = fpbitmap->Bounds().Width() + B_V_SCROLL_BAR_WIDTH + (BORDER_WIDTH * 2); height = fpbitmap->Bounds().Height() + pbar->Bounds().Height() + B_H_SCROLL_BAR_HEIGHT + (BORDER_HEIGHT * 2) + 1; BScreen *pscreen = new BScreen(pwin); BRect rctscreen = pscreen->Frame(); if (width > rctscreen.Width()) width = rctscreen.Width(); if (height > rctscreen.Height()) height = rctscreen.Height(); pwin->SetSizeLimits(B_V_SCROLL_BAR_WIDTH * 4, width, pbar->Bounds().Height() + (B_H_SCROLL_BAR_HEIGHT * 4) + 1, height); pwin->SetZoomLimits(width, height); AdjustScrollBars(); //pwin->Zoom(); // Perform all of the hard work of resizing the // window while taking into account the size of // the screen, the tab and borders of the window // // HACK: Need to fix case where window un-zooms // when the window is already the correct size // for the current image // repaint view Invalidate(); } catch (StatusNotOKException) { BAlert *palert = new BAlert(NULL, B_TRANSLATE("Sorry, unable to load the image."), B_TRANSLATE("OK")); palert->Go(); } }
void ImageView::AttachedToWindow() { AdjustScrollBars(); }
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 TCueSheetWindow::FrameResized( float newWidth, float newHeight) { AdjustScrollBars(); BWindow::FrameResized(newWidth, newHeight); }
void PictureViewer::FrameResized( float x, float y ) { AdjustScrollBars(); Refresh(); }
TCueSheetWindow::TCueSheetWindow(BMessage* data) : BWindow (data) { // // Rehydrate the cue from message data // // Init Undo Engine fUndoEngine = new TUndoEngine(); // Set up variable settings fFile = NULL; // Dialog box state fPanelOpen = false; // Update menu pointers BMenuBar* badBar = (BMenuBar*)FindView("MuseumMenu"); RemoveChild(badBar); delete badBar; // // Create new menu... // Set up menu bar BRect mbarRect = Bounds(); mbarRect.bottom = mbarRect.top+kMenuHeight; BMenuBar* mbar = new BMenuBar(mbarRect, "MuseumMenu"); // Create a new TMuseumMenu object and pass the BMenuBar object in to the constructor. // Then add the individual menu items with the TMuseumMenu object fAppMenu = new TMuseumMenus(mbar); AddChild(mbar); // Update pointers to child views fStageWindow = (TStageWindow*)FindWindow("Stage"); fHeaderContainer = (THeaderContainerView*)FindView("HeaderContainerView"); fToolbar = (TToolbar*)FindView("TooolbarView"); fTimeZone = (TCueSheetTimeView*)FindView("TimeZoneView"); fExportTimeView = (TExportTimeView*)FindView("ExportTimeView"); fExportZone = (TExportZone*)FindView("ExportZoneView"); fTimeline = (TTimelineView*)FindView("TimelineView"); fCueSheetView = (TCueSheetView*)FindView("CueSheetView"); if (!fCueSheetView) printf("TCSW:TCSW fCueSheetView is null!\n"); fHScroll = (TCueSheetScrollBarH*)FindView("HCueScroll"); fVScroll = (TCueSheetScrollBarV*)FindView("VCueScroll"); fTimeScaler = (TTimeScalerView*)FindView("TimeScalerView"); // Match CueChannels to CueChannelHeaders printf("TCSW:TCSW GetChannelList start\n"); for(int32 index = 0; index < fCueSheetView->GetChannelList()->CountItems(); index++) { TCueChannelHeader* header = (TCueChannelHeader*)fHeaderContainer->ChildAt(index); TCueChannel* channel = (TCueChannel*)fCueSheetView->GetChannelList()->ItemAt(index); header->SetChannel(channel); channel->SetHeader(header); } printf("TCSW:TCSW GetChannelList end\n"); // Set scrollbar targets fHScroll->SetTarget(fCueSheetView); fVScroll->SetTarget(fCueSheetView); // Adjust the scroll bars AdjustScrollBars(); // Add ourself to cue sheet list static_cast<MuseumApp*>(be_app)->GetCueSheetList()->AddItem(this); // Create playbackEngine fVideoEngine = new TVideoEngine(fCueSheetView); ASSERT(fVideoEngine); // Attach palettes and stage to playbackEngine //TTimePalette *timePalette = static_cast<MuseumApp*>(be_app)->GetTimePalette(); //ASSERT(timePalette); //timePalette->GetTimePaletteView()->ConnectToPlaybackEngine(fPlaybackEngine); //TTransportPalette *transport = static_cast<MuseumApp*>(be_app)->GetTransport(); //ASSERT(transport); //transport->GetTransportPaletteView()->ConnectToPlaybackEngine(fPlaybackEngine); }
// Refresh -- Should anything change within the View, this is the method // to call. it does everything you need to. // It also handles the refreshing of only the refresh-needing parts // so it does smooth scrolling, etc void PictureViewer::Refresh() { Window()->Lock(); int32 mode = setup->ViewingMode(); if ( thePic != NULL && ( mode == PEEK_IMAGE_NORMAL || mode == PEEK_IMAGE_WINDOW_TO_IMAGE ) ) { float pointx = Bounds().Width()/2 - thePic->Bounds().Width()/2 ; float pointy = Bounds().Height()/2 - thePic->Bounds().Height()/2 ; if (pointy < 1) pointy = 1; if (pointx < 1) pointx = 1; BRegion viewRegion( Bounds() ); viewRegion.Exclude( BRect(pointx+1,pointy+1, pointx + thePic->Bounds().Width(), pointy + thePic->Bounds().Height()) ); Invalidate(&viewRegion); } if ( (thePic != NULL) && (mode == PEEK_IMAGE_SCALED_NICELY) ) { float width = Bounds().Width(); float height = Bounds().Height(); float pic_width = thePic->Bounds().Width(); float pic_height = thePic->Bounds().Height(); float ratio = 1; if ( (width - pic_width) < (height - pic_height) ) { ratio = width / pic_width; } else { ratio = height / pic_height; } BRect new_rect(0,0,pic_width * ratio, pic_height * ratio ); float x = Bounds().Width() / 2 - new_rect.Width() / 2; float y = Bounds().Height() / 2 - new_rect.Height() / 2; new_rect.left += x; new_rect.top += y; new_rect.right += x; new_rect.bottom += y; BRegion viewRegion( Bounds() ); viewRegion.Exclude( new_rect ); Invalidate(&viewRegion); } if ( thePic != NULL ) { DrawSingleImage(this); } else { Invalidate(); } AdjustScrollBars(); Window()->Unlock(); }