Changeset 11565
- Timestamp:
- 11/24/14 03:12:49 (10 years ago)
- Location:
- branches/OptimizationNetworks
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.CodeEditor/3.3/CodeEditor.cs
r10359 r11565 26 26 // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 28 using HeuristicLab.Common.Resources; 29 using ICSharpCode.TextEditor; 30 using ICSharpCode.TextEditor.Document; 28 31 using System; 29 32 using System.CodeDom.Compiler; … … 35 38 using System.Threading; 36 39 using System.Windows.Forms; 37 using HeuristicLab.Common.Resources;38 using ICSharpCode.TextEditor;39 using ICSharpCode.TextEditor.Document;40 40 using Dom = ICSharpCode.SharpDevelop.Dom; 41 41 using NRefactory = ICSharpCode.NRefactory; … … 131 131 Doc.CommitUpdate(); 132 132 } 133 } 134 135 public bool ReadOnly { 136 get { return Doc.ReadOnly; } 137 set { Doc.ReadOnly = value; } 133 138 } 134 139 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/UserDefinedNetworkView.Designer.cs
r11564 r11565 47 47 this.codeTabPage = new System.Windows.Forms.TabPage(); 48 48 this.programmableItemView = new HeuristicLab.Core.Views.ProgrammableItemView(); 49 this.initializeButton = new System.Windows.Forms.Button(); 49 50 this.tabControl.SuspendLayout(); 50 51 this.nodesTabPage.SuspendLayout(); 51 52 this.portsTabPage.SuspendLayout(); 52 53 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 54 this.codeTabPage.SuspendLayout(); 53 55 this.SuspendLayout(); 54 56 // … … 67 69 // codeTabPage 68 70 // 71 this.codeTabPage.Controls.Add(this.initializeButton); 69 72 this.codeTabPage.Controls.Add(this.programmableItemView); 70 73 this.codeTabPage.Location = new System.Drawing.Point(4, 22); … … 80 83 this.programmableItemView.Content = null; 81 84 this.programmableItemView.Dock = System.Windows.Forms.DockStyle.Fill; 82 this.programmableItemView.Location = new System.Drawing.Point( 3, 3);85 this.programmableItemView.Location = new System.Drawing.Point(0, 0); 83 86 this.programmableItemView.Name = "programmableItemView"; 84 87 this.programmableItemView.ReadOnly = false; 85 this.programmableItemView.Size = new System.Drawing.Size(63 1, 459);88 this.programmableItemView.Size = new System.Drawing.Size(637, 465); 86 89 this.programmableItemView.TabIndex = 0; 90 // 91 // initializeButton 92 // 93 this.initializeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh; 94 this.initializeButton.Location = new System.Drawing.Point(33, 3); 95 this.initializeButton.Name = "initializeButton"; 96 this.initializeButton.Size = new System.Drawing.Size(24, 24); 97 this.initializeButton.TabIndex = 1; 98 this.toolTip.SetToolTip(this.initializeButton, "Initialize"); 99 this.initializeButton.UseVisualStyleBackColor = true; 100 this.initializeButton.Click += new System.EventHandler(this.initializeButton_Click); 87 101 // 88 102 // UserDefinedNetworkView … … 93 107 this.portsTabPage.ResumeLayout(false); 94 108 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 109 this.codeTabPage.ResumeLayout(false); 95 110 this.ResumeLayout(false); 96 111 this.PerformLayout(); … … 102 117 protected System.Windows.Forms.TabPage codeTabPage; 103 118 protected HeuristicLab.Core.Views.ProgrammableItemView programmableItemView; 119 protected System.Windows.Forms.Button initializeButton; 104 120 } 105 121 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/UserDefinedNetworkView.cs
r11564 r11565 43 43 programmableItemView.Content = Content; 44 44 } 45 46 protected override void SetEnabledStateOfControls() { 47 base.SetEnabledStateOfControls(); 48 initializeButton.Enabled = Content != null && !ReadOnly && !Locked; 49 } 50 51 private void initializeButton_Click(object sender, System.EventArgs e) { 52 Content.Initialize(); 53 } 45 54 } 46 55 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/UserDefinedNodeView.Designer.cs
r11564 r11565 47 47 this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl(); 48 48 this.portsTabPage = new System.Windows.Forms.TabPage(); 49 this.portCollectionView = new HeuristicLab.Core.Networks.Views.PortCollectionView(); 49 50 this.codeTabPage = new System.Windows.Forms.TabPage(); 50 this.portCollectionView = new HeuristicLab.Core.Networks.Views.PortCollectionView();51 51 this.programmableItemView = new HeuristicLab.Core.Views.ProgrammableItemView(); 52 this.initializeButton = new System.Windows.Forms.Button(); 52 53 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 53 54 this.tabControl.SuspendLayout(); 54 55 this.portsTabPage.SuspendLayout(); 56 this.codeTabPage.SuspendLayout(); 55 57 this.SuspendLayout(); 56 58 // … … 85 87 this.portsTabPage.UseVisualStyleBackColor = true; 86 88 // 87 // codeTabPage88 //89 this.codeTabPage.Controls.Add(this.programmableItemView);90 this.codeTabPage.Location = new System.Drawing.Point(4, 22);91 this.codeTabPage.Name = "codeTabPage";92 this.codeTabPage.Padding = new System.Windows.Forms.Padding(3);93 this.codeTabPage.Size = new System.Drawing.Size(637, 465);94 this.codeTabPage.TabIndex = 1;95 this.codeTabPage.Text = "Code";96 this.codeTabPage.UseVisualStyleBackColor = true;97 //98 89 // portCollectionView 99 90 // … … 108 99 this.portCollectionView.TabIndex = 0; 109 100 // 101 // codeTabPage 102 // 103 this.codeTabPage.Controls.Add(this.initializeButton); 104 this.codeTabPage.Controls.Add(this.programmableItemView); 105 this.codeTabPage.Location = new System.Drawing.Point(4, 22); 106 this.codeTabPage.Name = "codeTabPage"; 107 this.codeTabPage.Padding = new System.Windows.Forms.Padding(3); 108 this.codeTabPage.Size = new System.Drawing.Size(637, 465); 109 this.codeTabPage.TabIndex = 1; 110 this.codeTabPage.Text = "Code"; 111 this.codeTabPage.UseVisualStyleBackColor = true; 112 // 110 113 // programmableItemView 111 114 // … … 118 121 this.programmableItemView.Size = new System.Drawing.Size(631, 459); 119 122 this.programmableItemView.TabIndex = 0; 123 // 124 // initializeButton 125 // 126 this.initializeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh; 127 this.initializeButton.Location = new System.Drawing.Point(36, 6); 128 this.initializeButton.Name = "initializeButton"; 129 this.initializeButton.Size = new System.Drawing.Size(24, 24); 130 this.initializeButton.TabIndex = 1; 131 this.toolTip.SetToolTip(this.initializeButton, "Initialize"); 132 this.initializeButton.UseVisualStyleBackColor = true; 133 this.initializeButton.Click += new System.EventHandler(this.initializeButton_Click); 120 134 // 121 135 // UserDefinedNodeView … … 130 144 this.tabControl.ResumeLayout(false); 131 145 this.portsTabPage.ResumeLayout(false); 146 this.codeTabPage.ResumeLayout(false); 132 147 this.ResumeLayout(false); 133 148 this.PerformLayout(); … … 142 157 protected System.Windows.Forms.TabPage codeTabPage; 143 158 protected HeuristicLab.Core.Views.ProgrammableItemView programmableItemView; 159 protected System.Windows.Forms.Button initializeButton; 144 160 145 161 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/UserDefinedNodeView.cs
r11564 r11565 42 42 programmableItemView.Content = Content; 43 43 } 44 45 protected override void SetEnabledStateOfControls() { 46 base.SetEnabledStateOfControls(); 47 initializeButton.Enabled = Content != null && !ReadOnly && !Locked; 48 } 49 50 private void initializeButton_Click(object sender, System.EventArgs e) { 51 Content.Initialize(); 52 } 44 53 } 45 54 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Views/ProgrammableItemView.cs
r11564 r11565 21 21 22 22 using HeuristicLab.Common.Resources; 23 using HeuristicLab.Core.Views;24 23 using HeuristicLab.MainForm; 25 24 using HeuristicLab.PluginInfrastructure; … … 71 70 protected override void SetEnabledStateOfControls() { 72 71 base.SetEnabledStateOfControls(); 73 compileButton.Enabled = Content != null && !Locked && !ReadOnly; 74 codeEditor.Enabled = Content != null; 72 compileButton.Enabled = Content != null && Content.CanChangeCode && !Locked && !ReadOnly; 73 codeEditor.Enabled = Content != null && !Locked; 74 codeEditor.ReadOnly = ReadOnly || Locked || ((Content != null) && !Content.CanChangeCode); 75 75 } 76 76 … … 97 97 } 98 98 private void codeEditor_Validated(object sender, EventArgs e) { 99 if ( Content != null) Content.Code = codeEditor.UserCode;99 if ((Content != null) && Content.CanChangeCode) Content.Code = codeEditor.UserCode; 100 100 } 101 101 private void errorsListView_DoubleClick(object sender, EventArgs e) { -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/IUserDefinedNetwork.cs
r11564 r11565 24 24 new PortCollection Ports { get; } 25 25 new NodeCollection Nodes { get; } 26 27 void Initialize(); 26 28 } 27 29 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/IUserDefinedNode.cs
r11564 r11565 23 23 public interface IUserDefinedNode : IProgrammableNode { 24 24 new PortCollection Ports { get; } 25 26 void Initialize(); 25 27 } 26 28 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ProgrammableNetwork.cs
r11564 r11565 103 103 } 104 104 105 public override void Initialize() { 106 base.Initialize(); 107 Nodes.Clear(); 108 } 109 105 110 #region Events 106 111 public override void RegisterEvents() { -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ProgrammableNetworkItem.cs
r11564 r11565 100 100 get { return ReadCodeTemplate("HeuristicLab.Optimization.Networks.Core.Networks.ProgrammableNetworkItemTemplate.cs"); } 101 101 } 102 103 102 [Storable] 104 103 private string code; … … 106 105 get { return code; } 107 106 set { 107 if (!CanChangeCode) throw new NotSupportedException("Code cannot be changed."); 108 108 if (value != code) { 109 109 code = value; … … 112 112 } 113 113 } 114 115 114 private CompilerErrorCollection compileErrors; 116 115 public CompilerErrorCollection CompileErrors { … … 120 119 OnCompileErrorsChanged(); 121 120 } 121 } 122 public virtual bool CanChangeCode { 123 get { return false; } 122 124 } 123 125 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ProgrammableNode.cs
r11564 r11565 119 119 } 120 120 121 public override void Initialize() { 122 base.Initialize(); 123 Ports.Clear(); 124 } 125 121 126 protected virtual void MessagePort_MessageReceived(object sender, EventArgs<IMessage, CancellationToken> e) { } 122 127 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/UserDefinedNetwork.cs
r11564 r11565 34 34 get { return base.Nodes; } 35 35 } 36 public override bool CanChangeCode { 37 get { return true; } 38 } 36 39 37 40 [StorableConstructor] … … 45 48 return new UserDefinedNetwork(this, cloner); 46 49 } 50 51 public void Initialize() { 52 CompiledNetworkItem.DeregisterEvents(); 53 CompiledNetworkItem.Initialize(); 54 CompiledNetworkItem.RegisterEvents(); 55 } 47 56 } 48 57 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/UserDefinedNode.cs
r11564 r11565 30 30 get { return base.Ports; } 31 31 } 32 public override bool CanChangeCode { 33 get { return true; } 34 } 32 35 33 36 [StorableConstructor] … … 41 44 return new UserDefinedNode(this, cloner); 42 45 } 46 47 public void Initialize() { 48 CompiledNetworkItem.DeregisterEvents(); 49 CompiledNetworkItem.Initialize(); 50 CompiledNetworkItem.RegisterEvents(); 51 } 43 52 } 44 53 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core/IProgrammableItem.cs
r11564 r11565 29 29 string Code { get; set; } 30 30 CompilerErrorCollection CompileErrors { get; } 31 bool CanChangeCode { get; } 31 32 32 33 void Compile(); -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj
r11564 r11565 153 153 </ItemGroup> 154 154 <ItemGroup> 155 <ProjectReference Include="..\..\HeuristicLab.Algorithms.GeneticAlgorithm\3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj">156 <Project>{a51da44f-cb35-4f6f-99f5-2a2e904ab93b}</Project>157 <Name>HeuristicLab.Algorithms.GeneticAlgorithm-3.3</Name>158 <Private>False</Private>159 </ProjectReference>160 155 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 161 156 <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project> … … 183 178 <Private>False</Private> 184 179 </ProjectReference> 185 <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj">186 <Project>{66d249c3-a01d-42a8-82a2-919bc8ec3d83}</Project>187 <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name>188 <Private>False</Private>189 </ProjectReference>190 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj">191 <Project>{dbecb8b0-b166-4133-baf1-ed67c3fd7fca}</Project>192 <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name>193 <Private>False</Private>194 </ProjectReference>195 180 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 196 181 <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project> … … 216 201 <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project> 217 202 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 218 <Private>False</Private>219 </ProjectReference>220 <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">221 <Project>{3540e29e-4793-49e7-8ee2-fea7f61c3994}</Project>222 <Name>HeuristicLab.Problems.Instances-3.3</Name>223 <Private>False</Private>224 </ProjectReference>225 <ProjectReference Include="..\..\HeuristicLab.Problems.Knapsack\3.3\HeuristicLab.Problems.Knapsack-3.3.csproj">226 <Project>{e10f395f-c8a6-48ad-b470-9aa7a1f43809}</Project>227 <Name>HeuristicLab.Problems.Knapsack-3.3</Name>228 <Private>False</Private>229 </ProjectReference>230 <ProjectReference Include="..\..\HeuristicLab.Problems.TravelingSalesman\3.3\HeuristicLab.Problems.TravelingSalesman-3.3.csproj">231 <Project>{d767c38d-8014-46b0-9a32-03a3aecce34a}</Project>232 <Name>HeuristicLab.Problems.TravelingSalesman-3.3</Name>233 203 <Private>False</Private> 234 204 </ProjectReference> -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks.KSPTSP/KSPTSPConnectorCode.cs
r11564 r11565 28 28 using System.Drawing; 29 29 using System.Linq; 30 using System.Threading; 30 31 31 32 namespace HeuristicLab.Optimization.Networks.KSPTSP { … … 48 49 49 50 public override void Initialize() { 51 base.Initialize(); 50 52 var parameters = new MessagePort("Parameters"); 51 53 Ports.Add(parameters); … … 78 80 } 79 81 80 private void Knapsack_MessageReceived(object sender, EventArgs<IMessage, System.Threading.CancellationToken> e) {82 private void Knapsack_MessageReceived(object sender, EventArgs<IMessage, CancellationToken> e) { 81 83 // get parameters 82 84 var parametersPort = (IMessagePort)Ports["Parameters"]; -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks.KSPTSP/KSPTSPNetworkCode.cs
r11564 r11565 53 53 54 54 public override void Initialize() { 55 base.Initialize(); 56 55 57 #region ParametersNode 56 58 var paramsNode = new UserDefinedNode("ParametersNode"); -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Plugin.cs.frame
r11520 r11565 28 28 [Plugin("HeuristicLab.Optimization.Networks", "3.3.11.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Optimization.Networks-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Algorithms.GeneticAlgorithm", "3.3")]31 30 [PluginDependency("HeuristicLab.Collections", "3.3")] 32 31 [PluginDependency("HeuristicLab.Common", "3.3")] … … 34 33 [PluginDependency("HeuristicLab.Core", "3.3")] 35 34 [PluginDependency("HeuristicLab.Data", "3.3")] 36 [PluginDependency("HeuristicLab.Encodings.BinaryVectorEncoding", "3.3")]37 [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")]38 35 [PluginDependency("HeuristicLab.Operators", "3.3")] 39 36 [PluginDependency("HeuristicLab.Optimization", "3.3")] 40 37 [PluginDependency("HeuristicLab.Parameters", "3.3")] 41 38 [PluginDependency("HeuristicLab.Persistence", "3.3")] 42 [PluginDependency("HeuristicLab.Problems.Knapsack", "3.3")]43 [PluginDependency("HeuristicLab.Problems.TravelingSalesman", "3.3")]44 39 public class HeuristicLabOptimizationNetworksPlugin : PluginBase { 45 40 }
Note: See TracChangeset
for help on using the changeset viewer.