Example #1
0
        public GlobalActions (ActionManager manager) : base (manager, "Global")
        {
            Add (new ActionEntry [] {
                // Media Menu
                new ActionEntry ("PhotosMenuAction", null,
                    Catalog.GetString ("_Photos"), null, null, null),

                new ActionEntry ("ImportAction", Stock.Add,
                    Catalog.GetString ("_Import"), "<control>I",
                    Catalog.GetString ("Import Photos"), OnImport),

                new ActionEntry ("QuitAction", Stock.Quit,
                    Catalog.GetString ("_Quit"), "<control>Q",
                    Catalog.GetString ("Quit Tripod"), OnQuit),
            });
        }
Example #2
0
        internal Client(bool loadFiles)
        {
            app_count++;

            Window = new Gtk.Window(Gtk.WindowType.Toplevel)
            {
                Title = Catalog.GetString("PDF Mod")
            };
            Window.SetSizeRequest(640, 480);
            Window.DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Quit();
                args.RetVal = true;
            };

            // PDF Icon View
            IconView = new DocumentIconView(this);
            var iconview_sw = new Gtk.ScrolledWindow();

            iconview_sw.AddWithViewport(IconView);

            query_box = new QueryBox(this)
            {
                NoShowAll = true
            };
            query_box.Hide();

            // ActionManager
            ActionManager = new Hyena.Gui.ActionManager();
            Window.AddAccelGroup(ActionManager.UIManager.AccelGroup);
            Actions = new Actions(this, ActionManager);

            // Status bar
            StatusBar = new Gtk.Statusbar()
            {
                HasResizeGrip = true
            };
            status_label = new Label()
            {
                Xalign = 0.0f
            };
            StatusBar.PackStart(status_label, true, true, 6);
            StatusBar.ReorderChild(status_label, 0);

            var zoom_slider = new ZoomSlider(this);

            StatusBar.PackEnd(zoom_slider, false, false, 0);
            StatusBar.ReorderChild(zoom_slider, 1);

            // Properties editor box
            EditorBox = new MetadataEditorBox(this)
            {
                NoShowAll = true
            };
            EditorBox.Hide();

            // Menubar
            menu_bar = ActionManager.UIManager.GetWidget("/MainMenu") as MenuBar;

            // Toolbar
            HeaderToolbar              = ActionManager.UIManager.GetWidget("/HeaderToolbar") as Gtk.Toolbar;
            HeaderToolbar.ShowArrow    = false;
            HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons;
            HeaderToolbar.Tooltips     = true;
            HeaderToolbar.NoShowAll    = true;
            HeaderToolbar.Visible      = Configuration.ShowToolbar;

            // BookmarksView
            BookmarkView           = new BookmarkView(this);
            BookmarkView.NoShowAll = true;
            BookmarkView.Visible   = false;

            var vbox = new VBox();

            vbox.PackStart(menu_bar, false, false, 0);
            vbox.PackStart(HeaderToolbar, false, false, 0);
            vbox.PackStart(EditorBox, false, false, 0);
            vbox.PackStart(query_box, false, false, 0);

            var hbox = new HPaned();

            hbox.Add1(BookmarkView);
            hbox.Add2(iconview_sw);
            vbox.PackStart(hbox, true, true, 0);

            vbox.PackStart(StatusBar, false, true, 0);
            Window.Add(vbox);

            Window.ShowAll();

            if (loadFiles)
            {
                RunIdle(LoadFiles);
                Application.Run();
            }
        }
Example #3
0
        internal Client (bool loadFiles)
        {
            app_count++;

            Window = new Gtk.Window (Gtk.WindowType.Toplevel) { Title = Catalog.GetString ("PDF Mod") };
            Window.SetSizeRequest (640, 480);
            Window.DeleteEvent += delegate (object o, DeleteEventArgs args) {
                Quit ();
                args.RetVal = true;
            };

            // PDF Icon View
            IconView = new DocumentIconView (this);
            var iconview_sw = new Gtk.ScrolledWindow ();
            iconview_sw.AddWithViewport (IconView);

            query_box = new QueryBox (this) { NoShowAll = true };
            query_box.Hide ();

            // ActionManager
            ActionManager = new Hyena.Gui.ActionManager ();
            Window.AddAccelGroup (ActionManager.UIManager.AccelGroup);
            Actions = new Actions (this, ActionManager);

            // Status bar
            StatusBar = new Gtk.Statusbar () { HasResizeGrip = true };
            status_label = new Label () { Xalign = 0.0f };
            StatusBar.PackStart (status_label, true, true, 6);
            StatusBar.ReorderChild (status_label, 0);

            var zoom_slider = new ZoomSlider (this);
            StatusBar.PackEnd (zoom_slider, false, false, 0);
            StatusBar.ReorderChild (zoom_slider, 1);

            // Properties editor box
            EditorBox = new MetadataEditorBox (this) { NoShowAll = true };
            EditorBox.Hide ();

            // Menubar
            menu_bar = ActionManager.UIManager.GetWidget ("/MainMenu") as MenuBar;

            // Toolbar
            HeaderToolbar = ActionManager.UIManager.GetWidget ("/HeaderToolbar") as Gtk.Toolbar;
            HeaderToolbar.ShowArrow = false;
            HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons;
            HeaderToolbar.Tooltips = true;
            HeaderToolbar.NoShowAll = true;
            HeaderToolbar.Visible = Configuration.ShowToolbar;

            // BookmarksView
            BookmarkView = new BookmarkView (this);
            BookmarkView.NoShowAll = true;
            BookmarkView.Visible = false;

            var vbox = new VBox ();
            vbox.PackStart (menu_bar, false, false, 0);
            vbox.PackStart (HeaderToolbar, false, false, 0);
            vbox.PackStart (EditorBox, false, false, 0);
            vbox.PackStart (query_box, false, false, 0);

            var hbox = new HPaned ();
            hbox.Add1 (BookmarkView);
            hbox.Add2 (iconview_sw);
            vbox.PackStart (hbox, true, true, 0);

            vbox.PackStart (StatusBar, false, true, 0);
            Window.Add (vbox);

            Window.ShowAll ();

            if (loadFiles) {
                RunIdle (LoadFiles);
                Application.Run ();
            }
        }
Example #4
0
        public Actions (Client app, ActionManager action_manager) : base (action_manager, "Global")
        {
            this.app = app;
            undo_manager = new UndoManager ();

            AddImportant (
                new ActionEntry ("FileMenu", null, Catalog.GetString ("_File"), null, null, null),
                new ActionEntry ("Open",   Gtk.Stock.Open,   null, "<control>O", Catalog.GetString ("Open a document"), OnOpen),
                new ActionEntry ("Save",   Gtk.Stock.Save,   null, "<control>S", Catalog.GetString ("Save changes to this document, overwriting the existing file"), OnSave),
                new ActionEntry ("SaveAs", Gtk.Stock.SaveAs, null, "<control><shift>S", Catalog.GetString ("Save this document to a new file"), OnSaveAs),
                new ActionEntry ("RecentMenu", null, Catalog.GetString ("Recent _Files"), null, null, null),
                new ActionEntry ("InsertFrom", Gtk.Stock.Add, Catalog.GetString("_Insert From..."), null, Catalog.GetString("Insert pages from another document"), OnInsertFrom),
                new ActionEntry ("Close", Gtk.Stock.Close, null, "<control>W", null, OnClose),

                new ActionEntry ("EditMenu", null, Catalog.GetString ("_Edit"), null, null, null),
                new ActionEntry ("Undo", Stock.Undo, null, "<control>z", null, OnUndo),
                new ActionEntry ("Redo", Stock.Redo, null, "<control>y", null, OnRedo),
                new ActionEntry ("Extract", Gtk.Stock.New, null, null, null, OnExtractPages),
                new ActionEntry ("Remove", Gtk.Stock.Remove, null, "Delete", null, OnRemove),
                new ActionEntry ("RotateLeft", null, Catalog.GetString ("Rotate Left"), "bracketleft", Catalog.GetString ("Rotate left"), OnRotateLeft),
                new ActionEntry ("RotateRight", null, Catalog.GetString ("Rotate Right"), "bracketright", Catalog.GetString ("Rotate right"), OnRotateRight),
                new ActionEntry ("ExportImages", null, null, null, null, OnExportImages),
                new ActionEntry ("SelectAll", Stock.SelectAll, null, "<control>A", null, OnSelectAll),
                new ActionEntry ("SelectOdds", null, Catalog.GetString ("Select Odd Pages"), null, null, OnSelectOdds),
                new ActionEntry ("SelectEvens", null, Catalog.GetString ("Select Even Pages"), null, null, OnSelectEvens),
                new ActionEntry ("SelectMatching", null, Catalog.GetString ("Select Matching..."), "<control>F", null, OnSelectMatching),
                new ActionEntry ("SelectInverse", null, Catalog.GetString ("_Invert Selection"), "<shift><control>I", null, OnSelectInverse),

                new ActionEntry ("ViewMenu", null, Catalog.GetString ("_View"), null, null, null),
                new ActionEntry ("ZoomIn", Stock.ZoomIn, null, "<control>plus", null, OnZoomIn),
                new ActionEntry ("ZoomOut", Stock.ZoomOut, null, "<control>minus", null, OnZoomOut),
                new ActionEntry ("OpenInViewer", null, Catalog.GetString ("Open in Viewer"), "F5", Catalog.GetString ("Open in viewer"), OnOpenInViewer),

                new ActionEntry ("BookmarksMenu", null, Catalog.GetString ("_Bookmarks"), null, null, null),
                new ActionEntry ("AddBookmark", null, Catalog.GetString ("_Add Bookmark"), "<control>d", null, null),
                new ActionEntry ("RenameBookmark", null, Catalog.GetString ("Re_name Bookmark"), "F2", null, null),
                new ActionEntry ("ChangeBookmarkDest", null, Catalog.GetString ("_Change Bookmark Destination"), null, null, null),
                new ActionEntry ("RemoveBookmarks", Stock.Remove, Catalog.GetString ("_Remove Bookmark"), null, null, null),
                new ActionEntry ("EditBookmarks", null, Catalog.GetString ("_Edit Bookmarks"), "<control>B", null, OnEditBookmarks),

                new ActionEntry ("HelpMenu", null, Catalog.GetString ("_Help"), null, null, null),
                new ActionEntry ("Help", Stock.Help, Catalog.GetString ("_Contents"), "F1", null, OnHelp),
                new ActionEntry ("About", Stock.About, null, null, null, OnAbout),

                new ActionEntry ("PageContextMenu", null, "", null, null, OnPageContextMenu),
                new ActionEntry ("BookmarkContextMenu", null, "", null, null, OnBookmarkContextMenu)
            );

            this["AddBookmark"].ShortLabel = Catalog.GetString ("_Add");
            this["RemoveBookmarks"].ShortLabel = Catalog.GetString ("_Remove");

            AddImportant (
                new ToggleActionEntry ("Properties", Stock.Properties, null, "<alt>Return", Catalog.GetString ("View and edit the title, keywords, and more for this document"), OnProperties, false),
                new ToggleActionEntry ("ZoomFit", Stock.ZoomFit, null, "<control>0", null, OnZoomFit, true),
                new ToggleActionEntry ("ViewToolbar", null, Catalog.GetString ("Toolbar"), null, null, OnViewToolbar, Client.Configuration.ShowToolbar),
                new ToggleActionEntry ("ViewBookmarks", null, Catalog.GetString ("Bookmarks"), "F9", null, OnViewBookmarks, Client.Configuration.ShowBookmarks),
                new ToggleActionEntry ("FullScreenView", null, Catalog.GetString ("Fullscreen"), "F11", null, OnFullScreenView, false)
            );

            this["RotateRight"].IconName = "object-rotate-right";
            this["RotateLeft"].IconName = "object-rotate-left";
            this["ExportImages"].IconName = "image-x-generic";
            this["ViewBookmarks"].IconName = "user-bookmarks";
            this["AddBookmark"].IconName = "bookmark-new";

            UpdateAction ("Help", true);

            Update ();
            app.IconView.SelectionChanged += OnChanged;
            app.IconView.ZoomChanged += delegate { Update (); };
            app.DocumentLoaded += (o, a) => {
                app.Document.Changed += () => Update ();
                Update ();
            };
            undo_manager.UndoChanged += OnChanged;

            AddUiFromFile ("UIManager.xml");
            Register ();

            // Add additional menu item keybindings
            AddAccel ("/MainMenu/ViewMenu/ZoomIn",  Gdk.ModifierType.ControlMask, Gdk.Key.KP_Add, Gdk.Key.equal);
            AddAccel ("/MainMenu/ViewMenu/ZoomOut", Gdk.ModifierType.ControlMask, Gdk.Key.KP_Subtract, Gdk.Key.underscore);
            AddAccel ("/MainMenu/FileMenu/Close",   Gdk.ModifierType.ControlMask, Gdk.Key.q);
            AddAccel ("/MainMenu/EditMenu/Redo",    Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask, Gdk.Key.z);

            // Set up recent documents menu
            MenuItem recent_item = ActionManager.UIManager.GetWidget ("/MainMenu/FileMenu/RecentMenu") as MenuItem;
            var recent_chooser_item = new RecentChooserMenu (RecentManager.Default) {
                Filter = new RecentFilter (),
                SortType = RecentSortType.Mru
            };
            recent_chooser_item.Filter.AddPattern ("*.pdf");
            recent_chooser_item.ItemActivated += delegate {
                Client.RunIdle (delegate { app.LoadPath (recent_chooser_item.CurrentUri); });
            };
            recent_item.Submenu = recent_chooser_item;
        }
Example #5
0
 public HyenaActionGroup(ActionManager action_manager, string name)
     : base(name)
 {
     this.action_manager = action_manager;
 }