* integration of vector icons with the registrar and the mime data base
* additional versions of SetIcon[ForType] and GetIcon[ForType] in BMimeType and BAppFileInfo, which handle flat vector icon data * changes in Tracker to support scalable icons (currently broken for non-vector icons and needs cleanup) and drawing icons correctly with alpha channel (large parts of this work done by Michael Lotz) If someone feels like looking over the changes, that would be much appreciated! :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18699 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -124,11 +124,11 @@ BColumn::InstantiateFromStream(BMallocIO *stream, bool endianSwap)
|
||||
version = SwapInt32(version);
|
||||
}
|
||||
|
||||
// PRINT(("validating key %x, version %d\n", key, version));
|
||||
// PRINT(("validating key %x, version %d\n", key, version));
|
||||
if (!ValidateStream(stream, key, version))
|
||||
return 0;
|
||||
|
||||
// PRINT(("instantiating column, %s\n", endianSwap ? "endian swapping," : ""));
|
||||
// PRINT(("instantiating column, %s\n", endianSwap ? "endian swapping," : ""));
|
||||
BColumn *result = new BColumn(stream, endianSwap);
|
||||
|
||||
// sanity-check the resulting column
|
||||
@@ -191,7 +191,7 @@ BColumn::ArchiveToStream(BMallocIO *stream) const
|
||||
int32 version = kColumnStateArchiveVersion;
|
||||
stream->Write(&version, sizeof(int32));
|
||||
|
||||
// PRINT(("ArchiveToStream column, key %x, version %d\n", key, version));
|
||||
// PRINT(("ArchiveToStream column, key %x, version %d\n", key, version));
|
||||
|
||||
StringToStream(&fTitle, stream);
|
||||
stream->Write(&fOffset, sizeof(float));
|
||||
@@ -230,11 +230,13 @@ const char *kViewStatePrimarySortTypeName = "ViewState:fPrimarySortType";
|
||||
const char *kViewStateSecondarySortAttrName = "ViewState:fSecondarySortAttr";
|
||||
const char *kViewStateSecondarySortTypeName = "ViewState:fSecondarySortType";
|
||||
const char *kViewStateReverseSortName = "ViewState:fReverseSort";
|
||||
const char *kViewStateIconSizeName = "ViewState:fIconSize";
|
||||
|
||||
BViewState::BViewState()
|
||||
{
|
||||
fViewMode = kListMode;
|
||||
fLastIconMode = 0;
|
||||
fIconSize = 32;
|
||||
fListOrigin.Set(0, 0);
|
||||
fIconOrigin.Set(0, 0);
|
||||
fPrimarySortAttr = AttrHashString(kAttrStatName, B_STRING_TYPE);
|
||||
@@ -256,11 +258,13 @@ BViewState::BViewState(BMallocIO *stream, bool endianSwap)
|
||||
stream->Read(&fSecondarySortAttr, sizeof(uint32));
|
||||
stream->Read(&fSecondarySortType, sizeof(uint32));
|
||||
stream->Read(&fReverseSort, sizeof(bool));
|
||||
stream->Read(&fIconSize, sizeof(uint32));
|
||||
|
||||
if (endianSwap) {
|
||||
PRINT(("endian swapping view state\n"));
|
||||
fViewMode = B_SWAP_INT32(fViewMode);
|
||||
fLastIconMode = B_SWAP_INT32(fLastIconMode);
|
||||
fIconSize = B_SWAP_INT32(fIconSize);
|
||||
swap_data(B_POINT_TYPE, &fListOrigin, sizeof(fListOrigin), B_SWAP_ALWAYS);
|
||||
swap_data(B_POINT_TYPE, &fIconOrigin, sizeof(fIconOrigin), B_SWAP_ALWAYS);
|
||||
fPrimarySortAttr = B_SWAP_INT32(fPrimarySortAttr);
|
||||
@@ -268,6 +272,13 @@ BViewState::BViewState(BMallocIO *stream, bool endianSwap)
|
||||
fPrimarySortType = B_SWAP_INT32(fPrimarySortType);
|
||||
fSecondarySortType = B_SWAP_INT32(fSecondarySortType);
|
||||
}
|
||||
|
||||
// assure a sane state
|
||||
if (fIconSize < 16)
|
||||
fIconSize = 16;
|
||||
if (fIconSize > 64)
|
||||
fIconSize = 64;
|
||||
|
||||
fStateNeedsSaving = false;
|
||||
}
|
||||
|
||||
@@ -282,7 +293,14 @@ BViewState::BViewState(const BMessage &message)
|
||||
message.FindInt32(kViewStateSecondarySortAttrName, (int32 *)&fSecondarySortAttr);
|
||||
message.FindInt32(kViewStateSecondarySortTypeName, (int32 *)&fSecondarySortType);
|
||||
message.FindBool(kViewStateReverseSortName, &fReverseSort);
|
||||
message.FindInt32(kViewStateIconSizeName, (int32 *)&fIconSize);
|
||||
|
||||
// assure a sane state
|
||||
if (fIconSize < 16)
|
||||
fIconSize = 16;
|
||||
if (fIconSize > 64)
|
||||
fIconSize = 64;
|
||||
|
||||
fStateNeedsSaving = false;
|
||||
}
|
||||
|
||||
@@ -304,6 +322,7 @@ BViewState::ArchiveToStream(BMallocIO *stream) const
|
||||
stream->Write(&fSecondarySortAttr, sizeof(uint32));
|
||||
stream->Write(&fSecondarySortType, sizeof(uint32));
|
||||
stream->Write(&fReverseSort, sizeof(bool));
|
||||
stream->Write(&fIconSize, sizeof(uint32));
|
||||
}
|
||||
|
||||
|
||||
@@ -321,6 +340,7 @@ BViewState::ArchiveToMessage(BMessage &message) const
|
||||
message.AddInt32(kViewStateSecondarySortAttrName, static_cast<int32>(fSecondarySortAttr));
|
||||
message.AddInt32(kViewStateSecondarySortTypeName, static_cast<int32>(fSecondarySortType));
|
||||
message.AddBool(kViewStateReverseSortName, fReverseSort);
|
||||
message.AddInt32(kViewStateIconSizeName, static_cast<int32>(fIconSize));
|
||||
}
|
||||
|
||||
|
||||
@@ -346,10 +366,12 @@ BViewState::InstantiateFromStream(BMallocIO *stream, bool endianSwap)
|
||||
if ((result->fViewMode != kListMode
|
||||
&& result->fViewMode != kIconMode
|
||||
&& result->fViewMode != kMiniIconMode
|
||||
&& result->fViewMode != kScaleIconMode
|
||||
&& result->fViewMode != 0)
|
||||
|| (result->fLastIconMode != kListMode
|
||||
&& result->fLastIconMode != kIconMode
|
||||
&& result->fLastIconMode != kMiniIconMode
|
||||
&& result->fLastIconMode != kScaleIconMode
|
||||
&& result->fLastIconMode != 0)) {
|
||||
|
||||
PRINT(("Bad data instantiating ViewState, view mode %x, lastIconMode %x\n",
|
||||
@@ -384,12 +406,14 @@ BViewState::InstantiateFromMessage(const BMessage &message)
|
||||
if ((result->fViewMode != kListMode
|
||||
&& result->fViewMode != kIconMode
|
||||
&& result->fViewMode != kMiniIconMode
|
||||
&& result->fViewMode != kScaleIconMode
|
||||
&& result->fViewMode != 0)
|
||||
|| (result->fLastIconMode != kListMode
|
||||
&& result->fLastIconMode != kIconMode
|
||||
&& result->fLastIconMode != kMiniIconMode
|
||||
&& result->fLastIconMode != kScaleIconMode
|
||||
&& result->fLastIconMode != 0)) {
|
||||
|
||||
|
||||
PRINT(("Bad data instantiating ViewState, view mode %x, lastIconMode %x\n",
|
||||
result->fViewMode, result->fLastIconMode));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user