Skip to content

Commit

Permalink
Added the "Configured" column to the Midi Objects dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg68 committed Feb 28, 2025
1 parent 69623b5 commit 15b8204
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/midi/GOMidiEventPatternList.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
* License GPL-2.0 or later
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
*/
Expand All @@ -23,6 +23,8 @@ template <class MidiType, class MidiEventPattern> class GOMidiEventPatternList {

unsigned GetEventCount() const { return m_events.size(); }

bool IsMidiConfigured() const { return !m_events.empty(); }

const MidiEventPattern &GetEvent(unsigned index) const {
return m_events[index];
}
Expand Down
7 changes: 6 additions & 1 deletion src/grandorgue/gui/dialogs/GOMidiObjectsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ enum {
GRID_COL_TYPE = 0,
GRID_COL_CONTEXT,
GRID_COL_ELEMENT,
GRID_COL_CONFIGURED,
GRID_N_COLS,
};

Expand All @@ -60,16 +61,18 @@ GOMidiObjectsDialog::GOMidiObjectsDialog(
topSizer->AddSpacer(5);

m_ObjectsGrid
= new GOGrid(this, ID_LIST, wxDefaultPosition, wxSize(250, 200));
= new GOGrid(this, ID_LIST, wxDefaultPosition, wxSize(350, 200));
m_ObjectsGrid->CreateGrid(0, GRID_N_COLS, wxGrid::wxGridSelectRows);
m_ObjectsGrid->HideRowLabels();
m_ObjectsGrid->EnableEditing(false);
m_ObjectsGrid->SetColLabelValue(GRID_COL_TYPE, _("Type"));
m_ObjectsGrid->SetColLabelValue(GRID_COL_CONTEXT, _("Context"));
m_ObjectsGrid->SetColLabelValue(GRID_COL_ELEMENT, _("Element"));
m_ObjectsGrid->SetColLabelValue(GRID_COL_CONFIGURED, _("Configured"));
m_ObjectsGrid->SetColSize(GRID_COL_TYPE, 100);
m_ObjectsGrid->SetColSize(GRID_COL_CONTEXT, 150);
m_ObjectsGrid->SetColSize(GRID_COL_ELEMENT, 100);
m_ObjectsGrid->SetColSize(GRID_COL_CONFIGURED, 30);

topSizer->Add(m_ObjectsGrid, 1, wxEXPAND | wxALL, 5);

Expand Down Expand Up @@ -130,6 +133,8 @@ bool GOMidiObjectsDialog::TransferDataToWindow() {
GRID_COL_CONTEXT,
GOMidiObjectContext::getFullTitle(obj->GetContext()));
m_ObjectsGrid->SetCellValue(i, GRID_COL_ELEMENT, obj->GetName());
m_ObjectsGrid->SetCellValue(
i, GRID_COL_CONFIGURED, obj->IsMidiConfigured() ? _("Yes") : _("No"));
}
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/grandorgue/midi/objects/GOMidiObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class GOMidiObject : public GOSoundStateHandler, public GOSaveableObject {

wxString GetContextTitle() const;

virtual bool IsMidiConfigured() const { return false; }

virtual void Init(
GOConfigReader &cfg, const wxString &group, const wxString &name) {
InitMidiObject(cfg, group, name);
Expand Down
7 changes: 7 additions & 0 deletions src/grandorgue/midi/objects/GOMidiObjectWithDivision.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class GOMidiObjectWithDivision : public GOMidiReceivingSendingObject {
void SaveMidiObject(
GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override;

public:
virtual bool IsMidiConfigured() const {
return m_DivisionSender.IsMidiConfigured()
|| GOMidiReceivingSendingObject::IsMidiConfigured();
}

protected:
void SendDivisionMidiKey(unsigned key, unsigned value) {
m_DivisionSender.SetKey(key, value);
}
Expand Down
7 changes: 7 additions & 0 deletions src/grandorgue/midi/objects/GOMidiReceivingSendingObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class GOMidiReceivingSendingObject : public GOMidiSendingObject,
virtual void SaveMidiObject(
GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override;

public:
virtual bool IsMidiConfigured() const {
return m_receiver.IsMidiConfigured()
|| GOMidiSendingObject::IsMidiConfigured();
}

protected:
void PreparePlayback() override;

private:
Expand Down
4 changes: 4 additions & 0 deletions src/grandorgue/midi/objects/GOMidiSendingObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class GOMidiSendingObject : public GOMidiObject {
void SaveMidiObject(
GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override;

virtual bool IsMidiConfigured() const {
return m_sender.IsMidiConfigured() || GOMidiObject::IsMidiConfigured();
}

void SendMidiValue(bool value) { m_sender.SetDisplay(value); }
void SendMidiValue(int value) { m_sender.SetValue(value); }
void SendMidiValue(const wxString &value) { m_sender.SetLabel(value); }
Expand Down

0 comments on commit 15b8204

Please sign in to comment.