From 37ded9acc3bed9475dc0a7ee44313f67261bbae8 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 1 Aug 2015 10:24:41 -0700 Subject: [PATCH] Window->Form. --- src/xenia/debug/ui/main_window.cc | 48 +++++++++++++++---------------- src/xenia/debug/ui/main_window.h | 4 +-- src/xenia/kernel/xam_ui.cc | 24 ++++++++-------- third_party/elemental-forms | 2 +- 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/xenia/debug/ui/main_window.cc b/src/xenia/debug/ui/main_window.cc index f4ecb5c5a..b1fdcadbc 100644 --- a/src/xenia/debug/ui/main_window.cc +++ b/src/xenia/debug/ui/main_window.cc @@ -34,25 +34,23 @@ MainWindow::~MainWindow() = default; bool MainWindow::Initialize() { client_ = app_->client(); - platform_window_ = xe::ui::Window::Create(app()->loop(), kBaseTitle); - if (!platform_window_) { + window_ = xe::ui::Window::Create(app()->loop(), kBaseTitle); + if (!window_) { return false; } - platform_window_->Initialize(); - platform_window_->set_context( - xe::ui::gl::GLContext::Create(platform_window_.get())); - platform_window_->MakeReady(); + window_->Initialize(); + window_->set_context(xe::ui::gl::GLContext::Create(window_.get())); + window_->MakeReady(); - platform_window_->on_closed.AddListener( - std::bind(&MainWindow::OnClose, this)); + window_->on_closed.AddListener(std::bind(&MainWindow::OnClose, this)); - platform_window_->on_key_down.AddListener([this](xe::ui::KeyEvent& e) { + window_->on_key_down.AddListener([this](xe::ui::KeyEvent& e) { bool handled = true; switch (e.key_code()) { case 0x1B: { // VK_ESCAPE // Allow users to escape fullscreen (but not enter it). - if (platform_window_->is_fullscreen()) { - platform_window_->ToggleFullscreen(false); + if (window_->is_fullscreen()) { + window_->ToggleFullscreen(false); } } break; @@ -69,9 +67,9 @@ bool MainWindow::Initialize() { auto main_menu = MenuItem::Create(MenuItem::Type::kNormal); auto file_menu = MenuItem::Create(MenuItem::Type::kPopup, L"&File"); { - file_menu->AddChild( - MenuItem::Create(MenuItem::Type::kString, L"E&xit", L"Alt+F4", - [this]() { platform_window_->Close(); })); + file_menu->AddChild(MenuItem::Create(MenuItem::Type::kString, L"E&xit", + L"Alt+F4", + [this]() { window_->Close(); })); } main_menu->AddChild(std::move(file_menu)); @@ -87,9 +85,9 @@ bool MainWindow::Initialize() { } main_menu->AddChild(std::move(help_menu)); - platform_window_->set_main_menu(std::move(main_menu)); + window_->set_main_menu(std::move(main_menu)); - platform_window_->Resize(1440, 1200); + window_->Resize(1440, 1200); BuildUI(); @@ -100,10 +98,10 @@ void MainWindow::BuildUI() { using namespace el::dsl; el::AnimationBlocker animation_blocker; - auto root_element = platform_window_->root_element(); - window_ = std::make_unique(); - window_->set_settings(el::WindowSettings::kFullScreen); - root_element->AddChild(window_.get()); + auto root_element = window_->root_element(); + form_ = std::make_unique(); + form_->set_settings(el::FormSettings::kFullScreen); + root_element->AddChild(form_.get()); auto root_node = LayoutBoxNode() @@ -132,14 +130,14 @@ void MainWindow::BuildUI() { .align(Align::kTop)) .pane(LayoutBoxNode().id("log_box").gravity(Gravity::kAll))); - window_->LoadNodeTree(root_node); - window_->GetElementsById({ + form_->LoadNodeTree(root_node); + form_->GetElementsById({ {TBIDC("split_container"), &ui_.split_container}, {TBIDC("toolbar_box"), &ui_.toolbar_box}, {TBIDC("tab_container"), &ui_.tab_container}, }); - handler_ = std::make_unique(window_.get()); + handler_ = std::make_unique(form_.get()); handler_->Listen(el::EventType::kClick, TBIDC("pause_button"), [this](const el::Event& ev) { client_->Interrupt(); @@ -164,7 +162,7 @@ void MainWindow::BuildUI() { UpdateElementState(); - el::util::ShowDebugInfoSettingsWindow(root_element); + el::util::ShowDebugInfoSettingsForm(root_element); } void MainWindow::UpdateElementState() { @@ -173,7 +171,7 @@ void MainWindow::UpdateElementState() { el::TabContainer* tab_container; el::Button* pause_button; el::Button* resume_button; - window_->GetElementsById({ + form_->GetElementsById({ {TBIDC("tab_container"), &tab_container}, {TBIDC("pause_button"), &pause_button}, {TBIDC("resume_button"), &resume_button}, diff --git a/src/xenia/debug/ui/main_window.h b/src/xenia/debug/ui/main_window.h index e99bd1e14..5f8dc46cb 100644 --- a/src/xenia/debug/ui/main_window.h +++ b/src/xenia/debug/ui/main_window.h @@ -44,8 +44,8 @@ class MainWindow { Application* app_ = nullptr; xe::debug::client::xdp::XdpClient* client_ = nullptr; - std::unique_ptr platform_window_; - std::unique_ptr window_; + std::unique_ptr window_; + std::unique_ptr form_; struct { el::SplitContainer* split_container; el::LayoutBox* toolbar_box; diff --git a/src/xenia/kernel/xam_ui.cc b/src/xenia/kernel/xam_ui.cc index b9905e693..e4fc36397 100644 --- a/src/xenia/kernel/xam_ui.cc +++ b/src/xenia/kernel/xam_ui.cc @@ -22,13 +22,13 @@ namespace kernel { SHIM_CALL XamIsUIActive_shim(PPCContext* ppc_context, KernelState* kernel_state) { XELOGD("XamIsUIActive()"); - SHIM_SET_RETURN_32(el::ModalWindow::is_any_visible()); + SHIM_SET_RETURN_32(el::ModalForm::is_any_visible()); } -class MessageBoxWindow : public el::ModalWindow { +class MessageBoxWindow : public el::ModalForm { public: MessageBoxWindow(xe::threading::Fence* fence) - : ModalWindow([fence]() { fence->Signal(); }) {} + : ModalForm([fence]() { fence->Signal(); }) {} ~MessageBoxWindow() override = default; // TODO(benvanik): icon. @@ -44,7 +44,7 @@ class MessageBoxWindow : public el::ModalWindow { // In case we are cancelled, always set default button. *out_chosen_button_ = default_button; - ModalWindow::Show(root_element); + ModalForm::Show(root_element); EnsureFocus(); } @@ -89,7 +89,7 @@ class MessageBoxWindow : public el::ModalWindow { Die(); return true; } - return ModalWindow::OnEvent(ev); + return ModalForm::OnEvent(ev); } std::wstring title_; @@ -168,10 +168,10 @@ SHIM_CALL XamShowMessageBoxUI_shim(PPCContext* ppc_context, SHIM_SET_RETURN_32(X_ERROR_IO_PENDING); } -class KeyboardInputWindow : public el::ModalWindow { +class KeyboardInputWindow : public el::ModalForm { public: KeyboardInputWindow(xe::threading::Fence* fence) - : ModalWindow([fence]() { fence->Signal(); }) {} + : ModalForm([fence]() { fence->Signal(); }) {} ~KeyboardInputWindow() override = default; // TODO(benvanik): icon. @@ -189,7 +189,7 @@ class KeyboardInputWindow : public el::ModalWindow { *out_text = default_text; } - ModalWindow::Show(root_element); + ModalForm::Show(root_element); EnsureFocus(); } @@ -245,7 +245,7 @@ class KeyboardInputWindow : public el::ModalWindow { return true; } - return ModalWindow::OnEvent(ev); + return ModalForm::OnEvent(ev); } std::wstring title_; @@ -341,10 +341,10 @@ dword_result_t XamShowDeviceSelectorUI(dword_t user_index, dword_t content_type, } DECLARE_XAM_EXPORT(XamShowDeviceSelectorUI, ExportTag::kImplemented); -class DirtyDiscWindow : public el::ModalWindow { +class DirtyDiscWindow : public el::ModalForm { public: DirtyDiscWindow(xe::threading::Fence* fence) - : ModalWindow([fence]() { fence->Signal(); }) {} + : ModalForm([fence]() { fence->Signal(); }) {} ~DirtyDiscWindow() override = default; protected: @@ -377,7 +377,7 @@ class DirtyDiscWindow : public el::ModalWindow { Die(); return true; } - return ModalWindow::OnEvent(ev); + return ModalForm::OnEvent(ev); } }; diff --git a/third_party/elemental-forms b/third_party/elemental-forms index 66048454a..54ccef6df 160000 --- a/third_party/elemental-forms +++ b/third_party/elemental-forms @@ -1 +1 @@ -Subproject commit 66048454a5b720eb32f6d1a117038a507001b975 +Subproject commit 54ccef6df50a7d92a1869c6b54ae4b1f57356933