Commit Graph

167 Commits

Author SHA1 Message Date
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
Andrew Borodin 8f4b9e32f1 Remove extra screen update after show help.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-10-17 13:30:03 +03:00
Andrew Borodin bb8babce1e (dlg_find_by_id): use the GLib way to find widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-09-09 12:01:56 +03:00
Andrew Borodin ba86de945c Optimization of walking in dialog widgets.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-09-09 12:01:55 +03:00
Andrew Borodin c4b95bcd32 Ticket #2576: fix of symbols duplication.
dialog_map, input_map and listbox_map variabels are declared and defined twice.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-07-14 21:46:59 +04:00
Andrew Borodin 17033652ee Revert "Ticket #2453: aggressive screen repaint"
This reverts commit f809e6cf7a.

While navigating in main menu (from one submenu to another one)
or after closing a dialog, the screen is blinking.
2011-07-09 20:39:46 +04:00
Andrew Borodin f809e6cf7a Ticket #2453: aggressive screen repaint
... to avoid artefacts after printing of non-printable symbols.

(tty_touch_lines): new function to mark modified lines of screen.
(do_refresh): mark lines as modified before redraw of non-fullscreen dialog
and clear entire screen before redraw of fullscreen dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-07-08 13:51:41 +04:00
Andrew Borodin 82b27ead4d Optimization of history load.
Formerly, each widget loaded its history self in its constructor.
Thus, history file was read as many times as many widgets with history
are in dialog.

Now all widget histories are read from ${XDG_CACHE_HOME}/mc/history
file at one time after dialog initialization.

The ev_history_load_save_t event is apllied to load  histories.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-06-21 16:13:10 +04:00
Andrew Borodin cff5925598 Optimization of history save.
Formerly, each widget saved its history self in WIDGET_DESTROY stage.
Thus, history file was read and written as many times as many widgets
with history are in dialog.

Now all widget histories are written to ${XDG_CACHE_HOME}/mc/history
file at one time before dialog destruction.

An ev_history_load_save_t event type is created to use new event engine
to save histories.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-06-21 16:13:10 +04:00
Andrew Borodin 3aa74a2320 Added event_group member to the Dlg_head structure
...to start use the new event engine in widgets.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-06-21 16:13:10 +04:00
Andrew Borodin 05ae0b187d Ticket #2459: if active panel changed type from file listing to info, inactive panel is not become active.
How to reproduce:

1. Run mc.
2. Change both panels to listing modes.
3. Switch to the right panel.
4. Switch type of active right panel to info using menu.

Result: left panel is not active.
Expected result: left panel must become active.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-05-04 17:07:25 +04:00
Andrew Borodin d92a2a4fd6 Get rid of some function forward declarations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-04-13 13:37:46 +04:00
Andrew Borodin f83bdadfa8 Ticket #2520: SIGINT generated by Ctrl-g pressing closes file panels.
When SIGINT signal is raised, the CK_Cancel message is handled by
dlg_execute_cmd() and midnight_dlg is closed.

The solution: CK_Cancel is sent to current dialog via callback, and if
current dialog doesn't handle CK_Cancel message, then handle it with common
way using dlg_execute_cmd().

Since Ctrl-g is used to generate SIGINT in MC, remove this shortcut from
all sections of keymaps except the [dialog] section.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-03-30 16:17:16 +04:00
Slava Zanko f40887c3c6 Lib: removed includes to "src" directory
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-03-21 23:55:52 +02:00
Slava Zanko a01b8edd7a Use events for suspend mc (by pressing on CTRL+Z)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-03-21 23:55:52 +02:00
Slava Zanko aad40e52fb Moved mc_refresh() to lib/widget
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-03-21 23:55:52 +02:00
Slava Zanko 5f8a5e4290 Use events for calling help window
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-03-21 23:55:52 +02:00
Slava Zanko 3634716374 Moved input_map, listbox_map and dialog_map variables to 'lib' subdirectory.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-03-21 23:55:51 +02:00
Slava Zanko 6016620f42 Remove backlinks from lib to src - move global variables(used in lib) to mc_global structure (see lib/global.c)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-03-21 23:55:50 +02:00
Andrew Borodin 722121a575 Define keybind numbers using enum.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-03-20 19:26:08 +03:00
Andrew Borodin 50de02cfe4 Unification of keybinding names.
Most of keybind names are changed to unify that names.
Details see in doc/keybind-migration.txt file.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-03-20 19:26:08 +03:00
Andrew Borodin 912c62f564 Ticket #2459: switch to the left panel after mouse click on input line history pictogram.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-01-24 20:42:38 +03:00
Slava Zanko bbf1f4e857 Moved filemanager-related stuff to src/filemanager directory
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2010-11-24 10:51:32 +03:00
Andrew Borodin fdb61594df Cleanup of main.[ch].
All file panels related stuff was moved to midnight.[ch].

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2010-11-24 10:51:31 +03:00
Slava Zanko 08e9759283 Split file src/keybind.[ch] to lib/keybind.[ch] and src/keybind-defaults.[ch].
File src/cmddef.h now merged to lib/keybind.h

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2010-11-24 10:51:31 +03:00
Slava Zanko 62f3c368c9 Renamed keybind-related functions:
* lookup_action          -> keybind_lookup_action
* lookup_keymap_shortcut -> keybind_lookup_keymap_shortcut
* lookup_keymap_command  -> keybind_lookup_keymap_command

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2010-11-24 10:51:31 +03:00
Andrew Borodin 71364f88c3 Split lib/widget/widget.[ch] and lib/widget/wtools.[ch] files
...into small: one widget in one file.
Renamed most if WInput functions.
Minor optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2010-11-24 10:51:30 +03:00
Slava Zanko 8b018db98f Some WIDGET-related stuff moved to lib/widget directory
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2010-11-24 10:51:30 +03:00