From a3c29a134376696461609da860b63a380552e752 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 1 Jan 2025 20:09:55 +0000 Subject: [PATCH] Allow resizing of Output Properties dialog. Also fixes a bug where the GenDrill dialog returned a fixed result. --- common/dialogs/dialog_rc_job.cpp | 7 +--- kicad/dialogs/panel_jobs.cpp | 6 ++- kicad/dialogs/panel_jobs_base.cpp | 2 + kicad/dialogs/panel_jobs_base.fbp | 4 +- kicad/dialogs/panel_jobs_base.h | 2 +- pcbnew/dialogs/dialog_gendrill.cpp | 55 +++++++++++-------------- pcbnew/dialogs/dialog_gendrill.h | 9 +--- pcbnew/dialogs/dialog_gendrill_base.cpp | 8 +--- pcbnew/dialogs/dialog_gendrill_base.fbp | 42 +++++++++---------- pcbnew/dialogs/dialog_gendrill_base.h | 5 +-- 10 files changed, 59 insertions(+), 81 deletions(-) diff --git a/common/dialogs/dialog_rc_job.cpp b/common/dialogs/dialog_rc_job.cpp index a3f4d8f713..793b74b6b9 100644 --- a/common/dialogs/dialog_rc_job.cpp +++ b/common/dialogs/dialog_rc_job.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2024 Mark Roszko - * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2025 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 as published by the @@ -34,12 +34,9 @@ DIALOG_RC_JOB::DIALOG_RC_JOB( wxWindow* parent, JOB_RC* aJob, const wxString& aT m_job( aJob ) { for( const auto& [format, name] : outputFormatMap ) - { m_choiceFormat->Append( wxGetTranslation( name ) ); - } - SetupStandardButtons( { { wxID_OK, _( "Save" ) }, - { wxID_CANCEL, _( "Close" ) } } ); + SetupStandardButtons(); } diff --git a/kicad/dialogs/panel_jobs.cpp b/kicad/dialogs/panel_jobs.cpp index 56714642e5..623597d106 100644 --- a/kicad/dialogs/panel_jobs.cpp +++ b/kicad/dialogs/panel_jobs.cpp @@ -76,7 +76,8 @@ public: // prevent someone from failing to add the type info in the future wxASSERT( jobTypeInfos.contains( m_output->m_type ) ); - SetTitle( wxString::Format( _( "%s Output Options" ), m_output->m_outputHandler->GetDefaultDescription() ) ); + SetTitle( wxString::Format( _( "%s Output Options" ), + m_output->m_outputHandler->GetDefaultDescription() ) ); if( m_output->m_type != JOBSET_OUTPUT_TYPE::ARCHIVE ) { @@ -133,7 +134,8 @@ public: bool TransferDataFromWindow() override { wxString outputPath = m_textCtrlOutputPath->GetValue().Trim().Trim( false ); - if( outputPath == wxEmptyString ) + + if( outputPath.IsEmpty() ) { DisplayErrorMessage( this, _( "Output path cannot be empty" ) ); return false; diff --git a/kicad/dialogs/panel_jobs_base.cpp b/kicad/dialogs/panel_jobs_base.cpp index 80016895fe..bfb4e6f852 100644 --- a/kicad/dialogs/panel_jobs_base.cpp +++ b/kicad/dialogs/panel_jobs_base.cpp @@ -244,6 +244,8 @@ DIALOG_JOB_OUTPUT_BASE::DIALOG_JOB_OUTPUT_BASE( wxWindow* parent, wxWindowID id, wxArrayString m_choiceArchiveformatChoices; m_choiceArchiveformat = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceArchiveformatChoices, 0 ); m_choiceArchiveformat->SetSelection( 0 ); + m_choiceArchiveformat->SetMinSize( wxSize( 100,-1 ) ); + fgSizer1->Add( m_choiceArchiveformat, 0, wxALIGN_CENTER_VERTICAL, 5 ); m_textOutputPath = new wxStaticText( this, wxID_ANY, _("Output path:"), wxDefaultPosition, wxDefaultSize, 0 ); diff --git a/kicad/dialogs/panel_jobs_base.fbp b/kicad/dialogs/panel_jobs_base.fbp index f3ffc04ca8..60a016e3f7 100644 --- a/kicad/dialogs/panel_jobs_base.fbp +++ b/kicad/dialogs/panel_jobs_base.fbp @@ -1285,7 +1285,7 @@ DIALOG_JOB_OUTPUT_BASE -1,-1 - wxDEFAULT_DIALOG_STYLE + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h; forward_declare @@ -1542,7 +1542,7 @@ 0 - + 100,-1 1 m_choiceArchiveformat 1 diff --git a/kicad/dialogs/panel_jobs_base.h b/kicad/dialogs/panel_jobs_base.h index 4ee9214f8c..8811cbf948 100644 --- a/kicad/dialogs/panel_jobs_base.h +++ b/kicad/dialogs/panel_jobs_base.h @@ -134,7 +134,7 @@ class DIALOG_JOB_OUTPUT_BASE : public DIALOG_SHIM public: - DIALOG_JOB_OUTPUT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + DIALOG_JOB_OUTPUT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_JOB_OUTPUT_BASE(); diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 104447783e..4ea8232043 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -80,9 +80,8 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, wxWindow* aPare m_buttonsSizer->Layout(); - SetReturnCode( 1 ); initDialog(); - GetSizer()->SetSizeHints( this ); + finishDialogSettings(); } @@ -103,9 +102,8 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, JOB_EXPORT_PCB_ SetupStandardButtons(); m_buttonsSizer->Layout(); - SetReturnCode( 1 ); initDialog(); - GetSizer()->SetSizeHints( this ); + finishDialogSettings(); } @@ -127,6 +125,28 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL() bool DIALOG_GENDRILL::TransferDataFromWindow() { + if( !m_job ) + { + GenDrillAndMapFiles( true, m_cbGenerateMap->GetValue() ); + } + else + { + m_job->SetOutputPath( m_outputDirectoryName->GetValue() ); + m_job->m_format = m_rbExcellon->GetValue() ? JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::EXCELLON + : JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::GERBER; + m_job->m_drillUnits = m_Choice_Unit->GetSelection() == 0 + ? JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MILLIMETERS + : JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCHES; + m_job->m_drillOrigin = static_cast( m_Choice_Drill_Offset->GetSelection() ); + m_job->m_excellonCombinePTHNPTH = m_Check_Merge_PTH_NPTH->IsChecked(); + m_job->m_excellonMinimalHeader = m_Check_Minimal->IsChecked(); + m_job->m_excellonMirrorY = m_Check_Mirror->IsChecked(); + m_job->m_excellonOvalDrillRoute = m_radioBoxOvalHoleMode->GetSelection() == 0; + m_job->m_mapFormat = static_cast( m_Choice_Drill_Map->GetSelection() ); + m_job->m_zeroFormat = static_cast( m_Choice_Zeros_Format->GetSelection() ); + m_job->m_generateMap = m_cbGenerateMap->IsChecked(); + } + return true; } @@ -330,33 +350,6 @@ void DIALOG_GENDRILL::OnSelDrillUnitsSelected( wxCommandEvent& event ) } -void DIALOG_GENDRILL::OnGenDrillFile( wxCommandEvent& event ) -{ - if( !m_job ) - { - GenDrillAndMapFiles( true, m_cbGenerateMap->GetValue() ); - } - else - { - m_job->SetOutputPath( m_outputDirectoryName->GetValue() ); - m_job->m_format = m_rbExcellon->GetValue() ? JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::EXCELLON - : JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::GERBER; - m_job->m_drillUnits = m_Choice_Unit->GetSelection() == 0 - ? JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MILLIMETERS - : JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCHES; - m_job->m_drillOrigin = static_cast( m_Choice_Drill_Offset->GetSelection() ); - m_job->m_excellonCombinePTHNPTH = m_Check_Merge_PTH_NPTH->IsChecked(); - m_job->m_excellonMinimalHeader = m_Check_Minimal->IsChecked(); - m_job->m_excellonMirrorY = m_Check_Mirror->IsChecked(); - m_job->m_excellonOvalDrillRoute = m_radioBoxOvalHoleMode->GetSelection() == 0; - m_job->m_mapFormat = static_cast( m_Choice_Drill_Map->GetSelection() ); - m_job->m_zeroFormat = static_cast( m_Choice_Zeros_Format->GetSelection() ); - m_job->m_generateMap = m_cbGenerateMap->IsChecked(); - Close(); - } -} - - void DIALOG_GENDRILL::OnSelZerosFmtSelected( wxCommandEvent& event ) { UpdatePrecisionOptions(); diff --git a/pcbnew/dialogs/dialog_gendrill.h b/pcbnew/dialogs/dialog_gendrill.h index 1c62e657f9..a53eb0d9e3 100644 --- a/pcbnew/dialogs/dialog_gendrill.h +++ b/pcbnew/dialogs/dialog_gendrill.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 1992-2019 Jean_Pierre Charras - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2025 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 @@ -56,7 +56,6 @@ private: // event functions void OnSelDrillUnitsSelected( wxCommandEvent& event ) override; void OnSelZerosFmtSelected( wxCommandEvent& event ) override; - void OnGenDrillFile( wxCommandEvent& event ) override; void onFileFormatSelection( wxCommandEvent& event ) override; // Called when closing the dialog: Update config. @@ -68,12 +67,6 @@ private: event.Skip(); } - void onQuitDlg( wxCommandEvent& event ) override - { - UpdateConfig(); - event.Skip(); - } - /* * Create a plain text report file giving a list of drill values and drill count * for through holes, oblong holes, and for buried vias, diff --git a/pcbnew/dialogs/dialog_gendrill_base.cpp b/pcbnew/dialogs/dialog_gendrill_base.cpp index ec87f29e89..71d6e0e2b3 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.cpp +++ b/pcbnew/dialogs/dialog_gendrill_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -207,7 +207,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con m_messagesBox = new wxTextCtrl( bMsgSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); m_messagesBox->SetMinSize( wxSize( -1,90 ) ); - bMsgSizer->Add( m_messagesBox, 1, wxALL|wxEXPAND, 5 ); + bMsgSizer->Add( m_messagesBox, 1, wxEXPAND, 5 ); bMainSizer->Add( bMsgSizer, 1, wxALL|wxEXPAND, 5 ); @@ -244,8 +244,6 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con m_Choice_Unit->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this ); m_Choice_Zeros_Format->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this ); m_buttonReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenReportFile ), NULL, this ); - m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::onQuitDlg ), NULL, this ); - m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenDrillFile ), NULL, this ); } DIALOG_GENDRILL_BASE::~DIALOG_GENDRILL_BASE() @@ -258,7 +256,5 @@ DIALOG_GENDRILL_BASE::~DIALOG_GENDRILL_BASE() m_Choice_Unit->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this ); m_Choice_Zeros_Format->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this ); m_buttonReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenReportFile ), NULL, this ); - m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::onQuitDlg ), NULL, this ); - m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenDrillFile ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_gendrill_base.fbp b/pcbnew/dialogs/dialog_gendrill_base.fbp index c613a0f0dc..e54e6d258c 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.fbp +++ b/pcbnew/dialogs/dialog_gendrill_base.fbp @@ -1,36 +1,34 @@ - + + ; C++ - - 1 - connect - none - - - 0 - 0 + 1 + source_name + 0 + 0 res UTF-8 + connect dialog_gendrill_base 1000 + none + + 1 - 1 - UI dialog_gendrill_base + . - 0 - source_name - 1 - 0 - source_name - - - 1 + 1 + 1 + 1 + 1 + UI + 0 + 0 0 - 0 0 wxAUI_MGR_DEFAULT @@ -1884,7 +1882,7 @@ protected 5 - wxALL|wxEXPAND + wxEXPAND 1 1 @@ -2049,8 +2047,6 @@ m_sdbSizer protected - onQuitDlg - OnGenDrillFile diff --git a/pcbnew/dialogs/dialog_gendrill_base.h b/pcbnew/dialogs/dialog_gendrill_base.h index cc541990b7..d79583ee22 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.h +++ b/pcbnew/dialogs/dialog_gendrill_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -34,6 +34,7 @@ class STD_BITMAP_BUTTON; /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_GENDRILL_BASE /////////////////////////////////////////////////////////////////////////////// @@ -84,8 +85,6 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM virtual void OnSelDrillUnitsSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnSelZerosFmtSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnGenReportFile( wxCommandEvent& event ) { event.Skip(); } - virtual void onQuitDlg( wxCommandEvent& event ) { event.Skip(); } - virtual void OnGenDrillFile( wxCommandEvent& event ) { event.Skip(); } public: