/// <summary>
        ///     adds an item to the select list
        /// </summary>
        /// <param name="label">the label to be displayed</param>
        /// <param name="image">the icon to be displayed</param>
        /// <param name="data">the data to be returned when an item is queried</param>
        /// <param name="isChecked">whether the item is initially checked</param>
        public void AddItem(string label, Image image, object data, bool isChecked)
        {
            var toolStripMenuSelectListItem = new ToolStripMenuSelectListItem
            {
                Text = label
            };

            if (image == null)
            {
                image = _defaultImage;
            }
            toolStripMenuSelectListItem.DisplayStyle       = ToolStripItemDisplayStyle.Text;
            toolStripMenuSelectListItem.Image              = image;
            toolStripMenuSelectListItem.CheckOnClick       = true;
            toolStripMenuSelectListItem.CheckStateChanged += ItemCheckStateChanged;
            toolStripMenuSelectListItem.Data = data;
            if (isChecked)
            {
                if (!_multiCheckAllowed)
                {
                    _updateInProgress = true;
                    UncheckAll();
                    _updateInProgress = false;
                }
                toolStripMenuSelectListItem.Checked = true;
            }
            DropDownItems.Add(toolStripMenuSelectListItem);
        }
Example #2
0
        /// <summary>
        /// adds an item to the select list
        /// </summary>
        /// <param name="label">the label to be displayed</param>
        /// <param name="image">the icon to be displayed</param>
        /// <param name="data">the data to be returned when an item is queried</param>
        /// <param name="isChecked">whether the item is initially checked</param>
        public void AddItem(string label, Image image, Object data, bool isChecked)
        {
            ToolStripMenuSelectListItem newItem = new ToolStripMenuSelectListItem();

            newItem.Text = label;
            if (image == null)
            {
                image = defaultImage;
            }
            newItem.DisplayStyle       = ToolStripItemDisplayStyle.Text;
            newItem.Image              = image;
            newItem.CheckOnClick       = true;
            newItem.CheckStateChanged += ItemCheckStateChanged;
            newItem.Data = data;
            if (isChecked)
            {
                if (!multiCheckAllowed)
                {
                    updateInProgress = true;
                    UncheckAll();
                    updateInProgress = false;
                }
                newItem.Checked = isChecked;
            }
            DropDownItems.Add(newItem);
        }
Example #3
0
        private void ItemCheckStateChanged(object sender, System.EventArgs e)
        {
            if (updateInProgress)
            {
                return;
            }
            ToolStripMenuSelectListItem tsmi = (ToolStripMenuSelectListItem)sender;

            updateInProgress = true;
            if (tsmi.Checked && !multiCheckAllowed)
            {
                UncheckAll();
                tsmi.Checked = true;
            }
            updateInProgress = false;
            if (CheckedChanged != null)
            {
                CheckedChanged(this, new ItemCheckedChangedEventArgs(tsmi));
            }
        }
Example #4
0
        /// <summary>
        /// adds an item to the select list
        /// </summary>
        /// <param name="label">the label to be displayed</param>
        /// <param name="image">the icon to be displayed</param>
        /// <param name="data">the data to be returned when an item is queried</param>
        /// <param name="isChecked">whether the item is initially checked</param>
        public void AddItem(string label, Image image, Object data, bool isChecked)
        {
            ToolStripMenuSelectListItem newItem = new ToolStripMenuSelectListItem();

            newItem.Text               = label;
            newItem.Image              = image;
            newItem.CheckOnClick       = true;
            newItem.CheckStateChanged += new System.EventHandler(this.ItemCheckStateChanged);
            newItem.Data               = data;
            if (isChecked)
            {
                if (!multiCheckAllowed)
                {
                    updateInProgress = true;
                    UncheckAll();
                    updateInProgress = false;
                }
                newItem.Checked = isChecked;
            }
            this.DropDownItems.Add(newItem);
        }
Example #5
0
 public ItemCheckedChangedEventArgs(ToolStripMenuSelectListItem item)
 {
     Item = item;
 }
Example #6
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();
            }
        }
 public ItemCheckedChangedEventArgs(ToolStripMenuSelectListItem item)
 {
     Item = item;
 }
 /// <summary>
 /// adds an item to the select list
 /// </summary>
 /// <param name="label">the label to be displayed</param>
 /// <param name="image">the icon to be displayed</param>
 /// <param name="data">the data to be returned when an item is queried</param>
 /// <param name="isChecked">whether the item is initially checked</param>
 public void AddItem(string label, Image image, Object data, bool isChecked)
 {
     ToolStripMenuSelectListItem newItem = new ToolStripMenuSelectListItem();
     newItem.Text = label;
     newItem.Image = image;
     newItem.CheckOnClick = true;
     newItem.CheckStateChanged += new System.EventHandler(this.ItemCheckStateChanged);
     newItem.Data = data;
     if(isChecked) {
         if(!multiCheckAllowed) {
             updateInProgress = true;
             UncheckAll();
             updateInProgress = false;
         }
         newItem.Checked = isChecked;
     }
     this.DropDownItems.Add(newItem);
 }
Example #9
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);
            }
        }
		/// <summary>
		/// adds an item to the select list
		/// </summary>
		/// <param name="label">the label to be displayed</param>
		/// <param name="image">the icon to be displayed</param>
		/// <param name="data">the data to be returned when an item is queried</param>
		/// <param name="isChecked">whether the item is initially checked</param>
		public void AddItem(string label, Image image, Object data, bool isChecked) {
			ToolStripMenuSelectListItem newItem = new ToolStripMenuSelectListItem();
			newItem.Text = label;
			if (image == null) {
				image = defaultImage;
			}
			newItem.DisplayStyle = ToolStripItemDisplayStyle.Text;
			newItem.Image = image;
			newItem.CheckOnClick = true;
			newItem.CheckStateChanged += ItemCheckStateChanged;
			newItem.Data = data;
			if (isChecked) {
				if (!multiCheckAllowed) {
					updateInProgress = true;
					UncheckAll();
					updateInProgress = false;
				}
				newItem.Checked = isChecked;
			}
			DropDownItems.Add(newItem);
		}