code cleaning
This commit is contained in:
parent
b808fcf4a2
commit
96849d5a11
|
@ -39,9 +39,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,9 +340,7 @@ void WinEDA_DrawFrame::ReDrawPanel()
|
||||||
if( DrawPanel == NULL )
|
if( DrawPanel == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
DrawPanel->ReDraw( &dc );
|
DrawPanel->ReDraw( &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,9 +597,8 @@ void WinEDA_DrawFrame::AdjustScrollBars()
|
||||||
int x, y, scroll_x, scroll_y;
|
int x, y, scroll_x, scroll_y;
|
||||||
double scale_x, scale_y;
|
double scale_x, scale_y;
|
||||||
|
|
||||||
wxClientDC DC( this );
|
DrawPanel DC( this );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &DC );
|
|
||||||
x = DC.LogicalToDeviceXRel( draw_size.GetWidth() );
|
x = DC.LogicalToDeviceXRel( draw_size.GetWidth() );
|
||||||
y = DC.LogicalToDeviceYRel( draw_size.GetHeight() );
|
y = DC.LogicalToDeviceYRel( draw_size.GetHeight() );
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,26 @@
|
||||||
#define CURSOR_SIZE 12 // Cursor size in pixels
|
#define CURSOR_SIZE 12 // Cursor size in pixels
|
||||||
|
|
||||||
|
|
||||||
|
// Helper class to handle the client Device Context
|
||||||
|
KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel )
|
||||||
|
: wxClientDC(aDrawPanel)
|
||||||
|
{
|
||||||
|
GRResetPenAndBrush( this );
|
||||||
|
SetBackgroundMode( wxTRANSPARENT );
|
||||||
|
#ifdef WX_ZOOM
|
||||||
|
double scale = aDrawPanel->GetScreen()->GetScalingFactor();
|
||||||
|
SetUserScale( scale, scale );
|
||||||
|
wxPoint origin = aDrawPanel->GetScreen()->m_DrawOrg;
|
||||||
|
SetLogicalOrigin( origin.x, origin.y );
|
||||||
|
#endif
|
||||||
|
aDrawPanel->SetBoundaryBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
KicadGraphicContext::~KicadGraphicContext( )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Used to inhibit a response to a mouse left button release, after a
|
/* Used to inhibit a response to a mouse left button release, after a
|
||||||
* double click (when releasing the left button at the end of the second
|
* double click (when releasing the left button at the end of the second
|
||||||
* click. Used in eeschema to inhibit a mouse left release command when
|
* click. Used in eeschema to inhibit a mouse left release command when
|
||||||
|
@ -172,19 +192,6 @@ wxRealPoint WinEDA_DrawPanel::GetGrid()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC )
|
|
||||||
{
|
|
||||||
GRResetPenAndBrush( DC );
|
|
||||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
|
||||||
#ifdef WX_ZOOM
|
|
||||||
double scale = GetScreen()->GetScalingFactor();
|
|
||||||
DC->SetUserScale( scale, scale );
|
|
||||||
wxPoint origin = GetScreen()->m_DrawOrg;
|
|
||||||
DC->SetLogicalOrigin( origin.x, origin.y );
|
|
||||||
#endif
|
|
||||||
SetBoundaryBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Calculate the cursor position in internal units.
|
/** Calculate the cursor position in internal units.
|
||||||
* @return position (in internal units)
|
* @return position (in internal units)
|
||||||
|
@ -194,8 +201,8 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
|
||||||
{
|
{
|
||||||
#ifdef WX_ZOOM
|
#ifdef WX_ZOOM
|
||||||
wxCoord x, y;
|
wxCoord x, y;
|
||||||
wxClientDC DC( this );
|
KicadGraphicContext DC( this );
|
||||||
PrepareGraphicContext( &DC );
|
|
||||||
x = DC.DeviceToLogicalX( ScreenPos.x );
|
x = DC.DeviceToLogicalX( ScreenPos.x );
|
||||||
y = DC.DeviceToLogicalY( ScreenPos.y );
|
y = DC.DeviceToLogicalY( ScreenPos.y );
|
||||||
return wxPoint( x, y );
|
return wxPoint( x, y );
|
||||||
|
@ -304,8 +311,8 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition()
|
||||||
{
|
{
|
||||||
#ifdef WX_ZOOM
|
#ifdef WX_ZOOM
|
||||||
wxCoord x, y;
|
wxCoord x, y;
|
||||||
wxClientDC DC( this );
|
KicadGraphicContext DC( this );
|
||||||
PrepareGraphicContext( &DC );
|
|
||||||
x = DC.LogicalToDeviceX( GetScreen()->m_Curseur.x );
|
x = DC.LogicalToDeviceX( GetScreen()->m_Curseur.x );
|
||||||
y = DC.LogicalToDeviceY( GetScreen()->m_Curseur.y );
|
y = DC.LogicalToDeviceY( GetScreen()->m_Curseur.y );
|
||||||
return wxPoint( x, y );
|
return wxPoint( x, y );
|
||||||
|
@ -332,8 +339,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
|
||||||
GetScreen()->Unscale( realpos );
|
GetScreen()->Unscale( realpos );
|
||||||
#ifdef WX_ZOOM
|
#ifdef WX_ZOOM
|
||||||
// wxCoord x, y;
|
// wxCoord x, y;
|
||||||
// wxClientDC DC( this );
|
// KicadGraphicContext DC( this );
|
||||||
// PrepareGraphicContext( &DC );
|
|
||||||
// realpos.x = DC.DeviceToLogicalX( realpos.x );
|
// realpos.x = DC.DeviceToLogicalX( realpos.x );
|
||||||
// realpos.y = DC.DeviceToLogicalY( realpos.y );
|
// realpos.y = DC.DeviceToLogicalY( realpos.y );
|
||||||
#else
|
#else
|
||||||
|
@ -567,7 +573,6 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
||||||
wxRect PaintClipBox;
|
wxRect PaintClipBox;
|
||||||
wxPoint org;
|
wxPoint org;
|
||||||
|
|
||||||
PrepareGraphicContext( &paintDC );
|
|
||||||
tmp = m_ClipBox;
|
tmp = m_ClipBox;
|
||||||
|
|
||||||
org = m_ClipBox.GetOrigin();
|
org = m_ClipBox.GetOrigin();
|
||||||
|
@ -1010,11 +1015,11 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
screen->m_MousePosition =
|
screen->m_MousePosition =
|
||||||
CursorRealPosition( screen->m_MousePositionInPixels );
|
CursorRealPosition( screen->m_MousePositionInPixels );
|
||||||
|
|
||||||
wxClientDC DC( this );
|
KicadGraphicContext DC( this );
|
||||||
|
|
||||||
int kbstat = 0;
|
int kbstat = 0;
|
||||||
|
|
||||||
DC.SetBackground( *wxBLACK_BRUSH );
|
DC.SetBackground( *wxBLACK_BRUSH );
|
||||||
PrepareGraphicContext( &DC );
|
|
||||||
|
|
||||||
g_KeyPressed = localkey;
|
g_KeyPressed = localkey;
|
||||||
|
|
||||||
|
@ -1259,10 +1264,10 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
|
||||||
if( event.ShiftDown() && (key > 256) )
|
if( event.ShiftDown() && (key > 256) )
|
||||||
localkey |= GR_KB_SHIFT;
|
localkey |= GR_KB_SHIFT;
|
||||||
|
|
||||||
wxClientDC DC( this );
|
KicadGraphicContext DC( this );
|
||||||
|
|
||||||
BASE_SCREEN* Screen = GetScreen();
|
BASE_SCREEN* Screen = GetScreen();
|
||||||
|
|
||||||
PrepareGraphicContext( &DC );
|
|
||||||
|
|
||||||
g_KeyPressed = localkey;
|
g_KeyPressed = localkey;
|
||||||
|
|
||||||
|
|
|
@ -722,8 +722,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
|
||||||
if( entry == NULL )
|
if( entry == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxClientDC dc( m_Parent->DrawPanel );
|
KicadGraphicContext dc( m_Parent->DrawPanel );
|
||||||
m_Parent->DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode );
|
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode );
|
||||||
|
|
||||||
|
|
|
@ -179,9 +179,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
Recadre_Trace( mouseWarp );
|
Recadre_Trace( mouseWarp );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
|
@ -356,9 +354,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
||||||
Recadre_Trace( TRUE );
|
Recadre_Trace( TRUE );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
DrawPanel->MouseTo( curpos );
|
DrawPanel->MouseTo( curpos );
|
||||||
|
@ -581,9 +577,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( const wxString& pattern,
|
||||||
Recadre_Trace( mouseWarp );
|
Recadre_Trace( mouseWarp );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
|
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
|
||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
|
|
|
@ -604,12 +604,10 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = true;
|
DrawPanel->m_IgnoreMouseEvents = true;
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
wxGetMousePosition( &pos.x, &pos.y );
|
||||||
pos.y += 20;
|
pos.y += 20;
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
pos = wxGetMousePosition();
|
pos = wxGetMousePosition();
|
||||||
|
|
||||||
pos.y += 20;
|
pos.y += 20;
|
||||||
|
|
|
@ -72,13 +72,6 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
|
||||||
if( !( DrawItem->m_Flags & IS_NEW ) )
|
if( !( DrawItem->m_Flags & IS_NEW ) )
|
||||||
SaveCopyInUndoList( DrawItem->GetParent() );
|
SaveCopyInUndoList( DrawItem->GetParent() );
|
||||||
|
|
||||||
wxClientDC dc( DrawPanel );
|
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
DrawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode,
|
|
||||||
NULL, DefaultTransformMatrix );
|
|
||||||
|
|
||||||
if( m_drawSpecificUnit )
|
if( m_drawSpecificUnit )
|
||||||
DrawItem->m_Unit = GetUnit();
|
DrawItem->m_Unit = GetUnit();
|
||||||
else
|
else
|
||||||
|
@ -98,9 +91,6 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
|
||||||
component->GetDrawItemList().sort();
|
component->GetDrawItemList().sort();
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
DrawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode,
|
|
||||||
NULL, DefaultTransformMatrix );
|
|
||||||
|
|
||||||
DrawItem->DisplayInfo( this );
|
DrawItem->DisplayInfo( this );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,9 +287,7 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
|
|
@ -189,9 +189,6 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
|
||||||
int NumOfParts = 0;
|
int NumOfParts = 0;
|
||||||
CMP_LIB_ENTRY* LibEntry;
|
CMP_LIB_ENTRY* LibEntry;
|
||||||
wxString CmpName;
|
wxString CmpName;
|
||||||
wxClientDC dc( DrawPanel );
|
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
if( Lib )
|
if( Lib )
|
||||||
NumOfParts = Lib->GetCount();
|
NumOfParts = Lib->GetCount();
|
||||||
|
@ -234,7 +231,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
|
||||||
m_entryName = CmpName;
|
m_entryName = CmpName;
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
RedrawActiveWindow( &dc, true );
|
DrawPanel->Refresh( );
|
||||||
|
|
||||||
if( m_CmpList )
|
if( m_CmpList )
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,9 +75,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
int layer = GetScreen()->m_Active_Layer;
|
int layer = GetScreen()->m_Active_Layer;
|
||||||
GERBER* gerber_layer = g_GERBER_List[layer];
|
GERBER* gerber_layer = g_GERBER_List[layer];
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
wxGetMousePosition( &pos.x, &pos.y );
|
||||||
|
|
||||||
|
@ -263,9 +261,6 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||||
wxClientDC dc( DrawPanel );
|
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,6 @@ public:
|
||||||
BASE_SCREEN* GetScreen();
|
BASE_SCREEN* GetScreen();
|
||||||
|
|
||||||
|
|
||||||
void PrepareGraphicContext( wxDC* DC );
|
|
||||||
bool IsPointOnDisplay( wxPoint ref_pos );
|
bool IsPointOnDisplay( wxPoint ref_pos );
|
||||||
void OnPaint( wxPaintEvent& event );
|
void OnPaint( wxPaintEvent& event );
|
||||||
void OnSize( wxSizeEvent& event );
|
void OnSize( wxSizeEvent& event );
|
||||||
|
@ -181,5 +180,12 @@ public:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper class to handle the client Device Context
|
||||||
|
class KicadGraphicContext : public wxClientDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel );
|
||||||
|
~KicadGraphicContext();
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* #ifndef PANEL_WXSTRUCT_H */
|
#endif /* #ifndef PANEL_WXSTRUCT_H */
|
||||||
|
|
|
@ -36,14 +36,12 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
bool on_state;
|
bool on_state;
|
||||||
|
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
wxGetMousePosition( &pos.x, &pos.y );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
|
|
|
@ -169,12 +169,8 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
||||||
g_Show_Ratsnest = m_OptionsToolBar->GetToolState( id );
|
g_Show_Ratsnest = m_OptionsToolBar->GetToolState( id );
|
||||||
{
|
Ratsnest_On_Off( NULL );
|
||||||
wxClientDC dc( DrawPanel );
|
DrawPanel->Refresh( );
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
Ratsnest_On_Off( &dc );
|
|
||||||
RedrawActiveWindow( &dc, true );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
|
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
|
||||||
|
|
|
@ -32,8 +32,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
int itmp;
|
int itmp;
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
|
|
||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
|
|
|
@ -91,9 +91,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
|
||||||
|
|
||||||
offsetX = m_Auxiliary_Axis_Position.x;
|
offsetX = m_Auxiliary_Axis_Position.x;
|
||||||
offsetY = m_Auxiliary_Axis_Position.y;
|
offsetY = m_Auxiliary_Axis_Position.y;
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
Compile_Ratsnest( &dc, TRUE );
|
Compile_Ratsnest( &dc, TRUE );
|
||||||
|
|
||||||
/* Temporary modification of footprints that are flipped (i.e. on bottom
|
/* Temporary modification of footprints that are flipped (i.e. on bottom
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
|
void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString fn;
|
wxString fn;
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
|
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +51,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
|
||||||
// If an edition is in progress, stop it
|
// If an edition is in progress, stop it
|
||||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
|
|
|
@ -80,9 +80,8 @@ void DIALOG_GLOBAL_PADS_EDITION::OnCancelClick( wxCommandEvent& event )
|
||||||
*/
|
*/
|
||||||
void DIALOG_GLOBAL_PADS_EDITION::InstallPadEditor( wxCommandEvent& event )
|
void DIALOG_GLOBAL_PADS_EDITION::InstallPadEditor( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxClientDC dc( m_Parent->DrawPanel );
|
KicadGraphicContext dc( m_Parent->DrawPanel );
|
||||||
|
|
||||||
m_Parent->DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
m_Parent->DrawPanel->CursorOff( &dc );
|
m_Parent->DrawPanel->CursorOff( &dc );
|
||||||
m_Parent->InstallPadOptionsFrame( m_CurrentPad, &dc, wxDefaultPosition );
|
m_Parent->InstallPadOptionsFrame( m_CurrentPad, &dc, wxDefaultPosition );
|
||||||
m_Parent->DrawPanel->CursorOn( &dc );
|
m_Parent->DrawPanel->CursorOn( &dc );
|
||||||
|
|
|
@ -147,9 +147,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
bool redraw = false;
|
bool redraw = false;
|
||||||
|
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
wxGetMousePosition( &pos.x, &pos.y );
|
||||||
|
|
||||||
pos.y += 20;
|
pos.y += 20;
|
||||||
|
|
|
@ -382,9 +382,6 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
wxClientDC dc( DrawPanel );
|
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
{
|
{
|
||||||
|
@ -403,7 +400,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
switch( DrawStruct->Type() )
|
switch( DrawStruct->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_PAD:
|
case TYPE_PAD:
|
||||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
|
InstallPadOptionsFrame( (D_PAD*) DrawStruct, DC, pos );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -420,7 +417,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc );
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, DC );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,12 @@
|
||||||
void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxClientDC dc( DrawPanel );
|
|
||||||
|
|
||||||
DrawPanel->CursorOff( &dc );
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_TB_OPTIONS_SHOW_GRID:
|
case ID_TB_OPTIONS_SHOW_GRID:
|
||||||
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
|
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
|
||||||
DrawPanel->ReDraw( &dc, TRUE );
|
DrawPanel->Refresh( );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||||
|
@ -51,24 +48,24 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
||||||
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
|
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
|
||||||
DrawPanel->ReDraw( &dc, TRUE );
|
DrawPanel->Refresh( );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
||||||
m_DisplayViaFill = !m_OptionsToolBar->GetToolState( id );
|
m_DisplayViaFill = !m_OptionsToolBar->GetToolState( id );
|
||||||
DrawPanel->ReDraw( &dc, TRUE );
|
DrawPanel->Refresh( );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
|
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
|
||||||
m_DisplayModText =
|
m_DisplayModText =
|
||||||
m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
|
m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
|
||||||
DrawPanel->ReDraw( &dc, TRUE );
|
DrawPanel->Refresh( );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
|
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
|
||||||
m_DisplayModEdge =
|
m_DisplayModEdge =
|
||||||
m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
|
m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
|
||||||
DrawPanel->ReDraw( &dc, TRUE );
|
DrawPanel->Refresh( );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -78,5 +75,4 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
DrawPanel->CursorOn( &dc );
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,7 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
wxGetMousePosition( &pos.x, &pos.y );
|
||||||
|
|
||||||
|
|
|
@ -388,9 +388,6 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
wxClientDC dc( DrawPanel );
|
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
{
|
{
|
||||||
|
@ -429,38 +426,38 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_PAD:
|
case TYPE_PAD:
|
||||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
|
InstallPadOptionsFrame( (D_PAD*) DrawStruct, DC, pos );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc );
|
InstallModuleOptionsFrame( (MODULE*) DrawStruct, DC );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case TYPE_MIRE:
|
||||||
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
|
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, DC, pos );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_COTATION:
|
case TYPE_COTATION:
|
||||||
Install_Edit_Cotation( (COTATION*) DrawStruct, &dc, pos );
|
Install_Edit_Cotation( (COTATION*) DrawStruct, DC, pos );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc );
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, DC );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) DrawStruct, &dc );
|
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) DrawStruct, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_ZONE_CONTAINER:
|
case TYPE_ZONE_CONTAINER:
|
||||||
if( DrawStruct->m_Flags )
|
if( DrawStruct->m_Flags )
|
||||||
break;
|
break;
|
||||||
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) DrawStruct );
|
Edit_Zone_Params( DC, (ZONE_CONTAINER*) DrawStruct );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -498,7 +495,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
if( (DrawStruct->m_Flags & IS_NEW) )
|
if( (DrawStruct->m_Flags & IS_NEW) )
|
||||||
{
|
{
|
||||||
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
|
End_Edge( (DRAWSEGMENT*) DrawStruct, DC );
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,10 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
pos = GetPosition();
|
pos = GetPosition();
|
||||||
pos.x += 20;
|
pos.x += 20;
|
||||||
pos.y += 20;
|
pos.y += 20;
|
||||||
|
|
|
@ -72,9 +72,7 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
|
||||||
|
|
||||||
if( found )
|
if( found )
|
||||||
{
|
{
|
||||||
wxClientDC dc( DrawPanel );
|
KicadGraphicContext dc( DrawPanel );
|
||||||
|
|
||||||
DrawPanel->PrepareGraphicContext( &dc );
|
|
||||||
|
|
||||||
if( g_HightLigt_Status )
|
if( g_HightLigt_Status )
|
||||||
Hight_Light( &dc );
|
Hight_Light( &dc );
|
||||||
|
|
Loading…
Reference in New Issue