This commit is contained in:
Jsj 2007-11-30 14:40:47 +00:00
parent 9d594d0470
commit 75590ecaed
3 changed files with 76 additions and 117 deletions

View File

@ -31,7 +31,6 @@ namespace Volian.Controls.Library
//public delegate void vlnCSLARTBLinkEvent(object sender, vlnCSLARTBLinkEventArgs args); //public delegate void vlnCSLARTBLinkEvent(object sender, vlnCSLARTBLinkEventArgs args);
public partial class DisplayItem : UserControl public partial class DisplayItem : UserControl
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Events #region Events
//public event vlnCSLARTBLinkEvent LinkClicked; //public event vlnCSLARTBLinkEvent LinkClicked;
//private void OnLinkClicked(object sender, vlnCSLARTBLinkEventArgs args) //private void OnLinkClicked(object sender, vlnCSLARTBLinkEventArgs args)
@ -129,13 +128,11 @@ namespace Volian.Controls.Library
{ {
case 0: case 0:
ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom); ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom);
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("*0* Item {0} Parent {1}", ItemLocation, _MyParent.ItemLocation);
ItemWidth = _Panel.ToDisplay(_Layout.ColT) + _Panel.ToDisplay(_Layout.WidT); ItemWidth = _Panel.ToDisplay(_Layout.ColT) + _Panel.ToDisplay(_Layout.WidT);
break; break;
case 1: case 1:
//ItemWidth = _Panel.ToDisplay(_ColS) + _Panel.ToDisplay(_layout.WidSTableEdit, Convert.ToInt32(_layout.PMode)-1); //ItemWidth = _Panel.ToDisplay(_ColS) + _Panel.ToDisplay(_layout.WidSTableEdit, Convert.ToInt32(_layout.PMode)-1);
ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom); ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom);
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("*1* Item {0} Parent {1}", ItemLocation, _MyParent.ItemLocation);
int borderWidth = _DisplayRTB.Width - _DisplayRTB.ClientRectangle.Width; int borderWidth = _DisplayRTB.Width - _DisplayRTB.ClientRectangle.Width;
TextWidth = __WidthAdjust + borderWidth + _Panel.ToDisplay(_Layout.WidSTableEdit, Convert.ToInt32(_Layout.PMode) - 1); TextWidth = __WidthAdjust + borderWidth + _Panel.ToDisplay(_Layout.WidSTableEdit, Convert.ToInt32(_Layout.PMode) - 1);
break; break;
@ -148,13 +145,11 @@ namespace Volian.Controls.Library
//ItemLocation = new Point(_MyParent.TextLeft, _MyParent.Bottom); //ItemLocation = new Point(_MyParent.TextLeft, _MyParent.Bottom);
ItemLocation = new Point(50, _MyParent.Bottom); ItemLocation = new Point(50, _MyParent.Bottom);
ItemLocation = TableLocation(_MyParent, _Layout, ItemWidth); ItemLocation = TableLocation(_MyParent, _Layout, ItemWidth);
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("*2T* Item {0} Parent {1}", ItemLocation, _MyParent.ItemLocation);
} }
else else
{ {
ItemLocation = new Point(_MyParent.TextLeft, _MyParent.Bottom); ItemLocation = new Point(_MyParent.TextLeft, _MyParent.Bottom);
ItemWidth = _MyParent.TextWidth; ItemWidth = _MyParent.TextWidth;
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("*2* Item {0} Parent {1}", ItemLocation, _MyParent.ItemLocation);
} }
break; break;
} }
@ -199,7 +194,7 @@ namespace Volian.Controls.Library
{ {
string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands
//if (line != line2) //if (line != line2)
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'{0}' <> '{1}'", line, line2); // Console.WriteLine("'{0}' <> '{1}'", line, line2);
SizeF siz = g.MeasureString(line2, fnt,pnt,StringFormat.GenericTypographic) ; SizeF siz = g.MeasureString(line2, fnt,pnt,StringFormat.GenericTypographic) ;
if (siz.Width+ _Panel.Settings.TableWidthAdjust > max) max = siz.Width + _Panel.Settings.TableWidthAdjust; if (siz.Width+ _Panel.Settings.TableWidthAdjust > max) max = siz.Width + _Panel.Settings.TableWidthAdjust;
} }
@ -238,7 +233,7 @@ namespace Volian.Controls.Library
get { return Width - lblTab.Left; } get { return Width - lblTab.Left; }
set set
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.Debug("ItemWidth"); //Console.Write("\r\nItemWidth");
Width = value + lblTab.Left; Width = value + lblTab.Left;
} }
} }
@ -247,7 +242,7 @@ namespace Volian.Controls.Library
get { return _DisplayRTB.Width; } get { return _DisplayRTB.Width; }
set set
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.Debug("TextWidth"); //Console.Write("\r\nTextWidth");
Width = value + lblTab.Left + lblTab.Width; Width = value + lblTab.Left + lblTab.Width;
} }
} }
@ -388,7 +383,7 @@ namespace Volian.Controls.Library
if ((Expanding != ExpandingStatus.No || Expanded) & _After != null) tmpa = _After[_After.Count - 1].BottomMost; if ((Expanding != ExpandingStatus.No || Expanded) & _After != null) tmpa = _After[_After.Count - 1].BottomMost;
if (tmpr == null) if (tmpr == null)
return tmpa; return tmpa;
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("Left {0}, Right {1}", tmpa.Bottom, tmpr.Bottom); //Console.Write("\r\nLeft {0}, Right {1}", tmpa.Bottom, tmpr.Bottom);
if (tmpa.Bottom >= tmpr.Bottom) if (tmpa.Bottom >= tmpr.Bottom)
return tmpa; return tmpa;
return tmpr; return tmpr;
@ -481,6 +476,7 @@ namespace Volian.Controls.Library
_DisplayRTB.Top = 3; _DisplayRTB.Top = 3;
this.Paint += new PaintEventHandler(vlnCSLARTB_Paint); this.Paint += new PaintEventHandler(vlnCSLARTB_Paint);
this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged); this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged);
_DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter);
if (item != null) if (item != null)
{ {
_Type = (int)item.MyContent.Type; _Type = (int)item.MyContent.Type;
@ -504,7 +500,7 @@ namespace Volian.Controls.Library
} }
if (expand) vlnExp.ShowExpanded(); if (expand) vlnExp.ShowExpanded();
_Panel = panel; _Panel = panel;
if(item != null)panel.ItemLookup.Add(item.ItemID, this); panel.ItemLookup.Add(item.ItemID, this);
_Relation = relationType; _Relation = relationType;
if(parent != null)RNOLevel = parent.RNOLevel; if(parent != null)RNOLevel = parent.RNOLevel;
//List<vlnCSLARTB> siblings; //List<vlnCSLARTB> siblings;
@ -562,20 +558,8 @@ namespace Volian.Controls.Library
{ {
Name = string.Format("Item-{0}", item.ItemID); Name = string.Format("Item-{0}", item.ItemID);
// Don't allow substeps to expand // Don't allow substeps to expand
switch (_Type / 10000) CanExpand = (TemporaryFormat.IsHigh(item) || ((_Type >= 10000) && (_Type < 20000))) &&
{ (item.MyContent.ContentPartCount != 0);
case 1:
//CanExpand = (item.MyContent.ContentPartCount != 0);
CanExpand = true;
vlnExp.Attachment = (item.MyContent.ContentPartCount == 0);
break;
case 2:
CanExpand = TemporaryFormat.IsHigh(item); ;
break;
default:
CanExpand = false;
break;
}
//CanExpand = (item.MyContent.ContentPartCount != 0); //CanExpand = (item.MyContent.ContentPartCount != 0);
if(expand && (item.MyContent.ContentPartCount != 0)) // If it should expand and it can expand if(expand && (item.MyContent.ContentPartCount != 0)) // If it should expand and it can expand
Expand(true); Expand(true);
@ -588,16 +572,16 @@ namespace Volian.Controls.Library
//BringToFront(); //BringToFront();
} }
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB before Controls Add"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB before Controls Add");
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("Item Location Before Control.Add = {0}", this.Location);
panel.Controls.Add(this); panel.Controls.Add(this);
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("Item Location After Control.Add = {0}", this.Location);
// TODO: RHM - Bug in code positioning items
//if (Previous != null) Previous = Previous;
//if (MyParent != null) MyParent = MyParent;
_Loading = false; _Loading = false;
//TabFormat = "<number> "; //TabFormat = "<number> ";
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add");
} }
void _DisplayRTB_Enter(object sender, EventArgs e)
{
_Panel._ItemSelected = _MyItem;
}
public void AutoExpand() public void AutoExpand()
{ {
Expand(_Type >= 20000); Expand(_Type >= 20000);
@ -838,10 +822,6 @@ namespace Volian.Controls.Library
} }
} }
} }
private void vlnExp_AttachmentClick(object sender, vlnExpanderEventArgs args)
{
_Panel.OnAttachmentClicked(sender, new DisplayPanelAttachmentEventArgs(this));
}
public void Expand(bool expand) public void Expand(bool expand)
{ {
//// TIMING: vlnCSLARTB.TimeIt("Expand Start"); //// TIMING: vlnCSLARTB.TimeIt("Expand Start");
@ -920,7 +900,7 @@ namespace Volian.Controls.Library
get get
{ {
//if (this.MyID == _WatchFor) //if (this.MyID == _WatchFor)
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}", _WatchFor); // Console.Write("\r\n {0}", _WatchFor);
DisplayItem tmp = this; DisplayItem tmp = this;
if (tmp.Next == null && FirstSibling._Relation == ChildRelation.Before) if (tmp.Next == null && FirstSibling._Relation == ChildRelation.Before)
return UpOne; return UpOne;
@ -934,7 +914,7 @@ namespace Volian.Controls.Library
if (tmp.Expanding == ExpandingStatus.Expanding || tmp.Moving) // Parent Expanding or Moving - Wait if (tmp.Expanding == ExpandingStatus.Expanding || tmp.Moving) // Parent Expanding or Moving - Wait
return null; return null;
DisplayItem btm = tmp.BottomMost; DisplayItem btm = tmp.BottomMost;
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'BottomMost',{0},'{1}'", btm.MyID, btm.MyText); //Console.Write("\r\n'BottomMost',{0},'{1}'", btm.MyID, btm.MyText);
if (this != btm) if (this != btm)
{ {
if (tmp.Next != null && tmp.Next.TopMost.Top != btm.Bottom) if (tmp.Next != null && tmp.Next.TopMost.Top != btm.Bottom)
@ -966,7 +946,7 @@ namespace Volian.Controls.Library
private void AdjustLocation() private void AdjustLocation()
{ {
//if (this.MyID == _WatchFor) //if (this.MyID == _WatchFor)
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}",_WatchFor); // Console.Write("\r\n {0}",_WatchFor);
DisplayItem tmp = NextItem; DisplayItem tmp = NextItem;
if (tmp == null) return; if (tmp == null) return;
//if(tmp.Top > _Panel.Height && Bottom > _Panel.Height){ //if(tmp.Top > _Panel.Height && Bottom > _Panel.Height){
@ -976,7 +956,7 @@ namespace Volian.Controls.Library
//} //}
if (tmp != null && !tmp.Moving && tmp.Top != Bottom ) if (tmp != null && !tmp.Moving && tmp.Top != Bottom )
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Adjust Location',{0},'Move',{1}", MyID, tmp.MyID); //Console.Write("\r\n'Adjust Location',{0},'Move',{1}", MyID, tmp.MyID);
//tmp.TopMost.Top = Bottom; //tmp.TopMost.Top = Bottom;
_Panel.Scrolling++; _Panel.Scrolling++;
tmp.Top = Bottom; tmp.Top = Bottom;
@ -1000,7 +980,7 @@ namespace Volian.Controls.Library
// DateTime tNow = DateTime.Now; // DateTime tNow = DateTime.Now;
// if (!dicTiming.ContainsKey(p)) dicTiming[p] = 0; // if (!dicTiming.ContainsKey(p)) dicTiming[p] = 0;
// dicTiming[p] += (tNow.Ticks - tLast.Ticks); // dicTiming[p] += (tNow.Ticks - tLast.Ticks);
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\t{0}\t{1:0.000}", p, tNow - tLast); // //Console.Write("\t{0}\t{1:0.000}", p, tNow - tLast);
// tLast = tNow; // tLast = tNow;
//} //}
//public static void TimeItList() //public static void TimeItList()
@ -1009,39 +989,39 @@ namespace Volian.Controls.Library
// long total = 0; // long total = 0;
// foreach (string s in dicTiming.Keys) // foreach (string s in dicTiming.Keys)
// { // {
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}\"{1}\"",sep, s); // //Console.Write("{0}\"{1}\"",sep, s);
// total += dicTiming[s]; // total += dicTiming[s];
// //sep = "\t"; // //sep = "\t";
// } // }
// //sep = "\r\n"; // //sep = "\r\n";
// foreach (string s in dicTiming.Keys) // foreach (string s in dicTiming.Keys)
// { // {
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}{1}", sep, (dicTiming[s]*100)/total ); // //Console.Write("{0}{1}", sep, (dicTiming[s]*100)/total );
// //sep = "\t"; // //sep = "\t";
// long i = (dicTiming[s]*10000)/total; // long i = (dicTiming[s]*10000)/total;
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\"{0}\"\t{1}\t{2}\t\"{3}\"", s, dicTiming[s], ((float)i) / 100, "".PadRight((int)(i / 100), 'X')); // Console.WriteLine("\"{0}\"\t{1}\t{2}\t\"{3}\"", s, dicTiming[s], ((float)i) / 100, "".PadRight((int)(i / 100), 'X'));
// } // }
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\r\n{0:0.000}", tNow - tLast); // //Console.Write("\r\n{0:0.000}", tNow - tLast);
//} //}
//public static void TimeItSetup() //public static void TimeItSetup()
//{ //{
// dicTiming = new Dictionary<string, long>(); // dicTiming = new Dictionary<string, long>();
// DateTime tNow = DateTime.Now; // DateTime tNow = DateTime.Now;
// // Reset all Counts // // Reset all Counts
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0:0.000}", tNow - tLast); // //Console.Write("\r\n{0:0.000}", tNow - tLast);
// tLast = tNow; // tLast = tNow;
//} //}
public IDisplayRTB TextBox public DisplayRTB TextBox
{ {
get { return (IDisplayRTB)_DisplayRTB; } get { return _DisplayRTB; }
} }
private void vlnCSLARTB_Resize(object sender, EventArgs e) private void vlnCSLARTB_Resize(object sender, EventArgs e)
{ {
//return; //return;
//TimeIt("ResizeStart"); //TimeIt("ResizeStart");
if (_MyItem == null) return; if (_MyItem == null) return;
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Resize',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width); //Console.Write("\r\n'Resize',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width);
//SetToolTip(); //SetToolTip();
AdjustLocation(); AdjustLocation();
//TimeIt("ResizeEnd"); //TimeIt("ResizeEnd");
@ -1050,7 +1030,7 @@ namespace Volian.Controls.Library
{ {
//return; //return;
if (_Panel.Scrolling == 0) return; if (_Panel.Scrolling == 0) return;
//_MyLog.DebugFormat("'Move',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width); //Console.Write("'Move',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width);
if (_MyItem == null) return; if (_MyItem == null) return;
//if (_Panel.Scrolling) return; //if (_Panel.Scrolling) return;
if (Expanding == ExpandingStatus.Expanding) return; if (Expanding == ExpandingStatus.Expanding) return;
@ -1065,7 +1045,7 @@ namespace Volian.Controls.Library
//if (ShowMoves) //if (ShowMoves)
//if (MyID == 367) //if (MyID == 367)
//{ //{
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat(",{0},{1},{2},{3},'{4}'", MyID, tmp.MyID, Top, Left, e.GetType().Name); // Console.Write(",{0},{1},{2},{3},'{4}'", MyID, tmp.MyID, Top, Left, e.GetType().Name);
// //ShowMoves = true; // //ShowMoves = true;
//} //}
//SetToolTip(); //SetToolTip();
@ -1074,7 +1054,7 @@ namespace Volian.Controls.Library
//{ //{
// if (_After[0].TopMost.Top != Bottom) // if (_After[0].TopMost.Top != Bottom)
// { // {
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Adjust After',{0},'{1}'", MyID, MyText); // Console.Write("\r\n'Adjust After',{0},'{1}'", MyID, MyText);
// _After[0].TopMost.Top = Bottom; // _After[0].TopMost.Top = Bottom;
// } // }
//} //}
@ -1082,7 +1062,7 @@ namespace Volian.Controls.Library
{ {
if (_RNO[0].TopMost.Top != Top) if (_RNO[0].TopMost.Top != Top)
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\r\n'Adjust RNO',{0},'Move',{1}", MyID, _RNO[0].MyID); //Console.Write("\r\n'Adjust RNO',{0},'Move',{1}", MyID, _RNO[0].MyID);
if (RNOLevel >= _Panel.MaxRNO) if (RNOLevel >= _Panel.MaxRNO)
{ {
DisplayItem tmpBottom = this; DisplayItem tmpBottom = this;
@ -1102,6 +1082,7 @@ namespace Volian.Controls.Library
_Moving = false; _Moving = false;
BottomMost.AdjustLocation(); BottomMost.AdjustLocation();
} }
//private void veRichTextBoxText_LinkClicked(object sender, LinkClickedEventArgs e) //private void veRichTextBoxText_LinkClicked(object sender, LinkClickedEventArgs e)
//{ //{
// //MessageBox.Show(e.LinkText); // //MessageBox.Show(e.LinkText);
@ -1109,7 +1090,7 @@ namespace Volian.Controls.Library
//} //}
void _DisplayRTB_LinkGoTo(object sender, System.Windows.Forms.LinkClickedEventArgs e) void _DisplayRTB_LinkGoTo(object sender, System.Windows.Forms.LinkClickedEventArgs e)
{ {
_MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + e.LinkText); Console.WriteLine("_DisplayRTB_LinkGoTO " + e.LinkText);
_Panel.OnLinkClicked(sender, new DisplayLinkEventArgs(this, e)); _Panel.OnLinkClicked(sender, new DisplayLinkEventArgs(this, e));
} }
private void lblTab_MouseDown(object sender, MouseEventArgs e) private void lblTab_MouseDown(object sender, MouseEventArgs e)
@ -1126,7 +1107,7 @@ namespace Volian.Controls.Library
} }
private void veRichTextBoxText_Resize(object sender, EventArgs e) private void veRichTextBoxText_Resize(object sender, EventArgs e)
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Resize Text',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width); //Console.Write("\r\n'Resize Text',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width);
} }
} }
} }

View File

@ -87,7 +87,6 @@ namespace Volian.Controls.Library
this.vlnExp.WidthFactor = 7; this.vlnExp.WidthFactor = 7;
this.vlnExp.BeforeExpand += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeExpand); this.vlnExp.BeforeExpand += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeExpand);
this.vlnExp.BeforeColapse += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeColapse); this.vlnExp.BeforeColapse += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeColapse);
this.vlnExp.AttachmentClick += new vlnExpanderEvent(vlnExp_AttachmentClick);
// //
// DisplayItem // DisplayItem
// //

View File

@ -12,7 +12,6 @@ namespace Volian.Controls.Library
{ {
public partial class DisplayPanel : Panel public partial class DisplayPanel : Panel
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Events #region Events
public event DisplayPanelEvent ItemClick; public event DisplayPanelEvent ItemClick;
internal void OnItemClick(object sender, DisplayPanelEventArgs args) internal void OnItemClick(object sender, DisplayPanelEventArgs args)
@ -25,23 +24,17 @@ namespace Volian.Controls.Library
if (LinkClicked != null) LinkClicked(sender, args); if (LinkClicked != null) LinkClicked(sender, args);
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Click", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public event DisplayPanelAttachmentEvent AttachmentClicked;
internal void OnAttachmentClicked(object sender, DisplayPanelAttachmentEventArgs args)
{
if (AttachmentClicked != null) AttachmentClicked(sender, args);
else MessageBox.Show(args.MyDisplayItem.MyItem.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#endregion #endregion
#region Constructors #region Constructors
public DisplayPanel() public DisplayPanel()
{ {
InitializeComponent(); InitializeComponent();
this.Paint += new PaintEventHandler(DisplayPanel_Paint); this.Paint += new PaintEventHandler(vlnCSLAPanel_Paint);
this.DoubleClick += new EventHandler(DisplayPanel_DoubleClick); this.DoubleClick += new EventHandler(vlnCSLAPanel_DoubleClick);
this.AutoScroll = true; this.AutoScroll = true;
} }
void DisplayPanel_DoubleClick(object sender, EventArgs e) void vlnCSLAPanel_DoubleClick(object sender, EventArgs e)
{ {
ShowLines = !ShowLines; ShowLines = !ShowLines;
Refresh(); Refresh();
@ -51,33 +44,25 @@ namespace Volian.Controls.Library
Pen bluePen = new Pen(Color.CornflowerBlue,1); Pen bluePen = new Pen(Color.CornflowerBlue,1);
g.DrawLine(bluePen, x, 0, x, this.Height); g.DrawLine(bluePen, x, 0, x, this.Height);
} }
void DisplayPanel_Paint(object sender, PaintEventArgs e) void vlnCSLAPanel_Paint(object sender, PaintEventArgs e)
{ {
if (ShowLines) if (ShowLines)
{ {
//int fifth = Height / 5; VerticalLine(e.Graphics, 60);
//Rectangle r1 = new Rectangle(0, 0, Width, Height - fifth); VerticalLine(e.Graphics, 102);
////Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(128, 0, 32), Color.FromArgb(96, 0, 16), 90); VerticalLine(e.Graphics, 415);
//Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(255,128, 0, 32), Color.FromArgb(255,96, 0, 16),System.Drawing.Drawing2D.LinearGradientMode.Vertical);
//e.Graphics.FillRectangle(b, r1);
//r1 = new Rectangle(0, Height - fifth, Width, fifth);
//b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(255,96, 0, 16), Color.FromArgb(255,128, 0, 32), 90);
//e.Graphics.FillRectangle(b, r1);
//VerticalLine(e.Graphics, 60);
//VerticalLine(e.Graphics, 102);
//VerticalLine(e.Graphics, 415);
} }
} }
public DisplayPanel(IContainer container) public DisplayPanel(IContainer container)
{ {
container.Add(this); container.Add(this);
InitializeComponent(); InitializeComponent();
this.Paint += new PaintEventHandler(DisplayPanel_Paint); this.Paint += new PaintEventHandler(vlnCSLAPanel_Paint);
this.BackColorChanged += new EventHandler(DisplayPanel_BackColorChanged); this.BackColorChanged += new EventHandler(vlnCSLAPanel_BackColorChanged);
this.DoubleClick += new EventHandler(DisplayPanel_DoubleClick); this.DoubleClick += new EventHandler(vlnCSLAPanel_DoubleClick);
this.AutoScroll = true; this.AutoScroll = true;
} }
void DisplayPanel_BackColorChanged(object sender, EventArgs e) void vlnCSLAPanel_BackColorChanged(object sender, EventArgs e)
{ {
// Walk through controls & set colors // Walk through controls & set colors
InactiveColor = PanelColor = BackColor; InactiveColor = PanelColor = BackColor;
@ -104,8 +89,8 @@ namespace Volian.Controls.Library
if(value != null) if(value != null)
_Layout = _MyItem.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData; _Layout = _MyItem.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
//// TIMING: vlnCSLARTB.TimeIt("pMyItem Layout"); //// TIMING: vlnCSLARTB.TimeIt("pMyItem Layout");
//this.Layout += new LayoutEventHandler(DisplayPanel_Layout); //this.Layout += new LayoutEventHandler(vlnCSLAPanel_Layout);
//this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll); //this.Scroll += new ScrollEventHandler(vlnCSLAPanel_Scroll);
//// TIMING: vlnCSLARTB.TimeIt("pMyItem Scroll"); //// TIMING: vlnCSLARTB.TimeIt("pMyItem Scroll");
Controls.Clear(); Controls.Clear();
ItemLookup = new Dictionary<int, DisplayItem>(); ItemLookup = new Dictionary<int, DisplayItem>();
@ -145,6 +130,17 @@ namespace Volian.Controls.Library
ExpandAsNeeded(item); ExpandAsNeeded(item);
ItemLookup[id].ItemSelect(); ItemLookup[id].ItemSelect();
} }
internal ItemInfo _ItemSelected;
public ItemInfo ItemSelected
{
get { return _ItemSelected; }
set
{
int id = value.ItemID;
ExpandAsNeeded(value);
ItemLookup[id].ItemSelect();
}
}
private int _Scrolling = 0; // Volian Property Snippet private int _Scrolling = 0; // Volian Property Snippet
public int Scrolling public int Scrolling
{ {
@ -161,13 +157,13 @@ namespace Volian.Controls.Library
} }
set { _Settings = value;} set { _Settings = value;}
} }
//void DisplayPanel_Layout(object sender, LayoutEventArgs e) //void vlnCSLAPanel_Layout(object sender, LayoutEventArgs e)
// { // {
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("layout {0} {1} {2} {3}", e.AffectedComponent.GetType().Name,e.AffectedControl.Name,e.AffectedProperty, sender.GetType().Name); // //Console.Write("\r\nlayout {0} {1} {2} {3}", e.AffectedComponent.GetType().Name,e.AffectedControl.Name,e.AffectedProperty, sender.GetType().Name);
// } // }
//void DisplayPanel_Scroll(object sender, ScrollEventArgs e) //void vlnCSLAPanel_Scroll(object sender, ScrollEventArgs e)
//{ //{
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("scroll {0} {1} {2} {3}", e.OldValue, e.NewValue, e.ScrollOrientation,sender.GetType().Name); // //Console.Write("\r\nscroll {0} {1} {2} {3}", e.OldValue, e.NewValue, e.ScrollOrientation,sender.GetType().Name);
// Scrolling = false; // Scrolling = false;
//} //}
//public void AdjustOutOfRangeControls(int yAdjust) //public void AdjustOutOfRangeControls(int yAdjust)
@ -291,13 +287,14 @@ namespace Volian.Controls.Library
public void ListControls() public void ListControls()
{ {
// Walk through the controls and find the next control for each // Walk through the controls and find the next control for each
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("'Item','Next'"); //Console.Clear();
Console.WriteLine("'Item','Next'");
foreach (Control control in Controls) foreach (Control control in Controls)
if (control.GetType().Name == "vlnCSLARTB") if (control.GetType().Name == "vlnCSLARTB")
{ {
DisplayItem rtb = (DisplayItem)control; DisplayItem rtb = (DisplayItem)control;
DisplayItem nxt = rtb.NextItem; DisplayItem nxt = rtb.NextItem;
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", rtb.MyID, nxt == null ? 0 : nxt.MyID); Console.WriteLine("{0},{1}", rtb.MyID, nxt == null ? 0 : nxt.MyID);
} }
} }
#endregion #endregion
@ -308,7 +305,6 @@ namespace Volian.Controls.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public partial class DisplayPanelSettings public partial class DisplayPanelSettings
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public DisplayPanelSettings(DisplayPanel panel) public DisplayPanelSettings(DisplayPanel panel)
{ {
_Panel = panel; _Panel = panel;
@ -482,22 +478,20 @@ namespace Volian.Controls.Library
_MyMouseEventArgs = myMouseEventArgs; _MyMouseEventArgs = myMouseEventArgs;
} }
} }
public partial class DisplayPanelAttachmentEventArgs #region enums
public enum ParsedLinkType : int
{ {
private DisplayItem _MyDisplayItem; // Volian Property Snippet NotParsed = 0,
public DisplayItem MyDisplayItem Transition = 1,
{ TransitionRange = 2,
get { return _MyDisplayItem; } ReferencedObject = 3
set { _MyDisplayItem = value; }
}
public DisplayPanelAttachmentEventArgs(DisplayItem myDisplayItem)
{
_MyDisplayItem = myDisplayItem;
}
} }
#endregion
public delegate void DisplayPanelEvent(object sender, DisplayPanelEventArgs args);
public delegate void DisplayPanelLinkEvent(object sender, DisplayLinkEventArgs args);
#region DisplayLinkEventArgs
public partial class DisplayLinkEventArgs : EventArgs public partial class DisplayLinkEventArgs : EventArgs
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private DisplayItem _LinkedRTB; // Volian Property Snippet private DisplayItem _LinkedRTB; // Volian Property Snippet
public DisplayItem LinkedRTB public DisplayItem LinkedRTB
{ {
@ -514,7 +508,7 @@ namespace Volian.Controls.Library
{ {
LinkedRTB = linkedRTB; LinkedRTB = linkedRTB;
LinkInfo = linkInfo; LinkInfo = linkInfo;
//if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText); Console.WriteLine("\r\n DisplayLinkEventArgs in DisplayPanel: LinkInfo '{0}'\r\n", linkInfo.LinkText);
} }
private void ParseLink() private void ParseLink()
{ {
@ -532,14 +526,10 @@ namespace Volian.Controls.Library
case "Transition": case "Transition":
case "TransitionRange": case "TransitionRange":
_Type = (ParsedLinkType)Enum.Parse(_Type.GetType(), m.Groups[1].Value); _Type = (ParsedLinkType)Enum.Parse(_Type.GetType(), m.Groups[1].Value);
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Link String - '{0}'", m.Groups[2].Value);
int transitionID = Convert.ToInt32(m.Groups[2].Value.Split(" ".ToCharArray())[1]); int transitionID = Convert.ToInt32(m.Groups[2].Value.Split(" ".ToCharArray())[1]);
foreach (TransitionInfo ti in _LinkedRTB.MyItem.MyContent.ContentTransitions) foreach (TransitionInfo ti in _LinkedRTB.MyItem.MyContent.ContentTransitions)
{
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Transition ID = '{0}'", ti.TransitionID);
if (ti.TransitionID == transitionID) if (ti.TransitionID == transitionID)
_MyTransition = ti; _MyTransition = ti;
}
break; break;
} }
} }
@ -574,17 +564,6 @@ namespace Volian.Controls.Library
} }
} }
#region enums
public enum ParsedLinkType : int
{
NotParsed = 0,
Transition = 1,
TransitionRange = 2,
ReferencedObject = 3
}
#endregion #endregion
public delegate void DisplayPanelEvent(object sender, DisplayPanelEventArgs args);
public delegate void DisplayPanelLinkEvent(object sender, DisplayLinkEventArgs args);
public delegate void DisplayPanelAttachmentEvent(object sender, DisplayPanelAttachmentEventArgs args);
public delegate void DisplayRTBLinkEvent(object sender, LinkClickedEventArgs e); public delegate void DisplayRTBLinkEvent(object sender, LinkClickedEventArgs e);
} }