-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwinmapviewer.cpp
More file actions
48 lines (42 loc) · 1.52 KB
/
winmapviewer.cpp
File metadata and controls
48 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// windows.h is required to be included *before* commctrl.h
// clang-format off
#include <windows.h>
#include <commctrl.h>
// clang-format on
#include <cstdlib>
#include "HiddenWindow.h"
#include "MainWindow.h"
#include "MainWindowManager.h"
#include "MapPrinter.h"
#include "SearchProvider.h"
#include "Settings.h"
#include "StyleDatabase.h"
#include "resource.h"
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
try {
InitCommonControls();
const StyleDatabase styleDatabase(IDM_STYLE_OSM_STANDARD);
const GdiPlusWrapper gdiPlusWrapper;
const TileDownloader tileDownloader(gdiPlusWrapper);
DownloadWorker downloadWorker(tileDownloader);
TileCache tileCache(downloadWorker, tileDownloader);
HiddenWindow hiddenWindow(hInstance, tileCache);
downloadWorker.setNotificationReceiver(hiddenWindow.create());
const SearchProvider searchProvider;
const MapPrinter mapPrinter(tileCache);
MainWindowManager mainWindowManager(mapPrinter, searchProvider, styleDatabase, tileCache, hInstance);
mainWindowManager.create(loadSettingsFromRegistry(), nCmdShow);
HACCEL hAccelTable = LoadAccelerators(hInstance, reinterpret_cast<LPCTSTR>(IDC_WINMAPVIEWER));
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
} catch (char const* e) {
panicMessage("WinMain", e);
exit(EXIT_FAILURE);
}
}