Compare commits

..

No commits in common. "3c804bf62ab9c24cad14339d844df1547834b027" and "b7202a2b0d631aea3100fd5bef21c9360722aa43" have entirely different histories.

6 changed files with 17 additions and 31 deletions

View File

@ -33,7 +33,7 @@ endif()
install(
FILES
ns_logo.icns
ns.icns
DESTINATION
${NOSTALGIA_DIST_RESOURCES}/icons
)

View File

@ -9,7 +9,7 @@
<string>Nostalgia Studio</string>
<key>CFBundleIconFile</key>
<string>icons/ns_logo.icns</string>
<string>icons/ns.icns</string>
<key>CFBundleIdentifier</key>
<string>net.drinkingtea.nostalgia.studio</string>
@ -18,7 +18,7 @@
<string>APPL</string>
<key>CFBundleVersion</key>
<string>dev build</string>
<string>0.0.0</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>
@ -30,6 +30,6 @@
<string>True</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2016-2025 Gary Talent &lt;gary@drinkingtea.net&gt;</string>
<string>Copyright (c) 2016-2023 Gary Talent &lt;gary@drinkingtea.net&gt;</string>
</dict>
</plist>

Binary file not shown.

View File

@ -13,7 +13,6 @@ ox::Error MakeCopyPopup::open(ox::StringViewCR path) noexcept {
m_dirPath = substr(path, 0, idx + 1);
m_title = sfmt("Copy {}", path);
m_fileName = "";
m_errMsg = "";
return {};
}
@ -26,7 +25,7 @@ bool MakeCopyPopup::isOpen() const noexcept {
return m_open;
}
void MakeCopyPopup::draw(StudioContext const &ctx) noexcept {
void MakeCopyPopup::draw(StudioContext const &ctx, ImVec2 const &sz) noexcept {
switch (m_stage) {
case Stage::Closed:
break;
@ -37,26 +36,25 @@ void MakeCopyPopup::draw(StudioContext const &ctx) noexcept {
[[fallthrough]];
case Stage::Open:
ig::centerNextWindow(ctx.tctx);
ImGui::SetNextWindowSize({250, 0});
constexpr auto modalFlags =
ImGuiWindowFlags_NoCollapse |
ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoResize;
ImGui::SetNextWindowSize(sz);
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) {
if (ImGui::IsWindowAppearing()) {
ImGui::SetKeyboardFocusHere();
}
ig::InputText("Name", m_fileName);
if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter)) {
accept(ctx);
}
ImGui::Text("%s", m_errMsg.c_str());
bool open = true;
switch (ig::PopupControlsOkCancel(open)) {
case ig::PopupResponse::None:
break;
case ig::PopupResponse::OK:
accept(ctx);
{
auto const p = sfmt("{}{}", m_dirPath, m_fileName);
if (!ctx.project->exists(p)) {
makeCopy.emit(m_srcPath, p);
close();
}
}
break;
case ig::PopupResponse::Cancel:
close();
@ -68,14 +66,5 @@ void MakeCopyPopup::draw(StudioContext const &ctx) noexcept {
}
}
void MakeCopyPopup::accept(StudioContext const &ctx) noexcept {
auto const p = sfmt("{}{}", m_dirPath, m_fileName);
if (!ctx.project->exists(p)) {
makeCopy.emit(m_srcPath, p);
close();
} else {
m_errMsg = sfmt("{} already exists", p);
}
}
}

View File

@ -20,7 +20,6 @@ class MakeCopyPopup {
};
Stage m_stage = Stage::Closed;
bool m_open{};
ox::String m_errMsg;
ox::String m_title{"Copy File"};
ox::String m_srcPath;
ox::String m_dirPath;
@ -36,10 +35,8 @@ class MakeCopyPopup {
[[nodiscard]]
bool isOpen() const noexcept;
void draw(StudioContext const &ctx) noexcept;
void draw(StudioContext const &ctx, ImVec2 const &sz = {}) noexcept;
private:
void accept(StudioContext const &ctx) noexcept;
};
}

View File

@ -137,7 +137,7 @@ void StudioUI::draw() noexcept {
p->draw(m_sctx);
}
m_closeFileConfirm.draw(m_sctx);
m_copyFilePopup.draw(m_sctx);
m_copyFilePopup.draw(m_sctx, {250, 0});
}
ImGui::End();
handleKeyInput();