Annotation of uae/src/od-macos/macgui.c, revision 1.1.1.3

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.