[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/Scrollab...
From: |
Heiko Weiss |
Subject: |
[dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/Scrollab... |
Date: |
Tue, 16 Dec 2008 13:44:00 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnetlib
Changes by: Heiko Weiss <brubbel> 08/12/16 13:44:00
Modified files:
. : ChangeLog
System.Windows.Forms: ScrollableControl.cs NumericUpDown.cs
UpDownBase.cs
Log message:
ScrollableControl.cs: fix ScrollControlIntoView and updating scrollbars
if
controls are added or removed.
NumericUpdown.cs: implemented a lot of TODOs.
UpDownBase.cs: implemented a lot of TODOs.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2546&r2=1.2547
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Windows.Forms/ScrollableControl.cs?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Windows.Forms/NumericUpDown.cs?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Windows.Forms/UpDownBase.cs?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2546
retrieving revision 1.2547
diff -u -b -r1.2546 -r1.2547
--- ChangeLog 26 Nov 2008 19:11:20 -0000 1.2546
+++ ChangeLog 16 Dec 2008 13:43:59 -0000 1.2547
@@ -1,3 +1,10 @@
+2008-12-16 Heiko Weiss <address@hidden>
+
+ * System.Windows.Forms/ScrollableControl.cs: fix ScrollControlIntoView
and
+ updating scrollbars if controls are added or removed.
+ * System.Windows.Forms/NumericUpdown.cs: implemented a lot of TODOs.
+ * System.Windows.Forms/UpDownBase.cs: implemented a lot of TODOs.
+
2008-11-26 Klaus Treichel <address@hidden>
* runtime/System/Nullable_1.cs: Exclude class from build for now.
Index: System.Windows.Forms/ScrollableControl.cs
===================================================================
RCS file:
/sources/dotgnu-pnet/pnetlib/System.Windows.Forms/ScrollableControl.cs,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- System.Windows.Forms/ScrollableControl.cs 30 Nov 2007 11:59:02 -0000
1.16
+++ System.Windows.Forms/ScrollableControl.cs 16 Dec 2008 13:43:59 -0000
1.17
@@ -268,11 +268,14 @@
}
else
{
- vScrollBar.LargeChange =
DisplayRectangle.Height;
- vScrollBar.SmallChange =
(DisplayRectangle.Height + 9 )/ 10;
+// vScrollBar.CreateControl();
+
// set Maximum before setting
the value, or we get an exception
vScrollBar.Maximum =
ScrollArea.Height - 1;
vScrollBar.Value =
-(autoScrollPosition.Y);
+ // set Large/SmallChange after
setting maximum, or display failure
+ vScrollBar.LargeChange =
DisplayRectangle.Height;
+ vScrollBar.SmallChange =
(DisplayRectangle.Height + 9 )/ 10;
vScrollBar.Visible = vscroll;
}
}
@@ -285,11 +288,12 @@
}
else
{
- hScrollBar.LargeChange =
DisplayRectangle.Width;
- hScrollBar.SmallChange =
(DisplayRectangle.Width + 9) / 10;
// set Maximum before setting
the value, or we get an exception
hScrollBar.Maximum =
ScrollArea.Width - 1;
hScrollBar.Value =
-(autoScrollPosition.X);
+ // set Large/SmallChange after
setting maximum, or display failure
+ hScrollBar.LargeChange =
DisplayRectangle.Width;
+ hScrollBar.SmallChange =
(DisplayRectangle.Width + 9) / 10;
hScrollBar.Visible = hscroll;
}
}
@@ -512,14 +516,56 @@
}
}
+ protected override void OnControlAdded(ControlEventArgs e) {
+ base.OnControlAdded (e);
+ UpdateScrollBars();
+ }
+
+ protected override void OnControlRemoved(ControlEventArgs e) {
+ base.OnControlRemoved (e);
+ UpdateScrollBars();
+ }
+
public void ScrollControlIntoView(Control activeControl)
{
if(activeControl.Visible && AutoScroll &&
(hScrollBar.Visible || vScrollBar.Visible))
{
- int x = autoScrollPosition.X + activeControl.Left;
- int y = autoScrollPosition.Y + activeControl.Top;
- ScrollByOffset(new Size(x, y));
+ Rectangle displayRect = DisplayRectangle;
+ Rectangle clientRectangle = ClientRectangle;
+
+ int x = displayRect.X;
+ int y = displayRect.Y;
+ int width = this.autoScrollMargin.Width;
+ int height = this.autoScrollMargin.Height;
+
+ Rectangle bounds = activeControl.Bounds;
+ if (bounds.X < width)
+ {
+ x = (displayRect.X + width) - bounds.X;
+ }
+ else if (((bounds.X + bounds.Width) + width) >
clientRectangle.Width)
+ {
+ x = clientRectangle.Width - (((bounds.X
+ bounds.Width) + width) - displayRect.X);
+ if (((bounds.X + x) - displayRect.X) <
width)
+ {
+ x = (displayRect.X +
width) - bounds.X;
+ }
+ }
+ if (bounds.Y < height)
+ {
+ y = (displayRect.Y + height) - bounds.Y;
+ }
+ else if (((bounds.Y + bounds.Height) + height) >
clientRectangle.Height)
+ {
+ y = clientRectangle.Height - (((bounds.Y +
bounds.Height) + height) - displayRect.Y);
+ if (((bounds.Y + y) - displayRect.Y) < height)
+ {
+ y = (displayRect.Y + height) -
bounds.Y;
+ }
+ }
+
+ ScrollByOffset(new Size(-x, -y));
UpdateScrollBars();
}
return;
Index: System.Windows.Forms/NumericUpDown.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Windows.Forms/NumericUpDown.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- System.Windows.Forms/NumericUpDown.cs 17 Dec 2004 10:44:00 -0000
1.3
+++ System.Windows.Forms/NumericUpDown.cs 16 Dec 2008 13:44:00 -0000
1.4
@@ -89,6 +89,15 @@
UpdateEditText();
}
+ private void SetCurrentvalue( decimal value ) {
+ if( currentValue != value ) {
+ currentValue = value;
+ if( null != ValueChanged ) {
+ ValueChanged( this, System.EventArgs.Empty );
+ }
+ }
+ }
+
[TODO]
public void BeginInit()
{
@@ -120,6 +129,7 @@
public void EndInit()
{
initializing = false;
+ this.Value = this.Constrain(this.currentValue);
}
public decimal Increment
@@ -143,12 +153,12 @@
}
set
{
- maximum = Constrain(value);
- if (maximum < currentValue)
+ this.maximum = value;
+ if (this.minimum > this.maximum)
{
- currentValue = maximum;
- UpdateEditText();
+ this.minimum = this.maximum;
}
+ this.Value = this.Constrain(this.currentValue);
}
}
@@ -161,12 +171,12 @@
}
set
{
- minimum = Constrain(value);
- if (minimum > currentValue)
+ this.minimum = value;
+ if (this.minimum > this.maximum)
{
- currentValue = minimum;
- UpdateEditText();
+ this.maximum = value;
}
+ this.Value = this.Constrain(this.currentValue);
}
}
@@ -183,39 +193,80 @@
{
throw new ArgumentException();
}
- currentValue = Constrain(value);
+ SetCurrentvalue( Constrain(value) );
UpdateEditText();
}
}
- [TODO]
private decimal Constrain(decimal value)
{
+ if (value < this.minimum)
+ {
+ value = this.minimum;
+ }
+ if (value > this.maximum)
+ {
+ value = this.maximum;
+ }
return value;
}
+ protected void ParseEditText()
+ {
+ try
+ {
+ decimal newValue;
+ if (this.hexadecimal)
+ {
+ newValue =
this.Constrain(Convert.ToDecimal(Convert.ToInt32(this.Text, 0x10)));
+ }
+ else
+ {
+ newValue =
this.Constrain(decimal.Parse(this.Text));
+ }
+ SetCurrentvalue( newValue );
+ }
+ catch (Exception)
+ {
+ }
+ finally
+ {
+ base.UserEdit = false;
+ UpdateEditText();
+ }
+ }
+
public override void UpButton()
{
+ if( base.UserEdit ) {
+ this.ParseEditText();
+ }
if (currentValue < maximum)
{
- currentValue += increment;
- if (currentValue > maximum)
+ decimal newValue = currentValue + increment;
+ if (newValue > maximum)
{
- currentValue = maximum;
+ newValue = maximum;
}
+ SetCurrentvalue( newValue );
UpdateEditText();
}
}
public override void DownButton()
{
+ if( base.UserEdit ) {
+ this.ParseEditText();
+ }
if (currentValue > minimum)
{
- currentValue -= increment;
- if (currentValue < minimum)
+ decimal newValue = currentValue - increment;
+
+ if (newValue < minimum)
{
- currentValue = minimum;
+ newValue = minimum;
}
+ SetCurrentvalue( newValue );
UpdateEditText();
}
}
@@ -259,6 +310,13 @@
protected override void UpdateEditText()
{
+ if (!this.initializing)
+ {
+ if (base.UserEdit)
+ {
+ this.ParseEditText();
+ }
+
if (hexadecimal)
{
base.Text = currentValue.ToString("X");
@@ -275,16 +333,46 @@
}
}
}
+ }
- [TODO]
- protected virtual void ValidateEditText()
+ protected override void ValidateEditText()
{
+ this.ParseEditText();
+ this.UpdateEditText();
}
[TODO]
protected override void OnChanged(object source, EventArgs e)
{
- throw new NotImplementedException("OnChanged");
+ }
+
+ protected override void OnTextBoxKeyPress(object source,
KeyPressEventArgs e)
+ {
+ base.OnTextBoxKeyPress(source, e);
+
+ System.Globalization.NumberFormatInfo numberFormat =
System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
+
+ string dec = numberFormat.NumberDecimalSeparator;
+ string group = numberFormat.NumberGroupSeparator;
+ string sign = numberFormat.NegativeSign;
+ string key = e.KeyChar.ToString();
+
+ if ( !char.IsDigit(e.KeyChar) && key != dec && key != group &&
key != sign && e.KeyChar != '\b' )
+ {
+ if (this.hexadecimal)
+ {
+ if ( e.KeyChar >= 'a' && e.KeyChar <= 'f' )
+ {
+ return;
+ }
+ if ( e.KeyChar >= 'A' && e.KeyChar <= 'F' )
+ {
+ return;
+ }
+ }
+
+ e.Handled = true;
+ }
}
public override string ToString()
Index: System.Windows.Forms/UpDownBase.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Windows.Forms/UpDownBase.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- System.Windows.Forms/UpDownBase.cs 21 Nov 2005 10:04:14 -0000 1.4
+++ System.Windows.Forms/UpDownBase.cs 16 Dec 2008 13:44:00 -0000 1.5
@@ -363,10 +363,8 @@
}
}
- [TODO]
protected virtual void OnChanged(object source, EventArgs e)
{
- throw new NotImplementedException("OnChanged");
}
[TODO]
@@ -380,41 +378,68 @@
Height = ClientToBounds(new Size(0, s.Height)).Height;
}
- [TODO]
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
+ doLayout();
}
- [TODO]
protected override void OnLayout(LayoutEventArgs e)
{
base.OnLayout(e);
doLayout();
}
- [TODO]
protected override void OnMouseWheel(MouseEventArgs e)
{
+ if( e.Delta > 0 ) {
+ this.UpButton();
+ }
+ else {
+ this.DownButton();
+ }
base.OnMouseWheel(e);
}
- [TODO]
protected virtual void OnTextBoxKeyDown(object source, KeyEventArgs e)
{
+ this.OnKeyDown(e);
+ if (this.interceptArrowKeys)
+ {
+ if (e.KeyData == Keys.Up)
+ {
+ this.UpButton();
+ e.Handled = true;
+ }
+ else if (e.KeyData == Keys.Down)
+ {
+ this.DownButton();
+ e.Handled = true;
+ }
+ }
+ if ((e.KeyCode == Keys.Return) && this.UserEdit)
+ {
+ this.ValidateEditText();
+ }
+ }
+
+ protected virtual void ValidateEditText()
+ {
}
- [TODO]
protected virtual void OnTextBoxKeyPress(object source,
KeyPressEventArgs e)
{
+ this.OnKeyPress(e);
}
- [TODO]
protected virtual void OnTextBoxLostFocus(object source, EventArgs e)
{
+ if(this.UserEdit)
+ {
+ this.ValidateEditText();
+ }
}
- [TODO]
protected virtual void OnTextBoxResize(object source, EventArgs e)
{
Size s;
@@ -422,12 +447,15 @@
s = upDownEdit.Size;
s = ClientToBounds(new Size(s.Width + DefaultButtonsWidth,
s.Height));
this.Size = s;
+ doLayout();
}
[TODO]
protected virtual void OnTextBoxTextChanged(object source, EventArgs e)
{
userEdit = true;
+ this.OnTextChanged(e);
+ this.OnChanged(source, new EventArgs());
}
[DefaultValue(false)]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/Scrollab...,
Heiko Weiss <=