Fixup PCB_ONE_LAYER_SELECTOR
It is useful to be able to tell which layer you are selecting. The checkboxes, on the other hand, provide no information when dealing with a single layer selection
This commit is contained in:
parent
140e4cbe28
commit
5975524826
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Apr 22 2021)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -88,6 +88,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
|
|||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LAYER_SELECTION_BASE::OnMouseMove ) );
|
||||
m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
|
||||
m_leftGridLayers->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
|
||||
m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
|
||||
|
@ -97,6 +98,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
|
|||
DIALOG_LAYER_SELECTION_BASE::~DIALOG_LAYER_SELECTION_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_LAYER_SELECTION_BASE::OnMouseMove ) );
|
||||
m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
|
||||
m_leftGridLayers->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
|
||||
m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<property name="file">dialog_layer_selection_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_layer_selection_base</property>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -53,6 +55,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnUpdateUI">OnMouseMove</event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerMain</property>
|
||||
|
@ -251,7 +254,7 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="Dialog" expanded="1">
|
||||
<object class="Dialog" expanded="0">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
|
@ -277,34 +280,34 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerMain</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerUpper</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerLeft</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -361,11 +364,11 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxGrid" expanded="1">
|
||||
<object class="wxGrid" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -452,20 +455,20 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerRight</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -522,11 +525,11 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxGrid" expanded="1">
|
||||
<object class="wxGrid" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -615,11 +618,11 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="1">
|
||||
<object class="wxStaticLine" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -673,11 +676,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_RIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<object class="wxStdDialogButtonSizer" expanded="0">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Apr 22 2021)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -39,7 +39,8 @@ class DIALOG_LAYER_SELECTION_BASE : public DIALOG_SHIM
|
|||
wxGrid* m_leftGridLayers;
|
||||
wxGrid* m_rightGridLayers;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnMouseMove( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void OnLeftButtonReleased( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
|
||||
|
@ -69,7 +70,7 @@ class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE : public DIALOG_SHIM
|
|||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
|
||||
|
||||
|
|
|
@ -80,15 +80,16 @@ class PCB_ONE_LAYER_SELECTOR : public PCB_LAYER_SELECTOR, public DIALOG_LAYER_SE
|
|||
{
|
||||
public:
|
||||
PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD * aBrd, PCB_LAYER_ID aDefaultLayer,
|
||||
LSET aNotAllowedLayersMask );
|
||||
LSET aNotAllowedLayersMask, bool aHideCheckBoxes = false );
|
||||
~PCB_ONE_LAYER_SELECTOR();
|
||||
|
||||
LAYER_NUM GetLayerSelection() { return m_layerSelected; }
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
void OnLeftGridCellClick( wxGridEvent& event ) override;
|
||||
void OnRightGridCellClick( wxGridEvent& event ) override;
|
||||
void OnLeftGridCellClick( wxGridEvent& aEvent ) override;
|
||||
void OnRightGridCellClick( wxGridEvent& aEvent ) override;
|
||||
void OnMouseMove( wxUpdateUIEvent& aEvent ) override;
|
||||
|
||||
// Will close the dialog on ESC key
|
||||
void onCharHook( wxKeyEvent& event );
|
||||
|
@ -105,7 +106,8 @@ private:
|
|||
|
||||
PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD* aBrd,
|
||||
PCB_LAYER_ID aDefaultLayer,
|
||||
LSET aNotAllowedLayersMask ) :
|
||||
LSET aNotAllowedLayersMask,
|
||||
bool aHideCheckBoxes ) :
|
||||
PCB_LAYER_SELECTOR( aParent ),
|
||||
DIALOG_LAYER_SELECTION_BASE( aParent )
|
||||
{
|
||||
|
@ -121,6 +123,12 @@ PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( PCB_BASE_FRAME* aParent, BOARD*
|
|||
m_rightGridLayers->SetColFormatBool( SELECT_COLNUM );
|
||||
buildList();
|
||||
|
||||
if( aHideCheckBoxes )
|
||||
{
|
||||
m_leftGridLayers->HideCol( SELECT_COLNUM );
|
||||
m_rightGridLayers->HideCol( SELECT_COLNUM );
|
||||
}
|
||||
|
||||
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( PCB_ONE_LAYER_SELECTOR::onCharHook ) );
|
||||
|
||||
Layout();
|
||||
|
@ -135,6 +143,41 @@ PCB_ONE_LAYER_SELECTOR::~PCB_ONE_LAYER_SELECTOR()
|
|||
}
|
||||
|
||||
|
||||
void PCB_ONE_LAYER_SELECTOR::OnMouseMove( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
/// We have to assign this in UpdateUI events because the wxGrid is not properly receiving
|
||||
/// MouseMove events. It seems to only get them on the edges. So, for now we use this
|
||||
/// workaround
|
||||
|
||||
wxPoint mouse_pos = wxGetMousePosition();
|
||||
wxPoint left_pos = m_leftGridLayers->ScreenToClient( mouse_pos );
|
||||
wxPoint right_pos = m_rightGridLayers->ScreenToClient( mouse_pos );
|
||||
|
||||
if( m_leftGridLayers->HitTest( left_pos ) == wxHT_WINDOW_INSIDE )
|
||||
{
|
||||
int row = m_leftGridLayers->YToRow( left_pos.y );
|
||||
|
||||
if( row != wxNOT_FOUND && row < static_cast<int>( m_layersIdLeftColumn.size() ) )
|
||||
{
|
||||
m_layerSelected = m_layersIdLeftColumn[ row ];
|
||||
m_leftGridLayers->SelectBlock( row, LAYERNAME_COLNUM, row, LAYERNAME_COLNUM);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_rightGridLayers->HitTest( right_pos ) == wxHT_WINDOW_INSIDE )
|
||||
{
|
||||
int row = m_rightGridLayers->YToRow( right_pos.y );
|
||||
|
||||
if( row == wxNOT_FOUND || row >= static_cast<int>( m_layersIdRightColumn.size() ) )
|
||||
return;
|
||||
|
||||
m_layerSelected = m_layersIdRightColumn[ row ];
|
||||
m_rightGridLayers->SelectBlock( row, LAYERNAME_COLNUM, row, LAYERNAME_COLNUM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_ONE_LAYER_SELECTOR::onCharHook( wxKeyEvent& event )
|
||||
{
|
||||
if( event.GetKeyCode() == WXK_ESCAPE )
|
||||
|
@ -231,7 +274,7 @@ void PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick( wxGridEvent& event )
|
|||
PCB_LAYER_ID PCB_BASE_FRAME::SelectOneLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask,
|
||||
wxPoint aDlgPosition )
|
||||
{
|
||||
PCB_ONE_LAYER_SELECTOR dlg( this, GetBoard(), aDefaultLayer, aNotAllowedLayersMask );
|
||||
PCB_ONE_LAYER_SELECTOR dlg( this, GetBoard(), aDefaultLayer, aNotAllowedLayersMask, true );
|
||||
|
||||
if( aDlgPosition != wxDefaultPosition )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue