Beispiel #1
0
void roadmap_softkeys_remove_right_soft_key(const char *name){
	remove_softkey(name, right_soft_key);
#ifdef RIMAPI
	roadmap_main_context_menu_reset(TRUE);
	roadmap_main_context_menu_set(2, roadmap_softkeys_get_right_soft_key_text(), roadmap_softkeys_right_softkey_callback);
#endif
}
Beispiel #2
0
static void remove_softkey (const char *name, SoftKeyEntry *table) {

   int i;
   BOOL found = FALSE;
   
   for (i=MAX_SOFTKEYS -1; i>=0; i--) {
   	  
      if (table[i].name && !strcmp(table[i].name, name)) {
      	found = TRUE;
      	break;
      }
   }

   if (!found) {
      roadmap_log (ROADMAP_DEBUG, "Can't find a softkey to remove. softkey: %s", name);
      return;
   }

   table[i].sk.callback = NULL;
   table[i].sk.text[0] = 0;
   if (table[i].name)
      free(table[i].name);
   table[i].name = NULL;
   
   if ( (i!=MAX_SOFTKEYS-1) &&  (table[i+1].name) ){ // this is not the last soft key - the next one isn't null
   		SoftKeyEntry nextSKEntry; 
   		nextSKEntry.name = table[i+1].name;
   		nextSKEntry.sk = table[i+1].sk;
   		table[i].sk.callback = table[i+1].sk.callback; // so we need to copy all the next ones backward by one 
   		strcpy(table[i].sk.text,table[i+1].sk.text);
   		table[i].name = strdup(table[i+1].name);
   		remove_softkey(nextSKEntry.name,table); // recursive function
   }
}
Beispiel #3
0
// Draw the warning on the screen
void roadmap_alerter_display(void) {
    const char * iconName;
    int 	alertId;
    char AlertStr[200];
    RoadMapGuiPoint AlertIconLocation;
    int opacity;
    char distance_str[100];
//	RoadMapGpsPosition pos;
    RoadMapImage theIcon;
    BOOL is_cancelable;

    AlertStr[0] = 0;

    if (alert_should_be_visible) {


        if (!alert_active && the_active_alert.alert_type == ALERT) {

            roadmap_alerter_audio();
        }

        alertId = roadmap_alerter_get_active_alert_id();
        is_cancelable = (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->is_cancelable)) (alertId);
        if (!alert_active && is_cancelable)
            set_softkey();

//		alert_active = TRUE;
//
//		if (the_active_alert.alert_type == ALERT){
//				iconName =  (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_alert_icon)) (alertId);
//		}
//		else {
//				iconName =  (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_warning_icon)) (alertId);
//		}
//
//        snprintf(AlertStr + strlen(AlertStr), sizeof(AlertStr)
//                - strlen(AlertStr), "<b1>%s%s\n",roadmap_lang_get("Approaching"), roadmap_lang_get((* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_string)) (alertId) ));
//
//        snprintf(AlertStr + strlen(AlertStr), sizeof(AlertStr)
//                - strlen(AlertStr), roadmap_lang_get("%s: %d %s\n"),roadmap_lang_get("In"), the_active_alert.distance_to_alert, roadmap_lang_get(roadmap_math_distance_unit()));
//
// 		roadmap_navigate_get_current (&pos, NULL, NULL);
//        snprintf(AlertStr + strlen(AlertStr), sizeof(AlertStr)
//                - strlen(AlertStr), roadmap_lang_get("%d %s"),roadmap_math_to_speed_unit(pos.speed), roadmap_lang_get(roadmap_math_speed_unit()));
//
//	    roadmap_display_pop_up("Approach Alert", iconName , NULL, AlertStr);

        alertId = roadmap_alerter_get_active_alert_id();

        if (the_active_alert.alert_type == ALERT) {
            iconName =  (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_alert_icon)) (alertId);
            if (iconName == NULL) {
                return;
            }
            theIcon = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, iconName );
            if (theIcon == NULL) {
                roadmap_log( ROADMAP_ERROR, "Alerts - Icon Not found (%s)", iconName);
                return;
            }
            alert_active = TRUE;
        }
        else {
            iconName =  (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_warning_icon)) (alertId);
            theIcon = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, iconName);
            if (theIcon == NULL) {
                roadmap_log( ROADMAP_ERROR, "Alerts - Icon Not found (%s)", iconName);
                return;
            }
            alert_active = TRUE;
        }

        AlertIconLocation.x = roadmap_canvas_width () - roadmap_canvas_image_width(theIcon);
        AlertIconLocation.y = roadmap_canvas_height ()/2 - roadmap_canvas_image_height(theIcon)/2 ;
        opacity = 0;

        sprintf(distance_str, "%d %s",  the_active_alert.distance_to_alert, roadmap_math_distance_unit());
        roadmap_display_text("Distance To Alert", distance_str);
        roadmap_canvas_draw_image (theIcon, &AlertIconLocation,opacity, IMAGE_NORMAL);


    } else {
        if (alert_active && !alert_should_be_visible) {
            alert_active = FALSE;
            if ((* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->is_cancelable)) (roadmap_alerter_get_active_alert_id()))
                remove_softkey();
            the_active_alert.active_alert_id = -1;
            roadmap_display_hide("Distance To Alert");
        }
    }
}