Check for index in range before selecting range in DataGridView.

Replace {sp} with space when svgText elements are deserialized.
Added error handling for missing genmac macros.
Changed lookup to internal to check for missing genmac macros.
This commit is contained in:
Rich 2011-06-23 21:30:38 +00:00
parent 5a7af006a8
commit 595db08cc7
4 changed files with 10 additions and 4 deletions

View File

@ -398,7 +398,6 @@ namespace Sync
if (fc.ReadOnly) fc.MoveToDevelopment(); if (fc.ReadOnly) fc.MoveToDevelopment();
} }
} }
private void listToClipboardToolStripMenuItem_Click(object sender, EventArgs e) private void listToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
{ {
dgv.EndEdit(); dgv.EndEdit();
@ -428,6 +427,7 @@ namespace Sync
{ {
dgv.ClearSelection(); dgv.ClearSelection();
DataGridView.HitTestInfo info = dgv.HitTest(e.X, e.Y); DataGridView.HitTestInfo info = dgv.HitTest(e.X, e.Y);
if (info.RowIndex < 0) return;
dgv.CurrentCell = dgv[0, info.RowIndex]; dgv.CurrentCell = dgv[0, info.RowIndex];
dgv.Rows[info.RowIndex].Selected = true; dgv.Rows[info.RowIndex].Selected = true;
} }

View File

@ -112,7 +112,7 @@ namespace Volian.Svg.Library
#region Part Lookup #region Part Lookup
private Dictionary<string, SvgPart> _LookUp; private Dictionary<string, SvgPart> _LookUp;
[XmlIgnore] [XmlIgnore]
private Dictionary<string, SvgPart> LookUp internal Dictionary<string, SvgPart> LookUp
{ {
get get
{ {

View File

@ -68,7 +68,7 @@ namespace Volian.Svg.Library
public string Text public string Text
{ {
get { return _Text; } get { return _Text; }
set { _Text = value; } set { _Text = value.Replace("{sp}"," "); }
} }
#endregion #endregion
#region Font Settings #region Font Settings

View File

@ -346,11 +346,17 @@ namespace Volian.Svg.Library
} }
public partial class SvgUse : SvgPartInheritance public partial class SvgUse : SvgPartInheritance
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
{ {
// TODO: Could I use the template // TODO: Could I use the template
SetupInheritance(myParent.MyInheritedSettings); SetupInheritance(myParent.MyInheritedSettings);
mySvg[_UseID].Draw(cb, scale.AdjustOrigin(X, Y), mySvg, this); if (mySvg.LookUp.ContainsKey(_UseID))
mySvg[_UseID].Draw(cb, scale.AdjustOrigin(X, Y), mySvg, this);
else
{
_MyLog.WarnFormat("Missing Macro '{0}'", _UseID);
}
//cb.AddTemplate(mySvg.GetTemplate(_UseID.Substring(1),cb), scale.X(X), scale.Y(cb, Y)); //cb.AddTemplate(mySvg.GetTemplate(_UseID.Substring(1),cb), scale.X(X), scale.Y(cb, Y));
} }
public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent) public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)