• 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

Revision26 (tree)
Time2014-08-04 23:18:23
Authorc477

Log Message

MRT Drawing.(IndexMap,NightColor etc.) Switch output RenderTarget by 0~5 keys.
Form key event trial.

Change Summary

Incremental Difference

--- trunk/plugins/jp.sourceforge.c477.structures.sample01/plugin.xml (revision 25)
+++ trunk/plugins/jp.sourceforge.c477.structures.sample01/plugin.xml (revision 26)
@@ -3,7 +3,23 @@
33 <title>サンプル構造物セット</title>
44 <author>C477</author>
55 <homepage>https://sourceforge.jp/users/c477/</homepage>
6-
6+
7+ <contribution type="CommandUI" id="TestCommandUI">
8+ <name>建物設置</name>
9+ <short-caption>建物</short-caption>
10+ <long-caption>建造物設置</long-caption>
11+ <description>建造物を設置します</description>
12+ <icon index="1">../../res/plugin_icons.bmp</icon>
13+ <setup>
14+ <menu-item parent="BUILD" id="STRUCTURES"/>
15+ </setup>
16+ </contribution>
17+ <contribution type="Command" id="C_BuildTool">
18+ <name>建造物設置フォーム</name>
19+ <class name="nft.ui.core.BuildToolForm" codebase=".UI"/>
20+ <command type="ModelessForm" menupath="BUILD\STRUCTURES" />
21+ </contribution>
22+
723 <contribution type="image" id="pic.ModernDepartment">
824 <default src="stationMDNDepart.bmp"/>
925 <condition when="night" src="stationMDNDepart_n.bmp"/>
--- trunk/plugins/system/plugin.xml (revision 25)
+++ trunk/plugins/system/plugin.xml (revision 26)
@@ -98,6 +98,8 @@
9898 </item>
9999 <item mid="VIEW" caption="表示(&amp;V)">
100100 </item>
101+ <item mid="BUILD" caption="建設(&amp;B)">
102+ </item>
101103 <item mid="HELP" caption="ヘルプ(&amp;H)">
102104 <item mid="DEBUG|XNAFORMTEST" caption="XNAコントロールテスト"/>
103105 <item mid="DEBUG|TABLEFORMTEST" caption="テーブルレイアウトのテスト"/>
--- trunk/xna/NFT.Shader/C#/DefaultEffect.cs (revision 25)
+++ trunk/xna/NFT.Shader/C#/DefaultEffect.cs (revision 26)
@@ -24,6 +24,7 @@
2424 #region Effect Parameters
2525
2626 protected EffectParameter textureParam;
27+ protected EffectParameter textureNightParam;
2728 protected EffectParameter diffuseColorParam;
2829 protected EffectParameter alphaTestParam;
2930 protected EffectParameter objKeyParam;
@@ -209,6 +210,18 @@
209210 set { textureParam.SetValue(value); }
210211 }
211212
213+ /// <summary>
214+ /// Gets or sets the current Night override texture.
215+ /// set null to use Day texture by darken it.
216+ /// </summary>
217+ public Texture2D NightTexture {
218+ get {
219+ return textureNightParam.GetValueTexture2D();
220+ }
221+ set {
222+ textureNightParam.SetValue(value);
223+ }
224+ }
212225
213226 /// <summary>
214227 /// Gets or sets whether vertex color is enabled.
@@ -356,9 +369,10 @@
356369 protected virtual void CacheEffectParameters()
357370 {
358371 textureParam = Parameters["Texture"];
372+ textureNightParam = Parameters["Texture_Night"];
359373 diffuseColorParam = Parameters["DiffuseColor"];
360374 alphaTestParam = Parameters["AlphaTest"];
361- objKeyParam = Parameters["ObjKey"];
375+ objKeyParam = Parameters["IdxColor"];
362376 fogColorParam = Parameters["FogColor"];
363377 fogVectorParam = Parameters["FogVector"];
364378 worldViewProjParam = Parameters["WorldViewProj"];
@@ -374,8 +388,9 @@
374388 /// </summary>
375389 protected override void OnApply()
376390 {
377- Vector3 v3 = new Vector3((htid & 0xffff)/65536f, (htid >>16)/65536f, 1);
378- objKeyParam.SetValue(v3);
391+ byte[] arr = BitConverter.GetBytes(htid);
392+ Vector4 v4 = new Vector4(arr[0] / 255f, arr[1] / 255f, arr[2] / 255f, arr[3] / 255f);
393+ objKeyParam.SetValue(v4);
379394 // Recompute the world+view+projection matrix or fog vector?
380395 dirtyFlags = EffectHelpers.SetWorldViewProjAndFog(dirtyFlags, ref world, ref view, ref projection, ref worldView, fogEnabled, fogStart, fogEnd, worldViewProjParam, fogVectorParam);
381396 //if((dirtyFlags & EffectDirtyFlags.World) != 0)
@@ -421,10 +436,14 @@
421436 // Recompute the shader index?
422437 if ((dirtyFlags & EffectDirtyFlags.ShaderIndex) != 0)
423438 {
424- int shaderIndex = ((int)usage)*2;
425- if (vertexColorEnabled)
426- shaderIndex ++;
427-
439+ int shaderIndex;
440+ if (textureNightParam.GetValueTexture2D() != null && usage!=EffectUsage.Normal) {
441+ shaderIndex = 5 + ((int)usage);
442+ } else {
443+ shaderIndex = ((int)usage) * 2;
444+ if (vertexColorEnabled)
445+ shaderIndex++;
446+ }
428447 //if (!fogEnabled)
429448 // shaderIndex += 1;
430449
--- trunk/xna/NFT.XNA/XnaSurface.cs (revision 25)
+++ trunk/xna/NFT.XNA/XnaSurface.cs (revision 26)
@@ -24,6 +24,10 @@
2424
2525 public class XnaSurface : ISurface
2626 {
27+ public enum RenderOutput : int {
28+ Default=-1, DayColor=0, ObjKeyMap=1, Lighting=2, NightColor=3, DepthMap=6
29+ }
30+
2731 static protected Stopwatch watch = new Stopwatch();
2832
2933 static internal XnaSurface CreateForControl(Control c, SurfaceUsage usage) {
@@ -80,6 +84,7 @@
8084 protected Size szPrefferd;
8185 private int objcount;
8286 private int mrtcount; //Mulit Render Target count
87+ private int idx_out=-1; // Output Render Target (-1:Final image)
8388
8489 protected PostProcessEffect ppEffect;
8590 protected SpriteBatch spriteBatch;
@@ -142,10 +147,10 @@
142147 #endif
143148 switch (usage) {
144149 case SurfaceUsage.GameView:
145- mrtcount = 3;
150+ mrtcount = 4;
146151 break;
147152 case SurfaceUsage.PreCombinedTexture:
148- mrtcount = 2;
153+ mrtcount = 3;
149154 break;
150155 default:
151156 mrtcount = 0;
@@ -224,6 +229,15 @@
224229 return new Point((int)vout.X, (int)vout.Y);
225230 }
226231
232+ public RenderOutput Output{
233+ get {
234+ return (RenderOutput)idx_out;
235+ }
236+ set {
237+ idx_out = (int)value;
238+ }
239+ }
240+
227241 internal int WorkBuffersCount {
228242 get {
229243 return mrtcount;
@@ -294,16 +308,29 @@
294308 void PostProcess() {
295309 if (mrtcount > 0) {
296310 GraphicsDevice.SetRenderTarget(target);
297- ppEffect.CurrentTechnique = ppEffect.Techniques["EdgeDetect"];
298- ppEffect.DepthTexture = WorkTarget(1);
299- // ポストプロセス エフェクトを適用する全画面スプライトを描画します。
300- //spriteBatch.Begin(0, BlendState.Opaque);
301- spriteBatch.Begin(0, BlendState.Opaque, null, null, null, ppEffect);
302- RenderTarget2D finalImage = WorkTarget(0);
311+ RenderTarget2D finalImage;
312+ if (idx_out < 0) {
313+ ppEffect.CurrentTechnique = ppEffect.Techniques["EdgeDetect"];
314+ ppEffect.DepthTexture = WorkTarget(2);
315+ // ポストプロセス エフェクトを適用する全画面スプライトを描画します。
316+ spriteBatch.Begin(0, BlendState.Opaque, null, null, null, ppEffect);
317+ finalImage = WorkTarget(0);
318+ } else if (idx_out < mrtcount){
319+ // デバッグ用:指定作業バッファの出力
320+ spriteBatch.Begin(0, BlendState.Opaque);
321+ finalImage = WorkTarget(idx_out);
322+ } else {
323+ // デバッグ用:指定作業バッファの出力(Alpha値をグレースケール表示)
324+ ppEffect.CurrentTechnique = ppEffect.Techniques["AlphaToGS"];
325+ ppEffect.DepthTexture = WorkTarget(idx_out-mrtcount);
326+ spriteBatch.Begin(0, BlendState.Opaque, null, null, null, ppEffect);
327+ finalImage = WorkTarget(0);
328+ }
303329 XnaRect rct = viewport.Bounds;
304330 rct.Width = Math.Min(rct.Width, finalImage.Width);
305331 rct.Height = Math.Min(rct.Height, finalImage.Height);
306332 spriteBatch.Draw(finalImage, Vector2.Zero, viewport.Bounds, XnaColor.White);
333+
307334 #if false //DEBUG
308335 PointF3D v = CameraPosition;
309336
--- trunk/xna/NFT.XNA/XnaGraphicManager.cs (revision 25)
+++ trunk/xna/NFT.XNA/XnaGraphicManager.cs (revision 26)
@@ -151,6 +151,7 @@
151151 ctrl.Dock = DockStyle.Fill;
152152 parent.Controls.Add(ctrl);
153153 eventtarget = ctrl;
154+ parent.KeyUp += new KeyEventHandler(ctrl.XnaControl_KeyUp);
154155 return ctrl.Surface;
155156 }
156157
--- trunk/xna/NFT.XNA/XnaControl.cs (revision 25)
+++ trunk/xna/NFT.XNA/XnaControl.cs (revision 26)
@@ -13,8 +13,7 @@
1313 using Microsoft.Xna.Framework;
1414 using System.Diagnostics;
1515
16-namespace nft.xna
17-{
16+namespace nft.xna {
1817
1918 /// <summary>
2019 /// このカスタム コントロールは、XNA Framework GraphicsDevice を使用して、
@@ -21,36 +20,35 @@
2120 /// Windows フォームにレンダリングします。
2221 /// ※サンプルにあったGraphicDeviceContorlを大幅カスタマイズ c477
2322 /// </summary>
24- public class XnaControl : Control
25- {
23+ public class XnaControl : Control {
2624 protected XnaSurface surface = null;
2725 SurfaceUsage usage;
2826 #region Initialization
2927
3028 public XnaControl(SurfaceUsage usage) {
31- this.usage = usage;
29+ this.usage = usage;
30+ KeyUp += new KeyEventHandler(XnaControl_KeyUp);
3231 }
3332
34- public XnaControl() : this(SurfaceUsage.Normal) {
33+ public XnaControl()
34+ : this(SurfaceUsage.Normal) {
3535 }
3636
3737 public XnaSurface Surface {
38- get { return surface; }
38+ get {
39+ return surface;
40+ }
3941 }
4042
41- protected override void OnCreateControl()
42- {
43- if (!DesignMode)
44- {
43+ protected override void OnCreateControl() {
44+ if (!DesignMode) {
4545 surface = XnaSurface.CreateForControl(this, usage);
4646 }
4747 base.OnCreateControl();
4848 }
4949
50- protected override void Dispose(bool disposing)
51- {
52- if (disposing && surface != null)
53- {
50+ protected override void Dispose(bool disposing) {
51+ if (disposing && surface != null) {
5452 surface.Dispose();
5553 surface = null;
5654 }
@@ -59,8 +57,7 @@
5957 #endregion
6058
6159 #region Paint
62- protected override void OnPaint(PaintEventArgs evt)
63- {
60+ protected override void OnPaint(PaintEventArgs evt) {
6461 if (surface == null) {
6562 // Assume running in DesignMode.
6663 PaintErrorMessage(evt.Graphics, Text + "\n\n" + GetType());
@@ -87,13 +84,10 @@
8784
8885 // Called when GraphicsDevice is not available.
8986 // For example, Device lost or Running in 'DesignMode==true'
90- protected virtual void PaintErrorMessage(Graphics graphics, string text)
91- {
87+ protected virtual void PaintErrorMessage(Graphics graphics, string text) {
9288 graphics.Clear(SysColor.CornflowerBlue);
93- using (Brush brush = new SolidBrush(SysColor.Black))
94- {
95- using (StringFormat format = new StringFormat())
96- {
89+ using (Brush brush = new SolidBrush(SysColor.Black)) {
90+ using (StringFormat format = new StringFormat()) {
9791 format.Alignment = StringAlignment.Center;
9892 format.LineAlignment = StringAlignment.Center;
9993 graphics.DrawString(text, Font, brush, ClientRectangle, format);
@@ -107,6 +101,35 @@
107101 Invalidate();
108102 }
109103
104+
105+ internal void XnaControl_KeyUp(object sender, KeyEventArgs e) {
106+ if (e.Control) {
107+ switch (e.KeyCode) {
108+ case Keys.D0:
109+ surface.Output = XnaSurface.RenderOutput.Default;
110+ break;
111+ case Keys.D1:
112+ surface.Output = XnaSurface.RenderOutput.DayColor;
113+ break;
114+ case Keys.D2:
115+ surface.Output = XnaSurface.RenderOutput.NightColor;
116+ break;
117+ case Keys.D3:
118+ surface.Output = XnaSurface.RenderOutput.DepthMap;
119+ break;
120+ case Keys.D4:
121+ surface.Output = XnaSurface.RenderOutput.ObjKeyMap;
122+ break;
123+ case Keys.D5:
124+ surface.Output = XnaSurface.RenderOutput.Lighting;
125+ break;
126+ }
127+ Invalidate();
128+ }
129+ }
130+
131+
132+
110133 /*
111134 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
112135 width = ((width + 1) | 1) - 1;
@@ -116,13 +139,11 @@
116139 */
117140
118141 // override to cancel default background fill.
119- protected override void OnPaintBackground(PaintEventArgs pevent)
120- {
142+ protected override void OnPaintBackground(PaintEventArgs pevent) {
121143 }
122144 #endregion
123145
124- private void InitializeComponent()
125- {
146+ private void InitializeComponent() {
126147 this.SuspendLayout();
127148 //
128149 // XnaControl
--- trunk/core/core/GraphicManagerEx.cs (revision 25)
+++ trunk/core/core/GraphicManagerEx.cs (revision 26)
@@ -59,12 +59,13 @@
5959 return entity.CreateTerrainTemplate(rkey, basecol, vertices, brightness);
6060 }
6161
62-
62+ /*
6363 public ITerrainPlate CreateTerrainPlate(Location loc, ITerrainPlateTemplate template) {
64- UInt32 id = (UInt32)((loc.X << 16) + loc.Y);
64+ UInt32 id = (UInt32)(loc.X + loc.Y); //((loc.X << 16) + loc.Y);
6565 return entity.CreateTerrainPlate(id, template);
6666 }
67-
67+ */
68+
6869 public ITerrainPlate CreateTerrainPlate(UInt32 id, ITerrainPlateTemplate template) {
6970 return entity.CreateTerrainPlate(id, template);
7071 }
--- trunk/core/impl/view/GameViewPanel.cs (revision 25)
+++ trunk/core/impl/view/GameViewPanel.cs (revision 26)
@@ -16,7 +16,9 @@
1616 public class GameViewPanel : UserControl
1717 {
1818 SceneBuilder builder;
19+ bool prepared;
1920 public GameViewPanel(GameImpl game) {
21+ prepared = false;
2022 InitializeComponent();
2123 //renderPanel.SurfaceUsage = SurfaceUsage.Normal;
2224 touchPanel.Scroll2 += new ScrollEventHandler(OnTouchPanelScroll);
@@ -25,9 +27,11 @@
2527 }
2628
2729 void EventTarget_MouseMove(object sender, MouseEventArgs e) {
28- //UInt32 u = renderPanel.Surface.HitTestAt(e.X, e.Y);
29- object o = builder.GetObjectAt(e.Location);
30- renderPanel.Refresh();
30+ if (prepared) {
31+ //UInt32 u = renderPanel.Surface.HitTestAt(e.X, e.Y);
32+ object o = builder.GetObjectAt(e.Location);
33+ renderPanel.Refresh();
34+ }
3135 }
3236
3337 public SceneBuilder SceneBuilder {
@@ -48,6 +52,7 @@
4852
4953 void SurfaceReady(object sender, EventArgs e) {
5054 builder.AttachSurface(renderPanel.Surface);
55+ prepared = true;
5156 }
5257
5358 protected override void OnLoad(EventArgs e) {
--- trunk/core/contributions/terrain/TerrainPlateSet.cs (revision 25)
+++ trunk/core/contributions/terrain/TerrainPlateSet.cs (revision 26)
@@ -73,7 +73,8 @@
7373 holder = Add(key, templ);
7474 }
7575 templ = holder.AddRef();
76- return GraphicManager.CreateTerrainPlate(loc, templ);
76+ UInt32 idkey = (UInt32)(hint.VX + hint.VY+0x800000);
77+ return GraphicManager.CreateTerrainPlate(idkey, templ);
7778 }
7879
7980 protected TemplateHolder Add(T key, ITerrainPlateTemplate templ) {
@@ -137,7 +138,8 @@
137138 holder = Add(key, templ);
138139 }
139140 templ = holder.AddRef();
140- return GraphicManager.CreateTerrainPlate(UInt32.MaxValue, templ);
141+ UInt32 idkey = (UInt32)(hint.VX + hint.VY);
142+ return GraphicManager.CreateTerrainPlate(idkey, templ);
141143 }
142144
143145 protected TemplateHolder Add(T key, ITerrainPlateTemplate templ) {
--- trunk/framework/framework/drawing/RenderViewPanel.cs (revision 25)
+++ trunk/framework/framework/drawing/RenderViewPanel.cs (revision 26)
@@ -42,7 +42,8 @@
4242 {
4343 IGraphicManager gm = (IGraphicManager)GlobalModules.GetModule(typeof(IGraphicManager));
4444 surface = gm.CreateSurfaceForControl(this, out eventtarget, usage);
45-
45+ //((Control)surface).KeyDown+=new KeyEventHandler(RenderViewPanel_surface_KeyDown);
46+ this.KeyDown += new KeyEventHandler(RenderViewPanel_KeyDown);
4647 // Disable control to all events are processed by parent.
4748 eventtarget.Enabled = false;
4849 eventtarget = this;
@@ -50,6 +51,10 @@
5051 OnSurfacePrepared(this, new EventArgs());
5152 }
5253 }
54+
55+ void RenderViewPanel_KeyDown(object sender, KeyEventArgs e) {
56+ Debug.WriteLine("RenderViewPanel_KeyDown:" + e.KeyData);
57+ }
5358
5459 public ISurface Surface
5560 {
--- trunk/framework/ui/mainframe/MainFrame.cs (revision 25)
+++ trunk/framework/ui/mainframe/MainFrame.cs (revision 26)
@@ -12,6 +12,7 @@
1212 using nft.framework.drawing;
1313 using System.IO;
1414 using WeifenLuo.WinFormsUI.Docking;
15+using System.Security.Permissions;
1516
1617
1718 namespace nft.ui.mainframe
@@ -44,9 +45,8 @@
4445 //IsMdiContainer = true;
4546 dockManager = new DockingManagerEx(panelCenter);
4647 stripManager = new ToolStripManager(toolStripPanel, mainMenu);
47- //KeyPreview = true;
48- //KeyDown += new KeyEventHandler(MainFrame_KeyDown);
49- //KeyUp += new KeyEventHandler(MainFrame_KeyUp);
48+ KeyPreview = true;
49+ PreviewKeyDown += new PreviewKeyDownEventHandler(MainFrame_PreviewKeyDown);
5050 /*
5151 Bitmap bmp = new Bitmap(2000, 2000, PixelFormat.Format32bppArgb);
5252 Bitmap b2 = bmp;
@@ -61,20 +61,34 @@
6161 Show();
6262 }
6363
64- void MainFrame_KeyUp(object sender, KeyEventArgs e) {
65- if (e.KeyCode == Keys.Left) {
66- Debug.WriteLine("Handled!");
67- e.Handled = true;
68- } else {
69- Debug.Write(e.KeyCode);
70- }
64+ void MainFrame_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
65+ Debug.WriteLine("PreviewKeyDown:" + e.KeyData);
7166 }
7267
73- void MainFrame_KeyDown(object sender, KeyEventArgs e) {
74- Debug.WriteLine("MainFrame getKeyEvent="+e.KeyCode);
68+ #region Key event management
69+ /*
70+ [UIPermission(SecurityAction.Demand, Window = UIPermissionWindow.AllWindows)]
71+ protected override bool ProcessDialogKey(Keys keyData) {
72+ Debug.WriteLine("ProcessDialogKey:" + keyData);
73+ //処理されたとき(consume)は、trueを返す
74+ return base.ProcessDialogKey(keyData);
7575 }
76+ */
7677
77- /// <summary>
78+ //他のMDI子ウィンドウに渡る前にチェックできる。ここで処理するのが望ましい
79+ //PreviewKeyDownは思うように機能しない
80+ [UIPermission(SecurityAction.Demand, Window = UIPermissionWindow.AllWindows)]
81+ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
82+ Debug.WriteLine("ProcessCmdKey:" + keyData);
83+ //処理されたとき(consume)は、trueを返す
84+ //一般のキーとして処理したい場合はfalseを返す
85+ //return false;
86+ return base.ProcessCmdKey(ref msg, keyData);
87+ }
88+
89+ #endregion
90+
91+ /// <summary>
7892 /// 使用されているリソースに後処理を実行します。
7993 /// </summary>
8094 protected override void Dispose( bool disposing )
--- trunk/framework/TODO.txt (revision 25)
+++ trunk/framework/TODO.txt (revision 26)
@@ -79,8 +79,8 @@
7979 ゲームビュー&プレコンバインドでは下記
8080 0:RGB=昼間色、A=透過情報
8181 1:AR=グループ内ID GB=ID塗り分け
82-2:RGB=夜間色、A=
83-3:RGB=照り返し、A=深度
82+2:RGB=照り返し、A=深度
83+3:RGB=夜間色、A=
8484
8585 IDは24bit枠
8686 ・地形は(x-y)値(16bit)+0xff
--- trunk/TestLauncher/test/KeyControlTest.cs (nonexistent)
+++ trunk/TestLauncher/test/KeyControlTest.cs (revision 26)
@@ -0,0 +1,23 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using nft.framework;
6+using System.Windows.Forms;
7+
8+namespace nft.test.test {
9+ public class KeyControlTest {
10+ [TestEntry("静的フォームのキーイベント制御")]
11+ public static void ModlessFormKeyControlTest() {
12+ KeyControlForm form = new KeyControlForm();
13+ form.Show(Application.OpenForms[0]);
14+ }
15+
16+ [TestEntry("モーダルフォームのキーイベント制御")]
17+ public static void ModalFormKeyControlTest() {
18+ KeyControlForm form = new KeyControlForm();
19+ form.ShowDialog(Application.OpenForms[0]);
20+ }
21+
22+ }
23+}
--- trunk/TestLauncher/test/KeyControlForm.Designer.cs (nonexistent)
+++ trunk/TestLauncher/test/KeyControlForm.Designer.cs (revision 26)
@@ -0,0 +1,167 @@
1+namespace nft.test.test {
2+ partial class KeyControlForm {
3+ /// <summary>
4+ /// Required designer variable.
5+ /// </summary>
6+ private System.ComponentModel.IContainer components = null;
7+
8+ /// <summary>
9+ /// Clean up any resources being used.
10+ /// </summary>
11+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
12+ protected override void Dispose(bool disposing) {
13+ if (disposing && (components != null)) {
14+ components.Dispose();
15+ }
16+ base.Dispose(disposing);
17+ }
18+
19+ #region Windows Form Designer generated code
20+
21+ /// <summary>
22+ /// Required method for Designer support - do not modify
23+ /// the contents of this method with the code editor.
24+ /// </summary>
25+ private void InitializeComponent() {
26+ System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
27+ "Item1",
28+ "Sub1"}, -1);
29+ System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem(new string[] {
30+ "Item2",
31+ "Sub2"}, -1);
32+ System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem(new string[] {
33+ "Item3",
34+ "Sub3"}, -1);
35+ System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Child1");
36+ System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Child2");
37+ System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Node1", new System.Windows.Forms.TreeNode[] {
38+ treeNode1,
39+ treeNode2});
40+ System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("Root", new System.Windows.Forms.TreeNode[] {
41+ treeNode3});
42+ this.button1 = new System.Windows.Forms.Button();
43+ this.listBox1 = new System.Windows.Forms.ListBox();
44+ this.listView1 = new System.Windows.Forms.ListView();
45+ this.textBox1 = new System.Windows.Forms.TextBox();
46+ this.c1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
47+ this.c2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
48+ this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
49+ this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
50+ this.treeView1 = new System.Windows.Forms.TreeView();
51+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
52+ this.SuspendLayout();
53+ //
54+ // button1
55+ //
56+ this.button1.Location = new System.Drawing.Point(12, 12);
57+ this.button1.Name = "button1";
58+ this.button1.Size = new System.Drawing.Size(75, 23);
59+ this.button1.TabIndex = 0;
60+ this.button1.Text = "Click me!";
61+ this.button1.UseVisualStyleBackColor = true;
62+ //
63+ // listBox1
64+ //
65+ this.listBox1.FormattingEnabled = true;
66+ this.listBox1.ItemHeight = 12;
67+ this.listBox1.Items.AddRange(new object[] {
68+ "Item1",
69+ "Item2",
70+ "Item3"});
71+ this.listBox1.Location = new System.Drawing.Point(12, 180);
72+ this.listBox1.Name = "listBox1";
73+ this.listBox1.Size = new System.Drawing.Size(107, 52);
74+ this.listBox1.TabIndex = 1;
75+ //
76+ // listView1
77+ //
78+ this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
79+ this.c1,
80+ this.c2});
81+ this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
82+ listViewItem1,
83+ listViewItem2,
84+ listViewItem3});
85+ this.listView1.Location = new System.Drawing.Point(134, 135);
86+ this.listView1.Name = "listView1";
87+ this.listView1.Size = new System.Drawing.Size(138, 97);
88+ this.listView1.TabIndex = 2;
89+ this.listView1.UseCompatibleStateImageBehavior = false;
90+ this.listView1.View = System.Windows.Forms.View.Details;
91+ //
92+ // textBox1
93+ //
94+ this.textBox1.Location = new System.Drawing.Point(12, 42);
95+ this.textBox1.Name = "textBox1";
96+ this.textBox1.Size = new System.Drawing.Size(99, 19);
97+ this.textBox1.TabIndex = 3;
98+ this.textBox1.Text = "ABC";
99+ //
100+ // dateTimePicker1
101+ //
102+ this.dateTimePicker1.Location = new System.Drawing.Point(12, 89);
103+ this.dateTimePicker1.Name = "dateTimePicker1";
104+ this.dateTimePicker1.Size = new System.Drawing.Size(98, 19);
105+ this.dateTimePicker1.TabIndex = 4;
106+ //
107+ // numericUpDown1
108+ //
109+ this.numericUpDown1.Location = new System.Drawing.Point(12, 155);
110+ this.numericUpDown1.Name = "numericUpDown1";
111+ this.numericUpDown1.Size = new System.Drawing.Size(46, 19);
112+ this.numericUpDown1.TabIndex = 5;
113+ //
114+ // treeView1
115+ //
116+ this.treeView1.FullRowSelect = true;
117+ this.treeView1.Location = new System.Drawing.Point(134, 13);
118+ this.treeView1.Name = "treeView1";
119+ treeNode1.Name = "c1";
120+ treeNode1.Text = "Child1";
121+ treeNode2.Name = "c2";
122+ treeNode2.Text = "Child2";
123+ treeNode3.Name = "n1";
124+ treeNode3.Text = "Node1";
125+ treeNode4.Name = "root";
126+ treeNode4.Text = "Root";
127+ this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
128+ treeNode4});
129+ this.treeView1.Size = new System.Drawing.Size(138, 116);
130+ this.treeView1.TabIndex = 6;
131+ //
132+ // KeyControlForm
133+ //
134+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
135+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
136+ this.ClientSize = new System.Drawing.Size(284, 244);
137+ this.Controls.Add(this.treeView1);
138+ this.Controls.Add(this.numericUpDown1);
139+ this.Controls.Add(this.dateTimePicker1);
140+ this.Controls.Add(this.textBox1);
141+ this.Controls.Add(this.listView1);
142+ this.Controls.Add(this.listBox1);
143+ this.Controls.Add(this.button1);
144+ this.KeyPreview = true;
145+ this.Name = "KeyControlForm";
146+ this.Text = "KeyControlForm";
147+ this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.KeyControlForm_KeyDown);
148+ this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.KeyControlForm_PreviewKeyDown);
149+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
150+ this.ResumeLayout(false);
151+ this.PerformLayout();
152+
153+ }
154+
155+ #endregion
156+
157+ private System.Windows.Forms.Button button1;
158+ private System.Windows.Forms.ListBox listBox1;
159+ private System.Windows.Forms.ListView listView1;
160+ private System.Windows.Forms.ColumnHeader c1;
161+ private System.Windows.Forms.ColumnHeader c2;
162+ private System.Windows.Forms.TextBox textBox1;
163+ private System.Windows.Forms.DateTimePicker dateTimePicker1;
164+ private System.Windows.Forms.NumericUpDown numericUpDown1;
165+ private System.Windows.Forms.TreeView treeView1;
166+ }
167+}
\ No newline at end of file
--- trunk/TestLauncher/test/KeyControlForm.cs (nonexistent)
+++ trunk/TestLauncher/test/KeyControlForm.cs (revision 26)
@@ -0,0 +1,50 @@
1+using System;
2+using System.Collections.Generic;
3+using System.ComponentModel;
4+using System.Data;
5+using System.Drawing;
6+using System.Linq;
7+using System.Text;
8+using System.Windows.Forms;
9+using System.Security.Permissions;
10+using System.Diagnostics;
11+
12+namespace nft.test.test {
13+ public partial class KeyControlForm : Form {
14+ public KeyControlForm() {
15+ InitializeComponent();
16+ }
17+
18+ [UIPermission(SecurityAction.Demand,Window = UIPermissionWindow.AllWindows)]
19+ protected override bool ProcessDialogKey(Keys keyData) {
20+ Debug.WriteLine("ProcessDialogKey:" + keyData);
21+ //本来の処理をさせたくないときは、trueを返す
22+ return true;
23+ //return base.ProcessDialogKey(keyData);
24+ }
25+ [UIPermission(SecurityAction.Demand, Window = UIPermissionWindow.AllWindows)]
26+ protected override bool ProcessTabKey(bool forward) {
27+ Debug.WriteLine("ProcessTabKey");
28+ return true;
29+ }
30+
31+ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
32+ Debug.WriteLine("ProcessCmdKey:" + keyData);
33+ return base.ProcessCmdKey(ref msg, keyData);
34+ }
35+ protected override bool ProcessDialogChar(char charCode) {
36+ Debug.WriteLine("ProcessDialogChar:" + new string(charCode,1)+", "+ (uint)charCode);
37+ return base.ProcessDialogChar(charCode);
38+ }
39+
40+ private void KeyControlForm_KeyDown(object sender, KeyEventArgs e) {
41+ e.Handled = true; // 子コントロールにイベントを渡さない
42+ Debug.WriteLine("Event KeyDown:" + e.KeyCode + ", " + e.KeyValue);
43+ }
44+
45+ private void KeyControlForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
46+ Debug.WriteLine("Event PreviewKeyDown:" + e.KeyCode + ", " + e.KeyValue+", inputKey="+e.IsInputKey);
47+ }
48+
49+ }
50+}
--- trunk/ui_jp/ui/core/BuildToolForm.Designer.cs (nonexistent)
+++ trunk/ui_jp/ui/core/BuildToolForm.Designer.cs (revision 26)
@@ -0,0 +1,68 @@
1+namespace nft.ui.core {
2+ partial class BuildToolForm {
3+ /// <summary>
4+ /// Required designer variable.
5+ /// </summary>
6+ private System.ComponentModel.IContainer components = null;
7+
8+ /// <summary>
9+ /// Clean up any resources being used.
10+ /// </summary>
11+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
12+ protected override void Dispose(bool disposing) {
13+ if (disposing && (components != null)) {
14+ components.Dispose();
15+ }
16+ base.Dispose(disposing);
17+ }
18+
19+ #region Windows Form Designer generated code
20+
21+ /// <summary>
22+ /// Required method for Designer support - do not modify
23+ /// the contents of this method with the code editor.
24+ /// </summary>
25+ private void InitializeComponent() {
26+ this.renderView = new nft.framework.drawing.RenderViewPanel();
27+ this.lbStructures = new System.Windows.Forms.ListBox();
28+ this.SuspendLayout();
29+ //
30+ // renderView
31+ //
32+ this.renderView.Location = new System.Drawing.Point(0, 80);
33+ this.renderView.Name = "renderView";
34+ this.renderView.Size = new System.Drawing.Size(192, 195);
35+ this.renderView.SurfaceUsage = nft.framework.drawing.SurfaceUsage.Normal;
36+ this.renderView.TabIndex = 0;
37+ //
38+ // lbStructures
39+ //
40+ this.lbStructures.FormattingEnabled = true;
41+ this.lbStructures.ItemHeight = 12;
42+ this.lbStructures.Location = new System.Drawing.Point(0, 1);
43+ this.lbStructures.Name = "lbStructures";
44+ this.lbStructures.Size = new System.Drawing.Size(192, 76);
45+ this.lbStructures.TabIndex = 1;
46+ //
47+ // BuildToolForm
48+ //
49+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
50+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51+ this.ClientSize = new System.Drawing.Size(192, 274);
52+ this.Controls.Add(this.lbStructures);
53+ this.Controls.Add(this.renderView);
54+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
55+ this.Name = "BuildToolForm";
56+ this.ShowInTaskbar = false;
57+ this.Text = "建造物設置";
58+ this.ResumeLayout(false);
59+
60+ }
61+
62+ #endregion
63+
64+ private framework.drawing.RenderViewPanel renderView;
65+ private System.Windows.Forms.ListBox lbStructures;
66+
67+ }
68+}
\ No newline at end of file
--- trunk/ui_jp/ui/core/BuildToolForm.cs (nonexistent)
+++ trunk/ui_jp/ui/core/BuildToolForm.cs (revision 26)
@@ -0,0 +1,15 @@
1+using System;
2+using System.Collections.Generic;
3+using System.ComponentModel;
4+using System.Data;
5+using System.Drawing;
6+using System.Text;
7+using System.Windows.Forms;
8+
9+namespace nft.ui.core {
10+ public partial class BuildToolForm : Form {
11+ public BuildToolForm() {
12+ InitializeComponent();
13+ }
14+ }
15+}