Пример #1
0
void ssd_widget_container_size (SsdWidget dialog, SsdSize *size) {

   SsdSize max_size;

   /* Calculate size recurisvely */
   if (dialog->parent) {
      ssd_widget_container_size (dialog->parent, size);
      max_size.width = size->width;
      max_size.height = size->height;

   } else {
      max_size.width = roadmap_canvas_width ();
#ifdef TOUCH_SCREEN
      max_size.height = roadmap_canvas_height ();
#else
      max_size.height = roadmap_canvas_height () - roadmap_bar_bottom_height();
#endif
   }

   ssd_widget_get_size (dialog, size, &max_size);

   if (dialog->draw) {
      RoadMapGuiRect rect;
      rect.minx = 0;
      rect.miny = 0;
      rect.maxx = size->width - 1;
      rect.maxy = size->height - 1;

      dialog->draw (dialog, &rect, SSD_GET_SIZE|SSD_GET_CONTAINER_SIZE);

      size->width = rect.maxx - rect.minx + 1;
      size->height = rect.maxy - rect.miny + 1;
   }
}
Пример #2
0
void ssd_dialog_allign_focus(void){
   SsdSize size;
   int height;
   int min;
   SsdWidget title;
    title = ssd_widget_get (RoadMapDialogCurrent->container, "title_bar");
    if (title)
       min =  title->cached_size.height;
    else
       min = 0;
#ifndef TOUCH_SCREEN
    if (!is_screen_wide())
    	min += roadmap_bar_top_height();
    if( SSD_TAB_CONTROL & RoadMapDialogCurrent->container->flags)
       min += ssd_tabcontrol_get_height();
#endif

#ifdef TOUCH_SCREEN
   height = roadmap_canvas_height();
#else
   height = roadmap_canvas_height() - roadmap_bar_bottom_height();
#endif

   if (RoadMapDialogCurrent->in_focus && RoadMapDialogCurrent->scroll_container){
      if ((RoadMapDialogCurrent->in_focus->position.y == -1) || (RoadMapDialogCurrent->in_focus->position.x == -1 )){
         RoadMapDialogCurrent->in_focus->position.y = 0;
         RoadMapDialogCurrent->scroll_container->offset_y +=20;
      }
      ssd_widget_get_size(RoadMapDialogCurrent->in_focus, &size, NULL);
      if (( RoadMapDialogCurrent->in_focus->position.y == 0) || ((size.height + RoadMapDialogCurrent->in_focus->position.y) > height)){

          while (( RoadMapDialogCurrent->in_focus->position.y == 0) || ((size.height + RoadMapDialogCurrent->in_focus->position.y) > height)) {
            ssd_widget_set_offset(RoadMapDialogCurrent->scroll_container, 0, RoadMapDialogCurrent->scroll_container->offset_y-20);
            ssd_dialog_draw();
         }
         
         while (RoadMapDialogCurrent->in_focus->position.y < min){
            ssd_widget_set_offset(RoadMapDialogCurrent->scroll_container, 0, RoadMapDialogCurrent->scroll_container->offset_y+20);
            ssd_dialog_draw();
         }
      }
      else{
         while (RoadMapDialogCurrent->in_focus->position.y < min){
            ssd_widget_set_offset(RoadMapDialogCurrent->scroll_container, 0, RoadMapDialogCurrent->scroll_container->offset_y+20);
            ssd_dialog_draw();
         }
      }
   }
   
}
Пример #3
0
static const char * create_group_url(const char *group_name) {
   static char url[1024];
   snprintf(url, sizeof(url),"%s?sessionid=%d&cookie=%s&deviceid=%d&width=%d&height=%d&gotogroup=%s&client_version=%s&web_version=%s&lang=%s",
            roadmap_groups_get_url(),
            Realtime_GetServerId(),
            Realtime_GetServerCookie(),
            RT_DEVICE_ID,
            roadmap_canvas_width(),
            roadmap_canvas_height() - roadmap_bar_bottom_height(),
            group_name,
            roadmap_start_version(),
            BROWSER_WEB_VERSION,
            roadmap_lang_get_system_lang());
   append_current_location(url + strlen(url));
   return &url[0];
}
Пример #4
0
static const char *create_url(void) {
   static char url[1024];
   snprintf(url, sizeof(url),"%s?sessionid=%d&cookie=%s&deviceid=%d&width=%d&height=%d&client_version=%s&web_version=%s&lang=%s",
            roadmap_groups_get_url(),
            Realtime_GetServerId(),
            Realtime_GetServerCookie(),
#ifndef RIMAPI
            RT_DEVICE_ID,
#else
            20, // until server is changed. TODO : CHANGE!
#endif
            roadmap_canvas_width(),
            roadmap_canvas_height() - roadmap_bar_bottom_height(),
            roadmap_start_version(),
            BROWSER_WEB_VERSION,
            roadmap_lang_get_system_lang());
   append_current_location(url + strlen(url));
   return &url[0];
}
Пример #5
0
int roadmap_display_border(int style, int header, int pointer_type, RoadMapGuiPoint *bottom, RoadMapGuiPoint *top, const char* background, RoadMapPosition *position, int position_offset_y){
	//static const char *fill_bg = "#f3f3f5";// "#e4f1f9";
	RoadMapPen fill_pen;
	int screen_width, screen_height, sign_width, sign_height;
	RoadMapGuiPoint right_point, left_point, start_sides_point, point, new_point;
	int i, num_items;
	int count, start_pos_x, top_height;
	RoadMapGuiPoint sign_bottom, sign_top;
	RoadMapImage image;
	RoadMapGuiPoint points[3];
	RoadMapGuiPoint fill_points[4];


	screen_width = roadmap_canvas_width();
	screen_height = roadmap_canvas_height();

	if (top == NULL)
	{
		sign_top.x = 1;
		sign_top.y = roadmap_bar_top_height();
	}
	else{
		sign_top.x = top->x ;
		sign_top.y = top->y ;
	}

	if (bottom == NULL)
	{
		sign_bottom.x = screen_width-1;
		sign_bottom.y = screen_height - roadmap_bar_bottom_height();
	}
	else{
		sign_bottom.x = bottom->x ;
		sign_bottom.y = bottom->y ;
	}

   if ((pointer_type == POINTER_POSITION) || (pointer_type == POINTER_FIXED_POSITION)){
       roadmap_math_coordinate (position, points);
       roadmap_math_rotate_project_coordinate ( points );
       points[0].y += position_offset_y;
   }

	sign_width = sign_bottom.x  - sign_top.x;
	sign_height = sign_bottom.y - sign_top.y;

	if (header != HEADER_NONE){
	    image = get_image(border_top, style, header, pointer_type, bottom, top, 0);
    	roadmap_canvas_draw_image (image, &sign_top, 0, IMAGE_NORMAL);

    	left_point.x = sign_top.x;
		right_point.x = left_point.x + sign_width - s_images[header+2].width ;
		start_sides_point.y = sign_top.y + s_images[header].height  ;
		top_height = s_images[header].height+7;
#ifndef __ROADMAP_BORDER_CACHE__
    	// Release after drawing
		roadmap_canvas_free_image( image );
#endif
	}
	else{
		 RoadMapImage image;
		left_point.x = sign_top.x;
		right_point.x = sign_bottom.x - s_images[border_white_right+style].width;
		start_sides_point.y = sign_top.y + s_images[border_white_top_right+style].height;
		left_point.y = sign_top.y ;
		image =  get_image(border_top, style, header, pointer_type, bottom, top, 0);
  		roadmap_canvas_draw_image (image, &left_point, 0, IMAGE_NORMAL);
#ifndef __ROADMAP_BORDER_CACHE__
  		// Release after drawing
		roadmap_canvas_free_image( image );
#endif
  		right_point.y = sign_top.y;
  		if (style == STYLE_BLACK)
  		   top_height = s_images[border_white_top+style].height+7;
  		else
  		 top_height = s_images[border_white_top+style].height;
	}

	num_items = ( sign_height - start_sides_point.y +sign_top.y - s_images[border_white_bottom+style].height ) / s_images[border_white_right+style].height;
	if (num_items < 0 )
	   return 0;
	image  = get_image(border_sides, style, header, pointer_type, bottom, top, 1);

	for (i = 0; i < num_items; i++){
	   point.x = left_point.x;
      point.y = start_sides_point.y + i*s_images[border_white_right+style].height;
      roadmap_canvas_draw_image (image, &point, 0, IMAGE_NORMAL);

	}

	point.y += roadmap_canvas_image_height(image)-1;
#ifndef __ROADMAP_BORDER_CACHE__
	// Release after drawing
	roadmap_canvas_free_image( image );
#endif

	if (pointer_type == POINTER_NONE){
	   RoadMapImage image;
	   left_point.y = point.y +  s_images[border_white_left+style].height ;
	   image =  get_image(border_bottom, style, header, pointer_type, bottom, top, 0);
	   roadmap_canvas_draw_image (image, &left_point, 0, IMAGE_NORMAL);
#ifndef __ROADMAP_BORDER_CACHE__
	   // Release after drawing
		roadmap_canvas_free_image( image );
#endif
	}
	else{
	   left_point.y = point.y +  s_images[border_white_left+style].height ;
	   roadmap_canvas_draw_image (s_images[border_white_bottom_left+style].image, &left_point, 0, IMAGE_NORMAL);


	    right_point.y = point.y + s_images[border_white_right+style].height;
	    roadmap_canvas_draw_image (s_images[border_white_bottom_right+style].image, &right_point, 0, IMAGE_NORMAL);

		if (pointer_type == POINTER_MENU)
			num_items = 1;
		else if (pointer_type == POINTER_COMMENT){
			num_items = ((right_point.x - left_point.x)/s_images[border_white_bottom+style].width)/4 -2;
		}
		else if (pointer_type == POINTER_FIXED_POSITION){
         int pointer_draw_offset;
           pointer_draw_offset = points[0].x - 15 - left_point.x;
           if (pointer_draw_offset+sign_top.x > sign_bottom.x-52)
              pointer_draw_offset = sign_bottom.x-52-sign_top.x;
           if (pointer_draw_offset+sign_top.x < sign_top.x+30)
              pointer_draw_offset = 30;

           num_items = (pointer_draw_offset-21)/s_images[border_white_bottom+style].width;
		}
		else if (pointer_type == POINTER_POSITION)
		         num_items = (right_point.x - left_point.x- 100)/s_images[border_white_bottom+style].width;
		else
			num_items = ((right_point.x - left_point.x)/s_images[border_white_bottom+style].width)/2 -2;

		for (i = 0; i<num_items; i++){
			point.x = left_point.x + s_images[border_white_bottom_left+style].width + i * s_images[border_white_bottom+style].width ;
			point.y = left_point.y;
			roadmap_canvas_draw_image (s_images[border_white_bottom+style].image, &point, 0, IMAGE_NORMAL);
		}


		if ((pointer_type == POINTER_POSITION) || (pointer_type == POINTER_FIXED_POSITION)){
			int visible = roadmap_math_point_is_visible (position);
			if (visible){
				int count = 3;
				RoadMapPen pointer_pen;
				if (points[0].y > (point.y +10) ){
				   points[1].x = point.x;
				   points[1].y = point.y+s_images[border_black_bottom_no_frame].height-3;
				   points[2].x = point.x+42;
				   points[2].y = point.y+s_images[border_black_bottom_no_frame].height-3;

				   pointer_pen = roadmap_canvas_create_pen ("fill_pop_up_pen");

				   roadmap_canvas_set_foreground("#000000");
				   roadmap_canvas_set_opacity(181);
				   count = 3;
				   roadmap_canvas_draw_multiple_polygons (1, &count, points, 1, 0);

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

				      point.x = point.x + s_images[border_black_bottom_no_frame].width ;
				      point.y = point.y;
				      roadmap_canvas_draw_image (s_images[border_black_bottom_no_frame].image, &point, 0, IMAGE_NORMAL);
				   }
				}

			}
   		start_pos_x = point.x+1;
		}
		else{
			roadmap_canvas_draw_image (s_images[pointer_type].image, &point, 0, IMAGE_NORMAL);
			start_pos_x = point.x + s_images[pointer_type].width;
		}



		num_items = (right_point.x - start_pos_x )/s_images[border_white_bottom+style].width ;
		for (i = 0; i<num_items; i++){
			new_point.x = start_pos_x + i * s_images[border_white_bottom+style].width ;
			new_point.y = point.y;
			roadmap_canvas_draw_image (s_images[border_white_bottom+style].image, &new_point, 0, IMAGE_NORMAL);
		}
	}

	//Fill the
	if ((style == STYLE_NORMAL) || (style == STYLE_BLACK)){
	   if ((pointer_type == POINTER_POSITION) || (pointer_type == POINTER_FIXED_POSITION)|| (pointer_type == POINTER_COMMENT))
	      point.y -= 1;
		fill_points[0].x =right_point.x ;
		fill_points[0].y =point.y +1;
		fill_points[1].x =right_point.x ;
		fill_points[1].y = top->y + top_height -7;
		fill_points[2].x = left_point.x + s_images[border_white_left+style].width ;
		fill_points[2].y = top->y + top_height - 7;
		fill_points[3].x =left_point.x + s_images[border_white_left+style].width ;
		fill_points[3].y = point.y +1;
		count = 4;
	}
	else{
		fill_points[0].x =right_point.x+2 ;
		fill_points[0].y =point.y +2;
		fill_points[1].x =right_point.x +2;
		fill_points[1].y = top->y + top_height -2;
		fill_points[2].x = left_point.x + s_images[border_white_left+style].width -2;
		fill_points[2].y = top->y + top_height - 2;
		fill_points[3].x =left_point.x + s_images[border_white_left+style].width -2;
		fill_points[3].y = point.y +2;
		count = 4;
	}
  	fill_pen = roadmap_canvas_create_pen ("fill_pop_up_pen");
   roadmap_canvas_set_foreground(background);

   if (style == STYLE_BLACK)
      roadmap_canvas_set_opacity(181);
	roadmap_canvas_draw_multiple_polygons (1, &count, fill_points, 1,0 );

	return sign_width;

}
Пример #6
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();
}
Пример #7
0
}

static void draw_bg( SsdWidget this, RoadMapGuiRect *rect, int flags){

   static RoadMapImage TopBgImage;
   static RoadMapImage BottomBgImage;
   static RoadMapImage MiddleBgImage;
   RoadMapGuiPoint point;
   int i;
   static int top_height, top_width;
   static int bottom_height, bottom_width;

#ifdef TOUCH_SCREEN
   int height = roadmap_canvas_height() ;
#else
   int height = roadmap_canvas_height() -  roadmap_bar_bottom_height();
#endif
   int width = roadmap_canvas_width();

   /*
    * AGA TODO:: Check images caching
    */
   if (!TopBgImage)
      TopBgImage = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN|RES_NOCACHE, "menu_bg_top");
   if (TopBgImage == NULL){
      return;
   }

   if (!BottomBgImage)
      BottomBgImage = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN|RES_NOCACHE, "menu_bg_bottom");
   if (BottomBgImage == NULL){
Пример #8
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 ();
}
Пример #9
0
void ssd_widget_get_size (SsdWidget w, SsdSize *size, const SsdSize *max) {

   SsdSize pack_size = {0, 0};

   RoadMapGuiRect max_size = {0, 0, 0, 0};
   int total_height_below = 0;

   *size = w->size;

   if ((w->size.height >= 0) && (w->size.width >= 0)) {
      return;
   }

   if (!max && (w->cached_size.width < 0)) {
       static SsdSize canvas_size;

       canvas_size.width   = roadmap_canvas_width();
#ifdef TOUCH_SCREEN
 	   canvas_size.height  = roadmap_canvas_height() ;
#else
       canvas_size.height  = roadmap_canvas_height() - roadmap_bar_bottom_height();
#endif
       max = &canvas_size;
   }
   else{
   	if (!max)
   		max = &w->cached_size;
   }



   if ((w->cached_size.width >= 0) && (w->cached_size.height >= 0)) {
      *size = w->cached_size;
      return;
   }
   /* Comment by AGA. THere is no assignment for this flag
   if (size->height == SSD_MAX_SIZE) {
      // Check if other siblings exists and should be placed below this one
      SsdWidget below_w = w->next;


      while (below_w) {

         if (below_w->flags & SSD_ORDER_LAST) {
            SsdSize s;
            ssd_widget_get_size (below_w, &s, max);

            total_height_below += s.height;
         }
         below_w = below_w->next;
      }

   }
   */

   if ((w->flags & SSD_DIALOG_FLOAT) && !(w->flags & SSD_DIALOG_TRANSPARENT)){
      if ((size->width == SSD_MAX_SIZE) && ((max->width >= roadmap_canvas_width()) || (max->width >= roadmap_canvas_height()))){
         if (roadmap_canvas_width() > roadmap_canvas_height())
            size->width = roadmap_canvas_height();
         else
            size->width = roadmap_canvas_width()- ADJ_SCALE(20);
#ifdef IPHONE
         size->width = ADJ_SCALE(320);
#endif

      }else
         if (size->width == SSD_MAX_SIZE) size->width = max->width -ADJ_SCALE(20);
      if (size->height== SSD_MAX_SIZE) size->height= max->height - total_height_below;

   } else {

      if (size->width == SSD_MAX_SIZE) size->width = max->width;
      if (size->height== SSD_MAX_SIZE) size->height= max->height - total_height_below;
   }

#ifdef IPHONE_NATIVE
   if (size->width > ADJ_SCALE(320))
      size->width = ADJ_SCALE(320);
#endif //IPHONE

   if ((size->height >= 0) && (size->width >= 0)) {
      w->cached_size = *size;
      return;
   }

   if (size->width >= 0)  {
      max_size.maxx = size->width - 1;
   } else {
      if (!max){
                static SsdSize canvas_size;
                canvas_size.width = roadmap_canvas_width();
#ifdef TOUCH_SCREEN
				canvas_size.height = roadmap_canvas_height();
#else
                canvas_size.height = roadmap_canvas_height() - roadmap_bar_bottom_height();
#endif
                max = &canvas_size;
      }
      max_size.maxx = max->width - 1;
   }

   if (size->height >= 0) {
      max_size.maxy = size->height - 1;
   } else {
      max_size.maxy = max->height - 1;
   }

   if (!(w->flags & SSD_VAR_SIZE) && w->children) {
      RoadMapGuiRect container_rect = max_size;
      int container_width;
      int container_height;

      w->draw (w, &max_size, SSD_GET_SIZE);

      container_width  = max_size.minx - container_rect.minx +
                         container_rect.maxx - max_size.maxx;
      container_height = max_size.miny - container_rect.miny +
                         container_rect.maxy - max_size.maxy;

      calc_pack_size (w->children, &max_size, &pack_size);

      pack_size.width  += container_width;
      pack_size.height += container_height;

   } else {
      w->draw (w, &max_size, SSD_GET_SIZE);
      pack_size.width  = max_size.maxx - max_size.minx + 1;
      pack_size.height = max_size.maxy - max_size.miny + 1;
   }

   if (size->height< 0) size->height = pack_size.height;
   if (size->width < 0) size->width  = pack_size.width;

   w->cached_size = *size;
}
Пример #10
0
void ssd_widget_get_size (SsdWidget w, SsdSize *size, const SsdSize *max) {


   RoadMapGuiRect max_size_temp;
   SsdSize pack_size = {0, 0};

   RoadMapGuiRect max_size = {0, 0, 0, 0};
   int total_height_below = 0;

   *size = w->size;

   if ((w->size.height >= 0) && (w->size.width >= 0)) {
      return;
   }

   if (!max && (w->cached_size.width < 0)) {
       static SsdSize canvas_size;

       canvas_size.width   = roadmap_canvas_width();
#ifdef TOUCH_SCREEN
 	   canvas_size.height  = roadmap_canvas_height() ;
#else
       canvas_size.height  = roadmap_canvas_height() - roadmap_bar_bottom_height();
#endif
       max = &canvas_size;
   }
   else{
   	if (!max)
   		max = &w->cached_size;
   }



   if ((w->cached_size.width >= 0) && (w->cached_size.height >= 0)) {
      *size = w->cached_size;
      return;
   }
   /* Comment by AGA. THere is no assignment for this flag
   if (size->height == SSD_MAX_SIZE) {
      /* Check if other siblings exists and should be placed below this one *
      SsdWidget below_w = w->next;


      while (below_w) {

         if (below_w->flags & SSD_ORDER_LAST) {
            SsdSize s;
            ssd_widget_get_size (below_w, &s, max);

            total_height_below += s.height;
         }
         below_w = below_w->next;
      }

   }
   */

   if ((w->flags & SSD_DIALOG_FLOAT) && !(w->flags & SSD_DIALOG_TRANSPARENT)){
      if ((size->width == SSD_MAX_SIZE) && ((max->width >= roadmap_canvas_width()) || (max->width >= roadmap_canvas_height()))){
         if (roadmap_canvas_width() > roadmap_canvas_height()) {
            size->width = roadmap_canvas_height();
//			printf("size->width,height %d,%d\n",size->width,size->height);
         }
         else
            size->width = roadmap_canvas_width()-20;
#ifdef IPHONE
         size->width = 320 * roadmap_screen_get_screen_scale() / 100;
#endif
         
      }else
         if (size->width == SSD_MAX_SIZE) size->width = max->width -20;
      if (size->height== SSD_MAX_SIZE) size->height= max->height - total_height_below;

   } else {

      if (size->width == SSD_MAX_SIZE) size->width = max->width;
      if (size->height== SSD_MAX_SIZE) size->height= max->height - total_height_below;
   }

#ifdef IPHONE_NATIVE
   if (size->width > 320 * roadmap_screen_get_screen_scale() / 100)
      size->width = 320 * roadmap_screen_get_screen_scale() / 100;
#endif //IPHONE

   if ((size->height >= 0) && (size->width >= 0)) {
      w->cached_size = *size;
      return;
   }

   if (size->width >= 0)  {
      max_size.maxx = size->width - 1;
   } else {
      if (!max){
                static SsdSize canvas_size;
                canvas_size.width = roadmap_canvas_width();
#ifdef TOUCH_SCREEN
				canvas_size.height = roadmap_canvas_height();
#else
                canvas_size.height = roadmap_canvas_height() - roadmap_bar_bottom_height();
#endif
                max = &canvas_size;
      }
      max_size.maxx = max->width - 1;
   }

   if (size->height >= 0) {
      max_size.maxy = size->height - 1;
   } else {
      max_size.maxy = max->height - 1;
   }

   max_size_temp = max_size;
   get_size(w,&pack_size, &max_size);


   if (w->flags & SSD_WIDGET_RESIZE) {
	   /*
	    * The following code will take affect when the caclculated size extends beyond the screen height, and
	    * thus won't be shown fully.
	    * In this case, we will extend the widget's width
	    * as wide as possible, hoping that this will help fit the widget in the screen. - D.F.
	    */
	   if((roadmap_canvas_width() > roadmap_canvas_height())){
		   if( (size->width == roadmap_canvas_height())&&(pack_size.height>roadmap_canvas_height())){
			   ssd_widget_reset_cache(w);
			   pack_size.height = 0;
			   pack_size.width = 0;
			   size->width  = roadmap_canvas_width();
			   max_size_temp.maxx = roadmap_canvas_width() -1;
			   get_size(w,&pack_size, &max_size_temp);
		   }
	   }
   }




   if (size->height< 0) size->height = pack_size.height;
   if (size->width < 0) size->width  = pack_size.width;

   w->cached_size = *size;
}
Пример #11
0
static void draw_dialog (SsdDialog dialog) {

   if (!dialog) {
      return;

   } else {
      RoadMapGuiRect rect;
      rect.minx = 0;
#ifndef TOUCH_SCREEN
      if (is_screen_wide())
         rect.miny = 1;
      else
         rect.miny = roadmap_bar_top_height()+1;
      rect.maxx = roadmap_canvas_width() -1;
#else
      rect.miny = 1;
      rect.maxx = roadmap_canvas_width() -1;
#endif

#ifdef TOUCH_SCREEN
      rect.maxy = roadmap_canvas_height() - 1;
#else
      rect.maxy = roadmap_canvas_height() - 1 - roadmap_bar_bottom_height() ;
#endif

      ssd_widget_reset_cache (dialog->container);
      ssd_widget_draw (dialog->container, &rect, 0);

      if ((dialog->container->flags & SSD_CONTAINER_TITLE) && (dialog->scroll_container != NULL) && (dialog->scroll_container->offset_y < 0)){
         SsdWidget title;
         SsdSize size;
         title = ssd_widget_get (dialog->container, "title_bar");
         ssd_widget_get_size(title, &size, NULL);
#ifndef TOUCH_SCREEN
        if (!is_screen_wide()){
           rect.miny = roadmap_bar_top_height();
        }
        else{
           rect.miny = 0;
        }
#else
        rect.miny = 1;
#endif
        rect.maxy = rect.miny + size.height-1 ;
        title->draw(title, &rect, 0);
        rect.miny +=1;
        ssd_widget_draw(title->children, &rect, 0);
      }


#ifndef TOUCH_SCREEN
      roadmap_bar_draw_bottom_bar(TRUE);
      if ((dialog->container->flags & SSD_CONTAINER_TITLE) && (dialog->scroll_container != NULL) && (dialog->scroll_container->offset_y < 0))
        if (!is_screen_wide())
           roadmap_bar_draw_top_bar(TRUE);
#endif

      ssd_dialog_sort_tab_order( dialog);
      ssd_dialog_sort_tab_order_by_gui_position();
   }
}