Source control.

This commit is contained in:
Ben Vanik 2015-09-07 08:28:02 -07:00
parent a1a996c1e6
commit 2b30ac393d
6 changed files with 137 additions and 22 deletions

View File

@ -7,9 +7,10 @@
******************************************************************************
*/
#include "xenia/debug/ui/views/cpu/call_stack_control.h"
#include "el/animation_manager.h"
#include "xenia/base/string_buffer.h"
#include "xenia/debug/ui/views/cpu/call_stack_control.h"
namespace xe {
namespace debug {

View File

@ -7,9 +7,10 @@
******************************************************************************
*/
#include "xenia/debug/ui/views/cpu/cpu_view.h"
#include "el/animation_manager.h"
#include "xenia/base/string_buffer.h"
#include "xenia/debug/ui/views/cpu/cpu_view.h"
namespace xe {
namespace debug {
@ -50,24 +51,6 @@ el::Element* CpuView::BuildUI() {
.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!")
.id("source_textbox")
.gravity(Gravity::kAll)
.is_multiline(true)
.is_read_only(true));
auto register_list_node = ListBoxNode()
.gravity(Gravity::kAll)
.item("A")
@ -121,7 +104,8 @@ el::Element* CpuView::BuildUI() {
.axis(Axis::kY)
.fixed_pane(FixedPane::kSecond)
.value(240)
.pane(source_code_node)
.pane(LabelNode("<source control>")
.id("source_placeholder"))
.pane(source_registers_node))
.pane(source_tools_node)));
@ -145,18 +129,23 @@ el::Element* CpuView::BuildUI() {
root_element_.set_layout_distribution(LayoutDistribution::kAvailable);
root_element_.LoadNodeTree(node);
el::Label* source_placeholder;
el::Label* gr_registers_placeholder;
el::Label* fr_registers_placeholder;
el::Label* vr_registers_placeholder;
el::Label* host_registers_placeholder;
el::Label* call_stack_placeholder;
root_element_.GetElementsById({
{TBIDC("source_placeholder"), &source_placeholder},
{TBIDC("gr_registers_placeholder"), &gr_registers_placeholder},
{TBIDC("fr_registers_placeholder"), &fr_registers_placeholder},
{TBIDC("vr_registers_placeholder"), &vr_registers_placeholder},
{TBIDC("host_registers_placeholder"), &host_registers_placeholder},
{TBIDC("call_stack_placeholder"), &call_stack_placeholder},
});
source_placeholder->parent()->ReplaceChild(source_placeholder,
source_control_.BuildUI());
source_control_.Setup(client_);
gr_registers_placeholder->parent()->ReplaceChild(
gr_registers_placeholder, gr_registers_control_.BuildUI());
gr_registers_control_.Setup(client_);
@ -274,6 +263,7 @@ void CpuView::UpdateThreadList() {
void CpuView::SwitchCurrentThread(model::Thread* thread) {
current_thread_ = thread;
source_control_.set_thread(thread);
gr_registers_control_.set_thread(thread);
fr_registers_control_.set_thread(thread);
vr_registers_control_.set_thread(thread);

View File

@ -16,6 +16,7 @@
#include "xenia/debug/ui/view.h"
#include "xenia/debug/ui/views/cpu/call_stack_control.h"
#include "xenia/debug/ui/views/cpu/register_list_control.h"
#include "xenia/debug/ui/views/cpu/source_control.h"
namespace xe {
namespace debug {
@ -43,6 +44,7 @@ class CpuView : public View {
// TODO(benvanik): better state machine.
model::Thread* current_thread_ = nullptr;
SourceControl source_control_;
RegisterListControl gr_registers_control_;
RegisterListControl fr_registers_control_;
RegisterListControl vr_registers_control_;

View File

@ -7,6 +7,8 @@
******************************************************************************
*/
#include "xenia/debug/ui/views/cpu/register_list_control.h"
#include <cinttypes>
#include <cstdlib>
@ -14,7 +16,6 @@
#include "xenia/base/string_buffer.h"
#include "xenia/base/string_util.h"
#include "xenia/cpu/x64_context.h"
#include "xenia/debug/ui/views/cpu/register_list_control.h"
namespace xe {
namespace debug {

View File

@ -0,0 +1,75 @@
/**
******************************************************************************
* 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 "xenia/debug/ui/views/cpu/source_control.h"
#include "el/animation_manager.h"
#include "xenia/base/string_buffer.h"
namespace xe {
namespace debug {
namespace ui {
namespace views {
namespace cpu {
SourceControl::SourceControl() = default;
SourceControl::~SourceControl() = default;
el::Element* SourceControl::BuildUI() {
using namespace el::dsl; // NOLINT(build/namespaces)
el::AnimationBlocker animation_blocker;
auto 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!")
.id("source_textbox")
.gravity(Gravity::kAll)
.is_multiline(true)
.is_read_only(true));
root_element_.set_gravity(Gravity::kAll);
root_element_.set_layout_distribution(LayoutDistribution::kAvailable);
root_element_.LoadNodeTree(node);
handler_ = std::make_unique<el::EventHandler>(&root_element_);
return &root_element_;
}
void SourceControl::Setup(DebugClient* client) {
client_ = client;
// system()->on_thread_state_updated.AddListener([this](model::Thread* thread)
// {
// if (thread == thread_) {
// InvalidateCallStack();
// }
//});
}
void SourceControl::set_thread(model::Thread* thread) {
thread_ = thread;
// InvalidateCallStack();
}
} // namespace cpu
} // namespace views
} // namespace ui
} // namespace debug
} // namespace xe

View File

@ -0,0 +1,46 @@
/**
******************************************************************************
* 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_SOURCE_CONTROL_H_
#define XENIA_DEBUG_UI_VIEWS_CPU_SOURCE_CONTROL_H_
#include <memory>
#include <string>
#include "xenia/debug/ui/control.h"
namespace xe {
namespace debug {
namespace ui {
namespace views {
namespace cpu {
class SourceControl : public Control {
public:
SourceControl();
~SourceControl() override;
el::Element* BuildUI() override;
void Setup(xe::debug::DebugClient* client) override;
model::Thread* thread() const { return thread_; }
void set_thread(model::Thread* thread);
private:
model::Thread* thread_ = nullptr;
};
} // namespace cpu
} // namespace views
} // namespace ui
} // namespace debug
} // namespace xe
#endif // XENIA_DEBUG_UI_VIEWS_CPU_SOURCE_CONTROL_H_