From 7329f53da5342c0472028cd9d7e2b6278e2959e1 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Fri, 11 Nov 2016 11:46:13 +0300 Subject: [PATCH] WEdit: use WRect to save previous location. Signed-off-by: Andrew Borodin --- src/editor/edit.c | 20 +++++++------------- src/editor/editwidget.c | 7 ++----- src/editor/editwidget.h | 3 +-- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index e6e1b4e73..149d84b5a 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -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) { diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index d2df9ea79..9a3e3245e 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -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); } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/editor/editwidget.h b/src/editor/editwidget.h index 5e515f3e9..78adb9dd6 100644 --- a/src/editor/editwidget.h +++ b/src/editor/editwidget.h @@ -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 */