Grids: add buttons to re-order grids
This commit is contained in:
parent
2b78c20a62
commit
2764e59400
|
@ -86,6 +86,8 @@ DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ) :
|
|||
|
||||
m_addGridButton->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
|
||||
m_removeGridButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
||||
m_moveUpButton->SetBitmap( KiBitmap( BITMAPS::small_up ) );
|
||||
m_moveDownButton->SetBitmap( KiBitmap( BITMAPS::small_down ) );
|
||||
|
||||
SetupStandardButtons();
|
||||
SetInitialFocus( m_GridOriginXCtrl );
|
||||
|
@ -269,3 +271,33 @@ void DIALOG_GRID_SETTINGS::OnRemoveGrid( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_GRID_SETTINGS::OnMoveGridUp( wxCommandEvent& event )
|
||||
{
|
||||
GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid;
|
||||
int row = m_currentGridCtrl->GetSelection();
|
||||
|
||||
if( gridCfg.sizes.size() <= 1 || row == 0 )
|
||||
return;
|
||||
|
||||
std::swap( gridCfg.sizes[row], gridCfg.sizes[row - 1] );
|
||||
RebuildGridSizes();
|
||||
|
||||
if( row != 0 )
|
||||
m_currentGridCtrl->SetSelection( row - 1 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_GRID_SETTINGS::OnMoveGridDown( wxCommandEvent& event )
|
||||
{
|
||||
GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid;
|
||||
int row = m_currentGridCtrl->GetSelection();
|
||||
|
||||
if( gridCfg.sizes.size() <= 1 || row == ( (int) gridCfg.sizes.size() - 1 ) )
|
||||
return;
|
||||
|
||||
std::swap( gridCfg.sizes[row], gridCfg.sizes[row + 1] );
|
||||
RebuildGridSizes();
|
||||
|
||||
if( row != 0 )
|
||||
m_currentGridCtrl->SetSelection( row + 1 );
|
||||
}
|
||||
|
|
|
@ -40,6 +40,15 @@ DIALOG_GRID_SETTINGS_BASE::DIALOG_GRID_SETTINGS_BASE( wxWindow* parent, wxWindow
|
|||
bSizer4->Add( m_removeGridButton, 0, 0, 5 );
|
||||
|
||||
|
||||
bSizer4->Add( 20, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_moveUpButton = new STD_BITMAP_BUTTON( sbCurrentGrid->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer4->Add( m_moveUpButton, 0, wxRIGHT, 5 );
|
||||
|
||||
m_moveDownButton = new STD_BITMAP_BUTTON( sbCurrentGrid->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer4->Add( m_moveDownButton, 0, 0, 5 );
|
||||
|
||||
|
||||
sbCurrentGrid->Add( bSizer4, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
|
@ -247,6 +256,8 @@ DIALOG_GRID_SETTINGS_BASE::DIALOG_GRID_SETTINGS_BASE( wxWindow* parent, wxWindow
|
|||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRID_SETTINGS_BASE::OnInitDlg ) );
|
||||
m_addGridButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnAddGrid ), NULL, this );
|
||||
m_removeGridButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnRemoveGrid ), NULL, this );
|
||||
m_moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridUp ), NULL, this );
|
||||
m_moveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridDown ), NULL, this );
|
||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnOkClick ), NULL, this );
|
||||
}
|
||||
|
@ -257,6 +268,8 @@ DIALOG_GRID_SETTINGS_BASE::~DIALOG_GRID_SETTINGS_BASE()
|
|||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRID_SETTINGS_BASE::OnInitDlg ) );
|
||||
m_addGridButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnAddGrid ), NULL, this );
|
||||
m_removeGridButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnRemoveGrid ), NULL, this );
|
||||
m_moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridUp ), NULL, this );
|
||||
m_moveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridDown ), NULL, this );
|
||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnOkClick ), NULL, this );
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="label">Add Grid</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
|
@ -277,7 +277,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Remove Field...</property>
|
||||
<property name="label">Remove Grid</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
|
@ -313,6 +313,164 @@
|
|||
<event name="OnButtonClick">OnRemoveGrid</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">20</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Move grid up in list</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_moveUpButton</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnMoveGridUp</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Move grid up in list</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_moveDownButton</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnMoveGridDown</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -46,6 +46,8 @@ class DIALOG_GRID_SETTINGS_BASE : public DIALOG_SHIM
|
|||
wxListBox* m_currentGridCtrl;
|
||||
STD_BITMAP_BUTTON* m_addGridButton;
|
||||
STD_BITMAP_BUTTON* m_removeGridButton;
|
||||
STD_BITMAP_BUTTON* m_moveUpButton;
|
||||
STD_BITMAP_BUTTON* m_moveDownButton;
|
||||
wxStaticBoxSizer* sbGridOriginSizer;
|
||||
wxStaticText* m_staticTextGridPosX;
|
||||
wxTextCtrl* m_GridOriginXCtrl;
|
||||
|
@ -89,6 +91,8 @@ class DIALOG_GRID_SETTINGS_BASE : public DIALOG_SHIM
|
|||
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddGrid( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRemoveGrid( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMoveGridUp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMoveGridDown( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ void EDA_DRAW_FRAME::UpdateGridSelectBox()
|
|||
m_gridSelectBox->Append( grid );
|
||||
|
||||
m_gridSelectBox->Append( wxT( "---" ) );
|
||||
m_gridSelectBox->Append( _( "Edit User Grid..." ) );
|
||||
m_gridSelectBox->Append( _( "Edit Grids..." ) );
|
||||
|
||||
m_gridSelectBox->SetSelection( config()->m_Window.grid.last_size_idx );
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std:
|
|||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_wires",
|
||||
&aWindow->grid.override_wires, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_vias",
|
||||
&aWindow->grid.override_wires, false ) );
|
||||
&aWindow->grid.override_vias, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_text",
|
||||
&aWindow->grid.override_text, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_graphics",
|
||||
|
|
|
@ -42,6 +42,8 @@ public:
|
|||
private:
|
||||
void OnAddGrid( wxCommandEvent& event ) override;
|
||||
void OnRemoveGrid( wxCommandEvent& event ) override;
|
||||
void OnMoveGridUp( wxCommandEvent& event ) override;
|
||||
void OnMoveGridDown( wxCommandEvent& event ) override;
|
||||
|
||||
void RebuildGridSizes();
|
||||
|
||||
|
|
Loading…
Reference in New Issue