Пример #1
0
void roadmap_foursquare_login_dialog(void) {
   const char *pVal;

   if (!ssd_dialog_activate(FOURSQUARE_LOGIN_DIALOG_NAME, NULL)) {
      create_login_dialog();
      ssd_dialog_activate(FOURSQUARE_LOGIN_DIALOG_NAME, NULL);
   }

   if (roadmap_foursquare_logged_in())
      ssd_dialog_set_value("Login Status Label", roadmap_lang_get("Status: logged in"));
   else
      ssd_dialog_set_value("Login Status Label", roadmap_lang_get("Status: not logged in"));

   ssd_dialog_set_value("FoursquareUserName", roadmap_foursquare_get_username());
   ssd_dialog_set_value("FoursquarePassword", roadmap_foursquare_get_password());

   if (roadmap_foursquare_is_tweet_login_enabled())
      pVal = yesno[0];
   else
      pVal = yesno[1];
   ssd_dialog_set_data("FoursquareSendLogin", (void *) pVal);

   if (roadmap_foursquare_is_tweet_badge_enabled())
      pVal = yesno[0];
   else
      pVal = yesno[1];
   ssd_dialog_set_data("FoursquareSendBadgeUnlock", (void *) pVal);
}
static int list_callback (SsdWidget widget, const char *new_value, const void *value, void *context) {

   RoadMapAddressSearch *search = (RoadMapAddressSearch *)context;

   if ((strlen(new_value) > 3) &&
       !strcmp(new_value + strlen(new_value) - 3, " - ")) {

       char str[255];

       ssd_generic_list_dialog_hide ();

       strcpy(str, new_value);
       str[strlen(str) - 2] = '\0';

       ssd_dialog_set_value ("input", str);

       str[strlen(str) - 1] = '\0';
       search->prefix = strdup(str);

       return 1;
   }

   search->callback (new_value, search->data);
   free (search);

   ssd_generic_list_dialog_hide ();

   return 1;
}
Пример #3
0
void roadmap_foursquare_checkedin_dialog(void) {
   char text[256];

   roadmap_main_remove_periodic(roadmap_foursquare_checkedin_dialog);

   if (!ssd_dialog_activate(FOURSQUARE_CHECKEDIN_DIALOG_NAME, NULL)) {
      create_checkedin_dialog();
      ssd_dialog_activate(FOURSQUARE_CHECKEDIN_DIALOG_NAME, NULL);
   }

   ssd_dialog_set_value("Checkin message lablel", gsCheckInInfo.sCheckinMessage);
   ssd_dialog_set_value("Checkin address", gsCheckInInfo.sAddress);
   snprintf(text, sizeof(text), "%s %s", roadmap_lang_get("Points:"), gsCheckInInfo.sScorePoints);
   ssd_dialog_set_value("Checkin points", text);

   roadmap_screen_redraw();
}
static BOOL keyboard_callback(int         exit_code,
                              const char* value,
                              void*       context)
{
   RoadMapAddressSearch *search = (RoadMapAddressSearch *)context;

   const char *title;
   int count;
   int is_kb_ok = (dec_ok == exit_code);

   if (!search->city) {
      if (!*value && is_kb_ok) {
         search->callback ("", search->data);
         free (search);
         return TRUE;
      }
      title = roadmap_lang_get ("City");
   } else {
      title = roadmap_lang_get ("Street");
      if (search->prefix && !strcmp(search->prefix, value)) {
         ssd_dialog_set_value ("input", "");

         free (search->prefix);
         search->prefix = NULL;
         return TRUE;
      }
   }

   count = roadmap_address_search_count (is_kb_ok, value, search);

   if (*value && !count) return 0;
   if (!count) return 1;

   if ((count <= MAX_LIST_RESULTS) || is_kb_ok)
   {
      roadmap_address_search_populate (is_kb_ok, value, search);

#ifndef J2ME
      qsort (RoadMapAddressSearchNames, RoadMapAddressSearchCount,
             sizeof(RoadMapAddressSearchNames[0]), cmpstring);
#endif

      ssd_generic_list_dialog_show (title,
                     RoadMapAddressSearchCount,
                     (const char **)RoadMapAddressSearchNames,
                     NULL,
                     list_callback,
                     NULL,
                     search, SSD_GEN_LIST_ENTRY_HEIGHT );
   }


   return TRUE;
}
Пример #5
0
/***********************************************************
 *  Name        : ssd_progress_msg_dialog_set_text
 *
 *  Purpose     :  change the text of the progress dialog
 *
 *  Params		: [in] dlg_text - the text to be displayed in message
 *  			:
 *  			:
 *				:
 *  Returns 	: void
 */
void ssd_progress_msg_dialog_set_text( const char* dlg_text )
{

   if ( !gProgressMsgDlg  )
   {
       // Create the dialog. Return in case of failure
      if ( !( gProgressMsgDlg = ssd_progress_msg_dialog_new() ) )
         return;
   }

   ssd_dialog_set_value( SSD_PROGRESS_MSG_TEXT_FLD, dlg_text );

   ssd_dialog_draw();

}
Пример #6
0
/***********************************************************
 *  Name        : ssd_progress_msg_dialog_show
 *
 *  Purpose     :  Shows the dialog with the given name. Creates the new one if not exists
 *
 *  Params		: [in] dlg_text - the text to be displayed in message
 *  			:
 *				:
 *  Returns 	: void
 */
void ssd_progress_msg_dialog_show( const char* dlg_text )
{

	if ( !gProgressMsgDlg  )
	{
       // Create the dialog. Return in case of failure
	   if ( !( gProgressMsgDlg = ssd_progress_msg_dialog_new() ) )
		   return;
	}

	ssd_dialog_activate( SSD_PROGRESS_MSG_DLG_NAME, NULL );

	ssd_dialog_set_value( SSD_PROGRESS_MSG_TEXT_FLD, dlg_text );

	roadmap_screen_redraw();

}
Пример #7
0
/***********************************************************
 *  Name        : ssd_progress_msg_dialog_show
 *
 *  Purpose     :  Shows the dialog with the given name. Creates the new one if not exists
 *
 *  Params		: [in] dlg_text - the text to be displayed in message
 *  			:
 *				:
 *  Returns 	: void
 */
void ssd_progress_msg_dialog_show( const char* dlg_text )
{

	if ( !gProgressMsgDlg  )
	{
       // Create the dialog. Return in case of failure
	   if ( !( gProgressMsgDlg = ssd_progress_msg_dialog_new() ) )
		   return;
	}
#ifdef TOUCH_SCREEN
	ssd_widget_show(ssd_widget_get(gProgressMsgDlg, "Hide Button" ));
#endif
	ssd_dialog_activate( SSD_PROGRESS_MSG_DLG_NAME, NULL );

	ssd_dialog_set_value( SSD_PROGRESS_MSG_TEXT_FLD, dlg_text );

	ssd_dialog_draw();

}
Пример #8
0
static int fill_dialog(PluginLine *line, RoadMapPosition *pos,
                       int direction) {

   const char *street_name = NULL;
   const char *city_name = NULL;
   int fraddl;
   int toaddl;
   int fraddr;
   int toaddr;
   int left;
   int right;
   char str[100];

   if (line->plugin_id == EditorPluginID) {
#if 0
      EditorStreetProperties properties;

      if (editor_db_activate (line->fips) == -1) return -1;

      editor_street_get_properties (line->line_id, &properties);

      street_name = editor_street_get_street_name (&properties);

      city_name = editor_street_get_street_city
                        (&properties, ED_STREET_LEFT_SIDE);

      editor_street_get_street_range
         (&properties, ED_STREET_LEFT_SIDE, &fraddl, &toaddl);
      editor_street_get_street_range
         (&properties, ED_STREET_RIGHT_SIDE, &fraddr, &toaddr);
#endif
   } else {
      RoadMapStreetProperties properties;

      if (roadmap_locator_activate (line->fips) < 0) return -1;

      roadmap_street_get_properties (line->line_id, &properties);

      street_name = roadmap_street_get_street_name (&properties);

      city_name = roadmap_street_get_street_city
                        (&properties, ROADMAP_STREET_LEFT_SIDE);

      roadmap_street_get_street_range
         (&properties, ROADMAP_STREET_LEFT_SIDE, &fraddl, &toaddl);
      roadmap_street_get_street_range
         (&properties, ROADMAP_STREET_RIGHT_SIDE, &fraddr, &toaddr);
   }

   if (!city_name) city_name = "";

   get_estimated_range
         (line, pos, direction, fraddl, toaddl, fraddr, toaddr, &left, &right);
#ifndef SSD
   roadmap_dialog_set_data ("Update", STREET_PREFIX, street_name);

   roadmap_dialog_set_data ("Update", CITY_PREFIX, city_name);

   snprintf(str, sizeof(str), "%s:%d  %s:%d",
         roadmap_lang_get ("Left"), left,
         roadmap_lang_get ("Right"), right);

   roadmap_dialog_set_data ("Update", "Estimated", str);

   roadmap_dialog_set_data ("Update", UPDATE_LEFT, "");
   roadmap_dialog_set_data ("Update", UPDATE_RIGHT, "");
#else
   ssd_dialog_set_value (STREET_PREFIX, street_name);
   ssd_dialog_set_value (CITY_PREFIX, city_name);
   sprintf(str, "%d", left);
   ssd_dialog_set_value ("estimated_left", str);
   sprintf(str, "%d", right);
   ssd_dialog_set_value ("estimated_right", str);
   ssd_dialog_set_value (UPDATE_LEFT, "");
   ssd_dialog_set_value (UPDATE_RIGHT, "");
   ssd_dialog_draw ();
#endif
   return 0;
}
Пример #9
0
void editor_segments_properties (SelectedLine *lines, int lines_count) {

   char str[100];
   int total_length = 0;
   int total_time = 0;
   int i;
   DialogSelectedLines *selected_lines = malloc (sizeof(*selected_lines));

   selected_lines->lines = lines;
   selected_lines->count = lines_count;

   activate_dialog("Segment Properties", selected_lines);
   editor_segments_fill_dialog (lines, lines_count);

   /* Collect info data */
   for (i=0; i<selected_lines->count; i++) {
      int line_length;
      int time;

      SelectedLine *line = &selected_lines->lines[i];

      if (line->line.plugin_id == EditorPluginID) {

         line_length = editor_line_length (line->line.line_id);
         time = editor_line_get_cross_time (line->line.line_id, 1);
         
      } else  {
         LineRouteTime from_cross_time;
         LineRouteTime to_cross_time;

	      roadmap_square_set_current (line->line.square);
         line_length = roadmap_line_length (line->line.line_id);
         if (roadmap_line_speed_get_cross_times
               (line->line.line_id, &from_cross_time, &to_cross_time) == -1) {
            time = -1; //TODO get real speed
         } else {
            time = from_cross_time;
         }
      }

      if (time > 0) {
         total_time += time;
      } else {

         if ((total_time == 0) || (total_length == 0)) {
            total_time += (int)(1.0 *line_length / 10);
         } else {
            total_time +=
               (int)(1.0 * line_length / (total_length/total_time)) + 1;
         }
      }

      total_length += line_length;
   }

#ifdef SSD
   if (selected_lines->lines[0].line.plugin_id == ROADMAP_PLUGIN_ID) {
      int line = selected_lines->lines[0].line.line_id;
      int avg_speed = roadmap_line_speed_get_avg_speed (line, 0);
      int cur_speed = roadmap_line_speed_get_speed (line, 0);

      snprintf (str, sizeof(str), " : %d (%d)",
               roadmap_math_to_speed_unit(avg_speed), roadmap_math_to_speed_unit(cur_speed));
      ssd_dialog_set_value ("Speed", str);
   } else {
      ssd_dialog_set_value ("Speed", "");
   }
#endif   

   snprintf (str, sizeof(str), "  : %d %s",
            roadmap_math_distance_to_current(total_length), roadmap_lang_get(roadmap_math_distance_unit()));
#ifdef SSD
   ssd_dialog_set_value ("Length", str);
#else   
   roadmap_dialog_set_data ("Info", "Length", str);
#endif   

   snprintf (str, sizeof(str), "  : %d %s",
             total_time, roadmap_lang_get("seconds"));

#ifdef SSD
   ssd_dialog_set_value ("Time", str);
   ssd_dialog_draw ();
#else   
   roadmap_dialog_set_data ("Info", "Time", str);
#endif   
}
Пример #10
0
void editor_segments_fill_dialog (SelectedLine *lines, int lines_count) {

   char street_name[512];
   const char *street_type = "";
   const char *t2s = "";
   const char *city = "";
   int cfcc = ROADMAP_ROAD_LAST;
   int same_street = 1;
   int same_city = 1;
   int i;

   strcpy (street_name, "");
   for (i=0; i<lines_count; i++) {
      
      const char *this_name = "";
      const char *this_type = "";
      const char *this_t2s = "";
      const char *this_city = "";

      if (lines[i].line.plugin_id == EditorPluginID) {
         if (editor_db_activate (lines[i].line.fips) != -1) {

            int street_id = -1;
            
            editor_line_get_street (lines[i].line.line_id, &street_id);

            this_name = editor_street_get_street_fename (street_id);
            this_type = editor_street_get_street_fetype (street_id);
            this_t2s = editor_street_get_street_t2s (street_id);
            this_city = editor_street_get_street_city (street_id);
				//editor_line_get_direction (lines[i].line.line_id, &this_direction);
         }
      } else { 

         RoadMapStreetProperties properties;

         if (roadmap_locator_activate (lines[i].line.fips) < 0) {
            continue;
         }

         roadmap_square_set_current (lines[i].line.square);
         roadmap_street_get_properties (lines[i].line.line_id, &properties);
    
         this_name = roadmap_street_get_street_name (&properties);
         this_type = roadmap_street_get_street_fetype (&properties);
         this_t2s = roadmap_street_get_street_t2s (&properties);

         this_city = roadmap_street_get_street_city
               (&properties, ROADMAP_STREET_LEFT_SIDE);
/*
			if (!editor_override_line_get_direction (lines[0].line.line_id, &this_direction)) {

            this_direction =
               roadmap_line_route_get_direction
                  (lines[i].line.line_id, ROUTE_CAR_ALLOWED);
            roadmap_line_route_get_speed_limit
                  (lines[i].line.line_id,
                   &this_speed_limit, &this_speed_limit);
         }
*/         
      }

      if (same_street) {
         if (!strlen(street_type)) {
            street_type = this_type;
         }

         if (!strlen(t2s)) {
            t2s = this_t2s;
         }

         if (!strlen(street_name)) {
            strncpy_safe (street_name, this_name, 512);
         } else {
            if (strlen(this_name) && strcmp(this_name, street_name)) {
               strcpy (street_name, "");
               street_type = "";
               t2s = "";
               same_street = 0;
            }
         }
       }

      if (same_city) {
         if (!strlen(city)) {
            city = this_city;
         } else {
            if (strlen(this_city) && strcmp(this_city, city)) {
               same_city = 0;
               city = "";
            }
         }
      } 
      
      if (lines[i].line.cfcc < cfcc) {
         cfcc = lines[i].line.cfcc;
      }
   }

   if (same_city && !strlen(city)) {
      
      city = editor_segments_find_city
             (lines[0].line.line_id, lines[0].line.plugin_id, lines[0].line.square);
   }

#ifdef SSD
   ssd_dialog_set_data ("Road type", (void *) (long)(cfcc - ROADMAP_ROAD_FIRST));
   ssd_dialog_set_value ("Name", street_name);
   ssd_dialog_set_value ("Text to Speech", t2s);

   ssd_dialog_set_value ("City", city);

   def_values[0] = ssd_dialog_get_value ("City");

#else
   roadmap_dialog_set_data
      ("General", "Road type", (void *) (cfcc - ROADMAP_ROAD_FIRST));
   roadmap_dialog_set_data ("General", "Street type", street_type);
   roadmap_dialog_set_data ("General", "Name", street_name);
   roadmap_dialog_set_data ("General", "Text to Speech", t2s);

   roadmap_dialog_set_data ("General", "City", city);

#endif


}