Changeset 12662 for stable/HeuristicLab.CodeEditor
- Timestamp:
- 07/07/15 18:07:59 (9 years ago)
- Location:
- stable
- Files:
-
- 4 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12473,12478,12659
- Property svn:mergeinfo changed
-
stable/HeuristicLab.CodeEditor/3.4/CodeEditor.cs
r12009 r12662 27 27 using System.Threading.Tasks; 28 28 using System.Windows.Documents; 29 using HeuristicLab.Common;30 29 using ICSharpCode.AvalonEdit; 31 30 using ICSharpCode.AvalonEdit.AddIn; … … 37 36 using ICSharpCode.AvalonEdit.Search; 38 37 using ICSharpCode.NRefactory.Editor; 39 using ICSharpCode.NRefactory.TypeSystem;40 38 using ICSharpCode.SharpDevelop.Editor; 41 39 using Forms = System.Windows.Forms; … … 44 42 45 43 namespace HeuristicLab.CodeEditor { 46 public partial class CodeEditor : Forms.UserControl{44 public partial class CodeEditor : CodeEditorBase { 47 45 private static readonly Media.Color WarningColor = Media.Colors.Blue; 48 46 private static readonly Media.Color ErrorColor = Media.Colors.Red; … … 73 71 private ITextMarker prefixMarker; 74 72 private string prefix = string.Empty; 75 public string Prefix {73 public override string Prefix { 76 74 get { return prefix; } 77 75 set { … … 91 89 private ITextMarker suffixMarker; 92 90 private string suffix = string.Empty; 93 public string Suffix {91 public override string Suffix { 94 92 get { return suffix; } 95 93 set { … … 108 106 } 109 107 110 public string UserCode {108 public override string UserCode { 111 109 get { return Doc.GetText(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length); } 112 110 set { … … 163 161 #endregion 164 162 165 public bool ReadOnly {163 public override bool ReadOnly { 166 164 get { return TextEditor.IsReadOnly; } 167 165 set { TextEditor.IsReadOnly = value; } … … 259 257 260 258 #region Assembly Management 261 public void AddAssembly(Assembly a) {259 public override void AddAssembly(Assembly a) { 262 260 assemblyLoader.AddAssembly(a); 263 261 } 264 262 265 public void AddAssemblies(IEnumerable<Assembly> assemblies) {263 public override void AddAssemblies(IEnumerable<Assembly> assemblies) { 266 264 assemblyLoader.AddAssemblies(assemblies); 267 265 } 268 266 269 public async Task AddAssembliesAsync(IEnumerable<Assembly> assemblies) {267 public override async Task AddAssembliesAsync(IEnumerable<Assembly> assemblies) { 270 268 await assemblyLoader.AddAssembliesAsync(assemblies); 271 269 } 272 270 273 public void RemoveAssembly(Assembly a) {271 public override void RemoveAssembly(Assembly a) { 274 272 assemblyLoader.RemoveAssembly(a); 275 273 } 276 274 #endregion 277 275 278 public void ScrollToPosition(int line, int column) {276 public override void ScrollToPosition(int line, int column) { 279 277 var segment = GetSegmentAtLocation(line, column); 280 278 TextEditor.CaretOffset = segment.Offset + segment.Length; … … 282 280 } 283 281 284 public void ScrollAfterPrefix() {282 public override void ScrollAfterPrefix() { 285 283 var location = Doc.GetLocation(prefix.Length); 286 284 ScrollToPosition(location.Line, location.Column); … … 399 397 400 398 #region Compiler Errors 401 public void ShowCompileErrors(CompilerErrorCollection compilerErrors) {399 public override void ShowCompileErrors(CompilerErrorCollection compilerErrors) { 402 400 if (compilerErrors == null) return; 403 401 … … 446 444 } 447 445 } 448 449 #region Events450 public event EventHandler TextEditorTextChanged;451 private void OnTextEditorTextChanged() {452 var handler = TextEditorTextChanged;453 if (handler != null) handler(this, EventArgs.Empty);454 }455 456 public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoading;457 private void OnAssembliesLoading(IEnumerable<Assembly> args) {458 var handler = AssembliesLoading;459 if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));460 }461 462 public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoaded;463 private void OnAssembliesLoaded(IEnumerable<Assembly> args) {464 var handler = AssembliesLoaded;465 if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));466 }467 468 public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesLoaded;469 private void OnInternalAssembliesLoaded(IEnumerable<IUnresolvedAssembly> args) {470 var handler = InternalAssembliesLoaded;471 if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));472 }473 474 public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloading;475 private void OnAssembliesUnloading(IEnumerable<Assembly> args) {476 var handler = AssembliesUnloading;477 if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));478 }479 480 public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloaded;481 private void OnAssembliesUnloaded(IEnumerable<Assembly> args) {482 var handler = AssembliesUnloaded;483 if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));484 }485 486 public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesUnloaded;487 private void OnInternalAssembliesUnloaded(IEnumerable<IUnresolvedAssembly> args) {488 var handler = InternalAssembliesUnloaded;489 if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));490 }491 #endregion492 446 } 493 447 } -
stable/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs
r12473 r12662 25 25 using System.Reflection; 26 26 using System.Threading.Tasks; 27 using System.Windows.Forms; 27 28 using HeuristicLab.Common; 28 29 using ICSharpCode.NRefactory.TypeSystem; 29 30 30 31 namespace HeuristicLab.CodeEditor { 31 public class CodeEditorBase : System.Windows.Forms.UserControl {32 public class CodeEditorBase : UserControl { 32 33 public virtual string UserCode { get; set; } 33 34 … … 60 61 #region Events 61 62 public event EventHandler TextEditorTextChanged; 62 protected virtual void TextEditor_TextChanged(object sender, EventArgs e) {63 if (TextEditorTextChanged != null) {64 TextEditorTextChanged(this, new EventArgs());65 }66 }67 63 protected virtual void OnTextEditorTextChanged() { 68 64 var handler = TextEditorTextChanged; -
stable/HeuristicLab.CodeEditor/3.4/HeuristicLab.CodeEditor-3.4.csproj
r12007 r12662 136 136 <Compile Include="GoToLineDialog.Designer.cs"> 137 137 <DependentUpon>GoToLineDialog.cs</DependentUpon> 138 </Compile> 139 <Compile Include="CodeEditorBase.cs"> 140 <SubType>UserControl</SubType> 138 141 </Compile> 139 142 <Compile Include="LanguageFeatures\CodeFolding\CodeFoldingResult.cs" /> … … 173 176 <DependentUpon>CodeEditor.cs</DependentUpon> 174 177 </Compile> 178 <Compile Include="SimpleCodeEditor.cs"> 179 <SubType>UserControl</SubType> 180 </Compile> 181 <Compile Include="SimpleCodeEditor.Designer.cs"> 182 <DependentUpon>SimpleCodeEditor.cs</DependentUpon> 183 </Compile> 175 184 <Compile Include="AvalonEditWrapper.xaml.cs"> 176 185 <DependentUpon>AvalonEditWrapper.xaml</DependentUpon> -
stable/HeuristicLab.CodeEditor/3.4/Plugin.cs.frame
r12009 r12662 27 27 [PluginDependency("HeuristicLab.Common", "3.3")] 28 28 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 29 [PluginDependency("HeuristicLab.NRefactory", "5.5.0")] 30 #if !__MonoCS__ 29 31 [PluginDependency("HeuristicLab.AvalonEdit", "5.0.1")] 30 [PluginDependency("HeuristicLab.NRefactory", "5.5.0")] 32 #endif 31 33 public class HeuristicLabCodeEditorPlugin : PluginBase { 32 34 } -
stable/HeuristicLab.CodeEditor/3.4/SimpleCodeEditor.Designer.cs
r12473 r12662 29 29 // TextEditor 30 30 // 31 this.TextEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 32 | System.Windows.Forms.AnchorStyles.Left) 31 this.TextEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 32 | System.Windows.Forms.AnchorStyles.Left) 33 33 | System.Windows.Forms.AnchorStyles.Right))); 34 34 this.TextEditor.Location = new System.Drawing.Point(3, 3); … … 37 37 this.TextEditor.Size = new System.Drawing.Size(158, 57); 38 38 this.TextEditor.TabIndex = 0; 39 this.TextEditor.TextChanged += new System.EventHandler(this.TextEditor_TextChanged); 39 40 // 40 // CodeEditor41 // SimpleCodeEditor 41 42 // 42 43 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 43 44 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 44 45 this.Controls.Add(this.TextEditor); 45 this.Name = " CodeEditor";46 this.Name = "SimpleCodeEditor"; 46 47 this.Size = new System.Drawing.Size(164, 63); 47 48 this.ResumeLayout(false); -
stable/HeuristicLab.CodeEditor/3.4/SimpleCodeEditor.cs
r12473 r12662 20 20 #endregion 21 21 22 using System; 23 22 24 namespace HeuristicLab.CodeEditor { 23 25 public partial class SimpleCodeEditor : CodeEditorBase { … … 34 36 } 35 37 } 38 39 protected virtual void TextEditor_TextChanged(object sender, EventArgs e) { 40 OnTextEditorTextChanged(); 41 } 36 42 } 37 43 }
Note: See TracChangeset
for help on using the changeset viewer.