Example #1
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);
        }
Example #2
0
        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);
        }
Example #3
0
        /// <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.ComboBoxText?SetupToolbar(Toolbar tb)
        {
            if (dashPatternSep == null)
            {
                dashPatternSep = new SeparatorToolItem();
            }

            tb.AppendItem(dashPatternSep);

            if (dashPatternLabel == null)
            {
                dashPatternLabel = new ToolBarLabel(string.Format(" {0}: ", Translations.GetString("Dash")));
            }

            tb.AppendItem(dashPatternLabel);

            if (comboBox == null)
            {
                comboBox = new ToolBarComboBox(50, 0, true,
                                               "-", " -", " --", " ---", "  -", "   -", " - --", " - - --------", " - - ---- - ----");
            }

            tb.AppendItem(comboBox);

            if (dashChangeSetup)
            {
                return(null);
            }
            else
            {
                dashChangeSetup = true;

                return(comboBox.ComboBox);
            }
        }
Example #4
0
        protected override void OnBuildToolBar(Toolbar tb)
        {
            base.OnBuildToolBar(tb);

            tb.AppendItem(TypeLabel);
            tb.AppendItem(TypeComboBox);
        }
Example #5
0
        protected override void OnBuildToolBar(Toolbar tb)
        {
            base.OnBuildToolBar(tb);

            tb.AppendItem(Separator);

            tb.AppendItem(BrushLabel);
            tb.AppendItem(BrushComboBox);
        }
Example #6
0
        protected override void OnBuildToolBar(Toolbar tb)
        {
            base.OnBuildToolBar(tb);

            tb.AppendItem(Separator);

            tb.AppendItem(ToleranceLabel);
            tb.AppendItem(ToleranceSlider);
        }
Example #7
0
        protected override void OnBuildToolBar(Toolbar tb)
        {
            base.OnBuildToolBar(tb);

            tb.AppendItem(BrushWidthLabel);
            tb.AppendItem(BrushWidthSpinButton);

            // Change the cursor when the BrushWidth is changed.
            BrushWidthSpinButton.Widget.ValueChanged += (sender, e) => SetCursor(DefaultCursor);
        }
Example #8
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);
        }
Example #9
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);
        }
Example #10
0
        public override void HandleBuildToolBar(Toolbar tb, ISettingsService settings, string toolPrefix)
        {
            base.HandleBuildToolBar(tb, settings, toolPrefix);

            this.settings = settings;
            tool_prefix   = toolPrefix;
            toolbar       = tb;

            tb.AppendItem(ArrowSeparator);
            tb.AppendItem(ArrowLabel);
            tb.AppendItem(ArrowOneEnabledCheckBox);
            tb.AppendItem(ArrowTwoEnabledCheckBox);

            extra_toolbar_items_added = false;

            UpdateArrowOptionToolbarItems(true);
        }
Example #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);


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

            if (dpbBox != null)
            {
                dpbBox.Changed += (o, e) =>
                {
                    dashPattern = dpbBox.ActiveText;
                };
            }
        }
Example #12
0
        protected override void OnBuildToolBar(Toolbar tb)
        {
            base.OnBuildToolBar(tb);

            tb.AppendItem(Separator);
            tb.AppendItem(FillLabel);
            tb.AppendItem(FillDropDown);

            // TODO: This could be cleaner.
            // This will only return an item on the first setup so we only add the handler once.
            var dash_pattern_box = dashPBox.SetupToolbar(tb);

            if (dash_pattern_box != null)
            {
                dash_pattern_box.Entry.Text = Settings.GetSetting(DASH_PATTERN_SETTING, "-");

                dash_pattern_box.Changed += (o, e) => {
                    dash_pattern = dash_pattern_box.ActiveText;
                };
            }
        }
Example #13
0
        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);
        }
Example #14
0
        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);

            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);
        }
Example #15
0
        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);
        }
Example #16
0
        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);
        }
Example #17
0
        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);
        }
Example #18
0
        protected virtual void BuildRasterizationToolItems(Toolbar tb)
        {
            if (ShowAlphaBlendingButton || ShowAntialiasingButton)
            {
                tb.AppendItem(new SeparatorToolItem());
            }

            if (ShowAntialiasingButton)
            {
                BuildAntialiasingTool(tb);
            }
            if (ShowAlphaBlendingButton)
            {
                BuildAlphaBlending(tb);
            }
        }
Example #19
0
        protected override void OnBuildToolBar(Toolbar tb)
        {
            base.OnBuildToolBar(tb);

            tb.AppendItem(SamplingLabel);
            tb.AppendItem(SampleSizeDropDown);
            tb.AppendItem(SampleTypeDropDown);

            tb.AppendItem(Separator);

            tb.AppendItem(ToolSelectionLabel);
            tb.AppendItem(ToolSelectionDropDown);
        }
Example #20
0
        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)
            {
                var      name   = Name;
                var      width  = PintaCore.Settings.GetSetting("brush-width-" + name, 2);
                string[] widths = { "1",  "2",  "3",  "4",  "5",  "6",  "7",  "8",  "9",
                                    "10", "11", "12", "13", "14", "15", "20", "25", "30","35",
                                    "40", "45", "50", "55" };

                var activeIndex = 1;
                for (var n = 0; n < widths.Length; n++)
                {
                    if (int.Parse(widths[n]) == width)
                    {
                        activeIndex = n;
                        break;
                    }
                }


                brush_width = new ToolBarComboBox(65, activeIndex, true, widths);
                SetCursor(DefaultCursor);

                brush_width.ComboBox.Changed += (sender, e) => {
                    int w;

                    if (int.TryParse(brush_width.ComboBox.ActiveText, out w))
                    {
                        if (w > 0)
                        {
                            ((ComboBoxEntry)brush_width.ComboBox).Entry.Text = w.ToString();
                        }
                        else
                        {
                            w = DEFAULT_BRUSH_WIDTH;
                        }
                    }
                    else
                    {
                        w = DEFAULT_BRUSH_WIDTH;
                    }

                    BrushWidth = w;
                    SetCursor(DefaultCursor);
                };
            }

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