#include "vxBoot/gui.h" #include "vxBoot/loader.h" #include #include //--- // Private //--- //-- // Public //--- /* gui_main() : main loop for the GUI display */ void gui_main(void) { struct gui_meta disp; void (*display)(struct gui_meta*); int key; disp.list.anchor = 0; disp.list.select = 0; disp.list.count = loader_kernel_img_count(); #ifdef FX9860G disp.list.line = 5; disp.scroll.y = 10; disp.scroll.offset = 0; if (disp.list.count - 6 > 0) { disp.scroll.width = (6 * 48) / disp.list.count; disp.scroll.offset = (38 - disp.scroll.width); disp.scroll.offset /= (disp.list.count - 6); } display = &gui_fx9860g_display; #endif #ifdef FXCG50 disp.list.line = 11; disp.scroll.y = 21; disp.scroll.offset = 0; if (disp.list.count - 11 > 0) { disp.scroll.width = 167 / (disp.list.count - 11); disp.scroll.offset = (167 - disp.scroll.width); disp.scroll.offset /= (disp.list.count - 11); } display = &gui_fxcg50_display; #endif while (1) { dclear(C_BLACK); (*display)(&disp); dupdate(); key = getkey().key; if (key == KEY_F6) break; if (key == KEY_EXE || key == KEY_SHIFT) { loader( loader_kernel_img_get(disp.list.select)->inode, LOADER_DEFAULT ); } if (key == KEY_UP) { disp.list.select -= 1; if (disp.list.select < 0) disp.list.select = 0; if (disp.list.select < disp.list.anchor) disp.list.anchor -= 1; } if (key != KEY_DOWN) continue; disp.list.select += 1; if (disp.list.select >= disp.list.count) disp.list.select = disp.list.count - 1; if (disp.list.select - disp.list.anchor >= disp.list.line) disp.list.anchor += 1; } } #if 0 /* gui_main() : main loop for the GUI display */ void gui_main(void) { int select_height; int disp_start; int max_line; int offsetW; int offsetH; int selected; int lheight; int loffset; int lrest; int count; int key; int pos; int i; selected = 0; disp_start = 0; offsetW = (DWIDTH * 5) / 100; offsetH = (DHEIGHT * 5) / 100; select_height = DHEIGHT - (offsetH * 3) - 6; select_height = select_height - (offsetH * 2) - 6; max_line = (select_height / (FHEIGHT + 6)) + 1; count = loader_kernel_img_count(); lheight = (max_line * select_height) / count; lrest = select_height - lheight; while (1) { dclear(C_BLACK); dupdate(); key = getkey().key; if (key == KEY_F6) break; if (key == KEY_EXE || key == KEY_SHIFT) { loader( loader_kernel_img_get(selected)->inode, LOADER_DEFAULT ); } if (key == KEY_UP) { selected -= 1; if (selected < 0) selected = 0; if (selected < disp_start) disp_start -= 1; } if (key == KEY_DOWN) { selected += 1; if (selected >= count) selected = count - 1; if (selected - disp_start >= max_line) disp_start += 1; } } } #endif