Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Fixed sizing of the setting dialog #77
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Samarin committed Aug 28, 2021
1 parent 0b9e4f1 commit d2dd041
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Fixed moving and resizing the setting dialog https://github.com/oleg68/GrandOrgue/issues/77
- Fixed sizing of the setting dialog https://github.com/oleg68/GrandOrgue/issues/77
- `Sample Rate`` and ``Sample Per Buffer`` settings have been moved to the ``Audio Output`` tab
# 0.3.1.2341-13.os (2021-08-24)
- Enabled resizing of the main window https://github.com/oleg68/GrandOrgue/issues/71
Expand Down
18 changes: 18 additions & 0 deletions src/core/GOrgueCheckListBox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef GORGUECHECKLISTBOX_H
#define GORGUECHECKLISTBOX_H

#include <wx/checklst.h>

class GOrgueCheckListBox: public wxCheckListBox
{
public:
GOrgueCheckListBox(wxWindow *parent, wxWindowID id, const wxArrayString & choices):
wxCheckListBox(parent, id, wxDefaultPosition, wxDefaultSize, choices)
{ InvalidateBestSize(); }

protected:
virtual wxSize DoGetBestSize() const override { return GetMinSize(); }
};

#endif /* GORGUECHECKLISTBOX_H */

18 changes: 18 additions & 0 deletions src/grandorgue/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include <iostream>

#include "SettingsDialog.h"

Expand All @@ -45,6 +46,13 @@ BEGIN_EVENT_TABLE(SettingsDialog, wxPropertySheetDialog)
EVT_BUTTON(wxID_HELP, SettingsDialog::OnHelp)
END_EVENT_TABLE()

void printBestSize(const wxString name, wxPanel *pPanel)
{
wxSize bestSize(pPanel->GetBestSize());
std::cout << "SettingsDialog " << name << "->BestSize=" << bestSize.x << "," << bestSize.y << std::endl;
}


SettingsDialog::SettingsDialog(wxWindow* win, GOrgueSound& sound) :
wxPropertySheetDialog(win, wxID_ANY, _("Program Settings"), wxDefaultPosition, wxSize(740,600), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDIALOG_NO_PARENT),
m_Sound(sound)
Expand Down Expand Up @@ -76,6 +84,16 @@ SettingsDialog::SettingsDialog(wxWindow* win, GOrgueSound& sound) :
notebook->AddPage(m_ArchivePage, _("Organ Packages"));

LayoutDialog();
printBestSize("MidiDevicePage", m_MidiDevicePage);
printBestSize("OptionsPage", m_OptionsPage);
printBestSize("OrganPage", m_OrganPage);
printBestSize("ArchivePage", m_ArchivePage);
printBestSize("MidiMessagePage", m_MidiMessagePage);
printBestSize("GroupPage", m_GroupPage);
printBestSize("OutputPage", m_OutputPage);
printBestSize("ReverbPage", m_ReverbPage);
printBestSize("TemperamentsPage", m_TemperamentsPage);
printBestSize("DefaultsPage", m_DefaultsPage);
}

SettingsDialog::~SettingsDialog()
Expand Down
5 changes: 3 additions & 2 deletions src/grandorgue/SettingsMidiDevices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "SettingsMidiDevices.h"

#include "GOrgueCheckListBox.h"
#include "GOrgueMidi.h"
#include "GOrgueSettings.h"
#include "GOrgueSound.h"
Expand Down Expand Up @@ -58,7 +59,7 @@ SettingsMidiDevices::SettingsMidiDevices(GOrgueSound& sound, wxWindow* parent) :

wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* item3 = new wxStaticBoxSizer(wxVERTICAL, this, _("MIDI &input devices"));
m_InDevices = new wxCheckListBox(this, ID_INDEVICES, wxDefaultPosition, wxDefaultSize, choices);
m_InDevices = new GOrgueCheckListBox(this, ID_INDEVICES, choices);
for (unsigned i = 0; i < state.size(); i++)
{
if (state[i])
Expand Down Expand Up @@ -86,7 +87,7 @@ SettingsMidiDevices::SettingsMidiDevices(GOrgueSound& sound, wxWindow* parent) :
}

item3 = new wxStaticBoxSizer(wxVERTICAL, this, _("MIDI &output devices"));
m_OutDevices = new wxCheckListBox(this, ID_OUTDEVICES, wxDefaultPosition, wxDefaultSize, choices);
m_OutDevices = new GOrgueCheckListBox(this, ID_OUTDEVICES, choices);
for (unsigned i = 0; i < out_state.size(); i++)
if (out_state[i])
m_OutDevices->Check(i);
Expand Down

0 comments on commit d2dd041

Please sign in to comment.