mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Clarify widget redraw in runtime.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
ef94b84eaf
commit
30959e0b7d
@ -241,8 +241,7 @@ button_set_text (WButton * b, const char *text)
|
||||
release_hotkey (b->text);
|
||||
b->text = parse_hotkey (text);
|
||||
w->cols = button_get_len (b);
|
||||
if (w->owner != NULL)
|
||||
send_message (w, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (w);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -47,13 +47,6 @@ WButtonBar *find_buttonbar (const WDialog * h);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
static inline void
|
||||
buttonbar_redraw (WButtonBar * bb)
|
||||
{
|
||||
if (bb != NULL)
|
||||
send_message (bb, NULL, MSG_DRAW, 0, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
buttonbar_set_visible (WButtonBar * bb, gboolean visible)
|
||||
{
|
||||
|
@ -1382,8 +1382,7 @@ dlg_replace_widget (Widget * old_w, Widget * new_w)
|
||||
if (should_focus)
|
||||
dlg_select_widget (new_w);
|
||||
|
||||
if (new_w->owner->state == DLG_ACTIVE)
|
||||
send_message (new_w, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (new_w);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -164,7 +164,7 @@ gauge_set_value (WGauge * g, int max, int current)
|
||||
max = 1; /* I do not like division by zero :) */
|
||||
g->current = current;
|
||||
g->max = max;
|
||||
gauge_callback (WIDGET (g), NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (g));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -175,7 +175,7 @@ gauge_show (WGauge * g, gboolean shown)
|
||||
if (g->shown != shown)
|
||||
{
|
||||
g->shown = shown;
|
||||
gauge_callback (WIDGET (g), NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (g));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,6 @@ groupbox_new (int y, int x, int height, int width, const char *title)
|
||||
void
|
||||
groupbox_set_title (WGroupbox * g, const char *title)
|
||||
{
|
||||
Widget *w = WIDGET (g);
|
||||
|
||||
g_free (g->title);
|
||||
g->title = NULL;
|
||||
|
||||
@ -134,8 +132,7 @@ groupbox_set_title (WGroupbox * g, const char *title)
|
||||
g_free (t);
|
||||
}
|
||||
|
||||
if (w->owner != NULL)
|
||||
send_message (w, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (g));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -150,8 +150,7 @@ hline_set_text (WHLine * l, const char *text)
|
||||
else
|
||||
l->text = g_strdup (text);
|
||||
|
||||
if (WIDGET (l)->owner != NULL)
|
||||
send_message (l, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (l));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -1265,6 +1265,7 @@ input_set_point (WInput * in, int pos)
|
||||
void
|
||||
input_update (WInput * in, gboolean clear_first)
|
||||
{
|
||||
Widget *w = WIDGET (in);
|
||||
int has_history = 0;
|
||||
int i;
|
||||
int buf_len;
|
||||
@ -1292,13 +1293,13 @@ input_update (WInput * in, gboolean clear_first)
|
||||
in->mark = min (in->mark, buf_len);
|
||||
|
||||
/* don't draw widget not put into dialog */
|
||||
if (WIDGET (in)->owner == NULL)
|
||||
if (w->owner == NULL || w->owner->state != DLG_ACTIVE)
|
||||
return;
|
||||
|
||||
if (has_history != 0)
|
||||
draw_history_button (in);
|
||||
|
||||
if ((WIDGET (in)->options & W_DISABLED) != 0)
|
||||
if ((w->options & W_DISABLED) != 0)
|
||||
tty_setcolor (DISABLED_COLOR);
|
||||
else if (in->first)
|
||||
tty_setcolor (in->color[WINPUTC_UNCHANGED]);
|
||||
|
@ -1058,7 +1058,7 @@ query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
listbox_select_entry (LISTBOX (h->current->data), i);
|
||||
end = new_end;
|
||||
input_handle_char (input, parm);
|
||||
send_message (h->current->data, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (h->current->data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1161,7 +1161,7 @@ query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
if (need_redraw == 2)
|
||||
{
|
||||
insert_text (input, last_text, low);
|
||||
send_message (h->current->data, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (h->current->data));
|
||||
}
|
||||
else if (need_redraw == 1)
|
||||
{
|
||||
|
@ -182,11 +182,10 @@ label_set_text (WLabel * label, const char *text)
|
||||
}
|
||||
}
|
||||
|
||||
if (w->owner != NULL)
|
||||
send_message (w, NULL, MSG_DRAW, 0, NULL);
|
||||
|
||||
if (newcols < w->cols)
|
||||
w->cols = newcols;
|
||||
|
||||
widget_redraw (w);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -268,6 +268,20 @@ widget_erase (Widget * w)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
widget_redraw (Widget * w)
|
||||
{
|
||||
if (w != NULL)
|
||||
{
|
||||
WDialog *h = w->owner;
|
||||
|
||||
if (h != NULL && h->state == DLG_ACTIVE)
|
||||
w->callback (w, NULL, MSG_DRAW, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* get mouse pointer location within widget */
|
||||
Gpm_Event
|
||||
mouse_get_local (const Gpm_Event * global, const Widget * w)
|
||||
|
@ -142,6 +142,7 @@ void widget_set_options (Widget * w, widget_options_t options, gboolean enable);
|
||||
void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
|
||||
/* select color for widget in dependance of state */
|
||||
void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey);
|
||||
void widget_redraw (Widget * w);
|
||||
void widget_erase (Widget * w);
|
||||
|
||||
/* get mouse pointer location within widget */
|
||||
|
@ -1878,7 +1878,7 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
|
||||
|
||||
edit_cursor_move (edit, curs - edit->curs1);
|
||||
edit->force |= REDRAW_PAGE;
|
||||
send_message (edit, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (edit));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -3333,7 +3333,7 @@ edit_select_codepage_cmd (WEdit * edit)
|
||||
edit_set_codeset (edit);
|
||||
|
||||
edit->force = REDRAW_PAGE;
|
||||
send_message (edit, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (edit));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1173,7 +1173,7 @@ edit_update_screen (WEdit * e)
|
||||
edit_render_keypress (e);
|
||||
}
|
||||
|
||||
buttonbar_redraw (find_buttonbar (h));
|
||||
widget_redraw (WIDGET (find_buttonbar (h)));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -922,7 +922,7 @@ find_add_match (const char *dir, const char *file)
|
||||
/* Don't scroll */
|
||||
if (matches == 0)
|
||||
listbox_select_first (find_list);
|
||||
send_message (find_list, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (find_list));
|
||||
|
||||
matches++;
|
||||
found_num_update ();
|
||||
|
@ -233,7 +233,7 @@ update_split (const WDialog * h)
|
||||
check_options[0].widget->state = _panels_layout.horizontal_equal ? 1 : 0;
|
||||
else
|
||||
check_options[0].widget->state = _panels_layout.vertical_equal ? 1 : 0;
|
||||
send_message (check_options[0].widget, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (check_options[0].widget));
|
||||
|
||||
tty_setcolor (check_options[0].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL);
|
||||
|
||||
|
@ -1097,10 +1097,10 @@ static void
|
||||
update_dirty_panels (void)
|
||||
{
|
||||
if (get_current_type () == view_listing && current_panel->dirty)
|
||||
send_message (current_panel, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (current_panel));
|
||||
|
||||
if (get_other_type () == view_listing && other_panel->dirty)
|
||||
send_message (other_panel, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (other_panel));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -2497,7 +2497,7 @@ do_search (WPanel * panel, int c_code)
|
||||
unselect_item (panel);
|
||||
panel->selected = sel;
|
||||
select_item (panel);
|
||||
send_message (panel, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (WIDGET (panel));
|
||||
}
|
||||
else if (c_code != KEY_BACKSPACE)
|
||||
{
|
||||
@ -3462,7 +3462,7 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
|
||||
bb = find_buttonbar (w->owner);
|
||||
midnight_set_buttonbar (bb);
|
||||
buttonbar_redraw (bb);
|
||||
widget_redraw (WIDGET (bb));
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_UNFOCUS:
|
||||
@ -3718,7 +3718,7 @@ panel_event (Gpm_Event * event, void *data)
|
||||
|
||||
finish:
|
||||
if (panel->dirty)
|
||||
send_message (w, NULL, MSG_DRAW, 0, NULL);
|
||||
widget_redraw (w);
|
||||
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
@ -1236,7 +1236,7 @@ tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
|
||||
buttonbar_clear_label (b, 7, WIDGET (tree));
|
||||
#endif
|
||||
buttonbar_set_label (b, 8, Q_ ("ButtonBar|Rmdir"), tree_map, w);
|
||||
buttonbar_redraw (b);
|
||||
widget_redraw (WIDGET (b));
|
||||
|
||||
/* FIXME: Should find a better way of only displaying the
|
||||
currently selected item */
|
||||
|
@ -189,7 +189,7 @@ mcview_update (mcview_t * view)
|
||||
{
|
||||
view->dpy_bbar_dirty = FALSE;
|
||||
mcview_set_buttonbar (view);
|
||||
buttonbar_redraw (find_buttonbar (WIDGET (view)->owner));
|
||||
widget_redraw (WIDGET (find_buttonbar (WIDGET (view)->owner)));
|
||||
}
|
||||
|
||||
if (view->dirty > dirt_limit)
|
||||
|
Loading…
Reference in New Issue
Block a user