From 62e5500420c290140256b9405ae7d331f28a9964 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 23 Nov 2020 11:44:46 +0000 Subject: [PATCH] Cleanup dialog layout & punctuation. --- pcbnew/import_gfx/dialog_import_gfx.cpp | 7 +- pcbnew/import_gfx/dialog_import_gfx_base.cpp | 53 +++++------- pcbnew/import_gfx/dialog_import_gfx_base.fbp | 88 +++++++------------- pcbnew/import_gfx/dialog_import_gfx_base.h | 3 +- 4 files changed, 57 insertions(+), 94 deletions(-) diff --git a/pcbnew/import_gfx/dialog_import_gfx.cpp b/pcbnew/import_gfx/dialog_import_gfx.cpp index ff16e64894..1566ae7c5c 100644 --- a/pcbnew/import_gfx/dialog_import_gfx.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2020 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 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "dxf_import_plugin.h" @@ -43,7 +44,7 @@ LAYER_NUM DIALOG_IMPORT_GFX::m_layer = Dwgs_User; double DIALOG_IMPORT_GFX::m_scaleImport = 1.0; // Do not change the imported items size int DIALOG_IMPORT_GFX::m_originUnits = 0; // millimeter int DIALOG_IMPORT_GFX::m_lineWidthUnits = 0; // millimeter -int DIALOG_IMPORT_GFX::m_dxfUnits = 0; // first entry in the dxfUnits map below +int DIALOG_IMPORT_GFX::m_dxfUnits = 0; // first entry in the dxfUnits map below const std::map dxfUnitsMap = { { DXF_IMPORT_UNITS::INCHES, _( "Inches" ) }, @@ -127,6 +128,8 @@ DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFoo m_choiceDxfUnits->SetSelection( m_dxfUnits ); + m_browseButton->SetBitmap( KiBitmap( folder_xpm ) ); + SetInitialFocus( m_textCtrlFileName ); m_sdbSizerOK->SetDefault(); GetSizer()->Fit( this ); diff --git a/pcbnew/import_gfx/dialog_import_gfx_base.cpp b/pcbnew/import_gfx/dialog_import_gfx_base.cpp index 418d8157fc..d67e47b01f 100644 --- a/pcbnew/import_gfx/dialog_import_gfx_base.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx_base.cpp @@ -33,13 +33,11 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, bSizerFile->Add( m_textCtrlFileName, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonBrowse->SetToolTip( _("Only vectors will be imported. Bitmaps and fonts will be ignored.") ); - - bSizerFile->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + bSizerFile->Add( m_browseButton, 0, wxALL, 5 ); - bSizerMain->Add( bSizerFile, 0, wxALL|wxEXPAND, 5 ); + bSizerMain->Add( bSizerFile, 0, wxALL|wxEXPAND, 10 ); wxStaticBoxSizer* sbSizer2; sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Placement") ), wxVERTICAL ); @@ -49,7 +47,7 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, m_rbInteractivePlacement = new wxRadioButton( sbSizer2->GetStaticBox(), wxID_ANY, _("Interactive placement"), wxDefaultPosition, wxDefaultSize, 0 ); m_rbInteractivePlacement->SetValue( true ); - bSizerOptions->Add( m_rbInteractivePlacement, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + bSizerOptions->Add( m_rbInteractivePlacement, 0, wxEXPAND|wxBOTTOM, 5 ); wxBoxSizer* bSizerUserPos; bSizerUserPos = new wxBoxSizer( wxHORIZONTAL ); @@ -60,7 +58,7 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, wxBoxSizer* bSizerPosSettings; bSizerPosSettings = new wxBoxSizer( wxHORIZONTAL ); - m_staticTextXpos = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("X"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextXpos = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextXpos->Wrap( -1 ); bSizerPosSettings->Add( m_staticTextXpos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); @@ -77,7 +75,7 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, bSizerPosSettings->Add( m_DxfPcbXCoord, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_staticTextYpos = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Y"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextYpos = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextYpos->Wrap( -1 ); bSizerPosSettings->Add( m_staticTextYpos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); @@ -113,10 +111,10 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, bSizerOptions->Add( bSizerUserPos, 0, wxEXPAND, 5 ); - sbSizer2->Add( bSizerOptions, 0, wxEXPAND|wxLEFT, 20 ); + sbSizer2->Add( bSizerOptions, 0, wxEXPAND, 5 ); - bSizerMain->Add( sbSizer2, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + bSizerMain->Add( sbSizer2, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Import Parameters") ), wxVERTICAL ); @@ -124,16 +122,13 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, wxBoxSizer* bSizer7; bSizer7 = new wxBoxSizer( wxHORIZONTAL ); - - bSizer7->Add( 0, 0, 0, wxLEFT|wxRIGHT, 10 ); - wxFlexGridSizer* fgSizerImportSettings; fgSizerImportSettings = new wxFlexGridSizer( 0, 3, 5, 5 ); fgSizerImportSettings->AddGrowableCol( 1 ); fgSizerImportSettings->SetFlexibleDirection( wxBOTH ); fgSizerImportSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextBrdlayer = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Graphic layer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBrdlayer = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Graphic layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextBrdlayer->Wrap( -1 ); fgSizerImportSettings->Add( m_staticTextBrdlayer, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -143,7 +138,7 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, fgSizerImportSettings->Add( 0, 0, 0, 0, 5 ); - m_staticTextscale = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Import scale"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextscale = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Import scale:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextscale->Wrap( -1 ); fgSizerImportSettings->Add( m_staticTextscale, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -154,13 +149,13 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, fgSizerImportSettings->Add( 0, 0, 0, 0, 5 ); - bSizer7->Add( fgSizerImportSettings, 1, wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP, 5 ); + bSizer7->Add( fgSizerImportSettings, 1, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); sbSizer1->Add( bSizer7, 1, wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - sbSizer1->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 ); + sbSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxVERTICAL ); @@ -168,13 +163,13 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, m_groupItems = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Group items"), wxDefaultPosition, wxDefaultSize, 0 ); m_groupItems->SetToolTip( _("Add all imported items into a new group") ); - bSizer8->Add( m_groupItems, 0, wxBOTTOM|wxEXPAND|wxLEFT, 10 ); + bSizer8->Add( m_groupItems, 0, wxEXPAND|wxBOTTOM, 5 ); - sbSizer1->Add( bSizer8, 0, wxALL|wxEXPAND, 5 ); + sbSizer1->Add( bSizer8, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - bSizerMain->Add( sbSizer1, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + bSizerMain->Add( sbSizer1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); wxStaticBoxSizer* sbSizer3; sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("DXF Parameters") ), wxVERTICAL ); @@ -182,16 +177,13 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, wxBoxSizer* bSizer81; bSizer81 = new wxBoxSizer( wxHORIZONTAL ); - - bSizer81->Add( 0, 0, 0, wxLEFT|wxRIGHT, 10 ); - wxFlexGridSizer* fgDxfImportSettings; fgDxfImportSettings = new wxFlexGridSizer( 0, 3, 5, 5 ); fgDxfImportSettings->AddGrowableCol( 1 ); fgDxfImportSettings->SetFlexibleDirection( wxBOTH ); fgDxfImportSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextLineWidth = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Default line width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLineWidth = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLineWidth->Wrap( -1 ); fgDxfImportSettings->Add( m_staticTextLineWidth, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -204,9 +196,9 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, m_choiceUnitLineWidth->SetSelection( 0 ); fgDxfImportSettings->Add( m_choiceUnitLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_staticTextLineWidth1 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Default units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLineWidth1 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Default units:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLineWidth1->Wrap( -1 ); - fgDxfImportSettings->Add( m_staticTextLineWidth1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + fgDxfImportSettings->Add( m_staticTextLineWidth1, 0, wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_choiceDxfUnitsChoices; m_choiceDxfUnits = new wxChoice( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceDxfUnitsChoices, 0 ); @@ -223,10 +215,7 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, sbSizer3->Add( bSizer81, 1, wxEXPAND, 5 ); - bSizerMain->Add( sbSizer3, 1, wxALL|wxEXPAND, 5 ); - - - bSizerMain->Add( 0, 0, 0, wxEXPAND, 5 ); + bSizerMain->Add( sbSizer3, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); @@ -245,7 +234,7 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, this->Centre( wxBOTH ); // Connect Events - m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onBrowseFiles ), NULL, this ); + m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onBrowseFiles ), NULL, this ); m_rbInteractivePlacement->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onInteractivePlacement ), NULL, this ); m_rbInteractivePlacement->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_IMPORT_GFX_BASE::originOptionOnUpdateUI ), NULL, this ); m_rbAbsolutePlacement->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onAbsolutePlacement ), NULL, this ); @@ -258,7 +247,7 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, DIALOG_IMPORT_GFX_BASE::~DIALOG_IMPORT_GFX_BASE() { // Disconnect Events - m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onBrowseFiles ), NULL, this ); + m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onBrowseFiles ), NULL, this ); m_rbInteractivePlacement->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onInteractivePlacement ), NULL, this ); m_rbInteractivePlacement->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_IMPORT_GFX_BASE::originOptionOnUpdateUI ), NULL, this ); m_rbAbsolutePlacement->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onAbsolutePlacement ), NULL, this ); diff --git a/pcbnew/import_gfx/dialog_import_gfx_base.fbp b/pcbnew/import_gfx/dialog_import_gfx_base.fbp index 5a3ccc5137..503690ba2b 100644 --- a/pcbnew/import_gfx/dialog_import_gfx_base.fbp +++ b/pcbnew/import_gfx/dialog_import_gfx_base.fbp @@ -59,7 +59,7 @@ wxVERTICAL none - 5 + 10 wxALL|wxEXPAND 0 @@ -192,11 +192,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT + wxALL 0 - + 1 1 1 @@ -229,7 +229,7 @@ 0 0 wxID_ANY - Browse + Browse... 0 @@ -239,7 +239,7 @@ 0 1 - m_buttonBrowse + m_browseButton 1 @@ -252,9 +252,9 @@ 1 - + ; ; forward_declare 0 - Only vectors will be imported. Bitmaps and fonts will be ignored. + wxFILTER_NONE wxDefaultValidator @@ -268,8 +268,8 @@ - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 10 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 wxID_ANY @@ -280,8 +280,8 @@ 1 none - 20 - wxEXPAND|wxLEFT + 5 + wxEXPAND 0 @@ -290,7 +290,7 @@ none 5 - wxBOTTOM|wxEXPAND|wxTOP + wxEXPAND|wxBOTTOM 0 1 @@ -470,7 +470,7 @@ 0 0 wxID_ANY - X + X: 0 0 @@ -595,7 +595,7 @@ 0 0 wxID_ANY - Y + Y: 0 0 @@ -823,8 +823,8 @@ - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 10 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 wxID_ANY @@ -843,19 +843,9 @@ bSizer7 wxHORIZONTAL none - - 10 - wxLEFT|wxRIGHT - 0 - - 0 - protected - 0 - - 5 - wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP + wxEXPAND|wxBOTTOM|wxRIGHT 1 3 @@ -901,7 +891,7 @@ 0 0 wxID_ANY - Graphic layer + Graphic layer: 0 0 @@ -1037,7 +1027,7 @@ 0 0 wxID_ANY - Import scale + Import scale: 0 0 @@ -1146,7 +1136,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxBOTTOM 0 1 @@ -1204,7 +1194,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxBOTTOM 0 @@ -1212,8 +1202,8 @@ wxVERTICAL none - 10 - wxBOTTOM|wxEXPAND|wxLEFT + 5 + wxEXPAND|wxBOTTOM 0 1 @@ -1281,8 +1271,8 @@ - 5 - wxALL|wxEXPAND + 10 + wxEXPAND|wxRIGHT|wxLEFT 1 wxID_ANY @@ -1301,16 +1291,6 @@ bSizer81 wxHORIZONTAL none - - 10 - wxLEFT|wxRIGHT - 0 - - 0 - protected - 0 - - 5 wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT @@ -1359,7 +1339,7 @@ 0 0 wxID_ANY - Default line width + Default line width: 0 0 @@ -1519,7 +1499,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + wxALIGN_CENTER_VERTICAL 0 1 @@ -1549,7 +1529,7 @@ 0 0 wxID_ANY - Default units + Default units: 0 0 @@ -1658,16 +1638,6 @@ - - 5 - wxEXPAND - 0 - - 0 - protected - 0 - - 5 wxEXPAND|wxALL diff --git a/pcbnew/import_gfx/dialog_import_gfx_base.h b/pcbnew/import_gfx/dialog_import_gfx_base.h index d2d1abf240..8c9ccc51a5 100644 --- a/pcbnew/import_gfx/dialog_import_gfx_base.h +++ b/pcbnew/import_gfx/dialog_import_gfx_base.h @@ -20,6 +20,7 @@ class PCB_LAYER_BOX_SELECTOR; #include #include #include +#include #include #include #include @@ -47,7 +48,7 @@ class DIALOG_IMPORT_GFX_BASE : public DIALOG_SHIM protected: wxStaticText* m_staticTextFile; wxTextCtrl* m_textCtrlFileName; - wxButton* m_buttonBrowse; + wxBitmapButton* m_browseButton; wxRadioButton* m_rbInteractivePlacement; wxRadioButton* m_rbAbsolutePlacement; wxStaticText* m_staticTextXpos;