1
0
Fork 0
forked from len0rd/rockbox

Remove a viewport ambiguity by changing the screens width/heigth members into lcdwidth/lcdheight. Normal usercode should always use getwidth()/getheigth() as that returns the viewport width/height. Fixes issues that would have appeared in many places when introducing viewports with sizes != lcd sizes.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17857 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2008-06-28 20:45:21 +00:00
parent 3d240f1e2a
commit 205f3df781
26 changed files with 165 additions and 149 deletions

View file

@ -158,11 +158,11 @@ static void draw_screen(struct screen *display, char *title,
enough to display the selected slider - calculate total height enough to display the selected slider - calculate total height
of display with three sliders present */ of display with three sliders present */
display_three_rows = display_three_rows =
display->height >= MARGIN_TOP + display->getheight() >= MARGIN_TOP +
display->char_height*4 + /* Title + 3 sliders */ display->char_height*4 + /* Title + 3 sliders */
TITLE_MARGIN_BOTTOM + TITLE_MARGIN_BOTTOM +
SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */ SELECTOR_TB_MARGIN*6 + /* 2 margins/slider */
MARGIN_BOTTOM; MARGIN_BOTTOM;
/* Figure out widest label character in case they vary - /* Figure out widest label character in case they vary -
this function assumes labels are one character */ this function assumes labels are one character */
@ -178,13 +178,13 @@ static void draw_screen(struct screen *display, char *title,
/* Draw title string */ /* Draw title string */
set_drawinfo(display, DRMODE_SOLID, text_color, background_color); set_drawinfo(display, DRMODE_SOLID, text_color, background_color);
display->getstringsize(title, &x, &y); display->getstringsize(title, &x, &y);
display->putsxy((display->width - x) / 2, MARGIN_TOP, title); display->putsxy((display->getwidth() - x) / 2, MARGIN_TOP, title);
/* Get slider positions and top starting position */ /* Get slider positions and top starting position */
text_top = MARGIN_TOP + y + TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; text_top = MARGIN_TOP + y + TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN;
slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN +
max_label_width + SLIDER_MARGIN_LEFT; max_label_width + SLIDER_MARGIN_LEFT;
slider_width = display->width - slider_left - SLIDER_MARGIN_RIGHT - slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT -
display->char_width*2 - SELECTOR_LR_MARGIN - SELECTOR_WIDTH - display->char_width*2 - SELECTOR_LR_MARGIN - SELECTOR_WIDTH -
MARGIN_RIGHT; MARGIN_RIGHT;
@ -208,7 +208,7 @@ static void draw_screen(struct screen *display, char *title,
/* Draw solid bar selection bar */ /* Draw solid bar selection bar */
display->fillrect(0, display->fillrect(0,
text_top - SELECTOR_TB_MARGIN, text_top - SELECTOR_TB_MARGIN,
display->width, display->getwidth(),
display->char_height + display->char_height +
SELECTOR_TB_MARGIN*2); SELECTOR_TB_MARGIN*2);
@ -225,8 +225,8 @@ static void draw_screen(struct screen *display, char *title,
SELECTOR_HEIGHT) / 2; SELECTOR_HEIGHT) / 2;
screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor); screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor);
screen_put_iconxy(display, screen_put_iconxy(display,
display->width - MARGIN_RIGHT - display->getwidth() - MARGIN_RIGHT -
get_icon_width(display->screen_type), get_icon_width(display->screen_type),
top, Icon_Cursor); top, Icon_Cursor);
} }
@ -282,9 +282,9 @@ static void draw_screen(struct screen *display, char *title,
/* Display color swatch on color screens only */ /* Display color swatch on color screens only */
int left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN; int left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN;
int top = text_top + SWATCH_TOP_MARGIN; int top = text_top + SWATCH_TOP_MARGIN;
int width = display->width - left - SELECTOR_LR_MARGIN - int width = display->getwidth() - left - SELECTOR_LR_MARGIN -
SELECTOR_WIDTH - MARGIN_RIGHT; SELECTOR_WIDTH - MARGIN_RIGHT;
int height = display->height - top - MARGIN_BOTTOM; int height = display->getheight() - top - MARGIN_BOTTOM;
/* Only draw if room */ /* Only draw if room */
if (height >= display->char_height + 2) if (height >= display->char_height + 2)
@ -314,11 +314,11 @@ static void draw_screen(struct screen *display, char *title,
display->getstringsize(buf, &x, &y); display->getstringsize(buf, &x, &y);
i = text_top + SWATCH_TOP_MARGIN; i = text_top + SWATCH_TOP_MARGIN;
if (i + y <= display->height - MARGIN_BOTTOM) if (i + y <= display->getheight() - MARGIN_BOTTOM)
{ {
set_drawinfo(display, DRMODE_SOLID, text_color, background_color); set_drawinfo(display, DRMODE_SOLID, text_color, background_color);
x = (display->width - x) / 2; x = (display->getwidth() - x) / 2;
y = (i + display->height - MARGIN_BOTTOM - y) / 2; y = (i + display->getheight() - MARGIN_BOTTOM - y) / 2;
display->putsxy(x, y, buf); display->putsxy(x, y, buf);
} }
} }

View file

@ -788,17 +788,17 @@ static void statusbar_toggle_handler(void *data)
if (!global_settings.statusbar && !draw) if (!global_settings.statusbar && !draw)
{ {
vp->vp.y = 0; vp->vp.y = 0;
vp->vp.height = screens[i].height; vp->vp.height = screens[i].lcdheight;
} }
else else
{ {
vp->vp.y = STATUSBAR_HEIGHT; vp->vp.y = STATUSBAR_HEIGHT;
vp->vp.height = screens[i].height - STATUSBAR_HEIGHT; vp->vp.height = screens[i].lcdheight - STATUSBAR_HEIGHT;
} }
} }
} }
#endif #endif
void gui_sync_wps_init(void) void gui_sync_wps_init(void)
{ {
int i; int i;

View file

@ -78,7 +78,7 @@ void list_init_viewports(struct gui_synclist *list)
{ {
viewport_set_defaults(vp, i); viewport_set_defaults(vp, i);
list->parent[i]->y = gui_statusbar_height(); list->parent[i]->y = gui_statusbar_height();
list->parent[i]->height = screens[i].height - list->parent[i]->y; list->parent[i]->height = screens[i].lcdheight - list->parent[i]->y;
} }
} }
#ifdef HAVE_BUTTONBAR #ifdef HAVE_BUTTONBAR

View file

@ -64,7 +64,7 @@ static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode)
{ {
w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_PITCH), w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_PITCH),
pitch / 10, pitch % 10 ); pitch / 10, pitch % 10 );
display->putsxy((display->width-(w*display->char_width))/2, display->putsxy((display->lcdwidth-(w*display->char_width))/2,
display->nb_lines/2,buf); display->nb_lines/2,buf);
} }
else /* bigger screen, show everything... */ else /* bigger screen, show everything... */
@ -77,9 +77,9 @@ static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode)
ptr = str(LANG_PITCH_UP_SEMITONE); ptr = str(LANG_PITCH_UP_SEMITONE);
} }
display->getstringsize(ptr,&w,&h); display->getstringsize(ptr,&w,&h);
display->putsxy((display->width-w)/2, 0, ptr); display->putsxy((display->lcdwidth-w)/2, 0, ptr);
display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
display->width/2 - 3, h, 7, 8); display->lcdwidth/2 - 3, h, 7, 8);
/* DOWN: Pitch Down */ /* DOWN: Pitch Down */
if (pitch_mode == PITCH_MODE_ABSOLUTE) { if (pitch_mode == PITCH_MODE_ABSOLUTE) {
@ -88,33 +88,35 @@ static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode)
ptr = str(LANG_PITCH_DOWN_SEMITONE); ptr = str(LANG_PITCH_DOWN_SEMITONE);
} }
display->getstringsize(ptr,&w,&h); display->getstringsize(ptr,&w,&h);
display->putsxy((display->width-w)/2, display->height - h, ptr); display->putsxy((display->lcdwidth-w)/2, display->lcdheight - h, ptr);
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
display->width/2 - 3, display->height - h*2, 7, 8); display->lcdwidth/2 - 3,
display->lcdheight - h*2, 7, 8);
/* RIGHT: +2% */ /* RIGHT: +2% */
ptr = "+2%"; ptr = "+2%";
display->getstringsize(ptr,&w,&h); display->getstringsize(ptr,&w,&h);
display->putsxy(display->width-w, (display->height-h)/2, ptr); display->putsxy(display->lcdwidth-w, (display->lcdheight-h)/2, ptr);
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
display->width-w-8, (display->height-h)/2, 7, 8); display->lcdwidth-w-8,
(display->lcdheight-h)/2, 7, 8);
/* LEFT: -2% */ /* LEFT: -2% */
ptr = "-2%"; ptr = "-2%";
display->getstringsize(ptr,&w,&h); display->getstringsize(ptr,&w,&h);
display->putsxy(0, (display->height-h)/2, ptr); display->putsxy(0, (display->lcdheight-h)/2, ptr);
display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
w+1, (display->height-h)/2, 7, 8); w+1, (display->lcdheight-h)/2, 7, 8);
/* "Pitch" */ /* "Pitch" */
snprintf((char *)buf, sizeof(buf), str(LANG_PITCH)); snprintf((char *)buf, sizeof(buf), str(LANG_PITCH));
display->getstringsize(buf,&w,&h); display->getstringsize(buf,&w,&h);
display->putsxy((display->width-w)/2, (display->height/2)-h, buf); display->putsxy((display->lcdwidth-w)/2, (display->lcdheight/2)-h, buf);
/* "XX.X%" */ /* "XX.X%" */
snprintf((char *)buf, sizeof(buf), "%d.%d%%", snprintf((char *)buf, sizeof(buf), "%d.%d%%",
pitch / 10, pitch % 10 ); pitch / 10, pitch % 10 );
display->getstringsize(buf,&w,&h); display->getstringsize(buf,&w,&h);
display->putsxy((display->width-w)/2, display->height/2, buf); display->putsxy((display->lcdwidth-w)/2, display->lcdheight/2, buf);
} }
display->update(); display->update();
@ -123,7 +125,7 @@ static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode)
static int pitch_increase(int pitch, int delta, bool allow_cutoff) static int pitch_increase(int pitch, int delta, bool allow_cutoff)
{ {
int new_pitch; int new_pitch;
if (delta < 0) { if (delta < 0) {
if (pitch + delta >= PITCH_MIN) { if (pitch + delta >= PITCH_MIN) {
new_pitch = pitch + delta; new_pitch = pitch + delta;

View file

@ -107,7 +107,7 @@ static void quickscreen_fix_viewports(struct gui_quickscreen *qs,
vp_icons[screen].height = vp_icons[screen].height =
vps[screen][QUICKSCREEN_BOTTOM].y - vp_icons[screen].y; vps[screen][QUICKSCREEN_BOTTOM].y - vp_icons[screen].y;
if (left_width + right_width > display->width - CENTER_ICONAREA_WIDTH) if (left_width + right_width > display->lcdwidth - CENTER_ICONAREA_WIDTH)
{ {
/* scrolling needed */ /* scrolling needed */
int width = (parent->width - CENTER_ICONAREA_WIDTH)/2; int width = (parent->width - CENTER_ICONAREA_WIDTH)/2;

View file

@ -91,14 +91,14 @@ static void splash(struct screen * screen, const char *fmt, va_list ap)
#endif #endif
if (lastbreak) if (lastbreak)
{ {
if (x + (next - lastbreak) * space_w + w > screen->width) if (x + (next - lastbreak) * space_w + w > screen->lcdwidth)
{ /* too wide, wrap */ { /* too wide, wrap */
widths[line] = x; widths[line] = x;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if (x > maxw) if (x > maxw)
maxw = x; maxw = x;
#endif #endif
if ((y + h > screen->height) || (line >= (MAXLINES-1))) if ((y + h > screen->lcdheight) || (line >= (MAXLINES-1)))
break; /* screen full or out of lines */ break; /* screen full or out of lines */
x = 0; x = 0;
y += h; y += h;
@ -132,8 +132,8 @@ static void splash(struct screen * screen, const char *fmt, va_list ap)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
/* If we center the display, then just clear the box we need and put /* If we center the display, then just clear the box we need and put
a nice little frame and put the text in there! */ a nice little frame and put the text in there! */
y = (screen->height - y) / 2; /* height => y start position */ y = (screen->lcdheight - y) / 2; /* height => y start position */
x = (screen->width - maxw) / 2 - 2; x = (screen->lcdwidth - maxw) / 2 - 2;
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if (screen->depth > 1) if (screen->depth > 1)
@ -147,7 +147,7 @@ static void splash(struct screen * screen, const char *fmt, va_list ap)
#endif #endif
screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
screen->fillrect(x, y-2, maxw+4, screen->height-y*2+4); screen->fillrect(x, y-2, maxw+4, screen->lcdheight-y*2+4);
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if (screen->depth > 1) if (screen->depth > 1)
@ -156,7 +156,7 @@ static void splash(struct screen * screen, const char *fmt, va_list ap)
#endif #endif
screen->set_drawmode(DRMODE_SOLID); screen->set_drawmode(DRMODE_SOLID);
screen->drawrect(x, y-2, maxw+4, screen->height-y*2+4); screen->drawrect(x, y-2, maxw+4, screen->lcdheight-y*2+4);
#else /* HAVE_LCD_CHARCELLS */ #else /* HAVE_LCD_CHARCELLS */
y = 0; /* vertical centering on 2 lines would be silly */ y = 0; /* vertical centering on 2 lines would be silly */
x = 0; x = 0;
@ -167,7 +167,7 @@ static void splash(struct screen * screen, const char *fmt, va_list ap)
for (i = 0; i <= line; i++) for (i = 0; i <= line; i++)
{ {
x = MAX((screen->width - widths[i]) / 2, 0); x = MAX((screen->lcdwidth - widths[i]) / 2, 0);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
screen->putsxy(x, y, lines[i]); screen->putsxy(x, y, lines[i]);

View file

@ -256,7 +256,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
{ {
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
display->fillrect(0, 0, display->width, STATUSBAR_HEIGHT); display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT);
display->set_drawmode(DRMODE_SOLID); display->set_drawmode(DRMODE_SOLID);
if (bar->info.battery_state) if (bar->info.battery_state)
@ -329,7 +329,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
if(!display->has_disk_led && bar->info.led) if(!display->has_disk_led && bar->info.led)
gui_statusbar_led(display); gui_statusbar_led(display);
#endif #endif
display->update_rect(0, 0, display->width, STATUSBAR_HEIGHT); display->update_rect(0, 0, display->getwidth(), STATUSBAR_HEIGHT);
bar->lastinfo = bar->info; bar->lastinfo = bar->info;
} }
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
@ -573,7 +573,7 @@ static void gui_statusbar_icon_lock_remote(struct screen * display)
static void gui_statusbar_led(struct screen * display) static void gui_statusbar_led(struct screen * display)
{ {
display->mono_bitmap(bitmap_icon_disk, display->mono_bitmap(bitmap_icon_disk,
STATUSBAR_DISK_X_POS(display->width), STATUSBAR_DISK_X_POS(display->getwidth()),
STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH, STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH,
STATUSBAR_HEIGHT); STATUSBAR_HEIGHT);
} }
@ -605,7 +605,7 @@ static void gui_statusbar_time(struct screen * display, struct tm *time)
display->setfont(FONT_SYSFIXED); display->setfont(FONT_SYSFIXED);
display->getstringsize(buffer, &width, &height); display->getstringsize(buffer, &width, &height);
if (height <= STATUSBAR_HEIGHT) { if (height <= STATUSBAR_HEIGHT) {
display->putsxy(STATUSBAR_TIME_X_END(display->width) - width, display->putsxy(STATUSBAR_TIME_X_END(display->getwidth()) - width,
STATUSBAR_Y_POS, buffer); STATUSBAR_Y_POS, buffer);
} }
display->setfont(FONT_UI); display->setfont(FONT_UI);

View file

@ -48,10 +48,10 @@ int viewport_get_nb_lines(struct viewport *vp)
void viewport_set_defaults(struct viewport *vp, enum screen_type screen) void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
{ {
vp->x = 0; vp->x = 0;
vp->width = screens[screen].width; vp->width = screens[screen].lcdwidth;
vp->y = gui_statusbar_height(); vp->y = gui_statusbar_height();
vp->height = screens[screen].height - vp->y; vp->height = screens[screen].lcdheight - vp->y;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
vp->drawmode = DRMODE_SOLID; vp->drawmode = DRMODE_SOLID;
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */

View file

@ -1550,16 +1550,17 @@ bool wps_data_load(struct wps_data *wps_data,
/* Initialise the first (default) viewport */ /* Initialise the first (default) viewport */
wps_data->viewports[0].vp.x = 0; wps_data->viewports[0].vp.x = 0;
wps_data->viewports[0].vp.width = display->width; wps_data->viewports[0].vp.width = display->getwidth();
if (!global_settings.statusbar) if (!global_settings.statusbar)
{ {
wps_data->viewports[0].vp.y = 0; wps_data->viewports[0].vp.y = 0;
wps_data->viewports[0].vp.height = display->height; wps_data->viewports[0].vp.height = display->getheight();
} }
else else
{ {
wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT; wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
wps_data->viewports[0].vp.height = display->height - STATUSBAR_HEIGHT; wps_data->viewports[0].vp.height = display->getheight() -
STATUSBAR_HEIGHT;
} }
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
wps_data->viewports[0].vp.font = FONT_UI; wps_data->viewports[0].vp.font = FONT_UI;

View file

@ -399,8 +399,8 @@ static int draw_eq_sliders(int current_band, enum eq_slider_mode mode)
enum eq_type type; enum eq_type type;
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
slider_width[i] = screens[i].width - 4; /* two pixel margin on each side */ slider_width[i] = screens[i].getwidth() - 4; /* 2 pixel margin
each side */
for (i=0; i<5; i++) { for (i=0; i<5; i++) {
cutoff = *setting++; cutoff = *setting++;
q = *setting++; q = *setting++;

View file

@ -448,7 +448,7 @@ int rectrigger(void)
int old_stop_gap = global_settings.rec_stop_gap; int old_stop_gap = global_settings.rec_stop_gap;
int old_trigger_mode = global_settings.rec_trigger_mode; int old_trigger_mode = global_settings.rec_trigger_mode;
int old_trigger_type = global_settings.rec_trigger_type; int old_trigger_type = global_settings.rec_trigger_type;
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
{ {
screens[i].clear_display(); screens[i].clear_display();
@ -457,11 +457,11 @@ int rectrigger(void)
vp[i].height -= SYSFONT_HEIGHT*2; vp[i].height -= SYSFONT_HEIGHT*2;
trig_xpos[i] = 0; trig_xpos[i] = 0;
trig_ypos[i] = vp[i].y + vp[i].height; trig_ypos[i] = vp[i].y + vp[i].height;
pm_y[i] = screens[i].height - SYSFONT_HEIGHT; pm_y[i] = screens[i].getheight() - SYSFONT_HEIGHT;
trig_width[i] = screens[i].width; trig_width[i] = screens[i].getwidth();
} }
/* TODO: what to do if there is < 4 lines on the screen? */ /* TODO: what to do if there is < 4 lines on the screen? */
settings[TRIGGER_MODE] = settings[TRIGGER_MODE] =
find_setting(&global_settings.rec_trigger_mode, NULL); find_setting(&global_settings.rec_trigger_mode, NULL);
settings[TRIGGER_TYPE] = settings[TRIGGER_TYPE] =

View file

@ -35,7 +35,7 @@ void black_background(struct screen* display){
#endif #endif
{ {
display->clear_display(); display->clear_display();
display->fillrect(0,0,display->width,display->height); display->fillrect(0,0,display->getwidth(),display->getheight());
} }
} }

View file

@ -28,7 +28,7 @@
#define ANALOG_SECOND_RADIUS(screen, round) \ #define ANALOG_SECOND_RADIUS(screen, round) \
ANALOG_MINUTE_RADIUS(screen, round) ANALOG_MINUTE_RADIUS(screen, round)
#define ANALOG_MINUTE_RADIUS(screen, round) \ #define ANALOG_MINUTE_RADIUS(screen, round) \
(round?MIN(screen->height/2 -10, screen->width/2 -10):screen->height/2) (round?MIN(screen->getheight()/2 -10, screen->getwidth()/2 -10):screen->getheight()/2)
#define ANALOG_HOUR_RADIUS(screen, round) \ #define ANALOG_HOUR_RADIUS(screen, round) \
(2*ANALOG_MINUTE_RADIUS(screen, round)/3) (2*ANALOG_MINUTE_RADIUS(screen, round)/3)
@ -52,8 +52,8 @@ void polar_to_cartesian_screen_centered(struct screen * display,
int a, int r, int* x, int* y) int a, int r, int* x, int* y)
{ {
polar_to_cartesian(a, r, x, y); polar_to_cartesian(a, r, x, y);
*x+=display->width/2; *x+=display->getwidth()/2;
*y+=display->height/2; *y+=display->getheight()/2;
} }
void angle_to_square(int square_width, int square_height, void angle_to_square(int square_width, int square_height,
@ -87,8 +87,8 @@ void angle_to_square_screen_centered(struct screen * display,
int a, int* x, int* y) int a, int* x, int* y)
{ {
angle_to_square(square_width, square_height, a, x, y); angle_to_square(square_width, square_height, a, x, y);
*x+=display->width/2; *x+=display->getwidth()/2;
*y+=display->height/2; *y+=display->getheight()/2;
} }
void draw_hand(struct screen* display, int angle, void draw_hand(struct screen* display, int angle,
@ -100,9 +100,9 @@ void draw_hand(struct screen* display, int angle,
polar_to_cartesian_screen_centered(display, angle, radius, &x1, &y1); polar_to_cartesian_screen_centered(display, angle, radius, &x1, &y1);
}else{/* fullscreen clock, hands describes square motions */ }else{/* fullscreen clock, hands describes square motions */
int square_width, square_height; int square_width, square_height;
/* radius is defined smallest between width and height */ /* radius is defined smallest between getwidth() and getheight() */
square_height=radius; square_height=radius;
square_width=(radius*display->width)/display->height; square_width=(radius*display->getwidth())/display->getheight();
angle_to_square_screen_centered( angle_to_square_screen_centered(
display, square_width, square_height, angle, &x1, &y1); display, square_width, square_height, angle, &x1, &y1);
} }
@ -140,14 +140,14 @@ void draw_counter(struct screen* display, struct counter* counter)
counter_time.hour, counter_time.minute); counter_time.hour, counter_time.minute);
getstringsize(smalldigits_bitmaps, buffer, &hour_str_w, &str_h); getstringsize(smalldigits_bitmaps, buffer, &hour_str_w, &str_h);
draw_string(display, smalldigits_bitmaps, buffer, draw_string(display, smalldigits_bitmaps, buffer,
display->width-hour_str_w, display->getwidth()-hour_str_w,
display->height-2*str_h); display->getheight()-2*str_h);
rb->snprintf(buffer, 10, "%02d", counter_time.second); rb->snprintf(buffer, 10, "%02d", counter_time.second);
getstringsize(smalldigits_bitmaps, buffer, &second_str_w, &str_h); getstringsize(smalldigits_bitmaps, buffer, &second_str_w, &str_h);
draw_string(display, smalldigits_bitmaps, buffer, draw_string(display, smalldigits_bitmaps, buffer,
display->width-(hour_str_w+second_str_w)/2, display->getwidth()-(hour_str_w+second_str_w)/2,
display->height-str_h); display->getheight()-str_h);
} }
void draw_date(struct screen* display, struct time* time, int date_format) void draw_date(struct screen* display, struct time* time, int date_format)
@ -166,14 +166,14 @@ void draw_date(struct screen* display, struct time* time, int date_format)
/* draws month and day */ /* draws month and day */
getstringsize(smalldigits_bitmaps, buffer, &monthday_str_w, &str_h); getstringsize(smalldigits_bitmaps, buffer, &monthday_str_w, &str_h);
draw_string(display, smalldigits_bitmaps, buffer, draw_string(display, smalldigits_bitmaps, buffer,
0, display->height-year_line*str_h); 0, display->getheight()-year_line*str_h);
rb->snprintf(buffer, 10, "%04d", time->year); rb->snprintf(buffer, 10, "%04d", time->year);
/* draws year */ /* draws year */
getstringsize(smalldigits_bitmaps, buffer, &year_str_w, &str_h); getstringsize(smalldigits_bitmaps, buffer, &year_str_w, &str_h);
draw_string(display, smalldigits_bitmaps, buffer, draw_string(display, smalldigits_bitmaps, buffer,
(monthday_str_w-year_str_w)/2, (monthday_str_w-year_str_w)/2,
display->height-monthday_line*str_h); display->getheight()-monthday_line*str_h);
} }
void draw_border(struct screen* display, int skin) void draw_border(struct screen* display, int skin)
@ -181,7 +181,7 @@ void draw_border(struct screen* display, int skin)
/* Draws square dots every 5 minutes */ /* Draws square dots every 5 minutes */
int i; int i;
int x, y; int x, y;
int size=display->height/50;/* size of the square dots */ int size=display->getheight()/50;/* size of the square dots */
if(size%2)/* a pair number */ if(size%2)/* a pair number */
size++; size++;
for(i=0; i < 60; i+=5){ for(i=0; i < 60; i+=5){
@ -190,7 +190,7 @@ void draw_border(struct screen* display, int skin)
ANALOG_MINUTE_RADIUS(display, skin), &x, &y); ANALOG_MINUTE_RADIUS(display, skin), &x, &y);
}else{ }else{
angle_to_square_screen_centered( angle_to_square_screen_centered(
display, display->width/2-size/2, display->height/2-size/2, display, display->getwidth()/2-size/2, display->getheight()/2-size/2,
MINUTE_ANGLE(i, 0), &x, &y); MINUTE_ANGLE(i, 0), &x, &y);
} }
display->fillrect(x-size/2, y-size/2, size, size); display->fillrect(x-size/2, y-size/2, size, size);
@ -222,15 +222,15 @@ void draw_hour(struct screen* display, struct time* time,
void draw_center_cover(struct screen* display) void draw_center_cover(struct screen* display)
{ {
display->hline((display->width/2)-1, display->hline((display->getwidth()/2)-1,
(display->width/2)+1, (display->height/2)+3); (display->getwidth()/2)+1, (display->getheight()/2)+3);
display->hline((display->width/2)-3, display->hline((display->getwidth()/2)-3,
(display->width/2)+3, (display->height/2)+2); (display->getwidth()/2)+3, (display->getheight()/2)+2);
display->fillrect((display->width/2)-4, (display->height/2)-1, 9, 3); display->fillrect((display->getwidth()/2)-4, (display->getheight()/2)-1, 9, 3);
display->hline((display->width/2)-3, display->hline((display->getwidth()/2)-3,
(display->width/2)+3, (display->height/2)-2); (display->getwidth()/2)+3, (display->getheight()/2)-2);
display->hline((display->width/2)-1, display->hline((display->getwidth()/2)-1,
(display->width/2)+1, (display->height/2)-3); (display->getwidth()/2)+1, (display->getheight()/2)-3);
} }
void analog_clock_draw(struct screen* display, struct time* time, void analog_clock_draw(struct screen* display, struct time* time,

View file

@ -45,8 +45,8 @@ void binary_clock_draw(struct screen* display, struct time* time, int skin){
char buffer[9]; char buffer[9];
int i; int i;
const struct picture* binary_bitmaps = &(binary_skin[skin][display->screen_type]); const struct picture* binary_bitmaps = &(binary_skin[skin][display->screen_type]);
int y_offset=(display->height-(binary_bitmaps->height*3))/2; int y_offset=(display->getheight()-(binary_bitmaps->height*3))/2;
int x_offset=(display->width-(binary_bitmaps->width*6))/2; int x_offset=(display->getwidth()-(binary_bitmaps->width*6))/2;
for(i=0;i<3;i++){ for(i=0;i<3;i++){
print_binary(buffer, lines_values[i], 6); print_binary(buffer, lines_values[i], 6);
draw_string(display, binary_bitmaps, buffer, x_offset, draw_string(display, binary_bitmaps, buffer, x_offset,

View file

@ -64,19 +64,22 @@ void digital_clock_draw(struct screen* display,
} }
} }
getstringsize(digits_bitmaps, buffer, &str_w, &str_h); getstringsize(digits_bitmaps, buffer, &str_w, &str_h);
draw_string(display, digits_bitmaps, buffer, (display->width-str_w)/2, 0); draw_string(display, digits_bitmaps, buffer,
(display->getwidth()-str_w)/2, 0);
if(settings->digital.show_seconds){ if(settings->digital.show_seconds){
buffer_pos=0; buffer_pos=0;
buffer_printf(buffer, buffer_pos, "%02d", time->second); buffer_printf(buffer, buffer_pos, "%02d", time->second);
getstringsize(digits_bitmaps, buffer, &str_w, &str_h); getstringsize(digits_bitmaps, buffer, &str_w, &str_h);
draw_string(display, digits_bitmaps, buffer, (display->width-str_w)/2, draw_string(display, digits_bitmaps, buffer,
(display->getwidth()-str_w)/2,
digits_bitmaps->height); digits_bitmaps->height);
} }
if(settings->general.date_format!=NONE){ if(settings->general.date_format!=NONE){
format_date(buffer, time, settings->general.date_format); format_date(buffer, time, settings->general.date_format);
getstringsize(smalldigits_bitmaps, buffer, &str_w, &str_h); getstringsize(smalldigits_bitmaps, buffer, &str_w, &str_h);
draw_string(display, smalldigits_bitmaps, buffer, (display->width-str_w)/2, draw_string(display, smalldigits_bitmaps, buffer,
display->height-smalldigits_bitmaps->height*2); (display->getwidth()-str_w)/2,
display->getheight()-smalldigits_bitmaps->height*2);
} }
if(counter){ if(counter){
struct time counter_time; struct time counter_time;
@ -84,7 +87,7 @@ void digital_clock_draw(struct screen* display,
rb->snprintf(buffer, 20, "%02d:%02d:%02d", rb->snprintf(buffer, 20, "%02d:%02d:%02d",
counter_time.hour, counter_time.minute, counter_time.second); counter_time.hour, counter_time.minute, counter_time.second);
getstringsize(smalldigits_bitmaps, buffer, &str_w, &str_h); getstringsize(smalldigits_bitmaps, buffer, &str_w, &str_h);
draw_string(display, smalldigits_bitmaps, buffer, (display->width-str_w)/2, draw_string(display, smalldigits_bitmaps, buffer,
display->height-str_h); (display->getwidth()-str_w)/2, display->getheight()-str_h);
} }
} }

View file

@ -144,11 +144,11 @@ void draw_logo(struct screen* display){
void draw_message(struct screen* display, int msg, int y){ void draw_message(struct screen* display, int msg, int y){
const struct picture* message = &(messages[display->screen_type]); const struct picture* message = &(messages[display->screen_type]);
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
display->fillrect(0, display->height-message->height, display->fillrect(0, display->getheight()-message->height,
display->width, message->height); display->getwidth(), message->height);
display->set_drawmode(DRMODE_SOLID); display->set_drawmode(DRMODE_SOLID);
vertical_picture_draw_sprite(display, message, msg, vertical_picture_draw_sprite(display, message, msg,
0, display->height-(message->height*y)); 0, display->getheight()-(message->height*y));
} }
void load_settings(void){ void load_settings(void){

View file

@ -108,8 +108,8 @@ void polygon_init(struct polygon * polygon, struct screen * display)
int i; int i;
for(i=0;i<NB_POINTS;++i) for(i=0;i<NB_POINTS;++i)
{ {
polygon->points[i].x=(rb->rand() % (display->width)); polygon->points[i].x=(rb->rand() % (display->getwidth()));
polygon->points[i].y=(rb->rand() % (display->height)); polygon->points[i].y=(rb->rand() % (display->getheight()));
} }
} }
@ -167,9 +167,9 @@ void polygon_update(struct polygon *polygon, struct screen * display, struct pol
x=1; x=1;
polygon_move->move_steps[i].x=get_new_step(step); polygon_move->move_steps[i].x=get_new_step(step);
} }
else if(x>=display->width) else if(x>=display->getwidth())
{ {
x=display->width-1; x=display->getwidth()-1;
polygon_move->move_steps[i].x=get_new_step(step); polygon_move->move_steps[i].x=get_new_step(step);
} }
polygon->points[i].x=x; polygon->points[i].x=x;
@ -182,9 +182,9 @@ void polygon_update(struct polygon *polygon, struct screen * display, struct pol
y=1; y=1;
polygon_move->move_steps[i].y=get_new_step(step); polygon_move->move_steps[i].y=get_new_step(step);
} }
else if(y>=display->height) else if(y>=display->getheight())
{ {
y=display->height-1; y=display->getheight()-1;
polygon_move->move_steps[i].y=get_new_step(step); polygon_move->move_steps[i].y=get_new_step(step);
} }
polygon->points[i].y=y; polygon->points[i].y=y;

View file

@ -112,7 +112,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
void dice_init(struct dices* dice){ void dice_init(struct dices* dice){
dice->nb_dices=INITIAL_NB_DICES; dice->nb_dices=INITIAL_NB_DICES;
sides_index=INITIAL_NB_SIDES; sides_index=INITIAL_NB_SIDES;
} }
void dice_roll(struct dices* dice) { void dice_roll(struct dices* dice) {
@ -139,8 +139,8 @@ void dice_print(struct dices* dice, struct screen* display){
/* display characteristics */ /* display characteristics */
int char_height, char_width; int char_height, char_width;
display->getstringsize("M", &char_width, &char_height); display->getstringsize("M", &char_width, &char_height);
int display_nb_row=display->height/char_height; int display_nb_row=display->getheight()/char_height;
int display_nb_col=display->width/char_width; int display_nb_col=display->getwidth()/char_width;
int nb_dices_per_line=display_nb_col/4;/* 4 char per dice displayed*/ int nb_dices_per_line=display_nb_col/4;/* 4 char per dice displayed*/
int nb_lines_required=dice->nb_dices/nb_dices_per_line; int nb_lines_required=dice->nb_dices/nb_dices_per_line;

View file

@ -173,8 +173,8 @@ void jackpot_display_slot_machine(struct jackpot* game, struct screen* display)
display->putc(0, 0, '['); display->putc(0, 0, '[');
#else #else
const struct picture* picture= &(jackpot_pictures[display->screen_type]); const struct picture* picture= &(jackpot_pictures[display->screen_type]);
int pos_x=(display->width-NB_SLOTS*(picture->width+1))/2; int pos_x=(display->getwidth()-NB_SLOTS*(picture->width+1))/2;
int pos_y=(display->height-(picture->height))/2; int pos_y=(display->getheight()-(picture->height))/2;
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
for(i=0;i<NB_SLOTS;i++) for(i=0;i<NB_SLOTS;i++)
{ {
@ -223,9 +223,10 @@ void jackpot_info_message(struct screen* display, char* message)
int xpos, ypos; int xpos, ypos;
int message_height, message_width; int message_height, message_width;
display->getstringsize(message, &message_width, &message_height); display->getstringsize(message, &message_width, &message_height);
xpos=(display->width-message_width)/2; xpos=(display->getwidth()-message_width)/2;
ypos=display->height-message_height; ypos=display->getheight()-message_height;
rb->screen_clear_area(display, 0, ypos, display->width, message_height); rb->screen_clear_area(display, 0, ypos, display->getwidth(),
message_height);
display->putsxy(xpos,ypos,message); display->putsxy(xpos,ypos,message);
display->update(); display->update();
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */

View file

@ -176,8 +176,8 @@ void maze_draw(struct maze* maze, struct screen* display)
int point_width, point_height, point_offset_x, point_offset_y; int point_width, point_height, point_offset_x, point_offset_y;
unsigned short cell; unsigned short cell;
wx = (int) display->width / MAZE_WIDTH; wx = (int) display->getwidth() / MAZE_WIDTH;
wy = (int) display->height / MAZE_HEIGHT; wy = (int) display->getheight() / MAZE_HEIGHT;
if(wx>3){ if(wx>3){
point_width=wx-3; point_width=wx-3;

View file

@ -995,7 +995,7 @@ static int star_menu(void)
rb->viewport_set_defaults(&vp[selection], selection); rb->viewport_set_defaults(&vp[selection], selection);
/* we are hiding the statusbar so fix the height also */ /* we are hiding the statusbar so fix the height also */
vp[selection].y = 0; vp[selection].y = 0;
vp[selection].height = rb->screens[selection]->height; vp[selection].height = rb->screens[selection]->lcdheight;
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if (rb->screens[selection]->depth > 1) if (rb->screens[selection]->depth > 1)
{ {

View file

@ -232,7 +232,8 @@ int zx_kbd_input(char* text/*, int buflen*/)
param[l].font_h = param[l].font->height; param[l].font_h = param[l].font->height;
/* check if FONT_UI fits the screen */ /* check if FONT_UI fits the screen */
if (2*param[l].font_h+3 + BUTTONBAR_HEIGHT > rb->screens[l]->height) { if (2*param[l].font_h+3 + BUTTONBAR_HEIGHT >
rb->screens[l]->getheight()) {
param[l].font = rb->font_get(FONT_SYSFIXED); param[l].font = rb->font_get(FONT_SYSFIXED);
param[l].font_h = param[l].font->height; param[l].font_h = param[l].font->height;
param[l].curfont = FONT_SYSFIXED; param[l].curfont = FONT_SYSFIXED;
@ -259,9 +260,9 @@ int zx_kbd_input(char* text/*, int buflen*/)
{ {
if( param[l].kbd_buf[i] == '\n' ) if( param[l].kbd_buf[i] == '\n' )
{ {
k = ( rb->screens[l]->width / param[l].font_w ) k = ( rb->screens[l]->getwidth() / param[l].font_w ) -
- i % ( rb->screens[l]->width / param[l].font_w ) - 1; i % ( rb->screens[l]->getwidth() / param[l].font_w ) - 1;
if( k == ( rb->screens[l]->width / param[l].font_w ) - 1 ) if( k == ( rb->screens[l]->getwidth() / param[l].font_w ) - 1 )
{ {
param[l].nchars--; param[l].nchars--;
for( j = i; j < param[l].nchars; j++ ) for( j = i; j < param[l].nchars; j++ )
@ -303,17 +304,19 @@ int zx_kbd_input(char* text/*, int buflen*/)
if (w > text_w) if (w > text_w)
text_w = w; text_w = w;
} }
param[l].max_chars_text = rb->screens[l]->width / text_w - 2; param[l].max_chars_text = rb->screens[l]->getwidth() / text_w - 2;
/* calculate keyboard grid size */ /* calculate keyboard grid size */
param[l].max_chars = rb->screens[l]->width / param[l].font_w; param[l].max_chars = rb->screens[l]->getwidth() / param[l].font_w;
if (!kbd_loaded) { if (!kbd_loaded) {
param[l].lines = param[l].DEFAULT_LINES; param[l].lines = param[l].DEFAULT_LINES;
param[l].keyboard_margin = DEFAULT_MARGIN; param[l].keyboard_margin = DEFAULT_MARGIN;
} else { } else {
param[l].lines = (rb->screens[l]->height - BUTTONBAR_HEIGHT - statusbar_size) / param[l].font_h - 1; param[l].lines = (rb->screens[l]->lcdheight - BUTTONBAR_HEIGHT -
param[l].keyboard_margin = rb->screens[l]->height - BUTTONBAR_HEIGHT - statusbar_size) / param[l].font_h - 1;
statusbar_size - (param[l].lines+1)*param[l].font_h; param[l].keyboard_margin = rb->screens[l]->lcdheight -
BUTTONBAR_HEIGHT - statusbar_size -
(param[l].lines+1)*param[l].font_h;
if (param[l].keyboard_margin < 3) { if (param[l].keyboard_margin < 3) {
param[l].lines--; param[l].lines--;
param[l].keyboard_margin += param[l].font_h; param[l].keyboard_margin += param[l].font_h;
@ -342,7 +345,7 @@ int zx_kbd_input(char* text/*, int buflen*/)
FOR_NB_SCREENS(l) FOR_NB_SCREENS(l)
rb->screens[l]->clear_display(); rb->screens[l]->clear_display();
/* draw page */ /* draw page */
FOR_NB_SCREENS(l) FOR_NB_SCREENS(l)
{ {
@ -360,12 +363,13 @@ int zx_kbd_input(char* text/*, int buflen*/)
} }
} }
} }
/* separator */ /* separator */
FOR_NB_SCREENS(l) FOR_NB_SCREENS(l)
{ {
rb->screens[l]->hline(0, rb->screens[l]->width - 1, param[l].main_y - param[l].keyboard_margin); rb->screens[l]->hline(0, rb->screens[l]->getwidth() - 1,
param[l].main_y - param[l].keyboard_margin);
/* write out the text */ /* write out the text */
#if 0 #if 0

View file

@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/ * \/ \/ \/ \/ \/
* $Id$ * $Id$
* *
* Copyright (C) 2002 by Björn Stenberg * Copyright (C) 2002 by Bj<EFBFBD>rn Stenberg
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -302,7 +302,7 @@ int kbd_input(char* text, int buflen)
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 96 #if LCD_WIDTH >= 160 && LCD_HEIGHT >= 96
struct screen *sc = &screens[l]; struct screen *sc = &screens[l];
if (sc->width >= 160 && sc->height >= 96) if (sc->getwidth() >= 160 && sc->getheight() >= 96)
{ {
pm->default_kbd = pm->default_kbd =
"ABCDEFG abcdefg !?\" @#$%+'\n" "ABCDEFG abcdefg !?\" @#$%+'\n"
@ -384,7 +384,8 @@ int kbd_input(char* text, int buflen)
pm->font_h = pm->font->height; pm->font_h = pm->font->height;
/* check if FONT_UI fits the screen */ /* check if FONT_UI fits the screen */
if (2*pm->font_h + 3 + statusbar_size + BUTTONBAR_HEIGHT > sc->height) if (2*pm->font_h + 3 + statusbar_size +
BUTTONBAR_HEIGHT > sc->getheight())
{ {
pm->font = font_get(FONT_SYSFIXED); pm->font = font_get(FONT_SYSFIXED);
pm->font_h = pm->font->height; pm->font_h = pm->font->height;
@ -419,11 +420,11 @@ int kbd_input(char* text, int buflen)
{ {
if (pm->kbd_buf[i] == '\n') if (pm->kbd_buf[i] == '\n')
{ {
int k = sc->width / pm->font_w int k = sc->getwidth() / pm->font_w
- i % ( sc->width / pm->font_w ) - 1; - i % ( sc->getwidth() / pm->font_w ) - 1;
int j; int j;
if (k == sc->width / pm->font_w - 1) if (k == sc->getwidth() / pm->font_w - 1)
{ {
pm->nchars--; pm->nchars--;
@ -478,10 +479,10 @@ int kbd_input(char* text, int buflen)
text_w = w; text_w = w;
} }
pm->max_chars_text = sc->width / text_w - 2; pm->max_chars_text = sc->getwidth() / text_w - 2;
/* Calculate keyboard grid size */ /* Calculate keyboard grid size */
pm->max_chars = sc->width / pm->font_w; pm->max_chars = sc->getwidth() / pm->font_w;
if (!kbd_loaded) if (!kbd_loaded)
{ {
@ -490,9 +491,9 @@ int kbd_input(char* text, int buflen)
} }
else else
{ {
pm->lines = (sc->height - BUTTONBAR_HEIGHT - statusbar_size) pm->lines = (sc->getheight() - BUTTONBAR_HEIGHT - statusbar_size)
/ pm->font_h - 1; / pm->font_h - 1;
pm->keyboard_margin = sc->height - BUTTONBAR_HEIGHT - pm->keyboard_margin = sc->getheight() - BUTTONBAR_HEIGHT -
statusbar_size - (pm->lines+1)*pm->font_h; statusbar_size - (pm->lines+1)*pm->font_h;
if (pm->keyboard_margin < 3) if (pm->keyboard_margin < 3)
@ -518,7 +519,7 @@ int kbd_input(char* text, int buflen)
#ifdef KBD_MORSE_INPUT #ifdef KBD_MORSE_INPUT
pm->old_main_y = pm->main_y; pm->old_main_y = pm->main_y;
if (morse_mode) if (morse_mode)
pm->main_y = sc->height - pm->font_h; pm->main_y = sc->getheight() - pm->font_h;
#endif #endif
} }
@ -587,7 +588,7 @@ int kbd_input(char* text, int buflen)
} }
pm->x += w*5 - 3; pm->x += w*5 - 3;
if (pm->x >= sc->width - w*6) if (pm->x >= sc->getwidth() - w*6)
{ {
pm->x = 0; pm->x = 0;
pm->y += 8; /* sysfixed font height */ pm->y += 8; /* sysfixed font height */
@ -639,10 +640,10 @@ int kbd_input(char* text, int buflen)
doesn't collide */ doesn't collide */
sc->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); sc->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
sc->fillrect(0, pm->main_y - pm->keyboard_margin - 1, sc->fillrect(0, pm->main_y - pm->keyboard_margin - 1,
sc->width, pm->font_h + 4); sc->getwidth(), pm->font_h + 4);
sc->set_drawmode(DRMODE_SOLID); sc->set_drawmode(DRMODE_SOLID);
sc->hline(0, sc->width - 1, pm->main_y - pm->keyboard_margin); sc->hline(0, sc->getwidth() - 1, pm->main_y - pm->keyboard_margin);
/* write out the text */ /* write out the text */
sc->setfont(pm->curfont); sc->setfont(pm->curfont);
@ -691,13 +692,14 @@ int kbd_input(char* text, int buflen)
/* Draw nicer bitmap arrow if room, else settle for ">". */ /* Draw nicer bitmap arrow if room, else settle for ">". */
if (text_w >= 6 && pm->font_h >= 8) if (text_w >= 6 && pm->font_h >= 8)
{ {
screen_put_iconxy(sc, sc->width - text_w + (text_w - 6) / 2, screen_put_iconxy(sc, sc->getwidth() - text_w +
(text_w - 6) / 2,
pm->main_y + (pm->font_h - 8) / 2, pm->main_y + (pm->font_h - 8) / 2,
Icon_Cursor); Icon_Cursor);
} }
else else
{ {
sc->putsxy(sc->width - text_w, pm->main_y, ">"); sc->putsxy(sc->getwidth() - text_w, pm->main_y, ">");
} }
} }
@ -729,7 +731,7 @@ int kbd_input(char* text, int buflen)
#ifdef KBD_MODES #ifdef KBD_MODES
if (pm->line_edit) if (pm->line_edit)
sc->fillrect(0, pm->main_y - pm->keyboard_margin + 2, sc->fillrect(0, pm->main_y - pm->keyboard_margin + 2,
sc->width, pm->font_h + 2); sc->getwidth(), pm->font_h + 2);
else /* highlight the key that has focus */ else /* highlight the key that has focus */
#endif #endif
sc->fillrect(pm->font_w*pm->x, sc->fillrect(pm->font_w*pm->x,
@ -801,7 +803,7 @@ int kbd_input(char* text, int buflen)
if (morse_mode) if (morse_mode)
{ {
pm->old_main_y = pm->main_y; pm->old_main_y = pm->main_y;
pm->main_y = sc->height - pm->font_h; pm->main_y = sc->getheight() - pm->font_h;
} }
else else
{ {

View file

@ -1064,8 +1064,9 @@ bool recording_screen(bool no_source)
screen_update = 1; screen_update = 1;
screens[1].clear_display(); screens[1].clear_display();
snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON)); snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON));
screens[1].puts((screens[1].width/w - strlen(buf))/2 + 1, screens[1].puts((screens[1].getwidth()/w - strlen(buf))/2 +
screens[1].height/(h*2) + 1, buf); 1,
screens[1].getheight()/(h*2) + 1, buf);
screens[1].update(); screens[1].update();
gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF)); gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF));
} }
@ -1880,10 +1881,12 @@ bool recording_screen(bool no_source)
/* draw the trigger status */ /* draw the trigger status */
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
{ {
/* NOTE: UGLY width setting based on height! To be fixed! */
trig_width[i] = ((vp[i].height < 64) || trig_width[i] = ((vp[i].height < 64) ||
((vp[i].height < 72) && (PM_HEIGHT > 1))) ? ((vp[i].height < 72) && (PM_HEIGHT > 1))) ?
screens[i].width - 14 * w : screens[i].width; screens[i].getwidth() - 14 * w :
trig_xpos[i] = screens[i].width - trig_width[i]; screens[i].getwidth();
trig_xpos[i] = screens[i].getwidth() - trig_width[i];
trig_ypos[i] = ((vp[i].height < 72) && (PM_HEIGHT > 1)) ? trig_ypos[i] = ((vp[i].height < 72) && (PM_HEIGHT > 1)) ?
h*2 : h*2 :
h*(1 + filename_offset[i] + PM_HEIGHT + h*(1 + filename_offset[i] + PM_HEIGHT +

View file

@ -36,8 +36,8 @@ struct screen screens[NB_SCREENS] =
{ {
{ {
.screen_type=SCREEN_MAIN, .screen_type=SCREEN_MAIN,
.width=LCD_WIDTH, .lcdwidth=LCD_WIDTH,
.height=LCD_HEIGHT, .lcdheight=LCD_HEIGHT,
.depth=LCD_DEPTH, .depth=LCD_DEPTH,
#if defined(HAVE_LCD_COLOR) #if defined(HAVE_LCD_COLOR)
.is_color=true, .is_color=true,
@ -134,8 +134,8 @@ struct screen screens[NB_SCREENS] =
#if NB_SCREENS == 2 #if NB_SCREENS == 2
{ {
.screen_type=SCREEN_REMOTE, .screen_type=SCREEN_REMOTE,
.width=LCD_REMOTE_WIDTH, .lcdwidth=LCD_REMOTE_WIDTH,
.height=LCD_REMOTE_HEIGHT, .lcdheight=LCD_REMOTE_HEIGHT,
.depth=LCD_REMOTE_DEPTH, .depth=LCD_REMOTE_DEPTH,
.is_color=false,/* No color remotes yet */ .is_color=false,/* No color remotes yet */
.pixel_format=LCD_REMOTE_PIXELFORMAT, .pixel_format=LCD_REMOTE_PIXELFORMAT,
@ -230,8 +230,8 @@ void screen_access_init(void)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
((struct screen*)&screens[i])->setfont(FONT_UI); ((struct screen*)&screens[i])->setfont(FONT_UI);
#endif #endif
int height=display->height; int height=display->lcdheight;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if(global_settings.statusbar) if(global_settings.statusbar)
height -= STATUSBAR_HEIGHT; height -= STATUSBAR_HEIGHT;

View file

@ -58,7 +58,7 @@ typedef void screen_bitmap_func(const void *src, int x, int y, int width,
struct screen struct screen
{ {
enum screen_type screen_type; enum screen_type screen_type;
int width, height; int lcdwidth, lcdheight;
int depth; int depth;
int nb_lines; int nb_lines;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP