* 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:
parent
5074333ded
commit
b545073f08
@ -16,9 +16,6 @@ class BFile;
|
||||
class BList;
|
||||
class BMessageRunner;
|
||||
|
||||
extern "C" status_t _init_interface_kit_();
|
||||
|
||||
|
||||
struct text_run {
|
||||
int32 offset;
|
||||
BFont font;
|
||||
@ -40,7 +37,6 @@ enum undo_state {
|
||||
};
|
||||
|
||||
namespace BPrivate {
|
||||
class WidthBuffer;
|
||||
class TextGapBuffer;
|
||||
} // namespace BPrivate
|
||||
|
||||
@ -276,7 +272,6 @@ private:
|
||||
class TypingUndoBuffer;
|
||||
|
||||
friend class TextTrackState;
|
||||
friend status_t _init_interface_kit_();
|
||||
|
||||
virtual void _ReservedTextView3();
|
||||
virtual void _ReservedTextView4();
|
||||
@ -417,8 +412,6 @@ private:
|
||||
LayoutData* fLayoutData;
|
||||
|
||||
uint32 _reserved[8];
|
||||
|
||||
static BPrivate::WidthBuffer* sWidths;
|
||||
};
|
||||
|
||||
#endif // _TEXTVIEW_H
|
||||
|
@ -78,6 +78,23 @@ private:
|
||||
static uint32 Hash(uint32);
|
||||
};
|
||||
|
||||
extern WidthBuffer* gWidthBuffer;
|
||||
|
||||
} // 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
|
||||
|
@ -904,7 +904,7 @@ _init_interface_kit_()
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
BTextView::sWidths = new BPrivate::WidthBuffer;
|
||||
BPrivate::gWidthBuffer = new BPrivate::WidthBuffer;
|
||||
|
||||
_init_global_fonts_();
|
||||
|
||||
@ -927,7 +927,10 @@ _init_interface_kit_()
|
||||
extern "C" status_t
|
||||
_fini_interface_kit_()
|
||||
{
|
||||
//TODO: Implement ?
|
||||
delete BPrivate::gWidthBuffer;
|
||||
BPrivate::gWidthBuffer = NULL;
|
||||
|
||||
// TODO: Anything else?
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -1470,4 +1473,3 @@ truncate_string(const char* string, uint32 mode, float width,
|
||||
strlcpy(dest, source, length + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,9 +152,6 @@ struct BTextView::LayoutData {
|
||||
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 kBlueInputColor = { 152, 203, 255, 255 };
|
||||
@ -3824,8 +3821,9 @@ BTextView::_StyledWidth(int32 fromOffset, int32 length, float *outAscent,
|
||||
|
||||
#if USE_WIDTHBUFFER
|
||||
// Use _BWidthBuffer_ if possible
|
||||
if (sWidths != NULL) {
|
||||
result += sWidths->StringWidth(*fText, fromOffset, numChars, font);
|
||||
if (BPrivate::gWidthBuffer != NULL) {
|
||||
result += BPrivate::gWidthBuffer->StringWidth(*fText, fromOffset,
|
||||
numChars, font);
|
||||
} else {
|
||||
#endif
|
||||
const char* text = fText->GetString(fromOffset, &numChars);
|
||||
|
@ -20,12 +20,16 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//! NetPositive binary compatibility support
|
||||
class _BWidthBuffer_;
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
const static uint32 kTableCount = 128;
|
||||
const static uint32 kInvalidCode = 0xFFFFFFFF;
|
||||
static BLocker sWidthLocker = BLocker("width buffer lock");
|
||||
|
||||
WidthBuffer* gWidthBuffer = NULL;
|
||||
// initialized in InterfaceDefs.cpp
|
||||
|
||||
struct hashed_escapement {
|
||||
uint32 code;
|
||||
@ -363,3 +367,28 @@ WidthBuffer::HashEscapements(const char *inText, int32 numChars, int32 textLen,
|
||||
|
||||
} // 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
|
||||
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
|
||||
{
|
||||
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;
|
||||
font_height BPoseView::sFontInfo = { 0, 0, 0 };
|
||||
bigtime_t BPoseView::sLastKeyTime = 0;
|
||||
BPrivate::WidthBuffer* BPoseView::sWidthBuffer = new BPrivate::WidthBuffer;
|
||||
BFont BPoseView::sCurrentFont;
|
||||
OffscreenBitmap *BPoseView::sOffscreen = new OffscreenBitmap;
|
||||
char BPoseView::sMatchString[] = "";
|
||||
|
@ -62,10 +62,6 @@ All rights reserved.
|
||||
class BRefFilter;
|
||||
class BList;
|
||||
|
||||
// TODO: Get rid of this.
|
||||
#include <TextView.h>
|
||||
// for BTextView::WidthBuffer;
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class BCountView;
|
||||
@ -665,9 +661,6 @@ class BPoseView : public BView {
|
||||
bigtime_t fLastDeskbarFrameCheckTime;
|
||||
BRect fDeskbarFrame;
|
||||
|
||||
// TODO: Get rid of this.
|
||||
static BPrivate::WidthBuffer *sWidthBuffer;
|
||||
|
||||
static OffscreenBitmap *sOffscreen;
|
||||
|
||||
typedef BView _inherited;
|
||||
|
Loading…
Reference in New Issue
Block a user