This commit is contained in:
Igor Pavlov
2015-01-03 00:00:00 +00:00
committed by Kornel Lesiński
parent 7e021179cd
commit 0713a3ab80
153 changed files with 2744 additions and 1485 deletions

View File

@@ -1004,7 +1004,7 @@ STDMETHODIMP CFSFolder::Rename(UInt32 index, const wchar_t *newName, IProgress *
STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,IProgress *progress)
{
RINOK(progress->SetTotal(numItems));
int prevDeletedFileIndex = -1;
// int prevDeletedFileIndex = -1;
for (UInt32 i = 0; i < numItems; i++)
{
// Sleep(200);
@@ -1025,7 +1025,7 @@ STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,IProgress
{
const CDirItem &fi = Files[index];
const FString fullPath = _path + GetRelPath(fi);
prevDeletedFileIndex = index;
// prevDeletedFileIndex = index;
if (fi.IsDir())
result = RemoveDirWithSubItems(fullPath);
else

View File

@@ -260,7 +260,7 @@ static HRESULT FsCopyFile(
&writeAskResult));
if (IntToBool(writeAskResult))
{
FString destPathNew = us2fs(destPathResult);
FString destPathNew = us2fs((const wchar_t *)(BSTR)destPathResult);
RINOK(callback->SetCurrentFilePath(fs2us(srcPath)));
if (!FsCopyFile(srcPath, destPathNew, callback, completedSize))
{
@@ -351,7 +351,7 @@ static HRESULT FsMoveFile(
&writeAskResult));
if (IntToBool(writeAskResult))
{
FString destPathNew = us2fs(destPathResult);
FString destPathNew = us2fs((const wchar_t *)(BSTR)destPathResult);
RINOK(callback->SetCurrentFilePath(fs2us(srcPath)));
if (!FsMoveFile(srcPath, destPathNew, callback, completedSize))
{

View File

@@ -2,24 +2,28 @@
#include "StdAfx.h"
#include "HelpUtils.h"
#if defined(UNDER_CE) || !defined(_WIN32)
void ShowHelpWindow(HWND, LPCWSTR)
{
}
#else
#include <HtmlHelp.h>
#include "../../../Common/StringConvert.h"
#include "../../../Windows/DLL.h"
#include "HelpUtils.h"
static LPCWSTR kHelpFileName = L"7-zip.chm::/";
#ifdef UNDER_CE
void ShowHelpWindow(HWND, LPCWSTR)
{
}
#else
void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile)
{
FString path = NWindows::NDLL::GetModuleDirPrefix();
HtmlHelp(hwnd, GetSystemString(fs2us(path) + kHelpFileName + topicFile), HH_DISPLAY_TOPIC, NULL);
HtmlHelp(hwnd, GetSystemString(fs2us(path) + kHelpFileName + topicFile), HH_DISPLAY_TOPIC, 0);
}
#endif

View File

@@ -3,6 +3,8 @@
#ifndef __MY_WINDOWS_NEW_H
#define __MY_WINDOWS_NEW_H
#ifdef _MSC_VER
#include <ShObjIdl.h>
#ifndef __ITaskbarList3_INTERFACE_DEFINED__
@@ -70,3 +72,5 @@ struct ITaskbarList3: public ITaskbarList2
#endif
#endif
#endif

View File

@@ -577,6 +577,10 @@ public:
bool _processTimerMem;
CPanel &_panel;
CDisableTimerProcessing(const CDisableTimerProcessing &);
CDisableTimerProcessing& operator=(const CDisableTimerProcessing &);
public:
CDisableTimerProcessing(CPanel &panel): _panel(panel) { Disable(); }
@@ -590,7 +594,6 @@ public:
{
_panel._processTimer = _processTimerMem;
}
CDisableTimerProcessing& operator=(const CDisableTimerProcessing &) {; }
};
class CDisableNotify
@@ -599,6 +602,10 @@ public:
bool _processStatusBarMem;
CPanel &_panel;
CDisableNotify(const CDisableNotify &);
CDisableNotify& operator=(const CDisableNotify &);
public:
CDisableNotify(CPanel &panel): _panel(panel) { Disable(); }
@@ -620,7 +627,6 @@ public:
_panel._processNotify = _processNotifyMem;
_panel._processStatusBar = _processStatusBarMem;
}
CDisableNotify& operator=(const CDisableNotify &) {; }
};
// bool _passwordIsDefined;

View File

@@ -1137,11 +1137,11 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
return;
CProcess process;
HRESULT res;
/* HRESULT res; */
if (editMode)
res = StartEditApplication(fs2us(tempFilePath), useEditor, (HWND)*this, process);
/* res = */ StartEditApplication(fs2us(tempFilePath), useEditor, (HWND)*this, process);
else
res = StartApplication(fs2us(tempDirNorm), fs2us(tempFilePath), (HWND)*this, process);
/* res = */ StartApplication(fs2us(tempDirNorm), fs2us(tempFilePath), (HWND)*this, process);
if ((HANDLE)process == 0)
return;

View File

@@ -91,12 +91,12 @@ HRESULT CPanel::InitColumns()
ReadListViewInfo();
PROPID sortID;
// PROPID sortID;
/*
if (_listViewInfo.SortIndex >= 0)
sortID = _listViewInfo.Columns[_listViewInfo.SortIndex].PropID;
*/
sortID = _listViewInfo.SortID;
// sortID = _listViewInfo.SortID;
_ascending = _listViewInfo.Ascending;

View File

@@ -640,6 +640,10 @@ bool CPanel::InvokePluginCommand(int id)
return InvokePluginCommand(id, _sevenZipContextMenu, _systemContextMenu);
}
#if defined(_MSC_VER) && !defined(UNDER_CE)
#define use_CMINVOKECOMMANDINFOEX
#endif
bool CPanel::InvokePluginCommand(int id,
IContextMenu *sevenZipContextMenu, IContextMenu *systemContextMenu)
{
@@ -650,7 +654,7 @@ bool CPanel::InvokePluginCommand(int id,
else
offset = id - kSevenZipStartMenuID;
#ifdef UNDER_CE
#ifndef use_CMINVOKECOMMANDINFOEXR
CMINVOKECOMMANDINFO
#else
CMINVOKECOMMANDINFOEX
@@ -659,7 +663,7 @@ bool CPanel::InvokePluginCommand(int id,
memset(&commandInfo, 0, sizeof(commandInfo));
commandInfo.cbSize = sizeof(commandInfo);
commandInfo.fMask = 0
#ifndef UNDER_CE
#ifdef use_CMINVOKECOMMANDINFOEXR
| CMIC_MASK_UNICODE
#endif
;
@@ -669,7 +673,7 @@ bool CPanel::InvokePluginCommand(int id,
CSysString currentFolderSys = GetSystemString(_currentFolderPrefix);
commandInfo.lpDirectory = (LPCSTR)(LPCTSTR)(currentFolderSys);
commandInfo.nShow = SW_SHOW;
#ifndef UNDER_CE
#ifdef use_CMINVOKECOMMANDINFOEXR
commandInfo.lpParametersW = NULL;
commandInfo.lpTitle = "";
commandInfo.lpVerbW = (LPCWSTR)(MAKEINTRESOURCEW(offset));

View File

@@ -194,15 +194,15 @@ void CPanel::DeleteItems(bool NON_CE_VAR(toRecycleBin))
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res;
// int res;
#ifdef _UNICODE
res = ::SHFileOperationW(&fo);
/* res = */ ::SHFileOperationW(&fo);
#else
SHFileOperationWP shFileOperationW = (SHFileOperationWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
if (shFileOperationW == 0)
return;
res = shFileOperationW(&fo);
/* res = */ shFileOperationW(&fo);
#endif
}
}
@@ -529,7 +529,7 @@ void CPanel::ChangeComment()
LangString(IDS_COMMENT2, dlg.Static);
if (dlg.Create(GetParent()) != IDOK)
return;
NCOM::CPropVariant propVariant = dlg.Value;
NCOM::CPropVariant propVariant = (const wchar_t *)dlg.Value;
CDisableNotify disableNotify(*this);
HRESULT result = folderOperations->SetProperty(realIndex, kpidComment, &propVariant, NULL);

View File

@@ -97,7 +97,7 @@ void CPanel::SetSortRawStatus()
int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
if (lpData == NULL)
if (lpData == 0)
return 0;
CPanel *panel = (CPanel*)lpData;
@@ -189,7 +189,7 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
if (lpData == NULL) return 0;
if (lpData == 0) return 0;
if (lParam1 == kParentIndex) return -1;
if (lParam2 == kParentIndex) return 1;

View File

@@ -1,207 +0,0 @@
// PluginsPage.cpp
#include "StdAfx.h"
#include "Common/MyCom.h"
#include "Windows/DLL.h"
#include "HelpUtils.h"
#include "LangUtils.h"
#include "PluginsPage.h"
#include "PluginsPageRes.h"
#include "ProgramLocation.h"
#include "PluginInterface.h"
static const UInt32 kLangIDs[] =
{
IDT_PLUGINS_PLUGINS,
IDB_PLUGINS_OPTIONS
};
static LPCWSTR kPluginsTopic = L"FM/options.htm#plugins";
bool CPluginsPage::OnInit()
{
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
_listView.Attach(GetItem(IDL_PLUGINS));
UINT32 newFlags = /* LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
_listView.SetExtendedListViewStyle(newFlags, newFlags);
_listView.InsertColumn(0, L"Plugins", 50);
ReadFileFolderPluginInfoList(_plugins);
_listView.SetRedraw(false);
// _listView.DeleteAllItems();
for (int i = 0; i < _plugins.Size(); i++)
{
const CPluginInfo &p = _plugins[i];
if (!p.OptionsClassIDDefined)
continue;
LVITEMW item;
item.iItem = i;
item.mask = LVIF_TEXT | LVIF_STATE;
UString pluginName = p.Name;
item.pszText = (WCHAR *)(const WCHAR *)pluginName;
item.state = 0;
item.stateMask = UINT(-1);
item.iSubItem = 0;
_listView.InsertItem(&item);
_listView.SetCheckState(i, true);
}
_listView.SetRedraw(true);
if (_listView.GetItemCount() > 0)
{
UINT state = LVIS_SELECTED | LVIS_FOCUSED;
_listView.SetItemState(0, state, state);
}
_listView.SetColumnWidthAuto(0);
return CPropertyPage::OnInit();
}
LONG CPluginsPage::OnApply()
{
/*
int selectedIndex = m_Lang.GetCurSel();
int aPathIndex = m_Lang.GetItemData(selectedIndex);
SaveRegLang(m_Paths[aPathIndex]);
ReloadLang();
*/
return PSNRET_NOERROR;
}
void CPluginsPage::OnNotifyHelp()
{
ShowHelpWindow(NULL, kPluginsTopic);
}
bool CPluginsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
{
case IDB_PLUGINS_OPTIONS:
OnButtonOptions();
break;
default:
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
}
return true;
}
class CPluginOptionsCallback:
public IPluginOptionsCallback,
public CMyUnknownImp
{
UString _pluginName;
public:
MY_UNKNOWN_IMP
STDMETHOD(GetProgramFolderPath)(BSTR *value);
STDMETHOD(GetProgramPath)(BSTR *Value);
STDMETHOD(GetRegistryCUPath)(BSTR *Value);
void Init(const UString &pluginName)
{ _pluginName = pluginName; }
};
STDMETHODIMP CPluginOptionsCallback::GetProgramFolderPath(BSTR *value)
{
*value = 0;
UString folder;
if (!::GetProgramFolderPath(folder))
return E_FAIL;
return StringToBstr(folder, value);
}
static UString GetDefaultProgramName()
{
return L"7zFM.exe";
}
STDMETHODIMP CPluginOptionsCallback::GetProgramPath(BSTR *value)
{
*value = 0;
UString folder;
if (!::GetProgramFolderPath(folder))
return E_FAIL;
return StringToBstr(folder + GetDefaultProgramName(), value);
}
STDMETHODIMP CPluginOptionsCallback::GetRegistryCUPath(BSTR *value)
{
return StringToBstr(UString(L"Software"
WSTRING_PATH_SEPARATOR L"7-Zip"
WSTRING_PATH_SEPARATOR L"FM"
WSTRING_PATH_SEPARATOR L"Plugins"
WSTRING_PATH_SEPARATOR) + _pluginName, value);
}
void CPluginsPage::OnButtonOptions()
{
int index = _listView.GetSelectionMark();
if (index < 0)
return;
CPluginInfo pluginInfo = _plugins[index];
if (!pluginInfo.OptionsClassIDDefined)
{
MessageBoxW(*this, L"There are no options", L"7-Zip", 0);
return;
}
NWindows::NDLL::CLibrary lib;
CMyComPtr<IPluginOptions> pluginOptions;
if (!lib.Load(pluginInfo.FilePath))
{
MessageBoxW(*this, L"Can't load plugin", L"7-Zip", 0);
return;
}
typedef UINT32 (WINAPI * CreateObjectPointer)(const GUID *clsID, const GUID *interfaceID, void **outObject);
CreateObjectPointer createObject = (CreateObjectPointer)lib.GetProc("CreateObject");
if (createObject == NULL)
{
MessageBoxW(*this, L"Incorrect plugin", L"7-Zip", 0);
return;
}
if (createObject(&pluginInfo.OptionsClassID, &IID_IPluginOptions, (void **)&pluginOptions) != S_OK)
{
MessageBoxW(*this, L"There are no options", L"7-Zip", 0);
return;
}
CPluginOptionsCallback *callbackSpec = new CPluginOptionsCallback;
CMyComPtr<IPluginOptionsCallback> callback(callbackSpec);
callbackSpec->Init(pluginInfo.Name);
pluginOptions->PluginOptions(*this, callback);
}
bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
{
if (lParam->hwndFrom == HWND(_listView) && lParam->code == LVN_ITEMCHANGED)
{
const NMLISTVIEW *aNMListView = (const NMLISTVIEW *)lParam;
if ((aNMListView->uChanged & LVIF_STATE) != 0)
{
UINT oldState = aNMListView->uOldState & LVIS_STATEIMAGEMASK;
UINT newState = aNMListView->uNewState & LVIS_STATEIMAGEMASK;
if (oldState != newState)
Changed();
}
return true;
}
return CPropertyPage::OnNotify(controlID, lParam);
}
/*
bool CPluginsPage::OnCommand(int code, int itemID, LPARAM lParam)
{
if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
{
Changed();
return true;
}
return CPropertyPage::OnCommand(code, itemID, lParam);
}
*/

View File

@@ -1,26 +0,0 @@
// PluginsPage.h
#include "Windows/Control/ListView.h"
#ifndef __PLUGINSPAGE_H
#define __PLUGINSPAGE_H
#include "Windows/Control/PropertyPage.h"
#include "Windows/Control/ComboBox.h"
#include "RegistryPlugins.h"
class CPluginsPage: public NWindows::NControl::CPropertyPage
{
NWindows::NControl::CListView _listView;
CObjectVector<CPluginInfo> _plugins;
public:
virtual bool OnInit();
virtual void OnNotifyHelp();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnButtonOptions();
virtual LONG OnApply();
virtual bool OnNotify(UINT controlID, LPNMHDR lParam);
};
#endif

View File

@@ -1,15 +0,0 @@
#include "PluginsPageRes.h"
#include "../../GuiCommon.rc"
#define xc 96
#define yc 80
IDD_PLUGINS MY_PAGE
CAPTION "Plugins"
BEGIN
LTEXT "&Plugins:", IDC_PLUGINS_STATIC_PLUGINS, m, m, xc, 8
CONTROL "List1", IDC_PLUGINS_LIST, "SysListView32",
LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
m, 20, xc, 40
PUSHBUTTON "Options...", IDC_PLUGINS_BUTTON_OPTIONS, m, by, bxs, bys
END

View File

@@ -1,4 +0,0 @@
#define IDD_PLUGINS 999
#define IDT_PLUGINS_PLUGINS 999
#define IDL_PLUGINS 999
#define IDB_PLUGINS_OPTIONS 999

View File

@@ -54,7 +54,7 @@ bool CProgressDialog::OnInit()
_dialogCreatedEvent.Set();
#ifdef LANG
LangSetDlgItemsText(*this, NULL, 0);
LangSetDlgItems(*this, NULL, 0);
#endif
m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));

View File

@@ -238,16 +238,20 @@ CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true), MainWindow
throw 1334987;
if (_createDialogEvent.Create() != S_OK)
throw 1334987;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&_taskbarList);
if (_taskbarList)
_taskbarList->HrInit();
#endif
}
#ifndef _SFX
CProgressDialog::~CProgressDialog()
{
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
SetTaskbarProgressState(TBPF_NOPROGRESS);
#endif
AddToTitle(L"");
}
void CProgressDialog::AddToTitle(LPCWSTR s)
@@ -264,6 +268,7 @@ void CProgressDialog::AddToTitle(LPCWSTR s)
void CProgressDialog::SetTaskbarProgressState()
{
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
if (_taskbarList && _hwndForTaskbar)
{
TBPFLAG tbpFlags;
@@ -273,6 +278,7 @@ void CProgressDialog::SetTaskbarProgressState()
tbpFlags = _errorsWereDisplayed ? TBPF_ERROR: TBPF_NORMAL;
SetTaskbarProgressState(tbpFlags);
}
#endif
}
static const unsigned kTitleFileNameSizeLimit = 36;
@@ -543,8 +549,10 @@ void CProgressDialog::SetProgressPos(UInt64 pos)
pos - _progressBar_Pos >= (_progressBar_Range >> 10))
{
m_ProgressBar.SetPos(_progressConv.Count(pos));
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
if (_taskbarList && _hwndForTaskbar)
_taskbarList->SetProgressValue(_hwndForTaskbar, pos, _progressBar_Range);
#endif
_progressBar_Pos = pos;
}
}
@@ -935,7 +943,9 @@ INT_PTR CProgressDialog::Create(const UString &title, NWindows::CThread &thread,
bool CProgressDialog::OnExternalCloseMessage()
{
// it doesn't work if there is MessageBox.
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
SetTaskbarProgressState(TBPF_NOPROGRESS);
#endif
// AddToTitle(L"Finished ");
// SetText(L"Finished2 ");

View File

@@ -152,7 +152,9 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
int _numMessages;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
CMyComPtr<ITaskbarList3> _taskbarList;
#endif
HWND _hwndForTaskbar;
UInt32 _prevTime;
@@ -190,11 +192,13 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
bool _externalCloseMessageWasReceived;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
void SetTaskbarProgressState(TBPFLAG tbpFlags)
{
if (_taskbarList && _hwndForTaskbar)
_taskbarList->SetProgressState(_hwndForTaskbar, tbpFlags);
}
#endif
void SetTaskbarProgressState();
void UpdateStatInfo(bool showAll);

View File

@@ -165,7 +165,7 @@ bool CSystemPage::OnInit()
#if NUM_EXT_GROUPS > 1
{
ci.iSubItem = 2;
ci.pszText = TEXT("All Users");
ci.pszText = (LPTSTR)TEXT("All Users");
_listView.InsertColumn(2, &ci);
}
#endif