* Removed useless context menu.

* Removed useless mouse button preferences.
* The secondary and tertiary buttons now both paste the selection (or clipboard data)
  into the Terminal, this fixes bug #1159.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20772 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-04-20 16:09:27 +00:00
parent 15b4543f2c
commit ef502a7eb3
4 changed files with 313 additions and 486 deletions
+1 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003-2006, Haiku, Inc. All Rights Reserved. * Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
* Copyright (c) 2004 Daniel Furrer <[email protected]> * Copyright (c) 2004 Daniel Furrer <[email protected]>
* Copyright (c) 2003-4 Kian Duffy <[email protected]> * Copyright (c) 2003-4 Kian Duffy <[email protected]>
* Copyright (c) 1998,99 Kazuho Okui and Takashi Murai. * Copyright (c) 1998,99 Kazuho Okui and Takashi Murai.
@@ -55,9 +55,6 @@ static const pref_defaults kTermDefaults[] = {
{ PREF_TEXT_ENCODING, "UTF-8" }, { PREF_TEXT_ENCODING, "UTF-8" },
{ PREF_SELECT_MBUTTON, "Button 1"},
{ PREF_PASTE_MBUTTON, "Button 2"},
{ PREF_SUBMENU_MBUTTON, "Button 3"},
{ PREF_MOUSE_IMAGE, "Hand cursor"}, { PREF_MOUSE_IMAGE, "Hand cursor"},
{ PREF_DRAGN_COPY, "0"}, { PREF_DRAGN_COPY, "0"},
+38 -73
View File
@@ -1,4 +1,5 @@
/* /*
* Copyright 2001-2007, Haiku.
* Copyright (c) 2003-4 Kian Duffy <[email protected]> * Copyright (c) 2003-4 Kian Duffy <[email protected]>
* Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
* *
@@ -30,27 +31,16 @@
#ifndef TERMCONST_H_INCLUDED #ifndef TERMCONST_H_INCLUDED
#define TERMCONST_H_INCLUDED #define TERMCONST_H_INCLUDED
#ifndef NODEBUG
#define MALLOC_DEBUG
#endif
//////////////////////////////////////////////////////////////////////////////
// Application signature (Must same in Muterminal.rsrc)// // Application signature (Must same in Muterminal.rsrc)//
//////////////////////////////////////////////////////////////////////////////
#define TERM_SIGNATURE "application/x-vnd.Haiku-Terminal" #define TERM_SIGNATURE "application/x-vnd.Haiku-Terminal"
#define PREFFILE_MIMETYPE "text/x-terminal-pref" #define PREFFILE_MIMETYPE "text/x-terminal-pref"
//////////////////////////////////////////////////////////////////////////////
// Signature of R5's Terminal. Needed for proper drop-in window count support // Signature of R5's Terminal. Needed for proper drop-in window count support
//////////////////////////////////////////////////////////////////////////////
#define R5_TERM_SIGNATURE "application/x-vnd.Be-SHEL" #define R5_TERM_SIGNATURE "application/x-vnd.Be-SHEL"
////////////////////////////////////////////////////////////////////////////// // Message constants for menu items
// Message constants for menu items.
//////////////////////////////////////////////////////////////////////////////
// Menu Message. // Menu Message
//
const uint32 MENU_SWITCH_TERM = 'MSWT'; const uint32 MENU_SWITCH_TERM = 'MSWT';
const uint32 MENU_NEW_TERM = 'MNTE'; const uint32 MENU_NEW_TERM = 'MNTE';
const uint32 MENU_PREF_OPEN = 'MPre'; const uint32 MENU_PREF_OPEN = 'MPre';
@@ -69,13 +59,11 @@ const uint32 MENU_SHOW_COLOR = 'Mcol';
const uint32 M_GET_DEVICE_NUM = 'Mgdn'; const uint32 M_GET_DEVICE_NUM = 'Mgdn';
// Message Runner. // Message Runner
const uint32 MSGRUN_CURSOR = 'Rcur'; const uint32 MSGRUN_CURSOR = 'Rcur';
const uint32 MSGRUN_WINDOW = 'Rwin'; const uint32 MSGRUN_WINDOW = 'Rwin';
// Preference Message. // Preference Message
//
const ulong PSET__COLS = 'pcol'; const ulong PSET__COLS = 'pcol';
const ulong PSET__ROWS = 'prow'; const ulong PSET__ROWS = 'prow';
const ulong PSET__HFONT = 'phfn'; const ulong PSET__HFONT = 'phfn';
@@ -95,52 +83,43 @@ const uint32 ONETHREETWOTWENTYFIVE = 'hunv';
const uint32 FULLSCREEN = 'fscr'; const uint32 FULLSCREEN = 'fscr';
const uint32 MSG_FONT_CHANGED = 'fntc'; const uint32 MSG_FONT_CHANGED = 'fntc';
const uint32 SAVE_AS_DEFAULT = 'sadf'; const uint32 SAVE_AS_DEFAULT = 'sadf';
////////////////////////////////////////////////////////////////////////////
// Preference Read/Write Keys // Preference Read/Write Keys
//////////////////////////////////////////////////////////////////////////// const char* const PREF_HALF_FONT_FAMILY = "Half Font Famly";
const char * const PREF_HALF_FONT_FAMILY = "Half Font Famly"; const char* const PREF_HALF_FONT_STYLE = "Half Font Style";
const char * const PREF_HALF_FONT_STYLE = "Half Font Style"; const char* const PREF_HALF_FONT_SIZE = "Half Font Size";
const char * const PREF_HALF_FONT_SIZE = "Half Font Size";
const char * const PREF_FULL_FONT_FAMILY = "Full Font Famly"; const char* const PREF_FULL_FONT_FAMILY = "Full Font Famly";
const char * const PREF_FULL_FONT_STYLE = "Full Font Style"; const char* const PREF_FULL_FONT_STYLE = "Full Font Style";
const char * const PREF_FULL_FONT_SIZE = "Full Font Size"; const char* const PREF_FULL_FONT_SIZE = "Full Font Size";
const char * const PREF_TEXT_FORE_COLOR = "Text Foreground Color"; const char* const PREF_TEXT_FORE_COLOR = "Text Foreground Color";
const char * const PREF_TEXT_BACK_COLOR = "Text Background Color"; const char* const PREF_TEXT_BACK_COLOR = "Text Background Color";
const char * const PREF_SELECT_FORE_COLOR = "Selection Foreground Color"; const char* const PREF_SELECT_FORE_COLOR = "Selection Foreground Color";
const char * const PREF_SELECT_BACK_COLOR = "Selection Background Color"; const char* const PREF_SELECT_BACK_COLOR = "Selection Background Color";
const char * const PREF_CURSOR_FORE_COLOR = "Cursor Foreground Color"; const char* const PREF_CURSOR_FORE_COLOR = "Cursor Foreground Color";
const char * const PREF_CURSOR_BACK_COLOR = "Cursor Background Color"; const char* const PREF_CURSOR_BACK_COLOR = "Cursor Background Color";
const char * const PREF_IM_FORE_COLOR = "IM Foreground Color"; const char* const PREF_IM_FORE_COLOR = "IM Foreground Color";
const char * const PREF_IM_BACK_COLOR = "IM Background Color"; const char* const PREF_IM_BACK_COLOR = "IM Background Color";
const char * const PREF_IM_SELECT_COLOR = "IM Selection Color"; const char* const PREF_IM_SELECT_COLOR = "IM Selection Color";
const char * const PREF_DRAGN_COPY = "Drag'n Copy"; const char* const PREF_DRAGN_COPY = "Drag'n Copy";
const char * const PREF_HISTORY_SIZE = "Histry Size"; const char* const PREF_HISTORY_SIZE = "Histry Size";
const char * const PREF_CURSOR_BLINKING = "Cursor Blinking rate"; const char* const PREF_CURSOR_BLINKING = "Cursor Blinking rate";
const char * const PREF_IM_AWARE = "Input Method Aware"; const char* const PREF_IM_AWARE = "Input Method Aware";
const char * const PREF_MOUSE_IMAGE = "Cursor Image"; const char* const PREF_MOUSE_IMAGE = "Cursor Image";
const char * const PREF_SELECT_MBUTTON = "Select Region Buttion"; const char* const PREF_COLS = "Cols";
const char * const PREF_SUBMENU_MBUTTON = "Submenu Mouse Button"; const char* const PREF_ROWS = "Rows";
const char * const PREF_PASTE_MBUTTON = "Paste Mouse Button"; const char* const PREF_SHELL = "Shell";
const char * const PREF_COLS = "Cols"; const char* const PREF_TEXT_ENCODING = "Text encoding";
const char * const PREF_ROWS = "Rows"; const char* const PREF_GUI_LANGUAGE = "Language";
const char * const PREF_SHELL = "Shell";
const char * const PREF_TEXT_ENCODING = "Text encoding";
const char * const PREF_GUI_LANGUAGE = "Language";
////////////////////////////////////////////////////////////////////////////
// Color type // Color type
////////////////////////////////////////////////////////////////////////////
enum { enum {
TEXT_FOREGROUND_COLOR, TEXT_FOREGROUND_COLOR,
TEXT_BACKGROUND_COLOR, TEXT_BACKGROUND_COLOR,
@@ -148,26 +127,21 @@ enum {
SELECTION_BACKGROUND_COLOR SELECTION_BACKGROUND_COLOR
}; };
////////////////////////////////////////////////////////////////////////////
// Preference Folder and setting path // Preference Folder and setting path
////////////////////////////////////////////////////////////////////////////
const int32 DEFAULT = -1; const int32 DEFAULT = -1;
//////////////////////////////////////////////////////////////////////////// // Font Width
//
////////////////////////////////////////////////////////////////////////////
/* Font Width */
const int HALF_WIDTH = 1; const int HALF_WIDTH = 1;
const int FULL_WIDTH = 2; const int FULL_WIDTH = 2;
/* Scroll direction flag */ // Scroll direction flag
enum{ enum{
SCRUP, SCRUP,
SCRDOWN SCRDOWN
}; };
/* Insert mode flag */ // Insert mode flag
#define MODE_OVER 0 #define MODE_OVER 0
#define MODE_INSERT 1 #define MODE_INSERT 1
@@ -179,15 +153,12 @@ const float VIEW_OFFSET = 3;
fFontWidth * (fCurPos.x + 1) - 1, \ fFontWidth * (fCurPos.x + 1) - 1, \
fFontHeight * fCurPos.y + fTop + fCursorHeight - 1) fFontHeight * fCurPos.y + fTop + fCursorHeight - 1)
//////////////////////////////////////////////////////////////////////////// // Define TermBuffer internal code
//
////////////////////////////////////////////////////////////////////////////
/* Define TermBuffer internal code */
#define NO_CHAR 0x00 #define NO_CHAR 0x00
#define A_CHAR 0x01 #define A_CHAR 0x01
#define IN_STRING 0xFF #define IN_STRING 0xFF
/* TermBuffer extended attribute */ // TermBuffer extended attribute
#define A_WIDTH 0x8000 #define A_WIDTH 0x8000
#define BOLD 0x4000 #define BOLD 0x4000
#define UNDERLINE 0x2000 #define UNDERLINE 0x2000
@@ -216,20 +187,14 @@ const float VIEW_OFFSET = 3;
#define FORECOLORED(x) ((x) << 3) #define FORECOLORED(x) ((x) << 3)
#define BACKCOLORED(x) ((x) << 0) #define BACKCOLORED(x) ((x) << 0)
////////////////////////////////////////////////////////////////////////////
// TypeDefs // TypeDefs
////////////////////////////////////////////////////////////////////////////
typedef unsigned short ushort; typedef unsigned short ushort;
typedef struct typedef struct {
{
int x1; int x1;
int y1; int y1;
int x2; int x2;
int y2; int y2;
} } sDrawRect;
sDrawRect;
#endif // TERMCONST_H_INCLUDED
#endif //TERMCONST_H_INCLUDED
+27 -90
View File
@@ -10,6 +10,20 @@
*/ */
#include "TermView.h"
#include "TermWindow.h"
#include "TermApp.h"
#include "TermParse.h"
#include "TermBuffer.h"
#include "CodeConv.h"
#include "VTkeymap.h"
#include "TermConst.h"
#include "PrefHandler.h"
#include "MenuUtil.h"
#include "PrefView.h"
#include "spawn.h"
#include <Autolock.h> #include <Autolock.h>
#include <Beep.h> #include <Beep.h>
#include <Clipboard.h> #include <Clipboard.h>
@@ -29,19 +43,6 @@
#include <new> #include <new>
#include "TermView.h"
#include "TermWindow.h"
#include "TermApp.h"
#include "TermParse.h"
#include "TermBuffer.h"
#include "CodeConv.h"
#include "VTkeymap.h"
#include "TermConst.h"
#include "PrefHandler.h"
#include "MenuUtil.h"
#include "PrefView.h"
#include "spawn.h"
using std::nothrow; using std::nothrow;
// defined VTKeyTbl.c // defined VTKeyTbl.c
@@ -93,9 +94,6 @@ TermView::TermView(BRect frame, CodeConv *inCodeConv, int fd)
fScrBot(fTermRows - 1), fScrBot(fTermRows - 1),
fScrBufSize(gTermPref->getInt32(PREF_HISTORY_SIZE)), fScrBufSize(gTermPref->getInt32(PREF_HISTORY_SIZE)),
fScrRegionSet(0), fScrRegionSet(0),
fPopMenu(NULL),
fPopEncoding(NULL),
fPopSize(NULL),
fSelected(false), fSelected(false),
fMouseTracking(false), fMouseTracking(false),
fViewThread(-1), fViewThread(-1),
@@ -105,20 +103,19 @@ TermView::TermView(BRect frame, CodeConv *inCodeConv, int fd)
fDrawRect_p(0), fDrawRect_p(0),
fIMflag(false) fIMflag(false)
{ {
// Cursor reset. // Reset cursor
fCurPos.Set(0, 0); fCurPos.Set(0, 0);
fCurStack.Set(0, 0); fCurStack.Set(0, 0);
fPreviousMousePoint.Set(0, 0); fPreviousMousePoint.Set(0, 0);
fSelStart.Set(-1, -1); fSelStart.Set(-1, -1);
fSelEnd.Set(-1, -1); fSelEnd.Set(-1, -1);
SetMouseButton();
SetMouseCursor(); SetMouseCursor();
SetTermFont(be_plain_font, be_plain_font); SetTermFont(be_plain_font, be_plain_font);
//SetIMAware(gTermPref->getInt32(PREF_IM_AWARE)); //SetIMAware(gTermPref->getInt32(PREF_IM_AWARE));
InitViewThread(); _InitViewThread();
} }
@@ -166,16 +163,6 @@ TermView::SetTermSize(int rows, int cols, bool resize)
} }
//! Set mouse button assignments
void
TermView::SetMouseButton()
{
mSelectButton = SetupMouseButton(gTermPref->getString(PREF_SELECT_MBUTTON));
mSubMenuButton = SetupMouseButton(gTermPref->getString(PREF_SUBMENU_MBUTTON));
mPasteMenuButton = SetupMouseButton(gTermPref->getString(PREF_PASTE_MBUTTON));
}
//! Sets the mouse cursor image //! Sets the mouse cursor image
void void
TermView::SetMouseCursor() TermView::SetMouseCursor()
@@ -744,7 +731,7 @@ TermView::ScrollAtCursor()
thread_id thread_id
TermView::InitViewThread() TermView::_InitViewThread()
{ {
// spwan Draw Engine thread. // spwan Draw Engine thread.
if (fViewThread < 0) { if (fViewThread < 0) {
@@ -1735,75 +1722,37 @@ TermView::WritePTY(const uchar *text, int numBytes)
} }
//! Make encoding pop up menu (make copy of window's one.)
void
TermView::SetupPop(void)
{
fPopMenu = new BPopUpMenu("");
MakeEncodingMenu(fPopMenu, gNowCoding, true);
fPopMenu->SetTargetForItems(Window());
}
// convert button name to number.
int32
TermView::SetupMouseButton(const char *bname)
{
if (!strcmp(bname, "Disable"))
return 0;
if (!strcmp(bname, "Button 1"))
return B_PRIMARY_MOUSE_BUTTON;
if (!strcmp(bname, "Button 2"))
return B_SECONDARY_MOUSE_BUTTON;
if (!strcmp(bname, "Button 3"))
return B_TERTIARY_MOUSE_BUTTON;
return 0; //Disable
}
void void
TermView::MouseDown(BPoint where) TermView::MouseDown(BPoint where)
{ {
int32 buttons = 0, clicks = 0; int32 buttons;
int32 mod;
BPoint inPoint;
ssize_t num_bytes;
Window()->CurrentMessage()->FindInt32("buttons", &buttons); Window()->CurrentMessage()->FindInt32("buttons", &buttons);
// paste button // paste button
if (buttons == mPasteMenuButton) { if ((buttons & (B_SECONDARY_MOUSE_BUTTON | B_TERTIARY_MOUSE_BUTTON)) != 0) {
if (fSelected) { if (fSelected) {
// If selected region, copy text from region. // copy text from region
BString copyStr(""); BString copy;
fTextBuffer->GetStringFromRegion(copy);
fTextBuffer->GetStringFromRegion(copyStr); WritePTY((uchar *)copy.String(), copy.Length());
num_bytes = copyStr.Length();
WritePTY((uchar *)copyStr.String(), num_bytes);
} else { } else {
// If don't selected, copy text from clipboard. // copy text from clipboard.
DoPaste(); DoPaste();
} }
return; return;
} }
// Select Region // Select Region
if (buttons == mSelectButton) { if (buttons == B_PRIMARY_MOUSE_BUTTON) {
int32 mod, clicks;
Window()->CurrentMessage()->FindInt32("modifiers", &mod); Window()->CurrentMessage()->FindInt32("modifiers", &mod);
Window()->CurrentMessage()->FindInt32("clicks", &clicks); Window()->CurrentMessage()->FindInt32("clicks", &clicks);
if (fSelected) { if (fSelected) {
CurPos inPos, stPos, edPos; CurPos inPos, stPos, edPos;
if (fSelStart < fSelEnd) { if (fSelStart < fSelEnd) {
stPos = fSelStart; stPos = fSelStart;
edPos = fSelEnd; edPos = fSelEnd;
} else { } else {
stPos = fSelEnd; stPos = fSelEnd;
edPos = fSelStart; edPos = fSelStart;
@@ -1814,12 +1763,9 @@ TermView::MouseDown(BPoint where)
// If mouse pointer is avove selected Region, start Drag'n Copy. // If mouse pointer is avove selected Region, start Drag'n Copy.
if (inPos > stPos && inPos < edPos) { if (inPos > stPos && inPos < edPos) {
if (mod & B_CONTROL_KEY || gTermPref->getInt32(PREF_DRAGN_COPY)) { if (mod & B_CONTROL_KEY || gTermPref->getInt32(PREF_DRAGN_COPY)) {
BPoint p; BPoint p;
uint32 bt; uint32 bt;
do { do {
GetMouse(&p, &bt); GetMouse(&p, &bt);
if (bt == 0) { if (bt == 0) {
@@ -1861,7 +1807,7 @@ TermView::MouseDown(BPoint where)
} }
// If mouse has a lot of movement, disable double/triple click. // If mouse has a lot of movement, disable double/triple click.
inPoint = fPreviousMousePoint - where; BPoint inPoint = fPreviousMousePoint - where;
if (abs((int)inPoint.x) > 16 || abs((int)inPoint.y) > 16) if (abs((int)inPoint.x) > 16 || abs((int)inPoint.y) > 16)
clicks = 1; clicks = 1;
@@ -1895,15 +1841,6 @@ TermView::MouseDown(BPoint where)
return; return;
} }
// Sub menu(coding popup menu)
if (buttons == mSubMenuButton){
ConvertToScreen(&where);
SetupPop();
fPopMenu->Go(where, true);
delete fPopMenu;
return;
}
BView::MouseDown(where); BView::MouseDown(where);
} }
+101 -173
View File
@@ -1,4 +1,5 @@
/* /*
* Copyright 2001-2007, Haiku.
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net> * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
* *
@@ -27,16 +28,17 @@
* THE SOFTWARE. * THE SOFTWARE.
* *
*/ */
#ifndef TERMVIEW_H #ifndef TERMVIEW_H
#define TERMVIEW_H #define TERMVIEW_H
#include "CurPos.h"
#include "TermConst.h"
#include "TermWindow.h"
#include <View.h> #include <View.h>
#include <String.h> #include <String.h>
#include <MessageRunner.h> #include <MessageRunner.h>
#include "TermConst.h"
#include "TermWindow.h"
#include "CurPos.h"
/* Cursor Blinking flag */ /* Cursor Blinking flag */
#define CUROFF 0 #define CUROFF 0
@@ -51,6 +53,7 @@ const unsigned char M_ADD_CURSOR [] = {
1, // Color depth 1, // Color depth
0, // Hot spot y 0, // Hot spot y
1, // Hot spot x 1, // Hot spot x
// Cursor image // Cursor image
0x70, 0x00, 0x70, 0x00,
0x48, 0x00, 0x48, 0x00,
@@ -93,201 +96,150 @@ class BPopUpMenu;
class BScrollBar; class BScrollBar;
class BString; class BString;
class TermView : public BView class TermView : public BView {
{ public:
public: TermView(BRect frame, CodeConv *inCodeConv, int fd);
// ~TermView();
// Constructor, Destructor, and Initializer.
//
TermView (BRect frame, CodeConv *inCodeConv, int fd);
~TermView ();
//
// Initializer, Set function
//
void SetTermFont(const BFont *halfFont, const BFont *fullFont); void SetTermFont(const BFont *halfFont, const BFont *fullFont);
void GetFontSize (int *width, int *height); void GetFontSize(int *width, int *height);
BRect SetTermSize (int rows, int cols, bool flag); BRect SetTermSize(int rows, int cols, bool flag);
void SetTermColor (void); void SetTermColor();
void SetMouseButton (void); void SetMouseCursor();
void SetMouseCursor (void);
// void SetIMAware (bool); // void SetIMAware (bool);
void SetScrollBar (BScrollBar *scrbar); void SetScrollBar(BScrollBar *scrbar);
BScrollBar *ScrollBar () const { return fScrollBar; }; BScrollBar *ScrollBar() const { return fScrollBar; };
// // Output Charactor
// Output Charactor. void PutChar(uchar *string, ushort attr, int width);
// void PutCR(void);
void PutChar (uchar *string, ushort attr, int width); void PutLF(void);
void PutCR (void); void PutNL(int num);
void PutLF (void); void SetInsertMode(int flag);
void PutNL (int num); void InsertSpace(int num);
void SetInsertMode (int flag);
void InsertSpace (int num);
int TermDraw (const CurPos &start, const CurPos &end); int TermDraw(const CurPos &start, const CurPos &end);
int TermDrawRegion (CurPos start, CurPos end); int TermDrawRegion(CurPos start, CurPos end);
int TermDrawSelectedRegion (CurPos start, CurPos end); int TermDrawSelectedRegion(CurPos start, CurPos end);
// // Delete Charactor
// Delete Charactor. void EraseBelow();
// void DeleteChar(int num);
void EraseBelow (void); void DeleteColumns();
void DeleteChar (int num); void DeleteLine(int num);
void DeleteColumns (void);
void DeleteLine (int num);
// // Get and Set Cursor position
// Get and Set Cursor position. void SetCurPos(int x, int y);
// void SetCurX(int x);
void SetCurPos (int x, int y); void SetCurY(int y);
void SetCurX (int x);
void SetCurY (int y);
void GetCurPos (CurPos *inCurPos); void GetCurPos(CurPos *inCurPos);
int GetCurX (void); int GetCurX();
int GetCurY (void); int GetCurY();
void SaveCursor (void); void SaveCursor();
void RestoreCursor (void); void RestoreCursor();
//
// Move Cursor // Move Cursor
// void MoveCurRight(int num);
void MoveCurRight (int num); void MoveCurLeft(int num);
void MoveCurLeft (int num); void MoveCurUp(int num);
void MoveCurUp (int num); void MoveCurDown(int num);
void MoveCurDown (int num);
// // Cursor setting
// Cursor setting. void DrawCursor();
// void BlinkCursor();
void DrawCursor (void); void SetCurDraw(bool flag);
void BlinkCursor (void); void SetCurBlinking(bool flag);
void SetCurDraw (bool flag);
void SetCurBlinking (bool flag);
// // Scroll region
// Scroll region. void ScrollRegion(int top, int bot, int dir, int num);
// void SetScrollRegion(int top, int bot);
void ScrollRegion (int top, int bot, int dir, int num); void ScrollAtCursor();
void SetScrollRegion (int top, int bot);
void ScrollAtCursor (void);
// // Other
// Other.
//
void UpdateSIGWINCH(); void UpdateSIGWINCH();
void DeviceStatusReport (int); void DeviceStatusReport(int);
void UpdateLine (void); void UpdateLine();
void ScrollScreen (void); void ScrollScreen();
void ScrollScreenDraw (void); void ScrollScreenDraw();
void GetFrameSize (float *width, float *height); void GetFrameSize(float *width, float *height);
void GetFontInfo (int *, int*); void GetFontInfo(int *, int*);
bool Find (const BString &str, bool forwardSearch, bool matchCase, bool matchWord); bool Find(const BString &str, bool forwardSearch, bool matchCase, bool matchWord);
void GetSelection (BString &str); void GetSelection(BString &str);
/* protected:
* PRIVATE MEMBER. virtual void AttachedToWindow(void);
*/ virtual void Draw(BRect updateRect);
virtual void WindowActivated(bool active);
virtual void KeyDown(const char*, int32);
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint, uint32, const BMessage *);
private: virtual void FrameResized(float width, float height);
/* virtual void MessageReceived(BMessage* message);
* static Functions (Thread functions).
*/
static int32 ViewThread (void *); private:
static int32 MouseTracking (void *); static int32 ViewThread(void *);
static int32 MouseTracking(void *);
/*
* Hook Functions.
*/
void AttachedToWindow (void);
void Draw (BRect updateRect);
void WindowActivated (bool active);
void KeyDown (const char*, int32);
void MouseDown (BPoint where);
void MouseMoved (BPoint, uint32, const BMessage *);
void FrameResized(float width, float height);
void MessageReceived(BMessage* message);
/*
* Private Member Functions.
*/
thread_id InitViewThread (void);
inline void DrawLines (int , int, ushort, uchar *, int, int, int, BView *);
thread_id _InitViewThread(void);
void DrawLines(int , int, ushort, uchar *, int, int, int, BView *);
void DoPrint(BRect updateRect); void DoPrint(BRect updateRect);
void ResizeScrBarRange (void); void ResizeScrBarRange (void);
void DoFileDrop(entry_ref &ref); void DoFileDrop(entry_ref &ref);
// edit menu function. // edit menu function.
void DoCopy (void); void DoCopy();
void DoPaste (void); void DoPaste();
void DoSelectAll (void); void DoSelectAll();
void DoClearAll (void); void DoClearAll();
int SubstMetaChar (const char *p, char *q); int SubstMetaChar (const char *p, char *q);
void WritePTY (const uchar *text, int num_byteses); void WritePTY (const uchar *text, int num_byteses);
// Comunicate Input Method // Comunicate Input Method
// void DoIMStart (BMessage* message); // void DoIMStart (BMessage* message);
// void DoIMStop (BMessage* message); // void DoIMStop (BMessage* message);
// void DoIMChange (BMessage* message); // void DoIMChange (BMessage* message);
// void DoIMLocation (BMessage* message); // void DoIMLocation (BMessage* message);
// void DoIMConfirm (void); // void DoIMConfirm (void);
void ConfirmString (const char *, int32); void ConfirmString (const char *, int32);
int32 GetCharFromUTF8String (const char *, char *); int32 GetCharFromUTF8String (const char *, char *);
int32 GetWidthFromUTF8String (const char *); int32 GetWidthFromUTF8String (const char *);
// mouse operation // mouse operation
void SetupPop (void); int32 SetupMouseButton(const char *bname);
int32 SetupMouseButton (const char *bname);
// Mouse select // Mouse select
void Select (CurPos start, CurPos end); void Select(CurPos start, CurPos end);
void AddSelectRegion (CurPos); void AddSelectRegion(CurPos);
void ResizeSelectRegion (CurPos); void ResizeSelectRegion(CurPos);
void DeSelect(void); void DeSelect();
// select word function // select word function
void SelectWord (BPoint where, int mod); void SelectWord(BPoint where, int mod);
void SelectLine (BPoint where, int mod); void SelectLine(BPoint where, int mod);
// point and text offset conversion. // point and text offset conversion.
CurPos BPointToCurPos (const BPoint &p); CurPos BPointToCurPos(const BPoint &p);
BPoint CurPosToBPoint (const CurPos &pos); BPoint CurPosToBPoint(const CurPos &pos);
bool CheckSelectedRegion (const CurPos &pos); bool CheckSelectedRegion(const CurPos &pos);
inline void SendDataToDrawEngine(int, int, int, int);
inline void SendDataToDrawEngine (int, int, int, int);
/*
* DATA Member.
*/
int fTerminalFd; int fTerminalFd;
//
// Font and Width. // Font and Width
//
BFont fHalfFont; BFont fHalfFont;
BFont fFullFont; BFont fFullFont;
int fFontWidth; int fFontWidth;
int fFontHeight; int fFontHeight;
int fFontAscent; int fFontAscent;
struct escapement_delta fEscapement; struct escapement_delta fEscapement;
// // Flags
// Flags.
//
// Update flag (Set on PutChar). // Update flag (Set on PutChar).
bool fUpdateFlag; bool fUpdateFlag;
@@ -315,66 +267,43 @@ private:
bool fBoldFlag; bool fBoldFlag;
bool fUnderlineFlag; bool fUnderlineFlag;
//
// Cursor position. // Cursor position.
//
CurPos fCurPos; CurPos fCurPos;
CurPos fCurStack; CurPos fCurStack;
int fBufferStartPos; int fBufferStartPos;
//
// Terminal rows and columns. // Terminal rows and columns.
//
int fTermRows; int fTermRows;
int fTermColumns; int fTermColumns;
//
// Terminal view pointer. // Terminal view pointer.
//
int fTop; int fTop;
//
// Object pointer. // Object pointer.
//
TermBuffer *fTextBuffer; TermBuffer *fTextBuffer;
CodeConv *fCodeConv; CodeConv *fCodeConv;
BScrollBar *fScrollBar; BScrollBar *fScrollBar;
//
// Offscreen Bitmap and View. // Offscreen Bitmap and View.
//
BRect fSrcRect; BRect fSrcRect;
BRect fDstRect; BRect fDstRect;
//
// Color and Attribute. // Color and Attribute.
//
// text fore and back color
rgb_color fTextForeColor, fTextBackColor; rgb_color fTextForeColor, fTextBackColor;
// cursor fore and back color
rgb_color fCursorForeColor, fCursorBackColor; rgb_color fCursorForeColor, fCursorBackColor;
// selected region color
rgb_color fSelectForeColor, fSelectBackColor; rgb_color fSelectForeColor, fSelectBackColor;
uchar fTermAttr; uchar fTermAttr;
//
// Scroll Region // Scroll Region
//
int fScrTop; int fScrTop;
int fScrBot; int fScrBot;
int fScrBufSize; int fScrBufSize;
bool fScrRegionSet; bool fScrRegionSet;
BPopUpMenu *fPopMenu;
BMenu *fPopEncoding;
BMenu *fPopSize;
// mouse // mouse
int32 mSelectButton; int32 mSelectButton;
int32 mSubMenuButton; int32 mSubMenuButton;
@@ -409,7 +338,6 @@ private:
BMessenger fIMMessenger; BMessenger fIMMessenger;
int32 fImCodeState; int32 fImCodeState;
}; };