void GOrgueSoundingPipe::LoadAttack(GOrgueConfigReader& cfg, wxString group, wxString prefix) { attack_load_info ainfo; ainfo.filename.Assign(cfg.ReadStringTrim(ODFSetting, group, prefix), m_organfile); ainfo.sample_group = cfg.ReadInteger(ODFSetting, group, prefix + wxT("IsTremulant"), -1, 1, false, -1); ainfo.load_release = cfg.ReadBoolean(ODFSetting, group, prefix + wxT("LoadRelease"), false, !m_Percussive);; ainfo.percussive = m_Percussive; ainfo.max_playback_time = cfg.ReadInteger(ODFSetting, group, prefix + wxT("MaxKeyPressTime"), -1, 100000, false, -1); ainfo.cue_point = cfg.ReadInteger(ODFSetting, group, prefix + wxT("CuePoint"), -1, MAX_SAMPLE_LENGTH, false, -1); ainfo.min_attack_velocity = cfg.ReadInteger(ODFSetting, group, prefix + wxT("AttackVelocity"), 0, 127, false, 0); ainfo.max_released_time = cfg.ReadInteger(ODFSetting, group, prefix + wxT("MaxTimeSinceLastRelease"), -1, 100000, false, -1); ainfo.attack_start = cfg.ReadInteger(ODFSetting, group, prefix + wxT("AttackStart"), 0, MAX_SAMPLE_LENGTH, false, 0); ainfo.release_end = cfg.ReadInteger(ODFSetting, group, prefix + wxT("ReleaseEnd"), -1, MAX_SAMPLE_LENGTH, false, -1); unsigned loop_cnt = cfg.ReadInteger(ODFSetting, group, prefix + wxT("LoopCount"), 0, 100, false, 0); for(unsigned j = 0; j < loop_cnt; j++) { loop_load_info linfo; linfo.loop_start = cfg.ReadInteger(ODFSetting, group, prefix + wxString::Format(wxT("Loop%03dStart"), j + 1), 0, MAX_SAMPLE_LENGTH, false, 0); linfo.loop_end = cfg.ReadInteger(ODFSetting, group, prefix + wxString::Format(wxT("Loop%03dEnd"), j + 1), linfo.loop_start + 1, MAX_SAMPLE_LENGTH, true); ainfo.loops.push_back(linfo); } m_AttackInfo.push_back(ainfo); }
void GOrgueEnclosure::Load(GOrgueConfigReader& cfg, wxString group, int enclosure_nb) { m_organfile->RegisterSaveableObject(this); m_group = group; m_Name = cfg.ReadStringNotEmpty(ODFSetting, m_group, wxT("Name")); m_Displayed1 = cfg.ReadBoolean(ODFSetting, m_group, wxT("Displayed"), false, true); m_Displayed2 = cfg.ReadBoolean(ODFSetting, m_group, wxT("Displayed"), false, false); m_AmpMinimumLevel = cfg.ReadInteger(ODFSetting, m_group, wxT("AmpMinimumLevel"), 0, 100); m_MIDIInputNumber = cfg.ReadInteger(ODFSetting, m_group, wxT("MIDIInputNumber"), 0, 200, false, 0); Set(cfg.ReadInteger(CMBSetting, m_group, wxT("Value"), 0, 127, false, 127)); m_midi.SetIndex(enclosure_nb); m_midi.Load(cfg, m_group, m_organfile->GetSettings().GetMidiMap()); m_sender.Load(cfg, m_group, m_organfile->GetSettings().GetMidiMap()); m_shortcut.Load(cfg, m_group); }
void GOrgueDivisionalCoupler::Load(GOrgueConfigReader& cfg, wxString group) { wxString buffer; m_BiDirectionalCoupling=cfg.ReadBoolean(ODFSetting, group,wxT("BiDirectionalCoupling")); unsigned NumberOfManuals=cfg.ReadInteger(ODFSetting, group,wxT("NumberOfManuals"), 1, m_organfile->GetManualAndPedalCount() - m_organfile->GetFirstManualIndex() + 1); m_manuals.resize(0); for (unsigned i = 0; i < NumberOfManuals; i++) { buffer.Printf(wxT("Manual%03d"), i + 1); m_manuals.push_back(cfg.ReadInteger(ODFSetting, group, buffer, m_organfile->GetFirstManualIndex(), m_organfile->GetManualAndPedalCount())); } GOrgueDrawstop::Load(cfg, group); }
void GOrgueTremulant::Load(GOrgueConfigReader& cfg, wxString group, int sampler_group_id) { m_TremulantType = (GOrgueTremulantType)cfg.ReadEnum(ODFSetting, group, wxT("TremulantType"), m_tremulant_types, sizeof(m_tremulant_types) / sizeof(m_tremulant_types[0]), false, GOSynthTrem); if (m_TremulantType == GOSynthTrem) { m_TremProvider = new GOSoundProviderSynthedTrem(m_organfile->GetMemoryPool()), m_Period = cfg.ReadLong(ODFSetting, group, wxT("Period"), 32, 441000); m_StartRate = cfg.ReadInteger(ODFSetting, group, wxT("StartRate"), 1, 100); m_StopRate = cfg.ReadInteger(ODFSetting, group, wxT("StopRate"), 1, 100); m_AmpModDepth = cfg.ReadInteger(ODFSetting, group, wxT("AmpModDepth"), 1, 100); m_SamplerGroupID = sampler_group_id; m_PlaybackHandle = 0; } GOrgueDrawstop::Load(cfg, group); m_organfile->RegisterCacheObject(this); }
void GOrguePipeConfig::Load(GOrgueConfigReader& cfg, wxString group, wxString prefix) { m_Group = group; m_NamePrefix = prefix; m_AudioGroup = cfg.ReadString(CMBSetting, group, prefix + wxT("AudioGroup"), false); m_DefaultAmplitude = cfg.ReadFloat(ODFSetting, group, prefix + wxT("AmplitudeLevel"), 0, 1000, false, 100); m_Amplitude = cfg.ReadFloat(CMBSetting, group, prefix + wxT("Amplitude"), 0, 1000, false, m_DefaultAmplitude); m_DefaultGain = cfg.ReadFloat(ODFSetting, group, prefix + wxT("Gain"), -120, 40, false, 0); m_Gain = cfg.ReadFloat(CMBSetting, group, prefix + wxT("UserGain"), -120, 40, false, m_DefaultGain); m_DefaultTuning = cfg.ReadFloat(ODFSetting, group, prefix + wxT("PitchTuning"), -1200, 1200, false, 0); m_Tuning = cfg.ReadFloat(CMBSetting, group, prefix + wxT("Tuning"), -1200, 1200, false, m_DefaultTuning); m_DefaultDelay = cfg.ReadInteger(ODFSetting, group, prefix + wxT("TrackerDelay"), 0, 10000, false, 0); m_Delay = cfg.ReadInteger(CMBSetting, group, prefix + wxT("Delay"), 0, 10000, false, m_DefaultDelay); m_BitsPerSample = cfg.ReadInteger(CMBSetting, m_Group, m_NamePrefix + wxT("BitsPerSample"), -1, 24, false, -1); if (m_BitsPerSample != 8 && m_BitsPerSample != 12 && m_BitsPerSample != 16 && m_BitsPerSample != 20 && m_BitsPerSample != 24) m_BitsPerSample = -1; m_Compress = cfg.ReadInteger(CMBSetting, m_Group, m_NamePrefix + wxT("Compress"), -1, 1, false, -1); m_Channels = cfg.ReadInteger(CMBSetting, m_Group, m_NamePrefix + wxT("Channels"), -1, 2, false, -1); m_LoopLoad = cfg.ReadInteger(CMBSetting, m_Group, m_NamePrefix + wxT("LoopLoad"), -1, 2, false, -1); m_AttackLoad = cfg.ReadInteger(CMBSetting, m_Group, m_NamePrefix + wxT("AttackLoad"), -1, 1, false, -1); m_ReleaseLoad = cfg.ReadInteger(CMBSetting, m_Group, m_NamePrefix + wxT("ReleaseLoad"), -1, 1, false, -1); m_Callback->UpdateAmplitude(); m_Callback->UpdateTuning(); m_Callback->UpdateAudioGroup(); }
void GOrgueEnclosure::Init(GOrgueConfigReader& cfg, wxString group, wxString Name, unsigned def_value) { m_organfile->RegisterSaveableObject(this); m_group = group; m_Name = Name; Set(cfg.ReadInteger(CMBSetting, m_group, wxT("Value"), 0, 127, false, def_value)); m_midi.Load(cfg, m_group, m_organfile->GetSettings().GetMidiMap()); m_sender.Load(cfg, m_group, m_organfile->GetSettings().GetMidiMap()); m_shortcut.Load(cfg, m_group); m_AmpMinimumLevel = 1; }
void GOrgueSoundingPipe::Load(GOrgueConfigReader& cfg, wxString group, wxString prefix) { m_organfile->RegisterCacheObject(this); m_Filename = cfg.ReadStringTrim(ODFSetting, group, prefix); m_PipeConfig.Load(cfg, group, prefix); m_HarmonicNumber = cfg.ReadInteger(ODFSetting, group, prefix + wxT("HarmonicNumber"), 1, 1024, false, m_HarmonicNumber); m_PitchCorrection = cfg.ReadFloat(ODFSetting, group, prefix + wxT("PitchCorrection"), -1200, 1200, false, m_PitchCorrection); m_SamplerGroupID = cfg.ReadInteger(ODFSetting, group, prefix + wxT("WindchestGroup"), 1, m_organfile->GetWindchestGroupCount(), false, m_SamplerGroupID); m_Percussive = cfg.ReadBoolean(ODFSetting, group, prefix + wxT("Percussive"), false, m_Percussive); m_SampleMidiKeyNumber = cfg.ReadInteger(ODFSetting, group, prefix + wxT("MIDIKeyNumber"), -1, 127, false, -1); m_LoopCrossfadeLength = cfg.ReadInteger(ODFSetting, group, prefix + wxT("LoopCrossfadeLength"), 0, 120, false, 0); m_ReleaseCrossfadeLength = cfg.ReadInteger(ODFSetting, group, prefix + wxT("ReleaseCrossfadeLength"), 0, 200, false, 0); m_RetunePipe = cfg.ReadBoolean(ODFSetting, group, prefix + wxT("AcceptsRetuning"), false, m_RetunePipe); UpdateAmplitude(); m_organfile->GetWindchest(m_SamplerGroupID - 1)->AddPipe(this); LoadAttack(cfg, group, prefix); unsigned attack_count = cfg.ReadInteger(ODFSetting, group, prefix + wxT("AttackCount"), 0, 100, false, 0); for(unsigned i = 0; i < attack_count; i++) LoadAttack(cfg, group, prefix + wxString::Format(wxT("Attack%03d"), i + 1)); unsigned release_count = cfg.ReadInteger(ODFSetting, group, prefix + wxT("ReleaseCount"), 0, 100, false, 0); for(unsigned i = 0; i < release_count; i++) { release_load_info rinfo; wxString p = prefix + wxString::Format(wxT("Release%03d"), i + 1); rinfo.filename.Assign(cfg.ReadStringTrim(ODFSetting, group, p), m_organfile); rinfo.sample_group = cfg.ReadInteger(ODFSetting, group, p + wxT("IsTremulant"), -1, 1, false, -1); rinfo.max_playback_time = cfg.ReadInteger(ODFSetting, group, p + wxT("MaxKeyPressTime"), -1, 100000, false, -1); rinfo.cue_point = cfg.ReadInteger(ODFSetting, group, p + wxT("CuePoint"), -1, MAX_SAMPLE_LENGTH, false, -1); rinfo.release_end = cfg.ReadInteger(ODFSetting, group, p + wxT("ReleaseEnd"), -1, MAX_SAMPLE_LENGTH, false, -1); m_ReleaseInfo.push_back(rinfo); } m_MinVolume = cfg.ReadFloat(ODFSetting, group, wxT("MinVelocityVolume"), 0, 1000, false, m_MinVolume); m_MaxVolume = cfg.ReadFloat(ODFSetting, group, wxT("MaxVelocityVolume"), 0, 1000, false, m_MaxVolume); m_SoundProvider.SetVelocityParameter(m_MinVolume, m_MaxVolume); m_PipeConfig.SetName(wxString::Format(_("%d: %s"), m_MidiKeyNumber, m_Filename.c_str())); }
void GOrgueDivisional::Load(GOrgueConfigReader& cfg, wxString group, int manualNumber, int divisionalNumber) { m_DivisionalNumber = divisionalNumber; m_ManualNumber = manualNumber; m_midi.SetIndex(manualNumber); m_Protected = cfg.ReadBoolean(ODFSetting, group, wxT("Protected"), false, false); GOrguePushbutton::Load(cfg, group); if (!m_IsSetter) { /* skip ODF settings */ UpdateState(); wxString buffer; int pos; std::vector<bool> used(m_State.size()); GOrgueManual* associatedManual = m_organfile->GetManual(m_ManualNumber); unsigned NumberOfStops = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfStops"), 0, associatedManual->GetStopCount(), true, 0); unsigned NumberOfCouplers = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfCouplers"), 0, associatedManual->GetCouplerCount(), m_organfile->DivisionalsStoreIntermanualCouplers() || m_organfile->DivisionalsStoreIntramanualCouplers(), 0); unsigned NumberOfTremulants = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfTremulants"), 0, m_organfile->GetTremulantCount(), m_organfile->DivisionalsStoreTremulants(), 0); unsigned NumberOfSwitches = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfSwitches"), 0, m_organfile->GetSwitchCount(), false, 0); for (unsigned i = 0; i < NumberOfStops; i++) { buffer.Printf(wxT("Stop%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -associatedManual->GetStopCount(), associatedManual->GetStopCount()); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_STOP, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfCouplers; i++) { buffer.Printf(wxT("Coupler%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -999, 999); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_COUPLER, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfTremulants; i++) { buffer.Printf(wxT("Tremulant%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -999, 999, false, 0); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_TREMULANT, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfSwitches; i++) { buffer.Printf(wxT("Switch%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -999, 999, false, 0); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_SWITCH, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } } }
void GOrgueDivisional::LoadCombination(GOrgueConfigReader& cfg) { GOSettingType type = CMBSetting; if (!m_IsSetter) if (cfg.ReadInteger(CMBSetting, m_group, wxT("NumberOfStops"), -1, 999, false, -1) == -1) type = ODFSetting; wxString buffer; GOrgueManual* associatedManual = m_organfile->GetManual(m_ManualNumber); unsigned NumberOfStops = cfg.ReadInteger(type, m_group, wxT("NumberOfStops"), 0, associatedManual->GetStopCount(), true, 0); unsigned NumberOfCouplers = cfg.ReadInteger(type, m_group, wxT("NumberOfCouplers"), 0, associatedManual->GetCouplerCount(), m_organfile->DivisionalsStoreIntermanualCouplers() || m_organfile->DivisionalsStoreIntramanualCouplers(), 0); unsigned NumberOfTremulants = cfg.ReadInteger(type, m_group, wxT("NumberOfTremulants"), 0, m_organfile->GetTremulantCount(), m_organfile->DivisionalsStoreTremulants(), 0); unsigned NumberOfSwitches = cfg.ReadInteger(type, m_group, wxT("NumberOfSwitches"), 0, m_organfile->GetSwitchCount(), false, 0); int pos; Clear(); for (unsigned i = 0; i < NumberOfStops; i++) { buffer.Printf(wxT("Stop%03d"), i + 1); int s = cfg.ReadInteger(type, m_group, buffer, -associatedManual->GetStopCount(), associatedManual->GetStopCount()); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_STOP, m_ManualNumber, abs(s)); if (pos >= 0) { if (m_State[pos] != -1) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } m_State[pos] = (s > 0) ? 1 : 0; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfCouplers; i++) { buffer.Printf(wxT("Coupler%03d"), i + 1); int s = cfg.ReadInteger(type, m_group, buffer, -999, 999); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_COUPLER, m_ManualNumber, abs(s)); if (pos >= 0) { if (m_State[pos] != -1) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } m_State[pos] = (s > 0) ? 1 : 0; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfTremulants; i++) { buffer.Printf(wxT("Tremulant%03d"), i + 1); int s = cfg.ReadInteger(type, m_group, buffer, -999, 999, false, 0); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_TREMULANT, m_ManualNumber, abs(s)); if (pos >= 0) { if (m_State[pos] != -1) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } m_State[pos] = (s > 0) ? 1 : 0; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfSwitches; i++) { buffer.Printf(wxT("Switch%03d"), i + 1); int s = cfg.ReadInteger(type, m_group, buffer, -999, 999, false, 0); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_SWITCH, m_ManualNumber, abs(s)); if (pos >= 0) { if (m_State[pos] != -1) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } m_State[pos] = (s > 0) ? 1 : 0; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } }
void GOGUIEnclosure::Load(GOrgueConfigReader& cfg, wxString group) { GOGUIControl::Load(cfg, group); unsigned bitmap_count = cfg.ReadInteger(ODFSetting, group, wxT("BitmapCount"), 1, 127, false, 16); wxChar style = wxT('A') + cfg.ReadInteger(ODFSetting, group, wxT("EnclosureStyle"), 1, 4, false, 1) - 1; for(unsigned i = 1; i <= bitmap_count; i++) { wxString bitmap = cfg.ReadStringTrim(ODFSetting, group, wxString::Format(wxT("Bitmap%03d"), i), false, wxString::Format(wxT("GO:enclosure%c%02d"), style, i - 1)); wxString mask = cfg.ReadStringTrim(ODFSetting, group, wxString::Format(wxT("Mask%03d"), i), false, wxEmptyString); m_Bitmaps.push_back(m_panel->LoadBitmap(bitmap, mask)); } for(unsigned i = 1; i < m_Bitmaps.size(); i++) if (m_Bitmaps[0].GetWidth() != m_Bitmaps[i].GetWidth() || m_Bitmaps[0].GetHeight() != m_Bitmaps[i].GetHeight()) throw wxString::Format(_("bitmap size does not match for '%s'"), group.c_str()); int x, y, w, h; x = cfg.ReadInteger(ODFSetting, group, wxT("PositionX"), 0, m_metrics->GetScreenWidth(), false, -1); y = cfg.ReadInteger(ODFSetting, group, wxT("PositionY"), 0, m_metrics->GetScreenHeight(), false, -1); w = cfg.ReadInteger(ODFSetting, group, wxT("Width"), 1, m_metrics->GetScreenWidth(), false, m_Bitmaps[0].GetWidth()); h = cfg.ReadInteger(ODFSetting, group, wxT("Height"), 1, m_metrics->GetScreenHeight(), false, m_Bitmaps[0].GetHeight()); m_BoundingRect = wxRect(x, y, w, h); m_TileOffsetX = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetX"), 0, m_Bitmaps[0].GetWidth() - 1, false, 0); m_TileOffsetY = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetY"), 0, m_Bitmaps[0].GetHeight() - 1, false, 0); m_TextColor = cfg.ReadColor(ODFSetting, group, wxT("DispLabelColour"), false, wxT("White")); m_FontSize = cfg.ReadFontSize(ODFSetting, group, wxT("DispLabelFontSize"), false, wxT("7")); m_FontName = cfg.ReadStringTrim(ODFSetting, group, wxT("DispLabelFontName"), false, wxT("")); m_Text = cfg.ReadString(ODFSetting, group, wxT("DispLabelText"), false, m_enclosure->GetName()); x = cfg.ReadInteger(ODFSetting, group, wxT("TextRectLeft"), 0, m_BoundingRect.GetWidth() - 1, false, 0); y = cfg.ReadInteger(ODFSetting, group, wxT("TextRectTop"), 0, m_BoundingRect.GetHeight() - 1, false, 0); w = cfg.ReadInteger(ODFSetting, group, wxT("TextRectWidth"), 1, m_BoundingRect.GetWidth() - x, false, m_BoundingRect.GetWidth() - x); h = cfg.ReadInteger(ODFSetting, group, wxT("TextRectHeight"), 1, m_BoundingRect.GetHeight() - y, false, m_BoundingRect.GetHeight() - y); m_TextRect = wxRect(x, y, w, h); m_TextWidth = cfg.ReadInteger(ODFSetting, group, wxT("TextBreakWidth"), 0, m_TextRect.GetWidth(), false, m_TextRect.GetWidth()); x = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectLeft"), 0, m_BoundingRect.GetWidth() - 1, false, 0); y = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectTop"), 0, m_BoundingRect.GetHeight() - 1, false, 13); w = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectWidth"), 1, m_BoundingRect.GetWidth() - x, false, m_BoundingRect.GetWidth() - x); h = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectHeight"), 1, m_BoundingRect.GetHeight() - y, false, m_BoundingRect.GetHeight() - y - 3); m_MouseRect = wxRect(x, y, w, h); m_MouseAxisStart = cfg.ReadInteger(ODFSetting, group, wxT("MouseAxisStart"), 0, m_MouseRect.GetHeight(), false, m_MouseRect.GetHeight() / 3); m_MouseAxisEnd = cfg.ReadInteger(ODFSetting, group, wxT("MouseAxisEnd"), m_MouseAxisStart, m_MouseRect.GetHeight(), false, m_MouseRect.GetHeight() / 3 * 2); m_Font.SetName(m_FontName); m_Font.SetPoints(m_FontSize); }
void GOrgueSettingNumber<T>::Load(GOrgueConfigReader& cfg) { (*this)(cfg.ReadInteger(CMBSetting, m_Group, m_Name, m_MinValue, m_MaxValue, false, m_DefaultValue)); }
void GOGUIButton::Load(GOrgueConfigReader& cfg, wxString group) { GOGUIControl::Load(cfg, group); m_IsPiston = cfg.ReadBoolean(ODFSetting, group, wxT("DisplayAsPiston"), false, m_IsPiston); m_TextColor = cfg.ReadColor(ODFSetting, group, wxT("DispLabelColour"), false, wxT("Dark Red")); m_FontSize = cfg.ReadFontSize(ODFSetting, group, wxT("DispLabelFontSize"), false, wxT("normal")); m_FontName = cfg.ReadStringTrim(ODFSetting, group, wxT("DispLabelFontName"), false, wxT("")); m_Text = cfg.ReadString(ODFSetting, group, wxT("DispLabelText"), false, m_Button->GetName()); int x, y, w, h; m_DispKeyLabelOnLeft = cfg.ReadBoolean(ODFSetting, group, wxT("DispKeyLabelOnLeft"), false, true); wxString off_mask_file, on_mask_file; wxString on_file, off_file; if (m_IsPiston) { int DispImageNum = cfg.ReadInteger(ODFSetting, group, wxT("DispImageNum"), 1, 5, false, m_Button->IsReadOnly() ? 3 : 1); off_file = wxString::Format(wxT("GO:piston%02d_off"), DispImageNum); on_file = wxString::Format(wxT("GO:piston%02d_on"), DispImageNum); m_DispRow = cfg.ReadInteger(ODFSetting, group, wxT("DispButtonRow"), 0, 99 + m_metrics->NumberOfExtraButtonRows(), false, 1); m_DispCol = cfg.ReadInteger(ODFSetting, group, wxT("DispButtonCol"), 1, m_metrics->NumberOfButtonCols(), false, 1); } else { int DispImageNum = cfg.ReadInteger(ODFSetting, group, wxT("DispImageNum"), 1, 6, false, m_Button->IsReadOnly() ? 4 : 1); off_file = wxString::Format(wxT("GO:drawstop%02d_off"), DispImageNum); on_file = wxString::Format(wxT("GO:drawstop%02d_on"), DispImageNum); m_DispRow = cfg.ReadInteger(ODFSetting, group, wxT("DispDrawstopRow"), 1, 99 + m_metrics->NumberOfExtraDrawstopRowsToDisplay(), false, 1); m_DispCol = cfg.ReadInteger(ODFSetting, group, wxT("DispDrawstopCol"), 1, m_DispRow > 99 ? m_metrics->NumberOfExtraDrawstopColsToDisplay() : m_metrics->NumberOfDrawstopColsToDisplay(), false, 1); } on_file = cfg.ReadStringTrim(ODFSetting, group, wxT("ImageOn"), false, on_file); off_file = cfg.ReadStringTrim(ODFSetting, group, wxT("ImageOff"), false, off_file); on_mask_file = cfg.ReadStringTrim(ODFSetting, group, wxT("MaskOn"), false, wxEmptyString); off_mask_file = cfg.ReadStringTrim(ODFSetting, group, wxT("MaskOff"), false, on_mask_file); m_OnBitmap = m_panel->LoadBitmap(on_file, on_mask_file); m_OffBitmap = m_panel->LoadBitmap(off_file, off_mask_file); x = cfg.ReadInteger(ODFSetting, group, wxT("PositionX"), 0, m_metrics->GetScreenWidth(), false, -1); y = cfg.ReadInteger(ODFSetting, group, wxT("PositionY"), 0, m_metrics->GetScreenHeight(), false, -1); w = cfg.ReadInteger(ODFSetting, group, wxT("Width"), 1, m_metrics->GetScreenWidth(), false, m_OnBitmap.GetWidth()); h = cfg.ReadInteger(ODFSetting, group, wxT("Height"), 1, m_metrics->GetScreenHeight(), false, m_OnBitmap.GetHeight()); m_BoundingRect = wxRect(x, y, w, h); if (m_OnBitmap.GetWidth() != m_OffBitmap.GetWidth() || m_OnBitmap.GetHeight() != m_OffBitmap.GetHeight()) throw wxString::Format(_("bitmap size does not match for '%s'"), group.c_str()); m_TileOffsetX = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetX"), 0, m_OnBitmap.GetWidth() - 1, false, 0); m_TileOffsetY = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetY"), 0, m_OnBitmap.GetHeight() - 1, false, 0); x = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectLeft"), 0, m_BoundingRect.GetWidth() - 1, false, 0); y = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectTop"), 0, m_BoundingRect.GetHeight() - 1, false, 0); w = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectWidth"), 1, m_BoundingRect.GetWidth() - x, false, m_BoundingRect.GetWidth() - x); h = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectHeight"), 1, m_BoundingRect.GetHeight() - y, false, m_BoundingRect.GetHeight() - y); m_MouseRect = wxRect(x, y, w, h); m_Radius = cfg.ReadInteger(ODFSetting, group, wxT("MouseRadius"), 0, std::max(m_MouseRect.GetWidth(), m_MouseRect.GetHeight()), false, std::min(w/2, h/2)); x = cfg.ReadInteger(ODFSetting, group, wxT("TextRectLeft"), 0, m_BoundingRect.GetWidth() - 1, false, 1); y = cfg.ReadInteger(ODFSetting, group, wxT("TextRectTop"), 0, m_BoundingRect.GetHeight() - 1, false, 1); w = cfg.ReadInteger(ODFSetting, group, wxT("TextRectWidth"), 1, m_BoundingRect.GetWidth() - x, false, m_BoundingRect.GetWidth() - x); h = cfg.ReadInteger(ODFSetting, group, wxT("TextRectHeight"), 1, m_BoundingRect.GetHeight() - y, false, m_BoundingRect.GetHeight() - y); m_TextRect = wxRect(x, y, w, h); m_TextWidth = cfg.ReadInteger(ODFSetting, group, wxT("TextBreakWidth"), 0, m_TextRect.GetWidth(), false, m_TextRect.GetWidth() - (m_TextRect.GetWidth() < 50 ? 4 : 14)); m_Font = m_metrics->GetControlLabelFont(); m_Font.SetName(m_FontName); m_Font.SetPoints(m_FontSize); }