From 941c45808b0eb2498e27f7803d57c5ee824439ba Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 30 Jul 2006 09:30:16 +0000 Subject: [PATCH] Make Consolas the default font on Vista. Allow runtime pad creation. Ad SharpDevelopInteraction example to SdaUser. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1628 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- doc/ChangeLog.xml | 65 +++++++++++++++++ samples/SdaUser/MainForm.Designer.cs | 24 +++++-- samples/SdaUser/MainForm.cs | 29 ++++++-- samples/SdaUser/SdaUser.csproj | 5 ++ samples/SdaUser/SdaUser.sln | 6 ++ .../SharpDevelopInteraction/AssemblyInfo.cs | 31 ++++++++ .../InteractionClass.cs | 37 ++++++++++ .../SharpDevelopInteraction.csproj | 59 +++++++++++++++ .../SharpDevelopInteraction.sln | 6 ++ .../Project/Src/Nodes/DigitsNode.cs | 2 +- .../Project/Src/Nodes/EnvironmentNode.cs | 2 +- .../Project/Src/Nodes/KeywordListNode.cs | 2 +- .../Project/Src/Nodes/MarkerNode.cs | 2 +- .../HistoryViewDisplayBinding/DiffPanel.cs | 2 +- .../HistoryViewDisplayBinding/InfoPanel.cs | 2 +- .../Gui/Components/ExtTreeView/ExtTreeNode.cs | 6 +- .../Src/Gui/Components/FontSelectionPanel.cs | 2 +- .../IDEOptions/EditStandardHeaderPanel.cs | 2 +- .../OptionPanels/OutputWindowOptionsPanel.cs | 2 +- src/Main/Base/Project/Src/Gui/IWorkbench.cs | 9 ++- .../Base/Project/Src/Gui/IWorkbenchLayout.cs | 9 ++- .../CompilerMessageView.cs | 4 +- .../Src/Gui/Workbench/DefaultWorkbench.cs | 13 ++++ .../Workbench/Layouts/SdiWorkspaceLayout.cs | 9 +++ .../Src/Internal/Doozers/PadDescriptor.cs | 72 +++++++++++++++---- .../SharpDevelopTextEditorProperties.cs | 2 +- .../Gui/OptionPanels/CodeTemplatePanel.cs | 2 +- .../OptionPanels/GeneralTextEditorPanel.cs | 4 +- .../ResourceService/ResourceService.cs | 25 +++++-- .../StartUp/Project/SharpDevelop.exe.manifest | 11 +++ src/Main/StartUp/Project/SharpDevelopMain.cs | 2 +- 31 files changed, 396 insertions(+), 52 deletions(-) create mode 100644 samples/SdaUser/SharpDevelopInteraction/AssemblyInfo.cs create mode 100644 samples/SdaUser/SharpDevelopInteraction/InteractionClass.cs create mode 100644 samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.csproj create mode 100644 samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.sln diff --git a/doc/ChangeLog.xml b/doc/ChangeLog.xml index bbae9b000b..644376eae0 100644 --- a/doc/ChangeLog.xml +++ b/doc/ChangeLog.xml @@ -1,4 +1,69 @@  + Add ICSharpCode.SharpDevelop.Sda and SdaUser example application. + Samples for IList as DataSource, EventLogger is a Report that shows dynamic use of images in a Report,ContributersList shows a couple of Contributers + Iamges can be set/changed at runtime + More fixes from FxCop + Work on Collections as DataSource. Fixed some stuff from FxCop + work in progress - added more detail around connection, metadata and object view management + Remove unnecessary usage of Assembly.GetEntryAssembly + Fixed a problem with Fonts, make some changes from FxCop + Update SharpReport Examples + Implemented enum completion after "return". + Fixed SD2-920: Refactoring menu options for enums contains invalid options + When creating a property in VB, rename the field if it would conflict with the property name (fixes SD2-947) + Fixed some translation issues. + SD2-945: Typing a declaration of two or more variables in the same line (VB) throws exception + Move files to match new namespace structure. + Improved NRefactory public API (moving classes to other namespaces etc.) + Fixed Unbound printing for FormSheet Reports + Fixed SD2-891: Content of VB 'With' statement not converted correctly to C# +Fixed SD2-894: Abstract properties declaration not converted correctly from VB to C# +Fixed SD2-895: VB 'Not' operator is not converted correctly to C# +Fixed SD2-901: VB 'Continue' statement not converted correctly from C# +Fixed SD2-902: C# 'break' statement not converted correctly to VB + Move samples to SharpDevelop2.1 + Fixed SD2-930: VB exponential operator not converted to C# +Fixed SD2-879: Folding breaks with consecutive operators in VB code +Fixed SD2-906: Folding breaks on VB property declaration +Fixed SD2-921: Definitions in one line converted incorrectly from VB to C# +Fixed SD2-903: 'Using' statement not converted correctly from VB to C# +Fixed SD2-890: 'uint' type converted incorrectly from C# to VB +Fixed SD2-907: static method level variables are not translated from VB to C# + uploaded a new version of my Help 2.0 register tool including its source + Merged missing SharpReport resources from Corsavy. +Fixed some bugs in code analysis-AddIn. + added addin file + Add "Suppress message" command to FxCop warnings on the error list + Added SharpDbTools project to the SharpDevelop.sln + Fixed some FxCop warnings in NRefactory. + Fixed SD2-922: RegEx window not restoring its size after been maximized + Added Debugger.BooInterpreter + Fixed SD2-937 + Fixed SD2-939 + possible workaround to SD2-941. +i couldn't reproduce the problem illustrated in SD2-941, but instead this addresses the crash when BooBinding tries to reference FormsDesigner if the FormsDesigner.addin file does not exist. + Fixed the following build errors for the SharpDevelop.Tests solution: +Main\Base\Test\Services_Navigation\NavigationServiceTestFixture.cs(115,52) +: error CS1026: ) expected +Main\Base\Test\Services_Navigation\NavigationServiceTestFixture.cs(128,55) +: error CS0117: 'ICSharpCode.Core.NavigationService' does not contain a definition for 'GetListOfPoints' + + + Allow AddIns to customize the MSBuild logger. + Implemented SD2-572: Enum autocomplete + Implemented SD2-446: Support skipping method bodies in VB Lexer. + NRefactory now preserves blank lines. + Work around MSBuild CopyToOutputDirectory bug. +Fixed NRefactory unit tests. + New feature: move class to file + ObjectValue split into ObjectValue and ObjectValueClass; +Variable submenus implemented in Debugger.Core + NRefactory: use Location structure instead of System.Drawing.Point for source positions. + Boo.InterpreterAddIn now can host multiple interpreters + Some FxCop suggestions to NRefactory. + Update to log4net 1.2.10. + Fixed suggestions by FxCop for NavigationService; + Merged Corsavy r1517:1567 to trunk. Search and Replace dialog buttons disabled if no find pattern entered. Search/replace keyboard shortcuts now switch between the search/replace tabs when the search and replace dialog has the focus. SD2-918. Unit tests window - Run tests right click menu option available when no tests are loaded. Added keyboard shortcut to open Code Coverage window. Added text editor right click and edit menu options to show/hide code coverage. diff --git a/samples/SdaUser/MainForm.Designer.cs b/samples/SdaUser/MainForm.Designer.cs index b37dec8fc7..8ff9820213 100644 --- a/samples/SdaUser/MainForm.Designer.cs +++ b/samples/SdaUser/MainForm.Designer.cs @@ -36,6 +36,7 @@ namespace SdaUser { this.runButton = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.makeTransparentButton = new System.Windows.Forms.Button(); this.closeButton = new System.Windows.Forms.Button(); this.visibleCheckBox = new System.Windows.Forms.CheckBox(); this.unloadHostDomainButton = new System.Windows.Forms.Button(); @@ -55,19 +56,29 @@ namespace SdaUser // // groupBox1 // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.makeTransparentButton); this.groupBox1.Controls.Add(this.closeButton); this.groupBox1.Controls.Add(this.visibleCheckBox); this.groupBox1.Enabled = false; - this.groupBox1.Location = new System.Drawing.Point(12, 130); + this.groupBox1.Location = new System.Drawing.Point(12, 123); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(268, 92); + this.groupBox1.Size = new System.Drawing.Size(268, 82); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "groupBox1"; // + // makeTransparentButton + // + this.makeTransparentButton.Location = new System.Drawing.Point(135, 50); + this.makeTransparentButton.Name = "makeTransparentButton"; + this.makeTransparentButton.Size = new System.Drawing.Size(112, 23); + this.makeTransparentButton.TabIndex = 2; + this.makeTransparentButton.Text = "Make Transparent"; + this.makeTransparentButton.UseVisualStyleBackColor = true; + this.makeTransparentButton.Click += new System.EventHandler(this.MakeTransparentButtonClick); + // // closeButton // this.closeButton.Location = new System.Drawing.Point(6, 50); @@ -103,7 +114,7 @@ namespace SdaUser // // openFileButton // - this.openFileButton.Location = new System.Drawing.Point(18, 243); + this.openFileButton.Location = new System.Drawing.Point(18, 223); this.openFileButton.Name = "openFileButton"; this.openFileButton.Size = new System.Drawing.Size(75, 23); this.openFileButton.TabIndex = 3; @@ -115,7 +126,7 @@ namespace SdaUser // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(292, 334); + this.ClientSize = new System.Drawing.Size(292, 255); this.Controls.Add(this.openFileButton); this.Controls.Add(this.unloadHostDomainButton); this.Controls.Add(this.groupBox1); @@ -126,6 +137,7 @@ namespace SdaUser this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); } + private System.Windows.Forms.Button makeTransparentButton; private System.Windows.Forms.Button openFileButton; private System.Windows.Forms.Button unloadHostDomainButton; private System.Windows.Forms.Button closeButton; diff --git a/samples/SdaUser/MainForm.cs b/samples/SdaUser/MainForm.cs index 0be2e8b061..dbf4eeeb42 100644 --- a/samples/SdaUser/MainForm.cs +++ b/samples/SdaUser/MainForm.cs @@ -31,10 +31,6 @@ namespace SdaUser // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); - - // - // TODO: Add constructor code after the InitializeComponent() call. - // } void RunButtonClick(object sender, EventArgs e) @@ -109,6 +105,7 @@ namespace SdaUser using (OpenFileDialog dlg = new OpenFileDialog()) { if (dlg.ShowDialog() == DialogResult.OK) { if (runButton.Enabled) { + // create host with InitialFile set runButton.Enabled = false; unloadHostDomainButton.Enabled = true; @@ -116,10 +113,32 @@ namespace SdaUser wbSettings.InitialFileList.Add(dlg.FileName); RunWorkbench(wbSettings); } else if (host != null) { - host.OpenDocument(dlg.FileName); + if (host.IsSolutionOrProject(dlg.FileName)) { + // won't occur because no project types are defined + // in our reduces .addin file. + host.OpenProject(dlg.FileName); + } else { + host.OpenDocument(dlg.FileName); + } } } } } + + /// + /// This demonstrates how to access SharpDevelop's internals from the host application. + /// + void MakeTransparentButtonClick(object sender, System.EventArgs e) + { + // We need to use a wrapper class to cross the AppDomain barrier. + // The assembly containing the wrapper class will be loaded to both AppDomains. + // Therefore we don't use our possibly large main application, but a special + // assembly just for the interaction. + + SharpDevelopInteraction.InteractionClass obj; + obj = host.CreateInstanceInTargetDomain(); + + obj.MakeTransparent(); + } } } diff --git a/samples/SdaUser/SdaUser.csproj b/samples/SdaUser/SdaUser.csproj index 579a56ea93..d49686c1f3 100644 --- a/samples/SdaUser/SdaUser.csproj +++ b/samples/SdaUser/SdaUser.csproj @@ -62,6 +62,11 @@ Always + + {84054D5E-0B81-4C4B-AABB-DCC43030830B} + SharpDevelopInteraction + False + \ No newline at end of file diff --git a/samples/SdaUser/SdaUser.sln b/samples/SdaUser/SdaUser.sln index f62f0f2516..1f2d8c5a7c 100644 --- a/samples/SdaUser/SdaUser.sln +++ b/samples/SdaUser/SdaUser.sln @@ -2,6 +2,8 @@ # SharpDevelop 2.1.0.1602 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SdaUser", "SdaUser.csproj", "{3FF48818-69D2-4884-8F4F-62EC72F0D5F0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDevelopInteraction", "SharpDevelopInteraction\SharpDevelopInteraction.csproj", "{84054D5E-0B81-4C4B-AABB-DCC43030830B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,5 +14,9 @@ Global {3FF48818-69D2-4884-8F4F-62EC72F0D5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3FF48818-69D2-4884-8F4F-62EC72F0D5F0}.Release|Any CPU.Build.0 = Release|Any CPU {3FF48818-69D2-4884-8F4F-62EC72F0D5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84054D5E-0B81-4C4B-AABB-DCC43030830B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84054D5E-0B81-4C4B-AABB-DCC43030830B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84054D5E-0B81-4C4B-AABB-DCC43030830B}.Release|Any CPU.Build.0 = Release|Any CPU + {84054D5E-0B81-4C4B-AABB-DCC43030830B}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection EndGlobal diff --git a/samples/SdaUser/SharpDevelopInteraction/AssemblyInfo.cs b/samples/SdaUser/SharpDevelopInteraction/AssemblyInfo.cs new file mode 100644 index 0000000000..210a659f0a --- /dev/null +++ b/samples/SdaUser/SharpDevelopInteraction/AssemblyInfo.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("SharpDevelopInteraction")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SharpDevelopInteraction")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/samples/SdaUser/SharpDevelopInteraction/InteractionClass.cs b/samples/SdaUser/SharpDevelopInteraction/InteractionClass.cs new file mode 100644 index 0000000000..047c7e557f --- /dev/null +++ b/samples/SdaUser/SharpDevelopInteraction/InteractionClass.cs @@ -0,0 +1,37 @@ +/* + * Created by SharpDevelop. + * User: Daniel Grunwald + * Date: 28.07.2006 + * Time: 23:10 + */ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using ICSharpCode.SharpDevelop.Gui; + +namespace SharpDevelopInteraction +{ + /// + /// If you want to control SharpDevelop's internals from the host application, + /// you need to use a wrapper assembly and class like this. + /// Make sure to inherit from MarshalByRefObject and create the instance using + /// host.CreateInstanceInTargetDomain<T> in the host application. + /// + /// The class itself will be responsible to use WorkbenchSingleton.SafeThread(Async)Call + /// for all operations if SharpDevelop is running on its own thread. + /// + public class InteractionClass : MarshalByRefObject + { + public void MakeTransparent() + { + WorkbenchSingleton.SafeThreadAsyncCall(new MethodInvoker(MakeTransparentInternal)); + } + + void MakeTransparentInternal() + { + WorkbenchSingleton.MainForm.Opacity *= 0.85; + if (WorkbenchSingleton.MainForm.Opacity < 0.2) + WorkbenchSingleton.MainForm.Opacity = 1; + } + } +} diff --git a/samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.csproj b/samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.csproj new file mode 100644 index 0000000000..61770806c2 --- /dev/null +++ b/samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.csproj @@ -0,0 +1,59 @@ + + + Library + SharpDevelopInteraction + SharpDevelopInteraction + Debug + AnyCPU + {84054D5E-0B81-4C4B-AABB-DCC43030830B} + False + False + False + Auto + 4194304 + AnyCPU + 4096 + 4 + false + + + obj\ + obj\Debug\ + ..\..\..\bin\ + False + DEBUG;TRACE + true + Full + True + + + obj\ + obj\Release\ + bin\Release\ + True + TRACE + False + None + False + + + + + + ..\..\..\bin\ICSharpCode.Core.dll + False + False + + + ..\..\..\bin\ICSharpCode.SharpDevelop.dll + False + False + + + + + + + + + \ No newline at end of file diff --git a/samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.sln b/samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.sln new file mode 100644 index 0000000000..47b86fd3b3 --- /dev/null +++ b/samples/SdaUser/SharpDevelopInteraction/SharpDevelopInteraction.sln @@ -0,0 +1,6 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.1602 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDevelopInteraction", "SharpDevelopInteraction.csproj", "{84054D5E-0B81-4C4B-AABB-DCC43030830B}" +EndProject +Global +EndGlobal diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs index d2eeae3d96..fa406a3d80 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs @@ -82,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes DigitsNode node = (DigitsNode)parent; Properties properties = ((Properties)PropertyService.Get("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new Properties())); - sampleLabel.Font = ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString())); + sampleLabel.Font = ParseFont(properties.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString())); color = node.Color; PreviewUpdate(sampleLabel, color); } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs index ab491259ce..7bf0623d48 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs @@ -158,7 +158,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes this.UseItemStyleForSubItems = false; Properties properties = ((Properties)PropertyService.Get("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new Properties())); - basefont = ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString())); + basefont = ParseFont(properties.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString())); listfont = listFont; ColorUpdate(); diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs index 4fea82c578..7c6f93cf48 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs @@ -152,7 +152,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes } Properties properties = ((Properties)PropertyService.Get("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new Properties())); - sampleLabel.Font = ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString())); + sampleLabel.Font = ParseFont(properties.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString())); color = node.Color; nameBox.Text = node.Name; diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs index 431cb84ce0..4b8f09a818 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs @@ -133,7 +133,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes Properties properties = ((Properties)PropertyService.Get("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new Properties())); - sampleLabel.Font = ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString())); + sampleLabel.Font = ParseFont(properties.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString())); color = node.Color; nameBox.Text = node.What; diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/DiffPanel.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/DiffPanel.cs index be0f1eecec..34d0fe8496 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/DiffPanel.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/DiffPanel.cs @@ -35,7 +35,7 @@ namespace ICSharpCode.Svn Get("toRevision").SelectedIndexChanged += new EventHandler(ShowDiff); ControlDictionary["diffRichTextBox"].Enabled = false; - ControlDictionary["diffRichTextBox"].Font = ResourceService.CourierNew10; + ControlDictionary["diffRichTextBox"].Font = ResourceService.DefaultMonospacedFont; ControlDictionary["splitter1"].Height = 3; ListViewItem newItem; diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs index a104f9fe8d..267d9fd9c4 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs @@ -37,7 +37,7 @@ namespace ICSharpCode.Svn changesList = Get("changes"); revisionList.SelectedIndexChanged += RevisionListViewSelectionChanged; ControlDictionary["commentRichTextBox"].Enabled = false; - ControlDictionary["commentRichTextBox"].Font = ResourceService.CourierNew10; + ControlDictionary["commentRichTextBox"].Font = ResourceService.DefaultMonospacedFont; // Work around WinForms/XmlForms bug: ControlDictionary["splitter1"].Height = 3; diff --git a/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs b/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs index be0573509d..588345d903 100644 --- a/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs +++ b/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs @@ -333,9 +333,9 @@ namespace ICSharpCode.SharpDevelop.Gui boldFont = ResourceService.LoadFont("Tahoma", 9, FontStyle.Bold); italicFont = ResourceService.LoadFont("Tahoma", 9, FontStyle.Italic); - monospacedFont = ResourceService.LoadFont("Courier New", 10); - boldMonospacedFont = ResourceService.LoadFont("Courier New", 10, FontStyle.Bold); - italicMonospacedFont = ResourceService.LoadFont("Courier New", 10, FontStyle.Italic); + monospacedFont = ResourceService.DefaultMonospacedFont; + boldMonospacedFont = ResourceService.LoadDefaultMonospacedFont(FontStyle.Bold); + italicMonospacedFont = ResourceService.LoadDefaultMonospacedFont(FontStyle.Italic); } #endregion diff --git a/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs b/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs index 405070b5fd..fd65b320f3 100644 --- a/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs +++ b/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs @@ -106,7 +106,7 @@ namespace ICSharpCode.SharpDevelop.Gui return new Font(descr[1], Single.Parse(descr[3])); } catch (Exception ex) { LoggingService.Warn(ex); - return ResourceService.CourierNew10; + return ResourceService.DefaultMonospacedFont; } } diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/EditStandardHeaderPanel.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/EditStandardHeaderPanel.cs index 899c7445ce..832a50e155 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/EditStandardHeaderPanel.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/EditStandardHeaderPanel.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels { SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.EditStandardHeaderPanel.xfrm")); - ControlDictionary["headerTextBox"].Font = ResourceService.CourierNew10; + ControlDictionary["headerTextBox"].Font = ResourceService.DefaultMonospacedFont; foreach (StandardHeader header in StandardHeader.StandardHeaders) { ((ComboBox)ControlDictionary["headerChooser"]).Items.Add(header); } diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs index dd8e833d78..3c245481e9 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs @@ -39,7 +39,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels ControlDictionary["FontGroupBox"].Controls.Add(fontSelectionPanel); ((CheckBox)ControlDictionary["wordWrapCheckBox"]).Checked = properties.Get("WordWrap", true); - fontSelectionPanel.CurrentFontString = properties.Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString(); + fontSelectionPanel.CurrentFontString = properties.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString()).ToString(); } public override bool StorePanelContents() diff --git a/src/Main/Base/Project/Src/Gui/IWorkbench.cs b/src/Main/Base/Project/Src/Gui/IWorkbench.cs index 04e2b64196..c350aee4ba 100644 --- a/src/Main/Base/Project/Src/Gui/IWorkbench.cs +++ b/src/Main/Base/Project/Src/Gui/IWorkbench.cs @@ -65,6 +65,11 @@ namespace ICSharpCode.SharpDevelop.Gui /// void ShowPad(PadDescriptor content); + /// + /// Closes and disposes a . + /// + void UnloadPad(PadDescriptor content); + /// /// Returns a pad from a specific type. /// @@ -83,7 +88,7 @@ namespace ICSharpCode.SharpDevelop.Gui /// /// Re-initializes all components of the workbench, should be called /// when a special property is changed that affects layout stuff. - /// (like language change) + /// (like language change) /// void RedrawAllComponents(); @@ -91,7 +96,7 @@ namespace ICSharpCode.SharpDevelop.Gui /// Is called, when a workbench view was opened /// /// - /// WorkbenchSingleton.WorkbenchCreated += delegate { + /// WorkbenchSingleton.WorkbenchCreated += delegate { /// WorkbenchSingleton.Workbench.ViewOpened += ...; /// }; /// diff --git a/src/Main/Base/Project/Src/Gui/IWorkbenchLayout.cs b/src/Main/Base/Project/Src/Gui/IWorkbenchLayout.cs index a512b5c0da..a43d65f446 100644 --- a/src/Main/Base/Project/Src/Gui/IWorkbenchLayout.cs +++ b/src/Main/Base/Project/Src/Gui/IWorkbenchLayout.cs @@ -11,7 +11,7 @@ using ICSharpCode.Core; namespace ICSharpCode.SharpDevelop.Gui { /// - /// The IWorkbenchLayout object is responsible for the layout of + /// The IWorkbenchLayout object is responsible for the layout of /// the workspace, it shows the contents, chooses the IWorkbenchWindow /// implementation etc. it could be attached/detached at the runtime /// to a workbench. @@ -48,10 +48,15 @@ namespace ICSharpCode.SharpDevelop.Gui void ActivatePad(string fullyQualifiedTypeName); /// - /// Hides a new . + /// Hides a . /// void HidePad(PadDescriptor content); + /// + /// Closes and disposes a . + /// + void UnloadPad(PadDescriptor content); + /// /// returns true, if padContent is visible; /// diff --git a/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs b/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs index 46a3cd2a0f..afc1f03665 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs @@ -127,7 +127,7 @@ namespace ICSharpCode.SharpDevelop.Gui properties = (Properties)PropertyService.Get(OutputWindowOptionsPanel.OutputWindowsProperty, new Properties()); - textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString()); + textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString()).ToString()); properties.PropertyChanged += new PropertyChangedEventHandler(PropertyChanged); //textEditorControl.ActiveTextAreaControl.TextArea.DoubleClick += TextEditorControlDoubleClick; @@ -367,7 +367,7 @@ namespace ICSharpCode.SharpDevelop.Gui ToolbarService.UpdateToolbar(toolStrip); } if (e.Key == "DefaultFont") { - textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString()); + textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString()).ToString()); } } diff --git a/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs b/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs index a229addc90..a019194cce 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs @@ -314,6 +314,19 @@ namespace ICSharpCode.SharpDevelop.Gui } } + /// + /// Closes and disposes a . + /// + public void UnloadPad(PadDescriptor content) + { + PadContentCollection.Remove(content); + + if (layout != null) { + layout.UnloadPad(content); + } + content.Dispose(); + } + public void UpdateRenderer() { bool pro = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.UseProfessionalRenderer", true); diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs index 3c180cabe7..9647df8e8c 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs @@ -469,6 +469,15 @@ namespace ICSharpCode.SharpDevelop.Gui } } + public void UnloadPad(PadDescriptor padContent) + { + if (padContent != null && contentHash.ContainsKey(padContent.Class)) { + contentHash[padContent.Class].Close(); + contentHash[padContent.Class].Dispose(); + contentHash.Remove(padContent.Class); + } + } + public void ActivatePad(PadDescriptor padContent) { if (padContent != null && contentHash.ContainsKey(padContent.Class)) { diff --git a/src/Main/Base/Project/Src/Internal/Doozers/PadDescriptor.cs b/src/Main/Base/Project/Src/Internal/Doozers/PadDescriptor.cs index 0a249ecd35..9e9d2c0ae7 100644 --- a/src/Main/Base/Project/Src/Internal/Doozers/PadDescriptor.cs +++ b/src/Main/Base/Project/Src/Internal/Doozers/PadDescriptor.cs @@ -11,20 +11,54 @@ using ICSharpCode.SharpDevelop.Gui; namespace ICSharpCode.Core { /// - /// Description of PadDescriptor. + /// Describes a pad. /// public class PadDescriptor : IDisposable { - Codon codon; + string @class; + string title; + string icon; + string category; + string shortcut; + + AddIn addIn; + Type padType; + IPadContent padContent; bool padContentCreated; + /// + /// Creates a new pad descriptor from the AddIn tree. + /// + public PadDescriptor(Codon codon) + { + addIn = codon.AddIn; + shortcut = codon.Properties["shortcut"]; + category = codon.Properties["category"]; + icon = codon.Properties["icon"]; + title = codon.Properties["title"]; + @class = codon.Properties["class"]; + } + + /// + /// Creates a pad descriptor for the specified pad type. + /// + public PadDescriptor(Type padType, string title, string icon) + { + this.padType = padType; + this.@class = padType.FullName; + this.title = title; + this.icon = icon; + this.category = "none"; + this.shortcut = ""; + } + /// /// Returns the title of the pad. /// public string Title { get { - return codon.Properties["title"]; + return title; } } @@ -34,7 +68,7 @@ namespace ICSharpCode.Core /// public string Icon { get { - return codon.Properties["icon"]; + return icon; } } @@ -44,7 +78,12 @@ namespace ICSharpCode.Core /// public string Category { get { - return codon.Properties["category"]; + return category; + } + set { + if (value == null) + throw new ArgumentNullException("value"); + category = value; } } @@ -53,13 +92,21 @@ namespace ICSharpCode.Core /// public string Shortcut { get { - return codon.Properties["shortcut"]; + return shortcut; + } + set { + if (value == null) + throw new ArgumentNullException("value"); + shortcut = value; } } + /// + /// Gets the name of the pad class. + /// public string Class { get { - return codon.Properties["class"]; + return @class; } } @@ -99,7 +146,11 @@ namespace ICSharpCode.Core #endif if (!padContentCreated) { padContentCreated = true; - padContent = (IPadContent)codon.AddIn.CreateObject(Class); + if (addIn != null) { + padContent = (IPadContent)addIn.CreateObject(Class); + } else { + padContent = (IPadContent)Activator.CreateInstance(padType); + } } } @@ -112,10 +163,5 @@ namespace ICSharpCode.Core } WorkbenchSingleton.Workbench.WorkbenchLayout.ActivatePad(this); } - - public PadDescriptor(Codon codon) - { - this.codon = codon; - } } } diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs index bede4cf39c..c471c4fbb6 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor static SharpDevelopTextEditorProperties() { Properties properties2 = ((Properties)PropertyService.Get("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new Properties())); - FontContainer.DefaultFont = FontContainer.ParseFont(properties2.Get("DefaultFont", ResourceService.CourierNew10.ToString())); + FontContainer.DefaultFont = FontContainer.ParseFont(properties2.Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString())); properties2.PropertyChanged += new PropertyChangedEventHandler(CheckFontChange); } diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/CodeTemplatePanel.cs b/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/CodeTemplatePanel.cs index cbc90bb8bf..f2b73830e0 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/CodeTemplatePanel.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/CodeTemplatePanel.cs @@ -48,7 +48,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels ControlDictionary["removeGroupButton"].Click += new System.EventHandler(RemoveGroupEvent); - ((TextBox)ControlDictionary["templateTextBox"]).Font = ResourceService.CourierNew10; + ((TextBox)ControlDictionary["templateTextBox"]).Font = ResourceService.DefaultMonospacedFont; ((TextBox)ControlDictionary["templateTextBox"]).TextChanged += new EventHandler(TextChange); ((ListView)ControlDictionary["templateListView"]).Activation = ItemActivation.Standard; diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs b/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs index 4f58cf3387..4ec9db4e5c 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs @@ -99,7 +99,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels ((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex = encodingIndex; encoding = CharacterEncodings.GetEncodingByIndex(encodingIndex).CodePage; - Font currentFont = ParseFont(((Properties)CustomizationObject).Get("DefaultFont", ResourceService.CourierNew10.ToString()).ToString()); + Font currentFont = ParseFont(((Properties)CustomizationObject).Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString()).ToString()); for (int i = 6; i <= 24; ++i) { ((ComboBox)ControlDictionary["fontSizeComboBox"]).Items.Add(i); @@ -219,7 +219,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.OptionPanels return new Font(descr[1], Single.Parse(descr[3])); } catch (Exception ex) { LoggingService.Warn(ex); - return ResourceService.CourierNew10; + return ResourceService.DefaultMonospacedFont; } } } diff --git a/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs b/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs index 518afc6562..6674e0ed04 100644 --- a/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs +++ b/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs @@ -215,13 +215,28 @@ namespace ICSharpCode.Core } #region Font loading - static Font courierNew10; + static Font defaultMonospacedFont; - public static Font CourierNew10 { + public static Font DefaultMonospacedFont { get { - if (courierNew10 == null) - courierNew10 = LoadFont("Courier New", 10); - return courierNew10; + if (defaultMonospacedFont == null) { + defaultMonospacedFont = LoadDefaultMonospacedFont(FontStyle.Regular); + } + return defaultMonospacedFont; + } + } + + /// + /// Loads the default monospaced font (Consolas or Courier New). + /// + public static Font LoadDefaultMonospacedFont(FontStyle style) + { + if (Environment.OSVersion.Platform == PlatformID.Win32NT + && Environment.OSVersion.Version.Major >= 6) + { + return LoadFont("Consolas", 10, style); + } else { + return LoadFont("Courier New", 10, style); } } diff --git a/src/Main/StartUp/Project/SharpDevelop.exe.manifest b/src/Main/StartUp/Project/SharpDevelop.exe.manifest index cfc9c1fcaa..a7ca524cdb 100644 --- a/src/Main/StartUp/Project/SharpDevelop.exe.manifest +++ b/src/Main/StartUp/Project/SharpDevelop.exe.manifest @@ -14,4 +14,15 @@ /> + + + + + + + + + + + diff --git a/src/Main/StartUp/Project/SharpDevelopMain.cs b/src/Main/StartUp/Project/SharpDevelopMain.cs index f54b5e6e49..c4ecdcebf4 100644 --- a/src/Main/StartUp/Project/SharpDevelopMain.cs +++ b/src/Main/StartUp/Project/SharpDevelopMain.cs @@ -115,7 +115,7 @@ namespace ICSharpCode.SharpDevelop startup.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(exe.Location), ".."); startup.AllowUserAddIns = true; startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), - ".ICSharpCode/SharpDevelop2.1"); + "ICSharpCode/SharpDevelop2.1"); startup.AddAddInsFromDirectory(Path.Combine(startup.ApplicationRootPath, "AddIns"));