CodeStyle fixes, some refactoring and cleanup
* Clear some codestyle issues catched by checker script; * Rename RestartDebugCapture to more consistent StartStopDebugCapture; * Updated Copyrights and authors lists, some occurences of the raw MIT licence text replaced with "under the terms of MIT licence" reference; * Fixes for x86_64 build. This is cumulative cleanup commit for series of Terminal refactoring changes I have introduced last time. No significant functional changes.
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright 2008-2010, Ingo Weinhold, [email protected].
|
* Copyright 2008-2010, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
* Siarzhuk Zharski, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BasicTerminalBuffer.h"
|
#include "BasicTerminalBuffer.h"
|
||||||
@@ -265,7 +270,6 @@ BasicTerminalBuffer::SynchronizeWith(const BasicTerminalBuffer* other,
|
|||||||
destLine->softBreak = sourceLine->softBreak;
|
destLine->softBreak = sourceLine->softBreak;
|
||||||
if (destLine->length > 0) {
|
if (destLine->length > 0) {
|
||||||
memcpy(destLine->cells, sourceLine->cells,
|
memcpy(destLine->cells, sourceLine->cells,
|
||||||
// destLine->length * sizeof(TerminalCell));
|
|
||||||
fWidth * sizeof(TerminalCell));
|
fWidth * sizeof(TerminalCell));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -309,6 +313,7 @@ BasicTerminalBuffer::GetChar(int32 row, int32 column, UTF8Char& character,
|
|||||||
return A_CHAR;
|
return A_CHAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicTerminalBuffer::GetCellAttributes(int32 row, int32 column,
|
BasicTerminalBuffer::GetCellAttributes(int32 row, int32 column,
|
||||||
uint32& attributes, uint32& count) const
|
uint32& attributes, uint32& count) const
|
||||||
@@ -319,16 +324,14 @@ BasicTerminalBuffer::GetCellAttributes(int32 row, int32 column,
|
|||||||
if (line == NULL || column < 0)
|
if (line == NULL || column < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 c = column;
|
int32 c = column;
|
||||||
for (; c < fWidth; c++) {
|
for (; c < fWidth; c++) {
|
||||||
TerminalCell& cell = line->cells[c];
|
TerminalCell& cell = line->cells[c];
|
||||||
if (c > column && attributes != cell.attributes) {
|
if (c > column && attributes != cell.attributes)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
attributes = cell.attributes;
|
attributes = cell.attributes;
|
||||||
}
|
}
|
||||||
count = c - column;
|
count = c - column;
|
||||||
// printf("r:%d c:%d count:%d a:%x\n", row, column, count, attributes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -497,6 +500,7 @@ BasicTerminalBuffer::GetLineColor(int32 index) const
|
|||||||
return line != NULL ? line->attributes : 0;
|
return line != NULL ? line->attributes : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BasicTerminalBuffer::Find(const char* _pattern, const TermPos& start,
|
BasicTerminalBuffer::Find(const char* _pattern, const TermPos& start,
|
||||||
bool forward, bool caseSensitive, bool matchWord, TermPos& _matchStart,
|
bool forward, bool caseSensitive, bool matchWord, TermPos& _matchStart,
|
||||||
@@ -728,7 +732,7 @@ BasicTerminalBuffer::InsertTab()
|
|||||||
if (x != fCursor.x) {
|
if (x != fCursor.x) {
|
||||||
TerminalLine* line = _LineAt(fCursor.y);
|
TerminalLine* line = _LineAt(fCursor.y);
|
||||||
for (int32 i = fCursor.x; i <= x; i++) {
|
for (int32 i = fCursor.x; i <= x; i++) {
|
||||||
line->cells[i].character = ' ';
|
line->cells[i].character = ' ';
|
||||||
line->cells[i].attributes = fAttributes;
|
line->cells[i].attributes = fAttributes;
|
||||||
}
|
}
|
||||||
fCursor.x = x;
|
fCursor.x = x;
|
||||||
@@ -784,35 +788,27 @@ void
|
|||||||
BasicTerminalBuffer::EraseCharsFrom(int32 first, int32 numChars)
|
BasicTerminalBuffer::EraseCharsFrom(int32 first, int32 numChars)
|
||||||
{
|
{
|
||||||
TerminalLine* line = _LineAt(fCursor.y);
|
TerminalLine* line = _LineAt(fCursor.y);
|
||||||
|
|
||||||
/* if (IsAlternateScreenActive())*/ {
|
int32 end = min_c(first + numChars, fWidth);
|
||||||
int32 end = min_c(first + numChars, fWidth);
|
for (int32 i = first; i < end; i++)
|
||||||
for (int32 i = first; i < end; i++)
|
line->cells[i].attributes = fAttributes;
|
||||||
line->cells[i].attributes = fAttributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
line->attributes = fAttributes;
|
line->attributes = fAttributes;
|
||||||
|
|
||||||
_Invalidate(fCursor.y, fCursor.y);
|
|
||||||
|
|
||||||
// if (fCursor.x >= line->length)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
fSoftWrappedCursor = false;
|
fSoftWrappedCursor = false;
|
||||||
|
|
||||||
int32 end = min_c(first + numChars, line->length);
|
end = min_c(first + numChars, line->length);
|
||||||
// printf("%d:%d - %d|", fCursor.y, first, end);
|
|
||||||
if (first > 0 && IS_WIDTH(line->cells[first - 1].attributes))
|
if (first > 0 && IS_WIDTH(line->cells[first - 1].attributes))
|
||||||
first--;
|
first--;
|
||||||
if (end > 0 && IS_WIDTH(line->cells[end - 1].attributes))
|
if (end > 0 && IS_WIDTH(line->cells[end - 1].attributes))
|
||||||
end++;
|
end++;
|
||||||
|
|
||||||
// printf("%d - %d\n", first, end);
|
|
||||||
for (int32 i = first; i < end; i++) {
|
for (int32 i = first; i < end; i++) {
|
||||||
line->cells[i].character = kSpaceChar;
|
line->cells[i].character = kSpaceChar;
|
||||||
line->cells[i].attributes = fAttributes;
|
line->cells[i].attributes = fAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Invalidate(fCursor.y, fCursor.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -887,8 +883,6 @@ BasicTerminalBuffer::DeleteChars(int32 numChars)
|
|||||||
line->length = fCursor.x;
|
line->length = fCursor.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// line->attributes = fAttributes;
|
|
||||||
|
|
||||||
_Invalidate(fCursor.y, fCursor.y);
|
_Invalidate(fCursor.y, fCursor.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1331,7 +1325,7 @@ BasicTerminalBuffer::_ResizeRewrap(int32 width, int32 height,
|
|||||||
sourceLine->cells + sourceX, toCopy * sizeof(TerminalCell));
|
sourceLine->cells + sourceX, toCopy * sizeof(TerminalCell));
|
||||||
destLine->length += toCopy;
|
destLine->length += toCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
destLine->attributes = sourceLine->attributes;
|
destLine->attributes = sourceLine->attributes;
|
||||||
|
|
||||||
bool nextDestLine = false;
|
bool nextDestLine = false;
|
||||||
@@ -1572,12 +1566,9 @@ void
|
|||||||
BasicTerminalBuffer::_PadLineToCursor()
|
BasicTerminalBuffer::_PadLineToCursor()
|
||||||
{
|
{
|
||||||
TerminalLine* line = _LineAt(fCursor.y);
|
TerminalLine* line = _LineAt(fCursor.y);
|
||||||
if (line->length < fCursor.x) {
|
if (line->length < fCursor.x)
|
||||||
for (int32 i = line->length; i < fCursor.x; i++) {
|
for (int32 i = line->length; i < fCursor.x; i++)
|
||||||
line->cells[i].character = kSpaceChar;
|
line->cells[i].character = kSpaceChar;
|
||||||
// line->cells[i].attributes = line->attributes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1716,7 +1707,7 @@ BasicTerminalBuffer::MakeLinesSnapshots(time_t timeStamp, const char* fileName)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t countLines = dumpHistory ? fHistory->Size() : fHeight;
|
int countLines = dumpHistory ? fHistory->Size() : fHeight;
|
||||||
fprintf(fileOut, "> %s lines dump begin <\n",
|
fprintf(fileOut, "> %s lines dump begin <\n",
|
||||||
dumpHistory ? "History" : "Terminal");
|
dumpHistory ? "History" : "Terminal");
|
||||||
|
|
||||||
@@ -1727,11 +1718,11 @@ BasicTerminalBuffer::MakeLinesSnapshots(time_t timeStamp, const char* fileName)
|
|||||||
: fScreen[_LineIndex(i)];
|
: fScreen[_LineIndex(i)];
|
||||||
|
|
||||||
if (line == NULL) {
|
if (line == NULL) {
|
||||||
fprintf(fileOut, "line: %ld is NULL!!!\n", i);
|
fprintf(fileOut, "line: %d is NULL!!!\n", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fileOut, "%02d:%02d:%08lx:\n",
|
fprintf(fileOut, "%02" B_PRId16 ":%02" B_PRId16 ":%08" B_PRIx32 ":\n",
|
||||||
i, line->length, line->attributes);
|
i, line->length, line->attributes);
|
||||||
for (int j = 0; j < line->length; j++)
|
for (int j = 0; j < line->length; j++)
|
||||||
fprintf(fileOut, "%c", line->cells[j].character.bytes[0]);
|
fprintf(fileOut, "%c", line->cells[j].character.bytes[0]);
|
||||||
@@ -1739,7 +1730,7 @@ BasicTerminalBuffer::MakeLinesSnapshots(time_t timeStamp, const char* fileName)
|
|||||||
fprintf(fileOut, "\n");
|
fprintf(fileOut, "\n");
|
||||||
for (int s = 28; s >= 0; s -= 4) {
|
for (int s = 28; s >= 0; s -= 4) {
|
||||||
for (int j = 0; j < fWidth; j++)
|
for (int j = 0; j < fWidth; j++)
|
||||||
fprintf(fileOut, "%01lx",
|
fprintf(fileOut, "%01" B_PRIx32,
|
||||||
(line->cells[j].attributes >> s) & 0x0F);
|
(line->cells[j].attributes >> s) & 0x0F);
|
||||||
|
|
||||||
fprintf(fileOut, "\n");
|
fprintf(fileOut, "\n");
|
||||||
@@ -1751,14 +1742,15 @@ BasicTerminalBuffer::MakeLinesSnapshots(time_t timeStamp, const char* fileName)
|
|||||||
fprintf(fileOut, "> %s lines dump finished <\n",
|
fprintf(fileOut, "> %s lines dump finished <\n",
|
||||||
dumpHistory ? "History" : "Terminal");
|
dumpHistory ? "History" : "Terminal");
|
||||||
|
|
||||||
} while (dumpHistory = !dumpHistory);
|
dumpHistory = !dumpHistory;
|
||||||
|
} while (dumpHistory);
|
||||||
|
|
||||||
fclose(fileOut);
|
fclose(fileOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicTerminalBuffer::RestartDebugCapture()
|
BasicTerminalBuffer::StartStopDebugCapture()
|
||||||
{
|
{
|
||||||
if (fCaptureFile >= 0) {
|
if (fCaptureFile >= 0) {
|
||||||
close(fCaptureFile);
|
close(fCaptureFile);
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright 2008, Ingo Weinhold, [email protected].
|
* Copyright 2008, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
* Siarzhuk Zharski, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef BASIC_TERMINAL_BUFFER_H
|
#ifndef BASIC_TERMINAL_BUFFER_H
|
||||||
#define BASIC_TERMINAL_BUFFER_H
|
#define BASIC_TERMINAL_BUFFER_H
|
||||||
@@ -114,8 +119,8 @@ public:
|
|||||||
// snapshots and data capture for debugging
|
// snapshots and data capture for debugging
|
||||||
void MakeLinesSnapshots(time_t timeStamp,
|
void MakeLinesSnapshots(time_t timeStamp,
|
||||||
const char* fileName);
|
const char* fileName);
|
||||||
void RestartDebugCapture();
|
void StartStopDebugCapture();
|
||||||
/*inline*/ void CaptureChar(char ch);
|
void CaptureChar(char ch);
|
||||||
|
|
||||||
// insert chars/lines
|
// insert chars/lines
|
||||||
inline void InsertChar(UTF8Char c);
|
inline void InsertChar(UTF8Char c);
|
||||||
@@ -183,7 +188,7 @@ protected:
|
|||||||
|
|
||||||
static TerminalLine** _AllocateLines(int32 width, int32 count);
|
static TerminalLine** _AllocateLines(int32 width, int32 count);
|
||||||
static void _FreeLines(TerminalLine** lines, int32 count);
|
static void _FreeLines(TerminalLine** lines, int32 count);
|
||||||
void _ClearLines(int32 first, int32 last/*, uint32 attr = 0*/); //TODO attr
|
void _ClearLines(int32 first, int32 last);
|
||||||
|
|
||||||
status_t _ResizeHistory(int32 width,
|
status_t _ResizeHistory(int32 width,
|
||||||
int32 historyCapacity);
|
int32 historyCapacity);
|
||||||
@@ -272,7 +277,7 @@ BasicTerminalBuffer::SetAttributes(uint32 attributes)
|
|||||||
void
|
void
|
||||||
BasicTerminalBuffer::PreserveAttributes(bool store)
|
BasicTerminalBuffer::PreserveAttributes(bool store)
|
||||||
{
|
{
|
||||||
if (store)
|
if (store)
|
||||||
fSavedAttributes = fAttributes;
|
fSavedAttributes = fAttributes;
|
||||||
else
|
else
|
||||||
fAttributes = fSavedAttributes;
|
fAttributes = fSavedAttributes;
|
||||||
@@ -306,18 +311,21 @@ BasicTerminalBuffer::EraseChars(int32 numChars)
|
|||||||
EraseCharsFrom(fCursor.x, numChars);
|
EraseCharsFrom(fCursor.x, numChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicTerminalBuffer::DeleteColumns()
|
BasicTerminalBuffer::DeleteColumns()
|
||||||
{
|
{
|
||||||
DeleteColumnsFrom(fCursor.x);
|
DeleteColumnsFrom(fCursor.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicTerminalBuffer::SetCursor(int32 x, int32 y)
|
BasicTerminalBuffer::SetCursor(int32 x, int32 y)
|
||||||
{
|
{
|
||||||
_SetCursor(x, y, false);
|
_SetCursor(x, y, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicTerminalBuffer::SetCursorX(int32 x)
|
BasicTerminalBuffer::SetCursorX(int32 x)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2012, Haiku, Inc. All rights reserved.
|
* Copyright 2010-2013, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stefano Ceccherini, [email protected]
|
||||||
|
* Siarzhuk Zharski, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -8,7 +12,6 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
@@ -128,7 +131,8 @@ XColorsTable::XColorsTable()
|
|||||||
|
|
||||||
XColorsTable::~XColorsTable()
|
XColorsTable::~XColorsTable()
|
||||||
{
|
{
|
||||||
// fTable is owned by BApplication - no need to free it.
|
// fTable as result of LoadResource call and owned
|
||||||
|
// by BApplication so no need to free it explicitly
|
||||||
fTable = NULL;
|
fTable = NULL;
|
||||||
fCount = 0;
|
fCount = 0;
|
||||||
}
|
}
|
||||||
@@ -180,9 +184,9 @@ status_t
|
|||||||
XColorsTable::_LoadXColorsTable()
|
XColorsTable::_LoadXColorsTable()
|
||||||
{
|
{
|
||||||
BResources* res = BApplication::AppResources();
|
BResources* res = BApplication::AppResources();
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
fTable = (_XColorEntry*)res->LoadResource(B_RAW_TYPE, "XColorsTable", &size);
|
fTable = (_XColorEntry*)res->LoadResource(B_RAW_TYPE, "XColorsTable", &size);
|
||||||
if (fTable == NULL || size < sizeof(_XColorEntry)) {
|
if (fTable == NULL || size < sizeof(_XColorEntry)) {
|
||||||
@@ -191,16 +195,6 @@ XColorsTable::_LoadXColorsTable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fCount = size / sizeof(_XColorEntry);
|
fCount = size / sizeof(_XColorEntry);
|
||||||
|
|
||||||
// printf("%ld; sizeof:%ld\n", fCount, sizeof(_XColorEntry));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < fCount; i++) {
|
|
||||||
printf("%ld:%#010lx -> %d/%d/%d %d\n",
|
|
||||||
i, fTable[i].hash, fTable[i].color.red,
|
|
||||||
fTable[i].color.green, fTable[i].color.blue,
|
|
||||||
fTable[i].color.alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2012, Haiku, Inc. All rights reserved.
|
* Copyright 2010-2013, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stefano Ceccherini, [email protected]
|
||||||
|
* Siarzhuk Zharski, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef _COLORS_H
|
#ifndef _COLORS_H
|
||||||
#define _COLORS_H
|
#define _COLORS_H
|
||||||
@@ -28,8 +32,8 @@ const uint kTermColorCount = 256;
|
|||||||
|
|
||||||
|
|
||||||
// Helper class handling XColorName/rgb:xxx/xxx/xxx -> rgb_color conversions.
|
// Helper class handling XColorName/rgb:xxx/xxx/xxx -> rgb_color conversions.
|
||||||
// The source of XColorNames is wide available rgb.txt for X11 System.
|
// The source of XColorNames is wide available rgb.txt for X11 System.
|
||||||
// It is stored in "XColorsTable" application resource as array of
|
// It is stored in "XColorsTable" application resource as array of
|
||||||
// "hash <-> rgb_color" pairs. The table is loaded only on demand.
|
// "hash <-> rgb_color" pairs. The table is loaded only on demand.
|
||||||
// Name hashes must be sorted to let lookup procedure work properly
|
// Name hashes must be sorted to let lookup procedure work properly
|
||||||
class XColorsTable {
|
class XColorsTable {
|
||||||
@@ -39,7 +43,7 @@ class XColorsTable {
|
|||||||
rgb_color color;
|
rgb_color color;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XColorsTable();
|
XColorsTable();
|
||||||
~XColorsTable();
|
~XColorsTable();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright 2008, Ingo Weinhold, [email protected].
|
* Copyright 2008, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
* Siarzhuk Zharski, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "HistoryBuffer.h"
|
#include "HistoryBuffer.h"
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
|
* Copyright 2003-2013, Haiku, Inc. All Rights Reserved.
|
||||||
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
||||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||||
* Copyright (c) 1998,99 Kazuho Okui and Takashi Murai.
|
* Copyright (c) 1998,99 Kazuho Okui and Takashi Murai.
|
||||||
*
|
*
|
||||||
* Distributed unter the terms of the MIT License.
|
* Distributed unter the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Daniel Furrer, assimil8or@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +65,7 @@ static const pref_defaults kTermDefaults[] = {
|
|||||||
{ PREF_ANSI_MAGENTA_COLOR, "115, 68, 123" },
|
{ PREF_ANSI_MAGENTA_COLOR, "115, 68, 123" },
|
||||||
{ PREF_ANSI_CYAN_COLOR, " 6, 152, 154" },
|
{ PREF_ANSI_CYAN_COLOR, " 6, 152, 154" },
|
||||||
{ PREF_ANSI_WHITE_COLOR, "245, 245, 245" },
|
{ PREF_ANSI_WHITE_COLOR, "245, 245, 245" },
|
||||||
|
|
||||||
{ PREF_ANSI_BLACK_HCOLOR, "128, 128, 128" },
|
{ PREF_ANSI_BLACK_HCOLOR, "128, 128, 128" },
|
||||||
{ PREF_ANSI_RED_HCOLOR, "255, 0, 0" },
|
{ PREF_ANSI_RED_HCOLOR, "255, 0, 0" },
|
||||||
{ PREF_ANSI_GREEN_HCOLOR, " 0, 255, 0" },
|
{ PREF_ANSI_GREEN_HCOLOR, " 0, 255, 0" },
|
||||||
@@ -204,11 +209,12 @@ PrefHandler::SaveAsText(const char *path, const char *mimetype,
|
|||||||
fContainer.GetInfo(B_STRING_TYPE, i, (char**)&key, &type) == B_OK;
|
fContainer.GetInfo(B_STRING_TYPE, i, (char**)&key, &type) == B_OK;
|
||||||
#endif
|
#endif
|
||||||
i++) {
|
i++) {
|
||||||
int len = snprintf(buffer, sizeof(buffer), "\"%s\" , \"%s\"\n", key, getString(key));
|
int len = snprintf(buffer, sizeof(buffer), "\"%s\" , \"%s\"\n",
|
||||||
|
key, getString(key));
|
||||||
file.Write(buffer, len);
|
file.Write(buffer, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mimetype != NULL){
|
if (mimetype != NULL) {
|
||||||
BNodeInfo info(&file);
|
BNodeInfo info(&file);
|
||||||
info.SetType(mimetype);
|
info.SetType(mimetype);
|
||||||
info.SetPreferredApp(signature);
|
info.SetPreferredApp(signature);
|
||||||
@@ -237,6 +243,7 @@ PrefHandler::getFloat(const char *key)
|
|||||||
return atof(value);
|
return atof(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "Terminal getString"
|
#define B_TRANSLATION_CONTEXT "Terminal getString"
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2006, Haiku, Inc. All Rights Reserved.
|
* Copyright (c) 2003-2013, Haiku, Inc. All Rights Reserved.
|
||||||
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
||||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||||
* Copyright (c) 1998,99 Kazuho Okui and Takashi Murai.
|
* Copyright (c) 1998,99 Kazuho Okui and Takashi Murai.
|
||||||
*
|
*
|
||||||
* Distributed unter the terms of the MIT License.
|
* Distributed unter the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Daniel Furrer, assimil8or@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
#ifndef PREF_HANDLER_H
|
#ifndef PREF_HANDLER_H
|
||||||
#define PREF_HANDLER_H
|
#define PREF_HANDLER_H
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007-2010, Haiku, Inc. All rights reserved.
|
* Copyright 2007-2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||||
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
||||||
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||||
*
|
*
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Daniel Furrer, assimil8or@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -71,7 +75,6 @@
|
|||||||
// TODO: should extract from /etc/passwd instead???
|
// TODO: should extract from /etc/passwd instead???
|
||||||
const char *kDefaultShell = "/bin/sh";
|
const char *kDefaultShell = "/bin/sh";
|
||||||
const char *kTerminalType = "xterm-256color";
|
const char *kTerminalType = "xterm-256color";
|
||||||
//const char *kTerminalType = "xterm";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set environment variable.
|
* Set environment variable.
|
||||||
@@ -382,6 +385,7 @@ initialize_termios(struct termios &tio)
|
|||||||
tio.c_cc[VSUSP] = CSUSP; /* '^Z' */
|
tio.c_cc[VSUSP] = CSUSP; /* '^Z' */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "Terminal Shell"
|
#define B_TRANSLATION_CONTEXT "Terminal Shell"
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Haiku, Inc. All rights reserved.
|
* Copyright 2001-2013, Haiku, Inc. All rights reserved.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* Distributed unter the terms of the MIT license.
|
* Distributed unter the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -292,7 +296,6 @@ TermApp::_ChildCleanupThread(void* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermApp::_Usage(char *name)
|
TermApp::_Usage(char *name)
|
||||||
{
|
{
|
||||||
@@ -351,4 +354,3 @@ TermApp::_InitDefaultPalette()
|
|||||||
for (uint gray = 8; gray < 240; gray += 10)
|
for (uint gray = 8; gray < 240; gray += 10)
|
||||||
(*color++).set_to(gray, gray, gray);
|
(*color++).set_to(gray, gray, gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Haiku.
|
* Copyright 2001-2013, 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.
|
||||||
*
|
*
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
#ifndef TERM_APP_H
|
#ifndef TERM_APP_H
|
||||||
#define TERM_APP_H
|
#define TERM_APP_H
|
||||||
|
|||||||
@@ -1,32 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2009, Haiku.
|
* Copyright 2001-2013, Haiku.
|
||||||
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
* Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
|
||||||
* Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
* 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.
|
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
#ifndef TERMCONST_H_INCLUDED
|
#ifndef TERMCONST_H_INCLUDED
|
||||||
#define TERMCONST_H_INCLUDED
|
#define TERMCONST_H_INCLUDED
|
||||||
@@ -164,16 +145,8 @@ static const char* const PREF_WINDOW_TITLE = "Window title";
|
|||||||
extern const char* const kTooTipSetTabTitlePlaceholders;
|
extern const char* const kTooTipSetTabTitlePlaceholders;
|
||||||
extern const char* const kTooTipSetWindowTitlePlaceholders;
|
extern const char* const kTooTipSetWindowTitlePlaceholders;
|
||||||
|
|
||||||
// Color type
|
|
||||||
enum {
|
|
||||||
TEXT_FOREGROUND_COLOR,
|
|
||||||
TEXT_BACKGROUND_COLOR,
|
|
||||||
SELECTION_FOREGROUND_COLOR,
|
|
||||||
SELECTION_BACKGROUND_COLOR
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// Cursor style
|
||||||
// Cursor shape
|
|
||||||
enum {
|
enum {
|
||||||
BLOCK_CURSOR,
|
BLOCK_CURSOR,
|
||||||
UNDERLINE_CURSOR,
|
UNDERLINE_CURSOR,
|
||||||
@@ -189,12 +162,6 @@ static const int32 DEFAULT = -1;
|
|||||||
static const int HALF_WIDTH = 1;
|
static const int HALF_WIDTH = 1;
|
||||||
static const int FULL_WIDTH = 2;
|
static const int FULL_WIDTH = 2;
|
||||||
|
|
||||||
// Scroll direction flag
|
|
||||||
enum{
|
|
||||||
SCRUP,
|
|
||||||
SCRDOWN
|
|
||||||
};
|
|
||||||
|
|
||||||
#define M_UTF8 -1
|
#define M_UTF8 -1
|
||||||
|
|
||||||
#define TAB_WIDTH 8
|
#define TAB_WIDTH 8
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Haiku, Inc.
|
* Copyright 2001-2013, Haiku, Inc.
|
||||||
* 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.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -176,7 +180,7 @@ TermParse::_InitPtyReader()
|
|||||||
|
|
||||||
fReaderThread = spawn_thread(_ptyreader_thread, "PtyReader",
|
fReaderThread = spawn_thread(_ptyreader_thread, "PtyReader",
|
||||||
B_NORMAL_PRIORITY, this);
|
B_NORMAL_PRIORITY, this);
|
||||||
if (fReaderThread < 0) {
|
if (fReaderThread < 0) {
|
||||||
delete_sem(fReaderSem);
|
delete_sem(fReaderSem);
|
||||||
fReaderSem = -1;
|
fReaderSem = -1;
|
||||||
delete_sem(fReaderLocker);
|
delete_sem(fReaderLocker);
|
||||||
@@ -485,40 +489,40 @@ TermParse::EscParse()
|
|||||||
/* "Special characters and line drawing" enabled by \E(0 */
|
/* "Special characters and line drawing" enabled by \E(0 */
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
fBuffer->InsertChar("\xE2\x96\x92",3);
|
fBuffer->InsertChar("\xE2\x96\x92", 3);
|
||||||
break;
|
break;
|
||||||
case 'j':
|
case 'j':
|
||||||
fBuffer->InsertChar("\xE2\x94\x98",3);
|
fBuffer->InsertChar("\xE2\x94\x98", 3);
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
fBuffer->InsertChar("\xE2\x94\x90",3);
|
fBuffer->InsertChar("\xE2\x94\x90", 3);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
fBuffer->InsertChar("\xE2\x94\x8C",3);
|
fBuffer->InsertChar("\xE2\x94\x8C", 3);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
fBuffer->InsertChar("\xE2\x94\x94",3);
|
fBuffer->InsertChar("\xE2\x94\x94", 3);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
fBuffer->InsertChar("\xE2\x94\xBC",3);
|
fBuffer->InsertChar("\xE2\x94\xBC", 3);
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
fBuffer->InsertChar("\xE2\x94\x80",3);
|
fBuffer->InsertChar("\xE2\x94\x80", 3);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
fBuffer->InsertChar("\xE2\x94\x9C",3);
|
fBuffer->InsertChar("\xE2\x94\x9C", 3);
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
fBuffer->InsertChar("\xE2\x94\xA4",3);
|
fBuffer->InsertChar("\xE2\x94\xA4", 3);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
fBuffer->InsertChar("\xE2\x94\xB4",3);
|
fBuffer->InsertChar("\xE2\x94\xB4", 3);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
fBuffer->InsertChar("\xE2\x94\xAC",3);
|
fBuffer->InsertChar("\xE2\x94\xAC", 3);
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
fBuffer->InsertChar("\xE2\x94\x82",3);
|
fBuffer->InsertChar("\xE2\x94\x82", 3);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fBuffer->InsertChar((char)c);
|
fBuffer->InsertChar((char)c);
|
||||||
@@ -694,7 +698,7 @@ TermParse::EscParse()
|
|||||||
param[nparam++] = DEFAULT;
|
param[nparam++] = DEFAULT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CASE_CSI_SP: // ESC [N q
|
case CASE_CSI_SP: // ESC [N q
|
||||||
// part of change cursor style DECSCUSR
|
// part of change cursor style DECSCUSR
|
||||||
if (nparam < NPARAM)
|
if (nparam < NPARAM)
|
||||||
param[nparam++] = ' ';
|
param[nparam++] = ' ';
|
||||||
@@ -1136,14 +1140,13 @@ TermParse::EscParse()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if (!isprint(params[i] & 0x7f)) {
|
if (!isprint(params[i] & 0x7f))
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
params[i] = '\0';
|
params[i] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isParsed)
|
if (isParsed)
|
||||||
_ProcessOperatingSystemControls(params);
|
_ProcessOperatingSystemControls(params);
|
||||||
|
|
||||||
@@ -1546,7 +1549,7 @@ TermParse::_ProcessOperatingSystemControls(uchar* params)
|
|||||||
case 104: // reset colors (0 - 255)
|
case 104: // reset colors (0 - 255)
|
||||||
{
|
{
|
||||||
bool reset = (mode / 100) == 1;
|
bool reset = (mode / 100) == 1;
|
||||||
|
|
||||||
// colors can be in "idx1:name1;...;idxN:nameN;" sequence too!
|
// colors can be in "idx1:name1;...;idxN:nameN;" sequence too!
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
char* p = strtok((char*)params, ";");
|
char* p = strtok((char*)params, ";");
|
||||||
@@ -1558,16 +1561,14 @@ TermParse::_ProcessOperatingSystemControls(uchar* params)
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (gXColorsTable.LookUpColor(p, &colors[count]) == B_OK) {
|
if (gXColorsTable.LookUpColor(p, &colors[count]) == B_OK)
|
||||||
count++;
|
count++;
|
||||||
}
|
} else
|
||||||
} else {
|
|
||||||
count++;
|
count++;
|
||||||
}
|
|
||||||
|
|
||||||
p = strtok(NULL, ";");
|
p = strtok(NULL, ";");
|
||||||
} while(p != NULL && count < kTermColorCount);
|
} while (p != NULL && count < kTermColorCount);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (!reset)
|
if (!reset)
|
||||||
fBuffer->SetColors(indexes, colors, count);
|
fBuffer->SetColors(indexes, colors, count);
|
||||||
@@ -1588,13 +1589,13 @@ TermParse::_ProcessOperatingSystemControls(uchar* params)
|
|||||||
// dyna-colors are pos-sensitive - no chance to continue
|
// dyna-colors are pos-sensitive - no chance to continue
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
indexes[count] = 10 + offset + count;
|
indexes[count] = 10 + offset + count;
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
p = strtok(NULL, ";");
|
p = strtok(NULL, ";");
|
||||||
} while(p != NULL && (offset + count) < 10);
|
|
||||||
|
} while (p != NULL && (offset + count) < 10);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fBuffer->SetColors(indexes, colors, count, true);
|
fBuffer->SetColors(indexes, colors, count, true);
|
||||||
}
|
}
|
||||||
@@ -1609,8 +1610,7 @@ TermParse::_ProcessOperatingSystemControls(uchar* params)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("%d -> %s\n", mode, params);
|
// printf("%d -> %s\n", mode, params);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc. All rights reserved.
|
||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
#ifndef TERMPARSE_H
|
#ifndef TERMPARSE_H
|
||||||
#define TERMPARSE_H
|
#define TERMPARSE_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Haiku, Inc.
|
* Copyright 2001-2013, Haiku, Inc.
|
||||||
* Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net
|
* Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net
|
||||||
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
|
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
|
||||||
* All rights reserved. Distributed under the terms of the MIT license.
|
* All rights reserved. Distributed under the terms of the MIT license.
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
* Y.Hayakawa, hida@sawada.riec.tohoku.ac.jp
|
* Y.Hayakawa, hida@sawada.riec.tohoku.ac.jp
|
||||||
* Ingo Weinhold, ingo_weinhold@gmx.de
|
* Ingo Weinhold, ingo_weinhold@gmx.de
|
||||||
* Clemens Zeidler, haiku@Clemens-Zeidler.de
|
* Clemens Zeidler, haiku@Clemens-Zeidler.de
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -332,7 +333,7 @@ TermView::_InitObject(const ShellParameters& shellParameters)
|
|||||||
fVisibleTextBuffer = new(std::nothrow) BasicTerminalBuffer;
|
fVisibleTextBuffer = new(std::nothrow) BasicTerminalBuffer;
|
||||||
if (fVisibleTextBuffer == NULL)
|
if (fVisibleTextBuffer == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
// TODO: Make the special word chars user-settable!
|
// TODO: Make the special word chars user-settable!
|
||||||
fCharClassifier = new(std::nothrow) CharClassifier(
|
fCharClassifier = new(std::nothrow) CharClassifier(
|
||||||
kDefaultSpecialWordChars);
|
kDefaultSpecialWordChars);
|
||||||
@@ -356,7 +357,7 @@ TermView::_InitObject(const ShellParameters& shellParameters)
|
|||||||
|
|
||||||
// set the shell parameters' encoding
|
// set the shell parameters' encoding
|
||||||
ShellParameters modifiedShellParameters(shellParameters);
|
ShellParameters modifiedShellParameters(shellParameters);
|
||||||
|
|
||||||
const BCharacterSet* charset
|
const BCharacterSet* charset
|
||||||
= BCharacterSetRoster::GetCharacterSetByConversionID(fEncoding);
|
= BCharacterSetRoster::GetCharacterSetByConversionID(fEncoding);
|
||||||
modifiedShellParameters.SetEncoding(charset ? charset->GetName() : "UTF-8");
|
modifiedShellParameters.SetEncoding(charset ? charset->GetName() : "UTF-8");
|
||||||
@@ -653,7 +654,7 @@ TermView::SetTermColor(uint index, rgb_color color, bool dynamic)
|
|||||||
fTextBuffer->SetPaletteColor(index, color);
|
fTextBuffer->SetPaletteColor(index, color);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 10:
|
case 10:
|
||||||
fTextForeColor = color;
|
fTextForeColor = color;
|
||||||
@@ -942,15 +943,12 @@ TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf,
|
|||||||
// color attribute
|
// color attribute
|
||||||
int forecolor = IS_FORECOLOR(attr);
|
int forecolor = IS_FORECOLOR(attr);
|
||||||
int backcolor = IS_BACKCOLOR(attr);
|
int backcolor = IS_BACKCOLOR(attr);
|
||||||
|
|
||||||
if (IS_FORESET(attr))
|
if (IS_FORESET(attr))
|
||||||
rgb_fore = fTextBuffer->PaletteColor(forecolor);
|
rgb_fore = fTextBuffer->PaletteColor(forecolor);
|
||||||
if (IS_BACKSET(attr))
|
if (IS_BACKSET(attr))
|
||||||
rgb_back = fTextBuffer->PaletteColor(backcolor);
|
rgb_back = fTextBuffer->PaletteColor(backcolor);
|
||||||
|
|
||||||
// printf("DLP:[%03x %03x %03x]; [%03x %03x %03x];\n",
|
|
||||||
// rgb_fore.red, rgb_fore.green, rgb_fore.blue, rgb_back.red, rgb_back.green, rgb_back.blue);
|
|
||||||
|
|
||||||
// Selection check.
|
// Selection check.
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
rgb_fore = fCursorForeColor;
|
rgb_fore = fCursorForeColor;
|
||||||
@@ -1040,7 +1038,6 @@ TermView::_DrawCursor()
|
|||||||
_DrawLinePart(fCursor.x * fFontWidth, (int32)rect.top, attr, buffer,
|
_DrawLinePart(fCursor.x * fFontWidth, (int32)rect.top, attr, buffer,
|
||||||
width, selected, cursorVisible, this);
|
width, selected, cursorVisible, this);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (selected)
|
if (selected)
|
||||||
SetHighColor(fSelectBackColor);
|
SetHighColor(fSelectBackColor);
|
||||||
else if (cursorVisible )
|
else if (cursorVisible )
|
||||||
@@ -1063,7 +1060,6 @@ TermView::_DrawCursor()
|
|||||||
|
|
||||||
FillRect(rect);
|
FillRect(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1624,19 +1620,19 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
#if 0
|
#if 0
|
||||||
} else if (msg->FindData("RGBColor", B_RGB_COLOR_TYPE,
|
} else if (msg->FindData("RGBColor", B_RGB_COLOR_TYPE,
|
||||||
(const void **)&color, &numBytes) == B_OK
|
(const void **)&color, &numBytes) == B_OK
|
||||||
&& numBytes == sizeof(color)) {
|
&& numBytes == sizeof(color)) {
|
||||||
// TODO: handle color drop
|
// TODO: handle color drop
|
||||||
// maybe only on replicants ?
|
// maybe only on replicants ?
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
} else if (msg->FindData("text/plain", B_MIME_TYPE,
|
} else if (msg->FindData("text/plain", B_MIME_TYPE,
|
||||||
(const void **)&text, &numBytes) == B_OK) {
|
(const void **)&text, &numBytes) == B_OK) {
|
||||||
_WritePTY(text, numBytes);
|
_WritePTY(text, numBytes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (msg->what){
|
switch (msg->what) {
|
||||||
case B_SIMPLE_DATA:
|
case B_SIMPLE_DATA:
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
{
|
{
|
||||||
@@ -1853,11 +1849,9 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
int32 count = 0;
|
int32 count = 0;
|
||||||
if (msg->FindInt32("count", &count) != B_OK)
|
if (msg->FindInt32("count", &count) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bool dynamic = false;
|
bool dynamic = false;
|
||||||
if (msg->FindBool("dynamic", &dynamic) != B_OK)
|
if (msg->FindBool("dynamic", &dynamic) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
uint8 index = 0;
|
uint8 index = 0;
|
||||||
if (msg->FindUInt8("index", i, &index) != B_OK)
|
if (msg->FindUInt8("index", i, &index) != B_OK)
|
||||||
@@ -1868,10 +1862,8 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
if (msg->FindData("color", B_RGB_COLOR_TYPE,
|
if (msg->FindData("color", B_RGB_COLOR_TYPE,
|
||||||
i, (const void**)&color, &bytes) != B_OK)
|
i, (const void**)&color, &bytes) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SetTermColor(index, *color, dynamic);
|
SetTermColor(index, *color, dynamic);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_RESET_TERMINAL_COLORS:
|
case MSG_RESET_TERMINAL_COLORS:
|
||||||
@@ -1879,11 +1871,9 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
int32 count = 0;
|
int32 count = 0;
|
||||||
if (msg->FindInt32("count", &count) != B_OK)
|
if (msg->FindInt32("count", &count) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bool dynamic = false;
|
bool dynamic = false;
|
||||||
if (msg->FindBool("dynamic", &dynamic) != B_OK)
|
if (msg->FindBool("dynamic", &dynamic) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
uint8 index = 0;
|
uint8 index = 0;
|
||||||
if (msg->FindUInt8("index", i, &index) != B_OK)
|
if (msg->FindUInt8("index", i, &index) != B_OK)
|
||||||
@@ -1893,7 +1883,6 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
SetTermColor(index,
|
SetTermColor(index,
|
||||||
TermApp::DefaultPalette()[index], dynamic);
|
TermApp::DefaultPalette()[index], dynamic);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_SET_CURSOR_STYLE:
|
case MSG_SET_CURSOR_STYLE:
|
||||||
@@ -2455,7 +2444,7 @@ TermView::_SendMouseEvent(int32 buttons, int32 mode, int32 x, int32 y,
|
|||||||
char xtermButtons;
|
char xtermButtons;
|
||||||
if (buttons == B_PRIMARY_MOUSE_BUTTON)
|
if (buttons == B_PRIMARY_MOUSE_BUTTON)
|
||||||
xtermButtons = 32 + 0;
|
xtermButtons = 32 + 0;
|
||||||
else if (buttons == B_SECONDARY_MOUSE_BUTTON)
|
else if (buttons == B_SECONDARY_MOUSE_BUTTON)
|
||||||
xtermButtons = 32 + 1;
|
xtermButtons = 32 + 1;
|
||||||
else if (buttons == B_TERTIARY_MOUSE_BUTTON)
|
else if (buttons == B_TERTIARY_MOUSE_BUTTON)
|
||||||
xtermButtons = 32 + 2;
|
xtermButtons = 32 + 2;
|
||||||
@@ -2494,8 +2483,8 @@ TermView::MouseDown(BPoint where)
|
|||||||
|
|
||||||
if (fReportAnyMouseEvent || fReportButtonMouseEvent
|
if (fReportAnyMouseEvent || fReportButtonMouseEvent
|
||||||
|| fReportNormalMouseEvent || fReportX10MouseEvent) {
|
|| fReportNormalMouseEvent || fReportX10MouseEvent) {
|
||||||
TermPos clickPos = _ConvertToTerminal(where);
|
TermPos clickPos = _ConvertToTerminal(where);
|
||||||
_SendMouseEvent(buttons, modifier, clickPos.x, clickPos.y, false);
|
_SendMouseEvent(buttons, modifier, clickPos.x, clickPos.y, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2588,17 +2577,17 @@ TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *message)
|
|||||||
int32 modifier;
|
int32 modifier;
|
||||||
Window()->CurrentMessage()->FindInt32("modifiers", &modifier);
|
Window()->CurrentMessage()->FindInt32("modifiers", &modifier);
|
||||||
|
|
||||||
TermPos clickPos = _ConvertToTerminal(where);
|
TermPos clickPos = _ConvertToTerminal(where);
|
||||||
|
|
||||||
if (fReportButtonMouseEvent) {
|
if (fReportButtonMouseEvent) {
|
||||||
if (fPrevPos.x != clickPos.x || fPrevPos.y != clickPos.y) {
|
if (fPrevPos.x != clickPos.x || fPrevPos.y != clickPos.y) {
|
||||||
_SendMouseEvent(fMouseButtons, modifier, clickPos.x, clickPos.y,
|
_SendMouseEvent(fMouseButtons, modifier, clickPos.x, clickPos.y,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
fPrevPos = clickPos;
|
fPrevPos = clickPos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_SendMouseEvent(fMouseButtons, modifier, clickPos.x, clickPos.y, true);
|
_SendMouseEvent(fMouseButtons, modifier, clickPos.x, clickPos.y, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2680,8 +2669,8 @@ TermView::MouseUp(BPoint where)
|
|||||||
|
|
||||||
if (fReportAnyMouseEvent || fReportButtonMouseEvent
|
if (fReportAnyMouseEvent || fReportButtonMouseEvent
|
||||||
|| fReportNormalMouseEvent) {
|
|| fReportNormalMouseEvent) {
|
||||||
TermPos clickPos = _ConvertToTerminal(where);
|
TermPos clickPos = _ConvertToTerminal(where);
|
||||||
_SendMouseEvent(0, 0, clickPos.x, clickPos.y, false);
|
_SendMouseEvent(0, 0, clickPos.x, clickPos.y, false);
|
||||||
} else {
|
} else {
|
||||||
if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0
|
if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0
|
||||||
&& (fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) {
|
&& (fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) {
|
||||||
@@ -3206,7 +3195,6 @@ TermView::_HandleInputMethodLocationRequest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermView::_CancelInputMethod()
|
TermView::_CancelInputMethod()
|
||||||
{
|
{
|
||||||
@@ -3267,16 +3255,16 @@ TermView::MakeDebugSnapshots()
|
|||||||
{
|
{
|
||||||
BAutolock _(fTextBuffer);
|
BAutolock _(fTextBuffer);
|
||||||
time_t timeStamp = time(NULL);
|
time_t timeStamp = time(NULL);
|
||||||
fTextBuffer->MakeLinesSnapshots(timeStamp, ".TextBuffer.log");
|
fTextBuffer->MakeLinesSnapshots(timeStamp, ".TextBuffer.dump");
|
||||||
fVisibleTextBuffer->MakeLinesSnapshots(timeStamp, ".VisualTextBuffer.log");
|
fVisibleTextBuffer->MakeLinesSnapshots(timeStamp, ".VisualTextBuffer.dump");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermView::RestartDebugCapture()
|
TermView::StartStopDebugCapture()
|
||||||
{
|
{
|
||||||
BAutolock _(fTextBuffer);
|
BAutolock _(fTextBuffer);
|
||||||
fTextBuffer->RestartDebugCapture();
|
fTextBuffer->StartStopDebugCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Haiku, Inc.
|
* Copyright 2001-2013, Haiku, Inc.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
* Stefano Ceccherini, stefano.ceccherini@gmail.com
|
* Stefano Ceccherini, stefano.ceccherini@gmail.com
|
||||||
* Kian Duffy, myob@users.sourceforge.net
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
* Ingo Weinhold, ingo_weinhold@gmx.de
|
* Ingo Weinhold, ingo_weinhold@gmx.de
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
#ifndef TERMVIEW_H
|
#ifndef TERMVIEW_H
|
||||||
#define TERMVIEW_H
|
#define TERMVIEW_H
|
||||||
@@ -91,7 +92,7 @@ public:
|
|||||||
void SetMouseClipboard(BClipboard *);
|
void SetMouseClipboard(BClipboard *);
|
||||||
|
|
||||||
void MakeDebugSnapshots();
|
void MakeDebugSnapshots();
|
||||||
void RestartDebugCapture();
|
void StartStopDebugCapture();
|
||||||
|
|
||||||
// edit functions
|
// edit functions
|
||||||
void Copy(BClipboard* clipboard);
|
void Copy(BClipboard* clipboard);
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007-2010, Haiku, Inc. All rights reserved.
|
* Copyright 2007-2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
|
* 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.
|
||||||
*
|
*
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Daniel Furrer, assimil8or@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TermWindow.h"
|
#include "TermWindow.h"
|
||||||
@@ -386,7 +391,7 @@ void
|
|||||||
TermWindow::MenusBeginning()
|
TermWindow::MenusBeginning()
|
||||||
{
|
{
|
||||||
TermView* view = _ActiveTermView();
|
TermView* view = _ActiveTermView();
|
||||||
|
|
||||||
// Syncronize Encode Menu Pop-up menu and Preference.
|
// Syncronize Encode Menu Pop-up menu and Preference.
|
||||||
const BCharacterSet* charset
|
const BCharacterSet* charset
|
||||||
= BCharacterSetRoster::GetCharacterSetByConversionID(view->Encoding());
|
= BCharacterSetRoster::GetCharacterSetByConversionID(view->Encoding());
|
||||||
@@ -473,7 +478,7 @@ TermWindow::_SetupMenu()
|
|||||||
.AddItem(B_TRANSLATE("New tab"), kNewTab, 'T')
|
.AddItem(B_TRANSLATE("New tab"), kNewTab, 'T')
|
||||||
.AddSeparator()
|
.AddSeparator()
|
||||||
.AddItem(B_TRANSLATE("Page setup" B_UTF8_ELLIPSIS), MENU_PAGE_SETUP)
|
.AddItem(B_TRANSLATE("Page setup" B_UTF8_ELLIPSIS), MENU_PAGE_SETUP)
|
||||||
.AddItem(B_TRANSLATE("Print"), MENU_PRINT,'P')
|
.AddItem(B_TRANSLATE("Print"), MENU_PRINT, 'P')
|
||||||
.AddSeparator()
|
.AddSeparator()
|
||||||
.AddItem(B_TRANSLATE("Close window"), B_QUIT_REQUESTED, 'W',
|
.AddItem(B_TRANSLATE("Close window"), B_QUIT_REQUESTED, 'W',
|
||||||
B_SHIFT_KEY)
|
B_SHIFT_KEY)
|
||||||
@@ -483,13 +488,13 @@ TermWindow::_SetupMenu()
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
.AddMenu(B_TRANSLATE("Edit"))
|
.AddMenu(B_TRANSLATE("Edit"))
|
||||||
.AddItem(B_TRANSLATE("Copy"), B_COPY,'C')
|
.AddItem(B_TRANSLATE("Copy"), B_COPY, 'C')
|
||||||
.AddItem(B_TRANSLATE("Paste"), B_PASTE,'V')
|
.AddItem(B_TRANSLATE("Paste"), B_PASTE, 'V')
|
||||||
.AddSeparator()
|
.AddSeparator()
|
||||||
.AddItem(B_TRANSLATE("Select all"), B_SELECT_ALL, 'A')
|
.AddItem(B_TRANSLATE("Select all"), B_SELECT_ALL, 'A')
|
||||||
.AddItem(B_TRANSLATE("Clear all"), MENU_CLEAR_ALL, 'L')
|
.AddItem(B_TRANSLATE("Clear all"), MENU_CLEAR_ALL, 'L')
|
||||||
.AddSeparator()
|
.AddSeparator()
|
||||||
.AddItem(B_TRANSLATE("Find" B_UTF8_ELLIPSIS), MENU_FIND_STRING,'F')
|
.AddItem(B_TRANSLATE("Find" B_UTF8_ELLIPSIS), MENU_FIND_STRING, 'F')
|
||||||
.AddItem(B_TRANSLATE("Find previous"), MENU_FIND_PREVIOUS, 'G',
|
.AddItem(B_TRANSLATE("Find previous"), MENU_FIND_PREVIOUS, 'G',
|
||||||
B_SHIFT_KEY)
|
B_SHIFT_KEY)
|
||||||
.GetItem(fFindPreviousMenuItem)
|
.GetItem(fFindPreviousMenuItem)
|
||||||
@@ -671,7 +676,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SHORTCUT_DEBUG_CAPTURE:
|
case SHORTCUT_DEBUG_CAPTURE:
|
||||||
_ActiveTermView()->RestartDebugCapture();
|
_ActiveTermView()->StartStopDebugCapture();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -710,8 +715,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
case MENU_PREF_OPEN:
|
case MENU_PREF_OPEN:
|
||||||
if (!fPrefWindow) {
|
if (!fPrefWindow) {
|
||||||
fPrefWindow = new PrefWindow(this);
|
fPrefWindow = new PrefWindow(this);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
fPrefWindow->Activate();
|
fPrefWindow->Activate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -728,8 +732,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
if (!fFindPanel) {
|
if (!fFindPanel) {
|
||||||
fFindPanel = new FindWindow(this, fFindString, fFindSelection,
|
fFindPanel = new FindWindow(this, fFindString, fFindSelection,
|
||||||
fMatchWord, fMatchCase, fForwardSearch);
|
fMatchWord, fMatchCase, fForwardSearch);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
fFindPanel->Activate();
|
fFindPanel->Activate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -760,7 +763,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
message->FindBool("forwardsearch", &fForwardSearch);
|
message->FindBool("forwardsearch", &fForwardSearch);
|
||||||
message->FindBool("matchcase", &fMatchCase);
|
message->FindBool("matchcase", &fMatchCase);
|
||||||
message->FindBool("matchword", &fMatchWord);
|
message->FindBool("matchword", &fMatchWord);
|
||||||
findresult = _ActiveTermView()->Find(fFindString, fForwardSearch, fMatchCase, fMatchWord);
|
findresult = _ActiveTermView()->Find(fFindString, fForwardSearch,
|
||||||
|
fMatchCase, fMatchWord);
|
||||||
|
|
||||||
if (!findresult) {
|
if (!findresult) {
|
||||||
BAlert* alert = new BAlert(B_TRANSLATE("Find failed"),
|
BAlert* alert = new BAlert(B_TRANSLATE("Find failed"),
|
||||||
@@ -899,7 +903,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
fTabView->ResizeBy(0, -mbHeight);
|
fTabView->ResizeBy(0, -mbHeight);
|
||||||
fTabView->MoveBy(0, mbHeight);
|
fTabView->MoveBy(0, mbHeight);
|
||||||
SetLook(fSavedLook);
|
SetLook(fSavedLook);
|
||||||
fSavedFrame = BRect(0,0,-1,-1);
|
fSavedFrame = BRect(0, 0, -1, -1);
|
||||||
SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
|
SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
|
||||||
fFullScreen = false;
|
fFullScreen = false;
|
||||||
}
|
}
|
||||||
@@ -922,7 +926,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (PrefHandler::GetDefaultPath(path) == B_OK)
|
if (PrefHandler::GetDefaultPath(path) == B_OK)
|
||||||
PrefHandler::Default()->SaveAsText(path.Path(), PREFFILE_MIMETYPE);
|
PrefHandler::Default()->SaveAsText(path.Path(),
|
||||||
|
PREFFILE_MIMETYPE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MENU_PAGE_SETUP:
|
case MENU_PAGE_SETUP:
|
||||||
@@ -1221,7 +1226,8 @@ TermWindow::_AddTab(Arguments* args, const BString& currentDirectory)
|
|||||||
BScrollView* scrollView = new TermScrollView("scrollView",
|
BScrollView* scrollView = new TermScrollView("scrollView",
|
||||||
containerView, view, fSessions.IsEmpty());
|
containerView, view, fSessions.IsEmpty());
|
||||||
if (!fFullScreen)
|
if (!fFullScreen)
|
||||||
scrollView->ScrollBar(B_VERTICAL)->ResizeBy(0, -(B_H_SCROLL_BAR_HEIGHT - 1));
|
scrollView->ScrollBar(B_VERTICAL)
|
||||||
|
->ResizeBy(0, -(B_H_SCROLL_BAR_HEIGHT - 1));
|
||||||
|
|
||||||
if (fSessions.IsEmpty())
|
if (fSessions.IsEmpty())
|
||||||
fTabView->SetScrollView(scrollView);
|
fTabView->SetScrollView(scrollView);
|
||||||
@@ -1964,7 +1970,7 @@ TermWindow::_NewSessionIndex()
|
|||||||
bool used = false;
|
bool used = false;
|
||||||
|
|
||||||
for (int32 i = 0;
|
for (int32 i = 0;
|
||||||
Session* session = _SessionAt(i); i++) {
|
Session* session = _SessionAt(i); i++) {
|
||||||
if (id == session->index) {
|
if (id == session->index) {
|
||||||
used = true;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold, ingo_weinhold@gmx.de
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TerminalBuffer.h"
|
#include "TerminalBuffer.h"
|
||||||
@@ -242,7 +247,7 @@ TerminalBuffer::GuessPaletteColor(int red, int green, int blue)
|
|||||||
{
|
{
|
||||||
int distance = 255 * 100;
|
int distance = 255 * 100;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
for (int i = 0; i < kTermColorCount && distance > 0; i++) {
|
for (uint32 i = 0; i < kTermColorCount && distance > 0; i++) {
|
||||||
rgb_color color = fColorsPalette[i];
|
rgb_color color = fColorsPalette[i];
|
||||||
int r = 30 * abs(color.red - red);
|
int r = 30 * abs(color.red - red);
|
||||||
int g = 59 * abs(color.green - green);
|
int g = 59 * abs(color.green - green);
|
||||||
@@ -254,7 +259,7 @@ TerminalBuffer::GuessPaletteColor(int red, int green, int blue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return min_c(index, kTermColorCount - 1);
|
return min_c(index, int(kTermColorCount - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold, ingo_weinhold@gmx.de
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
#ifndef TERMINAL_BUFFER_H
|
#ifndef TERMINAL_BUFFER_H
|
||||||
#define TERMINAL_BUFFER_H
|
#define TERMINAL_BUFFER_H
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Haiku, Inc. All rights reserved.
|
||||||
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold, ingo_weinhold@gmx.de
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
#ifndef TERMINAL_LINE_H
|
#ifndef TERMINAL_LINE_H
|
||||||
#define TERMINAL_LINE_H
|
#define TERMINAL_LINE_H
|
||||||
|
|||||||
@@ -2,30 +2,11 @@
|
|||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "VTparse.h"
|
#include "VTparse.h"
|
||||||
@@ -115,7 +96,7 @@ CASE_PRINT,
|
|||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
/* @ A B C */
|
/* @ A B C */
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
@@ -440,7 +421,7 @@ CASE_PRINT_CS96,
|
|||||||
CASE_PRINT_CS96,
|
CASE_PRINT_CS96,
|
||||||
CASE_PRINT_CS96,
|
CASE_PRINT_CS96,
|
||||||
CASE_PRINT_CS96,
|
CASE_PRINT_CS96,
|
||||||
CASE_PRINT_CS96,
|
CASE_PRINT_CS96,
|
||||||
/* @ A B C */
|
/* @ A B C */
|
||||||
CASE_PRINT_CS96,
|
CASE_PRINT_CS96,
|
||||||
CASE_PRINT_CS96,
|
CASE_PRINT_CS96,
|
||||||
@@ -1090,7 +1071,7 @@ CASE_PRINT,
|
|||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
/* @ A B C */
|
/* @ A B C */
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
@@ -3028,7 +3009,7 @@ CASE_IGNORE,
|
|||||||
CASE_IGNORE,
|
CASE_IGNORE,
|
||||||
CASE_IGNORE,
|
CASE_IGNORE,
|
||||||
/* CAN EM SUB ESC */
|
/* CAN EM SUB ESC */
|
||||||
CASE_GROUND_STATE,
|
CASE_GROUND_STATE,
|
||||||
CASE_IGNORE,
|
CASE_IGNORE,
|
||||||
CASE_GROUND_STATE,
|
CASE_GROUND_STATE,
|
||||||
CASE_IGNORE_ESC,
|
CASE_IGNORE_ESC,
|
||||||
@@ -4805,7 +4786,7 @@ CASE_PRINT,
|
|||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
/* @ A B C */
|
/* @ A B C */
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
@@ -5131,7 +5112,7 @@ CASE_PRINT,
|
|||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
/* @ A B C */
|
/* @ A B C */
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
CASE_PRINT,
|
CASE_PRINT,
|
||||||
|
|||||||
@@ -1,31 +1,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
|
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Kian Duffy, myob@users.sourceforge.net
|
||||||
|
* Siarzhuk Zharski, zharik@gmx.li
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user