(edit_init): change argument for coordinates.

Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2022-05-21 20:11:00 +03:00
parent 533b2076dd
commit 12543835f9
4 changed files with 10 additions and 11 deletions

View File

@ -180,8 +180,7 @@ char *edit_get_write_filter (const vfs_path_t * write_name_vpath,
const vfs_path_t * filename_vpath); const vfs_path_t * filename_vpath);
gboolean edit_save_confirm_cmd (WEdit * edit); gboolean edit_save_confirm_cmd (WEdit * edit);
gboolean edit_save_as_cmd (WEdit * edit); gboolean edit_save_as_cmd (WEdit * edit);
WEdit *edit_init (WEdit * edit, int y, int x, int lines, int cols, WEdit *edit_init (WEdit * edit, const WRect * r, const vfs_path_t * filename_vpath, long line);
const vfs_path_t * filename_vpath, long line);
gboolean edit_clean (WEdit * edit); gboolean edit_clean (WEdit * edit);
gboolean edit_ok_to_exit (WEdit * edit); gboolean edit_ok_to_exit (WEdit * edit);
gboolean edit_load_cmd (WDialog * h); gboolean edit_load_cmd (WDialog * h);

View File

@ -2081,8 +2081,7 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
*/ */
WEdit * WEdit *
edit_init (WEdit * edit, int y, int x, int lines, int cols, const vfs_path_t * filename_vpath, edit_init (WEdit * edit, const WRect * r, const vfs_path_t * filename_vpath, long line)
long line)
{ {
gboolean to_free = FALSE; gboolean to_free = FALSE;
@ -2106,14 +2105,13 @@ edit_init (WEdit * edit, int y, int x, int lines, int cols, const vfs_path_t * f
} }
else else
{ {
WRect r = { y, x, lines, cols };
Widget *w; Widget *w;
edit = g_malloc0 (sizeof (WEdit)); edit = g_malloc0 (sizeof (WEdit));
to_free = TRUE; to_free = TRUE;
w = WIDGET (edit); w = WIDGET (edit);
widget_init (w, &r, NULL, NULL); widget_init (w, r, NULL, NULL);
w->options |= WOP_SELECTABLE | WOP_TOP_SELECT | WOP_WANT_CURSOR; w->options |= WOP_SELECTABLE | WOP_TOP_SELECT | WOP_WANT_CURSOR;
w->keymap = editor_map; w->keymap = editor_map;
w->ext_keymap = editor_x_map; w->ext_keymap = editor_x_map;
@ -2246,8 +2244,7 @@ edit_reload_line (WEdit * edit, const vfs_path_t * filename_vpath, long line)
e->fullscreen = edit->fullscreen; e->fullscreen = edit->fullscreen;
e->loc_prev = edit->loc_prev; e->loc_prev = edit->loc_prev;
if (edit_init (e, w->rect.y, w->rect.x, w->rect.lines, w->rect.cols, filename_vpath, line) == if (edit_init (e, &w->rect, filename_vpath, line) == NULL)
NULL)
{ {
g_free (e); g_free (e);
return FALSE; return FALSE;

View File

@ -1384,7 +1384,7 @@ edit_add_window (WDialog * h, const WRect * r, const vfs_path_t * f, long fline)
WEdit *edit; WEdit *edit;
Widget *w; Widget *w;
edit = edit_init (NULL, r->y, r->x, r->lines, r->cols, f, fline); edit = edit_init (NULL, r, f, fline);
if (edit == NULL) if (edit == NULL)
return FALSE; return FALSE;

View File

@ -6,7 +6,7 @@
Written by: Written by:
Slava Zanko <slavazanko@gmail.com>, 2013 Slava Zanko <slavazanko@gmail.com>, 2013
Andrew Borodin <aborodin@vmail.ru>, 2021 Andrew Borodin <aborodin@vmail.ru>, 2021-2022
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -151,6 +151,8 @@ edit_completion_dialog_show__deinit (void)
static void static void
my_setup (void) my_setup (void)
{ {
WRect r;
str_init_strings (NULL); str_init_strings (NULL);
vfs_init (); vfs_init ();
@ -168,7 +170,8 @@ my_setup (void)
option_filesize_threshold = (char *) "64M"; option_filesize_threshold = (char *) "64M";
test_edit = edit_init (NULL, 0, 0, 24, 80, vfs_path_from_str ("test-data.txt"), 1); rect_init (&r, 0, 0, 24, 80);
test_edit = edit_init (NULL, &r, vfs_path_from_str ("test-data.txt"), 1);
memset (&owner, 0, sizeof (owner)); memset (&owner, 0, sizeof (owner));
group_add_widget (&owner, WIDGET (test_edit)); group_add_widget (&owner, WIDGET (test_edit));
edit_completion_dialog_show__init (); edit_completion_dialog_show__init ();