26 ImGui::SetNextWindowSize(ImVec2(900, 700), ImGuiCond_FirstUseEver);
27 if (!ImGui::Begin(absl::StrFormat(
"%s Project Editor###ProjectFileEditor",
35 if (ImGui::BeginTable(
"ProjectEditorToolbar", 8, ImGuiTableFlags_SizingFixedFit)) {
36 ImGui::TableNextColumn();
41 ImGui::TableNextColumn();
53 ImGui::TableNextColumn();
55 if (!can_save) ImGui::BeginDisabled();
56 if (ImGui::Button(absl::StrFormat(
"%s Save",
ICON_MD_SAVE).c_str())) {
64 if (!can_save) ImGui::EndDisabled();
66 ImGui::TableNextColumn();
67 if (ImGui::Button(absl::StrFormat(
"%s Save As",
ICON_MD_SAVE_AS).c_str())) {
80 ImGui::TableNextColumn();
83 ImGui::TableNextColumn();
89 ImGui::TableNextColumn();
92 ImGui::TableNextColumn();
94 ImGui::TextDisabled(
"%s",
filepath_.c_str());
96 ImGui::TextDisabled(
"No file loaded");
106 ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.3f, 0.2f, 0.2f, 0.5f));
107 if (ImGui::BeginChild(
"ValidationErrors", ImVec2(0, 100),
true)) {
108 ImGui::TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f),
111 ImGui::BulletText(
"%s", error.c_str());
115 ImGui::PopStyleColor();
119 ImVec2 editor_size = ImGui::GetContentRegionAvail();
235 std::vector<std::string> lines = absl::StrSplit(content,
'\n');
237 std::string current_section;
240 for (
const auto& line : lines) {
242 std::string trimmed = std::string(absl::StripAsciiWhitespace(line));
245 if (trimmed.empty() || trimmed[0] ==
'#')
continue;
248 if (trimmed[0] ==
'[' && trimmed[trimmed.size() - 1] ==
']') {
249 current_section = trimmed.substr(1, trimmed.size() - 2);
252 if (current_section !=
"project" &&
253 current_section !=
"files" &&
254 current_section !=
"feature_flags" &&
255 current_section !=
"workspace_settings" &&
256 current_section !=
"build_settings") {
258 absl::StrFormat(
"Line %d: Unknown section [%s]",
259 line_num, current_section));
265 size_t equals_pos = trimmed.find(
'=');
266 if (equals_pos == std::string::npos) {
268 absl::StrFormat(
"Line %d: Invalid format, expected key=value", line_num));
void SetShowWhitespaces(bool aValue)
std::string GetText() const
void Render(const char *aTitle, const ImVec2 &aSize=ImVec2(), bool aBorder=false)
void SetText(const std::string &aText)
void SetTabSize(int aValue)
void SetLanguageDefinition(const LanguageDefinition &aLanguageDef)
static const LanguageDefinition & C()