public DockItemContainer (DockFrame frame, DockItem item) { this.item = item; mainBox = new VBox (); Add (mainBox); mainBox.ResizeMode = Gtk.ResizeMode.Queue; mainBox.Spacing = 0; ShowAll (); mainBox.PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0); HBox hbox = new HBox (); hbox.Show (); hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0); contentBox = new HBox (); contentBox.Show (); hbox.PackStart (contentBox, true, true, 0); hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0); mainBox.PackStart (hbox, true, true, 0); mainBox.PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 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.DefaultWidth = 100; 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 (); }; }
public DockContainer (DockFrame frame) { GtkWorkarounds.FixContainerLeak (this); this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask; this.frame = frame; }
public PlaceholderWindow (DockFrame frame): base (Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window) frame.Toplevel; TypeHint = WindowTypeHint.Utility; // Create the mask for the arrow Realize (); redgc = new Gdk.GC (GdkWindow); redgc.RgbFgColor = frame.Style.Background (StateType.Selected); }
public TabStrip (DockFrame frame) { VBox vbox = new VBox (); box = new TabStripBox () { TabStrip = this }; vbox.PackStart (box, false, false, 0); // vbox.PackStart (bottomFiller, false, false, 0); Add (vbox); ShowAll (); bottomFiller.Hide (); BottomPadding = 3; WidthRequest = 0; box.Removed += HandleRemoved; }
public DockItemTitleTab (DockItem item, DockFrame frame) { this.item = item; this.frame = frame; this.VisibleWindow = false; UpdateVisualStyle (); NoShowAll = true; Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask; KeyPressEvent += HeaderKeyPress; KeyReleaseEvent += HeaderKeyRelease; this.SubscribeLeaveEvent (OnLeave); }
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; }
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 = 35; 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; }
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 = 35; 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; }
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; }; }
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_item.DefaultWidth = 100; 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; }
internal DockBar (DockFrame frame, Gtk.PositionType position) { VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment (0,0,0,0); if (Orientation == Gtk.Orientation.Horizontal) box = new HBox (); else box = new VBox (); al.Add (box); Add (al); filler = new Label (); filler.WidthRequest = 4; filler.HeightRequest = 4; box.PackEnd (filler); ShowAll (); UpdateVisibility (); }
public DockGroupItem (DockFrame frame, DockItem item): base (frame) { this.item = item; visibleFlag = item.Visible; }
public DockObject (DockFrame frame) { this.frame = frame; }
public virtual void CopyFrom (DockObject ob) { parentGroup = null; frame = ob.frame; rect = ob.rect; size = ob.size; allocSize = ob.allocSize; defaultHorSize = ob.defaultHorSize; defaultVerSize = ob.defaultVerSize; prefSize = ob.prefSize; }
internal DockItem (DockFrame frame, Widget w, string id): this (frame, id) { content = w; }
public PadTitleWindow (DockFrame frame, DockItem draggedItem) : base (Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window)frame.Toplevel; TypeHint = WindowTypeHint.Utility; var mainBox = new VBox (); var box = new HBox (false, 3); if (draggedItem.Icon != null) { var img = new ImageView (draggedItem.Icon); box.PackStart (img, false, false, 0); } var la = new Label (); la.Markup = draggedItem.Label; box.PackStart (la, false, false, 0); mainBox.PackStart (box, false, false, 0); var f = new CustomFrame (); f.SetPadding (12, 12, 12, 12); f.SetMargins (1, 1, 1, 1); f.Add (mainBox); Add (f); ShowAll (); }
internal DockGroup (DockFrame frame): base (frame) { }
internal DockItem (DockFrame frame, string id) { this.frame = frame; this.id = id; currentVisualStyle = regionStyle = frame.GetRegionStyleForItem (this); }
public PadTitleWindow (DockFrame frame, DockItem draggedItem): base (Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window) frame.Toplevel; TypeHint = WindowTypeHint.Utility; VBox mainBox = new VBox (); HBox box = new HBox (false, 3); if (draggedItem.Icon != null) { var img = new ImageView (draggedItem.Icon); box.PackStart (img, false, false, 0); } Gtk.Label la = new Label (); la.Markup = draggedItem.Label; box.PackStart (la, false, false, 0); mainBox.PackStart (box, false, false, 0); /* if (draggedItem.Widget.IsRealized) { var win = draggedItem.Widget.GdkWindow; var alloc = draggedItem.Widget.Allocation; Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, alloc.X, alloc.Y, 0, 0, alloc.Width, alloc.Height); double mw = 140, mh = 140; if (img.Width > img.Height) mw *= 2; else mh *= 2; double r = Math.Min (mw / img.Width, mh / img.Height); img = img.ScaleSimple ((int)(img.Width * r), (int)(img.Height * r), Gdk.InterpType.Hyper); mainBox.PackStart (new Gtk.Image (img), false, false, 0); }*/ CustomFrame f = new CustomFrame (); f.SetPadding (12, 12, 12, 12); f.SetMargins (1, 1, 1, 1); f.Add (mainBox); Add (f); ShowAll (); }
public static DockLayout Read (DockFrame frame, XmlReader reader) { DockLayout layout = new DockLayout (frame); layout.Read (reader); return layout; }
public DockLayout (DockFrame frame): base (frame, DockGroupType.Horizontal) { }
public DockFrameTopLevel (DockFrame frame) { this.frame = frame; }
public DockGroup (DockFrame frame, DockGroupType type): base (frame) { this.type = type; }
public AutoHideBox (DockFrame frame, DockItem item, Gtk.PositionType pos, int size): base (frame) { this.position = pos; this.frame = frame; this.targetSize = size; horiz = pos == PositionType.Left || pos == PositionType.Right; startPos = pos == PositionType.Top || pos == PositionType.Left; Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; Box fr; CustomFrame cframe = new CustomFrame (); switch (pos) { case PositionType.Left: cframe.SetMargins (0, 0, 1, 1); break; case PositionType.Right: cframe.SetMargins (0, 0, 1, 1); break; case PositionType.Top: cframe.SetMargins (1, 1, 0, 0); break; case PositionType.Bottom: cframe.SetMargins (1, 1, 0, 0); break; } if (frame.UseWindowsForTopLevelFrames) { // When using a top level window on mac, clicks on the first 4 pixels next to the border // are not detected. To avoid confusing the user (since the resize cursor is shown), // we make the resize drag area smaller. switch (pos) { case PositionType.Left: cframe.SetPadding (0, 0, 0, 4); gripSize = 4; break; case PositionType.Right: cframe.SetPadding (0, 0, 4, 0); gripSize = 4; break; } } EventBox sepBox = new EventBox (); cframe.Add (sepBox); if (horiz) { fr = new HBox (); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; }; sepBox.WidthRequest = gripSize; } else { fr = new VBox (); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; }; sepBox.HeightRequest = gripSize; } sepBox.Events = EventMask.AllEventsMask; if (pos == PositionType.Left || pos == PositionType.Top) fr.PackEnd (cframe, false, false, 0); else fr.PackStart (cframe, false, false, 0); Add (fr); ShowAll (); Hide (); #if ANIMATE_DOCKING scrollable = new ScrollableContainer (); scrollable.ScrollMode = false; scrollable.Show (); #endif VBox itemBox = new VBox (); itemBox.Show (); item.TitleTab.Active = true; itemBox.PackStart (item.TitleTab, false, false, 0); itemBox.PackStart (item.Widget, true, true, 0); item.Widget.Show (); #if ANIMATE_DOCKING scrollable.Add (itemBox); fr.PackStart (scrollable, true, true, 0); #else fr.PackStart (itemBox, true, true, 0); #endif sepBox.ButtonPressEvent += OnSizeButtonPress; sepBox.ButtonReleaseEvent += OnSizeButtonRelease; sepBox.MotionNotifyEvent += OnSizeMotion; sepBox.ExposeEvent += OnGripExpose; sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw (); }; sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw (); }; }
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"; }