LayoutUtils: improve text dump of layout
- Show view names in addition to class names - Use class_name from ClassInfo.h to get class names (no functional change) - Use 4 spaces for indentation instead of 2
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
#include <LayoutUtils.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <typeinfo>
|
||||
|
||||
#include <ClassInfo.h>
|
||||
#include <Layout.h>
|
||||
#include <View.h>
|
||||
|
||||
@@ -280,7 +280,7 @@ BLayoutUtils::GetLayoutTreeDump(BLayoutItem* item)
|
||||
BLayoutUtils::_GetLayoutTreeDump(BView* view, int level, BString& _output)
|
||||
{
|
||||
BString indent;
|
||||
indent.SetTo(' ', level * 2);
|
||||
indent.SetTo(' ', level * 4);
|
||||
|
||||
if (view == NULL) {
|
||||
_output << indent << "<null view>\n";
|
||||
@@ -292,12 +292,12 @@ BLayoutUtils::_GetLayoutTreeDump(BView* view, int level, BString& _output)
|
||||
BSize max = view->MaxSize();
|
||||
BSize preferred = view->PreferredSize();
|
||||
_output << BString().SetToFormat(
|
||||
"%sview %p (%s):\n"
|
||||
"%sview %p (%s %s):\n"
|
||||
"%s frame: (%f, %f, %f, %f)\n"
|
||||
"%s min: (%f, %f)\n"
|
||||
"%s max: (%f, %f)\n"
|
||||
"%s pref: (%f, %f)\n",
|
||||
indent.String(), view, typeid(*view).name(),
|
||||
indent.String(), view, class_name(view), view->Name(),
|
||||
indent.String(), frame.left, frame.top, frame.right, frame.bottom,
|
||||
indent.String(), min.width, min.height,
|
||||
indent.String(), max.width, max.height,
|
||||
@@ -310,7 +310,7 @@ BLayoutUtils::_GetLayoutTreeDump(BView* view, int level, BString& _output)
|
||||
|
||||
int32 count = view->CountChildren();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
_output << indent << " ---\n";
|
||||
_output << indent << " ---\n";
|
||||
_GetLayoutTreeDump(view->ChildAt(i), level + 1, _output);
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ BLayoutUtils::_GetLayoutTreeDump(BLayoutItem* item, int level,
|
||||
}
|
||||
|
||||
BString indent;
|
||||
indent.SetTo(' ', level * 2);
|
||||
indent.SetTo(' ', level * 4);
|
||||
|
||||
if (item == NULL) {
|
||||
_output << indent << "<null item>\n";
|
||||
@@ -340,10 +340,10 @@ BLayoutUtils::_GetLayoutTreeDump(BLayoutItem* item, int level,
|
||||
BSize preferred = item->PreferredSize();
|
||||
if (isViewLayout) {
|
||||
_output << indent << BString().SetToFormat(" [layout %p (%s)]\n",
|
||||
layout, typeid(*layout).name());
|
||||
layout, class_name(layout));
|
||||
} else {
|
||||
_output << indent << BString().SetToFormat("item %p (%s):\n",
|
||||
item, typeid(*item).name());
|
||||
item, class_name(item));
|
||||
}
|
||||
_output << BString().SetToFormat(
|
||||
"%s frame: (%f, %f, %f, %f)\n"
|
||||
@@ -360,7 +360,7 @@ BLayoutUtils::_GetLayoutTreeDump(BLayoutItem* item, int level,
|
||||
|
||||
int32 count = layout->CountItems();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
_output << indent << " ---\n";
|
||||
_output << indent << " ---\n";
|
||||
_GetLayoutTreeDump(layout->ItemAt(i), level + 1, false, _output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user