示例#1
0
static int ssd_widget_draw_grid_row (SsdWidget *w, int count,
                                     int width,
                                     int avg_width,
                                     int height,
                                     int x, int y) {
   int cur_x;
   int space;
   int i;
   int rtl = ssd_widget_rtl (w[0]->parent);

   if (w[0]->flags & SSD_ALIGN_LTR) rtl = 0;

   /* align center */
   space = (width - avg_width*count) / (count + 1);

   if (rtl) cur_x = x + width;
   else cur_x = x;

   for (i=0; i<count; i++) {

      if (rtl) {
         cur_x -= space;
         cur_x -= avg_width;
         cur_x -= w[i]->offset_x;
         ssd_widget_draw_one (w[i], cur_x, y + w[i]->offset_y, height);
      } else {
         cur_x += space;
         cur_x += w[i]->offset_x;
         ssd_widget_draw_one (w[i], cur_x, y + w[i]->offset_y, height);
         cur_x += avg_width;
      }
   }

   return height;
}
示例#2
0
static void _draw_alert(SsdWidget widget, RoadMapGuiRect *rect, int flags) {
	event_on_route_info *data = (event_on_route_info *) widget->data;
	RoadMapImage image;
	int width = widget->parent->cached_size.width - ADJ_SCALE(38);

	image = roadmap_res_get(RES_BITMAP, RES_SKIN, RTAlerts_Get_Map_Icon_By_Type(data->iType));
	if (!image)
		return;

	if (flags & SSD_GET_SIZE) {
		rect->maxx = rect->minx;
		rect->maxy = rect->miny + roadmap_canvas_image_height(image);
	}
	else {
		RoadMapGuiPoint position;
		if (ssd_widget_rtl(NULL))
			position.x = rect->minx - (width * data->iStart / 100) - roadmap_canvas_image_width(image)
					/ 2 ;
		else
			position.x = rect->minx + (width * data->iStart / 100) - roadmap_canvas_image_width(image)
					/ 2 + ADJ_SCALE(10);
		position.y = rect->miny - ADJ_SCALE(13);
		roadmap_canvas_draw_image(image, &position, 0, IMAGE_NORMAL);
	}

}
示例#3
0
static int on_options(SsdWidget widget, const char *new_value, void *context)
{
   int menu_x;

   if(g_context_menu_is_active)
   {
      ssd_dialog_hide_current(dec_ok);
      g_context_menu_is_active = FALSE;
   }

   if (ssd_widget_rtl (NULL))
   menu_x = SSD_X_SCREEN_RIGHT;
   else
   menu_x = SSD_X_SCREEN_LEFT;

   ssd_context_menu_show( menu_x, // X
            SSD_Y_SCREEN_BOTTOM, // Y
            &context_menu,
            on_option_selected,
            NULL,
            dir_default,
            0,
            TRUE);

   g_context_menu_is_active = TRUE;

   return 0;
}
int on_options(SsdWidget widget, const char *new_value, void *context)
{
   int menu_x;
   BOOL add_cancel = TRUE;
   BOOL b_report_wrong_address = ( get_selected_list_item()== COULDNT_FIND_INDEX ) ;
#ifdef TOUCH_SCREEN
   roadmap_screen_refresh();
#endif

   assert( !s_menu);

   if  (ssd_widget_rtl (NULL))
	   menu_x = SSD_X_SCREEN_RIGHT;
	else
		menu_x = SSD_X_SCREEN_LEFT;

   ssd_contextmenu_show_item( &context_menu,
                              cm_navigate,
                              !generic_search_dlg_is_1st(search_address)&&(!b_report_wrong_address),
                              FALSE);
   ssd_contextmenu_show_item( &context_menu,
                              cm_show,
                              !generic_search_dlg_is_1st(search_address)&&(!b_report_wrong_address),
                              FALSE);
   ssd_contextmenu_show_item( &context_menu,
                              cm_add_to_favorites,

                              !generic_search_dlg_is_1st(search_address)&&(!b_report_wrong_address),
                              FALSE);

   ssd_contextmenu_show_item( &context_menu,
                              cm_send,
                              b_report_wrong_address,
                              FALSE);

   ssd_contextmenu_show_item( &context_menu,
                              cm_cancel,
                              add_cancel,
                              FALSE);

   ssd_context_menu_show(  menu_x,              // X
                           SSD_Y_SCREEN_BOTTOM, // Y
                           &context_menu,
                           on_option_selected,
                           NULL,
                           dir_default,
                           0);


   s_menu = TRUE;

   return 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;
}
示例#6
0
static void add_title (SsdWidget w, int flags) {
   SsdWidget title, text;
	int rt_soft_key_flag;
	int lf_soft_key_flag;
	int align_flag = SSD_ALIGN_CENTER;

#ifdef TOUCH_SCREEN
	const char *back_buttons[] = {"back_button", "back_button_s"};
#endif

	if (ssd_widget_rtl (NULL)) {
		rt_soft_key_flag = SSD_END_ROW;
		lf_soft_key_flag = SSD_ALIGN_RIGHT;
	}
	else{
		rt_soft_key_flag = SSD_ALIGN_RIGHT;
		lf_soft_key_flag = SSD_END_ROW;
	}


  if (!((w->flags & SSD_DIALOG_FLOAT) && !(w->flags & SSD_DIALOG_TRANSPARENT)))
  {
	int height = ADJ_SCALE( 34 );

#ifdef ANDROID
   align_flag = 0;
#endif //ANDROID

#ifndef TOUCH_SCREEN
      height = 28;
#endif
   title = ssd_container_new ("title_bar", NULL, SSD_MAX_SIZE, height, SSD_END_ROW);
   ssd_widget_set_click_offsets_ext( title, 0, 0, 0, 10 );
   ssd_widget_set_offset(title, 0, 0);
   title->draw = draw_title;
  }
  else{
   int height = 28;
      if ( roadmap_screen_is_hd_screen() )
      {
         height = height*1.8;
      }

      title = ssd_container_new ("title_bar", NULL, SSD_MAX_SIZE, height,
                              SSD_END_ROW);
  }

   ssd_widget_set_color (title, "#ffffff", "#ff0000000");

   text = ssd_text_new ("title_text", "" , 13, SSD_WIDGET_SPACE|SSD_ALIGN_VCENTER|align_flag);

   ssd_widget_set_color (text, "#ffffff", "#ff0000000");



   if ((w->flags & SSD_ROUNDED_CORNERS) && (!(w->flags & SSD_POINTER_MENU)))
   	ssd_widget_set_color (text, "#ffffff", "#ff0000000");

   if (w->flags & SSD_CONTAINER_TITLE){
   		if (w->flags & SSD_ROUNDED_BLACK)
   		   ssd_widget_set_color (text, "#ffffff", "#ffffff");
   		else if (!(w->flags & SSD_DIALOG_FLOAT))
   			ssd_widget_set_color (text, "#ffffff", "#ff0000000");
   		else
   		   if (flags & SSD_DIALOG_TRANSPARENT)
   		      ssd_widget_set_color (text, "#ffffff", "#ff0000000");
   		   else
   		      ssd_widget_set_color (text, "#000000", "#ff0000000");
   }
#if defined(TOUCH_SCREEN)
   if (!( ((flags & SSD_DIALOG_FLOAT)&& !(flags & SSD_DIALOG_TRANSPARENT)) || (flags & SSD_DIALOG_NO_BACK))){
      SsdWidget btn = NULL;
#ifndef ANDROID
      btn = ssd_button_new (SSD_DIALOG_BUTTON_BACK_NAME, "", back_buttons, 2,
                        SSD_ALIGN_VCENTER, button_callback );
#endif


	   if ( ssd_widget_rtl(NULL) )
	   {
         SsdWidget btn2 =             ssd_button_new ("right_title_button", "", back_buttons, 2,
                  SSD_ALIGN_VCENTER, NULL );
         ssd_widget_add( title, btn2 );
         ssd_widget_set_click_offsets_ext( btn2, -40, -20, 20, 10 );
         ssd_widget_hide(btn2);
#ifdef ANDROID
         ssd_dialog_add_hspace (title, 10, 0);
#endif //ANDROID
	      ssd_widget_add (title,text);
	      if ( btn != NULL )
	      {
	         ssd_widget_set_click_offsets_ext( btn, -20, -20, 70, 10 );
	         ssd_widget_set_flags( btn, SSD_ALIGN_VCENTER|SSD_ALIGN_RIGHT );
	         ssd_widget_add( title, btn );
	      }
	   }
	   else
	   {
         SsdWidget btn2 =             ssd_button_new ("right_title_button", "", back_buttons, 2,
                  SSD_ALIGN_VCENTER|SSD_ALIGN_RIGHT, NULL );
         ssd_widget_set_click_offsets_ext( btn2, -40, -20, 20, 10 );
         ssd_widget_hide(btn2);
         if ( btn != NULL )
         {
            ssd_widget_set_click_offsets_ext( btn, -20, -20, 70, 10 );
            ssd_widget_add( title, btn );
         }
#ifdef ANDROID
         ssd_dialog_add_hspace (title, 10, 0);
#endif //ANDROID
         ssd_widget_add (title,text);
         ssd_widget_add( title, btn2 );
	   }

	}
   else
   {
	   ssd_widget_add ( title, text );
   }
#else
   ssd_widget_add ( title, text );
#endif

   ssd_widget_add (w, title);
}
示例#7
0
static void create_ssd_dialog (void) {

   const char *left_icon[] = {"left_side"};
   const char *right_icon[] = {"right_side"};
   SsdWidget left;
   SsdWidget right;
   SsdWidget box;
   SsdWidget text;
   int align = 0;

   SsdWidget dialog = ssd_dialog_new ("Update house number",
                  roadmap_lang_get ("Update house number"),NULL,
                  SSD_CONTAINER_BORDER|SSD_CONTAINER_TITLE|SSD_DIALOG_FLOAT|
                  SSD_ALIGN_CENTER|SSD_ALIGN_VCENTER|SSD_ROUNDED_CORNERS);

   ssd_widget_set_color (dialog, "#000000", "#ffffffdd");

   /* Labels */
   box = ssd_container_new ("labels_box", NULL, -1, -1, SSD_WIDGET_SPACE);
   ssd_widget_set_color (box, "#000000", NULL);

   ssd_widget_add (box,
      ssd_text_new ("street_label", roadmap_lang_get (STREET_PREFIX),
                    14, SSD_TEXT_LABEL|SSD_END_ROW));

   ssd_widget_add (box,
      ssd_text_new ("city_label", roadmap_lang_get (CITY_PREFIX),
                    14, SSD_TEXT_LABEL|SSD_END_ROW));

   ssd_widget_add (dialog, box);

   /* Values */
   box = ssd_container_new ("values_box", NULL, -1, -1, SSD_END_ROW);
   ssd_widget_set_color (box, "#000000", NULL);

   ssd_widget_add (box,
      ssd_text_new (STREET_PREFIX, "", 14, SSD_END_ROW));

   ssd_widget_add (box,
      ssd_text_new (CITY_PREFIX, "", 14, SSD_END_ROW));

   ssd_widget_add (dialog, box);

   /* Spacer */
   ssd_widget_add (dialog,
      ssd_container_new ("spacer1", NULL, 0, 16, SSD_END_ROW));

   /* Left side */
   if (ssd_widget_rtl (NULL)) {
      align = SSD_ALIGN_RIGHT;
   }

   left = ssd_container_new ("left", NULL, -1, -1, align|SSD_WS_TABSTOP);
   ssd_widget_set_color (left, "#000000", NULL);
   ssd_widget_set_offset (left, 2, 0);

   box = ssd_container_new ("left_box", NULL, 50, 20,
                            SSD_ALIGN_CENTER|SSD_END_ROW);
   ssd_widget_set_color (box, "#000000", NULL);

   ssd_widget_add (box,
      ssd_text_new ("estimated_left", "", 16, SSD_END_ROW|SSD_ALIGN_CENTER));
   ssd_widget_add (left, box);

   ssd_widget_add (left,
         ssd_button_new ("left_button", "", left_icon, 1,
                         SSD_ALIGN_CENTER|SSD_END_ROW, button_callback));

   text = ssd_text_new (UPDATE_LEFT, "", 15, SSD_END_ROW|SSD_ALIGN_CENTER);
   ssd_widget_set_color (text, "#ff0000", 0);
   ssd_widget_add (left, text);

   /* Right side */
   if (ssd_widget_rtl (NULL)) align = 0;
   else align = SSD_ALIGN_RIGHT;

   right = ssd_container_new ("right", NULL, -1, -1, align|SSD_WS_TABSTOP);
   ssd_widget_set_offset (right, 2, 0);
   ssd_widget_set_color (right, "#000000", NULL);
   box = ssd_container_new ("right_box", NULL, 50, 20,
                            SSD_ALIGN_CENTER|SSD_END_ROW);
   ssd_widget_set_color (box, "#000000", NULL);

   ssd_widget_add (box,
      ssd_text_new ("estimated_right", "", 16, SSD_END_ROW|SSD_ALIGN_CENTER));
   ssd_widget_add (right, box);

   ssd_widget_add (right,
         ssd_button_new ("right_button", "", right_icon, 1,
                         SSD_ALIGN_CENTER|SSD_END_ROW, button_callback));

   text = ssd_text_new (UPDATE_RIGHT, "", 15, SSD_END_ROW);
   ssd_widget_set_color (text, "#ff0000", 0);
   ssd_widget_add (right, text);

   if (ssd_widget_rtl (NULL)) {
      ssd_widget_add (dialog, right);
      ssd_widget_add (dialog, left);
   } else {
      ssd_widget_add (dialog, left);
      ssd_widget_add (dialog, right);
   }

   ssd_widget_add (dialog,
      ssd_button_label ("OK", roadmap_lang_get ("Ok"),
                        SSD_ALIGN_CENTER|SSD_START_NEW_ROW|SSD_WS_TABSTOP, button_callback));

}
示例#8
0
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();
}
示例#9
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

}
示例#10
0
SsdWidget events_on_route_widget(int altId, int flags) {
	SsdWidget container;
	SsdWidget bar;
	SsdWidget bitmap;
	int i;
	int count = 0;
	int non_traffic_count = 0;
	int height = ADJ_SCALE(50);

	if (!events_on_route_feature_enabled())
		return NULL;
	for (i = 0; i < events_on_route_count_alternative(altId); i++) {
		event_on_route_info *event = events_on_route_at_index_alternative(i, altId);
		if (event->iType != RT_ALERT_TYPE_TRAFFIC_INFO)
			non_traffic_count++;
		count++;
	}

	if (non_traffic_count == 0)
		height = ADJ_SCALE(40);

	container = ssd_container_new("events_container", NULL, SSD_MAX_SIZE, height, SSD_WIDGET_SPACE
			| SSD_END_ROW | flags);
	ssd_widget_set_color(container, NULL, NULL);

	bar = ssd_container_new("events_container", NULL, SSD_MAX_SIZE, ADJ_SCALE(10), SSD_WIDGET_SPACE
			| SSD_END_ROW | SSD_ALIGN_BOTTOM);
	bar->draw = _draw_bar;
	ssd_widget_add(container, bar);

	if (ssd_widget_rtl(NULL)) {
		bitmap = ssd_bitmap_new("Start", "events_arrow_left", 0);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(3), non_traffic_count ? ADJ_SCALE(13) : ADJ_SCALE(3));
	}
	else {
		bitmap = ssd_bitmap_new("Start", "events_arrow_right", 0);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(3), non_traffic_count ? ADJ_SCALE(13) : ADJ_SCALE(3));
	}
	ssd_widget_add(container, bitmap);

	if (ssd_widget_rtl(NULL)) {
		bitmap = ssd_bitmap_new("End", "events_flag_left", SSD_ALIGN_RIGHT);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(3), non_traffic_count ? ADJ_SCALE(10) : ADJ_SCALE(0));
	}
	else {
		bitmap = ssd_bitmap_new("End", "events_flag_right", SSD_ALIGN_RIGHT);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(-3), non_traffic_count ? ADJ_SCALE(10) : ADJ_SCALE(0));
	}
	ssd_widget_add(container, bitmap);

	for (i = 0; i < count; i++) {
		event_on_route_info *event = (event_on_route_info *) events_on_route_at_index_alternative(i, altId);
		if (event->iType != RT_ALERT_TYPE_TRAFFIC_INFO) {
			ssd_widget_add(container, _alert_widget(event));
		}
		else {
			ssd_widget_add(bar, _traffic_widget(event));
		}
	}

	return container;
}
示例#11
0
static void _draw_traffic(SsdWidget widget, RoadMapGuiRect *rect, int flags) {
	event_on_route_info *data = (event_on_route_info *) widget->data;
	static RoadMapImage events_divider;
	static RoadMapImage events_traffic_1 = NULL;
	static RoadMapImage events_traffic_2 = NULL;
	static RoadMapImage events_traffic_3 = NULL;
	RoadMapImage event_traffic;

	int width = widget->parent->cached_size.width - ADJ_SCALE(34);

	if (ssd_widget_rtl(NULL))
		rect->minx -= ADJ_SCALE(17);
	else
		rect->minx += ADJ_SCALE(17);

	if (!events_divider)
		events_divider = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_divider");

	if (!events_traffic_1)
		events_traffic_1 = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_traffic_1");
	if (!events_traffic_2)
		events_traffic_2 = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_traffic_2");

	if (!events_traffic_3)
		events_traffic_3 = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_traffic_3");

	switch (data->iSeverity) {
	case JAM_TYPE_MODERATE_TRAFFIC:
		event_traffic = events_traffic_1;
		break;
	case JAM_TYPE_HEAVY_TRAFFIC:
		event_traffic = events_traffic_2;
		break;
	case JAM_TYPE_STAND_STILL_TRAFFIC:
		event_traffic = events_traffic_3;
		break;
	default:
		return;
	}

	if (flags & SSD_GET_SIZE) {
		rect->maxx = rect->minx;//.+ 2 ;
		rect->maxy = rect->miny + roadmap_canvas_image_height(events_divider);
	}
	else {
		if ((data->iPrecentage * width / 100) > roadmap_canvas_image_width(events_divider)*2+2) {
			RoadMapGuiPoint position;
			RoadMapGuiPoint sign_top;
			RoadMapGuiPoint sign_bottom;

			if (ssd_widget_rtl(NULL))
				position.x = rect->minx - (width * data->iStart / 100) - roadmap_canvas_image_width(
						events_divider);
			else
				position.x = rect->minx + (width * data->iStart / 100);
			position.y = rect->miny;
			roadmap_canvas_draw_image(events_divider, &position, 0, IMAGE_NORMAL);

			if (ssd_widget_rtl(NULL))
				position.x = rect->minx - (width * data->iStart / 100) - (width * data->iPrecentage / 100)
						+ roadmap_canvas_image_width(events_divider);
			else
				position.x = rect->minx + (width * data->iStart / 100) + (width * data->iPrecentage / 100)
						- 2 * roadmap_canvas_image_width(events_divider);
			position.y = rect->miny;
			roadmap_canvas_draw_image(events_divider, &position, 0, IMAGE_NORMAL);

			if (ssd_widget_rtl(NULL))
				sign_bottom.x = rect->minx - (width * data->iStart / 100) - roadmap_canvas_image_width(
						events_divider);
			else
				sign_top.x = rect->minx + (width * data->iStart / 100) + roadmap_canvas_image_width(
						events_divider);
			sign_top.y = rect->miny;
			position.x = roadmap_canvas_image_width(event_traffic) / 2;
			position.y = roadmap_canvas_image_height(event_traffic) / 2;
			if (ssd_widget_rtl(NULL))
				sign_top.x = rect->minx - (width * data->iStart / 100) - (width * data->iPrecentage
						/ 100) + 2 * roadmap_canvas_image_width(events_divider);
			else
				sign_bottom.x = rect->minx + (width * data->iStart / 100) + (width * data->iPrecentage
						/ 100) - 2 * roadmap_canvas_image_width(events_divider);
			sign_bottom.y = rect->miny + roadmap_canvas_image_height(event_traffic);
			roadmap_canvas_draw_image_stretch(event_traffic, &sign_top, &sign_bottom, &position, 0,
					IMAGE_NORMAL);
		}
	}

}
示例#12
0
SsdWidget ssd_confirmed_entry_new (const char *name,
                                   const char *value,
                                   int entry_flags,
                                   int text_flags,
                                   int width,
                                   int height,
                                   const char *messagebox_text,
                                   const char *background_text) {

    const char *edit_button[] = {"edit_right", "edit_left"};
    SsdWidget button;
    SsdWidget space;
    SsdWidget bg_text;
    SsdWidget entry;
    SsdWidget text_box;
    int tab_st = 0;
    int txt_box_height = 40;
    SsdEntryContext*  ctx = (SsdEntryContext*) calloc( 1, sizeof( SsdEntryContext ) );
#ifndef TOUCH_SCREEN
    txt_box_height = 23;
#endif

#ifdef OPENGL
    if ( height > 0 )
        txt_box_height = height;
#endif


    entry_ctx_init( ctx );

    if (entry_flags & SSD_WS_TABSTOP) {
        entry_flags &= ~SSD_WS_TABSTOP;
        tab_st = SSD_WS_TABSTOP;
    }

    entry =
        ssd_container_new (name, NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, entry_flags);

    text_box =
        ssd_container_new ("text_box", NULL, width,
                           txt_box_height, SSD_CONTAINER_TXT_BOX|SSD_ALIGN_VCENTER|tab_st);

    ssd_widget_set_pointer_force_click( text_box );
    entry->get_value = get_value;
    entry->set_value = set_value;

    entry->bg_color = NULL;

    text_box->callback = confirmed_edit_callback;
    text_box->bg_color = NULL;


    space = ssd_container_new("Space", NULL,5, SSD_MIN_SIZE, SSD_WIDGET_SPACE);
    ssd_widget_set_color(space, NULL, NULL);
    ssd_widget_add(text_box, space);
    ssd_widget_add (text_box, ssd_text_new ("Text", value, -1, text_flags|SSD_ALIGN_VCENTER));
    if (background_text == NULL)
        bg_text = ssd_text_new ("BgText", "", -1, SSD_ALIGN_VCENTER);
    else
        bg_text = ssd_text_new ("BgText", background_text, -1, SSD_ALIGN_VCENTER);
    ssd_widget_set_color(bg_text, "#C0C0C0",NULL);
    ssd_widget_add (text_box, bg_text);
#ifdef TOUCH_SCREEN
    if (!ssd_widget_rtl(NULL))
        button = ssd_button_new ("edit_button", "", &edit_button[0], 1,
                                 SSD_ALIGN_VCENTER|SSD_ALIGN_RIGHT, edit_callback);
    else
        button = ssd_button_new ("edit_button", "", &edit_button[1], 1,
                                 SSD_ALIGN_VCENTER|SSD_ALIGN_RIGHT, edit_callback);

    if (!ssd_widget_rtl(NULL))
        ssd_widget_set_offset(button, 10, 0);
    else
        ssd_widget_set_offset(button, -11, 0);
#endif
    ctx->mb_text = (void *)strdup(messagebox_text);

    entry->context = ctx;

    if ((value != NULL) && (value[0] != 0))
        ssd_widget_hide(bg_text);

    ssd_widget_add (entry, text_box);

    /* Default keyboard params */
    ssd_entry_set_kb_params( entry, name, NULL, NULL, NULL, 0 );

    return entry;
}
示例#13
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);

}
示例#14
0
static int ssd_widget_draw_row (SsdWidget *w, int count,
                                int width, int height,
                                int x, int y) {
   int row_height = 0;
   int cur_x;
   int total_width;
   int space;
   int vcenter = 0;
   int bottom = 0;
   int i;
   int rtl = ssd_widget_rtl(w[0]->parent);
   SsdWidget prev_widget;
   int orig_width = width;
   int orig_x = x;
   if (y > roadmap_canvas_height()){
      return 0;
   }
   if (w[0]->flags & SSD_ALIGN_LTR) rtl = 0;

   if (rtl) cur_x = x;
   else cur_x = x + width;

   for (i=0; i<count; i++) {
      SsdSize size;
      ssd_widget_get_size (w[i], &size, NULL);

      if (size.height > row_height) row_height = size.height;
      if (w[i]->flags & SSD_ALIGN_VCENTER) vcenter = 1;
      if (w[i]->flags & SSD_ALIGN_BOTTOM) bottom = 1;
   }

   if (bottom) {
      y += (height - row_height);

   } else if (vcenter) {
      y += (height - row_height) / 2;
   }

   for (i=count-1; i>=0; i--) {
      SsdSize size;
      ssd_widget_get_size (w[i], &size, NULL);

      if (w[i]->flags & SSD_ALIGN_RIGHT) {
         cur_x += w[i]->offset_x;
         if (rtl) {
            if ((i < (count-1)) && (w[i+1]->flags & SSD_WIDGET_SPACE)) {
               cur_x += SSD_WIDGET_SEP;
            }
            ssd_widget_draw_one (w[i], cur_x, y + w[i]->offset_y, row_height);
            cur_x += size.width;
         } else {
            cur_x -= size.width;
            if ((i < (count-1)) && (w[i+1]->flags & SSD_WIDGET_SPACE)) {
               cur_x -= SSD_WIDGET_SEP;
            }
            ssd_widget_draw_one (w[i], cur_x, y + w[i]->offset_y, row_height);
         }
         //width -= size.width;
         if ((i < (count-1)) && (w[i+1]->flags & SSD_WIDGET_SPACE)) {
            //width -= SSD_WIDGET_SEP;
         }
         count--;
         if (i != count) {
            memmove (&w[i], &w[i+1], sizeof(w[0]) * count - i);
         }
      }
   }

   if (rtl) cur_x = x + width;
   else cur_x = x;

   prev_widget = NULL;

   while (count > 0) {
      SsdSize size;

      if (w[0]->flags & SSD_ALIGN_CENTER) {
         break;
      }

      ssd_widget_get_size (w[0], &size, NULL);

      if (rtl) {
         cur_x -= size.width;
         cur_x -= w[0]->offset_x;
         if (prev_widget && (prev_widget->flags & SSD_WIDGET_SPACE)) {
            cur_x -= SSD_WIDGET_SEP;
         }
         ssd_widget_draw_one (w[0], cur_x, y + w[0]->offset_y, row_height);
      } else {
         cur_x += w[0]->offset_x;
         if (prev_widget && (prev_widget->flags & SSD_WIDGET_SPACE)) {
            cur_x += SSD_WIDGET_SEP;
         }
         ssd_widget_draw_one (w[0], cur_x, y + w[0]->offset_y, row_height);
         cur_x += size.width;
      }

      width -= size.width;
      if (prev_widget && (prev_widget->flags & SSD_WIDGET_SPACE)) {
         width -= SSD_WIDGET_SEP;
      }
      prev_widget = *w;
      w++;
      count--;
   }

   if (count == 0) return row_height;

   /* align center */

   total_width = 0;
   for (i=0; i<count; i++) {
      SsdSize size;
      ssd_widget_get_size (w[i], &size, NULL);

      total_width += size.width;
   }

   space = (width - total_width) / (count + 1);

   for (i=0; i<count; i++) {
      SsdSize size;
      ssd_widget_get_size (w[i], &size, NULL);
      // beginning of patch to take care of title which wasn't aligned to center - dan
	  if (!strcmp(w[i]->name,"title_text")){
   		total_width=0;
	  	total_width += size.width;
	  	cur_x = orig_x;
	  	if (rtl)
	  		cur_x +=orig_width;
	  	space = (orig_width - total_width) / (count + 1);
      }
      // end of patch
      if (rtl) {
         cur_x -= space;
         cur_x -= size.width;
         cur_x -= w[i]->offset_x;
         ssd_widget_draw_one (w[i], cur_x, y + w[i]->offset_y, row_height);
      } else {
         cur_x += space;
         cur_x += w[i]->offset_x;
         ssd_widget_draw_one (w[i], cur_x, y + w[i]->offset_y, row_height);
         cur_x += size.width;
      }
   }

   return row_height;
}