Make TableWidth a Public Method
Fix Logic to move selection around links
This commit is contained in:
parent
9f780c4477
commit
3858729217
@ -1607,7 +1607,7 @@ namespace Volian.Controls.Library
|
|||||||
/// <param name="myFont"></param>
|
/// <param name="myFont"></param>
|
||||||
/// <param name="txt"></param>
|
/// <param name="txt"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private float TableWidth(Font myFont, string txt)
|
public float TableWidth(Font myFont, string txt)
|
||||||
{
|
{
|
||||||
string[] lines = txt.Split("\n".ToCharArray());
|
string[] lines = txt.Split("\n".ToCharArray());
|
||||||
float max = 0;
|
float max = 0;
|
||||||
|
@ -168,12 +168,12 @@ namespace Volian.Controls.Library
|
|||||||
_SelectedRtfSB.Remove(0, _SelectedRtfSB.Length);
|
_SelectedRtfSB.Remove(0, _SelectedRtfSB.Length);
|
||||||
|
|
||||||
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit);
|
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit);
|
||||||
if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
||||||
{
|
//{
|
||||||
ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||||
if (!ReadOnly && !edit) ReadOnly = true;
|
// if (!ReadOnly && !edit) ReadOnly = true;
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
_origDisplayText = vlntxt;
|
_origDisplayText = vlntxt;
|
||||||
#if(DEBUG)
|
#if(DEBUG)
|
||||||
// Use Times New Roman for Debugging
|
// Use Times New Roman for Debugging
|
||||||
@ -207,7 +207,6 @@ namespace Volian.Controls.Library
|
|||||||
int typ = ((int)_MyItemInfo.MyContent.Type) % 10000;
|
int typ = ((int)_MyItemInfo.MyContent.Type) % 10000;
|
||||||
OutlineTable(_MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless")<0);
|
OutlineTable(_MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless")<0);
|
||||||
FindAllLinks();
|
FindAllLinks();
|
||||||
AdjustSizeForContents(); // TODO: this is not quite right yet.
|
|
||||||
}
|
}
|
||||||
SelectAll();
|
SelectAll();
|
||||||
SelectionHangingIndent = 0;
|
SelectionHangingIndent = 0;
|
||||||
@ -222,9 +221,18 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
AddEventHandlers();
|
AddEventHandlers();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_MyStepItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
||||||
|
{
|
||||||
|
//AdjustWidthForContent();
|
||||||
|
_MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
_origRTF = Rtf;
|
_origRTF = Rtf;
|
||||||
_InitializingRTB = false;
|
_InitializingRTB = false;
|
||||||
_MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
|
_MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
|
||||||
|
AdjustSizeForContents(); // TODO: this is not quite right yet.
|
||||||
}
|
}
|
||||||
private bool _ProcessKeystrokes = true;
|
private bool _ProcessKeystrokes = true;
|
||||||
public bool ProcessKeystrokes
|
public bool ProcessKeystrokes
|
||||||
@ -776,7 +784,7 @@ namespace Volian.Controls.Library
|
|||||||
int widthNew = ContentsSize.Width + offset.Width + AdjustSize.Width;
|
int widthNew = ContentsSize.Width + offset.Width + AdjustSize.Width;
|
||||||
int heightNew = ContentsSize.Height + offset.Height + AdjustSize.Height;
|
int heightNew = ContentsSize.Height + offset.Height + AdjustSize.Height;
|
||||||
Size szNew = new Size(widthNew,heightNew);
|
Size szNew = new Size(widthNew,heightNew);
|
||||||
if (this.Size != szNew)
|
if (this.Size != szNew && !_InitializingRTB)
|
||||||
{
|
{
|
||||||
this.Size = szNew;
|
this.Size = szNew;
|
||||||
OnHeightChanged(this, new EventArgs());
|
OnHeightChanged(this, new EventArgs());
|
||||||
@ -2080,13 +2088,20 @@ namespace Volian.Controls.Library
|
|||||||
SelectedRtf = RtfPrefix + (withBorder ? @"\u9474?" : " ") + "}";
|
SelectedRtf = RtfPrefix + (withBorder ? @"\u9474?" : " ") + "}";
|
||||||
}
|
}
|
||||||
// Add the top line
|
// Add the top line
|
||||||
|
if (_MyStepItem != null)
|
||||||
|
{
|
||||||
|
//AdjustWidthForContent();
|
||||||
|
_MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text);
|
||||||
|
}
|
||||||
Select(0, 0);
|
Select(0, 0);
|
||||||
SelectedRtf = RtfPrefix + (withBorder ? @"\u9484?" : " ") + horzLine + (withBorder ? @"\u9488?\par " : @" \par ") + "}";
|
SelectedRtf = RtfPrefix + (withBorder ? @"\u9484?" : " ") + horzLine + (withBorder ? @"\u9488?\par " : @" \par ") + "}";
|
||||||
// Add the bottom line
|
// Add the bottom line
|
||||||
Select(TextLength, 0);
|
Select(TextLength, 0);
|
||||||
|
ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
|
||||||
SelectedRtf = RtfPrefix + (withBorder ? @"\par\u9492?" : @"\par ") + horzLine + (withBorder ? @"\u9496?" : @" ") + "}";
|
SelectedRtf = RtfPrefix + (withBorder ? @"\par\u9492?" : @"\par ") + horzLine + (withBorder ? @"\u9496?" : @" ") + "}";
|
||||||
|
ContentsResized -= new ContentsResizedEventHandler(StepRTB_ContentsResized);
|
||||||
ReplaceLinesInTable(withBorder);
|
ReplaceLinesInTable(withBorder);
|
||||||
|
|
||||||
}
|
}
|
||||||
private int MaxCharacterWidth()
|
private int MaxCharacterWidth()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user