1 module formoshlep.dlangui_main;
2 
3 import dlangui;
4 
5 extern(C) int DLANGUImain(string[] args)
6 {
7     import formoshlep.platform: FormoshlepPlatform;
8     import formoshlep.fonts: FormoshlepFontManager;
9 
10     initLogs();
11     Log.setLogLevel = LogLevel.Debug;
12     SCREEN_DPI = 10; // TODO: wtf?
13     Platform.setInstance = new FormoshlepPlatform();
14     FontManager.instance = new FormoshlepFontManager();
15     initResourceManagers();
16 
17     version (Windows)
18     {
19         import core.sys.windows.winuser;
20         DOUBLE_CLICK_THRESHOLD_MS = GetDoubleClickTime();
21     }
22 
23     currentTheme = createDefaultTheme();
24     Platform.instance.uiTheme = "theme_default";
25 
26     Log.i("Entering UIAppMain: ", args);
27 
28     int result = -1;
29     try
30     {
31         version(unittest)
32         {
33             result = 0;
34         }
35         else
36         {
37             result = UIAppMain(args);
38             Log.i("UIAppMain returned ", result);
39         }
40     }
41     catch (Exception e)
42     {
43         Log.e("Abnormal UIAppMain termination");
44         Log.e("UIAppMain exception: ", e);
45     }
46 
47     Platform.setInstance(null);
48 
49     releaseResourcesOnAppExit();
50 
51     Log.d("Exiting main");
52     APP_IS_SHUTTING_DOWN = true;
53 
54     return result;
55 }