kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #02545
Re: Issue with PCBNEW on Max OS X
I've done a dirty fix for the issue of the "overlapping" wxDC, but sadly i can't find a better solution for the problem.
Waiting for your blames and insults ;)
--
Marco
Index: modedit.cpp
===================================================================
--- modedit.cpp (revision 1774)
+++ modedit.cpp (working copy)
@@ -140,14 +140,15 @@
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
{
- int id = event.GetId();
- wxPoint pos;
- bool redraw = false;
- wxClientDC dc( DrawPanel );
+ int id = event.GetId();
+ wxPoint pos;
+ bool redraw = false;
+ {
+ wxClientDC dc( DrawPanel );
- DrawPanel->CursorOff( &dc );
- DrawPanel->PrepareGraphicContext( &dc );
-
+ DrawPanel->CursorOff( &dc );
+ DrawPanel->PrepareGraphicContext( &dc );
+ }
wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20;
@@ -188,6 +189,7 @@
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
+ wxClientDC dc( DrawPanel );
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
break;
@@ -196,6 +198,7 @@
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
+ wxClientDC dc( DrawPanel );
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
@@ -224,12 +227,16 @@
case ID_MODEDIT_NEW_MODULE:
{
+ MODULE* module;
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
GetScreen()->m_Curseur = wxPoint( 0, 0 );
+ {
+ wxClientDC dc( DrawPanel );
+ module = Create_1_Module( &dc, wxEmptyString );
+ }
- MODULE* module = Create_1_Module( &dc, wxEmptyString );
if( module ) // i.e. if create module command not aborted
{
module->SetPosition( wxPoint( 0, 0 ) );
@@ -244,7 +251,7 @@
{
wxFileName fn;
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
- wxString full_filename = wxGetApp().FindLibraryPath( fn );
+ wxString full_filename = wxGetApp().FindLibraryPath( fn );
Save_Module_In_Library( full_filename, GetBoard()->m_Modules,
true, true, true );
GetScreen()->ClrModify();
@@ -326,7 +333,12 @@
SetCurItem( NULL );
Clear_Pcb( true );
GetScreen()->m_Curseur = wxPoint( 0, 0 );
- Import_Module( &dc );
+
+ {
+ wxClientDC dc( DrawPanel );
+ Import_Module( &dc );
+ }
+
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0;
GetScreen()->ClrModify();
@@ -401,8 +413,11 @@
if( GetBoard()->m_Modules )
{
SetCurItem( GetBoard()->m_Modules );
- InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(),
- &dc, pos );
+ {
+ wxClientDC dc( DrawPanel );
+ InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(),
+ &dc, pos );
+ }
GetScreen()->GetCurItem()->m_Flags = 0;
}
break;
@@ -450,24 +465,36 @@
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
DrawPanel->MouseToCursorSchema();
- Rotate_Module( &dc, (MODULE*) GetScreen()->GetCurItem(), -900, true );
+ {
+ wxClientDC dc( DrawPanel );
+ Rotate_Module( &dc, (MODULE*) GetScreen()->GetCurItem(), -900,true );
+ }
break;
case ID_POPUP_PCB_EDIT_MODULE:
+ {
+ wxClientDC dc( DrawPanel );
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(),
&dc, pos );
+ }
GetScreen()->GetCurItem()->m_Flags = 0;
DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_MOVE_PAD_REQUEST:
DrawPanel->MouseToCursorSchema();
- StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc );
+ }
break;
case ID_POPUP_PCB_EDIT_PAD:
+ {
+ wxClientDC dc( DrawPanel );
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(),
&dc, pos );
+ }
DrawPanel->MouseToCursorSchema();
break;
@@ -496,33 +523,48 @@
break;
case ID_POPUP_PCB_EDIT_TEXTMODULE:
+ {
+ wxClientDC dc( DrawPanel );
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
&dc, pos );
+ }
DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
DrawPanel->MouseToCursorSchema();
- StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
- &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
+ &dc );
+ }
break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
+ {
+ wxClientDC dc( DrawPanel );
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
&dc );
+ }
DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_DELETE_TEXTMODULE:
SaveCopyInUndoList( GetBoard()->m_Modules );
- DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
- &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
+ &dc );
+ }
SetCurItem( NULL );
DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_PCB_MOVE_EDGE:
+ {
+ wxClientDC dc( DrawPanel );
Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
+ }
DrawPanel->MouseToCursorSchema();
break;
@@ -530,6 +572,7 @@
DrawPanel->MouseToCursorSchema();
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) )
{
+ wxClientDC dc( DrawPanel );
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc);
SetCurItem( NULL );
}
@@ -544,35 +587,54 @@
{
edge = (EDGE_MODULE*) GetScreen()->GetCurItem();
}
- Enter_Edge_Width( edge, &dc );
+
+ {
+ wxClientDC dc( DrawPanel );
+ Enter_Edge_Width( edge, &dc );
+ }
DrawPanel->MouseToCursorSchema();
}
break;
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE:
DrawPanel->MouseToCursorSchema();
- Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc);
+ }
break;
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE:
DrawPanel->MouseToCursorSchema();
- Edit_Edge_Width( NULL, &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ Edit_Edge_Width( NULL, &dc );
+ }
break;
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE:
DrawPanel->MouseToCursorSchema();
- Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc);
+ }
break;
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE:
DrawPanel->MouseToCursorSchema();
- Edit_Edge_Layer( NULL, &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ Edit_Edge_Layer( NULL, &dc );
+ }
break;
case ID_POPUP_PCB_DELETE_EDGE:
SaveCopyInUndoList( GetBoard()->m_Modules );
DrawPanel->MouseToCursorSchema();
- RemoveStruct( GetScreen()->GetCurItem(), &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ RemoveStruct( GetScreen()->GetCurItem(), &dc );
+ }
SetCurItem( NULL );
break;
@@ -582,7 +644,10 @@
case ID_MODEDIT_MODULE_SCALEX:
case ID_MODEDIT_MODULE_SCALEY:
SaveCopyInUndoList( GetBoard()->m_Modules );
- Transform( (MODULE*) GetScreen()->GetCurItem(), &dc, id );
+ {
+ wxClientDC dc( DrawPanel );
+ Transform( (MODULE*) GetScreen()->GetCurItem(), &dc, id );
+ }
break;
case ID_PCB_DRAWINGS_WIDTHS_SETUP:
@@ -597,7 +662,10 @@
if( item->Type() != TYPE_PAD )
item = NULL;
}
- InstallPadOptionsFrame( (D_PAD*) item, &dc, pos );
+ {
+ wxClientDC dc( DrawPanel );
+ InstallPadOptionsFrame( (D_PAD*) item, &dc, pos );
+ }
}
break;
@@ -618,33 +686,48 @@
case ID_POPUP_PLACE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
DrawPanel->m_AutoPAN_Request = FALSE;
- HandleBlockPlace( &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ HandleBlockPlace( &dc );
+ }
break;
case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
GetScreen()->BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE;
- HandleBlockPlace( &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ HandleBlockPlace( &dc );
+ }
break;
case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
GetScreen()->BlockLocate.SetMessageBlock( this );
GetScreen()->BlockLocate.SetMessageBlock( this );
- HandleBlockEnd( &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ HandleBlockEnd( &dc );
+ }
break;
case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
GetScreen()->BlockLocate.SetMessageBlock( this );
- HandleBlockEnd( &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ HandleBlockEnd( &dc );
+ }
break;
case ID_POPUP_ROTATE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
GetScreen()->BlockLocate.SetMessageBlock( this );
- HandleBlockEnd( &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ HandleBlockEnd( &dc );
+ }
break;
case ID_POPUP_MIRROR_X_BLOCK:
@@ -652,7 +735,10 @@
case ID_POPUP_INVERT_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
GetScreen()->BlockLocate.SetMessageBlock( this );
- HandleBlockEnd( &dc );
+ {
+ wxClientDC dc( DrawPanel );
+ HandleBlockEnd( &dc );
+ }
break;
default:
@@ -662,8 +748,12 @@
}
SetToolbars();
- DrawPanel->CursorOn( &dc );
- if ( redraw )
+ {
+ wxClientDC dc( DrawPanel );
+ DrawPanel->CursorOn( &dc );
+ }
+
+ if( redraw )
DrawPanel->Refresh();
}
Follow ups
References