Example #1
0
        public MainWindow()
        {
            // Build our window
            CreateWindow ();

            // Initialize interface things
            window_shell.AddAccelGroup (PintaCore.Actions.AccelGroup);
            dialog_handlers = new ActionHandlers ();

            PintaCore.Chrome.InitializeProgessDialog (new ProgressDialog ());
            PintaCore.Chrome.InitializeErrorDialogHandler ((parent, message, details) => {
                System.Console.Error.WriteLine ("Pinta: {0}", details);
                ErrorDialog errorDialog = new ErrorDialog (parent);
                try {
                    errorDialog.SetMessage (message);
                    errorDialog.AddDetails (details);
                    errorDialog.Run ();
                } finally {
                    errorDialog.Destroy ();
                }
            }
            );

            PintaCore.Initialize ();

            // Initialize extensions
            AddinManager.Initialize ();
            AddinManager.Registry.Update ();

            //Look out for any changes in extensions
            AddinManager.AddExtensionNodeHandler (typeof (IExtension), OnExtensionChanged);

            // Try to set the default tool to the PaintBrush
            PintaCore.Tools.SetCurrentTool (Catalog.GetString ("Paintbrush"));

            // Load the user's previous settings
            LoadUserSettings ();

            // Give the canvas focus
            PintaCore.Chrome.Canvas.GrabFocus ();

            // We support drag and drop for URIs
            window_shell.AddDragDropSupport (new Gtk.TargetEntry ("text/uri-list", 0, 100));

            // Handle a few main window specific actions
            PintaCore.Actions.File.BeforeQuit += delegate { SaveUserSettings (); };

            window_shell.DeleteEvent += MainWindow_DeleteEvent;
            window_shell.DragDataReceived += MainWindow_DragDataReceived;

            window_shell.KeyPressEvent += MainWindow_KeyPressEvent;
            window_shell.KeyReleaseEvent += MainWindow_KeyReleaseEvent;

            // TODO: These need to be [re]moved when we redo zoom support
            PintaCore.Actions.View.ZoomToWindow.Activated += new EventHandler (ZoomToWindow_Activated);
            PintaCore.Actions.View.ZoomToSelection.Activated += new EventHandler (ZoomToSelection_Activated);
            PintaCore.Workspace.ActiveDocumentChanged += ActiveDocumentChanged;
        }
Example #2
0
        private static void ExceptionManager_UnhandledException(GLib.UnhandledExceptionArgs args)
        {
            ErrorDialog errorDialog = new ErrorDialog (null);

            Exception ex = (Exception)args.ExceptionObject;

            try {
                errorDialog.Message = string.Format ("{0}:\n{1}", "Unhandled exception", ex.Message);
                errorDialog.AddDetails (ex.ToString (), false);
                errorDialog.Run ();
            } finally {
                errorDialog.Destroy ();
            }
        }
Example #3
0
        public MainWindow()
        {
            // Build our window
            CreateWindow();

            // Initialize interface things
            window_shell.AddAccelGroup(PintaCore.Actions.AccelGroup);
            dialog_handlers = new ActionHandlers();

            PintaCore.Chrome.InitializeProgessDialog(new ProgressDialog());
            PintaCore.Chrome.InitializeErrorDialogHandler((parent, message, details) => {
                System.Console.Error.WriteLine("Pinta: {0}", details);
                ErrorDialog errorDialog = new ErrorDialog(parent);
                try {
                    errorDialog.SetMessage(message);
                    errorDialog.AddDetails(details);
                    errorDialog.Run();
                } finally {
                    errorDialog.Destroy();
                }
            }
                                                          );

            PintaCore.Initialize();

            // Initialize extensions
            AddinManager.Initialize();
            AddinManager.Registry.Update();
            AddinSetupService setupService = new AddinSetupService(AddinManager.Registry);

            if (!setupService.AreRepositoriesRegistered())
            {
                setupService.RegisterRepositories(true);
            }

            //Look out for any changes in extensions
            AddinManager.AddExtensionNodeHandler(typeof(IExtension), OnExtensionChanged);

            // Try to set the default tool to the PaintBrush
            PintaCore.Tools.SetCurrentTool(Catalog.GetString("Paintbrush"));

            // Load the user's previous settings
            LoadUserSettings();

            // Give the canvas focus
            PintaCore.Chrome.Canvas.GrabFocus();

            // We support drag and drop for URIs
            window_shell.AddDragDropSupport(new Gtk.TargetEntry("text/uri-list", 0, 100));

            // Handle a few main window specific actions
            PintaCore.Actions.File.BeforeQuit += delegate { SaveUserSettings(); };

            window_shell.DeleteEvent      += MainWindow_DeleteEvent;
            window_shell.DragDataReceived += MainWindow_DragDataReceived;

            window_shell.KeyPressEvent   += MainWindow_KeyPressEvent;
            window_shell.KeyReleaseEvent += MainWindow_KeyReleaseEvent;

            // TODO: These need to be [re]moved when we redo zoom support
            PintaCore.Actions.View.ZoomToWindow.Activated    += new EventHandler(ZoomToWindow_Activated);
            PintaCore.Actions.View.ZoomToSelection.Activated += new EventHandler(ZoomToSelection_Activated);
            PintaCore.Workspace.ActiveDocumentChanged        += ActiveDocumentChanged;
        }
Example #4
0
        public MainWindow()
        {
            pressed_keys = new HashSet <Gdk.Key>();

            // Build our window
            CreateWindow();

            // Set up the Command Map window.
            cmd_map = new CommandMapWindow();

            // Move the tool toolbar into the command map window.
            //PintaCore.Chrome.ToolToolBar.Reparent (cmd_map.ToolToolbarBox);

            // Initialize interface things
            window_shell.AddAccelGroup(PintaCore.Actions.AccelGroup);
            dialog_handlers = new ActionHandlers();

            PintaCore.Chrome.InitializeProgessDialog(new ProgressDialog());
            PintaCore.Chrome.InitializeErrorDialogHandler((parent, message, details) => {
                System.Console.Error.WriteLine("Pinta: {0}", details);
                ErrorDialog errorDialog = new ErrorDialog(parent);
                try {
                    errorDialog.SetMessage(message);
                    errorDialog.AddDetails(details);
                    errorDialog.Run();
                } finally {
                    errorDialog.Destroy();
                }
            }
                                                          );

            PintaCore.Initialize();

            // Initialize extensions
            AddinManager.Initialize();
            AddinManager.Registry.Update();

            //Look out for any changes in extensions
            AddinManager.AddExtensionNodeHandler(typeof(IExtension), OnExtensionChanged);

            // Try to set the default tool to the PaintBrush
            PintaCore.Tools.SetCurrentTool(Catalog.GetString("Paintbrush"));

            // Load the user's previous settings
            LoadUserSettings();

            // Give the canvas focus
            PintaCore.Chrome.Canvas.GrabFocus();

            // We support drag and drop for URIs
            window_shell.AddDragDropSupport(new Gtk.TargetEntry("text/uri-list", 0, 100));

            // Handle a few main window specific actions
            PintaCore.Actions.File.BeforeQuit += delegate { SaveUserSettings(); };

            window_shell.DeleteEvent      += MainWindow_DeleteEvent;
            window_shell.DragDataReceived += MainWindow_DragDataReceived;

            window_shell.KeyPressEvent   += MainWindow_KeyPressEvent;
            window_shell.KeyReleaseEvent += MainWindow_KeyReleaseEvent;

            window_shell.FocusOutEvent += MainWindow_FocusOutEvent;

            // TODO: These need to be [re]moved when we redo zoom support
            PintaCore.Actions.View.ZoomToWindow.Activated    += new EventHandler(ZoomToWindow_Activated);
            PintaCore.Actions.View.ZoomToSelection.Activated += new EventHandler(ZoomToSelection_Activated);
            PintaCore.Workspace.ActiveDocumentChanged        += ActiveDocumentChanged;

            ButtonPressEventHandler close_cmd_map = delegate(object sender, ButtonPressEventArgs e) {
                cmd_map.Off(false);
            };

            // Tell some background stuff to close the CM when it is clicked.
            PintaCore.Chrome.Canvas.ButtonPressEvent += close_cmd_map;
            dock.ButtonPressEvent += close_cmd_map;
        }