0

私たちのアプリケーションは、Windows アプリケーションで MonoDevelop.Components.Docking フレームワークを使用しています。最後に最新バージョンに更新したのは 2010 年 11 月です。次の状況で発生する興味深い動作に遭遇しました。

  • DockGroupType.Tabbed ParentGroup の最初のパネルの自動非表示ボタンを押します

  • 展開されるまで、折りたたまれたパネルの上にマウスを置きます

  • パネルをタブ付きグループの中央にドラッグして (元の場所に戻します)、ドロップします。

この時点で、パネルは、パネルがドロップされる場所を示す青い四角形のサイズにサイズ変更され、メイン ウィンドウからドッキング解除されて、そのサイズでフロートします。これは、タブ グループの最初の項目でのみ発生します。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;
}

私はいくつかの小さなことを試しましたが、これまでのところ動作に影響を与えるものは何もありません. これを適切に機能させるために何を編集できるかについてのアイデアはありますか? ありがとう!

4

1 に答える 1

0

上記の問題を修正するために、ドッキングされているアイテムがタブ グループの最初のアイテムと同じかどうかを確認するチェックを追加しました。同じ場合は、挿入インデックスを適切に変更します。これは、グループ内のそれ自体の前にアイテムを挿入しようとするとフロートが発生するためです。問題。そのステータスは「AutoHide」であったため、技術的にはまだ表示されているため、タブ グループの表示オブジェクトのリストに保持されていました。変更点は以下。

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);
            }
...
于 2011-06-24T16:31:04.187 に答える