Quite a cleanup action to avoid polluting the global namespace with private
BTextView classes: * Declared the directly used BTextView helper classes as private BTextView classes and changed all affected files. * Realized that Tracker's BPoseView was (accidentally?) using what used to be _BWidthBuffer_. It had declared it's own class with the same name and same members/size in headers/private/tracker/TextViewSupport.h, but the implementation was nowhere to be found. I can only explain this that the BTextView implementation was then actually linked and used. But the big problem was that it was used without locking (unlike in BTextView)! When many Tracker windows opened during system startup or later and they happened to each request characters not yet in the cache, I imagine things could have gone bad and corrupted memory. Anyways, since I can see the usefulness of the cache, BPoseView uses BTextView::WidthBuffer on purpose now. And I moved the locking inside BTextView::WidthBuffer::StringWidth(). * Adjusted InterfaceDefs.cpp accordingly. * TODO: Move subsequent classes into BTextView namespace as well, ie derived classes that BTextView doesn't directly know about. All stuff in src/kits/ inteface/textview_support/ * Added preliminary and not yet implemented layout friendly BTextView constructors. * I will try to handle the insets imposed by BTextView::fTextRect a bit differently when used inside the new layout management framework. For this, I added BTextView::SetInsets() and GetInsets(). SetInsets() doesn't do anything yet. So far, everything seems to work still... ;-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27654 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -6,22 +6,15 @@
|
||||
#define _TEXTVIEW_H
|
||||
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Locker.h>
|
||||
#include <View.h>
|
||||
|
||||
class BMessageRunner;
|
||||
|
||||
class BBitmap;
|
||||
class BClipboard;
|
||||
class BFile;
|
||||
class BList;
|
||||
class _BTextGapBuffer_;
|
||||
class _BLineBuffer_;
|
||||
class _BStyleBuffer_;
|
||||
class _BWidthBuffer_;
|
||||
class _BUndoBuffer_;
|
||||
class _BInlineInput_;
|
||||
class _BTextTrackState_;
|
||||
class _BTextChangeResult_;
|
||||
class BMessageRunner;
|
||||
|
||||
extern "C" status_t _init_interface_kit_();
|
||||
|
||||
@@ -46,6 +39,7 @@ enum undo_state {
|
||||
B_UNDO_DROP
|
||||
};
|
||||
|
||||
|
||||
class BTextView : public BView {
|
||||
public:
|
||||
BTextView(BRect frame, const char* name,
|
||||
@@ -56,6 +50,15 @@ public:
|
||||
BRect textRect, const BFont* initialFont,
|
||||
const rgb_color* initialColor,
|
||||
uint32 resizeMask, uint32 flags);
|
||||
|
||||
BTextView(const char* name,
|
||||
uint32 flags
|
||||
= B_WILL_DRAW | B_PULSE_NEEDED);
|
||||
BTextView(const char* name,
|
||||
const BFont* initialFont,
|
||||
const rgb_color* initialColor,
|
||||
uint32 flags);
|
||||
|
||||
BTextView(BMessage* data);
|
||||
|
||||
virtual ~BTextView();
|
||||
@@ -172,6 +175,12 @@ public:
|
||||
|
||||
void SetTextRect(BRect rect);
|
||||
BRect TextRect() const;
|
||||
void SetInsets(float _leftInset, float topInset,
|
||||
float rightInset, float bottomInset);
|
||||
void GetInsets(float* _leftInset, float* _topInset,
|
||||
float* _rightInset,
|
||||
float* _bottomInset) const;
|
||||
|
||||
void SetStylable(bool stylable);
|
||||
bool IsStylable() const;
|
||||
void SetTabWidth(float width);
|
||||
@@ -231,8 +240,17 @@ protected:
|
||||
BHandler** _handler);
|
||||
|
||||
private:
|
||||
friend status_t _init_interface_kit_();
|
||||
friend class _BTextTrackState_;
|
||||
class InlineInput;
|
||||
struct LayoutData;
|
||||
class LineBuffer;
|
||||
class StyleBuffer;
|
||||
class TextGapBuffer;
|
||||
class TextTrackState;
|
||||
class UndoBuffer;
|
||||
class WidthBuffer;
|
||||
|
||||
friend class TextTrackState;
|
||||
friend status_t _init_interface_kit_();
|
||||
|
||||
virtual void _ReservedTextView3();
|
||||
virtual void _ReservedTextView4();
|
||||
@@ -275,11 +293,9 @@ private:
|
||||
|
||||
void _DoInsertText(const char* inText,
|
||||
int32 inLength, int32 inOffset,
|
||||
const text_run_array* inRuns,
|
||||
_BTextChangeResult_* outResult);
|
||||
const text_run_array* inRuns);
|
||||
|
||||
void _DoDeleteText(int32 fromOffset, int32 toOffset,
|
||||
_BTextChangeResult_* outResult);
|
||||
void _DoDeleteText(int32 fromOffset, int32 toOffset);
|
||||
|
||||
void _DrawLine(BView* view, const int32 &startLine,
|
||||
const int32& startOffset, const bool& erase,
|
||||
@@ -337,12 +353,9 @@ private:
|
||||
void _HandleInputMethodLocationRequest();
|
||||
void _CancelInputMethod();
|
||||
|
||||
static void LockWidthBuffer();
|
||||
static void UnlockWidthBuffer();
|
||||
|
||||
_BTextGapBuffer_* fText;
|
||||
_BLineBuffer_* fLines;
|
||||
_BStyleBuffer_* fStyles;
|
||||
TextGapBuffer* fText;
|
||||
LineBuffer* fLines;
|
||||
StyleBuffer* fStyles;
|
||||
BRect fTextRect;
|
||||
float fMinTextRectWidth;
|
||||
int32 fSelStart;
|
||||
@@ -368,19 +381,16 @@ private:
|
||||
color_space fColorSpace;
|
||||
bool fResizable;
|
||||
BView* fContainerView;
|
||||
_BUndoBuffer_* fUndo;
|
||||
_BInlineInput_* fInline;
|
||||
UndoBuffer* fUndo;
|
||||
InlineInput* fInline;
|
||||
BMessageRunner * fDragRunner;
|
||||
BMessageRunner * fClickRunner;
|
||||
BPoint fWhere;
|
||||
_BTextTrackState_* fTrackingMouse;
|
||||
_BTextChangeResult_* fTextChange;
|
||||
TextTrackState* fTrackingMouse;
|
||||
|
||||
uint32 _reserved[8];
|
||||
uint32 _reserved[9];
|
||||
|
||||
static _BWidthBuffer_* sWidths;
|
||||
static sem_id sWidthSem;
|
||||
static int32 sWidthAtom;
|
||||
static WidthBuffer* sWidths;
|
||||
};
|
||||
|
||||
#endif // _TEXTVIEW_H
|
||||
|
||||
Reference in New Issue
Block a user