Exemple #1
0
        public static void Main(string[] args)
        {
            int threads = -1;

            var p = new OptionSet () {
                { "rt|render-threads=", "number of threads to use for rendering", (int v) => threads = v }
            };

            List<string> extra;

            try {
                extra = p.Parse (args);
            } catch (OptionException e) {
                Console.Write ("Pinta: ");
                Console.WriteLine (e.Message);
                return;
            }

            Application.Init ();
            MainWindow win = new MainWindow ();
            win.Show ();

            if (threads != -1)
                Pinta.Core.PintaCore.System.RenderThreads = threads;

            if (extra.Count > 0) {
                // Not sure what this does for Mac, so I'm not touching it
                if (Platform.GetOS () == Platform.OS.Mac) {
                    string arg = args[0];

                    if (args[0].StartsWith ("-psn_")) {
                        if (args.Length > 1)
                            arg = args[1];
                        else
                            arg = null;
                    }

                    if (arg != null && arg != "")
                        Pinta.Core.PintaCore.Actions.File.OpenFile (arg);
                } else {
                    Pinta.Core.PintaCore.Actions.File.OpenFile (extra[0]);
                }
            }

            Application.Run ();
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            string app_dir = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location);
            string locale_dir;
            bool devel_mode = File.Exists (Path.Combine (Path.Combine (app_dir, ".."), "Pinta.sln"));

            if (Platform.GetOS () != Platform.OS.X11 || devel_mode)
                locale_dir = Path.Combine (app_dir, "locale");
            else {
                // From MonoDevelop:
                // Pinta is located at $prefix/lib/pinta
                // adding "../.." should give us $prefix
                string prefix = Path.Combine (Path.Combine (app_dir, ".."), "..");
                //normalise it
                prefix = Path.GetFullPath (prefix);
                //catalog is installed to "$prefix/share/locale" by default
                locale_dir = Path.Combine (Path.Combine (prefix, "share"), "locale");
            }

            try {
                Catalog.Init ("pinta", locale_dir);
            } catch (Exception ex) {
                Console.WriteLine (ex);
            }

            int threads = -1;

            var p = new OptionSet () {
                { "rt|render-threads=", Catalog.GetString ("number of threads to use for rendering"), (int v) => threads = v }
            };

            List<string> extra;

            try {
                extra = p.Parse (args);
            } catch (OptionException e) {
                Console.Write ("Pinta: ");
                Console.WriteLine (e.Message);
                return;
            }

            GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler (ExceptionManager_UnhandledException);

            Application.Init ();
            MainWindow win = new MainWindow ();
            win.Show ();

            if (threads != -1)
                Pinta.Core.PintaCore.System.RenderThreads = threads;

            if (extra.Count > 0) {
                // Not sure what this does for Mac, so I'm not touching it
                if (Platform.GetOS () == Platform.OS.Mac) {
                    string arg = args[0];

                    if (args[0].StartsWith ("-psn_")) {
                        if (args.Length > 1)
                            arg = args[1];
                        else
                            arg = null;
                    }

                    if (!string.IsNullOrEmpty (arg)) {
                        Pinta.Core.PintaCore.Actions.File.OpenFile (arg);
                        PintaCore.Workspace.ActiveDocument.HasFile = true;
                    }
                } else {
                    Pinta.Core.PintaCore.Actions.File.OpenFile (extra[0]);
                    PintaCore.Workspace.ActiveDocument.HasFile = true;
                }
            } else {
                // Create a blank document
                PintaCore.Actions.File.NewFile (new Gdk.Size (800, 600));
            }

            Application.Run ();
        }