• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FreeTrainの進化系を目指す


Commit MetaInfo

Revision5 (tree)
Time2013-11-26 21:54:17
Authorc477

Log Message

プラグイン一覧フォームとエラーフォームの微修正

Change Summary

Incremental Difference

--- plugins/test/plugin.xml (revision 4)
+++ plugins/test/plugin.xml (revision 5)
@@ -15,17 +15,11 @@
1515 <class name="nft.framework.plugin.FixedClassContributionFactory"/>
1616 <implementation name="nft.framework.plugin.DummyContribution" />
1717 </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>
2418
25- <contribution type="ImageResource" id="tex112x136x96">
19+ <contribution type="Image" id="tex112x136x96">
2620 <src>cube112x136x96.bmp</src>
2721 </contribution>
28- <contribution type="ImageResource" id="tex32x48x56">
22+ <contribution type="Image" id="tex32x48x56">
2923 <src>cube32x48x56.bmp</src>
3024 </contribution>
3125
--- plugins/system/plugin.xml (revision 4)
+++ plugins/system/plugin.xml (revision 5)
@@ -17,65 +17,71 @@
1717 </contribution>
1818 <contribution type="factory" id="F_SubForm">
1919 <name>SubForm</name>
20+ <description>Child GUI forms</description>
2021 <implementation name="nft.contributions.ui.CtbSubform"/>
2122 </contribution>
2223 <contribution type="factory" id="F_MenuItems">
23- <name>MenuItem factory</name>
24+ <name>Menu items</name>
2425 <implementation name="nft.contributions.ui.CtbMenuItem"/>
2526 <declare type="MenuItems"/>
2627 </contribution>
2728 <contribution type="factory" id="F_ToolButtons">
28- <name>Tool button factory</name>
29+ <name>Tool buttons</name>
2930 <implementation name="nft.contributions.ui.CtbToolButton"/>
3031 <declare type="ToolButtons"/>
3132 </contribution>
3233 <contribution type="factory" id="F_Command">
33- <name>User command factory</name>
34+ <name>User commands</name>
3435 <implementation name="nft.contributions.ui.CtbCommandEntity"/>
3536 <declare type="Command"/>
3637 </contribution>
3738 <contribution type="factory" id="F_CommandUI">
38- <name>CommandUI factory</name>
39+ <name>Command UIs</name>
3940 <implementation name="nft.contributions.ui.CtbCommandUI"/>
4041 <declare type="CommandUI"/>
4142 </contribution>
4243 <contribution type="factory" id="F_CommandUIGroup">
43- <name>CommandUI Group definition</name>
44+ <name>Command UI Group definition</name>
4445 <implementation name="nft.contributions.ui.CtbCommandUIGroup"/>
4546 <declare type="CommandUIGroup"/>
4647 </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>
4753 <contribution type="factory" id="F_TerrainGenerator">
48- <name>TerrainGenerator factory</name>
54+ <name>Terrain generators</name>
4955 <class name="nft.framework.plugin.InheritableContributionFactory"/>
5056 <basetype name="nft.contributions.game.CtbTerrainGenerator" codebase=".Core"/>
5157 <declare type="TerrainGenerator"/>
5258 </contribution>
5359 <contribution type="factory" id="F_WorldDivider">
54- <name>WorldDivider factory</name>
60+ <name>World dividers</name>
5561 <class name="nft.framework.plugin.InheritableContributionFactory"/>
5662 <basetype name="nft.contributions.game.CtbWorldDivider" codebase=".Core"/>
5763 <declare type="WorldDivider"/>
5864 </contribution>
5965 <contribution type="factory" id="F_GroundTextrue">
60- <name>Terrain(ground) textrue factory</name>
66+ <name>Terrain(ground) textrue sets</name>
6167 <class name="nft.contributions.terrain.CtbGroundTextureFactory" codebase=".Core"/>
6268 <basetype name="nft.contributions.terrain.CtbSimpleGroundTexture" codebase=".Core"/>
6369 <declare type="GroundTexture"/>
6470 </contribution>
6571 <contribution type="factory" id="F_CliffTexture">
66- <name>Cliff texture factory</name>
72+ <name>Cliff texture sets</name>
6773 <class name="nft.contributions.terrain.CtbCliffTextureFactory" codebase=".Core"/>
6874 <basetype name="nft.contributions.terrain.CtbSimpleCliffTexture" codebase=".Core"/>
6975 <declare type="CliffTexture"/>
7076 </contribution>
7177 <contribution type="factory" id="F_HeightCutPlaneTexture">
72- <name>Height-cut plane texture factory</name>
78+ <name>Height-cut plane texture sets</name>
7379 <class name="nft.contributions.terrain.CtbHeightCutPlaneTextureFactory" codebase=".Core"/>
7480 <basetype name="nft.contributions.terrain.CtbHeightCutPlaneTexture" codebase=".Core"/>
7581 <declare type="HeightCutPlaneTexture"/>
7682 </contribution>
7783 <contribution type="factory" id="F_HeightCutSlopeTexture">
78- <name>Height-cut slope (terrain) texture factory</name>
84+ <name>Height-cut slope (terrain) texture sets</name>
7985 <class name="nft.contributions.terrain.CtbHeightCutSlopeTextureFactory" codebase=".Core"/>
8086 <basetype name="nft.contributions.terrain.CtbHeightCutSlopeTexture" codebase=".Core"/>
8187 <declare type="HeightCutSlopeTexture"/>
--- framework/framework/plugin/FixedClassContributionFactory.cs (revision 4)
+++ framework/framework/plugin/FixedClassContributionFactory.cs (revision 5)
@@ -29,5 +29,9 @@
2929 public Contribution load(Plugin owner, ParamsReader e) {
3030 return (Contribution)Activator.CreateInstance(concreteType,new object[]{owner, e});
3131 }
32+
33+ public string Description {
34+ get { return null; }
35+ }
3236 }
3337 }
--- framework/framework/plugin/InheritableContributionFactory.cs (revision 4)
+++ framework/framework/plugin/InheritableContributionFactory.cs (revision 5)
@@ -37,5 +37,9 @@
3737 "{0} is incorrect for this contribution (expected:{1})",
3838 contrib.GetType().FullName, baseType.FullName ));
3939 }
40+
41+ public string Description {
42+ get { return null; }
43+ }
4044 }
4145 }
--- framework/framework/plugin/PluginManager.cs (revision 4)
+++ framework/framework/plugin/PluginManager.cs (revision 5)
@@ -465,21 +465,35 @@
465465 /// </summary>
466466 public void AddContributionFactory( string name, IContributionFactory factory )
467467 {
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);
473481 }
474482
475483 //
476484 public IContributionFactory GetContributionFactory( string name ) {
477- IContributionFactory factory = contributionFactories[name];
485+ string anam = AdjustFactoryName(name);
486+ IContributionFactory factory = contributionFactories[anam];
478487 if(factory==null)
479- throw new Exception(name+"は未知のコントリビューションです");
488+ throw new Exception(name + "は未知のコントリビューションです");
480489 else
481490 return factory;
482491 }
492+
493+ static string AdjustFactoryName(string orignam) {
494+ if(orignam==null) return null;
495+ return orignam.Trim().ToLower();
496+ }
483497 #endregion
484498
485499 /// <summary>
@@ -517,7 +531,7 @@
517531 }
518532 }
519533
520- public IEnumerable<IContributionFactory> Factories {
534+ public IEnumerable<KeyValuePair<string,IContributionFactory>> Factories {
521535 get {
522536 return new FactoryEnumerator();
523537 }
@@ -573,13 +587,13 @@
573587 }
574588
575589
576- internal class FactoryEnumerator : IEnumerable<IContributionFactory>
590+ internal class FactoryEnumerator : IEnumerable<KeyValuePair<string, IContributionFactory>>
577591 {
578592 public FactoryEnumerator() {
579593 }
580594
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)
583597 yield return fct;
584598 }
585599
--- framework/framework/plugin/CustomContributionFactory.cs (revision 4)
+++ framework/framework/plugin/CustomContributionFactory.cs (revision 5)
@@ -29,5 +29,10 @@
2929 }
3030
3131 protected abstract Contribution Cretate(Plugin owner, ParamsReader e);
32+
33+
34+ public string Description {
35+ get { return null; }
36+ }
3237 }
3338 }
--- framework/framework/plugin/ContributionFactory.cs (revision 4)
+++ framework/framework/plugin/ContributionFactory.cs (revision 5)
@@ -20,6 +20,8 @@
2020 Contribution load( Plugin owner, ParamsReader e );
2121
2222 Type OutputType { get; }
23+
24+ string Description { get; }
2325 }
2426
2527 public class DefaultContributionFactory : Contribution, IContributionFactory
@@ -47,5 +49,16 @@
4749 "{0} is incorrect for this contribution (expected:{1})",
4850 contrib.GetType().FullName, baseType.FullName ));
4951 }
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+ }
5063 }
5164 }
--- framework/framework/loader/XmlParamParser.cs (revision 4)
+++ framework/framework/loader/XmlParamParser.cs (revision 5)
@@ -45,12 +45,13 @@
4545 }
4646
4747 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+ }
5353 }
54+ return null;
5455 }
5556 }
5657
--- framework/util/UIUtil.cs (revision 4)
+++ framework/util/UIUtil.cs (revision 5)
@@ -125,9 +125,13 @@
125125 {
126126 Assembly asm = Assembly.LoadFrom(Directories.AppBaseDir+"NFT.UI.DLL");
127127 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+ }
131135 }
132136 }
133137 }
--- ui_jp/ui/system/ErrorMessageBox.cs (revision 4)
+++ ui_jp/ui/system/ErrorMessageBox.cs (revision 5)
@@ -33,6 +33,7 @@
3333 private System.Windows.Forms.Button copyButton;
3434 private System.Windows.Forms.Label note;
3535 private Button throwButton;
36+ private Button abortButton;
3637
3738 private readonly Exception exception;
3839
@@ -99,6 +100,7 @@
99100 this.copyButton = new System.Windows.Forms.Button();
100101 this.note = new System.Windows.Forms.Label();
101102 this.throwButton = new System.Windows.Forms.Button();
103+ this.abortButton = new System.Windows.Forms.Button();
102104 ((System.ComponentModel.ISupportInitialize)(this.icon)).BeginInit();
103105 this.SuspendLayout();
104106 //
@@ -130,11 +132,11 @@
130132 this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
131133 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
132134 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);
134136 this.okButton.Name = "okButton";
135137 this.okButton.Size = new System.Drawing.Size(80, 24);
136138 this.okButton.TabIndex = 3;
137- this.okButton.Text = "&OK";
139+ this.okButton.Text = "続行(&C)";
138140 //
139141 // msg
140142 //
@@ -155,8 +157,7 @@
155157 this.linkLabel1.Size = new System.Drawing.Size(112, 16);
156158 this.linkLabel1.TabIndex = 4;
157159 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/";
160161 this.linkLabel1.Text = " バグの報告先";
161162 this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
162163 //
@@ -187,14 +188,25 @@
187188 // throwButton
188189 //
189190 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);
191192 this.throwButton.Name = "throwButton";
192- this.throwButton.Size = new System.Drawing.Size(146, 23);
193+ this.throwButton.Size = new System.Drawing.Size(134, 23);
193194 this.throwButton.TabIndex = 7;
194195 this.throwButton.Text = "再throw(開発用)";
195196 this.throwButton.UseVisualStyleBackColor = true;
196197 this.throwButton.Click += new System.EventHandler(this.throwButton_Click);
197198 //
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+ //
198210 // ErrorMessageBox
199211 //
200212 this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
@@ -203,6 +215,7 @@
203215 this.Controls.Add(this.note);
204216 this.Controls.Add(this.copyButton);
205217 this.Controls.Add(this.linkLabel1);
218+ this.Controls.Add(this.abortButton);
206219 this.Controls.Add(this.okButton);
207220 this.Controls.Add(this.detail);
208221 this.Controls.Add(this.msg);
--- ui_jp/ui/system/PluginListDialog.cs (revision 4)
+++ ui_jp/ui/system/PluginListDialog.cs (revision 5)
@@ -300,9 +300,8 @@
300300
301301 // construct tree
302302 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));
306305 }
307306 //foreach (Plugin p in PluginManager.theInstance.Plugins)
308307 //tree.Nodes.Add( CreateTreeItem(p) );
@@ -583,10 +582,18 @@
583582 {
584583 }
585584
586- private TreeNode CreateTreeItem(IContributionFactory f)
585+ private TreeNode CreateTreeItem(KeyValuePair<string,IContributionFactory> kvp)
587586 {
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("") });
590597 node.Tag = f;
591598 node.Checked = true;
592599 return node;