Exemplo n.º 1
0
static SsdWidget ssd_progress_msg_dialog_new( void )
{
	SsdWidget dialog, group, text, spacer, button;

	int rtl_flag = 0x0;
	int         text_width;
	int         text_ascent;
	int         text_descent;
	int         text_height;

    dialog = ssd_dialog_new( SSD_PROGRESS_MSG_DLG_NAME, "", NULL, SSD_CONTAINER_BORDER|SSD_PERSISTENT|
								SSD_CONTAINER_TITLE|SSD_DIALOG_FLOAT|SSD_ALIGN_CENTER|
								SSD_ALIGN_VCENTER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_BLACK);

    if ( !dialog )
    {
        roadmap_log( ROADMAP_ERROR, "Error creating progress message dialog" );
        return NULL;
    }
    rtl_flag = ssd_widget_rtl( NULL );
    group = ssd_container_new( "Text Container", NULL,
                SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_END_ROW|rtl_flag );
    ssd_widget_set_color ( group, NULL, NULL );


    roadmap_canvas_get_text_extents( "aAbB19Xx", SSD_PROGRESS_MSG_FONT_SIZE, &text_width, &text_ascent, &text_descent, NULL);
    text_height =  (text_ascent + text_descent);
    // Space right
    spacer = ssd_container_new ( "spacer_right", NULL, 10, 1, SSD_END_ROW);
    ssd_widget_set_color ( spacer, NULL, NULL);
    ssd_widget_add ( group, spacer );

    text = ssd_text_new( SSD_PROGRESS_MSG_TEXT_FLD, "", SSD_PROGRESS_MSG_FONT_SIZE, SSD_ALIGN_VCENTER|SSD_END_ROW );
    ssd_widget_set_color(text, "#ffffff","#ffffff");
    ssd_widget_add( group, text );

    ssd_widget_add ( dialog, group );

    // Space below
    spacer = ssd_container_new( "spacer", NULL, SSD_MAX_SIZE, 10,
          SSD_WIDGET_SPACE|SSD_END_ROW );
    ssd_widget_set_color(spacer, NULL, NULL);
    ssd_widget_add( dialog, spacer );

#ifdef TOUCH_SCREEN
    button = ssd_button_label("Hide Button", roadmap_lang_get("Hide"), SSD_ALIGN_CENTER, on_button_hide);
    ssd_widget_add(dialog, button);
#endif

    return dialog;
}
Exemplo n.º 2
0
static void roadmap_lang_new_item (const char *name, const char *value) {

   int hash = roadmap_hash_string (name);

   if (RoadMapLangCount == RoadMapLangSize) {
      roadmap_lang_allocate ();
   }

   RoadMapLangItems[RoadMapLangCount].name  = name;
   RoadMapLangItems[RoadMapLangCount].value = value;

   roadmap_hash_add (RoadMapLangHash, hash, RoadMapLangCount);

   RoadMapLangCount++;

#ifndef _WIN32
   {
      //cache characters
      int width, ascent, descent, can_tilt=1;
      roadmap_canvas_get_text_extents(value, -1, &width, &ascent, &descent, &can_tilt);
   }
#endif //OPENGL
}
Exemplo n.º 3
0
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

}
Exemplo n.º 4
0
void roadmap_canvas_draw_formated_string_size (RoadMapGuiPoint *position,
                                                int corner,
                                                int size,
                                                int font_type,
                                                const char *text) {
   int x;
   int y;
   int text_width;
   int text_ascent;
   int text_descent;
   int text_height;
   roadmap_canvas_get_text_extents
         (text, size, &text_width, &text_ascent, &text_descent, NULL);

   text_height = text_ascent + text_descent;

   switch (corner) {

   case ROADMAP_CANVAS_TOPLEFT:
      y = position->y;
      x = position->x;
      break;

   case ROADMAP_CANVAS_TOPRIGHT:
      y = position->y;
      x = position->x - text_width;
      break;

   case ROADMAP_CANVAS_BOTTOMRIGHT:
      y = position->y - text_height;
      x = position->x - text_width;
      break;

   case ROADMAP_CANVAS_BOTTOMLEFT:
      y = position->y - text_height;
      x = position->x;
      break;

   case ROADMAP_CANVAS_BOTTOMMIDDLE:
      y = position->y - text_height;
      x = position->x - (text_width / 2);
      break;

   case ROADMAP_CANVAS_CENTERMIDDLE:
      y = position->y - (text_ascent / 2) - text_descent;
      x = position->x - (text_width / 2);
      break;

   case ROADMAP_CANVAS_CENTERRIGHT:
      y = position->y - (text_ascent / 2 ) - text_descent;
      x = position->x - text_width;
      break;

   case ROADMAP_CANVAS_CENTERLEFT:
      y = position->y - (text_ascent / 2) - text_descent;
      x = position->x;
      break;

   default:
      return;
   }

   RoadMapGuiPoint start = {x, y+text_height};
   roadmap_canvas_draw_formated_string_angle (&start, position, 0, size, font_type, text);
}
Exemplo n.º 5
0
void roadmap_display_sign_pop_up(RoadMapSign *sign) {

	RoadMapGuiPoint text_position;
	RoadMapGuiPoint top, bottom;
	int text_height = 0;
	RoadMapGuiPoint icon_screen_point;
    int width, ascent, descent;
	int lines = 1;
	int screen_width;
	int sign_width;
	int i;
	int allign = ROADMAP_CANVAS_TOPLEFT;

	if (ssd_widget_rtl (NULL))
		allign = ROADMAP_CANVAS_TOPRIGHT;


	roadmap_canvas_get_text_extents
        (sign->content, -1, &width, &ascent, &descent, NULL);

    text_height = ascent + descent + 5;

	screen_width = roadmap_canvas_width();


	for (i = 0; sign->content[i] != '\0'; i++)
		if (sign->content[i]=='\n')
			lines++;

	if (lines < 2)
		lines = 2;

	sign->deadline = -1;

	top.x = 1;
	top.y = roadmap_bar_top_height()+1;

	bottom.x = screen_width;


#ifdef TOUCH_SCREEN
	bottom.y = (lines) * 21 + top.y + 8;
	sign_width = roadmap_display_border(sign->style, sign->header_type, sign->pointer_type, &bottom, &top, "#d2dfef", &sign->position,0);
#else
	bottom.y = (lines) * 21 + top.y;
	sign_width = roadmap_display_border(sign->style, sign->header_type, sign->pointer_type, &bottom, &top, "#e4f1f9", &sign->position,0);
#endif
    if (sign->image != NULL){
    		RoadMapImage close;
    		RoadMapImage image =  (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, sign->image);
    		if (image){

    			if (ssd_widget_rtl (NULL))
    				icon_screen_point.x =  top.x + 12;
    			else
    				icon_screen_point.x =  top.x + sign_width - 12 - roadmap_canvas_image_width(image);
            	icon_screen_point.y = 	 bottom.y - roadmap_canvas_image_height(image) -12;
            	roadmap_canvas_draw_image (image, &icon_screen_point,
            					                                  0, IMAGE_NORMAL);
    		}

    		close =  (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, "rm_quit");
    		if (close){
    			icon_screen_point.y = top.y + 4;
    			if (ssd_widget_rtl (NULL))
    				icon_screen_point.x =  top.x + 2;
    			else
    				icon_screen_point.x =  top.x + sign_width - 12 - roadmap_canvas_image_width(close);
            	roadmap_canvas_draw_image (close, &icon_screen_point,
            					                                  0, IMAGE_NORMAL);
    		}

    }

	roadmap_canvas_select_pen (sign->foreground);
	if (ssd_widget_rtl (NULL))
		text_position.x = sign_width  - 10 ;
	else
		text_position.x = 10;

#ifdef TOUCH_SCREEN
	text_position.y =  roadmap_bar_top_height() + 5 ;
#else
	text_position.y =  roadmap_bar_top_height() + 9 ;
#endif

    roadmap_display_string
       (sign->content, lines, text_height, &text_position, allign);

}
Exemplo n.º 6
0
static void roadmap_display_sign (RoadMapSign *sign) {
    RoadMapGuiPoint points[7];
    RoadMapGuiPoint text_position;
    int width, height, ascent, descent;
    int screen_width;
    int sign_width, sign_height, text_height;
    int count;
    int i;
    int lines;
    RoadMapGuiPoint icon_screen_point;
	RoadMapImage image;

    roadmap_log_push ("roadmap_display_sign");

    roadmap_canvas_get_text_extents
        (sign->content, 12, &width, &ascent, &descent, NULL);


    width += 8; /* Keep some room around the text. */

    height = roadmap_canvas_height();

    screen_width = roadmap_canvas_width();

    /* Check if the text fits into one line, or if we need to use
     * more than one.
     */
    if (width + 10 < screen_width) {
        sign_width = width;
        lines = 1;
    } else {
        sign_width = screen_width - 10;
        lines = 1 + ((width + 10) / screen_width);
    }

	for (i = 0; sign->content[i] != '\0'; i++)
		if (sign->content[i]=='\n')
			lines++;

    text_height = ascent + descent + 4;
    sign_height = lines * text_height ;

   // screen_width = roadmap_canvas_width();

    if (sign->has_position) {

        int visible = roadmap_math_point_is_visible (&sign->position);

        if (sign->was_visible && (! visible)) {
            sign->deadline = 0;
            roadmap_log_pop ();
            return;
        }
        sign->was_visible = visible;

        roadmap_math_coordinate (&sign->position, points);
        roadmap_math_rotate_project_coordinate ( points );

        if (sign->where == SIGN_TOP) {

            points[1].x = 5 + (screen_width - sign_width) / 2;
            points[2].x = points[1].x - 5;
            points[4].x = (screen_width + sign_width) / 2;
            points[6].x = points[1].x + 10;

            text_position.x = points[2].x + 4;

        } else if (points[0].x < screen_width / 2) {

            points[1].x = 10;
            points[2].x = 5;
            points[4].x = sign_width + 5;
            points[6].x = 20;

            text_position.x = 9;

        } else {

            points[1].x = screen_width - 10;
            points[2].x = screen_width - 5;
            points[4].x = screen_width - sign_width - 5;
            points[6].x = screen_width - 20;

            text_position.x = points[4].x + 4;
        }
        points[3].x = points[2].x;
        points[5].x = points[4].x;


       if (sign->where == SIGN_TOP || (points[0].y > height / 2)) {
            points[1].y = sign_height + roadmap_bar_top_height() +roadmap_ticker_height()+roadmap_message_ticker_height()+5;
            if (points[0].y < points[1].y){
				points[0].x = points[1].x;
				points[0].y = points[1].y;
            }
            points[3].y = roadmap_bar_top_height() +roadmap_ticker_height()+roadmap_message_ticker_height()+5;

            text_position.y = roadmap_bar_top_height() + roadmap_ticker_height()+roadmap_message_ticker_height()+8;
        }
        else {

            points[1].y = height - sign_height - roadmap_bar_bottom_height() - 5;
            points[3].y = height - roadmap_bar_bottom_height() - 5;

            text_position.y = points[1].y + 3;
        }
        points[2].y = points[1].y;
        points[4].y = points[3].y;
        points[5].y = points[1].y;
        points[6].y = points[1].y;

        count = 7;

        roadmap_display_highlight (&sign->endpoint[0]);
        roadmap_display_highlight (&sign->endpoint[1]);

    } else {

        points[0].x = (screen_width - sign_width) / 2;
        points[1].x = (screen_width + sign_width) / 2;
        points[0].x = 2;
        points[1].x = 2+sign_width;
        points[2].x = points[1].x;
        points[3].x = points[0].x;

        switch (sign->where)
        {
           case SIGN_BOTTOM:

              points[0].y = height - sign_height - roadmap_bar_bottom_height();
              break;

           case SIGN_TOP:
              points[0].y = roadmap_bar_top_height() +roadmap_ticker_height()+roadmap_message_ticker_height()+3;
              break;

           case SIGN_RIGHT:
              points[0].y = roadmap_bar_top_height() +roadmap_ticker_height()+roadmap_message_ticker_height()+3;
              points[0].x = 2;
              points[1].x = 2+sign_width;
              points[2].x = points[1].x;
              points[3].x = points[0].x;
              break;

           case SIGN_CENTER:

              points[0].y = (height - sign_height) / 2;
              break;
        }
        points[1].y = points[0].y;
        points[2].y = points[0].y + sign_height;
        points[3].y = points[2].y;

        text_position.x = points[0].x + 4;
        text_position.y = points[0].y + 1;

        count = 4;
    }


    roadmap_canvas_select_pen (sign->background);
    roadmap_canvas_set_opacity(181);
    roadmap_canvas_draw_multiple_polygons (1, &count, points, 1, 0);


    roadmap_canvas_select_pen (RoadMapMessageContour);
    roadmap_canvas_draw_multiple_polygons (1, &count, points, 0, 0);

    if (sign->image != NULL){
    		image =  (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, sign->image);
    		icon_screen_point.x =  points[3].x + 2;
            icon_screen_point.y = 	 points[3].y+sign_height/2 - roadmap_canvas_image_width(image)/2;
            roadmap_canvas_draw_image (image, &icon_screen_point,
            				                                  0, IMAGE_NORMAL);
    }

    roadmap_canvas_select_pen (sign->foreground);
    roadmap_display_string
        (sign->content, lines, text_height, &text_position, ROADMAP_CANVAS_TOPLEFT);

    roadmap_log_pop ();
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
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);
}
Exemplo n.º 9
0
RoadMapPen roadmap_canvas_select_pen(RoadMapPen pen) {
void roadmap_canvas_get_formated_text_extents
        (const char *text, int size, int *width,
            int *ascent, int *descent, int *can_tilt, int font_type){
	roadmap_canvas_get_text_extents(text,size,width,ascent,descent,can_tilt);
}
Exemplo n.º 10
0
void roadmap_canvas_get_formated_text_extents(const char *text, int size,
		int *width, int *ascent, int *descent, int *can_tilt, int font_type) {
	roadmap_canvas_get_text_extents(text, size, width, ascent, descent,
			can_tilt); // no formatting for now.
}