This commit is contained in:
@@ -19,6 +19,20 @@ namespace Volian.Controls.Library
|
||||
public delegate void VlnFlexGridCursorMovementEvent(object sender, VlnFlexGridCursorMovementEventArgs args);
|
||||
public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid
|
||||
{
|
||||
public bool HasVScroll
|
||||
{
|
||||
get
|
||||
{
|
||||
return RTBAPI.HasVertScroll(this);
|
||||
}
|
||||
}
|
||||
public bool HasHScroll
|
||||
{
|
||||
get
|
||||
{
|
||||
return RTBAPI.HasHorzScroll(this);
|
||||
}
|
||||
}
|
||||
public event VlnFlexGridEvent OpenAnnotations;
|
||||
public void OnOpenAnnotations(object sender, EventArgs args)
|
||||
{
|
||||
@@ -82,42 +96,42 @@ namespace Volian.Controls.Library
|
||||
// _tableCellEditor.ContentsResized += new ContentsResizedEventHandler(_tableCellEditor_ContentsResized);
|
||||
//}
|
||||
|
||||
void _tableCellEditor_ContentsResized(object sender, ContentsResizedEventArgs e)
|
||||
{
|
||||
if (_tableCellEditor._initializingEdit) return;
|
||||
CellRange cr = GetMergedRange(Row, Col);
|
||||
int oH = cr.UserData == null? 0 : (int)cr.UserData;
|
||||
int nH = _tableCellEditor.ContentsRectangle.Height;
|
||||
int Hadj = (nH - oH);
|
||||
cr.UserData = _tableCellEditor.ContentsRectangle.Height;
|
||||
int cellHeight = GetCellHeight(Row,Col);
|
||||
int cellheightNLines = cellHeight / (Rows.DefaultSize - 3);
|
||||
int nHNLines = nH / (Rows.DefaultSize - 3);
|
||||
if (Hadj != 0)
|
||||
{
|
||||
int curHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height;
|
||||
//if (Hadj > 0 && cellHeight <= oH)
|
||||
if (Hadj > 0 && cellheightNLines < nHNLines)
|
||||
curHeight += (Rows.DefaultSize - 3);
|
||||
if (Hadj < 0 && CanReduceRow())
|
||||
curHeight -= (Rows.DefaultSize-3);
|
||||
Rows[Row].Height = curHeight;
|
||||
AdjustGridControlSize();
|
||||
}
|
||||
//cr.UserData = _tableCellEditor.ContentsRectangle.Height;
|
||||
//int mh = GetMaxRowHeight();
|
||||
////Rows[Row].Height = mh + 2;
|
||||
//int h = 0;
|
||||
//if (cr.r1 == cr.r2 && cr.c1 == cr.c2)
|
||||
// h = Rows[Row].Height - 2;
|
||||
//else
|
||||
//{
|
||||
// for (int r = cr.r1; r <= cr.r2; r++)
|
||||
// h += Rows[r].Height - 2;
|
||||
//}
|
||||
//Rows[Row].Height += (mh - h);
|
||||
////AdjustGridControlSize();
|
||||
}
|
||||
//void _tableCellEditor_ContentsResized(object sender, ContentsResizedEventArgs e)
|
||||
//{
|
||||
// if (_tableCellEditor._initializingEdit) return;
|
||||
// CellRange cr = GetMergedRange(Row, Col);
|
||||
// int oH = cr.UserData == null? 0 : (int)cr.UserData;
|
||||
// int nH = _tableCellEditor.ContentsRectangle.Height;
|
||||
// int Hadj = (nH - oH);
|
||||
// cr.UserData = _tableCellEditor.ContentsRectangle.Height;
|
||||
// int cellHeight = GetCellHeight(Row,Col);
|
||||
// int cellheightNLines = cellHeight / (Rows.DefaultSize - 3);
|
||||
// int nHNLines = nH / (Rows.DefaultSize - 3);
|
||||
// if (Hadj != 0)
|
||||
// {
|
||||
// int curHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height;
|
||||
// //if (Hadj > 0 && cellHeight <= oH)
|
||||
// if (Hadj > 0 && cellheightNLines < nHNLines)
|
||||
// curHeight += (Rows.DefaultSize - 3);
|
||||
// if (Hadj < 0 && CanReduceRow())
|
||||
// curHeight -= (Rows.DefaultSize-3);
|
||||
// Rows[Row].Height = curHeight;
|
||||
// AdjustGridControlSize();
|
||||
// }
|
||||
// //cr.UserData = _tableCellEditor.ContentsRectangle.Height;
|
||||
// //int mh = GetMaxRowHeight();
|
||||
// ////Rows[Row].Height = mh + 2;
|
||||
// //int h = 0;
|
||||
// //if (cr.r1 == cr.r2 && cr.c1 == cr.c2)
|
||||
// // h = Rows[Row].Height - 2;
|
||||
// //else
|
||||
// //{
|
||||
// // for (int r = cr.r1; r <= cr.r2; r++)
|
||||
// // h += Rows[r].Height - 2;
|
||||
// //}
|
||||
// //Rows[Row].Height += (mh - h);
|
||||
// ////AdjustGridControlSize();
|
||||
//}
|
||||
private int GetCellHeight(int row, int col)
|
||||
{
|
||||
int height = 0;
|
||||
@@ -128,30 +142,54 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
return height;
|
||||
}
|
||||
private bool CanReduceRow()
|
||||
private int BlankRowSpace()
|
||||
{
|
||||
int curRowHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize - 3 : Rows[Row].Height -3;
|
||||
int curRowHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize - 3 : Rows[Row].Height - 3;
|
||||
int curRowHeightNLines = curRowHeight / (Rows.DefaultSize - 3);
|
||||
bool bReduce = (curRowHeight > (Rows.DefaultSize - 3));
|
||||
if (bReduce)
|
||||
if (curRowHeight <= (Rows.DefaultSize - 3)) return 0; // never have row less than default height
|
||||
int blankRowSpace = curRowHeight;
|
||||
for (int c = 0; c < Cols.Count; c++)
|
||||
{
|
||||
for (int c = 0; c < Cols.Count; c++)
|
||||
CellRange cr = GetMergedRange(Row, c);
|
||||
if (Row >= cr.r1 && Row <= cr.r2)
|
||||
{
|
||||
CellRange cr = GetMergedRange(Row, c);
|
||||
if (Row >= cr.r1 && Row <= cr.r2)
|
||||
{
|
||||
int mergeCellHeightNLines = GetCellHeight(Row, c) / (Rows.DefaultSize - 3);
|
||||
//int ud = (cr.UserData == null) ? 0 : (int)cr.UserData;
|
||||
//if ((c != Col) && curRowHeight <= ud && ud >= mergeCellHeight)
|
||||
// bReduce = false;
|
||||
int ud = ((cr.UserData == null) ? 0 : (int)cr.UserData) / (Rows.DefaultSize - 3);
|
||||
if ((c != Col) && curRowHeightNLines <= ud && ud >= mergeCellHeightNLines)
|
||||
bReduce = false;
|
||||
}
|
||||
int cellHeight = GetCellHeight(Row, c);
|
||||
//int mergeCellHeightNLines = cellHeight / (Rows.DefaultSize - 3);
|
||||
int dataHeight = (cr.UserData == null) ? cellHeight : (int)cr.UserData;
|
||||
int ud = dataHeight / (Rows.DefaultSize - 3);
|
||||
//if (cellHeight < dataHeight)
|
||||
// Console.WriteLine("r {0}, c {1}, cell{2}, data{3}", Row, c, cellHeight, dataHeight);
|
||||
blankRowSpace = Math.Min(blankRowSpace, Math.Max(0,cellHeight - dataHeight));
|
||||
}
|
||||
}
|
||||
return bReduce;
|
||||
//Console.WriteLine("BlankRowSpace {0}", blankRowSpace);
|
||||
return blankRowSpace;
|
||||
}
|
||||
//private bool CanReduceRow()
|
||||
//{
|
||||
// int curRowHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize - 3 : Rows[Row].Height -3;
|
||||
// int curRowHeightNLines = curRowHeight / (Rows.DefaultSize - 3);
|
||||
// bool bReduce = (curRowHeight > (Rows.DefaultSize - 3));
|
||||
// if (bReduce)
|
||||
// {
|
||||
// for (int c = 0; c < Cols.Count; c++)
|
||||
// {
|
||||
// CellRange cr = GetMergedRange(Row, c);
|
||||
// if (Row >= cr.r1 && Row <= cr.r2)
|
||||
// {
|
||||
// int mergeCellHeightNLines = GetCellHeight(Row, c) / (Rows.DefaultSize - 3);
|
||||
// //int ud = (cr.UserData == null) ? 0 : (int)cr.UserData;
|
||||
// //if ((c != Col) && curRowHeight <= ud && ud >= mergeCellHeight)
|
||||
// // bReduce = false;
|
||||
// int ud = ((cr.UserData == null) ? 0 : (int)cr.UserData) / (Rows.DefaultSize - 3);
|
||||
// if ((c != Col) && curRowHeightNLines <= ud && ud >= mergeCellHeightNLines)
|
||||
// bReduce = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //Console.WriteLine("canreduce {0}, {1}", Row, bReduce);
|
||||
// return bReduce;
|
||||
//}
|
||||
//private int GetMaxRowHeight()
|
||||
//{
|
||||
// int maxRTFHeight = _minRowSplitHeight; //Rows.DefaultSize;// the smallest a row can be
|
||||
@@ -215,7 +253,8 @@ namespace Volian.Controls.Library
|
||||
|
||||
|
||||
_tableCellEditor = new TableCellEditor(this);
|
||||
_tableCellEditor.ContentsResized += new ContentsResizedEventHandler(_tableCellEditor_ContentsResized);
|
||||
//_tableCellEditor.ContentsResized += new ContentsResizedEventHandler(_tableCellEditor_ContentsResized);
|
||||
_tableCellEditor.HeightChanged += new StepRTBEvent(_tableCellEditor_HeightChanged);
|
||||
_clpbrdCpyPste = new TableClipBoardFuncts();
|
||||
|
||||
//this.Enter += new System.EventHandler(this.Grid_Enter);
|
||||
@@ -233,8 +272,48 @@ namespace Volian.Controls.Library
|
||||
this.KeyDown += new KeyEventHandler(VlnFlexGrid_KeyDown);
|
||||
this.KeyUp +=new KeyEventHandler(VlnFlexGrid_KeyUp);
|
||||
this.SelChange += new EventHandler(VlnFlexGrid_SelChange);
|
||||
this.Resize += new EventHandler(VlnFlexGrid_Resize);
|
||||
TableCellEditor.EditMode = TableCellEditor.Visible; // need to comment out for compile for only jsj - 07FEB2011
|
||||
}
|
||||
|
||||
|
||||
void _tableCellEditor_HeightChanged(object sender, EventArgs args)
|
||||
{
|
||||
if (_tableCellEditor._initializingEdit || !_tableCellEditor.Visible) return;
|
||||
int curHeight = GetCellHeight(Row, Col);//(Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height;
|
||||
CellRange cr = GetMergedRange(Row, Col);
|
||||
int oH = cr.UserData == null ? curHeight : (int)cr.UserData;
|
||||
int nH = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
int Hadj = (nH - curHeight);//oH);
|
||||
cr.UserData = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
//int cellHeight = GetCellHeight(Row, Col);
|
||||
//int cellheightNLines = cellHeight / (Rows.DefaultSize - 3);
|
||||
//int nHNLines = nH / (Rows.DefaultSize - 3);
|
||||
if (Hadj != 0)
|
||||
{
|
||||
//if (Hadj > 0 && cellHeight <= oH)
|
||||
//if (Hadj > 0 && cellheightNLines < nHNLines)
|
||||
// curHeight += (Rows.DefaultSize - 3);
|
||||
//if (Hadj < 0 && CanReduceRow())
|
||||
// curHeight -= (Rows.DefaultSize - 3);
|
||||
int blankRowSpace = BlankRowSpace();
|
||||
if (Hadj < 0)
|
||||
Hadj = -Math.Min(-Hadj, blankRowSpace);
|
||||
//if (Hadj > 0)
|
||||
// Console.WriteLine("r {0}, nh {1}, curh{2}", Row, nH, curHeight);
|
||||
if (Hadj != 0)
|
||||
{
|
||||
Rows[Row].Height += Hadj;//= curHeight;
|
||||
AdjustGridControlSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VlnFlexGrid_Resize(object sender, EventArgs e)
|
||||
{
|
||||
if (TableCellEditor.Visible)
|
||||
Volian.Base.Library.vlnStackTrace.ShowStackLocal("VlnFlexGrid_Resize", 1);
|
||||
}
|
||||
void VlnFlexGrid_SelChange(object sender, EventArgs e)
|
||||
{
|
||||
// Possibilities
|
||||
@@ -350,6 +429,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCellBorder(Graphics graphics, Rectangle rectangle, int row, int col)
|
||||
{
|
||||
int x1 = rectangle.Left;
|
||||
@@ -548,7 +628,7 @@ namespace Volian.Controls.Library
|
||||
|
||||
this.Size = new Size(wid + difW, height + difH);
|
||||
}
|
||||
this.Refresh();
|
||||
//this.Refresh();
|
||||
}
|
||||
|
||||
public void AdjustGridHeightWidth(int r, int c)
|
||||
@@ -557,23 +637,36 @@ namespace Volian.Controls.Library
|
||||
string tstr = null;
|
||||
bool dummyCharWidth = false;
|
||||
bool AllowWidthShrink = false;
|
||||
trtb.SetTableGridCellRTFPrefix(this.Font);
|
||||
trtb.Clear();
|
||||
tstr = (string)this[r, c];
|
||||
trtb.Font = this.Font;
|
||||
//trtb.Rtf = trtb.RtfPrefixForSymbols;
|
||||
if (tstr != null && tstr.Length > 0)
|
||||
{
|
||||
string tsave = tstr;
|
||||
if (tstr.StartsWith(@"{\rtf"))
|
||||
trtb.Rtf = tstr; // already RTF text
|
||||
else
|
||||
trtb.Text = tstr; // this will convert regular text to RTF text
|
||||
|
||||
//if (trtb.Rtf.Contains("SimSun"))
|
||||
// Console.WriteLine("here's SimSun! :-)");
|
||||
// regular text has special characters to toggle Bold, Underline, and Italics
|
||||
// we need to subtract the width of these characters (allow column/row to shrink)
|
||||
AllowWidthShrink = RemoveBoldUlineItalicChars(trtb.Rtf);
|
||||
|
||||
// this will convert the special characters for Bold, Underline, and Italics
|
||||
// into RTF commands
|
||||
trtb.Rtf = ConvertTableText(trtb.Rtf);
|
||||
//VE_Font vf = new VE_Font(this.Font.FontFamily.Name, (int)this.Font.Size, E_Style.None);
|
||||
trtb.Rtf = trtb.RtfPrefix + ConvertTableText(trtb.Rtf) + "}";
|
||||
string fromRTF = trtb.Rtf;
|
||||
trtb.Rtf = trtb.RtfPrefix + ConvertTableText(tstr) + "}";
|
||||
string fromStr = trtb.Rtf;
|
||||
if (fromRTF.Contains("SimSun"))
|
||||
Console.WriteLine("SimSun");
|
||||
else
|
||||
Compare(fromRTF, fromStr, tsave);
|
||||
//ConvertTableText(trtb);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -589,6 +682,7 @@ namespace Volian.Controls.Library
|
||||
trtb.Text = ""; // clear out the dummy character before saving
|
||||
dummyCharWidth = false;
|
||||
}
|
||||
|
||||
this[r, c] = trtb.Rtf; // save the cleaned up and processed cell text as RTF
|
||||
|
||||
this.Select(r, c, false);
|
||||
@@ -665,6 +759,46 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
|
||||
private void Compare(string fromRTF, string fromStr, string rawstr)
|
||||
{
|
||||
int istart = fromRTF.IndexOf(" ",fromRTF.IndexOf("viewkind"));
|
||||
int jstart = fromStr.IndexOf(" ",fromStr.IndexOf("viewkind"));
|
||||
for (int i = istart; i < fromRTF.Length; i++)
|
||||
{
|
||||
int j = i - istart + jstart;
|
||||
//else if (fromRTF[i] != fromStr[j])
|
||||
if (fromRTF[i] != fromStr[j])
|
||||
{
|
||||
if (fromRTF.Substring(i, 1) == @"~" && fromStr.Substring(j, 3) == @"'a0")
|
||||
{
|
||||
//i++;
|
||||
jstart += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("fromStr:\r\n'{0}'\r\nfromRTF:\r\n'{1}'", fromStr, fromRTF);
|
||||
ShowRawString(rawstr, "rawstr");
|
||||
Console.WriteLine("Str:'{0}' , RTF:'{1}'", fromStr.Substring(j, 10), fromRTF.Substring(i, 10));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowRawString(string str, string title)
|
||||
{
|
||||
Console.WriteLine("Raw Start --{0}:\n", title);
|
||||
foreach (char c in str)
|
||||
{
|
||||
int ic= (int)c;
|
||||
if (c!='\n'&&( ic > 126 || ic < 32))
|
||||
Console.Write("<<{0:x4}>>", ic);
|
||||
else
|
||||
Console.Write(c);
|
||||
}
|
||||
Console.WriteLine("\n-- Raw End:{0}", title);
|
||||
}
|
||||
|
||||
private void Grid_AfterResize(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
this.AdjustGridControlSize();
|
||||
@@ -716,30 +850,123 @@ namespace Volian.Controls.Library
|
||||
|
||||
}
|
||||
|
||||
//private string ConvertTableText(string str, VE_Font vf)
|
||||
private string ConvertTableText(string str)
|
||||
{
|
||||
string rtn = "";
|
||||
string rtn = str;
|
||||
//ShowRawString(str,"ConvertTableText IN");
|
||||
if (!str.StartsWith(@"{\rtf"))
|
||||
{
|
||||
rtn = rtn.Replace("\n", "\\par\r\n");
|
||||
rtn = rtn.Replace("\xF2", @"\f1 \u8805?\f0 "); //greater than or equal
|
||||
rtn = rtn.Replace("\x7F", @"\f1 \u916?\f0 "); // delta
|
||||
if (rtn.Contains("\xFF"))
|
||||
rtn = rtn.Replace("\xFF", @"\u160?");
|
||||
//rtn = rtn.Replace(@"\'a0", @"\u160?");
|
||||
//rtn = rtn.Replace("\xff", @"\u160?");
|
||||
//rtn = rtn.Replace("\xA0", @"\u160?");
|
||||
// underline On
|
||||
rtn = rtn.Replace("\xab", @"\ul");
|
||||
// underline Off
|
||||
rtn = rtn.Replace("\xbb", @"\ulnone");
|
||||
//rtn = rtn.Replace("\xef\xe6", @"\up2 ");
|
||||
//rtn = rtn.Replace("\xef\xe7", @"\up0 ");
|
||||
rtn = rtn.Replace("\x9566", @"\up2 ");
|
||||
rtn = rtn.Replace("\x9567", @"\up0 ");
|
||||
rtn = rtn.Replace("{", @"\{");
|
||||
rtn = rtn.Replace("}", @"\}");
|
||||
rtn = rtn.Replace("\xd5", @"\b");
|
||||
rtn = rtn.Replace("\xd6", @"\b0");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Underline next word
|
||||
rtn = SomethingNextWord(rtn, @"\'17", @"\ul ", @"\ulnone ");
|
||||
|
||||
// Underline next word
|
||||
rtn = SomethingNextWord(str, @"\'17", @"\ul ", @"\ulnone ");
|
||||
// Bold next word
|
||||
rtn = SomethingNextWord(rtn, @"\'13", @"\b ", @"\b0 ");
|
||||
|
||||
// Bold next word
|
||||
rtn = SomethingNextWord(rtn, @"\'13", @"\b ", @"\b0 ");
|
||||
// Italics On
|
||||
rtn = rtn.Replace(@"\'1B4", @"\i ");
|
||||
|
||||
// Italics On
|
||||
rtn = rtn.Replace(@"\'1B4", @"\i ");
|
||||
// Italics Off
|
||||
rtn = rtn.Replace(@"\'1B5", @"\i0 ");
|
||||
|
||||
// Italics Off
|
||||
rtn = rtn.Replace(@"\'1B5", @"\i0 ");
|
||||
// underline On
|
||||
rtn = rtn.Replace(@"\'ab", @"\ul");
|
||||
// underline Off
|
||||
rtn = rtn.Replace(@"\'bb", @"\ulnone");
|
||||
|
||||
// underline On
|
||||
rtn = rtn.Replace(@"\'ab", @"\ul ");
|
||||
// underline Off
|
||||
rtn = rtn.Replace(@"\'bb", @"\ulnone ");
|
||||
rtn = rtn.Replace(@"\'ef\'e6", @"\up2 ");
|
||||
rtn = rtn.Replace(@"\'ef\'e7", @"\up0 ");
|
||||
rtn = rtn.Replace(@"\'f2", @"\f1 \u8805?\f0 "); //greater than or equal
|
||||
//rtn = rtn.Replace("\xB0 ", @"\'b0 ");
|
||||
//rtn = rtn.Replace("\x2552", "\\b ");
|
||||
//rtn = rtn.Replace("\x2553", "\\b0 ");
|
||||
rtn = rtn.Replace(@"\'d5", @"\b");
|
||||
rtn = rtn.Replace(@"\'d6", @"\b0");
|
||||
//rtn = rtn.Replace("\xA0", @"\u160?");
|
||||
//rtn = rtn.Replace(@"\'a0", @"\u160?");
|
||||
rtn = rtn.Replace(@"\'ff", @"\u160?");
|
||||
//rtn = rtn.Replace("\xFF", @"\u160?");
|
||||
//rtn = rtn.Replace(@"\~", @"\u160?");
|
||||
rtn = rtn.Replace("\x7F", @"\f1 \u916?\f0 "); // delta
|
||||
}
|
||||
|
||||
//ShowRawString(rtn, "ConvertTableText OUT");
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//private void ConvertTableText(StepRTB srtb)
|
||||
//{
|
||||
// string[] symb = { @"\'f2"};
|
||||
// string str = srtb.Rtf;
|
||||
|
||||
// // Underline next word
|
||||
// str = SomethingNextWord(str, @"\'17", @"\ul ", @"\ulnone ");
|
||||
|
||||
// // Bold next word
|
||||
// str = SomethingNextWord(str, @"\'13", @"\b ", @"\b0 ");
|
||||
|
||||
// // Italics On
|
||||
// str = str.Replace(@"\'1B4", @"\i ");
|
||||
|
||||
// // Italics Off
|
||||
// str = str.Replace(@"\'1B5", @"\i0 ");
|
||||
|
||||
// // underline On
|
||||
// str = str.Replace(@"\'ab", @"\ul");
|
||||
// // underline Off
|
||||
// str = str.Replace(@"\'bb", @"\ulnone");
|
||||
|
||||
// str = str.Replace(@"\'ef\'e6", @"\up2 ");
|
||||
// str = str.Replace(@"\'ef\'e7", @"\up0 ");
|
||||
// str = str.Replace(@"\'d5", @"\b");
|
||||
// str = str.Replace(@"\'d6", @"\b0");
|
||||
// str = str.Replace("\xA0", @"\u160?");
|
||||
// str = str.Replace("\x7F", @"\u916?");
|
||||
// VE_Font vf = new VE_Font(this.Font.FontFamily.Name,(int)this.Font.Size,E_Style.None);
|
||||
// DisplayText dt = new DisplayText(str,vf, true);
|
||||
|
||||
// srtb.Rtf = str;
|
||||
// //srtb.SelectionStart = 0;
|
||||
// //foreach (string s in symb)
|
||||
// //{
|
||||
// // int idx = srtb.Rtf.LastIndexOf(s, srtb.Rtf.Length-1);
|
||||
// // while (idx >= 0)
|
||||
// // {
|
||||
// // srtb.Rtf = srtb.Rtf.Remove(idx, s.Length);
|
||||
// // srtb.SelectionStart = idx;
|
||||
// // srtb.InsertSymbol(s);
|
||||
// // idx = srtb.Rtf.LastIndexOf(s,idx);
|
||||
// // }
|
||||
// //}
|
||||
// //rtn = rtn.Replace("\xf2 ", @"\u8805?"); //greater than or equal
|
||||
// //rtn = rtn.Replace("\xA0", @"\u160?");
|
||||
// //rtn = rtn.Replace("\x7F", @"\u916?");
|
||||
|
||||
//}
|
||||
|
||||
// This converts Underline or bold next word character to the corresponding on/off commands
|
||||
private static string SomethingNextWord(string str, string nxtwordcmd, string cmdOn, string cmdOff)
|
||||
{
|
||||
@@ -1711,13 +1938,18 @@ namespace Volian.Controls.Library
|
||||
// get the cell text in the first cell of the merged grouping of cells
|
||||
// we will append the newly parsed text to this cell's text.
|
||||
int rw = curRow;
|
||||
while (rw - 1 > 0 && tci[rw - 1, curCol].MergeRowBellow) rw--;
|
||||
string jstr = (string)this[rw, curCol];
|
||||
while (rw - 1 >= 0 && tci[rw - 1, curCol].MergeRowBellow) rw--;
|
||||
int cl = curCol;
|
||||
while (cl - 1 >= 0 && tci[rw, cl-1].MergeColRight) cl--;
|
||||
//string jstr = (string)this[rw, curCol];
|
||||
string jstr = (string)this[rw, cl];
|
||||
if (jstr == null)
|
||||
jstr = tstr;
|
||||
else
|
||||
jstr += "\n" + tstr; // multi line cell
|
||||
this[rw, curCol] = jstr;
|
||||
jstr += ((cl==curCol)? "\n" : "") + tstr; // multi line cell
|
||||
//jstr += "\n" + tstr; // multi line cell
|
||||
//this[rw, curCol] = jstr;
|
||||
this[rw, cl] = jstr;
|
||||
// take a peek at the start of the next piece of table text to parse
|
||||
// if it starts with a '-' char, then flag to merge the columns up to
|
||||
// this point with the same columns in the next row
|
||||
@@ -1754,14 +1986,19 @@ namespace Volian.Controls.Library
|
||||
// get the cell text in the first cell of the merged grouping of cells
|
||||
// we will append the newly parsed text to this cell's text.
|
||||
int rw = curRow;
|
||||
while (rw - 1 > 0 && tci[rw - 1, curCol].MergeRowBellow) rw--;
|
||||
string jstr = (string)this[rw, curCol];
|
||||
while (rw - 1 >= 0 && tci[rw - 1, curCol].MergeRowBellow) rw--;
|
||||
int cl = curCol;
|
||||
while (cl - 1 >= 0 && tci[rw, cl-1].MergeColRight) cl--;
|
||||
//string jstr = (string)this[rw, curCol];
|
||||
string jstr = (string)this[rw, cl];
|
||||
if (jstr == null)
|
||||
jstr = tstr;
|
||||
else
|
||||
jstr += "\n" + tstr; // multi line cell
|
||||
jstr += ((cl == curCol) ? "\n" : "") + tstr; // multi line cell
|
||||
//jstr += "\n" + tstr; // multi line cell
|
||||
|
||||
this[rw, curCol] = jstr;
|
||||
//this[rw, curCol] = jstr;
|
||||
this[rw, cl] = jstr;
|
||||
}
|
||||
else if (tstr.Length > 0) // parsed text is all dash characters
|
||||
{
|
||||
@@ -1808,13 +2045,18 @@ namespace Volian.Controls.Library
|
||||
// get the cell text in the first cell of the merged grouping of cells
|
||||
// we will append the newly parsed text to this cell's text.
|
||||
int rw = curRow;
|
||||
while (rw - 1 > 0 && tci[rw - 1, curCol].MergeRowBellow) rw--;
|
||||
string jstr = (string)this[rw, curCol];
|
||||
while (rw - 1 >= 0 && tci[rw - 1, curCol].MergeRowBellow) rw--;
|
||||
int cl = curCol;
|
||||
while (cl - 1 >= 0 && tci[rw, cl-1].MergeColRight) cl--;
|
||||
//string jstr = (string)this[rw, curCol];
|
||||
string jstr = (string)this[rw, cl];
|
||||
if (jstr == null)
|
||||
jstr = tstr;
|
||||
else
|
||||
jstr += "\n" + tstr; // multi line cell
|
||||
this[rw, curCol] = jstr;
|
||||
jstr += ((cl == curCol) ? "\n" : "") + tstr; // multi line cell
|
||||
//jstr += "\n" + tstr; // multi line cell
|
||||
//this[rw, curCol] = jstr;
|
||||
this[rw, cl] = jstr;
|
||||
}
|
||||
}
|
||||
} while (idx != -1);
|
||||
@@ -2217,6 +2459,7 @@ namespace Volian.Controls.Library
|
||||
AutoSize = false;
|
||||
BackColor = Color.SkyBlue;
|
||||
BorderStyle = BorderStyle.None;
|
||||
ScrollBars = RichTextBoxScrollBars.None;
|
||||
|
||||
_initializingEdit = false;
|
||||
_pendingKey = (char)0;
|
||||
@@ -2226,7 +2469,7 @@ namespace Volian.Controls.Library
|
||||
this.CursorMovement += new StepRTBCursorMovementEvent(TableCellEditor_CursorMovement);
|
||||
this.CursorKeyPress += new StepRTBCursorKeysEvent(TableCellEditor_CursorKeyPress);
|
||||
this.Leave += new EventHandler(_editor_Leave);
|
||||
this.HeightChanged += new StepRTBEvent(_HeightChanged);
|
||||
//this.HeightChanged += new StepRTBEvent(_HeightChanged);
|
||||
}
|
||||
|
||||
// start editing: move to cell and activate
|
||||
@@ -2261,13 +2504,15 @@ namespace Volian.Controls.Library
|
||||
|
||||
Size sz = new Size(rc.Width, rc.Height);
|
||||
|
||||
this.Size = sz;
|
||||
//this.Size = sz;
|
||||
this.Width = rc.Width;
|
||||
|
||||
// make editor visible
|
||||
Visible = true;
|
||||
|
||||
// and get the focus
|
||||
Select();
|
||||
//Select();
|
||||
Focus();
|
||||
_initializingEdit = false;
|
||||
}
|
||||
|
||||
@@ -2350,10 +2595,10 @@ namespace Volian.Controls.Library
|
||||
_owner.Invalidate();
|
||||
_owner.AdjustGridControlSize();
|
||||
}
|
||||
void _HeightChanged(object sender, EventArgs args)
|
||||
{
|
||||
_owner.Invalidate();
|
||||
}
|
||||
//void _HeightChanged(object sender, EventArgs args)
|
||||
//{
|
||||
// _owner.Invalidate();
|
||||
//}
|
||||
|
||||
// save key that started the editing mode
|
||||
public void SetPendingKey(char chr)
|
||||
|
Reference in New Issue
Block a user