mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 20:11:38 -06:00
4.44 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
804edc5756
commit
d9666cf046
157
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.cpp
Executable file
157
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.cpp
Executable file
@@ -0,0 +1,157 @@
|
||||
// FoldersPage.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "resource.h"
|
||||
#include "FoldersPage.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/Shell.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#include "../../../FileManager/HelpUtils.h"
|
||||
#include "../../Common/ZipRegistry.h"
|
||||
|
||||
#include "../../../FileManager/LangUtils.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static CIDLangPair kIDLangPairs[] =
|
||||
{
|
||||
{ IDC_FOLDERS_STATIC_WORKING_FOLDER, 0x01000210 },
|
||||
{ IDC_FOLDERS_WORK_RADIO_SYSTEM, 0x01000211 },
|
||||
{ IDC_FOLDERS_WORK_RADIO_CURRENT, 0x01000212 },
|
||||
{ IDC_FOLDERS_WORK_RADIO_SPECIFIED, 0x01000213 },
|
||||
{ IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, 0x01000214 }
|
||||
};
|
||||
|
||||
static const int kWorkModeButtons[] =
|
||||
{
|
||||
IDC_FOLDERS_WORK_RADIO_SYSTEM,
|
||||
IDC_FOLDERS_WORK_RADIO_CURRENT,
|
||||
IDC_FOLDERS_WORK_RADIO_SPECIFIED
|
||||
};
|
||||
|
||||
static const int kNumWorkModeButtons = sizeof(kWorkModeButtons) / sizeof(kWorkModeButtons[0]);
|
||||
|
||||
bool CFoldersPage::OnInit()
|
||||
{
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
ReadWorkDirInfo(m_WorkDirInfo);
|
||||
|
||||
CheckButton(IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, m_WorkDirInfo.ForRemovableOnly);
|
||||
|
||||
CheckRadioButton(kWorkModeButtons[0], kWorkModeButtons[kNumWorkModeButtons - 1],
|
||||
kWorkModeButtons[m_WorkDirInfo.Mode]);
|
||||
|
||||
m_WorkPath.Init(*this, IDC_FOLDERS_WORK_EDIT_PATH);
|
||||
m_ButtonSetWorkPath.Init(*this, IDC_FOLDERS_WORK_BUTTON_PATH);
|
||||
|
||||
m_WorkPath.SetText(m_WorkDirInfo.Path);
|
||||
|
||||
MyEnableControls();
|
||||
|
||||
return CPropertyPage::OnInit();
|
||||
}
|
||||
|
||||
int CFoldersPage::GetWorkMode() const
|
||||
{
|
||||
for (int i = 0; i < kNumWorkModeButtons; i++)
|
||||
if(IsButtonCheckedBool(kWorkModeButtons[i]))
|
||||
return i;
|
||||
throw 0;
|
||||
}
|
||||
|
||||
void CFoldersPage::MyEnableControls()
|
||||
{
|
||||
bool enablePath = (GetWorkMode() == NWorkDir::NMode::kSpecified);
|
||||
m_WorkPath.Enable(enablePath);
|
||||
m_ButtonSetWorkPath.Enable(enablePath);
|
||||
}
|
||||
|
||||
void CFoldersPage::GetWorkDir(NWorkDir::CInfo &workDirInfo)
|
||||
{
|
||||
m_WorkPath.GetText(workDirInfo.Path);
|
||||
workDirInfo.ForRemovableOnly = IsButtonCheckedBool(IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE);
|
||||
workDirInfo.Mode = NWorkDir::NMode::EEnum(GetWorkMode());
|
||||
}
|
||||
|
||||
/*
|
||||
bool CFoldersPage::WasChanged()
|
||||
{
|
||||
NWorkDir::CInfo workDirInfo;
|
||||
GetWorkDir(workDirInfo);
|
||||
return (workDirInfo.Mode != m_WorkDirInfo.Mode ||
|
||||
workDirInfo.ForRemovableOnly != m_WorkDirInfo.ForRemovableOnly ||
|
||||
workDirInfo.Path.Compare(m_WorkDirInfo.Path) != 0);
|
||||
}
|
||||
*/
|
||||
|
||||
void CFoldersPage::ModifiedEvent()
|
||||
{
|
||||
Changed();
|
||||
/*
|
||||
if (WasChanged())
|
||||
Changed();
|
||||
else
|
||||
UnChanged();
|
||||
*/
|
||||
}
|
||||
|
||||
bool CFoldersPage::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
for (int i = 0; i < kNumWorkModeButtons; i++)
|
||||
if (buttonID == kWorkModeButtons[i])
|
||||
{
|
||||
MyEnableControls();
|
||||
ModifiedEvent();
|
||||
return true;
|
||||
}
|
||||
switch(buttonID)
|
||||
{
|
||||
case IDC_FOLDERS_WORK_BUTTON_PATH:
|
||||
OnFoldersWorkButtonPath();
|
||||
break;
|
||||
case IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE:
|
||||
break;
|
||||
default:
|
||||
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
ModifiedEvent();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFoldersPage::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
{
|
||||
if (code == EN_CHANGE && itemID == IDC_FOLDERS_WORK_EDIT_PATH)
|
||||
{
|
||||
ModifiedEvent();
|
||||
return true;
|
||||
}
|
||||
return CPropertyPage::OnCommand(code, itemID, lParam);
|
||||
}
|
||||
|
||||
void CFoldersPage::OnFoldersWorkButtonPath()
|
||||
{
|
||||
UString currentPath;
|
||||
m_WorkPath.GetText(currentPath);
|
||||
UString title = LangString(IDS_FOLDERS_SET_WORK_PATH_TITLE, 0x01000281);
|
||||
UString resultPath;
|
||||
if (NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
|
||||
m_WorkPath.SetText(resultPath);
|
||||
}
|
||||
|
||||
LONG CFoldersPage::OnApply()
|
||||
{
|
||||
GetWorkDir(m_WorkDirInfo);
|
||||
SaveWorkDirInfo(m_WorkDirInfo);
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
static LPCWSTR kFoldersTopic = L"fm/plugins/7-zip/options.htm#folders";
|
||||
|
||||
void CFoldersPage::OnNotifyHelp()
|
||||
{
|
||||
ShowHelpWindow(NULL, kFoldersTopic);
|
||||
}
|
||||
30
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.h
Executable file
30
CPP/7zip/UI/Explorer/FoldersPage/FoldersPage.h
Executable file
@@ -0,0 +1,30 @@
|
||||
// FoldersPage.h
|
||||
|
||||
#ifndef __FOLDERSPAGE_H
|
||||
#define __FOLDERSPAGE_H
|
||||
|
||||
#include "Windows/Control/PropertyPage.h"
|
||||
|
||||
#include "../../Common/ZipRegistry.h"
|
||||
|
||||
class CFoldersPage : public NWindows::NControl::CPropertyPage
|
||||
{
|
||||
NWorkDir::CInfo m_WorkDirInfo;
|
||||
|
||||
void MyEnableControls();
|
||||
void ModifiedEvent();
|
||||
NWindows::NControl::CDialogChildControl m_WorkPath;
|
||||
NWindows::NControl::CDialogChildControl m_ButtonSetWorkPath;
|
||||
void OnFoldersWorkButtonPath();
|
||||
int GetWorkMode() const;
|
||||
void GetWorkDir(NWorkDir::CInfo &workDirInfo);
|
||||
// bool WasChanged();
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
|
||||
virtual void OnNotifyHelp();
|
||||
virtual LONG OnApply();
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
};
|
||||
|
||||
#endif
|
||||
12
CPP/7zip/UI/Explorer/FoldersPage/resource.h
Executable file
12
CPP/7zip/UI/Explorer/FoldersPage/resource.h
Executable file
@@ -0,0 +1,12 @@
|
||||
#define IDD_FOLDERS 900
|
||||
|
||||
#define IDS_FOLDERS_SET_WORK_PATH_TITLE 103
|
||||
|
||||
#define IDC_FOLDERS_STATIC_WORKING_FOLDER 1001
|
||||
|
||||
#define IDC_FOLDERS_WORK_RADIO_SYSTEM 1011
|
||||
#define IDC_FOLDERS_WORK_RADIO_CURRENT 1012
|
||||
#define IDC_FOLDERS_WORK_RADIO_SPECIFIED 1013
|
||||
#define IDC_FOLDERS_WORK_EDIT_PATH 1014
|
||||
#define IDC_FOLDERS_WORK_BUTTON_PATH 1015
|
||||
#define IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE 1017
|
||||
36
CPP/7zip/UI/Explorer/FoldersPage/resource.rc
Executable file
36
CPP/7zip/UI/Explorer/FoldersPage/resource.rc
Executable file
@@ -0,0 +1,36 @@
|
||||
#include "resource.h"
|
||||
#include "../../../GuiCommon.rc"
|
||||
|
||||
#define xSize2 196
|
||||
#define ySize2 140
|
||||
#define xSize (xSize2 + marg + marg)
|
||||
#define ySize (ySize2 + marg + marg)
|
||||
|
||||
#define marg2 marg
|
||||
#define marg3 10
|
||||
#define gPos (marg + marg2)
|
||||
#define gSize (xSize2 - marg2 - marg2)
|
||||
#define gPos2 (gPos + marg3)
|
||||
|
||||
|
||||
IDD_FOLDERS DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
|
||||
CAPTION "Folders"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
GROUPBOX "&Working folder", IDC_FOLDERS_STATIC_WORKING_FOLDER, marg, marg, xSize2, 98
|
||||
CONTROL "&System temp folder", IDC_FOLDERS_WORK_RADIO_SYSTEM, "Button", BS_AUTORADIOBUTTON | WS_GROUP,
|
||||
gPos, 20, gSize, 10
|
||||
CONTROL "&Current", IDC_FOLDERS_WORK_RADIO_CURRENT, "Button", BS_AUTORADIOBUTTON,
|
||||
gPos, 34, gSize, 10
|
||||
CONTROL "Specified:", IDC_FOLDERS_WORK_RADIO_SPECIFIED, "Button", BS_AUTORADIOBUTTON,
|
||||
gPos, 48, gSize, 10
|
||||
EDITTEXT IDC_FOLDERS_WORK_EDIT_PATH, gPos2, 63, gSize - marg3 - bDotsSize - 10, 14, ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...", IDC_FOLDERS_WORK_BUTTON_PATH, xSize - marg - marg2 - bDotsSize, 63, bDotsSize, bYSize
|
||||
CONTROL "Use for removable drives only", IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
gPos, 87, gSize, 10
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_FOLDERS_SET_WORK_PATH_TITLE "Specify a location for temporary archive files."
|
||||
END
|
||||
Reference in New Issue
Block a user