1
1

* dlg.h: New message DLG_RESIZE.

* layout.c: Call DLG_RESIZE instead of resizing viewer and
editor individually.
* view.c (view): Install handler for DLG_RESIZE.  Make view_dlg
a local variable.
Этот коммит содержится в:
Pavel Roskin 2002-09-24 03:56:08 +00:00
родитель 95deedcc08
Коммит 7b42d6c5cd
4 изменённых файлов: 37 добавлений и 26 удалений

Просмотреть файл

@ -1,5 +1,11 @@
2002-09-23 Pavel Roskin <proski@gnu.org>
* dlg.h: New message DLG_RESIZE.
* layout.c: Call DLG_RESIZE instead of resizing viewer and
editor individually.
* view.c (view): Install handler for DLG_RESIZE. Make view_dlg
a local variable.
* view.c (view): Set view_dlg to NULL after it's destroyed.
* color.h: Remove EDITOR_UNDERLINED_COLOR, it's unused.

Просмотреть файл

@ -52,6 +52,7 @@ enum {
DLG_DRAW, /* Sent for updating dialog managed area */
DLG_FOCUS, /* Sent on give focus to a widget */
DLG_UNFOCUS, /* Sent on remove focus from widget */
DLG_RESIZE, /* Sent when the window size changes */
DLG_ONE_UP, /* Sent on selecting next */
DLG_ONE_DOWN, /* Sent on selecting prev */
DLG_POST_KEY, /* Sent after key has been sent */

Просмотреть файл

@ -723,8 +723,6 @@ void flag_winch (int dummy)
winch_flag = 1;
}
void edit_adjust_size (Dlg_head * h);
static void
low_level_change_screen_size (void)
{
@ -751,11 +749,12 @@ low_level_change_screen_size (void)
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
}
void change_screen_size (void)
void
change_screen_size (void)
{
#if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
#if defined TIOCGWINSZ && !defined SCO_FLAVOR
#ifndef NCURSES_VERSION
mc_noraw_mode ();
endwin ();
@ -772,22 +771,20 @@ void change_screen_size (void)
init_curses ();
#endif
setup_panels ();
if (current_dlg == view_dlg)
view_adjust_size (view_dlg);
#ifdef USE_INTERNAL_EDIT
if (current_dlg == edit_dlg)
edit_adjust_size (edit_dlg);
#endif
/* Inform currently running dialog */
(*current_dlg->callback) (current_dlg, current_dlg->current->dlg_id,
DLG_RESIZE);
#ifdef RESIZABLE_MENUBAR
menubar_arrange(the_menubar);
menubar_arrange (the_menubar);
#endif
/* Now, force the redraw */
do_refresh ();
touchwin (stdscr);
#endif /* TIOCGWINSZ && !SCO_FLAVOR */
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
#endif /* TIOCGWINSZ && !SCO_FLAVOR */
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
winch_flag = 0;
}

Просмотреть файл

@ -2398,8 +2398,17 @@ view_adjust_size (Dlg_head *h)
view_update_bytes_per_line(view);
}
/* Only the text mode edition uses this */
Dlg_head *view_dlg;
/* Callback for the view dialog */
static int
view_dialog_callback (Dlg_head * h, int id, int msg)
{
switch (msg) {
case DLG_RESIZE:
view_adjust_size (h);
return MSG_HANDLED;
}
return default_dlg_callback (h, id, msg);
}
/* Real view only */
int
@ -2408,20 +2417,19 @@ view (char *_command, const char *_file, int *move_dir_p, int start_line)
int error;
WView *wview;
WButtonBar *bar;
Dlg_head *our_dlg;
Dlg_head *view_dlg;
/* Create dialog and widgets, put them on the dialog */
our_dlg =
create_dlg (0, 0, LINES, COLS, NULL, NULL,
view_dlg =
create_dlg (0, 0, LINES, COLS, NULL, view_dialog_callback,
"[Internal File Viewer]", NULL, DLG_NONE);
view_dlg = our_dlg;
wview = view_new (0, 0, COLS, LINES - 1, 0);
bar = buttonbar_new (1);
add_widget (our_dlg, wview);
add_widget (our_dlg, bar);
add_widget (view_dlg, wview);
add_widget (view_dlg, bar);
error = view_init (wview, _command, _file, start_line);
if (move_dir_p)
@ -2432,12 +2440,11 @@ view (char *_command, const char *_file, int *move_dir_p, int start_line)
* be aware of it
*/
if (!error) {
run_dlg (our_dlg);
run_dlg (view_dlg);
if (move_dir_p)
*move_dir_p = wview->move_dir;
}
destroy_dlg (our_dlg);
view_dlg = NULL;
destroy_dlg (view_dlg);
return !error;
}