7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 14:31:42 +00:00

Allow resizing of Output Properties dialog.

Also fixes a bug where the GenDrill dialog returned a fixed
result.
This commit is contained in:
Jeff Young 2025-01-01 20:09:55 +00:00
parent 7881fa68e9
commit a3c29a1343
10 changed files with 59 additions and 81 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Mark Roszko <mark.roszko@gmail.com>
* 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();
}

View File

@ -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;

View File

@ -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 );

View File

@ -1285,7 +1285,7 @@
<property name="name">DIALOG_JOB_OUTPUT_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">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title"></property>
<property name="tooltip"></property>
@ -1542,7 +1542,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">100,-1</property>
<property name="moveable">1</property>
<property name="name">m_choiceArchiveformat</property>
<property name="pane_border">1</property>

View File

@ -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();

View File

@ -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<JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN>( 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<JOB_EXPORT_PCB_DRILL::MAP_FORMAT>( m_Choice_Drill_Map->GetSelection() );
m_job->m_zeroFormat = static_cast<JOB_EXPORT_PCB_DRILL::ZEROS_FORMAT>( 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<JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN>( 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<JOB_EXPORT_PCB_DRILL::MAP_FORMAT>( m_Choice_Drill_Map->GetSelection() );
m_job->m_zeroFormat = static_cast<JOB_EXPORT_PCB_DRILL::ZEROS_FORMAT>( m_Choice_Zeros_Format->GetSelection() );
m_job->m_generateMap = m_cbGenerateMap->IsChecked();
Close();
}
}
void DIALOG_GENDRILL::OnSelZerosFmtSelected( wxCommandEvent& event )
{
UpdatePrecisionOptions();

View File

@ -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 <jp.charras@ujf-grenoble.fr>
* 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,

View File

@ -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 );
}

View File

@ -1,36 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="18"/>
<FileVersion major="1" minor="17"/>
<object class="Project" expanded="true">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="cpp_class_decoration"></property>
<property name="cpp_disconnect_events">1</property>
<property name="cpp_event_generation">connect</property>
<property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">0</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_gendrill_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">dialog_gendrill_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces"></property>
<property name="python_skip_events">1</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>
<object class="Dialog" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
@ -1884,7 +1882,7 @@
<property name="permission">protected</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="true">
<property name="BottomDockable">1</property>
@ -2049,8 +2047,6 @@
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnCancelButtonClick">onQuitDlg</event>
<event name="OnOKButtonClick">OnGenDrillFile</event>
</object>
</object>
</object>

View File

@ -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: