static int vlclua_input_add_subtitle( lua_State *L ) { input_thread_t *p_input = vlclua_get_input_internal( L ); if( !p_input ) return luaL_error( L, "can't add subtitle: no current input" ); if( !lua_isstring( L, 1 ) ) return luaL_error( L, "vlc.input.add_subtitle() usage: (path)" ); const char *psz_path = luaL_checkstring( L, 1 ); input_AddSubtitle( p_input, psz_path, false ); vlc_object_release( p_input ); return 1; }
void TopWindow::processEvent( EvtDragDrop &rEvtDragDrop ) { // Get the control hit by the mouse int xPos = rEvtDragDrop.getXPos() - getLeft(); int yPos = rEvtDragDrop.getYPos() - getTop(); CtrlGeneric *pHitControl = findHitControl( xPos, yPos ); if( pHitControl && pHitControl->getType() == "tree" ) { // Send a dragDrop event EvtDragDrop evt( getIntf(), xPos, yPos, rEvtDragDrop.getFiles() ); pHitControl->handleEvent( evt ); } else { input_thread_t *pInput = getIntf()->p_sys->p_input; bool is_subtitle = false; list<string> files = rEvtDragDrop.getFiles(); if( files.size() == 1 && pInput != NULL ) { list<string>::const_iterator it = files.begin(); char* psz_file = make_path( it->c_str() ); if( psz_file ) { is_subtitle = !input_AddSubtitle( pInput, psz_file, true ); free( psz_file ); } } if( !is_subtitle ) { list<string>::const_iterator it = files.begin(); for( bool first = true; it != files.end(); ++it, first = false ) { bool playOnDrop = m_playOnDrop && first; CmdAddItem( getIntf(), it->c_str(), playOnDrop ).execute(); } } } m_pDragControl = NULL; }