OSDN Git Service

2957ffcd621b74a5f936607e1441361af86ec94e
[csp-qt/common_source_project-fm7.git] / source / src / qt / common / emuevents_control.cpp
1
2
3 #include "qt_emuevents.h"
4 #include "qt_main.h"
5 #include "qt_dialogs.h"
6 #include "emu_utils.h"
7
8 extern EMU *emu;
9
10 void Ui_MainWindow::OnReset(void)
11 {
12     printf("Reset\n");
13     if(emu) emu->reset();
14 }
15   void Ui_MainWindow::OnSpecialReset(void)
16   {
17 #ifdef USE_SPECIAL_RESET
18      printf("Special Reset\n");
19     if(emu) emu->special_reset();
20 #endif
21   }
22 #ifdef USE_STATE
23   void Ui_MainWindow::OnLoadState(void) // Final entry of load state.
24   {
25     if(emu) emu->load_state();
26   }
27   
28   void Ui_MainWindow::OnSaveState(void)
29   {
30     if(emu) emu->save_state();
31   }
32 #endif
33 #ifdef USE_BOOT_MODE
34 #endif
35
36 #ifdef USE_CPU_TYPE
37 #endif
38
39 void Ui_MainWindow::OnCpuPower(int mode)
40 {
41   config.cpu_power = mode;
42   if(emu) {
43     emu->update_config();
44   }
45 }
46
47 #ifdef USE_AUTO_KEY
48 void Ui_MainWindow::OnStartAutoKey(void)
49 {
50   if(emu) {
51     emu->start_auto_key();
52   }
53 }
54 void Ui_MainWindow::OnStopAutoKey(void)
55 {
56   if(emu) {
57     emu->stop_auto_key();
58   }
59 }
60 #endif
61 #ifdef USE_DEBUGGER
62  void Ui_MainWindow::OnOpenDebugger(int no)
63  {
64    if((no < 0) || (no > 3)) return;
65    if(emu) emu->open_debugger(no);
66  }
67 void Ui_MainWindow::OnCloseDebugger(void )
68  {
69    if(emu) emu->close_debugger();
70  }
71 #endif
72
73
74 // Will move to other file.
75 #if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)
76 //void OpenRecentFloppy(QWidget *parent, int drv, int num)
77
78 void OnCloseFD(int drive)
79 {
80   if(emu) close_disk(drive);
81 }
82 // Use Dialog
83 #endif
84
85 #ifdef USE_DIPSWITCH
86 void OnToggleDipSw(int dipsw)
87 {
88   if((dipsw < 0) || (dipsw > 31)) return;
89   config.dipswitch ^= (1 << dipsw);
90 }
91 void OnChangeDipSw(int dipsw, int flag)
92 {
93  
94   if((dipsw < 0) || (dipsw > 31)) return;
95   if(flag == 0) {
96     config.dipswitch &= ~(1 << dipsw);
97   } else {
98     config.dipswitch |= (1 << dipsw);
99   }
100 }
101 #endif
102 #ifdef USE_DEVICE_TYPE
103 void OnSetDeviceType(int devtype)
104 {
105   if((devtype < 0) || (devtype > 7)) return;
106   config.device_type = devtype;
107 }
108 #endif
109
110 #if defined(USE_CART1) || defined(USE_CART2)
111 #endif
112
113
114 #if defined(USE_QD1) || defined(USE_QD2)
115 void OnOpenQD(QWidget *parent, int drive)
116 {
117 //  if(emu) open_quickdisk_dialog(AGWIDGET(hWindow), drive);
118 }
119
120 void OnCloseQD(int drive)
121 {
122 //  if(emu) emu->close_quickdisk(drive);
123 }
124
125 void OnRecentQD(int drive, int menunum)
126 {
127   std::string path;
128   int i;
129
130   if((menunum < 0) || (menunum > 7)) return;
131   path = config.recent_quickdisk_path[drive][menunum];
132   
133   for(int i = menunum; i > 0; i--) {
134     strcpy(config.recent_quickdisk_path[drive][i], config.recent_quickdisk_path[drive][i - 1]);
135   }
136   strcpy(config.recent_quickdisk_path[drive][0], path.c_str());
137   if(emu) {
138     emu->open_quickdisk(drive, path.c_str());
139   }
140 }
141 #endif
142 #ifdef USE_TAPE
143
144 #endif
145 #ifdef USE_TAPE_BUTTON
146 #endif
147 // Implement LASER-DISC, BINARY
148 //
149
150 void OnStartRecordScreen(int num)
151 {
152
153   const int fps[3] = {60, 30, 15};
154   if((num < 0) || (num > 2)) return;
155   if(emu) {
156     emu->start_rec_sound();
157     if(!emu->start_rec_video(fps[num])) {
158       emu->stop_rec_sound();
159     }
160   }
161 }
162 void OnStopRecordScreen(void)
163 {
164   if(emu) {
165     emu->stop_rec_video();
166     emu->stop_rec_sound();
167   }
168 }
169
170 void OnScreenCapture(QWidget *parent)
171 {
172   if(emu) emu->capture_screen();
173 }
174
175
176
177
178 void OnFullScreen(QMainWindow *MainWindow, QWidget *drawspace, int mode)
179 {
180 }
181