Lines Matching full:list

82 } LIST;  typedef
90 init_list(LIST * list, WINDOW *par, WINDOW *win, int mousex) in init_list() argument
92 list->par = par; in init_list()
93 list->win = win; in init_list()
94 list->length = 0; in init_list()
95 list->offset = 0; in init_list()
96 list->choice = 0; in init_list()
97 list->mousex = mousex; in init_list()
98 list->allocd = 0; in init_list()
99 list->data = 0; in init_list()
117 data_of(LIST * list) in data_of() argument
119 if (list != 0 in data_of()
120 && list->data != 0) in data_of()
121 return list->data[list->choice]; in data_of()
126 free_list(LIST * list, int reinit) in free_list() argument
128 if (list->data != 0) { in free_list()
131 for (n = 0; list->data[n] != 0; n++) in free_list()
132 free(list->data[n]); in free_list()
133 free(list->data); in free_list()
134 list->data = 0; in free_list()
137 init_list(list, list->par, list->win, list->mousex); in free_list()
141 add_to_list(LIST * list, char *text) in add_to_list() argument
145 need = (unsigned) (list->length + 1); in add_to_list()
146 if (need + 1 > list->allocd) { in add_to_list()
147 list->allocd = 2 * (need + 1); in add_to_list()
148 if (list->data == 0) { in add_to_list()
149 list->data = dlg_malloc(char *, list->allocd); in add_to_list()
151 list->data = dlg_realloc(char *, list->allocd, list->data); in add_to_list()
153 assert_ptr(list->data, "add_to_list"); in add_to_list()
155 list->data[list->length++] = dlg_strclone(text); in add_to_list()
156 list->data[list->length] = 0; in add_to_list()
160 keep_visible(LIST * list) in keep_visible() argument
162 int high = getmaxy(list->win); in keep_visible()
164 if (list->choice < list->offset) { in keep_visible()
165 list->offset = list->choice; in keep_visible()
167 if (list->choice - list->offset >= high) in keep_visible()
168 list->offset = list->choice - high + 1; in keep_visible()
174 find_choice(char *target, LIST * list) in find_choice() argument
176 int choice = list->choice; in find_choice()
179 list->choice = 0; in find_choice()
190 for (n = 0; n < list->length; n++) { in find_choice()
192 char *b = list->data[n]; in find_choice()
208 list->choice = n; in find_choice()
212 if (choice != list->choice) { in find_choice()
213 keep_visible(list); in find_choice()
215 return (choice != list->choice); in find_choice()
219 display_list(LIST * list) in display_list() argument
221 if (list->win != 0) { in display_list()
228 dlg_attr_clear(list->win, getmaxy(list->win), getmaxx(list->win), item_attr); in display_list()
229 for (n = list->offset; n < list->length && list->data[n]; n++) { in display_list()
230 y = n - list->offset; in display_list()
231 if (y >= getmaxy(list->win)) in display_list()
233 (void) wmove(list->win, y, 0); in display_list()
234 if (n == list->choice) in display_list()
235 dlg_attrset(list->win, item_selected_attr); in display_list()
236 (void) waddstr(list->win, list->data[n]); in display_list()
237 dlg_attrset(list->win, item_attr); in display_list()
239 dlg_attrset(list->win, item_attr); in display_list()
241 getparyx(list->win, y, x); in display_list()
244 bottom = y + getmaxy(list->win); in display_list()
245 dlg_draw_scrollbar(list->par, in display_list()
246 (long) list->offset, in display_list()
247 (long) list->offset, in display_list()
248 (long) (list->offset + getmaxy(list->win)), in display_list()
249 (long) (list->length), in display_list()
251 x + getmaxx(list->win), in display_list()
257 (void) wmove(list->win, list->choice - list->offset, 0); in display_list()
258 (void) wnoutrefresh(list->win); in display_list()
271 fix_arrows(LIST * list) in fix_arrows() argument
273 if (list->win != 0) { in fix_arrows()
280 getparyx(list->win, y, x); in fix_arrows()
282 right = getmaxx(list->win); in fix_arrows()
283 bottom = y + getmaxy(list->win); in fix_arrows()
286 ((list->mousex == MOUSE_D) in fix_arrows()
290 ((list->mousex == MOUSE_D) in fix_arrows()
297 #define fix_arrows(list) /* nothing */ argument
301 show_list(char *target, LIST * list, bool keep) in show_list() argument
303 bool changed = keep || find_choice(target, list); in show_list()
304 display_list(list); in show_list()
309 * Highlight the closest match to 'target' in the given list, setting offset
313 show_both_lists(char *input, LIST * d_list, LIST * f_list, bool keep) in show_both_lists()
321 * Move up/down in the given list
324 change_list(int choice, LIST * list) in change_list() argument
326 if (data_of(list) != 0) { in change_list()
327 int last = list->length - 1; in change_list()
329 choice += list->choice; in change_list()
334 list->choice = choice; in change_list()
335 keep_visible(list); in change_list()
336 display_list(list); in change_list()
343 scroll_list(int direction, LIST * list) in scroll_list() argument
345 if (data_of(list) != 0) { in scroll_list()
346 int length = getmaxy(list->win); in scroll_list()
347 if (change_list(direction * length, list)) in scroll_list()
360 match(char *name, LIST * d_list, LIST * f_list, MATCH * match_list) in match()
401 complete(char *name, LIST * d_list, LIST * f_list, char **buff_ptr) in complete()
452 fill_lists(char *current, char *input, LIST * d_list, LIST * f_list, bool keep) in fill_lists()
539 usable_state(int state, LIST * dirs, LIST * files) in usable_state()
628 LIST d_list, f_list; in dlg_fselect()