FreeTrainの進化系を目指す
プラグイン一覧フォームとエラーフォームの微修正
| @@ -15,17 +15,11 @@ | ||
| 15 | 15 | <class name="nft.framework.plugin.FixedClassContributionFactory"/> |
| 16 | 16 | <implementation name="nft.framework.plugin.DummyContribution" /> |
| 17 | 17 | </contribution> |
| 18 | - | |
| 19 | - <contribution type="factory" id="F_ImageSource"> | |
| 20 | - <name>image resource factory</name> | |
| 21 | - <basetype name="nft.contributions.graphics.CtbImageResource" codebase=".Core"/> | |
| 22 | - <declare type="ImageResource"/> | |
| 23 | - </contribution> | |
| 24 | 18 | |
| 25 | - <contribution type="ImageResource" id="tex112x136x96"> | |
| 19 | + <contribution type="Image" id="tex112x136x96"> | |
| 26 | 20 | <src>cube112x136x96.bmp</src> |
| 27 | 21 | </contribution> |
| 28 | - <contribution type="ImageResource" id="tex32x48x56"> | |
| 22 | + <contribution type="Image" id="tex32x48x56"> | |
| 29 | 23 | <src>cube32x48x56.bmp</src> |
| 30 | 24 | </contribution> |
| 31 | 25 |
| @@ -17,65 +17,71 @@ | ||
| 17 | 17 | </contribution> |
| 18 | 18 | <contribution type="factory" id="F_SubForm"> |
| 19 | 19 | <name>SubForm</name> |
| 20 | + <description>Child GUI forms</description> | |
| 20 | 21 | <implementation name="nft.contributions.ui.CtbSubform"/> |
| 21 | 22 | </contribution> |
| 22 | 23 | <contribution type="factory" id="F_MenuItems"> |
| 23 | - <name>MenuItem factory</name> | |
| 24 | + <name>Menu items</name> | |
| 24 | 25 | <implementation name="nft.contributions.ui.CtbMenuItem"/> |
| 25 | 26 | <declare type="MenuItems"/> |
| 26 | 27 | </contribution> |
| 27 | 28 | <contribution type="factory" id="F_ToolButtons"> |
| 28 | - <name>Tool button factory</name> | |
| 29 | + <name>Tool buttons</name> | |
| 29 | 30 | <implementation name="nft.contributions.ui.CtbToolButton"/> |
| 30 | 31 | <declare type="ToolButtons"/> |
| 31 | 32 | </contribution> |
| 32 | 33 | <contribution type="factory" id="F_Command"> |
| 33 | - <name>User command factory</name> | |
| 34 | + <name>User commands</name> | |
| 34 | 35 | <implementation name="nft.contributions.ui.CtbCommandEntity"/> |
| 35 | 36 | <declare type="Command"/> |
| 36 | 37 | </contribution> |
| 37 | 38 | <contribution type="factory" id="F_CommandUI"> |
| 38 | - <name>CommandUI factory</name> | |
| 39 | + <name>Command UIs</name> | |
| 39 | 40 | <implementation name="nft.contributions.ui.CtbCommandUI"/> |
| 40 | 41 | <declare type="CommandUI"/> |
| 41 | 42 | </contribution> |
| 42 | 43 | <contribution type="factory" id="F_CommandUIGroup"> |
| 43 | - <name>CommandUI Group definition</name> | |
| 44 | + <name>Command UI Group definition</name> | |
| 44 | 45 | <implementation name="nft.contributions.ui.CtbCommandUIGroup"/> |
| 45 | 46 | <declare type="CommandUIGroup"/> |
| 46 | 47 | </contribution> |
| 48 | + <contribution type="factory" id="F_ImageSource"> | |
| 49 | + <name>Image Resources</name> | |
| 50 | + <basetype name="nft.contributions.graphics.CtbImageResource" codebase=".Core"/> | |
| 51 | + <declare type="Image"/> | |
| 52 | + </contribution> | |
| 47 | 53 | <contribution type="factory" id="F_TerrainGenerator"> |
| 48 | - <name>TerrainGenerator factory</name> | |
| 54 | + <name>Terrain generators</name> | |
| 49 | 55 | <class name="nft.framework.plugin.InheritableContributionFactory"/> |
| 50 | 56 | <basetype name="nft.contributions.game.CtbTerrainGenerator" codebase=".Core"/> |
| 51 | 57 | <declare type="TerrainGenerator"/> |
| 52 | 58 | </contribution> |
| 53 | 59 | <contribution type="factory" id="F_WorldDivider"> |
| 54 | - <name>WorldDivider factory</name> | |
| 60 | + <name>World dividers</name> | |
| 55 | 61 | <class name="nft.framework.plugin.InheritableContributionFactory"/> |
| 56 | 62 | <basetype name="nft.contributions.game.CtbWorldDivider" codebase=".Core"/> |
| 57 | 63 | <declare type="WorldDivider"/> |
| 58 | 64 | </contribution> |
| 59 | 65 | <contribution type="factory" id="F_GroundTextrue"> |
| 60 | - <name>Terrain(ground) textrue factory</name> | |
| 66 | + <name>Terrain(ground) textrue sets</name> | |
| 61 | 67 | <class name="nft.contributions.terrain.CtbGroundTextureFactory" codebase=".Core"/> |
| 62 | 68 | <basetype name="nft.contributions.terrain.CtbSimpleGroundTexture" codebase=".Core"/> |
| 63 | 69 | <declare type="GroundTexture"/> |
| 64 | 70 | </contribution> |
| 65 | 71 | <contribution type="factory" id="F_CliffTexture"> |
| 66 | - <name>Cliff texture factory</name> | |
| 72 | + <name>Cliff texture sets</name> | |
| 67 | 73 | <class name="nft.contributions.terrain.CtbCliffTextureFactory" codebase=".Core"/> |
| 68 | 74 | <basetype name="nft.contributions.terrain.CtbSimpleCliffTexture" codebase=".Core"/> |
| 69 | 75 | <declare type="CliffTexture"/> |
| 70 | 76 | </contribution> |
| 71 | 77 | <contribution type="factory" id="F_HeightCutPlaneTexture"> |
| 72 | - <name>Height-cut plane texture factory</name> | |
| 78 | + <name>Height-cut plane texture sets</name> | |
| 73 | 79 | <class name="nft.contributions.terrain.CtbHeightCutPlaneTextureFactory" codebase=".Core"/> |
| 74 | 80 | <basetype name="nft.contributions.terrain.CtbHeightCutPlaneTexture" codebase=".Core"/> |
| 75 | 81 | <declare type="HeightCutPlaneTexture"/> |
| 76 | 82 | </contribution> |
| 77 | 83 | <contribution type="factory" id="F_HeightCutSlopeTexture"> |
| 78 | - <name>Height-cut slope (terrain) texture factory</name> | |
| 84 | + <name>Height-cut slope (terrain) texture sets</name> | |
| 79 | 85 | <class name="nft.contributions.terrain.CtbHeightCutSlopeTextureFactory" codebase=".Core"/> |
| 80 | 86 | <basetype name="nft.contributions.terrain.CtbHeightCutSlopeTexture" codebase=".Core"/> |
| 81 | 87 | <declare type="HeightCutSlopeTexture"/> |
| @@ -29,5 +29,9 @@ | ||
| 29 | 29 | public Contribution load(Plugin owner, ParamsReader e) { |
| 30 | 30 | return (Contribution)Activator.CreateInstance(concreteType,new object[]{owner, e}); |
| 31 | 31 | } |
| 32 | + | |
| 33 | + public string Description { | |
| 34 | + get { return null; } | |
| 35 | + } | |
| 32 | 36 | } |
| 33 | 37 | } |
| @@ -37,5 +37,9 @@ | ||
| 37 | 37 | "{0} is incorrect for this contribution (expected:{1})", |
| 38 | 38 | contrib.GetType().FullName, baseType.FullName )); |
| 39 | 39 | } |
| 40 | + | |
| 41 | + public string Description { | |
| 42 | + get { return null; } | |
| 43 | + } | |
| 40 | 44 | } |
| 41 | 45 | } |
| @@ -465,21 +465,35 @@ | ||
| 465 | 465 | /// </summary> |
| 466 | 466 | public void AddContributionFactory( string name, IContributionFactory factory ) |
| 467 | 467 | { |
| 468 | - if( contributionFactories.ContainsKey(name) ) | |
| 469 | - throw new Exception(string.Format( | |
| 470 | - "contribution type \"{0}\" is already registered.",name)); | |
| 471 | - | |
| 472 | - contributionFactories.Add(name,factory); | |
| 468 | + string anam = AdjustFactoryName(name); | |
| 469 | + if (contributionFactories.ContainsKey(anam)) { | |
| 470 | + string msg; | |
| 471 | + if (anam.Equals(name)) { | |
| 472 | + msg = string.Format( | |
| 473 | + "contribution type \"{0}\" is already registered.", anam); | |
| 474 | + } else { | |
| 475 | + msg = string.Format( | |
| 476 | + "contribution type \"{0}\" is already registered as \"{1}\".", name, anam); | |
| 477 | + } | |
| 478 | + throw new Exception(msg); | |
| 479 | + } | |
| 480 | + contributionFactories.Add(anam, factory); | |
| 473 | 481 | } |
| 474 | 482 | |
| 475 | 483 | // |
| 476 | 484 | public IContributionFactory GetContributionFactory( string name ) { |
| 477 | - IContributionFactory factory = contributionFactories[name]; | |
| 485 | + string anam = AdjustFactoryName(name); | |
| 486 | + IContributionFactory factory = contributionFactories[anam]; | |
| 478 | 487 | if(factory==null) |
| 479 | - throw new Exception(name+"は未知のコントリビューションです"); | |
| 488 | + throw new Exception(name + "は未知のコントリビューションです"); | |
| 480 | 489 | else |
| 481 | 490 | return factory; |
| 482 | 491 | } |
| 492 | + | |
| 493 | + static string AdjustFactoryName(string orignam) { | |
| 494 | + if(orignam==null) return null; | |
| 495 | + return orignam.Trim().ToLower(); | |
| 496 | + } | |
| 483 | 497 | #endregion |
| 484 | 498 | |
| 485 | 499 | /// <summary> |
| @@ -517,7 +531,7 @@ | ||
| 517 | 531 | } |
| 518 | 532 | } |
| 519 | 533 | |
| 520 | - public IEnumerable<IContributionFactory> Factories { | |
| 534 | + public IEnumerable<KeyValuePair<string,IContributionFactory>> Factories { | |
| 521 | 535 | get { |
| 522 | 536 | return new FactoryEnumerator(); |
| 523 | 537 | } |
| @@ -573,13 +587,13 @@ | ||
| 573 | 587 | } |
| 574 | 588 | |
| 575 | 589 | |
| 576 | - internal class FactoryEnumerator : IEnumerable<IContributionFactory> | |
| 590 | + internal class FactoryEnumerator : IEnumerable<KeyValuePair<string, IContributionFactory>> | |
| 577 | 591 | { |
| 578 | 592 | public FactoryEnumerator() { |
| 579 | 593 | } |
| 580 | 594 | |
| 581 | - public IEnumerator<IContributionFactory> GetEnumerator() { | |
| 582 | - foreach (IContributionFactory fct in PluginManager.theInstance.contributionFactories.Values) | |
| 595 | + public IEnumerator<KeyValuePair<string, IContributionFactory>> GetEnumerator() { | |
| 596 | + foreach (KeyValuePair<string,IContributionFactory> fct in PluginManager.theInstance.contributionFactories) | |
| 583 | 597 | yield return fct; |
| 584 | 598 | } |
| 585 | 599 |
| @@ -29,5 +29,10 @@ | ||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | protected abstract Contribution Cretate(Plugin owner, ParamsReader e); |
| 32 | + | |
| 33 | + | |
| 34 | + public string Description { | |
| 35 | + get { return null; } | |
| 36 | + } | |
| 32 | 37 | } |
| 33 | 38 | } |
| @@ -20,6 +20,8 @@ | ||
| 20 | 20 | Contribution load( Plugin owner, ParamsReader e ); |
| 21 | 21 | |
| 22 | 22 | Type OutputType { get; } |
| 23 | + | |
| 24 | + string Description { get; } | |
| 23 | 25 | } |
| 24 | 26 | |
| 25 | 27 | public class DefaultContributionFactory : Contribution, IContributionFactory |
| @@ -47,5 +49,16 @@ | ||
| 47 | 49 | "{0} is incorrect for this contribution (expected:{1})", |
| 48 | 50 | contrib.GetType().FullName, baseType.FullName )); |
| 49 | 51 | } |
| 52 | + | |
| 53 | + public override string Description { | |
| 54 | + get { | |
| 55 | + string dbase = base.Description; | |
| 56 | + if (dbase != null & dbase.Length > 0) { | |
| 57 | + return dbase; | |
| 58 | + } else { | |
| 59 | + return base.Name; | |
| 60 | + } | |
| 61 | + } | |
| 62 | + } | |
| 50 | 63 | } |
| 51 | 64 | } |
| @@ -45,12 +45,13 @@ | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public IFileSource GetFileSource(string path) { |
| 48 | - Uri uri= XmlUtil.resolve(node, path); | |
| 49 | - if (uri.IsFile) { | |
| 50 | - return new LocalFile(uri.LocalPath); | |
| 51 | - } else { | |
| 52 | - return null; | |
| 48 | + if (path != null && path.Length > 0) { | |
| 49 | + Uri uri = XmlUtil.resolve(node, path); | |
| 50 | + if (uri.IsFile) { | |
| 51 | + return new LocalFile(uri.LocalPath); | |
| 52 | + } | |
| 53 | 53 | } |
| 54 | + return null; | |
| 54 | 55 | } |
| 55 | 56 | } |
| 56 | 57 |
| @@ -125,9 +125,13 @@ | ||
| 125 | 125 | { |
| 126 | 126 | Assembly asm = Assembly.LoadFrom(Directories.AppBaseDir+"NFT.UI.DLL"); |
| 127 | 127 | Type t = asm.GetType("nft.ui.system.ErrorMessageBox"); |
| 128 | - object ret = t.InvokeMember("Show",BindingFlags.Public|BindingFlags.Static|BindingFlags.InvokeMethod,null,null,new object[]{owner,msg,e}); | |
| 129 | - if (ret is bool && (bool)ret) { | |
| 130 | - throw e; | |
| 128 | + BindingFlags flags = BindingFlags.Public|BindingFlags.Static|BindingFlags.InvokeMethod; | |
| 129 | + object ret = t.InvokeMember("Show",flags ,null,null,new object[]{owner,msg,e}); | |
| 130 | + if ((bool)ret && Main.mainFrame!=null) { | |
| 131 | + DialogResult r2 = MessageBox.Show(null, "Are you sure to QUIT?", "NeoFT", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); | |
| 132 | + if (r2 == DialogResult.Yes) { | |
| 133 | + Environment.Exit(-2); | |
| 134 | + } | |
| 131 | 135 | } |
| 132 | 136 | } |
| 133 | 137 | } |
| @@ -33,6 +33,7 @@ | ||
| 33 | 33 | private System.Windows.Forms.Button copyButton; |
| 34 | 34 | private System.Windows.Forms.Label note; |
| 35 | 35 | private Button throwButton; |
| 36 | + private Button abortButton; | |
| 36 | 37 | |
| 37 | 38 | private readonly Exception exception; |
| 38 | 39 |
| @@ -99,6 +100,7 @@ | ||
| 99 | 100 | this.copyButton = new System.Windows.Forms.Button(); |
| 100 | 101 | this.note = new System.Windows.Forms.Label(); |
| 101 | 102 | this.throwButton = new System.Windows.Forms.Button(); |
| 103 | + this.abortButton = new System.Windows.Forms.Button(); | |
| 102 | 104 | ((System.ComponentModel.ISupportInitialize)(this.icon)).BeginInit(); |
| 103 | 105 | this.SuspendLayout(); |
| 104 | 106 | // |
| @@ -130,11 +132,11 @@ | ||
| 130 | 132 | this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
| 131 | 133 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; |
| 132 | 134 | this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.System; |
| 133 | - this.okButton.Location = new System.Drawing.Point(512, 219); | |
| 135 | + this.okButton.Location = new System.Drawing.Point(408, 219); | |
| 134 | 136 | this.okButton.Name = "okButton"; |
| 135 | 137 | this.okButton.Size = new System.Drawing.Size(80, 24); |
| 136 | 138 | this.okButton.TabIndex = 3; |
| 137 | - this.okButton.Text = "&OK"; | |
| 139 | + this.okButton.Text = "続行(&C)"; | |
| 138 | 140 | // |
| 139 | 141 | // msg |
| 140 | 142 | // |
| @@ -155,8 +157,7 @@ | ||
| 155 | 157 | this.linkLabel1.Size = new System.Drawing.Size(112, 16); |
| 156 | 158 | this.linkLabel1.TabIndex = 4; |
| 157 | 159 | this.linkLabel1.TabStop = true; |
| 158 | - this.linkLabel1.TargetUrl = "http://www.kohsuke.org/freetrain/wiki/pukiwiki.php?%A5%D0%A5%B0%CA%F3%B9%F0%A4%CE" + | |
| 159 | - "%BC%EA%BD%E7"; | |
| 160 | + this.linkLabel1.TargetUrl = "https://sourceforge.jp/users/c477/pf/NeoFT.Workshop/ticket/"; | |
| 160 | 161 | this.linkLabel1.Text = " バグの報告先"; |
| 161 | 162 | this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; |
| 162 | 163 | // |
| @@ -187,14 +188,25 @@ | ||
| 187 | 188 | // throwButton |
| 188 | 189 | // |
| 189 | 190 | this.throwButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); |
| 190 | - this.throwButton.Location = new System.Drawing.Point(200, 220); | |
| 191 | + this.throwButton.Location = new System.Drawing.Point(190, 220); | |
| 191 | 192 | this.throwButton.Name = "throwButton"; |
| 192 | - this.throwButton.Size = new System.Drawing.Size(146, 23); | |
| 193 | + this.throwButton.Size = new System.Drawing.Size(134, 23); | |
| 193 | 194 | this.throwButton.TabIndex = 7; |
| 194 | 195 | this.throwButton.Text = "再throw(開発用)"; |
| 195 | 196 | this.throwButton.UseVisualStyleBackColor = true; |
| 196 | 197 | this.throwButton.Click += new System.EventHandler(this.throwButton_Click); |
| 197 | 198 | // |
| 199 | + // abortButton | |
| 200 | + // | |
| 201 | + this.abortButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | |
| 202 | + this.abortButton.DialogResult = System.Windows.Forms.DialogResult.Abort; | |
| 203 | + this.abortButton.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
| 204 | + this.abortButton.Location = new System.Drawing.Point(494, 219); | |
| 205 | + this.abortButton.Name = "abortButton"; | |
| 206 | + this.abortButton.Size = new System.Drawing.Size(98, 24); | |
| 207 | + this.abortButton.TabIndex = 3; | |
| 208 | + this.abortButton.Text = "アプリ終了(&X)"; | |
| 209 | + // | |
| 198 | 210 | // ErrorMessageBox |
| 199 | 211 | // |
| 200 | 212 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 12); |
| @@ -203,6 +215,7 @@ | ||
| 203 | 215 | this.Controls.Add(this.note); |
| 204 | 216 | this.Controls.Add(this.copyButton); |
| 205 | 217 | this.Controls.Add(this.linkLabel1); |
| 218 | + this.Controls.Add(this.abortButton); | |
| 206 | 219 | this.Controls.Add(this.okButton); |
| 207 | 220 | this.Controls.Add(this.detail); |
| 208 | 221 | this.Controls.Add(this.msg); |
| @@ -300,9 +300,8 @@ | ||
| 300 | 300 | |
| 301 | 301 | // construct tree |
| 302 | 302 | tree.Nodes.Clear(); |
| 303 | - foreach (IContributionFactory f in PluginManager.theInstance.Factories) { | |
| 304 | - Type t = f.OutputType; | |
| 305 | - tree.Nodes.Add(CreateTreeItem(f)); | |
| 303 | + foreach (KeyValuePair<string, IContributionFactory> fent in PluginManager.theInstance.Factories) { | |
| 304 | + tree.Nodes.Add(CreateTreeItem(fent)); | |
| 306 | 305 | } |
| 307 | 306 | //foreach (Plugin p in PluginManager.theInstance.Plugins) |
| 308 | 307 | //tree.Nodes.Add( CreateTreeItem(p) ); |
| @@ -583,10 +582,18 @@ | ||
| 583 | 582 | { |
| 584 | 583 | } |
| 585 | 584 | |
| 586 | - private TreeNode CreateTreeItem(IContributionFactory f) | |
| 585 | + private TreeNode CreateTreeItem(KeyValuePair<string,IContributionFactory> kvp) | |
| 587 | 586 | { |
| 588 | - int icon = 6; | |
| 589 | - TreeNode node = new TreeNode(f.OutputType.Name, icon, icon, new TreeNode[]{new TreeNode("")} ); | |
| 587 | + IContributionFactory f = kvp.Value; | |
| 588 | + string caption; | |
| 589 | + Contribution ctb = f as Contribution; | |
| 590 | + if (ctb != null && ctb.Description != null && ctb.Description.Trim().Length>0 ) { | |
| 591 | + caption = string.Format("{0}: {1}", kvp.Key, ctb.Description); | |
| 592 | + } else { | |
| 593 | + caption = kvp.Key; | |
| 594 | + } | |
| 595 | + int icon = 6; | |
| 596 | + TreeNode node = new TreeNode(caption, icon, icon, new TreeNode[] { new TreeNode("") }); | |
| 590 | 597 | node.Tag = f; |
| 591 | 598 | node.Checked = true; |
| 592 | 599 | return node; |