示例#1
0
文件: FloodTool.cs 项目: msiyer/Pinta
		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);
		}
示例#2
0
        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);
        }
示例#3
0
        protected override void OnBuildToolBar(Gtk.Toolbar tb)
        {
            base.OnBuildToolBar (tb);

            if (tool_select_label == null)
                tool_select_label = new ToolBarLabel (" 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, "Do not switch tool", "Switch to previous tool");//, "Switch to Pencil tool");

            tb.AppendItem (tool_select);
        }
示例#4
0
		protected override void OnBuildToolBar (Gtk.Toolbar tb)
		{
			base.OnBuildToolBar (tb);

			tb.AppendItem (new Gtk.SeparatorToolItem ());

			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);
		}
示例#5
0
		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);
		}
示例#6
0
        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);
        }
示例#7
0
        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);
            };

            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);
            };
        }
示例#8
0
 public void CreateToolBar(Gtk.Toolbar toolbar)
 {
     toolbar.AppendItem (new Gtk.SeparatorToolItem ());
     toolbar.AppendItem (ZoomOut.CreateToolBarItem ());
     toolbar.AppendItem (ZoomComboBox);
     toolbar.AppendItem (ZoomIn.CreateToolBarItem ());
     toolbar.AppendItem (new Gtk.SeparatorToolItem ());
     toolbar.AppendItem (PixelGrid.CreateToolBarItem ());
     toolbar.AppendItem (Rulers.CreateToolBarItem ());
     toolbar.AppendItem (new ToolBarLabel (" Units:  "));
     toolbar.AppendItem (UnitComboBox);
 }
示例#9
0
	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;
	}
示例#10
0
        protected override void OnBuildToolBar(Gtk.Toolbar tb)
        {
            base.OnBuildToolBar (tb);

            if (linear_gradient_btn == null) {
                linear_gradient_btn = new ToolBarToggleButton ("Toolbar.LinearGradient.png", Catalog.GetString ("Linear Gradient"), Catalog.GetString ("Linear Gradient"));
                linear_gradient_btn.Active = true;
                linear_gradient_btn.Toggled += HandleGradientTypeButtonToggled;;
            }

            tb.AppendItem (linear_gradient_btn);

            if (linear_reflected_gradient_btn == null) {
                linear_reflected_gradient_btn = new ToolBarToggleButton ("Toolbar.LinearReflectedGradient.png", Catalog.GetString ("Linear Reflected Gradient"), Catalog.GetString ("Linear Reflected Gradient"));
                linear_reflected_gradient_btn.Toggled += HandleGradientTypeButtonToggled;;
            }

            tb.AppendItem (linear_reflected_gradient_btn);

            if (diamond_gradient_btn == null) {
                diamond_gradient_btn = new ToolBarToggleButton ("Toolbar.DiamondGradient.png", Catalog.GetString ("Linear Diamond Gradient"), Catalog.GetString ("Linear Diamond Gradient"));
                diamond_gradient_btn.Toggled += HandleGradientTypeButtonToggled;;
            }

            tb.AppendItem (diamond_gradient_btn);

            if (radial_gradient_btn == null) {
                radial_gradient_btn = new ToolBarToggleButton ("Toolbar.RadialGradient.png", Catalog.GetString ("Radial Gradient"), Catalog.GetString ("Radial Gradient"));
                radial_gradient_btn.Toggled += HandleGradientTypeButtonToggled;;
            }

            tb.AppendItem (radial_gradient_btn);

            if (conical_gradient_btn == null) {
                conical_gradient_btn = new ToolBarToggleButton ("Toolbar.ConicalGradient.png", Catalog.GetString ("Conical Gradient"), Catalog.GetString ("Conical Gradient"));
                conical_gradient_btn.Toggled += HandleGradientTypeButtonToggled;;
            }

            tb.AppendItem (conical_gradient_btn);

            tb.AppendItem (new Gtk.SeparatorToolItem ());

            /***** ColorBgra mode *****/
            //TODO icons!
            if (color_mode_gradient_btn == null) {
                color_mode_gradient_btn = new ToolBarToggleButton ("ColorPalette.SwapIcon.png", Catalog.GetString ("Color Mode"), Catalog.GetString ("Color Mode"));
                color_mode_gradient_btn.Active = true;
                color_mode_gradient_btn.Toggled += HandleGradientColorModeButtonToggled;;
            }

            tb.AppendItem (color_mode_gradient_btn);

            if (transparency_mode_gradient_btn == null) {
                transparency_mode_gradient_btn = new ToolBarToggleButton ("ColorPalette.SwapIcon.png", Catalog.GetString ("Transparency Mode"), Catalog.GetString ("Transparency Mode"));
                transparency_mode_gradient_btn.Toggled += HandleGradientColorModeButtonToggled;;
            }

            tb.AppendItem (transparency_mode_gradient_btn);
        }
示例#11
0
        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);
        }
示例#12
0
 public void CreateHistoryWindowToolBar(Gtk.Toolbar toolbar)
 {
     toolbar.AppendItem (Undo.CreateToolBarItem ());
     toolbar.AppendItem (Redo.CreateToolBarItem ());
 }
示例#13
0
        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);
        }
示例#14
0
文件: TextTool.cs 项目: xxgreg/Pinta
        protected override void OnBuildToolBar(Gtk.Toolbar tb)
        {
            //TODO
            //fontSmoothing

            base.OnBuildToolBar (tb);

            if (font_label == null)
                font_label = new ToolBarLabel (" Font: ");

            tb.AppendItem (font_label);

            using (Pango.Context c = PangoHelper.ContextGet ()) {
                List<Pango.FontFamily> fonts = new List<Pango.FontFamily> (c.Families);

                List<string> entries = new List<string> ();
                fonts.ForEach (f => entries.Add (f.Name));
                entries.Sort ();

                //by default Arial!
                int index = entries.IndexOf ("Arial");
                if (index < 0)
                    index = 0;
                //FIXME: I put a try to handle a bug when I am debugging on monodevelop there is a an exception
                //this exception do not occure when I put a try catch ;(
                try {
                    if (font_combo == null) {
                        font_combo = new ToolBarComboBox (100, index, false, entries.ToArray ());
                        font_combo.ComboBox.Changed += HandleFontChanged;
                    }

                    tb.AppendItem (font_combo);

                    //size depend on font and modifier (italic, bold,...)
                    Pango.FontFamily fam = fonts.Find (f => f.Name == font_combo.ComboBox.ActiveText);

                    entries = new List<string> ();
                    foreach (int i in GetSizeList (fam.Faces[0])) {
                        entries.Add (i.ToString ());
                    }

                    //by default 11!
                    index = entries.IndexOf ("11");
                    if (index < 0)
                        index = 0;

                    if (size_combo == null) {
                        size_combo = new ToolBarComboBox (50, index, true, entries.ToArray ());

                        size_combo.ComboBox.Changed += HandleSizeChanged;
                        (size_combo.ComboBox as Gtk.ComboBoxEntry).Entry.FocusOutEvent += new Gtk.FocusOutEventHandler (HandleFontSizeFocusOut);
                        (size_combo.ComboBox as Gtk.ComboBoxEntry).Entry.FocusInEvent += new Gtk.FocusInEventHandler (HandleFontSizeFocusIn);
                    }

                    tb.AppendItem (size_combo);
                } catch (Exception e) {
                    Console.WriteLine (e.ToString ());
                }
            }
            tb.AppendItem (new SeparatorToolItem ());

            if (bold_btn == null) {
                bold_btn = new ToolBarToggleButton ("Toolbar.Bold.png", "Bold", "Bold the text");
                bold_btn.Toggled += HandleBoldButtonToggled;
            }

            tb.AppendItem (bold_btn);

            if (italic_btn == null) {
                italic_btn = new ToolBarToggleButton ("Toolbar.Italic.png", "Italic", "Italic the text");
                italic_btn.Toggled += HandleItalicButtonToggled;
                ;
            }

            tb.AppendItem (italic_btn);

            if (underscore_btn == null) {
                underscore_btn = new ToolBarToggleButton ("Toolbar.Underline.png", "Uncerline", "Underline the text");
                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", "Align left", "Align text to left");
                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", "Align center", "Align text to center");
                center_alignment_btn.Toggled += HandleCenterAlignmentButtonToggled;
                ;
            }

            tb.AppendItem (center_alignment_btn);

            if (Right_alignment_btn == null) {
                Right_alignment_btn = new ToolBarToggleButton ("Toolbar.RightAlignment.png", "Align right", "Align text to right");
                Right_alignment_btn.Toggled += HandleRightAlignmentButtonToggled;
                ;
            }

            tb.AppendItem (Right_alignment_btn);
        }
示例#15
0
        //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);
        }
示例#16
0
 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 ());
 }
示例#17
0
        protected override void OnBuildToolBar(Gtk.Toolbar tb)
        {
            base.OnBuildToolBar(tb);

            if (selection_sep == null)
                selection_sep = new Gtk.SeparatorToolItem();

            tb.AppendItem(selection_sep);

            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);
        }
示例#18
0
 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 ());
     toolbar.AppendItem (Edit.Cut.CreateToolBarItem ());
     toolbar.AppendItem (Edit.Copy.CreateToolBarItem ());
     toolbar.AppendItem (Edit.Paste.CreateToolBarItem ());
     toolbar.AppendItem (Image.CropToSelection.CreateToolBarItem ());
     toolbar.AppendItem (Edit.Deselect.CreateToolBarItem ());
     toolbar.AppendItem (new SeparatorToolItem ());
     toolbar.AppendItem (Edit.Undo.CreateToolBarItem ());
     toolbar.AppendItem (Edit.Redo.CreateToolBarItem ());
     View.CreateToolBar (toolbar);
 }
示例#19
0
        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;
                (size_combo.ComboBox as Gtk.ComboBoxEntry).Entry.FocusOutEvent += new Gtk.FocusOutEventHandler (HandleFontSizeFocusOut);
                (size_combo.ComboBox as Gtk.ComboBoxEntry).Entry.FocusInEvent += new Gtk.FocusInEventHandler (HandleFontSizeFocusIn);
            }

            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);

            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;
            }
        }
示例#20
0
        protected override void OnBuildToolBar(Gtk.Toolbar tb)
        {
            base.OnBuildToolBar (tb);

            if (tolerance_label == null)
                tolerance_label = new ToolBarLabel ("    Tolerance: ");

            tb.AppendItem (tolerance_label);

            if (tolerance_slider == null)
                tolerance_slider = new ToolBarSlider (0, 100, 1, 50);

            tb.AppendItem (tolerance_slider);
        }
示例#21
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            menu.Append (Undo.CreateAcceleratedMenuItem (Gdk.Key.Z, Gdk.ModifierType.ControlMask));

            ImageMenuItem redo = Redo.CreateAcceleratedMenuItem (Gdk.Key.Z, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);
            redo.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.Y, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (redo);

            menu.AppendSeparator ();
            menu.Append (Cut.CreateAcceleratedMenuItem (Gdk.Key.X, Gdk.ModifierType.ControlMask));
            menu.Append (Copy.CreateAcceleratedMenuItem (Gdk.Key.C, Gdk.ModifierType.ControlMask));
            menu.Append (Paste.CreateAcceleratedMenuItem (Gdk.Key.V, Gdk.ModifierType.ControlMask));
            menu.Append (PasteIntoNewLayer.CreateAcceleratedMenuItem (Gdk.Key.V, Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask));
            menu.Append (PasteIntoNewImage.CreateAcceleratedMenuItem (Gdk.Key.V, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask));

            menu.AppendSeparator ();
            menu.Append (SelectAll.CreateAcceleratedMenuItem (Gdk.Key.A, Gdk.ModifierType.ControlMask));

            ImageMenuItem deslect = Deselect.CreateAcceleratedMenuItem (Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);
            deslect.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.D, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (deslect);

            menu.AppendSeparator ();
            menu.Append (EraseSelection.CreateAcceleratedMenuItem (Gdk.Key.Delete, Gdk.ModifierType.None));
            menu.Append (FillSelection.CreateAcceleratedMenuItem (Gdk.Key.BackSpace, Gdk.ModifierType.None));
            //menu.Append (InvertSelection.CreateAcceleratedMenuItem (Gdk.Key.I, Gdk.ModifierType.ControlMask));

            menu.AppendSeparator ();
            Gtk.Action menu_action = new Gtk.Action ("Palette", Mono.Unix.Catalog.GetString ("Palette"), null, null);
            Menu palette_menu = (Menu) menu.AppendItem (menu_action.CreateSubMenuItem ()).Submenu;
            palette_menu.Append (LoadPalette.CreateMenuItem ());
            palette_menu.Append (SavePalette.CreateMenuItem ());
            palette_menu.Append (ResetPalette.CreateMenuItem ());
            palette_menu.Append (ResizePalette.CreateMenuItem ());
        }
示例#22
0
		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);
		}
示例#23
0
        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);

                // Change the cursor when the SampleSize is changed.
                sample_size.SelectedItemChanged += (sender, e) => SetCursor (DefaultCursor);

                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);
        }
示例#24
0
        // 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);
            }
        }
示例#25
0
	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;
	}
示例#26
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            MenuItem show_pad = (MenuItem)menu.Children[0];
            menu.Remove (show_pad);

            menu.Append (ToolBar.CreateMenuItem ());
            menu.Append (PixelGrid.CreateMenuItem ());
            menu.Append (Rulers.CreateMenuItem ());
            menu.AppendSeparator ();

            ImageMenuItem zoomin = ZoomIn.CreateAcceleratedMenuItem (Gdk.Key.plus, Gdk.ModifierType.ControlMask);
            zoomin.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.equal, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomin.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (zoomin);

            ImageMenuItem zoomout = ZoomOut.CreateAcceleratedMenuItem (Gdk.Key.minus, Gdk.ModifierType.ControlMask);
            zoomout.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.underscore, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomout.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (zoomout);

            ImageMenuItem actualsize = ActualSize.CreateAcceleratedMenuItem (Gdk.Key.Key_0, Gdk.ModifierType.ControlMask);
            actualsize.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask, AccelFlags.Visible));
            menu.Append (actualsize);
            menu.Append (ZoomToWindow.CreateAcceleratedMenuItem (Gdk.Key.B, Gdk.ModifierType.ControlMask));
            //menu.Append (ZoomToSelection.CreateAcceleratedMenuItem (Gdk.Key.B, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.Append (Fullscreen.CreateAcceleratedMenuItem (Gdk.Key.F11, Gdk.ModifierType.None));

            menu.AppendSeparator ();

            Gtk.Action unit_action = new Gtk.Action ("RulerUnits", Mono.Unix.Catalog.GetString ("Ruler Units"), null, null);
            Menu unit_menu = (Menu)menu.AppendItem (unit_action.CreateSubMenuItem ()).Submenu;
            unit_menu.Append (Pixels.CreateMenuItem ());
            unit_menu.Append (Inches.CreateMenuItem ());
            unit_menu.Append (Centimeters.CreateMenuItem ());

            menu.AppendSeparator ();
            menu.Append (show_pad);
        }
示例#27
0
        protected override void OnBuildToolBar(Gtk.Toolbar tb)
        {
            base.OnBuildToolBar (tb);

            if (mode_label == null)
                mode_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Fill mode")));

            tb.AppendItem (mode_label);

            if (mode_combo == null)
                mode_combo = new ToolBarComboBox (100, 0, false, Catalog.GetString ("Contiguous"), Catalog.GetString ("Global"));

            tb.AppendItem (mode_combo);

            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);
        }
示例#28
0
 public void CreateToolBar(Gtk.Toolbar toolbar)
 {
     toolbar.AppendItem (new Gtk.SeparatorToolItem ());
     toolbar.AppendItem (ZoomOut.CreateToolBarItem ());
     toolbar.AppendItem (ZoomComboBox);
     toolbar.AppendItem (ZoomIn.CreateToolBarItem ());
 }
示例#29
0
文件: ShapeTool.cs 项目: xxgreg/Pinta
        // 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 (" 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 (ShowStrokeComboBox) {
                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);
            }
        }
示例#30
0
        protected override void OnBuildToolBar(Gtk.Toolbar tb)
        {
            base.OnBuildToolBar (tb);

            if (mode_label == null)
                mode_label = new ToolBarLabel (" Fill mode: ");

            tb.AppendItem (mode_label);

            if (mode_combo == null)
                mode_combo = new ToolBarComboBox (100, 0, false, "Contiguous", "Global");

            tb.AppendItem (mode_combo);

            if (tolerance_label == null)
                tolerance_label = new ToolBarLabel ("    Tolerance: ");

            tb.AppendItem (tolerance_label);

            if (tolerance_slider == null)
                tolerance_slider = new ToolBarSlider (0, 100, 1, 0);

            tb.AppendItem (tolerance_slider);
        }