예제 #1
0
static int roadmap_ticker_short_click(RoadMapGuiPoint *point) {
   static RoadMapSoundList list;

   if (!gInitialized) return 0 ;

   if (!gTickerOn)
      return 0;

#ifdef PLAY_CLICK
	if (!list) {
		list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
		roadmap_sound_list_add (list, "click");
		roadmap_res_get (RES_SOUND, 0, "click");
	}
#endif
    if (gTickerOn)
      if ((point->y >= (OpenIconRct.miny)) &&
        (point->y <= (OpenIconRct.maxy))) {
#ifdef PLAY_CLICK
			roadmap_sound_play_list (list);
#endif
			roadmap_ticker_hide();
            return 1;
        }

   return 0;

}
static int roadmap_screen_obj_long_click (RoadMapGuiPoint *point) {

   static RoadMapSoundList list;
   RoadMapScreenObj object = RoadMapScreenObjSelected;

   if (!RoadMapScreenObjSelected) {
      return 0;
   }

   if (RoadMapScreenObjSelected->flags & OBJ_FLAG_REPEAT) return 1;

   if (object->state_fn && (*object->state_fn)() < 0 ) return 0;

   RoadMapScreenObjSelected = NULL;

   if (!list) {
      list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
      roadmap_sound_list_add (list, "click_long");
      roadmap_res_get (RES_SOUND, 0, "click_long");
   }

   if (object->long_action) {
      roadmap_sound_play_list (list);
      (*(object->long_action->callback)) ();

   } else if (object->action) {
      roadmap_sound_play_list (list);
      (*(object->action->callback)) ();
   }

   return 1;
}
예제 #3
0
static int ssd_button_long_click (SsdWidget widget,
                                  const RoadMapGuiPoint *point) {
   struct ssd_button_data *data = (struct ssd_button_data *) widget->data;

   static RoadMapSoundList list;

   widget->force_click = FALSE;

#ifndef IPHONE
  if (!list) {
      list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
      roadmap_sound_list_add (list, "click_long");
      roadmap_res_get (RES_SOUND, 0, "click_long");
   }

   roadmap_sound_play_list (list);
#endif //IPHONE

   if (widget->callback) {
      (*widget->callback) (widget, SSD_BUTTON_LONG_CLICK);
   }

   data->state = BUTTON_STATE_NORMAL;

   return 1;
}
예제 #4
0
int roadmap_bar_long_click (RoadMapGuiPoint *point) {

	if ( !SelectedBarObject )
		return 0;

   if ( SelectedBarObject->action ) {
      static RoadMapSoundList list;

      SelectedBarObject->image_state = IMAGE_STATE_SELECTED;
   	  roadmap_screen_redraw();

      if (!list) {
         list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
         roadmap_sound_list_add (list, "click");
         roadmap_res_get (RES_SOUND, 0, "click");
      }

      roadmap_sound_play_list (list);

	  roadmap_screen_redraw();
      (*(SelectedBarObject->action->callback)) ();

      roadmap_screen_redraw();

      SelectedBarObject->image_state = IMAGE_STATE_NORMAL;
   }

   return 1;
}
예제 #5
0
int roadmap_bar_short_click (RoadMapGuiPoint *point) {
   
   BarObject *object = roadmap_bar_by_pos(point, &TopBarObjectTable);

   if (!object) {
   	  object = roadmap_bar_by_pos(point, &BottomBarObjectTable);
   	  if (!object)
      	return 0;
   }

   if (object->action) {
      static RoadMapSoundList list;
   
	  object->state = IMAGE_STATE_NORMAL;
	  roadmap_screen_redraw();

      if (!list) {
         list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
         roadmap_sound_list_add (list, "click");
         roadmap_res_get (RES_SOUND, 0, "click");
      }

      roadmap_sound_play_list (list);
	  
	  roadmap_screen_redraw();
	  
      (*(object->action->callback)) ();
      
      roadmap_screen_redraw();
   }

   return 1;
}
예제 #6
0
BOOL tts_playlist_add( TtsPlayList list, const char* text )
{
   int result = -1;
   const TtsProvider* provider = NULL;

   if ( !tts_enabled() )
      return FALSE;

   if ( !text )
   {
      roadmap_log( ROADMAP_ERROR, TTS_LOG_STR( "Cannot add NULL texts to the playlist" ) );
      return FALSE;
   }

   provider = _voice_service_provider( list->voice_id );
   switch ( provider->storage_type )
   {
      case __tts_db_data_storage__file:
      {
         TtsPath path;
         const char* parsed_text = _parse_text( text );
         if ( tts_cache_get( parsed_text, list->voice_id, NULL, &path ) )
         {
            result = roadmap_sound_list_add( list->sound_list, path.path );
            roadmap_log( ROADMAP_DEBUG, TTS_LOG_STR( "Adding text %s (Voice: %s). Path: %s to the playlist. Status: %d" ),
                  parsed_text, list->voice_id, path.path, result );

            if ( result == SND_LIST_ERR_NO_FILE )
            {
               const TtsDbEntry* db_entry = tts_db_entry( list->voice_id, parsed_text, NULL );
               TtsTextType text_type = tts_db_text_type( db_entry );

               roadmap_log( ROADMAP_WARNING, TTS_LOG_STR( "File %s doesn't exist!!!. Removing the entry!" ), path.path );
               tts_cache_remove( parsed_text, list->voice_id, __tts_db_data_storage__file );
               // Post new request if matches the current voice
               if ( !list->voice_id || !strcmp( list->voice_id, sgTtsVoiceId ) )
               {
                  tts_request_ex( parsed_text, text_type, NULL, NULL, TTS_FLAG_NONE );
                  tts_commit(); // Commit immediately in this case
               }
            }
         }
         break;
      }
      case __tts_db_data_storage__blob_record:
      {
         TtsData data;
         if ( tts_cache_get( _parse_text( text ), list->voice_id, &data, NULL ) )
            result = roadmap_sound_list_add_buf( list->sound_list, data.data, data.data_size );
         break;
      }
      default:
      {
         roadmap_log( ROADMAP_WARNING, "Data storage type %d is not supported" );
      }
   }

   return ( result >= 0 );
}
예제 #7
0
int roadmap_bar_obj_released (RoadMapGuiPoint *point)
{
   BarObject *new_bar_object = NULL;
	// The release event causes the selected object in the press event to be unselected
   if ( SelectedBarObject )
	{
       SelectedBarObject->image_state = IMAGE_STATE_NORMAL;
       roadmap_pointer_unregister_drag_motion(roadmap_bar_drag_motion);

       if ( !gHideTopBar )
          new_bar_object = roadmap_bar_by_pos(point, &TopBarObjectTable);

       if (!new_bar_object) {
         if ( !gHideBottomBar )
            new_bar_object = roadmap_bar_by_pos(point, &BottomBarObjectTable);
            if (!new_bar_object){
               SelectedBarObject = NULL;
               roadmap_screen_redraw();
               return 0;
            }
       }
       if (new_bar_object != SelectedBarObject){
          SelectedBarObject = NULL;
          roadmap_screen_redraw();
          return 1;
       }

	   if ( SelectedBarObject->action )
	   {
	      static RoadMapSoundList list;

	      SelectedBarObject->image_state = IMAGE_STATE_SELECTED;
	      roadmap_screen_redraw();

#ifdef PLAY_CLICK
	      if (!list) {
	         list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
	         roadmap_sound_list_add (list, "click");
	         roadmap_res_get (RES_SOUND, 0, "click");
	      }

	      roadmap_sound_play_list (list);
#endif

	      roadmap_screen_redraw();

	      (*(SelectedBarObject->action->callback)) ();

	      roadmap_screen_redraw();

	      SelectedBarObject->image_state = IMAGE_STATE_NORMAL;

	   }
	}
   SelectedBarObject = NULL;
   roadmap_screen_redraw();
   return 1;
}
예제 #8
0
static void Play_Animation_Sound (void) {
   static RoadMapSoundList list;
   if (!list) {
      list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
      roadmap_sound_list_add (list, ANIMATION_SOUND);
      roadmap_res_get (RES_SOUND, 0, ANIMATION_SOUND);
   }
   roadmap_sound_play_list (list);
}
예제 #9
0
static void play_remider_sound(void){
   static RoadMapSoundList list;
   if (!list) {
      list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
      roadmap_sound_list_add (list, REMINDER_SOUND);
      roadmap_res_get (RES_SOUND, 0, REMINDER_SOUND);
   }
   roadmap_sound_play_list (list);
}
예제 #10
0
static int short_click (SsdWidget widget, const RoadMapGuiPoint *point) {

	widget->force_click = FALSE;

   if (widget->callback) {
#ifdef PLAY_CLICK
      RoadMapSoundList list = roadmap_sound_list_create (0);
      if (roadmap_sound_list_add (list, "click") != -1) {
         roadmap_sound_play_list (list);
      }
#endif //IPHONE
      (*widget->callback) (widget, SSD_BUTTON_SHORT_CLICK);
      return 1;
   }

   return 0;
}
예제 #11
0
static int ssd_button_short_click (SsdWidget widget,
                                   const RoadMapGuiPoint *point) {
   struct ssd_button_data *data = (struct ssd_button_data *) widget->data;

   static RoadMapSoundList list;

   if (data->state == BUTTON_STATE_DISABLED)
      return 1;

   widget->force_click = FALSE;

#ifdef PLAY_CLICK
	if (!list) {
      list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
      roadmap_sound_list_add (list, "click");
      roadmap_res_get (RES_SOUND, 0, "click");
   }

   roadmap_sound_play_list (list);
#endif //IPHONE

#ifdef TOUCH_SCREEN
	if (widget->callback == NULL){
		data->state = BUTTON_STATE_NORMAL;
		roadmap_screen_redraw ();
		return 0;
	}
	else{
		delayed_widget = widget;
		widget->in_focus = TRUE;
		data->state = BUTTON_STATE_SELECTED;
  	    roadmap_main_set_periodic (100, button_callback);
  	    return 1;
	}
#else
   if (widget->callback) {
      (*widget->callback) ( widget, SSD_BUTTON_SHORT_CLICK );
      return 1;
   }

	data->state = BUTTON_STATE_NORMAL;
	roadmap_screen_redraw ();
#endif

   return 0;
}
예제 #12
0
void RealTimeBonus_SegmentChangedCB (PluginLine *current, int direction){

   int line_length;
   RoadMapPosition      pos;

   line_length  = roadmap_line_length(current->line_id);
   if (line_length < 75)
      return;

   roadmap_square_set_current(current->square);

   if (direction == ROUTE_DIRECTION_WITH_LINE){
      roadmap_street_extend_line_ends(current, NULL, &pos, FLAG_EXTEND_TO, NULL, NULL);
   }
   else{
      roadmap_street_extend_line_ends(current, &pos, NULL, FLAG_EXTEND_FROM, NULL, NULL);
   }

   if (g_CustomIndex == -1)
      return;

   if (gBonusTable.bonus[g_CustomIndex] == NULL)
      return;

   printf("CustomBonusCB %s",gBonusTable.bonus[g_CustomIndex]->pIconName);
   gBonusTable.bonus[g_CustomIndex]->position.latitude = pos.latitude;
   gBonusTable.bonus[g_CustomIndex]->position.longitude = pos.longitude;
   //Adding the custom bonus
   if (roadmap_map_settings_road_goodies()){
      static RoadMapSoundList list;
      if (!list) {
         list = roadmap_sound_list_create (SOUND_LIST_NO_FREE);
         roadmap_sound_list_add (list, "ping2");
         roadmap_res_get (RES_SOUND, 0, "ping2");
      }
      roadmap_sound_play_list (list);

      AddBonusToMap(gBonusTable.bonus[g_CustomIndex], TRUE);
   }

   g_CustomIndex = -1;
   roadmap_navigate_unregister_segment_changed(RealTimeBonus_SegmentChangedCB);

}