]> git.sesse.net Git - pistorm/blobdiff - platforms/amiga/pistorm-dev/pistorm_dev_amiga/gui_interact.c
Fix font rendering issue in GUI
[pistorm] / platforms / amiga / pistorm-dev / pistorm_dev_amiga / gui_interact.c
index 789f4d83954ef7a2f2615c9668017c771ae6f6c3..b18a556424efa15545de840ce4024305f2767f8a 100644 (file)
@@ -19,7 +19,7 @@
 extern unsigned int pistorm_base_addr;
 struct ReqToolsBase *ReqToolsBase;
 
-#define VERSION "v0.3"
+#define VERSION "v0.3.4"
 
 #define button1w 54
 #define button1h 11
@@ -33,9 +33,20 @@ struct ReqToolsBase *ReqToolsBase;
 #define tbox1w 130
 #define tbox1h 10
 
+#define tbox2w 132
+#define tbox2h 12
+
 #define statusbarw 507
 #define statusbarh 10
 
+struct TextAttr font =
+{
+        "topaz.font",
+        8,
+        FS_NORMAL,
+        0
+};
+
 SHORT SharedBordersPairs0[] =
 {
     0, 0, 0, button1h - 1, 1, button1h - 2, 1, 0, button1w - 2, 0
@@ -80,11 +91,11 @@ SHORT SharedBordersPairs8[] =
 
 SHORT SharedBordersPairs9[] =
 {
-    0, 0, 0, tbox1h - 1, 1, tbox1h - 2, 1, 0, tbox1w - 2, 0
+    0, 0, 0, tbox2h - 1, 1, tbox2h - 2, 1, 0, tbox2w - 2, 0
 };
 SHORT SharedBordersPairs10[] =
 {
-    1, tbox1h - 1, tbox1w - 2, tbox1h - 1, tbox1w - 2, 1, tbox1w - 1, 0, tbox1w - 1, tbox1h - 1
+    1, tbox2h - 1, tbox2w - 2, tbox2h - 1, tbox2w - 2, 1, tbox2w - 1, 0, tbox2w - 1, tbox2h - 1
 };
 
 
@@ -117,14 +128,14 @@ struct Border SharedBordersInvert[] =
 
 struct IntuiText KickstartCommit_text =
 {
-    1, 0, JAM2, 2, 2, NULL, (UBYTE *)"Commit", NULL
+    1, 0, JAM2, 2, 2, &font, (UBYTE *)"Commit", NULL
 };
 
 #define GADKICKSTARTCOMMIT 14
 
 struct Gadget KickstartCommit =
 {
-    NULL, 406, 49, button1w, button1h,
+    NULL, 401, 49, button1w, button1h,
     GADGHIMAGE,
     RELVERIFY,
     BOOLGADGET,
@@ -142,7 +153,7 @@ struct StringInfo KickstartFileValue =
 
 struct IntuiText KickstartFile_text =
 {
-    1, 0, JAM2, 0, -10, NULL, "Kickstart file:", NULL
+    1, 0, JAM2, 0, -10, &font, "Kickstart file:", NULL
 };
 
 #define GADKICKSTARTFILE 13
@@ -159,7 +170,7 @@ struct Gadget KickstartFile =
 
 struct IntuiText ShutdownButton_text =
 {
-    1, 0, JAM2, 2, 2, NULL, (UBYTE *)"Shutdown Pi", NULL
+    1, 0, JAM2, 2, 2, &font, (UBYTE *)"Shutdown Pi", NULL
 };
 
 #define GADSHUTDOWN 12
@@ -179,15 +190,15 @@ UBYTE DestinationValue_buf[255];
 
 struct IntuiText Destination_text[] =
 {
-    1, 0, JAM2, -97, 1, NULL, "Destination:", &Destination_text[1],
-    1, 0, JAM2, 1, 1, NULL, DestinationValue_buf, NULL,
+    1, 0, JAM2, -98, 1, &font, "Destination:", &Destination_text[1],
+    1, 0, JAM2, 1, 1, &font, DestinationValue_buf, NULL,
 };
 
 #define GADGETDESTINATION 11
 
 struct Gadget GetDestination =
 {
-    &ShutdownButton, 106, 105, tbox1w, tbox1h,
+    &ShutdownButton, 107, 105, tbox2w, tbox2h,
     GADGHIMAGE,
     RELVERIFY,
     BOOLGADGET,
@@ -197,7 +208,7 @@ struct Gadget GetDestination =
 
 struct IntuiText RebootButton_text =
 {
-    1, 0, JAM2, 2, 2, NULL, (UBYTE *)"Reboot", NULL
+    1, 0, JAM2, 2, 2, &font, (UBYTE *)"Reboot", NULL
 };
 
 #define GADREBOOT 10
@@ -212,11 +223,11 @@ struct Gadget RebootButton =
     &RebootButton_text, 0, NULL, GADREBOOT, NULL
 };
 
-UBYTE StatusBar_buf[128] = "PiStorm...";
+UBYTE StatusBar_buf[128] = "Reticulating splines...";
 
 struct IntuiText StatusBar_text =
 {
-    1, 0, JAM2, 4, 2, NULL, (UBYTE *)StatusBar_buf, NULL
+    1, 0, JAM2, 4, 2, &font, (UBYTE *)StatusBar_buf, NULL
 };
 
 #define GADSTATUSBAR 9
@@ -234,14 +245,14 @@ struct Gadget StatusBar =
 
 struct IntuiText RetrieveButton_text =
 {
-    1, 0, JAM2, 10, 2, NULL, (UBYTE *)"Retrieve", NULL
+    1, 0, JAM2, 10, 2, &font, (UBYTE *)"Retrieve", NULL
 };
 
 #define GADRETRIEVEBUTTON 8
 
 struct Gadget RetrieveButton =
 {
-    &StatusBar, 244, 105, button2w, button2h,
+    &StatusBar, 244, 99, button2w, button2h,
     GADGHIMAGE,
     RELVERIFY,
     BOOLGADGET,
@@ -258,8 +269,8 @@ struct StringInfo GetFileValue =
 
 struct IntuiText GetFile_text[] =
 {
-    1, 0, JAM2, -98, -10, NULL, "Get file from PiStorm:", &GetFile_text[1],
-    1, 0, JAM2, -59, 1, NULL, "Source:", NULL,
+    1, 0, JAM2, -98, -10, &font, "Get file from PiStorm:", &GetFile_text[1],
+    1, 0, JAM2, -59, 1, &font, "Source:", NULL,
 };
 
 #define GADGETFILE 7
@@ -276,7 +287,7 @@ struct Gadget GetFile =
 
 struct IntuiText ConfigDefault_text =
 {
-    1, 0, JAM2, 2, 2, NULL, (UBYTE *)"Load Default", NULL
+    1, 0, JAM2, 2, 2, &font, (UBYTE *)"Load Default", NULL
 };
 
 #define GADCONFIGDEFAULT 6
@@ -293,7 +304,7 @@ struct Gadget ConfigDefault =
 
 struct IntuiText ConfigCommit_text =
 {
-    1, 0, JAM2, 2, 2, NULL, (UBYTE *)"Commit", NULL
+    1, 0, JAM2, 2, 2, &font, (UBYTE *)"Commit", NULL
 };
 
 #define GADCONFIGCOMMIT 5
@@ -318,7 +329,7 @@ struct StringInfo ConfigFileValue =
 
 struct IntuiText ConfigFile_text =
 {
-    1, 0, JAM2, 0, -10, NULL, "Config file:", NULL
+    1, 0, JAM2, 0, -10, &font, "Config file:", NULL
 };
 
 #define GADCONFIGFILE 4
@@ -337,14 +348,14 @@ UBYTE RTGStatus_buf[64] = "RTG status";
 
 struct IntuiText RTGStatus_text =
 {
-    1, 0, JAM2, 1, 1, NULL, (UBYTE *)RTGStatus_buf, NULL
+    1, 0, JAM2, 1, 1, &font, (UBYTE *)RTGStatus_buf, NULL
 };
 
 #define GADRTGSTATUS 3
 
 struct Gadget RTGStatus =
 {
-    &ConfigFile, 14, 15, tbox1w, tbox1h,
+    &ConfigFile, 10, 20, tbox1w, tbox1h,
     GADGHIMAGE,
     0,
     BOOLGADGET,
@@ -356,14 +367,14 @@ UBYTE RTG_buf[64] = "RTG Enable";
 
 struct IntuiText RTG_text =
 {
-    1, 0, JAM2, 8, 2, NULL, (UBYTE *)RTG_buf, NULL
+    1, 0, JAM2, 8, 2, &font, (UBYTE *)RTG_buf, NULL
 };
 
 #define GADRTGBUTTON 2
 
 struct Gadget RTGButton =
 {
-    &RTGStatus, 150, 14, button3w, button3h,
+    &RTGStatus, 144, 19, button3w, button3h,
     GADGHIMAGE,
     RELVERIFY,
     BOOLGADGET,
@@ -373,7 +384,7 @@ struct Gadget RTGButton =
 
 struct IntuiText AboutButton_text =
 {
-    1, 0, JAM2, 8, 2, NULL, (UBYTE *)"About", NULL
+    1, 0, JAM2, 8, 2, &font, (UBYTE *)"About", NULL
 };
 
 #define GADABOUT 1
@@ -391,7 +402,7 @@ struct Gadget AboutButton =
 
 struct IntuiText QuitButton_text =
 {
-    1, 0, JAM2, 12, 2, NULL, (UBYTE *)"Quit", NULL
+    1, 0, JAM2, 12, 2, &font, (UBYTE *)"Quit", NULL
 };
 
 #define GADQUIT 0
@@ -409,7 +420,7 @@ struct Gadget QuitButton =
 
 struct NewWindow winlayout =
 {
-    20, 20,
+    0, 0,
     512, 200,
     -1, -1,
     CLOSEWINDOW | GADGETUP | GADGETDOWN,
@@ -485,9 +496,11 @@ static char *GetSavePath()
     else
     {
         rtEZRequest("Out of memory!", "Oh no!", NULL, NULL);
+        return NULL;
     }
 
     strncpy(fullpath, (char*)filereq->Dir, 256);
+    rtFreeRequest((APTR)filereq);
     return fullpath;
 }
 
@@ -515,8 +528,8 @@ int main()
         static struct IntuiText pos;
         struct IntuiText msg[] =
         {
-            1, 0, JAM2, 0, 0, NULL, "You need reqtools.library V38 or higher!.", &msg[1],
-            1, 0, JAM2, 0, 10, NULL, "Please install it in your Libs: drirectory.", NULL,
+            1, 0, JAM2, 0, 0, &font, "You need reqtools.library V38 or higher!.", &msg[1],
+            1, 0, JAM2, 0, 10, &font, "Please install it in your Libs: drirectory.", NULL,
         };
         AutoRequest(NULL, msg, NULL, &pos, 0, 0, 0, 0);
         return RETURN_FAIL;
@@ -533,6 +546,10 @@ int main()
         no_board = TRUE;
         WriteGadgetText("PiStorm not found", StatusBar_buf, myWindow, &StatusBar);
     }
+    else
+    {
+        WriteGadgetText("PiStorm found!", StatusBar_buf, myWindow, &StatusBar);
+    }
     if (!no_board)
     {
         updateRTG(myWindow);
@@ -600,6 +617,7 @@ int main()
                             {
                                 break;
                             }
+                            Disable();
                             unsigned short ret = pi_handle_config(PICFG_LOAD, ConfigFileValue_buf);
                             if (ret == PI_RES_FILENOTFOUND)
                             {
@@ -720,6 +738,7 @@ int main()
                             {
                                 break;
                             }
+                            Disable();
                             unsigned short ret = pi_remap_kickrom(KickstartFileValue_buf);
                             if (ret == PI_RES_FILENOTFOUND)
                             {