Ejemplo n.º 1
0
        void IPlugin.Init(object context)
        {
            solidIDE   = context as ISolidIDE;
            mainWindow = solidIDE.GetMainWindow();

            // Dock with PropertyGrid
            Gtk.ScrolledWindow inspectorGridScrollWindow = new Gtk.ScrolledWindow();
            Gtk.Viewport       inspectorGridViewport     = new Gtk.Viewport();
            inspectorGridScrollWindow.Add(inspectorGridViewport);
            inspectorGrid = new SolidV.Gtk.InspectorGrid.InspectorGrid();
            inspectorGridViewport.Add(inspectorGrid);
            inspectorGridScrollWindow.ShowAll();

            InspectorDockItem                = mainWindow.DockFrame.AddItem("Inspector");
            InspectorDockItem.Behavior       = DockItemBehavior.Normal;
            InspectorDockItem.Expand         = true;
            InspectorDockItem.DrawFrame      = true;
            InspectorDockItem.Label          = "Inspector";
            InspectorDockItem.Content        = inspectorGridScrollWindow;
            InspectorDockItem.DefaultVisible = true;
            InspectorDockItem.Visible        = true;

            IServiceContainer plugins  = solidIDE.GetServiceContainer();
            IDesigner         designer = plugins.GetService <IDesigner>();

            designer.CurrentSheetChanged += HandleDesignerCurrentSheetChanged;

            // Menu
            var viewMenuItem      = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View");
            var InspectorMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View", "Inspector");

            InspectorMenuItem.Activated += HandleShowInspectorActivated;
        }
Ejemplo n.º 2
0
        public void DropShapeFromTool(ITool <Gdk.Event, Cairo.Context, Model> tool, Rectangle dropTo, Shape currentInfoObject = null)
        {
            //TODO: May we simulate drag&drop mechanism to send data?

            IServiceContainer plugins  = solidIDE.GetServiceContainer();
            IDesigner         designer = plugins.GetService <IDesigner>();

            if (designer != null && designer.CurrentSheet != null)
            {
                if (tool != null)
                {
                    ShapeFromTool(tool, dropTo, currentInfoObject);
                    tool.Command().Do();
                }
                else if (currentInfoObject != null)
                {
                    designer.AddShapes(currentInfoObject.DeepCopy());
                }
            }
        }