2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Implementation of list control showing archive contents.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "Main.h"
|
|
|
|
#include "ContentList.h"
|
|
|
|
|
|
|
|
const LPARAM kDescendingFlag = 0x0100;
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(ContentList, CListCtrl)
|
2014-11-04 00:26:53 +00:00
|
|
|
ON_WM_CREATE()
|
|
|
|
ON_WM_DESTROY()
|
|
|
|
ON_WM_SYSCOLORCHANGE()
|
|
|
|
//ON_WM_MOUSEWHEEL()
|
|
|
|
ON_NOTIFY_REFLECT(NM_DBLCLK, OnDoubleClick)
|
|
|
|
ON_NOTIFY_REFLECT(NM_RCLICK, OnRightClick)
|
|
|
|
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnClick)
|
|
|
|
ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnGetDispInfo)
|
2007-03-27 17:47:10 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
afx_msg BOOL
|
|
|
|
ContentList::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
|
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("MOUSE WHEEL");
|
2014-11-04 00:26:53 +00:00
|
|
|
return CWnd::OnMouseWheel(nFlags, zDelta, pt);
|
|
|
|
// return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL ContentList::PreCreateWindow(CREATESTRUCT& cs)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (!CListCtrl::PreCreateWindow(cs))
|
|
|
|
return FALSE;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
cs.style &= ~LVS_TYPEMASK;
|
|
|
|
cs.style |= LVS_REPORT;
|
|
|
|
cs.style |= LVS_SHOWSELALWAYS;
|
|
|
|
cs.dwExStyle |= WS_EX_CLIENTEDGE;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return TRUE;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::PostNcDestroy(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("ContentList PostNcDestroy");
|
2014-11-04 00:26:53 +00:00
|
|
|
delete this;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
static inline int MaxVal(int a, int b)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
return a > b ? a : b;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int ContentList::OnCreate(LPCREATESTRUCT lpcs)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CString colHdrs[kNumVisibleColumns] = {
|
2015-01-09 01:41:53 +00:00
|
|
|
L"Pathname", L"Type", L"Aux", L"Mod Date",
|
|
|
|
L"Format", L"Size", L"Ratio", L"Packed", L"Access"
|
2014-11-04 00:26:53 +00:00
|
|
|
}; // these should come from string table, not hard-coded
|
|
|
|
static int colFmt[kNumVisibleColumns] = {
|
|
|
|
LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT,
|
|
|
|
LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_LEFT
|
|
|
|
};
|
|
|
|
|
|
|
|
if (CListCtrl::OnCreate(lpcs) == -1)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create all of the columns with an initial width of 1, then set
|
|
|
|
* them to the correct values with NewColumnWidths() (which handles
|
|
|
|
* defaulted values).
|
|
|
|
*/
|
|
|
|
for (int i = 0; i < kNumVisibleColumns; i++)
|
|
|
|
InsertColumn(i, colHdrs[i], colFmt[i], 1);
|
|
|
|
NewColumnWidths();
|
|
|
|
|
|
|
|
/* add images for list; this MUST be loaded before header images */
|
|
|
|
LoadListImages();
|
|
|
|
SetImageList(&fListImageList, LVSIL_SMALL);
|
|
|
|
|
|
|
|
/* add our up/down arrow bitmaps */
|
|
|
|
LoadHeaderImages();
|
|
|
|
CHeaderCtrl* pHeader = GetHeaderCtrl();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (pHeader == NULL)
|
2015-01-09 01:41:53 +00:00
|
|
|
LOGW("GLITCH: couldn't get header ctrl");
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(pHeader != NULL);
|
|
|
|
pHeader->SetImageList(&fHdrImageList);
|
|
|
|
|
|
|
|
/* load the data and sort it */
|
|
|
|
if (LoadData() != 0) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
MessageBox(L"Not all entries were loaded.", L"Error",
|
2014-11-04 00:26:53 +00:00
|
|
|
MB_OK | MB_ICONSTOP);
|
|
|
|
/* keep going with what we've got; the error only affects display */
|
|
|
|
}
|
|
|
|
NewSortOrder();
|
|
|
|
|
|
|
|
/* grab the focus so we get keyboard and mouse wheel messages */
|
|
|
|
SetFocus();
|
|
|
|
|
|
|
|
/* highlight/select entire line, not just filename */
|
|
|
|
ListView_SetExtendedListViewStyleEx(m_hWnd,
|
|
|
|
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
|
|
|
|
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::OnDestroy(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2015-01-09 01:41:53 +00:00
|
|
|
LOGD("ContentList OnDestroy");
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
ExportColumnWidths();
|
|
|
|
CListCtrl::OnDestroy();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::OnSysColorChange(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
fHdrImageList.DeleteImageList();
|
|
|
|
LoadHeaderImages();
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::OnColumnClick(NMHDR* pnmh, LRESULT* pResult)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
NM_LISTVIEW* pnmlv = (NM_LISTVIEW*) pnmh;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2015-01-09 01:41:53 +00:00
|
|
|
LOGD("ContentList OnColumnClick");
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (fpLayout->GetSortColumn() == pnmlv->iSubItem)
|
|
|
|
fpLayout->SetAscending(!fpLayout->GetAscending());
|
|
|
|
else {
|
|
|
|
fpLayout->SetSortColumn(pnmlv->iSubItem);
|
|
|
|
fpLayout->SetAscending(true);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
NewSortOrder();
|
|
|
|
*pResult = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::ExportColumnWidths(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("ExportColumnWidths");
|
2014-11-04 00:26:53 +00:00
|
|
|
for (int i = 0; i < kNumVisibleColumns; i++)
|
|
|
|
fpLayout->SetColumnWidth(i, GetColumnWidth(i));
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::NewColumnWidths(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
for (int i = 0; i < kNumVisibleColumns; i++) {
|
|
|
|
int width = fpLayout->GetColumnWidth(i);
|
|
|
|
if (width == ColumnLayout::kWidthDefaulted) {
|
|
|
|
width = GetDefaultWidth(i);
|
2015-01-09 01:41:53 +00:00
|
|
|
LOGD("Defaulting width %d to %d", i, width);
|
2014-11-04 00:26:53 +00:00
|
|
|
fpLayout->SetColumnWidth(i, width);
|
|
|
|
}
|
|
|
|
SetColumnWidth(i, width);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::Reload(bool saveSelection)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Reloading ContentList");
|
2014-11-04 00:26:53 +00:00
|
|
|
CWaitCursor waitc;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
// fInvalid = false;
|
|
|
|
fpArchive->ClearReloadFlag();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
long* savedSel = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
long selCount = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
if (saveSelection) {
|
|
|
|
/* get the serials for the current selection (if any) */
|
|
|
|
savedSel = GetSelectionSerials(&selCount);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* get the item that's currently at the top of the page */
|
|
|
|
int top = GetTopIndex();
|
|
|
|
int bottom = top + GetCountPerPage() -1;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* reload the list */
|
|
|
|
LoadData();
|
|
|
|
NewSortOrder();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (savedSel != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
/* restore the selection */
|
|
|
|
RestoreSelection(savedSel, selCount);
|
|
|
|
delete[] savedSel;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* try to put us back in the same place */
|
|
|
|
EnsureVisible(bottom, false);
|
|
|
|
EnsureVisible(top, false);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
long* ContentList::GetSelectionSerials(long* pSelCount)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 05:13:13 +00:00
|
|
|
long* savedSel = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
long maxCount;
|
|
|
|
|
|
|
|
maxCount = GetSelectedCount();
|
2015-01-09 01:41:53 +00:00
|
|
|
LOGD("GetSelectionSerials (maxCount=%d)", maxCount);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (maxCount > 0) {
|
|
|
|
savedSel = new long[maxCount];
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
POSITION posn;
|
|
|
|
posn = GetFirstSelectedItemPosition();
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(posn != NULL);
|
|
|
|
if (posn == NULL)
|
|
|
|
return NULL;
|
|
|
|
while (posn != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
int num = GetNextSelectedItem(posn);
|
|
|
|
GenericEntry* pEntry = (GenericEntry*) GetItemData(num);
|
|
|
|
|
|
|
|
if (idx == maxCount) {
|
|
|
|
ASSERT(false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
savedSel[idx++] = pEntry->GetSelectionSerial();
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT(idx == maxCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
*pSelCount = maxCount;
|
|
|
|
return savedSel;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::RestoreSelection(const long* savedSel, long selCount)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("RestoreSelection (selCount=%d)", selCount);
|
2014-11-18 05:13:13 +00:00
|
|
|
if (savedSel == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
for (i = GetItemCount()-1; i >= 0; i--) {
|
|
|
|
GenericEntry* pEntry = (GenericEntry*) GetItemData(i);
|
|
|
|
|
|
|
|
for (j = 0; j < selCount; j++) {
|
|
|
|
if (pEntry->GetSelectionSerial() == savedSel[j] &&
|
|
|
|
pEntry->GetSelectionSerial() != -1)
|
|
|
|
{
|
|
|
|
/* match! */
|
|
|
|
if (SetItemState(i, LVIS_SELECTED, LVIS_SELECTED) == FALSE) {
|
2014-12-19 01:25:46 +00:00
|
|
|
LOGW("WHOA: unable to set selected on item=%d", i);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::NewSortOrder(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CWaitCursor wait; // automatically changes mouse to hourglass
|
|
|
|
int column;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
column = fpLayout->GetSortColumn();
|
|
|
|
if (!fpLayout->GetAscending())
|
|
|
|
column |= kDescendingFlag;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
SetSortIcon();
|
|
|
|
SortItems(CompareFunc, column);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*static*/ void ContentList::MakeFileTypeDisplayString(const GenericEntry* pEntry,
|
|
|
|
WCHAR* buf)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
bool isDir =
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir ||
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory;
|
|
|
|
|
|
|
|
if (pEntry->GetSourceFS() == DiskImg::kFormatMacHFS && isDir) {
|
|
|
|
/* HFS directories don't have types; fake it */
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, L"DIR/");
|
2014-11-04 00:26:53 +00:00
|
|
|
} else if (!(pEntry->GetFileType() >= 0 && pEntry->GetFileType() <= 0xff))
|
|
|
|
{
|
|
|
|
/* oversized type; assume it's HFS */
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
WCHAR typeBuf[kFileTypeBufLen];
|
2014-11-04 00:26:53 +00:00
|
|
|
MakeMacTypeString(pEntry->GetFileType(), typeBuf);
|
|
|
|
|
|
|
|
switch (pEntry->GetRecordKind()) {
|
|
|
|
case GenericEntry::kRecordKindFile:
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, typeBuf);
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case GenericEntry::kRecordKindForkedFile:
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"%ls+", typeBuf);
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case GenericEntry::kRecordKindUnknown:
|
|
|
|
// shouldn't happen
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"%ls-", typeBuf);
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case GenericEntry::kRecordKindVolumeDir:
|
|
|
|
case GenericEntry::kRecordKindDirectory:
|
|
|
|
case GenericEntry::kRecordKindDisk:
|
|
|
|
default:
|
|
|
|
ASSERT(FALSE);
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, L"!!!");
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* typical ProDOS-style stuff */
|
|
|
|
switch (pEntry->GetRecordKind()) {
|
|
|
|
case GenericEntry::kRecordKindVolumeDir:
|
|
|
|
case GenericEntry::kRecordKindDirectory:
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"%ls/", pEntry->GetFileTypeString());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case GenericEntry::kRecordKindFile:
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"%ls", pEntry->GetFileTypeString());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case GenericEntry::kRecordKindForkedFile:
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"%ls+", pEntry->GetFileTypeString());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case GenericEntry::kRecordKindDisk:
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, L"Disk");
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case GenericEntry::kRecordKindUnknown:
|
|
|
|
// usually a GSHK-archived empty data file does this
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"%ls-", pEntry->GetFileTypeString());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(FALSE);
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, L"!!!");
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*static*/ void ContentList::MakeMacTypeString(unsigned long val, WCHAR* buf)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/* expand longword with ASCII type bytes */
|
|
|
|
buf[0] = (unsigned char) (val >> 24);
|
|
|
|
buf[1] = (unsigned char) (val >> 16);
|
|
|
|
buf[2] = (unsigned char) (val >> 8);
|
|
|
|
buf[3] = (unsigned char) val;
|
|
|
|
buf[4] = '\0';
|
|
|
|
|
|
|
|
/* sanitize */
|
2007-03-27 17:47:10 +00:00
|
|
|
while (*buf != '\0') {
|
2014-11-18 22:30:51 +00:00
|
|
|
*buf = DiskImg::MacToASCII((unsigned char)*buf);
|
2007-03-27 17:47:10 +00:00
|
|
|
buf++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*static*/ void ContentList::MakeAuxTypeDisplayString(const GenericEntry* pEntry,
|
|
|
|
WCHAR* buf)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
bool isDir =
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir ||
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory;
|
|
|
|
|
|
|
|
if (pEntry->GetSourceFS() == DiskImg::kFormatMacHFS && isDir) {
|
|
|
|
/* HFS directories don't have types; fake it */
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, L" ");
|
2014-11-04 00:26:53 +00:00
|
|
|
} else if (!(pEntry->GetFileType() >= 0 && pEntry->GetFileType() <= 0xff))
|
|
|
|
{
|
|
|
|
/* oversized type; assume it's HFS */
|
|
|
|
MakeMacTypeString(pEntry->GetAuxType(), buf);
|
|
|
|
} else {
|
|
|
|
if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDisk)
|
2014-11-19 22:54:24 +00:00
|
|
|
wsprintf(buf, L"%I64dk", pEntry->GetUncompressedLen() / 1024);
|
2014-11-04 00:26:53 +00:00
|
|
|
else
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"$%04lX", pEntry->GetAuxType());
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::MakeRatioDisplayString(const GenericEntry* pEntry, WCHAR* buf,
|
2014-11-04 00:26:53 +00:00
|
|
|
int* pPerc)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
LONGLONG totalLen, totalCompLen;
|
|
|
|
totalLen = pEntry->GetUncompressedLen();
|
|
|
|
totalCompLen = pEntry->GetCompressedLen();
|
|
|
|
|
|
|
|
if ((!totalLen && totalCompLen) || (totalLen && !totalCompLen)) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, L"---"); /* weird */
|
2014-11-04 00:26:53 +00:00
|
|
|
*pPerc = -1;
|
|
|
|
} else if (totalLen < totalCompLen) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(buf, L">100%"); /* compression failed? */
|
2014-11-04 00:26:53 +00:00
|
|
|
*pPerc = 101;
|
|
|
|
} else {
|
|
|
|
*pPerc = ComputePercent(totalCompLen, totalLen);
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wsprintf(buf, L"%d%%", *pPerc);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
static const WCHAR kAccessBits[] = L"dnb iwr";
|
2014-11-04 00:26:53 +00:00
|
|
|
LV_DISPINFO* plvdi = (LV_DISPINFO*) pnmh;
|
|
|
|
CString str;
|
|
|
|
|
|
|
|
if (fpArchive->GetReloadFlag()) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(plvdi->item.pszText, L"");
|
2014-11-04 00:26:53 +00:00
|
|
|
*pResult = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI("OnGetDispInfo");
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (plvdi->item.mask & LVIF_TEXT) {
|
|
|
|
GenericEntry* pEntry = (GenericEntry*) plvdi->item.lParam;
|
|
|
|
//GenericEntry* pEntry = fpArchive->GetEntry(plvdi->item.iItem);
|
|
|
|
|
|
|
|
switch (plvdi->item.iSubItem) {
|
|
|
|
case 0: // pathname
|
2014-11-18 22:30:51 +00:00
|
|
|
if ((int) wcslen(pEntry->GetDisplayName()) > plvdi->item.cchTextMax) {
|
2014-11-04 00:26:53 +00:00
|
|
|
// looks like current limit is 264 chars, which we could hit
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcsncpy(plvdi->item.pszText, pEntry->GetDisplayName(),
|
2014-11-04 00:26:53 +00:00
|
|
|
plvdi->item.cchTextMax);
|
|
|
|
plvdi->item.pszText[plvdi->item.cchTextMax-1] = '\0';
|
|
|
|
} else {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(plvdi->item.pszText, pEntry->GetDisplayName());
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
2015-01-09 01:41:53 +00:00
|
|
|
#if 0 // no longer needed -- "display names" are converted to Unicode
|
2014-11-04 00:26:53 +00:00
|
|
|
/*
|
|
|
|
* Sanitize the string. This is really only necessary for
|
|
|
|
* HFS, which has 8-bit "Macintosh Roman" filenames. The Win32
|
|
|
|
* controls can deal with it, but it looks better if we massage
|
|
|
|
* it a little.
|
|
|
|
*/
|
|
|
|
{
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
WCHAR* str = plvdi->item.pszText;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
while (*str != '\0') {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
*str = DiskImg::MacToASCII((unsigned char) (*str));
|
2014-11-04 00:26:53 +00:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
2015-01-09 01:41:53 +00:00
|
|
|
#endif
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 1: // type
|
|
|
|
MakeFileTypeDisplayString(pEntry, plvdi->item.pszText);
|
|
|
|
break;
|
|
|
|
case 2: // auxtype
|
|
|
|
MakeAuxTypeDisplayString(pEntry, plvdi->item.pszText);
|
|
|
|
break;
|
|
|
|
case 3: // mod date
|
|
|
|
{
|
|
|
|
CString modDate;
|
|
|
|
FormatDate(pEntry->GetModWhen(), &modDate);
|
2014-11-25 22:34:14 +00:00
|
|
|
::lstrcpy(plvdi->item.pszText, (LPCWSTR) modDate);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4: // format
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEntry->GetFormatStr() != NULL);
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(plvdi->item.pszText, pEntry->GetFormatStr());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 5: // size
|
2014-11-19 22:54:24 +00:00
|
|
|
wsprintf(plvdi->item.pszText, L"%I64d", pEntry->GetUncompressedLen());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 6: // ratio
|
|
|
|
int crud;
|
|
|
|
MakeRatioDisplayString(pEntry, plvdi->item.pszText, &crud);
|
|
|
|
break;
|
|
|
|
case 7: // packed
|
2014-11-19 22:54:24 +00:00
|
|
|
wsprintf(plvdi->item.pszText, L"%I64d", pEntry->GetCompressedLen());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 8: // access
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
WCHAR bitLabels[sizeof(kAccessBits)];
|
2014-11-04 00:26:53 +00:00
|
|
|
int i, j, mask;
|
|
|
|
|
|
|
|
for (i = 0, j = 0, mask = 0x80; i < 8; i++, mask >>= 1) {
|
|
|
|
if (pEntry->GetAccess() & mask)
|
|
|
|
bitLabels[j++] = kAccessBits[i];
|
|
|
|
}
|
|
|
|
bitLabels[j] = '\0';
|
|
|
|
ASSERT(j < sizeof(bitLabels));
|
|
|
|
//::sprintf(plvdi->item.pszText, "0x%02x", pEntry->GetAccess());
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
wcscpy(plvdi->item.pszText, bitLabels);
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 9: // NuRecordIdx [hidden]
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//if (plvdi->item.mask & LVIF_IMAGE) {
|
2014-11-18 21:05:15 +00:00
|
|
|
// LOGI("IMAGE req item=%d subitem=%d",
|
2014-11-04 00:26:53 +00:00
|
|
|
// plvdi->item.iItem, plvdi->item.iSubItem);
|
|
|
|
//}
|
|
|
|
|
|
|
|
*pResult = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Helper functions for sort routine.
|
|
|
|
*/
|
2015-01-09 01:41:53 +00:00
|
|
|
static inline int CompareUnsignedLong(uint32_t u1, uint32_t u2)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (u1 < u2)
|
|
|
|
return -1;
|
|
|
|
else if (u1 > u2)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
static inline int CompareLONGLONG(LONGLONG u1, LONGLONG u2)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
if (u1 < u2)
|
|
|
|
return -1;
|
|
|
|
else if (u1 > u2)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
2014-11-21 21:18:20 +00:00
|
|
|
static inline int CompareTime(time_t t1, time_t t2)
|
2014-11-18 22:30:51 +00:00
|
|
|
{
|
|
|
|
if (t1 < t2)
|
|
|
|
return -1;
|
|
|
|
else if (t1 > t2)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int CALLBACK ContentList::CompareFunc(LPARAM lParam1, LPARAM lParam2,
|
|
|
|
LPARAM lParamSort)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
const GenericEntry* pEntry1 = (const GenericEntry*) lParam1;
|
|
|
|
const GenericEntry* pEntry2 = (const GenericEntry*) lParam2;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
WCHAR tmpBuf1[16]; // needs >= 5 for file type compare, and
|
|
|
|
WCHAR tmpBuf2[16]; // >= 7 for ratio string
|
2014-11-04 00:26:53 +00:00
|
|
|
int result;
|
|
|
|
|
|
|
|
/* for descending order, flip the parameters */
|
|
|
|
if (lParamSort & kDescendingFlag) {
|
|
|
|
const GenericEntry* tmp;
|
|
|
|
lParamSort &= ~(kDescendingFlag);
|
|
|
|
tmp = pEntry1;
|
|
|
|
pEntry1 = pEntry2;
|
|
|
|
pEntry2 = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (lParamSort) {
|
|
|
|
case 0: // pathname
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
result = wcsicmp(pEntry1->GetDisplayName(), pEntry2->GetDisplayName());
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 1: // file type
|
|
|
|
MakeFileTypeDisplayString(pEntry1, tmpBuf1);
|
|
|
|
MakeFileTypeDisplayString(pEntry2, tmpBuf2);
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
result = wcsicmp(tmpBuf1, tmpBuf2);
|
2014-11-04 00:26:53 +00:00
|
|
|
if (result != 0)
|
|
|
|
break;
|
|
|
|
/* else fall through to case 2 */
|
|
|
|
case 2: // aux type
|
|
|
|
if (pEntry1->GetRecordKind() == GenericEntry::kRecordKindDisk) {
|
|
|
|
if (pEntry2->GetRecordKind() == GenericEntry::kRecordKindDisk) {
|
|
|
|
result = pEntry1->GetAuxType() - pEntry2->GetAuxType();
|
|
|
|
} else {
|
|
|
|
result = -1;
|
|
|
|
}
|
|
|
|
} else if (pEntry2->GetRecordKind() == GenericEntry::kRecordKindDisk) {
|
|
|
|
result = 1;
|
|
|
|
} else {
|
|
|
|
result = pEntry1->GetAuxType() - pEntry2->GetAuxType();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3: // mod date
|
2014-11-18 22:30:51 +00:00
|
|
|
result = CompareTime(pEntry1->GetModWhen(),
|
2014-11-04 00:26:53 +00:00
|
|
|
pEntry2->GetModWhen());
|
|
|
|
break;
|
|
|
|
case 4: // format
|
|
|
|
result = ::lstrcmp(pEntry1->GetFormatStr(), pEntry2->GetFormatStr());
|
|
|
|
break;
|
|
|
|
case 5: // size
|
|
|
|
result = CompareLONGLONG(pEntry1->GetUncompressedLen(),
|
|
|
|
pEntry2->GetUncompressedLen());
|
|
|
|
break;
|
|
|
|
case 6: // ratio
|
|
|
|
int perc1, perc2;
|
|
|
|
MakeRatioDisplayString(pEntry1, tmpBuf1, &perc1);
|
|
|
|
MakeRatioDisplayString(pEntry2, tmpBuf2, &perc2);
|
|
|
|
result = perc1 - perc2;
|
|
|
|
break;
|
|
|
|
case 7: // packed
|
|
|
|
result = CompareLONGLONG(pEntry1->GetCompressedLen(),
|
|
|
|
pEntry2->GetCompressedLen());
|
|
|
|
break;
|
|
|
|
case 8: // access
|
|
|
|
result = CompareUnsignedLong(pEntry1->GetAccess(),
|
|
|
|
pEntry2->GetAccess());
|
|
|
|
break;
|
|
|
|
case kNumVisibleColumns: // file-order sort
|
|
|
|
default:
|
|
|
|
result = pEntry1->GetIndex() - pEntry2->GetIndex();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int ContentList::LoadData(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
GenericEntry* pEntry;
|
|
|
|
LV_ITEM lvi;
|
|
|
|
int dirCount = 0;
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
DeleteAllItems(); // for Reload case
|
|
|
|
|
|
|
|
pEntry = fpArchive->GetEntries();
|
2014-11-18 05:13:13 +00:00
|
|
|
while (pEntry != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
pEntry->SetIndex(idx);
|
|
|
|
|
|
|
|
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
|
|
|
|
lvi.iItem = idx++;
|
|
|
|
lvi.iSubItem = 0;
|
|
|
|
if (pEntry->GetDamaged())
|
|
|
|
lvi.iImage = kListIconDamaged;
|
|
|
|
else if (pEntry->GetSuspicious())
|
|
|
|
lvi.iImage = kListIconSuspicious;
|
|
|
|
else if (pEntry->GetHasNonEmptyComment())
|
|
|
|
lvi.iImage = kListIconNonEmptyComment;
|
|
|
|
else if (pEntry->GetHasComment())
|
|
|
|
lvi.iImage = kListIconComment;
|
|
|
|
else
|
|
|
|
lvi.iImage = kListIconNone;
|
|
|
|
lvi.pszText = LPSTR_TEXTCALLBACK;
|
|
|
|
lvi.lParam = (LPARAM) pEntry;
|
|
|
|
|
|
|
|
if (InsertItem(&lvi) == -1) {
|
|
|
|
ASSERT(false);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
pEntry = pEntry->GetNext();
|
|
|
|
}
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("ContentList got %d entries (%d files + %d unseen directories)",
|
2014-11-04 00:26:53 +00:00
|
|
|
idx, idx - dirCount, dirCount);
|
|
|
|
return 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
int ContentList::GetDefaultWidth(int col)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
int retval;
|
|
|
|
|
|
|
|
switch (col) {
|
|
|
|
case 0: // pathname
|
|
|
|
retval = 200;
|
|
|
|
break;
|
|
|
|
case 1: // type (need "$XY" and long HFS types)
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = MaxVal(GetStringWidth(L"XXMMMM+"), GetStringWidth(L"XXType"));
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 2: // auxtype (hex or long HFS type)
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = MaxVal(GetStringWidth(L"XX$CCCC"), GetStringWidth(L"XXAux"));
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 3: // mod date
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = GetStringWidth(L"XX88-MMM-88 88:88");
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 4: // format
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = GetStringWidth(L"XXUncompr");
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 5: // uncompressed size
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = GetStringWidth(L"XX88888888");
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 6: // ratio
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = MaxVal(GetStringWidth(L"XXRatio"), GetStringWidth(L"XX100%"));
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 7: // packed
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = GetStringWidth(L"XX88888888");
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
case 8: // access
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
retval = MaxVal(GetStringWidth(L"XXAccess"), GetStringWidth(L"XXdnbiwr"));
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(false);
|
|
|
|
retval = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::SetSortIcon(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CHeaderCtrl* pHeader = GetHeaderCtrl();
|
|
|
|
ASSERT(pHeader != NULL);
|
|
|
|
HDITEM curItem;
|
|
|
|
|
|
|
|
/* update all column headers */
|
|
|
|
for (int i = 0; i < kNumVisibleColumns; i++) {
|
|
|
|
curItem.mask = HDI_IMAGE | HDI_FORMAT;
|
|
|
|
pHeader->GetItem(i, &curItem);
|
|
|
|
|
|
|
|
if (fpLayout->GetSortColumn() != i) {
|
|
|
|
curItem.fmt &= ~(HDF_IMAGE | HDF_BITMAP_ON_RIGHT);
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
//LOGI(" Sorting on %d", i);
|
2014-11-04 00:26:53 +00:00
|
|
|
curItem.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT;
|
|
|
|
if (fpLayout->GetAscending())
|
|
|
|
curItem.iImage = 0;
|
|
|
|
else
|
|
|
|
curItem.iImage = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
pHeader->SetItem(i, &curItem);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::OnDoubleClick(NMHDR*, LRESULT* pResult)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/* test */
|
|
|
|
DWORD dwPos = ::GetMessagePos();
|
|
|
|
CPoint point ((int) LOWORD(dwPos), (int) HIWORD(dwPos));
|
|
|
|
ScreenToClient(&point);
|
|
|
|
|
|
|
|
int idx = HitTest(point);
|
|
|
|
if (idx != -1) {
|
|
|
|
CString str = GetItemText(idx, 0);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("%ls was double-clicked", (LPCWSTR) str);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
((MainWindow*) ::AfxGetMainWnd())->HandleDoubleClick();
|
|
|
|
*pResult = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::OnRightClick(NMHDR*, LRESULT* pResult)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* -The first item in the menu performs the double-click action on the
|
|
|
|
* -item clicked on. The rest of the menu is simply a mirror of the items
|
|
|
|
* -in the "Actions" menu. To make this work, we let the main window handle
|
|
|
|
* -everything, but save a copy of the index of the menu item that was
|
|
|
|
* -clicked on.
|
|
|
|
*
|
|
|
|
* [We do this differently now?? ++ATM 20040722]
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
DWORD dwPos = ::GetMessagePos();
|
|
|
|
CPoint point ((int) LOWORD(dwPos), (int) HIWORD(dwPos));
|
|
|
|
ScreenToClient(&point);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#if 0
|
2014-11-04 00:26:53 +00:00
|
|
|
int idx = HitTest(point);
|
|
|
|
if (idx != -1) {
|
|
|
|
CString str = GetItemText(idx, 0);
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("%ls was right-clicked", (LPCWSTR) str);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
//fRightClickItem = idx;
|
2007-03-27 17:47:10 +00:00
|
|
|
#else
|
2014-11-04 00:26:53 +00:00
|
|
|
{
|
2007-03-27 17:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
CMenu menu;
|
|
|
|
menu.LoadMenu(IDR_RIGHTCLICKMENU);
|
|
|
|
CMenu* pContextMenu = menu.GetSubMenu(0);
|
|
|
|
ClientToScreen(&point);
|
|
|
|
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
|
|
|
point.x, point.y, ::AfxGetMainWnd());
|
|
|
|
}
|
|
|
|
*pResult = 0;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::SelectAll(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
int i;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
for (i = GetItemCount()-1; i >= 0; i--) {
|
|
|
|
if (!SetItemState(i, LVIS_SELECTED, LVIS_SELECTED)) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Glitch: SetItemState failed on %d", i);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::InvertSelection(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
int i, oldState;
|
|
|
|
|
|
|
|
for (i = GetItemCount()-1; i >= 0; i--) {
|
|
|
|
oldState = GetItemState(i, LVIS_SELECTED);
|
|
|
|
if (!SetItemState(i, oldState ? 0 : LVIS_SELECTED, LVIS_SELECTED)) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Glitch: SetItemState failed on %d", i);
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::SelectSubdirContents(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* We do the selection by prefix matching on the display name. This means
|
|
|
|
* we do one pass through the list for the contents of a subdir, including
|
|
|
|
* all of its subdirs. However, the subdirs we select as we're going will
|
|
|
|
* be indistinguishable from subdirs selected by the user, which could
|
|
|
|
* result in O(n^2) behavior.
|
|
|
|
*
|
|
|
|
* We mark the user's selection with LVIS_CUT, process them all, then go
|
|
|
|
* back and clear all of the LVIS_CUT flags. Of course, if they select
|
|
|
|
* the entire archive, we're approach O(n^2) anyway. If efficiency is a
|
|
|
|
* problem we will need to sort the list, do some work, then sort it back
|
|
|
|
* the way it was.
|
|
|
|
*
|
|
|
|
* This doesn't work for volume directories, because their display name
|
|
|
|
* isn't quite right. That's okay for now -- we document that we don't
|
|
|
|
* allow deletion of the volume directory. (We don't currently have a test
|
|
|
|
* to see if a GenericEntry is a volume dir; might want to add one.)
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
POSITION posn;
|
|
|
|
posn = GetFirstSelectedItemPosition();
|
2014-11-18 05:13:13 +00:00
|
|
|
if (posn == NULL) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("SelectSubdirContents: nothing is selected");
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* mark all selected items with LVIS_CUT */
|
2014-11-18 05:13:13 +00:00
|
|
|
while (posn != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
int num = GetNextSelectedItem(/*ref*/ posn);
|
|
|
|
SetItemState(num, LVIS_CUT, LVIS_CUT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* for each LVIS_CUT entry, select all prefix matches */
|
|
|
|
CString prefix;
|
|
|
|
for (int i = GetItemCount()-1; i >= 0; i--) {
|
|
|
|
GenericEntry* pEntry = (GenericEntry*) GetItemData(i);
|
|
|
|
bool origSel;
|
|
|
|
|
|
|
|
origSel = GetItemState(i, LVIS_CUT) != 0;
|
|
|
|
|
|
|
|
if (origSel &&
|
|
|
|
(pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory ||
|
|
|
|
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir))
|
|
|
|
{
|
|
|
|
prefix = pEntry->GetDisplayName();
|
|
|
|
prefix += pEntry->GetFssep();
|
|
|
|
SelectSubdir(prefix);
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (!SetItemState(i, oldState ? 0 : LVIS_SELECTED, LVIS_SELECTED)) {
|
2014-11-18 21:05:15 +00:00
|
|
|
// LOGI("GLITCH: SetItemState failed on %d", i);
|
2014-11-04 00:26:53 +00:00
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear the LVIS_CUT flags */
|
|
|
|
posn = GetFirstSelectedItemPosition();
|
2014-11-18 05:13:13 +00:00
|
|
|
while (posn != NULL) {
|
2014-11-04 00:26:53 +00:00
|
|
|
int num = GetNextSelectedItem(/*ref*/ posn);
|
|
|
|
SetItemState(num, 0, LVIS_CUT);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::SelectSubdir(const WCHAR* displayPrefix)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" ContentList selecting all in '%ls'", displayPrefix);
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
int len = wcslen(displayPrefix);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
for (int i = GetItemCount()-1; i >= 0; i--) {
|
|
|
|
GenericEntry* pEntry = (GenericEntry*) GetItemData(i);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
if (wcsnicmp(displayPrefix, pEntry->GetDisplayName(), len) == 0)
|
2014-11-04 00:26:53 +00:00
|
|
|
SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::ClearSelection(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
for (int i = GetItemCount()-1; i >= 0; i--)
|
|
|
|
SetItemState(i, 0, LVIS_SELECTED);
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void ContentList::FindNext(const WCHAR* str, bool down, bool matchCase,
|
2014-11-04 00:26:53 +00:00
|
|
|
bool wholeWord)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
POSITION posn;
|
|
|
|
int i, num;
|
|
|
|
bool found = false;
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("FindNext '%ls' d=%d c=%d w=%d", str, down, matchCase, wholeWord);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
posn = GetFirstSelectedItemPosition();
|
|
|
|
num = GetNextSelectedItem(/*ref*/ posn);
|
|
|
|
if (num < 0) { // num will be -1 if nothing is selected
|
|
|
|
if (down)
|
|
|
|
num = -1;
|
|
|
|
else
|
|
|
|
num = GetItemCount();
|
|
|
|
}
|
|
|
|
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI(" starting search from entry %d", num);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (down) {
|
|
|
|
for (i = num+1; i < GetItemCount(); i++) {
|
|
|
|
found = CompareFindString(i, str, matchCase, wholeWord);
|
|
|
|
if (found)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!found) { // wrap
|
|
|
|
for (i = 0; i <= num; i++) {
|
|
|
|
found = CompareFindString(i, str, matchCase, wholeWord);
|
|
|
|
if (found)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = num-1; i >= 0; i--) {
|
|
|
|
found = CompareFindString(i, str, matchCase, wholeWord);
|
|
|
|
if (found)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!found) { // wrap
|
|
|
|
for (i = GetItemCount()-1; i >= num; i--) {
|
|
|
|
found = CompareFindString(i, str, matchCase, wholeWord);
|
|
|
|
if (found)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found) {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Found, i=%d", i);
|
2014-11-04 00:26:53 +00:00
|
|
|
ClearSelection();
|
|
|
|
SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
|
|
|
|
EnsureVisible(i, false);
|
|
|
|
} else {
|
2014-11-18 21:05:15 +00:00
|
|
|
LOGI("Not found");
|
2014-11-04 00:26:53 +00:00
|
|
|
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
|
|
|
|
pMain->FailureBeep();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
bool ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase,
|
2014-11-04 00:26:53 +00:00
|
|
|
bool wholeWord)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
GenericEntry* pEntry = (GenericEntry*) GetItemData(num);
|
|
|
|
char fssep = pEntry->GetFssep();
|
2014-11-18 05:13:13 +00:00
|
|
|
const WCHAR* (*pSubCompare)(const WCHAR* str, const WCHAR* subStr) = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (matchCase)
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
pSubCompare = wcsstr;
|
2014-11-04 00:26:53 +00:00
|
|
|
else
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
pSubCompare = Stristr;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
if (wholeWord) {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* src = pEntry->GetDisplayName();
|
|
|
|
const WCHAR* start = src;
|
|
|
|
size_t strLen = wcslen(str);
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
/* scan forward, looking for a match that starts & ends on fssep */
|
|
|
|
while (*start != '\0') {
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* match;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
match = (*pSubCompare)(start, str);
|
|
|
|
|
2014-11-18 05:13:13 +00:00
|
|
|
if (match == NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
break;
|
|
|
|
if ((match == src || *(match-1) == fssep) &&
|
|
|
|
(match[strLen] == '\0' || match[strLen] == fssep))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
start++;
|
|
|
|
}
|
|
|
|
} else {
|
2014-11-18 05:13:13 +00:00
|
|
|
if ((*pSubCompare)(pEntry->GetDisplayName(), str) != NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|