Beispiel #1
0
        /// <summary>
        /// Gets the style for a dock object, which will inherit values from all region/style definitions
        /// </summary>
        internal DockVisualStyle GetRegionStyleForObject(DockObject obj)
        {
            DockVisualStyle mergedStyle = null;

            if (obj is DockGroupItem)
            {
                DockVisualStyle s;
                if (stylesById.TryGetValue(((DockGroupItem)obj).Id, out s))
                {
                    mergedStyle = DefaultVisualStyle.Clone();
                    mergedStyle.CopyValuesFrom(s);
                }
            }
            foreach (var e in regionStyles)
            {
                if (InRegion(e.Item1, obj))
                {
                    if (mergedStyle == null)
                    {
                        mergedStyle = DefaultVisualStyle.Clone();
                    }
                    mergedStyle.CopyValuesFrom(e.Item2);
                }
            }
            return(mergedStyle ?? DefaultVisualStyle);
        }
Beispiel #2
0
        public DockFrame()
        {
            GtkWorkarounds.FixContainerLeak(this);

            dockBarTop    = new DockBar(this, Gtk.PositionType.Top);
            dockBarBottom = new DockBar(this, Gtk.PositionType.Bottom);
            dockBarLeft   = new DockBar(this, Gtk.PositionType.Left);
            dockBarRight  = new DockBar(this, Gtk.PositionType.Right);

            container = new DockContainer(this);
            HBox hbox = new HBox();

            hbox.PackStart(dockBarLeft, false, false, 0);
            hbox.PackStart(container, true, true, 0);
            hbox.PackStart(dockBarRight, false, false, 0);
            mainBox = new VBox();
            mainBox.PackStart(dockBarTop, false, false, 0);
            mainBox.PackStart(hbox, true, true, 0);
            mainBox.PackStart(dockBarBottom, false, false, 0);
            Add(mainBox);
            mainBox.ShowAll();
            mainBox.NoShowAll = true;
            CompactGuiLevel   = 2;
            UpdateDockbarsVisibility();

            DefaultVisualStyle = new DockVisualStyle();
        }
Beispiel #3
0
		public void CopyValuesFrom (DockVisualStyle style)
		{
			if (style.PadBackgroundColor != null)
				PadBackgroundColor = style.PadBackgroundColor;
			if (style.PadTitleLabelColor != null)
				PadTitleLabelColor = style.PadTitleLabelColor;
			if (style.TabStyle != null)
				TabStyle = style.TabStyle;
			if (style.TreeBackgroundColor != null)
				TreeBackgroundColor = style.TreeBackgroundColor;
			if (style.ShowPadTitleIcon != null)
				ShowPadTitleIcon = style.ShowPadTitleIcon;
			if (style.UppercaseTitles != null)
				UppercaseTitles = style.UppercaseTitles;
			if (style.ExpandedTabs != null)
				ExpandedTabs = style.ExpandedTabs;
			if (style.InactivePadBackgroundColor != null)
				InactivePadBackgroundColor = style.InactivePadBackgroundColor;
			if (style.PadTitleHeight != null)
				PadTitleHeight = style.PadTitleHeight;
			if (style.SingleColumnMode != null)
				SingleColumnMode = style.SingleColumnMode;
			if (style.SingleRowMode != null)
				SingleRowMode = style.SingleRowMode;
		}
Beispiel #4
0
 /// <summary>
 /// Sets the style for a region of the dock frame
 /// </summary>
 /// <param name='regionPosition'>
 /// A region is a collection with the format: "ItemId1/Position1;ItemId2/Position2..."
 /// ItemId is the id of a dock item. Position is one of the values of the DockPosition enumeration
 /// </param>
 /// <param name='style'>
 /// Style.
 /// </param>
 public void SetRegionStyle(string regionPosition, DockVisualStyle style)
 {
     // Remove any old region style and add it
     regionStyles.RemoveAll(s => s.Item1 == regionPosition);
     if (style != null)
     {
         regionStyles.Add(new Tuple <string, DockVisualStyle> (regionPosition, style));
     }
 }
Beispiel #5
0
 public void SetDockItemStyle(string itemId, DockVisualStyle style)
 {
     if (style != null)
     {
         stylesById [itemId] = style;
     }
     else
     {
         stylesById.Remove(itemId);
     }
 }
Beispiel #6
0
		public static DockVisualStyle CreateDefaultStyle ()
		{
			DockVisualStyle s = new DockVisualStyle ();
			s.PadBackgroundColor = new Gdk.Color (0,0,0);
			s.PadTitleLabelColor = new Gdk.Color (0,0,0);
			s.TabStyle = DockTabStyle.Normal;
			s.TreeBackgroundColor = null;
			s.ShowPadTitleIcon = true;
			s.UppercaseTitles = false;
			s.ExpandedTabs = false;
			s.InactivePadBackgroundColor = new Gdk.Color (0,0,0);
			s.PadTitleHeight = -1;
			s.SingleRowMode = false;
			s.SingleColumnMode = false;
			return s;
		}
Beispiel #7
0
 public void CopyValuesFrom(DockVisualStyle style)
 {
     if (style.PadBackgroundColor != null)
     {
         PadBackgroundColor = style.PadBackgroundColor;
     }
     if (style.PadTitleLabelColor != null)
     {
         PadTitleLabelColor = style.PadTitleLabelColor;
     }
     if (style.TabStyle != null)
     {
         TabStyle = style.TabStyle;
     }
     if (style.TreeBackgroundColor != null)
     {
         TreeBackgroundColor = style.TreeBackgroundColor;
     }
     if (style.ShowPadTitleIcon != null)
     {
         ShowPadTitleIcon = style.ShowPadTitleIcon;
     }
     if (style.UppercaseTitles != null)
     {
         UppercaseTitles = style.UppercaseTitles;
     }
     if (style.ExpandedTabs != null)
     {
         ExpandedTabs = style.ExpandedTabs;
     }
     if (style.InactivePadBackgroundColor != null)
     {
         InactivePadBackgroundColor = style.InactivePadBackgroundColor;
     }
     if (style.PadTitleHeight != null)
     {
         PadTitleHeight = style.PadTitleHeight;
     }
     if (style.SingleColumnMode != null)
     {
         SingleColumnMode = style.SingleColumnMode;
     }
     if (style.SingleRowMode != null)
     {
         SingleRowMode = style.SingleRowMode;
     }
 }
Beispiel #8
0
        /// <summary>
        /// Gets the style assigned to a specific position of the layout
        /// </summary>
        /// <returns>
        /// The region style for position.
        /// </returns>
        /// <param name='parentGroup'>
        /// Group which contains the position
        /// </param>
        /// <param name='childIndex'>
        /// Index of the position inside the group
        /// </param>
        /// <param name='insertingPosition'>
        /// If true, the position will be inserted (meaning that the objects in childIndex will be shifted 1 position)
        /// </param>
        internal DockVisualStyle GetRegionStyleForPosition(DockGroup parentGroup, int childIndex, bool insertingPosition)
        {
            DockVisualStyle mergedStyle = null;

            foreach (var e in regionStyles)
            {
                if (InRegion(e.Item1, parentGroup, childIndex, insertingPosition))
                {
                    if (mergedStyle == null)
                    {
                        mergedStyle = DefaultVisualStyle.Clone();
                    }
                    mergedStyle.CopyValuesFrom(e.Item2);
                }
            }
            return(mergedStyle ?? DefaultVisualStyle);
        }
Beispiel #9
0
        public static DockVisualStyle CreateDefaultStyle()
        {
            DockVisualStyle s = new DockVisualStyle();

            s.PadBackgroundColor         = new Gdk.Color(0, 0, 0);
            s.PadTitleLabelColor         = new Gdk.Color(0, 0, 0);
            s.TabStyle                   = DockTabStyle.Normal;
            s.TreeBackgroundColor        = null;
            s.ShowPadTitleIcon           = true;
            s.UppercaseTitles            = false;
            s.ExpandedTabs               = false;
            s.InactivePadBackgroundColor = new Gdk.Color(0, 0, 0);
            s.PadTitleHeight             = -1;
            s.SingleRowMode              = false;
            s.SingleColumnMode           = false;
            return(s);
        }
Beispiel #10
0
        void UpdateStyle()
        {
            var s = itemStyle != null ? itemStyle : regionStyle;

            if (s != currentVisualStyle)
            {
                currentVisualStyle = s;
                if (titleTab != null)
                {
                    titleTab.VisualStyle = s;
                }
                if (widget != null)
                {
                    widget.VisualStyle = s;
                }
                frame.UpdateStyle(this);
            }
        }
Beispiel #11
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";
		}
Beispiel #12
0
		void UpdateStyle ()
		{
			var s = itemStyle != null ? itemStyle : regionStyle;
			if (s != currentVisualStyle) {
				currentVisualStyle = s;
				if (titleTab != null)
					titleTab.VisualStyle = s;
				if (widget != null)
					widget.VisualStyle = s;
				frame.UpdateStyle (this);
			}
		}
Beispiel #13
0
 internal void SetStyle(DockVisualStyle style)
 {
     topFrame.BackgroundColor = style.PadBackgroundColor.Value;
 }
Beispiel #14
0
		internal DockItem (DockFrame frame, string id)
		{
			this.frame = frame;
			this.id = id;
			currentVisualStyle = regionStyle = frame.GetRegionStyleForItem (this);
		}
Beispiel #15
0
 internal DockItem(DockFrame frame, string id)
 {
     this.frame         = frame;
     this.id            = id;
     currentVisualStyle = regionStyle = frame.GetRegionStyleForItem(this);
 }
Beispiel #16
0
 internal void SetRegionStyle(DockVisualStyle style)
 {
     regionStyle = style;
     UpdateStyle();
 }
Beispiel #17
0
		internal void SetStyle (DockVisualStyle style)
		{
			topFrame.BackgroundColor = style.PadBackgroundColor.Value;
		}
Beispiel #18
0
		/// <summary>
		/// Sets the style for a region of the dock frame
		/// </summary>
		/// <param name='regionPosition'>
		/// A region is a collection with the format: "ItemId1/Position1;ItemId2/Position2..."
		/// ItemId is the id of a dock item. Position is one of the values of the DockPosition enumeration
		/// </param>
		/// <param name='style'>
		/// Style.
		/// </param>
		public void SetRegionStyle (string regionPosition, DockVisualStyle style)
		{
			// Remove any old region style and add it
			regionStyles.RemoveAll (s => s.Item1 == regionPosition);
			if (style != null)
				regionStyles.Add (new Tuple<string,DockVisualStyle> (regionPosition, style));
		}
Beispiel #19
0
		internal void SetRegionStyle (DockVisualStyle style)
		{
			regionStyle = style;
			UpdateStyle ();
		}
Beispiel #20
0
		public void SetDockItemStyle (string itemId, DockVisualStyle style)
		{
			if (style != null)
				stylesById [itemId] = style;
			else
				stylesById.Remove (itemId);
		}
Beispiel #21
0
		public DockFrame ()
		{
            GtkWorkarounds.FixContainerLeak (this);

			dockBarTop = new DockBar (this, Gtk.PositionType.Top);
			dockBarBottom = new DockBar (this, Gtk.PositionType.Bottom);
			dockBarLeft = new DockBar (this, Gtk.PositionType.Left);
			dockBarRight = new DockBar (this, Gtk.PositionType.Right);
			
			container = new DockContainer (this);
			HBox hbox = new HBox ();
			hbox.PackStart (dockBarLeft, false, false, 0);
			hbox.PackStart (container, true, true, 0);
			hbox.PackStart (dockBarRight, false, false, 0);
			mainBox = new VBox ();
			mainBox.PackStart (dockBarTop, false, false, 0);
			mainBox.PackStart (hbox, true, true, 0);
			mainBox.PackStart (dockBarBottom, false, false, 0);
			Add (mainBox);
			mainBox.ShowAll ();
			mainBox.NoShowAll = true;
			CompactGuiLevel = 2;
			UpdateDockbarsVisibility ();

			DefaultVisualStyle = new DockVisualStyle ();
		}