95 constexpr const char* kPopupId =
"##new_project_dialog";
97 ImGui::OpenPopup(kPopupId);
101 ImGui::SetNextWindowSize(ImVec2(560, 0), ImGuiCond_Appearing);
102 if (!ImGui::BeginPopupModal(kPopupId,
nullptr,
103 ImGuiWindowFlags_AlwaysAutoResize |
104 ImGuiWindowFlags_NoSavedSettings)) {
116 tr(
"Pick a template, point at the ROM it should build on, and give the "
117 "project a name. The project file will be saved beside the source "
124 ImGui::TextUnformatted(tr(
"Template"));
126 ImGui::SetNextItemWidth(-1);
127 if (ImGui::BeginCombo(
"##template_combo", combo_preview)) {
128 for (
int i = 0; i < kTemplateCount; ++i) {
130 const std::string label =
131 absl::StrFormat(
"%s %s", kTemplates[i].icon, kTemplates[i].name);
132 if (ImGui::Selectable(label.c_str(), selected)) {
136 ImGui::SetItemDefaultFocus();
147 ImGui::TextWrapped(tr(
"%s Effect: %s"),
ICON_MD_EDIT, tmpl.what_changes);
148 const char* skill_tag = tmpl.skill_level == 1 ?
"Beginner"
149 : tmpl.skill_level == 2 ?
"Intermediate"
151 ImGui::TextWrapped(tr(
"%s Skill: %s"),
ICON_MD_INFO, skill_tag);
157 ImGui::TextUnformatted(tr(
"Source ROM"));
158 const float browse_width = ImGui::CalcTextSize(
" Browse…").x +
160 ImGui::GetStyle().FramePadding.x * 2.0f + 8.0f;
161 ImGui::SetNextItemWidth(-browse_width - ImGui::GetStyle().ItemSpacing.x);
167 if (!picked.empty()) {
177 ImGui::TextUnformatted(tr(
"Project name"));
178 ImGui::SetNextItemWidth(-1);
183 ImGui::TextWrapped(tr(
184 "Used as the project display name and to derive the project filename. "
185 "Spaces are replaced with underscores."));
195 const bool rom_valid = !rom_path.empty() && std::filesystem::exists(rom_path);
196 const bool name_valid = !project_name.empty();
197 const bool can_create = rom_valid && name_valid;
200 ImGui::BeginDisabled();
204 rom_path, project_name)
205 : absl::FailedPreconditionError(
206 "Project creation callback is not configured");
208 status_message_ = absl::StrFormat(
"Create failed: %s", status.message());
210 ImGui::CloseCurrentPopup();
217 ImGui::EndDisabled();
220 if (ImGui::Button(
ICON_MD_CLOSE " Cancel", ImVec2(100, 0)) ||
221 ImGui::IsKeyPressed(ImGuiKey_Escape,
false)) {
222 ImGui::CloseCurrentPopup();
234 if (!rom_valid && rom_path.empty()) {
236 }
else if (!rom_valid) {
238 }
else if (!name_valid) {