MonoDevelop.Components.Docking - 选项卡式 DockGroupType 问题

发布于 2024-11-16 19:55:15 字数 2798 浏览 1 评论 0原文

我们的应用程序在我们的应用程序中使用 MonoDevelop.Components.Docking 框架 Windows 应用程序。我们上次更新到最新版本是在 11 月 2010.我遇到了一些有趣的行为 以下情况:

  • 按下第一个面板的自动隐藏按钮 DockGroupType.Tabbed ParentGroup

  • 将鼠标悬停在折叠面板上,直至其展开

  • 将面板拖动到选项卡式组的中心(返回到原始状态) 点)并将

此时,面板大小调整为蓝色矩形的大小 显示面板将被放下的位置,然后从主面板脱离 窗口以该大小浮动。这只发生在 a 中的第一个项目上 选项卡式组。我在中找到了注释掉的代码部分 DockGroupItem.cs(第 112 行,GetDockTarget(..))看起来好像 可能会处理这个问题。但是,它引用了 DockPosition 类型,即 未定义,CenterAfter。方法如下,注释掉 粗体部分:

public bool GetDockTarget (DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
{

 dockDelegate = null;                

 if (item != this.item && this.item.Visible && rect.Contains (px,py)) {

      int xdockMargin = (int) ((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2;

      int ydockMargin = (int) ((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2;

      DockPosition pos;                   

/*    if (ParentGroup.Type == DockGroupType.Tabbed) {

            rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin,rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);

            pos = DockPosition.CenterAfter;

      }

*/    if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {

            outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height);

            pos = DockPosition.Left;

      }

      else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {

            outrect = new Gdk.Rectangle (rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height);

            pos = DockPosition.Right;

      }

      else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {

            outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin);

            pos = DockPosition.Top;

      }

      else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {

            outrect = new Gdk.Rectangle (rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin);

            pos = DockPosition.Bottom;

      }

      else {

            outrect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);

            pos = DockPosition.Center;
      }          

      dockDelegate = delegate (DockItem dit) {

            DockGroupItem it = ParentGroup.AddObject (dit, pos, Id);

            it.SetVisible (true);

            ParentGroup.FocusItem (it);

      };

      return true;
 }

 outrect = Gdk.Rectangle.Zero;
 return false;
}

我尝试了一些小事情,但没有什么影响行为,所以 远的。关于我可以编辑什么以使它正常工作有什么想法吗? 谢谢!

Our application uses the MonoDevelop.Components.Docking framework in our
Windows application. We last updated to the latest version in November
2010. I have come across some interesting behavior that occurs in the
following situation:

  • Press the auto hide button of the first panel in a
    DockGroupType.Tabbed ParentGroup

  • Hold mouse over collapsed panel until it expands

  • Drag panel into center of the tabbed group (back to original
    spot) and drop

At this point the panel resizes to the size of the blue rectangle that
showed where the panel would be dropped, and then undocks from the main
window to float at that size. This only happens on the first item in a
tabbed group. I found a commented out section of code in
DockGroupItem.cs (line 112, GetDockTarget(..)) that seems as though it
might deal with this. However, it references a DockPosition type that is
not defined, CenterAfter. The method is below, with the commented out
portion in bold:

public bool GetDockTarget (DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
{

 dockDelegate = null;                

 if (item != this.item && this.item.Visible && rect.Contains (px,py)) {

      int xdockMargin = (int) ((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2;

      int ydockMargin = (int) ((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2;

      DockPosition pos;                   

/*    if (ParentGroup.Type == DockGroupType.Tabbed) {

            rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin,rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);

            pos = DockPosition.CenterAfter;

      }

*/    if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {

            outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height);

            pos = DockPosition.Left;

      }

      else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {

            outrect = new Gdk.Rectangle (rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height);

            pos = DockPosition.Right;

      }

      else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {

            outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin);

            pos = DockPosition.Top;

      }

      else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {

            outrect = new Gdk.Rectangle (rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin);

            pos = DockPosition.Bottom;

      }

      else {

            outrect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);

            pos = DockPosition.Center;
      }          

      dockDelegate = delegate (DockItem dit) {

            DockGroupItem it = ParentGroup.AddObject (dit, pos, Id);

            it.SetVisible (true);

            ParentGroup.FocusItem (it);

      };

      return true;
 }

 outrect = Gdk.Rectangle.Zero;
 return false;
}

I have tried a few small things, but nothing as affected the behavior so
far. Any ideas on what I could edit to get this working properly?
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

筑梦 2024-11-23 19:55:15

为了解决上面的问题,我添加了一个检查,以查看停靠的项目是否与选项卡组中的第一个项目相同,如果是,则适当修改插入索引,因为尝试在组中的自身之前插入该项目会导致浮动问题。由于其状态为“自动隐藏”,因此它在技术上仍然可见,因此保留在选项卡组的可见对象列表中。更改如下。

DockGroup.cs(第 122 行)- 注释掉了索引增加:

public DockGroupItem AddObject (DockItem obj, DockPosition pos, string relItemId)
{
...
else if (pos == DockPosition.CenterBefore || pos == DockPosition.Center) {
                if (type != DockGroupType.Tabbed)
                    gitem = Split (DockGroupType.Tabbed, pos == DockPosition.CenterBefore, obj, npos);
                else {
                    //if (pos == DockPosition.Center) // removed to fix issue with drag/docking the 1st tab item after autohiding 
                        //npos++;
                    gitem = new DockGroupItem (Frame, obj);
                    dockObjects.Insert (npos, gitem);
                    gitem.ParentGroup = this;
                }
            }
            ResetVisibleGroups ();
            return gitem;
}

DockGroup.cs(第 912 行)- 添加了对同一项目的检查

internal override bool GetDockTarget (DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect)
        {
            if (!Allocation.Contains (px, py) || VisibleObjects.Count == 0) {
                dockDelegate = null;
                rect = Gdk.Rectangle.Zero;
                return false;
            }

            if (type == DockGroupType.Tabbed) {
                // this is a fix for issue with drag/docking the 1st tab item after autohiding it
                int pos = 0;
                if (item.Id == ((DockGroupItem)VisibleObjects[0]).Id)
                {
                    pos++;
                }

                // Tabs can only contain DockGroupItems
                return ((DockGroupItem)VisibleObjects[pos]).GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect);
            }
...

To fix the problem above I added a check to see if the item being docked is the same as the first item in the tab group, if so, modifies the insertion index appropriately because trying to insert the item before itself in the group causes the float problem. Since its status was "AutoHide" it is still technically visible, so was kept in the tab group's list of visible objects. Changes are below.

DockGroup.cs (line 122) - commented out the index increase:

public DockGroupItem AddObject (DockItem obj, DockPosition pos, string relItemId)
{
...
else if (pos == DockPosition.CenterBefore || pos == DockPosition.Center) {
                if (type != DockGroupType.Tabbed)
                    gitem = Split (DockGroupType.Tabbed, pos == DockPosition.CenterBefore, obj, npos);
                else {
                    //if (pos == DockPosition.Center) // removed to fix issue with drag/docking the 1st tab item after autohiding 
                        //npos++;
                    gitem = new DockGroupItem (Frame, obj);
                    dockObjects.Insert (npos, gitem);
                    gitem.ParentGroup = this;
                }
            }
            ResetVisibleGroups ();
            return gitem;
}

DockGroup.cs (line 912) - added check for same item

internal override bool GetDockTarget (DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect)
        {
            if (!Allocation.Contains (px, py) || VisibleObjects.Count == 0) {
                dockDelegate = null;
                rect = Gdk.Rectangle.Zero;
                return false;
            }

            if (type == DockGroupType.Tabbed) {
                // this is a fix for issue with drag/docking the 1st tab item after autohiding it
                int pos = 0;
                if (item.Id == ((DockGroupItem)VisibleObjects[0]).Id)
                {
                    pos++;
                }

                // Tabs can only contain DockGroupItems
                return ((DockGroupItem)VisibleObjects[pos]).GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect);
            }
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文