diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index 182ecfb2fb..9ca9576573 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku. + * Copyright 2001-2010, Haiku, Inc. * Copyright (c) 2003-4 Kian Duffy * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. * @@ -42,250 +42,253 @@ public: class Listener; public: - TermView(BRect frame, - const ShellParameters& shellParameters, - int32 historySize); - TermView(int rows, int columns, - const ShellParameters& shellParameters, - int32 historySize); - TermView(BMessage* archive); - ~TermView(); + TermView(BRect frame, + const ShellParameters& shellParameters, + int32 historySize); + TermView(int rows, int columns, + const ShellParameters& shellParameters, + int32 historySize); + TermView(BMessage* archive); + ~TermView(); - static BArchivable* Instantiate(BMessage* data); - virtual status_t Archive(BMessage* data, bool deep = true) const; + static BArchivable* Instantiate(BMessage* data); + virtual status_t Archive(BMessage* data, bool deep = true) const; - virtual void GetPreferredSize(float* _width, float* _height); + virtual void GetPreferredSize(float* _width, float* _height); - bool IsShellBusy() const; - bool GetActiveProcessInfo( - ActiveProcessInfo& _info) const; + bool IsShellBusy() const; + bool GetActiveProcessInfo( + ActiveProcessInfo& _info) const; bool GetShellInfo(ShellInfo& _info) const; - const char* TerminalName() const; + const char* TerminalName() const; - inline TerminalBuffer* TextBuffer() const { return fTextBuffer; } + inline TerminalBuffer* TextBuffer() const { return fTextBuffer; } - void GetTermFont(BFont* font) const; - void SetTermFont(const BFont* font); + void GetTermFont(BFont* font) const; + void SetTermFont(const BFont* font); - void GetFontSize(int* width, int* height); - int Rows() const; - int Columns() const; - BRect SetTermSize(int rows, int cols); - void SetTermSize(BRect rect); - void GetTermSizeFromRect(const BRect &rect, - int *rows, int *columns); + void GetFontSize(int* width, int* height); + int Rows() const; + int Columns() const; + BRect SetTermSize(int rows, int cols); + void SetTermSize(BRect rect); + void GetTermSizeFromRect(const BRect &rect, + int *rows, int *columns); - void SetTextColor(rgb_color fore, rgb_color back); - void SetSelectColor(rgb_color fore, rgb_color back); + void SetTextColor(rgb_color fore, rgb_color back); + void SetSelectColor(rgb_color fore, rgb_color back); - int Encoding() const; - void SetEncoding(int encoding); + int Encoding() const; + void SetEncoding(int encoding); - void SetScrollBar(BScrollBar* scrollBar); - BScrollBar* ScrollBar() const { return fScrollBar; }; + void SetScrollBar(BScrollBar* scrollBar); + BScrollBar* ScrollBar() const { return fScrollBar; }; - void SetMouseClipboard(BClipboard *); + void SetMouseClipboard(BClipboard *); // edit functions - void Copy(BClipboard* clipboard); - void Paste(BClipboard* clipboard); - void SelectAll(); - void Clear(); + void Copy(BClipboard* clipboard); + void Paste(BClipboard* clipboard); + void SelectAll(); + void Clear(); // Other - void GetFrameSize(float* width, float* height); - bool Find(const BString& str, bool forwardSearch, - bool matchCase, bool matchWord); - void GetSelection(BString& string); + void GetFrameSize(float* width, float* height); + bool Find(const BString& str, bool forwardSearch, + bool matchCase, bool matchWord); + void GetSelection(BString& string); - bool CheckShellGone() const; + bool CheckShellGone() const; - void InitiateDrag(); + void InitiateDrag(); - void DisableResizeView(int32 disableCount = 1); - static void AboutRequested(); + void DisableResizeView(int32 disableCount = 1); + static void AboutRequested(); - void SetListener(Listener* listener) - { fListener = listener; } + void SetListener(Listener* listener) + { fListener = listener; } protected: - virtual void AttachedToWindow(); - virtual void DetachedFromWindow(); - virtual void Draw(BRect updateRect); - virtual void WindowActivated(bool active); - virtual void MakeFocus(bool focusState = true); - virtual void KeyDown(const char* bytes, int32 numBytes); + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void Draw(BRect updateRect); + virtual void WindowActivated(bool active); + virtual void MakeFocus(bool focusState = true); + virtual void KeyDown(const char* bytes, int32 numBytes); - virtual void MouseDown(BPoint where); - virtual void MouseMoved(BPoint where, uint32 transit, - const BMessage* message); - virtual void MouseUp(BPoint where); + virtual void MouseDown(BPoint where); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* message); + virtual void MouseUp(BPoint where); - virtual void FrameResized(float width, float height); - virtual void MessageReceived(BMessage* message); + virtual void FrameResized(float width, float height); + virtual void MessageReceived(BMessage* message); - virtual void ScrollTo(BPoint where); - virtual void TargetedByScrollView(BScrollView *scrollView); + virtual void ScrollTo(BPoint where); + virtual void TargetedByScrollView(BScrollView *scrollView); - virtual status_t GetSupportedSuites(BMessage* msg); - virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, - BMessage* specifier, int32 form, - const char* property); + virtual status_t GetSupportedSuites(BMessage* msg); + virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, + BMessage* specifier, int32 form, + const char* property); private: class CharClassifier; private: // point and text offset conversion - inline int32 _LineAt(float y); - inline float _LineOffset(int32 index); - inline TermPos _ConvertToTerminal(const BPoint& point); - inline BPoint _ConvertFromTerminal(const TermPos& pos); + inline int32 _LineAt(float y); + inline float _LineOffset(int32 index); + inline TermPos _ConvertToTerminal(const BPoint& point); + inline BPoint _ConvertFromTerminal(const TermPos& pos); - inline void _InvalidateTextRect(int32 x1, int32 y1, int32 x2, - int32 y2); + inline void _InvalidateTextRect(int32 x1, int32 y1, + int32 x2, int32 y2); - status_t _InitObject(const ShellParameters& shellParameters); + status_t _InitObject( + const ShellParameters& shellParameters); - status_t _AttachShell(Shell* shell); - void _DetachShell(); + status_t _AttachShell(Shell* shell); + void _DetachShell(); - void _Activate(); - void _Deactivate(); + void _Activate(); + void _Deactivate(); - void _DrawLinePart(int32 x1, int32 y1, uint32 attr, - char* buffer, int32 width, bool mouse, - bool cursor, BView* inView); - void _DrawCursor(); - void _InvalidateTextRange(TermPos start, TermPos end); + void _DrawLinePart(int32 x1, int32 y1, uint32 attr, + char* buffer, int32 width, bool mouse, + bool cursor, BView* inView); + void _DrawCursor(); + void _InvalidateTextRange(TermPos start, + TermPos end); - bool _IsCursorVisible() const; - void _BlinkCursor(); - void _ActivateCursor(bool invalidate); + bool _IsCursorVisible() const; + void _BlinkCursor(); + void _ActivateCursor(bool invalidate); - void _DoPrint(BRect updateRect); - void _UpdateScrollBarRange(); - void _SecondaryMouseButtonDropped(BMessage* msg); - void _DoSecondaryMouseDropAction(BMessage* msg); - void _DoFileDrop(entry_ref &ref); + void _DoPrint(BRect updateRect); + void _UpdateScrollBarRange(); + void _SecondaryMouseButtonDropped(BMessage* msg); + void _DoSecondaryMouseDropAction(BMessage* msg); + void _DoFileDrop(entry_ref &ref); - void _SynchronizeWithTextBuffer(int32 visibleDirtyTop, - int32 visibleDirtyBottom); + void _SynchronizeWithTextBuffer( + int32 visibleDirtyTop, + int32 visibleDirtyBottom); - void _WritePTY(const char* text, int32 numBytes); + void _WritePTY(const char* text, int32 numBytes); // selection - float _MouseDistanceSinceLastClick(BPoint where); - void _Select(TermPos start, TermPos end, bool inclusive, - bool setInitialSelection); - void _ExtendSelection(TermPos, bool inclusive, - bool useInitialSelection); - void _Deselect(); - bool _HasSelection() const; - void _SelectWord(BPoint where, bool extend, - bool useInitialSelection); - void _SelectLine(BPoint where, bool extend, - bool useInitialSelection); + float _MouseDistanceSinceLastClick(BPoint where); + void _Select(TermPos start, TermPos end, + bool inclusive, bool setInitialSelection); + void _ExtendSelection(TermPos, bool inclusive, + bool useInitialSelection); + void _Deselect(); + bool _HasSelection() const; + void _SelectWord(BPoint where, bool extend, + bool useInitialSelection); + void _SelectLine(BPoint where, bool extend, + bool useInitialSelection); - void _AutoScrollUpdate(); + void _AutoScrollUpdate(); - bool _CheckSelectedRegion(const TermPos& pos) const; - bool _CheckSelectedRegion(int32 row, int32 firstColumn, - int32& lastColumn) const; + bool _CheckSelectedRegion(const TermPos& pos) const; + bool _CheckSelectedRegion(int32 row, + int32 firstColumn, int32& lastColumn) const; - void _UpdateSIGWINCH(); + void _UpdateSIGWINCH(); - void _ScrollTo(float y, bool scrollGfx); - void _ScrollToRange(TermPos start, TermPos end); + void _ScrollTo(float y, bool scrollGfx); + void _ScrollToRange(TermPos start, TermPos end); - void _SendMouseEvent(int32 button, int32 mode, int32 x, - int32 y, bool motion); + void _SendMouseEvent(int32 button, int32 mode, + int32 x, int32 y, bool motion); - void _DrawInlineMethodString(); - void _HandleInputMethodChanged(BMessage* message); - void _HandleInputMethodLocationRequest(); - void _CancelInputMethod(); + void _DrawInlineMethodString(); + void _HandleInputMethodChanged(BMessage* message); + void _HandleInputMethodLocationRequest(); + void _CancelInputMethod(); private: - Listener* fListener; - Shell* fShell; + Listener* fListener; + Shell* fShell; - BMessageRunner* fWinchRunner; - BMessageRunner* fCursorBlinkRunner; - BMessageRunner* fAutoScrollRunner; - BMessageRunner* fResizeRunner; - BStringView* fResizeView; - CharClassifier* fCharClassifier; + BMessageRunner* fWinchRunner; + BMessageRunner* fCursorBlinkRunner; + BMessageRunner* fAutoScrollRunner; + BMessageRunner* fResizeRunner; + BStringView* fResizeView; + CharClassifier* fCharClassifier; // Font and Width - BFont fHalfFont; - int fFontWidth; - int fFontHeight; - int fFontAscent; + BFont fHalfFont; + int fFontWidth; + int fFontHeight; + int fFontAscent; struct escapement_delta fEscapement; // frame resized flag. - bool fFrameResized; - int32 fResizeViewDisableCount; + bool fFrameResized; + int32 fResizeViewDisableCount; // Cursor Blinking, draw flag. - bigtime_t fLastActivityTime; - int32 fCursorState; - int fCursorHeight; + bigtime_t fLastActivityTime; + int32 fCursorState; + int fCursorHeight; // Cursor position. - TermPos fCursor; + TermPos fCursor; - int32 fMouseButtons; + int32 fMouseButtons; // Terminal rows and columns. - int fColumns; - int fRows; + int fColumns; + int fRows; - int fEncoding; + int fEncoding; bool fActive; // Object pointer. - TerminalBuffer* fTextBuffer; + TerminalBuffer* fTextBuffer; BasicTerminalBuffer* fVisibleTextBuffer; - BScrollBar* fScrollBar; + BScrollBar* fScrollBar; InlineInput* fInline; // Color and Attribute. - rgb_color fSelectForeColor; - rgb_color fSelectBackColor; + rgb_color fSelectForeColor; + rgb_color fSelectBackColor; // Scroll Region - float fScrollOffset; - int32 fScrBufSize; + float fScrollOffset; + int32 fScrBufSize; // TODO: That's the history capacity -- only needed // until the text buffer is created. - float fAutoScrollSpeed; + float fAutoScrollSpeed; // redraw management - bigtime_t fLastSyncTime; - int32 fScrolledSinceLastSync; - BMessageRunner* fSyncRunner; - bool fConsiderClockedSync; + bigtime_t fLastSyncTime; + int32 fScrolledSinceLastSync; + BMessageRunner* fSyncRunner; + bool fConsiderClockedSync; // selection - TermPos fSelStart; - TermPos fSelEnd; - TermPos fInitialSelectionStart; - TermPos fInitialSelectionEnd; - bool fMouseTracking; - bool fCheckMouseTracking; - int fSelectGranularity; - BPoint fLastClickPoint; + TermPos fSelStart; + TermPos fSelEnd; + TermPos fInitialSelectionStart; + TermPos fInitialSelectionEnd; + bool fMouseTracking; + bool fCheckMouseTracking; + int fSelectGranularity; + BPoint fLastClickPoint; // mouse - TermPos fPrevPos; - bool fReportX10MouseEvent; - bool fReportNormalMouseEvent; - bool fReportButtonMouseEvent; - bool fReportAnyMouseEvent; - BClipboard* fMouseClipboard; + TermPos fPrevPos; + bool fReportX10MouseEvent; + bool fReportNormalMouseEvent; + bool fReportButtonMouseEvent; + bool fReportAnyMouseEvent; + BClipboard* fMouseClipboard; };