Big cleanup, rewrote Shelf.h.

Fixed bug in BShelf::ReplicantAt() - it is supposed to test if any of
the variables passed in is NULL before writing to them.
Got rid of the _PR3_COMPATIBLE_ stuff - we definitely don't need that :)
Refactored the code a bit - moved the identical parts of the three
DeleteReplicant() variants into a separate method _DeleteReplicant(),
moved _rep_data_ code out of the class definition, replaced names like
"fView2" and "aBool" with something more meaningful.
Prefixed private methods with '_'.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13471 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-07-06 00:43:52 +00:00
parent 4da171eff7
commit 508d8a847f
2 changed files with 356 additions and 398 deletions

View File

@ -1,145 +1,115 @@
/*******************************************************************************
/
/ File: Shelf.h
/
/ Description: BShelf stores replicant views that are dropped onto it
/
/ Copyright 1996-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
/*
* Copyright 2001-2005, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _SHELF_H
#define _SHELF_H
#include <BeBuild.h>
#include <Handler.h>
#include <List.h>
class BDataIO;
class BView;
class BEntry;
extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
const BMessage*, const BView*);
struct entry_ref;
/*----------------------------------------------------------------*/
/*----- BShelf class ---------------------------------------------*/
class _rep_data_;
class BShelf : public BHandler {
public:
BShelf(BView *view,
bool allow_drags = true,
const char *shelf_type = NULL);
BShelf(const entry_ref *ref,
BView *view,
bool allow_drags = true,
const char *shelf_type = NULL);
BShelf(BDataIO *stream,
BView *view,
bool allow_drags = true,
const char *shelf_type = NULL);
BShelf(BMessage *data);
virtual ~BShelf();
public:
BShelf(BView* view, bool allowDrags = true, const char* shelfType = NULL);
BShelf(const entry_ref* ref, BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BDataIO* stream, BView* view, bool allowDrags = true,
const char* shelfType = NULL);
BShelf(BMessage *data);
virtual ~BShelf();
virtual status_t Archive(BMessage *data, bool deep = true) const;
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
virtual void MessageReceived(BMessage *msg);
status_t Save();
virtual void SetDirty(bool state);
bool IsDirty() const;
virtual void MessageReceived(BMessage *msg);
status_t Save();
virtual void SetDirty(bool state);
bool IsDirty() const;
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual BHandler* ResolveSpecifier(BMessage *msg,
int32 index, BMessage *specifier,
int32 form, const char *property);
virtual status_t GetSupportedSuites(BMessage* data);
virtual status_t Perform(perform_code d, void *arg);
bool AllowsDragging() const;
void SetAllowsDragging(bool state);
bool AllowsZombies() const;
void SetAllowsZombies(bool state);
bool DisplaysZombies() const;
void SetDisplaysZombies(bool state);
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
virtual status_t Perform(perform_code d, void *arg);
bool AllowsDragging() const;
void SetAllowsDragging(bool state);
bool AllowsZombies() const;
void SetAllowsZombies(bool state);
bool DisplaysZombies() const;
void SetDisplaysZombies(bool state);
bool IsTypeEnforced() const;
void SetTypeEnforced(bool state);
status_t SetSaveLocation(BDataIO *data_io);
status_t SetSaveLocation(const entry_ref *ref);
BDataIO *SaveLocation(entry_ref *ref) const;
status_t SetSaveLocation(BDataIO *data_io);
status_t SetSaveLocation(const entry_ref *ref);
BDataIO* SaveLocation(entry_ref *ref) const;
status_t AddReplicant(BMessage *data, BPoint location);
status_t DeleteReplicant(BView *replicant);
status_t DeleteReplicant(BMessage *data);
status_t DeleteReplicant(int32 index);
int32 CountReplicants() const;
BMessage *ReplicantAt(int32 index,
BView **view = NULL,
uint32 *uid = NULL,
status_t *perr = NULL) const;
int32 IndexOf(const BView *replicant_view) const;
int32 IndexOf(const BMessage *archive) const;
int32 IndexOf(uint32 id) const;
status_t AddReplicant(BMessage *data, BPoint location);
status_t DeleteReplicant(BView *replicant);
status_t DeleteReplicant(BMessage *data);
status_t DeleteReplicant(int32 index);
int32 CountReplicants() const;
BMessage* ReplicantAt(int32 index,
BView **view = NULL,
uint32 *uid = NULL,
status_t *perr = NULL) const;
int32 IndexOf(const BView *replicantView) const;
int32 IndexOf(const BMessage *archive) const;
int32 IndexOf(uint32 id) const;
protected:
virtual bool CanAcceptReplicantMessage(BMessage*) const;
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
protected:
virtual bool CanAcceptReplicantMessage(BMessage*) const;
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
virtual void ReplicantDeleted(int32 index,
const BMessage *archive,
const BView *replicant);
virtual void ReplicantDeleted(int32 index, const BMessage *archive,
const BView *replicant);
/*----- Private or reserved -----------------------------------------*/
private:
friend class _TContainerViewFilter_;
friend void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
const BMessage*, const BView*);
virtual void _ReservedShelf2();
virtual void _ReservedShelf3();
virtual void _ReservedShelf4();
virtual void _ReservedShelf5();
private:
friend class _TContainerViewFilter_;
#if !_PR3_COMPATIBLE_
virtual void _ReservedShelf6();
virtual void _ReservedShelf7();
virtual void _ReservedShelf8();
#endif
BShelf(const BShelf&);
BShelf &operator=(const BShelf &);
virtual void _ReservedShelf2();
virtual void _ReservedShelf3();
virtual void _ReservedShelf4();
virtual void _ReservedShelf5();
virtual void _ReservedShelf6();
virtual void _ReservedShelf7();
virtual void _ReservedShelf8();
status_t _Archive(BMessage *data) const;
void InitData(BEntry *entry,
BDataIO *stream,
BView *view,
bool allow_drags);
status_t RealAddReplicant(BMessage *data,
BPoint *loc,
uint32 uid);
status_t GetProperty(BMessage *msg, BMessage *reply);
BShelf(const BShelf& other);
BShelf& operator=(const BShelf& other);
BView *fContainerView;
BDataIO *fStream;
BEntry *fEntry;
BList fReplicants;
_TContainerViewFilter_ *fFilter;
uint32 fGenCount;
bool fAllowDragging;
bool fDirty;
bool fDisplayZombies;
bool fAllowZombies;
bool fTypeEnforced;
status_t _Archive(BMessage* data) const;
void _InitData(BEntry* entry, BDataIO* stream,
BView* view, bool allowDrags);
status_t _DeleteReplicant(_rep_data_* replicant);
status_t _RealAddReplicant(BMessage* data,
BPoint* location, uint32 uniqueID);
status_t _GetProperty(BMessage* message, BMessage* reply);
uint32 _reserved[3]; /* was 5 */
#if !_PR3_COMPATIBLE_
uint32 _more_reserved[5];
#endif
private:
BView* fContainerView;
BDataIO* fStream;
BEntry* fEntry;
BList fReplicants;
_TContainerViewFilter_* fFilter;
uint32 fGenCount;
bool fAllowDragging;
bool fDirty;
bool fDisplayZombies;
bool fAllowZombies;
bool fTypeEnforced;
uint32 _reserved[8];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _SHELF_H */
#endif /* _SHELF_H */

View File

@ -1,32 +1,15 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2004, Haiku
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Shelf.cpp
// Author: Marc Flerackers (mflerackers@androme.be)
// Description: BShelf stores replicant views that are dropped onto it
//------------------------------------------------------------------------------
/*
* Copyright 2001-2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers (mflerackers@androme.be)
* Axel Dörfler, axeld@pinc-software.de
*/
/** BShelf stores replicant views that are dropped onto it */
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <Beep.h>
#include <Dragger.h>
#include <Entry.h>
@ -44,113 +27,26 @@
#include <stdio.h>
extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
const BMessage*, const BView*);
class _rep_data_ {
private:
friend class BShelf;
_rep_data_(BMessage *message, BView *view, BDragger *dragger,
BDragger::relation relation, unsigned long id, image_id image)
:
fMessage(message),
fView(view),
fDragger(NULL),
fRelation(relation),
fId(id),
fImage(image),
fError(B_OK),
fView2(NULL)
{
}
BDragger::relation relation, unsigned long id, image_id image);
_rep_data_();
_rep_data_()
:
fMessage(NULL),
fView(NULL),
fDragger(NULL),
fRelation(BDragger::TARGET_UNKNOWN),
fId(0),
fError(B_ERROR),
fView2(NULL)
{
}
static _rep_data_* find(BList const *list, BMessage const *msg);
static _rep_data_* find(BList const *list, BView const *view, bool allowZombie);
static _rep_data_* find(BList const *list, unsigned long id);
static _rep_data_ *find(BList const *list, BMessage const *msg)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fMessage == msg)
return item;
}
return NULL;
}
static _rep_data_ *find(BList const *list, BView const *view, bool aBool)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fView == view)
return item;
if (aBool && item->fView2 == view)
return item;
}
return NULL;
}
static _rep_data_ *find(BList const *list, unsigned long id)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fId == id)
return item;
}
return NULL;
}
static int32 index_of(BList const *list, BMessage const *msg)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fMessage == msg)
return i;
}
return -1;
}
static int32 index_of(BList const *list, BView const *view, bool aBool)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fView == view)
return i;
if (aBool && item->fView2 == view)
return i;
}
return -1;
}
static int32 index_of(BList const *list, unsigned long id)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fId == id)
return i;
}
return -1;
}
friend class BShelf;
static int32 index_of(BList const *list, BMessage const *msg);
static int32 index_of(BList const *list, BView const *view, bool allowZombie);
static int32 index_of(BList const *list, unsigned long id);
BMessage *fMessage;
BView *fView;
@ -159,23 +55,154 @@ friend class BShelf;
unsigned long fId;
image_id fImage;
status_t fError;
BView *fView2;
BView *fZombieView;
};
class _TContainerViewFilter_ : public BMessageFilter {
public:
_TContainerViewFilter_(BShelf *shelf, BView *view);
virtual ~_TContainerViewFilter_();
public:
_TContainerViewFilter_(BShelf *shelf, BView *view);
virtual ~_TContainerViewFilter_();
filter_result Filter(BMessage *msg, BHandler **handler);
filter_result ObjectDropFilter(BMessage *msg, BHandler **handler);
protected:
BShelf *fShelf;
BView *fView;
};
// #pragma mark -
_rep_data_::_rep_data_(BMessage *message, BView *view, BDragger *dragger,
BDragger::relation relation, unsigned long id, image_id image)
:
fMessage(message),
fView(view),
fDragger(NULL),
fRelation(relation),
fId(id),
fImage(image),
fError(B_OK),
fZombieView(NULL)
{
}
_rep_data_::_rep_data_()
:
fMessage(NULL),
fView(NULL),
fDragger(NULL),
fRelation(BDragger::TARGET_UNKNOWN),
fId(0),
fError(B_ERROR),
fZombieView(NULL)
{
}
//static
_rep_data_ *
_rep_data_::find(BList const *list, BMessage const *msg)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fMessage == msg)
return item;
}
return NULL;
}
//static
_rep_data_ *
_rep_data_::find(BList const *list, BView const *view, bool allowZombie)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fView == view)
return item;
if (allowZombie && item->fZombieView == view)
return item;
}
return NULL;
}
//static
_rep_data_ *
_rep_data_::find(BList const *list, unsigned long id)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fId == id)
return item;
}
return NULL;
}
//static
int32
_rep_data_::index_of(BList const *list, BMessage const *msg)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fMessage == msg)
return i;
}
return -1;
}
//static
int32
_rep_data_::index_of(BList const *list, BView const *view, bool allowZombie)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fView == view)
return i;
if (allowZombie && item->fZombieView == view)
return i;
}
return -1;
}
//static
int32
_rep_data_::index_of(BList const *list, unsigned long id)
{
int32 i = 0;
_rep_data_ *item;
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
if (item->fId == id)
return i;
}
return -1;
}
// #pragma mark -
_TContainerViewFilter_::_TContainerViewFilter_(BShelf *shelf, BView *view)
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE)
{
@ -261,7 +288,7 @@ _TContainerViewFilter_::ObjectDropFilter(BMessage *msg, BHandler **_handler)
}
} else {
if (fShelf->RealAddReplicant(msg, &point, 0) == B_OK)
if (fShelf->_RealAddReplicant(msg, &point, 0) == B_OK)
Looper()->DetachCurrentMessage();
}
@ -269,54 +296,61 @@ _TContainerViewFilter_::ObjectDropFilter(BMessage *msg, BHandler **_handler)
}
class _TReplicantViewFilter_ : public BMessageFilter {
public:
_TReplicantViewFilter_(BShelf *shelf, BView *view)
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE)
{
fShelf = shelf;
fView = view;
}
virtual ~_TReplicantViewFilter_()
{
}
filter_result Filter(BMessage *, BHandler **)
{
return B_DISPATCH_MESSAGE;
}
// #pragma mark -
class _TReplicantViewFilter_ : public BMessageFilter {
public:
_TReplicantViewFilter_(BShelf *shelf, BView *view)
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE)
{
fShelf = shelf;
fView = view;
}
virtual ~_TReplicantViewFilter_()
{
}
filter_result Filter(BMessage *, BHandler **)
{
return B_DISPATCH_MESSAGE;
}
protected:
BShelf *fShelf;
BView *fView;
};
// **** BShelf ****
// #pragma mark -
BShelf::BShelf(BView *view, bool allow_drags, const char *shelf_type)
: BHandler(shelf_type)
: BHandler(shelf_type)
{
InitData(NULL, NULL, view, allow_drags);
_InitData(NULL, NULL, view, allow_drags);
}
BShelf::BShelf(const entry_ref *ref, BView *view, bool allow_drags,
const char *shelf_type)
: BHandler(shelf_type)
const char *shelf_type)
: BHandler(shelf_type)
{
InitData(new BEntry(ref), NULL, view, allow_drags);
_InitData(new BEntry(ref), NULL, view, allow_drags);
}
BShelf::BShelf(BDataIO *stream, BView *view, bool allow_drags,
const char *shelf_type)
: BHandler(shelf_type)
const char *shelf_type)
: BHandler(shelf_type)
{
InitData(NULL, stream, view, allow_drags);
_InitData(NULL, stream, view, allow_drags);
}
BShelf::BShelf(BMessage *data)
: BHandler(data)
: BHandler(data)
{
// TODO: Implement ?
}
@ -493,26 +527,25 @@ BShelf::SaveLocation(entry_ref *ref) const
if (fStream && ref) {
*ref = entry;
return fStream;
} else if (fEntry) {
}
if (fEntry) {
fEntry->GetRef(&entry);
if (ref)
*ref = entry;
return NULL;
} else {
*ref = entry;
return NULL;
}
*ref = entry;
return NULL;
}
status_t
BShelf::AddReplicant(BMessage *data, BPoint location)
{
return RealAddReplicant(data, &location, 0);
return _RealAddReplicant(data, &location, 0);
}
@ -522,33 +555,10 @@ BShelf::DeleteReplicant(BView *replicant)
int32 index = _rep_data_::index_of(&fReplicants, replicant, true);
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
if (item == NULL)
return B_BAD_VALUE;
if (!item)
return B_ERROR;
bool aBool;
item->fMessage->FindBool("", &aBool);
BView *view = item->fView;
if (!view)
view = item->fView2;
if (view)
view->RemoveSelf();
if (item->fDragger)
item->fDragger->RemoveSelf();
fReplicants.RemoveItem(item);
if (aBool && item->fImage >= 0)
unload_add_on(item->fImage);
delete item;
return B_OK;
return _DeleteReplicant(item);
}
@ -558,33 +568,10 @@ BShelf::DeleteReplicant(BMessage *data)
int32 index = _rep_data_::index_of(&fReplicants, data);
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
if (!item)
return B_ERROR;
return B_BAD_VALUE;
bool aBool;
item->fMessage->FindBool("", &aBool);
BView *view = item->fView;
if (!view)
view = item->fView2;
if (view)
view->RemoveSelf();
if (item->fDragger)
item->fDragger->RemoveSelf();
fReplicants.RemoveItem(item);
if (aBool && item->fImage >= 0)
unload_add_on(item->fImage);
delete item;
return B_OK;
return _DeleteReplicant(item);
}
@ -592,35 +579,10 @@ status_t
BShelf::DeleteReplicant(int32 index)
{
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
if (!item)
return B_ERROR;
return B_BAD_INDEX;
bool aBool;
item->fMessage->FindBool("", &aBool);
BView *view = item->fView;
if (!view)
view = item->fView2;
if (view)
view->RemoveSelf();
if (item->fDragger)
item->fDragger->RemoveSelf();
ReplicantDeleted(index, item->fMessage, item->fView);
fReplicants.RemoveItem(item);
if (aBool && item->fImage >= 0)
unload_add_on(item->fImage);
delete item;
return B_OK;
return _DeleteReplicant(item);
}
@ -632,27 +594,30 @@ BShelf::CountReplicants() const
BMessage *
BShelf::ReplicantAt(int32 index, BView **view, uint32 *uid,
status_t *perr) const
BShelf::ReplicantAt(int32 index, BView **_view, uint32 *_uniqueID,
status_t *_error) const
{
status_t err = B_ERROR;
BMessage *message = NULL;
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
if (item == NULL) {
// no replicant found
if (_view)
*_view = NULL;
if (_uniqueID)
*_uniqueID = ~0UL;
if (_error)
*_error = B_BAD_INDEX;
if (item) {
message = item->fMessage;
*view = item->fView;
*uid = item->fId;
*perr = item->fError;
} else {
*view = NULL;
*uid = 0;
*perr = err;
return NULL;
}
return message;
if (_view)
*_view = item->fView;
if (_uniqueID)
*_uniqueID = item->fId;
if (_error)
*_error = item->fError;
return item->fMessage;
}
@ -714,11 +679,9 @@ void BShelf::_ReservedShelf2() {}
void BShelf::_ReservedShelf3() {}
void BShelf::_ReservedShelf4() {}
void BShelf::_ReservedShelf5() {}
#if !_PR3_COMPATIBLE_
void BShelf::_ReservedShelf6() {}
void BShelf::_ReservedShelf7() {}
void BShelf::_ReservedShelf8() {}
#endif
BShelf::BShelf(const BShelf&)
@ -751,15 +714,15 @@ BShelf::_Archive(BMessage *data) const
void
BShelf::InitData(BEntry *entry, BDataIO *stream, BView *view,
bool allow_drags)
BShelf::_InitData(BEntry *entry, BDataIO *stream, BView *view,
bool allowDrags)
{
fContainerView = view;
fStream = NULL;
fEntry = entry;
fFilter = NULL;
fGenCount = 1;
fAllowDragging = allow_drags;
fAllowDragging = allowDrags;
fDirty = true;
fDisplayZombies = false;
fAllowZombies = true;
@ -779,20 +742,18 @@ BShelf::InitData(BEntry *entry, BDataIO *stream, BView *view,
BMessage archive;
if (archive.Unflatten(fStream) == B_OK) {
bool aBool;
bool allowZombies;
if (archive.FindBool("_zom_dsp", &allowZombies) != B_OK)
allowZombies = false;
if (!archive.FindBool("_zom_dsp", &aBool))
aBool = false;
SetDisplaysZombies(allowZombies);
SetDisplaysZombies(aBool);
if (archive.FindBool("_zom_alw", &allowZombies) != B_OK)
allowZombies = true;
if (!archive.FindBool("_zom_alw", &aBool))
aBool = true;
SetAllowsZombies(aBool);
SetAllowsZombies(allowZombies);
int32 genCount;
if (!archive.FindInt32("_sg_cnt", &genCount))
genCount = 1;
@ -803,7 +764,34 @@ BShelf::InitData(BEntry *entry, BDataIO *stream, BView *view,
status_t
BShelf::RealAddReplicant(BMessage *data, BPoint *loc, uint32 uid)
BShelf::_DeleteReplicant(_rep_data_* item)
{
bool loadedImage;
item->fMessage->FindBool("", &loadedImage);
BView *view = item->fView;
if (view == NULL)
view = item->fZombieView;
if (view)
view->RemoveSelf();
if (item->fDragger)
item->fDragger->RemoveSelf();
fReplicants.RemoveItem(item);
if (loadedImage && item->fImage >= 0)
unload_add_on(item->fImage);
delete item;
return B_OK;
}
status_t
BShelf::_RealAddReplicant(BMessage *data, BPoint *loc, uint32 uid)
{
BView *replicant = NULL;
BDragger *dragger = NULL;
@ -947,7 +935,7 @@ BShelf::RealAddReplicant(BMessage *data, BPoint *loc, uint32 uid)
image);
item->fError = B_OK;
item->fView2 = zombie;
item->fZombieView = zombie;
if (zombie)
zombie->SetArchive(data);
@ -967,7 +955,7 @@ BShelf::RealAddReplicant(BMessage *data, BPoint *loc, uint32 uid)
status_t
BShelf::GetProperty(BMessage *msg, BMessage *reply)
BShelf::_GetProperty(BMessage *msg, BMessage *reply)
{
//TODO: Implement
return B_ERROR;