Extract draw toolbar and thin NodeCanvas and Win32 shell
This commit is contained in:
@@ -4,10 +4,16 @@
|
||||
#include "platform_windows/windows_window_shell.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "canvas.h"
|
||||
#include "legacy_gl_runtime_dispatch.h"
|
||||
#include "legacy_preference_storage.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <shellscalingapi.h>
|
||||
#include <string>
|
||||
|
||||
@@ -105,6 +111,57 @@ void ensure_runtime_data_directory()
|
||||
LOG("data files ok");
|
||||
}
|
||||
|
||||
void setup_exception_handler()
|
||||
{
|
||||
// Setup exception handler
|
||||
BT_SetAppName(_T("PanoPainter"));
|
||||
BT_SetAppVersion(g_version_w);
|
||||
//BT_SetSupportEMail(_T("your@email.com"));
|
||||
BT_SetFlags(BTF_DETAILEDMODE | BTF_ATTACHREPORT | BTF_SCREENCAPTURE);
|
||||
|
||||
// = BugTrapServer ===========================================
|
||||
//BT_SetSupportServer(_T("omigamedev.ddns.net"), 8088);
|
||||
BT_SetSupportEMail(_T("info@panopainter.com"));
|
||||
// - or -
|
||||
//BT_SetSupportServer(_T("127.0.0.1"), 9999);
|
||||
|
||||
// = BugTrapWebServer ========================================
|
||||
//BT_SetSupportServer(_T("http://localhost/BugTrapWebServer/RequestHandler.aspx"), BUGTRAP_HTTP_PORT);
|
||||
//BT_SetSupportServer(_T("http://omigamedev.ddns.net:8088/source/Server/BugTrapWebServer/RequestHandler.aspx"), BUGTRAP_HTTP_PORT);
|
||||
BT_SetSupportServer(_T("http://panopainter.com/bug/"), BUGTRAP_HTTP_PORT);
|
||||
|
||||
// required for VS 2005 & 2008
|
||||
BT_InstallSehFilter();
|
||||
|
||||
// Add custom log file using default name
|
||||
TCHAR wpath[MAX_PATH];
|
||||
//GetFullPathNameW(L"panopainter-log.txt", 1024, wpath, nullptr);
|
||||
auto log_file = App::I->data_path + "/panopainter-log.txt";
|
||||
std::mbstowcs(wpath, log_file.c_str(), log_file.size());
|
||||
BT_AddLogFile(wpath);
|
||||
|
||||
BT_SetPreErrHandler([](INT_PTR){
|
||||
if (Canvas::I && Canvas::I->m_unsaved)
|
||||
{
|
||||
auto t = std::time(nullptr);
|
||||
auto tm = *std::localtime(&t);
|
||||
std::ostringstream oss;
|
||||
oss << std::put_time(&tm, "%d-%m-%Y %H-%M-%S");
|
||||
|
||||
auto path = App::I->data_path + "/" + App::I->doc_name + "-recovery (" + oss.str() + ").ppi";
|
||||
Canvas::I->project_save_thread(path, false);
|
||||
static char abspath[MAX_PATH];
|
||||
GetFullPathNameA(path.c_str(), MAX_PATH, abspath, NULL);
|
||||
static char message[4096];
|
||||
snprintf(message, sizeof(message), "File recovered in: %s", abspath);
|
||||
MessageBoxA(retained_state().hWnd, message, "File Recovery", MB_OK | MB_ICONWARNING);
|
||||
}
|
||||
LogRemote::I.file_close();
|
||||
}, 0);
|
||||
|
||||
BT_SetTerminate();
|
||||
}
|
||||
|
||||
MainWindowStartupState initialize_main_window_startup_state()
|
||||
{
|
||||
auto startup = MainWindowStartupState {};
|
||||
|
||||
@@ -46,6 +46,7 @@ enum class MainStartupResult
|
||||
};
|
||||
|
||||
void ensure_runtime_data_directory();
|
||||
void setup_exception_handler();
|
||||
MainWindowStartupState initialize_main_window_startup_state();
|
||||
void create_main_window(const MainWindowStartupState& startup, HWND& hWnd, HINSTANCE hInst, const wchar_t* window_title);
|
||||
void initialize_pixel_format_descriptor(PIXELFORMATDESCRIPTOR& pixel_format);
|
||||
|
||||
Reference in New Issue
Block a user