* Moved the global BPrivate::WidthBuffer from BTextView into BPrivate as
gWidthBuffer. * Tracker PoseView now uses BPrivate::gWidthBuffer instead of it's own instance. * TextView.h and PoseView.h are now a little cleaner. * InterfaceDefs.cpp now deletes gWidthBuffer in _fini_interface_kit_(). * Added binary compatibility support for NetPositive in WidthBuffer.h and .cpp. Obviously it kind of defeats the purpose of having WidthBuffer neatly tucked away in the BPrivate namespace, but Haiku should run NetPositive, I guess. Fixes #2879. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28532 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -16,9 +16,6 @@ class BFile;
|
|||||||
class BList;
|
class BList;
|
||||||
class BMessageRunner;
|
class BMessageRunner;
|
||||||
|
|
||||||
extern "C" status_t _init_interface_kit_();
|
|
||||||
|
|
||||||
|
|
||||||
struct text_run {
|
struct text_run {
|
||||||
int32 offset;
|
int32 offset;
|
||||||
BFont font;
|
BFont font;
|
||||||
@@ -40,7 +37,6 @@ enum undo_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
class WidthBuffer;
|
|
||||||
class TextGapBuffer;
|
class TextGapBuffer;
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
@@ -276,7 +272,6 @@ private:
|
|||||||
class TypingUndoBuffer;
|
class TypingUndoBuffer;
|
||||||
|
|
||||||
friend class TextTrackState;
|
friend class TextTrackState;
|
||||||
friend status_t _init_interface_kit_();
|
|
||||||
|
|
||||||
virtual void _ReservedTextView3();
|
virtual void _ReservedTextView3();
|
||||||
virtual void _ReservedTextView4();
|
virtual void _ReservedTextView4();
|
||||||
@@ -417,8 +412,6 @@ private:
|
|||||||
LayoutData* fLayoutData;
|
LayoutData* fLayoutData;
|
||||||
|
|
||||||
uint32 _reserved[8];
|
uint32 _reserved[8];
|
||||||
|
|
||||||
static BPrivate::WidthBuffer* sWidths;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _TEXTVIEW_H
|
#endif // _TEXTVIEW_H
|
||||||
|
|||||||
@@ -78,6 +78,23 @@ private:
|
|||||||
static uint32 Hash(uint32);
|
static uint32 Hash(uint32);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern WidthBuffer* gWidthBuffer;
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
using BPrivate::WidthBuffer;
|
||||||
|
|
||||||
|
#if __GNUC__ < 3
|
||||||
|
//! NetPositive binary compatibility support
|
||||||
|
|
||||||
|
class _BWidthBuffer_ : public _BTextViewSupportBuffer_<BPrivate::_width_table_> {
|
||||||
|
_BWidthBuffer_();
|
||||||
|
virtual ~_BWidthBuffer_();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern
|
||||||
|
_BWidthBuffer_* gCompatibilityWidthBuffer;
|
||||||
|
|
||||||
|
#endif // __GNUC__ < 3
|
||||||
|
|
||||||
#endif // __WIDTHBUFFER_H
|
#endif // __WIDTHBUFFER_H
|
||||||
|
|||||||
@@ -904,7 +904,7 @@ _init_interface_kit_()
|
|||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
BTextView::sWidths = new BPrivate::WidthBuffer;
|
BPrivate::gWidthBuffer = new BPrivate::WidthBuffer;
|
||||||
|
|
||||||
_init_global_fonts_();
|
_init_global_fonts_();
|
||||||
|
|
||||||
@@ -927,7 +927,10 @@ _init_interface_kit_()
|
|||||||
extern "C" status_t
|
extern "C" status_t
|
||||||
_fini_interface_kit_()
|
_fini_interface_kit_()
|
||||||
{
|
{
|
||||||
//TODO: Implement ?
|
delete BPrivate::gWidthBuffer;
|
||||||
|
BPrivate::gWidthBuffer = NULL;
|
||||||
|
|
||||||
|
// TODO: Anything else?
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -1470,4 +1473,3 @@ truncate_string(const char* string, uint32 mode, float width,
|
|||||||
strlcpy(dest, source, length + 1);
|
strlcpy(dest, source, length + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,9 +152,6 @@ struct BTextView::LayoutData {
|
|||||||
bool valid;
|
bool valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialized/finalized by init/fini_interface_kit
|
|
||||||
BPrivate::WidthBuffer* BTextView::sWidths = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
const static rgb_color kBlackColor = { 0, 0, 0, 255 };
|
const static rgb_color kBlackColor = { 0, 0, 0, 255 };
|
||||||
const static rgb_color kBlueInputColor = { 152, 203, 255, 255 };
|
const static rgb_color kBlueInputColor = { 152, 203, 255, 255 };
|
||||||
@@ -3824,8 +3821,9 @@ BTextView::_StyledWidth(int32 fromOffset, int32 length, float *outAscent,
|
|||||||
|
|
||||||
#if USE_WIDTHBUFFER
|
#if USE_WIDTHBUFFER
|
||||||
// Use _BWidthBuffer_ if possible
|
// Use _BWidthBuffer_ if possible
|
||||||
if (sWidths != NULL) {
|
if (BPrivate::gWidthBuffer != NULL) {
|
||||||
result += sWidths->StringWidth(*fText, fromOffset, numChars, font);
|
result += BPrivate::gWidthBuffer->StringWidth(*fText, fromOffset,
|
||||||
|
numChars, font);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
const char* text = fText->GetString(fromOffset, &numChars);
|
const char* text = fText->GetString(fromOffset, &numChars);
|
||||||
|
|||||||
@@ -20,12 +20,16 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
//! NetPositive binary compatibility support
|
||||||
|
class _BWidthBuffer_;
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
const static uint32 kTableCount = 128;
|
const static uint32 kTableCount = 128;
|
||||||
const static uint32 kInvalidCode = 0xFFFFFFFF;
|
const static uint32 kInvalidCode = 0xFFFFFFFF;
|
||||||
static BLocker sWidthLocker = BLocker("width buffer lock");
|
static BLocker sWidthLocker = BLocker("width buffer lock");
|
||||||
|
WidthBuffer* gWidthBuffer = NULL;
|
||||||
|
// initialized in InterfaceDefs.cpp
|
||||||
|
|
||||||
struct hashed_escapement {
|
struct hashed_escapement {
|
||||||
uint32 code;
|
uint32 code;
|
||||||
@@ -363,3 +367,28 @@ WidthBuffer::HashEscapements(const char *inText, int32 numChars, int32 textLen,
|
|||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
#if __GNUC__ < 3
|
||||||
|
//! NetPositive binary compatibility support
|
||||||
|
|
||||||
|
_BWidthBuffer_::_BWidthBuffer_()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
_BWidthBuffer_::~_BWidthBuffer_()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
_BWidthBuffer_* gCompatibilityWidthBuffer = NULL;
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
float
|
||||||
|
StringWidth__14_BWidthBuffer_PCcllPC5BFont(_BWidthBuffer_* widthBuffer,
|
||||||
|
const char *inText, int32 fromOffset, int32 length, const BFont *inStyle)
|
||||||
|
{
|
||||||
|
return BPrivate::gWidthBuffer->StringWidth(inText, fromOffset, length,
|
||||||
|
inStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __GNUC__ < 3
|
||||||
|
|
||||||
|
|||||||
@@ -641,7 +641,8 @@ BPoseView::SaveState(BMessage &message) const
|
|||||||
float
|
float
|
||||||
BPoseView::StringWidth(const char *str) const
|
BPoseView::StringWidth(const char *str) const
|
||||||
{
|
{
|
||||||
return sWidthBuffer->StringWidth(str, 0, (int32)strlen(str), &sCurrentFont);
|
return BPrivate::gWidthBuffer->StringWidth(str, 0, (int32)strlen(str),
|
||||||
|
&sCurrentFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -649,7 +650,7 @@ float
|
|||||||
BPoseView::StringWidth(const char *str, int32 len) const
|
BPoseView::StringWidth(const char *str, int32 len) const
|
||||||
{
|
{
|
||||||
ASSERT(strlen(str) == (uint32)len);
|
ASSERT(strlen(str) == (uint32)len);
|
||||||
return sWidthBuffer->StringWidth(str, 0, len, &sCurrentFont);
|
return BPrivate::gWidthBuffer->StringWidth(str, 0, len, &sCurrentFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -9321,7 +9322,6 @@ TPoseViewFilter::Filter(BMessage *message, BHandler **)
|
|||||||
float BPoseView::sFontHeight = -1;
|
float BPoseView::sFontHeight = -1;
|
||||||
font_height BPoseView::sFontInfo = { 0, 0, 0 };
|
font_height BPoseView::sFontInfo = { 0, 0, 0 };
|
||||||
bigtime_t BPoseView::sLastKeyTime = 0;
|
bigtime_t BPoseView::sLastKeyTime = 0;
|
||||||
BPrivate::WidthBuffer* BPoseView::sWidthBuffer = new BPrivate::WidthBuffer;
|
|
||||||
BFont BPoseView::sCurrentFont;
|
BFont BPoseView::sCurrentFont;
|
||||||
OffscreenBitmap *BPoseView::sOffscreen = new OffscreenBitmap;
|
OffscreenBitmap *BPoseView::sOffscreen = new OffscreenBitmap;
|
||||||
char BPoseView::sMatchString[] = "";
|
char BPoseView::sMatchString[] = "";
|
||||||
|
|||||||
@@ -62,10 +62,6 @@ All rights reserved.
|
|||||||
class BRefFilter;
|
class BRefFilter;
|
||||||
class BList;
|
class BList;
|
||||||
|
|
||||||
// TODO: Get rid of this.
|
|
||||||
#include <TextView.h>
|
|
||||||
// for BTextView::WidthBuffer;
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
class BCountView;
|
class BCountView;
|
||||||
@@ -665,9 +661,6 @@ class BPoseView : public BView {
|
|||||||
bigtime_t fLastDeskbarFrameCheckTime;
|
bigtime_t fLastDeskbarFrameCheckTime;
|
||||||
BRect fDeskbarFrame;
|
BRect fDeskbarFrame;
|
||||||
|
|
||||||
// TODO: Get rid of this.
|
|
||||||
static BPrivate::WidthBuffer *sWidthBuffer;
|
|
||||||
|
|
||||||
static OffscreenBitmap *sOffscreen;
|
static OffscreenBitmap *sOffscreen;
|
||||||
|
|
||||||
typedef BView _inherited;
|
typedef BView _inherited;
|
||||||
|
|||||||
Reference in New Issue
Block a user