Skip to content

Commit

Permalink
Fix ExportOptionsDialog help button
Browse files Browse the repository at this point in the history
The help button now officially works. Also in this commit I simplified
the button layout code :D

Signed-off-by: Avery King <[email protected]>
  • Loading branch information
Avery King committed Dec 26, 2024
1 parent 0b54198 commit 7c33250
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/export/ExportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "../shuttle/ShuttleGui.h"
#include "../theme/AllThemeResources.h"
#include "../theme/Theme.h"
#include "../widgets/HelpSystem.h"

//// ExportOptionsDialog //////////////////////////////////////////////////////

Expand All @@ -32,6 +33,11 @@ ExportOptionsDialog::ExportOptionsDialog(ExportPluginArray& plugins)
mPlugins(plugins),
mBook(nullptr)
{
// Events
Bind(wxEVT_BUTTON, &ExportOptionsDialog::OnOK, this, wxID_OK);
Bind(wxEVT_BUTTON, &ExportOptionsDialog::OnCancel, this, wxID_CANCEL);
Bind(wxEVT_BUTTON, &ExportOptionsDialog::OnHelp, this, wxID_HELP);

Populate();
}

Expand Down Expand Up @@ -62,21 +68,7 @@ void ExportOptionsDialog::Populate()
}
S.EndHorizontalLay();

S.StartHorizontalLay(wxALIGN_RIGHT);
{
auto okButton = S.AddButton(XO("OK"));
auto cancelButton = S.AddButton(XO("Cancel"));
auto helpButton = new wxBitmapButton(S.GetParent(), wxID_HELP, theTheme.Bitmap( bmpHelpIcon ));

okButton->Bind(wxEVT_BUTTON, &ExportOptionsDialog::OnOK, this);
cancelButton->Bind(wxEVT_BUTTON, &ExportOptionsDialog::OnCancel, this);

helpButton->SetToolTip( XO("Help").Translation() );
helpButton->SetLabel(XO("Help").Translation()); // for screen readers
// S.Position(wxALIGN_TOP).AddWindow(helpButton);
S.AddWindow(helpButton);
}
S.EndHorizontalLay();
S.AddStandardButtons(eOkButton | eCancelButton | eHelpButton);
}
S.EndStatic();
}
Expand All @@ -91,6 +83,11 @@ void ExportOptionsDialog::OnCancel(wxCommandEvent&)
EndModal(wxID_CANCEL);
}

void ExportOptionsDialog::OnHelp(wxCommandEvent&)
{
HelpSystem::ShowHelp(this, L"Importing_and_Exporting", true);
}

void ExportOptionsDialog::SetIndex(int index)
{
mIndex = index;
Expand Down
1 change: 1 addition & 0 deletions src/export/ExportDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ExportOptionsDialog final : public wxDialogWrapper

void OnOK(wxCommandEvent&);
void OnCancel(wxCommandEvent&);
void OnHelp(wxCommandEvent&);

public:
ExportOptionsDialog(ExportPluginArray& plugins);
Expand Down

0 comments on commit 7c33250

Please sign in to comment.