This commit is contained in:
Kathy Ruffing 2011-03-09 11:52:09 +00:00
parent afd5e5bcbb
commit c693bc8b10

View File

@ -15,21 +15,6 @@ namespace Volian.Controls.Library
{ {
public partial class GridItem : EditItem public partial class GridItem : EditItem
{ {
/*
* TODO: (2/16/11)
* 1) KBR Need to include/handle StepRTB/EditItem Events: Add for grid items, the events that
* are handled by StepRTB/EditItem. Should these be abstract events within EditItem so
* that it 'tells' you which events you need.
* May Need yet:
* OnOpenContextMenu (grid and/or rtb)
* OnSetMenu?? - related to context menu
* 2) KBR ContextMenu for table. May want it to function in a similar way to spellcheck, with
* the contentmenu to support table options and a last item that supports existing
* contextmenu
* 3) When data migration of tables, need to include the font if there is a symbol. Move
* AddFontTable from StepRTB.cs to a place accessible, such as volian.base. And then
* in data migration, will need to know if a font is fixed.
*/
#region Fields #region Fields
public VlnFlexGrid MyFlexGrid public VlnFlexGrid MyFlexGrid
{ {
@ -172,18 +157,10 @@ namespace Volian.Controls.Library
} }
void MyStepRTB_DoSaveContents(object sender, EventArgs args) void MyStepRTB_DoSaveContents(object sender, EventArgs args)
{ {
if (MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0) // Only if a Cell is Selected SaveCurrentAndContents();
{
int row = MyFlexGrid.Row;
int col = MyFlexGrid.Col;
SaveContents();
MyStepRTB.Rtf = MyStepRTB.DoNewLinkInGridCell();
MyFlexGrid.Row = row;
MyFlexGrid.Col = col;
MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col] = MyStepRTB.Rtf;
}
SaveContents();
} }
void MyStepRTB_VisibleChanged(object sender, EventArgs e) void MyStepRTB_VisibleChanged(object sender, EventArgs e)
{ {
MyStepRTB.EditMode = MyStepRTB.Visible; MyStepRTB.EditMode = MyStepRTB.Visible;
@ -205,6 +182,7 @@ namespace Volian.Controls.Library
private void AdjustColorsForEditMode() private void AdjustColorsForEditMode()
{ {
MyFlexGrid.StyleBackColor = Color.White;
if (MyStepRTB.EditMode) if (MyStepRTB.EditMode)
{ {
MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Focus"].BackColor =
@ -503,6 +481,7 @@ namespace Volian.Controls.Library
// in the grid: // in the grid:
MyFlexGrid.Cols.Fixed = 0; MyFlexGrid.Cols.Fixed = 0;
MyFlexGrid.Rows.Fixed = 0; MyFlexGrid.Rows.Fixed = 0;
MyFlexGrid.StyleBackColor = Color.White;
string xml = MyFlexGrid.GetXMLData(); string xml = MyFlexGrid.GetXMLData();
using (Item itm = MyItemInfo.Get()) using (Item itm = MyItemInfo.Get())
@ -763,15 +742,7 @@ namespace Volian.Controls.Library
{ {
if (highlight) if (highlight)
{ {
//for (int r = 0; r < MyFlexGrid.Rows.Count; r++) MyFlexGrid.StyleBackColor = Color.Gray;
// for (int c = 0; c < MyFlexGrid.Cols.Count; c++)
// {
// CellStyle cs = MyFlexGrid.GetCellStyle(r, c);
// CellRange cr = MyFlexGrid.GetCellRange(r, c);
// Console.WriteLine("Style[{0},{1}] = '{2}' {3} '{4}'", r,c,cs.Name,cs.BackColor,cr.StyleNew.Name);
// }
MyFlexGrid.Styles["Alternate"].BackColor =
MyFlexGrid.Styles["Normal"].BackColor = Color.Gray;
} }
else else
{ {
@ -779,8 +750,7 @@ namespace Volian.Controls.Library
SetActive(); SetActive();
else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor
{ {
MyFlexGrid.Styles["Alternate"].BackColor = MyFlexGrid.StyleBackColor =
MyFlexGrid.Styles["Normal"].BackColor =
MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.InactiveColor : MyStepPanel.AnnotationColor; MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.InactiveColor : MyStepPanel.AnnotationColor;
// Turn-off Size adjustment // Turn-off Size adjustment
MyFlexGrid.Cols.Fixed = 0; MyFlexGrid.Cols.Fixed = 0;
@ -807,6 +777,7 @@ namespace Volian.Controls.Library
MyFlexGrid.Clear(); MyFlexGrid.Clear();
MyFlexGrid.MergedRanges.Clear(); MyFlexGrid.MergedRanges.Clear();
MyFlexGrid.ReadXml(xd); MyFlexGrid.ReadXml(xd);
MyFlexGrid.KeyActionTab = KeyActionEnum.MoveAcross;
MyFlexGrid.AdjustGridControlSize(); MyFlexGrid.AdjustGridControlSize();
// When a grid is read from XML, all of the styles are updated to the values in the XML. // When a grid is read from XML, all of the styles are updated to the values in the XML.
// Thus any specific settings need to be set after the grid is read. // Thus any specific settings need to be set after the grid is read.
@ -854,6 +825,20 @@ namespace Volian.Controls.Library
SaveContents(); SaveContents();
} }
public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table
public override void SaveCurrentAndContents()
{
if (MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0) // Only if a Cell is Selected
{
int row = MyFlexGrid.Row;
int col = MyFlexGrid.Col;
SaveContents();
MyStepRTB.Rtf = MyStepRTB.DoNewLinkInGridCell();
MyFlexGrid.Row = row;
MyFlexGrid.Col = col;
MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col] = MyStepRTB.Rtf;
}
SaveContents();
}
#endregion #endregion
#region Miscellaneous Support #region Miscellaneous Support
internal void SetSearchCell(string SearchString) internal void SetSearchCell(string SearchString)