Beispiel #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;
        }
Beispiel #2
0
        void IPlugin.Init(object context)
        {
            solidIDE   = context as ISolidIDE;
            mainWindow = solidIDE.GetMainWindow();

            // Dock with Tree
            Gtk.ScrolledWindow treeViewScrollWindow = new Gtk.ScrolledWindow();
            Gtk.Viewport       treeViewViewport     = new Gtk.Viewport();
            treeViewScrollWindow.Add(treeViewViewport);
            treeView = new Gtk.TreeView();
            treeViewViewport.Add(treeView);
            treeViewScrollWindow.ShowAll();
            Gtk.TreeViewColumn   col             = new Gtk.TreeViewColumn();
            Gtk.CellRendererText colAssemblyCell = new Gtk.CellRendererText();
            col.PackStart(colAssemblyCell, true);
            col.AddAttribute(colAssemblyCell, "text", 0);
            treeView.AppendColumn(col);
            treeView.Model          = new Gtk.TreeStore(typeof(string), typeof(Tool <Gdk.Event, Cairo.Context, Model>), typeof(Shape));
            treeView.RowActivated  += HandleRowActivated;
            treeView.CursorChanged += HandleCursorChanged;
            Gtk.Drag.SourceSet(
                treeView,
                Gdk.ModifierType.Button1Mask,
                new Gtk.TargetEntry[] { new Gtk.TargetEntry("application/x-solidide.shape", Gtk.TargetFlags.App, 0) },
                Gdk.DragAction.Copy
                );

            /*treeView.EnableModelDragSource(
             * Gdk.ModifierType.None,
             * new Gtk.TargetEntry[] { new TargetEntry("application/SolidIDE", 0, 0) },
             * Gdk.DragAction.Default);*/
            treeView.DragBegin   += HandleTreeViewDragBegin;
            treeView.DragDataGet += HandleTreeViewDragDataGet;
            //treeView.DragDrop += HandleTreeViewDragDrop;

            toolboxDockItem                = mainWindow.DockFrame.AddItem("Toolbox");
            toolboxDockItem.Behavior       = DockItemBehavior.Normal;
            toolboxDockItem.Expand         = true;
            toolboxDockItem.DrawFrame      = true;
            toolboxDockItem.Label          = "Toolbox";
            toolboxDockItem.Content        = treeViewScrollWindow;
            toolboxDockItem.DefaultVisible = true;
            toolboxDockItem.Visible        = true;

            UpdateToolbox();

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

            solidIDE.GetMenuItem <Gtk.TearoffMenuItem>("View", "TearoffView");
            var toolboxMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View", "Toolbox");

            toolboxMenuItem.Activated += HandleShowToolboxActivated;
        }
Beispiel #3
0
        void IPlugin.Init(object context)
        {
            mainApp    = context as ISolidIDE;
            mainWindow = mainApp.GetMainWindow();

            noteBook = new Gtk.Notebook();
            noteBook.AppendPage(new TextView(), new Gtk.Label("TestPlugin Visualizer"));
            noteBook.AppendPage(new DrawingArea(), new Gtk.Label("TestPlugin Visualizer"));
            noteBook.ShowAll();

            dockItem                = mainWindow.DockFrame.AddItem("TestPlugin Visualizer");
            dockItem.Behavior       = DockItemBehavior.Normal;
            dockItem.Expand         = true;
            dockItem.DrawFrame      = true;
            dockItem.Label          = "TestPlugin Visualizer";
            dockItem.Content        = noteBook;
            dockItem.DefaultVisible = true;
            dockItem.Visible        = true;
        }
Beispiel #4
0
        void IPlugin.Init(object context)
        {
            mainApp    = context as ISolidIDE;
            mainWindow = mainApp.GetMainWindow();
            DockFrame frame = mainWindow.DockFrame;

            // Tree View
            treeView = new Gtk.TreeView();
            Gtk.TreeViewColumn   col             = new Gtk.TreeViewColumn();
            Gtk.CellRendererText colAssemblyCell = new Gtk.CellRendererText();
            col.PackStart(colAssemblyCell, true);
            col.AddAttribute(colAssemblyCell, "text", 0);
            if (treeView.GetColumn(0) != null)
            {
                treeView.Columns[0] = col;
            }
            else
            {
                treeView.AppendColumn(col);
            }
            treeView.Model         = new Gtk.TreeStore(typeof(string));
            treeView.Model         = homeSubFolders(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
            treeView.RowActivated += HandleRowActivated;

            Gtk.ScrolledWindow treeViewScrollWindow = new Gtk.ScrolledWindow();
            Gtk.Viewport       treeViewViewport     = new Gtk.Viewport();
            treeViewScrollWindow.Add(treeViewViewport);
            treeViewViewport.Add(treeView);
            treeViewScrollWindow.ShowAll();

            DockItem treeViewDock = frame.AddItem("TreeViewDock");

            treeViewDock.Behavior       = DockItemBehavior.Normal;
            treeViewDock.Expand         = true;
            treeViewDock.DrawFrame      = true;
            treeViewDock.Label          = "Files";
            treeViewDock.Content        = treeViewScrollWindow;
            treeViewDock.DefaultVisible = true;
            treeViewDock.Visible        = true;

            // Text Editor Notebook
            noteBook = new Gtk.Notebook();

            Gtk.ScrolledWindow textEditorScrollWindow = new Gtk.ScrolledWindow();
            Gtk.Viewport       textEditorViewport     = new Gtk.Viewport();
            textEditorScrollWindow.Add(textEditorViewport);
            textEditorViewport.Add(noteBook);
            textEditorScrollWindow.ShowAll();

            DockItem textEditorDock = frame.AddItem("TextEditorDock");

            textEditorDock.Behavior       = DockItemBehavior.Normal;
            textEditorDock.Expand         = true;
            textEditorDock.DrawFrame      = true;
            textEditorDock.Label          = "Text Editor";
            textEditorDock.Content        = textEditorScrollWindow;
            textEditorDock.DefaultVisible = true;
            textEditorDock.Visible        = true;

            // Menu
            var fileMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File");
            var saveMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File", "Save");

            saveMenuItem.Activated += HandleSaveActivated;
            var closeMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File", "Close");

            closeMenuItem.Activated += HandleCloseActivated;
            var exitMenuItem = mainApp.GetMenuItem <Gtk.ImageMenuItem>("File", "Exit");

            exitMenuItem.Activated += HandleExitActivated;

            /*
             * mainApp.GetMenuItem<Gtk.SeparatorMenuItem>("View", "");
             * mainApp.GetMenuItem<Gtk.CheckMenuItem>("View", "CheckTest1");
             * mainApp.GetMenuItem<Gtk.CheckMenuItem>("View", "CheckTest2");
             * //mainApp.GetMenuItem<Gtk.RadioMenuItem>("View", "RadioTest1");
             * //mainApp.GetMenuItem<Gtk.RadioMenuItem>("View", "RadioTest2");
             * //mainApp.GetMenuItem<Gtk.RadioMenuItem>("View", "RadioTest3");
             */
        }
Beispiel #5
0
        void IPlugin.Init(object context)
        {
            solidIDE   = context as ISolidIDE;
            mainWindow = solidIDE.GetMainWindow();

            // Notebook
            noteBook = new Gtk.Notebook();

            designerDockItem          = mainWindow.DockFrame.AddItem("Designer");
            designerDockItem.Behavior =
                DockItemBehavior.CantAutoHide |
                DockItemBehavior.CantClose |
                DockItemBehavior.NeverFloating;
            designerDockItem.Expand         = true;
            designerDockItem.DrawFrame      = true;
            designerDockItem.Label          = "Designer";
            designerDockItem.Content        = noteBook;
            designerDockItem.DefaultVisible = true;
            designerDockItem.Visible        = true;

            // Menu
            var fileMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("File");
            var saveMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("File", "Save");

            saveMenuItem.Activated += HandleSaveActivated;
            var viewMenuItem     = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View");
            var designerMenuItem = solidIDE.GetMenuItem <Gtk.ImageMenuItem>("View", "Designer");

            designerMenuItem.Activated += HandleShowDesignerActivated;

            // Test
            var                   model       = new Model();
            ShapesModel           scene       = new ShapesModel();
            SelectionModel        selection   = new SelectionModel();
            InteractionStateModel interaction = new InteractionStateModel();
            var                   view        = new View <Cairo.Context, Model>();

            controller = new CompositeController <Gdk.Event, Cairo.Context, Model>();

            model.RegisterSubModel <ShapesModel>(scene);
            model.RegisterSubModel <SelectionModel>(selection);
            model.RegisterSubModel <InteractionStateModel>(interaction);
            model.ModelChanged += HandleModelChanged;

            //TODO: Scan plugins for shapes and viewers
            view.Viewers.Add(typeof(Model), new ModelViewer <Cairo.Context>());
            view.Viewers.Add(typeof(ShapesModel), new ShapeModelViewer());
            view.Viewers.Add(typeof(RectangleShape), new RectangleShapeViewer());
            view.Viewers.Add(typeof(EllipseShape), new EllipseShapeViewer());
            view.Viewers.Add(typeof(ArrowShape), new ArrowShapeViewer());
            view.Viewers.Add(typeof(BezierCurvedArrowShape), new BezierCurvedArrowShapeViewer());
            view.Viewers.Add(typeof(TextBlockShape), new TextBlockShapeViewer());
            view.Viewers.Add(typeof(SelectionModel), new SelectionModelViewer());
            view.Viewers.Add(typeof(Glue), new GlueViewer());
            view.Viewers.Add(typeof(InteractionStateModel), new InteractionStateModelViewer());
            view.Viewers.Add(typeof(FocusRectangleShape), new FocusRectangleShapeViewer());

            //scene.Shapes.Add(new RectangleShape(new Rectangle(0,0,100,50)));

            controller.SubControllers.Add(new ShapeSelectionController(model, view));
            chainController = new ChainController <Gdk.Event, Cairo.Context, Model>();
            chainController.SubControllers.Add(new ConnectorDragController(model, view));
            chainController.SubControllers.Add(new ShapeDragController(model, view));
            controller.SubControllers.Add(chainController);

            IDesigner designer = this;

            designer.AddSheet("Sheet", new Sheet <Gdk.Event, Cairo.Context, Model>(model, view, controller));
        }