static void scroll_to_last_line (void) { int exp_size = get_num_expanded_data_rows (); int scrll = 0, offset = 0; if (!gscroll.expanded) gscroll.dash = dash->total_alloc - real_size_y; else { scrll = dash->module[gscroll.current].idx_data - 1; if (scrll >= exp_size && scrll >= offset + exp_size) offset = scrll < exp_size - 1 ? 0 : scrll - exp_size + 1; gscroll.module[gscroll.current].scroll = scrll; gscroll.module[gscroll.current].offset = offset; } }
static void scroll_down_expanded_module (void) { int exp_size = get_num_expanded_data_rows (); int *scroll_ptr, *offset_ptr; scroll_ptr = &gscroll.module[gscroll.current].scroll; offset_ptr = &gscroll.module[gscroll.current].offset; if (!gscroll.expanded) return; if (*scroll_ptr >= dash->module[gscroll.current].idx_data - 1) return; ++(*scroll_ptr); if (*scroll_ptr >= exp_size && *scroll_ptr >= *offset_ptr + exp_size) ++(*offset_ptr); }
static void page_up_module (void) { int exp_size = get_num_expanded_data_rows (); int *scroll_ptr, *offset_ptr; scroll_ptr = &gscroll.module[gscroll.current].scroll; offset_ptr = &gscroll.module[gscroll.current].offset; if (!gscroll.expanded) return; /* decrease scroll and offset by exp_size */ *scroll_ptr -= exp_size; if (*scroll_ptr < 0) *scroll_ptr = 0; if (*scroll_ptr < *offset_ptr) *offset_ptr -= exp_size; if (*offset_ptr <= 0) *offset_ptr = 0; }
static void page_down_module (void) { int exp_size = get_num_expanded_data_rows (); int *scroll_ptr, *offset_ptr; scroll_ptr = &gscroll.module[gscroll.current].scroll; offset_ptr = &gscroll.module[gscroll.current].offset; if (!gscroll.expanded) return; *scroll_ptr += exp_size; if (*scroll_ptr >= dash->module[gscroll.current].idx_data - 1) *scroll_ptr = dash->module[gscroll.current].idx_data - 1; if (*scroll_ptr >= exp_size && *scroll_ptr >= *offset_ptr + exp_size) *offset_ptr += exp_size; if (*offset_ptr + exp_size >= dash->module[gscroll.current].idx_data - 1) *offset_ptr = dash->module[gscroll.current].idx_data - exp_size; if (*scroll_ptr < exp_size - 1) *offset_ptr = 0; }
/* set search gscroll */ static void perform_find_dash_scroll (GScroll * gscroll, GModule module) { int *scrll, *offset; int exp_size = get_num_expanded_data_rows (); /* reset gscroll offsets if we are changing module */ if (gscroll->current != module) reset_scroll_offsets (gscroll); scrll = &gscroll->module[module].scroll; offset = &gscroll->module[module].offset; (*scrll) = find_t.next_idx; if (*scrll >= exp_size && *scrll >= *offset + exp_size) (*offset) = (*scrll) < exp_size - 1 ? 0 : (*scrll) - exp_size + 1; gscroll->current = module; gscroll->dash = module * DASH_COLLAPSED; gscroll->expanded = 1; find_t.module = module; }