+ enh: New About Box

This commit is contained in:
Rainer Kottenhoff 2018-02-24 13:07:43 +01:00
parent 18928095da
commit 528c32abe2
7 changed files with 51 additions and 40 deletions

View File

@ -34,7 +34,7 @@
#pragma warning( push )
#pragma warning( disable : 4201) // union/struct w/o name
#define _RICHEDIT_VER 0x0200
#define _RICHEDIT_VER 0x0410
#include <richedit.h>
#include "scintilla.h"
@ -66,7 +66,6 @@ extern int flagNoFileVariables;
extern int flagUseSystemMRU;
//=============================================================================
//
// MsgBox()
@ -301,7 +300,6 @@ static char* pAboutInfo;
INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
WCHAR wch[256] = { L'\0' };
static HFONT hFontTitle;
switch (umsg)
@ -340,12 +338,25 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
// --- Rich Edit Control ---
COLORREF colBackGr = RGB(230, 230, 230);
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETBKGNDCOLOR, 0, colBackGr);
//SetDlgItemText(hwnd, IDC_RICHEDITABOUT, VERSION_CONTRIBUTORS);
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETBKGNDCOLOR, 0, (LPARAM)colBackGr);
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETEVENTMASK, 0, (LPARAM)(ENM_LINK)); // link click
#if 0
PARAFORMAT2 ParaFormat2;
ZeroMemory(&ParaFormat2, sizeof(PARAFORMAT2));
ParaFormat2.cbSize = (UINT)sizeof(PARAFORMAT2);
ParaFormat2.dwMask = (PFM_SPACEBEFORE | PFM_SPACEAFTER | PFM_LINESPACING);
ParaFormat2.dySpaceBefore = 48; // paragraph
ParaFormat2.dySpaceAfter = 48; // paragraph
ParaFormat2.dyLineSpacing = 24; // [twips]
ParaFormat2.bLineSpacingRule = 5; // 5: dyLineSpacing/20 is the spacing, in lines, from one line to the next.
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETPARAFORMAT, 0, (LPARAM)&ParaFormat2);
SetDlgItemText(hwnd, IDC_RICHEDITABOUT, ABOUT_INFO_PLAIN);
#else
EDITSTREAM editStreamIn = { (DWORD_PTR)&pAboutInfo, 0, _LoadRtfCallback };
//pAboutInfo = pAboutInfoErrMsg;
pAboutInfo = pAboutInfoResource;
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn);
/*
DWORD dwSize = _LoadStringEx(IDR_ABOUTINFO_RTF, L"RTF", NULL);
if (dwSize != 0)
@ -363,10 +374,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn);
}
*/
//pAboutInfo = pAboutInfoErrMsg;
pAboutInfo = pAboutInfoResource;
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn);
#endif
CenterDlgInParent(hwnd);
}
return TRUE;
@ -385,19 +393,29 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
ShellExecute(hwnd, L"open", L"https://rizonesoft.com", NULL, NULL, SW_SHOWNORMAL);
break;
//case IDC_MODWEBPAGE:
// ShellExecute(hwnd, L"open", L"https://xhmikosr.github.io/notepad2-mod/", NULL, NULL, SW_SHOWNORMAL);
// break;
//case IDC_NOTE2WEBPAGE:
// ShellExecute(hwnd, L"open", L"http://www.flos-freeware.ch", NULL, NULL, SW_SHOWNORMAL);
// break;
default:
break;
}
}
break;
case EN_LINK: // hyperlink from RichEdit Ctrl
{
ENLINK* penLink = (ENLINK *)lParam;
if (penLink->msg == WM_LBUTTONDOWN)
{
WCHAR hLink[256];
TEXTRANGE txtRng;
txtRng.chrg = penLink->chrg;
txtRng.lpstrText = hLink;
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_GETTEXTRANGE, 0, (LPARAM)&txtRng);
ShellExecute(hwnd, L"open", hLink, NULL, NULL, SW_SHOWNORMAL);
}
}
break;
default:
break;
}
}
break;

View File

@ -280,6 +280,7 @@ WIN32_FIND_DATA fdCurFile;
UINT msgTaskbarCreated = 0;
HMODULE hModUxTheme = NULL;
HMODULE hRichEdit = NULL;
EDITFINDREPLACE g_efrData = { "", "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL };
UINT cpLastFind = 0;
@ -512,6 +513,7 @@ int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int n
if (!IsWin8()) {
hModUxTheme = LoadLibrary(L"uxtheme.dll");
}
hRichEdit = LoadLibrary(L"MSFTEDIT.DLL"); // RichEditCtrl > 4.1 // old: LoadLibrary(L"RichEd20.dll");
Scintilla_RegisterClasses(hInstance);
@ -4356,12 +4358,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
break;
case IDM_HELP_ABOUT:
{
HMODULE hRichEdit = LoadLibrary(L"RichEd20.dll");
if (hRichEdit) {
ThemedDialogBox(g_hInstance, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
}
}
ThemedDialogBox(g_hInstance, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
break;
case IDM_SETPASS:

View File

@ -33,6 +33,7 @@ IDI_RUN ICON "..\\res\\Run.ico"
IDI_STYLES ICON "..\\res\\Styles.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
@ -61,10 +62,6 @@ IDR_MAINWND2 BITMAP "..\\res\\Toolbar2.bmp"
IDC_COPY CURSOR "..\\res\\Copy.cur"
IDR_ABOUTINFO_RTF TEXT "..\\res\\AboutInfo.rtf"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
@ -652,7 +649,7 @@ BEGIN
LTEXT "IDC_COPYRIGHT",IDC_COPYRIGHT,80,55,180,8
LTEXT "",IDC_WEBPAGE2,190,55,130,8,NOT WS_VISIBLE | WS_DISABLED
CONTROL "",IDC_WEBPAGE,"SysLink",WS_TABSTOP,190,55,130,10
CONTROL "",IDC_RICHEDITABOUT,"RichEdit20W",ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_NOHIDESEL | ES_READONLY | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,20,80,320,170
CONTROL "",IDC_RICHEDITABOUT,"RichEdit50W",WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP | 0x29c4,20,80,320,170
PUSHBUTTON "Copy Version Text",IDC_COPYVERSTRG,260,7,80,14,BS_FLAT
END
@ -1173,15 +1170,6 @@ BEGIN
BOTTOMMARGIN, 218
END
IDD_ABOUT2, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 361
VERTGUIDE, 80
TOPMARGIN, 7
BOTTOMMARGIN, 271
END
IDD_FIND, DIALOG
BEGIN
LEFTMARGIN, 7

View File

@ -110,6 +110,7 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<LanguageStandard>stdcpp17</LanguageStandard>
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<Link>
<AdditionalDependencies>msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -163,6 +164,7 @@
<StringPooling>true</StringPooling>
<FloatingPointModel>Fast</FloatingPointModel>
<LanguageStandard>stdcpp17</LanguageStandard>
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<Link>
<AdditionalDependencies>msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -215,6 +217,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<Link>
<AdditionalDependencies>msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -269,6 +272,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<Link>
<AdditionalDependencies>msimg32.lib;comctl32.lib;imm32.lib;shlwapi.lib;scintilla.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -369,6 +373,7 @@
</ItemGroup>
<ItemGroup>
<Image Include="..\res\Notepad3.ico" />
<Image Include="..\res\Notepad3_128.ico" />
<Image Include="..\res\Toolbar2.bmp" />
</ItemGroup>
<ItemGroup>

View File

@ -150,6 +150,9 @@
<Image Include="..\res\Toolbar2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\res\Notepad3_128.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Notepad3.rc">
@ -165,5 +168,6 @@
<Text Include="..\Versions\build.txt">
<Filter>templates</Filter>
</Text>
<Text Include="..\res\AboutInfo.rtf" />
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -164,7 +164,6 @@
#define IDR_MAINWND128 550
#define IDC_RICHEDITABOUT 551
#define IDC_COPYVERSTRG 552
#define IDR_ABOUTINFO_RTF 553
#define IDS_APPTITLE 10000
#define IDS_APPTITLE_ELEVATED 10001
#define IDS_APPTITLE_PASTEBOARD 10002