Author: toshok
Date: 2007-01-19 13:06:18 -0500 (Fri, 19 Jan 2007)
New Revision: 71351
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
Log:
2007-01-19 Chris Toshok <[EMAIL PROTECTED]>
* DataGridColumnStyle.cs: stop setting _readonly in the
PropertyDescriptor setter. fixes a unit test failure.
also, rename ParentReadOnly to TableStyleReadOnly, and have it
just consult our table style (if we have one). We don't need to
consult the datagrid readonly attribute because that's passed in
as the _ro arg to Edit. this simplifies things a little.
* DataGrid.cs: use CurrentColumn instead of
current_cell.ColumnNumber just to simplify some of the code.
switch the order of some things in the CurrentCell setter to keep
the previous cell from getting a textbox again -
EnsureCellVisibility causes scrolling to happen, which calls Edit.
So we need to set the new cell before calling it.
call Edit in OnEnter, as does Microsoft.
also, make sure the current table style isn't the one we create
initially when checking to see if it's different than the one
we're setting it to in BindColumns (this fixes #80421).
* GridTableStylesCollection.cs: table styles can have "" for a
mapping name. part of the fix for #80421.
* DataGridTextBoxColumn.cs: simplify the readonly calculation in
Edit significantly.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-01-19 18:04:33 UTC (rev 71350)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-01-19 18:06:18 UTC (rev 71351)
@@ -1,3 +1,33 @@
+2007-01-19 Chris Toshok <[EMAIL PROTECTED]>
+
+ * DataGridColumnStyle.cs: stop setting _readonly in the
+ PropertyDescriptor setter. fixes a unit test failure.
+
+ also, rename ParentReadOnly to TableStyleReadOnly, and have it
+ just consult our table style (if we have one). We don't need to
+ consult the datagrid readonly attribute because that's passed in
+ as the _ro arg to Edit. this simplifies things a little.
+
+ * DataGrid.cs: use CurrentColumn instead of
+ current_cell.ColumnNumber just to simplify some of the code.
+
+ switch the order of some things in the CurrentCell setter to keep
+ the previous cell from getting a textbox again -
+ EnsureCellVisibility causes scrolling to happen, which calls Edit.
+ So we need to set the new cell before calling it.
+
+ call Edit in OnEnter, as does Microsoft.
+
+ also, make sure the current table style isn't the one we create
+ initially when checking to see if it's different than the one
+ we're setting it to in BindColumns (this fixes #80421).
+
+ * GridTableStylesCollection.cs: table styles can have "" for a
+ mapping name. part of the fix for #80421.
+
+ * DataGridTextBoxColumn.cs: simplify the readonly calculation in
+ Edit significantly.
+
2007-01-18 Jonathan Pobst <[EMAIL PROTECTED]>
* TextRenderer.cs: Rewrote to be complete-er, more MS-matching-er,
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
2007-01-19 18:04:33 UTC (rev 71350)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
2007-01-19 18:06:18 UTC (rev 71351)
@@ -25,9 +25,6 @@
//
//
-// NOT COMPLETE
-
-
using System;
using System.ComponentModel;
using System.Data;
@@ -511,22 +508,22 @@
if (value.RowNumber == RowsCount &&
!ListManager.CanAddRows)
value.RowNumber --;
-
- if (value.RowNumber == RowsCount) {
- cursor_in_add_row = true;
- add_row_changed = false;
- AddNewRow ();
- }
- else {
- cursor_in_add_row = false;
- }
}
int old_row = current_cell.RowNumber;
+ current_cell = value;
+
EnsureCellVisibility (value);
- current_cell = value;
+ if (CurrentRow == RowsCount &&
ListManager.CanAddRows) {
+ cursor_in_add_row = true;
+ add_row_changed = false;
+ AddNewRow ();
+ }
+ else {
+ cursor_in_add_row = false;
+ }
InvalidateRowHeader (old_row);
InvalidateRowHeader (current_cell.RowNumber);
@@ -1045,7 +1042,7 @@
public bool EndEdit (DataGridColumnStyle gridColumn, int
rowNumber, bool shouldAbort)
{
- if (shouldAbort || gridColumn.ParentReadOnly)
+ if (shouldAbort || (_readonly ||
gridColumn.TableStyleReadOnly || gridColumn.ReadOnly))
gridColumn.Abort (rowNumber);
else {
gridColumn.Commit (ListManager, rowNumber);
@@ -1349,6 +1346,7 @@
protected override void OnEnter (EventArgs e)
{
base.OnEnter (e);
+ Edit ();
}
protected virtual void OnFlatModeChanged (EventArgs e)
@@ -2386,10 +2384,12 @@
if (list_manager != null) {
string list_name = list_manager.GetListName
(null);
if (TableStyles[list_name] == null) {
+ // no style exists by the supplied name
current_style.GridColumnStyles.Clear
();
current_style.CreateColumnsForTable
(false);
}
- else if (CurrentTableStyle.MappingName !=
list_name) {
+ else if (CurrentTableStyle == grid_style ||
+ CurrentTableStyle.MappingName !=
list_name) {
// If the style has been defined by the
user, use it
CurrentTableStyle =
styles_collection[list_name];
current_style.CreateColumnsForTable
(true);
@@ -2486,14 +2486,14 @@
private void Edit ()
{
- if
(CurrentTableStyle.GridColumnStyles[current_cell.ColumnNumber].bound == false)
+ if
(CurrentTableStyle.GridColumnStyles[CurrentColumn].bound == false)
return;
is_editing = true;
is_changing = false;
-
-
CurrentTableStyle.GridColumnStyles[current_cell.ColumnNumber].Edit (ListManager,
- current_cell.RowNumber, GetCellBounds
(current_cell.RowNumber, current_cell.ColumnNumber),
+
+ CurrentTableStyle.GridColumnStyles[CurrentColumn].Edit
(ListManager,
+ CurrentRow, GetCellBounds (CurrentRow,
CurrentColumn),
_readonly, "", true);
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
2007-01-19 18:04:33 UTC (rev 71350)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
2007-01-19 18:06:18 UTC (rev 71351)
@@ -280,8 +280,6 @@
if (value != property_descriptor) {
property_descriptor = value;
- _readonly = property_descriptor == null
? false : property_descriptor.IsReadOnly;
-
EventHandler eh = (EventHandler)(Events
[PropertyDescriptorChangedEvent]);
if (eh != null)
eh (this, EventArgs.Empty);
@@ -339,26 +337,9 @@
set { arrow_drawing = value; }
}
- // The logic seems to be that:
- // - If DataGrid.ReadOnly is true all the tables and columns
are readonly ignoring other settings
- // - If DataGridTableStyle.ReadOnly is true all columns are
readonly ignoring other settings
- // - If DataGrid.ReadOnly and DataGridTableStyle.ReadOnly are
false, the columns settings are mandatory
- //
- internal bool ParentReadOnly {
+ internal bool TableStyleReadOnly {
get {
- if (grid != null) {
- if (grid.ReadOnly == true) {
- return true;
- }
- }
-
- if (table_style != null) {
- if (table_style.ReadOnly == true) {
- return true;
- }
- }
-
- return false;
+ return table_style != null &&
table_style.ReadOnly;
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
2007-01-19 18:04:33 UTC (rev 71350)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
2007-01-19 18:06:18 UTC (rev 71351)
@@ -161,11 +161,7 @@
bool ro = false;
- if ((ParentReadOnly == true) ||
- (ParentReadOnly == false && ReadOnly == true)
||
- (ParentReadOnly == false && _ro == true)) {
- textbox.ReadOnly = true;
- }
+ ro = (TableStyleReadOnly || ReadOnly || _ro);
if (!ro && instantText != null && instantText != "") {
textbox.Text = instantText;
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
2007-01-19 18:04:33 UTC (rev 71350)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
2007-01-19 18:06:18 UTC (rev 71351)
@@ -219,9 +219,6 @@
{
for (int i = 0; i < items.Count; i++) {
DataGridTableStyle table = (DataGridTableStyle)
items[i];
-
- if (table.MappingName == null ||
table.MappingName == string.Empty)
- continue;
if (String.Compare (table.MappingName,
tableName, true) == 0) {
return i;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches