Changeset 10892 for stable/HeuristicLab.Scripting.Views
- Timestamp:
- 05/26/14 16:41:12 (10 years ago)
- Location:
- stable
- Files:
-
- 5 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 10510-10512,10566,10577,10642,10727,10731,10747,10761,10857,10865
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.cs
r10731 r10892 21 21 22 22 using System; 23 using System.Drawing;24 23 using System.Windows.Forms; 25 24 using HeuristicLab.Common; … … 95 94 base.OnContentChanged(); 96 95 if (Content == null) { 97 codeEditor.UserCode = string.Empty;98 96 variableStoreView.Content = null; 99 97 } else { 100 codeEditor.UserCode = Content.Code;101 foreach (var asm in Content.GetAssemblies())102 codeEditor.AddAssembly(asm);103 98 variableStoreView.Content = Content.VariableStore; 104 if (Content.CompileErrors == null) {105 compilationLabel.ForeColor = SystemColors.ControlDarkDark;106 compilationLabel.Text = "Not compiled";107 } else if (Content.CompileErrors.HasErrors) {108 compilationLabel.ForeColor = Color.DarkRed;109 compilationLabel.Text = "Compilation failed";110 } else {111 compilationLabel.ForeColor = Color.DarkGreen;112 compilationLabel.Text = "Compilation successful";113 }114 99 } 115 100 } … … 117 102 protected override void SetEnabledStateOfControls() { 118 103 base.SetEnabledStateOfControls(); 119 compileButton.Enabled = Content != null && !Locked && !ReadOnly;120 104 startStopButton.Enabled = Content != null && (!Locked || Running); 121 codeEditor.Enabled = Content != null && !Locked && !ReadOnly;122 105 } 123 106 -
stable/HeuristicLab.Scripting.Views/3.3/HeuristicLab.Scripting.Views-3.3.csproj
r10510 r10892 86 86 <ItemGroup> 87 87 <None Include="Plugin.cs.frame" /> 88 <Compile Include="CSharpScriptView.cs"> 89 <SubType>UserControl</SubType> 90 </Compile> 91 <Compile Include="CSharpScriptView.Designer.cs"> 92 <DependentUpon>CSharpScriptView.cs</DependentUpon> 93 </Compile> 88 94 <Compile Include="ScriptView.cs"> 89 95 <SubType>UserControl</SubType> -
stable/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs
r10506 r10892 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptView)); 48 49 this.compilationLabel = new System.Windows.Forms.Label(); 49 this.startStopButton = new System.Windows.Forms.Button(); 50 this.imageList = new System.Windows.Forms.ImageList(this.components); 51 this.compileButton = new System.Windows.Forms.Button(); 52 this.infoTabControl = new System.Windows.Forms.TabControl(); 53 this.outputTabPage = new System.Windows.Forms.TabPage(); 54 this.outputTextBox = new System.Windows.Forms.TextBox(); 55 this.errorListTabPage = new System.Windows.Forms.TabPage(); 50 56 this.errorListView = new System.Windows.Forms.ListView(); 51 57 this.iconColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); … … 55 61 this.columnColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 56 62 this.descriptionColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 57 this.imageList = new System.Windows.Forms.ImageList(this.components);58 63 this.codeEditor = new HeuristicLab.CodeEditor.CodeEditor(); 59 64 this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 60 this.splitContainer2 = new System.Windows.Forms.SplitContainer();61 this.infoTabControl = new System.Windows.Forms.TabControl();62 this.outputTabPage = new System.Windows.Forms.TabPage();63 this.outputTextBox = new System.Windows.Forms.TextBox();64 this.errorListTabPage = new System.Windows.Forms.TabPage();65 this.variableStoreView = new HeuristicLab.Scripting.Views.VariableStoreView();66 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();67 this.compileButton = new System.Windows.Forms.Button();68 65 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 66 this.infoTabControl.SuspendLayout(); 67 this.outputTabPage.SuspendLayout(); 68 this.errorListTabPage.SuspendLayout(); 69 69 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 70 70 this.splitContainer1.Panel1.SuspendLayout(); 71 71 this.splitContainer1.Panel2.SuspendLayout(); 72 72 this.splitContainer1.SuspendLayout(); 73 ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();74 this.splitContainer2.Panel1.SuspendLayout();75 this.splitContainer2.Panel2.SuspendLayout();76 this.splitContainer2.SuspendLayout();77 this.infoTabControl.SuspendLayout();78 this.outputTabPage.SuspendLayout();79 this.errorListTabPage.SuspendLayout();80 73 this.SuspendLayout(); 81 74 // … … 84 77 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 85 78 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 86 this.nameTextBox.Location = new System.Drawing.Point(6 0, 0);87 this.nameTextBox.Size = new System.Drawing.Size(7 50, 20);79 this.nameTextBox.Location = new System.Drawing.Point(69, 0); 80 this.nameTextBox.Size = new System.Drawing.Size(741, 20); 88 81 // 89 82 // infoLabel … … 101 94 this.compilationLabel.Text = "Not compiled"; 102 95 // 103 // startStopButton 104 // 105 this.startStopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play; 106 this.startStopButton.Location = new System.Drawing.Point(36, 26); 107 this.startStopButton.Name = "startStopButton"; 108 this.startStopButton.Size = new System.Drawing.Size(24, 24); 109 this.startStopButton.TabIndex = 1; 110 this.startStopButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 111 this.toolTip.SetToolTip(this.startStopButton, "Run (F5)"); 112 this.startStopButton.UseVisualStyleBackColor = true; 113 this.startStopButton.Click += new System.EventHandler(this.startStopButton_Click); 96 // imageList 97 // 98 this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 99 this.imageList.ImageSize = new System.Drawing.Size(16, 16); 100 this.imageList.TransparentColor = System.Drawing.Color.Transparent; 101 // 102 // compileButton 103 // 104 this.compileButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Script; 105 this.compileButton.Location = new System.Drawing.Point(6, 26); 106 this.compileButton.Name = "compileButton"; 107 this.compileButton.Size = new System.Drawing.Size(24, 24); 108 this.compileButton.TabIndex = 8; 109 this.compileButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 110 this.toolTip.SetToolTip(this.compileButton, "Compile (F6)"); 111 this.compileButton.UseVisualStyleBackColor = true; 112 this.compileButton.Click += new System.EventHandler(this.CompileButtonOnClick); 113 // 114 // infoTabControl 115 // 116 this.infoTabControl.Controls.Add(this.outputTabPage); 117 this.infoTabControl.Controls.Add(this.errorListTabPage); 118 this.infoTabControl.Dock = System.Windows.Forms.DockStyle.Fill; 119 this.infoTabControl.Location = new System.Drawing.Point(0, 0); 120 this.infoTabControl.Name = "infoTabControl"; 121 this.infoTabControl.SelectedIndex = 0; 122 this.infoTabControl.Size = new System.Drawing.Size(832, 112); 123 this.infoTabControl.TabIndex = 1; 124 // 125 // outputTabPage 126 // 127 this.outputTabPage.Controls.Add(this.outputTextBox); 128 this.outputTabPage.Location = new System.Drawing.Point(4, 22); 129 this.outputTabPage.Name = "outputTabPage"; 130 this.outputTabPage.Padding = new System.Windows.Forms.Padding(3); 131 this.outputTabPage.Size = new System.Drawing.Size(824, 86); 132 this.outputTabPage.TabIndex = 1; 133 this.outputTabPage.Text = "Output"; 134 this.outputTabPage.UseVisualStyleBackColor = true; 135 // 136 // outputTextBox 137 // 138 this.outputTextBox.Dock = System.Windows.Forms.DockStyle.Fill; 139 this.outputTextBox.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 140 this.outputTextBox.Location = new System.Drawing.Point(3, 3); 141 this.outputTextBox.Multiline = true; 142 this.outputTextBox.Name = "outputTextBox"; 143 this.outputTextBox.ReadOnly = true; 144 this.outputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; 145 this.outputTextBox.Size = new System.Drawing.Size(818, 80); 146 this.outputTextBox.TabIndex = 0; 147 this.outputTextBox.WordWrap = false; 148 // 149 // errorListTabPage 150 // 151 this.errorListTabPage.Controls.Add(this.errorListView); 152 this.errorListTabPage.Location = new System.Drawing.Point(4, 22); 153 this.errorListTabPage.Name = "errorListTabPage"; 154 this.errorListTabPage.Padding = new System.Windows.Forms.Padding(3); 155 this.errorListTabPage.Size = new System.Drawing.Size(824, 86); 156 this.errorListTabPage.TabIndex = 0; 157 this.errorListTabPage.Text = "Error List"; 158 this.errorListTabPage.UseVisualStyleBackColor = true; 114 159 // 115 160 // errorListView … … 128 173 this.errorListView.Location = new System.Drawing.Point(3, 3); 129 174 this.errorListView.Name = "errorListView"; 130 this.errorListView.Size = new System.Drawing.Size( 623, 79);175 this.errorListView.Size = new System.Drawing.Size(818, 80); 131 176 this.errorListView.SmallImageList = this.imageList; 132 177 this.errorListView.TabIndex = 0; … … 158 203 this.descriptionColumnHeader.Text = "Description"; 159 204 // 160 // imageList161 //162 this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;163 this.imageList.ImageSize = new System.Drawing.Size(16, 16);164 this.imageList.TransparentColor = System.Drawing.Color.Transparent;165 //166 205 // codeEditor 167 206 // … … 170 209 this.codeEditor.Name = "codeEditor"; 171 210 this.codeEditor.Prefix = ""; 172 this.codeEditor.Size = new System.Drawing.Size( 637, 428);211 this.codeEditor.Size = new System.Drawing.Size(832, 430); 173 212 this.codeEditor.Suffix = ""; 174 213 this.codeEditor.TabIndex = 0; 175 214 this.codeEditor.UserCode = ""; 176 this.codeEditor.TextEditorTextChanged += new System.EventHandler(this. codeEditor_TextEditorTextChanged);215 this.codeEditor.TextEditorTextChanged += new System.EventHandler(this.CodeEditorOnTextEditorTextChanged); 177 216 // 178 217 // splitContainer1 … … 181 220 | System.Windows.Forms.AnchorStyles.Left) 182 221 | System.Windows.Forms.AnchorStyles.Right))); 183 this.splitContainer1.Location = new System.Drawing.Point( 3, 56);222 this.splitContainer1.Location = new System.Drawing.Point(0, 56); 184 223 this.splitContainer1.Name = "splitContainer1"; 224 this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; 185 225 // 186 226 // splitContainer1.Panel1 187 227 // 188 this.splitContainer1.Panel1.Controls.Add(this. splitContainer2);228 this.splitContainer1.Panel1.Controls.Add(this.codeEditor); 189 229 // 190 230 // splitContainer1.Panel2 191 231 // 192 this.splitContainer1.Panel2.Controls.Add(this.variableStoreView); 193 this.splitContainer1.Panel2.Controls.Add(this.viewHost); 194 this.splitContainer1.Size = new System.Drawing.Size(829, 543); 195 this.splitContainer1.SplitterDistance = 637; 196 this.splitContainer1.TabIndex = 7; 197 // 198 // splitContainer2 199 // 200 this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; 201 this.splitContainer2.Location = new System.Drawing.Point(0, 0); 202 this.splitContainer2.Name = "splitContainer2"; 203 this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; 204 // 205 // splitContainer2.Panel1 206 // 207 this.splitContainer2.Panel1.Controls.Add(this.codeEditor); 208 // 209 // splitContainer2.Panel2 210 // 211 this.splitContainer2.Panel2.Controls.Add(this.infoTabControl); 212 this.splitContainer2.Size = new System.Drawing.Size(637, 543); 213 this.splitContainer2.SplitterDistance = 428; 214 this.splitContainer2.TabIndex = 5; 215 // 216 // infoTabControl 217 // 218 this.infoTabControl.Controls.Add(this.outputTabPage); 219 this.infoTabControl.Controls.Add(this.errorListTabPage); 220 this.infoTabControl.Dock = System.Windows.Forms.DockStyle.Fill; 221 this.infoTabControl.Location = new System.Drawing.Point(0, 0); 222 this.infoTabControl.Name = "infoTabControl"; 223 this.infoTabControl.SelectedIndex = 0; 224 this.infoTabControl.Size = new System.Drawing.Size(637, 111); 225 this.infoTabControl.TabIndex = 1; 226 // 227 // outputTabPage 228 // 229 this.outputTabPage.Controls.Add(this.outputTextBox); 230 this.outputTabPage.Location = new System.Drawing.Point(4, 22); 231 this.outputTabPage.Name = "outputTabPage"; 232 this.outputTabPage.Padding = new System.Windows.Forms.Padding(3); 233 this.outputTabPage.Size = new System.Drawing.Size(629, 85); 234 this.outputTabPage.TabIndex = 1; 235 this.outputTabPage.Text = "Output"; 236 this.outputTabPage.UseVisualStyleBackColor = true; 237 // 238 // outputTextBox 239 // 240 this.outputTextBox.Dock = System.Windows.Forms.DockStyle.Fill; 241 this.outputTextBox.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 242 this.outputTextBox.Location = new System.Drawing.Point(3, 3); 243 this.outputTextBox.Multiline = true; 244 this.outputTextBox.Name = "outputTextBox"; 245 this.outputTextBox.ReadOnly = true; 246 this.outputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; 247 this.outputTextBox.Size = new System.Drawing.Size(623, 79); 248 this.outputTextBox.TabIndex = 0; 249 this.outputTextBox.WordWrap = false; 250 // 251 // errorListTabPage 252 // 253 this.errorListTabPage.Controls.Add(this.errorListView); 254 this.errorListTabPage.Location = new System.Drawing.Point(4, 22); 255 this.errorListTabPage.Name = "errorListTabPage"; 256 this.errorListTabPage.Padding = new System.Windows.Forms.Padding(3); 257 this.errorListTabPage.Size = new System.Drawing.Size(629, 85); 258 this.errorListTabPage.TabIndex = 0; 259 this.errorListTabPage.Text = "Error List"; 260 this.errorListTabPage.UseVisualStyleBackColor = true; 261 // 262 // variableStoreView 263 // 264 this.variableStoreView.Caption = "ItemCollection View"; 265 this.variableStoreView.Content = null; 266 this.variableStoreView.Dock = System.Windows.Forms.DockStyle.Fill; 267 this.variableStoreView.Location = new System.Drawing.Point(0, 0); 268 this.variableStoreView.Name = "variableStoreView"; 269 this.variableStoreView.ReadOnly = false; 270 this.variableStoreView.Size = new System.Drawing.Size(188, 543); 271 this.variableStoreView.TabIndex = 0; 272 // 273 // viewHost 274 // 275 this.viewHost.Caption = "View"; 276 this.viewHost.Content = null; 277 this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill; 278 this.viewHost.Enabled = false; 279 this.viewHost.Location = new System.Drawing.Point(0, 0); 280 this.viewHost.Name = "viewHost"; 281 this.viewHost.ReadOnly = false; 282 this.viewHost.Size = new System.Drawing.Size(188, 543); 283 this.viewHost.TabIndex = 0; 284 this.viewHost.ViewsLabelVisible = true; 285 this.viewHost.ViewType = null; 286 // 287 // compileButton 288 // 289 this.compileButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Script; 290 this.compileButton.Location = new System.Drawing.Point(6, 26); 291 this.compileButton.Name = "compileButton"; 292 this.compileButton.Size = new System.Drawing.Size(24, 24); 293 this.compileButton.TabIndex = 8; 294 this.compileButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 295 this.toolTip.SetToolTip(this.compileButton, "Compile (F6)"); 296 this.compileButton.UseVisualStyleBackColor = true; 297 this.compileButton.Click += new System.EventHandler(this.compileButton_Click); 232 this.splitContainer1.Panel2.Controls.Add(this.infoTabControl); 233 this.splitContainer1.Size = new System.Drawing.Size(832, 546); 234 this.splitContainer1.SplitterDistance = 430; 235 this.splitContainer1.TabIndex = 9; 298 236 // 299 237 // ScriptView 300 238 // 301 239 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 240 this.Controls.Add(this.splitContainer1); 302 241 this.Controls.Add(this.compileButton); 303 this.Controls.Add(this.splitContainer1);304 this.Controls.Add(this.startStopButton);305 242 this.Controls.Add(this.compilationLabel); 306 243 this.Name = "ScriptView"; 307 244 this.Size = new System.Drawing.Size(835, 602); 308 245 this.Controls.SetChildIndex(this.compilationLabel, 0); 309 this.Controls.SetChildIndex(this. startStopButton, 0);246 this.Controls.SetChildIndex(this.compileButton, 0); 310 247 this.Controls.SetChildIndex(this.splitContainer1, 0); 311 248 this.Controls.SetChildIndex(this.nameLabel, 0); 312 249 this.Controls.SetChildIndex(this.nameTextBox, 0); 313 250 this.Controls.SetChildIndex(this.infoLabel, 0); 314 this.Controls.SetChildIndex(this.compileButton, 0);315 251 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 252 this.infoTabControl.ResumeLayout(false); 253 this.outputTabPage.ResumeLayout(false); 254 this.outputTabPage.PerformLayout(); 255 this.errorListTabPage.ResumeLayout(false); 316 256 this.splitContainer1.Panel1.ResumeLayout(false); 317 257 this.splitContainer1.Panel2.ResumeLayout(false); 318 258 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 319 259 this.splitContainer1.ResumeLayout(false); 320 this.splitContainer2.Panel1.ResumeLayout(false);321 this.splitContainer2.Panel2.ResumeLayout(false);322 ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();323 this.splitContainer2.ResumeLayout(false);324 this.infoTabControl.ResumeLayout(false);325 this.outputTabPage.ResumeLayout(false);326 this.outputTabPage.PerformLayout();327 this.errorListTabPage.ResumeLayout(false);328 260 this.ResumeLayout(false); 329 261 this.PerformLayout(); … … 333 265 #endregion 334 266 335 private System.Windows.Forms.Label compilationLabel; 336 private System.Windows.Forms.Button startStopButton; 337 private System.Windows.Forms.ListView errorListView; 338 private System.Windows.Forms.ColumnHeader descriptionColumnHeader; 339 private System.Windows.Forms.ColumnHeader lineColumnHeader; 340 private System.Windows.Forms.ColumnHeader columnColumnHeader; 341 private CodeEditor.CodeEditor codeEditor; 342 private System.Windows.Forms.SplitContainer splitContainer1; 343 private System.Windows.Forms.SplitContainer splitContainer2; 344 private MainForm.WindowsForms.ViewHost viewHost; 345 private VariableStoreView variableStoreView; 346 private System.Windows.Forms.ColumnHeader errorNumberColumnHeader; 347 private System.Windows.Forms.ColumnHeader categoryColumnHeader; 348 private System.Windows.Forms.TabControl infoTabControl; 349 private System.Windows.Forms.TabPage errorListTabPage; 350 private System.Windows.Forms.TabPage outputTabPage; 351 private System.Windows.Forms.TextBox outputTextBox; 352 private System.Windows.Forms.Button compileButton; 353 private System.Windows.Forms.ColumnHeader iconColumnHeader; 354 private System.Windows.Forms.ImageList imageList; 267 protected System.Windows.Forms.Label compilationLabel; 268 protected System.Windows.Forms.Button compileButton; 269 protected System.Windows.Forms.ImageList imageList; 270 protected System.Windows.Forms.TabControl infoTabControl; 271 protected System.Windows.Forms.TabPage outputTabPage; 272 protected System.Windows.Forms.TextBox outputTextBox; 273 protected System.Windows.Forms.TabPage errorListTabPage; 274 protected System.Windows.Forms.ListView errorListView; 275 protected System.Windows.Forms.ColumnHeader iconColumnHeader; 276 protected System.Windows.Forms.ColumnHeader categoryColumnHeader; 277 protected System.Windows.Forms.ColumnHeader errorNumberColumnHeader; 278 protected System.Windows.Forms.ColumnHeader lineColumnHeader; 279 protected System.Windows.Forms.ColumnHeader columnColumnHeader; 280 protected System.Windows.Forms.ColumnHeader descriptionColumnHeader; 281 protected CodeEditor.CodeEditor codeEditor; 282 protected System.Windows.Forms.SplitContainer splitContainer1; 355 283 } 356 284 } -
stable/HeuristicLab.Scripting.Views/3.3/ScriptView.cs
r10506 r10892 26 26 using System.Linq; 27 27 using System.Windows.Forms; 28 using HeuristicLab.Common;29 28 using HeuristicLab.Common.Resources; 30 29 using HeuristicLab.Core.Views; … … 36 35 [Content(typeof(Script), true)] 37 36 public partial class ScriptView : NamedItemView { 38 private bool running;39 40 37 public new Script Content { 41 38 get { return (Script)base.Content; } 42 set { base.Content = (Script)value; }39 set { base.Content = value; } 43 40 } 44 41 … … 46 43 InitializeComponent(); 47 44 errorListView.SmallImageList.Images.AddRange(new Image[] { VSImageLibrary.Warning, VSImageLibrary.Error }); 48 AdjustErrorListViewColumnSizes();49 45 } 50 46 51 47 protected override void RegisterContentEvents() { 52 48 base.RegisterContentEvents(); 53 Content.CodeChanged += Content_CodeChanged; 54 Content.ScriptExecutionStarted += Content_ScriptExecutionStarted; 55 Content.ScriptExecutionFinished += Content_ScriptExecutionFinished; 56 Content.ConsoleOutputChanged += Content_ConsoleOutputChanged; 49 Content.CodeChanged += ContentOnCodeChanged; 57 50 } 58 51 59 52 protected override void DeregisterContentEvents() { 60 Content.CodeChanged -= Content_CodeChanged; 61 Content.ScriptExecutionStarted -= Content_ScriptExecutionStarted; 62 Content.ScriptExecutionFinished -= Content_ScriptExecutionFinished; 63 Content.ConsoleOutputChanged -= Content_ConsoleOutputChanged; 53 Content.CodeChanged -= ContentOnCodeChanged; 64 54 base.DeregisterContentEvents(); 65 55 } 66 56 67 #region Content event handlers 68 private void Content_CodeChanged(object sender, EventArgs e) { 57 protected virtual void ContentOnCodeChanged(object sender, EventArgs e) { 69 58 codeEditor.UserCode = Content.Code; 70 59 } 71 private void Content_ScriptExecutionStarted(object sender, EventArgs e) {72 if (InvokeRequired)73 Invoke((Action<object, EventArgs>)Content_ScriptExecutionStarted, sender, e);74 else {75 Locked = true;76 ReadOnly = true;77 startStopButton.Image = VSImageLibrary.Stop;78 infoTabControl.SelectedTab = outputTabPage;79 }80 }81 private void Content_ScriptExecutionFinished(object sender, EventArgs<Exception> e) {82 if (InvokeRequired)83 Invoke((Action<object, EventArgs<Exception>>)Content_ScriptExecutionFinished, sender, e);84 else {85 Locked = false;86 ReadOnly = false;87 startStopButton.Image = VSImageLibrary.Play;88 running = false;89 var ex = e.Value;90 if (ex != null)91 PluginInfrastructure.ErrorHandling.ShowErrorDialog(this, ex);92 }93 }94 private void Content_ConsoleOutputChanged(object sender, EventArgs<string> e) {95 if (InvokeRequired)96 Invoke((Action<object, EventArgs<string>>)Content_ConsoleOutputChanged, sender, e);97 else {98 outputTextBox.AppendText(e.Value);99 }100 }101 #endregion102 60 103 61 protected override void OnContentChanged() { … … 105 63 if (Content == null) { 106 64 codeEditor.UserCode = string.Empty; 107 variableStoreView.Content = null;108 65 } else { 109 66 codeEditor.UserCode = Content.Code; 110 67 foreach (var asm in Content.GetAssemblies()) 111 68 codeEditor.AddAssembly(asm); 112 variableStoreView.Content = Content.VariableStore;113 69 if (Content.CompileErrors == null) { 114 70 compilationLabel.ForeColor = SystemColors.ControlDarkDark; … … 127 83 base.SetEnabledStateOfControls(); 128 84 compileButton.Enabled = Content != null && !Locked && !ReadOnly; 129 startStopButton.Enabled = Content != null && (!Locked || running);130 85 codeEditor.Enabled = Content != null && !Locked && !ReadOnly; 131 86 } 132 87 133 #region Child Control event handlers 134 private void compileButton_Click(object sender, EventArgs e) { 88 protected virtual void CompileButtonOnClick(object sender, EventArgs e) { 135 89 Compile(); 136 90 } 137 91 138 private void startStopButton_Click(object sender, EventArgs e) { 139 if (running) { 140 Content.Kill(); 141 } else 142 if (Compile()) { 143 outputTextBox.Clear(); 144 Content.Execute(); 145 running = true; 146 } 147 } 148 149 private void codeEditor_TextEditorTextChanged(object sender, EventArgs e) { 92 protected virtual void CodeEditorOnTextEditorTextChanged(object sender, EventArgs e) { 93 if (Content == null) return; 150 94 Content.Code = codeEditor.UserCode; 151 95 } 152 #endregion153 154 #region global HotKeys155 96 protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { 156 97 switch (keyData) { 157 case Keys.F5:158 if (Content != null && !Locked) {159 if (Compile()) {160 outputTextBox.Clear();161 Content.Execute();162 running = true;163 } else164 infoTabControl.SelectedTab = errorListTabPage;165 }166 break;167 case Keys.F5 | Keys.Shift:168 if (running) Content.Kill();169 break;170 98 case Keys.F6: 171 if ( !Compile() || Content.CompileErrors.HasWarnings)172 infoTabControl.SelectedTab = errorListTabPage;173 break;99 if (Content != null && !Locked) 100 Compile(); 101 return true; 174 102 } 175 103 return base.ProcessCmdKey(ref msg, keyData); 176 104 } 177 #endregion178 105 179 #region Auxiliary functions 180 private bool Compile() { 106 public virtual bool Compile() { 181 107 ReadOnly = true; 182 108 Locked = true; … … 188 114 return true; 189 115 } catch { 190 outputTextBox.AppendText("Compilation failed."); 191 return false; 116 if (Content.CompileErrors.HasErrors) { 117 outputTextBox.AppendText("Compilation failed."); 118 return false; 119 } else { 120 outputTextBox.AppendText("Compilation succeeded."); 121 return true; 122 } 192 123 } finally { 193 124 ShowCompilationResults(); 125 if (Content.CompileErrors.Count > 0) 126 infoTabControl.SelectedTab = errorListTabPage; 194 127 ReadOnly = false; 195 128 Locked = false; … … 197 130 } 198 131 } 199 #endregion200 132 201 pr ivatevoid ShowCompilationResults() {133 protected virtual void ShowCompilationResults() { 202 134 if (Content.CompileErrors.Count == 0) return; 203 135 var msgs = Content.CompileErrors.OfType<CompilerError>() … … 220 152 } 221 153 222 pr ivatevoid AdjustErrorListViewColumnSizes() {154 protected virtual void AdjustErrorListViewColumnSizes() { 223 155 foreach (ColumnHeader ch in errorListView.Columns) 224 // adjusts the column width to the width of the column 225 // header or the column content, whichever is greater 156 // adjusts the column width to the width of the column header 226 157 ch.Width = -2; 227 158 } -
stable/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs
r10506 r10892 21 21 22 22 using System; 23 using System.Collections;24 23 using System.Collections.Generic; 25 24 using System.Drawing; … … 220 219 221 220 if (items.Count > 0) { 222 DataObjectdata = new DataObject();221 var data = new DataObject(); 223 222 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 224 223 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 225 224 if (ReadOnly) { 226 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);225 DoDragDrop(data, DragDropEffects.Copy); 227 226 } else { 228 DragDropEffectsresult = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);227 var result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move); 229 228 if ((result & DragDropEffects.Move) == DragDropEffects.Move) { 230 229 foreach (string item in items) Content.Remove(item); … … 235 234 } 236 235 protected virtual void variableListView_DragEnter(object sender, DragEventArgs e) { 237 validDragOperation = false; 238 if (!Locked && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is object)) { 239 validDragOperation = true; 240 } else if (!Locked && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 241 validDragOperation = true; 242 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 243 foreach (object item in items) 244 validDragOperation = validDragOperation && (item is object); 245 } 236 validDragOperation = !Locked && !ReadOnly && e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null; 246 237 } 247 238 protected virtual void variableListView_DragOver(object sender, DragEventArgs e) { … … 257 248 protected virtual void variableListView_DragDrop(object sender, DragEventArgs e) { 258 249 if (e.Effect != DragDropEffects.None) { 259 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 260 IEnumerable<object> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<object>(); 261 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 262 var cloner = new Cloner(); 263 var clonedItems = new List<object>(); 264 foreach (var item in items) { 265 var dc = item as IDeepCloneable; 266 clonedItems.Add(dc != null ? cloner.Clone(dc) : item); 267 } 268 items = clonedItems; 269 } 270 foreach (var item in items) { 271 string name = GenerateNewVariableName(); 272 Content.Add(name, item); 273 var listViewItem = variableListView.FindItemWithText(name); 274 listViewItem.BeginEdit(); 275 } 276 } else { 277 object item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 278 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 279 var cloner = new Cloner(); 280 var dc = item as IDeepCloneable; 281 if (dc != null) item = cloner.Clone(dc); 282 } 283 string name = GenerateNewVariableName(); 284 Content.Add(name, item); 285 var listViewItem = variableListView.FindItemWithText(name); 286 listViewItem.BeginEdit(); 287 } 250 object item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 251 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 252 var cloner = new Cloner(); 253 var dc = item as IDeepCloneable; 254 if (dc != null) item = cloner.Clone(dc); 255 } 256 string name = GenerateNewVariableName(); 257 Content.Add(name, item); 258 var listViewItem = variableListView.FindItemWithText(name); 259 listViewItem.BeginEdit(); 288 260 } 289 261 } … … 423 395 string toolTipText = string.Join(Environment.NewLine, lines); 424 396 if (!serializable) 425 toolTipText += Environment.NewLine + "CAUTION: Type is not serializable!";397 toolTipText = "Caution: Type is not serializable!" + Environment.NewLine + toolTipText; 426 398 return toolTipText; 427 399 }
Note: See TracChangeset
for help on using the changeset viewer.