Changeset 2243
- Timestamp:
- 08/05/09 19:24:49 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 20 added
- 7 edited
- 4 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.Test/3.2/HeuristicLabMainFormTestApplication.cs
r2229 r2243 25 25 using System.Windows.Forms; 26 26 using HeuristicLab.PluginInfrastructure; 27 using HeuristicLab.MainForm; 27 28 28 namespace HeuristicLab. Grid{29 [ClassInfo(Name = " Grid Client", Description="Client application for the distributed engine grid.", AutoRestart = true)]29 namespace HeuristicLab.MainForm.Test { 30 [ClassInfo(Name = "MainForm Test", Description="Test application for new mainform development.")] 30 31 class GridClientApplication : ApplicationBase { 31 32 public override void Run() { 32 Form mainForm = new ClientForm(); 33 DockingMainForm mainForm = new DockingMainForm(typeof(ITestUserInterfaceItemProvider)); 34 mainForm.Title = "Test new MAINFORM concept"; 33 35 Application.Run(mainForm); 34 36 } -
trunk/sources/HeuristicLab.MainForm.Test/3.2/HeuristicLabMainFormTestPlugin.cs
r2233 r2243 26 26 27 27 namespace HeuristicLab.Modeling.Database { 28 [ClassInfo(Name = "HeuristicLab.MainForm-3.2")] 29 [PluginFile(Filename = "HeuristicLab.MainForm-3.2.dll", Filetype = PluginFileType.Assembly)] 30 [PluginFile(Filename = "HeuristicLab.MainForm.Docking-3.2.dll", Filetype = PluginFileType.Assembly)] 31 [Dependency(Dependency = "HeuristicLab.Core-3.2")] 32 public class HeuristicLabMainFormPlugin : PluginBase { 28 [ClassInfo(Name = "HeuristicLab.MainForm.Test-3.2")] 29 [PluginFile(Filename = "HeuristicLab.MainForm.Test-3.2.dll", Filetype = PluginFileType.Assembly)] 30 [Dependency(Dependency = "HeuristicLab.MainForm-3.2")] 31 public class HeuristicLabMainFormTestPlugin : PluginBase { 33 32 } 34 33 } -
trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLab.MainForm.csproj
r2233 r2243 82 82 </ItemGroup> 83 83 <ItemGroup> 84 <Compile Include="Interfaces\IUserInterfaceItem.cs" /> 85 <Compile Include="ToolStripMenuItemBase.cs" /> 86 <Compile Include="ToolStripButtonItemBase.cs" /> 87 <Compile Include="ToolStripItemBase.cs" /> 84 88 <Compile Include="DockingMainForm.cs"> 85 89 <SubType>Form</SubType> … … 97 101 <Compile Include="Interfaces\IAction.cs" /> 98 102 <Compile Include="Interfaces\IMainForm.cs" /> 99 <Compile Include="Interfaces\I MenuItem.cs" />103 <Compile Include="Interfaces\IToolStripMenuItem.cs" /> 100 104 <Compile Include="Interfaces\IModel.cs" /> 105 <Compile Include="Interfaces\IToolStripButtonItem.cs" /> 101 106 <Compile Include="Interfaces\IToolStripItem.cs" /> 102 <Compile Include="Interfaces\IUserInterfaceItem.cs" />103 107 <Compile Include="Interfaces\IView.cs" /> 104 108 <Compile Include="Properties\AssemblyInfo.cs" /> 109 <Compile Include="UserInterfaceItemBase.cs" /> 105 110 <Compile Include="ViewBase.cs"> 106 111 <SubType>UserControl</SubType> -
trunk/sources/HeuristicLab.MainForm/3.2/HeuristicLabMainFormPlugin.cs
r2233 r2243 28 28 [ClassInfo(Name = "HeuristicLab.MainForm-3.2")] 29 29 [PluginFile(Filename = "HeuristicLab.MainForm-3.2.dll", Filetype = PluginFileType.Assembly)] 30 [PluginFile(Filename = "HeuristicLab.MainForm.Docking-3.2.dll", Filetype = PluginFileType.Assembly)]31 30 [Dependency(Dependency = "HeuristicLab.Core-3.2")] 32 31 public class HeuristicLabMainFormPlugin : PluginBase { -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IAction.cs
r2233 r2243 28 28 public interface IAction { 29 29 void Execute(IMainForm mainform); 30 bool Enabled(IMainForm mainform);31 30 } 32 31 } -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IMainForm.cs
r2233 r2243 32 32 Icon Icon { get; set; } 33 33 34 IModel Model { get; }35 34 IView ActiveView { get; } 36 35 IEnumerable<IView> OpenViews { get; } 37 36 38 37 Type UserInterfaceItemType { get; } 39 40 38 void ShowView(IView view); 41 39 } -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IToolStripButtonItem.cs
r2233 r2243 26 26 27 27 namespace HeuristicLab.MainForm { 28 public interface IToolStrip Item {28 public interface IToolStripButtonItem : IToolStripItem { 29 29 } 30 30 } -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IToolStripItem.cs
r2233 r2243 25 25 using System.Text; 26 26 using System.Drawing; 27 using System.Windows.Forms; 27 28 28 namespace HeuristicLab.MainForm.Interfaces { 29 public interface IUserInterfaceItem : IAction { 30 string Name { get; } 29 namespace HeuristicLab.MainForm { 30 public interface IToolStripItem : IUserInterfaceItem { 31 31 Image Image { get; } 32 string ImagePath { get; } 32 ToolStripItemDisplayStyle DisplayStyle { get; } 33 ToolStripItem ToolStripItem { get; set; } 33 34 } 34 35 } -
trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IToolStripMenuItem.cs
r2233 r2243 24 24 using System.Linq; 25 25 using System.Text; 26 using System.Windows.Forms; 26 27 27 28 namespace HeuristicLab.MainForm { 28 public interface IMenuItem { 29 public interface IToolStripMenuItem : IToolStripItem { 30 string MenuStructure { get; } 31 char MenuStructureSeparator { get; } 32 Keys ShortCutKeys { get; } 29 33 } 30 34 } -
trunk/sources/HeuristicLab.MainForm/3.2/MainFormBase.cs
r2233 r2243 29 29 using System.Windows.Forms; 30 30 31 using HeuristicLab.PluginInfrastructure; 32 31 33 namespace HeuristicLab.MainForm { 32 public partial class MainFormBase : Form, IMainForm {33 p ublic MainFormBase()34 public abstract partial class MainFormBase : Form, IMainForm { 35 protected MainFormBase(Type userInterfaceItemType) 34 36 : base() { 35 37 InitializeComponent(); 36 38 openViews = new List<IView>(); 37 }38 39 public MainFormBase(Type userInterfaceItemType)40 : this() {41 39 this.userInterfaceItemType = userInterfaceItemType; 40 CreateGUI(); 42 41 } 43 42 44 43 #region IMainForm Members 45 44 public string Title { 46 get { return this.T itle; }47 set { this.T itle= value; }45 get { return this.Text; } 46 set { this.Text = value; } 48 47 } 49 48 … … 56 55 public Type UserInterfaceItemType { 57 56 get { return this.userInterfaceItemType; } 58 }59 60 protected IModel model;61 public IModel Model {62 get { return this.model; }63 set { this.model = value; }64 57 } 65 58 … … 79 72 openViews.Add(view); 80 73 } 74 #endregion 81 75 76 #region create menu and toolbar 77 private void CreateGUI() { 78 DiscoveryService ds = new DiscoveryService(); 79 Type[] userInterfaceTypes = ds.GetTypes(userInterfaceItemType); 80 81 foreach (Type t in userInterfaceTypes.Where(t=> typeof(IToolStripMenuItem).IsAssignableFrom(t))) { 82 if (!t.IsAbstract && !t.IsInterface && !t.HasElementType) { 83 IToolStripMenuItem item = (IToolStripMenuItem) Activator.CreateInstance(t); 84 AddToolStripMenuItem(item); 85 } 86 } 87 88 foreach (Type t in userInterfaceTypes.Where(t => typeof(IToolStripButtonItem).IsAssignableFrom(t))) { 89 if (!t.IsAbstract && !t.IsInterface && !t.HasElementType) { 90 IToolStripButtonItem item = (IToolStripButtonItem)Activator.CreateInstance(t); 91 AddToolStripButtonItem(item); 92 } 93 } 94 } 95 96 private void AddToolStripMenuItem(IToolStripMenuItem menuItem) { 97 ToolStripMenuItem item = new ToolStripMenuItem(); 98 SetToolStripItemProperties(item, menuItem); 99 item.ShortcutKeys = menuItem.ShortCutKeys; 100 101 ToolStripMenuItem parent = null; 102 if (!String.IsNullOrEmpty(menuItem.MenuStructure)) { 103 ToolStripItemCollection parentItems = menuStrip.Items; 104 foreach (string structure in menuItem.MenuStructure.Split(menuItem.MenuStructureSeparator)) { 105 if (parentItems.ContainsKey(structure)) 106 parent = (ToolStripMenuItem)parentItems[structure]; 107 else { 108 parent = new ToolStripMenuItem(structure); 109 parent.Name = structure; 110 parentItems.Add(parent); 111 } 112 parentItems = parent.DropDownItems; 113 } 114 } 115 116 if (parent == null) 117 menuStrip.Items.Add(item); 118 else 119 parent.DropDownItems.Add(item); 120 } 121 122 private void AddToolStripButtonItem(IToolStripButtonItem buttonItem) { 123 ToolStripButton item = new ToolStripButton(); 124 SetToolStripItemProperties(item, buttonItem); 125 toolStrip.Items.Add(item); 126 } 127 128 private void SetToolStripItemProperties(ToolStripItem toolStripItem, IToolStripItem iToolStripItem) { 129 toolStripItem.Text = iToolStripItem.Name; 130 toolStripItem.Name = iToolStripItem.Name; 131 toolStripItem.Tag = iToolStripItem; 132 toolStripItem.Image = iToolStripItem.Image; 133 toolStripItem.DisplayStyle = iToolStripItem.DisplayStyle; 134 toolStripItem.Click += new EventHandler(ToolStripItemClicked); 135 iToolStripItem.ToolStripItem = toolStripItem; 136 } 137 138 private void ToolStripItemClicked(object sender, EventArgs e) { 139 System.Windows.Forms.ToolStripItem item = (System.Windows.Forms.ToolStripItem)sender; 140 ((IAction)item.Tag).Execute(this); 141 } 82 142 #endregion 83 143 } -
trunk/sources/HeuristicLab.sln
r2240 r2243 243 243 EndProject 244 244 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.MainForm", "HeuristicLab.MainForm\3.2\HeuristicLab.MainForm.csproj", "{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}" 245 EndProject 246 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.MainForm.Test-3.2", "HeuristicLab.MainForm.Test\3.2\HeuristicLab.MainForm.Test-3.2.csproj", "{569E430B-B4CE-4B94-A44E-6246B6E4E3BC}" 245 247 EndProject 246 248 Global … … 3906 3908 {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Visualization Debug|x64.ActiveCfg = Debug|Any CPU 3907 3909 {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Visualization Debug|x86.ActiveCfg = Debug|Any CPU 3910 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|Any CPU.ActiveCfg = Debug|Any CPU 3911 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU 3912 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU 3913 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU 3914 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 3915 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Debug|Any CPU.Build.0 = Debug|Any CPU 3916 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Debug|x64.ActiveCfg = Debug|Any CPU 3917 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Debug|x86.ActiveCfg = Debug|x86 3918 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Debug|x86.Build.0 = Debug|x86 3919 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Modeling Debug|Any CPU.ActiveCfg = Debug|Any CPU 3920 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Modeling Debug|Any CPU.Build.0 = Debug|Any CPU 3921 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Modeling Debug|x64.ActiveCfg = Debug|Any CPU 3922 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Modeling Debug|x86.ActiveCfg = Debug|Any CPU 3923 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Release|Any CPU.ActiveCfg = Release|Any CPU 3924 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Release|Any CPU.Build.0 = Release|Any CPU 3925 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Release|x64.ActiveCfg = Release|Any CPU 3926 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Release|x86.ActiveCfg = Release|x86 3927 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Release|x86.Build.0 = Release|x86 3928 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.v3.2 Debug|Any CPU.ActiveCfg = Debug|Any CPU 3929 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.v3.2 Debug|Any CPU.Build.0 = Debug|Any CPU 3930 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.v3.2 Debug|x64.ActiveCfg = Debug|Any CPU 3931 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.v3.2 Debug|x86.ActiveCfg = Debug|Any CPU 3932 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Visualization Debug|Any CPU.ActiveCfg = Debug|Any CPU 3933 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Visualization Debug|Any CPU.Build.0 = Debug|Any CPU 3934 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Visualization Debug|x64.ActiveCfg = Debug|Any CPU 3935 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Visualization Debug|x86.ActiveCfg = Debug|Any CPU 3908 3936 EndGlobalSection 3909 3937 GlobalSection(SolutionProperties) = preSolution … … 3996 4024 {45D11FBD-A71B-48D3-8A94-8EB0DFE8E06A} = {410732DB-725A-4824-896B-C298978343C0} 3997 4025 {3BD61258-31DA-4B09-89C0-4F71FEF5F05A} = {410732DB-725A-4824-896B-C298978343C0} 4026 {569E430B-B4CE-4B94-A44E-6246B6E4E3BC} = {410732DB-725A-4824-896B-C298978343C0} 3998 4027 {A9E282EA-180F-4233-B809-AEDF0787545C} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B} 3999 4028 {BF7D9494-A586-457B-8DF9-ED599F9E6A71} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B} -
trunk/sources/HeuristicLab/CopyAssemblies.cmd
r2240 r2243 71 71 copy "%SolutionDir%\HeuristicLab.Logging\3.2\%Outdir%\HeuristicLab.Logging-3.2.dll" .\plugins 72 72 copy "%SolutionDir%\HeuristicLab.Logging\3.3\%Outdir%\HeuristicLab.Logging-3.3.dll" .\plugins 73 copy "%SolutionDir%\HeuristicLab.MainForm\3.2\%Outdir%\HeuristicLab.MainForm-3.2.dll" .\plugins 74 copy "%SolutionDir%\HeuristicLab.MainForm.Test\3.2\%Outdir%\HeuristicLab.MainForm.Test-3.2.dll" .\plugins 73 75 copy "%SolutionDir%\HeuristicLab.Modeling\3.2\%Outdir%\HeuristicLab.Modeling-3.2.dll" .\plugins 74 76 copy "%SolutionDir%\HeuristicLab.Modeling\3.3\%Outdir%\HeuristicLab.Modeling-3.3.dll" .\plugins
Note: See TracChangeset
for help on using the changeset viewer.