From 650b26175119637643e5d66186408af3efdc445d Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 15 Mar 2018 08:59:00 +0100 Subject: [PATCH] + cln: clean coding --- src/Notepad3.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index 470f37ccc..e76af790f 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -1200,23 +1200,10 @@ void __fastcall SetWordWrapping(HWND hwndEditCtrl) //============================================================================= // -// CreateEditCtrl() +// InitializeSciEditCtrl() // -HWND __fastcall CreateEditCtrl(HWND hwndParent, HINSTANCE hInstance) +void __fastcall InitializeSciEditCtrl(HWND hwndEditCtrl) { - HWND hwndEditCtrl = CreateWindowEx( - WS_EX_CLIENTEDGE, - L"Scintilla", - NULL, - WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, - 0, 0, 0, 0, - hwndParent, - (HMENU)IDC_EDIT, - hInstance, - NULL); - - g_hScintilla = (HANDLE)SendMessage(hwndEditCtrl, SCI_GETDIRECTPOINTER, 0, 0); - Encoding_Current(g_iDefaultNewFileEncoding); Encoding_SciSetCodePage(hwndEditCtrl, g_iDefaultNewFileEncoding); @@ -1319,8 +1306,6 @@ HWND __fastcall CreateEditCtrl(HWND hwndParent, HINSTANCE hInstance) //SciInitThemes(hwndEditCtrl); UpdateLineNumberWidth(); - - return(hwndEditCtrl); } @@ -1335,7 +1320,20 @@ LRESULT MsgCreate(HWND hwnd,WPARAM wParam,LPARAM lParam) HINSTANCE hInstance = ((LPCREATESTRUCT)lParam)->hInstance; // Setup edit control - g_hwndEdit = CreateEditCtrl(hwnd, hInstance); + g_hwndEdit = CreateWindowEx( + WS_EX_CLIENTEDGE, + L"Scintilla", + NULL, + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, + 0, 0, 0, 0, + hwnd, + (HMENU)IDC_EDIT, + hInstance, + NULL); + + g_hScintilla = (HANDLE)SendMessage(g_hwndEdit, SCI_GETDIRECTPOINTER, 0, 0); + + InitializeSciEditCtrl(g_hwndEdit); hwndEditFrame = CreateWindowEx( WS_EX_CLIENTEDGE,