15 |
public partial class Form1 : Form |
public partial class Form1 : Form |
16 |
{ |
{ |
17 |
IEmuConfig CurrentSelectedRom = null; |
IEmuConfig CurrentSelectedRom = null; |
18 |
//PlatformControl CurrentPlatformControl = null; |
PlatformControl CurrentPlatformControl = null; |
19 |
|
GameControl CurrentGameControl = null; |
20 |
public Form1() |
public Form1() |
21 |
{ |
{ |
22 |
InitializeComponent(); |
InitializeComponent(); |
41 |
{ |
{ |
42 |
PlatformControl c = sender as PlatformControl; |
PlatformControl c = sender as PlatformControl; |
43 |
c.BorderStyle = BorderStyle.FixedSingle; |
c.BorderStyle = BorderStyle.FixedSingle; |
44 |
|
CurrentPlatformControl = c; |
45 |
} |
} |
46 |
|
|
47 |
void platform_ctrl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) |
void platform_ctrl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) |
63 |
(e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)) |
(e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)) |
64 |
{ |
{ |
65 |
char t = (char)e.KeyCode; |
char t = (char)e.KeyCode; |
66 |
foreach (Control cc in platform_flow.Controls) |
PlatformControl ctrl = (platform_flow.GetNextControl(CurrentPlatformControl, true) as PlatformControl); |
67 |
|
if (ctrl == null) { ctrl = (platform_flow.GetNextControl(platform_flow.Controls[0], true) as PlatformControl); } |
68 |
|
bool found = false; |
69 |
|
PlatformControl pc = CurrentPlatformControl; |
70 |
|
bool wrapped = false; |
71 |
|
bool not_found = true; |
72 |
|
while (!found) |
73 |
{ |
{ |
74 |
PlatformControl gc = cc as PlatformControl; |
if (wrapped) |
|
if (gc.PlatformName.ToLower().StartsWith(t.ToString().ToLower())) |
|
75 |
{ |
{ |
76 |
platform_flow.ScrollControlIntoView(gc); |
foreach (Control ctl in platform_flow.Controls) |
77 |
gc.Select(); |
{ |
78 |
break; |
PlatformControl p_ctl = ctl as PlatformControl; if (p_ctl.PlatformName.ToLower().StartsWith(t.ToString().ToLower())) { not_found = false; } |
79 |
|
} |
80 |
|
if (not_found) { found = true; } |
81 |
} |
} |
82 |
|
ctrl = (platform_flow.GetNextControl(pc, true) as PlatformControl); |
83 |
|
if (ctrl == null) |
84 |
|
{ |
85 |
|
ctrl = platform_flow.Controls[0] as PlatformControl; |
86 |
|
wrapped = true; |
87 |
|
} |
88 |
|
if (ctrl.PlatformName.ToLower().StartsWith(t.ToString().ToLower())) |
89 |
|
{ |
90 |
|
platform_flow.ScrollControlIntoView(ctrl); |
91 |
|
ctrl.Select(); |
92 |
|
found = true; |
93 |
|
} |
94 |
|
pc = ctrl; |
95 |
} |
} |
96 |
} |
} |
97 |
} |
} |
112 |
platform_ctrl.PlatformName = config.PlatformNameLong; |
platform_ctrl.PlatformName = config.PlatformNameLong; |
113 |
platform_ctrl.PreviewKeyDown += new PreviewKeyDownEventHandler(platform_ctrl_PreviewKeyDown); |
platform_ctrl.PreviewKeyDown += new PreviewKeyDownEventHandler(platform_ctrl_PreviewKeyDown); |
114 |
platform_flow.Controls.Add(platform_ctrl); |
platform_flow.Controls.Add(platform_ctrl); |
|
//platform_flow.SetFlowBreak(platform_ctrl, true); |
|
115 |
platform_ctrl.GotFocus += new EventHandler(platform_ctrl_GotFocus); |
platform_ctrl.GotFocus += new EventHandler(platform_ctrl_GotFocus); |
116 |
platform_ctrl.LostFocus += new EventHandler(platform_ctrl_LostFocus); |
platform_ctrl.LostFocus += new EventHandler(platform_ctrl_LostFocus); |
|
//CurrentPlatformControl = platform_flow.Controls[0] as PlatformControl; |
|
117 |
} |
} |
118 |
platform_flow.Controls[0].Select(); |
platform_flow.Controls[0].Select(); |
119 |
(platform_flow.Controls[0] as PlatformControl).BorderStyle = BorderStyle.FixedSingle; |
(platform_flow.Controls[0] as PlatformControl).BorderStyle = BorderStyle.FixedSingle; |
136 |
game_ctrl.GameName = config.RomTitle; |
game_ctrl.GameName = config.RomTitle; |
137 |
game_ctrl.PreviewKeyDown += new PreviewKeyDownEventHandler(game_ctrl_PreviewKeyDown); |
game_ctrl.PreviewKeyDown += new PreviewKeyDownEventHandler(game_ctrl_PreviewKeyDown); |
138 |
rom_flow.Controls.Add(game_ctrl); |
rom_flow.Controls.Add(game_ctrl); |
|
//rom_flow.SetFlowBreak(game_ctrl, true); |
|
139 |
game_ctrl.GotFocus += new EventHandler(game_ctrl_GotFocus); |
game_ctrl.GotFocus += new EventHandler(game_ctrl_GotFocus); |
140 |
game_ctrl.LostFocus += new EventHandler(game_ctrl_LostFocus); |
game_ctrl.LostFocus += new EventHandler(game_ctrl_LostFocus); |
141 |
} |
} |
153 |
{ |
{ |
154 |
GameControl c = sender as GameControl; |
GameControl c = sender as GameControl; |
155 |
c.BorderStyle = BorderStyle.FixedSingle; |
c.BorderStyle = BorderStyle.FixedSingle; |
156 |
|
CurrentGameControl = c; |
157 |
} |
} |
158 |
|
|
159 |
void game_ctrl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) |
void game_ctrl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) |
178 |
(e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)) |
(e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)) |
179 |
{ |
{ |
180 |
char t = (char)e.KeyCode; |
char t = (char)e.KeyCode; |
181 |
foreach (Control cc in rom_flow.Controls) |
GameControl ctrl = (rom_flow.GetNextControl(CurrentPlatformControl, true) as GameControl); |
182 |
|
if (ctrl == null) { ctrl = (rom_flow.GetNextControl(rom_flow.Controls[0], true) as GameControl); } |
183 |
|
bool found = false; |
184 |
|
GameControl pc = CurrentGameControl; |
185 |
|
bool wrapped = false; |
186 |
|
bool not_found = true; |
187 |
|
while (!found) |
188 |
{ |
{ |
189 |
GameControl gc = cc as GameControl; |
if (wrapped) |
|
if (gc.GameName.ToLower().StartsWith(t.ToString().ToLower())) |
|
190 |
{ |
{ |
191 |
rom_flow.ScrollControlIntoView(gc); |
foreach (Control ctl in rom_flow.Controls) |
192 |
gc.Select(); |
{ |
193 |
break; |
GameControl p_ctl = ctl as GameControl; if (p_ctl.GameName.ToLower().StartsWith(t.ToString().ToLower())) { not_found = false; } |
194 |
|
} |
195 |
|
if (not_found) { found = true; } |
196 |
} |
} |
197 |
} |
ctrl = (rom_flow.GetNextControl(pc, true) as GameControl); |
198 |
|
if (ctrl == null) |
199 |
|
{ |
200 |
|
ctrl = rom_flow.Controls[0] as GameControl; |
201 |
|
wrapped = true; |
202 |
|
} |
203 |
|
if (ctrl.GameName.ToLower().StartsWith(t.ToString().ToLower())) |
204 |
|
{ |
205 |
|
rom_flow.ScrollControlIntoView(ctrl); |
206 |
|
ctrl.Select(); |
207 |
|
found = true; |
208 |
|
} |
209 |
|
pc = ctrl; |
210 |
|
} |
211 |
} |
} |
212 |
} |
} |
213 |
} |
} |