Inheritance: ProjectItemInfo
Exemplo n.º 1
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.º 2
0
        internal void NotifyWidgetNameChanged(object obj, string oldName, string newName, bool isRoot)
        {
            WidgetComponent c = obj != null ? (WidgetComponent)App.GetComponent(obj, null, null) : null;

            if (c != null)
            {
                c.UpdateName(newName);
            }

            if (isRoot)
            {
                WidgetInfo wi = GetWidget(oldName);
                if (wi != null)
                {
                    wi.NotifyNameChanged(newName);
                }
            }

            GuiDispatch.InvokeSync(
                delegate {
                if (c != null)
                {
                    if (ComponentNameChanged != null)
                    {
                        ComponentNameChanged(this, new ComponentNameEventArgs(this, c, oldName));
                    }
                }
            }
                );
        }
Exemplo n.º 3
0
        static void OnProjectReloaded(object sender, EventArgs a)
        {
            if (WidgetNotebook.Page == -1)
            {
                return;
            }

            // Get the opened components

            int       active = WidgetNotebook.Page;
            ArrayList pages  = new ArrayList();

            while (WidgetNotebook.NPages > 0)
            {
                DesignerView view = (DesignerView)WidgetNotebook.GetNthPage(0);
                pages.Add(view.Component.Name);
                WidgetNotebook.Remove(view);
                view.Dispose();
            }
            openWindows.Clear();

            // Reopen the components
            foreach (string s in pages)
            {
                WidgetInfo w = Project.GetWidget(s);
                if (w != null)
                {
                    OpenWindow(w);
                }
            }
            WidgetNotebook.Page = active;
        }
Exemplo n.º 4
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.º 5
0
        static void OnSelectionChanged(object s, ComponentEventArgs args)
        {
            if (args.Component == null)
            {
                return;
            }
            WidgetInfo wi = Project.GetWidget(args.Component.Name);

            if (wi != null && IsWindowOpen(wi))
            {
                OpenWindow(wi);
            }
        }
Exemplo n.º 6
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.º 7
0
 internal void NotifyWidgetRemoved(string name)
 {
     GuiDispatch.InvokeSync(
         delegate {
         WidgetInfo wi = GetWidget(name);
         if (wi != null)
         {
             widgets.Remove(wi);
             if (WidgetRemoved != null)
             {
                 WidgetRemoved(this, new WidgetInfoEventArgs(this, wi));
             }
         }
     }
         );
 }
Exemplo n.º 8
0
 static void CloseWindow(WidgetInfo widget)
 {
     if (widget != null)
     {
         Gtk.Widget page = (Gtk.Widget)openWindows [widget];
         if (page != null)
         {
             WidgetNotebook.Remove(page);
             openWindows.Remove(widget);
             page.Dispose();
             if (openWindows.Count == 0)
             {
                 SteticApp.ActiveDesigner = null;
             }
         }
     }
 }
Exemplo n.º 9
0
        public DesignerView(Stetic.Project project, ProjectItemInfo item)
        {
            this.widget = (WidgetInfo)item;

            // Widget design tab

            design = project.CreateWidgetDesigner(widget, true);

            // Actions design tab

            actionbox = design.CreateActionGroupDesigner();

            // Designers tab

            AppendPage(design, new Gtk.Label(Catalog.GetString("Designer")));
            AppendPage(actionbox, new Gtk.Label(Catalog.GetString("Actions")));
            TabPos = Gtk.PositionType.Bottom;
        }
Exemplo n.º 10
0
        public DesignerView(Stetic.Project project, ProjectItemInfo item)
        {
            this.widget = (WidgetInfo) item;

            // Widget design tab

            design = project.CreateWidgetDesigner (widget, true);

            // Actions design tab

            actionbox = design.CreateActionGroupDesigner ();

            // Designers tab

            AppendPage (design, new Gtk.Label (Catalog.GetString ("Designer")));
            AppendPage (actionbox, new Gtk.Label (Catalog.GetString ("Actions")));
            TabPos = Gtk.PositionType.Bottom;
        }
Exemplo n.º 11
0
 internal void NotifyWidgetAdded(object obj, string name, string typeName)
 {
     GuiDispatch.InvokeSync(
         delegate {
         Component c = App.GetComponent(obj, name, typeName);
         if (c != null)
         {
             WidgetInfo wi = GetWidget(c.Name);
             if (wi == null)
             {
                 wi = new WidgetInfo(this, c);
                 widgets.Add(wi);
             }
             if (WidgetAdded != null)
             {
                 WidgetAdded(this, new WidgetInfoEventArgs(this, wi));
             }
         }
     }
         );
 }
Exemplo n.º 12
0
        void ReadWidget(XmlTextReader reader)
        {
            WidgetInfo w = new WidgetInfo(this, reader.GetAttribute("id"), reader.GetAttribute("class"));

            widgets.Add(w);
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }
            reader.ReadStartElement();
            reader.MoveToContent();
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "action-group")
                {
                    w.AddGroup(reader.GetAttribute("name"));
                }
                reader.Skip();
                reader.MoveToContent();
            }
            reader.ReadEndElement();
        }
Exemplo n.º 13
0
		internal void NotifyWidgetAdded (object obj, string name, string typeName)
		{
			GuiDispatch.InvokeSync (
				delegate {
					Component c = App.GetComponent (obj, name, typeName);
					if (c != null) {
						WidgetInfo wi = GetWidget (c.Name);
						if (wi == null) {
							wi = new WidgetInfo (this, c);
							widgets.Add (wi);
						}
						if (WidgetAdded != null)
							WidgetAdded (this, new WidgetInfoEventArgs (this, wi));
					}
				}
			);
		}
Exemplo n.º 14
0
		public void RemoveComponent (WidgetInfo component)
		{
			ProjectBackend.RemoveWidget (component.Name);
		}
Exemplo n.º 15
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.º 16
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.º 17
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.º 18
0
//		public WidgetDesigner CreateWidgetDesigner (WidgetInfo widgetInfo, bool autoCommitChanges)
//		{
//			return new WidgetDesigner (this, widgetInfo.Name, autoCommitChanges);
//		}
		
		public WidgetDesigner CreateWidgetDesigner (WidgetInfo widgetInfo)
		{
			return new WidgetDesigner (this, widgetInfo.Name);
		}
Exemplo n.º 19
0
		void ReadWidget (XmlTextReader reader)
		{
			WidgetInfo w = new WidgetInfo (this, reader.GetAttribute ("id"), reader.GetAttribute ("class"));
			widgets.Add (w);
			if (reader.IsEmptyElement) {
				reader.Skip ();
				return;
			}
			reader.ReadStartElement ();
			reader.MoveToContent ();
			while (reader.NodeType != XmlNodeType.EndElement) {
				if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "action-group") {
					w.AddGroup (reader.GetAttribute ("name"));
				}
				reader.Skip ();
				reader.MoveToContent ();
			}
			reader.ReadEndElement ();
		}
		public WidgetDesigner CreateWidgetDesigner (WidgetInfo widgetInfo, bool autoCommitChanges)
		{
			return new WidgetDesigner (this, widgetInfo.Name, autoCommitChanges);
		}
Exemplo n.º 21
0
 internal WidgetInfoEventArgs(Project p, WidgetInfo w)
 {
     project = p;
     widget  = w;
 }
Exemplo n.º 22
0
 static bool IsWindowOpen(WidgetInfo component)
 {
     Gtk.Widget w = openWindows [component] as Gtk.Widget;
     return(w != null && w.Visible);
 }
Exemplo n.º 23
0
 static void CloseWindow(WidgetInfo widget)
 {
     if (widget != null) {
         Gtk.Widget page = (Gtk.Widget) openWindows [widget];
         if (page != null) {
             WidgetNotebook.Remove (page);
             openWindows.Remove (widget);
             page.Dispose ();
             if (openWindows.Count == 0)
                 SteticApp.ActiveDesigner = null;
         }
     }
 }
Exemplo n.º 24
0
 public void RemoveComponent(WidgetInfo component)
 {
     ProjectBackend.RemoveWidget(component.Name);
 }
Exemplo n.º 25
0
 public WidgetDesigner CreateWidgetDesigner(WidgetInfo widgetInfo, bool autoCommitChanges)
 {
     return(new WidgetDesigner(this, widgetInfo.Name, autoCommitChanges));
 }
Exemplo n.º 26
0
 static bool IsWindowOpen(WidgetInfo component)
 {
     Gtk.Widget w = openWindows [component] as Gtk.Widget;
     return w != null && w.Visible;
 }
Exemplo n.º 27
0
//		public WidgetDesigner CreateWidgetDesigner (WidgetInfo widgetInfo, bool autoCommitChanges)
//		{
//			return new WidgetDesigner (this, widgetInfo.Name, autoCommitChanges);
//		}

        public WidgetDesigner CreateWidgetDesigner(WidgetInfo widgetInfo)
        {
            return(new WidgetDesigner(this, widgetInfo.Name));
        }