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