[Amis-vcs] SF.net SVN: amis: [2228] branches/amis3
Brought to you by:
julienq,
marisademeglio
|
From: <mar...@us...> - 2007-11-18 21:51:42
|
Revision: 2228
http://amis.svn.sourceforge.net/amis/?rev=2228&view=rev
Author: marisademeglio
Date: 2007-11-18 13:51:45 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Added load from cd function
Modified Paths:
--------------
branches/amis3/AmisCore/src/dtb/Dtb.cpp
branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps
branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc
branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj
branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h
branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h
branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h
branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp
branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp
branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp
Added Paths:
-----------
branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h
branches/amis3/AmisGuiMFC2/include/util/
branches/amis3/AmisGuiMFC2/include/util/SearchForFilesMFC.h
branches/amis3/AmisGuiMFC2/include/util/VolMaster.h
branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp
branches/amis3/AmisGuiMFC2/src/util/
branches/amis3/AmisGuiMFC2/src/util/SearchForFilesMFC.cpp
branches/amis3/AmisGuiMFC2/src/util/VolMaster.cpp
Removed Paths:
-------------
branches/amis3/AmisGuiMFC2/include/SearchForFilesMFC.h
branches/amis3/AmisGuiMFC2/include/VolMaster.h
branches/amis3/AmisGuiMFC2/src/SearchForFilesMFC.cpp
branches/amis3/AmisGuiMFC2/src/VolMaster.cpp
Modified: branches/amis3/AmisCore/src/dtb/Dtb.cpp
===================================================================
--- branches/amis3/AmisCore/src/dtb/Dtb.cpp 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisCore/src/dtb/Dtb.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -190,6 +190,7 @@
}
loadBookmarks(mpFiles->getBookmarksFilepath());
+ return true;
}
//--------------------------------------------------
Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.aps
===================================================================
(Binary files differ)
Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc
===================================================================
--- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.rc 2007-11-18 21:51:45 UTC (rev 2228)
@@ -368,7 +368,7 @@
LISTBOX IDC_BOOKLIST,7,27,239,124,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Open",IDC_OPENBOOK,71,159,50,14
- PUSHBUTTON "&Cancel",IDC_CANCEL,129,159,50,14
+ PUSHBUTTON "&Cancel",IDCANCEL,129,159,50,14
END
IDD_ABOUTBOX DIALOGEX 0, 0, 235, 97
Modified: branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj
===================================================================
--- branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/AmisGuiMFC2.vcproj 2007-11-18 21:51:45 UTC (rev 2228)
@@ -144,9 +144,6 @@
RelativePath=".\include\Preferences.h">
</File>
<File
- RelativePath=".\include\SearchForFilesMFC.h">
- </File>
- <File
RelativePath=".\include\stdafx.h">
</File>
<File
@@ -221,6 +218,9 @@
RelativePath=".\include\gui\dialogs\GoToPageDialog.h">
</File>
<File
+ RelativePath=".\include\gui\dialogs\MultipleBooksOnVolumeDialog.h">
+ </File>
+ <File
RelativePath=".\include\gui\dialogs\OpenUrlDialog.h">
</File>
<File
@@ -271,6 +271,16 @@
</File>
</Filter>
</Filter>
+ <Filter
+ Name="util"
+ Filter="">
+ <File
+ RelativePath=".\include\util\SearchForFilesMFC.h">
+ </File>
+ <File
+ RelativePath=".\include\util\VolMaster.h">
+ </File>
+ </Filter>
</Filter>
<Filter
Name="src"
@@ -309,9 +319,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\src\SearchForFilesMFC.cpp">
- </File>
- <File
RelativePath=".\src\stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
@@ -499,6 +506,9 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\src\gui\dialogs\MultipleBooksOnVolumeDialog.cpp">
+ </File>
+ <File
RelativePath=".\src\gui\dialogs\OpenUrlDialog.cpp">
<FileConfiguration
Name="Release|Win32">
@@ -639,6 +649,16 @@
</File>
</Filter>
</Filter>
+ <Filter
+ Name="util"
+ Filter="">
+ <File
+ RelativePath=".\src\util\SearchForFilesMFC.cpp">
+ </File>
+ <File
+ RelativePath=".\src\util\VolMaster.cpp">
+ </File>
+ </Filter>
</Filter>
<Filter
Name="SelfVoicing"
Modified: branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/include/DtbWithHooks.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -25,7 +25,7 @@
#include "dtb/Dtb.h"
-#include "SearchForFilesMFC.h"
+#include "util/SearchForFilesMFC.h"
namespace amis
{
Deleted: branches/amis3/AmisGuiMFC2/include/SearchForFilesMFC.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/SearchForFilesMFC.h 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/include/SearchForFilesMFC.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -1,32 +0,0 @@
-#ifndef SEARCHFORFILESMFC_H
-#define SEARCHFORFILESMFC_H
-
-#include <string>
-#include <vector>
-#include "stdafx.h"
-#include "util/SearchForFiles.h"
-
-using namespace std;
-namespace amis
-{
-namespace util
-{
-class SearchForFilesMFC : public amis::util::SearchForFiles
-{
-public:
- SearchForFilesMFC();
- ~SearchForFilesMFC();
-
- //the parameter is a folder path, with or without a trailing slash, e.g. "c:\daisybooks"
- int startSearch(std::string);
- void stopSearch();
- int startSearchOnCdRom();
-
-private:
- int recursiveSearch(LPCTSTR);
- void doEvents();
- bool mbShouldStop;
-};
-}
-}
-#endif
\ No newline at end of file
Deleted: branches/amis3/AmisGuiMFC2/include/VolMaster.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/VolMaster.h 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/include/VolMaster.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -1,44 +0,0 @@
-////////////////////////////////////////////////////////////////
-// MSDN Magazine -- January 2004
-// If this code works, it was written by Paul DiLascia.
-// If not, I don't know who wrote it.
-// Compiles with Visual Studio .NET on Windows XP. Tab size=3.
-//
-#pragma once
-
-//////////////////
-// Handly class to encapsulate Windows' logical disk drive functions.
-//
-class CVolumeMaster {
-public:
-
- // Get bitmask of logical drives--same as Windows fn.
- DWORD GetLogicalDrives()
- {
- return ::GetLogicalDrives();
- }
-
- // Get drive type--same as Windows fn.
- UINT GetDriveType(LPCTSTR lpPath)
- {
- return ::GetDriveType(lpPath);
- }
-
- // Get logical drive strings as array of CStrings
- int GetLogicalDriveStrings(CStringArray& ar);
-
- // Get volume information using CStrings instead of LPTSTR
- BOOL GetVolumeInformation(LPCTSTR drive, // eg, "\\Server\Share" or "C:\"
- CString& volname, // volume name (label)
- DWORD& VolumeSerialNumber, // volume serial number
- DWORD& MaximumComponentLength, // maximum component len (name between \'s)
- DWORD& FileSystemFlags, // flags
- CString& filesys); // file system--eg FAT or NTFS
-
- // Handy helpers to get human-readable names of things
- static CString FormatDriveType(UINT type);
- static CString FormatBitMask(DWORD bitmap, int group=5);
- static CString FormatFileSystemFlags(DWORD flags, LPCTSTR sep);
-};
-
-
Modified: branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/include/gui/AmisGuiMFC2.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -93,6 +93,8 @@
afx_msg void OnResetFontSize();
afx_msg void OnToggleContrast();
afx_msg void OnSearchForBooks();
+ afx_msg void OnLoadCd();
+
protected:
HMENU m_hMDIMenu;
HACCEL m_hMDIAccel;
Added: branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h (rev 0)
+++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/MultipleBooksOnVolumeDialog.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -0,0 +1,62 @@
+/*
+AMIS: Adaptive Multimedia Information System
+Software for playing DAISY books
+Homepage: http://amis.sf.net
+
+Copyright (C) 2004-2007 DAISY for All Project
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef MULTIPLEBOOKSONVOLUMEDIALOG_H
+#define MULTIPLEBOOKSONVOLUMEDIALOG_H
+
+#include "gui/dialogs/AmisDialogBase.h"
+#include "../resource.h"
+#include "ambulant/net/url.h"
+#include "AmisCore.h"
+
+namespace amis
+{
+namespace gui
+{
+namespace dialogs
+{
+class MultipleBooksOnVolumeDialog : public AmisDialogBase
+{
+public:
+ //the pUrlList parameter has a default value only because the compiler requires it
+ MultipleBooksOnVolumeDialog(CWnd* pParent = NULL, amis::UrlList* pUrlList = NULL);
+ ~MultipleBooksOnVolumeDialog();
+ ambulant::net::url getBookToLoad();
+ enum { IDD = IDD_CDSEARCH };
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+protected:
+ virtual BOOL OnInitDialog();
+ afx_msg void OnDblclkFilelist();
+ afx_msg void OnOpenbook();
+ afx_msg void OnPaint();
+ DECLARE_MESSAGE_MAP()
+
+private:
+ void populateListControl();
+ void loadBook();
+
+ ambulant::net::url mLoadBookOnDialogClose;
+ amis::UrlList* mpUrlList;
+};
+}
+}
+}
+#endif
Modified: branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h
===================================================================
--- branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/include/gui/dialogs/SearchForBooksDialog.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -24,7 +24,7 @@
#include "gui/dialogs/AmisDialogBase.h"
#include "../resource.h"
-#include "SearchForFilesMFC.h"
+#include "util/SearchForFilesMFC.h"
#include "ambulant/net/url.h"
namespace amis
@@ -41,10 +41,9 @@
ambulant::net::url getBookToLoad();
enum { IDD = IDD_SEARCHDAISY };
protected:
- virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInitDialog();
protected:
- afx_msg void OnDblclkFilesfound();
+ afx_msg void OnDblclkFilelist();
afx_msg void OnOpenbook();
afx_msg void OnPaint();
afx_msg void OnBrowse();
Copied: branches/amis3/AmisGuiMFC2/include/util/SearchForFilesMFC.h (from rev 2227, branches/amis3/AmisGuiMFC2/include/SearchForFilesMFC.h)
===================================================================
--- branches/amis3/AmisGuiMFC2/include/util/SearchForFilesMFC.h (rev 0)
+++ branches/amis3/AmisGuiMFC2/include/util/SearchForFilesMFC.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -0,0 +1,32 @@
+#ifndef SEARCHFORFILESMFC_H
+#define SEARCHFORFILESMFC_H
+
+#include <string>
+#include <vector>
+#include "stdafx.h"
+#include "util/SearchForFiles.h"
+
+using namespace std;
+namespace amis
+{
+namespace util
+{
+class SearchForFilesMFC : public amis::util::SearchForFiles
+{
+public:
+ SearchForFilesMFC();
+ ~SearchForFilesMFC();
+
+ //the parameter is a folder path, with or without a trailing slash, e.g. "c:\daisybooks"
+ int startSearch(std::string);
+ void stopSearch();
+ int startSearchOnCdRom();
+
+private:
+ int recursiveSearch(LPCTSTR);
+ void doEvents();
+ bool mbShouldStop;
+};
+}
+}
+#endif
\ No newline at end of file
Copied: branches/amis3/AmisGuiMFC2/include/util/VolMaster.h (from rev 2227, branches/amis3/AmisGuiMFC2/include/VolMaster.h)
===================================================================
--- branches/amis3/AmisGuiMFC2/include/util/VolMaster.h (rev 0)
+++ branches/amis3/AmisGuiMFC2/include/util/VolMaster.h 2007-11-18 21:51:45 UTC (rev 2228)
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////
+// MSDN Magazine -- January 2004
+// If this code works, it was written by Paul DiLascia.
+// If not, I don't know who wrote it.
+// Compiles with Visual Studio .NET on Windows XP. Tab size=3.
+//
+#pragma once
+
+//////////////////
+// Handly class to encapsulate Windows' logical disk drive functions.
+//
+class CVolumeMaster {
+public:
+
+ // Get bitmask of logical drives--same as Windows fn.
+ DWORD GetLogicalDrives()
+ {
+ return ::GetLogicalDrives();
+ }
+
+ // Get drive type--same as Windows fn.
+ UINT GetDriveType(LPCTSTR lpPath)
+ {
+ return ::GetDriveType(lpPath);
+ }
+
+ // Get logical drive strings as array of CStrings
+ int GetLogicalDriveStrings(CStringArray& ar);
+
+ // Get volume information using CStrings instead of LPTSTR
+ BOOL GetVolumeInformation(LPCTSTR drive, // eg, "\\Server\Share" or "C:\"
+ CString& volname, // volume name (label)
+ DWORD& VolumeSerialNumber, // volume serial number
+ DWORD& MaximumComponentLength, // maximum component len (name between \'s)
+ DWORD& FileSystemFlags, // flags
+ CString& filesys); // file system--eg FAT or NTFS
+
+ // Handy helpers to get human-readable names of things
+ static CString FormatDriveType(UINT type);
+ static CString FormatBitMask(DWORD bitmap, int group=5);
+ static CString FormatFileSystemFlags(DWORD flags, LPCTSTR sep);
+};
+
+
Modified: branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/src/DtbWithHooks.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -90,7 +90,6 @@
{
CString title = p_txt->getTextString().c_str();
title.Trim();
- //DanToDo: title text seems to be empty with HELP DTB. Not initialized properly in the backend parser ?
amis::gui::MainWndParts::Instance()->updateTitleBar(amis::gui::MainWndParts::TITLEBAR_BOOKTITLE, title);
}
}
Deleted: branches/amis3/AmisGuiMFC2/src/SearchForFilesMFC.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/SearchForFilesMFC.cpp 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/src/SearchForFilesMFC.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -1,149 +0,0 @@
-/*
-AMIS: Adaptive Multimedia Information System
-Software for playing DAISY books
-Homepage: http://amis.sf.net
-
-Copyright (C) 2004-2007 DAISY for All Project
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-#include "stdafx.h"
-#include "util/SearchForFiles.h"
-#include "SearchForFilesMFC.h"
-#include "ambulant/net/url.h"
-
-using namespace amis::util;
-
-SearchForFilesMFC::SearchForFilesMFC()
-{
- mbShouldStop = false;
-}
-
-SearchForFilesMFC::~SearchForFilesMFC()
-{
- clearSearchResults();
-}
-
-int SearchForFilesMFC::startSearch(std::string searchPath)
-{
- USES_CONVERSION;
- mbShouldStop = false;
- std::string search_path = searchPath;
-
- clearSearchResults();
- //make sure it has a trailing slash
- if (search_path[search_path.length() - 1] != '\\') search_path += "\\";
- search_path += "*.*";
- //call the search routine, which returns the number of files found
- return recursiveSearch(A2T(search_path.c_str()));
-}
-
-void SearchForFilesMFC::startSearchOnCdRom()
-{
- //find the cdrom drive letter
- CVolumeMaster vm;
- CStringArray arDrives;
- int n = vm.GetLogicalDriveStrings(arDrives);
-
- CString cd_drive;
-
- for (int i=0; i<n; i++)
- {
- if (GetDriveType(arDrives.GetAt(i)) == DRIVE_CDROM)
- {
- cd_drive = arDrives.GetAt(i);
- break;
- }
- }
-
- if (cd_drive.IsEmpty() == FALSE)
- {
-}
-
-void SearchForFilesMFC::stopSearch()
-{
- mbShouldStop = true;
-}
-
-int SearchForFilesMFC::recursiveSearch(LPCTSTR path)
-{
- USES_CONVERSION;
-
- CFileFind finder;
- CString filename;
- int files_found = 0;
-
- CString cstr_path = path;
- if (cstr_path.GetLength() == 0) return 0;
-
- BOOL b_is_working = finder.FindFile(cstr_path);
- while (b_is_working)
- {
- b_is_working = finder.FindNextFile();
-
- // handle messages
- doEvents();
-
- // received a stop signal
- if (mbShouldStop == true) break;
-
- if (finder.IsDots()) continue;
-
- // if it's a directory, recursively search it
- if (finder.IsDirectory() && isRecursiveSearch())
- {
- CString str = finder.GetFilePath();
- files_found += recursiveSearch(str + _T("\\*.*"));
- }
- else
- {
- filename = finder.GetFileName();
- std::string str_filename = T2A(filename);
- if (matchesSearchCriteria(str_filename) && !matchesSearchExclusionCriteria(str_filename))
- {
- files_found++;
- //save the file path
- CString file_path = finder.GetFilePath();
- std::string file_path_string = T2A(file_path);
- //TODO
- //we assume that the search returns local files
- ambulant::net::url file_path_url = ambulant::net::url::from_filename(file_path_string);
- addSearchResult(&file_path_url);
- }
- }
- }
-
- amis::UrlList* results = getSearchResults();
- return results->size();
-}
-
-//peek at the message queue
-void SearchForFilesMFC::doEvents()
-{
- MSG msg;
-
- while ( ::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE ) )
- {
- if ( ::GetMessage(&msg, NULL, 0, 0))
- {
- ::TranslateMessage(&msg);
- ::DispatchMessage(&msg);
- }
- else
- {
- break;
- }
- }
-}
\ No newline at end of file
Deleted: branches/amis3/AmisGuiMFC2/src/VolMaster.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/VolMaster.cpp 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/src/VolMaster.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -1,137 +0,0 @@
-////////////////////////////////////////////////////////////////
-// MSDN Magazine -- January 2004
-// If this code works, it was written by Paul DiLascia.
-// If not, I don't know who wrote it.
-// Compiles with Visual Studio .NET on Windows XP. Tab size=3.
-//
-#include "stdafx.h"
-#include "VolMaster.h"
-
-//////////////////
-// Get logical drive strings as CStringArray
-//
-int CVolumeMaster::GetLogicalDriveStrings(CStringArray& ar)
-{
- const BUFLEN = 26*4;
- TCHAR buf[BUFLEN+1];
- ::GetLogicalDriveStrings(BUFLEN, buf);
-
- for (LPCTSTR drive=buf; *drive; drive += _tcslen(drive)+1) {
- ar.Add(drive);
- }
- return ar.GetSize();
-}
-
-//////////////////
-// Get logical drive info using CStrings instead of LPTSTR buffers.
-//
-BOOL CVolumeMaster::GetVolumeInformation(LPCTSTR drive,
- CString& volname,
- DWORD& VolumeSerialNumber,
- DWORD& MaximumComponentLength,
- DWORD& FileSystemFlags,
- CString& filesys)
-{
- BOOL bRet= ::GetVolumeInformation(drive,
- volname.GetBuffer(_MAX_FNAME), _MAX_FNAME,
- &VolumeSerialNumber,
- &MaximumComponentLength,
- &FileSystemFlags,
- filesys.GetBuffer(_MAX_FNAME), _MAX_FNAME);
- volname.ReleaseBuffer();
- filesys.ReleaseBuffer();
- return bRet;
-}
-
-//////////////////
-// Convert bitmask to string "0010011011..." etc.
-// If group is specified, adds a space every group bits for legibility.
-//
-CString CVolumeMaster::FormatBitMask(DWORD bitmask, int group)
-{
- CString bits;
- for (int i=0; i<32; i++) {
- bits += (bitmask & 0x1) ? _T('1') : _T('0');
- if (group>0 && i%group+1 == group)
- bits += _T(' ');
- bitmask>>=1;
- }
- return bits;
-}
-
-///////////////////
-// Get human-readable drive type.
-//
-CString CVolumeMaster::FormatDriveType(UINT type)
-{
-
- const struct {
- UINT type;
- LPCTSTR name;
- } TypeNames[] = {
- { DRIVE_UNKNOWN, _T("DRIVE_UNKNOWN") },
- { DRIVE_NO_ROOT_DIR, _T("DRIVE_NO_ROOT_DIR") },
- { DRIVE_REMOVABLE, _T("DRIVE_REMOVABLE") },
- { DRIVE_FIXED, _T("DRIVE_FIXED") },
- { DRIVE_REMOTE, _T("DRIVE_REMOTE") },
- { DRIVE_CDROM, _T("DRIVE_CDROM") },
- { DRIVE_RAMDISK, _T("DRIVE_RAMDISK") },
- { 0, NULL },
- };
- for (int i=0; TypeNames[i].name; i++) {
- if (type==TypeNames[i].type)
- return TypeNames[i].name;
- }
- CString str;
- str.Format(_T("DRIVE TYPE %d"),type);
- return str;
-}
-
-///////////////////
-// Get human-readable FS flags, one per line.
-// Adds sep (separator) between flags.
-//
-CString CVolumeMaster::FormatFileSystemFlags(DWORD flags, LPCTSTR sep)
-{
-/* if (flags==0)
- return _T("[none]");
-
- const struct {
- long flag;
- LPCTSTR name;
- } FlagNames[] = {
- { FILE_NAMED_STREAMS, _T("FILE_NAMED_STREAMS") },
- { FILE_READ_ONLY_VOLUME, _T("FILE_READ_ONLY_VOLUME") },
- { FILE_SUPPORTS_OBJECT_IDS, _T("FILE_SUPPORTS_OBJECT_IDS") },
- { FILE_SUPPORTS_REPARSE_POINTS, _T("FILE_SUPPORTS_REPARSE_POINTS") },
- { FILE_SUPPORTS_SPARSE_FILES, _T("FILE_SUPPORTS_SPARSE_FILES") },
- { FILE_VOLUME_QUOTAS, _T("FILE_VOLUME_QUOTAS") },
- { FS_CASE_IS_PRESERVED, _T("FS_CASE_IS_PRESERVED") },
- { FS_CASE_SENSITIVE, _T("FS_CASE_SENSITIVE") },
- { FS_FILE_COMPRESSION, _T("FS_FILE_COMPRESSION") },
- { FS_FILE_ENCRYPTION, _T("FS_FILE_ENCRYPTION") },
- { FS_PERSISTENT_ACLS, _T("FS_PERSISTENT_ACLS") },
- { FS_UNICODE_STORED_ON_DISK, _T("FS_UNICODE_STORED_ON_DISK") },
- { FS_VOL_IS_COMPRESSED, _T("FS_VOL_IS_COMPRESSED") },
- { 0,NULL }
- };
-
- CString str;
- static TCHAR buf[256]={0};
- for (int i=0; FlagNames[i].name; i++) {
- if (flags & FlagNames[i].flag) {
- str += FlagNames[i].name;
- if (sep)
- str += sep;
- }
- }
- // remove last separator
- str.SetAt(str.GetLength()-_tcslen(sep),0);
- return str;
- */
-
- //we don't use this function right now...no need to formalize this return value
- CString dummy = _T("dummy");
- return dummy;
-}
-
Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/src/gui/AmisGuiMFC2.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -22,16 +22,15 @@
#include "stdafx.h"
#include "../resource.h"
+#include "AmisCore.h"
+#include "util/FilePathTools.h"
+#include "Preferences.h"
+#include "io/RecentBooksFileIO.h"
#include "pdtb.h"
-
#include "dtb/nav/NavModel.h"
-
#include "DtbWithHooks.h"
-#include "Preferences.h"
-#include "io/RecentBooksFileIO.h"
-
#include "gui/AmisGuiMFC2.h"
#include "gui/MainFrm.h"
#include "gui/ChildFrm.h"
@@ -40,18 +39,16 @@
#include "gui/MmView.h"
#include "gui/MenuManip.h"
#include "gui/TextRenderBrain.h"
-
#include "gui/sidebar/AmisSidebar.h"
#include "gui/sidebar/AmisSidebarLoader.h"
-
#include "gui/dialogs/AmisFileDialog.h"
#include "gui/dialogs/AboutDialog.h"
#include "gui/dialogs/OpenUrlDialog.h"
#include "gui/dialogs/SkipDialog.h"
#include "gui/dialogs/GoToPageDialog.h"
#include "gui/dialogs/SearchForBooksDialog.h"
+#include "gui/dialogs/MultipleBooksOnVolumeDialog.h"
-#include "util/FilePathTools.h"
//#include "../AmisAudio/AmisAudio.h"
//using namespace amis::audio;
@@ -92,6 +89,7 @@
ON_COMMAND(ID_MENU_VIEW_LARGEFONT, OnIncreaseFontSize)
ON_COMMAND(ID_MENU_VIEW_RESETFONT, OnResetFontSize)
ON_COMMAND(ID_MENU_FILE_SEARCHDRIVE, OnSearchForBooks)
+ ON_COMMAND(ID_MENU_FILE_LOADCD, OnLoadCd)
END_MESSAGE_MAP()
CAmisGuiMFC2App::CAmisGuiMFC2App()
@@ -568,4 +566,39 @@
ambulant::net::url book_url = search.getBookToLoad();
this->openBook(&book_url);
}
+}
+
+void CAmisGuiMFC2App::OnLoadCd()
+{
+ util::SearchForFilesMFC searcher;
+ //prepare the search tool
+ searcher.clearAll();
+ searcher.addSearchCriteria("ncc.htm");
+ searcher.addSearchCriteria(".opf");
+ //sometimes I see these temp files on my drive .. excluding them just to be safe
+ searcher.addSearchExclusionCriteria("_ncc.html");
+ searcher.setRecursiveSearch(true);
+
+ int num_books = searcher.startSearchOnCdRom();
+
+ //TODO: localize this string
+ if (num_books == 0) AfxMessageBox(_T("No files found on this CD-ROM"));
+ else
+ {
+ amis::UrlList* p_results = searcher.getSearchResults();
+ if (p_results->size() > 1)
+ {
+ dialogs::MultipleBooksOnVolumeDialog dlg(NULL, p_results);
+ if (dlg.do_modal() == IDOK)
+ {
+ openBook(&dlg.getBookToLoad());
+ }
+ }
+ else
+ {
+ //open the first and only URL found
+ openBook(&(*p_results)[0]);
+ }
+ }
+
}
\ No newline at end of file
Added: branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp (rev 0)
+++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/MultipleBooksOnVolumeDialog.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -0,0 +1,139 @@
+/*
+AMIS: Adaptive Multimedia Information System
+Software for playing DAISY books
+Homepage: http://amis.sf.net
+
+Copyright (C) 2004-2007 DAISY for All Project
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "stdafx.h"
+#include "gui/dialogs/MultipleBooksOnVolumeDialog.h"
+#include "../resource.h"
+#include "AmisCore.h"
+
+using namespace amis::gui::dialogs;
+
+BEGIN_MESSAGE_MAP(MultipleBooksOnVolumeDialog, CDialog)
+ ON_WM_PAINT()
+ ON_LBN_DBLCLK(IDC_BOOKLIST, OnDblclkFilelist)
+ ON_BN_CLICKED(IDC_OPENBOOK, OnOpenbook)
+END_MESSAGE_MAP()
+
+MultipleBooksOnVolumeDialog::MultipleBooksOnVolumeDialog(CWnd* pParent /*=NULL*/, amis::UrlList* pUrlList)
+ : AmisDialogBase(MultipleBooksOnVolumeDialog::IDD)
+{
+ mpUrlList = pUrlList;
+}
+
+MultipleBooksOnVolumeDialog::~MultipleBooksOnVolumeDialog()
+{
+}
+
+BOOL MultipleBooksOnVolumeDialog::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+ populateListControl();
+ //set focus to the listbox
+ CWnd* p_control = NULL;
+ p_control = GetDlgItem(IDC_BOOKLIST);
+ if (p_control)
+ {
+ p_control->SetFocus();
+ return FALSE;
+ }
+ // return TRUE unless you set the focus to a control
+ else return TRUE;
+}
+
+//TODO: fill in titles, not URLs
+void MultipleBooksOnVolumeDialog::populateListControl()
+{
+ USES_CONVERSION;
+ CListBox* p_filelist = NULL;
+ p_filelist = (CListBox*)this->GetDlgItem(IDC_BOOKLIST);
+
+ amis::UrlList::iterator it;
+ int i = 0;
+ for (it = mpUrlList->begin(); it != mpUrlList->end(); ++it)
+ {
+ CString result;
+ result = A2T(it->get_url().c_str());
+ p_filelist->AddString(result);
+ i++;
+ }
+
+ p_filelist->SetFocus();
+ CButton* p_button = (CButton*)this->GetDlgItem(IDC_OPENBOOK);
+ p_button->EnableWindow(TRUE);
+}
+
+void MultipleBooksOnVolumeDialog::loadBook()
+{
+ CListBox* p_list = NULL;
+ p_list = (CListBox*)this->GetDlgItem(IDC_BOOKLIST);
+ int sel = p_list->GetCurSel();
+ if (sel > -1 && sel < mpUrlList->size()) mLoadBookOnDialogClose = (*mpUrlList)[sel];
+ this->EndDialog(1);
+}
+
+ambulant::net::url MultipleBooksOnVolumeDialog::getBookToLoad()
+{
+ return mLoadBookOnDialogClose;
+}
+
+void MultipleBooksOnVolumeDialog::OnPaint()
+{
+ CPaintDC dc(this); // device context for painting
+ // Let the window do its default painting...
+ CWnd::DefWindowProc( WM_PAINT, (WPARAM)dc.m_hDC, 0 );
+ //call the base class on_paint function
+ on_paint();
+}
+
+void MultipleBooksOnVolumeDialog::OnOpenbook()
+{
+ loadBook();
+}
+
+void MultipleBooksOnVolumeDialog::OnDblclkFilelist()
+{
+ loadBook();
+}
+
+BOOL MultipleBooksOnVolumeDialog::PreTranslateMessage(MSG* pMsg)
+{
+ if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP)
+ {
+ CWnd* p_wnd = this->GetFocus();
+ if (p_wnd)
+ {
+ int id = p_wnd->GetDlgCtrlID();
+ //inexplicably, the default behavior for pressing enter in a dialog is to close it.
+ //we're overriding this here.
+ if (pMsg->wParam == VK_RETURN)
+ {
+ //if the files list has focus, open the selected book
+ if (id == IDC_BOOKLIST)
+ {
+ pMsg->wParam = NULL;
+ loadBook();
+ }
+ }
+ }
+ }
+ return AmisDialogBase::PreTranslateMessage(pMsg);
+}
Modified: branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp
===================================================================
--- branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp 2007-11-18 19:59:34 UTC (rev 2227)
+++ branches/amis3/AmisGuiMFC2/src/gui/dialogs/SearchForBooksDialog.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -23,9 +23,8 @@
#include "stdafx.h"
#include "gui/dialogs/SearchForBooksDialog.h"
#include "../resource.h"
-#include "SearchForFilesMFC.h"
+#include "util/SearchForFilesMFC.h"
#include "AmisCore.h"
-#include "..\..\..\include\gui\dialogs\searchforbooksdialog.h"
using namespace amis::gui::dialogs;
@@ -34,7 +33,7 @@
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
ON_BN_CLICKED(IDC_STARTSEARCH, OnStartsearch)
ON_BN_CLICKED(IDC_STOPSEARCH, OnStopsearch)
- ON_LBN_DBLCLK(IDC_FILESFOUND, OnDblclkFilesfound)
+ ON_LBN_DBLCLK(IDC_FILESFOUND, OnDblclkFilelist)
ON_BN_CLICKED(IDC_OPENBOOK, OnOpenbook)
END_MESSAGE_MAP()
@@ -56,14 +55,6 @@
{
}
-void SearchForBooksDialog::DoDataExchange(CDataExchange* pDX)
-{
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SearchForBooks)
-
- //}}AFX_DATA_MAP
-}
-
BOOL SearchForBooksDialog::OnInitDialog()
{
CDialog::OnInitDialog();
@@ -105,10 +96,10 @@
CListBox* p_filelist = NULL;
p_filelist = (CListBox*)this->GetDlgItem(IDC_FILESFOUND);
- amis::UrlList* search_results = mSearcher.getSearchResults();
+ amis::UrlList* p_search_results = mSearcher.getSearchResults();
amis::UrlList::iterator it;
int i = 0;
- for (it = search_results->begin(); it != search_results->end(); ++it)
+ for (it = p_search_results->begin(); it != p_search_results->end(); ++it)
{
CString result;
result = A2T(it->get_url().c_str());
@@ -118,7 +109,7 @@
p_filelist->SetFocus();
- if (search_results->size() == 0)
+ if (p_search_results->size() == 0)
{
CEdit* p_edit = (CEdit*)this->GetDlgItem(IDC_SEARCHPATH);
p_edit->SetWindowText(_T(""));
@@ -136,11 +127,8 @@
CListBox* p_list = NULL;
p_list = (CListBox*)this->GetDlgItem(IDC_FILESFOUND);
int sel = p_list->GetCurSel();
- if (sel > -1 && sel < p_list->GetCount())
- {
- amis::UrlList* search_results = mSearcher.getSearchResults();
- mLoadBookOnDialogClose = (*search_results)[sel];
- }
+ amis::UrlList* p_search_results = mSearcher.getSearchResults();
+ if (sel > -1 && sel < p_search_results->size()) mLoadBookOnDialogClose = (*p_search_results)[sel];
this->EndDialog(1);
}
@@ -250,12 +238,12 @@
loadBook();
}
-void SearchForBooksDialog::OnDblclkFilesfound()
+void SearchForBooksDialog::OnDblclkFilelist()
{
loadBook();
}
-BOOL amis::gui::dialogs::SearchForBooksDialog::PreTranslateMessage(MSG* pMsg)
+BOOL SearchForBooksDialog::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP)
{
Copied: branches/amis3/AmisGuiMFC2/src/util/SearchForFilesMFC.cpp (from rev 2227, branches/amis3/AmisGuiMFC2/src/SearchForFilesMFC.cpp)
===================================================================
--- branches/amis3/AmisGuiMFC2/src/util/SearchForFilesMFC.cpp (rev 0)
+++ branches/amis3/AmisGuiMFC2/src/util/SearchForFilesMFC.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -0,0 +1,155 @@
+/*
+AMIS: Adaptive Multimedia Information System
+Software for playing DAISY books
+Homepage: http://amis.sf.net
+
+Copyright (C) 2004-2007 DAISY for All Project
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#include "stdafx.h"
+#include "util/SearchForFiles.h"
+#include "util/SearchForFilesMFC.h"
+#include "ambulant/net/url.h"
+#include "util/VolMaster.h"
+
+using namespace amis::util;
+
+SearchForFilesMFC::SearchForFilesMFC()
+{
+ mbShouldStop = false;
+}
+
+SearchForFilesMFC::~SearchForFilesMFC()
+{
+ clearSearchResults();
+}
+
+int SearchForFilesMFC::startSearch(std::string searchPath)
+{
+ USES_CONVERSION;
+ mbShouldStop = false;
+ std::string search_path = searchPath;
+
+ clearSearchResults();
+ //make sure it has a trailing slash
+ if (search_path[search_path.length() - 1] != '\\') search_path += "\\";
+ search_path += "*.*";
+ //call the search routine, which returns the number of files found
+ return recursiveSearch(A2T(search_path.c_str()));
+}
+
+int SearchForFilesMFC::startSearchOnCdRom()
+{
+ USES_CONVERSION;
+ //find the cdrom drive letter
+ CVolumeMaster vm;
+ CStringArray arDrives;
+ int n = vm.GetLogicalDriveStrings(arDrives);
+ CString cd_drive;
+ int files_found = 0;
+
+ for (int i=0; i<n; i++)
+ {
+ if (GetDriveType(arDrives.GetAt(i)) == DRIVE_CDROM)
+ {
+ cd_drive = arDrives.GetAt(i);
+ break;
+ }
+ }
+
+ if (cd_drive.IsEmpty() == FALSE)
+ {
+ files_found = startSearch(T2A(cd_drive));
+ }
+
+ return files_found;
+}
+
+void SearchForFilesMFC::stopSearch()
+{
+ mbShouldStop = true;
+}
+
+int SearchForFilesMFC::recursiveSearch(LPCTSTR path)
+{
+ USES_CONVERSION;
+
+ CFileFind finder;
+ CString filename;
+ int files_found = 0;
+
+ CString cstr_path = path;
+ if (cstr_path.GetLength() == 0) return 0;
+
+ BOOL b_is_working = finder.FindFile(cstr_path);
+ while (b_is_working)
+ {
+ b_is_working = finder.FindNextFile();
+
+ // handle messages
+ doEvents();
+
+ // received a stop signal
+ if (mbShouldStop == true) break;
+
+ if (finder.IsDots()) continue;
+
+ // if it's a directory, recursively search it
+ if (finder.IsDirectory() && isRecursiveSearch())
+ {
+ CString str = finder.GetFilePath();
+ files_found += recursiveSearch(str + _T("\\*.*"));
+ }
+ else
+ {
+ filename = finder.GetFileName();
+ std::string str_filename = T2A(filename);
+ if (matchesSearchCriteria(str_filename) && !matchesSearchExclusionCriteria(str_filename))
+ {
+ files_found++;
+ //save the file path
+ CString file_path = finder.GetFilePath();
+ std::string file_path_string = T2A(file_path);
+ //TODO
+ //we assume that the search returns local files
+ ambulant::net::url file_path_url = ambulant::net::url::from_filename(file_path_string);
+ addSearchResult(&file_path_url);
+ }
+ }
+ }
+
+ amis::UrlList* results = getSearchResults();
+ return results->size();
+}
+
+//peek at the message queue
+void SearchForFilesMFC::doEvents()
+{
+ MSG msg;
+
+ while ( ::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE ) )
+ {
+ if ( ::GetMessage(&msg, NULL, 0, 0))
+ {
+ ::TranslateMessage(&msg);
+ ::DispatchMessage(&msg);
+ }
+ else
+ {
+ break;
+ }
+ }
+}
\ No newline at end of file
Copied: branches/amis3/AmisGuiMFC2/src/util/VolMaster.cpp (from rev 2227, branches/amis3/AmisGuiMFC2/src/VolMaster.cpp)
===================================================================
--- branches/amis3/AmisGuiMFC2/src/util/VolMaster.cpp (rev 0)
+++ branches/amis3/AmisGuiMFC2/src/util/VolMaster.cpp 2007-11-18 21:51:45 UTC (rev 2228)
@@ -0,0 +1,137 @@
+////////////////////////////////////////////////////////////////
+// MSDN Magazine -- January 2004
+// If this code works, it was written by Paul DiLascia.
+// If not, I don't know who wrote it.
+// Compiles with Visual Studio .NET on Windows XP. Tab size=3.
+//
+#include "stdafx.h"
+#include "util/VolMaster.h"
+
+//////////////////
+// Get logical drive strings as CStringArray
+//
+int CVolumeMaster::GetLogicalDriveStrings(CStringArray& ar)
+{
+ const BUFLEN = 26*4;
+ TCHAR buf[BUFLEN+1];
+ ::GetLogicalDriveStrings(BUFLEN, buf);
+
+ for (LPCTSTR drive=buf; *drive; drive += _tcslen(drive)+1) {
+ ar.Add(drive);
+ }
+ return ar.GetSize();
+}
+
+//////////////////
+// Get logical drive info using CStrings instead of LPTSTR buffers.
+//
+BOOL CVolumeMaster::GetVolumeInformation(LPCTSTR drive,
+ CString& volname,
+ DWORD& VolumeSerialNumber,
+ DWORD& MaximumComponentLength,
+ DWORD& FileSystemFlags,
+ CString& filesys)
+{
+ BOOL bRet= ::GetVolumeInformation(drive,
+ volname.GetBuffer(_MAX_FNAME), _MAX_FNAME,
+ &VolumeSerialNumber,
+ &MaximumComponentLength,
+ &FileSystemFlags,
+ filesys.GetBuffer(_MAX_FNAME), _MAX_FNAME);
+ volname.ReleaseBuffer();
+ filesys.ReleaseBuffer();
+ return bRet;
+}
+
+//////////////////
+// Convert bitmask to string "0010011011..." etc.
+// If group is specified, adds a space every group bits for legibility.
+//
+CString CVolumeMaster::FormatBitMask(DWORD bitmask, int group)
+{
+ CString bits;
+ for (int i=0; i<32; i++) {
+ bits += (bitmask & 0x1) ? _T('1') : _T('0');
+ if (group>0 && i%group+1 == group)
+ bits += _T(' ');
+ bitmask>>=1;
+ }
+ return bits;
+}
+
+///////////////////
+// Get human-readable drive type.
+//
+CString CVolumeMaster::FormatDriveType(UINT type)
+{
+
+ const struct {
+ UINT type;
+ LPCTSTR name;
+ } TypeNames[] = {
+ { DRIVE_UNKNOWN, _T("DRIVE_UNKNOWN") },
+ { DRIVE_NO_ROOT_DIR, _T("DRIVE_NO_ROOT_DIR") },
+ { DRIVE_REMOVABLE, _T("DRIVE_REMOVABLE") },
+ { DRIVE_FIXED, _T("DRIVE_FIXED") },
+ { DRIVE_REMOTE, _T("DRIVE_REMOTE") },
+ { DRIVE_CDROM, _T("DRIVE_CDROM") },
+ { DRIVE_RAMDISK, _T("DRIVE_RAMDISK") },
+ { 0, NULL },
+ };
+ for (int i=0; TypeNames[i].name; i++) {
+ if (type==TypeNames[i].type)
+ return TypeNames[i].name;
+ }
+ CString str;
+ str.Format(_T("DRIVE TYPE %d"),type);
+ return str;
+}
+
+///////////////////
+// Get human-readable FS flags, one per line.
+// Adds sep (separator) between flags.
+//
+CString CVolumeMaster::FormatFileSystemFlags(DWORD flags, LPCTSTR sep)
+{
+/* if (flags==0)
+ return _T("[none]");
+
+ const struct {
+ long flag;
+ LPCTSTR name;
+ } FlagNames[] = {
+ { FILE_NAMED_STREAMS, _T("FILE_NAMED_STREAMS") },
+ { FILE_READ_ONLY_VOLUME, _T("FILE_READ_ONLY_VOLUME") },
+ { FILE_SUPPORTS_OBJECT_IDS, _T("FILE_SUPPORTS_OBJECT_IDS") },
+ { FILE_SUPPORTS_REPARSE_POINTS, _T("FILE_SUPPORTS_REPARSE_POINTS") },
+ { FILE_SUPPORTS_SPARSE_FILES, _T("FILE_SUPPORTS_SPARSE_FILES") },
+ { FILE_VOLUME_QUOTAS, _T("FILE_VOLUME_QUOTAS") },
+ { FS_CASE_IS_PRESERVED, _T("FS_CASE_IS_PRESERVED") },
+ { FS_CASE_SENSITIVE, _T("FS_CASE_SENSITIVE") },
+ { FS_FILE_COMPRESSION, _T("FS_FILE_COMPRESSION") },
+ { FS_FILE_ENCRYPTION, _T("FS_FILE_ENCRYPTION") },
+ { FS_PERSISTENT_ACLS, _T("FS_PERSISTENT_ACLS") },
+ { FS_UNICODE_STORED_ON_DISK, _T("FS_UNICODE_STORED_ON_DISK") },
+ { FS_VOL_IS_COMPRESSED, _T("FS_VOL_IS_COMPRESSED") },
+ { 0,NULL }
+ };
+
+ CString str;
+ static TCHAR buf[256]={0};
+ for (int i=0; FlagNames[i].name; i++) {
+ if (flags & FlagNames[i].flag) {
+ str += FlagNames[i].name;
+ if (sep)
+ str += sep;
+ }
+ }
+ // remove last separator
+ str.SetAt(str.GetLength()-_tcslen(sep),0);
+ return str;
+ */
+
+ //we don't use this function right now...no need to formalize this return value
+ CString dummy = _T("dummy");
+ return dummy;
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|