mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
* 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.
This commit is contained in:
parent
95deedcc08
commit
7b42d6c5cd
@ -1,5 +1,11 @@
|
|||||||
2002-09-23 Pavel Roskin <proski@gnu.org>
|
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.
|
* view.c (view): Set view_dlg to NULL after it's destroyed.
|
||||||
|
|
||||||
* color.h: Remove EDITOR_UNDERLINED_COLOR, it's unused.
|
* color.h: Remove EDITOR_UNDERLINED_COLOR, it's unused.
|
||||||
|
@ -52,6 +52,7 @@ enum {
|
|||||||
DLG_DRAW, /* Sent for updating dialog managed area */
|
DLG_DRAW, /* Sent for updating dialog managed area */
|
||||||
DLG_FOCUS, /* Sent on give focus to a widget */
|
DLG_FOCUS, /* Sent on give focus to a widget */
|
||||||
DLG_UNFOCUS, /* Sent on remove focus from 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_UP, /* Sent on selecting next */
|
||||||
DLG_ONE_DOWN, /* Sent on selecting prev */
|
DLG_ONE_DOWN, /* Sent on selecting prev */
|
||||||
DLG_POST_KEY, /* Sent after key has been sent */
|
DLG_POST_KEY, /* Sent after key has been sent */
|
||||||
|
27
src/layout.c
27
src/layout.c
@ -723,8 +723,6 @@ void flag_winch (int dummy)
|
|||||||
winch_flag = 1;
|
winch_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_adjust_size (Dlg_head * h);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
low_level_change_screen_size (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 */
|
#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(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
|
||||||
#if defined TIOCGWINSZ && !defined SCO_FLAVOR
|
#if defined TIOCGWINSZ && !defined SCO_FLAVOR
|
||||||
|
|
||||||
#ifndef NCURSES_VERSION
|
#ifndef NCURSES_VERSION
|
||||||
mc_noraw_mode ();
|
mc_noraw_mode ();
|
||||||
endwin ();
|
endwin ();
|
||||||
@ -772,22 +771,20 @@ void change_screen_size (void)
|
|||||||
init_curses ();
|
init_curses ();
|
||||||
#endif
|
#endif
|
||||||
setup_panels ();
|
setup_panels ();
|
||||||
if (current_dlg == view_dlg)
|
|
||||||
view_adjust_size (view_dlg);
|
/* Inform currently running dialog */
|
||||||
#ifdef USE_INTERNAL_EDIT
|
(*current_dlg->callback) (current_dlg, current_dlg->current->dlg_id,
|
||||||
if (current_dlg == edit_dlg)
|
DLG_RESIZE);
|
||||||
edit_adjust_size (edit_dlg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RESIZABLE_MENUBAR
|
#ifdef RESIZABLE_MENUBAR
|
||||||
menubar_arrange(the_menubar);
|
menubar_arrange (the_menubar);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Now, force the redraw */
|
/* Now, force the redraw */
|
||||||
do_refresh ();
|
do_refresh ();
|
||||||
touchwin (stdscr);
|
touchwin (stdscr);
|
||||||
#endif /* TIOCGWINSZ && !SCO_FLAVOR */
|
#endif /* TIOCGWINSZ && !SCO_FLAVOR */
|
||||||
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
|
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
|
||||||
winch_flag = 0;
|
winch_flag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
src/view.c
29
src/view.c
@ -2398,8 +2398,17 @@ view_adjust_size (Dlg_head *h)
|
|||||||
view_update_bytes_per_line(view);
|
view_update_bytes_per_line(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only the text mode edition uses this */
|
/* Callback for the view dialog */
|
||||||
Dlg_head *view_dlg;
|
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 */
|
/* Real view only */
|
||||||
int
|
int
|
||||||
@ -2408,20 +2417,19 @@ view (char *_command, const char *_file, int *move_dir_p, int start_line)
|
|||||||
int error;
|
int error;
|
||||||
WView *wview;
|
WView *wview;
|
||||||
WButtonBar *bar;
|
WButtonBar *bar;
|
||||||
Dlg_head *our_dlg;
|
Dlg_head *view_dlg;
|
||||||
|
|
||||||
/* Create dialog and widgets, put them on the dialog */
|
/* Create dialog and widgets, put them on the dialog */
|
||||||
our_dlg =
|
view_dlg =
|
||||||
create_dlg (0, 0, LINES, COLS, NULL, NULL,
|
create_dlg (0, 0, LINES, COLS, NULL, view_dialog_callback,
|
||||||
"[Internal File Viewer]", NULL, DLG_NONE);
|
"[Internal File Viewer]", NULL, DLG_NONE);
|
||||||
|
|
||||||
view_dlg = our_dlg;
|
|
||||||
wview = view_new (0, 0, COLS, LINES - 1, 0);
|
wview = view_new (0, 0, COLS, LINES - 1, 0);
|
||||||
|
|
||||||
bar = buttonbar_new (1);
|
bar = buttonbar_new (1);
|
||||||
|
|
||||||
add_widget (our_dlg, wview);
|
add_widget (view_dlg, wview);
|
||||||
add_widget (our_dlg, bar);
|
add_widget (view_dlg, bar);
|
||||||
|
|
||||||
error = view_init (wview, _command, _file, start_line);
|
error = view_init (wview, _command, _file, start_line);
|
||||||
if (move_dir_p)
|
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
|
* be aware of it
|
||||||
*/
|
*/
|
||||||
if (!error) {
|
if (!error) {
|
||||||
run_dlg (our_dlg);
|
run_dlg (view_dlg);
|
||||||
if (move_dir_p)
|
if (move_dir_p)
|
||||||
*move_dir_p = wview->move_dir;
|
*move_dir_p = wview->move_dir;
|
||||||
}
|
}
|
||||||
destroy_dlg (our_dlg);
|
destroy_dlg (view_dlg);
|
||||||
view_dlg = NULL;
|
|
||||||
|
|
||||||
return !error;
|
return !error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user