Commit 36ae78ff authored by jean-pierre charras's avatar jean-pierre charras

pcbnew: fix wxWidgets 2.8 compatibility issue (temporary fix, still have a...

pcbnew: fix wxWidgets 2.8 compatibility issue (temporary fix, still have a minor cosmetic issue), and add missing file.
parent ede208f3
......@@ -85,7 +85,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
}
minwidth += BM_SIZE + 35; // Take in account the bitmap size and margins
SetMinClientSize( wxSize( minwidth, -1 ) );
SetMinSize( wxSize( minwidth, -1 ) );
}
......
......@@ -85,7 +85,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
bUpperRightSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgUpperRightGridSizer;
fgUpperRightGridSizer = new wxFlexGridSizer( 3, 3, 0, 0 );
fgUpperRightGridSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
fgUpperRightGridSizer->AddGrowableCol( 1 );
fgUpperRightGridSizer->SetFlexibleDirection( wxBOTH );
fgUpperRightGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
......@@ -126,24 +126,18 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
m_DefaulThicknessTextUnit->Wrap( -1 );
fgUpperRightGridSizer->Add( m_DefaulThicknessTextUnit, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
bUpperRightSizer->Add( fgUpperRightGridSizer, 0, wxEXPAND, 5 );
wxFlexGridSizer* fgLowerRightSizer;
fgLowerRightSizer = new wxFlexGridSizer( 1, 2, 0, 0 );
fgLowerRightSizer->AddGrowableCol( 1 );
fgLowerRightSizer->SetFlexibleDirection( wxBOTH );
fgLowerRightSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_LayerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayerLabel->Wrap( -1 );
fgLowerRightSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
fgUpperRightGridSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgLowerRightSizer->Add( m_LayerSelectionCtrl, 0, wxALL, 5 );
fgUpperRightGridSizer->Add( m_LayerSelectionCtrl, 0, wxALL, 5 );
bUpperRightSizer->Add( fgLowerRightSizer, 1, wxEXPAND, 5 );
fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bUpperRightSizer->Add( fgUpperRightGridSizer, 0, wxEXPAND, 5 );
bUpperSizer->Add( bUpperRightSizer, 1, wxEXPAND, 5 );
......
......@@ -42,7 +42,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">537,215</property>
<property name="size">576,215</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Graphic Item Properties</property>
......@@ -1250,7 +1250,7 @@
<property name="name">fgUpperRightGridSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">3</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
......@@ -2023,24 +2023,6 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgLowerRightSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">1</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT</property>
......@@ -2215,6 +2197,16 @@
<event name="OnUpdateUI"></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">0</property>
</object>
</object>
</object>
</object>
</object>
......
......@@ -76,7 +76,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 537,215 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 576,215 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE();
};
......
......@@ -22,7 +22,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
m_leftGridLayers = new wxGrid( this, ID_LEFT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_leftGridLayers->CreateGrid( 1, 4 );
m_leftGridLayers->CreateGrid( 1, 3 );
m_leftGridLayers->EnableEditing( false );
m_leftGridLayers->EnableGridLines( true );
m_leftGridLayers->EnableDragGridSize( false );
......@@ -45,12 +45,12 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
// Cell Defaults
m_leftGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
m_leftGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerUpper->Add( m_leftGridLayers, 0, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( m_leftGridLayers, 1, wxALL|wxEXPAND, 5 );
m_rightGridLayers = new wxGrid( this, ID_RIGHT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_rightGridLayers->CreateGrid( 1, 4 );
m_rightGridLayers->CreateGrid( 1, 3 );
m_rightGridLayers->EnableEditing( false );
m_rightGridLayers->EnableGridLines( true );
m_rightGridLayers->EnableDragGridSize( false );
......@@ -72,7 +72,7 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
// Cell Defaults
m_rightGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
m_rightGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerUpper->Add( m_rightGridLayers, 0, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( m_rightGridLayers, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
......@@ -121,7 +121,7 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
m_leftGridLayers = new wxGrid( this, ID_LEFT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_leftGridLayers->CreateGrid( 1, 4 );
m_leftGridLayers->CreateGrid( 1, 3 );
m_leftGridLayers->EnableEditing( false );
m_leftGridLayers->EnableGridLines( true );
m_leftGridLayers->EnableDragGridSize( false );
......@@ -159,7 +159,7 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
m_rightGridLayers = new wxGrid( this, ID_RIGHT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_rightGridLayers->CreateGrid( 1, 4 );
m_rightGridLayers->CreateGrid( 1, 3 );
m_rightGridLayers->EnableEditing( false );
m_rightGridLayers->EnableGridLines( true );
m_rightGridLayers->EnableDragGridSize( false );
......
This diff is collapsed.
......@@ -48,7 +48,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( 452,183 ), long style = wxCAPTION|wxCLOSE_BOX );
DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Layer:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 337,183 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_LAYER_SELECTION_BASE();
};
......@@ -79,7 +79,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 Cpper Layer Pair:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 332,175 ), 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( 400,175 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE();
};
......
......@@ -166,6 +166,12 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
break;
case PCB_MODULE_EDGE_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_MODEDIT_EDIT_BODY_ITEM;
break;
default:
break;
}
......
......@@ -214,9 +214,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
case ID_POPUP_MODEDIT_EDIT_BODY_ITEM:
case ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE:
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
case ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE:
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
case ID_POPUP_PCB_DELETE_EDGE:
......@@ -670,24 +668,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->Refresh();
break;
case ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() );
m_canvas->Refresh();
break;
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Width( NULL );
m_canvas->Refresh();
break;
case ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() );
m_canvas->Refresh();
break;
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
m_canvas->MoveCursorToCrossHair();
Edit_Edge_Layer( NULL );
......
......@@ -331,7 +331,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
if( !flags )
{
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
msg = AddHotkeyName( _("Move Edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, KiBitmap( move_line_xpm ) );
}
......@@ -339,21 +339,20 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ),
KiBitmap( apply_xpm ) );
wxMenu* edit_mnu = new wxMenu;
AddMenuItem( PopMenu, edit_mnu, ID_POPUP_MODEDIT_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
_( "Edit Body Item" ), KiBitmap( options_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE,
_( "Change Body Item Width (Current)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
_( "Change Body Items Width (All)" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE,
_( "Change Body Item Layer (Current)" ), KiBitmap( select_layer_pair_xpm ) );
AddMenuItem( edit_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
_( "Change Body Items Layer (All)" ), KiBitmap( select_layer_pair_xpm ) );
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
msg = AddHotkeyName( _("Edit" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
msg, KiBitmap( options_segment_xpm ) );
msg = AddHotkeyName( _("Delete Edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) );
wxMenu* edit_global_mnu = new wxMenu;
AddMenuItem( PopMenu, edit_global_mnu, ID_POPUP_MODEDIT_GLOBAL_EDIT_EDGE,
_( "Global Changes" ), KiBitmap( edit_xpm ) );
AddMenuItem( edit_global_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
_( "Change Body Items Width" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_global_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
_( "Change Body Items Layer" ), KiBitmap( select_layer_pair_xpm ) );
}
break;
......
......@@ -115,12 +115,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
......
......@@ -312,9 +312,8 @@ enum pcbnew_ids
ID_MODEDIT_PLACE_GRID_COORD,
// ID used in module editor:
ID_POPUP_MODEDIT_EDIT_WIDTH_CURRENT_EDGE,
ID_POPUP_MODEDIT_GLOBAL_EDIT_EDGE,
ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
ID_POPUP_MODEDIT_EDIT_LAYER_CURRENT_EDGE,
ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH,
ID_POPUP_MODEDIT_EDIT_EDGE,
......
......@@ -83,6 +83,8 @@ class PCB_ONE_LAYER_SELECTOR : public PCB_LAYER_SELECTOR,
LAYER_NUM m_layerSelected;
LAYER_NUM m_minLayer;
LAYER_NUM m_maxLayer;
std::vector<LAYER_NUM> m_layersIdLeftColumn;
std::vector<LAYER_NUM> m_layersIdRightColumn;
public:
PCB_ONE_LAYER_SELECTOR( wxWindow* aParent, BOARD * aBrd,
......@@ -122,25 +124,17 @@ private:
#define SELECT_COLNUM 0
#define COLOR_COLNUM 1
#define LAYERNAME_COLNUM 2
#define LAYERID_COLNUM 3
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
void PCB_ONE_LAYER_SELECTOR::BuildList()
{
m_leftGridLayers->SetColFormatNumber( LAYERID_COLNUM );
m_rightGridLayers->SetColFormatNumber( LAYERID_COLNUM );
m_leftGridLayers->HideCol( LAYERID_COLNUM );
m_rightGridLayers->HideCol( LAYERID_COLNUM );
// Hide layerid column which is used only to know the layer id
// not to be shown in dialogs
m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 );
m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 );
// Select a not show cell, to avoid a wrong cell selection for user
m_leftGridLayers->GoToCell( 0, LAYERID_COLNUM );
m_rightGridLayers->GoToCell( 0, LAYERID_COLNUM );
int left_row = 0;
int right_row = 0;
wxString layernum;
wxString layername;
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
......@@ -160,7 +154,6 @@ void PCB_ONE_LAYER_SELECTOR::BuildList()
wxColour color = MakeColour( GetLayerColor( layerid ) );
layername = GetLayerName( layerid );
layernum.Printf( wxT("%d"), layerid );
if( layerid <= LAST_COPPER_LAYER )
{
......@@ -171,8 +164,6 @@ void PCB_ONE_LAYER_SELECTOR::BuildList()
color );
m_leftGridLayers->SetCellValue( left_row, LAYERNAME_COLNUM,
layername );
m_leftGridLayers->SetCellValue( left_row, LAYERID_COLNUM,
layernum );
if( m_layerSelected == layerid )
{
......@@ -180,8 +171,10 @@ void PCB_ONE_LAYER_SELECTOR::BuildList()
wxT("X") );
m_leftGridLayers->SetCellBackgroundColour ( left_row, SELECT_COLNUM,
color );
m_leftGridLayers->SetGridCursor( left_row, LAYERNAME_COLNUM );
}
m_layersIdLeftColumn.push_back( layerid );
left_row++;
}
else
......@@ -193,8 +186,6 @@ void PCB_ONE_LAYER_SELECTOR::BuildList()
color );
m_rightGridLayers->SetCellValue( right_row, LAYERNAME_COLNUM,
layername );
m_rightGridLayers->SetCellValue( right_row, LAYERID_COLNUM,
layernum );
if( m_layerSelected == layerid )
{
......@@ -202,8 +193,10 @@ void PCB_ONE_LAYER_SELECTOR::BuildList()
wxT("X") );
m_rightGridLayers->SetCellBackgroundColour ( right_row, SELECT_COLNUM,
color );
m_rightGridLayers->SetGridCursor( right_row, LAYERNAME_COLNUM );
}
m_layersIdRightColumn.push_back( layerid );
right_row++;
}
}
......@@ -223,19 +216,13 @@ void PCB_ONE_LAYER_SELECTOR::BuildList()
void PCB_ONE_LAYER_SELECTOR::OnLeftGridClick( wxGridEvent& event )
{
wxString text = m_leftGridLayers->GetCellValue(event.GetRow(), LAYERID_COLNUM);
long layer;
text.ToLong( &layer );
m_layerSelected = layer;
m_layerSelected = m_layersIdLeftColumn[ event.GetRow() ];
EndModal( 1 );
}
void PCB_ONE_LAYER_SELECTOR::OnRightGridClick( wxGridEvent& event )
{
wxString text = m_rightGridLayers->GetCellValue(event.GetRow(), LAYERID_COLNUM);
long layer;
text.ToLong( &layer );
m_layerSelected = layer;
m_layerSelected = m_layersIdRightColumn[ event.GetRow() ];
EndModal( 2 );
}
......@@ -283,6 +270,7 @@ private:
LAYER_NUM m_backLayer;
int m_leftRowSelected;
int m_rightRowSelected;
std::vector<LAYER_NUM> m_layersId;
public:
SELECT_COPPER_LAYERS_PAIR_DIALOG( wxWindow* aParent, BOARD * aPcb,
......@@ -354,20 +342,14 @@ SELECT_COPPER_LAYERS_PAIR_DIALOG::
void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList()
{
m_leftGridLayers->SetColFormatNumber( LAYERID_COLNUM );
m_rightGridLayers->SetColFormatNumber( LAYERID_COLNUM );
m_leftGridLayers->HideCol( LAYERID_COLNUM );
m_rightGridLayers->HideCol( LAYERID_COLNUM );
m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 );
m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 );
// Select a not show cell, to avoid a wrong cell selection for user
m_leftGridLayers->GoToCell( 0, LAYERID_COLNUM );
m_rightGridLayers->GoToCell( 0, LAYERID_COLNUM );
int row = 0;
wxString layernum;
wxString layername;
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
LAYER_NUM layerid = i;
......@@ -383,16 +365,15 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList()
wxColour color = MakeColour( GetLayerColor( layerid ) );
layername = GetLayerName( layerid );
layernum.Printf( wxT("%d"), layerid );
if( row )
m_leftGridLayers->AppendRows( 1 );
m_leftGridLayers->SetCellBackgroundColour ( row, COLOR_COLNUM,
color );
m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM,
layername );
m_leftGridLayers->SetCellValue( row, LAYERID_COLNUM,
layernum );
m_layersId.push_back( layerid );
if( m_frontLayer == layerid )
{
......@@ -401,6 +382,7 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList()
m_leftGridLayers->SetCellBackgroundColour( row, SELECT_COLNUM,
color );
m_leftRowSelected = row;
m_leftGridLayers->SetGridCursor( row, LAYERNAME_COLNUM );
}
if( row )
......@@ -409,8 +391,6 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList()
color );
m_rightGridLayers->SetCellValue( row, LAYERNAME_COLNUM,
layername );
m_rightGridLayers->SetCellValue( row, LAYERID_COLNUM,
layernum );
if( m_backLayer == layerid )
{
......@@ -419,6 +399,7 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList()
m_rightGridLayers->SetCellBackgroundColour ( row, SELECT_COLNUM,
color );
m_rightRowSelected = row;
m_rightGridLayers->SetGridCursor( row, LAYERNAME_COLNUM );
}
row++;
......@@ -433,9 +414,7 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList()
void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnLeftGridClick( wxGridEvent& event )
{
int row = event.GetRow();
wxString text = m_leftGridLayers->GetCellValue( row, LAYERID_COLNUM );
long layer;
text.ToLong( &layer );
LAYER_NUM layer = m_layersId[row];
if( m_frontLayer == layer )
return;
......@@ -452,14 +431,13 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnLeftGridClick( wxGridEvent& event )
m_leftGridLayers->SetCellBackgroundColour( row, SELECT_COLNUM,
MakeColour( GetLayerColor( layer ) ) );
m_leftGridLayers->SetGridCursor( row, LAYERNAME_COLNUM );
}
void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnRightGridClick( wxGridEvent& event )
{
int row = event.GetRow();
wxString text = m_rightGridLayers->GetCellValue( row, LAYERID_COLNUM );
long layer;
text.ToLong( &layer );
LAYER_NUM layer = m_layersId[row];
if( m_backLayer == layer )
return;
......@@ -475,4 +453,5 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnRightGridClick( wxGridEvent& event )
wxT("X") );
m_rightGridLayers->SetCellBackgroundColour ( row, SELECT_COLNUM,
MakeColour( GetLayerColor( layer ) ) );
m_rightGridLayers->SetGridCursor( row, LAYERNAME_COLNUM );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment