eeschema: Recache bitmaps when changing

Clearing the cache removes all items from screen until the cache is
refreshed.  Instead, we wanted to re-cache the items to take into
account the bitmap changes.

Fixes: lp:1815443
* https://bugs.launchpad.net/kicad/+bug/1815443
This commit is contained in:
Seth Hillbrand 2019-02-12 07:40:20 -08:00
parent 869bdc2b3c
commit ea84020b1f
5 changed files with 23 additions and 10 deletions

View File

@ -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;
}

View File

@ -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:

View File

@ -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 );

View File

@ -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:

View File

@ -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();
}