コード例 #1
0
 // Handling the application startup layout.
 // If layout file is found the dock items would be restored as they were before the shut down.
 private void LoadLayout()
 {
     if (File.Exists(layoutFile))
     {
         dockFrame.LoadLayouts(System.IO.Path.Combine(applicationDataDir, "config.layout"));
     }
     else
     {
         dockFrame.CreateLayout("BasicLayout", /*copyCurrent*/ true);
     }
 }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: atom-cmd/Pinta
        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";
        }
コード例 #3
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
            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);

            // 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 = 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";
        }
コード例 #4
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);
    }