Skeleton debugger UI (playing with things).

This commit is contained in:
Ben Vanik 2015-07-11 13:48:09 -07:00
parent ad2b8147c3
commit 77894ac03a
11 changed files with 517 additions and 110 deletions

View File

@ -9,6 +9,8 @@
#include "xenia/debug/ui/main_window.h"
#include "el/animation_manager.h"
#include "el/util/debug.h"
#include "xenia/base/clock.h"
#include "xenia/base/logging.h"
#include "xenia/base/platform.h"
@ -96,9 +98,60 @@ bool MainWindow::Initialize() {
Resize(1440, 1200);
BuildUI();
return true;
}
void MainWindow::BuildUI() {
using namespace el::dsl;
el::AnimationBlocker animation_blocker;
auto root_element = control_->root_element();
window_ = std::make_unique<el::Window>();
window_->set_settings(el::WindowSettings::kFullScreen);
root_element->AddChild(window_.get());
auto root_node =
LayoutBoxNode()
.gravity(Gravity::kAll)
.distribution(LayoutDistribution::kAvailable)
.axis(Axis::kY)
.child(LayoutBoxNode()
.id("toolbar_box")
.gravity(Gravity::kTop | Gravity::kLeftRight)
.distribution(LayoutDistribution::kAvailable)
.child(LabelNode("toolbar")))
.child(
SplitContainerNode()
.id("split_container")
.gravity(Gravity::kAll)
.axis(Axis::kX)
.fixed_pane(FixedPane::kSecond)
.min(128)
.value(250)
.pane(TabContainerNode()
.id("tab_container")
.gravity(Gravity::kAll)
.align(Align::kTop))
.pane(LayoutBoxNode().id("log_box").gravity(Gravity::kAll)));
window_->LoadNodeTree(root_node);
window_->GetElementsById({
{TBIDC("split_container"), &ui_.split_container},
{TBIDC("toolbar_box"), &ui_.toolbar_box},
{TBIDC("tab_container"), &ui_.tab_container},
});
ui_.tab_container->tab_bar()->LoadNodeTree(ButtonNode(cpu_view_.name()));
ui_.tab_container->content_root()->AddChild(cpu_view_.BuildUI());
ui_.tab_container->tab_bar()->LoadNodeTree(ButtonNode(gpu_view_.name()));
ui_.tab_container->content_root()->AddChild(gpu_view_.BuildUI());
el::util::ShowDebugInfoSettingsWindow(root_element);
}
void MainWindow::OnClose() { app_->Quit(); }
void MainWindow::OnCommand(int id) {

View File

@ -12,7 +12,10 @@
#include <memory>
#include "el/elements.h"
#include "xenia/debug/ui/application.h"
#include "xenia/debug/ui/views/cpu/cpu_view.h"
#include "xenia/debug/ui/views/gpu/gpu_view.h"
#include "xenia/ui/elemental_control.h"
#include "xenia/ui/platform.h"
#include "xenia/ui/window.h"
@ -30,13 +33,26 @@ class MainWindow : public xe::ui::PlatformWindow {
bool Initialize();
// void NavigateToCpuView(uint32_t address);
private:
void BuildUI();
void OnClose() override;
void OnCommand(int id) override;
Application* app_ = nullptr;
xe::ui::PlatformMenu main_menu_;
std::unique_ptr<xe::ui::ElementalControl> control_;
std::unique_ptr<el::Window> window_;
struct {
el::SplitContainer* split_container;
el::LayoutBox* toolbar_box;
el::TabContainer* tab_container;
} ui_ = {0};
views::cpu::CpuView cpu_view_;
views::gpu::GpuView gpu_view_;
};
} // namespace ui

42
src/xenia/debug/ui/view.h Normal file
View File

@ -0,0 +1,42 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_DEBUG_UI_VIEW_H_
#define XENIA_DEBUG_UI_VIEW_H_
#include <memory>
#include <string>
#include "el/elements.h"
namespace xe {
namespace debug {
namespace ui {
class View {
public:
virtual ~View() = default;
std::string name() const { return name_; }
el::LayoutBox* root_element() { return &root_element_; }
virtual el::Element* BuildUI() = 0;
protected:
View(std::string name) : name_(name) {}
std::string name_;
el::LayoutBox root_element_;
};
} // namespace ui
} // namespace debug
} // namespace xe
#endif // XENIA_DEBUG_UI_VIEW_H_

View File

@ -0,0 +1,154 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "el/animation_manager.h"
#include "xenia/debug/ui/views/cpu/cpu_view.h"
namespace xe {
namespace debug {
namespace ui {
namespace views {
namespace cpu {
CpuView::CpuView() : View("CPU") {}
CpuView::~CpuView() = default;
el::Element* CpuView::BuildUI() {
using namespace el::dsl;
el::AnimationBlocker animation_blocker;
auto functions_node =
LayoutBoxNode()
.gravity(Gravity::kAll)
.distribution(LayoutDistribution::kAvailable)
.axis(Axis::kY)
.child(
LayoutBoxNode()
.gravity(Gravity::kTop | Gravity::kLeftRight)
.distribution(LayoutDistribution::kAvailable)
.axis(Axis::kX)
.skin("button_group")
.child(ButtonNode("?"))
.child(
DropDownButtonNode().item("Module").item("Module").item(
"Module")))
.child(ListBoxNode()
.gravity(Gravity::kAll)
.item("fn")
.item("fn")
.item("fn")
.item("fn"))
.child(LayoutBoxNode()
.gravity(Gravity::kBottom | Gravity::kLeftRight)
.distribution(LayoutDistribution::kAvailable)
.axis(Axis::kX)
.child(TextBoxNode()
.type(EditType::kSearch)
.placeholder("Filter")));
auto source_code_node =
LayoutBoxNode()
.gravity(Gravity::kAll)
.distribution(LayoutDistribution::kAvailable)
.axis(Axis::kY)
.child(
LayoutBoxNode()
.gravity(Gravity::kTop | Gravity::kLeftRight)
.distribution(LayoutDistribution::kGravity)
.distribution_position(LayoutDistributionPosition::kLeftTop)
.axis(Axis::kX)
.child(ButtonNode("A")))
.child(TextBoxNode("source!")
.gravity(Gravity::kAll)
.is_multiline(true)
.is_read_only(true));
auto register_list_node = ListBoxNode()
.gravity(Gravity::kAll)
.item("A")
.item("A")
.item("A")
.item("A");
auto source_registers_node =
TabContainerNode()
.gravity(Gravity::kAll)
.tab(ButtonNode("GPR"), CloneNode(register_list_node))
.tab(ButtonNode("FPR"), CloneNode(register_list_node))
.tab(ButtonNode("VMX"), CloneNode(register_list_node));
auto source_tools_node =
TabContainerNode()
.gravity(Gravity::kAll)
.align(Align::kLeft)
.tab(ButtonNode("Stack"), LabelNode("STACK"))
.tab(ButtonNode("BPs"), LabelNode("BREAKPOINTS"));
auto source_pane_node =
LayoutBoxNode()
.gravity(Gravity::kAll)
.distribution(LayoutDistribution::kAvailable)
.axis(Axis::kY)
.child(
LayoutBoxNode()
.id("source_toolbar")
.gravity(Gravity::kTop | Gravity::kLeftRight)
.distribution(LayoutDistribution::kGravity)
.distribution_position(LayoutDistributionPosition::kLeftTop)
.axis(Axis::kX)
.child(ButtonNode("button"))
.child(ButtonNode("button"))
.child(ButtonNode("button")))
.child(LayoutBoxNode()
.gravity(Gravity::kAll)
.distribution(LayoutDistribution::kAvailable)
.child(SplitContainerNode()
.gravity(Gravity::kAll)
.axis(Axis::kX)
.fixed_pane(FixedPane::kSecond)
.value(128)
.pane(SplitContainerNode()
.gravity(Gravity::kAll)
.axis(Axis::kY)
.fixed_pane(FixedPane::kSecond)
.value(180)
.pane(source_code_node)
.pane(source_registers_node))
.pane(source_tools_node)));
auto memory_pane_node = LabelNode("MEMORY");
auto node = SplitContainerNode()
.gravity(Gravity::kAll)
.axis(Axis::kY)
.min(128)
.max(512)
.value(128)
.pane(functions_node)
.pane(SplitContainerNode()
.gravity(Gravity::kAll)
.axis(Axis::kY)
.value(800)
.pane(source_pane_node)
.pane(memory_pane_node));
root_element_.set_gravity(Gravity::kAll);
root_element_.set_layout_distribution(LayoutDistribution::kAvailable);
root_element_.LoadNodeTree(node);
root_element_.GetElementsById({
//
});
return &root_element_;
}
} // namespace cpu
} // namespace views
} // namespace ui
} // namespace debug
} // namespace xe

View File

@ -0,0 +1,40 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_DEBUG_UI_VIEWS_CPU_CPU_VIEW_H_
#define XENIA_DEBUG_UI_VIEWS_CPU_CPU_VIEW_H_
#include <memory>
#include <string>
#include "xenia/debug/ui/view.h"
namespace xe {
namespace debug {
namespace ui {
namespace views {
namespace cpu {
class CpuView : public View {
public:
CpuView();
~CpuView() override;
el::Element* BuildUI() override;
protected:
};
} // namespace cpu
} // namespace views
} // namespace ui
} // namespace debug
} // namespace xe
#endif // XENIA_DEBUG_UI_VIEWS_CPU_CPU_VIEW_H_

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "el/animation_manager.h"
#include "xenia/debug/ui/views/gpu/gpu_view.h"
namespace xe {
namespace debug {
namespace ui {
namespace views {
namespace gpu {
GpuView::GpuView() : View("GPU") {}
GpuView::~GpuView() = default;
el::Element* GpuView::BuildUI() {
using namespace el::dsl;
el::AnimationBlocker animation_blocker;
auto node = LabelNode("TODO");
root_element_.set_gravity(Gravity::kAll);
root_element_.set_layout_distribution(LayoutDistribution::kAvailable);
root_element_.LoadNodeTree(node);
root_element_.GetElementsById({
//
});
return &root_element_;
}
} // namespace gpu
} // namespace views
} // namespace ui
} // namespace debug
} // namespace xe

View File

@ -0,0 +1,40 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2015 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_DEBUG_UI_VIEWS_GPU_GPU_VIEW_H_
#define XENIA_DEBUG_UI_VIEWS_GPU_GPU_VIEW_H_
#include <memory>
#include <string>
#include "xenia/debug/ui/view.h"
namespace xe {
namespace debug {
namespace ui {
namespace views {
namespace gpu {
class GpuView : public View {
public:
GpuView();
~GpuView() override;
el::Element* BuildUI() override;
protected:
};
} // namespace gpu
} // namespace views
} // namespace ui
} // namespace debug
} // namespace xe
#endif // XENIA_DEBUG_UI_VIEWS_GPU_GPU_VIEW_H_

View File

@ -77,11 +77,16 @@
<ClInclude Include="..\..\base\main.h" />
<ClInclude Include="application.h" />
<ClInclude Include="main_window.h" />
<ClInclude Include="view.h" />
<ClInclude Include="views\cpu\cpu_view.h" />
<ClInclude Include="views\gpu\gpu_view.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\base\main_win.cc" />
<ClCompile Include="application.cc" />
<ClCompile Include="main_window.cc" />
<ClCompile Include="views\cpu\cpu_view.cc" />
<ClCompile Include="views\gpu\gpu_view.cc" />
<ClCompile Include="xe-debug-ui.cc" />
</ItemGroup>
<ItemGroup>

View File

@ -19,6 +19,15 @@
<Filter Include="src\xenia\debug\ui\elements">
<UniqueIdentifier>{f0ac4999-4700-4b41-b73d-c6dc8b23c5e6}</UniqueIdentifier>
</Filter>
<Filter Include="src\xenia\debug\ui\views">
<UniqueIdentifier>{5601b0a2-a720-4d89-9fca-df1637fce0b1}</UniqueIdentifier>
</Filter>
<Filter Include="src\xenia\debug\ui\views\cpu">
<UniqueIdentifier>{5b186e9a-1fef-42f5-b06b-2ac0b10a8a5b}</UniqueIdentifier>
</Filter>
<Filter Include="src\xenia\debug\ui\views\gpu">
<UniqueIdentifier>{c66e9a6b-0947-4610-9b2b-29db99c08e91}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\base\main.h">
@ -30,6 +39,15 @@
<ClInclude Include="application.h">
<Filter>src\xenia\debug\ui</Filter>
</ClInclude>
<ClInclude Include="view.h">
<Filter>src\xenia\debug\ui</Filter>
</ClInclude>
<ClInclude Include="views\gpu\gpu_view.h">
<Filter>src\xenia\debug\ui\views\gpu</Filter>
</ClInclude>
<ClInclude Include="views\cpu\cpu_view.h">
<Filter>src\xenia\debug\ui\views\cpu</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\base\main_win.cc">
@ -44,6 +62,12 @@
<ClCompile Include="application.cc">
<Filter>src\xenia\debug\ui</Filter>
</ClCompile>
<ClCompile Include="views\gpu\gpu_view.cc">
<Filter>src\xenia\debug\ui\views\gpu</Filter>
</ClCompile>
<ClCompile Include="views\cpu\cpu_view.cc">
<Filter>src\xenia\debug\ui\views\cpu</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources.rc">

View File

@ -141,15 +141,6 @@ bool ElementalControl::Create() {
root_element_->set_background_skin(TBIDC("background"));
root_element_->set_rect({0, 0, 1000, 1000});
// Block animations during init.
el::AnimationBlocker anim_blocker;
// TODO(benvanik): dummy UI.
auto message_window = new el::MessageWindow(root_element(), TBIDC(""));
message_window->Show("Title", "Hello!");
el::util::ShowDebugInfoSettingsWindow(root_element());
return true;
}

@ -1 +1 @@
Subproject commit a03a3089954862677e2d30f85824b978a45eba22
Subproject commit a95e9a1984029382ae8e35260725d5697a702f8b