Fix cosmetic issues in dialog. Use move instead of swap in dialog, to avoid mistakes, as the dialog allows moving objects between layers, and do not really swap layers.

This commit is contained in:
jean-pierre charras 2018-03-28 12:45:54 +02:00
parent 952aa7a1a6
commit 6a4d14bade
5 changed files with 37 additions and 38 deletions

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_layer_selection_base.h"
@ -26,7 +26,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
m_leftGridLayers->EnableEditing( false );
m_leftGridLayers->EnableGridLines( true );
m_leftGridLayers->EnableDragGridSize( false );
m_leftGridLayers->SetMargins( 0, 3 );
m_leftGridLayers->SetMargins( 5, 3 );
// Columns
m_leftGridLayers->EnableDragColMove( false );
@ -56,7 +56,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
m_rightGridLayers->EnableEditing( false );
m_rightGridLayers->EnableGridLines( true );
m_rightGridLayers->EnableDragGridSize( false );
m_rightGridLayers->SetMargins( 0, 3 );
m_rightGridLayers->SetMargins( 5, 3 );
// Columns
m_rightGridLayers->EnableDragColMove( false );
@ -77,7 +77,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
bSizerUpper->Add( m_rightGridLayers, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizerMain );

View File

@ -45,7 +45,7 @@
<property name="name">DIALOG_LAYER_SELECTION_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Select Layer</property>
<property name="tooltip"></property>
@ -95,7 +95,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -158,7 +158,7 @@
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">3</property>
<property name="margin_width">0</property>
<property name="margin_width">5</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -301,7 +301,7 @@
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">3</property>
<property name="margin_width">0</property>
<property name="margin_width">5</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -411,7 +411,7 @@
<property name="name">DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Select Copper Layer Pair:</property>
<property name="tooltip"></property>

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_LAYER_SELECTION_BASE_H__
@ -47,7 +47,7 @@ class DIALOG_LAYER_SELECTION_BASE : public wxDialog
public:
DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Layer"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Layer"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LAYER_SELECTION_BASE();
};
@ -78,7 +78,7 @@ class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE : public wxDialog
public:
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Copper Layer Pair:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Copper Layer Pair:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE();
};

View File

@ -573,14 +573,14 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal )
KiBitmap( exchange_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers..." ),
_( "Swap tracks on copper layers or drawings on other layers" ),
_( "&Move and Swap Layers..." ),
_( "Move tracks or drawings from a layer to an other layer" ),
KiBitmap( swap_layer_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_PCB_GLOBAL_DELETE,
_( "&Global Deletions..." ),
_( "Delete tracks, footprints and texts on board" ),
_( "Delete tracks, footprints and graphic items from board" ),
KiBitmap( general_deletions_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_CLEAN,

View File

@ -51,11 +51,11 @@ enum swap_layer_id {
};
class SWAP_LAYERS_DIALOG : public DIALOG_SHIM
class MOVE_SWAP_LAYER_DIALOG : public DIALOG_SHIM
{
public:
SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, PCB_LAYER_ID* aArray );
// ~SWAP_LAYERS_DIALOG() { };
MOVE_SWAP_LAYER_DIALOG( PCB_BASE_FRAME* parent, PCB_LAYER_ID* aArray );
// ~MOVE_SWAP_LAYER_DIALOG() { };
private:
PCB_BASE_FRAME* m_Parent;
@ -79,18 +79,18 @@ private:
};
BEGIN_EVENT_TABLE( SWAP_LAYERS_DIALOG, wxDialog )
BEGIN_EVENT_TABLE( MOVE_SWAP_LAYER_DIALOG, wxDialog )
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + PCB_LAYER_ID_COUNT - 1,
wxEVT_COMMAND_BUTTON_CLICKED, SWAP_LAYERS_DIALOG::Sel_Layer )
wxEVT_COMMAND_BUTTON_CLICKED, MOVE_SWAP_LAYER_DIALOG::Sel_Layer )
EVT_BUTTON( wxID_OK, SWAP_LAYERS_DIALOG::OnOkClick )
EVT_BUTTON( wxID_OK, MOVE_SWAP_LAYER_DIALOG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, SWAP_LAYERS_DIALOG::OnCancelClick )
EVT_BUTTON( wxID_CANCEL, MOVE_SWAP_LAYER_DIALOG::OnCancelClick )
END_EVENT_TABLE()
SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, PCB_LAYER_ID* aArray ) :
DIALOG_SHIM( parent, -1, _( "Swap Layers:" ), wxPoint( -1, -1 ),
MOVE_SWAP_LAYER_DIALOG::MOVE_SWAP_LAYER_DIALOG( PCB_BASE_FRAME* parent, PCB_LAYER_ID* aArray ) :
DIALOG_SHIM( parent, -1, _( "Move Layers:" ), wxPoint( -1, -1 ),
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
m_callers_nlayers( aArray )
{
@ -260,7 +260,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, PCB_LAYER_ID* aA
}
/* Provide spacers to occupy otherwise blank cells within the second
* FlexGrid sizer. (Becuse there are three columns, three spacers
* FlexGrid sizer. (Because there are three columns, three spacers
* are thus required for each unused row.)
for( int ii = 3 * NB_PCB_LAYERS; ii < 96; ii++ )
{
@ -291,16 +291,13 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, PCB_LAYER_ID* aA
StdDialogButtonSizer->Realize();
// Resize the dialog
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
GetSizer()->SetSizeHints( this );
Center();
}
void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event )
void MOVE_SWAP_LAYER_DIALOG::Sel_Layer( wxCommandEvent& event )
{
int ii;
@ -340,19 +337,21 @@ void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event )
// that this layer *is* being swapped)
layer_list[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) );
}
layer_list[ii]->Refresh();
}
}
void SWAP_LAYERS_DIALOG::OnCancelClick( wxCommandEvent& event )
void MOVE_SWAP_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
EndModal( wxID_CANCEL );
}
void SWAP_LAYERS_DIALOG::OnOkClick( wxCommandEvent& event )
void MOVE_SWAP_LAYER_DIALOG::OnOkClick( wxCommandEvent& event )
{
EndModal( 1 );
EndModal( wxID_OK );
}
@ -363,9 +362,9 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
for( unsigned i = 0; i < DIM( new_layer ); ++i )
new_layer[i] = NO_CHANGE;
SWAP_LAYERS_DIALOG dlg( this, new_layer );
MOVE_SWAP_LAYER_DIALOG dlg( this, new_layer );
if( dlg.ShowModal() != 1 )
if( dlg.ShowModal() != wxID_OK )
return; // (Canceled dialog box returns -1 instead)
// Change traces.