summaryrefslogtreecommitdiff
path: root/apps/plugins/text_editor.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-03-21 13:41:35 +0000
committerDave Chapman <dave@dchapman.com>2008-03-21 13:41:35 +0000
commite92d2c51ed455cc0a889fb6d38b4802eee252a6a (patch)
tree028860f37ad61406d82ad036694186dbc9d45360 /apps/plugins/text_editor.c
parentbb026334c020bb04839186e7a45bac1dc7cb1724 (diff)
downloadrockbox-e92d2c51ed455cc0a889fb6d38b4802eee252a6a.zip
rockbox-e92d2c51ed455cc0a889fb6d38b4802eee252a6a.tar.gz
rockbox-e92d2c51ed455cc0a889fb6d38b4802eee252a6a.tar.bz2
rockbox-e92d2c51ed455cc0a889fb6d38b4802eee252a6a.tar.xz
Add a general-purpose parse_list function to parse a string containing a delimited list of items and adapt the parse_image_load() function in the WPS parser to use it. This function will also be used to parse the upcoming WPS %V viewport tag, but I'm committing it separately as these changes are unrelated to the viewport implementation itself.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16728 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/text_editor.c')
-rw-r--r--apps/plugins/text_editor.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 6b6e449..780516e 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -273,7 +273,7 @@ int do_item_menu(int cur_sel, char* copy_buffer)
|| (c>='0' && c<= '9'))
#define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \
(toupper(c)) - 'A' + 10)
-int hex_to_rgb(const char* hex)
+int hex_to_rgb(const char* hex, int* color)
{ int ok = 1;
int i;
int red, green, blue;
@@ -290,11 +290,12 @@ int hex_to_rgb(const char* hex)
red = (hex2dec(hex[0]) << 4) | hex2dec(hex[1]);
green = (hex2dec(hex[2]) << 4) | hex2dec(hex[3]);
blue = (hex2dec(hex[4]) << 4) | hex2dec(hex[5]);
- return LCD_RGBPACK(red,green,blue);
+ *color = LCD_RGBPACK(red,green,blue);
+ return 0;
}
}
- return 0;
+ return -1;
}
#endif /* HAVE_LCD_COLOR */
@@ -407,7 +408,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
case 1:
edit_text = false;
if (value)
- color = hex_to_rgb(value);
+ hex_to_rgb(value, &color);
else color = 0;
rb->strcpy(extension, name);
rb->set_color(rb->screens[SCREEN_MAIN], name, &color, -1);