Browse Source

Debugger grid child windows now use a custom border instead of SizableToolWindow.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@685 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
91406cf910
  1. 22
      src/Main/Base/Project/Src/Gui/TreeGrid/DynamicList.cs
  2. 100
      src/Main/Base/Project/Src/Gui/TreeGrid/DynamicTreeRow.cs
  3. 9
      src/Main/Base/Project/Src/Services/Debugger/DebuggerGridControl.cs

22
src/Main/Base/Project/Src/Gui/TreeGrid/DynamicList.cs

@ -222,6 +222,20 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
return width; return width;
} }
int lineMarginY = 0;
public int LineMarginY {
get {
return lineMarginY;
}
set {
if (lineMarginY == value)
return;
lineMarginY = value;
Redraw();
}
}
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)
{ {
//Debug.WriteLine("OnPaint"); //Debug.WriteLine("OnPaint");
@ -268,7 +282,7 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
columnIndex += 1; columnIndex += 1;
} }
} }
yPos += row.Height + 1; yPos += row.Height + lineMarginY;
} }
removedControls.Clear(); removedControls.Clear();
foreach (Control ctl in Controls) { foreach (Control ctl in Controls) {
@ -299,7 +313,7 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
break; break;
if (yPos <= y + row.Height) if (yPos <= y + row.Height)
return row; return row;
y += row.Height + 1; y += row.Height + lineMarginY;
} }
return null; return null;
} }
@ -313,7 +327,7 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
foreach (DynamicListRow r in Rows) { foreach (DynamicListRow r in Rows) {
if (r == row) if (r == row)
return new Point(0, y); return new Point(0, y);
y += r.Height + 1; y += r.Height + lineMarginY;
} }
throw new ArgumentException("The row in not in this list!"); throw new ArgumentException("The row in not in this list!");
} }
@ -325,7 +339,7 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
get { get {
int y = 0; int y = 0;
foreach (DynamicListRow r in Rows) { foreach (DynamicListRow r in Rows) {
y += r.Height + 1; y += r.Height + lineMarginY;
} }
return y; return y;
} }

100
src/Main/Base/Project/Src/Gui/TreeGrid/DynamicTreeRow.cs

@ -84,6 +84,103 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
{ {
bool isActive = true; bool isActive = true;
bool allowResizing = true;
public bool AllowResizing {
get {
return allowResizing;
}
set {
if (allowResizing == value)
return;
allowResizing = value;
this.DockPadding.All = value ? 2 : 1;
}
}
public ChildForm()
{
this.FormBorderStyle = FormBorderStyle.None;
this.DockPadding.All = 2;
this.BackColor = Color.FromArgb(195, 192, 175);
}
#region Resizing the form
private enum MousePositionCodes
{
HTERROR = (-2),
HTTRANSPARENT = (-1),
HTNOWHERE = 0,
HTCLIENT = 1,
HTCAPTION = 2,
HTSYSMENU = 3,
HTGROWBOX = 4,
HTSIZE = HTGROWBOX,
HTMENU = 5,
HTHSCROLL = 6,
HTVSCROLL = 7,
HTMINBUTTON = 8,
HTMAXBUTTON = 9,
HTLEFT = 10,
HTRIGHT = 11,
HTTOP = 12,
HTTOPLEFT = 13,
HTTOPRIGHT = 14,
HTBOTTOM = 15,
HTBOTTOMLEFT = 16,
HTBOTTOMRIGHT = 17,
HTBORDER = 18,
HTREDUCE = HTMINBUTTON,
HTZOOM = HTMAXBUTTON,
HTSIZEFIRST = HTLEFT,
HTSIZELAST = HTBOTTOMRIGHT,
HTOBJECT = 19,
HTCLOSE = 20,
HTHELP = 21
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == 0x0084) // WM_NCHITTEST
HitTest(ref m);
}
void HitTest(ref Message m)
{
if (!allowResizing)
return;
int mousePos = m.LParam.ToInt32();
int mouseX = mousePos & 0xffff;
int mouseY = mousePos >> 16;
//System.Diagnostics.Debug.WriteLine(mouseX + " / " + mouseY);
Rectangle bounds = Bounds;
bool isLeft = mouseX == bounds.Left || mouseX + 1 == bounds.Left;
bool isTop = mouseY == bounds.Top || mouseY + 1 == bounds.Top;
bool isRight = mouseX == bounds.Right - 1 || mouseX == bounds.Right - 2;
bool isBottom = mouseY == bounds.Bottom - 1 || mouseY == bounds.Bottom - 2;
if (isLeft) {
if (isTop)
m.Result = new IntPtr((int)MousePositionCodes.HTTOPLEFT);
else if (isBottom)
m.Result = new IntPtr((int)MousePositionCodes.HTBOTTOMLEFT);
else
m.Result = new IntPtr((int)MousePositionCodes.HTLEFT);
} else if (isRight) {
if (isTop)
m.Result = new IntPtr((int)MousePositionCodes.HTTOPRIGHT);
else if (isBottom)
m.Result = new IntPtr((int)MousePositionCodes.HTBOTTOMRIGHT);
else
m.Result = new IntPtr((int)MousePositionCodes.HTRIGHT);
} else if (isTop) {
m.Result = new IntPtr((int)MousePositionCodes.HTTOP);
} else if (isBottom) {
m.Result = new IntPtr((int)MousePositionCodes.HTBOTTOM);
}
}
#endregion
protected override void OnActivated(EventArgs e) protected override void OnActivated(EventArgs e)
{ {
base.OnActivated(e); base.OnActivated(e);
@ -123,7 +220,6 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
frm = null; frm = null;
OnCollapsed(EventArgs.Empty); OnCollapsed(EventArgs.Empty);
}; };
frm.FormBorderStyle = FormBorderStyle.SizableToolWindow;
Point p = e.List.PointToScreen(e.List.GetPositionFromRow(this)); Point p = e.List.PointToScreen(e.List.GetPositionFromRow(this));
p.Offset(e.List.Columns[0].Width, Height); p.Offset(e.List.Columns[0].Width, Height);
frm.StartPosition = FormStartPosition.Manual; frm.StartPosition = FormStartPosition.Manual;
@ -146,7 +242,6 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
}; };
scrollContainer.Controls.Add(childList); scrollContainer.Controls.Add(childList);
frm.DockPadding.All = 2;
frm.Controls.Add(scrollContainer); frm.Controls.Add(scrollContainer);
int screenHeight = Screen.FromPoint(p).WorkingArea.Bottom - p.Y; int screenHeight = Screen.FromPoint(p).WorkingArea.Bottom - p.Y;
@ -170,6 +265,7 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid
frm.Left -= missingWidth; frm.Left -= missingWidth;
} }
frm.ClientSize = new Size(formWidth, formHeight); frm.ClientSize = new Size(formWidth, formHeight);
frm.MinimumSize = new Size(100, Math.Min(50, formHeight));
isOpeningChild = true; isOpeningChild = true;
frm.Show(); frm.Show();
isOpeningChild = false; isOpeningChild = false;

9
src/Main/Base/Project/Src/Services/Debugger/DebuggerGridControl.cs

@ -63,27 +63,28 @@ namespace ICSharpCode.Core
EndUpdate(); EndUpdate();
} }
Form frm; DynamicTreeRow.ChildForm frm;
public void ShowForm(ICSharpCode.TextEditor.TextArea textArea, Point logicTextPos) public void ShowForm(ICSharpCode.TextEditor.TextArea textArea, Point logicTextPos)
{ {
frm = new DynamicTreeRow.ChildForm(); frm = new DynamicTreeRow.ChildForm();
frm.FormBorderStyle = FormBorderStyle.None; frm.AllowResizing = false;
frm.Owner = textArea.FindForm(); frm.Owner = textArea.FindForm();
int ypos = (textArea.Document.GetVisibleLine(logicTextPos.Y) + 1) * textArea.TextView.FontHeight - textArea.VirtualTop.Y; int ypos = (textArea.Document.GetVisibleLine(logicTextPos.Y) + 1) * textArea.TextView.FontHeight - textArea.VirtualTop.Y;
Point p = new Point(0, ypos); Point p = new Point(0, ypos);
p = textArea.PointToScreen(p); p = textArea.PointToScreen(p);
p.X = Control.MousePosition.X - 16; p.X = Control.MousePosition.X - 16;
p.Y -= 1;
frm.StartPosition = FormStartPosition.Manual; frm.StartPosition = FormStartPosition.Manual;
frm.ShowInTaskbar = false; frm.ShowInTaskbar = false;
frm.Location = p; frm.Location = p;
frm.Size = new Size(Width, row.Height); frm.ClientSize = new Size(Width + 2, row.Height + 2);
Dock = DockStyle.Fill; Dock = DockStyle.Fill;
frm.Controls.Add(this); frm.Controls.Add(this);
ICSharpCode.TextEditor.Gui.CompletionWindow.AbstractCompletionWindow.ShowWindowWithoutFocus(frm); ICSharpCode.TextEditor.Gui.CompletionWindow.AbstractCompletionWindow.ShowWindowWithoutFocus(frm);
textArea.Click += OnTextAreaClick; textArea.Click += OnTextAreaClick;
textArea.KeyDown += OnTextAreaClick; textArea.KeyDown += OnTextAreaClick;
frm.Height = row.Height; frm.ClientSize = new Size(frm.ClientSize.Width, row.Height + 2);
} }
void OnTextAreaClick(object sender, EventArgs e) void OnTextAreaClick(object sender, EventArgs e)

Loading…
Cancel
Save