Пример #1
0
long GMSourceView::onSourceTipText(FXObject*sender,FXSelector,void*ptr){
  FXint x,y; FXuint buttons;
  sourcelist->getCursorPosition(x,y,buttons);
  FXTreeItem * item = sourcelist->getItemAt(x,y);
  if (item && item->getData()) {
    GMSource * src = static_cast<GMSource*>(item->getData());
    return src->handle(sender,FXSEL(SEL_QUERY_TIP,0),ptr);
    }
  return 0;
  }
Пример #2
0
long GMSourceView::onCmdSourceSelected(FXObject*,FXSelector,void*){
  FXTreeItem * item = sourcelist->getCurrentItem();
  if (item) {
    setSource(static_cast<GMSource*>(item->getData()),false);
    }
  return 1;
  }
Пример #3
0
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 = static_cast<GMSource*>(item->getData());
      if (src->settingKey()==key) {
        sourcelist->setCurrentItem(item);
        break;
        }
      item=item->getBelow();
      }
    }

  if (sourcelist->getCurrentItem()==nullptr && sourcelist->getFirstItem())
    sourcelist->setCurrentItem(sourcelist->getFirstItem());

  source=static_cast<GMSource*>(sourcelist->getItemData(sourcelist->getCurrentItem()));
  GMPlayerManager::instance()->getTrackView()->init(source);
  }
Пример #4
0
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();
}
Пример #5
0
void GMSourceView::updateSource(GMSource * src){
  FXTreeItem * item = sourcelist->getFirstItem();
  while(item) {
    if (item->getData()==src) {
      item->setText(tr(src->getName().text()));
      break;
      }
    item=item->getBelow();
    }
  resort();
  }
Пример #6
0
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);
    }
  }