|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * Interface to the Tcl/Tk GUI
5: *
6: * Copyright 1996 Bernd Schmidt
7: */
8:
9: #include <stdio.h>
10: #include <stdlib.h>
11: #include <string.h>
12: #ifdef __unix
13: #include <sys/types.h>
14: #include <sys/stat.h>
15: #include <sys/time.h>
16: #endif
17: #include <fcntl.h>
18: #include <unistd.h>
19: #include <signal.h>
20: #include <SIOUX.h>
21:
22: #include "config.h"
23: #include "amiga.h"
24: #include "options.h"
25: #include "memory.h"
26: #include "custom.h"
27: #include "newcpu.h"
28: #include "disk.h"
29: #include "gui.h"
30:
31: #define kAppleMenuID 128
32: #define kFileMenuID 129
33: #define kEditMenuID 130
34: #define kDrivesMenuID 131
35: #define kMemoryMenuID 132
36: #define kResMenuID 135
37: #define kRateMenuID 134
38: #define kVideoMenuID 133
39:
40: MenuHandle resMenu,rateMenu;
41: static int macLedState[5];
42: int quit_program;
43: extern int use_quickdraw;
44: static Rect powerRect, driveDf0Rect, driveDf1Rect, driveDf2Rect, driveDf3Rect;
45:
46: static void sigchldhandler(int foo)
47: {
48: }
49:
50: static void InitToolbox(void)
51: {
52: InitGraf (&qd.thePort);
53: InitFonts ();
54: FlushEvents (everyEvent,0);
55: InitWindows ();
56: InitMenus ();
57: TEInit ();
58: InitDialogs (nil);
59: InitCursor ();
60: }
61:
62: #define kPrefStrRsrc 130
63:
64: int gui_init(void)
65: { char pathString[1024];
66: Handle menuBar;
67:
68: InitToolbox();
69:
70: SIOUXSettings.initializeTB=false;
71: SIOUXSettings.standalone=false;
72: SIOUXSettings.setupmenus=false;
73: SIOUXSettings.autocloseonquit=true;
74: SIOUXSettings.asktosaveonclose=false;
75: SIOUXSettings.showstatusline=false;
76: SIOUXSettings.rows=11;
77: SIOUXSettings.toppixel=350;
78: SIOUXSettings.leftpixel=0;
79: fprintf(stderr,"Starting up the GUI�\n");
80: SIOUXSetTitle("\pInfo Window");
81:
82: if (ReadPrefs(pathString))
83: { if (*pathString != 0) add_filesys_unit("HD0", (char *)pathString, false);
84: }
85: else
86: { if (*pathString == 0)
87: { CreatePrefs();
88: WritePrefs(0);
89: }
90: }
91:
92: menuBar=GetNewMBar(128);
93: SetMenuBar(menuBar);
94: DisposeHandle(menuBar);
95:
96: AddResMenu(GetMenuHandle(kAppleMenuID), 'DRVR');
97:
98: if (screen_res != 4) DisableItem (GetMenuHandle(kFileMenuID), 3);
99: if (use_quickdraw) CheckItem(GetMenuHandle(kVideoMenuID),5,true);
100: if (use_gfxlib) CheckItem(GetMenuHandle(kVideoMenuID),7,true);
101: if (use_slow_mem) SetMenuItemText(GetMenuHandle(kMemoryMenuID), 1, "\pDisable 1 Mb (SlowMem)" );
102: if (!automount_uaedev) CheckItem(GetMenuHandle(kDrivesMenuID),7,true);
103: if (produce_sound) SetMenuItemText(GetMenuHandle(kFileMenuID), 9, "\pTurn Sound Off");
104: else SetMenuItemText(GetMenuHandle(kFileMenuID), 9, "\pTurn Sound On");
105: if (fake_joystick) SetMenuItemText(GetMenuHandle(kFileMenuID), 11, "\pTurn Joystick Off");
106: else SetMenuItemText(GetMenuHandle(kFileMenuID), 11, "\pTurn Joystick On");
107:
108: rateMenu=GetMenu(kRateMenuID);
109: InsertMenu(rateMenu, -1);
110: if (framerate == 1) CheckItem(rateMenu,1,true);
111: if (framerate == 3) CheckItem(rateMenu,2,true);
112: if (framerate == 5) CheckItem(rateMenu,3,true);
113: if (framerate == 7) CheckItem(rateMenu,4,true);
114:
115: resMenu=GetMenu(kResMenuID);
116: InsertMenu(resMenu, -1);
117: CheckItem(resMenu,(unsigned char)screen_res+1,true);
118:
119: DrawMenuBar();
120:
121: macLedState[0]=false;
122: macLedState[1]=false;
123: macLedState[2]=false;
124: macLedState[3]=false;
125: macLedState[4]=false;
126:
127: quit_program = 0;
128: }
129:
1.1.1.2 ! root 130: int gui_update(void)
! 131: {
! 132: return 0;
! 133: }
! 134:
1.1 root 135: void gui_exit(void)
136: {
137: DeleteMenu(kAppleMenuID);
138: DeleteMenu(kFileMenuID);
139: DeleteMenu(kEditMenuID);
140: DeleteMenu(kDrivesMenuID);
141: DeleteMenu(kMemoryMenuID);
142: DeleteMenu(kResMenuID);
143: DeleteMenu(kRateMenuID);
144: DeleteMenu(kVideoMenuID);
145: }
146:
147: void gui_prepare_leds(long screenV)
148: {
149: if (screen_res >= 3)
150: { SetRect(&powerRect,70,(short)screenV+1,110,(short)screenV+11);
151: SetRect(&driveDf0Rect,220,(short)screenV+1,260,(short)screenV+11);
152: SetRect(&driveDf1Rect,292,(short)screenV+1,332,(short)screenV+11);
153: SetRect(&driveDf2Rect,365,(short)screenV+1,405,(short)screenV+11);
154: SetRect(&driveDf3Rect,436,(short)screenV+1,476,(short)screenV+11);
155: }
156: else
157: { SetRect(&powerRect,46,(short)screenV+1,76,(short)screenV+11);
158: SetRect(&driveDf0Rect,106,(short)screenV+1,136,(short)screenV+11);
159: SetRect(&driveDf1Rect,166,(short)screenV+1,196,(short)screenV+11);
160: SetRect(&driveDf2Rect,226,(short)screenV+1,256,(short)screenV+11);
161: SetRect(&driveDf3Rect,286,(short)screenV+1,316,(short)screenV+11);
162: }
163: }
164:
165: void gui_update_leds(void)
166: { int i;
167:
168: for(i=0;i<=4;i++) gui_led(i,macLedState[i]);
169: }
170:
171: void gui_led(int led, int on)
172: {
173: macLedState[led]=on;
174: if (dont_want_aspect || screen_res == 2)
175: { if (led == 0)
176: { if (on)
177: { ForeColor(redColor);
178: PaintRect(&powerRect);
179: }
180: else
181: { ForeColor(whiteColor);
182: PaintRect(&powerRect);
183: }
184: }
185: else
186: { switch (led)
187: { case 1:
188: if (on)
189: { ForeColor(greenColor);
190: PaintRect(&driveDf0Rect);
191: }
192: else
193: { ForeColor(whiteColor);
194: PaintRect(&driveDf0Rect);
195: }
196: break;
197:
198: case 2:
199: if (on)
200: { ForeColor(greenColor);
201: PaintRect(&driveDf1Rect);
202: }
203: else
204: { ForeColor(whiteColor);
205: PaintRect(&driveDf1Rect);
206: }
207: break;
208:
209: case 3:
210: if (on)
211: { ForeColor(greenColor);
212: PaintRect(&driveDf2Rect);
213: }
214: else
215: { ForeColor(whiteColor);
216: PaintRect(&driveDf2Rect);
217: }
218: break;
219:
220: case 4:
221: if (on)
222: { ForeColor(greenColor);
223: PaintRect(&driveDf3Rect);
224: }
225: else
226: { ForeColor(whiteColor);
227: PaintRect(&driveDf3Rect);
228: }
229: break;
230: }
231: }
232: ForeColor(blackColor);
233: }
234: }
235:
236: void gui_filename(int num, char *name)
237: {
238: }
239:
240: static void getline(char *p)
241: {
242: }
243:
244: void gui_handle_events(void)
245: {
246: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.