mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
HackStudio: Add GML Preview action tab
This allows us to show a GML Preview in realtime via HackStudio::GMLPreviewWidget! :^)
This commit is contained in:
parent
0295cf96a8
commit
6aa2b7d4cc
5 changed files with 79 additions and 0 deletions
|
@ -288,6 +288,9 @@ bool HackStudioWidget::open_file(const String& full_filename)
|
|||
current_editor().set_focus(true);
|
||||
|
||||
current_editor().on_cursor_change = [this] { update_statusbar(); };
|
||||
current_editor().on_change = [this] { update_gml_preview(); };
|
||||
update_gml_preview();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -504,6 +507,7 @@ void HackStudioWidget::add_new_editor(GUI::Widget& parent)
|
|||
wrapper->editor().set_focus(true);
|
||||
wrapper->set_project_root(LexicalPath(m_project->root_path()));
|
||||
wrapper->editor().on_cursor_change = [this] { update_statusbar(); };
|
||||
wrapper->editor().on_change = [this] { update_gml_preview(); };
|
||||
}
|
||||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_switch_to_next_editor_action()
|
||||
|
@ -908,6 +912,7 @@ void HackStudioWidget::create_action_tab(GUI::Widget& parent)
|
|||
m_diff_viewer->set_content(original_content, diff);
|
||||
set_edit_mode(EditMode::Diff);
|
||||
});
|
||||
m_gml_preview_widget = m_action_tab_widget->add_tab<GMLPreviewWidget>("GML Preview", "");
|
||||
|
||||
ToDoEntries::the().on_update = [this]() {
|
||||
m_todo_entries_widget->refresh();
|
||||
|
@ -1150,4 +1155,10 @@ bool HackStudioWidget::any_document_is_dirty() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void HackStudioWidget::update_gml_preview()
|
||||
{
|
||||
auto gml_content = current_editor_wrapper().filename().ends_with(".gml") ? current_editor_wrapper().editor().text() : "";
|
||||
m_gml_preview_widget->load_gml(gml_content);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue