diff --git a/AddIns/ICSharpCode.SharpDevelop.addin b/AddIns/ICSharpCode.SharpDevelop.addin index 237c0dbb36..7d929c100a 100644 --- a/AddIns/ICSharpCode.SharpDevelop.addin +++ b/AddIns/ICSharpCode.SharpDevelop.addin @@ -108,7 +108,7 @@ @@ -155,7 +155,7 @@ @@ -298,25 +298,7 @@ - - - - + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + - - - - - + @@ -670,10 +670,12 @@ @@ -741,7 +743,7 @@ class = "ICSharpCode.SharpDevelop.Commands.OpenFile"/> @@ -1685,34 +1687,34 @@ - - - - - - - - - - + + + + + + + diff --git a/data/options/SharpDevelop-templates.xml b/data/options/SharpDevelop-templates.xml index 26215f2067..ef508aab60 100644 --- a/data/options/SharpDevelop-templates.xml +++ b/data/options/SharpDevelop-templates.xml @@ -5,10 +5,10 @@ ${Selection} } for (|; ; ) { -${Selection} + ${Selection} } for (|; ; ) -${Selection} + ${Selection} if (|) { ${Selection} } @@ -18,41 +18,41 @@ ${Selection} } if (|) -${Selection} + ${Selection} switch (|) { -case: -break; -default: -${Selection} -break; + case: + break; + default: + ${Selection} + break; } switch (|) { -case : -${Selection} -break; + case : + ${Selection} + break; } try { -${Selection}| + ${Selection}| } catch (Exception) { } try { -${Selection}| + ${Selection}| } catch (Exception) { - + } finally { - + } try { -${Selection}| + ${Selection}| } finally { - + } while (|) { -${Selection} + ${Selection} } while (|) -${Selection} + ${Selection} System.Console.WriteLine(${Selection}|); System.Console.Write(${Selection}|); diff --git a/data/resources/StringResources.cz.resources b/data/resources/StringResources.cz.resources index e14971383a..eb13aad2a6 100644 Binary files a/data/resources/StringResources.cz.resources and b/data/resources/StringResources.cz.resources differ diff --git a/data/resources/StringResources.de.resources b/data/resources/StringResources.de.resources index b33053639e..1e4a4210e8 100644 Binary files a/data/resources/StringResources.de.resources and b/data/resources/StringResources.de.resources differ diff --git a/data/resources/StringResources.es-mx.resources b/data/resources/StringResources.es-mx.resources index 91e876c877..37a08f0583 100644 Binary files a/data/resources/StringResources.es-mx.resources and b/data/resources/StringResources.es-mx.resources differ diff --git a/data/resources/StringResources.es.resources b/data/resources/StringResources.es.resources index 87b8d4b8b4..8c26ae2fd2 100644 Binary files a/data/resources/StringResources.es.resources and b/data/resources/StringResources.es.resources differ diff --git a/data/resources/StringResources.fr.resources b/data/resources/StringResources.fr.resources index 698eee93ce..4e2c62cf7a 100644 Binary files a/data/resources/StringResources.fr.resources and b/data/resources/StringResources.fr.resources differ diff --git a/data/resources/StringResources.hu.resources b/data/resources/StringResources.hu.resources index 9a153854e8..aedf123e9c 100644 Binary files a/data/resources/StringResources.hu.resources and b/data/resources/StringResources.hu.resources differ diff --git a/data/resources/StringResources.it.resources b/data/resources/StringResources.it.resources index e0f3e05205..c9045fbc56 100644 Binary files a/data/resources/StringResources.it.resources and b/data/resources/StringResources.it.resources differ diff --git a/data/resources/StringResources.kr.resources b/data/resources/StringResources.kr.resources index 3f37e26f97..c7eb09937b 100644 Binary files a/data/resources/StringResources.kr.resources and b/data/resources/StringResources.kr.resources differ diff --git a/data/resources/StringResources.nl.resources b/data/resources/StringResources.nl.resources index 9ebb02e3d5..136d727fbf 100644 Binary files a/data/resources/StringResources.nl.resources and b/data/resources/StringResources.nl.resources differ diff --git a/data/resources/StringResources.pl.resources b/data/resources/StringResources.pl.resources index 6e3c527dda..27e081f34d 100644 Binary files a/data/resources/StringResources.pl.resources and b/data/resources/StringResources.pl.resources differ diff --git a/data/resources/StringResources.pt-br.resources b/data/resources/StringResources.pt-br.resources index 437da4a7b0..53e534c68d 100644 Binary files a/data/resources/StringResources.pt-br.resources and b/data/resources/StringResources.pt-br.resources differ diff --git a/data/resources/StringResources.ro.resources b/data/resources/StringResources.ro.resources index 681bda3d06..41a8e66298 100644 Binary files a/data/resources/StringResources.ro.resources and b/data/resources/StringResources.ro.resources differ diff --git a/data/resources/StringResources.tr.resources b/data/resources/StringResources.tr.resources index 4152113d97..a241870763 100644 Binary files a/data/resources/StringResources.tr.resources and b/data/resources/StringResources.tr.resources differ diff --git a/data/templates/file/CSharp/CSharp.WPFFlowDocument.xft b/data/templates/file/CSharp/CSharp.WPFFlowDocument.xft index 0c7d92f6e1..10a99da554 100644 --- a/data/templates/file/CSharp/CSharp.WPFFlowDocument.xft +++ b/data/templates/file/CSharp/CSharp.WPFFlowDocument.xft @@ -9,7 +9,7 @@ defaultname = "FlowDocument${Number}.xaml" language = "XML"/> - A WinFX Flow Document + ${res:Templates.File.WinFXFlowDocument.Name} - ASP.net webpage project + ${res:Templates.Project.WebPage.Name} C# ASP.NET C#.Project.Form C# - ASP.net web application + ${res:Templates.Project.WebPage.Description} diff --git a/samples/SharpReport/PullData/MSDE/CustOrdersDetail.srd b/samples/SharpReport/PullData/MSDE/CustOrdersDetail.srd index 4fc5392953..beccd4383e 100644 --- a/samples/SharpReport/PullData/MSDE/CustOrdersDetail.srd +++ b/samples/SharpReport/PullData/MSDE/CustOrdersDetail.srd @@ -12,7 +12,7 @@ - + diff --git a/samples/SharpReport/ReportSamples/ReportSamples.csproj b/samples/SharpReport/ReportSamples/ReportSamples.csproj index 7a06f09a47..a9f9b69473 100644 --- a/samples/SharpReport/ReportSamples/ReportSamples.csproj +++ b/samples/SharpReport/ReportSamples/ReportSamples.csproj @@ -1,6 +1,6 @@  - WinExe + Exe ReportSamples ReportSamples Debug @@ -38,10 +38,6 @@ - - ..\..\..\..\..\..\AddIns\AddIns\Misc\SharpReport\SharpReportCore.dll - False - @@ -70,6 +66,10 @@ tlbimp False + + {4B2239FF-8FD6-431D-9D22-1B8049BA6917} + SharpReportCore + \ No newline at end of file diff --git a/samples/SharpReport/ReportSamples/ReportSamples.sln b/samples/SharpReport/ReportSamples/ReportSamples.sln index 7ca3ebf91b..485b4323e3 100644 --- a/samples/SharpReport/ReportSamples/ReportSamples.sln +++ b/samples/SharpReport/ReportSamples/ReportSamples.sln @@ -1,7 +1,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.1100 +# SharpDevelop 2.0.0.1438 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportSamples", "ReportSamples.csproj", "{0D46CC0C-FC27-4258-BC0D-F4A9E617FA0E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpReportCore", "..\..\..\src\AddIns\Misc\SharpReport\SharpReportCore\SharpReportCore.csproj", "{4B2239FF-8FD6-431D-9D22-1B8049BA6917}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,5 +14,9 @@ Global {0D46CC0C-FC27-4258-BC0D-F4A9E617FA0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0D46CC0C-FC27-4258-BC0D-F4A9E617FA0E}.Release|Any CPU.Build.0 = Release|Any CPU {0D46CC0C-FC27-4258-BC0D-F4A9E617FA0E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4B2239FF-8FD6-431D-9D22-1B8049BA6917}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4B2239FF-8FD6-431D-9D22-1B8049BA6917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4B2239FF-8FD6-431D-9D22-1B8049BA6917}.Release|Any CPU.Build.0 = Release|Any CPU + {4B2239FF-8FD6-431D-9D22-1B8049BA6917}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin b/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin index 2f8b51ce33..f3e98c9420 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin @@ -26,7 +26,7 @@ diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs index c2ecc02e16..01aaac4b90 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs @@ -417,8 +417,8 @@ namespace CSharpBinding.FormattingStrategy return IndentLine(textArea, lineNr) + "#endregion".Length; } - if (lineAbove.HighlightSpanStack != null && lineAbove.HighlightSpanStack.Count > 0) { - if (!((Span)lineAbove.HighlightSpanStack.Peek()).StopEOL) { // case for /* style comments + if (lineAbove.HighlightSpanStack != null && !lineAbove.HighlightSpanStack.IsEmpty) { + if (!lineAbove.HighlightSpanStack.Peek().StopEOL) { // case for /* style comments int index = lineAboveText.IndexOf("/*"); if (index > 0) { StringBuilder indentation = new StringBuilder(GetIndentation(textArea, lineNr - 1)); diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs index 27c3143491..b7262c1a29 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs @@ -321,7 +321,8 @@ namespace CSharpBinding.FormattingStrategy // statement). if (!oldBlock.Continuation && !oldBlock.OneLineBlock && oldBlock.StartLine == block.StartLine && - block.StartLine < doc.LineNumber && lastRealChar != ':') { + block.StartLine < doc.LineNumber && lastRealChar != ':') + { // use indent StringBuilder to get the indentation of the current line indent.Length = 0; line = doc.Text; // get untrimmed line @@ -330,6 +331,11 @@ namespace CSharpBinding.FormattingStrategy break; indent.Append(line[i]); } + // /* */ multiline comments have an extra space - do not count it + // for the block's indentation. + if (startInComment && indent.Length > 0 && indent[indent.Length - 1] == ' ') { + indent.Length -= 1; + } block.InnerIndent = indent.ToString(); } return; diff --git a/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.addin b/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.addin index a6a7cd904f..28adcd15d5 100644 --- a/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.addin +++ b/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.addin @@ -15,7 +15,7 @@ diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs index 77573ced08..7f23c9c77b 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs @@ -353,6 +353,16 @@ namespace ICSharpCode.FormsDesigner protected abstract string CreateEventHandler(EventDescriptor edesc, string eventMethodName, string body, string indentation); + protected virtual int GetCursorLine(IDocument document, IMethod method) + { + return method.BodyRegion.BeginLine + 1; + } + + protected virtual int GetCursorLineAfterEventHandlerCreation() + { + return 2; + } + /// /// If found return true and int as position /// @@ -371,7 +381,7 @@ namespace ICSharpCode.FormsDesigner foreach (IMethod method in completeClass.Methods) { if (method.Name == eventMethodName) { - position = method.Region.BeginLine + 1; + position = GetCursorLine(document, method); file = method.DeclaringType.CompilationUnit.FileName; return true; } @@ -379,12 +389,13 @@ namespace ICSharpCode.FormsDesigner viewContent.MergeFormChanges(); Reparse(); - position = c.Region.EndLine + 1; file = c.CompilationUnit.FileName; + int line = GetEventHandlerInsertionLine(c); - int offset = viewContent.Document.GetLineSegment(GetEventHandlerInsertionLine(c) - 1).Offset; + int offset = viewContent.Document.GetLineSegment(line - 1).Offset; viewContent.Document.Insert(offset, CreateEventHandler(edesc, eventMethodName, body, tabs)); + position = line + GetCursorLineAfterEventHandlerCreation(); return false; } diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/CSharpDesignerGenerator.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/CSharpDesignerGenerator.cs index 23d1fe89f0..a764e2e485 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/CSharpDesignerGenerator.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/CSharpDesignerGenerator.cs @@ -19,19 +19,7 @@ namespace ICSharpCode.FormsDesigner { protected override DomRegion GetReplaceRegion(ICSharpCode.TextEditor.Document.IDocument document, IMethod method) { - DomRegion r = method.BodyRegion; - int offset = document.PositionToOffset(new Point(r.BeginColumn - 1, r.BeginLine - 1)); - string tmp = document.GetText(offset, 10); - while (offset < document.TextLength) { - char c = document.GetCharAt(offset++); - if (c == '{') { - return new DomRegion(r.BeginLine + 1, 1, r.EndLine, 1); - } - if (c != ' ') { - break; - } - } - return new DomRegion(r.BeginLine + 2, 1, r.EndLine, 1); + return new DomRegion(GetCursorLine(document, method), 1, method.BodyRegion.EndLine, 1); } protected override System.CodeDom.Compiler.CodeDomProvider CreateCodeProvider() @@ -52,6 +40,28 @@ namespace ICSharpCode.FormsDesigner return b.ToString(); } + protected override int GetCursorLineAfterEventHandlerCreation() + { + return 3; + } + + protected override int GetCursorLine(ICSharpCode.TextEditor.Document.IDocument document, IMethod method) + { + DomRegion r = method.BodyRegion; + int offset = document.PositionToOffset(new Point(r.BeginColumn - 1, r.BeginLine - 1)); + string tmp = document.GetText(offset, 10); + while (offset < document.TextLength) { + char c = document.GetCharAt(offset++); + if (c == '{') { + return r.BeginLine + 1; + } + if (c != ' ') { + break; + } + } + return r.BeginLine + 2; + } + protected static string GenerateParams(EventDescriptor edesc, bool paramNames) { System.Type type = edesc.EventType; diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs index ff6f7f34ea..5ba27408c3 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs @@ -289,7 +289,7 @@ namespace ICSharpCode.FormsDesigner public void ShowSourceCode(int lineNumber) { ShowSourceCode(); - textAreaControlProvider.TextEditorControl.ActiveTextAreaControl.JumpTo(lineNumber, 255); + textAreaControlProvider.TextEditorControl.ActiveTextAreaControl.JumpTo(lineNumber - 1); } public void ShowSourceCode(IComponent component, EventDescriptor edesc, string eventMethodName) @@ -300,7 +300,7 @@ namespace ICSharpCode.FormsDesigner if (FileUtility.IsEqualFileName(file, this.TextEditorControl.FileName)) { ShowSourceCode(position); } else { - FileService.JumpToFilePosition(file, position, 255); + FileService.JumpToFilePosition(file, position - 1, 0); } } diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs index f0ea2f11c3..b155111153 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs @@ -183,7 +183,7 @@ namespace ICSharpCode.FormsDesigner.Gui void loadButtonClick(object sender, System.EventArgs e) { if (!System.IO.File.Exists(ControlDictionary["fileNameTextBox"].Text)) { - MessageBox.Show("Please enter a valid file name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageService.ShowWarning("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.EnterValidFilename}"); return; } @@ -192,7 +192,7 @@ namespace ICSharpCode.FormsDesigner.Gui Assembly asm = Assembly.LoadFrom(assemblyFileName); FillComponents(asm, Path.GetDirectoryName(assemblyFileName)); } catch { - MessageBox.Show("Please enter the file name of a valid .NET assembly.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageService.ShowWarning("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.FileIsNotAssembly}"); FillComponents(null, null); } } diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs index 80438a299a..8f3c11cf1c 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs @@ -124,7 +124,7 @@ namespace ICSharpCode.FormsDesigner } } } - SideTabDesigner customTab = new CustomComponentsSideTab(SharpDevelopSideBar.SideBar, "Custom Components", toolboxService); + SideTabDesigner customTab = new CustomComponentsSideTab(SharpDevelopSideBar.SideBar, ResourceService.GetString("ICSharpCode.SharpDevelop.FormDesigner.ToolboxProvider.CustomComponents"), toolboxService); customTab.ItemRemoved += SideTabItemRemoved; customTab.ItemsExchanged += SideTabItemsExchanged; SideTabs.Add(customTab); diff --git a/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/BinaryView.cs b/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/BinaryView.cs index 4c9ef0b54f..3549c8697b 100644 --- a/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/BinaryView.cs +++ b/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/BinaryView.cs @@ -50,7 +50,7 @@ namespace ResourceEditor viewHexDumpCheckBox.Location = new Point(8, 4); viewHexDumpCheckBox.Size = new Size(Width - 16, 16); - viewHexDumpCheckBox.Text = "Show as Hex Dump"; + viewHexDumpCheckBox.Text = StringParser.Parse("${res:ResourceEditor.ResourceEdit.ShowAsHexDump}"); viewHexDumpCheckBox.CheckedChanged += new EventHandler(CheckEvt); Controls.Add(byteDataTextBox); diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/AssignStylesheetCommand.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/AssignStylesheetCommand.cs index c243699d70..59cf51ae36 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/AssignStylesheetCommand.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/AssignStylesheetCommand.cs @@ -43,7 +43,7 @@ namespace ICSharpCode.XmlEditor dialog.AddExtension = true; dialog.Multiselect = false; dialog.CheckFileExists = true; - dialog.Title = "Assign XSLT Stylesheet"; + dialog.Title = ResourceService.GetString("ICSharpCode.XmlEditor.AssignXSLT.Title"); AddInTreeNode node = AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter"); if (node != null) { diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemasPanel.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemasPanel.cs index 546c28627e..d7ccf710df 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemasPanel.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemasPanel.cs @@ -105,7 +105,7 @@ namespace ICSharpCode.XmlEditor changed = AddSchema(schemaFileName); } } catch (Exception ex) { - MessageService.ShowError(ex, "${res:ICSharpCode.XmlEditor.XmlSchemasPanel.UnableToAddSchema}"); + MessageService.ShowError("${res:ICSharpCode.XmlEditor.XmlSchemasPanel.UnableToAddSchema}\n\n" + ex.Message); } } diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin index 765a563c31..8fa2b369fb 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin @@ -44,7 +44,7 @@ extensions = "*.xml"/> @@ -65,7 +65,7 @@ @@ -74,11 +74,11 @@ diff --git a/src/AddIns/Misc/AddInManager/Project/Src/InstallableAddIn.cs b/src/AddIns/Misc/AddInManager/Project/Src/InstallableAddIn.cs index a1ba88521b..d9489e331a 100644 --- a/src/AddIns/Misc/AddInManager/Project/Src/InstallableAddIn.cs +++ b/src/AddIns/Misc/AddInManager/Project/Src/InstallableAddIn.cs @@ -40,7 +40,7 @@ namespace ICSharpCode.AddInManager addIn = AddIn.Load(fileName); } if (addIn.Manifest.PrimaryIdentity == null) - throw new AddInLoadException("The AddIn must have an for use with the AddIn-Manager."); + throw new AddInLoadException(ResourceService.GetString("AddInManager.AddInMustHaveIdentity")); } void LoadAddInFromZip(ZipFile file) diff --git a/src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs b/src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs index ac09ae6710..b8757e12cc 100644 --- a/src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs +++ b/src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs @@ -453,8 +453,7 @@ namespace ICSharpCode.AddInManager switch (Path.GetExtension(file).ToLowerInvariant()) { case ".addin": if (FileUtility.IsBaseDirectory(FileUtility.ApplicationRootPath, file)) { - MessageService.ShowMessage("You cannot install AddIns inside the ${ProductName} directory, " + - "they will be picked up as pre-installed AddIns automatically."); + MessageService.ShowMessage("${res:AddInManager.CannotInstallIntoApplicationDirectory}"); return false; } list.Add(new InstallableAddIn(file, false)); @@ -464,7 +463,7 @@ namespace ICSharpCode.AddInManager list.Add(new InstallableAddIn(file, true)); break; default: - MessageService.ShowMessage("Unknown file format: " + Path.GetExtension(file)); + MessageService.ShowMessage("${res:AddInManager.UnknownFileFormat} " + Path.GetExtension(file)); return false; } } catch (AddInLoadException ex) { @@ -651,7 +650,7 @@ namespace ICSharpCode.AddInManager case AddInAction.Disable: for (int i = 0; i < selected.Count; i++) { if (selected[i].Manifest.PrimaryIdentity == "ICSharpCode.AddInManager") { - MessageService.ShowMessage("You cannot disable the AddInManager because you need it to re-enable AddIns!"); + MessageService.ShowMessage("${res:AddInManager.CannotDisableAddInManager}"); selected.RemoveAt(i--); } } diff --git a/src/AddIns/Misc/CodeCoverage/Project/Src/CodeCoverageHighlighter.cs b/src/AddIns/Misc/CodeCoverage/Project/Src/CodeCoverageHighlighter.cs index 02ac80b2a6..1e90bafcb8 100644 --- a/src/AddIns/Misc/CodeCoverage/Project/Src/CodeCoverageHighlighter.cs +++ b/src/AddIns/Misc/CodeCoverage/Project/Src/CodeCoverageHighlighter.cs @@ -40,19 +40,19 @@ namespace ICSharpCode.CodeCoverage if (sequencePoint.EndLine == sequencePoint.Line) { LineSegment lineSegment = markerStrategy.Document.GetLineSegment(sequencePoint.Line - 1); - markerStrategy.AddMarker(new CodeCoverageTextMarker(lineSegment.Offset + sequencePoint.Column, sequencePoint)); + markerStrategy.AddMarker(new CodeCoverageTextMarker(lineSegment.Offset + sequencePoint.Column - 1, sequencePoint)); } else { // Sequence point spread across lines. for (int line = sequencePoint.Line; line <= sequencePoint.EndLine; ++line) { LineSegment lineSegment = markerStrategy.Document.GetLineSegment(line - 1); if (line == sequencePoint.Line) { // First line. - markerStrategy.AddMarker(new CodeCoverageTextMarker(lineSegment.Offset + sequencePoint.Column, lineSegment.Length - (lineSegment.DelimiterLength - 1) - sequencePoint.Column, sequencePoint)); + markerStrategy.AddMarker(new CodeCoverageTextMarker(lineSegment.Offset + sequencePoint.Column - 1, lineSegment.Length - (sequencePoint.Column - 1), sequencePoint)); } else if (line == sequencePoint.EndLine) { // Last line. markerStrategy.AddMarker(new CodeCoverageTextMarker(lineSegment.Offset, sequencePoint.EndColumn - 1, sequencePoint)); } else { - markerStrategy.AddMarker(new CodeCoverageTextMarker(lineSegment.Offset, lineSegment.Length - (lineSegment.DelimiterLength - 1), sequencePoint)); + markerStrategy.AddMarker(new CodeCoverageTextMarker(lineSegment.Offset, lineSegment.Length, sequencePoint)); } } } diff --git a/src/AddIns/Misc/CodeCoverage/Test/AddCodeCoverageMarkersTestFixture.cs b/src/AddIns/Misc/CodeCoverage/Test/AddCodeCoverageMarkersTestFixture.cs index ae6ca041de..128189db17 100644 --- a/src/AddIns/Misc/CodeCoverage/Test/AddCodeCoverageMarkersTestFixture.cs +++ b/src/AddIns/Misc/CodeCoverage/Test/AddCodeCoverageMarkersTestFixture.cs @@ -78,7 +78,7 @@ namespace ICSharpCode.CodeCoverage.Tests [Test] public void MarkerOneOffset() { - Assert.AreEqual(3, markerOne.Offset); + Assert.AreEqual(2, markerOne.Offset); } [Test] @@ -108,7 +108,7 @@ namespace ICSharpCode.CodeCoverage.Tests [Test] public void MarkerTwoOffset() { - Assert.AreEqual(9, markerTwo.Offset); + Assert.AreEqual(8, markerTwo.Offset); } [Test] @@ -132,7 +132,7 @@ namespace ICSharpCode.CodeCoverage.Tests [Test] public void MarkerThreeOffset() { - Assert.AreEqual(27, markerThree.Offset); + Assert.AreEqual(26, markerThree.Offset); } [Test] diff --git a/src/AddIns/Misc/CodeCoverage/Test/CodeCoverageMarkersCoverTwoLinesTestFixture.cs b/src/AddIns/Misc/CodeCoverage/Test/CodeCoverageMarkersCoverTwoLinesTestFixture.cs index 2eedca5db3..866cc94628 100644 --- a/src/AddIns/Misc/CodeCoverage/Test/CodeCoverageMarkersCoverTwoLinesTestFixture.cs +++ b/src/AddIns/Misc/CodeCoverage/Test/CodeCoverageMarkersCoverTwoLinesTestFixture.cs @@ -70,7 +70,7 @@ namespace ICSharpCode.CodeCoverage.Tests [Test] public void MarkerOneOffset() { - Assert.AreEqual(3, markerOne.Offset); + Assert.AreEqual(2, markerOne.Offset); } [Test] @@ -82,13 +82,13 @@ namespace ICSharpCode.CodeCoverage.Tests [Test] public void MarkerTwoOffset() { - Assert.AreEqual(9, markerTwo.Offset); + Assert.AreEqual(8, markerTwo.Offset); } [Test] public void MarkerTwoLength() { - Assert.AreEqual(56, markerTwo.Length); + Assert.AreEqual(58, markerTwo.Length); } [Test] @@ -112,7 +112,7 @@ namespace ICSharpCode.CodeCoverage.Tests [Test] public void MarkerFourOffset() { - Assert.AreEqual(129, markerFour.Offset); + Assert.AreEqual(128, markerFour.Offset); } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs index 7693e582e0..8321272ec5 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs @@ -75,10 +75,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads debuggerCore.OnDebuggeeStateChanged(); // Force refresh of pads } } else { - MessageBox.Show("You can not switch to function without symbols", "Function switch"); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.CallStack.CannotSwitchWithoutSymbols}", "${res:MainWindow.Windows.Debug.CallStack.FunctionSwitch}"); } } else { - MessageBox.Show("You can not switch functions while the debugger is running.", "Function switch"); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.CallStack.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.CallStack.FunctionSwitch}"); } } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs index 50646f0283..583a1322e0 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs @@ -57,11 +57,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads RedrawContent(); } + static string privateMembersName, staticMembersName, privateStaticMembersName; + public override void RedrawContent() { name.Text = ResourceService.GetString("Global.Name"); val.Text = ResourceService.GetString("Dialog.HighlightingEditor.Properties.Value"); type.Text = ResourceService.GetString("ResourceEditor.ResourceEdit.TypeColumn"); + + privateMembersName = StringParser.Parse("<${res:MainWindow.Windows.Debug.LocalVariables.PrivateMembers}>"); + staticMembersName = StringParser.Parse("<${res:MainWindow.Windows.Debug.LocalVariables.StaticMembers}>"); + privateStaticMembersName = StringParser.Parse("<${res:MainWindow.Windows.Debug.LocalVariables.PrivateStaticMembers}>"); } // This is a walkarond for a visual issue @@ -88,9 +94,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads public static void AddVariableCollectionToTree(VariableCollection varCollection, TreeListViewItemCollection tree) { - TreeListViewItem privateInstanceMenu = new TreeListViewItem("", 0); - TreeListViewItem staticMenu = new TreeListViewItem("", 0); - TreeListViewItem privateStaticMenu = new TreeListViewItem("", 0); + TreeListViewItem privateInstanceMenu = new TreeListViewItem(privateMembersName, 0); + TreeListViewItem staticMenu = new TreeListViewItem(staticMembersName, 0); + TreeListViewItem privateStaticMenu = new TreeListViewItem(privateStaticMembersName, 0); AddVariableMethod addVariable = delegate(Variable variable) { ClassVariable classVariable = variable as ClassVariable; @@ -146,7 +152,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads ((TreeListViewDebuggerItem)e.Item).BeforeExpand(); } } else { - MessageBox.Show("You can not explore variables while the debuggee is running."); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.LocalVariables.CannotExploreVariablesWhileRunning}"); e.Cancel = true; } } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.Menu.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.Menu.cs index 2ff067a778..ce40b22b33 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.Menu.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.Menu.cs @@ -56,7 +56,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads bool suspended = (selItems[0].Tag as Thread).Suspended; if (!debuggerCore.IsPaused) { - MessageBox.Show("You can not freeze or thaw thread while the debugger is running.", "Thread freeze"); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotFreezeWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.Freeze}"); return; } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs index ea5f981eed..98f16205b2 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/RunningThreadsPad.cs @@ -97,7 +97,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads debuggerCore.OnDebuggeeStateChanged(); // Force refresh of pads } } else { - MessageBox.Show("You can not switch threads while the debugger is running.", "Thread switch"); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.ThreadSwitch}"); } } @@ -147,7 +147,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads item.SubItems.Add(thread.Priority.ToString()); break; } - item.SubItems.Add(StringParser.Parse(thread.Suspended ? "${res:Global.Yes}" : "${res:Global.No}")); + item.SubItems.Add(ResourceService.GetString(thread.Suspended ? "Global.Yes" : "Global.No")); return; } } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs index fd2dbc06a0..af29f3e043 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs @@ -120,7 +120,7 @@ namespace ICSharpCode.SharpDevelop.Services public void StepInto() { if (debugger.SelectedFunction == null || debugger.IsRunning) { - MessageBox.Show("You can not step because there is no function selected to be stepped","Step into"); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepInto}"); } else { debugger.StepInto(); } @@ -129,7 +129,7 @@ namespace ICSharpCode.SharpDevelop.Services public void StepOver() { if (debugger.SelectedFunction == null || debugger.IsRunning) { - MessageBox.Show("You can not step because there is no function selected to be stepped","Step over"); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepOver.Description}"); } else { debugger.StepOver(); } @@ -138,7 +138,7 @@ namespace ICSharpCode.SharpDevelop.Services public void StepOut() { if (debugger.SelectedFunction == null || debugger.IsRunning) { - MessageBox.Show("You can not step because there is no function selected to be stepped","Step out"); + MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepOut}"); } else { debugger.StepOut(); } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingColorDialog.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingColorDialog.cs index 6d450bd50c..4887a21b78 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingColorDialog.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingColorDialog.cs @@ -38,6 +38,9 @@ namespace ICSharpCode.SharpDevelop.Gui { { SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.ColorDialog.xfrm")); + if (color == null) { + color = new EditorHighlightColor(true); + } Color = color; boldBox = (CheckBox)ControlDictionary["boldBox"]; diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs index 239ff26417..6c13ac9c6a 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs @@ -148,7 +148,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes public static EditorHighlightColor FromTextEditor(ICSharpCode.TextEditor.Document.HighlightColor color) { - return new EditorHighlightColor(color.HasForgeground, color.Color, color.HasBackground, color.BackgroundColor, color.Bold, color.Italic); + return new EditorHighlightColor(color.HasForeground, color.Color, color.HasBackground, color.BackgroundColor, color.Bold, color.Italic); } public EditorHighlightColor(bool hascolor, Color Color, bool hasbackcolor, Color BackColor, bool bold, bool italic) diff --git a/src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/TocPad.cs b/src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/TocPad.cs index 42f58e0546..5b62782cc9 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/TocPad.cs +++ b/src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/TocPad.cs @@ -300,7 +300,11 @@ namespace HtmlHelp2 #region published Help2 TOC Commands public void SynchronizeToc(string topicUrl) { - tocControl.Synchronize(topicUrl); + try { + tocControl.Synchronize(topicUrl); + } catch (System.Runtime.InteropServices.COMException) { + // SD2-812: ignore exception when trying to synchronize non-existing URL + } } public void GetNextFromNode() @@ -312,9 +316,14 @@ namespace HtmlHelp2 public void GetNextFromUrl(string url) { - int currentNode = tocControl.Hierarchy.GetNextFromUrl(url); - string topicUrl = tocControl.Hierarchy.GetURL(currentNode); - this.CallHelp(topicUrl, true); + try { + int currentNode = tocControl.Hierarchy.GetNextFromUrl(url); + string topicUrl = tocControl.Hierarchy.GetURL(currentNode); + this.CallHelp(topicUrl, true); + } catch (System.Runtime.InteropServices.COMException) { + } catch (ArgumentException) { + // SD2-812: ignore exception when trying to synchronize non-existing URL + } } public void GetPrevFromNode() @@ -326,9 +335,14 @@ namespace HtmlHelp2 public void GetPrevFromUrl(string url) { - int currentNode = tocControl.Hierarchy.GetPrevFromUrl(url); - string topicUrl = tocControl.Hierarchy.GetURL(currentNode); - this.CallHelp(topicUrl, true); + try { + int currentNode = tocControl.Hierarchy.GetPrevFromUrl(url); + string topicUrl = tocControl.Hierarchy.GetURL(currentNode); + this.CallHelp(topicUrl, true); + } catch (ArgumentException) { + } catch (System.Runtime.InteropServices.COMException) { + // SD2-812: ignore exception when trying to synchronize non-existing URL + } } public bool IsNotFirstNode diff --git a/src/AddIns/Misc/NAntAddIn/Project/NAnt.addin b/src/AddIns/Misc/NAntAddIn/Project/NAnt.addin index bff34be550..caca257951 100644 --- a/src/AddIns/Misc/NAntAddIn/Project/NAnt.addin +++ b/src/AddIns/Misc/NAntAddIn/Project/NAnt.addin @@ -17,7 +17,7 @@ diff --git a/src/AddIns/Misc/RegExpTk/Project/Resources/RegExpTkGroupForm.xfrm b/src/AddIns/Misc/RegExpTk/Project/Resources/RegExpTkGroupForm.xfrm index 9eb281d8b9..53b48196dd 100644 --- a/src/AddIns/Misc/RegExpTk/Project/Resources/RegExpTkGroupForm.xfrm +++ b/src/AddIns/Misc/RegExpTk/Project/Resources/RegExpTkGroupForm.xfrm @@ -2,7 +2,7 @@ - + diff --git a/src/AddIns/Misc/RegExpTk/Project/Src/Dialogs/MainWindow.cs b/src/AddIns/Misc/RegExpTk/Project/Src/Dialogs/MainWindow.cs index 5af4e4c716..5e9c9c075c 100644 --- a/src/AddIns/Misc/RegExpTk/Project/Src/Dialogs/MainWindow.cs +++ b/src/AddIns/Misc/RegExpTk/Project/Src/Dialogs/MainWindow.cs @@ -32,7 +32,7 @@ namespace Plugins.RegExpTk { public QuickInsert(string name, string text) { - Name = name; + Name = StringParser.Parse(name); Text = text; } @@ -67,13 +67,14 @@ namespace Plugins.RegExpTk { SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.RegExpTkMainForm.xfrm")); ArrayList quickies = new ArrayList(); - quickies.Add(new QuickInsert("Ungreedy star", "*?")); - quickies.Add(new QuickInsert("Word character value", "\\w")); - quickies.Add(new QuickInsert("Non-word character value", "\\W")); - quickies.Add(new QuickInsert("Whitespace character", "\\s")); - quickies.Add(new QuickInsert("Non-whitespace character", "\\S")); - quickies.Add(new QuickInsert("Digit character", "\\d")); - quickies.Add(new QuickInsert("Non-digit character", "\\D")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.UngreedyStar}", "*?")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.WordCharacter}", "\\w")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.NonWordCharacter}", "\\W")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.WhitespaceCharacter}", "\\s")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.NonWhitespaceCharacter}", "\\S")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.DigitCharacter}", "\\d")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.NonDigitCharacter}", "\\D")); + quickies.Add(new QuickInsert("${res:RegExpTk.RegExpMenu.WordBorder}", "\\b")); foreach (QuickInsert insert in quickies) { MenuCommand cmd = new MenuCommand(insert.Name, new EventHandler(quickInsert)); @@ -81,7 +82,7 @@ namespace Plugins.RegExpTk { quickInsertMenu.Items.Add(cmd); } - matchListViewContextMenu.Items.Add(new MenuCommand("Show groups", new EventHandler(MatchListViewContextMenu_Clicked))); + matchListViewContextMenu.Items.Add(new MenuCommand("${res:RegExpTk.MainDialog.ShowGroups}", new EventHandler(MatchListViewContextMenu_Clicked))); ((Button)ControlDictionary["OkButton"]).Click += new EventHandler(OkButton_Click); ((CheckBox)ControlDictionary["ReplaceCheckBox"]).CheckedChanged += new EventHandler(ReplaceCheckBox_CheckedChanged); @@ -248,7 +249,7 @@ namespace Plugins.RegExpTk { SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = "c:\\"; - sfd.Filter = "Assemblies (*.dll)|*.dll"; + sfd.Filter = ResourceService.GetString("RegExpTk.MainDialog.Assemblies"); sfd.DefaultExt = "dll"; sfd.CheckPathExists = true; 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/Factories.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Factories.cs index 2ed99ddeaa..1e0879219e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/Factories.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/Factories.cs @@ -38,7 +38,8 @@ namespace SharpReport.Designer { public class IDesignableFactory : SharpReportCore.GenericFactory { - public IDesignableFactory() :base(Assembly.GetExecutingAssembly(),typeof(IDesignable)){ + public IDesignableFactory() :base(Assembly.GetExecutingAssembly(), + typeof(IDesignable)){ } public new BaseReportItem Create(string name) { diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignerVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignerVisitor.cs deleted file mode 100644 index 0e2a34c045..0000000000 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IDesignerVisitor.cs +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Forstmeier Helmut - * Date: 10.08.2005 - * Time: 22:14 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -/// -/// Each DesignControl Visitor has to implement this Interface -/// -using System; - -namespace SharpReport.Designer{ - public interface IDesignerVisitor { - void Visit (SharpReport.Designer.BaseDesignerControl designer); - } -} - diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/IVisitor.cs deleted file mode 100644 index 905432bb4b..0000000000 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/IVisitor.cs +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Forstmeier Peter - * Date: 10.08.2005 - * Time: 13:38 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - - using System; - using SharpReport.Designer; - - namespace SharpReport.Designer{ - /// - /// Implemented in SharpReportDesigner - /// - - public interface IVisitor{ - void Accept(IDesignerVisitor visitor); - } - } 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..81c7217899 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs @@ -21,7 +21,7 @@ namespace SharpReport.Designer{ /// /// Description of BaseDesignerControl. /// - public class BaseDesignerControl : System.Windows.Forms.UserControl,SharpReport.Designer.IVisitor + public class BaseDesignerControl : UserControl,SharpReportCore.IVisitor { private SharpReport.Designer.Report reportControl; private Ruler.ctrlRuler ctrlRuler1; @@ -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) { @@ -118,9 +118,12 @@ namespace SharpReport.Designer{ #endregion #region SharpReport.DelegatesInterfaces.IVisitor interface implementation - public void Accept(IDesignerVisitor visitor) { - visitor.Visit(this); + + public void Accept(IModelVisitor visitor){ + SharpReportCore.IModelVisitor v = visitor as SharpReportCore.IModelVisitor; + v.Visit(this); } + #endregion 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/SideTab/BuildSideTab.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs index 857701fdb7..e7978d0bae 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SideTab/BuildSideTab.cs @@ -72,7 +72,7 @@ namespace SharpReport bitmap); tab.Items.Add (t); - t = sideTab.SideTabItemFactory.CreateSideTabItem( "DataRow", + t = sideTab.SideTabItemFactory.CreateSideTabItem( ResourceService.GetString("SharpReport.Toolbar.DataRow"), GlobalEnums.ReportItemType.ReportRowItem.ToString(), ResourceService.GetBitmap("Icons.16x16.SharpQuery.Table")); tab.Items.Add (t); @@ -84,7 +84,7 @@ namespace SharpReport bitmap = ResourceService.GetIcon("Icons.16x16.ResourceEditor.bmp").ToBitmap(); - t = sideTab.SideTabItemFactory.CreateSideTabItem( "Image", + t = sideTab.SideTabItemFactory.CreateSideTabItem( ResourceService.GetString("SharpReport.Toolbar.Image"), GlobalEnums.ReportItemType.ReportImageItem.ToString(), bitmap); tab.Items.Add (t); 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 edb3df3a68..42352a1de8 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj @@ -62,8 +62,6 @@ - - @@ -76,7 +74,6 @@ - @@ -90,6 +87,9 @@ + + + diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs index f40f837a32..60ec30a434 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs @@ -261,7 +261,7 @@ namespace SharpReport{ public void SaveToFile(string fileName){ try { SharpReport.Visitors.SaveReportVisitor saveVisitor = new SharpReport.Visitors.SaveReportVisitor(); - this.baseDesignerControl.Accept (saveVisitor); + this.baseDesignerControl.Accept ((SharpReportCore.IModelVisitor)saveVisitor); XmlDocument xmlDoc = saveVisitor.XmlDocument; XmlTextWriter xw = new XmlTextWriter (fileName,System.Text.Encoding.UTF8); xmlDoc.PreserveWhitespace = true; diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/AbstractVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/AbstractVisitor.cs deleted file mode 100644 index 1275f0893b..0000000000 --- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/AbstractVisitor.cs +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version: 1.1.4322.2032 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ -using System; -using System.Xml; - -using SharpReport.Designer; - -using SharpReportCore; -namespace SharpReport.Visitors -{ - - - /// - /// Abstract Class for Designer Visitor - /// - /// - /// created by - Forstmeier Peter - /// created on - 02.12.2004 16:53:00 - /// - public class AbstractVisitor : object, SharpReport.Designer.IDesignerVisitor { - private readonly string nodesQuery = "controls/control"; - private string fileName; - private XmlFormReader xmlFormReader; - - public AbstractVisitor() { - } - - public AbstractVisitor(string fileName){ - this.fileName = fileName; - xmlFormReader = new XmlFormReader() ; - } - - - - /// - /// All classes how use this baseclass have to override this method - /// - /// - /// Interface method from IDesignerVisitor - /// - /// - public virtual void Visit(SharpReport.Designer.BaseDesignerControl designer) { - - } - - - - #region Properties - protected string FileName { - get { - return fileName; - } - } - - protected XmlFormReader XmlFormReader { - get { - return xmlFormReader; - } - } - - protected string NodesQuery { - get { - return nodesQuery; - } - } - - #endregion - - } -} diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs index 05d19a65e7..c947451fd7 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs @@ -28,9 +28,9 @@ using SharpReport.ReportItems; namespace SharpReport.Visitors { - public class LoadReportVisitor : SharpReport.Visitors.AbstractVisitor { - - SharpReport.Designer.BaseDesignerControl designer; + + public class LoadReportVisitor : SharpReportCore.AbstractModelVisitor { + SharpReport.Designer.BaseDesignerControl baseDesigner; IDesignableFactory designableFactory ; public LoadReportVisitor(string fileName):base(fileName) { @@ -41,16 +41,19 @@ namespace SharpReport.Visitors { /// Loads ReportDefinition from File and set the values in the SharpReportDesigner /// /// SharpReportDesigner - - public override void Visit(SharpReport.Designer.BaseDesignerControl designer){ + public override void Visit(System.Windows.Forms.Control designer){ if (designer == null) { throw new ArgumentNullException("designer"); } + this.baseDesigner = designer as SharpReport.Designer.BaseDesignerControl; + + if (this.baseDesigner == null) { + throw new ArgumentException("designer"); + } XmlDocument xmlDoc; try { xmlDoc = XmlHelper.OpenSharpReport (base.FileName); - this.designer = designer; SetDesigner (xmlDoc); AdjustSectionsWidth(); } catch (Exception ) { @@ -60,41 +63,36 @@ namespace SharpReport.Visitors { } private void AdjustSectionsWidth() { - foreach (ReportSection section in designer.SectionsCollection) { - section.VisualControl.Width = designer.ReportModel.ReportSettings.PageSettings.Bounds.Width; + foreach (ReportSection section in baseDesigner.SectionsCollection) { + section.VisualControl.Width = baseDesigner.ReportModel.ReportSettings.PageSettings.Bounds.Width; if (section.SectionMargin == 0) { - section.SectionMargin = designer.ReportModel.ReportSettings.PageSettings.Bounds.Left; + section.SectionMargin = baseDesigner.ReportModel.ReportSettings.PageSettings.Bounds.Left; } } } - private void SetDesigner (XmlDocument doc){ - this.designer.ReportModel.ReportSettings.SetSettings ((XmlElement)doc.DocumentElement.FirstChild); + this.baseDesigner.ReportModel.ReportSettings.SetSettings ((XmlElement)doc.DocumentElement.FirstChild); SetSections (doc); } private void SetSections (XmlDocument doc) { - + XmlNodeList sectionNodes = doc.DocumentElement.ChildNodes; //Start with node(1) - XmlNode node; - BaseSection baseSection = null; + for (int i = 1;i < sectionNodes.Count ; i++ ) { - node = sectionNodes[i]; + XmlNode node = sectionNodes[i]; XmlElement sectionElem = node as XmlElement; if (sectionElem != null) { - baseSection = (BaseSection)designer.ReportModel.SectionCollection.Find(sectionElem.GetAttribute("name")); - if (baseSection != null) { - XmlHelper.SetSectionValues (base.XmlFormReader,sectionElem,baseSection); - XmlNodeList ctrlList = sectionElem.SelectNodes (base.NodesQuery); - SetReportItems(baseSection,null,ctrlList); - } else { - throw new MissingSectionException(); - } + BaseSection baseSection = (BaseSection)baseDesigner.ReportModel.SectionCollection.Find(sectionElem.GetAttribute("name")); + + XmlNodeList ctrlList = base.MakeSection(sectionElem,baseSection); + SetReportItems(baseSection,null,ctrlList); + } else { throw new MissingSectionException(); } @@ -106,7 +104,6 @@ namespace SharpReport.Visitors { IContainerItem parentContainer,XmlNodeList ctrlList) { BaseReportItem baseReportItem; - //BaseReportItem parentItem; foreach (XmlNode ctrlNode in ctrlList) { XmlElement ctrlElem = ctrlNode as XmlElement; if (ctrlElem != null) { @@ -114,28 +111,12 @@ namespace SharpReport.Visitors { try { itemRenderer = designableFactory.Create(ctrlElem.GetAttribute("type")); - baseReportItem = (BaseReportItem)itemRenderer; - - baseReportItem.SuspendLayout(); - XmlHelper.SetReportItemValues (base.XmlFormReader,ctrlElem,baseReportItem); - - if (parentContainer == null) { - baseReportItem.Parent = baseSection; - baseSection.Items.Add (baseReportItem); - } else { - baseReportItem.Parent = parentContainer; - parentContainer.Items.Add(baseReportItem); - - } - baseReportItem.ResumeLayout(); + baseReportItem = base.MakeItem(ctrlElem,parentContainer,baseSection,itemRenderer); IContainerItem iContainer = baseReportItem as IContainerItem; if (iContainer != null) { XmlNodeList newList = ctrlNode.SelectNodes (base.NodesQuery); if (newList.Count > 0) { - System.Console.WriteLine("\tLoadReportVisitor recursive call for <{0}> with {1} elements", - baseReportItem.Name, - newList.Count); SetReportItems (baseSection,iContainer,newList); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs index fc964f4ee8..f1a2469d10 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/SaveReportVisitor.cs @@ -20,17 +20,22 @@ namespace SharpReport.Visitors{ /// Description of SaveReportVisitor. /// - public class SaveReportVisitor : AbstractVisitor + public class SaveReportVisitor :SharpReportCore.AbstractModelVisitor { private XmlDocument xmlDoc; + private SharpReport.Designer.BaseDesignerControl baseDesigner; - public SaveReportVisitor ():base() { + public SaveReportVisitor ():base(String.Empty) { } - - public override void Visit (SharpReport.Designer.BaseDesignerControl designer) { - xmlDoc = this.BuildReportDocument(designer); + public override void Visit (Control designer) { + this.baseDesigner = designer as SharpReport.Designer.BaseDesignerControl; + + if (this.baseDesigner == null) { + throw new ArgumentException("designer"); + } + xmlDoc = this.BuildReportDocument(baseDesigner); } private XmlDocument BuildReportDocument (SharpReport.Designer.BaseDesignerControl designer) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs index c38f2a0983..c05ff37e96 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs @@ -68,6 +68,7 @@ namespace SharpReportCore { string toPrint = CheckForNullValue(); base.Text = base.FireFormatOutput(toPrint,this.FormatString,""); +// System.Console.WriteLine("\tBaseDataItem <{0}> / <{1}>",this.Name,this.Text); base.Render (rpea); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs index 91e9570ebc..df56b1972a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs @@ -35,14 +35,15 @@ namespace SharpReportCore{ public RowItem(string tableName){ this.tableName = tableName; - this.Items.Added += OnAdded; +// this.Items.Added += OnAdded; } + /* 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 @@ -58,8 +59,8 @@ namespace SharpReportCore{ if (rpea == null) { throw new ArgumentNullException("rpea"); } - System.Console.WriteLine(""); - System.Console.WriteLine("--Start of {0}",this.ToString()); +// System.Console.WriteLine(""); +// System.Console.WriteLine("--Start of {0}",this.ToString()); base.Render(rpea); RectangleF rect = PrepareRectangle (rpea); @@ -83,8 +84,8 @@ namespace SharpReportCore{ childItem.Render (rpea); childItem.Location = new Point(loc.X,loc.Y); } - System.Console.WriteLine("--End of RowItem"); - System.Console.WriteLine(""); +// System.Console.WriteLine("--End of RowItem"); +// System.Console.WriteLine(""); base.NotiyfyAfterPrint (rpea.LocationAfterDraw); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs index ec1b56a655..44e112865d 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs @@ -35,8 +35,8 @@ namespace SharpReportCore { GroupSeperator groupSeperator; public event EventHandler ListChanged; - public event EventHandler GroupChanged; - public event EventHandler GroupChanging; +// public event EventHandler GroupChanged; +// public event EventHandler GroupChanging; /// /// use this Constructor for PullDataReports @@ -62,7 +62,7 @@ namespace SharpReportCore { this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, reportSettings); this.dataViewStrategy.ListChanged += new EventHandler (NotifyListChanged); - this.dataViewStrategy.GroupChanged += new EventHandler (OnGroupChange); +// this.dataViewStrategy.GroupChanged += new EventHandler (OnGroupChange); } public DataManager(DataTable dataSource, ReportSettings reportSettings){ @@ -272,18 +272,18 @@ namespace SharpReportCore { } private void NotifyGroupChanging () { - if (this.GroupChanging!= null) { - this.GroupChanging (this,EventArgs.Empty); - } +// if (this.GroupChanging!= null) { +// this.GroupChanging (this,EventArgs.Empty); +// } } + private void NotifyGroupChanged() { if (this.IsGrouped) { - if (this.GroupChanged != null) { - this.GroupChanged (this,new GroupChangedEventArgs(this.groupSeperator)); - } +// if (this.GroupChanged != null) { +// this.GroupChanged (this,new GroupChangedEventArgs(this.groupSeperator)); +// } } - } private void OnGroupChange (object sender,GroupChangedEventArgs e) { @@ -384,7 +384,6 @@ namespace SharpReportCore { } } - // Nur zum testen public DataNavigator GetNavigator { get { @@ -393,22 +392,6 @@ namespace SharpReportCore { } - /* - public object Current { - get { - throw new NotImplementedException(); - } - } - */ -// public void Reset() { -// this.dataViewStrategy.Reset(); -// } -// -// public bool MoveNext() { -// return this.dataViewStrategy.MoveNext(); -// } - - public bool IsGrouped { get { @@ -427,6 +410,7 @@ namespace SharpReportCore { return this.dataViewStrategy.IsFiltered; } } + #region System.IDisposable interface implementation public void Dispose() { this.Dispose(true); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs index e91fc37bc5..9040308862 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs @@ -17,12 +17,16 @@ namespace SharpReportCore public class DataNavigator :IDataNavigator{ IDataViewStrategy store; - public event EventHandler ListChanged; + GroupSeperator groupSeperator; + public event EventHandler ListChanged; +// public event EventHandler GroupChanging; + public event EventHandler GroupChanged; public DataNavigator(IDataViewStrategy store){ this.store = store; this.store.ListChanged += new EventHandler (OnListChanged); + this.store.GroupChanged += new EventHandler (OnGroupChange); } private void OnListChanged (object sender,System.ComponentModel.ListChangedEventArgs e) { @@ -31,10 +35,34 @@ namespace SharpReportCore } } +// private void NotifyGroupChanging () { +// if (this.GroupChanging!= null) { +// this.GroupChanging (this,EventArgs.Empty); +// } +// } + + private void NotifyGroupChanged() { + if (this.store.IsGrouped) { + if (this.GroupChanged != null) { + this.GroupChanged (this,new GroupChangedEventArgs(this.groupSeperator)); + } + } + } + + private void OnGroupChange (object sender,GroupChangedEventArgs e) { + this.groupSeperator = e.GroupSeperator; + this.NotifyGroupChanged(); + } + + #region IDataNavigator implementation + public void Fill (ReportItemCollection collection) { +// this.NotifyGroupChanging(); + this.NotifyGroupChanged(); foreach (IItemRenderer item in collection) { this.store.Fill(item); } +// this.NotifyGroupChanged(); } @@ -79,5 +107,7 @@ namespace SharpReportCore return this.store.Current; } } + + #endregion } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs index 856814305e..5a7a78bde7 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/CollectionStrategy.cs @@ -212,13 +212,15 @@ namespace SharpReportCore { public override void Bind() { base.Bind(); - if ((base.ReportSettings.GroupColumnsCollection != null) && (base.ReportSettings.GroupColumnsCollection.Count > 0)) { +// if ((base.ReportSettings.GroupColumnsCollection != null) && (base.ReportSettings.GroupColumnsCollection.Count > 0)) { + if (base.ReportSettings.GroupColumnsCollection.Count > 0) { this.Group (); Reset(); return; } if (base.ReportSettings.SortColumnCollection != null) { +// if (base.ReportSettings.SortColumnCollection.Count > 0) { this.Sort (); } Reset(); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs index 4f3b73b905..d835372ec2 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/ListStrategy/TableStrategy.cs @@ -92,8 +92,6 @@ namespace SharpReportCore { #region Grouping - - private void BuildGroup(){ try { SharpIndexCollection groupedArray = new SharpIndexCollection(); @@ -168,15 +166,14 @@ namespace SharpReportCore { public override void Bind() { base.Bind(); - if ((base.ReportSettings.GroupColumnsCollection != null) && (base.ReportSettings.GroupColumnsCollection.Count > 0)) { + if (base.ReportSettings.GroupColumnsCollection.Count > 0) { this.Group (); Reset(); return; } - if (base.ReportSettings.SortColumnCollection != null) { this.Sort (); - } + Reset(); } @@ -208,7 +205,7 @@ namespace SharpReportCore { try { base.Fill(item); if (this.Current == null) { - System.Console.WriteLine("ow is null"); + System.Console.WriteLine("row is null"); } if (this.row != null) { BaseDataItem baseDataItem = item as BaseDataItem; @@ -239,6 +236,7 @@ namespace SharpReportCore { public override int Count { get { return this.IndexList.Count; +// return this.view.Count; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs index a777109540..173608ddcb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractDataRenderer.cs @@ -39,7 +39,6 @@ namespace SharpReportCore{ protected override int RenderSection(BaseSection section, ReportPageEventArgs rpea){ - bool hasContainer = false; IContainerItem container = null; foreach (BaseReportItem item in section.Items) { @@ -54,7 +53,7 @@ namespace SharpReportCore{ } else { return base.RenderSection(section, rpea); } - + } private int DoContainerControl (BaseSection section, @@ -64,7 +63,6 @@ namespace SharpReportCore{ if (container == null) { return section.Size.Height; } - this.DataNavigator.Fill(container.Items); Point drawPoint = new Point(0,0); if (section.Visible){ @@ -81,10 +79,8 @@ namespace SharpReportCore{ } if ((section.CanGrow == false)&& (section.CanShrink == false)) { - return section.Size.Height; - - } - + return section.Size.Height; + } return drawPoint.Y; } return drawPoint.Y; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs index b38f6bf3c2..fbdfd83c11 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs @@ -219,6 +219,7 @@ namespace SharpReportCore { protected void DrawSingleItem (ReportPageEventArgs rpea,BaseReportItem item){ item.SuspendLayout(); +// System.Console.WriteLine("\tDrawSingleItem {0}",item.Name); item.FormatOutput -= new EventHandler (FormatBaseReportItem); item.FormatOutput += new EventHandler (FormatBaseReportItem); item.Render(rpea); @@ -227,10 +228,11 @@ namespace SharpReportCore { // Called by FormatOutPutEvent of the BaseReportItem void FormatBaseReportItem (object sender, FormatOutputEventArgs rpea) { -// System.Console.WriteLine("FormatBaseReportItem"); BaseDataItem baseDataItem = sender as BaseDataItem; + if (baseDataItem != null) { if (!String.IsNullOrEmpty(baseDataItem.FormatString)) { + rpea.FormatedValue = defaultFormatter.FormatItem (baseDataItem); // System.Console.WriteLine("\tFormated Value = {0}",rpea.FormatedValue); } else { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs index c7bb557bbe..0cb81848c0 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs @@ -47,8 +47,8 @@ namespace SharpReportCore { public RenderDataReport(ReportModel model,DataManager dataManager):base (model,dataManager){ - base.DataManager.GroupChanged += new EventHandler(OnGroupChanged); - base.DataManager.GroupChanging += new EventHandler (OnGroupChanging); +// base.DataManager.GroupChanged += new EventHandler(OnGroupChanged); +// base.DataManager.GroupChanging += new EventHandler (OnGroupChanging); } @@ -70,13 +70,13 @@ namespace SharpReportCore { private void OnSectionPrinting (object sender,SectionPrintingEventArgs e) { - System.Console.WriteLine(""); - System.Console.WriteLine("Begin Print <{0}> with <{1}> Items ",e.Section.Name, - e.Section.Items.Count); +// System.Console.WriteLine(""); +// System.Console.WriteLine("Begin Print <{0}> with <{1}> Items ",e.Section.Name, +// e.Section.Items.Count); } private void OnSectionPrinted (object sender,SectionPrintingEventArgs e) { - System.Console.WriteLine("Section Printed <{0}> ",e.Section.Name); +// System.Console.WriteLine("Section Printed <{0}> ",e.Section.Name); } @@ -121,7 +121,7 @@ namespace SharpReportCore { private void DoPageEnd (ReportPageEventArgs rpea){ - System.Console.WriteLine("\tDoPageEnd"); +// System.Console.WriteLine("\tDoPageEnd"); base.PrintPageEnd(this,rpea); base.MeasurePageEnd (rpea); @@ -156,7 +156,7 @@ namespace SharpReportCore { } protected override void BeginPrintPage(object sender, ReportPageEventArgs rpea) { - System.Console.WriteLine("!!! Beginprintpage"); +// System.Console.WriteLine("!!! BeginPrintpage"); if (rpea == null) { throw new ArgumentNullException("rpea"); } @@ -206,7 +206,6 @@ namespace SharpReportCore { while (this.dataNavigator.MoveNext()) { this.dataNavigator.Fill (base.CurrentSection.Items); base.RenderSection (section,rpea); - section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap; base.FitSectionToItems (base.CurrentSection,rpea); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs index 57803b103c..576a7e09a8 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs @@ -32,10 +32,8 @@ namespace SharpReportCore { using System; using System.Drawing; using SharpReportCore; - - - public class ReportModel : object,SharpReportCore.IModel,IDisposable{ - + + public class ReportModel : object,SharpReportCore.IVisitor,IDisposable{ ReportSettings reportSettings; ReportSectionCollection sectionCollection; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs index b8eb8ce1b0..88155fd8a9 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs @@ -505,7 +505,7 @@ namespace SharpReportCore { try { ReportModel model = new ReportModel(); - SharpReportCore.LoadModelVisitor modelVisitor = new SharpReportCore.LoadModelVisitor(model,fileName); + SharpReportCore.LoadModelVisitor modelVisitor = new SharpReportCore.LoadModelVisitor(model,fileName); model.Accept (modelVisitor); return model; } catch (Exception) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs index 05dbb0733e..4573089fec 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/AbstractModelVisitor.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ using System; - +using System.Xml; /// /// Base Class for ModelVisitor /// @@ -18,18 +18,79 @@ using System; /// namespace SharpReportCore { public class AbstractModelVisitor : object, SharpReportCore.IModelVisitor { + private readonly string nodesQuery = "controls/control"; + private SharpReportCore.XmlFormReader xmlFormReader; + private string fileName; +// private GenericFactory genericFactory; /// /// Default constructor - initializes all fields to default values /// - public AbstractModelVisitor() { + + + public AbstractModelVisitor(string fileName){ + this.fileName = fileName; + xmlFormReader = new XmlFormReader() ; + } + + protected XmlNodeList MakeSection (XmlElement sectionElem,BaseSection baseSection) { + if (baseSection == null) { + throw new MissingSectionException(); + } + baseSection.SuspendLayout(); + XmlHelper.SetSectionValues (xmlFormReader,sectionElem,baseSection); + baseSection.ResumeLayout(); + return BuildControlList(sectionElem); + } + + + protected BaseReportItem MakeItem (XmlElement elem,IContainerItem parent, + BaseSection section,IItemRenderer itemRenderer) { + + BaseReportItem item = (BaseReportItem)itemRenderer; + item.SuspendLayout(); + XmlHelper.SetReportItemValues (xmlFormReader,elem,item); + if (parent == null) { + item.Parent = section; + section.Items.Add (item); + } else { + item.Parent = parent; + parent.Items.Add(item); + } + item.ResumeLayout(); + return item; } + protected XmlNodeList BuildControlList(XmlElement section) { + return section.SelectNodes (this.nodesQuery); + } + + protected string NodesQuery { + get { + return nodesQuery; + } + } + + protected XmlFormReader XmlFormReader { + get { + return xmlFormReader; + } + } + protected string FileName { + get { + return fileName; + } + } + + #region SharpReport.DelegatesInterfaces.IModelVisitor interface implementation public virtual void Visit(SharpReportCore.ReportModel reportModel) { - + throw new NotImplementedException(); + } + public virtual void Visit (System.Windows.Forms.Control designer){ + throw new NotImplementedException(); } #endregion diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs index bab00013b7..00c3a27919 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/IVisitor.cs @@ -11,13 +11,24 @@ using System; namespace SharpReportCore{ - - public interface IModel{ - void Accept(IModelVisitor visitor); - } + + /// + /// Used by + /// + + public interface IVisitor{ + void Accept(SharpReportCore.IModelVisitor visitor); + } public interface IModelVisitor{ + /// + /// Use this function to Visit from ReportEngine + /// void Visit (SharpReportCore.ReportModel reportModel); + /// + /// This function is used by the Designer + /// + void Visit (System.Windows.Forms.Control designer); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs index 7aea187159..6f01209afb 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Visitors/LoadModelVisitor.cs @@ -25,13 +25,11 @@ using SharpReportCore; namespace SharpReportCore { public class LoadModelVisitor : SharpReportCore.AbstractModelVisitor { - private string fileName; private ReportModel model; - SharpReportCore.XmlFormReader xmlFormReader; BaseItemFactory baseItemFactory; - public LoadModelVisitor(ReportModel reportModel,string fileName){ - this.fileName = fileName; + public LoadModelVisitor(ReportModel reportModel, + string fileName):base(fileName){ this.model = reportModel; baseItemFactory = new BaseItemFactory(); } @@ -40,12 +38,11 @@ namespace SharpReportCore { #region overrides public override void Visit(ReportModel reportModel) { if (reportModel == null) { - throw new MissingModelException(); + throw new ArgumentNullException("reportModel"); } else { XmlDocument xmlDoc; try { - xmlDoc = XmlHelper.OpenSharpReport (fileName); - xmlFormReader = new XmlFormReader(); + xmlDoc = XmlHelper.OpenSharpReport (base.FileName); reportModel.ReportSettings.SetSettings ((XmlElement)xmlDoc.DocumentElement.FirstChild); SetSections (xmlDoc); } catch (Exception ) { @@ -60,48 +57,51 @@ namespace SharpReportCore { void SetSections (XmlDocument doc) { XmlNodeList sectionNodes = doc.DocumentElement.ChildNodes; //Start with node(1) - XmlNode node; - BaseSection baseSection; + for (int i = 1;i < sectionNodes.Count ; i++ ) { - node = sectionNodes[i]; + XmlNode node = sectionNodes[i]; if (node is XmlElement) { XmlElement sectionElem = (XmlElement)node; - baseSection = (BaseSection)model.SectionCollection.Find(sectionElem.GetAttribute("name")); - baseSection.SuspendLayout(); - if (baseSection != null) { - XmlHelper.SetSectionValues (xmlFormReader,sectionElem,baseSection); - XmlNodeList ctrlList = sectionElem.SelectNodes ("controls/control"); - if (ctrlList.Count > 0) { - foreach (XmlNode ctrlNode in ctrlList) { - if (ctrlNode is XmlElement) { - XmlElement ctrlElem = (XmlElement)ctrlNode; - BaseReportItem rpt = null; - try { - //Read the Element - rpt = (BaseReportItem)baseItemFactory.Create(ctrlElem.GetAttribute("basetype")); - if (rpt != null) { -// rpt.SuspendLayout(); - rpt.Parent = baseSection; - baseSection.Items.Add (rpt); - XmlHelper.SetReportItemValues (xmlFormReader,ctrlElem,rpt); - rpt.Visible = true; - rpt.ResumeLayout(); - } else { - String str = String.Format("< {0}>",ctrlElem.GetAttribute("basetype")); - throw new UnkownItemException(str); - } - } catch (Exception ) { - throw; - } - } + + BaseSection baseSection = (BaseSection)model.SectionCollection.Find(sectionElem.GetAttribute("name")); + + XmlNodeList ctrlList = base.MakeSection(sectionElem,baseSection); + SetReportItems(baseSection,null,ctrlList); + + }else { + throw new System.Xml.XmlException ("Report : SetSection Wrong Node in Report"); + } + } + } + + + void SetReportItems(BaseSection baseSection, + IContainerItem parentContainer,XmlNodeList ctrlList) { + + BaseReportItem baseReportItem; + + foreach (XmlNode ctrlNode in ctrlList) { + XmlElement ctrlElem = ctrlNode as XmlElement; + if (ctrlElem != null) { + IItemRenderer itemRenderer = null; + try { + itemRenderer = baseItemFactory.Create(ctrlElem.GetAttribute("basetype")); + baseReportItem = base.MakeItem (ctrlElem,parentContainer,baseSection,itemRenderer); + + IContainerItem iContainer = baseReportItem as IContainerItem; + + if (iContainer != null) { + XmlNodeList newList = ctrlNode.SelectNodes (base.NodesQuery); + if (newList.Count > 0) { + SetReportItems (baseSection,iContainer,newList); } } - }else { - throw new MissingSectionException(); + + } + catch (Exception ) { + throw new UnkownItemException(); } - }else { - throw new System.Xml.XmlException ("Report : SetSection Wrong Node in Report"); } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs b/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs index d066066585..bf5255f6e4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/GeneratorCommands.cs @@ -84,7 +84,7 @@ namespace ReportGenerator{ } } - + /* public class WriteXsdComplete : AbstractMenuCommand { public override void Run() { ResultPanel resultPanel = base.Owner as ResultPanel; @@ -104,5 +104,25 @@ namespace ReportGenerator{ } } + */ + } + public class WriteXsdComplete : AbstractMenuCommand { + public override void Run() { + ResultPanel resultPanel = base.Owner as ResultPanel; + if (resultPanel != null) { + resultPanel.SaveXsdFile (false); + } + + } + } + + public class WriteXsdSchema : AbstractMenuCommand { + public override void Run() { + ResultPanel resultPanel = base.Owner as ResultPanel; + if (resultPanel != null) { + resultPanel.SaveXsdFile (true); + } + + } } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj b/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj index a0d9f863b2..56d09e82c7 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj +++ b/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj @@ -202,6 +202,7 @@ Configuration\GlobalAssemblyInfo.cs + - \ No newline at end of file + diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd index d5a46e6027..42ae8f499a 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd @@ -127,7 +127,7 @@ - +