Scrollbar in Stamps display now works, with new Stamp Control buttons below.

This commit is contained in:
William Kendrick 2003-09-28 07:50:41 +00:00
parent fa1fe602ce
commit a5c75316d0

View file

@ -804,7 +804,7 @@ void mainloop(void)
line_start_x, line_start_y, w, h, shape_tool_mode, line_start_x, line_start_y, w, h, shape_tool_mode,
shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y; shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y;
int num_things, thing_scroll, cur_thing, old_thing, do_draw, old_tool, int num_things, thing_scroll, cur_thing, old_thing, do_draw, old_tool,
tmp_int; tmp_int, max;
int cur_time, last_print_time, scrolling, ignoring_motion; int cur_time, last_print_time, scrolling, ignoring_motion;
SDL_TimerID scrolltimer; SDL_TimerID scrolltimer;
SDL_Event event; SDL_Event event;
@ -1451,7 +1451,12 @@ void mainloop(void)
do_draw = 0; do_draw = 0;
/* Deal with scrollbars: */ /* Deal with scroll buttons: */
max = 14;
if (cur_tool == TOOL_STAMP && !disable_stamp_controls)
max = 10;
if (num_things > 14 + TOOLOFFSET) if (num_things > 14 + TOOLOFFSET)
{ {
@ -1504,7 +1509,9 @@ void mainloop(void)
} }
} }
else if (event.button.y >= else if (event.button.y >=
(48 * (6 + TOOLOFFSET / 2)) + 40 + 24) (48 * ((max - 2) / 2 + TOOLOFFSET / 2)) + 40 + 24 &&
event.button.y <
(48 * ((max - 2) / 2 + TOOLOFFSET / 2)) + 40 + 24 + 24)
{ {
if (thing_scroll < num_things - 12 - TOOLOFFSET) if (thing_scroll < num_things - 12 - TOOLOFFSET)
{ {
@ -1559,9 +1566,10 @@ void mainloop(void)
} }
if (event.button.y > 40 + off_y && if (event.button.y > 40 + off_y &&
event.button.y < event.button.y <
(48 * (7 + TOOLOFFSET / 2)) + 40 - off_y) (48 * ((max / 2) + TOOLOFFSET / 2)) + 40 - off_y)
{ {
which = ((event.button.y - 40 - off_y) / 48) * 2 + which = ((event.button.y - 40 - off_y) / 48) * 2 +
((event.button.x - (WINDOW_WIDTH - 96)) / 48) + ((event.button.x - (WINDOW_WIDTH - 96)) / 48) +
@ -1970,9 +1978,15 @@ void mainloop(void)
do_draw = 0; do_draw = 0;
/* Deal with scrollbars: */
if (num_things > 14 + TOOLOFFSET) /* Deal with scroll wheels: */
max = 14;
if (cur_tool == TOOL_STAMP && !disable_stamp_controls)
max = 10;
if (num_things > max + TOOLOFFSET)
{ {
if (event.button.button == 4) if (event.button.button == 4)
{ {
@ -1993,7 +2007,7 @@ void mainloop(void)
{ {
/* Wheelmouse - DOWN "button" */ /* Wheelmouse - DOWN "button" */
if (thing_scroll < num_things - 12) if (thing_scroll < num_things - (max - 2))
{ {
thing_scroll = thing_scroll + 2; thing_scroll = thing_scroll + 2;
do_draw = 1; do_draw = 1;
@ -2012,7 +2026,9 @@ void mainloop(void)
off_y = 0; off_y = 0;
} }
} }
/* Assign the change(s), if any / redraw, if needed: */
/* Assign the change(s), if any / redraw, if needed: */
if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES) if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES)
{ {
@ -2301,7 +2317,12 @@ void mainloop(void)
} }
if (num_things > 14 + TOOLOFFSET) max = 14;
if (cur_tool == TOOL_STAMP && !disable_stamp_controls)
max = 10;
if (num_things > max + TOOLOFFSET)
{ {
/* Are there scroll buttons? */ /* Are there scroll buttons? */
@ -2314,11 +2335,12 @@ void mainloop(void)
else else
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);
} }
else if (event.button.y > (48 * (6 + TOOLOFFSET / 2)) + 40 + 24) else if (event.button.y > (48 * ((max - 2) / 2 + TOOLOFFSET / 2)) + 40 + 24 &&
event.button.y <= (48 * ((max - 2) / 2 + TOOLOFFSET / 2)) + 40 + 24 + 24)
{ {
/* Down button; is it available? */ /* Down button; is it available? */
if (thing_scroll < num_things - 12) if (thing_scroll < num_things - (max - 2))
do_setcursor(cursor_down); do_setcursor(cursor_down);
else else
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);