Exemple #1
0
        public CommandMapWindow()
            : base(Gtk.WindowType.Popup)
        {
            const int spacing = 5;

            TransientFor = PintaCore.Chrome.MainWindow;
            WindowPosition = WindowPosition.CenterOnParent;
            Opacity = 0.9;

            var eventBox = new CommandMapEventBox(this);
            var frame = new Frame ();
            HBox topLevelBox = new HBox();
            VBox vbox1 = new VBox();
            vbox1.Spacing = spacing;
            vbox1.BorderWidth = spacing;
            topLevelBox.Add(vbox1);
            VBox vbox2 = new VBox();
            vbox2.Spacing = spacing;
            vbox2.BorderWidth = spacing;
            topLevelBox.Add(vbox2);
            frame.Add(topLevelBox);
            eventBox.Add(frame);
            Add (eventBox);

            // Add rows for tools and box for tool toolbar.
            var tools = new CategoryBox("Tools");
            var toolsBox = new HBox();
            tools1 = new VBox();
            toolsBox.Add(tools1);
            tools2 = new VBox();
            toolsBox.Add(tools2);
            tools.Body.Add(toolsBox);
            vbox1.Add(tools);

            // Add the main toolbars.
            HBox main1 = new HBox ();
            main1.Spacing = spacing;
            var file = new CategoryBox ("File");
            var edit = new CategoryBox ("Edit");
            CreateButtons ("File", PintaCore.Actions.File.GetFileActions (), file.Body);
            CreateButtons ("Edit", PintaCore.Actions.Edit.GetEditActions (), edit.Body);
            main1.Add (file);
            main1.Add (edit);
            vbox2.Add (main1);

            HBox main2 = new HBox ();
            main2.Spacing = spacing;
            var select = new CategoryBox ("Select");
            var crop = new CategoryBox ("Crop");
            CreateButtons ("Select", PintaCore.Actions.Edit.GetSelectActions (), select.Body);
            CreateButtons ("Crop", PintaCore.Actions.Image.GetCropActions (), crop.Body);
            main2.Add (select);
            main2.Add (crop);
            vbox2.Add (main2);

            HBox main3 = new HBox ();
            main3.Spacing = spacing;
            var zoom = new CategoryBox ("Zoom");
            var transform = new CategoryBox ("Transform");
            CreateButtons ("Zoom", PintaCore.Actions.View.GetZoomActions (), zoom.Body);
            CreateButtons("Transform", PintaCore.Actions.Image.GetTransformActions(), transform.Body);
            main3.Add(transform);
            main3.Add (zoom);
            vbox2.Add (main3);

            HBox main4 = new HBox ();
            main4.Spacing = spacing;
            var layers = new CategoryBox ("Layers");
            var layer_transform = new CategoryBox ("Layer Transform");
            CreateButtons ("Layers", PintaCore.Actions.Layers.GetLayerActions (), layers.Body);
            CreateButtons ("Layer Transform", PintaCore.Actions.Layers.GetLayerTransformActions (), layer_transform.Body);
            main4.Add (layers);
            main4.Add (layer_transform);
            vbox2.Add (main4);

            // Add adjustments and add-ins manager.
            var adjustmentsRow = new HBox();
            adjustmentsRow.Spacing = spacing;

            var adjustments = new CategoryBox("Adjustments");
            AdjustmentsCommandMapBox = new HBox ();
            adjustments.Body.Add (AdjustmentsCommandMapBox);
            adjustmentsRow.Add(adjustments);

            var addins = new CategoryBox("Add-ins");
            CreateButtons("Add-ins", PintaCore.Actions.Addins.GetAddinActions(), addins.Body);
            adjustmentsRow.Add(addins);

            vbox2.Add (adjustmentsRow);

            // Add effects.
            var effects = new CategoryBox ("Effects");
            EffectsCommandMapBox = new VBox ();
            effects.Body.Add (EffectsCommandMapBox);
            vbox2.Add (effects);

            // Add quit, help, and palette frames.
            HBox main5 = new HBox ();
            main5.Spacing = spacing;
            var quit = new CategoryBox ("Quit");
            var help = new CategoryBox ("Help");
            var palette = new CategoryBox ("Palette");
            CreateButtons ("Quit", PintaCore.Actions.File.GetQuitActions (), quit.Body);
            CreateButtons ("Help", PintaCore.Actions.Help.GetHelpActions (), help.Body);
            CreateButtons ("Palette", PintaCore.Actions.Edit.GetPaletteActions (), palette.Body);
            main5.Add (palette);
            main5.Add (help);
            main5.Add (quit);
            vbox2.Add (main5);

            PintaCore.Tools.ToolAdded += HandleToolAdded;
            PintaCore.Tools.ToolRemoved += HandleToolRemoved;

            command_map_boxes = new List<HBox> ();
            command_map_buttons = new Dictionary<Gtk.Action, Button> ();
            command_map_button_boxes = new Dictionary<Gtk.Action, HBox> ();
            adjustment_command_map_buttons = new Dictionary<BaseEffect, Button> ();

            PintaCore.Effects.AddEffectEvent += AddEffect;
            PintaCore.Effects.RemoveEffectEvent += RemoveEffect;
            PintaCore.Effects.AddAdjustmentEvent += AddAdjustment;
        }
Exemple #2
0
        public CommandMapWindow() : base(Gtk.WindowType.Popup)
        {
            const int spacing = 5;

            TransientFor   = PintaCore.Chrome.MainWindow;
            WindowPosition = WindowPosition.CenterOnParent;
            Opacity        = 0.9;

            var  eventBox    = new CommandMapEventBox(this);
            var  frame       = new Frame();
            HBox topLevelBox = new HBox();
            VBox vbox1       = new VBox();

            vbox1.Spacing     = spacing;
            vbox1.BorderWidth = spacing;
            topLevelBox.Add(vbox1);
            VBox vbox2 = new VBox();

            vbox2.Spacing     = spacing;
            vbox2.BorderWidth = spacing;
            topLevelBox.Add(vbox2);
            frame.Add(topLevelBox);
            eventBox.Add(frame);
            Add(eventBox);

            // Add rows for tools and box for tool toolbar.
            var tools    = new CategoryBox("Tools");
            var toolsBox = new HBox();

            tools1 = new VBox();
            toolsBox.Add(tools1);
            tools2 = new VBox();
            toolsBox.Add(tools2);
            tools.Body.Add(toolsBox);
            vbox1.Add(tools);

            // Add the main toolbars.
            HBox main1 = new HBox();

            main1.Spacing = spacing;
            var file = new CategoryBox("File");
            var edit = new CategoryBox("Edit");

            CreateButtons("File", PintaCore.Actions.File.GetFileActions(), file.Body);
            CreateButtons("Edit", PintaCore.Actions.Edit.GetEditActions(), edit.Body);
            main1.Add(file);
            main1.Add(edit);
            vbox2.Add(main1);

            HBox main2 = new HBox();

            main2.Spacing = spacing;
            var select = new CategoryBox("Select");
            var crop   = new CategoryBox("Crop");

            CreateButtons("Select", PintaCore.Actions.Edit.GetSelectActions(), select.Body);
            CreateButtons("Crop", PintaCore.Actions.Image.GetCropActions(), crop.Body);
            main2.Add(select);
            main2.Add(crop);
            vbox2.Add(main2);

            HBox main3 = new HBox();

            main3.Spacing = spacing;
            var zoom      = new CategoryBox("Zoom");
            var transform = new CategoryBox("Transform");

            CreateButtons("Zoom", PintaCore.Actions.View.GetZoomActions(), zoom.Body);
            CreateButtons("Transform", PintaCore.Actions.Image.GetTransformActions(), transform.Body);
            main3.Add(transform);
            main3.Add(zoom);
            vbox2.Add(main3);

            HBox main4 = new HBox();

            main4.Spacing = spacing;
            var layers          = new CategoryBox("Layers");
            var layer_transform = new CategoryBox("Layer Transform");

            CreateButtons("Layers", PintaCore.Actions.Layers.GetLayerActions(), layers.Body);
            CreateButtons("Layer Transform", PintaCore.Actions.Layers.GetLayerTransformActions(), layer_transform.Body);
            main4.Add(layers);
            main4.Add(layer_transform);
            vbox2.Add(main4);

            // Add adjustments and add-ins manager.
            var adjustmentsRow = new HBox();

            adjustmentsRow.Spacing = spacing;

            var adjustments = new CategoryBox("Adjustments");

            AdjustmentsCommandMapBox = new HBox();
            adjustments.Body.Add(AdjustmentsCommandMapBox);
            adjustmentsRow.Add(adjustments);

            var addins = new CategoryBox("Add-ins");

            CreateButtons("Add-ins", PintaCore.Actions.Addins.GetAddinActions(), addins.Body);
            adjustmentsRow.Add(addins);

            vbox2.Add(adjustmentsRow);

            // Add effects.
            var effects = new CategoryBox("Effects");

            EffectsCommandMapBox = new VBox();
            effects.Body.Add(EffectsCommandMapBox);
            vbox2.Add(effects);

            // Add quit, help, and palette frames.
            HBox main5 = new HBox();

            main5.Spacing = spacing;
            var quit    = new CategoryBox("Quit");
            var help    = new CategoryBox("Help");
            var palette = new CategoryBox("Palette");

            CreateButtons("Quit", PintaCore.Actions.File.GetQuitActions(), quit.Body);
            CreateButtons("Help", PintaCore.Actions.Help.GetHelpActions(), help.Body);
            CreateButtons("Palette", PintaCore.Actions.Edit.GetPaletteActions(), palette.Body);
            main5.Add(palette);
            main5.Add(help);
            main5.Add(quit);
            vbox2.Add(main5);

            PintaCore.Tools.ToolAdded   += HandleToolAdded;
            PintaCore.Tools.ToolRemoved += HandleToolRemoved;

            command_map_boxes              = new List <HBox> ();
            command_map_buttons            = new Dictionary <Gtk.Action, Button> ();
            command_map_button_boxes       = new Dictionary <Gtk.Action, HBox> ();
            adjustment_command_map_buttons = new Dictionary <BaseEffect, Button> ();

            PintaCore.Effects.AddEffectEvent     += AddEffect;
            PintaCore.Effects.RemoveEffectEvent  += RemoveEffect;
            PintaCore.Effects.AddAdjustmentEvent += AddAdjustment;
        }