static void roadmap_speedometer_after_refresh (void){ RoadMapGuiPoint image_position; RoadMapGuiPoint text_position; RoadMapGuiPoint units_position; RoadMapGpsPosition pos; RoadMapPen speedometer_pen; char str[30]; char unit_str[30]; int font_size = 20; int font_size_units = 10; int speed_offset = 6; int units_offset = 6; int speed; #ifdef IPHONE_NATIVE font_size = 18; font_size_units = 8; #else if ( roadmap_lang_rtl() ) font_size_units--; // Longer text for units #endif if (SpeedometerImage == NULL){ return; } if (gHideSpeedometer){ after_refresh_callback(); return; } if (!roadmap_map_settings_isShowSpeedometer()){ after_refresh_callback(); return; } if (roadmap_screen_is_hd_screen()){ speed_offset *= 1.5; units_offset *= 1.5; } roadmap_navigate_get_current (&pos, NULL, NULL); speed = pos.speed; if ((speed == -1) || !roadmap_gps_have_reception()){ after_refresh_callback(); return; } speedometer_pen = roadmap_canvas_create_pen ("speedometer_pen"); if (roadmap_skin_state() == 1) roadmap_canvas_set_foreground(SPEEDOMETER_SPEED_COLOR_NIGHT); else roadmap_canvas_set_foreground(SPEEDOMETER_SPEED_COLOR_DAY); image_position.x = roadmap_canvas_width() - roadmap_canvas_image_width(SpeedometerImage); image_position.y = roadmap_canvas_height() - roadmap_canvas_image_height(SpeedometerImage) - roadmap_bar_bottom_height() - gOffset; roadmap_canvas_draw_image (SpeedometerImage, &image_position, 0, IMAGE_NORMAL); text_position.y = image_position.y + roadmap_canvas_image_height(SpeedometerImage) *.8; units_position.y = image_position.y + roadmap_canvas_image_height(SpeedometerImage)*.8; if (speed != -1){ if (!roadmap_gps_is_show_raw()) { snprintf (str, sizeof(str), "%3d", roadmap_math_to_speed_unit(speed)); snprintf (unit_str, sizeof(unit_str), "%s", roadmap_lang_get(roadmap_math_speed_unit())); } else { snprintf (str, sizeof(str), "%3d", pos.accuracy); snprintf (unit_str, sizeof(unit_str), "%s", "ac"); } if (ssd_widget_rtl(NULL)){ text_position.x = roadmap_canvas_width() -speed_offset; roadmap_canvas_draw_string_size(&text_position, ROADMAP_CANVAS_BOTTOMRIGHT, font_size, str); units_position.x = image_position.x + units_offset; roadmap_canvas_draw_string_size(&units_position, ROADMAP_CANVAS_BOTTOMLEFT, font_size_units, unit_str); } else{ text_position.x = image_position.x + speed_offset; roadmap_canvas_draw_string_size(&text_position, ROADMAP_CANVAS_BOTTOMLEFT, font_size, str); units_position.x = roadmap_canvas_width() -units_offset; roadmap_canvas_draw_string_size(&units_position, ROADMAP_CANVAS_BOTTOMRIGHT, font_size_units, unit_str); } } after_refresh_callback(); }
static void draw_objects(BarObjectTable_s *table){ int font_size; int i; int state, condition; RoadMapGuiPoint TextLocation; RoadMapImage image; int text_flag = ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP ; for (i=0; i < table->count; i++) { RoadMapGuiPoint ObjectLocation; RoadMapGuiPoint BgFocusLocation; if (table->object[i] == NULL) continue; if (table->object[i]->condition_fn[0]){ int j; BOOL cond = TRUE; for (j=0; j< table->object[i]->num_conditions;j++){ condition = (*table->object[i]->condition_fn[j]) (); if (condition != table->object[i]->condition_value[j]) cond = FALSE; } if (!cond) continue; } roadmap_bar_pos(table->object[i], &ObjectLocation); if (table->object[i]->state_fn) { state = (*table->object[i]->state_fn) (); if ((state < 0) || (state >= MAX_STATES)){ } else{ if (table->object[i]->images[state] != NULL){ if (table->object[i]->image_state == IMAGE_STATE_SELECTED){ if (table->object[i]->image_selected[state] != NULL){ image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->image_selected[state] ); roadmap_canvas_draw_image ( image, &ObjectLocation, 0,IMAGE_NORMAL); } else{ #ifdef TOUCH_SCREEN if (TopBarSelectedBg){ image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[state] ); BgFocusLocation.x = ObjectLocation.x - (roadmap_canvas_image_width(TopBarSelectedBg) -roadmap_canvas_image_width( image ))/2; BgFocusLocation.y = ObjectLocation.y - (roadmap_canvas_image_height(TopBarSelectedBg) -roadmap_canvas_image_height( image ))/4*3; roadmap_canvas_draw_image ( TopBarSelectedBg, &BgFocusLocation, 0,IMAGE_NORMAL ); } #endif image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[state] ); roadmap_canvas_draw_image ( image, &ObjectLocation, 0,IMAGE_NORMAL); } } else{ image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[state] ); roadmap_canvas_draw_image ( image, &ObjectLocation, 0,IMAGE_NORMAL); } } } } else{ if (table->object[i]->image_state == IMAGE_STATE_SELECTED){ if (table->object[i]->image_selected[0] != NULL){ image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->image_selected[0] ); roadmap_canvas_draw_image ( image, &ObjectLocation, 0,IMAGE_NORMAL); } else{ #ifdef TOUCH_SCREEN if (TopBarSelectedBg){ image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[0] ); BgFocusLocation.x = ObjectLocation.x - (roadmap_canvas_image_width(TopBarSelectedBg) -roadmap_canvas_image_width( image ))/2; BgFocusLocation.y = ObjectLocation.y - (roadmap_canvas_image_height(TopBarSelectedBg) -roadmap_canvas_image_height( image ))/4*3; roadmap_canvas_draw_image ( TopBarSelectedBg, &BgFocusLocation, 0,IMAGE_NORMAL ); } #endif image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[0] ); roadmap_canvas_draw_image (image, &ObjectLocation, 0,IMAGE_NORMAL); } } else if (table->object[i]->images[0] ) { image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[0] ); roadmap_canvas_draw_image ( image , &ObjectLocation, 0,IMAGE_NORMAL); } } if (table->object[i]->bar_image_fn){ const char *image_name = NULL; image_name = table->object[i]->bar_image_fn->bar_text_fn(); if (image_name && *image_name){ image = roadmap_res_get (RES_BITMAP, RES_SKIN, image_name ); if (image){ roadmap_canvas_draw_image ( image , &ObjectLocation, 0,IMAGE_NORMAL); } } } if (table->object[i]->bar_text){ if (table->object[i]->font_size != 0) font_size = table->object[i]->font_size; else font_size = 10; if (table->object[i]->text_alling != -1){ text_flag = table->object[i]->text_alling; } else if (table->object[i]->pos_x < 0){ text_flag = ROADMAP_CANVAS_RIGHT|ROADMAP_CANVAS_TOP; } if (!table->object[i]->bar_text->pen) { table->object[i]->bar_text->pen = roadmap_canvas_create_pen (table->object[i]->bar_text->name, FALSE); if (table->object[i]->text_color){ roadmap_canvas_set_foreground (table->object[i]->text_color); } } else { roadmap_canvas_select_pen (table->object[i]->bar_text->pen); } if (!table->object[i]->text_color){ if (roadmap_skin_state()) roadmap_canvas_set_foreground ("#ffffff"); else roadmap_canvas_set_foreground (table->object[i]->bar_text->default_foreground); } if (table->object[i]->state_fn) { state = (*table->object[i]->state_fn) (); if (state >0){ if (table->object[i]->images[state]) { image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[state] ); TextLocation.x = ObjectLocation.x + roadmap_canvas_image_width( image )/2; TextLocation.y = ObjectLocation.y + roadmap_canvas_image_height( image )/2; } else roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,(*table->object[i]->bar_text->bar_text_fn)()); } } else{ if (table->object[i]->images[0]){ image = roadmap_bar_load_image( table->object[i]->name, table->object[i]->images[0] ); TextLocation.x = ObjectLocation.x + roadmap_canvas_image_width( image )/2; TextLocation.y = ObjectLocation.y + roadmap_canvas_image_height( image )/2 -2; } else roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,(*table->object[i]->bar_text->bar_text_fn)()); } } if (table->object[i]->fixed_text){ if (table->object[i]->font_size != 0) font_size = table->object[i]->font_size; else font_size = 10; if (table->object[i]->text_alling != -1){ text_flag = table->object[i]->text_alling; } else if (table->object[i]->pos_x < 0){ text_flag = ROADMAP_CANVAS_RIGHT|ROADMAP_CANVAS_TOP; } roadmap_canvas_create_pen (table->object[i]->name, FALSE); if (table->object[i]->text_color){ roadmap_canvas_set_foreground (table->object[i]->text_color); } else{ if (roadmap_skin_state()) roadmap_canvas_set_foreground ("#ffffff"); else roadmap_canvas_set_foreground ("#000000"); } if (table->object[i]->state_fn) { state = (*table->object[i]->state_fn) (); if (state >0){ roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,table->object[i]->fixed_text); } } else{ roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,table->object[i]->fixed_text); } } } }
void roadmap_ticker_display() { char text[256]; char points[20]; char rank[20]; int text_width, ascent, descent; RoadMapGuiPoint position; RoadMapGuiPoint text_position; RoadMapImage image; int start,end, start_x; int iMyTotalPoints; int iMyRanking; int allign; int width; int text_offset_y = 25; int point_start_x = 190; int rank_start_x = 270; int new_pnts_start_x = 50; RoadMapImage x_image = NULL; const char * point_text = NULL; if ( roadmap_screen_is_hd_screen() ) { text_offset_y = 22; point_start_x = 200; rank_start_x = 280; new_pnts_start_x = 65; } width = roadmap_canvas_width(); if (!gInitialized) return ; if (!ticker_cfg_on() && !gTickerSupressHide){ gTickerOn = FALSE; return; } if (gTickerHide ){ gTickerOn = FALSE; return; } if (!roadmap_message_format (text, sizeof(text), "%X|%*")) { if (gTickerSupressHide){ roadmap_message_set('*', "%d", 0); roadmap_message_format (text, sizeof(text), "%*"); } else{ show_close_icon(); gTickerOn = FALSE; return; } } gTickerOn = TRUE; roadmap_canvas_get_text_extents (text, 14, &text_width, &ascent, &descent, NULL); roadmap_canvas_select_pen (RoadMapTickerPen); end = roadmap_canvas_width(); start = 1; start_x = 1; image = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, TICKER_MIDDLE_IMAGE); if ( image ) { while (start < end){ position.x = start; position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset(); roadmap_canvas_draw_image ( image, &position, 0, IMAGE_NORMAL); start += roadmap_canvas_image_width( image ); } } position.x = 0; if (ssd_widget_rtl(NULL)){ allign = ROADMAP_CANVAS_RIGHT; text_position.x = roadmap_canvas_width() -4; } else{ allign = ROADMAP_CANVAS_LEFT; text_position.x = 4; } text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + 2; roadmap_canvas_draw_string_size (&text_position, allign |ROADMAP_CANVAS_TOP, 14,roadmap_lang_get("Your Points (updated daily)")); text_position.x = 4; text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + 2 +TICKER_TOP_BAR_TEXT_OFFSET; switch( gLastUpdateEvent ) { case default_event: point_text = roadmap_lang_get("New points"); break; case report_event: point_text = roadmap_lang_get("Road report"); break; case comment_event: point_text = roadmap_lang_get("Event comment"); break; case confirm_event: point_text= roadmap_lang_get("Prompt response"); break; case road_munching_event : point_text= roadmap_lang_get("Road munching"); break; case user_contribution_event : point_text= roadmap_lang_get("Traffic detection"); break; case bonus_points : point_text= roadmap_lang_get("Bonus points"); break; } roadmap_canvas_draw_string_size (&text_position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, 14,point_text); image = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, TICKER_DIVIDER); if ( image ) { position.y = roadmap_bar_top_height() + TICKER_TOP_BAR_DIVIDER_OFFSET; position.x = width /3 +4 + 30; roadmap_canvas_draw_image ( image, &position, 0, IMAGE_NORMAL); position.y = roadmap_bar_top_height() + TICKER_TOP_BAR_DIVIDER_OFFSET; position.x = 2*width/3+4 +15; roadmap_canvas_draw_image ( image, &position, 0, IMAGE_NORMAL); } text_position.x = (width/3) + (width/3)/4 + 30; text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + 2 + TICKER_TOP_BAR_TEXT_OFFSET; roadmap_canvas_draw_string_size (&text_position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, 14,roadmap_lang_get("Total")); text_position.x = (width/3) + (width/3)/4+ 30; text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + text_offset_y +TICKER_TOP_BAR_TEXT_OFFSET; iMyTotalPoints = editor_points_get_total_points(); if (iMyTotalPoints != -1){ if (iMyTotalPoints < 10000){ sprintf(points,"%d", iMyTotalPoints); } else{ sprintf(points,"%dK", (int)iMyTotalPoints/1000); } } else{ strcpy(points,""); } roadmap_canvas_draw_string_size (&text_position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, 14,points); text_position.x = width - (width/3) + (width/3)/4+ 15; text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + 2 +TICKER_TOP_BAR_TEXT_OFFSET; iMyRanking = RealTime_GetMyRanking(); if (iMyRanking == -1) strcpy(rank,""); else sprintf(rank, "%d", iMyRanking); roadmap_canvas_draw_string_size (&text_position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, 14,roadmap_lang_get("Rank")); text_position.x = width - (width/3) + (width/3)/4+ 12; text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + text_offset_y +TICKER_TOP_BAR_TEXT_OFFSET; roadmap_canvas_draw_string_size (&text_position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, 14,rank); if (strcmp(text,"0")){ text_position.x = new_pnts_start_x - start_x + 30; text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + text_offset_y +TICKER_TOP_BAR_TEXT_OFFSET; roadmap_canvas_draw_string_size (&text_position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, 14,"+"); text_position.x = new_pnts_start_x - start_x + 40; text_position.y = roadmap_bar_top_height() + roadmap_ticker_top_bar_offset() + text_offset_y +TICKER_TOP_BAR_TEXT_OFFSET; roadmap_canvas_draw_string_size (&text_position, ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP, 14,text); } #ifdef TOUCH_SCREEN x_image = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, "x_close"); if ( x_image ) { position.x = roadmap_canvas_width() - roadmap_canvas_image_width(x_image) - 5; position.y = roadmap_bar_top_height() + gMiddleImageSize.height -roadmap_canvas_image_height(x_image) -5; roadmap_canvas_draw_image ( x_image, &position, 0, IMAGE_NORMAL); } #endif }
void roadmap_canvas_draw_string (RoadMapGuiPoint *position, int corner, const char *text) { roadmap_canvas_draw_string_size(position, corner, -1, text); }
static void roadmap_display_string (char *text, int lines, int height, RoadMapGuiPoint *position, int corner) { char *text_line = &text[0]; char display_line[256]; int width, ascent, descent; unsigned int pos; int text_size = -1; int offset = 0; // if (strchr(text, '\n') != 0){ while (strchr(text_line, '\n')){ pos = strchr(text_line,'\n')-text_line; if (pos >= sizeof(display_line)) pos = sizeof(display_line) - 1; strncpy(display_line, text_line, pos); display_line[pos]=0; text_line = strchr(text_line, '\n') + 1; if (!strncmp("<h1>", display_line,strlen("<h1>"))){ text_size = 18; offset = strlen("<h1>"); roadmap_canvas_set_foreground("#ffffff"); } else if (!strncmp("<h2>", display_line,strlen("<h2>"))){ text_size = 16; offset = strlen("<h2>"); #ifdef TOUCH_SCREEN roadmap_canvas_set_foreground("#ffffff"); #else roadmap_canvas_set_foreground("#000000"); #endif } else if (!strncmp("<r1>", display_line,strlen("<b1>"))){ text_size = 18; offset = strlen("<r1>"); roadmap_canvas_set_foreground("#FF0000"); } else if (!strncmp("<b1>", display_line,strlen("<b1>"))){ text_size = 18; offset = strlen("<b1>"); roadmap_canvas_set_foreground("#ffffff"); } else if (!strncmp("<h3>", display_line,strlen("<h3>"))){ text_size = -1; offset = strlen("<h3>"); roadmap_canvas_set_foreground("#000000"); } else{ offset = 0; text_size = 12; roadmap_canvas_set_foreground("#000000"); } roadmap_canvas_draw_string_size (position,corner, text_size,display_line+offset); roadmap_canvas_get_text_extents (display_line, text_size, &width, &ascent, &descent, NULL); height = ascent + descent + 4; position->y += height; } if (!strncmp("<h1>", text_line,strlen("<h1>"))){ text_size = 18; offset = strlen("<h1>"); } else if (!strncmp("<h3>", text_line,strlen("<h3>"))){ text_size = 13; offset = strlen("<h3>"); } else{ offset = 0; text_size = 12; } roadmap_canvas_draw_string_size (position,corner, text_size,text_line+offset); return; } if (lines > 1) { /* There is more than one line of text to display: * find where to cut the text. We choose to cut at * a space, either before of after the string midpoint, * whichever end with the shortest chunks. */ char *text_end = text_line + strlen(text_line); char *p1 = text_line + (strlen(text_line) / 2); char *p2 = p1; while (p1 > text_line) { if (*p1 == ' ') { break; } p1 -= 1; } while (p2 < text_end) { if (*p2 == ' ') { break; } p2 += 1; } if (text_end - p1 > p2 - text_line) { p1 = p2; } if (p1 > text_line) { char saved = *p1; *p1 = 0; roadmap_canvas_draw_string (position, corner, text_line); *p1 = saved; text_line = p1 + 1; position->y += height; } } roadmap_canvas_draw_string_size (position,corner, 12,text_line); }
static void roadmap_display_console_box (int type, int corner, const char *format) { char text[256]; int count; int width, ascent, descent; int warning_font_size = 13; int offset = 62; #ifdef ANDROID warning_font_size = 15; #endif RoadMapGuiPoint frame[4]; #ifdef _WIN32 offset = 33; #endif count = 4; if (! roadmap_message_format (text, sizeof(text), format)) { return; } #ifdef QTMOBILITY { roadmap_display_set_message(text); return; } #endif if ( type == ROADMAP_CONSOLE_WARNING ){ roadmap_canvas_get_text_extents (text, warning_font_size, &width, &ascent, &descent, NULL); while (width > (roadmap_canvas_width()-10)){ warning_font_size--; roadmap_canvas_get_text_extents (text, warning_font_size, &width, &ascent, &descent, NULL); } } else if (type == ROADMAP_CONSOLE_ACTIVITY ){ roadmap_canvas_get_text_extents (text, 12, &width, &ascent, &descent, NULL); } else { roadmap_canvas_get_text_extents (text, 16, &width, &ascent, &descent, NULL); } if (roadmap_screen_is_hd_screen()) offset = 94; if (type == ROADMAP_CONSOLE_ACTIVITY) { #ifdef TOUCH_SCREEN if (roadmap_horizontal_screen_orientation()) frame[2].x = roadmap_canvas_width() - offset; else #endif frame[2].x = roadmap_canvas_width() ; frame[0].x = frame[2].x - width - 4; } else if (corner & ROADMAP_CANVAS_RIGHT) { #ifdef TOUCH_SCREEN if (roadmap_horizontal_screen_orientation()) frame[2].x = roadmap_canvas_width() - 5-offset; else #endif frame[2].x = roadmap_canvas_width() - 1 ; frame[0].x = frame[2].x - width - 6; } else { frame[0].x = 5; frame[2].x = frame[0].x + width + 6; } frame[1].x = frame[0].x; frame[3].x = frame[2].x; if (corner & ROADMAP_CANVAS_BOTTOM) { frame[0].y = roadmap_canvas_height () - ascent - descent - 11 - 22; frame[1].y = roadmap_canvas_height () - 6 - 22; } else { if ( type == ROADMAP_CONSOLE_ACTIVITY || type == ROADMAP_CONSOLE_WARNING ) { frame[0].y = roadmap_bar_top_height() + roadmap_ticker_height()+ roadmap_message_ticker_height()+1; } else { frame[0].y = 40; } frame[1].y = ascent + descent + frame[0].y + 6; } frame[2].y = frame[1].y; frame[3].y = frame[0].y; count = 4; if (type == ROADMAP_CONSOLE_WARNING ) { roadmap_canvas_select_pen (RoadMapWarningBackground); roadmap_canvas_set_opacity(181); } else if (type == ROADMAP_CONSOLE_ACTIVITY) { roadmap_canvas_select_pen (RoadMapActivityBackground); } else { roadmap_canvas_select_pen (RoadMapConsoleBackground); } roadmap_canvas_draw_multiple_polygons (1, &count, frame, 1, 0); if (type == ROADMAP_CONSOLE_WARNING) { roadmap_canvas_select_pen (RoadMapWarningForeground); } else if (type == ROADMAP_CONSOLE_ACTIVITY) { roadmap_canvas_select_pen (RoadMapActivityForeground); } else { roadmap_canvas_select_pen (RoadMapConsoleForeground); } if (type != ROADMAP_CONSOLE_WARNING ) roadmap_canvas_draw_multiple_polygons (1, &count, frame, 0, 0); frame[0].x = frame[3].x - 3; frame[0].y = frame[3].y + 1; if (type == ROADMAP_CONSOLE_WARNING ) { roadmap_canvas_draw_string_size (frame, ROADMAP_CANVAS_RIGHT|ROADMAP_CANVAS_TOP, warning_font_size,text); } else if (type == ROADMAP_CONSOLE_ACTIVITY) roadmap_canvas_draw_string_size (frame, ROADMAP_CANVAS_RIGHT|ROADMAP_CANVAS_TOP, 12,text); else roadmap_canvas_draw_string (frame, ROADMAP_CANVAS_RIGHT|ROADMAP_CANVAS_TOP, text); }
void draw_objects(BarObjectTable_s *table){ int font_size; int i; int state, condition; RoadMapGuiPoint TextLocation; int text_flag = ROADMAP_CANVAS_LEFT|ROADMAP_CANVAS_TOP ; for (i=0; i < table->count; i++) { RoadMapGuiPoint ObjectLocation; if (table->object[i] == NULL) continue; if (table->object[i]->condition_fn[0]){ int j; BOOL cond = TRUE; for (j=0; j< table->object[i]->num_conditions;j++){ condition = (*table->object[i]->condition_fn[j]) (); if (condition != table->object[i]->condition_value[j]) cond = FALSE; } if (!cond) continue; } roadmap_bar_pos(table->object[i], &ObjectLocation); if (table->object[i]->state_fn) { state = (*table->object[i]->state_fn) (); if ((state < 0) || (state >= MAX_STATES)){ } else{ if (table->object[i]->images[state] != NULL){ if ((table->object[i]->image_state == IMAGE_STATE_SELECTED) && (table->object[i]->image_selected[state] != NULL)) roadmap_canvas_draw_image (table->object[i]->image_selected[state], &ObjectLocation, 0,IMAGE_NORMAL); else roadmap_canvas_draw_image (table->object[i]->images[state], &ObjectLocation, 0,IMAGE_NORMAL); } } } else{ if ((table->object[i]->image_state == IMAGE_STATE_SELECTED) && (table->object[i]->image_selected[0] != NULL)){ roadmap_canvas_draw_image (table->object[i]->image_selected[0], &ObjectLocation, 0,IMAGE_NORMAL); } else if (table->object[i]->images[0]) roadmap_canvas_draw_image (table->object[i]->images[0], &ObjectLocation, 0,IMAGE_NORMAL); } if (table->object[i]->bar_text){ if (table->object[i]->font_size != 0) font_size = table->object[i]->font_size; else font_size = 10; if (table->object[i]->text_alling != -1){ text_flag = table->object[i]->text_alling; } else if (table->object[i]->pos_x < 0){ text_flag = ROADMAP_CANVAS_RIGHT|ROADMAP_CANVAS_TOP; } roadmap_canvas_create_pen (table->object[i]->bar_text->name); if (table->object[i]->text_color){ roadmap_canvas_set_foreground (table->object[i]->text_color); } else{ roadmap_canvas_set_foreground (table->object[i]->bar_text->default_foreground); } if (table->object[i]->state_fn) { state = (*table->object[i]->state_fn) (); if (state >0){ if (table->object[i]->images[state]){ TextLocation.x = ObjectLocation.x + roadmap_canvas_image_width(table->object[i]->images[state])/2; TextLocation.y = ObjectLocation.y + roadmap_canvas_image_height(table->object[i]->images[state])/2; } else roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,(*table->object[i]->bar_text->bar_text_fn)()); } } else{ if (table->object[i]->images[0]){ TextLocation.x = ObjectLocation.x + roadmap_canvas_image_width(table->object[i]->images[0])/2; TextLocation.y = ObjectLocation.y + roadmap_canvas_image_height(table->object[i]->images[0])/2 -2; } else roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,(*table->object[i]->bar_text->bar_text_fn)()); } } if (table->object[i]->fixed_text){ if (table->object[i]->font_size != 0) font_size = table->object[i]->font_size; else font_size = 10; if (table->object[i]->text_alling != -1){ text_flag = table->object[i]->text_alling; } else if (table->object[i]->pos_x < 0){ text_flag = ROADMAP_CANVAS_RIGHT|ROADMAP_CANVAS_TOP; } roadmap_canvas_create_pen (table->object[i]->name); if (table->object[i]->text_color){ roadmap_canvas_set_foreground (table->object[i]->text_color); } else{ if (roadmap_skin_state()) roadmap_canvas_set_foreground ("#ffffff"); else roadmap_canvas_set_foreground ("#000000"); } if (table->object[i]->state_fn) { state = (*table->object[i]->state_fn) (); if (state >0){ roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,table->object[i]->fixed_text); } } else{ roadmap_bar_pos(table->object[i], &TextLocation); roadmap_canvas_draw_string_size (&TextLocation, text_flag, font_size,table->object[i]->fixed_text); } } } }