diff --git a/CMakeModules/CreateBzrVersionHeader.cmake b/CMakeModules/CreateBzrVersionHeader.cmake index 9964686741..38f0f0b7d3 100644 --- a/CMakeModules/CreateBzrVersionHeader.cmake +++ b/CMakeModules/CreateBzrVersionHeader.cmake @@ -56,7 +56,11 @@ macro( create_bzr_version_header ) if( Kicad_REPO_LAST_CHANGED_DATE ) string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3" _kicad_bzr_date ${Kicad_REPO_LAST_CHANGED_DATE} ) - set( KICAD_BUILD_VERSION "(${_kicad_bzr_date} BZR ${Kicad_REPO_REVISION})" ) + if( KICAD_GOST ) + set( KICAD_BUILD_VERSION "(${_kicad_bzr_date} BZR ${Kicad_REPO_REVISION} GOST)" ) + else( KICAD_GOST ) + set( KICAD_BUILD_VERSION "(${_kicad_bzr_date} BZR ${Kicad_REPO_REVISION})" ) + endif( KICAD_GOST ) # Definition to conditionally use date and revision returned from the # Bazaar log command instead of hand coded date and revision in diff --git a/common/drawframe.cpp b/common/drawframe.cpp index dcd1d6e843..b6dde7881e 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -346,8 +346,8 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) * index returned by GetSelection(). */ m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000; - screen->SetCrossHairPosition( DrawPanel->GetScreenCenterLogicalPosition() ); screen->SetGrid( id ); + screen->SetCrossHairPosition( screen->RefPos( true ) ); Refresh(); } diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 23ff91b2ca..30228160ce 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -60,6 +60,9 @@ public: EDA_UNITS_T m_UserGridUnit; wxRealPoint m_UserGridSize; + int m_FastGrid1; + int m_FastGrid2; + EDA_3D_FRAME* m_Draw3DFrame; FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 07a9fe4185..f3f62d184d 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -30,6 +30,8 @@ static const wxString DisplayViaFillEntry( wxT( "DiViaFi" ) ); static const wxString DisplayPadNumberEntry( wxT( "DiPadNu" ) ); static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) ); static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) ); +static const wxString FastGrid1Entry( wxT( "FastGrid1" ) ); +static const wxString FastGrid2Entry( wxT( "FastGrid2" ) ); /****************************/ @@ -76,6 +78,9 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, m_UserGridSize = wxRealPoint( 100.0, 100.0 ); m_UserGridUnit = INCHES; m_Collector = new GENERAL_COLLECTOR(); + + m_FastGrid1 = 0; + m_FastGrid2 = 0; } @@ -482,6 +487,11 @@ void PCB_BASE_FRAME::LoadSettings() cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true ); cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED ); + cfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0); + m_FastGrid1 = itmp; + cfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0); + m_FastGrid2 = itmp; + if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH ) m_DisplayModEdge = FILLED; @@ -518,6 +528,8 @@ void PCB_BASE_FRAME::SaveSettings() cfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum ); cfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge ); cfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText ); + cfg->Write( m_FrameName + FastGrid1Entry, ( long )m_FastGrid1 ); + cfg->Write( m_FrameName + FastGrid2Entry, ( long )m_FastGrid2 ); } diff --git a/pcbnew/dialogs/dialog_set_grid.fbp b/pcbnew/dialogs/dialog_set_grid.fbp index f169f1c07d..8bcd80c353 100644 --- a/pcbnew/dialogs/dialog_set_grid.fbp +++ b/pcbnew/dialogs/dialog_set_grid.fbp @@ -1,806 +1,1148 @@ - - - - - - C++ - 1 - UTF-8 - connect - dialog_set_grid_base - 1000 - none - 1 - dialog_set_grid - - . - - 1 - 0 - 0 - - - - - 1 - - - - 0 - wxID_ANY - - - DIALOG_SET_GRID_BASE - - 374,267 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Grid Origin and User Grid Size - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - bUpperSizer - wxHORIZONTAL - none - - 5 - wxEXPAND|wxALL - 1 - - wxID_ANY - User Grid Size - - sbLeftSizer - wxVERTICAL - none - - - 5 - wxALL|wxEXPAND - 0 - - - "Inches" "mm" - - 1 - - - 0 - wxID_ANY - Grid Size Units - 1 - - - m_UnitGrid - protected - - 0 - - wxRA_SPECIFY_COLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - User Grid Size X - - - m_staticTextSizeX - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptGridSizeX - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - User Grid Size Y - - - m_staticTextSizeY - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptGridSizeY - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 2 - - wxID_ANY - Grid Origin - - sbRightSizer - wxVERTICAL - none - - - 5 - wxALL|wxEXPAND - 0 - - 3 - wxBOTH - 1 - - 0 - - fgSizerGridOrigin - wxFLEX_GROWMODE_SPECIFIED - none - 2 - 0 - - 5 - wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT - 0 - - - - 1 - - - 0 - wxID_ANY - Grid origin X: - - - m_staticTextGridPosX - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_GridOriginXCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - Inches - - - m_TextPosXUnits - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT - 0 - - - - 1 - - - 0 - wxID_ANY - Grid origin Y: - - - m_staticTextGridPosY - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_GridOriginYCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - Inches - - - m_TextPosYUnits - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 0 - 1 - - - 0 - wxID_ANY - Reset Grid Origin - - - m_buttonReset - protected - - - - - - - - - OnResetGridOrgClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_RIGHT|wxTOP|wxBOTTOM - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer1 - protected - - OnCancelClick - - - - OnOkClick - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + UTF-8 + connect + dialog_set_grid_base + 1000 + none + 1 + dialog_set_grid + + . + + 1 + 1 + 0 + 0 + + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_SET_GRID_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Grid Origin and User Grid Size + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bUpperSizer + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + User Grid Size + + sbLeftSizer + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + + "Inches" "mm" + + 1 + 1 + + + 0 + wxID_ANY + Grid Size Units + 1 + + + m_UnitGrid + protected + + 0 + + wxRA_SPECIFY_COLS + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 10 + protected + 10 + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + User Grid Size X + + + m_staticTextSizeX + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + + 0 + + m_OptGridSizeX + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + User Grid Size Y + + + m_staticTextSizeY + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + + 0 + + m_OptGridSizeY + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer4 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Grid Origin + + sbRightSizer + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + 3 + wxBOTH + 1 + + 0 + + fgSizerGridOrigin + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Grid origin X: + + + m_staticTextGridPosX + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + + 0 + + m_GridOriginXCtrl + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Inches + + + m_TextPosXUnits + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Grid origin Y: + + + m_staticTextGridPosY + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + + 0 + + m_GridOriginYCtrl + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Inches + + + m_TextPosYUnits + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + 0 + 1 + + + 0 + wxID_ANY + Reset Grid Origin + + + m_buttonReset + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnResetGridOrgClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Grid for fast switching + + sbSizer4 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + 2 + wxBOTH + 1 + + 0 + + fgSizer3 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Fast Grid 1: + + + m_staticTextGrid1 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + + + + 1 + 1 + + + 0 + wxID_ANY + + + m_comboBoxGrid1 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + Combo! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Fast Grid 2: + + + m_staticTextGrid2 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + + + + 1 + 1 + + + 0 + wxID_ANY + + + m_comboBoxGrid2 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + Combo! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxTOP|wxBOTTOM + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/pcbnew/dialogs/dialog_set_grid_base.cpp b/pcbnew/dialogs/dialog_set_grid_base.cpp index 1065a60feb..62c30c3776 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.cpp +++ b/pcbnew/dialogs/dialog_set_grid_base.cpp @@ -1,113 +1,147 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_set_grid_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizerMain; - bSizerMain = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bUpperSizer; - bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbLeftSizer; - sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Grid Size") ), wxVERTICAL ); - - wxString m_UnitGridChoices[] = { _("Inches"), _("mm") }; - int m_UnitGridNChoices = sizeof( m_UnitGridChoices ) / sizeof( wxString ); - m_UnitGrid = new wxRadioBox( this, wxID_ANY, _("Grid Size Units"), wxDefaultPosition, wxDefaultSize, m_UnitGridNChoices, m_UnitGridChoices, 1, wxRA_SPECIFY_COLS ); - m_UnitGrid->SetSelection( 0 ); - sbLeftSizer->Add( m_UnitGrid, 0, wxALL|wxEXPAND, 5 ); - - - sbLeftSizer->Add( 10, 10, 0, 0, 5 ); - - m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("User Grid Size X"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSizeX->Wrap( -1 ); - sbLeftSizer->Add( m_staticTextSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_OptGridSizeX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbLeftSizer->Add( m_OptGridSizeX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("User Grid Size Y"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSizeY->Wrap( -1 ); - sbLeftSizer->Add( m_staticTextSizeY, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_OptGridSizeY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbLeftSizer->Add( m_OptGridSizeY, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - bUpperSizer->Add( sbLeftSizer, 1, wxEXPAND|wxALL, 5 ); - - wxStaticBoxSizer* sbRightSizer; - sbRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Origin") ), wxVERTICAL ); - - wxFlexGridSizer* fgSizerGridOrigin; - fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 0, 0 ); - fgSizerGridOrigin->AddGrowableCol( 1 ); - fgSizerGridOrigin->SetFlexibleDirection( wxBOTH ); - fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticTextGridPosX = new wxStaticText( this, wxID_ANY, _("Grid origin X:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextGridPosX->Wrap( -1 ); - fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_GridOriginXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_TextPosXUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextPosXUnits->Wrap( -1 ); - fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextGridPosY = new wxStaticText( this, wxID_ANY, _("Grid origin Y:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextGridPosY->Wrap( -1 ); - fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_GridOriginYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_TextPosYUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextPosYUnits->Wrap( -1 ); - fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - sbRightSizer->Add( fgSizerGridOrigin, 0, wxALL|wxEXPAND, 5 ); - - m_buttonReset = new wxButton( this, wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 ); - sbRightSizer->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 ); - - bUpperSizer->Add( sbRightSizer, 2, wxEXPAND|wxALL, 5 ); - - bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); - - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( this, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); - m_sdbSizer1->Realize(); - bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM, 5 ); - - this->SetSizer( bSizerMain ); - this->Layout(); - - // Connect Events - m_buttonReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this ); - m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this ); - m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this ); -} - -DIALOG_SET_GRID_BASE::~DIALOG_SET_GRID_BASE() -{ - // Disconnect Events - m_buttonReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this ); - m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this ); - m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this ); -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Sep 6 2011) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_set_grid_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bUpperSizer; + bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbLeftSizer; + sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Grid Size") ), wxVERTICAL ); + + wxString m_UnitGridChoices[] = { _("Inches"), _("mm") }; + int m_UnitGridNChoices = sizeof( m_UnitGridChoices ) / sizeof( wxString ); + m_UnitGrid = new wxRadioBox( this, wxID_ANY, _("Grid Size Units"), wxDefaultPosition, wxDefaultSize, m_UnitGridNChoices, m_UnitGridChoices, 1, wxRA_SPECIFY_COLS ); + m_UnitGrid->SetSelection( 0 ); + sbLeftSizer->Add( m_UnitGrid, 0, wxALL|wxEXPAND, 5 ); + + + sbLeftSizer->Add( 10, 10, 0, 0, 5 ); + + m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("User Grid Size X"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSizeX->Wrap( -1 ); + sbLeftSizer->Add( m_staticTextSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_OptGridSizeX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbLeftSizer->Add( m_OptGridSizeX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("User Grid Size Y"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSizeY->Wrap( -1 ); + sbLeftSizer->Add( m_staticTextSizeY, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_OptGridSizeY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbLeftSizer->Add( m_OptGridSizeY, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + bUpperSizer->Add( sbLeftSizer, 1, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer4; + bSizer4 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbRightSizer; + sbRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Origin") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizerGridOrigin; + fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 0, 0 ); + fgSizerGridOrigin->AddGrowableCol( 1 ); + fgSizerGridOrigin->SetFlexibleDirection( wxBOTH ); + fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextGridPosX = new wxStaticText( this, wxID_ANY, _("Grid origin X:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGridPosX->Wrap( -1 ); + fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + m_GridOriginXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextPosXUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextPosXUnits->Wrap( -1 ); + fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextGridPosY = new wxStaticText( this, wxID_ANY, _("Grid origin Y:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGridPosY->Wrap( -1 ); + fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + m_GridOriginYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextPosYUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextPosYUnits->Wrap( -1 ); + fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbRightSizer->Add( fgSizerGridOrigin, 0, wxALL|wxEXPAND, 5 ); + + m_buttonReset = new wxButton( this, wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 ); + sbRightSizer->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 ); + + bSizer4->Add( sbRightSizer, 1, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer4; + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid for fast switching") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer3->AddGrowableCol( 1 ); + fgSizer3->SetFlexibleDirection( wxBOTH ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextGrid1 = new wxStaticText( this, wxID_ANY, _("Fast Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrid1->Wrap( -1 ); + fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_comboBoxGrid1 = new wxComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + fgSizer3->Add( m_comboBoxGrid1, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + m_staticTextGrid2 = new wxStaticText( this, wxID_ANY, _("Fast Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrid2->Wrap( -1 ); + fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_comboBoxGrid2 = new wxComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + fgSizer3->Add( m_comboBoxGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + sbSizer4->Add( fgSizer3, 1, wxALL|wxEXPAND, 5 ); + + bSizer4->Add( sbSizer4, 1, wxALL|wxEXPAND, 5 ); + + bUpperSizer->Add( bSizer4, 1, wxEXPAND, 5 ); + + bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM, 5 ); + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); + + // Connect Events + m_buttonReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_SET_GRID_BASE::~DIALOG_SET_GRID_BASE() +{ + // Disconnect Events + m_buttonReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this ); + +} diff --git a/pcbnew/dialogs/dialog_set_grid_base.h b/pcbnew/dialogs/dialog_set_grid_base.h index bb6c46cc1c..0ca1808db8 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.h +++ b/pcbnew/dialogs/dialog_set_grid_base.h @@ -1,66 +1,72 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __dialog_set_grid_base__ -#define __dialog_set_grid_base__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_SET_GRID_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_SET_GRID_BASE : public wxDialog -{ - private: - - protected: - wxRadioBox* m_UnitGrid; - - wxStaticText* m_staticTextSizeX; - wxTextCtrl* m_OptGridSizeX; - wxStaticText* m_staticTextSizeY; - wxTextCtrl* m_OptGridSizeY; - wxStaticText* m_staticTextGridPosX; - wxTextCtrl* m_GridOriginXCtrl; - wxStaticText* m_TextPosXUnits; - wxStaticText* m_staticTextGridPosY; - wxTextCtrl* m_GridOriginYCtrl; - wxStaticText* m_TextPosYUnits; - wxButton* m_buttonReset; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnResetGridOrgClick( wxCommandEvent& event ){ event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } - - - public: - DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Origin and User Grid Size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 374,267 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_SET_GRID_BASE(); - -}; - -#endif //__dialog_set_grid_base__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Sep 6 2011) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_set_grid_base__ +#define __dialog_set_grid_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_SET_GRID_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_SET_GRID_BASE : public wxDialog +{ + private: + + protected: + wxRadioBox* m_UnitGrid; + + wxStaticText* m_staticTextSizeX; + wxTextCtrl* m_OptGridSizeX; + wxStaticText* m_staticTextSizeY; + wxTextCtrl* m_OptGridSizeY; + wxStaticText* m_staticTextGridPosX; + wxTextCtrl* m_GridOriginXCtrl; + wxStaticText* m_TextPosXUnits; + wxStaticText* m_staticTextGridPosY; + wxTextCtrl* m_GridOriginYCtrl; + wxStaticText* m_TextPosYUnits; + wxButton* m_buttonReset; + wxStaticText* m_staticTextGrid1; + wxComboBox* m_comboBoxGrid1; + wxStaticText* m_staticTextGrid2; + wxComboBox* m_comboBoxGrid2; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnResetGridOrgClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Origin and User Grid Size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_SET_GRID_BASE(); + +}; + +#endif //__dialog_set_grid_base__ diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 9886725ee2..460deb4b53 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -132,12 +132,26 @@ static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, (int) wxID_REDO ); #endif +static Ki_HotkeyInfo HkSwitchTrackWidthToNext( wxT( "Switch Track Width To Next" ), HK_SWITCH_TRACK_WIDTH_TO_NEXT, 'W' ); + +static Ki_HotkeyInfo HkSwitchTrackWidthToPrevious( wxT( "Switch Track Width To Previous" ), HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS, 'W' + + GR_KB_CTRL ); + +static Ki_HotkeyInfo HkSwitchGridToFastGrid1( wxT( "Switch Grid To Fast Grid1" ), HK_SWITCH_GRID_TO_FASTGRID1, GR_KB_ALT + '1' ); + +static Ki_HotkeyInfo HkSwitchGridToFastGrid2( wxT( "Switch Grid To Fast Grid2" ), HK_SWITCH_GRID_TO_FASTGRID2, GR_KB_ALT + '2' ); + +static Ki_HotkeyInfo HkSwitchGridToNext( wxT( "Switch Grid To Next" ), HK_SWITCH_GRID_TO_NEXT, '`' ); + +static Ki_HotkeyInfo HkSwitchGridToPrevious( wxT( "Switch Grid To Previous" ), HK_SWITCH_GRID_TO_PREVIOUS, '`' + + GR_KB_CTRL ); static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL ); static Ki_HotkeyInfo HkTrackDisplayMode( wxT( "Track Display Mode" ), HK_SWITCH_TRACK_DISPLAY_MODE, 'K' ); static Ki_HotkeyInfo HkAddModule( wxT( "Add Module" ), HK_ADD_MODULE, 'O' ); + /* Record and play macros */ static Ki_HotkeyInfo HkRecordMacros0( wxT( "Record Macros 0" ), HK_RECORD_MACROS_0, GR_KB_CTRL+'0' ); @@ -206,16 +220,13 @@ Ki_HotkeyInfo* board_edit_Hotkey_List[] = &HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4, &HkSwitch2InnerLayer5, &HkSwitch2InnerLayer6, &HkSwitch2ComponentLayer, &HkSwitch2NextCopperLayer, &HkSwitch2PreviousCopperLayer,&HkAddModule, - &HkRecordMacros0, &HkCallMacros0, - &HkRecordMacros1, &HkCallMacros1, - &HkRecordMacros2, &HkCallMacros2, - &HkRecordMacros3, &HkCallMacros3, - &HkRecordMacros4, &HkCallMacros4, - &HkRecordMacros5, &HkCallMacros5, - &HkRecordMacros6, &HkCallMacros6, - &HkRecordMacros7, &HkCallMacros7, - &HkRecordMacros8, &HkCallMacros8, - &HkRecordMacros9, &HkCallMacros9, + &HkSwitchTrackWidthToNext, &HkSwitchTrackWidthToPrevious,&HkSwitchGridToFastGrid1, + &HkSwitchGridToFastGrid2, &HkSwitchGridToNext, &HkSwitchGridToPrevious, + &HkRecordMacros0, &HkCallMacros0, &HkRecordMacros1, &HkCallMacros1, + &HkRecordMacros2, &HkCallMacros2, &HkRecordMacros3, &HkCallMacros3, + &HkRecordMacros4, &HkCallMacros4, &HkRecordMacros5, &HkCallMacros5, + &HkRecordMacros6, &HkCallMacros6, &HkRecordMacros7, &HkCallMacros7, + &HkRecordMacros8, &HkCallMacros8, &HkRecordMacros9, &HkCallMacros9, NULL }; diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index 1c3178e04c..4eba6a5499 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -31,6 +31,12 @@ enum hotkey_id_commnand { HK_FIND_ITEM, HK_EDIT_ITEM, HK_PLACE_ITEM, + HK_SWITCH_TRACK_WIDTH_TO_NEXT, + HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS, + HK_SWITCH_GRID_TO_FASTGRID1, + HK_SWITCH_GRID_TO_FASTGRID2, + HK_SWITCH_GRID_TO_NEXT, + HK_SWITCH_GRID_TO_PREVIOUS, HK_SWITCH_LAYER_TO_COPPER, HK_SWITCH_LAYER_TO_COMPONENT, HK_SWITCH_LAYER_TO_NEXT, diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 0e1cb56875..95958a68bc 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -149,7 +149,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); + + int ll; + unsigned int cnt; switch( HK_Descr->m_Idcommand ) { @@ -238,6 +241,58 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit CallMacros(aDC, aPosition, 9); break; + case HK_SWITCH_TRACK_WIDTH_TO_NEXT: + GetBoard()->m_TrackWidthSelector = ( GetBoard()->m_TrackWidthSelector + 1 ) % GetBoard()->m_TrackWidthList.size(); + break; + + case HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS: + if( GetBoard()->m_TrackWidthSelector == 0 ) + GetBoard()->m_TrackWidthSelector = GetBoard()->m_TrackWidthList.size(); + + GetBoard()->m_TrackWidthSelector--; + break; + + case HK_SWITCH_GRID_TO_FASTGRID1: + if( m_SelGridBox ) + { + m_SelGridBox->SetSelection( m_FastGrid1 ); + cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED ); + OnSelectGrid( cmd ); + } + break; + + case HK_SWITCH_GRID_TO_FASTGRID2: + if( m_SelGridBox ) + { + m_SelGridBox->SetSelection( m_FastGrid2 ); + cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED ); + OnSelectGrid( cmd ); + } + break; + + case HK_SWITCH_GRID_TO_NEXT: + if( m_SelGridBox ) + { + m_SelGridBox->SetSelection( ( m_SelGridBox->GetSelection() + 1 ) % m_SelGridBox->GetCount() ); + cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED ); + OnSelectGrid( cmd ); + } + break; + + case HK_SWITCH_GRID_TO_PREVIOUS: + if( m_SelGridBox ) + { + cnt = m_SelGridBox->GetSelection(); + if ( cnt == 0 ) + cnt = m_SelGridBox->GetCount() - 1; + else + cnt--; + m_SelGridBox->SetSelection( cnt ); + cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED ); + OnSelectGrid( cmd ); + } + break; + case HK_SWITCH_LAYER_TO_PREVIOUS: ll = getActiveLayer(); if( (ll <= LAYER_N_BACK) || (ll > LAYER_N_FRONT) ) diff --git a/pcbnew/set_grid.cpp b/pcbnew/set_grid.cpp index 4fe478e890..1e18ef31e0 100644 --- a/pcbnew/set_grid.cpp +++ b/pcbnew/set_grid.cpp @@ -28,6 +28,8 @@ public: int GetGridUnits(); void SetGridOrigin( const wxPoint& grid ); wxPoint GetGridOrigin(); + void SetGridForFastSwitching( wxArrayString aGrids, int aGrid1, int aGrid2 ); + void GetGridForFastSwitching( int& aGrid1, int& aGrid2 ); private: void OnResetGridOrgClick( wxCommandEvent& event ); @@ -44,6 +46,9 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos ) dlg.SetGridSize( m_UserGridSize ); dlg.SetGridOrigin( GetScreen()->m_GridOrigin ); + if( m_SelGridBox ) + dlg.SetGridForFastSwitching( m_SelGridBox->GetStrings(), m_FastGrid1, m_FastGrid2 ); + if( dlg.ShowModal() == wxID_CANCEL ) return; @@ -53,6 +58,8 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos ) GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); + dlg.GetGridForFastSwitching( m_FastGrid1, m_FastGrid2 ); + // If the user grid is the current option, recall SetGrid() // to force new values put in list as current grid value if( GetScreen()->GetGridId() == ID_POPUP_GRID_USER ) @@ -133,6 +140,24 @@ void DIALOG_SET_GRID::SetGridOrigin( const wxPoint& grid ) PutValueInLocalUnits( *m_GridOriginYCtrl, grid.y, m_internalUnits ); } +void DIALOG_SET_GRID::SetGridForFastSwitching( wxArrayString aGrids, int aGrid1, int aGrid2 ) +{ + for( wxArrayString::iterator i = aGrids.begin(); i != aGrids.end(); i++ ) + { + m_comboBoxGrid1->Append( *i ); + m_comboBoxGrid2->Append( *i ); + } + + m_comboBoxGrid1->SetSelection( aGrid1 ); + m_comboBoxGrid2->SetSelection( aGrid2 ); +} + +void DIALOG_SET_GRID::GetGridForFastSwitching( int& aGrid1, int& aGrid2 ) +{ + aGrid1 = m_comboBoxGrid1->GetSelection(); + aGrid2 = m_comboBoxGrid2->GetSelection(); +} + void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event ) {