diff options
Diffstat (limited to 'apps/gui/quickscreen.c')
-rw-r--r-- | apps/gui/quickscreen.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index a11107cb51..7d94d4a0dc 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -51,6 +51,7 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) | |||
51 | display->has_buttonbar=false; | 51 | display->has_buttonbar=false; |
52 | #endif | 52 | #endif |
53 | gui_textarea_clear(display); | 53 | gui_textarea_clear(display); |
54 | display->setfont(FONT_SYSFIXED); | ||
54 | display->getstringsize("M",&w,&h); | 55 | display->getstringsize("M",&w,&h); |
55 | /* Displays the icons */ | 56 | /* Displays the icons */ |
56 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], | 57 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], |
@@ -62,7 +63,6 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) | |||
62 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], | 63 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], |
63 | display->width/2 + 8, | 64 | display->width/2 + 8, |
64 | display->height/2 - 4, 7, 8); | 65 | display->height/2 - 4, 7, 8); |
65 | display->setfont(FONT_SYSFIXED); | ||
66 | 66 | ||
67 | /* Displays the left's text */ | 67 | /* Displays the left's text */ |
68 | title=option_select_get_title(qs->left_option); | 68 | title=option_select_get_title(qs->left_option); |
@@ -90,7 +90,7 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) | |||
90 | display->putsxy(display->width - w, display->height/2, option); | 90 | display->putsxy(display->width - w, display->height/2, option); |
91 | 91 | ||
92 | gui_textarea_update(display); | 92 | gui_textarea_update(display); |
93 | lcd_setfont(FONT_UI); | 93 | display->setfont(FONT_UI); |
94 | } | 94 | } |
95 | 95 | ||
96 | void gui_syncquickscreen_draw(struct gui_quickscreen * qs) | 96 | void gui_syncquickscreen_draw(struct gui_quickscreen * qs) |
@@ -102,6 +102,7 @@ void gui_syncquickscreen_draw(struct gui_quickscreen * qs) | |||
102 | 102 | ||
103 | bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) | 103 | bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) |
104 | { | 104 | { |
105 | |||
105 | switch(button) | 106 | switch(button) |
106 | { | 107 | { |
107 | case QUICKSCREEN_LEFT : | 108 | case QUICKSCREEN_LEFT : |
@@ -143,24 +144,32 @@ bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) | |||
143 | return(false); | 144 | return(false); |
144 | } | 145 | } |
145 | 146 | ||
146 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs) | 147 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) |
147 | { | 148 | { |
148 | int key; | 149 | int key; |
150 | /* To quit we need either : | ||
151 | * - a second press on the button that made us enter | ||
152 | * - an action taken while pressing the enter button, | ||
153 | * then release the enter button*/ | ||
154 | bool can_quit=false; | ||
149 | gui_syncquickscreen_draw(qs); | 155 | gui_syncquickscreen_draw(qs); |
150 | while (true) { | 156 | while (true) { |
151 | key = button_get(true); | 157 | key = button_get(true); |
152 | if(default_event_handler(key) == SYS_USB_CONNECTED) | 158 | if(default_event_handler(key & ~button_enter) == SYS_USB_CONNECTED) |
153 | return(true); | 159 | return(true); |
154 | if(gui_quickscreen_do_button(qs, key)) | 160 | if(gui_quickscreen_do_button(qs, key & ~button_enter)) |
155 | { | 161 | { |
162 | can_quit=true; | ||
156 | if(qs->callback) | 163 | if(qs->callback) |
157 | qs->callback(qs); | 164 | qs->callback(qs); |
158 | gui_syncquickscreen_draw(qs); | 165 | gui_syncquickscreen_draw(qs); |
159 | } | 166 | } |
160 | else if(key==QUICKSCREEN_QUIT | 167 | else if(key==button_enter) |
168 | can_quit=true; | ||
169 | if(key==(button_enter | BUTTON_REL) && can_quit) | ||
170 | return(false); | ||
161 | #ifdef QUICKSCREEN_QUIT | 171 | #ifdef QUICKSCREEN_QUIT |
162 | || key==QUICKSCREEN_QUIT | 172 | if(key==QUICKSCREEN_QUIT |
163 | #endif | ||
164 | #ifdef QUICKSCREEN_QUIT2 | 173 | #ifdef QUICKSCREEN_QUIT2 |
165 | || key==QUICKSCREEN_QUIT2 | 174 | || key==QUICKSCREEN_QUIT2 |
166 | #endif | 175 | #endif |
@@ -168,9 +177,8 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs) | |||
168 | || key==QUICKSCREEN_RC_QUIT | 177 | || key==QUICKSCREEN_RC_QUIT |
169 | #endif | 178 | #endif |
170 | ) | 179 | ) |
171 | { | ||
172 | return(false); | 180 | return(false); |
173 | } | 181 | #endif /* QUICKSCREEN_QUIT */ |
174 | gui_syncstatusbar_draw(&statusbars, false); | 182 | gui_syncstatusbar_draw(&statusbars, false); |
175 | } | 183 | } |
176 | } | 184 | } |