fix some ui glitch with NodeButton, start implementing working dir option

This commit is contained in:
2018-10-06 16:17:42 +02:00
parent 739784b0d1
commit 05decb6a05
9 changed files with 74 additions and 16 deletions

View File

@@ -233,9 +233,18 @@ void NodeDialogNewDoc::init_controls()
btn_ok->on_click(btn_ok);
};
#if defined(_WIN32) || defined(__OSX__)
working_path = find<NodeText>("path");
static char path_buffer[256];
realpath(App::I.data_path.c_str(), path_buffer);
btn_path = find<NodeButton>("btn-path");
btn_path->on_click = [this](Node*){
App::I.pick_dir([this](std::string path){
LOG("change working path to %s", path.c_str());
App::I.work_path = path;
realpath(path.c_str(), path_buffer);
working_path->set_text_format("Working dir: %s", path_buffer);
});
};
working_path = find<NodeText>("path");
realpath(App::I.work_path.c_str(), path_buffer);
working_path->set_text_format("Working dir: %s", path_buffer);
#endif
}