/// <summary> /// Sets up the DashPatternBox in the Toolbar. /// /// Note that the dash pattern change event response code must be created manually outside of the DashPatternBox /// (using the returned Gtk.ComboBox from the SetupToolbar method) so that each tool that uses it /// can react to the change in pattern according to its usage. /// /// Returns null if the DashPatternBox has already been setup; otherwise, returns the DashPatternBox itself. /// </summary> /// <param name="tb">The Toolbar to add the DashPatternBox to.</param> /// <returns>null if the DashPatternBox has already been setup; otherwise, returns the DashPatternBox itself.</returns> public Gtk.ComboBox SetupToolbar(Toolbar tb) { if (dashPatternSep == null) { dashPatternSep = new SeparatorToolItem(); } tb.AppendItem(dashPatternSep); if (dashPatternLabel == null) { dashPatternLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Dash"))); } tb.AppendItem(dashPatternLabel); if (comboBox == null) { comboBox = new ToolBarComboBox(100, 0, true, "-", " -", " --", " ---", " -", " -", " - --", " - - --------", " - - ---- - ----"); } tb.AppendItem(comboBox); if (dashChangeSetup) { return null; } else { dashChangeSetup = true; return comboBox.ComboBox; } }
protected override void OnBuildToolBar (Toolbar tb) { base.OnBuildToolBar (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); }
public void CreateToolBar(Gtk.Toolbar toolbar) { toolbar.AppendItem(new Gtk.SeparatorToolItem()); toolbar.AppendItem(ZoomOut.CreateToolBarItem()); toolbar.AppendItem(ZoomComboBox); toolbar.AppendItem(ZoomIn.CreateToolBarItem()); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); tb.AppendItem(ModeLabel); tb.AppendItem(ModeDropDown); tb.AppendItem(Separator); tb.AppendItem(ToleranceLabel); tb.AppendItem(ToleranceSlider); }
public static Gtk.Widget MakeToolbarToggleButton(Gtk.Toolbar toolbar, string stock_id, System.EventHandler e) { Gtk.StockItem item = Gtk.StockItem.Zero; if (Gtk.StockManager.Lookup(stock_id, ref item)) { SignalFuncHelper helper = new SignalFuncHelper(e); // FIXME current gtk-sharp bindings don't have a null_ok flag on the // widget parameter so it is impossible to make a toggle button in toolbar. Gtk.Widget w; try { w = toolbar.AppendElement(Gtk.ToolbarChildType.Togglebutton, null, item.Label.Replace("_", null), null, null, new Gtk.Image(item.StockId, Gtk.IconSize.LargeToolbar), new Gtk.SignalFunc(helper.Func)); } catch { w = toolbar.AppendItem(item.Label.Replace("_", null), null, null, new Gtk.Image(item.StockId, Gtk.IconSize.LargeToolbar), new Gtk.SignalFunc(helper.Func)); } helper.Sender = w; return(w); } return(null); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); tb.AppendItem(SelectionSeparator); workspace.SelectionHandler.BuildToolbar(tb, Settings); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); 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, 50); } tb.AppendItem(tolerance_slider); }
public void CreateLayerWindowToolBar(Gtk.Toolbar toolbar) { toolbar.AppendItem(AddNewLayer.CreateToolBarItem()); toolbar.AppendItem(DeleteLayer.CreateToolBarItem()); toolbar.AppendItem(DuplicateLayer.CreateToolBarItem()); toolbar.AppendItem(MergeLayerDown.CreateToolBarItem()); toolbar.AppendItem(MoveLayerUp.CreateToolBarItem()); toolbar.AppendItem(MoveLayerDown.CreateToolBarItem()); toolbar.AppendItem(Properties.CreateToolBarItem()); }
public static Gtk.Window Create() { window = new Window ("Toolbar"); window.Resizable = false; toolbar = new Toolbar (); toolbar.InsertStock (Stock.New, "Stock icon: New", "Toolbar/New", new SignalFunc (set_small_icon), IntPtr.Zero, -1); toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open", new SignalFunc (set_large_icon), IntPtr.Zero, -1); toolbar.AppendSpace (); toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips", new Image (Stock.DialogInfo, IconSize.LargeToolbar), new SignalFunc (toggle_tooltips)); toolbar.AppendSpace (); toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal", new Image (Stock.GoForward, IconSize.LargeToolbar), new SignalFunc (set_horizontal)); toolbar.AppendItem ("Vertical", "Vertical layout", "Toolbar/Vertical", new Image (Stock.GoUp, IconSize.LargeToolbar), new SignalFunc (set_vertical)); toolbar.AppendSpace (); toolbar.AppendItem ("Icons", "Only show icons", "Toolbar/IconsOnly", new Image (Stock.Home, IconSize.LargeToolbar), new SignalFunc (set_icon_only)); toolbar.AppendItem ("Text", "Only show Text", "Toolbar/TextOnly", new Image (Stock.JustifyFill, IconSize.LargeToolbar), new SignalFunc (set_text_only)); toolbar.AppendItem ("Both", "Show both Icon & Text", "Toolbar/Both", new Image (Stock.Index, IconSize.LargeToolbar), new SignalFunc (set_both)); toolbar.AppendItem ("Both (Horizontal)", "Show Icon & Text horizontally", "Toolbar/BothHoriz", new Image (Stock.Index, IconSize.LargeToolbar), new SignalFunc (set_both_horiz)); toolbar.AppendSpace (); toolbar.InsertStock (Stock.Close, "Stock icon: Close", "Toolbar/Close", new SignalFunc (Close_Button), IntPtr.Zero, -1); window.Add (toolbar); window.ShowAll (); return window; }
public void CreateToolBar(Gtk.Toolbar toolbar) { toolbar.AppendItem(File.New.CreateToolBarItem()); toolbar.AppendItem(File.Open.CreateToolBarItem()); ToolItem recentExperimentButton = ConstrucRecentExperimentsMenuButton(); toolbar.AppendItem(recentExperimentButton); toolbar.AppendItem(File.Save.CreateToolBarItem()); toolbar.AppendItem(File.SaveAs.CreateToolBarItem()); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(File.PackageBuilder.CreateToolBarItem()); toolbar.AppendItem(File.Settings.CreateToolBarItem()); ToolItem helpMenuButton = ConstructHelpMenuButton(); toolbar.AppendItem(helpMenuButton); }
public static Gtk.Widget MakeToolbarButton(Gtk.Toolbar toolbar, string stock_id, string label, System.EventHandler e) { Gtk.StockItem item = Gtk.StockItem.Zero; if (Gtk.StockManager.Lookup(stock_id, ref item)) { SignalFuncHelper helper = new SignalFuncHelper(e); Gtk.Widget w = toolbar.AppendItem(label ?? item.Label.Replace("_", null), null, null, new Gtk.Image(item.StockId, Gtk.IconSize.LargeToolbar), new Gtk.SignalFunc(helper.Func)); helper.Sender = w; return(w); } return(null); }
protected override void OnBuildToolBar (Toolbar tb) { base.OnBuildToolBar(tb); 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); Gtk.ComboBox dpbBox = dashPBox.SetupToolbar(tb); if (dpbBox != null) { dpbBox.Changed += (o, e) => { dashPattern = dpbBox.ActiveText; }; } }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (font_label == null) { font_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Font"))); } tb.AppendItem(font_label); if (font_combo == null) { var fonts = PintaCore.System.Fonts.GetInstalledFonts(); fonts.Sort(); // Default to Arial or first in list int index = Math.Max(fonts.IndexOf("Arial"), 0); font_combo = new ToolBarFontComboBox(150, index, fonts.ToArray()); font_combo.ComboBox.Changed += HandleFontChanged; } tb.AppendItem(font_combo); if (spacer_label == null) { spacer_label = new ToolBarLabel(" "); } tb.AppendItem(spacer_label); if (size_combo == null) { size_combo = new ToolBarComboBox(65, 0, true); size_combo.ComboBox.Changed += HandleSizeChanged; } tb.AppendItem(size_combo); tb.AppendItem(new SeparatorToolItem()); if (bold_btn == null) { bold_btn = new ToolBarToggleButton("Toolbar.Bold.png", Catalog.GetString("Bold"), Catalog.GetString("Bold")); bold_btn.Toggled += HandleBoldButtonToggled; } tb.AppendItem(bold_btn); if (italic_btn == null) { italic_btn = new ToolBarToggleButton("Toolbar.Italic.png", Catalog.GetString("Italic"), Catalog.GetString("Italic")); italic_btn.Toggled += HandleItalicButtonToggled; } tb.AppendItem(italic_btn); if (underscore_btn == null) { underscore_btn = new ToolBarToggleButton("Toolbar.Underline.png", Catalog.GetString("Underline"), Catalog.GetString("Underline")); underscore_btn.Toggled += HandleUnderscoreButtonToggled; } tb.AppendItem(underscore_btn); tb.AppendItem(new SeparatorToolItem()); if (left_alignment_btn == null) { left_alignment_btn = new ToolBarToggleButton("Toolbar.LeftAlignment.png", Catalog.GetString("Left Align"), Catalog.GetString("Left Align")); left_alignment_btn.Active = true; left_alignment_btn.Toggled += HandleLeftAlignmentButtonToggled; } tb.AppendItem(left_alignment_btn); if (center_alignment_btn == null) { center_alignment_btn = new ToolBarToggleButton("Toolbar.CenterAlignment.png", Catalog.GetString("Center Align"), Catalog.GetString("Center Align")); center_alignment_btn.Toggled += HandleCenterAlignmentButtonToggled; } tb.AppendItem(center_alignment_btn); if (Right_alignment_btn == null) { Right_alignment_btn = new ToolBarToggleButton("Toolbar.RightAlignment.png", Catalog.GetString("Right Align"), Catalog.GetString("Right Align")); Right_alignment_btn.Toggled += HandleRightAlignmentButtonToggled; } tb.AppendItem(Right_alignment_btn); 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("Text Style"))); } tb.AppendItem(fill_label); if (fill_button == null) { fill_button = new ToolBarDropDownButton(); fill_button.AddItem(Catalog.GetString("Normal"), "ShapeTool.Fill.png", 0); fill_button.AddItem(Catalog.GetString("Normal and Outline"), "ShapeTool.OutlineFill.png", 1); fill_button.AddItem(Catalog.GetString("Outline"), "ShapeTool.Outline.png", 2); fill_button.AddItem(Catalog.GetString("Fill Background"), "TextTool.FillBackground.png", 3); fill_button.SelectedItemChanged += HandleBoldButtonToggled; } tb.AppendItem(fill_button); tb.AppendItem(new SeparatorToolItem()); if (outline_width_label == null) { outline_width_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Outline width"))); } tb.AppendItem(outline_width_label); if (outline_width_minus == null) { outline_width_minus = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease outline size")); outline_width_minus.Clicked += MinusButtonClickedEvent; } tb.AppendItem(outline_width_minus); if (outline_width == null) { outline_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"); (outline_width.Child as ComboBoxEntry).Changed += HandleSizeChanged; } tb.AppendItem(outline_width); if (outline_width_plus == null) { outline_width_plus = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase outline size")); outline_width_plus.Clicked += PlusButtonClickedEvent; } tb.AppendItem(outline_width_plus); UpdateFontSizes(); if (PintaCore.Workspace.HasOpenDocuments) { //Make sure the event handler is never added twice. PintaCore.Workspace.ActiveDocument.LayerCloned -= FinalizeText; //When an ImageSurface is Cloned, finalize the re-editable text (if applicable). PintaCore.Workspace.ActiveDocument.LayerCloned += FinalizeText; } }
public void CreateToolBar(Gtk.Toolbar toolbar) { toolbar.AppendItem(File.New.CreateToolBarItem()); toolbar.AppendItem(File.Open.CreateToolBarItem()); toolbar.AppendItem(File.Save.CreateToolBarItem()); // Printing is disabled for now until it is fully functional. #if false toolbar.AppendItem(File.Print.CreateToolBarItem()); #endif toolbar.AppendItem(new SeparatorToolItem()); // Cut/Copy/Paste comes before Undo/Redo on Windows if (PintaCore.System.OperatingSystem == OS.Windows) { toolbar.AppendItem(Edit.Cut.CreateToolBarItem()); toolbar.AppendItem(Edit.Copy.CreateToolBarItem()); toolbar.AppendItem(Edit.Paste.CreateToolBarItem()); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Edit.Undo.CreateToolBarItem()); toolbar.AppendItem(Edit.Redo.CreateToolBarItem()); } else { toolbar.AppendItem(Edit.Undo.CreateToolBarItem()); toolbar.AppendItem(Edit.Redo.CreateToolBarItem()); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Edit.Cut.CreateToolBarItem()); toolbar.AppendItem(Edit.Copy.CreateToolBarItem()); toolbar.AppendItem(Edit.Paste.CreateToolBarItem()); } toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Image.CropToSelection.CreateToolBarItem()); toolbar.AppendItem(Edit.Deselect.CreateToolBarItem()); }
protected virtual void OnBuildToolBar(Toolbar tb) { if (tool_label == null) tool_label = new ToolBarLabel (" Tool: "); tb.AppendItem (tool_label); if (tool_image == null) tool_image = new ToolBarImage (Icon); tb.AppendItem (tool_image); if (tool_sep == null) tool_sep = new SeparatorToolItem (); tb.AppendItem (tool_sep); }
protected override void OnBuildToolBar(Toolbar tb) { base.OnBuildToolBar (tb); if (brush_label == null) brush_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Type"))); if (brush_combo_box == null) { brush_combo_box = new ToolBarComboBox (100, 0, false); brush_combo_box.ComboBox.Changed += (o, e) => { Gtk.TreeIter iter; if (brush_combo_box.ComboBox.GetActiveIter (out iter)) { active_brush = (PaintBrush)brush_combo_box.Model.GetValue (iter, 1); } else { active_brush = default_brush; } }; foreach (var brush in PintaCore.PaintBrushes) { if (default_brush == null) default_brush = (PaintBrush)brush; brush_combo_box.Model.AppendValues (brush.Name, brush); } brush_combo_box.ComboBox.Active = 0; } tb.AppendItem (brush_label); tb.AppendItem (brush_combo_box); }
private void BuildAntialiasingTool(Toolbar tb) { if (antialiasing_button != null) { tb.AppendItem (antialiasing_button); return; } antialiasing_button = new ToolBarDropDownButton (); antialiasing_button.AddItem (Catalog.GetString ("Antialiasing On"), "Toolbar.AntiAliasingEnabledIcon.png", true); antialiasing_button.AddItem (Catalog.GetString ("Antialiasing Off"), "Toolbar.AntiAliasingDisabledIcon.png", false); tb.AppendItem (antialiasing_button); }
protected virtual void OnBuildToolBar(Toolbar tb) { if (tool_label == null) tool_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Tool"))); tb.AppendItem (tool_label); if (tool_image == null) tool_image = new ToolBarImage (Icon); tb.AppendItem (tool_image); if (tool_sep == null) tool_sep = new SeparatorToolItem (); tb.AppendItem (tool_sep); }
Toolbar CreateToolbar () { Toolbar toolbar = new Toolbar (); toolbar.ToolbarStyle = ToolbarStyle.Icons; toolbar.AppendItem ("Execute", "Execute SQL Commands.", String.Empty, new Gtk.Image (Stock.Execute, IconSize.SmallToolbar), new Gtk.SignalFunc (OnToolbar_Execute)); toolbar.AppendItem ("DataGrid", "Toggle Results to DataGrid or TextView", String.Empty, new Gtk.Image (Stock.GoDown, IconSize.SmallToolbar), new Gtk.SignalFunc (OnToolbar_ToggleResultsOutput)); return toolbar; }
public void CreateHistoryWindowToolBar(Gtk.Toolbar toolbar) { toolbar.AppendItem(Undo.CreateToolBarItem()); toolbar.AppendItem(Redo.CreateToolBarItem()); }
private void BuildAntialiasingTool(Toolbar tb) { Image antialiasing_on_icon = new Image (PintaCore.Resources.GetIcon ("Toolbar.AntiAliasingEnabledIcon.png")); antialiasing_on_icon.Show (); Image antialiasing_off_icon = new Image (PintaCore.Resources.GetIcon ("Toolbar.AntiAliasingDisabledIcon.png")); antialiasing_off_icon.Show (); antialiasing_btn = new ToggleToolButton (); antialiasing_btn.IconWidget = antialiasing_off_icon; antialiasing_btn.Show (); antialiasing_btn.Label = Catalog.GetString ("Antialiasing"); antialiasing_btn.TooltipText = Catalog.GetString ("Antialiasing"); antialiasing_btn.Toggled += delegate { if (antialiasing_btn.Active) antialiasing_btn.IconWidget = antialiasing_on_icon; else antialiasing_btn.IconWidget = antialiasing_off_icon; }; tb.AppendItem (antialiasing_btn); }
private void BuildAlphaBlending(Toolbar tb) { Image blending_on_icon = new Image (PintaCore.Resources.GetIcon ("Toolbar.BlendingEnabledIcon.png")); blending_on_icon.Show (); Image blending_off_icon = new Image (PintaCore.Resources.GetIcon ("Toolbar.BlendingOverwriteIcon.png")); blending_off_icon.Show (); alphablending_btn = new ToggleToolButton (); alphablending_btn.IconWidget = blending_off_icon; alphablending_btn.Show (); alphablending_btn.Label = Catalog.GetString ("Antialiasing"); alphablending_btn.TooltipText = Catalog.GetString ("Normal blending / Overwrite blending"); alphablending_btn.Toggled += delegate { if (alphablending_btn.Active) alphablending_btn.IconWidget = blending_on_icon; else alphablending_btn.IconWidget = blending_off_icon; }; tb.AppendItem (alphablending_btn); }
protected override void OnBuildToolBar(Toolbar tb) { base.OnBuildToolBar(tb); if (label_type == null) label_type = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Type"))); if (comboBox_type == null) { comboBox_type = new ToolBarComboBox (100, 0, false, Catalog.GetString ("Normal"), Catalog.GetString ("Smooth")); comboBox_type.ComboBox.Changed += (o, e) => { eraser_type = (EraserType)comboBox_type.ComboBox.Active; }; } tb.AppendItem (label_type); tb.AppendItem (comboBox_type); // Change the cursor when the BrushWidth is changed. brush_width.ComboBox.Changed += (sender, e) => SetCursor (DefaultCursor); }
public void CreateToolBar(Gtk.Toolbar toolbar) { toolbar.AppendItem(File.New.CreateToolBarItem()); toolbar.AppendItem(File.Open.CreateToolBarItem()); toolbar.AppendItem(File.Save.CreateToolBarItem()); //toolbar.AppendItem (File.Print.CreateToolBarItem ()); toolbar.AppendItem(new SeparatorToolItem()); // Cut/Copy/Paste comes before Undo/Redo on Windows if (PintaCore.System.OperatingSystem == OS.Windows) { toolbar.AppendItem(Edit.Cut.CreateToolBarItem()); toolbar.AppendItem(Edit.Copy.CreateToolBarItem()); toolbar.AppendItem(Edit.Paste.CreateToolBarItem()); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Edit.Undo.CreateToolBarItem()); toolbar.AppendItem(Edit.Redo.CreateToolBarItem()); } else { toolbar.AppendItem(Edit.Undo.CreateToolBarItem()); toolbar.AppendItem(Edit.Redo.CreateToolBarItem()); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Edit.Cut.CreateToolBarItem()); toolbar.AppendItem(Edit.Copy.CreateToolBarItem()); toolbar.AppendItem(Edit.Paste.CreateToolBarItem()); } toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Image.CropToSelection.CreateToolBarItem()); toolbar.AppendItem(Edit.Deselect.CreateToolBarItem()); View.CreateToolBar(toolbar); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(new ToolBarImage("StatusBar.CursorXY.png")); ToolBarLabel cursor = new ToolBarLabel(" 0, 0"); toolbar.AppendItem(cursor); PintaCore.Chrome.LastCanvasCursorPointChanged += delegate { Gdk.Point pt = PintaCore.Chrome.LastCanvasCursorPoint; cursor.Text = string.Format(" {0}, {1}", pt.X, pt.Y); }; }
protected virtual void BuildRasterizationToolItems(Toolbar tb) { if (ShowAlphaBlendingButton || ShowAntialiasingButton) tb.AppendItem (new SeparatorToolItem ()); if (ShowAntialiasingButton) BuildAntialiasingTool (tb); if (ShowAlphaBlendingButton) BuildAlphaBlending (tb); }
public void CreateToolBar(Gtk.Toolbar toolbar) { toolbar.AppendItem(File.New.CreateToolBarItem()); toolbar.AppendItem(File.Open.CreateToolBarItem()); toolbar.AppendItem(File.Save.CreateToolBarItem()); // Printing is disabled for now until it is fully functional. #if false toolbar.AppendItem(File.Print.CreateToolBarItem()); #endif toolbar.AppendItem(new SeparatorToolItem()); // Cut/Copy/Paste comes before Undo/Redo on Windows if (PintaCore.System.OperatingSystem == OS.Windows) { toolbar.AppendItem(Edit.Cut.CreateToolBarItem()); toolbar.AppendItem(Edit.Copy.CreateToolBarItem()); toolbar.AppendItem(Edit.Paste.CreateToolBarItem()); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Edit.Undo.CreateToolBarItem()); toolbar.AppendItem(Edit.Redo.CreateToolBarItem()); } else { toolbar.AppendItem(Edit.Undo.CreateToolBarItem()); toolbar.AppendItem(Edit.Redo.CreateToolBarItem()); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Edit.Cut.CreateToolBarItem()); toolbar.AppendItem(Edit.Copy.CreateToolBarItem()); toolbar.AppendItem(Edit.Paste.CreateToolBarItem()); } toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(Image.CropToSelection.CreateToolBarItem()); toolbar.AppendItem(Edit.Deselect.CreateToolBarItem()); View.CreateToolBar(toolbar); toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(new ToolBarImage("StatusBar.CursorXY.png")); ToolBarLabel cursor = new ToolBarLabel(" 0, 0"); toolbar.AppendItem(cursor); PintaCore.Chrome.LastCanvasCursorPointChanged += delegate { Gdk.Point pt = PintaCore.Chrome.LastCanvasCursorPoint; cursor.Text = string.Format(" {0}, {1}", pt.X, pt.Y); }; toolbar.AppendItem(new SeparatorToolItem()); toolbar.AppendItem(new ToolBarImage("Tools.RectangleSelect.png")); ToolBarLabel SelectionSize = new ToolBarLabel(" 0, 0"); toolbar.AppendItem(SelectionSize); PintaCore.Workspace.SelectionChanged += delegate { if (!PintaCore.Workspace.HasOpenDocuments) { SelectionSize.Text = " 0, 0"; return; } double minX = double.MaxValue; double minY = double.MaxValue; double maxX = double.MinValue; double maxY = double.MinValue; //Calculate the minimum rectangular bounds that surround the current selection. foreach (List <IntPoint> li in PintaCore.Workspace.ActiveDocument.Selection.SelectionPolygons) { foreach (IntPoint ip in li) { if (minX > ip.X) { minX = ip.X; } if (minY > ip.Y) { minY = ip.Y; } if (maxX < ip.X) { maxX = ip.X; } if (maxY < ip.Y) { maxY = ip.Y; } } } double xDiff = maxX - minX; double yDiff = maxY - minY; if (double.IsNegativeInfinity(xDiff)) { xDiff = 0d; } if (double.IsNegativeInfinity(yDiff)) { yDiff = 0d; } SelectionSize.Text = string.Format(" {0}, {1}", xDiff, yDiff); }; }
private void BuildAlphaBlending(Toolbar tb) { if (alphablending_button != null) { tb.AppendItem (alphablending_button); return; } alphablending_button = new ToolBarDropDownButton (); alphablending_button.AddItem (Catalog.GetString ("Normal Blending"), "Toolbar.BlendingEnabledIcon.png", true); alphablending_button.AddItem (Catalog.GetString ("Overwrite"), "Toolbar.BlendingOverwriteIcon.png", false); tb.AppendItem (alphablending_button); }
protected override void OnBuildToolBar(Toolbar tb) { base.OnBuildToolBar (tb); // Change the cursor when the BrushWidth is changed. brush_width.ComboBox.Changed += (sender, e) => SetCursor (DefaultCursor); tb.AppendItem (new Gtk.SeparatorToolItem ()); if (brush_label == null) brush_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Type"))); if (brush_combo_box == null) { brush_combo_box = new ToolBarComboBox (100, 0, false); brush_combo_box.ComboBox.Changed += (o, e) => { Gtk.TreeIter iter; if (brush_combo_box.ComboBox.GetActiveIter (out iter)) { active_brush = (BasePaintBrush)brush_combo_box.Model.GetValue (iter, 1); } else { active_brush = default_brush; } }; RebuildBrushComboBox (); } tb.AppendItem (brush_label); tb.AppendItem (brush_combo_box); }
protected override void OnBuildToolBar(Toolbar tb) { base.OnBuildToolBar(tb); 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); }
protected override void OnBuildToolBar(Toolbar tb) { base.OnBuildToolBar(tb); if (spacer_label == null) spacer_label = new ToolBarLabel (" "); tb.AppendItem (spacer_label); if (fill_outline_image == null) fill_outline_image = new ToolBarImage ("ShapeTool.OutlineFill.png"); tb.AppendItem (fill_outline_image); if (fill_outline_label == null) fill_outline_label = new ToolBarLabel (" : "); tb.AppendItem (fill_outline_label); if (fill_outline == null) fill_outline = new ToolBarComboBox (150, 0, false, "Outline Shape", "Fill Shape", "Fill and Outline Shape"); tb.AppendItem (fill_outline); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (font_label == null) { font_label = new ToolBarLabel(string.Format(" {0}: ", Translations.GetString("Font"))); } tb.AppendItem(font_label); if (font_button == null) { font_button = new (new FontButton() { ShowStyle = true, ShowSize = true, UseFont = true }); // Default to Arial if possible. font_button.Widget.Font = Settings.GetSetting(FONT_SETTING, "Arial 12"); font_button.Widget.FontSet += HandleFontChanged; } tb.AppendItem(font_button); tb.AppendItem(new SeparatorToolItem()); if (bold_btn == null) { bold_btn = new ToolBarToggleButton("Toolbar.Bold.png", Translations.GetString("Bold"), Translations.GetString("Bold")); bold_btn.Active = Settings.GetSetting(BOLD_SETTING, false); bold_btn.Toggled += HandleBoldButtonToggled; } tb.AppendItem(bold_btn); if (italic_btn == null) { italic_btn = new ToolBarToggleButton("Toolbar.Italic.png", Translations.GetString("Italic"), Translations.GetString("Italic")); italic_btn.Active = Settings.GetSetting(ITALIC_SETTING, false); italic_btn.Toggled += HandleItalicButtonToggled; } tb.AppendItem(italic_btn); if (underscore_btn == null) { underscore_btn = new ToolBarToggleButton("Toolbar.Underline.png", Translations.GetString("Underline"), Translations.GetString("Underline")); underscore_btn.Active = Settings.GetSetting(UNDERLINE_SETTING, false); underscore_btn.Toggled += HandleUnderscoreButtonToggled; } tb.AppendItem(underscore_btn); tb.AppendItem(new SeparatorToolItem()); var alignment = (TextAlignment)Settings.GetSetting(ALIGNMENT_SETTING, (int)TextAlignment.Left); if (left_alignment_btn == null) { left_alignment_btn = new ToolBarToggleButton("Toolbar.LeftAlignment.png", Translations.GetString("Left Align"), Translations.GetString("Left Align")); left_alignment_btn.Active = alignment == TextAlignment.Left; left_alignment_btn.Toggled += HandleLeftAlignmentButtonToggled; } tb.AppendItem(left_alignment_btn); if (center_alignment_btn == null) { center_alignment_btn = new ToolBarToggleButton("Toolbar.CenterAlignment.png", Translations.GetString("Center Align"), Translations.GetString("Center Align")); center_alignment_btn.Active = alignment == TextAlignment.Center; center_alignment_btn.Toggled += HandleCenterAlignmentButtonToggled; } tb.AppendItem(center_alignment_btn); if (Right_alignment_btn == null) { Right_alignment_btn = new ToolBarToggleButton("Toolbar.RightAlignment.png", Translations.GetString("Right Align"), Translations.GetString("Right Align")); Right_alignment_btn.Active = alignment == TextAlignment.Right; Right_alignment_btn.Toggled += HandleRightAlignmentButtonToggled; } tb.AppendItem(Right_alignment_btn); if (fill_sep == null) { fill_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(fill_sep); if (fill_label == null) { fill_label = new ToolBarLabel(string.Format(" {0}: ", Translations.GetString("Text Style"))); } tb.AppendItem(fill_label); if (fill_button == null) { fill_button = new ToolBarDropDownButton(); fill_button.AddItem(Translations.GetString("Normal"), Pinta.Resources.Icons.FillStyleFill, 0); fill_button.AddItem(Translations.GetString("Normal and Outline"), Pinta.Resources.Icons.FillStyleOutlineFill, 1); fill_button.AddItem(Translations.GetString("Outline"), Pinta.Resources.Icons.FillStyleOutline, 2); fill_button.AddItem(Translations.GetString("Fill Background"), Pinta.Resources.Icons.FillStyleBackground, 3); fill_button.SelectedIndex = Settings.GetSetting(STYLE_SETTING, 0); fill_button.SelectedItemChanged += HandleBoldButtonToggled; } tb.AppendItem(fill_button); if (outline_sep == null) { outline_sep = new SeparatorToolItem(); } tb.AppendItem(outline_sep); if (outline_width_label == null) { outline_width_label = new ToolBarLabel(string.Format(" {0}: ", Translations.GetString("Outline width"))); } tb.AppendItem(outline_width_label); if (outline_width == null) { outline_width = new (new SpinButton(1, 1e5, 1) { Value = Settings.GetSetting(OUTLINE_WIDTH_SETTING, 2) }); outline_width.Widget.ValueChanged += HandleFontChanged; } tb.AppendItem(outline_width); outline_width.Visible = outline_width_label.Visible = outline_sep.Visible = StrokeText; UpdateFont(); if (PintaCore.Workspace.HasOpenDocuments) { //Make sure the event handler is never added twice. PintaCore.Workspace.ActiveDocument.LayerCloned -= FinalizeText; //When an ImageSurface is Cloned, finalize the re-editable text (if applicable). PintaCore.Workspace.ActiveDocument.LayerCloned += FinalizeText; } }
protected override void OnBuildToolBar(Toolbar tb) { base.OnBuildToolBar (tb); if (brush_width_label == null) brush_width_label = new ToolBarLabel (" Brush width: "); tb.AppendItem (brush_width_label); if (brush_width_minus == null) { brush_width_minus = new ToolBarButton ("Toolbar.MinusButton.png", "", "Decrease brush size"); brush_width_minus.Clicked += MinusButtonClickedEvent; } tb.AppendItem (brush_width_minus); if (brush_width == null) brush_width = new ToolBarComboBox (50, 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", "", "Increase brush size"); brush_width_plus.Clicked += PlusButtonClickedEvent; } tb.AppendItem (brush_width_plus); if (spacer_label == null) spacer_label = new ToolBarLabel (" "); tb.AppendItem (spacer_label); if (fill_outline_image == null) fill_outline_image = new ToolBarImage ("ShapeTool.OutlineFill.png"); tb.AppendItem (fill_outline_image); if (fill_outline_label == null) fill_outline_label = new ToolBarLabel (" : "); tb.AppendItem (fill_outline_label); if (fill_outline == null) fill_outline = new ToolBarComboBox (150, 0, false, "Outline Shape", "Fill Shape", "Fill and Outline Shape"); tb.AppendItem (fill_outline); }