9.06 beta

This commit is contained in:
Igor Pavlov
2009-08-17 00:00:00 +00:00
committed by Kornel Lesiński
parent 829409452d
commit c99f3ebdd6
445 changed files with 15246 additions and 8133 deletions

View File

@@ -7,7 +7,7 @@
#include "ExtractDialog.h"
#include "Common/StringConvert.h"
#include "Windows/Shell.h"
#include "Windows/FileName.h"
#include "Windows/FileDir.h"
#include "Windows/ResourceString.h"
@@ -18,35 +18,47 @@
#include "../Common/ZipRegistry.h"
#include "../FileManager/BrowseDialog.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/resourceGui.h"
#include "ExtractRes.h"
#include "ExtractDialogRes.h"
// #include "Help/Context/Extract.h"
using namespace NWindows;
using namespace NFile;
using namespace NName;
static const int kPathModeButtons[] =
extern HINSTANCE g_hInstance;
static CIDLangPair kPathMode_Pairs[] =
{
IDC_EXTRACT_RADIO_FULL_PATHNAMES,
IDC_EXTRACT_RADIO_CURRENT_PATHNAMES,
IDC_EXTRACT_RADIO_NO_PATHNAMES
{ IDC_EXTRACT_RADIO_FULL_PATHNAMES, 0x02000811 },
// { IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, 0x02000812 },
{ IDC_EXTRACT_RADIO_NO_PATHNAMES, 0x02000813 }
};
static CIDLangPair kOverwriteMode_Pairs[] =
{
{ IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, 0x02000821 },
{ IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, 0x02000822 },
{ IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, 0x02000823 },
{ IDC_EXTRACT_RADIO_AUTO_RENAME, 0x02000824 },
{ IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, 0x02000825 }
};
#ifndef _SFX
static const NExtract::NPathMode::EEnum kPathModeButtonsVals[] =
static const
// NExtract::NPathMode::EEnum
int
kPathModeButtonsVals[] =
{
NExtract::NPathMode::kFullPathnames,
NExtract::NPathMode::kCurrentPathnames,
// NExtract::NPathMode::kCurrentPathnames,
NExtract::NPathMode::kNoPathnames
};
static const int kNumPathnamesButtons = sizeof(kPathModeButtons) / sizeof(kPathModeButtons[0]);
static const int kOverwriteButtons[] =
{
IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE,
@@ -56,7 +68,10 @@ static const int kOverwriteButtons[] =
IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING,
};
static const NExtract::NOverwriteMode::EEnum kOverwriteButtonsVals[] =
static const
int
// NExtract::NOverwriteMode::EEnum
kOverwriteButtonsVals[] =
{
NExtract::NOverwriteMode::kAskBefore,
NExtract::NOverwriteMode::kWithoutPrompt,
@@ -76,65 +91,11 @@ static const int kFilesButtons[] =
static const int kNumFilesButtons = sizeof(kFilesButtons) / sizeof(kFilesButtons[0]);
*/
void CExtractDialog::GetPathMode()
{
for (int i = 0; i < kNumPathnamesButtons; i++)
if(IsButtonCheckedBool(kPathModeButtons[i]))
{
PathMode = kPathModeButtonsVals[i];
return;
}
throw 1;
}
void CExtractDialog::SetPathMode()
{
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < kNumPathnamesButtons; i++)
if(PathMode == kPathModeButtonsVals[i])
{
CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1],
kPathModeButtons[i]);
return;
}
PathMode = kPathModeButtonsVals[0];
}
throw 1;
}
void CExtractDialog::GetOverwriteMode()
{
for (int i = 0; i < kNumOverwriteButtons; i++)
if(IsButtonCheckedBool(kOverwriteButtons[i]))
{
OverwriteMode = kOverwriteButtonsVals[i];
return;
}
throw 0;
}
void CExtractDialog::SetOverwriteMode()
{
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < kNumOverwriteButtons; i++)
if(OverwriteMode == kOverwriteButtonsVals[i])
{
CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1],
kOverwriteButtons[i]);
return;
}
OverwriteMode = kOverwriteButtonsVals[0];
}
throw 1;
}
/*
int CExtractDialog::GetFilesMode() const
{
for (int i = 0; i < kNumFilesButtons; i++)
if(IsButtonCheckedBool(kFilesButtons[i]))
if (IsButtonCheckedBool(kFilesButtons[i]))
return i;
throw 0;
}
@@ -147,18 +108,10 @@ static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_EXTRACT_EXTRACT_TO, 0x02000801 },
{ IDC_EXTRACT_PATH_MODE, 0x02000810 },
{ IDC_EXTRACT_RADIO_FULL_PATHNAMES, 0x02000811 },
{ IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, 0x02000812 },
{ IDC_EXTRACT_RADIO_NO_PATHNAMES, 0x02000813 },
{ IDC_EXTRACT_OVERWRITE_MODE, 0x02000820 },
{ IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, 0x02000821 },
{ IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, 0x02000822 },
{ IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, 0x02000823 },
{ IDC_EXTRACT_RADIO_AUTO_RENAME, 0x02000824 },
{ IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, 0x02000825 },
{ IDC_EXTRACT_FILES, 0x02000830 },
{ IDC_EXTRACT_RADIO_SELECTED_FILES, 0x02000831 },
{ IDC_EXTRACT_RADIO_ALL_FILES, 0x02000832 },
{ IDC_EXTRACT_OVERWRITE_MODE, 0x02000820 },
// { IDC_EXTRACT_FILES, 0x02000830 },
// { IDC_EXTRACT_RADIO_SELECTED_FILES, 0x02000831 },
// { IDC_EXTRACT_RADIO_ALL_FILES, 0x02000832 },
{ IDC_EXTRACT_PASSWORD, 0x02000802 },
{ IDC_EXTRACT_CHECK_SHOW_PASSWORD, 0x02000B02 },
{ IDOK, 0x02000702 },
@@ -174,6 +127,23 @@ static CIDLangPair kIDLangPairs[] =
static const int kHistorySize = 8;
#endif
#ifndef _SFX
static void AddComboItems(NWindows::NControl::CComboBox &combo, const CIDLangPair *items, int numItems, const int *values, int curVal)
{
int curSel = 0;
for (int i = 0; i < numItems; i++)
{
UString s = LangString(items[i].ControlID, items[i].LangID);
s.Replace(L"&", L"");
int index = (int)combo.AddString(s);
combo.SetItemData(index, i);
if (values[i] == curVal)
curSel = i;
}
combo.SetCurSel(curSel);
}
#endif
bool CExtractDialog::OnInit()
{
#ifdef LANG
@@ -186,18 +156,18 @@ bool CExtractDialog::OnInit()
_passwordControl.SetPasswordChar(TEXT('*'));
#endif
NExtract::CInfo extractionInfo;
NExtract::CInfo info;
#ifdef NO_REGISTRY
PathMode = NExtract::NPathMode::kFullPathnames;
OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
// extractionInfo.Paths = NExtract::NPathMode::kFullPathnames;
// info.Paths = NExtract::NPathMode::kFullPathnames;
#else
ReadExtractionInfo(extractionInfo);
CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, extractionInfo.ShowPassword);
info.Load();
CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, info.ShowPassword);
UpdatePasswordControl();
PathMode = extractionInfo.PathMode;
OverwriteMode = extractionInfo.OverwriteMode;
PathMode = info.PathMode;
OverwriteMode = info.OverwriteMode;
#endif
_path.Attach(GetItem(IDC_EXTRACT_COMBO_PATH));
@@ -205,22 +175,26 @@ bool CExtractDialog::OnInit()
_path.SetText(DirectoryPath);
#ifndef NO_REGISTRY
for(int i = 0; i < extractionInfo.Paths.Size() && i < kHistorySize; i++)
_path.AddString(extractionInfo.Paths[i]);
for (int i = 0; i < info.Paths.Size() && i < kHistorySize; i++)
_path.AddString(info.Paths[i]);
#endif
/*
if(extractionInfo.Paths.Size() > 0)
if (info.Paths.Size() > 0)
_path.SetCurSel(0);
else
_path.SetCurSel(-1);
*/
#ifndef _SFX
SetPathMode();
SetOverwriteMode();
_pathMode.Attach(GetItem(IDC_EXTRACT_COMBO_PATH_MODE));
AddComboItems(_pathMode, kPathMode_Pairs, sizeof(kPathMode_Pairs) / sizeof(kPathMode_Pairs[0]),
kPathModeButtonsVals, PathMode);
_overwriteMode.Attach(GetItem(IDC_EXTRACT_COMBO_OVERWRITE_MODE));
AddComboItems(_overwriteMode, kOverwriteMode_Pairs, sizeof(kOverwriteMode_Pairs) / sizeof(kOverwriteMode_Pairs[0]),
kOverwriteButtonsVals, OverwriteMode);
/*
CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1],
@@ -233,11 +207,15 @@ bool CExtractDialog::OnInit()
#endif
HICON icon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON));
SetIcon(ICON_BIG, icon);
// CWindow filesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
// filesWindow.Enable(_enableFilesButton);
// UpdateWildCardState();
NormalizePosition();
return CModalDialog::OnInit();
}
@@ -284,7 +262,7 @@ void CExtractDialog::OnButtonSetPath()
_path.GetText(currentPath);
UString title = LangStringSpec(IDS_EXTRACT_SET_FOLDER, 0x02000881);
UString resultPath;
if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
if (!MyBrowseForFolder(HWND(*this), title, currentPath, resultPath))
return;
#ifndef NO_REGISTRY
_path.SetCurSel(-1);
@@ -294,7 +272,7 @@ void CExtractDialog::OnButtonSetPath()
void AddUniqueString(UStringVector &list, const UString &s)
{
for(int i = 0; i < list.Size(); i++)
for (int i = 0; i < list.Size(); i++)
if (s.CompareNoCase(list[i]) == 0)
return;
list.Add(s);
@@ -303,18 +281,21 @@ void AddUniqueString(UStringVector &list, const UString &s)
void CExtractDialog::OnOK()
{
#ifndef _SFX
GetPathMode();
GetOverwriteMode();
NExtract::NPathMode::EEnum pathMode2 = (NExtract::NPathMode::EEnum)kPathModeButtonsVals[_pathMode.GetItemData(_pathMode.GetCurSel())];
if (PathMode != NExtract::NPathMode::kCurrentPathnames ||
pathMode2 != NExtract::NPathMode::kFullPathnames)
PathMode = pathMode2;
OverwriteMode = (NExtract::NOverwriteMode::EEnum)kOverwriteButtonsVals[_overwriteMode.GetItemData(_overwriteMode.GetCurSel())];
// _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
_passwordControl.GetText(Password);
#endif
NExtract::CInfo extractionInfo;
extractionInfo.PathMode = PathMode;
extractionInfo.OverwriteMode = OverwriteMode;
extractionInfo.ShowPassword = (IsButtonChecked(
IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED);
NExtract::CInfo info;
info.PathMode = PathMode;
info.OverwriteMode = OverwriteMode;
info.ShowPassword = (IsButtonCheckedBool(IDC_EXTRACT_CHECK_SHOW_PASSWORD));
UString s;
@@ -325,10 +306,10 @@ void CExtractDialog::OnOK()
#else
int currentItem = _path.GetCurSel();
if(currentItem == CB_ERR)
if (currentItem == CB_ERR)
{
_path.GetText(s);
if(_path.GetCount() >= kHistorySize)
if (_path.GetCount() >= kHistorySize)
currentItem = _path.GetCount() - 1;
}
else
@@ -338,19 +319,19 @@ void CExtractDialog::OnOK()
s.Trim();
#ifndef _SFX
AddUniqueString(extractionInfo.Paths, s);
AddUniqueString(info.Paths, s);
#endif
DirectoryPath = s;
#ifndef NO_REGISTRY
for(int i = 0; i < _path.GetCount(); i++)
if(i != currentItem)
for (int i = 0; i < _path.GetCount(); i++)
if (i != currentItem)
{
UString sTemp;
_path.GetLBText(i, sTemp);
sTemp.Trim();
AddUniqueString(extractionInfo.Paths, sTemp);
AddUniqueString(info.Paths, sTemp);
}
SaveExtractionInfo(extractionInfo);
info.Save();
#endif
CModalDialog::OnOK();
}