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; }
public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window) : base("EditTagIconDialog.ui", "edit_tag_icon_dialog") { TransientFor = parent_window; Title = String.Format(Catalog.GetString("Edit Icon for Tag {0}"), t.Name); preview_pixbuf = t.Icon; Cms.Profile screen_profile; if (preview_pixbuf != null && ColorManagement.Profiles.TryGetValue(Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) { preview_image.Pixbuf = preview_pixbuf.Copy(); ColorManagement.ApplyProfile(preview_image.Pixbuf, screen_profile); } else { preview_image.Pixbuf = preview_pixbuf; } query = new PhotoQuery(db.Photos); if (db.Tags.Hidden != null) { query.Terms = OrTerm.FromTags(new [] { t }); } else { query.Terms = new Literal(t); } image_view = new PhotoImageView(query) { CropHelpers = false }; image_view.SelectionXyRatio = 1.0; image_view.SelectionChanged += HandleSelectionChanged; image_view.PhotoChanged += HandlePhotoChanged; external_photo_chooser = new Gtk.FileChooserButton(Catalog.GetString("Select Photo from file"), Gtk.FileChooserAction.Open); external_photo_chooser.Filter = new FileFilter(); external_photo_chooser.Filter.AddPixbufFormats(); external_photo_chooser.LocalOnly = false; external_photo_chooser_hbox.PackStart(external_photo_chooser); external_photo_chooser.Show(); external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged; photo_scrolled_window.Add(image_view); if (query.Count > 0) { photo_spin_button.Wrap = true; photo_spin_button.Adjustment.Lower = 1.0; photo_spin_button.Adjustment.Upper = (double)query.Count; photo_spin_button.Adjustment.StepIncrement = 1.0; photo_spin_button.ValueChanged += HandleSpinButtonChanged; image_view.Item.Index = 0; } else { from_photo_label.Markup = String.Format(Catalog.GetString( "\n<b>From Photo</b>\n" + " You can use one of your library photos as an icon for this tag.\n" + " However, first you must have at least one photo associated\n" + " with this tag. Please tag a photo as '{0}' and return here\n" + " to use it as an icon."), t.Name); photo_scrolled_window.Visible = false; photo_label.Visible = false; photo_spin_button.Visible = false; } icon_store = new ListStore(typeof(string), typeof(Gdk.Pixbuf)); icon_view = new Gtk.IconView(icon_store); icon_view.PixbufColumn = 1; icon_view.SelectionMode = SelectionMode.Single; icon_view.SelectionChanged += HandleIconSelectionChanged; icon_scrolled_window.Add(icon_view); icon_view.Show(); image_view.Show(); DelayedOperation fill_delay = new DelayedOperation(FillIconView); fill_delay.Start(); }
public FullScreenView (IBrowsableCollection collection) : base ("Full Screen Mode") { Name = "FullscreenContainer"; try { //scroll = new Gtk.ScrolledWindow (null, null); actions = new ActionGroup ("joe"); actions.Add (new ActionEntry [] { new ActionEntry (HideToolbar, Stock.Close, Catalog.GetString ("Hide"), null, Catalog.GetString ("Hide Toolbar"), HideToolbarAction), new ActionEntry (ExitFullScreen, "f-spot-view-restore", Catalog.GetString ("Exit fullscreen"), null, null, ExitAction), new ActionEntry (SlideShow, "f-spot-slideshow", Catalog.GetString ("Slideshow"), null, Catalog.GetString ("Start slideshow"), SlideShowAction), }); actions.Add (new ToggleActionEntry [] { new ToggleActionEntry (Info, Stock.Info, Catalog.GetString ("Info"), null, Catalog.GetString ("Image Information"), InfoAction, false) }); new Fader (this, 1.0, 3); notebook = new Notebook (); notebook.ShowBorder = false; notebook.ShowTabs = false; notebook.Show (); scroll = new ScrolledView (); view = new PhotoImageView (collection); // FIXME this should be handled by the new style setting code view.ModifyBg (Gtk.StateType.Normal, this.Style.Black); view.PointerMode = ImageView.PointerModeType.Scroll; this.Add (notebook); view.Show (); view.MotionNotifyEvent += HandleViewMotion; Action rotate_left = new RotateLeftAction (view.Item); actions.Add (rotate_left); Action rotate_right = new RotateRightAction (view.Item); actions.Add (rotate_right); scroll.ScrolledWindow.Add (view); HBox hhbox = new HBox (); hhbox.PackEnd (GetButton (HideToolbar), false, true, 0); hhbox.PackEnd (GetButton (Info), false, true, 0); hhbox.PackStart (GetButton (ExitFullScreen, true), false, false, 0); hhbox.PackStart (Add (new PreviousPictureAction (view.Item)), false, false, 0); hhbox.PackStart (GetButton (SlideShow), false, true, 0); hhbox.PackStart (Add (new NextPictureAction (view.Item)), false, false, 0); //hhbox.PackStart (Add (new AutoColor (view.Item)), false, false, 0); display = new TextureDisplay (view.Item); display.AddEvents ((int) (Gdk.EventMask.PointerMotionMask)); display.ModifyBg (Gtk.StateType.Normal, this.Style.Black); display.MotionNotifyEvent += HandleViewMotion; Label effect = new Label (Catalog.GetString ("Slide transition: ")); hhbox.PackStart (effect, false, false, 5); hhbox.PackStart (display.GetCombo (), false, false, 0); display.Show (); hhbox.PackStart (Add (new RotateLeftAction (view.Item)), false, false, 0); hhbox.PackStart (Add (new RotateRightAction (view.Item)), false, false, 0); hhbox.BorderWidth = 15; tag_view = new TagView (); hhbox.PackStart (tag_view, false, false, 0); //display = new ImageDisplay (view.Item); notebook.AppendPage (scroll, null); notebook.AppendPage (display, null); hhbox.ShowAll (); //scroll.ShowControls (); scroll.Show (); this.Decorated = false; this.Fullscreen (); this.ButtonPressEvent += HandleButtonPressEvent; view.Item.Changed += HandleItemChanged; view.GrabFocus (); controls = new ControlOverlay (this); controls.Add (hhbox); controls.Dismiss (); notebook.CurrentPage = 0; } catch (System.Exception e) { System.Console.WriteLine (e); } }
public FullScreenView(IBrowsableCollection collection, Gtk.Window parent) : base("Full Screen Mode") { //going fullscreen on the same screen the parent window Gdk.Screen screen = Screen; int monitor = screen.GetMonitorAtWindow (parent.GdkWindow); Gdk.Rectangle bounds = screen.GetMonitorGeometry (monitor); Move (bounds.X, bounds.Y); string style = "style \"test\" {\n" + "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" + "}\n" + "class \"GtkToolbar\" style \"test\""; Gtk.Rc.ParseString (style); Name = "FullscreenContainer"; try { //scroll = new Gtk.ScrolledWindow (null, null); actions = new ActionGroup ("joe"); actions.Add (new ActionEntry [] { new ActionEntry (HideToolbar, Stock.Close, Catalog.GetString ("Hide"), null, Catalog.GetString ("Hide toolbar"), HideToolbarAction)}); actions.Add (new ToggleActionEntry [] { new ToggleActionEntry (Info, Stock.Info, Catalog.GetString ("Info"), null, Catalog.GetString ("Image information"), InfoAction, false)}); Gtk.Action exit_full_screen = new Gtk.Action (ExitFullScreen, Catalog.GetString ("Exit fullscreen"), null, null); exit_full_screen.IconName = "view-restore"; exit_full_screen.Activated += ExitAction; actions.Add (exit_full_screen); Gtk.Action slide_show = new Gtk.Action (SlideShow, Catalog.GetString ("Slideshow"), Catalog.GetString ("Start slideshow"), null); slide_show.IconName = "media-playback-start"; slide_show.Activated += SlideShowAction; actions.Add (slide_show); new WindowOpacityFader (this, 1.0, 600); notebook = new Notebook (); notebook.ShowBorder = false; notebook.ShowTabs = false; notebook.Show (); scroll = new ScrolledView (); scroll.ScrolledWindow.SetPolicy (PolicyType.Never, PolicyType.Never); view = new PhotoImageView (collection); // FIXME this should be handled by the new style setting code view.ModifyBg (Gtk.StateType.Normal, this.Style.Black); this.Add (notebook); view.Show (); view.MotionNotifyEvent += HandleViewMotion; view.PointerMode = PointerMode.Scroll; scroll.ScrolledWindow.Add (view); Toolbar tbar = new Toolbar (); tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; tbar.ShowArrow = false; tbar.BorderWidth = 15; ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem () as ToolItem; t_item.IsImportant = true; tbar.Insert (t_item, -1); Gtk.Action action = new PreviousPictureAction (view.Item); actions.Add (action); tbar.Insert (action.CreateToolItem () as ToolItem, -1); play_pause_button = (actions [SlideShow]).CreateToolItem () as ToolButton; tbar.Insert (play_pause_button, -1); action = new NextPictureAction (view.Item); actions.Add (action); tbar.Insert (action.CreateToolItem () as ToolItem, -1); t_item = new ToolItem (); t_item.Child = new Label (Catalog.GetString ("Slide transition:")); tbar.Insert (t_item, -1); display = new SlideShow (view.Item); display.AddEvents ((int) (Gdk.EventMask.PointerMotionMask)); display.ModifyBg (Gtk.StateType.Normal, this.Style.Black); display.MotionNotifyEvent += HandleViewMotion; display.Show (); t_item = new ToolItem (); ComboBox combo = ComboBox.NewText (); foreach (var transition in display.Transitions) combo.AppendText (transition.Name); combo.Active = 0; combo.Changed += HandleTransitionChanged; t_item.Child = combo; tbar.Insert (t_item, -1); action = new RotateLeftAction (view.Item); actions.Add (action); tbar.Insert (action.CreateToolItem () as ToolItem, -1); action = new RotateRightAction (view.Item); actions.Add (action); tbar.Insert (action.CreateToolItem () as ToolItem, -1); info_button = (ToggleToolButton) ((actions [Info]).CreateToolItem () as ToolItem); tbar.Insert (info_button, -1); tbar.Insert ((actions [HideToolbar]).CreateToolItem () as ToolItem, -1); notebook.AppendPage (scroll, null); notebook.AppendPage (display, null); tbar.ShowAll (); scroll.Show (); this.Decorated = false; this.Fullscreen (); this.ButtonPressEvent += HandleButtonPressEvent; view.Item.Changed += HandleItemChanged; view.GrabFocus (); hide_cursor_delay = new DelayedOperation (3000, new GLib.IdleHandler (HideCursor)); hide_cursor_delay.Start (); controls = new ControlOverlay (this); controls.Add (tbar); controls.Dismiss (); notebook.CurrentPage = 0; } catch (System.Exception e) { Log.Exception (e); } }
#pragma warning restore 649 public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window) : base("EditTagIconDialog.ui", "edit_tag_icon_dialog") { TransientFor = parent_window; Title = Strings.EditIconForTagName(t.Name); // FIXME, Icon //preview_pixbuf = t.Icon; if (preview_pixbuf != null && ColorManagement.Profiles.TryGetValue(Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out var screen_profile)) { preview_image.Pixbuf = preview_pixbuf.Copy(); ColorManagement.ApplyProfile(preview_image.Pixbuf, screen_profile); } else { preview_image.Pixbuf = preview_pixbuf; } query = new PhotoQuery(db.Photos); if (db.Tags.Hidden != null) { query.Terms = OrTerm.FromTags(new[] { t }); } else { query.Terms = new Literal(t); } image_view = new PhotoImageView(query) { CropHelpers = false }; image_view.SelectionXyRatio = 1.0; image_view.SelectionChanged += HandleSelectionChanged; image_view.PhotoChanged += HandlePhotoChanged; external_photo_chooser = new Gtk.FileChooserButton(Strings.SelectPhotoFromFile, Gtk.FileChooserAction.Open) { Filter = new FileFilter() }; external_photo_chooser.Filter.AddPixbufFormats(); external_photo_chooser.LocalOnly = false; external_photo_chooser_hbox.PackStart(external_photo_chooser); external_photo_chooser.Show(); external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged; photo_scrolled_window.Add(image_view); if (query.Count > 0) { photo_spin_button.Wrap = true; photo_spin_button.Adjustment.Lower = 1.0; photo_spin_button.Adjustment.Upper = query.Count; photo_spin_button.Adjustment.StepIncrement = 1.0; photo_spin_button.ValueChanged += HandleSpinButtonChanged; image_view.Item.Index = 0; } else { from_photo_label.Markup = string.Format($"\n<b>{Strings.FromPhoto}</b>\n{Strings.TagFromPhotoLabelMessage}", t.Name); photo_scrolled_window.Visible = false; photo_label.Visible = false; photo_spin_button.Visible = false; } icon_store = new ListStore(typeof(string), typeof(Gdk.Pixbuf)); icon_view = new Gtk.IconView(icon_store) { PixbufColumn = 1, SelectionMode = SelectionMode.Single }; icon_view.SelectionChanged += HandleIconSelectionChanged; icon_scrolled_window.Add(icon_view); icon_view.Show(); image_view.Show(); //var fill_delay = new DelayedOperation (FillIconView); //fill_delay.Start (); }
public int ImportFromFile(PhotoStore store, string path) { this.store = store; this.CreateDialog ("import_dialog"); this.Dialog.TransientFor = main_window; this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent; this.Dialog.Response += HandleDialogResponse; this.Dialog.DefaultResponse = ResponseType.Ok; AllowFinish = false; LoadPreferences (); //import_folder_entry.Activated += HandleEntryActivate; duplicate_check.Toggled += HandleRecurseToggled; recurse_check.Toggled += HandleRecurseToggled; copy_check.Toggled += HandleRecurseToggled; menu = new SourceMenu (this); source_option_menu.Menu = menu; collection = new FSpot.PhotoList (new Photo [0]); tray = new ScalingIconView (collection); tray.Selection.Changed += HandleTraySelectionChanged; icon_scrolled.SetSizeRequest (400, 200); icon_scrolled.Add (tray); //icon_scrolled.Visible = false; tray.DisplayTags = false; tray.Show (); photo_view = new PhotoImageView (collection); photo_scrolled.Add (photo_view); photo_scrolled.SetSizeRequest (200, 200); photo_view.Show (); //GtkUtil.ModifyColors (frame_eventbox); GtkUtil.ModifyColors (photo_scrolled); GtkUtil.ModifyColors (photo_view); photo_view.Pixbuf = GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, "f-spot", 128, (Gtk.IconLookupFlags)0); photo_view.ZoomFit (false); tag_entry = new FSpot.Widgets.TagEntry (MainWindow.Toplevel.Database.Tags, false); tag_entry.UpdateFromTagNames (new string []{}); tagentry_box.Add (tag_entry); tag_entry.Show (); this.Dialog.Show (); //source_option_menu.Changed += HandleSourceChanged; if (path != null) { SetImportPath (path); int i = menu.FindItemPosition (path); if (i > 0) { source_option_menu.SetHistory ((uint)i); } else if (Directory.Exists (path)) { SourceItem path_item = new SourceItem (new VfsSource (path)); menu.Prepend (path_item); path_item.ShowAll (); SetImportPath (path); source_option_menu.SetHistory (0); } idle_start.Start (); } ResponseType response = (ResponseType) this.Dialog.Run (); while (response == ResponseType.Ok) { try { if (Directory.Exists (this.ImportPath)) break; } catch (System.Exception e){ System.Console.WriteLine (e); break; } HigMessageDialog md = new HigMessageDialog (this.Dialog, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, Catalog.GetString ("Directory does not exist."), String.Format (Catalog.GetString ("The directory you selected \"{0}\" does not exist. " + "Please choose a different directory"), this.ImportPath)); md.Run (); md.Destroy (); response = (Gtk.ResponseType) this.Dialog.Run (); } if (response == ResponseType.Ok) { this.UpdateTagStore (tag_entry.GetTypedTagNames ()); SavePreferences (); this.Finish (); if (tags_selected != null && tags_selected.Count > 0) { for (int i = 0; i < collection.Count; i++) { Photo p = collection [i] as Photo; if (p == null) continue; p.AddTag ((Tag [])tags_selected.ToArray(typeof(Tag))); store.Commit (p); } } int width, height; this.Dialog.GetSize (out width, out height); FSpot.Preferences.Set (FSpot.Preferences.IMPORT_WINDOW_WIDTH, width); FSpot.Preferences.Set (FSpot.Preferences.IMPORT_WINDOW_HEIGHT, height); FSpot.Preferences.Set (FSpot.Preferences.IMPORT_WINDOW_PANE_POSITION, import_hpaned.Position); this.Dialog.Destroy (); return collection.Count; } else { this.Cancel (); //this.Dialog.Destroy(); return 0; } }