static CopyOperation() { if (Platform.IsMac) { RTF_ATOM = Gdk.Atom.Intern("NSRTFPboardType", false); //TODO: use public.rtf when dep on MacOS 10.6 const string NSHTMLPboardType = "Apple HTML pasteboard type"; HTML_ATOM = Gdk.Atom.Intern(NSHTMLPboardType, false); } else { RTF_ATOM = Gdk.Atom.Intern("text/rtf", false); HTML_ATOM = Gdk.Atom.Intern("text/html", false); } targetList = new Gtk.TargetList(); targetList.Add(HTML_ATOM, /* FLAGS */ 0, HTMLTextType); targetList.Add(RTF_ATOM, /* FLAGS */ 0, RichTextType); targetList.Add(MD_ATOM, /* FLAGS */ 0, MonoTextType); targetList.AddTextTargets(TextType); //HACK: work around gtk_selection_data_set_text causing crashes on Mac w/ QuickSilver, Clipbard History etc. if (Platform.IsMac) { targetList.Remove("COMPOUND_TEXT"); targetList.Remove("TEXT"); targetList.Remove("STRING"); } }
static CopyOperation() { targetList = new Gtk.TargetList(); targetList.Add(RTF_ATOM, /* FLAGS */ 0, RichTextType); targetList.Add(MD_ATOM, /* FLAGS */ 0, MonoTextType); targetList.AddTextTargets(TextType); }
public PlaysTreeView() { enableCategoryMove = true; SetCategoriesMenu (); targetEntry = new TargetEntry [] { new TargetEntry ("event-type-dnd", TargetFlags.Widget, 0) }; targetList = new TargetList (targetEntry); this.EnableModelDragDest (targetEntry, DragAction.Move); }
public PlaysTreeView() { enableCategoryMove = true; targetEntry = new TargetEntry [] { new TargetEntry ("event-type-dnd", TargetFlags.Widget, 0) }; targetList = new TargetList (targetEntry); this.EnableModelDragDest (targetEntry, DragAction.Move); eventTypeMenu = new EventTypeMenu (); eventTypeMenu.EditProperties += (cat) => EditProperties (cat); eventTypeMenu.SortEvent += (sender, e) => modelSort.SetSortFunc (0, SortFunction); }
public static void Main (string[] args) { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("sl-SI"); Thread.CurrentThread.CurrentCulture.SetSlovenian(); Application.Init (); TargetList lst = new TargetList(); lst.AddTextTargets(0); System.Console.WriteLine(((TargetEntry[]) lst).Length); foreach(TargetEntry t in ((TargetEntry[]) lst)) System.Console.WriteLine(t.Target); MainWindow win = new MainWindow (); win.Show (); Application.Run (); }
public EditModsDialog(Window parent, Instance inst) : base("Edit Mods", parent) { this.inst = inst; XML gxml = new XML(null, "MultiMC.GTKGUI.EditModsDialog.glade", "vboxEditMods", null); gxml.Autoconnect(this); this.VBox.PackStart(vboxEditMods); this.AddButton("_Cancel", ResponseType.Cancel); this.AddButton("_OK", ResponseType.Ok); WidthRequest = 600; HeightRequest = 500; modStore = new ListStore(typeof(string), typeof(Mod)); jarModList.Model = modStore; jarModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0); mlModStore = new ListStore(typeof(string), typeof(Mod)); mlModList.Model = mlModStore; mlModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0); //mlModList.Selection.Mode = SelectionMode.Multiple; inst.InstMods.ModFileChanged += (o, args) => LoadModList(); // Listen for key presses jarModList.KeyPressEvent += new KeyPressEventHandler(jarModList_KeyPressEvent); mlModList.KeyPressEvent += new KeyPressEventHandler(mlModList_KeyPressEvent); TargetEntry te = new TargetEntry (); te.Flags = TargetFlags.Widget; te.Target = "STRING"; TargetEntry[] tes = new TargetEntry[1]; tes[0]=te; Gtk.TargetList tel = new Gtk.TargetList(tes); Gtk.Drag.SourceSet (jarModList, Gdk.ModifierType.Button1Mask, tes, Gdk.DragAction.Move); Gtk.Drag.DestSetTargetList (jarModList, tel); jarModList.DragDataGet += new DragDataGetHandler (ddgh); jarModList.DragDataReceived += new DragDataReceivedHandler (ddrh); }
static CopyOperation () { if (Platform.IsMac) { RTF_ATOM = Gdk.Atom.Intern ("NSRTFPboardType", false); //TODO: use public.rtf when dep on MacOS 10.6 const string NSHTMLPboardType = "Apple HTML pasteboard type"; HTML_ATOM = Gdk.Atom.Intern (NSHTMLPboardType, false); } else { RTF_ATOM = Gdk.Atom.Intern ("text/rtf", false); HTML_ATOM = Gdk.Atom.Intern ("text/html", false); } targetList = new Gtk.TargetList (); targetList.Add (HTML_ATOM, /* FLAGS */0, HTMLTextType); targetList.Add (RTF_ATOM, /* FLAGS */0, RichTextType); targetList.Add (MD_ATOM, /* FLAGS */0, MonoTextType); targetList.AddTextTargets (TextType); //HACK: work around gtk_selection_data_set_text causing crashes on Mac w/ QuickSilver, Clipbard History etc. if (Platform.IsMac) { targetList.Remove ("COMPOUND_TEXT"); targetList.Remove ("TEXT"); targetList.Remove ("STRING"); } }
public void CopyLyricsToClipboard() { Clipboard clipboard = Clipboard.Get (CLIPBOARD_ATOM); var targets = new TargetList (); targets.AddTextTargets (TextType); clipboard.SetWithData ((Gtk.TargetEntry[])targets, ClipboardGetFunc, ClipboardClearFunc); }
static CopyOperation () { targetList = new Gtk.TargetList (); targetList.Add (RTF_ATOM, /* FLAGS */0, RichTextType); targetList.Add (MD_ATOM, /* FLAGS */0, MonoTextType); targetList.AddTextTargets (TextType); }
static CopyOperation () { if (Platform.IsMac) { RTF_ATOM = Gdk.Atom.Intern ("NSRTFPboardType", false); //TODO: use public.rtf when dep on MacOS 10.6 const string NSHTMLPboardType = "Apple HTML pasteboard type"; HTML_ATOM = Gdk.Atom.Intern (NSHTMLPboardType, false); } else if (Platform.IsWindows) { RTF_ATOM = Gdk.Atom.Intern ("Rich Text Format", false); HTML_ATOM = Gdk.Atom.Intern ("HTML Format", false); } else { RTF_ATOM = Gdk.Atom.Intern ("text/rtf", false); HTML_ATOM = Gdk.Atom.Intern ("text/html", false); } var newTargets = new List<TargetEntry> (); newTargets.Add (new TargetEntry ("SAVE_TARGETS", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry (HTML_ATOM.Name, TargetFlags.OtherApp, HTMLTextType)); newTargets.Add (new TargetEntry ("UTF8_STRING", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry (RTF_ATOM.Name, TargetFlags.OtherApp, RichTextType)); newTargets.Add (new TargetEntry (MD_ATOM.Name, TargetFlags.App, MonoTextType)); newTargets.Add (new TargetEntry ("text/plain;charset=utf-8", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry ("text/plain", TargetFlags.App, TextType)); //HACK: work around gtk_selection_data_set_text causing crashes on Mac w/ QuickSilver, Clipbard History etc. if (!Platform.IsMac) { newTargets.Add (new TargetEntry ("COMPOUND_TEXT", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry ("STRING", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry ("TEXT", TargetFlags.App, TextType)); } TargetEntries = newTargets.ToArray (); TargetList = new TargetList (TargetEntries); }
public SingleView(SafeUri [] uris) { this.uri = uris [0]; Log.Debug ("uri: " + this.uri); GtkBeans.Builder builder = new GtkBeans.Builder ("single_view.ui"); builder.Autoconnect (this); LoadPreference (Preferences.VIEWER_WIDTH); LoadPreference (Preferences.VIEWER_MAXIMIZED); Gtk.Toolbar toolbar = new Gtk.Toolbar (); toolbar_hbox.PackStart (toolbar); rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), true); rl_button.Clicked += HandleRotate270Command; rl_button.TooltipText = Catalog.GetString ("Rotate photo left"); toolbar.Insert (rl_button, -1); rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), true); rr_button.Clicked += HandleRotate90Command; rr_button.TooltipText = Catalog.GetString ("Rotate photo right"); toolbar.Insert (rr_button, -1); toolbar.Insert (new SeparatorToolItem (), -1); ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), true); fs_button.Clicked += HandleViewFullscreen; fs_button.TooltipText = Catalog.GetString ("View photos fullscreen"); toolbar.Insert (fs_button, -1); ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), true); ss_button.Clicked += HandleViewSlideshow; ss_button.TooltipText = Catalog.GetString ("View photos in a slideshow"); toolbar.Insert (ss_button, -1); collection = new UriCollection (uris); TargetList targetList = new TargetList(); targetList.AddTextTargets((uint)DragDropTargets.TargetType.PlainText); targetList.AddUriTargets((uint)DragDropTargets.TargetType.UriList); directory_view = new SelectionCollectionGridView (collection); directory_view.Selection.Changed += HandleSelectionChanged; directory_view.DragDataReceived += HandleDragDataReceived; Gtk.Drag.DestSet (directory_view, DestDefaults.All, (TargetEntry[])targetList, DragAction.Copy | DragAction.Move); directory_view.DisplayTags = false; directory_view.DisplayDates = false; directory_view.DisplayRatings = false; directory_scrolled = new ScrolledWindow(); directory_scrolled.Add (directory_view); sidebar = new Sidebar (); info_vbox.Add (sidebar); sidebar.AppendPage (directory_scrolled, Catalog.GetString ("Folder"), "gtk-directory"); AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged); sidebar.Context = ViewContext.Single; sidebar.CloseRequested += HandleHideSidePane; sidebar.Show (); ThumbnailLoader.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw (); }; image_view = new PhotoImageView (collection); GtkUtil.ModifyColors (image_view); GtkUtil.ModifyColors (image_scrolled); image_view.ZoomChanged += HandleZoomChanged; image_view.Item.Changed += HandleItemChanged; image_view.ButtonPressEvent += HandleImageViewButtonPressEvent; image_view.DragDataReceived += HandleDragDataReceived; Gtk.Drag.DestSet (image_view, DestDefaults.All, (TargetEntry[])targetList, DragAction.Copy | DragAction.Move); image_scrolled.Add (image_view); Window.ShowAll (); zoom_scale.ValueChanged += HandleZoomScaleValueChanged; LoadPreference (Preferences.VIEWER_SHOW_TOOLBAR); LoadPreference (Preferences.VIEWER_INTERPOLATION); LoadPreference (Preferences.VIEWER_TRANSPARENCY); LoadPreference (Preferences.VIEWER_TRANS_COLOR); ShowSidebar = collection.Count > 1; LoadPreference (Preferences.VIEWER_SHOW_FILENAMES); Preferences.SettingChanged += OnPreferencesChanged; Window.DeleteEvent += HandleDeleteEvent; collection.Changed += HandleCollectionChanged; // wrap the methods to fit to the delegate image_view.Item.Changed += delegate (object sender, BrowsablePointerChangedEventArgs old) { BrowsablePointer pointer = sender as BrowsablePointer; if (pointer == null) return; IPhoto [] item = {pointer.Current}; sidebar.HandleSelectionChanged (new PhotoList (item)); }; image_view.Item.Collection.ItemsChanged += sidebar.HandleSelectionItemsChanged; UpdateStatusLabel (); if (collection.Count > 0) directory_view.Selection.Add (0); export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem (this).Submenu; export.Submenu.ShowAll (); export.Activated += HandleExportActivated ; }
void Toolbox_DragSourceSet(object sender, Gtk.TargetEntry [] e) { targets = new Gtk.TargetList(); targets.AddTable(e); }
public void HandleCopy (object sender, EventArgs args) { Clipboard primary = Clipboard.Get (Atom.Intern ("PRIMARY", false)); Clipboard clipboard = Clipboard.Get (Atom.Intern ("CLIPBOARD", false)); if (Window.Focus is Editable) { (Window.Focus as Editable).CopyClipboard (); return; } TargetList targetList = new TargetList (); targetList.AddTextTargets ((uint)DragDropTargets.TargetType.PlainText); targetList.AddUriTargets ((uint)DragDropTargets.TargetType.UriList); targetList.Add ( DragDropTargets.CopyFilesEntry.Target, (uint)DragDropTargets.CopyFilesEntry.Flags, (uint)DragDropTargets.CopyFilesEntry.Info); // use eager evaluation, because we want to copy the photos which are currently selected ... var uris = new UriList (from p in SelectedPhotos () select p.DefaultVersion.Uri); var paths = String.Join (" ", (from p in SelectedPhotos () select p.DefaultVersion.Uri.LocalPath).ToArray () ); clipboard.SetWithData ((TargetEntry[])targetList, delegate (Clipboard clip, SelectionData data, uint info) { if (info == (uint)DragDropTargets.TargetType.PlainText) { data.Text = paths; return; } if (info == (uint)DragDropTargets.TargetType.UriList) { data.SetUriListData (uris); return; } if (info == DragDropTargets.CopyFilesEntry.Info) { data.SetCopyFiles (uris); return; } Log.DebugFormat ("Unknown Selection Data Target (info: {0})", info); }, delegate { }); primary.Text = paths; }
protected override void Initialize(IPadWindow window) { this.window = window; dragPad = new FigmaDragAndDropContent(); window.PadContentHidden += Container_PadHidden; window.PadContentShown += Container_PadShown; widget = new Gtk.GtkNSViewHost(dragPad); widget.DragBegin += (o, args) => { if (!isDragging) { DesignerSupport.DesignerSupport.Service.ToolboxService.DragSelectedItem(widget, args.Context); isDragging = true; } }; widget.DragDataGet += (object o, DragDataGetArgs args) => { if (selectedNode is IDragDataToolboxNode node) { foreach (var format in node.Formats) { args.SelectionData.Set(Gdk.Atom.Intern(format, false), 8, node.GetData(format)); } } }; widget.DragEnd += (o, args) => { isDragging = false; }; dragPad.SelectCode += (sender, e) => { if (!string.IsNullOrEmpty(e)) { var selected = new TextToolboxNode(e); DesignerSupport.DesignerSupport.Service.ToolboxService.SelectItem(selected); DesignerSupport.DesignerSupport.Service.ToolboxService.UseSelectedItem(); } }; dragPad.DragSourceSet += (s, e) => { targets = CreateDefaultTargeList(); targets.AddTable(e); }; dragPad.DragBegin += (object sender, EventArgs e) => { var code = dragPad.GetCode(dragPad.SelectedNode); selectedNode = new TextToolboxNode(code); DesignerSupport.DesignerSupport.Service.ToolboxService.SelectItem(selectedNode); Gtk.Drag.SourceUnset(widget); if (selectedNode is IDragDataToolboxNode node) { foreach (var format in node.Formats) { targets.Add(format, 0, 0); } } // Gtk.Application.CurrentEvent and other copied gdk_events seem to have a problem // when used as they use gdk_event_copy which seems to crash on de-allocating the private slice. IntPtr currentEvent = Components.GtkWorkarounds.GetCurrentEventHandle(); Gtk.Drag.Begin(widget, targets, Gdk.DragAction.Copy | Gdk.DragAction.Move, 1, new Gdk.Event(currentEvent, false)); // gtk_drag_begin does not store the event, so we're okay Components.GtkWorkarounds.FreeEvent(currentEvent); }; widget.ShowAll(); if (IdeApp.Workbench != null) { //IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged; IdeApp.Workbench.ActiveDocumentChanged += onActiveDocChanged; // += new EventHandler(onActiveDocChanged); onActiveDocChanged(null, null); } }
static CopyOperation () { if (Platform.IsMac) { RTF_ATOM = Gdk.Atom.Intern ("NSRTFPboardType", false); //TODO: use public.rtf when dep on MacOS 10.6 const string NSHTMLPboardType = "Apple HTML pasteboard type"; HTML_ATOM = Gdk.Atom.Intern (NSHTMLPboardType, false); } else if (Platform.IsWindows) { RTF_ATOM = Gdk.Atom.Intern ("Rich Text Format", false); HTML_ATOM = Gdk.Atom.Intern ("HTML Format", false); } else { RTF_ATOM = Gdk.Atom.Intern ("text/rtf", false); HTML_ATOM = Gdk.Atom.Intern ("text/html", false); } var newTargets = new List<TargetEntry> (); newTargets.Add (new TargetEntry ("SAVE_TARGETS", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry (HTML_ATOM.Name, TargetFlags.OtherApp, HTMLTextType)); newTargets.Add (new TargetEntry ("UTF8_STRING", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry (RTF_ATOM.Name, TargetFlags.OtherApp, RichTextType)); if (!Platform.IsWindows) { // This seems to randomly break pasting on Windows. We'll disable it // for now until we find a better solution // https://bugzilla.xamarin.com/show_bug.cgi?id=23036 newTargets.Add (new TargetEntry (MD_ATOM.Name, TargetFlags.App, MonoTextType)); } newTargets.Add (new TargetEntry ("text/plain;charset=utf-8", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry ("text/plain", TargetFlags.App, TextType)); //HACK: work around gtk_selection_data_set_text causing crashes on Mac w/ QuickSilver, Clipbard History etc. if (!Platform.IsMac) { newTargets.Add (new TargetEntry ("COMPOUND_TEXT", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry ("STRING", TargetFlags.App, TextType)); newTargets.Add (new TargetEntry ("TEXT", TargetFlags.App, TextType)); } TargetEntries = newTargets.ToArray (); TargetList = new TargetList (TargetEntries); }