eOSState cMenuFileBrowserBase::PlayCurrent() { if(GetCurrentItem()) { return GetCurrentItem()->Play(this); } return osContinue; }
eOSState cMenuFileBrowserBase::OpenCurrentInfo() { if(GetCurrentItem()) { return GetCurrentItem()->OpenInfo(); } return osContinue; }
eOSState cMenuFileBrowserBase::UpdateCurrent(bool currentChanged) { if(GetCurrentItem()) { return GetCurrentItem()->Update(this, currentChanged); } return osContinue; }
eOSState cMenuFileBrowserBase::OpenCurrent(bool asPlaylistItem) { if(GetCurrentItem()) { return GetCurrentItem()->Open(this, asPlaylistItem); } return osContinue; }
//光标消息 BOOL CDlgSkinControl::OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT uMessage) { //获取光标 CPoint MousePoint; GetCursorPos(&MousePoint); ScreenToClient(&MousePoint); //设置选择 WORD wHoverItem=m_wHoverItem; m_wHoverItem=GetCurrentItem(MousePoint); m_wHoverColor=GetCurrentColor(MousePoint); //更新界面 if (m_wHoverItem!=wHoverItem) { RedrawWindow(NULL,NULL,RDW_FRAME|RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASENOW); } //设置光标 if ((m_wHoverItem!=INVALID_WORD)||(m_wHoverColor!=INVALID_WORD)) { SetCursor(LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_HAND_CUR))); return true; } return __super::OnSetCursor(pWnd,nHitTest,uMessage); }
bool List::Filter(bool reset) { std::string current = GetCurrentItem(); std::vector<std::string>* destination = filteredItems == &temp1 ? &temp2 : &temp1; destination->clear(); if (reset) filteredItems = &items; // reset filter for (std::vector<std::string>::const_iterator it = filteredItems->begin(); it != filteredItems->end(); ++it) { std::string lcitem(*it, 0, query.length()); StringToLowerInPlace(lcitem); if (lcitem == query) { if (*it == current) place = destination->size(); destination->push_back(*it); } } if (destination->empty()) { query = query.substr(0, query.length() - 1); return false; } else { filteredItems = destination; place = std::max(0, std::min(place, int(filteredItems->size()) - 1)); topIndex = 0; return true; } }
/*---------------------------------------------------------------------------*/ void wxSQLBook::OnDescribeClick(wxCommandEvent& event) { wxString item = GetCurrentItem(); if (!item.IsEmpty()) Describe(item); }
// RMI receiver in the server to remove all items from the inventory. changes are automatically propagated to the clients IMPLEMENT_RMI(CInventory, SvReq_RemoveAllItems) { IItemSystem* pItemSystem = CCryAction::GetCryAction()->GetIItemSystem(); IItem* pItem = pItemSystem->GetItem( GetCurrentItem() ); if (pItem) { pItem->Select(false); pItemSystem->SetActorItem( GetActor(), (EntityId)0, false ); } Destroy(); if (gEnv->bMultiplayer) { TRMIInventory_Dummy Info; GetGameObject()->InvokeRMI( Cl_RemoveAllAmmo(), Info, eRMI_ToAllClients); } else { ResetAmmo(); } return true; }
/** * \brief demuxer function for iTML parsing */ int Demux( demux_t *p_demux ) { xml_reader_t *p_xml_reader; char *psz_name = NULL; input_item_t *p_current_input = GetCurrentItem(p_demux); p_demux->p_sys->i_ntracks = 0; /* create new xml parser from stream */ p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s ); if( !p_xml_reader ) goto end; /* locating the root node */ do { if( xml_ReaderRead( p_xml_reader ) != 1 ) { msg_Err( p_demux, "can't read xml stream" ); goto end; } } while( xml_ReaderNodeType( p_xml_reader ) != XML_READER_STARTELEM ); /* checking root node name */ psz_name = xml_ReaderName( p_xml_reader ); if( !psz_name || strcmp( psz_name, "plist" ) ) { msg_Err( p_demux, "invalid root node name: %s", psz_name ); goto end; } input_item_node_t *p_subitems = input_item_node_Create( p_current_input ); xml_elem_hnd_t pl_elements[] = { {"dict", COMPLEX_CONTENT, {.cmplx = parse_plist_dict} } };
void cMenuFileBrowserBase::TagUntagCurrentItem() { cMenuBrowserItem *item = GetCurrentItem(); if (item && (item->IsFile() || item->IsDir())) { if(!IsTagged(GetCurrentItem())) { //select line TagItem(GetCurrentItem()); } else { //deselect line RemoveTag(GetCurrentItem()); } Display(); } }
void cMenuFileBrowserBase::MarkUnmarkCurrentItem() { cMenuBrowserItem *item = GetCurrentItem(); if (item && (item->IsFile() || item->IsDir())) { if(!IsMarked(GetCurrentItem())) { //select line MarkItem(GetCurrentItem()); } else { //deselect line RemoveMark(GetCurrentItem()); } Display(); } }
/* SelectItem() Imposta l'elemento come selezionato. Se la selezione riesce, imposta l'indice interno (a base 0) relativo alla riga corrente. */ int CListViewEx::SelectItem(int nItem) { // controlla l'indice if(nItem >= 0 && nItem < GetListCtrl().GetItemCount()) { LV_ITEM lvitem; if(GetCurrentItem() >= 0) { // elimina la selezione per la riga corrente memset(&lvitem,'\0',sizeof(LV_ITEM)); lvitem.mask = LVIF_STATE; lvitem.iItem = GetCurrentItem(); lvitem.iSubItem = 0; lvitem.state = 0; lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED; GetListCtrl().SetItemState(GetCurrentItem(),&lvitem); //if(GetListCtrl().SetItemState(GetCurrentItem(),&lvitem)) { // imposta come selezionata la riga specificata memset(&lvitem,'\0',sizeof(LV_ITEM)); lvitem.mask = LVIF_STATE; lvitem.iItem = nItem; lvitem.iSubItem = 0; lvitem.state = LVIS_FOCUSED | LVIS_SELECTED; lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED; if(GetListCtrl().SetItemState(nItem,&lvitem)) { // si assicura che la riga sia visibile ed aggiorna l'indice interno SetRedraw(FALSE); GetListCtrl().EnsureVisible(nItem,TRUE); SetRedraw(TRUE); SetCurrentItem(nItem); } } } } return(GetCurrentItem()); }
/* OnNext() */ void CWallBrowserFileView::OnNext(void) { if(GetListCtrl().GetItemCount() > 0) { int nItem = GetCurrentItem(); if(++nItem >= GetListCtrl().GetItemCount()) nItem = 0; OnSelectItem(nItem); } }
static int Demux( demux_t *p_demux ) { xml_reader_t *p_xml_reader = NULL; const char *node; int i_ret = -1; input_item_t *p_current_input = GetCurrentItem(p_demux); input_item_node_t *p_input_node = NULL; p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s ); if( !p_xml_reader ) goto error; /* check root node */ if( xml_ReaderNextNode( p_xml_reader, &node ) != XML_READER_STARTELEM ) { msg_Err( p_demux, "invalid file (no root node)" ); goto error; } if( strcmp( node, "genrelist" ) && strcmp( node, "stationlist" ) ) { msg_Err( p_demux, "invalid root node <%s>", node ); goto error; } p_input_node = input_item_node_Create( p_current_input ); if( !strcmp( node, "genrelist" ) ) { /* we're reading a genre list */ if( DemuxGenre( p_demux, p_xml_reader, p_input_node ) ) goto error; } else { /* we're reading a station list */ if( DemuxStation( p_demux, p_xml_reader, p_input_node, var_InheritBool( p_demux, "shoutcast-show-adult" ) ) ) goto error; } input_item_node_PostAndDelete( p_input_node ); p_input_node = NULL; i_ret = 0; /* Needed for correct operation of go back */ error: if( p_xml_reader ) xml_ReaderDelete( p_xml_reader ); if( p_input_node ) input_item_node_Delete( p_input_node ); vlc_gc_decref(p_current_input); return i_ret; }
/* OnPrevious() */ void CWallBrowserFileView::OnPrevious(void) { if(GetListCtrl().GetItemCount() > 0) { int nItem = GetCurrentItem(); if(--nItem < 0) nItem = GetListCtrl().GetItemCount()-1; OnSelectItem(nItem); } }
/* SelectItem() Imposta l'elemento come selezionato. Se la selezione riesce, imposta l'indice interno relativo alla riga corrente. int nItem indice (base 0) dell'elemento */ int CListCtrlEx::SelectItem(int nItem) { // riga corrente int iCurrentItem = GetCurrentItem(); // controlla l'indice if(nItem >=0 && nItem < CListCtrl::GetItemCount()) { /* M$VC 6.0 POSITION position; position = GetFirstSelectedItemPosition(); while(position) iCurrentItem = GetNextSelectedItem(position); */ LV_ITEM lvitem; // ricava la riga selezionata if((iCurrentItem = CListCtrl::GetNextItem(0,LVNI_ALL|LVNI_FOCUSED|LVNI_SELECTED)) < 0) iCurrentItem = 0; if(iCurrentItem >= 0) { // elimina la selezione per la riga corrente memset(&lvitem,'\0',sizeof(LV_ITEM)); lvitem.mask = LVIF_STATE; lvitem.iItem = iCurrentItem; lvitem.iSubItem = 0; lvitem.state = 0; lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED ; if(CListCtrl::SetItemState(iCurrentItem,&lvitem)) { // imposta come selezionata la riga specificata memset(&lvitem,'\0',sizeof(LV_ITEM)); lvitem.mask = LVIF_STATE; lvitem.iItem = nItem; lvitem.iSubItem = 0; lvitem.state = LVIS_FOCUSED | LVIS_SELECTED; lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED; if(CListCtrl::SetItemState(nItem,&lvitem)) { // si assicura che la riga sia visibile ed aggiorna l'indice interno SetRedraw(FALSE); CListCtrl::EnsureVisible(nItem,FALSE); SetRedraw(TRUE); SetCurrentItem(nItem); } } } } return(iCurrentItem); }
/** * \brief demuxer function for XSPF parsing */ int Demux( demux_t *p_demux ) { int i_ret = -1; xml_reader_t *p_xml_reader = NULL; const char *name = NULL; input_item_t *p_current_input = GetCurrentItem(p_demux); p_demux->p_sys->pp_tracklist = NULL; p_demux->p_sys->i_tracklist_entries = 0; p_demux->p_sys->i_track_id = -1; p_demux->p_sys->psz_base = NULL; /* create new xml parser from stream */ p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s ); if( !p_xml_reader ) goto end; /* locating the root node */ if( xml_ReaderNextNode( p_xml_reader, &name ) != XML_READER_STARTELEM ) { msg_Err( p_demux, "can't read xml stream" ); goto end; } /* checking root node name */ if( strcmp( name, "playlist" ) ) { msg_Err( p_demux, "invalid root node name <%s>", name ); goto end; } input_item_node_t *p_subitems = input_item_node_Create( p_current_input ); i_ret = parse_playlist_node( p_demux, p_subitems, p_xml_reader, "playlist" ) ? 0 : -1; for( int i = 0 ; i < p_demux->p_sys->i_tracklist_entries ; i++ ) { input_item_t *p_new_input = p_demux->p_sys->pp_tracklist[i]; if( p_new_input ) { input_item_node_AppendItem( p_subitems, p_new_input ); } } input_item_node_PostAndDelete( p_subitems ); end: vlc_gc_decref(p_current_input); if( p_xml_reader ) xml_ReaderDelete( p_xml_reader ); return i_ret; /* Needed for correct operation of go back */ }
static int Demux( demux_t *p_demux ) { char *psz_line; input_item_t *p_current_input = GetCurrentItem(p_demux); input_item_node_t *p_subitems = input_item_node_Create( p_current_input ); while( (psz_line = stream_ReadLine( p_demux->s )) ) { char *psz_parse = psz_line; /* Skip leading tabs and spaces */ while( *psz_parse == ' ' || *psz_parse == '\t' || *psz_parse == '\n' || *psz_parse == '\r' ) psz_parse++; /* if the line is the uri of the media item */ if( !strncasecmp( psz_parse, "<media src=\"", strlen( "<media src=\"" ) ) ) { char *psz_uri = psz_parse + strlen( "<media src=\"" ); psz_parse = strchr( psz_uri, '"' ); if( psz_parse != NULL ) { *psz_parse = '\0'; resolve_xml_special_chars( psz_uri ); psz_uri = ProcessMRL( psz_uri, p_demux->p_sys->psz_prefix ); if( psz_uri != NULL ) { input_item_t *p_input; p_input = input_item_NewExt( psz_uri, psz_uri, 0, NULL, 0, -1 ); input_item_node_AppendItem( p_subitems, p_input ); vlc_gc_decref( p_input ); free( psz_uri ); } } } /* Fetch another line */ free( psz_line ); } input_item_node_PostAndDelete( p_subitems ); vlc_gc_decref(p_current_input); var_Destroy( p_demux, "wpl-extvlcopt" ); return 0; /* Needed for correct operation of go back */ }
/** * \brief demuxer function for iTML parsing */ int Demux( demux_t *p_demux ) { xml_reader_t *p_xml_reader; const char *node; input_item_t *p_current_input = GetCurrentItem(p_demux); p_demux->p_sys->i_ntracks = 0; /* create new xml parser from stream */ p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s ); if( !p_xml_reader ) goto end; /* locating the root node */ int type; do { type = xml_ReaderNextNode( p_xml_reader, &node ); if( type <= 0 ) { msg_Err( p_demux, "can't read xml stream" ); goto end; } } while( type != XML_READER_STARTELEM ); /* checking root node name */ if( strcmp( node, "plist" ) ) { msg_Err( p_demux, "invalid root node <%s>", node ); goto end; } input_item_node_t *p_subitems = input_item_node_Create( p_current_input ); xml_elem_hnd_t pl_elements[] = // { {"dict", COMPLEX_CONTENT, {.cmplx = parse_plist_dict} } }; { {"dict", COMPLEX_CONTENT, {(bool (__cdecl *)(track_elem_t *,const char *,char *))parse_plist_dict} } }; // sunqueen modify parse_plist_node( p_demux, p_subitems, NULL, p_xml_reader, "plist", pl_elements ); input_item_node_PostAndDelete( p_subitems ); vlc_gc_decref(p_current_input); end: if( p_xml_reader ) xml_ReaderDelete( p_xml_reader ); /* Needed for correct operation of go back */ return 0; }
// Override the right control void CMenuDisplay::OnRight() { // Get the current resolution MenuDisplayResolution currentResolution=GetCurrentSelectedResolution(); CMenuBase::OnRight(); // If the renderer control is selected, rebuild the resolutions control if (GetCurrentItem() == m_pRendererCtrl) { SetupResolutionCtrl(); // Set the resolution for the control SetCurrentCtrlResolution(currentResolution); } }
void RoomConfigWidget::on_ModifyPerm__released () { QStandardItem *stdItem = GetCurrentItem (); if (!stdItem) return; QStandardItem *parent = stdItem->parent (); if (!Aff2Cat_.values ().contains (parent)) { qWarning () << Q_FUNC_INFO << "bad parent" << parent << "for" << stdItem; return; } const QXmppMucItem::Affiliation aff = Aff2Cat_.key (parent); const QString& jid = stdItem->text (); std::unique_ptr<AffiliationSelectorDialog> dia (new AffiliationSelectorDialog (this)); dia->SetJID (jid); dia->SetAffiliation (aff); dia->SetReason (stdItem->data (ItemRoles::Reason).toString ()); if (dia->exec () != QDialog::Accepted) return; const QString& newJid = dia->GetJID (); if (newJid.isEmpty ()) return; parent->removeRow (stdItem->row ()); QXmppMucItem item; item.setJid (newJid); item.setAffiliation (dia->GetAffiliation ()); item.setReason (dia->GetReason ()); SendItem (item); if (item.affiliation () != QXmppMucItem::NoAffiliation) handlePermsReceived ({ item }); }
/***************************************************************************** * Demux: The important stuff *****************************************************************************/ static int Demux( demux_t *p_demux ) { char *psz_line; input_item_t *p_input; input_item_t *p_current_input = GetCurrentItem(p_demux); input_item_node_t *p_subitems = input_item_node_Create( p_current_input ); while( (psz_line = stream_ReadLine( p_demux->s )) ) { char **ppsz_options = NULL; int i_options = 0; char *psz_name = NULL; if( !ParseLine( psz_line, &psz_name, &ppsz_options, &i_options ) ) { free( psz_line ); continue; } EnsureUTF8( psz_name ); for( int i = 0; i< i_options; i++ ) EnsureUTF8( ppsz_options[i] ); p_input = input_item_NewExt( "dvb://", psz_name, i_options, (const char**)ppsz_options, VLC_INPUT_OPTION_TRUSTED, -1 ); input_item_node_AppendItem( p_subitems, p_input ); vlc_gc_decref( p_input ); while( i_options-- ) free( ppsz_options[i_options] ); free( ppsz_options ); free( psz_line ); } input_item_node_PostAndDelete( p_subitems ); vlc_gc_decref(p_current_input); return 0; /* Needed for correct operation of go back */ }
/* OnDeleteItem() */ int CWallBrowserFileView::OnDeleteItem(void) { // ricava l'elemento corrente int nItem = GetCurrentItem(); // controlla che sia valido if(nItem >= 0 && nItem < GetListCtrl().GetItemCount()) { // LV_ITEM lvitem = {0}; lvitem.mask = LVIF_PARAM; lvitem.iItem = nItem; lvitem.iSubItem = 0; GetListCtrl().GetItem(&lvitem); ITEMINFO* pItem = (ITEMINFO*)lvitem.lParam; if(pItem) delete pItem; // lo elimina dalla lista GetListCtrl().DeleteItem(nItem); // imposta il nuovo elemento corrente if(nItem >= GetListCtrl().GetItemCount()) nItem--; if(nItem < 0) nItem = 0; nItem = SelectItem(nItem); CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument(); if(pDoc) { memset(m_szFileName,'\0',sizeof(m_szFileName)); pDoc->SetPictureFlag(FALSE); pDoc->ResetFileName(); TRACE("%s(%d): sending ONUPDATE_FLAG_FILEDELETED\n",__FILE__,__LINE__); pDoc->UpdateAllViews(NULL,ONUPDATE_FLAG_FILEDELETED); } } return(nItem); }
// RMI receiver in the server to remove an item from the inventory. change is automatically propagated to the clients IMPLEMENT_RMI(CInventory, SvReq_RemoveItem) { TRMIInventory_Item Info(params); IItemSystem* pItemSystem = CCryAction::GetCryAction()->GetIItemSystem(); IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass( Info.m_ItemClass.c_str()); if (pClass) { IItem* pItem = pItemSystem->GetItem( GetItemByClass( pClass ) ); if (pItem && pItem->GetEntityId()==GetCurrentItem()) { pItem->Select(false); pItemSystem->SetActorItem( GetActor(), (EntityId)0, false ); } if (pItem) gEnv->pEntitySystem->RemoveEntity( pItem->GetEntityId() ); } return true; }
/** Parses the whole channels.conf file */ static int Demux(demux_t *demux) { input_item_t *input = GetCurrentItem(demux); input_item_node_t *subitems = input_item_node_Create(input); char *line; while ((line = stream_ReadLine(demux->s)) != NULL) { input_item_t *item = ParseLine(line); if (item == NULL) continue; input_item_node_AppendItem(subitems, item); vlc_gc_decref(item); } input_item_node_PostAndDelete(subitems); vlc_gc_decref(input); return 0; /* Needed for correct operation of go back */ }
static int Demux( demux_t *p_demux ) { char *psz_url, *psz_dir; psz_dir = strrchr( p_demux->psz_location, '/' ); if( psz_dir != NULL ) psz_dir[1] = '\0'; if( asprintf( &psz_url, "dvd://%s", p_demux->psz_location ) == -1 ) return 0; input_item_t *p_current_input = GetCurrentItem(p_demux); input_item_t *p_input = input_item_New( psz_url, psz_url ); input_item_PostSubItem( p_current_input, p_input ); vlc_gc_decref( p_input ); vlc_gc_decref(p_current_input); free( psz_url ); return 0; /* Needed for correct operation of go back */ }
static int Demux( demux_t *p_demux ) { size_t len = strlen( "dvd://" ) + strlen( p_demux->psz_path ) - strlen( "VIDEO_TS.IFO" ); char *psz_url; psz_url = malloc( len+1 ); if( !psz_url ) return 0; snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path ); input_item_t *p_current_input = GetCurrentItem(p_demux); input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url ); input_item_PostSubItem( p_current_input, p_input ); vlc_gc_decref( p_input ); vlc_gc_decref(p_current_input); free( psz_url ); return 0; /* Needed for correct operation of go back */ }
void RoomConfigWidget::on_RemovePerm__released () { QStandardItem *stdItem = GetCurrentItem (); if (!stdItem) return; const QString& jid = stdItem->text (); if (jid.isEmpty ()) return; QStandardItem *parent = stdItem->parent (); if (!parent) return; parent->removeRow (stdItem->row ()); QXmppMucItem item; item.setJid (jid); item.setAffiliation (QXmppMucItem::NoAffiliation); SendItem (item); }
static int DemuxDVD_VR( demux_t *p_demux ) { char *psz_url = strdup( p_demux->psz_path ); if( !psz_url ) return 0; size_t len = strlen( psz_url ); strncpy( psz_url + len - 12, "VR_MOVIE.VRO", 12 ); input_item_t *p_current_input = GetCurrentItem(p_demux); input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url ); input_item_PostSubItem( p_current_input, p_input ); vlc_gc_decref( p_input ); vlc_gc_decref(p_current_input); free( psz_url ); return 0; /* Needed for correct operation of go back */ }
static int Demux( demux_t* p_demux ) { const char* psz_name; int i_type; demux_sys_t* p_sys = p_demux->p_sys; input_item_t* p_input = GetCurrentItem( p_demux ); input_item_node_t* p_node = input_item_node_Create( p_input ); p_sys->psz_prefix = FindPrefix( p_demux ); do { i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_name ); if ( i_type == XML_READER_STARTELEM && !strcasecmp( psz_name, "head" ) ) read_head( p_demux, p_input ); else if ( i_type == XML_READER_STARTELEM && !strcasecmp( psz_name, "body" ) ) read_body( p_demux, p_node ); } while (i_type != XML_READER_ENDELEM || strcasecmp( psz_name, "smil" ) ); input_item_node_PostAndDelete( p_node ); input_item_Release( p_input ); return 0; }