public Navbar (Gtk.IconSize size) { address = new Entry ("address"); // FIXME: this doesnt't seem to work yet // address.Completion = new EntryCompletion (); address.WidthChars = 50; address.Activated += new EventHandler (OnGoUrl); ActionEntry[] actions = new ActionEntry[] { new ActionEntry ("back", Gtk.Stock.GoBack, null, null, GettextCatalog.GetString ("Go back"), new EventHandler (OnBackClicked)), new ActionEntry ("forward", Gtk.Stock.GoForward, null, null, GettextCatalog.GetString ("Go forward"), new EventHandler (OnForwardClicked)), new ActionEntry ("stop", Gtk.Stock.Stop, null, null, GettextCatalog.GetString ("Stop loading"), new EventHandler (OnStopClicked)), new ActionEntry ("reload", Gtk.Stock.Refresh, null, null, GettextCatalog.GetString ("Address"), new EventHandler (OnReloadClicked)), new ActionEntry ("go", Gtk.Stock.Ok, null, null, GettextCatalog.GetString ("Load address"), new EventHandler (OnGoUrl)) }; ActionGroup ag = new ActionGroup ("navbarGroup"); ag.Add (actions); UIManager uim = new UIManager (); uim.InsertActionGroup (ag, 0); uim.AddWidget += new AddWidgetHandler (OnAddWidget); uim.AddUiFromString (uiInfo); ToolItem item = new ToolItem (); item.Add (address); Toolbar tb = uim.GetWidget ("/ui/toolbar") as Toolbar; tb.IconSize = size; tb.Add (item); this.ShowAll (); }
public Shell() : base("Mono Heap Profiler") { entries = new ActionEntry[] { new ActionEntry ("FileMenu", null, "_File", null, null, null), new ActionEntry ("OpenAction", Stock.Open, null, "<control>O", "Open a profile...", new EventHandler (OnOpen)), new ActionEntry ("QuitAction", Stock.Quit, null, "<control>Q", "Quit the application", delegate { Application.Quit (); }), }; DefaultSize = new Gdk.Size (700, 700); DeleteEvent += delegate { Application.Quit (); }; main_box = new VBox (false, 0); Add (main_box); shell_commands = new ActionGroup ("TestActions"); shell_commands.Add (entries); uim = new UIManager (); uim.AddWidget += delegate (object obj, AddWidgetArgs args) { args.Widget.Show (); main_box.PackStart (args.Widget, false, true, 0); }; uim.ConnectProxy += OnProxyConnect; uim.InsertActionGroup (shell_commands, 0); uim.AddUiFromResource ("shell-ui.xml"); AddAccelGroup (uim.AccelGroup); sb = new Statusbar (); main_box.PackEnd (sb, false, true, 0); pager = new ShellPager (this); main_box.PackEnd (pager, true, true, 0); }
public MainUIManager(ViewGui viewGui) { this.viewGui = viewGui; actions = new ActionGroup("Actions"); ActionEntry actionEntryQuit; actionEntryQuit = new ActionEntry("Quitter", Gtk.Stock.Quit, null, "<control>Q", "Quitter l'environnement Sofia", new EventHandler(Quit)); ActionEntry[] entries = new ActionEntry [] { new ActionEntry("Fichier", null, "_Fichier", null, null, null), new ActionEntry("Editer", null, "Editio_n", null, null, null), new ActionEntry("Rechercher", null, "Recher_cher", null, null, null), new ActionEntry("Aide", null, "_Aide", null, null, null), actionEntryQuit, new ActionEntry("Préférences", Gtk.Stock.Preferences, null, null, "Préférences", new EventHandler(Preferences)), new ActionEntry("RubriquesAide", Gtk.Stock.Help, "Rubriques d'_aide", "F1", "Aide - Rubriques d'aide", new EventHandler(Help)), new ActionEntry("APropos", Gtk.Stock.About, null, null, "A propos de l'environnement Sofia", new EventHandler(About)) }; actions.Add(entries); InsertActionGroup(actions, 0); this.viewGui.AddAccelGroup(AccelGroup); uint id = 0; try { id = AddUiFromFile("MainUIDef.xml"); } catch { RemoveUi(id); } }
private void OnPlayClicked(object o, EventArgs args) { if (track != null) { // Pause playback only if the selected track is playing. if (ServiceManager.PlayerEngine.CurrentTrack == track && ServiceManager.PlayerEngine.CurrentState == PlayerState.Playing) { ServiceManager.PlayerEngine.Pause(); Image play = new Image(); play.IconName = "media-playback-start"; play.IconSize = (int)IconSize.Menu; ((Button)o).Image = play; } else { ServiceManager.PlayerEngine.Open(track); Gtk.ActionGroup actions = ServiceManager.Get <InterfaceActionService> ().PlaybackActions; (actions["StopWhenFinishedAction"] as Gtk.ToggleAction).Active = true; ServiceManager.PlayerEngine.Play(); Image stop = new Image(); stop.IconName = "media-playback-stop"; stop.IconSize = (int)IconSize.Menu; ((Button)o).Image = stop; } } }
public EntityListView() { SizeRequested += delegate(object o, SizeRequestedArgs args) { if (Child != null) args.Requisition = Child.SizeRequest (); }; SizeAllocated += delegate(object o, SizeAllocatedArgs args) { if (Child != null) Child.Allocation = args.Allocation; }; VBox vBox = new VBox(); ScrolledWindow scrolledWindow = new ScrolledWindow(); scrolledWindow.ShadowType = ShadowType.In; treeView = new TreeView(); scrolledWindow.Add (treeView); vBox.Add (scrolledWindow); Add (vBox); ShowAll (); actionGroup = new ActionGroup("entityListView"); }
private string getUi(ActionGroup actionGroup) { string uiItems = ""; foreach (Gtk.Action action in actionGroup.ListActions()) uiItems = uiItems + String.Format (uiItem, action.Name); return prefix + uiItems + sufix; }
public override void Initialize () { action_group = new Gtk.ActionGroup ("RemoveBrokenLinks"); action_group.Add (new Gtk.ActionEntry [] { new Gtk.ActionEntry ("ToolsMenuAction", null, Catalog.GetString ("_Tools"), null, null, null), new Gtk.ActionEntry ("RemoveBrokenLinksAction", null, Catalog.GetString ("_Remove broken links"), null, null, delegate { OnRemoveBrokenLinksActivated (); }) }); rblUi = Tomboy.ActionManager.UI.AddUiFromString (@" <ui> <menubar name='MainWindowMenubar'> <placeholder name='MainWindowMenuPlaceholder'> <menu name='ToolsMenu' action='ToolsMenuAction'> <menuitem name='RemoveBrokenLinks' action='RemoveBrokenLinksAction' /> </menu> </placeholder> </menubar> </ui> "); Tomboy.ActionManager.UI.InsertActionGroup (action_group, 0); initialized = true; }
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); }; }
public MainUIManager(ViewGui viewGui) { this.viewGui = viewGui; actions = new ActionGroup ("Actions"); ActionEntry actionEntryQuit; actionEntryQuit = new ActionEntry("Quitter", Gtk.Stock.Quit, null, "<control>Q", "Quitter l'environnement Sofia", new EventHandler (Quit)); ActionEntry[] entries = new ActionEntry [] { new ActionEntry ("Fichier", null, "_Fichier", null, null, null), new ActionEntry ("Editer", null, "Editio_n", null, null, null), new ActionEntry ("Rechercher", null, "Recher_cher", null, null, null), new ActionEntry ("Aide", null, "_Aide", null, null, null), actionEntryQuit, new ActionEntry ("Préférences", Gtk.Stock.Preferences, null, null, "Préférences", new EventHandler (Preferences)), new ActionEntry ("RubriquesAide", Gtk.Stock.Help, "Rubriques d'_aide", "F1", "Aide - Rubriques d'aide", new EventHandler (Help)), new ActionEntry ("APropos", Gtk.Stock.About, null, null, "A propos de l'environnement Sofia", new EventHandler (About)) }; actions.Add (entries); InsertActionGroup(actions, 0); this.viewGui.AddAccelGroup(AccelGroup); uint id = 0; try { id = AddUiFromFile("MainUIDef.xml"); } catch { RemoveUi(id); } }
public override void Initialize() { action_group = new Gtk.ActionGroup("RemoveBrokenLinks"); action_group.Add(new Gtk.ActionEntry [] { new Gtk.ActionEntry("ToolsMenuAction", null, Catalog.GetString("_Tools"), null, null, null), new Gtk.ActionEntry("RemoveBrokenLinksAction", null, Catalog.GetString("_Remove broken links"), null, null, delegate { OnRemoveBrokenLinksActivated(); }) }); rblUi = Tomboy.ActionManager.UI.AddUiFromString(@" <ui> <menubar name='MainWindowMenubar'> <placeholder name='MainWindowMenuPlaceholder'> <menu name='ToolsMenu' action='ToolsMenuAction'> <menuitem name='RemoveBrokenLinks' action='RemoveBrokenLinksAction' /> </menu> </placeholder> </menubar> </ui> " ); Tomboy.ActionManager.UI.InsertActionGroup(action_group, 0); initialized = true; }
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); }
static void PostActivate_cb(IntPtr inst, IntPtr action) { try { ActionGroup __obj = GLib.Object.GetObject(inst, false) as ActionGroup; __obj.OnPostActivate(GLib.Object.GetObject(action) as Gtk.Action); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
static void DisconnectProxy_cb(IntPtr inst, IntPtr action, IntPtr proxy) { try { ActionGroup __obj = GLib.Object.GetObject(inst, false) as ActionGroup; __obj.OnDisconnectProxy(GLib.Object.GetObject(action) as Gtk.Action, GLib.Object.GetObject(proxy) as Gtk.Widget); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
private void OnPlayClicked(object o, EventArgs args) { if (track != null) { ServiceManager.PlayerEngine.Open(track); Gtk.ActionGroup actions = ServiceManager.Get <InterfaceActionService> ().PlaybackActions; (actions["StopWhenFinishedAction"] as Gtk.ToggleAction).Active = true; } }
public override void Initialize() { Logger.Debug("TasksApplicationAddin.Initialize ()"); if (manager == null) { lock (locker) { if (manager == null) { manager = new TaskManager( Path.Combine(Tomboy.DefaultNoteManager.NoteDirectoryPath, "Tasks")); } } /// /// Add a "To Do List" to Tomboy's Tray Icon Menu /// action_group = new Gtk.ActionGroup("Tasks"); action_group.Add(new Gtk.ActionEntry [] { new Gtk.ActionEntry("ToolsMenuAction", null, Catalog.GetString("_Tools"), null, null, null), new Gtk.ActionEntry("OpenToDoListAction", null, Catalog.GetString("To Do List"), null, null, delegate { OnOpenToDoListAction(); }) }); // tray_icon_ui = Tomboy.ActionManager.UI.AddUiFromString (@" // <ui> // <popup name='TrayIconMenu' action='TrayIconMenuAction'> // <menuitem name='OpenToDoList' action='OpenToDoListAction' /> // </popup> // </ui> // "); tools_menu_ui = Tomboy.ActionManager.UI.AddUiFromString(@" <ui> <menubar name='MainWindowMenubar'> <placeholder name='MainWindowMenuPlaceholder'> <menu name='ToolsMenu' action='ToolsMenuAction'> <menuitem name='OpenToDoList' action='OpenToDoListAction' /> </menu> </placeholder> </menubar> </ui> " ); Tomboy.ActionManager.UI.InsertActionGroup(action_group, 0); Tomboy.DefaultNoteManager.NoteDeleted += OnNoteDeleted; tomboy_tray_menu = GetTomboyTrayMenu(); tomboy_tray_menu.Shown += OnTomboyTrayMenuShown; tomboy_tray_menu.Hidden += OnTomboyTrayMenuHidden; initialized = true; } }
public MainWindow (): base (Gtk.WindowType.Toplevel) { // this window this.Title= "Supos"; this.DeleteEvent += OnDeleteEvent; // main vbox mainBox = new VBox(false, 0); this.Add(mainBox); // actiongroup and uimanager stuff (menubar) actgroup = new ActionGroup ("TestActions"); SetUpActionGroup(); uim = new UIManager (); uim.InsertActionGroup (actgroup, 0); this.AddAccelGroup(uim.AccelGroup); SetUpUiManager(); Gtk.Widget menubar = uim.GetWidget("/MenuBar"); mainBox.PackStart(menubar, false, false, 0); actgroup.GetAction("disconnect").Sensitive=false; // main panned view mainPaned = new HPaned(); mainPaned.Sensitive = false; mainPaned.Name = "toucharea"; mainBox.PackStart(mainPaned, true, true, 0); // order editing view orderview = new ViewOrderEdit(); mainPaned.Pack2(orderview, false, false); // categories product paned view HPaned hpan2; hpan2 = new HPaned(); mainPaned.Pack1(hpan2, true, false); // categories view catview = new ViewNameIcon(); catview.DataMember="Categories"; catview.SelectionChanged += this.OnCatSelectionChanged; catview.WidthRequest= 200; hpan2.Pack1(catview, false, false); // products view prodview = new ViewNameIcon(); prodview.DataMember = "Products"; prodview.RowActivated += this.OnProdRowActivated; prodview.WidthRequest= 400; hpan2.Pack2(prodview, true, false); // status bar Statusbar statusbar; statusbar = new Statusbar(); mainBox.PackStart(statusbar, false, false, 0); // clock Clock clock; clock = new Clock(); clock.BorderWidth = 6; statusbar.PackStart(clock, false, false, 0); // END build interface this.ApplyViewPreferences(SettingsHandler.Settings.viewSettings); }
public void AddActionGroup (ActionGroup group) { lock (this) { if (action_groups.ContainsKey (group.Name)) { throw new ApplicationException ("Group already exists"); } InnerAddActionGroup (group); } }
public override void Initialize () { Logger.Debug ("TasksApplicationAddin.Initialize ()"); if (manager == null) { lock (locker) { if (manager == null) { manager = new TaskManager ( Path.Combine (Tomboy.DefaultNoteManager.NoteDirectoryPath, "Tasks")); } } /// /// Add a "To Do List" to Tomboy's Tray Icon Menu /// action_group = new Gtk.ActionGroup ("Tasks"); action_group.Add (new Gtk.ActionEntry [] { new Gtk.ActionEntry ("ToolsMenuAction", null, Catalog.GetString ("_Tools"), null, null, null), new Gtk.ActionEntry ("OpenToDoListAction", null, Catalog.GetString ("To Do List"), null, null, delegate { OnOpenToDoListAction (); }) }); // tray_icon_ui = Tomboy.ActionManager.UI.AddUiFromString (@" // <ui> // <popup name='TrayIconMenu' action='TrayIconMenuAction'> // <menuitem name='OpenToDoList' action='OpenToDoListAction' /> // </popup> // </ui> // "); tools_menu_ui = Tomboy.ActionManager.UI.AddUiFromString (@" <ui> <menubar name='MainWindowMenubar'> <placeholder name='MainWindowMenuPlaceholder'> <menu name='ToolsMenu' action='ToolsMenuAction'> <menuitem name='OpenToDoList' action='OpenToDoListAction' /> </menu> </placeholder> </menubar> </ui> "); Tomboy.ActionManager.UI.InsertActionGroup (action_group, 0); Tomboy.DefaultNoteManager.NoteDeleted += OnNoteDeleted; tomboy_tray_menu = GetTomboyTrayMenu (); tomboy_tray_menu.Shown += OnTomboyTrayMenuShown; tomboy_tray_menu.Hidden += OnTomboyTrayMenuHidden; initialized = true; } }
public void ShowWindow () { Application.Init (); gxml = new Glade.XML ("contactviewer.glade", "MainWindow"); gxml.Autoconnect (this); ActionEntry[] entries = new ActionEntry [] { new ActionEntry ("FileMenuAction", null, "_File", null, null, null), new ActionEntry ("OpenAction", Gtk.Stock.Open, "_Open", "<control>O", Catalog.GetString ("Open..."), new EventHandler (OnOpenDatabase)), new ActionEntry ("QuitAction", Gtk.Stock.Quit, "_Quit", "<control>Q", Catalog.GetString ("Quit"), new EventHandler (OnQuit)), new ActionEntry ("HelpMenuAction", null, "_Help", null, null, null), new ActionEntry ("AboutAction", Gnome.Stock.About, "_About", null, Catalog.GetString ("About"), new EventHandler (OnAbout)) }; ActionGroup grp = new ActionGroup ("MainGroup"); grp.Add (entries); ui_manager = new UIManager (); ui_manager.InsertActionGroup(grp, 0); ui_manager.AddUiFromResource ("menu.xml"); MenubarHolder.Add (ui_manager.GetWidget ("/MainMenu")); // Fix the TreeView that will contain all contacts contact_store = new ListStore (typeof (string), typeof (string)); ContactList.Model = contact_store; ContactList.RulesHint = true; ContactList.AppendColumn (Catalog.GetString ("Contacts"), new CellRendererText (), "text", 1); ContactList.ButtonReleaseEvent += OnContactSelected; // This ListStore will let the user choose what to see in the contact list contact_show_type_store = new ListStore (typeof (string), typeof (string)); contact_show_type_store.AppendValues ("DisplayName", Catalog.GetString ("Display name")); contact_show_type_store.AppendValues ("PrimaryEmail", Catalog.GetString ("Primary E-mail")); contact_show_type_store.AppendValues ("SecondEmail", Catalog.GetString ("Secondary E-mail")); contact_show_type_store.AppendValues ("NickName", Catalog.GetString ("Nickname")); CellRendererText cell = new CellRendererText (); ListIdentifier.PackStart (cell, false); ListIdentifier.AddAttribute (cell, "text", 1); ListIdentifier.Model = contact_show_type_store; ListIdentifier.Active = 0; ListIdentifier.Changed += OnContactListTypeChanged; MainWindow.Icon = Beagle.Images.GetPixbuf ("contact-icon.png"); MainWindow.DeleteEvent += OnDeleteEvent; LoadDatabase (); Application.Run (); }
public TaskUIHandler() { m_Actions = new ActionGroup ("Task"); this.AddTaskActions (m_Actions); var guiService = ServiceManager.Get<GuiService> (); guiService.Window.Planning.TasksTreeView.Selection.Changed += delegate { int count = guiService.Window.Planning.TasksTreeView.Selection.CountSelectedRows (); m_removeTask.Sensitive = count > 0; }; }
public void SetActionGroup(ActionGroup actionGroup) { if (this.actionGroup != null) { //this.actionGroup es el anterior uIManager.RemoveUi(mergeId); uIManager.RemoveActionGroup(this.actionGroup); } this.actionGroup = actionGroup; if (actionGroup == null) return; uIManager.InsertActionGroup(actionGroup, 0); mergeId = uIManager.AddUiFromString (getUi(actionGroup)); }
static IntPtr GetAction_cb(IntPtr inst, IntPtr action_name) { try { ActionGroup __obj = GLib.Object.GetObject(inst, false) as ActionGroup; Gtk.Action __result; __result = __obj.OnGetAction(GLib.Marshaller.Utf8PtrToString(action_name)); return(__result == null ? IntPtr.Zero : __result.Handle); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, true); // NOTREACHED: above call does not return. throw e; } }
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); }
public EditUIHandler() { m_Actions = new ActionGroup ("Edit"); this.AddEditActions (m_Actions); var cmdService = ServiceManager.Get<CommandService> (); cmdService.Commands.Changed += delegate { undo.Sensitive = cmdService.Commands.CanUndo; redo.Sensitive = cmdService.Commands.CanRedo; undo.Label = String.Format ("Undo {0}", cmdService.Commands.UndoText); redo.Label = String.Format ("Redo {0}", cmdService.Commands.RedoText); }; }
//------------------------------------------------------------------------------ public MainMenu() { uim = new Gtk.UIManager(); Gtk.ActionGroup actions = new Gtk.ActionGroup("MenuBarActions" + Guid.NewGuid()); actions.Add(getActionEntries()); uim.InsertActionGroup(actions, 0); // Put the XML definition of the controls (widgets) into the UIManager's buffer -and- create controls (widgets). uim.AddUiFromString(UI.ToString()); instance = (Gtk.MenuBar)uim.GetWidget("/menubar"); instance.ShowAll(); }
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); }
public LircPlugin() { actions = new ActionGroup("Lirc"); ctrl = new ActionMapper(new BansheeController()); actions.Add(new ActionEntry[] { new ActionEntry("LircAction", null, "_Lirc", null, "Configure the Lirc Addin", null), new ActionEntry("LircConfigureAction", Stock.Properties, "_Configure", null, "Configure the Lirc addin", OnConfigurePlugin), }); action_service = ServiceManager.Get<InterfaceActionService>("InterfaceActionService"); action_service.UIManager.InsertActionGroup(actions, 0); action_service.UIManager.AddUiFromResource("Ui.xml"); }
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); }
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) ); }; }
//Pixbuf logoPixbuf; //Pixbuf bgPixbuf; //DrawingArea drawingArea; // private Gdk.Pixbuf imagePb; // private Gtk.Image image; public StartPage(string path) { //string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "moscrif.png"); //logoPixbuf = new Gdk.Pixbuf (file); //bgPixbuf = new Gdk.Pixbuf (file); editorAction = new Gtk.ActionGroup("startpage"); this.fileName = path; control = new Gtk.ScrolledWindow(); (control as Gtk.ScrolledWindow).ShadowType = Gtk.ShadowType.Out; eventBox = new StartEventControl();//new Gtk.EventBox(); //(control as Gtk.ScrolledWindow).Add(eventBox); (control as Gtk.ScrolledWindow).AddWithViewport (eventBox); (control as Gtk.ScrolledWindow).FocusChain = new Widget[] { eventBox }; control.ShowAll(); //eventBox.ExposeEvent+= Expose; eventBox.ShowAll(); }
//Pixbuf logoPixbuf; //Pixbuf bgPixbuf; //DrawingArea drawingArea; // private Gdk.Pixbuf imagePb; // private Gtk.Image image; public StartPage(string path) { //string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "moscrif.png"); //logoPixbuf = new Gdk.Pixbuf (file); //bgPixbuf = new Gdk.Pixbuf (file); editorAction = new Gtk.ActionGroup("startpage"); this.fileName = path; control = new Gtk.ScrolledWindow(); (control as Gtk.ScrolledWindow).ShadowType = Gtk.ShadowType.Out; eventBox = new StartEventControl(); //new Gtk.EventBox(); //(control as Gtk.ScrolledWindow).Add(eventBox); (control as Gtk.ScrolledWindow).AddWithViewport(eventBox); (control as Gtk.ScrolledWindow).FocusChain = new Widget[] { eventBox }; control.ShowAll(); //eventBox.ExposeEvent+= Expose; eventBox.ShowAll(); }
public ChatWindow() : base(Gtk.WindowType.Toplevel) { this.Title = "#gnome-hackers on irc.gimp.net - Logopathy"; this.DeleteEvent += OnDeleteEvent; this.Table = new Gtk.Table(5, 5, false); this.Add(this.Table); this.ActionGroup = new Gtk.ActionGroup("General"); SetUpActionGroup(); UiManager = new Gtk.UIManager(); UiManager.InsertActionGroup(this.ActionGroup, 0); AddAccelGroup(UiManager.AccelGroup); SetUpUiManager(); this.MenuBar = UiManager.GetWidget("/MenuBar"); this.Table.Attach(this.MenuBar, 0, 5, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); MainPaned = new Gtk.HPaned(); this.Table.Attach(MainPaned, 0, 5, 1, 2); LeftSidebar = new Gtk.VPaned(); MainPaned.Pack1(LeftSidebar, true, true); ServerView = new Logopathy.Gui.ServerListView(); ServerViewSW = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0)); ServerViewSW.Add(ServerView); LeftSidebar.Pack1(ServerViewSW, true, true); UserView = new Logopathy.Gui.UserView(); UserViewSW = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0)); UserViewSW.Add(UserView); LeftSidebar.Pack2(UserViewSW, true, true); ChatNotebook = new Logopathy.Gui.ChatNotebook(new TpServer()); MainPaned.Pack2(ChatNotebook, true, true); }
private BookmarkUI () { action_service = ServiceManager.Get<InterfaceActionService> (); actions = new ActionGroup ("Bookmarks"); actions.Add (new ActionEntry [] { new ActionEntry ("BookmarksAction", null, Catalog.GetString ("_Bookmarks"), null, null, null), new ActionEntry ("BookmarksAddAction", Stock.Add, Catalog.GetString ("_Add Bookmark"), "<control>D", Catalog.GetString ("Bookmark the Position in the Current Track"), HandleNewBookmark) }); action_service.UIManager.InsertActionGroup (actions, 0); ui_manager_id = action_service.UIManager.AddUiFromResource ("BookmarksMenu.xml"); bookmark_item = action_service.UIManager.GetWidget ("/MainMenu/ToolsMenu/Bookmarks") as ImageMenuItem; new_item = action_service.UIManager.GetWidget ("/MainMenu/ToolsMenu/Bookmarks/Add") as ImageMenuItem; bookmark_menu = bookmark_item.Submenu as Menu; bookmark_item.Selected += HandleMenuShown; remove_item = new ImageMenuItem (Catalog.GetString ("_Remove Bookmark")); remove_item.Sensitive = false; remove_item.Image = new Image (Stock.Remove, IconSize.Menu); remove_item.Submenu = remove_menu = new Menu (); bookmark_menu.Append (remove_item); actions["BookmarksAction"].Activated += (o, a) => { if (!loaded) { LoadBookmarks (); loaded = true; } }; }
void AddProjectActions(ActionGroup actionGroup) { var guiService = ServiceManager.Get<GuiService> (); var project = new Gtk.Action ("project", Catalog.GetString ("_Project")); actionGroup.Add (project); var addproject = new Gtk.Action ("add-project", Catalog.GetString ("_Add Project"), null, Gtk.Stock.Add); addproject.Activated += delegate { guiService.Window.Planning.AppendProject (); }; actionGroup.Add (addproject, "<Control>plus"); var removeproject = new Gtk.Action ("remove-project", Catalog.GetString ("_Remove Project"), null, Gtk.Stock.Remove); removeproject.Sensitive = false; guiService.Window.Planning.ProjectChanged += delegate { var p = guiService.Window.Planning.SelectedProject; removeproject.Sensitive = p != null && p.Id > 0; }; removeproject.Activated += delegate { guiService.Window.Planning.RemoveSelectedProject (); }; actionGroup.Add (removeproject); }
private void InstallInterfaceActions() { actions = new ActionGroup("Mirage Playlist Generator"); actions.Add(new ActionEntry [] { new ActionEntry ("MirageAction", null, AddinManager.CurrentLocalizer.GetString ("Mirage Playlist Generator"), null, AddinManager.CurrentLocalizer.GetString ("Manage the Mirage extension"), null), new ActionEntry("MirageRescanMusicAction", null, AddinManager.CurrentLocalizer.GetString ("Rescan the Music Library"), null, AddinManager.CurrentLocalizer.GetString ("Rescans the Music Library for new songs"), OnMirageRescanMusicHandler), new ActionEntry("MirageDuplicateSearchAction", null, AddinManager.CurrentLocalizer.GetString ("Duplicate Search (Experimental)"), null, AddinManager.CurrentLocalizer.GetString ("Searches your Music Library for possible duplicates"), OnMirageDuplicateSearchHandler), new ActionEntry("MirageResetAction", null, AddinManager.CurrentLocalizer.GetString ("Reset Mirage"), null, AddinManager.CurrentLocalizer.GetString ("Resets the Mirage Playlist Generation Plugin. "+ "All songs have to be analyzed again to use Automatic Playlist Generation."), OnMirageResetHandler), }); action_service.UIManager.InsertActionGroup(actions, 0); uiManagerId = action_service.UIManager.AddUiFromResource("MirageMenu.xml"); }
public void Dispose() { ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent); Hyena.Log.Debug ("Disposing LCD service"); action_service.UIManager.RemoveUi (ui_manager_id); action_service.UIManager.RemoveActionGroup (actions); actions = null; lcdclient.Dispose(); lcdclient = null; ScreensDelete(); }
void IExtensionService.Initialize() { Hyena.Log.Debug ("Initializing LCD service"); action_service = ServiceManager.Get<InterfaceActionService> (); actions = new ActionGroup ("LCD"); actions.Add (new ActionEntry [] { new ActionEntry ("LCDAction", null, AddinManager.CurrentLocalizer.GetString ("LCD"), null, null, null), new ActionEntry ("LCDConfigureAction", Stock.Properties, AddinManager.CurrentLocalizer.GetString ("_Configure..."), null, AddinManager.CurrentLocalizer.GetString ("Configure the LCD plugin"), OnConfigure) }); action_service.UIManager.InsertActionGroup (actions, 0); ui_manager_id = action_service.UIManager.AddUiFromResource ("LCDMenu.xml"); ScreensCreate(); lcdclient = new LCDClient(Host, Port); lcdclient.Connected += OnConnected; parser = new LCDParser(); ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.Iterate | PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.TrackInfoUpdated | PlayerEvent.StateChange); }
// ============================================ // PUBLIC Constructors // ============================================ public MenuManager() { ActionEntry[] entries = new ActionEntry[] { new ActionEntry("FileMenu", null, "_File", null, null, null), new ActionEntry("ViewMenu", null, "_View", null, null, null), new ActionEntry("GoMenu", null, "_Go", null, null, null), new ActionEntry("ToolMenu", null, "_Tool", null, null, null), new ActionEntry("NetworkMenu", null, "_Network", null, null, null), new ActionEntry("HelpMenu", null, "_Help", null, null, null), // File Menu new ActionEntry("ProxySettings", "Proxy", "Proxy Settings", null, "Setup Proxy", new EventHandler(ActionActivated)), new ActionEntry("Logout", "Logout", "Logout", null, "Logout", new EventHandler(ActionActivated)), new ActionEntry("Quit", Gtk.Stock.Quit, "Quit", "<control>Q", "Quit Shared Folder", new EventHandler(ActionActivated)), // View Menu new ActionEntry("Refresh", Gtk.Stock.Refresh, "Refresh", null, null, new EventHandler(ActionActivated)), // Go Menu new ActionEntry("GoUp", Gtk.Stock.GoUp, "UP", null, "Open The Parent Folder", new EventHandler(ActionActivated)), new ActionEntry("GoHome", Gtk.Stock.Home, "Home", null, "Open The Root Directory", new EventHandler(ActionActivated)), new ActionEntry("GoMyFolder", "StockMyFolder", "MyFolder", null, "My Shared Folder", new EventHandler(ActionActivated)), new ActionEntry("GoNetwork", "StockNetwork", "Network", null, "View Network", new EventHandler(ActionActivated)), // Network new ActionEntry("SetPort", Gtk.Stock.Preferences, "Set P2P Port", null, "Set P2P Port", new EventHandler(ActionActivated)), new ActionEntry("AddPeer", Gtk.Stock.Network, "Add Peer", null, "Add New Peer", new EventHandler(ActionActivated)), new ActionEntry("RmPeer", Gtk.Stock.Delete, "Remove Peer", null, "Remove Peer", new EventHandler(ActionActivated)), new ActionEntry("DownloadManager", "Download", "Download Manager", null, "Download Manager", new EventHandler(ActionActivated)), // Help Menu new ActionEntry("About", Gtk.Stock.About, "About", null, "About Shared Folder", new EventHandler(ActionActivated)), }; // Toggle items ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] { // View new ToggleActionEntry("ViewToolBar", null, "ToolBar", null, null, new EventHandler(ActionActivated), true), new ToggleActionEntry("ViewUserPanel", null, "User Panel", null, null, new EventHandler(ActionActivated), true), // Network new ToggleActionEntry("NetOnline", null, "Online", null, null, new EventHandler(ActionActivated), false) }; actionGroup = new ActionGroup("group"); actionGroup.Add(entries); actionGroup.Add(toggleEntries); InsertActionGroup(actionGroup, 0); AddUiFromString(uiInfo); }
Gtk.Menu CreateMenu () { if (menu != null) return menu; var group = new ActionGroup ("Popup"); var help = new Gtk.Action ("help", GettextCatalog.GetString ("Show Error Reference"), GettextCatalog.GetString ("Show Error Reference"), Gtk.Stock.Help); help.Activated += OnShowReference; group.Add (help, "F1"); var copy = new Gtk.Action ("copy", GettextCatalog.GetString ("_Copy"), GettextCatalog.GetString ("Copy task"), Gtk.Stock.Copy); copy.Activated += OnTaskCopied; group.Add (copy, "<Control><Mod2>c"); var jump = new Gtk.Action ("jump", GettextCatalog.GetString ("_Go to"), GettextCatalog.GetString ("Go to task"), Gtk.Stock.JumpTo); jump.Activated += OnTaskJumpto; group.Add (jump); var columns = new Gtk.Action ("columns", GettextCatalog.GetString ("Columns")); group.Add (columns, null); var columnType = new ToggleAction ("columnType", GettextCatalog.GetString ("Type"), GettextCatalog.GetString ("Toggle visibility of Type column"), null); columnType.Toggled += OnColumnVisibilityChanged; columnsActions[columnType] = VisibleColumns.Type; group.Add (columnType); var columnValidity = new ToggleAction ("columnValidity", GettextCatalog.GetString ("Validity"), GettextCatalog.GetString ("Toggle visibility of Validity column"), null); columnValidity.Toggled += OnColumnVisibilityChanged; columnsActions[columnValidity] = VisibleColumns.Marked; group.Add (columnValidity); var columnLine = new ToggleAction ("columnLine", GettextCatalog.GetString ("Line"), GettextCatalog.GetString ("Toggle visibility of Line column"), null); columnLine.Toggled += OnColumnVisibilityChanged; columnsActions[columnLine] = VisibleColumns.Line; group.Add (columnLine); var columnDescription = new ToggleAction ("columnDescription", GettextCatalog.GetString ("Description"), GettextCatalog.GetString ("Toggle visibility of Description column"), null); columnDescription.Toggled += OnColumnVisibilityChanged; columnsActions[columnDescription] = VisibleColumns.Description; group.Add (columnDescription); var columnFile = new ToggleAction ("columnFile", GettextCatalog.GetString ("File"), GettextCatalog.GetString ("Toggle visibility of File column"), null); columnFile.Toggled += OnColumnVisibilityChanged; columnsActions[columnFile] = VisibleColumns.File; group.Add (columnFile); var columnProject = new ToggleAction ("columnProject", GettextCatalog.GetString ("Project"), GettextCatalog.GetString ("Toggle visibility of Project column"), null); columnProject.Toggled += OnColumnVisibilityChanged; columnsActions[columnProject] = VisibleColumns.Project; group.Add (columnProject); var columnPath = new ToggleAction ("columnPath", GettextCatalog.GetString ("Path"), GettextCatalog.GetString ("Toggle visibility of Path column"), null); columnPath.Toggled += OnColumnVisibilityChanged; columnsActions[columnPath] = VisibleColumns.Path; group.Add (columnPath); var uiManager = new UIManager (); uiManager.InsertActionGroup (group, 0); string uiStr = "<ui><popup name='popup'>" + "<menuitem action='help'/>" + "<menuitem action='copy'/>" + "<menuitem action='jump'/>" + "<separator/>" + "<menu action='columns'>" + "<menuitem action='columnType' />" + "<menuitem action='columnValidity' />" + "<menuitem action='columnLine' />" + "<menuitem action='columnDescription' />" + "<menuitem action='columnFile' />" + "<menuitem action='columnProject' />" + "<menuitem action='columnPath' />" + "</menu>" + "</popup></ui>"; uiManager.AddUiFromString (uiStr); menu = (Menu)uiManager.GetWidget ("/popup"); menu.ShowAll (); menu.Shown += delegate { columnType.Active = view.Columns[VisibleColumns.Type].Visible; columnValidity.Active = view.Columns[VisibleColumns.Marked].Visible; columnLine.Active = view.Columns[VisibleColumns.Line].Visible; columnDescription.Active = view.Columns[VisibleColumns.Description].Visible; columnFile.Active = view.Columns[VisibleColumns.File].Visible; columnProject.Active = view.Columns[VisibleColumns.Project].Visible; columnPath.Active = view.Columns[VisibleColumns.Path].Visible; help.Sensitive = copy.Sensitive = jump.Sensitive = view.Selection != null && view.Selection.CountSelectedRows () > 0 && (columnType.Active || columnValidity.Active || columnLine.Active || columnDescription.Active || columnFile.Active || columnPath.Active); }; return menu; }
private void RegisterUIManager() { ActionGroup trayActionGroup = new ActionGroup ("Tray"); trayActionGroup.Add (new ActionEntry [] { new ActionEntry ("NewTaskAction", Stock.New, Catalog.GetString ("New Task ..."), null, null, OnNewTask), new ActionEntry ("ShowTasksAction", null, Catalog.GetString ("Show Tasks ..."), null, null, OnShowTaskWindow), new ActionEntry ("AboutAction", Stock.About, OnAbout), new ActionEntry ("PreferencesAction", Stock.Preferences, OnPreferences), new ActionEntry ("RefreshAction", Stock.Execute, Catalog.GetString ("Refresh Tasks ..."), null, null, OnRefreshAction), new ActionEntry ("QuitAction", Stock.Quit, OnQuit) }); uiManager = new UIManager (); uiManager.AddUiFromString (menuXml); uiManager.InsertActionGroup (trayActionGroup, 0); }
public UIManager(SearchWindow search) { this.search = search; this.actions = new ActionGroup("Actions"); ActionEntry quit_action_entry; if (search.IconEnabled) { quit_action_entry = new ActionEntry("Quit", Gtk.Stock.Close, null, "<control>Q", Catalog.GetString("Close Desktop Search"), Quit); } else { quit_action_entry = new ActionEntry("Quit", Gtk.Stock.Quit, null, "<control>Q", Catalog.GetString("Exit Desktop Search"), Quit); } Gtk.ActionEntry[] entries = new ActionEntry[] { new ActionEntry("Search", null, Catalog.GetString("_Search"), null, null, null), new ActionEntry("Domain", null, Catalog.GetString("Search _Domains"), null, null, null), new ActionEntry("Actions", null, Catalog.GetString("_Actions"), null, null, null), new ActionEntry("View", null, Catalog.GetString("_View"), null, null, null), new ActionEntry("Service", null, Catalog.GetString("Service _Options"), null, null, null), new ActionEntry("Help", null, Catalog.GetString("_Help"), null, null, null), quit_action_entry, new ActionEntry("Preferences", Gtk.Stock.Preferences, null, null, Catalog.GetString("Exit Desktop Search"), Preferences), new ActionEntry("StartService", Gtk.Stock.Execute, Catalog.GetString("Start service"), null, null, StartService), new ActionEntry("StopService", Gtk.Stock.Stop, Catalog.GetString("Stop service"), null, null, StopService), new ActionEntry("IndexInfo", Gtk.Stock.Index, Catalog.GetString("Index information"), null, null, IndexInfo), new ActionEntry("Contents", Gtk.Stock.Help, Catalog.GetString("_Contents"), "F1", Catalog.GetString("Help - Table of Contents"), Help), new ActionEntry("About", Gnome.Stock.About, null, null, Catalog.GetString("About Desktop Search"), About), new ActionEntry("QuickTips", null, Catalog.GetString("Quick Tips"), null, null, QuickTips), new ActionEntry("FocusSearchEntry", null, "", "<control>K", null, OnFocusSearchEntry), new ActionEntry("FocusSearchEntry2", null, "", "<control>L", null, OnFocusSearchEntry), new ActionEntry("HideWindow", null, "", "Escape", null, OnHideWindow), new ActionEntry("HideWindow2", null, "", "<control>W", null, OnHideWindow) }; actions.Add(entries); sort_entries = new RadioActionEntry[] { new RadioActionEntry("SortModified", null, Catalog.GetString("Sort by Date _Modified"), null, Catalog.GetString("Sort the most-recently-modified matches first"), (int)SortType.Modified), new RadioActionEntry("SortName", null, Catalog.GetString("Sort by _Name"), null, Catalog.GetString("Sort matches by name"), (int)SortType.Name), new RadioActionEntry("SortRelevance", null, Catalog.GetString("Sort by _Relevance"), null, Catalog.GetString("Sort the best matches first"), (int)SortType.Relevance), }; actions.Add(sort_entries, (int)SortType.Modified, OnSortChanged); domain_entries = new ToggleActionEntry [] { new ToggleActionEntry("Local", null, Catalog.GetString("_Local"), null, Catalog.GetString("Search in personal data in this computer"), /* personal files, emails */ OnDomainChanged, true), new ToggleActionEntry("System", null, Catalog.GetString("_System"), null, Catalog.GetString("Search in system data on this computer"), /* system manpages, applications */ OnDomainChanged, true), new ToggleActionEntry("Global", null, Catalog.GetString("_Global"), null, Catalog.GetString("Search in internet services"), /* gmail and other web services */ OnDomainChanged, false), new ToggleActionEntry("Neighborhood", null, Catalog.GetString("_Neighborhood"), null, Catalog.GetString("Search on computers near me"), /* remote beagle services */ OnDomainChanged, false) }; actions.Add(domain_entries); view_entries = new ToggleActionEntry[] { new ToggleActionEntry("ShowDetails", null, Catalog.GetString("Show Details"), null, null, OnToggleDetails, true) }; actions.Add(view_entries); InsertActionGroup(actions, 0); search.AddAccelGroup(AccelGroup); AddUiFromString(ui_def); }
public ImageEditor(string filePath) { fileName = filePath; fileBarierName = fileName + ".mso"; if (System.IO.File.Exists(fileBarierName)) { string barierFile; try { using (StreamReader file = new StreamReader(fileBarierName)) { barierFile = file.ReadToEnd(); file.Close(); file.Dispose(); } if (!string.IsNullOrEmpty(barierFile)) { //listPoint = JsonConvert.DeserializeObject<List<BarierPoint>>(barierFile); System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); jss.RegisterConverters(new[] { new BarierPointJavaScriptConverter() }); listPoint = jss.Deserialize <List <BarierPoint> >(barierFile); } } catch (Exception ex) { MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_cannot_open", fileBarierName), ex.Message, Gtk.MessageType.Error, null); ms.ShowDialog(); } } editorAction = new Gtk.ActionGroup("imageeditor"); //ic = new ImageCanvas(filePath,listPoint); ic = new ImageCanvas(filePath, listPoint) { Name = "canvas", CanDefault = true, CanFocus = true, Events = (Gdk.EventMask) 16134 }; vbox = new Gtk.VBox(); /*Gdk.Color col = new Gdk.Color(255,255,0); * vbox.ModifyBg(StateType.Normal, col);*/ itc = new ImageToolBarControl(ic); //new ImageToolBarControl(ic); itc.DeleteBarierLayerEvent += delegate(object sender, EventArgs e) { if (System.IO.File.Exists(fileBarierName)) { try{ System.IO.File.Delete(fileBarierName); OnModifiedChanged(false); ic.DeleteBarier(); }catch (Exception ex) { MessageDialogs mdd = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_delete_file", fileBarierName), ex.Message, Gtk.MessageType.Error); mdd.ShowDialog(); } } else { ic.DeleteBarier(); } }; vbox.PackStart(itc, false, false, 0); ScrolledWindow sw = new Gtk.ScrolledWindow(); sw.ShadowType = Gtk.ShadowType.Out; sw.Hadjustment.ValueChanged += delegate(object sender, EventArgs e) { //Console.WriteLine("sw.Hadjustment -> {0}",sw.Hadjustment.Value); }; sw.Vadjustment.ValueChanged += delegate(object sender, EventArgs e) { //Console.WriteLine("sw.Vadjustment -> {0}",sw.Vadjustment.Value); }; Viewport vp = new Viewport() { ShadowType = ShadowType.None }; vp.ScrollEvent += delegate(object o, ScrollEventArgs args) { if (args.Event.State == ModifierType.ControlMask) { switch (args.Event.Direction) { case ScrollDirection.Down: case ScrollDirection.Right: itc.ZoomOut(); return; case ScrollDirection.Left: case ScrollDirection.Up: itc.ZoomIn(); return; } } }; vp.MotionNotifyEvent += delegate(object o, MotionNotifyEventArgs args) { Cairo.PointD offset = new Cairo.PointD(sw.Hadjustment.Value, sw.Vadjustment.Value); int x = (int)args.Event.X; int y = (int)args.Event.Y; if (ic.ConvertPointToCanvasPoint(offset, ref x, ref y)) { OnWriteToStatusbar(String.Format(statusFormat, x, y, ic.WidthImage, ic.HeightImage)); } if (itc.ToolState == ImageToolBarControl.ToolStateEnum.nothing) { return; } if (itc.ToolState == ImageToolBarControl.ToolStateEnum.editpoint) { ic.StepMovingPoint((int)args.Event.X, (int)args.Event.Y, offset); //OnModifiedChanged(true); } }; vp.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args) { //Console.WriteLine("1_ButtonReleaseEvent"); if (args.Event.Button != 1) { return; } if (itc.ToolState == ImageToolBarControl.ToolStateEnum.nothing) { return; } Cairo.PointD offset = new Cairo.PointD(sw.Hadjustment.Value, sw.Vadjustment.Value); if (itc.ToolState == ImageToolBarControl.ToolStateEnum.editpoint) { ic.EndMovingPoint((int)args.Event.X, (int)args.Event.Y, offset); OnModifiedChanged(true); } }; vp.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { if (args.Event.Button != 1) { return; } if (itc.ToolState == ImageToolBarControl.ToolStateEnum.nothing) { return; } Cairo.PointD offset = new Cairo.PointD(sw.Hadjustment.Value, sw.Vadjustment.Value); if (itc.ToolState == ImageToolBarControl.ToolStateEnum.addpoint) { ic.AddPoint((int)args.Event.X, (int)args.Event.Y, offset); OnModifiedChanged(true); } else if (itc.ToolState == ImageToolBarControl.ToolStateEnum.deletepoint) { ic.DeletePoint((int)args.Event.X, (int)args.Event.Y, offset); OnModifiedChanged(true); } else if (itc.ToolState == ImageToolBarControl.ToolStateEnum.moviepoint) { ic.StartMovingPoint((int)args.Event.X, (int)args.Event.Y, offset); OnModifiedChanged(true); } else if (itc.ToolState == ImageToolBarControl.ToolStateEnum.editpoint) { if (args.Event.State == ModifierType.ShiftMask) { ic.DeletePoint((int)args.Event.X, (int)args.Event.Y, offset); OnModifiedChanged(true); return; } ic.EditPoint((int)args.Event.X, (int)args.Event.Y, offset); OnModifiedChanged(true); } }; sw.Add(vp); vp.Add(ic); vbox.PackEnd(sw, true, true, 0); ic.Show(); vp.Show(); vbox.ShowAll(); }
protected TaskListWindow(TaskManager manager) : base(Catalog.GetString("To Do List")) { this.manager = manager; this.IconName = "tomboy"; this.SetDefaultSize(500, 300); this.sort_column = SortColumn.CompletionDate; AddAccelGroup(Tomboy.ActionManager.UI.AccelGroup); action_group = new Gtk.ActionGroup("TaskList"); action_group.Add(new Gtk.ActionEntry [] { new Gtk.ActionEntry("TaskListFileMenuAction", null, Catalog.GetString("_File"), null, null, null), new Gtk.ActionEntry("NewTaskAction", Gtk.Stock.New, Catalog.GetString("New _Task"), "<Control>T", Catalog.GetString("Create a new task"), null), new Gtk.ActionEntry("OpenTaskAction", String.Empty, Catalog.GetString("_Options..."), "<Control>O", Catalog.GetString("Open the selected task"), null), new Gtk.ActionEntry("CloseTaskListWindowAction", Gtk.Stock.Close, Catalog.GetString("_Close"), "<Control>W", Catalog.GetString("Close this window"), null), new Gtk.ActionEntry("TaskListEditMenuAction", null, Catalog.GetString("_Edit"), null, null, null), new Gtk.ActionEntry("DeleteTaskAction", Gtk.Stock.Preferences, Catalog.GetString("_Delete"), "Delete", Catalog.GetString("Delete the selected task"), null), new Gtk.ActionEntry("OpenOriginNoteAction", null, Catalog.GetString("Open Associated _Note"), null, Catalog.GetString("Open the note containing the task"), null), new Gtk.ActionEntry("TaskListViewMenuAction", null, Catalog.GetString("_View"), null, null, null), new Gtk.ActionEntry("TaskListHelpMenuAction", null, Catalog.GetString("_Help"), null, null, null), new Gtk.ActionEntry("ShowTaskHelpAction", Gtk.Stock.Help, Catalog.GetString("_Contents"), "F1", Catalog.GetString("Tasks Help"), null) }); action_group.Add(new Gtk.ToggleActionEntry [] { new Gtk.ToggleActionEntry("ShowCompletedTasksAction", null, Catalog.GetString("Show _Completed Tasks"), null, Catalog.GetString("Show completed tasks in the list"), null, true), new Gtk.ToggleActionEntry("ShowDueDateColumnAction", null, Catalog.GetString("Show _Due Date Column"), null, Catalog.GetString("Show the due date column in the list"), null, true), new Gtk.ToggleActionEntry("ShowPriorityColumnAction", null, Catalog.GetString("Show _Priority Column"), null, Catalog.GetString("Show the priority column in the list"), null, true) }); Tomboy.ActionManager.UI.InsertActionGroup(action_group, 0); menu_bar = CreateMenuBar(); MakeTasksTree(); tree.Show(); // Update on changes to tasks TaskManager.TaskAdded += OnTaskAdded; TaskManager.TaskDeleted += OnTaskDeleted; TaskManager.TaskStatusChanged += OnTaskStatusChanged; tasks_sw = new Gtk.ScrolledWindow(); tasks_sw.ShadowType = Gtk.ShadowType.In; tasks_sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; tasks_sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; // Reign in the window size if there are notes with long // names, or a lot of notes... Gtk.Requisition tree_req = tree.SizeRequest(); if (tree_req.Height > 420) { tasks_sw.HeightRequest = 420; } if (tree_req.Width > 480) { tasks_sw.WidthRequest = 480; } tasks_sw.Add(tree); tasks_sw.Show(); task_count = new Gtk.Label(); task_count.Xalign = 0; task_count.Show(); Gtk.HBox status_box = new Gtk.HBox(false, 8); status_box.PackStart(task_count, true, true, 0); status_box.Show(); Gtk.VBox vbox = new Gtk.VBox(false, 8); vbox.BorderWidth = 6; vbox.PackStart(tasks_sw, true, true, 0); vbox.PackStart(status_box, false, false, 0); vbox.Show(); // Use another VBox to place the MenuBar // right at thetop of the window. content_vbox = new Gtk.VBox(false, 0); content_vbox.PackStart(menu_bar, false, false, 0); content_vbox.PackStart(vbox, true, true, 0); content_vbox.Show(); this.Add(content_vbox); this.DeleteEvent += OnDelete; this.KeyPressEvent += OnKeyPressed; // For Escape SetUpTreeModel(); }