Ejemplo n.º 1
0
		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);
		}
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
		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;
				};
			}
		}
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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;
            }
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        public virtual void HandleBuildToolBar(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 += BrushMinusButtonClickedEvent;
            }

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

				brush_width.ComboBox.Changed += (o, e) =>
				{
					ShapeEngine selEngine = SelectedShapeEngine;

					if (selEngine != null)
					{
						selEngine.BrushWidth = BrushWidth;
                        StorePreviousSettings ();
                        DrawActiveShape (false, false, true, false, false);
					}
				};
			}

            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 += BrushPlusButtonClickedEvent;
            }

            tb.AppendItem(brush_width_plus);

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

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

			tb.AppendItem(shape_type_sep);

			if (shape_type_label == null)
				shape_type_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Shape Type")));

			tb.AppendItem(shape_type_label);

			if (shape_type_button == null)
			{
				shape_type_button = new ToolBarDropDownButton();

				shape_type_button.AddItem(Catalog.GetString("Open Line/Curve Series"), "Tools.Line.png", 0);
				shape_type_button.AddItem(Catalog.GetString("Closed Line/Curve Series"), "Tools.Rectangle.png", 1);
				shape_type_button.AddItem(Catalog.GetString("Ellipse"), "Tools.Ellipse.png", 2);
				shape_type_button.AddItem(Catalog.GetString("Rounded Line Series"), "Tools.RoundedRectangle.png", 3);

				shape_type_button.SelectedItemChanged += (o, e) =>
				{
					ShapeTypes newShapeType = ShapeType;
					ShapeEngine selEngine = SelectedShapeEngine;

					if (selEngine != null)
					{
						//Verify that the tool needs to be switched.
						if (GetCorrespondingTool(newShapeType) != this.owner)
						{
							//Create a new ShapesModifyHistoryItem so that the changing of the shape type can be undone.
							PintaCore.Workspace.ActiveDocument.History.PushNewItem(new ShapesModifyHistoryItem(
								this, owner.Icon, Catalog.GetString("Changed Shape Type")));

							//Clone the old shape; it should be automatically garbage-collected. newShapeType already has the updated value.
							selEngine = selEngine.Convert(newShapeType, SelectedShapeIndex);

							int previousSSI = SelectedShapeIndex;

							ActivateCorrespondingTool(selEngine.ShapeType, true);

							SelectedShapeIndex = previousSSI;

							//Draw the updated shape with organized points generation (for mouse detection). 
							DrawActiveShape(true, false, true, false, true);
						}
					}
				};
			}

			shape_type_button.SelectedItem = shape_type_button.Items[(int)owner.ShapeType];

			tb.AppendItem(shape_type_button);


            Gtk.ComboBox dpbBox = dash_pattern_box.SetupToolbar(tb);

            if (dpbBox != null)
            {
                dpbBox.Changed += (o, e) =>
                {
					ShapeEngine selEngine = SelectedShapeEngine;

					if (selEngine != null)
					{
						selEngine.DashPattern = dpbBox.ActiveText;
                        StorePreviousSettings ();
                        DrawActiveShape (false, false, true, false, false);
					}
                };
            }
        }