/[pcsx2_0.9.7]/trunk/pcsx2/gui/Panels/ConfigurationPanels.h
ViewVC logotype

Contents of /trunk/pcsx2/gui/Panels/ConfigurationPanels.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 1 month ago) by william
File MIME type: text/plain
File size: 16908 byte(s)
re-commit (had local access denied errors when committing)
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 // All of the options screens in PCSX2 are implemented as panels which can be bound to
17 // either their own dialog boxes, or made into children of a paged Properties box. The
18 // paged Properties box is generally superior design, and there's a good chance we'll not
19 // want to deviate form that design anytime soon. But there's no harm in keeping nice
20 // encapsulation of panels regardless, just in case we want to shuffle things around. :)
21
22 #pragma once
23
24 #include <wx/statline.h>
25 #include <wx/dnd.h>
26
27 #include "AppCommon.h"
28 #include "ApplyState.h"
29
30
31 namespace Panels
32 {
33 // --------------------------------------------------------------------------------------
34 // DirPickerPanel
35 // --------------------------------------------------------------------------------------
36 // A simple panel which provides a specialized configurable directory picker with a
37 // "[x] Use Default setting" option, which enables or disables the panel.
38 //
39 class DirPickerPanel : public BaseApplicableConfigPanel
40 {
41 typedef BaseApplicableConfigPanel _parent;
42
43 protected:
44 FoldersEnum_t m_FolderId;
45 wxDirPickerCtrl* m_pickerCtrl;
46 pxCheckBox* m_checkCtrl;
47
48 public:
49 DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid, const wxString& label, const wxString& dialogLabel );
50 DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid, const wxString& dialogLabel );
51 virtual ~DirPickerPanel() throw() { }
52
53 void Reset();
54 wxDirName GetPath() const;
55 void SetPath( const wxString& src );
56
57 DirPickerPanel& SetStaticDesc( const wxString& msg );
58 DirPickerPanel& SetToolTip( const wxString& tip );
59
60 wxWindowID GetId() const;
61 wxWindowID GetPanelId() const { return m_windowId; }
62
63 // Overrides!
64
65 void Apply();
66 void AppStatusEvent_OnSettingsApplied();
67 bool Enable( bool enable=true );
68
69 protected:
70 void Init( FoldersEnum_t folderid, const wxString& dialogLabel, bool isCompact );
71
72 void UseDefaultPath_Click( wxCommandEvent &event );
73 void Explore_Click( wxCommandEvent &event );
74 void UpdateCheckStatus( bool someNoteworthyBoolean );
75 };
76
77 // --------------------------------------------------------------------------------------
78 // DocsFolderPickerPanel / LanguageSelectionPanel
79 // --------------------------------------------------------------------------------------
80 class DocsFolderPickerPanel : public BaseApplicableConfigPanel
81 {
82 protected:
83 pxRadioPanel* m_radio_UserMode;
84 DirPickerPanel* m_dirpicker_custom;
85
86 public:
87 virtual ~DocsFolderPickerPanel() throw() { }
88 DocsFolderPickerPanel( wxWindow* parent, bool isFirstTime = true );
89
90 void Apply();
91 void AppStatusEvent_OnSettingsApplied();
92
93 DocsModeType GetDocsMode() const;
94 wxWindowID GetDirPickerId() const { return m_dirpicker_custom ? m_dirpicker_custom->GetId() : 0; }
95
96 protected:
97 void OnRadioChanged( wxCommandEvent& evt );
98 };
99
100 class LanguageSelectionPanel : public BaseApplicableConfigPanel
101 {
102 protected:
103 LangPackList m_langs;
104 wxComboBox* m_picker;
105
106 public:
107 virtual ~LanguageSelectionPanel() throw() { }
108 LanguageSelectionPanel( wxWindow* parent );
109
110 void Apply();
111 void AppStatusEvent_OnSettingsApplied();
112
113 protected:
114 void OnApplyLanguage_Clicked( wxCommandEvent& evt );
115 };
116
117 // --------------------------------------------------------------------------------------
118 // CpuPanelEE / CpuPanelVU
119 // --------------------------------------------------------------------------------------
120 class CpuPanelEE : public BaseApplicableConfigPanel
121 {
122 protected:
123 pxRadioPanel* m_panel_RecEE;
124 pxRadioPanel* m_panel_RecIOP;
125
126 public:
127 CpuPanelEE( wxWindow* parent );
128 virtual ~CpuPanelEE() throw() {}
129
130 void Apply();
131 void AppStatusEvent_OnSettingsApplied();
132
133 protected:
134 void OnRestoreDefaults( wxCommandEvent& evt );
135 };
136
137 class CpuPanelVU : public BaseApplicableConfigPanel
138 {
139 protected:
140 pxRadioPanel* m_panel_VU0;
141 pxRadioPanel* m_panel_VU1;
142
143 public:
144 CpuPanelVU( wxWindow* parent );
145 virtual ~CpuPanelVU() throw() {}
146
147 void Apply();
148 void AppStatusEvent_OnSettingsApplied();
149
150 protected:
151 void OnRestoreDefaults( wxCommandEvent& evt );
152 };
153
154 // --------------------------------------------------------------------------------------
155 // BaseAdvancedCpuOptions
156 // --------------------------------------------------------------------------------------
157 class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel
158 {
159 protected:
160 pxRadioPanel* m_RoundModePanel;
161 pxRadioPanel* m_ClampModePanel;
162
163 pxCheckBox* m_Option_FTZ;
164 pxCheckBox* m_Option_DAZ;
165
166 public:
167 BaseAdvancedCpuOptions( wxWindow* parent );
168 virtual ~BaseAdvancedCpuOptions() throw() { }
169
170 void RestoreDefaults();
171
172 protected:
173 void OnRestoreDefaults( wxCommandEvent& evt );
174 void ApplyRoundmode( SSE_MXCSR& mxcsr );
175 };
176
177 // --------------------------------------------------------------------------------------
178 // AdvancedOptionsFPU / AdvancedOptionsVU
179 // --------------------------------------------------------------------------------------
180 class AdvancedOptionsFPU : public BaseAdvancedCpuOptions
181 {
182 public:
183 AdvancedOptionsFPU( wxWindow* parent );
184 virtual ~AdvancedOptionsFPU() throw() { }
185 void Apply();
186 void AppStatusEvent_OnSettingsApplied();
187 };
188
189 class AdvancedOptionsVU : public BaseAdvancedCpuOptions
190 {
191 public:
192 AdvancedOptionsVU( wxWindow* parent );
193 virtual ~AdvancedOptionsVU() throw() { }
194 void Apply();
195 void AppStatusEvent_OnSettingsApplied();
196 };
197
198 // --------------------------------------------------------------------------------------
199 // FrameSkipPanel
200 // --------------------------------------------------------------------------------------
201 class FrameSkipPanel : public BaseApplicableConfigPanel
202 {
203 protected:
204 wxSpinCtrl* m_spin_FramesToSkip;
205 wxSpinCtrl* m_spin_FramesToDraw;
206 //pxCheckBox* m_check_EnableSkip;
207 //pxCheckBox* m_check_EnableSkipOnTurbo;
208
209 pxRadioPanel* m_radio_SkipMode;
210
211 public:
212 FrameSkipPanel( wxWindow* parent );
213 virtual ~FrameSkipPanel() throw() {}
214
215 void Apply();
216 void AppStatusEvent_OnSettingsApplied();
217 };
218
219 // --------------------------------------------------------------------------------------
220 // FramelimiterPanel
221 // --------------------------------------------------------------------------------------
222 class FramelimiterPanel : public BaseApplicableConfigPanel
223 {
224 protected:
225 pxCheckBox* m_check_LimiterDisable;
226 wxSpinCtrl* m_spin_NominalPct;
227 wxSpinCtrl* m_spin_SlomoPct;
228 wxSpinCtrl* m_spin_TurboPct;
229
230 wxTextCtrl* m_text_BaseNtsc;
231 wxTextCtrl* m_text_BasePal;
232
233 wxCheckBox* m_SkipperEnable;
234 wxCheckBox* m_TurboSkipEnable;
235 wxSpinCtrl* m_spin_SkipThreshold;
236
237 public:
238 FramelimiterPanel( wxWindow* parent );
239 virtual ~FramelimiterPanel() throw() {}
240
241 void Apply();
242 void AppStatusEvent_OnSettingsApplied();
243 };
244
245 // --------------------------------------------------------------------------------------
246 // GSWindowSettingsPanel
247 // --------------------------------------------------------------------------------------
248 class GSWindowSettingsPanel : public BaseApplicableConfigPanel
249 {
250 protected:
251 wxComboBox* m_combo_AspectRatio;
252
253 pxCheckBox* m_check_CloseGS;
254 pxCheckBox* m_check_SizeLock;
255 pxCheckBox* m_check_VsyncEnable;
256 pxCheckBox* m_check_Fullscreen;
257 pxCheckBox* m_check_ExclusiveFS;
258 pxCheckBox* m_check_HideMouse;
259
260 wxTextCtrl* m_text_WindowWidth;
261 wxTextCtrl* m_text_WindowHeight;
262
263 public:
264 GSWindowSettingsPanel( wxWindow* parent );
265 virtual ~GSWindowSettingsPanel() throw() {}
266 void Apply();
267 void AppStatusEvent_OnSettingsApplied();
268 };
269
270 class VideoPanel : public BaseApplicableConfigPanel
271 {
272 protected:
273 pxCheckBox* m_check_SynchronousGS;
274 pxCheckBox* m_check_DisableOutput;
275
276 public:
277 VideoPanel( wxWindow* parent );
278 virtual ~VideoPanel() throw() {}
279 void Apply();
280 void AppStatusEvent_OnSettingsApplied();
281
282 protected:
283 void OnOpenWindowSettings( wxCommandEvent& evt );
284 };
285
286 // --------------------------------------------------------------------------------------
287 // SpeedHacksPanel
288 // --------------------------------------------------------------------------------------
289 class SpeedHacksPanel : public BaseApplicableConfigPanel
290 {
291 protected:
292 wxFlexGridSizer* s_table;
293
294 pxCheckBox* m_check_Enable;
295 wxButton* m_button_Defaults;
296
297 wxSlider* m_slider_eecycle;
298 wxSlider* m_slider_vustealer;
299 pxStaticText* m_msg_eecycle;
300 pxStaticText* m_msg_vustealer;
301
302 pxCheckBox* m_check_intc;
303 pxCheckBox* m_check_waitloop;
304 pxCheckBox* m_check_fastCDVD;
305 pxCheckBox* m_check_vuFlagHack;
306 pxCheckBox* m_check_vuBlockHack;
307 pxCheckBox* m_check_vuMinMax;
308
309 public:
310 virtual ~SpeedHacksPanel() throw() {}
311 SpeedHacksPanel( wxWindow* parent );
312 void Apply();
313 void EnableStuff();
314 void AppStatusEvent_OnSettingsApplied();
315 void AppStatusEvent_OnSettingsApplied( const Pcsx2Config::SpeedhackOptions& opt );
316
317 protected:
318 const wxChar* GetEEcycleSliderMsg( int val );
319 const wxChar* GetVUcycleSliderMsg( int val );
320 void SetEEcycleSliderMsg();
321 void SetVUcycleSliderMsg();
322
323 void OnEnable_Toggled( wxCommandEvent& evt );
324 void Defaults_Click( wxCommandEvent& evt );
325 void Slider_Click(wxScrollEvent &event);
326 void EECycleRate_Scroll(wxScrollEvent &event);
327 void VUCycleRate_Scroll(wxScrollEvent &event);
328 };
329
330 // --------------------------------------------------------------------------------------
331 // GameFixesPanel
332 // --------------------------------------------------------------------------------------
333 class GameFixesPanel : public BaseApplicableConfigPanel
334 {
335 protected:
336 pxCheckBox* m_checkbox[GamefixId_COUNT];
337 pxCheckBox* m_check_Enable;
338
339 public:
340 GameFixesPanel( wxWindow* parent );
341 virtual ~GameFixesPanel() throw() { }
342 void EnableStuff();
343 void OnEnable_Toggled( wxCommandEvent& evt );
344 void Apply();
345 void AppStatusEvent_OnSettingsApplied();
346 };
347
348 // --------------------------------------------------------------------------------------
349 // GameDatabasePanel
350 // --------------------------------------------------------------------------------------
351 class GameDatabasePanel : public BaseApplicableConfigPanel
352 {
353 protected:
354 //wxTextCtrl* searchBox;
355 //wxComboBox* searchType;
356 //wxListBox* searchList;
357 wxButton* searchBtn;
358 wxTextCtrl* serialBox;
359 wxTextCtrl* nameBox;
360 wxTextCtrl* regionBox;
361 wxTextCtrl* compatBox;
362 wxTextCtrl* commentBox;
363 wxTextCtrl* patchesBox;
364 pxCheckBox* gameFixes[GamefixId_COUNT];
365
366 public:
367 GameDatabasePanel( wxWindow* parent );
368 virtual ~GameDatabasePanel() throw() { }
369 void Apply();
370 void AppStatusEvent_OnSettingsApplied();
371
372 protected:
373 void PopulateFields( const wxString& serial=wxEmptyString );
374 bool WriteFieldsToDB();
375 void Search_Click( wxCommandEvent& evt );
376 };
377
378 class SettingsDirPickerPanel : public DirPickerPanel
379 {
380 public:
381 SettingsDirPickerPanel( wxWindow* parent );
382 };
383
384 // --------------------------------------------------------------------------------------
385 // BasePathsPanel / StandardPathsPanel
386 // --------------------------------------------------------------------------------------
387 class BasePathsPanel : public wxPanelWithHelpers
388 {
389 public:
390 BasePathsPanel( wxWindow* parent );
391
392 protected:
393 };
394
395 class StandardPathsPanel : public BasePathsPanel
396 {
397 public:
398 StandardPathsPanel( wxWindow* parent );
399 };
400
401 // --------------------------------------------------------------------------------------
402 // BaseSelectorPanel
403 // --------------------------------------------------------------------------------------
404 class BaseSelectorPanel: public BaseApplicableConfigPanel
405 {
406 typedef BaseApplicableConfigPanel _parent;
407
408 public:
409 virtual ~BaseSelectorPanel() throw();
410 BaseSelectorPanel( wxWindow* parent );
411
412 virtual void RefreshSelections();
413
414 virtual bool Show( bool visible=true );
415 virtual void OnShown();
416 virtual void OnFolderChanged( wxFileDirPickerEvent& evt );
417
418 protected:
419 void OnRefreshSelections( wxCommandEvent& evt );
420
421 virtual void DoRefresh()=0;
422 virtual bool ValidateEnumerationStatus()=0;
423 void OnShow(wxShowEvent& evt);
424 };
425
426 // --------------------------------------------------------------------------------------
427 // BiosSelectorPanel
428 // --------------------------------------------------------------------------------------
429 class BiosSelectorPanel : public BaseSelectorPanel
430 {
431 protected:
432 ScopedPtr<wxArrayString> m_BiosList;
433 wxListBox* m_ComboBox;
434 DirPickerPanel* m_FolderPicker;
435
436 public:
437 BiosSelectorPanel( wxWindow* parent );
438 virtual ~BiosSelectorPanel() throw();
439
440 protected:
441 virtual void Apply();
442 virtual void AppStatusEvent_OnSettingsApplied();
443 virtual void DoRefresh();
444 virtual bool ValidateEnumerationStatus();
445 };
446
447 // --------------------------------------------------------------------------------------
448 // PluginSelectorPanel
449 // --------------------------------------------------------------------------------------
450 class PluginSelectorPanel: public BaseSelectorPanel,
451 public EventListener_Plugins
452 {
453 protected:
454 // ----------------------------------------------------------------------------
455 class EnumeratedPluginInfo
456 {
457 public:
458 uint PassedTest; // msk specifying which plugin types passed the mask test.
459 uint TypeMask; // indicates which combo boxes it should be listed in
460 wxString Name; // string to be pasted into the combo box
461 wxString Version[PluginId_Count];
462
463 EnumeratedPluginInfo()
464 {
465 PassedTest = 0;
466 TypeMask = 0;
467 }
468 };
469
470 // ----------------------------------------------------------------------------
471 class EnumThread : public Threading::pxThread
472 {
473 public:
474 SafeList<EnumeratedPluginInfo> Results; // array of plugin results.
475
476 protected:
477 PluginSelectorPanel& m_master;
478 ScopedBusyCursor m_hourglass;
479 public:
480 virtual ~EnumThread() throw()
481 {
482 pxThread::Cancel();
483 }
484
485 EnumThread( PluginSelectorPanel& master );
486 void DoNextPlugin( int evtidx );
487
488 protected:
489 void ExecuteTaskInThread();
490 };
491
492 // ----------------------------------------------------------------------------
493 // This panel contains all of the plugin combo boxes. We stick them
494 // on a panel together so that we can hide/show the whole mess easily.
495 class ComboBoxPanel : public wxPanelWithHelpers
496 {
497 protected:
498 wxComboBox* m_combobox[PluginId_Count];
499 wxButton* m_configbutton[PluginId_Count];
500 DirPickerPanel& m_FolderPicker;
501
502 public:
503 ComboBoxPanel( PluginSelectorPanel* parent );
504 wxComboBox& Get( PluginsEnum_t pid ) { return *m_combobox[pid]; }
505 wxButton& GetConfigButton( PluginsEnum_t pid ) { return *m_configbutton[pid]; }
506 wxDirName GetPluginsPath() const { return m_FolderPicker.GetPath(); }
507 DirPickerPanel& GetDirPicker() { return m_FolderPicker; }
508 void Reset();
509
510 };
511
512 // ----------------------------------------------------------------------------
513 class StatusPanel : public wxPanelWithHelpers
514 {
515 protected:
516 wxGauge& m_gauge;
517 wxStaticText& m_label;
518 int m_progress;
519
520 public:
521 StatusPanel( wxWindow* parent );
522
523 void SetGaugeLength( int len );
524 void AdvanceProgress( const wxString& msg );
525 void Reset();
526 };
527
528 // ------------------------------------------------------------------------
529 // PluginSelectorPanel Members
530
531 protected:
532 StatusPanel* m_StatusPanel;
533 ComboBoxPanel* m_ComponentBoxes;
534 bool m_Canceled;
535
536 ScopedPtr<wxArrayString> m_FileList; // list of potential plugin files
537 ScopedPtr<EnumThread> m_EnumeratorThread;
538
539 public:
540 virtual ~PluginSelectorPanel() throw();
541 PluginSelectorPanel( wxWindow* parent );
542
543 void CancelRefresh(); // used from destructor, stays non-virtual
544 void Apply();
545
546 protected:
547 void DispatchEvent( const PluginEventType& evt );
548
549 void OnConfigure_Clicked( wxCommandEvent& evt );
550 void OnShowStatusBar( wxCommandEvent& evt );
551 void OnPluginSelected( wxCommandEvent& evt );
552
553 virtual void OnProgress( wxCommandEvent& evt );
554 virtual void OnEnumComplete( wxCommandEvent& evt );
555
556 virtual void AppStatusEvent_OnSettingsApplied();
557
558 virtual void DoRefresh();
559 virtual bool ValidateEnumerationStatus();
560
561 int FileCount() const { return m_FileList->Count(); }
562 const wxString& GetFilename( int i ) const { return (*m_FileList)[i]; }
563
564 friend class EnumThread;
565 };
566 }
567

  ViewVC Help
Powered by ViewVC 1.1.22