This commit is contained in:
Igor Pavlov
2003-12-11 00:00:00 +00:00
committed by Kornel Lesiński
commit 8c1b5c7b7e
982 changed files with 118799 additions and 0 deletions

View File

@@ -0,0 +1,161 @@
// EditPage.cpp
#include "StdAfx.h"
#include "resource.h"
#include "EditPage.h"
#include "Common/StringConvert.h"
#include "Windows/Defs.h"
// #include "Windows/FileFind.h"
// #include "Windows/FileDir.h"
#include "../../RegistryUtils.h"
#include "../../HelpUtils.h"
#include "../../LangUtils.h"
#include "../../ProgramLocation.h"
using namespace NWindows;
static CIDLangPair kIDLangPairs[] =
{
{ IDC_EDIT_STATIC_EDITOR, 0x03010201}
};
static LPCWSTR kEditTopic = L"FM/options.htm#editor";
bool CEditPage::OnInit()
{
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
_editorEdit.Attach(GetItem(IDC_EDIT_EDIT_EDITOR));
CSysString editorPath;
ReadRegEditor(editorPath);
_editorEdit.SetText(editorPath);
return CPropertyPage::OnInit();
}
LONG CEditPage::OnApply()
{
// int selectedIndex = _langCombo.GetCurSel();
// int pathIndex = _langCombo.GetItemData(selectedIndex);
// ReloadLang();
CSysString editorPath;
_editorEdit.GetText(editorPath);
SaveRegEditor(editorPath);
return PSNRET_NOERROR;
}
void CEditPage::OnNotifyHelp()
{
ShowHelpWindow(NULL, kEditTopic); // change it
}
bool CEditPage::OnButtonClicked(int aButtonID, HWND aButtonHWND)
{
switch(aButtonID)
{
case IDC_EDIT_BUTTON_SET:
{
OnSetEditorButton();
// if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, aResultPath))
// return;
return true;
}
}
return CPropertyPage::OnButtonClicked(aButtonID, aButtonHWND);
}
class CDoubleZeroStringList
{
CRecordVector<int> _indexes;
CSysString _string;
public:
void Add(LPCTSTR string);
void SetForBuffer(LPTSTR buffer);
};
const TCHAR kDelimiterSymbol = TEXT(' ');
void CDoubleZeroStringList::Add(LPCTSTR string)
{
_string += string;
_indexes.Add(_string.Length());
_string += kDelimiterSymbol;
}
void CDoubleZeroStringList::SetForBuffer(LPTSTR buffer)
{
lstrcpy(buffer, _string);
for (int i = 0; i < _indexes.Size(); i++)
buffer[_indexes[i]] = TEXT('\0');
}
void CEditPage::OnSetEditorButton()
{
OPENFILENAME info;
info.lStructSize = sizeof(info);
info.hwndOwner = HWND(*this);
info.hInstance = 0;
const int kBufferSize = MAX_PATH * 2;
TCHAR buffer[kBufferSize + 1];
CSysString editorPath;
_editorEdit.GetText(editorPath);
lstrcpy(buffer, editorPath);
const int kFilterBufferSize = MAX_PATH;
TCHAR filterBuffer[kFilterBufferSize];
CDoubleZeroStringList doubleZeroStringList;
CSysString string = TEXT("*.exe");
doubleZeroStringList.Add(string);
doubleZeroStringList.Add(string);
doubleZeroStringList.SetForBuffer(filterBuffer);
info.lpstrFilter = filterBuffer;
info.lpstrCustomFilter = NULL;
info.nMaxCustFilter = 0;
info.nFilterIndex = 0;
info.lpstrFile = buffer;
info.nMaxFile = kBufferSize;
info.lpstrFileTitle = NULL;
info.nMaxFileTitle = 0;
info.lpstrInitialDir= NULL;
/*
CSysString title = "Open";
LangLoadString(IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, 0x02000D90);
info.lpstrTitle = title;
*/
info.lpstrTitle = 0;
info.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
info.nFileOffset = 0;
info.nFileExtension = 0;
info.lpstrDefExt = NULL;
info.lCustData = 0;
info.lpfnHook = NULL;
info.lpTemplateName = NULL;
if(!GetOpenFileName(&info))
return;
_editorEdit.SetText(buffer);
// Changed();
}
bool CEditPage::OnCommand(int code, int itemID, LPARAM param)
{
if (code == EN_CHANGE && itemID == IDC_EDIT_EDIT_EDITOR)
{
Changed();
return true;
}
return CPropertyPage::OnCommand(code, itemID, param);
}

View File

@@ -0,0 +1,23 @@
// EditPage.h
#pragma once
#ifndef __EDITPAGE_H
#define __EDITPAGE_H
#include "Windows/Control/PropertyPage.h"
#include "Windows/Control/Edit.h"
class CEditPage: public NWindows::NControl::CPropertyPage
{
NWindows::NControl::CEdit _editorEdit;
void OnSetEditorButton();
public:
virtual bool OnInit();
virtual void OnNotifyHelp();
virtual bool OnCommand(int code, int itemID, LPARAM param);
virtual LONG OnApply();
virtual bool OnButtonClicked(int aButtonID, HWND aButtonHWND);
};
#endif

View File

@@ -0,0 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by resource.rc
//
#define IDD_EDIT 903
#define IDC_EDIT_STATIC_EDITOR 1000
#define IDC_EDIT_EDIT_EDITOR 1002
#define IDC_EDIT_BUTTON_SET 1003
// 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 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,98 @@
//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_EDIT DIALOG DISCARDABLE 0, 0, 210, 154
STYLE DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Editor"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Editor:",IDC_EDIT_STATIC_EDITOR,7,7,196,8
EDITTEXT IDC_EDIT_EDIT_EDITOR,7,20,160,14,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_EDIT_BUTTON_SET,182,20,21,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_EDIT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 203
TOPMARGIN, 7
BOTTOMMARGIN, 147
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////