Skip to content

Commit f7f5e6e

Browse files
authored
Renamed ChurchName to OrganName and moved from GOOrganController to GOOrganModel (#2119)
1 parent a18e1bb commit f7f5e6e

9 files changed

+31
-31
lines changed

src/grandorgue/GODocument.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool GODocument::LoadOrgan(
7676
}
7777

7878
wxCommandEvent event(wxEVT_WINTITLE, 0);
79-
event.SetString(m_OrganController->GetChurchName());
79+
event.SetString(m_OrganController->GetOrganName());
8080
wxTheApp->GetTopWindow()->GetEventHandler()->AddPendingEvent(event);
8181

8282
for (unsigned i = 0; i < m_OrganController->GetPanelCount(); i++)

src/grandorgue/GOOrganController.cpp

+17-19
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ GOOrganController::GOOrganController(
106106
m_b_customized(false),
107107
m_CurrentPitch(999999.0), // for enforcing updating the label first time
108108
m_OrganModified(false),
109-
m_ChurchName(),
110109
m_ChurchAddress(),
111110
m_OrganBuilder(),
112111
m_OrganBuildDate(),
@@ -209,7 +208,6 @@ void GOOrganController::ReadOrganFile(GOConfigReader &cfg) {
209208
/* load church info */
210209
cfg.ReadString(
211210
ODFSetting, WX_ORGAN, wxT("HauptwerkOrganFileFormatVersion"), false);
212-
m_ChurchName = cfg.ReadStringTrim(ODFSetting, WX_ORGAN, wxT("ChurchName"));
213211
m_ChurchAddress = cfg.ReadString(ODFSetting, WX_ORGAN, wxT("ChurchAddress"));
214212
m_OrganBuilder
215213
= cfg.ReadString(ODFSetting, WX_ORGAN, wxT("OrganBuilder"), false);
@@ -325,12 +323,16 @@ void GOOrganController::ReadOrganFile(GOConfigReader &cfg) {
325323
for (unsigned i = 0; i < m_panels.size(); i++)
326324
m_panels[i]->Layout();
327325

328-
GetRootPipeConfigNode().SetName(GetChurchName());
326+
const wxString &organName = GetOrganName();
327+
328+
GetRootPipeConfigNode().SetName(organName);
329329
ReadCombinations(cfg);
330330
m_setter->OnCombinationsLoaded(GetCombinationsDir(), wxEmptyString);
331331

332332
GOHash hash;
333-
hash.Update(m_ChurchName.utf8_str(), strlen(m_ChurchName.utf8_str()));
333+
const auto organNameUtf8 = organName.utf8_str();
334+
335+
hash.Update(organNameUtf8, strlen(organNameUtf8));
334336
GOHashType result = hash.getHash();
335337
m_SampleSetId1 = ((result.hash[0] & 0x7F) << 24)
336338
| ((result.hash[1] & 0x7F) << 16) | ((result.hash[2] & 0x7F) << 8)
@@ -340,8 +342,6 @@ void GOOrganController::ReadOrganFile(GOConfigReader &cfg) {
340342
| (result.hash[7] & 0x7F);
341343
}
342344

343-
wxString GOOrganController::GetOrganHash() { return m_hash; }
344-
345345
wxString GOOrganController::GenerateSettingFileName() {
346346
return m_config.OrganSettingsPath() + wxFileName::GetPathSeparator()
347347
+ GOStdFileName::composeSettingFileName(GetOrganHash(), m_config.Preset());
@@ -643,7 +643,7 @@ wxString GOOrganController::ExportCombination(const wxString &fileName) {
643643
YAML::Node infoNode = globalNode[INFO];
644644

645645
infoNode[CONTENT_TYPE] = WX_GRANDORGUE_COMBINATIONS;
646-
infoNode[ORGAN_NAME] = m_ChurchName;
646+
infoNode[ORGAN_NAME] = GetOrganName();
647647
infoNode[GRANDORGUE_VERSION] = APP_VERSION;
648648
infoNode[SAVED_TIME] = wxDateTime::Now().Format();
649649

@@ -668,29 +668,29 @@ wxString GOOrganController::ExportCombination(const wxString &fileName) {
668668
}
669669

670670
/**
671-
* Check the churchName of the imported combination file. If it differs from the
672-
* current organ m_ChurchName then ask for the user
673-
* @param churchName the organ the combination file was saved of
671+
* Check the organName of the imported combination file. If it differs from the
672+
* current organ name then ask for the user
673+
* @param organName the organ the combination file was saved of
674674
* @return true if the churchNames are the same or the user agree with importing
675675
* the combination file
676676
*/
677677
bool GOOrganController::IsToImportCombinationsFor(
678-
const wxString &fileName, const wxString &churchName) const {
678+
const wxString &fileName, const wxString &organName) const {
679679
bool isToImport = true;
680680

681-
if (churchName != m_ChurchName) {
681+
if (organName != GetOrganName()) {
682682
wxLogWarning(
683683
_("This combination file '%s' was originally made for another organ "
684684
"'%s'"),
685685
fileName,
686-
churchName);
686+
organName);
687687
isToImport = wxMessageBox(
688688
wxString::Format(
689689
_("This combination file '%s' was originally made for "
690690
"another organ '%s'. Importing it can cause various "
691691
"problems. Should it really be imported?"),
692692
fileName,
693-
churchName),
693+
organName),
694694
_("Import Combinations"),
695695
wxYES_NO,
696696
NULL)
@@ -866,7 +866,7 @@ bool GOOrganController::Export(const wxString &cmb) {
866866

867867
m_b_customized = true;
868868
cfg.WriteString(WX_ORGAN, wxT("ODFHash"), m_ODFHash);
869-
cfg.WriteString(WX_ORGAN, wxT("ChurchName"), m_ChurchName);
869+
cfg.WriteString(WX_ORGAN, wxT("ChurchName"), GetOrganName());
870870
cfg.WriteString(WX_ORGAN, wxT("ChurchAddress"), m_ChurchAddress);
871871
cfg.WriteString(WX_ORGAN, wxT("ODFPath"), GetODFFilename());
872872
if (m_ArchiveID != wxEmptyString)
@@ -943,8 +943,6 @@ void GOOrganController::AddPanel(GOGUIPanel *panel) {
943943
m_panels.push_back(panel);
944944
}
945945

946-
const wxString &GOOrganController::GetChurchName() { return m_ChurchName; }
947-
948946
const wxString &GOOrganController::GetChurchAddress() {
949947
return m_ChurchAddress;
950948
}
@@ -987,7 +985,7 @@ GOOrgan GOOrganController::GetOrganInfo() {
987985
GetODFFilename(),
988986
m_ArchiveID,
989987
m_ArchivePath,
990-
GetChurchName(),
988+
GetOrganName(),
991989
GetOrganBuilder(),
992990
GetRecordingDetails());
993991
}
@@ -999,7 +997,7 @@ const wxString GOOrganController::GetSettingFilename() {
999997
const wxString GOOrganController::GetCacheFilename() { return m_CacheFilename; }
1000998

1001999
wxString GOOrganController::GetCombinationsDir() const {
1002-
return wxFileName(m_config.OrganCombinationsPath(), m_ChurchName)
1000+
return wxFileName(m_config.OrganCombinationsPath(), GetOrganName())
10031001
.GetFullPath();
10041002
}
10051003

src/grandorgue/GOOrganController.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -82,7 +82,6 @@ class GOOrganController : public GOEventDistributor,
8282
float m_CurrentPitch; // organ pitch
8383
bool m_OrganModified; // always m_IsOrganModified >= IsModelModified()
8484

85-
wxString m_ChurchName;
8685
wxString m_ChurchAddress;
8786
wxString m_OrganBuilder;
8887
wxString m_OrganBuildDate;
@@ -121,7 +120,7 @@ class GOOrganController : public GOEventDistributor,
121120
void SetTemperament(const GOTemperament &temperament);
122121
void PreconfigRecorder();
123122

124-
wxString GetOrganHash();
123+
const wxString &GetOrganHash() const { return m_hash; }
125124
bool IsToImportCombinationsFor(
126125
const wxString &fileName, const wxString &churchName) const;
127126

@@ -226,7 +225,6 @@ class GOOrganController : public GOEventDistributor,
226225
wxString GetCombinationsDir() const;
227226

228227
/* Organ and Building general information */
229-
const wxString &GetChurchName();
230228
const wxString &GetChurchAddress();
231229
const wxString &GetOrganBuilder();
232230
const wxString &GetOrganBuildDate();

src/grandorgue/combinations/GOSetter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ void GOSetter::PreparePlayback() {
985985
buffer.Printf(wxT("%03d"), m_pos);
986986
m_PosDisplay.SetContent(buffer);
987987

988-
m_NameDisplay.SetContent(m_OrganController->GetChurchName());
988+
m_NameDisplay.SetContent(m_OrganController->GetOrganName());
989989

990990
wxCommandEvent event(wxEVT_SETVALUE, ID_METER_FRAME_SPIN);
991991
event.SetInt(m_pos);

src/grandorgue/gui/dialogs/GOPropertiesDialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -75,7 +75,7 @@ GOPropertiesDialog::GOPropertiesDialog(
7575

7676
sizer->Add(GOPropertiesText(this, 0, _("Title")), 0);
7777
sizer->Add(
78-
GOPropertiesText(this, 300, m_OrganController->GetChurchName()),
78+
GOPropertiesText(this, 300, m_OrganController->GetOrganName()),
7979
0,
8080
wxLEFT,
8181
10);

src/grandorgue/gui/panels/GOGUIPanel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -151,7 +151,7 @@ void GOGUIPanel::Load(GOConfigReader &cfg, const wxString &group) {
151151
new_format = true;
152152

153153
if (cfgGroup.IsEmpty()) {
154-
m_Name = m_OrganController->GetChurchName();
154+
m_Name = m_OrganController->GetOrganName();
155155
m_GroupName = wxT("");
156156
cfgGroup = wxT("Organ");
157157
if (new_format) {

src/grandorgue/midi/GOMidiRecorder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ void GOMidiRecorder::StartRecording(bool rename) {
351351
Write(&h, sizeof(h));
352352
Write(&t, sizeof(t));
353353

354-
wxString s = m_OrganController->GetChurchName();
354+
wxString s = m_OrganController->GetOrganName();
355355
wxCharBuffer b = s.ToAscii();
356356
unsigned len = s.length();
357357
unsigned char th[] = {0x00, 0xFF, 0x04};

src/grandorgue/model/GOOrganModel.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ unsigned GOOrganModel::GetRecorderElementID(const wxString &name) {
4747
static const wxString WX_ORGAN = wxT("Organ");
4848

4949
void GOOrganModel::Load(GOConfigReader &cfg) {
50+
m_OrganName = cfg.ReadStringTrim(ODFSetting, WX_ORGAN, wxT("ChurchName"));
5051
m_DivisionalsStoreIntermanualCouplers = cfg.ReadBoolean(
5152
ODFSetting, WX_ORGAN, wxT("DivisionalsStoreIntermanualCouplers"));
5253
m_DivisionalsStoreIntramanualCouplers = cfg.ReadBoolean(

src/grandorgue/model/GOOrganModel.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2006 Milan Digital Audio LLC
3-
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
3+
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
44
* License GPL-2.0 or later
55
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
66
*/
@@ -47,6 +47,7 @@ class GOOrganModel : private GOCombinationButtonSet,
4747
GOModificationProxy m_ModificationProxy;
4848
GOCombinationDefinition m_GeneralTemplate;
4949

50+
wxString m_OrganName;
5051
bool m_DivisionalsStoreIntermanualCouplers;
5152
bool m_DivisionalsStoreIntramanualCouplers;
5253
bool m_DivisionalsStoreTremulants;
@@ -106,6 +107,8 @@ class GOOrganModel : private GOCombinationButtonSet,
106107
const GOConfig &GetConfig() const { return m_config; }
107108
GOConfig &GetConfig() { return m_config; }
108109

110+
const wxString &GetOrganName() const { return m_OrganName; }
111+
109112
unsigned GetRecorderElementID(const wxString &name);
110113

111114
const GOCombinationDefinition &GetGeneralTemplate() const {

0 commit comments

Comments
 (0)