Example #1
0
        /// <summary>
        ///     This needs to be called to initialize the quick settings menu entries
        /// </summary>
        private void InitializeQuickSettingsMenu()
        {
            contextmenu_quicksettings.DropDownItems.Clear();

            if (_coreConfiguration.DisableQuickSettings)
            {
                return;
            }

            // Only add if the value is not fixed
            if (!_coreConfiguration.IsWriteProtected("CaptureMousepointer"))
            {
                // For the capture mousecursor option
                var captureMouseItem = new ToolStripMenuSelectListItem
                {
                    Text         = _greenshotLanguage.SettingsCaptureMousepointer,
                    Checked      = _coreConfiguration.CaptureMousepointer,
                    CheckOnClick = true
                };
                captureMouseItem.CheckStateChanged += CheckStateChangedHandler;

                contextmenu_quicksettings.DropDownItems.Add(captureMouseItem);
            }
            ToolStripMenuSelectList selectList;

            if (!_coreConfiguration.IsWriteProtected("Destinations"))
            {
                // screenshot destination
                selectList = new ToolStripMenuSelectList("destinations", true)
                {
                    Text = _greenshotLanguage.SettingsDestination
                };
                // Working with IDestination:
                foreach (var destination in _destinationHolder.SortedActiveDestinations)
                {
                    selectList.AddItem(destination.Description, destination, _coreConfiguration.OutputDestinations.Contains(destination.Designation));
                }
                selectList.CheckedChanged += QuickSettingDestinationChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }

            if (!_coreConfiguration.IsWriteProtected("WindowCaptureMode"))
            {
                // Capture Modes
                selectList = new ToolStripMenuSelectList("capturemodes", false)
                {
                    Text = _greenshotLanguage.SettingsWindowCaptureMode
                };
                var enumTypeName = typeof(WindowCaptureModes).Name;
                foreach (WindowCaptureModes captureMode in Enum.GetValues(typeof(WindowCaptureModes)))
                {
                    selectList.AddItem(Language.GetString(enumTypeName + "." + captureMode), captureMode, _coreConfiguration.WindowCaptureMode == captureMode);
                }
                selectList.CheckedChanged += QuickSettingCaptureModeChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }

            // print options
            selectList = new ToolStripMenuSelectList("printoptions", true)
            {
                Text = _greenshotLanguage.SettingsPrintoptions
            };

            foreach (var outputPrintIniValue in _coreConfiguration.GetIniValues().Values.Where(value => value.PropertyName.StartsWith("OutputPrint") && value.ValueType == typeof(bool) && !_coreConfiguration.IsWriteProtected(value.PropertyName)))
            {
                selectList.AddItem(Language.GetString(outputPrintIniValue.PropertyName), outputPrintIniValue, (bool)outputPrintIniValue.Value);
            }
            if (selectList.DropDownItems.Count > 0)
            {
                selectList.CheckedChanged += QuickSettingBoolItemChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }
            else
            {
                selectList.Dispose();
            }

            // effects
            selectList = new ToolStripMenuSelectList("effects", true)
            {
                Text = _greenshotLanguage.SettingsVisualization
            };

            var iniValue    = _coreConfiguration["PlayCameraSound"];
            var languageKey = _coreConfiguration.GetTagValue(iniValue.PropertyName, ConfigTags.LanguageKey) as string;

            if (!_coreConfiguration.IsWriteProtected(iniValue.PropertyName))
            {
                selectList.AddItem(Language.GetString(languageKey), iniValue, (bool)iniValue.Value);
            }
            iniValue    = _coreConfiguration["ShowTrayNotification"];
            languageKey = _coreConfiguration.GetTagValue(iniValue.PropertyName, ConfigTags.LanguageKey) as string;
            if (!_coreConfiguration.IsWriteProtected(iniValue.PropertyName))
            {
                selectList.AddItem(Language.GetString(languageKey), iniValue, (bool)iniValue.Value);
            }
            if (selectList.DropDownItems.Count > 0)
            {
                selectList.CheckedChanged += QuickSettingBoolItemChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }
            else
            {
                selectList.Dispose();
            }
        }
Example #2
0
        /// <summary>
        /// This needs to be called to initialize the quick settings menu entries
        /// </summary>
        private void InitializeQuickSettingsMenu()
        {
            contextmenu_quicksettings.DropDownItems.Clear();

            if (_conf.DisableQuickSettings) {
                return;
            }

            // Only add if the value is not fixed
            if (!_conf.Values["CaptureMousepointer"].IsFixed) {
                // For the capture mousecursor option
                ToolStripMenuSelectListItem captureMouseItem = new ToolStripMenuSelectListItem();
                captureMouseItem.Text = Language.GetString("settings_capture_mousepointer");
                captureMouseItem.Checked = _conf.CaptureMousepointer;
                captureMouseItem.CheckOnClick = true;
                captureMouseItem.CheckStateChanged += CheckStateChangedHandler;

                contextmenu_quicksettings.DropDownItems.Add(captureMouseItem);
            }
            ToolStripMenuSelectList selectList;
            if (!_conf.Values["Destinations"].IsFixed) {
                // screenshot destination
                selectList = new ToolStripMenuSelectList("destinations", true);
                selectList.Text = Language.GetString(LangKey.settings_destination);
                // Working with IDestination:
                foreach (IDestination destination in DestinationHelper.GetAllDestinations()) {
                    selectList.AddItem(destination.Description, destination, _conf.OutputDestinations.Contains(destination.Designation));
                }
                selectList.CheckedChanged += QuickSettingDestinationChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }

            if (!_conf.Values["WindowCaptureMode"].IsFixed) {
                // Capture Modes
                selectList = new ToolStripMenuSelectList("capturemodes", false);
                selectList.Text = Language.GetString(LangKey.settings_window_capture_mode);
                string enumTypeName = typeof(WindowCaptureMode).Name;
                foreach (WindowCaptureMode captureMode in Enum.GetValues(typeof(WindowCaptureMode))) {
                    selectList.AddItem(Language.GetString(enumTypeName + "." + captureMode.ToString()), captureMode, _conf.WindowCaptureMode == captureMode);
                }
                selectList.CheckedChanged += QuickSettingCaptureModeChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }

            // print options
            selectList = new ToolStripMenuSelectList("printoptions",true);
            selectList.Text = Language.GetString(LangKey.settings_printoptions);

            IniValue iniValue;
            foreach(string propertyName in _conf.Values.Keys) {
                if (propertyName.StartsWith("OutputPrint")) {
                    iniValue = _conf.Values[propertyName];
                    if (iniValue.Attributes.LanguageKey != null && !iniValue.IsFixed) {
                        selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
                    }
                }
            }
            if (selectList.DropDownItems.Count > 0) {
                selectList.CheckedChanged += QuickSettingBoolItemChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }

            // effects
            selectList = new ToolStripMenuSelectList("effects",true);
            selectList.Text = Language.GetString(LangKey.settings_visualization);

            iniValue = _conf.Values["PlayCameraSound"];
            if (!iniValue.IsFixed) {
                selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
            }
            iniValue = _conf.Values["ShowTrayNotification"];
            if (!iniValue.IsFixed) {
                selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
            }
            if (selectList.DropDownItems.Count > 0) {
                selectList.CheckedChanged += QuickSettingBoolItemChanged;
                contextmenu_quicksettings.DropDownItems.Add(selectList);
            }
        }
        private void InitializeQuickSettingsMenu()
        {
            this.contextmenu_quicksettings.DropDownItems.Clear();
            // screenshot destination
            ToolStripMenuSelectList selectList = new ToolStripMenuSelectList("destinations", true);
            selectList.Text = Language.GetString(LangKey.settings_destination);
            // Working with IDestination:
            foreach (IDestination destination in DestinationHelper.GetAllDestinations())
            {
                selectList.AddItem(destination.Description, destination, conf.OutputDestinations.Contains(destination.Designation));
            }
            selectList.CheckedChanged += new EventHandler(this.QuickSettingDestinationChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);

            // Capture Modes
            selectList = new ToolStripMenuSelectList("capturemodes", false);
            selectList.Text = Language.GetString(LangKey.settings_window_capture_mode);
            string enumTypeName = typeof(WindowCaptureMode).Name;
            foreach (WindowCaptureMode captureMode in Enum.GetValues(typeof(WindowCaptureMode)))
            {
                selectList.AddItem(Language.GetString(enumTypeName + "." + captureMode.ToString()), captureMode, conf.WindowCaptureMode == captureMode);
            }
            selectList.CheckedChanged += new EventHandler(this.QuickSettingCaptureModeChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);

            // print options
            selectList = new ToolStripMenuSelectList("printoptions", true);
            selectList.Text = Language.GetString(LangKey.settings_printoptions);

            IniValue iniValue;
            foreach (string propertyName in conf.Values.Keys)
            {
                if (propertyName.StartsWith("OutputPrint"))
                {
                    iniValue = conf.Values[propertyName];
                    if (iniValue.Attributes.LanguageKey != null)
                    {
                        selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
                    }
                }
            }
            selectList.CheckedChanged += new EventHandler(this.QuickSettingBoolItemChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);

            // effects
            selectList = new ToolStripMenuSelectList("effects", true);
            selectList.Text = Language.GetString(LangKey.settings_visualization);

            iniValue = conf.Values["PlayCameraSound"];
            selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
            iniValue = conf.Values["ShowTrayNotification"];
            selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value);
            selectList.CheckedChanged += new EventHandler(this.QuickSettingBoolItemChanged);
            this.contextmenu_quicksettings.DropDownItems.Add(selectList);
        }
Example #4
0
 private void InitializeQuickSettingsMenu()
 {
     this.contextmenu_quicksettings.DropDownItems.Clear();
      // screenshot destination
      ToolStripMenuSelectList selectList = new ToolStripMenuSelectList("destination", true);
      selectList.Text = lang.GetString(LangKey.settings_destination);
      selectList.AddItem(lang.GetString(LangKey.settings_destination_editor), Destination.Editor, conf.OutputDestinations.Contains(Destination.Editor));
      selectList.AddItem(lang.GetString(LangKey.settings_destination_clipboard), Destination.Clipboard, conf.OutputDestinations.Contains(Destination.Clipboard));
      selectList.AddItem(lang.GetString(LangKey.quicksettings_destination_file), Destination.FileDefault, conf.OutputDestinations.Contains(Destination.FileDefault));
      selectList.AddItem(lang.GetString(LangKey.settings_destination_fileas), Destination.FileWithDialog, conf.OutputDestinations.Contains(Destination.FileWithDialog));
      selectList.AddItem(lang.GetString(LangKey.settings_destination_printer), Destination.Printer, conf.OutputDestinations.Contains(Destination.Printer));
      selectList.AddItem(lang.GetString(LangKey.settings_destination_email), Destination.EMail, conf.OutputDestinations.Contains(Destination.EMail));
      selectList.CheckedChanged += new EventHandler(this.QuickSettingItemChanged);
      this.contextmenu_quicksettings.DropDownItems.Add(selectList);
      // print options
      selectList = new ToolStripMenuSelectList("printoptions", true);
      selectList.Text = lang.GetString(LangKey.settings_printoptions);
      selectList.AddItem(lang.GetString(LangKey.printoptions_allowshrink), "AllowPrintShrink", conf.OutputPrintAllowShrink);
      selectList.AddItem(lang.GetString(LangKey.printoptions_allowenlarge), "AllowPrintEnlarge", conf.OutputPrintAllowEnlarge);
      selectList.AddItem(lang.GetString(LangKey.printoptions_allowrotate), "AllowPrintRotate", conf.OutputPrintAllowRotate);
      selectList.AddItem(lang.GetString(LangKey.printoptions_allowcenter), "AllowPrintCenter", conf.OutputPrintCenter);
      selectList.CheckedChanged += new EventHandler(this.QuickSettingItemChanged);
      this.contextmenu_quicksettings.DropDownItems.Add(selectList);
      // effects
      selectList = new ToolStripMenuSelectList("effects", true);
      selectList.Text = lang.GetString(LangKey.settings_visualization);
      selectList.AddItem(lang.GetString(LangKey.settings_playsound), "PlaySound", conf.PlayCameraSound);
      selectList.CheckedChanged += new EventHandler(this.QuickSettingItemChanged);
      this.contextmenu_quicksettings.DropDownItems.Add(selectList);
 }