2010-07-10 08:58:15 -05:00
|
|
|
/*
|
|
|
|
* The contents of this file are subject to the Mozilla Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
2010-05-07 04:47:10 -05:00
|
|
|
* The Original Code is Vision.
|
2010-07-10 08:58:15 -05:00
|
|
|
*
|
2010-05-07 04:47:10 -05:00
|
|
|
* The Initial Developer of the Original Code is The Vision Team.
|
|
|
|
* Portions created by The Vision Team are
|
|
|
|
* Copyright (C) 1999, 2000, 2001 The Vision Team. All Rights
|
|
|
|
* Reserved.
|
2010-07-10 08:58:15 -05:00
|
|
|
*
|
2010-05-07 04:47:10 -05:00
|
|
|
* Contributor(s): Rene Gollent
|
|
|
|
* Todd Lair
|
|
|
|
*/
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
#ifndef RUNVIEW_H_
|
|
|
|
#define RUNVIEW_H_
|
|
|
|
|
|
|
|
#define LINE_COUNT 1000
|
|
|
|
|
|
|
|
#include <View.h>
|
|
|
|
|
|
|
|
const uint32 M_LOOKUP_WEBSTER = 'rvlw';
|
|
|
|
const uint32 M_LOOKUP_GOOGLE = 'rvlg';
|
|
|
|
const uint32 M_LOOKUP_ACRONYM = 'rvla';
|
|
|
|
const uint32 M_CLEAR = 'rvcl';
|
|
|
|
|
|
|
|
const uint32 M_OFFVIEW_SELECTION = 'rvos';
|
|
|
|
const uint32 M_THEME_FOREGROUND_CHANGE = 'rvtf';
|
|
|
|
const uint32 M_THEME_BACKGROUND_CHANGE = 'rvtb';
|
|
|
|
const uint32 M_THEME_FONT_CHANGE = 'rvto';
|
|
|
|
|
|
|
|
#define C_URL 0
|
|
|
|
#define F_URL 0
|
|
|
|
|
|
|
|
struct Line;
|
|
|
|
class Theme;
|
|
|
|
class RunView;
|
|
|
|
class BScrollView;
|
|
|
|
class BCursor;
|
|
|
|
class BMessageRunner;
|
|
|
|
class BPopUpMenu;
|
|
|
|
|
|
|
|
class SelectPos
|
|
|
|
{
|
2010-07-10 08:58:15 -05:00
|
|
|
public:
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2012-06-09 08:14:33 -05:00
|
|
|
int fLine;
|
|
|
|
int fOffset;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 08:58:15 -05:00
|
|
|
SelectPos (
|
2012-06-09 08:14:33 -05:00
|
|
|
int selLine = 0,
|
|
|
|
int selOffset = 0)
|
2010-07-10 08:58:15 -05:00
|
|
|
: fLine (selLine),
|
|
|
|
fOffset (selOffset)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
SelectPos (const SelectPos& pos)
|
|
|
|
: fLine (pos.fLine),
|
|
|
|
fOffset (pos.fOffset)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
~SelectPos (void)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
SelectPos& operator = (const SelectPos& pos) {
|
|
|
|
fLine = pos.fLine;
|
|
|
|
fOffset = pos.fOffset;
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int operator == (const SelectPos& rhs) const {
|
|
|
|
return ((fLine == rhs.fLine) && (fOffset == rhs.fOffset));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int operator != (const SelectPos& rhs) const {
|
|
|
|
return (!(*this == rhs));
|
|
|
|
}
|
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class RunView : public BView
|
|
|
|
{
|
2010-07-10 08:58:15 -05:00
|
|
|
BScrollView* fScroller;
|
|
|
|
BCursor* fURLCursor;
|
|
|
|
Theme* fTheme;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 08:58:15 -05:00
|
|
|
Line* fWorking;
|
|
|
|
Line* fLines[LINE_COUNT];
|
2010-05-07 04:47:10 -05:00
|
|
|
int16 fLine_count,
|
2010-07-10 08:58:15 -05:00
|
|
|
fClickCount;
|
|
|
|
|
|
|
|
char* fStamp_format;
|
|
|
|
char* fClipping_name;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
SelectPos fSp_start, fSp_end;
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
int32 fTracking;
|
|
|
|
SelectPos fTrack_offset;
|
2010-07-10 08:58:15 -05:00
|
|
|
BMessageRunner* fOff_view_runner;
|
2010-05-07 04:47:10 -05:00
|
|
|
bigtime_t fOff_view_time;
|
|
|
|
|
|
|
|
bool fResizedirty;
|
|
|
|
bool fFontsdirty;
|
2010-07-10 08:58:15 -05:00
|
|
|
BPopUpMenu* fMyPopUp;
|
2010-05-07 04:47:10 -05:00
|
|
|
BPoint fLastClick;
|
|
|
|
bigtime_t fLastClickTime;
|
|
|
|
|
|
|
|
|
|
|
|
bool RecalcScrollBar (bool constrain);
|
|
|
|
void ResizeRecalc (void);
|
|
|
|
void FontChangeRecalc (void);
|
|
|
|
void ExtendTrackingSelect (BPoint);
|
|
|
|
void ShiftTrackingSelect (BPoint, bool, bigtime_t);
|
|
|
|
void CheckURLCursor (BPoint);
|
|
|
|
void BuildPopUp (void);
|
|
|
|
|
2010-07-10 08:58:15 -05:00
|
|
|
bool CheckClickBounds (const SelectPos&, const BPoint&) const;
|
|
|
|
void LoadURL(const char* url);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
RunView (
|
|
|
|
BRect,
|
|
|
|
const char*,
|
|
|
|
Theme*,
|
|
|
|
uint32 = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
|
|
|
uint32 = 0UL);
|
2010-05-07 04:47:10 -05:00
|
|
|
virtual ~RunView (void);
|
|
|
|
|
|
|
|
virtual void AttachedToWindow (void);
|
|
|
|
virtual void DetachedFromWindow (void);
|
|
|
|
virtual void FrameResized (float, float);
|
2010-07-10 08:58:15 -05:00
|
|
|
virtual void TargetedByScrollView (BScrollView*);
|
2010-05-07 04:47:10 -05:00
|
|
|
virtual void Show ();
|
|
|
|
virtual void Draw (BRect);
|
2010-07-10 08:58:15 -05:00
|
|
|
virtual void MessageReceived (BMessage*);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
virtual void SetViewColor (rgb_color);
|
2010-07-10 08:58:15 -05:00
|
|
|
void SetViewColor (uchar red, uchar green, uchar blue, uchar alpha = 255) {
|
|
|
|
rgb_color color = {red, green, blue, alpha};
|
|
|
|
SetViewColor (color);
|
|
|
|
}
|
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
virtual void MouseDown (BPoint);
|
2010-07-10 08:58:15 -05:00
|
|
|
virtual void MouseMoved (BPoint, uint32, const BMessage*);
|
2010-05-07 04:47:10 -05:00
|
|
|
virtual void MouseUp (BPoint);
|
|
|
|
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2012-06-09 08:14:33 -05:00
|
|
|
void Append (const char*, int32, int, int, int);
|
|
|
|
void Append (const char*, int, int, int);
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
void Clear (void);
|
|
|
|
|
|
|
|
int16 LineCount (void) const;
|
2012-10-17 16:21:11 -05:00
|
|
|
const char* LineAt (int) const;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 08:58:15 -05:00
|
|
|
void SetTimeStampFormat (const char*);
|
|
|
|
void SetTheme (Theme*);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
SelectPos PositionAt (BPoint) const;
|
|
|
|
BPoint PointAt (SelectPos) const;
|
2010-07-10 08:58:15 -05:00
|
|
|
|
|
|
|
BRect GetTextFrame (const SelectPos&, const SelectPos&) const;
|
|
|
|
bool IntersectSelection (const SelectPos&, const SelectPos&) const;
|
|
|
|
void GetSelectionText (BString&) const;
|
|
|
|
void Select (const SelectPos&, const SelectPos&);
|
2010-05-07 04:47:10 -05:00
|
|
|
void SelectAll (void);
|
2010-07-10 08:58:15 -05:00
|
|
|
void SetClippingName (const char*);
|
|
|
|
bool FindText(const char*);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
void ScrollToBottom(void);
|
|
|
|
void ScrollToSelection(void);
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|