TermView and the classes used by it now don't know about PrefHandler
anymore, but have methods to set the needed options. Various cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21728 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -55,9 +55,6 @@ static const pref_defaults kTermDefaults[] = {
|
|||||||
|
|
||||||
{ PREF_TEXT_ENCODING, "UTF-8" },
|
{ PREF_TEXT_ENCODING, "UTF-8" },
|
||||||
|
|
||||||
{ PREF_MOUSE_IMAGE, "Hand cursor"},
|
|
||||||
{ PREF_DRAGN_COPY, "0"},
|
|
||||||
|
|
||||||
{ PREF_GUI_LANGUAGE, "English"},
|
{ PREF_GUI_LANGUAGE, "English"},
|
||||||
{ PREF_IM_AWARE, "0"},
|
{ PREF_IM_AWARE, "0"},
|
||||||
{ NULL, NULL},
|
{ NULL, NULL},
|
||||||
|
|||||||
@@ -4,33 +4,10 @@
|
|||||||
* Copyright (c) 2004 Daniel Furrer <[email protected]>
|
* Copyright (c) 2004 Daniel Furrer <[email protected]>
|
||||||
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* Distributed under the terms of the MIT license.
|
||||||
* a copy of this software and associated documentation files or portions
|
|
||||||
* thereof (the "Software"), to deal in the Software without restriction,
|
|
||||||
* including without limitation the rights to use, copy, modify, merge,
|
|
||||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
||||||
* and to permit persons to whom the Software is furnished to do so, subject
|
|
||||||
* to the following conditions:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice
|
|
||||||
* in the binary, as well as this list of conditions and the following
|
|
||||||
* disclaimer in the documentation and/or other materials provided with
|
|
||||||
* the distribution.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Shell.h"
|
#include "Shell.h"
|
||||||
|
|
||||||
#include "TermConst.h"
|
#include "TermConst.h"
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ but it font is full width font on preference panel.
|
|||||||
#include "TermBuffer.h"
|
#include "TermBuffer.h"
|
||||||
|
|
||||||
#include "CurPos.h"
|
#include "CurPos.h"
|
||||||
#include "PrefHandler.h"
|
|
||||||
#include "TermConst.h"
|
#include "TermConst.h"
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|||||||
@@ -103,13 +103,11 @@ 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_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_COLS = "Cols";
|
const char* const PREF_COLS = "Cols";
|
||||||
const char* const PREF_ROWS = "Rows";
|
const char* const PREF_ROWS = "Rows";
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT license.
|
* All rights reserved. Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
* Stefano Ceccherini <stefano.ceccherini@gmail.com>
|
||||||
* Kian Duffy, myob@users.sourceforge.net
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
* Y.Hayakawa, hida@sawada.riec.tohoku.ac.jp
|
* Y.Hayakawa, hida@sawada.riec.tohoku.ac.jp
|
||||||
*/
|
*/
|
||||||
@@ -13,8 +14,6 @@
|
|||||||
#include "TermView.h"
|
#include "TermView.h"
|
||||||
|
|
||||||
#include "CodeConv.h"
|
#include "CodeConv.h"
|
||||||
#include "MenuUtil.h"
|
|
||||||
#include "PrefHandler.h"
|
|
||||||
#include "PrefView.h"
|
#include "PrefView.h"
|
||||||
#include "Shell.h"
|
#include "Shell.h"
|
||||||
#include "TermBuffer.h"
|
#include "TermBuffer.h"
|
||||||
@@ -108,11 +107,16 @@ const unsigned char M_ADD_CURSOR[] = {
|
|||||||
|
|
||||||
|
|
||||||
#define MOUSE_THR_CODE 'mtcd'
|
#define MOUSE_THR_CODE 'mtcd'
|
||||||
|
#define ROWS_DEFAULT 25
|
||||||
|
#define COLUMNS_DEFAULT 80
|
||||||
|
|
||||||
const static uint32 kUpdateSigWinch = 'Rwin';
|
const static uint32 kUpdateSigWinch = 'Rwin';
|
||||||
|
|
||||||
|
const static rgb_color kBlackColor = { 0, 0, 0, 255 };
|
||||||
|
const static rgb_color kWhiteColor = { 255, 255, 255, 255 };
|
||||||
|
|
||||||
TermView::TermView(BRect frame, const char *command)
|
|
||||||
|
TermView::TermView(BRect frame, const char *command, int32 historySize)
|
||||||
: BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED),
|
: BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED),
|
||||||
fShell(NULL),
|
fShell(NULL),
|
||||||
fFontWidth(0),
|
fFontWidth(0),
|
||||||
@@ -132,17 +136,22 @@ TermView::TermView(BRect frame, const char *command)
|
|||||||
fCurPos(0, 0),
|
fCurPos(0, 0),
|
||||||
fCurStack(0, 0),
|
fCurStack(0, 0),
|
||||||
fBufferStartPos(-1),
|
fBufferStartPos(-1),
|
||||||
fTermRows(PrefHandler::Default()->getInt32(PREF_ROWS)),
|
fTermRows(ROWS_DEFAULT),
|
||||||
fTermColumns(PrefHandler::Default()->getInt32(PREF_COLS)),
|
fTermColumns(COLUMNS_DEFAULT),
|
||||||
fEncoding(M_UTF8),
|
fEncoding(M_UTF8),
|
||||||
fTop(0),
|
fTop(0),
|
||||||
fTextBuffer(NULL),
|
fTextBuffer(NULL),
|
||||||
fScrollBar(NULL),
|
fScrollBar(NULL),
|
||||||
|
fTextForeColor(kBlackColor),
|
||||||
|
fTextBackColor(kWhiteColor),
|
||||||
|
fCursorForeColor(kWhiteColor),
|
||||||
|
fCursorBackColor(kBlackColor),
|
||||||
|
fSelectForeColor(kWhiteColor),
|
||||||
|
fSelectBackColor(kBlackColor),
|
||||||
fScrTop(0),
|
fScrTop(0),
|
||||||
fScrBot(fTermRows - 1),
|
fScrBot(fTermRows - 1),
|
||||||
fScrBufSize(PrefHandler::Default()->getInt32(PREF_HISTORY_SIZE)),
|
fScrBufSize(historySize),
|
||||||
fScrRegionSet(0),
|
fScrRegionSet(0),
|
||||||
fMouseImage(false),
|
|
||||||
fPreviousMousePoint(0, 0),
|
fPreviousMousePoint(0, 0),
|
||||||
fSelStart(-1, -1),
|
fSelStart(-1, -1),
|
||||||
fSelEnd(-1, -1),
|
fSelEnd(-1, -1),
|
||||||
@@ -176,17 +185,22 @@ TermView::TermView(BMessage *archive)
|
|||||||
fCurPos(0, 0),
|
fCurPos(0, 0),
|
||||||
fCurStack(0, 0),
|
fCurStack(0, 0),
|
||||||
fBufferStartPos(-1),
|
fBufferStartPos(-1),
|
||||||
fTermRows(25),
|
fTermRows(ROWS_DEFAULT),
|
||||||
fTermColumns(80),
|
fTermColumns(COLUMNS_DEFAULT),
|
||||||
fEncoding(M_UTF8),
|
fEncoding(M_UTF8),
|
||||||
fTop(0),
|
fTop(0),
|
||||||
fTextBuffer(NULL),
|
fTextBuffer(NULL),
|
||||||
fScrollBar(NULL),
|
fScrollBar(NULL),
|
||||||
|
fTextForeColor(kBlackColor),
|
||||||
|
fTextBackColor(kWhiteColor),
|
||||||
|
fCursorForeColor(kWhiteColor),
|
||||||
|
fCursorBackColor(kBlackColor),
|
||||||
|
fSelectForeColor(kWhiteColor),
|
||||||
|
fSelectBackColor(kBlackColor),
|
||||||
fScrTop(0),
|
fScrTop(0),
|
||||||
fScrBot(fTermRows - 1),
|
fScrBot(fTermRows - 1),
|
||||||
fScrBufSize(1000),
|
fScrBufSize(1000),
|
||||||
fScrRegionSet(0),
|
fScrRegionSet(0),
|
||||||
fMouseImage(false),
|
|
||||||
fPreviousMousePoint(0, 0),
|
fPreviousMousePoint(0, 0),
|
||||||
fSelStart(-1, -1),
|
fSelStart(-1, -1),
|
||||||
fSelEnd(-1, -1),
|
fSelEnd(-1, -1),
|
||||||
@@ -202,7 +216,7 @@ TermView::TermView(BMessage *archive)
|
|||||||
if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK)
|
if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK)
|
||||||
fTermRows = 25;
|
fTermRows = 25;
|
||||||
|
|
||||||
// TODO: Retrieve command from archive
|
// TODO: Retrieve command, colors, history size, etc. from archive
|
||||||
_InitObject(NULL);
|
_InitObject(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,11 +226,9 @@ TermView::_InitObject(const char *command)
|
|||||||
{
|
{
|
||||||
fTextBuffer = new TermBuffer(fTermRows, fTermColumns, fScrBufSize);
|
fTextBuffer = new TermBuffer(fTermRows, fTermColumns, fScrBufSize);
|
||||||
|
|
||||||
SetMouseCursor();
|
|
||||||
SetTermFont(be_fixed_font, be_fixed_font);
|
SetTermFont(be_fixed_font, be_fixed_font);
|
||||||
SetTermColor();
|
|
||||||
|
|
||||||
//SetIMAware(PrefHandler::Default()->getInt32(PREF_IM_AWARE));
|
//SetIMAware(false);
|
||||||
|
|
||||||
fShell = new Shell();
|
fShell = new Shell();
|
||||||
status_t status = fShell->Open(fTermRows, fTermColumns,
|
status_t status = fShell->Open(fTermRows, fTermColumns,
|
||||||
@@ -349,33 +361,33 @@ TermView::SetTermSize(int rows, int cols, bool resize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Sets the mouse cursor image
|
|
||||||
void
|
void
|
||||||
TermView::SetMouseCursor()
|
TermView::SetTextColor(rgb_color fore, rgb_color back)
|
||||||
{
|
{
|
||||||
if (!strcmp(PrefHandler::Default()->getString(PREF_MOUSE_IMAGE), "Hand cursor"))
|
fTextForeColor = fore;
|
||||||
fMouseImage = false;
|
fTextBackColor = back;
|
||||||
else
|
|
||||||
fMouseImage = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Sets colors for the terminal
|
|
||||||
void
|
|
||||||
TermView::SetTermColor()
|
|
||||||
{
|
|
||||||
fTextForeColor = PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR);
|
|
||||||
fTextBackColor = PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR);
|
|
||||||
fSelectForeColor = PrefHandler::Default()->getRGB(PREF_SELECT_FORE_COLOR);
|
|
||||||
fSelectBackColor = PrefHandler::Default()->getRGB(PREF_SELECT_BACK_COLOR);
|
|
||||||
fCursorForeColor = PrefHandler::Default()->getRGB(PREF_CURSOR_FORE_COLOR);
|
|
||||||
fCursorBackColor = PrefHandler::Default()->getRGB(PREF_CURSOR_BACK_COLOR);
|
|
||||||
|
|
||||||
SetLowColor(fTextBackColor);
|
SetLowColor(fTextBackColor);
|
||||||
SetViewColor(fTextBackColor);
|
SetViewColor(fTextBackColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TermView::SetSelectColor(rgb_color fore, rgb_color back)
|
||||||
|
{
|
||||||
|
fSelectForeColor = fore;
|
||||||
|
fSelectBackColor = back;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TermView::SetCursorColor(rgb_color fore, rgb_color back)
|
||||||
|
{
|
||||||
|
fCursorForeColor = fore;
|
||||||
|
fCursorBackColor = back;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TermView::Encoding() const
|
TermView::Encoding() const
|
||||||
{
|
{
|
||||||
@@ -386,6 +398,9 @@ TermView::Encoding() const
|
|||||||
void
|
void
|
||||||
TermView::SetEncoding(int encoding)
|
TermView::SetEncoding(int encoding)
|
||||||
{
|
{
|
||||||
|
// TODO: Shell::_Spawn() sets the "TTYPE" environment variable using
|
||||||
|
// the string value of encoding. But when this function is called and
|
||||||
|
// the encoding changes, the new value is never passed to Shell.
|
||||||
fEncoding = encoding;
|
fEncoding = encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,8 +978,7 @@ TermView::MouseTracking(void *data)
|
|||||||
BRect r;
|
BRect r;
|
||||||
|
|
||||||
if (theObj->HasSelection()
|
if (theObj->HasSelection()
|
||||||
&& ( PrefHandler::Default()->getInt32(PREF_DRAGN_COPY)
|
&& (modifiers() & B_CONTROL_KEY)) {
|
||||||
|| modifiers() & B_CONTROL_KEY)) {
|
|
||||||
|
|
||||||
if (theObj->LockLooper()) {
|
if (theObj->LockLooper()) {
|
||||||
theObj->GetMouse(&stpoint, &button);
|
theObj->GetMouse(&stpoint, &button);
|
||||||
@@ -1411,9 +1425,6 @@ TermView::WindowActivated(bool active)
|
|||||||
if (active == false) {
|
if (active == false) {
|
||||||
// DoIMConfirm();
|
// DoIMConfirm();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active && fMouseImage)
|
|
||||||
be_app->SetCursor(B_I_BEAM_CURSOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1901,7 +1912,7 @@ 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 || PrefHandler::Default()->getInt32(PREF_DRAGN_COPY)) {
|
if (mod & B_CONTROL_KEY) {
|
||||||
BPoint p;
|
BPoint p;
|
||||||
uint32 bt;
|
uint32 bt;
|
||||||
do {
|
do {
|
||||||
@@ -1984,14 +1995,9 @@ TermView::MouseDown(BPoint where)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *)
|
TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *message)
|
||||||
{
|
{
|
||||||
if (fMouseImage && Window()->IsActive()) {
|
BView::MouseMoved(where, transit, message);
|
||||||
if (transit == B_ENTERED_VIEW)
|
|
||||||
be_app->SetCursor(B_I_BEAM_CURSOR);
|
|
||||||
if (transit == B_EXITED_VIEW)
|
|
||||||
be_app->SetCursor(B_HAND_CURSOR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,31 +3,12 @@
|
|||||||
* 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.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* Distributed under the terms of the MIT license.
|
||||||
* a copy of this software and associated documentation files or portions
|
* Authors:
|
||||||
* thereof (the "Software"), to deal in the Software without restriction,
|
* Stefano Ceccherini <stefano.ceccherini@gmail.com>
|
||||||
* including without limitation the rights to use, copy, modify, merge,
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
||||||
* and to permit persons to whom the Software is furnished to do so, subject
|
|
||||||
* to the following conditions:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice
|
|
||||||
* in the binary, as well as this list of conditions and the following
|
|
||||||
* disclaimer in the documentation and/or other materials provided with
|
|
||||||
* the distribution.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TERMVIEW_H
|
#ifndef TERMVIEW_H
|
||||||
#define TERMVIEW_H
|
#define TERMVIEW_H
|
||||||
|
|
||||||
@@ -50,7 +31,7 @@ class Shell;
|
|||||||
class TermBuffer;
|
class TermBuffer;
|
||||||
class TermView : public BView {
|
class TermView : public BView {
|
||||||
public:
|
public:
|
||||||
TermView(BRect frame, const char *command = NULL);
|
TermView(BRect frame, const char *command = NULL, int32 historySize = 1000);
|
||||||
TermView(BMessage *archive);
|
TermView(BMessage *archive);
|
||||||
~TermView();
|
~TermView();
|
||||||
|
|
||||||
@@ -67,12 +48,13 @@ public:
|
|||||||
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 SetTextColor(rgb_color fore, rgb_color back);
|
||||||
|
void SetSelectColor(rgb_color fore, rgb_color back);
|
||||||
|
void SetCursorColor(rgb_color fore, rgb_color back);
|
||||||
|
|
||||||
int Encoding() const;
|
int Encoding() const;
|
||||||
void SetEncoding(int encoding);
|
void SetEncoding(int encoding);
|
||||||
|
|
||||||
void SetMouseCursor();
|
|
||||||
// void SetIMAware (bool);
|
// void SetIMAware (bool);
|
||||||
void SetScrollBar(BScrollBar *scrbar);
|
void SetScrollBar(BScrollBar *scrbar);
|
||||||
BScrollBar *ScrollBar() const { return fScrollBar; };
|
BScrollBar *ScrollBar() const { return fScrollBar; };
|
||||||
@@ -84,9 +66,9 @@ public:
|
|||||||
void PutNL(int num);
|
void PutNL(int num);
|
||||||
void SetInsertMode(int flag);
|
void SetInsertMode(int flag);
|
||||||
void InsertSpace(int num);
|
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 EraseBelow();
|
||||||
void DeleteChar(int num);
|
void DeleteChar(int num);
|
||||||
@@ -259,16 +241,13 @@ private:
|
|||||||
rgb_color fTextForeColor, fTextBackColor;
|
rgb_color fTextForeColor, fTextBackColor;
|
||||||
rgb_color fCursorForeColor, fCursorBackColor;
|
rgb_color fCursorForeColor, fCursorBackColor;
|
||||||
rgb_color fSelectForeColor, fSelectBackColor;
|
rgb_color fSelectForeColor, fSelectBackColor;
|
||||||
uchar fTermAttr;
|
|
||||||
|
|
||||||
// Scroll Region
|
// Scroll Region
|
||||||
int fScrTop;
|
int fScrTop;
|
||||||
int fScrBot;
|
int fScrBot;
|
||||||
int fScrBufSize;
|
int32 fScrBufSize;
|
||||||
bool fScrRegionSet;
|
bool fScrRegionSet;
|
||||||
|
|
||||||
bool fMouseImage;
|
|
||||||
|
|
||||||
BPoint fPreviousMousePoint;
|
BPoint fPreviousMousePoint;
|
||||||
|
|
||||||
// view selection
|
// view selection
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Haiku, Inc.
|
* Copyright 2007 Haiku, Inc.
|
||||||
|
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
||||||
* Copyright (c) 2003-2004 Kian Duffy <myob@users.sourceforge.net>
|
* Copyright (c) 2003-2004 Kian Duffy <myob@users.sourceforge.net>
|
||||||
* Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
* Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||||
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
|
||||||
*
|
*
|
||||||
* Distributed unter the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TermWindow.h"
|
#include "TermWindow.h"
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Dragger.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -53,7 +54,27 @@ const static float kViewOffset = 3;
|
|||||||
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
||||||
:
|
:
|
||||||
BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
|
BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
|
||||||
fTabView(NULL)
|
fTabView(NULL),
|
||||||
|
fTermView(NULL),
|
||||||
|
fMenubar(NULL),
|
||||||
|
fFilemenu(NULL),
|
||||||
|
fEditmenu(NULL),
|
||||||
|
fEncodingmenu(NULL),
|
||||||
|
fHelpmenu(NULL),
|
||||||
|
fFontMenu(NULL),
|
||||||
|
fWindowSizeMenu(NULL),
|
||||||
|
fNewFontMenu(NULL),
|
||||||
|
fPrintSettings(NULL),
|
||||||
|
fPrefWindow(NULL),
|
||||||
|
fFindPanel(NULL),
|
||||||
|
fSavedFrame(0, 0, -1, -1),
|
||||||
|
fFindString(""),
|
||||||
|
fFindForwardMenuItem(NULL),
|
||||||
|
fFindBackwardMenuItem(NULL),
|
||||||
|
fFindSelection(false),
|
||||||
|
fForwardSearch(false),
|
||||||
|
fMatchCase(false),
|
||||||
|
fMatchWord(false)
|
||||||
{
|
{
|
||||||
fTabView = new SmartTabView(Bounds(), "Tab view");
|
fTabView = new SmartTabView(Bounds(), "Tab view");
|
||||||
AddChild(fTabView);
|
AddChild(fTabView);
|
||||||
@@ -61,11 +82,12 @@ TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
|||||||
_NewTab(command);
|
_NewTab(command);
|
||||||
_NewTab(NULL);
|
_NewTab(NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
TermWindow::TermWindow(BRect frame, const char* title, const char *command)
|
||||||
: BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
|
: BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE),
|
||||||
|
fTabView(NULL),
|
||||||
fTermView(NULL),
|
fTermView(NULL),
|
||||||
fMenubar(NULL),
|
fMenubar(NULL),
|
||||||
fFilemenu(NULL),
|
fFilemenu(NULL),
|
||||||
@@ -147,8 +169,9 @@ TermWindow::_InitWindow(const char *command)
|
|||||||
// Initialize TermView. (font, size and color)
|
// Initialize TermView. (font, size and color)
|
||||||
fTermView->SetTermFont(&halfFont, &fullFont);
|
fTermView->SetTermFont(&halfFont, &fullFont);
|
||||||
|
|
||||||
|
_SetTermColors();
|
||||||
BRect rect = fTermView->SetTermSize(PrefHandler::Default()->getInt32(PREF_ROWS),
|
BRect rect = fTermView->SetTermSize(PrefHandler::Default()->getInt32(PREF_ROWS),
|
||||||
PrefHandler::Default()->getInt32(PREF_COLS), true);
|
PrefHandler::Default()->getInt32(PREF_COLS), true);
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
fTermView->GetFontSize(&width, &height);
|
fTermView->GetFontSize(&width, &height);
|
||||||
@@ -491,7 +514,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_COLOR_CHANGED: {
|
case MSG_COLOR_CHANGED: {
|
||||||
fTermView->SetTermColor();
|
_SetTermColors();
|
||||||
fTermView->Invalidate();
|
fTermView->Invalidate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -537,6 +560,20 @@ TermWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TermWindow::_SetTermColors()
|
||||||
|
{
|
||||||
|
fTermView->SetTextColor(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR),
|
||||||
|
PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR));
|
||||||
|
|
||||||
|
fTermView->SetSelectColor(PrefHandler::Default()->getRGB(PREF_SELECT_FORE_COLOR),
|
||||||
|
PrefHandler::Default()->getRGB(PREF_SELECT_BACK_COLOR));
|
||||||
|
|
||||||
|
fTermView->SetCursorColor(PrefHandler::Default()->getRGB(PREF_CURSOR_FORE_COLOR),
|
||||||
|
PrefHandler::Default()->getRGB(PREF_CURSOR_BACK_COLOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TermWindow::_DoPageSetup()
|
TermWindow::_DoPageSetup()
|
||||||
{
|
{
|
||||||
@@ -595,7 +632,7 @@ TermWindow::_DoPrint()
|
|||||||
|
|
||||||
job.CommitJob();
|
job.CommitJob();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermWindow::_NewTab(const char *command)
|
TermWindow::_NewTab(const char *command)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void _SetTermColors();
|
||||||
void _InitWindow(const char *command);
|
void _InitWindow(const char *command);
|
||||||
void _SetupMenu();
|
void _SetupMenu();
|
||||||
status_t _DoPageSetup();
|
status_t _DoPageSetup();
|
||||||
|
|||||||
Reference in New Issue
Block a user