mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 02:07:09 -06:00
3.13
This commit is contained in:
102
7zip/FileManager/Resource/LangPage/LangPage.cpp
Executable file
102
7zip/FileManager/Resource/LangPage/LangPage.cpp
Executable file
@@ -0,0 +1,102 @@
|
||||
// LangPage.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "resource.h"
|
||||
#include "LangPage.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/FileFind.h"
|
||||
|
||||
#include "../../RegistryUtils.h"
|
||||
#include "../../HelpUtils.h"
|
||||
#include "../../LangUtils.h"
|
||||
#include "../../ProgramLocation.h"
|
||||
|
||||
#include "../../MyLoadMenu.h"
|
||||
|
||||
static CIDLangPair kIDLangPairs[] =
|
||||
{
|
||||
{ IDC_LANG_STATIC_LANG, 0x01000401}
|
||||
};
|
||||
|
||||
static LPCWSTR kLangTopic = L"FM/options.htm#language";
|
||||
|
||||
bool CLangPage::OnInit()
|
||||
{
|
||||
_langWasChanged = false;
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
|
||||
_langCombo.Attach(GetItem(IDC_LANG_COMBO_LANG));
|
||||
|
||||
int index = _langCombo.AddString(TEXT("English (English)"));
|
||||
_langCombo.SetItemData(index, _paths.Size());
|
||||
_paths.Add(TEXT(""));
|
||||
_langCombo.SetCurSel(0);
|
||||
|
||||
UString folderPath;
|
||||
if (::GetProgramFolderPath(folderPath))
|
||||
{
|
||||
folderPath += L"Lang\\";
|
||||
NWindows::NFile::NFind::CEnumeratorW enumerator(folderPath + L"*.txt");
|
||||
NWindows::NFile::NFind::CFileInfoW fileInfo;
|
||||
while (enumerator.Next(fileInfo))
|
||||
{
|
||||
if (fileInfo.IsDirectory())
|
||||
continue;
|
||||
CLang lang;
|
||||
UString filePath = folderPath + fileInfo.Name;
|
||||
if (lang.Open(GetSystemString(filePath)))
|
||||
{
|
||||
UString name;
|
||||
UString englishName, nationalName;
|
||||
if (lang.GetMessage(0x00000000, englishName))
|
||||
name += englishName;
|
||||
if (lang.GetMessage(0x00000001, nationalName))
|
||||
{
|
||||
if (!nationalName.IsEmpty())
|
||||
{
|
||||
name += L" (";
|
||||
name += nationalName;
|
||||
name += L")";
|
||||
}
|
||||
}
|
||||
if (name.IsEmpty())
|
||||
name = fileInfo.Name;
|
||||
index = _langCombo.AddString(GetSystemString(name));
|
||||
_langCombo.SetItemData(index, _paths.Size());
|
||||
_paths.Add(GetSystemString(filePath));
|
||||
if (g_LangPath.CollateNoCase(GetSystemString(filePath)) == 0)
|
||||
_langCombo.SetCurSel(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
return CPropertyPage::OnInit();
|
||||
}
|
||||
|
||||
LONG CLangPage::OnApply()
|
||||
{
|
||||
int selectedIndex = _langCombo.GetCurSel();
|
||||
int pathIndex = _langCombo.GetItemData(selectedIndex);
|
||||
SaveRegLang(_paths[pathIndex]);
|
||||
ReloadLang();
|
||||
_langWasChanged = true;
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
void CLangPage::OnNotifyHelp()
|
||||
{
|
||||
ShowHelpWindow(NULL, kLangTopic); // change it
|
||||
}
|
||||
|
||||
bool CLangPage::OnCommand(int code, int itemID, LPARAM param)
|
||||
{
|
||||
if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
|
||||
{
|
||||
Changed();
|
||||
return true;
|
||||
}
|
||||
return CPropertyPage::OnCommand(code, itemID, param);
|
||||
}
|
||||
|
||||
23
7zip/FileManager/Resource/LangPage/LangPage.h
Executable file
23
7zip/FileManager/Resource/LangPage/LangPage.h
Executable file
@@ -0,0 +1,23 @@
|
||||
// LangPage.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __LANGPAGE_H
|
||||
#define __LANGPAGE_H
|
||||
|
||||
#include "Windows/Control/PropertyPage.h"
|
||||
#include "Windows/Control/ComboBox.h"
|
||||
|
||||
class CLangPage: public NWindows::NControl::CPropertyPage
|
||||
{
|
||||
NWindows::NControl::CComboBox _langCombo;
|
||||
CSysStringVector _paths;
|
||||
public:
|
||||
bool _langWasChanged;
|
||||
virtual bool OnInit();
|
||||
virtual void OnNotifyHelp();
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM param);
|
||||
virtual LONG OnApply();
|
||||
};
|
||||
|
||||
#endif
|
||||
19
7zip/FileManager/Resource/LangPage/resource.h
Executable file
19
7zip/FileManager/Resource/LangPage/resource.h
Executable file
@@ -0,0 +1,19 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
#define IDD_LANG 900
|
||||
|
||||
#define IDC_LANG_STATIC_LANG 1000
|
||||
#define IDC_LANG_COMBO_LANG 1001
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 135
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
99
7zip/FileManager/Resource/LangPage/resource.rc
Executable file
99
7zip/FileManager/Resource/LangPage/resource.rc
Executable file
@@ -0,0 +1,99 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Russian resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
|
||||
#pragma code_page(1251)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Russian resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_LANG DIALOG DISCARDABLE 0, 0, 210, 154
|
||||
STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Language"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Language:",IDC_LANG_STATIC_LANG,7,7,196,8
|
||||
COMBOBOX IDC_LANG_COMBO_LANG,7,20,146,124,CBS_DROPDOWNLIST |
|
||||
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_LANG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 203
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 147
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user