Loading pcbnew/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ set(PCBNEW_SRCS dialog_freeroute_exchange.cpp # dialog_gendrill.cpp dialog_general_options.cpp dialog_generaloptions_BoardEditor_base.cpp # dialog_graphic_items_options.cpp # dialog_initpcb.cpp # dialog_netlist.cpp Loading pcbnew/dialog_general_options.cpp +50 −409 Original line number Diff line number Diff line ///////////////////////////////////////////////////////////////////////////// // Name: dialog_general_options.cpp // Purpose: // Author: jean-pierre Charras // Modified by: // Created: 21/01/2006 18:28:47 // RCS-ID: // Copyright: License GNU // Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 21/01/2006 18:28:47 #if defined (__GNUG__) && !defined (NO_GCC_PRAGMA) #pragma implementation "dialog_general_options.h" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif ////@begin includes ////@end includes #include "fctsys.h" #include "common.h" #include "pcbnew.h" #include "id.h" #include "dialog_general_options.h" ////@begin XPM images ////@end XPM images #include "dialog_generaloptions_BoardEditor_base.h" /***********************************************************************/ class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base /***********************************************************************/ { private: WinEDA_PcbFrame* m_Parent; wxDC* m_DC; public: Dialog_GeneralOptions( WinEDA_PcbFrame* parent, wxDC* DC ); ~Dialog_GeneralOptions() {}; void OnInitDialog( wxInitDialogEvent& event ); void OnOkClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); }; /*****************************************************************/ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) /*****************************************************************/ /* Mises a jour de differentes variables de gestion d'options apres action sur * le toolbar d'options /* Must be called on a click on the left toolbar (options toolbar * Update variables according to the tools states */ { int id = event.GetId(); Loading Loading @@ -160,58 +146,43 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) } /*! * WinEDA_PcbGeneralOptionsFrame type definition */ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbGeneralOptionsFrame, wxDialog ) /*! * WinEDA_PcbGeneralOptionsFrame event table definition */ BEGIN_EVENT_TABLE( WinEDA_PcbGeneralOptionsFrame, wxDialog ) ////@begin WinEDA_PcbGeneralOptionsFrame event table entries EVT_BUTTON( wxID_OK, WinEDA_PcbGeneralOptionsFrame::OnOkClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_PcbGeneralOptionsFrame::OnCancelClick ) ////@end WinEDA_PcbGeneralOptionsFrame event table entries Dialog_GeneralOptions::Dialog_GeneralOptions( WinEDA_PcbFrame* parent, wxDC* DC ) : DialogGeneralOptionsBoardEditor_base( parent ) { m_Parent = parent; m_DC = DC; } END_EVENT_TABLE() /*! * WinEDA_PcbGeneralOptionsFrame constructors * Dialog_GeneralOptions creator */ WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame() void Dialog_GeneralOptions::OnInitDialog( wxInitDialogEvent& event ) { } WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame( WinEDA_PcbFrame* parent, wxDC* DC, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { m_Parent = parent; m_DC = DC; SetFont( *g_DialogFont ); SetFocus(); Create( parent, id, caption, pos, size, style ); /* Set display options */ m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 ); m_BoxUnits->SetSelection( g_UnitMetric ? 1 : 0 ); m_UnitsSelection->SetSelection( g_UnitMetric ? 1 : 0 ); m_CursorShape->SetSelection( g_CursorShape ? 1 : 0 ); wxString timevalue; timevalue << g_TimeOut / 60; m_SaveTime->SetValue( timevalue ); m_LayerNumber->SetValue( g_DesignSettings.m_CopperLayerCount ); int layer_count[] = {1,2,4,6,8,10,12,14,16}; m_LayerNumber->SetSelection(1); for ( unsigned ii = 0; ii < sizeof(layer_count); ii++ ) { if ( g_DesignSettings.m_CopperLayerCount == layer_count[ii] ) continue; m_LayerNumber->SetSelection(ii); break; } m_LayerNumber->SetSelection( g_DesignSettings.m_CopperLayerCount ); m_MaxShowLinks->SetValue( g_MaxLinksShowed ); m_DrcOn->SetValue( Drc_On ); Loading @@ -223,359 +194,28 @@ WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame( WinEDA_PcbFrame* p m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); } /*! * WinEDA_PcbGeneralOptionsFrame creator */ m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption ); m_MagneticTrackOptCtrl->SetSelection( g_MagneticTrackOption ); bool WinEDA_PcbGeneralOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin WinEDA_PcbGeneralOptionsFrame member initialisation m_PolarDisplay = NULL; m_BoxUnits = NULL; m_CursorShape = NULL; m_LayerNumber = NULL; m_MaxShowLinks = NULL; m_SaveTime = NULL; m_DrcOn = NULL; m_ShowGlobalRatsnest = NULL; m_ShowModuleRatsnest = NULL; m_TrackAutodel = NULL; m_Track_45_Only_Ctrl = NULL; m_Segments_45_Only_Ctrl = NULL; m_AutoPANOpt = NULL; m_Track_DoubleSegm_Ctrl = NULL; m_MagneticPadOptCtrl = NULL; m_MagneticTrackOptCtrl = NULL; ////@end WinEDA_PcbGeneralOptionsFrame member initialisation ////@begin WinEDA_PcbGeneralOptionsFrame creation SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); if( GetSizer() ) { GetSizer()->SetSizeHints( this ); } Centre(); ////@end WinEDA_PcbGeneralOptionsFrame creation SetFont( *g_DialogFont ); return true; } /*! * Control creation for WinEDA_PcbGeneralOptionsFrame */ void WinEDA_PcbGeneralOptionsFrame::CreateControls() { ////@begin WinEDA_PcbGeneralOptionsFrame content construction // Generated by DialogBlocks, Mon 03 Mar 2008 04:27:22 PM EST (unregistered) WinEDA_PcbGeneralOptionsFrame* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL ); itemDialog1->SetSizer( itemBoxSizer2 ); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 5 ); wxArrayString m_PolarDisplayStrings; m_PolarDisplayStrings.Add( _( "No Display" ) ); m_PolarDisplayStrings.Add( _( "Display" ) ); m_PolarDisplay = new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Display Polar Coord" ), wxDefaultPosition, wxDefaultSize, m_PolarDisplayStrings, 1, wxRA_SPECIFY_COLS ); m_PolarDisplay->SetSelection( 0 ); itemBoxSizer3->Add( m_PolarDisplay, 0, wxALIGN_LEFT | wxALL, 5 ); wxArrayString m_BoxUnitsStrings; m_BoxUnitsStrings.Add( _( "Inches" ) ); m_BoxUnitsStrings.Add( _( "millimeters" ) ); m_BoxUnits = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _( "Units" ), wxDefaultPosition, wxDefaultSize, m_BoxUnitsStrings, 1, wxRA_SPECIFY_COLS ); m_BoxUnits->SetSelection( 0 ); itemBoxSizer3->Add( m_BoxUnits, 0, wxALIGN_LEFT | wxALL, 5 ); wxArrayString m_CursorShapeStrings; m_CursorShapeStrings.Add( _( "Small" ) ); m_CursorShapeStrings.Add( _( "Big" ) ); m_CursorShape = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _( "Cursor" ), wxDefaultPosition, wxDefaultSize, m_CursorShapeStrings, 1, wxRA_SPECIFY_COLS ); m_CursorShape->SetSelection( 0 ); itemBoxSizer3->Add( m_CursorShape, 0, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* itemBoxSizer7 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer7, 0, wxGROW | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer8Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Number of Layers:" ) ); wxStaticBoxSizer* itemStaticBoxSizer8 = new wxStaticBoxSizer( itemStaticBoxSizer8Static, wxVERTICAL ); itemBoxSizer7->Add( itemStaticBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_LayerNumber = new wxSpinCtrl( itemDialog1, ID_SPINCTRL1, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 16, 1 ); itemStaticBoxSizer8->Add( m_LayerNumber, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Max Links:" ) ); wxStaticBoxSizer* itemStaticBoxSizer10 = new wxStaticBoxSizer( itemStaticBoxSizer10Static, wxVERTICAL ); itemBoxSizer7->Add( itemStaticBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_MaxShowLinks = new wxSpinCtrl( itemDialog1, ID_SPINCTRL2, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 5, 1 ); itemStaticBoxSizer10->Add( m_MaxShowLinks, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Auto Save (minuts):" ) ); wxStaticBoxSizer* itemStaticBoxSizer12 = new wxStaticBoxSizer( itemStaticBoxSizer12Static, wxVERTICAL ); itemBoxSizer7->Add( itemStaticBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_SaveTime = new wxSpinCtrl( itemDialog1, ID_SPINCTRL3, _T( "0" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 60, 0 ); itemStaticBoxSizer12->Add( m_SaveTime, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxBoxSizer* itemBoxSizer14 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer14, 0, wxGROW | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Options:" ) ); wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer( itemStaticBoxSizer15Static, wxVERTICAL ); itemBoxSizer14->Add( itemStaticBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_DrcOn = new wxCheckBox( itemDialog1, ID_CHECKBOX, _( "Drc ON" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_DrcOn->SetValue( false ); m_DrcOn->SetForegroundColour( wxColour( 198, 0, 0 ) ); itemStaticBoxSizer15->Add( m_DrcOn, 0, wxALIGN_LEFT | wxALL, 5 ); m_ShowGlobalRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _( "Show Ratsnest" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowGlobalRatsnest->SetValue( false ); itemStaticBoxSizer15->Add( m_ShowGlobalRatsnest, 0, wxALIGN_LEFT | wxALL, 5 ); m_ShowModuleRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _( "Show Mod Ratsnest" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowModuleRatsnest->SetValue( false ); itemStaticBoxSizer15->Add( m_ShowModuleRatsnest, 0, wxALIGN_LEFT | wxALL, 5 ); m_TrackAutodel = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _( "Tracks Auto Del" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_TrackAutodel->SetValue( false ); itemStaticBoxSizer15->Add( m_TrackAutodel, 0, wxALIGN_LEFT | wxALL, 5 ); m_Track_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _( "Track only 45 degrees" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Track_45_Only_Ctrl->SetValue( false ); itemStaticBoxSizer15->Add( m_Track_45_Only_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 ); m_Segments_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _( "Segments 45 Only" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Segments_45_Only_Ctrl->SetValue( false ); itemStaticBoxSizer15->Add( m_Segments_45_Only_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 ); m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _( "Auto PAN" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AutoPANOpt->SetValue( false ); m_AutoPANOpt->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemStaticBoxSizer15->Add( m_AutoPANOpt, 0, wxALIGN_LEFT | wxALL, 5 ); m_Track_DoubleSegm_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _( "Double Segm Track" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Track_DoubleSegm_Ctrl->SetValue( false ); m_Track_DoubleSegm_Ctrl->SetForegroundColour( wxColour( 0, 144, 0 ) ); itemStaticBoxSizer15->Add( m_Track_DoubleSegm_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* itemBoxSizer24 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer24, 0, wxALIGN_TOP | wxALL, 5 ); wxArrayString m_MagneticPadOptCtrlStrings; m_MagneticPadOptCtrlStrings.Add( _( "Never" ) ); m_MagneticPadOptCtrlStrings.Add( _( "When creating tracks" ) ); m_MagneticPadOptCtrlStrings.Add( _( "Always" ) ); m_MagneticPadOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _( "Magnetic Pads" ), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlStrings, 1, wxRA_SPECIFY_COLS ); m_MagneticPadOptCtrl->SetSelection( 0 ); if( WinEDA_PcbGeneralOptionsFrame::ShowToolTips() ) m_MagneticPadOptCtrl->SetToolTip( _( "control the capture of the pcb cursor when the mouse cursor enters a pad area" ) ); itemBoxSizer24->Add( m_MagneticPadOptCtrl, 0, wxGROW | wxALL, 5 ); wxArrayString m_MagneticTrackOptCtrlStrings; m_MagneticTrackOptCtrlStrings.Add( _( "Never" ) ); m_MagneticTrackOptCtrlStrings.Add( _( "When creating tracks" ) ); m_MagneticTrackOptCtrlStrings.Add( _( "Always" ) ); m_MagneticTrackOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _( "Magnetic Tracks" ), wxDefaultPosition, wxDefaultSize, m_MagneticTrackOptCtrlStrings, 1, wxRA_SPECIFY_COLS ); m_MagneticTrackOptCtrl->SetSelection( 0 ); if( WinEDA_PcbGeneralOptionsFrame::ShowToolTips() ) m_MagneticTrackOptCtrl->SetToolTip( _( "control the capture of the pcb cursor when the mouse cursor enters a track" ) ); itemBoxSizer24->Add( m_MagneticTrackOptCtrl, 0, wxGROW | wxALL, 5 ); wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _( "&OK" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton27->SetForegroundColour( wxColour( 221, 0, 0 ) ); itemBoxSizer24->Add( itemButton27, 0, wxGROW | wxALL, 5 ); wxButton* itemButton28 = new wxButton( itemDialog1, wxID_CANCEL, _( "&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton28->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemBoxSizer24->Add( itemButton28, 0, wxGROW | wxALL, 5 ); // Set validators m_MagneticPadOptCtrl->SetValidator( wxGenericValidator( &g_MagneticPadOption ) ); m_MagneticTrackOptCtrl->SetValidator( wxGenericValidator( &g_MagneticTrackOption ) ); ////@end WinEDA_PcbGeneralOptionsFrame content construction } /*! * Should we show tooltips? */ bool WinEDA_PcbGeneralOptionsFrame::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap WinEDA_PcbGeneralOptionsFrame::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin WinEDA_PcbGeneralOptionsFrame bitmap retrieval wxUnusedVar( name ); return wxNullBitmap; ////@end WinEDA_PcbGeneralOptionsFrame bitmap retrieval } /*! * Get icon resources */ wxIcon WinEDA_PcbGeneralOptionsFrame::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin WinEDA_PcbGeneralOptionsFrame icon retrieval wxUnusedVar( name ); return wxNullIcon; ////@end WinEDA_PcbGeneralOptionsFrame icon retrieval } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ void WinEDA_PcbGeneralOptionsFrame::OnCancelClick( wxCommandEvent& event ) /*****************************************************************/ void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event ) /*****************************************************************/ { ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. // Before editing this code, remove the block markers. event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ void WinEDA_PcbGeneralOptionsFrame::OnOkClick( wxCommandEvent& event ) { AcceptPcbOptions( event ); ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. // Before editing this code, remove the block markers. event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. } /**************************************************************************/ void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions( wxCommandEvent& event ) void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) /**************************************************************************/ { int ii; Loading @@ -583,7 +223,7 @@ void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions( wxCommandEvent& event ) DisplayOpt.DisplayPolarCood = (m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE; ii = g_UnitMetric; g_UnitMetric = (m_BoxUnits->GetSelection() == 0) ? 0 : 1; g_UnitMetric = (m_UnitsSelection->GetSelection() == 0) ? 0 : 1; if( ii != g_UnitMetric ) m_Parent->ReCreateAuxiliaryToolbar(); Loading @@ -591,7 +231,8 @@ void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions( wxCommandEvent& event ) g_TimeOut = 60 * m_SaveTime->GetValue(); /* Mise a jour de la combobox d'affichage de la couche active */ g_DesignSettings.m_CopperLayerCount = m_LayerNumber->GetValue(); int layer_count[] = {1,2,4,6,8,10,12,14,16}; g_DesignSettings.m_CopperLayerCount = layer_count[m_LayerNumber->GetSelection()]; m_Parent->ReCreateLayerBox( NULL ); g_MaxLinksShowed = m_MaxShowLinks->GetValue(); Loading Loading @@ -660,8 +301,8 @@ void WinEDA_PcbFrame::InstallPcbOptionsFrame( const wxPoint& pos, case ID_OPTIONS_SETUP: { WinEDA_PcbGeneralOptionsFrame* OptionsFrame = new WinEDA_PcbGeneralOptionsFrame( this, DC ); Dialog_GeneralOptions* OptionsFrame = new Dialog_GeneralOptions( this, DC ); OptionsFrame->ShowModal(); OptionsFrame->Destroy(); Loading Loading
pcbnew/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ set(PCBNEW_SRCS dialog_freeroute_exchange.cpp # dialog_gendrill.cpp dialog_general_options.cpp dialog_generaloptions_BoardEditor_base.cpp # dialog_graphic_items_options.cpp # dialog_initpcb.cpp # dialog_netlist.cpp Loading
pcbnew/dialog_general_options.cpp +50 −409 Original line number Diff line number Diff line ///////////////////////////////////////////////////////////////////////////// // Name: dialog_general_options.cpp // Purpose: // Author: jean-pierre Charras // Modified by: // Created: 21/01/2006 18:28:47 // RCS-ID: // Copyright: License GNU // Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 21/01/2006 18:28:47 #if defined (__GNUG__) && !defined (NO_GCC_PRAGMA) #pragma implementation "dialog_general_options.h" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif ////@begin includes ////@end includes #include "fctsys.h" #include "common.h" #include "pcbnew.h" #include "id.h" #include "dialog_general_options.h" ////@begin XPM images ////@end XPM images #include "dialog_generaloptions_BoardEditor_base.h" /***********************************************************************/ class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base /***********************************************************************/ { private: WinEDA_PcbFrame* m_Parent; wxDC* m_DC; public: Dialog_GeneralOptions( WinEDA_PcbFrame* parent, wxDC* DC ); ~Dialog_GeneralOptions() {}; void OnInitDialog( wxInitDialogEvent& event ); void OnOkClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); }; /*****************************************************************/ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) /*****************************************************************/ /* Mises a jour de differentes variables de gestion d'options apres action sur * le toolbar d'options /* Must be called on a click on the left toolbar (options toolbar * Update variables according to the tools states */ { int id = event.GetId(); Loading Loading @@ -160,58 +146,43 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) } /*! * WinEDA_PcbGeneralOptionsFrame type definition */ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbGeneralOptionsFrame, wxDialog ) /*! * WinEDA_PcbGeneralOptionsFrame event table definition */ BEGIN_EVENT_TABLE( WinEDA_PcbGeneralOptionsFrame, wxDialog ) ////@begin WinEDA_PcbGeneralOptionsFrame event table entries EVT_BUTTON( wxID_OK, WinEDA_PcbGeneralOptionsFrame::OnOkClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_PcbGeneralOptionsFrame::OnCancelClick ) ////@end WinEDA_PcbGeneralOptionsFrame event table entries Dialog_GeneralOptions::Dialog_GeneralOptions( WinEDA_PcbFrame* parent, wxDC* DC ) : DialogGeneralOptionsBoardEditor_base( parent ) { m_Parent = parent; m_DC = DC; } END_EVENT_TABLE() /*! * WinEDA_PcbGeneralOptionsFrame constructors * Dialog_GeneralOptions creator */ WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame() void Dialog_GeneralOptions::OnInitDialog( wxInitDialogEvent& event ) { } WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame( WinEDA_PcbFrame* parent, wxDC* DC, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { m_Parent = parent; m_DC = DC; SetFont( *g_DialogFont ); SetFocus(); Create( parent, id, caption, pos, size, style ); /* Set display options */ m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 ); m_BoxUnits->SetSelection( g_UnitMetric ? 1 : 0 ); m_UnitsSelection->SetSelection( g_UnitMetric ? 1 : 0 ); m_CursorShape->SetSelection( g_CursorShape ? 1 : 0 ); wxString timevalue; timevalue << g_TimeOut / 60; m_SaveTime->SetValue( timevalue ); m_LayerNumber->SetValue( g_DesignSettings.m_CopperLayerCount ); int layer_count[] = {1,2,4,6,8,10,12,14,16}; m_LayerNumber->SetSelection(1); for ( unsigned ii = 0; ii < sizeof(layer_count); ii++ ) { if ( g_DesignSettings.m_CopperLayerCount == layer_count[ii] ) continue; m_LayerNumber->SetSelection(ii); break; } m_LayerNumber->SetSelection( g_DesignSettings.m_CopperLayerCount ); m_MaxShowLinks->SetValue( g_MaxLinksShowed ); m_DrcOn->SetValue( Drc_On ); Loading @@ -223,359 +194,28 @@ WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame( WinEDA_PcbFrame* p m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); } /*! * WinEDA_PcbGeneralOptionsFrame creator */ m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption ); m_MagneticTrackOptCtrl->SetSelection( g_MagneticTrackOption ); bool WinEDA_PcbGeneralOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin WinEDA_PcbGeneralOptionsFrame member initialisation m_PolarDisplay = NULL; m_BoxUnits = NULL; m_CursorShape = NULL; m_LayerNumber = NULL; m_MaxShowLinks = NULL; m_SaveTime = NULL; m_DrcOn = NULL; m_ShowGlobalRatsnest = NULL; m_ShowModuleRatsnest = NULL; m_TrackAutodel = NULL; m_Track_45_Only_Ctrl = NULL; m_Segments_45_Only_Ctrl = NULL; m_AutoPANOpt = NULL; m_Track_DoubleSegm_Ctrl = NULL; m_MagneticPadOptCtrl = NULL; m_MagneticTrackOptCtrl = NULL; ////@end WinEDA_PcbGeneralOptionsFrame member initialisation ////@begin WinEDA_PcbGeneralOptionsFrame creation SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); if( GetSizer() ) { GetSizer()->SetSizeHints( this ); } Centre(); ////@end WinEDA_PcbGeneralOptionsFrame creation SetFont( *g_DialogFont ); return true; } /*! * Control creation for WinEDA_PcbGeneralOptionsFrame */ void WinEDA_PcbGeneralOptionsFrame::CreateControls() { ////@begin WinEDA_PcbGeneralOptionsFrame content construction // Generated by DialogBlocks, Mon 03 Mar 2008 04:27:22 PM EST (unregistered) WinEDA_PcbGeneralOptionsFrame* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL ); itemDialog1->SetSizer( itemBoxSizer2 ); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 5 ); wxArrayString m_PolarDisplayStrings; m_PolarDisplayStrings.Add( _( "No Display" ) ); m_PolarDisplayStrings.Add( _( "Display" ) ); m_PolarDisplay = new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Display Polar Coord" ), wxDefaultPosition, wxDefaultSize, m_PolarDisplayStrings, 1, wxRA_SPECIFY_COLS ); m_PolarDisplay->SetSelection( 0 ); itemBoxSizer3->Add( m_PolarDisplay, 0, wxALIGN_LEFT | wxALL, 5 ); wxArrayString m_BoxUnitsStrings; m_BoxUnitsStrings.Add( _( "Inches" ) ); m_BoxUnitsStrings.Add( _( "millimeters" ) ); m_BoxUnits = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _( "Units" ), wxDefaultPosition, wxDefaultSize, m_BoxUnitsStrings, 1, wxRA_SPECIFY_COLS ); m_BoxUnits->SetSelection( 0 ); itemBoxSizer3->Add( m_BoxUnits, 0, wxALIGN_LEFT | wxALL, 5 ); wxArrayString m_CursorShapeStrings; m_CursorShapeStrings.Add( _( "Small" ) ); m_CursorShapeStrings.Add( _( "Big" ) ); m_CursorShape = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _( "Cursor" ), wxDefaultPosition, wxDefaultSize, m_CursorShapeStrings, 1, wxRA_SPECIFY_COLS ); m_CursorShape->SetSelection( 0 ); itemBoxSizer3->Add( m_CursorShape, 0, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* itemBoxSizer7 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer7, 0, wxGROW | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer8Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Number of Layers:" ) ); wxStaticBoxSizer* itemStaticBoxSizer8 = new wxStaticBoxSizer( itemStaticBoxSizer8Static, wxVERTICAL ); itemBoxSizer7->Add( itemStaticBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_LayerNumber = new wxSpinCtrl( itemDialog1, ID_SPINCTRL1, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 16, 1 ); itemStaticBoxSizer8->Add( m_LayerNumber, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Max Links:" ) ); wxStaticBoxSizer* itemStaticBoxSizer10 = new wxStaticBoxSizer( itemStaticBoxSizer10Static, wxVERTICAL ); itemBoxSizer7->Add( itemStaticBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_MaxShowLinks = new wxSpinCtrl( itemDialog1, ID_SPINCTRL2, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 5, 1 ); itemStaticBoxSizer10->Add( m_MaxShowLinks, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Auto Save (minuts):" ) ); wxStaticBoxSizer* itemStaticBoxSizer12 = new wxStaticBoxSizer( itemStaticBoxSizer12Static, wxVERTICAL ); itemBoxSizer7->Add( itemStaticBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_SaveTime = new wxSpinCtrl( itemDialog1, ID_SPINCTRL3, _T( "0" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 60, 0 ); itemStaticBoxSizer12->Add( m_SaveTime, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxBoxSizer* itemBoxSizer14 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer14, 0, wxGROW | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Options:" ) ); wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer( itemStaticBoxSizer15Static, wxVERTICAL ); itemBoxSizer14->Add( itemStaticBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); m_DrcOn = new wxCheckBox( itemDialog1, ID_CHECKBOX, _( "Drc ON" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_DrcOn->SetValue( false ); m_DrcOn->SetForegroundColour( wxColour( 198, 0, 0 ) ); itemStaticBoxSizer15->Add( m_DrcOn, 0, wxALIGN_LEFT | wxALL, 5 ); m_ShowGlobalRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _( "Show Ratsnest" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowGlobalRatsnest->SetValue( false ); itemStaticBoxSizer15->Add( m_ShowGlobalRatsnest, 0, wxALIGN_LEFT | wxALL, 5 ); m_ShowModuleRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _( "Show Mod Ratsnest" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowModuleRatsnest->SetValue( false ); itemStaticBoxSizer15->Add( m_ShowModuleRatsnest, 0, wxALIGN_LEFT | wxALL, 5 ); m_TrackAutodel = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _( "Tracks Auto Del" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_TrackAutodel->SetValue( false ); itemStaticBoxSizer15->Add( m_TrackAutodel, 0, wxALIGN_LEFT | wxALL, 5 ); m_Track_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _( "Track only 45 degrees" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Track_45_Only_Ctrl->SetValue( false ); itemStaticBoxSizer15->Add( m_Track_45_Only_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 ); m_Segments_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _( "Segments 45 Only" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Segments_45_Only_Ctrl->SetValue( false ); itemStaticBoxSizer15->Add( m_Segments_45_Only_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 ); m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _( "Auto PAN" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AutoPANOpt->SetValue( false ); m_AutoPANOpt->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemStaticBoxSizer15->Add( m_AutoPANOpt, 0, wxALIGN_LEFT | wxALL, 5 ); m_Track_DoubleSegm_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _( "Double Segm Track" ), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Track_DoubleSegm_Ctrl->SetValue( false ); m_Track_DoubleSegm_Ctrl->SetForegroundColour( wxColour( 0, 144, 0 ) ); itemStaticBoxSizer15->Add( m_Track_DoubleSegm_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* itemBoxSizer24 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer2->Add( itemBoxSizer24, 0, wxALIGN_TOP | wxALL, 5 ); wxArrayString m_MagneticPadOptCtrlStrings; m_MagneticPadOptCtrlStrings.Add( _( "Never" ) ); m_MagneticPadOptCtrlStrings.Add( _( "When creating tracks" ) ); m_MagneticPadOptCtrlStrings.Add( _( "Always" ) ); m_MagneticPadOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _( "Magnetic Pads" ), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlStrings, 1, wxRA_SPECIFY_COLS ); m_MagneticPadOptCtrl->SetSelection( 0 ); if( WinEDA_PcbGeneralOptionsFrame::ShowToolTips() ) m_MagneticPadOptCtrl->SetToolTip( _( "control the capture of the pcb cursor when the mouse cursor enters a pad area" ) ); itemBoxSizer24->Add( m_MagneticPadOptCtrl, 0, wxGROW | wxALL, 5 ); wxArrayString m_MagneticTrackOptCtrlStrings; m_MagneticTrackOptCtrlStrings.Add( _( "Never" ) ); m_MagneticTrackOptCtrlStrings.Add( _( "When creating tracks" ) ); m_MagneticTrackOptCtrlStrings.Add( _( "Always" ) ); m_MagneticTrackOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _( "Magnetic Tracks" ), wxDefaultPosition, wxDefaultSize, m_MagneticTrackOptCtrlStrings, 1, wxRA_SPECIFY_COLS ); m_MagneticTrackOptCtrl->SetSelection( 0 ); if( WinEDA_PcbGeneralOptionsFrame::ShowToolTips() ) m_MagneticTrackOptCtrl->SetToolTip( _( "control the capture of the pcb cursor when the mouse cursor enters a track" ) ); itemBoxSizer24->Add( m_MagneticTrackOptCtrl, 0, wxGROW | wxALL, 5 ); wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _( "&OK" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton27->SetForegroundColour( wxColour( 221, 0, 0 ) ); itemBoxSizer24->Add( itemButton27, 0, wxGROW | wxALL, 5 ); wxButton* itemButton28 = new wxButton( itemDialog1, wxID_CANCEL, _( "&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton28->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemBoxSizer24->Add( itemButton28, 0, wxGROW | wxALL, 5 ); // Set validators m_MagneticPadOptCtrl->SetValidator( wxGenericValidator( &g_MagneticPadOption ) ); m_MagneticTrackOptCtrl->SetValidator( wxGenericValidator( &g_MagneticTrackOption ) ); ////@end WinEDA_PcbGeneralOptionsFrame content construction } /*! * Should we show tooltips? */ bool WinEDA_PcbGeneralOptionsFrame::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap WinEDA_PcbGeneralOptionsFrame::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin WinEDA_PcbGeneralOptionsFrame bitmap retrieval wxUnusedVar( name ); return wxNullBitmap; ////@end WinEDA_PcbGeneralOptionsFrame bitmap retrieval } /*! * Get icon resources */ wxIcon WinEDA_PcbGeneralOptionsFrame::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin WinEDA_PcbGeneralOptionsFrame icon retrieval wxUnusedVar( name ); return wxNullIcon; ////@end WinEDA_PcbGeneralOptionsFrame icon retrieval } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ void WinEDA_PcbGeneralOptionsFrame::OnCancelClick( wxCommandEvent& event ) /*****************************************************************/ void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event ) /*****************************************************************/ { ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. // Before editing this code, remove the block markers. event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ void WinEDA_PcbGeneralOptionsFrame::OnOkClick( wxCommandEvent& event ) { AcceptPcbOptions( event ); ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. // Before editing this code, remove the block markers. event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. } /**************************************************************************/ void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions( wxCommandEvent& event ) void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) /**************************************************************************/ { int ii; Loading @@ -583,7 +223,7 @@ void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions( wxCommandEvent& event ) DisplayOpt.DisplayPolarCood = (m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE; ii = g_UnitMetric; g_UnitMetric = (m_BoxUnits->GetSelection() == 0) ? 0 : 1; g_UnitMetric = (m_UnitsSelection->GetSelection() == 0) ? 0 : 1; if( ii != g_UnitMetric ) m_Parent->ReCreateAuxiliaryToolbar(); Loading @@ -591,7 +231,8 @@ void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions( wxCommandEvent& event ) g_TimeOut = 60 * m_SaveTime->GetValue(); /* Mise a jour de la combobox d'affichage de la couche active */ g_DesignSettings.m_CopperLayerCount = m_LayerNumber->GetValue(); int layer_count[] = {1,2,4,6,8,10,12,14,16}; g_DesignSettings.m_CopperLayerCount = layer_count[m_LayerNumber->GetSelection()]; m_Parent->ReCreateLayerBox( NULL ); g_MaxLinksShowed = m_MaxShowLinks->GetValue(); Loading Loading @@ -660,8 +301,8 @@ void WinEDA_PcbFrame::InstallPcbOptionsFrame( const wxPoint& pos, case ID_OPTIONS_SETUP: { WinEDA_PcbGeneralOptionsFrame* OptionsFrame = new WinEDA_PcbGeneralOptionsFrame( this, DC ); Dialog_GeneralOptions* OptionsFrame = new Dialog_GeneralOptions( this, DC ); OptionsFrame->ShowModal(); OptionsFrame->Destroy(); Loading