Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/07/09 02:44:23 (15 years ago)
Author:
swagner
Message:

Continued work on Optimizer and on adapting all views to the new MainForm concept (#770)

Location:
trunk/sources/HeuristicLab.Optimizer/3.3
Files:
3 added
1 deleted
16 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj

    r2520 r2546  
    5151  </ItemGroup>
    5252  <ItemGroup>
    53     <Compile Include="Actions\SaveAsAction.cs" />
    54     <Compile Include="Actions\SaveAllAction.cs" />
    55     <Compile Include="Actions\SaveAction.cs" />
    56     <Compile Include="Actions\OpenAction.cs" />
    57     <Compile Include="Actions\NewAction.cs" />
     53    <Compile Include="FileManager.cs" />
    5854    <Compile Include="MenuItems\CloseMenuItem.cs" />
    5955    <Compile Include="MenuItems\CloseAllMenuItem.cs" />
     
    6864    <Compile Include="MenuItems\NewMenuItem.cs" />
    6965    <Compile Include="MenuItems\Separators.cs" />
    70     <Compile Include="NewDialog.cs">
     66    <Compile Include="NewItemDialog.cs">
    7167      <SubType>Form</SubType>
    7268    </Compile>
    73     <Compile Include="NewDialog.Designer.cs">
    74       <DependentUpon>NewDialog.cs</DependentUpon>
     69    <Compile Include="NewItemDialog.Designer.cs">
     70      <DependentUpon>NewItemDialog.cs</DependentUpon>
    7571    </Compile>
    7672    <Compile Include="Properties\AssemblyInfo.cs" />
     73    <Compile Include="Properties\Resources.Designer.cs">
     74      <AutoGen>True</AutoGen>
     75      <DesignTime>True</DesignTime>
     76      <DependentUpon>Resources.resx</DependentUpon>
     77    </Compile>
    7778    <Compile Include="ToolBarItems\SaveAllToolBarItem.cs" />
    7879    <Compile Include="ToolBarItems\SaveToolBarItem.cs" />
     
    8990      <Name>HeuristicLab.Common.Resources-3.2</Name>
    9091    </ProjectReference>
     92    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
     93      <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
     94      <Name>HeuristicLab.Core.Views-3.3</Name>
     95    </ProjectReference>
     96    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     97      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
     98      <Name>HeuristicLab.Core-3.3</Name>
     99    </ProjectReference>
    91100    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.2\HeuristicLab.MainForm.WindowsForms-3.2.csproj">
    92101      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
     
    97106      <Name>HeuristicLab.MainForm-3.2</Name>
    98107    </ProjectReference>
     108    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     109      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
     110      <Name>HeuristicLab.Persistence-3.3</Name>
     111    </ProjectReference>
    99112    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
    100113      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
     
    103116  </ItemGroup>
    104117  <ItemGroup>
    105     <EmbeddedResource Include="NewDialog.resx">
    106       <DependentUpon>NewDialog.cs</DependentUpon>
     118    <EmbeddedResource Include="NewItemDialog.resx">
     119      <DependentUpon>NewItemDialog.cs</DependentUpon>
     120    </EmbeddedResource>
     121    <EmbeddedResource Include="Properties\Resources.resx">
     122      <Generator>ResXFileCodeGenerator</Generator>
     123      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    107124    </EmbeddedResource>
    108125  </ItemGroup>
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLabOptimizerApplication.cs

    r2520 r2546  
    3131namespace HeuristicLab.Optimizer {
    3232  [ClassInfo(Name = "Optimizer 3.3", Description="Next generation heuristic optimization environment.")]
    33   class HeuristicLabOptimizerApplication : ApplicationBase {
     33  internal class HeuristicLabOptimizerApplication : ApplicationBase {
    3434    public override void Run() {
    3535      DockingMainForm mainForm = new DockingMainForm(typeof(IOptimizerUserInterfaceItemProvider));
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLabOptimizerPlugin.cs

    r2501 r2546  
    2828  [ClassInfo(Name = "HeuristicLab.Optimizer-3.3")]
    2929  [PluginFile(Filename = "HeuristicLab.Optimizer-3.3.dll", Filetype = PluginFileType.Assembly)]
     30  [Dependency(Dependency = "HeuristicLab.Persistence-3.3")]
    3031  [Dependency(Dependency = "HeuristicLab.Common.Resources-3.2")]
     32  [Dependency(Dependency = "HeuristicLab.Core-3.3")]
     33  [Dependency(Dependency = "HeuristicLab.Core.Views-3.3")]
    3134  [Dependency(Dependency = "HeuristicLab.MainForm-3.2")]
    3235  [Dependency(Dependency = "HeuristicLab.MainForm.WindowsForms-3.2")]
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/CloseAllMenuItem.cs

    r2520 r2546  
    1010
    1111namespace HeuristicLab.Optimizer.MenuItems {
    12   public class CloseAllMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class CloseAllMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1313    public override string Name {
    1414      get { return "Clos&e All"; }
    1515    }
    16 
    1716    public override IEnumerable<string> Structure {
    1817      get { return new string[] { "&File" }; }
    1918    }
    20 
    2119    public override int Position {
    2220      get { return 1700; }
     21    }
     22
     23    public override void MainFormInitialized(object sender, EventArgs e) {
     24      ToolStripItem.Enabled = false;
     25    }
     26    public override void ActiveViewChanged(object sender, EventArgs e) {
     27      ToolStripItem.Enabled = MainFormManager.MainForm.Views.FirstOrDefault() != null;
    2328    }
    2429
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/CloseMenuItem.cs

    r2520 r2546  
    1010
    1111namespace HeuristicLab.Optimizer.MenuItems {
    12   public class CloseMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class CloseMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1313    public override string Name {
    1414      get { return "&Close"; }
    1515    }
    16 
    1716    public override IEnumerable<string> Structure {
    1817      get { return new string[] { "&File" }; }
    1918    }
    20 
    2119    public override int Position {
    2220      get { return 1600; }
     21    }
     22
     23    public override void MainFormInitialized(object sender, EventArgs e) {
     24      ToolStripItem.Enabled = false;
     25    }
     26    public override void ActiveViewChanged(object sender, EventArgs e) {
     27      ToolStripItem.Enabled = MainFormManager.MainForm.Views.FirstOrDefault() != null;
    2328    }
    2429
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/ExitMenuItem.cs

    r2520 r2546  
    1010
    1111namespace HeuristicLab.Optimizer.MenuItems {
    12   public class ExitMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class ExitMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1313    public override IEnumerable<string> Structure {
    1414      get { return new string[] { "&File" }; }
    1515    }
    16 
    1716    public override string Name {
    1817      get { return "E&xit"; }
    1918    }
    20 
    2119    public override int Position {
    2220      get { return 1999; }
    2321    }
    24 
    2522    public override Keys ShortCutKeys {
    2623      get { return Keys.Control | Keys.X; }
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/NewMenuItem.cs

    r2520 r2546  
    99
    1010namespace HeuristicLab.Optimizer.MenuItems {
    11   public class NewMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     11  internal class NewMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1212    public override string Name {
    1313      get { return "&New..."; }
    1414    }
    15 
    1615    public override IEnumerable<string> Structure {
    1716      get { return new string[] { "&File" }; }
    1817    }
    19 
    2018    public override int Position {
    2119      get { return 1100; }
    2220    }
    23 
    2421    public override ToolStripItemDisplayStyle ToolStripItemDisplayStyle {
    2522      get { return ToolStripItemDisplayStyle.ImageAndText; }
    2623    }
    27 
    2824    public override Image Image {
    2925      get { return Resources.NewIcon; }
    3026    }
    31 
    3227    public override Keys ShortCutKeys {
    3328      get { return Keys.Control | Keys.N; }
     
    3530
    3631    public override void Execute() {
    37       Actions.NewAction.Execute();
     32      FileManager.New();
    3833    }
    3934  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/OpenMenuItem.cs

    r2520 r2546  
    99
    1010namespace HeuristicLab.Optimizer.MenuItems {
    11   public class OpenMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     11  internal class OpenMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1212    public override string Name {
    1313      get { return "&Open..."; }
    1414    }
    15 
    1615    public override IEnumerable<string> Structure {
    1716      get { return new string[] { "&File" }; }
    1817    }
    19 
    2018    public override int Position {
    2119      get { return 1200; }
    2220    }
    23 
    2421    public override ToolStripItemDisplayStyle ToolStripItemDisplayStyle {
    2522      get { return ToolStripItemDisplayStyle.ImageAndText; }
    2623    }
    27 
    2824    public override Image Image {
    2925      get { return Resources.OpenIcon; }
    3026    }
    31 
    3227    public override Keys ShortCutKeys {
    3328      get { return Keys.Control | Keys.O; }
     
    3530
    3631    public override void Execute() {
    37       Actions.OpenAction.Execute();
     32      FileManager.Open();
    3833    }
    3934  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveAllMenuItem.cs

    r2520 r2546  
    55using System.Windows.Forms;
    66using System.Drawing;
     7using HeuristicLab.MainForm;
    78using HeuristicLab.MainForm.WindowsForms;
    89using HeuristicLab.Common.Resources;
    910
    1011namespace HeuristicLab.Optimizer.MenuItems {
    11   public class SaveAllMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class SaveAllMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1213    public override string Name {
    1314      get { return "Save Al&l"; }
    1415    }
    15 
    1616    public override IEnumerable<string> Structure {
    1717      get { return new string[] { "&File" }; }
    1818    }
    19 
    2019    public override int Position {
    2120      get { return 1500; }
    2221    }
    23 
    2422    public override ToolStripItemDisplayStyle ToolStripItemDisplayStyle {
    2523      get { return ToolStripItemDisplayStyle.ImageAndText; }
    2624    }
    27 
    2825    public override Image Image {
    2926      get { return Resources.SaveAllIcon; }
    3027    }
    3128
     29    public override void MainFormInitialized(object sender, EventArgs e) {
     30      ToolStripItem.Enabled = false;
     31    }
     32    public override void ActiveViewChanged(object sender, EventArgs e) {
     33      ToolStripItem.Enabled = MainFormManager.MainForm.Views.FirstOrDefault() != null;
     34    }
     35
    3236    public override void Execute() {
    33       Actions.SaveAllAction.Execute();
     37      FileManager.SaveAll();
    3438    }
    3539  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveAsMenuItem.cs

    r2520 r2546  
    55using System.Windows.Forms;
    66using System.Drawing;
     7using HeuristicLab.MainForm;
    78using HeuristicLab.MainForm.WindowsForms;
    89using HeuristicLab.Common.Resources;
     10using HeuristicLab.Core;
     11using HeuristicLab.Core.Views;
    912
    1013namespace HeuristicLab.Optimizer.MenuItems {
    11   public class SaveAsMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     14  internal class SaveAsMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1215    public override string Name {
    1316      get { return "Save &As..."; }
    1417    }
    15 
    1618    public override IEnumerable<string> Structure {
    1719      get { return new string[] { "&File" }; }
    1820    }
    19 
    2021    public override int Position {
    2122      get { return 1400; }
    2223    }
    23 
    2424    public override ToolStripItemDisplayStyle ToolStripItemDisplayStyle {
    2525      get { return ToolStripItemDisplayStyle.ImageAndText; }
    2626    }
    27 
    2827    public override Keys ShortCutKeys {
    2928      get { return Keys.Control | Keys.Shift | Keys.S; }
    3029    }
    3130
     31    public override void MainFormInitialized(object sender, EventArgs e) {
     32      ToolStripItem.Enabled = false;
     33    }
     34    public override void ActiveViewChanged(object sender, EventArgs e) {
     35      IItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;
     36      ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Item.GetType())));
     37    }
     38
    3239    public override void Execute() {
    33       Actions.SaveAsAction.Execute();
     40      FileManager.SaveAs();
    3441    }
    3542  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveMenuItem.cs

    r2520 r2546  
    55using System.Windows.Forms;
    66using System.Drawing;
     7using HeuristicLab.MainForm;
    78using HeuristicLab.MainForm.WindowsForms;
    89using HeuristicLab.Common.Resources;
     10using HeuristicLab.Core;
     11using HeuristicLab.Core.Views;
    912
    1013namespace HeuristicLab.Optimizer.MenuItems {
    11   public class SaveMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
     14  internal class SaveMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItemBase, IOptimizerUserInterfaceItemProvider {
    1215    public override string Name {
    1316      get { return "&Save"; }
    1417    }
    15 
    1618    public override IEnumerable<string> Structure {
    1719      get { return new string[] { "&File" }; }
    1820    }
    19 
    2021    public override int Position {
    2122      get { return 1300; }
    2223    }
    23 
    2424    public override ToolStripItemDisplayStyle ToolStripItemDisplayStyle {
    2525      get { return ToolStripItemDisplayStyle.ImageAndText; }
    2626    }
    27 
    2827    public override Image Image {
    2928      get { return Resources.SaveIcon; }
    3029    }
    31 
    3230    public override Keys ShortCutKeys {
    3331      get { return Keys.Control | Keys.S; }
    3432    }
    3533
     34    public override void MainFormInitialized(object sender, EventArgs e) {
     35      ToolStripItem.Enabled = false;
     36    }
     37    public override void ActiveViewChanged(object sender, EventArgs e) {
     38      IItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;
     39      ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Item.GetType())));
     40    }
     41
    3642    public override void Execute() {
    37       Actions.SaveAction.Execute();
     43      FileManager.Save();
    3844    }
    3945  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/Separators.cs

    r2520 r2546  
    1010
    1111namespace HeuristicLab.Optimizer.MenuItems {
    12   public class SeparatorMenuItem : MenuSeparatorItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class SeparatorMenuItem : MenuSeparatorItemBase, IOptimizerUserInterfaceItemProvider {
    1313    public override IEnumerable<string> Structure {
    1414      get { return new string[] { "&File" }; }
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.Designer.cs

    r2537 r2546  
    11namespace HeuristicLab.Optimizer {
    2   partial class NewDialog {
     2  partial class NewItemDialog {
    33    /// <summary>
    44    /// Required designer variable.
     
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      this.components = new System.ComponentModel.Container();
     27      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewItemDialog));
    2628      this.okButton = new System.Windows.Forms.Button();
    2729      this.cancelButton = new System.Windows.Forms.Button();
     30      this.itemsListView = new System.Windows.Forms.ListView();
     31      this.nameColumnHeader = new System.Windows.Forms.ColumnHeader();
     32      this.descriptioncolumnHeader = new System.Windows.Forms.ColumnHeader();
     33      this.itemsLabel = new System.Windows.Forms.Label();
     34      this.showIconsCheckBox = new System.Windows.Forms.CheckBox();
     35      this.showDetailsCheckBox = new System.Windows.Forms.CheckBox();
     36      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    2837      this.SuspendLayout();
    2938      //
     
    3342      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    3443      this.okButton.Enabled = false;
    35       this.okButton.Location = new System.Drawing.Point(380, 315);
     44      this.okButton.Location = new System.Drawing.Point(456, 409);
    3645      this.okButton.Name = "okButton";
    3746      this.okButton.Size = new System.Drawing.Size(75, 23);
    38       this.okButton.TabIndex = 0;
     47      this.okButton.TabIndex = 2;
    3948      this.okButton.Text = "&OK";
    4049      this.okButton.UseVisualStyleBackColor = true;
     50      this.okButton.Click += new System.EventHandler(this.okButton_Click);
    4151      //
    4252      // cancelButton
     
    4454      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    4555      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    46       this.cancelButton.Location = new System.Drawing.Point(461, 315);
     56      this.cancelButton.Location = new System.Drawing.Point(537, 409);
    4757      this.cancelButton.Name = "cancelButton";
    4858      this.cancelButton.Size = new System.Drawing.Size(75, 23);
    49       this.cancelButton.TabIndex = 0;
     59      this.cancelButton.TabIndex = 3;
    5060      this.cancelButton.Text = "&Cancel";
    5161      this.cancelButton.UseVisualStyleBackColor = true;
    5262      //
    53       // NewDialog
     63      // itemsListView
     64      //
     65      this.itemsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     66                  | System.Windows.Forms.AnchorStyles.Left)
     67                  | System.Windows.Forms.AnchorStyles.Right)));
     68      this.itemsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     69            this.nameColumnHeader,
     70            this.descriptioncolumnHeader});
     71      this.itemsListView.HideSelection = false;
     72      this.itemsListView.Location = new System.Drawing.Point(12, 33);
     73      this.itemsListView.MultiSelect = false;
     74      this.itemsListView.Name = "itemsListView";
     75      this.itemsListView.Size = new System.Drawing.Size(600, 370);
     76      this.itemsListView.TabIndex = 1;
     77      this.itemsListView.UseCompatibleStateImageBehavior = false;
     78      this.itemsListView.View = System.Windows.Forms.View.SmallIcon;
     79      this.itemsListView.SelectedIndexChanged += new System.EventHandler(this.itemTypesListView_SelectedIndexChanged);
     80      this.itemsListView.DoubleClick += new System.EventHandler(this.itemTypesListView_DoubleClick);
     81      //
     82      // nameColumnHeader
     83      //
     84      this.nameColumnHeader.Text = "Name";
     85      //
     86      // descriptioncolumnHeader
     87      //
     88      this.descriptioncolumnHeader.Text = "Description";
     89      //
     90      // itemsLabel
     91      //
     92      this.itemsLabel.AutoSize = true;
     93      this.itemsLabel.Location = new System.Drawing.Point(12, 9);
     94      this.itemsLabel.Name = "itemsLabel";
     95      this.itemsLabel.Size = new System.Drawing.Size(35, 13);
     96      this.itemsLabel.TabIndex = 0;
     97      this.itemsLabel.Text = "&Items:";
     98      //
     99      // showIconsCheckBox
     100      //
     101      this.showIconsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     102      this.showIconsCheckBox.Appearance = System.Windows.Forms.Appearance.Button;
     103      this.showIconsCheckBox.Checked = true;
     104      this.showIconsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     105      this.showIconsCheckBox.Image = ((System.Drawing.Image)(resources.GetObject("showIconsCheckBox.Image")));
     106      this.showIconsCheckBox.Location = new System.Drawing.Point(558, 3);
     107      this.showIconsCheckBox.Name = "showIconsCheckBox";
     108      this.showIconsCheckBox.Size = new System.Drawing.Size(24, 24);
     109      this.showIconsCheckBox.TabIndex = 4;
     110      this.toolTip.SetToolTip(this.showIconsCheckBox, "Show Icons");
     111      this.showIconsCheckBox.UseVisualStyleBackColor = true;
     112      this.showIconsCheckBox.Click += new System.EventHandler(this.showIconsCheckBox_Click);
     113      //
     114      // showDetailsCheckBox
     115      //
     116      this.showDetailsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     117      this.showDetailsCheckBox.Appearance = System.Windows.Forms.Appearance.Button;
     118      this.showDetailsCheckBox.Image = ((System.Drawing.Image)(resources.GetObject("showDetailsCheckBox.Image")));
     119      this.showDetailsCheckBox.Location = new System.Drawing.Point(588, 3);
     120      this.showDetailsCheckBox.Name = "showDetailsCheckBox";
     121      this.showDetailsCheckBox.Size = new System.Drawing.Size(24, 24);
     122      this.showDetailsCheckBox.TabIndex = 5;
     123      this.toolTip.SetToolTip(this.showDetailsCheckBox, "Show Details");
     124      this.showDetailsCheckBox.UseVisualStyleBackColor = true;
     125      this.showDetailsCheckBox.Click += new System.EventHandler(this.showDetailsCheckBox_Click);
     126      //
     127      // NewItemDialog
    54128      //
    55129      this.AcceptButton = this.okButton;
     
    57131      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    58132      this.CancelButton = this.cancelButton;
    59       this.ClientSize = new System.Drawing.Size(548, 350);
     133      this.ClientSize = new System.Drawing.Size(624, 444);
     134      this.Controls.Add(this.showDetailsCheckBox);
     135      this.Controls.Add(this.showIconsCheckBox);
     136      this.Controls.Add(this.itemsLabel);
     137      this.Controls.Add(this.itemsListView);
    60138      this.Controls.Add(this.cancelButton);
    61139      this.Controls.Add(this.okButton);
    62       this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
    63140      this.MaximizeBox = false;
    64141      this.MinimizeBox = false;
    65       this.Name = "NewDialog";
     142      this.Name = "NewItemDialog";
     143      this.ShowIcon = false;
    66144      this.ShowInTaskbar = false;
    67145      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    68146      this.Text = "New Item";
    69147      this.TopMost = true;
     148      this.Load += new System.EventHandler(this.NewItemDialog_Load);
     149      this.Shown += new System.EventHandler(this.NewItemDialog_Shown);
    70150      this.ResumeLayout(false);
     151      this.PerformLayout();
    71152
    72153    }
     
    76157    private System.Windows.Forms.Button okButton;
    77158    private System.Windows.Forms.Button cancelButton;
     159    private System.Windows.Forms.ListView itemsListView;
     160    private System.Windows.Forms.Label itemsLabel;
     161    private System.Windows.Forms.CheckBox showIconsCheckBox;
     162    private System.Windows.Forms.CheckBox showDetailsCheckBox;
     163    private System.Windows.Forms.ToolTip toolTip;
     164    private System.Windows.Forms.ColumnHeader nameColumnHeader;
     165    private System.Windows.Forms.ColumnHeader descriptioncolumnHeader;
    78166  }
    79167}
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.cs

    r2537 r2546  
    77using System.Text;
    88using System.Windows.Forms;
     9using HeuristicLab.PluginInfrastructure;
     10using HeuristicLab.Common.Resources;
     11using HeuristicLab.Core;
    912
    1013namespace HeuristicLab.Optimizer {
    11   public partial class NewDialog : Form {
    12     private Type newItemType;
    13     public Type NewItemType {
    14       get { return newItemType; }
     14  internal partial class NewItemDialog : Form {
     15    private bool initialized;
     16    private List<IItem> items;
     17
     18    private IItem item;
     19    public IItem Item {
     20      get { return item; }
    1521    }
    1622
    17     public NewDialog() {
     23    public NewItemDialog() {
     24      initialized = false;
     25      items = new List<IItem>();
     26      item = null;
    1827      InitializeComponent();
    19       newItemType = null;
     28    }
     29
     30    private void NewItemDialog_Load(object sender, EventArgs e) {
     31      if (!initialized) {
     32        SetListViewDisplayStyleCheckBoxes();
     33
     34        DiscoveryService ds = new DiscoveryService();
     35        var categories = from t in ds.GetTypes(typeof(IItem))
     36                         where CreatableAttribute.IsCreatable(t)
     37                         orderby CreatableAttribute.GetCategory(t), ItemAttribute.GetName(t) ascending
     38                         group t by CreatableAttribute.GetCategory(t) into c
     39                         select c;
     40
     41        itemsListView.SmallImageList = new ImageList();
     42        foreach (var category in categories) {
     43          ListViewGroup group = new ListViewGroup(category.Key);
     44          itemsListView.Groups.Add(group);
     45          foreach (var creatable in category) {
     46            IItem i = (IItem)Activator.CreateInstance(creatable);
     47            items.Add(i);
     48            ListViewItem item = new ListViewItem(new string[] { i.Name, i.Description}, group);
     49            itemsListView.SmallImageList.Images.Add(i.Image);
     50            item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     51            item.Tag = i;
     52            itemsListView.Items.Add(item);
     53          }
     54        }
     55        initialized = true;
     56      }
     57    }
     58
     59    private void NewItemDialog_Shown(object sender, EventArgs e) {
     60      item = null;
     61    }
     62
     63    private void itemTypesListView_SelectedIndexChanged(object sender, EventArgs e) {
     64      okButton.Enabled = itemsListView.SelectedItems.Count == 1;
     65    }
     66
     67    private void okButton_Click(object sender, EventArgs e) {
     68      if (itemsListView.SelectedItems.Count == 1) {
     69        item = (IItem)((IItem)itemsListView.SelectedItems[0].Tag).Clone();
     70        DialogResult = DialogResult.OK;
     71        Close();
     72      }
     73    }
     74    private void itemTypesListView_DoubleClick(object sender, EventArgs e) {
     75      if (itemsListView.SelectedItems.Count == 1) {
     76        item = (IItem)((IItem)itemsListView.SelectedItems[0].Tag).Clone();
     77        DialogResult = DialogResult.OK;
     78        Close();
     79      }
     80    }
     81
     82    private void showIconsCheckBox_Click(object sender, EventArgs e) {
     83      itemsListView.View = View.SmallIcon;
     84      SetListViewDisplayStyleCheckBoxes();
     85    }
     86    private void showDetailsCheckBox_Click(object sender, EventArgs e) {
     87      itemsListView.View = View.Details;
     88      SetListViewDisplayStyleCheckBoxes();
     89      for (int i = 0; i < itemsListView.Columns.Count; i++)
     90        itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     91    }
     92    private void SetListViewDisplayStyleCheckBoxes() {
     93      showIconsCheckBox.Checked = itemsListView.View == View.SmallIcon;
     94      showDetailsCheckBox.Checked = itemsListView.View == View.Details;
    2095    }
    2196  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.resx

    r2537 r2546  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     121  <data name="showIconsCheckBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     122    <value>
     123        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
     124        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAHdJREFUOE9j/P//
     125        PwOlAGQCJZjhP5dKFlkYajFFtoP9DwwG8gDcBTDtDAwNQBMhmBiA1QCQRmINwWkAzBBCLsPrBWRvwNjo
     126        LsMwAJe/sRkGcSU4BhGxgJ6gsHkB1TA0A4gJeWQ1JHgBNbEhXEYtF1CUmUCBSQkGALV/aRnqsiFZAAAA
     127        AElFTkSuQmCC
     128</value>
     129  </data>
     130  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     131    <value>17, 17</value>
     132  </metadata>
     133  <data name="showDetailsCheckBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     134    <value>
     135        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
     136        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAF5JREFUOE9j/P//
     137        PwOlAGQCJZjhP5dKFlkYajFFtoP9DwwG8gDcBdi0I4cLSB6djyRGRRcwMDQAbSKMYS7G6wViQgXDAJDt
     138        aKaD/U7fMBhYFxATcMhqqJOUQYmMEgwAizNpEwxYZgUAAAAASUVORK5CYII=
     139</value>
     140  </data>
    120141</root>
  • trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/NewToolBarItem.cs

    r2520 r2546  
    1010
    1111namespace HeuristicLab.Optimizer {
    12   public class NewToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class NewToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
    1313    public override string Name {
    1414      get { return "New..."; }
    1515    }
    16 
    1716    public override string ToolTipText {
    1817      get { return "New Item (Ctrl + N)"; }
    1918    }
    20 
    2119    public override int Position {
    2220      get { return 10; }
    2321    }
    24 
    2522    public override Image Image {
    2623      get { return Resources.NewIcon; }
     
    2825
    2926    public override void Execute() {
    30       Actions.NewAction.Execute();
     27      FileManager.New();
    3128    }
    3229  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/OpenToolBarItem.cs

    r2520 r2546  
    1010
    1111namespace HeuristicLab.Optimizer {
    12   public class OpenToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class OpenToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
    1313    public override string Name {
    1414      get { return "Open..."; }
    1515    }
    16 
    1716    public override string ToolTipText {
    1817      get { return "Open File (Ctrl + O)"; }
    1918    }
    20 
    2119    public override int Position {
    2220      get { return 20; }
    2321    }
    24 
    2522    public override Image Image {
    2623      get { return Resources.OpenIcon; }
     
    2825
    2926    public override void Execute() {
    30       Actions.OpenAction.Execute();
     27      FileManager.Open();
    3128    }
    3229  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveAllToolBarItem.cs

    r2520 r2546  
    1010
    1111namespace HeuristicLab.Optimizer {
    12   public class SaveAllToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
     12  internal class SaveAllToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
    1313    public override string Name {
    1414      get { return "Save All"; }
    1515    }
    16 
    1716    public override string ToolTipText {
    1817      get { return "Save All Files"; }
    1918    }
    20 
    2119    public override int Position {
    2220      get { return 40; }
    2321    }
    24 
    2522    public override Image Image {
    2623      get { return Resources.SaveAllIcon; }
    2724    }
    2825
     26    public override void MainFormInitialized(object sender, EventArgs e) {
     27      ToolStripItem.Enabled = false;
     28    }
     29    public override void ActiveViewChanged(object sender, EventArgs e) {
     30      ToolStripItem.Enabled = MainFormManager.MainForm.Views.FirstOrDefault() != null;
     31    }
     32
    2933    public override void Execute() {
    30       Actions.SaveAllAction.Execute();
     34      FileManager.SaveAll();
    3135    }
    3236  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveToolBarItem.cs

    r2520 r2546  
    88using HeuristicLab.MainForm.WindowsForms;
    99using HeuristicLab.Common.Resources;
     10using HeuristicLab.Core;
     11using HeuristicLab.Core.Views;
    1012
    1113namespace HeuristicLab.Optimizer {
    12   public class SaveToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
     14  internal class SaveToolBarItem : HeuristicLab.MainForm.WindowsForms.ToolBarItemBase, IOptimizerUserInterfaceItemProvider {
    1315    public override string Name {
    1416      get { return "Save"; }
    1517    }
    16 
    1718    public override string ToolTipText {
    1819      get { return "Save File (Ctrl + S)"; }
    1920    }
    20 
    2121    public override int Position {
    2222      get { return 30; }
    2323    }
    24 
    2524    public override Image Image {
    2625      get { return Resources.SaveIcon; }
    2726    }
    2827
     28    public override void MainFormInitialized(object sender, EventArgs e) {
     29      ToolStripItem.Enabled = false;
     30    }
     31    public override void ActiveViewChanged(object sender, EventArgs e) {
     32      IItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;
     33      ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Item.GetType())));
     34    }
     35
    2936    public override void Execute() {
    30       Actions.SaveAction.Execute();
     37      FileManager.Save();
    3138    }
    3239  }
Note: See TracChangeset for help on using the changeset viewer.