public override void OnDisplay() { base.OnDisplay(); m_Filling = true; chkToolbar.Checked = m_Applied.ReadBoolean(Config.Show_Toolbar, true); chkTools.Checked = m_Applied.ReadBoolean(Config.Show_Tools, true); chkToolbox.Checked = m_Applied.ReadBoolean(Config.ShowPaletteKey(Parameters.Tool), true); chkOutline.Checked = m_Applied.ReadBoolean(Config.ShowPaletteKey(Palette.Item("DocumentOutline")), true); chkPages.Checked = m_Applied.ReadBoolean(Config.Show_PageList, true); chkInfoBar.Checked = m_Applied.ReadBoolean(Config.Show_InfoMeasurement, true); chkShowHidden.Checked = m_Applied.ReadBoolean(Config.Show_Hidden_When_Editing, true); chkMultipleDocuments.Checked = m_Applied.ReadBoolean(Config.Multiple_Documents, false); chkResizeDocToWindow.Checked = m_Applied.ReadBoolean(Config.Resize_Document_ToWindow, true); #if DEBUG chkMultipleDocuments.Visible = Level == Config.Levels.User; // currently off unless debug #endif m_Filling = false; }
/// <summary>returns the ID of the palette selected for the given purpose</summary> public string PaletteSelection(Palette.Purpose purpose, bool verify) { // // This is stored in the configuration, but we need to check for some special cases, such as if nothing is yet selected (must select something by default) // or if a palette has been selected and then later deleted. Again it is essential that we return a valid palette, assuming there is one // But in the latter case, verification is difficult unless Palette.List matches this applied configuration. This will be the case in the GUI // but not always in the editing. Therefore the second parameter controls whether this check should be performed if (purpose.IsCustom) { throw new ArgumentException("AppliedConfig.PaletteSelection: purpose cannot be \'custom\'"); } string key = Config.SelectPaletteKey(purpose); string selected = this.ReadString(key); if (!string.IsNullOrEmpty(selected) && verify) { if (!Palette.List.ContainsKey(selected)) { Debug.WriteLine("Selected palette not available; selection reset for purpose: " + purpose.Name); selected = ""; } } if (String.IsNullOrEmpty(selected)) { // nothing selected - find most appropriate palette Palette selectedPalette = null; foreach (Palette possible in AvailablePalettesForPurpose(purpose)) { if (string.IsNullOrEmpty(selected) || possible.UserDefined == false) { // Selects any palette, with built-in system ones having priority selected = possible.ID; selectedPalette = possible; } } if (!string.IsNullOrEmpty(selected)) // Store the value back again; it is rather slow searching each time { // find where it is defined Config sourceConfig = null; if (selectedPalette.UserDefined) { foreach (Config config in Configurations) { if (config.CustomPalettes.ContainsValue(selectedPalette.CustomDocument)) { sourceConfig = config; } } } else { sourceConfig = Config.SystemConfig; // actually defined in S/W - can safely store in sys config Config.SystemConfig.Write(key, selected); } if (sourceConfig != null) { sourceConfig.Write(key, selected); } else { Utilities.LogSubError("AppliedConfig.PaletteSelection: Failed to find place to write auto palette selection"); } } } return(selected); }