mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
Move widget add/del API from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
6eedbce076
commit
22ad70ed02
@ -761,127 +761,6 @@ dlg_erase (WDialog * h)
|
||||
tty_fill_region (wh->y, wh->x, wh->lines, wh->cols, ' ');
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Insert widget to dialog before requested widget. Make the widget current. Return widget ID.
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const void *before)
|
||||
{
|
||||
WGroup *g = GROUP (h);
|
||||
Widget *wh = WIDGET (h);
|
||||
Widget *widget;
|
||||
GList *new_current;
|
||||
|
||||
/* Don't accept 0 widgets */
|
||||
if (w == NULL)
|
||||
abort ();
|
||||
|
||||
widget = WIDGET (w);
|
||||
|
||||
if ((pos_flags & WPOS_CENTER_HORZ) != 0)
|
||||
widget->x = (wh->cols - widget->cols) / 2;
|
||||
widget->x += wh->x;
|
||||
|
||||
if ((pos_flags & WPOS_CENTER_VERT) != 0)
|
||||
widget->y = (wh->lines - widget->lines) / 2;
|
||||
widget->y += wh->y;
|
||||
|
||||
widget->owner = g;
|
||||
widget->pos_flags = pos_flags;
|
||||
widget->id = h->widget_id++;
|
||||
|
||||
if (g->widgets == NULL || before == NULL)
|
||||
{
|
||||
g->widgets = g_list_append (g->widgets, widget);
|
||||
new_current = g_list_last (g->widgets);
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *b;
|
||||
|
||||
b = g_list_find (g->widgets, before);
|
||||
|
||||
/* don't accept widget not from dialog. This shouldn't happen */
|
||||
if (b == NULL)
|
||||
abort ();
|
||||
|
||||
b = g_list_next (b);
|
||||
g->widgets = g_list_insert_before (g->widgets, b, widget);
|
||||
if (b != NULL)
|
||||
new_current = g_list_previous (b);
|
||||
else
|
||||
new_current = g_list_last (g->widgets);
|
||||
}
|
||||
|
||||
/* widget has been added at runtime */
|
||||
if (widget_get_state (wh, WST_ACTIVE))
|
||||
{
|
||||
send_message (widget, NULL, MSG_INIT, 0, NULL);
|
||||
widget_select (widget);
|
||||
}
|
||||
else
|
||||
g->current = new_current;
|
||||
|
||||
return widget->id;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/** wrapper to simply add lefttop positioned controls */
|
||||
|
||||
unsigned long
|
||||
add_widget (WDialog * h, void *w)
|
||||
{
|
||||
WGroup *g = GROUP (h);
|
||||
|
||||
return add_widget_autopos (h, w, WPOS_KEEP_DEFAULT,
|
||||
g->current != NULL ? g->current->data : NULL);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
unsigned long
|
||||
add_widget_before (WDialog * h, void *w, void *before)
|
||||
{
|
||||
return add_widget_autopos (h, w, WPOS_KEEP_DEFAULT, before);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/** delete widget from dialog */
|
||||
void
|
||||
del_widget (void *w)
|
||||
{
|
||||
WGroup *g;
|
||||
WDialog *h;
|
||||
GList *d;
|
||||
|
||||
/* Don't accept NULL widget. This shouldn't happen */
|
||||
if (w == NULL)
|
||||
abort ();
|
||||
|
||||
g = WIDGET (w)->owner;
|
||||
h = DIALOG (g);
|
||||
|
||||
d = g_list_find (g->widgets, w);
|
||||
if (d == g->current)
|
||||
group_set_current_widget_next (g);
|
||||
|
||||
g->widgets = g_list_remove_link (g->widgets, d);
|
||||
if (g->widgets == NULL)
|
||||
g->current = NULL;
|
||||
|
||||
/* widget has been deleted in runtime */
|
||||
if (widget_get_state (WIDGET (h), WST_ACTIVE))
|
||||
{
|
||||
dlg_draw (h);
|
||||
group_select_current_widget (g);
|
||||
}
|
||||
|
||||
WIDGET (w)->owner = NULL;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
|
@ -75,7 +75,6 @@ struct WDialog
|
||||
int mouse_status; /* For the autorepeat status of the mouse */
|
||||
|
||||
/* Internal variables */
|
||||
unsigned long widget_id; /* maximum id of all widgets */
|
||||
void *data; /* Data can be passed to dialog */
|
||||
char *event_group; /* Name of event group for this dialog */
|
||||
|
||||
@ -110,12 +109,6 @@ WDialog *dlg_create (gboolean modal, int y1, int x1, int lines, int cols,
|
||||
|
||||
void dlg_set_default_colors (void);
|
||||
|
||||
unsigned long add_widget_autopos (WDialog * dest, void *w, widget_pos_flags_t pos_flags,
|
||||
const void *before);
|
||||
unsigned long add_widget (WDialog * dest, void *w);
|
||||
unsigned long add_widget_before (WDialog * h, void *w, void *before);
|
||||
void del_widget (void *w);
|
||||
|
||||
/* sets size of dialog, leaving positioning to automatic mehtods
|
||||
according to dialog flags */
|
||||
void dlg_set_size (WDialog * h, int lines, int cols);
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -103,6 +104,110 @@ group_select_next_or_prev (WGroup * g, gboolean next)
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Insert widget to group before specified widget with specified positioning.
|
||||
* Make the inserted widget current.
|
||||
*
|
||||
* @param g WGroup object
|
||||
* @param w widget to be added
|
||||
* @pos positioning flags
|
||||
* @param before add @w before this widget
|
||||
*
|
||||
* @return widget ID
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
group_add_widget_autopos (WGroup * g, void *w, widget_pos_flags_t pos_flags, const void *before)
|
||||
{
|
||||
Widget *wg = WIDGET (g);
|
||||
Widget *ww = WIDGET (w);
|
||||
GList *new_current;
|
||||
|
||||
/* Don't accept NULL widget. This shouldn't happen */
|
||||
assert (ww != NULL);
|
||||
|
||||
if ((pos_flags & WPOS_CENTER_HORZ) != 0)
|
||||
ww->x = (wg->cols - ww->cols) / 2;
|
||||
ww->x += wg->x;
|
||||
|
||||
if ((pos_flags & WPOS_CENTER_VERT) != 0)
|
||||
ww->y = (wg->lines - ww->lines) / 2;
|
||||
ww->y += wg->y;
|
||||
|
||||
ww->owner = g;
|
||||
ww->pos_flags = pos_flags;
|
||||
ww->id = g->widget_id++;
|
||||
|
||||
if (g->widgets == NULL || before == NULL)
|
||||
{
|
||||
g->widgets = g_list_append (g->widgets, ww);
|
||||
new_current = g_list_last (g->widgets);
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *b;
|
||||
|
||||
b = g_list_find (g->widgets, before);
|
||||
|
||||
/* don't accept widget not from group. This shouldn't happen */
|
||||
assert (b != NULL);
|
||||
|
||||
b = g_list_next (b);
|
||||
g->widgets = g_list_insert_before (g->widgets, b, ww);
|
||||
if (b != NULL)
|
||||
new_current = g_list_previous (b);
|
||||
else
|
||||
new_current = g_list_last (g->widgets);
|
||||
}
|
||||
|
||||
/* widget has been added at runtime */
|
||||
if (widget_get_state (wg, WST_ACTIVE))
|
||||
{
|
||||
send_message (ww, NULL, MSG_INIT, 0, NULL);
|
||||
widget_select (ww);
|
||||
}
|
||||
else
|
||||
g->current = new_current;
|
||||
|
||||
return ww->id;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Delete widget from group.
|
||||
*
|
||||
* @param w Widget object
|
||||
*/
|
||||
void
|
||||
group_del_widget (void *w)
|
||||
{
|
||||
WGroup *g;
|
||||
GList *d;
|
||||
|
||||
/* Don't accept NULL widget. This shouldn't happen */
|
||||
assert (w != NULL);
|
||||
|
||||
g = WIDGET (w)->owner;
|
||||
|
||||
d = g_list_find (g->widgets, w);
|
||||
if (d == g->current)
|
||||
group_set_current_widget_next (g);
|
||||
|
||||
g->widgets = g_list_remove_link (g->widgets, d);
|
||||
if (g->widgets == NULL)
|
||||
g->current = NULL;
|
||||
|
||||
/* widget has been deleted at runtime */
|
||||
if (widget_get_state (WIDGET (g), WST_ACTIVE))
|
||||
{
|
||||
dlg_draw (DIALOG (g)); /* FIXME */
|
||||
group_select_current_widget (g);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Switch current widget to widget after current in group.
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ struct WGroup
|
||||
GList *widgets; /* widgets list */
|
||||
GList *current; /* Currently active widget */
|
||||
|
||||
unsigned long widget_id; /* maximum id of all widgets */
|
||||
gboolean winch_pending; /* SIGWINCH signal has been got. Resize group after rise */
|
||||
};
|
||||
|
||||
@ -37,6 +38,10 @@ struct WGroup
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
unsigned long group_add_widget_autopos (WGroup * g, void *w, widget_pos_flags_t pos_flags,
|
||||
const void *before);
|
||||
void group_del_widget (void *w);
|
||||
|
||||
void group_set_current_widget_next (WGroup * g);
|
||||
void group_set_current_widget_prev (WGroup * g);
|
||||
|
||||
@ -53,9 +58,43 @@ void group_select_widget_by_id (const WGroup * g, unsigned long id);
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Select current widget in the group.
|
||||
* Add widget to group before current widget.
|
||||
*
|
||||
* @param g WGroup object
|
||||
* @param w widget to be added
|
||||
*
|
||||
* @return widget ID
|
||||
*/
|
||||
|
||||
static inline unsigned long
|
||||
group_add_widget (WGroup * g, void *w)
|
||||
{
|
||||
return group_add_widget_autopos (g, w, WPOS_KEEP_DEFAULT,
|
||||
g->current != NULL ? g->current->data : NULL);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Add widget to group before specified widget.
|
||||
*
|
||||
* @param g WGroup object
|
||||
* @param w widget to be added
|
||||
* @param before add @w before this widget
|
||||
*
|
||||
* @return widget ID
|
||||
*/
|
||||
|
||||
static inline unsigned long
|
||||
group_add_widget_before (WGroup * g, void *w, void *before)
|
||||
{
|
||||
return group_add_widget_autopos (g, w, WPOS_KEEP_DEFAULT, before);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Select current widget in the Dialog.
|
||||
*
|
||||
* @param h WDialog object
|
||||
*/
|
||||
|
||||
static inline void
|
||||
|
@ -230,7 +230,7 @@ history_show (history_descriptor_t * hd)
|
||||
|
||||
/* this call makes list stick to all sides of dialog, effectively make
|
||||
it be resized with dialog */
|
||||
add_widget_autopos (query_dlg, hd->listbox, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (GROUP (query_dlg), hd->listbox, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
/* to avoid diplicating of (calculating sizes in two places)
|
||||
code, call history_dlg_callback function here, to set dialog and
|
||||
|
@ -1268,7 +1268,7 @@ complete_engine (WInput * in, int what_to_do)
|
||||
query_dlg = dlg_create (TRUE, y, x, query_height, query_width, WPOS_KEEP_DEFAULT, TRUE,
|
||||
dialog_colors, query_callback, NULL, "[Completion]", NULL);
|
||||
query_list = listbox_new (1, 1, h - 2, w - 2, FALSE, NULL);
|
||||
add_widget (query_dlg, query_list);
|
||||
group_add_widget (GROUP (query_dlg), query_list);
|
||||
|
||||
for (p = in->completions + 1; *p != NULL; p++)
|
||||
listbox_add_item (query_list, LISTBOX_APPEND_AT_END, 0, *p, NULL, FALSE);
|
||||
|
@ -109,7 +109,7 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
|
||||
NULL, NULL, help, title);
|
||||
|
||||
listbox->list = listbox_new (2, 2, lines, cols, FALSE, NULL);
|
||||
add_widget (listbox->dlg, listbox->list);
|
||||
group_add_widget (GROUP (listbox->dlg), listbox->list);
|
||||
|
||||
return listbox;
|
||||
}
|
||||
|
@ -564,7 +564,8 @@ quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
|
||||
/* add widget into dialog */
|
||||
item->widget->options |= item->quick_widget->options; /* FIXME: cannot reset flags, setup only */
|
||||
item->widget->state |= item->quick_widget->state; /* FIXME: cannot reset flags, setup only */
|
||||
id = add_widget_autopos (dd, item->widget, item->quick_widget->pos_flags, NULL);
|
||||
id = group_add_widget_autopos (GROUP (dd), item->widget, item->quick_widget->pos_flags,
|
||||
NULL);
|
||||
if (item->quick_widget->id != NULL)
|
||||
*item->quick_widget->id = id;
|
||||
}
|
||||
|
@ -273,6 +273,7 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
||||
{
|
||||
va_list ap;
|
||||
WDialog *query_dlg;
|
||||
WGroup *g;
|
||||
WButton *button;
|
||||
int win_len = 0;
|
||||
int i;
|
||||
@ -291,6 +292,7 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
char *cp = va_arg (ap, char *);
|
||||
|
||||
win_len += str_term_width1 (cp) + 6;
|
||||
if (strchr (cp, '&') != NULL)
|
||||
win_len--;
|
||||
@ -307,14 +309,15 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
||||
query_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, pos_flags, FALSE, query_colors, query_default_callback,
|
||||
NULL, "[QueryBox]", header);
|
||||
g = GROUP (query_dlg);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
WButton *defbutton = NULL;
|
||||
|
||||
add_widget_autopos (query_dlg, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
|
||||
NULL);
|
||||
add_widget (query_dlg, hline_new (lines - 4, -1, -1));
|
||||
group_add_widget_autopos (g, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
|
||||
NULL);
|
||||
group_add_widget (g, hline_new (lines - 4, -1, -1));
|
||||
|
||||
cols = (cols - win_len - 2) / 2 + 2;
|
||||
va_start (ap, count);
|
||||
@ -329,7 +332,7 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
||||
xpos--;
|
||||
|
||||
button = button_new (lines - 3, cols, B_USER + i, NORMAL_BUTTON, cur_name, NULL);
|
||||
add_widget (query_dlg, button);
|
||||
group_add_widget (g, button);
|
||||
cols += xpos;
|
||||
if (i == sel_pos)
|
||||
defbutton = button;
|
||||
@ -356,9 +359,9 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
||||
}
|
||||
else
|
||||
{
|
||||
add_widget_autopos (query_dlg, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
|
||||
NULL);
|
||||
add_widget (query_dlg, button_new (0, 0, 0, HIDDEN_BUTTON, "-", NULL));
|
||||
group_add_widget_autopos (g, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
|
||||
NULL);
|
||||
group_add_widget (g, button_new (0, 0, 0, HIDDEN_BUTTON, "-", NULL));
|
||||
last_query_dlg = query_dlg;
|
||||
}
|
||||
sel_pos = 0;
|
||||
@ -687,6 +690,7 @@ simple_status_msg_init_cb (status_msg_t * sm)
|
||||
{
|
||||
simple_status_msg_t *ssm = SIMPLE_STATUS_MSG (sm);
|
||||
Widget *wd = WIDGET (sm->dlg);
|
||||
WGroup *wg = GROUP (sm->dlg);
|
||||
|
||||
const char *b_name = N_("&Abort");
|
||||
int b_width;
|
||||
@ -702,10 +706,10 @@ simple_status_msg_init_cb (status_msg_t * sm)
|
||||
|
||||
y = 2;
|
||||
ssm->label = label_new (y++, 3, "");
|
||||
add_widget_autopos (sm->dlg, ssm->label, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||
add_widget (sm->dlg, hline_new (y++, -1, -1));
|
||||
group_add_widget_autopos (wg, ssm->label, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||
group_add_widget (wg, hline_new (y++, -1, -1));
|
||||
b = WIDGET (button_new (y++, 3, B_CANCEL, NORMAL_BUTTON, b_name, NULL));
|
||||
add_widget_autopos (sm->dlg, b, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||
group_add_widget_autopos (wg, b, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||
|
||||
widget_set_size (wd, wd->y, wd->x, y + 2, wd_width);
|
||||
}
|
||||
|
@ -3441,6 +3441,7 @@ diff_view (const char *file1, const char *file2, const char *label1, const char
|
||||
Widget *w;
|
||||
WDialog *dview_dlg;
|
||||
Widget *dw;
|
||||
WGroup *g;
|
||||
|
||||
/* Create dialog and widgets, put them on the dialog */
|
||||
dview_dlg =
|
||||
@ -3449,14 +3450,16 @@ diff_view (const char *file1, const char *file2, const char *label1, const char
|
||||
dw = WIDGET (dview_dlg);
|
||||
widget_want_tab (dw, TRUE);
|
||||
|
||||
g = GROUP (dview_dlg);
|
||||
|
||||
dview = g_new0 (WDiff, 1);
|
||||
w = WIDGET (dview);
|
||||
widget_init (w, dw->y, dw->x, dw->lines - 1, dw->cols, dview_callback, dview_mouse_callback);
|
||||
w->options |= WOP_SELECTABLE;
|
||||
add_widget_autopos (dview_dlg, w, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, w, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
w = WIDGET (buttonbar_new (TRUE));
|
||||
add_widget_autopos (dview_dlg, w, w->pos_flags, NULL);
|
||||
group_add_widget_autopos (g, w, w->pos_flags, NULL);
|
||||
|
||||
dview_dlg->get_title = dview_get_title;
|
||||
|
||||
|
@ -2268,7 +2268,7 @@ edit_close_cmd (WEdit * edit)
|
||||
if (edit->locked != 0)
|
||||
unlock_file (edit->filename_vpath);
|
||||
|
||||
del_widget (edit);
|
||||
group_del_widget (edit);
|
||||
widget_destroy (WIDGET (edit));
|
||||
|
||||
if (edit_widget_is_editor (CONST_WIDGET (g->current->data)))
|
||||
|
@ -311,6 +311,7 @@ editcmd_dialog_raw_key_query (const char *heading, const char *query, gboolean c
|
||||
int w, wq;
|
||||
int y = 2;
|
||||
WDialog *raw_dlg;
|
||||
WGroup *g;
|
||||
|
||||
w = str_term_width1 (heading) + 6;
|
||||
wq = str_term_width1 (query);
|
||||
@ -319,17 +320,19 @@ editcmd_dialog_raw_key_query (const char *heading, const char *query, gboolean c
|
||||
raw_dlg =
|
||||
dlg_create (TRUE, 0, 0, cancel ? 7 : 5, w, WPOS_CENTER | WPOS_TRYUP, FALSE, dialog_colors,
|
||||
editcmd_dialog_raw_key_query_cb, NULL, NULL, heading);
|
||||
g = GROUP (raw_dlg);
|
||||
widget_want_tab (WIDGET (raw_dlg), TRUE);
|
||||
|
||||
add_widget (raw_dlg, label_new (y, 3, query));
|
||||
add_widget (raw_dlg, input_new (y++, 3 + wq + 1, input_colors,
|
||||
w - (6 + wq + 1), "", 0, INPUT_COMPLETE_NONE));
|
||||
group_add_widget (g, label_new (y, 3, query));
|
||||
group_add_widget (g,
|
||||
input_new (y++, 3 + wq + 1, input_colors, w - (6 + wq + 1), "", 0,
|
||||
INPUT_COMPLETE_NONE));
|
||||
if (cancel)
|
||||
{
|
||||
add_widget (raw_dlg, hline_new (y++, -1, -1));
|
||||
group_add_widget (g, hline_new (y++, -1, -1));
|
||||
/* Button w/o hotkey to allow use any key as raw or macro one */
|
||||
add_widget_autopos (raw_dlg, button_new (y, 1, B_CANCEL, NORMAL_BUTTON, _("Cancel"), NULL),
|
||||
WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||
group_add_widget_autopos (g, button_new (y, 1, B_CANCEL, NORMAL_BUTTON, _("Cancel"), NULL),
|
||||
WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||
}
|
||||
|
||||
w = dlg_run (raw_dlg);
|
||||
@ -384,7 +387,7 @@ editcmd_dialog_completion_show (const WEdit * edit, int max_len, GString ** comp
|
||||
compl_list = listbox_new (1, 1, compl_dlg_h - 2, compl_dlg_w - 2, FALSE, NULL);
|
||||
|
||||
/* add the dialog */
|
||||
add_widget (compl_dlg, compl_list);
|
||||
group_add_widget (GROUP (compl_dlg), compl_list);
|
||||
|
||||
/* fill the listbox with the completions */
|
||||
for (i = num_compl - 1; i >= 0; i--) /* reverse order */
|
||||
@ -443,7 +446,7 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
|
||||
def_dlg = dlg_create (TRUE, start_y, start_x, def_dlg_h, def_dlg_w, WPOS_KEEP_DEFAULT, TRUE,
|
||||
dialog_colors, NULL, NULL, "[Definitions]", match_expr);
|
||||
def_list = listbox_new (1, 1, def_dlg_h - 2, def_dlg_w - 2, FALSE, NULL);
|
||||
add_widget (def_dlg, def_list);
|
||||
group_add_widget (GROUP (def_dlg), def_list);
|
||||
|
||||
/* fill the listbox with the completions */
|
||||
for (i = 0; i < num_lines; i++)
|
||||
|
@ -1192,6 +1192,7 @@ edit_files (const GList * files)
|
||||
{
|
||||
static gboolean made_directory = FALSE;
|
||||
WDialog *edit_dlg;
|
||||
WGroup *g;
|
||||
WMenuBar *menubar;
|
||||
Widget *w, *wd;
|
||||
const GList *file;
|
||||
@ -1224,13 +1225,15 @@ edit_files (const GList * files)
|
||||
edit_dlg->get_shortcut = edit_get_shortcut;
|
||||
edit_dlg->get_title = edit_get_title;
|
||||
|
||||
g = GROUP (edit_dlg);
|
||||
|
||||
menubar = menubar_new (NULL, TRUE);
|
||||
w = WIDGET (menubar);
|
||||
add_widget_autopos (edit_dlg, w, w->pos_flags, NULL);
|
||||
group_add_widget_autopos (g, w, w->pos_flags, NULL);
|
||||
edit_init_menu (menubar);
|
||||
|
||||
w = WIDGET (buttonbar_new (TRUE));
|
||||
add_widget_autopos (edit_dlg, w, w->pos_flags, NULL);
|
||||
group_add_widget_autopos (g, w, w->pos_flags, NULL);
|
||||
|
||||
for (file = files; file != NULL; file = g_list_next (file))
|
||||
{
|
||||
@ -1355,7 +1358,7 @@ edit_add_window (WDialog * h, int y, int x, int lines, int cols, const vfs_path_
|
||||
w->callback = edit_callback;
|
||||
w->mouse_callback = edit_mouse_callback;
|
||||
|
||||
add_widget_autopos (h, w, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (GROUP (h), w, WPOS_KEEP_ALL, NULL);
|
||||
edit_set_buttonbar (edit, find_buttonbar (h));
|
||||
dlg_draw (h);
|
||||
|
||||
|
@ -72,6 +72,7 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
|
||||
int res;
|
||||
char *curr = NULL;
|
||||
WDialog *sug_dlg;
|
||||
WGroup *g;
|
||||
WListbox *sug_list;
|
||||
int max_btn_len = 0;
|
||||
int replace_len;
|
||||
@ -111,22 +112,23 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
|
||||
|
||||
sug_dlg = dlg_create (TRUE, ypos, xpos, sug_dlg_h, sug_dlg_w, WPOS_KEEP_DEFAULT, TRUE,
|
||||
dialog_colors, NULL, NULL, "[ASpell]", _("Check word"));
|
||||
g = GROUP (sug_dlg);
|
||||
|
||||
add_widget (sug_dlg, label_new (1, 2, lang_label));
|
||||
add_widget (sug_dlg, label_new (3, 2, word_label));
|
||||
group_add_widget (g, label_new (1, 2, lang_label));
|
||||
group_add_widget (g, label_new (3, 2, word_label));
|
||||
|
||||
add_widget (sug_dlg, groupbox_new (4, 2, sug_dlg_h - 5, 25, _("Suggest")));
|
||||
group_add_widget (g, groupbox_new (4, 2, sug_dlg_h - 5, 25, _("Suggest")));
|
||||
|
||||
sug_list = listbox_new (5, 2, sug_dlg_h - 7, 24, FALSE, NULL);
|
||||
for (i = 0; i < suggest->len; i++)
|
||||
listbox_add_item (sug_list, LISTBOX_APPEND_AT_END, 0, g_array_index (suggest, char *, i),
|
||||
NULL, FALSE);
|
||||
add_widget (sug_dlg, sug_list);
|
||||
group_add_widget (g, sug_list);
|
||||
|
||||
add_widget (sug_dlg, add_btn);
|
||||
add_widget (sug_dlg, replace_btn);
|
||||
add_widget (sug_dlg, skip_btn);
|
||||
add_widget (sug_dlg, cancel_button);
|
||||
group_add_widget (g, add_btn);
|
||||
group_add_widget (g, replace_btn);
|
||||
group_add_widget (g, skip_btn);
|
||||
group_add_widget (g, cancel_button);
|
||||
|
||||
res = dlg_run (sug_dlg);
|
||||
if (res == B_ENTER)
|
||||
|
@ -589,7 +589,7 @@ user_group_button_cb (WButton * button, int action)
|
||||
listbox_select_entry (chl_list, fe);
|
||||
|
||||
b_pos = chl_list->pos;
|
||||
add_widget (chl_dlg, chl_list);
|
||||
group_add_widget (GROUP (chl_dlg), chl_list);
|
||||
|
||||
result = dlg_run (chl_dlg);
|
||||
|
||||
@ -725,6 +725,7 @@ advanced_chown_init (void)
|
||||
{
|
||||
gboolean single_set;
|
||||
WDialog *ch_dlg;
|
||||
WGroup *ch_grp;
|
||||
int lines = 12;
|
||||
int cols = 74;
|
||||
int i;
|
||||
@ -741,67 +742,66 @@ advanced_chown_init (void)
|
||||
ch_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors,
|
||||
advanced_chown_callback, NULL, "[Advanced Chown]", _("Chown advanced command"));
|
||||
|
||||
ch_grp = GROUP (ch_dlg);
|
||||
|
||||
l_filename = label_new (2, 3, "");
|
||||
add_widget (ch_dlg, l_filename);
|
||||
group_add_widget (ch_grp, l_filename);
|
||||
|
||||
add_widget (ch_dlg, hline_new (3, -1, -1));
|
||||
group_add_widget (ch_grp, hline_new (3, -1, -1));
|
||||
|
||||
#define XTRACT(i,y,cb) y, BX+advanced_chown_but[i].x, \
|
||||
advanced_chown_but[i].ret_cmd, advanced_chown_but[i].flags, \
|
||||
(advanced_chown_but[i].text), cb
|
||||
b_att[0] = perm_button_new (XTRACT (0, BY, NULL));
|
||||
advanced_chown_but[0].id = add_widget (ch_dlg, b_att[0]);
|
||||
advanced_chown_but[0].id = group_add_widget (ch_grp, b_att[0]);
|
||||
b_att[1] = perm_button_new (XTRACT (1, BY, NULL));
|
||||
advanced_chown_but[1].id = add_widget (ch_dlg, b_att[1]);
|
||||
advanced_chown_but[1].id = group_add_widget (ch_grp, b_att[1]);
|
||||
b_att[2] = perm_button_new (XTRACT (2, BY, NULL));
|
||||
advanced_chown_but[2].id = add_widget (ch_dlg, b_att[2]);
|
||||
advanced_chown_but[2].id = group_add_widget (ch_grp, b_att[2]);
|
||||
b_user = button_new (XTRACT (3, BY, user_group_button_cb));
|
||||
advanced_chown_but[3].id = add_widget (ch_dlg, b_user);
|
||||
advanced_chown_but[3].id = group_add_widget (ch_grp, b_user);
|
||||
b_group = button_new (XTRACT (4, BY, user_group_button_cb));
|
||||
advanced_chown_but[4].id = add_widget (ch_dlg, b_group);
|
||||
#undef XTRACT
|
||||
advanced_chown_but[4].id = group_add_widget (ch_grp, b_group);
|
||||
|
||||
l_mode = label_new (BY + 2, 3, "");
|
||||
add_widget (ch_dlg, l_mode);
|
||||
group_add_widget (ch_grp, l_mode);
|
||||
|
||||
y = BY + 3;
|
||||
if (!single_set)
|
||||
{
|
||||
i = BUTTONS_PERM;
|
||||
add_widget (ch_dlg, hline_new (y++, -1, -1));
|
||||
advanced_chown_but[i].id = add_widget (ch_dlg,
|
||||
button_new (y,
|
||||
WIDGET (ch_dlg)->cols / 2 -
|
||||
advanced_chown_but[i].len,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
group_add_widget (ch_grp, hline_new (y++, -1, -1));
|
||||
advanced_chown_but[i].id = group_add_widget (ch_grp,
|
||||
button_new (y,
|
||||
WIDGET (ch_dlg)->cols / 2 -
|
||||
advanced_chown_but[i].len,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
i++;
|
||||
advanced_chown_but[i].id = add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 + 1,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
advanced_chown_but[i].id = group_add_widget (ch_grp,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 + 1,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
y++;
|
||||
}
|
||||
|
||||
i = BUTTONS_PERM + 2;
|
||||
add_widget (ch_dlg, hline_new (y++, -1, -1));
|
||||
advanced_chown_but[i].id = add_widget (ch_dlg,
|
||||
button_new (y,
|
||||
WIDGET (ch_dlg)->cols / 2 -
|
||||
advanced_chown_but[i].len,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
group_add_widget (ch_grp, hline_new (y++, -1, -1));
|
||||
advanced_chown_but[i].id = group_add_widget (ch_grp,
|
||||
button_new (y,
|
||||
WIDGET (ch_dlg)->cols / 2 -
|
||||
advanced_chown_but[i].len,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
i++;
|
||||
advanced_chown_but[i].id = add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 + 1,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
advanced_chown_but[i].id = group_add_widget (ch_grp,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 + 1,
|
||||
advanced_chown_but[i].ret_cmd,
|
||||
advanced_chown_but[i].flags,
|
||||
advanced_chown_but[i].text, NULL));
|
||||
|
||||
widget_select (WIDGET (b_att[0]));
|
||||
|
||||
|
@ -250,7 +250,7 @@ sel_skin_button (WButton * button, int action)
|
||||
}
|
||||
|
||||
/* make list stick to all sides of dialog, effectively make it be resized with dialog */
|
||||
add_widget_autopos (skin_dlg, skin_list, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (GROUP (skin_dlg), skin_list, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
result = dlg_run (skin_dlg);
|
||||
if (result == B_ENTER)
|
||||
@ -1024,6 +1024,7 @@ tree_box (const char *current_dir)
|
||||
{
|
||||
WTree *mytree;
|
||||
WDialog *dlg;
|
||||
WGroup *g;
|
||||
Widget *wd;
|
||||
char *val = NULL;
|
||||
WButtonBar *bar;
|
||||
@ -1033,13 +1034,14 @@ tree_box (const char *current_dir)
|
||||
/* Create the components */
|
||||
dlg = dlg_create (TRUE, 0, 0, LINES - 9, COLS - 20, WPOS_CENTER, FALSE, dialog_colors,
|
||||
tree_callback, NULL, "[Directory Tree]", _("Directory tree"));
|
||||
g = GROUP (dlg);
|
||||
wd = WIDGET (dlg);
|
||||
|
||||
mytree = tree_new (2, 2, wd->lines - 6, wd->cols - 5, FALSE);
|
||||
add_widget_autopos (dlg, mytree, WPOS_KEEP_ALL, NULL);
|
||||
add_widget_autopos (dlg, hline_new (wd->lines - 4, 1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, mytree, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, hline_new (wd->lines - 4, 1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
bar = buttonbar_new (TRUE);
|
||||
add_widget (dlg, bar);
|
||||
group_add_widget (g, bar);
|
||||
/* restore ButtonBar coordinates after add_widget() */
|
||||
WIDGET (bar)->x = 0;
|
||||
WIDGET (bar)->y = LINES - 1;
|
||||
@ -1232,6 +1234,7 @@ jobs_box (void)
|
||||
const size_t n_but = G_N_ELEMENTS (job_but);
|
||||
|
||||
WDialog *jobs_dlg;
|
||||
WGroup *g;
|
||||
int cols = 60;
|
||||
int lines = 15;
|
||||
int x = 0;
|
||||
@ -1253,19 +1256,19 @@ jobs_box (void)
|
||||
|
||||
jobs_dlg = dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, NULL, NULL,
|
||||
"[Background jobs]", _("Background jobs"));
|
||||
g = GROUP (jobs_dlg);
|
||||
|
||||
bg_list = listbox_new (2, 2, lines - 6, cols - 6, FALSE, NULL);
|
||||
jobs_fill_listbox (bg_list);
|
||||
add_widget (jobs_dlg, bg_list);
|
||||
group_add_widget (g, bg_list);
|
||||
|
||||
add_widget (jobs_dlg, hline_new (lines - 4, -1, -1));
|
||||
group_add_widget (g, hline_new (lines - 4, -1, -1));
|
||||
|
||||
x = (cols - x) / 2;
|
||||
for (i = 0; i < n_but; i++)
|
||||
{
|
||||
add_widget (jobs_dlg,
|
||||
button_new (lines - 3, x, job_but[i].value, job_but[i].flags, job_but[i].name,
|
||||
job_but[i].callback));
|
||||
group_add_widget (g, button_new (lines - 3, x, job_but[i].value, job_but[i].flags,
|
||||
job_but[i].name, job_but[i].callback));
|
||||
x += job_but[i].len + 1;
|
||||
}
|
||||
|
||||
|
@ -281,6 +281,7 @@ chmod_init (const char *fname, const struct stat *sf_stat)
|
||||
{
|
||||
gboolean single_set;
|
||||
WDialog *ch_dlg;
|
||||
WGroup *g;
|
||||
int lines, cols;
|
||||
int i, y;
|
||||
int perm_gb_len;
|
||||
@ -309,61 +310,61 @@ chmod_init (const char *fname, const struct stat *sf_stat)
|
||||
ch_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors,
|
||||
chmod_callback, NULL, "[Chmod]", _("Chmod command"));
|
||||
g = GROUP (ch_dlg);
|
||||
|
||||
add_widget (ch_dlg, groupbox_new (PY, PX, BUTTONS_PERM + 2, perm_gb_len, _("Permission")));
|
||||
group_add_widget (g, groupbox_new (PY, PX, BUTTONS_PERM + 2, perm_gb_len, _("Permission")));
|
||||
|
||||
for (i = 0; i < BUTTONS_PERM; i++)
|
||||
{
|
||||
check_perm[i].check = check_new (PY + i + 1, PX + 2, (ch_mode & check_perm[i].mode) != 0,
|
||||
check_perm[i].text);
|
||||
add_widget (ch_dlg, check_perm[i].check);
|
||||
group_add_widget (g, check_perm[i].check);
|
||||
}
|
||||
|
||||
file_gb = groupbox_new (PY, PX + perm_gb_len + 1, BUTTONS_PERM + 2, file_gb_len, _("File"));
|
||||
add_widget (ch_dlg, file_gb);
|
||||
group_add_widget (g, file_gb);
|
||||
|
||||
/* Set the labels */
|
||||
y = PY + 2;
|
||||
cols = PX + perm_gb_len + 3;
|
||||
c_fname = str_trunc (fname, file_gb_len - 3);
|
||||
add_widget (ch_dlg, label_new (y, cols, c_fname));
|
||||
group_add_widget (g, label_new (y, cols, c_fname));
|
||||
g_snprintf (buffer, sizeof (buffer), "%o", (unsigned int) ch_mode);
|
||||
statl = label_new (y + 2, cols, buffer);
|
||||
add_widget (ch_dlg, statl);
|
||||
group_add_widget (g, statl);
|
||||
c_fown = str_trunc (get_owner (sf_stat->st_uid), file_gb_len - 3);
|
||||
add_widget (ch_dlg, label_new (y + 4, cols, c_fown));
|
||||
group_add_widget (g, label_new (y + 4, cols, c_fown));
|
||||
c_fgrp = str_trunc (get_group (sf_stat->st_gid), file_gb_len - 3);
|
||||
add_widget (ch_dlg, label_new (y + 6, cols, c_fgrp));
|
||||
group_add_widget (g, label_new (y + 6, cols, c_fgrp));
|
||||
|
||||
if (!single_set)
|
||||
{
|
||||
i = 0;
|
||||
add_widget (ch_dlg, hline_new (lines - chmod_but[i].y - 1, -1, -1));
|
||||
|
||||
group_add_widget (g, hline_new (lines - chmod_but[i].y - 1, -1, -1));
|
||||
|
||||
for (; i < BUTTONS - 2; i++)
|
||||
{
|
||||
y = lines - chmod_but[i].y;
|
||||
add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 - chmod_but[i].len,
|
||||
chmod_but[i].ret_cmd, chmod_but[i].flags, chmod_but[i].text,
|
||||
NULL));
|
||||
group_add_widget (g, button_new (y, WIDGET (ch_dlg)->cols / 2 - chmod_but[i].len,
|
||||
chmod_but[i].ret_cmd, chmod_but[i].flags,
|
||||
chmod_but[i].text, NULL));
|
||||
i++;
|
||||
add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 + 1,
|
||||
chmod_but[i].ret_cmd, chmod_but[i].flags, chmod_but[i].text,
|
||||
NULL));
|
||||
group_add_widget (g, button_new (y, WIDGET (ch_dlg)->cols / 2 + 1,
|
||||
chmod_but[i].ret_cmd, chmod_but[i].flags,
|
||||
chmod_but[i].text, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
i = BUTTONS - 2;
|
||||
y = lines - chmod_but[i].y;
|
||||
add_widget (ch_dlg, hline_new (y - 1, -1, -1));
|
||||
add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 - chmod_but[i].len, chmod_but[i].ret_cmd,
|
||||
chmod_but[i].flags, chmod_but[i].text, NULL));
|
||||
group_add_widget (g, hline_new (y - 1, -1, -1));
|
||||
group_add_widget (g, button_new (y, WIDGET (ch_dlg)->cols / 2 - chmod_but[i].len,
|
||||
chmod_but[i].ret_cmd, chmod_but[i].flags, chmod_but[i].text,
|
||||
NULL));
|
||||
i++;
|
||||
add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 + 1, chmod_but[i].ret_cmd,
|
||||
chmod_but[i].flags, chmod_but[i].text, NULL));
|
||||
group_add_widget (g, button_new (y, WIDGET (ch_dlg)->cols / 2 + 1, chmod_but[i].ret_cmd,
|
||||
chmod_but[i].flags, chmod_but[i].text, NULL));
|
||||
|
||||
/* select first checkbox */
|
||||
widget_select (WIDGET (check_perm[0].check));
|
||||
|
@ -192,6 +192,7 @@ chown_init (void)
|
||||
{
|
||||
int single_set;
|
||||
WDialog *ch_dlg;
|
||||
WGroup *g;
|
||||
int lines, cols;
|
||||
int i, y;
|
||||
struct passwd *l_pass;
|
||||
@ -204,10 +205,11 @@ chown_init (void)
|
||||
ch_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, chown_callback,
|
||||
NULL, "[Chown]", _("Chown command"));
|
||||
g = GROUP (ch_dlg);
|
||||
|
||||
add_widget (ch_dlg, groupbox_new (2, 3, GH, GW, _("User name")));
|
||||
group_add_widget (g, groupbox_new (2, 3, GH, GW, _("User name")));
|
||||
l_user = listbox_new (3, 4, GH - 2, GW - 2, FALSE, NULL);
|
||||
add_widget (ch_dlg, l_user);
|
||||
group_add_widget (g, l_user);
|
||||
/* add field for unknown names (numbers) */
|
||||
listbox_add_item (l_user, LISTBOX_APPEND_AT_END, 0, _("<Unknown user>"), NULL, FALSE);
|
||||
/* get and put user names in the listbox */
|
||||
@ -216,9 +218,9 @@ chown_init (void)
|
||||
listbox_add_item (l_user, LISTBOX_APPEND_SORTED, 0, l_pass->pw_name, NULL, FALSE);
|
||||
endpwent ();
|
||||
|
||||
add_widget (ch_dlg, groupbox_new (2, 4 + GW, GH, GW, _("Group name")));
|
||||
group_add_widget (g, groupbox_new (2, 4 + GW, GH, GW, _("Group name")));
|
||||
l_group = listbox_new (3, 5 + GW, GH - 2, GW - 2, FALSE, NULL);
|
||||
add_widget (ch_dlg, l_group);
|
||||
group_add_widget (g, l_group);
|
||||
/* add field for unknown names (numbers) */
|
||||
listbox_add_item (l_group, LISTBOX_APPEND_AT_END, 0, _("<Unknown group>"), NULL, FALSE);
|
||||
/* get and put group names in the listbox */
|
||||
@ -227,42 +229,40 @@ chown_init (void)
|
||||
listbox_add_item (l_group, LISTBOX_APPEND_SORTED, 0, l_grp->gr_name, NULL, FALSE);
|
||||
endgrent ();
|
||||
|
||||
add_widget (ch_dlg, groupbox_new (2, 5 + GW * 2, GH, GW, _("File")));
|
||||
group_add_widget (g, groupbox_new (2, 5 + GW * 2, GH, GW, _("File")));
|
||||
/* add widgets for the file information */
|
||||
for (i = 0; i < LABELS; i++)
|
||||
{
|
||||
chown_label[i].l = label_new (chown_label[i].y, 7 + GW * 2, "");
|
||||
add_widget (ch_dlg, chown_label[i].l);
|
||||
group_add_widget (g, chown_label[i].l);
|
||||
}
|
||||
|
||||
if (single_set == 0)
|
||||
{
|
||||
int x;
|
||||
|
||||
add_widget (ch_dlg, hline_new (lines - chown_but[0].y - 1, -1, -1));
|
||||
group_add_widget (g, hline_new (lines - chown_but[0].y - 1, -1, -1));
|
||||
|
||||
y = lines - chown_but[0].y;
|
||||
x = (cols - blen) / 2;
|
||||
|
||||
for (i = 0; i < BUTTONS - 2; i++)
|
||||
{
|
||||
add_widget (ch_dlg,
|
||||
button_new (y, x, chown_but[i].ret_cmd, chown_but[i].flags,
|
||||
chown_but[i].text, NULL));
|
||||
group_add_widget (g, button_new (y, x, chown_but[i].ret_cmd, chown_but[i].flags,
|
||||
chown_but[i].text, NULL));
|
||||
x += chown_but[i].len + 1;
|
||||
}
|
||||
}
|
||||
|
||||
i = BUTTONS - 2;
|
||||
y = lines - chown_but[i].y;
|
||||
add_widget (ch_dlg, hline_new (y - 1, -1, -1));
|
||||
add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 - chown_but[i].len, chown_but[i].ret_cmd,
|
||||
chown_but[i].flags, chown_but[i].text, NULL));
|
||||
group_add_widget (g, hline_new (y - 1, -1, -1));
|
||||
group_add_widget (g, button_new (y, WIDGET (ch_dlg)->cols / 2 - chown_but[i].len,
|
||||
chown_but[i].ret_cmd, chown_but[i].flags, chown_but[i].text,
|
||||
NULL));
|
||||
i++;
|
||||
add_widget (ch_dlg,
|
||||
button_new (y, WIDGET (ch_dlg)->cols / 2 + 1, chown_but[i].ret_cmd,
|
||||
chown_but[i].flags, chown_but[i].text, NULL));
|
||||
group_add_widget (g, button_new (y, WIDGET (ch_dlg)->cols / 2 + 1, chown_but[i].ret_cmd,
|
||||
chown_but[i].flags, chown_but[i].text, NULL));
|
||||
|
||||
/* select first listbox */
|
||||
widget_select (WIDGET (l_user));
|
||||
|
@ -3102,6 +3102,7 @@ void
|
||||
dirsize_status_init_cb (status_msg_t * sm)
|
||||
{
|
||||
dirsize_status_msg_t *dsm = (dirsize_status_msg_t *) sm;
|
||||
WGroup *gd = GROUP (sm->dlg);
|
||||
Widget *wd = WIDGET (sm->dlg);
|
||||
|
||||
const char *b1_name = N_("&Abort");
|
||||
@ -3119,17 +3120,17 @@ dirsize_status_init_cb (status_msg_t * sm)
|
||||
|
||||
ui_width = MAX (COLS / 2, b_width + 6);
|
||||
dsm->dirname = label_new (2, 3, "");
|
||||
add_widget (sm->dlg, dsm->dirname);
|
||||
group_add_widget (gd, dsm->dirname);
|
||||
dsm->count_size = label_new (3, 3, "");
|
||||
add_widget (sm->dlg, dsm->count_size);
|
||||
add_widget (sm->dlg, hline_new (4, -1, -1));
|
||||
group_add_widget (gd, dsm->count_size);
|
||||
group_add_widget (gd, hline_new (4, -1, -1));
|
||||
|
||||
dsm->abort_button = WIDGET (button_new (5, 3, FILE_ABORT, NORMAL_BUTTON, b1_name, NULL));
|
||||
add_widget (sm->dlg, dsm->abort_button);
|
||||
group_add_widget (gd, dsm->abort_button);
|
||||
if (dsm->allow_skip)
|
||||
{
|
||||
dsm->skip_button = WIDGET (button_new (5, 3, FILE_SKIP, NORMAL_BUTTON, b2_name, NULL));
|
||||
add_widget (sm->dlg, dsm->skip_button);
|
||||
group_add_widget (gd, dsm->skip_button);
|
||||
widget_select (dsm->skip_button);
|
||||
}
|
||||
|
||||
|
@ -410,17 +410,15 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
|
||||
W(i) = WIDGET (label_new (dlg_widgets[i].y, dlg_widgets[i].x, text))
|
||||
|
||||
#define ADD_LABEL(i) \
|
||||
add_widget_autopos (ui->replace_dlg, W(i), dlg_widgets[i].pos_flags, \
|
||||
GROUP (ui->replace_dlg)->current != NULL ? \
|
||||
GROUP (ui->replace_dlg)->current->data : NULL)
|
||||
group_add_widget_autopos (g, W(i), dlg_widgets[i].pos_flags, \
|
||||
g->current != NULL ? g->current->data : NULL)
|
||||
|
||||
#define NEW_BUTTON(i) \
|
||||
W(i) = WIDGET (button_new (dlg_widgets[i].y, dlg_widgets[i].x, \
|
||||
dlg_widgets[i].value, NORMAL_BUTTON, dlg_widgets[i].text, NULL))
|
||||
|
||||
#define ADD_BUTTON(i) \
|
||||
add_widget_autopos (ui->replace_dlg, W(i), dlg_widgets[i].pos_flags, \
|
||||
ui->replace_dlg->current->data)
|
||||
group_add_widget_autopos (g, W(i), dlg_widgets[i].pos_flags, g->current->data)
|
||||
|
||||
/* dialog sizes */
|
||||
const int dlg_height = 17;
|
||||
@ -644,7 +642,7 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
|
||||
/* file info */
|
||||
for (i = 0; i <= 7; i++)
|
||||
ADD_LABEL (i);
|
||||
add_widget (ui->replace_dlg, hline_new (W (7)->y - wd->y + 1, -1, -1));
|
||||
group_add_widget (g, hline_new (W (7)->y - wd->y + 1, -1, -1));
|
||||
|
||||
/* label & buttons */
|
||||
ADD_LABEL (8); /* Overwrite this file? */
|
||||
@ -654,14 +652,14 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
|
||||
ADD_BUTTON (11); /* Append */
|
||||
if (do_reget)
|
||||
ADD_BUTTON (12); /* Reget */
|
||||
add_widget (ui->replace_dlg, hline_new (W (10)->y - wd->y + 1, -1, -1));
|
||||
group_add_widget (g, hline_new (W (10)->y - wd->y + 1, -1, -1));
|
||||
|
||||
/* label & buttons */
|
||||
ADD_LABEL (13); /* Overwrite all files? */
|
||||
add_widget (ui->replace_dlg, dlg_widgets[14].widget);
|
||||
group_add_widget (g, dlg_widgets[14].widget);
|
||||
for (i = 15; i <= 19; i++)
|
||||
ADD_BUTTON (i);
|
||||
add_widget (ui->replace_dlg, hline_new (W (19)->y - wd->y + 1, -1, -1));
|
||||
group_add_widget (g, hline_new (W (19)->y - wd->y + 1, -1, -1));
|
||||
|
||||
ADD_BUTTON (20); /* Abort */
|
||||
|
||||
@ -801,6 +799,7 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
|
||||
filegui_dialog_type_t dialog_type)
|
||||
{
|
||||
file_op_context_ui_t *ui;
|
||||
WGroup *g;
|
||||
int buttons_width;
|
||||
int dlg_width = 58, dlg_height = 17;
|
||||
int y = 2, x = 3;
|
||||
@ -828,6 +827,7 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
|
||||
ui->op_dlg =
|
||||
dlg_create (TRUE, 0, 0, dlg_height, dlg_width, WPOS_CENTER, FALSE, dialog_colors, NULL,
|
||||
NULL, NULL, op_names[ctx->operation]);
|
||||
g = GROUP (ui->op_dlg);
|
||||
|
||||
if (dialog_type != FILEGUI_DIALOG_DELETE_ITEM)
|
||||
{
|
||||
@ -835,30 +835,29 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
|
||||
ui->showing_bps = with_eta;
|
||||
|
||||
ui->src_file_label = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->src_file_label);
|
||||
group_add_widget (g, ui->src_file_label);
|
||||
|
||||
ui->src_file = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->src_file);
|
||||
group_add_widget (g, ui->src_file);
|
||||
|
||||
ui->tgt_file_label = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->tgt_file_label);
|
||||
group_add_widget (g, ui->tgt_file_label);
|
||||
|
||||
ui->tgt_file = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->tgt_file);
|
||||
group_add_widget (g, ui->tgt_file);
|
||||
|
||||
ui->progress_file_gauge = gauge_new (y++, x + 3, dlg_width - (x + 3) * 2, FALSE, 100, 0);
|
||||
if (!classic_progressbar && (current_panel == right_panel))
|
||||
ui->progress_file_gauge->from_left_to_right = FALSE;
|
||||
add_widget_autopos (ui->op_dlg, ui->progress_file_gauge, WPOS_KEEP_TOP | WPOS_KEEP_HORZ,
|
||||
NULL);
|
||||
group_add_widget_autopos (g, ui->progress_file_gauge, WPOS_KEEP_TOP | WPOS_KEEP_HORZ, NULL);
|
||||
|
||||
ui->progress_file_label = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->progress_file_label);
|
||||
group_add_widget (g, ui->progress_file_label);
|
||||
|
||||
if (verbose && dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
|
||||
{
|
||||
ui->total_bytes_label = hline_new (y++, -1, -1);
|
||||
add_widget (ui->op_dlg, ui->total_bytes_label);
|
||||
group_add_widget (g, ui->total_bytes_label);
|
||||
|
||||
if (ctx->progress_totals_computed)
|
||||
{
|
||||
@ -866,27 +865,27 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
|
||||
gauge_new (y++, x + 3, dlg_width - (x + 3) * 2, FALSE, 100, 0);
|
||||
if (!classic_progressbar && (current_panel == right_panel))
|
||||
ui->progress_total_gauge->from_left_to_right = FALSE;
|
||||
add_widget_autopos (ui->op_dlg, ui->progress_total_gauge,
|
||||
WPOS_KEEP_TOP | WPOS_KEEP_HORZ, NULL);
|
||||
group_add_widget_autopos (g, ui->progress_total_gauge,
|
||||
WPOS_KEEP_TOP | WPOS_KEEP_HORZ, NULL);
|
||||
}
|
||||
|
||||
ui->total_files_processed_label = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->total_files_processed_label);
|
||||
group_add_widget (g, ui->total_files_processed_label);
|
||||
|
||||
ui->time_label = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->time_label);
|
||||
group_add_widget (g, ui->time_label);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->src_file = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->src_file);
|
||||
group_add_widget (g, ui->src_file);
|
||||
|
||||
ui->total_files_processed_label = label_new (y++, x, "");
|
||||
add_widget (ui->op_dlg, ui->total_files_processed_label);
|
||||
group_add_widget (g, ui->total_files_processed_label);
|
||||
}
|
||||
|
||||
add_widget (ui->op_dlg, hline_new (y++, -1, -1));
|
||||
group_add_widget (g, hline_new (y++, -1, -1));
|
||||
|
||||
progress_buttons[0].w = WIDGET (button_new (y, 0, progress_buttons[0].action,
|
||||
progress_buttons[0].flags, progress_buttons[0].text,
|
||||
@ -918,9 +917,9 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
|
||||
if (progress_buttons[3].len == -1)
|
||||
progress_buttons[3].len = button_get_len (BUTTON (progress_buttons[3].w));
|
||||
|
||||
add_widget (ui->op_dlg, progress_buttons[0].w);
|
||||
add_widget (ui->op_dlg, progress_buttons[1].w);
|
||||
add_widget (ui->op_dlg, progress_buttons[3].w);
|
||||
group_add_widget (g, progress_buttons[0].w);
|
||||
group_add_widget (g, progress_buttons[1].w);
|
||||
group_add_widget (g, progress_buttons[3].w);
|
||||
|
||||
buttons_width = 2 +
|
||||
progress_buttons[0].len + MAX (progress_buttons[1].len, progress_buttons[2].len) +
|
||||
|
@ -565,6 +565,8 @@ static gboolean
|
||||
find_parameters (char **start_dir, ssize_t * start_dir_len,
|
||||
char **ignore_dirs, char **pattern, char **content)
|
||||
{
|
||||
WGroup *g;
|
||||
|
||||
/* Size of the find parameters window */
|
||||
#ifdef HAVE_CHARSET
|
||||
const int lines = 18;
|
||||
@ -671,96 +673,97 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
|
||||
find_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, find_parm_callback,
|
||||
NULL, "[Find File]", _("Find File"));
|
||||
g = GROUP (find_dlg);
|
||||
|
||||
x1 = 3;
|
||||
x2 = cols / 2 + 1;
|
||||
cw = (cols - 7) / 2;
|
||||
y1 = 2;
|
||||
|
||||
add_widget (find_dlg, label_new (y1++, x1, _("Start at:")));
|
||||
group_add_widget (g, label_new (y1++, x1, _("Start at:")));
|
||||
in_start =
|
||||
input_new (y1, x1, input_colors, cols - b0 - 7, in_start_dir, "start",
|
||||
INPUT_COMPLETE_CD | INPUT_COMPLETE_FILENAMES);
|
||||
add_widget (find_dlg, in_start);
|
||||
group_add_widget (g, in_start);
|
||||
|
||||
add_widget (find_dlg, button_new (y1++, cols - b0 - 3, B_TREE, NORMAL_BUTTON, buts[0], NULL));
|
||||
group_add_widget (g, button_new (y1++, cols - b0 - 3, B_TREE, NORMAL_BUTTON, buts[0], NULL));
|
||||
|
||||
ignore_dirs_cbox =
|
||||
check_new (y1++, x1, options.ignore_dirs_enable, _("Ena&ble ignore directories:"));
|
||||
add_widget (find_dlg, ignore_dirs_cbox);
|
||||
group_add_widget (g, ignore_dirs_cbox);
|
||||
|
||||
in_ignore =
|
||||
input_new (y1++, x1, input_colors, cols - 6,
|
||||
options.ignore_dirs != NULL ? options.ignore_dirs : "", "ignoredirs",
|
||||
INPUT_COMPLETE_CD | INPUT_COMPLETE_FILENAMES);
|
||||
add_widget (find_dlg, in_ignore);
|
||||
group_add_widget (g, in_ignore);
|
||||
|
||||
add_widget (find_dlg, hline_new (y1++, -1, -1));
|
||||
group_add_widget (g, hline_new (y1++, -1, -1));
|
||||
|
||||
y2 = y1;
|
||||
|
||||
/* Start 1st column */
|
||||
add_widget (find_dlg, label_new (y1++, x1, file_name_label));
|
||||
group_add_widget (g, label_new (y1++, x1, file_name_label));
|
||||
in_name =
|
||||
input_new (y1++, x1, input_colors, cw, INPUT_LAST_TEXT, "name",
|
||||
INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_CD);
|
||||
add_widget (find_dlg, in_name);
|
||||
group_add_widget (g, in_name);
|
||||
|
||||
/* Start 2nd column */
|
||||
content_label = label_new (y2++, x2, content_content_label);
|
||||
add_widget (find_dlg, content_label);
|
||||
group_add_widget (g, content_label);
|
||||
in_with =
|
||||
input_new (y2++, x2, input_colors, cw, content_is_empty ? "" : INPUT_LAST_TEXT,
|
||||
MC_HISTORY_SHARED_SEARCH, INPUT_COMPLETE_NONE);
|
||||
in_with->label = content_label;
|
||||
add_widget (find_dlg, in_with);
|
||||
group_add_widget (g, in_with);
|
||||
|
||||
/* Continue 1st column */
|
||||
recursively_cbox = check_new (y1++, x1, options.find_recurs, file_recurs_label);
|
||||
add_widget (find_dlg, recursively_cbox);
|
||||
group_add_widget (g, recursively_cbox);
|
||||
|
||||
file_pattern_cbox = check_new (y1++, x1, options.file_pattern, file_pattern_label);
|
||||
add_widget (find_dlg, file_pattern_cbox);
|
||||
group_add_widget (g, file_pattern_cbox);
|
||||
|
||||
file_case_sens_cbox = check_new (y1++, x1, options.file_case_sens, file_case_label);
|
||||
add_widget (find_dlg, file_case_sens_cbox);
|
||||
group_add_widget (g, file_case_sens_cbox);
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
file_all_charsets_cbox =
|
||||
check_new (y1++, x1, options.file_all_charsets, file_all_charsets_label);
|
||||
add_widget (find_dlg, file_all_charsets_cbox);
|
||||
group_add_widget (g, file_all_charsets_cbox);
|
||||
#endif
|
||||
|
||||
skip_hidden_cbox = check_new (y1++, x1, options.skip_hidden, file_skip_hidden_label);
|
||||
add_widget (find_dlg, skip_hidden_cbox);
|
||||
group_add_widget (g, skip_hidden_cbox);
|
||||
|
||||
/* Continue 2nd column */
|
||||
content_whole_words_cbox =
|
||||
check_new (y2++, x2, options.content_whole_words, content_whole_words_label);
|
||||
add_widget (find_dlg, content_whole_words_cbox);
|
||||
group_add_widget (g, content_whole_words_cbox);
|
||||
|
||||
content_regexp_cbox = check_new (y2++, x2, options.content_regexp, content_regexp_label);
|
||||
add_widget (find_dlg, content_regexp_cbox);
|
||||
group_add_widget (g, content_regexp_cbox);
|
||||
|
||||
content_case_sens_cbox = check_new (y2++, x2, options.content_case_sens, content_case_label);
|
||||
add_widget (find_dlg, content_case_sens_cbox);
|
||||
group_add_widget (g, content_case_sens_cbox);
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
content_all_charsets_cbox =
|
||||
check_new (y2++, x2, options.content_all_charsets, content_all_charsets_label);
|
||||
add_widget (find_dlg, content_all_charsets_cbox);
|
||||
group_add_widget (g, content_all_charsets_cbox);
|
||||
#endif
|
||||
|
||||
content_first_hit_cbox =
|
||||
check_new (y2++, x2, options.content_first_hit, content_first_hit_label);
|
||||
add_widget (find_dlg, content_first_hit_cbox);
|
||||
group_add_widget (g, content_first_hit_cbox);
|
||||
|
||||
/* buttons */
|
||||
y1 = max (y1, y2);
|
||||
x1 = (cols - b12) / 2;
|
||||
add_widget (find_dlg, hline_new (y1++, -1, -1));
|
||||
add_widget (find_dlg, button_new (y1, x1, B_ENTER, DEFPUSH_BUTTON, buts[1], NULL));
|
||||
add_widget (find_dlg, button_new (y1, x1 + b1 + 1, B_CANCEL, NORMAL_BUTTON, buts[2], NULL));
|
||||
group_add_widget (g, hline_new (y1++, -1, -1));
|
||||
group_add_widget (g, button_new (y1, x1, B_ENTER, DEFPUSH_BUTTON, buts[1], NULL));
|
||||
group_add_widget (g, button_new (y1, x1 + b1 + 1, B_CANCEL, NORMAL_BUTTON, buts[2], NULL));
|
||||
|
||||
find_par_start:
|
||||
widget_select (WIDGET (in_name));
|
||||
@ -1631,6 +1634,7 @@ find_do_edit_file (WButton * button, int action)
|
||||
static void
|
||||
setup_gui (void)
|
||||
{
|
||||
WGroup *g;
|
||||
size_t i;
|
||||
int lines, cols;
|
||||
int y;
|
||||
@ -1658,23 +1662,24 @@ setup_gui (void)
|
||||
find_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, find_callback, NULL,
|
||||
"[Find File]", NULL);
|
||||
g = GROUP (find_dlg);
|
||||
|
||||
find_calc_button_locations (find_dlg, TRUE);
|
||||
|
||||
y = 2;
|
||||
find_list = listbox_new (y, 2, lines - 10, cols - 4, FALSE, NULL);
|
||||
add_widget_autopos (find_dlg, find_list, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, find_list, WPOS_KEEP_ALL, NULL);
|
||||
y += WIDGET (find_list)->lines;
|
||||
|
||||
add_widget_autopos (find_dlg, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
|
||||
found_num_label = label_new (y++, 4, "");
|
||||
add_widget_autopos (find_dlg, found_num_label, WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, found_num_label, WPOS_KEEP_BOTTOM, NULL);
|
||||
|
||||
status_label = label_new (y++, 4, _("Searching"));
|
||||
add_widget_autopos (find_dlg, status_label, WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, status_label, WPOS_KEEP_BOTTOM, NULL);
|
||||
|
||||
add_widget_autopos (find_dlg, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
|
||||
for (i = 0; i < fbuts_num; i++)
|
||||
{
|
||||
@ -1686,7 +1691,7 @@ setup_gui (void)
|
||||
WIDGET (button_new
|
||||
(y, fbuts[i].x, fbuts[i].ret_cmd, fbuts[i].flags, fbuts[i].text,
|
||||
fbuts[i].callback));
|
||||
add_widget_autopos (find_dlg, fbuts[i].button, WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, fbuts[i].button, WPOS_KEEP_BOTTOM, NULL);
|
||||
}
|
||||
|
||||
if (i == quit_button)
|
||||
|
@ -750,6 +750,7 @@ init_hotlist (hotlist_t list_type)
|
||||
int lines, cols;
|
||||
int y;
|
||||
int dh = 0;
|
||||
WGroup *g;
|
||||
WGroupbox *path_box;
|
||||
Widget *hotlist_widget;
|
||||
|
||||
@ -775,11 +776,12 @@ init_hotlist (hotlist_t list_type)
|
||||
hotlist_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, hotlist_callback,
|
||||
NULL, help_node, title);
|
||||
g = GROUP (hotlist_dlg);
|
||||
|
||||
y = UY;
|
||||
hotlist_group = groupbox_new (y, UX, lines - 10 + dh, cols - 2 * UX, _("Top level group"));
|
||||
hotlist_widget = WIDGET (hotlist_group);
|
||||
add_widget_autopos (hotlist_dlg, hotlist_widget, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, hotlist_widget, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
l_hotlist =
|
||||
listbox_new (y + 1, UX + 1, hotlist_widget->lines - 2, hotlist_widget->cols - 2, FALSE,
|
||||
@ -798,26 +800,26 @@ init_hotlist (hotlist_t list_type)
|
||||
fill_listbox (l_hotlist);
|
||||
|
||||
/* insert before groupbox to view scrollbar */
|
||||
add_widget_autopos (hotlist_dlg, l_hotlist, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, l_hotlist, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
y += hotlist_widget->lines;
|
||||
|
||||
path_box = groupbox_new (y, UX, 3, hotlist_widget->cols, _("Directory path"));
|
||||
add_widget_autopos (hotlist_dlg, path_box, WPOS_KEEP_BOTTOM | WPOS_KEEP_HORZ, NULL);
|
||||
group_add_widget_autopos (g, path_box, WPOS_KEEP_BOTTOM | WPOS_KEEP_HORZ, NULL);
|
||||
|
||||
pname = label_new (y + 1, UX + 2, "");
|
||||
add_widget_autopos (hotlist_dlg, pname, WPOS_KEEP_BOTTOM | WPOS_KEEP_LEFT, NULL);
|
||||
group_add_widget_autopos (g, pname, WPOS_KEEP_BOTTOM | WPOS_KEEP_LEFT, NULL);
|
||||
y += WIDGET (path_box)->lines;
|
||||
|
||||
add_widget_autopos (hotlist_dlg, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
|
||||
for (i = 0; i < hotlist_but_num; i++)
|
||||
if ((hotlist_but[i].type & list_type) != 0)
|
||||
add_widget_autopos (hotlist_dlg,
|
||||
button_new (y + hotlist_but[i].y, UX + hotlist_but[i].x,
|
||||
hotlist_but[i].ret_cmd, hotlist_but[i].flags,
|
||||
hotlist_but[i].text, hotlist_button_callback),
|
||||
hotlist_but[i].pos_flags, NULL);
|
||||
group_add_widget_autopos (g,
|
||||
button_new (y + hotlist_but[i].y, UX + hotlist_but[i].x,
|
||||
hotlist_but[i].ret_cmd, hotlist_but[i].flags,
|
||||
hotlist_but[i].text, hotlist_button_callback),
|
||||
hotlist_but[i].pos_flags, NULL);
|
||||
|
||||
widget_select (WIDGET (l_hotlist));
|
||||
}
|
||||
@ -831,6 +833,7 @@ init_movelist (struct hotlist *item)
|
||||
char *hdr;
|
||||
int lines, cols;
|
||||
int y;
|
||||
WGroup *g;
|
||||
Widget *movelist_widget;
|
||||
|
||||
do_refresh ();
|
||||
@ -843,32 +846,33 @@ init_movelist (struct hotlist *item)
|
||||
movelist_dlg =
|
||||
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, hotlist_callback,
|
||||
NULL, "[Hotlist]", hdr);
|
||||
g = GROUP (movelist_dlg);
|
||||
|
||||
g_free (hdr);
|
||||
|
||||
y = UY;
|
||||
movelist_group = groupbox_new (y, UX, lines - 7, cols - 2 * UX, _("Directory label"));
|
||||
movelist_widget = WIDGET (movelist_group);
|
||||
add_widget_autopos (movelist_dlg, movelist_widget, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, movelist_widget, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
l_movelist =
|
||||
listbox_new (y + 1, UX + 1, movelist_widget->lines - 2, movelist_widget->cols - 2, FALSE,
|
||||
hotlist_listbox_callback);
|
||||
fill_listbox (l_movelist);
|
||||
/* insert before groupbox to view scrollbar */
|
||||
add_widget_autopos (movelist_dlg, l_movelist, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, l_movelist, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
y += movelist_widget->lines;
|
||||
|
||||
add_widget_autopos (movelist_dlg, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
group_add_widget_autopos (g, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
|
||||
|
||||
for (i = 0; i < hotlist_but_num; i++)
|
||||
if ((hotlist_but[i].type & LIST_MOVELIST) != 0)
|
||||
add_widget_autopos (movelist_dlg,
|
||||
button_new (y + hotlist_but[i].y, UX + hotlist_but[i].x,
|
||||
hotlist_but[i].ret_cmd, hotlist_but[i].flags,
|
||||
hotlist_but[i].text, hotlist_button_callback),
|
||||
hotlist_but[i].pos_flags, NULL);
|
||||
group_add_widget_autopos (g,
|
||||
button_new (y + hotlist_but[i].y, UX + hotlist_but[i].x,
|
||||
hotlist_but[i].ret_cmd, hotlist_but[i].flags,
|
||||
hotlist_but[i].text, hotlist_button_callback),
|
||||
hotlist_but[i].pos_flags, NULL);
|
||||
|
||||
widget_select (WIDGET (l_movelist));
|
||||
}
|
||||
|
@ -481,6 +481,7 @@ static WDialog *
|
||||
layout_dlg_create (void)
|
||||
{
|
||||
WDialog *layout_dlg;
|
||||
WGroup *g;
|
||||
int l1 = 0, width;
|
||||
int b1, b2, b;
|
||||
size_t i;
|
||||
@ -547,29 +548,30 @@ layout_dlg_create (void)
|
||||
layout_dlg =
|
||||
dlg_create (TRUE, 0, 0, 15, width, WPOS_CENTER, FALSE, dialog_colors, layout_callback, NULL,
|
||||
"[Layout]", _("Layout"));
|
||||
g = GROUP (layout_dlg);
|
||||
|
||||
#define XTRACT(i) (*check_options[i].variable != 0), check_options[i].text
|
||||
|
||||
/* "Panel split" groupbox */
|
||||
add_widget (layout_dlg, groupbox_new (2, 3, 6, l1, title1));
|
||||
group_add_widget (g, groupbox_new (2, 3, 6, l1, title1));
|
||||
|
||||
radio_widget = radio_new (3, 5, 2, s_split_direction);
|
||||
radio_widget->sel = panels_layout.horizontal_split ? 1 : 0;
|
||||
add_widget (layout_dlg, radio_widget);
|
||||
group_add_widget (g, radio_widget);
|
||||
|
||||
check_options[0].widget = check_new (5, 5, XTRACT (0));
|
||||
add_widget (layout_dlg, check_options[0].widget);
|
||||
group_add_widget (g, check_options[0].widget);
|
||||
|
||||
equal_split = panels_layout.horizontal_split ?
|
||||
panels_layout.horizontal_equal : panels_layout.vertical_equal;
|
||||
|
||||
bleft_widget = button_new (6, 8, B_2LEFT, NARROW_BUTTON, "&<", b_left_right_cback);
|
||||
widget_disable (WIDGET (bleft_widget), equal_split);
|
||||
add_widget (layout_dlg, bleft_widget);
|
||||
group_add_widget (g, bleft_widget);
|
||||
|
||||
bright_widget = button_new (6, 14, B_2RIGHT, NARROW_BUTTON, "&>", b_left_right_cback);
|
||||
widget_disable (WIDGET (bright_widget), equal_split);
|
||||
add_widget (layout_dlg, bright_widget);
|
||||
group_add_widget (g, bright_widget);
|
||||
|
||||
/* "Console output" groupbox */
|
||||
{
|
||||
@ -580,37 +582,36 @@ layout_dlg_create (void)
|
||||
|
||||
w = WIDGET (groupbox_new (8, 3, 3, l1, title2));
|
||||
w->state |= disabled;
|
||||
add_widget (layout_dlg, w);
|
||||
group_add_widget (g, w);
|
||||
|
||||
w = WIDGET (button_new (9, output_lines_label_len + 5, B_PLUS,
|
||||
NARROW_BUTTON, "&+", bplus_cback));
|
||||
w->state |= disabled;
|
||||
add_widget (layout_dlg, w);
|
||||
group_add_widget (g, w);
|
||||
|
||||
w = WIDGET (button_new (9, output_lines_label_len + 5 + 5, B_MINUS,
|
||||
NARROW_BUTTON, "&-", bminus_cback));
|
||||
w->state |= disabled;
|
||||
add_widget (layout_dlg, w);
|
||||
group_add_widget (g, w);
|
||||
}
|
||||
|
||||
/* "Other options" groupbox */
|
||||
add_widget (layout_dlg, groupbox_new (2, 4 + l1, 9, l1, title3));
|
||||
group_add_widget (g, groupbox_new (2, 4 + l1, 9, l1, title3));
|
||||
|
||||
for (i = 1; i < (size_t) LAYOUT_OPTIONS_COUNT; i++)
|
||||
{
|
||||
check_options[i].widget = check_new (i + 2, 6 + l1, XTRACT (i));
|
||||
add_widget (layout_dlg, check_options[i].widget);
|
||||
group_add_widget (g, check_options[i].widget);
|
||||
}
|
||||
|
||||
#undef XTRACT
|
||||
|
||||
add_widget (layout_dlg, hline_new (11, -1, -1));
|
||||
group_add_widget (g, hline_new (11, -1, -1));
|
||||
/* buttons */
|
||||
add_widget (layout_dlg,
|
||||
button_new (12, (width - b) / 2, B_ENTER, DEFPUSH_BUTTON, ok_button, 0));
|
||||
add_widget (layout_dlg,
|
||||
button_new (12, (width - b) / 2 + b1 + 1, B_CANCEL, NORMAL_BUTTON,
|
||||
cancel_button, 0));
|
||||
group_add_widget (g, button_new (12, (width - b) / 2, B_ENTER, DEFPUSH_BUTTON, ok_button, 0));
|
||||
group_add_widget (g,
|
||||
button_new (12, (width - b) / 2 + b1 + 1, B_CANCEL, NORMAL_BUTTON,
|
||||
cancel_button, 0));
|
||||
|
||||
widget_select (WIDGET (radio_widget));
|
||||
|
||||
|
@ -917,34 +917,36 @@ done_mc (void)
|
||||
static void
|
||||
create_file_manager (void)
|
||||
{
|
||||
WGroup *g = GROUP (midnight_dlg);
|
||||
|
||||
midnight_dlg->get_shortcut = midnight_get_shortcut;
|
||||
midnight_dlg->get_title = midnight_get_title;
|
||||
/* allow rebind tab */
|
||||
widget_want_tab (WIDGET (midnight_dlg), TRUE);
|
||||
|
||||
the_menubar = menubar_new (NULL, menubar_visible);
|
||||
add_widget (midnight_dlg, the_menubar);
|
||||
group_add_widget (g, the_menubar);
|
||||
init_menu ();
|
||||
|
||||
create_panels ();
|
||||
add_widget (midnight_dlg, get_panel_widget (0));
|
||||
add_widget (midnight_dlg, get_panel_widget (1));
|
||||
group_add_widget (g, get_panel_widget (0));
|
||||
group_add_widget (g, get_panel_widget (1));
|
||||
|
||||
the_hint = label_new (0, 0, 0);
|
||||
the_hint->transparent = TRUE;
|
||||
the_hint->auto_adjust_cols = 0;
|
||||
WIDGET (the_hint)->cols = COLS;
|
||||
add_widget (midnight_dlg, the_hint);
|
||||
group_add_widget (g, the_hint);
|
||||
|
||||
cmdline = command_new (0, 0, 0);
|
||||
add_widget (midnight_dlg, cmdline);
|
||||
group_add_widget (g, cmdline);
|
||||
|
||||
the_prompt = label_new (0, 0, mc_prompt);
|
||||
the_prompt->transparent = TRUE;
|
||||
add_widget (midnight_dlg, the_prompt);
|
||||
group_add_widget (g, the_prompt);
|
||||
|
||||
the_bar = buttonbar_new (mc_global.keybar_visible);
|
||||
add_widget (midnight_dlg, the_bar);
|
||||
group_add_widget (g, the_bar);
|
||||
midnight_set_buttonbar (the_bar);
|
||||
}
|
||||
|
||||
|
@ -141,6 +141,8 @@ init_panelize (void)
|
||||
/* *INDENT-ON* */
|
||||
};
|
||||
|
||||
WGroup *g;
|
||||
|
||||
size_t i;
|
||||
int blen;
|
||||
int panelize_cols;
|
||||
@ -169,27 +171,28 @@ init_panelize (void)
|
||||
panelize_dlg =
|
||||
dlg_create (TRUE, 0, 0, 20, panelize_cols, WPOS_CENTER, FALSE, dialog_colors,
|
||||
panelize_callback, NULL, "[External panelize]", _("External panelize"));
|
||||
g = GROUP (panelize_dlg);
|
||||
|
||||
/* add listbox to the dialogs */
|
||||
y = UY;
|
||||
add_widget (panelize_dlg, groupbox_new (y++, UX, 12, panelize_cols - UX * 2, ""));
|
||||
group_add_widget (g, groupbox_new (y++, UX, 12, panelize_cols - UX * 2, ""));
|
||||
|
||||
l_panelize = listbox_new (y, UX + 1, 10, panelize_cols - UX * 2 - 2, FALSE, NULL);
|
||||
for (current = panelize; current != NULL; current = current->next)
|
||||
listbox_add_item (l_panelize, LISTBOX_APPEND_AT_END, 0, current->label, current, FALSE);
|
||||
listbox_select_entry (l_panelize, listbox_search_text (l_panelize, _("Other command")));
|
||||
add_widget (panelize_dlg, l_panelize);
|
||||
group_add_widget (g, l_panelize);
|
||||
|
||||
y += WIDGET (l_panelize)->lines + 1;
|
||||
add_widget (panelize_dlg, label_new (y++, UX, _("Command")));
|
||||
group_add_widget (g, label_new (y++, UX, _("Command")));
|
||||
pname =
|
||||
input_new (y++, UX, input_colors, panelize_cols - UX * 2, "", "in",
|
||||
INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_HOSTNAMES | INPUT_COMPLETE_COMMANDS |
|
||||
INPUT_COMPLETE_VARIABLES | INPUT_COMPLETE_USERNAMES | INPUT_COMPLETE_CD |
|
||||
INPUT_COMPLETE_SHELL_ESC);
|
||||
add_widget (panelize_dlg, pname);
|
||||
group_add_widget (g, pname);
|
||||
|
||||
add_widget (panelize_dlg, hline_new (y++, -1, -1));
|
||||
group_add_widget (g, hline_new (y++, -1, -1));
|
||||
|
||||
x = (panelize_cols - blen) / 2;
|
||||
for (i = 0; i < G_N_ELEMENTS (panelize_but); i++)
|
||||
@ -198,7 +201,7 @@ init_panelize (void)
|
||||
|
||||
b = button_new (y, x,
|
||||
panelize_but[i].ret_cmd, panelize_but[i].flags, panelize_but[i].text, NULL);
|
||||
add_widget (panelize_dlg, b);
|
||||
group_add_widget (g, b);
|
||||
|
||||
x += button_get_len (b) + 1;
|
||||
}
|
||||
|
@ -1049,6 +1049,7 @@ help_interactive_display (const gchar * event_group_name, const gchar * event_na
|
||||
HELP_TITLE_COLOR /* title color */
|
||||
};
|
||||
|
||||
WGroup *g;
|
||||
WButtonBar *help_bar;
|
||||
Widget *md;
|
||||
char *hlpfile = NULL;
|
||||
@ -1103,6 +1104,7 @@ help_interactive_display (const gchar * event_group_name, const gchar * event_na
|
||||
whelp =
|
||||
dlg_create (TRUE, 0, 0, help_lines + 4, HELP_WINDOW_WIDTH + 4, WPOS_CENTER | WPOS_TRYUP,
|
||||
FALSE, help_colors, help_callback, NULL, "[Help]", _("Help"));
|
||||
g = GROUP (whelp);
|
||||
widget_want_tab (WIDGET (whelp), TRUE);
|
||||
|
||||
selected_item = search_string_node (main_node, STRING_LINK_START) - 1;
|
||||
@ -1121,8 +1123,8 @@ help_interactive_display (const gchar * event_group_name, const gchar * event_na
|
||||
|
||||
md = mousedispatch_new (1, 1, help_lines, HELP_WINDOW_WIDTH - 2);
|
||||
|
||||
add_widget (whelp, md);
|
||||
add_widget (whelp, help_bar);
|
||||
group_add_widget (g, md);
|
||||
group_add_widget (g, help_bar);
|
||||
|
||||
buttonbar_set_label (help_bar, 1, Q_ ("ButtonBar|Help"), help_map, NULL);
|
||||
buttonbar_set_label (help_bar, 2, Q_ ("ButtonBar|Index"), help_map, NULL);
|
||||
|
25
src/learn.c
25
src/learn.c
@ -247,6 +247,8 @@ learn_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
static void
|
||||
init_learn (void)
|
||||
{
|
||||
WGroup *g;
|
||||
|
||||
const int dlg_width = 78;
|
||||
const int dlg_height = 23;
|
||||
|
||||
@ -276,6 +278,7 @@ init_learn (void)
|
||||
learn_dlg =
|
||||
dlg_create (TRUE, 0, 0, dlg_height, dlg_width, WPOS_CENTER, FALSE, dialog_colors,
|
||||
learn_callback, NULL, "[Learn keys]", learn_title);
|
||||
g = GROUP (learn_dlg);
|
||||
|
||||
/* find first unshown button */
|
||||
for (key = key_name_conv_tab, learn_total = 0;
|
||||
@ -308,8 +311,8 @@ init_learn (void)
|
||||
learnkeys[i].button =
|
||||
WIDGET (button_new (y, x, B_USER + i, NARROW_BUTTON, buffer, learn_button));
|
||||
learnkeys[i].label = WIDGET (label_new (y, x + 19, ""));
|
||||
add_widget (learn_dlg, learnkeys[i].button);
|
||||
add_widget (learn_dlg, learnkeys[i].label);
|
||||
group_add_widget (g, learnkeys[i].button);
|
||||
group_add_widget (g, learnkeys[i].label);
|
||||
|
||||
y++;
|
||||
if (y == UY + ROWS)
|
||||
@ -319,20 +322,20 @@ init_learn (void)
|
||||
}
|
||||
}
|
||||
|
||||
add_widget (learn_dlg, hline_new (dlg_height - 8, -1, -1));
|
||||
add_widget (learn_dlg,
|
||||
label_new (dlg_height - 7, 5,
|
||||
_("Press all the keys mentioned here. After you have done it, check\n"
|
||||
"which keys are not marked with OK. Press space on the missing\n"
|
||||
"key, or click with the mouse to define it. Move around with Tab.")));
|
||||
add_widget (learn_dlg, hline_new (dlg_height - 4, -1, -1));
|
||||
group_add_widget (g, hline_new (dlg_height - 8, -1, -1));
|
||||
group_add_widget (g, label_new (dlg_height - 7, 5,
|
||||
_
|
||||
("Press all the keys mentioned here. After you have done it, check\n"
|
||||
"which keys are not marked with OK. Press space on the missing\n"
|
||||
"key, or click with the mouse to define it. Move around with Tab.")));
|
||||
group_add_widget (g, hline_new (dlg_height - 4, -1, -1));
|
||||
/* buttons */
|
||||
bl0 = str_term_width1 (b0) + 5; /* default button */
|
||||
bl1 = str_term_width1 (b1) + 3; /* normal button */
|
||||
bx0 = (dlg_width - (bl0 + bl1 + 1)) / 2;
|
||||
bx1 = bx0 + bl0 + 1;
|
||||
add_widget (learn_dlg, button_new (dlg_height - 3, bx0, B_ENTER, DEFPUSH_BUTTON, b0, NULL));
|
||||
add_widget (learn_dlg, button_new (dlg_height - 3, bx1, B_CANCEL, NORMAL_BUTTON, b1, NULL));
|
||||
group_add_widget (g, button_new (dlg_height - 3, bx0, B_ENTER, DEFPUSH_BUTTON, b0, NULL));
|
||||
group_add_widget (g, button_new (dlg_height - 3, bx1, B_CANCEL, NORMAL_BUTTON, b1, NULL));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -235,6 +235,7 @@ mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_lin
|
||||
WView *lc_mcview;
|
||||
WDialog *view_dlg;
|
||||
Widget *vw, *b;
|
||||
WGroup *g;
|
||||
|
||||
/* Create dialog and widgets, put them on the dialog */
|
||||
view_dlg = dlg_create (FALSE, 0, 0, 1, 1, WPOS_FULLSCREEN, FALSE, NULL, mcview_dialog_callback,
|
||||
@ -242,11 +243,13 @@ mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_lin
|
||||
vw = WIDGET (view_dlg);
|
||||
widget_want_tab (vw, TRUE);
|
||||
|
||||
g = GROUP (view_dlg);
|
||||
|
||||
lc_mcview = mcview_new (vw->y, vw->x, vw->lines - 1, vw->cols, FALSE);
|
||||
add_widget_autopos (view_dlg, lc_mcview, WPOS_KEEP_ALL, NULL);
|
||||
group_add_widget_autopos (g, lc_mcview, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
b = WIDGET (buttonbar_new (TRUE));
|
||||
add_widget_autopos (view_dlg, b, b->pos_flags, NULL);
|
||||
group_add_widget_autopos (g, b, b->pos_flags, NULL);
|
||||
|
||||
view_dlg->get_title = mcview_get_title;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user