ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/AmigaOS/prefs_editor_amiga.cpp
(Generate patch)

Comparing BasiliskII/src/AmigaOS/prefs_editor_amiga.cpp (file contents):
Revision 1.10 by cebix, 2000-07-22T16:20:54Z vs.
Revision 1.18 by jlachmann, 2002-06-23T08:27:05Z

# Line 1 | Line 1
1   /*
2   *  prefs_editor_amiga.cpp - Preferences editor, AmigaOS implementation (using gtlayout.library)
3   *
4 < *  Basilisk II (C) 1997-2000 Christian Bauer
4 > *  Basilisk II (C) 1997-2001 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 30 | Line 30
30   #include <cybergraphics/cybergraphics.h>
31   #include <graphics/displayinfo.h>
32   #include <devices/ahi.h>
33 + #define __USE_SYSBASE
34   #include <proto/exec.h>
35   #include <proto/dos.h>
36   #include <proto/intuition.h>
# Line 40 | Line 41
41   #include <proto/Picasso96.h>
42   #include <proto/cybergraphics.h>
43   #include <proto/ahi.h>
44 + #include <inline/exec.h>
45 + #include <inline/dos.h>
46 + #include <inline/intuition.h>
47 + #include <inline/gadtools.h>
48 + #include <inline/gtlayout.h>
49 + #include <inline/graphics.h>
50 + #include <inline/asl.h>
51 + #include <inline/Picasso96.h>
52 + #include <inline/cybergraphics.h>
53 + #include <inline/cybergraphics.h>
54 + #include <inline/ahi.h>
55 + #include <clib/alib_protos.h>
56  
57   #include "sysdeps.h"
58   #include "main.h"
# Line 94 | Line 107 | const int GAD_SCSI3_UNIT = 0x0413;
107   const int GAD_SCSI4_UNIT = 0x0414;
108   const int GAD_SCSI5_UNIT = 0x0415;
109   const int GAD_SCSI6_UNIT = 0x0416;
110 + const int GAD_SCSI_MEMTYPE = 0x0420;
111  
112   const int GAD_VIDEO_TYPE = 0x0500;                      // "Graphics/Sound" pane
113   const int GAD_DISPLAY_X = 0x0501;
# Line 176 | Line 190 | bool PrefsEditor(void)
190          };
191  
192          // Open gtlayout.library
193 <        GTLayoutBase = (struct Library *)OpenLibrary((UBYTE *)"gtlayout.library", 39);
193 >        GTLayoutBase = (struct Library *)OpenLibrary("gtlayout.library", 39);
194          if (GTLayoutBase == NULL) {
195                  WarningAlert(GetString(STR_NO_GTLAYOUT_LIB_WARN));
196                  return true;
# Line 354 | Line 368 | bool PrefsEditor(void)
368                                                  case GAD_BOOTDRIVER:
369                                                          switch (code) {
370                                                                  case 0:
371 <                                                                        PrefsReplaceInt16("bootdriver", 0);
371 >                                                                        PrefsReplaceInt32("bootdriver", 0);
372                                                                          break;
373                                                                  case 1:
374 <                                                                        PrefsReplaceInt16("bootdriver", CDROMRefNum);
374 >                                                                        PrefsReplaceInt32("bootdriver", CDROMRefNum);
375                                                                          break;
376                                                          }
377                                                          break;
378  
379 +                                                case GAD_SCSI_MEMTYPE:
380 +                                                        PrefsReplaceInt32("scsimemtype", code);
381 +                                                        break;
382 +
383                                                  case GAD_VIDEO_TYPE:
384                                                          ghost_graphics_gadgets(h);
385                                                          break;
# Line 428 | Line 446 | bool PrefsEditor(void)
446                                                  case GAD_SCSI6_DEVICE:
447                                                  case GAD_SERIALA_DEVICE:
448                                                  case GAD_SERIALB_DEVICE:
449 +                                                        if (dev_request) {
450 +                                                                LT_LockWindow(win);
451 +                                                                BOOL result = AslRequestTags(dev_request,
452 +                                                                        ASLFR_Window, (ULONG)win,
453 +                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:",
454 +                                                                        TAG_END);
455 +                                                                LT_UnlockWindow(win);
456 +                                                                if (result) {
457 +                                                                        char *str;
458 +                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
459 +                                                                        strncpy(str, dev_request->rf_File, 255);        // Don't copy the directory part. This is usually "DEVS:" and we don't need that.
460 +                                                                        str[255] = 0;
461 +                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
462 +                                                                }
463 +                                                        }
464 +                                                        break;
465 +
466                                                  case GAD_ETHER_DEVICE:
467                                                          if (dev_request) {
468                                                                  LT_LockWindow(win);
469 <                                                                BOOL result = AslRequestTags(dev_request, ASLFR_Window, (ULONG)win, TAG_END);
469 >                                                                BOOL result = AslRequestTags(dev_request,
470 >                                                                        ASLFR_Window, (ULONG)win,
471 >                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:Networks",
472 >                                                                        TAG_END);
473                                                                  LT_UnlockWindow(win);
474                                                                  if (result) {
475                                                                          char *str;
# Line 513 | Line 551 | quit:
551          FreeAslRequest(dev_request);
552          FreeAslRequest(file_request);
553  
554 <        // Delete menus
554 >        // Delete Menus
555          LT_DisposeMenu(menu);
556  
557          // Delete handle
# Line 554 | Line 592 | static void parse_volumes_prefs(void)
592  
593          bootdriver_num = 0;
594  
595 <        int bootdriver = PrefsFindInt16("bootdriver");
595 >        int bootdriver = PrefsFindInt32("bootdriver");
596          switch (bootdriver) {
597                  case 0:
598                          bootdriver_num = 0;
# Line 1067 | Line 1105 | static void create_volumes_pane(struct L
1105  
1106   static char scsi_dev[6][256];
1107   static LONG scsi_unit[6];
1108 + static LONG scsi_memtype;
1109  
1110   // Read SCSI preferences
1111   static void parse_scsi_prefs(void)
# Line 1081 | Line 1120 | static void parse_scsi_prefs(void)
1120                  if (str)
1121                          sscanf(str, "%[^/]/%ld", scsi_dev[i], &scsi_unit[i]);
1122          }
1123 +
1124 +        scsi_memtype = PrefsFindInt32("scsimemtype");
1125   }
1126  
1127   // Read settings from gadgets and set preferences
# Line 1105 | Line 1146 | static void create_scsi_pane(struct Layo
1146          parse_scsi_prefs();
1147  
1148          VGROUP;
1149 <                for (int i=0; i<7; i++) {
1150 <                        HGROUP;
1151 <                                LT_New(h, LA_Type, TEXT_KIND,
1152 <                                        LA_LabelID, STR_SCSI_ID_0 + i,
1153 <                                        TAG_END
1154 <                                );
1155 <                                LT_New(h, LA_Type, STRING_KIND,
1156 <                                        LA_LabelID, STR_DEVICE_CTRL,
1157 <                                        LA_ID, GAD_SCSI0_DEVICE + i,
1158 <                                        LA_Chars, 20,
1159 <                                        LA_STRPTR, (ULONG)scsi_dev[i],
1160 <                                        GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
1161 <                                        LAST_Picker, TRUE,
1162 <                                        TAG_END
1163 <                                );
1164 <                                LT_New(h, LA_Type, INTEGER_KIND,
1165 <                                        LA_LabelID, STR_UNIT_CTRL,
1166 <                                        LA_ID, GAD_SCSI0_UNIT + i,
1167 <                                        LA_Chars, 4,
1168 <                                        LA_LONG, (ULONG)&scsi_unit[i],
1169 <                                        LAIN_UseIncrementers, TRUE,
1170 <                                        GTIN_MaxChars, 8,
1171 <                                        TAG_END
1172 <                                );
1173 <                        ENDGROUP;
1174 <                }
1149 >                LT_New(h, LA_Type, VERTICAL_KIND,
1150 >                        LA_LabelID, STR_SCSI_DEVICES_CTRL,
1151 >                        TAG_END
1152 >                );
1153 >                        for (int i=0; i<7; i++) {
1154 >                                HGROUP;
1155 >                                        LT_New(h, LA_Type, TEXT_KIND,
1156 >                                                LA_LabelID, STR_SCSI_ID_0 + i,
1157 >                                                TAG_END
1158 >                                        );
1159 >                                        LT_New(h, LA_Type, STRING_KIND,
1160 >                                                LA_LabelID, STR_DEVICE_CTRL,
1161 >                                                LA_ID, GAD_SCSI0_DEVICE + i,
1162 >                                                LA_Chars, 20,
1163 >                                                LA_STRPTR, (ULONG)scsi_dev[i],
1164 >                                                GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
1165 >                                                LAST_Picker, TRUE,
1166 >                                                TAG_END
1167 >                                        );
1168 >                                        LT_New(h, LA_Type, INTEGER_KIND,
1169 >                                                LA_LabelID, STR_UNIT_CTRL,
1170 >                                                LA_ID, GAD_SCSI0_UNIT + i,
1171 >                                                LA_Chars, 4,
1172 >                                                LA_LONG, (ULONG)&scsi_unit[i],
1173 >                                                LAIN_UseIncrementers, TRUE,
1174 >                                                GTIN_MaxChars, 8,
1175 >                                                TAG_END
1176 >                                        );
1177 >                                ENDGROUP;
1178 >                        }
1179 >                ENDGROUP;
1180 >                VGROUP;
1181 >                        LT_New(h, LA_Type, CYCLE_KIND,
1182 >                                LA_LabelID, STR_SCSI_MEMTYPE_CTRL,
1183 >                                LA_ID, GAD_SCSI_MEMTYPE,
1184 >                                LACY_FirstLabel, STR_MEMTYPE_CHIP_LAB,
1185 >                                LACY_LastLabel, STR_MEMTYPE_ANY_LAB,
1186 >                                LA_LONG, (ULONG)&scsi_memtype,
1187 >                                TAG_END
1188 >                        );
1189 >                ENDGROUP;
1190          ENDGROUP;
1191   }
1192  
# Line 1146 | Line 1202 | enum {
1202          DISPLAY_SCREEN
1203   };
1204  
1205 < static BYTE display_type;
1205 > static LONG display_type;
1206   static LONG dis_width, dis_height;
1207   static ULONG mode_id;
1208   static BYTE frameskip_num;
# Line 1190 | Line 1246 | static void parse_graphics_prefs(void)
1246  
1247          const char *str = PrefsFindString("screen");
1248          if (str) {
1249 <                if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2)
1249 >                if (sscanf(str, "win/%ld/%ld", &dis_width, &dis_height) == 2)
1250                          display_type = DISPLAY_WINDOW;
1251 <                else if (sscanf(str, "pip/%d/%d", &dis_width, &dis_height) == 2)
1251 >                else if (sscanf(str, "pip/%ld/%ld", &dis_width, &dis_height) == 2)
1252                          display_type = DISPLAY_PIP;
1253                  else if (sscanf(str, "scr/%08lx", &mode_id) == 1)
1254                          display_type = DISPLAY_SCREEN;
# Line 1251 | Line 1307 | static void screen_mode_req(struct Windo
1307  
1308          ULONG id;
1309  
1310 +        // Try P96 first, because it also provides a (fake) cybergraphics.library
1311          if (P96Base) {
1312                  id = p96RequestModeIDTags(
1313                          P96MA_MinDepth, 8,
# Line 1258 | Line 1315 | static void screen_mode_req(struct Windo
1315                          TAG_END
1316                  );
1317          } else {
1318 <                UWORD model_array[] = {PIXFMT_LUT8, PIXFMT_RGB16, PIXFMT_ARGB32, 0, ~0};
1318 >                UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
1319                  id = (ULONG) CModeRequestTags(NULL,
1320                          CYBRMREQ_MinDepth, 8,
1321 <                        CYBRMREQ_CModelArray, (ULONG)model_array,
1321 >                        CYBRMREQ_CModelArray, (ULONG) ModelArray,
1322                          TAG_END
1323                  );
1324          }
# Line 1347 | Line 1404 | static void create_graphics_pane(struct
1404                                  LA_LabelID, STR_VIDEO_TYPE_CTRL,
1405                                  LA_ID, GAD_VIDEO_TYPE,
1406                                  LACY_LabelTable, (ULONG)labels,
1407 <                                LA_BYTE, (ULONG)&display_type,
1407 >                                LA_LONG, (ULONG)&display_type,
1408                                  TAG_END
1409                          );
1410                          LT_New(h, LA_Type, INTEGER_KIND,
# Line 1445 | Line 1502 | static void parse_serial_prefs(void)
1502          ether_unit = 0;
1503  
1504          const char *str = PrefsFindString("ether");
1505 <        if (str)
1506 <                sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1505 >        if (str) {
1506 >                const char *FirstSlash = strchr(str, '/');
1507 >                const char *LastSlash = strrchr(str, '/');
1508 >
1509 >                if (FirstSlash && FirstSlash && FirstSlash != LastSlash) {
1510 >                        // Device name contains path, i.e. "Networks/xyzzy.device"
1511 >                        const char *lp = str;
1512 >                        char *dp = ether_dev;
1513 >
1514 >                        while (lp != LastSlash)
1515 >                                *dp++ = *lp++;
1516 >                        *dp = '\0';
1517 >
1518 >                        sscanf(LastSlash, "/%ld", &ether_unit);
1519 >
1520 > //                      printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
1521 >                } else {
1522 >                        sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1523 >                }
1524 >        }
1525   }
1526  
1527   // Set serial preference item
# Line 1468 | Line 1543 | static void read_serial_settings(void)
1543  
1544          if (strlen(ether_dev)) {
1545                  char str[256];
1546 +
1547                  sprintf(str, "%s/%ld", ether_dev, ether_unit);
1548                  PrefsReplaceString("ether", str);
1549          } else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines