[studio] Make NewMenu default Name field to focus when it appears
All checks were successful
Build / build (push) Successful in 3m30s
All checks were successful
Build / build (push) Successful in 3m30s
This commit is contained in:
parent
0d8b82ba49
commit
ff666eda9b
@ -53,6 +53,7 @@ void NewMenu::draw(StudioContext &sctx) noexcept {
|
||||
case Stage::NewItemType:
|
||||
drawNewItemType(sctx);
|
||||
break;
|
||||
case Stage::NewItemTransitioningToPath:
|
||||
case Stage::NewItemPath:
|
||||
drawNewItemPath(sctx);
|
||||
break;
|
||||
@ -90,8 +91,8 @@ void NewMenu::drawNewItemType(StudioContext const&sctx) noexcept {
|
||||
}, m_types.size(), m_selectedType, {200, 100});
|
||||
auto const&im = *m_types[m_selectedType];
|
||||
drawFirstPageButtons(im.itemTemplates().size() == 1 ?
|
||||
Stage::NewItemPath : Stage::NewItemTemplate);
|
||||
if (m_stage == Stage::NewItemPath || m_stage == Stage::NewItemTemplate) {
|
||||
Stage::NewItemTransitioningToPath : Stage::NewItemTemplate);
|
||||
if (m_stage == Stage::NewItemTransitioningToPath || m_stage == Stage::NewItemTemplate) {
|
||||
if (m_path.len() == 0) {
|
||||
m_path = im.defaultPath();
|
||||
}
|
||||
@ -108,16 +109,18 @@ void NewMenu::drawNewItemTemplate(StudioContext const&sctx) noexcept {
|
||||
ig::ListBox("Template", [&](size_t const i) -> ox::CStringView {
|
||||
return templates[i]->name();
|
||||
}, templates.size(), m_selectedTemplate, {200, 100});
|
||||
drawButtons(Stage::NewItemPath);
|
||||
drawButtons(Stage::NewItemTransitioningToPath);
|
||||
});
|
||||
}
|
||||
|
||||
void NewMenu::drawNewItemPath(StudioContext &sctx) noexcept {
|
||||
setSize({380, 340});
|
||||
drawWindow(sctx.tctx, m_open, [this, &sctx] {
|
||||
if (m_selectedType < m_types.size()) {
|
||||
ig::InputText("Name", m_itemName);
|
||||
if (m_stage == Stage::NewItemTransitioningToPath) [[unlikely]] {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
m_stage = Stage::NewItemPath;
|
||||
}
|
||||
ig::InputText("Name", m_itemName);
|
||||
ImGui::NewLine();
|
||||
ImGui::Text("Path");
|
||||
auto const vp = ImGui::GetContentRegionAvail();
|
||||
|
@ -20,6 +20,7 @@ class NewMenu final: public Popup {
|
||||
Closed,
|
||||
Opening,
|
||||
NewItemType,
|
||||
NewItemTransitioningToPath,
|
||||
NewItemPath,
|
||||
NewItemTemplate,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user