public CecilPropertyDescriptor (CecilWidgetLibrary lib, XmlElement elem, Stetic.ItemGroup group, Stetic.ClassDescriptor klass, PropertyDefinition pinfo): base (elem, group, klass) { string tname; if (pinfo != null) { name = pinfo.Name; tname = pinfo.PropertyType.FullName; canWrite = pinfo.SetMethod != null; } else { name = elem.GetAttribute ("name"); tname = elem.GetAttribute ("type"); canWrite = elem.Attributes ["canWrite"] == null; } Load (elem); type = Stetic.Registry.GetType (tname, false); if (type == null) { Console.WriteLine ("Could not find type: " + tname); type = typeof(string); } if (type.IsValueType) initialValue = Activator.CreateInstance (type); // Consider all properties runtime-properties, since they have been created // from class properties. isRuntimeProperty = true; if (pinfo != null) SaveCecilXml (elem); }
internal GuiBuilderWindow (GuiBuilderProject fproject, Stetic.Project gproject, Stetic.WidgetInfo rootWidget) { this.fproject = fproject; this.rootWidget = rootWidget; this.gproject = gproject; name = rootWidget.Name; gproject.ProjectReloaded += OnProjectReloaded; rootWidget.Changed += OnChanged; }
public CodeBinder (Project project, ITextFileProvider textFileProvider, Stetic.Component targetObject) { this.project = project; this.textFileProvider = textFileProvider; gproject = GtkDesignInfo.FromProject (project).GuiBuilderProject; TargetObject = targetObject; }
public EditIconFactoryDialog (Gtk.Window parent, Stetic.IProject project, ProjectIconFactory iconFactory) { this.iconFactory = iconFactory; this.parent = parent; this.project = project; Glade.XML xml = new Glade.XML (null, "stetic.glade", "EditIconFactoryDialog", null); xml.Autoconnect (this); customIconList = new ProjectIconList (project, iconFactory); iconListScrolledwindow.AddWithViewport (customIconList); }
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); }
public CecilPropertyDescriptor (XmlElement elem, Stetic.ItemGroup group, Stetic.ClassDescriptor klass, PropertyDescriptor prop): base (elem, group, klass) { this.name = prop.Name; this.type = prop.PropertyType; this.canWrite = prop.CanWrite; if (type.IsValueType) initialValue = Activator.CreateInstance (type); this.label = prop.Label; this.description = prop.Description; this.maximum = prop.Maximum; this.minimum = prop.Minimum; this.initWithName = prop.InitWithName; this.translatable = prop.Translatable; }
void FillWidgets (Stetic.Wrapper.Widget widget, int level) { if (!widget.Unselectable) { TreeIter iter = store.AppendValues (widget.ClassDescriptor.Icon, widget.Wrapped.Name); widgets [widget.Wrapped.Name] = iter; } Gtk.Container cont = widget.Wrapped as Gtk.Container; if (cont != null && widget.ClassDescriptor.AllowChildren) { foreach (Gtk.Widget child in cont.AllChildren) { Stetic.Wrapper.Widget cwidget = Stetic.Wrapper.Widget.Lookup (child); if (cwidget != null) FillWidgets (cwidget, level+1); } } }
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; }
void BuildContextMenu (Stetic.Wrapper.Widget parentWrapper, bool top, Widget context) { MenuItem item; item = new ImageMenuItem (Gtk.Stock.Cut, null); if (editable.CanCut) item.Activated += DoCut; else item.Sensitive = false; Add (item); item = new ImageMenuItem (Gtk.Stock.Copy, null); if (editable.CanCopy) item.Activated += DoCopy; else item.Sensitive = false; Add (item); item = new ImageMenuItem (Gtk.Stock.Paste, null); if (editable.CanPaste) item.Activated += DoPaste; else item.Sensitive = false; Add (item); if (editable.CanDelete) { item = new ImageMenuItem (Gtk.Stock.Delete, null); item.Activated += DoDelete; Add (item); } if (top) { for (; parentWrapper != null; parentWrapper = parentWrapper.ParentWrapper) { Add (new SeparatorMenuItem ()); item = LabelItem (parentWrapper.Wrapped); item.Submenu = new ContextMenu (parentWrapper, context); Add (item); } } ShowAll (); }
public ConfirmWindowDeleteDialog (string windowName, string fileName, Stetic.ProjectItemInfo obj) { XML glade = new XML (null, "gui.glade", "ConfirmWindowDeleteDialog", null); glade.Autoconnect (this); if (obj is Stetic.WidgetInfo && ((Stetic.WidgetInfo)obj).IsWindow) { label.Text = GettextCatalog.GetString ("Are you sure you want to delete the window '{0}'?", windowName); } else if (obj is Stetic.WidgetInfo) { label.Text = GettextCatalog.GetString ("Are you sure you want to delete the widget '{0}'?", windowName); } else if (obj is Stetic.ActionGroupInfo) { label.Text = GettextCatalog.GetString ("Are you sure you want to delete the action group '{0}'?", windowName); } else label.Text = GettextCatalog.GetString ("Are you sure you want to delete '{0}'?", windowName); if (fileName != null) { checkbox.Label = string.Format (checkbox.Label, fileName); checkbox.Active = true; } else checkbox.Hide (); }
void Load (Stetic.Wrapper.ActionGroup group) { if (autoCommitChanges) { groupCopy = group; } else { actionCopyMap.Clear (); groupCopy = new Stetic.Wrapper.ActionGroup (); groupCopy.Name = group.Name; foreach (Stetic.Wrapper.Action action in group.Actions) { Stetic.Wrapper.Action dupaction = action.Clone (); groupCopy.Actions.Add (dupaction); actionCopyMap [dupaction] = action; } groupCopy.SignalAdded += new Stetic.SignalEventHandler (OnSignalAdded); groupCopy.SignalChanged += new Stetic.SignalChangedEventHandler (OnSignalChanged); } }
public WidgetActionBar (WidgetDesignerFrontend frontend, Stetic.Wrapper.Widget rootWidget) { this.frontend = frontend; editors = new Hashtable (); wrappers = new Hashtable (); sensitives = new Hashtable (); invisibles = new Hashtable (); toggles = new ArrayList (); IconSize = IconSize.Menu; Orientation = Orientation.Horizontal; ToolbarStyle = ToolbarStyle.BothHoriz; combo = new WidgetTreeCombo (); comboItem = new ToolItem (); comboItem.Add (combo); comboItem.ShowAll (); Insert (comboItem, -1); ShowAll (); RootWidget = rootWidget; }
public static void AddFault(Stetic.Wrapper.Widget owner, object faultId, Gtk.Orientation orientation, int x, int y, int width, int height) { Gtk.Widget widget = owner.Wrapped; if (!widget.IsRealized) return; Gdk.Window win = NewWindow (widget, Gdk.WindowClass.InputOnly); win.MoveResize (x, y, width, height); Hashtable widgetFaults = faultGroups[widget] as Hashtable; if (widgetFaults == null) { faultGroups[widget] = widgetFaults = new Hashtable (); widget.Destroyed += FaultWidgetDestroyed; widget.DragMotion += FaultDragMotion; widget.DragLeave += FaultDragLeave; widget.DragDrop += FaultDragDrop; widget.DragDataReceived += FaultDragDataReceived; DND.DestSet (widget, false); } widgetFaults[win] = new Fault (owner, faultId, orientation, win); }
public ContextMenu (Stetic.Wrapper.Widget wrapper, Gtk.Widget context) { MenuItem item; editable = wrapper; widget = wrapper.Wrapped; if (widget == context) { item = LabelItem (widget); item.Sensitive = false; Add (item); } item = new MenuItem (Catalog.GetString ("_Select")); item.Activated += DoSelect; Add (item); ClassDescriptor klass = wrapper.ClassDescriptor; if (klass != null) { foreach (ItemDescriptor id in klass.ContextMenu) { CommandDescriptor cmd = (CommandDescriptor)id; if (!cmd.VisibleFor (widget)) continue; item = new MenuItem (cmd.Label); if (cmd.Enabled (widget, context)) { Gtk.Widget wdup = widget, cdup = context; // FIXME bxc 75689 item.Activated += delegate (object o, EventArgs args) { cmd.Run (wdup, cdup); }; } else item.Sensitive = false; Add (item); } } BuildContextMenu (wrapper.ParentWrapper, widget == context, context); }
public SelectIconDialog(Gtk.Window parent, Stetic.IProject project) { this.parent = parent; this.project = project; Glade.XML xml = new Glade.XML (null, "stetic.glade", "SelectIconDialog", null); xml.Autoconnect (this); // Stock icon list iconList = new StockIconList (); iconList.SelectionChanged += new EventHandler (OnIconSelectionChanged); iconScrolledwindow.AddWithViewport (iconList); // Custom icon list customIconList = new ProjectIconList (project, project.IconFactory); customIconList.SelectionChanged += new EventHandler (OnCustomIconSelectionChanged); customIconScrolledwindow.AddWithViewport (customIconList); dialog.ShowAll (); UpdateIconSelection (); UpdateButtons (); }
public void RemoveActionGroup (Stetic.Wrapper.ActionGroup group) { ActionGroups.Remove (group); }
public static void AddFault(Stetic.Wrapper.Widget owner, object faultId, Gtk.Orientation orientation, Gdk.Rectangle fault) { AddFault (owner, faultId, orientation, fault.X, fault.Y, fault.Width, fault.Height); }
public Fault(Stetic.Wrapper.Widget owner, object id, Gtk.Orientation orientation, Gdk.Window window) { Owner = owner; Id = id; Orientation = orientation; Window = window; }
static void FaultDrop(Stetic.Wrapper.Widget wrapper, int x, int y, Gtk.Widget targetWidget) { Fault fault = FindFault (x, y, targetWidget); if (fault != null) { fault.Owner.Drop (wrapper.Wrapped, fault.Id); wrapper.Select (); } }
public static void ClearFaults(Stetic.Wrapper.Widget owner) { ClearFaults (owner.Wrapped); }
public static void AddVFault(Stetic.Wrapper.Widget owner, object faultId, Gtk.Widget left, Gtk.Widget right) { Gtk.Widget widget = owner.Wrapped; if (!widget.IsRealized) return; Gdk.Rectangle leftAlloc, rightAlloc; int x1, y1, x2, y2; if (left != null && right != null) { leftAlloc = left.Allocation; rightAlloc = right.Allocation; x1 = leftAlloc.X + leftAlloc.Width; x2 = rightAlloc.X; y1 = Math.Min (leftAlloc.Y, rightAlloc.Y); y2 = Math.Max (leftAlloc.Y + leftAlloc.Height, rightAlloc.Y + rightAlloc.Height); while (x2 - x1 < FaultOverlap * 2) { x1--; x2++; } } else if (left == null) { rightAlloc = right.Allocation; x1 = 0; x2 = Math.Max (rightAlloc.X, FaultOverlap); y1 = rightAlloc.Y; y2 = rightAlloc.Y + rightAlloc.Height; } else { leftAlloc = left.Allocation; x1 = Math.Min (leftAlloc.X + leftAlloc.Width, widget.Allocation.Width - FaultOverlap); x2 = widget.Allocation.Width; y1 = leftAlloc.Y; y2 = leftAlloc.Y + leftAlloc.Height; } AddFault (owner, faultId, Gtk.Orientation.Vertical, x1, y1, x2 - x1, y2 - y1); }
public static void AddHFault(Stetic.Wrapper.Widget owner, object faultId, Gtk.Widget above, Gtk.Widget below) { Gtk.Widget widget = owner.Wrapped; if (!widget.IsRealized) return; Gdk.Rectangle aboveAlloc, belowAlloc; int x1, y1, x2, y2; if (above != null && below != null) { aboveAlloc = above.Allocation; belowAlloc = below.Allocation; x1 = Math.Min (aboveAlloc.X, belowAlloc.X); x2 = Math.Max (aboveAlloc.X + aboveAlloc.Width, belowAlloc.X + belowAlloc.Width); y1 = aboveAlloc.Y + aboveAlloc.Height; y2 = belowAlloc.Y; while (y2 - y1 < FaultOverlap * 2) { y1--; y2++; } } else if (above == null) { belowAlloc = below.Allocation; x1 = belowAlloc.X; x2 = belowAlloc.X + belowAlloc.Width; y1 = 0; y2 = Math.Max (belowAlloc.Y, FaultOverlap); } else { aboveAlloc = above.Allocation; x1 = aboveAlloc.X; x2 = aboveAlloc.X + aboveAlloc.Width; y1 = Math.Min (aboveAlloc.Y + aboveAlloc.Height, widget.Allocation.Height - FaultOverlap); y2 = widget.Allocation.Height; } AddFault (owner, faultId, Gtk.Orientation.Horizontal, x1, y1, x2 - x1, y2 - y1); }
public static void AddFault(Stetic.Wrapper.Widget owner, object faultId, Gtk.SideType side, Gtk.Widget widget) { Gdk.Rectangle fault; Gtk.Orientation orientation; if (widget == null) { fault = owner.Wrapped.Allocation; int border = (int)((Gtk.Container)owner.Wrapped).BorderWidth; fault.Inflate (-border, -border); } else fault = widget.Allocation; switch (side) { case Gtk.SideType.Top: fault.Y -= FaultOverlap; fault.Height = 2 * FaultOverlap; orientation = Gtk.Orientation.Horizontal; break; case Gtk.SideType.Bottom: fault.Y += fault.Height - FaultOverlap; fault.Height = 2 * FaultOverlap; orientation = Gtk.Orientation.Horizontal; break; case Gtk.SideType.Left: fault.X -= FaultOverlap; fault.Width = 2 * FaultOverlap; orientation = Gtk.Orientation.Vertical; break; case Gtk.SideType.Right: fault.X += fault.Width - FaultOverlap; fault.Width = 2 *FaultOverlap; orientation = Gtk.Orientation.Vertical; break; default: throw new Exception ("not reached"); } AddFault (owner, faultId, orientation, fault); }
public static void AddFault(Stetic.Wrapper.Widget owner, object faultId, Gtk.Orientation orientation, Gtk.Widget before, Gtk.Widget after) { if (orientation == Gtk.Orientation.Horizontal) AddHFault (owner, faultId, before, after); else AddVFault (owner, faultId, before, after); }
protected virtual void OnWidgetAdded (Stetic.Wrapper.WidgetEventArgs args) { NotifyChanged (); if (WidgetAdded != null) WidgetAdded (this, args); }
public void PopupContextMenu (Stetic.Wrapper.Widget wrapper) { Gtk.Menu m = new ContextMenu (wrapper); m.Popup (); }
void OnWidgetNameChanged (Stetic.Wrapper.WidgetNameChangedArgs args, bool isTopLevel) { if (frontend != null) frontend.NotifyWidgetNameChanged (Component.GetSafeReference (args.WidgetWrapper), args.OldName, args.NewName, isTopLevel); if (args.WidgetWrapper != null && WidgetNameChanged != null) WidgetNameChanged (this, args); }
void IProject.NotifyNameChanged (Stetic.Wrapper.WidgetNameChangedArgs args) { if (loading) return; NotifyChanged (); OnWidgetNameChanged (args, args.WidgetWrapper.IsTopLevel); }
public void AttachActionGroups (Stetic.Wrapper.ActionGroupCollection groups) { ActionGroups = groups; ownedGlobalActionGroups = false; }
internal WidgetEditSession CreateWidgetDesignerSession (WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges) { return new WidgetEditSession (this, frontend, windowName, editingBackend, autoCommitChanges); }