diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2013-12-20 23:34:28 +0100 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2014-01-07 14:13:40 +0100 |
| commit | 5aa5a923f3cc48a189f690fa47eafac389e8fbe4 (patch) | |
| tree | d9d24fc357f6cbb88224f9e92ebf98bb14e75ab2 | |
| parent | 91ef65306bf4e459f430d6dc44e5923d6b9f8399 (diff) | |
| download | rockbox-5aa5a923f3cc48a189f690fa47eafac389e8fbe4.zip rockbox-5aa5a923f3cc48a189f690fa47eafac389e8fbe4.tar.gz rockbox-5aa5a923f3cc48a189f690fa47eafac389e8fbe4.tar.bz2 rockbox-5aa5a923f3cc48a189f690fa47eafac389e8fbe4.tar.xz | |
splitedit: Adapt put_line().
This plugin had a (broken) poor-mans list implementation which can be
better achieved through put_line().
Change-Id: I4ba92ba3a01b84a273b3f0a5d067b24c622ddc9e
| -rw-r--r-- | apps/plugins/splitedit.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index 1e117b1..a17ce30 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c @@ -777,6 +777,19 @@ static int save( return retval; } +static void puts_wrapper(int x, int y, const char *str, bool scroll, bool selected) +{ + struct line_desc line = LINE_DESC_DEFINIT; + struct screen *lcd = rb->screens[SCREEN_MAIN]; + int w = lcd->getcharwidth(); + int h = lcd->getcharheight(); + + line.scroll = scroll; + line.style = selected ? STYLE_INVERT : STYLE_DEFAULT; + + rb->screens[0]->put_line(x * w, y * h, &line, str); +} + /** * Let the user choose which file to save with which name */ @@ -804,8 +817,8 @@ static void save_editor(struct mp3entry *mp3, int splittime) rb->lcd_clear_display(); /* Save file1? */ - rb->lcd_puts_style(0, 0, "Save part 1?", choice == SE_PART1_SAVE); - rb->lcd_puts(13, 0, part1_save?"yes":"no"); + puts_wrapper(0, 0, "Save part 1?", false, choice == SE_PART1_SAVE); + puts_wrapper(7, 0, part1_save?"yes":"no", false, false); /* trim to display the filename without path */ for (pos = rb->strlen(part1_name); pos > 0; pos--) @@ -816,12 +829,11 @@ static void save_editor(struct mp3entry *mp3, int splittime) pos++; /* File name 1 */ - rb->lcd_puts_scroll_style(0, 1, - &part1_name[pos], choice == SE_PART1_NAME); + puts_wrapper(0, 1, &part1_name[pos], true, choice == SE_PART1_NAME); /* Save file2? */ - rb->lcd_puts_style(0, 3, "Save part 2?", choice == SE_PART2_SAVE); - rb->lcd_puts(13, 3, part2_save?"yes":"no"); + puts_wrapper(0, 3, "Save part 2?", false, choice == SE_PART2_SAVE); + puts_wrapper(7, 3, part2_save?"yes":"no", false, false); /* trim to display the filename without path */ for (pos = rb->strlen(part2_name); pos > 0; pos --) @@ -832,11 +844,10 @@ static void save_editor(struct mp3entry *mp3, int splittime) pos++; /* File name 2 */ - rb->lcd_puts_scroll_style(0, 4, - &part2_name[pos], choice == SE_PART2_NAME); + puts_wrapper(0, 4, &part2_name[pos], true, choice == SE_PART2_NAME); /* Save */ - rb->lcd_puts_style(0, 6, "Save", choice == SE_SAVE); + puts_wrapper(0, 6, "Save", false, choice == SE_SAVE); rb->lcd_update(); |