Rockbox Ports are now being developed for various digital audio players!
FOR_NB_SCREENS(i) { if (i==0) screens[i].setfont(FONT_UI); else screens[i].setfont(FONT_SYSFIXED); screens[i].getstringsize("M", &w, &h); screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8); }
#define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
FOR_NB_SCREENS(i) { if (i==0) { screens[i].setfont(FONT_UI); screens[i].getstringsize("M", &w, &h); screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8); } else { screens[i].setfont(FONT_SYSFIXED); screens[i].getstringsize("M", &rc_w, &rc_h); screens[i].setmargins(global_settings.invert_cursor ? 0 : rc_w, 8); } }
(small) problem..I found the peakmeter is actually drawn twice, once in peakmeter.c and once again in recording.c.. In peakmeter.c the hight and position for the meter appear to be set in line 1190:int peak_meter_draw_get_btn(int x, int y, int height)Now as I see it is not possible to get the different positions/sizes for screens with different fonts using this as there is nothing to identify the screen.I have been browsing the source, but cannot find anything that would help me here, but I might miss something..any ideas..?
extern int peak_meter_draw_get_btn(int x, int y[], int height[]);
int peak_meter_draw_get_btn(int x, int y[], int height[]){ int button = BUTTON_NONE; long next_refresh = current_tick; long next_big_refresh = current_tick + HZ / 10; int i;#ifndef SIMULATOR bool highperf = !ata_disk_is_active();#else bool highperf = false;#endif bool dopeek = true; while (TIME_BEFORE(current_tick, next_big_refresh)) { button = button_get(false); if (button != BUTTON_NONE) { break; } if (dopeek) { /* Peek only once per refresh when disk is */ peak_meter_peek(); /* spinning, but as often as possible */ dopeek = highperf; /* otherwise. */ yield(); } else { sleep(0); /* Sleep until end of current tick. */ } if (TIME_AFTER(current_tick, next_refresh)) { FOR_NB_SCREENS(i) { peak_meter_screen(&screens[i], x, y[i], height[i]); screens[i].update_rect(x, y[i], screens[i].width, height[i]); } next_refresh += HZ / PEAK_METER_FPS; dopeek = true; } } return button;}
/* Wait for a button a while (HZ/10) drawing the peak meter */ button = peak_meter_draw_get_btn(0, pm_y, pm_h);
FOR_NB_SCREENS(i) { peak_meter_screen(&screens[i], 0, pm_y[i], pm_h[i]); screens[i].update(); }
int font[2]; int w[2], h[2]; int pm_y[2], pm_h[2];..... FOR_NB_SCREENS(i) { screens[i].setfont(FONT_UI); screens[i].getstringsize("M", &w[i], &h[i]); if (i == SCREEN_MAIN) { if (h[i] < ((LCD_HEIGHT - 40) / 8)) font[i] = FONT_UI; else font[i] = FONT_SYSFIXED; } else if (h[i] <= ((64 - 8) / 7)) font[i] = FONT_UI; else font[i] = FONT_SYSFIXED; screens[i].setfont(font[i]); screens[i].getstringsize("M", &w[i], &h[i]); screens[i].setmargins(global_settings.invert_cursor ? 0 : w[i], 8); if (h[i] > 8) { pm_y[i] = 9 + h[i] * 2; pm_h[i] = (h[i] - 1) * 2; } else { pm_y[i] = 8 + h[i] * 2; pm_h[i] = h[i] * 2; } }
Page created in 0.103 seconds with 14 queries.