94 constexpr const char* kPopupId =
"##new_project_dialog";
96 ImGui::OpenPopup(kPopupId);
100 ImGui::SetNextWindowSize(ImVec2(560, 0), ImGuiCond_Appearing);
101 if (!ImGui::BeginPopupModal(kPopupId,
nullptr,
102 ImGuiWindowFlags_AlwaysAutoResize |
103 ImGuiWindowFlags_NoSavedSettings)) {
115 tr(
"Pick a template, point at the ROM it should build on, and give the "
116 "project a name. The project file will be saved beside the source "
123 ImGui::TextUnformatted(tr(
"Template"));
125 ImGui::SetNextItemWidth(-1);
126 if (ImGui::BeginCombo(
"##template_combo", combo_preview)) {
127 for (
int i = 0; i < kTemplateCount; ++i) {
129 const std::string label =
130 absl::StrFormat(
"%s %s", kTemplates[i].icon, kTemplates[i].name);
131 if (ImGui::Selectable(label.c_str(), selected)) {
135 ImGui::SetItemDefaultFocus();
146 ImGui::TextWrapped(tr(
"%s Effect: %s"),
ICON_MD_EDIT, tmpl.what_changes);
147 const char* skill_tag = tmpl.skill_level == 1 ?
"Beginner"
148 : tmpl.skill_level == 2 ?
"Intermediate"
150 ImGui::TextWrapped(tr(
"%s Skill: %s"),
ICON_MD_INFO, skill_tag);
156 ImGui::TextUnformatted(tr(
"Source ROM"));
157 const float browse_width = ImGui::CalcTextSize(
" Browse…").x +
159 ImGui::GetStyle().FramePadding.x * 2.0f + 8.0f;
160 ImGui::SetNextItemWidth(-browse_width - ImGui::GetStyle().ItemSpacing.x);
166 if (!picked.empty()) {
176 ImGui::TextUnformatted(tr(
"Project name"));
177 ImGui::SetNextItemWidth(-1);
182 ImGui::TextWrapped(tr(
183 "Used as the project display name and to derive the project filename. "
184 "Spaces are replaced with underscores."));
194 const bool rom_valid = !rom_path.empty() && std::filesystem::exists(rom_path);
195 const bool name_valid = !project_name.empty();
196 const bool can_create = rom_valid && name_valid;
199 ImGui::BeginDisabled();
203 rom_path, project_name)
204 : absl::FailedPreconditionError(
205 "Project creation callback is not configured");
207 status_message_ = absl::StrFormat(
"Create failed: %s", status.message());
209 ImGui::CloseCurrentPopup();
216 ImGui::EndDisabled();
219 if (ImGui::Button(
ICON_MD_CLOSE " Cancel", ImVec2(100, 0)) ||
220 ImGui::IsKeyPressed(ImGuiKey_Escape,
false)) {
221 ImGui::CloseCurrentPopup();
233 if (!rom_valid && rom_path.empty()) {
235 }
else if (!rom_valid) {
237 }
else if (!name_valid) {