protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); tb.AppendItem(GradientLabel); tb.AppendItem(GradientDropDown); }
public void BuildToolbar(Gtk.Toolbar tb) { if (selection_label == null) { selection_label = new ToolBarLabel(Catalog.GetString(" Selection Mode: ")); } tb.AppendItem(selection_label); if (selection_combo_box == null) { selection_combo_box = new ToolBarComboBox(170, 0, false); selection_combo_box.ComboBox.Changed += (o, e) => { Gtk.TreeIter iter; if (selection_combo_box.ComboBox.GetActiveIter(out iter)) { selected_mode = (CombineMode)selection_combo_box.Model.GetValue(iter, 1); } }; foreach (var mode in combine_modes) { selection_combo_box.Model.AppendValues(mode.Value, mode.Key); } selection_combo_box.ComboBox.Active = 0; } tb.AppendItem(selection_combo_box); }
public void BuildToolbar(Gtk.Toolbar tb) { if (selection_label == null) { selection_label = new ToolBarLabel(Catalog.GetString(" Selection Mode: ")); } tb.AppendItem(selection_label); if (selection_combo_box == null) { selection_combo_box = new ToolBarComboBox(170, 0, false); selection_combo_box.ComboBox.Changed += (o, e) => { Gtk.TreeIter iter; if (selection_combo_box.ComboBox.GetActiveIter(out iter)) { SelectionMode = ((KeyValuePair <int, string>)selection_combo_box.Model.GetValue(iter, 1)).Key; } }; foreach (KeyValuePair <int, string> sel in selectionCombinations) { selection_combo_box.Model.AppendValues(sel.Value, sel); } selection_combo_box.ComboBox.Active = 0; } tb.AppendItem(selection_combo_box); }
public void BuildToolbar(Gtk.Toolbar tb, ISettingsService settings) { if (selection_label == null) { selection_label = new ToolBarLabel(Translations.GetString(" Selection Mode: ")); } tb.AppendItem(selection_label); if (selection_combo_box == null) { selection_combo_box = new ToolBarComboBox(170, 0, false); selection_combo_box.ComboBox.Changed += (o, e) => { selected_mode = combine_modes[selection_combo_box.ComboBox.ActiveText]; }; foreach (var mode in combine_modes) { selection_combo_box.ComboBox.AppendText(mode.Key); } selection_combo_box.ComboBox.Active = settings.GetSetting(COMBINE_MODE_SETTING, 0); } tb.AppendItem(selection_combo_box); }
public override void HandleBuildToolBar(Gtk.Toolbar tb, ISettingsService settings, string toolPrefix) { base.HandleBuildToolBar(tb, settings, toolPrefix); if (radius_sep == null) { radius_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(radius_sep); if (radius_label == null) { radius_label = new ToolBarLabel(string.Format(" {0}: ", Translations.GetString("Radius"))); } tb.AppendItem(radius_label); if (radius == null) { radius = new (new Gtk.SpinButton(0, 1e5, 1) { Value = settings.GetSetting(RADIUS_SETTING(toolPrefix), 20) }); radius.Widget.ValueChanged += (o, e) => { //Go through the Get/Set routine. Radius = Radius; }; } tb.AppendItem(radius); }
public override void HandleBuildToolBar(Gtk.Toolbar tb) { base.HandleBuildToolBar(tb); if (radius_sep == null) { radius_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(radius_sep); if (radius_label == null) { radius_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Radius"))); } tb.AppendItem(radius_label); if (radius_minus == null) { radius_minus = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease shape's corner radius")); radius_minus.Clicked += RadiusMinusButtonClickedEvent; } tb.AppendItem(radius_minus); if (radius == null) { radius = new ToolBarComboBox(65, 16, true, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "20", "25", "30", "40", "50", "60", "70", "80"); radius.ComboBox.Changed += (o, e) => { //Go through the Get/Set routine. Radius = Radius; }; } tb.AppendItem(radius); if (radius_plus == null) { radius_plus = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase shape's corner radius")); radius_plus.Clicked += RadiusPlusButtonClickedEvent; } tb.AppendItem(radius_plus); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (tool_select_label == null) { tool_select_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("After select"))); } tb.AppendItem(tool_select_label); // TODO: Enable when we have the Pencil tool if (tool_select == null) { tool_select = new ToolBarComboBox(170, 0, false, Catalog.GetString("Do not switch tool"), Catalog.GetString("Switch to previous tool"), Catalog.GetString("Switch to Pencil tool")); } tb.AppendItem(tool_select); }
protected override void BuildToolBar(Gtk.Toolbar tb) { base.BuildToolBar(tb); if (radius_sep == null) { radius_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(radius_sep); if (radius_label == null) { radius_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Radius"))); } tb.AppendItem(radius_label); if (radius_minus == null) { radius_minus = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease rectangle's corner radius")); radius_minus.Clicked += RadiusMinusButtonClickedEvent; } tb.AppendItem(radius_minus); if (radius == null) { radius = new ToolBarComboBox(65, 2, true, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "20", "25", "30", "35", "40", "45", "50", "55"); } tb.AppendItem(radius); if (radius_plus == null) { radius_plus = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase rectangle's corner radius")); radius_plus.Clicked += RadiusPlusButtonClickedEvent; } tb.AppendItem(radius_plus); }
//private ToolBarLabel mode_label; //private ToolBarDropDownButton mode_button; protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (gradient_label == null) { gradient_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Gradient"))); } tb.AppendItem(gradient_label); if (gradient_button == null) { gradient_button = new ToolBarDropDownButton(); gradient_button.AddItem(Catalog.GetString("Linear Gradient"), "Toolbar.LinearGradient.png", GradientType.Linear); gradient_button.AddItem(Catalog.GetString("Linear Reflected Gradient"), "Toolbar.LinearReflectedGradient.png", GradientType.LinearReflected); gradient_button.AddItem(Catalog.GetString("Linear Diamond Gradient"), "Toolbar.DiamondGradient.png", GradientType.Diamond); gradient_button.AddItem(Catalog.GetString("Radial Gradient"), "Toolbar.RadialGradient.png", GradientType.Radial); gradient_button.AddItem(Catalog.GetString("Conical Gradient"), "Toolbar.ConicalGradient.png", GradientType.Conical); } tb.AppendItem(gradient_button); // Hide TransparentMode. The core issue is we can't just paint it on top of the // current layer because it's transparent. Will require significant effort to support. //tb.AppendItem (new Gtk.SeparatorToolItem ()); //if (mode_label == null) // mode_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Mode"))); //tb.AppendItem (mode_label); //if (mode_button == null) { // mode_button = new ToolBarDropDownButton (); // mode_button.AddItem (Catalog.GetString ("Color Mode"), "Toolbar.ColorMode.png", GradientColorMode.Color); // mode_button.AddItem (Catalog.GetString ("Transparency Mode"), "Toolbar.TransparentMode.png", GradientColorMode.Transparency); //} //tb.AppendItem (mode_button); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (mode_label == null) { mode_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Flood Mode"))); } tb.AppendItem(mode_label); if (mode_button == null) { mode_button = new ToolBarDropDownButton(); mode_button.AddItem(Catalog.GetString("Contiguous"), "Tools.FreeformShape.png", true); mode_button.AddItem(Catalog.GetString("Global"), "Menu.Help.Website.png", false); } tb.AppendItem(mode_button); if (mode_sep == null) { mode_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(mode_sep); if (tolerance_label == null) { tolerance_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Tolerance"))); } tb.AppendItem(tolerance_label); if (tolerance_slider == null) { tolerance_slider = new ToolBarSlider(0, 100, 1, 0); } tb.AppendItem(tolerance_slider); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (selection_sep == null) { selection_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(selection_sep); PintaCore.Workspace.SelectionHandler.BuildToolbar(tb); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (sampling_label == null) { sampling_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Sampling"))); } tb.AppendItem(sampling_label); if (sample_size == null) { sample_size = new ToolBarDropDownButton(true); sample_size.AddItem(Catalog.GetString("Single Pixel"), "Toolbar.Sampling.1x1.png", 1); sample_size.AddItem(Catalog.GetString("3 x 3 Region"), "Toolbar.Sampling.3x3.png", 3); sample_size.AddItem(Catalog.GetString("5 x 5 Region"), "Toolbar.Sampling.5x5.png", 5); sample_size.AddItem(Catalog.GetString("7 x 7 Region"), "Toolbar.Sampling.7x7.png", 7); sample_size.AddItem(Catalog.GetString("9 x 9 Region"), "Toolbar.Sampling.9x9.png", 9); } tb.AppendItem(sample_size); if (sample_type == null) { sample_type = new ToolBarDropDownButton(true); sample_type.AddItem(Catalog.GetString("Layer"), "Menu.Layers.MergeLayerDown.png", true); sample_type.AddItem(Catalog.GetString("Image"), "ResizeCanvas.Image.png", false); } tb.AppendItem(sample_type); if (sample_sep == null) { sample_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(sample_sep); if (tool_select_label == null) { tool_select_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("After select"))); } tb.AppendItem(tool_select_label); if (tool_select == null) { tool_select = new ToolBarDropDownButton(true); tool_select.AddItem(Catalog.GetString("Do not switch tool"), "Tools.ColorPicker.png", 0); tool_select.AddItem(Catalog.GetString("Switch to previous tool"), "Tools.ColorPicker.PreviousTool.png", 1); tool_select.AddItem(Catalog.GetString("Switch to Pencil tool"), "Tools.Pencil.png", 2); } tb.AppendItem(tool_select); }
public override void HandleBuildToolBar(Gtk.Toolbar tb) { base.HandleBuildToolBar(tb); #region Show Arrows //Arrow separator. if (arrowSep == null) { arrowSep = new Gtk.SeparatorToolItem(); showOtherArrowOptions = false; } tb.AppendItem(arrowSep); if (arrowLabel == null) { arrowLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Arrow"))); } tb.AppendItem(arrowLabel); //Show arrow 1. showArrowOneBox = new Gtk.CheckButton("1"); showArrowOneBox.Active = previousSettings1.Show; showArrowOneBox.Toggled += (o, e) => { //Determine whether to change the visibility of Arrow options in the toolbar based on the updated Arrow showing/hiding. if (!showArrowOneBox.Active && !showArrowTwoBox.Active) { if (showOtherArrowOptions) { tb.Remove(arrowSizeLabel); tb.Remove(arrowSizeMinus); tb.Remove(arrowSize); tb.Remove(arrowSizePlus); tb.Remove(arrowAngleOffsetLabel); tb.Remove(arrowAngleOffsetMinus); tb.Remove(arrowAngleOffset); tb.Remove(arrowAngleOffsetPlus); tb.Remove(arrowLengthOffsetLabel); tb.Remove(arrowLengthOffsetMinus); tb.Remove(arrowLengthOffset); tb.Remove(arrowLengthOffsetPlus); showOtherArrowOptions = false; } } else { if (!showOtherArrowOptions) { tb.Add(arrowSizeLabel); tb.Add(arrowSizeMinus); tb.Add(arrowSize); tb.Add(arrowSizePlus); tb.Add(arrowAngleOffsetLabel); tb.Add(arrowAngleOffsetMinus); tb.Add(arrowAngleOffset); tb.Add(arrowAngleOffsetPlus); tb.Add(arrowLengthOffsetLabel); tb.Add(arrowLengthOffsetMinus); tb.Add(arrowLengthOffset); tb.Add(arrowLengthOffsetPlus); showOtherArrowOptions = true; } } LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine; if (activeEngine != null) { activeEngine.Arrow1.Show = showArrowOneBox.Active; DrawActiveShape(false, false, true, false, false); storePreviousSettings(); } }; tb.AddWidgetItem(showArrowOneBox); //Show arrow 2. showArrowTwoBox = new Gtk.CheckButton("2"); showArrowTwoBox.Active = previousSettings2.Show; showArrowTwoBox.Toggled += (o, e) => { //Determine whether to change the visibility of Arrow options in the toolbar based on the updated Arrow showing/hiding. if (!showArrowOneBox.Active && !showArrowTwoBox.Active) { if (showOtherArrowOptions) { tb.Remove(arrowSizeLabel); tb.Remove(arrowSizeMinus); tb.Remove(arrowSize); tb.Remove(arrowSizePlus); tb.Remove(arrowAngleOffsetLabel); tb.Remove(arrowAngleOffsetMinus); tb.Remove(arrowAngleOffset); tb.Remove(arrowAngleOffsetPlus); tb.Remove(arrowLengthOffsetLabel); tb.Remove(arrowLengthOffsetMinus); tb.Remove(arrowLengthOffset); tb.Remove(arrowLengthOffsetPlus); showOtherArrowOptions = false; } } else { if (!showOtherArrowOptions) { tb.Add(arrowSizeLabel); tb.Add(arrowSizeMinus); tb.Add(arrowSize); tb.Add(arrowSizePlus); tb.Add(arrowAngleOffsetLabel); tb.Add(arrowAngleOffsetMinus); tb.Add(arrowAngleOffset); tb.Add(arrowAngleOffsetPlus); tb.Add(arrowLengthOffsetLabel); tb.Add(arrowLengthOffsetMinus); tb.Add(arrowLengthOffset); tb.Add(arrowLengthOffsetPlus); showOtherArrowOptions = true; } } LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine; if (activeEngine != null) { activeEngine.Arrow2.Show = showArrowTwoBox.Active; DrawActiveShape(false, false, true, false, false); storePreviousSettings(); } }; tb.AddWidgetItem(showArrowTwoBox); #endregion Show Arrows #region Arrow Size if (arrowSizeLabel == null) { arrowSizeLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Size"))); } if (arrowSizeMinus == null) { arrowSizeMinus = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease arrow size")); arrowSizeMinus.Clicked += new EventHandler(arrowSizeMinus_Clicked); } if (arrowSize == null) { arrowSize = new ToolBarComboBox(65, 7, true, "3", "4", "5", "6", "7", "8", "9", "10", "12", "15", "18", "20", "25", "30", "40", "50", "60", "70", "80", "90", "100"); arrowSize.ComboBox.Changed += (o, e) => { if (arrowSize.ComboBox.ActiveText.Length < 1) { //Ignore the change until the user enters something. return; } else { double newSize = 10d; if (arrowSize.ComboBox.ActiveText == "-") { //The user is trying to enter a negative value: change it to 1. newSize = 1d; } else { if (Double.TryParse(arrowSize.ComboBox.ActiveText, out newSize)) { if (newSize < 1d) { //Less than 1: change it to 1. newSize = 1d; } else if (newSize > 100d) { //Greater than 100: change it to 100. newSize = 100d; } } else { //Not a number: wait until the user enters something. return; } } (arrowSize.ComboBox as Gtk.ComboBoxEntry).Entry.Text = newSize.ToString(); LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine; if (activeEngine != null) { activeEngine.Arrow1.ArrowSize = newSize; activeEngine.Arrow2.ArrowSize = newSize; DrawActiveShape(false, false, true, false, false); storePreviousSettings(); } } }; } if (arrowSizePlus == null) { arrowSizePlus = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase arrow size")); arrowSizePlus.Clicked += new EventHandler(arrowSizePlus_Clicked); } #endregion Arrow Size #region Angle Offset if (arrowAngleOffsetLabel == null) { arrowAngleOffsetLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Angle"))); } if (arrowAngleOffsetMinus == null) { arrowAngleOffsetMinus = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease angle offset")); arrowAngleOffsetMinus.Clicked += new EventHandler(arrowAngleOffsetMinus_Clicked); } if (arrowAngleOffset == null) { arrowAngleOffset = new ToolBarComboBox(65, 9, true, "-30", "-25", "-20", "-15", "-10", "-5", "0", "5", "10", "15", "20", "25", "30"); arrowAngleOffset.ComboBox.Changed += (o, e) => { if (arrowAngleOffset.ComboBox.ActiveText.Length < 1) { //Ignore the change until the user enters something. return; } else if (arrowAngleOffset.ComboBox.ActiveText == "-") { //The user is trying to enter a negative value: ignore the change until the user enters more. return; } else { double newAngle = 15d; if (Double.TryParse(arrowAngleOffset.ComboBox.ActiveText, out newAngle)) { if (newAngle < -89d) { //Less than -89: change it to -89. newAngle = -89d; } else if (newAngle > 89d) { //Greater than 89: change it to 89. newAngle = 89d; } } else { //Not a number: wait until the user enters something. return; } (arrowAngleOffset.ComboBox as Gtk.ComboBoxEntry).Entry.Text = newAngle.ToString(); LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine; if (activeEngine != null) { activeEngine.Arrow1.AngleOffset = newAngle; activeEngine.Arrow2.AngleOffset = newAngle; DrawActiveShape(false, false, true, false, false); storePreviousSettings(); } } }; } if (arrowAngleOffsetPlus == null) { arrowAngleOffsetPlus = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase angle offset")); arrowAngleOffsetPlus.Clicked += new EventHandler(arrowAngleOffsetPlus_Clicked); } #endregion Angle Offset #region Length Offset if (arrowLengthOffsetLabel == null) { arrowLengthOffsetLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Length"))); } if (arrowLengthOffsetMinus == null) { arrowLengthOffsetMinus = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease length offset")); arrowLengthOffsetMinus.Clicked += new EventHandler(arrowLengthOffsetMinus_Clicked); } if (arrowLengthOffset == null) { arrowLengthOffset = new ToolBarComboBox(65, 8, true, "-30", "-25", "-20", "-15", "-10", "-5", "0", "5", "10", "15", "20", "25", "30"); arrowLengthOffset.ComboBox.Changed += (o, e) => { if (arrowLengthOffset.ComboBox.ActiveText.Length < 1) { //Ignore the change until the user enters something. return; } else if (arrowLengthOffset.ComboBox.ActiveText == "-") { //The user is trying to enter a negative value: ignore the change until the user enters more. return; } else { double newLength = 10d; if (Double.TryParse(arrowLengthOffset.ComboBox.ActiveText, out newLength)) { if (newLength < -100d) { //Less than -100: change it to -100. newLength = -100d; } else if (newLength > 100d) { //Greater than 100: change it to 100. newLength = 100d; } } else { //Not a number: wait until the user enters something. return; } (arrowLengthOffset.ComboBox as Gtk.ComboBoxEntry).Entry.Text = newLength.ToString(); LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine; if (activeEngine != null) { activeEngine.Arrow1.LengthOffset = newLength; activeEngine.Arrow2.LengthOffset = newLength; DrawActiveShape(false, false, true, false, false); storePreviousSettings(); } } }; } if (arrowLengthOffsetPlus == null) { arrowLengthOffsetPlus = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase length offset")); arrowLengthOffsetPlus.Clicked += new EventHandler(arrowLengthOffsetPlus_Clicked); } #endregion Length Offset if (showOtherArrowOptions) { tb.Add(arrowSizeLabel); tb.Add(arrowSizeMinus); tb.Add(arrowSize); tb.Add(arrowSizePlus); tb.Add(arrowAngleOffsetLabel); tb.Add(arrowAngleOffsetMinus); tb.Add(arrowAngleOffset); tb.Add(arrowAngleOffsetPlus); tb.Add(arrowLengthOffsetLabel); tb.Add(arrowLengthOffsetMinus); tb.Add(arrowLengthOffset); tb.Add(arrowLengthOffsetPlus); } }
// Do this in a separate method so SelectTool can override it as // a no-op, but still get the BaseShape.OnBuildToolBar logic. protected virtual void BuildToolBar(Gtk.Toolbar tb) { if (brush_width_label == null) { brush_width_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Brush width"))); } tb.AppendItem(brush_width_label); if (brush_width_minus == null) { brush_width_minus = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease brush size")); brush_width_minus.Clicked += MinusButtonClickedEvent; } tb.AppendItem(brush_width_minus); if (brush_width == null) { brush_width = new ToolBarComboBox(65, 1, true, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "20", "25", "30", "35", "40", "45", "50", "55"); } tb.AppendItem(brush_width); if (brush_width_plus == null) { brush_width_plus = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase brush size")); brush_width_plus.Clicked += PlusButtonClickedEvent; } tb.AppendItem(brush_width_plus); if (ShowStrokeComboBox) { if (fill_sep == null) { fill_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(fill_sep); if (fill_label == null) { fill_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Fill Style"))); } tb.AppendItem(fill_label); if (fill_button == null) { fill_button = new ToolBarDropDownButton(); fill_button.AddItem(Catalog.GetString("Outline Shape"), "ShapeTool.Outline.png", 0); fill_button.AddItem(Catalog.GetString("Fill Shape"), "ShapeTool.Fill.png", 1); fill_button.AddItem(Catalog.GetString("Fill and Outline Shape"), "ShapeTool.OutlineFill.png", 2); } tb.AppendItem(fill_button); } }