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

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

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

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

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

78 lines
2.3 KiB
C++

/*
* CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms.
*/
#include "stdafx.h"
#include "RecompressOptionsDialog.h"
#include "NufxArchive.h"
#include "HelpTopics.h"
//BEGIN_MESSAGE_MAP(UseSelectionDialog, CDialog)
// ON_WM_HELPINFO()
// //ON_COMMAND(IDHELP, OnHelp)
//END_MESSAGE_MAP()
BOOL RecompressOptionsDialog::OnInitDialog(void)
{
fCompressionIdx = LoadComboBox((NuThreadFormat) fCompressionType);
return UseSelectionDialog::OnInitDialog();
}
int RecompressOptionsDialog::LoadComboBox(NuThreadFormat fmt)
{
static const struct {
NuThreadFormat format;
const WCHAR* name;
} kComboStrings[] = {
{ kNuThreadFormatUncompressed, L"No compression" },
{ kNuThreadFormatHuffmanSQ, L"Squeeze" },
{ kNuThreadFormatLZW1, L"Dynamic LZW/1" },
{ kNuThreadFormatLZW2, L"Dynamic LZW/2" },
{ kNuThreadFormatLZC12, L"12-bit LZC" },
{ kNuThreadFormatLZC16, L"16-bit LZC" },
{ kNuThreadFormatDeflate, L"Deflate" },
{ kNuThreadFormatBzip2, L"Bzip2" },
};
CComboBox* pCombo;
int idx, comboIdx;
int retIdx = 0;
pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP);
ASSERT(pCombo != NULL);
for (idx = comboIdx = 0; idx < NELEM(kComboStrings); idx++) {
if (NufxArchive::IsCompressionSupported(kComboStrings[idx].format)) {
pCombo->AddString(kComboStrings[idx].name);
pCombo->SetItemData(comboIdx, kComboStrings[idx].format);
if (kComboStrings[idx].format == fmt)
retIdx = comboIdx;
comboIdx++;
}
}
return retIdx;
}
void RecompressOptionsDialog::DoDataExchange(CDataExchange* pDX)
{
DDX_CBIndex(pDX, IDC_RECOMP_COMP, fCompressionIdx);
if (pDX->m_bSaveAndValidate) {
CComboBox* pCombo;
pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP);
ASSERT(pCombo != NULL);
fCompressionType = pCombo->GetItemData(fCompressionIdx);
LOGI("DDX got type=%d from combo index %d",
fCompressionType, fCompressionIdx);
}
UseSelectionDialog::DoDataExchange(pDX);
}