diff --git a/eeschema/edit_bitmap.cpp b/eeschema/edit_bitmap.cpp index 2519ddf920..7b329c2b4c 100644 --- a/eeschema/edit_bitmap.cpp +++ b/eeschema/edit_bitmap.cpp @@ -99,13 +99,13 @@ void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis ) } -void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem ) +bool SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem ) { // TODO: change image scale or more DIALOG_IMAGE_EDITOR dlg( this, aItem->GetImage() ); if( dlg.ShowModal() != wxID_OK ) - return; + return false; // save old image in undo list if not already in edit // or the image to be edited is part of a block @@ -120,4 +120,5 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem ) RefreshItem( aItem ); OnModify(); + return true; } diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index cf329128ea..c15ee7898b 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -430,7 +430,12 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) break; case SCH_BITMAP_T: - EditImage( (SCH_BITMAP*) item ); + + // The bitmap is cached in Opengl: clear the cache, because + // the cache data is perhaps invalid + if( EditImage( (SCH_BITMAP*) item ) ) + GetCanvas()->GetView()->RecacheAllItems(); + break; case SCH_FIELD_T: diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index c4d11cdd0e..36edeebab7 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -1020,7 +1020,13 @@ private: * false to mirror relative to vertical axis */ void MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis ); - void EditImage( SCH_BITMAP* aItem ); + + /** + * Launches the "Edit Image" dialog to modify an image + * @param aItem Pointer to the image item to modify + * @return true if the image was modified, false if the user canceled + */ + bool EditImage( SCH_BITMAP* aItem ); // Hierarchical Sheet & PinSheet void InstallHierarchyFrame( wxPoint& pos ); diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index b3c2c0e6bb..0be43ca843 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -921,7 +921,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) RotateImage( (SCH_BITMAP*) item ); // The bitmap is cached in Opengl: clear the cache, because // the cache data is invalid - GetCanvas()->GetGAL()->ClearCache(); + GetCanvas()->GetView()->RecacheAllItems(); break; case SCH_SHEET_T: @@ -1093,10 +1093,12 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) break; case SCH_BITMAP_T: - EditImage( (SCH_BITMAP*) item ); + // The bitmap is cached in Opengl: clear the cache, because // the cache data is perhaps invalid - GetCanvas()->GetGAL()->ClearCache(); + if( EditImage( (SCH_BITMAP*) item ) ) + GetCanvas()->GetView()->RecacheAllItems(); + break; case SCH_LINE_T: // These items have no param to edit @@ -1294,7 +1296,7 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent ) // The bitmap is cached in Opengl: clear the cache, because // the cache data is invalid - GetCanvas()->GetGAL()->ClearCache(); + GetCanvas()->GetView()->RecacheAllItems(); break; case SCH_SHEET_T: diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index 73778e7ca9..9385f7c631 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -384,8 +384,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed // Bitmaps are cached in Opengl: clear the cache, because // the cache data can be invalid - GetCanvas()->GetGAL()->ClearCache(); - + GetCanvas()->GetView()->RecacheAllItems(); GetCanvas()->GetView()->ClearHiddenFlags(); }