pulled latest translations from Transifex
[TortoiseGit.git] / src / TortoiseUDiff / MainWindow.h
blobe8fe2fbcaaeebb3f94ef15fb3fb0184ced105993
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2007,2009-2012 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
20 #include "BaseWindow.h"
21 #include "SciLexer.h"
22 #include "Scintilla.h"
23 #include "Registry.h"
24 #include "resource.h"
25 #include "FindBar.h"
26 #include <string>
27 #include <stdio.h>
29 using namespace std;
31 /**
32 * \ingroup TortoiseUDiff
33 * Main window of TortoiseUDiff. Handles the child windows (Scintilla control,
34 * CFindBar, ...).
36 class CMainWindow : public CWindow
38 public:
39 CMainWindow(HINSTANCE hInst, const WNDCLASSEX* wcx = NULL);
40 ~CMainWindow(void);
42 /**
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() { return m_hWndEdit; }
49 bool LoadFile(LPCTSTR filename);
50 bool LoadFile(HANDLE hFile);
51 bool SaveFile(LPCTSTR filename);
52 void SetTitle(LPCTSTR title);
53 std::wstring GetAppDirectory();
54 void RunCommand(const std::wstring& command);
56 protected:
57 /// the message handler for this window
58 LRESULT CALLBACK WinMsgHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
59 /// Handles all the WM_COMMAND window messages (e.g. menu commands)
60 LRESULT DoCommand(int id);
62 bool Initialize();
64 private:
65 void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, const char *face=0);
66 bool IsUTF8(LPVOID pBuffer, size_t cb);
67 void InitEditor();
68 void SetupWindow(bool bUTF8);
70 private:
71 LRESULT m_directFunction;
72 LRESULT m_directPointer;
74 HWND m_hWndEdit;
76 CFindBar m_FindBar;
77 bool m_bShowFindBar;
78 bool m_bMatchCase;
79 wstring m_findtext;
80 wstring m_filename;
82 void loadOrSaveFile( bool doLoad, const wstring& filename = L"" );