summaryrefslogtreecommitdiff
path: root/riscos/wimp.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-06-20 21:35:33 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-06-20 21:35:33 +0000
commit5adef63ac5099ff12c8fed4872f8df4331072d7e (patch)
treec2e879a435b4430fbbd4b0133b92eaf790c9350f /riscos/wimp.c
parent5f10c6277ae20474392df402670123ac17c55bcf (diff)
downloadnetsurf-5adef63ac5099ff12c8fed4872f8df4331072d7e.tar.gz
netsurf-5adef63ac5099ff12c8fed4872f8df4331072d7e.tar.bz2
Localise configure icon strings when appropriate.
Fix gright menu handling - now writes into display field without attempting to localise the selection string - it's already localised. Update German Messages file appropriately. svn path=/trunk/netsurf/; revision=2638
Diffstat (limited to 'riscos/wimp.c')
-rw-r--r--riscos/wimp.c67
1 files changed, 66 insertions, 1 deletions
diff --git a/riscos/wimp.c b/riscos/wimp.c
index 7156584a9..6ae47bfe1 100644
--- a/riscos/wimp.c
+++ b/riscos/wimp.c
@@ -284,6 +284,71 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text) {
/**
+ * Set the contents of an icon to a string.
+ *
+ * \param w window handle
+ * \param i icon handle
+ * \param text string (in local encoding) (copied)
+ */
+void ro_gui_set_icon_string_le(wimp_w w, wimp_i i, const char *text) {
+ wimp_caret caret;
+ wimp_icon_state ic;
+ os_error *error;
+ int old_len, len;
+
+ /* get the icon data */
+ ic.w = w;
+ ic.i = i;
+ error = xwimp_get_icon_state(&ic);
+ if (error) {
+ LOG(("xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+
+ /* check that the existing text is not the same as the updated text
+ * to stop flicker */
+ if (ic.icon.data.indirected_text.size &&
+ !strncmp(ic.icon.data.indirected_text.text,
+ text,
+ (unsigned int)ic.icon.data.indirected_text.size - 1))
+ return;
+
+ /* copy the text across */
+ old_len = strlen(ic.icon.data.indirected_text.text);
+ if (ic.icon.data.indirected_text.size) {
+ strncpy(ic.icon.data.indirected_text.text, text,
+ (unsigned int)ic.icon.data.indirected_text.size - 1);
+ ic.icon.data.indirected_text.text[
+ ic.icon.data.indirected_text.size - 1] = '\0';
+ }
+
+ /* handle the caret being in the icon */
+ error = xwimp_get_caret_position(&caret);
+ if (error) {
+ LOG(("xwimp_get_caret_position: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+ if ((caret.w == w) && (caret.i == i)) {
+ len = strlen(text);
+ if ((caret.index > len) || (caret.index == old_len))
+ caret.index = len;
+ error = xwimp_set_caret_position(w, i, caret.pos.x, caret.pos.y,
+ -1, caret.index);
+ if (error) {
+ LOG(("xwimp_set_caret_position: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ }
+ }
+ ro_gui_redraw_icon(w, i);
+}
+
+
+/**
* Set the contents of an icon to a number.
*
* \param w window handle
@@ -406,7 +471,7 @@ void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state) {
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
}
- if (!state)
+ if (!state)
return;
/* ensure the caret is not in a shaded icon */