protected override void OnDestroyed()
 {
     if (detachedPlayer)
     {
         playerWindow.Destroy();
         detachedPlayer = false;
     }
     playercapturer.Destroy();
     base.OnDestroyed();
 }
Exemple #2
0
 public override void Destroy()
 {
     GLib.Source.Remove(timerId);
     gmapWidget.Destroy();
     if (mapWindow != null)
     {
         mapWindow.Destroy();
     }
     uow?.Dispose();
     base.Destroy();
 }
Exemple #3
0
 public override void Destroy()
 {
     if (ChatCallbackObservable.IsInitiated)
     {
         ChatCallbackObservable.GetInstance().RemoveObserver(this);
     }
     GLib.Source.Remove(timerId);
     gmapWidget.Destroy();
     if (mapWindow != null)
     {
         mapWindow.Destroy();
     }
     base.Destroy();
 }
Exemple #4
0
        public static void Grab(this Gtk.Window window)
        {
            window.GrabFocus();

            Gtk.Grab.Add(window);

            var mask = Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask;

#if GTK3
            var grabbed = window.Display.DeviceManager.ClientPointer.Grab(window.GetWindow(), Gdk.GrabOwnership.Window, true, mask, null, 0);
            if (grabbed != Gdk.GrabStatus.Success)
            {
                Gtk.Grab.Remove(window);
            }
#else
            var grabbed = Gdk.Pointer.Grab(window.GdkWindow, true, mask, null, null, 0);
            if (grabbed == Gdk.GrabStatus.Success)
            {
                grabbed = Gdk.Keyboard.Grab(window.GdkWindow, true, 0);

                if (grabbed != Gdk.GrabStatus.Success)
                {
                    Gtk.Grab.Remove(window);
                    window.Destroy();
                }
            }
            else
            {
                Gtk.Grab.Remove(window);
            }
#endif
        }
 void HideTip()
 {
     if (tipWindow != null)
     {
         tipWindow.Destroy();
         tipWindow = null;
     }
 }
Exemple #6
0
 void window_DeleteEvent(object o, Gtk.DeleteEventArgs args)
 {
     if (AutoDispose)
     {
         window.Hide();
         if (window.Modal)
         {
             /*never destroy modal windows automagically*/
         }
         else
         {
             window.Destroy();
         }
         args.RetVal = true; //we handled this event ourselves
     }
     else //dont autodispose
     {
         window.Hide();      //just hide the window
         args.RetVal = true; //we handled this event
     }
 }
Exemple #7
0
 void ResetFloatMode()
 {
     if (floatingWindow != null)
     {
         // The widgets have already been removed from the window in ResetMode
         floatingWindow.Destroy();
         floatingWindow = null;
         if (titleTab != null)
         {
             titleTab.UpdateBehavior();
         }
     }
 }
Exemple #8
0
 static void GetDefaults()
 {
     if (!gotDefault)
     {
         // Is there a better way of getting the default?
         Gtk.Window  d = new Gtk.Window("");
         Gtk.Toolbar t = new Gtk.Toolbar();
         d.Add(t);
         defaultStyle = t.ToolbarStyle;
         defaultSize  = t.IconSize;
         d.Destroy();
         gotDefault = true;
     }
 }
                private void updateProgressBar()
                {
                    progressbar1.Text     = System.Convert.ToString(percentage) + "%";
                    progressbar1.Fraction = percentage / 100;
                    copyLabel.Text        = file;

                    if (copied_files == file_number)
                    {
                        file_number  = 0;
                        copied_files = 0;
                        percentage   = 0;
                        dialog2.Destroy();
                        Build();
                    }
                }
Exemple #10
0
        public MusicSource() : base("Google Music", "Google Music", 30)
        {
            api             = new Google.Music.Api();
            downloadWrapper = new MusicDownloadWrapper(api);
            downloadWrapper.Start();

            TypeUniqueId = "google-music";
            Properties.Set <Gdk.Pixbuf>("Icon.Pixbuf_16", Gdk.Pixbuf.LoadFromResource("google-music-favicon"));

            var win         = new Gtk.Window("Google Music Login");
            var loginWidget = new LoginWidget();

            loginWidget.UserLoggedIn += (cookies) => {
                api.SetCookies(cookies);
                AsyncUserJob.Create(() => {
                    Refetch();
                }, "Fetching playlist");

                win.Destroy();
            };
            win.Add(loginWidget);
            win.ShowAll();
        }
Exemple #11
0
        public static void Grab(this Gtk.Window window)
        {
            window.GrabFocus();

            Gtk.Grab.Add(window);

            Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(window.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, 0);

            if (grabbed == Gdk.GrabStatus.Success)
            {
                grabbed = Gdk.Keyboard.Grab(window.GdkWindow, true, 0);

                if (grabbed != Gdk.GrabStatus.Success)
                {
                    Gtk.Grab.Remove(window);
                    window.Destroy();
                }
            }
            else
            {
                Gtk.Grab.Remove(window);
            }
        }
        public MusicSource()
            : base("Google Music", "Google Music", 30)
        {
            api = new Google.Music.Api();
            downloadWrapper = new MusicDownloadWrapper(api);
            downloadWrapper.Start();

            TypeUniqueId = "google-music";
            Properties.Set<Gdk.Pixbuf>("Icon.Pixbuf_16", Gdk.Pixbuf.LoadFromResource("google-music-favicon"));

            var win = new Gtk.Window("Google Music Login");
            var loginWidget = new LoginWidget();
            loginWidget.UserLoggedIn += (cookies) => {
                api.SetCookies(cookies);
                AsyncUserJob.Create(() => {
                    Refetch();
                }, "Fetching playlist");

                win.Destroy();
            };
            win.Add(loginWidget);
            win.ShowAll();
        }
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
#if GIO_2_16
            if (listwindow != null)
            {
                listwindow.Destroy();
            }
#endif
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                Dialog.Destroy();
                return;
            }

            clean  = remove_check.Active;
            rotate = rotate_check.Active;
            Dialog.Destroy();

            command_thread      = new System.Threading.Thread(new System.Threading.ThreadStart(Transfer));
            command_thread.Name = Catalog.GetString("Transferring Pictures");

            progress_dialog = new FSpot.ThreadProgressDialog(command_thread, selection.Count);
            progress_dialog.Start();
        }
		static void GetDefaults ()
		{
			if (!gotDefault) {
				// Is there a better way of getting the default?
				Gtk.Window d = new Gtk.Window ("");
				Gtk.Toolbar t = new Gtk.Toolbar ();
				d.Add (t);
				defaultStyle = t.ToolbarStyle;
				defaultSize = t.IconSize;
				d.Destroy ();
				gotDefault = true;
			}
		}
Exemple #15
0
        /// <summary>Writes PDF for specified auto-doc commands.</summary>
        /// <param name="section">The writer to write to.</param>
        /// <param name="tags">The autodoc tags.</param>
        private void TagsToMigraDoc(Section section, List <AutoDocumentation.ITag> tags)
        {
            int figureNumber = 0;

            foreach (AutoDocumentation.ITag tag in tags)
            {
                if (tag is AutoDocumentation.Heading)
                {
                    AutoDocumentation.Heading heading = tag as AutoDocumentation.Heading;
                    if (heading.headingLevel > 0 && heading.headingLevel <= 6)
                    {
                        Paragraph para = section.AddParagraph(heading.text, "Heading" + heading.headingLevel);
                        para.Format.KeepWithNext = true;
                        int posSpace = heading.text.IndexOf(' ');
                        if (posSpace > 0)
                        {
                            para.AddBookmark(heading.text.Substring(posSpace + 1));
                        }
                        if (heading.headingLevel == 1)
                        {
                            para.Format.OutlineLevel = OutlineLevel.Level1;
                        }
                        else if (heading.headingLevel == 2)
                        {
                            para.Format.OutlineLevel = OutlineLevel.Level2;
                        }
                        else if (heading.headingLevel == 3)
                        {
                            para.Format.OutlineLevel = OutlineLevel.Level3;
                        }
                        else if (heading.headingLevel == 4)
                        {
                            para.Format.OutlineLevel = OutlineLevel.Level4;
                        }
                        else if (heading.headingLevel == 5)
                        {
                            para.Format.OutlineLevel = OutlineLevel.Level5;
                        }
                        else if (heading.headingLevel == 6)
                        {
                            para.Format.OutlineLevel = OutlineLevel.Level6;
                        }
                    }
                }
                else if (tag is AutoDocumentation.Paragraph)
                {
                    AutoDocumentation.Paragraph paragraph = tag as AutoDocumentation.Paragraph;
                    if (paragraph.text.Contains("![Alt Text]"))
                    {
                        figureNumber++;
                    }
                    paragraph.text = paragraph.text.Replace("[FigureNumber]", figureNumber.ToString());
                    AddFormattedParagraphToSection(section, paragraph);
                }
                else if (tag is AutoDocumentation.GraphAndTable)
                {
                    CreateGraphPDF(section, tag as AutoDocumentation.GraphAndTable);
                }
                else if (tag is GraphPage)
                {
                    CreateGraphPage(section, tag as GraphPage);
                }
                else if (tag is AutoDocumentation.NewPage)
                {
                    section.AddPageBreak();
                }
                else if (tag is AutoDocumentation.Table)
                {
                    CreateTable(section, tag as AutoDocumentation.Table);
                }
                else if (tag is Graph)
                {
                    GraphPresenter graphPresenter = new GraphPresenter();
                    explorerPresenter.ApsimXFile.Links.Resolve(graphPresenter);
                    GraphView graphView = new GraphView();
                    graphView.BackColor        = OxyPlot.OxyColors.White;
                    graphView.ForegroundColour = OxyPlot.OxyColors.Black;
                    graphView.FontSize         = 12;
                    graphView.Width            = 500;
                    graphView.Height           = 500;
                    graphPresenter.Attach(tag, graphView, explorerPresenter);
                    string pngFileName = graphPresenter.ExportToPNG(WorkingDirectory);
                    section.AddImage(pngFileName);
                    string caption = (tag as Graph).Caption;
                    if (caption != null)
                    {
                        section.AddParagraph(caption);
                    }
                    graphPresenter.Detach();
                    graphView.MainWidget.Destroy();
                }
                else if (tag is Map && (tag as Map).GetCoordinates().Count > 0)
                {
                    MapPresenter mapPresenter = new MapPresenter();
                    MapView      mapView      = new MapView(null);
                    mapPresenter.Attach(tag, mapView, explorerPresenter);
                    string pngFileName = mapPresenter.ExportToPNG(WorkingDirectory);
                    if (!String.IsNullOrEmpty(pngFileName))
                    {
                        section.AddImage(pngFileName);
                    }
                    mapPresenter.Detach();
                    mapView.MainWidget.Destroy();
                }
                else if (tag is AutoDocumentation.Image)
                {
                    AutoDocumentation.Image imageTag = tag as AutoDocumentation.Image;
                    if (imageTag.image.Width > 700)
                    {
                        imageTag.image = ImageUtilities.ResizeImage(imageTag.image, 700, 500);
                    }
                    string pngFileName = Path.Combine(WorkingDirectory, imageTag.name);
                    imageTag.image.Save(pngFileName, System.Drawing.Imaging.ImageFormat.Png);
                    section.AddImage(pngFileName);
                    figureNumber++;
                }
                else if (tag is AutoDocumentation.ModelView)
                {
                    AutoDocumentation.ModelView modelView     = tag as AutoDocumentation.ModelView;
                    ViewNameAttribute           viewName      = ReflectionUtilities.GetAttribute(modelView.model.GetType(), typeof(ViewNameAttribute), false) as ViewNameAttribute;
                    PresenterNameAttribute      presenterName = ReflectionUtilities.GetAttribute(modelView.model.GetType(), typeof(PresenterNameAttribute), false) as PresenterNameAttribute;
                    if (viewName != null && presenterName != null)
                    {
                        ViewBase owner = ViewBase.MasterView as ViewBase;
                        if (viewName.ToString() == "UserInterface.Views.MapView")
                        {
                            owner = null;
                        }

                        ViewBase   view      = Assembly.GetExecutingAssembly().CreateInstance(viewName.ToString(), false, BindingFlags.Default, null, new object[] { owner }, null, null) as ViewBase;
                        IPresenter presenter = Assembly.GetExecutingAssembly().CreateInstance(presenterName.ToString()) as IPresenter;

                        if (view != null && presenter != null)
                        {
                            explorerPresenter.ApsimXFile.Links.Resolve(presenter);
                            presenter.Attach(modelView.model, view, explorerPresenter);

                            Gtk.Window popupWin = new Gtk.Window(Gtk.WindowType.Popup);
                            popupWin.SetSizeRequest(800, 800);
                            popupWin.Add(view.MainWidget);

                            if (view is IMapView map)
                            {
                                map.HideZoomControls();
                            }

                            popupWin.ShowAll();

                            while (Gtk.Application.EventsPending())
                            {
                                Gtk.Application.RunIteration();
                            }

                            // From MapView:
                            // With WebKit, it appears we need to give it time to actually update the display
                            // Really only a problem with the temporary windows used for generating documentation
                            if (view is MapView)
                            {
                                var watch = new System.Diagnostics.Stopwatch();
                                watch.Start();
                                while (watch.ElapsedMilliseconds < 1000)
                                {
                                    Gtk.Application.RunIteration();
                                }
                            }

                            string pngFileName = (presenter as IExportable).ExportToPNG(WorkingDirectory);
                            section.AddImage(pngFileName);
                            presenter.Detach();
                            view.MainWidget.Destroy();
                            popupWin.Destroy();
                        }
                    }
                }
            }
        }
Exemple #16
0
		static void GlobalSetup ()
		{
			if (initedGlobal || setupFail)
				return;
			initedGlobal = true;
			
			//FIXME: should we remove these when finalizing?
			try {
				ApplicationEvents.Quit += delegate (object sender, ApplicationQuitEventArgs e) {
					if (!IdeApp.Exit ())
						e.UserCancelled = true;
					e.Handled = true;
				};
				
				ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
					if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null) {
						IdeApp.Workbench.RootWindow.Deiconify ();
						IdeApp.Workbench.RootWindow.Show ();
						
						// This is a workaround to a GTK+ bug. The HasTopLevelFocus flag is not properly
						// set when the main window is restored. The workaround is to create and quickly
						// destroy a top level window. GTK+ then detects that the top level focus has
						// changed and properly sets HasTopLevelFocus.
						Gtk.Window ww = new Gtk.Window ("");
						ww.Decorated = false;
						ww.SetDefaultSize (0, 0);
						ww.Present ();
						IdeApp.Workbench.RootWindow.Present ();
						GLib.Timeout.Add (1, delegate {
							// Without this small delay, GTK+ crashes when destroying the window
							ww.Destroy ();
							return false;
						});
						e.Handled = true;
					}
				};
				
				ApplicationEvents.OpenDocuments += delegate (object sender, ApplicationDocumentEventArgs e) {
					//OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
					GLib.Timeout.Add (10, delegate {
						IdeApp.OpenFiles (e.Documents.Select (doc =>
							new FileOpenInformation (doc.Key, doc.Value, 1, OpenDocumentOptions.Default)));
						return false;
					});
					e.Handled = true;
				};
				
				//if not running inside an app bundle, assume usual MD build layout and load the app icon
				FilePath exePath = System.Reflection.Assembly.GetExecutingAssembly ().Location;
				if (!exePath.ToString ().Contains ("MonoDevelop.app")) {
					var mdSrcMain = exePath.ParentDirectory.ParentDirectory.ParentDirectory;
					var icons = mdSrcMain.Combine ("theme-icons", "Mac", "monodevelop.icns");
					if (File.Exists (icons))
						NSApplication.SharedApplication.ApplicationIconImage = new NSImage (icons);
				}
			} catch (Exception ex) {
				MonoDevelop.Core.LoggingService.LogError ("Could not install app event handlers", ex);
				setupFail = true;
			}
		}
 /// <summary>
 /// Close the specified window.
 /// </summary>
 /// <param name="window">The window to close.</param>
 public static void Close(this Gtk.Window window)
 {
     window.Destroy();
     INTV.Shared.ComponentModel.CommandManager.InvalidateRequerySuggested();
 }