Commit Graph

77 Commits

Author SHA1 Message Date
Andrew Borodin a6f5767f3f Use signed long instead of unsigned long for binded actions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:08 +03:00
Andrew Borodin 2789e6e390 Ticket #3431: add missing default cases.
Introduce -Wswitch-default check.

Some minor cosmetics.

Thanks Andreas Mohr <and at gmx dot li> for original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:50 +03:00
Andrew Borodin b698b7e834 Ticket #3435: clang compiler fixes/cleanups.
Since O_* macros are used in lib/global.h, include <fcntl.h> there.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:49 +03:00
Andrew Borodin 454479549c Update copyright years. 2015-02-26 09:12:08 +03:00
Egmont Koblinger 5b243eb9ea (dlg_set_size): clarify comment and hangling of DLG_TRYUP flag.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-03-24 16:20:41 +04:00
Andrew Borodin e5203cb023 Fix name of FSF in all *.c files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:17 +04:00
Andrew Borodin bf474e1241 Ticket #2165: basic version of the user-friendly skin selector.
Thanks Egmont Koblinger and Vitaliy Filippov for original patches.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-11 15:13:09 +04:00
Andrew Borodin f0da49345a Collapse list of copyright years to ranges. Add 2014 year.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-10 16:27:03 +04:00
Andrew Borodin 29f6dd2a84 Use g_list_free_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-11-25 13:47:40 +04:00
Slava Zanko 0ed4a91d7d Reduce cppcheck warnings (style) in lib subdirectory.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-11-25 13:47:39 +04:00
Slava Zanko 0d489acd58 cppcheck: reduce variable scope.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-11-25 13:47:39 +04:00
Andrew Borodin c7b7a299e3 Ticket #3084: (dlg_init): fix order of messages sent to widgets during dialog initialization.
If checkbox is the first focusable widget in a dialog, it taken the MSG_DRAW
message after MSG_FOCUS one and therefore wasn't highlighted.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-11-07 15:59:26 +04:00
Andrew Borodin a6b3cc8f24 Typo.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:14:08 +04:00
Egmont Koblinger 930f683019 Handle newline and tab with shift/ctrl modifiers correctly.
MC already has its own half-ready trick: when pasting with Shift-Insert,
using the X11 extension, the newline ("Enter" as mc calls it) with the
Shift modifier pressed gets converted to a "Return", and in the editor
the Return character inserts a non-indenting newline. This makes pasting
better in terminals not supporting bracketed paste, however, it has some
problems that this commit addresses:

  * Shift+newline gets this special treatment, but Ctrl+newline gets
    dropped. Hence e.g. when pasting in Gnome-terminal with Ctrl+Shift+V
    all the newlines will be missing. This commit adds the same
    non-indenting newline behavior to Ctrl+Newline and Ctrl+Shift+Newline.

  * The code forgets about Tab that also needs special treatment:

    - Most terminals send \e[Z on Shift+Tab, this is not handled by MC
      at all, moreover it causes a hang for about a second. This commit
      teaches this sequence to MC. This is especially useful when no X11
      is available, because there Ctrl+Tab is identical to Tab, so the
      backwards tab feature is not available. With this commit Shift+Tab
      becomes a backwards tab too on all terminals that emit \e[Z.

    - When pasting to the editor, Shift+Tab, Ctrl+Tab and Ctrl+Shift+Tab
      should all insert a tab for the same reason mentioned at the newline.

    - It would look inconsistent in the keymap files to have logical code
      such as "backtab" instead of "shift-tab" and friends, hence get rid
      of KEY_BTAB and use KEY_M_SHIFT | '\t' instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-03 11:41:58 +04:00
Andrew Borodin 48abe8735f Rename functions:
init_widget -> widget_init
create_dlg -> dlg_create
init_dlg -> dlg_init
run_dlg -> dlg_run
destroy_dlg -> dlg_destroy

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin 0adf569b54 (dlg_overlap): rename to widget_overlapped()
...and move to lib/widget/widget-common.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin c7da120588 (dlg_replace_widget): rename to widget_replace()
...and move to lib/widget/widget-common.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin 970cfd881a (dlg_mouse_event): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin 01c5cf66a5 (dlg_default_callback): get rid of extra type cast.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin 6d31d85f0d Use tty_draw_box instead of draw_box() to draw frames.
* (draw_box): remove.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:02 +03:00
Andrew Borodin 30959e0b7d Clarify widget redraw in runtime.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-03-09 16:04:19 +04:00
Andrew Borodin 30dbb79655 (del_widget): fix memory leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 15:35:35 +04:00
Andrew Borodin 3fc490ea12 (add_widget_autopos): don't access to NULL widget.
(del_widget): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 15:35:35 +04:00
Andrew Borodin 281209c79d lib/widget/*.[ch]: fix indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-20 13:27:10 +04:00
Andrew Borodin 665d238ffa Unify widget and dialog message handling.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:44:14 +04:00
Andrew Borodin 497b69c106 Remove DLG_WANT_IDLE. Use W_WANT_IDLE instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:44:13 +04:00
Andrew Borodin 843dcd104e Rename Dlg_head to WDialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:47 +04:00
Andrew Borodin 0078874613 Rename default callbacks of widget and dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:47 +04:00
Andrew Borodin f14cee4e18 Remove DLG_REVERSE flag.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:46 +04:00
Andrew Borodin e009cd9ea9 (create_dlg): ignore empty string as title.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:45 +04:00
Andrew Borodin e6f467c875 Add flags to place widgets with horizontal and vertical centering in dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:45 +04:00
Andrew Borodin c6ddd28366 Unification of widget and dialog callback functions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:44 +04:00
Andrew Borodin 05d7f3c84e Aggressive use WIDGET macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:44 +04:00
Andrew Borodin 2a95cb2ffd Ticket #2919: widget system improvements and unifications.
First step: derive dialog from widget.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-19 21:42:44 +04:00
Andrew Borodin 82bb9c39da Define winch_flag as volatile sig_atomic_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-09 10:05:13 +04:00
Andrew Borodin 908e747861 Optimization of ini files load.
Some ini files (keymaps, skins) are loaded in read-only mode. For those
files, we don't need load and keep comments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-07-31 14:50:11 +04:00
Slava Zanko 94bd4b1f78 Code indentation.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-07-17 17:04:05 +04:00
Andrew Borodin 83e3945c24 Ticket #2817: add mouse handler to the dialog.
Currently, dialog itself doesn't handle mouse events. It just
resends mouse event to each its widget. If we can several overlapped
widgets (especially, menu bar), there is some problem to decide which
widget must get event at first.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-05-30 13:23:12 +04:00
Andrew Borodin 08f2593ae9 Ticket #2608: mc hangs while switching to opened screen.
The bug was introduced in 6ad4b2466b.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-04-09 21:16:23 +04:00
Andrew Borodin dea3aa9023 Reorder fields in mc_global struct and change type for some of them.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-19 11:06:00 +03:00
Andrew Borodin 7e6ff9caf9 Allow override standard dialog actions in some dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Andrew Borodin dc3d161e71 Don't get dialog hotkey from disabled widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Andrew Borodin 65d9697d69 Fixed widget redraw order in dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Andrew Borodin fe34f89a19 Added dlg_set_top_widget() function
...to move widget to the top of widget list and make it current.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Andrew Borodin 6ad4b2466b Allow add and remove widgets in runtime.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Andrew Borodin 33d25a0c8f Put global mouse coordinates to widgets.
Now each widget gets absolute coordinates of mouse pointer and decides
itself how to handle them.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Andrew Borodin 7956b64e54 Fix mouse handling in dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Andrew Borodin c3f359c82b Ticket #2608: widget enhancements.
New method of widget ID assignment:
now widget ID is a value of unsigned long type. Dlg_head structure now has
new filed widget_id that contains a ID of the next added widget. When new
widget is added into dialog, widget_id is set as ID of it and then
incremented.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-08 10:37:55 +03:00
Slava Zanko 6c32fa3b84 Added function mc_config_get_full_path() for search user's config files by short names.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-12-06 16:24:10 +03:00
Slava Zanko 0138645541 Ticket 1551: Update GPL version from 2 to 3
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-10-18 14:08:34 +03:00