--- tuxpaint-0.9.5/src/tuxpaint.c.org 2003-01-14 10:28:12.000000000 +0900 +++ tuxpaint-0.9.5/src/tuxpaint.c 2003-01-14 14:34:06.000000000 +0900 @@ -1,3 +1,22 @@ +#define SVGA /* define SVGA to enable 800x600 mode */ + +#ifdef SVGA +#define WINDOW_WIDTH 800 +#define WINDOW_HEIGHT 600 +#define HEIGHTOFFSET 96 /* Muximum value is WINDOW_HEIGHT - 480 */ + /* recomend integral multiple of 48 */ +#define TOOLOFFSET HEIGHTOFFSET/48*2 +#define PROMPTOFFSETX (WINDOW_WIDTH - 640)/2 +#define PROMPTOFFSETY HEIGHTOFFSET/2 +#else +#define WINDOW_WIDTH 640 +#define WINDOW_HEIGHT 480 +#define HEIGHTOFFSET 0 +#define TOOLOFFSET 0 +#define PROMPTOFFSETX 0 +#define PROMPTOFFSETY 0 +#endif + /* tuxpaint.c @@ -126,8 +145,8 @@ #define FNAME_EXTENSION ".bmp" #endif -#define THUMB_W ((640 - 96 - 96) / 4) -#define THUMB_H (((48 * 7 + 40) - 72) / 4) +#define THUMB_W ((WINDOW_WIDTH - 96 - 96) / 4) +#define THUMB_H (((48 * 7 + 40 + HEIGHTOFFSET) - 72) / 4) #include "tools.h" #include "titles.h" @@ -567,8 +586,8 @@ cursor_y = -1; cursor_textwidth = 0; - mouse_x = 640 / 2; - mouse_y = 480 / 2; + mouse_x = WINDOW_WIDTH / 2; + mouse_y = WINDOW_HEIGHT / 2; SDL_WarpMouse(mouse_x, mouse_y); mousekey_up = SDL_KEYUP; @@ -603,7 +622,7 @@ draw_toolbar(); draw_colors(1); draw_brushes(); - update_canvas(0, 0, 640 - 96, (48 * 7) + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96, (48 * 7) + 40 + HEIGHTOFFSET); SDL_Flip(screen); @@ -758,7 +777,7 @@ do_undo(); } do_undo(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); shape_tool_mode = SHAPE_TOOL_MODE_DONE; } } @@ -772,7 +791,7 @@ if (tool_avail[TOOL_REDO]) { do_redo(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); shape_tool_mode = SHAPE_TOOL_MODE_DONE; } } @@ -795,7 +814,7 @@ tool_avail[TOOL_NEW] = tmp_int; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES || @@ -846,7 +865,7 @@ { SDL_FillRect(canvas, NULL, SDL_MapRGB(canvas->format, 255, 255, 255)); - update_canvas(0, 0, 640 - 96, (48 * 7) + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96, (48 * 7) + 40 + HEIGHTOFFSET); cur_undo = 0; oldest_undo = 0; @@ -866,7 +885,7 @@ } draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } else if (key == SDLK_s && (mod & KMOD_CTRL || @@ -886,7 +905,7 @@ /* cur_tool = old_tool; */ draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } else { @@ -986,7 +1005,7 @@ old_tool = cur_tool; cur_tool = which; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); playsound(1, SND_CLICK, 0); @@ -1041,7 +1060,7 @@ cur_tool = old_tool; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); shape_tool_mode = SHAPE_TOOL_MODE_DONE; } else if (cur_tool == TOOL_REDO) @@ -1053,7 +1072,7 @@ cur_tool = old_tool; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); shape_tool_mode = SHAPE_TOOL_MODE_DONE; } else if (cur_tool == TOOL_OPEN) @@ -1071,7 +1090,7 @@ cur_tool = old_tool; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); draw_tux_text(TUX_GREAT, tool_tips[cur_tool]); @@ -1114,7 +1133,7 @@ cur_tool = old_tool; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } else if (cur_tool == TOOL_NEW) { @@ -1125,7 +1144,7 @@ SDL_FillRect(canvas, NULL, SDL_MapRGB(canvas->format, 255, 255, 255)); - update_canvas(0, 0, 640 - 96, (48 * 7) + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96, (48 * 7) + 40 + HEIGHTOFFSET); cur_undo = 0; oldest_undo = 0; @@ -1147,7 +1166,7 @@ cur_tool = old_tool; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } else if (cur_tool == TOOL_PRINT) { @@ -1172,7 +1191,7 @@ cur_tool = old_tool; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } else if (cur_tool == TOOL_MAGIC) { @@ -1189,17 +1208,17 @@ done = do_quit(); cur_tool = old_tool; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } - SDL_UpdateRect(screen, 640 - 96, 0, 96, (48 * 7) + 40); - SDL_UpdateRect(screen, 0, (48 * 7) + 40, 640, 48); + SDL_UpdateRect(screen, WINDOW_WIDTH - 96, 0, 96, (48 * 7) + 40 + HEIGHTOFFSET); + SDL_UpdateRect(screen, 0, (48 * 7) + 40 + HEIGHTOFFSET, WINDOW_WIDTH, 48); } } - else if (event.button.x >= 640 - 96 && - event.button.x < 640 && + else if (event.button.x >= WINDOW_WIDTH - 96 && + event.button.x < WINDOW_WIDTH && event.button.y >= 40 && - event.button.y < (48 * 7) + 40) + event.button.y < (48 * (7+TOOLOFFSET/2)) + 40) { /* Options on the right have been pressed! */ @@ -1241,7 +1260,7 @@ /* Deal with scrollbars: */ - if (num_things > 14) + if (num_things > 14 + TOOLOFFSET) { if (event.button.y < 40 + 24) { @@ -1291,9 +1310,9 @@ } } } - else if (event.button.y >= (48 * 6) + 40 + 24) + else if (event.button.y >= (48 * (6+TOOLOFFSET/2)) + 40 + 24) { - if (thing_scroll < num_things - 12) + if (thing_scroll < num_things - 12 - TOOLOFFSET) { thing_scroll = thing_scroll + 2; do_draw = 1; @@ -1347,10 +1366,10 @@ if (event.button.y > 40 + off_y && - event.button.y < (48 * 7) + 40 - off_y) + event.button.y < (48 * (7+TOOLOFFSET/2)) + 40 - off_y) { which = ((event.button.y - 40 - off_y) / 48) * 2 + - ((event.button.x - (640 - 96)) / 48) + + ((event.button.x - (WINDOW_WIDTH - 96)) / 48) + thing_scroll; if (which < num_things) @@ -1426,8 +1445,8 @@ draw_colors(stamp_colorable(cur_stamp) || stamp_tintable(cur_stamp)); SDL_UpdateRect(screen, - 0, (48 * 7) + 40, - 640, 48); + 0, (48 * 7) + 40 + HEIGHTOFFSET, + WINDOW_WIDTH, 48); } } else if (cur_tool == TOOL_SHAPES) @@ -1448,8 +1467,8 @@ else draw_colors(0); - SDL_UpdateRect(screen, 0, (48 * 7) + 40, - 640, 48); + SDL_UpdateRect(screen, 0, (48 * 7) + 40 + HEIGHTOFFSET, + WINDOW_WIDTH, 48); } cur_magic = cur_thing; @@ -1464,14 +1483,14 @@ /* Update the screen: */ if (do_draw) - SDL_UpdateRect(screen, 640 - 96, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, WINDOW_WIDTH - 96, 0, 96, (48 * 7) + 40 + HEIGHTOFFSET); } } else if (event.button.x > 96 && /* FIXME: Need exact number here! */ - event.button.x < 640 && - event.button.y > (48 * 7) + 40 && - event.button.y <= (48 * 7) + 48 + 48 && + event.button.x < WINDOW_WIDTH && + event.button.y > (48 * (7+TOOLOFFSET/2)) + 40 && + event.button.y <= (48 * (7+TOOLOFFSET/2)) + 48 + 48 && (cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES || cur_tool == TOOL_SHAPES || cur_tool == TOOL_TEXT || (cur_tool == TOOL_MAGIC && cur_magic == MAGIC_FILL) || @@ -1481,14 +1500,14 @@ { /* Color! */ - which = (event.button.x - 96) / ((640 - 96) / NUM_COLORS); + which = (event.button.x - 96) / ((WINDOW_WIDTH - 96) / NUM_COLORS); if (which < NUM_COLORS) { cur_color = which; playsound(1, SND_BUBBLE, 1); draw_colors(1); - SDL_UpdateRect(screen, 0, (48 * 7) + 40, 640, 48); + SDL_UpdateRect(screen, 0, (48 * 7) + 40 + HEIGHTOFFSET, WINDOW_WIDTH, 48); render_brush(); draw_tux_text(TUX_KISS, color_names[cur_color]); @@ -1496,9 +1515,9 @@ do_render_cur_text(0); } } - else if (event.button.x > 96 && event.button.x < 640 - 96 && + else if (event.button.x > 96 && event.button.x < WINDOW_WIDTH - 96 && /* event.button.y >= 0 && */ - event.button.y < (48 * 7) + 40) + event.button.y < (48 * 7) + 40 + HEIGHTOFFSET) { /* Draw something! */ @@ -1512,7 +1531,7 @@ been_saved = 0; tool_avail[TOOL_SAVE] = 1; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, 48 * 7 + 40); + SDL_UpdateRect(screen, 0, 0, 96, 48 * (7+TOOLOFFSET/2) + 40); } if (cur_tool == TOOL_BRUSH) @@ -1674,7 +1693,7 @@ tool_avail[TOOL_NEW] = 1; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } } } @@ -1721,7 +1740,7 @@ /* Deal with scrollbars: */ - if (num_things > 14) + if (num_things > 14 + TOOLOFFSET) { if (event.button.button == 4) { @@ -1816,8 +1835,8 @@ draw_colors(stamp_colorable(cur_stamp) || stamp_tintable(cur_stamp)); SDL_UpdateRect(screen, - 0, (48 * 7) + 40, - 640, 48); + 0, (48 * 7) + 40 + HEIGHTOFFSET, + WINDOW_WIDTH, 48); } } else if (cur_tool == TOOL_SHAPES) @@ -1838,8 +1857,8 @@ else draw_colors(0); - SDL_UpdateRect(screen, 0, (48 * 7) + 40, - 640, 48); + SDL_UpdateRect(screen, 0, (48 * 7) + 40 + HEIGHTOFFSET, + WINDOW_WIDTH, 48); } cur_magic = cur_thing; @@ -1854,7 +1873,7 @@ /* Update the screen: */ if (do_draw) - SDL_UpdateRect(screen, 640 - 96, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, WINDOW_WIDTH - 96, 0, 96, (48 * 7) + 40 + HEIGHTOFFSET); } else if (event.type == SDL_USEREVENT) { @@ -1975,15 +1994,15 @@ } } else if (event.button.x > 96 && - event.button.y >= (48 * 7) + 40 && - event.button.y <= (48 * 7) + 40 + 48) + event.button.y >= (48 * 7) + 40 + HEIGHTOFFSET && + event.button.y <= (48 * 7) + 40 + 48 + HEIGHTOFFSET) { /* Color picker: */ do_setcursor(cursor_hand); } - else if (event.button.x >= 640 - 96 && event.button.y > 40 && - event.button.y <= (48 * 7) + 40) + else if (event.button.x >= WINDOW_WIDTH - 96 && event.button.y > 40 && + event.button.y <= (48 * (7+TOOLOFFSET/2)) + 40) { /* Selector: */ @@ -2017,7 +2036,7 @@ } - if (num_things > 14) + if (num_things > 14 + TOOLOFFSET) { /* Are there scroll buttons? */ @@ -2030,7 +2049,7 @@ else do_setcursor(cursor_arrow); } - else if (event.button.y > (48 * 6) + 40 + 24) + else if (event.button.y > (48 * (6+TOOLOFFSET/2)) + 40 + 24) { /* Down button; is it available? */ @@ -2053,8 +2072,8 @@ do_setcursor(cursor_hand); } } - else if (event.button.x > 96 && event.button.x < 640 - 96 && - event.button.y < (48 * 7) + 40) + else if (event.button.x > 96 && event.button.x < WINDOW_WIDTH - 96 && + event.button.y < (48 * 7) + 40 + HEIGHTOFFSET) { /* Canvas: */ @@ -2168,8 +2187,8 @@ h = 96; } - if (old_x >= 0 && old_x < 640 - 96 - 96 && - old_y >= 0 && old_y < (48 * 7) + 40) + if (old_x >= 0 && old_x < WINDOW_WIDTH - 96 - 96 && + old_y >= 0 && old_y < (48 * 7) + 40 + HEIGHTOFFSET) { #ifndef LOW_QUALITY_STAMP_OUTLINE if (cur_tool == TOOL_STAMP) @@ -2185,8 +2204,8 @@ old_x + w / 2 + 96, old_y + h / 2); } - if (new_x >= 0 && new_x < 640 - 96 - 96 && - new_y >= 0 && new_y < (48 * 7) + 40) + if (new_x >= 0 && new_x < WINDOW_WIDTH - 96 - 96 && + new_y >= 0 && new_y < (48 * 7) + 40 + HEIGHTOFFSET) { #ifndef LOW_QUALITY_STAMP_OUTLINE if (cur_tool == TOOL_STAMP) @@ -3015,7 +3034,7 @@ if (wanna_update_toolbar) { draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } } @@ -3683,9 +3702,9 @@ if (fullscreen) { #ifdef USE_HWSURFACE - screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN | SDL_HWSURFACE); + screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 16, SDL_FULLSCREEN | SDL_HWSURFACE); #else - screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN | SDL_SWSURFACE); + screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 16, SDL_FULLSCREEN | SDL_SWSURFACE); #endif if (screen == NULL) @@ -3703,9 +3722,9 @@ if (!fullscreen) { #ifdef USE_HWSURFACE - screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE); + screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 16, SDL_HWSURFACE); #else - screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE); + screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 16, SDL_SWSURFACE); #endif } @@ -3781,7 +3800,7 @@ /* Create drawing canvas: */ canvas = SDL_CreateRGBSurface(screen->flags, - 640 - (96 * 2), (48 * 7) + 40, + WINDOW_WIDTH - (96 * 2), (48 * 7) + 40 + HEIGHTOFFSET, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, @@ -3807,7 +3826,7 @@ for (i = 0; i < NUM_UNDO_BUFS; i++) { undo_bufs[i] = SDL_CreateRGBSurface(screen->flags, - 640 - (96 * 2), (48 * 7) + 40, + WINDOW_WIDTH - (96 * 2), (48 * 7) + 40 + HEIGHTOFFSET, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, @@ -3867,8 +3886,13 @@ show_progress_bar(); +#ifdef SVGA + img_cursor_up = loadimage(DATA_PREFIX "images/ui/cursor_up_L.png"); + img_cursor_down = loadimage(DATA_PREFIX "images/ui/cursor_down_L.png"); +#else img_cursor_up = loadimage(DATA_PREFIX "images/ui/cursor_up.png"); img_cursor_down = loadimage(DATA_PREFIX "images/ui/cursor_down.png"); +#endif img_scroll_up = loadimage(DATA_PREFIX "images/ui/scroll_up.png"); img_scroll_down = loadimage(DATA_PREFIX "images/ui/scroll_down.png"); @@ -4122,7 +4146,7 @@ /* Create appropriately-shaped buttons: */ - tmp_btn = thumbnail(img_btn_down, (640 - 96) / NUM_COLORS, 48, 0); + tmp_btn = thumbnail(img_btn_down, (WINDOW_WIDTH - 96) / NUM_COLORS, 48, 0); /* Create surfaces to draw them into: */ @@ -4131,7 +4155,7 @@ { img_color_btns[i] = SDL_CreateRGBSurface(screen->flags, - /* (640 - 96) / NUM_COLORS, 48, */ + /* (WINDOW_WIDTH - 96) / NUM_COLORS, 48, */ tmp_btn->w, tmp_btn->h, screen->format->BitsPerPixel, screen->format->Rmask, @@ -4160,7 +4184,7 @@ for (y = 0; y < tmp_btn->h /* 48 */; y++) { - for (x = 0; x < tmp_btn->w /* (640 - 96) / NUM_COLORS */; x++) + for (x = 0; x < tmp_btn->w /* (WINDOW_WIDTH - 96) / NUM_COLORS */; x++) { SDL_GetRGB(getpixel(tmp_btn, x, y), tmp_btn->format, &r, &g, &b); @@ -4427,35 +4451,42 @@ draw_image_title(TITLE_TOOLS, 0); - for (i = 0; i < NUM_TOOLS; i++) + for (i = 0; i < NUM_TOOLS + TOOLOFFSET; i++) { dest.x = ((i % 2) * 48); dest.y = ((i / 2) * 48) + 40; - if (i == cur_tool) + if (i < NUM_TOOLS) { - SDL_BlitSurface(img_btn_down, NULL, screen, &dest); - } - else if (tool_avail[i]) - { - SDL_BlitSurface(img_btn_up, NULL, screen, &dest); - } - else - { - SDL_BlitSurface(img_btn_off, NULL, screen, &dest); - } + if (i == cur_tool) + { + SDL_BlitSurface(img_btn_down, NULL, screen, &dest); + } + else if (tool_avail[i]) + { + SDL_BlitSurface(img_btn_up, NULL, screen, &dest); + } + else + { + SDL_BlitSurface(img_btn_off, NULL, screen, &dest); + } - dest.x = ((i % 2) * 48) + 4; - dest.y = ((i / 2) * 48) + 40 + 4; + dest.x = ((i % 2) * 48) + 4; + dest.y = ((i / 2) * 48) + 40 + 4; - SDL_BlitSurface(img_tools[i], NULL, screen, &dest); + SDL_BlitSurface(img_tools[i], NULL, screen, &dest); - dest.x = ((i % 2) * 48) + 4 + (40 - img_tool_names[i]->w) / 2; - dest.y = ((i / 2) * 48) + 40 + 4 + (44 - img_tool_names[i]->h); + dest.x = ((i % 2) * 48) + 4 + (40 - img_tool_names[i]->w) / 2; + dest.y = ((i / 2) * 48) + 40 + 4 + (44 - img_tool_names[i]->h); - SDL_BlitSurface(img_tool_names[i], NULL, screen, &dest); + SDL_BlitSurface(img_tool_names[i], NULL, screen, &dest); + } + else + { + SDL_BlitSurface(img_btn_off, NULL, screen, &dest); + } } } @@ -4471,11 +4502,11 @@ /* FIXME: Should we worry about more than 14 magic effects? :^/ */ - draw_image_title(TITLE_MAGIC, 640 - 96); + draw_image_title(TITLE_MAGIC, WINDOW_WIDTH - 96); - for (i = 0; i < 14; i++) + for (i = 0; i < 14 + TOOLOFFSET; i++) { - dest.x = 640 - 96 + ((i % 2) * 48); + dest.x = WINDOW_WIDTH - 96 + ((i % 2) * 48); dest.y = ((i / 2) * 48) + 40; @@ -4490,13 +4521,13 @@ SDL_BlitSurface(img_btn_up, NULL, screen, &dest); } - dest.x = 640 - 96 + ((i % 2) * 48) + 4; + dest.x = WINDOW_WIDTH - 96 + ((i % 2) * 48) + 4; dest.y = ((i / 2) * 48) + 40 + 4; SDL_BlitSurface(img_magics[i], NULL, screen, &dest); - dest.x = 640 - 96 + ((i % 2) * 48) + 4 + + dest.x = WINDOW_WIDTH - 96 + ((i % 2) * 48) + 4 + (40 - img_magic_names[i]->w) / 2; dest.y = ((i / 2) * 48) + 40 + 4 + (44 - img_magic_names[i]->h); @@ -4518,18 +4549,18 @@ SDL_Rect dest; dest.x = 0; - dest.y = 40 + ((NUM_TOOLS / 2) * 48); + dest.y = 40 + ((NUM_TOOLS / 2) * 48) + HEIGHTOFFSET; if (enabled) { SDL_BlitSurface(img_title_large_on, NULL, screen, &dest); dest.x = 0; - dest.y = 40 + ((NUM_TOOLS / 2) * 48); + dest.y = 40 + ((NUM_TOOLS / 2) * 48) + HEIGHTOFFSET; SDL_BlitSurface(img_title_large_on, NULL, screen, &dest); dest.x = (96 - img_title_names[TITLE_COLORS]->w) / 2; - dest.y = (40 + ((NUM_TOOLS / 2) * 48) + + dest.y = (40 + ((NUM_TOOLS / 2) * 48) + HEIGHTOFFSET + (48 - img_title_names[TITLE_COLORS]->h) / 2); SDL_BlitSurface(img_title_names[TITLE_COLORS], NULL, screen, &dest); } @@ -4541,18 +4572,18 @@ for (i = 0; i < NUM_COLORS; i++) { #ifndef LOW_QUALITY_COLOR_SELECTOR - dest.x = (i * ((640 - 96) / NUM_COLORS)) + 96; - dest.y = 40 + ((NUM_TOOLS / 2) * 48); + dest.x = (i * ((WINDOW_WIDTH - 96) / NUM_COLORS)) + 96; + dest.y = 40 + ((NUM_TOOLS / 2) * 48) + HEIGHTOFFSET; if (enabled) SDL_BlitSurface(img_color_btns[i], NULL, screen, &dest); else SDL_BlitSurface(img_color_btns[COLOR_WHITE], NULL, screen, &dest); #else - dest.x = (i * ((640 - 96) / NUM_COLORS)) + 96; - dest.y = 40 + ((NUM_TOOLS / 2) * 48); - dest.w = ((640 - 96) / NUM_COLORS); - dest.h = 48; + dest.x = (i * ((WINDOW_WIDTH - 96) / NUM_COLORS)) + 96; + dest.y = 40 + ((NUM_TOOLS / 2) * 48) + HEIGHTOFFSET; + dest.w = ((WINDOW_WIDTH - 96) / NUM_COLORS); + dest.h = 48 + HEIGHTOFFSET; if (enabled) SDL_FillRect(screen, &dest, @@ -4567,8 +4598,8 @@ if (i == cur_color && enabled) { - dest.x = (i * ((640 - 96) / NUM_COLORS)) + 96; - dest.y = 40 + ((NUM_TOOLS / 2) * 48); + dest.x = (i * ((WINDOW_WIDTH - 96) / NUM_COLORS)) + 96 + dest.w/2 - 20; + dest.y = 40 + ((NUM_TOOLS / 2) * 48) + HEIGHTOFFSET; SDL_BlitSurface(img_paintcan, NULL, screen, &dest); } @@ -4586,17 +4617,17 @@ /* Draw the title: */ - draw_image_title(TITLE_BRUSHES, 640 - 96); + draw_image_title(TITLE_BRUSHES, WINDOW_WIDTH - 96); /* Do we need scrollbars? */ - if (num_brushes > 14) + if (num_brushes > 14 + TOOLOFFSET) { off_y = 24; - max = 12; + max = 12 + TOOLOFFSET; - dest.x = 640 - 96; + dest.x = WINDOW_WIDTH - 96; dest.y = 40; if (brush_scroll > 0) @@ -4608,10 +4639,10 @@ SDL_BlitSurface(img_scroll_up_off, NULL, screen, &dest); } - dest.x = 640 - 96; - dest.y = 40 + 24 + (6 * 48); + dest.x = WINDOW_WIDTH - 96; + dest.y = 40 + 24 + ((6+TOOLOFFSET/2) * 48); - if (brush_scroll < num_brushes - 12) + if (brush_scroll < num_brushes - 12 - TOOLOFFSET) { SDL_BlitSurface(img_scroll_down, NULL, screen, &dest); } @@ -4623,7 +4654,7 @@ else { off_y = 0; - max = 14; + max = 14 + TOOLOFFSET; } @@ -4636,7 +4667,7 @@ i = brush - brush_scroll; - dest.x = ((i % 2) * 48) + (640 - 96); + dest.x = ((i % 2) * 48) + (WINDOW_WIDTH - 96); dest.y = ((i / 2) * 48) + 40 + off_y; if (brush == cur_brush) @@ -4654,7 +4685,7 @@ if (brush < num_brushes) { - dest.x = ((i % 2) * 48) + (640 - 96) + + dest.x = ((i % 2) * 48) + (WINDOW_WIDTH - 96) + ((48 - (img_brushes[brush]->w)) / 2); /* FIXME: Shouldn't that be ->h??? */ @@ -4680,17 +4711,17 @@ /* Draw the title: */ - draw_image_title(TITLE_LETTERS, 640 - 96); + draw_image_title(TITLE_LETTERS, WINDOW_WIDTH - 96); /* Do we need scrollbars? */ - if (num_fonts > 14) + if (num_fonts > 14 + TOOLOFFSET) { off_y = 24; - max = 12; + max = 12 + TOOLOFFSET; - dest.x = 640 - 96; + dest.x = WINDOW_WIDTH - 96; dest.y = 40; if (font_scroll > 0) @@ -4702,10 +4733,10 @@ SDL_BlitSurface(img_scroll_up_off, NULL, screen, &dest); } - dest.x = 640 - 96; - dest.y = 40 + 24 + (6 * 48); + dest.x = WINDOW_WIDTH - 96; + dest.y = 40 + 24 + ((6+TOOLOFFSET/2) * 48); - if (font_scroll < num_fonts - 12) + if (font_scroll < num_fonts - 12 - TOOLOFFSET) { SDL_BlitSurface(img_scroll_down, NULL, screen, &dest); } @@ -4717,7 +4748,7 @@ else { off_y = 0; - max = 14; + max = 14 + TOOLOFFSET; } @@ -4730,7 +4761,7 @@ i = font - font_scroll; - dest.x = ((i % 2) * 48) + (640 - 96); + dest.x = ((i % 2) * 48) + (WINDOW_WIDTH - 96); dest.y = ((i / 2) * 48) + 40 + off_y; if (font == cur_font) @@ -4763,7 +4794,7 @@ if (src.y < 0) src.y = 0; - dest.x = ((i % 2) * 48) + (640 - 96); + dest.x = ((i % 2) * 48) + (WINDOW_WIDTH - 96); if (src.w > tmp_surf->w) { src.w = tmp_surf->w; @@ -4797,17 +4828,17 @@ /* Draw the title: */ - draw_image_title(TITLE_STAMPS, 640 - 96); + draw_image_title(TITLE_STAMPS, WINDOW_WIDTH - 96); /* Do we need scrollbars? */ - if (num_stamps > 14) + if (num_stamps > 14 + TOOLOFFSET) { off_y = 24; - max = 12; + max = 12 + TOOLOFFSET; - dest.x = 640 - 96; + dest.x = WINDOW_WIDTH - 96; dest.y = 40; if (stamp_scroll > 0) @@ -4819,10 +4850,10 @@ SDL_BlitSurface(img_scroll_up_off, NULL, screen, &dest); } - dest.x = 640 - 96; - dest.y = 40 + 24 + (6 * 48); + dest.x = WINDOW_WIDTH - 96; + dest.y = 40 + 24 + ((6+TOOLOFFSET/2) * 48); - if (stamp_scroll < num_stamps - 12) + if (stamp_scroll < num_stamps - 12 - TOOLOFFSET) { SDL_BlitSurface(img_scroll_down, NULL, screen, &dest); } @@ -4834,7 +4865,7 @@ else { off_y = 0; - max = 14; + max = 14 + TOOLOFFSET; } @@ -4847,7 +4878,7 @@ i = stamp - stamp_scroll; - dest.x = ((i % 2) * 48) + (640 - 96); + dest.x = ((i % 2) * 48) + (WINDOW_WIDTH - 96); dest.y = ((i / 2) * 48) + 40 + off_y; if (stamp == cur_stamp) @@ -4870,7 +4901,7 @@ else img = img_stamps[stamp]; - dest.x = ((i % 2) * 48) + (640 - 96) + + dest.x = ((i % 2) * 48) + (WINDOW_WIDTH - 96) + ((48 - (img->w)) / 2); dest.y = ((i / 2) * 48) + 40 + ((48 - (img->h)) / 2) + off_y; @@ -4889,11 +4920,11 @@ SDL_Rect dest; - draw_image_title(TITLE_SHAPES, 640 - 96); + draw_image_title(TITLE_SHAPES, WINDOW_WIDTH - 96); - for (i = 0; i < 14; i++) + for (i = 0; i < 14 + TOOLOFFSET; i++) { - dest.x = ((i % 2) * 48) + 640 - 96; + dest.x = ((i % 2) * 48) + WINDOW_WIDTH - 96; dest.y = ((i / 2) * 48) + 40; @@ -4913,12 +4944,12 @@ if (i < NUM_SHAPES) { - dest.x = ((i % 2) * 48) + 4 + 640 - 96; + dest.x = ((i % 2) * 48) + 4 + WINDOW_WIDTH - 96; dest.y = ((i / 2) * 48) + 40 + 4; SDL_BlitSurface(img_shapes[i], NULL, screen, &dest); - dest.x = ((i % 2) * 48) + 4 + 640 - 96 + + dest.x = ((i % 2) * 48) + 4 + WINDOW_WIDTH - 96 + (40 - img_shape_names[i]->w) / 2; dest.y = ((i / 2) * 48) + 40 + 4 + (44 - img_shape_names[i]->h); @@ -4937,13 +4968,13 @@ int i; SDL_Rect dest; - dest.x = 640 - 96; + dest.x = WINDOW_WIDTH - 96; dest.y = 0; SDL_BlitSurface(img_title_off, NULL, screen, &dest); - for (i = 0; i < 14; i++) + for (i = 0; i < 14 + TOOLOFFSET; i++) { - dest.x = ((i % 2) * 48) + 640 - 96; + dest.x = ((i % 2) * 48) + WINDOW_WIDTH - 96; dest.y = ((i / 2) * 48) + 40; SDL_BlitSurface(img_btn_off, NULL, screen, &dest); @@ -5391,7 +5422,7 @@ printf("BLITTING: %d\n", cur_undo); #endif SDL_BlitSurface(undo_bufs[cur_undo], NULL, canvas, NULL); - update_canvas(0, 0, (640 - 96), (48 * 7) + 40); + update_canvas(0, 0, (WINDOW_WIDTH - 96), (48 * 7) + 40 + HEIGHTOFFSET); if (cur_undo == oldest_undo) { @@ -5408,7 +5439,7 @@ if (wanna_update_toolbar) { draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } been_saved = 0; @@ -5433,7 +5464,7 @@ printf("BLITTING: %d\n", cur_undo); #endif SDL_BlitSurface(undo_bufs[cur_undo], NULL, canvas, NULL); - update_canvas(0, 0, (640 - 96), (48 * 7) + 40); + update_canvas(0, 0, (WINDOW_WIDTH - 96), (48 * 7) + 40 + HEIGHTOFFSET); been_saved = 0; } @@ -5452,7 +5483,7 @@ tool_avail[TOOL_UNDO] = 1; draw_toolbar(); - SDL_UpdateRect(screen, 0, 0, 96, (48 * 7) + 40); + SDL_UpdateRect(screen, 0, 0, 96, (48 * (7+TOOLOFFSET/2)) + 40); } @@ -5632,8 +5663,8 @@ void clipped_putpixel(SDL_Surface * dest, int x, int y, Uint32 c) { - if (x >= 96 && x < (640 - 96) && - y >= 0 && y < (48 * 7 + 40)) + if (x >= 96 && x < (WINDOW_WIDTH - 96) && + y >= 0 && y < (48 * 7 + 40 + HEIGHTOFFSET)) { putpixel(dest, x, y, c); } @@ -5656,17 +5687,17 @@ if (y2 < 0) y2 = 0; - if (x1 >= (640 - 96 - 96)) - x1 = (640 - 96 - 96) - 1; + if (x1 >= (WINDOW_WIDTH - 96 - 96)) + x1 = (WINDOW_WIDTH - 96 - 96) - 1; - if (x2 >= (640 - 96 - 96)) - x2 = (640 - 96 - 96) - 1; + if (x2 >= (WINDOW_WIDTH - 96 - 96)) + x2 = (WINDOW_WIDTH - 96 - 96) - 1; - if (y1 >= (48 * 7) + 40) - y1 = (48 * 7) + 40 - 1; + if (y1 >= (48 * 7) + 40 + HEIGHTOFFSET) + y1 = (48 * 7) + 40 + HEIGHTOFFSET - 1; - if (y2 >= (48 * 7) + 40) - y2 = (48 * 7) + 40 - 1; + if (y2 >= (48 * 7) + 40 + HEIGHTOFFSET) + y2 = (48 * 7) + 40 + HEIGHTOFFSET - 1; line_xor(x1, y1, x2, y1); line_xor(x2, y1, x2, y2); @@ -5816,14 +5847,14 @@ if (y2 < 0) y2 = 0; - if (x1 >= 640) - x1 = 640 - 1; - if (x2 >= 640) - x2 = 640 - 1; - if (y1 >= 480) - y1 = 480 - 1; - if (y2 >= 480) - y2 = 480 - 1; + if (x1 >= WINDOW_WIDTH) + x1 = WINDOW_WIDTH - 1; + if (x2 >= WINDOW_WIDTH) + x2 = WINDOW_WIDTH - 1; + if (y1 >= WINDOW_HEIGHT) + y1 = WINDOW_HEIGHT - 1; + if (y2 >= WINDOW_HEIGHT) + y2 = WINDOW_HEIGHT - 1; SDL_UpdateRect(screen, x1, y1, x2 - x1 + 1, y2 - y1 + 1); } @@ -5885,9 +5916,9 @@ /* Clear first: */ dest.x = 0; - dest.y = (48 * 7) + 40 + 48; - dest.w = 640; - dest.h = 480 - ((48 * 7) + 40 + 48); + dest.y = (48 * 7) + 40 + 48 + HEIGHTOFFSET; + dest.w = WINDOW_WIDTH; + dest.h = WINDOW_HEIGHT - ((48 * 7) + 40 + 48 + HEIGHTOFFSET); SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 255, 255, 255)); @@ -5895,26 +5926,26 @@ /* Draw tux: */ dest.x = 0; - dest.y = 480 - (img_tux[which_tux] -> h); + dest.y = WINDOW_HEIGHT - (img_tux[which_tux] -> h); - if (dest.y < ((48 * 7) + 40 + 48)) - dest.y = ((48 * 7) + 40 + 48); + if (dest.y < ((48 * 7) + 40 + 48 + HEIGHTOFFSET)) + dest.y = ((48 * 7) + 40 + 48 + HEIGHTOFFSET); SDL_BlitSurface(img_tux[which_tux], NULL, screen, &dest); upper_str = uppercase(str); wordwrap_text(font, upper_str, black, - img_tux[which_tux] -> w + 5, (48 * 7) + 40 + 48 + 5, - 640); + img_tux[which_tux] -> w + 5, (48 * 7) + 40 + 48 + HEIGHTOFFSET + 5, + WINDOW_WIDTH); free(upper_str); /* Update the display: */ SDL_UpdateRect(screen, - 0, (48 * 7) + 40 + 48, - 640, 480 - ((48 * 7) + 40 + 48)); + 0, (48 * 7) + 40 + 48 + HEIGHTOFFSET, + WINDOW_WIDTH, WINDOW_HEIGHT - ((48 * 7) + 40 + 48 + HEIGHTOFFSET)); } @@ -6599,8 +6630,8 @@ if (keymouse) { - mouse_x = 640 / 2; - mouse_y = 480 / 2; + mouse_x = WINDOW_WIDTH / 2; + mouse_y = WINDOW_HEIGHT / 2; SDL_WarpMouse(mouse_x, mouse_y); } @@ -6611,8 +6642,8 @@ for (w = 0; w <= 96; w = w + 4) { - dest.x = 160 + 96 - w; - dest.y = 94 + 96 - w; + dest.x = 160 + 96 - w + PROMPTOFFSETX; + dest.y = 94 + 96 - w + PROMPTOFFSETY; dest.w = (320 - 96 * 2) + w * 2; dest.h = w * 2; SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 0, 0)); @@ -6639,8 +6670,8 @@ for (i = 8; i > 0; i = i - 2) { - dest.x = 160 + 96 - (w - 4) + i; - dest.y = 94 + 96 - (w - 4) + i; + dest.x = 160 + 96 - (w - 4) + i + PROMPTOFFSETX; + dest.y = 94 + 96 - (w - 4) + i + PROMPTOFFSETY; dest.w = (320 - 96 * 2) + (w - 4) * 2; dest.h = (w - 4) * 2; @@ -6654,8 +6685,8 @@ w = w - 6; - dest.x = 160 + 96 - w; - dest.y = 94 + 96 - w; + dest.x = 160 + 96 - w + PROMPTOFFSETX; + dest.y = 94 + 96 - w + PROMPTOFFSETY; dest.w = (320 - 96 * 2) + w * 2; dest.h = w * 2; SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 255, 255, 255)); @@ -6663,27 +6694,27 @@ /* Draw the question: */ - wordwrap_text(font, text, black, 166, 100, 482); + wordwrap_text(font, text, black, 166 + PROMPTOFFSETX, 100 + PROMPTOFFSETY, 482); /* Draw yes button: */ - dest.x = 166; - dest.y = 178; + dest.x = 166 + PROMPTOFFSETX; + dest.y = 178 + PROMPTOFFSETY; SDL_BlitSurface(img_yes, NULL, screen, &dest); - wordwrap_text(font, btn_yes, black, 166 + 48 + 4, 183, 482); + wordwrap_text(font, btn_yes, black, 166 + PROMPTOFFSETX + 48 + 4, 183 + PROMPTOFFSETY, 482); /* Draw no button: */ if (strlen(btn_no) != 0) { - dest.x = 166; - dest.y = 230; + dest.x = 166 + PROMPTOFFSETX; + dest.y = 230 + PROMPTOFFSETY; SDL_BlitSurface(img_no, NULL, screen, &dest); - wordwrap_text(font, btn_no, black, 166 + 48 + 4, 235, 482); + wordwrap_text(font, btn_no, black, 166 + PROMPTOFFSETX + 48 + 4, 235 + PROMPTOFFSETY, 482); } @@ -6756,15 +6787,15 @@ event.button.button >= 1 && event.button.button <= 3) { - if (event.button.x >= 166 && event.button.x < 166 + 48) + if (event.button.x >= 166 + PROMPTOFFSETX && event.button.x < 166 + PROMPTOFFSETX + 48) { - if (event.button.y >= 178 && event.button.y < 178 + 48) + if (event.button.y >= 178 + PROMPTOFFSETY && event.button.y < 178 + PROMPTOFFSETY + 48) { ans = 1; done = 1; } else if (strlen(btn_no) != 0 && - event.button.y >= 230 && event.button.y < 230 + 48) + event.button.y >= 230 + PROMPTOFFSETY && event.button.y < 230 + PROMPTOFFSETY + 48) { ans = 0; done = 1; @@ -6773,10 +6804,10 @@ } else if (event.type == SDL_MOUSEMOTION) { - if (event.button.x >= 166 && event.button.x < 166 + 48 && - ((event.button.y >= 178 && event.button.y < 178 + 48) || + if (event.button.x >= 166 + PROMPTOFFSETX && event.button.x < 166 + PROMPTOFFSETX + 48 && + ((event.button.y >= 178 + PROMPTOFFSETY && event.button.y < 178 + PROMPTOFFSETY + 48) || (strlen(btn_no) != 0 && - event.button.y >= 230 && event.button.y < 230 + 48))) + event.button.y >= 230 + PROMPTOFFSETY && event.button.y < 230 + PROMPTOFFSETY + 48))) { do_setcursor(cursor_hand); } @@ -6795,7 +6826,7 @@ /* Erase question prompt: */ - update_canvas(0, 0, 640 - 96 - 96, 48 * 7 + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96 - 96, 48 * 7 + 40 + HEIGHTOFFSET); return ans; } @@ -7215,7 +7246,7 @@ } if (xx % 10 == 0) - update_canvas(0, 0, 640 - 96, (48 * 7) + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96, (48 * 7) + 40 + HEIGHTOFFSET); } #endif } @@ -7879,8 +7910,8 @@ dest.x = 96; dest.y = 0; - dest.w = 640 - 96 - 96; - dest.h = 48 * 7 + 40; + dest.w = WINDOW_WIDTH - 96 - 96; + dest.h = 48 * 7 + 40 + HEIGHTOFFSET; SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 255, 255, 255)); @@ -7915,7 +7946,7 @@ /* Draw arrows: */ - dest.x = (640 - img_scroll_up->w) / 2; + dest.x = (WINDOW_WIDTH - img_scroll_up->w) / 2; dest.y = 0; if (cur > 0) @@ -7923,8 +7954,8 @@ else SDL_BlitSurface(img_scroll_up_off, NULL, screen, &dest); - dest.x = (640 - img_scroll_up->w) / 2; - dest.y = (48 * 7 + 40) - 48; + dest.x = (WINDOW_WIDTH - img_scroll_up->w) / 2; + dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - 48; if (cur < num_files - 16) SDL_BlitSurface(img_scroll_down, NULL, screen, &dest); @@ -7935,33 +7966,33 @@ /* "Open" button: */ dest.x = 96; - dest.y = (48 * 7 + 40) - 48; + dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - 48; SDL_BlitSurface(img_open, NULL, screen, &dest); dest.x = 96 + (48 - img_openlabels_open->w) / 2; - dest.y = (48 * 7 + 40) - img_openlabels_open->h; + dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - img_openlabels_open->h; SDL_BlitSurface(img_openlabels_open, NULL, screen, &dest); /* "Back" button: */ - dest.x = 640 - 96 - 48; - dest.y = (48 * 7 + 40) - 48; + dest.x = WINDOW_WIDTH - 96 - 48; + dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - 48; SDL_BlitSurface(img_back, NULL, screen, &dest); - dest.x = 640 - 96 - 48 + (48 - img_openlabels_back->w) / 2; - dest.y = (48 * 7 + 40) - img_openlabels_back->h; + dest.x = WINDOW_WIDTH - 96 - 48 + (48 - img_openlabels_back->w) / 2; + dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - img_openlabels_back->h; SDL_BlitSurface(img_openlabels_back, NULL, screen, &dest); /* "Erase" button: */ - dest.x = 640 - 96 - 48 - 48; - dest.y = (48 * 7 + 40) - 48; + dest.x = WINDOW_WIDTH - 96 - 48 - 48; + dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - 48; SDL_BlitSurface(img_erase, NULL, screen, &dest); - dest.x = 640 - 96 - 48 - 48 + (48 - img_openlabels_erase->w) / 2; - dest.y = (48 * 7 + 40) - img_openlabels_erase->h; + dest.x = WINDOW_WIDTH - 96 - 48 - 48 + (48 - img_openlabels_erase->w) / 2; + dest.y = (48 * 7 + 40 + HEIGHTOFFSET) - img_openlabels_erase->h; SDL_BlitSurface(img_openlabels_erase, NULL, screen, &dest); @@ -8078,9 +8109,9 @@ event.button.button >= 1 && event.button.button <= 3) { - if (event.button.x >= 96 && event.button.x < 640 - 96 && + if (event.button.x >= 96 && event.button.x < WINDOW_WIDTH - 96 && event.button.y >= 24 && - event.button.y < (48 * 7 + 40 - 48)) + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET - 48)) { /* Picked an icon! */ @@ -8107,8 +8138,8 @@ last_click_button = event.button.button; } } - else if (event.button.x >= (640 - img_scroll_up->w) / 2 && - event.button.x <= (640 + img_scroll_up->w) / 2) + else if (event.button.x >= (WINDOW_WIDTH - img_scroll_up->w) / 2 && + event.button.x <= (WINDOW_WIDTH + img_scroll_up->w) / 2) { if (event.button.y < 24) { @@ -8127,8 +8158,8 @@ if (which > cur + 16) which = which - 4; } - else if (event.button.y >= (48 * 7 + 40 - 48) && - event.button.y < (48 * 7 + 40 - 24)) + else if (event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET - 48) && + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET - 24)) { /* Down scroll button: */ @@ -8147,18 +8178,18 @@ } } else if (event.button.x >= 96 && event.button.x < 96 + 48 && - event.button.y >= (48 * 7 + 40) - 48 && - event.button.y < (48 * 7 + 40)) + event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 && + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET)) { /* Open */ done = 1; playsound(1, SND_CLICK, 1); } - else if (event.button.x >= (640 - 96 - 48) && - event.button.x < (640 - 96) && - event.button.y >= (48 * 7 + 40) - 48 && - event.button.y < (48 * 7 + 40)) + else if (event.button.x >= (WINDOW_WIDTH - 96 - 48) && + event.button.x < (WINDOW_WIDTH - 96) && + event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 && + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET)) { /* Back */ @@ -8166,10 +8197,10 @@ done = 1; playsound(1, SND_CLICK, 1); } - else if (event.button.x >= (640 - 96 - 48 - 48) && - event.button.x < (640 - 48 - 96) && - event.button.y >= (48 * 7 + 40) - 48 && - event.button.y < (48 * 7 + 40)) + else if (event.button.x >= (WINDOW_WIDTH - 96 - 48 - 48) && + event.button.x < (WINDOW_WIDTH - 48 - 96) && + event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 && + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET)) { /* Erase */ @@ -8181,18 +8212,18 @@ /* Deal with mouse pointer shape! */ if (event.button.y < 24 && - event.button.x >= (640 - img_scroll_up->w) / 2 && - event.button.x <= (640 + img_scroll_up->w) / 2 && + event.button.x >= (WINDOW_WIDTH - img_scroll_up->w) / 2 && + event.button.x <= (WINDOW_WIDTH + img_scroll_up->w) / 2 && cur > 0) { /* Scroll up button: */ do_setcursor(cursor_up); } - else if (event.button.y >= (48 * 7 + 40 - 48) && - event.button.y < (48 * 7 + 40 - 24) && - event.button.x >= (640 - img_scroll_up->w) / 2 && - event.button.x <= (640 + img_scroll_up->w) / 2 && + else if (event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET - 48) && + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET - 24) && + event.button.x >= (WINDOW_WIDTH - img_scroll_up->w) / 2 && + event.button.x <= (WINDOW_WIDTH + img_scroll_up->w) / 2 && cur < num_files - 16) { /* Scroll down button: */ @@ -8200,20 +8231,20 @@ do_setcursor(cursor_down); } else if (((event.button.x >= 96 && event.button.x < 96 + 48) || - (event.button.x >= (640 - 96 - 48) && - event.button.x < (640 - 96)) || - (event.button.x >= (640 - 96 - 48 - 48) && - event.button.x < (640 - 48 - 96))) && - event.button.y >= (48 * 7 + 40) - 48 && - event.button.y < (48 * 7 + 40)) + (event.button.x >= (WINDOW_WIDTH - 96 - 48) && + event.button.x < (WINDOW_WIDTH - 96)) || + (event.button.x >= (WINDOW_WIDTH - 96 - 48 - 48) && + event.button.x < (WINDOW_WIDTH - 48 - 96))) && + event.button.y >= (48 * 7 + 40 + HEIGHTOFFSET) - 48 && + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET)) { /* One of the command buttons: */ do_setcursor(cursor_hand); } - else if (event.button.x >= 96 && event.button.x < 640 - 96 && + else if (event.button.x >= 96 && event.button.x < WINDOW_WIDTH - 96 && event.button.y > 24 && - event.button.y < (48 * 7 + 40) - 48 && + event.button.y < (48 * 7 + 40 + HEIGHTOFFSET) - 48 && ((((event.button.x - 96) / (THUMB_W) + (((event.button.y - 24) / THUMB_H) * 4)) + cur) < num_files)) @@ -8377,7 +8408,7 @@ } - update_canvas(0, 0, 640 - 96 - 96, 48 * 7 + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96 - 96, 48 * 7 + 40 + HEIGHTOFFSET); } @@ -8603,7 +8634,7 @@ void scan_fill(int cnt, point_type * pts) { - edge * edges[48 * 7 + 40 + 5], * active; + edge * edges[48 * 7 + 40 + HEIGHTOFFSET + 5], * active; int i, scan; debug("scan_fill()"); @@ -8611,7 +8642,7 @@ /* Create empty edges: */ - for (i = 0; i < 48 * 7 + 40 + 5; i++) + for (i = 0; i < 48 * 7 + 40 + HEIGHTOFFSET + 5; i++) { edges[i] = (edge *) malloc(sizeof(edge)); edges[i]->next = NULL; @@ -8631,7 +8662,7 @@ /* Scan! */ - for (scan = 0; scan < 48 * 7 + 40; scan++) + for (scan = 0; scan < 48 * 7 + 40 + HEIGHTOFFSET; scan++) { build_active_list(scan, active, edges); @@ -8639,7 +8670,7 @@ { fill_scan(scan, active); - update_canvas(0, scan, 640 - 96, scan); + update_canvas(0, scan, WINDOW_WIDTH - 96, scan); SDL_Flip(screen); SDL_Delay(10); @@ -8653,7 +8684,7 @@ debug("Freeing..."); - for (i = 0; i < 48 * 7 + 40; i++) + for (i = 0; i < 48 * 7 + 40 + HEIGHTOFFSET; i++) { free(edges[i]); } @@ -8671,12 +8702,12 @@ } else if (b == Right) { - if (p.x >= 640 - 96) + if (p.x >= WINDOW_WIDTH - 96) return 0; } else if (b == Bottom) { - if (p.y >= 48 * 7 + 40) + if (p.y >= 48 * 7 + 40 + HEIGHTOFFSET) return 0; } else if (b == Top) @@ -8715,8 +8746,8 @@ } else if (b == Right) { - ipt.x = 640 - 96 - 1; - ipt.y = p2.y + ((640 - 96 - 1) - p2.x) * m; + ipt.x = WINDOW_WIDTH - 96 - 1; + ipt.y = p2.y + ((WINDOW_WIDTH - 96 - 1) - p2.x) * m; } else if (b == Top) { @@ -8728,9 +8759,9 @@ } else if (b == Bottom) { - ipt.y = (48 * 7 + 40) - 1; + ipt.y = (48 * 7 + 40 + HEIGHTOFFSET) - 1; if (p1.x != p2.x) - ipt.x = p2.x + (((48 * 7 + 40) - 1) - p2.y) / m; + ipt.x = p2.x + (((48 * 7 + 40 + HEIGHTOFFSET) - 1) - p2.y) / m; else ipt.x = p2.x; } @@ -9084,7 +9115,7 @@ int x; - for (x = 0; x < 640; x = x + 65) + for (x = 0; x < WINDOW_WIDTH; x = x + 65) { src.x = 65 - (prog_bar_ctr % 65); src.y = 0; @@ -9092,14 +9123,14 @@ src.h = 24; dest.x = x; - dest.y = 480 - 24; + dest.y = WINDOW_HEIGHT - 24; SDL_BlitSurface(img_progress, &src, screen, &dest); } prog_bar_ctr++; - SDL_UpdateRect(screen, 0, 480 - 24, 640, 24); + SDL_UpdateRect(screen, 0, WINDOW_HEIGHT - 24, WINDOW_WIDTH, 24); } @@ -9156,7 +9187,7 @@ { /* FIXME: Do something different! */ - update_canvas(0, 0, 640 - 96, (48 * 7) + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96, (48 * 7) + 40 + HEIGHTOFFSET); cursor_textwidth = 0; return; } @@ -9166,7 +9197,7 @@ { /* FIXME: Only delete what's changed! */ - update_canvas(0, 0, 640 - 96, (48 * 7) + 40); + update_canvas(0, 0, WINDOW_WIDTH - 96, (48 * 7) + 40 + HEIGHTOFFSET); /* Draw outline around text: */ @@ -9176,10 +9207,10 @@ dest.w = w + 4; dest.h = h + 4; - if (dest.x + dest.w > 640 - 96) - dest.w = 640 - 96 - dest.x; - if (dest.y + dest.h > (48 * 7 + 40)) - dest.h = (48 * 7 + 40) - dest.y; + if (dest.x + dest.w > WINDOW_WIDTH - 96) + dest.w = WINDOW_WIDTH - 96 - dest.x; + if (dest.y + dest.h > (48 * 7 + 40 + HEIGHTOFFSET)) + dest.h = (48 * 7 + 40 + HEIGHTOFFSET) - dest.y; SDL_FillRect(screen, &dest, SDL_MapRGB(canvas->format, 0, 0, 0)); @@ -9192,10 +9223,10 @@ dest.w = w; dest.h = h; - if (dest.x + dest.w > 640 - 96) - dest.w = 640 - 96 - dest.x; - if (dest.y + dest.h > (48 * 7 + 40)) - dest.h = (48 * 7 + 40) - dest.y; + if (dest.x + dest.w > WINDOW_WIDTH - 96) + dest.w = WINDOW_WIDTH - 96 - dest.x; + if (dest.y + dest.h > (48 * 7 + 40 + HEIGHTOFFSET)) + dest.h = (48 * 7 + 40 + HEIGHTOFFSET) - dest.y; if ((color_hexes[cur_color][0] + color_hexes[cur_color][1] + @@ -9228,10 +9259,10 @@ src.w = tmp_surf->w; src.h = tmp_surf->h; - if (dest.x + src.w > 640 - 96 - 96) - src.w = 640 - 96 - 96 - dest.x; - if (dest.y + src.h > (48 * 7 + 40)) - src.h = (48 * 7 + 40) - dest.y; + if (dest.x + src.w > WINDOW_WIDTH - 96 - 96) + src.w = WINDOW_WIDTH - 96 - 96 - dest.x; + if (dest.y + src.h > (48 * 7 + 40 + HEIGHTOFFSET)) + src.h = (48 * 7 + 40 + HEIGHTOFFSET) - dest.y; if (do_blit) { @@ -9816,12 +9847,12 @@ if (mousekey_up == SDL_KEYDOWN && mouse_y > 0) mouse_y = mouse_y - 8; - else if (mousekey_down == SDL_KEYDOWN && mouse_y < 480 - 1) + else if (mousekey_down == SDL_KEYDOWN && mouse_y < WINDOW_HEIGHT - 1) mouse_y = mouse_y + 8; if (mousekey_left == SDL_KEYDOWN && mouse_x > 0) mouse_x = mouse_x - 8; - if (mousekey_right == SDL_KEYDOWN && mouse_x < 640 - 1) + if (mousekey_right == SDL_KEYDOWN && mouse_x < WINDOW_WIDTH - 1) mouse_x = mouse_x + 8; SDL_WarpMouse(mouse_x, mouse_y);