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,
|
2012-10-18 15:59:15 -05:00
|
|
|
fClickCount;
|
2010-07-10 08:58:15 -05:00
|
|
|
|
|
|
|
char* fStamp_format;
|
|
|
|
char* fClipping_name;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2012-10-18 15:59:15 -05:00
|
|
|
SelectPos fSp_start, fSp_end;
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2012-10-18 15:59:15 -05:00
|
|
|
int32 fTracking;
|
|
|
|
SelectPos fTrack_offset;
|
|
|
|
BMessageRunner* fOff_view_runner;
|
|
|
|
bigtime_t fOff_view_time;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2012-10-18 15:59:15 -05:00
|
|
|
bool fResizedirty;
|
|
|
|
bool fFontsdirty;
|
|
|
|
BPopUpMenu* fMyPopUp;
|
|
|
|
BPoint fLastClick;
|
|
|
|
bigtime_t fLastClickTime;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-10-18 15:59:15 -05:00
|
|
|
bool CheckClickBounds (const SelectPos&,
|
|
|
|
const BPoint&) const;
|
|
|
|
void LoadURL(const char* url);
|
2010-07-10 08:58:15 -05:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-10-18 15:59:15 -05:00
|
|
|
virtual void AttachedToWindow (void);
|
|
|
|
virtual void DetachedFromWindow (void);
|
|
|
|
virtual void FrameResized (float, float);
|
|
|
|
virtual void TargetedByScrollView (BScrollView*);
|
|
|
|
virtual void Show ();
|
|
|
|
virtual void Draw (BRect);
|
|
|
|
virtual void MessageReceived (BMessage*);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2012-10-18 15:59:15 -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
|
|
|
|
2012-10-18 15:59:15 -05:00
|
|
|
virtual void MouseDown (BPoint);
|
|
|
|
virtual void MouseMoved (BPoint, uint32, const BMessage*);
|
|
|
|
virtual void MouseUp (BPoint);
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2021-06-07 20:01:14 -05:00
|
|
|
void Append (const char*, int32, rgb_color, rgb_color, rgb_color);
|
|
|
|
void Append (const char*, rgb_color, rgb_color, rgb_color);
|
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);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|