1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2016, 2019-2021, 2023 - TortoiseGit
4 // Copyright (C) 2007, 2009-2013, 2020 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "BaseWindow.h"
24 #include "Scintilla.h"
32 * \ingroup TortoiseUDiff
33 * Main window of TortoiseUDiff. Handles the child windows (Scintilla control,
36 class CMainWindow
: public CWindow
39 CMainWindow(HINSTANCE hInst
, const WNDCLASSEX
* wcx
= nullptr);
43 * Registers the window class and creates the window.
45 bool RegisterAndCreateWindow();
47 LRESULT
SendEditor(UINT Msg
, WPARAM wParam
= 0, LPARAM lParam
= 0);
48 HWND
GetHWNDEdit() const { return m_hWndEdit
; }
49 bool LoadFile(LPCWSTR filename
);
50 bool LoadFile(HANDLE hFile
, bool wantStdIn
);
51 bool SaveFile(LPCWSTR filename
);
52 void SetTitle(LPCWSTR title
);
53 std::wstring
GetAppDirectory();
54 void RunCommand(const std::wstring
& command
);
57 /// the message handler for this window
58 LRESULT CALLBACK
WinMsgHandler(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
) override
;
59 /// Handles all the WM_COMMAND window messages (e.g. menu commands)
60 LRESULT
DoCommand(int id
);
63 void SetTheme(bool bDark
);
66 void SetAStyle(int style
, COLORREF fore
, COLORREF back
= ::GetSysColor(COLOR_WINDOW
), int size
= -1, const char* face
= nullptr);
67 bool IsUTF8(LPVOID pBuffer
, size_t cb
);
69 void SetupWindow(bool bUTF8
);
70 void UpdateLineCount();
73 LRESULT m_directFunction
= 0;
74 LRESULT m_directPointer
= 0;
76 HWND m_hWndEdit
= nullptr;
77 int m_themeCallbackId
= 0;
79 void DoSearch(bool reverse
);
81 bool m_bShowFindBar
= false;
82 bool m_bMatchCase
= false;
83 std::wstring m_findtext
;
84 std::wstring m_filename
;
86 bool loadOrSaveFile(bool doLoad
, const std::wstring
& filename
= L
"");
87 bool canCloseWhenModified();