Implement tick marks in the Type menu on OS X.
[sgt/puzzles] / windows.c
index 9863de4..32c3322 100644 (file)
--- a/windows.c
+++ b/windows.c
@@ -398,12 +398,14 @@ static void win_text_colour(frontend *fe, int colour)
     if (fe->drawstatus == PRINTING) {
        int hatch;
        float r, g, b;
-       print_get_colour(fe->dr, colour, &hatch, &r, &g, &b);
-       if (fe->printcolour)
-           SetTextColor(fe->hdc, RGB(r * 255, g * 255, b * 255));
-       else
-           SetTextColor(fe->hdc,
-                        hatch == HATCH_CLEAR ? RGB(255,255,255) : RGB(0,0,0));
+       print_get_colour(fe->dr, colour, fe->printcolour, &hatch, &r, &g, &b);
+
+       /*
+        * Displaying text in hatched colours is not permitted.
+        */
+       assert(hatch < 0);
+
+       SetTextColor(fe->hdc, RGB(r * 255, g * 255, b * 255));
     } else {
        SetTextColor(fe->hdc, fe->colours[colour]);
     }
@@ -417,14 +419,10 @@ static void win_set_brush(frontend *fe, int colour)
     if (fe->drawstatus == PRINTING) {
        int hatch;
        float r, g, b;
-       print_get_colour(fe->dr, colour, &hatch, &r, &g, &b);
+       print_get_colour(fe->dr, colour, fe->printcolour, &hatch, &r, &g, &b);
 
-       if (fe->printcolour) {
+       if (hatch < 0) {
            br = CreateSolidBrush(RGB(r * 255, g * 255, b * 255));
-       } else if (hatch == HATCH_SOLID) {
-           br = CreateSolidBrush(RGB(0,0,0));
-       } else if (hatch == HATCH_CLEAR) {
-           br = CreateSolidBrush(RGB(255,255,255));
        } else {
 #ifdef _WIN32_WCE
            /*
@@ -469,18 +467,12 @@ static void win_set_pen(frontend *fe, int colour, int thin)
        float r, g, b;
        int width = thin ? 0 : fe->linewidth;
 
-       print_get_colour(fe->dr, colour, &hatch, &r, &g, &b);
-       if (fe->printcolour)
-           pen = CreatePen(PS_SOLID, width,
-                           RGB(r * 255, g * 255, b * 255));
-       else if (hatch == HATCH_SOLID)
-           pen = CreatePen(PS_SOLID, width, RGB(0, 0, 0));
-       else if (hatch == HATCH_CLEAR)
-           pen = CreatePen(PS_SOLID, width, RGB(255,255,255));
-       else {
-           assert(!"This shouldn't happen");
-           pen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
-       }
+       print_get_colour(fe->dr, colour, fe->printcolour, &hatch, &r, &g, &b);
+       /*
+        * Stroking in hatched colours is not permitted.
+        */
+       assert(hatch < 0);
+       pen = CreatePen(PS_SOLID, width, RGB(r * 255, g * 255, b * 255));
     } else {
        pen = fe->pens[colour];
     }
@@ -1659,7 +1651,7 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
             if (help_topic) {
                 char *item;
                 assert(thegame.name);
-                item = snewn(9+strlen(thegame.name), char); /*ick*/
+                item = snewn(10+strlen(thegame.name), char); /*ick*/
                 sprintf(item, "&Help on %s", thegame.name);
                 AppendMenu(menu, MF_ENABLED, IDM_GAMEHELP, item);
                 sfree(item);
@@ -2222,7 +2214,7 @@ static void about(frontend *fe)
 
     y += height/2;                    /* extra space before OK */
     mkctrl(fe, width*2, maxwid+width*2, y, y+height*7/4, "BUTTON",
-          BS_PUSHBUTTON | BS_NOTIFY | WS_TABSTOP | BS_DEFPUSHBUTTON, 0,
+          BS_PUSHBUTTON | WS_TABSTOP | BS_DEFPUSHBUTTON, 0,
           "OK", IDOK);
 
     SendMessage(fe->cfgbox, WM_INITDIALOG, 0, 0);
@@ -2465,10 +2457,10 @@ static int get_config(frontend *fe, int which)
 
     y += height/2;                    /* extra space before OK and Cancel */
     mkctrl(fe, col1l, (col1l+col2r)/2-width, y, y+height*7/4, "BUTTON",
-          BS_PUSHBUTTON | BS_NOTIFY | WS_TABSTOP | BS_DEFPUSHBUTTON, 0,
+          BS_PUSHBUTTON | WS_TABSTOP | BS_DEFPUSHBUTTON, 0,
           "OK", IDOK);
     mkctrl(fe, (col1l+col2r)/2+width, col2r, y, y+height*7/4, "BUTTON",
-          BS_PUSHBUTTON | BS_NOTIFY | WS_TABSTOP, 0, "Cancel", IDCANCEL);
+          BS_PUSHBUTTON | WS_TABSTOP, 0, "Cancel", IDCANCEL);
 
     SendMessage(fe->cfgbox, WM_INITDIALOG, 0, 0);