App::I static singleton to pointer

This commit is contained in:
2019-07-11 18:08:17 +02:00
parent 92dd00d910
commit b89274e7a6
33 changed files with 417 additions and 412 deletions

View File

@@ -69,14 +69,14 @@ void NodeDialogOpen::init_controls()
root()->update();
};
container = find<Node>("files-list");
auto names = Asset::list_files(App::I.work_path, ".*\\.ppi");
auto names = Asset::list_files(App::I->work_path, ".*\\.ppi");
for (const auto& n : names)
{
auto node = new NodeDialogOpenItem;
node->m_manager = m_manager;
node->init();
node->m_text->set_text(n.c_str());
node->m_path = App::I.work_path + "/" + n;
node->m_path = App::I->work_path + "/" + n;
node->m_file_name = n;
node->on_selected = [&](NodeDialogOpenItem* target) {
if (target == current)
@@ -198,9 +198,9 @@ void NodeDialogSave::init_controls()
static char path_buffer[256];
btn_path = find<NodeButton>("btn-path");
btn_path->on_click = [this](Node*){
App::I.pick_dir([this](std::string path){
App::I->pick_dir([this](std::string path){
LOG("change working path to %s", path.c_str());
App::I.work_path = path;
App::I->work_path = path;
#ifdef _WIN32
GetFullPathNameA(path.c_str(), sizeof(path_buffer), path_buffer, nullptr);
#else
@@ -211,9 +211,9 @@ void NodeDialogSave::init_controls()
};
working_path = find<NodeText>("path");
#ifdef _WIN32
GetFullPathNameA(App::I.work_path.c_str(), sizeof(path_buffer), path_buffer, nullptr);
GetFullPathNameA(App::I->work_path.c_str(), sizeof(path_buffer), path_buffer, nullptr);
#else
realpath(App::I.work_path.c_str(), path_buffer);
realpath(App::I->work_path.c_str(), path_buffer);
#endif
working_path->set_text_format("Working dir: %s", path_buffer);
#endif
@@ -259,9 +259,9 @@ void NodeDialogNewDoc::init_controls()
static char path_buffer[256];
btn_path = find<NodeButton>("btn-path");
btn_path->on_click = [this](Node*){
App::I.pick_dir([this](std::string path){
App::I->pick_dir([this](std::string path){
LOG("change working path to %s", path.c_str());
App::I.work_path = path;
App::I->work_path = path;
#ifdef _WIN32
GetFullPathNameA(path.c_str(), sizeof(path_buffer), path_buffer, nullptr);
#else
@@ -272,9 +272,9 @@ void NodeDialogNewDoc::init_controls()
};
working_path = find<NodeText>("path");
#ifdef _WIN32
GetFullPathNameA(App::I.work_path.c_str(), sizeof(path_buffer), path_buffer, nullptr);
GetFullPathNameA(App::I->work_path.c_str(), sizeof(path_buffer), path_buffer, nullptr);
#else
realpath(App::I.work_path.c_str(), path_buffer);
realpath(App::I->work_path.c_str(), path_buffer);
#endif
working_path->set_text_format("Working dir: %s", path_buffer);
#endif