1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-26 02:46:13 -04:00
Commit Graph

289 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Kalle Olavi Niemitalo
2bd2686672 menu_leds_info: Revert the previous change.
Revert commit 2380ea9f1b,
"menu_leds_info: Don't call msg_text."  MSGBOX_SCROLLABLE requires
a modifiable copy of the string, and msg_text provides that.  To
reproduce the crash, run ELinks in a small window, select the English
language, and choose Help -> LED indicators.
2007-03-11 00:18:33 +02:00
Kalle Olavi Niemitalo
2380ea9f1b menu_leds_info: Don't call msg_text. 2007-03-11 00:05:25 +02:00
Kalle Olavi Niemitalo
2b7788614f Type-check button arguments of msg_box.
Don't cast function pointers; calling functions via pointers of
incorrect types is not guaranteed to work.  Instead, define the
functions with the desired types, and make them cast the incoming
parameters.  Or define wrapper functions if the return types don't
match.

really_exit_prog wasn't being used outside src/dialogs/menu.c,
and I had to change its parameter type, so it's now static.
2007-03-10 23:50:56 +02:00
Miciah Dashiel Butler Masters
1a89589b13 menu_handler: Don't call get_parent_ptr for redraw events
Only call get_parent_ptr for resize events so that the menu isn't moved
to the cursor position for normal redraw events.
2007-03-03 12:44:45 +00:00
Kalle Olavi Niemitalo
cf32aba65f BFU doc: Comment on what widget_data.cdata means for WIDGET_TEXT.
Inspired by bug 935.
2007-02-17 14:17:24 +02:00
Kalle Olavi Niemitalo
d7e4b57146 Make instances of struct listbox_ops const. 2007-02-04 15:17:49 +02:00
Kalle Olavi Niemitalo
a5e321cb2b Make instances of struct hierbox_browser_button const.
And explicitly disable the "Save" buttons in anonymous mode,
even though they are currently inside #if 0.
2007-02-04 13:54:07 +02:00
Kalle Olavi Niemitalo
5b6dbcc879 default_listbox_ops_messages: Make static and const. 2007-01-28 14:52:09 +02:00
Kalle Olavi Niemitalo
da759b10f0 add_dlg_button_do: Let file point to const. 2007-01-28 14:44:24 +02:00
Kalle Olavi Niemitalo
be9660f7d0 Make all instances of struct widget_ops const.
And widget_type_to_ops[] too.
2007-01-28 14:41:40 +02:00
Kalle Olavi Niemitalo
d40cccef0f Make widget.ops point to const. 2007-01-28 14:38:53 +02:00
Kalle Olavi Niemitalo
b4359e0445 Explicitly compare to COLOR_MODE_MONO where appropriate. 2006-12-25 10:27:23 +02:00
Kalle Olavi Niemitalo
3a7798d72b split_line: Define text_end only ifdef CONFIG_UTF8.
If CONFIG_UTF8 is not defined, then text_end is not used, and GCC
could warn about that.  Because configure can add -Werror to CFLAGS,
the warning could then cause the whole build to fail.
2006-12-03 22:23:42 +02:00
Kalle Olavi Niemitalo
bddafe5f7e Document how timer callbacks erase timer IDs; add some assertions.
Tangential to bug 868.
2006-12-02 18:35:03 +02:00
Miciah Dashiel Butler Masters
5537a3f977 Improve performance with textareas + UTF-8 I/O
If utf8_char2cells isn't told where the string that contains
the given UTF-8 character ends, it computes that itself. Two users
of utf8_char2cells, format_textutf8 and split_line, were calling
utf8_char2cells in a loop without providing the end of the string,
resulting in numerous calls by utf8_char2cells to strlen.
With this patch, format_textutf8 and split_line each find the end
of the string once and provide it to utf8_char2cells.

This particularly improves performance with textareas, since
format_textutf8 is called multiple times each time the user interacts
with the textarea and when it must be redrawn.

Closes: Bug 823 - Big textarea is too slow with CONFIG_UTF8
2006-12-02 14:48:48 +00:00
Kalle Olavi Niemitalo
8b8cd57941 Use new macro UCS_ORPHAN_CELL for broken double-cell characters.
UCS_ORPHAN_CELL is currently defined as U+0020 SPACE, which was
already used before this macro, so the behaviour does not change,
but the code seems clearer now.

I searched for ' ' and 32 and 0x20 and \x20, and replaced with
UCS_ORPHAN_CELL wherever UCS_NO_CHAR was involved.  However,
some BFU widgets first draw spaces and then overwrite with text;
those will require a more complex fix if UCS_ORPHAN_CELL is ever
changed to some other character.
2006-11-13 00:49:59 +02:00
Kalle Olavi Niemitalo
1c5db85b1a Bug 821: Document the charsets of buffers for BFU and form input fields. 2006-10-25 19:46:01 +03:00
Kalle Olavi Niemitalo
2fd8538a72 Bug 821: kbd_field: CONFIG_UTF8 does not mean widget_data->cdata is UTF-8.
The current rules are:

             term.utf8
CONFIG_UTF8  UTF-8 I/O  widget_data.cdata
-----------  ---------  ------------------
undefined    disabled   charset of the terminal
undefined    enabled    charset of the terminal
defined      disabled   charset of the terminal (*)
defined      enabled    always UTF-8

(*) kbd_field was incorrectly assuming UTF-8 in this case.
2006-10-22 17:18:26 +03:00
Miciah Dashiel Butler Masters
28261fcfba check_dialog: compare return value from widget handlers explicitly
Explicitly compare the value that is returned by the widget handler
against EVENT_NOT_PROCESSED rather than relying on the fact that
EVENT_NOT_PROCESSED is equal to 1.
ffeedbdc5045a6a5db2bc75ecaab56bfe46c80ea
2006-10-20 23:10:35 +00:00
Laurent MONIN
e86e1d0fa3 Trim some trailing whitespaces. 2006-09-29 00:07:54 +02:00
Laurent MONIN
0b58b99d30 Use @current_tab for current tab. 2006-09-28 23:58:26 +02:00
Kalle Olavi Niemitalo
677e5c7adc Callers of cp_to_unicode() assert that it didn't return UCS_NO_CHAR.
UCS_NO_CHAR here means the input was too short.  Because the strings
generally come from the source code or from PO files, they should not
end in the middle of a character.  However, the whole character may be
missing if the string is empty.  So select_button_by_key() now checks
for that case separately.

UCS_NO_CHAR must not be passed to unicode_fold_label_case() because
the result is undefined.
2006-09-17 19:54:37 +03:00
Kalle Olavi Niemitalo
92cb452a9e Rename CONFIG_UTF_8 to CONFIG_UTF8.
The configure script no longer recognizes "CONFIG_UTF_8=yes" lines
in custom features.conf files.  They will have to be changed to
"CONFIG_UTF8=yes".  This incompatibility was deemed acceptable
because no released version of ELinks supports CONFIG_UTF_8.

The --enable-utf-8 option was not renamed.
2006-09-17 16:12:47 +03:00
Kalle Olavi Niemitalo
e8462980e5 Change "utf_8" to "utf8" in most identifiers.
Suggested by Miciah on #elinks.

What was renamed:
  add_utf_8                      => add_utf8
  cp2utf_8                       => cp2utf8
  encode_utf_8                   => encode_utf8
  get_translation_table_to_utf_8 => get_translation_table_to_utf8
  goto invalid_utf_8_start_byte  => goto invalid_utf8_start_byte
  goto utf_8                     => goto utf8
  goto utf_8_select              => goto utf8_select
  terminal_interlink.utf_8       => terminal_interlink.utf8
  utf_8_to_unicode               => utf8_to_unicode

What was not renamed:
  terminal._template_.utf_8_io option, TERM_OPT_UTF_8_IO
    Compatibility with existing elinks.conf files would require an alias.
  --enable-utf-8
    Because the name of the charset is UTF-8, --enable-utf-8 looks better
    than --enable-utf8.
  CONFIG_UTF_8
    Will be renamed in a later commit.
  Unicode/utf_8.cp, table_utf_8, aliases_utf_8
    Will be renamed in a later commit.
2006-09-17 16:06:22 +03:00
Kalle Olavi Niemitalo
6773c8505d BFU UTF-8: check_hotkeys_common() compares hotkeys as Unicode. 2006-08-13 23:45:41 +03:00
Kalle Olavi Niemitalo
b6447ae26b UTF-8: New function cp_to_unicode(). 2006-08-13 23:35:50 +03:00
Kalle Olavi Niemitalo
7ebc8d8281 terminal UTF-8: New type term_event_char_T.
It is either unicode_val_T or unsigned char.
2006-08-13 23:23:54 +03:00
Kalle Olavi Niemitalo
4d80fe6453 BFU UTF-8: select_button_by_key() folds the case of Unicode characters.
This causes the documented-slow cp2u() to be called in a loop, which
fortunately doesn't have very many iterations.  If this is too slow,
then cp2u() can be rewritten, or the hotkeys can be cached in struct
widget or struct widget_data.

Note that check_kbd_label_key() does not yet allow non-ASCII
characters when CONFIG_UTF_8 is defined.  Before they are allowed,
menu.c should also be updated.
2006-08-13 20:30:19 +03:00
Kalle Olavi Niemitalo
f3b04b8645 terminal: Introduce term_event_key_T. 2006-08-12 14:48:08 +03:00
Kalle Olavi Niemitalo
44633cd757 BFU: Fix cell count for forcibly wrapped lines.
To reproduce before this patch:
- Run ELinks with an 80x25 terminal.
- Set document.browse.forms.confirm_submit = 1.
- Go to <http://bugzilla.elinks.cz/query.cgi>.
- Click the [ Search ] submit button.
- ELinks asks "Do you want to post form data to URL".
  Each line of the URL begins at the horizontal center of the dialog,
  and bleeds outside the right border of the dialog.  Also, the
  [ Yes ] and [ No ] buttons appear to float below the dialog.
2006-08-06 23:26:55 +00:00
Kalle Olavi Niemitalo
a9da075eb5 terminal UTF-8: term_event_keyboard.key is UCS-4, #ifdef CONFIG_UTF_8.
Form fields and BFU text-input widgets then convert from UCS-4 to UTF-8.
If not all UTF-8 bytes fit, they don't insert anything.  Thus it is no
longer possible to get invalid UTF-8 by hitting the length limit.

It is unclear to me which charset is supposed to be used for strings
in internal buffers.  I made BFU insert UTF-8 whenever CONFIG_UTF_8,
but form fields use the charset of the terminal; that may have to be
changed.

As a side effect, this change should solve bug 782, because
term_send_ucs no longer encodes in UTF-8 if CONFIG_UTF_8 is defined.
I think the UTF-8 and codepage encoding calls I added are safe, too.
A similar bug may still surface somewhere else, but 782 could be
closed for now.

This change also lays the foundation for binding actions to non-ASCII
keys, but the keystroke name parser doesn't yet support that.
The CONFIG_UTF_8 mode does not currently support non-ASCII characters
in hot keys, either.
2006-08-06 20:02:43 +00:00
Kalle Olavi Niemitalo
fde466bde9 terminal: Introduce macros for KBD_F1...KBD_F12 arithmetic. 2006-08-06 20:02:39 +00:00
Laurent MONIN
1136aefb71 Trim trailing whitespaces. 2006-07-27 09:51:10 +02:00
Laurent MONIN
a897a95721 Compilation fixes (CONFIG_UTF_8): move variables declarations at start
of blocks. Old compilers do not support in-block declarations.
2006-07-27 09:49:49 +02:00
Pavol Babincak
a7a7984d89 Merge with http://www.fi.muni.cz/~xbabinc/elinks/elinks-utf8.git/
without ucdata stuff. UTF-8 code cleanup. Added Pavol Babincak
to the AUTHORS
2006-07-25 09:59:12 +02:00
Laurent MONIN
29fb051fc9 Compilation fix: move variables declarations to top. 2006-07-24 17:56:07 +02:00
Witold Filipczyk
2a6125e3d0 Merge with utf8. src/document/plain/renderer.c replaced by utf8 version 2006-07-21 13:12:06 +02:00
Miciah Dashiel Butler Masters
29ffe71bc1 New actions: kill-word-back, move-backward-word, move-forward-word 2006-06-23 04:07:52 +00:00
Miciah Dashiel Butler Masters
588fa3ece8 Properly deselect the main menu instead of crashing
In send_kbd_event, use deselect_mainmenu to get rid of the main menu
instead of delete_window. This fixes bug 747.
2006-06-19 11:07:03 +00:00
Miciah Dashiel Butler Masters
81b4f8b917 done_listbox_item: if_assert_failed return 2006-06-16 21:13:32 +00:00
Miciah Dashiel Butler Masters
6f98f5fd96 Bookmarks: Fix update after move
do_move_bookmark was only updating the selection in the bookmarks manager
window in which the Move button was pressed. Now all windows are updated.

This patch also prevents a crash when the first item that was displayed
in a box was the last child of a folder and was being moved (the comment
removed in this patch was incorrect in assuming that bm->box->next must
be valid because it neglected to account for non-root children).

This change required that I move the definition of struct
hierbox_dialog_list_item from src/bfu/hierbox.c to src/bfu/hierbox.h.

Thanks to Kalle Olavi Niemitalo for finding both the update problem
and the crash.
2006-06-16 21:13:31 +00:00
Laurent MONIN
3e4bf0cf27 Fix: redraw main menu when one cancels it by clicking outside menu space. 2006-06-07 16:33:14 +02:00
Kalle Olavi Niemitalo
d10a489a14 BFU: Mark format strings in struct listbox_ops_messages.
With regular comments in the definition of the structure itself,
and with xgettext:c-format comments in constants of that type,
if xgettext would otherwise guess wrong; so that translators
will know they'll have to double any percent signs they add.
I didn't regenerate PO files, though.
2006-06-02 19:08:09 +00:00
Miciah Dashiel Butler Masters
f271a06487 Factor deselect_mainmenu out of select_menu_item, do_mainmenu,
mainmenu_mouse_handler, and mainmenu_kbd_handler
2006-06-02 03:57:53 +00:00
Miciah Dashiel Butler Masters
cdcc8c8415 do_mainmenu: get the menu's window via menu->win instead of using a
silly foreach loop
2006-06-02 03:54:54 +00:00
Miciah Dashiel Butler Masters
c330ae9b9c do_mainmenu: use add_to_list instead of add_at_pos 2006-06-02 03:27:55 +00:00
Laurent MONIN
5acb5e6663 Trim trailing whitespaces. 2006-05-31 19:34:49 +02:00
Laurent MONIN
1d3656a317 Pass a pointer to a hash pointer to free_hash() to ensure hash pointer
is NULL on return.
2006-05-31 19:33:36 +02:00
Laurent MONIN
54099f5286 Do not export init_hash(),strhash() and hash_size() anymore, use a
wrapper named init_hash8() instead.
2006-05-31 19:17:01 +02:00
Kalle Olavi Niemitalo
0a8633d07e BFU: Fix infinite loops in menus that have only unselectable elements.
src/bfu/menu.c (scroll_menu): Let neither menu->selected nor pos
become -2.

src/bfu/menu.c (menu_mouse_handler): Call set_menu_selection directly
rather than via scroll_menu, as sel is already known to be selectable.
(Not required for fixing the bug.)

src/bfu/menu.c (menu_search_handler): Break infinite loops also if
menu->selected is -1 initially.

src/bfu/menu.c (menu_handler): Instead of tweaking menu->selected
directly, let scroll_menu do it.
2006-05-21 20:09:53 +03:00
Kalle Olavi Niemitalo
9fa5ae374f BFU: Fix searching in menus past unselectable items.
The bug was that menu_search_handler gave scroll_menu an incorrect
count because it didn't know that scroll_menu skips unselectable
items.
2006-05-21 18:12:34 +03:00
Kalle Olavi Niemitalo
1fdd9002cb BFU: Redraw the terminal when moving the main menu to the bottom.
This fixes a bug where choosing e.g. "About" from the menu left
the main menu visible but Ctrl-L in the About dialog hid it again.
2006-05-15 00:30:54 +03:00
Kalle Olavi Niemitalo
ca84c353b5 BFU: Display the main menu immediately when activating it.
This fixes two bugs:
1. Pressing F9 did not make the main menu visible, but then pressing
   e.g. Right made it visible.
2. Pressing F9 and then Down displayed the first submenu (File) at the
   wrong position on the screen.
2006-05-15 00:15:08 +03:00
Jonas Fonseca
2fcf33541c Merge with http://www.iki.fi/kon/2006/elinks.git#plausible 2006-05-13 23:15:05 +02:00
Kalle Olavi Niemitalo
eae626a981 doc: Added src/bfu/README.
src/bfu/README: This new file currently contains a diagram of how the
various struct types of src/bfu/ and src/terminal/ relate to each
other.  More documentation may be added later, although if it is
specific to a particular structure, then it should probably go in the
corresponding header file so that people will remember to update it.
2006-05-13 17:01:20 +03:00
Pavol Babincak
31f2c28c06 Correction of b0e2840f0d. Do not correct main menu when utf-8 is not used. 2006-05-07 00:51:27 +02:00
Miciah Dashiel Butler Masters
3b64f2e9e8 Preserve the text when doing a prefix completion. 2006-04-29 22:55:32 +00:00
Miciah Dashiel Butler Masters
6d3b2a97f6 Ignore text after the cursor when performing a completion. The text will
be deleted.
2006-04-29 22:30:07 +00:00
Pavol Babincak
c8a6a4c44d Fix broken double-width chars when displaying menu or dialog. 2006-04-09 16:59:27 +02:00
Pavol Babincak
b0e2840f0d When double-width character in mainmenu is on last collumn don't show it. 2006-04-08 00:42:41 +02:00
Pavol Babincak
3c019606b2 Correct split on punctuation in BFU text.
When CONFIG_UTF_8 is defined but utf8 isn't used.
2006-04-08 00:37:25 +02:00
Pavol Babincak
662ffb903c Modified inpfield to be able to work with double-width UTF-8 chars.
Note: there is ugly hack in ACT_EDIT_BACKSPACE where last byte of UTF-8
character is removed and then moving to left until complete UTF-8
character is found.
2006-04-08 00:16:10 +02:00
witekfl
97d7a57b8a Do not delete main menu while displaying dialogs or when mouse is
pressed outside menu bar
2006-03-11 21:08:02 +01:00
Pavol Babincak
509fe2cf0d Added support for double-width UTF-8 checkboxes and listbox in dialogs. 2006-03-06 15:15:30 +01:00
Pavol Babincak
10303bb94a Added support for UTF-8 (including double-width) texts in dialogs. 2006-03-06 06:18:47 +01:00
Pavol Babincak
dfe029bc27 Added support for correctly displaying double-width UTF-8 chars in buttons.
With UTF-8 support in terminal enabled it is possible to use double-width
UTF-8 strings as margins of buttons. Although they are displayed wrong when
UTF-8 support in terminal is disabled.
2006-03-06 06:09:58 +01:00
Pavol Babincak
38db20b776 Added format_only parameter for distinguish between formating.
Preparation for using struct terminal in formating functions.

By now distinguish between formating widgets and formating widgets with
displaying was done with term == NULL and term != NULL. I hope I'am
not wrong.
2006-03-06 06:01:12 +01:00
Pavol Babincak
f3a063f1ed Corrected support for double-width UTF-8 chars in titles of dialogs. 2006-03-06 05:05:18 +01:00
Pavol Babincak
e0886dd842 Bug fix: menu with UTF-8 items was unneeded wider.
Also deal with double-width UTF-8 characters.
2006-03-05 01:15:26 +01:00
witekfl
e50581faf3 Menu bar moved at the end of windows queue. bfu_technology activated at the
right place.
2006-03-04 11:42:57 +01:00
witekfl
a802f0fb3e Someone, sometime ago wanted always visible menu bar. This is attempt to
handle it. I have no idea where to make initialisation call to
activate_bfu_technology.
2006-03-03 19:01:15 +01:00
Miciah Dashiel Butler Masters
143398f09d Unwrap a line in query_delete_selected_item. 2006-02-19 07:22:51 +00:00
Miciah Dashiel Butler Masters
b8063709c0 Query whether to delete the selected hierbox item if the user answers
no to confirmation to delete the marked item.
2006-02-19 07:19:35 +00:00
Miciah Dashiel Butler Masters
b97508e48a Simplify query_delete_selected_item
Check whether the item can be deleted before allocating the context so
as to save a free in the case that the item cannot be deleted.
2006-02-19 07:15:27 +00:00
Miciah Dashiel Butler Masters
e9799a2265 Reflow the control flow in push_hierbox_delete_button 2006-02-19 07:13:37 +00:00
Miciah Dashiel Butler Masters
6683f14bc1 Factor query_delete_selected_item out of push_hierbox_delete_button. 2006-02-19 07:11:51 +00:00
Miciah Dashiel Butler Masters
d87a90da6b Drop temporary variables when using listbox_message 2006-02-19 06:46:05 +00:00
Miciah Dashiel Butler Masters
a3fb98f499 src/bfu
Inconsequential change to push_hierbox_delete_button

Use item instead of context->item.
2006-02-19 06:22:12 +00:00
Pavol Babincak
f9d67aeb73 Added configure option --enable-utf-8
For enabling better UTF-8 support by Witek and Scrool.
2006-02-18 20:28:00 +01:00
Pavol Babincak
585d69355a Bug fix: hidden UTF-8 characters before end of input box
Bug fix: when UTF-8 characters are entered into input box they are hidden
before end of input box.
2006-02-18 20:27:51 +01:00
Pavol Babincak
259a64a7a7 Code cleanup. 2006-02-18 20:27:48 +01:00
Witold Filipczyk
44a1aa9c87 Witekfl's UTF-8 patch v5. 2006-02-18 20:27:46 +01:00
Kalle Olavi Niemitalo
4217f2c555 Merge with http://elinks.cz/elinks.git 2006-02-18 12:21:47 +02:00
Miciah Dashiel Butler Masters
190259ca22 mem_alloc_align: drop the obj type parameter
Instead use the object itself, i.e., replace typeof(obj) with
typeof(**ptr).
2006-02-17 17:32:59 +00:00
Kalle Olavi Niemitalo
9b9da06eb7 Merge with http://elinks.cz/elinks.git 2006-02-12 19:26:09 +02:00
Miciah Dashiel Butler Masters
c776fab903 Initially place cursor on the current listbox item
Introduce the macros before_widgets and foreach_widget_back. Use the
latter in update_all_widgets instead of foreach_widget so that the
widgets are printed in reverse order, which means that any listbox is
drawn last, which allows it to grab the cursor from the selected button
when the dialogue box is initialised or redrawn.

Requested by Kirk Reiser for great usability with screen readers.
2006-02-12 17:11:57 +00:00
Kalle Olavi Niemitalo
b1f8756c59 Merge with http://elinks.cz/elinks.git 2006-02-05 17:48:43 +02:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Kalle Olavi Niemitalo
89fe822f70 Merge with 6a9ea02f3a
(via http://elinks.cz/elinks.git)
2006-01-14 21:30:12 +02:00
Laurent MONIN
b8e64a5ee0 Simplify secure_open() call, make it a wrapper around secure_open_umask(). 2006-01-10 23:49:35 +01:00
Laurent MONIN
9b88da873a Use mode_t and mode macros everywhere. 2006-01-10 23:35:22 +01:00
Kalle Olavi Niemitalo
2cfd0a9bb4 Merge with http://elinks.cz/elinks.git 2006-01-09 02:20:27 +02:00
Laurent MONIN
d767650585 check_hotkeys_common(): @res -> @found. 2006-01-06 21:37:36 +01:00
Laurent MONIN
c08d932433 Merge is_hotkey(), is_not_so_hotkey() and check_hotkeys_common() to
reduce code redundancy and speed up things.
2006-01-06 21:34:57 +01:00
Kalle Olavi Niemitalo
93714a3e35 Merge with http://elinks.cz/elinks.git 2006-01-06 02:13:11 +02:00
Miciah Dashiel Butler Masters
a645bb2ead Do return EVENT_NOT_PROCESSED from hierbox_ev_init and hierbox_ev_abort
hierbox_ev_init and hierbox_ev_abort must return EVENT_NOT_PROCESSED
so that the generic dialog code runs and initialises the widgets and stuff.
This commit reverts commit f8310de64b to fix
a segfault and also adds comments to explain the unintuitive return value.
2006-01-05 23:41:18 +00:00
Laurent MONIN
77156c021a Drop unused listbox widget height stuff. 2006-01-05 11:50:42 +01:00
Laurent MONIN
f8310de64b hierbox_ev_[init|abort](): it makes more sense to return EVENT_PROCESSED. 2006-01-05 11:44:29 +01:00
Laurent MONIN
a05b6c0636 hierbox_ev_kbd(): use a switch(). 2006-01-05 11:41:26 +01:00
Kalle Olavi Niemitalo
345ba7afcd Merge with http://elinks.cz/elinks.git 2006-01-01 19:05:44 +02:00
Kalle Olavi Niemitalo
4c2831677a Here is a framework that detects cases where a PO file assigns
the same accelerator key to multiple buttons in a dialog box or
to multiple items in a menu.  ELinks already has some support for
this but it requires the translator to run ELinks and manually
scan through all menus and dialogs.  The attached changes make it
possible to quickly detect and list any conflicts, including ones
that can only occur on operating systems or configurations that
the translator is not currently using.

The changes have no immediate effect on the elinks executable or
the MO files.  PO files become larger, however.

The scheme works like this:

- Like before, accelerator keys in translatable strings are
  tagged with the tilde (~) character.

- Whenever a C source file defines an accelerator key, it must
  assign one or more named "contexts" to it.  The translations in
  the PO files inherit these contexts.  If multiple strings use
  the same accelerator (case insensitive) in the same context,
  that's a conflict and can be detected automatically.

- The contexts are defined with "gettext_accelerator_context"
  comments in source files.  These comments delimit regions where
  all translatable strings containing tildes are given the same
  contexts.  There must be one special comment at the top of the
  region; it lists the contexts assigned to that region.  The
  region automatically ends at the end of the function (found
  with regexp /^\}/), but it can also be closed explicitly with
  another special comment.  The comments are formatted like this:

    /* [gettext_accelerator_context(foo, bar, baz)]
         begins a region that uses the contexts "foo", "bar", and "baz".
         The comma is the delimiter; whitespace is optional.

       [gettext_accelerator_context()]
         ends the region.  */

  The scripts don't currently check whether this syntax occurs
  inside or outside comments.

- The names of contexts consist of C identifiers delimited with
  periods.  I typically used the name of a function that sets
  up a dialog, or the name of an array where the items of a
  menu are listed.  There is a special feature for static
  functions: if the name begins with a period, then the period
  will be replaced with the name of the source file and a colon.

- If a menu is programmatically generated from multiple parts,
  of which some are never used together, so that it is safe to
  use the same accelerators in them, then it is necessary to
  define multiple contexts for the same menu.  link_menu() in
  src/viewer/text/link.c is the most complex example of this.

- During make update-po:

  - A Perl script (po/gather-accelerator-contexts.pl) reads
    po/elinks.pot, scans the source files listed in it for
    "gettext_accelerator_context" comments, and rewrites
    po/elinks.pot with "accelerator_context" comments that
    indicate the contexts of each msgid: the union of all
    contexts of all of its uses in the source files.  It also
    removes any "gettext_accelerator_context" comments that
    xgettext --add-comments has copied to elinks.pot.

  - If po/gather-accelerator-contexts.pl does not find any
    contexts for some use of an msgid that seems to contain an
    accelerator (because it contains a tilde), it warns.  If the
    tilde refers to e.g. "~/.elinks" and does not actually mark
    an accelerator, the warning can be silenced by specifying the
    special context "IGNORE", which the script otherwise ignores.

  - msgmerge copies the "accelerator_context" comments from
    po/elinks.pot to po/*.po.  Translators do not edit those
    comments.

- During make check-po:

  - Another Perl script (po/check-accelerator-contexts.pl) reads
    po/*.po and keeps track of which accelerators have been bound
    in each context.  It warns about any conflicts it finds.
    This script does not access the C source files; thus it does
    not matter if the line numbers in "#:" lines are out of date.

This implementation is not perfect and I am not proposing to
add it to the main source tree at this time.  Specifically:

- It introduces compile-time dependencies on Perl and Locale::PO.
  There should be a configure-time or compile-time check so that
  the new features are skipped if the prerequisites are missing.

- When the scripts include msgstr strings in warnings, they
  should transcode them from the charset of the PO file to the
  one specified by the user's locale.

- It is not adequately documented (well, except perhaps here).

- po/check-accelerator-contexts.pl reports the same conflict
  multiple times if it occurs in multiple contexts.

- The warning messages should include line numbers, so that users
  of Emacs could conveniently edit the conflicting part of the PO
  file.  This is not feasible with the current version of
  Locale::PO.

- Locale::PO does not understand #~ lines and spews warnings
  about them.  There is an ugly hack to hide these warnings.

- Jonas Fonseca suggested the script could propose accelerators
  that are still available.  This has not been implemented.

There are three files attached:

- po/gather-accelerator-contexts.pl: Augments elinks.pot with
  context information.

- po/check-accelerator-contexts.pl: Checks conflicts.

- accelerator-contexts.diff: Makes po/Makefile run the scripts,
  and adds special comments to source files.
2006-01-01 18:55:18 +02:00
Miciah Dashiel Butler Masters
227150d100 Merge the definition and initialisation of msg in 2006-01-01 08:07:14 +00:00
Miciah Dashiel Butler Masters
127b27bd49 Use listbox_message. 2006-01-01 08:07:14 +00:00
Miciah Dashiel Butler Masters
2ee5b85b9e Introduce and use local variable ops, assigned the value of box->ops, 2006-01-01 08:07:14 +00:00
Miciah Dashiel Butler Masters
985efb99b6 Introduce a macro listbox_message(msg) that tries ops->messages->msg 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
6114066803 Replace unsigned char *delete_messages[2][DELETE_ERRORS] with struct 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
4e83efb6d3 Drop a comment that should have gone with revision 1.129. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
eeed2cd4a8 Use the local variable item instead of context->item, which is assigned 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
247fe95fea In hierbox_ev_kbd, use the local variable selected, which is assigned 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
4eb0cbf271 Introduce and use local variable item, assigned the value of 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
5042a48750 Re-indent recursively_goto_listbox. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
6aed6ff96f Factor recursively_goto_listbox out of recursively_goto_each_listbox. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
a4209b02fe Rename recursively_goto_listbox to recursively_goto_each_listbox. 2006-01-01 08:07:13 +00:00
Miciah Dashiel Butler Masters
963452c65f Rename done_listbox_item parameter box_item to item. 2006-01-01 08:07:13 +00:00
Laurent MONIN
26c9bdf538 Move code from kbd_listbox() to new do_kbd_listbox_action(). 2005-12-26 11:02:39 +01:00
Laurent MONIN
918fed9966 kbd_listbox(): converts if {} stuff to a switch{}. 2005-12-26 10:53:39 +01:00
Laurent MONIN
9683cf429b display_listbox_item(): clarify tests a bit. 2005-12-26 10:39:07 +01:00
Jonas Fonseca
1c3f6a8f3b Place cursor at start of text and only highlight the text in the managers
The old behavior would lead screeanreaders to pronounce items like the
bookmarks as "unknown-unknown-<the link name>". That is the border
chars of the tree view would be renderered as "unknown".

Requested by Klaus Knopper.
2005-12-26 00:26:04 +01:00
Miciah Dashiel Butler Masters
b150fa8c56 #include util/align.h in bfu/msgbox.h. 2005-12-20 10:48:45 +00:00
Miciah Dashiel Butler Masters
d12226d4cb Fix a problem with my rewrite of scroll_menu where selecting an item on
a main menu selects the next item instead.
2005-12-19 03:44:14 +00:00
Miciah Dashiel Butler Masters
82850fab29 Rewrite the better part of scroll_menu so that it is more readable
and wraps properly when the first or last items on a menu are
unselectable. Drop search_selectable, which is now unnecessary.
2005-12-19 01:01:52 +00:00
Miciah Dashiel Butler Masters
fa0ce83f24 Recomment do_tab_compl_unambiguous. 2005-12-17 00:02:15 +00:00
Miciah Dashiel Butler Masters
093800d6fb Only set match the first time since we are only interested in the common
substring at the start, which will be the same for all matches.
2005-12-16 23:59:04 +00:00
Miciah Dashiel Butler Masters
aad46173ae Refactor. 2005-12-16 23:50:17 +00:00
Miciah Dashiel Butler Masters
63a71348f2 Refactor. 2005-12-16 23:48:41 +00:00
Miciah Dashiel Butler Masters
5279ea97da Drop a funny comment. 2005-12-16 23:47:25 +00:00
Miciah Dashiel Butler Masters
20ee738904 Stop using a special value of 0 for longest_common_match to check whether
a match has been found and just check whether match is NULL.
2005-12-16 23:37:52 +00:00
Miciah Dashiel Butler Masters
0f8fe3f919 Define a new routine strcommonlen and use it in do_tab_compl_unambiguous. 2005-12-16 23:35:11 +00:00
Jonas Fonseca
acf2ec806b Remove empty lines in start of header files
A left over from the CVS Id removal. Also, for a few files, normalize the
order in which things are declared in headers.
2005-11-15 11:33:27 +01:00
Laurent MONIN
df065ead80 Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
Jonas Fonseca
c88afeb1c2 path_to_top -> top_builddir 2005-10-20 04:00:35 +02:00
Jonas Fonseca
e39a4342d6 Include $(top_srcdir)/Makefile.lib instead of $(path_to_top)/Makefile.lib
A step towards out of tree builds ...
2005-10-20 01:11:47 +02:00
Jonas Fonseca
94ed6fa754 Finalize and cleanup the denser Makefile format
Convert remaining conditional file building to use

	OBJS-$(CONFIG_FOO) += foo.o

one problem with reverse meaining (in util/) fixed with local 'hack'.

Cleanup and remove stuff which is now default targets.
2005-09-28 12:38:17 +02:00
Jonas Fonseca
1efab31581 Simplify building of and linking with directories
Ditch the building of an archive (.a) in favour of linking all objects in a
directory into a lib.o file. This makes it easy to link in subdirectories
and more importantly keeps the build logic in the local subdirectories.

Note: after updating you will have to rm **/*.a if you do not make clean
before updating.
2005-09-27 21:38:58 +02:00
Jonas Fonseca
b30064c0d0 Rename targets: *-l -> *-local 2005-09-27 21:11:28 +02:00
Petr Baudis
4e2d48cc93 ELBuildize some more stuff. All for tonight, turn for the Americans. 2005-09-16 05:09:08 +02:00
Jonas Fonseca
7462f22635 Remove now obsolete .cvsignore files. 2005-09-15 18:33:20 +02:00
Petr Baudis
0f6d4310ad Initial commit of the HEAD branch of the ELinks CVS repository, as of
Thu Sep 15 15:57:07 CEST 2005. The previous history can be added to this
by grafting.
2005-09-15 15:58:31 +02:00