forked from len0rd/rockbox
Databox: Added crude print() function, and enabled building on all targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6442 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b0b12e685e
commit
68ffd8fd2f
3 changed files with 40 additions and 6 deletions
|
@ -39,11 +39,11 @@ DIRS = .
|
||||||
# Subdirs containing multi-file plugins
|
# Subdirs containing multi-file plugins
|
||||||
|
|
||||||
#for all targets
|
#for all targets
|
||||||
SUBDIRS += searchengine
|
SUBDIRS += searchengine databox
|
||||||
|
|
||||||
#for any recorder and iRiver model
|
#for any recorder and iRiver model
|
||||||
ifneq (,$(strip $(foreach tgt,RECORDER IRIVER,$(findstring $(tgt),$(TARGET)))))
|
ifneq (,$(strip $(foreach tgt,RECORDER IRIVER,$(findstring $(tgt),$(TARGET)))))
|
||||||
SUBDIRS += rockboy databox
|
SUBDIRS += rockboy
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,22 +48,25 @@ struct editing editing;
|
||||||
extern int acceptedmask;
|
extern int acceptedmask;
|
||||||
|
|
||||||
void databox_init(void) {
|
void databox_init(void) {
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
printing.fontfixed = rb->font_get(FONT_SYSFIXED);
|
printing.fontfixed = rb->font_get(FONT_SYSFIXED);
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
printing.font_w = printing.fontfixed->maxwidth;
|
printing.font_w = printing.fontfixed->maxwidth;
|
||||||
printing.font_h = printing.fontfixed->height;
|
printing.font_h = printing.fontfixed->height;
|
||||||
|
#endif
|
||||||
printing.line=0;
|
printing.line=0;
|
||||||
printing.position=0;
|
printing.position=0;
|
||||||
editor.editingmode = INVALID_MARK;
|
editor.editingmode = INVALID_MARK;
|
||||||
editor.token = tokenbuf;
|
editor.token = tokenbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
void print(char *word, int invert) {
|
void print(char *word, int invert) {
|
||||||
int strlen=rb->strlen(word), newpos=printing.position+strlen+1;
|
int strlen=rb->strlen(word), newpos=printing.position+strlen+1;
|
||||||
if(newpos*printing.font_w>LCD_WIDTH) {
|
if(newpos*printing.font_w>LCD_WIDTH) {
|
||||||
printing.line++;
|
printing.line++;
|
||||||
printing.position=0;
|
printing.position=0;
|
||||||
newpos=printing.position+strlen+1;
|
newpos=printing.position+strlen+1;
|
||||||
}
|
}
|
||||||
rb->lcd_putsxy(printing.font_w*printing.position,printing.font_h*printing.line,word);
|
rb->lcd_putsxy(printing.font_w*printing.position,printing.font_h*printing.line,word);
|
||||||
if(invert)
|
if(invert)
|
||||||
|
@ -71,6 +74,27 @@ void print(char *word, int invert) {
|
||||||
rb->lcd_update_rect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h);
|
rb->lcd_update_rect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h);
|
||||||
printing.position=newpos;
|
printing.position=newpos;
|
||||||
}
|
}
|
||||||
|
#else /* HAVE_LCD_CHARCELLS */
|
||||||
|
#define MARKER_LEFT 0x81
|
||||||
|
#define MARKER_RIGHT 0x82
|
||||||
|
void print(char *word, int invert) {
|
||||||
|
int strlen = rb->strlen(word);
|
||||||
|
int newpos = printing.position + strlen + (invert ? 3 : 1);
|
||||||
|
if (newpos > 11) {
|
||||||
|
printing.line++;
|
||||||
|
printing.position = 0;
|
||||||
|
newpos = printing.position + strlen + (invert ? 3 : 1);
|
||||||
|
}
|
||||||
|
if (invert) {
|
||||||
|
rb->lcd_putc(printing.position, printing.line, MARKER_LEFT);
|
||||||
|
rb->lcd_puts(printing.position + 1, printing.line, word);
|
||||||
|
rb->lcd_putc(printing.position + strlen + 1, printing.line, MARKER_RIGHT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rb->lcd_puts(printing.position, printing.line, word);
|
||||||
|
printing.position = newpos;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void displaytstream(struct token *token) {
|
void displaytstream(struct token *token) {
|
||||||
int index=0;
|
int index=0;
|
||||||
|
@ -224,17 +248,21 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
check_accepted(editor.token,editor.currentindex);
|
check_accepted(editor.token,editor.currentindex);
|
||||||
editing.selecting=1;
|
editing.selecting=1;
|
||||||
buildchoices(acceptedmask);
|
buildchoices(acceptedmask);
|
||||||
rb->memset(&editing.old_token,0,sizeof(struct token));
|
rb->memset(&editing.old_token,0,sizeof(struct token));
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
#endif
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
printing.line=0;
|
printing.line=0;
|
||||||
printing.position=0;
|
printing.position=0;
|
||||||
displaytstream(editor.token);
|
displaytstream(editor.token);
|
||||||
editor.valid=check_tokenstream(editor.token,editor.editingmode);
|
editor.valid=check_tokenstream(editor.token,editor.editingmode);
|
||||||
check_accepted(editor.token,editor.currentindex);
|
check_accepted(editor.token,editor.currentindex);
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
#endif
|
||||||
button = rb->button_get(true);
|
button = rb->button_get(true);
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case BUTTON_LEFT:
|
case BUTTON_LEFT:
|
||||||
|
@ -301,13 +329,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
|
#endif
|
||||||
return PLUGIN_USB_CONNECTED;
|
return PLUGIN_USB_CONNECTED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (!done);
|
} while (!done);
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
|
#endif
|
||||||
if(editor.valid&&editor.tokencount>0) {
|
if(editor.valid&&editor.tokencount>0) {
|
||||||
if(writetstream(filename,editor.token)) {
|
if(writetstream(filename,editor.token)) {
|
||||||
rb->splash(HZ*2,true,"Wrote file succesfully ^.^");
|
rb->splash(HZ*2,true,"Wrote file succesfully ^.^");
|
||||||
|
|
|
@ -29,8 +29,10 @@
|
||||||
extern struct plugin_api* rb;
|
extern struct plugin_api* rb;
|
||||||
|
|
||||||
struct print {
|
struct print {
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
struct font *fontfixed;
|
struct font *fontfixed;
|
||||||
int font_w,font_h;
|
int font_w,font_h;
|
||||||
|
#endif
|
||||||
int line;
|
int line;
|
||||||
int position;
|
int position;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue