void GMSourceView::init() { loadSettings("window"); clear(); listsources(); FXString key = getApp()->reg().readStringEntry("window","source-list-current",""); if (!key.empty()){ FXTreeItem * item = sourcelist->getFirstItem(); while(item) { GMSource * src = (GMSource*)item->getData(); if (src->settingKey()==key) { sourcelist->setCurrentItem(item); break; } item=item->getNext(); } } if (sourcelist->getCurrentItem()==NULL && sourcelist->getFirstItem()) sourcelist->setCurrentItem(sourcelist->getFirstItem()); source=(GMSource*)sourcelist->getItemData(sourcelist->getCurrentItem()); GMPlayerManager::instance()->getTrackView()->init(source); }
void DirectoryView::change_directory(FXTreeItem* item) { iconlist->clearItems(); for(FXTreeItem* it = item->getFirst(); it != NULL; it = it->getNext()) { DreamfallFileEntry* entry = static_cast<DreamfallFileEntry*>(it->getData()); FXIcon* big; FXIcon* small; int size; const char* typestr = "DIRECTORY"; const char* pak = ""; switch(entry->get_type()) { case DreamfallFileEntry::DIRECTORY_FILE_ENTRY: big = Icon::large_folder; small = Icon::folder_closed; size = it->getNumChildren(); typestr = "Directory"; break; case DreamfallFileEntry::PAK_FILE_ENTRY: big = (entry->get_pak().type == FILETYPE_SHARK3D)?Icon::large_file:Icon::large_shark; small = Icon::unknown_document; size = entry->get_pak().filesize; typestr = filetype2string(entry->get_pak().type); pak = entry->get_pak().pakfile.c_str(); break; break; default: big = Icon::large_file; small = Icon::unknown_document; size = 0; //entry->filesize; break; } iconlist->appendItem(FXString().format("%s\t%s\t%dKB\t%s", entry->get_label().c_str(), typestr, size/1024, pak), big, small, it); } iconlist->setSortFunc(iconlist_sorter); iconlist->sortItems(); }
void GMSourceView::updateSource(GMSource * src){ FXTreeItem * item = sourcelist->getFirstItem(); while(item) { if (item->getData()==src) { item->setText(tr(src->getName().text())); break; } item=item->getNext(); } resort(); }
void GMSourceView::setSource(GMSource * src,FXbool makecurrent/*=true*/){ if (src!=source) { source=src; if (makecurrent) { FXTreeItem * item = sourcelist->getFirstItem(); while(item) { if (item->getData()==src) { sourcelist->setCurrentItem(item,false); break; } item=item->getNext(); } } GMPlayerManager::instance()->getTrackView()->setSource(source); } }