diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/list.c | 8 | ||||
-rw-r--r-- | apps/gui/list.h | 6 | ||||
-rw-r--r-- | apps/plugin.c | 22 | ||||
-rw-r--r-- | apps/plugin.h | 29 | ||||
-rw-r--r-- | apps/plugins/SOURCES | 1 | ||||
-rw-r--r-- | apps/plugins/doom/f_wipe.c | 10 | ||||
-rw-r--r-- | apps/plugins/doom/i_video.c | 16 | ||||
-rw-r--r-- | apps/plugins/doom/r_draw.c | 4 | ||||
-rw-r--r-- | apps/plugins/doom/st_stuff.c | 4 | ||||
-rw-r--r-- | apps/plugins/doom/v_video.c | 32 | ||||
-rw-r--r-- | apps/plugins/doom/v_video.h | 8 | ||||
-rw-r--r-- | apps/plugins/text_editor.c | 447 | ||||
-rw-r--r-- | apps/plugins/viewers.config | 4 |
13 files changed, 549 insertions, 42 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 8ca3042a4b..d0117d7c03 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -491,6 +491,14 @@ void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items) | |||
491 | #endif | 491 | #endif |
492 | } | 492 | } |
493 | } | 493 | } |
494 | int gui_synclist_get_nb_items(struct gui_synclist * lists) | ||
495 | { | ||
496 | return gui_list_get_nb_items(&((lists)->gui_list[0])); | ||
497 | } | ||
498 | int gui_synclist_get_sel_pos(struct gui_synclist * lists) | ||
499 | { | ||
500 | return gui_list_get_sel_pos(&((lists)->gui_list[0])); | ||
501 | } | ||
494 | void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback) | 502 | void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback) |
495 | { | 503 | { |
496 | int i; | 504 | int i; |
diff --git a/apps/gui/list.h b/apps/gui/list.h index e72e00c5d1..48b7a5e0fc 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -337,14 +337,10 @@ extern void gui_synclist_init( | |||
337 | ); | 337 | ); |
338 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); | 338 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); |
339 | extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); | 339 | extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); |
340 | #define gui_synclist_get_nb_items(lists) \ | 340 | extern int gui_synclist_get_nb_items(struct gui_synclist * lists); |
341 | gui_list_get_nb_items(&((lists)->gui_list[0])) | ||
342 | 341 | ||
343 | extern int gui_synclist_get_sel_pos(struct gui_synclist * lists); | 342 | extern int gui_synclist_get_sel_pos(struct gui_synclist * lists); |
344 | 343 | ||
345 | #define gui_synclist_get_sel_pos(lists) \ | ||
346 | gui_list_get_sel_pos(&((lists)->gui_list[0])) | ||
347 | |||
348 | extern void gui_synclist_draw(struct gui_synclist * lists); | 344 | extern void gui_synclist_draw(struct gui_synclist * lists); |
349 | extern void gui_synclist_select_item(struct gui_synclist * lists, | 345 | extern void gui_synclist_select_item(struct gui_synclist * lists, |
350 | int item_number); | 346 | int item_number); |
diff --git a/apps/plugin.c b/apps/plugin.c index 6cbda49a48..57bc09530a 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "sound.h" | 52 | #include "sound.h" |
53 | #include "database.h" | 53 | #include "database.h" |
54 | #include "splash.h" | 54 | #include "splash.h" |
55 | #include "list.h" | ||
55 | #if (CONFIG_CODEC == SWCODEC) | 56 | #if (CONFIG_CODEC == SWCODEC) |
56 | #include "pcm_playback.h" | 57 | #include "pcm_playback.h" |
57 | #include "dsp.h" | 58 | #include "dsp.h" |
@@ -412,6 +413,27 @@ static const struct plugin_api rockbox_api = { | |||
412 | 413 | ||
413 | vsnprintf, | 414 | vsnprintf, |
414 | memchr, | 415 | memchr, |
416 | /* list */ | ||
417 | gui_synclist_init, | ||
418 | gui_synclist_set_nb_items, | ||
419 | gui_synclist_set_icon_callback, | ||
420 | gui_synclist_get_nb_items, | ||
421 | gui_synclist_get_sel_pos, | ||
422 | gui_synclist_draw, | ||
423 | gui_synclist_select_item, | ||
424 | gui_synclist_select_next, | ||
425 | gui_synclist_select_previous, | ||
426 | gui_synclist_select_next_page, | ||
427 | gui_synclist_select_previous_page, | ||
428 | gui_synclist_add_item, | ||
429 | gui_synclist_del_item, | ||
430 | gui_synclist_limit_scroll, | ||
431 | gui_synclist_flash, | ||
432 | #ifdef HAVE_LCD_BITMAP | ||
433 | gui_synclist_scroll_right, | ||
434 | gui_synclist_scroll_left, | ||
435 | #endif | ||
436 | gui_synclist_do_button, | ||
415 | }; | 437 | }; |
416 | 438 | ||
417 | int plugin_load(const char* plugin, void* parameter) | 439 | int plugin_load(const char* plugin, void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 4061346eba..d39e92de9c 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -67,6 +67,7 @@ | |||
67 | #include "sound.h" | 67 | #include "sound.h" |
68 | #include "menu.h" | 68 | #include "menu.h" |
69 | #include "rbunicode.h" | 69 | #include "rbunicode.h" |
70 | #include "list.h" | ||
70 | 71 | ||
71 | #ifdef HAVE_REMOTE_LCD | 72 | #ifdef HAVE_REMOTE_LCD |
72 | #include "lcd-remote.h" | 73 | #include "lcd-remote.h" |
@@ -102,7 +103,7 @@ | |||
102 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 103 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
103 | 104 | ||
104 | /* increase this every time the api struct changes */ | 105 | /* increase this every time the api struct changes */ |
105 | #define PLUGIN_API_VERSION 17 | 106 | #define PLUGIN_API_VERSION 18 |
106 | 107 | ||
107 | /* update this to latest version if a change to the api struct breaks | 108 | /* update this to latest version if a change to the api struct breaks |
108 | backwards compatibility (and please take the opportunity to sort in any | 109 | backwards compatibility (and please take the opportunity to sort in any |
@@ -483,6 +484,32 @@ struct plugin_api { | |||
483 | 484 | ||
484 | int (*vsnprintf)(char *buf, int size, const char *fmt, va_list ap); | 485 | int (*vsnprintf)(char *buf, int size, const char *fmt, va_list ap); |
485 | void *(*memchr)(const void *s1, int c, size_t n); | 486 | void *(*memchr)(const void *s1, int c, size_t n); |
487 | |||
488 | /* list */ | ||
489 | void (*gui_synclist_init)(struct gui_synclist * lists, | ||
490 | list_get_name callback_get_item_name,void * data); | ||
491 | void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); | ||
492 | void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback); | ||
493 | int (*gui_synclist_get_nb_items)(struct gui_synclist * lists); | ||
494 | int (*gui_synclist_get_sel_pos)(struct gui_synclist * lists); | ||
495 | void (*gui_synclist_draw)(struct gui_synclist * lists); | ||
496 | void (*gui_synclist_select_item)(struct gui_synclist * lists, | ||
497 | int item_number); | ||
498 | void (*gui_synclist_select_next)(struct gui_synclist * lists); | ||
499 | void (*gui_synclist_select_previous)(struct gui_synclist * lists); | ||
500 | void (*gui_synclist_select_next_page)(struct gui_synclist * lists, | ||
501 | enum screen_type screen); | ||
502 | void (*gui_synclist_select_previous_page)(struct gui_synclist * lists, | ||
503 | enum screen_type screen); | ||
504 | void (*gui_synclist_add_item)(struct gui_synclist * lists); | ||
505 | void (*gui_synclist_del_item)(struct gui_synclist * lists); | ||
506 | void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll); | ||
507 | void (*gui_synclist_flash)(struct gui_synclist * lists); | ||
508 | #ifdef HAVE_LCD_BITMAP | ||
509 | void (*gui_synclist_scroll_right)(struct gui_synclist * lists); | ||
510 | void (*gui_synclist_scroll_left)(struct gui_synclist * lists); | ||
511 | #endif | ||
512 | unsigned (*gui_synclist_do_button)(struct gui_synclist * lists, unsigned button); | ||
486 | }; | 513 | }; |
487 | 514 | ||
488 | /* plugin header */ | 515 | /* plugin header */ |
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index b777791f69..029b622fdf 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -26,6 +26,7 @@ wavplay.c | |||
26 | #ifndef IRIVER_IFP7XX_SERIES /* Temporarily disable plugins for iFP7xx */ | 26 | #ifndef IRIVER_IFP7XX_SERIES /* Temporarily disable plugins for iFP7xx */ |
27 | dice.c | 27 | dice.c |
28 | #ifdef HAVE_LCD_BITMAP /* Not for the Player */ | 28 | #ifdef HAVE_LCD_BITMAP /* Not for the Player */ |
29 | text_editor.c | ||
29 | 30 | ||
30 | #if CONFIG_LCD != LCD_IPOD2BPP /* Plugins needing the grayscale lib */ | 31 | #if CONFIG_LCD != LCD_IPOD2BPP /* Plugins needing the grayscale lib */ |
31 | fire.c | 32 | fire.c |
diff --git a/apps/plugins/doom/f_wipe.c b/apps/plugins/doom/f_wipe.c index a6251f295e..f51224f5ce 100644 --- a/apps/plugins/doom/f_wipe.c +++ b/apps/plugins/doom/f_wipe.c | |||
@@ -140,7 +140,7 @@ static int wipe_doMelt(int width, int height, int ticks) | |||
140 | return done; | 140 | return done; |
141 | } | 141 | } |
142 | 142 | ||
143 | // CPhipps - modified to allocate and deallocate screens[2 to 3] as needed, saving memory | 143 | // CPhipps - modified to allocate and deallocate d_screens[2 to 3] as needed, saving memory |
144 | 144 | ||
145 | static int wipe_exitMelt(int width, int height, int ticks) | 145 | static int wipe_exitMelt(int width, int height, int ticks) |
146 | { | 146 | { |
@@ -152,20 +152,20 @@ static int wipe_exitMelt(int width, int height, int ticks) | |||
152 | free(wipe_scr_end); | 152 | free(wipe_scr_end); |
153 | // Paranoia | 153 | // Paranoia |
154 | y = NULL; | 154 | y = NULL; |
155 | wipe_scr_start = wipe_scr_end = screens[SRC_SCR] = screens[DEST_SCR] = NULL; | 155 | wipe_scr_start = wipe_scr_end = d_screens[SRC_SCR] = d_screens[DEST_SCR] = NULL; |
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | int wipe_StartScreen(int x, int y, int width, int height) | 159 | int wipe_StartScreen(int x, int y, int width, int height) |
160 | { | 160 | { |
161 | wipe_scr_start = screens[SRC_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT); | 161 | wipe_scr_start = d_screens[SRC_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT); |
162 | V_CopyRect(x, y, 0, width, height, x, y, SRC_SCR, VPT_NONE ); // Copy start screen to buffer | 162 | V_CopyRect(x, y, 0, width, height, x, y, SRC_SCR, VPT_NONE ); // Copy start screen to buffer |
163 | return 0; | 163 | return 0; |
164 | } | 164 | } |
165 | 165 | ||
166 | int wipe_EndScreen(int x, int y, int width, int height) | 166 | int wipe_EndScreen(int x, int y, int width, int height) |
167 | { | 167 | { |
168 | wipe_scr_end = screens[DEST_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT); | 168 | wipe_scr_end = d_screens[DEST_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT); |
169 | V_CopyRect(x, y, 0, width, height, x, y, DEST_SCR, VPT_NONE); // Copy end screen to buffer | 169 | V_CopyRect(x, y, 0, width, height, x, y, DEST_SCR, VPT_NONE); // Copy end screen to buffer |
170 | V_CopyRect(x, y, SRC_SCR, width, height, x, y, 0 , VPT_NONE); // restore start screen | 170 | V_CopyRect(x, y, SRC_SCR, width, height, x, y, 0 , VPT_NONE); // restore start screen |
171 | return 0; | 171 | return 0; |
@@ -180,7 +180,7 @@ int wipe_ScreenWipe(int x, int y, int width, int height, int ticks) | |||
180 | if (!go) // initial stuff | 180 | if (!go) // initial stuff |
181 | { | 181 | { |
182 | go = 1; | 182 | go = 1; |
183 | wipe_scr = screens[0]; | 183 | wipe_scr = d_screens[0]; |
184 | wipe_initMelt(width, height, ticks); | 184 | wipe_initMelt(width, height, ticks); |
185 | } | 185 | } |
186 | V_MarkRect(0, 0, width, height); // do a piece of wipe-in | 186 | V_MarkRect(0, 0, width, height); // do a piece of wipe-in |
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c index 6adb9491a4..ea6389deab 100644 --- a/apps/plugins/doom/i_video.c +++ b/apps/plugins/doom/i_video.c | |||
@@ -16,7 +16,11 @@ | |||
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | 17 | * |
18 | * $Log$ | 18 | * $Log$ |
19 | * Revision 1.4 2006/04/02 20:45:24 kkurbjun | 19 | * Revision 1.5 2006/04/03 08:51:08 bger |
20 | * Patch #4864 by Jonathan Gordon: text editor plugin, with some changes by me. | ||
21 | * Also correct a var clash between the rockbox's gui api and doom plugin | ||
22 | * | ||
23 | * Revision 1.4 2006-04-02 20:45:24 kkurbjun | ||
20 | * Properly ifdef H300 video code, fix commented line handling rockbox volume | 24 | * Properly ifdef H300 video code, fix commented line handling rockbox volume |
21 | * | 25 | * |
22 | * Revision 1.3 2006-04-02 01:52:44 kkurbjun | 26 | * Revision 1.3 2006-04-02 01:52:44 kkurbjun |
@@ -336,7 +340,7 @@ void I_FinishUpdate (void) | |||
336 | *(volatile unsigned short *) 0xf0000002 = 0; // value | 340 | *(volatile unsigned short *) 0xf0000002 = 0; // value |
337 | *(volatile unsigned short *) 0xf0000000 = 0x22; // GRAM | 341 | *(volatile unsigned short *) 0xf0000000 = 0x22; // GRAM |
338 | 342 | ||
339 | unsigned char *screenptr=screens[0]; | 343 | unsigned char *screenptr=d_screens[0]; |
340 | int wcnt=0, hcnt=0; | 344 | int wcnt=0, hcnt=0; |
341 | 345 | ||
342 | while(hcnt<LCD_HEIGHT) | 346 | while(hcnt<LCD_HEIGHT) |
@@ -358,7 +362,7 @@ void I_FinishUpdate (void) | |||
358 | { | 362 | { |
359 | for (x = 0; x < LCD_WIDTH; x++) | 363 | for (x = 0; x < LCD_WIDTH; x++) |
360 | { | 364 | { |
361 | paletteIndex = screens[0][y*SCREENWIDTH + x]; | 365 | paletteIndex = d_screens[0][y*SCREENWIDTH + x]; |
362 | rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex]; | 366 | rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex]; |
363 | } | 367 | } |
364 | } | 368 | } |
@@ -371,7 +375,7 @@ void I_FinishUpdate (void) | |||
371 | // | 375 | // |
372 | void I_ReadScreen (byte* scr) | 376 | void I_ReadScreen (byte* scr) |
373 | { | 377 | { |
374 | memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT); | 378 | memcpy (scr, d_screens[0], SCREENWIDTH*SCREENHEIGHT); |
375 | } | 379 | } |
376 | 380 | ||
377 | // | 381 | // |
@@ -399,9 +403,9 @@ void I_InitGraphics(void) | |||
399 | 403 | ||
400 | #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) | 404 | #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) |
401 | coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); | 405 | coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); |
402 | screens[0] = fastscreen; | 406 | d_screens[0] = fastscreen; |
403 | #else | 407 | #else |
404 | // Don't know if this will fit in other IRAMs | 408 | // Don't know if this will fit in other IRAMs |
405 | screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char)); | 409 | d_screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char)); |
406 | #endif | 410 | #endif |
407 | } | 411 | } |
diff --git a/apps/plugins/doom/r_draw.c b/apps/plugins/doom/r_draw.c index b6d84f0dff..a6bc21e420 100644 --- a/apps/plugins/doom/r_draw.c +++ b/apps/plugins/doom/r_draw.c | |||
@@ -573,7 +573,7 @@ void R_InitBuffer(int width, int height) | |||
573 | 573 | ||
574 | viewwindowy = width==SCREENWIDTH ? 0 : (SCREENHEIGHT-(ST_SCALED_HEIGHT-1)-height)>>1; | 574 | viewwindowy = width==SCREENWIDTH ? 0 : (SCREENHEIGHT-(ST_SCALED_HEIGHT-1)-height)>>1; |
575 | 575 | ||
576 | topleft = screens[0] + viewwindowy*SCREENWIDTH + viewwindowx; | 576 | topleft = d_screens[0] + viewwindowy*SCREENWIDTH + viewwindowx; |
577 | 577 | ||
578 | // Preclaculate all row offsets. | 578 | // Preclaculate all row offsets. |
579 | // CPhipps - merge viewwindowx into here | 579 | // CPhipps - merge viewwindowx into here |
@@ -627,7 +627,7 @@ void R_FillBackScreen (void) | |||
627 | 627 | ||
628 | void R_VideoErase(unsigned ofs, int count) | 628 | void R_VideoErase(unsigned ofs, int count) |
629 | { | 629 | { |
630 | memcpy(screens[0]+ofs, screens[1]+ofs, count); // LFB copy. | 630 | memcpy(d_screens[0]+ofs, d_screens[1]+ofs, count); // LFB copy. |
631 | } | 631 | } |
632 | 632 | ||
633 | // | 633 | // |
diff --git a/apps/plugins/doom/st_stuff.c b/apps/plugins/doom/st_stuff.c index 5d9244d951..feae89a802 100644 --- a/apps/plugins/doom/st_stuff.c +++ b/apps/plugins/doom/st_stuff.c | |||
@@ -1148,6 +1148,6 @@ void ST_Init(void) | |||
1148 | veryfirsttime = 0; | 1148 | veryfirsttime = 0; |
1149 | ST_loadData(); | 1149 | ST_loadData(); |
1150 | // proff 08/18/98: Changed for high-res | 1150 | // proff 08/18/98: Changed for high-res |
1151 | screens[4] = Z_Malloc(SCREENWIDTH*(ST_SCALED_HEIGHT+1), PU_STATIC, 0); | 1151 | d_screens[4] = Z_Malloc(SCREENWIDTH*(ST_SCALED_HEIGHT+1), PU_STATIC, 0); |
1152 | // screens[4] = Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0); | 1152 | // d_screens[4] = Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0); |
1153 | } | 1153 | } |
diff --git a/apps/plugins/doom/v_video.c b/apps/plugins/doom/v_video.c index 75ccc3ffda..ca90c4b293 100644 --- a/apps/plugins/doom/v_video.c +++ b/apps/plugins/doom/v_video.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "m_swap.h" | 44 | #include "m_swap.h" |
45 | #include "rockmacros.h" | 45 | #include "rockmacros.h" |
46 | // Each screen is [SCREENWIDTH*SCREENHEIGHT]; | 46 | // Each screen is [SCREENWIDTH*SCREENHEIGHT]; |
47 | byte *screens[6] IBSS_ATTR; | 47 | byte *d_screens[6] IBSS_ATTR; |
48 | int dirtybox[4]; | 48 | int dirtybox[4]; |
49 | 49 | ||
50 | /* jff 4/24/98 initialize this at runtime */ | 50 | /* jff 4/24/98 initialize this at runtime */ |
@@ -239,8 +239,8 @@ void V_CopyRect(int srcx, int srcy, int srcscrn, int width, | |||
239 | 239 | ||
240 | V_MarkRect (destx, desty, width, height); | 240 | V_MarkRect (destx, desty, width, height); |
241 | 241 | ||
242 | src = screens[srcscrn]+SCREENWIDTH*srcy+srcx; | 242 | src = d_screens[srcscrn]+SCREENWIDTH*srcy+srcx; |
243 | dest = screens[destscrn]+SCREENWIDTH*desty+destx; | 243 | dest = d_screens[destscrn]+SCREENWIDTH*desty+destx; |
244 | 244 | ||
245 | for ( ; height>0 ; height--) | 245 | for ( ; height>0 ; height--) |
246 | { | 246 | { |
@@ -294,7 +294,7 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height, | |||
294 | if (!scrn) | 294 | if (!scrn) |
295 | V_MarkRect (x, y, width, height); | 295 | V_MarkRect (x, y, width, height); |
296 | 296 | ||
297 | dest = screens[scrn] + y*SCREENWIDTH+x; | 297 | dest = d_screens[scrn] + y*SCREENWIDTH+x; |
298 | // x & y no longer needed | 298 | // x & y no longer needed |
299 | 299 | ||
300 | while (height--) { | 300 | while (height--) { |
@@ -308,7 +308,7 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height, | |||
308 | } else { | 308 | } else { |
309 | V_MarkRect (x, y, width, height); | 309 | V_MarkRect (x, y, width, height); |
310 | 310 | ||
311 | dest = screens[scrn] + y*SCREENWIDTH+x; | 311 | dest = d_screens[scrn] + y*SCREENWIDTH+x; |
312 | 312 | ||
313 | while (height--) { | 313 | while (height--) { |
314 | memcpy (dest, src, width); | 314 | memcpy (dest, src, width); |
@@ -369,7 +369,7 @@ void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest) | |||
369 | I_Error ("V_GetBlock: Bad arguments"); | 369 | I_Error ("V_GetBlock: Bad arguments"); |
370 | #endif | 370 | #endif |
371 | 371 | ||
372 | src = screens[scrn] + y*SCREENWIDTH+x; | 372 | src = d_screens[scrn] + y*SCREENWIDTH+x; |
373 | 373 | ||
374 | while (height--) | 374 | while (height--) |
375 | { | 375 | { |
@@ -394,13 +394,13 @@ void V_Init (void) | |||
394 | #define PREALLOCED_SCREENS 2 | 394 | #define PREALLOCED_SCREENS 2 |
395 | 395 | ||
396 | // CPhipps - no point in "stick these in low dos memory on PCs" anymore | 396 | // CPhipps - no point in "stick these in low dos memory on PCs" anymore |
397 | // Allocate the screens individually, so I_InitGraphics can release screens[0] | 397 | // Allocate the screens individually, so I_InitGraphics can release d_screens[0] |
398 | // if e.g. it wants a MitSHM buffer instead | 398 | // if e.g. it wants a MitSHM buffer instead |
399 | 399 | ||
400 | for (i=0 ; i<PREALLOCED_SCREENS ; i++) | 400 | for (i=0 ; i<PREALLOCED_SCREENS ; i++) |
401 | screens[i] = calloc(SCREENWIDTH*SCREENHEIGHT, 1); | 401 | d_screens[i] = calloc(SCREENWIDTH*SCREENHEIGHT, 1); |
402 | for (; i<4; i++) // Clear the rest (paranoia) | 402 | for (; i<4; i++) // Clear the rest (paranoia) |
403 | screens[i] = NULL; | 403 | d_screens[i] = NULL; |
404 | } | 404 | } |
405 | 405 | ||
406 | // | 406 | // |
@@ -448,7 +448,7 @@ void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch, | |||
448 | if (!(flags & VPT_STRETCH)) { | 448 | if (!(flags & VPT_STRETCH)) { |
449 | unsigned int col; | 449 | unsigned int col; |
450 | const column_t *column; | 450 | const column_t *column; |
451 | byte *desttop = screens[scrn]+y*SCREENWIDTH+x; | 451 | byte *desttop = d_screens[scrn]+y*SCREENWIDTH+x; |
452 | unsigned int w = SHORT(patch->width); | 452 | unsigned int w = SHORT(patch->width); |
453 | 453 | ||
454 | if (!scrn) | 454 | if (!scrn) |
@@ -544,7 +544,7 @@ void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch, | |||
544 | V_MarkRect ( stretchx, stretchy, (SHORT( patch->width ) * DX ) >> 16, | 544 | V_MarkRect ( stretchx, stretchy, (SHORT( patch->width ) * DX ) >> 16, |
545 | (SHORT( patch->height) * DY ) >> 16 ); | 545 | (SHORT( patch->height) * DY ) >> 16 ); |
546 | 546 | ||
547 | desttop = screens[scrn] + stretchy * SCREENWIDTH + stretchx; | 547 | desttop = d_screens[scrn] + stretchy * SCREENWIDTH + stretchx; |
548 | 548 | ||
549 | for ( col = 0; col <= w; x++, col+=DXI, desttop++ ) { | 549 | for ( col = 0; col <= w; x++, col+=DXI, desttop++ ) { |
550 | const column_t *column; | 550 | const column_t *column; |
@@ -640,11 +640,11 @@ byte *V_PatchToBlock(const char* name, int cm, | |||
640 | enum patch_translation_e flags, | 640 | enum patch_translation_e flags, |
641 | unsigned short* width, unsigned short* height) | 641 | unsigned short* width, unsigned short* height) |
642 | { | 642 | { |
643 | byte *oldscr = screens[1]; | 643 | byte *oldscr = d_screens[1]; |
644 | byte *block; | 644 | byte *block; |
645 | const patch_t *patch; | 645 | const patch_t *patch; |
646 | 646 | ||
647 | screens[1] = calloc(SCREENWIDTH*SCREENHEIGHT, 1); | 647 | d_screens[1] = calloc(SCREENWIDTH*SCREENHEIGHT, 1); |
648 | 648 | ||
649 | patch = W_CacheLumpName(name); | 649 | patch = W_CacheLumpName(name); |
650 | V_DrawMemPatch(SHORT(patch->leftoffset), SHORT(patch->topoffset), | 650 | V_DrawMemPatch(SHORT(patch->leftoffset), SHORT(patch->topoffset), |
@@ -662,8 +662,8 @@ byte *V_PatchToBlock(const char* name, int cm, | |||
662 | V_GetBlock(0, 0, 1, *width, *height, | 662 | V_GetBlock(0, 0, 1, *width, *height, |
663 | block = malloc((long)(*width) * (*height))); | 663 | block = malloc((long)(*width) * (*height))); |
664 | 664 | ||
665 | free(screens[1]); | 665 | free(d_screens[1]); |
666 | screens[1] = oldscr; | 666 | d_screens[1] = oldscr; |
667 | return block; | 667 | return block; |
668 | } | 668 | } |
669 | #endif /* GL_DOOM */ | 669 | #endif /* GL_DOOM */ |
@@ -691,7 +691,7 @@ void V_SetPalette(int pal) | |||
691 | #ifndef GL_DOOM | 691 | #ifndef GL_DOOM |
692 | void V_FillRect(int scrn, int x, int y, int width, int height, byte colour) | 692 | void V_FillRect(int scrn, int x, int y, int width, int height, byte colour) |
693 | { | 693 | { |
694 | byte* dest = screens[scrn] + x + y*SCREENWIDTH; | 694 | byte* dest = d_screens[scrn] + x + y*SCREENWIDTH; |
695 | while (height--) { | 695 | while (height--) { |
696 | memset(dest, colour, width); | 696 | memset(dest, colour, width); |
697 | dest += SCREENWIDTH; | 697 | dest += SCREENWIDTH; |
diff --git a/apps/plugins/doom/v_video.h b/apps/plugins/doom/v_video.h index c9926e8997..c4b8927109 100644 --- a/apps/plugins/doom/v_video.h +++ b/apps/plugins/doom/v_video.h | |||
@@ -72,7 +72,7 @@ typedef enum | |||
72 | 72 | ||
73 | #define CR_DEFAULT CR_RED /* default value for out of range colors */ | 73 | #define CR_DEFAULT CR_RED /* default value for out of range colors */ |
74 | 74 | ||
75 | extern byte *screens[6]; | 75 | extern byte *d_screens[6]; |
76 | extern int dirtybox[4]; | 76 | extern int dirtybox[4]; |
77 | extern const byte gammatable[5][256]; | 77 | extern const byte gammatable[5][256]; |
78 | extern int usegamma; | 78 | extern int usegamma; |
@@ -173,11 +173,11 @@ void V_SetPalette(int pal); | |||
173 | // CPhipps - function to plot a pixel | 173 | // CPhipps - function to plot a pixel |
174 | 174 | ||
175 | #ifndef GL_DOOM | 175 | #ifndef GL_DOOM |
176 | #define V_PlotPixel(s,x,y,c) screens[s][x+SCREENWIDTH*y]=c | 176 | #define V_PlotPixel(s,x,y,c) d_screens[s][x+SCREENWIDTH*y]=c |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | #define V_AllocScreen(scrn) screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT) | 179 | #define V_AllocScreen(scrn) d_screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT) |
180 | #define V_FreeScreen(scrn) free(screens[scrn]); screens[scrn] = NULL | 180 | #define V_FreeScreen(scrn) free(d_screens[scrn]); d_screens[scrn] = NULL |
181 | 181 | ||
182 | #ifdef GL_DOOM | 182 | #ifdef GL_DOOM |
183 | #include "gl_struct.h" | 183 | #include "gl_struct.h" |
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c new file mode 100644 index 0000000000..6767940938 --- /dev/null +++ b/apps/plugins/text_editor.c | |||
@@ -0,0 +1,447 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Jonathan Gordon | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "plugin.h" | ||
20 | /* button definitions, every keypad must only have select,menu and cancel */ | ||
21 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
22 | #define TEXT_EDITOR_SELECT BUTTON_PLAY | ||
23 | #define TEXT_EDITOR_CANCEL BUTTON_OFF | ||
24 | #define TEXT_EDITOR_ITEM_MENU BUTTON_F1 | ||
25 | |||
26 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
27 | #define TEXT_EDITOR_SELECT_PRE BUTTON_MENU | ||
28 | #define TEXT_EDITOR_SELECT (BUTTON_MENU|BUTTON_REL) | ||
29 | #define TEXT_EDITOR_CANCEL BUTTON_OFF | ||
30 | #define TEXT_EDITOR_ITEM_MENU BUTTON_MENU|BUTTON_REPEAT | ||
31 | |||
32 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
33 | #define TEXT_EDITOR_SELECT BUTTON_SELECT | ||
34 | #define TEXT_EDITOR_CANCEL BUTTON_OFF | ||
35 | #define TEXT_EDITOR_DELETE BUTTON_REC | ||
36 | #define TEXT_EDITOR_ITEM_MENU BUTTON_MODE | ||
37 | |||
38 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) | ||
39 | #define TEXT_EDITOR_SELECT_PRE BUTTON_SELECT | ||
40 | #define TEXT_EDITOR_SELECT ( BUTTON_SELECT | BUTTON_REL) | ||
41 | #define TEXT_EDITOR_CANCEL_PRE BUTTON_SELECT | ||
42 | #define TEXT_EDITOR_CANCEL (BUTTON_SELECT | BUTTON_MENU) | ||
43 | #define TEXT_EDITOR_DELETE (BUTTON_LEFT) | ||
44 | #define TEXT_EDITOR_ITEM_MENU (BUTTON_MENU) | ||
45 | |||
46 | #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD | ||
47 | |||
48 | #elif CONFIG_KEYPAD == IAUDIO_X5_PAD | ||
49 | #define TEXT_EDITOR_SELECT BUTTON_SELECT | ||
50 | #define TEXT_EDITOR_CANCEL BUTTON_POWER | ||
51 | #define TEXT_EDITOR_ITEM_MENU BUTTON_PLAY | ||
52 | |||
53 | #elif CONFIG_KEYPAD == GIGABEAT_PAD | ||
54 | |||
55 | #else | ||
56 | #error TEXT_EDITOR: Unsupported keypad | ||
57 | #endif | ||
58 | |||
59 | #define MAX_LINE_LEN 128 | ||
60 | |||
61 | #if PLUGIN_BUFFER_SIZE > 0x45000 | ||
62 | #define MAX_LINES 2048 | ||
63 | #else | ||
64 | #define MAX_LINES 128 | ||
65 | #endif | ||
66 | |||
67 | PLUGIN_HEADER | ||
68 | static struct plugin_api* rb; | ||
69 | |||
70 | struct LineStruct { | ||
71 | char line[MAX_LINE_LEN]; | ||
72 | int prev; /* index to prev item, or -1 */ | ||
73 | int next; /* index to next item, or -1 */ | ||
74 | }; | ||
75 | |||
76 | struct LineStruct lines[MAX_LINES]; | ||
77 | int line_count = 0; | ||
78 | int first = -1, last = -1; | ||
79 | int indicies[MAX_LINES]; | ||
80 | /**************************** stuff for the linked lists ***************/ | ||
81 | int build_indicies(void) | ||
82 | { | ||
83 | int i=0, index = first; | ||
84 | struct LineStruct *line; | ||
85 | if (first==-1) | ||
86 | return 0; | ||
87 | while (i<line_count) | ||
88 | { | ||
89 | indicies[i++] = index; | ||
90 | DEBUGF("%d,",index); | ||
91 | line = &lines[index]; | ||
92 | index = line->next; | ||
93 | |||
94 | } | ||
95 | DEBUGF("\n"); | ||
96 | return 1; | ||
97 | } | ||
98 | |||
99 | int find_first_free(int start) | ||
100 | { | ||
101 | int i; | ||
102 | if ((start <0) || (start >=MAX_LINES)) | ||
103 | start = 0; | ||
104 | i = start; | ||
105 | do | ||
106 | { | ||
107 | if (lines[i].line[0] == '\0') | ||
108 | return i; | ||
109 | i = (i+1)%MAX_LINES; | ||
110 | } while (i!=start); | ||
111 | return -1; | ||
112 | } | ||
113 | |||
114 | int add_line(char *line, int idx_after_me) | ||
115 | { | ||
116 | struct LineStruct *temp; | ||
117 | int next; | ||
118 | int this_idx = find_first_free(idx_after_me); | ||
119 | if ((line_count >= MAX_LINES) || (this_idx == -1)) | ||
120 | return -1; | ||
121 | DEBUGF("line:%s ,idx_after_me=%d\n",line,idx_after_me); | ||
122 | if (idx_after_me == -1) /* add as the first item */ | ||
123 | { | ||
124 | rb->strcpy(lines[this_idx].line,line); | ||
125 | lines[this_idx].prev = -1; | ||
126 | if (first != -1) | ||
127 | lines[first].prev = this_idx; | ||
128 | lines[this_idx].next = first; | ||
129 | first = this_idx; | ||
130 | if (last == idx_after_me) | ||
131 | last = this_idx; | ||
132 | line_count++; | ||
133 | return 1; | ||
134 | } | ||
135 | |||
136 | temp = &lines[idx_after_me]; | ||
137 | next = lines[idx_after_me].next; | ||
138 | temp->next = this_idx; | ||
139 | rb->strcpy(lines[this_idx].line,line); | ||
140 | temp = &lines[this_idx]; | ||
141 | temp->next = next; | ||
142 | temp->prev = idx_after_me; | ||
143 | if (last == idx_after_me) | ||
144 | last = this_idx; | ||
145 | if (first == -1) | ||
146 | first = this_idx; | ||
147 | line_count ++; | ||
148 | return this_idx; | ||
149 | } | ||
150 | |||
151 | void del_line(int line) | ||
152 | { | ||
153 | int idx_prev, idx_next; | ||
154 | idx_prev = (&lines[line])->prev; | ||
155 | idx_next = (&lines[line])->next; | ||
156 | lines[line].line[0] = '\0'; | ||
157 | lines[idx_prev].next = idx_next; | ||
158 | lines[idx_next].prev = idx_prev; | ||
159 | line_count --; | ||
160 | } | ||
161 | char *list_get_name_cb(int selected_item,void* data,char* buf) | ||
162 | { | ||
163 | (void)data; | ||
164 | rb->strcpy(buf,lines[indicies[selected_item]].line); | ||
165 | return buf; | ||
166 | } | ||
167 | char filename[1024]; | ||
168 | void save_changes(int overwrite) | ||
169 | { | ||
170 | int fd; | ||
171 | int i; | ||
172 | |||
173 | if (!filename[0] || overwrite) | ||
174 | { | ||
175 | rb->strcpy(filename,"/"); | ||
176 | rb->kbd_input(filename,1024); | ||
177 | } | ||
178 | |||
179 | fd = rb->open(filename,O_WRONLY|O_CREAT); | ||
180 | if (!fd) | ||
181 | { | ||
182 | rb->splash(HZ*2,1,"Changes NOT saved"); | ||
183 | return; | ||
184 | } | ||
185 | |||
186 | rb->lcd_clear_display(); | ||
187 | build_indicies(); | ||
188 | for (i=0;i<line_count;i++) | ||
189 | { | ||
190 | rb->fdprintf(fd,"%s\n",lines[indicies[i]].line); | ||
191 | } | ||
192 | |||
193 | rb->close(fd); | ||
194 | } | ||
195 | |||
196 | void setup_lists(struct gui_synclist *lists) | ||
197 | { | ||
198 | build_indicies(); | ||
199 | rb->gui_synclist_init(lists,list_get_name_cb,0); | ||
200 | rb->gui_synclist_set_icon_callback(lists,NULL); | ||
201 | rb->gui_synclist_set_nb_items(lists,line_count); | ||
202 | rb->gui_synclist_limit_scroll(lists,true); | ||
203 | rb->gui_synclist_select_item(lists, 0); | ||
204 | rb->gui_synclist_draw(lists); | ||
205 | } | ||
206 | enum { | ||
207 | MENU_RET_SAVE = -1, | ||
208 | MENU_RET_NO_UPDATE, | ||
209 | MENU_RET_UPDATE, | ||
210 | }; | ||
211 | int do_item_menu(int cur_sel, char* copy_buffer) | ||
212 | { | ||
213 | int m, ret = 0; | ||
214 | static const struct menu_item items[] = { | ||
215 | { "Cut", NULL }, | ||
216 | { "Copy", NULL }, | ||
217 | { "", NULL }, | ||
218 | { "Insert Above", NULL }, | ||
219 | { "Insert Below", NULL }, | ||
220 | { "", NULL }, | ||
221 | { "Cat To Above",NULL }, | ||
222 | /* { "Split Line",NULL }, */ | ||
223 | { "", NULL }, | ||
224 | { "Save", NULL }, | ||
225 | }; | ||
226 | m = rb->menu_init(items, sizeof(items) / sizeof(*items), | ||
227 | NULL, NULL, NULL, NULL); | ||
228 | |||
229 | switch (rb->menu_show(m)) | ||
230 | { | ||
231 | case 0: /* cut */ | ||
232 | rb->strcpy(copy_buffer,lines[indicies[cur_sel]].line); | ||
233 | del_line(indicies[cur_sel]); | ||
234 | ret = MENU_RET_UPDATE; | ||
235 | break; | ||
236 | case 1: /* copy */ | ||
237 | rb->strcpy(copy_buffer,lines[indicies[cur_sel]].line); | ||
238 | ret = MENU_RET_NO_UPDATE; | ||
239 | break; | ||
240 | case 2: /* blank */ | ||
241 | ret = MENU_RET_NO_UPDATE; | ||
242 | break; | ||
243 | |||
244 | case 3: /* insert above */ | ||
245 | if (!rb->kbd_input(copy_buffer,MAX_LINE_LEN)) | ||
246 | { | ||
247 | add_line(copy_buffer,lines[indicies[cur_sel]].prev); | ||
248 | copy_buffer[0]='\0'; | ||
249 | ret = MENU_RET_UPDATE; | ||
250 | } | ||
251 | break; | ||
252 | case 4: /* insert below */ | ||
253 | if (!rb->kbd_input(copy_buffer,MAX_LINE_LEN)) | ||
254 | { | ||
255 | add_line(copy_buffer,indicies[cur_sel]); | ||
256 | copy_buffer[0]='\0'; | ||
257 | ret = MENU_RET_UPDATE; | ||
258 | } | ||
259 | break; | ||
260 | case 5: /* blank */ | ||
261 | ret = MENU_RET_NO_UPDATE; | ||
262 | break; | ||
263 | case 6: /* cat to above */ | ||
264 | if (cur_sel>0) | ||
265 | { | ||
266 | rb->strcat(lines[indicies[cur_sel-1]].line,lines[indicies[cur_sel]].line); | ||
267 | del_line(indicies[cur_sel]); | ||
268 | ret = MENU_RET_UPDATE; | ||
269 | } | ||
270 | break; | ||
271 | /* case 7: // split line */ | ||
272 | |||
273 | case 7: /* save */ | ||
274 | ret = MENU_RET_SAVE; | ||
275 | break; | ||
276 | default: | ||
277 | ret = MENU_RET_NO_UPDATE; | ||
278 | break; | ||
279 | } | ||
280 | rb->menu_exit(m); | ||
281 | return ret; | ||
282 | } | ||
283 | /* this is the plugin entry point */ | ||
284 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
285 | { | ||
286 | int fd; | ||
287 | char temp_line[MAX_LINE_LEN]; | ||
288 | |||
289 | struct gui_synclist lists; | ||
290 | bool exit = false; | ||
291 | int button, last_button = BUTTON_NONE; | ||
292 | bool changed = false; | ||
293 | int cur_sel; | ||
294 | char copy_buffer[MAX_LINE_LEN]; copy_buffer[0]='\0'; | ||
295 | |||
296 | rb = api; | ||
297 | if (parameter) | ||
298 | { | ||
299 | rb->strcpy(filename,(char*)parameter); | ||
300 | fd = rb->open(filename,O_RDONLY); | ||
301 | if (fd<0) | ||
302 | { | ||
303 | rb->splash(HZ*2,true,"Couldnt open file: %s",(char*)parameter); | ||
304 | return PLUGIN_ERROR; | ||
305 | } | ||
306 | /* read in the file */ | ||
307 | while (rb->read_line(fd,temp_line,MAX_LINE_LEN)) | ||
308 | { | ||
309 | if (add_line(temp_line,last) < 0) | ||
310 | { | ||
311 | rb->splash(HZ*2,true,"Error reading file: %s",(char*)parameter); | ||
312 | rb->close(fd); | ||
313 | return PLUGIN_ERROR; | ||
314 | } | ||
315 | } | ||
316 | rb->close(fd); | ||
317 | } | ||
318 | else filename[0] = '\0'; | ||
319 | /* now dump it in the list */ | ||
320 | setup_lists(&lists); | ||
321 | while (!exit) | ||
322 | { | ||
323 | rb->gui_synclist_draw(&lists); | ||
324 | cur_sel = rb->gui_synclist_get_sel_pos(&lists); | ||
325 | button = rb->button_get(true); | ||
326 | if (rb->gui_synclist_do_button(&lists,button)) | ||
327 | continue; | ||
328 | switch (button) | ||
329 | { | ||
330 | case TEXT_EDITOR_SELECT: | ||
331 | { | ||
332 | #ifdef TEXT_EDITOR_SELECT_PRE | ||
333 | if (last_button != TEXT_EDITOR_SELECT_PRE) | ||
334 | break; | ||
335 | #endif | ||
336 | char buf[MAX_LINE_LEN];buf[0]='\0'; | ||
337 | |||
338 | if (line_count) | ||
339 | rb->strcpy(buf,lines[indicies[cur_sel]].line); | ||
340 | if (!rb->kbd_input(buf,MAX_LINE_LEN)) | ||
341 | { | ||
342 | if (line_count) | ||
343 | rb->strcpy(lines[indicies[cur_sel]].line,buf); | ||
344 | else { add_line(buf, first); setup_lists(&lists); } | ||
345 | changed = true; | ||
346 | } | ||
347 | } | ||
348 | break; | ||
349 | #ifdef TEXT_EDITOR_DELETE | ||
350 | case TEXT_EDITOR_DELETE: | ||
351 | #ifdef TEXT_EDITOR_DELETE_PRE | ||
352 | if (last_button != TEXT_EDITOR_DELETE_PRE) | ||
353 | break; | ||
354 | #endif | ||
355 | if (!line_count) break; | ||
356 | rb->strcpy(copy_buffer,lines[indicies[cur_sel]].line); | ||
357 | del_line(indicies[cur_sel]); | ||
358 | changed = true; | ||
359 | setup_lists(&lists); | ||
360 | break; | ||
361 | #endif | ||
362 | #ifdef TEXT_EDITOR_ITEM_MENU | ||
363 | case TEXT_EDITOR_ITEM_MENU: | ||
364 | #ifdef TEXT_EDITOR_RC_ITEM_MENU | ||
365 | case TEXT_EDITOR_RC_ITEM_MENU: | ||
366 | #endif | ||
367 | #ifdef TEXT_EDITOR_ITEM_MENU_PRE | ||
368 | if (lastbutton != TEXT_EDITOR_ITEM_MENU_PRE | ||
369 | #ifdef TEXT_EDITOR_RC_ITEM_MENU_PRE | ||
370 | && lastbutton != TEXT_EDITOR_RC_ITEM_MENU_PRE | ||
371 | #endif | ||
372 | ) | ||
373 | break; | ||
374 | #endif | ||
375 | { /* do the item menu */ | ||
376 | switch (do_item_menu(cur_sel, copy_buffer)) | ||
377 | { | ||
378 | case MENU_RET_SAVE: | ||
379 | save_changes(1); | ||
380 | changed = false; | ||
381 | break; | ||
382 | case MENU_RET_UPDATE: | ||
383 | changed = true; | ||
384 | setup_lists(&lists); | ||
385 | break; | ||
386 | case MENU_RET_NO_UPDATE: | ||
387 | break; | ||
388 | } | ||
389 | } | ||
390 | break; | ||
391 | #endif /* TEXT_EDITOR_ITEM_MENU */ | ||
392 | case TEXT_EDITOR_CANCEL: | ||
393 | #ifdef TEXT_EDITOR_CANCEL_PRE | ||
394 | if (last_button != TEXT_EDITOR_CANCEL_PRE) | ||
395 | break; | ||
396 | #endif | ||
397 | if (changed) | ||
398 | { | ||
399 | int m; | ||
400 | int result; | ||
401 | |||
402 | static const struct menu_item items[] = { | ||
403 | { "Return", NULL }, | ||
404 | { " ", NULL }, | ||
405 | { "Save Changes", NULL }, | ||
406 | { "Save As...", NULL }, | ||
407 | { " ", NULL }, | ||
408 | { "Save and Exit", NULL }, | ||
409 | { "Ignore Changes and Exit", NULL }, | ||
410 | }; | ||
411 | |||
412 | m = rb->menu_init(items, sizeof(items) / sizeof(*items), | ||
413 | NULL, NULL, NULL, NULL); | ||
414 | |||
415 | result=rb->menu_show(m); | ||
416 | |||
417 | switch (result) | ||
418 | { | ||
419 | case 0: | ||
420 | break; | ||
421 | case 2: //save to disk | ||
422 | save_changes(1); | ||
423 | changed = 0; | ||
424 | break; | ||
425 | case 3: | ||
426 | save_changes(0); | ||
427 | changed = 0; | ||
428 | break; | ||
429 | |||
430 | case 5: | ||
431 | save_changes(1); | ||
432 | exit=1; | ||
433 | break; | ||
434 | case 6: | ||
435 | exit=1; | ||
436 | break; | ||
437 | } | ||
438 | rb->menu_exit(m); | ||
439 | } | ||
440 | else exit=1; | ||
441 | break; | ||
442 | } | ||
443 | last_button = button; | ||
444 | } | ||
445 | |||
446 | return PLUGIN_OK; | ||
447 | } | ||
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config index a4dcc3695b..6de2bd883a 100644 --- a/apps/plugins/viewers.config +++ b/apps/plugins/viewers.config | |||
@@ -1,6 +1,7 @@ | |||
1 | ch8,viewers/chip8,70 70 7f 7f 70 70 | 1 | ch8,viewers/chip8,70 70 7f 7f 70 70 |
2 | txt,viewers/viewer,55 55 55 55 55 55 | 2 | txt,viewers/viewer,55 55 55 55 55 55 |
3 | nfo,viewers/viewer,55 55 55 55 55 55 | 3 | nfo,viewers/viewer,55 55 55 55 55 55 |
4 | txt,rocks/text_editor, 55 55 55 55 55 55 | ||
4 | jpg,viewers/jpeg,18 24 3C 3C 24 18 | 5 | jpg,viewers/jpeg,18 24 3C 3C 24 18 |
5 | ucl,viewers/rockbox_flash,2A 7F 41 41 7F 2A | 6 | ucl,viewers/rockbox_flash,2A 7F 41 41 7F 2A |
6 | rvf,viewers/video,5D 7F 5D 7F 5D 7F | 7 | rvf,viewers/video,5D 7F 5D 7F 5D 7F |
@@ -15,4 +16,5 @@ rsp,viewers/searchengine, 0e 11 11 31 7e 60 | |||
15 | ss,rocks/sudoku, 55 55 55 55 55 55 | 16 | ss,rocks/sudoku, 55 55 55 55 55 55 |
16 | wav,viewers/wav2wv, 00 00 00 00 00 00 | 17 | wav,viewers/wav2wv, 00 00 00 00 00 00 |
17 | wav,viewers/mp3_encoder, 00 00 00 00 00 00 | 18 | wav,viewers/mp3_encoder, 00 00 00 00 00 00 |
18 | wav,viewers/wavplay,60 7F 05 35 3F 00 \ No newline at end of file | 19 | wav,viewers/wavplay,60 7F 05 35 3F 00 |
20 | |||