␉return 0;␊ |
}␊ |
␊ |
int freeWindowBuffer( window_t *window )␊ |
{␊ |
␉if (window->pixmap && window->pixmap->pixels)␊ |
{␊ |
␉␉free(window->pixmap->pixels);␊ |
␉␉free(window->pixmap);␊ |
␉␉return 0;␊ |
␉}␊ |
␉␉␊ |
␉return 1;␊ |
}␊ |
␊ |
void fillPixmapWithColor(pixmap_t *pm, uint32_t color)␊ |
{␊ |
␉int x,y;␊ |
|
␉blend( images[iBackground].image, gui.screen.pixmap, gui.background.pos );␊ |
␉␊ |
␉// draw logo.png into background buffer␊ |
␉blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos);␊ |
␉if (gui.logo.draw)␊ |
␉{␊ |
␉blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos);␊ |
␉}␊ |
␉␊ |
␉memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );␊ |
}␊ |
␊ |
void loadThemeValues(config_file_t *theme, bool overide)␊ |
void setupDeviceList(config_file_t *theme)␊ |
{␊ |
␉unsigned int screen_width = gui.screen.width;␊ |
␉unsigned int screen_height = gui.screen.height;␊ |
␉unsigned int pixel;␊ |
␉int␉alpha;␉␉␉␉// transparency level 0 (obligue) - 255 (transparent)␊ |
␉uint32_t color;␉␉␉// color value formatted RRGGBB␊ |
␉int val, len;␊ |
␉const char *string;␉␊ |
␊ |
␉if(getIntForKey("devices_max_visible", &val, theme ))␊ |
␉␉gui.maxdevices = MIN( val, gDeviceCount );␊ |
␊ |
␉if(getIntForKey("devices_iconspacing", &val, theme ))␊ |
␉␉gui.devicelist.iconspacing = val;␊ |
␊ |
␉// check layout for horizontal or vertical␊ |
␉gui.layout = HorizontalLayout;␊ |
␉if(getValueForKey( "devices_layout", &string, &len, theme)) {␊ |
␉␉if (!strcmp (string, "vertical")) {␊ |
␉␉␉gui.layout = VerticalLayout;␊ |
␉␉}␊ |
␉}␊ |
␊ |
␉switch (gui.layout) {␊ |
␉case VerticalLayout:␊ |
␉␉gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);␊ |
␉␉gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);␊ |
␊ |
␉␉if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )␊ |
␉␉␉gui.devicelist.pos.x = pixel;␊ |
␊ |
␉␉if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )␊ |
␉␉␉gui.devicelist.pos.y = pixel;␊ |
␉␉break;␊ |
␉␉␊ |
␉case HorizontalLayout:␊ |
␉default:␊ |
␉␉gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);␊ |
␉␉gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);␊ |
␊ |
␉␉if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )␊ |
␉␉␉gui.devicelist.pos.x = pixel;␊ |
␉␉else␊ |
␉␉␉gui.devicelist.pos.x = ( gui.screen.width - gui.devicelist.width ) / 2;␊ |
␉␉␊ |
␉␉if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , images[iSelection].image->height ) )␊ |
␉␉␉gui.devicelist.pos.y = pixel;␊ |
␉␉else␊ |
␉␉␉gui.devicelist.pos.y = ( gui.screen.height - gui.devicelist.height ) / 2;␊ |
␉␉break;␊ |
␉}␊ |
␊ |
␉if(getColorForKey("devices_bgcolor", &color, theme))␊ |
␉␉gui.devicelist.bgcolor = (color & 0x00FFFFFF);␊ |
␊ |
␉if(getIntForKey("devices_transparency", &alpha, theme))␊ |
␉␉gui.devicelist.bgcolor = gui.devicelist.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24);␊ |
␊ |
␉if (gui.devicelist.pixmap)␊ |
␉{␊ |
␉ freeWindowBuffer(&gui.devicelist);␊ |
createWindowBuffer(&gui.devicelist);␊ |
}␊ |
}␊ |
␊ |
void loadThemeValues(config_file_t *theme)␊ |
{␊ |
␉unsigned int screen_width = gui.screen.width;␊ |
␉unsigned int screen_height = gui.screen.height;␊ |
␉unsigned int pixel;␊ |
␉int␉alpha;␉␉␉␉// transparency level 0 (obligue) - 255 (transparent)␊ |
␉uint32_t color;␉␉␉// color value formatted RRGGBB␊ |
␉int val;␊ |
␊ |
␉/*␊ |
␉ * Parse screen parameters␊ |
␉ */␊ |
|
␉if(getDimensionForKey("countdown_pos_y", &pixel, theme, screen_height , 0 ) )␊ |
␉␉gui.countdown.pos.y = pixel;␊ |
␊ |
␉/*␊ |
/*␊ |
␉ * Parse devicelist parameters␊ |
␉ */␊ |
␉if(getIntForKey("devices_max_visible", &val, theme ))␊ |
␉␉gui.maxdevices = MIN( val, gDeviceCount );␊ |
␉setupDeviceList(theme);␊ |
␊ |
␉if(getIntForKey("devices_iconspacing", &val, theme ))␊ |
␉␉gui.devicelist.iconspacing = val;␊ |
␊ |
␉// check layout for horizontal or vertical␊ |
␉gui.layout = HorizontalLayout;␊ |
␉if(getValueForKey( "devices_layout", &string, &len, theme)) {␊ |
␉␉if (!strcmp (string, "vertical")) {␊ |
␉␉␉gui.layout = VerticalLayout;␊ |
␉␉}␊ |
␉}␊ |
␊ |
␉switch (gui.layout) {␊ |
␉case VerticalLayout:␊ |
␉␉gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);␊ |
␉␉gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);␊ |
␊ |
␉␉if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )␊ |
␉␉␉gui.devicelist.pos.x = pixel;␊ |
␊ |
␉␉if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )␊ |
␉␉␉gui.devicelist.pos.y = pixel;␊ |
␉␉break;␊ |
␉␉␊ |
␉case HorizontalLayout:␊ |
␉default:␊ |
␉␉gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);␊ |
␉␉gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);␊ |
␊ |
␉␉if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )␊ |
␉␉␉gui.devicelist.pos.x = pixel;␊ |
␉␉else␊ |
␉␉␉gui.devicelist.pos.x = ( gui.screen.width - gui.devicelist.width ) / 2;␊ |
␉␉␊ |
␉␉if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , images[iSelection].image->height ) )␊ |
␉␉␉gui.devicelist.pos.y = pixel;␊ |
␉␉else␊ |
␉␉␉gui.devicelist.pos.y = ( gui.screen.height - gui.devicelist.height ) / 2;␊ |
␉␉break;␊ |
␉}␊ |
␊ |
␉if(getColorForKey("devices_bgcolor", &color, theme))␊ |
␉␉gui.devicelist.bgcolor = (color & 0x00FFFFFF);␊ |
␊ |
␉if(getIntForKey("devices_transparency", &alpha, theme))␊ |
␉␉gui.devicelist.bgcolor = gui.devicelist.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24);␊ |
␊ |
␉/*␊ |
␉ * Parse infobox parameters␊ |
␉ */␊ |
|
␊ |
␉// load graphics otherwise fail and return␊ |
␉if (loadGraphics() == 0) {␊ |
␉␉loadThemeValues(&bootInfo->themeConfig, true);␊ |
␉␉loadThemeValues(&bootInfo->themeConfig);␊ |
␉␉colorFont(&font_small, gui.screen.font_small_color);␊ |
␉␉colorFont(&font_console, gui.screen.font_console_color);␊ |
␊ |
|
␉␉␉␉if (createWindowBuffer(&gui.devicelist) == 0) {␊ |
␉␉␉␉␉if (createWindowBuffer(&gui.bootprompt) == 0) {␊ |
␉␉␉␉␉␉if (createWindowBuffer(&gui.infobox) == 0) {␊ |
␉␉␉␉␉␉␉if (createWindowBuffer(&gui.menu) == 0) {␉␉␉␉␉␉␉␊ |
␉␉␉␉␉␉␉if (createWindowBuffer(&gui.menu) == 0) {␊ |
␉␉␉␉␉␉␉ gui.logo.draw = true;␊ |
␉␉␉␉␉␉␉␉␊ |
#ifdef AUTORES_DEBUG␊ |
␉␉␉␉␉␉␉␉printf("Press Any Key...\n");␊ |