Ejemplo n.º 1
0
        private bool DrawOrderMenu(Gdk.EventButton args)
        {
            Gtk.Menu order_menu = new Gtk.Menu();

            GtkUtil.MakeCheckMenuItem(order_menu, Catalog.GetString("Arrange by _Month"),
                                      MainWindow.Toplevel.HandleArrangeByTime, true, (adaptor is TimeAdaptor), true);

            GtkUtil.MakeCheckMenuItem(order_menu, Catalog.GetString("Arrange by _Folder"),
                                      MainWindow.Toplevel.HandleArrangeByDirectory, true, (adaptor is DirectoryAdaptor), true);

            GtkUtil.MakeMenuSeparator(order_menu);

            GtkUtil.MakeCheckMenuItem(order_menu, Catalog.GetString("_Reverse Order"),
                                      MainWindow.Toplevel.HandleReverseOrder, true, adaptor.OrderAscending, false);

            if (adaptor is TimeAdaptor && adaptor.Query.Range != null)
            {
                GtkUtil.MakeMenuSeparator(order_menu);

                GtkUtil.MakeMenuItem(order_menu, Catalog.GetString("_Clear Date Range"),
                                     MainWindow.Toplevel.HandleClearDateRange);
            }

            if (args != null)
            {
                order_menu.Popup(null, null, null, args.Button, args.Time);
            }
            else
            {
                order_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public void Activate(Gdk.EventButton eb, Literal literal, Gtk.Menu popupMenu, bool isPopup)
        {
            /*MenuItem attach_item = new MenuItem (Catalog.GetString ("Find With"));
             * TagMenu attach_menu = new TagMenu (attach_item, App.Instance.Database.Tags);
             * attach_menu.TagSelected += literal.HandleAttachTagCommand;
             * attach_item.ShowAll ();
             * popup_menu.Append (attach_item);*/

            if (literal.IsNegated)
            {
                GtkUtil.MakeMenuItem(popupMenu, Strings.IncludePhotosTaggedTagName(literal.Tag.Name),
                                     new EventHandler(literal.HandleToggleNegatedCommand), true);
            }
            else
            {
                GtkUtil.MakeMenuItem(popupMenu, Strings.ExcludePhotosTaggedTagName(literal.Tag.Name),
                                     new EventHandler(literal.HandleToggleNegatedCommand), true);
            }

            GtkUtil.MakeMenuItem(popupMenu, Strings.RemoveFromSearch, "gtk-remove", new EventHandler(literal.HandleRemoveCommand), true);

            if (isPopup)
            {
                if (eb != null)
                {
                    popupMenu.Popup(null, null, null, eb.Button, eb.Time);
                }
                else
                {
                    popupMenu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
                }
            }
        }
Ejemplo n.º 3
0
    public void Activate(Gdk.EventButton eb, Tag tag, Tag [] tags)
    {
        int photo_count = App.Instance.Organizer.SelectedPhotos().Length;
        int tags_count  = tags.Length;

        Gtk.Menu popup_menu = new Gtk.Menu();

        GtkUtil.MakeMenuItem(popup_menu,
                             String.Format(Catalog.GetPluralString("Find", "Find", tags.Length), tags.Length),
                             "gtk-add",
                             new EventHandler(App.Instance.Organizer.HandleIncludeTag),
                             true
                             );

        FSpot.TermMenuItem.Create(tags, popup_menu);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Create New Tag..."), "tag-new",
                             App.Instance.Organizer.HandleCreateNewCategoryCommand, true);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetString("Edit Tag..."), "gtk-edit",
                             delegate {
            App.Instance.Organizer.HandleEditSelectedTagWithTag(tag);
        }, tag != null && tags_count == 1);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Delete Tag", "Delete Tags", tags_count), "gtk-delete",
                             new EventHandler(App.Instance.Organizer.HandleDeleteSelectedTagCommand), tag != null);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Attach Tag to Selection", "Attach Tags to Selection", tags_count), "gtk-add",
                             new EventHandler(App.Instance.Organizer.HandleAttachTagCommand), tag != null && photo_count > 0);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Remove Tag From Selection", "Remove Tags From Selection", tags_count), "gtk-remove",
                             new EventHandler(App.Instance.Organizer.HandleRemoveTagCommand), tag != null && photo_count > 0);

        if (tags_count > 1 && tag != null)
        {
            GtkUtil.MakeMenuSeparator(popup_menu);

            GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Merge Tags"),
                                 new EventHandler(App.Instance.Organizer.HandleMergeTagsCommand), true);
        }

        if (eb != null)
        {
            popup_menu.Popup(null, null, null, eb.Button, eb.Time);
        }
        else
        {
            popup_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
        }
    }
Ejemplo n.º 4
0
        void AddMenuItems(Menu popup_menu)
        {
            var items = new Dictionary <MenuItem, InfoEntry>();

            if (popup_menu.Children.Length > 0 && entries.Count > 0)
            {
                GtkUtil.MakeMenuSeparator(popup_menu);
            }

            foreach (var entry in entries)
            {
                if (entry.AlwaysVisible)
                {
                    continue;
                }

                var item =
                    GtkUtil.MakeCheckMenuItem(popup_menu, entry.Description, (sender, args) =>
                {
                    ContextSwitchStrategy.SetInfoEntryVisible(Context, items[sender as CheckMenuItem], (sender as CheckMenuItem).Active);
                    Update();
                },
                                              true, ContextSwitchStrategy.InfoEntryVisible(Context, entry), false);

                items.Add(item, entry);
            }
        }
Ejemplo n.º 5
0
        void BuildUI(Window parent)
        {
            TransientFor   = parent;
            WindowPosition = WindowPosition.CenterOnParent;

            photo_view = new PhotoImageView(Controller.Photos);
            photo_scrolled.Add(photo_view);
            photo_scrolled.SetSizeRequest(200, 200);
            photo_view.Show();

            GtkUtil.ModifyColors(photo_scrolled);
            GtkUtil.ModifyColors(photo_view);

            var tray = new BrowseablePointerGridView(photo_view.Item)
            {
                DisplayTags = false
            };

            icon_scrolled.Add(tray);
            tray.Show();

            progress_bar.Hide();

            import_button.Sensitive = false;

            tag_entry = new TagEntry(App.Instance.Database.Tags, false);
            tag_entry.UpdateFromTagNames(new string [] {});
            tagentry_box.Add(tag_entry);
            tag_entry.Show();
            attachtags_label.MnemonicWidget = tag_entry;
        }
Ejemplo n.º 6
0
        internal static Gdk.EventKey ConvertKeyEvent(AppKit.NSEvent ev)
        {
            var state = Gdk.ModifierType.None;

            if ((ev.ModifierFlags & AppKit.NSEventModifierMask.ControlKeyMask) != 0)
            {
                state |= Gdk.ModifierType.ControlMask;
            }
            if ((ev.ModifierFlags & AppKit.NSEventModifierMask.ShiftKeyMask) != 0)
            {
                state |= Gdk.ModifierType.ShiftMask;
            }
            if ((ev.ModifierFlags & AppKit.NSEventModifierMask.CommandKeyMask) != 0)
            {
                state |= Gdk.ModifierType.MetaMask;
            }
            if ((ev.ModifierFlags & AppKit.NSEventModifierMask.AlternateKeyMask) != 0)
            {
                state |= Gdk.ModifierType.Mod1Mask;
            }

            var w = GetGtkWindow(ev.Window);

            return(GtkUtil.CreateKeyEventFromKeyCode(ev.KeyCode, state, Gdk.EventType.KeyPress, w != null ? w.GdkWindow : null));
        }
        void TemplatesTreeViewButtonPressed(object o, ButtonPressEventArgs args)
        {
            SolutionTemplate template = GetSelectedTemplate();

            if ((template == null) || (template.AvailableLanguages.Count <= 1))
            {
                return;
            }

            if (templateTextRenderer.IsLanguageButtonPressed(args.Event))
            {
                if (popupMenu == null)
                {
                    popupMenu = new Menu();
                    popupMenu.AttachToWidget(this, null);
                }
                ClearPopupMenuItems();
                AddLanguageMenuItems(popupMenu, template);
                popupMenu.ModifyBg(StateType.Normal, GtkTemplateCellRenderer.LanguageButtonBackgroundColor);
                popupMenu.ShowAll();

                MenuPositionFunc posFunc = (Menu m, out int x, out int y, out bool pushIn) => {
                    Gdk.Rectangle rect       = templateTextRenderer.GetLanguageRect();
                    Gdk.Rectangle screenRect = GtkUtil.ToScreenCoordinates(templatesTreeView, templatesTreeView.GdkWindow, rect);
                    x      = screenRect.X;
                    y      = screenRect.Bottom;
                    pushIn = false;
                };
                popupMenu.Popup(null, null, posFunc, 0, args.Event.Time);
            }
        }
Ejemplo n.º 8
0
        internal static Gdk.EventKey ConvertKeyEvent(AppKit.NSEvent ev)
        {
            var state = ConvertModifierMask(ev.ModifierFlags);

            var w = GetGtkWindow(ev.Window);

            return(GtkUtil.CreateKeyEventFromKeyCode(ev.KeyCode, state, Gdk.EventType.KeyPress, w != null ? w.GdkWindow : null, (uint)(ev.Timestamp * 1000)));
        }
Ejemplo n.º 9
0
 private void SetColors()
 {
     GtkUtil.ModifyColors(filmstrip);
     GtkUtil.ModifyColors(tag_view);
     GtkUtil.ModifyColors(photo_view);
     GtkUtil.ModifyColors(background);
     GtkUtil.ModifyColors(photo_view_scrolled);
     GtkUtil.ModifyColors(rating);
 }
Ejemplo n.º 10
0
        void ShowEditor(Editor editor)
        {
            SetupEditor(editor);
            current_editor = editor;

            buttons.Hide();

            // Top label
            VBox  vbox  = new VBox(false, 4);
            Label label = new Label();

            label.Markup = string.Format("<big><b>{0}</b></big>", editor.Label);
            vbox.PackStart(label, false, false, 5);

            // Optional config widget
            Widget config = editor.ConfigurationWidget();

            if (config != null)
            {
                // This is necessary because GtkBuilder widgets need to be
                // reparented.
                if (config.Parent != null)
                {
                    config.Reparent(vbox);
                }
                else
                {
                    vbox.PackStart(config, false, false, 0);
                }
            }

            // Apply / Cancel buttons
            HButtonBox tool_buttons = new HButtonBox();

            tool_buttons.LayoutStyle = ButtonBoxStyle.End;
            tool_buttons.Spacing     = 5;
            tool_buttons.BorderWidth = 5;
            tool_buttons.Homogeneous = false;

            Button cancel = new Button(Stock.Cancel);

            cancel.Clicked += HandleCancel;
            tool_buttons.Add(cancel);

            Button apply = new Button(editor.ApplyLabel);

            apply.Image    = new Image(GtkUtil.TryLoadIcon(FSpot.Settings.Global.IconTheme, editor.IconName, 22, 0));
            apply.Clicked += (s, e) => { Apply(editor); };
            tool_buttons.Add(apply);

            // Pack it all together
            vbox.PackEnd(tool_buttons, false, false, 0);
            active_editor = vbox;
            widgets.Add(active_editor);
            active_editor.ShowAll();
        }
Ejemplo n.º 11
0
 public bool FillIconView()
 {
     icon_store.Clear();
     string [] icon_list = FSpot.Core.Global.IconTheme.ListIcons("Emblems");
     foreach (string item_name in icon_list)
     {
         icon_store.AppendValues(item_name, GtkUtil.TryLoadIcon(FSpot.Core.Global.IconTheme, item_name, 32, (IconLookupFlags)0));
     }
     return(false);
 }
        async void RequestPopup(Xwt.Rectangle rect)
        {
            var token = popupSrc.Token;

            diff = await Task.Run(async delegate {
                try {
                    foreach (var op in await codeAction.GetPreviewOperationsAsync(token))
                    {
                        var ac = op as ApplyChangesOperation;
                        if (ac == null)
                        {
                            continue;
                        }
                        var changedDocument = ac.ChangedSolution.GetDocument(documentContext.AnalysisDocument.Id);

                        changedTextDocument = TextEditorFactory.CreateNewDocument(new StringTextSource((await changedDocument.GetTextAsync(token)).ToString()), editor.FileName);
                        try {
                            var list = new List <DiffHunk> (editor.GetDiff(changedTextDocument, new DiffOptions(false, true)));
                            if (list.Count > 0)
                            {
                                return(list);
                            }
                        } catch (Exception e) {
                            LoggingService.LogError("Error while getting preview list diff.", e);
                        }
                    }
                } catch (OperationCanceledException) {}
                return(new List <DiffHunk> ());
            });

            if (diff.Count > 0 && !token.IsCancellationRequested)
            {
                var pos = PopupPosition.Left;
                if (Platform.IsMac)
                {
                    var screenRect = GtkUtil.ToScreenCoordinates(IdeApp.Workbench.RootWindow, IdeApp.Workbench.RootWindow.GdkWindow, rect.ToGdkRectangle());
                    var geometry   = Screen.GetUsableMonitorGeometry(Screen.GetMonitorAtPoint(screenRect.X, screenRect.Y));
                    var request    = SizeRequest();
                    if (screenRect.X - geometry.X < request.Width)
                    {
                        pos = PopupPosition.Top;
                        if (geometry.Bottom - screenRect.Bottom < request.Height)
                        {
                            pos = PopupPosition.Bottom;
                        }
                    }
                    else
                    {
                        pos = PopupPosition.Right;
                    }
                }
                ShowPopup(rect, pos);
            }
        }
Ejemplo n.º 13
0
        public void Activate(Gdk.EventButton eb)
        {
            Menu popup_menu = new Menu();

            if (icon_list.select_count >= 0)
            {
                GtkUtil.MakeMenuItem(popup_menu, "Copy Image Location", new EventHandler(Action_CopyImageLocation));
                GtkUtil.MakeMenuItem(popup_menu, "Remove Image", new EventHandler(Action_RemoveImage));
            }

            popup_menu.Popup(null, null, null, IntPtr.Zero, eb.Button, eb.Time);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Creates a Gtk.Widget that's used to configure the service.	This
        /// will be used in the Synchronization Preferences.	Preferences should
        /// not automatically be saved by a GConf Property Editor.	Preferences
        /// should be saved when SaveConfiguration () is called.
        /// </summary>
        public override Gtk.Widget CreatePreferencesControl()
        {
            Gtk.VBox container = new Gtk.VBox(false, 0);

            container.PackStart(GtkUtil.newMarkupLabel(Catalog.GetString("<span weight='bold'>Server Settings:</span>")));
            SetupGuiServerRelated(container, 4);
            container.PackStart(new Gtk.Label());
            container.PackStart(GtkUtil.newMarkupLabel(Catalog.GetString("<span weight='bold'>Encryption Settings:</span>")));
            SetupGuiEncryptionRelated(container, 4);
            container.ShowAll();
            return(container);
        }
Ejemplo n.º 15
0
        void PackButton(Editor editor)
        {
            Button button = new Button(editor.Label);

            if (editor.IconName != null)
            {
                button.Image = new Image(GtkUtil.TryLoadIcon(FSpot.Settings.Global.IconTheme, editor.IconName, 22, (Gtk.IconLookupFlags) 0));
            }
            button.Clicked += (o, e) => { ChooseEditor(editor); };
            button.Show();
            buttons.Add(button);
            editor_buttons.Add(editor, button);
        }
Ejemplo n.º 16
0
        void PackButton(Editor editor)
        {
            Button button = new Button(editor.Label);

            if (editor.IconName != null)
            {
                button.Image = new Image(GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, editor.IconName, 22, (Gtk.IconLookupFlags) 0));
            }
            button.Clicked += delegate(object o, EventArgs e) { ChooseEditor(editor); };
            button.Show();
            buttons.Add(button);
            editor_buttons.Add(editor, button);
        }
Ejemplo n.º 17
0
        public VfsSource(string uri)
        {
            string [] components = uri.Split(new char [] { '/' });
            this.Name = components [components.Length - 1];
            if (this.Name == String.Empty)
            {
                this.Name = components [components.Length - 2];
            }

            this.uri = uri;

            this.Icon = GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, "stock_folder", 32, (Gtk.IconLookupFlags) 0);
        }
Ejemplo n.º 18
0
	public void Populate (bool flat = false)
	{
		if (flat)
			PopulateFlat (tag_store.RootCategory, this);
		else
			Populate (tag_store.RootCategory, this);

		if (NewTagHandler != null) {
			GtkUtil.MakeMenuSeparator (this);
			GtkUtil.MakeMenuItem (this, Mono.Unix.Catalog.GetString ("Create New Tag..."),
					"tag-new", NewTagHandler, true);
		}
	}
Ejemplo n.º 19
0
        void ConstraintPixCellFunc(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            string stockname = (string)tree_model.GetValue(iter, 0);

            if (stockname != null)
            {
                (cell as CellRendererPixbuf).Pixbuf = GtkUtil.TryLoadIcon(FSpot.Core.Global.IconTheme, stockname, 16, (Gtk.IconLookupFlags) 0);
            }
            else
            {
                (cell as CellRendererPixbuf).Pixbuf = null;
            }
        }
        void DrawShadow(Cairo.Context ctx, Gdk.Rectangle ar, PositionType pos, List <Section> secs)
        {
            foreach (Section s in secs)
            {
                Cairo.Gradient pat = null;
                Gdk.Rectangle  r   = ar;
                switch (pos)
                {
                case PositionType.Top:
                    r.Height = shadowSize > r.Height ? r.Height / 2 : shadowSize;
                    r.X     += s.Offset;
                    r.Width  = s.Size;
                    pat      = new Cairo.LinearGradient(r.X, r.Y, r.X, r.Bottom);
                    break;

                case PositionType.Bottom:
                    r.Y      = r.Bottom - shadowSize;
                    r.Height = shadowSize > r.Height ? r.Height / 2 : shadowSize;
                    r.X      = r.X + s.Offset;
                    r.Width  = s.Size;
                    pat      = new Cairo.LinearGradient(r.X, r.Bottom, r.X, r.Y);
                    break;

                case PositionType.Left:
                    r.Width  = shadowSize > r.Width ? r.Width / 2 : shadowSize;
                    r.Y     += s.Offset;
                    r.Height = s.Size;
                    pat      = new Cairo.LinearGradient(r.X, r.Y, r.Right, r.Y);
                    break;

                case PositionType.Right:
                    r.X      = r.Right - shadowSize;
                    r.Width  = shadowSize > r.Width ? r.Width / 2 : shadowSize;
                    r.Y     += s.Offset;
                    r.Height = s.Size;
                    pat      = new Cairo.LinearGradient(r.Right, r.Y, r.X, r.Y);
                    break;
                }
                Cairo.Color c = GtkUtil.ToCairoColor(darkColor);
                pat.AddColorStop(0, c);
                c.A = 0;
                pat.AddColorStop(1, c);
                ctx.NewPath();
                ctx.Rectangle(r.X, r.Y, r.Width, r.Height);
                ctx.Pattern = pat;
                ctx.Fill();
                pat.Destroy();
            }
        }
Ejemplo n.º 21
0
        public static Gtk.Menu GetSubmenu(Tag [] tags)
        {
            Tag single_tag = null;

            if (tags != null && tags.Length == 1)
            {
                single_tag = tags[0];
            }

            //Console.WriteLine ("creating find with menu item");
            if (LogicWidget.Root == null || LogicWidget.Root.SubTerms.Count == 0)
            {
                //Console.WriteLine ("root is null or has no terms");
                return(null);
            }
            else
            {
                //Console.WriteLine ("root is not null and has terms");
                Gtk.Menu m = new Gtk.Menu();

                Gtk.MenuItem all_item = GtkUtil.MakeMenuItem(m, Catalog.GetString("All"), new EventHandler(App.Instance.Organizer.HandleRequireTag));
                GtkUtil.MakeMenuSeparator(m);

                int sensitive_items = 0;
                foreach (Term term in LogicWidget.Root.SubTerms)
                {
                    List <string> term_parts = new List <string> ();

                    bool contains_tag = AppendTerm(term_parts, term, single_tag);

                    string name = "_" + String.Join(", ", term_parts.ToArray());

                    Gtk.MenuItem item = GtkUtil.MakeMenuItem(m, name, new EventHandler(App.Instance.Organizer.HandleAddTagToTerm));
                    item.Sensitive = !contains_tag;

                    if (!contains_tag)
                    {
                        sensitive_items++;
                    }
                }

                if (sensitive_items == 0)
                {
                    all_item.Sensitive = false;
                }

                return(m);
            }
        }
Ejemplo n.º 22
0
        public DriveSource(Gnome.Vfs.Drive drive)
        {
            this.Name  = drive.DisplayName;
            this.Drive = drive;

            if (drive.IsMounted)
            {
                this.Icon = GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, drive.MountedVolume.Icon, 32, (Gtk.IconLookupFlags) 0);
                //this.Sensitive = drive.MountedVolume.IsMounted;
            }
            else
            {
                this.Icon = GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, drive.Icon, 32, (Gtk.IconLookupFlags) 0);
            }
        }
Ejemplo n.º 23
0
        public CameraSource(GPhotoCamera cam, int index)
        {
            this.cam         = cam;
            this.CameraIndex = index;

#if LONG_NAMES
            this.Name = String.Format("{0} ({1})", cam.CameraList.GetName(index), cam.CameraList.GetValue(index));
#else
            this.Name = String.Format("{0}", cam.CameraList.GetName(index));
#endif
            this.Icon = GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, "camera-photo", 32, (Gtk.IconLookupFlags) 0);
            if (this.Icon == null)
            {
                this.Icon = GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, "media-flash", 32, (Gtk.IconLookupFlags) 0);
            }
        }
Ejemplo n.º 24
0
        private void ShowEditor(Editor editor)
        {
            SetupEditor(editor);
            current_editor = editor;

            buttons.Hide();

            // Top label
            VBox  vbox  = new VBox(false, 4);
            Label label = new Label();

            label.Markup = String.Format("<big><b>{0}</b></big>", editor.Label);
            vbox.PackStart(label, false, false, 5);

            // Optional config widget
            Widget config = editor.ConfigurationWidget();

            if (config != null)
            {
                vbox.PackStart(config, false, false, 0);
            }

            // Apply / Cancel buttons
            HButtonBox tool_buttons = new HButtonBox();

            tool_buttons.LayoutStyle = ButtonBoxStyle.End;
            tool_buttons.Spacing     = 5;
            tool_buttons.BorderWidth = 5;
            tool_buttons.Homogeneous = false;

            Button cancel = new Button(Stock.Cancel);

            cancel.Clicked += HandleCancel;
            tool_buttons.Add(cancel);

            Button apply = new Button(editor.ApplyLabel);

            apply.Image    = new Image(GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, editor.IconName, 22, (Gtk.IconLookupFlags) 0));
            apply.Clicked += delegate { Apply(editor); };
            tool_buttons.Add(apply);

            // Pack it all together
            vbox.PackEnd(tool_buttons, false, false, 0);
            active_editor = vbox;
            widgets.Add(active_editor);
            active_editor.ShowAll();
        }
Ejemplo n.º 25
0
        private void SetColors()
        {
            GtkUtil.ModifyColors(filmstrip);
            GtkUtil.ModifyColors(tag_view);
            GtkUtil.ModifyColors(View);
            GtkUtil.ModifyColors(background);
            GtkUtil.ModifyColors(photo_view_scrolled);
            GtkUtil.ModifyColors(rating);

            Gdk.Color dark = Style.Dark(Gtk.StateType.Normal);
            filmstrip.ModifyBg(Gtk.StateType.Normal, dark);
            tag_view.ModifyBg(Gtk.StateType.Normal, dark);
            View.ModifyBg(Gtk.StateType.Normal, dark);
            background.ModifyBg(Gtk.StateType.Normal, dark);
            photo_view_scrolled.ModifyBg(Gtk.StateType.Normal, dark);
            rating.ModifyBg(Gtk.StateType.Normal, dark);
        }
Ejemplo n.º 26
0
        public static Gtk.Menu GetSubmenu(Tag[] tags)
        {
            Tag single_tag = null;

            if (tags != null && tags.Length == 1)
            {
                single_tag = tags[0];
            }

            if (LogicWidget.Root == null || LogicWidget.Root.SubTerms.Count == 0)
            {
                return(null);
            }

            var m = new Gtk.Menu();

            var all_item = GtkUtil.MakeMenuItem(m, Strings.All, new EventHandler(App.Instance.Organizer.HandleRequireTag));

            GtkUtil.MakeMenuSeparator(m);

            int sensitive_items = 0;

            foreach (var term in LogicWidget.Root.SubTerms)
            {
                var term_parts = new List <string> ();

                bool contains_tag = AppendTerm(term_parts, term, single_tag);

                string name = "_" + string.Join(", ", term_parts.ToArray());

                var item = GtkUtil.MakeMenuItem(m, name, new EventHandler(App.Instance.Organizer.HandleAddTagToTerm));
                item.Sensitive = !contains_tag;

                if (!contains_tag)
                {
                    sensitive_items++;
                }
            }

            if (sensitive_items == 0)
            {
                all_item.Sensitive = false;
            }

            return(m);
        }
Ejemplo n.º 27
0
        private void HandleImageViewButtonPressEvent(object sender, ButtonPressEventArgs args)
        {
            if (args.Event.Type != EventType.ButtonPress || args.Event.Button != 3)
            {
                return;
            }

            Gtk.Menu popup_menu = new Gtk.Menu();
            bool     has_item   = image_view.Item.Current != null;

            GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Rotate _Left"), "object-rotate-left", delegate { HandleRotate270Command(window, null); }, has_item);
            GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Rotate _Right"), "object-rotate-right", delegate { HandleRotate90Command(window, null); }, has_item);
            GtkUtil.MakeMenuSeparator(popup_menu);
            GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Set as Background"), HandleSetAsBackgroundCommand, has_item);

            popup_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Creates a SyncServer instance that the SyncManager can use to
        /// synchronize with this service.	This method is called during
        /// every synchronization process.	If the same SyncServer object
        /// is returned here, it should be reset as if it were new.
        /// </summary>
        public override SyncServer CreateSyncServer()
        {
            SyncServer server = null;

            String          password;
            WebDAVInterface webdavserver;


            if (GetConfigSettings(out password, out webdavserver))
            {
                try
                {
                    server = new EncryptedWebdavSyncServer(Services.NativeApplication.CacheDirectory, Util.GetBytes(password), webdavserver);
                }
                catch (PasswordException)
                {
                    // Display window with hint that the pw is wrong
                    GtkUtil.ShowHintWindow(Tomboy.SyncDialog, "Wrong Password", "The password you provided was wrong.");
                    throw;
                }
                catch (FormatException)
                {
                    // Display window with hint
                    GtkUtil.ShowHintWindow(Tomboy.SyncDialog, "Encryption Error", "The encrypted files seem to be corrupted.");
                    throw;
                }
                catch (WebDavException wde)
                {
                    Exception inner = wde.InnerException;
                    for (int i = 0; i < 10 && (inner.InnerException != null); i++)                     // max 10
                    {
                        inner = inner.InnerException;
                    }

                    GtkUtil.ShowHintWindow(Tomboy.SyncDialog, "WebDav Error", "Error while communicating with server:\n" + inner.Message);
                    throw;
                }
            }
            else
            {
                throw new InvalidOperationException("FileSystemSyncServiceAddin.CreateSyncServer () called without being configured");
            }

            return(server);
        }
Ejemplo n.º 29
0
        void DrawMessageExtendIcon(Mono.TextEditor.TextEditor editor, Cairo.Context g, double y, int errorCounterWidth, int eh)
        {
            EnsureLayoutCreated(editor);
            double rW = errorCounterWidth - 2;
            double rH = editor.LineHeight * 3 / 4;

            double rX = editor.Allocation.Width - rW - 2;
            double rY = y + (editor.LineHeight - rH) / 2;

            BookmarkMarker.DrawRoundRectangle(g, rX, rY, 8, rW, rH);

            g.Color = oldIsOver ? GtkUtil.AddLight(TagColor.BorderColor, -0.1) : GtkUtil.AddLight(TagColor.BorderColor, -0.2);
            g.Fill();
            if (CollapseExtendedErrors)
            {
                if (errorCountLayout != null)
                {
                    g.Color = TextColor.Color;
                    g.Save();
                    g.Translate(rX + rW / 4, rY + (rH - eh) / 2);
                    g.ShowLayout(errorCountLayout);
                    g.Restore();
                }
                else
                {
                    g.MoveTo(rX + rW / 2 - rW / 4, rY + rH / 4);
                    g.LineTo(rX + rW / 2 + rW / 4, rY + rH / 4);
                    g.LineTo(rX + rW / 2, rY + rH - rH / 4);
                    g.ClosePath();

                    g.Color = new Cairo.Color(1, 1, 1);
                    g.Fill();
                }
            }
            else
            {
                g.MoveTo(rX + rW / 2 - rW / 4, rY + rH - rH / 4);
                g.LineTo(rX + rW / 2 + rW / 4, rY + rH - rH / 4);
                g.LineTo(rX + rW / 2, rY + rH / 4);
                g.ClosePath();

                g.Color = new Cairo.Color(1, 1, 1);
                g.Fill();
            }
        }
Ejemplo n.º 30
0
    public void Populate(bool flat)
    {
        if (flat)
        {
            PopulateFlat(tag_store.RootCategory, this);
        }
        else
        {
            Populate(tag_store.RootCategory, this);
        }

        if (NewTagHandler != null)
        {
            GtkUtil.MakeMenuSeparator(this);
            GtkUtil.MakeMenuItem(this, Mono.Unix.Catalog.GetString("Create New Tag"),
                                 "f-spot-new-tag", NewTagHandler, true);
        }
    }