* Gerbview: update a old code in a dialog.

Fixes: lp:1741410
https://bugs.launchpad.net/kicad/+bug/1741410
This commit is contained in:
jean-pierre charras 2018-01-05 11:45:50 +01:00
parent 658d181ec7
commit 33cbbc95d9
5 changed files with 223 additions and 112 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_layers_select_to_pcb_base.h"
@ -27,7 +27,17 @@ LAYERS_MAP_DIALOG_BASE::LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id,
wxBoxSizer* sbUpperSizer;
sbUpperSizer = new wxBoxSizer( wxHORIZONTAL );
sbSizerLayersTable = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layer selection:") ), wxHORIZONTAL );
wxBoxSizer* bSizerLayerSelection;
bSizerLayerSelection = new wxBoxSizer( wxVERTICAL );
m_staticTextLayerSel = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLayerSel->Wrap( -1 );
bSizerLayerSelection->Add( m_staticTextLayerSel, 0, wxALL, 5 );
m_bSizerLayerList = new wxBoxSizer( wxHORIZONTAL );
m_bSizerLayerList->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_flexLeftColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
m_flexLeftColumnBoxSizer->AddGrowableCol( 0 );
@ -38,13 +48,27 @@ LAYERS_MAP_DIALOG_BASE::LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id,
m_flexLeftColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
sbSizerLayersTable->Add( m_flexLeftColumnBoxSizer, 1, wxEXPAND, 5 );
m_bSizerLayerList->Add( m_flexLeftColumnBoxSizer, 1, wxEXPAND, 5 );
m_staticlineSep = new wxStaticLine( sbSizerLayersTable->GetStaticBox(), ID_M_STATICLINESEP, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
sbSizerLayersTable->Add( m_staticlineSep, 0, wxEXPAND | wxALL, 5 );
m_staticlineSep = new wxStaticLine( this, ID_M_STATICLINESEP, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
m_bSizerLayerList->Add( m_staticlineSep, 0, wxEXPAND | wxALL, 5 );
m_flexRightColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
m_flexRightColumnBoxSizer->AddGrowableCol( 0 );
m_flexRightColumnBoxSizer->AddGrowableCol( 1 );
m_flexRightColumnBoxSizer->AddGrowableCol( 2 );
m_flexRightColumnBoxSizer->AddGrowableCol( 3 );
m_flexRightColumnBoxSizer->SetFlexibleDirection( wxBOTH );
m_flexRightColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
sbUpperSizer->Add( sbSizerLayersTable, 1, wxALL|wxEXPAND, 5 );
m_bSizerLayerList->Add( m_flexRightColumnBoxSizer, 1, wxEXPAND, 5 );
bSizerLayerSelection->Add( m_bSizerLayerList, 1, wxEXPAND, 5 );
sbUpperSizer->Add( bSizerLayerSelection, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
@ -109,7 +133,6 @@ LAYERS_MAP_DIALOG_BASE::LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id,
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
}

View File

@ -24,7 +24,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
@ -44,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">LAYERS_MAP_DIALOG_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">386,333</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Layer Selection</property>
@ -104,40 +104,18 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Layer selection:</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sbSizerLayersTable</property>
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<property name="name">bSizerLayerSelection</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<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">4</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0,1,2,3</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">m_flexLeftColumnBoxSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="rows">16</property>
<property name="vgap">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -164,7 +142,8 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_STATICLINESEP</property>
<property name="id">wxID_ANY</property>
<property name="label">Layer selection:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -172,7 +151,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticlineSep</property>
<property name="name">m_staticTextLayerSel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -182,13 +161,14 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_VERTICAL</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -214,6 +194,144 @@
<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="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_bSizerLayerList</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</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">4</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0,1,2,3</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">m_flexLeftColumnBoxSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="rows">16</property>
<property name="vgap">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" 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="best_size"></property>
<property name="bg"></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="default_pane">0</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="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_STATICLINESEP</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_staticlineSep</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="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_VERTICAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<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="wxFlexGridSizer" expanded="1">
<property name="cols">4</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0,1,2,3</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">m_flexRightColumnBoxSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="rows">16</property>
<property name="vgap">0</property>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">

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_LAYERS_SELECT_TO_PCB_BASE_H__
@ -11,22 +11,31 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/sizer.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/statline.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/combobox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LAYERS_MAP_DIALOG_BASE 1000
#define ID_M_STATICLINESEP 1001
#define ID_M_STATICTEXTCOPPERLAYERCOUNT 1002
#define ID_M_COMBOCOPPERLAYERSCOUNT 1003
#define ID_STORE_CHOICE 1004
#define ID_GET_PREVIOUS_CHOICE 1005
#define ID_RESET_CHOICE 1006
///////////////////////////////////////////////////////////////////////////////
/// Class LAYERS_MAP_DIALOG_BASE
///////////////////////////////////////////////////////////////////////////////
@ -44,20 +53,11 @@ class LAYERS_MAP_DIALOG_BASE : public DIALOG_SHIM
protected:
enum
{
ID_LAYERS_MAP_DIALOG_BASE = 1000,
ID_M_STATICLINESEP,
ID_M_STATICTEXTCOPPERLAYERCOUNT,
ID_M_COMBOCOPPERLAYERSCOUNT,
ID_STORE_CHOICE,
ID_GET_PREVIOUS_CHOICE,
ID_RESET_CHOICE
};
wxStaticBoxSizer* sbSizerLayersTable;
wxStaticText* m_staticTextLayerSel;
wxBoxSizer* m_bSizerLayerList;
wxFlexGridSizer* m_flexLeftColumnBoxSizer;
wxStaticLine* m_staticlineSep;
wxFlexGridSizer* m_flexRightColumnBoxSizer;
wxStaticText* m_staticTextCopperlayerCount;
wxComboBox* m_comboCopperLayersCount;
wxButton* m_buttonStore;
@ -78,7 +78,7 @@ class LAYERS_MAP_DIALOG_BASE : public DIALOG_SHIM
public:
LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id = ID_LAYERS_MAP_DIALOG_BASE, const wxString& title = _("Layer Selection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id = ID_LAYERS_MAP_DIALOG_BASE, const wxString& title = _("Layer Selection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 386,333 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~LAYERS_MAP_DIALOG_BASE();
};

View File

@ -6,7 +6,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -83,26 +83,6 @@ void LAYERS_MAP_DIALOG::initDialog()
wxString msg;
wxSize goodSize;
m_flexRightColumnBoxSizer = NULL;
// Experimentation has shown that buttons in the Windows version can be 20
// pixels wide and 20 pixels high, but that they need to be 26 pixels wide
// and 26 pixels high in the Linux version. (And although the dimensions
// of those buttons could be set to 26 pixels wide and 26 pixels high in
// both of those versions, that would result in a dialog box which would
// be excessively high in the Windows version.)
#ifdef __WINDOWS__
int w = 20;
int h = 20;
#else
int w = 26;
int h = 26;
#endif
// As currently implemented, the dimensions of the buttons in the Mac
// version are also 26 pixels wide and 26 pixels high. If appropriate,
// the above code should be modified as required in the event that those
// buttons should be some other size in that version.
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
{
// Specify the default value for each member of these arrays.
@ -141,17 +121,9 @@ void LAYERS_MAP_DIALOG::initDialog()
{
m_staticlineSep->Hide();
}
else // Add the second list of gerber files
{
m_flexRightColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
for( int ii = 0; ii < 4; ii++ )
m_flexRightColumnBoxSizer->AddGrowableCol( ii );
m_flexRightColumnBoxSizer->SetFlexibleDirection( wxBOTH );
m_flexRightColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
sbSizerLayersTable->Add( m_flexRightColumnBoxSizer, 1, wxEXPAND, 5 );
}
wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer;
for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ )
{
// Each Gerber layer has an associated static text string (to
@ -185,27 +157,26 @@ void LAYERS_MAP_DIALOG::initDialog()
// Provide a text string to identify the Gerber layer
msg.Printf( _( "Layer %d" ), m_buttonTable[ii] + 1 );
label = new wxStaticText( this, wxID_STATIC, msg, wxDefaultPosition,
wxDefaultSize, wxALIGN_RIGHT );
flexColumnBoxSizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL |
wxRIGHT | wxLEFT, 5 );
label = new wxStaticText( this,
wxID_STATIC, msg, wxDefaultPosition,
wxDefaultSize, 0 );
flexColumnBoxSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Add file name and extension without path. */
wxFileName fn( images->GetGbrImage( ii )->m_FileName );
label = new wxStaticText( this, wxID_STATIC, fn.GetFullName(),
label = new wxStaticText( this,
wxID_STATIC, fn.GetFullName(),
wxDefaultPosition, wxDefaultSize );
flexColumnBoxSizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL |
wxRIGHT | wxLEFT, 5 );
wxALIGN_CENTER_VERTICAL | wxALL, 5 );
// Provide a button for this layer (which will invoke a child dialog box)
item_ID = ID_BUTTON_0 + ii;
wxButton * Button = new wxButton( this, item_ID, wxT( "..." ),
wxDefaultPosition, wxSize( w, h ), 0 );
wxButton * Button = new wxButton( this,
item_ID, wxT( "..." ),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
flexColumnBoxSizer->Add( Button, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
flexColumnBoxSizer->Add( Button, 0, wxALIGN_CENTER_VERTICAL | wxALL );
// Provide another text string to specify which Pcbnew layer that this
// Gerber layer is initially mapped to, and set the initial text to
@ -223,7 +194,8 @@ void LAYERS_MAP_DIALOG::initDialog()
if( ii == 0 )
{
msg = _( "Do not export" );
text = new wxStaticText( this, item_ID, msg, wxDefaultPosition,
text = new wxStaticText( this,
item_ID, msg, wxDefaultPosition,
wxDefaultSize, 0 );
goodSize = text->GetSize();
@ -240,12 +212,12 @@ void LAYERS_MAP_DIALOG::initDialog()
else
{
msg = GetPCBDefaultLayerName( m_layersLookUpTable[m_buttonTable[ii]] );
text = new wxStaticText( this, item_ID, msg, wxDefaultPosition,
text = new wxStaticText( this,
item_ID, msg, wxDefaultPosition,
wxDefaultSize, 0 );
}
text->SetMinSize( goodSize );
flexColumnBoxSizer->Add( text, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT,
flexColumnBoxSizer->Add( text, 1, wxALIGN_CENTER_VERTICAL | wxALL,
5 );
m_layersList[ii] = text;

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2011-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -41,8 +41,6 @@ private:
GERBVIEW_FRAME* m_Parent;
int m_gerberActiveLayersCount; // Number of initialized gerber layers
static int m_exportBoardCopperLayersCount;
wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used
// when we have more than 16 gerber files loaded
LAYER_NUM m_layersLookUpTable[GERBER_DRAWLAYERS_COUNT]; // Indexes Gerber layers to PCB file layers
// the last value in table is the number of copper layers
int m_buttonTable[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes buttons to Gerber layers