1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00
This commit is contained in:
Jonas Fonseca 2006-05-21 19:50:20 +02:00 committed by Jonas Fonseca
commit 142c96f31c
5 changed files with 766 additions and 569 deletions

View File

@ -210,10 +210,19 @@ RULES_REC = $(addsuffix -recursive,$(RULES))
.PHONY: $(RULES) $(RULES_LOCAL) $(RULES_REC) $(addsuffix -default,$(RULES))
# The -recursive rules decend all subdirs.
# The -recursive rules descend all subdirs.
# If make -k was used and a sub-Make fails, then keep building the
# remaining subdirectories, but return an error at the end.
$(RULES_REC):
ifneq (,$(findstring k,$(MAKEFLAGS)))
@suberr=0; \
$(foreach subdir,$(sort $(SUBDIRS)), \
$(call ncmd,recmake,$(subdir),$(subst -recursive,,$@)) || suberr=1;) \
exit $$suberr
else
@$(foreach subdir,$(sort $(SUBDIRS)), \
$(call ncmd,recmake,$(subdir),$(subst -recursive,,$@)) || exit 1;)
endif
# Dummy -local rules
$(RULES_LOCAL):

1218
po/fi.po

File diff suppressed because it is too large Load Diff

View File

@ -61,6 +61,7 @@ static int m_submenu_len = sizeof(m_submenu) - 1;
static window_handler_T menu_handler;
static window_handler_T mainmenu_handler;
static void display_mainmenu(struct terminal *term, struct menu *menu);
static void set_menu_selection(struct menu *menu, int pos);
static inline int
@ -266,9 +267,14 @@ count_menu_size(struct terminal *term, struct menu *menu)
static void
scroll_menu(struct menu *menu, int steps, int wrap)
{
int height, scr_i, pos, start;
int pos, start;
int s = steps ? steps/abs(steps) : 1; /* Selectable item search direction. */
/* menu->selected sometimes became -2 and caused infinite loops.
* That should no longer be possible. */
assert(menu->selected >= -1);
if_assert_failed return;
if (menu->size <= 0) {
no_item:
/* Menu is empty. */
@ -279,7 +285,13 @@ no_item:
start = pos = menu->selected;
if (!steps) steps = 1, --pos;
if (!steps) {
/* The caller wants us to check that menu->selected is
* actually selectable, and correct it if not. */
steps = 1;
if (pos >= 0)
--pos;
}
while (steps) {
pos += s, steps -= s;
@ -314,6 +326,20 @@ no_item:
select_item:
if (!mi_is_selectable(&menu->items[pos]))
goto no_item;
set_menu_selection(menu, pos);
}
/* Set menu->selected = pos, and adjust menu->first if needed.
* This neither redraws the menu nor runs the item's action.
* The caller must ensure that menu->items[pos] is selectable. */
static void
set_menu_selection(struct menu *menu, int pos)
{
int height, scr_i;
assert(pos >= 0 && pos < menu->size);
assert(mi_is_selectable(&menu->items[pos]));
if_assert_failed return;
menu->selected = pos;
@ -595,8 +621,7 @@ menu_mouse_handler(struct menu *menu, struct term_event *ev)
if (sel >= 0 && sel < menu->size
&& mi_is_selectable(&menu->items[sel])) {
menu->selected = sel;
scroll_menu(menu, 0, 1);
set_menu_selection(menu, sel);
display_menu(win->term, menu);
select_menu(win->term, menu);
}
@ -654,7 +679,8 @@ search_menu_item(struct menu_item *item, unsigned char *buffer,
{
unsigned char *text, *match;
if (!mi_has_left_text(item)) return 0;
/* set_menu_selection asserts selectability. */
if (!mi_has_left_text(item) || !mi_is_selectable(item)) return 0;
text = mi_text_translate(item) ? _(item->text, term) : item->text;
@ -680,6 +706,7 @@ menu_search_handler(struct input_line *line, int action_id)
unsigned char *buffer = line->buffer;
struct window *win;
int pos = menu->selected;
int start;
int direction;
switch (action_id) {
@ -712,11 +739,12 @@ menu_search_handler(struct input_line *line, int action_id)
pos %= menu->size;
start = pos;
do {
struct menu_item *item = &menu->items[pos];
if (search_menu_item(item, buffer, term)) {
scroll_menu(menu, pos - menu->selected, 0);
set_menu_selection(menu, pos);
display_menu(term, menu);
return INPUT_LINE_PROCEED;
}
@ -725,7 +753,7 @@ menu_search_handler(struct input_line *line, int action_id)
if (pos == menu->size) pos = 0;
else if (pos < 0) pos = menu->size - 1;
} while (pos != menu->selected);
} while (pos != start);
return INPUT_LINE_CANCEL;
}
@ -851,8 +879,10 @@ menu_handler(struct window *win, struct term_event *ev)
case EVENT_REDRAW:
get_parent_ptr(win, &menu->parent_x, &menu->parent_y);
count_menu_size(win->term, menu);
menu->selected--;
scroll_menu(menu, 1, 1);
/* do_menu sets menu->selected = 0. If that
* item isn't actually selectable, correct
* menu->selected here. */
scroll_menu(menu, 0, 1);
display_menu(win->term, menu);
break;

View File

@ -350,23 +350,36 @@ update_depths(struct listbox_item *parent)
}
}
enum move_bookmark_flags {
MOVE_BOOKMARK_NONE = 0x00,
MOVE_BOOKMARK_MOVED = 0x01,
MOVE_BOOKMARK_CYCLE = 0x02
};
/* Traverse all bookmarks and move all marked items
* _into_ destb or, if destb is NULL, _after_ dest. */
static void
static enum move_bookmark_flags
do_move_bookmark(struct bookmark *dest, struct list_head *destb,
struct list_head *desti, struct list_head *src,
struct listbox_data *box)
{
static int move_bookmark_event_id = EVENT_NONE;
struct bookmark *bm, *next;
enum move_bookmark_flags result = MOVE_BOOKMARK_NONE;
assert((destb && desti) || (!destb && !desti));
set_event_id(move_bookmark_event_id, "bookmark-move");
foreachsafe (bm, next, *src) {
if (bm != dest /* prevent moving a folder into itself */
&& bm->box_item->marked && bm != move_cache_root_avoid) {
if (!bm->box_item->marked) {
/* Don't move this bookmark itself; but if
* it's a folder, then we'll look inside. */
} else if (bm == dest || bm == move_cache_root_avoid) {
/* Prevent moving a folder into itself. */
result |= MOVE_BOOKMARK_CYCLE;
} else {
result |= MOVE_BOOKMARK_MOVED;
bm->box_item->marked = 0;
trigger_event(move_bookmark_event_id, bm,
@ -411,9 +424,12 @@ do_move_bookmark(struct bookmark *dest, struct list_head *destb,
}
if (bm->box_item->type == BI_FOLDER) {
do_move_bookmark(dest, destb, desti, &bm->child, box);
result |= do_move_bookmark(dest, destb, desti,
&bm->child, box);
}
}
return result;
}
static widget_handler_status_T
@ -424,6 +440,7 @@ push_move_button(struct dialog_data *dlg_data,
struct bookmark *dest = NULL;
struct list_head *destb = NULL, *desti = NULL;
struct widget_data *widget_data = dlg_data->widgets_data;
enum move_bookmark_flags result;
if (!box->sel) return EVENT_PROCESSED; /* nowhere to move to */
@ -444,14 +461,36 @@ push_move_button(struct dialog_data *dlg_data,
}
}
do_move_bookmark(dest, destb, desti, &bookmarks, box);
bookmarks_set_dirty();
result = do_move_bookmark(dest, destb, desti, &bookmarks, box);
if (result & MOVE_BOOKMARK_MOVED) {
bookmarks_set_dirty();
#ifdef BOOKMARKS_RESAVE
write_bookmarks();
write_bookmarks();
#endif
display_widget(dlg_data, widget_data);
display_widget(dlg_data, widget_data); /* the hierbox */
} else if (result & MOVE_BOOKMARK_CYCLE) {
/* If the user also selected other bookmarks, then
* they have already been moved, and this box doesn't
* appear. */
info_box(dlg_data->win->term, 0,
N_("Cannot move folder inside itself"), ALIGN_LEFT,
N_("You are trying to move the marked folder inside "
"itself. To move the folder to a different "
"location select the new location before pressing "
"the Move button."));
} else {
info_box(dlg_data->win->term, 0,
N_("Nothing to move"), ALIGN_LEFT,
N_("To move bookmarks, first mark all the bookmarks "
"(or folders) you want to move. This can be done "
"with the Insert key if you're using the default "
"key-bindings. An asterisk will appear near all "
"marked bookmarks. Now move to where you want to "
"have the stuff moved to, and press the \"Move\" "
"button."));
}
return EVENT_PROCESSED;
}

View File

@ -429,6 +429,7 @@ set_server(struct dialog_data *dlg_data, struct widget_data *widget_data)
static widget_handler_status_T
push_add_server_button(struct dialog_data *dlg_data, struct widget_data *button)
{
/* [gettext_accelerator_context(.push_add_server_button)] */
#define SERVER_WIDGETS_COUNT 3
struct terminal *term = dlg_data->win->term;
struct dialog *dlg;