dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtstyle / ColorMain.c
index 40d04c47a53ab49416b77cb6f35f946aeccbcc9f..3f2957967f17ea6a862df4119d1d0c775dbae45f 100644 (file)
@@ -16,7 +16,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  * Floor, Boston, MA 02110-1301 USA
  */
 /*+++++++++++++++++++++++++++++++++++++++*/
 /* include files                         */
 /*+++++++++++++++++++++++++++++++++++++++*/
-#ifdef __apollo
-#include  "/sys5/usr/include/limits.h"
-#else  /* common default */
 #include <limits.h>
-#endif /* __apollo */
 
 #include <locale.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <X11/Intrinsic.h>
 #include <X11/Xlib.h>
 #include <Xm/MwmUtil.h>
@@ -218,6 +215,12 @@ static void _DtmapCB_colorUse(
                         Widget w,
                         XtPointer client_data,
                         XtPointer call_data) ;
+static void colorEditorCB(
+                        Widget w,
+                        XtPointer client_data,
+                        XtPointer call_data) ;
+
+static void allocNewColors(void);
 static Boolean ValidName( char *name) ;
 void loadDatabase();
 
@@ -551,8 +554,9 @@ CreatePaletteButtons(
        XtSetArg (args[n], XmNrecomputeSize, False); n++; 
        XtSetArg (args[n], XmNwidth,  COLOR_BUTTON_WIDTH); n++; 
        XtSetArg (args[n], XmNheight, COLOR_BUTTON_HEIGHT); n++; 
-       /* allow traversal only if dynamicColor is on */
-       if (!style.dynamicColor)
+       /* allow traversal only if editing is possible */
+       if (style.dynamicColor || style.visualClass==TrueColor
+                       || style.visualClass==DirectColor)
        {
            XtSetArg (args[n], XmNtraversalOn, False); n++; 
        }
@@ -589,10 +593,11 @@ CreatePaletteButtons(
        string = CMPSTR("     ");
        XtSetArg (args[n], XmNlabelString, string); n++;
        colorButton[i] = XmCreatePushButton(paletteRc, "colorButton", args, n);
-       /* allow access to modify functionality only if dynamicColor is on */
-       if (style.dynamicColor)
+       /* allow access to modify functionality if available */
+       if (style.dynamicColor || style.visualClass==TrueColor
+                       || style.visualClass==DirectColor)
            XtAddCallback(colorButton[i], XmNactivateCallback, selectColorCB, 
-                         (XtPointer)i);  
+                         (XtPointer) (intptr_t) i);  
        XmStringFree(string);
     }
     XtManageChildren(colorButton,pCurrentPalette->num_of_colors);
@@ -600,14 +605,18 @@ CreatePaletteButtons(
     if(!save.restoreFlag)
        selected_button = 0;
 
-    /* draw selection border only if dynamicColor is on */
-    if (style.dynamicColor)
+    /* draw selection border if editing is possible */
+    if (style.dynamicColor || style.visualClass==TrueColor
+               || style.visualClass==DirectColor)
     {
         n=0;
         XtSetArg (args[n], XmNborderColor, BlackPixelOfScreen(style.screen)); n++;
         XtSetValues(colorButton[selected_button],args,n);
     }
-    
+
+       if(style.visualClass==TrueColor || style.visualClass==DirectColor)
+               allocNewColors();
+
     style.count++;
 }
 
@@ -742,6 +751,77 @@ InitializePaletteList(
   style.count++;
   return(True);
 }
+
+/*
+ * Allocate new pixel values and update color palette buttons.
+ * This is needed for screens without dynamicColor.
+ */
+static void allocNewColors(void)
+{
+       int i, n;
+       Arg args[10];
+       static unsigned long   pixels[XmCO_MAX_NUM_COLORS*5];
+       static int       count = 0;
+
+       if(count)
+       {
+               /* free the cells from last selection */
+               XFreeColors(style.display, style.colormap, pixels, count, 0);
+               count=0;
+       }
+
+       for (i=0; i<pCurrentPalette->num_of_colors; i++)
+       {
+               n=0;
+               if (XAllocColor(style.display, style.colormap,
+                       &(pCurrentPalette->color[i].fg)) == 0) break;
+               pixels[count++] = pCurrentPalette->color[i].fg.pixel;
+
+               if (XAllocColor(style.display, style.colormap,
+                       &(pCurrentPalette->color[i].bg)) == 0) break;
+               pixels[count++] = pCurrentPalette->color[i].bg.pixel;
+               XtSetArg (args[n], XmNbackground,
+                       pCurrentPalette->color[i].bg.pixel); n++;
+
+               if (XAllocColor(style.display, style.colormap,
+                       &(pCurrentPalette->color[i].sc)) == 0)  break;
+               pixels[count++] = pCurrentPalette->color[i].sc.pixel;
+               XtSetArg (args[n], XmNarmColor,
+                       pCurrentPalette->color[i].sc.pixel); n++;
+
+               if (UsePixmaps == FALSE)
+               {
+                       if (XAllocColor(style.display, style.colormap,
+                               &(pCurrentPalette->color[i].ts)) == 0) break;
+                       pixels[count++] = pCurrentPalette->color[i].ts.pixel;
+                       XtSetArg (args[n], XmNtopShadowColor,
+                               pCurrentPalette->color[i].ts.pixel); n++;
+
+                       if (XAllocColor(style.display, style.colormap,
+                               &(pCurrentPalette->color[i].bs)) == 0) break;
+                       pixels[count++] = pCurrentPalette->color[i].bs.pixel;
+                       XtSetArg (args[n], XmNbottomShadowColor,
+                               pCurrentPalette->color[i].bs.pixel); n++;
+               }
+               else    /* create pixmaps for top/bottom shadow */
+               {
+                       XmDestroyPixmap(style.screen, edit.pixmap25);
+                       XmDestroyPixmap(style.screen, edit.pixmap75);
+
+                       edit.pixmap25 = XmGetPixmap (style.screen,
+                               "50_foreground",pCurrentPalette->color[i].bg.pixel,
+                               WhitePixelOfScreen(style.screen));
+
+                       edit.pixmap75 = XmGetPixmap (style.screen,
+                               "50_foreground",pCurrentPalette->color[i].bg.pixel,
+                               BlackPixelOfScreen(style.screen));
+
+                       XtSetArg (args[n], XmNtopShadowPixmap, edit.pixmap25); n++;
+                       XtSetArg (args[n], XmNbottomShadowPixmap, edit.pixmap75); n++;
+               }
+               XtSetValues(colorButton[i], args, n);
+       }
+}
     
 /*
 **  This is the selection callback for the Scrolled list.
@@ -754,16 +834,13 @@ selectPaletteCB(
         XtPointer client_data,
         XtPointer call_data )
 {
-    register int     n,i;
+    register int     n;
     Arg              args[10];
     XmListCallbackStruct *cb = (XmListCallbackStruct *)call_data;
     palette         *tmp_palette;
     XmString         string;
     Pixel            white, black;
-    static unsigned long   pixels[XmCO_MAX_NUM_COLORS*5];
-    static int       count;
-    static Boolean   First = True;
-
+       static Boolean   First = True;
 
     white = WhitePixelOfScreen(style.screen);
     black = BlackPixelOfScreen(style.screen);
@@ -793,82 +870,15 @@ selectPaletteCB(
                ReColorPalette();
            else 
             {     
-               /* PUT DIALOG saying can't dynamically change */
-               if(First)
-               {
-                  InfoDialog(NEXT_SESSION, style.colorDialog, False);
-                  First = False;
-               }
-               else
-               {
-                  if (TypeOfMonitor != XmCO_BLACK_WHITE)
-
-                     /* free the cells from last selection */
-                     XFreeColors(style.display, style.colormap, pixels, 
-                                 count, 0);
-               }
-
                if (TypeOfMonitor != XmCO_BLACK_WHITE)
                {
-                  /* allocate new colors */
-                  count = 0;
-
-                  for (i=0; i<pCurrentPalette->num_of_colors; i++)
-                  {
-                     n=0;  
-                     if (XAllocColor(style.display, style.colormap,
-                                 &(pCurrentPalette->color[i].bg)) == 0)
-                        break;
-                     pixels[count++] = pCurrentPalette->color[i].bg.pixel;
-                     XtSetArg (args[n], XmNbackground,
-                                 pCurrentPalette->color[i].bg.pixel); n++;
-
-                     if (XAllocColor(style.display, style.colormap,
-                                 &(pCurrentPalette->color[i].sc)) == 0)
-                        break;
-                     pixels[count++] = pCurrentPalette->color[i].sc.pixel;
-                     XtSetArg (args[n], XmNarmColor, 
-                                 pCurrentPalette->color[i].sc.pixel); n++;
-
-                     if (UsePixmaps == FALSE)
-                     {
-                        if (XAllocColor(style.display, style.colormap,
-                                 &(pCurrentPalette->color[i].ts)) == 0)
-                           break;
-                        pixels[count++] = pCurrentPalette->color[i].ts.pixel;
-                        XtSetArg (args[n], XmNtopShadowColor, 
-                                 pCurrentPalette->color[i].ts.pixel); n++;
-
-                        if (XAllocColor(style.display, style.colormap,
-                                 &(pCurrentPalette->color[i].bs)) == 0)
-                           break;
-                        pixels[count++] = pCurrentPalette->color[i].bs.pixel;
-                        XtSetArg (args[n], XmNbottomShadowColor, 
-                            pCurrentPalette->color[i].bs.pixel); n++;
-                     }
-                     else     /* create pixmaps for top/bottom shadow */
-                     {
-                         XmDestroyPixmap(style.screen, edit.pixmap25);
-                         XmDestroyPixmap(style.screen, edit.pixmap75);
-
-                         edit.pixmap25 = XmGetPixmap (style.screen, 
-                                         "50_foreground",
-                                         pCurrentPalette->color[i].bg.pixel,
-                                         WhitePixelOfScreen(style.screen));
-
-                         edit.pixmap75 = XmGetPixmap (style.screen, 
-                                         "50_foreground",
-                                         pCurrentPalette->color[i].bg.pixel,
-                                         BlackPixelOfScreen(style.screen));
-
-                        XtSetArg (args[n], XmNtopShadowPixmap, edit.pixmap25);
-                            n++;
-                        XtSetArg (args[n], XmNbottomShadowPixmap, edit.pixmap75);     
-                            n++;
-                     }
-
-                     XtSetValues(colorButton[i], args, n);
-                  }
+                            /* PUT DIALOG saying can't dynamically change */
+                 if(First)
+                 {
+                    InfoDialog(NEXT_SESSION, style.colorDialog, False);
+                    First = False;
+                 }
+                 allocNewColors();
                }
                else  /* XmCO_BLACK_WHITE */
                {
@@ -973,12 +983,13 @@ selectColorCB(
         XtPointer client_data,
         XtPointer call_data )
 {
-    int              i,n;
+    intptr_t         i;
+    int              n;
     Arg              args[4];
     ColorSet *color_set;
     XmPushButtonCallbackStruct *cb = (XmPushButtonCallbackStruct *)call_data;
 
-    i = (int) client_data;
+    i = (intptr_t) client_data;
 
     /* if click_count == 1 .. first button press, set time out */
     if(cb->click_count == 1)
@@ -994,10 +1005,15 @@ selectColorCB(
 
     if ((edit.DialogShell == NULL) || (!XtIsManaged(edit.DialogShell)))
     {
+               Pixel bg_pixel;
+
         /* make the new selected button have a border color */
-        n=0;
-        XtSetArg (args[n], XmNborderColor, 
-                  pCurrentPalette->color[pCurrentPalette->secondary].bg.pixel);
+               n=0;
+               XtSetArg(args[n],XmNbackground,&bg_pixel); n++;
+               XtGetValues(colorDialog.colorForm,args,n);
+
+               n=0;
+        XtSetArg (args[n], XmNborderColor,bg_pixel);
         n++;
         XtSetValues(colorButton[selected_button],args,n);
 
@@ -1010,9 +1026,28 @@ selectColorCB(
 
         color_set = (ColorSet *) &pCurrentPalette->color[selected_button];
         ColorEditor(style.colorDialog,color_set);
+
+               if(!style.dynamicColor) /* need to update pixels */
+                       XtAddCallback(edit.DialogShell, XmNcallback, colorEditorCB, NULL);
     }
 }
 
+/*
+ * Color editor callback for screens without dynamicColor.
+ */
+static void colorEditorCB(Widget w, XtPointer client_data, XtPointer call_data)
+{
+       static Boolean first = True;
+       DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
+
+       /* show "next session" message if first edit */
+    if(cb->button_position==OK_BUTTON && first){
+               InfoDialog(NEXT_SESSION, style.colorDialog, False);
+               first = False;
+       }
+       allocNewColors();
+       XtRemoveCallback(edit.DialogShell, XmNcallback, colorEditorCB, NULL);
+}
 
 /*
 **  This is the double click timeout callback.  If this routine is called
@@ -1024,20 +1059,24 @@ timeoutCB(
         XtIntervalId *id )
 {
     register int     n;
-    int              i;
+    intptr_t         i;
     Arg              args[2];
+       Pixel   bg_pixel;
 
     if (TypeOfMonitor == XmCO_BLACK_WHITE)
         return;
 
-    i = (int)client_data;
+    i = (intptr_t) client_data;
 
     if ((edit.DialogShell == NULL) || (!XtIsManaged(edit.DialogShell)))
     {
         /* make the new selected button have a border color */
+               n=0;
+               XtSetArg(args[n],XmNbackground,&bg_pixel); n++;
+               XtGetValues(colorDialog.colorForm,args,n);
+
         n=0;
-        XtSetArg (args[n], XmNborderColor, 
-                  pCurrentPalette->color[pCurrentPalette->secondary].bg.pixel);
+        XtSetArg (args[n], XmNborderColor,bg_pixel);
         n++;
         XtSetValues(colorButton[selected_button],args,n);
 
@@ -1065,9 +1104,9 @@ addPaletteCB(
     {
         n = 0;
 
-        XtSetArg(args[n], XmNokLabelString, CMPSTR(_DtOkString)); n++;
-        XtSetArg(args[n], XmNcancelLabelString, CMPSTR(_DtCancelString)); n++;
-        XtSetArg(args[n], XmNhelpLabelString, CMPSTR(_DtHelpString)); n++;
+        XtSetArg(args[n], XmNokLabelString, CMPSTR((String) _DtOkString)); n++;
+        XtSetArg(args[n], XmNcancelLabelString, CMPSTR((String) _DtCancelString)); n++;
+        XtSetArg(args[n], XmNhelpLabelString, CMPSTR((String) _DtHelpString)); n++;
        string =  CMPSTR(((char *)GETMESSAGE(14, 10, "New palette name:")));
         XtSetArg(args[n], XmNselectionLabelString, string); n++;
         string1 =  CMPSTR("");
@@ -1366,6 +1405,8 @@ modifyColorCB(
     color_set = (ColorSet *) &pCurrentPalette->color[selected_button];
     ColorEditor(style.colorDialog,color_set);
 
+       if(!style.dynamicColor) /* need to update pixels */
+               XtAddCallback(edit.DialogShell, XmNcallback, colorEditorCB, NULL);
 }
 
 
@@ -1476,9 +1517,9 @@ deletePaletteCB(
     if (deleteDialog == NULL)
     {
        n=0;
-        XtSetArg(args[n], XmNokLabelString, CMPSTR(_DtOkString)); n++;
-        XtSetArg(args[n], XmNcancelLabelString, CMPSTR(_DtCancelString)); n++;
-        XtSetArg(args[n], XmNhelpLabelString, CMPSTR(_DtHelpString)); n++;
+        XtSetArg(args[n], XmNokLabelString, CMPSTR((String) _DtOkString)); n++;
+        XtSetArg(args[n], XmNcancelLabelString, CMPSTR((String) _DtCancelString)); n++;
+        XtSetArg(args[n], XmNhelpLabelString, CMPSTR((String) _DtHelpString)); n++;
        XtSetArg(args[n], XmNdialogType, XmDIALOG_INFORMATION);             n++;
        XtSetArg(args[n], XmNborderWidth, 3);                               n++;
         XtSetArg(args[n], XmNdefaultPosition, False);                      n++;
@@ -1567,9 +1608,9 @@ resourcesCB(
         n = 0;
 
         /* Set up DialogBox button labels. */
-        button_string[0] = CMPSTR(_DtOkString);
-        button_string[1] = CMPSTR(_DtCancelString);
-        button_string[2] = CMPSTR(_DtHelpString);
+        button_string[0] = CMPSTR((String) _DtOkString);
+        button_string[1] = CMPSTR((String) _DtCancelString);
+        button_string[2] = CMPSTR((String) _DtHelpString);
 
         XtSetArg (args[n], XmNchildType, XmWORK_AREA);  n++;
         XtSetArg (args[n], XmNbuttonCount, NUM_LABELS);  n++;
@@ -1704,7 +1745,7 @@ colorUseCB(
     XmToggleButtonCallbackStruct *cb = 
             (XmToggleButtonCallbackStruct *)call_data;
 
-    colorDialog.currentColorUse = (int) client_data;
+    colorDialog.currentColorUse = (int) (intptr_t) client_data;
     switch (colorDialog.currentColorUse)
     {
         case XmCO_HIGH_COLOR:
@@ -2049,7 +2090,7 @@ SaveOrgPalette( void )
    int i;
    palette  *tmp_palette, *tmp2_palette;
 
-   if(save.restoreFlag && defaultName_restore[0] != NULL) {
+   if(save.restoreFlag && defaultName_restore[0] != 0) {
       tmp_palette = pHeadPalette;
       while(tmp_palette->next != NULL )
          if(strcmp(tmp_palette->name, defaultName))
@@ -2077,7 +2118,7 @@ SaveOrgPalette( void )
        OrgPalette.active = pCurrentPalette->active;
        OrgPalette.inactive = pCurrentPalette->inactive;
 
-       if(save.restoreFlag && defaultName_restore[0] != NULL)
+       if(save.restoreFlag && defaultName_restore[0] != 0)
           OrgPalette.color[i].bg.pixel = tmp2_palette->color[i].bg.pixel;
        else
           OrgPalette.color[i].bg.pixel = pCurrentPalette->color[i].bg.pixel;
@@ -2085,7 +2126,7 @@ SaveOrgPalette( void )
        OrgPalette.color[i].bg.green = pCurrentPalette->color[i].bg.green;
        OrgPalette.color[i].bg.blue = pCurrentPalette->color[i].bg.blue;
 
-       if(save.restoreFlag && defaultName_restore[0] != NULL)
+       if(save.restoreFlag && defaultName_restore[0] != 0)
           OrgPalette.color[i].fg.pixel = tmp2_palette->color[i].fg.pixel;
        else
           OrgPalette.color[i].fg.pixel = pCurrentPalette->color[i].fg.pixel;
@@ -2093,7 +2134,7 @@ SaveOrgPalette( void )
        OrgPalette.color[i].fg.green = pCurrentPalette->color[i].fg.green;
        OrgPalette.color[i].fg.blue = pCurrentPalette->color[i].fg.blue;
 
-       if(save.restoreFlag && defaultName_restore[0] != NULL)
+       if(save.restoreFlag && defaultName_restore[0] != 0)
           OrgPalette.color[i].ts.pixel = tmp2_palette->color[i].ts.pixel;
        else
           OrgPalette.color[i].ts.pixel = pCurrentPalette->color[i].ts.pixel;
@@ -2101,7 +2142,7 @@ SaveOrgPalette( void )
        OrgPalette.color[i].ts.green = pCurrentPalette->color[i].ts.green;
        OrgPalette.color[i].ts.blue = pCurrentPalette->color[i].ts.blue;
 
-       if(save.restoreFlag && defaultName_restore[0] != NULL)
+       if(save.restoreFlag && defaultName_restore[0] != 0)
           OrgPalette.color[i].bs.pixel = tmp2_palette->color[i].bs.pixel;
        else
           OrgPalette.color[i].bs.pixel = pCurrentPalette->color[i].bs.pixel;
@@ -2109,7 +2150,7 @@ SaveOrgPalette( void )
        OrgPalette.color[i].bs.green = pCurrentPalette->color[i].bs.green;
        OrgPalette.color[i].bs.blue = pCurrentPalette->color[i].bs.blue;
 
-       if(save.restoreFlag && defaultName_restore[0] != NULL)
+       if(save.restoreFlag && defaultName_restore[0] != 0)
           OrgPalette.color[i].sc.pixel = tmp2_palette->color[i].sc.pixel;
        else
           OrgPalette.color[i].sc.pixel = pCurrentPalette->color[i].sc.pixel;
@@ -2118,7 +2159,7 @@ SaveOrgPalette( void )
        OrgPalette.color[i].sc.blue = pCurrentPalette->color[i].sc.blue;
    }
 
-   if(save.restoreFlag && defaultName_restore[0] != NULL
+   if(save.restoreFlag && defaultName_restore[0] != 0
       if(tmp_palette != NULL)
          pCurrentPalette = tmp2_palette;
 
@@ -2284,10 +2325,10 @@ show_selection(
     style.colorSrv = True;
     if(value != NULL)
     {
-       if((int)client_data == GET_TYPE_MONITOR)
+       if((intptr_t) client_data == GET_TYPE_MONITOR)
        {
-          sscanf ((char *)value, "%x_%x_%x_%x",&(TypeOfMonitor),
-                                     &(UsePixmaps), &(FgColor),&dynamic_color);
+          sscanf ((char *)value, "%x_%x_%x_%x", (unsigned int *) &(TypeOfMonitor),
+                                     (unsigned int *) &(UsePixmaps), (unsigned int *) &(FgColor), (unsigned int *) &dynamic_color);
           if(dynamic_color == FALSE)
              style.dynamicColor = False;
           else
@@ -2413,7 +2454,9 @@ saveColor(
                pCurrentPalette->name);
        sprintf(bufr, "%s*paletteDlg.selected_button: %d\n", bufr, 
                selected_button);
-       write (fd, bufr, strlen(bufr));
+       if(-1 == write (fd, bufr, strlen(bufr))) {
+               perror(strerror(errno));
+       }
     }
 }
 
@@ -2440,9 +2483,9 @@ SameName(
      tmpStr = (char *)XtMalloc(strlen(STR1) + strlen(name) + 1);
      sprintf(tmpStr, STR1, name);
      XtSetArg(args[n], XmNmessageString, CMPSTR(tmpStr)); n++;
-     XtSetArg(args[n], XmNokLabelString, CMPSTR(_DtOkString)); n++;
-     XtSetArg(args[n], XmNcancelLabelString, CMPSTR(_DtCancelString)); n++;
-     XtSetArg(args[n], XmNhelpLabelString, CMPSTR(_DtHelpString)); n++;
+     XtSetArg(args[n], XmNokLabelString, CMPSTR((String) _DtOkString)); n++;
+     XtSetArg(args[n], XmNcancelLabelString, CMPSTR((String) _DtCancelString)); n++;
+     XtSetArg(args[n], XmNhelpLabelString, CMPSTR((String) _DtHelpString)); n++;
      XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC ); n++;
      XtSetArg(args[n], XmNdialogTitle, CMPSTR(((char *)GETMESSAGE(14, 21, "Warning")))); n++;
      colorDialog.dlg = XmCreateWarningDialog(style.colorDialog, "QNotice", args, n);
@@ -2593,9 +2636,9 @@ CreateDialogBoxD(
        XtRealizeWidget(parent);
 
    /* Set up DialogBox button labels. */
-    button_string[0] = CMPSTR(_DtOkString);
-    button_string[1] = CMPSTR(_DtCancelString);
-    button_string[2] = CMPSTR(_DtHelpString);
+    button_string[0] = CMPSTR((String) _DtOkString);
+    button_string[1] = CMPSTR((String) _DtCancelString);
+    button_string[2] = CMPSTR((String) _DtHelpString);
 
    /* saveRestore
     * Note that save.poscnt has been initialized elsewhere.  
@@ -2738,8 +2781,7 @@ CreateBottomColor( void )
     if(style.count > 10)
        return;
 
-
-    if(style.dynamicColor)
+    if(TypeOfMonitor != XmCO_BLACK_WHITE)
     {
         /* Create form for Add and Delete buttons */
         n = 0;
@@ -2814,7 +2856,7 @@ CreateBottomColor( void )
     XtManageChild(style.buttonsForm);
     
     /* Create Modify... button */
-    if(style.dynamicColor)
+    if(TypeOfMonitor != XmCO_BLACK_WHITE)
     {
         n = 0;
         XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM);  n++;