static void preview(HWND hwndDlg) { POPUPDATAT popup = {}; // Pick a random contact HANDLE hContact = 0; int n_contacts = CallService(MS_DB_CONTACT_GETCOUNT,0,0); if(n_contacts != 0) { int contact = rand() % n_contacts; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); for(int i=0; i<contact; i++) hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); } // Pick a random quote int q = rand() % SIZEOF(quotes); _tcsncpy(popup.lptzContactName,quotes[q].name,MAX_CONTACTNAME); _tcsncpy(popup.lptzText, quotes[q].text,MAX_SECONDLINE); popup.lchContact = hContact; popup.iSeconds = get_timeout(hwndDlg); popup.colorText = get_text_color(hwndDlg,false); popup.colorBack = get_back_color(hwndDlg,false); CallService(MS_POPUP_ADDPOPUPT,reinterpret_cast<WPARAM>(&popup),0); }
void checkin_menu_draw_layer_bar(Layer *cell_layer, GContext *ctx) { graphics_context_set_fill_color(ctx, (GColor)get_primary_color()); graphics_fill_rect(ctx, GRect(0,0,SIDE_BAR_WIDTH,168), 8, GCornerNone); if(split_bar) { Layer *window_layer = window_get_root_layer(s_window); GRect bounds = layer_get_frame(window_layer); graphics_context_set_fill_color(ctx, (GColor)get_back_color()); graphics_fill_rect(ctx, GRect(0,bounds.size.h/2,SIDE_BAR_WIDTH,bounds.size.h/2), 8, GCornerNone); } graphics_context_set_fill_color(ctx, GColorBlack); #ifdef PBL_ROUND #else graphics_fill_circle(ctx, GPoint(7,10), 3); #endif }
static void menu_draw(struct Menu *menu) { int x, y, i, cur_page_start, total_page; int NEW_MAX_SCREEN_X = ((g_messages == g_messages_chs) || (g_messages == g_messages_cht)) ? (MAX_SCREEN_X+12) : (MAX_SCREEN_X);///+ int NEW_MAX_MENU_NUMBER_PER_PAGE = ((g_messages == g_messages_chs) || (g_messages == g_messages_cht)) ? (MAX_MENU_NUMBER_PER_PAGE-10) : (MAX_MENU_NUMBER_PER_PAGE);///+ x = 1, y = 1; set_screen_xy(x, y); write_string_with_color(g_messages[PRO_RECOVERY_MENU], 0xFF); x = 1, y = 2; set_screen_xy(x, y); write_string_with_color(g_messages[menu->banner_id], menu->banner_color); x = (cur_language == PSP_SYSTEMPARAM_LANGUAGE_FRENCH ? 0 : 3), y = 4; set_screen_xy(x, y); { char buf[10]; int color; if(menu->cur_sel == 0) { strcpy(buf, "> "); color = CUR_SEL_COLOR; } else { strcpy(buf, " "); color = 0; } strcat(buf, g_messages[BACK]); write_string_with_color(buf, color); } x = (cur_language == PSP_SYSTEMPARAM_LANGUAGE_FRENCH ? 0 : 3), y = 6; set_screen_xy(x, y); if(menu->cur_sel == 0) { cur_page_start = 0; } else { cur_page_start = (menu->cur_sel-1) / NEW_MAX_MENU_NUMBER_PER_PAGE * NEW_MAX_MENU_NUMBER_PER_PAGE;///|cur_page_start = (menu->cur_sel-1) / MAX_MENU_NUMBER_PER_PAGE * MAX_MENU_NUMBER_PER_PAGE; } for(i=cur_page_start; i<MIN(menu->submenu_size, cur_page_start+NEW_MAX_MENU_NUMBER_PER_PAGE); ++i) {///|for(i=cur_page_start; i<MIN(menu->submenu_size, cur_page_start+NEW_MAX_MENU_NUMBER_PER_PAGE); ++i) { char buf[256], *p; int color; struct MenuEntry* entry; entry = &menu->submenu[i]; if(menu->cur_sel == i+1) { set_line_backcolor(x, y, get_back_color(g_frame_count % (60 * 2 * MENU_BACK_COLOR_HALFTIME))); color = CUR_SEL_COLOR; strcpy(buf, "> "); } else { color = entry->color; strcpy(buf, " "); } p = buf + strlen(buf); if(entry->info_idx >= 0) { sprintf(p, "%s", g_messages[entry->info_idx]); } else { int (*display_callback)(struct MenuEntry* , char *, int); display_callback = (*entry->display_callback); if (display_callback != NULL) { (*display_callback)(entry, p, sizeof(buf) - (p - buf)); } else { strcpy(p, "FIXME"); } } if(entry->type == TYPE_SUBMENU) { strcat(p, " ->"); } write_string_with_color(buf, color); set_screen_xy(x, ++y); } total_page = (menu->submenu_size+NEW_MAX_MENU_NUMBER_PER_PAGE-1) / NEW_MAX_MENU_NUMBER_PER_PAGE;///|total_page = (menu->submenu_size+MAX_MENU_NUMBER_PER_PAGE-1) / MAX_MENU_NUMBER_PER_PAGE; if(total_page > 1) { char buf[20]; x = ((g_messages == g_messages_chs) || (g_messages == g_messages_cht)) ? (NEW_MAX_SCREEN_X - 20) : (NEW_MAX_SCREEN_X - 15);///|x = MAX_SCREEN_X - 15; y = 4; sprintf(buf, "%s %d/%d", g_messages[PAGE], (cur_page_start/NEW_MAX_MENU_NUMBER_PER_PAGE)+1, total_page);///|sprintf(buf, "%s %d/%d", g_messages[PAGE], (cur_page_start/MAX_MENU_NUMBER_PER_PAGE)+1, total_page); set_screen_xy(x, y); write_string_with_color(buf, 0); } write_bottom_info(); draw_bottom_line(); }