]> granicus.if.org Git - graphviz/commitdiff
Update with new lefty, fixing many bugs and supporting new features
authorerg <devnull@localhost>
Fri, 8 Apr 2005 20:45:34 +0000 (20:45 +0000)
committererg <devnull@localhost>
Fri, 8 Apr 2005 20:45:34 +0000 (20:45 +0000)
20 files changed:
cmd/lefty/ws/mswin32/gquery.c
cmd/lefty/ws/mswin32/gscroll.c
cmd/lefty/ws/mswin32/gtext.c
cmd/lefty/ws/mswin32/gview.c
cmd/lefty/ws/mswin32/lefty.rc
cmd/lefty/ws/mswin32/resource.h
cmd/lefty/ws/none/garray.c
cmd/lefty/ws/none/gbutton.c
cmd/lefty/ws/none/gcanvas.c
cmd/lefty/ws/none/gcommon.c
cmd/lefty/ws/none/gcommon.h
cmd/lefty/ws/none/glabel.c
cmd/lefty/ws/none/gmenu.c
cmd/lefty/ws/none/gpcanvas.c
cmd/lefty/ws/none/gquery.c
cmd/lefty/ws/none/gscroll.c
cmd/lefty/ws/none/gtext.c
cmd/lefty/ws/none/gview.c
cmd/lefty/ws/x11/garray.c
cmd/lefty/ws/x11/gbutton.c

index 0b7c9fb1ce0247492a38cbcfb56109cfb2d8f9ed..000a1f833e156dcb902a321966db242a2c05b24e 100644 (file)
@@ -14,7 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 
 #define WQU widget->u.q
 
-BOOL CALLBACK stringproc(HWND, UINT, WPARAM, LPARAM);
-BOOL CALLBACK choiceproc(HWND, UINT, WPARAM, LPARAM);
+BOOL CALLBACK stringproc (HWND, UINT, WPARAM, LPARAM);
+BOOL CALLBACK choiceproc (HWND, UINT, WPARAM, LPARAM);
 
-int GQcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GQcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     DWORD wflags;
     int ai;
 
     WQU->mode = G_QWSTRING;
     wflags = WS_OVERLAPPEDWINDOW;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRMODE:
-           if (Strcmp("string", attrp[ai].u.t) == 0)
-               WQU->mode = G_QWSTRING;
-           else if (Strcmp("file", attrp[ai].u.t) == 0)
-               WQU->mode = G_QWFILE;
-           else if (Strcmp("choice", attrp[ai].u.t) == 0)
-               WQU->mode = G_QWCHOICE;
-           else {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRMODE:
+            if (strcmp ("string", attrp[ai].u.t) == 0)
+                WQU->mode = G_QWSTRING;
+            else if (strcmp ("file", attrp[ai].u.t) == 0)
+                WQU->mode = G_QWFILE;
+            else if (strcmp ("choice", attrp[ai].u.t) == 0)
+                WQU->mode = G_QWCHOICE;
+            else {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     switch (WQU->mode) {
     case G_QWSTRING:
-       widget->w = 0;
-       break;
+        widget->w = 0;
+        break;
     case G_QWFILE:
-       widget->w = 0;
-       break;
+        widget->w = 0;
+        break;
     case G_QWCHOICE:
-       widget->w = 0;
-       break;
+        widget->w = 0;
+        break;
     }
     return 0;
 }
 
-int GQsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GQsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     int ai;
 
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRMODE:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "mode");
-           return -1;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRMODE:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "mode");
+            return -1;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GQgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GQgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     int ai;
 
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRMODE:
-           switch (WQU->mode) {
-           case G_QWSTRING:
-               attrp[ai].u.t = "string";
-               break;
-           case G_QWFILE:
-               attrp[ai].u.t = "file";
-               break;
-           case G_QWCHOICE:
-               attrp[ai].u.t = "choice";
-               break;
-           }
-           break;
-       case G_ATTRUSERDATA:
-           attrp[ai].u.u = widget->udata;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRMODE:
+            switch (WQU->mode) {
+            case G_QWSTRING:
+                attrp[ai].u.t = "string";
+                break;
+            case G_QWFILE:
+                attrp[ai].u.t = "file";
+                break;
+            case G_QWCHOICE:
+                attrp[ai].u.t = "choice";
+                break;
+            }
+            break;
+        case G_ATTRUSERDATA:
+            attrp[ai].u.u = widget->udata;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GQdestroywidget(Gwidget_t * widget)
-{
+int GQdestroywidget (Gwidget_t *widget) {
     return 0;
 }
 
@@ -131,9 +128,10 @@ static char *buttons[20];
 static char *stringp;
 static int stringn;
 
-int GQqueryask(Gwidget_t * widget, char *prompt, char *args,
-              char *responsep, int responsen)
-{
+int GQqueryask (
+    Gwidget_t *widget, char *prompt, char *args,
+    char *responsep, int responsen
+) {
     OPENFILENAME ofn;
     char buf[256];
     char *s1, *s2;
@@ -142,121 +140,121 @@ int GQqueryask(Gwidget_t * widget, char *prompt, char *args,
 
     switch (WQU->mode) {
     case G_QWSTRING:
-       stringp = responsep;
-       stringn = responsen;
-       buttons[0] = prompt;
-       buttons[1] = args;
-       DialogBox(hinstance, (LPCSTR) "STRINGDIALOG", (HWND) NULL,
-                 stringproc);
-       Gpopdownflag = TRUE;
-       if (stringp)
-           return 0;
-       return -1;
-       break;
+        stringp = responsep;
+        stringn = responsen;
+        buttons[0] = prompt;
+        buttons[1] = args;
+        DialogBox (hinstance, (LPCSTR) "STRINGDIALOG", (HWND) NULL, stringproc);
+        Gpopdownflag = TRUE;
+        if (stringp)
+            return 0;
+        return -1;
+        break;
     case G_QWFILE:
-       strcpy(buf, args);
-       ofn.lStructSize = sizeof(OPENFILENAME);
-       ofn.hwndOwner = (HWND) NULL;
-       ofn.lpstrFilter = "All Files (*.*)\0*.*\0";
-       ofn.lpstrCustomFilter = NULL;
-       ofn.nMaxCustFilter = 0;
-       ofn.nFilterIndex = 1;
-       ofn.lpstrFile = buf;
-       ofn.nMaxFile = 256;
-       ofn.lpstrFileTitle = NULL;
-       ofn.nMaxFileTitle = 0;
-       ofn.lpstrInitialDir = NULL;
-       ofn.lpstrTitle = prompt;
-       ofn.Flags = 0;
-       ofn.lpstrDefExt = NULL;
-       if (!GetOpenFileName(&ofn)) {
-           Gpopdownflag = TRUE;
-           return -1;
-       }
-       strncpy(responsep, buf, responsen);
-       Gpopdownflag = TRUE;
-       break;
+        strcpy (buf, args);
+        ofn.lStructSize       = sizeof (OPENFILENAME);
+        ofn.hwndOwner         = (HWND) NULL;
+        ofn.lpstrFilter       = "All Files (*.*)\0*.*\0";
+        ofn.lpstrCustomFilter = NULL;
+        ofn.nMaxCustFilter    = 0;
+        ofn.nFilterIndex      = 1;
+        ofn.lpstrFile         = buf;
+        ofn.nMaxFile          = 256;
+        ofn.lpstrFileTitle    = NULL;
+        ofn.nMaxFileTitle     = 0;
+        ofn.lpstrInitialDir   = NULL;
+        ofn.lpstrTitle        = prompt;
+        ofn.Flags             = 0;
+        ofn.lpstrDefExt       = NULL;
+        if (!GetOpenFileName (&ofn)) {
+            Gpopdownflag = TRUE;
+            return -1;
+        }
+        strncpy (responsep, buf, responsen);
+        Gpopdownflag = TRUE;
+        break;
     case G_QWCHOICE:
-       if (!args)
-           return -1;
-       WQU->button = 0;
-       choicew = widget;
-       buttons[0] = prompt;
-       for (s1 = args, i = 1; *s1; i++) {
-           buttons[i] = s1;
-           s2 = s1;
-           while (*s2 && *s2 != '|')
-               s2++;
-           c = *s2, *s2 = 0;
-           s1 = s2;
-           if (c)
-               s1++;
-       }
-       buttons[i] = NULL;
-       DialogBox(hinstance, "CHOICEDIALOG", (HWND) NULL, choiceproc);
-       if (WQU->button > 0)
-           strncpy(responsep, buttons[WQU->button], responsen);
-       for (s2 = args; s2 < s1; s2++)
-           if (!*s2)
-               *s2 = '|';
-       Gpopdownflag = TRUE;
-       if (WQU->button > 0)
-           return 0;
-       return -1;
-       break;
+        if (!args)
+            return -1;
+        WQU->button = 0;
+        choicew = widget;
+        buttons[0] = prompt;
+        for (s1 = args, i = 1; *s1; i++) {
+            buttons[i] = s1;
+            s2 = s1;
+            while (*s2 && *s2 != '|')
+                s2++;
+            c = *s2, *s2 = 0;
+            s1 = s2;
+            if (c)
+                s1++;
+        }
+        buttons[i] = NULL;
+        DialogBox (hinstance, "CHOICEDIALOG", (HWND) NULL, choiceproc);
+        if (WQU->button > 0)
+            strncpy (responsep, buttons[WQU->button], responsen);
+        for (s2 = args; s2 < s1; s2++)
+            if (!*s2)
+                *s2 = '|';
+        Gpopdownflag = TRUE;
+        if (WQU->button > 0)
+            return 0;
+        return -1;
+        break;
     }
     if (responsep[0] && responsep[strlen(responsep) - 1] == '\n')
-       responsep[strlen(responsep) - 1] = 0;
+        responsep[strlen(responsep) - 1] = 0;
     return 0;
 }
 
-BOOL CALLBACK stringproc(HWND hdlg, UINT message,
-                        WPARAM wparam, LPARAM lparam)
-{
+BOOL CALLBACK stringproc (
+    HWND hdlg, UINT message, WPARAM wparam, LPARAM lparam
+{
     switch (message) {
     case WM_INITDIALOG:
-       SetDlgItemText(hdlg, IDC_STATIC1, (LPCSTR) buttons[0]);
-       if (buttons[1])
-           SetDlgItemText(hdlg, IDC_EDIT1, (LPCSTR) buttons[1]);
-       return TRUE;
-       break;
+        SetDlgItemText (hdlg, IDC_STATIC1, (LPCSTR) buttons[0]);
+        if (buttons[1])
+            SetDlgItemText (hdlg, IDC_EDIT1, (LPCSTR) buttons[1]);
+        return TRUE;
+        break;
     case WM_COMMAND:
-       switch (wparam) {
-       case IDOK:
-           GetDlgItemText(hdlg, IDC_EDIT1, stringp, stringn);
-           EndDialog(hdlg, TRUE);
-           return TRUE;
-       case IDCANCEL:
-           stringp = NULL;
-           EndDialog(hdlg, TRUE);
-           return TRUE;
-           break;
-       }
+        switch (wparam) {
+        case IDOK:
+            GetDlgItemText (hdlg, IDC_EDIT1, stringp, stringn);
+            EndDialog (hdlg, TRUE);
+            return TRUE;
+        case IDCANCEL:
+            stringp = NULL;
+            EndDialog(hdlg, TRUE);
+            return TRUE;
+            break;
+        }
     }
     return FALSE;
 }
 
-BOOL CALLBACK choiceproc(HWND hdlg, UINT message,
-                        WPARAM wparam, LPARAM lparam)
-{
+BOOL CALLBACK choiceproc (HWND hdlg, UINT message,
+        WPARAM wparam, LPARAM lparam) {
     int sel, i;
 
     switch (message) {
     case WM_INITDIALOG:
-       SetDlgItemText(hdlg, IDC_STATIC1, (LPCSTR) buttons[0]);
-       for (i = 1; buttons[i]; i++)
-           SendDlgItemMessage(hdlg, IDC_LIST1, LB_ADDSTRING,
-                              0, (LPARAM) buttons[i]);
-       return TRUE;
-       break;
+        SetDlgItemText (hdlg, IDC_STATIC1, (LPCSTR) buttons[0]);
+        for (i = 1; buttons[i]; i++)
+            SendDlgItemMessage (
+                hdlg, IDC_LIST1, LB_ADDSTRING, 0, (LPARAM) buttons[i]
+            );
+        return TRUE;
+        break;
     case WM_COMMAND:
-       if ((sel = (int) SendDlgItemMessage(hdlg, IDC_LIST1,
-                                           LB_GETCURSEL, 0, 0)) >= 0) {
-           choicew->u.q->button = sel + 1;
-           EndDialog(hdlg, TRUE);
-       }
-       return TRUE;
-       break;
+        if ((sel = (int) SendDlgItemMessage (
+            hdlg, IDC_LIST1, LB_GETCURSEL, 0,  0
+        )) >= 0) {
+            choicew->u.q->button = sel + 1;
+            EndDialog (hdlg, TRUE);
+        }
+        return TRUE;
+        break;
     }
     return FALSE;
 }
index 1f197e831a4ba7b6ab0f3ebef6013b09db0f5d9b..60af5992d7621a5a55390b48c7c055a1c51e88f1 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 #include "mem.h"
 
-int GScreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GScreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     PIXsize_t ps;
     DWORD wflags;
     int ai;
 
     if (!parent) {
-       Gerr(POS, G_ERRNOPARENTWIDGET);
-       return -1;
+        Gerr (POS, G_ERRNOPARENTWIDGET);
+        return -1;
     }
     wflags = WS_CHILDWINDOW | WS_HSCROLL | WS_VSCROLL;
     ps.x = ps.y = MINSWSIZE;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINSWSIZE);
-           break;
-       case G_ATTRBORDERWIDTH:
-           wflags |= WS_BORDER;
-           break;
-       case G_ATTRCHILDCENTER:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "childcenter");
-           return -1;
-       case G_ATTRMODE:
-           if (Strcmp("forcebars", attrp[ai].u.t) != 0) {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
-           return -1;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINSWSIZE);
+            break;
+        case G_ATTRBORDERWIDTH:
+            wflags |= WS_BORDER;
+            break;
+        case G_ATTRCHILDCENTER:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "childcenter");
+            return -1;
+        case G_ATTRMODE:
+            if (strcmp ("forcebars", attrp[ai].u.t) != 0) {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
+            return -1;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
-    Gadjustwrect(parent, &ps);
-    if (!(widget->w = CreateWindow("ScrollClass", "scroll", wflags, 0, 0,
-                                  ps.x, ps.y, parent->w,
-                                  (HMENU) (widget - &Gwidgets[0]),
-                                  hinstance, NULL))) {
-       Gerr(POS, G_ERRCANNOTCREATEWIDGET);
-       return -1;
+    Gadjustwrect (parent, &ps);
+    if (!(widget->w = CreateWindow (
+        "ScrollClass", "scroll", wflags, 0, 0,
+        ps.x, ps.y, parent->w, (HMENU) (widget - &Gwidgets[0]),
+        hinstance, NULL
+    ))) {
+        Gerr (POS, G_ERRCANNOTCREATEWIDGET);
+        return -1;
     }
-    ShowWindow(widget->w, SW_SHOW);
-    UpdateWindow(widget->w);
+    ShowWindow (widget->w, SW_SHOW);
+    UpdateWindow (widget->w);
     if (parent && parent->type == G_ARRAYWIDGET)
-       Gawinsertchild(parent, widget);
+        Gawinsertchild (parent, widget);
     return 0;
 }
 
-int GSsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GSsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     Gwidget_t *parent, *child;
     PIXpoint_t po;
     PIXsize_t ps, pps, cps;
@@ -90,121 +90,117 @@ int GSsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
     wflags1 = SWP_NOMOVE | SWP_NOZORDER;
     wflags2 = SWP_NOSIZE | SWP_NOZORDER;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINSWSIZE);
-           Gadjustwrect(parent, &ps);
-           SetWindowPos(widget->w, (HWND) NULL, 0, 0, ps.x, ps.y,
-                        wflags1);
-           break;
-       case G_ATTRBORDERWIDTH:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "borderwidth");
-           return -1;
-       case G_ATTRCHILDCENTER:
-           for (wi = 0; wi < Gwidgetn; wi++) {
-               child = &Gwidgets[wi];
-               if (child->inuse && child->pwi == widget - &Gwidgets[0])
-                   break;
-           }
-           if (wi == Gwidgetn)
-               return 0;
-           GETORIGIN(attrp[ai].u.p, po);
-           GetClientRect(widget->w, &r);
-           pps.x = r.right - r.left, pps.y = r.bottom - r.top;
-           po.x -= pps.x / 2, po.y -= pps.y / 2;
-           GetWindowRect(child->w, &r);
-           cps.x = r.right - r.left, cps.y = r.bottom - r.top;
-           if (po.x < 0)
-               po.x = 0;
-           if (po.y < 0)
-               po.y = 0;
-           if (po.x > cps.x - pps.x)
-               po.x = cps.x - pps.x;
-           if (po.y > cps.y - pps.y)
-               po.y = cps.y - pps.y;
-           SetWindowPos(child->w, (HWND) NULL, -po.x, -po.y, 0, 0,
-                        wflags2);
-           SetScrollPos(widget->w, SB_HORZ, po.x, TRUE);
-           SetScrollPos(widget->w, SB_VERT, po.y, TRUE);
-           break;
-       case G_ATTRMODE:
-           if (Strcmp("forcebars", attrp[ai].u.t) != 0) {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "windowid");
-           return -1;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINSWSIZE);
+            Gadjustwrect (parent, &ps);
+            SetWindowPos (widget->w, (HWND) NULL, 0, 0, ps.x, ps.y, wflags1);
+            break;
+        case G_ATTRBORDERWIDTH:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "borderwidth");
+            return -1;
+        case G_ATTRCHILDCENTER:
+            for (wi = 0; wi < Gwidgetn; wi++) {
+                child = &Gwidgets[wi];
+                if (child->inuse && child->pwi == widget - &Gwidgets[0])
+                    break;
+            }
+            if (wi == Gwidgetn)
+                return 0;
+            GETORIGIN (attrp[ai].u.p, po);
+            GetClientRect (widget->w, &r);
+            pps.x = r.right - r.left, pps.y = r.bottom - r.top;
+            po.x -= pps.x / 2, po.y -= pps.y / 2;
+            GetWindowRect (child->w, &r);
+            cps.x = r.right - r.left, cps.y = r.bottom - r.top;
+            if (po.x < 0)
+                po.x = 0;
+            if (po.y < 0)
+                po.y = 0;
+            if (po.x > cps.x - pps.x)
+                po.x = cps.x - pps.x;
+            if (po.y > cps.y - pps.y)
+                po.y = cps.y - pps.y;
+            SetWindowPos (child->w, (HWND) NULL, -po.x, -po.y, 0, 0, wflags2);
+            SetScrollPos (widget->w, SB_HORZ, po.x, TRUE);
+            SetScrollPos (widget->w, SB_VERT, po.y, TRUE);
+            break;
+        case G_ATTRMODE:
+            if (strcmp ("forcebars", attrp[ai].u.t) != 0) {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "windowid");
+            return -1;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GSgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GSgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     Gwidget_t *child;
     RECT r;
     int width, height, ai, wi;
 
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GetWindowRect(widget->w, &r);
-           attrp[ai].u.s.x = r.right - r.left;
-           attrp[ai].u.s.y = r.bottom - r.top;
-           break;
-       case G_ATTRBORDERWIDTH:
-           Gerr(POS, G_ERRCANNOTGETATTR, "borderwidth");
-           return -1;
-       case G_ATTRCHILDCENTER:
-           for (wi = 0; wi < Gwidgetn; wi++) {
-               child = &Gwidgets[wi];
-               if (child->inuse && child->pwi == widget - &Gwidgets[0])
-                   break;
-           }
-           if (wi == Gwidgetn) {
-               Gerr(POS, G_ERRNOCHILDWIDGET);
-               return -1;
-           }
-           GetWindowRect(widget->w, &r);
-           width = r.right - r.left;
-           height = r.bottom - r.top;
-           GetWindowRect(widget->w, &r);
-           attrp[ai].u.p.x = width / 2 - r.left;
-           attrp[ai].u.p.y = height / 2 - r.top;
-           break;
-       case G_ATTRMODE:
-           attrp[ai].u.t = "forcebars";
-           break;
-       case G_ATTRWINDOWID:
-           sprintf(&Gbufp[0], "0x%lx", widget->w);
-           attrp[ai].u.t = &Gbufp[0];
-           break;
-       case G_ATTRUSERDATA:
-           attrp[ai].u.u = widget->udata;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GetWindowRect (widget->w, &r);
+            attrp[ai].u.s.x = r.right - r.left;
+            attrp[ai].u.s.y = r.bottom - r.top;
+            break;
+        case G_ATTRBORDERWIDTH:
+            Gerr (POS, G_ERRCANNOTGETATTR, "borderwidth");
+            return -1;
+        case G_ATTRCHILDCENTER:
+            for (wi = 0; wi < Gwidgetn; wi++) {
+                child = &Gwidgets[wi];
+                if (child->inuse && child->pwi == widget - &Gwidgets[0])
+                    break;
+            }
+            if (wi == Gwidgetn) {
+                Gerr (POS, G_ERRNOCHILDWIDGET);
+                return -1;
+            }
+            GetWindowRect (widget->w, &r);
+            width = r.right - r.left;
+            height = r.bottom - r.top;
+            GetWindowRect (widget->w, &r);
+            attrp[ai].u.p.x = width / 2 - r.left;
+            attrp[ai].u.p.y = height / 2 - r.top;
+            break;
+        case G_ATTRMODE:
+            attrp[ai].u.t = "forcebars";
+            break;
+        case G_ATTRWINDOWID:
+            sprintf (&Gbufp[0], "0x%lx", widget->w);
+            attrp[ai].u.t = &Gbufp[0];
+            break;
+        case G_ATTRUSERDATA:
+            attrp[ai].u.u = widget->udata;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GSdestroywidget(Gwidget_t * widget)
-{
+int GSdestroywidget (Gwidget_t *widget) {
     Gwidget_t *parent;
 
     parent = (widget->pwi == -1) ? NULL : &Gwidgets[widget->pwi];
     if (parent && parent->type == G_ARRAYWIDGET)
-       Gawdeletechild(parent, widget);
-    DestroyWindow(widget->w);
+        Gawdeletechild (parent, widget);
+    DestroyWindow (widget->w);
     return 0;
 }
index 13eed9c72ad2bec1b3c0f26f72207a9db00170e2..af41b295115b9d6872ef36d303444d40602cf07b 100644 (file)
@@ -14,7 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 
 #define WTU widget->u.t
 
-int GTcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GTcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     PIXsize_t ps;
     DWORD wflags;
     char *s;
     int ai;
 
     if (!parent) {
-       Gerr(POS, G_ERRNOPARENTWIDGET);
-       return -1;
+        Gerr (POS, G_ERRNOPARENTWIDGET);
+        return -1;
     }
     wflags = WS_CHILDWINDOW;
     WTU->func = NULL;
     ps.x = ps.y = MINTWSIZE;
     s = "";
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINTWSIZE);
-           break;
-       case G_ATTRBORDERWIDTH:
-           wflags |= WS_BORDER;
-           break;
-       case G_ATTRTEXT:
-           s = attrp[ai].u.t;
-           break;
-       case G_ATTRAPPENDTEXT:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "appendtext");
-           return -1;
-       case G_ATTRMODE:
-           if (Strcmp("oneline", attrp[ai].u.t) != 0 &&
-               Strcmp("input", attrp[ai].u.t) != 0 &&
-               Strcmp("output", attrp[ai].u.t) != 0) {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
-           return -1;
-       case G_ATTRNEWLINECB:
-           WTU->func = attrp[ai].u.func;
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINTWSIZE);
+            break;
+        case G_ATTRBORDERWIDTH:
+            wflags |= WS_BORDER;
+            break;
+        case G_ATTRTEXT:
+            s = attrp[ai].u.t;
+            break;
+        case G_ATTRAPPENDTEXT:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "appendtext");
+            return -1;
+        case G_ATTRMODE:
+            if (
+                strcmp ("oneline", attrp[ai].u.t) != 0 &&
+                strcmp ("input", attrp[ai].u.t) != 0 &&
+                strcmp ("output", attrp[ai].u.t) != 0
+            ) {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
+            return -1;
+        case G_ATTRNEWLINECB:
+            WTU->func = attrp[ai].u.func;
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
-    Gadjustwrect(parent, &ps);
+    Gadjustwrect (parent, &ps);
     wflags |= (ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL);
     if (ps.y > 40)
-       wflags |= (WS_HSCROLL | WS_VSCROLL);
-    if (!(widget->w = CreateWindow("EDIT", s, wflags, 0, 0, ps.x, ps.y,
-                                  parent->w,
-                                  (HMENU) (widget - &Gwidgets[0]),
-                                  hinstance, NULL))) {
-       Gerr(POS, G_ERRCANNOTCREATEWIDGET);
-       return -1;
+        wflags |= (WS_HSCROLL | WS_VSCROLL);
+    if (!(widget->w = CreateWindow (
+        "EDIT", s, wflags, 0, 0, ps.x, ps.y,
+        parent->w, (HMENU) (widget - &Gwidgets[0]), hinstance, NULL
+    ))) {
+        Gerr (POS, G_ERRCANNOTCREATEWIDGET);
+        return -1;
     }
-    ShowWindow(widget->w, SW_SHOW);
-    UpdateWindow(widget->w);
+    ShowWindow (widget->w, SW_SHOW);
+    UpdateWindow (widget->w);
     if (parent && parent->type == G_ARRAYWIDGET)
-       Gawinsertchild(parent, widget);
+        Gawinsertchild (parent, widget);
     return 0;
 }
 
-int GTsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GTsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     Gwidget_t *parent;
     PIXsize_t ps;
     DWORD wflags1;
@@ -103,117 +104,116 @@ int GTsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
     parent = (widget->pwi == -1) ? NULL : &Gwidgets[widget->pwi];
     wflags1 = SWP_NOMOVE | SWP_NOZORDER;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINTWSIZE);
-           Gadjustwrect(parent, &ps);
-           SetWindowPos(widget->w, (HWND) NULL, 0, 0, ps.x, ps.y,
-                        wflags1);
-           break;
-       case G_ATTRBORDERWIDTH:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "borderwidth");
-           return -1;
-       case G_ATTRTEXT:
-           Gnocallbacks = TRUE;
-           SendMessage(widget->w, WM_SETTEXT, 0, "");
-           SendMessage(widget->w, EM_SETSEL, -1, 32760);
-           SendMessage(widget->w, EM_REPLACESEL, 0,
-                       (LPARAM) attrp[ai].u.t);
-           SendMessage(widget->w, EM_SETSEL, -1, 32760);
-           /* SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) "\r\n"); */
-           /* SendMessage (widget->w, EM_SETSEL, -1, 32760); */
-           Gnocallbacks = FALSE;
-           break;
-       case G_ATTRAPPENDTEXT:
-           Gnocallbacks = TRUE;
-           SendMessage(widget->w, EM_SETSEL, -1, 32760);
-           SendMessage(widget->w, EM_REPLACESEL, 0,
-                       (LPARAM) attrp[ai].u.t);
-           SendMessage(widget->w, EM_SETSEL, -1, 32760);
-           SendMessage(widget->w, EM_REPLACESEL, 0, (LPARAM) "\r\n");
-           SendMessage(widget->w, EM_SETSEL, -1, 32760);
-           Gnocallbacks = FALSE;
-           break;
-       case G_ATTRMODE:
-           if (Strcmp("oneline", attrp[ai].u.t) != 0 &&
-               Strcmp("input", attrp[ai].u.t) != 0 &&
-               Strcmp("output", attrp[ai].u.t) != 0) {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "windowid");
-           return -1;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINTWSIZE);
+            Gadjustwrect (parent, &ps);
+            SetWindowPos (widget->w, (HWND) NULL, 0, 0, ps.x, ps.y, wflags1);
+            break;
+        case G_ATTRBORDERWIDTH:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "borderwidth");
+            return -1;
+        case G_ATTRTEXT:
+            Gnocallbacks = TRUE;
+            SendMessage (widget->w, WM_SETTEXT, 0, "");
+            SendMessage (widget->w, EM_SETSEL, -1, 32760);
+            SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) attrp[ai].u.t);
+            SendMessage (widget->w, EM_SETSEL, -1, 32760);
+#if 0
+            SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) "\r\n");
+            SendMessage (widget->w, EM_SETSEL, -1, 32760);
+#endif
+            Gnocallbacks = FALSE;
+            break;
+        case G_ATTRAPPENDTEXT:
+            Gnocallbacks = TRUE;
+            SendMessage (widget->w, EM_SETSEL, -1, 32760);
+            SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) attrp[ai].u.t);
+            SendMessage (widget->w, EM_SETSEL, -1, 32760);
+            SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) "\r\n");
+            SendMessage (widget->w, EM_SETSEL, -1, 32760);
+            Gnocallbacks = FALSE;
+            break;
+        case G_ATTRMODE:
+            if (
+                strcmp ("oneline", attrp[ai].u.t) != 0 &&
+                strcmp ("input", attrp[ai].u.t) != 0 &&
+                strcmp ("output", attrp[ai].u.t) != 0
+            ) {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "windowid");
+            return -1;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GTgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GTgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     RECT r;
     int rtn, ai, i, j;
 
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GetWindowRect(widget->w, &r);
-           attrp[ai].u.s.x = r.right - r.left;
-           attrp[ai].u.s.y = r.bottom - r.top;
-           break;
-       case G_ATTRBORDERWIDTH:
-           Gerr(POS, G_ERRCANNOTGETATTR, "borderwidth");
-           return -1;
-       case G_ATTRTEXT:
-           if ((rtn = GetWindowTextLength(widget->w)) + 1 > Gbufn) {
-               Gbufp = Marraygrow(Gbufp, (long) (rtn + 1) * BUFSIZE);
-               Gbufn = rtn + 1;
-           }
-           GetWindowText(widget->w, &Gbufp[0], Gbufn - 1);
-           for (i = 0, j = 0; Gbufp[i]; i++)
-               if (Gbufp[i] != '\r')
-                   Gbufp[j++] = Gbufp[i];
-           Gbufp[j++] = 0;
-           attrp[ai].u.t = &Gbufp[0];
-           break;
-       case G_ATTRAPPENDTEXT:
-           Gerr(POS, G_ERRCANNOTGETATTR, "appendtext");
-           return -1;
-       case G_ATTRMODE:
-           attrp[ai].u.t = "oneline";
-           break;
-       case G_ATTRWINDOWID:
-           sprintf(&Gbufp[0], "0x%lx", widget->w);
-           attrp[ai].u.t = &Gbufp[0];
-           break;
-       case G_ATTRNEWLINECB:
-           attrp[ai].u.func = WTU->func;
-           break;
-       case G_ATTRUSERDATA:
-           attrp[ai].u.u = widget->udata;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GetWindowRect (widget->w, &r);
+            attrp[ai].u.s.x = r.right - r.left;
+            attrp[ai].u.s.y = r.bottom - r.top;
+            break;
+        case G_ATTRBORDERWIDTH:
+            Gerr (POS, G_ERRCANNOTGETATTR, "borderwidth");
+            return -1;
+        case G_ATTRTEXT:
+            if ((rtn = GetWindowTextLength (widget->w)) + 1 > Gbufn) {
+                Gbufp = Marraygrow (Gbufp, (long) (rtn + 1) * BUFSIZE);
+                Gbufn = rtn + 1;
+            }
+            GetWindowText (widget->w, &Gbufp[0], Gbufn - 1);
+            for (i = 0, j = 0; Gbufp[i]; i++)
+                if (Gbufp[i] != '\r')
+                    Gbufp[j++] = Gbufp[i];
+            Gbufp[j++] = 0;
+            attrp[ai].u.t = &Gbufp[0];
+            break;
+        case G_ATTRAPPENDTEXT:
+            Gerr (POS, G_ERRCANNOTGETATTR, "appendtext");
+            return -1;
+        case G_ATTRMODE:
+            attrp[ai].u.t = "oneline";
+            break;
+        case G_ATTRWINDOWID:
+            sprintf (&Gbufp[0], "0x%lx", widget->w);
+            attrp[ai].u.t = &Gbufp[0];
+            break;
+        case G_ATTRNEWLINECB:
+            attrp[ai].u.func = WTU->func;
+            break;
+        case G_ATTRUSERDATA:
+            attrp[ai].u.u = widget->udata;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GTdestroywidget(Gwidget_t * widget)
-{
+int GTdestroywidget (Gwidget_t *widget) {
     Gwidget_t *parent;
 
     parent = (widget->pwi == -1) ? NULL : &Gwidgets[widget->pwi];
     if (parent && parent->type == G_ARRAYWIDGET)
-       Gawdeletechild(parent, widget);
-    DestroyWindow(widget->w);
+        Gawdeletechild (parent, widget);
+    DestroyWindow (widget->w);
     return 0;
 }
index 70508050c1c4a6a5eacee5fa808440d8b48466ac..20ddebc30a8015f4a509fe7a194618e0e10d6fed 100644 (file)
@@ -14,7 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
@@ -23,9 +23,9 @@
 
 #define WVU widget->u.v
 
-int GVcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GVcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     PIXpoint_t po;
     PIXsize_t ps;
     DWORD wflags;
@@ -39,46 +39,46 @@ int GVcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
     po.x = po.y = CW_USEDEFAULT;
     ps.x = ps.y = MINVWSIZE;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRORIGIN:
-           GETORIGIN(attrp[ai].u.p, po);
-           break;
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINVWSIZE);
-           break;
-       case G_ATTRNAME:
-           s = attrp[ai].u.t;
-           break;
-       case G_ATTRZORDER:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "zorder");
-           return -1;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
-           return -1;
-       case G_ATTREVENTCB:
-           WVU->func = attrp[ai].u.func;
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRORIGIN:
+            GETORIGIN (attrp[ai].u.p, po);
+            break;
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINVWSIZE);
+            break;
+        case G_ATTRNAME:
+            s = attrp[ai].u.t;
+            break;
+        case G_ATTRZORDER:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "zorder");
+            return -1;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
+            return -1;
+        case G_ATTREVENTCB:
+            WVU->func = attrp[ai].u.func;
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
-    if (!(widget->w = CreateWindow("LeftyClass", s, wflags, po.x, po.y,
-                                  ps.x, ps.y, (HWND) 0, (HMENU) 0,
-                                  hinstance, NULL))) {
-       Gerr(POS, G_ERRCANNOTCREATEWIDGET);
-       return -1;
+    if (!(widget->w = CreateWindow (
+        "LeftyClass", s, wflags, po.x, po.y,
+        ps.x, ps.y, (HWND) 0, (HMENU) 0, hinstance, NULL
+    ))) {
+        Gerr (POS, G_ERRCANNOTCREATEWIDGET);
+        return -1;
     }
-    ShowWindow(widget->w, SW_SHOW);
-    UpdateWindow(widget->w);
+    ShowWindow (widget->w, SW_SHOW);
+    UpdateWindow (widget->w);
     return 0;
 }
 
-int GVsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GVsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     PIXpoint_t po;
     PIXsize_t ps;
     DWORD wflags1, wflags2, wflags3, wflags4;
@@ -89,92 +89,88 @@ int GVsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
     wflags3 = SWP_NOSIZE | SWP_NOMOVE;
     wflags4 = SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRORIGIN:
-           GETORIGIN(attrp[ai].u.p, po);
-           SetWindowPos(widget->w, (HWND) NULL, po.x, po.y, 0, 0,
-                        wflags2);
-           break;
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINVWSIZE);
-           SetWindowPos(widget->w, (HWND) NULL, 0, 0, ps.x, ps.y,
-                        wflags1);
-           break;
-       case G_ATTRNAME:
-           SetWindowText(widget->w, attrp[ai].u.t);
-           return -1;
-       case G_ATTRZORDER:
-           if (Strcmp(attrp[ai].u.t, "top") == 0)
-               SetWindowPos(widget->w, (HWND) HWND_TOP, 0, 0, 0, 0,
-                            wflags3);
-           else if (Strcmp(attrp[ai].u.t, "bottom") == 0)
-               SetWindowPos(widget->w, (HWND) HWND_BOTTOM,
-                            0, 0, 0, 0, wflags4);
-           else {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
-           return -1;
-       case G_ATTREVENTCB:
-           WVU->func = attrp[ai].u.func;
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRORIGIN:
+            GETORIGIN (attrp[ai].u.p, po);
+            SetWindowPos (widget->w, (HWND) NULL, po.x, po.y, 0, 0, wflags2);
+            break;
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINVWSIZE);
+            SetWindowPos (widget->w, (HWND) NULL, 0, 0, ps.x, ps.y, wflags1);
+            break;
+        case G_ATTRNAME:
+            SetWindowText (widget->w, attrp[ai].u.t);
+            return -1;
+        case G_ATTRZORDER:
+            if (strcmp (attrp[ai].u.t, "top") == 0)
+                SetWindowPos (widget->w, (HWND) HWND_TOP, 0, 0, 0, 0, wflags3);
+            else if (strcmp (attrp[ai].u.t, "bottom") == 0)
+                SetWindowPos (
+                    widget->w, (HWND) HWND_BOTTOM, 0, 0, 0, 0, wflags4
+                );
+            else {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
+            return -1;
+        case G_ATTREVENTCB:
+            WVU->func = attrp[ai].u.func;
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GVgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GVgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     RECT r;
     int ai;
 
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRORIGIN:
-           GetWindowRect(widget->w, &r);
-           attrp[ai].u.p.x = r.left, attrp[ai].u.p.y = r.top;
-           break;
-       case G_ATTRSIZE:
-           GetWindowRect(widget->w, &r);
-           attrp[ai].u.s.x = r.right - r.left;
-           attrp[ai].u.s.y = r.bottom - r.top;
-           break;
-       case G_ATTRNAME:
-           Gerr(POS, G_ERRNOTIMPLEMENTED);
-           return -1;
-       case G_ATTRZORDER:
-           Gerr(POS, G_ERRNOTIMPLEMENTED);
-           return -1;
-       case G_ATTRWINDOWID:
-           sprintf(&Gbufp[0], "0x%lx", widget->w);
-           attrp[ai].u.t = &Gbufp[0];
-           break;
-       case G_ATTREVENTCB:
-           attrp[ai].u.func = WVU->func;
-           break;
-       case G_ATTRUSERDATA:
-           attrp[ai].u.u = widget->udata;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRORIGIN:
+            GetWindowRect (widget->w, &r);
+            attrp[ai].u.p.x = r.left, attrp[ai].u.p.y = r.top;
+            break;
+        case G_ATTRSIZE:
+            GetWindowRect (widget->w, &r);
+            attrp[ai].u.s.x = r.right - r.left;
+            attrp[ai].u.s.y = r.bottom - r.top;
+            break;
+        case G_ATTRNAME:
+            Gerr (POS, G_ERRNOTIMPLEMENTED);
+            return -1;
+        case G_ATTRZORDER:
+            Gerr (POS, G_ERRNOTIMPLEMENTED);
+            return -1;
+        case G_ATTRWINDOWID:
+            sprintf (&Gbufp[0], "0x%lx", widget->w);
+            attrp[ai].u.t = &Gbufp[0];
+            break;
+        case G_ATTREVENTCB:
+            attrp[ai].u.func = WVU->func;
+            break;
+        case G_ATTRUSERDATA:
+            attrp[ai].u.u = widget->udata;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GVdestroywidget(Gwidget_t * widget)
-{
+int GVdestroywidget (Gwidget_t *widget) {
     WVU->closing = TRUE;
-    DestroyWindow(widget->w);
+    DestroyWindow (widget->w);
     return 0;
 }
index 7de1ae667316dc508913eac8892ed4eb05050921..5060e11d90c03629b83d0bbc1f9fe3560152ba94 100644 (file)
@@ -33,7 +33,7 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Dialog"
 FONT 8, "MS Sans Serif"
 BEGIN
-    LISTBOX         IDC_LIST1,40,21,105,71,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | 
+    LISTBOX         IDC_LIST1,40,21,105,71,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
                     WS_TABSTOP
     CTEXT           "Static",IDC_STATIC1,8,3,171,12
 END
@@ -56,12 +56,12 @@ END
 // TEXTINCLUDE
 //
 
-1 TEXTINCLUDE DISCARDABLE 
+1 TEXTINCLUDE DISCARDABLE
 BEGIN
     "resource.h\0"
 END
 
-2 TEXTINCLUDE DISCARDABLE 
+2 TEXTINCLUDE DISCARDABLE
 BEGIN
     "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
     "#include ""windows.h""\r\n"
@@ -69,7 +69,7 @@ BEGIN
     "\0"
 END
 
-3 TEXTINCLUDE DISCARDABLE 
+3 TEXTINCLUDE DISCARDABLE
 BEGIN
     "\r\n"
     "\0"
index 3c995540ade6d5316b719dc344960d217ad1f7c1..78dab091d287132ba1d21b8d853cfe26006f2c1f 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
 #define IDC_STATIC                      -1
 
 // Next default values for new objects
-// 
+//
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        104
index 847938ebba142d50ee4f0a91916ed481a05f20a8..404aa680ad43f52e459f8567896198a6407978af 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 #include "mem.h"
 
-int GAcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GAcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GAsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GAsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GAgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GAgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GAdestroywidget(Gwidget_t * widget)
-{
+int GAdestroywidget (Gwidget_t *widget) {
     return 0;
 }
 
-int Gaworder(Gwidget_t * widget, void *data, Gawordercb func)
-{
+int Gaworder (Gwidget_t *widget, void *data, Gawordercb func) {
     return 0;
 }
 
-int Gawsetmode(Gwidget_t * widget, int mode)
-{
+int Gawsetmode (Gwidget_t *widget, int mode) {
     return 0;
 }
 
-int Gawgetmode(Gwidget_t * widget)
-{
+int Gawgetmode (Gwidget_t *widget) {
     return 0;
 }
 
-void Gawdefcoordscb(int wi, Gawdata_t * dp)
-{
+void Gawdefcoordscb (int wi, Gawdata_t *dp) {
 }
index 494000193561facdf8c508653aee3903f696ffae..ba76af27120f580745d40084ccf6edcbfac33cdc 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 
-int GBcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GBcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
     return 0;
 }
 
-int GBsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GBsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GBgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GBgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GBdestroywidget(Gwidget_t * widget)
-{
+int GBdestroywidget (Gwidget_t *widget) {
     return 0;
 }
index 5b756548de71588493ffc4cb320da4a797a43e79..4f99d11e53a1f3ff9bba92ffc93797443b12fd25 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 #include "mem.h"
 
-int GCcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GCcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GCsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GCsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GCgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GCgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GCdestroywidget(Gwidget_t * widget)
-{
+int GCdestroywidget (Gwidget_t *widget) {
     return 0;
 }
 
-int GCcanvasclear(Gwidget_t * widget)
-{
+int GCcanvasclear (Gwidget_t *widget) {
     return 0;
 }
 
-int GCsetgfxattr(Gwidget_t * widget, Ggattr_t * ap)
-{
+int GCsetgfxattr (Gwidget_t *widget, Ggattr_t *ap) {
     return 0;
 }
 
-int GCgetgfxattr(Gwidget_t * widget, Ggattr_t * ap)
-{
+int GCgetgfxattr (Gwidget_t *widget, Ggattr_t *ap) {
     return 0;
 }
 
-int GCarrow(Gwidget_t * widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t * ap)
-{
+int GCarrow (Gwidget_t *widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t *ap) {
     return 0;
 }
 
-int GCline(Gwidget_t * widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t * ap)
-{
+int GCline (Gwidget_t *widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t *ap) {
     return 0;
 }
 
-int GCbox(Gwidget_t * widget, Grect_t gr, Ggattr_t * ap)
-{
+int GCbox (Gwidget_t *widget, Grect_t gr, Ggattr_t *ap) {
     return 0;
 }
 
-int GCpolygon(Gwidget_t * widget, int gpn, Gpoint_t * gpp, Ggattr_t * ap)
-{
+int GCpolygon (Gwidget_t *widget, int gpn, Gpoint_t *gpp, Ggattr_t *ap) {
     return 0;
 }
 
-int GCsplinegon(Gwidget_t * widget, int gpn, Gpoint_t * gpp, Ggattr_t * ap)
-{
+int GCsplinegon (Gwidget_t *widget, int gpn, Gpoint_t *gpp, Ggattr_t *ap) {
     return 0;
 }
 
-int GCarc(Gwidget_t * widget, Gpoint_t gc, Gsize_t gs, double ang1,
-         double ang2, Ggattr_t * ap)
-{
+int GCarc (
+    Gwidget_t *widget, Gpoint_t gc, Gsize_t gs, double ang1,
+    double ang2, Ggattr_t *ap
+) {
     return 0;
 }
 
-int GCtext(Gwidget_t * widget, Gtextline_t * tlp, int n, Gpoint_t go,
-          char *fn, double fs, char *justs, Ggattr_t * ap)
-{
+int GCtext (
+    Gwidget_t *widget, Gtextline_t *tlp, int n, Gpoint_t go,
+    char *fn, double fs, char *justs, Ggattr_t *ap
+) {
     return 0;
 }
 
-int GCgettextsize(Gwidget_t * widget, Gtextline_t * tlp, int n, char *fn,
-                 double fs, Gsize_t * gsp)
-{
+int GCgettextsize (
+    Gwidget_t *widget, Gtextline_t *tlp, int n, char *fn,
+    double fs, Gsize_t *gsp
+) {
     return -1;
 }
 
-int GCcreatebitmap(Gwidget_t * widget, Gbitmap_t * bitmap, Gsize_t s)
-{
+int GCcreatebitmap (Gwidget_t *widget, Gbitmap_t *bitmap, Gsize_t s) {
     return 0;
 }
 
-int GCdestroybitmap(Gbitmap_t * bitmap)
-{
+int GCdestroybitmap (Gbitmap_t *bitmap) {
     return 0;
 }
 
 #define COMPDIFF(a, b) (((a) > (b)) ? (a) - (b) : (b) - (a))
-#define CDIFF(a, b) (COMPDIFF (a.red, b[0]) + COMPDIFF (a.green, b[1]) + \
-        COMPDIFF (a.blue, b[2]))
+#define CDIFF(a, b) ( \
+    COMPDIFF (a.red, b[0]) + COMPDIFF (a.green, b[1]) + \
+    COMPDIFF (a.blue, b[2]) \
+)
 #define CMINMAXDIFF 20000
 
-int GCreadbitmap(Gwidget_t * widget, Gbitmap_t * bitmap, FILE * fp)
-{
+int GCreadbitmap (Gwidget_t *widget, Gbitmap_t *bitmap, FILE *fp) {
     return 0;
 }
 
-int GCwritebitmap(Gbitmap_t * bitmap, FILE * fp)
-{
+int GCwritebitmap (Gbitmap_t *bitmap, FILE *fp) {
     return 0;
 }
 
-int GCbitblt(Gwidget_t * widget, Gpoint_t gp, Grect_t gr,
-            Gbitmap_t * bitmap, char *mode, Ggattr_t * ap)
-{
+int GCbitblt (
+    Gwidget_t *widget, Gpoint_t gp, Grect_t gr, Gbitmap_t *bitmap,
+    char *mode, Ggattr_t *ap
+) {
     return 0;
 }
 
-int GCgetmousecoords(Gwidget_t * widget, Gpoint_t * gpp, int *count)
-{
+int GCgetmousecoords (Gwidget_t *widget, Gpoint_t *gpp, int *count) {
     return 0;
 }
index d0b6d31f9fb66d0305961e046fc696536de44ebb..40f05f1c7b045f19625d95939cddabf703272c53 100644 (file)
@@ -14,7 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
@@ -28,27 +28,22 @@ int Gpopdownflag;
 int Gscreenn;
 int Gdepth;
 
-int Ginitgraphics(void)
-{
+int Ginitgraphics (void) {
     return 0;
 }
 
-int Gtermgraphics(void)
-{
+int Gtermgraphics (void) {
     return 0;
 }
 
-int Gsync(void)
-{
+int Gsync (void) {
     return 0;
 }
 
-int Gresetbstate(int wi)
-{
+int Gresetbstate (int wi) {
     return 0;
 }
 
-int Gprocessevents(int waitflag, Geventmode_t mode)
-{
+int Gprocessevents (int waitflag, int mode) {
     return 0;
 }
index 584ad22a7ae675d038ccff6bc515389887698bca..2b33bb2ea0a44429bb88bb848c0a2117a848cd7b 100644 (file)
 extern "C" {
 #endif
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #ifndef _GCOMMON_H
 #define _GCOMMON_H
 
-    typedef struct {
-       int x, y;
-    } XPoint;
-    typedef int Widget;
-    typedef int Display;
-
-    extern Widget Groot;
-    extern Display *Gdisplay;
-    extern int Gpopdownflag;
-    extern int Gscreenn;
-    extern int Gdepth;
-
-    int Ginitgraphics(void);
-    int Gtermgraphics(void);
-    int Gsync(void);
-
-    int GAcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GAsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GAgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GAdestroywidget(Gwidget_t *);
-
-    int GBcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GBsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GBgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GBdestroywidget(Gwidget_t *);
-
-    int GCcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GCsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GCgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GCdestroywidget(Gwidget_t *);
-    int GCcanvasclear(Gwidget_t *);
-    int GCsetgfxattr(Gwidget_t *, Ggattr_t *);
-    int GCgetgfxattr(Gwidget_t *, Ggattr_t *);
-    int GCarrow(Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
-    int GCline(Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
-    int GCbox(Gwidget_t *, Grect_t, Ggattr_t *);
-    int GCpolygon(Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
-    int GCsplinegon(Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
-    int GCarc(Gwidget_t *, Gpoint_t, Gsize_t, double, double, Ggattr_t *);
-    int GCtext(Gwidget_t *, Gtextline_t *, int, Gpoint_t,
-              char *, double, char *, Ggattr_t *);
-    int GCgettextsize(Gwidget_t *, Gtextline_t *, int, char *, double,
-                     Gsize_t *);
-    int GCcreatebitmap(Gwidget_t *, Gbitmap_t *, Gsize_t);
-    int GCdestroybitmap(Gbitmap_t *);
-    int GCreadbitmap(Gwidget_t *, Gbitmap_t *, FILE *);
-    int GCwritebitmap(Gbitmap_t *, FILE *);
-    int GCbitblt(Gwidget_t *, Gpoint_t, Grect_t, Gbitmap_t *, char *,
-                Ggattr_t *);
-    int GCgetmousecoords(Gwidget_t *, Gpoint_t *, int *);
-
-    int GLcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GLsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GLgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GLdestroywidget(Gwidget_t *);
-
-    int GMcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GMsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GMgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GMdestroywidget(Gwidget_t *);
-    int GMmenuaddentries(Gwidget_t *, int, char **);
-    int GMmenudisplay(Gwidget_t *, Gwidget_t *);
-
-    int GPcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GPsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GPgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GPdestroywidget(Gwidget_t *);
-    int GPcanvasclear(Gwidget_t *);
-    int GPsetgfxattr(Gwidget_t *, Ggattr_t *);
-    int GPgetgfxattr(Gwidget_t *, Ggattr_t *);
-    int GParrow(Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
-    int GPline(Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
-    int GPbox(Gwidget_t *, Grect_t, Ggattr_t *);
-    int GPpolygon(Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
-    int GPsplinegon(Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
-    int GParc(Gwidget_t *, Gpoint_t, Gsize_t, double, double, Ggattr_t *);
-    int GPtext(Gwidget_t *, Gtextline_t *, int, Gpoint_t,
-              char *, double, char *, Ggattr_t *);
-    int GPcreatebitmap(Gwidget_t *, Gbitmap_t *, Gsize_t);
-    int GPdestroybitmap(Gbitmap_t *);
-    int GPreadbitmap(Gwidget_t *, Gbitmap_t *, FILE *);
-    int GPwritebitmap(Gbitmap_t *, FILE *);
-    int GPbitblt(Gwidget_t *, Gpoint_t, Grect_t, Gbitmap_t *, char *,
-                Ggattr_t *);
-
-    int GQcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GQsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GQgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GQdestroywidget(Gwidget_t *);
-    int GQqueryask(Gwidget_t *, char *, char *, char *, int);
-
-    int GScreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GSsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GSgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GSdestroywidget(Gwidget_t *);
-
-    int GTcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GTsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GTgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GTdestroywidget(Gwidget_t *);
-
-    int GVcreatewidget(Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
-    int GVsetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GVgetwidgetattr(Gwidget_t *, int, Gwattr_t *);
-    int GVdestroywidget(Gwidget_t *);
-
-    void Gawdefcoordscb(int, Gawdata_t *);
-
-#endif                         /* _GCOMMON_H */
+typedef struct {
+    int x, y;
+} XPoint;
+typedef int Widget;
+typedef int Display;
+
+extern Widget Groot;
+extern Display *Gdisplay;
+extern int Gpopdownflag;
+extern int Gscreenn;
+extern int Gdepth;
+
+int Ginitgraphics (void);
+int Gtermgraphics (void);
+int Gsync (void);
+
+int GAcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GAsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GAgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GAdestroywidget (Gwidget_t *);
+
+int GBcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GBsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GBgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GBdestroywidget (Gwidget_t *);
+
+int GCcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GCsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GCgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GCdestroywidget (Gwidget_t *);
+int GCcanvasclear (Gwidget_t *);
+int GCsetgfxattr (Gwidget_t *, Ggattr_t *);
+int GCgetgfxattr (Gwidget_t *, Ggattr_t *);
+int GCarrow (Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
+int GCline (Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
+int GCbox (Gwidget_t *, Grect_t, Ggattr_t *);
+int GCpolygon (Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
+int GCsplinegon (Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
+int GCarc (Gwidget_t *, Gpoint_t, Gsize_t, double, double, Ggattr_t *);
+int GCtext (
+    Gwidget_t *, Gtextline_t *, int, Gpoint_t,
+    char *, double, char *, Ggattr_t *
+);
+int GCgettextsize (Gwidget_t *, Gtextline_t *, int, char *, double, Gsize_t *);
+int GCcreatebitmap (Gwidget_t *, Gbitmap_t *, Gsize_t);
+int GCdestroybitmap (Gbitmap_t *);
+int GCreadbitmap (Gwidget_t *, Gbitmap_t *, FILE *);
+int GCwritebitmap (Gbitmap_t *, FILE *);
+int GCbitblt (Gwidget_t *, Gpoint_t, Grect_t, Gbitmap_t *, char *, Ggattr_t *);
+int GCgetmousecoords (Gwidget_t *, Gpoint_t *, int *);
+
+int GLcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GLsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GLgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GLdestroywidget (Gwidget_t *);
+
+int GMcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GMsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GMgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GMdestroywidget (Gwidget_t *);
+int GMmenuaddentries (Gwidget_t *, int, char **);
+int GMmenudisplay (Gwidget_t *, Gwidget_t *);
+
+int GPcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GPsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GPgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GPdestroywidget (Gwidget_t *);
+int GPcanvasclear (Gwidget_t *);
+int GPsetgfxattr (Gwidget_t *, Ggattr_t *);
+int GPgetgfxattr (Gwidget_t *, Ggattr_t *);
+int GParrow (Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
+int GPline (Gwidget_t *, Gpoint_t, Gpoint_t, Ggattr_t *);
+int GPbox (Gwidget_t *, Grect_t, Ggattr_t *);
+int GPpolygon (Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
+int GPsplinegon (Gwidget_t *, int, Gpoint_t *, Ggattr_t *);
+int GParc (Gwidget_t *, Gpoint_t, Gsize_t, double, double, Ggattr_t *);
+int GPtext (
+    Gwidget_t *, Gtextline_t *, int, Gpoint_t,
+    char *, double, char *, Ggattr_t *
+);
+int GPcreatebitmap (Gwidget_t *, Gbitmap_t *, Gsize_t);
+int GPdestroybitmap (Gbitmap_t *);
+int GPreadbitmap (Gwidget_t *, Gbitmap_t *, FILE *);
+int GPwritebitmap (Gbitmap_t *, FILE *);
+int GPbitblt (Gwidget_t *, Gpoint_t, Grect_t, Gbitmap_t *, char *, Ggattr_t *);
+
+int GQcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GQsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GQgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GQdestroywidget (Gwidget_t *);
+int GQqueryask (Gwidget_t *, char *, char *, char *, int);
+
+int GScreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GSsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GSgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GSdestroywidget (Gwidget_t *);
+
+int GTcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GTsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GTgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GTdestroywidget (Gwidget_t *);
+
+int GVcreatewidget (Gwidget_t *, Gwidget_t *, int, Gwattr_t *);
+int GVsetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GVgetwidgetattr (Gwidget_t *, int, Gwattr_t *);
+int GVdestroywidget (Gwidget_t *);
+
+void Gawdefcoordscb (int, Gawdata_t *);
+
+#endif /* _GCOMMON_H */
 
 #ifdef __cplusplus
 }
 #endif
+
index c683240bdeff9613485f57318a51392341ee5913..92af3e1a95b5940b082392737ee1773c7ca82692 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 
-int GLcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GLcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GLsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GLsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GLgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GLgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GLdestroywidget(Gwidget_t * widget)
-{
+int GLdestroywidget (Gwidget_t *widget) {
     return 0;
 }
index fdc51577fbdff8b3f1445d0764886fdfc7a52245..2d9f854661e55d81004c2f3266d4d52417a39084 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 
-int GMcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GMcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GMsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GMsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GMgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GMgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GMdestroywidget(Gwidget_t * widget)
-{
+int GMdestroywidget (Gwidget_t *widget) {
     return 0;
 }
 
-int GMmenuaddentries(Gwidget_t * widget, int en, char **ep)
-{
+int GMmenuaddentries (Gwidget_t *widget, int en, char **ep) {
     return 0;
 }
 
-int GMmenudisplay(Gwidget_t * parent, Gwidget_t * widget)
-{
+int GMmenudisplay (Gwidget_t *parent, Gwidget_t *widget) {
     return -1;
 }
index 52ea5807c3cfbbf4d9982672d5dd3f4f3baff0a1..73a85047fae711e9cd19279150e76c3752d97104 100644 (file)
@@ -14,7 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 
 char *Gpscanvasname = "out.ps";
 
-int GPcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GPcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GPsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GPsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GPgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GPgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GPdestroywidget(Gwidget_t * widget)
-{
+int GPdestroywidget (Gwidget_t *widget) {
     return 0;
 }
 
-int GPcanvasclear(Gwidget_t * widget)
-{
+int GPcanvasclear (Gwidget_t *widget) {
     return 0;
 }
 
-int GPsetgfxattr(Gwidget_t * widget, Ggattr_t * ap)
-{
+int GPsetgfxattr (Gwidget_t *widget, Ggattr_t *ap) {
     return 0;
 }
 
-int GPgetgfxattr(Gwidget_t * widget, Ggattr_t * ap)
-{
+int GPgetgfxattr (Gwidget_t *widget, Ggattr_t *ap) {
     return 0;
 }
 
-int GParrow(Gwidget_t * widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t * ap)
-{
+int GParrow (Gwidget_t *widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t *ap) {
     return 0;
 }
 
-int GPline(Gwidget_t * widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t * ap)
-{
+int GPline (Gwidget_t *widget, Gpoint_t gp1, Gpoint_t gp2, Ggattr_t *ap) {
     return 0;
 }
 
-int GPbox(Gwidget_t * widget, Grect_t gr, Ggattr_t * ap)
-{
+int GPbox (Gwidget_t *widget, Grect_t gr, Ggattr_t *ap) {
     return 0;
 }
 
-int GPpolygon(Gwidget_t * widget, int gpn, Gpoint_t * gpp, Ggattr_t * ap)
-{
+int GPpolygon (Gwidget_t *widget, int gpn, Gpoint_t *gpp, Ggattr_t *ap) {
     return 0;
 }
 
-int GPsplinegon(Gwidget_t * widget, int gpn, Gpoint_t * gpp, Ggattr_t * ap)
-{
+int GPsplinegon (Gwidget_t *widget, int gpn, Gpoint_t *gpp, Ggattr_t *ap) {
     return 0;
 }
 
-int GParc(Gwidget_t * widget, Gpoint_t gc, Gsize_t gs,
-         double ang1, double ang2, Ggattr_t * ap)
-{
+int GParc (
+    Gwidget_t *widget, Gpoint_t gc, Gsize_t gs,
+    double ang1, double ang2, Ggattr_t *ap
+) {
     return 0;
 }
 
-int GPtext(Gwidget_t * widget, Gtextline_t * tlp, int n, Gpoint_t go,
-          char *fn, double fs, char *justs, Ggattr_t * ap)
-{
+int GPtext (
+    Gwidget_t *widget, Gtextline_t *tlp, int n, Gpoint_t go, char *fn,
+    double fs, char *justs, Ggattr_t *ap
+) {
     return 0;
 }
 
-static char *findfont(char *name)
-{
+static char *findfont (char *name) {
     return NULL;
 }
 
-int GPcreatebitmap(Gwidget_t * widget, Gbitmap_t * bitmap, Gsize_t s)
-{
+int GPcreatebitmap (Gwidget_t *widget, Gbitmap_t *bitmap, Gsize_t s) {
     return 0;
 }
 
-int GPdestroybitmap(Gbitmap_t * bitmap)
-{
+int GPdestroybitmap (Gbitmap_t *bitmap) {
     return 0;
 }
 
-int GPreadbitmap(Gwidget_t * widget, Gbitmap_t * bitmap, FILE * fp)
-{
+int GPreadbitmap (Gwidget_t *widget, Gbitmap_t *bitmap, FILE *fp) {
     return 0;
 }
 
-int GPwritebitmap(Gbitmap_t * bitmap, FILE * fp)
-{
+int GPwritebitmap (Gbitmap_t *bitmap, FILE *fp) {
     return -1;
 }
 
-int GPbitblt(Gwidget_t * widget, Gpoint_t gp, Grect_t gr,
-            Gbitmap_t * bitmap, char *mode, Ggattr_t * ap)
-{
+int GPbitblt (
+    Gwidget_t *widget, Gpoint_t gp, Grect_t gr, Gbitmap_t *bitmap,
+    char *mode, Ggattr_t *ap
+) {
     return 0;
 }
index 2da52292adcb27bdcdfc64320b08cf9d3d67250d..1f92bd896e40be24371a9e29d6a113f7b1f00863 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 
-int GQcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GQcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GQsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GQsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GQgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GQgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GQdestroywidget(Gwidget_t * widget)
-{
+int GQdestroywidget (Gwidget_t *widget) {
     return 0;
 }
 
-int GQqueryask(Gwidget_t * widget, char *prompt, char *args,
-              char *responsep, int responsen)
-{
+int GQqueryask (
+    Gwidget_t *widget, char *prompt, char *args,
+    char *responsep, int responsen
+) {
     return 0;
 }
index c49cbb23350c9b0bce572ece9f733bd25f7fce1f..9304bc3b6b45dc7090f101871b14833455652747 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 
-int GScreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GScreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GSsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GSsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GSgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GSgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GSdestroywidget(Gwidget_t * widget)
-{
+int GSdestroywidget (Gwidget_t *widget) {
     return 0;
 }
index b8aa4beda0df773561ba6472279bd596f9d1c9ac..675da526c02006a01ae799880e55a5550146621a 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 #include "mem.h"
 
-int GTcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GTcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GTsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GTsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GTgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GTgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GTdestroywidget(Gwidget_t * widget)
-{
+int GTdestroywidget (Gwidget_t *widget) {
     return 0;
 }
index 3335875b041bd684f43b4590a0b0393b4b0a9a0e..c3bb4229083ee0eab16e558d0fb1be8ae1bbe6d5 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
 
-int GVcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GVcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     return -1;
 }
 
-int GVsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GVsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GVgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GVgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     return 0;
 }
 
-int GVdestroywidget(Gwidget_t * widget)
-{
+int GVdestroywidget (Gwidget_t *widget) {
     return 0;
 }
index 4291c30e8656d118247b3fd30e11177c1161fd38..62dc90ecf0d69cd8eca122b4a54c8858ca28e258 100644 (file)
@@ -14,7 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 
 extern WidgetClass arrayWidgetClass;
 
-static void awcallback(Widget, XtPointer, XtPointer);
+static void awcallback (Widget, XtPointer, XtPointer);
 
-int GAcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GAcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget, int attrn, Gwattr_t *attrp
+{
     PIXsize_t ps;
     int ai;
     XColor c;
     int color;
 
     if (!parent) {
-       Gerr(POS, G_ERRNOPARENTWIDGET);
-       return -1;
+        Gerr (POS, G_ERRNOPARENTWIDGET);
+        return -1;
     }
     WAU->func = NULL;
     ps.x = ps.y = MINAWSIZE;
     RESETARGS;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINAWSIZE);
-           break;
-       case G_ATTRBORDERWIDTH:
-           ADD2ARGS(XtNborderWidth, attrp[ai].u.i);
-           break;
-       case G_ATTRMODE:
-           if (Strcmp("horizontal", attrp[ai].u.t) == 0) {
-               ADD2ARGS(XtNorientation, XtorientHorizontal);
-               WAU->mode = G_AWHARRAY;
-           } else if (Strcmp("vertical", attrp[ai].u.t) == 0) {
-               WAU->mode = G_AWVARRAY;
-           } else {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINAWSIZE);
+            break;
+        case G_ATTRBORDERWIDTH:
+            ADD2ARGS (XtNborderWidth, attrp[ai].u.i);
+            break;
+        case G_ATTRMODE:
+            if (strcmp ("horizontal", attrp[ai].u.t) == 0) {
+                ADD2ARGS (XtNorientation, XtorientHorizontal);
+                WAU->mode = G_AWHARRAY;
+            } else if (strcmp ("vertical", attrp[ai].u.t) == 0) {
+                WAU->mode = G_AWVARRAY;
+            } else {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRLAYOUT:
+            if (strcmp ("on", attrp[ai].u.t) == 0)
+                Gawsetmode (widget, FALSE);
+            else if (strcmp ("off", attrp[ai].u.t) == 0)
+                Gawsetmode (widget, TRUE);
+            else {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRCOLOR:
+            color = attrp[ai].u.c.index;
+            if (color != 0 && color != 1) {
+                Gerr (POS, G_ERRBADCOLORINDEX, color);
+                return -1;
+            }
+            c.red = attrp[ai].u.c.r * 257;
+            c.green = attrp[ai].u.c.g * 257;
+            c.blue = attrp[ai].u.c.b * 257;
+            if (XAllocColor (
+                Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c
+            )) {
+                if (color == 0)
+                    ADD2ARGS (XtNbackground, c.pixel);
+                else
+                    ADD2ARGS (XtNforeground, c.pixel);
            }
-           break;
-       case G_ATTRLAYOUT:
-           if (Strcmp("on", attrp[ai].u.t) == 0)
-               Gawsetmode(widget, FALSE);
-           else if (Strcmp("off", attrp[ai].u.t) == 0)
-               Gawsetmode(widget, TRUE);
-           else {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRCOLOR:
-           color = attrp[ai].u.c.index;
-           if (color != 0 && color != 1) {
-               Gerr(POS, G_ERRBADCOLORINDEX, color);
-               return -1;
-           }
-           c.red = attrp[ai].u.c.r * 257;
-           c.green = attrp[ai].u.c.g * 257;
-           c.blue = attrp[ai].u.c.b * 257;
-           if (XAllocColor
-               (Gdisplay, DefaultColormap(Gdisplay, Gscreenn), &c)) {
-               if (color == 0)
-                   ADD2ARGS(XtNbackground, c.pixel);
-               else
-                   ADD2ARGS(XtNforeground, c.pixel);
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
-           return -1;
-       case G_ATTRRESIZECB:
-           WAU->func = (Gawcoordscb) attrp[ai].u.func;
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
+            return -1;
+        case G_ATTRRESIZECB:
+            WAU->func = (Gawcoordscb) attrp[ai].u.func;
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
-    ADD2ARGS(XtNwidth, ps.x);
-    ADD2ARGS(XtNheight, ps.y);
-    if (!(widget->w = XtCreateWidget("array", arrayWidgetClass,
-                                    parent->w, argp, argn))) {
-       Gerr(POS, G_ERRCANNOTCREATEWIDGET);
-       return -1;
+    ADD2ARGS (XtNwidth, ps.x);
+    ADD2ARGS (XtNheight, ps.y);
+    if (!(widget->w = XtCreateWidget (
+        "array", arrayWidgetClass, parent->w, argp, argn
+    ))) {
+        Gerr (POS, G_ERRCANNOTCREATEWIDGET);
+        return -1;
     }
-    XtAddCallback(widget->w, XtNcallback, awcallback, (XtPointer) NULL);
-    Glazymanage(widget->w);
+    XtAddCallback (widget->w, XtNcallback, awcallback, (XtPointer) NULL);
+    Glazymanage (widget->w);
     return 0;
 }
 
-int GAsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GAsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     PIXsize_t ps;
     int ai;
 
     RESETARGS;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINAWSIZE);
-           ADD2ARGS(XtNwidth, ps.x);
-           ADD2ARGS(XtNheight, ps.y);
-           break;
-       case G_ATTRBORDERWIDTH:
-           ADD2ARGS(XtNborderWidth, attrp[ai].u.i);
-           break;
-       case G_ATTRMODE:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "mode");
-           return -1;
-       case G_ATTRLAYOUT:
-           if (Strcmp("on", attrp[ai].u.t) == 0)
-               Gawsetmode(widget, FALSE);
-           else if (Strcmp("off", attrp[ai].u.t) == 0)
-               Gawsetmode(widget, TRUE);
-           else {
-               Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
-               return -1;
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "windowid");
-           return -1;
-       case G_ATTRRESIZECB:
-           WAU->func = (Gawcoordscb) attrp[ai].u.func;
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINAWSIZE);
+            ADD2ARGS (XtNwidth, ps.x);
+            ADD2ARGS (XtNheight, ps.y);
+            break;
+        case G_ATTRBORDERWIDTH:
+            ADD2ARGS (XtNborderWidth, attrp[ai].u.i);
+            break;
+        case G_ATTRMODE:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "mode");
+            return -1;
+        case G_ATTRLAYOUT:
+            if (strcmp ("on", attrp[ai].u.t) == 0)
+                Gawsetmode (widget, FALSE);
+            else if (strcmp ("off", attrp[ai].u.t) == 0)
+                Gawsetmode (widget, TRUE);
+            else {
+                Gerr (POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
+                return -1;
+            }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "windowid");
+            return -1;
+        case G_ATTRRESIZECB:
+            WAU->func = (Gawcoordscb) attrp[ai].u.func;
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
-    XtSetValues(widget->w, argp, argn);
+    XtSetValues (widget->w, argp, argn);
     return 0;
 }
 
-int GAgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GAgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     Dimension width, height;
     int ai;
 
     for (ai = 0; ai < attrn; ai++) {
-       RESETARGS;
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           ADD2ARGS(XtNwidth, &width);
-           ADD2ARGS(XtNheight, &height);
-           XtGetValues(widget->w, argp, argn);
-           attrp[ai].u.s.x = width, attrp[ai].u.s.y = height;
-           break;
-       case G_ATTRBORDERWIDTH:
-           ADD2ARGS(XtNborderWidth, &width);
-           XtGetValues(widget->w, argp, argn);
-           attrp[ai].u.i = width;
-           break;
-       case G_ATTRMODE:
-           attrp[ai].u.t = (WAU->mode == G_AWHARRAY) ?
-               "horizontal" : "vertical";
-           break;
-       case G_ATTRLAYOUT:
-           attrp[ai].u.t = (Gawgetmode(widget)) ? "off" : "on";
-           break;
-       case G_ATTRWINDOWID:
-           sprintf(&Gbufp[0], "0x%lx", XtWindow(widget->w));
-           attrp[ai].u.t = &Gbufp[0];
-           break;
-       case G_ATTRRESIZECB:
-           attrp[ai].u.func = (void *) (WAU->func);
-           break;
-       case G_ATTRUSERDATA:
-           attrp[ai].u.u = widget->udata;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        RESETARGS;
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            ADD2ARGS (XtNwidth, &width);
+            ADD2ARGS (XtNheight, &height);
+            XtGetValues (widget->w, argp, argn);
+            attrp[ai].u.s.x = width, attrp[ai].u.s.y = height;
+            break;
+        case G_ATTRBORDERWIDTH:
+            ADD2ARGS (XtNborderWidth, &width);
+            XtGetValues (widget->w, argp, argn);
+            attrp[ai].u.i = width;
+            break;
+        case G_ATTRMODE:
+            attrp[ai].u.t = (
+                WAU->mode == G_AWHARRAY
+            ) ? "horizontal" : "vertical";
+            break;
+        case G_ATTRLAYOUT:
+            attrp[ai].u.t = (Gawgetmode (widget)) ? "off" : "on";
+            break;
+        case G_ATTRWINDOWID:
+            sprintf (&Gbufp[0], "0x%lx", XtWindow (widget->w));
+            attrp[ai].u.t = &Gbufp[0];
+            break;
+        case G_ATTRRESIZECB:
+            attrp[ai].u.func = WAU->func;
+            break;
+        case G_ATTRUSERDATA:
+            attrp[ai].u.u = widget->udata;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GAdestroywidget(Gwidget_t * widget)
-{
-    XtDestroyWidget(widget->w);
+int GAdestroywidget (Gwidget_t *widget) {
+    XtDestroyWidget (widget->w);
     return 0;
 }
 
-static void awcallback(Widget w, XtPointer clientdata, XtPointer calldata)
-{
+static void awcallback (Widget w, XtPointer clientdata, XtPointer calldata) {
     Gwidget_t *widget;
 
-    if (!(widget = findwidget((unsigned long) w, G_ARRAYWIDGET)))
-       return;
+    if (!(widget = findwidget ((unsigned long) w, G_ARRAYWIDGET)))
+        return;
     if (WAU->func)
-       (*WAU->func) (widget - &Gwidgets[0], (Gawdata_t *) calldata);
+        (*WAU->func) (widget - &Gwidgets[0], (Gawdata_t *) calldata);
     else
-       Gawdefcoordscb(widget - &Gwidgets[0], (Gawdata_t *) calldata);
+        Gawdefcoordscb (widget - &Gwidgets[0], (Gawdata_t *) calldata);
 }
 
 /* the rest of this file contains the implementation of the array widget */
@@ -231,7 +230,7 @@ typedef struct _ArrayClassRec *ArrayWidgetClass;
 typedef struct _ArrayRec *ArrayWidget;
 
 typedef struct _ArrayClassPart {
-    int dummy;                 /* not used */
+    int dummy; /* not used */
 } ArrayClassPart;
 
 typedef struct _ArrayClassRec {
@@ -258,305 +257,294 @@ typedef struct _ArrayRec {
 
 static XtResource resources[] = {
     {
-     XtNcallback,
-     XtCCallback,
-     XtRCallback,
-     sizeof(XtPointer),
-     XtOffsetOf(ArrayRec, array.callbacks),
-     XtRCallback, (XtPointer) NULL}
-    ,
+        XtNcallback,
+        XtCCallback,
+        XtRCallback,
+        sizeof (XtPointer),
+        XtOffsetOf (ArrayRec, array.callbacks),
+        XtRCallback, (XtPointer) NULL
+    },
     {
-     XtNorientation,
-     XtCOrientation,
-     XtROrientation,
-     sizeof(XtOrientation),
-     XtOffsetOf(ArrayRec, array.orientation),
-     XtRImmediate, (XtPointer) XtorientVertical}
+        XtNorientation,
+        XtCOrientation,
+        XtROrientation,
+        sizeof (XtOrientation),
+        XtOffsetOf (ArrayRec, array.orientation),
+        XtRImmediate, (XtPointer) XtorientVertical
+    }
 };
 
-static void ClassInitialize(void);
-static void Initialize(Widget, Widget, ArgList, Cardinal *);
-static void Destroy(Widget);
-static void Resize(Widget);
-static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *);
-static XtGeometryResult GeometryManager(Widget,
-                                       XtWidgetGeometry *,
-                                       XtWidgetGeometry *);
-static void ChangeManaged(Widget);
-static void InsertChild(Widget);
-static void DeleteChild(Widget);
-static void dolayout(ArrayWidget, int);
+static void ClassInitialize (void);
+static void Initialize (Widget, Widget, ArgList, Cardinal *);
+static void Destroy (Widget);
+static void Resize (Widget);
+static Boolean SetValues (Widget, Widget, Widget, ArgList, Cardinal *);
+static XtGeometryResult GeometryManager (
+    Widget, XtWidgetGeometry *, XtWidgetGeometry *
+);
+static void ChangeManaged (Widget);
+static void InsertChild (Widget);
+static void DeleteChild (Widget);
+static void dolayout (ArrayWidget, int);
 
 ArrayClassRec arrayClassRec = {
-    {                          /* core_class fields */
-     /* superclass          */ (WidgetClass) & compositeClassRec,
-     /* class_name          */ "Array",
-     /* widget_size         */ sizeof(ArrayRec),
-     /* class_initialize    */ ClassInitialize,
-     /* class_part_init     */ NULL,
-     /* class_inited        */ FALSE,
-     /* initialize          */ Initialize,
-     /* initialize_hook     */ NULL,
-     /* realize             */ XtInheritRealize,
-     /* actions             */ NULL,
-     /* num_actions         */ 0,
-     /* resources           */ resources,
-     /* num_resources       */ XtNumber(resources),
-     /* xrm_class           */ NULLQUARK,
-     /* compress_motion     */ TRUE,
-     /* compress_exposure   */ TRUE,
-     /* compress_enterleave */ TRUE,
-     /* visible_interest    */ FALSE,
-     /* destroy             */ Destroy,
-     /* resize              */ Resize,
-     /* expose              */ XtInheritExpose,
-     /* set_values          */ SetValues,
-     /* set_values_hook     */ NULL,
-     /* set_values_almost   */ XtInheritSetValuesAlmost,
-     /* get_values_hook     */ NULL,
-     /* accept_focus        */ NULL,
-     /* version             */ XtVersion,
-     /* callback_private    */ NULL,
-     /* tm_table            */ NULL,
-     /* query_geometry      */ XtInheritQueryGeometry,
-     /* display_accelerator */ XtInheritDisplayAccelerator,
-     /* extension           */ NULL
-     }
-    ,
-    {                          /* composite_class fields */
-     /* geometry_manager */ GeometryManager,
-     /* change_managed   */ ChangeManaged,
-     /* insert_child     */ InsertChild,
-     /* delete_child     */ DeleteChild,
-     /* extension        */ NULL
-     }
-    ,
-    {                          /* array_class fields */
-     /* dummy */ 0
-     }
+    { /* core_class fields */
+        /* superclass          */ (WidgetClass) &compositeClassRec,
+        /* class_name          */ "Array",
+        /* widget_size         */ sizeof(ArrayRec),
+        /* class_initialize    */ ClassInitialize,
+        /* class_part_init     */ NULL,
+        /* class_inited        */ FALSE,
+        /* initialize          */ Initialize,
+        /* initialize_hook     */ NULL,
+        /* realize             */ XtInheritRealize,
+        /* actions             */ NULL,
+        /* num_actions         */ 0,
+        /* resources           */ resources,
+        /* num_resources       */ XtNumber (resources),
+        /* xrm_class           */ NULLQUARK,
+        /* compress_motion     */ TRUE,
+        /* compress_exposure   */ TRUE,
+        /* compress_enterleave */ TRUE,
+        /* visible_interest    */ FALSE,
+        /* destroy             */ Destroy,
+        /* resize              */ Resize,
+        /* expose              */ XtInheritExpose,
+        /* set_values          */ SetValues,
+        /* set_values_hook     */ NULL,
+        /* set_values_almost   */ XtInheritSetValuesAlmost,
+        /* get_values_hook     */ NULL,
+        /* accept_focus        */ NULL,
+        /* version             */ XtVersion,
+        /* callback_private    */ NULL,
+        /* tm_table            */ NULL,
+        /* query_geometry      */ XtInheritQueryGeometry,
+        /* display_accelerator */ XtInheritDisplayAccelerator,
+        /* extension           */ NULL
+    },
+    { /* composite_class fields */
+        /* geometry_manager */ GeometryManager,
+        /* change_managed   */ ChangeManaged,
+        /* insert_child     */ InsertChild,
+        /* delete_child     */ DeleteChild,
+        /* extension        */ NULL
+    },
+    { /* array_class fields */
+        /* dummy */ 0
+    }
 };
 
-WidgetClass arrayWidgetClass = (WidgetClass) & arrayClassRec;
+WidgetClass arrayWidgetClass = (WidgetClass)&arrayClassRec;
 
-int Gaworder(Gwidget_t * widget, void *data, Gawordercb func)
-{
+int Gaworder (Gwidget_t *widget, void *data, Gawordercb func) {
     ArrayWidget aw;
 
     aw = (ArrayWidget) widget->w;
     (*func) (data, &aw->array.data);
-    dolayout(aw, TRUE);
+    dolayout (aw, TRUE);
     return 0;
 }
 
-int Gawsetmode(Gwidget_t * widget, int mode)
-{
+int Gawsetmode (Gwidget_t *widget, int mode) {
     ArrayWidget aw;
 
     aw = (ArrayWidget) widget->w;
     aw->array.batchmode = mode;
-    dolayout(aw, TRUE);
+    dolayout (aw, TRUE);
     return 0;
 }
 
-int Gawgetmode(Gwidget_t * widget)
-{
+int Gawgetmode (Gwidget_t *widget) {
     ArrayWidget aw;
 
     aw = (ArrayWidget) widget->w;
     return aw->array.batchmode;
 }
 
-void Gawdefcoordscb(int wi, Gawdata_t * dp)
-{
+void Gawdefcoordscb (int wi, Gawdata_t *dp) {
     Gawcarray_t *cp;
     int sx, sy, csx, csy, ci;
 
     sx = dp->sx, sy = dp->sy;
     csx = csy = 0;
     for (ci = 0; ci < dp->cj; ci++) {
-       cp = &dp->carray[ci];
-       if (!cp->flag)
-           continue;
-       cp->ox = csx, cp->oy = csy;
-       if (dp->type == G_AWVARRAY)
-           cp->sx = sx - 2 * cp->bs, csy += cp->sy + 2 * cp->bs;
-       else
-           cp->sy = sy - 2 * cp->bs, csx += cp->sx + 2 * cp->bs;
+        cp = &dp->carray[ci];
+        if (!cp->flag)
+            continue;
+        cp->ox = csx, cp->oy = csy;
+        if (dp->type == G_AWVARRAY)
+            cp->sx = sx - 2 * cp->bs, csy += cp->sy + 2 * cp->bs;
+        else
+            cp->sy = sy - 2 * cp->bs, csx += cp->sx + 2 * cp->bs;
     }
     if (dp->type == G_AWVARRAY)
-       dp->sy = csy;
+        dp->sy = csy;
     else
-       dp->sx = csx;
+        dp->sx = csx;
 }
 
-static void ClassInitialize(void)
-{
-    XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation,
-                  NULL, (Cardinal) 0);
+static void ClassInitialize (void) {
+    XtAddConverter (
+        XtRString, XtROrientation, XmuCvtStringToOrientation, NULL, 0
+    );
 }
 
-static void Initialize(Widget reqw, Widget neww,
-                      ArgList args, Cardinal * num_args)
-{
+static void Initialize (
+    Widget reqw, Widget neww, ArgList args, Cardinal *num_args
+{
     ArrayWidget aw;
 
     aw = (ArrayWidget) neww;
     if (aw->array.orientation == XtorientVertical)
-       aw->array.data.type = G_AWVARRAY;
+        aw->array.data.type = G_AWVARRAY;
     else
-       aw->array.data.type = G_AWHARRAY;
-    aw->array.data.carray = Marrayalloc((long) CHILDINCR * CHILDSIZE);
+        aw->array.data.type = G_AWHARRAY;
+    aw->array.data.carray = Marrayalloc ((long) CHILDINCR * CHILDSIZE);
     aw->array.data.cn = CHILDINCR;
     aw->array.data.cj = 0;
     aw->array.batchmode = FALSE;
     if (aw->core.width == 0)
-       aw->core.width = 100;
+        aw->core.width = 100;
     if (aw->core.height == 0)
-       aw->core.height = 100;
+        aw->core.height = 100;
 }
 
-static void Destroy(Widget w)
-{
+static void Destroy (Widget w) {
     ArrayWidget aw;
 
     aw = (ArrayWidget) w;
-    Marrayfree(aw->array.data.carray);
+    Marrayfree (aw->array.data.carray);
     aw->array.data.cn = aw->array.data.cj = 0;
 }
 
-static void Resize(Widget w)
-{
-    dolayout((ArrayWidget) w, FALSE);
+static void Resize (Widget w) {
+    dolayout ((ArrayWidget) w, FALSE);
 }
 
-static Boolean SetValues(Widget curw, Widget reqw, Widget neww,
-                        ArgList args, Cardinal * num_args)
-{
+static Boolean SetValues (
+    Widget curw, Widget reqw, Widget neww, ArgList args, Cardinal *num_args
+{
     ArrayWidget curaw;
     ArrayWidget newaw;
 
     curaw = (ArrayWidget) curw;
     newaw = (ArrayWidget) neww;
     if (curaw->array.orientation != newaw->array.orientation) {
-       if (newaw->array.orientation == XtorientVertical)
-           newaw->array.data.type = G_AWVARRAY;
-       else
-           newaw->array.data.type = G_AWHARRAY;
-       dolayout(newaw, TRUE);
-       return TRUE;
+        if (newaw->array.orientation == XtorientVertical)
+            newaw->array.data.type = G_AWVARRAY;
+        else
+            newaw->array.data.type = G_AWHARRAY;
+        dolayout (newaw, TRUE);
+        return TRUE;
     }
     return FALSE;
 }
 
-static XtGeometryResult GeometryManager(Widget w,
-                                       XtWidgetGeometry * req,
-                                       XtWidgetGeometry * rep)
-{
+static XtGeometryResult GeometryManager (
+    Widget w, XtWidgetGeometry *req, XtWidgetGeometry *rep
+) {
     Dimension width, height;
 
     if (req->request_mode & ~(CWX | CWY | CWWidth | CWHeight))
-       return XtGeometryNo;
+        return XtGeometryNo;
 
     if (req->request_mode & (CWX | CWY | CWWidth | CWHeight)) {
-       width = (req->request_mode & CWWidth) ? req->width : w->core.width;
-       height =
-           (req->request_mode & CWHeight) ? req->height : w->core.height;
-       w->core.width = width, w->core.height = height;
-       dolayout((ArrayWidget) XtParent(w), TRUE);
-       return XtGeometryYes;
+        width = (req->request_mode & CWWidth) ? req->width : w->core.width;
+        height = (req->request_mode & CWHeight) ? req->height : w->core.height;
+        w->core.width = width, w->core.height = height;
+        dolayout ((ArrayWidget) XtParent (w), TRUE);
+        return XtGeometryYes;
     }
     return XtGeometryYes;
 }
 
-static void ChangeManaged(Widget w)
-{
+static void ChangeManaged (Widget w) {
     ArrayWidget aw;
 
     aw = (ArrayWidget) w;
     if (!aw->array.batchmode)
-       dolayout(aw, TRUE);
+        dolayout (aw, TRUE);
 }
 
-static void InsertChild(Widget w)
-{
+static void InsertChild (Widget w) {
     ArrayWidget aw;
     CompositeWidgetClass sclass;
 
     sclass = (CompositeWidgetClass) compositeWidgetClass;
     (*sclass->composite_class.insert_child) (w);
-    aw = (ArrayWidget) XtParent(w);
+    aw = (ArrayWidget) XtParent (w);
     if (aw->array.data.cj == aw->array.data.cn) {
-       aw->array.data.carray = Marraygrow(aw->array.data.carray,
-                                          (long) (aw->array.data.cn +
-                                                  CHILDINCR) * CHILDSIZE);
-       aw->array.data.cn += CHILDINCR;
+        aw->array.data.carray = Marraygrow (
+            aw->array.data.carray,
+            (long) (aw->array.data.cn + CHILDINCR) * CHILDSIZE
+        );
+        aw->array.data.cn += CHILDINCR;
     }
     aw->array.data.carray[aw->array.data.cj++].w = w;
 }
 
-static void DeleteChild(Widget w)
-{
+static void DeleteChild (Widget w) {
     ArrayWidget aw;
     CompositeWidgetClass sclass;
     int ci;
 
     sclass = (CompositeWidgetClass) compositeWidgetClass;
     (*sclass->composite_class.delete_child) (w);
-    aw = (ArrayWidget) XtParent(w);
+    aw = (ArrayWidget) XtParent (w);
     for (ci = 0; ci < aw->array.data.cj; ci++)
-       if (aw->array.data.carray[ci].w == w)
-           break;
+        if (aw->array.data.carray[ci].w == w)
+            break;
     if (ci < aw->array.data.cj) {
-       for (; ci + 1 < aw->array.data.cj; ci++)
-           aw->array.data.carray[ci].w = aw->array.data.carray[ci + 1].w;
-       aw->array.data.cj--;
+        for (; ci + 1 < aw->array.data.cj; ci++)
+            aw->array.data.carray[ci].w = aw->array.data.carray[ci + 1].w;
+        aw->array.data.cj--;
     }
 }
 
-static void dolayout(ArrayWidget aw, int flag)
-{
+static void dolayout (ArrayWidget aw, int flag) {
     XtWidgetGeometry req, ret_req;
     Gawdata_t *dp;
     Gawcarray_t *cp;
     int sx, sy, ci;
 
     if (aw->array.batchmode)
-       return;
+        return;
     dp = &aw->array.data;
     for (ci = 0; ci < dp->cj; ci++) {
-       if (!XtIsManaged(dp->carray[ci].w)) {
-           dp->carray[ci].flag = 0;
-           continue;
-       }
-       cp = &dp->carray[ci];
-       cp->flag = 1;
-       cp->ox = cp->w->core.x;
-       cp->oy = cp->w->core.y;
-       cp->sx = cp->w->core.width;
-       cp->sy = cp->w->core.height;
-       cp->bs = cp->w->core.border_width;
+        if (!XtIsManaged (dp->carray[ci].w)) {
+            dp->carray[ci].flag = 0;
+            continue;
+        }
+        cp = &dp->carray[ci];
+        cp->flag = 1;
+        cp->ox = cp->w->core.x;
+        cp->oy = cp->w->core.y;
+        cp->sx = cp->w->core.width;
+        cp->sy = cp->w->core.height;
+        cp->bs = cp->w->core.border_width;
     }
     dp->sx = aw->core.width, dp->sy = aw->core.height;
-    XtCallCallbackList((Widget) aw, aw->array.callbacks, dp);
+    XtCallCallbackList ((Widget) aw, aw->array.callbacks, dp);
     if ((sx = dp->sx) < MINAWSIZE)
-       sx = MINAWSIZE;
+        sx = MINAWSIZE;
     if ((sy = dp->sy) < MINAWSIZE)
-       sy = MINAWSIZE;
+        sy = MINAWSIZE;
     if (flag && (aw->core.width != sx || aw->core.height != sy)) {
-       req.width = sx, req.height = sy;
-       req.request_mode = CWWidth | CWHeight;
-       if (XtMakeGeometryRequest((Widget) aw, &req, &ret_req) ==
-           XtGeometryAlmost) {
-           req = ret_req;
-           XtMakeGeometryRequest((Widget) aw, &req, &ret_req);
-           dp->sx = req.width, dp->sy = req.height;
-           XtCallCallbackList((Widget) aw, aw->array.callbacks, dp);
-       }
+        req.width = sx, req.height = sy;
+        req.request_mode = CWWidth | CWHeight;
+        if (XtMakeGeometryRequest (
+            (Widget) aw, &req, &ret_req
+        ) == XtGeometryAlmost) {
+            req = ret_req;
+            XtMakeGeometryRequest ((Widget) aw, &req, &ret_req);
+            dp->sx = req.width, dp->sy = req.height;
+            XtCallCallbackList ((Widget) aw, aw->array.callbacks, dp);
+        }
     }
     for (ci = 0; ci < dp->cj; ci++) {
-       cp = &dp->carray[ci];
-       if (!cp->flag)
-           continue;
-       XtConfigureWidget(cp->w, cp->ox, cp->oy, cp->sx, cp->sy, cp->bs);
+        cp = &dp->carray[ci];
+        if (!cp->flag)
+            continue;
+        XtConfigureWidget (cp->w, cp->ox, cp->oy, cp->sx, cp->sy, cp->bs);
     }
 }
index bf66b6d8b2e322c85b0bb96c62b4c3160d2a214b..2530bb568e8147a0b409e2f54efb9583238d33ae 100644 (file)
@@ -14,7 +14,7 @@
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-/* Lefteris Koutsofios - AT&T Bell Laboratories */
+/* Lefteris Koutsofios - AT&T Labs Research */
 
 #include "common.h"
 #include "g.h"
 
 #define WBU widget->u.b
 
-static void bwcallback(Widget, XtPointer, XtPointer);
+static void bwcallback (Widget, XtPointer, XtPointer);
 
-int GBcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
-                  int attrn, Gwattr_t * attrp)
-{
+int GBcreatewidget (
+    Gwidget_t *parent, Gwidget_t *widget,
+    int attrn, Gwattr_t *attrp
+) {
     PIXsize_t ps;
     char *s;
     int ai;
@@ -34,82 +35,84 @@ int GBcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
     int color;
 
     if (!parent) {
-       Gerr(POS, G_ERRNOPARENTWIDGET);
-       return -1;
+        Gerr (POS, G_ERRNOPARENTWIDGET);
+        return -1;
     }
     WBU->func = NULL;
     ps.x = ps.y = MINBWSIZE;
     s = NULL;
     RESETARGS;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINBWSIZE);
-           break;
-       case G_ATTRBORDERWIDTH:
-           ADD2ARGS(XtNborderWidth, attrp[ai].u.i);
-           break;
-       case G_ATTRTEXT:
-           s = attrp[ai].u.t;
-           ADD2ARGS(XtNlabel, s);
-           break;
-       case G_ATTRCOLOR:
-           color = attrp[ai].u.c.index;
-           if (color != 0 && color != 1) {
-               Gerr(POS, G_ERRBADCOLORINDEX, color);
-               return -1;
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINBWSIZE);
+            break;
+        case G_ATTRBORDERWIDTH:
+            ADD2ARGS (XtNborderWidth, attrp[ai].u.i);
+            break;
+        case G_ATTRTEXT:
+            s = attrp[ai].u.t;
+            ADD2ARGS (XtNlabel, s);
+            break;
+        case G_ATTRCOLOR:
+            color = attrp[ai].u.c.index;
+            if (color != 0 && color != 1) {
+                Gerr (POS, G_ERRBADCOLORINDEX, color);
+                return -1;
+            }
+            c.red = attrp[ai].u.c.r * 257;
+            c.green = attrp[ai].u.c.g * 257;
+            c.blue = attrp[ai].u.c.b * 257;
+            if (XAllocColor (
+                Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c
+            )) {
+                if (color == 0)
+                    ADD2ARGS (XtNbackground, c.pixel);
+                else
+                    ADD2ARGS (XtNforeground, c.pixel);
            }
-           c.red = attrp[ai].u.c.r * 257;
-           c.green = attrp[ai].u.c.g * 257;
-           c.blue = attrp[ai].u.c.b * 257;
-           if (XAllocColor
-               (Gdisplay, DefaultColormap(Gdisplay, Gscreenn), &c)) {
-               if (color == 0)
-                   ADD2ARGS(XtNbackground, c.pixel);
-               else
-                   ADD2ARGS(XtNforeground, c.pixel);
-           }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
-           return -1;
-       case G_ATTRBUTTONCB:
-           WBU->func = (Gbuttoncb) attrp[ai].u.func;
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR1, "windowid");
+            return -1;
+        case G_ATTRBUTTONCB:
+            WBU->func = (Gbuttoncb) attrp[ai].u.func;
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     if (!s || s[0] == '\000') {
-       ADD2ARGS(XtNwidth, ps.x);
-       ADD2ARGS(XtNheight, ps.y);
+        ADD2ARGS (XtNwidth, ps.x);
+        ADD2ARGS (XtNheight, ps.y);
     } else {
-       if (ps.x > MINBWSIZE)
-           ADD2ARGS(XtNwidth, ps.x);
-       if (ps.y > MINBWSIZE)
-           ADD2ARGS(XtNheight, ps.y);
+        if (ps.x > MINBWSIZE)
+            ADD2ARGS (XtNwidth, ps.x);
+        if (ps.y > MINBWSIZE)
+            ADD2ARGS (XtNheight, ps.y);
     }
-    ADD2ARGS(XtNhighlightThickness, 0);
-    ADD2ARGS(XtNinternalHeight, 0);
-    ADD2ARGS(XtNinternalWidth, 0);
-    ADD2ARGS(XtNjustify, XtJustifyLeft);
-    if (!(widget->w = XtCreateWidget("command", commandWidgetClass,
-                                    parent->w, argp, argn))) {
-       Gerr(POS, G_ERRCANNOTCREATEWIDGET);
-       return -1;
+    ADD2ARGS (XtNhighlightThickness, 0);
+    ADD2ARGS (XtNinternalHeight, 0);
+    ADD2ARGS (XtNinternalWidth, 0);
+    ADD2ARGS (XtNjustify, XtJustifyLeft);
+    if (!(widget->w = XtCreateWidget (
+        "command", commandWidgetClass, parent->w, argp, argn
+    ))) {
+        Gerr (POS, G_ERRCANNOTCREATEWIDGET);
+        return -1;
     }
-    XtAddCallback(widget->w, XtNcallback, bwcallback,
-                 (XtPointer) widget->udata);
-    Glazymanage(widget->w);
+    XtAddCallback (
+        widget->w, XtNcallback, bwcallback, (XtPointer) widget->udata
+    );
+    Glazymanage (widget->w);
     return 0;
 }
 
-int GBsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GBsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     PIXsize_t ps;
     int ai;
     XColor c;
@@ -117,107 +120,105 @@ int GBsetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
 
     RESETARGS;
     for (ai = 0; ai < attrn; ai++) {
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           GETSIZE(attrp[ai].u.s, ps, MINBWSIZE);
-           ADD2ARGS(XtNwidth, ps.x);
-           ADD2ARGS(XtNheight, ps.y);
-           break;
-       case G_ATTRBORDERWIDTH:
-           ADD2ARGS(XtNborderWidth, attrp[ai].u.i);
-           break;
-       case G_ATTRTEXT:
-           ADD2ARGS(XtNlabel, attrp[ai].u.t);
-           break;
-       case G_ATTRCOLOR:
-           color = attrp[ai].u.c.index;
-           if (color != 0 && color != 1) {
-               Gerr(POS, G_ERRBADCOLORINDEX, color);
-               return -1;
-           }
-           c.red = attrp[ai].u.c.r * 257;
-           c.green = attrp[ai].u.c.g * 257;
-           c.blue = attrp[ai].u.c.b * 257;
-           if (XAllocColor
-               (Gdisplay, DefaultColormap(Gdisplay, Gscreenn), &c)) {
-               if (color == 0)
-                   ADD2ARGS(XtNbackground, c.pixel);
-               else
-                   ADD2ARGS(XtNforeground, c.pixel);
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            GETSIZE (attrp[ai].u.s, ps, MINBWSIZE);
+            ADD2ARGS (XtNwidth, ps.x);
+            ADD2ARGS (XtNheight, ps.y);
+            break;
+        case G_ATTRBORDERWIDTH:
+            ADD2ARGS (XtNborderWidth, attrp[ai].u.i);
+            break;
+        case G_ATTRTEXT:
+            ADD2ARGS (XtNlabel, attrp[ai].u.t);
+            break;
+        case G_ATTRCOLOR:
+            color = attrp[ai].u.c.index;
+            if (color != 0 && color != 1) {
+                Gerr (POS, G_ERRBADCOLORINDEX, color);
+                return -1;
+            }
+            c.red = attrp[ai].u.c.r * 257;
+            c.green = attrp[ai].u.c.g * 257;
+            c.blue = attrp[ai].u.c.b * 257;
+            if (XAllocColor (
+                Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c
+            )) {
+                if (color == 0)
+                    ADD2ARGS (XtNbackground, c.pixel);
+                else
+                    ADD2ARGS (XtNforeground, c.pixel);
            }
-           break;
-       case G_ATTRWINDOWID:
-           Gerr(POS, G_ERRCANNOTSETATTR2, "windowid");
-           return -1;
-       case G_ATTRBUTTONCB:
-           WBU->func = (Gbuttoncb) attrp[ai].u.func;
-           break;
-       case G_ATTRUSERDATA:
-           widget->udata = attrp[ai].u.u;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+            break;
+        case G_ATTRWINDOWID:
+            Gerr (POS, G_ERRCANNOTSETATTR2, "windowid");
+            return -1;
+        case G_ATTRBUTTONCB:
+            WBU->func = (Gbuttoncb) attrp[ai].u.func;
+            break;
+        case G_ATTRUSERDATA:
+            widget->udata = attrp[ai].u.u;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
-    XtSetValues(widget->w, argp, argn);
+    XtSetValues (widget->w, argp, argn);
     return 0;
 }
 
-int GBgetwidgetattr(Gwidget_t * widget, int attrn, Gwattr_t * attrp)
-{
+int GBgetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) {
     Dimension width, height;
     char *s;
     int ai;
 
     for (ai = 0; ai < attrn; ai++) {
-       RESETARGS;
-       switch (attrp[ai].id) {
-       case G_ATTRSIZE:
-           ADD2ARGS(XtNwidth, &width);
-           ADD2ARGS(XtNheight, &height);
-           XtGetValues(widget->w, argp, argn);
-           attrp[ai].u.s.x = width, attrp[ai].u.s.y = height;
-           break;
-       case G_ATTRBORDERWIDTH:
-           ADD2ARGS(XtNborderWidth, &width);
-           XtGetValues(widget->w, argp, argn);
-           attrp[ai].u.i = width;
-           break;
-       case G_ATTRTEXT:
-           ADD2ARGS(XtNlabel, &s);
-           XtGetValues(widget->w, argp, argn);
-           attrp[ai].u.t = s;
-           break;
-       case G_ATTRWINDOWID:
-           sprintf(&Gbufp[0], "0x%lx", XtWindow(widget->w));
-           attrp[ai].u.t = &Gbufp[0];
-           break;
-       case G_ATTRBUTTONCB:
-           attrp[ai].u.func = (void *) (WBU->func);
-           break;
-       case G_ATTRUSERDATA:
-           attrp[ai].u.u = widget->udata;
-           break;
-       default:
-           Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
-           return -1;
-       }
+        RESETARGS;
+        switch (attrp[ai].id) {
+        case G_ATTRSIZE:
+            ADD2ARGS (XtNwidth, &width);
+            ADD2ARGS (XtNheight, &height);
+            XtGetValues (widget->w, argp, argn);
+            attrp[ai].u.s.x = width, attrp[ai].u.s.y = height;
+            break;
+        case G_ATTRBORDERWIDTH:
+            ADD2ARGS (XtNborderWidth, &width);
+            XtGetValues (widget->w, argp, argn);
+            attrp[ai].u.i = width;
+            break;
+        case G_ATTRTEXT:
+            ADD2ARGS (XtNlabel, &s);
+            XtGetValues (widget->w, argp, argn);
+            attrp[ai].u.t = s;
+            break;
+        case G_ATTRWINDOWID:
+            sprintf (&Gbufp[0], "0x%lx", XtWindow (widget->w));
+            attrp[ai].u.t = &Gbufp[0];
+            break;
+        case G_ATTRBUTTONCB:
+            attrp[ai].u.func = WBU->func;
+            break;
+        case G_ATTRUSERDATA:
+            attrp[ai].u.u = widget->udata;
+            break;
+        default:
+            Gerr (POS, G_ERRBADATTRID, attrp[ai].id);
+            return -1;
+        }
     }
     return 0;
 }
 
-int GBdestroywidget(Gwidget_t * widget)
-{
-    XtDestroyWidget(widget->w);
+int GBdestroywidget (Gwidget_t *widget) {
+    XtDestroyWidget (widget->w);
     return 0;
 }
 
-static void bwcallback(Widget w, XtPointer clientdata, XtPointer calldata)
-{
+static void bwcallback (Widget w, XtPointer clientdata, XtPointer calldata) {
     Gwidget_t *widget;
 
-    widget = findwidget((unsigned long) w, G_BUTTONWIDGET);
+    widget = findwidget ((unsigned long) w, G_BUTTONWIDGET);
     if (WBU->func)
-       (*WBU->func) (widget - &Gwidgets[0], clientdata);
+        (*WBU->func) (widget - &Gwidgets[0], clientdata);
 }