void ScrollViews( void ) // shift the display by increment in x and y { RECT region; if ( CurrSeries && (ScrollX || ScrollY) ) { CurrSeries->offset_x -= CurrSeries->pixel_size*(double)ScrollX; CurrSeries->offset_y += CurrSeries->pixel_size*(double)ScrollY; if ( FrontView ) // move the front view { FrontView->ShiftView( ScrollX, ScrollY, CurrSeries->pixel_size, CurrSeries->offset_x, CurrSeries->offset_y, CurrSeries->useProxies); } if ( BackView ) // move the back view if needed for blend view if ( BlendView ) { BackView->ShiftView( ScrollX, ScrollY, CurrSeries->pixel_size, CurrSeries->offset_x, CurrSeries->offset_y, CurrSeries->useProxies); UpdateBlendView(); // regenerate the blend of front and back views } InvalidateAllViews(); // flag for full rerendering later ClientRectLessStatusBar( ®ion ); if ( BlendView ) BlendView->Display(appDC, region ); else FrontView->Display(appDC, region ); ScrollOccurred = true; if ( ScrollX ) LToolRect.left += ScrollX; if ( ScrollY ) LToolRect.top += ScrollY; } }
/** aRegion is given in device coordinates!! aContext may be null, in which case layers should be used for rendering. */ void nsViewManager::Refresh(nsView *aView, const nsIntRegion& aRegion, bool aWillSendDidPaint) { NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager"); // damageRegion is the damaged area, in twips, relative to the view origin nsRegion damageRegion = aRegion.ToAppUnits(AppUnitsPerDevPixel()); // move region from widget coordinates into view coordinates damageRegion.MoveBy(-aView->ViewToWidgetOffset()); if (damageRegion.IsEmpty()) { #ifdef DEBUG_roc nsRect viewRect = aView->GetDimensions(); nsRect damageRect = damageRegion.GetBounds(); printf("XXX Damage rectangle (%d,%d,%d,%d) does not intersect the widget's view (%d,%d,%d,%d)!\n", damageRect.x, damageRect.y, damageRect.width, damageRect.height, viewRect.x, viewRect.y, viewRect.width, viewRect.height); #endif return; } nsIWidget *widget = aView->GetWidget(); if (!widget) { return; } NS_ASSERTION(!IsPainting(), "recursive painting not permitted"); if (IsPainting()) { RootViewManager()->mRecursiveRefreshPending = true; return; } { nsAutoScriptBlocker scriptBlocker; SetPainting(true); NS_ASSERTION(GetDisplayRootFor(aView) == aView, "Widgets that we paint must all be display roots"); if (mPresShell) { #ifdef DEBUG_INVALIDATIONS printf("--COMPOSITE-- %p\n", mPresShell); #endif mPresShell->Paint(aView, damageRegion, nsIPresShell::PAINT_COMPOSITE | (aWillSendDidPaint ? nsIPresShell::PAINT_WILL_SEND_DID_PAINT : 0)); #ifdef DEBUG_INVALIDATIONS printf("--ENDCOMPOSITE--\n"); #endif mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT); } SetPainting(false); } if (RootViewManager()->mRecursiveRefreshPending) { RootViewManager()->mRecursiveRefreshPending = false; InvalidateAllViews(); } }
// **************************************************************************** // // Function Name: RStandaloneDocument::OnRevertToSaved( ) // // Description: Command handler // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RStandaloneDocument::OnRevertToSaved( ) { try { RAlert alert; // If we have a filename, but no storage, the file was already open when we opened it if( m_pDocumentStorage == NULL ) alert.InformUser( STRING_ERROR_FILE_ALREADY_OPEN_REVERT ); else { // Ask the user if they really want to revert if( alert.QueryUser( STRING_ALERT_REVERT ) == kAlertYes ) { RWaitCursor waitCursor; // Get the file formats supported for loading by our application RFileFormatCollection fileFormatCollection; ::GetApplication( ).GetLoadFileFormats( fileFormatCollection ); // Get the file format which matches our file RFileFormat* pFileFormat = fileFormatCollection.GetMatchingFileFormat( GetDocumentFilename( ) ); TpsAssert( pFileFormat, "No file format to revert to." ); // Delete the documents contents. We are going to reuse it FreeDocumentContents( ); // Revert the file pFileFormat->Revert( GetDocumentFilename( ), this ); // We are back to the state just after we saved; tell the undo manager m_pUndoManager->DocSaved( ); // Update the scroll bars GetActiveView( )->UpdateScrollBars( kResize ); // Invalidate the views InvalidateAllViews( ); } } } catch( YException e ) { ::ReportException( e ); } }