예제 #1
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            var             layers      = new LayersListWidget();
            DockItem        layers_item = workspace.AddItem("Layers");
            DockItemToolbar layers_tb   = layers_item.GetToolbar(PositionType.Bottom);

            layers_item.Label     = Catalog.GetString("Layers");
            layers_item.Content   = layers;
            layers_item.Icon      = PintaCore.Resources.GetIcon("Menu.Layers.MergeLayerDown.png");
            layers_item.Behavior |= DockItemBehavior.CantClose;

            layers_tb.Add(PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem());

            Gtk.ToggleAction show_layers = padMenu.AppendToggleAction("Layers", Catalog.GetString("Layers"), null, "Menu.Layers.MergeLayerDown.png");
            show_layers.Activated      += delegate { layers_item.Visible = show_layers.Active; };
            layers_item.VisibleChanged += delegate { show_layers.Active = layers_item.Visible; };

            show_layers.Active = layers_item.Visible;

            PintaCore.Workspace.ActiveDocumentChanged += delegate { layers.Reset(); };
        }
예제 #2
0
        public void Initialize(DockFrame dockFrame)
        {
            m_dockFrame               = dockFrame;
            m_experimentPad           = m_dockFrame.AddItem("ExperimentPad");
            m_experimentPad.Label     = Catalog.GetString("ExperimentPad");
            m_experimentPad.Behavior  = DockItemBehavior.Locked;
            m_experimentPad.Expand    = true;
            m_experimentPad.DrawFrame = false;

            m_initialized = true;
        }
예제 #3
0
        /// <summary>
        /// Initialize the window pad in the given dock frame.
        /// </summary>
        /// <param name='dockFrame'>
        /// Dock frame.
        /// </param>
        public void Initialize(DockFrame dockFrame)
        {
            m_dockFrame = dockFrame;
            DockItem workspaceDockingWindow = m_dockFrame.AddItem("Workspace");

            workspaceDockingWindow.Label           = Catalog.GetString("Workspace");
            workspaceDockingWindow.DefaultLocation = "ComponentsLibrary/Center";
            workspaceDockingWindow.Behavior       |= DockItemBehavior.CantClose;

            workspaceDockingWindow.Content = CreateWorkspaceView();

            m_initialized = true;
        }
예제 #4
0
        /// <summary>
        /// Shows the component info pad.
        /// </summary>
        /// <param name="component">Component.</param>
        /// <param name="defaultLocationX">Default location x for the floating window</param>
        /// <param name="defaultLocationY">Default location y for the floating window</param>
        /// <param name="onVisibleChanged">The action that is executed when visibility of window changes.</param>
        internal void ShowComponentInfoPad(BasicNodeControl component,
                                           int defaultLocationX, int defaultLocationY, System.Action <Boolean> onVisibleChanged)
        {
            DockItem infoDockItem = m_mainWindowDockFrame.GetItem(component.ExperimentNode.ID);

            if (infoDockItem == null)
            {
                infoDockItem         = m_mainWindowDockFrame.AddItem(component.ExperimentNode.ID);
                infoDockItem.Content = CreateInfoWidget(component);

                infoDockItem.Label         = component.ExperimentNode.Data.Metadata.Label;
                infoDockItem.DefaultHeight = 150;
                infoDockItem.DefaultWidth  = 200;

                infoDockItem.DefaultLocation = GetLocation();

                infoDockItem.Visible = true;

                //attach action on visible changed, so that if window is closed then it toggles off the info icon
                infoDockItem.VisibleChanged += (object sender, EventArgs e) =>
                {
                    bool isVisible = ((DockItem)sender).Visible;
                    onVisibleChanged(isVisible);
                };

                AttachMouseOverHighlightHandlers(component, infoDockItem);

                infoPads.AddLast(infoDockItem);

                //Float window
                //this line allows setting window as floating automatically, to consider in future
                m_mainWindowDockFrame.SetStatus(infoDockItem, DockItemStatus.Floating);
                Gdk.Rectangle floatRectangle = infoDockItem.FloatingPosition;
                floatRectangle.Width  = 350;
                floatRectangle.Height = 180;

                //location of info box next to the component node just sligthly below cursor click
                floatRectangle.X = defaultLocationX;
                floatRectangle.Y = defaultLocationY + 20;
                infoDockItem.SetFloatMode(floatRectangle);
            }
            else
            {
                //if already exists just set it visible
                infoDockItem.Visible = true;
            }
        }
예제 #5
0
        /// <summary>
        /// Initialize the window pad in the given dock frame.
        /// </summary>
        /// <param name='dockFrame'>
        /// Dock frame.
        /// </param>
        public void Initialize(DockFrame dockFrame)
        {
            m_dockFrame = dockFrame;
            DockItem componentLibraryDockingWindow = m_dockFrame.AddItem("ComponentsLibrary");

            componentLibraryDockingWindow.Label        = Catalog.GetString("Components Library");
            componentLibraryDockingWindow.Behavior    |= DockItemBehavior.CantClose;
            componentLibraryDockingWindow.DefaultWidth = 200;

            componentLibraryDockingWindow.Content = CreateComponentsTreeView();

            //DockItemToolbar libraryToolbar = componentLibraryDockingWindow.GetToolbar(PositionType.Top);
            //libraryToolbar.Add(ApplicationUICore.Actions.ComponentLibrary.Rescan.CreateDockToolBarItem());

            EnableDrag();

            m_initialized = true;
        }
예제 #6
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            var             history      = new HistoryTreeView();
            DockItem        history_item = workspace.AddItem("History");
            DockItemToolbar history_tb   = history_item.GetToolbar(PositionType.Bottom);

            history_item.Label           = Catalog.GetString("History");
            history_item.DefaultLocation = "Images/Bottom";
            history_item.Content         = history;
            history_item.Icon            = PintaCore.Resources.GetIcon("Menu.Layers.DuplicateLayer.png");

            history_tb.Add(PintaCore.Actions.Edit.Undo.CreateDockToolBarItem());
            history_tb.Add(PintaCore.Actions.Edit.Redo.CreateDockToolBarItem());
            Gtk.ToggleAction show_history = padMenu.AppendToggleAction("History", Catalog.GetString("History"), null, "Menu.Layers.DuplicateLayer.png");
            show_history.Activated      += delegate { history_item.Visible = show_history.Active; };
            history_item.VisibleChanged += delegate { show_history.Active = history_item.Visible; };

            show_history.Active = history_item.Visible;
        }
예제 #7
0
        /// <summary>
        /// Initialize the window pad in the given dock frame.
        /// </summary>
        /// <param name='dockFrame'>
        /// Dock frame.
        /// </param>
        public void Initialize(DockFrame dockFrame)
        {
            if (this.dockFrame != null)
            {
                throw new ApplicationException("This DockPad has already been initialized");
            }
            if (dockFrame == null)
            {
                throw new ArgumentNullException("Provided DockFrame is null");
            }
            this.dockFrame = dockFrame;

            DockItem componentLibraryDock = dockFrame.AddItem("ComponentsLibrary");

            componentLibraryDock.Label        = Catalog.GetString("Components Library");
            componentLibraryDock.Behavior    |= DockItemBehavior.CantClose;
            componentLibraryDock.DefaultWidth = 200;
            componentLibraryDock.Content      = widget;
        }
예제 #8
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            DockItem      toolbox_item = workspace.AddItem("Toolbox");
            ToolBoxWidget toolbox      = new ToolBoxWidget()
            {
                Name = "toolbox"
            };

            toolbox_item.Label        = Catalog.GetString("Tools");
            toolbox_item.Content      = toolbox;
            toolbox_item.Icon         = PintaCore.Resources.GetIcon("Tools.Pencil.png");
            toolbox_item.Behavior    |= DockItemBehavior.CantClose;
            toolbox_item.DefaultWidth = 65;

            Gtk.ToggleAction show_toolbox = padMenu.AppendToggleAction("Tools", Catalog.GetString("Tools"), null, "Tools.Pencil.png");
            show_toolbox.Activated      += delegate { toolbox_item.Visible = show_toolbox.Active; };
            toolbox_item.VisibleChanged += delegate { show_toolbox.Active = toolbox_item.Visible; };

            show_toolbox.Active = toolbox_item.Visible;
        }
예제 #9
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            var tab = new DockNotebook()
            {
                NavigationButtonsVisible = false
            };

            NotebookContainer = new DockNotebookContainer(tab, true);

            tab.InitSize();

            var canvas_dock = workspace.AddItem("Canvas");

            canvas_dock.Behavior = DockItemBehavior.Locked;
            canvas_dock.Expand   = true;

            canvas_dock.DrawFrame = false;
            canvas_dock.Label     = Catalog.GetString("Canvas");
            canvas_dock.Content   = NotebookContainer;
        }
예제 #10
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            DockItem open_images_item = workspace.AddItem("Images");

            open_images_item.DefaultLocation = "Layers/Bottom";
            open_images_item.Label           = Catalog.GetString("Images");
            open_images_item.Content         = new OpenImagesListWidget();
            open_images_item.Icon            = PintaCore.Resources.GetIcon("Menu.Effects.Default.png");
            open_images_item.DefaultVisible  = false;
            open_images_item.DefaultWidth    = 100;

            ToggleAction show_open_images = padMenu.AppendToggleAction("Images", Catalog.GetString("Images"), null, null);

            show_open_images.Activated += delegate {
                open_images_item.Visible = show_open_images.Active;
            };

            open_images_item.VisibleChanged += delegate {
                show_open_images.Active = open_images_item.Visible;
            };
        }
예제 #11
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            const string pad_name = "Images";

            DockItem open_images_item = workspace.AddItem(pad_name);

            open_images_item.Label   = Catalog.GetString(pad_name);
            open_images_item.Content = new OpenImagesListWidget();

            ToggleAction show_open_images = padMenu.AppendToggleAction(pad_name, Catalog.GetString(pad_name), null, null);

            show_open_images.Activated += delegate {
                open_images_item.Visible = show_open_images.Active;
            };

            open_images_item.VisibleChanged += delegate {
                show_open_images.Active = open_images_item.Visible;
            };

            show_open_images.Active = open_images_item.Visible;
        }
예제 #12
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            DockItem           palette_item = workspace.AddItem("Palette");
            ColorPaletteWidget palette      = new ColorPaletteWidget()
            {
                Name = "palette"
            };

            palette_item.Label           = Catalog.GetString("Palette");
            palette_item.Content         = palette;
            palette_item.Icon            = PintaCore.Resources.GetIcon("Pinta.png");
            palette_item.DefaultLocation = "Toolbox/Bottom";
            palette_item.Behavior       |= DockItemBehavior.CantClose;
            palette_item.DefaultWidth    = 65;

            Gtk.ToggleAction show_palette = padMenu.AppendToggleAction("Palette", Catalog.GetString("Palette"), null, "Pinta.png");
            show_palette.Activated      += delegate { palette_item.Visible = show_palette.Active; };
            palette_item.VisibleChanged += delegate { show_palette.Active = palette_item.Visible; };

            palette.Initialize();
            show_palette.Active = palette_item.Visible;
        }
예제 #13
0
        internal void ShowComponentInfoPad(BasicNodeControl component)
        {
            DockItem infoDockItem = m_mainWindowDockFrame.GetItem(component.ExperimentNode.ID);

            if (infoDockItem == null)
            {
                infoDockItem         = m_mainWindowDockFrame.AddItem(component.ExperimentNode.ID);
                infoDockItem.Content = CreateInfoWidget(component);
            }

            infoDockItem.Label         = component.ExperimentNode.Data.Metadata.Label;
            infoDockItem.DefaultHeight = 150;
            infoDockItem.DefaultWidth  = 200;

            infoDockItem.DefaultLocation = GetLocation();

            m_mainWindowDockFrame.SetVisible(infoDockItem, true);

            infoPads.AddLast(infoDockItem);

            //TODO: floating info panels
            //there is still problem with below solution - if user resizes the window it frequently crashes (not always though)
            //however it crashes only when running from MONO Develop with attached debugger

            //            //this line allows setting window as floating automatically, to consider in future
            //            m_dockFrame.SetStatus(infoDockItem, DockItemStatus.Floating);
            //            Gdk.Rectangle floatRectangle = infoDockItem.FloatingPosition;
            //            floatRectangle.Width = 350;
            //            floatRectangle.Height = 180;
            //
            //            // TODO set location of info box next to the component node
            //            // to do this probably some translation will be needed of componentControl.DisplayBox on experiment canvas
            //            // to absolute x and y in relation to window
            //            floatRectangle.X = 600;
            //            floatRectangle.Y = 600;
            //            infoDockItem.SetFloatMode(floatRectangle);
        }
예제 #14
0
        /// <summary>
        /// Initialize the window pad in the given dock frame.
        /// </summary>
        /// <param name='dockFrame'>
        /// Dock frame.
        /// </param>
        public void Initialize(DockFrame dockFrame)
        {
            m_dockFrame = dockFrame;
            DockItem outputDockingWindow = m_dockFrame.AddItem("Output");

            outputDockingWindow.Label           = Catalog.GetString("Output");
            outputDockingWindow.DefaultHeight   = 100;
            outputDockingWindow.DefaultLocation = "ExperimentPad/Bottom"; //or experiment
            outputDockingWindow.Behavior       |= DockItemBehavior.CantClose;

            DockItemToolbar toolbar = outputDockingWindow.GetToolbar(PositionType.Top);

            m_buttonClear          = new Button(new Gtk.Image("gtk-clear", IconSize.Menu));
            m_buttonClear.Clicked += new EventHandler(OnButtonClearClick);
            toolbar.Add(m_buttonClear);

            toolbar.ShowAll();

            outputDockingWindow.Content = CreateOutputView();

            LoadIcons();

            m_initialized = true;
        }
예제 #15
0
        /// <summary>
        /// Shows the component info pad.
        /// </summary>
        /// <param name="component">Component.</param>
        /// <param name="defaultLocationX">Default location x for the floating window</param>
        /// <param name="defaultLocationY">Default location y for the floating window</param>
        /// <param name="onVisibleChanged">The action that is executed when visibility of window changes.</param>
        internal void ShowComponentInfoPad(BasicNodeControl component,
                                           int defaultLocationX, int defaultLocationY, System.Action <Boolean> onVisibleChanged)
        {
            DockItem infoDockItem = m_mainWindowDockFrame.GetItem(component.ExperimentNode.ID);

            if (infoDockItem == null)
            {
                infoDockItem         = m_mainWindowDockFrame.AddItem(component.ExperimentNode.ID);
                infoDockItem.Content = CreateInfoWidget(component);

                if (component is DecisionNodeControl)
                {
                    //    string m = component.ExperimentNode.ID;
                    //  if (m. ID.Equals (DecisionMetadataDefinition.GotoDecisionGuid)) {
                    if (component.ExperimentNode.Data.Metadata.Label.Equals("Goto Decision"))
                    {
                        infoDockItem.Label = GOTO_INFO_PANEL_TITLE_LABEL;
                    }
                    else
                    {
                        infoDockItem.Label = DECISION_INFO_PANEL_TITLE_LABEL;
                    }
                }
                else if (component is LoopNodeControl)
                {
                    infoDockItem.Label = LOOP_INFO_PANEL_TITLE_LABEL;
                }
                else
                {
                    infoDockItem.Label = component.ExperimentNode.Data.Metadata.Label;
                }

                infoDockItem.DefaultHeight = 150;
                //infoDockItem.DefaultWidth = 200;
                // HERZUM SPRINT 4.2: TLAB-226
                infoDockItem.DefaultHeight = 100;
                if (component is ScopeNodeControl || component is CommentNodeControl)
                {
                    infoDockItem.DefaultHeight = 50;
                }
                // END HERZUM SPRINT 4.2: TLAB-226

                infoDockItem.DefaultLocation = GetLocation();

                infoDockItem.Visible = true;

                //attach action on visible changed, so that if window is closed then it toggles off the info icon
                infoDockItem.VisibleChanged += (object sender, EventArgs e) =>
                {
                    bool isVisible = ((DockItem)sender).Visible;
                    onVisibleChanged(isVisible);
                };

                AttachMouseOverHighlightHandlers(component, infoDockItem);

                infoPads.AddLast(infoDockItem);

                //Float window
                //this line allows setting window as floating automatically, to consider in future
                m_mainWindowDockFrame.SetStatus(infoDockItem, DockItemStatus.Floating);
                Gdk.Rectangle floatRectangle = infoDockItem.FloatingPosition;
                floatRectangle.Width = 350;
                //floatRectangle.Height = 180;
                // HERZUM SPRINT 4.2: TLAB-225
                floatRectangle.Height = 100;
                if (component is ScopeNodeControl || component is CommentNodeControl)
                {
                    floatRectangle.Height = 50;
                }
                // END HERZUM SPRINT 4.2: TLAB-225

                //location of info box next to the component node just sligthly below cursor click
                floatRectangle.X = defaultLocationX;
                floatRectangle.Y = defaultLocationY + 20;
                infoDockItem.SetFloatMode(floatRectangle);
            }
            else
            {
                //if already exists just set it visible
                infoDockItem.Visible = true;
            }
        }
예제 #16
0
        void IPlugin.Init(object context)
        {
            ISampleTool SampleTool = context as ISampleTool;
            DockFrame   frame      = SampleTool.GetMainWindow().DockFrame;

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

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

            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;

            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;

            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;

            Gtk.MenuBar  mainMenuBar = SampleTool.GetMainMenu();
            Gtk.MenuItem fileMenu    = null;
            // Find the File menu if present
            foreach (Gtk.Widget w in mainMenuBar.Children)
            {
                if (w.Name == "FileAction")
                {
                    fileMenu = w as Gtk.MenuItem;
                }
            }

            // If not present - create it
            if (fileMenu == null)
            {
                Gtk.Menu menu = new Gtk.Menu();
                fileMenu         = new Gtk.MenuItem("File");
                fileMenu.Submenu = menu;
                mainMenuBar.Append(fileMenu);
            }

            // Setting up the Close menu item in File
            Gtk.MenuItem close = new Gtk.MenuItem("Close");
            close.Activated += HandleActivated;
            (fileMenu.Submenu as Gtk.Menu).Prepend(close);

            // Setting up the Save menu item in File
            Gtk.MenuItem save = new Gtk.MenuItem("Save");
            save.Activated += HandleSaveActivated;
            (fileMenu.Submenu as Gtk.Menu).Prepend(save);
        }
예제 #17
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");
             */
        }
예제 #18
0
    void CreateComponents()
    {
        fullViewVBox = new VBox(false, 0);
        rootWidget   = fullViewVBox;

        CreateMenuBar();

        CreateToolBar();

        // Create the docking widget and add it to the window.
        dock                   = new DockFrame();
        dock.Homogeneous       = false;
        dock.DefaultItemHeight = 100;
        dock.DefaultItemWidth  = 100;
        //dock.CompactGuiLevel = 1;

        toolbarFrame.AddContent(dock);

        // Create the notebook for the various documents.
        tabControl            = new DragNotebook(); //(dock.ShadedContainer);
        tabControl.Scrollable = true;
        tabControl.AppendPage(new Label("Other page"), new Label("Favorite Page  "));
        tabControl.AppendPage(new Label("What page"), new Label("Welcome/Start Page  "));
        tabControl.AppendPage(new TextView(), new Image("gtk-new", IconSize.Menu));
        tabControl.ShowAll();

        // The main document area
        documentDockItem                 = dock.AddItem("Documents");
        documentDockItem.Behavior        = DockItemBehavior.Locked;
        documentDockItem.Status          = DockItemStatus.AutoHide;
        documentDockItem.DefaultHeight   = 100;
        documentDockItem.DefaultWidth    = 100;
        documentDockItem.DefaultStatus   = DockItemStatus.AutoHide;
        documentDockItem.DefaultLocation = "Document/Right";
        documentDockItem.Expand          = true;
        documentDockItem.DrawFrame       = true;
        documentDockItem.Label           = "Documents";
        documentDockItem.Content         = tabControl;
        documentDockItem.DefaultVisible  = true;
        documentDockItem.Visible         = true;


        DockItem dit = dock.AddItem("left");

        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "left";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Left";
        dit.DefaultVisible  = true;
        dit.Visible         = true;
        DockItemToolbar tb = dit.GetToolbar(PositionType.Top);
        ToolButton      b  = new ToolButton(null, "Hello");

        tb.Add(b, false);
        tb.Visible = true;
        tb.ShowAll();

        dit                 = dock.AddItem("right");
        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Right";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Right";
        dit.DefaultVisible  = true;
        dit.Visible         = true;
        //dit.Icon = Gdk.Pixbuf.LoadFromResource("Cage.Shell.Docking.stock-close-12.png");

        dit                 = dock.AddItem("top");
        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Top";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Top";
        dit.DefaultVisible  = true;
        dit.Visible         = true;

        dit                 = dock.AddItem("bottom");
        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Bottom";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Bottom";
        dit.DefaultVisible  = true;
        dit.Visible         = true;



        if (File.Exists("toolbar.status"))
        {
            toolbarFrame.LoadStatus("toolbar.status");
        }

        if (File.Exists("config.layout"))
        {
            dock.LoadLayouts("config.layout");
        }
        else
        {
            dock.CreateLayout("test", true);
        }


        dock.CurrentLayout = "test";
        dock.HandlePadding = 0;
        dock.HandleSize    = 10;

        dock.SaveLayouts("config.layout");
        toolbarFrame.SaveStatus("toolbar.status");

        Add(fullViewVBox);
        fullViewVBox.ShowAll();

        statusBar = new Gtk.Statusbar();
        fullViewVBox.PackEnd(statusBar, false, true, 0);
    }
예제 #19
0
파일: CanvasPad.cs 프로젝트: romanzes/Pinta
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            // Create canvas
            Table mainTable = new Table(2, 2, false);

            sw = new ScrolledWindow()
            {
                Name       = "sw",
                ShadowType = ShadowType.EtchedOut
            };

            Viewport vp = new Viewport()
            {
                ShadowType = ShadowType.None
            };

            canvas = new PintaCanvas()
            {
                Name       = "canvas",
                CanDefault = true,
                CanFocus   = true,
                Events     = (Gdk.EventMask) 16134
            };

            // Canvas pad
            DockItem documentDockItem = workspace.AddItem("Canvas");

            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand   = true;

            documentDockItem.DrawFrame = false;
            documentDockItem.Label     = Catalog.GetString("Canvas");
            documentDockItem.Content   = mainTable;
            documentDockItem.Icon      = PintaCore.Resources.GetIcon("Menu.Effects.Artistic.OilPainting.png");

            //rulers
            hruler        = new HRuler();
            hruler.Metric = MetricType.Pixels;
            mainTable.Attach(hruler, 1, 2, 0, 1, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            vruler        = new VRuler();
            vruler.Metric = MetricType.Pixels;
            mainTable.Attach(vruler, 0, 1, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            sw.Hadjustment.ValueChanged += delegate {
                UpdateRulerRange();
            };

            sw.Vadjustment.ValueChanged += delegate {
                UpdateRulerRange();
            };

            PintaCore.Workspace.CanvasSizeChanged += delegate {
                UpdateRulerRange();
            };

            canvas.MotionNotifyEvent += delegate(object o, MotionNotifyEventArgs args) {
                if (!PintaCore.Workspace.HasOpenDocuments)
                {
                    return;
                }

                Cairo.PointD point = PintaCore.Workspace.WindowPointToCanvas(args.Event.X, args.Event.Y);

                hruler.Position = point.X;
                vruler.Position = point.Y;
            };

            mainTable.Attach(sw, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            sw.Add(vp);
            vp.Add(canvas);

            mainTable.ShowAll();
            canvas.Show();
            vp.Show();

            hruler.Visible = false;
            vruler.Visible = false;


            PintaCore.Chrome.InitializeCanvas(canvas);

            canvas.SizeAllocated += delegate { UpdateRulerRange(); };

            PintaCore.Actions.View.Rulers.Toggled        += HandleRulersToggled;
            PintaCore.Actions.View.Pixels.Activated      += (o, e) => { SetRulersUnit(MetricType.Pixels); };
            PintaCore.Actions.View.Inches.Activated      += (o, e) => { SetRulersUnit(MetricType.Inches); };
            PintaCore.Actions.View.Centimeters.Activated += (o, e) => { SetRulersUnit(MetricType.Centimeters); };
        }