Commit Graph

1505 Commits

Author SHA1 Message Date
Andrew Borodin
cebede5e84 (diff_two_paths): optimizate path comparision.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
72056890a7 (diff_two_paths): minor optimization: exit loop ASAP.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
02effb2499 (diff_two_paths): reduce variable scopes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew V. Samoilov
bf5abff937 (buttonbar_call): fix possible NULL dereference.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2017-11-17 16:01:29 +03:00
Andrew Borodin
7772f00aab Ticket #3780: code clean up before 4.8.20 release.
Direct include <limits.h> for MB_LEN_MAX.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 15:59:44 +03:00
Maksim Dzabraev
16b569986e Ticket #3870: fix INPUT_COMPLETE_CD in quick widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-28 19:18:23 +03:00
devzero
7f9b333861 Ticket #3616: speed up of utf-8 normalization.
When content of a large directory is being sorted by file names, a
significant amount of CPU time is spent in str_utf8_normalize() that is
called from str_utf8_create_key_gen().

For example, /usr/bin/ contains 5437 files on my Archlinux box. Running
mc /usr/bin/ /usr/bin/ takes approx. 75 000 000 CPU instructions to sort
file names, or 25% of total program run time. From these 75 000 000
instructions, 42 500 000 instruction are spent in str_utf8_normalize().

str_utf8_normalize() uses g_utf8_normalize() to do the work.
g_utf8_normalize() is a heavyweight function, that converts UTF-8 into
UCS-4, does the normalization and then converts UCS-4 back into UTF-8.

Since file names are composed of ASCII characters in most cases, we can
speed up str_utf8_normalize() by checking if the heavyweight Unicode
normalization is actually needed. Normalization of ASCII string is
no-op, so it is effectively "normalized" by just strdup().

With this patch, running mc /usr/bin/ /usr/bin/ requires just 37 000 000
instructions to sort the file names (down from 75 000 000) and 4 500 000
instuctions to do str_utf8_normalize() (down from 42 500 000).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-07-29 10:23:09 +03:00
Yury V. Zaytsev
f0414be51d Zero struct stat tv_nsec (if supported) whenever st is filled manually
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-05-17 21:18:58 +02:00
Andrew Borodin
ff1510de1f File panel: unification of terminology.
Use 'list(ing) format' instead of 'list(ing) type' and 'list(ing) mode'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
b56a77e02f Refactoring: handle panel listing mode switch in the panel level
...instead of top level.

Rename and move main/PanelListingSwitch keybind to panel/ListingSwitch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
f4eb2c47c9 Indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-14 18:54:22 +03:00
Thomas Dickey
4d46a10862 Ticket #3697: (tty_init): unify curses initialization
...for various curses implementations.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-14 14:06:13 +03:00
Yury V. Zaytsev
151b08b412 Ticket #3693: clarify that lack of noreturn attribute is on purpose
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-03-04 18:52:12 +01:00
Yury V. Zaytsev
f09d863ddf Revert "(my_exit): cleanup no attribute noreturn warning."
This reverts commit b91ab44b43.
2017-03-04 18:27:02 +01:00
Mooffie
ac23a4807c Pressing <right> and <left> in hotlist dialog doesn't refresh it.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-26 12:38:39 +02:00
Yury V. Zaytsev
ab4fcb6d30 Revert "Ticket #3687: store the 'hotlist' file in data dir, not config dir."
This reverts commit 306b30ed30.
2017-02-24 21:32:01 +01:00
Mooffie
5ea5c5deb6 Ticket #3760: Fix aborts of MSG_MOUSE_DOWN.
This patch was supposed to get committed as part of #3571 but this never
happened. We commit it now as we depend on its functionality for the next
commit.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-19 00:04:38 +02:00
Andrew Borodin
e83409b6d7 Ticket #3766: add_widget_autopos() doesn't remove focus from the previously focused widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-02-09 17:49:34 +02:00
Mooffie
bc46978036 (dialog_switch_list): simplify the listbox selector.
We use the new run_listbox_with_data().

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-29 23:32:13 +02:00
Mooffie
11c1aff4d3 Ticket #3763: introduce run_listbox_with_data().
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-29 23:32:04 +02:00
Andrew Borodin
e9fd11bfcd Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 19:12:55 +03:00
Andrew Borodin
28ca14d73a Aggressive use of whitespace() and whiteness() macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
e0c02c9c77 WCheck, WRadio: send MSG_MOTIFY without parameter.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andreas Mohr
469dc1352b (tty_color_get_name_by_index): cleanup format compiler warning.
Found by GCC 6.2.0.

color-internal.c:186:33: error: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'int' [-Werror=format=]

Signed-off-by: Andreas Mohr <and@gmx.li>
2017-01-22 18:44:22 +03:00
Andrew Borodin
37de8e6253 (mc_search__g_regex_match_full_safe): don't use negative string length.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
1ff4005228 Use g_queue_free_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Mooffie
c0abaa6508 (mc_search__cond_struct_new_regex_ci_str): add documentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
8b14798cc4 setup: split integer and boolean options.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
c4550374b2 Change type from int to gboolean for variables controlled by checkboxes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
5e2f4a8069 WCheck: change type of 'state' from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
76ee3b1644 WCheck: remove unused C_CHANGE.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
d7ecbd51cf (radio_callback): cosmetics.
* [MSG_HOTKEY]: remove extra block.
 * [MSG_KEY]: do not fall through.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
aa6055b6aa Ticket #3693: code cleanup before 4.8.19 release.
WRadio: remove unused 'state' field.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
aae43d362f (vfs_adjust_stat): new VFS API, currently used to calculate st_blocks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
bf40acf420 Clarify usage of st_rdev. Use it if HAVE_STRUCT_STAT_ST_RDEV is defined.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
061d60b82f Modify VFS APIs.
* vfs_s_stat: make public.
  * vfs_s_lstat: likewise.
  * vfs_s_fstat: likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
a8a8e85279 (vfs_s_default_stat): define st_blksize and st_blocks explicitly.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrey Gursky
4c418047b2 Ticket #3575: preserve timestamps with nanosecond precisions during file copy
MC truncates timestamps during file copy and drops sub-second precision.

Make use of utimensat(), introduced in Linux kernel 2.6.22 (and since
2.6.26 compatible with POSIX-1.2008).

Signed-off-by: Andrey Gursky <andrey.gursky@e-mail.ua>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-25 08:46:10 +03:00
Mooffie
12812968c0 extfs: fix documentation of allowed date formats.
We also improve the documentation of vfs_parse_filedate(), which does the
actual work.

Note that in the user-facing documentation (extfs/helpers/README) there are
two things we prefer *not* to mention about vfs_parse_filedate's ability:

* Accepting the format "MM-DD-YY hh:mm[:ss]", as this two-digit year is
  more likely to confuse readers of such dates.

* Accepting '/', instead of '-', as the separator in MM-DD-YYYY. (Considering
  that some scripts do use '/', maybe we should mention it?)

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-13 13:14:43 +03:00
Mooffie
1d9cd68ac3 Ticket #3589: make hex search work for binary data.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-10 18:40:02 +03:00
Andrew Borodin
8550044635 Ticket #3731: add new MSG_CHANGED_FOCUS message.
This message is sent to widgets'owner when widget's focus state is
changed.

Find file dialog: fix initial draw of ignore directories input line.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-10 18:31:03 +03:00
Sorin Sbarnea
0cf8e8f6e0 Ticker #3736: mc_tmpdir() use a buffer of only 64 characters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-07 09:47:55 +03:00
Mooffie
eff4d74743 (mc_search__hex_translate_to_regex): remove explicit handling of 0x prefixes.
scanf("%x") knows to eat up this prefix[1][2], so we don't need to do this
ourselves.

[1] K&R's "The C Programming Language" documents "%x" as "hexadecimal
    integer (with or without leading 0x or 0X)"
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
f96b11cf66 (mc_search__hex_translate_to_regex): rename variables.
Now that the string isn't duplicated there's nothing "temporary" about it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
b2cbddb534 (mc_search__hex_translate_to_regex): avoid string duplication.
We can read from the source string directly, as we no longer modify it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
78994224ce (mc_search__hex_translate_to_regex): clean up handling of 0x prefixes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
7be9334e45 Fix quotes handling.
Note: considering that this feature hasn't worked, we may consider removing it
entirely or partially (e.g., escaping) in order to simplify the code, as nobody
has grown used to it. It seems, based on the "hex mode" mentioned in the manual
page, that in the past there was no "normal" search in hex mode, and quoted
strings were the only easy way to look for text. This is no longer the case
nowadays.

Note: the characters in the quoted string are copied out as-is to the regexp.
No regexp-quoting is currently done. We may want to revisit this issue when we
work on ticket #3695.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
64e6ccef7f Handle invalid characters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
cc8fcdcfc0 Fix trailing whitespace problem.
sscanf() returns EOF when it reaches the end of the string. Our code
erroneously interprets this as if a number was read. The fix: we test for an
explicit '1'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
b25af93874 Report errors to the user.
Instead of silently accepting invalid patterns, we notify the user of errors.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:26 +03:00
Mooffie
306b30ed30 Ticket #3687: store the 'hotlist' file in data dir, not config dir.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:48:02 +03:00
Andrew Borodin
8002e52293 (mc_config_init_config_paths): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Andrew Borodin
496abc0e1f Rename mc_config_get_profile_root() to mc_get_profile_root()
...and move it out from lib/mcconfig.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Mooffie
239a8d0117 Ticket #3684: replace $MC_HOME with $MC_PROFILE_ROOT, a better "profile" mechanism.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-29 11:10:19 +03:00
Mooffie
e68f105e0e Ticket #3718: Options/Layout/Equal split gets reverted.
WRadio sends MSG_NOTIFY with MSG_KEY as parameter to it's owner
when selected item is changed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-24 09:41:07 +03:00
Mooffie
7f81194304 (mc_search_run): document the return value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
2356acc26d NULL-ize some variables to make unit tests happy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
9a39e35dc3 Use g_assert() instead of assert(3).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
eec71bccff Ticket #3703: fix potential NULL dereference.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
0e2833e398 MSG_INIT is handled by default.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
9c43890f0d (my_systemv): cleanup unreachable-code warning.
Compiler with my_exit() 'noreturn' knowledge will complain about
never reachable break statement.

Reported by clang compiler.

(Maybe there is a better code sequence)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
7e689e8e43 (vfs_die): cleanup no attribute noreturn warning.
utilvfs.c: In function 'vfs_die':
utilvfs.c:354:1: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]
 vfs_die (const char *m)
 ^~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
b91ab44b43 (my_exit): cleanup no attribute noreturn warning.
utilunix.c:360:1: error: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
38fc00669d lib/serialize.c: cleanup -Wformat-signedness warning.
serialize.c: In function 'mc_serialize_str':
serialize.c:116:34: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
     return g_strdup_printf ("%c%zd" SRLZ_DELIM_S "%s", prefix, strlen (data), data);
                                  ^
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 5 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_serialize_str()"
                   ^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
                      FUNC_NAME
                      ^~~~~~~~~
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 6 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_serialize_str()"
                   ^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
                      FUNC_NAME
                      ^~~~~~~~~
serialize.c: In function 'mc_deserialize_config':
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:301:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:313:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:325:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andrew Borodin
9df8bc2d12 (vfs_path_deserialize): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andrew Borodin
de0e960de5 (vfs_path_serialize): get rid of dynamic string allocation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
31b0bcd584 (mc_search__hex_translate_to_regex): cleanup -Wformat-signedness warning.
hex.c: In function 'mc_search__hex_translate_to_regex':
hex.c:79:39: error: format '%x' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=]
         if (sscanf (tmp_str + loop, "%x%n", &val, &ptr))
                                                ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Egmont Koblinger
0cceb99c2e Ticket #3711: support color aliases in skin files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 10:52:37 +03:00
Andrew Borodin
4247120b4a (tty_init): support curses other than ncurses.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 10:46:18 +03:00
Andrew Borodin
787e24966d Ticket #3697: fix broken compatibility with ncurses.
Revert "Ticket #3665: fix compatibility with netbsd curses."

This reverts commit 38d4c655d3.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 10:46:18 +03:00
Andrew Borodin
b19c336951 (parse_256_or_true_color_name): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 15:56:59 +03:00
Egmont Koblinger
31320b597c Ticket #3145: support for True Color (16 millions colors).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 15:56:59 +03:00
Andrew Borodin
5169a9dd95 Ticket #3714: (dialog_change_screen_size): fix dialog resizing order.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 12:36:57 +03:00
Mooffie
607eb74cbb Ticket #3721: clean up radio widget's MSG_CURSOR.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 12:31:47 +03:00
Andrew Borodin
83504f2bb5 Revert "(size_trunc_len): align to properly use either IEC or SI prefixes with the unit B (byte)."
This reverts commit bae814d0d4.
2016-11-08 13:19:37 +03:00
Andrew Borodin
e3d457eb3d Revert "Ticket #3666: (size_trunc_len): fix segfault because of small buffer usage."
This reverts commit 3024f309c2.
2016-11-08 13:19:29 +03:00
Michael Osipov
3024f309c2 Ticket #3666: (size_trunc_len): fix segfault because of small buffer usage.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-06 18:30:41 +03:00
Michael Osipov
bae814d0d4 (size_trunc_len): align to properly use either IEC or SI prefixes with the unit B (byte).
Additionally always put a space between number and unit which is
required by the norms.

It is important to note that really small buffers have to be bigger than it
appears because they store bytes and non-Latin scripts need more than one byte
with UTF-8 to encode them, e.g., the string "1023 МиБ" in Russian requires
11 bytes + null terminator.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-26 13:33:12 +03:00
Michael Osipov
b3867a6e15 Ticket #3666: Improper use of IEC and SI prefixes for size in size_trunc().
size_trunc() has been aligned to properly use either IEC or SI prefixes with
the unit B (byte). Additionally always put a space between number and unit
which is required by the norms.

Obsolete gettext message ids have been removed and some cleaned up for
duplicate words or leading spaces.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-26 13:33:12 +03:00
Andrew Borodin
716479ba4f Ticket #3700: fix segfault after switch left panel to info mode.
(widget_replace): if new widget cannot take focus, move focus to other widget
before widget replacement.

In our case, the focused file panel is replaced by Info one. Info panel
a) isn't selectable (it never takes focus) and b) uses CWD of current
panel. Therefore focus must be moved to other file panel to make it
current and correctly set up it's CWD before first draw of Info panel.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-23 08:08:15 +03:00
Andrew Borodin
ef5f1fa3eb Ticket #3672: allow rebind TAB key to change panel.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-03 15:21:57 +03:00
Andrew Borodin
0cc22928af lib/widget/menu.c: indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:52:07 +03:00
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
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
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