summaryrefslogtreecommitdiff
path: root/Applications/VisualBuilder
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-07 23:28:35 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-07 23:28:35 +0200
commit5e733d47a35ffb3779d44a25c4b95fa907b68daf (patch)
tree32ff62e520391c568e039bfa75f6b3a6d58b19c1 /Applications/VisualBuilder
parent5b0c0847eff037dec9e1657a3113754f14c9fe71 (diff)
downloadserenity-5e733d47a35ffb3779d44a25c4b95fa907b68daf.zip
VisualBuilder: Add a way to dump the current form to the debugger.
Diffstat (limited to 'Applications/VisualBuilder')
-rw-r--r--Applications/VisualBuilder/VBForm.cpp13
-rw-r--r--Applications/VisualBuilder/VBForm.h2
-rw-r--r--Applications/VisualBuilder/VBWidget.cpp7
-rw-r--r--Applications/VisualBuilder/VBWidget.h2
-rw-r--r--Applications/VisualBuilder/main.cpp3
5 files changed, 27 insertions, 0 deletions
diff --git a/Applications/VisualBuilder/VBForm.cpp b/Applications/VisualBuilder/VBForm.cpp
index 0b34fe2e4f..2e9af9bfea 100644
--- a/Applications/VisualBuilder/VBForm.cpp
+++ b/Applications/VisualBuilder/VBForm.cpp
@@ -300,6 +300,19 @@ void VBForm::mousemove_event(GMouseEvent& event)
}
}
+void VBForm::dump()
+{
+ dbgprintf("[Form]\n");
+ dbgprintf("Name=%s\n", m_name.characters());
+ dbgprintf("\n");
+ int i = 0;
+ for (auto& widget : m_widgets) {
+ dbgprintf("[Widget %d]\n", i++);
+ widget->dump();
+ dbgprintf("\n");
+ }
+}
+
void VBForm::mouseup_event(GMouseEvent& event)
{
if (event.button() == GMouseButton::Left) {
diff --git a/Applications/VisualBuilder/VBForm.h b/Applications/VisualBuilder/VBForm.h
index 4fa49c0c26..8968719533 100644
--- a/Applications/VisualBuilder/VBForm.h
+++ b/Applications/VisualBuilder/VBForm.h
@@ -25,6 +25,8 @@ public:
Function<void(VBWidget*)> on_widget_selected;
+ void dump();
+
protected:
virtual void paint_event(GPaintEvent&) override;
virtual void second_paint_event(GPaintEvent&) override;
diff --git a/Applications/VisualBuilder/VBWidget.cpp b/Applications/VisualBuilder/VBWidget.cpp
index 83e92167de..5df3eb6696 100644
--- a/Applications/VisualBuilder/VBWidget.cpp
+++ b/Applications/VisualBuilder/VBWidget.cpp
@@ -195,3 +195,10 @@ void VBWidget::capture_transform_origin_rect()
{
m_transform_origin_rect = rect();
}
+
+void VBWidget::dump()
+{
+ for (auto& property : m_properties) {
+ dbgprintf("%s=%s\n", property->name().characters(), property->value().to_string().characters());
+ }
+}
diff --git a/Applications/VisualBuilder/VBWidget.h b/Applications/VisualBuilder/VBWidget.h
index afd240b081..744b7e29c0 100644
--- a/Applications/VisualBuilder/VBWidget.h
+++ b/Applications/VisualBuilder/VBWidget.h
@@ -59,6 +59,8 @@ public:
Rect transform_origin_rect() const { return m_transform_origin_rect; }
void capture_transform_origin_rect();
+ void dump();
+
private:
VBWidget(VBWidgetType, VBForm&);
diff --git a/Applications/VisualBuilder/main.cpp b/Applications/VisualBuilder/main.cpp
index 0e00ab45c5..27642d2a3e 100644
--- a/Applications/VisualBuilder/main.cpp
+++ b/Applications/VisualBuilder/main.cpp
@@ -37,6 +37,9 @@ int main(int argc, char** argv)
menubar->add_menu(move(app_menu));
auto file_menu = make<GMenu>("File");
+ file_menu->add_action(GAction::create("Dump Form", [&] (auto&) {
+ form1->dump();
+ }));
menubar->add_menu(move(file_menu));
auto edit_menu = make<GMenu>("Edit");