X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/35ee200129890bb76d15168c879bb0b0ca622296..9b185b04d84ce479f224700d1dc83497719e22df:/windows.c diff --git a/windows.c b/windows.c index 72d0120..f4cbfe4 100644 --- a/windows.c +++ b/windows.c @@ -121,7 +121,6 @@ struct frontend { HPEN oldpen; char *help_path; int help_has_contents; - char *laststatus; enum { DRAWING, PRINTING, NOTHING } drawstatus; DOCINFO di; int printcount, printw, printh, printsolns, printcurr, printcolour; @@ -180,16 +179,8 @@ void get_random_seed(void **randseed, int *randseedsize) static void win_status_bar(void *handle, char *text) { frontend *fe = (frontend *)handle; - char *rewritten; - rewritten = midend_rewrite_statusbar(fe->me, text); - if (!fe->laststatus || strcmp(rewritten, fe->laststatus)) { - SetWindowText(fe->statusbar, rewritten); - sfree(fe->laststatus); - fe->laststatus = rewritten; - } else { - sfree(rewritten); - } + SetWindowText(fe->statusbar, text); } static blitter *win_blitter_new(void *handle, int w, int h) @@ -913,7 +904,7 @@ void print(frontend *fe) fe->drawstatus = PRINTING; fe->hdc = pd.hDC; - fe->dr = drawing_init(&win_drawing, fe); + fe->dr = drawing_new(&win_drawing, NULL, fe); document_print(doc, fe->dr); drawing_free(fe->dr); fe->dr = NULL; @@ -1091,7 +1082,6 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error) frontend *fe; int x, y; RECT r; - HDC hdc; fe = snew(frontend); @@ -1123,8 +1113,6 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error) fe->fonts = NULL; fe->nfonts = fe->fontsize = 0; - fe->laststatus = NULL; - { int i, ncolours; float *colours; @@ -1150,7 +1138,8 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error) WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, /* status bar does these */ NULL, NULL, inst, NULL); - } + } else + fe->statusbar = NULL; get_max_puzzle_size(fe, &x, &y); midend_size(fe->me, &x, &y, FALSE); @@ -1261,13 +1250,10 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error) SetMenu(fe->hwnd, bar); } - new_game_size(fe); + fe->bitmap = NULL; + new_game_size(fe); /* initialises fe->bitmap */ check_window_size(fe, &x, &y); - hdc = GetDC(fe->hwnd); - fe->bitmap = CreateCompatibleBitmap(hdc, x, y); - ReleaseDC(fe->hwnd, hdc); - SetWindowLong(fe->hwnd, GWL_USERDATA, (LONG)fe); ShowWindow(fe->hwnd, SW_NORMAL); @@ -1906,7 +1892,7 @@ static void new_game_size(frontend *fe) SetWindowPos(fe->statusbar, NULL, 0, y, x, sr.bottom - sr.top, SWP_NOZORDER); - DeleteObject(fe->bitmap); + if (fe->bitmap) DeleteObject(fe->bitmap); hdc = GetDC(fe->hwnd); fe->bitmap = CreateCompatibleBitmap(hdc, x, y);