Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Wed Mar 06 11:43:29 2019 +0000
Parent:
55:3d1e52e3e9b7
Child:
57:8fa31ff4e773
Commit message:
Updated button input to align the button

Changed in this revision

clock/http-clock-html.c Show annotated file Show diff for this revision Revisions of this file
fault/http-fault-html.c Show annotated file Show diff for this revision Revisions of this file
log/http-log-html.c Show annotated file Show diff for this revision Revisions of this file
page/page.c Show annotated file Show diff for this revision Revisions of this file
page/page.h Show annotated file Show diff for this revision Revisions of this file
--- a/clock/http-clock-html.c	Tue Mar 05 16:57:03 2019 +0000
+++ b/clock/http-clock-html.c	Wed Mar 06 11:43:29 2019 +0000
@@ -58,8 +58,8 @@
     PageAddIntInput ("/clock", 0, "Offset reset limit (s)",  12, "maxoffsetsecs",  5, ClkGovSlewOffsetMaxSecs         );
     
     PageAddH2("Trace");
-    if (ClkGovTrace) PageAddCheckInput("/clock", "Trace gov on" , "clockgovtrace", "turn off");
-    else             PageAddCheckInput("/clock", "Trace gov off", "clockgovtrace", "turn on" );
+    if (ClkGovTrace) PageAddCheckInput("/clock", "Trace gov is on" , 10, "clockgovtrace", "turn off");
+    else             PageAddCheckInput("/clock", "Trace gov is off", 10, "clockgovtrace", "turn on" );
 
     PageAddH2("Scan times");
     PageAddLabelledInt("Program cycles avg", 17, ScanAverage);
--- a/fault/http-fault-html.c	Tue Mar 05 16:57:03 2019 +0000
+++ b/fault/http-fault-html.c	Wed Mar 06 11:43:29 2019 +0000
@@ -23,11 +23,11 @@
         FaultZoneToString(FaultZoneGet(), sizeof(text), text);
         PageAddLabelledValue("Fault zone", 17, text);
         PageAddLabelledInt("After point", 17, FaultPointGet());
-        PageAddCheckInput("/fault", "Clear fault", "faultclear", "clear");
+        PageAddCheckInput("/fault", "Clear fault", 0, "faultclear", "clear");
     }
     else
     {
-        PageAddCheckInput("/fault", "Test fault", "faulttest", "test");
+        PageAddCheckInput("/fault", "Test fault", 0, "faulttest", "test");
     }
     
     PageAddEnd();
--- a/log/http-log-html.c	Tue Mar 05 16:57:03 2019 +0000
+++ b/log/http-log-html.c	Wed Mar 06 11:43:29 2019 +0000
@@ -11,7 +11,7 @@
     PageAddH1(PageSite, "Log");
     
     HttpAddText("<h2>");
-    PageAddCheckInput("/log", "Log", "clearlog", "clear");
+    PageAddCheckInput("/log", "Log", 0, "clearlog", "clear");
     HttpAddText("</h2>\r\n");
     
     HttpAddText("<code>");
--- a/page/page.c	Tue Mar 05 16:57:03 2019 +0000
+++ b/page/page.c	Wed Mar 06 11:43:29 2019 +0000
@@ -179,11 +179,20 @@
     snprintf(text, sizeof(text), "%d", value);
     PageAddTextInput(action, width, label, labelwidth, name, inputwidth, text);
 }
-void PageAddCheckInput(char* action, char* label, char* name, char* button)
+void PageAddCheckInput(char* action, char* label, float labelwidth, char* name, char* button)
 {
+    char text[100];
     HttpAddText("<form action='");              HttpAddText(action); HttpAddText("' method='get'>\r\n");
     HttpAddText("<input type='hidden' name='"); HttpAddText(name);   HttpAddText("'>\r\n");
-    HttpAddText(label); HttpAddText("\r\n");
+    if (labelwidth < 0.1)
+    {
+        HttpAddText(label); HttpAddText("\r\n");
+    }
+    else
+    {
+        snprintf(text, sizeof(text), "<div style='width:%.1fem; display:inline-block;'>%s</div>\r\n", labelwidth, label);
+        HttpAddText(text);
+    }
     HttpAddText("<input type='submit' value='"); HttpAddText(button); HttpAddText("'>\r\n");
     HttpAddText("</form>\r\n");
 }
--- a/page/page.h	Tue Mar 05 16:57:03 2019 +0000
+++ b/page/page.h	Wed Mar 06 11:43:29 2019 +0000
@@ -29,7 +29,7 @@
 extern void PageAddTextInput    (char* action, float width, char* label, float labelwidth, char* name, float inputwidth, char* value);
 extern void PageAddIntInput     (char* action, float width, char* label, float labelwidth, char* name, float inputwidth, int value);
 extern void PageAddHexInput     (char* action, float width, char* label, float labelwidth, char* name, float inputwidth, char value0, char value1);
-extern void PageAddCheckInput   (char* action, char* label, char* name, char* button);
+extern void PageAddCheckInput   (char* action,              char* label, float labelwidth, char* name, char* button);
 
 extern void PageAddAjaxToggle   (float labelwidth, char* label,                   char* id, char* request);
 extern void PageAddAjaxInput    (float labelwidth, char* label, float inputwidth, char* id, char* request);