WEdit: use WRect to save previous location.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-11-11 11:46:13 +03:00
parent 045816ed13
commit 7329f53da5
3 changed files with 10 additions and 20 deletions

View File

@ -2084,21 +2084,18 @@ edit_init (WEdit * edit, int y, int x, int lines, int cols, const vfs_path_t * f
if (edit != NULL)
{
gboolean fullscreen;
WRect loc_prev;
/* save some widget parameters */
gboolean fullscreen = edit->fullscreen;
int y_prev = edit->y_prev;
int x_prev = edit->x_prev;
int lines_prev = edit->lines_prev;
int cols_prev = edit->cols_prev;
fullscreen = edit->fullscreen;
loc_prev = edit->loc_prev;
edit_purge_widget (edit);
/* restore saved parameters */
edit->fullscreen = fullscreen;
edit->y_prev = y_prev;
edit->x_prev = x_prev;
edit->lines_prev = lines_prev;
edit->cols_prev = cols_prev;
edit->loc_prev = loc_prev;
}
else
{
@ -2237,10 +2234,7 @@ edit_reload_line (WEdit * edit, const vfs_path_t * filename_vpath, long line)
*WIDGET (e) = *w;
/* save some widget parameters */
e->fullscreen = edit->fullscreen;
e->y_prev = edit->y_prev;
e->x_prev = edit->x_prev;
e->lines_prev = edit->lines_prev;
e->cols_prev = edit->cols_prev;
e->loc_prev = edit->loc_prev;
if (edit_init (e, w->y, w->x, w->lines, w->cols, filename_vpath, line) == NULL)
{

View File

@ -192,7 +192,7 @@ edit_restore_size (WEdit * edit)
edit->drag_state = MCEDIT_DRAG_NONE;
w->mouse.forced_capture = FALSE;
widget_set_size (w, edit->y_prev, edit->x_prev, edit->lines_prev, edit->cols_prev);
widget_set_size_rect (w, &edit->loc_prev);
dlg_draw (DIALOG (w->owner));
}
@ -1323,10 +1323,7 @@ edit_save_size (WEdit * edit)
{
Widget *w = WIDGET (edit);
edit->y_prev = w->y;
edit->x_prev = w->x;
edit->lines_prev = w->lines;
edit->cols_prev = w->cols;
rect_init (&edit->loc_prev, w->y, w->x, w->lines, w->cols);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -68,8 +68,7 @@ struct WEdit
int drag_state_start; /* save cursor position before window moving */
/* save location before move/resize or toggle to fullscreen */
int x_prev, y_prev;
int cols_prev, lines_prev;
WRect loc_prev;
vfs_path_t *filename_vpath; /* Name of the file */
vfs_path_t *dir_vpath; /* NULL if filename is absolute */