[REGEDIT] Deduplication and other formatting changes (#7193)

- Deduplicates unused IDC_REGEDIT MENU vs. actually used IDR_REGEDIT_MENU
- shrinks the binary size, GCC8.4.0dbg build shrinks from 1.052.672 -> 1.049.600 bytes
- that also solves a few FIXME's, e.g. in hu-HU, pl-PL, sl-SI, sq-AL, tr-TR, uk-UA
- translates the help-popup string in th-TH.rc
- slightly tweak some headers to be a bit closer to newstyle without going all the way
- also link to LPGL2.1+ in the source files to reduce the wall-of-text, also some other whitespace tweaks in those, but no functional change
- security.c: vertical-compactness-whitespace-changes aim to get HeapAlloc closer to HeapFree
- id-ID.rc: "&Data nilai" and "&Nama nilai" does exist in 4 dialogs, Harmonize them
- pt-PT.rc: add 2 missing accels in IDD_EDIT_STRING
- edit.c: 3x ARRAY_SIZE
- the most review-worthy change in the actual .h/.c files is clb.c the change from ClbWndClass.hInstance = hinstDLL, ClbWndClass.hIcon = NULL; to ClbWndClass.hInstance = hinstDLL; ClbWndClass.hIcon = NULL;
- clb.c the stripped INT_PTR-cast for EndDialog() was Co-authored-by: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
This commit is contained in:
Joachim Henze 2024-07-29 21:19:10 +02:00 committed by GitHub
parent d7ab15dcb4
commit 470cef7bfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 152 additions and 869 deletions

View file

@ -2,20 +2,7 @@
* Regedit main function
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
*/
#include "regedit.h"
@ -35,7 +22,7 @@ HINSTANCE hInst;
HWND hFrameWnd;
HWND hStatusBar;
HMENU hMenuFrame;
HMENU hPopupMenus = 0;
HMENU hPopupMenus;
UINT nClipboardFormat;
LPCWSTR strClipboardFormat = L"TODO: SET CORRECT FORMAT";
@ -45,19 +32,13 @@ WCHAR szFrameClass[MAX_LOADSTRING];
WCHAR szChildClass[MAX_LOADSTRING];
/*******************************************************************************
/**
* PURPOSE: Saves instance handle and creates main window
*
*
* FUNCTION: InitInstance(HANDLE, int)
*
* PURPOSE: Saves instance handle and creates main window
*
* COMMENTS:
*
* In this function, we save the instance handle in a global variable and
* create and display the main program window.
* COMMENTS:
* In this function, we save the instance handle in a global variable and
* create and display the main program window.
*/
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
BOOL AclUiAvailable;
@ -133,11 +114,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd)
{
return FALSE;
}
/* Create the status bar */
hStatusBar = CreateStatusWindowW(WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | SBT_NOBORDERS,
@ -154,20 +132,15 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
return TRUE;
}
/******************************************************************************/
/*
* We need to destroy the main menu before destroying the main window
* to avoid a memory leak.
*/
void DestroyMainMenu()
{
DestroyMenu(hMenuFrame);
}
/******************************************************************************/
void ExitInstance(HINSTANCE hInstance)
{
UnregisterHexEditorClass(hInstance);
@ -207,9 +180,9 @@ static BOOL TranslateRegeditAccelerator(HWND hWnd, HACCEL hAccTable, PMSG msg)
}
int WINAPI wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow)
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccel;
@ -224,16 +197,13 @@ int WINAPI wWinMain(HINSTANCE hInstance,
LoadStringW(hInstance, IDC_REGEDIT, szChildClass, ARRAY_SIZE(szChildClass));
if (ProcessCmdLine(GetCommandLineW()))
{
return 0;
}
switch (GetUserDefaultUILanguage())
{
case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
SetProcessDefaultLayout(LAYOUT_RTL);
break;
default:
break;
}
@ -242,9 +212,8 @@ int WINAPI wWinMain(HINSTANCE hInstance,
/* Perform application initialization */
if (!InitInstance(hInstance, nCmdShow))
{
return 0;
}
hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(ID_ACCEL));
/* Main message loop */