diff --git a/src/ChangeLog b/src/ChangeLog index 75e20e7b7..e4e8ee1a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2005-01-25 Roland Illig + + * dialog.h (widget_msg_t): Added WIDGET_RESIZED to inform widgets + that they had been resized. + * dialog.c (widget_set_size): Send a WIDGET_RESIZED message after + setting the size. + * layout.c (panel_do_cols): Don't explicitly update the + bytes_per_line of a hexview WView. + * view.h (view_update_bytes_per_line): Removed from the interface + to WView. + * view.c (view_update_bytes_per_line): Declared as `static'. + * view.c (view_callback): Call update_bytes_per_line when the + WView is initialized and whenever a WIDGET_RESIZED message is + received. + 2005-01-19 Jindrich Novy * main.c (_do_panel_cd): Delete leading spaces from URL diff --git a/src/dialog.c b/src/dialog.c index e7f98155e..a8c586527 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -819,6 +819,7 @@ void widget_set_size (Widget *widget, int y, int x, int lines, int cols) widget->y = y; widget->cols = cols; widget->lines = lines; + send_message (widget, WIDGET_RESIZED, 0 /* unused */); } /* Replace widget old_w for widget new_w in the dialog h */ diff --git a/src/dialog.h b/src/dialog.h index 05e07d47b..2d4a94d44 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -44,7 +44,8 @@ typedef enum { WIDGET_HOTKEY, /* Sent to widget to catch preprocess key */ WIDGET_DESTROY, /* Sent to widget at destruction time */ WIDGET_CURSOR, /* Sent to widget to position the cursor */ - WIDGET_IDLE, /* Send to widgets with options & W_WANT_IDLE*/ + WIDGET_IDLE, /* Sent to widgets with options & W_WANT_IDLE*/ + WIDGET_RESIZED, /* Sent after a widget has been resized */ } widget_msg_t; typedef enum { diff --git a/src/layout.c b/src/layout.c index 816dfc41f..ca03d4203 100644 --- a/src/layout.c +++ b/src/layout.c @@ -633,10 +633,6 @@ panel_do_cols (int index) set_panel_formats ((WPanel *) panels [index].widget); else { panel_update_cols (panels [index].widget, frame_half); - - /* In case of an Hex Quick View must review line length */ - if (get_display_type (index) == view_quick) - view_update_bytes_per_line ((WView *) panels [index].widget); } } diff --git a/src/view.c b/src/view.c index 7babe81e3..f34afb949 100644 --- a/src/view.c +++ b/src/view.c @@ -753,7 +753,7 @@ do_view_init (WView *view, const char *_command, const char *_file, return 0; } -void +static void view_update_bytes_per_line (WView *view) { int cols; @@ -2734,6 +2734,8 @@ view_callback (WView *view, widget_msg_t msg, int parm) cb_ret_t i; Dlg_head *h = view->widget.parent; + view_update_bytes_per_line (view); + switch (msg) { case WIDGET_INIT: view_update_bytes_per_line (view); @@ -2781,6 +2783,10 @@ view_callback (WView *view, widget_msg_t msg, int parm) delete_hook (&select_file_hook, view_hook); return MSG_HANDLED; + case WIDGET_RESIZED: + view_update_bytes_per_line (view); + /* FALLTROUGH */ + default: return default_proc (msg, parm); } diff --git a/src/view.h b/src/view.h index d29806d09..1056c36df 100644 --- a/src/view.h +++ b/src/view.h @@ -9,8 +9,6 @@ WView *view_new (int y, int x, int cols, int lines, int is_panel); int view_init (WView *view, const char *_command, const char *_file, int start_line); -void view_update_bytes_per_line (WView *view); - /* Command: view a _file, if _command != NULL we use popen on _command */ /* move direction should be a pointer that will hold the direction in which */ /* the user wants to move (-1 previous file, 1 next file, 0 do nothing) */