Moved all TermView initializing code into TermView itself. Before you
couldn't just rely on its constructor to fully initialize the object, since the code was scattered around, mostly into TermWindow. Added a commented out TermWindow constructor which only creates and adds a TermView object to the view hierarchy, which now works. Removed weird TermWindowActivate method, use WindowActivated instead. TermApp can now keep a pointer to a BWindow instead of TermWindow, since it doesn't do anything special with it. TermView::SetTermFont() now can filter the font attributes (it uses B_FIXED_SPACING, I'm not sure it's needed but it doesn't hurt). Usual cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21698 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
#include "TTextControl.h"
|
||||
|
||||
|
||||
extern PrefHandler *PrefHandler::Default();
|
||||
|
||||
|
||||
ShellPrefView::ShellPrefView(BRect frame, const char *name,
|
||||
TermWindow *window)
|
||||
|
||||
@@ -146,7 +146,7 @@ TermApp::MessageReceived(BMessage* msg)
|
||||
break;
|
||||
|
||||
case MSG_ACTIVATE_TERM:
|
||||
fTermWindow->TermWinActivate();
|
||||
fTermWindow->Activate();
|
||||
break;
|
||||
|
||||
case MSG_TERM_IS_MINIMIZE:
|
||||
|
||||
@@ -35,11 +35,8 @@
|
||||
#include <Application.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class TermWindow;
|
||||
class TermParse;
|
||||
class BRect;
|
||||
|
||||
class BWindow;
|
||||
class TermApp : public BApplication {
|
||||
public:
|
||||
TermApp();
|
||||
@@ -71,7 +68,7 @@ class TermApp : public BApplication {
|
||||
BString fWindowTitle;
|
||||
int32 fWindowNumber;
|
||||
|
||||
TermWindow* fTermWindow;
|
||||
BWindow* fTermWindow;
|
||||
BRect fTermFrame;
|
||||
BString fCommandLine;
|
||||
};
|
||||
|
||||
@@ -61,8 +61,6 @@ const uint32 MENU_SHOW_COLOR = 'Mcol';
|
||||
|
||||
const uint32 M_GET_DEVICE_NUM = 'Mgdn';
|
||||
|
||||
// Message Runner
|
||||
const uint32 MSGRUN_WINDOW = 'Rwin';
|
||||
|
||||
// Preference Message
|
||||
const ulong PSET__COLS = 'pcol';
|
||||
|
||||
@@ -17,18 +17,19 @@
|
||||
#include "PrefHandler.h"
|
||||
#include "PrefView.h"
|
||||
#include "Shell.h"
|
||||
#include "TermApp.h"
|
||||
#include "TermBuffer.h"
|
||||
#include "TermConst.h"
|
||||
#include "TermParse.h"
|
||||
#include "TermWindow.h"
|
||||
#include "VTkeymap.h"
|
||||
|
||||
#include <Application.h>
|
||||
#include <Autolock.h>
|
||||
#include <Beep.h>
|
||||
#include <Clipboard.h>
|
||||
#include <Debug.h>
|
||||
#include <Input.h>
|
||||
#include <Message.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <Path.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Roster.h>
|
||||
@@ -107,6 +108,9 @@ const unsigned char M_ADD_CURSOR[] = {
|
||||
|
||||
#define MOUSE_THR_CODE 'mtcd'
|
||||
|
||||
const static uint32 kUpdateSigWinch = 'Rwin';
|
||||
|
||||
|
||||
TermView::TermView(BRect frame, const char *command)
|
||||
: BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED),
|
||||
fShell(NULL),
|
||||
@@ -151,13 +155,16 @@ TermView::TermView(BRect frame, const char *command)
|
||||
|
||||
SetMouseCursor();
|
||||
|
||||
SetTermFont(be_plain_font, be_plain_font);
|
||||
SetTermFont(be_plain_font, be_plain_font);
|
||||
SetTermColor();
|
||||
|
||||
//SetIMAware(PrefHandler::Default()->getInt32(PREF_IM_AWARE));
|
||||
|
||||
// Get encoding name (setenv TTYPE in spawn_shell functions)
|
||||
const char *encoding = longname2shortname(PrefHandler::Default()->getString(PREF_TEXT_ENCODING));
|
||||
const char *encoding = PrefHandler::Default()->getString(PREF_TEXT_ENCODING);
|
||||
SetEncoding(longname2id(encoding));
|
||||
|
||||
fShell = new Shell();
|
||||
status_t status = fShell->Open(fTermRows, fTermColumns, command, encoding);
|
||||
status_t status = fShell->Open(fTermRows, fTermColumns, command, longname2shortname(encoding));
|
||||
if (status < B_OK)
|
||||
throw status;
|
||||
|
||||
@@ -165,6 +172,8 @@ TermView::TermView(BRect frame, const char *command)
|
||||
if (status < B_OK)
|
||||
throw status;
|
||||
|
||||
SetTermSize(fTermColumns, fTermRows, false);
|
||||
|
||||
_InitMouseThread();
|
||||
}
|
||||
|
||||
@@ -181,6 +190,16 @@ TermView::~TermView()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermView::GetPreferredSize(float *width, float *height)
|
||||
{
|
||||
if (width)
|
||||
*width = fTermColumns * fFontWidth;
|
||||
if (height)
|
||||
*height = fTermRows * fFontHeight;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TermView::AttachShell(Shell *shell)
|
||||
{
|
||||
@@ -240,7 +259,7 @@ TermView::SetTermSize(int rows, int cols, bool resize)
|
||||
if (resize)
|
||||
ResizeTo(fTermColumns * fFontWidth - 1, fTermRows * fFontHeight -1);
|
||||
|
||||
Invalidate(Frame());
|
||||
Invalidate();
|
||||
|
||||
return rect;
|
||||
}
|
||||
@@ -283,6 +302,9 @@ TermView::SetTermFont(const BFont *halfFont, const BFont *fullFont)
|
||||
fHalfFont = halfFont;
|
||||
fFullFont = fullFont;
|
||||
|
||||
_FixFontAttributes(fHalfFont);
|
||||
_FixFontAttributes(fFullFont);
|
||||
|
||||
// calculate half font's max width
|
||||
// Not Bounding, check only A-Z(For case of fHalfFont is KanjiFont. )
|
||||
for (int c = 0x20 ; c <= 0x7e; c++){
|
||||
@@ -929,8 +951,7 @@ TermView::MouseTracking(void *data)
|
||||
}
|
||||
|
||||
// Scroll check
|
||||
if (theObj->LockLooper()) {
|
||||
|
||||
if (theObj->fScrollBar != NULL && theObj->LockLooper()) {
|
||||
// Get now scroll point
|
||||
theObj->fScrollBar->GetRange(&scr_start, &scr_end);
|
||||
scr_pos = theObj->fScrollBar->Value();
|
||||
@@ -1039,10 +1060,11 @@ TermView::DrawLines(int x1, int y1, ushort attr, uchar *buf,
|
||||
void
|
||||
TermView::ResizeScrBarRange()
|
||||
{
|
||||
float viewheight, start_pos;
|
||||
if (fScrollBar == NULL)
|
||||
return;
|
||||
|
||||
viewheight = fTermRows * fFontHeight;
|
||||
start_pos = fTop -(fScrBufSize - fTermRows *2) * fFontHeight;
|
||||
float viewheight = fTermRows * fFontHeight;
|
||||
float start_pos = fTop -(fScrBufSize - fTermRows *2) * fFontHeight;
|
||||
|
||||
if (start_pos > 0) {
|
||||
fScrollBar->SetRange(start_pos, viewheight + fTop - fFontHeight);
|
||||
@@ -1153,12 +1175,24 @@ TermView::AttachedToWindow()
|
||||
{
|
||||
SetFont(&fHalfFont);
|
||||
MakeFocus(true);
|
||||
fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows);
|
||||
if (fScrollBar)
|
||||
fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows);
|
||||
|
||||
BMessage message(kUpdateSigWinch);
|
||||
fWinchRunner = new (std::nothrow) BMessageRunner(BMessenger(this), &message, 500000);
|
||||
|
||||
Window()->SetPulseRate(1000000);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermView::DetachedFromWindow()
|
||||
{
|
||||
delete fWinchRunner;
|
||||
fWinchRunner = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermView::Pulse()
|
||||
{
|
||||
@@ -1293,11 +1327,7 @@ TermView::WindowActivated(bool active)
|
||||
void
|
||||
TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
{
|
||||
char c;
|
||||
struct termios tio;
|
||||
int32 key, mod;
|
||||
|
||||
uchar dstbuf[1024];
|
||||
Looper()->CurrentMessage()->FindInt32("modifiers", &mod);
|
||||
Looper()->CurrentMessage()->FindInt32("key", &key);
|
||||
|
||||
@@ -1306,6 +1336,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
|
||||
// If bytes[0] equal intr charactor,
|
||||
// send signal to shell process group.
|
||||
struct termios tio;
|
||||
fShell->GetAttr(tio);
|
||||
if (*bytes == tio.c_cc[VINTR]) {
|
||||
if (tio.c_lflag & ISIG)
|
||||
@@ -1315,31 +1346,19 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
// Terminal changes RET, ENTER, F1...F12, and ARROW key code.
|
||||
|
||||
if (numBytes == 1) {
|
||||
|
||||
switch (*bytes) {
|
||||
case B_RETURN:
|
||||
c = 0x0d;
|
||||
if (key == RETURN_KEY || key == ENTER_KEY) {
|
||||
fShell->Write(&c, 1);
|
||||
return;
|
||||
} else {
|
||||
fShell->Write(bytes, numBytes);
|
||||
return;
|
||||
}
|
||||
{
|
||||
char c = 0x0d;
|
||||
fShell->Write(&c, 1);
|
||||
break;
|
||||
|
||||
}
|
||||
case B_LEFT_ARROW:
|
||||
if (key == LEFT_ARROW_KEY) {
|
||||
fShell->Write(LEFT_ARROW_KEY_CODE, sizeof(LEFT_ARROW_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(LEFT_ARROW_KEY_CODE, sizeof(LEFT_ARROW_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_RIGHT_ARROW:
|
||||
if (key == RIGHT_ARROW_KEY) {
|
||||
fShell->Write(RIGHT_ARROW_KEY_CODE, sizeof(RIGHT_ARROW_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(RIGHT_ARROW_KEY_CODE, sizeof(RIGHT_ARROW_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_UP_ARROW:
|
||||
@@ -1351,10 +1370,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == UP_ARROW_KEY) {
|
||||
fShell->Write(UP_ARROW_KEY_CODE, sizeof(UP_ARROW_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(UP_ARROW_KEY_CODE, sizeof(UP_ARROW_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_DOWN_ARROW:
|
||||
@@ -1364,24 +1380,15 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == DOWN_ARROW_KEY) {
|
||||
fShell->Write(DOWN_ARROW_KEY_CODE, sizeof(DOWN_ARROW_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(DOWN_ARROW_KEY_CODE, sizeof(DOWN_ARROW_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_INSERT:
|
||||
if (key == INSERT_KEY) {
|
||||
fShell->Write(INSERT_KEY_CODE, sizeof(INSERT_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(INSERT_KEY_CODE, sizeof(INSERT_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_HOME:
|
||||
if (key == HOME_KEY) {
|
||||
fShell->Write(HOME_KEY_CODE, sizeof(HOME_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(HOME_KEY_CODE, sizeof(HOME_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_PAGE_UP:
|
||||
@@ -1393,10 +1400,7 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == PAGE_UP_KEY) {
|
||||
fShell->Write(PAGE_UP_KEY_CODE, sizeof(PAGE_UP_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(PAGE_UP_KEY_CODE, sizeof(PAGE_UP_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_PAGE_DOWN:
|
||||
@@ -1406,21 +1410,15 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key == PAGE_DOWN_KEY) {
|
||||
fShell->Write(PAGE_DOWN_KEY_CODE, sizeof(PAGE_DOWN_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(PAGE_DOWN_KEY_CODE, sizeof(PAGE_DOWN_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_END:
|
||||
if (key == END_KEY) {
|
||||
fShell->Write(END_KEY_CODE, sizeof(END_KEY_CODE)-1);
|
||||
return;
|
||||
}
|
||||
fShell->Write(END_KEY_CODE, sizeof(END_KEY_CODE)-1);
|
||||
break;
|
||||
|
||||
case B_FUNCTION_KEY:
|
||||
for (c = 0; c < 12; c++) {
|
||||
for (int32 c = 0; c < 12; c++) {
|
||||
if (key == function_keycode_table[c]) {
|
||||
fShell->Write(function_key_char_table[c], 5);
|
||||
return;
|
||||
@@ -1429,33 +1427,31 @@ TermView::KeyDown(const char *bytes, int32 numBytes)
|
||||
break;
|
||||
|
||||
default:
|
||||
fShell->Write(bytes, numBytes);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// input multibyte character
|
||||
|
||||
if (GetEncoding() != M_UTF8) {
|
||||
uchar dstbuf[1024];
|
||||
int cnum = CodeConv::ConvertFromInternal(bytes, numBytes,
|
||||
(char *)dstbuf, GetEncoding());
|
||||
fShell->Write(dstbuf, cnum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fShell->Write(bytes, numBytes);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermView::FrameResized(float width, float height)
|
||||
{
|
||||
const int cols =((int)width + 1) / fFontWidth;
|
||||
const int rows =((int)height + 1) / fFontHeight;
|
||||
const int cols = ((int)width + 1) / fFontWidth;
|
||||
const int rows = ((int)height + 1) / fFontHeight;
|
||||
|
||||
int offset = 0;
|
||||
|
||||
if (rows < fCurPos.y + 1) {
|
||||
fTop +=(fCurPos.y + 1 - rows) * fFontHeight;
|
||||
fTop += (fCurPos.y + 1 - rows) * fFontHeight;
|
||||
offset = fCurPos.y + 1 - rows;
|
||||
fCurPos.y = rows - 1;
|
||||
}
|
||||
@@ -1464,6 +1460,9 @@ TermView::FrameResized(float width, float height)
|
||||
fTermColumns = cols;
|
||||
|
||||
fFrameResized = true;
|
||||
|
||||
// TODO: Fix this
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
@@ -1550,6 +1549,9 @@ TermView::MessageReceived(BMessage *msg)
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
case kUpdateSigWinch:
|
||||
UpdateSIGWINCH();
|
||||
break;
|
||||
default:
|
||||
BView::MessageReceived(msg);
|
||||
break;
|
||||
@@ -1666,9 +1668,11 @@ TermView::DoClearAll(void)
|
||||
|
||||
// reset cursor pos
|
||||
SetCurPos(0, 0);
|
||||
|
||||
fScrollBar->SetRange(0, 0);
|
||||
fScrollBar->SetProportion(1);
|
||||
|
||||
if (fScrollBar) {
|
||||
fScrollBar->SetRange(0, 0);
|
||||
fScrollBar->SetProportion(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2223,3 +2227,12 @@ TermView::Redraw(int x1, int y1, int x2, int y2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
void
|
||||
TermView::_FixFontAttributes(BFont &font)
|
||||
{
|
||||
font.SetSpacing(B_FIXED_SPACING);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#define CUROFF 0
|
||||
#define CURON 1
|
||||
|
||||
class BMessageRunner;
|
||||
class BPopUpMenu;
|
||||
class BScrollBar;
|
||||
class BString;
|
||||
@@ -54,6 +55,8 @@ public:
|
||||
TermView(BRect frame, const char *command);
|
||||
~TermView();
|
||||
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
|
||||
status_t AttachShell(Shell *shell);
|
||||
void DetachShell();
|
||||
|
||||
@@ -61,8 +64,10 @@ public:
|
||||
|
||||
void SetTermFont(const BFont *halfFont, const BFont *fullFont);
|
||||
void GetFontSize(int *width, int *height);
|
||||
|
||||
BRect SetTermSize(int rows, int cols, bool flag);
|
||||
void SetTermColor();
|
||||
|
||||
void SetMouseCursor();
|
||||
// void SetIMAware (bool);
|
||||
void SetScrollBar(BScrollBar *scrbar);
|
||||
@@ -124,6 +129,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void Pulse();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void WindowActivated(bool active);
|
||||
@@ -180,8 +186,12 @@ private:
|
||||
bool CheckSelectedRegion(const CurPos &pos);
|
||||
inline void Redraw(int, int, int, int);
|
||||
|
||||
static void _FixFontAttributes(BFont &font);
|
||||
|
||||
Shell *fShell;
|
||||
|
||||
BMessageRunner *fWinchRunner;
|
||||
|
||||
// Font and Width
|
||||
BFont fHalfFont;
|
||||
BFont fFullFont;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <Menu.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuItem.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <Path.h>
|
||||
#include <PrintJob.h>
|
||||
#include <PropertyInfo.h>
|
||||
@@ -52,6 +51,16 @@
|
||||
|
||||
const static float kViewOffset = 3;
|
||||
|
||||
#if 0
|
||||
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
||||
:
|
||||
BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE)
|
||||
{
|
||||
fTermView = new TermView(Bounds(), command);
|
||||
AddChild(fTermView);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
||||
: BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
|
||||
@@ -67,7 +76,6 @@ TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
||||
fPrintSettings(NULL),
|
||||
fPrefWindow(NULL),
|
||||
fFindPanel(NULL),
|
||||
fWindowUpdate(NULL),
|
||||
fSavedFrame(0, 0, -1, -1),
|
||||
fFindString(""),
|
||||
fFindForwardMenuItem(NULL),
|
||||
@@ -79,7 +87,7 @@ TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
||||
{
|
||||
_InitWindow(command);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TermWindow::~TermWindow()
|
||||
{
|
||||
@@ -92,8 +100,6 @@ TermWindow::~TermWindow()
|
||||
}
|
||||
|
||||
PrefHandler::DeleteDefault();
|
||||
|
||||
delete fWindowUpdate;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,8 +123,7 @@ TermWindow::_InitWindow(const char *command)
|
||||
if (size < 6.0f)
|
||||
size = 6.0f;
|
||||
halfFont.SetSize(size);
|
||||
halfFont.SetSpacing(B_FIXED_SPACING);
|
||||
|
||||
|
||||
family = PrefHandler::Default()->getString(PREF_FULL_FONT_FAMILY);
|
||||
|
||||
BFont fullFont;
|
||||
@@ -146,8 +151,6 @@ TermWindow::_InitWindow(const char *command)
|
||||
fTermView->GetFontSize(&width, &height);
|
||||
SetSizeLimits(MIN_COLS * width, MAX_COLS * width,
|
||||
MIN_COLS * height, MAX_COLS * height);
|
||||
|
||||
fTermView->SetTermColor();
|
||||
|
||||
// Add offset to baseview.
|
||||
rect.InsetBy(-kViewOffset, -kViewOffset);
|
||||
@@ -173,13 +176,6 @@ TermWindow::_InitWindow(const char *command)
|
||||
AddChild(fTermView);
|
||||
|
||||
fEditmenu->SetTargetForItems(fTermView);
|
||||
|
||||
// Initialize TermParse
|
||||
SetEncoding(longname2id(PrefHandler::Default()->getString(PREF_TEXT_ENCODING)));
|
||||
|
||||
// Initialize MessageRunner.
|
||||
fWindowUpdate = new BMessageRunner(BMessenger(this),
|
||||
new BMessage (MSGRUN_WINDOW), 500000);
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +425,7 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
PrefHandler::Default()->getInt32 (PREF_COLS), 0);
|
||||
|
||||
ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2,
|
||||
r.Height()+fMenubar->Bounds().Height() + kViewOffset *2);
|
||||
r.Height()+fMenubar->Bounds().Height() + kViewOffset *2);
|
||||
|
||||
BPath path;
|
||||
if (PrefHandler::GetDefaultPath(path) == B_OK)
|
||||
@@ -468,36 +464,31 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
case EIGHTYTWENTYFOUR: {
|
||||
PrefHandler::Default()->setString(PREF_COLS, "80");
|
||||
PrefHandler::Default()->setString(PREF_ROWS, "24");
|
||||
this->PostMessage (MSG_ROWS_CHANGED);
|
||||
this->PostMessage (MSG_COLS_CHANGED);
|
||||
PostMessage (MSG_COLS_CHANGED);
|
||||
break;
|
||||
}
|
||||
case EIGHTYTWENTYFIVE: {
|
||||
PrefHandler::Default()->setString(PREF_COLS, "80");
|
||||
PrefHandler::Default()->setString(PREF_ROWS, "25");
|
||||
this->PostMessage (MSG_ROWS_CHANGED);
|
||||
this->PostMessage (MSG_COLS_CHANGED);
|
||||
PostMessage (MSG_COLS_CHANGED);
|
||||
break;
|
||||
}
|
||||
case EIGHTYFORTY: {
|
||||
PrefHandler::Default()->setString(PREF_COLS, "80");
|
||||
PrefHandler::Default()->setString(PREF_ROWS, "40");
|
||||
this->PostMessage (MSG_ROWS_CHANGED);
|
||||
this->PostMessage (MSG_COLS_CHANGED);
|
||||
PostMessage (MSG_COLS_CHANGED);
|
||||
break;
|
||||
}
|
||||
case ONETHREETWOTWENTYFOUR: {
|
||||
PrefHandler::Default()->setString(PREF_COLS, "132");
|
||||
PrefHandler::Default()->setString(PREF_ROWS, "24");
|
||||
this->PostMessage (MSG_ROWS_CHANGED);
|
||||
this->PostMessage (MSG_COLS_CHANGED);
|
||||
PostMessage (MSG_COLS_CHANGED);
|
||||
break;
|
||||
}
|
||||
case ONETHREETWOTWENTYFIVE: {
|
||||
PrefHandler::Default()->setString(PREF_COLS, "132");
|
||||
PrefHandler::Default()->setString(PREF_ROWS, "25");
|
||||
this->PostMessage (MSG_ROWS_CHANGED);
|
||||
this->PostMessage (MSG_COLS_CHANGED);
|
||||
PostMessage (MSG_COLS_CHANGED);
|
||||
break;
|
||||
}
|
||||
case FULLSCREEN: {
|
||||
@@ -549,10 +540,7 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
_DoPrint();
|
||||
break;
|
||||
}
|
||||
case MSGRUN_WINDOW: {
|
||||
fTermView->UpdateSIGWINCH();
|
||||
break;
|
||||
}
|
||||
|
||||
case B_ABOUT_REQUESTED: {
|
||||
be_app->PostMessage(B_ABOUT_REQUESTED);
|
||||
break;
|
||||
@@ -563,14 +551,18 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// WindowActivated (bool)
|
||||
// Dispatch Mesasge.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void
|
||||
TermWindow::WindowActivated(bool)
|
||||
{
|
||||
|
||||
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||
if (focus_follows_mouse()) {
|
||||
BPoint aMouseLoc = Frame().LeftTop();
|
||||
set_mouse_position(int32(aMouseLoc.x + 16), int32(aMouseLoc.y + 2));
|
||||
be_app->SetCursor(B_HAND_CURSOR);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -582,21 +574,6 @@ TermWindow::QuitRequested()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TermWindow::TermWinActivate()
|
||||
{
|
||||
Activate();
|
||||
|
||||
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||
if (focus_follows_mouse()) {
|
||||
BPoint aMouseLoc = Frame().LeftTop();
|
||||
set_mouse_position(int32(aMouseLoc.x + 16), int32(aMouseLoc.y + 2));
|
||||
be_app->SetCursor(B_HAND_CURSOR);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TermWindow::GetSupportedSuites(BMessage *msg)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
class BMenu;
|
||||
class BMenuBar;
|
||||
class BMessageRunner;
|
||||
class FindWindow;
|
||||
class PrefWindow;
|
||||
class TermView;
|
||||
@@ -46,8 +45,6 @@ public:
|
||||
TermWindow(BRect frame, const char* title, const char *command);
|
||||
virtual ~TermWindow();
|
||||
|
||||
void TermWinActivate();
|
||||
|
||||
protected:
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void WindowActivated(bool);
|
||||
@@ -77,7 +74,6 @@ private:
|
||||
BMessage *fPrintSettings;
|
||||
PrefWindow *fPrefWindow;
|
||||
FindWindow *fFindPanel;
|
||||
BMessageRunner *fWindowUpdate;
|
||||
BRect fSavedFrame;
|
||||
window_look fSavedLook;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user