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.3 by cebix, 1999-10-21T22:39:57Z vs.
Revision 1.14 by cebix, 2001-01-04T19:50:22Z

# Line 27 | Line 27
27   #include <libraries/asl.h>
28   #include <libraries/gtlayout.h>
29   #include <libraries/Picasso96.h>
30 + #include <cybergraphics/cybergraphics.h>
31   #include <graphics/displayinfo.h>
32   #include <devices/ahi.h>
33   #include <proto/exec.h>
# Line 37 | Line 38
38   #include <proto/graphics.h>
39   #include <proto/asl.h>
40   #include <proto/Picasso96.h>
41 + #include <proto/cybergraphics.h>
42   #include <proto/ahi.h>
43  
44   #include "sysdeps.h"
# Line 65 | Line 67 | const int GAD_CDROM_DEVICE = 0x0304;
67   const int GAD_CDROM_UNIT = 0x0305;
68   const int GAD_BOOTDRIVER = 0x0306;
69   const int GAD_NOCDROM = 0x0307;
70 + const int GAD_EXTFS = 0x0308;
71  
72   const int GAD_VOLUME_READONLY = 0x0310;         // "Add/Edit Volume" window
73   const int GAD_VOLUME_TYPE = 0x0311;
# Line 142 | Line 145 | static void read_settings(struct LayoutH
145   *  Locale hook - returns string for given ID
146   */
147  
145 #ifdef __GNUC__
148   static __saveds __attribute__((regparm(3))) const char *locale_hook_func(struct Hook *hook /*a0*/, void *id /*a1*/, struct LayoutHandle *h /*a2*/)
147 #else
148 static __saveds __regargs const char *locale_hook_func(struct Hook *hook /*a0*/, void *id /*a1*/, struct LayoutHandle *h /*a2*/)
149 #endif
149   {
150          return GetString((uint32)id);
151   }
# Line 355 | Line 354 | bool PrefsEditor(void)
354                                                  case GAD_BOOTDRIVER:
355                                                          switch (code) {
356                                                                  case 0:
357 <                                                                        PrefsReplaceInt16("bootdriver", 0);
357 >                                                                        PrefsReplaceInt32("bootdriver", 0);
358                                                                          break;
359                                                                  case 1:
360 <                                                                        PrefsReplaceInt16("bootdriver", CDROMRefNum);
360 >                                                                        PrefsReplaceInt32("bootdriver", CDROMRefNum);
361                                                                          break;
362                                                          }
363                                                          break;
# Line 429 | Line 428 | bool PrefsEditor(void)
428                                                  case GAD_SCSI6_DEVICE:
429                                                  case GAD_SERIALA_DEVICE:
430                                                  case GAD_SERIALB_DEVICE:
431 +                                                        if (dev_request) {
432 +                                                                LT_LockWindow(win);
433 +                                                                BOOL result = AslRequestTags(dev_request,
434 +                                                                        ASLFR_Window, (ULONG)win,
435 +                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:",
436 +                                                                        TAG_END);
437 +                                                                LT_UnlockWindow(win);
438 +                                                                if (result) {
439 +                                                                        char *str;
440 +                                                                        GT_GetGadgetAttrs(gad, win, NULL, GTST_String, (ULONG)&str, TAG_END);
441 +                                                                        strncpy(str, dev_request->rf_File, 255);        // Don't copy the directory part. This is usually "DEVS:" and we don't need that.
442 +                                                                        str[255] = 0;
443 +                                                                        LT_SetAttributes(h, gad->GadgetID, GTST_String, (ULONG)str, TAG_END);
444 +                                                                }
445 +                                                        }
446 +                                                        break;
447 +
448                                                  case GAD_ETHER_DEVICE:
449                                                          if (dev_request) {
450                                                                  LT_LockWindow(win);
451 <                                                                BOOL result = AslRequestTags(dev_request, ASLFR_Window, (ULONG)win, TAG_END);
451 >                                                                BOOL result = AslRequestTags(dev_request,
452 >                                                                        ASLFR_Window, (ULONG)win,
453 >                                                                        ASLFR_InitialDrawer, (ULONG) "Devs:Networks",
454 >                                                                        TAG_END);
455                                                                  LT_UnlockWindow(win);
456                                                                  if (result) {
457                                                                          char *str;
# Line 514 | Line 533 | quit:
533          FreeAslRequest(dev_request);
534          FreeAslRequest(file_request);
535  
536 +        // Delete Menus
537 +        LT_DisposeMenu(menu);
538 +
539          // Delete handle
540          LT_DeleteHandle(h);
541  
# Line 528 | Line 550 | quit:
550   */
551  
552   static struct List disk_list;
553 < static char cdrom_name[256];
553 > static char cdrom_name[256], extfs_name[256];
554   static ULONG cdrom_unit, cdrom_flags, cdrom_start, cdrom_size, cdrom_bsize;
555   static BYTE bootdriver_num, nocdrom;
556  
# Line 552 | Line 574 | static void parse_volumes_prefs(void)
574  
575          bootdriver_num = 0;
576  
577 <        int bootdriver = PrefsFindInt16("bootdriver");
577 >        int bootdriver = PrefsFindInt32("bootdriver");
578          switch (bootdriver) {
579                  case 0:
580                          bootdriver_num = 0;
# Line 563 | Line 585 | static void parse_volumes_prefs(void)
585          }
586  
587          nocdrom = PrefsFindBool("nocdrom");
588 +
589 +        extfs_name[0] = 0;
590 +        str = PrefsFindString("extfs");
591 +        if (str)
592 +                strncpy(extfs_name, str, sizeof(extfs_name) - 1);
593   }
594  
595   // Ghost/unghost "Edit" and "Remove" buttons
# Line 869 | Line 896 | do_req:                                                if (req) {
896                  }
897          } while (!done);
898  
872        // Delete handle
873        LT_DeleteHandle(h);
874
899          // Update preferences and list view
900          if (ok_clicked) {
901                  char str[256];
# Line 909 | Line 933 | do_req:                                                if (req) {
933                  LT_SetAttributes(h2, GAD_DISK_LIST, GTLV_Labels, (ULONG)&disk_list, TAG_END);
934                  ghost_volumes_gadgets(h2);
935          }
936 +
937 +        // Delete handle
938 +        LT_DeleteHandle(h);
939   }
940  
941   // Remove volume from list
# Line 954 | Line 981 | static void read_volumes_settings(void)
981                  PrefsRemoveItem("cdrom");
982  
983          PrefsReplaceBool("nocdrom", nocdrom);
984 +
985 +        if (strlen(extfs_name))
986 +                PrefsReplaceString("extfs", extfs_name);
987   }
988  
989   // Create "Volumes" pane
# Line 969 | Line 999 | static void create_volumes_pane(struct L
999                          VGROUP;
1000                                  LT_New(h, LA_Type, LISTVIEW_KIND,
1001                                          LA_ID, GAD_DISK_LIST,
1002 +                                        LA_Chars, 20,
1003                                          GTLV_Labels, (ULONG)&disk_list,
1004                                          LALV_Lines, 6,
1005                                          LALV_Link, (ULONG)NIL_LINK,
# Line 1036 | Line 1067 | static void create_volumes_pane(struct L
1067                                  TAG_END
1068                          );
1069                  ENDGROUP;
1070 +                VGROUP;
1071 +                        LT_New(h, LA_Type, STRING_KIND,
1072 +                                LA_LabelID, STR_EXTFS_CTRL,
1073 +                                LA_ID, GAD_EXTFS,
1074 +                                LA_Chars, 20,
1075 +                                LA_STRPTR, (ULONG)extfs_name,
1076 +                                GTST_MaxChars, sizeof(extfs_name) - 1,
1077 +                                TAG_END
1078 +                        );
1079 +                ENDGROUP;
1080          ENDGROUP;
1081   }
1082  
# Line 1071 | Line 1112 | static void read_scsi_settings(void)
1112  
1113                  if (strlen(scsi_dev[i])) {
1114                          char str[256];
1115 <                        sprintf("%s/%ld", scsi_dev[i], scsi_unit[i]);
1115 >                        sprintf(str, "%s/%ld", scsi_dev[i], scsi_unit[i]);
1116                          PrefsReplaceString(prefs_name, str);
1117                  } else
1118                          PrefsRemoveItem(prefs_name);
# Line 1223 | Line 1264 | static void ghost_graphics_gadgets(struc
1264   // Show screen mode requester
1265   static void screen_mode_req(struct Window *win, struct LayoutHandle *h)
1266   {
1267 <        if (P96Base == NULL)
1267 >        if (P96Base == NULL && CyberGfxBase == NULL)
1268                  return;
1269  
1270          LT_LockWindow(win);
1271 <        ULONG id = p96RequestModeIDTags(
1272 <                P96MA_MinDepth, 8,
1273 <                P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1274 <                TAG_END
1275 <        );
1271 >
1272 >        ULONG id;
1273 >
1274 >        // Try P96 first, because it also provides a (fake) cybergraphics.library
1275 >        if (P96Base) {
1276 >                id = p96RequestModeIDTags(
1277 >                        P96MA_MinDepth, 8,
1278 >                        P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
1279 >                        TAG_END
1280 >                );
1281 >        } else {
1282 >                UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
1283 >                id = (ULONG) CModeRequestTags(NULL,
1284 >                        CYBRMREQ_MinDepth, 8,
1285 >                        CYBRMREQ_CModelArray, (ULONG) ModelArray,
1286 >                        TAG_END
1287 >                );
1288 >        }
1289          LT_UnlockWindow(win);
1290  
1291          if (id != INVALID_ID) {
# Line 1412 | Line 1466 | static void parse_serial_prefs(void)
1466          ether_unit = 0;
1467  
1468          const char *str = PrefsFindString("ether");
1469 <        if (str)
1470 <                sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1469 >        if (str) {
1470 >                const char *FirstSlash = strchr(str, '/');
1471 >                const char *LastSlash = strrchr(str, '/');
1472 >
1473 >                if (FirstSlash && FirstSlash && FirstSlash != LastSlash) {
1474 >                        // Device name contains path, i.e. "Networks/xyzzy.device"
1475 >                        const char *lp = str;
1476 >                        char *dp = ether_dev;
1477 >
1478 >                        while (lp != LastSlash)
1479 >                                *dp++ = *lp++;
1480 >                        *dp = '\0';
1481 >
1482 >                        sscanf(LastSlash, "/%ld", &ether_unit);
1483 >
1484 > //                      printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
1485 >                } else {
1486 >                        sscanf(str, "%[^/]/%ld", ether_dev, &ether_unit);
1487 >                }
1488 >        }
1489   }
1490  
1491   // Set serial preference item
# Line 1435 | Line 1507 | static void read_serial_settings(void)
1507  
1508          if (strlen(ether_dev)) {
1509                  char str[256];
1510 +
1511                  sprintf(str, "%s/%ld", ether_dev, ether_unit);
1512                  PrefsReplaceString("ether", str);
1513          } else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines