Пример #1
0
        private void CreateDockAndPads(HBox container)
        {
            Gtk.IconFactory fact = new Gtk.IconFactory();
            fact.Add("Tools.Pencil.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Tools.Pencil.png")));
            fact.Add("Pinta.png", new Gtk.IconSet(PintaCore.Resources.GetIcon("Pinta.png")));
            fact.AddDefault();

            // Dock widget
            dock = new DockFrame();
            dock.CompactGuiLevel = 5;

            var style = new DockVisualStyle();

            style.PadTitleLabelColor         = Styles.PadLabelColor;
            style.PadBackgroundColor         = Styles.PadBackground;
            style.InactivePadBackgroundColor = Styles.InactivePadBackground;
            style.TabStyle          = DockTabStyle.Normal;
            style.ShowPadTitleIcon  = false;
            dock.DefaultVisualStyle = style;

            // Toolbox pad
            var toolboxpad = new ToolBoxPad();

            toolboxpad.Initialize(dock, show_pad);

            // Palette pad
            var palettepad = new ColorPalettePad();

            palettepad.Initialize(dock, show_pad);

            // Canvas pad
            canvas_pad = new CanvasPad();
            canvas_pad.Initialize(dock, show_pad);

            dock_container = canvas_pad.NotebookContainer;

            // Layer pad
            var layers_pad = new LayersPad();

            layers_pad.Initialize(dock, show_pad);

            // Open Images pad
            var open_images_pad = new OpenImagesPad();

            open_images_pad.Initialize(dock, show_pad);

            // History pad
            var history_pad = new HistoryPad();

            history_pad.Initialize(dock, show_pad);

            container.PackStart(dock, true, true, 0);

            string layout_file = PintaCore.Settings.LayoutFilePath;

            if (System.IO.File.Exists(layout_file))
            {
                try
                {
                    dock.LoadLayouts(layout_file);
                }
                // If parsing layouts.xml fails for some reason, proceed to create the default layout.
                catch (Exception e)
                {
                    System.Console.Error.WriteLine("Error reading " + PintaCore.Settings.LayoutFile + ": " + e.ToString());
                }
            }

            if (!dock.HasLayout("Default"))
            {
                dock.CreateLayout("Default", false);
            }

            dock.CurrentLayout = "Default";
        }
Пример #2
0
        private void CreateComponents()
        {
            this.fullViewVBox = new VBox(false, 0);
            this.rootWidget   = (Gtk.Container) this.fullViewVBox;
            this.Realize();
            this.toolbar = MainWindowPartFactory.CreateMainToolbarWidget();
            HBox hbox1 = new HBox(false, 0);

            this.fullViewVBox.PackStart((Widget)hbox1, false, false, 0U);
            this.toolbarFrame = new DockToolbarFrame();
            this.fullViewVBox.PackStart((Widget)this.toolbarFrame, true, true, 0U);
            this.dock = new DockFrame();
            this.dock.DefaultItemWidth = (int)byte.MaxValue;
            this.dock.CompactGuiLevel  = 2;
            this.toolbarFrame.ModifyBg(StateType.Normal, new Gdk.Color(byte.MaxValue, (byte)0, (byte)0));
            this.toolbarFrame.AddContent((Widget)this.dock);
            this.tabControl = new MonoDevelop.Components.DockNotebook.DockNotebook();
            this.tabControl.NavigationButtonsVisible = false;
            this.tabControl.SwitchPage    += new EventHandler(this.OnActiveWindowChanged);
            this.tabControl.PageRemoved   += new EventHandler(this.OnActiveWindowChanged);
            this.tabControl.PageAdded     += new EventHandler(this.OnActiveWindowChanged);
            this.tabControl.TabClosed     += new EventHandler <TabEventArgs>(this.CloseClicked);
            this.tabControl.TabActivated  += (EventHandler <TabEventArgs>)((sender, e) => this.ToggleFullViewMode());
            this.tabControl.DoPopupMenu    = new System.Action <MonoDevelop.Components.DockNotebook.DockNotebook, int, EventButton>(this.ShowPopup);
            this.tabControl.TabsReordered += new TabsReorderedHandler(this.OnTabsReordered);
            MonoDevelop.Components.DockNotebook.DockNotebook.ActiveNotebookChanged += (EventHandler)((param0, param1) => this.OnActiveWindowChanged((object)null, (EventArgs)null));
            this.Add((Widget)this.fullViewVBox);
            this.fullViewVBox.ShowAll();
            HBox hbox2 = new HBox(false, 0);

            this.bottomBar = MainWindowPartFactory.CreateMainStatus();
            this.bottomBar.Show();
            hbox2.PackStart(this.bottomBar, true, true, 0U);
            this.fullViewVBox.PackEnd((Widget)hbox2, false, false, 0U);
            hbox2.ShowAll();
            hbox1.PackStart(this.toolbar, true, true, 0U);
            this.tabControl.InitSize();
            int barHeight = this.tabControl.BarHeight;

            this.documentDockItem                        = this.dock.AddItem("Documents");
            this.documentDockItem.Behavior               = DockItemBehavior.Locked;
            this.documentDockItem.Expand                 = true;
            this.documentDockItem.DrawFrame              = false;
            this.documentDockItem.Label                  = "Documents";
            this.documentDockItem.Content                = (Widget)this.tabControl;
            this.documentDockItem.ContentVisibleChanged += new EventHandler(this.DockTabControlVisibleChanged);
            this.dock.DefaultVisualStyle                 = new DockVisualStyle()
            {
                PadTitleLabelColor         = new Gdk.Color?(Styles.PadLabelColor),
                PadBackgroundColor         = new Gdk.Color?(Styles.PadBackground),
                InactivePadBackgroundColor = new Gdk.Color?(Styles.InactivePadBackground),
                PadTitleHeight             = new int?(barHeight)
            };
            DockVisualStyle style1 = new DockVisualStyle();

            style1.PadTitleLabelColor         = new Gdk.Color?(Styles.PadLabelColor);
            style1.PadTitleHeight             = new int?(barHeight);
            style1.ShowPadTitleIcon           = new bool?(false);
            style1.UppercaseTitles            = new bool?(false);
            style1.ExpandedTabs               = new bool?(true);
            style1.PadBackgroundColor         = new Gdk.Color?(Styles.BrowserPadBackground);
            style1.InactivePadBackgroundColor = new Gdk.Color?(Styles.InactiveBrowserPadBackground);
            style1.TreeBackgroundColor        = new Gdk.Color?(Styles.BrowserPadBackground);
            this.dock.SetDockItemStyle("ProjectPad", style1);
            this.dock.SetDockItemStyle("ClassPad", style1);
            this.dock.SetRegionStyle("Documents/Left", style1);
            this.dock.SetRegionStyle("Documents/Right", style1);
            DockVisualStyle style2 = new DockVisualStyle();

            style2.SingleColumnMode = new bool?(true);
            this.dock.SetRegionStyle("Documents/Left;Documents/Right", style2);
            this.dock.SetDockItemStyle("Documents", style2);
            DockItem dockItem1 = this.dock.AddItem("__left");

            dockItem1.DefaultLocation = "Documents/Left";
            dockItem1.Behavior        = DockItemBehavior.Locked;
            dockItem1.DefaultVisible  = false;
            DockItem dockItem2 = this.dock.AddItem("__bottom");

            dockItem2.DefaultLocation = "Documents/Bottom";
            dockItem2.Behavior        = DockItemBehavior.Locked;
            dockItem2.DefaultVisible  = false;
            DockItem dockItem3 = this.dock.AddItem("__right");

            dockItem3.DefaultLocation = "Documents/Right";
            dockItem3.Behavior        = DockItemBehavior.Locked;
            dockItem3.DefaultVisible  = false;
            DockItem dockItem4 = this.dock.AddItem("__top");

            dockItem4.DefaultLocation = "Documents/Top";
            dockItem4.Behavior        = DockItemBehavior.Locked;
            dockItem4.DefaultVisible  = false;
            foreach (ExtensionNode extensionNode in AddinManager.GetExtensionNodes("/CocoStudio/Ide/Pads"))
            {
                this.ShowPadNode(extensionNode);
            }
            this.InitializeLayout("DefaultLayout");
            this.LoadLayoutFromFile(MainWindow.configFile);
        }