27 ImGui::SetNextWindowSize(ImVec2(900, 700), ImGuiCond_FirstUseEver);
28 if (!ImGui::Begin(absl::StrFormat(
"%s Project Editor###ProjectFileEditor",
36 if (ImGui::BeginTable(
"ProjectEditorToolbar", 8, ImGuiTableFlags_SizingFixedFit)) {
37 ImGui::TableNextColumn();
42 ImGui::TableNextColumn();
54 ImGui::TableNextColumn();
56 if (!can_save) ImGui::BeginDisabled();
57 if (ImGui::Button(absl::StrFormat(
"%s Save",
ICON_MD_SAVE).c_str())) {
65 if (!can_save) ImGui::EndDisabled();
67 ImGui::TableNextColumn();
68 if (ImGui::Button(absl::StrFormat(
"%s Save As",
ICON_MD_SAVE_AS).c_str())) {
81 ImGui::TableNextColumn();
84 ImGui::TableNextColumn();
90 ImGui::TableNextColumn();
93 ImGui::TableNextColumn();
95 ImGui::TextDisabled(
"%s",
filepath_.c_str());
97 ImGui::TextDisabled(
"No file loaded");
107 ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.3f, 0.2f, 0.2f, 0.5f));
108 if (ImGui::BeginChild(
"ValidationErrors", ImVec2(0, 100),
true)) {
109 ImGui::TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f),
112 ImGui::BulletText(
"%s", error.c_str());
116 ImGui::PopStyleColor();
120 ImVec2 editor_size = ImGui::GetContentRegionAvail();
236 std::vector<std::string> lines = absl::StrSplit(content,
'\n');
238 std::string current_section;
241 for (
const auto& line : lines) {
243 std::string trimmed = std::string(absl::StripAsciiWhitespace(line));
246 if (trimmed.empty() || trimmed[0] ==
'#')
continue;
249 if (trimmed[0] ==
'[' && trimmed[trimmed.size() - 1] ==
']') {
250 current_section = trimmed.substr(1, trimmed.size() - 2);
253 if (current_section !=
"project" &&
254 current_section !=
"files" &&
255 current_section !=
"feature_flags" &&
256 current_section !=
"workspace_settings" &&
257 current_section !=
"build_settings") {
259 absl::StrFormat(
"Line %d: Unknown section [%s]",
260 line_num, current_section));
266 size_t equals_pos = trimmed.find(
'=');
267 if (equals_pos == std::string::npos) {
269 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()