Commit Graph

13632 Commits

Author SHA1 Message Date
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 47f9b77194 WMenuBar: remove WMenuBar::is_active. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin 0df5ad5686 WInput: avoid double draw on resize.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin fd7c6c1c5d Menu: avoid double draw on resize.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin 91c72122a8 (widget_set_size): send MSG_DRAW after MSG_RESIZE.
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 aae31dbe43 WView: remove WView::active. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin ac35ab0401 WTree: remove WTree:active. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin e1a2e8f8ec WButton: remove WButton::selected. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin ad166313a4 WListbox: remove WListbox::focused. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +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 3debdac657 (menubar_callback): refactoring of menu draw after get focus and resize.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin 41144d619c (widget_set_state): return cb_ret_t instead of gboolean.
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 a64a7ba2fa Use WOP_SELECTABLE option in menu.
If menu is not active, it is not selectable also in order to disallow
select and focus the inactive menu.

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
Sergey Sharybin 9c3fe04114 Ticket #3686: initial support of CUDA syntax highlighting.
Based on existing cxx.syntax file with some extra keywords added.

Colors could be tweaked a bit still, and perhaps list of keywords
and built-in types could be extended further, but it should be a
good starting point already.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:13:51 +03:00
Andrew Borodin 74dda7352e Merge branch '3641_cleanup'
* 3641_cleanup:
  lib/mcconfig/paths.c: reduce scope of 'homedir' var.
  lib/mcconfig/paths.c: cleanup.
  doc/man/mc.1.in: fix substitution markers.
  src/vfs/fish/fish.c: apply coding guidelines.
  More use link_isdir().
  Get rid of #define const_cast().
  Fix typos.
  Define NCURSES_CONST if curses library doesn't define it.
  (ftpfs_open_data_connection): fix enable/disable interrupt key.
  (ftpfs_open_data_connection): fix socket leak in case of unsuccessful ftp connection.
  (dlg_adjust_position): refactoring.
  Ticket #3641: code cleanup before 4.8.18 release.
2016-09-11 11:11:47 +03:00
Mooffie 61f4ef98b9 lib/mcconfig/paths.c: reduce scope of 'homedir' var.
To ensure that nobody uses the 'homedir' variable in the future without
initializing it first, we make it private to the function, thereby effectively
removing it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Mooffie 92889819ea lib/mcconfig/paths.c: cleanup.
We can conclude, by reading their GLib source[1], by their documentation,
and by looking at how popular programs use them[2], that the functions
g_get_user_{config,cache,data}_dir() don't return a NULL or empty string.
So the handling of this case can go.

[1] https://git.gnome.org/browse/glib/tree/glib/gutils.c
[2] E.g., google "g_get_user_data_dir".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin d32f123d9c doc/man/mc.1.in: fix substitution markers.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin 0e22eae836 src/vfs/fish/fish.c: apply coding guidelines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin f408e9a755 More use link_isdir().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin 6127e5aea6 Get rid of #define const_cast(). 2016-09-11 11:11:01 +03:00
Andrew Borodin b22e376abf Fix typos. 2016-09-11 11:11:01 +03:00
Andrew Borodin 0df9d1ce0b Define NCURSES_CONST if curses library doesn't define it.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin 01428beb2a (ftpfs_open_data_connection): fix enable/disable interrupt key.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin ba20fac1b3 (ftpfs_open_data_connection): fix socket leak in case of unsuccessful ftp connection.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +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
Sergey Sharybin 834c09a283 Ticket #3683: initial support of GLSL syntax highlighting.
This is an initial support of GLSL syntax highlight for mcedit.
Keyword and and built-in function lists are based on glsl-mode.el
from emacs (which is originally written by Xavier Decoret and
Jim Hourihan).

Supports GLSL 4.5.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-08-31 11:06:28 +03:00
Andrew Borodin 03742623de Merge branch '3668_mcedit_load_bookmarks'
* 3668_mcedit_load_bookmarks:
  Ticket #3669: mcedit: don't kill bookmarks when open file from "Find File" dialog.
2016-08-26 15:07:46 +03:00
Andrew Borodin f2a76c2961 Ticket #3669: mcedit: don't kill bookmarks when open file from "Find File" dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-08-26 15:07:13 +03:00
Andrew Borodin e60cc8f029 Merge branch '3669_load_passive_panel'
* 3669_load_passive_panel:
  Ticket #3669: cannot change directory in the active panel
2016-08-16 14:28:45 +03:00
Andrew Borodin 5475e35378 Ticket #3669: cannot change directory in the active panel
...after changing VFS in the passive one.

Steps to reproduce:
1. Make left panel active.
2. Press F9 to open menu, select 'Right', then 'FTP link...'
3. Insert a valid FTP URL and press OK (or Enter). Wait for finish of FTP
directory reading.
4. Left panel is still active. Try to change CWD here by pressing Enter
or using command line.

Result: error messages 'ftpfs: CWD failed' and 'Cannot change directory'
or 'Cannot chdir to...'.

The problem: when VFS is changed in the passive panel, VFS CWD is
changed accordingly. Then active panel tries use the new VFS CWD.

The solution: restore VFS CWD after changing VFS in the passive panel.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-08-10 10:45:41 +03:00
Andrew Borodin c47f112fb8 Merge branch '3075_x_enter_bind'
* 3075_x_enter_bind:
  Ticket #3075: (midnight_callback): make alt-enter, ctrl-enter, ctrl-shift-enter bindable.
2016-08-04 10:28:23 +03:00
Mooffie 4a0f265d95 Ticket #3075: (midnight_callback): make alt-enter, ctrl-enter, ctrl-shift-enter bindable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-08-04 10:23:29 +03:00
Andrew Borodin 5313f3917a doc/man/ru/mc.1.in: add missing line break. 2016-08-04 09:54:52 +03:00
Andrew Borodin 7767762dce Merge branch '3641_cleanup'
* 3641_cleanup: (23 commits)
  Cleanup unused macros.
  (mc_search__translate_replace_glob_to_regex): cleanup compile warning.
  mcedit: syntax: associate node executables with JavaScript syntax.
  (mc_ctl): join conditions.
  (vfs_strip_suffix_from_filename): refactoring.
  lib/tty/key.h: remove declaration of unimplemented function.
  Fix default shortcut for "HotList" command.
  (vfs_setup_cwd): move directory test to separate function.
  (setup_panels): clarify panel size caclulation.
  (panel_update_cols): move from panel.c to layout.c.
  (tree_move): support VFS.
  (check_callback): clean unneeded type casting.
  Refactoring of widget's position and size calculation.
  Refactoring of dialog's position and size calculation.
  Ticket #3562: fix Glib-critical asserts in empty WListbox.
  (mc_search_set_error): cleanup compile warning on older gcc compilers:
  Find file: fix directory search order to be depth-first again.
  (variable_completion_function): cleanup Wconditional-uninitialized warning.
  Minor refactoring of mc shutdown.
  (make_symlink): trivial refactoring.
  ...
2016-07-29 09:33:22 +03:00
Andreas Mohr b36cec44e3 Cleanup unused macros.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andreas Mohr d013592eb4 (mc_search__translate_replace_glob_to_regex): cleanup compile warning.
glob.c:143:21: warning: implicit conversion loses integer precision: 'int' to 'char' [-Wconversion]
                c = ++cnt;
                  ~ ^~~~~
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Mooffie b218a28a45 mcedit: syntax: associate node executables with JavaScript syntax.
Some distros name the binary 'nodejs', some 'node'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin 28e4dfd059 (mc_ctl): join conditions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin e2c62afcc7 (vfs_strip_suffix_from_filename): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin b808dc564f lib/tty/key.h: remove declaration of unimplemented function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin b862c05221 Fix default shortcut for "HotList" command.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin 9f606a6668 (vfs_setup_cwd): move directory test to separate function. 2016-07-29 09:32:04 +03:00
Andrew Borodin 2abb92d7e6 (setup_panels): clarify panel size caclulation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin 6951d70c7c (panel_update_cols): move from panel.c to layout.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin 2f8b1de05f (tree_move): support VFS.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00