Changeset 12473


Ignore:
Timestamp:
06/18/15 14:24:42 (4 years ago)
Author:
ascheibe
Message:

#2329 added a simple code editor for Linux

Location:
trunk/sources
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CodeEditor/3.4/CodeEditor.cs

    r12012 r12473  
    2727using System.Threading.Tasks;
    2828using System.Windows.Documents;
    29 using HeuristicLab.Common;
    3029using ICSharpCode.AvalonEdit;
    3130using ICSharpCode.AvalonEdit.AddIn;
     
    3736using ICSharpCode.AvalonEdit.Search;
    3837using ICSharpCode.NRefactory.Editor;
    39 using ICSharpCode.NRefactory.TypeSystem;
    4038using ICSharpCode.SharpDevelop.Editor;
    4139using Forms = System.Windows.Forms;
     
    4442
    4543namespace HeuristicLab.CodeEditor {
    46   public partial class CodeEditor : Forms.UserControl {
     44  public partial class CodeEditor : CodeEditorBase {
    4745    private static readonly Media.Color WarningColor = Media.Colors.Blue;
    4846    private static readonly Media.Color ErrorColor = Media.Colors.Red;
     
    7371    private ITextMarker prefixMarker;
    7472    private string prefix = string.Empty;
    75     public string Prefix {
     73    public override string Prefix {
    7674      get { return prefix; }
    7775      set {
     
    9189    private ITextMarker suffixMarker;
    9290    private string suffix = string.Empty;
    93     public string Suffix {
     91    public override string Suffix {
    9492      get { return suffix; }
    9593      set {
     
    108106    }
    109107
    110     public string UserCode {
     108    public override string UserCode {
    111109      get { return Doc.GetText(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length); }
    112110      set {
     
    163161    #endregion
    164162
    165     public bool ReadOnly {
     163    public override bool ReadOnly {
    166164      get { return TextEditor.IsReadOnly; }
    167165      set { TextEditor.IsReadOnly = value; }
     
    259257
    260258    #region Assembly Management
    261     public void AddAssembly(Assembly a) {
     259    public override void AddAssembly(Assembly a) {
    262260      assemblyLoader.AddAssembly(a);
    263261    }
    264262
    265     public void AddAssemblies(IEnumerable<Assembly> assemblies) {
     263    public override void AddAssemblies(IEnumerable<Assembly> assemblies) {
    266264      assemblyLoader.AddAssemblies(assemblies);
    267265    }
    268266
    269     public async Task AddAssembliesAsync(IEnumerable<Assembly> assemblies) {
     267    public override async Task AddAssembliesAsync(IEnumerable<Assembly> assemblies) {
    270268      await assemblyLoader.AddAssembliesAsync(assemblies);
    271269    }
    272270
    273     public void RemoveAssembly(Assembly a) {
     271    public override void RemoveAssembly(Assembly a) {
    274272      assemblyLoader.RemoveAssembly(a);
    275273    }
    276274    #endregion
    277275
    278     public void ScrollToPosition(int line, int column) {
     276    public override void ScrollToPosition(int line, int column) {
    279277      var segment = GetSegmentAtLocation(line, column);
    280278      TextEditor.CaretOffset = segment.Offset + segment.Length;
     
    282280    }
    283281
    284     public void ScrollAfterPrefix() {
     282    public override void ScrollAfterPrefix() {
    285283      var location = Doc.GetLocation(prefix.Length);
    286284      ScrollToPosition(location.Line, location.Column);
     
    399397
    400398    #region Compiler Errors
    401     public void ShowCompileErrors(CompilerErrorCollection compilerErrors) {
     399    public override void ShowCompileErrors(CompilerErrorCollection compilerErrors) {
    402400      if (compilerErrors == null) return;
    403401
     
    446444      }
    447445    }
    448 
    449     #region Events
    450     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     #endregion
    492446  }
    493447}
  • trunk/sources/HeuristicLab.CodeEditor/3.4/HeuristicLab.CodeEditor-3.4.csproj

    r11992 r12473  
    136136    <Compile Include="GoToLineDialog.Designer.cs">
    137137      <DependentUpon>GoToLineDialog.cs</DependentUpon>
     138    </Compile>
     139    <Compile Include="CodeEditorBase.cs">
     140      <SubType>UserControl</SubType>
    138141    </Compile>
    139142    <Compile Include="LanguageFeatures\CodeFolding\CodeFoldingResult.cs" />
     
    173176      <DependentUpon>CodeEditor.cs</DependentUpon>
    174177    </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>
    175184    <Compile Include="AvalonEditWrapper.xaml.cs">
    176185      <DependentUpon>AvalonEditWrapper.xaml</DependentUpon>
  • trunk/sources/HeuristicLab.CodeEditor/3.4/Plugin.cs.frame

    r12012 r12473  
    2727  [PluginDependency("HeuristicLab.Common", "3.3")]
    2828  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
     29  [PluginDependency("HeuristicLab.NRefactory", "5.5.0")]
     30#if !__MonoCS__
    2931  [PluginDependency("HeuristicLab.AvalonEdit", "5.0.1")]
    30   [PluginDependency("HeuristicLab.NRefactory", "5.5.0")]
     32#endif
    3133  public class HeuristicLabCodeEditorPlugin : PluginBase {
    3234  }
  • trunk/sources/HeuristicLab.Operators.Programmable.Views/3.3/ProgrammableOperatorView.Designer.cs

    r12012 r12473  
    5555      this.showCodeButton = new System.Windows.Forms.Button();
    5656      this.compileButton = new System.Windows.Forms.Button();
     57#if __MonoCS__
     58      this.codeEditor = new HeuristicLab.CodeEditor.SimpleCodeEditor();
     59#else
    5760      this.codeEditor = new HeuristicLab.CodeEditor.CodeEditor();
     61#endif
    5862      this.tabControl1 = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
    5963      this.tabPage1 = new System.Windows.Forms.TabPage();
     
    324328    private HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
    325329    private System.Windows.Forms.SplitContainer splitContainer1;
    326     private HeuristicLab.CodeEditor.CodeEditor codeEditor;
     330    private HeuristicLab.CodeEditor.CodeEditorBase codeEditor;
    327331    private System.Windows.Forms.Button compileButton;
    328332    private System.Windows.Forms.Button showCodeButton;
  • trunk/sources/HeuristicLab.Operators.Programmable.Views/3.3/ProgrammableOperatorView.cs

    r12012 r12473  
    131131    }
    132132    private void showCodeButton_Click(object sender, EventArgs e) {
     133#if __MonoCS__
     134      new TextDialog("CodeViewer", ProgrammableOperator.CompilationUnitCode, true).ShowDialog(this);
     135#else
    133136      new CodeViewer(ProgrammableOperator.CompilationUnitCode).ShowDialog(this);
     137#endif
    134138    }
    135139    private void codeEditor_Validated(object sender, EventArgs e) {
     
    199203      try {
    200204        ProgrammableOperator.Compile();
    201       } catch (Exception ex) {
     205      }
     206      catch (Exception ex) {
    202207        ErrorHandling.ShowErrorDialog(this, ex);
    203208      }
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs

    r12012 r12473  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Reflection;
    24 using HeuristicLab.Common;
    2522
    2623namespace HeuristicLab.Scripting.Views {
     
    6461      this.columnColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    6562      this.descriptionColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     63#if __MonoCS__
     64      this.codeEditor = new HeuristicLab.CodeEditor.SimpleCodeEditor();
     65#else
    6666      this.codeEditor = new HeuristicLab.CodeEditor.CodeEditor();
     67#endif
    6768      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    6869      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     
    225226      // splitContainer1
    226227      //
    227       this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    228             | System.Windows.Forms.AnchorStyles.Left) 
     228      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     229            | System.Windows.Forms.AnchorStyles.Left)
    229230            | System.Windows.Forms.AnchorStyles.Right)));
    230231      this.splitContainer1.Location = new System.Drawing.Point(0, 56);
     
    287288    protected System.Windows.Forms.ColumnHeader columnColumnHeader;
    288289    protected System.Windows.Forms.ColumnHeader descriptionColumnHeader;
    289     protected CodeEditor.CodeEditor codeEditor;
     290    protected CodeEditor.CodeEditorBase codeEditor;
    290291    protected System.Windows.Forms.SplitContainer splitContainer1;
    291292  }
Note: See TracChangeset for help on using the changeset viewer.