mirror of https://github.com/MidnightCommander/mc
* editwidget.c (edit): Install handler for DLG_RESIZE.
This commit is contained in:
parent
7b42d6c5cd
commit
996a847666
|
@ -1,5 +1,7 @@
|
|||
2002-09-23 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* editwidget.c (edit): Install handler for DLG_RESIZE.
|
||||
|
||||
* editwidget.c (edit): Set edit_dlg to NULL after it's
|
||||
destroyed.
|
||||
|
||||
|
|
|
@ -117,6 +117,35 @@ int edit_mouse_event (Gpm_Event * event, void *x)
|
|||
return menubar_event (event, edit_menubar);
|
||||
}
|
||||
|
||||
static void
|
||||
edit_adjust_size (Dlg_head * h)
|
||||
{
|
||||
WEdit *edit;
|
||||
WButtonBar *edit_bar;
|
||||
|
||||
edit = (WEdit *) find_widget_type (h, (callback_fn) edit_callback);
|
||||
edit_bar = (WButtonBar *) edit->widget.parent->current->next->widget;
|
||||
widget_set_size (&edit->widget, 0, 0, LINES - 1, COLS);
|
||||
widget_set_size (&edit_bar->widget, LINES - 1, 0, 1, COLS);
|
||||
widget_set_size (&edit_menubar->widget, 0, 0, 1, COLS);
|
||||
|
||||
#ifdef RESIZABLE_MENUBAR
|
||||
menubar_arrange (edit_menubar);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Callback for the edit dialog */
|
||||
static int
|
||||
edit_dialog_callback (Dlg_head * h, int id, int msg)
|
||||
{
|
||||
switch (msg) {
|
||||
case DLG_RESIZE:
|
||||
edit_adjust_size (h);
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
return default_dlg_callback (h, id, msg);
|
||||
}
|
||||
|
||||
int
|
||||
edit (const char *_file, int line)
|
||||
{
|
||||
|
@ -150,7 +179,7 @@ edit (const char *_file, int line)
|
|||
|
||||
/* Create a new dialog and add it widgets to it */
|
||||
edit_dlg =
|
||||
create_dlg (0, 0, LINES, COLS, NULL, NULL,
|
||||
create_dlg (0, 0, LINES, COLS, NULL, edit_dialog_callback,
|
||||
"[Internal File Editor]", NULL, DLG_WANT_TAB);
|
||||
|
||||
init_widget (&(wedit->widget), 0, 0, LINES - 1, COLS,
|
||||
|
@ -276,22 +305,6 @@ long get_key_state (void)
|
|||
return (long) get_modifier ();
|
||||
}
|
||||
|
||||
void edit_adjust_size (Dlg_head * h)
|
||||
{
|
||||
WEdit *edit;
|
||||
WButtonBar *edit_bar;
|
||||
|
||||
edit = (WEdit *) find_widget_type (h, (callback_fn) edit_callback);
|
||||
edit_bar = (WButtonBar *) edit->widget.parent->current->next->widget;
|
||||
widget_set_size (&edit->widget, 0, 0, LINES - 1, COLS);
|
||||
widget_set_size (&edit_bar->widget, LINES - 1, 0, 1, COLS);
|
||||
widget_set_size (&edit_menubar->widget, 0, 0, 1, COLS);
|
||||
|
||||
#ifdef RESIZABLE_MENUBAR
|
||||
menubar_arrange (edit_menubar);
|
||||
#endif
|
||||
}
|
||||
|
||||
void edit_update_screen (WEdit * e)
|
||||
{
|
||||
edit_scroll_screen_over_cursor (e);
|
||||
|
|
Loading…
Reference in New Issue