Browse Source

fix a few formatting issues

David Rose 14 years ago
parent
commit
02ea25e30c
2 changed files with 24 additions and 5 deletions
  1. 23 5
      direct/src/plugin/p3dCert.cxx
  2. 1 0
      direct/src/plugin/p3dCert.h

+ 23 - 5
direct/src/plugin/p3dCert.cxx

@@ -427,15 +427,30 @@ void AuthDialog::
 layout() {
   get_text(_header, sizeof _header, _text, sizeof _text);
 
+  // Now replicate out any @ signs in the text to avoid FlTk's escape
+  // sequences.
+  int j = 0;
+  for (int i = 0; _text[i] != '\0'; ++i) {
+    _text_clean[j++] = _text[i];
+    if (_text[i] == '@') {
+      _text_clean[j++] = _text[i];
+    }
+  }
+  _text_clean[j] = '\0';
+  assert(strlen(_text_clean) < sizeof(_text_clean));
+
+  int next_y = 35;
   if (strlen(_header) > 0) {
-    Fl_Box *text0 = new Fl_Box(w() / 2, 35, 0, 25, _header);
+    Fl_Box *text0 = new Fl_Box(w() / 2, next_y, 0, 25, _header);
     text0->align(FL_ALIGN_TOP | FL_ALIGN_CENTER);
     text0->labelfont(FL_BOLD);
     text0->labelsize(text0->labelsize() * 1.5);
+    next_y += 25;
   }
 
-  Fl_Box *text1 = new Fl_Box(17, 55, 400, 120, _text);
+  Fl_Box *text1 = new Fl_Box(17, next_y, 400, 180, _text_clean);
   text1->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
+  next_y += 180;
 
   short nbuttons = 1;
   if (_cert != NULL) {
@@ -447,21 +462,24 @@ layout() {
   short bx = (w() - nbuttons * BUTTON_WIDTH - (nbuttons - 1) * BUTTON_SPACE) / 2;
 
   if (_verify_result == 0 && _cert != NULL) {
-    Fl_Return_Button *run_button = new Fl_Return_Button(bx, 200, BUTTON_WIDTH, 25, "Run");
+    Fl_Return_Button *run_button = new Fl_Return_Button(bx, next_y, BUTTON_WIDTH, 25, "Run");
     run_button->callback(this->run_clicked, this);
     bx += BUTTON_WIDTH + BUTTON_SPACE;
   }
 
   if (_cert != NULL) {
-    Fl_Button *view_button = new Fl_Button(bx, 200, BUTTON_WIDTH, 25, "View Certificate");
+    Fl_Button *view_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, "View Certificate");
     view_button->callback(this->view_cert_clicked, this);
     bx += BUTTON_WIDTH + BUTTON_SPACE;
   }
 
   Fl_Button *cancel_button;
-  cancel_button = new Fl_Button(bx, 200, BUTTON_WIDTH, 25, "Cancel");
+  cancel_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, "Cancel");
   cancel_button->callback(this->cancel_clicked, this);
 
+  next_y += 42;
+  size(435, next_y);
+
   end();
   set_modal();
 }

+ 1 - 0
direct/src/plugin/p3dCert.h

@@ -82,6 +82,7 @@ private:
 
   char _header[32];
   char _text[512];
+  char _text_clean[1024];
 
   string _friendly_name;
   int _verify_result;