Origial James Hoo mod to 16.04

This commit is contained in:
shunf4
2024-04-20 18:55:53 +08:00
parent 603abd5528
commit eaa3e8b48c
86 changed files with 55401 additions and 185 deletions

View File

@@ -0,0 +1,42 @@
// AboutEasy7ZipDialog.cpp
#include "StdAfx.h"
#include "AboutEasy7ZipDialog.h"
#include "HelpUtils.h"
static LPCWSTR kHelpTopic = L"start.htm";
bool CAboutEasy7ZipDialog::OnInit()
{
NormalizePosition();
return CModalDialog::OnInit();
}
void CAboutEasy7ZipDialog::OnHelp()
{
ShowHelpWindow(NULL, kHelpTopic);
}
bool CAboutEasy7ZipDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
LPCTSTR url;
switch(buttonID)
{
case IDC_ABOUT_BUTTON_EASY7ZIP_HOMEPAGE: url = TEXT("http://www.e7z.org/"); break;
default:
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
#ifdef UNDER_CE
SHELLEXECUTEINFO s;
memset(&s, 0, sizeof(s));
s.cbSize = sizeof(s);
s.lpFile = url;
::ShellExecuteEx(&s);
#else
::ShellExecute(NULL, NULL, url, NULL, NULL, SW_SHOWNORMAL);
#endif
return true;
}

View File

@@ -0,0 +1,18 @@
// AboutEasy7ZipDialog.h
#ifndef __ABOUT_EASY7ZIP_DIALOG_H
#define __ABOUT_EASY7ZIP_DIALOG_H
#include "AboutEasy7ZipDialogRes.h"
#include "../../../Windows/Control/Dialog.h"
class CAboutEasy7ZipDialog: public NWindows::NControl::CModalDialog
{
public:
virtual bool OnInit();
virtual void OnHelp();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_ABOUT_EASY_7ZIP, wndParent); }
};
#endif

View File

@@ -0,0 +1,16 @@
#include "AboutEasy7ZipDialogRes.h"
#include "../../GuiCommon.rc"
#include "../../MyVersion.h"
#define xc 165
#define yc 85
IDD_ABOUT_EASY_7ZIP DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "About Easy 7-Zip"
{
DEFPUSHBUTTON "OK", IDOK, bx1, by, bxs, bys
PUSHBUTTON MY_EASY7ZIP_HOMEPAGE, IDC_ABOUT_BUTTON_EASY7ZIP_HOMEPAGE, bx2, by, bxs, bys
LTEXT MY_EASY7ZIP_7ZIP_VERSION, -1, m, m, xc, 8
LTEXT MY_EASY7ZIP_COPYRIGHT, -1, m, m + 8 + 4, xc, 8
LTEXT "Easy 7-Zip is a free software made by James Hoo. The software was built based on 7-Zip 16.04.", -1, m, m + 8 + 4 + 8 + 12, xc, (yc - bys - 36)
}

View File

@@ -0,0 +1,2 @@
#define IDD_ABOUT_EASY_7ZIP 515
#define IDC_ABOUT_BUTTON_EASY7ZIP_HOMEPAGE 1001

View File

@@ -37,6 +37,8 @@ using namespace NName;
extern DWORD g_ComCtl32Version;
extern HINSTANCE g_hInstance;
extern bool g_bProcessError;
static CFSTR kTempDirPrefix = FTEXT("7zE");
void CPanelCallbackImp::OnTab()
@@ -542,6 +544,12 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices)
bool IsCorrectFsName(const UString &name);
static bool IsDirectory(LPCWSTR lpszPathFile)
{
DWORD dwAttr;
dwAttr = GetFileAttributesW(lpszPathFile);
return (dwAttr != (DWORD)-1) && ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) != 0);
}
/* Returns true, if path is path that can be used as path for File System functions
@@ -578,6 +586,9 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
CRecordVector<UInt32> indices;
UString destPath;
bool openOutputFolder;
bool deleteSourceFile;
bool close7Zip;
bool useDestPanel = false;
{
@@ -614,10 +625,15 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
LangString(move ? IDS_MOVE : IDS_COPY, copyDialog.Title);
LangString(move ? IDS_MOVE_TO : IDS_COPY_TO, copyDialog.Static);
copyDialog.Info = srcPanel.GetItemsInfoString(indices);
copyDialog.m_currentFolderPrefix = srcPanel._currentFolderPrefix;
if (copyDialog.Create(srcPanel.GetParent()) != IDOK)
return;
openOutputFolder = copyDialog.m_bOpenOutputFolder;
deleteSourceFile = copyDialog.m_bDeleteSourceFile;
close7Zip = copyDialog.m_bClose7Zip;
destPath = copyDialog.Value;
}
@@ -742,11 +758,13 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
useDestPanel = true;
AddUniqueStringToHeadOfList(copyFolders, destPath);
while (copyFolders.Size() > 20)
while (copyFolders.Size() > 30)
copyFolders.DeleteBack();
SaveCopyHistory(copyFolders);
}
g_bProcessError = false;
bool useSrcPanel = !useDestPanel || !srcPanel.Is_IO_FS_Folder();
bool useTemp = useSrcPanel && useDestPanel;
@@ -830,6 +848,62 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
disableNotify1.Restore();
disableNotify2.Restore();
srcPanel.SetFocusToList();
if (!g_bProcessError && result == S_OK)
{
if (openOutputFolder && IsDirectory(destPath))
{
StartApplicationDontWait(destPath, destPath, (HWND)_window);
}
if (deleteSourceFile)
{
DWORD dwAttr;
UString srcFilePath(srcPanel._currentFolderPrefix);
srcPanel.OpenParentFolder();
while (!srcFilePath.IsEmpty())
{
if (srcFilePath.Back() == '\\')
{
srcFilePath.DeleteBack();
}
dwAttr = GetFileAttributesW(srcFilePath);
if (dwAttr == INVALID_FILE_ATTRIBUTES)
{
int n = srcFilePath.ReverseFind(L'\\');
if (n != -1)
{
srcPanel.OpenParentFolder();
srcFilePath.ReleaseBuf_SetEnd(n);
}
else
{
break;
}
}
else if (dwAttr & FILE_ATTRIBUTE_ARCHIVE)
{
if (dwAttr & FILE_ATTRIBUTE_READONLY)
{
dwAttr &= (~FILE_ATTRIBUTE_READONLY);
SetFileAttributesW(srcFilePath, dwAttr);
}
::DeleteFileW(srcFilePath);
break;
}
else //if (dwAttr & FILE_ATTRIBUTE_DIRECTORY)
{
break;
}
} // while
}
if (close7Zip)
{
PostMessage (_window, WM_CLOSE, 0, 0);
}
}
}
void CApp::OnSetSameFolder(int srcPanelIndex)

View File

@@ -39,23 +39,23 @@ bool CComboDialog::OnInit()
return CModalDialog::OnInit();
}
bool CComboDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
{
int mx, my;
GetMargins(8, mx, my);
int bx1, bx2, by;
GetItemSizes(IDCANCEL, bx1, by);
GetItemSizes(IDOK, bx2, by);
int y = ySize - my - by;
int x = xSize - mx - bx1;
InvalidateRect(NULL);
MoveItem(IDCANCEL, x, y, bx1, by);
MoveItem(IDOK, x - mx - bx2, y, bx2, by);
ChangeSubWindowSizeX(_comboBox, xSize - mx * 2);
return false;
}
//bool CComboDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
//{
// int mx, my;
// GetMargins(8, mx, my);
// int bx1, bx2, by;
// GetItemSizes(IDCANCEL, bx1, by);
// GetItemSizes(IDOK, bx2, by);
// int y = ySize - my - by;
// int x = xSize - mx - bx1;
//
// InvalidateRect(NULL);
//
// MoveItem(IDCANCEL, x, y, bx1, by);
// MoveItem(IDOK, x - mx - bx2, y, bx2, by);
// ChangeSubWindowSizeX(_comboBox, xSize - mx * 2);
// return false;
//}
void CComboDialog::OnOK()
{

View File

@@ -13,7 +13,7 @@ class CComboDialog: public NWindows::NControl::CModalDialog
NWindows::NControl::CComboBox _comboBox;
virtual void OnOK();
virtual bool OnInit();
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
// virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
public:
// bool Sorted;
UString Title;

View File

@@ -1,14 +1,14 @@
#include "ComboDialogRes.h"
#include "../../GuiCommon.rc"
#define xc 240
#define xc 260
#define yc 64
IDD_COMBO DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
IDD_COMBO DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Combo"
{
LTEXT "", IDT_COMBO, m, m, xc, 8
COMBOBOX IDC_COMBO, m, 20, xc, 65, MY_COMBO_WITH_EDIT
COMBOBOX IDC_COMBO, m, 20, xc, 160, MY_COMBO_WITH_EDIT
OK_CANCEL
}

View File

@@ -9,12 +9,31 @@
#include "BrowseDialog.h"
#include "CopyDialog.h"
#include "Panel.h"
#include "ViewSettings.h"
#ifdef LANG
#include "LangUtils.h"
#endif
using namespace NWindows;
static bool IsFileExistentAndNotDir(const wchar_t * lpszFile)
{
DWORD dwAttr;
dwAttr = GetFileAttributesW(lpszFile);
return (dwAttr != INVALID_FILE_ATTRIBUTES)
&& ((dwAttr & FILE_ATTRIBUTE_ARCHIVE) != 0)
&& ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) == 0);
}
static bool IsDirectory(LPCWSTR lpszPathFile)
{
DWORD dwAttr;
dwAttr = GetFileAttributesW(lpszPathFile);
return (dwAttr != (DWORD)-1) && ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) != 0);
}
bool CCopyDialog::OnInit()
{
#ifdef LANG
@@ -23,6 +42,9 @@ bool CCopyDialog::OnInit()
_path.Attach(GetItem(IDC_COPY));
SetText(Title);
_freeSpace.Attach(GetItem(IDC_FREE_SPACE));
_freeSpace.SetText(L"");
NControl::CStatic staticContol;
staticContol.Attach(GetItem(IDT_COPY));
staticContol.SetText(Static);
@@ -33,8 +55,70 @@ bool CCopyDialog::OnInit()
FOR_VECTOR (i, Strings)
_path.AddString(Strings[i]);
_path.SetText(Value);
ShowPathFreeSpace(Value);
m_bOpenOutputFolder = ReadOptOpenOutputFolder();
m_bClose7Zip = ReadOptClose7Zip();
CheckButton(IDC_CHECK_OPEN_OUTPUT_FOLDER, m_bOpenOutputFolder);
CheckButton(IDC_CHECK_CLOSE_7ZIP, m_bClose7Zip);
SetItemText(IDT_COPY_INFO, Info);
NormalizeSize(true);
RECT rc;
GetWindowRect(&rc);
m_sizeMinWindow.cx = (RECT_SIZE_X(rc))*4/5;
m_sizeMinWindow.cy = (RECT_SIZE_Y(rc))*4/5;
/////////////////////////////////////////////////////////
m_strRealFileName.Empty();
if (IsDirectory(m_currentFolderPrefix))
{
EnableItem(IDC_COPY_ADD_FILE_NAME, false);
EnableItem(IDC_CHECK_DELETE_SOURCE_FILE, false);
}
else
{
while (!m_currentFolderPrefix.IsEmpty())
{
if (m_currentFolderPrefix.Back() == '\\')
{
m_currentFolderPrefix.DeleteBack();
}
if (IsFileExistentAndNotDir(m_currentFolderPrefix))
{
int n = m_currentFolderPrefix.ReverseFind(L'\\');
int m = m_currentFolderPrefix.ReverseFind(L'.');
if (n != -1)
{
n++;
}
else
{
n = 0;
}
if (m == -1 || m <= n) m = m_currentFolderPrefix.Len();
m_strRealFileName = m_currentFolderPrefix.Mid(n, m - n);
break;
}
else
{
int n = m_currentFolderPrefix.ReverseFind(L'\\');
if (n != -1)
{
m_currentFolderPrefix.ReleaseBuf_SetEnd(n);
}
else
{
break;
}
}
}
}
return CModalDialog::OnInit();
}
@@ -48,28 +132,49 @@ bool CCopyDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
int y = ySize - my - by;
int x = xSize - mx - bx1;
InvalidateRect(NULL);
// InvalidateRect(NULL);
{
RECT r;
GetClientRectOfItem(IDB_COPY_SET_PATH, r);
int bx = RECT_SIZE_X(r);
MoveItem(IDB_COPY_SET_PATH, xSize - mx - bx, r.top, bx, RECT_SIZE_Y(r));
ChangeSubWindowSizeX(_path, xSize - mx - mx - bx - mx);
GetClientRectOfItem(IDC_COPY_ADD_FILE_NAME, r);
int bxAddFileName = r.right - r.left;
int byAddFileName = r.bottom - r.top;
MoveItem(IDC_COPY_ADD_FILE_NAME, xSize - mx - bxAddFileName, r.top, bxAddFileName, byAddFileName, false);
GetClientRectOfItem(IDC_COPY_OPEN_PATH, r);
int bxOpen = r.right - r.left;
int byOpen = r.bottom - r.top;
MoveItem(IDC_COPY_OPEN_PATH, xSize - mx - bxOpen - mx/2 - bxAddFileName, r.top, bxOpen, byOpen, false);
GetClientRectOfItem(IDB_COPY_SET_PATH, r);
// int bx = RECT_SIZE_X(r);
int bxSet = RECT_SIZE_X(r);
int bySet = RECT_SIZE_Y(r);
// MoveItem(IDB_COPY_SET_PATH, xSize - mx - bx, r.top, bx, RECT_SIZE_Y(r));
// ChangeSubWindowSizeX(_path, xSize - mx - mx - bx - mx);
MoveItem(IDB_COPY_SET_PATH, xSize - mx - bxSet - bxOpen - mx - bxAddFileName, r.top, bxSet, bySet, false);
ChangeSubWindowSizeX(_path, xSize - mx - mx - bxSet - bxOpen - mx - mx/2 - bxAddFileName, false);
}
{
RECT r;
GetClientRectOfItem(IDT_COPY_INFO, r);
NControl::CStatic staticContol;
staticContol.Attach(GetItem(IDT_COPY_INFO));
// NControl::CStatic staticContol;
// staticContol.Attach(GetItem(IDT_COPY_INFO));
int yPos = r.top;
staticContol.Move(mx, yPos, xSize - mx * 2, y - 2 - yPos);
int xc = xSize - mx * 2;
// staticContol.Move(mx, yPos, xSize - mx * 2, y - 2 - yPos);
MoveItem(IDT_COPY_INFO, mx, yPos, xc, y - 2 - yPos, false);
GetClientRectOfItem(IDC_AFTER_EXTRACT, r);
MoveItem(IDC_AFTER_EXTRACT, mx, r.top, xc, r.bottom-r.top, false);
}
MoveItem(IDCANCEL, x, y, bx1, by);
MoveItem(IDOK, x - mx - bx2, y, bx2, by);
MoveItem(IDCANCEL, x, y, bx1, by, false);
MoveItem(IDOK, x - mx - bx2, y, bx2, by, false);
InvalidateRect(NULL);
return false;
}
@@ -80,6 +185,25 @@ bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
case IDB_COPY_SET_PATH:
OnButtonSetPath();
return true;
case IDC_COPY_OPEN_PATH:
OnButtonOpenPath();
return true;
case IDC_COPY_ADD_FILE_NAME:
OnButtonAddFileName();
return true;
case IDC_CHECK_OPEN_OUTPUT_FOLDER:
m_bOpenOutputFolder = IsButtonCheckedBool(IDC_CHECK_OPEN_OUTPUT_FOLDER);
return true;
case IDC_CHECK_DELETE_SOURCE_FILE:
m_bDeleteSourceFile = IsButtonCheckedBool(IDC_CHECK_DELETE_SOURCE_FILE);
return true;
case IDC_CHECK_CLOSE_7ZIP:
m_bClose7Zip = IsButtonCheckedBool(IDC_CHECK_CLOSE_7ZIP);
return true;
}
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
@@ -97,10 +221,191 @@ void CCopyDialog::OnButtonSetPath()
NFile::NName::NormalizeDirPathPrefix(resultPath);
_path.SetCurSel(-1);
_path.SetText(resultPath);
ShowPathFreeSpace(resultPath);
}
void CCopyDialog::OnOK()
{
SaveOptOpenOutputFolder(m_bOpenOutputFolder);
SaveOptClose7Zip(m_bClose7Zip);
_path.GetText(Value);
CModalDialog::OnOK();
}
void CCopyDialog::OnButtonOpenPath()
{
UString currentPath;
_path.GetText(currentPath);
if (IsDirectory(currentPath))
{
StartApplicationDontWait(currentPath, currentPath, (HWND)_window);
}
else
{
WCHAR szMsg[1024];
wsprintfW(szMsg, L"Folder \"%s\" is not available yet.\n\n"
L"Note: the program will create the folder automatically when extracting.", (LPCWSTR)currentPath);
MessageBoxW((HWND)_window, szMsg, L"7-Zip", MB_ICONEXCLAMATION);
}
}
void CCopyDialog::OnButtonAddFileName()
{
UString currentPath;
_path.GetText(currentPath);
currentPath.Trim();
if (currentPath.Back() == '\\')
{
currentPath.DeleteBack();
}
UString strLastDir;
int n = currentPath.ReverseFind(L'\\');
if (n != -1)
{
strLastDir = currentPath.Mid(n+1);
}
else
{
strLastDir = currentPath;
}
if (strLastDir != m_strRealFileName)
{
currentPath += L'\\';
currentPath += m_strRealFileName;
_path.SetText(currentPath);
}
_path.SetFocus();
}
bool CCopyDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_GETMINMAXINFO:
{
return OnGetMinMaxInfo((PMINMAXINFO)lParam);
}
}
return CModalDialog::OnMessage(message, wParam, lParam);
}
bool CCopyDialog::OnGetMinMaxInfo(PMINMAXINFO pMMI)
{
pMMI->ptMinTrackSize.x = m_sizeMinWindow.cx;
pMMI->ptMinTrackSize.y = m_sizeMinWindow.cy;
return false;
}
static int MakeByteSizeString64(wchar_t * lpszBuf, size_t ccBuf, unsigned __int64 n64Byte)
{
int nRet = 0;
if (n64Byte < 1000ui64)
{
// < 1K
nRet = swprintf(lpszBuf, ccBuf,
L"%I64d B", n64Byte);
}
else if (n64Byte < 1024000ui64) // 1024 * 1000
{
// 1K <= n64Byte < 1M
nRet = swprintf(lpszBuf, ccBuf,
L"%.1f KB", (double)n64Byte / 1024.0);
}
else if (n64Byte < 1048576000ui64) // 1024 * 1024 * 1000
{
// 1M <= n64Byte < 1G
nRet = swprintf(lpszBuf, ccBuf,
L"%.2f MB", (double)n64Byte / 1048576.0); // 1024 * 1024
}
else if (n64Byte < 1073741824000ui64) // 1024 * 1024 * 1024 * 1000
{
// 1 G <= n64Byte < 1T
nRet = swprintf(lpszBuf, ccBuf,
L"%.2f GB", (double)n64Byte / 1073741824.0); // 1024.0F * 1024.0F * 1024.0F
}
else
{
// n64Byte >= 1T
nRet = swprintf(lpszBuf, ccBuf,
L"%.2f TB", (double)n64Byte / 1099511627776.0);
// 1024.0F * 1024.0F * 1024.0F * 1024.0F
}
return nRet;
}
void CCopyDialog::ShowPathFreeSpace(UString & strPath)
{
bool bBadPath;
UString strText;
strText.Empty();
bBadPath = false;
strPath.Trim();
for (; !IsDirectory(strPath); )
{
int n = strPath.ReverseFind(L'\\');
if (n == -1)
{
bBadPath = true;
break;
}
else
{
strPath.ReleaseBuf_SetEnd(n);
}
}
if (!bBadPath)
{
unsigned __int64 n64FreeBytesAvailable;
unsigned __int64 n64TotalNumberOfBytes;
unsigned __int64 n64TotalNumberOfFreeBytes;
if (GetDiskFreeSpaceExW(strPath, (PULARGE_INTEGER)&n64FreeBytesAvailable,
(PULARGE_INTEGER)&n64TotalNumberOfBytes, (PULARGE_INTEGER)&n64TotalNumberOfFreeBytes))
{
wchar_t szFreeBytes[1024];
wchar_t szTotalBytes[1024];
MakeByteSizeString64(szFreeBytes, 1024-4, n64TotalNumberOfFreeBytes);
MakeByteSizeString64(szTotalBytes, 1024-4, n64TotalNumberOfBytes);
int nLen = swprintf(strText.GetBuf(1024), 1024-4, L"%s Free (Total: %s)", szFreeBytes, szTotalBytes);
strText.ReleaseBuf_SetEnd(nLen);
}
}
_freeSpace.SetText(strText);
}
bool CCopyDialog::OnCommand(int code, int itemID, LPARAM lParam)
{
if (itemID == IDC_COPY)
{
if (code == CBN_EDITCHANGE)
{
UString strPath;
_path.GetText(strPath);
ShowPathFreeSpace(strPath);
return true;
}
else if (code == CBN_SELCHANGE)
{
int nSel = _path.GetCurSel();
if (nSel != CB_ERR)
{
UString strPath;
_path.GetLBText(nSel, strPath);
ShowPathFreeSpace(strPath);
}
return true;
}
}
return CModalDialog::OnCommand(code, itemID, lParam);
}

View File

@@ -8,24 +8,46 @@
#include "CopyDialogRes.h"
const int kCopyDialog_NumInfoLines = 11;
const int kCopyDialog_NumInfoLines = 14;
class CCopyDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox _path;
NWindows::NControl::CStatic _freeSpace;
virtual void OnOK();
virtual bool OnInit();
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
void OnButtonSetPath();
void OnButtonOpenPath();
void OnButtonAddFileName();
bool OnButtonClicked(int buttonID, HWND buttonHWND);
bool OnCommand(int code, int itemID, LPARAM lParam);
bool OnGetMinMaxInfo(PMINMAXINFO pMMI);
void ShowPathFreeSpace(UString & strPath);
protected:
SIZE m_sizeMinWindow;
public:
CCopyDialog(): m_bOpenOutputFolder(false), m_bDeleteSourceFile(false), m_bClose7Zip (false) { m_sizeMinWindow.cx = 0; m_sizeMinWindow.cy = 0; }
UString Title;
UString Static;
UString Value;
UString Info;
UStringVector Strings;
bool m_bOpenOutputFolder;
bool m_bDeleteSourceFile;
bool m_bClose7Zip;
UString m_currentFolderPrefix;
UString m_strRealFileName;
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_COPY, parentWindow); }
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
};
#endif

View File

@@ -1,20 +1,75 @@
#include "CopyDialogRes.h"
#include "../../GuiCommon.rc"
#define xc 320
#define yc 144
//#define xc 320
//#define yc 144
//
//#define y 40
//
//IDD_COPY DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
//CAPTION "Copy"
//{
// LTEXT "", IDT_COPY, m, m, xc, 8
// COMBOBOX IDC_COPY, m, 20, xc - bxsDots - m, 65, MY_COMBO_WITH_EDIT
// PUSHBUTTON "...", IDB_COPY_SET_PATH, xs - m - bxsDots, 18, bxsDots, bys, WS_GROUP
// LTEXT "", IDT_COPY_INFO, m, y, xc, by - y - 1, SS_NOPREFIX | SS_LEFTNOWORDWRAP
// OK_CANCEL
//}
#define y 40
#define xc 340
#define yc 190
#define y 78
#define OPEN_XS 28
#define FILENAME_XS 40
#define SPACE_XS 4
#define FILENAME_X (xs - m - FILENAME_XS)
#define OPEN_X (FILENAME_X - OPEN_XS - SPACE_XS)
#define DOTS_X (OPEN_X - bxsDots - SPACE_XS)
#define PATH_Y (m + 12)
#define PATH_XS (DOTS_X - m - SPACE_XS)
#define FREE_SPACE_Y (PATH_Y + 15)
#define AFTER_EXTRACTION_Y (FREE_SPACE_Y + 12)
#define OPTION_SPACE 10
#define OPEN_OUTPUT_FOLDER_X (m + 6)
#define OPEN_OUTPUT_FOLDER_XS 80
#define OPEN_OUTPUT_FOLDER_Y (AFTER_EXTRACTION_Y + 12)
#define DELETE_SOURCE_X (OPEN_OUTPUT_FOLDER_X + OPEN_OUTPUT_FOLDER_XS + OPTION_SPACE)
#define DELETE_SOURCE_XS 88
#define CLOSE_7ZIP_X (DELETE_SOURCE_X + DELETE_SOURCE_XS + OPTION_SPACE)
#define CLOSE_7ZIP_XS 54
#define INFO_Y (AFTER_EXTRACTION_Y + 27 + 4)
#define INFO_YS (by - m - 12 - 15 - 12 - 27 - 4 - 1)
IDD_COPY DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
CAPTION "Copy"
{
LTEXT "", IDT_COPY, m, m, xc, 8
COMBOBOX IDC_COPY, m, 20, xc - bxsDots - m, 65, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COPY_SET_PATH, xs - m - bxsDots, 18, bxsDots, bys, WS_GROUP
LTEXT "", IDT_COPY_INFO, m, y, xc, by - y - 1, SS_NOPREFIX | SS_LEFTNOWORDWRAP
LTEXT "", IDT_COPY, m, m, xc, 9
COMBOBOX IDC_COPY, m, PATH_Y, PATH_XS, 160, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COPY_SET_PATH, DOTS_X, PATH_Y - 1, bxsDots, bys - 1, WS_GROUP
PUSHBUTTON "&Open", IDC_COPY_OPEN_PATH, OPEN_X, PATH_Y - 1, OPEN_XS, bys - 1, WS_GROUP
PUSHBUTTON "&Filename", IDC_COPY_ADD_FILE_NAME, FILENAME_X, PATH_Y - 1, FILENAME_XS, bys - 1, WS_GROUP
LTEXT "", IDC_FREE_SPACE, m, FREE_SPACE_Y, xc, 9
GROUPBOX "After extraction completes successfully", IDC_AFTER_EXTRACT, m, AFTER_EXTRACTION_Y, xc, 27
CONTROL "O&pen output folder", IDC_CHECK_OPEN_OUTPUT_FOLDER, MY_CHECKBOX, OPEN_OUTPUT_FOLDER_X, OPEN_OUTPUT_FOLDER_Y, OPEN_OUTPUT_FOLDER_XS, 10
CONTROL "&Delete source archive", IDC_CHECK_DELETE_SOURCE_FILE, MY_CHECKBOX, DELETE_SOURCE_X, OPEN_OUTPUT_FOLDER_Y, DELETE_SOURCE_XS, 10
CONTROL "&Close 7-Zip", IDC_CHECK_CLOSE_7ZIP, MY_CHECKBOX, CLOSE_7ZIP_X, OPEN_OUTPUT_FOLDER_Y, CLOSE_7ZIP_XS, 10
LTEXT "", IDT_COPY_INFO, m, INFO_Y, xc, INFO_YS, SS_NOPREFIX | SS_LEFTNOWORDWRAP
OK_CANCEL
}
#undef xc
#undef yc

View File

@@ -5,4 +5,12 @@
#define IDB_COPY_SET_PATH 102
#define IDT_COPY_INFO 103
#define IDC_CHECK_OPEN_OUTPUT_FOLDER 104
#define IDC_COPY_OPEN_PATH 105
#define IDC_FREE_SPACE 106
#define IDC_COPY_ADD_FILE_NAME 107
#define IDC_CHECK_DELETE_SOURCE_FILE 108
#define IDC_CHECK_CLOSE_7ZIP 109
#define IDC_AFTER_EXTRACT 110
#define IDS_SET_FOLDER 6007

View File

@@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FM", "FM.vcproj", "{2628FF64-E1E1-4CB7-B588-08DE7145B630}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugU|Win32 = DebugU|Win32
DebugU|x64 = DebugU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseU|Win32 = ReleaseU|Win32
ReleaseU|x64 = ReleaseU|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|Win32.ActiveCfg = Debug|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|Win32.Build.0 = Debug|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|x64.ActiveCfg = Debug|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|x64.Build.0 = Debug|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|Win32.ActiveCfg = DebugU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|Win32.Build.0 = DebugU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|x64.ActiveCfg = DebugU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|x64.Build.0 = DebugU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|Win32.ActiveCfg = Release|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|Win32.Build.0 = Release|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|x64.ActiveCfg = Release|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|x64.Build.0 = Release|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|Win32.Build.0 = ReleaseU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|x64.ActiveCfg = ReleaseU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|x64.Build.0 = ReleaseU|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

File diff suppressed because it is too large Load Diff

View File

@@ -42,6 +42,11 @@ bool CListViewDialog::OnInit()
_listView.SetColumnWidthAuto(0);
StringsWereChanged = false;
RECT rc;
GetWindowRect(&rc);
m_sizeMinWindow.cx = (RECT_SIZE_X(rc))*3/4;
m_sizeMinWindow.cy = (RECT_SIZE_Y(rc))*3/4;
NormalizeSize();
return CModalDialog::OnInit();
}
@@ -62,15 +67,15 @@ bool CListViewDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
rect.top = y - my;
InvalidateRect(&rect);
*/
InvalidateRect(NULL);
MoveItem(IDCANCEL, x, y, bx1, by);
MoveItem(IDOK, x - mx - bx2, y, bx2, by);
MoveItem(IDCANCEL, x, y, bx1, by, false);
MoveItem(IDOK, x - mx - bx2, y, bx2, by, false);
/*
if (wParam == SIZE_MAXSHOW || wParam == SIZE_MAXIMIZED || wParam == SIZE_MAXHIDE)
mx = 0;
*/
_listView.Move(mx, my, xSize - mx * 2, y - my * 2);
_listView.Move(mx, my, xSize - mx * 2, y - my * 2, false);
InvalidateRect(NULL);
return false;
}
@@ -141,3 +146,23 @@ void CListViewDialog::OnOK()
FocusedItemIndex = _listView.GetFocusedItem();
CModalDialog::OnOK();
}
bool CListViewDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_GETMINMAXINFO:
{
return OnGetMinMaxInfo((PMINMAXINFO)lParam);
}
}
return CModalDialog::OnMessage(message, wParam, lParam);
}
bool CListViewDialog::OnGetMinMaxInfo(PMINMAXINFO pMMI)
{
pMMI->ptMinTrackSize.x = m_sizeMinWindow.cx;
pMMI->ptMinTrackSize.y = m_sizeMinWindow.cy;
return false;
}

View File

@@ -15,6 +15,9 @@ class CListViewDialog: public NWindows::NControl::CModalDialog
virtual bool OnInit();
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
virtual bool OnNotify(UINT controlID, LPNMHDR header);
bool OnGetMinMaxInfo(PMINMAXINFO pMMI);
protected:
SIZE m_sizeMinWindow;
public:
UString Title;
bool DeleteIsAllowed;
@@ -24,7 +27,8 @@ public:
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_LISTVIEW, wndParent); }
CListViewDialog(): DeleteIsAllowed(false) {}
CListViewDialog(): DeleteIsAllowed(false) { m_sizeMinWindow.cx = 0; m_sizeMinWindow.cy = 0; }
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
};
#endif

View File

@@ -55,6 +55,12 @@ bool CMessagesDialog::OnInit()
_messageList.SetColumnWidthAuto(0);
_messageList.SetColumnWidthAuto(1);
RECT rc;
GetWindowRect(&rc);
m_sizeMinWindow.cx = (RECT_SIZE_X(rc))*3/4;
m_sizeMinWindow.cy = (RECT_SIZE_Y(rc))*3/4;
NormalizeSize();
return CModalDialog::OnInit();
}
@@ -68,9 +74,28 @@ bool CMessagesDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
int y = ySize - my - by;
int x = xSize - mx - bx;
InvalidateRect(NULL);
MoveItem(IDOK, x, y, bx, by);
_messageList.Move(mx, my, xSize - mx * 2, y - my * 2);
MoveItem(IDOK, x, y, bx, by, false);
_messageList.Move(mx, my, xSize - mx * 2, y - my * 2, false);
InvalidateRect(NULL);
return false;
}
bool CMessagesDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_GETMINMAXINFO:
{
return OnGetMinMaxInfo((PMINMAXINFO)lParam);
}
}
return CModalDialog::OnMessage(message, wParam, lParam);
}
bool CMessagesDialog::OnGetMinMaxInfo(PMINMAXINFO pMMI)
{
pMMI->ptMinTrackSize.x = m_sizeMinWindow.cx;
pMMI->ptMinTrackSize.y = m_sizeMinWindow.cy;
return false;
}

View File

@@ -16,10 +16,15 @@ class CMessagesDialog: public NWindows::NControl::CModalDialog
void AddMessage(LPCWSTR message);
virtual bool OnInit();
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
bool OnGetMinMaxInfo(PMINMAXINFO pMMI);
protected:
SIZE m_sizeMinWindow;
public:
const UStringVector *Messages;
CMessagesDialog() { m_sizeMinWindow.cx = 0; m_sizeMinWindow.cy = 0; }
INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_MESSAGES, parent); }
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
};
#endif

View File

@@ -10,6 +10,7 @@
#include "../Common/CompressCall.h"
#include "AboutDialog.h"
#include "AboutEasy7ZipDialog.h"
#include "App.h"
#include "HelpUtils.h"
#include "LangUtils.h"
@@ -622,6 +623,12 @@ bool OnMenuCommand(HWND hWnd, int id)
dialog.Create(hWnd);
break;
}
case IDM_ABOUT_EASY_7ZIP:
{
CAboutEasy7ZipDialog dialog;
dialog.Create(hWnd);
break;
}
default:
{
if (id >= kOpenBookmarkMenuID && id <= kOpenBookmarkMenuID + 9)

View File

@@ -189,6 +189,7 @@ enum MyMessages
};
UString GetFolderPath(IFolderFolder *folder);
void StartApplicationDontWait(const UString &dir, const UString &path, HWND window);
class CPanel;

View File

@@ -879,7 +879,7 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
return S_OK;
}
static void StartApplicationDontWait(const UString &dir, const UString &path, HWND window)
void StartApplicationDontWait(const UString &dir, const UString &path, HWND window)
{
CProcess process;
StartApplication(dir, path, window, process);

View File

@@ -306,7 +306,7 @@ void CPanel::Properties()
}
}
}
::MessageBoxW(*(this), message, LangString(IDS_PROPERTIES), MB_OK);
::MessageBoxW(*(this), message, LangString(IDS_PROPERTIES), MB_OK | MB_ICONINFORMATION);
}
}

View File

@@ -422,6 +422,9 @@ void CApp::Combine()
AddInfoFileName(info, fs2us(combiner.Names.Back()));
}
bool openOutputFolder;
bool deleteSourceFile;
bool close7Zip;
{
CCopyDialog copyDialog;
copyDialog.Value = path;
@@ -430,9 +433,13 @@ void CApp::Combine()
copyDialog.Title += srcPanel.GetItemRelPath(index);
LangString(IDS_COMBINE_TO, copyDialog.Static);
copyDialog.Info = info;
copyDialog.m_currentFolderPrefix = srcPanel.GetItemFullPath(index);
if (copyDialog.Create(srcPanel.GetParent()) != IDOK)
return;
path = copyDialog.Value;
openOutputFolder = copyDialog.m_bOpenOutputFolder;
deleteSourceFile = copyDialog.m_bDeleteSourceFile;
close7Zip = copyDialog.m_bClose7Zip;
}
NName::NormalizeDirPathPrefix(path);
@@ -479,6 +486,37 @@ void CApp::Combine()
if (combiner.Create(title, _window) != 0)
return;
if (openOutputFolder)
{
StartApplicationDontWait(path, path, (HWND)_window);
}
if (deleteSourceFile)
{
DWORD dwAttr;
UString strFilePath;
for (i = 0; i < combiner.Names.Size(); i++)
{
strFilePath = srcPath + combiner.Names[i];
dwAttr = GetFileAttributesW(strFilePath);
if ((dwAttr != INVALID_FILE_ATTRIBUTES)
&& (dwAttr & FILE_ATTRIBUTE_ARCHIVE))
{
if (dwAttr & FILE_ATTRIBUTE_READONLY)
{
dwAttr &= (~FILE_ATTRIBUTE_READONLY);
SetFileAttributesW(strFilePath, dwAttr);
}
::DeleteFileW(strFilePath);
}
}
}
if (close7Zip)
{
PostMessage (_window, WM_CLOSE, 0, 0);
}
}
RefreshTitleAlways();

View File

@@ -9,16 +9,19 @@
#include "../../../Windows/ErrorMsg.h"
#include "../GUI/ExtractRes.h"
#include "resourceGui.h"
#include "LangUtils.h"
#include "DialogSize.h"
#include "ProgressDialog2.h"
#include "ProgressDialog2Res.h"
#include "ProgressDialog2IconRes.h"
using namespace NWindows;
extern HINSTANCE g_hInstance;
bool g_bProcessError = false;
static const UINT_PTR kTimerID = 3;
@@ -66,6 +69,38 @@ static const UInt32 kLangIDs_Colon[] =
#endif
//////////////////
#define WM_TRAY_ICON_NOTIFY (WM_APP+10)
#define ID_SYSTRAY_ICON 100
BOOL SetSysTray(HWND hDlg,
DWORD dwMessage,
UINT uID,
UINT uFlags,
UINT uCallbackMessage,
HICON hIcon,
const wchar_t * pszTip)
{
NOTIFYICONDATAW tnd;
ZeroMemory(&tnd, sizeof(NOTIFYICONDATAW));
tnd.cbSize = sizeof(NOTIFYICONDATAW);
tnd.hWnd = hDlg;
tnd.uID = uID;
tnd.uFlags = uFlags;
tnd.uCallbackMessage = uCallbackMessage;
tnd.hIcon = hIcon;
if (pszTip != NULL && *pszTip != 0)
{
::lstrcpynW(tnd.szTip, pszTip, sizeof(tnd.szTip) / sizeof(WCHAR));
}
return Shell_NotifyIconW(dwMessage, &tnd);
}
#define UNDEFINED_VAL ((UInt64)(Int64)-1)
#define INIT_AS_UNDEFINED(v) v = UNDEFINED_VAL;
@@ -238,6 +273,13 @@ void CProgressSync::AddError_Code_Name(DWORD systemError, const wchar_t *name)
CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true), MainWindow(0)
{
for (int i = 0; i < 15; i++)
{
m_hIconSysTrayArray[i] = NULL;
}
m_nSysTrayIconArrayID = -1;
m_hSysTrayMenu = NULL;
_isDir = false;
_numMessages = 0;
@@ -372,6 +414,7 @@ bool CProgressDialog::OnInit()
LangString(IDS_PROGRESS_FOREGROUND, _foreground_String);
LangString(IDS_CONTINUE, _continue_String);
LangString(IDS_PROGRESS_PAUSED, _paused_String);
LangString(IDS_CANCEL, cancelString);
SetText(_title);
SetPauseText();
@@ -412,6 +455,11 @@ bool CProgressDialog::OnInit()
SetTaskbarProgressState();
RECT rc;
GetWindowRect(&rc);
m_sizeMinWindow.cx = (RECT_SIZE_X(rc))*2/3;
m_sizeMinWindow.cy = (RECT_SIZE_Y(rc))*3/4;
return CModalDialog::OnInit();
}
@@ -444,7 +492,7 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
sStep = r.top - my;
}
InvalidateRect(NULL);
// InvalidateRect(NULL);
int xSizeClient = xSize - mx * 2;
@@ -458,9 +506,19 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
int yPos = ySize - my - _buttonSizeY;
ChangeSubWindowSizeX(GetItem(IDT_PROGRESS_STATUS), xSize - mx * 2);
ChangeSubWindowSizeX(GetItem(IDT_PROGRESS_FILE_NAME), xSize - mx * 2);
ChangeSubWindowSizeX(GetItem(IDC_PROGRESS1), xSize - mx * 2);
ChangeSubWindowSizeX(GetItem(IDT_PROGRESS_STATUS), xSize - mx * 2, false);
// ChangeSubWindowSizeX(GetItem(IDT_PROGRESS_FILE_NAME), xSize - mx * 2);
{
int percent_width;
RECT rect;
GetClientRectOfItem(IDC_PROGRESS_PERCENT, rect);
percent_width = rect.right - rect.left;
MoveItem(IDC_PROGRESS_PERCENT, xSize - mx - percent_width, rect.top, percent_width, rect.bottom - rect.top, false);
ChangeSubWindowSizeX(GetItem(IDT_PROGRESS_FILE_NAME), xSize - (mx * 2) - percent_width, false);
}
ChangeSubWindowSizeX(GetItem(IDC_PROGRESS1), xSize - mx * 2, false);
int bSizeX = _buttonSizeX;
int mx2 = mx;
@@ -492,17 +550,17 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
xx -= bSizeX;
}
_messageList.Move(mx, y, xx, ySize2);
_messageList.Move(mx, y, xx, ySize2, false);
}
{
int xPos = xSize - mx;
xPos -= bSizeX;
MoveItem(IDCANCEL, xPos, yPos, bSizeX, _buttonSizeY);
MoveItem(IDCANCEL, xPos, yPos, bSizeX, _buttonSizeY, false);
xPos -= (mx2 + bSizeX);
MoveItem(IDB_PAUSE, xPos, yPos, bSizeX, _buttonSizeY);
MoveItem(IDB_PAUSE, xPos, yPos, bSizeX, _buttonSizeY, false);
xPos -= (mx2 + bSizeX);
MoveItem(IDB_PROGRESS_BACKGROUND, xPos, yPos, bSizeX, _buttonSizeY);
MoveItem(IDB_PROGRESS_BACKGROUND, xPos, yPos, bSizeX, _buttonSizeY, false);
}
int valueSize;
@@ -543,10 +601,11 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
yPos = my;
x = mx + gSize + padSize;
}
MoveItem(kIDs[i], x, yPos, labelSize, sY);
MoveItem(kIDs[i + 1], x + labelSize, yPos, valueSize, sY);
MoveItem(kIDs[i], x, yPos, labelSize, sY, false);
MoveItem(kIDs[i + 1], x + labelSize, yPos, valueSize, sY, false);
yPos += sStep;
}
InvalidateRect(NULL);
return false;
}
@@ -672,6 +731,39 @@ static UInt64 MyMultAndDiv(UInt64 mult1, UInt64 mult2, UInt64 divider)
return res;
}
void CProgressDialog::UpdateSysTrayIcon(bool bAddIcon, bool bUpdateTip)
{
int nNewIconID = (_prevPercentValue / 7) % 15;
bool bUpdateIcon = nNewIconID > m_nSysTrayIconArrayID;
if (bUpdateIcon || bUpdateTip || bAddIcon)
{
wchar_t szTip[64];
ConvertUInt64ToString(_prevPercentValue, szTip);
lstrcatW(szTip, L"%");
/*
#ifdef _DEBUG
wchar_t szDebug[1024];
swprintf(szDebug, 1024, L"Percent: %d; Icon: %d\n", _prevPercentValue, nNewIconID);
OutputDebugStringW(szDebug);
#endif
*/
UINT uFlags = NIF_TIP;
if (bUpdateIcon)
{
uFlags |= NIF_ICON;
}
if (!SetSysTray(_window, NIM_MODIFY, ID_SYSTRAY_ICON, uFlags, 0, m_hIconSysTrayArray[nNewIconID], szTip))
{
SetSysTray(_window, NIM_DELETE, ID_SYSTRAY_ICON, 0, 0, NULL, NULL);
SetSysTray(_window, NIM_ADD, ID_SYSTRAY_ICON, NIF_ICON | NIF_MESSAGE | NIF_TIP, WM_TRAY_ICON_NOTIFY,
m_hIconSysTrayArray[nNewIconID], szTip);
}
m_nSysTrayIconArrayID = nNewIconID;
}
}
void CProgressDialog::UpdateStatInfo(bool showAll)
{
UInt64 total, completed, totalFiles, completedFiles, inSize, outSize;
@@ -725,6 +817,37 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
ShowSize(IDT_PROGRESS_TOTAL_VAL, total, _totalBytes_Prev);
{
bool bPercentChanged = false;
UInt64 percent = 0;
{
if (IS_DEFINED_VAL(progressTotal))
{
percent = progressCompleted * 100;
if (progressTotal != 0)
percent /= progressTotal;
}
}
if (percent != _prevPercentValue)
{
_prevPercentValue = percent;
bPercentChanged = true;
}
if (bPercentChanged || titleFileName_Changed) SetTitleText();
if (bPercentChanged)
{
wchar_t szPercent[32];
ConvertUInt64ToString(percent, szPercent);
lstrcatW(szPercent, L"%");
SetItemText(IDC_PROGRESS_PERCENT, szPercent);
if (!_foreground && m_hIconSysTrayArray[0] != NULL)
{ // background
UpdateSysTrayIcon(false, true);
}
}
}
_elapsedTime += (curTime - _prevTime);
_prevTime = curTime;
UInt64 elapsedSec = _elapsedTime / 1000;
@@ -738,7 +861,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
SetItemText(IDT_PROGRESS_ELAPSED_VAL, s);
}
bool needSetTitle = false;
// bool needSetTitle = false;
if (elapsedChanged || showAll)
{
if (numErrors > _numPostedMessages)
@@ -806,22 +929,22 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
}
}
{
UInt64 percent = 0;
{
if (IS_DEFINED_VAL(progressTotal))
{
percent = progressCompleted * 100;
if (progressTotal != 0)
percent /= progressTotal;
}
}
if (percent != _prevPercentValue)
{
_prevPercentValue = percent;
needSetTitle = true;
}
}
//{
// UInt64 percent = 0;
// {
// if (IS_DEFINED_VAL(progressTotal))
// {
// percent = progressCompleted * 100;
// if (progressTotal != 0)
// percent /= progressTotal;
// }
// }
// if (percent != _prevPercentValue)
// {
// _prevPercentValue = percent;
// needSetTitle = true;
// }
//}
{
wchar_t s[64];
@@ -869,8 +992,8 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
}
}
if (needSetTitle || titleFileName_Changed)
SetTitleText();
// if (needSetTitle || titleFileName_Changed)
// SetTitleText();
if (status_Changed)
{
@@ -996,7 +1119,7 @@ bool CProgressDialog::OnExternalCloseMessage()
{
if (fm.OkMessage.Title.IsEmpty())
fm.OkMessage.Title = L"7-Zip";
MessageBoxW(*this, fm.OkMessage.Message, fm.OkMessage.Title, MB_OK);
MessageBoxW(*this, fm.OkMessage.Message, fm.OkMessage.Title, MB_OK | MB_ICONINFORMATION);
}
}
@@ -1011,10 +1134,58 @@ bool CProgressDialog::OnExternalCloseMessage()
return true;
}
bool CProgressDialog::CreateSysTrayMenu()
{
if (m_hSysTrayMenu != NULL) return true;
m_hSysTrayMenu = CreatePopupMenu();
AppendMenuW(m_hSysTrayMenu, MF_STRING, IDB_PROGRESS_BACKGROUND, _foreground_String);
AppendMenuW(m_hSysTrayMenu, MF_STRING, IDB_PAUSE, Sync.Get_Paused() ? _continue_String : _pause_String);
AppendMenuW(m_hSysTrayMenu, MF_STRING, IDCANCEL, cancelString);
return m_hSysTrayMenu != NULL;
}
bool CProgressDialog::OnTrayNotification(LPARAM lParam)
{
switch (lParam)
{
case WM_RBUTTONUP:
if (CreateSysTrayMenu())
{
POINT point;
::GetCursorPos(&point);
::TrackPopupMenu(m_hSysTrayMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, point.x, point.y, 0, _window, NULL);
// BUGFIX: See "PRB: Menus for Notification Icons Don't Work Correctly"
::PostMessage(_window, WM_NULL, 0, 0);
}
break;
case WM_LBUTTONUP:
OnPriorityButton();
break;
default:
break;
}
return false;
}
bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_GETMINMAXINFO:
{
return OnGetMinMaxInfo((PMINMAXINFO)lParam);
}
case WM_TRAY_ICON_NOTIFY:
{
return OnTrayNotification(lParam);
}
case kCloseMessage:
{
KillTimer(_timer);
@@ -1024,6 +1195,30 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
_externalCloseMessageWasReceived = true;
break;
}
if (!_foreground)
{ // background
SetSysTray(_window, NIM_DELETE, ID_SYSTRAY_ICON, 0, 0, NULL, NULL);
//#ifndef _SFX
if (MainWindow != 0)
{
ShowWindow(MainWindow, SW_SHOW);
}
//#endif
}
if (m_hIconSysTrayArray[0] != NULL)
{
for (int i = 0; i < 15; i++)
{
DestroyIcon(m_hIconSysTrayArray[i]);
m_hIconSysTrayArray[i] = NULL;
}
}
if (m_hSysTrayMenu != NULL)
{
::DestroyMenu(m_hSysTrayMenu);
m_hSysTrayMenu = NULL;
}
return OnExternalCloseMessage();
}
/*
@@ -1038,6 +1233,13 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
return CModalDialog::OnMessage(message, wParam, lParam);
}
bool CProgressDialog::OnGetMinMaxInfo(PMINMAXINFO pMMI)
{
pMMI->ptMinTrackSize.x = m_sizeMinWindow.cx;
pMMI->ptMinTrackSize.y = m_sizeMinWindow.cy;
return false;
}
void CProgressDialog::SetTitleText()
{
UString s;
@@ -1082,8 +1284,15 @@ void CProgressDialog::SetTitleText()
void CProgressDialog::SetPauseText()
{
SetItemText(IDB_PAUSE, Sync.Get_Paused() ? _continue_String : _pause_String);
LPCWSTR pszText = (Sync.Get_Paused() ? _continue_String : _pause_String);
SetItemText(IDB_PAUSE, pszText);
SetTitleText();
if (m_hSysTrayMenu != NULL)
{
ModifyMenuW(m_hSysTrayMenu, IDB_PAUSE, MF_BYCOMMAND, IDB_PAUSE, pszText);
}
}
void CProgressDialog::OnPauseButton()
@@ -1106,11 +1315,53 @@ void CProgressDialog::SetPriorityText()
SetTitleText();
}
bool CProgressDialog::LoadSysTrayIcons()
{
if (m_hIconSysTrayArray[0] != NULL) return true;
int id = IDI_SYSTRAY_0;
for (int n=0; n<15; n++, id++)
{
m_hIconSysTrayArray[n] = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
}
return m_hIconSysTrayArray[0] != NULL;
}
void CProgressDialog::OnPriorityButton()
{
_foreground = !_foreground;
#ifndef UNDER_CE
SetPriorityClass(GetCurrentProcess(), _foreground ? NORMAL_PRIORITY_CLASS: IDLE_PRIORITY_CLASS);
if (_foreground)
{
if (m_hIconSysTrayArray[0] != NULL)
{
//#ifndef _SFX
if (MainWindow != 0)
{
ShowWindow(MainWindow, SW_SHOW);
}
//#endif
Show(SW_SHOW);
SetSysTray(_window, NIM_DELETE, ID_SYSTRAY_ICON, 0, 0, NULL, NULL);
}
}
else
{ // background
if (LoadSysTrayIcons())
{
//#ifndef _SFX
if (MainWindow != 0)
{
ShowWindow(MainWindow, SW_HIDE);
}
//#endif
Show(SW_HIDE);
UpdateSysTrayIcon(true, true);
}
}
#endif
SetPriorityText();
}
@@ -1167,6 +1418,8 @@ void CProgressDialog::UpdateMessagesDialog()
}
if (!messages.IsEmpty())
{
g_bProcessError = true;
FOR_VECTOR (i, messages)
AddMessage(messages[i]);
if (_numAutoSizeMessages < 256 || GetNumDigits(_numPostedMessages) > GetNumDigits(_numAutoSizeMessages))
@@ -1197,11 +1450,11 @@ bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
if (!paused)
OnPauseButton();
_inCancelMessageBox = true;
int res = ::MessageBoxW(*this, LangString(IDS_PROGRESS_ASK_CANCEL), _title, MB_YESNOCANCEL);
int res = ::MessageBoxW(*this, LangString(IDS_PROGRESS_ASK_CANCEL), _title, MB_YESNO | MB_ICONQUESTION);
_inCancelMessageBox = false;
if (!paused)
OnPauseButton();
if (res == IDCANCEL || res == IDNO)
if (res == IDNO)
{
if (_externalCloseMessageWasReceived)
OnExternalCloseMessage();

View File

@@ -114,6 +114,7 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
UString _pause_String;
UString _continue_String;
UString _paused_String;
UString cancelString;
int _buttonSizeX;
int _buttonSizeY;
@@ -122,6 +123,10 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
UString _title;
HICON m_hIconSysTrayArray [15];
int m_nSysTrayIconArrayID;
HMENU m_hSysTrayMenu;
class CU64ToI32Converter
{
unsigned _numShiftBits;
@@ -192,6 +197,11 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
bool _inCancelMessageBox;
bool _externalCloseMessageWasReceived;
SIZE m_sizeMinWindow;
bool CreateSysTrayMenu();
bool LoadSysTrayIcons();
void UpdateSysTrayIcon(bool bAddIcon, bool bUpdateTip);
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
void SetTaskbarProgressState(TBPFLAG tbpFlags)
@@ -222,6 +232,8 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
void OnPriorityButton();
bool OnButtonClicked(int buttonID, HWND buttonHWND);
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
bool OnGetMinMaxInfo(PMINMAXINFO pMMI);
bool OnTrayNotification(LPARAM lParam);
void SetTitleText();
void ShowSize(int id, UInt64 val, UInt64 &prev);

View File

@@ -1,6 +1,8 @@
#include "ProgressDialog2Res.h"
#include "../../GuiCommon.rc"
#include "ProgressDialog2Icon.rc"
#undef DIALOG_ID
#define DIALOG_ID IDD_PROGRESS
#define xc 360
@@ -37,4 +39,5 @@ STRINGTABLE DISCARDABLE
IDS_CONTINUE "&Continue"
IDS_PROGRESS_ASK_CANCEL "Are you sure you want to cancel?"
IDS_CLOSE "&Close"
IDS_CANCEL "&Cancel"
}

View File

@@ -0,0 +1,19 @@
#include "ProgressDialog2IconRes.h"
IDI_SYSTRAY_0 ICON "../../UI/FileManager/trayico/tray00.ico"
IDI_SYSTRAY_1 ICON "../../UI/FileManager/trayico/tray01.ico"
IDI_SYSTRAY_2 ICON "../../UI/FileManager/trayico/tray02.ico"
IDI_SYSTRAY_3 ICON "../../UI/FileManager/trayico/tray03.ico"
IDI_SYSTRAY_4 ICON "../../UI/FileManager/trayico/tray04.ico"
IDI_SYSTRAY_5 ICON "../../UI/FileManager/trayico/tray05.ico"
IDI_SYSTRAY_6 ICON "../../UI/FileManager/trayico/tray06.ico"
IDI_SYSTRAY_7 ICON "../../UI/FileManager/trayico/tray07.ico"
IDI_SYSTRAY_8 ICON "../../UI/FileManager/trayico/tray08.ico"
IDI_SYSTRAY_9 ICON "../../UI/FileManager/trayico/tray09.ico"
IDI_SYSTRAY_10 ICON "../../UI/FileManager/trayico/tray10.ico"
IDI_SYSTRAY_11 ICON "../../UI/FileManager/trayico/tray11.ico"
IDI_SYSTRAY_12 ICON "../../UI/FileManager/trayico/tray12.ico"
IDI_SYSTRAY_13 ICON "../../UI/FileManager/trayico/tray13.ico"
IDI_SYSTRAY_14 ICON "../../UI/FileManager/trayico/tray14.ico"
//IDI_SYSTRAY_15 ICON "../../UI/FileManager/trayico/tray15.ico"
//IDI_SYSTRAY_16 ICON "../../UI/FileManager/trayico/tray16.ico"

View File

@@ -0,0 +1,17 @@
#define IDI_SYSTRAY_0 310
#define IDI_SYSTRAY_1 311
#define IDI_SYSTRAY_2 312
#define IDI_SYSTRAY_3 313
#define IDI_SYSTRAY_4 314
#define IDI_SYSTRAY_5 315
#define IDI_SYSTRAY_6 316
#define IDI_SYSTRAY_7 317
#define IDI_SYSTRAY_8 318
#define IDI_SYSTRAY_9 319
#define IDI_SYSTRAY_10 320
#define IDI_SYSTRAY_11 321
#define IDI_SYSTRAY_12 322
#define IDI_SYSTRAY_13 323
#define IDI_SYSTRAY_14 324
//#define IDI_SYSTRAY_15 325
//#define IDI_SYSTRAY_16 326

View File

@@ -3,6 +3,7 @@
#define IDS_CLOSE 408
#define IDS_CONTINUE 411
#define IDS_CANCEL 415
#define IDB_PROGRESS_BACKGROUND 444
#define IDS_PROGRESS_FOREGROUND 445
@@ -25,6 +26,7 @@
#define IDL_PROGRESS_MESSAGES 101
#define IDT_PROGRESS_FILE_NAME 102
#define IDT_PROGRESS_STATUS 103
#define IDC_PROGRESS_PERCENT 104
#define IDT_PROGRESS_PACKED_VAL 110
#define IDT_PROGRESS_FILES_VAL 111

View File

@@ -39,6 +39,7 @@
#define yc (z0 + z0s + bys)
#define percent_width 23
DIALOG_ID DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
CAPTION "Progress"
@@ -70,8 +71,9 @@ CAPTION "Progress"
RTEXT "", IDT_PROGRESS_PACKED_VAL, x3, y3, x3s, MY_TEXT_NOPREFIX
LTEXT "", IDT_PROGRESS_STATUS, m, z3, xc, MY_TEXT_NOPREFIX
CONTROL "", IDT_PROGRESS_FILE_NAME, "Static", SS_NOPREFIX | SS_LEFTNOWORDWRAP, m, z2, xc, z2s
CONTROL "", IDT_PROGRESS_FILE_NAME, "Static", SS_NOPREFIX | SS_LEFTNOWORDWRAP, m, z2, xc - percent_width, z2s
RTEXT "", IDC_PROGRESS_PERCENT, m + xc - percent_width, z2, percent_width, z2s, SS_NOPREFIX | SS_CENTERIMAGE
CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER, m, z1, xc, z1s
CONTROL "List1", IDL_PROGRESS_MESSAGES, "SysListView32",

View File

@@ -49,31 +49,31 @@ bool CSplitDialog::OnInit()
return CModalDialog::OnInit();
}
bool CSplitDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
{
int mx, my;
GetMargins(8, mx, my);
int bx1, bx2, by;
GetItemSizes(IDCANCEL, bx1, by);
GetItemSizes(IDOK, bx2, by);
int yPos = ySize - my - by;
int xPos = xSize - mx - bx1;
InvalidateRect(NULL);
{
RECT r;
GetClientRectOfItem(IDB_SPLIT_PATH, r);
int bx = RECT_SIZE_X(r);
MoveItem(IDB_SPLIT_PATH, xSize - mx - bx, r.top, bx, RECT_SIZE_Y(r));
ChangeSubWindowSizeX(_pathCombo, xSize - mx - mx - bx - mx);
}
MoveItem(IDCANCEL, xPos, yPos, bx1, by);
MoveItem(IDOK, xPos - mx - bx2, yPos, bx2, by);
return false;
}
//bool CSplitDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
//{
// int mx, my;
// GetMargins(8, mx, my);
// int bx1, bx2, by;
// GetItemSizes(IDCANCEL, bx1, by);
// GetItemSizes(IDOK, bx2, by);
// int yPos = ySize - my - by;
// int xPos = xSize - mx - bx1;
//
// InvalidateRect(NULL);
//
// {
// RECT r;
// GetClientRectOfItem(IDB_SPLIT_PATH, r);
// int bx = RECT_SIZE_X(r);
// MoveItem(IDB_SPLIT_PATH, xSize - mx - bx, r.top, bx, RECT_SIZE_Y(r));
// ChangeSubWindowSizeX(_pathCombo, xSize - mx - mx - bx - mx);
// }
//
// MoveItem(IDCANCEL, xPos, yPos, bx1, by);
// MoveItem(IDOK, xPos - mx - bx2, yPos, bx2, by);
//
// return false;
//}
bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{

View File

@@ -14,7 +14,7 @@ class CSplitDialog: public NWindows::NControl::CModalDialog
NWindows::NControl::CComboBox _volumeCombo;
virtual void OnOK();
virtual bool OnInit();
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
// virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
void OnButtonSetPath();
public:

View File

@@ -4,7 +4,7 @@
#define xc 288
#define yc 96
IDD_SPLIT DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
IDD_SPLIT DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Split File"
BEGIN
LTEXT "&Split to:", IDT_SPLIT_PATH, m, m, xc, 8

View File

@@ -6,9 +6,9 @@
/* we used 0x0400 for Windows NT supporting (MENUITEMINFOW)
But now menu problem is fixed. So it's OK to use 0x0500 (Windows 2000) */
// #define _WIN32_WINNT 0x0400
#define _WIN32_WINNT 0x0500
#define WINVER _WIN32_WINNT
//// #define _WIN32_WINNT 0x0400
//#define _WIN32_WINNT 0x0500
//#define WINVER _WIN32_WINNT
#include "../../../Common/Common.h"

View File

@@ -30,6 +30,9 @@ static const TCHAR *kFolderHistoryValueName = TEXT("FolderHistory");
static const TCHAR *kFastFoldersValueName = TEXT("FolderShortcuts");
static const TCHAR *kCopyHistoryValueName = TEXT("CopyHistory");
static const TCHAR *kOpenOutputFolderValueName = TEXT("OpenOutputFolder");
static const TCHAR *kClose7ZipValueName = TEXT("Close7Zip");
static NSynchronization::CCriticalSection g_CS;
#define Set32(p, v) SetUi32(((Byte *)p), v)
@@ -310,3 +313,39 @@ void AddUniqueStringToHeadOfList(UStringVector &list, const UString &s)
i++;
list.Insert(0, s);
}
void SaveOptOpenOutputFolder(bool bOpen)
{
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(kOpenOutputFolderValueName, bOpen);
}
bool ReadOptOpenOutputFolder()
{
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
return false;
bool bOpen;
if (key.QueryValue(kOpenOutputFolderValueName, bOpen) != ERROR_SUCCESS)
return false;
return bOpen;
}
void SaveOptClose7Zip(bool bClose7Zip)
{
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(kClose7ZipValueName, bClose7Zip);
}
bool ReadOptClose7Zip()
{
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
return false;
bool bOpen;
if (key.QueryValue(kClose7ZipValueName, bOpen) != ERROR_SUCCESS)
return false;
return bOpen;
}

View File

@@ -112,4 +112,10 @@ void ReadCopyHistory(UStringVector &folders);
void AddUniqueStringToHeadOfList(UStringVector &list, const UString &s);
void SaveOptOpenOutputFolder(bool bOpen);
bool ReadOptOpenOutputFolder();
void SaveOptClose7Zip(bool bClose7Zip);
bool ReadOptClose7Zip();
#endif

View File

@@ -93,6 +93,7 @@
#define IDM_HELP_CONTENTS 960
#define IDM_ABOUT 961
#define IDM_ABOUT_EASY_7ZIP 962
#define IDS_OPTIONS 2100

View File

@@ -124,15 +124,16 @@ BEGIN
#endif
MENUITEM SEPARATOR
MENUITEM "&About 7-Zip...", IDM_ABOUT
MENUITEM "&About Easy 7-Zip...", IDM_ABOUT_EASY_7ZIP
END
END
IDI_ICON ICON "../../UI/FileManager/FM.ico"
#ifndef UNDER_CE
1 24 MOVEABLE PURE "../../UI/FileManager/7zFM.exe.manifest"
#endif
//#ifndef UNDER_CE
//1 24 MOVEABLE PURE "../../UI/FileManager/7zFM.exe.manifest"
//#endif
IDB_ADD BITMAP "../../UI/FileManager/Add.bmp"
IDB_EXTRACT BITMAP "../../UI/FileManager/Extract.bmp"
@@ -237,6 +238,7 @@ BEGIN
END
#include "AboutDialog.rc"
#include "AboutEasy7ZipDialog.rc"
#include "BrowseDialog.rc"
#include "ComboDialog.rc"
#include "CopyDialog.rc"

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B