void CreateComponents ()
		{
			fullViewVBox = new VBox (false, 0);
			rootWidget = fullViewVBox;
			
			InstallMenuBar ();
			
			toolbarFrame = new CommandFrame (IdeApp.CommandService);
			fullViewVBox.PackStart (toolbarFrame, true, true, 0);
			
			foreach (DockToolbar t in toolbars)
				toolbarFrame.AddBar (t);
			
			// Create the docking widget and add it to the window.
			dock = new DockFrame ();
			
			dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
			IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
				dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
			};
			
			/* Side bar is experimental. Disabled for now
			HBox hbox = new HBox ();
			VBox sideBox = new VBox ();
			sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
			hbox.PackStart (sideBox, false, false, 0);
			hbox.ShowAll ();
			sideBox.NoShowAll = true;
			hbox.PackStart (dock, true, true, 0);
			DockBar bar = dock.ExtractDockBar (PositionType.Left);
			bar.AlwaysVisible = true;
			sideBox.PackStart (bar, true, true, 0);
			toolbarFrame.AddContent (hbox);
			*/

			toolbarFrame.AddContent (dock);
			
			// Create the notebook for the various documents.
			tabControl = new SdiDragNotebook (dock.ShadedContainer);
			tabControl.Scrollable = true;
			tabControl.SwitchPage += OnActiveWindowChanged;
			tabControl.PageAdded += delegate { OnActiveWindowChanged (null, null); };
			tabControl.PageRemoved += delegate { OnActiveWindowChanged (null, null); };
		
			tabControl.ButtonPressEvent += delegate(object sender, ButtonPressEventArgs e) {
				int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
				if (tab < 0)
					return;
				tabControl.CurrentPage = tab;
				if (e.Event.Type == Gdk.EventType.TwoButtonPress)
					ToggleFullViewMode ();
			};
			
			this.tabControl.PopupMenu += delegate {
				ShowPopup ();
			};
			this.tabControl.ButtonReleaseEvent += delegate (object sender, Gtk.ButtonReleaseEventArgs e) {
				int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
				if (tab < 0)
					return;
				if (e.Event.Button == 3)
					ShowPopup ();
			};
			
			tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered);

			// The main document area
			documentDockItem = dock.AddItem ("Documents");
			documentDockItem.Behavior = DockItemBehavior.Locked;
			documentDockItem.Expand = true;
			documentDockItem.DrawFrame = false;
			documentDockItem.Label = GettextCatalog.GetString ("Documents");
			documentDockItem.Content = tabControl;
			
			// Add some hiden items to be used as position reference
			DockItem dit = dock.AddItem ("__left");
			dit.DefaultLocation = "Documents/Left";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__right");
			dit.DefaultLocation = "Documents/Right";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__top");
			dit.DefaultLocation = "Documents/Top";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__bottom");
			dit.DefaultLocation = "Documents/Bottom";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;

			Add (fullViewVBox);
			fullViewVBox.ShowAll ();
			
			fullViewVBox.PackEnd (this.StatusBar, false, true, 0);
			
			if (MonoDevelop.Core.PropertyService.IsMac)
				this.StatusBar.HasResizeGrip = true;
			else {
				if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
					IdeApp.Workbench.StatusBar.HasResizeGrip = false;
				SizeAllocated += delegate {
					if (GdkWindow != null)
						IdeApp.Workbench.StatusBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
				};
			}

			// create DockItems for all the pads
			foreach (PadCodon content in padContentCollection)
				AddPad (content, content.DefaultPlacement, content.DefaultStatus);
			
			try {
				if (System.IO.File.Exists (configFile)) {
					dock.LoadLayouts (configFile);
					foreach (string layout in dock.Layouts) {
						if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
							layouts.Add (layout);
					}
				}
			} catch (Exception ex) {
				LoggingService.LogError (ex.ToString ());
			}
		}
        void CreateComponents()
        {
            fullViewVBox = new VBox (false, 0);
            rootWidget = fullViewVBox;

            InstallMenuBar ();
            Realize ();
            toolbar = DesktopService.CreateMainToolbar (this);
            DesktopService.SetMainWindowDecorations (this);
            var toolbarBox = new HBox ();
            fullViewVBox.PackStart (toolbarBox, false, false, 0);
            toolbarFrame = new CommandFrame (IdeApp.CommandService);

            fullViewVBox.PackStart (toolbarFrame, true, true, 0);

            // Create the docking widget and add it to the window.
            dock = new DockFrame ();

            dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
                dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            };

            /* Side bar is experimental. Disabled for now
            HBox hbox = new HBox ();
            VBox sideBox = new VBox ();
            sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
            hbox.PackStart (sideBox, false, false, 0);
            hbox.ShowAll ();
            sideBox.NoShowAll = true;
            hbox.PackStart (dock, true, true, 0);
            DockBar bar = dock.ExtractDockBar (PositionType.Left);
            bar.AlwaysVisible = true;
            sideBox.PackStart (bar, true, true, 0);
            toolbarFrame.AddContent (hbox);
            */

            toolbarFrame.AddContent (dock);

            // Create the notebook for the various documents.
            tabControl = new SdiDragNotebook (this);

            DockNotebook.ActiveNotebookChanged += delegate {
                OnActiveWindowChanged (null, null);
            };

            Add (fullViewVBox);
            fullViewVBox.ShowAll ();
            bottomBar = new MonoDevelopStatusBar ();
            fullViewVBox.PackEnd (bottomBar, false, true, 0);
            bottomBar.ShowAll ();
            toolbarBox.PackStart (this.toolbar, true, true, 0);

            // In order to get the correct bar height we need to calculate the tab size using the
            // correct style (the style of the window). At this point the widget is not yet a child
            // of the window, so its style is not yet the correct one.
            tabControl.InitSize ();
            var barHeight = tabControl.BarHeight;

            // The main document area
            documentDockItem = dock.AddItem ("Documents");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;
            documentDockItem.DrawFrame = false;
            documentDockItem.Label = GettextCatalog.GetString ("Documents");
            documentDockItem.Content = new DockNotebookContainer (tabControl, true);

            DockVisualStyle style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadBackgroundColor = Styles.PadBackground;
            style.InactivePadBackgroundColor = Styles.InactivePadBackground;
            style.PadTitleHeight = barHeight;
            dock.DefaultVisualStyle = style;

            style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadTitleHeight = barHeight;
            style.ShowPadTitleIcon = false;
            style.UppercaseTitles = false;
            style.ExpandedTabs = true;
            style.PadBackgroundColor = Styles.BrowserPadBackground;
            style.InactivePadBackgroundColor = Styles.InactiveBrowserPadBackground;
            style.TreeBackgroundColor = Styles.BrowserPadBackground;
            dock.SetDockItemStyle ("ProjectPad", style);
            dock.SetDockItemStyle ("ClassPad", style);

            //			dock.SetRegionStyle ("Documents/Left", style);
            //dock.SetRegionStyle ("Documents/Right", style);

            //			style = new DockVisualStyle ();
            //			style.SingleColumnMode = true;
            //			dock.SetRegionStyle ("Documents/Left;Documents/Right", style);
            //			dock.SetDockItemStyle ("Documents", style);

            // Add some hiden items to be used as position reference
            DockItem dit = dock.AddItem ("__left");
            dit.DefaultLocation = "Documents/Left";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__right");
            dit.DefaultLocation = "Documents/Right";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__top");
            dit.DefaultLocation = "Documents/Top";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__bottom");
            dit.DefaultLocation = "Documents/Bottom";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            if (MonoDevelop.Core.Platform.IsMac)
                bottomBar.HasResizeGrip = true;
            else {
                if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
                    bottomBar.HasResizeGrip = false;
                SizeAllocated += delegate {
                    if (GdkWindow != null)
                        bottomBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
                };
            }

            // create DockItems for all the pads
            ExtensionNodeList padCodons = AddinManager.GetExtensionNodes (viewContentPath);
            foreach (ExtensionNode node in padCodons)
                ShowPadNode (node);

            try {
                if (System.IO.File.Exists (configFile)) {
                    dock.LoadLayouts (configFile);
                    foreach (string layout in dock.Layouts) {
                        if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
                            layouts.Add (layout);
                    }
                }
            } catch (Exception ex) {
                LoggingService.LogError (ex.ToString ());
            }
        }
Beispiel #3
0
        private void CreateDockAndPads(HBox container)
        {
            // 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
            };

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

            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 ();

            // Toolbox pad
            DockItem toolbox_item = dock.AddItem ("Toolbox");
            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.Action show_toolbox = show_pad.AppendAction ("Tools", Catalog.GetString ("Tools"), null, "Tools.Pencil.png");
            show_toolbox.Activated += delegate { toolbox_item.Visible = true; };

            // Palette pad
            DockItem palette_item = dock.AddItem ("Palette");
            color = new ColorPaletteWidget () { Name = "color" };

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

            Gtk.Action show_palette = show_pad.AppendAction ("Palette", Catalog.GetString ("Palette"), null, "Pinta.png");
            show_palette.Activated += delegate { palette_item.Visible = true; };

            // Canvas pad
            DockItem documentDockItem = dock.AddItem ("Canvas");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;

            documentDockItem.DrawFrame = false;
            documentDockItem.Label = Catalog.GetString ("Documents");
            documentDockItem.Content = mainTable;

            //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 ();

            HideRulers();

            // Layer pad
            layers = new LayersListWidget ();
            DockItem layers_item = dock.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_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.Action show_layers = show_pad.AppendAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png");
            show_layers.Activated += delegate { layers_item.Visible = true; };

            // History pad
            HistoryTreeView history = new HistoryTreeView ();
            DockItem history_item = dock.AddItem ("History");
            DockItemToolbar history_tb = history_item.GetToolbar (PositionType.Bottom);

            history_item.Label = Catalog.GetString ("History");
            history_item.DefaultLocation = "Layers/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.Action show_history = show_pad.AppendAction ("History", Catalog.GetString ("History"), null, "Menu.Layers.DuplicateLayer.png");
            show_history.Activated += delegate { history_item.Visible = true; };

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

            string layout_file = System.IO.Path.Combine (PintaCore.Settings.GetUserSettingsDirectory (), "layouts.xml");

            if (System.IO.File.Exists (layout_file))
                dock.LoadLayouts (layout_file);

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

            dock.CurrentLayout = "Default";
        }
Beispiel #4
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;

            // Toolbox pad
            var toolboxpad = new ToolBoxPad ();
            toolboxpad.Initialize (dock, show_pad);

            // Palette pad
            var palettepad = new ColorPalettePad ();
            palettepad.Initialize (dock, show_pad);

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

            sw = canvas_pad.ScrolledWindow;

            // Layer pad
            var layers_pad = new LayersPad ();
            layers_pad.Initialize (dock, show_pad);

            // History pad
            var history_pad = new HistoryPad ();
            history_pad.Initialize (dock, show_pad);

            // Open Images pad
            var open_images_pad = new OpenImagesPad ();
            open_images_pad.Initialize (dock, show_pad);

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

            string layout_file = System.IO.Path.Combine (PintaCore.Settings.GetUserSettingsDirectory (), "layouts.xml");

            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 layouts.xml: " + e.ToString());
                }
            }

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

            dock.CurrentLayout = "Default";
        }
Beispiel #5
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;

            // Toolbox pad
            var toolboxpad = new ToolBoxPad ();
            toolboxpad.Initialize (dock, show_pad);

            // Palette pad
            var palettepad = new ColorPalettePad ();
            palettepad.Initialize (dock, show_pad);

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

            sw = canvas_pad.ScrolledWindow;

            // Layer pad
            var layers_pad = new LayersPad ();
            layers_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 = System.IO.Path.Combine (PintaCore.Settings.GetUserSettingsDirectory (), "layouts.xml");

            if (System.IO.File.Exists (layout_file))
                dock.LoadLayouts (layout_file);

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

            dock.CurrentLayout = "Default";
        }
Beispiel #6
0
        private void CreateDockAndPads(HBox container)
        {
            // Create canvas
            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
            };

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

            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 ();

            // Toolbox pad
            DockItem toolbox_item = dock.AddItem ("Toolbox");
            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.Action show_toolbox = show_pad.AppendAction ("Tools", Catalog.GetString ("Tools"), null, "Tools.Pencil.png");
            show_toolbox.Activated += delegate { toolbox_item.Visible = true; };

            // Palette pad
            DockItem palette_item = dock.AddItem ("Palette");
            color = new ColorPaletteWidget () { Name = "color" };

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

            Gtk.Action show_palette = show_pad.AppendAction ("Palette", Catalog.GetString ("Palette"), null, "Pinta.png");
            show_palette.Activated += delegate { palette_item.Visible = true; };

            // Canvas pad
            DockItem documentDockItem = dock.AddItem ("Canvas");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;

            documentDockItem.DrawFrame = false;
            documentDockItem.Label = Catalog.GetString ("Documents");
            documentDockItem.Content = sw;

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

            canvas.Show ();
            vp.Show ();

            // Layer pad
            LayersListWidget layers = new LayersListWidget ();
            DockItem layers_item = dock.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_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.Action show_layers = show_pad.AppendAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png");
            show_layers.Activated += delegate { layers_item.Visible = true; };

            // History pad
            HistoryTreeView history = new HistoryTreeView ();
            DockItem history_item = dock.AddItem ("History");
            DockItemToolbar history_tb = history_item.GetToolbar (PositionType.Bottom);

            history_item.Label = Catalog.GetString ("History");
            history_item.DefaultLocation = "Layers/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.Action show_history = show_pad.AppendAction ("History", Catalog.GetString ("History"), null, "Menu.Layers.DuplicateLayer.png");
            show_history.Activated += delegate { history_item.Visible = true; };

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

            string layout_file = System.IO.Path.Combine (PintaCore.Settings.GetUserSettingsDirectory (), "layouts.xml");

            if (System.IO.File.Exists (layout_file))
                dock.LoadLayouts (layout_file);

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

            dock.CurrentLayout = "Default";
        }
        public MainWindow()
            : base("This is a window test")
        {
            DeleteEvent += onDeleteEvent;
            SetSizeRequest( 800, 600 );

            df = new DockFrame();
            df.DefaultItemHeight = 100;
            df.DefaultItemWidth = 100;
            //df.Homogeneous = false;

            Add( df );

            DockItem doc_item = df.AddItem( "Document" );
            doc_item.Behavior = DockItemBehavior.CantClose;
            doc_item.Expand = true;
            doc_item.DrawFrame = true;
            doc_item.Label = "Documentos";
            Gtk.Notebook nb = new Notebook();
            nb.AppendPage( new Label( "Other page" ), new Label( "The label" ) );
            nb.AppendPage( new TextView(), new Image( "gtk-new", IconSize.Menu ) );
            nb.ShowAll();
            doc_item.Content = nb;
            doc_item.DefaultVisible = true;
            doc_item.Visible = true;

            DockItem left = df.AddItem( "left" );
            left.Behavior = DockItemBehavior.NeverHorizontal;
            left.DefaultLocation = "Document/Left";
            left.DefaultVisible = true;
            left.Visible = true;
            left.Label = "Left";
            left.DrawFrame = true;
            left.Content = new Label( "This is a test" );

            DockItem right = df.AddItem( "right" );
            right.Behavior = DockItemBehavior.CantClose;
            right.DefaultLocation = "Document/Right";
            right.DefaultVisible = true;
            right.Visible = true;
            right.Label = "Right";
            right.DrawFrame = true;
            right.Content = new Label( "CONTENT" );
            //right.Icon = "gtk-close";

            DockItem rb = df.AddItem( "right_bottom" );
            rb.Behavior = DockItemBehavior.CantClose;
            rb.DefaultLocation = "right/Bottom";
            rb.DefaultVisible = true;
            rb.Visible = true;
            rb.Label = "Right bottom";
            rb.DrawFrame = true;
            rb.Content = new Button( "A BUTTON!" );
            rb.Behavior = DockItemBehavior.CantClose;
            //rb.Icon = "gtk-new";

            if ( File.Exists( "config.layout" ) )
            {
                df.LoadLayouts( "config.layout" );
            }
            else
            {
                df.CreateLayout( "test", true );
            }
            df.CurrentLayout = "test";
            df.HandlePadding = 0;
            df.HandleSize = 10;

            ShowAll();
        }