Merge branch 'master' into sam460ex
This commit is contained in:
Vendored
+1
-1
@@ -164,7 +164,7 @@ dev() {
|
|||||||
test -n "$DEVUPCMD" && history -s "$DEVUPCMD"
|
test -n "$DEVUPCMD" && history -s "$DEVUPCMD"
|
||||||
|
|
||||||
# spice up terminal window title for git, add current branch name
|
# spice up terminal window title for git, add current branch name
|
||||||
test -d .git && PROMPT_COMMAND='echo -en "\033]0;['$DEVPROJ':`git branch | sed "/^[^*]/d;s/^\*\s//"`:${PWD##*/}]\a"'
|
test -d .git && PROMPT_COMMAND='echo -en "\033]0;['$DEVPROJ':`git branch 2>/dev/null | sed "/^[^*]/d;s/^\*\s//"`:${PWD##*/}]\a"'
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -W complete -W "$(dev)" dev
|
complete -W complete -W "$(dev)" dev
|
||||||
|
|||||||
@@ -658,21 +658,21 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ]
|
|||||||
# gcc and binutils
|
# gcc and binutils
|
||||||
if $(HAIKU_GCC_VERSION[1]) = 2 || $(isHybridBuild) {
|
if $(HAIKU_GCC_VERSION[1]) = 2 || $(isHybridBuild) {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
gcc-2.95.3-r1a4-x86-gcc2-2012-10-12.zip
|
gcc-2.95.3-r1a4-x86-gcc2-2012-11-01.zip
|
||||||
: $(baseURL)/gcc-2.95.3-r1a4-x86-gcc2-2012-10-12.zip ;
|
: $(baseURL)/gcc-2.95.3-r1a4-x86-gcc2-2012-11-01.zip ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if $(HAIKU_GCC_VERSION[1]) = 2 {
|
if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||||
# symlink to the appropriate system/lib[/gcc2] folder
|
# symlink to the appropriate system/lib[/gcc2] folder
|
||||||
AddSymlinkToHaikuHybridImage
|
AddSymlinkToHaikuHybridImage
|
||||||
develop abi x86 gcc2 tools gcc-2.95.3-haiku-121012 lib
|
develop abi x86 gcc2 tools gcc-2.95.3-haiku-121101 lib
|
||||||
: /system/lib libstdc++.r4.so : : true ;
|
: /system/lib libstdc++.r4.so : : true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) {
|
if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
gcc-4.6.3-r1a4-x86-gcc4-2012-10-18.zip
|
gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip
|
||||||
: $(baseURL)/gcc-4.6.3-r1a4-x86-gcc4-2012-10-18.zip ;
|
: $(baseURL)/gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if $(HAIKU_GCC_VERSION[1]) = 4 {
|
if $(HAIKU_GCC_VERSION[1]) = 4 {
|
||||||
@@ -684,7 +684,7 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ]
|
|||||||
local libs = libstdc++.so libsupc++.so ;
|
local libs = libstdc++.so libsupc++.so ;
|
||||||
for lib in $(libs) {
|
for lib in $(libs) {
|
||||||
AddSymlinkToHaikuHybridImage
|
AddSymlinkToHaikuHybridImage
|
||||||
develop abi x86 gcc4 tools gcc-4.6.3-haiku-121018 lib
|
develop abi x86 gcc4 tools gcc-4.6.3-haiku-121101 lib
|
||||||
: /system/lib $(lib) : : true ;
|
: /system/lib $(lib) : : true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1651,8 +1651,8 @@ if [ IsOptionalHaikuImagePackageAdded Puri ] {
|
|||||||
Echo "No optional package Puri for gcc2" ;
|
Echo "No optional package Puri for gcc2" ;
|
||||||
} else {
|
} else {
|
||||||
InstallOptionalHaikuImagePackage
|
InstallOptionalHaikuImagePackage
|
||||||
puri-0.3.9.1-r1a4-x86-gcc4-2012-08-31.zip
|
puri-0.3.9.1-x86-gcc4-2012-11-01.zip
|
||||||
: $(baseURL)/puri-0.3.9.1-r1a4-x86-gcc4-2012-08-31.zip ;
|
: $(baseURL)/puri-0.3.9.1-x86-gcc4-2012-11-01.zip ;
|
||||||
AddSymlinkToHaikuImage home config settings deskbar Applications
|
AddSymlinkToHaikuImage home config settings deskbar Applications
|
||||||
: /boot/apps/Puri/Puri ;
|
: /boot/apps/Puri/Puri ;
|
||||||
}
|
}
|
||||||
|
|||||||
+385
-291
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2010, Haiku Inc. All Rights Reserved.
|
* Copyright 2005-2012, Haiku Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
#define _MESSAGE_H
|
#define _MESSAGE_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#include <BeBuild.h>
|
#include <BeBuild.h>
|
||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
#include <Flattenable.h>
|
#include <Flattenable.h>
|
||||||
@@ -19,6 +21,7 @@
|
|||||||
#include <AppDefs.h> /* For convenience */
|
#include <AppDefs.h> /* For convenience */
|
||||||
#include <TypeConstants.h> /* For convenience */
|
#include <TypeConstants.h> /* For convenience */
|
||||||
|
|
||||||
|
|
||||||
class BAlignment;
|
class BAlignment;
|
||||||
class BBlockCache;
|
class BBlockCache;
|
||||||
class BMessenger;
|
class BMessenger;
|
||||||
@@ -45,341 +48,432 @@ enum {
|
|||||||
// app-defined specifiers start at B_SPECIFIERS_END + 1
|
// app-defined specifiers start at B_SPECIFIERS_END + 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BMessage {
|
class BMessage {
|
||||||
public:
|
public:
|
||||||
uint32 what;
|
uint32 what;
|
||||||
|
|
||||||
BMessage();
|
BMessage();
|
||||||
BMessage(uint32 what);
|
BMessage(uint32 what);
|
||||||
BMessage(const BMessage &other);
|
BMessage(const BMessage& other);
|
||||||
virtual ~BMessage();
|
virtual ~BMessage();
|
||||||
|
|
||||||
BMessage &operator=(const BMessage &other);
|
BMessage& operator=(const BMessage& other);
|
||||||
|
|
||||||
// Statistics and misc info
|
// Statistics and misc info
|
||||||
status_t GetInfo(type_code typeRequested, int32 index,
|
status_t GetInfo(type_code typeRequested, int32 index,
|
||||||
char **nameFound, type_code *typeFound,
|
char** nameFound, type_code* typeFound,
|
||||||
int32 *countFound = NULL) const;
|
int32* countFound = NULL) const;
|
||||||
status_t GetInfo(const char *name, type_code *typeFound,
|
status_t GetInfo(const char* name, type_code* typeFound,
|
||||||
int32 *countFound = NULL) const;
|
int32* countFound = NULL) const;
|
||||||
status_t GetInfo(const char *name, type_code *typeFound,
|
status_t GetInfo(const char* name, type_code* typeFound,
|
||||||
bool *fixedSize) const;
|
bool* fixedSize) const;
|
||||||
status_t GetInfo(const char *name, type_code *typeFound,
|
status_t GetInfo(const char* name, type_code* typeFound,
|
||||||
int32 *countFound, bool *fixedSize) const;
|
int32* countFound, bool* fixedSize) const;
|
||||||
|
|
||||||
int32 CountNames(type_code type) const;
|
int32 CountNames(type_code type) const;
|
||||||
bool IsEmpty() const;
|
bool IsEmpty() const;
|
||||||
bool IsSystem() const;
|
bool IsSystem() const;
|
||||||
bool IsReply() const;
|
bool IsReply() const;
|
||||||
void PrintToStream() const;
|
void PrintToStream() const;
|
||||||
|
|
||||||
status_t Rename(const char *oldEntry, const char *newEntry);
|
status_t Rename(const char* oldEntry,
|
||||||
|
const char* newEntry);
|
||||||
|
|
||||||
// Delivery info
|
// Delivery info
|
||||||
bool WasDelivered() const;
|
bool WasDelivered() const;
|
||||||
bool IsSourceWaiting() const;
|
bool IsSourceWaiting() const;
|
||||||
bool IsSourceRemote() const;
|
bool IsSourceRemote() const;
|
||||||
BMessenger ReturnAddress() const;
|
BMessenger ReturnAddress() const;
|
||||||
const BMessage *Previous() const;
|
const BMessage* Previous() const;
|
||||||
bool WasDropped() const;
|
bool WasDropped() const;
|
||||||
BPoint DropPoint(BPoint *offset = NULL) const;
|
BPoint DropPoint(BPoint* offset = NULL) const;
|
||||||
|
|
||||||
// Replying
|
// Replying
|
||||||
status_t SendReply(uint32 command, BHandler *replyTo = NULL);
|
status_t SendReply(uint32 command,
|
||||||
status_t SendReply(BMessage *reply, BHandler *replyTo = NULL,
|
BHandler* replyTo = NULL);
|
||||||
bigtime_t timeout = B_INFINITE_TIMEOUT);
|
status_t SendReply(BMessage* reply,
|
||||||
status_t SendReply(BMessage *reply, BMessenger replyTo,
|
BHandler* replyTo = NULL,
|
||||||
bigtime_t timeout = B_INFINITE_TIMEOUT);
|
bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||||
|
status_t SendReply(BMessage* reply, BMessenger replyTo,
|
||||||
|
bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||||
|
|
||||||
status_t SendReply(uint32 command, BMessage *replyToReply);
|
status_t SendReply(uint32 command,
|
||||||
status_t SendReply(BMessage *the_reply, BMessage *replyToReply,
|
BMessage* replyToReply);
|
||||||
bigtime_t sendTimeout = B_INFINITE_TIMEOUT,
|
status_t SendReply(BMessage* reply,
|
||||||
bigtime_t replyTimeout = B_INFINITE_TIMEOUT);
|
BMessage* replyToReply,
|
||||||
|
bigtime_t sendTimeout = B_INFINITE_TIMEOUT,
|
||||||
|
bigtime_t replyTimeout
|
||||||
|
= B_INFINITE_TIMEOUT);
|
||||||
|
|
||||||
// Flattening data
|
// Flattening data
|
||||||
ssize_t FlattenedSize() const;
|
ssize_t FlattenedSize() const;
|
||||||
status_t Flatten(char *buffer, ssize_t size) const;
|
status_t Flatten(char* buffer, ssize_t size) const;
|
||||||
status_t Flatten(BDataIO *stream, ssize_t *size = NULL) const;
|
status_t Flatten(BDataIO* stream,
|
||||||
status_t Unflatten(const char *flatBuffer);
|
ssize_t* size = NULL) const;
|
||||||
status_t Unflatten(BDataIO *stream);
|
status_t Unflatten(const char* flatBuffer);
|
||||||
|
status_t Unflatten(BDataIO* stream);
|
||||||
|
|
||||||
// Specifiers (scripting)
|
// Specifiers (scripting)
|
||||||
status_t AddSpecifier(const char *property);
|
status_t AddSpecifier(const char* property);
|
||||||
status_t AddSpecifier(const char *property, int32 index);
|
status_t AddSpecifier(const char* property, int32 index);
|
||||||
status_t AddSpecifier(const char *property, int32 index, int32 range);
|
status_t AddSpecifier(const char* property, int32 index,
|
||||||
status_t AddSpecifier(const char *property, const char *name);
|
int32 range);
|
||||||
status_t AddSpecifier(const BMessage *specifier);
|
status_t AddSpecifier(const char* property,
|
||||||
|
const char* name);
|
||||||
|
status_t AddSpecifier(const BMessage* specifier);
|
||||||
|
|
||||||
status_t SetCurrentSpecifier(int32 index);
|
status_t SetCurrentSpecifier(int32 index);
|
||||||
status_t GetCurrentSpecifier(int32 *index,
|
status_t GetCurrentSpecifier(int32* index,
|
||||||
BMessage *specifier = NULL, int32 *what = NULL,
|
BMessage* specifier = NULL,
|
||||||
const char **property = NULL) const;
|
int32* what = NULL,
|
||||||
bool HasSpecifiers() const;
|
const char** property = NULL) const;
|
||||||
status_t PopSpecifier();
|
bool HasSpecifiers() const;
|
||||||
|
status_t PopSpecifier();
|
||||||
|
|
||||||
// Adding data
|
// Adding data
|
||||||
status_t AddAlignment(const char* name,
|
status_t AddAlignment(const char* name,
|
||||||
const BAlignment& alignment);
|
const BAlignment& alignment);
|
||||||
status_t AddRect(const char *name, BRect aRect);
|
status_t AddRect(const char* name, BRect rect);
|
||||||
status_t AddPoint(const char *name, BPoint aPoint);
|
status_t AddPoint(const char* name, BPoint point);
|
||||||
status_t AddSize(const char* name, BSize aSize);
|
status_t AddSize(const char* name, BSize size);
|
||||||
status_t AddString(const char *name, const char *aString);
|
status_t AddString(const char* name, const char* string);
|
||||||
status_t AddString(const char *name, const BString &aString);
|
status_t AddString(const char* name,
|
||||||
status_t AddInt8(const char *name, int8 value);
|
const BString& string);
|
||||||
status_t AddUInt8(const char *name, uint8 value);
|
status_t AddInt8(const char* name, int8 value);
|
||||||
status_t AddInt16(const char *name, int16 value);
|
status_t AddUInt8(const char* name, uint8 value);
|
||||||
status_t AddUInt16(const char *name, uint16 value);
|
status_t AddInt16(const char* name, int16 value);
|
||||||
status_t AddInt32(const char *name, int32 value);
|
status_t AddUInt16(const char* name, uint16 value);
|
||||||
status_t AddUInt32(const char *name, uint32 value);
|
status_t AddInt32(const char* name, int32 value);
|
||||||
status_t AddInt64(const char *name, int64 value);
|
status_t AddUInt32(const char* name, uint32 value);
|
||||||
status_t AddUInt64(const char *name, uint64 value);
|
status_t AddInt64(const char* name, int64 value);
|
||||||
status_t AddBool(const char *name, bool aBoolean);
|
status_t AddUInt64(const char* name, uint64 value);
|
||||||
status_t AddFloat(const char *name, float aFloat);
|
status_t AddBool(const char* name, bool value);
|
||||||
status_t AddDouble(const char *name, double aDouble);
|
status_t AddFloat(const char* name, float value);
|
||||||
status_t AddPointer(const char *name, const void *aPointer);
|
status_t AddDouble(const char* name, double value);
|
||||||
status_t AddMessenger(const char *name, BMessenger messenger);
|
status_t AddPointer(const char* name,
|
||||||
status_t AddRef(const char *name, const entry_ref *ref);
|
const void* pointer);
|
||||||
status_t AddMessage(const char *name, const BMessage *message);
|
status_t AddMessenger(const char* name,
|
||||||
status_t AddFlat(const char *name, BFlattenable *object,
|
BMessenger messenger);
|
||||||
int32 count = 1);
|
status_t AddRef(const char* name, const entry_ref* ref);
|
||||||
status_t AddData(const char *name, type_code type,
|
status_t AddMessage(const char* name,
|
||||||
const void *data, ssize_t numBytes,
|
const BMessage* message);
|
||||||
bool isFixedSize = true, int32 count = 1);
|
status_t AddFlat(const char* name, BFlattenable* object,
|
||||||
|
int32 count = 1);
|
||||||
|
status_t AddData(const char* name, type_code type,
|
||||||
|
const void* data, ssize_t numBytes,
|
||||||
|
bool isFixedSize = true, int32 count = 1);
|
||||||
|
|
||||||
// Removing data
|
status_t Append(const BMessage& message);
|
||||||
status_t RemoveData(const char *name, int32 index = 0);
|
|
||||||
status_t RemoveName(const char *name);
|
|
||||||
status_t MakeEmpty();
|
|
||||||
|
|
||||||
// Finding data
|
// Removing data
|
||||||
status_t FindAlignment(const char* name,
|
status_t RemoveData(const char* name, int32 index = 0);
|
||||||
BAlignment* alignment) const;
|
status_t RemoveName(const char* name);
|
||||||
status_t FindAlignment(const char* name, int32 index,
|
status_t MakeEmpty();
|
||||||
BAlignment* alignment) const;
|
|
||||||
|
|
||||||
status_t FindRect(const char *name, BRect *rect) const;
|
// Finding data
|
||||||
status_t FindRect(const char *name, int32 index, BRect *rect) const;
|
status_t FindAlignment(const char* name,
|
||||||
status_t FindPoint(const char *name, BPoint *point) const;
|
BAlignment* alignment) const;
|
||||||
status_t FindPoint(const char *name, int32 index, BPoint *point) const;
|
status_t FindAlignment(const char* name, int32 index,
|
||||||
|
BAlignment* alignment) const;
|
||||||
|
|
||||||
status_t FindSize(const char *name, BSize* size) const;
|
status_t FindRect(const char* name, BRect* rect) const;
|
||||||
status_t FindSize(const char *name,
|
status_t FindRect(const char* name, int32 index,
|
||||||
int32 index, BSize* size) const;
|
BRect* rect) const;
|
||||||
|
status_t FindPoint(const char* name,
|
||||||
|
BPoint* point) const;
|
||||||
|
status_t FindPoint(const char* name, int32 index,
|
||||||
|
BPoint* point) const;
|
||||||
|
|
||||||
status_t FindString(const char *name, const char **string) const;
|
status_t FindSize(const char* name, BSize* size) const;
|
||||||
status_t FindString(const char *name, int32 index, const char **string) const;
|
status_t FindSize(const char* name, int32 index,
|
||||||
status_t FindString(const char *name, BString *string) const;
|
BSize* size) const;
|
||||||
status_t FindString(const char *name, int32 index, BString *string) const;
|
|
||||||
status_t FindInt8(const char *name, int8 *value) const;
|
|
||||||
status_t FindInt8(const char *name, int32 index, int8 *value) const;
|
|
||||||
status_t FindUInt8(const char *name, uint8 *value) const;
|
|
||||||
status_t FindUInt8(const char *name, int32 index, uint8 *value) const;
|
|
||||||
status_t FindInt16(const char *name, int16 *value) const;
|
|
||||||
status_t FindInt16(const char *name, int32 index, int16 *value) const;
|
|
||||||
status_t FindUInt16(const char *name, uint16 *value) const;
|
|
||||||
status_t FindUInt16(const char *name, int32 index, uint16 *value) const;
|
|
||||||
status_t FindInt32(const char *name, int32 *value) const;
|
|
||||||
status_t FindInt32(const char *name, int32 index, int32 *value) const;
|
|
||||||
status_t FindUInt32(const char *name, uint32 *value) const;
|
|
||||||
status_t FindUInt32(const char *name, int32 index, uint32 *value) const;
|
|
||||||
status_t FindInt64(const char *name, int64 *value) const;
|
|
||||||
status_t FindInt64(const char *name, int32 index, int64 *value) const;
|
|
||||||
status_t FindUInt64(const char *name, uint64 *value) const;
|
|
||||||
status_t FindUInt64(const char *name, int32 index, uint64 *value) const;
|
|
||||||
status_t FindBool(const char *name, bool *value) const;
|
|
||||||
status_t FindBool(const char *name, int32 index, bool *value) const;
|
|
||||||
status_t FindFloat(const char *name, float *value) const;
|
|
||||||
status_t FindFloat(const char *name, int32 index, float *value) const;
|
|
||||||
status_t FindDouble(const char *name, double *value) const;
|
|
||||||
status_t FindDouble(const char *name, int32 index, double *value) const;
|
|
||||||
status_t FindPointer(const char *name, void **pointer) const;
|
|
||||||
status_t FindPointer(const char *name, int32 index, void **pointer) const;
|
|
||||||
status_t FindMessenger(const char *name, BMessenger *messenger) const;
|
|
||||||
status_t FindMessenger(const char *name, int32 index, BMessenger *messenger) const;
|
|
||||||
status_t FindRef(const char *name, entry_ref *ref) const;
|
|
||||||
status_t FindRef(const char *name, int32 index, entry_ref *ref) const;
|
|
||||||
status_t FindMessage(const char *name, BMessage *message) const;
|
|
||||||
status_t FindMessage(const char *name, int32 index, BMessage *message) const;
|
|
||||||
status_t FindFlat(const char *name, BFlattenable *object) const;
|
|
||||||
status_t FindFlat(const char *name, int32 index, BFlattenable *object) const;
|
|
||||||
status_t FindData(const char *name, type_code type,
|
|
||||||
const void **data, ssize_t *numBytes) const;
|
|
||||||
status_t FindData(const char *name, type_code type, int32 index,
|
|
||||||
const void **data, ssize_t *numBytes) const;
|
|
||||||
|
|
||||||
// Replacing data
|
status_t FindString(const char* name,
|
||||||
status_t ReplaceAlignment(const char* name,
|
const char** string) const;
|
||||||
const BAlignment& alignment);
|
status_t FindString(const char* name, int32 index,
|
||||||
status_t ReplaceAlignment(const char* name, int32 index,
|
const char** string) const;
|
||||||
const BAlignment& alignment);
|
status_t FindString(const char* name,
|
||||||
|
BString* string) const;
|
||||||
|
status_t FindString(const char* name, int32 index,
|
||||||
|
BString* string) const;
|
||||||
|
status_t FindInt8(const char* name, int8* value) const;
|
||||||
|
status_t FindInt8(const char* name, int32 index,
|
||||||
|
int8* value) const;
|
||||||
|
status_t FindUInt8(const char* name, uint8* value) const;
|
||||||
|
status_t FindUInt8(const char* name, int32 index,
|
||||||
|
uint8* value) const;
|
||||||
|
status_t FindInt16(const char* name, int16* value) const;
|
||||||
|
status_t FindInt16(const char* name, int32 index,
|
||||||
|
int16* value) const;
|
||||||
|
status_t FindUInt16(const char* name,
|
||||||
|
uint16* value) const;
|
||||||
|
status_t FindUInt16(const char* name, int32 index,
|
||||||
|
uint16* value) const;
|
||||||
|
status_t FindInt32(const char* name, int32* value) const;
|
||||||
|
status_t FindInt32(const char* name, int32 index,
|
||||||
|
int32* value) const;
|
||||||
|
status_t FindUInt32(const char* name,
|
||||||
|
uint32* value) const;
|
||||||
|
status_t FindUInt32(const char* name, int32 index,
|
||||||
|
uint32* value) const;
|
||||||
|
status_t FindInt64(const char* name, int64* value) const;
|
||||||
|
status_t FindInt64(const char* name, int32 index,
|
||||||
|
int64* value) const;
|
||||||
|
status_t FindUInt64(const char* name,
|
||||||
|
uint64* value) const;
|
||||||
|
status_t FindUInt64(const char* name, int32 index,
|
||||||
|
uint64* value) const;
|
||||||
|
status_t FindBool(const char* name, bool* value) const;
|
||||||
|
status_t FindBool(const char* name, int32 index,
|
||||||
|
bool* value) const;
|
||||||
|
status_t FindFloat(const char* name, float* value) const;
|
||||||
|
status_t FindFloat(const char* name, int32 index,
|
||||||
|
float* value) const;
|
||||||
|
status_t FindDouble(const char* name,
|
||||||
|
double* value) const;
|
||||||
|
status_t FindDouble(const char* name, int32 index,
|
||||||
|
double* value) const;
|
||||||
|
status_t FindPointer(const char* name,
|
||||||
|
void** pointer) const;
|
||||||
|
status_t FindPointer(const char* name, int32 index,
|
||||||
|
void** pointer) const;
|
||||||
|
status_t FindMessenger(const char* name,
|
||||||
|
BMessenger* messenger) const;
|
||||||
|
status_t FindMessenger(const char* name, int32 index,
|
||||||
|
BMessenger* messenger) const;
|
||||||
|
status_t FindRef(const char* name, entry_ref* ref) const;
|
||||||
|
status_t FindRef(const char* name, int32 index,
|
||||||
|
entry_ref* ref) const;
|
||||||
|
status_t FindMessage(const char* name,
|
||||||
|
BMessage* message) const;
|
||||||
|
status_t FindMessage(const char* name, int32 index,
|
||||||
|
BMessage* message) const;
|
||||||
|
status_t FindFlat(const char* name,
|
||||||
|
BFlattenable* object) const;
|
||||||
|
status_t FindFlat(const char* name, int32 index,
|
||||||
|
BFlattenable* object) const;
|
||||||
|
status_t FindData(const char* name, type_code type,
|
||||||
|
const void** data, ssize_t* numBytes) const;
|
||||||
|
status_t FindData(const char* name, type_code type,
|
||||||
|
int32 index, const void** data,
|
||||||
|
ssize_t* numBytes) const;
|
||||||
|
|
||||||
status_t ReplaceRect(const char *name, BRect aRect);
|
// Replacing data
|
||||||
status_t ReplaceRect(const char *name, int32 index, BRect aRect);
|
status_t ReplaceAlignment(const char* name,
|
||||||
|
const BAlignment& alignment);
|
||||||
|
status_t ReplaceAlignment(const char* name, int32 index,
|
||||||
|
const BAlignment& alignment);
|
||||||
|
|
||||||
status_t ReplacePoint(const char *name, BPoint aPoint);
|
status_t ReplaceRect(const char* name, BRect rect);
|
||||||
status_t ReplacePoint(const char *name, int32 index, BPoint aPoint);
|
status_t ReplaceRect(const char* name, int32 index,
|
||||||
status_t ReplaceSize(const char* name, BSize aSize);
|
BRect rect);
|
||||||
status_t ReplaceSize(const char* name, int32 index, BSize aSize);
|
|
||||||
|
|
||||||
status_t ReplaceString(const char *name, const char *aString);
|
status_t ReplacePoint(const char* name, BPoint aPoint);
|
||||||
status_t ReplaceString(const char *name, int32 index, const char *aString);
|
status_t ReplacePoint(const char* name, int32 index,
|
||||||
status_t ReplaceString(const char *name, const BString &aString);
|
BPoint aPoint);
|
||||||
status_t ReplaceString(const char *name, int32 index, const BString &aString);
|
status_t ReplaceSize(const char* name, BSize aSize);
|
||||||
status_t ReplaceInt8(const char *name, int8 value);
|
status_t ReplaceSize(const char* name, int32 index,
|
||||||
status_t ReplaceInt8(const char *name, int32 index, int8 value);
|
BSize aSize);
|
||||||
status_t ReplaceUInt8(const char *name, uint8 value);
|
|
||||||
status_t ReplaceUInt8(const char *name, int32 index, uint8 value);
|
|
||||||
status_t ReplaceInt16(const char *name, int16 value);
|
|
||||||
status_t ReplaceInt16(const char *name, int32 index, int16 value);
|
|
||||||
status_t ReplaceUInt16(const char *name, uint16 value);
|
|
||||||
status_t ReplaceUInt16(const char *name, int32 index, uint16 value);
|
|
||||||
status_t ReplaceInt32(const char *name, int32 value);
|
|
||||||
status_t ReplaceInt32(const char *name, int32 index, int32 value);
|
|
||||||
status_t ReplaceUInt32(const char *name, uint32 value);
|
|
||||||
status_t ReplaceUInt32(const char *name, int32 index, uint32 value);
|
|
||||||
status_t ReplaceInt64(const char *name, int64 value);
|
|
||||||
status_t ReplaceInt64(const char *name, int32 index, int64 value);
|
|
||||||
status_t ReplaceUInt64(const char *name, uint64 value);
|
|
||||||
status_t ReplaceUInt64(const char *name, int32 index, uint64 value);
|
|
||||||
status_t ReplaceBool(const char *name, bool aBoolean);
|
|
||||||
status_t ReplaceBool(const char *name, int32 index, bool aBoolean);
|
|
||||||
status_t ReplaceFloat(const char *name, float aFloat);
|
|
||||||
status_t ReplaceFloat(const char *name, int32 index, float aFloat);
|
|
||||||
status_t ReplaceDouble(const char *name, double aDouble);
|
|
||||||
status_t ReplaceDouble(const char *name, int32 index, double aDouble);
|
|
||||||
status_t ReplacePointer(const char *name, const void *pointer);
|
|
||||||
status_t ReplacePointer(const char *name,int32 index,const void *pointer);
|
|
||||||
status_t ReplaceMessenger(const char *name, BMessenger messenger);
|
|
||||||
status_t ReplaceMessenger(const char *name, int32 index, BMessenger messenger);
|
|
||||||
status_t ReplaceRef( const char *name,const entry_ref *ref);
|
|
||||||
status_t ReplaceRef( const char *name, int32 index, const entry_ref *ref);
|
|
||||||
status_t ReplaceMessage(const char *name, const BMessage *message);
|
|
||||||
status_t ReplaceMessage(const char *name, int32 index, const BMessage *message);
|
|
||||||
status_t ReplaceFlat(const char *name, BFlattenable *object);
|
|
||||||
status_t ReplaceFlat(const char *name, int32 index, BFlattenable *object);
|
|
||||||
status_t ReplaceData(const char *name, type_code type,
|
|
||||||
const void *data, ssize_t numBytes);
|
|
||||||
status_t ReplaceData(const char *name, type_code type, int32 index,
|
|
||||||
const void *data, ssize_t numBytes);
|
|
||||||
|
|
||||||
// Comparing data - Haiku experimental API
|
status_t ReplaceString(const char* name,
|
||||||
bool HasSameData(const BMessage &other,
|
const char* string);
|
||||||
bool ignoreFieldOrder = true, bool deep = false) const;
|
status_t ReplaceString(const char* name, int32 index,
|
||||||
|
const char* string);
|
||||||
|
status_t ReplaceString(const char* name,
|
||||||
|
const BString& string);
|
||||||
|
status_t ReplaceString(const char* name, int32 index,
|
||||||
|
const BString& string);
|
||||||
|
status_t ReplaceInt8(const char* name, int8 value);
|
||||||
|
status_t ReplaceInt8(const char* name, int32 index,
|
||||||
|
int8 value);
|
||||||
|
status_t ReplaceUInt8(const char* name, uint8 value);
|
||||||
|
status_t ReplaceUInt8(const char* name, int32 index,
|
||||||
|
uint8 value);
|
||||||
|
status_t ReplaceInt16(const char* name, int16 value);
|
||||||
|
status_t ReplaceInt16(const char* name, int32 index,
|
||||||
|
int16 value);
|
||||||
|
status_t ReplaceUInt16(const char* name, uint16 value);
|
||||||
|
status_t ReplaceUInt16(const char* name, int32 index,
|
||||||
|
uint16 value);
|
||||||
|
status_t ReplaceInt32(const char* name, int32 value);
|
||||||
|
status_t ReplaceInt32(const char* name, int32 index,
|
||||||
|
int32 value);
|
||||||
|
status_t ReplaceUInt32(const char* name, uint32 value);
|
||||||
|
status_t ReplaceUInt32(const char* name, int32 index,
|
||||||
|
uint32 value);
|
||||||
|
status_t ReplaceInt64(const char* name, int64 value);
|
||||||
|
status_t ReplaceInt64(const char* name, int32 index,
|
||||||
|
int64 value);
|
||||||
|
status_t ReplaceUInt64(const char* name, uint64 value);
|
||||||
|
status_t ReplaceUInt64(const char* name, int32 index,
|
||||||
|
uint64 value);
|
||||||
|
status_t ReplaceBool(const char* name, bool aBoolean);
|
||||||
|
status_t ReplaceBool(const char* name, int32 index,
|
||||||
|
bool value);
|
||||||
|
status_t ReplaceFloat(const char* name, float value);
|
||||||
|
status_t ReplaceFloat(const char* name, int32 index,
|
||||||
|
float value);
|
||||||
|
status_t ReplaceDouble(const char* name, double value);
|
||||||
|
status_t ReplaceDouble(const char* name, int32 index,
|
||||||
|
double value);
|
||||||
|
status_t ReplacePointer(const char* name,
|
||||||
|
const void* pointer);
|
||||||
|
status_t ReplacePointer(const char* name, int32 index,
|
||||||
|
const void* pointer);
|
||||||
|
status_t ReplaceMessenger(const char* name,
|
||||||
|
BMessenger messenger);
|
||||||
|
status_t ReplaceMessenger(const char* name, int32 index,
|
||||||
|
BMessenger messenger);
|
||||||
|
status_t ReplaceRef(const char* name,
|
||||||
|
const entry_ref* ref);
|
||||||
|
status_t ReplaceRef(const char* name, int32 index,
|
||||||
|
const entry_ref* ref);
|
||||||
|
status_t ReplaceMessage(const char* name,
|
||||||
|
const BMessage* message);
|
||||||
|
status_t ReplaceMessage(const char* name, int32 index,
|
||||||
|
const BMessage* message);
|
||||||
|
status_t ReplaceFlat(const char* name,
|
||||||
|
BFlattenable* object);
|
||||||
|
status_t ReplaceFlat(const char* name, int32 index,
|
||||||
|
BFlattenable* object);
|
||||||
|
status_t ReplaceData(const char* name, type_code type,
|
||||||
|
const void* data, ssize_t numBytes);
|
||||||
|
status_t ReplaceData(const char* name, type_code type,
|
||||||
|
int32 index, const void* data,
|
||||||
|
ssize_t numBytes);
|
||||||
|
|
||||||
void *operator new(size_t size);
|
// Comparing data - Haiku experimental API
|
||||||
void *operator new(size_t, void *pointer);
|
bool HasSameData(const BMessage& other,
|
||||||
void operator delete(void *pointer, size_t size);
|
bool ignoreFieldOrder = true,
|
||||||
|
bool deep = false) const;
|
||||||
|
|
||||||
// Private, reserved, or obsolete
|
void* operator new(size_t size);
|
||||||
bool HasAlignment(const char*, int32 n = 0) const;
|
void* operator new(size_t, void* pointer);
|
||||||
bool HasRect(const char *, int32 n = 0) const;
|
void* operator new(size_t,
|
||||||
bool HasPoint(const char *, int32 n = 0) const;
|
const std::nothrow_t& noThrow);
|
||||||
bool HasSize(const char*, int32 n = 0) const;
|
void operator delete(void* pointer, size_t size);
|
||||||
bool HasString(const char *, int32 n = 0) const;
|
|
||||||
bool HasInt8(const char *, int32 n = 0) const;
|
|
||||||
bool HasUInt8(const char *, int32 n = 0) const;
|
|
||||||
bool HasInt16(const char *, int32 n = 0) const;
|
|
||||||
bool HasUInt16(const char *, int32 n = 0) const;
|
|
||||||
bool HasInt32(const char *, int32 n = 0) const;
|
|
||||||
bool HasUInt32(const char *, int32 n = 0) const;
|
|
||||||
bool HasInt64(const char *, int32 n = 0) const;
|
|
||||||
bool HasUInt64(const char *, int32 n = 0) const;
|
|
||||||
bool HasBool(const char *, int32 n = 0) const;
|
|
||||||
bool HasFloat(const char *, int32 n = 0) const;
|
|
||||||
bool HasDouble(const char *, int32 n = 0) const;
|
|
||||||
bool HasPointer(const char *, int32 n = 0) const;
|
|
||||||
bool HasMessenger(const char *, int32 n = 0) const;
|
|
||||||
bool HasRef(const char *, int32 n = 0) const;
|
|
||||||
bool HasMessage(const char *, int32 n = 0) const;
|
|
||||||
bool HasFlat(const char *, const BFlattenable *) const;
|
|
||||||
bool HasFlat(const char *, int32 n, const BFlattenable *) const;
|
|
||||||
bool HasData(const char *, type_code , int32 n = 0) const;
|
|
||||||
BRect FindRect(const char *, int32 n = 0) const;
|
|
||||||
BPoint FindPoint(const char *, int32 n = 0) const;
|
|
||||||
const char *FindString(const char *, int32 n = 0) const;
|
|
||||||
int8 FindInt8(const char *, int32 n = 0) const;
|
|
||||||
int16 FindInt16(const char *, int32 n = 0) const;
|
|
||||||
int32 FindInt32(const char *, int32 n = 0) const;
|
|
||||||
int64 FindInt64(const char *, int32 n = 0) const;
|
|
||||||
bool FindBool(const char *, int32 n = 0) const;
|
|
||||||
float FindFloat(const char *, int32 n = 0) const;
|
|
||||||
double FindDouble(const char *, int32 n = 0) const;
|
|
||||||
|
|
||||||
class Private;
|
// Private, reserved, or obsolete
|
||||||
struct message_header;
|
bool HasAlignment(const char* name,
|
||||||
struct field_header;
|
int32 n = 0) const;
|
||||||
|
bool HasRect(const char* name, int32 n = 0) const;
|
||||||
|
bool HasPoint(const char* name, int32 n = 0) const;
|
||||||
|
bool HasSize(const char* name, int32 n = 0) const;
|
||||||
|
bool HasString(const char* name, int32 n = 0) const;
|
||||||
|
bool HasInt8(const char* name, int32 n = 0) const;
|
||||||
|
bool HasUInt8(const char* name, int32 n = 0) const;
|
||||||
|
bool HasInt16(const char* name, int32 n = 0) const;
|
||||||
|
bool HasUInt16(const char* name, int32 n = 0) const;
|
||||||
|
bool HasInt32(const char* name, int32 n = 0) const;
|
||||||
|
bool HasUInt32(const char* name, int32 n = 0) const;
|
||||||
|
bool HasInt64(const char* name, int32 n = 0) const;
|
||||||
|
bool HasUInt64(const char* name, int32 n = 0) const;
|
||||||
|
bool HasBool(const char* name, int32 n = 0) const;
|
||||||
|
bool HasFloat(const char* name, int32 n = 0) const;
|
||||||
|
bool HasDouble(const char* name, int32 n = 0) const;
|
||||||
|
bool HasPointer(const char* name, int32 n = 0) const;
|
||||||
|
bool HasMessenger(const char* name,
|
||||||
|
int32 n = 0) const;
|
||||||
|
bool HasRef(const char* name, int32 n = 0) const;
|
||||||
|
bool HasMessage(const char* name, int32 n = 0) const;
|
||||||
|
bool HasFlat(const char* name,
|
||||||
|
const BFlattenable* ) const;
|
||||||
|
bool HasFlat(const char* name, int32 n,
|
||||||
|
const BFlattenable* ) const;
|
||||||
|
bool HasData(const char* name, type_code ,
|
||||||
|
int32 n = 0) const;
|
||||||
|
BRect FindRect(const char* name, int32 n = 0) const;
|
||||||
|
BPoint FindPoint(const char* name, int32 n = 0) const;
|
||||||
|
const char* FindString(const char* name, int32 n = 0) const;
|
||||||
|
int8 FindInt8(const char* name, int32 n = 0) const;
|
||||||
|
int16 FindInt16(const char* name, int32 n = 0) const;
|
||||||
|
int32 FindInt32(const char* name, int32 n = 0) const;
|
||||||
|
int64 FindInt64(const char* name, int32 n = 0) const;
|
||||||
|
bool FindBool(const char* name, int32 n = 0) const;
|
||||||
|
float FindFloat(const char* name, int32 n = 0) const;
|
||||||
|
double FindDouble(const char* name, int32 n = 0) const;
|
||||||
|
|
||||||
private:
|
class Private;
|
||||||
friend class Private;
|
struct message_header;
|
||||||
friend class BMessageQueue;
|
struct field_header;
|
||||||
|
|
||||||
status_t _InitCommon(bool initHeader);
|
private:
|
||||||
status_t _InitHeader();
|
friend class Private;
|
||||||
status_t _Clear();
|
friend class BMessageQueue;
|
||||||
|
|
||||||
status_t _FlattenToArea(message_header **_header) const;
|
status_t _InitCommon(bool initHeader);
|
||||||
status_t _CopyForWrite();
|
status_t _InitHeader();
|
||||||
status_t _Reference();
|
status_t _Clear();
|
||||||
status_t _Dereference();
|
|
||||||
|
|
||||||
status_t _ValidateMessage();
|
status_t _FlattenToArea(message_header** _header) const;
|
||||||
|
status_t _CopyForWrite();
|
||||||
|
status_t _Reference();
|
||||||
|
status_t _Dereference();
|
||||||
|
|
||||||
status_t _ResizeData(uint32 offset, int32 change);
|
status_t _ValidateMessage();
|
||||||
|
|
||||||
uint32 _HashName(const char* name) const;
|
status_t _ResizeData(uint32 offset, int32 change);
|
||||||
status_t _FindField(const char* name, type_code type,
|
|
||||||
field_header** _result) const;
|
|
||||||
status_t _AddField(const char* name, type_code type,
|
|
||||||
bool isFixedSize, field_header** _result);
|
|
||||||
status_t _RemoveField(field_header* field);
|
|
||||||
|
|
||||||
void _PrintToStream(const char* indent) const;
|
uint32 _HashName(const char* name) const;
|
||||||
|
status_t _FindField(const char* name, type_code type,
|
||||||
|
field_header** _result) const;
|
||||||
|
status_t _AddField(const char* name, type_code type,
|
||||||
|
bool isFixedSize, field_header** _result);
|
||||||
|
status_t _RemoveField(field_header* field);
|
||||||
|
|
||||||
private:
|
void _PrintToStream(const char* indent) const;
|
||||||
message_header* fHeader;
|
|
||||||
field_header* fFields;
|
|
||||||
uint8* fData;
|
|
||||||
|
|
||||||
uint32 fFieldsAvailable;
|
private:
|
||||||
size_t fDataAvailable;
|
BMessage(BMessage* message);
|
||||||
|
// deprecated
|
||||||
|
|
||||||
mutable BMessage* fOriginal;
|
virtual void _ReservedMessage1();
|
||||||
|
virtual void _ReservedMessage2();
|
||||||
|
virtual void _ReservedMessage3();
|
||||||
|
|
||||||
BMessage* fQueueLink;
|
status_t _SendMessage(port_id port, team_id portOwner,
|
||||||
// fQueueLink is used by BMessageQueue to build a linked list
|
int32 token, bigtime_t timeout,
|
||||||
|
bool replyRequired,
|
||||||
|
BMessenger& replyTo) const;
|
||||||
|
status_t _SendMessage(port_id port, team_id portOwner,
|
||||||
|
int32 token, BMessage* reply,
|
||||||
|
bigtime_t sendTimeout,
|
||||||
|
bigtime_t replyTimeout) const;
|
||||||
|
static status_t _SendFlattenedMessage(void* data, int32 size,
|
||||||
|
port_id port, int32 token,
|
||||||
|
bigtime_t timeout);
|
||||||
|
|
||||||
void* fArchivingPointer;
|
static void _StaticInit();
|
||||||
|
static void _StaticReInitForkedChild();
|
||||||
|
static void _StaticCleanup();
|
||||||
|
static void _StaticCacheCleanup();
|
||||||
|
static int32 _StaticGetCachedReplyPort();
|
||||||
|
|
||||||
uint32 fReserved[8];
|
private:
|
||||||
|
message_header* fHeader;
|
||||||
|
field_header* fFields;
|
||||||
|
uint8* fData;
|
||||||
|
|
||||||
// deprecated
|
uint32 fFieldsAvailable;
|
||||||
BMessage(BMessage *message);
|
size_t fDataAvailable;
|
||||||
|
|
||||||
virtual void _ReservedMessage1();
|
mutable BMessage* fOriginal;
|
||||||
virtual void _ReservedMessage2();
|
|
||||||
virtual void _ReservedMessage3();
|
|
||||||
|
|
||||||
status_t _SendMessage(port_id port, team_id portOwner, int32 token,
|
BMessage* fQueueLink;
|
||||||
bigtime_t timeout, bool replyRequired,
|
// fQueueLink is used by BMessageQueue to build a linked list
|
||||||
BMessenger &replyTo) const;
|
|
||||||
status_t _SendMessage(port_id port, team_id portOwner,
|
|
||||||
int32 token, BMessage *reply, bigtime_t sendTimeout,
|
|
||||||
bigtime_t replyTimeout) const;
|
|
||||||
static status_t _SendFlattenedMessage(void *data, int32 size,
|
|
||||||
port_id port, int32 token, bigtime_t timeout);
|
|
||||||
|
|
||||||
static void _StaticInit();
|
void* fArchivingPointer;
|
||||||
static void _StaticReInitForkedChild();
|
|
||||||
static void _StaticCleanup();
|
|
||||||
static void _StaticCacheCleanup();
|
|
||||||
static int32 _StaticGetCachedReplyPort();
|
|
||||||
|
|
||||||
enum { sNumReplyPorts = 3 };
|
uint32 fReserved[8];
|
||||||
static port_id sReplyPorts[sNumReplyPorts];
|
|
||||||
static int32 sReplyPortInUse[sNumReplyPorts];
|
|
||||||
static int32 sGetCachedReplyPort();
|
|
||||||
|
|
||||||
static BBlockCache* sMsgCache;
|
enum { sNumReplyPorts = 3 };
|
||||||
|
static port_id sReplyPorts[sNumReplyPorts];
|
||||||
|
static int32 sReplyPortInUse[sNumReplyPorts];
|
||||||
|
static int32 sGetCachedReplyPort();
|
||||||
|
|
||||||
|
static BBlockCache* sMsgCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _MESSAGE_H
|
#endif // _MESSAGE_H
|
||||||
|
|||||||
@@ -19,6 +19,13 @@
|
|||||||
#define DISABLES_ON_WINDOW_DEACTIVATION 1
|
#define DISABLES_ON_WINDOW_DEACTIVATION 1
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
B_KNOB_STYLE_NONE = 0,
|
||||||
|
B_KNOB_STYLE_DOTS,
|
||||||
|
B_KNOB_STYLE_LINES
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class BScrollBar : public BView {
|
class BScrollBar : public BView {
|
||||||
public:
|
public:
|
||||||
BScrollBar(BRect frame, const char* name,
|
BScrollBar(BRect frame, const char* name,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ int32 kFreeTypeCookie = 0x87654321;
|
|||||||
|
|
||||||
char *kFailBackMime = {"application/octet-stream"};
|
char *kFailBackMime = {"application/octet-stream"};
|
||||||
char *kDirectoryMime = {"application/x-vnd.Be-directory"};
|
char *kDirectoryMime = {"application/x-vnd.Be-directory"};
|
||||||
|
char *kAttrTypeName = {"BEOS:TYPE"};
|
||||||
|
|
||||||
|
|
||||||
status_t set_mime(vnode *node, const char *filename)
|
status_t set_mime(vnode *node, const char *filename)
|
||||||
@@ -35,7 +36,7 @@ status_t set_mime(vnode *node, const char *filename)
|
|||||||
struct ext_mime *p;
|
struct ext_mime *p;
|
||||||
int32 namelen;
|
int32 namelen;
|
||||||
int32 ext_len;
|
int32 ext_len;
|
||||||
node->mime = kFailBackMime;
|
node->mime = NULL;
|
||||||
|
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
{
|
{
|
||||||
@@ -56,7 +57,10 @@ status_t set_mime(vnode *node, const char *filename)
|
|||||||
if (!strcasecmp(filename + namelen - ext_len, p->extension))
|
if (!strcasecmp(filename + namelen - ext_len, p->extension))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node->mime = p->mime;
|
if(p->mime==NULL)
|
||||||
|
node->mime = kFailBackMime;
|
||||||
|
else
|
||||||
|
node->mime = p->mime;
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,8 +193,8 @@ fake_read_attrib_dir(fs_volume *_vol, fs_vnode *_node, void *_cookie,
|
|||||||
|
|
||||||
entry->d_ino = node->vnid;
|
entry->d_ino = node->vnid;
|
||||||
entry->d_dev = ns->id;
|
entry->d_dev = ns->id;
|
||||||
entry->d_reclen = sizeof(struct dirent) + 10;
|
entry->d_reclen = sizeof(struct dirent) + strlen(kAttrTypeName);
|
||||||
strcpy(entry->d_name, "BEOS:TYPE");
|
strcpy(entry->d_name, kAttrTypeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
*cookie = kCloseTypeCookie;
|
*cookie = kCloseTypeCookie;
|
||||||
@@ -207,24 +211,19 @@ fake_create_attrib(fs_volume *_vol, fs_vnode *_node, const char* name,
|
|||||||
uint32 type, int openMode, void** _cookie)
|
uint32 type, int openMode, void** _cookie)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace *)_vol->private_volume;
|
nspace *ns = (nspace *)_vol->private_volume;
|
||||||
int result = B_NO_ERROR;
|
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
TRACE("fake_create_attrib - ENTER (name = [%s])\n",name);
|
TRACE("fake_create_attrib - ENTER (name = [%s])\n",name);
|
||||||
|
|
||||||
if (strcmp(name, "BEOS:TYPE") != 0)
|
if (strcmp(name, kAttrTypeName) == 0)
|
||||||
goto exit;
|
*_cookie = &kSetTypeCookie;
|
||||||
|
|
||||||
*_cookie = &kSetTypeCookie;
|
|
||||||
|
|
||||||
exit:
|
TRACE("fake_create_attrib - EXIT\n");
|
||||||
|
|
||||||
TRACE("fake_create_attrib - EXIT, result is %s\n", strerror(result));
|
|
||||||
|
|
||||||
UNLOCK_VOL(ns);
|
UNLOCK_VOL(ns);
|
||||||
|
|
||||||
return result;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
@@ -232,18 +231,16 @@ fake_open_attrib(fs_volume *_vol, fs_vnode *_node, const char *name,
|
|||||||
int openMode, void **_cookie)
|
int openMode, void **_cookie)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace *)_vol->private_volume;
|
nspace *ns = (nspace *)_vol->private_volume;
|
||||||
int result = B_NO_ERROR;
|
status_t result = B_NO_ERROR;
|
||||||
|
|
||||||
LOCK_VOL(ns);
|
LOCK_VOL(ns);
|
||||||
|
|
||||||
TRACE("fake_open_attrib - ENTER (name = [%s])\n",name);
|
TRACE("fake_open_attrib - ENTER (name = [%s])\n",name);
|
||||||
|
|
||||||
if (strcmp(name, "BEOS:TYPE") != 0)
|
if (strcmp(name, kAttrTypeName) == 0)
|
||||||
goto exit;
|
*_cookie = &kSetTypeCookie;
|
||||||
|
else
|
||||||
*_cookie = &kSetTypeCookie;
|
result = ENOENT;
|
||||||
|
|
||||||
exit:
|
|
||||||
|
|
||||||
TRACE("fake_open_attrib - EXIT, result is %s\n", strerror(result));
|
TRACE("fake_open_attrib - EXIT, result is %s\n", strerror(result));
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include <driver_settings.h>
|
#include <driver_settings.h>
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
#include <disk_device_manager.h>
|
||||||
|
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
#include "fake_attributes.h"
|
#include "fake_attributes.h"
|
||||||
@@ -43,11 +44,11 @@
|
|||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
#include "volume_util.h"
|
#include "volume_util.h"
|
||||||
|
|
||||||
static const char* kNTFSUntitled = {"NTFS Untitled"};
|
static const char* kNTFSUnnamed = {"NTFS Unnamed"};
|
||||||
|
|
||||||
typedef struct identify_cookie {
|
typedef struct identify_cookie {
|
||||||
NTFS_BOOT_SECTOR boot;
|
NTFS_BOOT_SECTOR boot;
|
||||||
char label[256];
|
char label[MAX_PATH];
|
||||||
} identify_cookie;
|
} identify_cookie;
|
||||||
|
|
||||||
|
|
||||||
@@ -257,10 +258,11 @@ fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(cookie->label, kNTFSUntitled);
|
cookie->label[0]='\0';
|
||||||
|
memcpy(&cookie->boot, &boot, 512);
|
||||||
|
|
||||||
// try get path for device
|
// get path for device
|
||||||
if (ioctl(fd, B_GET_PATH_FOR_DEVICE, devpath)) {
|
if (ioctl(fd, B_GET_PATH_FOR_DEVICE, devpath) != 0) {
|
||||||
// try mount
|
// try mount
|
||||||
ntVolume = utils_mount_volume(devpath, MS_RDONLY | MS_RECOVER);
|
ntVolume = utils_mount_volume(devpath, MS_RDONLY | MS_RECOVER);
|
||||||
if (ntVolume != NULL) {
|
if (ntVolume != NULL) {
|
||||||
@@ -270,7 +272,26 @@ fs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&cookie->boot, &boot, 512);
|
// generate a more or less descriptive name for unnamed volume
|
||||||
|
if (cookie->label[0]=='\0') {
|
||||||
|
double size;
|
||||||
|
off_t diskSize = sle64_to_cpu(boot.number_of_sectors)
|
||||||
|
* le16_to_cpu(boot.bpb.bytes_per_sector);
|
||||||
|
off_t divisor = 1ULL << 40;
|
||||||
|
char unit = 'T';
|
||||||
|
if (diskSize < divisor) {
|
||||||
|
divisor = 1UL << 30;
|
||||||
|
unit = 'G';
|
||||||
|
if (diskSize < divisor) {
|
||||||
|
divisor = 1UL << 20;
|
||||||
|
unit = 'M';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size = (double)((10 * diskSize + divisor - 1) / divisor);
|
||||||
|
snprintf(cookie->label, MAX_PATH - 1, "%g %cB NTFS File System",
|
||||||
|
size / 10, unit);
|
||||||
|
}
|
||||||
|
|
||||||
*_cookie = cookie;
|
*_cookie = cookie;
|
||||||
|
|
||||||
@@ -468,7 +489,7 @@ fs_rfsstat(fs_volume *_vol, struct fs_info *fss)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
strcpy(fss->volume_name, kNTFSUntitled);
|
strcpy(fss->volume_name, kNTFSUnnamed);
|
||||||
else
|
else
|
||||||
fss->volume_name[i + 1] = 0;
|
fss->volume_name[i + 1] = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2011, Haiku Inc. All rights reserved.
|
* Copyright 2005-2012, Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -245,8 +245,15 @@ void *
|
|||||||
BMessage::operator new(size_t size)
|
BMessage::operator new(size_t size)
|
||||||
{
|
{
|
||||||
DEBUG_FUNCTION_ENTER2;
|
DEBUG_FUNCTION_ENTER2;
|
||||||
void *pointer = sMsgCache->Get(size);
|
return sMsgCache->Get(size);
|
||||||
return pointer;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *
|
||||||
|
BMessage::operator new(size_t size, const std::nothrow_t &noThrow)
|
||||||
|
{
|
||||||
|
DEBUG_FUNCTION_ENTER2;
|
||||||
|
return sMsgCache->Get(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2622,6 +2629,34 @@ BMessage::AddFlat(const char *name, BFlattenable *object, int32 count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BMessage::Append(const BMessage &other)
|
||||||
|
{
|
||||||
|
field_header *field = other.fFields;
|
||||||
|
for (uint32 i = 0; i < other.fHeader->field_count; i++, field++) {
|
||||||
|
const char *name = (const char *)(other.fData + field->offset);
|
||||||
|
const void *data = (const void *)(other.fData + field->offset
|
||||||
|
+ field->name_length);
|
||||||
|
bool isFixed = (field->flags & FIELD_FLAG_FIXED_SIZE) != 0;
|
||||||
|
size_t size = field->data_size / field->count;
|
||||||
|
|
||||||
|
for (uint32 j = 0; j < field->count; j++) {
|
||||||
|
if (!isFixed)
|
||||||
|
size = *(uint32 *)data;
|
||||||
|
|
||||||
|
status_t status = AddData(name, field->type, data, size,
|
||||||
|
isFixed != 0, 1);
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
data = (const void *)((const char *)data + size
|
||||||
|
+ (isFixed ? 0 : sizeof(uint32)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMessage::FindAlignment(const char *name, BAlignment *alignment) const
|
BMessage::FindAlignment(const char *name, BAlignment *alignment) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -846,6 +846,7 @@ BScrollBar::Draw(BRect updateRect)
|
|||||||
EndLineArray();
|
EndLineArray();
|
||||||
} else
|
} else
|
||||||
StrokeRect(bounds);
|
StrokeRect(bounds);
|
||||||
|
|
||||||
bounds.InsetBy(1.0, 1.0);
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
bool enabled = fPrivateData->fEnabled && fMin < fMax
|
bool enabled = fPrivateData->fEnabled && fMin < fMax
|
||||||
@@ -1152,6 +1153,69 @@ BScrollBar::Draw(BRect updateRect)
|
|||||||
FillRect(rect);
|
FillRect(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fPrivateData->fScrollBarInfo.knob == B_KNOB_STYLE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// draw the scrollbar thumb knobs
|
||||||
|
bool square = fPrivateData->fScrollBarInfo.knob == B_KNOB_STYLE_DOTS;
|
||||||
|
int32 knobWidth = 0;
|
||||||
|
int32 knobHeight = 0;
|
||||||
|
|
||||||
|
if (square) {
|
||||||
|
knobWidth = 2;
|
||||||
|
knobHeight = 2;
|
||||||
|
} else {
|
||||||
|
knobWidth = 1;
|
||||||
|
knobHeight = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 flags = 0;
|
||||||
|
if (!enabled)
|
||||||
|
flags |= BControlLook::B_DISABLED;
|
||||||
|
|
||||||
|
float hmiddle = rect.Width() / 2;
|
||||||
|
float vmiddle = rect.Height() / 2;
|
||||||
|
|
||||||
|
BRect middleKnob = BRect(
|
||||||
|
rect.left + hmiddle
|
||||||
|
- (fOrientation == B_HORIZONTAL ? knobWidth : knobHeight),
|
||||||
|
rect.top + vmiddle
|
||||||
|
- (fOrientation == B_HORIZONTAL ? knobHeight : knobWidth),
|
||||||
|
rect.left + hmiddle
|
||||||
|
+ (fOrientation == B_HORIZONTAL ? knobWidth : knobHeight),
|
||||||
|
rect.top + vmiddle
|
||||||
|
+ (fOrientation == B_HORIZONTAL ? knobHeight : knobWidth));
|
||||||
|
|
||||||
|
if (fOrientation == B_HORIZONTAL) {
|
||||||
|
BRect leftKnob = middleKnob.OffsetByCopy(knobWidth * -4, 0);
|
||||||
|
if (leftKnob.left > rect.left + knobWidth) {
|
||||||
|
be_control_look->DrawButtonBackground(this, leftKnob, updateRect,
|
||||||
|
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
BRect rightKnob = middleKnob.OffsetByCopy(knobWidth * 4, 0);
|
||||||
|
if (rightKnob.right < rect.right - knobWidth) {
|
||||||
|
be_control_look->DrawButtonBackground(this, rightKnob, updateRect,
|
||||||
|
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BRect topKnob = middleKnob.OffsetByCopy(0, knobWidth * -4);
|
||||||
|
if (topKnob.top > rect.top + knobHeight) {
|
||||||
|
be_control_look->DrawButtonBackground(this, topKnob, updateRect,
|
||||||
|
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
BRect bottomKnob = middleKnob.OffsetByCopy(0, knobWidth * 4);
|
||||||
|
if (bottomKnob.bottom < rect.bottom - knobHeight) {
|
||||||
|
be_control_look->DrawButtonBackground(this, bottomKnob, updateRect,
|
||||||
|
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw middle knob last because it modifies middleKnob
|
||||||
|
be_control_look->DrawButtonBackground(this, middleKnob, updateRect,
|
||||||
|
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,19 +50,19 @@ APRWindow::APRWindow(BRect frame)
|
|||||||
|
|
||||||
BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL);
|
BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL);
|
||||||
|
|
||||||
|
fLookAndFeelSettings = new LookAndFeelSettingsView(
|
||||||
|
B_TRANSLATE("Look and feel"));
|
||||||
|
|
||||||
fFontSettings = new FontView(B_TRANSLATE("Fonts"));
|
fFontSettings = new FontView(B_TRANSLATE("Fonts"));
|
||||||
|
|
||||||
fColorsView = new APRView(B_TRANSLATE("Colors"));
|
fColorsView = new APRView(B_TRANSLATE("Colors"));
|
||||||
|
|
||||||
fLookAndFeelSettings = new LookAndFeelSettingsView(
|
|
||||||
B_TRANSLATE("Look and feel"));
|
|
||||||
|
|
||||||
fAntialiasingSettings = new AntialiasingSettingsView(
|
fAntialiasingSettings = new AntialiasingSettingsView(
|
||||||
B_TRANSLATE("Antialiasing"));
|
B_TRANSLATE("Antialiasing"));
|
||||||
|
|
||||||
|
tabView->AddTab(fLookAndFeelSettings);
|
||||||
tabView->AddTab(fFontSettings);
|
tabView->AddTab(fFontSettings);
|
||||||
tabView->AddTab(fColorsView);
|
tabView->AddTab(fColorsView);
|
||||||
tabView->AddTab(fLookAndFeelSettings);
|
|
||||||
tabView->AddTab(fAntialiasingSettings);
|
tabView->AddTab(fAntialiasingSettings);
|
||||||
|
|
||||||
_UpdateButtons();
|
_UpdateButtons();
|
||||||
|
|||||||
@@ -0,0 +1,360 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
|
* John Scipione <jscipione@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "FakeScrollBar.h"
|
||||||
|
|
||||||
|
#include <Box.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <ScrollBar.h>
|
||||||
|
#include <Shape.h>
|
||||||
|
#include <Size.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ARROW_LEFT = 0,
|
||||||
|
ARROW_RIGHT,
|
||||||
|
ARROW_UP,
|
||||||
|
ARROW_DOWN,
|
||||||
|
ARROW_NONE
|
||||||
|
} arrow_direction;
|
||||||
|
|
||||||
|
|
||||||
|
FakeScrollBar::FakeScrollBar(bool drawArrows, bool doubleArrows,
|
||||||
|
int32 knobStyle, BMessage* message)
|
||||||
|
:
|
||||||
|
BControl("FakeScrollBar", NULL, message, B_WILL_DRAW | B_NAVIGABLE),
|
||||||
|
fDrawArrows(drawArrows),
|
||||||
|
fDoubleArrows(doubleArrows),
|
||||||
|
fKnobStyle(knobStyle)
|
||||||
|
{
|
||||||
|
SetExplicitMinSize(BSize(160, 20));
|
||||||
|
SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FakeScrollBar::~FakeScrollBar(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::Draw(BRect updateRect)
|
||||||
|
{
|
||||||
|
BRect bounds = Bounds();
|
||||||
|
|
||||||
|
rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
if (IsFocus()) {
|
||||||
|
// draw the focus indicator
|
||||||
|
SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR));
|
||||||
|
StrokeRect(bounds);
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
|
// Draw the selected border (1px)
|
||||||
|
if (Value() == B_CONTROL_ON)
|
||||||
|
SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
|
||||||
|
else
|
||||||
|
SetHighColor(normal);
|
||||||
|
|
||||||
|
StrokeRect(bounds);
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
} else {
|
||||||
|
// Draw the selected border (2px)
|
||||||
|
if (Value() == B_CONTROL_ON)
|
||||||
|
SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
|
||||||
|
else
|
||||||
|
SetHighColor(normal);
|
||||||
|
|
||||||
|
StrokeRect(bounds);
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
StrokeRect(bounds);
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw a gap (1px)
|
||||||
|
SetHighColor(normal);
|
||||||
|
StrokeRect(bounds);
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
|
// draw a border around control (1px)
|
||||||
|
SetHighColor(tint_color(normal, B_DARKEN_1_TINT));
|
||||||
|
StrokeRect(bounds);
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
|
BRect thumbBG = bounds;
|
||||||
|
BRect bgRect = bounds;
|
||||||
|
|
||||||
|
if (fDrawArrows) {
|
||||||
|
// draw arrows
|
||||||
|
SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
|
BRect buttonFrame(bounds.left, bounds.top,
|
||||||
|
bounds.left + bounds.Height(), bounds.bottom);
|
||||||
|
|
||||||
|
_DrawArrowButton(ARROW_LEFT, fDoubleArrows, buttonFrame, updateRect);
|
||||||
|
|
||||||
|
if (fDoubleArrows) {
|
||||||
|
buttonFrame.OffsetBy(bounds.Height() + 1, 0.0);
|
||||||
|
_DrawArrowButton(ARROW_RIGHT, fDoubleArrows, buttonFrame,
|
||||||
|
updateRect);
|
||||||
|
|
||||||
|
buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2) + 1),
|
||||||
|
bounds.top);
|
||||||
|
_DrawArrowButton(ARROW_LEFT, fDoubleArrows, buttonFrame,
|
||||||
|
updateRect);
|
||||||
|
|
||||||
|
thumbBG.left += bounds.Height() * 2 + 2;
|
||||||
|
thumbBG.right -= bounds.Height() * 2 + 2;
|
||||||
|
} else {
|
||||||
|
thumbBG.left += bounds.Height() + 1;
|
||||||
|
thumbBG.right -= bounds.Height() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonFrame.OffsetTo(bounds.right - bounds.Height(), bounds.top);
|
||||||
|
_DrawArrowButton(ARROW_RIGHT, fDoubleArrows, buttonFrame, updateRect);
|
||||||
|
|
||||||
|
SetDrawingMode(B_OP_COPY);
|
||||||
|
|
||||||
|
bgRect = bounds.InsetByCopy(48, 0);
|
||||||
|
} else
|
||||||
|
bgRect = bounds.InsetByCopy(16, 0);
|
||||||
|
|
||||||
|
// fill background besides the thumb
|
||||||
|
BRect leftOfThumb(thumbBG.left, thumbBG.top, bgRect.left - 1,
|
||||||
|
thumbBG.bottom);
|
||||||
|
BRect rightOfThumb(bgRect.right + 1, thumbBG.top, thumbBG.right,
|
||||||
|
thumbBG.bottom);
|
||||||
|
|
||||||
|
be_control_look->DrawScrollBarBackground(this, leftOfThumb,
|
||||||
|
rightOfThumb, updateRect, normal, 0, B_HORIZONTAL);
|
||||||
|
|
||||||
|
// Draw scroll thumb
|
||||||
|
|
||||||
|
// fill the clickable surface of the thumb
|
||||||
|
be_control_look->DrawButtonBackground(this, bgRect, updateRect,
|
||||||
|
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
|
||||||
|
|
||||||
|
if (fKnobStyle == B_KNOB_STYLE_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// draw the scrollbar thumb knobs
|
||||||
|
bool square = fKnobStyle == B_KNOB_STYLE_DOTS;
|
||||||
|
int32 knobWidth = 0;
|
||||||
|
int32 knobHeight = 0;
|
||||||
|
|
||||||
|
if (square) {
|
||||||
|
knobWidth = 2;
|
||||||
|
knobHeight = 2;
|
||||||
|
} else {
|
||||||
|
knobWidth = 1;
|
||||||
|
knobHeight = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
float hmiddle = bgRect.Width() / 2;
|
||||||
|
float vmiddle = bgRect.Height() / 2;
|
||||||
|
|
||||||
|
BRect middleKnob = BRect(bgRect.left + hmiddle - knobWidth,
|
||||||
|
bgRect.top + vmiddle - knobHeight,
|
||||||
|
bgRect.left + hmiddle + knobWidth,
|
||||||
|
bgRect.top + vmiddle + knobHeight);
|
||||||
|
|
||||||
|
BRect leftKnob = middleKnob.OffsetByCopy(knobWidth * -4, 0);
|
||||||
|
be_control_look->DrawButtonBackground(this, leftKnob, updateRect,
|
||||||
|
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
|
||||||
|
|
||||||
|
BRect rightKnob = middleKnob.OffsetByCopy(knobWidth * 4, 0);
|
||||||
|
be_control_look->DrawButtonBackground(this, rightKnob, updateRect,
|
||||||
|
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
|
||||||
|
|
||||||
|
// draw middle knob last because it modifies middleKnob
|
||||||
|
be_control_look->DrawButtonBackground(this, middleKnob, updateRect,
|
||||||
|
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::MouseDown(BPoint point)
|
||||||
|
{
|
||||||
|
BControl::MouseDown(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::MouseMoved(BPoint point, uint32 transit,
|
||||||
|
const BMessage* message)
|
||||||
|
{
|
||||||
|
BControl::MouseMoved(point, transit, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::MouseUp(BPoint point)
|
||||||
|
{
|
||||||
|
SetValue(B_CONTROL_ON);
|
||||||
|
Invoke();
|
||||||
|
|
||||||
|
Invalidate();
|
||||||
|
|
||||||
|
BControl::MouseUp(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::SetValue(int32 value)
|
||||||
|
{
|
||||||
|
if (value != Value()) {
|
||||||
|
BControl::SetValueNoUpdate(value);
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BView* parent = Parent();
|
||||||
|
BView* child = NULL;
|
||||||
|
|
||||||
|
if (parent != NULL) {
|
||||||
|
// If the parent is a BBox, the group parent is the parent of the BBox
|
||||||
|
BBox* box = dynamic_cast<BBox*>(parent);
|
||||||
|
|
||||||
|
if (box && box->LabelView() == this)
|
||||||
|
parent = box->Parent();
|
||||||
|
|
||||||
|
if (parent != NULL) {
|
||||||
|
BBox* box = dynamic_cast<BBox*>(parent);
|
||||||
|
|
||||||
|
// If the parent is a BBox, skip the label if there is one
|
||||||
|
if (box && box->LabelView())
|
||||||
|
child = parent->ChildAt(1);
|
||||||
|
else
|
||||||
|
child = parent->ChildAt(0);
|
||||||
|
} else
|
||||||
|
child = Window()->ChildAt(0);
|
||||||
|
} else if (Window())
|
||||||
|
child = Window()->ChildAt(0);
|
||||||
|
|
||||||
|
while (child) {
|
||||||
|
FakeScrollBar* scrollbar = dynamic_cast<FakeScrollBar*>(child);
|
||||||
|
|
||||||
|
if (scrollbar != NULL && (scrollbar != this))
|
||||||
|
scrollbar->SetValue(B_CONTROL_OFF);
|
||||||
|
else {
|
||||||
|
// If the child is a BBox, check if the label is a scrollbarbutton
|
||||||
|
BBox* box = dynamic_cast<BBox*>(child);
|
||||||
|
|
||||||
|
if (box && box->LabelView()) {
|
||||||
|
scrollbar = dynamic_cast<FakeScrollBar*>(box->LabelView());
|
||||||
|
|
||||||
|
if (scrollbar != NULL && (scrollbar != this))
|
||||||
|
scrollbar->SetValue(B_CONTROL_OFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
child = child->NextSibling();
|
||||||
|
}
|
||||||
|
|
||||||
|
//ASSERT(Value() == B_CONTROL_ON);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::SetDoubleArrows(bool doubleArrows)
|
||||||
|
{
|
||||||
|
fDoubleArrows = doubleArrows;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::SetKnobStyle(uint32 knobStyle)
|
||||||
|
{
|
||||||
|
fKnobStyle = knobStyle;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::SetFromScrollBarInfo(const scroll_bar_info &info)
|
||||||
|
{
|
||||||
|
fDoubleArrows = info.double_arrows;
|
||||||
|
fKnobStyle = info.knob;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FakeScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
||||||
|
const BRect& updateRect)
|
||||||
|
{
|
||||||
|
if (!updateRect.Intersects(r))
|
||||||
|
return;
|
||||||
|
|
||||||
|
rgb_color c = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
rgb_color light = tint_color(c, B_LIGHTEN_MAX_TINT);
|
||||||
|
rgb_color dark = tint_color(c, B_DARKEN_1_TINT);
|
||||||
|
rgb_color darker = tint_color(c, B_DARKEN_2_TINT);
|
||||||
|
rgb_color normal = c;
|
||||||
|
rgb_color arrow = tint_color(c,
|
||||||
|
(B_DARKEN_MAX_TINT + B_DARKEN_4_TINT) / 2.0);
|
||||||
|
|
||||||
|
BPoint tri1, tri2, tri3;
|
||||||
|
float hInset = r.Width() / 3;
|
||||||
|
float vInset = r.Height() / 3;
|
||||||
|
r.InsetBy(hInset, vInset);
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
case ARROW_LEFT:
|
||||||
|
tri1.Set(r.right, r.top);
|
||||||
|
tri2.Set(r.right - r.Width() / 1.33, (r.top + r.bottom + 1) / 2);
|
||||||
|
tri3.Set(r.right, r.bottom + 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ARROW_RIGHT:
|
||||||
|
tri1.Set(r.left, r.bottom + 1);
|
||||||
|
tri2.Set(r.left + r.Width() / 1.33, (r.top + r.bottom + 1) / 2);
|
||||||
|
tri3.Set(r.left, r.top);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ARROW_UP:
|
||||||
|
tri1.Set(r.left, r.bottom);
|
||||||
|
tri2.Set((r.left + r.right + 1) / 2, r.bottom - r.Height() / 1.33);
|
||||||
|
tri3.Set(r.right + 1, r.bottom);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
tri1.Set(r.left, r.top);
|
||||||
|
tri2.Set((r.left + r.right + 1) / 2, r.top + r.Height() / 1.33);
|
||||||
|
tri3.Set(r.right + 1, r.top);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
r.InsetBy(-(hInset - 1), -(vInset - 1));
|
||||||
|
BRect temp(r.InsetByCopy(-1, -1));
|
||||||
|
be_control_look->DrawButtonBackground(this, temp, updateRect,
|
||||||
|
normal, 0, BControlLook::B_ALL_BORDERS, B_HORIZONTAL);
|
||||||
|
|
||||||
|
BShape arrowShape;
|
||||||
|
arrowShape.MoveTo(tri1);
|
||||||
|
arrowShape.LineTo(tri2);
|
||||||
|
arrowShape.LineTo(tri3);
|
||||||
|
|
||||||
|
SetHighColor(arrow);
|
||||||
|
SetPenSize(ceilf(hInset / 2.0));
|
||||||
|
StrokeShape(&arrowShape);
|
||||||
|
SetPenSize(1.0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
|
* John Scipione <jscipione@gmail.com>
|
||||||
|
*/
|
||||||
|
#ifndef FAKE_SCROLL_BAR_H
|
||||||
|
#define FAKE_SCROLL_BAR_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Control.h>
|
||||||
|
|
||||||
|
|
||||||
|
class FakeScrollBar : public BControl {
|
||||||
|
public:
|
||||||
|
FakeScrollBar(bool drawArrows, bool doubleArrows,
|
||||||
|
int32 knobStyle, BMessage* message);
|
||||||
|
~FakeScrollBar(void);
|
||||||
|
|
||||||
|
virtual void MouseDown(BPoint point);
|
||||||
|
virtual void MouseMoved(BPoint point, uint32 transit,
|
||||||
|
const BMessage *message);
|
||||||
|
virtual void MouseUp(BPoint point);
|
||||||
|
|
||||||
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
|
virtual void SetValue(int32 value);
|
||||||
|
|
||||||
|
void SetDoubleArrows(bool doubleArrows);
|
||||||
|
void SetKnobStyle(uint32 knobStyle);
|
||||||
|
|
||||||
|
void SetFromScrollBarInfo(const scroll_bar_info &info);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _DrawArrowButton(int32 direction,
|
||||||
|
bool doubleArrows, BRect r,
|
||||||
|
const BRect& updateRect);
|
||||||
|
|
||||||
|
bool fDrawArrows;
|
||||||
|
bool fDoubleArrows;
|
||||||
|
int32 fKnobStyle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FAKE_SCROLL_BAR_H
|
||||||
@@ -10,6 +10,7 @@ Preference Appearance :
|
|||||||
APRMain.cpp
|
APRMain.cpp
|
||||||
AntialiasingSettingsView.cpp
|
AntialiasingSettingsView.cpp
|
||||||
LookAndFeelSettingsView.cpp
|
LookAndFeelSettingsView.cpp
|
||||||
|
FakeScrollBar.cpp
|
||||||
FontSelectionView.cpp
|
FontSelectionView.cpp
|
||||||
FontView.cpp
|
FontView.cpp
|
||||||
APRView.cpp
|
APRView.cpp
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Alexander von Gluck, kallisti5@unixzen.com
|
|
||||||
* Stephan Aßmus <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
|
* Alexander von Gluck <kallisti5@unixzen.com>
|
||||||
|
* John Scipione <jscipione@gmail.com>
|
||||||
* Ryan Leavengood <leavengood@gmail.com>
|
* Ryan Leavengood <leavengood@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -22,15 +23,22 @@
|
|||||||
#include <GridLayoutBuilder.h>
|
#include <GridLayoutBuilder.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
|
#include <RadioButton.h>
|
||||||
|
#include <ScrollBar.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
#include <Size.h>
|
||||||
#include <Slider.h>
|
#include <Slider.h>
|
||||||
#include <SpaceLayoutItem.h>
|
#include <SpaceLayoutItem.h>
|
||||||
|
#include <StringView.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
#include "APRWindow.h"
|
#include "APRWindow.h"
|
||||||
|
#include "FakeScrollBar.h"
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
@@ -40,9 +48,17 @@
|
|||||||
|
|
||||||
static const int32 kMsgSetDecor = 'deco';
|
static const int32 kMsgSetDecor = 'deco';
|
||||||
static const int32 kMsgDecorInfo = 'idec';
|
static const int32 kMsgDecorInfo = 'idec';
|
||||||
static const int32 kMsgDoubleScrollbarArrows = 'dsba';
|
|
||||||
|
|
||||||
static const bool kDefaultDoubleScrollbarArrowsSetting = false;
|
static const int32 kMsgDoubleScrollBarArrows = 'dsba';
|
||||||
|
|
||||||
|
static const int32 kMsgArrowStyleSingle = 'mass';
|
||||||
|
static const int32 kMsgArrowStyleDouble = 'masd';
|
||||||
|
|
||||||
|
static const int32 kMsgKnobStyleNone = 'mksn';
|
||||||
|
static const int32 kMsgKnobStyleDots = 'mksd';
|
||||||
|
static const int32 kMsgKnobStyleLines = 'mksl';
|
||||||
|
|
||||||
|
static const bool kDefaultDoubleScrollBarArrowsSetting = false;
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@@ -53,8 +69,7 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
|
|||||||
BView(name, 0),
|
BView(name, 0),
|
||||||
fDecorInfoButton(NULL),
|
fDecorInfoButton(NULL),
|
||||||
fDecorMenuField(NULL),
|
fDecorMenuField(NULL),
|
||||||
fDecorMenu(NULL),
|
fDecorMenu(NULL)
|
||||||
fDoubleScrollbarArrowsCheckBox(NULL)
|
|
||||||
{
|
{
|
||||||
// Decorator menu
|
// Decorator menu
|
||||||
_BuildDecorMenu();
|
_BuildDecorMenu();
|
||||||
@@ -64,24 +79,79 @@ LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
|
|||||||
fDecorInfoButton = new BButton(B_TRANSLATE("About"),
|
fDecorInfoButton = new BButton(B_TRANSLATE("About"),
|
||||||
new BMessage(kMsgDecorInfo));
|
new BMessage(kMsgDecorInfo));
|
||||||
|
|
||||||
fDoubleScrollbarArrowsCheckBox = new BCheckBox("doubleScrollbarArrows",
|
// scrollbar arrow style
|
||||||
B_TRANSLATE("Use double scrollbar arrows"),
|
BBox* arrowStyleBox = new BBox("arrow style");
|
||||||
new BMessage(kMsgDoubleScrollbarArrows));
|
arrowStyleBox->SetLabel(B_TRANSLATE("Arrow style"));
|
||||||
|
|
||||||
fSavedDoubleArrowsValue = _GetDoubleScrollbarArrowsSetting();
|
fSavedDoubleArrowsValue = _DoubleScrollBarArrows();
|
||||||
fDoubleScrollbarArrowsCheckBox->SetValue(fSavedDoubleArrowsValue);
|
|
||||||
|
fArrowStyleSingle = new FakeScrollBar(true, false, B_KNOB_STYLE_LINES,
|
||||||
|
new BMessage(kMsgArrowStyleSingle));
|
||||||
|
fArrowStyleDouble = new FakeScrollBar(true, true, B_KNOB_STYLE_LINES,
|
||||||
|
new BMessage(kMsgArrowStyleDouble));
|
||||||
|
|
||||||
|
BView* arrowStyleView;
|
||||||
|
arrowStyleView = BLayoutBuilder::Group<>()
|
||||||
|
.AddGroup(B_VERTICAL, 1)
|
||||||
|
.Add(new BStringView("single", B_TRANSLATE("Single:")))
|
||||||
|
.Add(fArrowStyleSingle)
|
||||||
|
.Add(new BStringView("spacer", ""))
|
||||||
|
.Add(new BStringView("double", B_TRANSLATE("Double:")))
|
||||||
|
.Add(fArrowStyleDouble)
|
||||||
|
.Add(BSpaceLayoutItem::CreateVerticalStrut(0))
|
||||||
|
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||||
|
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
||||||
|
.End()
|
||||||
|
.View();
|
||||||
|
arrowStyleBox->AddChild(arrowStyleView);
|
||||||
|
|
||||||
|
// scrollbar knob style
|
||||||
|
fSavedKnobStyleValue = _ScrollBarKnobStyle();
|
||||||
|
|
||||||
|
BBox* knobStyleBox = new BBox("knob style");
|
||||||
|
knobStyleBox->SetLabel(B_TRANSLATE("Knob style"));
|
||||||
|
|
||||||
|
fKnobStyleNone = new FakeScrollBar(false, false, B_KNOB_STYLE_NONE,
|
||||||
|
new BMessage(kMsgKnobStyleNone));
|
||||||
|
fKnobStyleDots = new FakeScrollBar(false, false, B_KNOB_STYLE_DOTS,
|
||||||
|
new BMessage(kMsgKnobStyleDots));
|
||||||
|
fKnobStyleLines = new FakeScrollBar(false, false, B_KNOB_STYLE_LINES,
|
||||||
|
new BMessage(kMsgKnobStyleLines));
|
||||||
|
|
||||||
|
BView* knobStyleView;
|
||||||
|
knobStyleView = BLayoutBuilder::Group<>()
|
||||||
|
.AddGroup(B_VERTICAL, 0)
|
||||||
|
.Add(fKnobStyleNone)
|
||||||
|
.Add(new BStringView("spacer", ""))
|
||||||
|
.Add(fKnobStyleDots)
|
||||||
|
.Add(new BStringView("spacer", ""))
|
||||||
|
.Add(fKnobStyleLines)
|
||||||
|
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||||
|
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
||||||
|
.End()
|
||||||
|
.View();
|
||||||
|
knobStyleBox->AddChild(knobStyleView);
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
|
|
||||||
// control layout
|
// control layout
|
||||||
AddChild(BGridLayoutBuilder(10, 10)
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_DEFAULT_SPACING)
|
||||||
.Add(fDecorMenuField->CreateLabelLayoutItem(), 0, 0)
|
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
|
||||||
.Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0)
|
.Add(BGridLayoutBuilder(B_USE_DEFAULT_SPACING,
|
||||||
.Add(fDecorInfoButton, 2, 0)
|
B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(fDecorMenuField->CreateLabelLayoutItem(), 0, 0)
|
||||||
.Add(fDoubleScrollbarArrowsCheckBox, 0, 3, 2)
|
.Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0)
|
||||||
.Add(BSpaceLayoutItem::CreateGlue(), 0, 4, 2)
|
.Add(fDecorInfoButton, 2, 0)
|
||||||
.SetInsets(10, 10, 10, 10)
|
)
|
||||||
|
.Add(new BStringView("label", B_TRANSLATE("Scroll bars:")))
|
||||||
|
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
|
||||||
|
.Add(arrowStyleBox)
|
||||||
|
.Add(knobStyleBox)
|
||||||
|
.End()
|
||||||
|
.AddGlue()
|
||||||
|
.End()
|
||||||
|
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||||
|
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
|
||||||
);
|
);
|
||||||
// TODO : Decorator Preview Image?
|
// TODO : Decorator Preview Image?
|
||||||
}
|
}
|
||||||
@@ -102,7 +172,30 @@ LookAndFeelSettingsView::AttachedToWindow()
|
|||||||
|
|
||||||
fDecorMenu->SetTargetForItems(this);
|
fDecorMenu->SetTargetForItems(this);
|
||||||
fDecorInfoButton->SetTarget(this);
|
fDecorInfoButton->SetTarget(this);
|
||||||
fDoubleScrollbarArrowsCheckBox->SetTarget(this);
|
fArrowStyleSingle->SetTarget(this);
|
||||||
|
fArrowStyleDouble->SetTarget(this);
|
||||||
|
fKnobStyleNone->SetTarget(this);
|
||||||
|
fKnobStyleDots->SetTarget(this);
|
||||||
|
fKnobStyleLines->SetTarget(this);
|
||||||
|
|
||||||
|
if (fSavedDoubleArrowsValue)
|
||||||
|
fArrowStyleDouble->SetValue(B_CONTROL_ON);
|
||||||
|
else
|
||||||
|
fArrowStyleSingle->SetValue(B_CONTROL_ON);
|
||||||
|
|
||||||
|
switch (fSavedKnobStyleValue) {
|
||||||
|
case B_KNOB_STYLE_NONE:
|
||||||
|
fKnobStyleNone->SetValue(B_CONTROL_ON);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_KNOB_STYLE_DOTS:
|
||||||
|
fKnobStyleDots->SetValue(B_CONTROL_ON);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_KNOB_STYLE_LINES:
|
||||||
|
fKnobStyleLines->SetValue(B_CONTROL_ON);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -117,6 +210,7 @@ LookAndFeelSettingsView::MessageReceived(BMessage *msg)
|
|||||||
_SetDecor(newDecor);
|
_SetDecor(newDecor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kMsgDecorInfo:
|
case kMsgDecorInfo:
|
||||||
{
|
{
|
||||||
DecorInfo* decor = fDecorUtility.FindDecorator(fCurrentDecor);
|
DecorInfo* decor = fDecorUtility.FindDecorator(fCurrentDecor);
|
||||||
@@ -145,8 +239,25 @@ LookAndFeelSettingsView::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kMsgDoubleScrollbarArrows:
|
|
||||||
_SetDoubleScrollbarArrowsSetting(fDoubleScrollbarArrowsCheckBox->Value());
|
case kMsgArrowStyleSingle:
|
||||||
|
_SetDoubleScrollBarArrows(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMsgArrowStyleDouble:
|
||||||
|
_SetDoubleScrollBarArrows(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMsgKnobStyleNone:
|
||||||
|
_SetScrollBarKnobStyle(B_KNOB_STYLE_NONE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMsgKnobStyleDots:
|
||||||
|
_SetScrollBarKnobStyle(B_KNOB_STYLE_DOTS);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kMsgKnobStyleLines:
|
||||||
|
_SetScrollBarKnobStyle(B_KNOB_STYLE_LINES);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -221,7 +332,7 @@ LookAndFeelSettingsView::_AdoptInterfaceToCurrentDecor()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LookAndFeelSettingsView::_GetDoubleScrollbarArrowsSetting()
|
LookAndFeelSettingsView::_DoubleScrollBarArrows()
|
||||||
{
|
{
|
||||||
scroll_bar_info info;
|
scroll_bar_info info;
|
||||||
get_scroll_bar_info(&info);
|
get_scroll_bar_info(&info);
|
||||||
@@ -231,42 +342,84 @@ LookAndFeelSettingsView::_GetDoubleScrollbarArrowsSetting()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LookAndFeelSettingsView::_SetDoubleScrollbarArrowsSetting(bool value)
|
LookAndFeelSettingsView::_SetDoubleScrollBarArrows(bool doubleArrows)
|
||||||
{
|
{
|
||||||
scroll_bar_info info;
|
scroll_bar_info info;
|
||||||
get_scroll_bar_info(&info);
|
get_scroll_bar_info(&info);
|
||||||
|
|
||||||
info.double_arrows = value;
|
info.double_arrows = doubleArrows;
|
||||||
set_scroll_bar_info(&info);
|
set_scroll_bar_info(&info);
|
||||||
|
|
||||||
|
if (doubleArrows)
|
||||||
|
fArrowStyleDouble->SetValue(B_CONTROL_ON);
|
||||||
|
else
|
||||||
|
fArrowStyleSingle->SetValue(B_CONTROL_ON);
|
||||||
|
|
||||||
Window()->PostMessage(kMsgUpdate);
|
Window()->PostMessage(kMsgUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
LookAndFeelSettingsView::_ScrollBarKnobStyle()
|
||||||
|
{
|
||||||
|
scroll_bar_info info;
|
||||||
|
get_scroll_bar_info(&info);
|
||||||
|
|
||||||
|
return info.knob;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LookAndFeelSettingsView::_SetScrollBarKnobStyle(int32 knobStyle)
|
||||||
|
{
|
||||||
|
scroll_bar_info info;
|
||||||
|
get_scroll_bar_info(&info);
|
||||||
|
|
||||||
|
info.knob = knobStyle;
|
||||||
|
set_scroll_bar_info(&info);
|
||||||
|
|
||||||
|
switch (knobStyle) {
|
||||||
|
case B_KNOB_STYLE_NONE:
|
||||||
|
fKnobStyleNone->SetValue(B_CONTROL_ON);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_KNOB_STYLE_DOTS:
|
||||||
|
fKnobStyleDots->SetValue(B_CONTROL_ON);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_KNOB_STYLE_LINES:
|
||||||
|
fKnobStyleLines->SetValue(B_CONTROL_ON);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Window()->PostMessage(kMsgUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
LookAndFeelSettingsView::IsDefaultable()
|
||||||
|
{
|
||||||
|
return fCurrentDecor != fDecorUtility.DefaultDecorator()->Name()
|
||||||
|
|| _DoubleScrollBarArrows() != false
|
||||||
|
|| _ScrollBarKnobStyle() != B_KNOB_STYLE_DOTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LookAndFeelSettingsView::SetDefaults()
|
LookAndFeelSettingsView::SetDefaults()
|
||||||
{
|
{
|
||||||
_SetDecor(fDecorUtility.DefaultDecorator());
|
_SetDecor(fDecorUtility.DefaultDecorator());
|
||||||
_SetDoubleScrollbarArrowsSetting(kDefaultDoubleScrollbarArrowsSetting);
|
_SetDoubleScrollBarArrows(false);
|
||||||
fDoubleScrollbarArrowsCheckBox->SetValue(
|
_SetScrollBarKnobStyle(B_KNOB_STYLE_DOTS);
|
||||||
kDefaultDoubleScrollbarArrowsSetting);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
LookAndFeelSettingsView::IsDefaultable()
|
|
||||||
{
|
|
||||||
return fCurrentDecor != fDecorUtility.DefaultDecorator()->Name() ||
|
|
||||||
fDoubleScrollbarArrowsCheckBox->Value() !=
|
|
||||||
kDefaultDoubleScrollbarArrowsSetting;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LookAndFeelSettingsView::IsRevertable()
|
LookAndFeelSettingsView::IsRevertable()
|
||||||
{
|
{
|
||||||
return fCurrentDecor != fSavedDecor ||
|
return fCurrentDecor != fSavedDecor
|
||||||
fDoubleScrollbarArrowsCheckBox->Value() != fSavedDoubleArrowsValue;
|
|| _DoubleScrollBarArrows() != fSavedDoubleArrowsValue
|
||||||
|
|| _ScrollBarKnobStyle() != fSavedKnobStyleValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -274,6 +427,6 @@ void
|
|||||||
LookAndFeelSettingsView::Revert()
|
LookAndFeelSettingsView::Revert()
|
||||||
{
|
{
|
||||||
_SetDecor(fSavedDecor);
|
_SetDecor(fSavedDecor);
|
||||||
_SetDoubleScrollbarArrowsSetting(fSavedDoubleArrowsValue);
|
_SetScrollBarKnobStyle(fSavedKnobStyleValue);
|
||||||
fDoubleScrollbarArrowsCheckBox->SetValue(fSavedDoubleArrowsValue);
|
_SetDoubleScrollBarArrows(fSavedDoubleArrowsValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
* Copyright 2010-2012 Haiku, Inc. All rights reserved.
|
* Copyright 2010-2012 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Alexander von Gluck, kallisti5@unixzen.com
|
|
||||||
* Stephan Aßmus <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
|
* Alexander von Gluck <kallisti5@unixzen.com>
|
||||||
|
* John Scipione <jscipione@gmail.com>
|
||||||
* Ryan Leavengood <leavengood@gmail.com>
|
* Ryan Leavengood <leavengood@gmail.com>
|
||||||
*/
|
*/
|
||||||
#ifndef LOOK_AND_FEEL_SETTINGS_VIEW_H
|
#ifndef LOOK_AND_FEEL_SETTINGS_VIEW_H
|
||||||
@@ -20,7 +21,7 @@ class BButton;
|
|||||||
class BCheckBox;
|
class BCheckBox;
|
||||||
class BMenuField;
|
class BMenuField;
|
||||||
class BPopUpMenu;
|
class BPopUpMenu;
|
||||||
|
class FakeScrollBar;
|
||||||
|
|
||||||
class LookAndFeelSettingsView : public BView {
|
class LookAndFeelSettingsView : public BView {
|
||||||
public:
|
public:
|
||||||
@@ -30,10 +31,11 @@ public:
|
|||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
void SetDefaults();
|
|
||||||
void Revert();
|
|
||||||
bool IsDefaultable();
|
bool IsDefaultable();
|
||||||
|
void SetDefaults();
|
||||||
|
|
||||||
bool IsRevertable();
|
bool IsRevertable();
|
||||||
|
void Revert();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _SetDecor(const BString& name);
|
void _SetDecor(const BString& name);
|
||||||
@@ -42,8 +44,12 @@ private:
|
|||||||
void _BuildDecorMenu();
|
void _BuildDecorMenu();
|
||||||
void _AdoptToCurrentDecor();
|
void _AdoptToCurrentDecor();
|
||||||
void _AdoptInterfaceToCurrentDecor();
|
void _AdoptInterfaceToCurrentDecor();
|
||||||
bool _GetDoubleScrollbarArrowsSetting();
|
|
||||||
void _SetDoubleScrollbarArrowsSetting(bool value);
|
bool _DoubleScrollBarArrows();
|
||||||
|
void _SetDoubleScrollBarArrows(bool doubleArrows);
|
||||||
|
|
||||||
|
int32 _ScrollBarKnobStyle();
|
||||||
|
void _SetScrollBarKnobStyle(int32 knobStyle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DecorInfoUtility fDecorUtility;
|
DecorInfoUtility fDecorUtility;
|
||||||
@@ -51,11 +57,19 @@ private:
|
|||||||
BButton* fDecorInfoButton;
|
BButton* fDecorInfoButton;
|
||||||
BMenuField* fDecorMenuField;
|
BMenuField* fDecorMenuField;
|
||||||
BPopUpMenu* fDecorMenu;
|
BPopUpMenu* fDecorMenu;
|
||||||
BCheckBox* fDoubleScrollbarArrowsCheckBox;
|
|
||||||
|
FakeScrollBar* fArrowStyleSingle;
|
||||||
|
FakeScrollBar* fArrowStyleDouble;
|
||||||
|
|
||||||
|
FakeScrollBar* fKnobStyleNone;
|
||||||
|
FakeScrollBar* fKnobStyleDots;
|
||||||
|
FakeScrollBar* fKnobStyleLines;
|
||||||
|
|
||||||
BString fSavedDecor;
|
BString fSavedDecor;
|
||||||
BString fCurrentDecor;
|
BString fCurrentDecor;
|
||||||
|
|
||||||
bool fSavedDoubleArrowsValue;
|
bool fSavedDoubleArrowsValue;
|
||||||
|
int32 fSavedKnobStyleValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LOOK_AND_FEEL_SETTINGS_VIEW_H
|
#endif // LOOK_AND_FEEL_SETTINGS_VIEW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user