示例#1
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));
        }
示例#3
0
        static int RunApp(string[] args, int n)
        {
            Project = SteticApp.CreateProject();

            Project.WidgetAdded     += OnWidgetAdded;
            Project.WidgetRemoved   += OnWidgetRemoved;
            Project.ModifiedChanged += OnProjectModified;
            Project.ProjectReloaded += OnProjectReloaded;

            Palette      = SteticApp.PaletteWidget;
            widgetTree   = SteticApp.WidgetTreeWidget;
            Signals      = SteticApp.SignalsWidget;
            propertyTree = SteticApp.PropertiesWidget;
            ProjectView  = new WindowListWidget();

            UIManager = new Stetic.UIManager(Project);

            Glade.XML.CustomHandler = CustomWidgetHandler;
            Glade.XML glade = new Glade.XML("stetic.glade", "MainWindow");
            glade.Autoconnect(typeof(SteticMain));

            if (ProjectView.Parent is Gtk.Viewport &&
                ProjectView.Parent.Parent is Gtk.ScrolledWindow)
            {
                Gtk.Viewport       viewport = (Gtk.Viewport)ProjectView.Parent;
                Gtk.ScrolledWindow scrolled = (Gtk.ScrolledWindow)viewport.Parent;
                viewport.Remove(ProjectView);
                scrolled.Remove(viewport);
                scrolled.AddWithViewport(ProjectView);
            }

            foreach (Gtk.Widget w in glade.GetWidgetPrefix(""))
            {
                Gtk.Window win = w as Gtk.Window;
                if (win != null)
                {
                    win.AddAccelGroup(UIManager.AccelGroup);
                    win.ShowAll();
                }
            }
            MainWindow                      = (Gtk.Window)Palette.Toplevel;
            WidgetNotebook                  = (Gtk.Notebook)glade ["notebook"];
            WidgetNotebook.SwitchPage      += OnPageChanged;
            ProjectView.ComponentActivated += OnWidgetActivated;
            widgetTree.SelectionChanged    += OnSelectionChanged;

#if GTK_SHARP_2_6
            // This is needed for both our own About dialog and for ones
            // the user constructs
            Gtk.AboutDialog.SetUrlHook(ActivateUrl);
#endif

            if (n < args.Length)
            {
                LoadProject(args [n]);
            }

            ReadConfiguration();

            foreach (string s in Configuration.WidgetLibraries)
            {
                SteticApp.AddWidgetLibrary(s);
            }
            SteticApp.UpdateWidgetLibraries(false);

            ProjectView.Fill(Project);

            Program.Run();
            return(0);
        }