This commit is contained in:
John Jenko 2011-04-26 20:01:48 +00:00
parent 2ec5e1b8dc
commit 271c1ce923
4 changed files with 48 additions and 5 deletions

View File

@ -1927,7 +1927,7 @@ namespace Volian.Controls.Library
}
protected void SetupEditItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem)
{
if (itemInfo.ItemID == 10366) Console.WriteLine("Here");
//if (itemInfo.ItemID == 10366) Console.WriteLine("Here");
//if (itemInfo.ItemID == 225) _MyStepRTB.Resize += new EventHandler(_MyStepRTB_Resize);
//_MyStepRTB.MyRTBItem = this;
//// TIMING: DisplayItem.TimeIt("CSLARTB InitComp");

View File

@ -46,6 +46,7 @@ namespace Volian.Controls.Library
}
void MyFlexGrid_Resize(object sender, EventArgs e)
{
if (MyFlexGrid.ReadingXml) return;
this.Size = new Size(MyFlexGrid.Width + GridMargin, MyFlexGrid.Height + GridMargin);
AdjustTableWidthAndLocation();
AdjustLocation();
@ -202,10 +203,11 @@ namespace Volian.Controls.Library
private string _OrigRtf; // used to store original rtf to allow for 'escape' key restore
void MyFlexGrid_SelChange(object sender, EventArgs e)
{
if (Initializing) return;
//if (Initializing) return;
//Volian.Base.Library.vlnStackTrace.ShowStackLocal("MyFlexGrid_SelChange {0}",MyFlexGrid.Selection);
RTBLastFocus = false;
MyStepRTB.Visible = false; // Hide the editor if the Selection Changes
if (Initializing) return;
if (MyFlexGrid.Selection.IsSingleCell && MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0)
{
object obj = MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col];
@ -334,6 +336,7 @@ namespace Volian.Controls.Library
}
public override void RefreshContent()
{
_ActiveMode = MyFlexGrid.ContainsFocus;
using (Grid myGrid = MyItemInfo.MyContent.MyGrid.Get())
{
MyItemInfo.MyContent.MyGrid.ResetContent(myGrid);
@ -562,8 +565,8 @@ namespace Volian.Controls.Library
{
Focus();
MyFlexGrid.Focus();
if (!MyFlexGrid.IsRoTable) // Table ROs are none editable - don't select a table cell
MyFlexGrid.Select(0, 0);
//if (!MyFlexGrid.IsRoTable) // Table ROs are none editable - don't select a table cell
// MyFlexGrid.Select(0, 0);
}
else
{

View File

@ -438,7 +438,8 @@ namespace Volian.Controls.Library
else
{
lastEI.SaveContents();
lastEI.RefreshDisplay(false);
if (!(lastEI.MyItemInfo.IsTable))
lastEI.RefreshDisplay(false);
}
}
_SelectedEditItem = value;
@ -446,7 +447,10 @@ namespace Volian.Controls.Library
{
_SelectedEditItem.RefreshDisplay(true);
if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID)
{
ExpandAsNeeded(value.MyItemInfo);
SelectedItemInfo = value.MyItemInfo;
}
}
if (lastEI != null)
lastEI.IdentifyMe(false);

View File

@ -524,6 +524,12 @@ namespace Volian.Controls.Library
CellRange cr = GetMergedRange(row, col);
return (cr.r1 == row && cr.c1 == col);
}
private bool _ReadingXml = false;
public bool ReadingXml
{
get { return _ReadingXml; }
}
private static Regex _ReplaceVESymbFix = new Regex(@"({\\f[0-9]+[^ ]* )(VESymbFix)(;})");
private static Regex _ReplaceArialUnicodeMS = new Regex(@"({\\f[0-9]+[^ ]* )(Arial Unicode MS)(;})");
private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!VESymbFix)(?!Arial Unicode MS))([^;]*)|(!!!!))(;})");
@ -555,12 +561,17 @@ namespace Volian.Controls.Library
}
Clear();
MergedRanges.Clear();
_ReadingXml = true;
//Console.WriteLine("LoadGrid - Before ReadXML");
using (StringReader sr = new StringReader(str))
{
ReadXml(sr);
this.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None;
sr.Close();
}
//Console.WriteLine("LoadGrid - After ReadXML");
_ReadingXml = false;
Select(-1, -1); // this keeps the cell from being selected when the grid is first displayed
Visible = true;
}
@ -617,8 +628,33 @@ namespace Volian.Controls.Library
this.KeyDown += new KeyEventHandler(VlnFlexGrid_KeyDown);
this.KeyUp +=new KeyEventHandler(VlnFlexGrid_KeyUp);
TableCellEditor.EditMode = TableCellEditor.Visible; // need to comment out for compile for only jsj - 07FEB2011
this.MouseDown += new MouseEventHandler(VlnFlexGrid_MouseDown);
}
void VlnFlexGrid_MouseDown(object sender, MouseEventArgs e)
{
int left = 0;
int top = 0;
int col = 0;
int row = 0;
while (e.X > left && col < Cols.Count)
{
left += Cols[col].Width > 0 ? Cols[col].Width : Cols.DefaultSize;
col++;
}
while (e.Y > top && row < Rows.Count)
{
top += Rows[row].Height > 0 ? Rows[row].Height : Rows.DefaultSize;
row++;
}
col--;
row--;
//Console.WriteLine("Mousedown Row, Col [{0},{1}]", row, col);
Select(row, col);
}
void _tableCellEditor_HeightChanged(object sender, EventArgs args)
{
if (_tableCellEditor._initializingEdit || !_tableCellEditor.Visible) return;