code cleaning
This commit is contained in:
parent
96849d5a11
commit
c2ea4a0aff
|
@ -335,15 +335,6 @@ void WinEDA_DrawFrame::DisplayUnitsMsg()
|
|||
}
|
||||
|
||||
|
||||
void WinEDA_DrawFrame::ReDrawPanel()
|
||||
{
|
||||
if( DrawPanel == NULL )
|
||||
return;
|
||||
|
||||
KicadGraphicContext dc( DrawPanel );
|
||||
DrawPanel->ReDraw( &dc );
|
||||
}
|
||||
|
||||
|
||||
/* Recalculate the size of toolbars and display panel.
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,8 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
|
|||
{
|
||||
PutOnGrid( &(GetBaseScreen()->m_Curseur) );
|
||||
AdjustScrollBars();
|
||||
ReDrawPanel();
|
||||
KicadGraphicContext dc( DrawPanel );
|
||||
DrawPanel->ReDraw( &dc );
|
||||
|
||||
/* Move the mouse cursor to the on grid graphic cursor position */
|
||||
if( ToMouse == TRUE )
|
||||
|
@ -55,12 +56,13 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
|
|||
}
|
||||
|
||||
|
||||
/** Redraw the screen with the zoom level which shows all the page or the board
|
||||
/** Redraw the screen with best zoom level and the best centering
|
||||
* that shows all the page or the board
|
||||
*/
|
||||
void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor )
|
||||
{
|
||||
if( GetBaseScreen()->SetZoom( BestZoom() ) )
|
||||
Recadre_Trace( move_mouse_cursor );
|
||||
GetBaseScreen()->SetZoom( BestZoom() ); // Set the best zoom
|
||||
Recadre_Trace( move_mouse_cursor ); // Set the best centering and refresh the screen
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,11 +95,7 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect )
|
|||
void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
|
||||
{
|
||||
if( DrawPanel == NULL )
|
||||
{
|
||||
wxLogDebug( wxT( "%s, %d: DrawPanel object is undefined ." ),
|
||||
__TFILE__, __LINE__ );
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
int i;
|
||||
int id = event.GetId();
|
||||
|
@ -131,7 +129,10 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
|
|||
case ID_ZOOM_REDRAW:
|
||||
// DrawPanel->Refresh(); usually good,
|
||||
// but does not work under linux, when called from here (wxGTK bug ?)
|
||||
ReDrawPanel();
|
||||
{
|
||||
KicadGraphicContext dc( DrawPanel );
|
||||
DrawPanel->ReDraw( &dc );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_CENTER:
|
||||
|
@ -139,12 +140,7 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_ZOOM_PAGE:
|
||||
// With Zoom_Automatique(), the "Zoom Auto" button (and hotkey)
|
||||
// does nothing if the view is already at the correct
|
||||
// zoom level, but needs to be shifted (centered).
|
||||
//Zoom_Automatique( false );
|
||||
GetBaseScreen()->SetZoom( BestZoom() );
|
||||
Recadre_Trace( false );
|
||||
Zoom_Automatique( false );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_SELECT:
|
||||
|
|
|
@ -236,9 +236,7 @@ public:
|
|||
wxDC* DC );
|
||||
TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC );
|
||||
|
||||
void InstallPadOptionsFrame( D_PAD* pad,
|
||||
wxDC* DC,
|
||||
const wxPoint& pos );
|
||||
void InstallPadOptionsFrame( D_PAD* pad );
|
||||
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
|
||||
wxDC* DC );
|
||||
|
||||
|
|
|
@ -298,9 +298,7 @@ public:
|
|||
|
||||
void SetToolbars();
|
||||
void Process_Settings( wxCommandEvent& event );
|
||||
void InstallPcbOptionsFrame( const wxPoint& pos,
|
||||
wxDC* DC,
|
||||
int id );
|
||||
void InstallPcbOptionsFrame( int id );
|
||||
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
|
||||
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
|
||||
|
||||
|
|
|
@ -273,7 +273,6 @@ public:
|
|||
void SVG_Print( wxCommandEvent& event );
|
||||
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void ReDrawPanel();
|
||||
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
|
||||
void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen );
|
||||
|
||||
|
|
|
@ -19,12 +19,10 @@
|
|||
#include "pcbnew_id.h"
|
||||
|
||||
|
||||
Dialog_GeneralOptions::Dialog_GeneralOptions( WinEDA_PcbFrame* parent,
|
||||
wxDC* DC ) :
|
||||
Dialog_GeneralOptions::Dialog_GeneralOptions( WinEDA_PcbFrame* parent ) :
|
||||
DialogGeneralOptionsBoardEditor_base( parent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_DC = DC;
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -101,8 +99,8 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
|
|||
if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() )
|
||||
{
|
||||
g_Show_Ratsnest = m_ShowGlobalRatsnest->GetValue();
|
||||
m_Parent->Ratsnest_On_Off( m_DC );
|
||||
m_Parent->RedrawActiveWindow( m_DC, true );
|
||||
m_Parent->Ratsnest_On_Off( NULL );
|
||||
m_Parent->DrawPanel->Refresh( );
|
||||
}
|
||||
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
|
||||
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
|
||||
|
@ -121,8 +119,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
|
|||
#include "dialog_graphic_items_options.cpp"
|
||||
|
||||
|
||||
void WinEDA_PcbFrame::InstallPcbOptionsFrame( const wxPoint& pos,
|
||||
wxDC* DC, int id )
|
||||
void WinEDA_PcbFrame::InstallPcbOptionsFrame( int id )
|
||||
{
|
||||
switch( id )
|
||||
{
|
||||
|
|
|
@ -9,12 +9,11 @@ class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base
|
|||
{
|
||||
private:
|
||||
WinEDA_PcbFrame* m_Parent;
|
||||
wxDC* m_DC;
|
||||
|
||||
void init();
|
||||
|
||||
public:
|
||||
Dialog_GeneralOptions( WinEDA_PcbFrame* parent, wxDC* DC );
|
||||
Dialog_GeneralOptions( WinEDA_PcbFrame* parent );
|
||||
~Dialog_GeneralOptions() {};
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
|
|
|
@ -55,11 +55,10 @@ class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE
|
|||
{
|
||||
public:
|
||||
WinEDA_BasePcbFrame* m_Parent;
|
||||
wxDC* m_DC;
|
||||
D_PAD* m_CurrentPad;
|
||||
|
||||
public:
|
||||
DIALOG_PAD_PROPERTIES( WinEDA_BasePcbFrame* parent, D_PAD* Pad, wxDC* DC );
|
||||
DIALOG_PAD_PROPERTIES( WinEDA_BasePcbFrame* parent, D_PAD* Pad );
|
||||
void InitDialog( );
|
||||
void OnPadShapeSelection( wxCommandEvent& event );
|
||||
void OnDrillShapeSelected( wxCommandEvent& event );
|
||||
|
@ -72,12 +71,11 @@ public:
|
|||
|
||||
|
||||
/*******************************************************************************************/
|
||||
DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( WinEDA_BasePcbFrame* parent, D_PAD* Pad, wxDC* DC ) :
|
||||
DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( WinEDA_BasePcbFrame* parent, D_PAD* Pad ) :
|
||||
DIALOG_PAD_PROPERTIES_BASE( parent )
|
||||
/*******************************************************************************************/
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_DC = DC;
|
||||
m_CurrentPad = Pad;
|
||||
|
||||
if( m_CurrentPad )
|
||||
|
@ -95,10 +93,10 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( WinEDA_BasePcbFrame* parent, D_PAD
|
|||
|
||||
|
||||
/*************************************************************/
|
||||
void WinEDA_BasePcbFrame::InstallPadOptionsFrame( D_PAD* Pad, wxDC* DC, const wxPoint& pos )
|
||||
void WinEDA_BasePcbFrame::InstallPadOptionsFrame( D_PAD* Pad )
|
||||
/*************************************************************/
|
||||
{
|
||||
DIALOG_PAD_PROPERTIES dlg( this, Pad, DC );
|
||||
DIALOG_PAD_PROPERTIES dlg( this, Pad );
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
@ -418,9 +416,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
int internalUnits = m_Parent->m_InternalUnits;
|
||||
wxString msg;
|
||||
|
||||
if( m_DC )
|
||||
m_Parent->DrawPanel->CursorOff( m_DC );
|
||||
|
||||
g_Pad_Master.m_Attribut = CodeType[m_PadType->GetSelection()];
|
||||
g_Pad_Master.m_PadShape = CodeShape[m_PadShape->GetSelection()];
|
||||
|
||||
|
@ -489,11 +484,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
if( error )
|
||||
{
|
||||
if( m_DC )
|
||||
m_Parent->DrawPanel->CursorOn( m_DC );
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
PadLayerMask = 0;
|
||||
if( m_PadLayerCu->GetValue() )
|
||||
|
@ -533,12 +524,12 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
m_Parent->SaveCopyInUndoList( Module, UR_CHANGED );
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
if( m_DC ) // redraw the area where the pad was, without pad (delete pad on screen)
|
||||
{
|
||||
m_CurrentPad->m_Flags |= DO_NOT_DRAW;
|
||||
m_Parent->DrawPanel->PostDirtyRect( m_CurrentPad->GetBoundingBox() );
|
||||
m_CurrentPad->m_Flags &= ~DO_NOT_DRAW;
|
||||
}
|
||||
// redraw the area where the pad was, without pad (delete pad on screen)
|
||||
m_CurrentPad->m_Flags |= DO_NOT_DRAW;
|
||||
m_Parent->DrawPanel->PostDirtyRect( m_CurrentPad->GetBoundingBox() );
|
||||
m_CurrentPad->m_Flags &= ~DO_NOT_DRAW;
|
||||
|
||||
// Update values
|
||||
m_CurrentPad->m_PadShape = g_Pad_Master.m_PadShape;
|
||||
m_CurrentPad->m_Attribut = g_Pad_Master.m_Attribut;
|
||||
if( m_CurrentPad->m_Pos != g_Pad_Master.m_Pos )
|
||||
|
@ -634,15 +625,13 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
m_CurrentPad->DisplayInfo( m_Parent );
|
||||
if( m_DC ) // redraw the area where the pad was
|
||||
m_Parent->DrawPanel->PostDirtyRect( m_CurrentPad->GetBoundingBox() );
|
||||
// redraw the area where the pad was
|
||||
m_Parent->DrawPanel->PostDirtyRect( m_CurrentPad->GetBoundingBox() );
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
}
|
||||
|
||||
EndModal(1);
|
||||
|
||||
if( m_DC )
|
||||
m_Parent->DrawPanel->CursorOn( m_DC );
|
||||
if( RastnestIsChanged ) // The net ratsnest must be recalculated
|
||||
m_Parent->GetBoard()->m_Status_Pcb = 0;
|
||||
}
|
||||
|
|
|
@ -689,7 +689,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PCB_EDIT_PAD:
|
||||
InstallPadOptionsFrame( (D_PAD*) GetCurItem(), &dc, pos );
|
||||
InstallPadOptionsFrame( (D_PAD*) GetCurItem() );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ this file again."));
|
|||
AuxiliaryToolBar_Update_UI();
|
||||
|
||||
// Display the loaded board:
|
||||
DrawPanel->Refresh( true);
|
||||
Zoom_Automatique( false );
|
||||
wxSafeYield(); // Needed if we want to see the board now.
|
||||
|
||||
// Compile rastnest and displays net info
|
||||
|
|
|
@ -80,11 +80,7 @@ void DIALOG_GLOBAL_PADS_EDITION::OnCancelClick( wxCommandEvent& event )
|
|||
*/
|
||||
void DIALOG_GLOBAL_PADS_EDITION::InstallPadEditor( wxCommandEvent& event )
|
||||
{
|
||||
KicadGraphicContext dc( m_Parent->DrawPanel );
|
||||
|
||||
m_Parent->DrawPanel->CursorOff( &dc );
|
||||
m_Parent->InstallPadOptionsFrame( m_CurrentPad, &dc, wxDefaultPosition );
|
||||
m_Parent->DrawPanel->CursorOn( &dc );
|
||||
m_Parent->InstallPadOptionsFrame( m_CurrentPad );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_MODEDIT_PAD_SETTINGS:
|
||||
InstallPadOptionsFrame( NULL, NULL, wxPoint( -1, -1 ) );
|
||||
InstallPadOptionsFrame( NULL );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_CHECK:
|
||||
|
@ -427,7 +427,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
else
|
||||
{
|
||||
SetToolID( id, wxCURSOR_ARROW, _( "Pad Settings" ) );
|
||||
InstallPadOptionsFrame( NULL, NULL, wxPoint( -1, -1 ) );
|
||||
InstallPadOptionsFrame( NULL );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
}
|
||||
break;
|
||||
|
@ -491,8 +491,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_EDIT_PAD:
|
||||
{
|
||||
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(),
|
||||
&dc, pos );
|
||||
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem() );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
break;
|
||||
|
@ -626,7 +625,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
if( item->Type() != TYPE_PAD )
|
||||
item = NULL;
|
||||
}
|
||||
InstallPadOptionsFrame( (D_PAD*) item, &dc, pos );
|
||||
InstallPadOptionsFrame( (D_PAD*) item );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
switch( DrawStruct->Type() )
|
||||
{
|
||||
case TYPE_PAD:
|
||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct, DC, pos );
|
||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
|
@ -409,7 +409,6 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) DrawStruct );
|
||||
int ret = dialog.ShowModal();
|
||||
GetScreen()->GetCurItem()->m_Flags = 0;
|
||||
GetScreen()->GetCurItem()->m_Flags = 0;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
if( ret > 0 )
|
||||
DrawPanel->Refresh();
|
||||
|
|
|
@ -426,7 +426,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
|
||||
case TYPE_PAD:
|
||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct, DC, pos );
|
||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
|
|
|
@ -215,6 +215,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
|
|||
{
|
||||
m_FrameName = wxT( "PcbFrame" );
|
||||
m_Draw_Sheet_Ref = true; // true to display sheet references
|
||||
m_Draw_Axis = false; // true to display X and Y axis
|
||||
m_Draw_Auxiliary_Axis = true;
|
||||
m_SelTrackWidthBox = NULL;
|
||||
m_SelViaSizeBox = NULL;
|
||||
|
|
|
@ -30,8 +30,6 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
|
|||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
|
||||
KicadGraphicContext dc( DrawPanel );
|
||||
|
||||
wxFileName fn;
|
||||
|
||||
pos = GetPosition();
|
||||
|
@ -61,17 +59,17 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
|
|||
|
||||
case ID_OPTIONS_SETUP:
|
||||
{
|
||||
Dialog_GeneralOptions dlg( this, &dc );
|
||||
Dialog_GeneralOptions dlg( this );
|
||||
dlg.ShowModal();
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_PCB_DRAWINGS_WIDTHS_SETUP:
|
||||
InstallPcbOptionsFrame( pos, &dc, id );
|
||||
InstallPcbOptionsFrame( id );
|
||||
break;
|
||||
|
||||
case ID_PCB_PAD_SETUP:
|
||||
InstallPadOptionsFrame( NULL, NULL, pos );
|
||||
InstallPadOptionsFrame( NULL );
|
||||
break;
|
||||
|
||||
case ID_CONFIG_SAVE:
|
||||
|
|
|
@ -38,7 +38,7 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
|
|||
case ID_PCB_ADD_LINE_BUTT:
|
||||
case ID_PCB_COTATION_BUTT:
|
||||
case ID_PCB_ADD_TEXT_BUTT:
|
||||
InstallPcbOptionsFrame( pos, NULL, ID_PCB_DRAWINGS_WIDTHS_SETUP );
|
||||
InstallPcbOptionsFrame( ID_PCB_DRAWINGS_WIDTHS_SETUP );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -59,7 +59,7 @@ void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
|
|||
switch( id )
|
||||
{
|
||||
case ID_MODEDIT_ADD_PAD:
|
||||
InstallPadOptionsFrame( NULL, NULL, wxPoint( -1, -1 ) );
|
||||
InstallPadOptionsFrame( NULL );
|
||||
break;
|
||||
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
|
|
Loading…
Reference in New Issue