• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

FreeTrainの進化系を目指す


Commit MetaInfo

Revision74 (tree)
Zeit2017-05-29 00:12:29
Autorc477

Log Message

VDockContentId.cs ドックコンテント用 IIdentifier

Ändern Zusammenfassung

Diff

--- trunk/core/debug/TestXnaForm.cs (revision 73)
+++ trunk/core/debug/TestXnaForm.cs (revision 74)
@@ -30,8 +30,9 @@
3030 List<I3DObject> structures = new List<I3DObject>();
3131 protected override void OnLoad(EventArgs e)
3232 {
33- CtbImageResource ir1 = PluginManager.theInstance.GetContribution(new VContributionId(@"test\tex112x136x96")) as CtbImageResource;
34- CtbImageResource ir2 = PluginManager.theInstance.GetContribution(new VContributionId(@"test\tex32x48x56")) as CtbImageResource;
33+ VPluginId pid0 = VPluginId.FromString("test");
34+ CtbImageResource ir1 = PluginManager.theInstance.GetContribution(new VContributionId(pid0, "tex112x136x96")) as CtbImageResource;
35+ CtbImageResource ir2 = PluginManager.theInstance.GetContribution(new VContributionId(pid0, "tex32x48x56")) as CtbImageResource;
3536 ITexture tx1 = GM.CreateStaticTexture(ResourceKey.CreateKey(ir1, ir2.ID.AsString), ir1.Data.Default.ImageSrc);
3637 ITexture tx2 = GM.CreateStaticTexture(ResourceKey.CreateKey(ir2, ir2.ID.AsString), ir2.Data.Default.ImageSrc);
3738 ICubicStructure st1 = GM.CreateStructure(0, null, tx1, new Point3D(112, 96, 136));
--- trunk/framework/TODO.txt (revision 73)
+++ trunk/framework/TODO.txt (revision 74)
@@ -1,4 +1,9 @@
1-◎直近のタスク
1+
2+次のアイデア
3+◆(Point,Rectなど)座標系のクラスはinterface側に拡張メソッドで共通処理を描く
4+◆コントリビューションのParser, Repository, を別コントリビューションとして分離
5+
6+◎コマンド関連整理(ほぼ完?)
27 CommandUIをUI部分のみ完全分離
38 コントリビューションとして登録するならやはりICommandProcedureベースが楽
49  → Enable(Availableに改名したい)の機能は分離? ICommandProcedureWithAvailableFrag
@@ -6,10 +11,6 @@
611  当面、CommandUIの個々のプロパティーの変更は考えない
712  →CommandEntryにCommandUIを付け替え可能にして、その変更イベントを作る
813
9-次のアイデア
10-◆(Point,Rectなど)座標系のクラスはinterface側に拡張メソッドで共通処理を描く
11-◆コントリビューションのParser, Repository, を別コントリビューションとして分離
12-
1314 ●検討事項
1415  KVS,キャッシュサービス(メモリ⇔ファイル) ※utilにcacheクラスがあるが、WeakRefferenceのみ
1516 1.WeakRefferenceの解放タイミングをキャッチできるか?
--- trunk/framework/framework/plugin/VContributionId.cs (revision 73)
+++ trunk/framework/framework/plugin/VContributionId.cs (revision 74)
@@ -14,6 +14,17 @@
1414 // {Plugin_id}\{Contribution_short_id}
1515 static public readonly string PID_Sepalator = "\\";
1616
17+ public static VContributionId FromString(string idStr)
18+ {
19+ int n = idStr.IndexOf(PID_Sepalator);
20+ if (n == -1) {
21+ string format = I18n.T("'{0}' is not a invalid contribution ID. It should be '{plugin_id}\\{inner_id}'.");
22+ Debug.Assert(false, String.Format(format, idStr));
23+ }
24+
25+ return new VContributionId(idStr.Substring(0, n), idStr.Substring(n + PID_Sepalator.Length));
26+ }
27+
1728 internal static VContributionId CreateFrom(ParamsReader contribRootReader)
1829 {
1930 string short_id = contribRootReader["id"].InnerText;
@@ -54,14 +65,6 @@
5465 private VContributionId(string pluginId, string subId) : base(CombineWithValidating(pluginId, subId))
5566 {}
5667
57- /// <summary>
58- ///
59- /// </summary>
60- /// <param name="idStr"></param>
61- [Obsolete("TODO:使わないようにしたい")]
62- public VContributionId(string idStr) : base(idStr)
63- {}
64-
6568 public string PluginID
6669 {
6770 get {
--- trunk/mainframe/ui/CtbSubform.cs (revision 73)
+++ trunk/mainframe/ui/CtbSubform.cs (revision 74)
@@ -9,6 +9,7 @@
99 using WeifenLuo.WinFormsUI.Docking;
1010 using System.Collections.Generic;
1111 using nft.ui.docking;
12+using nft.ui.ui.docking;
1213
1314 namespace nft.contributions.ui
1415 {
@@ -29,8 +30,6 @@
2930 public static readonly string NoSave = "nosave";
3031 }
3132
32- public static readonly string SepalatorPersist = "::";
33-
3433 /// <summary>
3534 ///
3635 /// </summary>
@@ -235,17 +234,13 @@
235234 }
236235
237236 protected readonly CtbSubform ctbOwner;
238- protected readonly string key;
237+ protected readonly VDockContentId contentId;
239238 protected CtbFormHolder(CtbSubform ctb, string key, LayoutState initial, LayoutStyle allowed, StyleOption opt)
240239 : base(initial, allowed, opt) {
241240 this.ctbOwner = ctb;
242- this.key = ctb.ID + SepalatorPersist + key;
241+ this.contentId = new VDockContentId(ctb.ContributionID, key);
243242 }
244-
245- protected internal override string GetParsisitString() {
246- return key;
247- }
248-
243+ internal protected override VDockContentId ContentID { get { return this.contentId; } }
249244 }
250245
251246 }
--- trunk/mainframe/ui/docking/DefaultDockForm.cs (revision 73)
+++ trunk/mainframe/ui/docking/DefaultDockForm.cs (revision 74)
@@ -32,7 +32,7 @@
3232 if (holder.HasOption(StyleOption.NoSaveLayout)) {
3333 return null;
3434 } else {
35- return holder.GetParsisitString();
35+ return holder.ContentID.AsString;
3636 }
3737 }
3838
--- trunk/mainframe/ui/docking/IDockContentFactory.cs (revision 73)
+++ trunk/mainframe/ui/docking/IDockContentFactory.cs (revision 74)
@@ -1,5 +1,6 @@
11 using nft.contributions.ui;
22 using nft.framework.plugin;
3+using nft.ui.ui.docking;
34 using System;
45 using System.Collections.Generic;
56 using System.Text;
@@ -11,20 +12,18 @@
1112 }
1213
1314 public class DockContentContributionResolver {
14- public static readonly string SepalatorPersist = "::";
1515 public static DockContent ResolveDockContent(string persist) {
16- int n = persist.IndexOf(SepalatorPersist);
17- string id = persist.Substring(0, n);
18- string nam = persist.Substring(n + SepalatorPersist.Length);
19- Contribution ctb = PluginManager.theInstance.GetContribution(new VContributionId(id));
16+ VDockContentId contentId = VDockContentId.RestoreFromString(persist);
17+ Contribution ctb = PluginManager.theInstance.GetContribution(contentId.ContributionID);
18+ String innerName = contentId.Name;
2019 IDockContentFactory fct = ctb as IDockContentFactory;
2120 if (fct != null) {
22- return fct.CreateDockContent(nam);
21+ return fct.CreateDockContent(innerName);
2322 }
2423 CtbCommand cmd = ctb as CtbCommand;
2524 if (cmd != null && cmd.Commandprocedure is IDockContentFactory) {
2625 fct = cmd.Commandprocedure as IDockContentFactory;
27- return fct.CreateDockContent(nam);
26+ return fct.CreateDockContent(innerName);
2827 }
2928 return null;
3029 }
--- trunk/mainframe/ui/docking/SubformHolder.cs (revision 73)
+++ trunk/mainframe/ui/docking/SubformHolder.cs (revision 74)
@@ -6,6 +6,7 @@
66 using nft.ui.mainframe_old;
77 using System.Windows.Forms;
88 using nft.ui.mainframe;
9+using nft.ui.ui.docking;
910
1011 namespace nft.ui.docking {
1112
@@ -77,7 +78,7 @@
7778 get { return option; }
7879 }
7980
80- public Boolean HasOption(StyleOption o){
81+ public Boolean HasOption(StyleOption o) {
8182 return (option & o) != 0;
8283 }
8384
@@ -202,10 +203,10 @@
202203 }
203204 }
204205
205- protected static LayoutState FromState(DockState s){
206+ protected static LayoutState FromState(DockState s) {
206207 if (s == DockState.Float) {
207208 return LayoutState.Float;
208- } else if(s == DockState.DockLeft){
209+ } else if (s == DockState.DockLeft) {
209210 return LayoutState.Left;
210211 } else if (s == DockState.DockRight) {
211212 return LayoutState.Right;
@@ -228,6 +229,6 @@
228229 }
229230 #endregion
230231
231- internal protected abstract string GetParsisitString();
232+ internal protected abstract VDockContentId ContentID { get; }
232233 }
233234 }
--- trunk/mainframe/ui/docking/VDockContentId.cs (nonexistent)
+++ trunk/mainframe/ui/docking/VDockContentId.cs (revision 74)
@@ -0,0 +1,46 @@
1+using nft.framework;
2+using nft.framework.plugin;
3+using System;
4+using System.Collections.Generic;
5+using System.Linq;
6+using System.Text;
7+using System.Threading.Tasks;
8+
9+namespace nft.ui.ui.docking
10+{
11+ public class VDockContentId : VAbstractIdentifier
12+ {
13+ static public readonly string CID_Sepalator = "::";
14+
15+ internal static VDockContentId RestoreFromString(string idstr)
16+ {
17+ return new VDockContentId(idstr);
18+ }
19+
20+ private VDockContentId(string idstr) : base(idstr)
21+ {
22+ }
23+
24+ public VDockContentId(VContributionId id, string name) : base(id.AsString + CID_Sepalator + name)
25+ {
26+ }
27+
28+ public VContributionId ContributionID
29+ {
30+ get
31+ {
32+ int n = AsString.IndexOf(CID_Sepalator);
33+ return VContributionId.FromString(AsString.Substring(0, n));
34+ }
35+ }
36+
37+ public string Name
38+ {
39+ get
40+ {
41+ int n = AsString.IndexOf(CID_Sepalator);
42+ return AsString.Substring(n + CID_Sepalator.Length);
43+ }
44+ }
45+ }
46+}