Esempio n. 1
0
void CDuiFrameWnd::OpenFileDialog()
{
    OPENFILENAME ofn;      
    TCHAR szFile[MAX_PATH] = _T("");

    ZeroMemory(&ofn, sizeof(ofn));  
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner   = *this;
    ofn.lpstrFile   = szFile;   
    ofn.nMaxFile    = sizeof(szFile);  
    ofn.lpstrFilter = STR_FILE_FILTER;
    ofn.nFilterIndex    = 1;  
    ofn.lpstrFileTitle  = NULL;  
    ofn.nMaxFileTitle   = 0;  
    ofn.lpstrInitialDir = NULL;  
    ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;  

    if (GetOpenFileName(&ofn))  
    {
        std::vector<PlayFileInfo> vctString;
		PlayFileInfo tempPlayFileInfo;
		wcscpy(tempPlayFileInfo.szFileName, szFile);
		tempPlayFileInfo.nPos = 0;
		vctString.push_back(tempPlayFileInfo);
        AddFiles(vctString);
    } 
}
void CDownloads_Bittorrent_Files::AddFiles(fs::ListTree <vmsBtDownloadManager::vmsFile>* pTree, CColumnTreeCtrl *pTreeCtrl, HTREEITEM hRoot)
{
	for (int i = 0; i < pTree->GetLeafCount (); i++)
	{
		vmsBtDownloadManager::vmsFile &file = pTree->GetLeaf (i)->GetData ();
		if (file.nIndex == -1)
		{
			HTREEITEM hItem = pTreeCtrl->GetTreeCtrl ().InsertItem (TVIF_TEXT | TVIF_PARAM | TVIF_STATE, 
				file.strName, 0, 0, TVIS_EXPANDED, TVIS_EXPANDED, -1, hRoot, TVI_LAST);
			pTreeCtrl->SetItemText (hItem, 1, BytesToString (file.nFileSize));
			AddFiles (pTree->GetLeaf (i), pTreeCtrl, hItem);
			
		}
		else
		{
			HTREEITEM hItem = pTreeCtrl->GetTreeCtrl ().InsertItem (TVIF_TEXT | TVIF_PARAM | TVIF_PARAM, 
				file.strName, 0, 0, 0, 0, file.nIndex, hRoot, TVI_LAST);
			pTreeCtrl->SetItemText (hItem, 1, BytesToString (file.nFileSize));
			CString str; str.Format ("%d%%", m_dld->pMgr->GetBtDownloadMgr ()->get_FilePercentDone (file.nIndex));
			pTreeCtrl->SetItemText (hItem, 2, str);
			if (file.iPriority == 0)
				pTreeCtrl->SetItemText (hItem, 3, LS (L_PRIORITY_SKIP));
			else if (file.iPriority == 1)
				pTreeCtrl->SetItemText (hItem, 3, LS (L_PRIORITY_NORMAL));
			else 
				pTreeCtrl->SetItemText (hItem, 3, LS (L_PRIORITY_HIGH));
			
		}
	}	
}
void CBtDld_Files::AddFiles(fs::ListTree <vmsBtDownloadManager::vmsFile>* pTree, CColumnTreeCtrl *pTreeCtrl, HTREEITEM hRoot)
{
	for (int i = 0; i < pTree->GetLeafCount (); i++)
	{
		vmsBtDownloadManager::vmsFile &file = pTree->GetLeaf (i)->GetData ();
		if (file.nIndex == -1)
		{
			HTREEITEM hItem = pTreeCtrl->GetTreeCtrl ().InsertItem (TVIF_TEXT | TVIF_PARAM, 
				file.strName, 0, 0, 0, 0, (DWORD_PTR)NULL, hRoot, TVI_LAST);
			pTreeCtrl->SetItemText (hItem, 1, BytesToString (file.nFileSize));
			AddFiles (pTree->GetLeaf (i), pTreeCtrl, hItem);
			pTreeCtrl->GetTreeCtrl ().SetCheck (hItem, vmsTreeCtrlHelper::isAtLeast1ChildChecked (&pTreeCtrl->GetTreeCtrl (), hItem));
		}
		else
		{
			_inc_filesTreeData *pTD = new _inc_filesTreeData;
			m_vToDelete.push_back (pTD);
			pTD->nFileIndex = file.nIndex;
			pTD->nFilePriority = file.iPriority;
			HTREEITEM hItem = pTreeCtrl->GetTreeCtrl ().InsertItem (TVIF_TEXT | TVIF_PARAM, 
				file.strName, 0, 0, 0, 0, (DWORD_PTR)pTD, hRoot, TVI_LAST);
			pTreeCtrl->SetItemText (hItem, 1, BytesToString (file.nFileSize));
			pTreeCtrl->GetTreeCtrl ().SetCheck (hItem, file.iPriority != 0);
		}
	}
}
Esempio n. 4
0
void CDuiFrameWnd::OnDropFiles( HWND hwnd, HDROP hDropInfo )
{
    UINT  nFileCount = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
    TCHAR szFileName[_MAX_PATH] = _T("");
    DWORD dwAttribute;
    std::vector<PlayFileInfo> vctString;

    // 获取拖拽进来文件和文件夹
    for (UINT i = 0; i < nFileCount; i++)
    {
        ::DragQueryFile(hDropInfo, i, szFileName, sizeof(szFileName));
        dwAttribute = ::GetFileAttributes(szFileName);

        // 是否为文件夹
        if ( dwAttribute & FILE_ATTRIBUTE_DIRECTORY )
        {          
            ::SetCurrentDirectory(szFileName);       
            EnumerateFiles(vctString);	      
        }
        else
        {
			PlayFileInfo tempPlayFileInfo;
			wcscpy(tempPlayFileInfo.szFileName, szFileName);
			tempPlayFileInfo.nPos = 0;
            vctString.push_back(tempPlayFileInfo);
        }
    }

    AddFiles(vctString);
    ::DragFinish(hDropInfo);
}
BOOL CBtDld_Files::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

	
	m_wndFiles.ModifyStyle (TVS_CHECKBOXES, 0);
	m_wndFiles.ModifyStyle (0, TVS_CHECKBOXES);

	fs::ListTree <vmsBtDownloadManager::vmsFile>::ListTreePtr tFiles;
	tFiles.CreateInstance ();
	m_pvDlds->at (0)->pMgr->GetBtDownloadMgr ()->GetFilesTree (tFiles);

	CRect rc; m_wndFiles.GetClientRect (&rc);
	m_wndFiles.GetTreeCtrl().ModifyStyle (0, TVS_HASBUTTONS | TVS_HASLINES | 
		TVS_LINESATROOT | TVS_CHECKBOXES | TVS_FULLROWSELECT);
	m_wndFiles.InsertColumn (0, LS (L_NAME), LVCFMT_LEFT, rc.Width () - 130 - GetSystemMetrics (SM_CXVSCROLL));
	m_wndFiles.InsertColumn (1, LS (L_SIZE), LVCFMT_LEFT, 130);
	AddFiles (tFiles, &m_wndFiles, TVI_ROOT);

	HTREEITEM hChild = m_wndFiles.GetTreeCtrl ().GetChildItem (TVI_ROOT);
	if (hChild && m_wndFiles.GetTreeCtrl ().GetNextItem (hChild, TVGN_NEXT) == NULL)
		m_wndFiles.GetTreeCtrl ().Expand (hChild, TVE_EXPAND);
	
	return TRUE;  
	              
}
Esempio n. 6
0
void mtlrchApp::EvDropFiles (TDropInfo drop)
{
    // Number of files dropped.
    int totalNumberOfFiles = drop.DragQueryFileCount();

    TFileList* files = new TFileList;

    for (int i = 0; i < totalNumberOfFiles; i++) {
        // Tell DragQueryFile the file interested in (i) and the length of your buffer.
        int     fileLength = drop.DragQueryFileNameLen(i) + 1;
        char    *fileName = new char[fileLength];

        drop.DragQueryFile(i, fileName, fileLength);

        // Getting the file dropped. The location is relative to your client coordinates,
        // and will have negative values if dropped in the non client parts of the window.
        //
        // DragQueryPoint copies that point where the file was dropped and returns whether
        // or not the point is in the client area.  Regardless of whether or not the file
        // is dropped in the client or non-client area of the window, you will still receive
        // the file name.
        TPoint  point;
        BOOL    inClientArea = drop.DragQueryPoint(point);
        files->Add(new TFileDrop(fileName, point, inClientArea, this));
    }

    // Open the files that were dropped.
    AddFiles(files);

    // Release the memory allocated for this handle with DragFinish.
    drop.DragFinish();
}
Esempio n. 7
0
/**
Processes the current directory entry. If the directory has any files it will 
create the appropriate file entries in the directory tree. If the directory 
has any subdirectories it will create nodes in the directory tree and will 
create an TDirectoryEntry and then use that to process the subdirectory

@param aAdjustment The difference between offsets in the core image directory and
the actual position in the file
*/
TInt TDirectoryEntry::Process(long aAdjustment)
	{
	TRofsDir dir;
	iAdjustment = aAdjustment;
	long dirStartPos = iFilePos;
	int result = KErrNone;
	int dirSize = iReader->ReadDirEntry(dir, iFilePos);
	if (dirSize != 0)
		{
		if (dir.iFileBlockAddress != 0)
			{
			// directory has files in it
			result = AddFiles(dir.iFileBlockAddress-iAdjustment, dir.iFileBlockSize);
			}
		if (result == KErrNone && dir.iStructSize > dirSize)
			{
			// directory has subdirectories
			result = AddSubDirs(dirStartPos + dir.iStructSize);
			}
		}
	else 
		result = KErrGeneral;

	return result;
	}
Esempio n. 8
0
void CDownloads_Bittorrent_Files::set_ActiveDownload(vmsDownloadSmartPtr dld)
{
	GetTreeCtrl ().DeleteAllItems ();

	m_dld = dld;
	if (dld == NULL)
		return;

	fs::ListTree <vmsBtDownloadManager::vmsFile> tFiles;
	m_dld->pMgr->GetBtDownloadMgr ()->GetFilesTree (tFiles);

	AddFiles (&tFiles, this, TVI_ROOT);
	
	
}
Esempio n. 9
0
const void MerryCommandManager::AddFiles(const wxArrayString& files,const wxArrayString& excludes)
{
	if (excludes.empty())
		return AddFiles(files);
	for(int i=files.GetCount()-1;i >= 0;--i)
	{
		int j;
		for(j = excludes.size()-1;j >= 0;--j)
		{//过滤符合条件的内容
			if (files[i].Matches(excludes[j]))
				break;
		}
		if (j == -1 && this->AddCommand(files[i]) == -2)
			break;
	}
}
Esempio n. 10
0
FileTabs& FileTabs::operator<<(const FileTabs &src)
{
	Clear();
	Stacking(false);
	SortGroups(false);
	Grouping(false);
	AddFiles(src.GetFiles(), src.GetIcons(), false);
	CopySettings(src);	
	stackedicons = src.stackedicons;
	greyedicons = src.greyedicons;
	
	if (src.HasCursor())
		SetData(~src);
	sc.SetPos(src.GetScrollPos());
	Refresh();
	return *this;
}
Esempio n. 11
0
void PProjectWindow::MessageReceived(BMessage *msg)
{
	if (msg->WasDropped() && msg->HasRef("refs"))
		AddRefs(msg);
	else
		switch (msg->what)
		{
			case msg_PProjectItemInvoked:
				OpenItem();
				break;

			case msg_PProjectItemSelected:
				SelectionChanged();
				break;

			case msg_PAdd:
				AddFiles();
				SetDirty(true);
				break;

			case msg_PRemove:
				RemoveSelected();
				break;

			case B_REFS_RECEIVED:
				AddRefs(msg);
				break;

			case msg_EditAsText:
				if (IsDirty())
					Save();
				gApp->NewWindow(EntryRef());
				Close();
				break;

			default:
				inherited::MessageReceived(msg);
				break;
		}
} /* PProjectWindow::MessageReceived */
Esempio n. 12
0
ConflictListDialog::ConflictListDialog(wxWindow* parent, 
                                       const std::vector<std::string>& files)
   : ExtDialog(parent, -1, _("TortoiseCVS - Resolve Conflicts"),
               wxDefaultPosition, wxDefaultSize,
               wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | 
               wxDEFAULT_DIALOG_STYLE | wxCLIP_CHILDREN)

{
   TDEBUG_ENTER("ConflictListDialog::ConflictListDialog");
   SetIcon(wxIcon(wxT("A_TORTOISE"), wxBITMAP_TYPE_ICO_RESOURCE));

   std::vector<ItemData*> itemData;
   std::vector<std::string> tmp;
   std::vector<std::string>::const_iterator it;

   // Add files
   it = files.begin();
   while (it != files.end())
   {
      ItemData *data = new ItemData();
      data->m_Filename = *it;
      data->m_Status = CVSStatus::STATUS_CONFLICT;
      itemData.push_back(data);
      tmp.push_back(*it);
      it++;
   }


   // Trim paths to sensible length
   ShortenPaths(tmp, myStub);

   wxStaticText* label2 = new ExtStaticText(this, -1, _(
"CVS encountered conflicts when trying to merge your changes in the files below. Please merge your changes manually."),
                                            wxDefaultPosition, 
                                            wxDLG_UNIT(this, wxSize(60, 15)));
   
   FilenameText* label1 = new FilenameText(this, -1, _("Folder: %s"), wxText(RemoveTrailingDelimiter(myStub)));
   label1->SetWindowStyle(label1->GetWindowStyle() | wxST_NO_AUTORESIZE);
   myFiles = new ExtListCtrl(this, CONFLICTLISTDLG_ID_FILES, wxDefaultPosition, wxDefaultSize, 
                             wxLC_REPORT | wxLC_ALIGN_LEFT);
   myFiles->PushEventHandler(new ListCtrlEventHandler(this));
   myFiles->InsertColumn(0, _("Filename"), wxLIST_FORMAT_LEFT, 0);
   myFiles->InsertColumn(1, _("Format"), wxLIST_FORMAT_LEFT, 0);
   myFiles->InsertColumn(2, _("Status"), wxLIST_FORMAT_LEFT, 0);
   AddFiles(tmp, itemData);
   myFiles->SetBestColumnWidth(0);
   myFiles->SetBestColumnWidth(1);
   myFiles->SetBestColumnWidth(2);
   myFiles->SetBestSize(wxDLG_UNIT(this, wxSize(150, 150)), wxDefaultSize);

   wxStaticText* tip = new wxStaticText(this, -1,
                                        _("To resolve the conflicts, double or right click on the files above."));
   tip->SetForegroundColour(SetForegroundColour(ColorRefToWxColour(GetIntegerPreference("Colour Tip Text"))));

   // OK/Cancel button
   wxBoxSizer* sizerConfirm = new wxBoxSizer(wxHORIZONTAL);
   myOK = new wxButton(this, wxID_OK, _("Close"));
   myOK->SetDefault();
   sizerConfirm->Add(myOK, 0, wxGROW | wxALL, 5);

   // Status bar
   myStatusBar = new wxStatusBar(this, -1);
   myStatusBar->SetStatusText(Printf(_("%d file(s)"), files.size()).c_str());

   // Main box with everything in it
   wxBoxSizer* sizerTop = new wxBoxSizer(wxVERTICAL);
   sizerTop->Add(label2, 0, wxGROW | wxALL, 3);
   sizerTop->Add(label1, 0, wxGROW | wxALL, 3);
   sizerTop->Add(myFiles, 2, wxGROW | wxALL, 3);
   sizerTop->Add(tip, 0, wxALIGN_LEFT | wxALL, 3);
   sizerTop->Add(sizerConfirm, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 10);
   sizerTop->Add(myStatusBar, 0, wxGROW | wxALL, 0);

   // Overall dialog layout settings
   SetAutoLayout(TRUE);
   SetSizer(sizerTop);
   sizerTop->SetSizeHints(this);
   sizerTop->Fit(this);

   RestoreTortoiseDialogSize(this, "Conflict");
   SetTortoiseDialogPos(this, GetRemoteHandle());
   RestoreTortoiseDialogState(this, "Conflict");
}
bool
DeviceStorageRequestChild::
  Recv__delete__(const DeviceStorageResponseValue& aValue)
{
  switch (aValue.type()) {

    case DeviceStorageResponseValue::TErrorResponse:
    {
      DS_LOG_INFO("error %u", mRequest->GetId());
      ErrorResponse r = aValue;
      mRequest->Reject(r.error());
      break;
    }

    case DeviceStorageResponseValue::TSuccessResponse:
    {
      DS_LOG_INFO("success %u", mRequest->GetId());
      nsString fullPath;
      mRequest->GetFile()->GetFullPath(fullPath);
      mRequest->Resolve(fullPath);
      break;
    }

    case DeviceStorageResponseValue::TFileDescriptorResponse:
    {
      DS_LOG_INFO("fd %u", mRequest->GetId());
      FileDescriptorResponse r = aValue;

      DeviceStorageFile* file = mRequest->GetFile();
      DeviceStorageFileDescriptor* descriptor = mRequest->GetFileDescriptor();
      nsString fullPath;
      file->GetFullPath(fullPath);
      descriptor->mDSFile = file;
      descriptor->mFileDescriptor = r.fileDescriptor();
      mRequest->Resolve(fullPath);
      break;
    }

    case DeviceStorageResponseValue::TBlobResponse:
    {
      DS_LOG_INFO("blob %u", mRequest->GetId());
      BlobResponse r = aValue;
      BlobChild* actor = static_cast<BlobChild*>(r.blobChild());
      RefPtr<BlobImpl> blobImpl = actor->GetBlobImpl();
      mRequest->Resolve(blobImpl.get());
      break;
    }

    case DeviceStorageResponseValue::TFreeSpaceStorageResponse:
    {
      DS_LOG_INFO("free %u", mRequest->GetId());
      FreeSpaceStorageResponse r = aValue;
      mRequest->Resolve(r.freeBytes());
      break;
    }

    case DeviceStorageResponseValue::TUsedSpaceStorageResponse:
    {
      DS_LOG_INFO("used %u", mRequest->GetId());
      UsedSpaceStorageResponse r = aValue;
      mRequest->Resolve(r.usedBytes());
      break;
    }

    case DeviceStorageResponseValue::TAvailableStorageResponse:
    {
      DS_LOG_INFO("available %u", mRequest->GetId());
      AvailableStorageResponse r = aValue;
      mRequest->Resolve(r.mountState());
      break;
    }

    case DeviceStorageResponseValue::TStorageStatusResponse:
    {
      DS_LOG_INFO("status %u", mRequest->GetId());
      StorageStatusResponse r = aValue;
      mRequest->Resolve(r.storageStatus());
      break;
    }

    case DeviceStorageResponseValue::TFormatStorageResponse:
    {
      DS_LOG_INFO("format %u", mRequest->GetId());
      FormatStorageResponse r = aValue;
      mRequest->Resolve(r.mountState());
      break;
    }

    case DeviceStorageResponseValue::TMountStorageResponse:
    {
      DS_LOG_INFO("mount %u", mRequest->GetId());
      MountStorageResponse r = aValue;
      mRequest->Resolve(r.storageStatus());
      break;
    }

    case DeviceStorageResponseValue::TUnmountStorageResponse:
    {
      DS_LOG_INFO("unmount %u", mRequest->GetId());
      UnmountStorageResponse r = aValue;
      mRequest->Resolve(r.storageStatus());
      break;
    }

    case DeviceStorageResponseValue::TEnumerationResponse:
    {
      DS_LOG_INFO("enumerate %u", mRequest->GetId());
      EnumerationResponse r = aValue;
      auto request = static_cast<DeviceStorageCursorRequest*>(mRequest.get());
      uint32_t count = r.paths().Length();
      request->AddFiles(count);
      for (uint32_t i = 0; i < count; i++) {
        RefPtr<DeviceStorageFile> dsf
          = new DeviceStorageFile(r.type(), r.paths()[i].storageName(),
                                  r.rootdir(), r.paths()[i].name());
        request->AddFile(dsf.forget());
      }
      request->Continue();
      break;
    }

    default:
    {
      DS_LOG_ERROR("unknown %u", mRequest->GetId());
      NS_RUNTIMEABORT("not reached");
      break;
    }
  }
  return true;
}
Esempio n. 14
0
int ArchivePanel::pPutFiles(
		const PluginPanelItem *PanelItem,
		int ItemsNumber,
		int Move,
#ifdef UNICODE
		const wchar_t* SrcPath,
#endif
		int OpMode
		)
{
	bool bResult = false;

	FarPanelInfo info;
	ArchiveItemArray items;

	m_bPasswordSet = false;

	if ( m_pArchive == NULL )
	{
		CreateArchiveParams params;

		if ( dlgModifyCreateArchive(
				this, 
				&params
				) )
		{
			m_bPasswordSet = true;
			m_strPassword = params.strPassword;

			int nSelectedCount = info.GetSelectedItemsCount();

			bool bSeparately = params.bSeparateArchives && (nSelectedCount > 1);
			int	nCount = (bSeparately)?nSelectedCount:1;

			string strArchiveName;

			for (int el = 0; el < nCount; el++)
			{
				if ( bSeparately )
				{
					PluginPanelItem Item;
					info.GetSelectedItem(el, &Item);

					items.reset(); //???

					GetPanelItemsToProcess(&Item, 1, items);

#ifdef UNICODE
					strArchiveName = FSF.PointToName(Item.FindData.lpwszFileName);
#else
					strArchiveName = FSF.PointToName(Item.FindData.cFileName);
#endif

				
					if ( (Item.FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY )
						CutTo(strArchiveName, _T('.'), true);

					info.FreePanelItem(&Item);
				}
				else
				{
					strArchiveName = params.strFileName;

					PluginPanelItem* pItems = new PluginPanelItem[nSelectedCount];

					for (int i = 0; i < nSelectedCount; i++)
						info.GetSelectedItem(i, &pItems[i]);

					GetPanelItemsToProcess(pItems, nSelectedCount, items);

					for (int i = 0; i < nSelectedCount; i++)
						info.FreePanelItem(&pItems[i]);

					delete pItems;
				}

				if ( !params.bExactName )
				{
					strArchiveName += _T(".");
					strArchiveName += params.pFormat->GetDefaultExtention();
				}

				string strFullArchiveName = info.GetCurrentDirectory();
				AddEndSlash(strFullArchiveName);

				strFullArchiveName += strArchiveName;
				
				//Archive* pArchive = pManager->OpenCreateArchive(params.pFormat, strFullArchiveName, this, Callback, true);
				//BADBAD, надо убедиться, что отсюда сразу в ClosePlugin попадаем
				m_pArchive = pManager->OpenCreateArchive(params.pFormat, strFullArchiveName, this, Callback, true);

				if ( m_pArchive )
					bResult = AddFiles(items, info.GetCurrentDirectory(), params.strConfig);
			}
		}
	}
	else
	{
		GetPanelItemsToProcess(PanelItem, ItemsNumber, items);

#ifdef UNICODE
		bResult = AddFiles(items, SrcPath ? SrcPath : info.GetCurrentDirectory(), nullptr);
#else
		bResult = AddFiles(items, info.GetCurrentDirectory(), nullptr);
#endif
	}

	return bResult;
}
Esempio n. 15
0
void CDuiFrameWnd::InitWindow()
{
    SetIcon(IDI_ICON1);

    // 根据分辨率自动调节窗口大小
    MONITORINFO oMonitor = {};
    oMonitor.cbSize = sizeof(oMonitor);
    ::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTONEAREST), &oMonitor);
    AdaptWindowSize(oMonitor.rcMonitor.right - oMonitor.rcMonitor.left);
    ::GetWindowPlacement(*this, &m_OldWndPlacement);

    // 初始化CActiveXUI控件
    std::vector<CDuiString> vctName;
    CActiveXUI* pActiveXUI;

    vctName.push_back(_T("ActiveXLib"));
    vctName.push_back(_T("ActiveXFind"));
    vctName.push_back(_T("ActiveXMine"));
    vctName.push_back(_T("ActiveXCloud"));

    for (UINT i = 0; i < vctName.size(); i++)
    {
        pActiveXUI = static_cast<CActiveXUI*>(m_PaintManager.FindControl(vctName[i]));

        if(pActiveXUI) 
        {
            pActiveXUI->SetDelayCreate(false);                     
            pActiveXUI->CreateControl(CLSID_WebBrowser);    
        }
    }

    // 几个常用控件做为成员变量
    CSliderUI* pSilderVol = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("sliderVol")));
    m_pSliderPlay = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("sliderPlay")));
    m_pLabelTime  = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("labelPlayTime")));

    if (! pSilderVol || ! m_pSliderPlay || ! m_pLabelTime)
    {
        return;
    }

    pSilderVol->OnNotify    += MakeDelegate(this, &CDuiFrameWnd::OnVolumeChanged);
    m_pSliderPlay->OnNotify += MakeDelegate(this, &CDuiFrameWnd::OnPosChanged);

    // 设置播放器的窗口句柄和回调函数
    CWndUI *pWnd = static_cast<CWndUI*>(m_PaintManager.FindControl(_T("wndMedia")));
    if (pWnd)
    {
        m_cAVPlayer.SetHWND(pWnd->GetHWND()); 
        m_cAVPlayer.SetCallbackPlaying(CallbackPlaying);
        m_cAVPlayer.SetCallbackPosChanged(CallbackPosChanged);
        m_cAVPlayer.SetCallbackEndReached(CallbackEndReached);
    }

    // 加载m3u播放列表
    AddFiles(m_cPlayList.GetPlaylist(), true);   

    // 选中上一次播放文件的位置
    CTreeViewUI *pTree = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("treePlaylist")));
    if (pTree)
    {
        pTree->SelectItem(m_iPlaylistIndex, true);
    }
}
Esempio n. 16
0
void FileTabs::AddFiles(const Vector<String> &files, bool make_active)
{
	AddFiles(files, Vector<Image>(), make_active);
}
Esempio n. 17
0
// add files to list
gbool GFileSorter::AddFiles(const char *directory,time_t &maxFileTime,BOOL &stop)
{

    CFileFind finder;

    CString dir = directory;

    // add separator
    int l = dir.GetLength();
    if (l == 0) return FALSE;
    if ( !((dir[l-1] == '\\') || (dir[l-1] == '/'))) dir += '\\';

    dir += "*.*";

    CString path;

    CTime creationTime((time_t)0);
    CTime accessTime((time_t)0);
    CTime writeTime((time_t)0);

    // setup the find structure
    BOOL bWorking = finder.FindFile(dir);


    while (bWorking)  { // for all entrys
        if (stop) break;

        bWorking = finder.FindNextFile();

        path = finder.GetFilePath();

        creationTime = (time_t)0;
        accessTime = (time_t)0;
        writeTime = (time_t)0;

        BOOL ret=finder.GetCreationTime(creationTime);
        finder.GetLastAccessTime(accessTime);
        finder.GetLastWriteTime(writeTime);

        time_t t = creationTime.GetTime();

        if (writeTime.GetTime()>0) t = max(t,writeTime.GetTime()); // HG wg Kristof

        if (accessTime.GetTime()>0) t = max(t,accessTime.GetTime());

        if (finder.IsDots( )) {	// ignore . ..

        } else 	if (finder.IsDirectory( )) { // recursively step down

            t=0; // we want to delete empty directories new 20.10.98
            AddFiles(path,t,stop);

            DWORD length = 0;

            // to do get date of latest
            TRACE("D %s c %ld a %ld w %ld size %ld \n",(const char *) path, creationTime.GetTime(),accessTime.GetTime(),writeTime.GetTime(),length);

            // time is the max of the child time +1
            GFSortEntry *e = new GFSortEntry(path,t+1,length,gtrue);

            if (!e) break;
            if (!Add(e)) break;

            if (t>maxFileTime) maxFileTime = t;


        }
        else {

            DWORD length = finder.GetLength(); // get length 64
            fileSum += length;

            TRACE("F %s c %ld a %ld w %ld size %ld \n",(const char *) path, creationTime.GetTime(),accessTime.GetTime(),writeTime.GetTime(),length);
            GFSortEntry *e = new GFSortEntry(path,t,length);

            if (t>maxFileTime) maxFileTime = t;

            if (!e) break;
            if (!Add(e)) break;
        }


    }
    finder.Close();

    //TRACE("%ld bytes \n",(long)fileSum);

    return TRUE;
}