cleanup of archiving code
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17674 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
693f381e83
commit
95f766fa3e
@ -296,7 +296,7 @@ BWindow::BWindow(BMessage* data)
|
|||||||
|
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
while ( data->FindMessage("_views", i++, &msg) == B_OK){
|
while (data->FindMessage("_views", i++, &msg) == B_OK) {
|
||||||
BArchivable *obj = instantiate_object(&msg);
|
BArchivable *obj = instantiate_object(&msg);
|
||||||
BView *child = dynamic_cast<BView *>(obj);
|
BView *child = dynamic_cast<BView *>(obj);
|
||||||
if (child)
|
if (child)
|
||||||
@ -372,47 +372,62 @@ BWindow::Instantiate(BMessage *data)
|
|||||||
status_t
|
status_t
|
||||||
BWindow::Archive(BMessage* data, bool deep) const
|
BWindow::Archive(BMessage* data, bool deep) const
|
||||||
{
|
{
|
||||||
status_t retval = BLooper::Archive(data, deep);
|
status_t ret = BLooper::Archive(data, deep);
|
||||||
if (retval != B_OK)
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
data->AddRect("_frame", fFrame);
|
if (ret == B_OK)
|
||||||
data->AddString("_title", fTitle);
|
ret = data->AddRect("_frame", fFrame);
|
||||||
data->AddInt32("_wlook", fLook);
|
if (ret == B_OK)
|
||||||
data->AddInt32("_wfeel", fFeel);
|
ret = data->AddString("_title", fTitle);
|
||||||
if (fFlags)
|
if (ret == B_OK)
|
||||||
data->AddInt32("_flags", fFlags);
|
ret = data->AddInt32("_wlook", fLook);
|
||||||
data->AddInt32("_wspace", (uint32)Workspaces());
|
if (ret == B_OK)
|
||||||
|
ret = data->AddInt32("_wfeel", fFeel);
|
||||||
|
if (ret == B_OK && fFlags != 0)
|
||||||
|
ret = data->AddInt32("_flags", fFlags);
|
||||||
|
if (ret == B_OK)
|
||||||
|
ret = data->AddInt32("_wspace", (uint32)Workspaces());
|
||||||
|
|
||||||
if (!_ComposeType(fLook, fFeel))
|
if (ret == B_OK && !_ComposeType(fLook, fFeel))
|
||||||
data->AddInt32("_type", (uint32)Type());
|
ret = data->AddInt32("_type", (uint32)Type());
|
||||||
|
|
||||||
if (fMaxZoomWidth != 32768.0 || fMaxZoomHeight != 32768.0) {
|
if (fMaxZoomWidth != 32768.0 || fMaxZoomHeight != 32768.0) {
|
||||||
data->AddFloat("_zoom", fMaxZoomWidth);
|
if (ret == B_OK)
|
||||||
data->AddFloat("_zoom", fMaxZoomHeight);
|
ret = data->AddFloat("_zoom", fMaxZoomWidth);
|
||||||
|
if (ret == B_OK)
|
||||||
|
ret = data->AddFloat("_zoom", fMaxZoomHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fMinWidth != 0.0 || fMinHeight != 0.0
|
if (fMinWidth != 0.0 || fMinHeight != 0.0
|
||||||
|| fMaxWidth != 32768.0 || fMaxHeight != 32768.0) {
|
|| fMaxWidth != 32768.0 || fMaxHeight != 32768.0) {
|
||||||
data->AddFloat("_sizel", fMinWidth);
|
if (ret == B_OK)
|
||||||
data->AddFloat("_sizel", fMinHeight);
|
ret = data->AddFloat("_sizel", fMinWidth);
|
||||||
data->AddFloat("_sizel", fMaxWidth);
|
if (ret == B_OK)
|
||||||
data->AddFloat("_sizel", fMaxHeight);
|
ret = data->AddFloat("_sizel", fMinHeight);
|
||||||
|
if (ret == B_OK)
|
||||||
|
ret = data->AddFloat("_sizel", fMaxWidth);
|
||||||
|
if (ret == B_OK)
|
||||||
|
ret = data->AddFloat("_sizel", fMaxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fPulseRate != 500000)
|
if (ret == B_OK && fPulseRate != 500000)
|
||||||
data->AddInt64("_pulse", fPulseRate);
|
data->AddInt64("_pulse", fPulseRate);
|
||||||
|
|
||||||
if (deep) {
|
if (ret == B_OK && deep) {
|
||||||
int32 noOfViews = CountChildren();
|
int32 noOfViews = CountChildren();
|
||||||
for (int32 i = 0; i < noOfViews; i++){
|
for (int32 i = 0; i < noOfViews; i++){
|
||||||
BMessage childArchive;
|
BMessage childArchive;
|
||||||
if (ChildAt(i)->Archive(&childArchive, deep) == B_OK)
|
ret = ChildAt(i)->Archive(&childArchive, true);
|
||||||
data->AddMessage("_views", &childArchive);
|
if (ret == B_OK)
|
||||||
|
ret = data->AddMessage("_views", &childArchive);
|
||||||
|
if (ret != B_OK)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
if (ret == B_OK)
|
||||||
|
ret = data->AddString("class", "BWindow");
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1039,6 +1054,8 @@ FrameMoved(origin);
|
|||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
if (BView* view = _FindView((int32)tokens.ItemAtFast(i)))
|
if (BView* view = _FindView((int32)tokens.ItemAtFast(i)))
|
||||||
view->_Draw(updateRect);
|
view->_Draw(updateRect);
|
||||||
|
else
|
||||||
|
printf("_UPDATE_ - didn't find view by token: %ld\n", (int32)tokens.ItemAtFast(i));
|
||||||
}
|
}
|
||||||
// TODO: the tokens are actually hirachically sorted,
|
// TODO: the tokens are actually hirachically sorted,
|
||||||
// so traversing the list in revers and calling
|
// so traversing the list in revers and calling
|
||||||
|
Loading…
Reference in New Issue
Block a user