Exemplo n.º 1
0
void update_alert(){
   SsdWidget text, bitmap;
   char TextStr[200];
   const char * iconName;
   const char *alert_text;
   int alertId = roadmap_alerter_get_active_alert_id();
   roadmap_square_set_current(the_active_alert.square);
   text = ssd_widget_get(dialog, "Alert Title");
   alert_text = (*(RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_string)) (alertId) ;
   if (!alert_text)
      return;
   sprintf(TextStr, "%s",roadmap_lang_get(alert_text));
   ssd_text_set_text(text, TextStr);

   text = ssd_widget_get(dialog, "Distance");
   sprintf(TextStr,"%s: %d %s", roadmap_lang_get("In"), the_active_alert.distance_to_alert, roadmap_lang_get(roadmap_math_distance_unit()));
   ssd_text_set_text(text, TextStr);

   bitmap = ssd_widget_get(dialog, "alert_Icon");
   if (the_active_alert.alert_type == ALERT){
      iconName =  (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_alert_icon)) (alertId);
   }
   else {
      iconName =  (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_warning_icon)) (alertId);
   }
   ssd_bitmap_update(bitmap, iconName);
}
Exemplo n.º 2
0
// Draw the warning on the screen
void roadmap_alerter_display(void){
   if (alert_should_be_visible) {
      if (the_active_alert.active_alert_id == -1){
         return;
      }
      if ((!alert_active) || (prev_alert.active_alert_id != the_active_alert.active_alert_id)){
         if (alert_active)
            hide_alert_dialog();
         kill_timer();
         prev_alert.active_alert_id = the_active_alert.active_alert_id;
         show_alert_dialog();
         if (the_active_alert.alert_type == ALERT)
            roadmap_alerter_audio();
         alert_active = TRUE;
      }
      else{
         update_alert();
      }
   } else {
      if (alert_active && !alert_should_be_visible) {
         if (AlerterTimerCallback == NULL){
            SsdWidget text = ssd_widget_get(dialog, "Distance");
            ssd_text_set_text(text, " ");
            g_seconds = 5;
            AlerterTimerCallback = hide_alert_timeout;
            roadmap_main_set_periodic (1000, AlerterTimerCallback);
         }
      }
   }
}
Exemplo n.º 3
0
BOOL address_search_auto_nav( const char* address)
{
   SsdWidget edit    = NULL;

   address_search_dlg_show_auto( on_auto_search_completed, (void*)address);
   
   edit  = generic_search_dlg_get_search_edit_box(search_address);
   
   ssd_text_set_text( edit, address);
   s_auto_start_nav = TRUE;
   on_search();
   
   return TRUE;
}
Exemplo n.º 4
0
void navigate_res_update_ETA_widget(SsdWidget container, int iRouteDistance, int iRouteLenght, const char *via, BOOL showDistance){
   SsdWidget text;
   timeStruct ETA_struct;
   timeStruct curTime ;
   timeStruct timeToDest;
   int distance_to_destination_far;
   char str[100];
   char unit_str[20];
   char msg[250];
   
   curTime = navigate_main_get_current_time(); 
   
   timeToDest.hours = iRouteLenght / 3600;
   timeToDest.minutes =  (iRouteLenght % 3600) / 60;
   timeToDest.seconds = iRouteLenght % 60;
   ETA_struct = navigate_main_calculate_eta(curTime,timeToDest);

   navigate_main_get_distance_str(iRouteDistance, &str[0], sizeof(str), &unit_str[0], sizeof(unit_str));
   
   snprintf(msg, sizeof(msg), "%d",   (int)(iRouteLenght/60.0));
   text = ssd_widget_get (container, "ETA_W_Minutes_Text");
   ssd_text_set_text(text, msg);

   msg[0] = 0;
   snprintf(msg + strlen(msg), sizeof(msg) - strlen(msg),
                    "%s",roadmap_lang_get("ETA"));
   text = ssd_widget_get (container, "ETA_Text");
   ssd_text_set_text(text, msg);

   msg[0] = 0;
   snprintf(msg + strlen(msg), sizeof(msg) - strlen(msg),
                    "%d:%02d",
                     ETA_struct.hours, ETA_struct.minutes);
   text = ssd_widget_get (container, "ETA_W_ETA_TIME_Text");
   ssd_text_set_text(text, msg);

 

   if (showDistance){
      text = ssd_widget_get (container, "ETA_W_Distance_Text");
      ssd_text_set_text(text, str);

      text = ssd_widget_get (container, "ETA_W_Distance_Unit_Text");
      ssd_text_set_text(text, unit_str);
   }

   // VIA Text
   if (via && (via[0] != 0)){
      msg[0] = 0;
      snprintf (msg, sizeof (msg), "%s: %s",
                   roadmap_lang_get("Via"),
                   roadmap_lang_get (via));
      text = ssd_widget_get (container, "ETA_W_VIA_Text");
      ssd_text_set_text(text, msg);
   }
}
BOOL address_search_auto_search( const char* address)
{
   SsdWidget edit    = NULL;

//   if( s_cb || s_ctx)
//   {
//      assert(0);  // Dialog is in use now
//      return FALSE;
//   }

   address_search_dlg_show( on_auto_search_completed, (void*)address);

   edit  = generic_search_dlg_get_search_edit_box(search_address);

   ssd_text_set_text( edit, address);
   on_search();

   return TRUE;
}
Exemplo n.º 6
0
void ssd_dialog_change_text(const char *name, const char *value){
   SsdWidget text = ssd_widget_get(RoadMapDialogCurrent->container, name);
   if (text)
      ssd_text_set_text(text, value);
}