Esempio n. 1
0
WEdit *
find_editor (const Dlg_head * h)
{
    if (edit_widget_is_editor ((Widget *) h->current->data))
        return (WEdit *) h->current->data;
    return (WEdit *) find_widget_type (h, edit_callback);
}
Esempio n. 2
0
WEdit *
find_editor (const WDialog * h)
{
    if (edit_widget_is_editor (CONST_WIDGET (h->current->data)))
        return (WEdit *) h->current->data;
    return (WEdit *) find_widget_type (h, edit_callback);
}
Esempio n. 3
0
static char *
edit_get_title (const Dlg_head * h, size_t len)
{
    const WEdit *edit = (const WEdit *) find_widget_type (h, edit_callback);
    const char *modified = edit->modified ? "(*) " : "    ";
    const char *file_label;

    len -= 4;

    file_label = str_term_trim (edit->filename, len - str_term_width1 (_("Edit: ")));

    return g_strconcat (_("Edit: "), modified, file_label, (char *) NULL);
}
Esempio n. 4
0
static cb_ret_t
edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
{
    WEdit *edit;
    WMenuBar *menubar;
    WButtonBar *buttonbar;

    edit = (WEdit *) find_widget_type (h, edit_callback);
    menubar = find_menubar (h);
    buttonbar = find_buttonbar (h);

    switch (msg)
    {
    case DLG_INIT:
        edit_set_buttonbar (edit, buttonbar);
        return MSG_HANDLED;

    case DLG_DRAW:
        /* don't use common_dialog_repaint() -- we don't need a frame */
        tty_setcolor (EDITOR_NORMAL_COLOR);
        dlg_erase (h);
        return MSG_HANDLED;

    case DLG_RESIZE:
        /* dlg_set_size() is surplus for this case */
        h->lines = LINES;
        h->cols = COLS;
        widget_set_size (&buttonbar->widget, h->lines - 1, h->x, 1, h->cols);
        widget_set_size (&menubar->widget, h->y, h->x, 1, h->cols);
        menubar_arrange (menubar);
        widget_set_size (&edit->widget, h->y + 1, h->x, h->lines - 2, h->cols);
        return MSG_HANDLED;

    case DLG_ACTION:
        if (sender == (Widget *) menubar)
            return send_message ((Widget *) edit, WIDGET_COMMAND, parm);
        if (sender == (Widget *) buttonbar)
            return send_message ((Widget *) edit, WIDGET_COMMAND, parm);
        return MSG_HANDLED;

    case DLG_VALIDATE:
        h->state = DLG_ACTIVE;  /* don't stop the dialog before final decision */
        if (edit_ok_to_exit (edit))
            h->state = DLG_CLOSED;
        return MSG_HANDLED;

    default:
        return default_dlg_callback (h, sender, msg, parm, data);
    }
}
Esempio n. 5
0
static void
view_adjust_size (Dlg_head *h)
{
    WDiff *view;
    WButtonBar *bar;

    /* Look up the viewer and the buttonbar, we assume only two widgets here */
    view = (WDiff *)find_widget_type(h, view_callback);
    bar = find_buttonbar(h);
    widget_set_size(&view->widget, 0, 0, LINES, COLS);
    widget_set_size((Widget *)bar, LINES - 1, 0, 1, COLS);

    view_compute_areas(view);
}
Esempio n. 6
0
File: lib.c Progetto: iNode/mc
char *
mcview_get_title (const WDialog * h, size_t len)
{
    const mcview_t *view = (const mcview_t *) find_widget_type (h, mcview_callback);
    const char *modified = view->hexedit_mode && (view->change_list != NULL) ? "(*) " : "    ";
    const char *file_label;
    const char *view_filename;
    char *ret_str;

    view_filename = vfs_path_as_str (view->filename_vpath);

    len -= 4;

    file_label = view_filename != NULL ? view_filename : view->command != NULL ? view->command : "";
    file_label = str_term_trim (file_label, len - str_term_width1 (_("View: ")));

    ret_str = g_strconcat (_("View: "), modified, file_label, (char *) NULL);
    return ret_str;
}
Esempio n. 7
0
WMenuBar *
find_menubar (const WDialog * h)
{
    return MENUBAR (find_widget_type (h, menubar_callback));
}
Esempio n. 8
0
/* Find ButtonBar widget in the dialog */
WButtonBar *
find_buttonbar (const WDialog * h)
{
    return BUTTONBAR (find_widget_type (h, buttonbar_callback));
}
Esempio n. 9
0
File: menu.c Progetto: ryanlee/mc
WMenuBar *
find_menubar (const Dlg_head * h)
{
    return (WMenuBar *) find_widget_type (h, menubar_callback);
}
Esempio n. 10
0
WTree *
find_tree (WDialog * h)
{
    return (WTree *) find_widget_type (h, tree_callback);
}
Esempio n. 11
0
/* Find ButtonBar widget in the dialog */
WButtonBar *
find_buttonbar (const Dlg_head * h)
{
    return (WButtonBar *) find_widget_type (h, buttonbar_callback);
}
Esempio n. 12
0
File: tree.c Progetto: ryanlee/mc
WTree *
find_tree (struct Dlg_head *h)
{
    return (WTree *) find_widget_type (h, tree_callback);
}