Open new tab for new Tool automatically

master
Marko Semet 2019-05-31 16:07:16 +02:00
parent a0d4a3ac90
commit 8ba77d3b39
3 changed files with 7 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/build/
/sir/
/builds/
/_build

View File

@ -111,9 +111,11 @@ namespace sirEdit::data {
return this->serializer;
}
void addTool(Tool tool) {
this->serializer.addTool(new Tool(std::move(tool)));
const Tool* addTool(Tool tool) {
Tool* tmp = new Tool(std::move(tool));
this->serializer.addTool(tmp);
updateCall(this->change_callback);
return tmp;
}
void setFieldStatus(const Tool& tool, const Type& type, const Field& field, FIELD_STATE state, const std::function<void(const Type&, const Field&, FIELD_STATE, FIELD_STATE)>& callback_field, const std::function<void(const Type&, TYPE_STATE, TYPE_STATE)>& callback_type) {
// Set state

View File

@ -270,8 +270,8 @@ class MainWindow {
// Dialog finished
toolFinish->signal_clicked().connect([this, newToolDialog, toolName, toolDescription, toolCommand]() -> void {
newToolDialog->hide();
this->__transitions.addTool({toolName->get_text(), toolDescription->get_buffer()->get_text(), toolCommand->get_buffer()->get_text()});
// TODO: Open new tool view
const Tool* tool = this->__transitions.addTool({toolName->get_text(), toolDescription->get_buffer()->get_text(), toolCommand->get_buffer()->get_text()});
this->__create_tab(*const_cast<Tool*>(tool));
});
}