mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Small fixes which make it easier to check if an IniValue is fixed, also changed the Component.Enabled in the settingsForm for some more properties. In normal English, if I have defined a property in the "greenshot-fixed.ini" the matching setting can not be changed!
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2260 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
929363202b
commit
0b1a0c3d55
5 changed files with 38 additions and 19 deletions
|
@ -951,7 +951,7 @@ namespace Greenshot {
|
|||
}
|
||||
|
||||
// Only add if the value is not fixed
|
||||
if (!conf.Values["CaptureMousepointer"].Attributes.FixedValue) {
|
||||
if (!conf.Values["CaptureMousepointer"].IsFixed) {
|
||||
// For the capture mousecursor option
|
||||
ToolStripMenuSelectListItem captureMouseItem = new ToolStripMenuSelectListItem();
|
||||
captureMouseItem.Text = Language.GetString("settings_capture_mousepointer");
|
||||
|
@ -964,7 +964,7 @@ namespace Greenshot {
|
|||
this.contextmenu_quicksettings.DropDownItems.Add(captureMouseItem);
|
||||
}
|
||||
ToolStripMenuSelectList selectList = null;
|
||||
if (!conf.Values["Destinations"].Attributes.FixedValue) {
|
||||
if (!conf.Values["Destinations"].IsFixed) {
|
||||
// screenshot destination
|
||||
selectList = new ToolStripMenuSelectList("destinations", true);
|
||||
selectList.Text = Language.GetString(LangKey.settings_destination);
|
||||
|
@ -976,7 +976,7 @@ namespace Greenshot {
|
|||
this.contextmenu_quicksettings.DropDownItems.Add(selectList);
|
||||
}
|
||||
|
||||
if (!conf.Values["WindowCaptureMode"].Attributes.FixedValue) {
|
||||
if (!conf.Values["WindowCaptureMode"].IsFixed) {
|
||||
// Capture Modes
|
||||
selectList = new ToolStripMenuSelectList("capturemodes", false);
|
||||
selectList.Text = Language.GetString(LangKey.settings_window_capture_mode);
|
||||
|
@ -996,7 +996,7 @@ namespace Greenshot {
|
|||
foreach(string propertyName in conf.Values.Keys) {
|
||||
if (propertyName.StartsWith("OutputPrint")) {
|
||||
iniValue = conf.Values[propertyName];
|
||||
if (iniValue.Attributes.LanguageKey != null && !iniValue.Attributes.FixedValue) {
|
||||
if (iniValue.Attributes.LanguageKey != null && !iniValue.IsFixed) {
|
||||
selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
|
||||
}
|
||||
}
|
||||
|
@ -1011,11 +1011,11 @@ namespace Greenshot {
|
|||
selectList.Text = Language.GetString(LangKey.settings_visualization);
|
||||
|
||||
iniValue = conf.Values["PlayCameraSound"];
|
||||
if (!iniValue.Attributes.FixedValue) {
|
||||
if (!iniValue.IsFixed) {
|
||||
selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
|
||||
}
|
||||
iniValue = conf.Values["ShowTrayNotification"];
|
||||
if (!iniValue.Attributes.FixedValue) {
|
||||
if (!iniValue.IsFixed) {
|
||||
selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
|
||||
}
|
||||
if (selectList.DropDownItems.Count > 0) {
|
||||
|
|
|
@ -281,7 +281,7 @@ namespace Greenshot {
|
|||
private void DisplayDestinations() {
|
||||
bool destinationsEnabled = true;
|
||||
if (coreConfiguration.Values.ContainsKey("Destinations")) {
|
||||
destinationsEnabled = !coreConfiguration.Values["Destinations"].Attributes.FixedValue;
|
||||
destinationsEnabled = !coreConfiguration.Values["Destinations"].IsFixed;
|
||||
}
|
||||
checkbox_picker.Checked = false;
|
||||
|
||||
|
@ -335,23 +335,24 @@ namespace Greenshot {
|
|||
combobox_language.SelectedValue = Language.CurrentLanguage;
|
||||
}
|
||||
// Disable editing when the value is fixed
|
||||
combobox_language.Enabled = !coreConfiguration.Values["Language"].Attributes.FixedValue;
|
||||
combobox_language.Enabled = !coreConfiguration.Values["Language"].IsFixed;
|
||||
|
||||
textbox_storagelocation.Text = FilenameHelper.FillVariables(coreConfiguration.OutputFilePath, false);
|
||||
// Disable editing when the value is fixed
|
||||
textbox_storagelocation.Enabled = !coreConfiguration.Values["OutputFilePath"].Attributes.FixedValue;
|
||||
textbox_storagelocation.Enabled = !coreConfiguration.Values["OutputFilePath"].IsFixed;
|
||||
|
||||
SetWindowCaptureMode(coreConfiguration.WindowCaptureMode);
|
||||
// Disable editing when the value is fixed
|
||||
combobox_window_capture_mode.Enabled = !coreConfiguration.Values["WindowCaptureMode"].Attributes.FixedValue;
|
||||
combobox_window_capture_mode.Enabled = !coreConfiguration.Values["WindowCaptureMode"].IsFixed;
|
||||
|
||||
trackBarJpegQuality.Value = coreConfiguration.OutputFileJpegQuality;
|
||||
trackBarJpegQuality.Enabled = !coreConfiguration.Values["OutputFileJpegQuality"].IsFixed;
|
||||
textBoxJpegQuality.Text = coreConfiguration.OutputFileJpegQuality+"%";
|
||||
|
||||
DisplayDestinations();
|
||||
|
||||
numericUpDownWaitTime.Value = coreConfiguration.CaptureDelay >=0?coreConfiguration.CaptureDelay:0;
|
||||
|
||||
numericUpDownWaitTime.Enabled = !coreConfiguration.Values["CaptureDelay"].IsFixed;
|
||||
// Autostart checkbox logic.
|
||||
if (StartupHelper.hasRunAll()) {
|
||||
// Remove runUser if we already have a run under all
|
||||
|
@ -365,6 +366,7 @@ namespace Greenshot {
|
|||
}
|
||||
|
||||
numericUpDown_daysbetweencheck.Value = coreConfiguration.UpdateCheckInterval;
|
||||
numericUpDown_daysbetweencheck.Enabled = !coreConfiguration.Values["UpdateCheckInterval"].IsFixed;
|
||||
CheckDestinationSettings();
|
||||
}
|
||||
|
||||
|
@ -520,7 +522,7 @@ namespace Greenshot {
|
|||
bool pickerSelected = checkbox_picker.Checked;
|
||||
bool destinationsEnabled = true;
|
||||
if (coreConfiguration.Values.ContainsKey("Destinations")) {
|
||||
destinationsEnabled = !coreConfiguration.Values["Destinations"].Attributes.FixedValue;
|
||||
destinationsEnabled = !coreConfiguration.Values["Destinations"].IsFixed;
|
||||
}
|
||||
listview_destinations.Enabled = destinationsEnabled;
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ namespace GreenshotPlugin.Controls {
|
|||
CheckBox checkBox = controlObject as CheckBox;
|
||||
if (checkBox != null) {
|
||||
checkBox.Checked = (bool)iniValue.Value;
|
||||
checkBox.Enabled = !iniValue.Attributes.FixedValue;
|
||||
checkBox.Enabled = !iniValue.IsFixed;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -410,12 +410,12 @@ namespace GreenshotPlugin.Controls {
|
|||
string hotkeyValue = (string)iniValue.Value;
|
||||
if (!string.IsNullOrEmpty(hotkeyValue)) {
|
||||
hotkeyControl.SetHotkey(hotkeyValue);
|
||||
hotkeyControl.Enabled = !iniValue.Attributes.FixedValue;
|
||||
hotkeyControl.Enabled = !iniValue.IsFixed;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
textBox.Text = iniValue.ToString();
|
||||
textBox.Enabled = !iniValue.Attributes.FixedValue;
|
||||
textBox.Enabled = !iniValue.IsFixed;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ namespace GreenshotPlugin.Controls {
|
|||
if (comboxBox != null) {
|
||||
comboxBox.Populate(iniValue.ValueType);
|
||||
comboxBox.SetValue((Enum)iniValue.Value);
|
||||
comboxBox.Enabled = !iniValue.Attributes.FixedValue;
|
||||
comboxBox.Enabled = !iniValue.IsFixed;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ namespace Greenshot.IniFile {
|
|||
if (fixedProperties.TryGetValue(section.IniSectionAttribute.Name, out fixedPropertiesForSection)) {
|
||||
foreach (string fixedPropertyKey in fixedPropertiesForSection.Keys) {
|
||||
if (section.Values.ContainsKey(fixedPropertyKey)) {
|
||||
section.Values[fixedPropertyKey].Attributes.FixedValue = true;
|
||||
section.Values[fixedPropertyKey].IsFixed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,23 @@ namespace Greenshot.IniFile {
|
|||
this.attributes = iniPropertyAttribute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true when the value is fixed
|
||||
/// </summary>
|
||||
public bool IsFixed {
|
||||
get {
|
||||
if (attributes != null) {
|
||||
return attributes.FixedValue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
set {
|
||||
if (attributes != null) {
|
||||
attributes.FixedValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MemberInfo MemberInfo {
|
||||
get {
|
||||
if (propertyInfo == null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue