mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-17 04:11:51 -06:00
4.44 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
804edc5756
commit
d9666cf046
90
CPP/7zip/FileManager/Resource/LangPage/LangPage.cpp
Executable file
90
CPP/7zip/FileManager/Resource/LangPage/LangPage.cpp
Executable file
@@ -0,0 +1,90 @@
|
||||
// LangPage.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "resource.h"
|
||||
#include "LangPage.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#include "../../RegistryUtils.h"
|
||||
#include "../../HelpUtils.h"
|
||||
#include "../../LangUtils.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));
|
||||
|
||||
UString s = NWindows::MyLoadStringW(IDS_LANG_ENGLISH);
|
||||
s += L" (";
|
||||
s += NWindows::MyLoadStringW(IDS_LANG_NATIVE);
|
||||
s += L")";
|
||||
int index = (int)_langCombo.AddString(s);
|
||||
_langCombo.SetItemData(index, _paths.Size());
|
||||
_paths.Add(L"-");
|
||||
_langCombo.SetCurSel(0);
|
||||
|
||||
CObjectVector<CLangEx> langs;
|
||||
LoadLangs(langs);
|
||||
for (int i = 0; i < langs.Size(); i++)
|
||||
{
|
||||
const CLangEx &lang = langs[i];
|
||||
UString name;
|
||||
UString englishName, nationalName;
|
||||
if (lang.Lang.GetMessage(0x00000000, englishName))
|
||||
name = englishName;
|
||||
else
|
||||
name = lang.ShortName;
|
||||
if (lang.Lang.GetMessage(0x00000001, nationalName))
|
||||
{
|
||||
if (!nationalName.IsEmpty())
|
||||
{
|
||||
name += L" (";
|
||||
name += nationalName;
|
||||
name += L")";
|
||||
}
|
||||
}
|
||||
index = (int)_langCombo.AddString(name);
|
||||
_langCombo.SetItemData(index, _paths.Size());
|
||||
_paths.Add(lang.ShortName);
|
||||
if (g_LangID.CompareNoCase(lang.ShortName) == 0)
|
||||
_langCombo.SetCurSel(index);
|
||||
}
|
||||
return CPropertyPage::OnInit();
|
||||
}
|
||||
|
||||
LONG CLangPage::OnApply()
|
||||
{
|
||||
int selectedIndex = _langCombo.GetCurSel();
|
||||
int pathIndex = (int)_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);
|
||||
}
|
||||
21
CPP/7zip/FileManager/Resource/LangPage/LangPage.h
Executable file
21
CPP/7zip/FileManager/Resource/LangPage/LangPage.h
Executable file
@@ -0,0 +1,21 @@
|
||||
// LangPage.h
|
||||
|
||||
#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;
|
||||
UStringVector _paths;
|
||||
public:
|
||||
bool _langWasChanged;
|
||||
virtual bool OnInit();
|
||||
virtual void OnNotifyHelp();
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM param);
|
||||
virtual LONG OnApply();
|
||||
};
|
||||
|
||||
#endif
|
||||
16
CPP/7zip/FileManager/Resource/LangPage/StdAfx.h
Executable file
16
CPP/7zip/FileManager/Resource/LangPage/StdAfx.h
Executable file
@@ -0,0 +1,16 @@
|
||||
// stdafx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#define _WIN32_WINNT 0x0400
|
||||
|
||||
// it's for Windows NT supporting (MENUITEMINFOW)
|
||||
#define WINVER 0x0400
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "Common/NewHandler.h"
|
||||
|
||||
#endif
|
||||
6
CPP/7zip/FileManager/Resource/LangPage/resource.h
Executable file
6
CPP/7zip/FileManager/Resource/LangPage/resource.h
Executable file
@@ -0,0 +1,6 @@
|
||||
#define IDD_LANG 900
|
||||
#define IDS_LANG_ENGLISH 995
|
||||
#define IDS_LANG_NATIVE 996
|
||||
|
||||
#define IDC_LANG_STATIC_LANG 1000
|
||||
#define IDC_LANG_COMBO_LANG 1001
|
||||
21
CPP/7zip/FileManager/Resource/LangPage/resource.rc
Executable file
21
CPP/7zip/FileManager/Resource/LangPage/resource.rc
Executable file
@@ -0,0 +1,21 @@
|
||||
#include "resource.h"
|
||||
#include "../../../GuiCommon.rc"
|
||||
|
||||
#define xSize2 238
|
||||
#define ySize2 204
|
||||
#define xSize (xSize2 + marg + marg)
|
||||
#define ySize (ySize2 + marg + marg)
|
||||
|
||||
IDD_LANG DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
|
||||
CAPTION "Language"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
LTEXT "Language:", IDC_LANG_STATIC_LANG, marg, marg, xSize2, 8
|
||||
COMBOBOX IDC_LANG_COMBO_LANG, marg, 20, 146, ySize2 - 12, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_LANG_ENGLISH "English"
|
||||
IDS_LANG_NATIVE "English"
|
||||
END
|
||||
Reference in New Issue
Block a user