Commit Graph

110 Commits

Author SHA1 Message Date
Andrew Borodin
36cc88b5f2 Reimplement widget focus/selection.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
599361b3fc (dlg_set_bottom_widget): rename to widget_set_bottom.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
d200893347 (dlg_select_widget): rename to widget_select.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
35451978f6 Rename WDialog APIs:
dlg_one_up -> dlg_select_prev_widget
dlg_one_down -> dlg_select_next_widget

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
b19ae2b938 Refactoring of change of current widget.
Add new WDialog APIs:

  * dlg_set_current_widget_next
  * dlg_set_current_widget_prev
  * dlg_get_widget_next_of
  * dlg_get_widget_prev_of

and use them:

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
240350db95 Refactoring of widget drawing to avoid multiple widget redraw.
Send MSG_DRAW message immediately after MSG_FOCUS/MSG_UNFOCUS.
Thus, the MSG_DRAW message handler is the only place where widget
should be drawn. Widget should not draw itself in other message
handlers.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
c37f9b770a WST_FOCUSED: add new state and handle it.
Notify widget's owner that widget gets or loses focus.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
c90b806728 Don't focus widget that doesn't have the WOP_SELECTABLE option.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
5ac1c5a3e0 Ticket #2919: refactoring of focus/unfocus of widgets.
Initial step: add WOP_SELECTABLE option and set it up explicitly for
widgets that can be selected.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
adc6bd83d6 (dlg_adjust_position): refactoring. 2016-09-11 11:11:01 +03:00
Andrew Borodin
fb4f4674c7 Ticket #3641: code cleanup before 4.8.18 release.
(dlg_adjust_position): don't change origin of non-centered dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin
b0e3552847 Refactoring of widget's position and size calculation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
Andrew Borodin
86fd77155e Refactoring of dialog's position and size calculation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
Andrew Borodin
7c74fd90f0 Ticket #3661: wrong handling of mouse clicks in long listing mode.
This occurs if the left panel is in long listing mode and the right
panel is in full listing mode:
When the left panel is active and you click on the right side of the
panel, the click event is directed to the (inactive) right panel instead
of the (active) left panel.

This occurs if the right panel is in long listing mode:
When the left panel is active and you click on the left panel, the click
event is always directed to the (inactive) right panel. It's impossible
to click anything on the left panel, if the right panel is in long
listing mode.

Thanks Seray Rosh <seray.rosh@web.de> for intial patch.

Initial commit: refactoring of widget selection.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-09 19:13:20 +03:00
Andrew Borodin
b4af91dfc0 Reorganize WDialog flags.
* DLG_FULLSCREEN: move and rename to WPOS_FULLSCREEN.
 * DLG_CENTER: move and rename to WPOS_CENTER.
 * DLG_TRYUP: move and rename to WPOS_TRYUP.
 * WDialog::fullscreen: remove, use WPOS_FULLSCREEN instead.
 * WDialog::compact: new field. Use instead of DLG_COMPACT.
 * WDialog:🎏 remove.
 * dlg_flags_t: remove.
 * dlg_create: add new agruments: pos_flags, compact. Remove
argument: flags.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:41:00 +03:00
Andrew Borodin
0933b08964 (dlg_set_position): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
163d9cd94a Rename DLG_WANT_TAB to WOP_WANT_TAB and move it to widget_options_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
d44220c75f If widget wants cursor, define that explicitly.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
db0d01b9d6 Add WST_MODAL state.
* WDialog::modal: remove. Use WST_MODAL instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
fd4e56bf39 WOP_TOP_SELECT: new widget option
...to place widget on top of other widgets in dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
4b72fb5f5e Join widget_state_t and dlg_state_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
0a2877edef Move WOP_WANT_IDLE option to widget_state_t flags
...and rename to WST_IDLE.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
b337287336 Move WOP_DISABLED option to widget_state_t flags
...and rename to WST_DISABLED.

  * Widget::state: new field.
  * (widget_set_state): new function.
  * (widget_set_options): symplify.
  * (input_set_options): remove.
  * MSG_ENABLE, MSG_DISABLE: new messages.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
f5a1dfcef4 (widget_get_options): new widget API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
4a0cd948df Change prefix of widget options: W_ -> WOP_.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
dcf2ac11c1 (dlg_set_top_or_bottom_widget): move to proper file section.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
284a19aff1 (find_widget_type): Make Solaris Studio happy
Make Solaris Studio 12.4 happy.

"dialog.c", line 1029: warning: argument #2 is incompatible with prototype:
        prototype: pointer to const void
        argument : pointer to function (...) returning enum (...)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
68d7f53039 lib/widget/dialog.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
16f229114a Ticket #3598: cleanup some -Wcast-qual compiler warnings.
Introduce CONST_WIDGET helper and use it.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:43 +03:00
Mooffie
438e841226 Rename mouse.was_drag to mouse.last_msg.
Get rid of the 'click' variable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 15:29:55 +03:00
Andrew Borodin
8490ca7be4 Drop old mouse API and use the new one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 15:29:55 +03:00
Mooffie
781b810c13 Fix menu handling.
We now send mouse events to widgets in reverse Z-order, as done in common GUIs.
This makes it easy to implement "invisible" menubars correctly.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 15:29:55 +03:00
Andrew Borodin
471ea781ca Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:10 +03:00
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