Attempt to fix teardrop radio buttons on GTK.

This commit is contained in:
Jeff Young 2023-05-22 14:48:31 +01:00
parent a13a49f45a
commit 00986484e0
4 changed files with 161 additions and 5 deletions

View File

@ -80,10 +80,12 @@ protected:
if( !m_rbStraightLines->GetValue() ) if( !m_rbStraightLines->GetValue() )
{ {
m_rbStraightLines->SetValue( true ); m_rbStraightLines->SetValue( true );
m_rbAntiCurved->SetValue( true );
m_rbCurved->SetValue( false ); m_rbCurved->SetValue( false );
} }
else else
{ {
m_rbAntiStraight->SetValue( true );
m_rbStraightLines->SetValue( false ); m_rbStraightLines->SetValue( false );
} }
} }
@ -92,14 +94,19 @@ protected:
if( !m_rbCurved->GetValue() ) if( !m_rbCurved->GetValue() )
{ {
m_rbCurved->SetValue( true ); m_rbCurved->SetValue( true );
m_rbAntiStraight->SetValue( true );
m_rbStraightLines->SetValue( false ); m_rbStraightLines->SetValue( false );
} }
else else
{ {
m_rbAntiCurved->SetValue( true );
m_rbCurved->SetValue( false ); m_rbCurved->SetValue( false );
} }
} }
// Track-to-track teardrops always follow the document-wide settings (there are no teardrop
// properties on individual track segments as they're too ephemeral). Therefore we disable
// Set-to-specified-values when track-to-track is selected.
void onTrackToTrack( wxCommandEvent& event ) override void onTrackToTrack( wxCommandEvent& event ) override
{ {
if( event.IsChecked() && m_specifiedValues->GetValue() ) if( event.IsChecked() && m_specifiedValues->GetValue() )
@ -109,6 +116,7 @@ protected:
} }
} }
// These just improve usability so that you don't have to click twice to enable a filter.
void OnNetclassFilterSelect( wxCommandEvent& event ) override void OnNetclassFilterSelect( wxCommandEvent& event ) override
{ {
m_netclassFilterOpt->SetValue( true ); m_netclassFilterOpt->SetValue( true );
@ -121,12 +129,20 @@ protected:
{ {
m_netFilterOpt->SetValue( true ); m_netFilterOpt->SetValue( true );
} }
// Remove "add" terminology when updating only existing teardrops.
void OnExistingFilterSelect( wxCommandEvent& event ) override void OnExistingFilterSelect( wxCommandEvent& event ) override
{ {
if( event.IsChecked() ) if( event.IsChecked() )
m_specifiedValues->SetLabel( _( "Update teardrops to specified values:" ) ); {
m_addTeardrops->SetLabel( _( "Set teardrops to default values for shape" ) );
m_specifiedValues->SetLabel( _( "Set teardrops to specified values:" ) );
}
else else
{
m_addTeardrops->SetLabel( _( "Add teardrops with default values for shape" ) );
m_specifiedValues->SetLabel( _( "Add teardrops with specified values:" ) ); m_specifiedValues->SetLabel( _( "Add teardrops with specified values:" ) );
}
} }
void setSpecifiedParams( TEARDROP_PARAMETERS* targetParams ); void setSpecifiedParams( TEARDROP_PARAMETERS* targetParams );

View File

@ -205,10 +205,20 @@ DIALOG_GLOBAL_EDIT_TEARDROPS_BASE::DIALOG_GLOBAL_EDIT_TEARDROPS_BASE( wxWindow*
m_staticText15->Wrap( -1 ); m_staticText15->Wrap( -1 );
bSizer41->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); bSizer41->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_rbStraightLines = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, _("Straight lines"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); m_rbAntiStraight = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbAntiStraight->Hide();
bSizer41->Add( m_rbAntiStraight, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_rbStraightLines = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, _("Straight lines"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer41->Add( m_rbStraightLines, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); bSizer41->Add( m_rbStraightLines, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_rbCurved = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, _("Curved"), wxDefaultPosition, wxDefaultSize, wxRB_SINGLE ); m_rbAntiCurved = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbAntiCurved->Hide();
bSizer41->Add( m_rbAntiCurved, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_rbCurved = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, _("Curved"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizer41->Add( m_rbCurved, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); bSizer41->Add( m_rbCurved, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );

View File

@ -1893,6 +1893,70 @@
<event name="OnUpdateUI">onSpecifiedValuesUpdateUi</event> <event name="OnUpdateUI">onSpecifiedValuesUpdateUi</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioButton" 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">1</property>
<property name="id">wxID_ANY</property>
<property name="label"></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_rbAntiStraight</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">wxRB_GROUP</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
@ -1943,7 +2007,7 @@
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxRB_GROUP</property> <property name="style"></property>
<property name="subclass">; ; forward_declare</property> <property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
@ -1959,6 +2023,70 @@
<event name="OnUpdateUI">onSpecifiedValuesUpdateUi</event> <event name="OnUpdateUI">onSpecifiedValuesUpdateUi</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioButton" 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">1</property>
<property name="id">wxID_ANY</property>
<property name="label"></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_rbAntiCurved</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">wxRB_GROUP</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
@ -2009,7 +2137,7 @@
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxRB_SINGLE</property> <property name="style">wxRB_GROUP</property>
<property name="subclass">; ; forward_declare</property> <property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>

View File

@ -73,7 +73,9 @@ class DIALOG_GLOBAL_EDIT_TEARDROPS_BASE : public DIALOG_SHIM
wxStaticText* m_minTrackWidthHint; wxStaticText* m_minTrackWidthHint;
wxStaticBitmap* m_bitmapTeardrop; wxStaticBitmap* m_bitmapTeardrop;
wxStaticText* m_staticText15; wxStaticText* m_staticText15;
wxRadioButton* m_rbAntiStraight;
wxRadioButton* m_rbStraightLines; wxRadioButton* m_rbStraightLines;
wxRadioButton* m_rbAntiCurved;
wxRadioButton* m_rbCurved; wxRadioButton* m_rbCurved;
wxStaticText* m_stLenPercentLabel; wxStaticText* m_stLenPercentLabel;
wxTextCtrl* m_tcLenPercent; wxTextCtrl* m_tcLenPercent;