Inheritance: System.MarshalByRefObject, IProject, IDisposable
Exemplo n.º 1
0
		public static void Export (ProjectBackend project, string filename)
		{
			XmlDocument doc = new XmlDocument ();
			doc.PreserveWhitespace = true;

			XmlElement toplevel = doc.CreateElement ("glade-interface");
			doc.AppendChild (toplevel);

			ObjectWriter owriter = new ObjectWriter (doc, FileFormat.Glade);
			foreach (Widget w in project.Toplevels) {
				Stetic.Wrapper.Container wrapper = Stetic.Wrapper.Container.Lookup (w);
				if (wrapper == null)
					continue;

				XmlElement elem = wrapper.Write (owriter);
				if (elem != null)
					toplevel.AppendChild (elem);
			}
	
			doc = GladeUtils.XslExportTransform (doc);

			// FIXME; if you use UTF8, it starts with a BOM???
			XmlTextWriter writer = new XmlTextWriter (filename, System.Text.Encoding.ASCII);
			writer.Formatting = Formatting.Indented;
			doc.Save (writer);
			writer.Close ();
		}
Exemplo n.º 2
0
        public object AddNewComponent(string fileName)
        {
            object ob        = ProjectBackend.AddNewComponent(fileName);
            object component = App.GetComponent(ob, null, null);

            if (component is WidgetComponent)
            {
                var        wc = (WidgetComponent)component;
                WidgetInfo wi = GetWidget(wc.Name);
                if (wi == null)
                {
                    wi = new WidgetInfo(this, wc);
                    widgets.Add(wi);
                }
                return(wi);
            }

            if (component is ActionGroupComponent)
            {
                var ac = (ActionGroupComponent)component;
                // Don't wait for the group added event to come to update the groups list since
                // it may be too late.
                ActionGroupInfo gi = GetActionGroup(ac.Name);
                if (gi == null)
                {
                    gi = new ActionGroupInfo(this, ac.Name);
                    groups.Add(gi);
                }
                return(gi);
            }

            return(null);
        }
Exemplo n.º 3
0
        public static void Export(ProjectBackend project, string filename)
        {
            XmlDocument doc = new XmlDocument();

            doc.PreserveWhitespace = true;

            XmlElement toplevel = doc.CreateElement("glade-interface");

            doc.AppendChild(toplevel);

            ObjectWriter owriter = new ObjectWriter(doc, FileFormat.Glade);

            foreach (Widget w in project.Toplevels)
            {
                Stetic.Wrapper.Container wrapper = Stetic.Wrapper.Container.Lookup(w);
                if (wrapper == null)
                {
                    continue;
                }

                XmlElement elem = wrapper.Write(owriter);
                if (elem != null)
                {
                    toplevel.AppendChild(elem);
                }
            }

            doc = GladeUtils.XslExportTransform(doc);

            XmlTextWriter writer = new XmlTextWriter(filename, EncodingUtility.UTF8NoBom);

            writer.Formatting = Formatting.Indented;
            doc.Save(writer);
            writer.Close();
        }
Exemplo n.º 4
0
        public static void Import(ProjectBackend project, string filename)
        {
            XmlDocument doc = new XmlDocument();

            doc.PreserveWhitespace = true;
            doc.XmlResolver        = null;
            doc.Load(filename);
            project.SetFileName(filename);
            project.Id = System.IO.Path.GetFileName(filename);
            doc        = GladeUtils.XslImportTransform(doc);

            XmlNode node = doc.SelectSingleNode("/glade-interface");

            if (node == null)
            {
                throw new ApplicationException(Catalog.GetString("Not a glade file according to node name."));
            }

            ObjectReader reader = new ObjectReader(project, FileFormat.Glade);

            foreach (XmlElement toplevel in node.SelectNodes("widget"))
            {
                Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject(reader, toplevel) as Wrapper.Container;
                if (wrapper != null)
                {
                    project.AddWidget((Gtk.Widget)wrapper.Wrapped);
                }
            }
        }
		public static void GenerateProjectGuiCode (CodeNamespace globalNs, CodeTypeDeclaration globalType, GenerationOptions options, List<SteticCompilationUnit> units, ProjectBackend[] projects, ArrayList warnings)
		{
			// Generate code for each project
			foreach (ProjectBackend gp in projects) {
			
				// Generate top levels
				foreach (Gtk.Widget w in gp.Toplevels) {
					Stetic.Wrapper.Widget wwidget = Stetic.Wrapper.Widget.Lookup (w);
					string topLevelName = wwidget.Name;
					if (gp.ComponentNeedsCodeGeneration (topLevelName)) {
						//designer file for widget could be changed beyond stetic process 
						//and we nead update wrapper before code generation
						//during reloading wrappered widget w could be changed;
						Gtk.Widget currentw = w;
						if (gp.ReloadTopLevel (topLevelName)) {
							currentw = gp.GetWidget (topLevelName);
						}
						GenerateWidgetCode (globalNs, options, units, currentw, warnings);
					}
				}
					
				// Generate global action groups
				foreach (Wrapper.ActionGroup agroup in gp.ActionGroups) {
					string groupName = agroup.Name;
					if (gp.ComponentNeedsCodeGeneration (groupName)) {
						//designer file for action group could be changed beyond stetic process 
						//and we nead update wrapper
						gp.ReloadActionGroup (groupName);
						GenerateGlobalActionGroupCode (globalNs, options, units, agroup, warnings);
					}
				}
			}
		}
Exemplo n.º 6
0
        public WidgetLibrary[] GetProjectLibraries(ProjectBackend project)
        {
            ArrayList projectLibs = new ArrayList();

            if (project != null)
            {
                projectLibs.AddRange(project.WidgetLibraries);
            }

            ArrayList list = new ArrayList();

            list.Add(Registry.CoreWidgetLibrary);
            foreach (WidgetLibrary alib in Registry.RegisteredWidgetLibraries)
            {
                if (project != null && !alib.SupportsGtkVersion(project.TargetGtkVersion))
                {
                    continue;
                }
                string aname = alib.Name;
                if (projectLibs.Contains(aname) || globalWidgetLibraries.Contains(aname))
                {
                    list.Add(alib);
                }
            }
            return((WidgetLibrary[])list.ToArray(typeof(WidgetLibrary)));
        }
Exemplo n.º 7
0
		public WidgetFactory (ProjectBackend project, ClassDescriptor klass)
		{
			this.project = project;
			this.klass = klass;
			Initialize (klass.Label, klass.Icon);
			if (project == null)
				Sensitive = false;
		}
Exemplo n.º 8
0
 public void RemoveWidgetLibrary(string assemblyPath)
 {
     reloadRequested = false;
     ProjectBackend.RemoveWidgetLibrary(assemblyPath);
     app.UpdateWidgetLibraries(false, false);
     if (!reloadRequested)
     {
         ProjectBackend.Reload();
     }
 }
 public WidgetFactory(ProjectBackend project, ClassDescriptor klass)
 {
     this.project = project;
     this.klass   = klass;
     Initialize(klass.Label, klass.Icon);
     if (project == null)
     {
         Sensitive = false;
     }
 }
Exemplo n.º 10
0
		public static ActionGroupDesignerBackend CreateActionGroupDesigner (ProjectBackend project, ActionGroupToolbar groupToolbar)
		{
			Editor.ActionGroupEditor agroupEditor = new Editor.ActionGroupEditor ();
			agroupEditor.Project = project;
			WidgetDesignerBackend groupDesign = new WidgetDesignerBackend (agroupEditor, -1, -1);
			
			groupToolbar.Bind (agroupEditor);
			
			return new ActionGroupDesignerBackend (groupDesign, agroupEditor, groupToolbar);
		}
Exemplo n.º 11
0
        public CodeGenerationResult GenerateProjectCode(GenerationOptions options, params Project[] projects)
        {
            ProjectBackend[] pbs = new ProjectBackend [projects.Length];
            for (int n = 0; n < projects.Length; n++)
            {
                pbs [n] = projects [n].ProjectBackend;
            }

            return(Backend.GenerateProjectCode(options, pbs));
        }
Exemplo n.º 12
0
        public void ConvertProject(string oldSteticFileName, string newGuiFolderName)
        {
            //ProjectBackend property when created invokes Load method which is not valid
            //for old file layout

            ProjectBackend backend = app.Backend.CreateProject();

            backend.SetFrontend(this);
            backend.ConvertProject(oldSteticFileName, newGuiFolderName);
        }
Exemplo n.º 13
0
        public static ActionGroupDesignerBackend CreateActionGroupDesigner(ProjectBackend project, ActionGroupToolbar groupToolbar)
        {
            Editor.ActionGroupEditor agroupEditor = new Editor.ActionGroupEditor();
            agroupEditor.Project = project;
            WidgetDesignerBackend groupDesign = new WidgetDesignerBackend(agroupEditor, -1, -1);

            groupToolbar.Bind(agroupEditor);

            return(new ActionGroupDesignerBackend(groupDesign, agroupEditor, groupToolbar));
        }
Exemplo n.º 14
0
 public void AddWidgetLibrary(string assemblyPath, bool isInternal)
 {
     reloadRequested = false;
     ProjectBackend.AddWidgetLibrary(assemblyPath, isInternal);
     app.UpdateWidgetLibraries(false, false);
     if (!reloadRequested)
     {
         ProjectBackend.Reload();
     }
 }
Exemplo n.º 15
0
        public WidgetEditSession(ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges)
        {
            this.frontend          = frontend;
            this.autoCommitChanges = autoCommitChanges;
            undoManager            = new ContainerUndoRedoManager();
            undoQueue             = new UndoQueue();
            undoManager.UndoQueue = undoQueue;

            sourceWidget       = windowName;
            this.sourceProject = sourceProject;

            if (!autoCommitChanges)
            {
                // Reuse the action groups and icon factory of the main project
                gproject = editingBackend;

                // Attach will prevent the destruction of the action group list by gproject
                gproject.AttachActionGroups(sourceProject.ActionGroups);

                gproject.IconFactory                 = sourceProject.IconFactory;
                gproject.FileName                    = sourceProject.FileName;
                gproject.ImagesRootPath              = sourceProject.ImagesRootPath;
                gproject.ResourceProvider            = sourceProject.ResourceProvider;
                gproject.WidgetLibraries             = (ArrayList)sourceProject.WidgetLibraries.Clone();
                gproject.InternalWidgetLibraries     = (ArrayList)sourceProject.InternalWidgetLibraries.Clone();
                gproject.TargetGtkVersion            = sourceProject.TargetGtkVersion;
                sourceProject.ComponentTypesChanged += OnSourceProjectLibsChanged;
                sourceProject.ProjectReloaded       += OnSourceProjectReloaded;

                rootWidget = editingBackend.GetTopLevelWrapper(sourceWidget, false);
                if (rootWidget == null)
                {
                    // Copy the widget to edit from the source project
                    // When saving the file, this project will be merged with the main project.
                    sourceProject.CopyWidgetToProject(windowName, gproject, windowName);
                    rootWidget = gproject.GetTopLevelWrapper(windowName, true);
                }

                gproject.Modified = false;
            }
            else
            {
                rootWidget = sourceProject.GetTopLevelWrapper(windowName, true);
                gproject   = sourceProject;
            }

            rootWidget.Select();
            undoManager.RootObject = rootWidget;

            gproject.ModifiedChanged  += new EventHandler(OnModifiedChanged);
            gproject.Changed          += new EventHandler(OnChanged);
            gproject.ProjectReloaded  += new EventHandler(OnProjectReloaded);
            gproject.ProjectReloading += new EventHandler(OnProjectReloading);
//			gproject.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
        }
Exemplo n.º 16
0
		public WidgetEditSession (ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges)
		{
			this.frontend = frontend;
			this.autoCommitChanges = autoCommitChanges;
			undoManager = new ContainerUndoRedoManager ();
			undoQueue = new UndoQueue ();
			undoManager.UndoQueue = undoQueue;
			
			sourceWidget = windowName;
			this.sourceProject = sourceProject;
			
			if (!autoCommitChanges) {
				// Reuse the action groups and icon factory of the main project
				gproject = editingBackend;
				
				// Attach will prevent the destruction of the action group list by gproject
				gproject.AttachActionGroups (sourceProject.ActionGroups);
				
				gproject.IconFactory = sourceProject.IconFactory;
				gproject.FileName = sourceProject.FileName;
				gproject.ImagesRootPath = sourceProject.ImagesRootPath;
				gproject.ResourceProvider = sourceProject.ResourceProvider;
				gproject.WidgetLibraries = (ArrayList) sourceProject.WidgetLibraries.Clone ();
				gproject.InternalWidgetLibraries = (ArrayList) sourceProject.InternalWidgetLibraries.Clone ();
				gproject.TargetGtkVersion = sourceProject.TargetGtkVersion;
				sourceProject.ComponentTypesChanged += OnSourceProjectLibsChanged;
				sourceProject.ProjectReloaded += OnSourceProjectReloaded;
				
				rootWidget = editingBackend.GetTopLevelWrapper (sourceWidget, false);
				if (rootWidget == null) {
					// Copy the widget to edit from the source project
					// When saving the file, this project will be merged with the main project.
					sourceProject.CopyWidgetToProject (windowName, gproject, windowName);
					rootWidget = gproject.GetTopLevelWrapper (windowName, true);
				}
				
				gproject.Modified = false;
			}
			else {
				rootWidget = sourceProject.GetTopLevelWrapper (windowName, true);
				gproject = sourceProject;
			}
			
			rootWidget.Select ();
			undoManager.RootObject = rootWidget;
			
			gproject.ModifiedChanged += new EventHandler (OnModifiedChanged);
			gproject.Changed += new EventHandler (OnChanged);
			gproject.ProjectReloaded += new EventHandler (OnProjectReloaded);
			gproject.ProjectReloading += new EventHandler (OnProjectReloading);
//			gproject.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
		}
Exemplo n.º 17
0
        public WidgetInfo AddNewComponent(XmlElement template)
        {
            object          ob = ProjectBackend.AddNewWidgetFromTemplate(template.OuterXml);
            WidgetComponent wc = (WidgetComponent)App.GetComponent(ob, null, null);
            WidgetInfo      wi = GetWidget(wc.Name);

            if (wi == null)
            {
                wi = new WidgetInfo(this, wc);
                widgets.Add(wi);
            }
            return(wi);
        }
Exemplo n.º 18
0
        public WidgetInfo AddNewComponent(ComponentType type, string name)
        {
            object          ob = ProjectBackend.AddNewWidget(type.Name, name);
            WidgetComponent wc = (WidgetComponent)App.GetComponent(ob, null, null);
            WidgetInfo      wi = GetWidget(wc.Name);

            if (wi == null)
            {
                wi = new WidgetInfo(this, wc);
                widgets.Add(wi);
            }
            return(wi);
        }
Exemplo n.º 19
0
        public WidgetComponent GetComponent(string name)
        {
            object ob = ProjectBackend.GetTopLevelWrapper(name, false);

            if (ob != null)
            {
                return((WidgetComponent)App.GetComponent(ob, name, null));
            }
            else
            {
                return(null);
            }
        }
		internal Project (Application app, ProjectBackend backend)
		{
			this.app = app;
			if (backend != null) {
				this.backend = backend;
				backend.SetFrontend (this);
			}

			if (app is IsolatedApplication) {
				IsolatedApplication iapp = app as IsolatedApplication;
				iapp.BackendChanging += OnBackendChanging;
				iapp.BackendChanged += OnBackendChanged;
			}
		}
Exemplo n.º 21
0
        public void CopyWidgetToProject(string name, ProjectBackend other, string replacedName)
        {
            WidgetData wdata = GetWidgetData(name);

            if (name == null)
            {
                throw new InvalidOperationException("Component not found: " + name);
            }

            XmlElement data;

            if (wdata.Widget != null)
            {
                data = Stetic.WidgetUtils.ExportWidget(wdata.Widget);
            }
            else
            {
                data = (XmlElement)wdata.XmlData.Clone();
            }

            // If widget already exist, replace it
            wdata = other.GetWidgetData(replacedName);
            if (wdata == null)
            {
                wdata = new WidgetData(name, data, null);
                other.topLevels.Add(wdata);
            }
            else
            {
                if (wdata.Widget != null)
                {
                    // If a widget instance already exist, load the new data on it
                    Wrapper.Widget sw = Wrapper.Widget.Lookup(wdata.Widget);
                    sw.Read(new ObjectReader(other, FileFormat.Native), data);
                    sw.NotifyChanged();
                    if (name != replacedName)
                    {
                        other.OnWidgetNameChanged(new Wrapper.WidgetNameChangedArgs(sw, replacedName, name), true);
                    }
                }
                else
                {
                    wdata.SetXmlData(name, data);
                    if (name != replacedName)
                    {
                        other.OnWidgetNameChanged(new Wrapper.WidgetNameChangedArgs(null, replacedName, name), true);
                    }
                }
            }
        }
Exemplo n.º 22
0
        public ProjectBackend LoadProject(string path)
        {
            ProjectBackend p = new ProjectBackend(this);

            if (System.IO.Path.GetExtension(path) == ".glade")
            {
                GladeFiles.Import(p, path);
            }
            else
            {
                p.Load(path);
            }
            return(p);
        }
		public static void GenerateProjectGuiCode (SteticCompilationUnit globalUnit, CodeNamespace globalNs, CodeTypeDeclaration globalType, GenerationOptions options, List<SteticCompilationUnit> units, ProjectBackend[] projects, ArrayList warnings)
		{
			// Generate code for each project
			foreach (ProjectBackend gp in projects) {
			
				// Generate top levels
				foreach (Gtk.Widget w in gp.Toplevels)
					GenerateWidgetCode (globalUnit, globalNs, options, units, w, warnings);
					
				// Generate global action groups
				foreach (Wrapper.ActionGroup agroup in gp.ActionGroups)
					GenerateGlobalActionGroupCode (globalUnit, globalNs, options, units, agroup, warnings);
			}
		}
Exemplo n.º 24
0
        internal Project(Application app, ProjectBackend backend)
        {
            this.app = app;
            if (backend != null)
            {
                this.backend = backend;
                backend.SetFrontend(this);
            }

            if (app is IsolatedApplication)
            {
                IsolatedApplication iapp = app as IsolatedApplication;
                iapp.BackendChanging += OnBackendChanging;
                iapp.BackendChanged  += OnBackendChanged;
            }
        }
Exemplo n.º 25
0
        public ActionGroupComponent AddNewActionGroup(XmlElement template)
        {
            object ob = ProjectBackend.AddNewActionGroupFromTemplate(template.OuterXml);
            ActionGroupComponent ac = (ActionGroupComponent)App.GetComponent(ob, null, null);

            // Don't wait for the group added event to come to update the groups list since
            // it may be too late.
            ActionGroupInfo gi = GetActionGroup(ac.Name);

            if (gi == null)
            {
                gi = new ActionGroupInfo(this, ac.Name);
                groups.Add(gi);
            }
            return(ac);
        }
Exemplo n.º 26
0
        public ActionGroupEditSession(ActionGroupDesignerFrontend frontend, ProjectBackend project, string containerName, string groupToEdit, bool autoCommitChanges)
        {
            this.groupToEdit       = groupToEdit;
            this.containerName     = containerName;
            this.frontend          = frontend;
            this.project           = project;
            this.autoCommitChanges = autoCommitChanges;

            if (groupToEdit != null)
            {
                group = project.ActionGroups [groupToEdit];
                if (group == null)
                {
                    throw new InvalidOperationException("Unknown action group: " + groupToEdit);
                }
                Load(group);
                undoManager            = new UndoRedoManager();
                undoQueue              = new UndoQueue();
                undoManager.UndoQueue  = undoQueue;
                undoManager.RootObject = groupCopy;

                groupToolbar = new ActionGroupToolbar(frontend, groupCopy);
            }
            else
            {
                if (!autoCommitChanges)
                {
                    throw new System.NotSupportedException();
                }

                Stetic.Wrapper.Container container = project.GetTopLevelWrapper(containerName, true);
                groupToolbar = new ActionGroupToolbar(frontend, container.LocalActionGroups);
            }

            // Don't delay the creation of the designer because when used in combination with the
            // widget designer, change events are subscribed since the begining

            designer = UserInterface.CreateActionGroupDesigner(project, groupToolbar);
            designer.Editor.GroupModified      += OnModified;
            designer.Toolbar.AllowActionBinding = allowActionBinding;
            designer.Destroyed += delegate
            {
                designer = null;
                Dispose();
            };
        }
Exemplo n.º 27
0
        internal ActionGroupComponent[] GetActionGroups()
        {
            Wrapper.ActionGroup[] acs = ProjectBackend.GetActionGroups();

            ArrayList comps = new ArrayList(acs.Length);

            for (int n = 0; n < acs.Length; n++)
            {
                ActionGroupComponent ag = (ActionGroupComponent)App.GetComponent(acs[n], null, null);
                if (ag != null)
                {
                    comps.Add(ag);
                }
            }

            return((ActionGroupComponent[])comps.ToArray(typeof(ActionGroupComponent)));
        }
Exemplo n.º 28
0
        internal void BeginComponentDrag(ProjectBackend project, string desc, string className, ObjectWrapper wrapper, Gtk.Widget source, Gdk.DragContext ctx, ComponentDropCallback callback)
        {
            if (wrapper != null)
            {
                Stetic.Wrapper.ActionPaletteItem it = new Stetic.Wrapper.ActionPaletteItem(Gtk.UIManagerItemType.Menuitem, null, (Wrapper.Action)wrapper);
                DND.Drag(source, ctx, it);
            }
            else if (callback != null)
            {
                DND.Drag(source, ctx, delegate()
                {
                    callback();

                    // If the class name has an assembly name, remove it now
                    int i = className.IndexOf(',');
                    if (i != -1)
                    {
                        className = className.Substring(0, i);
                    }

                    ClassDescriptor cls = Registry.LookupClassByName(className);
                    if (cls != null)
                    {
                        return(cls.NewInstance(project) as Gtk.Widget);
                    }
                    else
                    {
                        // Class not found, show an error
                        string msg            = string.Format("The widget '{0}' could not be found.", className);
                        Gtk.MessageDialog dlg = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg);
                        dlg.Run();
                        dlg.Destroy();
                        return(null);
                    }
                },
                         (desc != null && desc.Length > 0) ? desc : className
                         );
            }
            else
            {
                ClassDescriptor cls = Registry.LookupClassByName(className);
                DND.Drag(source, ctx, cls.NewInstance(project) as Gtk.Widget);
            }
        }
Exemplo n.º 29
0
        public WidgetEditSession(ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName)
        {
            this.frontend         = frontend;
            undoManager           = new ContainerUndoRedoManager();
            undoQueue             = new UndoQueue();
            undoManager.UndoQueue = undoQueue;

            sourceWidget = windowName;
            this.project = sourceProject;

            rootWidget = sourceProject.GetTopLevelWrapper(windowName, true);
            rootWidget.Select();
            undoManager.RootObject = rootWidget;

            this.project.Changed          += new ProjectChangedEventHandler(OnChanged);
            this.project.ProjectReloaded  += new EventHandler(OnProjectReloaded);
            this.project.ProjectReloading += new EventHandler(OnProjectReloading);
//			this.project.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
        }
Exemplo n.º 30
0
		public WidgetEditSession (ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName)
		{
			this.frontend = frontend;
			undoManager = new ContainerUndoRedoManager ();
			undoQueue = new UndoQueue ();
			undoManager.UndoQueue = undoQueue;
			
			sourceWidget = windowName;
			this.project = sourceProject;
						
			rootWidget = sourceProject.GetTopLevelWrapper (windowName, true);
			rootWidget.Select ();
			undoManager.RootObject = rootWidget;
			
			this.project.Changed += new ProjectChangedEventHandler (OnChanged);
			this.project.ProjectReloaded += new EventHandler (OnProjectReloaded);
			this.project.ProjectReloading += new EventHandler (OnProjectReloading);
//			this.project.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
		}
Exemplo n.º 31
0
		public static void Import (ProjectBackend project, string filename)
		{
			XmlDocument doc = new XmlDocument ();
			doc.PreserveWhitespace = true;
			doc.XmlResolver = null;
			doc.Load (filename);
			project.Id = System.IO.Path.GetFileName (filename);
			doc = GladeUtils.XslImportTransform (doc);

			XmlNode node = doc.SelectSingleNode ("/glade-interface");
			if (node == null)
				throw new ApplicationException (Catalog.GetString ("Not a glade file according to node name."));

			ObjectReader reader = new ObjectReader (project, FileFormat.Glade);
			foreach (XmlElement toplevel in node.SelectNodes ("widget")) {
				Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject (reader, toplevel, null) as Wrapper.Container;
				if (wrapper != null)
					project.AddWidget ((Gtk.Widget)wrapper.Wrapped);
			}
		}
Exemplo n.º 32
0
		public static void GenerateProjectCode (string file, CodeDomProvider provider, GenerationOptions options, ProjectBackend[] projects)
		{
			CodeGenerationResult res = GenerateProjectCode (options, projects);
			
			string basePath = Path.GetDirectoryName (file);
			
			foreach (SteticCompilationUnit unit in res.Units) {
				string fname;
				if (unit.Name.Length == 0)
					fname = file;
				else
					fname = Path.Combine (basePath, unit.Name);
				StreamWriter fileStream = new StreamWriter (fname);
				try {
					provider.GenerateCodeFromCompileUnit (unit, fileStream, new CodeGeneratorOptions ());
				} finally {
					fileStream.Close ();
				}
			}
		}
Exemplo n.º 33
0
        public void SetWidgetLibraries(string[] libraries, string[] internalLibraries)
        {
            reloadRequested = false;

            ArrayList libs = new ArrayList();

            libs.AddRange(libraries);
            libs.AddRange(internalLibraries);
            ProjectBackend.WidgetLibraries = libs;

            libs = new ArrayList();
            libs.AddRange(internalLibraries);
            ProjectBackend.InternalWidgetLibraries = libs;

            app.UpdateWidgetLibraries(false, false);
            if (!reloadRequested)
            {
                ProjectBackend.Reload();
            }
        }
Exemplo n.º 34
0
		public override void Dispose ()
		{
			Registry.RegistryChanged -= OnRegistryChanged;
			
			foreach (PaletteGroup grp in groups.Values)
				grp.Destroy ();

			if (localActionsBox != null) {
				localActionsBox.Destroy ();
				localActionsBox = null;
			}
			if (globalActionsBox != null) {
				globalActionsBox.Destroy ();
				globalActionsBox = null;
			}
			
			project = null;
			selection = null;
			base.Dispose ();
		}
Exemplo n.º 35
0
        public ComponentType[] GetComponentTypes()
        {
            ArrayList types = new ArrayList();

            ArrayList typeNames = ProjectBackend.GetComponentTypes();

            for (int n = 0; n < typeNames.Count; n++)
            {
                types.Add(app.GetComponentType((string)typeNames [n]));
            }

            // Global action groups
            foreach (ActionGroupComponent grp in GetActionGroups())
            {
                foreach (ActionComponent ac in grp.GetActions())
                {
                    types.Add(new ComponentType(app, ac));
                }
            }

            return((ComponentType[])types.ToArray(typeof(ComponentType)));
        }
Exemplo n.º 36
0
        void OnBackendChanged(ApplicationBackend oldBackend)
        {
            if (oldBackend != null)
            {
                tmpProjectFile = Path.GetTempFileName();
                backend.Save(tmpProjectFile);
                backend.Dispose();
            }

            backend = app.Backend.CreateProject();
            backend.SetFrontend(this);

            if (tmpProjectFile != null && File.Exists(tmpProjectFile))
            {
//				backend.Load (tmpProjectFile, fileName);
                throw new NotImplementedException("OnBackendChanged");
                File.Delete(tmpProjectFile);
                tmpProjectFile = null;
            }
            else if (folderName != null)
            {
                backend.Load(folderName);
            }

            if (resourceProvider != null)
            {
                backend.ResourceProvider = resourceProvider;
            }

            if (BackendChanged != null)
            {
                BackendChanged(oldBackend);
            }

            if (ProjectReloaded != null)
            {
                ProjectReloaded(this, EventArgs.Empty);
            }
        }
Exemplo n.º 37
0
		public ActionGroupEditSession (ActionGroupDesignerFrontend frontend, ProjectBackend project, string containerName, string groupToEdit, bool autoCommitChanges)
		{
			this.groupToEdit = groupToEdit;
			this.containerName = containerName;
			this.frontend = frontend;
			this.project = project;
			this.autoCommitChanges = autoCommitChanges;
			
			if (groupToEdit != null) {
				group = project.ActionGroups [groupToEdit];
				if (group == null)
					throw new InvalidOperationException ("Unknown action group: " + groupToEdit);
				Load (group);
				undoManager = new UndoRedoManager ();
				undoQueue = new UndoQueue ();
				undoManager.UndoQueue = undoQueue;
				undoManager.RootObject = groupCopy;
				
				groupToolbar = new ActionGroupToolbar (frontend, groupCopy);
			}
			else {
				if (!autoCommitChanges)
					throw new System.NotSupportedException ();
				
				Stetic.Wrapper.Container container = project.GetTopLevelWrapper (containerName, true);
				groupToolbar = new ActionGroupToolbar (frontend, container.LocalActionGroups);
			}
			
			// Don't delay the creation of the designer because when used in combination with the
			// widget designer, change events are subscribed since the begining
			
			designer = UserInterface.CreateActionGroupDesigner (project, groupToolbar);
			designer.Editor.GroupModified += OnModified;
			designer.Toolbar.AllowActionBinding = allowActionBinding;
			designer.Destroyed += delegate { designer = null; Dispose (); };
		}
        public override void Dispose()
        {
            Registry.RegistryChanged -= OnRegistryChanged;

            foreach (PaletteGroup grp in groups.Values)
            {
                grp.Destroy();
            }

            if (localActionsBox != null)
            {
                localActionsBox.Destroy();
                localActionsBox = null;
            }
            if (globalActionsBox != null)
            {
                globalActionsBox.Destroy();
                globalActionsBox = null;
            }

            project   = null;
            selection = null;
            base.Dispose();
        }
 public PaletteBackend(ApplicationBackend app, ProjectBackend project) : this(app)
 {
     this.ProjectBackend = project;
 }
        public void LoadWidgets(ProjectBackend project)
        {
            if (project == null)
            {
                box.Hide();
                return;
            }

            box.Show();

            foreach (PaletteGroup g in groups.Values)
            {
                box.Remove(g);
                g.Destroy();
            }

            groups.Clear();

            foreach (string[] grp in visibleGroups)
            {
                AddOrGetGroup(grp[0], grp[1]);
            }

            ArrayList classes = new ArrayList();

            if (libraries == null)
            {
                foreach (ClassDescriptor klass in Registry.AllClasses)
                {
                    if (klass.SupportsGtkVersion(project.TargetGtkVersion))
                    {
                        classes.Add(klass);
                    }
                }
            }
            else if (project != null)
            {
                foreach (WidgetLibrary lib in libraries)
                {
                    bool isInternalLib = project.IsInternalLibrary(lib.Name);
                    foreach (ClassDescriptor cd in lib.AllClasses)
                    {
                        if (!cd.Deprecated && cd.Category.Length > 0 && (isInternalLib || !cd.IsInternal) && cd.SupportsGtkVersion(project.TargetGtkVersion))
                        {
                            classes.Add(cd);
                        }
                    }
                }
            }

            classes.Sort(this);

            foreach (ClassDescriptor klass in classes)
            {
                if (!groups.Contains(klass.Category))
                {
                    continue;
                }

                WidgetFactory factory;
                if (klass.Category == "window")
                {
                    factory = new WindowFactory(project, klass);
                }
                else
                {
                    factory = new WidgetFactory(project, klass);
                }

                AddOrGetGroup(klass.Category).Append(factory);
            }

            if (localActionsBox != null)
            {
                localActionsBox.Destroy();
            }
            if (globalActionsBox != null)
            {
                globalActionsBox.Destroy();
            }

            PaletteGroup widgetGroup = AddOrGetGroup("actions", Catalog.GetString("Actions"));

            localActionsBox  = new ActionGroupBox();
            globalActionsBox = new ActionGroupBox();
            widgetGroup.Append(localActionsBox);
            widgetGroup.Append(globalActionsBox);

            if (project != null)
            {
                widgetGroup.Sensitive = true;
                localActionsBox.SetActionGroups(selection != null ? selection.LocalActionGroups : null);
                globalActionsBox.SetActionGroups(project.ActionGroups);
            }
            else
            {
                widgetGroup.Sensitive = false;
                localActionsBox.SetActionGroups(null);
                globalActionsBox.SetActionGroups(null);
            }

            // This is a workaround. In looks like the palette is not correctly
            // redrawn if it is rebuilt while it is not visible (the dock is hidden in MD).
            GLib.Idle.Add(delegate
            {
                ShowAll();
                return(false);
            });
        }
Exemplo n.º 41
0
		public ProjectBackend LoadProject (string path)
		{
			ProjectBackend p = new ProjectBackend (this);
			
			if (System.IO.Path.GetExtension (path) == ".glade") {
				GladeFiles.Import (p, path);
			} else {
				p.Load (path);
			}
			return p;
		}
Exemplo n.º 42
0
		void OnBackendChanged (ApplicationBackend oldBackend)
		{
			if (oldBackend != null) {
				tmpProjectFile = Path.GetTempFileName ();
				backend.Save (tmpProjectFile);
				backend.Dispose ();
			}
			
			backend = app.Backend.CreateProject ();
			backend.SetFrontend (this);

			if (tmpProjectFile != null && File.Exists (tmpProjectFile)) {
//				backend.Load (tmpProjectFile, fileName);
				throw new NotImplementedException ("OnBackendChanged");
				File.Delete (tmpProjectFile);
				tmpProjectFile = null;
			} else if (folderName != null) {
				backend.Load (folderName);
			}

			if (resourceProvider != null)
				backend.ResourceProvider = resourceProvider;

			if (BackendChanged != null)
				BackendChanged (oldBackend);
				
			if (ProjectReloaded != null)
				ProjectReloaded (this, EventArgs.Empty);
		}
Exemplo n.º 43
0
		public CodeGenerationResult GenerateProjectCode (GenerationOptions options, params Project[] projects)
		{
			ProjectBackend[] pbs = new ProjectBackend [projects.Length];
			for (int n=0; n<projects.Length; n++)
				pbs [n] = projects [n].ProjectBackend;
				
			return Backend.GenerateProjectCode (options, pbs);
		}
Exemplo n.º 44
0
		internal void BeginComponentDrag (ProjectBackend project, string desc, string className, ObjectWrapper wrapper, Gtk.Widget source, Gdk.DragContext ctx, ComponentDropCallback callback)
		{
			if (wrapper != null) {
				Stetic.Wrapper.ActionPaletteItem it = new Stetic.Wrapper.ActionPaletteItem (Gtk.UIManagerItemType.Menuitem, null, (Wrapper.Action) wrapper);
				DND.Drag (source, ctx, it);
			}
			else if (callback != null) {
				DND.Drag (source, ctx, delegate () {
					callback ();
					
					// If the class name has an assembly name, remove it now
					int i = className.IndexOf (',');
					if (i != -1)
						className = className.Substring (0, i);
					
					ClassDescriptor cls = Registry.LookupClassByName (className);
					if (cls != null)
						return cls.NewInstance (project) as Gtk.Widget;
					else {
						// Class not found, show an error
						string msg = string.Format ("The widget '{0}' could not be found.", className);
						Gtk.MessageDialog dlg = new Gtk.MessageDialog (null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg);
						dlg.Run ();
						dlg.Destroy ();
						return null;
					}
				},
				(desc != null && desc.Length > 0) ? desc : className
				);
			}
			else {
				ClassDescriptor cls = Registry.LookupClassByName (className);
				DND.Drag (source, ctx, cls.NewInstance (project) as Gtk.Widget);
			}
		}
Exemplo n.º 45
0
		public WidgetLibrary[] GetProjectLibraries (ProjectBackend project)
		{
			ArrayList projectLibs = new ArrayList ();
			if (project != null)
				projectLibs.AddRange (project.WidgetLibraries);
				
			ArrayList list = new ArrayList ();
			list.Add (Registry.CoreWidgetLibrary);
			foreach (WidgetLibrary alib in Registry.RegisteredWidgetLibraries) {
				if (project != null && !alib.SupportsGtkVersion (project.TargetGtkVersion))
					continue;
				string aname = alib.Name;
				if (projectLibs.Contains (aname) || globalWidgetLibraries.Contains (aname))
					list.Add (alib);
			}
			return (WidgetLibrary[]) list.ToArray (typeof(WidgetLibrary));
		}
 public WindowFactory(ProjectBackend project, ClassDescriptor klass) : base(project, klass)
 {
 }
Exemplo n.º 47
0
 public SignalsEditorBackend(SignalsEditorFrontend frontend, ProjectBackend project) : this(frontend)
 {
     ProjectBackend = project;
 }
Exemplo n.º 48
0
		public WindowFactory (ProjectBackend project, ClassDescriptor klass) : base (project, klass) 
		{
		}
Exemplo n.º 49
0
		public static CodeGenerationResult GenerateProjectCode (GenerationOptions options, ProjectBackend[] projects)
		{
			ArrayList warningList = new ArrayList ();
			
			List<SteticCompilationUnit> units = new List<SteticCompilationUnit> ();
			SteticCompilationUnit globalUnit = new SteticCompilationUnit ("");
			units.Add (globalUnit);
			
			if (options == null)
				options = new GenerationOptions ();
			CodeNamespace globalNs = new CodeNamespace (options.GlobalNamespace);
			globalUnit.Namespaces.Add (globalNs);
			
			// Global class
			
			CodeTypeDeclaration globalType = new CodeTypeDeclaration ("Gui");
			globalType.Attributes = MemberAttributes.Private;
			globalType.TypeAttributes = TypeAttributes.NestedAssembly;
			globalNs.Types.Add (globalType);
			
			// Create the project initialization method
			// This method will only be added at the end if there
			// is actually something to initialize
			
			CodeMemberMethod initMethod = new CodeMemberMethod ();
			initMethod.Name = "Initialize";
			initMethod.ReturnType = new CodeTypeReference (typeof(void));
			initMethod.Attributes = MemberAttributes.Assembly | MemberAttributes.Static;
			initMethod.Parameters.Add (new CodeParameterDeclarationExpression (typeof(Gtk.Widget), "iconRenderer"));
			
			GeneratorContext initContext = new ProjectGeneratorContext (globalNs, globalType, initMethod.Statements, options);
			initContext.RootObject = new CodeArgumentReferenceExpression ("iconRenderer");
			
			// Generate icon factory creation

			foreach (ProjectBackend gp in projects) {
				if (gp.IconFactory.Icons.Count > 0)
					gp.IconFactory.GenerateBuildCode (initContext);
			}
			warningList.AddRange (initContext.Warnings);
					
			// Generate the code
			
			if (options.UsePartialClasses)
				CodeGeneratorPartialClass.GenerateProjectGuiCode (globalUnit, globalNs, globalType, options, units, projects, warningList);
			else
				CodeGeneratorInternalClass.GenerateProjectGuiCode (globalUnit, globalNs, globalType, options, units, projects, warningList);

			GenerateProjectActionsCode (globalNs, options, projects);
			
			// Final step. If there is some initialization code, add all needed infrastructure
			
			globalType.Members.Add (initMethod);
			
			CodeMemberField initField = new CodeMemberField (typeof(bool), "initialized");
			initField.Attributes = MemberAttributes.Private | MemberAttributes.Static;
			globalType.Members.Add (initField);
			
			CodeFieldReferenceExpression initVar = new CodeFieldReferenceExpression (
				new CodeTypeReferenceExpression (globalNs.Name + ".Gui"),
				"initialized"
			);
			
			CodeConditionStatement initCondition = new CodeConditionStatement ();
			initCondition.Condition = new CodeBinaryOperatorExpression (
				initVar, 
				CodeBinaryOperatorType.IdentityEquality,
				new CodePrimitiveExpression (false)
			);
			initCondition.TrueStatements.Add (new CodeAssignStatement (
				initVar,
				new CodePrimitiveExpression (true)
			));
			initCondition.TrueStatements.AddRange (initMethod.Statements);
			initMethod.Statements.Clear ();
			initMethod.Statements.Add (initCondition);
			
			return new CodeGenerationResult (units.ToArray (), (string[]) warningList.ToArray (typeof(string)));
		}
Exemplo n.º 50
0
		public CodeGenerationResult GenerateProjectCode (GenerationOptions options, ProjectBackend[] projects)
		{
			return CodeGenerator.GenerateProjectCode (options, projects);
		}
Exemplo n.º 51
0
		public void CopyWidgetToProject (string name, ProjectBackend other, string replacedName)
		{
			WidgetData wdata = GetWidgetData (name);
			if (name == null)
				throw new InvalidOperationException ("Component not found: " + name);
			
			XmlElement data;
			if (wdata.Widget != null)
				data = Stetic.WidgetUtils.ExportWidget (wdata.Widget);
			else
				data = (XmlElement) wdata.XmlData.Clone ();
			
			// If widget already exist, replace it
			wdata = other.GetWidgetData (replacedName);
			if (wdata == null) {
				wdata = new WidgetData (name, data, null);
				other.topLevels.Add (wdata);
			} else {
				if (wdata.Widget != null) {
					// If a widget instance already exist, load the new data on it
					Wrapper.Widget sw = Wrapper.Widget.Lookup (wdata.Widget);
					sw.Read (new ObjectReader (other, FileFormat.Native), data);
					sw.NotifyChanged ();
					if (name != replacedName)
						other.OnWidgetNameChanged (new Wrapper.WidgetNameChangedArgs (sw, replacedName, name), true);
				} else {
					wdata.SetXmlData (name, data);
					if (name != replacedName)
						other.OnWidgetNameChanged (new Wrapper.WidgetNameChangedArgs (null, replacedName, name), true);
				}
			}
		}
Exemplo n.º 52
0
        public static void GenerateProjectGuiCode(SteticCompilationUnit globalUnit, CodeNamespace globalNs, CodeTypeDeclaration globalType, GenerationOptions options, List<SteticCompilationUnit> units, ProjectBackend[] projects, ArrayList warnings)
        {
            bool multiProject = projects.Length > 1;

            // Build method overload that takes a type as parameter.

            CodeMemberMethod met = new CodeMemberMethod ();
            met.Name = "Build";
            globalType.Members.Add (met);
            met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(object), "cobj"));
            met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(Type), "type"));
            if (multiProject)
                met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(string), "file"));
            met.ReturnType = new CodeTypeReference (typeof(void));
            met.Attributes = MemberAttributes.Public | MemberAttributes.Static;

            CodeMethodInvokeExpression call = new CodeMethodInvokeExpression (
                    new CodeMethodReferenceExpression (
                        new CodeTypeReferenceExpression (globalNs.Name + ".Gui"),
                        "Build"
                    ),
                    new CodeArgumentReferenceExpression ("cobj"),
                    new CodePropertyReferenceExpression (
                        new CodeArgumentReferenceExpression ("type"),
                        "FullName"
                    )
            );
            if (multiProject)
                call.Parameters.Add (new CodeArgumentReferenceExpression ("file"));

            met.Statements.Add (call);

            // Generate the build method

            met = new CodeMemberMethod ();
            met.Name = "Build";
            globalType.Members.Add (met);

            met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(object), "cobj"));
            met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(string), "id"));
            if (multiProject)
                met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(string), "file"));
            met.ReturnType = new CodeTypeReference (typeof(void));
            met.Attributes = MemberAttributes.Public | MemberAttributes.Static;

            if (options.GenerateEmptyBuildMethod)
                return;

            CodeArgumentReferenceExpression cobj = new CodeArgumentReferenceExpression ("cobj");
            CodeArgumentReferenceExpression cfile = new CodeArgumentReferenceExpression ("file");
            CodeArgumentReferenceExpression cid = new CodeArgumentReferenceExpression ("id");

            CodeStatementCollection projectCol = met.Statements;

            CodeConditionStatement tcond = new CodeConditionStatement ();
            tcond.Condition = new CodeMethodInvokeExpression (new CodeTypeOfExpression (typeof(Gtk.Widget)), "IsAssignableFrom", cobj);

            tcond.TrueStatements.Add (
                    new CodeMethodInvokeExpression (
                        new CodeTypeReferenceExpression (globalNs.Name + ".Gui"),
                        "Initialize",
                        cobj
                    )
            );

            // Generate code for each project

            foreach (ProjectBackend gp in projects) {

                CodeStatementCollection widgetCol;

                if (multiProject) {
                    CodeConditionStatement pcond = new CodeConditionStatement ();
                    pcond.Condition = new CodeBinaryOperatorExpression (
                        cfile,
                        CodeBinaryOperatorType.IdentityEquality,
                        new CodePrimitiveExpression (gp.Id)
                    );
                    projectCol.Add (pcond);

                    widgetCol = pcond.TrueStatements;
                    projectCol = pcond.FalseStatements;
                } else {
                    widgetCol = projectCol;
                }

                // Generate top levels

                CodeIdentifiers ids = new CodeIdentifiers ();

                foreach (Gtk.Widget w in gp.Toplevels) {
                    CodeConditionStatement cond = new CodeConditionStatement ();
                    cond.Condition = new CodeBinaryOperatorExpression (
                        cid,
                        CodeBinaryOperatorType.IdentityEquality,
                        new CodePrimitiveExpression (w.Name)
                    );
                    widgetCol.Add (cond);

                    GenerateComponentCode (w, globalUnit, globalNs, cobj, cond.TrueStatements, globalType, options, units, ids, warnings);

                    widgetCol = cond.FalseStatements;
                }

                // Generate action groups

                foreach (Wrapper.ActionGroup agroup in gp.ActionGroups) {
                    CodeConditionStatement cond = new CodeConditionStatement ();
                    cond.Condition = new CodeBinaryOperatorExpression (
                        cid,
                        CodeBinaryOperatorType.IdentityEquality,
                        new CodePrimitiveExpression (agroup.Name)
                    );
                    widgetCol.Add (cond);

                    GenerateComponentCode (agroup, globalUnit, globalNs, cobj, cond.TrueStatements, globalType, options, units, ids, warnings);

                    widgetCol = cond.FalseStatements;
                }
            }
        }
Exemplo n.º 53
0
		public void LoadWidgets (ProjectBackend project)
		{
			if (project == null) {
				box.Hide ();
				return;
			}
			
			box.Show ();
			
			foreach (PaletteGroup g in groups.Values) {
				box.Remove (g);
				g.Destroy ();
			}
				
			groups.Clear ();
			
			foreach (string[] grp in visibleGroups)
				AddOrGetGroup (grp[0], grp[1]);

			ArrayList classes = new ArrayList ();
			if (libraries == null) {
				foreach (ClassDescriptor klass in Registry.AllClasses)
					if (klass.SupportsGtkVersion (project.TargetGtkVersion))
					    classes.Add (klass);
			} else if (project != null) {
				foreach (WidgetLibrary lib in libraries) {
					bool isInternalLib = project.IsInternalLibrary (lib.Name);
					foreach (ClassDescriptor cd in lib.AllClasses) {
						if (!cd.Deprecated && cd.Category.Length > 0 && (isInternalLib || !cd.IsInternal) && cd.SupportsGtkVersion (project.TargetGtkVersion))
							classes.Add (cd);
					}
				}
			}
			
			classes.Sort (this);

			foreach (ClassDescriptor klass in classes) {

				if (!groups.Contains (klass.Category))
					continue;
					
				WidgetFactory factory;
				if (klass.Category == "window")
					factory = new WindowFactory (project, klass);
				else
					factory = new WidgetFactory (project, klass);

				AddOrGetGroup(klass.Category).Append (factory);
			}

			if (localActionsBox != null)
				localActionsBox.Destroy ();
			if (globalActionsBox != null)
				globalActionsBox.Destroy ();
				
			PaletteGroup widgetGroup = AddOrGetGroup ("actions", Catalog.GetString ("Actions"));
			localActionsBox = new ActionGroupBox ();
			globalActionsBox = new ActionGroupBox ();
			widgetGroup.Append (localActionsBox);
			widgetGroup.Append (globalActionsBox);
			
			if (project != null) {
				widgetGroup.Sensitive = true;
				localActionsBox.SetActionGroups (selection != null ? selection.LocalActionGroups : null);
				globalActionsBox.SetActionGroups (project.ActionGroups);
			} else {
				widgetGroup.Sensitive = false;
				localActionsBox.SetActionGroups (null);
				globalActionsBox.SetActionGroups (null);
			}
			
			// This is a workaround. In looks like the palette is not correctly
			// redrawn if it is rebuilt while it is not visible (the dock is hidden in MD).
			GLib.Idle.Add (delegate {
				ShowAll ();
				return false;
			});
		}
Exemplo n.º 54
0
		public PaletteBackend (ApplicationBackend app, ProjectBackend project): this (app)
		{
			this.ProjectBackend = project;
		}
		public SignalsEditorBackend (SignalsEditorFrontend frontend, ProjectBackend project): this (frontend)
		{
			ProjectBackend = project;
		}
Exemplo n.º 56
0
		public PropertyGrid (ProjectBackend project): this ()
		{
			this.ProjectBackend = project;
		}