コード例 #1
0
ファイル: DockFrame.cs プロジェクト: ywscr/Pinta
        public void LoadLayouts(XmlReader reader)
        {
            layouts.Clear();
            container.Clear();
            currentLayout = null;

            reader.MoveToContent();
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }
            reader.ReadStartElement("layouts");
            reader.MoveToContent();
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    DockLayout layout = DockLayout.Read(this, reader);
                    layouts.Add(layout.Name, layout);
                }
                else
                {
                    reader.Skip();
                }
                reader.MoveToContent();
            }
            reader.ReadEndElement();
            container.RelayoutWidgets();
        }
コード例 #2
0
ファイル: DockContainer.cs プロジェクト: msiyer/Pinta
		public void LoadLayout (DockLayout dl)
		{
			HidePlaceholder ();

			// Sticky items currently selected in notebooks will remain
			// selected after switching the layout
			List<DockItem> sickyOnTop = new List<DockItem> ();
			foreach (DockItem it in items) {
				if ((it.Behavior & DockItemBehavior.Sticky) != 0) {
					DockGroupItem gitem = FindDockGroupItem (it.Id);
					if (gitem != null && gitem.ParentGroup.IsSelectedPage (it))
						sickyOnTop.Add (it);
				}
			}			
			
			if (layout != null)
				layout.StoreAllocation ();
			layout = dl;
			layout.RestoreAllocation ();
			
			// Make sure items not present in this layout are hidden
			foreach (DockItem it in items) {
				if ((it.Behavior & DockItemBehavior.Sticky) != 0)
					it.Visible = it.StickyVisible;
				if (layout.FindDockGroupItem (it.Id) == null)
					it.HideWidget ();
			}
			
			RelayoutWidgets ();

			foreach (DockItem it in sickyOnTop)
				it.Present (false);
		}
コード例 #3
0
ファイル: DockLayout.cs プロジェクト: ywscr/Pinta
        public static DockLayout Read(DockFrame frame, XmlReader reader)
        {
            DockLayout layout = new DockLayout(frame);

            layout.Read(reader);
            return(layout);
        }
コード例 #4
0
ファイル: DockFrame.cs プロジェクト: ywscr/Pinta
        DockLayout GetDefaultLayout()
        {
            DockLayout group = new DockLayout(this);

            // Add items which don't have relative defaut positions

            List <DockItem> todock = new List <DockItem> ();

            foreach (DockItem item in container.Items)
            {
                if (string.IsNullOrEmpty(item.DefaultLocation))
                {
                    DockGroupItem dgt = new DockGroupItem(this, item);
                    dgt.SetVisible(item.DefaultVisible);
                    group.AddObject(dgt);
                }
                else
                {
                    todock.Add(item);
                }
            }

            // Add items with relative positions.
            int lastCount = 0;

            while (lastCount != todock.Count)
            {
                lastCount = todock.Count;
                for (int n = 0; n < todock.Count; n++)
                {
                    DockItem it = todock [n];
                    if (AddDefaultItem(group, it) != null)
                    {
                        todock.RemoveAt(n);
                        n--;
                    }
                }
            }

            // Items which could not be docked because of an invalid default location
            foreach (DockItem item in todock)
            {
                DockGroupItem dgt = new DockGroupItem(this, item);
                dgt.SetVisible(false);
                group.AddObject(dgt);
            }
//			group.Dump ();
            return(group);
        }
コード例 #5
0
        public void LoadLayout(DockLayout dl)
        {
            HidePlaceholder();

            // Sticky items currently selected in notebooks will remain
            // selected after switching the layout
            List <DockItem> sickyOnTop = new List <DockItem> ();

            foreach (DockItem it in items)
            {
                if ((it.Behavior & DockItemBehavior.Sticky) != 0)
                {
                    DockGroupItem gitem = FindDockGroupItem(it.Id);
                    if (gitem != null && gitem.ParentGroup.IsSelectedPage(it))
                    {
                        sickyOnTop.Add(it);
                    }
                }
            }

            if (layout != null)
            {
                layout.StoreAllocation();
            }
            layout = dl;
            layout.RestoreAllocation();

            // Make sure items not present in this layout are hidden
            foreach (DockItem it in items)
            {
                if ((it.Behavior & DockItemBehavior.Sticky) != 0)
                {
                    it.Visible = it.StickyVisible;
                }
                if (layout.FindDockGroupItem(it.Id) == null)
                {
                    it.HideWidget();
                }
            }

            RelayoutWidgets();

            foreach (DockItem it in sickyOnTop)
            {
                it.Present(false);
            }
        }
コード例 #6
0
ファイル: DockContainer.cs プロジェクト: msiyer/Pinta
		public void Clear ()
		{
			layout = null;
		}
コード例 #7
0
 public void Clear()
 {
     layout = null;
 }
コード例 #8
0
ファイル: DockLayout.cs プロジェクト: msiyer/Pinta
		public static DockLayout Read (DockFrame frame, XmlReader reader)
		{
			DockLayout layout = new DockLayout (frame);
			layout.Read (reader);
			return layout;
		}
コード例 #9
0
ファイル: DockFrame.cs プロジェクト: msiyer/Pinta
		DockLayout GetDefaultLayout ()
		{
			DockLayout group = new DockLayout (this);
			
			// Add items which don't have relative defaut positions
			
			List<DockItem> todock = new List<DockItem> ();
			foreach (DockItem item in container.Items) {
				if (string.IsNullOrEmpty (item.DefaultLocation)) {
					DockGroupItem dgt = new DockGroupItem (this, item);
					dgt.SetVisible (item.DefaultVisible);
					group.AddObject (dgt);
				}
				else
					todock.Add (item);
			}
			
			// Add items with relative positions.
			int lastCount = 0;
			while (lastCount != todock.Count) {
				lastCount = todock.Count;
				for (int n=0; n<todock.Count; n++) {
					DockItem it = todock [n];
					if (AddDefaultItem (group, it) != null) {
						todock.RemoveAt (n);
						n--;
					}
				}
			}
			
			// Items which could not be docked because of an invalid default location
			foreach (DockItem item in todock) {
				DockGroupItem dgt = new DockGroupItem (this, item);
				dgt.SetVisible (false);
				group.AddObject (dgt);
			}
//			group.Dump ();
			return group;
		}