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); }
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)); } } } ); }
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; }
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); }
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); } }
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); }
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)); } } } ); }
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; } } } }
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; }
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; }
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)); } } } ); }
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(); }
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)); } } ); }
public void RemoveComponent (WidgetInfo component) { ProjectBackend.RemoveWidget (component.Name); }
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; }
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; }
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; }
// 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); }
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); }
internal WidgetInfoEventArgs(Project p, WidgetInfo w) { project = p; widget = w; }
static bool IsWindowOpen(WidgetInfo component) { Gtk.Widget w = openWindows [component] as Gtk.Widget; return(w != null && w.Visible); }
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; } } }
public void RemoveComponent(WidgetInfo component) { ProjectBackend.RemoveWidget(component.Name); }
public WidgetDesigner CreateWidgetDesigner(WidgetInfo widgetInfo, bool autoCommitChanges) { return(new WidgetDesigner(this, widgetInfo.Name, autoCommitChanges)); }
static bool IsWindowOpen(WidgetInfo component) { Gtk.Widget w = openWindows [component] as Gtk.Widget; return w != null && w.Visible; }
// 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)); }