Commit Graph

167 Commits

Author SHA1 Message Date
Andrew Borodin 702c3634e5 Move the some stuff from dialog.[ch] to dialog-switch.[ch]:
* variables: top_dlg, fast_refresh;
  * function: do_refresh().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:54 +03:00
Andrew Borodin e6cb6591b3 (dlg_close): rename from dlg_stop().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:11 +03:00
Andrew Borodin 47da3a764a (dlg_default_destroy): send MSG_DESTROY to the dialog itself
...to avoid various memory leaks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 7257f794d2 Update template for .c files.
Add section for forward declarations of local functions. This section is
located before file scope variables because functions can be used in
strucutres (see find.c for example):

/*** forward declarations (file scope functions) *************************************************/

/* button callbacks */
static int start_stop (WButton * button, int action);
static int find_do_view_file (WButton * button, int action);
static int find_do_edit_file (WButton * button, int action);

/*** file scope variables ************************************************************************/

static struct
{
    ...
    bcback_fn callback;
} fbuts[] =
{
    ...
    { B_STOP, NORMAL_BUTTON, N_("S&uspend"), 0, 0, NULL, start_stop },
    ...
    { B_VIEW, NORMAL_BUTTON, N_("&View - F3"), 0, 0, NULL, find_do_view_file },
    { B_VIEW, NORMAL_BUTTON, N_("&Edit - F4"), 0, 0, NULL, find_do_edit_file }
};

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 584fb9815c Change WDialog::data from void* to union{void*, int}
...to use data of type other than pointer w/o extra type cast.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 57c61b7681 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin b3fb596040 (dlg_init): get rid of extra dialog draws.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin caf41457c6 (widget_adjust_position): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin 390d614b5e (group_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin 5fae2313f3 Widget: use WRect to hold position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:49:20 +03:00
Andrew Borodin 2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin 231c84caeb Widget: implement destroy callback.
(dlg_destroy): remove. Use widget_destroy() to destroy any dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 4598667b4d Ticket #2919: implement WST_VISIBLE widget state.
(widget_is_focusable): new widget API.
Use it to detect if widget can take focus or not.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-04-11 17:06:28 +03:00
Andrew Borodin daf21d8315 Clarify init and destroy of dialog.
(group_default_callback): NULLify list of widgets after destroy.

(dlg_default_callback): do nothing in MSG_INIT and MSG_DESTROY handlers.

(dlg_destroy): send MSG_DESTORY to dialog to allow it destroy it's
private data. MSG_DESTROY is a last message sent to dialog before
desctuction.

(edit_dialog_callback): use MSG_DESTROY instead of MSG_END to deinit
editor.

(midnight_callback): use MSG_DESTROY instead of MSG_DESTORY to deinit
file manager.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin 9ee52e77c3 Ticket #4179: code clean up before 4.8.27 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin cc470c615a (tty_clear_screen): rename from clr_scr and move to lib/tty.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin 258e6bcd57 Ticket #4142: ctrl-l shortcut (refresh screen) is broken.
This bug was introduced in 2e734e5618.

(dlg_handle_key): fallback to dialog_map if shortcut is not defined in
filemanager/editor/viewer/diffviewer key map.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-11-21 14:54:27 +03:00
Andrew Borodin b9cf2898c4 Ticket #4057: blank screen with invisible error.
How to reproduce:
Run `mcedit .` from an empty shell. mc used to show an error banner. Now
it shows black-on-black error message.

do_refresh() function expects that at least one fullscreen dialog (file
manager, editor, etc) is existing in the dialog stack. If query dialog
is created before any fullscreen one, do_refresh() do nothing.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-11 10:43:05 +03:00
Andrew Borodin bcdd81c628 WGroup: support colors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin d38eb77c8c WGroup: support state.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin f0e13d8fba Make WST_CONSTRUCT a default widget state. 2020-03-08 20:17:32 +03:00
Andrew Borodin f39f05632a WGroup: support key events.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin 2e734e5618 Make keybind map a member of Widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin 326c4ce1d9 (dlg_key_event): clarify post-hotkey handling.
Current widget is the sender of MSG_UNHANDLED_KEY message.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin c2aadb2ad5 WGroup: support mouse events.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin 4b3b49faad (widget_draw): support groups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin d1f9e698ac WDialog: use WBackground in frameless dialogs (screens).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:32 +03:00
Andrew Borodin ed9199e94e Create WFrame widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:17:02 +03:00
Andrew Borodin c77dc88ff9 WGroup: support draw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin 2a265e38a0 WDialog set/change size API: move to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin 04f04ba130 Send new widget size as parameter of MSG_RESIZE message.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin 045816ed13 (dlg_set_position): use WRect.
(widget_set_size_rect): new API.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:15:37 +03:00
Andrew Borodin 6acd8475dd Update cursor API: support groups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:13:35 +03:00
Andrew Borodin e9d23e90f0 Find widget API: support groups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:13:33 +03:00
Andrew Borodin fdf3d9c3b7 WGroup: implement init & destroy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:12:45 +03:00
Andrew Borodin b9cf650605 Move send broadcast message API from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:55 +03:00
Andrew Borodin 22ad70ed02 Move widget add/del API from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:55 +03:00
Andrew Borodin 6eedbce076 Move widget selection API from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:11:39 +03:00
Andrew Borodin d575c7058b Move winch_pending member from WDialog to WGroup.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:09:13 +03:00
Andrew Borodin e4e0070db5 Ticket #2919: implement WGroup widget.
WGroup is the base widget for complex objects such as windows, dialog
windows, etc.

Initial steps:
  * move widget list of dialog into WGroup class;
  * inherit WGroup from Widget;
  * inherit WDialog from WGroup.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-03-08 20:09:12 +03:00
Andrew Borodin 31b37a1f79 Ticket #4050: code cleanup before 4.8.25 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin 65e12d1a9f (dlg_redraw): rename to dlg_draw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin 35f14be028 (widget_move): rename to widget_gotoyx.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin baca4ba045 Widget and WDialog API changes:
* (widget_destroy): new API to destroy widget.
  * (del_widget): don't destroy widget after remove it from dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-12-15 12:53:20 +03:00
Andrew Borodin 297391fd60 (dlg_adjust_position): rename to widget_adjust_position and make public.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin 29110e5681 Move history operation routines from lib/widget/history.c to lib/mcconfig/history.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin 37ffc02422 Ticket #117: refactoring of SIGWINCH hangling.
Use pipe to collect consecutive raised SIGWINCH events.
Then handle multiple events at a time treating them
as a single one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:22:21 +03:00
Andrew Borodin 3b997974ec Refactor dialog command execution. 2019-04-27 19:29:24 +03:00
Andrew Borodin 433ae45bdd Clarify checks of dialog and widget existence.
Widget list in the dialog cannot contain empty elements.
Dialog list cannot contain empty elements too.
Therefore simplify some checks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 13:10:00 +03:00
Andrew Borodin 1dd8a47987 Ticket #3955: code cleanup before 4.8.23 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:44:40 +03:00