Example #1
0
        public ViewActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.View.ActualSize.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ActualSize.png")));
            fact.Add ("Menu.View.Grid.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Grid.png")));
            fact.Add ("Menu.View.Rulers.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Rulers.png")));
            fact.Add ("Menu.View.ZoomIn.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomIn.png")));
            fact.Add ("Menu.View.ZoomOut.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomOut.png")));
            fact.Add ("Menu.View.ZoomToSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToSelection.png")));
            fact.Add ("Menu.View.ZoomToWindow.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToWindow.png")));
            fact.AddDefault ();

            ZoomIn = new Gtk.Action ("ZoomIn", Catalog.GetString ("Zoom In"), null, Stock.ZoomIn);
            ZoomOut = new Gtk.Action ("ZoomOut", Catalog.GetString ("Zoom Out"), null, Stock.ZoomOut);
            ZoomToWindow = new Gtk.Action ("ZoomToWindow", Catalog.GetString ("Zoom to Window"), null, Stock.ZoomFit);
            ZoomToSelection = new Gtk.Action ("ZoomToSelection", Catalog.GetString ("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
            ActualSize = new Gtk.Action ("ActualSize", Catalog.GetString ("Actual Size"), null, Stock.Zoom100);
            PixelGrid = new Gtk.ToggleAction ("PixelGrid", Catalog.GetString ("Pixel Grid"), null, "Menu.View.Grid.png");
            Rulers = new Gtk.ToggleAction ("Rulers", Catalog.GetString ("Rulers"), null, "Menu.View.Rulers.png");
            Pixels = new Gtk.Action ("Pixels", Catalog.GetString ("Pixels"), null, null);
            Inches = new Gtk.Action ("Inches", Catalog.GetString ("Inches"), null, null);
            Centimeters = new Gtk.Action ("Centimeters", Catalog.GetString ("Centimeters"), null, null);
            Fullscreen = new Gtk.Action ("Fullscreen", Catalog.GetString ("Fullscreen"), null, Stock.Fullscreen);

            ZoomComboBox = new ToolBarComboBox (75, 11, true, "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%", "Window");
            UnitComboBox = new ToolBarComboBox (100, 0, false, Catalog.GetString ("Pixels"), Catalog.GetString ("Inches"), Catalog.GetString ("Centimeters"));
        }
Example #2
0
        /// <summary>
        /// Register a new adjustment with Pinta, causing it to be added to the Adjustments menu.
        /// </summary>
        /// <param name="adjustment">The adjustment to register</param>
        /// <returns>The action created for this adjustment</returns>
        public Gtk.Action RegisterAdjustment(BaseEffect adjustment)
        {
            // Add icon to IconFactory
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add (adjustment.Icon, new Gtk.IconSet (PintaCore.Resources.GetIcon (adjustment.Icon)));
            fact.AddDefault ();

            // Create a gtk action for each adjustment
            Gtk.Action act = new Gtk.Action (adjustment.GetType ().Name, adjustment.Name + (adjustment.IsConfigurable ? Catalog.GetString ("...") : ""), string.Empty, adjustment.Icon);
            act.Activated += delegate (object sender, EventArgs e) { PintaCore.LivePreview.Start (adjustment); };

            PintaCore.Actions.Adjustments.Actions.Add (act);

            // Create a menu item for each adjustment
            MenuItem menu_item;

            // If no key is specified, don't use an accelerated menu item
            if (adjustment.AdjustmentMenuKey == (Gdk.Key)0)
                menu_item = (MenuItem)act.CreateMenuItem ();
            else
                menu_item = act.CreateAcceleratedMenuItem (adjustment.AdjustmentMenuKey, adjustment.AdjustmentMenuKeyModifiers);

            ((Menu)((ImageMenuItem)PintaCore.Chrome.MainMenu.Children[5]).Submenu).AppendMenuItemSorted (menu_item);

            adjustments.Add (adjustment, act);
            adjustment_menuitems.Add (adjustment, menu_item);

            return act;
        }
Example #3
0
        public FileActions()
        {
            New           = new Gtk.Action("New", Catalog.GetString("New..."), null, Stock.New);
            NewScreenshot = new Gtk.Action("NewScreenshot", Catalog.GetString("New Screenshot..."), null, Stock.Fullscreen);
            Open          = new Gtk.Action("Open", Catalog.GetString("Open..."), null, Stock.Open);
            OpenRecent    = new RecentAction("OpenRecent", Catalog.GetString("Open Recent"), null, Stock.Open, RecentManager.Default);

            RecentFilter recentFilter = new RecentFilter();

            recentFilter.AddApplication("Pinta");

            (OpenRecent as RecentAction).AddFilter(recentFilter);

            Close  = new Gtk.Action("Close", Catalog.GetString("Close"), null, Stock.Close);
            Save   = new Gtk.Action("Save", Catalog.GetString("Save"), null, Stock.Save);
            SaveAs = new Gtk.Action("SaveAs", Catalog.GetString("Save As..."), null, Stock.SaveAs);
            Print  = new Gtk.Action("Print", Catalog.GetString("Print"), null, Stock.Print);
            Exit   = new Gtk.Action("Exit", Catalog.GetString("Quit"), null, Stock.Quit);

            New.ShortLabel   = Catalog.GetString("New");
            Open.ShortLabel  = Catalog.GetString("Open");
            Open.IsImportant = true;
            Save.IsImportant = true;

            Close.Sensitive = false;
            Print.Sensitive = false;
        }
Example #4
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        UiManagerHelper uiManagerHelper = new UiManagerHelper(UIManager);

        ActionGroup actionGroup1 = new ActionGroup("pageActionGroup");
        Gtk.Action newAction = new Gtk.Action("newAction", null, null, Stock.New);
        actionGroup1.Add (newAction);
        Gtk.Action editAction = new Gtk.Action("editAction", null, null, Stock.Edit);
        actionGroup1.Add (editAction);

        ActionGroup actionGroup2 = new ActionGroup("pageActionGroup");
        Gtk.Action deleteAction = new Gtk.Action("deleteAction", null, null, Stock.Delete);
        actionGroup2.Add (deleteAction);

        ActionGroup currentActionGroup = actionGroup1;
        uiManagerHelper.SetActionGroup (currentActionGroup);

        executeAction.Activated += delegate {
            Console.WriteLine("executeAction.Activated");
            if (currentActionGroup == actionGroup1)
                currentActionGroup = actionGroup2;
            else
                currentActionGroup = actionGroup1;
            uiManagerHelper.SetActionGroup(currentActionGroup);
        };
    }
Example #5
0
        public ToolBarItem(string text, string imageId)
        {
            Text    = text;
            ImageId = imageId;

            Action = new Gtk.Action(Text, Text, string.Empty, imageId);
        }
Example #6
0
        public ImageActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.Image.CanvasSize.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.CanvasSize.png")));
            fact.Add ("Menu.Image.Crop.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.Crop.png")));
            fact.Add ("Menu.Image.Flatten.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.Flatten.png")));
            fact.Add ("Menu.Image.FlipHorizontal.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.FlipHorizontal.png")));
            fact.Add ("Menu.Image.FlipVertical.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.FlipVertical.png")));
            fact.Add ("Menu.Image.Resize.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.Resize.png")));
            fact.Add ("Menu.Image.Rotate180CW.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.Rotate180CW.png")));
            fact.Add ("Menu.Image.Rotate90CCW.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.Rotate90CCW.png")));
            fact.Add ("Menu.Image.Rotate90CW.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Image.Rotate90CW.png")));
            fact.AddDefault ();

            CropToSelection = new Gtk.Action ("CropToSelection", Catalog.GetString ("Crop to Selection"), null, "Menu.Image.Crop.png");
            AutoCrop = new Gtk.Action ("AutoCrop", Catalog.GetString ("Auto Crop"), null, "Menu.Image.Crop.png");
            Resize = new Gtk.Action ("Resize", Catalog.GetString ("Resize Image..."), null, "Menu.Image.Resize.png");
            CanvasSize = new Gtk.Action ("CanvasSize", Catalog.GetString ("Resize Canvas..."), null, "Menu.Image.CanvasSize.png");
            FlipHorizontal = new Gtk.Action ("FlipHorizontal", Catalog.GetString ("Flip Horizontal"), null, "Menu.Image.FlipHorizontal.png");
            FlipVertical = new Gtk.Action ("FlipVertical", Catalog.GetString ("Flip Vertical"), null, "Menu.Image.FlipVertical.png");
            RotateCW = new Gtk.Action ("RotateCW", Catalog.GetString ("Rotate 90° Clockwise"), null, "Menu.Image.Rotate90CW.png");
            RotateCCW = new Gtk.Action ("RotateCCW", Catalog.GetString ("Rotate 90° Counter-Clockwise"), null, "Menu.Image.Rotate90CCW.png");
            Rotate180 = new Gtk.Action ("Rotate180", Catalog.GetString ("Rotate 180°"), null, "Menu.Image.Rotate180CW.png");
            Flatten = new Gtk.Action ("Flatten", Catalog.GetString ("Flatten"), null, "Menu.Image.Flatten.png");

            CropToSelection.Sensitive = false;
        }
Example #7
0
        public EditActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.Edit.Deselect.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.Deselect.png")));
            fact.Add ("Menu.Edit.EraseSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.EraseSelection.png")));
            fact.Add ("Menu.Edit.FillSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.FillSelection.png")));
            fact.Add ("Menu.Edit.InvertSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.InvertSelection.png")));
            fact.Add ("Menu.Edit.SelectAll.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.SelectAll.png")));
            fact.AddDefault ();

            Undo = new Gtk.Action ("Undo", Catalog.GetString ("Undo"), null, Stock.Undo);
            Redo = new Gtk.Action ("Redo", Catalog.GetString ("Redo"), null, Stock.Redo);
            Cut = new Gtk.Action ("Cut", Catalog.GetString ("Cut"), null, Stock.Cut);
            Copy = new Gtk.Action ("Copy", Catalog.GetString ("Copy"), null, Stock.Copy);
            Paste = new Gtk.Action ("Paste", Catalog.GetString ("Paste"), null, Stock.Paste);

                PasteSubmenu = new Gtk.Action("Paste into", Catalog.GetString("Paste into..."), null, Stock.Paste);
                PasteIntoNewImage = new Gtk.Action("PasteIntoNewImage", Catalog.GetString("New image"), null, Stock.New);
                PasteIntoNewLayer = new Gtk.Action("PasteIntoNewLayer", Catalog.GetString("New layer"), null, "Menu.Layers.AddNewLayer.png");

            EraseSelection = new Gtk.Action ("EraseSelection", Catalog.GetString ("Erase Selection"), null, "Menu.Edit.EraseSelection.png");
            FillSelection = new Gtk.Action ("FillSelection", Catalog.GetString ("Fill Selection"), null, "Menu.Edit.FillSelection.png");
            InvertSelection = new Gtk.Action ("InvertSelection", Catalog.GetString ("Invert Selection"), null, "Menu.Edit.InvertSelection.png");
            SelectAll = new Gtk.Action ("SelectAll", Catalog.GetString ("Select All"), null, Stock.SelectAll);
            Deselect = new Gtk.Action ("Deselect", Catalog.GetString ("Deselect"), null, "Menu.Edit.Deselect.png");

            Undo.IsImportant = true;
            Undo.Sensitive = false;
            Redo.Sensitive = false;
            InvertSelection.Sensitive = false;
            Deselect.Sensitive = false;
            EraseSelection.Sensitive = false;
            FillSelection.Sensitive = false;
        }
Example #8
0
        public EditActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.Edit.Deselect.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.Deselect.png")));
            fact.Add ("Menu.Edit.EraseSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.EraseSelection.png")));
            fact.Add ("Menu.Edit.FillSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.FillSelection.png")));
            fact.Add ("Menu.Edit.InvertSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.InvertSelection.png")));
            fact.Add ("Menu.Edit.SelectAll.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.SelectAll.png")));
            fact.AddDefault ();

            Undo = new Gtk.Action ("Undo", Mono.Unix.Catalog.GetString ("Undo"), null, "gtk-undo");
            Redo = new Gtk.Action ("Redo", Mono.Unix.Catalog.GetString ("Redo"), null, "gtk-redo");
            Cut = new Gtk.Action ("Cut", Mono.Unix.Catalog.GetString ("Cut"), null, "gtk-cut");
            Copy = new Gtk.Action ("Copy", Mono.Unix.Catalog.GetString ("Copy"), null, "gtk-copy");
            Paste = new Gtk.Action ("Paste", Mono.Unix.Catalog.GetString ("Paste"), null, "gtk-paste");
            PasteIntoNewLayer = new Gtk.Action ("PasteIntoNewLayer", Mono.Unix.Catalog.GetString ("Paste Into New Layer"), null, "gtk-paste");
            PasteIntoNewImage = new Gtk.Action ("PasteIntoNewImage", Mono.Unix.Catalog.GetString ("Paste Into New Image"), null, "gtk-paste");
            EraseSelection = new Gtk.Action ("EraseSelection", Mono.Unix.Catalog.GetString ("Erase Selection"), null, "Menu.Edit.EraseSelection.png");
            FillSelection = new Gtk.Action ("FillSelection", Mono.Unix.Catalog.GetString ("Fill Selection"), null, "Menu.Edit.FillSelection.png");
            InvertSelection = new Gtk.Action ("InvertSelection", Mono.Unix.Catalog.GetString ("Invert Selection"), null, "Menu.Edit.InvertSelection.png");
            SelectAll = new Gtk.Action ("SelectAll", Mono.Unix.Catalog.GetString ("Select All"), null, "Menu.Edit.SelectAll.png");
            Deselect = new Gtk.Action ("Deselect", Mono.Unix.Catalog.GetString ("Deselect"), null, "Menu.Edit.Deselect.png");

            Undo.Sensitive = false;
            Redo.Sensitive = false;
            PasteIntoNewImage.Sensitive = false;
            InvertSelection.Sensitive = false;
            Deselect.Sensitive = false;
        }
Example #9
0
        public FileActions()
        {
            New = new Gtk.Action ("New", Catalog.GetString ("New..."), null, Stock.New);
            Open = new Gtk.Action ("Open", Catalog.GetString ("Open..."), null, Stock.Open);
            OpenRecent = new RecentAction ("OpenRecent", Catalog.GetString ("Open Recent"), null, Stock.Open, RecentManager.Default);

            RecentFilter recentFilter = new RecentFilter ();
            recentFilter.AddApplication ("Pinta");

            (OpenRecent as RecentAction).AddFilter (recentFilter);

            recentData = new RecentData ();
            recentData.AppName = "Pinta";
            recentData.AppExec = GetExecutablePathname ();
            recentData.MimeType = "image/*";

            lastDialogDir = System.Environment.GetFolderPath (Environment.SpecialFolder.MyPictures);

            Close = new Gtk.Action ("Close", Catalog.GetString ("Close"), null, Stock.Close);
            Save = new Gtk.Action ("Save", Catalog.GetString ("Save"), null, Stock.Save);
            SaveAs = new Gtk.Action ("SaveAs", Catalog.GetString ("Save As..."), null, Stock.SaveAs);
            Print = new Gtk.Action ("Print", Catalog.GetString ("Print"), null, Stock.Print);
            Exit = new Gtk.Action ("Exit", Catalog.GetString ("Quit"), null, Stock.Quit);

            New.ShortLabel = Catalog.GetString ("New");
            Open.ShortLabel = Catalog.GetString ("Open");
            Open.IsImportant = true;
            Save.IsImportant = true;

            Close.Sensitive = false;
            Print.Sensitive = false;
        }
Example #10
0
        /// <summary>
        /// Register a new adjustment with Pinta, causing it to be added to the Adjustments menu.
        /// </summary>
        /// <param name="adjustment">The adjustment to register</param>
        /// <returns>The action created for this adjustment</returns>
        public Gtk.Action RegisterAdjustment(BaseEffect adjustment)
        {
            // Add icon to IconFactory
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add(adjustment.Icon, new Gtk.IconSet(PintaCore.Resources.GetIcon(adjustment.Icon)));
            fact.AddDefault();

            // Create a gtk action for each adjustment
            Gtk.Action act = new Gtk.Action(adjustment.GetType().Name, adjustment.Name + (adjustment.IsConfigurable ? Catalog.GetString("...") : ""), string.Empty, adjustment.Icon);
            act.Activated += delegate(object sender, EventArgs e) { PintaCore.LivePreview.Start(adjustment); };

            PintaCore.Actions.Adjustments.Actions.Add(act);

            // Create a menu item for each adjustment
            MenuItem menu_item;

            // If no key is specified, don't use an accelerated menu item
            if (adjustment.AdjustmentMenuKey == (Gdk.Key) 0)
            {
                menu_item = (MenuItem)act.CreateMenuItem();
            }
            else
            {
                menu_item = act.CreateAcceleratedMenuItem(adjustment.AdjustmentMenuKey, adjustment.AdjustmentMenuKeyModifiers);
            }

            ((Menu)((ImageMenuItem)PintaCore.Chrome.MainMenu.Children[5]).Submenu).AppendMenuItemSorted(menu_item);

            adjustments.Add(adjustment, act);
            adjustment_menuitems.Add(adjustment, menu_item);

            return(act);
        }
Example #11
0
        public ViewActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.View.ActualSize.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ActualSize.png")));
            fact.Add ("Menu.View.Grid.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Grid.png")));
            fact.Add ("Menu.View.Rulers.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.Rulers.png")));
            fact.Add ("Menu.View.ZoomIn.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomIn.png")));
            fact.Add ("Menu.View.ZoomOut.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomOut.png")));
            fact.Add ("Menu.View.ZoomToSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToSelection.png")));
            fact.Add ("Menu.View.ZoomToWindow.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.View.ZoomToWindow.png")));
            fact.AddDefault ();

            ZoomIn = new Gtk.Action ("ZoomIn", Catalog.GetString ("Zoom In"), null, Stock.ZoomIn);
            ZoomOut = new Gtk.Action ("ZoomOut", Catalog.GetString ("Zoom Out"), null, Stock.ZoomOut);
            ZoomToWindow = new Gtk.Action ("ZoomToWindow", Catalog.GetString ("Best Fit"), null, Stock.ZoomFit);
            ZoomToSelection = new Gtk.Action ("ZoomToSelection", Catalog.GetString ("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
            ActualSize = new Gtk.Action ("ActualSize", Catalog.GetString ("Normal Size"), null, Stock.Zoom100);
            ToolBar = new Gtk.ToggleAction ("Toolbar", Catalog.GetString ("Toolbar"), null, null);
            PixelGrid = new Gtk.ToggleAction ("PixelGrid", Catalog.GetString ("Pixel Grid"), null, "Menu.View.Grid.png");
            Rulers = new Gtk.ToggleAction ("Rulers", Catalog.GetString ("Rulers"), null, "Menu.View.Rulers.png");
            Pixels = new Gtk.RadioAction ("Pixels", Catalog.GetString ("Pixels"), null, null, 0);
            Inches = new Gtk.RadioAction ("Inches", Catalog.GetString ("Inches"), null, null, 1);
            Centimeters = new Gtk.RadioAction ("Centimeters", Catalog.GetString ("Centimeters"), null, null, 2);
            Fullscreen = new Gtk.Action ("Fullscreen", Catalog.GetString ("Fullscreen"), null, Stock.Fullscreen);

            ZoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "175%", "150%", "125%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%", "Window" };
            ZoomComboBox = new ToolBarComboBox (75, DefaultZoomIndex(), true, ZoomCollection);

            // Make sure these are the same group so only one will be selected at a time
            Inches.Group = Pixels.Group;
            Centimeters.Group = Pixels.Group;
        }
Example #12
0
        public static Hyena.Widgets.ImageButton CreateImageButton(this Gtk.Action action)
        {
            var button = new Hyena.Widgets.ImageButton(action.ShortLabel, action.IconName);

            action.ConnectProxy(button);
            return(button);
        }
Example #13
0
        private void BuildHeader()
        {
            source_actions_align = new Gtk.Alignment(0f, .5f, 1f, 0f)
            {
                RightPadding = 0,
                LeftPadding  = 0,
                NoShowAll    = true
            };

            if (Hyena.PlatformDetection.IsMeeGo)
            {
                source_actions_align.RightPadding = 5;
                source_actions_align.TopPadding   = 5;
            }

            footer = new VBox();

            source_actions_box = new EventBox()
            {
                Visible = true
            };

            BuildSearchEntry();

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    search_entry.Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    search_entry.Menu.Append(item);
                }
            }

            source_actions_box.ShowAll();
            source_actions_align.Add(source_actions_box);
            source_actions_align.Hide();
            search_entry.Show();


            context_pane = new Banshee.ContextPane.ContextPane();
            context_pane.ExpandHandler = b => {
                SetChildPacking(content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking(context_pane, b, b, 0, PackType.End);
            };

            // Top to bottom, their order is reverse of this:
            PackEnd(footer, false, false, 0);
            PackEnd(context_pane, false, false, 0);
            PackEnd(source_actions_align, false, false, 0);
            PackEnd(new ConnectedMessageBar(), false, true, 0);
        }
Example #14
0
        private void SetMenu()
        {
            Gtk.Action  rmv;
            UIManager   manager;
            ActionGroup g;

            manager = new UIManager();
            g       = new ActionGroup("SubCategoriesMenuGroup");

            edit = new Gtk.Action("EditAction",
                                  Mono.Unix.Catalog.GetString("Edit tags"),
                                  null, "gtk-edit");
            rmv = new Gtk.Action("RemoveAction",
                                 Mono.Unix.Catalog.GetString("Remove sub-category"),
                                 null, "gtk-remove");

            g.Add(edit, null);
            g.Add(rmv, null);

            manager.InsertActionGroup(g, 0);

            manager.AddUiFromString("<ui>" +
                                    "  <popup action='CategoriesMenu'>" +
                                    "    <menuitem action='EditAction'/>" +
                                    "    <menuitem action='RemoveAction'/>" +
                                    "  </popup>" +
                                    "</ui>");

            menu = manager.GetWidget("/CategoriesMenu") as Menu;

            edit.Activated += OnEdit;
            rmv.Activated  += OnRemove;
        }
Example #15
0
        public void UpdateAction(string action_name, bool visible, bool sensitive, Source source)
        {
            Gtk.Action action = this[action_name];
            UpdateAction(action, visible, sensitive);

            if (source != null && action.Visible)
            {
                // Save the original label
                if (!labels.ContainsKey(action_name))
                {
                    labels.Add(action_name, action.Label);
                }

                // Save the original icon name
                if (!icons.ContainsKey(action_name))
                {
                    icons.Add(action_name, action.IconName);
                }

                // If this source has a label property for this action, override the current label, otherwise reset it
                // to the original label
                string label = source.Properties.Get <string> (String.Format("{0}Label", action_name)) ?? labels[action_name];
                action.Label = label;

                // If this source has an icon property for this action, override the current icon, othewise reset it
                // to the original icon
                string icon = source.Properties.Get <string> (String.Format("{0}IconName", action_name)) ?? icons[action_name];
                if (!String.IsNullOrEmpty(icon))
                {
                    action.IconName = icon;
                }
            }
        }
Example #16
0
        public SearchEntry()
        {
            BuildSearchEntry();

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    Menu.Append(item);
                }
            }

            SearchSensitive = true;
            Show();
        }
Example #17
0
        public LayerActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add("Menu.Layers.AddNewLayer.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.AddNewLayer.png")));
            fact.Add("Menu.Layers.DeleteLayer.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.DeleteLayer.png")));
            fact.Add("Menu.Layers.DuplicateLayer.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.DuplicateLayer.png")));
            fact.Add("Menu.Layers.MergeLayerDown.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.MergeLayerDown.png")));
            fact.Add("Menu.Layers.MoveLayerDown.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.MoveLayerDown.png")));
            fact.Add("Menu.Layers.MoveLayerUp.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.MoveLayerUp.png")));
            fact.Add("Menu.Layers.FlipHorizontal.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.FlipHorizontal.png")));
            fact.Add("Menu.Layers.FlipVertical.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.FlipVertical.png")));
            fact.Add("Menu.Layers.ImportFromFile.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.ImportFromFile.png")));
            fact.Add("Menu.Layers.LayerProperties.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.LayerProperties.png")));
            fact.Add("Menu.Layers.RotateZoom.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Layers.RotateZoom.png")));
            fact.AddDefault();

            AddNewLayer    = new Gtk.Action("AddNewLayer", Catalog.GetString("Add New Layer"), null, "Menu.Layers.AddNewLayer.png");
            DeleteLayer    = new Gtk.Action("DeleteLayer", Catalog.GetString("Delete Layer"), null, "Menu.Layers.DeleteLayer.png");
            DuplicateLayer = new Gtk.Action("DuplicateLayer", Catalog.GetString("Duplicate Layer"), null, "Menu.Layers.DuplicateLayer.png");
            MergeLayerDown = new Gtk.Action("MergeLayerDown", Catalog.GetString("Merge Layer Down"), null, "Menu.Layers.MergeLayerDown.png");
            ImportFromFile = new Gtk.Action("ImportFromFile", Catalog.GetString("Import from File..."), null, "Menu.Layers.ImportFromFile.png");
            FlipHorizontal = new Gtk.Action("FlipHorizontal", Catalog.GetString("Flip Horizontal"), null, "Menu.Layers.FlipHorizontal.png");
            FlipVertical   = new Gtk.Action("FlipVertical", Catalog.GetString("Flip Vertical"), null, "Menu.Layers.FlipVertical.png");
            RotateZoom     = new Gtk.Action("RotateZoom", Catalog.GetString("Rotate / Zoom Layer..."), null, "Menu.Layers.RotateZoom.png");
            MoveLayerUp    = new Gtk.Action("MoveLayerUp", Catalog.GetString("Move Layer Up"), null, "Menu.Layers.MoveLayerUp.png");
            MoveLayerDown  = new Gtk.Action("MoveLayerDown", Catalog.GetString("Move Layer Down"), null, "Menu.Layers.MoveLayerDown.png");
            Properties     = new Gtk.Action("Properties", Catalog.GetString("Layer Properties..."), null, "Menu.Layers.LayerProperties.png");

            RotateZoom.Sensitive = false;
        }
Example #18
0
        /// <summary>
        /// Creates ActionMonitor
        /// </summary>
        /// <param name="aType">
        /// Type of monitoring <see cref="ActionMonitorType"/>
        /// </param>
        /// <param name="aAction">
        /// Action which is monitored <see cref="Gtk.Action"/>
        /// </param>
        public ActionMonitor(ActionMonitorType aType, Gtk.Action aAction)
        {
            reference   = new WeakReference(aAction);
            monitorType = aType;
//			reference.Target = aAction;
            defaults = new ActionMonitorDefaults(ActionMonitorDefaultsType.Always, false);
        }
Example #19
0
        private void AddActions(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("FindAction", Stock.Find, null, "<control>F", "Find",
                                new EventHandler(OnFindActivated)),
                new ActionEntry("FindNextAction", null, Catalog.GetString("Find _Next"), "F3", null,
                                new EventHandler(OnFindNextActivated)),
                new ActionEntry("FindPreviousAction", null, Catalog.GetString("Find _Previous"), "<shift>F3", null,
                                new EventHandler(OnFindPreviousActivated)),
                new ActionEntry("ReplaceAction", Stock.FindAndReplace, null, "<control>R", "Replace",
                                new EventHandler(OnReplaceActivated))
            };

            ActionGroup group = new ActionGroup("SearchActions");

            group.Add(actionEntries);

            uim.InsertActionGroup(group, 0);
            uim.AddUiFromString(uiXml);

            FindAction         = (Gtk.Action)uim.GetAction("/menubar/Search/Find");
            FindNextAction     = (Gtk.Action)uim.GetAction("/menubar/Search/FindNext");
            FindPreviousAction = (Gtk.Action)uim.GetAction("/menubar/Search/FindPrevious");
            ReplaceAction      = (Gtk.Action)uim.GetAction("/menubar/Search/Replace");

            uim.EnsureUpdate();
        }
Example #20
0
        /// <summary>
        /// Creates ActionMonitor
        /// </summary>
        /// <param name="aType">
        /// Type of monitoring <see cref="ActionMonitorType"/>
        /// </param>
        /// <param name="aAction">
        /// Action which is monitored <see cref="Gtk.Action"/>
        /// </param>
        /// <param name="aDefaults">
        /// Defaults how to resolve when DataSource is null <see cref="ActionMonitorDefaults"/>
        /// </param>
        public ActionMonitor(ActionMonitorType aType, Gtk.Action aAction, ActionMonitorDefaults aDefaults)
        {
            reference   = new WeakReference(aAction);
            monitorType = aType;
//			reference.Target = aAction;
            defaults = aDefaults;
        }
Example #21
0
        public CategoriaListView()
        {
            TreeViewHelper t=new TreeViewHelper(treeView,"Select * from categoria");
            Gtk.Action refreshAction = new Gtk.Action("refreshAction", null, null, Stock.Refresh);
            //tengo acceso al actionGroup de IEntityListView
            actionGroup.Add(refreshAction);
            refreshAction.Activated += delegate {t.Refresh ();};
            Gtk.Action editAction = new Gtk.Action("editAction", null, null, Stock.Edit);
            actionGroup.Add(editAction);
            editAction.Activated += delegate {
                Window ventana=new Window("Editar");
                ventana.SetDefaultSize(500,500);
                VBox h=new VBox(true,10);
                ventana.Add (h);
                Label enunciado=new Label("Introduce el nuevo valor:");
                h.Add (enunciado);
                Entry caja=new Entry();
                h.Add (caja);
                Button b=new Button("Editar");
                h.Add (b);
                b.Clicked+=delegate
                {
                    IDbCommand dbCommand=App.Instance.DbConnection.CreateCommand();
                    dbCommand.CommandText =
                    string.Format ("update categoria set nombre='{1}' where id={0}", t.Id,caja.Text);
                    dbCommand.ExecuteNonQuery ();
                };

                ventana.ShowAll();

            };
        }
Example #22
0
        static void OnDynamicAdd(object obj, EventArgs args)
        {
            if (mergeId != 0 || dynGroup != null)
            {
                return;
            }

            int num = spin.ValueAsInt;

            dynGroup = new ActionGroup("DynamicActions");
            uim.InsertActionGroup(dynGroup, 0);
            mergeId = uim.NewMergeId();

            for (int i = 0; i < num; i++)
            {
                string     name   = "DynAction" + i;
                string     label  = "Dynamic Action " + i;
                Gtk.Action action = new Gtk.Action(name, label);
                dynGroup.Add(action);
                uim.AddUi(mergeId, "/menubar/DynamicMenu", name,
                          name, UIManagerItemType.Menuitem, false);
            }

            uim.EnsureUpdate();
        }
Example #23
0
        protected virtual void InsertProxy(Gtk.Action menuAction, Widget parent, Widget afterItem)
        {
            int    position = 0;
            Widget item     = null;

            if (parent is MenuItem || parent is Menu)
            {
                Menu parent_menu = ((parent is MenuItem) ? (parent as MenuItem).Submenu : parent) as Menu;
                position = (afterItem != null) ? Array.IndexOf(parent_menu.Children, afterItem as MenuItem) + 1 : 0;
                item     = GetNewMenuItem();
                if (item != null)
                {
                    parent_menu.Insert(item, position);
                }
            }
            else if (parent is Toolbar)
            {
                ToolItem after_item = afterItem as ToolItem;
                if (after_item != null)
                {
                    position = (parent as Toolbar).GetItemIndex(after_item);
                    ToolItem tool_item = GetNewToolItem();
                    if (tool_item != null)
                    {
                        (parent as Toolbar).Insert(tool_item, position);
                        item = tool_item;
                    }
                }
            }

            if (item != null)
            {
                action.ConnectProxy(item);
            }
        }
Example #24
0
        public ArticuloListView()
        {
            string sql="select * from articulo";
             helper=new TreeViewHelper(treeView,sql);

            Gtk.Action editAction=new Gtk.Action("editAction",null,null, Stock.Edit);
            actionGroup.Add(editAction);

            Gtk.Action deleteAction=new Gtk.Action("deleteAction",null,null, Stock.Delete);
            actionGroup.Add(deleteAction);

            deleteAction.Activated+=delegate{
                executeNonQuery(string.Format("delete from articulo where id={0}",helper.Id));
            };

            Gtk.Action newAction=new Gtk.Action("newAction",null,null, Stock.New);
            actionGroup.Add(newAction);

            newAction.Activated+=delegate{

                executeNonQuery(string.Format("insert into articulo (nombre) values ('{0}')",DateTime.Now));
            };

            treeView.Selection.Changed += delegate {
                editAction.Sensitive=treeView.Selection.CountSelectedRows() >0;
                string id=getId();
                Console.WriteLine(id);
            };
        }
Example #25
0
        private void UpdateActions()
        {
            InterfaceActionService uia_service = ServiceManager.Get <InterfaceActionService> ();

            Gtk.Action action = uia_service.TrackActions["BurnDiscAction"];

            bool visible   = false;
            bool sensitive = false;

            DatabaseSource source = ServiceManager.SourceManager.ActiveSource as DatabaseSource;

            // FIXME: Figure out how to handle non-music-library sources
            if (source != null)
            {
                if (source is MusicLibrarySource || source.Parent is MusicLibrarySource)
                {
                    visible = true;
                }

                sensitive = source.TrackModel.Selection.Count > 0;
            }

            action.Sensitive = sensitive;
            action.Visible   = visible;
        }
Example #26
0
        private void UpdateActions()
        {
            InterfaceActionService uia_service = ServiceManager.Get <InterfaceActionService> ();

            if (uia_service == null)
            {
                return;
            }

            Gtk.Action rip_action = uia_service.GlobalActions["RipDiscAction"];
            if (rip_action != null)
            {
                string title            = disc_model.Title;
                int    max_title_length = 20;
                title = title.Length > max_title_length
                    ? String.Format("{0}\u2026", title.Substring (0, max_title_length).Trim())
                    : title;

                rip_action.Label      = String.Format(Catalog.GetString("Import \u201f{0}\u201d"), title);
                rip_action.ShortLabel = Catalog.GetString("Import CD");
                rip_action.IconName   = "media-import-audio-cd";
                rip_action.Sensitive  = AudioCdRipper.Supported && disc_model.EnabledCount > 0;
            }

            Gtk.Action duplicate_action = uia_service.GlobalActions["DuplicateDiscAction"];
            if (duplicate_action != null)
            {
                duplicate_action.IconName = "media-cdrom";
                duplicate_action.Visible  = AudioCdDuplicator.Supported;
            }
        }
Example #27
0
        public void Dispose()
        {
            if (current_nf != null)
            {
                try {
                    current_nf.Close();
                } catch {}
            }

            UninstallPreferences();

            ServiceManager.PlayerEngine.DisconnectEvent(OnPlayerEvent);

            elements_service.PrimaryWindowClose = null;

            interface_action_service.UIManager.RemoveUi(ui_manager_id);
            Gtk.Action close_action = interface_action_service.GlobalActions["CloseAction"];
            if (close_action != null)
            {
                interface_action_service.GlobalActions.Remove(close_action);
            }
            interface_action_service.GlobalActions.UpdateAction("QuitAction", true);

            AddinManager.AddinLoaded -= OnAddinLoaded;

            sound_menu               = null;
            elements_service         = null;
            interface_action_service = null;
        }
Example #28
0
        public LayerActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.Layers.AddNewLayer.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.AddNewLayer.png")));
            fact.Add ("Menu.Layers.DeleteLayer.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.DeleteLayer.png")));
            fact.Add ("Menu.Layers.DuplicateLayer.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.DuplicateLayer.png")));
            fact.Add ("Menu.Layers.MergeLayerDown.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png")));
            fact.Add ("Menu.Layers.MoveLayerDown.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.MoveLayerDown.png")));
            fact.Add ("Menu.Layers.MoveLayerUp.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.MoveLayerUp.png")));
            fact.Add ("Menu.Layers.FlipHorizontal.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.FlipHorizontal.png")));
            fact.Add ("Menu.Layers.FlipVertical.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.FlipVertical.png")));
            fact.Add ("Menu.Layers.ImportFromFile.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.ImportFromFile.png")));
            fact.Add ("Menu.Layers.LayerProperties.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.LayerProperties.png")));
            fact.Add ("Menu.Layers.RotateZoom.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Layers.RotateZoom.png")));
            fact.AddDefault ();

            AddNewLayer = new Gtk.Action ("AddNewLayer", Catalog.GetString ("Add New Layer"), null, "Menu.Layers.AddNewLayer.png");
            DeleteLayer = new Gtk.Action ("DeleteLayer", Catalog.GetString ("Delete Layer"), null, "Menu.Layers.DeleteLayer.png");
            DuplicateLayer = new Gtk.Action ("DuplicateLayer", Catalog.GetString ("Duplicate Layer"), null, "Menu.Layers.DuplicateLayer.png");
            MergeLayerDown = new Gtk.Action ("MergeLayerDown", Catalog.GetString ("Merge Layer Down"), null, "Menu.Layers.MergeLayerDown.png");
            ImportFromFile = new Gtk.Action ("ImportFromFile", Catalog.GetString ("Import from File..."), null, "Menu.Layers.ImportFromFile.png");
            FlipHorizontal = new Gtk.Action ("FlipHorizontal", Catalog.GetString ("Flip Horizontal"), null, "Menu.Layers.FlipHorizontal.png");
            FlipVertical = new Gtk.Action ("FlipVertical", Catalog.GetString ("Flip Vertical"), null, "Menu.Layers.FlipVertical.png");
            RotateZoom = new Gtk.Action ("RotateZoom", Catalog.GetString ("Rotate / Zoom"), null, "Menu.Layers.RotateZoom.png");
            MoveLayerUp = new Gtk.Action ("MoveLayerUp", Catalog.GetString ("Move Layer Up"), null, "Menu.Layers.MoveLayerUp.png");
            MoveLayerDown = new Gtk.Action ("MoveLayerDown", Catalog.GetString ("Move Layer Down"), null, "Menu.Layers.MoveLayerDown.png");
            Properties = new Gtk.Action ("Properties", Catalog.GetString ("Layer Properties..."), null, "Menu.Layers.LayerProperties.png");

            RotateZoom.Sensitive = false;
        }
Example #29
0
        public FileActions()
        {
            New = new Gtk.Action ("New", Mono.Unix.Catalog.GetString ("New..."), null, "gtk-new");
            Open = new Gtk.Action ("Open", Mono.Unix.Catalog.GetString ("Open..."), null, "gtk-open");
            OpenRecent = new RecentAction ("OpenRecent", Catalog.GetString ("Open Recent"), null, "gtk-open",
                                           RecentManager.Default);

            RecentFilter recentFilter = new RecentFilter ();
            recentFilter.AddApplication ("Pinta");

            (OpenRecent as RecentAction).AddFilter (recentFilter);

            recentData = new RecentData ();
            recentData.AppName = "Pinta";
            recentData.AppExec = GetExecutablePathname ();
            recentData.MimeType = "image/*";

            Close = new Gtk.Action ("Close", Mono.Unix.Catalog.GetString ("Close"), null, "gtk-close");
            Save = new Gtk.Action ("Save", Mono.Unix.Catalog.GetString ("Save"), null, "gtk-save");
            SaveAs = new Gtk.Action ("SaveAs", Mono.Unix.Catalog.GetString ("Save As..."), null, "gtk-save-as");
            Print = new Gtk.Action ("Print", Mono.Unix.Catalog.GetString ("Print"), null, "gtk-print");
            Exit = new Gtk.Action ("Exit", Mono.Unix.Catalog.GetString ("Quit"), null, "gtk-quit");

            //			OpenRecent.Sensitive = false;
            Close.Sensitive = false;
            Print.Sensitive = false;
        }
Example #30
0
        public ViewActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add("Menu.View.ActualSize.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ActualSize.png")));
            fact.Add("Menu.View.Grid.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Grid.png")));
            fact.Add("Menu.View.Rulers.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Rulers.png")));
            fact.Add("Menu.View.ZoomIn.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomIn.png")));
            fact.Add("Menu.View.ZoomOut.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomOut.png")));
            fact.Add("Menu.View.ZoomToSelection.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToSelection.png")));
            fact.Add("Menu.View.ZoomToWindow.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToWindow.png")));
            fact.AddDefault();

            ZoomIn          = new Gtk.Action("ZoomIn", Catalog.GetString("Zoom In"), null, Stock.ZoomIn);
            ZoomOut         = new Gtk.Action("ZoomOut", Catalog.GetString("Zoom Out"), null, Stock.ZoomOut);
            ZoomToWindow    = new Gtk.Action("ZoomToWindow", Catalog.GetString("Best Fit"), null, Stock.ZoomFit);
            ZoomToSelection = new Gtk.Action("ZoomToSelection", Catalog.GetString("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
            ActualSize      = new Gtk.Action("ActualSize", Catalog.GetString("Normal Size"), null, Stock.Zoom100);
            ToolBar         = new Gtk.ToggleAction("Toolbar", Catalog.GetString("Toolbar"), null, null);
            PixelGrid       = new Gtk.ToggleAction("PixelGrid", Catalog.GetString("Pixel Grid"), null, "Menu.View.Grid.png");
            Rulers          = new Gtk.ToggleAction("Rulers", Catalog.GetString("Rulers"), null, "Menu.View.Rulers.png");
            Pixels          = new Gtk.RadioAction("Pixels", Catalog.GetString("Pixels"), null, null, 0);
            Inches          = new Gtk.RadioAction("Inches", Catalog.GetString("Inches"), null, null, 1);
            Centimeters     = new Gtk.RadioAction("Centimeters", Catalog.GetString("Centimeters"), null, null, 2);
            Fullscreen      = new Gtk.Action("Fullscreen", Catalog.GetString("Fullscreen"), null, Stock.Fullscreen);

            ZoomCollection = new string[] {
                ToPercent(36),
                ToPercent(24),
                ToPercent(16),
                ToPercent(12),
                ToPercent(8),
                ToPercent(7),
                ToPercent(6),
                ToPercent(5),
                ToPercent(4),
                ToPercent(3),
                ToPercent(2),
                ToPercent(1.75),
                ToPercent(1.5),
                ToPercent(1.25),
                ToPercent(1),
                ToPercent(0.66),
                ToPercent(0.5),
                ToPercent(0.33),
                ToPercent(0.25),
                ToPercent(0.16),
                ToPercent(0.12),
                ToPercent(0.08),
                ToPercent(0.05),
                Catalog.GetString("Window")
            };
            ZoomComboBox = new ToolBarComboBox(90, DefaultZoomIndex(), true, ZoomCollection);

            // Make sure these are the same group so only one will be selected at a time
            Inches.Group      = Pixels.Group;
            Centimeters.Group = Pixels.Group;

            // The toolbar is shown by default.
            ToolBar.Active = true;
        }
Example #31
0
        public ViewActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add("Menu.View.ActualSize.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ActualSize.png")));
            fact.Add("Menu.View.Grid.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Grid.png")));
            fact.Add("Menu.View.Rulers.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.Rulers.png")));
            fact.Add("Menu.View.ZoomIn.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomIn.png")));
            fact.Add("Menu.View.ZoomOut.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomOut.png")));
            fact.Add("Menu.View.ZoomToSelection.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToSelection.png")));
            fact.Add("Menu.View.ZoomToWindow.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.View.ZoomToWindow.png")));
            fact.AddDefault();

            ZoomIn          = new Gtk.Action("ZoomIn", Catalog.GetString("Zoom In"), null, Stock.ZoomIn);
            ZoomOut         = new Gtk.Action("ZoomOut", Catalog.GetString("Zoom Out"), null, Stock.ZoomOut);
            ZoomToWindow    = new Gtk.Action("ZoomToWindow", Catalog.GetString("Best Fit"), null, Stock.ZoomFit);
            ZoomToSelection = new Gtk.Action("ZoomToSelection", Catalog.GetString("Zoom to Selection"), null, "Menu.View.ZoomToSelection.png");
            ActualSize      = new Gtk.Action("ActualSize", Catalog.GetString("Normal Size"), null, Stock.Zoom100);
            ToolBar         = new Gtk.ToggleAction("Toolbar", Catalog.GetString("Toolbar"), null, null);
            PixelGrid       = new Gtk.ToggleAction("PixelGrid", Catalog.GetString("Pixel Grid"), null, "Menu.View.Grid.png");
            Rulers          = new Gtk.ToggleAction("Rulers", Catalog.GetString("Rulers"), null, "Menu.View.Rulers.png");
            Pixels          = new Gtk.RadioAction("Pixels", Catalog.GetString("Pixels"), null, null, 0);
            Inches          = new Gtk.RadioAction("Inches", Catalog.GetString("Inches"), null, null, 1);
            Centimeters     = new Gtk.RadioAction("Centimeters", Catalog.GetString("Centimeters"), null, null, 2);
            Fullscreen      = new Gtk.Action("Fullscreen", Catalog.GetString("Fullscreen"), null, Stock.Fullscreen);

            ZoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "175%", "150%", "125%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%", Catalog.GetString("Window") };
            ZoomComboBox   = new ToolBarComboBox(75, DefaultZoomIndex(), true, ZoomCollection);

            // Make sure these are the same group so only one will be selected at a time
            Inches.Group      = Pixels.Group;
            Centimeters.Group = Pixels.Group;
        }
Example #32
0
        private void AddAdjustment(BaseEffect adjustment, Gtk.Action action)
        {
            var button = new CommandMapButton("Adjustments", action);

            AdjustmentsCommandMapBox.Add(button);
            adjustment_command_map_buttons.Add(adjustment, button);
        }
Example #33
0
        private void AddEffect(string category, Gtk.Action action)
        {
            HBox command_map_box;

            if (command_map_boxes.Count > 0)
            {
                var last_box = command_map_boxes[command_map_boxes.Count - 1];

                const int widgets_per_box = 10;
                if (last_box.Children.Length == widgets_per_box)
                {
                    last_box = new HBox();
                    command_map_boxes.Add(last_box);
                    EffectsCommandMapBox.Add(last_box);
                }

                command_map_box = last_box;
            }
            else
            {
                command_map_box = new HBox();
                command_map_boxes.Add(command_map_box);
                EffectsCommandMapBox.Add(command_map_box);
            }

            var button = new CommandMapButton("Effects", action);

            command_map_button_boxes[action] = command_map_box;
            command_map_box.Add(button);
            command_map_buttons.Add(action, button);
        }
Example #34
0
        public void Dispose()
        {
            if (disposed)
            {
                return;
            }

            Banshee.Base.ThreadAssist.ProxyToMain(delegate {
                Gtk.Action fetch_action = action_service.GlobalActions["FetchCoverArtAction"];
                if (fetch_action != null)
                {
                    action_service.GlobalActions.Remove(fetch_action);
                }

                action_service.RemoveActionGroup("CoverArt");
                action_service.UIManager.RemoveUi(ui_manager_id);

                actions        = null;
                action_service = null;

                ServiceManager.SourceManager.MusicLibrary.TracksAdded   -= OnTracksAdded;
                ServiceManager.SourceManager.MusicLibrary.TracksChanged -= OnTracksChanged;

                disposed = true;
            });
        }
Example #35
0
        public ImageActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add("Menu.Image.CanvasSize.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.CanvasSize.png")));
            fact.Add("Menu.Image.Crop.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.Crop.png")));
            fact.Add("Menu.Image.Flatten.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.Flatten.png")));
            fact.Add("Menu.Image.FlipHorizontal.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.FlipHorizontal.png")));
            fact.Add("Menu.Image.FlipVertical.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.FlipVertical.png")));
            fact.Add("Menu.Image.Resize.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.Resize.png")));
            fact.Add("Menu.Image.Rotate180CW.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.Rotate180CW.png")));
            fact.Add("Menu.Image.Rotate90CCW.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.Rotate90CCW.png")));
            fact.Add("Menu.Image.Rotate90CW.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Menu.Image.Rotate90CW.png")));
            fact.AddDefault();

            CropToSelection = new Gtk.Action("CropToSelection", Catalog.GetString("Crop to Selection"), null, "Menu.Image.Crop.png");
            AutoCrop        = new Gtk.Action("AutoCrop", Catalog.GetString("Auto Crop"), null, "Menu.Image.Crop.png");
            Resize          = new Gtk.Action("Resize", Catalog.GetString("Resize Image..."), null, "Menu.Image.Resize.png");
            CanvasSize      = new Gtk.Action("CanvasSize", Catalog.GetString("Resize Canvas..."), null, "Menu.Image.CanvasSize.png");
            FlipHorizontal  = new Gtk.Action("FlipHorizontal", Catalog.GetString("Flip Horizontal"), null, "Menu.Image.FlipHorizontal.png");
            FlipVertical    = new Gtk.Action("FlipVertical", Catalog.GetString("Flip Vertical"), null, "Menu.Image.FlipVertical.png");
            RotateCW        = new Gtk.Action("RotateCW", Catalog.GetString("Rotate 90° Clockwise"), null, "Menu.Image.Rotate90CW.png");
            RotateCCW       = new Gtk.Action("RotateCCW", Catalog.GetString("Rotate 90° Counter-Clockwise"), null, "Menu.Image.Rotate90CCW.png");
            Rotate180       = new Gtk.Action("Rotate180", Catalog.GetString("Rotate 180°"), null, "Menu.Image.Rotate180CW.png");
            Flatten         = new Gtk.Action("Flatten", Catalog.GetString("Flatten"), null, "Menu.Image.Flatten.png");

            CropToSelection.Sensitive = false;
        }
Example #36
0
        void CreateMenu()
        {
            Gtk.Action  select_all;
            Gtk.Action  select_none;
            UIManager   manager;
            ActionGroup g;

            manager = new UIManager();
            g       = new ActionGroup("MenuGroup");

            select_all  = new Gtk.Action("AllAction", Mono.Unix.Catalog.GetString("Select all"), null, "gtk-edit");
            select_none = new Gtk.Action("NoneAction", Mono.Unix.Catalog.GetString("Unselect all"), null, "gtk-edit");

            g.Add(select_all, null);
            g.Add(select_none, null);

            manager.InsertActionGroup(g, 0);

            manager.AddUiFromString("<ui>" +
                                    "  <popup action='Menu'>" +
                                    "    <menuitem action='AllAction'/>" +
                                    "    <menuitem action='NoneAction'/>" +
                                    "  </popup>" +
                                    "</ui>");

            playersMenu = manager.GetWidget("/Menu") as Menu;

            select_all.Activated  += (sender, e) => Select(true);
            select_none.Activated += (sender, e) => Select(false);
        }
Example #37
0
        private void AddActions(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("NewAction", Stock.New, null, "<control>N", "New File",
                                new EventHandler(OnNewActivated)),
                new ActionEntry("OpenAction", Stock.Open, null, "<control>O", "Open File",
                                new EventHandler(OnOpenActivated)),
                new ActionEntry("SaveAction", Stock.Save, null, "<control>S", "Save File",
                                new EventHandler(OnSaveActivated)),
                new ActionEntry("SaveAsAction", Stock.SaveAs, null, "<shift><control>S", "Save File As",
                                new EventHandler(OnSaveAsActivated)),
                new ActionEntry("RevertAction", Stock.RevertToSaved, null, null, "Revert File",
                                new EventHandler(OnRevertActivated)),
                new ActionEntry("CloseAction", Stock.Close, null, "<control>W", "Close File",
                                new EventHandler(OnCloseActivated)),
                new ActionEntry("QuitAction", Stock.Quit, null, "<control>Q", "Quit Application",
                                new EventHandler(OnQuitActivated))
            };

            ActionGroup group = new ActionGroup("FileActions");

            group.Add(actionEntries);

            uim.InsertActionGroup(group, 0);
            uim.AddUiFromString(uiXml);
            SaveAction   = (Gtk.Action)uim.GetAction("/menubar/File/Save");
            SaveAsAction = (Gtk.Action)uim.GetAction("/menubar/File/SaveAs");
            CloseAction  = (Gtk.Action)uim.GetAction("/menubar/File/Close");
            QuitAction   = (Gtk.Action)uim.GetAction("/menubar/File/Quit");
            RevertAction = (Gtk.Action)uim.GetAction("/menubar/File/Revert");

            uim.EnsureUpdate();
        }
Example #38
0
        public FileActions()
        {
            New = new Gtk.Action ("New", Catalog.GetString ("New..."), null, Stock.New);
            NewScreenshot = new Gtk.Action ("NewScreenshot", Catalog.GetString ("New Screenshot..."), null, Stock.Fullscreen);
            Open = new Gtk.Action ("Open", Catalog.GetString ("Open..."), null, Stock.Open);
            OpenRecent = new RecentAction ("OpenRecent", Catalog.GetString ("Open Recent"), null, Stock.Open, RecentManager.Default);

            RecentFilter recentFilter = new RecentFilter ();
            recentFilter.AddApplication ("Pinta");

            (OpenRecent as RecentAction).AddFilter (recentFilter);

            Close = new Gtk.Action ("Close", Catalog.GetString ("Close"), null, Stock.Close);
            Save = new Gtk.Action ("Save", Catalog.GetString ("Save"), null, Stock.Save);
            SaveAs = new Gtk.Action ("SaveAs", Catalog.GetString ("Save As..."), null, Stock.SaveAs);
            Print = new Gtk.Action ("Print", Catalog.GetString ("Print"), null, Stock.Print);
            Exit = new Gtk.Action ("Exit", Catalog.GetString ("Quit"), null, Stock.Quit);

            New.ShortLabel = Catalog.GetString ("New");
            Open.ShortLabel = Catalog.GetString ("Open");
            Open.IsImportant = true;
            Save.IsImportant = true;

            Close.Sensitive = false;
            Print.Sensitive = false;
        }
Example #39
0
        public Window(Inventory inventory)
            : this(new Builder("window.ui"))
        {
            Inventory = inventory;

            // load the menues and toolbars
            uiManager = new UIManager();

            // create the file actions
            Gtk.Action saveInventoryAction = new Gtk.Action("saveFile","Save","Save the active inventory",Stock.Save);
            saveInventoryAction.Activated += OnSaveInventory;
            Gtk.Action printLabelsAction = new Gtk.Action("printLabels","Print Labels","Print labels for items.",Stock.Print);
            printLabelsAction.Activated += OnPrintLabels;
            Gtk.Action quitAction = new Gtk.Action("quit","Quit","Quit the application",Stock.Quit);
            quitAction.Activated += OnQuit;
            Gtk.Action fileAction = new Gtk.Action("file","File");
            ActionGroup fileActionGroup = new ActionGroup("file");
            fileActionGroup.Add(saveInventoryAction);
            fileActionGroup.Add(printLabelsAction);
            fileActionGroup.Add(quitAction);
            fileActionGroup.Add(fileAction);
            uiManager.InsertActionGroup(fileActionGroup,0);

            // create items box
            itemsBox = new ItemsBox(inventory.Items, uiManager);
            itemsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            itemsBox.ShowMe += OnShowItemsBox;
            itemsAlign.Add(itemsBox);

            // create locations box
            locationsBox = new LocationsBox(inventory.Locations, uiManager);
            locationsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            locationsBox.ShowMe += OnShowLocationsBox;
            locationsBox.GotoItem += OnGotoLocationsItem;
            locationsAlign.Add(locationsBox);

            // create tags box
            tagsBox = new TagsBox(inventory.Tags, uiManager);
            tagsBox.ShowMe += OnShowTagsBox;
            tagsAlign.Add(tagsBox);

            // create tool and menubar
            uiManager.AddUiFromResource("window_menues.xml");
            menuBar = (MenuBar) uiManager.GetWidget("/menuBar");
            toolbar = (Toolbar) uiManager.GetWidget("/toolbar");
            toolbar.IconSize = IconSize.LargeToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Both;

            mainBox.PackStart(menuBar,false,true,0);
            mainBox.PackStart(toolbar,false,true,0);

            // laod category icons
            itemsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).ItemsTabIcon;
            locationsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).LocationsTabIcon;
            tagsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).TagsTabIcon;

            this.Icon = ((GtkSettings)Inventory.Settings).WindowIcon;
            this.Resize(((GtkSettings)Inventory.Settings).MainWindowWidth,((GtkSettings)Inventory.Settings).MainWindowHeight);
        }
Example #40
0
        ///<summary>Handle Activated event on a HistoryMenuItem</summary>
        void OnHistoryMenuItemActivated(object o, EventArgs args)
        {
            Gtk.Action action   = (Gtk.Action)o;
            int        i        = Convert.ToInt32(action.Name.Substring(0, 1));
            string     filePath = History.Instance.Files[i - 1];

            Services.File.LoadFiles(new string[] { filePath });
        }
Example #41
0
 public void Remove(string actionName)
 {
     Gtk.Action action = this[actionName];
     if (action != null)
     {
         Remove(action);
     }
 }
Example #42
0
 static void OnSelect(object obj, EventArgs args)
 {
     Gtk.Action action = actions[(Widget)obj];
     if (action.Tooltip != null)
     {
         statusbar.Push(0, action.Tooltip);
     }
 }
Example #43
0
        public WindowActions()
        {
            SaveAll = new Gtk.Action ("SaveAll", Catalog.GetString ("Save All"), null, Stock.Save);
            CloseAll = new Gtk.Action ("CloseAll", Catalog.GetString ("Close All"), null, Stock.Close);

            OpenWindows = new List<RadioAction> ();
            action_menu_items = new Dictionary<RadioAction,CheckMenuItem> ();
        }
Example #44
0
        public WindowActions()
        {
            SaveAll  = new Gtk.Action("SaveAll", Catalog.GetString("Save All"), null, Stock.Save);
            CloseAll = new Gtk.Action("CloseAll", Catalog.GetString("Close All"), null, Stock.Close);

            OpenWindows       = new List <RadioAction> ();
            action_menu_items = new Dictionary <RadioAction, CheckMenuItem> ();
        }
Example #45
0
        public static Gtk.ImageMenuItem CreateAcceleratedMenuItem(this Gtk.Action action, Gdk.Key key, Gdk.ModifierType mods)
        {
            ImageMenuItem item = (ImageMenuItem)action.CreateMenuItem();

            (item.Child as AccelLabel).AccelWidget = item;
            item.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(key, mods, AccelFlags.Visible));

            return(item);
        }
Example #46
0
        public categorialistview()
        {
            TreeViewHelper treeViewHelper = new TreeViewHelper(TreeView, AppDomain.Instance.DbConnection, "select id, nombre from categoria");

            Gtk.Action refreshAction = new Gtk.Action("refreshAction",null,null, Stock.Refresh);
            refreshAction.Activated += delegate {
                treeViewHelper.Refresh();
            };
            actionGroup.Add (refreshAction);
        }
Example #47
0
        public ArticuloListView()
        {
            TreeViewHelper treeViewHelper = new TreeViewHelper(treeView, App.Instance.DbConnection,
                "select * from articulo"
            );

            Gtk.Action refreshAction = new Gtk.Action("refreshAction", null, null, Stock.Refresh);

            refreshAction.Activated += delegate {
                treeViewHelper.Refresh();
            };
            actionGroup.Add(refreshAction);
        }
Example #48
0
        public HelpActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.Help.Bug.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Help.Bug.png")));
            fact.Add ("Menu.Help.Website.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Help.Website.png")));
            fact.Add ("Menu.Help.Translate.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Help.Translate.png")));
            fact.AddDefault ();

            Website = new Gtk.Action ("Website", Catalog.GetString ("Pinta Website"), null, "Menu.Help.Website.png");
            Bugs = new Gtk.Action ("Bugs", Catalog.GetString ("File a Bug"), null, "Menu.Help.Bug.png");
            Translate = new Gtk.Action ("Translate", Catalog.GetString ("Translate This Application"), null, "Menu.Help.Translate.png");
            About = new Gtk.Action ("About", Catalog.GetString ("About"), null, Stock.About);
        }
Example #49
0
        public void AddEffect(string category, Gtk.Action action)
        {
            if (!Menus.ContainsKey (category)) {
                Gtk.Action menu_action = new Gtk.Action (category, Mono.Unix.Catalog.GetString (category), null, null);
                Menu category_menu = (Menu)effects_menu.AppendItem (menu_action.CreateSubMenuItem ()).Submenu;

                Menus.Add (category, category_menu);
            }

            Menu m = Menus[category];

            m.Append (action.CreateMenuItem ());
        }
Example #50
0
        private void CreateActions()
        {
            action_back    = new Gtk.Action("go-back",    "Go Back",    null, "gtk-go-back");
            action_forward = new Gtk.Action("go-forward", "Go Forward", null, "gtk-go-forward");
            action_reload  = new Gtk.Action("reload",     "Reload",     null, "gtk-refresh");
            action_stop    = new Gtk.Action("stop",       "Stop",       null, "gtk-stop");
            action_jump    = new Gtk.Action("jump",       "Jump",       null, "gtk-jump-to");

            action_back.Activated    += new EventHandler(on_back_activate);
            action_forward.Activated += new EventHandler(on_forward_activate);
            action_reload.Activated  += new EventHandler(on_reload_activate);
            action_stop.Activated    += new EventHandler(on_stop_activate);
            action_jump.Activated    += new EventHandler(on_uri_activate);
        }
 protected void SetupSpecialActions()
 {
     // This demonstrates a shortcut assigned to an action that is
     // not attached to a menu widget. This particular one is assigned
     // to a textbox entry. I'm not sure that this is the best way
     // to do this, but it seems to work. :)
     Gtk.ActionGroup specialActions = new Gtk.ActionGroup("Special");
     this.specialAction1 = new Gtk.Action("specialAction1", "Special Action 1");
     string accelerator = Gtk.Accelerator.Name((uint)Gdk.Key.j, Gdk.ModifierType.ControlMask);
     specialActions.Add(this.specialAction1, accelerator);
     this.entry1.SetAccelPath(this.specialAction1.AccelPath, this.UIManager.AccelGroup);
     this.entry1.Activated += new System.EventHandler(this.OnSpecialAction1Activated);
     this.UIManager.InsertActionGroup(specialActions, -1);
 }
Example #52
0
        public FileActions()
        {
            New = new Gtk.Action ("New", Mono.Unix.Catalog.GetString ("New..."), null, "gtk-new");
            Open = new Gtk.Action ("Open", Mono.Unix.Catalog.GetString ("Open..."), null, "gtk-open");
            OpenRecent = new Gtk.Action ("OpenRecent", Mono.Unix.Catalog.GetString ("Open Recent"), null, "gtk-open");
            Close = new Gtk.Action ("Close", Mono.Unix.Catalog.GetString ("Close"), null, "gtk-close");
            Save = new Gtk.Action ("Save", Mono.Unix.Catalog.GetString ("Save"), null, "gtk-save");
            SaveAs = new Gtk.Action ("SaveAs", Mono.Unix.Catalog.GetString ("Save As..."), null, "gtk-save-as");
            Print = new Gtk.Action ("Print", Mono.Unix.Catalog.GetString ("Print"), null, "gtk-print");
            Exit = new Gtk.Action ("Exit", Mono.Unix.Catalog.GetString ("Quit"), null, "gtk-quit");

            OpenRecent.Sensitive = false;
            Close.Sensitive = false;
            Print.Sensitive = false;
        }
Example #53
0
        void AddHelpActions(ActionGroup actionGroup)
        {
            var help = new Gtk.Action ("help", Catalog.GetString ("_Help"));
            actionGroup.Add (help);

            var about = new Gtk.Action ("about", null, null, Gtk.Stock.About);
            about.Activated += delegate {
                var dialog = new AboutDialog ();
                dialog.Authors = new string[] { "Christian Hergert" };
                dialog.License = Util.ReadResource ("Resources.license.txt");
                dialog.Copyright = "Copyright © 2008 Christian Hergert";
                dialog.Run ();
                dialog.Destroy ();
            };
            actionGroup.Add (about);
        }
Example #54
0
        void AddAdroitActions(ActionGroup actionGroup)
        {
            var adroit = new Gtk.Action ("adroit", Catalog.GetString ("_Adroit"));
            actionGroup.Add (adroit);

            var quit = new Gtk.Action ("quit", null, null, Gtk.Stock.Quit);
            quit.Activated += delegate { Gtk.Application.Quit (); };
            actionGroup.Add (quit, "<Control>Q");

            var close = new Gtk.Action ("close", null, null, Gtk.Stock.Close);
            close.Activated += delegate { Gtk.Application.Quit (); };
            close.Visible = false;
            actionGroup.Add (close, "<Control>W");

            var export = new Gtk.Action ("export", Catalog.GetString ("_Export"));
            export.Visible = false;
            actionGroup.Add (export, null);
        }
Example #55
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        ActionGroup actionGroup1 = new ActionGroup("pageActionGroup");

        Gtk.Action newAction = new Gtk.Action("newAction", null, null, Stock.New);
        actionGroup1.Add (newAction);
        Gtk.Action editAction = new Gtk.Action("editAction", null, null, Stock.Edit);
        actionGroup1.Add (editAction);
        UIManager.InsertActionGroup(actionGroup1, 0);

        //		uint mergeId = UIManager.AddUiFromString(
        //			"<ui>" +
        //			"<toolbar name='toolbar'>" +
        //			"<toolitem name='newAction' action='newAction'/>" +
        //			"<toolitem name='editAction' action='editAction'/>" +
        //			"</toolbar>" +
        //			"</ui>");

        uint mergeId = UIManager.AddUiFromString( getUi(actionGroup1) );

        Console.WriteLine ("mergeId={0}", mergeId);

        ActionGroup actionGroup2 = new ActionGroup("pageActionGroup");

        Gtk.Action deleteAction = new Gtk.Action("deleteAction", null, null, Stock.Delete);
        actionGroup2.Add (deleteAction);

        executeAction.Activated += delegate {
            Console.WriteLine("executeAction.Activated");

            //Console.WriteLine("UIManager.Ui='{0}'", UIManager.Ui);
            UIManager.RemoveUi (mergeId);
            UIManager.RemoveActionGroup(actionGroup1);

            UIManager.InsertActionGroup(actionGroup2, 0);
            UIManager.AddUiFromString( getUi(actionGroup2) );

        };
    }
Example #56
0
        public CategoriaListView()
        {
            TreeViewHelper treeViewHelper = new TreeViewHelper(treeView, App.Instance.DbConnection, "select id, nombre from categoria");

            Gtk.Action refreshAction = new Gtk.Action("refreshAction", null, null, Stock.Refresh);
            refreshAction.Activated += delegate {
                treeViewHelper.Refresh ();
            };
            actionGroup.Add (refreshAction);

            Gtk.Action editAction = new Gtk.Action("editAction", null, null, Stock.Edit);
            editAction.Activated += delegate {
                Categoria categoria = Categoria.Load (treeViewHelper.Id);
                CategoriaView categoriaView = new CategoriaView();
                new CategoriaController(categoria,CategoriaView);
                categoriaView.Show();

            };
            actionGroup.Add (editAction);
        }
Example #57
0
        public EditActions()
        {
            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Menu.Edit.Deselect.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.Deselect.png")));
            fact.Add ("Menu.Edit.EraseSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.EraseSelection.png")));
            fact.Add ("Menu.Edit.FillSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.FillSelection.png")));
            fact.Add ("Menu.Edit.InvertSelection.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.InvertSelection.png")));
            fact.Add ("Menu.Edit.SelectAll.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.SelectAll.png")));
            fact.Add ("Menu.Edit.Addins.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Menu.Edit.Addins.png")));
            fact.AddDefault ();

            Undo = new Gtk.Action ("Undo", Catalog.GetString ("Undo"), null, Stock.Undo);
            Redo = new Gtk.Action ("Redo", Catalog.GetString ("Redo"), null, Stock.Redo);
            Cut = new Gtk.Action ("Cut", Catalog.GetString ("Cut"), null, Stock.Cut);
            Copy = new Gtk.Action ("Copy", Catalog.GetString ("Copy"), null, Stock.Copy);
            CopyMerged = new Gtk.Action ("CopyMerged", Catalog.GetString ("Copy Merged"), null, Stock.Copy);
            Paste = new Gtk.Action ("Paste", Catalog.GetString ("Paste"), null, Stock.Paste);
            PasteIntoNewLayer = new Gtk.Action ("PasteIntoNewLayer", Catalog.GetString ("Paste Into New Layer"), null, Stock.Paste);
            PasteIntoNewImage = new Gtk.Action ("PasteIntoNewImage", Catalog.GetString ("Paste Into New Image"), null, Stock.Paste);
            EraseSelection = new Gtk.Action ("EraseSelection", Catalog.GetString ("Delete Selection"), null, "Menu.Edit.EraseSelection.png");
            FillSelection = new Gtk.Action ("FillSelection", Catalog.GetString ("Fill Selection"), null, "Menu.Edit.FillSelection.png");
            InvertSelection = new Gtk.Action ("InvertSelection", Catalog.GetString ("Invert Selection"), null, "Menu.Edit.InvertSelection.png");
            SelectAll = new Gtk.Action ("SelectAll", Catalog.GetString ("Select All"), null, Stock.SelectAll);
            Deselect = new Gtk.Action ("Deselect", Catalog.GetString ("Deselect All"), null, "Menu.Edit.Deselect.png");

            LoadPalette = new Gtk.Action ("LoadPalette", Catalog.GetString ("Open..."), null, Stock.Open);
            SavePalette = new Gtk.Action ("SavePalette", Catalog.GetString ("Save As..."), null, Stock.Save);
            ResetPalette = new Gtk.Action ("ResetPalette", Catalog.GetString ("Reset to Default"), null, Stock.RevertToSaved);
            ResizePalette = new Gtk.Action ("ResizePalette", Catalog.GetString ("Set Number of Colors"), null, "Menu.Image.Resize.png");

            AddinManager = new Gtk.Action ("AddinManager", Catalog.GetString ("Add-in Manager"), null, "Menu.Edit.Addins.png");

            Undo.IsImportant = true;
            Undo.Sensitive = false;
            Redo.Sensitive = false;
            InvertSelection.Sensitive = false;
            Deselect.Sensitive = false;
            EraseSelection.Sensitive = false;
            FillSelection.Sensitive = false;
        }
Example #58
0
        public CategoriaListView()
        {
            App.Instance.DbConnection = new MySqlConnection(
                "Server=localhost;Database=dbprueba;User Id=root;Password=sistemas"
            );
            TreeViewHelper treeViewHelper = new TreeViewHelper(
                treeView,
                App.Instance.DbConnection,
                "select id, nombre from categoria order by nombre desc"
            );

            Gtk.Action addAction = new Gtk.Action("addAction", null, null, Stock.Add);
            addAction.Activated += delegate {
                IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand ();
                dbCommand.CommandText =
                    string.Format ("insert into categoria (nombre) values ('{0}')", DateTime.Now);
                dbCommand.ExecuteNonQuery ();
            };
            actionGroup.Add (addAction);

            Gtk.Action removeAction = new Gtk.Action("removeAction", null, null, Stock.Remove);
            removeAction.Activated += delegate {
                IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand ();
                dbCommand.CommandText =
                    string.Format ("delete from categoria where id={0}", treeViewHelper.Id);
                dbCommand.ExecuteNonQuery ();
            };
            actionGroup.Add(removeAction);

            Gtk.Action refreshAction = new Gtk.Action("refreshAction", null, null, Stock.Refresh);
            refreshAction.Activated += delegate {treeViewHelper.Refresh ();	};
            actionGroup.Add (refreshAction);

            treeView.Selection.Changed += delegate {
                Console.WriteLine("treeViewHelper.Id='{0}'", treeViewHelper.Id);
                removeAction.Sensitive = treeView.Selection.CountSelectedRows() > 0;
            };

            removeAction.Sensitive = false;
        }
Example #59
0
        public CategoriaListview()
        {
            TreeViewHelper treeViewHelper = new TreeViewHelper (treeView, App.Instance.DbConnection, "select id,nombre from categoria");

            Gtk.Action actionRefresh = new Gtk.Action("actionRefresh",null,null,Stock.Refresh);
            actionRefresh.Activated += delegate {

                treeViewHelper.refresh();
            };

            ActionGroup.Add (actionRefresh);

            Gtk.Action actionEdit = new Gtk.Action("actionEdit",null,null,Stock.Edit);
            actionEdit.Activated += delegate {

                Categoria categoria=(Categoria)ModelHelper.Load(typeof(Categoria),treeViewHelper.Id);

                Console.WriteLine ("id=[{0}, nombre={1} ",categoria.Id,categoria.Nombre);

            };

            ActionGroup.Add (actionEdit);
        }
Example #60
0
        public CategoriaListView()
        {
            TreeViewHelper treeViewHelper = new TreeViewHelper(treeView, App.Instance.DbConnection,
                "select id, nombre from categoria"
            );

            Gtk.Action refreshAction = new Gtk.Action("refreshAction", null, null, Stock.Refresh);
            refreshAction.Activated += delegate {
                treeViewHelper.Refresh();
            };
            actionGroup.Add(refreshAction);

            Gtk.Action editAction = new Gtk.Action ("editAction", null, null, Stock.Edit);
            editAction.Activated += delegate {

            };
            actionGroup.Add (editAction);

            treeView.Selection.Changed += delegate {
                Console.WriteLine("treeViewHelper.Id='{0}'", treeViewHelper.Id);
                editAction.Sensitive = treeView.Selection.CountSelectedRows() > 0;
            };
        }