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.tar.gz rockbox-5aa5a923f3cc48a189f690fa47eafac389e8fbe4.zip |
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 1e117b153b..a17ce30f5a 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c | |||
@@ -777,6 +777,19 @@ static int save( | |||
777 | return retval; | 777 | return retval; |
778 | } | 778 | } |
779 | 779 | ||
780 | static void puts_wrapper(int x, int y, const char *str, bool scroll, bool selected) | ||
781 | { | ||
782 | struct line_desc line = LINE_DESC_DEFINIT; | ||
783 | struct screen *lcd = rb->screens[SCREEN_MAIN]; | ||
784 | int w = lcd->getcharwidth(); | ||
785 | int h = lcd->getcharheight(); | ||
786 | |||
787 | line.scroll = scroll; | ||
788 | line.style = selected ? STYLE_INVERT : STYLE_DEFAULT; | ||
789 | |||
790 | rb->screens[0]->put_line(x * w, y * h, &line, str); | ||
791 | } | ||
792 | |||
780 | /** | 793 | /** |
781 | * Let the user choose which file to save with which name | 794 | * Let the user choose which file to save with which name |
782 | */ | 795 | */ |
@@ -804,8 +817,8 @@ static void save_editor(struct mp3entry *mp3, int splittime) | |||
804 | rb->lcd_clear_display(); | 817 | rb->lcd_clear_display(); |
805 | 818 | ||
806 | /* Save file1? */ | 819 | /* Save file1? */ |
807 | rb->lcd_puts_style(0, 0, "Save part 1?", choice == SE_PART1_SAVE); | 820 | puts_wrapper(0, 0, "Save part 1?", false, choice == SE_PART1_SAVE); |
808 | rb->lcd_puts(13, 0, part1_save?"yes":"no"); | 821 | puts_wrapper(7, 0, part1_save?"yes":"no", false, false); |
809 | 822 | ||
810 | /* trim to display the filename without path */ | 823 | /* trim to display the filename without path */ |
811 | for (pos = rb->strlen(part1_name); pos > 0; pos--) | 824 | for (pos = rb->strlen(part1_name); pos > 0; pos--) |
@@ -816,12 +829,11 @@ static void save_editor(struct mp3entry *mp3, int splittime) | |||
816 | pos++; | 829 | pos++; |
817 | 830 | ||
818 | /* File name 1 */ | 831 | /* File name 1 */ |
819 | rb->lcd_puts_scroll_style(0, 1, | 832 | puts_wrapper(0, 1, &part1_name[pos], true, choice == SE_PART1_NAME); |
820 | &part1_name[pos], choice == SE_PART1_NAME); | ||
821 | 833 | ||
822 | /* Save file2? */ | 834 | /* Save file2? */ |
823 | rb->lcd_puts_style(0, 3, "Save part 2?", choice == SE_PART2_SAVE); | 835 | puts_wrapper(0, 3, "Save part 2?", false, choice == SE_PART2_SAVE); |
824 | rb->lcd_puts(13, 3, part2_save?"yes":"no"); | 836 | puts_wrapper(7, 3, part2_save?"yes":"no", false, false); |
825 | 837 | ||
826 | /* trim to display the filename without path */ | 838 | /* trim to display the filename without path */ |
827 | for (pos = rb->strlen(part2_name); pos > 0; pos --) | 839 | for (pos = rb->strlen(part2_name); pos > 0; pos --) |
@@ -832,11 +844,10 @@ static void save_editor(struct mp3entry *mp3, int splittime) | |||
832 | pos++; | 844 | pos++; |
833 | 845 | ||
834 | /* File name 2 */ | 846 | /* File name 2 */ |
835 | rb->lcd_puts_scroll_style(0, 4, | 847 | puts_wrapper(0, 4, &part2_name[pos], true, choice == SE_PART2_NAME); |
836 | &part2_name[pos], choice == SE_PART2_NAME); | ||
837 | 848 | ||
838 | /* Save */ | 849 | /* Save */ |
839 | rb->lcd_puts_style(0, 6, "Save", choice == SE_SAVE); | 850 | puts_wrapper(0, 6, "Save", false, choice == SE_SAVE); |
840 | 851 | ||
841 | rb->lcd_update(); | 852 | rb->lcd_update(); |
842 | 853 | ||