Esempio n. 1
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;
        }
Esempio n. 2
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";
        }
Esempio n. 3
0
        async Task <bool> OpenDocumentsInContainer(ProgressMonitor pm, FilePath baseDir, List <Tuple <Document, string> > docViews, List <DocumentUserPrefs> list, DockNotebookContainer container)
        {
            int          currentNotebook = -1;
            DockNotebook nb = container.GetFirstNotebook();

            foreach (var doc in list)
            {
                string fileName = baseDir.Combine(doc.FileName).FullPath;
                if (GetDocument(fileName) == null && File.Exists(fileName))
                {
                    if (doc.NotebookId != currentNotebook)
                    {
                        if (currentNotebook != -1 || nb == null)
                        {
                            nb = container.InsertRight(null);
                        }
                        currentNotebook = doc.NotebookId;
                    }
                    // TODO: Get the correct project.
                    var document = await documentManager.BatchOpenDocument(pm, fileName, null, doc.Line, doc.Column, nb);

                    if (document != null)
                    {
                        var t = new Tuple <Document, string> (document, fileName);
                        docViews.Add(t);
                    }
                }
            }
            return(true);
        }
Esempio n. 4
0
        async Task <bool> OpenDocumentsInContainer(ProgressMonitor pm, FilePath baseDir, List <Tuple <Document, string> > docViews, List <DocumentUserPrefs> list, DockNotebookContainer container)
        {
            int          currentNotebook = -1;
            DockNotebook nb = container.GetFirstNotebook();

            foreach (var doc in list)
            {
                string fileName = baseDir.Combine(doc.FileName).FullPath;
                if (GetDocument(fileName) == null && File.Exists(fileName))
                {
                    if (doc.NotebookId != currentNotebook)
                    {
                        if (currentNotebook != -1 || nb == null)
                        {
                            nb = container.InsertRight(null);
                        }
                        currentNotebook = doc.NotebookId;
                    }
                    // TODO: Get the correct project.
                    var document = await documentManager.BatchOpenDocument(pm, fileName, null, doc.Line, doc.Column, nb);

                    if (document != null)
                    {
                        try {
                            var tab = ((SdiWorkspaceWindow)document.Window).DockNotebookTab;
                            if (tab != null)
                            {
                                tab.IsPinned = doc.IsPinned;
                            }
                        } catch (Exception ex) {
                            LoggingService.LogInternalError(ex);
                        }

                        var t = new Tuple <Document, string> (document, fileName);
                        docViews.Add(t);
                    }
                }
            }
            return(true);
        }