From 0373b987534376f74cbacb27e42d2f0490b02ac5 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Sun, 28 May 2006 16:15:45 +0000 Subject: [PATCH] Changed selection of ReportControls to 'RectTracker' found at git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1438 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- src/AddIns/Misc/SharpReport/SharpReport.sln | 2 +- .../SharpReport/Designer/Report.cs | 21 +- .../SectionControls/BaseDesignerControl.cs | 2 +- .../Designer/SectionControls/ReportDetail.cs | 5 - .../Designer/SectionControls/ReportSection.cs | 2 +- .../ReportSectionControlbase.cs | 203 ++++- .../VisualControls/ContainerControl.cs | 207 +++++ .../Designer/VisualControls/ControlHelper.cs | 14 + .../VisualControls/FunctionControl.cs | 1 - .../Designer/VisualControls/ITracker.cs | 50 ++ .../Designer/VisualControls/RectTracker.cs | 800 ++++++++++++++++++ .../VisualControls/ReportCircleControl.cs | 1 - .../VisualControls/ReportControlBase.cs | 184 ++-- .../VisualControls/ReportImageControl.cs | 1 - .../VisualControls/ReportObjectControlBase.cs | 4 +- .../VisualControls/ReportRectangleControl.cs | 1 - .../VisualControls/ReportRowControl.cs | 5 +- .../VisualControls/ReportTextControl.cs | 3 +- .../Functions/MiscFunctions/PageNumber.cs | 11 + .../Functions/MiscFunctions/Today.cs | 35 +- .../GraphicBased/ReportCircleItem.cs | 10 +- .../GraphicBased/ReportImageItem.cs | 9 + .../GraphicBased/ReportLineItem.cs | 10 + .../GraphicBased/ReportRectangleItem.cs | 10 + .../ReportItems/TextBased/ReportDataItem.cs | 28 +- .../ReportItems/TextBased/ReportRowItem.cs | 10 +- .../ReportItems/TextBased/ReportTextItem.cs | 11 +- .../SharpReport/SharpReport.csproj | 3 + .../SharpReportCore/BaseItems/RowItem.cs | 2 +- 29 files changed, 1500 insertions(+), 145 deletions(-) create mode 100644 src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs create mode 100644 src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ITracker.cs create mode 100644 src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs diff --git a/src/AddIns/Misc/SharpReport/SharpReport.sln b/src/AddIns/Misc/SharpReport/SharpReport.sln index 8a4c03e910..d570ed3229 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport.sln +++ b/src/AddIns/Misc/SharpReport/SharpReport.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.1034 +# SharpDevelop 2.0.0.1414 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpReportCore", "SharpReportCore\SharpReportCore.csproj", "{4B2239FF-8FD6-431D-9D22-1B8049BA6917}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpReport", "SharpReport\SharpReport.csproj", "{F5563727-8309-4AC3-BACA-EB28EFD8A1D0}" diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs index abb26ff322..bd5b563f04 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Report.cs @@ -340,11 +340,22 @@ namespace SharpReport.Designer{ void SectionSelected(object sender, System.EventArgs e){ ReportSection section = (ReportSection)sender; + + if (this.selectedSection != null) { + if (this.selectedSection != section) { + ITracker tracker = selectedSection.VisualControl as ITracker; + if (tracker != null) { + tracker.ClearSelections(); + } + } + } + selectedSection = section; selectedObject = (IBaseRenderer)section; OnObjectSelected(e); - } + + void ItemSelected(object sender, System.EventArgs e){ selectedObject = (IBaseRenderer)sender; OnObjectSelected(e); @@ -407,7 +418,7 @@ namespace SharpReport.Designer{ this.visualPageFooter.Name = "visualPageFooter"; this.visualPageFooter.Size = new System.Drawing.Size(400, 68); this.visualPageFooter.TabIndex = 6; - this.visualDetail.SectionChanged += new EventHandler (this.SectionSizeChanged); + this.visualPageFooter.SectionChanged += new EventHandler (this.SectionSizeChanged); // // visualFooter // @@ -418,7 +429,7 @@ namespace SharpReport.Designer{ this.visualFooter.Name = "visualFooter"; this.visualFooter.Size = new System.Drawing.Size(400, 76); this.visualFooter.TabIndex = 7; - this.visualDetail.SectionChanged += new EventHandler (this.SectionSizeChanged); + this.visualFooter.SectionChanged += new EventHandler (this.SectionSizeChanged); // // visualPageHeader // @@ -429,7 +440,7 @@ namespace SharpReport.Designer{ this.visualPageHeader.Name = "visualPageHeader"; this.visualPageHeader.Size = new System.Drawing.Size(400, 84); this.visualPageHeader.TabIndex = 1; - this.visualDetail.SectionChanged += new EventHandler (this.SectionSizeChanged); + this.visualPageHeader.SectionChanged += new EventHandler (this.SectionSizeChanged); // // visualReportHeader // @@ -440,7 +451,7 @@ namespace SharpReport.Designer{ this.visualReportHeader.Name = "visualReportHeader"; this.visualReportHeader.Size = new System.Drawing.Size(400, 56); this.visualReportHeader.TabIndex = 0; - this.visualDetail.SectionChanged += new EventHandler (this.SectionSizeChanged); + this.visualReportHeader.SectionChanged += new EventHandler (this.SectionSizeChanged); // // Report // diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs index d029280974..5ae675a03d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs @@ -96,7 +96,7 @@ namespace SharpReport.Designer{ void ReportControlSizeChanged(object sender, System.EventArgs e){ this.ctrlRuler1.Width = reportControl.Width; this.ctrlRuler1.Invalidate(); - NotifyPropertyChanged(this.Name + "ReportControlSizeChanged"); +// NotifyPropertyChanged(this.Name + "ReportControlSizeChanged"); } void ReportControlSectionChanged (object sender,SectionChangedEventArgs e) { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportDetail.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportDetail.cs index 5ab718f756..72d24a9ca4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportDetail.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportDetail.cs @@ -35,11 +35,6 @@ namespace SharpReport.Designer{ base.ItemDragDrop += new ItemDragDropEventHandler (ItemsChanging); } - protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { - base.OnPaint (e); - } - - protected void ItemsChanging (object sender,ItemDragDropEventArgs e) { if (ReportItemsHandling != null) { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs index 9ddf27fb44..1fadd7fc44 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs @@ -66,7 +66,7 @@ namespace SharpReport{ return this.visualControl; } set { this.visualControl = value; - this.visualControl.Body.Click += new EventHandler(VisualControlClick); + this.visualControl.Click += new EventHandler(VisualControlClick); this.visualControl.Body.MouseDown += new MouseEventHandler (VisualControlMouseUp); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs index adbee795d3..9279a5ea91 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs @@ -22,7 +22,9 @@ using SharpReport.ReportItems; /// namespace SharpReport.Designer{ - public abstract class ReportSectionControlBase :ReportObjectControlBase{ + public abstract class ReportSectionControlBase :ReportObjectControlBase, + ITracker{ + private System.Windows.Forms.Panel titlePanel; private System.Windows.Forms.Panel splitPanel; private Ruler.ctrlRuler ctrlRuler1; @@ -35,12 +37,16 @@ namespace SharpReport.Designer{ private int currentY; private IDesignableFactory designableFactory; + private ControlHelper controlHelper; private BaseReportItem draggedItem; public event EventHandler ItemSelected; public event ItemDragDropEventHandler ItemDragDrop; public event EventHandler SectionChanged; + private ReportControlBase selectedControl; + private RectTracker rectTracker = new RectTracker(); + internal ReportSectionControlBase(){ InitializeComponent(); this.SetStyle(ControlStyles.DoubleBuffer | @@ -51,12 +57,191 @@ namespace SharpReport.Designer{ this.UpdateStyles(); caption = this.Name; this.designableFactory = new IDesignableFactory(); + this.controlHelper = new ControlHelper(this); } void BodyPanelSizeChanged(object sender, System.EventArgs e){ this.Size = new Size (this.Size.Width,this.bodyPanel.Height + this.titlePanel.Height + this.splitPanel.Height); } + #region overrides + + protected override CreateParams CreateParams{ + get { + CreateParams cp=base.CreateParams; + cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT + return cp; + } + } + + #endregion + + #region ITracker implementation + + public void ClearSelections() { + this.controlHelper.Clear(this.bodyPanel); + this.selectedControl = null; + this.InvalidateEx(); + } + + public void InvalidateEx() { + + this.Invalidate(); + + if (this.Parent == null) { + return; + } + Rectangle rc = new Rectangle (this.bodyPanel.Location,this.bodyPanel.Size); + this.Invalidate(rc,true); + + if(this.selectedControl != null){ + rc = this.rectTracker.m_rect; + this.selectedControl.SetBounds(rc.Left, rc.Top, rc.Width, rc.Height); + this.selectedControl.Invalidate(); + } + + } + + public ReportControlBase SelectedControl { + set { + selectedControl = value; + } + } + + public RectTracker RectTracker { + get { + return this.rectTracker; + } + } + + public Control DesignSurface { + get{ + return this.bodyPanel; + } + } + #endregion + + + #region tracker + + + private Rectangle GetParentRectangle(){ + return new Rectangle(new Point(0,0),this.bodyPanel.Size); + } + + + private void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e){ + + if (this.rectTracker == null) { + return; + } + if(e.Button != MouseButtons .Left){ + return; + } + Point pt = this.bodyPanel.PointToClient(Cursor.Position); + + Rectangle rcForm = GetParentRectangle(); + + if(rcForm.Contains(pt)){ + Rectangle rcObject; + if (this.rectTracker.HitTest(pt) == RectTracker.TrackerHit.hitNothing) { + + this.selectedControl = null; + this.rectTracker.m_rect = new Rectangle(0,0,0,0); + // just to demonstrate RectTracker::TrackRubberBand + RectTracker tracker=new RectTracker(); + if (tracker.TrackRubberBand(this.bodyPanel, pt, false)){ + // see if rubber band intersects with the doc's tracker +// System.Console.WriteLine("3"); + tracker.NormalizeRect(ref tracker.m_rect); + Rectangle rectIntersect = tracker.m_rect; + foreach (Control ctrl in this.bodyPanel.Controls){ + rcObject = ctrl.Bounds; +// + if(tracker.m_rect.Contains(rcObject)){ + + this.rectTracker.m_rect = rcObject; + this.selectedControl = (ReportControlBase)ctrl; + this.selectedControl.Selected = true; + break; + } + } + } + else{ + + // No rubber band, see if the point selects an object. + + foreach (Control ctrl in this.bodyPanel.Controls){ + rcObject = ctrl.Bounds ; + if(rcObject.Contains(pt)){ + this.rectTracker.m_rect = rcObject; + this.selectedControl = (ReportControlBase)ctrl; + break; + } + } + } + if(this.selectedControl == null){ + NotifySectionClick(); + } + else{ +// System.Console.WriteLine("6"); +// m_FormTracker.Clear(); + + } + } + else if(this.selectedControl != null){// normal tracking action, when tracker is hit + if (this.rectTracker.Track(this.bodyPanel, pt, false,null)) { + Rectangle rc = this.rectTracker.m_rect; + this.selectedControl.SetBounds(rc.Left, rc.Top, rc.Width, rc.Height); + this.selectedControl.NotifyPropertyChanged("Tracker"); + } + } + + } + else{ + if(this.selectedControl == null){//select the container form + System.Console.WriteLine("9"); +// MainForm.m_propertyWindow.SetSelectedObject(m_Form); + /* + if(m_FormTracker.HitTest(pt) == RectTracker.TrackerHit.hitNothing) + { + m_FormTracker.m_rect = rcForm; + } + else if(!m_FormTracker.IsEmpty()) + { + m_FormTracker.Track(this, pt, false,null); + } + */ + } + else{ +// System.Console.WriteLine("10"); +// m_FormTracker.Clear(); + } + } + this.InvalidateEx(); + + } + + + private void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e){ + if (this.rectTracker != null) { + Point mousept=new Point(e.X,e.Y); + + if(this.selectedControl != null){ + if(!rectTracker.SetCursor(this,0,mousept)) + this.Cursor=Cursors.Arrow; + } + +// else{ +// if(!m_FormTracker.SetCursor(this,0,mousept)) +// this.Cursor=Cursors.Arrow; +// } + } + } + + #endregion + + #region painting private void BodyPanelPaint(object sender, PaintEventArgs pea) { pea.Graphics.Clear(this.Body.BackColor); @@ -77,6 +262,9 @@ namespace SharpReport.Designer{ } } + #endregion + + #region splitter void SplitPanelMouseDown(object sender, System.Windows.Forms.MouseEventArgs e){ mouseDown = true; currentY = e.Y; @@ -93,6 +281,7 @@ namespace SharpReport.Designer{ } } + #endregion #region propertys @@ -115,7 +304,12 @@ namespace SharpReport.Designer{ #endregion #region events - + + void NotifySectionClick () { + ClearSelections(); + this.OnClick(EventArgs.Empty); + } + void FiredDragDropItem (string item,Point pointAt) { if (ItemSelected != null) { ItemSelected (this,new EventArgs()); @@ -130,7 +324,7 @@ namespace SharpReport.Designer{ } #endregion - + #region DragDrop @@ -253,6 +447,8 @@ namespace SharpReport.Designer{ this.bodyPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.BodyPanelPaint); this.bodyPanel.SizeChanged += new System.EventHandler(this.BodyPanelSizeChanged); this.bodyPanel.DragLeave += new System.EventHandler(this.BodyPanelDragLeave); + this.bodyPanel.MouseMove += new MouseEventHandler(this.OnMouseMove); + this.bodyPanel.MouseDown += new MouseEventHandler(this.OnMouseDown); // // ctrlRuler1 // @@ -302,6 +498,7 @@ namespace SharpReport.Designer{ this.Controls.Add(this.titlePanel); this.Controls.Add(this.splitPanel); this.Controls.Add(this.ctrlRuler1); + this.Name = "UserControl1"; this.Size = new System.Drawing.Size(432, 154); this.titlePanel.ResumeLayout(false); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs new file mode 100644 index 0000000000..1a700f3a1e --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ContainerControl.cs @@ -0,0 +1,207 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Peter + * Date: 25.05.2006 + * Time: 09:19 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace SharpReport.Designer{ + + /// + /// Description of ContainerControl. + /// + public class ContainerControl:ReportControlBase,ITracker{ + private RectTracker rectTracker = new RectTracker(); + private ReportControlBase selectedControl; + + public ContainerControl():base(){ + this.Body.MouseMove += new MouseEventHandler( OnMouseMove); + this.Body.MouseDown += new MouseEventHandler(OnMouseDown); + } + + private Rectangle GetParentRectangle () { + return this.Body.ClientRectangle; + } + + protected override void OnPaint(System.Windows.Forms.PaintEventArgs e){ + base.OnPaint(e); + } + + #region overrides + /* + protected override CreateParams CreateParams{ + get { + CreateParams cp=base.CreateParams; + cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT + return cp; + } + } + */ + #endregion + + private void OnMouseDown(object sender, System.Windows.Forms.MouseEventArgs e){ + + if (this.rectTracker == null) { + return; + } + if(e.Button != MouseButtons .Left){ + return; + } + Point pt = this.Body.PointToClient(Cursor.Position); + + Rectangle rcForm = GetParentRectangle(); + + if(rcForm.Contains(pt)){ + Rectangle rcObject; + if (this.rectTracker.HitTest(pt) == RectTracker.TrackerHit.hitNothing) { +// System.Console.WriteLine("2"); + this.selectedControl = null; + this.rectTracker.m_rect = new Rectangle(0,0,0,0); + // just to demonstrate RectTracker::TrackRubberBand + RectTracker tracker=new RectTracker(); + if (tracker.TrackRubberBand(this.Body, pt, false)){ + // see if rubber band intersects with the doc's tracker + + tracker.NormalizeRect(ref tracker.m_rect); + Rectangle rectIntersect = tracker.m_rect; + foreach (Control ctrl in this.Body.Controls){ + rcObject = ctrl.Bounds; + if(tracker.m_rect.Contains(rcObject)){ + + this.rectTracker.m_rect = rcObject; + this.selectedControl = (ReportControlBase)ctrl; + this.selectedControl.Selected = true; + // MainForm.m_propertyWindow.SetSelectedObject(m_seletedCtrl); + break; + } + } + } + else{ + + // No rubber band, see if the point selects an object. + + foreach (Control ctrl in this.Body.Controls){ + rcObject = ctrl.Bounds ; + if(rcObject.Contains(pt)){ + + this.rectTracker.m_rect = rcObject; + this.selectedControl = (ReportControlBase)ctrl; + this.selectedControl.Selected = true; +// MainForm.m_propertyWindow.SetSelectedObject(ctrl); + break; + } + } + } + if(this.selectedControl == null){ +// NotifySectionClick(); + +// MainForm.m_propertyWindow.SetSelectedObject(m_Form); +// m_FormTracker.m_rect = rcForm; + } + else{ +// System.Console.WriteLine("6"); +// m_FormTracker.Clear(); + + } + } + else if(this.selectedControl != null){// normal tracking action, when tracker is hit +// System.Console.WriteLine("7"); + if (this.rectTracker.Track(this.Body, pt, false,null)) { + Rectangle rc = this.rectTracker.m_rect; + this.selectedControl.SetBounds(rc.Left, rc.Top, rc.Width, rc.Height); + } + } + } + else{ + if(this.selectedControl == null){//select the container form +// System.Console.WriteLine("9"); +// MainForm.m_propertyWindow.SetSelectedObject(m_Form); + /* + if(m_FormTracker.HitTest(pt) == RectTracker.TrackerHit.hitNothing) + { + m_FormTracker.m_rect = rcForm; + } + else if(!m_FormTracker.IsEmpty()) + { + m_FormTracker.Track(this, pt, false,null); + } + */ + } + else{ +// System.Console.WriteLine("10"); +// m_FormTracker.Clear(); + } + } + this.InvalidateEx(); + + } + + private void OnMouseMove (object sender, MouseEventArgs e) { + + if (this.rectTracker != null) { + Point mousept=new Point(e.X,e.Y); + + if(this.selectedControl != null){ + if(!rectTracker.SetCursor(this,0,mousept)) + this.Cursor=Cursors.Arrow; + } + +// else{ +// if(!m_FormTracker.SetCursor(this,0,mousept)) +// this.Cursor=Cursors.Arrow; +// } + } + } + + #region ITracker implementation + + public virtual void ClearSelections() { + base.ControlHelper.Clear(this); + this.selectedControl = null; + this.InvalidateEx(); + } + + public ReportControlBase SelectedControl { + set { + this.selectedControl = value; + } + } + + public RectTracker RectTracker { + get { + return this.rectTracker; + } + } + + public System.Windows.Forms.Control DesignSurface { + get { + return this.Body; + } + } + + public void InvalidateEx(){ + this.Invalidate(); + + if (this.Parent == null) { + return; + } + Rectangle rc = new Rectangle (this.Body.Location,this.Body.Size); + this.Invalidate(rc,true); + + if(this.selectedControl != null){ + rc = this.rectTracker.m_rect; + + this.selectedControl.SetBounds(rc.Left, rc.Top, rc.Width, rc.Height); + this.selectedControl.Invalidate(); + } + } + + #endregion + } +} diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs index 60a11f051b..efd5740c4e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs @@ -77,5 +77,19 @@ namespace SharpReport.Designer } + /// + /// Set the Controls to selected = false, so the Focusrectangle is + /// not draw + /// + /// + public void Clear (Control control) { + foreach (Control c in control.Controls) { + ReportControlBase rcb = c as ReportControlBase; + if (rcb != null) { + rcb.Selected = false; + Clear (c); + } + } + } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/FunctionControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/FunctionControl.cs index fe08d7c391..70a7ad04b9 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/FunctionControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/FunctionControl.cs @@ -36,7 +36,6 @@ namespace SharpReport.Designer { base.OnPaint(pea); base.DrawEdges (pea); - base.DrawDecorations(pea); // StringFormat f = base.StringFormat; // f.Alignment = base.StringAlignment; diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ITracker.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ITracker.cs new file mode 100644 index 0000000000..89a6afdd1f --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ITracker.cs @@ -0,0 +1,50 @@ +/* + * Created by SharpDevelop. + * User: Forstmeier Peter + * Date: 25.05.2006 + * Time: 09:54 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using System.Windows.Forms; + + +namespace SharpReport.Designer +{ + /// + /// Description of ITracker. + /// + public interface ITracker{ + + /// + /// Clear all selections + /// + + void ClearSelections(); + /// + /// Invalidate the DesignSurface and draw the Tracking rectangle + /// + void InvalidateEx(); + + /// + /// The selected Control + /// + ReportControlBase SelectedControl + {set;} + + /// + /// The + /// + RectTracker RectTracker + {get;} + + /// + /// The Body Conrol to draw the Treckung Rectangle on + /// + + Control DesignSurface + {get;} + } +} diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs new file mode 100644 index 0000000000..9a9b3d5de4 --- /dev/null +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/RectTracker.cs @@ -0,0 +1,800 @@ +using System; +using System.Windows.Forms; +using System.Drawing; +using System.Drawing.Imaging; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Drawing.Drawing2D; + +namespace SharpReport.Designer +{ + /// + /// Draw a Focus and DragRectangle + /// http://www.codeproject.com/csharp/SharpFormEditorDemo.asp + /// + /// + /// + public class RectTracker + { + #region Win32API + protected struct POINT + { + public Int32 x; + public Int32 y; + }; + + protected struct MSG + { + public Int32 hwnd; + public Int32 message; + public Int32 wParam; + public Int32 lParam; + public Int32 time; + public POINT pt; + }; + + [DllImport("user32.dll", SetLastError=true )] + protected static extern Int32 GetMessage (ref MSG lpMsg,Int32 hwnd,Int32 wMsgFilterMin,Int32 wMsgFilterMax); + + [DllImport("user32.dll", SetLastError=true )] + protected static extern Int32 DispatchMessage (ref MSG lpMsg); + + [DllImport("user32.dll", SetLastError=true )] + private static extern Int32 TranslateMessage (ref MSG lpMsg); + + private const int CX_BORDER=1; + private const int CY_BORDER=1; + protected const int WM_MOUSEFIRST = 0x0200; + protected const int WM_MOUSEMOVE = 0x0200; + protected const int WM_LBUTTONDOWN = 0x0201; + protected const int WM_LBUTTONUP = 0x0202; + protected const int WM_LBUTTONDBLCLK = 0x0203; + protected const int WM_RBUTTONDOWN = 0x0204; + protected const int WM_RBUTTONUP = 0x0205; + protected const int WM_RBUTTONDBLCLK = 0x0206; + protected const int WM_MBUTTONDOWN = 0x0207; + protected const int WM_MBUTTONUP = 0x0208; + protected const int WM_MBUTTONDBLCLK = 0x0209; + protected const int WM_KEYDOWN = 0x100; + protected const int WM_KEYUP = 0x101; + private static Cursor[] Cursors =new Cursor[10]; + private static HatchBrush HatchBrush = null; + private static Pen BlackDottedPen = null; + private static int HandleSize = 4; + private static Pen DotedPen=null; + + #endregion + + // + // Style Flags + public enum StyleFlags + { + solidLine = 1, dottedLine = 2, hatchedBorder = 4, + resizeInside = 8, resizeOutside = 16, hatchInside = 32, + }; + + // Hit-Test codes + public enum TrackerHit + { + hitNothing = -1, + hitTopLeft = 0, hitTopRight = 1, hitBottomRight = 2, hitBottomLeft = 3, + hitTop = 4, hitRight = 5, hitBottom = 6, hitLeft = 7, hitMiddle = 8 + }; + public enum backMode + { + TRANSPARENT= 1, + OPAQUE= 2 + }; + public enum rectPos + { + Left =0, + Right, + Top, + Bottom + }; + struct HANDLEINFO + { + public HANDLEINFO(rectPos X,rectPos Y,int CX,int CY,int HX,int HY,int IX,int IY) + { + nOffsetX=X; + nOffsetY=Y; + nCenterX=CX; + nCenterY=CY; + nHandleX=HX; + nHandleY=HY; + nInvertX=IX; + nInvertY=IY; + } + public rectPos nOffsetX; // offset within RECT for X coordinate + public rectPos nOffsetY; // offset within RECT for Y coordinate + public int nCenterX; // adjust X by Width()/2 * this number + public int nCenterY; // adjust Y by Height()/2 * this number + public int nHandleX; // adjust X by handle size * this number + public int nHandleY; // adjust Y by handle size * this number + public int nInvertX; // handle converts to this when X inverted + public int nInvertY; // handle converts to this when Y inverted + }; + struct RECTINFO + { + public RECTINFO(rectPos offset,int nsign) + { + nOffsetAcross=offset; + nSignAcross=nsign; + } + public rectPos nOffsetAcross; // offset of opposite point (ie. left->right) + public int nSignAcross; // sign relative to that point (ie. add/subtract) + } + + static HANDLEINFO[] HandleInfo=new HANDLEINFO[]{ + // corner handles (top-left, top-right, bottom-right, bottom-left + new HANDLEINFO(rectPos.Left, rectPos.Top,0, 0, 0, 0, 1, 3 ), + new HANDLEINFO(rectPos.Right,rectPos.Top,0, 0, -1, 0, 0, 2), + new HANDLEINFO(rectPos.Right,rectPos.Bottom,0, 0, -1, -1, 3, 1), + new HANDLEINFO(rectPos.Left, rectPos.Bottom, 0, 0, 0, -1, 2, 0 ), + // side handles (top, right, bottom, left) + new HANDLEINFO(rectPos.Left, rectPos.Top,1, 0, 0, 0, 4, 6), + new HANDLEINFO(rectPos.Right,rectPos.Top,0, 1, -1, 0, 7, 5), + new HANDLEINFO(rectPos.Left, rectPos.Bottom, 1, 0, 0, -1, 6, 4 ), + new HANDLEINFO(rectPos.Left, rectPos.Top,0, 1, 0, 0, 5, 7) + }; + static RECTINFO[] RectInfo=new RECTINFO[]{ + new RECTINFO(rectPos.Right, +1), + new RECTINFO(rectPos.Bottom, +1), + new RECTINFO(rectPos.Left,-1), + new RECTINFO(rectPos.Top, -1 ) + }; + // Attributes + public StyleFlags m_nStyle; // current state + public Rectangle m_rect; // current position (always in pixels) + public Size m_sizeMin; // minimum X and Y size during track operation + public int m_nHandleSize=0; // size of resize handles (default from WIN.INI) + protected bool m_bAllowInvert=false; // flag passed to Track or TrackRubberBand + protected Rectangle m_rectLast; + protected Size m_sizeLast; + protected bool m_bErase=false; // TRUE if DrawTrackerRect is called for erasing + protected bool m_bFinalErase=false; // TRUE if DragTrackerRect called for final erase + protected static bool bInitialized=false; + + public RectTracker() + { + Construct(); + m_nHandleSize = 6; + m_nStyle = StyleFlags.resizeOutside; + } + public RectTracker(Rectangle rect, StyleFlags nStyle) + { + Construct(); + m_rect=rect; + m_nStyle = nStyle; + } + protected void Construct() + { + if(false==bInitialized) + { + // initialize the cursor array + Cursors[0] = System.Windows.Forms.Cursors.SizeNWSE; + Cursors[1] = System.Windows.Forms.Cursors.SizeNESW; + Cursors[2] = Cursors[0]; + Cursors[3] = Cursors[1]; + Cursors[4] = System.Windows.Forms.Cursors.SizeNS; + Cursors[5] = System.Windows.Forms.Cursors.SizeWE; + Cursors[6] = Cursors[4]; + Cursors[7] = Cursors[5]; + Cursors[8] = System.Windows.Forms.Cursors.SizeAll; + Cursors[9] = System.Windows.Forms.Cursors.PanSW; + bInitialized = true; + BlackDottedPen=new Pen(System.Drawing.Color.Black,1); + HatchBrush=new HatchBrush(HatchStyle.Percent20,Color.Black,Color.FromArgb(0)); + DotedPen=new Pen(Color.Black,1); + DotedPen.DashStyle=DashStyle.Dot; + } + m_nStyle = 0; + m_nHandleSize = HandleSize; + m_sizeMin.Height = m_sizeMin.Width = m_nHandleSize*2; + + m_rectLast=new Rectangle(0,0,0,0); + m_sizeLast.Width = m_sizeLast.Height = 0; + m_bErase = false; + m_bFinalErase = false; + } + + + // Operations + public virtual void Draw(Graphics gs) + { + System.Drawing.Drawing2D.GraphicsState OldState=gs.Save(); + +// IntPtr hdc = new IntPtr(); + // get normalized rectangle + Rectangle rect = m_rect; + NormalizeRect(ref rect); + + // draw lines + if ((m_nStyle & (StyleFlags.dottedLine|StyleFlags.solidLine)) != 0) + { + if((m_nStyle&StyleFlags.dottedLine)!=0) + BlackDottedPen.DashStyle=DashStyle.Dot; + else + BlackDottedPen.DashStyle=DashStyle.Solid; + rect.Inflate(new Size(+1, +1)); // borders are one pixel outside + gs.DrawRectangle(BlackDottedPen,rect); + } + + + // hatch inside + if ((m_nStyle & StyleFlags.hatchInside) != 0) + { + gs.FillRectangle(HatchBrush,rect.Left+1, rect.Top+1, rect.Width-1, rect.Height-1); + } + + // draw hatched border + if (true)//(m_nStyle & StyleFlags.hatchedBorder) != 0) + { + Rectangle rectTrue=new Rectangle(0,0,0,0); + GetTrueRect(ref rectTrue); + gs.FillRectangle(HatchBrush,rectTrue.Left, rectTrue.Top, rectTrue.Width,rect.Top-rectTrue.Top); + gs.FillRectangle(HatchBrush,rectTrue.Left, rect.Bottom,rectTrue.Width,rectTrue.Bottom-rect.Bottom); + gs.FillRectangle(HatchBrush,rectTrue.Left, rect.Top, rect.Left-rectTrue.Left,rect.Height); + gs.FillRectangle(HatchBrush,rect.Right, rect.Top, rectTrue.Right-rect.Right,rect.Height); + } + + // draw resize handles + if ((m_nStyle & (StyleFlags.resizeInside|StyleFlags.resizeOutside)) != 0) + { + uint mask = GetHandleMask(); + for (int i = 0; i < 8; ++i) + { + if ((mask&(1<= -1); + if (nHandle == (int)TrackerHit.hitMiddle || nHandle ==(int)TrackerHit.hitNothing) + return nHandle; + + HANDLEINFO handleInfo = HandleInfo[nHandle]; + if (m_rect.Width< 0) + { + nHandle = handleInfo.nInvertX; + handleInfo = HandleInfo[nHandle]; + } + if (m_rect.Height< 0) + nHandle = handleInfo.nInvertY; + return nHandle; + } + + + private void DrawDragRect(Graphics gs,Rectangle rect,Rectangle rectLast) + { + ControlPaint.DrawReversibleFrame(rectLast,Color.White,FrameStyle.Dashed); + ControlPaint.DrawReversibleFrame(rect,Color.White,FrameStyle.Dashed); + + } + + public virtual void DrawTrackerRect(Rectangle Rect, Form ClipToFrm,Graphics gs,Control frm) + { + + Rectangle rect = Rect; + // convert to client coordinates + if (ClipToFrm != null) + { + rect=ClipToFrm.RectangleToScreen(rect); + rect=ClipToFrm.RectangleToClient(rect); + } + + Size size=new Size(0, 0); + if (!m_bFinalErase) + { + // otherwise, size depends on the style + if ((m_nStyle & StyleFlags.hatchedBorder)!=0) + { + size.Width = size.Height = Math.Max(1, GetHandleSize(rect)-1); + rect.Inflate(size); + } + else + { + size.Width = CX_BORDER; + size.Height = CY_BORDER; + } + } + + if (m_bFinalErase || !m_bErase) + { + Rectangle rcScreen = frm.RectangleToScreen(rect); + Rectangle rcLast = frm.RectangleToScreen(m_rectLast); + DrawDragRect(gs,rcScreen,rcLast); + } + // remember last rectangles + m_rectLast = rect; + m_sizeLast = size; + } + + public virtual void AdjustRect(int nHandle, ref Rectangle Rect) + { + if (nHandle ==(int)TrackerHit.hitMiddle) + return; + + // convert the handle into locations within m_rect + int px=-1, py=-1; + int ix=-1,iy=-1; + GetModifyPointers(nHandle,ref px, ref py,ref ix, ref iy,false); + + // enforce minimum width + int nNewWidth = m_rect.Width; + int nAbsWidth = m_bAllowInvert ? Math.Abs(nNewWidth) : nNewWidth; + if (nAbsWidth < m_sizeMin.Width) + { + nNewWidth = nAbsWidth != 0 ? nNewWidth / nAbsWidth : 1; + RECTINFO refrectinfo=RectInfo[px]; + px = GetRectInt((int)refrectinfo.nOffsetAcross) + + nNewWidth * m_sizeMin.Width * -refrectinfo.nSignAcross; + } + + // enforce minimum height + int nNewHeight = m_rect.Height; + int nAbsHeight = m_bAllowInvert ? Math.Abs(nNewHeight) : nNewHeight; + if ((py != -1)&&(nAbsHeight < m_sizeMin.Height)) + { + nNewHeight = nAbsHeight != 0 ? nNewHeight / nAbsHeight : 1; + Debug.Assert(py<4); + RECTINFO refrectinfo=RectInfo[py]; + py = GetRectInt((int)refrectinfo.nOffsetAcross) + + nNewHeight * m_sizeMin.Width * -refrectinfo.nSignAcross; + } + } + + public virtual void OnChangedRect(Rectangle rectOld) + { + } + + public virtual uint GetHandleMask() + { + uint mask = 0x0F; // always have 4 corner handles + int size = m_nHandleSize*3; + if (Math.Abs(m_rect.Width) - size > 4) + mask |= 0x50; + if (Math.Abs(m_rect.Height) - size > 4) + mask |= 0xA0; + return mask; + } + + protected virtual TrackerHit HitTestHandles(Point point) + { + Rectangle Truerect=new Rectangle(0,0,0,0); + uint mask = GetHandleMask(); + + // see if hit anywhere inside the tracker + GetTrueRect(ref Truerect); + if (!Truerect.Contains(point)) + return TrackerHit.hitNothing; // totally missed + + // see if we hit a handle + for (int i = 0; i < 8; ++i) + { + if((mask&(1<= 32768) + p=0; + switch(index) + { + case 0://left + m_rect.Width += (m_rect.X - p); + m_rect.X = p; + break; + case 1://right + m_rect.Width = p - m_rect.X; + break; + case 2://top + m_rect.Height += m_rect.Y - p; + m_rect.Y = p ; + break; + case 3://bottom + m_rect.Height = p - m_rect.Y; + break; + default: + break; + } + + } + + protected void GetModifyPointers(int nHandle,ref int ppx,ref int ppy,ref int px,ref int py,bool bModify) + { + Debug.Assert(nHandle >= 0); + Debug.Assert(nHandle <= 8); + + if (nHandle ==(int)TrackerHit.hitMiddle) + nHandle = (int)TrackerHit.hitTopLeft; // same as hitting top-left + + ppx = -1; + ppy = -1; + + // fill in the part of the rect that this handle modifies + // (Note: handles that map to themselves along a given axis when that + // axis is inverted don't modify the value on that axis) + + HANDLEINFO handleInfo = HandleInfo[nHandle]; + + if (handleInfo.nInvertX != nHandle) + { + ppx=(int)handleInfo.nOffsetX; + if (bModify) + px = GetRectInt(ppx); + } + else + { + // middle handle on X axis + if (bModify) + px = m_rect.Left + Math.Abs(m_rect.Width) / 2; + } + if (handleInfo.nInvertY != nHandle) + { + ppy=(int)handleInfo.nOffsetY; + if (bModify) + py = GetRectInt(ppy); + } + else + { + // middle handle on Y axis + if (bModify) + py = m_rect.Top + Math.Abs(m_rect.Height) / 2; + } + } + + protected virtual int GetHandleSize(Rectangle rect) + { + if (rect.IsEmpty) + rect = m_rect; + + int size = m_nHandleSize; + if ((m_nStyle & StyleFlags.resizeOutside)==0) + { + // make sure size is small enough for the size of the rect + int sizeMax = Math.Min(Math.Abs(rect.Right - rect.Left),Math.Abs(rect.Bottom - rect.Top)); + if (size * 2 > sizeMax) + size = sizeMax / 2; + } + return size; + } + + protected bool TrackHandle(int nHandle,Control frm,Point point,Form frmClipTo) + { + Debug.Assert(nHandle >= 0); + Debug.Assert(nHandle <= 8); // handle 8 is inside the rect + + // don't handle if capture already set + //if(frm.Capture) return false; + + Debug.Assert(!m_bFinalErase); + + // save original width & height in pixels + int nWidth = m_rect.Width; + int nHeight = m_rect.Height; + + // set capture to the window which received this message + frm.Capture=true; + Debug.Assert(frm.Capture); + frm.Update(); + if (frmClipTo!=null) + frmClipTo.Update(); + Rectangle rectSave = m_rect; + + // find out what x/y coords we are supposed to modify + int px=0, py=0; + int xDiff=0, yDiff=0; + GetModifyPointers(nHandle,ref px,ref py,ref xDiff,ref yDiff,true); + xDiff = point.X - xDiff; + yDiff = point.Y - yDiff; + + // get DC for drawing + Graphics gs; + if (frmClipTo!=null) + { + // clip to arbitrary window by using adjusted Window DC + gs=frmClipTo.CreateGraphics(); + } + else + { + // otherwise, just use normal DC + gs=frm.CreateGraphics(); + } + + Rectangle rectOld; + bool bMoved = false; + + // get messages until capture lost or cancelled/accepted + for (;;) + { + MSG msg=new MSG(); + if(GetMessage(ref msg, 0, 0, 0)!=1) break; + if(!frm.Capture) break; + + switch (msg.message) + { + // handle movement/accept messages + case WM_LBUTTONUP: + case WM_MOUSEMOVE: + rectOld = m_rect; + // handle resize cases (and part of move) + SetRectInt(px,LoWord(msg.lParam) - xDiff); + SetRectInt(py,HiWord(msg.lParam) - yDiff); + // handle move case + if (nHandle == (int)TrackerHit.hitMiddle) + { + m_rect.Width=nWidth; + m_rect.Height=nHeight; + } + // allow caller to adjust the rectangle if necessary + AdjustRect(nHandle,ref m_rect); + + // only redraw and callback if the rect actually changed! + m_bFinalErase = (msg.message == WM_LBUTTONUP); + if (m_bFinalErase) + goto ExitLoop; + + if (!rectOld.Equals(m_rect) || m_bFinalErase) + { + if (bMoved) + { + m_bErase = true; + DrawTrackerRect(rectOld, frmClipTo, gs, frm); + } + OnChangedRect(rectOld); + if (msg.message != WM_LBUTTONUP) + bMoved = true; + } + if (m_bFinalErase) + goto ExitLoop; + + if (!rectOld.Equals(m_rect)) + { + m_bErase = false; + DrawTrackerRect(m_rect, frmClipTo, gs, frm); + } + break; + + // handle cancel messages + case WM_KEYDOWN: + if (msg.wParam != 0x1B)//VK_ESCAPE + break; + goto default; + case WM_RBUTTONDOWN: + if (bMoved) + { + m_bErase = m_bFinalErase = true; + DrawTrackerRect(m_rect, frmClipTo, gs, frm); + } + m_rect = rectSave; + goto ExitLoop; + + // just dispatch rest of the messages + default: + DispatchMessage(ref msg); + break; + } + } + + ExitLoop: + gs.Dispose(); + frm.Capture=false; + // restore rect in case bMoved is still FALSE + if (!bMoved) + m_rect = rectSave; + m_bFinalErase = false; + m_bErase = false; + + // return TRUE only if rect has changed + return !rectSave.Equals(m_rect); + } + + public void NormalizeRect(ref Rectangle rect) + { + Rectangle rc = new Rectangle(rect.Location,rect.Size); + if(rect.Left > rect.Right) + { + rc.Width = -rect.Width; + rc.X = rect.Right; + } + if(rect.Top > rect.Bottom) + { + rc.Height = -rect.Height; + rc.Y = rect.Bottom; + } + rect = rc; + } + + #region Helper functions + + static int MakeLong(int LoWord, int HiWord) + { + return (HiWord << 16) | (LoWord & 0xffff); + } + + static IntPtr MakeLParam(int LoWord, int HiWord) + { + return (IntPtr) ((HiWord << 16) | (LoWord & 0xffff)); + } + + static int HiWord(int Number) + { + return (Number >> 16) & 0xffff; + } + + static int LoWord(int Number) + { + return Number & 0xffff; + } + + #endregion + } +} diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportCircleControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportCircleControl.cs index 1115956d42..7637c24f16 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportCircleControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportCircleControl.cs @@ -35,7 +35,6 @@ namespace SharpReport.Designer{ protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){ base.OnPaint(pea); base.DrawEdges (pea); - base.DrawDecorations(pea); shape.FillShape(pea.Graphics, new SolidFillPattern(this.BackColor), (RectangleF)this.ClientRectangle); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs index 94a5240d2b..4e9f2cb5b6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs @@ -19,22 +19,15 @@ namespace SharpReport.Designer{ /// Base Class of all Visible Controls like Graphic or textbased Item's /// - public abstract class ReportControlBase : ReportObjectControlBase{ - private System.Windows.Forms.Label lblTopLeft; - private System.Windows.Forms.Label lblBottomRight; + public abstract class ReportControlBase : ReportObjectControlBase, + INotifyPropertyChanged{ + private ControlHelper controlHelper; - private const string contextMenuPath = "/SharpReport/ContextMenu/Items"; - private enum SizeDirection{ - None, - TopLeft, - BottomRight, - } + private const string contextMenuPath = "/SharpReport/ContextMenu/Items"; + private bool selected; - private int xCoor; - private int yCoor; - private SizeDirection mouseDown; internal ReportControlBase(){ InitializeComponent(); @@ -44,72 +37,71 @@ namespace SharpReport.Designer{ ControlStyles.ResizeRedraw, true); this.UpdateStyles(); - lblTopLeft.Visible = false; - lblBottomRight.Visible = false; controlHelper = new ControlHelper((Control)this); } - private void ReportControlBaseEnter(object sender, System.EventArgs e){ - lblTopLeft.Visible = true; - lblBottomRight.Visible = true; - this.Refresh(); + private ITracker GetParent { + get { + if (this.Parent is Panel) { + ITracker t = this.Parent.Parent as ITracker; + if (t != null) { + return t; + } else { + System.Console.WriteLine("!!!!!!!!! NO TRACKER !!!!"); + return null; + + } + } else { + ITracker ct = this.Parent as ITracker; + if (ct != null) { + return ct; + }else { + System.Console.WriteLine("!!!!!!!!! NO TRACKER !!!!"); + return null; + } + } + } } - private void ReportControlBaseLeave(object sender, System.EventArgs e){ - lblTopLeft.Visible = false; - lblBottomRight.Visible = false; - this.Refresh(); + + private void NotifySelected() { + + this.GetParent.SelectedControl = this; + this.GetParent.InvalidateEx(); + this.OnClick (EventArgs.Empty); } - private void SizeMouseDown(object sender, System.Windows.Forms.MouseEventArgs e){ - if (sender == lblTopLeft){ - mouseDown = SizeDirection.TopLeft; - } - if (sender == lblBottomRight){ - mouseDown = SizeDirection.BottomRight; - } - xCoor = e.X; - yCoor = e.Y; + + private void NotifyUnSelected () { + this.selected = false; + this.GetParent.SelectedControl = null; + this.GetParent.InvalidateEx(); } - private void SizeMouseMove(object sender, System.Windows.Forms.MouseEventArgs e){ - if (mouseDown == SizeDirection.TopLeft){ - this.Top = this.Top + (e.Y - yCoor); - this.Left = this.Left + (e.X - xCoor); - } - - if (mouseDown == SizeDirection.BottomRight){ - this.Height = this.Height + (e.Y - yCoor); - this.Width = this.Width + (e.X - xCoor); + + private void OnMouseDown (object sender, MouseEventArgs e) { + ITracker tracker = this.GetParent; + if (tracker != null) { + tracker.ClearSelections(); + tracker.RectTracker.m_rect = this.Bounds; + this.selected = true; + this.NotifySelected(); + tracker.SelectedControl = this; } - + this.selected = true; } - private void ReportControlBaseMouseUp(object sender, MouseEventArgs e){ + + + private void OnMouseUp(object sender, MouseEventArgs e){ if (e.Button == MouseButtons.Right) { ContextMenuStrip ctMen = MenuService.CreateContextMenu (this,contextMenuPath); ctMen.Show (this,new Point (e.X,e.Y)); - } - } - private void SizeMouseUp(object sender, System.Windows.Forms.MouseEventArgs e){ - mouseDown = SizeDirection.None; - base.OnControlChanged(); - } - - - protected void DrawDecorations(PaintEventArgs e){ - // it is not said that the - // focused object in all the app - // is the current report item! - // So I don't check this.Focused. - - if (lblBottomRight.Visible){ - e.Graphics.Clear(this.Body.BackColor); - ControlPaint.DrawFocusRectangle(e.Graphics, - controlHelper.BuildFocusRectangle); + this.NotifyUnSelected(); } + } - + protected void DrawEdges (PaintEventArgs e,Rectangle rectangle) { controlHelper.DrawEdges(e,rectangle); } @@ -122,17 +114,49 @@ namespace SharpReport.Designer{ protected override void OnPaint(System.Windows.Forms.PaintEventArgs e){ base.OnPaint(e); + if (this.selected) { + RectTracker tracker = this.GetParent.RectTracker; + if (tracker != null) { + tracker.m_rect = this.Bounds; + tracker.Draw(this.GetParent.DesignSurface.CreateGraphics()); + } + } } - protected override void OnResize(EventArgs e){ + protected override void OnResize(EventArgs e){ base.OnResize(e); this.Invalidate(); } + protected ControlHelper ControlHelper { + get { + return controlHelper; + } + } + + + protected Rectangle FocusRectangle { get {return this.controlHelper.BuildFocusRectangle;} } + public bool Selected { + set { + selected = value; + } + } + + #region SharpReportCore.IPropertyChange interface implementation + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + public void NotifyPropertyChanged(string property) { + if (this.PropertyChanged != null) { + this.PropertyChanged(this,new System.ComponentModel.PropertyChangedEventArgs (property)); + } + } + #endregion + + #region Windows Forms Designer generated code /// /// This method is required for Windows Forms designer support. @@ -140,46 +164,14 @@ namespace SharpReport.Designer{ /// not be able to load this method if it was changed manually. /// private void InitializeComponent() { - this.lblBottomRight = new System.Windows.Forms.Label(); - this.lblTopLeft = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // lblBottomRight - // - this.lblBottomRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.lblBottomRight.BackColor = System.Drawing.Color.Transparent; - this.lblBottomRight.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.lblBottomRight.Cursor = System.Windows.Forms.Cursors.SizeNWSE; - this.lblBottomRight.Location = new System.Drawing.Point(283, 47); - this.lblBottomRight.Name = "lblBottomRight"; - this.lblBottomRight.Size = new System.Drawing.Size(8, 8); - this.lblBottomRight.TabIndex = 0; - this.lblBottomRight.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SizeMouseUp); - this.lblBottomRight.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SizeMouseMove); - this.lblBottomRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SizeMouseDown); - // - // lblTopLeft - // - this.lblTopLeft.BackColor = System.Drawing.Color.Transparent; - this.lblTopLeft.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.lblTopLeft.Cursor = System.Windows.Forms.Cursors.SizeAll; - this.lblTopLeft.Location = new System.Drawing.Point(0, 0); - this.lblTopLeft.Name = "lblTopLeft"; - this.lblTopLeft.Size = new System.Drawing.Size(8, 8); - this.lblTopLeft.TabIndex = 1; - this.lblTopLeft.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SizeMouseUp); - this.lblTopLeft.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SizeMouseMove); - this.lblTopLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SizeMouseDown); - // // ReportControlBase // - this.Controls.Add(this.lblTopLeft); - this.Controls.Add(this.lblBottomRight); this.Name = "ReportControlBase"; this.Size = new System.Drawing.Size(292, 56); - this.Enter += new System.EventHandler(this.ReportControlBaseEnter); - this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ReportControlBaseMouseUp); - this.Leave += new System.EventHandler(this.ReportControlBaseLeave); + this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnMouseUp); + this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnMouseDown); this.ResumeLayout(false); } #endregion diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportImageControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportImageControl.cs index c4f7eb709a..0c76d268d1 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportImageControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportImageControl.cs @@ -40,7 +40,6 @@ namespace SharpReport.ReportItems { protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) { base.OnPaint (pea); base.DrawEdges (pea); - base.DrawDecorations(pea); if (this.image != null) { if (this.scaleImageToSize) { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportObjectControlBase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportObjectControlBase.cs index faf4991794..10af035848 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportObjectControlBase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportObjectControlBase.cs @@ -41,7 +41,9 @@ namespace SharpReport.Designer } #endregion - protected void OnControlChanged () { + + + public void NotifyControlChanged () { if ( VisualControlChanged != null ) { VisualControlChanged (this,EventArgs.Empty); } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs index 8209227905..193f5acb7d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs @@ -41,7 +41,6 @@ namespace SharpReport.Designer { protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) { base.OnPaint(pea); - base.DrawDecorations(pea); shape.FillShape(pea.Graphics, new SolidFillPattern(this.BackColor), diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs index 498f7b6e5e..9eeafb7cbd 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs @@ -20,9 +20,11 @@ namespace SharpReport.Designer{ /// Description of ReportTableControl. /// - internal class ReportRowControl:ReportControlBase{ + internal class ReportRowControl:ContainerControl{ + private RectangleShape shape = new RectangleShape(); private bool drawBorder; + public ReportRowControl():base(){ InitializeComponent(); this.SetStyle(ControlStyles.DoubleBuffer | @@ -42,7 +44,6 @@ namespace SharpReport.Designer{ base.OnPaint(pea); base.DrawEdges (pea, new Rectangle(0,5,this.ClientSize.Width - 1,this.ClientSize.Height - 6) ); - base.DrawDecorations(pea); if (this.drawBorder) { shape.DrawShape (pea.Graphics, diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs index 82f2464afc..ba25bea4d1 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs @@ -72,7 +72,6 @@ namespace SharpReport.Designer{ base.OnPaint(pea); base.DrawEdges (pea); - base.DrawDecorations(pea); string str; @@ -91,7 +90,7 @@ namespace SharpReport.Designer{ this.textDrawer.DrawString (pea.Graphics,this.Text,this.Font, new SolidBrush(this.ForeColor),(RectangleF)this.ClientRectangle, this.stringTrimming,this.contentAlignment); - + } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs index 7f8a46972b..d4ae82201f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/PageNumber.cs @@ -44,6 +44,9 @@ namespace SharpReport.ReportItems.Functions { base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); this.Text = functionName; @@ -58,6 +61,12 @@ namespace SharpReport.ReportItems.Functions { this.visualControl.ResumeLayout(); } + #region Events + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ if (initDone == true) { @@ -89,6 +98,8 @@ namespace SharpReport.ReportItems.Functions { } } + #endregion + #region Properties public override Size Size { get { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs index edb4a7eefa..8b6f7dbdff 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/Functions/MiscFunctions/Today.cs @@ -18,15 +18,16 @@ using SharpReport.Designer; using System.Windows.Forms; - /// - /// This Function show's the date like - /// 'Printed : 04.23.2005' - /// Localise it by just overriding the Text Property - /// - /// - /// created by - Forstmeier Peter - /// created on - 24.04.2005 10:29:05 - /// +/// +/// This Function show's the date like +/// 'Printed : 04.23.2005' +/// Localise it by just overriding the Text Property +/// +/// +/// created by - Forstmeier Peter +/// created on - 24.04.2005 10:29:05 +/// + namespace SharpReport.ReportItems.Functions { public class TodaysDate : SharpReportCore.BaseToday,SharpReport.Designer.IDesignable { @@ -48,6 +49,10 @@ namespace SharpReport.ReportItems.Functions { this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); + + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); this.Text = functionName; @@ -62,6 +67,13 @@ namespace SharpReport.ReportItems.Functions { } #region events + + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ if (initDone == true) { ItemsHelper.UpdateControlFromTextBase(this.visualControl,this); @@ -93,10 +105,9 @@ namespace SharpReport.ReportItems.Functions { } #endregion - - - + #region overrides + public override string ToString() { return functionName; } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs index 214dcc0945..05d6449390 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportCircleItem.cs @@ -41,12 +41,20 @@ namespace SharpReport.ReportItems{ this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); - + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); + base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); } #region EventHandling + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromGraphicBase (this.visualControl,this); this.HandlePropertyChanged(e.PropertyName); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs index 44245af75c..6498a581b6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportImageItem.cs @@ -40,6 +40,9 @@ namespace SharpReport.ReportItems { this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); + + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); } private void Setup() { @@ -55,6 +58,12 @@ namespace SharpReport.ReportItems { #region EventHandling + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ Setup(); ItemsHelper.UpdateControlFromGraphicBase(this.visualControl,this); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs index 303df960fe..2862d989b3 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportLineItem.cs @@ -42,10 +42,20 @@ namespace SharpReport.ReportItems{ this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); + } #region EventHandling + + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromGraphicBase (this.visualControl,this); this.HandlePropertyChanged(e.PropertyName); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs index e312716dff..0a60a0cd03 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/GraphicBased/ReportRectangleItem.cs @@ -44,10 +44,20 @@ namespace SharpReport.ReportItems{ this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); + + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); } #region EventHandling + + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromGraphicBase (this.visualControl,this); this.HandlePropertyChanged(e.PropertyName); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs index e7256275dc..8ea05ec9e0 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs @@ -51,27 +51,30 @@ namespace SharpReport.ReportItems{ this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); - + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); + base.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (BasePropertyChange); } #endregion - #region overrides - public override string ToString(){ - return this.Name; - } + #region events's - #endregion + //Tracker + + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } - #region events's private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromTextBase(this.visualControl,this); this.visualControl.ContentAlignment = base.ContentAlignment; this.visualControl.StringTrimming = base.StringTrimming; - + this.visualControl.DrawBorder = base.DrawBorder; this.HandlePropertyChanged(e.PropertyName); } @@ -102,6 +105,7 @@ namespace SharpReport.ReportItems{ } #endregion + #region Property's public override Size Size { @@ -179,6 +183,14 @@ namespace SharpReport.ReportItems{ #endregion + #region overrides + public override string ToString(){ + return this.Name; + } + + #endregion + + /* #region IDisposable public override void Dispose(){ diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs index bbd7b10a09..965837f8b9 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs @@ -45,6 +45,8 @@ namespace SharpReport.ReportItems this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnAppereanceChanged); + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); base.PropertyChanged += new PropertyChangedEventHandler (BasePropertyChange); @@ -52,7 +54,7 @@ namespace SharpReport.ReportItems base.Items.Removed += OnRemove; } #endregion - + #region Events for Childs private void ChildSelected(object sender, EventArgs e){ @@ -104,7 +106,13 @@ namespace SharpReport.ReportItems this.HandlePropertyChanged("OnChildControlRemoved"); } } + + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromTextBase (this.visualControl,this); diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs index a1739baa4f..4105b46f74 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs @@ -43,7 +43,11 @@ namespace SharpReport.ReportItems { this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); + //Event from Tracker + this.visualControl.PropertyChanged += new PropertyChangedEventHandler (ControlPropertyChange); + base.PropertyChanged += new PropertyChangedEventHandler (BasePropertyChange); + } @@ -52,9 +56,14 @@ namespace SharpReport.ReportItems { #region events + //Tracker + private void ControlPropertyChange (object sender, PropertyChangedEventArgs e){ + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.HandlePropertyChanged(e.PropertyName); + } + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromTextBase(this.visualControl,this); - this.visualControl.ContentAlignment = base.ContentAlignment; this.visualControl.StringTrimming = base.StringTrimming; this.visualControl.DrawBorder = base.DrawBorder; diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj index 4f549a1b45..c551ab16bb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj @@ -87,6 +87,9 @@ + + + diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs index 91e9570ebc..8cfb6454f0 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs @@ -40,7 +40,7 @@ namespace SharpReportCore{ void OnAdded (object sender, CollectionItemEventArgs e){ System.Console.WriteLine(""); - System.Console.WriteLine("RowItem:OnAdded"); + System.Console.WriteLine("RowItem:OnAdded did we use this function???"); } #region overrides