Esempio n. 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;
        }
Esempio n. 2
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.Initialize();

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

            foreach (var extension in PintaCore.System.GetExtensions <IExtension> ())
            {
                extension.Initialize();
            }

            // 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;

            // 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;
        }