Move frmErrors when frmLoader is moved
Shutoff SpellCheck for StepRTB Use using for temporary StepRTB Use using for vlnFlexGrid Added debug output to track StepRTBs and vlnFlexGrids in memory Limit bottom margin to 0 or above Dispose of roImage after it is done being used Dispose of Figure after it is done being used. Use GetJustRODB so that images are not loaded. Added ErrorHandler if annotation is deleted after a search Track create, dispose and finalize Add static variable to control if SpellCheck is used Use using for temporary StepRTB Lazy Load SelectionStack Clean-up on Dispose Track create, dispose and finalize Make MyCopyInfo Lazy Loaded Use using for temporary StepRTB Add Dispose method for TableCellEditor Cleanup on Dispose Only kill MSWord instances that are invisible
This commit is contained in:
parent
ce21565a15
commit
7bcfafcc8b
@ -118,10 +118,11 @@ namespace DataLoader
|
|||||||
string fixStpText = "";
|
string fixStpText = "";
|
||||||
if (IsATable(content.Type))
|
if (IsATable(content.Type))
|
||||||
{
|
{
|
||||||
//if (ProcNumber == "EOP-ES-1.2")
|
|
||||||
// Console.WriteLine("here");
|
|
||||||
bool hasBorder = !WithoutBorder(content.Type);
|
bool hasBorder = !WithoutBorder(content.Type);
|
||||||
fixStpText = ConvertTableToGrid(stptext, content, fmt, isROTable, hasBorder ? GridLinePattern.Single : GridLinePattern.None );
|
fixStpText = ConvertTableToGrid(stptext, content, fmt, isROTable, hasBorder ? GridLinePattern.Single : GridLinePattern.None );
|
||||||
|
frmMain.AddInfo("Memory After Grid Convert {0}", GC.GetTotalMemory(true)); // This will force a Garbage Collection
|
||||||
|
frmMain.AddInfo("VlnFlexGrid Counts: {0}, {1}, {2}", VlnFlexGrid.CountCreated, VlnFlexGrid.CountNotDisposed, VlnFlexGrid.CountNotFinalized);
|
||||||
|
frmMain.AddInfo("StepRTB Counts: {0}, {1}, {2}", StepRTB.CountCreated, StepRTB.CountNotDisposed, StepRTB.CountNotFinalized);
|
||||||
int? typ = ConvertTableType(content, fmt);
|
int? typ = ConvertTableType(content, fmt);
|
||||||
if (typ != null) content.Type = typ;
|
if (typ != null) content.Type = typ;
|
||||||
else _ContentMigrationErrors.Add(content.ContentID, null);
|
else _ContentMigrationErrors.Add(content.ContentID, null);
|
||||||
@ -372,16 +373,17 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
//string savethis = stepText;
|
//string savethis = stepText;
|
||||||
string strGrid = "";
|
string strGrid = "";
|
||||||
VlnFlexGrid grd = new VlnFlexGrid(1, 1);
|
//MessageBox.Show("Before ConvertTableToGrid " + GC.GetTotalMemory(true).ToString());
|
||||||
|
using (VlnFlexGrid grd = new VlnFlexGrid(1, 1))
|
||||||
|
{
|
||||||
grd.IsRoTable = isROTable;
|
grd.IsRoTable = isROTable;
|
||||||
VE_Font vefont = fmt.PlantFormat.FormatData.StepDataList.Table.Font;
|
VE_Font vefont = fmt.PlantFormat.FormatData.StepDataList.Table.Font;
|
||||||
Font GridFont = new Font(vefont.Family, (float)vefont.Size);
|
Font GridFont = new Font(vefont.Family, (float)vefont.Size);
|
||||||
grd.Font = GridFont; // this also changes the default Row Height "Rows.DefaultSize"
|
grd.Font = GridFont; // this also changes the default Row Height "Rows.DefaultSize"
|
||||||
grd.ParseTableFromText(stepText,border);
|
grd.ParseTableFromText(stepText, border);
|
||||||
grd.AutoSizeCols();
|
grd.AutoSizeCols();
|
||||||
grd.AutoSizeRows();
|
grd.AutoSizeRows();
|
||||||
grd.MakeRTFcells();
|
grd.MakeRTFcells();
|
||||||
|
|
||||||
using (StringWriter sw = new StringWriter())
|
using (StringWriter sw = new StringWriter())
|
||||||
{
|
{
|
||||||
grd.WriteXml(sw);
|
grd.WriteXml(sw);
|
||||||
@ -390,7 +392,7 @@ namespace DataLoader
|
|||||||
strGrid = grd.GetSearchableText();
|
strGrid = grd.GetSearchableText();
|
||||||
sw.Close();
|
sw.Close();
|
||||||
}
|
}
|
||||||
grd.Dispose();
|
}
|
||||||
return strGrid;
|
return strGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,13 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_MyParent = myParent;
|
_MyParent = myParent;
|
||||||
|
_MyParent.Move += new EventHandler(_MyParent_Move);
|
||||||
|
}
|
||||||
|
void _MyParent_Move(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AdjustLocation();
|
||||||
}
|
}
|
||||||
private int _ErrorCount = 0;
|
private int _ErrorCount = 0;
|
||||||
|
|
||||||
public int ErrorCount
|
public int ErrorCount
|
||||||
{
|
{
|
||||||
get { return _ErrorCount; }
|
get { return _ErrorCount; }
|
||||||
@ -67,9 +71,18 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
private void frmErrors_Load(object sender, EventArgs e)
|
private void frmErrors_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Rectangle rec = Screen.GetWorkingArea(this);
|
AdjustLocation();
|
||||||
|
}
|
||||||
|
private void AdjustLocation()
|
||||||
|
{
|
||||||
|
int maxRight = Screen.GetWorkingArea(this).Right;
|
||||||
|
if (Screen.AllScreens.Length > 1)
|
||||||
|
{
|
||||||
|
foreach (Screen sc in Screen.AllScreens)
|
||||||
|
if (sc.WorkingArea.Right > maxRight) maxRight = sc.WorkingArea.Right;
|
||||||
|
}
|
||||||
Top = _MyParent.Top;
|
Top = _MyParent.Top;
|
||||||
Left = _MyParent.Right + Width > rec.Right ? rec.Right - Width : _MyParent.Right;
|
Left = _MyParent.Right + Width > maxRight ? maxRight - Width : _MyParent.Right;
|
||||||
}
|
}
|
||||||
public void Save(string path)
|
public void Save(string path)
|
||||||
{
|
{
|
||||||
|
@ -588,6 +588,7 @@ namespace DataLoader
|
|||||||
_Loading = false;
|
_Loading = false;
|
||||||
MSWordToPDF.CloseWordWhenDone = false;
|
MSWordToPDF.CloseWordWhenDone = false;
|
||||||
Format.FormatLoaded += new FormatEvent(Format_FormatLoaded);
|
Format.FormatLoaded += new FormatEvent(Format_FormatLoaded);
|
||||||
|
StepRTB.DoSpellCheck = false;
|
||||||
}
|
}
|
||||||
void Format_FormatLoaded(object sender, FormatEventArgs args)
|
void Format_FormatLoaded(object sender, FormatEventArgs args)
|
||||||
{
|
{
|
||||||
@ -601,13 +602,14 @@ namespace DataLoader
|
|||||||
//List<int> cachePdfInfo = PdfInfo.CacheList;
|
//List<int> cachePdfInfo = PdfInfo.CacheList;
|
||||||
//List<int> cacheDocVersionInfo = DocVersionInfo.CacheList;
|
//List<int> cacheDocVersionInfo = DocVersionInfo.CacheList;
|
||||||
//if (!CheckLogPath()) return;
|
//if (!CheckLogPath()) return;
|
||||||
StepRTB rtb = new StepRTB();
|
using (StepRTB rtb = new StepRTB())
|
||||||
TransitionFixer myFixer = new TransitionFixer(rtb,MySettings.LogFilePath);
|
{
|
||||||
|
TransitionFixer myFixer = new TransitionFixer(rtb, MySettings.LogFilePath);
|
||||||
myFixer.StatusChanged += new TransitionFixerEvent(myFixer_StatusChanged);
|
myFixer.StatusChanged += new TransitionFixerEvent(myFixer_StatusChanged);
|
||||||
TimeSpan howlong = myFixer.Process(MySettings.CheckRTF);
|
TimeSpan howlong = myFixer.Process(MySettings.CheckRTF);
|
||||||
string TransFixTime = string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds);
|
string TransFixTime = string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds);
|
||||||
MyInfo = TransFixTime;
|
MyInfo = TransFixTime;
|
||||||
if(!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
|
if (!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
|
||||||
//MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
|
//MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
|
||||||
CreateBackupRestoreBatchFiles();
|
CreateBackupRestoreBatchFiles();
|
||||||
ItemInfo.RestoreCacheList(cacheItemInfo);
|
ItemInfo.RestoreCacheList(cacheItemInfo);
|
||||||
@ -617,6 +619,7 @@ namespace DataLoader
|
|||||||
//DocVersionInfo.RestoreCacheList(cacheDocVersionInfo);
|
//DocVersionInfo.RestoreCacheList(cacheDocVersionInfo);
|
||||||
MyInfo = CSLACache.UsageAll;
|
MyInfo = CSLACache.UsageAll;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void myFixer_StatusChanged(object sender, TransitionFixerEventArgs args)
|
void myFixer_StatusChanged(object sender, TransitionFixerEventArgs args)
|
||||||
{
|
{
|
||||||
|
@ -770,16 +770,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
float oldRight = myDoc.PageSetup.RightMargin;
|
float oldRight = myDoc.PageSetup.RightMargin;
|
||||||
float oldHeight = myDoc.PageSetup.PageHeight;
|
float oldHeight = myDoc.PageSetup.PageHeight;
|
||||||
float oldWidth = myDoc.PageSetup.PageWidth;
|
float oldWidth = myDoc.PageSetup.PageWidth;
|
||||||
float newRight = oldWidth - (newWidth + newLeft);
|
float newRight = Math.Max(0, oldWidth - (newWidth + newLeft));
|
||||||
if (newRight < 0) newRight = 0;
|
float newBottom = Math.Max(0, oldHeight - (newLength + newTop + 1));
|
||||||
float newBottom = oldBottom - newTop;
|
|
||||||
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", newTop, newLeft, newLength, newWidth, oldTop, oldLeft, oldBottom, oldRight,oldHeight,oldWidth);
|
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", newTop, newLeft, newLength, newWidth, oldTop, oldLeft, oldBottom, oldRight,oldHeight,oldWidth);
|
||||||
if (printingMode)
|
if (printingMode)
|
||||||
{
|
{
|
||||||
if (myDoc.PageSetup.BottomMargin != 9999999)
|
if (myDoc.PageSetup.BottomMargin != 9999999)
|
||||||
{
|
{
|
||||||
// the + 1 in the next line allows for rounding.
|
// the + 1 in the next line allows for rounding.
|
||||||
myDoc.PageSetup.BottomMargin = 11 * 72 - (newTop + newLength + 1);
|
myDoc.PageSetup.BottomMargin = newBottom;
|
||||||
myDoc.PageSetup.RightMargin = newRight;
|
myDoc.PageSetup.RightMargin = newRight;
|
||||||
myDoc.PageSetup.LeftMargin = newLeft;
|
myDoc.PageSetup.LeftMargin = newLeft;
|
||||||
myDoc.PageSetup.TopMargin = newTop;
|
myDoc.PageSetup.TopMargin = newTop;
|
||||||
@ -789,7 +788,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// the + 1 in the next line allows for rounding.
|
// the + 1 in the next line allows for rounding.
|
||||||
myDoc.PageSetup.BottomMargin = 11 * 72 - (newTop + newLength + 1);
|
myDoc.PageSetup.BottomMargin = newBottom;
|
||||||
myDoc.PageSetup.RightMargin = newRight;
|
myDoc.PageSetup.RightMargin = newRight;
|
||||||
myDoc.PageSetup.LeftMargin = newLeft;
|
myDoc.PageSetup.LeftMargin = newLeft;
|
||||||
myDoc.PageSetup.TopMargin = newTop;
|
myDoc.PageSetup.TopMargin = newTop;
|
||||||
|
@ -541,15 +541,19 @@ namespace VEPROMS.CSLA.Library
|
|||||||
byte[] ab = r.ReadBytes((int)fsIn.Length);
|
byte[] ab = r.ReadBytes((int)fsIn.Length);
|
||||||
r.Close();
|
r.Close();
|
||||||
fsIn.Close();
|
fsIn.Close();
|
||||||
roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTimeUtc, "Migration");
|
using (roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTimeUtc, "Migration"))
|
||||||
Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID);
|
{
|
||||||
|
using (Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID))
|
||||||
|
{
|
||||||
if (figure != null) return;
|
if (figure != null) return;
|
||||||
figure = Figure.MakeFigure(rofst, roImg, null);
|
Figure.MakeFigure(rofst, roImg, null).Dispose();
|
||||||
myAddedROImages.Add(key);
|
myAddedROImages.Add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ROImageInfo GetMyImage(Dictionary<string, ROImageInfo> myImages, string imgname, DateTime dts)
|
private ROImageInfo GetMyImage(Dictionary<string, ROImageInfo> myImages, string imgname, DateTime dts)
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
CanReadProperty("MyRODb", true);
|
CanReadProperty("MyRODb", true);
|
||||||
if (_MyRODb == null && _RODbID != 0) _MyRODb = RODbInfo.Get(_RODbID);
|
if (_MyRODb == null && _RODbID != 0) _MyRODb = RODbInfo.GetJustRODB(_RODbID);
|
||||||
return _MyRODb;
|
return _MyRODb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
public partial class AnnotationDetails : UserControl
|
public partial class AnnotationDetails : UserControl
|
||||||
{
|
{
|
||||||
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#region Properties
|
#region Properties
|
||||||
private bool _LoadingAnnotation = false;
|
private bool _LoadingAnnotation = false;
|
||||||
private bool _LoadingGrid = false;
|
private bool _LoadingGrid = false;
|
||||||
@ -266,10 +267,17 @@ namespace Volian.Controls.Library
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
dgAnnotations.Rows[row].Selected = true;
|
dgAnnotations.Rows[row].Selected = true;
|
||||||
if (!_LoadingGrid && (dgAnnotations.FirstDisplayedScrollingRowIndex != -1))
|
if (!_LoadingGrid && (dgAnnotations.FirstDisplayedScrollingRowIndex != -1))
|
||||||
dgAnnotations.FirstDisplayedScrollingRowIndex = row;
|
dgAnnotations.FirstDisplayedScrollingRowIndex = row;
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_MyLog.InfoFormat("Trying to open an annotation which has been removed");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,25 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private bool _Disposed = false;
|
||||||
|
private static int _CountCreated = 0;
|
||||||
|
private static int _CountDisposed = 0;
|
||||||
|
private static int _CountFinalized = 0;
|
||||||
|
private static int IncrementCountCreated
|
||||||
|
{ get { return ++_CountCreated; } }
|
||||||
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
|
public static int CountCreated
|
||||||
|
{ get { return _CountCreated; } }
|
||||||
|
public static int CountNotDisposed
|
||||||
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
|
public static int CountNotFinalized
|
||||||
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
|
private bool _Finalized = false;
|
||||||
|
~StepRTB()
|
||||||
|
{
|
||||||
|
if (!_Finalized) _CountFinalized++;
|
||||||
|
_Finalized = true;
|
||||||
|
}
|
||||||
#region Events
|
#region Events
|
||||||
public event StepRTBRoEvent RoInsert;
|
public event StepRTBRoEvent RoInsert;
|
||||||
public void OnRoInsert(object sender, StepRTBRoEventArgs args)
|
public void OnRoInsert(object sender, StepRTBRoEventArgs args)
|
||||||
@ -542,7 +561,6 @@ namespace Volian.Controls.Library
|
|||||||
SetUpStepRTB();
|
SetUpStepRTB();
|
||||||
AddEventHandlers();
|
AddEventHandlers();
|
||||||
this.BorderStyleChanged += new EventHandler(StepRTB_BorderStyleChanged);
|
this.BorderStyleChanged += new EventHandler(StepRTB_BorderStyleChanged);
|
||||||
|
|
||||||
}
|
}
|
||||||
protected override void OnMouseWheel(MouseEventArgs e)
|
protected override void OnMouseWheel(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
@ -646,6 +664,7 @@ namespace Volian.Controls.Library
|
|||||||
private void SetUpStepRTB()
|
private void SetUpStepRTB()
|
||||||
{
|
{
|
||||||
DetectUrls = false;
|
DetectUrls = false;
|
||||||
|
if(DoSpellCheck)
|
||||||
C1SpellChecker2.SetActiveSpellChecking(this, true);
|
C1SpellChecker2.SetActiveSpellChecking(this, true);
|
||||||
this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables
|
this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables
|
||||||
BorderStyle = System.Windows.Forms.BorderStyle.None;
|
BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||||
@ -892,7 +911,7 @@ namespace Volian.Controls.Library
|
|||||||
if(newRtf != _LastRtf || ReadOnly != _lastReadOnly)
|
if(newRtf != _LastRtf || ReadOnly != _lastReadOnly)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("ItemID:{0}\r\nOld:'{1}'\r\nNew:'{2}'\r\n", MyItemInfo.ItemID, Rtf, newRtf);
|
//Console.WriteLine("ItemID:{0}\r\nOld:'{1}'\r\nNew:'{2}'\r\n", MyItemInfo.ItemID, Rtf, newRtf);
|
||||||
this.ContentsResized -=new ContentsResizedEventHandler(StepRTB_ContentsResized);
|
this.ContentsResized -= new ContentsResizedEventHandler(StepRTB_ContentsResized);
|
||||||
Text = "";
|
Text = "";
|
||||||
this.ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
|
this.ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
|
||||||
SelectedRtf = _LastRtf = newRtf;
|
SelectedRtf = _LastRtf = newRtf;
|
||||||
@ -1704,7 +1723,8 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
private string GetSelectedDisplayableText()
|
private string GetSelectedDisplayableText()
|
||||||
{
|
{
|
||||||
StepRTB srtb = new StepRTB();
|
using (StepRTB srtb = new StepRTB())
|
||||||
|
{
|
||||||
srtb.Rtf = this.SelectedRtf.Replace(@"\u8209?", "-");
|
srtb.Rtf = this.SelectedRtf.Replace(@"\u8209?", "-");
|
||||||
string rtnstr = "";
|
string rtnstr = "";
|
||||||
string ctxt = srtb.Text;//this.SelectedText;
|
string ctxt = srtb.Text;//this.SelectedText;
|
||||||
@ -1736,6 +1756,7 @@ namespace Volian.Controls.Library
|
|||||||
rtnstr += ctxt.Substring(idx);
|
rtnstr += ctxt.Substring(idx);
|
||||||
return rtnstr;
|
return rtnstr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsControlChar = false;
|
private bool IsControlChar = false;
|
||||||
private bool _SendBackSpace = false;
|
private bool _SendBackSpace = false;
|
||||||
@ -2158,14 +2179,25 @@ namespace Volian.Controls.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
#region SelectionStack
|
#region SelectionStack
|
||||||
Stack<SelectionData> _SelectionStack = new Stack<SelectionData>();
|
Stack<SelectionData> _SelectionStack = null;
|
||||||
|
public Stack<SelectionData> SelectionStack
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_SelectionStack == null)
|
||||||
|
_SelectionStack = new Stack<SelectionData>();
|
||||||
|
return _SelectionStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
public void PushSelection()
|
public void PushSelection()
|
||||||
{
|
{
|
||||||
_SelectionStack.Push(new SelectionData(this));
|
SelectionStack.Push(new SelectionData(this));
|
||||||
}
|
}
|
||||||
public void PopSelection()
|
public void PopSelection()
|
||||||
{
|
{
|
||||||
SelectionData selection = _SelectionStack.Pop();
|
SelectionData selection = SelectionStack.Pop();
|
||||||
|
if (SelectionStack.Count == 0)
|
||||||
|
_SelectionStack = null;
|
||||||
Select(selection.SelectionStart, selection.SelectionLength);
|
Select(selection.SelectionStart, selection.SelectionLength);
|
||||||
}
|
}
|
||||||
public class SelectionData
|
public class SelectionData
|
||||||
@ -2299,7 +2331,8 @@ namespace Volian.Controls.Library
|
|||||||
private RichTextBoxFinds _FindOptions = RichTextBoxFinds.None;
|
private RichTextBoxFinds _FindOptions = RichTextBoxFinds.None;
|
||||||
public bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
|
public bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
|
||||||
{
|
{
|
||||||
StepRTB savRTF = new StepRTB();
|
using (StepRTB savRTF = new StepRTB())
|
||||||
|
{
|
||||||
int startpos = SelectionStart + SelectionLength;
|
int startpos = SelectionStart + SelectionLength;
|
||||||
savRTF.Text = this.Text;
|
savRTF.Text = this.Text;
|
||||||
|
|
||||||
@ -2353,6 +2386,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private int FindStart()
|
private int FindStart()
|
||||||
{
|
{
|
||||||
foreach (LinkLocation ll in _LinkLocations)
|
foreach (LinkLocation ll in _LinkLocations)
|
||||||
@ -2784,6 +2818,12 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region SpellChecker
|
#region SpellChecker
|
||||||
|
private static bool _DoSpellCheck = true;
|
||||||
|
public static bool DoSpellCheck
|
||||||
|
{
|
||||||
|
get { return StepRTB._DoSpellCheck; }
|
||||||
|
set { StepRTB._DoSpellCheck = value; }
|
||||||
|
}
|
||||||
// We made the Spell Checker method a static so that all of the StepRTB boxes will bare the same instance of the dictionary.
|
// We made the Spell Checker method a static so that all of the StepRTB boxes will bare the same instance of the dictionary.
|
||||||
// This allow all the StepRTB's to automatically update when a new word is added.
|
// This allow all the StepRTB's to automatically update when a new word is added.
|
||||||
private static C1.Win.C1SpellChecker.C1SpellChecker _C1SpellChecker2;
|
private static C1.Win.C1SpellChecker.C1SpellChecker _C1SpellChecker2;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
partial class StepRTB
|
partial class StepRTB
|
||||||
@ -13,11 +14,16 @@ namespace Volian.Controls.Library
|
|||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
if (_Disposed) return;
|
||||||
|
_CountDisposed++;
|
||||||
|
_Disposed = true;
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
if(!_Finalized)
|
||||||
|
GC.ReRegisterForFinalize(this); // Make sure that StepRTB is finalized
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Component Designer generated code
|
#region Component Designer generated code
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
partial class VlnFlexGrid
|
partial class VlnFlexGrid
|
||||||
@ -13,13 +15,19 @@ namespace Volian.Controls.Library
|
|||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
if (_Disposed) return;
|
||||||
|
_CountDisposed++;
|
||||||
|
_Disposed = true;
|
||||||
|
_MyBorders = null;
|
||||||
|
_SpellChecker = null;
|
||||||
|
_tableCellEditor = null;
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
_SpellChecker.Dispose();
|
|
||||||
_tableCellEditor.Dispose();
|
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
if(!_Finalized)
|
||||||
|
GC.ReRegisterForFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Component Designer generated code
|
#region Component Designer generated code
|
||||||
|
@ -25,8 +25,26 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid
|
public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid
|
||||||
{
|
{
|
||||||
|
private bool _Disposed = false;
|
||||||
|
private static int _CountCreated = 0;
|
||||||
|
private static int _CountDisposed = 0;
|
||||||
|
private static int _CountFinalized = 0;
|
||||||
|
private static int IncrementCountCreated
|
||||||
|
{ get { return ++_CountCreated; } }
|
||||||
|
private int _CountWhenCreated = IncrementCountCreated;
|
||||||
|
public static int CountCreated
|
||||||
|
{ get { return _CountCreated; } }
|
||||||
|
public static int CountNotDisposed
|
||||||
|
{ get { return _CountCreated - _CountDisposed; } }
|
||||||
|
public static int CountNotFinalized
|
||||||
|
{ get { return _CountCreated - _CountFinalized; } }
|
||||||
|
private bool _Finalized = false;
|
||||||
|
~VlnFlexGrid()
|
||||||
|
{
|
||||||
|
if(!_Finalized) _CountFinalized++;
|
||||||
|
_Finalized = true;
|
||||||
|
}
|
||||||
private C1SpellChecker _SpellChecker;
|
private C1SpellChecker _SpellChecker;
|
||||||
|
|
||||||
public C1SpellChecker SpellChecker
|
public C1SpellChecker SpellChecker
|
||||||
{
|
{
|
||||||
get { return _SpellChecker; }
|
get { return _SpellChecker; }
|
||||||
@ -185,7 +203,16 @@ namespace Volian.Controls.Library
|
|||||||
return string.Empty;
|
return string.Empty;
|
||||||
return xd.SelectSingleNode("C1FlexGrid/MergedRanges").InnerXml;
|
return xd.SelectSingleNode("C1FlexGrid/MergedRanges").InnerXml;
|
||||||
}
|
}
|
||||||
public static GridCopyInfo MyCopyInfo = new GridCopyInfo();
|
private static GridCopyInfo _MyCopyInfo;
|
||||||
|
public static GridCopyInfo MyCopyInfo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_MyCopyInfo == null)
|
||||||
|
_MyCopyInfo = new GridCopyInfo();
|
||||||
|
return _MyCopyInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
private Color _DefaultCellBackgroundcolor;
|
private Color _DefaultCellBackgroundcolor;
|
||||||
|
|
||||||
public Color DefaultCellBackgroundcolor
|
public Color DefaultCellBackgroundcolor
|
||||||
@ -648,7 +675,8 @@ namespace Volian.Controls.Library
|
|||||||
int blankColSpace = curColWidth;
|
int blankColSpace = curColWidth;
|
||||||
for (int r = 0; r < Rows.Count; r++)
|
for (int r = 0; r < Rows.Count; r++)
|
||||||
{
|
{
|
||||||
StepRTB srtb = new StepRTB();
|
using (StepRTB srtb = new StepRTB())
|
||||||
|
{
|
||||||
CellRange cr = GetMergedRange(r, Col);
|
CellRange cr = GetMergedRange(r, Col);
|
||||||
srtb.Rtf = GetCellRTFString(cr.r1, cr.c1);
|
srtb.Rtf = GetCellRTFString(cr.r1, cr.c1);
|
||||||
if (Col >= cr.c1 && Col <= cr.c2)
|
if (Col >= cr.c1 && Col <= cr.c2)
|
||||||
@ -666,6 +694,7 @@ namespace Volian.Controls.Library
|
|||||||
blankColSpace = Math.Min(blankColSpace, Math.Max(0, cellWidth - srtb.Width));
|
blankColSpace = Math.Min(blankColSpace, Math.Max(0, cellWidth - srtb.Width));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Console.WriteLine("BlankRowSpace {0}", blankRowSpace);
|
//Console.WriteLine("BlankRowSpace {0}", blankRowSpace);
|
||||||
return blankColSpace;
|
return blankColSpace;
|
||||||
}
|
}
|
||||||
@ -1386,7 +1415,8 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
// only used in test program
|
// only used in test program
|
||||||
CellRange cr = this.Selection;
|
CellRange cr = this.Selection;
|
||||||
StepRTB srtb = new StepRTB();
|
using (StepRTB srtb = new StepRTB())
|
||||||
|
{
|
||||||
srtb.Rtf = this.GetCellRTFString(cr.r1, cr.c1);
|
srtb.Rtf = this.GetCellRTFString(cr.r1, cr.c1);
|
||||||
|
|
||||||
srtb.SelectAll();
|
srtb.SelectAll();
|
||||||
@ -1396,10 +1426,12 @@ namespace Volian.Controls.Library
|
|||||||
srtb.SelectionAlignment = (HorizontalAlignment)align;
|
srtb.SelectionAlignment = (HorizontalAlignment)align;
|
||||||
this.PutCellRTFString(cr.r1, cr.c1, srtb.Rtf);
|
this.PutCellRTFString(cr.r1, cr.c1, srtb.Rtf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void RTFTextAlignment(CellRange cr, HorizontalAlignment ha)
|
public void RTFTextAlignment(CellRange cr, HorizontalAlignment ha)
|
||||||
{
|
{
|
||||||
StepRTB srtb = new StepRTB();
|
using (StepRTB srtb = new StepRTB())
|
||||||
|
{
|
||||||
for (int rw = cr.r1; rw <= cr.r2; rw++)
|
for (int rw = cr.r1; rw <= cr.r2; rw++)
|
||||||
for (int cl = cr.c1; cl <= cr.c2; cl++)
|
for (int cl = cr.c1; cl <= cr.c2; cl++)
|
||||||
{
|
{
|
||||||
@ -1409,6 +1441,7 @@ namespace Volian.Controls.Library
|
|||||||
this.PutCellRTFString(rw, cl, srtb.Rtf);
|
this.PutCellRTFString(rw, cl, srtb.Rtf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum border)
|
public void SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum border)
|
||||||
@ -1578,7 +1611,8 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
public void ConvertTextCellToRTF(int r, int c)
|
public void ConvertTextCellToRTF(int r, int c)
|
||||||
{
|
{
|
||||||
StepRTB trtb = new StepRTB();
|
using (StepRTB trtb = new StepRTB())
|
||||||
|
{
|
||||||
string tstr = null;
|
string tstr = null;
|
||||||
bool dummyCharWidth = false;
|
bool dummyCharWidth = false;
|
||||||
bool AllowWidthShrink = false;
|
bool AllowWidthShrink = false;
|
||||||
@ -1702,9 +1736,11 @@ namespace Volian.Controls.Library
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private void AdjustCellHeightWidth(int r, int c)
|
private void AdjustCellHeightWidth(int r, int c)
|
||||||
{
|
{
|
||||||
StepRTB trtb = new StepRTB();
|
using (StepRTB trtb = new StepRTB())
|
||||||
|
{
|
||||||
string tstr = null;
|
string tstr = null;
|
||||||
bool dummyCharWidth = false;
|
bool dummyCharWidth = false;
|
||||||
bool AllowWidthShrink = false;
|
bool AllowWidthShrink = false;
|
||||||
@ -1736,6 +1772,7 @@ namespace Volian.Controls.Library
|
|||||||
// Now adjust the Height and Width in the defined merge ranges
|
// Now adjust the Height and Width in the defined merge ranges
|
||||||
AdjustMergeRangeHeightWidth(r, c, trtb, tstr, AllowWidthShrink);
|
AdjustMergeRangeHeightWidth(r, c, trtb, tstr, AllowWidthShrink);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void AdjustMergeRangeHeightWidth(int r, int c, StepRTB trtb, string tstr, bool AllowWidthShrink)
|
private void AdjustMergeRangeHeightWidth(int r, int c, StepRTB trtb, string tstr, bool AllowWidthShrink)
|
||||||
{
|
{
|
||||||
@ -2045,12 +2082,14 @@ namespace Volian.Controls.Library
|
|||||||
// find the needed cell width
|
// find the needed cell width
|
||||||
if (Col == cr.c1)
|
if (Col == cr.c1)
|
||||||
{
|
{
|
||||||
StepRTB srtb = new StepRTB();
|
using (StepRTB srtb = new StepRTB())
|
||||||
|
{
|
||||||
srtb.Rtf = GetCellRTFString(cr.r1, cr.c1);
|
srtb.Rtf = GetCellRTFString(cr.r1, cr.c1);
|
||||||
srtb.AdjustWidthForContent();
|
srtb.AdjustWidthForContent();
|
||||||
curColWidth = Math.Max(curColWidth, srtb.Width + 3);
|
curColWidth = Math.Max(curColWidth, srtb.Width + 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return curColWidth;
|
return curColWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2230,7 +2269,8 @@ namespace Volian.Controls.Library
|
|||||||
string rtfText = GetDataDisplay(r, c);
|
string rtfText = GetDataDisplay(r, c);
|
||||||
if (rtfText.StartsWith(@"{\rtf"))
|
if (rtfText.StartsWith(@"{\rtf"))
|
||||||
{
|
{
|
||||||
RTF _rtf = new RTF();
|
using (StepRTB _rtf = new StepRTB())
|
||||||
|
{
|
||||||
_rtf.Width = Cols[c].Width;
|
_rtf.Width = Cols[c].Width;
|
||||||
_rtf.Rtf = rtfText;
|
_rtf.Rtf = rtfText;
|
||||||
CellRange cr = GetCellRange(r, c);
|
CellRange cr = GetCellRange(r, c);
|
||||||
@ -2238,6 +2278,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion //Cell Text
|
#endregion //Cell Text
|
||||||
|
|
||||||
@ -4156,13 +4197,15 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
foreach (CellRange cr in MySelection)
|
foreach (CellRange cr in MySelection)
|
||||||
{
|
{
|
||||||
StepRTB rtb = new StepRTB();
|
using (StepRTB rtb = new StepRTB())
|
||||||
|
{
|
||||||
rtb.Rtf = GetCellRTFString(cr.r1, cr.c1);
|
rtb.Rtf = GetCellRTFString(cr.r1, cr.c1);
|
||||||
rtb.SelectAll();
|
rtb.SelectAll();
|
||||||
rtb.SelectionFont = new Font(rtb.SelectionFont, FontStyle.Bold);
|
rtb.SelectionFont = new Font(rtb.SelectionFont, FontStyle.Bold);
|
||||||
this[cr.r1, cr.c1] = rtb.Rtf;
|
this[cr.r1, cr.c1] = rtb.Rtf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowMySelection()
|
public void ShowMySelection()
|
||||||
{
|
{
|
||||||
@ -4205,7 +4248,10 @@ namespace Volian.Controls.Library
|
|||||||
public enum GridCopyOption { Row, Column, Selection };
|
public enum GridCopyOption { Row, Column, Selection };
|
||||||
|
|
||||||
#region RTF Class for Cell rendering
|
#region RTF Class for Cell rendering
|
||||||
class RTF : StepRTB //RichTextBox
|
/// <summary>
|
||||||
|
/// RTF Should only be used if the contents of the richtextbox are to be converted to an image.
|
||||||
|
/// </summary>
|
||||||
|
class RTF : StepRTB
|
||||||
{
|
{
|
||||||
// messages used by RichEd20.dll
|
// messages used by RichEd20.dll
|
||||||
internal const int
|
internal const int
|
||||||
@ -4351,7 +4397,10 @@ namespace Volian.Controls.Library
|
|||||||
this.Leave += new EventHandler(_editor_Leave);
|
this.Leave += new EventHandler(_editor_Leave);
|
||||||
//this.HeightChanged += new StepRTBEvent(_HeightChanged);
|
//this.HeightChanged += new StepRTBEvent(_HeightChanged);
|
||||||
}
|
}
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
// start editing: move to cell and activate
|
// start editing: move to cell and activate
|
||||||
public void StartEditing(int row, int col)
|
public void StartEditing(int row, int col)
|
||||||
{
|
{
|
||||||
|
@ -118,9 +118,10 @@ namespace Volian.MSWord
|
|||||||
{
|
{
|
||||||
foreach (System.Diagnostics.Process proc in wordProcesses)
|
foreach (System.Diagnostics.Process proc in wordProcesses)
|
||||||
{
|
{
|
||||||
// TODO: Determine if Word is Visible
|
// Determine if Word is Visible
|
||||||
// If it is let it run
|
// If it is let it run
|
||||||
// otherwise Kill it.
|
// otherwise Kill it.
|
||||||
|
if(proc.MainWindowTitle=="")
|
||||||
proc.Kill();
|
proc.Kill();
|
||||||
}
|
}
|
||||||
_MyWordApp = null;
|
_MyWordApp = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user