ciderpress/app/OpenVolumeDialog.h
Andy McFadden d8223dbcfd Relocate method comments
This moves method comments from the .cpp file to the .h file,
where users of the methods can find them.  This also makes it
possible for the IDE to show the comments when you mouse-hover over
the method name, though Visual Studio is a bit weak in this regard.

Also, added "override" keywords on overridden methods.  Reasonably
current versions of popular compilers seem to support this.

Also, don't have the return type on a separate line in the .cpp file.
The motivation for the practice -- quickly finding a method definition
with "^name" -- is less useful in C++ than C, and modern IDEs provide
more convenient ways to do the same thing.

Also, do some more conversion from unsigned types to uintXX_t.

This commit is primarily for the "app" directory.
2014-11-21 22:33:39 -08:00

107 lines
3.1 KiB
C++

/*
* CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms.
*/
#ifndef APP_OPENVOLUMEDIALOG_H
#define APP_OPENVOLUMEDIALOG_H
#include <afxwin.h>
#include "resource.h"
/*
* A dialog with a list control that we populate with the names of the
* volumes in the system.
*/
class OpenVolumeDialog : public CDialog {
public:
OpenVolumeDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_OPENVOLUMEDLG, pParentWnd),
fChosenDrive(L""),
fAllowROChange(true)
{
Preferences* pPreferences = GET_PREFERENCES_WR();
fReadOnly = pPreferences->GetPrefBool(kPrOpenVolumeRO);
}
// Result: drive to open (e.g. "A:\" or "80:\")
CString fChosenDrive;
// Did the user check "read only"? (sets default and holds return val)
BOOL fReadOnly;
// Set before calling DoModal to disable "read only" checkbox
bool fAllowROChange;
protected:
virtual BOOL OnInitDialog(void) override;
virtual void DoDataExchange(CDataExchange* pDX) override;
virtual void OnOK(void) override;
/*
* Something changed in the list. Update the "OK" button.
*/
afx_msg void OnListChange(NMHDR* pNotifyStruct, LRESULT* pResult);
/*
* The volume filter drop-down box has changed.
*/
afx_msg void OnVolumeFilterSelChange(void);
afx_msg void OnHelp(void);
afx_msg void OnListDblClick(NMHDR* pNotifyStruct, LRESULT* pResult);
// 0 is default; numbers must match up with pop-up menu order
// order also matters for range test in OnInitDialog
enum { kBoth=0, kLogical=1, kPhysical=2 };
// common constants
enum { kMaxLogicalDrives = 26, kMaxPhysicalDrives = 8 };
/*
* Load the set of logical and physical drives.
*/
void LoadDriveList(void);
/*
* Determine the logical volumes available in the system and stuff them into
* the list.
*/
bool LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex);
/*
* Add a list of physical drives to the list control.
*/
bool LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex);
/*
* Determine whether physical device N exists.
*
* Pass in the Int13 unit number, i.e. 0x00 for the first floppy drive. Win9x
* makes direct access to the hard drive very difficult, so we don't even try.
*
* TODO: remove this entirely?
*/
bool HasPhysicalDriveWin9x(int unit, CString* pRemark);
/*
* Determine whether physical device N exists.
*
* Pass in the Int13 unit number, i.e. 0x80 for the first hard drive. This
* should not be called with units for floppy drives (e.g. 0x00).
*/
bool HasPhysicalDriveWin2K(int unit, CString* pRemark);
/*
* Set the state of the "read only" checkbox in the dialog.
*/
void ForceReadOnly(bool readOnly) const;
struct {
unsigned int driveType;
} fVolumeInfo[kMaxLogicalDrives];
DECLARE_MESSAGE_MAP()
};
#endif /*APP_OPENVOLUMEDIALOG_H*/