Style changes in Tracker, no functional change.

Manual whitespace cleanup
Change instances of const char * to const char*
Convert /* */ C style comments to // C++ style comments
This commit is contained in:
John Scipione
2012-07-27 20:46:47 -04:00
parent 8fe9f8b2d0
commit b05aa8b5b1
135 changed files with 6806 additions and 6302 deletions
+78 -18
View File
@@ -32,11 +32,13 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "AttributeStream.h" #include "AttributeStream.h"
#include <Debug.h> #include <Debug.h>
#include <Node.h> #include <Node.h>
// ToDo: // ToDo:
// lazy Rewind from Drive, only if data is available // lazy Rewind from Drive, only if data is available
// BMessage node // BMessage node
@@ -49,6 +51,7 @@ AttributeInfo::AttributeInfo(const AttributeInfo &cloneThis)
{ {
} }
AttributeInfo::AttributeInfo(const char* name, attr_info info) AttributeInfo::AttributeInfo(const char* name, attr_info info)
: fName(name), : fName(name),
fInfo(info) fInfo(info)
@@ -162,6 +165,7 @@ AttributeStreamNode::Read(const char *name, const char *foreignName, uint32 type
return fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc); return fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc);
} }
off_t off_t
AttributeStreamNode::Write(const char* name, const char* foreignName, uint32 type, AttributeStreamNode::Write(const char* name, const char* foreignName, uint32 type,
off_t size, const void* buffer) off_t size, const void* buffer)
@@ -172,6 +176,7 @@ AttributeStreamNode::Write(const char *name, const char *foreignName, uint32 typ
return fWriteTo->Write(name, foreignName, type, size, buffer); return fWriteTo->Write(name, foreignName, type, size, buffer);
} }
bool bool
AttributeStreamNode::Drive() AttributeStreamNode::Drive()
{ {
@@ -183,6 +188,7 @@ AttributeStreamNode::Drive()
return true; return true;
} }
const AttributeInfo* const AttributeInfo*
AttributeStreamNode::Next() AttributeStreamNode::Next()
{ {
@@ -192,6 +198,7 @@ AttributeStreamNode::Next()
return NULL; return NULL;
} }
const char* const char*
AttributeStreamNode::Get() AttributeStreamNode::Get()
{ {
@@ -202,6 +209,7 @@ AttributeStreamNode::Get()
return fReadFrom->Get(); return fReadFrom->Get();
} }
bool bool
AttributeStreamNode::Fill(char* buffer) const AttributeStreamNode::Fill(char* buffer) const
{ {
@@ -209,6 +217,7 @@ AttributeStreamNode::Fill(char *buffer) const
return fReadFrom->Fill(buffer); return fReadFrom->Fill(buffer);
} }
bool bool
AttributeStreamNode::Start() AttributeStreamNode::Start()
{ {
@@ -219,6 +228,7 @@ AttributeStreamNode::Start()
return fWriteTo->Start(); return fWriteTo->Start();
} }
void void
AttributeStreamNode::Detach() AttributeStreamNode::Detach()
{ {
@@ -246,6 +256,7 @@ AttributeStreamFileNode::AttributeStreamFileNode(BNode *node)
ASSERT(fNode); ASSERT(fNode);
} }
void void
AttributeStreamFileNode::Rewind() AttributeStreamFileNode::Rewind()
{ {
@@ -253,6 +264,7 @@ AttributeStreamFileNode::Rewind()
fNode->RewindAttrs(); fNode->RewindAttrs();
} }
void void
AttributeStreamFileNode::SetTo(BNode* node) AttributeStreamFileNode::SetTo(BNode* node)
{ {
@@ -274,6 +286,7 @@ AttributeStreamFileNode::Contains(const char *name, uint32 type)
return info.size; return info.size;
} }
off_t off_t
AttributeStreamFileNode::Read(const char* name, const char* foreignName, uint32 type, AttributeStreamFileNode::Read(const char* name, const char* foreignName, uint32 type,
off_t size, void* buffer, void (*swapFunc)(void*)) off_t size, void* buffer, void (*swapFunc)(void*))
@@ -291,6 +304,7 @@ AttributeStreamFileNode::Read(const char *name, const char *foreignName, uint32
return 0; return 0;
} }
off_t off_t
AttributeStreamFileNode::Write(const char* name, const char* foreignName, uint32 type, AttributeStreamFileNode::Write(const char* name, const char* foreignName, uint32 type,
off_t size, const void* buffer) off_t size, const void* buffer)
@@ -306,6 +320,7 @@ AttributeStreamFileNode::Write(const char *name, const char *foreignName, uint32
return result; return result;
} }
bool bool
AttributeStreamFileNode::Drive() AttributeStreamFileNode::Drive()
{ {
@@ -324,6 +339,7 @@ AttributeStreamFileNode::Drive()
return true; return true;
} }
const char* const char*
AttributeStreamFileNode::Get() AttributeStreamFileNode::Get()
{ {
@@ -332,6 +348,7 @@ AttributeStreamFileNode::Get()
return NULL; return NULL;
} }
bool bool
AttributeStreamFileNode::Fill(char* buffer) const AttributeStreamFileNode::Fill(char* buffer) const
{ {
@@ -340,6 +357,7 @@ AttributeStreamFileNode::Fill(char *buffer) const
(size_t)fCurrentAttr.Size()) == (ssize_t)fCurrentAttr.Size(); (size_t)fCurrentAttr.Size()) == (ssize_t)fCurrentAttr.Size();
} }
const AttributeInfo* const AttributeInfo*
AttributeStreamFileNode::Next() AttributeStreamFileNode::Next()
{ {
@@ -364,12 +382,14 @@ AttributeStreamMemoryNode::AttributeStreamMemoryNode()
{ {
} }
void void
AttributeStreamMemoryNode::MakeEmpty() AttributeStreamMemoryNode::MakeEmpty()
{ {
fAttributes.MakeEmpty(); fAttributes.MakeEmpty();
} }
void void
AttributeStreamMemoryNode::Rewind() AttributeStreamMemoryNode::Rewind()
{ {
@@ -377,6 +397,7 @@ AttributeStreamMemoryNode::Rewind()
fCurrentIndex = -1; fCurrentIndex = -1;
} }
int32 int32
AttributeStreamMemoryNode::Find(const char* name, uint32 type) const AttributeStreamMemoryNode::Find(const char* name, uint32 type) const
{ {
@@ -389,6 +410,7 @@ AttributeStreamMemoryNode::Find(const char *name, uint32 type) const
return -1; return -1;
} }
off_t off_t
AttributeStreamMemoryNode::Contains(const char* name, uint32 type) AttributeStreamMemoryNode::Contains(const char* name, uint32 type)
{ {
@@ -429,6 +451,7 @@ AttributeStreamMemoryNode::Read(const char *name, const char *DEBUG_ONLY(foreign
return attrNode->fAttr.Size(); return attrNode->fAttr.Size();
} }
off_t off_t
AttributeStreamMemoryNode::Write(const char* name, const char*, uint32 type, AttributeStreamMemoryNode::Write(const char* name, const char*, uint32 type,
off_t size, const void* buffer) off_t size, const void* buffer)
@@ -441,6 +464,7 @@ AttributeStreamMemoryNode::Write(const char *name, const char *, uint32 type,
return size; return size;
} }
bool bool
AttributeStreamMemoryNode::Drive() AttributeStreamMemoryNode::Drive()
{ {
@@ -453,6 +477,7 @@ AttributeStreamMemoryNode::Drive()
return true; return true;
} }
AttributeStreamMemoryNode::AttrNode* AttributeStreamMemoryNode::AttrNode*
AttributeStreamMemoryNode::BufferingGet(const char* name, uint32 type, off_t size) AttributeStreamMemoryNode::BufferingGet(const char* name, uint32 type, off_t size)
{ {
@@ -481,6 +506,7 @@ AttributeStreamMemoryNode::BufferingGet()
return BufferingGet(attr->Name(), attr->Type(), attr->Size()); return BufferingGet(attr->Name(), attr->Type(), attr->Size());
} }
const AttributeInfo* const AttributeInfo*
AttributeStreamMemoryNode::Next() AttributeStreamMemoryNode::Next()
{ {
@@ -495,6 +521,7 @@ AttributeStreamMemoryNode::Next()
return &fAttributes.ItemAt(++fCurrentIndex)->fAttr; return &fAttributes.ItemAt(++fCurrentIndex)->fAttr;
} }
const char* const char*
AttributeStreamMemoryNode::Get() AttributeStreamMemoryNode::Get()
{ {
@@ -502,6 +529,7 @@ AttributeStreamMemoryNode::Get()
return fAttributes.ItemAt(fCurrentIndex)->fData; return fAttributes.ItemAt(fCurrentIndex)->fData;
} }
bool bool
AttributeStreamMemoryNode::Fill(char* buffer) const AttributeStreamMemoryNode::Fill(char* buffer) const
{ {
@@ -513,14 +541,15 @@ AttributeStreamMemoryNode::Fill(char *buffer) const
} }
AttributeStreamTemplateNode::AttributeStreamTemplateNode(const AttributeTemplate * AttributeStreamTemplateNode::AttributeStreamTemplateNode(
attrTemplates, int32 count) const AttributeTemplate* attrTemplates, int32 count)
: fAttributes(attrTemplates), : fAttributes(attrTemplates),
fCurrentIndex(-1), fCurrentIndex(-1),
fCount(count) fCount(count)
{ {
} }
off_t off_t
AttributeStreamTemplateNode::Contains(const char* name, uint32 type) AttributeStreamTemplateNode::Contains(const char* name, uint32 type)
{ {
@@ -531,12 +560,14 @@ AttributeStreamTemplateNode::Contains(const char *name, uint32 type)
return fAttributes[index].fSize; return fAttributes[index].fSize;
} }
void void
AttributeStreamTemplateNode::Rewind() AttributeStreamTemplateNode::Rewind()
{ {
fCurrentIndex = -1; fCurrentIndex = -1;
} }
const AttributeInfo* const AttributeInfo*
AttributeStreamTemplateNode::Next() AttributeStreamTemplateNode::Next()
{ {
@@ -546,11 +577,13 @@ AttributeStreamTemplateNode::Next()
++fCurrentIndex; ++fCurrentIndex;
fCurrentAttr.SetTo(fAttributes[fCurrentIndex].fAttributeName, fCurrentAttr.SetTo(fAttributes[fCurrentIndex].fAttributeName,
fAttributes[fCurrentIndex].fAttributeType, fAttributes[fCurrentIndex].fSize); fAttributes[fCurrentIndex].fAttributeType,
fAttributes[fCurrentIndex].fSize);
return &fCurrentAttr; return &fCurrentAttr;
} }
const char* const char*
AttributeStreamTemplateNode::Get() AttributeStreamTemplateNode::Get()
{ {
@@ -558,26 +591,32 @@ AttributeStreamTemplateNode::Get()
return fAttributes[fCurrentIndex].fBits; return fAttributes[fCurrentIndex].fBits;
} }
bool bool
AttributeStreamTemplateNode::Fill(char* buffer) const AttributeStreamTemplateNode::Fill(char* buffer) const
{ {
ASSERT(fCurrentIndex < fCount); ASSERT(fCurrentIndex < fCount);
memcpy(buffer, fAttributes[fCurrentIndex].fBits, (size_t)fAttributes[fCurrentIndex].fSize); memcpy(buffer, fAttributes[fCurrentIndex].fBits,
(size_t)fAttributes[fCurrentIndex].fSize);
return true; return true;
} }
int32 int32
AttributeStreamTemplateNode::Find(const char* name, uint32 type) const AttributeStreamTemplateNode::Find(const char* name, uint32 type) const
{ {
for (int32 index = 0; index < fCount; index++) for (int32 index = 0; index < fCount; index++) {
if (fAttributes[index].fAttributeType == type && if (fAttributes[index].fAttributeType == type &&
strcmp(name, fAttributes[index].fAttributeName) == 0) strcmp(name, fAttributes[index].fAttributeName) == 0) {
return index; return index;
}
}
return -1; return -1;
} }
bool bool
AttributeStreamFilterNode::Reject(const char*, uint32, off_t) AttributeStreamFilterNode::Reject(const char*, uint32, off_t)
{ {
@@ -585,6 +624,7 @@ AttributeStreamFilterNode::Reject(const char *, uint32 , off_t )
return false; return false;
} }
const AttributeInfo* const AttributeInfo*
AttributeStreamFilterNode::Next() AttributeStreamFilterNode::Next()
{ {
@@ -602,6 +642,7 @@ AttributeStreamFilterNode::Next()
return NULL; return NULL;
} }
off_t off_t
AttributeStreamFilterNode::Contains(const char* name, uint32 type) AttributeStreamFilterNode::Contains(const char* name, uint32 type)
{ {
@@ -616,6 +657,7 @@ AttributeStreamFilterNode::Contains(const char *name, uint32 type)
return 0; return 0;
} }
off_t off_t
AttributeStreamFilterNode::Read(const char* name, const char* foreignName, uint32 type, AttributeStreamFilterNode::Read(const char* name, const char* foreignName, uint32 type,
off_t size, void* buffer, void (*swapFunc)(void*)) off_t size, void* buffer, void (*swapFunc)(void*))
@@ -629,6 +671,7 @@ AttributeStreamFilterNode::Read(const char *name, const char *foreignName, uint3
return 0; return 0;
} }
off_t off_t
AttributeStreamFilterNode::Write(const char* name, const char* foreignName, uint32 type, AttributeStreamFilterNode::Write(const char* name, const char* foreignName, uint32 type,
off_t size, const void* buffer) off_t size, const void* buffer)
@@ -648,6 +691,7 @@ NamesToAcceptAttrFilter::NamesToAcceptAttrFilter(const char **nameList)
{ {
} }
bool bool
NamesToAcceptAttrFilter::Reject(const char* name, uint32 , off_t ) NamesToAcceptAttrFilter::Reject(const char* name, uint32 , off_t )
{ {
@@ -660,13 +704,16 @@ NamesToAcceptAttrFilter::Reject(const char *name, uint32 , off_t )
return false; return false;
} }
} }
//PRINT(("filter rejecting %s\n", name)); //PRINT(("filter rejecting %s\n", name));
return true; return true;
} }
SelectiveAttributeTransformer::SelectiveAttributeTransformer(const char *attributeName, SelectiveAttributeTransformer::SelectiveAttributeTransformer(
bool (*transformFunc)(const char * , uint32 , off_t, void *, void *), void *params) const char* attributeName,
bool (*transformFunc)(const char* , uint32 , off_t, void*, void*),
void* params)
: fAttributeNameToTransform(attributeName), : fAttributeNameToTransform(attributeName),
fTransformFunc(transformFunc), fTransformFunc(transformFunc),
fTransformParams(params), fTransformParams(params),
@@ -677,15 +724,20 @@ SelectiveAttributeTransformer::SelectiveAttributeTransformer(const char *attribu
SelectiveAttributeTransformer::~SelectiveAttributeTransformer() SelectiveAttributeTransformer::~SelectiveAttributeTransformer()
{ {
for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0; index--) for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0;
index--) {
delete [] fTransformedBuffers.ItemAt(index); delete [] fTransformedBuffers.ItemAt(index);
} }
}
void void
SelectiveAttributeTransformer::Rewind() SelectiveAttributeTransformer::Rewind()
{ {
for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0; index--) for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0;
index--) {
delete [] fTransformedBuffers.ItemAt(index); delete [] fTransformedBuffers.ItemAt(index);
}
fTransformedBuffers.MakeEmpty(); fTransformedBuffers.MakeEmpty();
} }
@@ -698,7 +750,8 @@ SelectiveAttributeTransformer::Read(const char *name, const char *foreignName,
if (!fReadFrom) if (!fReadFrom)
return 0; return 0;
off_t result = fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc); off_t result = fReadFrom->Read(name, foreignName, type, size, buffer,
swapFunc);
if (WillTransform(name, type, size, (const char*)buffer)) if (WillTransform(name, type, size, (const char*)buffer))
ApplyTransformer(name, type, size, (char*)buffer); ApplyTransformer(name, type, size, (char*)buffer);
@@ -706,6 +759,7 @@ SelectiveAttributeTransformer::Read(const char *name, const char *foreignName,
return result; return result;
} }
bool bool
SelectiveAttributeTransformer::WillTransform(const char* name, uint32, off_t, SelectiveAttributeTransformer::WillTransform(const char* name, uint32, off_t,
const char*) const const char*) const
@@ -713,16 +767,17 @@ SelectiveAttributeTransformer::WillTransform(const char *name, uint32 , off_t ,
return strcmp(name, fAttributeNameToTransform) == 0; return strcmp(name, fAttributeNameToTransform) == 0;
} }
bool bool
SelectiveAttributeTransformer::ApplyTransformer(const char *name, uint32 type, off_t size, SelectiveAttributeTransformer::ApplyTransformer(const char* name, uint32 type,
char *data) off_t size, char* data)
{ {
return (fTransformFunc)(name, type, size, data, fTransformParams); return (fTransformFunc)(name, type, size, data, fTransformParams);
} }
char* char*
SelectiveAttributeTransformer::CopyAndApplyTransformer(const char *name, uint32 type, SelectiveAttributeTransformer::CopyAndApplyTransformer(const char* name,
off_t size, const char *data) uint32 type, off_t size, const char* data)
{ {
char* result = NULL; char* result = NULL;
if (data) { if (data) {
@@ -734,9 +789,11 @@ SelectiveAttributeTransformer::CopyAndApplyTransformer(const char *name, uint32
delete [] result; delete [] result;
return NULL; return NULL;
} }
return result; return result;
} }
const AttributeInfo* const AttributeInfo*
SelectiveAttributeTransformer::Next() SelectiveAttributeTransformer::Next()
{ {
@@ -748,6 +805,7 @@ SelectiveAttributeTransformer::Next()
return result; return result;
} }
const char* const char*
SelectiveAttributeTransformer::Get() SelectiveAttributeTransformer::Get()
{ {
@@ -756,11 +814,13 @@ SelectiveAttributeTransformer::Get()
const char* result = fReadFrom->Get(); const char* result = fReadFrom->Get();
if (!WillTransform(fCurrentAttr.Name(), fCurrentAttr.Type(), fCurrentAttr.Size(), result)) if (!WillTransform(fCurrentAttr.Name(), fCurrentAttr.Type(),
fCurrentAttr.Size(), result)) {
return result; return result;
}
char *transformedData = CopyAndApplyTransformer(fCurrentAttr.Name(), fCurrentAttr.Type(), char* transformedData = CopyAndApplyTransformer(fCurrentAttr.Name(),
fCurrentAttr.Size(), result); fCurrentAttr.Type(), fCurrentAttr.Size(), result);
// enlist for proper disposal when our job is done // enlist for proper disposal when our job is done
if (transformedData) { if (transformedData) {
+26 -12
View File
@@ -46,11 +46,10 @@ All rights reserved.
// //
// In addition to the whacky (but usefull) << syntax, calls like Read, Write are also // In addition to the whacky (but usefull) << syntax, calls like Read, Write are also
// available // available
#ifndef __ATTRIBUTE_STREAM__ #ifndef __ATTRIBUTE_STREAM__
#define __ATTRIBUTE_STREAM__ #define __ATTRIBUTE_STREAM__
#include <Node.h> #include <Node.h>
#include <Rect.h> #include <Rect.h>
#include <String.h> #include <String.h>
@@ -60,6 +59,7 @@ All rights reserved.
#include "ObjectList.h" #include "ObjectList.h"
namespace BPrivate { namespace BPrivate {
struct AttributeTemplate { struct AttributeTemplate {
@@ -92,6 +92,7 @@ private:
attr_info fInfo; attr_info fInfo;
}; };
class AttributeStreamNode { class AttributeStreamNode {
public: public:
AttributeStreamNode(); AttributeStreamNode();
@@ -120,7 +121,6 @@ public:
const void* buffer); const void* buffer);
// write to this node // write to this node
// work calls // work calls
virtual bool Drive(); virtual bool Drive();
// node at the head of the stream makes the entire stream // node at the head of the stream makes the entire stream
@@ -152,6 +152,7 @@ protected:
AttributeStreamNode* fWriteTo; AttributeStreamNode* fWriteTo;
}; };
class AttributeStreamFileNode : public AttributeStreamNode { class AttributeStreamFileNode : public AttributeStreamNode {
// handles reading and writing attributes to and from the // handles reading and writing attributes to and from the
// stream // stream
@@ -162,10 +163,10 @@ public:
virtual void MakeEmpty(); virtual void MakeEmpty();
virtual void Rewind(); virtual void Rewind();
virtual off_t Contains(const char* name, uint32 type); virtual off_t Contains(const char* name, uint32 type);
virtual off_t Read(const char *name, const char *foreignName, uint32 type, off_t size, virtual off_t Read(const char* name, const char* foreignName, uint32 type,
void *buffer, void (*swapFunc)(void *) = 0); off_t size, void* buffer, void (*swapFunc)(void*) = 0);
virtual off_t Write(const char *name, const char *foreignName, uint32 type, off_t size, virtual off_t Write(const char* name, const char* foreignName, uint32 type,
const void *buffer); off_t size, const void* buffer);
void SetTo(BNode*); void SetTo(BNode*);
@@ -189,6 +190,7 @@ private:
typedef AttributeStreamNode _inherited; typedef AttributeStreamNode _inherited;
}; };
class AttributeStreamMemoryNode : public AttributeStreamNode { class AttributeStreamMemoryNode : public AttributeStreamNode {
// in memory attribute buffer; can be both target of writing and source // in memory attribute buffer; can be both target of writing and source
// of reading at the same time // of reading at the same time
@@ -203,7 +205,6 @@ public:
const void* buffer); const void* buffer);
protected: protected:
virtual bool CanFeed() const { return true; } virtual bool CanFeed() const { return true; }
virtual void Rewind(); virtual void Rewind();
virtual bool Drive(); virtual bool Drive();
@@ -234,13 +235,13 @@ protected:
int32 Find(const char* name, uint32 type) const; int32 Find(const char* name, uint32 type) const;
private: private:
BObjectList<AttrNode> fAttributes; BObjectList<AttrNode> fAttributes;
int32 fCurrentIndex; int32 fCurrentIndex;
typedef AttributeStreamNode _inherited; typedef AttributeStreamNode _inherited;
}; };
class AttributeStreamTemplateNode : public AttributeStreamNode { class AttributeStreamTemplateNode : public AttributeStreamNode {
// in read-only memory attribute source // in read-only memory attribute source
// can only be used as a source for Next and Get // can only be used as a source for Next and Get
@@ -250,7 +251,6 @@ public:
virtual off_t Contains(const char* name, uint32 type); virtual off_t Contains(const char* name, uint32 type);
protected: protected:
virtual bool CanFeed() const { return true; } virtual bool CanFeed() const { return true; }
virtual void Rewind(); virtual void Rewind();
virtual const AttributeInfo* Next(); virtual const AttributeInfo* Next();
@@ -268,6 +268,7 @@ private:
typedef AttributeStreamNode _inherited; typedef AttributeStreamNode _inherited;
}; };
class AttributeStreamFilterNode : public AttributeStreamNode { class AttributeStreamFilterNode : public AttributeStreamNode {
// filter node may not pass thru specified attributes // filter node may not pass thru specified attributes
public: public:
@@ -288,6 +289,7 @@ private:
typedef AttributeStreamNode _inherited; typedef AttributeStreamNode _inherited;
}; };
class NamesToAcceptAttrFilter : public AttributeStreamFilterNode { class NamesToAcceptAttrFilter : public AttributeStreamFilterNode {
// filter node that only passes thru attributes that match // filter node that only passes thru attributes that match
// a list of names // a list of names
@@ -301,6 +303,7 @@ private:
const char** fNameList; const char** fNameList;
}; };
class SelectiveAttributeTransformer : public AttributeStreamNode { class SelectiveAttributeTransformer : public AttributeStreamNode {
// node applies a transformation on specified attributes // node applies a transformation on specified attributes
public: public:
@@ -335,12 +338,13 @@ private:
typedef AttributeStreamNode _inherited; typedef AttributeStreamNode _inherited;
}; };
template <class Type> template <class Type>
class AttributeStreamConstValue : public AttributeStreamNode { class AttributeStreamConstValue : public AttributeStreamNode {
public: public:
AttributeStreamConstValue(const char* name, uint32 attributeType, Type value); AttributeStreamConstValue(const char* name, uint32 attributeType, Type value);
protected:
protected:
virtual bool CanFeed() const { return true; } virtual bool CanFeed() const { return true; }
virtual void Rewind() { fRewound = true; } virtual void Rewind() { fRewound = true; }
virtual const AttributeInfo* Next(); virtual const AttributeInfo* Next();
@@ -357,6 +361,7 @@ private:
typedef AttributeStreamNode _inherited; typedef AttributeStreamNode _inherited;
}; };
template<class Type> template<class Type>
AttributeStreamConstValue<Type>::AttributeStreamConstValue(const char* name, AttributeStreamConstValue<Type>::AttributeStreamConstValue(const char* name,
uint32 attributeType, Type value) uint32 attributeType, Type value)
@@ -366,6 +371,7 @@ AttributeStreamConstValue<Type>::AttributeStreamConstValue(const char *name,
{ {
} }
template<class Type> template<class Type>
const AttributeInfo* const AttributeInfo*
AttributeStreamConstValue<Type>::Next() AttributeStreamConstValue<Type>::Next()
@@ -377,6 +383,7 @@ AttributeStreamConstValue<Type>::Next()
return &fAttr; return &fAttr;
} }
template<class Type> template<class Type>
const char* const char*
AttributeStreamConstValue<Type>::Get() AttributeStreamConstValue<Type>::Get()
@@ -384,6 +391,7 @@ AttributeStreamConstValue<Type>::Get()
return (const char*)&fValue; return (const char*)&fValue;
} }
template<class Type> template<class Type>
bool bool
AttributeStreamConstValue<Type>::Fill(char* buffer) const AttributeStreamConstValue<Type>::Fill(char* buffer) const
@@ -392,6 +400,7 @@ AttributeStreamConstValue<Type>::Fill(char *buffer) const
return true; return true;
} }
template<class Type> template<class Type>
int32 int32
AttributeStreamConstValue<Type>::Find(const char* name, uint32 type) const AttributeStreamConstValue<Type>::Find(const char* name, uint32 type) const
@@ -402,6 +411,7 @@ AttributeStreamConstValue<Type>::Find(const char *name, uint32 type) const
return -1; return -1;
} }
class AttributeStreamBoolValue : public AttributeStreamConstValue<bool> { class AttributeStreamBoolValue : public AttributeStreamConstValue<bool> {
public: public:
AttributeStreamBoolValue(const char* name, bool value) AttributeStreamBoolValue(const char* name, bool value)
@@ -409,6 +419,7 @@ public:
{} {}
}; };
class AttributeStreamInt32Value : public AttributeStreamConstValue<int32> { class AttributeStreamInt32Value : public AttributeStreamConstValue<int32> {
public: public:
AttributeStreamInt32Value(const char* name, int32 value) AttributeStreamInt32Value(const char* name, int32 value)
@@ -416,6 +427,7 @@ public:
{} {}
}; };
class AttributeStreamInt64Value : public AttributeStreamConstValue<int64> { class AttributeStreamInt64Value : public AttributeStreamConstValue<int64> {
public: public:
AttributeStreamInt64Value(const char* name, int64 value) AttributeStreamInt64Value(const char* name, int64 value)
@@ -423,6 +435,7 @@ public:
{} {}
}; };
class AttributeStreamRectValue : public AttributeStreamConstValue<BRect> { class AttributeStreamRectValue : public AttributeStreamConstValue<BRect> {
public: public:
AttributeStreamRectValue(const char* name, BRect value) AttributeStreamRectValue(const char* name, BRect value)
@@ -430,6 +443,7 @@ public:
{} {}
}; };
class AttributeStreamFloatValue : public AttributeStreamConstValue<float> { class AttributeStreamFloatValue : public AttributeStreamConstValue<float> {
public: public:
AttributeStreamFloatValue(const char* name, float value) AttributeStreamFloatValue(const char* name, float value)
@@ -437,7 +451,7 @@ public:
{} {}
}; };
} } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
+1 -1
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _ATTRIBUTES_H #ifndef _ATTRIBUTES_H
#define _ATTRIBUTES_H #define _ATTRIBUTES_H
namespace BPrivate { namespace BPrivate {
// viewable attributes // viewable attributes
+1
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "AutoMounterSettings.h" #include "AutoMounterSettings.h"
#include <Alert.h> #include <Alert.h>
-1
View File
@@ -31,7 +31,6 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef AUTOMOUNTER_SETTINGS_H #ifndef AUTOMOUNTER_SETTINGS_H
#define AUTOMOUNTER_SETTINGS_H #define AUTOMOUNTER_SETTINGS_H
+1 -1
View File
@@ -68,4 +68,4 @@ enum {
const int32 B_RESTORE_BACKGROUND_IMAGE = 'Tbgr'; // force a Tracker window to const int32 B_RESTORE_BACKGROUND_IMAGE = 'Tbgr'; // force a Tracker window to
// use a new background image // use a new background image
#endif /* _TRACKER_BACKGROUND_H */ #endif // _TRACKER_BACKGROUND_H
+4 -2
View File
@@ -33,7 +33,7 @@ All rights reserved.
*/ */
// Classes used for setting up and managing background images // Classes used for setting up and managing background images
//
#include <Bitmap.h> #include <Bitmap.h>
#include <ControlLook.h> #include <ControlLook.h>
@@ -50,6 +50,7 @@ All rights reserved.
#include "Commands.h" #include "Commands.h"
#include "PoseView.h" #include "PoseView.h"
namespace BPrivate { namespace BPrivate {
const char* kBackgroundImageInfo = B_BACKGROUND_INFO; const char* kBackgroundImageInfo = B_BACKGROUND_INFO;
@@ -59,7 +60,8 @@ const char *kBackgroundImageInfoMode = B_BACKGROUND_MODE;
const char* kBackgroundImageInfoWorkspaces = B_BACKGROUND_WORKSPACES; const char* kBackgroundImageInfoWorkspaces = B_BACKGROUND_WORKSPACES;
const char* kBackgroundImageInfoPath = B_BACKGROUND_IMAGE; const char* kBackgroundImageInfoPath = B_BACKGROUND_IMAGE;
} } // namespace BPrivate
BackgroundImage* BackgroundImage*
BackgroundImage::GetBackgroundImage(const BNode* node, bool isDesktop) BackgroundImage::GetBackgroundImage(const BNode* node, bool isDesktop)
+5 -5
View File
@@ -31,16 +31,17 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
// Classes used for setting up and managing background images
//
#ifndef __BACKGROUND_IMAGE__ #ifndef __BACKGROUND_IMAGE__
#define __BACKGROUND_IMAGE__ #define __BACKGROUND_IMAGE__
// Classes used for setting up and managing background images
#include <String.h> #include <String.h>
#include "ObjectList.h" #include "ObjectList.h"
class BNode; class BNode;
class BView; class BView;
class BBitmap; class BBitmap;
@@ -127,7 +128,6 @@ private:
BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList; BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList;
}; };
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
+5 -2
View File
@@ -199,10 +199,13 @@ BImageResources::find_image(void *memAddr) const
image_info info; image_info info;
int32 cookie = 0; int32 cookie = 0;
while (get_next_image_info(0, &cookie, &info) == B_OK) while (get_next_image_info(0, &cookie, &info) == B_OK)
if ((info.text <= memAddr && (((uint8 *)info.text)+info.text_size) > memAddr) if ((info.text <= memAddr
||(info.data <= memAddr && (((uint8 *)info.data)+info.data_size) > memAddr)) && (((uint8*)info.text)+info.text_size) > memAddr)
|| (info.data <= memAddr
&& (((uint8*)info.data)+info.data_size) > memAddr)) {
// Found the image. // Found the image.
return info.id; return info.id;
}
return -1; return -1;
} }
+2 -2
View File
@@ -31,7 +31,6 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __BITS__ #ifndef __BITS__
#define __BITS__ #define __BITS__
@@ -43,6 +42,7 @@ All rights reserved.
#include "TrackerIcons.h" #include "TrackerIcons.h"
class BBitmap; class BBitmap;
namespace BPrivate { namespace BPrivate {
@@ -93,13 +93,13 @@ private:
}; };
extern extern
#ifdef _IMPEXP_TRACKER #ifdef _IMPEXP_TRACKER
_IMPEXP_TRACKER _IMPEXP_TRACKER
#endif #endif
BImageResources* GetTrackerResources(); BImageResources* GetTrackerResources();
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
+1 -1
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _COMMANDS_H #ifndef _COMMANDS_H
#define _COMMANDS_H #define _COMMANDS_H
#include "PublicCommands.h" #include "PublicCommands.h"
#include <MountServer.h> #include <MountServer.h>
+14 -12
View File
@@ -493,11 +493,10 @@ DraggableContainerIcon::FrameMoved(BPoint /*newLocation*/)
bar->GetPreferredSize(&width, &height); bar->GetPreferredSize(&width, &height);
bar->SetResizingMode(resizingMode); bar->SetResizingMode(resizingMode);
/* //BMenuItem* item = bar->ItemAt(bar->CountItems() - 1);
BMenuItem* item = bar->ItemAt(bar->CountItems() - 1); //if (item == NULL)
if (item == NULL) // return;
return;
*/
// BeOS shifts the coordinates for hidden views, so we cannot // BeOS shifts the coordinates for hidden views, so we cannot
// use them to decide if we should be visible or not... // use them to decide if we should be visible or not...
@@ -1668,7 +1667,7 @@ BContainerWindow::MessageReceived(BMessage *message)
FSUndo(); FSUndo();
break; break;
//case B_REDO: /* only defined in Dano/Zeta/OpenBeOS */ //case B_REDO: // only defined in Dano/Zeta/OpenBeOS
case kRedo: case kRedo:
FSRedo(); FSRedo();
break; break;
@@ -2372,8 +2371,10 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu *navMenu, uint32 what,
void void
BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent) BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent)
{ {
if (IsTrash() || InTrash() || IsPrintersDir() || !fMoveToItem || !fCopyToItem || !fCreateLinkItem) if (IsTrash() || InTrash() || IsPrintersDir() || !fMoveToItem
|| !fCopyToItem || !fCreateLinkItem) {
return; return;
}
// Grab the modifiers state since we use it twice // Grab the modifiers state since we use it twice
uint32 modifierKeys = modifiers(); uint32 modifierKeys = modifiers();
@@ -3340,9 +3341,8 @@ BContainerWindow::AddMimeTypesToMenu()
} }
/*! Adds a menu for a specific MIME type if it doesn't exist already. // Adds a menu for a specific MIME type if it doesn't exist already.
Returns the menu, if it existed or not. // Returns the menu, if it existed or not.
*/
BMenu* BMenu*
BContainerWindow::AddMimeMenu(const BMimeType& mimeType, bool isSuperType, BContainerWindow::AddMimeMenu(const BMimeType& mimeType, bool isSuperType,
BMenu* menu, int32 start) BMenu* menu, int32 start)
@@ -4170,8 +4170,10 @@ WindowStateNodeOpener::SetTo(Model *model, bool forWriting)
fNode = NULL; fNode = NULL;
fStreamNode = NULL; fStreamNode = NULL;
fModelOpener = new ModelNodeLazyOpener(model, forWriting, false); fModelOpener = new ModelNodeLazyOpener(model, forWriting, false);
if (fModelOpener->IsOpen(forWriting)) if (fModelOpener->IsOpen(forWriting)) {
fStreamNode = new AttributeStreamFileNode(fModelOpener->TargetModel()->Node()); fStreamNode = new AttributeStreamFileNode(
fModelOpener->TargetModel()->Node());
}
} }
+1 -1
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _CONTAINER_WINDOW_H #ifndef _CONTAINER_WINDOW_H
#define _CONTAINER_WINDOW_H #define _CONTAINER_WINDOW_H
#include <Window.h> #include <Window.h>
#include "LockingList.h" #include "LockingList.h"
+2 -1
View File
@@ -31,13 +31,14 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __COUNT_VIEW__ #ifndef __COUNT_VIEW__
#define __COUNT_VIEW__ #define __COUNT_VIEW__
#include <String.h> #include <String.h>
#include <View.h> #include <View.h>
namespace BPrivate { namespace BPrivate {
class BPoseView; class BPoseView;
+1
View File
@@ -8,6 +8,7 @@
#ifndef CURSORS_H #ifndef CURSORS_H
#define CURSORS_H #define CURSORS_H
// Exported with Wonderbrush from haiku/data/artwork/cursors/Overlays_Tracker // Exported with Wonderbrush from haiku/data/artwork/cursors/Overlays_Tracker
// TODO: Don't use these, there are new cursors, which you can use by ID. // TODO: Don't use these, there are new cursors, which you can use by ID.
// (Except for the kMoveCursor, which has different meaning here.) // (Except for the kMoveCursor, which has different meaning here.)
+3 -1
View File
@@ -31,16 +31,17 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _DESK_WINDOW_H #ifndef _DESK_WINDOW_H
#define _DESK_WINDOW_H #define _DESK_WINDOW_H
#include <Shelf.h> #include <Shelf.h>
#include <set> #include <set>
#include "ContainerWindow.h" #include "ContainerWindow.h"
#include "DesktopPoseView.h" #include "DesktopPoseView.h"
class BPopUpMenu; class BPopUpMenu;
namespace BPrivate { namespace BPrivate {
@@ -95,6 +96,7 @@ private:
typedef BContainerWindow _inherited; typedef BContainerWindow _inherited;
}; };
inline DesktopPoseView* inline DesktopPoseView*
BDeskWindow::PoseView() const BDeskWindow::PoseView() const
{ {
+6 -4
View File
@@ -34,21 +34,24 @@ All rights reserved.
// DesktopPoseView adds support for displaying integrated desktops // DesktopPoseView adds support for displaying integrated desktops
// from multiple volumes to BPoseView // from multiple volumes to BPoseView
#ifndef _DESKTOP_POSE_VIEW_H #ifndef _DESKTOP_POSE_VIEW_H
#define _DESKTOP_POSE_VIEW_H #define _DESKTOP_POSE_VIEW_H
#include "EntryIterator.h" #include "EntryIterator.h"
#include "PoseView.h" #include "PoseView.h"
namespace BPrivate { namespace BPrivate {
class DesktopPoseView : public BPoseView { class DesktopPoseView : public BPoseView {
// overrides BPoseView to add desktop-view specific code // overrides BPoseView to add desktop-view specific code
public: public:
DesktopPoseView(Model *, BRect, uint32 viewMode, uint32 resizeMask = B_FOLLOW_ALL); DesktopPoseView(Model*, BRect, uint32 viewMode,
uint32 resizeMask = B_FOLLOW_ALL);
static EntryListBase *InitDesktopDirentIterator(BPoseView *, const entry_ref *); static EntryListBase* InitDesktopDirentIterator(BPoseView*,
const entry_ref*);
void ShowVolumes(bool visible, bool showShared); void ShowVolumes(bool visible, bool showShared);
@@ -72,7 +75,6 @@ protected:
private: private:
typedef BPoseView _inherited; typedef BPoseView _inherited;
}; };
-1
View File
@@ -595,4 +595,3 @@ PaneSwitch::DrawInState(PaneSwitch::State state)
break; break;
} }
} }
+3 -1
View File
@@ -31,14 +31,15 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _DIALOG_PANE_ #ifndef _DIALOG_PANE_
#define _DIALOG_PANE_ #define _DIALOG_PANE_
#include <Control.h> #include <Control.h>
#include "ObjectList.h" #include "ObjectList.h"
namespace BPrivate { namespace BPrivate {
class ViewList : public BObjectList<BView> { class ViewList : public BObjectList<BView> {
@@ -51,6 +52,7 @@ public:
void AddAll(BView* toParent); void AddAll(BView* toParent);
}; };
class DialogPane : public BView { class DialogPane : public BView {
// dialog with collapsible panes // dialog with collapsible panes
public: public:
+4 -3
View File
@@ -139,7 +139,8 @@ BDirMenu::Populate(const BEntry *startEntry, BWindow *originatingWindow,
// if we're at the root directory skip "mnt" and go straight to "/" // if we're at the root directory skip "mnt" and go straight to "/"
BDirectory dir(&entry); BDirectory dir(&entry);
if (!showDesktop && dir.InitCheck() == B_OK && dir.IsRootDirectory()) { if (!showDesktop && dir.InitCheck() == B_OK
&& dir.IsRootDirectory()) {
hitRoot = true; hitRoot = true;
parent.SetTo("/"); parent.SetTo("/");
} }
@@ -176,7 +177,8 @@ BDirMenu::Populate(const BEntry *startEntry, BWindow *originatingWindow,
if (!select) if (!select)
return; return;
ModelMenuItem *item = dynamic_cast<ModelMenuItem *>(ItemAt(CountItems() - 1)); ModelMenuItem* item
= dynamic_cast<ModelMenuItem*>(ItemAt(CountItems() - 1));
if (item) { if (item) {
item->SetMarked(true); item->SetMarked(true);
if (menu) { if (menu) {
@@ -269,4 +271,3 @@ BDirMenu::AddDisksIconToMenu(bool atEnd)
else else
AddItem(item, 0); AddItem(item, 0);
} }
+3 -1
View File
@@ -31,13 +31,14 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef DIR_MENU_H #ifndef DIR_MENU_H
#define DIR_MENU_H #define DIR_MENU_H
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <String.h> #include <String.h>
class MenuBar; class MenuBar;
namespace BPrivate { namespace BPrivate {
@@ -64,6 +65,7 @@ private:
BString fEntryName; BString fEntryName;
}; };
inline void inline void
BDirMenu::SetMenuBar(BMenuBar* bar) BDirMenu::SetMenuBar(BMenuBar* bar)
{ {
-1
View File
@@ -550,4 +550,3 @@ CachedEntryIteratorList::AddItem(BEntryList *walker)
{ {
fIteratorList.AddItem(walker); fIteratorList.AddItem(walker);
} }
+13 -4
View File
@@ -31,20 +31,22 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __ENTRY_ITERATOR__
#define __ENTRY_ITERATOR__
// A lot of the code in here wouldn't be needed if the destructor // A lot of the code in here wouldn't be needed if the destructor
// for BEntryList was virtual // for BEntryList was virtual
// ToDo: // TODO: get rid of all BEntryList API's in here, replace them with
// get rid of all BEntryList API's in here, replace them with EntryListBase ones // EntryListBase ones
#ifndef __ENTRY_ITERATOR__
#define __ENTRY_ITERATOR__
#include <Directory.h> #include <Directory.h>
#include "ObjectList.h" #include "ObjectList.h"
#include "NodeWalker.h" #include "NodeWalker.h"
namespace BPrivate { namespace BPrivate {
class EntryListBase : public BEntryList { class EntryListBase : public BEntryList {
@@ -69,6 +71,7 @@ protected:
status_t fStatus; status_t fStatus;
}; };
class TWalkerWrapper : public EntryListBase { class TWalkerWrapper : public EntryListBase {
// this is to be able to use TWalker polymorfically as BEntryListBase // this is to be able to use TWalker polymorfically as BEntryListBase
public: public:
@@ -88,8 +91,10 @@ protected:
status_t fStatus; status_t fStatus;
}; };
const int32 kDirentBufferSize = 10 * 1024; const int32 kDirentBufferSize = 10 * 1024;
class CachedEntryIterator : public EntryListBase { class CachedEntryIterator : public EntryListBase {
public: public:
// takes any iterator and runs it through a cache of a specified size // takes any iterator and runs it through a cache of a specified size
@@ -133,6 +138,7 @@ private:
BEntry* fEntryBuffer; BEntry* fEntryBuffer;
}; };
class DirectoryEntryList : public EntryListBase { class DirectoryEntryList : public EntryListBase {
public: public:
DirectoryEntryList(const BDirectory &); DirectoryEntryList(const BDirectory &);
@@ -149,6 +155,7 @@ private:
BDirectory fDir; BDirectory fDir;
}; };
class CachedDirectoryEntryList : public CachedEntryIterator { class CachedDirectoryEntryList : public CachedEntryIterator {
// this class is to work around not being able to delete // this class is to work around not being able to delete
// BEntryList polymorfically - need to have a special // BEntryList polymorfically - need to have a special
@@ -161,6 +168,7 @@ private:
BDirectory fDir; BDirectory fDir;
}; };
class EntryIteratorList : public EntryListBase { class EntryIteratorList : public EntryListBase {
// This wraps up several BEntryList style iterators and // This wraps up several BEntryList style iterators and
// iterates them all, going from one to the other as it finishes // iterates them all, going from one to the other as it finishes
@@ -185,6 +193,7 @@ protected:
int32 fCurrentIndex; int32 fCurrentIndex;
}; };
class CachedEntryIteratorList : public CachedEntryIterator { class CachedEntryIteratorList : public CachedEntryIterator {
public: public:
CachedEntryIteratorList(bool sortInodes = true); CachedEntryIteratorList(bool sortInodes = true);
+2
View File
@@ -32,11 +32,13 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <FilePanel.h> #include <FilePanel.h>
#include "FilePanelPriv.h" #include "FilePanelPriv.h"
#include "RecentItems.h" #include "RecentItems.h"
// FBC fluff, stick it here to not pollute real .cpp files // FBC fluff, stick it here to not pollute real .cpp files
void BRecentItemsList::_r1() {} void BRecentItemsList::_r1() {}
+19 -21
View File
@@ -513,10 +513,8 @@ FSClipboardPaste(Model *model, uint32 linksMode)
} }
/** Seek node in clipboard, if found return it's moveMode // Seek node in clipboard, if found return it's moveMode
* else return 0 // else return 0
*/
uint32 uint32
FSClipboardFindNodeMode(Model* model, bool autoLock, bool updateRefIfNeeded) FSClipboardFindNodeMode(Model* model, bool autoLock, bool updateRefIfNeeded)
{ {
@@ -761,24 +759,24 @@ BClipboardRefsWatcher::Clear()
} }
} }
/*
void
BClipboardRefsWatcher::UpdatePoseViews(bool clearClipboard, const node_ref *node)
{
BMessage message(kFSClipboardChanges);
message.AddInt32("device", node->device);
message.AddInt64("directory", node->node);
message.AddBool("clearClipboard", clearClipboard);
if (Lock()) { //void
int32 items = fNotifyList.CountItems(); //BClipboardRefsWatcher::UpdatePoseViews(bool clearClipboard, const node_ref* node)
for (int32 i = 0;i < items;i++) { //{
fNotifyList.ItemAt(i)->SendMessage(&message); // BMessage message(kFSClipboardChanges);
} // message.AddInt32("device", node->device);
Unlock(); // message.AddInt64("directory", node->node);
} // message.AddBool("clearClipboard", clearClipboard);
} //
*/ // if (Lock()) {
// int32 items = fNotifyList.CountItems();
// for (int32 i = 0;i < items;i++) {
// fNotifyList.ItemAt(i)->SendMessage(&message);
// }
// Unlock();
// }
//}
void void
BClipboardRefsWatcher::UpdatePoseViews(BMessage* reportMessage) BClipboardRefsWatcher::UpdatePoseViews(BMessage* reportMessage)
+3 -2
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef FS_CLIPBOARD_H #ifndef FS_CLIPBOARD_H
#define FS_CLIPBOARD_H #define FS_CLIPBOARD_H
#include <Looper.h> #include <Looper.h>
#include "Model.h" #include "Model.h"
#include "ObjectList.h" #include "ObjectList.h"
@@ -50,6 +50,7 @@ typedef struct {
} TClipboardNodeRef; } TClipboardNodeRef;
const int32 T_CLIPBOARD_NODE = 'TCNR'; const int32 T_CLIPBOARD_NODE = 'TCNR';
class BClipboardRefsWatcher : public BLooper { class BClipboardRefsWatcher : public BLooper {
public: public:
BClipboardRefsWatcher(); BClipboardRefsWatcher();
@@ -92,4 +93,4 @@ bool FSClipboardPaste(Model *model, uint32 linksMode = 0);
void FSClipboardRemove(Model* model); void FSClipboardRemove(Model* model);
uint32 FSClipboardFindNodeMode(Model* model, bool autoLock, bool updateRefIfNeeded); uint32 FSClipboardFindNodeMode(Model* model, bool autoLock, bool updateRefIfNeeded);
#endif /* FS_CLIPBOARD_H */ #endif // FS_CLIPBOARD_H
+4
View File
@@ -44,6 +44,7 @@ class UndoItemCopy : public UndoItem {
uint32 fMoveMode; uint32 fMoveMode;
}; };
class UndoItemMove : public UndoItem { class UndoItemMove : public UndoItem {
public: public:
/** source - list of file(s) that were moved. Assumes ownership. /** source - list of file(s) that were moved. Assumes ownership.
@@ -60,6 +61,7 @@ class UndoItemMove : public UndoItem {
entry_ref fSourceRef, fTargetRef; entry_ref fSourceRef, fTargetRef;
}; };
class UndoItemFolder : public UndoItem { class UndoItemFolder : public UndoItem {
public: public:
UndoItemFolder(const entry_ref &ref); UndoItemFolder(const entry_ref &ref);
@@ -77,6 +79,7 @@ class UndoItemFolder : public UndoItem {
entry_ref fRef; entry_ref fRef;
}; };
class UndoItemRename : public UndoItem { class UndoItemRename : public UndoItem {
public: public:
UndoItemRename(const entry_ref &origRef, const entry_ref &ref); UndoItemRename(const entry_ref &origRef, const entry_ref &ref);
@@ -90,6 +93,7 @@ class UndoItemRename : public UndoItem {
entry_ref fRef, fOrigRef; entry_ref fRef, fOrigRef;
}; };
class UndoItemRenameVolume : public UndoItem { class UndoItemRenameVolume : public UndoItem {
public: public:
UndoItemRenameVolume(BVolume &volume, const char* newName); UndoItemRenameVolume(BVolume &volume, const char* newName);
+11 -1
View File
@@ -1,9 +1,11 @@
#ifndef _FS_UNDO_REDO_H #ifndef _FS_UNDO_REDO_H
#define _FS_UNDO_REDO_H #define _FS_UNDO_REDO_H
#include "ObjectList.h" #include "ObjectList.h"
#include <Entry.h> #include <Entry.h>
namespace BPrivate { namespace BPrivate {
class UndoItem; class UndoItem;
@@ -18,48 +20,56 @@ class Undo {
UndoItem* fUndo; UndoItem* fUndo;
}; };
class MoveCopyUndo : public Undo { class MoveCopyUndo : public Undo {
public: public:
MoveCopyUndo(BObjectList<entry_ref>* sourceList, BDirectory &dest, MoveCopyUndo(BObjectList<entry_ref>* sourceList, BDirectory &dest,
BList* pointList, uint32 moveMode); BList* pointList, uint32 moveMode);
}; };
class NewFolderUndo : public Undo { class NewFolderUndo : public Undo {
public: public:
NewFolderUndo(const entry_ref &ref); NewFolderUndo(const entry_ref &ref);
}; };
class RenameUndo : public Undo { class RenameUndo : public Undo {
public: public:
RenameUndo(BEntry &entry, const char* newName); RenameUndo(BEntry &entry, const char* newName);
}; };
class RenameVolumeUndo : public Undo { class RenameVolumeUndo : public Undo {
public: public:
RenameVolumeUndo(BVolume &volume, const char* newName); RenameVolumeUndo(BVolume &volume, const char* newName);
}; };
static static
inline bool FSIsUndoMoveMode(uint32 moveMode) inline bool FSIsUndoMoveMode(uint32 moveMode)
{ {
return (moveMode & '\xff\0\0\0') == 'U\0\0\0'; return (moveMode & '\xff\0\0\0') == 'U\0\0\0';
} }
static static
inline uint32 FSUndoMoveMode(uint32 moveMode) inline uint32 FSUndoMoveMode(uint32 moveMode)
{ {
return (moveMode & ~'\xff\0\0\0') | 'U\0\0\0'; return (moveMode & ~'\xff\0\0\0') | 'U\0\0\0';
} }
static static
inline uint32 FSMoveMode(uint32 moveMode) inline uint32 FSMoveMode(uint32 moveMode)
{ {
return (moveMode & ~'\xff\0\0\0') | 'T\0\0\0'; return (moveMode & ~'\xff\0\0\0') | 'T\0\0\0';
} }
extern void FSUndo(); extern void FSUndo();
extern void FSRedo(); extern void FSRedo();
} // namespace BPrivate } // namespace BPrivate
#endif /* _FS_UNDO_REDO_H */ #endif // _FS_UNDO_REDO_H
+12 -15
View File
@@ -34,8 +34,8 @@ respective holders. All rights reserved.
// Tracker file system calls. // Tracker file system calls.
// Note - APIs/code in FSUtils.h and FSUtils.cpp is slated for a major cleanup // APIs/code in FSUtils.h and FSUtils.cpp is slated for a major cleanup -- in
// -- in other words, you will find a lot of ugly cruft in here // other words, you will find a lot of ugly cruft in here
// ToDo: // ToDo:
// Move most of preflight error checks to the Model level and only keep those // Move most of preflight error checks to the Model level and only keep those
@@ -44,6 +44,7 @@ respective holders. All rights reserved.
// Clean up the error handling, push most of the user interaction out of the // Clean up the error handling, push most of the user interaction out of the
// low level FS calls. // low level FS calls.
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
@@ -2307,12 +2308,10 @@ FSMakeOriginalName(char *name, BDirectory *destDir, const char *suffix)
} }
if (!copycopy) { if (!copycopy) {
/* // The name can't be longer than B_FILE_NAME_LENGTH.
The name can't be longer than B_FILE_NAME_LENGTH. // The algoritm adds " copy XX" to the name. That's 8 characters.
The algoritm adds " copy XX" to the name. That's 8 characters. // B_FILE_NAME_LENGTH already accounts for NULL termination so we
B_FILE_NAME_LENGTH already accounts for NULL termination so we // don't need to save an extra char at the end.
don't need to save an extra char at the end.
*/
if (strlen(name) > B_FILE_NAME_LENGTH - 8) { if (strlen(name) > B_FILE_NAME_LENGTH - 8) {
// name is too long - truncate it! // name is too long - truncate it!
name[B_FILE_NAME_LENGTH - 8] = '\0'; name[B_FILE_NAME_LENGTH - 8] = '\0';
@@ -2331,13 +2330,11 @@ FSMakeOriginalName(char *name, BDirectory *destDir, const char *suffix)
sprintf(temp_name, "%s %ld", copybase, ++fnum); sprintf(temp_name, "%s %ld", copybase, ++fnum);
if (strlen(temp_name) > (B_FILE_NAME_LENGTH - 1)) { if (strlen(temp_name) > (B_FILE_NAME_LENGTH - 1)) {
/* // The name has grown too long. Maybe we just went from
The name has grown too long. Maybe we just went from // "<filename> copy 9" to "<filename> copy 10" and that extra
"<filename> copy 9" to "<filename> copy 10" and that extra // character was too much. The solution is to further
character was too much. The solution is to further // truncate the 'root' name and continue.
truncate the 'root' name and continue. // ??? should we reset fnum or not ???
??? should we reset fnum or not ???
*/
root[strlen(root) - 1] = '\0'; root[strlen(root) - 1] = '\0';
sprintf(temp_name, "%s%s %ld", root, suffix, fnum); sprintf(temp_name, "%s%s %ld", root, suffix, fnum);
} }
+3 -2
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef FS_UTILS_H #ifndef FS_UTILS_H
#define FS_UTILS_H #define FS_UTILS_H
#include <FindDirectory.h> #include <FindDirectory.h>
#include <List.h> #include <List.h>
#include <Point.h> #include <Point.h>
@@ -45,6 +45,7 @@ All rights reserved.
#include "Model.h" #include "Model.h"
#include "ObjectList.h" #include "ObjectList.h"
// Note - APIs/code in FSUtils.h and FSUtils.cpp is slated for a major cleanup // Note - APIs/code in FSUtils.h and FSUtils.cpp is slated for a major cleanup
// -- in other words, you will find a lot of ugly cruft in here // -- in other words, you will find a lot of ugly cruft in here
@@ -328,4 +329,4 @@ class WellKnowEntryList {
using namespace BPrivate; using namespace BPrivate;
#endif /* FS_UTILS_H */ #endif // FS_UTILS_H
+2 -2
View File
@@ -321,7 +321,8 @@ FavoritesMenu::ShouldShowModel(const Model *model)
// #pragma mark - // #pragma mark -
RecentsMenu::RecentsMenu(const char *name,int32 which,uint32 what,BHandler *target) RecentsMenu::RecentsMenu(const char* name, int32 which, uint32 what,
BHandler* target)
: BNavMenu(name, what, target), : BNavMenu(name, what, target),
fWhich(which), fWhich(which),
fRecentsCount(0), fRecentsCount(0),
@@ -459,4 +460,3 @@ RecentsMenu::ClearMenuBuildingState()
fMenuBuilt = false; fMenuBuilt = false;
BNavMenu::ClearMenuBuildingState(); BNavMenu::ClearMenuBuildingState();
} }
+4 -1
View File
@@ -31,15 +31,16 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __FAVORITES_MENU__ #ifndef __FAVORITES_MENU__
#define __FAVORITES_MENU__ #define __FAVORITES_MENU__
#include <vector> #include <vector>
#include "NavMenu.h" #include "NavMenu.h"
#include "ObjectList.h" #include "ObjectList.h"
class BRefFilter; class BRefFilter;
namespace BPrivate { namespace BPrivate {
@@ -48,6 +49,7 @@ class EntryListBase;
#define kGoDirectory "Tracker/Go" #define kGoDirectory "Tracker/Go"
class FavoritesMenu : public BSlowMenu { class FavoritesMenu : public BSlowMenu {
// FavoritesMenu is used in the FilePanel - // FavoritesMenu is used in the FilePanel -
// displays recent files, recent folders and favorites items // displays recent files, recent folders and favorites items
@@ -106,6 +108,7 @@ enum recent_type {
kRecentFolders = 2 kRecentFolders = 2
}; };
class RecentsMenu : public BNavMenu { class RecentsMenu : public BNavMenu {
public: public:
RecentsMenu(const char* name,int32 which,uint32 what,BHandler* target); RecentsMenu(const char* name,int32 which,uint32 what,BHandler* target);
+26 -1
View File
@@ -34,6 +34,7 @@ All rights reserved.
// Implementation for the public FilePanel object. // Implementation for the public FilePanel object.
#include <sys/resource.h> #include <sys/resource.h>
#include <BeBuild.h> #include <BeBuild.h>
@@ -64,6 +65,7 @@ run_open_panel()
(new TFilePanel())->Show(); (new TFilePanel())->Show();
} }
void void
run_save_panel() run_save_panel()
{ {
@@ -97,12 +99,14 @@ BFilePanel::BFilePanel(file_panel_mode mode, BMessenger *target,
fWindow->SetIsFilePanel(true); fWindow->SetIsFilePanel(true);
} }
BFilePanel::~BFilePanel() BFilePanel::~BFilePanel()
{ {
if (fWindow->Lock()) if (fWindow->Lock())
fWindow->Quit(); fWindow->Quit();
} }
void void
BFilePanel::Show() BFilePanel::Show()
{ {
@@ -124,6 +128,7 @@ BFilePanel::Show()
fWindow->Activate(); fWindow->Activate();
} }
void void
BFilePanel::Hide() BFilePanel::Hide()
{ {
@@ -135,6 +140,7 @@ BFilePanel::Hide()
fWindow->QuitRequested(); fWindow->QuitRequested();
} }
bool bool
BFilePanel::IsShowing() const BFilePanel::IsShowing() const
{ {
@@ -152,6 +158,7 @@ BFilePanel::SendMessage(const BMessenger *messenger, BMessage *message)
messenger->SendMessage(message); messenger->SendMessage(message);
} }
file_panel_mode file_panel_mode
BFilePanel::PanelMode() const BFilePanel::PanelMode() const
{ {
@@ -165,6 +172,7 @@ BFilePanel::PanelMode() const
return B_OPEN_PANEL; return B_OPEN_PANEL;
} }
BMessenger BMessenger
BFilePanel::Messenger() const BFilePanel::Messenger() const
{ {
@@ -177,6 +185,7 @@ BFilePanel::Messenger() const
return *static_cast<TFilePanel*>(fWindow)->Target(); return *static_cast<TFilePanel*>(fWindow)->Target();
} }
void void
BFilePanel::SetTarget(BMessenger target) BFilePanel::SetTarget(BMessenger target)
{ {
@@ -187,6 +196,7 @@ BFilePanel::SetTarget(BMessenger target)
static_cast<TFilePanel*>(fWindow)->SetTarget(target); static_cast<TFilePanel*>(fWindow)->SetTarget(target);
} }
void void
BFilePanel::SetMessage(BMessage* message) BFilePanel::SetMessage(BMessage* message)
{ {
@@ -197,6 +207,7 @@ BFilePanel::SetMessage(BMessage *message)
static_cast<TFilePanel*>(fWindow)->SetMessage(message); static_cast<TFilePanel*>(fWindow)->SetMessage(message);
} }
void void
BFilePanel::Refresh() BFilePanel::Refresh()
{ {
@@ -207,6 +218,7 @@ BFilePanel::Refresh()
static_cast<TFilePanel*>(fWindow)->Refresh(); static_cast<TFilePanel*>(fWindow)->Refresh();
} }
BRefFilter* BRefFilter*
BFilePanel::RefFilter() const BFilePanel::RefFilter() const
{ {
@@ -217,6 +229,7 @@ BFilePanel::RefFilter() const
return static_cast<TFilePanel*>(fWindow)->Filter(); return static_cast<TFilePanel*>(fWindow)->Filter();
} }
void void
BFilePanel::SetRefFilter(BRefFilter* filter) BFilePanel::SetRefFilter(BRefFilter* filter)
{ {
@@ -227,6 +240,7 @@ BFilePanel::SetRefFilter(BRefFilter *filter)
static_cast<TFilePanel*>(fWindow)->SetRefFilter(filter); static_cast<TFilePanel*>(fWindow)->SetRefFilter(filter);
} }
void void
BFilePanel::SetButtonLabel(file_panel_button button, const char* text) BFilePanel::SetButtonLabel(file_panel_button button, const char* text)
{ {
@@ -237,6 +251,7 @@ BFilePanel::SetButtonLabel(file_panel_button button, const char *text)
static_cast<TFilePanel*>(fWindow)->SetButtonLabel(button, text); static_cast<TFilePanel*>(fWindow)->SetButtonLabel(button, text);
} }
void void
BFilePanel::GetPanelDirectory(entry_ref* ref) const BFilePanel::GetPanelDirectory(entry_ref* ref) const
{ {
@@ -247,6 +262,7 @@ BFilePanel::GetPanelDirectory(entry_ref *ref) const
*ref = *static_cast<TFilePanel*>(fWindow)->TargetModel()->EntryRef(); *ref = *static_cast<TFilePanel*>(fWindow)->TargetModel()->EntryRef();
} }
void void
BFilePanel::SetSaveText(const char* text) BFilePanel::SetSaveText(const char* text)
{ {
@@ -257,6 +273,7 @@ BFilePanel::SetSaveText(const char *text)
static_cast<TFilePanel*>(fWindow)->SetSaveText(text); static_cast<TFilePanel*>(fWindow)->SetSaveText(text);
} }
void void
BFilePanel::SetPanelDirectory(const entry_ref* ref) BFilePanel::SetPanelDirectory(const entry_ref* ref)
{ {
@@ -267,6 +284,7 @@ BFilePanel::SetPanelDirectory(const entry_ref *ref)
static_cast<TFilePanel*>(fWindow)->SetTo(ref); static_cast<TFilePanel*>(fWindow)->SetTo(ref);
} }
void void
BFilePanel::SetPanelDirectory(const char* path) BFilePanel::SetPanelDirectory(const char* path)
{ {
@@ -282,6 +300,7 @@ BFilePanel::SetPanelDirectory(const char *path)
static_cast<TFilePanel*>(fWindow)->SetTo(&ref); static_cast<TFilePanel*>(fWindow)->SetTo(&ref);
} }
void void
BFilePanel::SetPanelDirectory(const BEntry* entry) BFilePanel::SetPanelDirectory(const BEntry* entry)
{ {
@@ -291,6 +310,7 @@ BFilePanel::SetPanelDirectory(const BEntry *entry)
SetPanelDirectory(&ref); SetPanelDirectory(&ref);
} }
void void
BFilePanel::SetPanelDirectory(const BDirectory* dir) BFilePanel::SetPanelDirectory(const BDirectory* dir)
{ {
@@ -300,12 +320,14 @@ BFilePanel::SetPanelDirectory(const BDirectory *dir)
SetPanelDirectory(&entry); SetPanelDirectory(&entry);
} }
BWindow* BWindow*
BFilePanel::Window() const BFilePanel::Window() const
{ {
return fWindow; return fWindow;
} }
void void
BFilePanel::Rewind() BFilePanel::Rewind()
{ {
@@ -316,6 +338,7 @@ BFilePanel::Rewind()
static_cast<TFilePanel*>(fWindow)->Rewind(); static_cast<TFilePanel*>(fWindow)->Rewind();
} }
status_t status_t
BFilePanel::GetNextSelectedRef(entry_ref* ref) BFilePanel::GetNextSelectedRef(entry_ref* ref)
{ {
@@ -338,6 +361,7 @@ BFilePanel::SetHideWhenDone(bool on)
static_cast<TFilePanel*>(fWindow)->SetHideWhenDone(on); static_cast<TFilePanel*>(fWindow)->SetHideWhenDone(on);
} }
bool bool
BFilePanel::HidesWhenDone(void) const BFilePanel::HidesWhenDone(void) const
{ {
@@ -348,15 +372,16 @@ BFilePanel::HidesWhenDone(void) const
return static_cast<TFilePanel*>(fWindow)->HidesWhenDone(); return static_cast<TFilePanel*>(fWindow)->HidesWhenDone();
} }
void void
BFilePanel::WasHidden() BFilePanel::WasHidden()
{ {
// hook function // hook function
} }
void void
BFilePanel::SelectionChanged() BFilePanel::SelectionChanged()
{ {
// hook function // hook function
} }
-1
View File
@@ -1730,4 +1730,3 @@ BFilePanelPoseView::AdaptToDesktopIntegrationChange(BMessage *message)
ShowVolumes(false, mountSharedVolumesOntoDesktop); ShowVolumes(false, mountSharedVolumesOntoDesktop);
ShowVolumes(mountVolumesOnDesktop, mountSharedVolumesOntoDesktop); ShowVolumes(mountVolumesOnDesktop, mountSharedVolumesOntoDesktop);
} }
+16 -8
View File
@@ -31,16 +31,17 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _FILE_PANEL_PRIV_H #ifndef _FILE_PANEL_PRIV_H
#define _FILE_PANEL_PRIV_H #define _FILE_PANEL_PRIV_H
#include <FilePanel.h> #include <FilePanel.h>
#include "ContainerWindow.h" #include "ContainerWindow.h"
#include "PoseView.h" #include "PoseView.h"
#include "TaskLoop.h" #include "TaskLoop.h"
class BTextControl; class BTextControl;
class BFilePanel; class BFilePanel;
class BRefFilter; class BRefFilter;
@@ -122,19 +123,19 @@ protected:
static filter_result FSFilter(BMessage*, BHandler**, BMessageFilter*); static filter_result FSFilter(BMessage*, BHandler**, BMessageFilter*);
static filter_result MessageDropFilter(BMessage*, BHandler**, BMessageFilter*); static filter_result MessageDropFilter(BMessage*, BHandler**, BMessageFilter*);
int32 ShowCenteredAlert(const char *text, const char *button1, const char *button2 = NULL,
const char *button3 = NULL);
int32 ShowCenteredAlert(const char* text, const char* button1,
const char* button2 = NULL, const char* button3 = NULL);
private: private:
bool SwitchDirToDesktopIfNeeded(entry_ref &ref); bool SwitchDirToDesktopIfNeeded(entry_ref &ref);
bool CanOpenParent() const; bool CanOpenParent() const;
void SwitchDirMenuTo(const entry_ref* ref); void SwitchDirMenuTo(const entry_ref* ref);
void AdjustButton(); void AdjustButton();
bool SelectChildInParent(const entry_ref *parent, const node_ref *child); bool SelectChildInParent(const entry_ref* parent,
const node_ref* child);
void OpenSelectionCommon(BMessage*); void OpenSelectionCommon(BMessage*);
bool fIsSavePanel; bool fIsSavePanel;
uint32 fNodeFlavors; uint32 fNodeFlavors;
BackgroundView* fBackView; BackgroundView* fBackView;
@@ -184,13 +185,14 @@ protected:
private: private:
bool fIsDesktop; bool fIsDesktop;
// this flags makes the distinction between the Desktop as the Root of // This flags makes the distinction between the Desktop as
// the world and "/boot/home/Desktop" to which we might have navigated // the root of the world and "/boot/home/Desktop" to which
// from the home dir // we might have navigated from the home dir.
typedef BPoseView _inherited; typedef BPoseView _inherited;
}; };
// inlines follow // inlines follow
inline bool inline bool
@@ -199,36 +201,42 @@ BFilePanelPoseView::IsFilePanel() const
return true; return true;
} }
inline bool inline bool
TFilePanel::IsSavePanel() const TFilePanel::IsSavePanel() const
{ {
return fIsSavePanel; return fIsSavePanel;
} }
inline const BMessenger* inline const BMessenger*
TFilePanel::Target() const TFilePanel::Target() const
{ {
return &fTarget; return &fTarget;
} }
inline void inline void
TFilePanel::Refresh() TFilePanel::Refresh()
{ {
fPoseView->Refresh(); fPoseView->Refresh();
} }
inline bool inline bool
TFilePanel::HidesWhenDone(void) TFilePanel::HidesWhenDone(void)
{ {
return fHideWhenDone; return fHideWhenDone;
} }
inline void inline void
TFilePanel::SetHideWhenDone(bool on) TFilePanel::SetHideWhenDone(bool on)
{ {
fHideWhenDone = on; fHideWhenDone = on;
} }
inline bool inline bool
TFilePanel::TrackingMenu() const TFilePanel::TrackingMenu() const
{ {
+1 -1
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "FilePermissionsView.h" #include "FilePermissionsView.h"
#include <stdio.h> #include <stdio.h>
@@ -358,4 +359,3 @@ FilePermissionsView::AttachedToWindow()
fOwnerTextControl->SetTarget(this); fOwnerTextControl->SetTarget(this);
fGroupTextControl->SetTarget(this); fGroupTextControl->SetTarget(this);
} }
+5 -2
View File
@@ -31,15 +31,16 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef FILE_PERMISSIONS_VIEW_H #ifndef FILE_PERMISSIONS_VIEW_H
#define FILE_PERMISSIONS_VIEW_H #define FILE_PERMISSIONS_VIEW_H
#include <CheckBox.h> #include <CheckBox.h>
#include <TextControl.h> #include <TextControl.h>
#include "Model.h" #include "Model.h"
namespace BPrivate { namespace BPrivate {
class FocusCheckBox : public BCheckBox { class FocusCheckBox : public BCheckBox {
@@ -61,6 +62,7 @@ class FocusCheckBox : public BCheckBox {
} }
}; };
class FilePermissionsView : public BView { class FilePermissionsView : public BView {
public: public:
FilePermissionsView(BRect, Model*); FilePermissionsView(BRect, Model*);
@@ -92,8 +94,9 @@ class FilePermissionsView : public BView {
typedef BView _inherited; typedef BView _inherited;
}; };
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
#endif /* FILE_PERMISSIONS_VIEW_H */ #endif // FILE_PERMISSIONS_VIEW_H
+1
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <Application.h> #include <Application.h>
#include <Box.h> #include <Box.h>
#include <Button.h> #include <Button.h>
+1 -2
View File
@@ -31,7 +31,6 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _FIND_PANEL_H #ifndef _FIND_PANEL_H
#define _FIND_PANEL_H #define _FIND_PANEL_H
@@ -40,13 +39,13 @@ All rights reserved.
#include <Window.h> #include <Window.h>
#include <View.h> #include <View.h>
#include "DialogPane.h" #include "DialogPane.h"
#include "ObjectList.h" #include "ObjectList.h"
#include "MimeTypeList.h" #include "MimeTypeList.h"
#include "Utilities.h" #include "Utilities.h"
#include "NodeWalker.h" #include "NodeWalker.h"
class BFilePanel; class BFilePanel;
class BQuery; class BQuery;
class BBox; class BBox;
+9 -15
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __FUNCTION_OBJECT__ #ifndef __FUNCTION_OBJECT__
#define __FUNCTION_OBJECT__ #define __FUNCTION_OBJECT__
#include <Message.h> #include <Message.h>
#include <Messenger.h> #include <Messenger.h>
#include <MessageFilter.h> #include <MessageFilter.h>
@@ -42,6 +42,7 @@ All rights reserved.
#include <Entry.h> #include <Entry.h>
#include <Node.h> #include <Node.h>
// parameter binders serve to store a copy of a struct and // parameter binders serve to store a copy of a struct and
// pass it in and out by pointers, allowing struct parameters to share // pass it in and out by pointers, allowing struct parameters to share
// the same syntax as scalar ones // the same syntax as scalar ones
@@ -164,8 +165,7 @@ public:
template<class R> template<class R>
class FunctionObjectWithResult : public FunctionObject { class FunctionObjectWithResult : public FunctionObject {
public: public:
const R &Result() const const R &Result() const { return result; }
{ return result; }
protected: protected:
R result; R result;
@@ -182,9 +182,7 @@ public:
{ {
} }
virtual void operator()() { (function)(p1.Pass()); }
virtual void operator()()
{ (function)(p1.Pass()); }
private: private:
void (*function)(Param1); void (*function)(Param1);
@@ -193,7 +191,8 @@ private:
template <class Result, class Param1> template <class Result, class Param1>
class SingleParamFunctionObjectWithResult : public FunctionObjectWithResult<Result> { class SingleParamFunctionObjectWithResult : public
FunctionObjectWithResult<Result> {
public: public:
SingleParamFunctionObjectWithResult(Result (*function)(Param1), Param1 p1) SingleParamFunctionObjectWithResult(Result (*function)(Param1), Param1 p1)
: function(function), : function(function),
@@ -201,7 +200,6 @@ public:
{ {
} }
virtual void operator()() virtual void operator()()
{ FunctionObjectWithResult<Result>::result = (function)(p1.Pass()); } { FunctionObjectWithResult<Result>::result = (function)(p1.Pass()); }
@@ -222,8 +220,7 @@ public:
{ {
} }
virtual void operator()() virtual void operator()() { (function)(p1.Pass(), p2.Pass()); }
{ (function)(p1.Pass(), p2.Pass()); }
private: private:
void (*function)(Param1, Param2); void (*function)(Param1, Param2);
@@ -244,9 +241,7 @@ public:
{ {
} }
virtual void operator()() { (function)(p1.Pass(), p2.Pass(), p3.Pass()); }
virtual void operator()()
{ (function)(p1.Pass(), p2.Pass(), p3.Pass()); }
private: private:
void (*function)(Param1, Param2, Param3); void (*function)(Param1, Param2, Param3);
@@ -562,5 +557,4 @@ NewLockingMemberFunctionObject(void (HandlerOrSubclass::*function)(),
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __FUNCTION_OBJECT__
+1 -1
View File
@@ -67,4 +67,4 @@ class TGroupedMenu : public BMenu {
} // namespace BPrivate } // namespace BPrivate
#endif /* GROUPED_MENU_H */ #endif // GROUPED_MENU_H
+25 -7
View File
@@ -31,12 +31,13 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __NU_ICON_CACHE__
#define __NU_ICON_CACHE__
// Icon cache is used for drawing node icons; it caches icons // Icon cache is used for drawing node icons; it caches icons
// and reuses them for successive draws // and reuses them for successive draws
#ifndef __NU_ICON_CACHE__
#define __NU_ICON_CACHE__
#include <Bitmap.h> #include <Bitmap.h>
#include <Mime.h> #include <Mime.h>
@@ -47,6 +48,7 @@ All rights reserved.
#include "OpenHashTable.h" #include "OpenHashTable.h"
#include "Utilities.h" #include "Utilities.h"
// Icon cache splits icons into two caches - the shared cache, likely to get the // Icon cache splits icons into two caches - the shared cache, likely to get the
// most hits and the node cache. Every icon that is found in a mime based // most hits and the node cache. Every icon that is found in a mime based
// structure goes into the shared cache, only files that have their own private // structure goes into the shared cache, only files that have their own private
@@ -89,6 +91,7 @@ enum IconDrawMode {
kDimmedIcon kDimmedIcon
}; };
#define NORMAL_ICON_ONLY kNormalIcon #define NORMAL_ICON_ONLY kNormalIcon
// replace use of these defines with mode once the respective getters // replace use of these defines with mode once the respective getters
// can get non-plain icons // can get non-plain icons
@@ -110,6 +113,7 @@ enum IconSource {
kNode kNode
}; };
class IconCacheEntry { class IconCacheEntry {
// aliased entries don't own their icons, just point // aliased entries don't own their icons, just point
// to some other entry that does // to some other entry that does
@@ -170,6 +174,7 @@ protected:
friend class NodeIconCache; friend class NodeIconCache;
}; };
class SimpleIconCache { class SimpleIconCache {
public: public:
SimpleIconCache(const char*); SimpleIconCache(const char*);
@@ -178,7 +183,8 @@ public:
virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode mode, virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode mode,
icon_size size, bool async = false) = 0; icon_size size, bool async = false) = 0;
virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode, virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode,
icon_size , void (*)(BView *, BPoint, BBitmap *, void *), void * = NULL) = 0; icon_size, void (*)(BView*, BPoint, BBitmap*, void*),
void* = NULL) = 0;
bool Lock(); bool Lock();
void Unlock(); void Unlock();
@@ -188,6 +194,7 @@ private:
Benaphore fLock; Benaphore fLock;
}; };
class SharedCacheEntry : public IconCacheEntry { class SharedCacheEntry : public IconCacheEntry {
public: public:
SharedCacheEntry(); SharedCacheEntry();
@@ -216,6 +223,7 @@ private:
friend class SharedIconCache; friend class SharedIconCache;
}; };
class SharedCacheEntryArray : public OpenHashElementArray<SharedCacheEntry> { class SharedCacheEntryArray : public OpenHashElementArray<SharedCacheEntry> {
// SharedIconCache stores all it's elements in this array // SharedIconCache stores all it's elements in this array
public: public:
@@ -223,6 +231,7 @@ public:
SharedCacheEntry* Add(); SharedCacheEntry* Add();
}; };
class SharedIconCache : public SimpleIconCache { class SharedIconCache : public SimpleIconCache {
// SharedIconCache is used for icons that come from the mime database // SharedIconCache is used for icons that come from the mime database
public: public:
@@ -257,6 +266,7 @@ private:
// and wait for the next sync to delete them // and wait for the next sync to delete them
}; };
class NodeCacheEntry : public IconCacheEntry { class NodeCacheEntry : public IconCacheEntry {
public: public:
NodeCacheEntry(bool permanent = false); NodeCacheEntry(bool permanent = false);
@@ -285,6 +295,7 @@ private:
friend class NodeIconCache; friend class NodeIconCache;
}; };
class NodeCacheEntryArray : public OpenHashElementArray<NodeCacheEntry> { class NodeCacheEntryArray : public OpenHashElementArray<NodeCacheEntry> {
// NodeIconCache stores all it's elements in this array // NodeIconCache stores all it's elements in this array
public: public:
@@ -292,6 +303,7 @@ public:
NodeCacheEntry* Add(); NodeCacheEntry* Add();
}; };
class NodeIconCache : public SimpleIconCache { class NodeIconCache : public SimpleIconCache {
// NodeIconCache is used for nodes that define their own icons // NodeIconCache is used for nodes that define their own icons
public: public:
@@ -323,8 +335,10 @@ private:
NodeCacheEntryArray fElementArray; NodeCacheEntryArray fElementArray;
}; };
const int32 kColorTransformTableSize = 256; const int32 kColorTransformTableSize = 256;
class IconCache { class IconCache {
public: public:
IconCache(); IconCache();
@@ -344,7 +358,8 @@ public:
// preload calls used to ensure successive cache hit for the respective // preload calls used to ensure successive cache hit for the respective
// icon, used for common tracker types, etc; Not calling these should only // icon, used for common tracker types, etc; Not calling these should only
// cause a slowdown // cause a slowdown
void Preload(Model *, IconDrawMode mode, icon_size size, bool permanent = false); void Preload(Model*, IconDrawMode mode, icon_size size,
bool permanent = false);
status_t Preload(const char* mimeType, IconDrawMode mode, icon_size size); status_t Preload(const char* mimeType, IconDrawMode mode, icon_size size);
void Deleting(const Model*); void Deleting(const Model*);
@@ -373,13 +388,11 @@ public:
BBitmap* MakeSelectedIcon(const BBitmap* normal, icon_size, BBitmap* MakeSelectedIcon(const BBitmap* normal, icon_size,
LazyBitmapAllocator*); LazyBitmapAllocator*);
static bool NeedsDeletionNotification(IconSource); static bool NeedsDeletionNotification(IconSource);
static IconCache* sIconCache; static IconCache* sIconCache;
private: private:
// shared calls // shared calls
IconCacheEntry* Preload(AutoLock<SimpleIconCache>* nodeCache, IconCacheEntry* Preload(AutoLock<SimpleIconCache>* nodeCache,
AutoLock<SimpleIconCache>* sharedCache, AutoLock<SimpleIconCache>* sharedCache,
@@ -460,7 +473,8 @@ private:
color_space fColorSpace; color_space fColorSpace;
}; };
// nothing but inlines after here
// inlines follow
inline const char* inline const char*
SharedCacheEntry::FileType() const SharedCacheEntry::FileType() const
@@ -468,18 +482,21 @@ SharedCacheEntry::FileType() const
return fFileType.String(); return fFileType.String();
} }
inline const char* inline const char*
SharedCacheEntry::AppSignature() const SharedCacheEntry::AppSignature() const
{ {
return fAppSignature.String(); return fAppSignature.String();
} }
inline bool inline bool
IconCache::NeedsDeletionNotification(IconSource from) IconCache::NeedsDeletionNotification(IconSource from)
{ {
return from == kNode; return from == kNode;
} }
inline IconCacheEntry* inline IconCacheEntry*
SharedIconCache::ResolveIfAlias(IconCacheEntry* entry) const SharedIconCache::ResolveIfAlias(IconCacheEntry* entry) const
{ {
@@ -489,6 +506,7 @@ SharedIconCache::ResolveIfAlias(IconCacheEntry *entry) const
return fHashTable.ElementAt(entry->fAliasForIndex); return fHashTable.ElementAt(entry->fAliasForIndex);
} }
inline int32 inline int32
SharedIconCache::EntryIndex(const SharedCacheEntry* entry) const SharedIconCache::EntryIndex(const SharedCacheEntry* entry) const
{ {
+5 -3
View File
@@ -31,18 +31,20 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef ICON_MENU_ITEM_H
#define ICON_MENU_ITEM_H
// Menu item class with small icons. // Menu item class with small icons.
#ifndef ICON_MENU_ITEM_H
#define ICON_MENU_ITEM_H
#include <MenuItem.h> #include <MenuItem.h>
#include "Model.h" #include "Model.h"
#include "Utilities.h" #include "Utilities.h"
class BNodeInfo;
class BNodeInfo;
namespace BPrivate { namespace BPrivate {
const bigtime_t kSynchMenuInvokeTimeout = 5000000; const bigtime_t kSynchMenuInvokeTimeout = 5000000;
-1
View File
@@ -2231,4 +2231,3 @@ TrackingView::Draw(BRect)
DrawString(Label(), BPoint(3, Bounds().Height() - fontHeight.descent)); DrawString(Label(), BPoint(3, Bounds().Height() - fontHeight.descent));
} }
+6 -2
View File
@@ -52,6 +52,7 @@ namespace BPrivate {
class Model; class Model;
class AttributeView; class AttributeView;
class BInfoWindow : public BWindow { class BInfoWindow : public BWindow {
public: public:
BInfoWindow(Model*, int32 groupIndex, LockingList<BWindow>* list = NULL); BInfoWindow(Model*, int32 groupIndex, LockingList<BWindow>* list = NULL);
@@ -76,7 +77,8 @@ class BInfoWindow : public BWindow {
Model* fModel; Model* fModel;
volatile bool fStopCalc; volatile bool fStopCalc;
int32 fIndex; // tells where it lives with respect to other int32 fIndex;
// tells where it lives with respect to other
thread_id fCalcThreadID; thread_id fCalcThreadID;
LockingList<BWindow>* fWindowList; LockingList<BWindow>* fWindowList;
FilePermissionsView* fPermissionsView; FilePermissionsView* fPermissionsView;
@@ -87,12 +89,14 @@ class BInfoWindow : public BWindow {
typedef BWindow _inherited; typedef BWindow _inherited;
}; };
inline bool inline bool
BInfoWindow::StopCalc() BInfoWindow::StopCalc()
{ {
return fStopCalc; return fStopCalc;
} }
inline Model* inline Model*
BInfoWindow::TargetModel() const BInfoWindow::TargetModel() const
{ {
@@ -103,4 +107,4 @@ BInfoWindow::TargetModel() const
using namespace BPrivate; using namespace BPrivate;
#endif #endif // INFO_WINDOW_H
+7 -3
View File
@@ -31,13 +31,14 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _LOCKING_LIST_H #ifndef _LOCKING_LIST_H
#define _LOCKING_LIST_H #define _LOCKING_LIST_H
#include <Locker.h> #include <Locker.h>
#include "ObjectList.h" #include "ObjectList.h"
namespace BPrivate { namespace BPrivate {
template <class T> template <class T>
@@ -57,12 +58,14 @@ private:
BLocker lock; BLocker lock;
}; };
template<class T> template<class T>
LockingList<T>::LockingList(int32 itemsPerBlock, bool owning) LockingList<T>::LockingList(int32 itemsPerBlock, bool owning)
: BObjectList<T>(itemsPerBlock, owning) : BObjectList<T>(itemsPerBlock, owning)
{ {
} }
template<class T> template<class T>
bool bool
LockingList<T>::Lock() LockingList<T>::Lock()
@@ -70,6 +73,7 @@ LockingList<T>::Lock()
return lock.Lock(); return lock.Lock();
} }
template<class T> template<class T>
void void
LockingList<T>::Unlock() LockingList<T>::Unlock()
@@ -77,6 +81,7 @@ LockingList<T>::Unlock()
lock.Unlock(); lock.Unlock();
} }
template<class T> template<class T>
bool bool
LockingList<T>::IsLocked() const LockingList<T>::IsLocked() const
@@ -84,9 +89,8 @@ LockingList<T>::IsLocked() const
return lock.IsLocked(); return lock.IsLocked();
} }
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _LOCKING_LIST_H
+4 -2
View File
@@ -31,14 +31,15 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __MIME_TYPE_LIST__ #ifndef __MIME_TYPE_LIST__
#define __MIME_TYPE_LIST__ #define __MIME_TYPE_LIST__
#include <String.h> #include <String.h>
#include "ObjectList.h" #include "ObjectList.h"
#include "Utilities.h" #include "Utilities.h"
namespace BPrivate { namespace BPrivate {
class MimeTypeList; class MimeTypeList;
@@ -63,6 +64,7 @@ private:
friend class MimeTypeList; friend class MimeTypeList;
}; };
class MimeTypeList { class MimeTypeList {
public: public:
MimeTypeList(); MimeTypeList();
@@ -88,4 +90,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __MIME_TYPE_LIST__
+2 -2
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _MIME_TYPES_H #ifndef _MIME_TYPES_H
#define _MIME_TYPES_H #define _MIME_TYPES_H
namespace BPrivate { namespace BPrivate {
#define B_FILE_MIMETYPE "application/octet-stream" #define B_FILE_MIMETYPE "application/octet-stream"
@@ -60,4 +60,4 @@ namespace BPrivate {
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _MIME_TYPES_H
+8 -1
View File
@@ -32,12 +32,14 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <Window.h> #include <Window.h>
#include "MiniMenuField.h" #include "MiniMenuField.h"
#include "Utilities.h" #include "Utilities.h"
MiniMenuField::MiniMenuField(BRect frame, const char* name, BPopUpMenu* menu, MiniMenuField::MiniMenuField(BRect frame, const char* name, BPopUpMenu* menu,
uint32 resizeFlags, uint32 flags) uint32 resizeFlags, uint32 flags)
: BView(frame, name, resizeFlags, flags), : BView(frame, name, resizeFlags, flags),
@@ -46,11 +48,13 @@ MiniMenuField::MiniMenuField(BRect frame, const char *name, BPopUpMenu *menu,
SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE); SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE);
} }
MiniMenuField::~MiniMenuField() MiniMenuField::~MiniMenuField()
{ {
delete fMenu; delete fMenu;
} }
void void
MiniMenuField::AttachedToWindow() MiniMenuField::AttachedToWindow()
{ {
@@ -61,6 +65,7 @@ MiniMenuField::AttachedToWindow()
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
} }
void void
MiniMenuField::MakeFocus(bool on) MiniMenuField::MakeFocus(bool on)
{ {
@@ -68,6 +73,7 @@ MiniMenuField::MakeFocus(bool on)
BView::MakeFocus(on); BView::MakeFocus(on);
} }
void void
MiniMenuField::KeyDown(const char* bytes, int32 numBytes) MiniMenuField::KeyDown(const char* bytes, int32 numBytes)
{ {
@@ -85,6 +91,7 @@ MiniMenuField::KeyDown(const char *bytes, int32 numBytes)
} }
} }
void void
MiniMenuField::Draw(BRect) MiniMenuField::Draw(BRect)
{ {
@@ -151,9 +158,9 @@ MiniMenuField::Draw(BRect)
AddLine(BPoint(bounds.left, bounds.bottom), AddLine(BPoint(bounds.left, bounds.bottom),
BPoint(bounds.left, bounds.top), focused ? markColor : viewColor); BPoint(bounds.left, bounds.top), focused ? markColor : viewColor);
EndLineArray(); EndLineArray();
} }
void void
MiniMenuField::MouseDown(BPoint) MiniMenuField::MouseDown(BPoint)
{ {
+3 -3
View File
@@ -31,17 +31,17 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __MINI_MENU_FIELD__ #ifndef __MINI_MENU_FIELD__
#define __MINI_MENU_FIELD__ #define __MINI_MENU_FIELD__
#include <View.h> #include <View.h>
class BPopUpMenu; class BPopUpMenu;
namespace BPrivate { namespace BPrivate {
class MiniMenuField : public BView { class MiniMenuField : public BView {
public: public:
MiniMenuField(BRect frame, const char* name, BPopUpMenu* menu, MiniMenuField(BRect frame, const char* name, BPopUpMenu* menu,
@@ -67,4 +67,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __MINI_MENU_FIELD__
+4 -5
View File
@@ -31,11 +31,12 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _NU_MODEL_H
#define _NU_MODEL_H
// Dedicated to BModel // Dedicated to BModel
#ifndef _NU_MODEL_H
#define _NU_MODEL_H
#include <AppFileInfo.h> #include <AppFileInfo.h>
#include <Debug.h> #include <Debug.h>
@@ -524,8 +525,6 @@ ModelNodeLazyOpener::OpenNode(bool writable)
return B_OK; return B_OK;
} }
} // namespace BPrivate } // namespace BPrivate
#endif // _NU_MODEL_H
#endif
+3 -2
View File
@@ -31,12 +31,13 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef MOUNTMENU_H #ifndef MOUNTMENU_H
#define MOUNTMENU_H #define MOUNTMENU_H
#include <Menu.h> #include <Menu.h>
namespace BPrivate { namespace BPrivate {
class MountMenu : public BMenu { class MountMenu : public BMenu {
@@ -54,4 +55,4 @@ protected:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // MOUNTMENU_H
-1
View File
@@ -868,4 +868,3 @@ BNavMenu::SetTrackingHookDeep(BMenu* menu, bool (*func)(BMenu*, void*),
SetTrackingHookDeep(submenu, func, state); SetTrackingHookDeep(submenu, func, state);
} }
} }
+23 -9
View File
@@ -31,6 +31,8 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "Bitmaps.h" #include "Bitmaps.h"
#include "Commands.h" #include "Commands.h"
#include "ContainerWindow.h" #include "ContainerWindow.h"
@@ -38,9 +40,11 @@ All rights reserved.
#include "Model.h" #include "Model.h"
#include "Navigator.h" #include "Navigator.h"
#include "Tracker.h" #include "Tracker.h"
#include <Window.h>
#include <Picture.h> #include <Picture.h>
#include <TextControl.h> #include <TextControl.h>
#include <Window.h>
namespace BPrivate { namespace BPrivate {
@@ -53,6 +57,7 @@ static const int32 kMaxHistory = 32;
// pictures when we can, e.g. on a AttachedToWindow. // pictures when we can, e.g. on a AttachedToWindow.
static BPicture sPicture; static BPicture sPicture;
BNavigatorButton::BNavigatorButton(BRect rect, const char* name, BMessage* message, BNavigatorButton::BNavigatorButton(BRect rect, const char* name, BMessage* message,
int32 resIDon, int32 resIDoff, int32 resIDdisabled) int32 resIDon, int32 resIDoff, int32 resIDdisabled)
: BPictureButton(rect, name, &sPicture, &sPicture, message), : BPictureButton(rect, name, &sPicture, &sPicture, message),
@@ -60,17 +65,18 @@ BNavigatorButton::BNavigatorButton(BRect rect, const char *name, BMessage *messa
fResIDOff(resIDoff), fResIDOff(resIDoff),
fResIDDisabled(resIDdisabled) fResIDDisabled(resIDdisabled)
{ {
// Clear to background color to // Clear to background color to avoid ugly border on click
// avoid ugly border on click
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
} }
BNavigatorButton::~BNavigatorButton() BNavigatorButton::~BNavigatorButton()
{ {
} }
void void
BNavigatorButton::AttachedToWindow() BNavigatorButton::AttachedToWindow()
{ {
@@ -91,6 +97,7 @@ BNavigatorButton::AttachedToWindow()
delete bmpDisabled; delete bmpDisabled;
} }
void void
BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on) BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on)
{ {
@@ -158,13 +165,14 @@ BNavigator::BNavigator(const Model *model, BRect rect, uint32 resizeMask)
B_FOLLOW_LEFT_RIGHT); B_FOLLOW_LEFT_RIGHT);
fLocation->SetDivider(0); fLocation->SetDivider(0);
AddChild(fLocation); AddChild(fLocation);
} }
BNavigator::~BNavigator() BNavigator::~BNavigator()
{ {
} }
void void
BNavigator::AttachedToWindow() BNavigator::AttachedToWindow()
{ {
@@ -178,6 +186,7 @@ BNavigator::AttachedToWindow()
fLocation->SetTarget(this); fLocation->SetTarget(this);
} }
void void
BNavigator::Draw(BRect) BNavigator::Draw(BRect)
{ {
@@ -194,6 +203,7 @@ BNavigator::Draw(BRect)
EndLineArray(); EndLineArray();
} }
void void
BNavigator::MessageReceived(BMessage* message) BNavigator::MessageReceived(BMessage* message)
{ {
@@ -216,8 +226,7 @@ BNavigator::MessageReceived(BMessage *message)
default: default:
{ {
// Catch any dropped refs and try // Catch any dropped refs and try to switch to this new directory
// to switch to this new directory
entry_ref ref; entry_ref ref;
if (message->FindRef("refs", &ref) == B_OK) { if (message->FindRef("refs", &ref) == B_OK) {
BMessage message(kSwitchDirectory); BMessage message(kSwitchDirectory);
@@ -236,6 +245,7 @@ BNavigator::MessageReceived(BMessage *message)
} }
} }
void void
BNavigator::GoBackward(bool option) BNavigator::GoBackward(bool option)
{ {
@@ -247,6 +257,7 @@ BNavigator::GoBackward(bool option)
} }
} }
void void
BNavigator::GoForward(bool option) BNavigator::GoForward(bool option)
{ {
@@ -257,6 +268,7 @@ BNavigator::GoForward(bool option)
} }
} }
void void
BNavigator::GoUp(bool option) BNavigator::GoUp(bool option)
{ {
@@ -268,6 +280,7 @@ BNavigator::GoUp(bool option)
} }
} }
void void
BNavigator::SendNavigationMessage(NavigationAction action, BEntry* entry, bool option) BNavigator::SendNavigationMessage(NavigationAction action, BEntry* entry, bool option)
{ {
@@ -312,6 +325,7 @@ BNavigator::SendNavigationMessage(NavigationAction action, BEntry *entry, bool o
} }
} }
void void
BNavigator::GoTo() BNavigator::GoTo()
{ {
@@ -333,21 +347,20 @@ BNavigator::GoTo()
} else { } else {
BPath path; BPath path;
if (Window() if (Window() && Window()->TargetModel()) {
&& Window()->TargetModel()) {
Window()->TargetModel()->GetPath(&path); Window()->TargetModel()->GetPath(&path);
fLocation->SetText(path.Path()); fLocation->SetText(path.Path());
} }
} }
} }
void void
BNavigator::UpdateLocation(const Model* newmodel, int32 action) BNavigator::UpdateLocation(const Model* newmodel, int32 action)
{ {
if (newmodel) if (newmodel)
newmodel->GetPath(&fPath); newmodel->GetPath(&fPath);
// Modify history according to commands // Modify history according to commands
switch (action) { switch (action) {
case kActionBackward: case kActionBackward:
@@ -383,6 +396,7 @@ BNavigator::UpdateLocation(const Model *newmodel, int32 action)
fLocation->SetText(fPath.Path()); fLocation->SetText(fPath.Path());
} }
float float
BNavigator::CalcNavigatorHeight(void) BNavigator::CalcNavigatorHeight(void)
{ {
+8 -3
View File
@@ -34,11 +34,13 @@ All rights reserved.
#ifndef _NAVIGATOR_H_ #ifndef _NAVIGATOR_H_
#define _NAVIGATOR_H_ #define _NAVIGATOR_H_
#include "Model.h" #include "Model.h"
#include <PictureButton.h> #include <PictureButton.h>
#include <View.h> #include <View.h>
class BTextControl; class BTextControl;
class BEntry; class BEntry;
@@ -59,6 +61,7 @@ enum NavigationAction
kNavigatorCommandLocation = 'NVLC' kNavigatorCommandLocation = 'NVLC'
}; };
// Custom BPictureButton which takes // Custom BPictureButton which takes
// bitmap resource IDs as arguments // bitmap resource IDs as arguments
class BNavigatorButton : public BPictureButton { class BNavigatorButton : public BPictureButton {
@@ -78,9 +81,11 @@ private:
int32 fResIDDisabled; int32 fResIDDisabled;
}; };
class BNavigator : public BView { class BNavigator : public BView {
public: public:
BNavigator(const Model *model, BRect rect, uint32 resizeMask = B_FOLLOW_LEFT_RIGHT); BNavigator(const Model* model, BRect rect,
uint32 resizeMask = B_FOLLOW_LEFT_RIGHT);
~BNavigator(); ~BNavigator();
void UpdateLocation(const Model* newmodel, int32 action); void UpdateLocation(const Model* newmodel, int32 action);
@@ -102,7 +107,6 @@ protected:
void GoTo(); void GoTo();
private: private:
BPath fPath; BPath fPath;
BNavigatorButton* fBack; BNavigatorButton* fBack;
BNavigatorButton* fForw; BNavigatorButton* fForw;
@@ -115,6 +119,7 @@ private:
typedef BView _inherited; typedef BView _inherited;
}; };
inline inline
BContainerWindow* BContainerWindow*
BNavigator::Window() const BNavigator::Window() const
@@ -127,4 +132,4 @@ BNavigator::Window() const
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _NAVIGATOR_H_
+2 -2
View File
@@ -110,6 +110,7 @@ NodePreloader::MessageReceived(BMessage *message)
node_ref itemNode; node_ref itemNode;
switch (message->what) { switch (message->what) {
case B_NODE_MONITOR: case B_NODE_MONITOR:
{
switch (message->FindInt32("opcode")) { switch (message->FindInt32("opcode")) {
case B_ENTRY_REMOVED: case B_ENTRY_REMOVED:
{ {
@@ -144,6 +145,7 @@ NodePreloader::MessageReceived(BMessage *message)
} }
} }
break; break;
}
default: default:
_inherited::MessageReceived(message); _inherited::MessageReceived(message);
@@ -187,7 +189,6 @@ NodePreloader::PreloadOne(const char *dirPath)
} else } else
delete model; delete model;
} }
} }
@@ -218,4 +219,3 @@ NodePreloader::Preload()
fLock.Unlock(); fLock.Unlock();
} }
+3 -3
View File
@@ -42,15 +42,16 @@ All rights reserved.
// aliasing after a deletion, etc. // aliasing after a deletion, etc.
// //
// The node preloader knows which icons to preload // The node preloader knows which icons to preload
#ifndef __NODE_CACHE_PRELOADER__ #ifndef __NODE_CACHE_PRELOADER__
#define __NODE_CACHE_PRELOADER__ #define __NODE_CACHE_PRELOADER__
#include <Handler.h> #include <Handler.h>
#include "ObjectList.h" #include "ObjectList.h"
#include "Model.h" #include "Model.h"
namespace BPrivate { namespace BPrivate {
class NodePreloader : public BHandler { class NodePreloader : public BHandler {
@@ -70,7 +71,6 @@ private:
// for now just preload apps and prefs // for now just preload apps and prefs
Model* FindModel(node_ref) const; Model* FindModel(node_ref) const;
BObjectList<Model> fModelList; BObjectList<Model> fModelList;
Benaphore fLock; Benaphore fLock;
volatile bool fQuitRequested; volatile bool fQuitRequested;
@@ -82,4 +82,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __NODE_CACHE_PRELOADER__
+4 -5
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <Debug.h> #include <Debug.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -40,6 +41,7 @@ All rights reserved.
#include "NodeWalker.h" #include "NodeWalker.h"
namespace BTrackerPrivate { namespace BTrackerPrivate {
TWalker::~TWalker() TWalker::~TWalker()
@@ -484,11 +486,8 @@ TVolWalker::TVolWalker(bool knowsAttributes, bool writable, bool includeTopDirec
fKnowsAttr(knowsAttributes), fKnowsAttr(knowsAttributes),
fWritable(writable) fWritable(writable)
{ {
// Get things initialized. Find first volume, or find the first volume
/* // that supports attributes.
Get things initialized. Find first volume, or find the first volume
that supports attributes.
*/
NextVolume(); NextVolume();
} }
+5 -2
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef WALKER_H #ifndef WALKER_H
#define WALKER_H #define WALKER_H
#ifndef _BE_BUILD_H #ifndef _BE_BUILD_H
#include <BeBuild.h> #include <BeBuild.h>
#endif #endif
@@ -48,8 +48,8 @@ All rights reserved.
#include "ObjectList.h" #include "ObjectList.h"
namespace BTrackerPrivate {
namespace BTrackerPrivate {
class TWalker : public BEntryList { class TWalker : public BEntryList {
// adds a virtual destructor that is severely missing in BEntryList // adds a virtual destructor that is severely missing in BEntryList
@@ -66,6 +66,7 @@ public:
virtual int32 CountEntries() = 0; virtual int32 CountEntries() = 0;
}; };
class TNodeWalker : public TWalker { class TNodeWalker : public TWalker {
// TNodeWalker supports iterating a single volume, starting from a specified // TNodeWalker supports iterating a single volume, starting from a specified
// entry; if passed a non-directory entry it returns just that one entry // entry; if passed a non-directory entry it returns just that one entry
@@ -111,6 +112,7 @@ private:
// keep around to support Rewind // keep around to support Rewind
}; };
class TVolWalker : public TNodeWalker { class TVolWalker : public TNodeWalker {
// TNodeWalker supports iterating over all the mounted volumes; // TNodeWalker supports iterating over all the mounted volumes;
// non-attribute and read-only volumes may optionaly be filtered out // non-attribute and read-only volumes may optionaly be filtered out
@@ -143,6 +145,7 @@ private:
typedef TNodeWalker _inherited; typedef TNodeWalker _inherited;
}; };
class TQueryWalker : public TWalker { class TQueryWalker : public TWalker {
public: public:
TQueryWalker(const char* predicate); TQueryWalker(const char* predicate);
-1
View File
@@ -1685,4 +1685,3 @@ ConditionalAllAppsIterator::Iterate() const
{ {
return fParent->ShowAllApplications(); return fParent->ShowAllApplications();
} }
+11 -3
View File
@@ -31,10 +31,13 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _OPEN_WITH_WINDOW_H #ifndef _OPEN_WITH_WINDOW_H
#define _OPEN_WITH_WINDOW_H #define _OPEN_WITH_WINDOW_H
// OpenWithContainerWindow supports the Open With feature
#include <String.h> #include <String.h>
#include "ContainerWindow.h" #include "ContainerWindow.h"
@@ -45,12 +48,11 @@ All rights reserved.
#include "SlowMenu.h" #include "SlowMenu.h"
#include "Utilities.h" #include "Utilities.h"
namespace BPrivate { namespace BPrivate {
class OpenWithPoseView; class OpenWithPoseView;
// OpenWithContainerWindow supports the Open With feature
enum { enum {
kUnknownRelation = -1, kUnknownRelation = -1,
kNoRelation = 0, kNoRelation = 0,
@@ -61,6 +63,7 @@ enum {
kPreferredForFile kPreferredForFile
}; };
// pass in a predicate; a query will search for matches // pass in a predicate; a query will search for matches
// matches will be returned in iteration // matches will be returned in iteration
class SearchForSignatureEntryList : public EntryListBase { class SearchForSignatureEntryList : public EntryListBase {
@@ -127,6 +130,7 @@ class SearchForSignatureEntryList : public EntryListBase {
bool fFoundOneNonSuperHandler; bool fFoundOneNonSuperHandler;
}; };
class OpenWithContainerWindow : public BContainerWindow { class OpenWithContainerWindow : public BContainerWindow {
public: public:
OpenWithContainerWindow(BMessage* entriesToOpen, OpenWithContainerWindow(BMessage* entriesToOpen,
@@ -185,6 +189,7 @@ class OpenWithContainerWindow : public BContainerWindow {
typedef BContainerWindow _inherited; typedef BContainerWindow _inherited;
}; };
class OpenWithPoseView : public BPoseView { class OpenWithPoseView : public BPoseView {
public: public:
OpenWithPoseView(BRect, uint32 resizeMask = B_FOLLOW_ALL); OpenWithPoseView(BRect, uint32 resizeMask = B_FOLLOW_ALL);
@@ -249,6 +254,7 @@ class OpenWithPoseView : public BPoseView {
typedef BPoseView _inherited; typedef BPoseView _inherited;
}; };
class RelationCachingModelProxy { class RelationCachingModelProxy {
public: public:
RelationCachingModelProxy(Model* model); RelationCachingModelProxy(Model* model);
@@ -260,6 +266,7 @@ class RelationCachingModelProxy {
mutable int32 fRelation; mutable int32 fRelation;
}; };
class OpenWithMenu : public BSlowMenu { class OpenWithMenu : public BSlowMenu {
public: public:
OpenWithMenu(const char* label, const BMessage* entriesToOpen, OpenWithMenu(const char* label, const BMessage* entriesToOpen,
@@ -290,6 +297,7 @@ class OpenWithMenu : public BSlowMenu {
typedef BSlowMenu _inherited; typedef BSlowMenu _inherited;
}; };
// used for optionally showing the list of all apps. Do nothing // used for optionally showing the list of all apps. Do nothing
// until asked to iterate and only if supposed to do so // until asked to iterate and only if supposed to do so
class ConditionalAllAppsIterator : public EntryListBase { class ConditionalAllAppsIterator : public EntryListBase {
+7
View File
@@ -34,11 +34,13 @@ All rights reserved.
// defines the status area drawn in the bottom left corner of a Tracker window // defines the status area drawn in the bottom left corner of a Tracker window
#include <Button.h> #include <Button.h>
#include <Screen.h> #include <Screen.h>
#include "OverrideAlert.h" #include "OverrideAlert.h"
OverrideAlert::OverrideAlert(const char* title, const char* text, OverrideAlert::OverrideAlert(const char* title, const char* text,
const char* button1, uint32 modifiers1, const char* button1, uint32 modifiers1,
const char* button2, uint32 modifiers2, const char* button2, uint32 modifiers2,
@@ -56,6 +58,7 @@ OverrideAlert::OverrideAlert(const char *title, const char *text,
MoveTo(where.x, where.y); MoveTo(where.x, where.y);
} }
OverrideAlert::OverrideAlert(const char* title, const char* text, OverrideAlert::OverrideAlert(const char* title, const char* text,
const char* button1, uint32 modifiers1, const char* button1, uint32 modifiers1,
const char* button2, uint32 modifiers2, const char* button2, uint32 modifiers2,
@@ -73,10 +76,12 @@ OverrideAlert::OverrideAlert(const char *title, const char *text,
MoveTo(where.x, where.y); MoveTo(where.x, where.y);
} }
OverrideAlert::~OverrideAlert() OverrideAlert::~OverrideAlert()
{ {
} }
void void
OverrideAlert::DispatchMessage(BMessage* message, BHandler* handler) OverrideAlert::DispatchMessage(BMessage* message, BHandler* handler)
{ {
@@ -90,6 +95,7 @@ OverrideAlert::DispatchMessage(BMessage *message, BHandler *handler)
BAlert::DispatchMessage(message, handler); BAlert::DispatchMessage(message, handler);
} }
BPoint BPoint
OverrideAlert::OverPosition(float width, float height) OverrideAlert::OverPosition(float width, float height)
{ {
@@ -133,6 +139,7 @@ OverrideAlert::OverPosition(float width, float height)
return desirableRect.LeftTop(); return desirableRect.LeftTop();
} }
void void
OverrideAlert::UpdateButtons(uint32 modifiers, bool force) OverrideAlert::UpdateButtons(uint32 modifiers, bool force)
{ {
+3 -2
View File
@@ -31,7 +31,6 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _OVERRIDE_ALERT_H #ifndef _OVERRIDE_ALERT_H
#define _OVERRIDE_ALERT_H #define _OVERRIDE_ALERT_H
@@ -45,8 +44,10 @@ All rights reserved.
// This allows it to work when confirming rename operations with // This allows it to work when confirming rename operations with
// Focus Follows Mouse turned on. // Focus Follows Mouse turned on.
#include <Alert.h> #include <Alert.h>
namespace BPrivate { namespace BPrivate {
class OverrideAlert : public BAlert { class OverrideAlert : public BAlert {
@@ -80,4 +81,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _OVERRIDE_ALERT_H
+12 -2
View File
@@ -32,13 +32,16 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "PendingNodeMonitorCache.h" #include "PendingNodeMonitorCache.h"
#include "PoseView.h" #include "PoseView.h"
const bigtime_t kDelayedNodeMonitorLifetime = 10000000; const bigtime_t kDelayedNodeMonitorLifetime = 10000000;
// after this much the pending node monitor gets discarded as // after this much the pending node monitor gets discarded as
// too old // too old
PendingNodeMonitorEntry::PendingNodeMonitorEntry(const node_ref* node, PendingNodeMonitorEntry::PendingNodeMonitorEntry(const node_ref* node,
const BMessage* nodeMonitor) const BMessage* nodeMonitor)
: fExpiresAfter(system_time() + kDelayedNodeMonitorLifetime), : fExpiresAfter(system_time() + kDelayedNodeMonitorLifetime),
@@ -47,18 +50,21 @@ PendingNodeMonitorEntry::PendingNodeMonitorEntry(const node_ref *node,
{ {
} }
const BMessage* const BMessage*
PendingNodeMonitorEntry::NodeMonitor() const PendingNodeMonitorEntry::NodeMonitor() const
{ {
return &fNodeMonitor; return &fNodeMonitor;
} }
bool bool
PendingNodeMonitorEntry::Match(const node_ref* node) const PendingNodeMonitorEntry::Match(const node_ref* node) const
{ {
return fNode == *node; return fNode == *node;
} }
bool bool
PendingNodeMonitorEntry::TooOld(bigtime_t now) const PendingNodeMonitorEntry::TooOld(bigtime_t now) const
{ {
@@ -76,6 +82,7 @@ PendingNodeMonitorCache::~PendingNodeMonitorCache()
{ {
} }
void void
PendingNodeMonitorCache::Add(const BMessage* message) PendingNodeMonitorCache::Add(const BMessage* message)
{ {
@@ -91,6 +98,7 @@ PendingNodeMonitorCache::Add(const BMessage *message)
fList.AddItem(new PendingNodeMonitorEntry(&node, message)); fList.AddItem(new PendingNodeMonitorEntry(&node, message));
} }
void void
PendingNodeMonitorCache::RemoveEntries(const node_ref* nodeRef) PendingNodeMonitorCache::RemoveEntries(const node_ref* nodeRef)
{ {
@@ -100,6 +108,7 @@ PendingNodeMonitorCache::RemoveEntries(const node_ref *nodeRef)
delete fList.RemoveItemAt(index); delete fList.RemoveItemAt(index);
} }
void void
PendingNodeMonitorCache::RemoveOldEntries() PendingNodeMonitorCache::RemoveOldEntries()
{ {
@@ -112,8 +121,10 @@ PendingNodeMonitorCache::RemoveOldEntries()
} }
} }
void void
PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView *poseView, const BPose *pose) PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView* poseView,
const BPose* pose)
{ {
bigtime_t now = system_time(); bigtime_t now = system_time();
for (int32 index = 0; index < fList.CountItems();) { for (int32 index = 0; index < fList.CountItems();) {
@@ -136,4 +147,3 @@ PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView *poseView, const BPose *po
index++; index++;
} }
} }
+4 -3
View File
@@ -39,15 +39,16 @@ All rights reserved.
// The respective node montior messages are stored in a list and applied // The respective node montior messages are stored in a list and applied
// later, when their target shows up. They get nuked when they become too // later, when their target shows up. They get nuked when they become too
// old. // old.
#ifndef __PENDING_NODEMONITOR_CACHE_H__ #ifndef __PENDING_NODEMONITOR_CACHE_H__
#define __PENDING_NODEMONITOR_CACHE_H__ #define __PENDING_NODEMONITOR_CACHE_H__
#include <Message.h> #include <Message.h>
#include <Node.h> #include <Node.h>
#include "ObjectList.h" #include "ObjectList.h"
namespace BPrivate { namespace BPrivate {
class BPoseView; class BPoseView;
@@ -66,6 +67,7 @@ private:
node_ref fNode; node_ref fNode;
}; };
class PendingNodeMonitorCache { class PendingNodeMonitorCache {
public: public:
PendingNodeMonitorCache(); PendingNodeMonitorCache();
@@ -85,5 +87,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __PENDING_NODEMONITOR_CACHE_H__
+2 -3
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -68,7 +69,6 @@ CalcFreeSpace(BVolume *volume)
// symlink pose uses the resolved model to retrieve the icon, if not broken // symlink pose uses the resolved model to retrieve the icon, if not broken
// everything else, like the attributes, etc. is retrieved directly from the // everything else, like the attributes, etc. is retrieved directly from the
// symlink itself // symlink itself
BPose::BPose(Model* model, BPoseView* view, uint32 clipboardMode, bool selected) BPose::BPose(Model* model, BPoseView* view, uint32 clipboardMode, bool selected)
: fModel(model), : fModel(model),
fWidgetList(4, true), fWidgetList(4, true),
@@ -767,14 +767,13 @@ BPose::WidgetFor(BColumn *column, BPoseView *poseView, ModelNodeLazyOpener &open
} }
/* deprecated */ // the following method is deprecated
bool bool
BPose::TestLargeIconPixel(BPoint point) const BPose::TestLargeIconPixel(BPoint point) const
{ {
return IconCache::sIconCache->IconHitTest(point, ResolvedModel(), return IconCache::sIconCache->IconHitTest(point, ResolvedModel(),
kNormalIcon, B_LARGE_ICON); kNormalIcon, B_LARGE_ICON);
} }
/* deprecated */
void void
+5 -4
View File
@@ -31,16 +31,17 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _POSE_H #ifndef _POSE_H
#define _POSE_H #define _POSE_H
#include <Region.h> #include <Region.h>
#include "TextWidget.h" #include "TextWidget.h"
#include "Model.h" #include "Model.h"
#include "Utilities.h" #include "Utilities.h"
namespace BPrivate { namespace BPrivate {
class BPoseView; class BPoseView;
@@ -85,8 +86,8 @@ class BPose {
BTextWidget* ActiveWidget() const; BTextWidget* ActiveWidget() const;
BTextWidget* WidgetFor(uint32 hashAttr, int32* index = 0) const; BTextWidget* WidgetFor(uint32 hashAttr, int32* index = 0) const;
BTextWidget *WidgetFor(BColumn *column, BPoseView *poseView, ModelNodeLazyOpener &opener, BTextWidget* WidgetFor(BColumn* column, BPoseView* poseView,
int32 *index = NULL); ModelNodeLazyOpener &opener, int32* index = NULL);
// adds the widget if needed // adds the widget if needed
bool PointInPose(BPoint poseLoc, const BPoseView*, BPoint where, bool PointInPose(BPoint poseLoc, const BPoseView*, BPoint where,
@@ -258,4 +259,4 @@ BPose::SetClipboardMode(uint32 clipboardMode)
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _POSE_H
+7
View File
@@ -51,12 +51,14 @@ PoseList::FindPose(const node_ref *node, int32 *resultingIndex) const
if (*pose->TargetModel()->NodeRef() == *node) { if (*pose->TargetModel()->NodeRef() == *node) {
if (resultingIndex) if (resultingIndex)
*resultingIndex = index; *resultingIndex = index;
return pose; return pose;
} }
} }
return NULL; return NULL;
} }
BPose* BPose*
PoseList::FindPose(const entry_ref* entry, int32* resultingIndex) const PoseList::FindPose(const entry_ref* entry, int32* resultingIndex) const
{ {
@@ -67,18 +69,21 @@ PoseList::FindPose(const entry_ref *entry, int32 *resultingIndex) const
if (*pose->TargetModel()->EntryRef() == *entry) { if (*pose->TargetModel()->EntryRef() == *entry) {
if (resultingIndex) if (resultingIndex)
*resultingIndex = index; *resultingIndex = index;
return pose; return pose;
} }
} }
return NULL; return NULL;
} }
BPose* BPose*
PoseList::FindPose(const Model* model, int32* resultingIndex) const PoseList::FindPose(const Model* model, int32* resultingIndex) const
{ {
return FindPose(model->NodeRef(), resultingIndex); return FindPose(model->NodeRef(), resultingIndex);
} }
BPose* BPose*
PoseList::DeepFindPose(const node_ref* node, int32* resultingIndex) const PoseList::DeepFindPose(const node_ref* node, int32* resultingIndex) const
{ {
@@ -89,6 +94,7 @@ PoseList::DeepFindPose(const node_ref *node, int32 *resultingIndex) const
if (*model->NodeRef() == *node) { if (*model->NodeRef() == *node) {
if (resultingIndex) if (resultingIndex)
*resultingIndex = index; *resultingIndex = index;
return pose; return pose;
} }
// if model is a symlink, try matching node with the target // if model is a symlink, try matching node with the target
@@ -98,6 +104,7 @@ PoseList::DeepFindPose(const node_ref *node, int32 *resultingIndex) const
if (model && *model->NodeRef() == *node) { if (model && *model->NodeRef() == *node) {
if (resultingIndex) if (resultingIndex)
*resultingIndex = index; *resultingIndex = index;
return pose; return pose;
} }
} }
+8 -3
View File
@@ -31,16 +31,18 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _POSE_LIST_H
#define _POSE_LIST_H
// PoseList is a commonly used instance of BObjectList<BPose> // PoseList is a commonly used instance of BObjectList<BPose>
// Defines convenience find and iteration calls // Defines convenience find and iteration calls
#ifndef _POSE_LIST_H
#define _POSE_LIST_H
#include "ObjectList.h" #include "ObjectList.h"
#include "Pose.h" #include "Pose.h"
struct node_ref; struct node_ref;
struct entry_ref; struct entry_ref;
@@ -68,6 +70,7 @@ public:
// iteration glue, add permutations as needed // iteration glue, add permutations as needed
template<class EachParam1> template<class EachParam1>
void void
EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1), EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1),
@@ -81,6 +84,7 @@ EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, EachPara
} }
} }
template<class EachParam1> template<class EachParam1>
void void
EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, int32 , EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, int32 ,
@@ -94,6 +98,7 @@ EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, int32 ,
} }
} }
template<class EachParam1, class EachParam2> template<class EachParam1, class EachParam2>
void void
EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1, EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1,
@@ -176,4 +181,4 @@ EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *,
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _POSE_LIST_H
+5 -6
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "PoseView.h" #include "PoseView.h"
#include <algorithm> #include <algorithm>
@@ -149,13 +150,11 @@ const BPoint kTransparentDragThreshold(256, 192);
// maximum size of the transparent drag bitmap, use a drag rect // maximum size of the transparent drag bitmap, use a drag rect
// if larger in any direction // if larger in any direction
struct attr_column_relation { struct attr_column_relation {
uint32 attrHash; uint32 attrHash;
int32 fieldMask; int32 fieldMask;
}; };
static struct attr_column_relation sAttrColumnMap[] = { static struct attr_column_relation sAttrColumnMap[] = {
{ AttrHashString(kAttrStatModified, B_TIME_TYPE), { AttrHashString(kAttrStatModified, B_TIME_TYPE),
B_STAT_MODIFICATION_TIME }, B_STAT_MODIFICATION_TIME },
@@ -167,7 +166,6 @@ static struct attr_column_relation sAttrColumnMap[] = {
B_STAT_MODE } B_STAT_MODE }
}; };
struct AddPosesResult { struct AddPosesResult {
~AddPosesResult(); ~AddPosesResult();
void ReleaseModels(); void ReleaseModels();
@@ -7307,8 +7305,9 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList **oldList)
if (selectionRect.Intersects(poseRect)) { if (selectionRect.Intersects(poseRect)) {
bool selected = pose->IsSelected(); bool selected = pose->IsSelected();
pose->Select(!fSelectionList->HasItem(pose)); pose->Select(!fSelectionList->HasItem(pose));
newList->AddItem((void *)index); // this sucks, need to clean up newList->AddItem((void*)index);
// using a vector class instead of BList // this sucks, need to clean up using a vector class instead
// of BList
if ((selected != pose->IsSelected()) && poseRect.Intersects(bounds)) { if ((selected != pose->IsSelected()) && poseRect.Intersects(bounds)) {
Invalidate(poseRect); Invalidate(poseRect);
@@ -8468,7 +8467,7 @@ rgb_color
BPoseView::DeskTextColor() const BPoseView::DeskTextColor() const
{ {
rgb_color color = ViewColor(); rgb_color color = ViewColor();
float thresh = color.red + (color.green * 1.5f) + (color.blue * .50f); float thresh = color.red + (color.green * 1.5f) + (color.blue * 0.50f);
if (thresh >= 300) { if (thresh >= 300) {
color.red = 0; color.red = 0;
+4 -4
View File
@@ -31,16 +31,16 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _POSE_VIEW_H
#define _POSE_VIEW_H
//
// BPoseView is a container for poses, handling all of the interaction, drawing, // BPoseView is a container for poses, handling all of the interaction, drawing,
// etc. The three different view modes are handled here. // etc. The three different view modes are handled here.
// //
// this is by far the fattest Tracker class and over time will undergo a lot of // this is by far the fattest Tracker class and over time will undergo a lot of
// trimming // trimming
#ifndef _POSE_VIEW_H
#define _POSE_VIEW_H
#include "AttributeStream.h" #include "AttributeStream.h"
#include "ContainerWindow.h" #include "ContainerWindow.h"
@@ -1185,4 +1185,4 @@ WhileEachTextWidget(BPose *pose, BPoseView *poseView,
using namespace BPrivate; using namespace BPrivate;
#endif /* _POSE_VIEW_H */ #endif // _POSE_VIEW_H
+18 -4
View File
@@ -203,6 +203,7 @@ const property_info kPosesPropertyList[] = {
#endif #endif
status_t status_t
BPoseView::GetSupportedSuites(BMessage* _SCRIPTING_ONLY(data)) BPoseView::GetSupportedSuites(BMessage* _SCRIPTING_ONLY(data))
{ {
@@ -217,6 +218,7 @@ BPoseView::GetSupportedSuites(BMessage *_SCRIPTING_ONLY(data))
#endif #endif
} }
bool bool
BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message)) BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message))
{ {
@@ -271,15 +273,18 @@ BPoseView::HandleScriptingMessage(BMessage *_SCRIPTING_ONLY(message))
break; break;
} }
if (handled) if (handled) {
// done handling message, send a reply // done handling message, send a reply
message->SendReply(&reply); message->SendReply(&reply);
}
return handled; return handled;
#else #else
return false; return false;
#endif #endif
} }
bool bool
BPoseView::ExecuteProperty(BMessage* _SCRIPTING_ONLY(specifier), BPoseView::ExecuteProperty(BMessage* _SCRIPTING_ONLY(specifier),
int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property),
@@ -334,6 +339,7 @@ BPoseView::ExecuteProperty(BMessage *_SCRIPTING_ONLY(specifier),
#endif #endif
} }
bool bool
BPoseView::CreateProperty(BMessage* _SCRIPTING_ONLY(specifier), BMessage*, BPoseView::CreateProperty(BMessage* _SCRIPTING_ONLY(specifier), BMessage*,
int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property),
@@ -396,6 +402,7 @@ BPoseView::CreateProperty(BMessage *_SCRIPTING_ONLY(specifier), BMessage *,
#endif #endif
} }
bool bool
BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier), BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property),
@@ -498,6 +505,7 @@ BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier),
#endif #endif
} }
bool bool
BPoseView::CountProperty(BMessage*, int32, const char* _SCRIPTING_ONLY(property), BPoseView::CountProperty(BMessage*, int32, const char* _SCRIPTING_ONLY(property),
BMessage* _SCRIPTING_ONLY(reply)) BMessage* _SCRIPTING_ONLY(reply))
@@ -520,6 +528,7 @@ BPoseView::CountProperty(BMessage *, int32, const char *_SCRIPTING_ONLY(property
#endif #endif
} }
bool bool
BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier),
int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property),
@@ -588,12 +597,15 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier),
int32 count = fPoseList->CountItems(); int32 count = fPoseList->CountItems();
switch (form) { switch (form) {
case B_DIRECT_SPECIFIER: case B_DIRECT_SPECIFIER:
{
// return all entries of all poses in PoseView // return all entries of all poses in PoseView
for (int32 index = 0; index < count; index++) for (int32 index = 0; index < count; index++)
reply->AddRef("result", PoseAtIndex(index)->TargetModel()->EntryRef()); reply->AddRef("result", PoseAtIndex(index)->TargetModel()->EntryRef());
handled = true; handled = true;
break; break;
}
case B_INDEX_SPECIFIER: case B_INDEX_SPECIFIER:
{ {
// return entry at index // return entry at index
@@ -611,6 +623,7 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier),
handled = true; handled = true;
break; break;
} }
case kPreviousSpecifier: case kPreviousSpecifier:
case kNextSpecifier: case kNextSpecifier:
{ {
@@ -646,6 +659,7 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier),
#endif #endif
} }
bool bool
BPoseView::SetProperty(BMessage* _SCRIPTING_ONLY(message), BMessage*, BPoseView::SetProperty(BMessage* _SCRIPTING_ONLY(message), BMessage*,
int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property),
@@ -677,8 +691,7 @@ BPoseView::SetProperty(BMessage *_SCRIPTING_ONLY(message), BMessage *,
handled = true; handled = true;
break; break;
} }
} } // fall thru
// fall thru
case kPreviousSpecifier: case kPreviousSpecifier:
case kNextSpecifier: case kNextSpecifier:
{ {
@@ -721,6 +734,7 @@ BPoseView::SetProperty(BMessage *_SCRIPTING_ONLY(message), BMessage *,
#endif #endif
} }
BHandler* BHandler*
BPoseView::ResolveSpecifier(BMessage* _SCRIPTING_ONLY(message), BPoseView::ResolveSpecifier(BMessage* _SCRIPTING_ONLY(message),
int32 _SCRIPTING_ONLY(index), BMessage* _SCRIPTING_ONLY(specifier), int32 _SCRIPTING_ONLY(index), BMessage* _SCRIPTING_ONLY(specifier),
@@ -742,6 +756,7 @@ BPoseView::ResolveSpecifier(BMessage *_SCRIPTING_ONLY(message),
#endif #endif
} }
BPose* BPose*
BPoseView::FindPose(const entry_ref* _SCRIPTING_ONLY(ref), BPoseView::FindPose(const entry_ref* _SCRIPTING_ONLY(ref),
int32 _SCRIPTING_ONLY(specifierForm), int32* _SCRIPTING_ONLY(index)) const int32 _SCRIPTING_ONLY(specifierForm), int32* _SCRIPTING_ONLY(index)) const
@@ -761,4 +776,3 @@ BPoseView::FindPose(const entry_ref *_SCRIPTING_ONLY(ref),
return NULL; return NULL;
#endif #endif
} }
+3 -2
View File
@@ -31,12 +31,13 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __PUBLIC_COMMANDS__ #ifndef __PUBLIC_COMMANDS__
#define __PUBLIC_COMMANDS__ #define __PUBLIC_COMMANDS__
#include <SupportDefs.h> #include <SupportDefs.h>
// commands that may be issued to the tracker by other apps using messengers // commands that may be issued to the tracker by other apps using messengers
namespace BPrivate { namespace BPrivate {
@@ -56,4 +57,4 @@ const uint32 kFSClipboardChanges = 'TCch';
using namespace BPrivate; using namespace BPrivate;
#endif /* __PUBLIC_COMMANDS__ */ #endif // __PUBLIC_COMMANDS__
+1 -1
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <Catalog.h> #include <Catalog.h>
#include <Locale.h> #include <Locale.h>
#include <Menu.h> #include <Menu.h>
@@ -192,4 +193,3 @@ BQueryContainerWindow::ActiveOnDevice(dev_t device) const
{ {
return PoseView()->ActiveOnDevice(device); return PoseView()->ActiveOnDevice(device);
} }
+6 -5
View File
@@ -31,18 +31,19 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _QUERY_CONTAINER_WINDOW_H #ifndef _QUERY_CONTAINER_WINDOW_H
#define _QUERY_CONTAINER_WINDOW_H #define _QUERY_CONTAINER_WINDOW_H
#include "ContainerWindow.h"
namespace BPrivate {
// Container window specificaly used for displaying BQueryPoseViews // Container window specificaly used for displaying BQueryPoseViews
// Adds query window specific menus // Adds query window specific menus
#include "ContainerWindow.h"
namespace BPrivate {
#define kQueryTemplates "DefaultQueryTemplates" #define kQueryTemplates "DefaultQueryTemplates"
class BQueryPoseView; class BQueryPoseView;
@@ -75,4 +76,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _QUERY_CONTAINER_WINDOW_H
+21 -11
View File
@@ -31,6 +31,8 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "QueryPoseView.h" #include "QueryPoseView.h"
#include <new> #include <new>
@@ -280,7 +282,8 @@ BQueryPoseView::InitDirentIterator(const entry_ref *ref)
// calculate the time to trigger the query refresh - next midnight // calculate the time to trigger the query refresh - next midnight
time_t now = time(0); time_t now = time(0);
time_t nextMidnight = now + 60 * 60 * 24; // move ahead by a day time_t nextMidnight = now + 60 * 60 * 24;
// move ahead by a day
tm timeData; tm timeData;
localtime_r(&nextMidnight, &timeData); localtime_r(&nextMidnight, &timeData);
timeData.tm_sec = 0; timeData.tm_sec = 0;
@@ -288,7 +291,8 @@ BQueryPoseView::InitDirentIterator(const entry_ref *ref)
timeData.tm_hour = 0; timeData.tm_hour = 0;
nextMidnight = mktime(&timeData); nextMidnight = mktime(&timeData);
time_t nextHour = now + 60 * 60; // move ahead by a hour time_t nextHour = now + 60 * 60;
// move ahead by a hour
localtime_r(&nextHour, &timeData); localtime_r(&nextHour, &timeData);
timeData.tm_sec = 0; timeData.tm_sec = 0;
timeData.tm_min = 0; timeData.tm_min = 0;
@@ -297,7 +301,8 @@ BQueryPoseView::InitDirentIterator(const entry_ref *ref)
PRINT(("%ld minutes, %ld seconds till next hour\n", (nextHour - now) / 60, PRINT(("%ld minutes, %ld seconds till next hour\n", (nextHour - now) / 60,
(nextHour - now) % 60)); (nextHour - now) % 60));
time_t nextMinute = now + 60; // move ahead by a minute time_t nextMinute = now + 60;
// move ahead by a minute
localtime_r(&nextMinute, &timeData); localtime_r(&nextMinute, &timeData);
timeData.tm_sec = 0; timeData.tm_sec = 0;
nextMinute = mktime(&timeData); nextMinute = mktime(&timeData);
@@ -358,6 +363,7 @@ BQueryPoseView::SearchForType() const
BModelOpener opener(TargetModel()); BModelOpener opener(TargetModel());
BString buffer; BString buffer;
attr_info attrInfo; attr_info attrInfo;
// read the type of files we are looking for // read the type of files we are looking for
status_t status = TargetModel()->Node()->GetAttrInfo(kAttrQueryInitialMime, &attrInfo); status_t status = TargetModel()->Node()->GetAttrInfo(kAttrQueryInitialMime, &attrInfo);
if (status == B_OK) if (status == B_OK)
@@ -369,9 +375,9 @@ BQueryPoseView::SearchForType() const
const ShortMimeInfo* info = tracker->MimeTypes()->FindMimeType(buffer.String()); const ShortMimeInfo* info = tracker->MimeTypes()->FindMimeType(buffer.String());
if (info) if (info)
fSearchForMimeType = info->InternalName(); fSearchForMimeType = info->InternalName();
}
}
}
}
if (!fSearchForMimeType.Length()) if (!fSearchForMimeType.Length())
fSearchForMimeType = B_FILE_MIMETYPE; fSearchForMimeType = B_FILE_MIMETYPE;
} }
@@ -426,8 +432,9 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe
MoreOptionsStruct saveMoreOptions; MoreOptionsStruct saveMoreOptions;
if (ReadAttr(model->Node(), kAttrQueryMoreOptions, kAttrQueryMoreOptionsForeign, if (ReadAttr(model->Node(), kAttrQueryMoreOptions, kAttrQueryMoreOptionsForeign,
B_RAW_TYPE, 0, &saveMoreOptions, sizeof(MoreOptionsStruct), B_RAW_TYPE, 0, &saveMoreOptions, sizeof(MoreOptionsStruct),
&MoreOptionsStruct::EndianSwap) != kReadAttrFailed) &MoreOptionsStruct::EndianSwap) != kReadAttrFailed) {
fQueryListRep->fShowResultsFromTrash = saveMoreOptions.searchTrash; fQueryListRep->fShowResultsFromTrash = saveMoreOptions.searchTrash;
}
fStatus = query.SetPredicate(buffer.String()); fStatus = query.SetPredicate(buffer.String());
@@ -438,8 +445,9 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe
fQueryListRep->fRefreshEveryMinute = false; fQueryListRep->fRefreshEveryMinute = false;
if (model->Node()->ReadAttr(kAttrDynamicDateQuery, B_BOOL_TYPE, 0, if (model->Node()->ReadAttr(kAttrDynamicDateQuery, B_BOOL_TYPE, 0,
&fQueryListRep->fDynamicDateQuery, sizeof(bool)) != sizeof(bool)) &fQueryListRep->fDynamicDateQuery, sizeof(bool)) != sizeof(bool)) {
fQueryListRep->fDynamicDateQuery = false; fQueryListRep->fDynamicDateQuery = false;
}
if (fQueryListRep->fDynamicDateQuery) { if (fQueryListRep->fDynamicDateQuery) {
// only refresh every minute on debug builds // only refresh every minute on debug builds
@@ -483,7 +491,7 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe
continue; continue;
searchAllVolumes = false; searchAllVolumes = false;
} else if (result != B_DEV_BAD_DRIVE_NUM) } else if (result != B_DEV_BAD_DRIVE_NUM) {
// if B_DEV_BAD_DRIVE_NUM, the volume just isn't mounted this // if B_DEV_BAD_DRIVE_NUM, the volume just isn't mounted this
// time around, keep looking for more // time around, keep looking for more
// if other error, bail // if other error, bail
@@ -491,6 +499,7 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe
} }
} }
} }
}
free(buffer); free(buffer);
} }
@@ -503,7 +512,8 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe
roster.Rewind(); roster.Rewind();
while (roster.GetNextVolume(&volume) == B_OK) while (roster.GetNextVolume(&volume) == B_OK)
if (volume.IsPersistent() && volume.KnowsQuery()) { if (volume.IsPersistent() && volume.KnowsQuery()) {
result = FetchOneQuery(&query, target, fQueryListRep->fQueryList, &volume); result = FetchOneQuery(&query, target,
fQueryListRep->fQueryList, &volume);
if (result != B_OK) if (result != B_OK)
continue; continue;
} }
@@ -521,9 +531,9 @@ QueryEntryListCollection::FetchOneQuery(const BQuery *copyThis,
BQuery* query = new (nothrow) BQuery; BQuery* query = new (nothrow) BQuery;
if (query == NULL) if (query == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
// have to fake a copy constructor here because BQuery doesn't have // have to fake a copy constructor here because BQuery doesn't have
// a copy constructor // a copy constructor
BString buffer; BString buffer;
const_cast<BQuery*>(copyThis)->GetPredicate(&buffer); const_cast<BQuery*>(copyThis)->GetPredicate(&buffer);
query->SetPredicate(buffer.String()); query->SetPredicate(buffer.String());
@@ -537,6 +547,7 @@ QueryEntryListCollection::FetchOneQuery(const BQuery *copyThis,
delete query; delete query;
return result; return result;
} }
list->AddItem(query); list->AddItem(query);
return B_OK; return B_OK;
@@ -672,4 +683,3 @@ QueryEntryListCollection::DynamicDateRefreshEveryMinute() const
{ {
return fQueryListRep->fRefreshEveryMinute; return fQueryListRep->fRefreshEveryMinute;
} }
+4 -5
View File
@@ -31,15 +31,16 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _QUERY_POSE_VIEW_H #ifndef _QUERY_POSE_VIEW_H
#define _QUERY_POSE_VIEW_H #define _QUERY_POSE_VIEW_H
class BQuery;
#include "EntryIterator.h" #include "EntryIterator.h"
#include "PoseView.h" #include "PoseView.h"
class BQuery;
namespace BPrivate { namespace BPrivate {
class BQueryContainerWindow; class BQueryContainerWindow;
@@ -99,7 +100,6 @@ class QueryEntryListCollection : public EntryListBase {
// elements that behave as an EntryList // elements that behave as an EntryList
// For now just manage a list of BQueries // For now just manage a list of BQueries
class QueryListRep { class QueryListRep {
public: public:
QueryListRep(BObjectList<BQuery>* queryList) QueryListRep(BObjectList<BQuery>* queryList)
@@ -141,7 +141,6 @@ class QueryEntryListCollection : public EntryListBase {
}; };
public: public:
QueryEntryListCollection(Model*, BHandler* = NULL, PoseList* oldPoseList = NULL); QueryEntryListCollection(Model*, BHandler* = NULL, PoseList* oldPoseList = NULL);
virtual ~QueryEntryListCollection(); virtual ~QueryEntryListCollection();
@@ -180,4 +179,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _QUERY_POSE_VIEW_H
+28 -29
View File
@@ -31,19 +31,20 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __RECENT_ITEMS_LIST__ #ifndef __RECENT_ITEMS_LIST__
#define __RECENT_ITEMS_LIST__ #define __RECENT_ITEMS_LIST__
// BRecentItemsList classes allow creating an entire menu with
// recent files, folders, apps. If the user wishes to add items to
// their own menu, they can instead use the GetNextMenuItem call to
// get one menu at a time to add it to their app.
#include <Entry.h> #include <Entry.h>
#include <Message.h> #include <Message.h>
#include <String.h> #include <String.h>
/* BRecentItemsList classes allow creating an entire menu with
* recent files, folders, apps. If the user wishes to add items to
* their own menu, they can instead use the GetNextMenuItem call to
* get one menu at a time to add it to their app.
*/
class BMenuItem; class BMenuItem;
class BMenu; class BMenu;
@@ -51,27 +52,25 @@ class BMenu;
class BRecentItemsList { class BRecentItemsList {
public: public:
BRecentItemsList(int32 maxItems, bool navMenuFolders); BRecentItemsList(int32 maxItems, bool navMenuFolders);
/* if <navMenuFolders> passed, folder items get NavMenu-style // if <navMenuFolders> passed, folder items get NavMenu-style
* subdirectories attached to them // subdirectories attached to them
*/
virtual ~BRecentItemsList() {} virtual ~BRecentItemsList() {}
virtual void Rewind(); virtual void Rewind();
/* resets the iteration */ // resets the iteration
virtual BMenuItem* GetNextMenuItem(const BMessage* fileOpenMessage = NULL, virtual BMenuItem* GetNextMenuItem(const BMessage* fileOpenMessage = NULL,
const BMessage* containerOpenMessage = NULL, const BMessage* containerOpenMessage = NULL,
BHandler* target = NULL, entry_ref* currentItemRef = NULL); BHandler* target = NULL, entry_ref* currentItemRef = NULL);
/* if <fileOpenMessage> specified, the item for a file gets a copy with // if <fileOpenMessage> specified, the item for a file gets a copy with
* the item ref attached as "refs", otherwise a default B_REFS_RECEIVED // the item ref attached as "refs", otherwise a default B_REFS_RECEIVED
* message message gets attached // message message gets attached
* if <containerOpenMessage> specified, the item for a folder, volume or query // if <containerOpenMessage> specified, the item for a folder, volume or query
* gets a copy with the item ref attached as "refs", otherwise a default // gets a copy with the item ref attached as "refs", otherwise a default
* B_REFS_RECEIVED message message gets attached // B_REFS_RECEIVED message message gets attached
* if <currentItemRef> gets passed, the caller gets to look at the // if <currentItemRef> gets passed, the caller gets to look at the
* entry_ref corresponding to the item // entry_ref corresponding to the item
*/
virtual status_t GetNextRef(entry_ref*); virtual status_t GetNextRef(entry_ref*);
@@ -82,7 +81,6 @@ protected:
bool fNavMenuFolders; bool fNavMenuFolders;
private: private:
virtual void _r1(); virtual void _r1();
virtual void _r2(); virtual void _r2();
virtual void _r3(); virtual void _r3();
@@ -97,17 +95,17 @@ private:
uint32 _reserved[20]; uint32 _reserved[20];
}; };
class BRecentFilesList : public BRecentItemsList { class BRecentFilesList : public BRecentItemsList {
public: public:
// use one of the two constructors to set up next item iteration
/* use one of the two constructors to set up next item iteration */
BRecentFilesList(int32 maxItems = 10, bool navMenuFolders = false, BRecentFilesList(int32 maxItems = 10, bool navMenuFolders = false,
const char* ofType = NULL, const char* openedByAppSig = NULL); const char* ofType = NULL, const char* openedByAppSig = NULL);
BRecentFilesList(int32 maxItems, bool navMenuFolders, const char* ofTypeList[], BRecentFilesList(int32 maxItems, bool navMenuFolders, const char* ofTypeList[],
int32 ofTypeListCount, const char* openedByAppSig = NULL); int32 ofTypeListCount, const char* openedByAppSig = NULL);
virtual ~BRecentFilesList(); virtual ~BRecentFilesList();
/* use one of the two NewFileListMenu calls to get an entire menu */ // use one of the two NewFileListMenu calls to get an entire menu
static BMenu* NewFileListMenu(const char* title, static BMenu* NewFileListMenu(const char* title,
BMessage* openFileMessage = NULL, BMessage* openFolderMessage = NULL, BMessage* openFileMessage = NULL, BMessage* openFolderMessage = NULL,
BHandler* target = NULL, BHandler* target = NULL,
@@ -124,7 +122,6 @@ public:
virtual status_t GetNextRef(entry_ref*); virtual status_t GetNextRef(entry_ref*);
protected: protected:
BString fType; BString fType;
char** fTypes; char** fTypes;
int32 fTypeCount; int32 fTypeCount;
@@ -145,13 +142,14 @@ private:
uint32 _reserved[20]; uint32 _reserved[20];
}; };
class BRecentFoldersList : public BRecentItemsList { class BRecentFoldersList : public BRecentItemsList {
public: public:
/* use the constructor to set up next item iteration */ // use the constructor to set up next item iteration
BRecentFoldersList(int32 maxItems, bool navMenuFolders = false, BRecentFoldersList(int32 maxItems, bool navMenuFolders = false,
const char* openedByAppSig = NULL); const char* openedByAppSig = NULL);
/* use NewFolderListMenu to get an entire menu */ // use NewFolderListMenu to get an entire menu
static BMenu* NewFolderListMenu(const char* title, static BMenu* NewFolderListMenu(const char* title,
BMessage* openMessage = NULL, BHandler* target = NULL, BMessage* openMessage = NULL, BHandler* target = NULL,
int32 maxItems = 10, bool navMenuFolders = false, int32 maxItems = 10, bool navMenuFolders = false,
@@ -177,12 +175,13 @@ private:
uint32 _reserved[20]; uint32 _reserved[20];
}; };
class BRecentAppsList : public BRecentItemsList { class BRecentAppsList : public BRecentItemsList {
public: public:
/* use the constructor to set up next item iteration */ // use the constructor to set up next item iteration
BRecentAppsList(int32 maxItems); BRecentAppsList(int32 maxItems);
/* use NewFolderListMenu to get an entire menu */ // use NewFolderListMenu to get an entire menu
static BMenu* NewAppListMenu(const char* title, static BMenu* NewAppListMenu(const char* title,
BMessage* openMessage = NULL, BHandler* target = NULL, BMessage* openMessage = NULL, BHandler* target = NULL,
int32 maxItems = 10); int32 maxItems = 10);
@@ -204,4 +203,4 @@ private:
uint32 _reserved[20]; uint32 _reserved[20];
}; };
#endif #endif // __RECENT_ITEMS_LIST__
+37 -7
View File
@@ -61,6 +61,7 @@ All rights reserved.
// ALTERED VERSION: Adapted to ANSI C and C++ for the OpenTracker // ALTERED VERSION: Adapted to ANSI C and C++ for the OpenTracker
// project (www.opentracker.org), Jul 11, 2000. // project (www.opentracker.org), Jul 11, 2000.
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -69,6 +70,7 @@ All rights reserved.
#include "RegExp.h" #include "RegExp.h"
// The first byte of the regexp internal "program" is actually this magic // The first byte of the regexp internal "program" is actually this magic
// number; the start node begins in the second byte. // number; the start node begins in the second byte.
@@ -200,6 +202,7 @@ RegExp::RegExp()
{ {
} }
RegExp::RegExp(const char* pattern) RegExp::RegExp(const char* pattern)
: fError(B_OK), : fError(B_OK),
fRegExp(NULL) fRegExp(NULL)
@@ -207,6 +210,7 @@ RegExp::RegExp(const char *pattern)
fRegExp = Compile(pattern); fRegExp = Compile(pattern);
} }
RegExp::RegExp(const BString &pattern) RegExp::RegExp(const BString &pattern)
: fError(B_OK), : fError(B_OK),
fRegExp(NULL) fRegExp(NULL)
@@ -214,19 +218,20 @@ RegExp::RegExp(const BString &pattern)
fRegExp = Compile(pattern.String()); fRegExp = Compile(pattern.String());
} }
RegExp::~RegExp() RegExp::~RegExp()
{ {
free(fRegExp); free(fRegExp);
} }
status_t status_t
RegExp::InitCheck() const RegExp::InitCheck() const
{ {
return fError; return fError;
} }
status_t status_t
RegExp::SetTo(const char* pattern) RegExp::SetTo(const char* pattern)
{ {
@@ -236,6 +241,7 @@ RegExp::SetTo(const char *pattern)
return fError; return fError;
} }
status_t status_t
RegExp::SetTo(const BString &pattern) RegExp::SetTo(const BString &pattern)
{ {
@@ -245,6 +251,7 @@ RegExp::SetTo(const BString &pattern)
return fError; return fError;
} }
bool bool
RegExp::Matches(const char* string) const RegExp::Matches(const char* string) const
{ {
@@ -254,6 +261,7 @@ RegExp::Matches(const char *string) const
return RunMatcher(fRegExp, string) == 1; return RunMatcher(fRegExp, string) == 1;
} }
bool bool
RegExp::Matches(const BString &string) const RegExp::Matches(const BString &string) const
{ {
@@ -278,7 +286,6 @@ RegExp::Matches(const BString &string) const
// //
// Beware that the optimization-preparation code in here knows about some // Beware that the optimization-preparation code in here knows about some
// of the structure of the compiled regexp. // of the structure of the compiled regexp.
regexp* regexp*
RegExp::Compile(const char* exp) RegExp::Compile(const char* exp)
{ {
@@ -308,8 +315,8 @@ RegExp::Compile(const char *exp)
return NULL; return NULL;
} }
// Allocate space.
r = (regexp*)malloc(sizeof(regexp) + fCodeSize); r = (regexp*)malloc(sizeof(regexp) + fCodeSize);
// Allocate space
if (!r) { if (!r) {
SetError(B_NO_MEMORY); SetError(B_NO_MEMORY);
@@ -331,8 +338,10 @@ RegExp::Compile(const char *exp)
r->reganch = 0; r->reganch = 0;
r->regmust = NULL; r->regmust = NULL;
r->regmlen = 0; r->regmlen = 0;
scan = r->program + 1; // First kRegExpBranch. scan = r->program + 1;
if (*Next((char *)scan) == kRegExpEnd) { // Only one top-level choice. // First kRegExpBranch.
if (*Next((char*)scan) == kRegExpEnd) {
// Only one top-level choice.
scan = Operand(scan); scan = Operand(scan);
// Starting-point info. // Starting-point info.
@@ -341,14 +350,12 @@ RegExp::Compile(const char *exp)
else if (*scan == kRegExpBol) else if (*scan == kRegExpBol)
r->reganch++; r->reganch++;
//
// If there's something expensive in the r.e., find the // If there's something expensive in the r.e., find the
// longest literal string that must appear and make it the // longest literal string that must appear and make it the
// regmust. Resolve ties in favor of later strings, since // regmust. Resolve ties in favor of later strings, since
// the regstart check works with the beginning of the r.e. // the regstart check works with the beginning of the r.e.
// and avoiding duplication strengthens checking. Not a // and avoiding duplication strengthens checking. Not a
// strong reason, but sufficient in the absence of others. // strong reason, but sufficient in the absence of others.
//
if (flags&kSPStart) { if (flags&kSPStart) {
longest = NULL; longest = NULL;
len = 0; len = 0;
@@ -365,12 +372,14 @@ RegExp::Compile(const char *exp)
return r; return r;
} }
regexp* regexp*
RegExp::Expression() const RegExp::Expression() const
{ {
return fRegExp; return fRegExp;
} }
const char* const char*
RegExp::ErrorString() const RegExp::ErrorString() const
{ {
@@ -469,6 +478,7 @@ RegExp::Reg(int32 paren, int32 *flagp)
return ret; return ret;
} }
// //
// - Branch - one alternative of an | operator // - Branch - one alternative of an | operator
// //
@@ -505,6 +515,7 @@ RegExp::Branch(int32 *flagp)
return ret; return ret;
} }
// //
// - Piece - something followed by possible [*+?] // - Piece - something followed by possible [*+?]
// //
@@ -572,6 +583,7 @@ RegExp::Piece(int32 *flagp)
return ret; return ret;
} }
// //
// - Atom - the lowest level // - Atom - the lowest level
// //
@@ -695,6 +707,7 @@ RegExp::Atom(int32 *flagp)
return ret; return ret;
} }
// //
// - Node - emit a node // - Node - emit a node
// //
@@ -719,6 +732,7 @@ RegExp::Node(char op)
return ret; return ret;
} }
// //
// - Char - emit (if appropriate) a byte of code // - Char - emit (if appropriate) a byte of code
// //
@@ -731,6 +745,7 @@ RegExp::Char(char b)
fCodeSize++; fCodeSize++;
} }
// //
// - Insert - insert an operator in front of already-emitted operand // - Insert - insert an operator in front of already-emitted operand
// //
@@ -760,6 +775,7 @@ RegExp::Insert(char op, char *opnd)
*place++ = '\0'; *place++ = '\0';
} }
// //
// - Tail - set the next-pointer at the end of a node chain // - Tail - set the next-pointer at the end of a node chain
// //
@@ -791,6 +807,7 @@ RegExp::Tail(char *p, char *val)
scan[2] = (char)(offset & 0377); scan[2] = (char)(offset & 0377);
} }
// //
// - OpTail - Tail on operand of first argument; nop if operandless // - OpTail - Tail on operand of first argument; nop if operandless
// //
@@ -807,6 +824,7 @@ RegExp::OpTail(char *p, char *val)
// RunMatcher and friends // RunMatcher and friends
// //
// //
// - RunMatcher - match a regexp against a string // - RunMatcher - match a regexp against a string
// //
@@ -866,6 +884,7 @@ RegExp::RunMatcher(regexp *prog, const char *string) const
return 0; return 0;
} }
// //
// - Try - try match at specific point // - Try - try match at specific point
// //
@@ -894,6 +913,7 @@ RegExp::Try(regexp *prog, const char *string) const
return 0; return 0;
} }
// //
// - Match - main matching routine // - Match - main matching routine
// //
@@ -1092,6 +1112,7 @@ RegExp::Match(const char *prog) const
return 0; return 0;
} }
// //
// - Repeat - repeatedly match something simple, report how many // - Repeat - repeatedly match something simple, report how many
// //
@@ -1141,6 +1162,7 @@ RegExp::Repeat(const char *p) const
return count; return count;
} }
// //
// - Next - dig the "next" pointer out of a node // - Next - dig the "next" pointer out of a node
// //
@@ -1162,6 +1184,7 @@ RegExp::Next(char *p)
return p + offset; return p + offset;
} }
const char* const char*
RegExp::Next(const char* p) const RegExp::Next(const char* p) const
{ {
@@ -1180,24 +1203,28 @@ RegExp::Next(const char *p) const
return p + offset; return p + offset;
} }
inline int32 inline int32
RegExp::UCharAt(const char* p) const RegExp::UCharAt(const char* p) const
{ {
return (int32)*(unsigned char *)p; return (int32)*(unsigned char *)p;
} }
inline char* inline char*
RegExp::Operand(char* p) const RegExp::Operand(char* p) const
{ {
return p + 3; return p + 3;
} }
inline const char* inline const char*
RegExp::Operand(const char* p) const RegExp::Operand(const char* p) const
{ {
return p + 3; return p + 3;
} }
inline bool inline bool
RegExp::IsMult(char c) const RegExp::IsMult(char c) const
{ {
@@ -1207,6 +1234,7 @@ RegExp::IsMult(char c) const
#ifdef DEBUG #ifdef DEBUG
// //
// - Dump - dump a regexp onto stdout in vaguely comprehensible form // - Dump - dump a regexp onto stdout in vaguely comprehensible form
// //
@@ -1248,6 +1276,7 @@ RegExp::Dump()
printf("\n"); printf("\n");
} }
// //
// - Prop - printable representation of opcode // - Prop - printable representation of opcode
// //
@@ -1331,6 +1360,7 @@ RegExp::Prop(const char *op) const
return buf; return buf;
} }
void void
RegExp::RegExpError(const char*) const RegExp::RegExpError(const char*) const
{ {
+16 -14
View File
@@ -31,6 +31,8 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _REG_EXP_H
#define _REG_EXP_H
// This code is based on regexp.c, v.1.3 by Henry Spencer: // This code is based on regexp.c, v.1.3 by Henry Spencer:
@@ -62,13 +64,13 @@ All rights reserved.
// ALTERED VERSION: Adapted to ANSI C and C++ for the OpenTracker // ALTERED VERSION: Adapted to ANSI C and C++ for the OpenTracker
// project (www.opentracker.org), Jul 11, 2000. // project (www.opentracker.org), Jul 11, 2000.
#ifndef _REG_EXP_H
#define _REG_EXP_H
#include <String.h> #include <String.h>
namespace BPrivate { namespace BPrivate {
enum { enum {
REGEXP_UNMATCHED_PARENTHESIS = B_ERRORS_END, REGEXP_UNMATCHED_PARENTHESIS = B_ERRORS_END,
REGEXP_TOO_BIG, REGEXP_TOO_BIG,
@@ -92,15 +94,15 @@ const int32 kSubExpressionMax = 10;
struct regexp { struct regexp {
const char* startp[kSubExpressionMax]; const char* startp[kSubExpressionMax];
const char* endp[kSubExpressionMax]; const char* endp[kSubExpressionMax];
char regstart; /* Internal use only. See RegExp.cpp for details. */ char regstart; // Internal use only. See RegExp.cpp for details.
char reganch; /* Internal use only. */ char reganch; // Internal use only.
const char *regmust;/* Internal use only. */ const char* regmust;// Internal use only.
int regmlen; /* Internal use only. */ int regmlen; // Internal use only.
char program[1]; /* Unwarranted chumminess with compiler. */ char program[1]; // Unwarranted chumminess with compiler.
}; };
class RegExp {
class RegExp {
public: public:
RegExp(); RegExp();
RegExp(const char*); RegExp(const char*);
@@ -125,7 +127,6 @@ public:
#endif #endif
private: private:
void SetError(status_t error) const; void SetError(status_t error) const;
// Working functions for Compile(): // Working functions for Compile():
@@ -162,23 +163,24 @@ private:
regexp* fRegExp; regexp* fRegExp;
// Work variables for Compile(). // Work variables for Compile().
const char* fInputScanPointer; const char* fInputScanPointer;
int32 fParenthesisCount; int32 fParenthesisCount;
char fDummy; char fDummy;
char *fCodeEmitPointer; // &fDummy = don't. char* fCodeEmitPointer;
// &fDummy = don't.
long fCodeSize; long fCodeSize;
// Work variables for RunMatcher(). // Work variables for RunMatcher().
mutable const char* fStringInputPointer; mutable const char* fStringInputPointer;
mutable const char *fRegBol; // Beginning of input, for ^ check. mutable const char* fRegBol;
// Beginning of input, for ^ check.
mutable const char** fStartPArrayPointer; mutable const char** fStartPArrayPointer;
mutable const char** fEndPArrayPointer; mutable const char** fEndPArrayPointer;
}; };
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _REG_EXP_H
+3 -2
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _SELECTION_WINDOW_H #ifndef _SELECTION_WINDOW_H
#define _SELECTION_WINDOW_H #define _SELECTION_WINDOW_H
#include <Button.h> #include <Button.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <MenuField.h> #include <MenuField.h>
@@ -44,6 +44,7 @@ All rights reserved.
#include "TrackerString.h" #include "TrackerString.h"
namespace BPrivate { namespace BPrivate {
class BContainerWindow; class BContainerWindow;
@@ -78,4 +79,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _SELECTION_WINDOW_H
+38 -4
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <Debug.h> #include <Debug.h>
#include <string.h> #include <string.h>
@@ -40,6 +41,7 @@ All rights reserved.
#include "TrackerSettings.h" #include "TrackerSettings.h"
Settings* settings = NULL; Settings* settings = NULL;
// generic setting handler classes // generic setting handler classes
@@ -54,28 +56,33 @@ StringValueSetting::StringValueSetting(const char *name, const char *defaultValu
{ {
} }
StringValueSetting::~StringValueSetting() StringValueSetting::~StringValueSetting()
{ {
} }
void void
StringValueSetting::ValueChanged(const char* newValue) StringValueSetting::ValueChanged(const char* newValue)
{ {
fValue = newValue; fValue = newValue;
} }
const char* const char*
StringValueSetting::Value() const StringValueSetting::Value() const
{ {
return fValue.String(); return fValue.String();
} }
void void
StringValueSetting::SaveSettingValue(Settings* settings) StringValueSetting::SaveSettingValue(Settings* settings)
{ {
settings->Write("\"%s\"", fValue.String()); settings->Write("\"%s\"", fValue.String());
} }
bool bool
StringValueSetting::NeedsSaving() const StringValueSetting::NeedsSaving() const
{ {
@@ -83,6 +90,7 @@ StringValueSetting::NeedsSaving() const
return fValue != fDefaultValue; return fValue != fDefaultValue;
} }
const char* const char*
StringValueSetting::Handle(const char* const* argv) StringValueSetting::Handle(const char* const* argv)
{ {
@@ -93,16 +101,20 @@ StringValueSetting::Handle(const char *const *argv)
return 0; return 0;
} }
// #pragma mark - // #pragma mark -
EnumeratedStringValueSetting::EnumeratedStringValueSetting(const char* name, EnumeratedStringValueSetting::EnumeratedStringValueSetting(const char* name,
const char *defaultValue, const char *const *values, const char *valueExpectedErrorString, const char* defaultValue, const char* const* values,
const char *wrongValueErrorString) const char* valueExpectedErrorString, const char* wrongValueErrorString)
: StringValueSetting(name, defaultValue, valueExpectedErrorString, wrongValueErrorString), : StringValueSetting(name, defaultValue, valueExpectedErrorString,
wrongValueErrorString),
fValues(values) fValues(values)
{ {
} }
void void
EnumeratedStringValueSetting::ValueChanged(const char* newValue) EnumeratedStringValueSetting::ValueChanged(const char* newValue)
{ {
@@ -112,8 +124,10 @@ EnumeratedStringValueSetting::ValueChanged(const char *newValue)
for (int32 index = 0; ; index++) { for (int32 index = 0; ; index++) {
if (!fValues[index]) if (!fValues[index])
break; break;
if (strcmp(fValues[index], newValue) != 0) if (strcmp(fValues[index], newValue) != 0)
continue; continue;
found = true; found = true;
break; break;
} }
@@ -122,6 +136,7 @@ EnumeratedStringValueSetting::ValueChanged(const char *newValue)
StringValueSetting::ValueChanged(newValue); StringValueSetting::ValueChanged(newValue);
} }
const char* const char*
EnumeratedStringValueSetting::Handle(const char* const* argv) EnumeratedStringValueSetting::Handle(const char* const* argv)
{ {
@@ -132,8 +147,10 @@ EnumeratedStringValueSetting::Handle(const char *const *argv)
for (int32 index = 0; ; index++) { for (int32 index = 0; ; index++) {
if (!fValues[index]) if (!fValues[index])
break; break;
if (strcmp(fValues[index], *argv) != 0) if (strcmp(fValues[index], *argv) != 0)
continue; continue;
found = true; found = true;
break; break;
} }
@@ -145,8 +162,10 @@ EnumeratedStringValueSetting::Handle(const char *const *argv)
return 0; return 0;
} }
// #pragma mark - // #pragma mark -
ScalarValueSetting::ScalarValueSetting(const char* name, int32 defaultValue, ScalarValueSetting::ScalarValueSetting(const char* name, int32 defaultValue,
const char* valueExpectedErrorString, const char* wrongValueErrorString, const char* valueExpectedErrorString, const char* wrongValueErrorString,
int32 min, int32 max) int32 min, int32 max)
@@ -160,6 +179,7 @@ ScalarValueSetting::ScalarValueSetting(const char *name, int32 defaultValue,
{ {
} }
void void
ScalarValueSetting::ValueChanged(int32 newValue) ScalarValueSetting::ValueChanged(int32 newValue)
{ {
@@ -168,18 +188,21 @@ ScalarValueSetting::ValueChanged(int32 newValue)
fValue = newValue; fValue = newValue;
} }
int32 int32
ScalarValueSetting::Value() const ScalarValueSetting::Value() const
{ {
return fValue; return fValue;
} }
void void
ScalarValueSetting::GetValueAsString(char* buffer) const ScalarValueSetting::GetValueAsString(char* buffer) const
{ {
sprintf(buffer, "%ld", fValue); sprintf(buffer, "%ld", fValue);
} }
const char* const char*
ScalarValueSetting::Handle(const char* const* argv) ScalarValueSetting::Handle(const char* const* argv)
{ {
@@ -199,20 +222,24 @@ ScalarValueSetting::Handle(const char *const *argv)
return NULL; return NULL;
} }
void void
ScalarValueSetting::SaveSettingValue(Settings* settings) ScalarValueSetting::SaveSettingValue(Settings* settings)
{ {
settings->Write("%ld", fValue); settings->Write("%ld", fValue);
} }
bool bool
ScalarValueSetting::NeedsSaving() const ScalarValueSetting::NeedsSaving() const
{ {
return fValue != fDefaultValue; return fValue != fDefaultValue;
} }
// #pragma mark - // #pragma mark -
HexScalarValueSetting::HexScalarValueSetting(const char* name, int32 defaultValue, HexScalarValueSetting::HexScalarValueSetting(const char* name, int32 defaultValue,
const char* valueExpectedErrorString, const char* wrongValueErrorString, const char* valueExpectedErrorString, const char* wrongValueErrorString,
int32 min, int32 max) int32 min, int32 max)
@@ -221,37 +248,44 @@ HexScalarValueSetting::HexScalarValueSetting(const char *name, int32 defaultValu
{ {
} }
void void
HexScalarValueSetting::GetValueAsString(char* buffer) const HexScalarValueSetting::GetValueAsString(char* buffer) const
{ {
sprintf(buffer, "0x%08lx", fValue); sprintf(buffer, "0x%08lx", fValue);
} }
void void
HexScalarValueSetting::SaveSettingValue(Settings* settings) HexScalarValueSetting::SaveSettingValue(Settings* settings)
{ {
settings->Write("0x%08lx", fValue); settings->Write("0x%08lx", fValue);
} }
// #pragma mark - // #pragma mark -
BooleanValueSetting::BooleanValueSetting(const char* name, bool defaultValue) BooleanValueSetting::BooleanValueSetting(const char* name, bool defaultValue)
: ScalarValueSetting(name, defaultValue, 0, 0) : ScalarValueSetting(name, defaultValue, 0, 0)
{ {
} }
bool bool
BooleanValueSetting::Value() const BooleanValueSetting::Value() const
{ {
return fValue != 0; return fValue != 0;
} }
void void
BooleanValueSetting::SetValue(bool value) BooleanValueSetting::SetValue(bool value)
{ {
fValue = value; fValue = value;
} }
const char* const char*
BooleanValueSetting::Handle(const char* const* argv) BooleanValueSetting::Handle(const char* const* argv)
{ {
@@ -268,9 +302,9 @@ BooleanValueSetting::Handle(const char *const *argv)
return 0; return 0;
} }
void void
BooleanValueSetting::SaveSettingValue(Settings* settings) BooleanValueSetting::SaveSettingValue(Settings* settings)
{ {
settings->Write(fValue ? "on" : "off"); settings->Write(fValue ? "on" : "off");
} }
+3 -2
View File
@@ -31,13 +31,14 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _SETTINGS_H_ #ifndef _SETTINGS_H_
#define _SETTINGS_H_ #define _SETTINGS_H_
#include <String.h> #include <String.h>
#include "SettingsHandler.h" #include "SettingsHandler.h"
namespace BPrivate { namespace BPrivate {
extern Settings* settings; extern Settings* settings;
@@ -135,4 +136,4 @@ protected:
using namespace BPrivate; using namespace BPrivate;
#endif /* _SETTINGS_H_ */ #endif // _SETTINGS_H_
+32 -3
View File
@@ -84,6 +84,7 @@ ArgvParser::~ArgvParser()
fclose(fFile); fclose(fFile);
} }
void void
ArgvParser::MakeArgvEmpty() ArgvParser::MakeArgvEmpty()
{ {
@@ -94,6 +95,7 @@ ArgvParser::MakeArgvEmpty()
fArgc = 0; fArgc = 0;
} }
status_t status_t
ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru) ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru)
{ {
@@ -111,6 +113,7 @@ ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void *passThru)
return B_OK; return B_OK;
} }
void void
ArgvParser::NextArgv() ArgvParser::NextArgv()
{ {
@@ -128,6 +131,7 @@ ArgvParser::NextArgv()
fArgc++; fArgc++;
} }
void void
ArgvParser::NextArgvIfNotEmpty() ArgvParser::NextArgvIfNotEmpty()
{ {
@@ -137,6 +141,7 @@ ArgvParser::NextArgvIfNotEmpty()
NextArgv(); NextArgv();
} }
char char
ArgvParser::GetCh() ArgvParser::GetCh()
{ {
@@ -150,15 +155,19 @@ ArgvParser::GetCh()
return fBuffer[fPos++]; return fBuffer[fPos++];
} }
status_t status_t
ArgvParser::EachArgv(const char *name, ArgvHandler argvHandlerFunc, void *passThru) ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc,
void* passThru)
{ {
ArgvParser parser(name); ArgvParser parser(name);
return parser.EachArgvPrivate(name, argvHandlerFunc, passThru); return parser.EachArgvPrivate(name, argvHandlerFunc, passThru);
} }
status_t status_t
ArgvParser::EachArgvPrivate(const char *name, ArgvHandler argvHandlerFunc, void *passThru) ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
void* passThru)
{ {
status_t result; status_t result;
@@ -183,11 +192,13 @@ ArgvParser::EachArgvPrivate(const char *name, ArgvHandler argvHandlerFunc, void
result = B_ERROR; result = B_ERROR;
break; break;
} }
fLineNo++; fLineNo++;
if (fSawBackslash) { if (fSawBackslash) {
fSawBackslash = false; fSawBackslash = false;
continue; continue;
} }
// end of line, flush all argv // end of line, flush all argv
result = SendArgv(argvHandlerFunc, passThru); result = SendArgv(argvHandlerFunc, passThru);
@@ -246,6 +257,7 @@ SettingsArgvDispatcher::SettingsArgvDispatcher(const char *name)
{ {
} }
void void
SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault) SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault)
{ {
@@ -256,6 +268,7 @@ SettingsArgvDispatcher::SaveSettings(Settings *settings, bool onlyIfNonDefault)
} }
} }
bool bool
SettingsArgvDispatcher::HandleRectValue(BRect &result, const char* const* argv, SettingsArgvDispatcher::HandleRectValue(BRect &result, const char* const* argv,
bool printError) bool printError)
@@ -266,27 +279,32 @@ SettingsArgvDispatcher::HandleRectValue(BRect &result, const char *const *argv,
return false; return false;
} }
result.left = atoi(*argv); result.left = atoi(*argv);
if (!*++argv) { if (!*++argv) {
if (printError) if (printError)
printf("rect top expected"); printf("rect top expected");
return false; return false;
} }
result.top = atoi(*argv); result.top = atoi(*argv);
if (!*++argv) { if (!*++argv) {
if (printError) if (printError)
printf("rect right expected"); printf("rect right expected");
return false; return false;
} }
result.right = atoi(*argv); result.right = atoi(*argv);
if (!*++argv) { if (!*++argv) {
if (printError) if (printError)
printf("rect bottom expected"); printf("rect bottom expected");
return false; return false;
} }
result.bottom = atoi(*argv); result.bottom = atoi(*argv);
return true; return true;
} }
void void
SettingsArgvDispatcher::WriteRectValue(Settings* setting, BRect rect) SettingsArgvDispatcher::WriteRectValue(Settings* setting, BRect rect)
{ {
@@ -294,6 +312,7 @@ SettingsArgvDispatcher::WriteRectValue(Settings *setting, BRect rect)
(int32)rect.right, (int32)rect.bottom); (int32)rect.right, (int32)rect.bottom);
} }
Settings::Settings(const char* filename, const char* settingsDirName) Settings::Settings(const char* filename, const char* settingsDirName)
: fFileName(filename), : fFileName(filename),
fSettingsDir(settingsDirName), fSettingsDir(settingsDirName),
@@ -302,7 +321,8 @@ Settings::Settings(const char *filename, const char *settingsDirName)
fListSize(30), fListSize(30),
fCurrentSettings(0) fCurrentSettings(0)
{ {
fList = (SettingsArgvDispatcher **)calloc((size_t)fListSize, sizeof(SettingsArgvDispatcher *)); fList = (SettingsArgvDispatcher**)calloc((size_t)fListSize,
sizeof(SettingsArgvDispatcher*));
} }
@@ -324,9 +344,11 @@ Settings::ParseUserSettings(int, const char *const *argv, void *castToThis)
SettingsArgvDispatcher* handler = ((Settings*)castToThis)->Find(*argv); SettingsArgvDispatcher* handler = ((Settings*)castToThis)->Find(*argv);
if (!handler) if (!handler)
return "unknown command"; return "unknown command";
return handler->Handle(argv); return handler->Handle(argv);
} }
bool bool
Settings::Add(SettingsArgvDispatcher* setting) Settings::Add(SettingsArgvDispatcher* setting)
{ {
@@ -343,6 +365,7 @@ Settings::Add(SettingsArgvDispatcher *setting)
return true; return true;
} }
SettingsArgvDispatcher* SettingsArgvDispatcher*
Settings::Find(const char* name) Settings::Find(const char* name)
{ {
@@ -353,6 +376,7 @@ Settings::Find(const char *name)
return NULL; return NULL;
} }
void void
Settings::TryReadingSettings() Settings::TryReadingSettings()
{ {
@@ -366,12 +390,14 @@ Settings::TryReadingSettings()
} }
} }
void void
Settings::SaveSettings(bool onlyIfNonDefault) Settings::SaveSettings(bool onlyIfNonDefault)
{ {
SaveCurrentSettings(onlyIfNonDefault); SaveCurrentSettings(onlyIfNonDefault);
} }
void void
Settings::MakeSettingsDirectory(BDirectory* resultingSettingsDir) Settings::MakeSettingsDirectory(BDirectory* resultingSettingsDir)
{ {
@@ -398,6 +424,7 @@ Settings::MakeSettingsDirectory(BDirectory *resultingSettingsDir)
resultingSettingsDir->SetTo(path.Path()); resultingSettingsDir->SetTo(path.Path());
} }
void void
Settings::SaveCurrentSettings(bool onlyIfNonDefault) Settings::SaveCurrentSettings(bool onlyIfNonDefault)
{ {
@@ -422,6 +449,7 @@ Settings::SaveCurrentSettings(bool onlyIfNonDefault)
fCurrentSettings = NULL; fCurrentSettings = NULL;
} }
void void
Settings::Write(const char* format, ...) Settings::Write(const char* format, ...)
{ {
@@ -432,6 +460,7 @@ Settings::Write(const char *format, ...)
va_end(args); va_end(args);
} }
void void
Settings::VSWrite(const char* format, va_list arg) Settings::VSWrite(const char* format, va_list arg)
{ {
+8 -7
View File
@@ -31,16 +31,17 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __SETTINGS_FILE__ #ifndef __SETTINGS_FILE__
#define __SETTINGS_FILE__ #define __SETTINGS_FILE__
#include <SupportDefs.h> #include <SupportDefs.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
class BFile; class BFile;
class BDirectory; class BDirectory;
class BRect; class BRect;
@@ -52,7 +53,6 @@ class Settings;
typedef const char* (*ArgvHandler)(int argc, const char* const *argv, void* params); typedef const char* (*ArgvHandler)(int argc, const char* const *argv, void* params);
// return 0 or error string if parsing failed // return 0 or error string if parsing failed
const int32 kBufferSize = 1024; const int32 kBufferSize = 1024;
class ArgvParser { class ArgvParser {
@@ -108,8 +108,7 @@ public:
void SaveSettings(Settings* settings, bool onlyIfNonDefault); void SaveSettings(Settings* settings, bool onlyIfNonDefault);
const char *Name() const const char* Name() const { return name; }
{ return name; }
// name as it appears in the settings file // name as it appears in the settings file
virtual const char* Handle(const char* const *argv) = 0; virtual const char* Handle(const char* const *argv) = 0;
@@ -117,7 +116,6 @@ public:
// values in argv format for this setting // values in argv format for this setting
// return a pointer to an error message or null if parsed OK // return a pointer to an error message or null if parsed OK
// some handy reader/writer calls // some handy reader/writer calls
bool HandleRectValue(BRect&, const char* const *argv, bool printError = true); bool HandleRectValue(BRect&, const char* const *argv, bool printError = true);
void WriteRectValue(Settings*, BRect); void WriteRectValue(Settings*, BRect);
@@ -131,10 +129,12 @@ protected:
{ return true; } { return true; }
// override to return false if current value is equal to the default // override to return false if current value is equal to the default
// and does not need saving // and does not need saving
private: private:
const char* name; const char* name;
}; };
class Settings { class Settings {
// this class is a list of all the settings handlers, reads and // this class is a list of all the settings handlers, reads and
// saves the settings file // saves the settings file
@@ -159,7 +159,8 @@ private:
void SaveCurrentSettings(bool onlyIfNonDefault); void SaveCurrentSettings(bool onlyIfNonDefault);
const char* fFileName; const char* fFileName;
const char *fSettingsDir; // currently unused const char* fSettingsDir;
// currently unused
SettingsArgvDispatcher** fList; SettingsArgvDispatcher** fList;
int32 fCount; int32 fCount;
int32 fListSize; int32 fListSize;
@@ -170,4 +171,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __SETTINGS_FILE__
+3 -1
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _SETTINGS_VIEWS #ifndef _SETTINGS_VIEWS
#define _SETTINGS_VIEWS #define _SETTINGS_VIEWS
#include <CheckBox.h> #include <CheckBox.h>
#include <GroupView.h> #include <GroupView.h>
#include <RadioButton.h> #include <RadioButton.h>
@@ -43,6 +43,7 @@ All rights reserved.
#include "TrackerSettings.h" #include "TrackerSettings.h"
const uint32 kSettingsContentsModified = 'Scmo'; const uint32 kSettingsContentsModified = 'Scmo';
class BButton; class BButton;
@@ -162,6 +163,7 @@ class SpaceBarSettingsView : public SettingsView {
typedef SettingsView _inherited; typedef SettingsView _inherited;
}; };
class TrashSettingsView : public SettingsView { class TrashSettingsView : public SettingsView {
public: public:
TrashSettingsView(); TrashSettingsView();
+6 -2
View File
@@ -178,9 +178,11 @@ BSlowContextMenu::ClearMenuBuildingState()
} }
} }
const int32 kItemsToAddChunk = 20; const int32 kItemsToAddChunk = 20;
const bigtime_t kMaxTimeBuildingMenu = 200000; const bigtime_t kMaxTimeBuildingMenu = 200000;
bool bool
BSlowContextMenu::AddDynamicItem(add_state state) BSlowContextMenu::AddDynamicItem(add_state state)
{ {
@@ -222,8 +224,9 @@ BSlowContextMenu::StartBuildingItemList()
BEntry entry; BEntry entry;
if (fNavDir.device < 0 || entry.SetTo(&fNavDir) != B_OK if (fNavDir.device < 0 || entry.SetTo(&fNavDir) != B_OK
|| !entry.Exists()) || !entry.Exists()) {
return false; return false;
}
fIteratingDesktop = false; fIteratingDesktop = false;
@@ -250,9 +253,10 @@ BSlowContextMenu::StartBuildingItemList()
startModel.EntryRef()); startModel.EntryRef());
AddRootItemsIfNeeded(); AddRootItemsIfNeeded();
AddTrashItem(); AddTrashItem();
} else } else {
fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory*> fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory*>
(startModel.Node())); (startModel.Node()));
}
if (fContainer->InitCheck() != B_OK) if (fContainer->InitCheck() != B_OK)
return false; return false;
+6 -2
View File
@@ -31,13 +31,14 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef SLOW_CONTEXT_POPUP_H #ifndef SLOW_CONTEXT_POPUP_H
#define SLOW_CONTEXT_POPUP_H #define SLOW_CONTEXT_POPUP_H
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include "NavMenu.h" #include "NavMenu.h"
namespace BPrivate { namespace BPrivate {
class BSlowContextMenu : public BPopUpMenu { class BSlowContextMenu : public BPopUpMenu {
@@ -112,22 +113,25 @@ private:
using namespace BPrivate; using namespace BPrivate;
inline const BObjectList<BString>* inline const BObjectList<BString>*
BSlowContextMenu::TypesList() const BSlowContextMenu::TypesList() const
{ {
return fTypesList; return fTypesList;
} }
inline const BMessenger inline const BMessenger
BSlowContextMenu::Target() const BSlowContextMenu::Target() const
{ {
return fMessenger; return fMessenger;
} }
inline const bool inline const bool
BSlowContextMenu::IsShowing() const BSlowContextMenu::IsShowing() const
{ {
return fIsShowing; return fIsShowing;
} }
#endif #endif // SLOW_CONTEXT_POPUP_H
+15 -5
View File
@@ -32,17 +32,21 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "SlowMenu.h" #include "SlowMenu.h"
BSlowMenu::BSlowMenu(const char* title, menu_layout layout) BSlowMenu::BSlowMenu(const char* title, menu_layout layout)
: BMenu(title, layout), : BMenu(title, layout),
fMenuBuilt(false) fMenuBuilt(false)
{ {
} }
const int32 kItemsToAddChunk = 20; const int32 kItemsToAddChunk = 20;
const bigtime_t kMaxTimeBuildingMenu = 200000; const bigtime_t kMaxTimeBuildingMenu = 200000;
bool bool
BSlowMenu::AddDynamicItem(add_state state) BSlowMenu::AddDynamicItem(add_state state)
{ {
@@ -68,20 +72,25 @@ BSlowMenu::AddDynamicItem(add_state state)
return false; return false;
// done with menu, don't call again // done with menu, don't call again
} }
if (system_time() > timeToBail)
// we have been in here long enough, come back later if (system_time() > timeToBail) {
// we've been in here long enough, come back later
break; break;
} }
return true; // call me again, got more to show
} }
return true;
// call me again, got more to show
}
bool bool
BSlowMenu::StartBuildingItemList() BSlowMenu::StartBuildingItemList()
{ {
return true; return true;
} }
bool bool
BSlowMenu::AddNextItem() BSlowMenu::AddNextItem()
{ {
@@ -90,6 +99,7 @@ BSlowMenu::AddNextItem()
return true; return true;
} }
void void
BSlowMenu::DoneBuildingItemList() BSlowMenu::DoneBuildingItemList()
{ {
@@ -97,10 +107,10 @@ BSlowMenu::DoneBuildingItemList()
// pure virtual, shouldn't be here // pure virtual, shouldn't be here
} }
void void
BSlowMenu::ClearMenuBuildingState() BSlowMenu::ClearMenuBuildingState()
{ {
TRESPASS(); TRESPASS();
// pure virtual, shouldn't be here // pure virtual, shouldn't be here
} }
+7 -5
View File
@@ -31,19 +31,21 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __SLOW_MENU__ #ifndef __SLOW_MENU__
#define __SLOW_MENU__ #define __SLOW_MENU__
#include <Menu.h>
#include <MenuItem.h>
#include <Debug.h>
// SlowMenu is a convenience class that makes it easier to // SlowMenu is a convenience class that makes it easier to
// use the AddDynamicItem callback to implement a menu that can // use the AddDynamicItem callback to implement a menu that can
// checks periodically between creating new items and quits // checks periodically between creating new items and quits
// early if needed // early if needed
#include <Menu.h>
#include <MenuItem.h>
#include <Debug.h>
namespace BPrivate { namespace BPrivate {
class BSlowMenu : public BMenu { class BSlowMenu : public BMenu {
@@ -73,4 +75,4 @@ class BSlowMenu : public BMenu {
using namespace BPrivate; using namespace BPrivate;
#endif /* __SLOW_MENU__ */ #endif // __SLOW_MENU__
+1
View File
@@ -203,4 +203,5 @@ extern BStatusWindow* gStatusWindow;
using namespace BPrivate; using namespace BPrivate;
#endif // STATUS_WINDOW_H #endif // STATUS_WINDOW_H
+12 -10
View File
@@ -72,8 +72,9 @@ OneShotDelayedTask::RunIfNeeded(bigtime_t currentTime)
} }
PeriodicDelayedTask::PeriodicDelayedTask(FunctionObjectWithResult<bool> *functor, PeriodicDelayedTask::PeriodicDelayedTask(
bigtime_t initialDelay, bigtime_t period) FunctionObjectWithResult<bool>* functor, bigtime_t initialDelay,
bigtime_t period)
: DelayedTask(initialDelay), : DelayedTask(initialDelay),
fPeriod(period), fPeriod(period),
fFunctor(functor) fFunctor(functor)
@@ -124,8 +125,8 @@ PeriodicDelayedTaskWithTimeout::RunIfNeeded(bigtime_t currentTime)
} }
RunWhenIdleTask::RunWhenIdleTask(FunctionObjectWithResult<bool> *functor, bigtime_t RunWhenIdleTask::RunWhenIdleTask(FunctionObjectWithResult<bool>* functor,
initialDelay, bigtime_t idleFor, bigtime_t heartBeat) bigtime_t initialDelay, bigtime_t idleFor, bigtime_t heartBeat)
: PeriodicDelayedTask(functor, initialDelay, heartBeat), : PeriodicDelayedTask(functor, initialDelay, heartBeat),
fIdleFor(idleFor), fIdleFor(idleFor),
fState(kInitialDelay) fState(kInitialDelay)
@@ -276,13 +277,14 @@ void
TaskLoop::RunLater(FunctionObjectWithResult<bool>* functor, bigtime_t delay, TaskLoop::RunLater(FunctionObjectWithResult<bool>* functor, bigtime_t delay,
bigtime_t period, bigtime_t timeout) bigtime_t period, bigtime_t timeout)
{ {
RunLater(new PeriodicDelayedTaskWithTimeout(functor, delay, period, timeout)); RunLater(new PeriodicDelayedTaskWithTimeout(functor, delay, period,
timeout));
} }
void void
TaskLoop::RunWhenIdle(FunctionObjectWithResult<bool> *functor, bigtime_t initialDelay, TaskLoop::RunWhenIdle(FunctionObjectWithResult<bool>* functor,
bigtime_t idleTime, bigtime_t heartBeat) bigtime_t initialDelay, bigtime_t idleTime, bigtime_t heartBeat)
{ {
RunLater(new RunWhenIdleTask(functor, initialDelay, idleTime, heartBeat)); RunLater(new RunWhenIdleTask(functor, initialDelay, idleTime, heartBeat));
} }
@@ -338,8 +340,9 @@ TaskLoop::AccumulatedRunLater(AccumulatingFunctionObject *functor, bigtime_t del
} }
int32 count = fTaskList.CountItems(); int32 count = fTaskList.CountItems();
for (int32 index = 0; index < count; index++) { for (int32 index = 0; index < count; index++) {
AccumulatedOneShotDelayedTask *task = dynamic_cast<AccumulatedOneShotDelayedTask *> AccumulatedOneShotDelayedTask* task
(fTaskList.ItemAt(index)); = dynamic_cast<AccumulatedOneShotDelayedTask*>(
fTaskList.ItemAt(index));
if (!task) if (!task)
continue; continue;
@@ -589,4 +592,3 @@ PiggybackTaskLoop::StartPulsingIfNeeded()
{ {
fPulseMe = true; fPulseMe = true;
} }
+33 -23
View File
@@ -31,23 +31,23 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
//
// Delayed Tasks, Periodic Delayed Tasks, Periodic Delayed Tasks with timeout,
// Run when idle tasks, accumulating delayed tasks
//
#ifndef __TASK_LOOP__ #ifndef __TASK_LOOP__
#define __TASK_LOOP__ #define __TASK_LOOP__
// Delayed Tasks, Periodic Delayed Tasks, Periodic Delayed Tasks with timeout,
// Run when idle tasks, accumulating delayed tasks
#include <Locker.h> #include <Locker.h>
#include "FunctionObject.h" #include "FunctionObject.h"
#include "ObjectList.h" #include "ObjectList.h"
namespace BPrivate { namespace BPrivate {
// Task flavors // Task flavors
class DelayedTask { class DelayedTask {
@@ -64,8 +64,9 @@ protected:
bigtime_t fRunAfter; bigtime_t fRunAfter;
}; };
class OneShotDelayedTask : public DelayedTask {
// called once after a specified delay // called once after a specified delay
class OneShotDelayedTask : public DelayedTask {
public: public:
OneShotDelayedTask(FunctionObject* functor, bigtime_t delay); OneShotDelayedTask(FunctionObject* functor, bigtime_t delay);
virtual ~OneShotDelayedTask(); virtual ~OneShotDelayedTask();
@@ -76,8 +77,9 @@ protected:
FunctionObject* fFunctor; FunctionObject* fFunctor;
}; };
class PeriodicDelayedTask : public DelayedTask {
// called periodically till functor return true // called periodically till functor return true
class PeriodicDelayedTask : public DelayedTask {
public: public:
PeriodicDelayedTask(FunctionObjectWithResult<bool>* functor, PeriodicDelayedTask(FunctionObjectWithResult<bool>* functor,
bigtime_t initialDelay, bigtime_t period); bigtime_t initialDelay, bigtime_t period);
@@ -90,8 +92,9 @@ protected:
FunctionObjectWithResult<bool>* fFunctor; FunctionObjectWithResult<bool>* fFunctor;
}; };
class PeriodicDelayedTaskWithTimeout : public PeriodicDelayedTask {
// called periodically till functor returns true or till time out // called periodically till functor returns true or till time out
class PeriodicDelayedTaskWithTimeout : public PeriodicDelayedTask {
public: public:
PeriodicDelayedTaskWithTimeout(FunctionObjectWithResult<bool>* functor, PeriodicDelayedTaskWithTimeout(FunctionObjectWithResult<bool>* functor,
bigtime_t initialDelay, bigtime_t period, bigtime_t timeout); bigtime_t initialDelay, bigtime_t period, bigtime_t timeout);
@@ -102,9 +105,10 @@ protected:
bigtime_t fTimeoutAfter; bigtime_t fTimeoutAfter;
}; };
class RunWhenIdleTask : public PeriodicDelayedTask {
// after initial delay starts periodically calling functor if system is idle // after initial delay starts periodically calling functor if system is idle
// until functor returns true // until functor returns true
class RunWhenIdleTask : public PeriodicDelayedTask {
public: public:
RunWhenIdleTask(FunctionObjectWithResult<bool>* functor, bigtime_t initialDelay, RunWhenIdleTask(FunctionObjectWithResult<bool>* functor, bigtime_t initialDelay,
bigtime_t idleFor, bigtime_t heartBeat); bigtime_t idleFor, bigtime_t heartBeat);
@@ -135,12 +139,13 @@ private:
typedef PeriodicDelayedTask _inherited; typedef PeriodicDelayedTask _inherited;
}; };
class AccumulatingFunctionObject : public FunctionObject {
// This class is used for clumping up function objects that // This class is used for clumping up function objects that
// can be done as a single object. For instance the mime // can be done as a single object. For instance the mime
// notification mechanism sends out multiple notifications on // notification mechanism sends out multiple notifications on
// a single change and we need to accumulate the resulting // a single change and we need to accumulate the resulting
// icon update into a single one // icon update into a single one
class AccumulatingFunctionObject : public FunctionObject {
public: public:
virtual bool CanAccumulate(const AccumulatingFunctionObject*) const = 0; virtual bool CanAccumulate(const AccumulatingFunctionObject*) const = 0;
virtual void Accumulate(AccumulatingFunctionObject*) = 0; virtual void Accumulate(AccumulatingFunctionObject*) = 0;
@@ -161,25 +166,27 @@ public:
void RunLater(FunctionObjectWithResult<bool>* functor, bigtime_t delay, void RunLater(FunctionObjectWithResult<bool>* functor, bigtime_t delay,
bigtime_t period); bigtime_t period);
// periodically execute function object after initial delay until function // periodically execute function object after initial delay until
// object returns true // function object returns true
void RunLater(FunctionObjectWithResult<bool>* functor, bigtime_t delay, void RunLater(FunctionObjectWithResult<bool>* functor, bigtime_t delay,
bigtime_t period, bigtime_t timeout); bigtime_t period, bigtime_t timeout);
// periodically execute function object after initial delay until function // periodically execute function object after initial delay until
// object returns true or timeout is reached // function object returns true or timeout is reached
void AccumulatedRunLater(AccumulatingFunctionObject *functor, bigtime_t delay, void AccumulatedRunLater(AccumulatingFunctionObject* functor,
bigtime_t maxAccumulatingTime = 0, int32 maxAccumulateCount = 0); bigtime_t delay, bigtime_t maxAccumulatingTime = 0,
int32 maxAccumulateCount = 0);
// will search the delayed task loop for other accumulating functors // will search the delayed task loop for other accumulating functors
// and will accumulate with them, else will create a new delayed task // and will accumulate with them, else will create a new delayed task
// the task will no longer accumulate if past the <maxAccumulatingTime> delay // the task will no longer accumulate if past the
// unless <maxAccumulatingTime> is zero // <maxAccumulatingTime> delay unless <maxAccumulatingTime> is zero
// no more than <maxAccumulateCount> will get accumulated, unless // no more than <maxAccumulateCount> will get accumulated, unless
// <maxAccumulateCount> is zero // <maxAccumulateCount> is zero
void RunWhenIdle(FunctionObjectWithResult<bool> *functor, bigtime_t initialDelay, void RunWhenIdle(FunctionObjectWithResult<bool>* functor,
bigtime_t idleTime, bigtime_t heartBeat = 1000000); bigtime_t initialDelay, bigtime_t idleTime,
bigtime_t heartBeat = 1000000);
// after initialDelay starts looking for a slot when the system is // after initialDelay starts looking for a slot when the system is
// idle for at least idleTime // idle for at least idleTime
@@ -199,6 +206,7 @@ protected:
bigtime_t fHeartBeat; bigtime_t fHeartBeat;
}; };
class StandAloneTaskLoop : public TaskLoop { class StandAloneTaskLoop : public TaskLoop {
// this task loop can work on it's own, just instantiate it // this task loop can work on it's own, just instantiate it
// and use it; It has to start it's own thread // and use it; It has to start it's own thread
@@ -223,6 +231,7 @@ private:
typedef TaskLoop _inherited; typedef TaskLoop _inherited;
}; };
class PiggybackTaskLoop : public TaskLoop { class PiggybackTaskLoop : public TaskLoop {
// this TaskLoop needs periodic calls from a viewable's Pulse // this TaskLoop needs periodic calls from a viewable's Pulse
// or some similar pulsing mechanism // or some similar pulsing mechanism
@@ -247,8 +256,9 @@ DelayedTask::RunAfterTime() const
return fRunAfter; return fRunAfter;
} }
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __TASK_LOOP__
+10 -4
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <Application.h> #include <Application.h>
#include <Catalog.h> #include <Catalog.h>
#include <FindDirectory.h> #include <FindDirectory.h>
@@ -61,8 +62,7 @@ namespace BPrivate {
const char* kTemplatesDirectory = "Tracker/Tracker New Templates"; const char* kTemplatesDirectory = "Tracker/Tracker New Templates";
} // namespace BPrivate
}
TemplatesMenu::TemplatesMenu(const BMessenger &target, const char* label) TemplatesMenu::TemplatesMenu(const BMessenger &target, const char* label)
: BMenu(label), : BMenu(label),
@@ -71,10 +71,12 @@ TemplatesMenu::TemplatesMenu(const BMessenger &target, const char *label)
{ {
} }
TemplatesMenu::~TemplatesMenu() TemplatesMenu::~TemplatesMenu()
{ {
} }
void void
TemplatesMenu::AttachedToWindow() TemplatesMenu::AttachedToWindow()
{ {
@@ -83,30 +85,36 @@ TemplatesMenu::AttachedToWindow()
SetTargetForItems(fTarget); SetTargetForItems(fTarget);
} }
status_t status_t
TemplatesMenu::SetTargetForItems(BHandler* target) TemplatesMenu::SetTargetForItems(BHandler* target)
{ {
status_t result = BMenu::SetTargetForItems(target); status_t result = BMenu::SetTargetForItems(target);
if (fOpenItem) if (fOpenItem)
fOpenItem->SetTarget(be_app_messenger); fOpenItem->SetTarget(be_app_messenger);
return result; return result;
} }
status_t status_t
TemplatesMenu::SetTargetForItems(BMessenger messenger) TemplatesMenu::SetTargetForItems(BMessenger messenger)
{ {
status_t result = BMenu::SetTargetForItems(messenger); status_t result = BMenu::SetTargetForItems(messenger);
if (fOpenItem) if (fOpenItem)
fOpenItem->SetTarget(be_app_messenger); fOpenItem->SetTarget(be_app_messenger);
return result; return result;
} }
void void
TemplatesMenu::UpdateMenuState() TemplatesMenu::UpdateMenuState()
{ {
BuildMenu(false); BuildMenu(false);
} }
bool bool
TemplatesMenu::BuildMenu(bool addItems) TemplatesMenu::BuildMenu(bool addItems)
{ {
@@ -143,7 +151,6 @@ TemplatesMenu::BuildMenu(bool addItems)
BMimeType mime(mimeType); BMimeType mime(mimeType);
if (mime.IsValid()) { if (mime.IsValid()) {
if (count == 0) if (count == 0)
AddSeparatorItem(); AddSeparatorItem();
@@ -163,7 +170,6 @@ TemplatesMenu::BuildMenu(bool addItems)
message->AddString("name", fileName); message->AddString("name", fileName);
AddItem(new IconMenuItem(fileName, message, &nodeInfo, B_MINI_ICON)); AddItem(new IconMenuItem(fileName, message, &nodeInfo, B_MINI_ICON));
} }
} }
} }
+3 -5
View File
@@ -31,13 +31,13 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __TEMPLATES_MENU__ #ifndef __TEMPLATES_MENU__
#define __TEMPLATES_MENU__ #define __TEMPLATES_MENU__
#include <Menu.h> #include <Menu.h>
namespace BPrivate { namespace BPrivate {
extern const char* kTemplatesDirectory; extern const char* kTemplatesDirectory;
@@ -45,11 +45,9 @@ extern const char* kTemplatesMenuName;
class TemplatesMenu : public BMenu { class TemplatesMenu : public BMenu {
public: public:
TemplatesMenu(const BMessenger &target, TemplatesMenu(const BMessenger& target, const char* label);
const char *label);
virtual ~TemplatesMenu(); virtual ~TemplatesMenu();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual status_t SetTargetForItems(BHandler*); virtual status_t SetTargetForItems(BHandler*);
@@ -68,4 +66,4 @@ private:
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __TEMPLATES_MENU__
+17 -2
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#if DEBUG #if DEBUG
#include "Tests.h" #include "Tests.h"
@@ -51,8 +52,6 @@ All rights reserved.
#include "Thread.h" #include "Thread.h"
const char* pathsToSearch[] = { const char* pathsToSearch[] = {
// "/boot/home/config/settings/NetPositive/Bookmarks/", // "/boot/home/config/settings/NetPositive/Bookmarks/",
#ifdef __HAIKU__ #ifdef __HAIKU__
@@ -65,6 +64,7 @@ const char *pathsToSearch[] = {
0 0
}; };
namespace BTrackerPrivate { namespace BTrackerPrivate {
class IconSpewer : public SimpleThread { class IconSpewer : public SimpleThread {
@@ -98,6 +98,7 @@ private:
entry_ref ref; entry_ref ref;
}; };
class IconTestWindow : public BWindow { class IconTestWindow : public BWindow {
public: public:
IconTestWindow(); IconTestWindow();
@@ -131,6 +132,7 @@ IconSpewer::~IconSpewer()
delete cachingIterator; delete cachingIterator;
} }
void void
IconSpewer::Run() IconSpewer::Run()
{ {
@@ -149,6 +151,7 @@ IconSpewer::Run()
} }
} }
void void
IconSpewer::Quit() IconSpewer::Quit()
{ {
@@ -156,10 +159,12 @@ IconSpewer::Quit()
fScanThread = -1; fScanThread = -1;
} }
const icon_size kIconSize = B_LARGE_ICON; const icon_size kIconSize = B_LARGE_ICON;
const int32 kRowCount = 10; const int32 kRowCount = 10;
const int32 kColumnCount = 10; const int32 kColumnCount = 10;
void void
IconSpewer::DrawSomeNew() IconSpewer::DrawSomeNew()
{ {
@@ -177,10 +182,12 @@ IconSpewer::DrawSomeNew()
sprintf(buffer, "last cycle time %Ld ms", cycleTime/1000); sprintf(buffer, "last cycle time %Ld ms", cycleTime/1000);
view->DrawString(buffer, BPoint(20, bounds.bottom - 20)); view->DrawString(buffer, BPoint(20, bounds.bottom - 20));
} }
if (numDrawn) { if (numDrawn) {
sprintf(buffer, "average draw time %Ld us per icon", watch.ElapsedTime() / numDrawn); sprintf(buffer, "average draw time %Ld us per icon", watch.ElapsedTime() / numDrawn);
view->DrawString(buffer, BPoint(20, bounds.bottom - 30)); view->DrawString(buffer, BPoint(20, bounds.bottom - 30));
} }
sprintf(buffer, "directory: %s", currentPath.Path()); sprintf(buffer, "directory: %s", currentPath.Path());
view->DrawString(buffer, BPoint(20, bounds.bottom - 40)); view->DrawString(buffer, BPoint(20, bounds.bottom - 40));
@@ -205,7 +212,10 @@ IconSpewer::DrawSomeNew()
} }
} }
bool oldIconCacheInited = false; bool oldIconCacheInited = false;
void void
IconSpewer::DrawSomeOld() IconSpewer::DrawSomeOld()
{ {
@@ -261,6 +271,7 @@ IconSpewer::DrawSomeOld()
#endif #endif
} }
const entry_ref* const entry_ref*
IconSpewer::NextRef() IconSpewer::NextRef()
{ {
@@ -295,6 +306,8 @@ IconSpewer::NextRef()
} }
// #pragma mark -
IconTestWindow::IconTestWindow() IconTestWindow::IconTestWindow()
: BWindow(BRect(100, 100, 500, 600), "icon cache test", B_TITLED_WINDOW_LOOK, : BWindow(BRect(100, 100, 500, 600), "icon cache test", B_TITLED_WINDOW_LOOK,
@@ -307,6 +320,7 @@ IconTestWindow::IconTestWindow()
iconSpewer.Go(); iconSpewer.Go();
} }
bool bool
IconTestWindow::QuitRequested() IconTestWindow::QuitRequested()
{ {
@@ -314,6 +328,7 @@ IconTestWindow::QuitRequested()
return true; return true;
} }
void void
RunIconCacheTests() RunIconCacheTests()
{ {
+1
View File
@@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
+12 -3
View File
@@ -93,10 +93,12 @@ public:
// used for sorting in PoseViews // used for sorting in PoseViews
private: private:
BRect CalcRectCommon(BPoint poseLoc, const BColumn *, const BPoseView *, float width); BRect CalcRectCommon(BPoint poseLoc, const BColumn*, const BPoseView*,
float width);
WidgetAttributeText* fText; WidgetAttributeText* fText;
uint32 fAttrHash; // ToDo: get rid of this uint32 fAttrHash;
// TODO: get rid of this
alignment fAlignment; alignment fAlignment;
bool fEditable : 1; bool fEditable : 1;
@@ -105,42 +107,49 @@ private:
bool fSymLink : 1; bool fSymLink : 1;
}; };
inline uint32 inline uint32
BTextWidget::AttrHash() const BTextWidget::AttrHash() const
{ {
return fAttrHash; return fAttrHash;
} }
inline void inline void
BTextWidget::SetEditable(bool on) BTextWidget::SetEditable(bool on)
{ {
fEditable = on; fEditable = on;
} }
inline bool inline bool
BTextWidget::IsEditable() const BTextWidget::IsEditable() const
{ {
return fEditable && fText->IsEditable(); return fEditable && fText->IsEditable();
} }
inline bool inline bool
BTextWidget::IsVisible() const BTextWidget::IsVisible() const
{ {
return fVisible; return fVisible;
} }
inline void inline void
BTextWidget::SetVisible(bool on) BTextWidget::SetVisible(bool on)
{ {
fVisible = on; fVisible = on;
} }
inline bool inline bool
BTextWidget::IsActive() const BTextWidget::IsActive() const
{ {
return fActive; return fActive;
} }
inline void inline void
BTextWidget::SetActive(bool on) BTextWidget::SetActive(bool on)
{ {
@@ -160,4 +169,4 @@ BTextWidget::Draw(BRect widgetRect, BRect widgetTextRect, float width,
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _TEXT_WIDGET_H
+15 -5
View File
@@ -32,9 +32,11 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include "Thread.h" #include "Thread.h"
#include "FunctionObject.h" #include "FunctionObject.h"
SimpleThread::SimpleThread(int32 priority, const char* name) SimpleThread::SimpleThread(int32 priority, const char* name)
: fScanThread(-1), : fScanThread(-1),
fPriority(priority), fPriority(priority),
@@ -45,19 +47,22 @@ SimpleThread::SimpleThread(int32 priority, const char *name)
SimpleThread::~SimpleThread() SimpleThread::~SimpleThread()
{ {
if (fScanThread > 0 && fScanThread != find_thread(NULL)) if (fScanThread > 0 && fScanThread != find_thread(NULL)) {
// kill the thread if it is not the one we are running in // kill the thread if it is not the one we are running in
kill_thread(fScanThread); kill_thread(fScanThread);
} }
}
void void
SimpleThread::Go() SimpleThread::Go()
{ {
fScanThread = spawn_thread(SimpleThread::RunBinder, fName ? fName : "TrackerTaskLoop", fScanThread = spawn_thread(SimpleThread::RunBinder,
fPriority, this); fName ? fName : "TrackerTaskLoop", fPriority, this);
resume_thread(fScanThread); resume_thread(fScanThread);
} }
status_t status_t
SimpleThread::RunBinder(void* castToThis) SimpleThread::RunBinder(void* castToThis)
{ {
@@ -66,6 +71,7 @@ SimpleThread::RunBinder(void *castToThis)
return B_OK; return B_OK;
} }
void void
Thread::Launch(FunctionObject* functor, int32 priority, const char* name) Thread::Launch(FunctionObject* functor, int32 priority, const char* name)
{ {
@@ -80,6 +86,7 @@ Thread::Thread(FunctionObject *functor, int32 priority, const char *name)
Go(); Go();
} }
Thread::~Thread() Thread::~Thread()
{ {
delete fFunctor; delete fFunctor;
@@ -94,13 +101,14 @@ Thread::Run()
// commit suicide // commit suicide
} }
void void
ThreadSequence::Launch(BObjectList<FunctionObject>* list, bool async, int32 priority) ThreadSequence::Launch(BObjectList<FunctionObject>* list, bool async, int32 priority)
{ {
if (!async) if (!async) {
// if not async, don't even create a thread, just do it right away // if not async, don't even create a thread, just do it right away
Run(list); Run(list);
else } else
new ThreadSequence(list, priority); new ThreadSequence(list, priority);
} }
@@ -118,6 +126,7 @@ ThreadSequence::~ThreadSequence()
delete fFunctorList; delete fFunctorList;
} }
void void
ThreadSequence::Run(BObjectList<FunctionObject>* list) ThreadSequence::Run(BObjectList<FunctionObject>* list)
{ {
@@ -126,6 +135,7 @@ ThreadSequence::Run(BObjectList<FunctionObject> *list)
(*list->ItemAt(index))(); (*list->ItemAt(index))();
} }
void void
ThreadSequence::Run() ThreadSequence::Run()
{ {
+25 -11
View File
@@ -31,10 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef __THREAD__ #ifndef __THREAD__
#define __THREAD__ #define __THREAD__
#include <Debug.h> #include <Debug.h>
#include <OS.h> #include <OS.h>
@@ -42,6 +42,7 @@ All rights reserved.
#include "FunctionObject.h" #include "FunctionObject.h"
#include "Utilities.h" #include "Utilities.h"
namespace BPrivate { namespace BPrivate {
class SimpleThread { class SimpleThread {
@@ -122,7 +123,6 @@ public:
{ {
} }
virtual void operator()() virtual void operator()()
{ (fOnThis->*fFunction)(); } { (fOnThis->*fFunction)(); }
@@ -133,6 +133,7 @@ private:
T fOnThis; T fOnThis;
}; };
template <class Param1, class Param2> template <class Param1, class Param2>
class TwoParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> { class TwoParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
public: public:
@@ -155,6 +156,7 @@ private:
Param2 fParam2; Param2 fParam2;
}; };
template <class Param1, class Param2, class Param3> template <class Param1, class Param2, class Param3>
class ThreeParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> { class ThreeParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
public: public:
@@ -179,6 +181,7 @@ private:
Param3 fParam3; Param3 fParam3;
}; };
template <class Param1, class Param2, class Param3, class Param4> template <class Param1, class Param2, class Param3, class Param4>
class FourParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> { class FourParamFunctionObjectWorkaround : public FunctionObjectWithResult<status_t> {
public: public:
@@ -205,32 +208,39 @@ private:
Param4 fParam4; Param4 fParam4;
}; };
template<class Param1> template<class Param1>
void void
LaunchInNewThread(const char *name, int32 priority, status_t (*func)(Param1), Param1 p1) LaunchInNewThread(const char* name, int32 priority, status_t (*func)(Param1),
Param1 p1)
{ {
Thread::Launch(new SingleParamFunctionObjectWorkaround<Param1>(func, p1), Thread::Launch(new SingleParamFunctionObjectWorkaround<Param1>(func, p1),
priority, name); priority, name);
} }
template<class T> template<class T>
void void
LaunchInNewThread(const char *name, int32 priority, status_t (T::*function)(), T *onThis) LaunchInNewThread(const char* name, int32 priority, status_t (T::*function)(),
T* onThis)
{ {
Thread::Launch(new SimpleMemberFunctionObjectWorkaround<T>(function, onThis), Thread::Launch(new SimpleMemberFunctionObjectWorkaround<T>(function,
priority, name); onThis), priority, name);
} }
template<class Param1, class Param2> template<class Param1, class Param2>
void void
LaunchInNewThread(const char* name, int32 priority, LaunchInNewThread(const char* name, int32 priority,
status_t (*func)(Param1, Param2), status_t (*func)(Param1, Param2),
Param1 p1, Param2 p2) Param1 p1, Param2 p2)
{ {
Thread::Launch(new TwoParamFunctionObjectWorkaround<Param1, Param2>(func, p1, p2), Thread::Launch(new
TwoParamFunctionObjectWorkaround<Param1, Param2>(func, p1, p2),
priority, name); priority, name);
} }
template<class Param1, class Param2, class Param3> template<class Param1, class Param2, class Param3>
void void
LaunchInNewThread(const char* name, int32 priority, LaunchInNewThread(const char* name, int32 priority,
@@ -241,6 +251,7 @@ LaunchInNewThread(const char *name, int32 priority,
Param3>(func, p1, p2, p3), priority, name); Param3>(func, p1, p2, p3), priority, name);
} }
template<class Param1, class Param2, class Param3, class Param4> template<class Param1, class Param2, class Param3, class Param4>
void void
LaunchInNewThread(const char* name, int32 priority, LaunchInNewThread(const char* name, int32 priority,
@@ -251,6 +262,7 @@ LaunchInNewThread(const char *name, int32 priority,
Param3, Param4>(func, p1, p2, p3, p4), priority, name); Param3, Param4>(func, p1, p2, p3, p4), priority, name);
} }
template<class View> template<class View>
class MouseDownThread { class MouseDownThread {
public: public:
@@ -267,8 +279,8 @@ protected:
virtual void Track(); virtual void Track();
static status_t TrackBinder(void*); static status_t TrackBinder(void*);
private:
private:
BMessenger fOwner; BMessenger fOwner;
void (View::*fDonePressing)(BPoint); void (View::*fDonePressing)(BPoint);
void (View::*fPressing)(BPoint, uint32); void (View::*fPressing)(BPoint, uint32);
@@ -314,14 +326,15 @@ template<class View>
void void
MouseDownThread<View>::Go() MouseDownThread<View>::Go()
{ {
fThreadID = spawn_thread(&MouseDownThread::TrackBinder, "MouseTrackingThread", fThreadID = spawn_thread(&MouseDownThread::TrackBinder,
B_NORMAL_PRIORITY, this); "MouseTrackingThread", B_NORMAL_PRIORITY, this);
if (fThreadID <= 0 || resume_thread(fThreadID) != B_OK) if (fThreadID <= 0 || resume_thread(fThreadID) != B_OK)
// didn't start, don't leak self // didn't start, don't leak self
delete this; delete this;
} }
template<class View> template<class View>
status_t status_t
MouseDownThread<View>::TrackBinder(void* castToThis) MouseDownThread<View>::TrackBinder(void* castToThis)
@@ -333,6 +346,7 @@ MouseDownThread<View>::TrackBinder(void *castToThis)
return B_OK; return B_OK;
} }
template<class View> template<class View>
void void
MouseDownThread<View>::Track() MouseDownThread<View>::Track()
@@ -369,4 +383,4 @@ MouseDownThread<View>::Track()
using namespace BPrivate; using namespace BPrivate;
#endif #endif // __THREAD__

Some files were not shown because too many files have changed in this diff Show More