fixed some Archive() following stippi's path
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17190 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -222,27 +222,33 @@ BAlert::Instantiate(BMessage* data)
|
||||
status_t
|
||||
BAlert::Archive(BMessage* data, bool deep) const
|
||||
{
|
||||
BWindow::Archive(data, deep);
|
||||
status_t ret = BWindow::Archive(data, deep);
|
||||
|
||||
// Stow the text
|
||||
data->AddString("_text", fTextView->Text());
|
||||
if (ret == B_OK)
|
||||
ret = data->AddString("_text", fTextView->Text());
|
||||
|
||||
// Stow the alert type
|
||||
data->AddInt32("_atype", fMsgType);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt32("_atype", fMsgType);
|
||||
|
||||
// Stow the button width
|
||||
data->AddInt32("_but_width", fButtonWidth);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt32("_but_width", fButtonWidth);
|
||||
|
||||
// Stow the shortcut keys
|
||||
if (fKeys[0] || fKeys[1] || fKeys[2]) {
|
||||
// If we have any to save, we must save something for everyone so it
|
||||
// doesn't get confusing on the unarchive.
|
||||
data->AddInt8("_but_key", fKeys[0]);
|
||||
data->AddInt8("_but_key", fKeys[1]);
|
||||
data->AddInt8("_but_key", fKeys[2]);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt8("_but_key", fKeys[0]);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt8("_but_key", fKeys[1]);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt8("_but_key", fKeys[2]);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,18 +57,18 @@ BBox::Instantiate(BMessage *archive)
|
||||
status_t
|
||||
BBox::Archive(BMessage *archive, bool deep) const
|
||||
{
|
||||
BView::Archive(archive, deep);
|
||||
status_t ret = BView::Archive(archive, deep);
|
||||
|
||||
if (fLabel)
|
||||
archive->AddString("_label", fLabel);
|
||||
if (fLabel && ret == B_OK)
|
||||
ret = archive->AddString("_label", fLabel);
|
||||
|
||||
if (fLabelView)
|
||||
archive->AddBool("_lblview", true);
|
||||
if (fLabelView && ret == B_OK)
|
||||
ret = archive->AddBool("_lblview", true);
|
||||
|
||||
if (fStyle != B_FANCY_BORDER)
|
||||
archive->AddInt32("_style", fStyle);
|
||||
if (fStyle != B_FANCY_BORDER && ret == B_OK)
|
||||
ret = archive->AddInt32("_style", fStyle);
|
||||
|
||||
return B_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -121,14 +121,18 @@ status_t
|
||||
BDragger::Archive(BMessage *data, bool deep) const
|
||||
{
|
||||
BMessage popupMsg;
|
||||
status_t ret = B_OK;
|
||||
|
||||
if (fPopUp) {
|
||||
fPopUp->Archive(&popupMsg);
|
||||
data->AddMessage("_popup", &popupMsg);
|
||||
ret = fPopUp->Archive(&popupMsg);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddMessage("_popup", &popupMsg);
|
||||
}
|
||||
|
||||
data->AddInt32("_rel", fRelation);
|
||||
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt32("_rel", fRelation);
|
||||
if (ret != B_OK)
|
||||
return ret;
|
||||
return BView::Archive(data, deep);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,19 +132,21 @@ BMenuField::Instantiate(BMessage *data)
|
||||
status_t
|
||||
BMenuField::Archive(BMessage *data, bool deep) const
|
||||
{
|
||||
BView::Archive(data, deep);
|
||||
status_t ret = BView::Archive(data, deep);
|
||||
|
||||
if (Label())
|
||||
data->AddString("_label", Label());
|
||||
if (ret == B_OK && Label())
|
||||
ret = data->AddString("_label", Label());
|
||||
|
||||
if (!IsEnabled())
|
||||
data->AddBool("_disable", true);
|
||||
if (ret == B_OK && !IsEnabled())
|
||||
ret = data->AddBool("_disable", true);
|
||||
|
||||
data->AddInt32("_align", Alignment());
|
||||
data->AddFloat("_divide", Divider());
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt32("_align", Alignment());
|
||||
if (ret == B_OK)
|
||||
ret = data->AddFloat("_divide", Divider());
|
||||
|
||||
if (fFixedSizeMB)
|
||||
data->AddBool("be:fixeds", true);
|
||||
if (ret == B_OK && fFixedSizeMB)
|
||||
ret = data->AddBool("be:fixeds", true);
|
||||
|
||||
// BMenuItem *item = fMenuBar->ItemAt(0);
|
||||
// if (!item)
|
||||
@@ -154,7 +156,7 @@ BMenuField::Archive(BMessage *data, bool deep) const
|
||||
// if (bmcitem && !bmcitem->fShowPopUpMarker)
|
||||
// data->AddBool("be:dmark", false);
|
||||
|
||||
return B_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -182,34 +182,36 @@ BMenuItem::Instantiate(BMessage *data)
|
||||
status_t
|
||||
BMenuItem::Archive(BMessage *data, bool deep) const
|
||||
{
|
||||
status_t ret = B_OK;
|
||||
if (fLabel)
|
||||
data->AddString("_label", Label());
|
||||
ret = data->AddString("_label", Label());
|
||||
|
||||
if (!IsEnabled())
|
||||
data->AddBool("_disable", true);
|
||||
if (ret == B_OK && !IsEnabled())
|
||||
ret = data->AddBool("_disable", true);
|
||||
|
||||
if (IsMarked())
|
||||
data->AddBool("_marked", true);
|
||||
if (ret == B_OK && IsMarked())
|
||||
ret = data->AddBool("_marked", true);
|
||||
|
||||
if (fUserTrigger)
|
||||
data->AddInt32("_user_trig", fUserTrigger);
|
||||
if (ret == B_OK && fUserTrigger)
|
||||
ret = data->AddInt32("_user_trig", fUserTrigger);
|
||||
|
||||
if (fShortcutChar) {
|
||||
data->AddInt32("_shortcut", fShortcutChar);
|
||||
data->AddInt32("_mods", fModifiers);
|
||||
if (ret == B_OK && fShortcutChar) {
|
||||
ret = data->AddInt32("_shortcut", fShortcutChar);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt32("_mods", fModifiers);
|
||||
}
|
||||
|
||||
if (Message())
|
||||
data->AddMessage("_msg", Message());
|
||||
if (ret == B_OK && Message())
|
||||
ret = data->AddMessage("_msg", Message());
|
||||
|
||||
if (deep && fSubmenu) {
|
||||
if (ret == B_OK && deep && fSubmenu) {
|
||||
BMessage submenu;
|
||||
|
||||
if (fSubmenu->Archive(&submenu, true) == B_OK)
|
||||
data->AddMessage("_submenu", &submenu);
|
||||
ret = data->AddMessage("_submenu", &submenu);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -236,12 +236,16 @@ BPicture::Archive(BMessage *archive, bool deep) const
|
||||
return err;
|
||||
|
||||
err = archive->AddData("_data", B_RAW_TYPE, extent->Data(), extent->Size());
|
||||
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
|
||||
for (int32 i = 0; i < extent->CountPictures(); i++) {
|
||||
BMessage picMsg;
|
||||
|
||||
((BPicture*)extent->PictureAt(i))->Archive(&picMsg, deep);
|
||||
archive->AddMessage("piclib", &picMsg);
|
||||
err = archive->AddMessage("piclib", &picMsg);
|
||||
if (err != B_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
@@ -223,16 +223,30 @@ BScrollBar::Instantiate(BMessage *data)
|
||||
status_t
|
||||
BScrollBar::Archive(BMessage *data, bool deep) const
|
||||
{
|
||||
BView::Archive(data,deep);
|
||||
data->AddFloat("_range",fMin);
|
||||
data->AddFloat("_range",fMax);
|
||||
data->AddFloat("_steps",fSmallStep);
|
||||
data->AddFloat("_steps",fLargeStep);
|
||||
data->AddFloat("_val",fValue);
|
||||
data->AddInt32("_orient",(int32)fOrientation);
|
||||
data->AddInt32("_prop",fProportion);
|
||||
status_t err = BView::Archive(data,deep);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
err = data->AddFloat("_range",fMin);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
err = data->AddFloat("_range",fMax);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
err = data->AddFloat("_steps",fSmallStep);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
err = data->AddFloat("_steps",fLargeStep);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
err = data->AddFloat("_val",fValue);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
err = data->AddInt32("_orient",(int32)fOrientation);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
err = data->AddInt32("_prop",fProportion);
|
||||
|
||||
return B_OK;
|
||||
return err;
|
||||
}
|
||||
|
||||
// AttachedToWindow
|
||||
|
||||
@@ -176,32 +176,35 @@ BShape::~BShape()
|
||||
status_t
|
||||
BShape::Archive(BMessage *archive, bool deep) const
|
||||
{
|
||||
status_t error = BArchivable::Archive(archive, deep);
|
||||
status_t err = BArchivable::Archive(archive, deep);
|
||||
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
|
||||
shape_data *data = (shape_data*)fPrivateData;
|
||||
|
||||
// If no valid shape data, return
|
||||
if (data->opCount == 0 || data->ptCount == 0)
|
||||
return error;
|
||||
return err;
|
||||
|
||||
// Avoids allocation for each point
|
||||
archive->AddData("pts", B_POINT_TYPE, data->ptList, sizeof(BPoint), true,
|
||||
err = archive->AddData("pts", B_POINT_TYPE, data->ptList, sizeof(BPoint), true,
|
||||
data->ptCount);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
|
||||
for (int32 i = 1; i < data->ptCount; i++)
|
||||
archive->AddPoint("pts", data->ptList[i]);
|
||||
for (int32 i = 1; i < data->ptCount && err == B_OK; i++)
|
||||
err = archive->AddPoint("pts", data->ptList[i]);
|
||||
|
||||
// Avoids allocation for each op
|
||||
archive->AddData("ops", B_INT32_TYPE, data->opList, sizeof(int32), true,
|
||||
data->opCount);
|
||||
if (err == B_OK)
|
||||
err = archive->AddData("ops", B_INT32_TYPE, data->opList, sizeof(int32), true,
|
||||
data->opCount);
|
||||
|
||||
for (int32 i = 1; i < data->opCount; i++)
|
||||
archive->AddInt32("ops", data->opList[i]);
|
||||
for (int32 i = 1; i < data->opCount && err == B_OK ; i++)
|
||||
err = archive->AddInt32("ops", data->opList[i]);
|
||||
|
||||
return error;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,14 +59,15 @@ BStringView::Instantiate(BMessage* data)
|
||||
status_t
|
||||
BStringView::Archive(BMessage* data, bool deep) const
|
||||
{
|
||||
BView::Archive(data, deep);
|
||||
status_t err = BView::Archive(data, deep);
|
||||
|
||||
if (fText)
|
||||
data->AddString("_text", fText);
|
||||
if (err == B_OK && fText)
|
||||
err = data->AddString("_text", fText);
|
||||
|
||||
data->AddInt32("_align", fAlign);
|
||||
if (err == B_OK)
|
||||
err = data->AddInt32("_align", fAlign);
|
||||
|
||||
return B_OK;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+52
-45
@@ -443,96 +443,103 @@ BView::Instantiate(BMessage *data)
|
||||
status_t
|
||||
BView::Archive(BMessage *data, bool deep) const
|
||||
{
|
||||
status_t retval = BHandler::Archive(data, deep);
|
||||
if (retval != B_OK)
|
||||
return retval;
|
||||
status_t ret = BHandler::Archive(data, deep);
|
||||
if (ret != B_OK)
|
||||
return ret;
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_FRAME_BIT)
|
||||
data->AddRect("_frame", Bounds().OffsetToCopy(fParentOffset));
|
||||
ret = data->AddRect("_frame", Bounds().OffsetToCopy(fParentOffset));
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_RESIZE_BIT)
|
||||
data->AddInt32("_resize_mode", ResizingMode());
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_RESIZE_BIT)
|
||||
ret = data->AddInt32("_resize_mode", ResizingMode());
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_FLAGS_BIT)
|
||||
data->AddInt32("_flags", Flags());
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_FLAGS_BIT)
|
||||
ret = data->AddInt32("_flags", Flags());
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_EVENT_MASK_BIT) {
|
||||
data->AddInt32("_evmask", fEventMask);
|
||||
data->AddInt32("_evmask", fEventOptions);
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_EVENT_MASK_BIT) {
|
||||
ret = data->AddInt32("_evmask", fEventMask);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt32("_evmask", fEventOptions);
|
||||
}
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_FONT_BIT) {
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_FONT_BIT) {
|
||||
BFont font;
|
||||
GetFont(&font);
|
||||
|
||||
font_family family;
|
||||
font_style style;
|
||||
font.GetFamilyAndStyle(&family, &style);
|
||||
data->AddString("_fname", family);
|
||||
data->AddString("_fname", style);
|
||||
|
||||
data->AddFloat("_fflt", font.Size());
|
||||
data->AddFloat("_fflt", font.Shear());
|
||||
data->AddFloat("_fflt", font.Rotation());
|
||||
ret = data->AddString("_fname", family);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddString("_fname", style);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddFloat("_fflt", font.Size());
|
||||
if (ret == B_OK)
|
||||
ret = data->AddFloat("_fflt", font.Shear());
|
||||
if (ret == B_OK)
|
||||
ret = data->AddFloat("_fflt", font.Rotation());
|
||||
}
|
||||
|
||||
// colors
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_HIGH_COLOR_BIT)
|
||||
data->AddInt32("_color", get_uint32_color(HighColor()));
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_HIGH_COLOR_BIT)
|
||||
ret = data->AddInt32("_color", get_uint32_color(HighColor()));
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_LOW_COLOR_BIT)
|
||||
data->AddInt32("_color", get_uint32_color(LowColor()));
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_LOW_COLOR_BIT)
|
||||
ret = data->AddInt32("_color", get_uint32_color(LowColor()));
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_VIEW_COLOR_BIT)
|
||||
data->AddInt32("_color", get_uint32_color(ViewColor()));
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_VIEW_COLOR_BIT)
|
||||
ret = data->AddInt32("_color", get_uint32_color(ViewColor()));
|
||||
|
||||
// NOTE: we do not use this flag any more
|
||||
// if ( 1 ){
|
||||
// data->AddInt32("_dbuf", 1);
|
||||
// ret = data->AddInt32("_dbuf", 1);
|
||||
// }
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_ORIGIN_BIT)
|
||||
data->AddPoint("_origin", Origin());
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_ORIGIN_BIT)
|
||||
ret = data->AddPoint("_origin", Origin());
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_PEN_SIZE_BIT)
|
||||
data->AddFloat("_psize", PenSize());
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_PEN_SIZE_BIT)
|
||||
ret = data->AddFloat("_psize", PenSize());
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_PEN_LOCATION_BIT)
|
||||
data->AddPoint("_ploc", PenLocation());
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_PEN_LOCATION_BIT)
|
||||
ret = data->AddPoint("_ploc", PenLocation());
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_LINE_MODES_BIT) {
|
||||
data->AddInt16("_lmcapjoin", (int16)LineCapMode());
|
||||
data->AddInt16("_lmcapjoin", (int16)LineJoinMode());
|
||||
data->AddFloat("_lmmiter", LineMiterLimit());
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_LINE_MODES_BIT) {
|
||||
ret = data->AddInt16("_lmcapjoin", (int16)LineCapMode());
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt16("_lmcapjoin", (int16)LineJoinMode());
|
||||
if (ret == B_OK)
|
||||
ret = data->AddFloat("_lmmiter", LineMiterLimit());
|
||||
}
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_BLENDING_BIT) {
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_BLENDING_BIT) {
|
||||
source_alpha alphaSourceMode;
|
||||
alpha_function alphaFunctionMode;
|
||||
GetBlendingMode(&alphaSourceMode, &alphaFunctionMode);
|
||||
|
||||
data->AddInt16("_blend", (int16)alphaSourceMode);
|
||||
data->AddInt16("_blend", (int16)alphaFunctionMode);
|
||||
ret = data->AddInt16("_blend", (int16)alphaSourceMode);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddInt16("_blend", (int16)alphaFunctionMode);
|
||||
}
|
||||
|
||||
if (fState->archiving_flags & B_VIEW_DRAWING_MODE_BIT)
|
||||
data->AddInt32("_dmod", DrawingMode());
|
||||
if (ret == B_OK && fState->archiving_flags & B_VIEW_DRAWING_MODE_BIT)
|
||||
ret = data->AddInt32("_dmod", DrawingMode());
|
||||
|
||||
if (deep) {
|
||||
int32 i = 0;
|
||||
BView *child;
|
||||
|
||||
while ((child = ChildAt(i++)) != NULL) {
|
||||
while (ret == B_OK && (child = ChildAt(i++)) != NULL) {
|
||||
BMessage childArchive;
|
||||
|
||||
retval = child->Archive(&childArchive, deep);
|
||||
if (retval == B_OK)
|
||||
data->AddMessage("_views", &childArchive);
|
||||
ret = child->Archive(&childArchive, deep);
|
||||
if (ret == B_OK)
|
||||
ret = data->AddMessage("_views", &childArchive);
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user