static void ShutdownService()
 {
     IdeApp.ProjectOperations.EndBuild      -= OnProjectCompiled;
     IdeApp.Workbench.ActiveDocumentChanged -= OnActiveDocumentChanged;
     if (steticApp != null)
     {
         StoreConfiguration();
         steticApp.Dispose();
         steticApp = null;
     }
 }
示例#2
0
        public Stetic.CodeGenerationResult GenerateCode(ArrayList projectFolders, bool useGettext, string gettextClass, bool usePartialClasses, GtkDesignInfo info)
        {
            Gtk.Application.Init();

            Stetic.Application app = Stetic.ApplicationFactory.CreateApplication(Stetic.IsolationMode.None);

            Stetic.Project[] projects = new Stetic.Project [projectFolders.Count];
            for (int n = 0; n < projectFolders.Count; n++)
            {
                projects [n] = app.CreateProject(info);
                projects [n].Load((string)projectFolders [n]);
            }

            Stetic.GenerationOptions options = new Stetic.GenerationOptions();
            options.UseGettext   = useGettext;
            options.GettextClass = gettextClass;

            return(app.GenerateProjectCode(options, projects));
        }
        public Stetic.CodeGenerationResult GenerateCode(ArrayList projectFiles, bool useGettext, string gettextClass, string resourceLoaderClass, bool usePartialClasses)
        {
            Gtk.Application.Init();

            Stetic.Application app = Stetic.ApplicationFactory.CreateApplication(Stetic.IsolationMode.None);

            Stetic.Project[] projects = new Stetic.Project [projectFiles.Count];
            for (int n = 0; n < projectFiles.Count; n++)
            {
                projects [n] = app.CreateProject();
                projects [n].Load((string)projectFiles [n]);
            }

            Stetic.GenerationOptions options = new Stetic.GenerationOptions();
            options.UseGettext               = useGettext;
            options.GettextClass             = gettextClass;
            options.ImageResourceLoaderClass = resourceLoaderClass;
            options.UsePartialClasses        = usePartialClasses;
            options.GenerateSingleFile       = false;

            return(app.GenerateProjectCode(options, projects));
        }
示例#4
0
文件: Stetic.cs 项目: mono/stetic
        public static int Main(string[] args)
        {
            int n = 0;
            IsolationMode mode = IsolationMode.None;
            bool usePartial = false;
            bool useGettext = false;
            bool genEmpty = false;
            bool useMultifile = false;

            while (n < args.Length) {
                string arg = args[n];
                if (arg.StartsWith ("--language:"))
                    language = arg.Substring (11);
                else if (arg.StartsWith ("-l:"))
                    language = arg.Substring (3);
                else if (arg.StartsWith ("-lib:"))
                    libraries.Add (arg.Substring (5));
                else if (arg.StartsWith ("--library:"))
                    libraries.Add (arg.Substring (10));
                else if (arg == "--generate" || arg == "-g")
                    break;
                else if (arg == "--noisolation")
                    mode = IsolationMode.None;
                else if (arg == "--gen-partial")
                    usePartial = true;
                else if (arg == "--gen-gettext")
                    useGettext = true;
                else if (arg == "--gen-multifile")
                    useMultifile = true;
                else if (arg == "--gen-empty")
                    genEmpty = true;
                else
                    break;
                n++;
            }

            if (args.Length == 1 && args [0] == "--help") {
                Console.WriteLine (Catalog.GetString ("Stetic - A GTK User Interface Builder"));
                Console.WriteLine (Catalog.GetString ("Usage:"));
                Console.WriteLine ("\tstetic [<file>]");
                Console.WriteLine ("\tstetic [--language:<language>] [-lib:<library>...] --generate <sourceFile> <projectFile> ...");
                return 0;
            }

            Program = new Gnome.Program ("Stetic", "0.0", Gnome.Modules.UI, args);

            int ret;

            if (args.Length - n > 2 && ((args [n] == "--generate" || args [n] == "-g"))) {
                SteticApp = Stetic.ApplicationFactory.CreateApplication (IsolationMode.None);
                GenerationOptions ops = new GenerationOptions ();
                ops.UsePartialClasses = usePartial;
                ops.GenerateEmptyBuildMethod = genEmpty;
                ops.UseGettext = useGettext;
                ops.GenerateSingleFile = !useMultifile;
                ret = GenerateCode (args [n+1], args, n+2, ops);
            }
            else {
                SteticApp = Stetic.ApplicationFactory.CreateApplication (mode);
                SteticApp.AllowInProcLibraries = false;
                ret = RunApp (args, n);
            }

            SteticApp.Dispose ();
            return ret;
        }
		static void ShutdownService ()
		{
			IdeApp.ProjectOperations.EndBuild -= OnProjectCompiled;
			IdeApp.Workbench.ActiveDocumentChanged -= OnActiveDocumentChanged;
			if (steticApp != null) {
				StoreConfiguration ();
				steticApp.Dispose ();
				steticApp = null;
			}
		}
示例#6
0
        public static int Main(string[] args)
        {
            int           n            = 0;
            IsolationMode mode         = IsolationMode.None;
            bool          usePartial   = false;
            bool          useGettext   = false;
            bool          genEmpty     = false;
            bool          useMultifile = false;

            while (n < args.Length)
            {
                string arg = args[n];
                if (arg.StartsWith("--language:"))
                {
                    language = arg.Substring(11);
                }
                else if (arg.StartsWith("-l:"))
                {
                    language = arg.Substring(3);
                }
                else if (arg.StartsWith("-lib:"))
                {
                    libraries.Add(arg.Substring(5));
                }
                else if (arg.StartsWith("--library:"))
                {
                    libraries.Add(arg.Substring(10));
                }
                else if (arg == "--generate" || arg == "-g")
                {
                    break;
                }
                else if (arg == "--noisolation")
                {
                    mode = IsolationMode.None;
                }
                else if (arg == "--gen-partial")
                {
                    usePartial = true;
                }
                else if (arg == "--gen-gettext")
                {
                    useGettext = true;
                }
                else if (arg == "--gen-multifile")
                {
                    useMultifile = true;
                }
                else if (arg == "--gen-empty")
                {
                    genEmpty = true;
                }
                else
                {
                    break;
                }
                n++;
            }

            if (args.Length == 1 && args [0] == "--help")
            {
                Console.WriteLine(Catalog.GetString("Stetic - A GTK User Interface Builder"));
                Console.WriteLine(Catalog.GetString("Usage:"));
                Console.WriteLine("\tstetic [<file>]");
                Console.WriteLine("\tstetic [--language:<language>] [-lib:<library>...] --generate <sourceFile> <projectFile> ...");
                return(0);
            }

            Program = new Gnome.Program("Stetic", "0.0", Gnome.Modules.UI, args);

            int ret;

            if (args.Length - n > 2 && ((args [n] == "--generate" || args [n] == "-g")))
            {
                SteticApp = Stetic.ApplicationFactory.CreateApplication(IsolationMode.None);
                GenerationOptions ops = new GenerationOptions();
                ops.UsePartialClasses        = usePartial;
                ops.GenerateEmptyBuildMethod = genEmpty;
                ops.UseGettext         = useGettext;
                ops.GenerateSingleFile = !useMultifile;
                ret = GenerateCode(args [n + 1], args, n + 2, ops);
            }
            else
            {
                SteticApp = Stetic.ApplicationFactory.CreateApplication(mode);
                SteticApp.AllowInProcLibraries = false;
                ret = RunApp(args, n);
            }

            SteticApp.Dispose();
            return(ret);
        }