Minor cleanup, Updated some copyrights
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21677 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -83,7 +83,7 @@ const uint32 coding_translation_table[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
status_t get_nth_encoding(int i, int *op);
|
status_t get_nth_encoding(int i, int *id);
|
||||||
|
|
||||||
int longname2id(const char *longname);
|
int longname2id(const char *longname);
|
||||||
const char * longname2shortname(const char *longname);
|
const char * longname2shortname(const char *longname);
|
||||||
@@ -93,5 +93,4 @@ const char id2shortcut(int op);
|
|||||||
void SetEncoding(int encoding);
|
void SetEncoding(int encoding);
|
||||||
int GetEncoding();
|
int GetEncoding();
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CODING_H_ */
|
#endif /* _CODING_H_ */
|
||||||
|
|||||||
+121
-132
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2007 Haiku, inc.
|
||||||
* Copyright (c) 2003-4 Kian Duffy <[email protected]>
|
* Copyright (c) 2003-4 Kian Duffy <[email protected]>
|
||||||
* 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.
|
||||||
@@ -54,10 +55,6 @@
|
|||||||
#define SHELL_COMMAND "/bin/sh -login"
|
#define SHELL_COMMAND "/bin/sh -login"
|
||||||
|
|
||||||
|
|
||||||
const static char *kSpawnAlertMessage = "alert --stop " "'Cannot execute \"%s\":\n"
|
|
||||||
"\t%s\n'"
|
|
||||||
"'Use Default Shell' 'Abort'";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set environment variable.
|
* Set environment variable.
|
||||||
*/
|
*/
|
||||||
@@ -92,11 +89,6 @@ setenv(const char *var, const char *value, bool overwrite)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* spawn_shell(): spawn child process, create pty master/slave device and
|
|
||||||
* execute SHELL program.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* handshake interface */
|
/* handshake interface */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -112,10 +104,111 @@ typedef struct
|
|||||||
#define PTY_WS 2 /* pty need WINSIZE (row and col ) */
|
#define PTY_WS 2 /* pty need WINSIZE (row and col ) */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static pid_t sShPid;
|
static pid_t sShPid;
|
||||||
|
|
||||||
|
|
||||||
|
Shell::Shell()
|
||||||
|
:fFd(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Shell::~Shell()
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Shell::Open(int row, int col, const char *command, const char *coding)
|
||||||
|
{
|
||||||
|
if (fFd >= 0)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
return _Spawn(row, col, command, coding);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Shell::Close()
|
||||||
|
{
|
||||||
|
if (fFd >= 0) {
|
||||||
|
close(fFd);
|
||||||
|
kill(-sShPid, SIGHUP);
|
||||||
|
int status;
|
||||||
|
wait(&status);
|
||||||
|
fFd = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
Shell::TTYName() const
|
||||||
|
{
|
||||||
|
return ttyname(fFd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
Shell::Read(void *buffer, size_t numBytes)
|
||||||
|
{
|
||||||
|
if (fFd < 0)
|
||||||
|
return B_NO_INIT;
|
||||||
|
|
||||||
|
return read(fFd, buffer, numBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
Shell::Write(const void *buffer, size_t numBytes)
|
||||||
|
{
|
||||||
|
if (fFd < 0)
|
||||||
|
return B_NO_INIT;
|
||||||
|
|
||||||
|
return write(fFd, buffer, numBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Shell::UpdateWindowSize(int rows, int columns)
|
||||||
|
{
|
||||||
|
struct winsize winSize;
|
||||||
|
winSize.ws_row = rows;
|
||||||
|
winSize.ws_col = columns;
|
||||||
|
ioctl(fFd, TIOCSWINSZ, &winSize);
|
||||||
|
Signal(SIGWINCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Shell::Signal(int signal)
|
||||||
|
{
|
||||||
|
kill(-sShPid, signal);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Shell::GetAttr(struct termios &attr)
|
||||||
|
{
|
||||||
|
return tcgetattr(fFd, &attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
Shell::SetAttr(struct termios &attr)
|
||||||
|
{
|
||||||
|
return tcsetattr(fFd, TCSANOW, &attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
Shell::FD() const
|
||||||
|
{
|
||||||
|
return fFd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// private
|
||||||
static status_t
|
static status_t
|
||||||
send_handshake_message(thread_id target, const handshake_t& handshake)
|
send_handshake_message(thread_id target, const handshake_t& handshake)
|
||||||
{
|
{
|
||||||
@@ -131,14 +224,14 @@ receive_handshake_message(handshake_t& handshake)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
status_t
|
||||||
spawn_shell(int row, int col, const char *command, const char *coding)
|
Shell::_Spawn(int row, int col, const char *command, const char *coding)
|
||||||
{
|
{
|
||||||
signal(SIGTTOU, SIG_IGN);
|
signal(SIGTTOU, SIG_IGN);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a pseudo-tty. We do this by cycling through files in the
|
* Get a pseudo-tty. We do this by cycling through files in the
|
||||||
* directory. The oparationg system will not allow us to open a master
|
* directory. The operationg system will not allow us to open a master
|
||||||
* which is already in use, so we simply go until the open succeeds.
|
* which is already in use, so we simply go until the open succeeds.
|
||||||
*/
|
*/
|
||||||
char ttyName[B_PATH_NAME_LENGTH];
|
char ttyName[B_PATH_NAME_LENGTH];
|
||||||
@@ -170,27 +263,27 @@ spawn_shell(int row, int col, const char *command, const char *coding)
|
|||||||
|
|
||||||
if (master < 0) {
|
if (master < 0) {
|
||||||
printf("didn't find any available pseudo ttys.");
|
printf("didn't find any available pseudo ttys.");
|
||||||
return -1;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the modes of the current terminal. We will duplicates these
|
* Get the modes of the current terminal. We will duplicates these
|
||||||
* on the pseudo terminal.
|
* on the pseudo terminal.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
thread_id terminalThread = find_thread(NULL);
|
thread_id terminalThread = find_thread(NULL);
|
||||||
|
|
||||||
/* Fork a child process. */
|
/* Fork a child process. */
|
||||||
if ((sShPid = fork()) < 0) {
|
if ((sShPid = fork()) < 0) {
|
||||||
close(master);
|
close(master);
|
||||||
return -1;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
handshake_t handshake;
|
handshake_t handshake;
|
||||||
|
|
||||||
if (sShPid == 0) {
|
if (sShPid == 0) {
|
||||||
// Now in child process.
|
// Now in child process.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make our controlling tty the pseudo tty. This hapens because
|
* Make our controlling tty the pseudo tty. This hapens because
|
||||||
@@ -408,8 +501,12 @@ spawn_shell(int row, int col, const char *command, const char *coding)
|
|||||||
* Exec failed.
|
* Exec failed.
|
||||||
*/
|
*/
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
const char *spawnAlertMessage = "alert --stop "
|
||||||
|
"'Cannot execute \"%s\":\n"
|
||||||
|
"\t%s\n'"
|
||||||
|
"'Use Default Shell' 'Abort'";
|
||||||
char errorMessage[256];
|
char errorMessage[256];
|
||||||
snprintf(errorMessage, sizeof(errorMessage), kSpawnAlertMessage, commandLine, strerror(errno));
|
snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, commandLine, strerror(errno));
|
||||||
|
|
||||||
if (system(errorMessage) == 0)
|
if (system(errorMessage) == 0)
|
||||||
execl("/bin/sh", "/bin/sh", "-login", NULL);
|
execl("/bin/sh", "/bin/sh", "-login", NULL);
|
||||||
@@ -449,119 +546,11 @@ spawn_shell(int row, int col, const char *command, const char *coding)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (done > 0) ? master : -1;
|
if (done <= 0)
|
||||||
}
|
return B_ERROR;
|
||||||
|
|
||||||
|
fFd = master;
|
||||||
static void
|
|
||||||
close_shell(int fd)
|
|
||||||
{
|
|
||||||
if (fd < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
int status;
|
|
||||||
kill(-sShPid, SIGHUP);
|
|
||||||
wait(&status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Shell::Shell()
|
|
||||||
:fFd(-1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Shell::~Shell()
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
Shell::Open(int row, int col, const char *command, const char *coding)
|
|
||||||
{
|
|
||||||
fFd = spawn_shell(row, col, command, coding);
|
|
||||||
if (fFd < 0)
|
|
||||||
return fFd;
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Shell::Close()
|
|
||||||
{
|
|
||||||
if (fFd >= 0) {
|
|
||||||
close_shell(fFd);
|
|
||||||
fFd = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
Shell::TTYName() const
|
|
||||||
{
|
|
||||||
return ttyname(fFd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
|
||||||
Shell::Read(void *buffer, size_t numBytes)
|
|
||||||
{
|
|
||||||
if (fFd < 0)
|
|
||||||
return B_NO_INIT;
|
|
||||||
|
|
||||||
return read(fFd, buffer, numBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
|
||||||
Shell::Write(const void *buffer, size_t numBytes)
|
|
||||||
{
|
|
||||||
if (fFd < 0)
|
|
||||||
return B_NO_INIT;
|
|
||||||
|
|
||||||
return write(fFd, buffer, numBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Shell::UpdateWindowSize(int rows, int columns)
|
|
||||||
{
|
|
||||||
struct winsize winSize;
|
|
||||||
winSize.ws_row = rows;
|
|
||||||
winSize.ws_col = columns;
|
|
||||||
ioctl(fFd, TIOCSWINSZ, &winSize);
|
|
||||||
Signal(SIGWINCH);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Shell::Signal(int signal)
|
|
||||||
{
|
|
||||||
kill(-sShPid, signal);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
Shell::GetAttr(struct termios &attr)
|
|
||||||
{
|
|
||||||
return tcgetattr(fFd, &attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
Shell::SetAttr(struct termios &attr)
|
|
||||||
{
|
|
||||||
return tcsetattr(fFd, TCSANOW, &attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
Shell::FD() const
|
|
||||||
{
|
|
||||||
return fFd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,9 @@ public:
|
|||||||
int FD() const;
|
int FD() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int fFd;
|
int fFd;
|
||||||
|
|
||||||
|
status_t _Spawn(int row, int col, const char *command, const char *coding);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SHELL_H
|
#endif // _SHELL_H
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2007 Haiku, Inc.
|
||||||
* Copyright (c) 2003-2004 Kian Duffy <[email protected]>
|
* Copyright (c) 2003-2004 Kian Duffy <[email protected]>
|
||||||
* Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
* Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
||||||
* Copyright (c) 2004 Daniel Furrer <[email protected]>
|
* Copyright (c) 2004 Daniel Furrer <[email protected]>
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <MessageRunner.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PrintJob.h>
|
#include <PrintJob.h>
|
||||||
#include <PropertyInfo.h>
|
#include <PropertyInfo.h>
|
||||||
@@ -20,7 +22,6 @@
|
|||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <WindowScreen.h>
|
#include <WindowScreen.h>
|
||||||
|
|
||||||
#include <float.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@@ -33,7 +34,6 @@
|
|||||||
#include "PrefWindow.h"
|
#include "PrefWindow.h"
|
||||||
#include "PrefView.h"
|
#include "PrefView.h"
|
||||||
#include "PrefHandler.h"
|
#include "PrefHandler.h"
|
||||||
#include "TermApp.h"
|
|
||||||
#include "TermBaseView.h"
|
#include "TermBaseView.h"
|
||||||
#include "TermBuffer.h"
|
#include "TermBuffer.h"
|
||||||
#include "TermParse.h"
|
#include "TermParse.h"
|
||||||
@@ -171,7 +171,7 @@ TermWindow::InitWindow()
|
|||||||
* TermView is character Terminal view on BaseView. It has paste
|
* TermView is character Terminal view on BaseView. It has paste
|
||||||
* on BaseView shift as VIEW_OFFSET.
|
* on BaseView shift as VIEW_OFFSET.
|
||||||
*/
|
*/
|
||||||
fBaseView = new TermBaseView(textframe, fTermView);
|
//fBaseView = new TermBaseView(textframe, fTermView);
|
||||||
|
|
||||||
// Initialize TermView. (font, size and color)
|
// Initialize TermView. (font, size and color)
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ TermWindow::InitWindow()
|
|||||||
MIN_COLS * height, MAX_COLS * height);
|
MIN_COLS * height, MAX_COLS * height);
|
||||||
|
|
||||||
fTermView->SetTermColor();
|
fTermView->SetTermColor();
|
||||||
fBaseView->SetViewColor(PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR));
|
//fBaseView->SetViewColor(PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR));
|
||||||
|
|
||||||
// Add offset to baseview.
|
// Add offset to baseview.
|
||||||
rect.InsetBy(-VIEW_OFFSET, -VIEW_OFFSET);
|
rect.InsetBy(-VIEW_OFFSET, -VIEW_OFFSET);
|
||||||
@@ -196,9 +196,9 @@ TermWindow::InitWindow()
|
|||||||
ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH,
|
ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH,
|
||||||
rect.Height() + fMenubar->Bounds().Height());
|
rect.Height() + fMenubar->Bounds().Height());
|
||||||
|
|
||||||
fBaseView->ResizeTo(rect.Width(), rect.Height());
|
//fBaseView->ResizeTo(rect.Width(), rect.Height());
|
||||||
fBaseView->AddChild(fTermView);
|
//fBaseView->AddChild(fTermView);
|
||||||
fTermView->MoveBy(VIEW_OFFSET, VIEW_OFFSET);
|
//fTermView->MoveBy(VIEW_OFFSET, VIEW_OFFSET);
|
||||||
|
|
||||||
// Make Scroll Bar.
|
// Make Scroll Bar.
|
||||||
|
|
||||||
@@ -212,7 +212,8 @@ TermWindow::InitWindow()
|
|||||||
fTermView->SetScrollBar(scrollBar);
|
fTermView->SetScrollBar(scrollBar);
|
||||||
|
|
||||||
AddChild(scrollBar);
|
AddChild(scrollBar);
|
||||||
AddChild(fBaseView);
|
//AddChild(fBaseView);
|
||||||
|
AddChild(fTermView);
|
||||||
|
|
||||||
// Set fEditmenu's target to fTermView. (Oh!...)
|
// Set fEditmenu's target to fTermView. (Oh!...)
|
||||||
fEditmenu->SetTargetForItems(fTermView);
|
fEditmenu->SetTargetForItems(fTermView);
|
||||||
@@ -223,14 +224,6 @@ TermWindow::InitWindow()
|
|||||||
if (fTermParse->StartThreads() < B_OK)
|
if (fTermParse->StartThreads() < B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Set Coding.
|
|
||||||
|
|
||||||
// Init find parameters
|
|
||||||
fMatchCase = false;
|
|
||||||
fMatchWord = false;
|
|
||||||
fFindSelection = false;
|
|
||||||
fForwardSearch = false;
|
|
||||||
|
|
||||||
// Initialize MessageRunner.
|
// Initialize MessageRunner.
|
||||||
fWindowUpdate = new BMessageRunner(BMessenger(this),
|
fWindowUpdate = new BMessageRunner(BMessenger(this),
|
||||||
new BMessage (MSGRUN_WINDOW), 500000);
|
new BMessage (MSGRUN_WINDOW), 500000);
|
||||||
@@ -238,7 +231,7 @@ TermWindow::InitWindow()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermWindow::MenusBeginning(void)
|
TermWindow::MenusBeginning()
|
||||||
{
|
{
|
||||||
// Syncronize Encode Menu Pop-up menu and Preference.
|
// Syncronize Encode Menu Pop-up menu and Preference.
|
||||||
(fEncodingmenu->FindItem(id2longname(GetEncoding())))->SetMarked(true);
|
(fEncodingmenu->FindItem(id2longname(GetEncoding())))->SetMarked(true);
|
||||||
@@ -247,7 +240,7 @@ TermWindow::MenusBeginning(void)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TermWindow::SetupMenu(void)
|
TermWindow::SetupMenu()
|
||||||
{
|
{
|
||||||
PrefHandler menuText;
|
PrefHandler menuText;
|
||||||
|
|
||||||
@@ -561,8 +554,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
fTermView->ScrollBar()->Hide();
|
fTermView->ScrollBar()->Hide();
|
||||||
fMenubar->Hide();
|
fMenubar->Hide();
|
||||||
fBaseView->MoveTo(0,0);
|
fTermView->MoveTo(0,0);
|
||||||
fBaseView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight);
|
fTermView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight);
|
||||||
fSavedLook = Look();
|
fSavedLook = Look();
|
||||||
// done before ResizeTo to work around a Dano bug (not erasing the decor)
|
// done before ResizeTo to work around a Dano bug (not erasing the decor)
|
||||||
SetLook(B_NO_BORDER_WINDOW_LOOK);
|
SetLook(B_NO_BORDER_WINDOW_LOOK);
|
||||||
@@ -574,8 +567,8 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
fTermView->ScrollBar()->Show();
|
fTermView->ScrollBar()->Show();
|
||||||
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
||||||
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
||||||
fBaseView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight);
|
fTermView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight);
|
||||||
fBaseView->MoveTo(0,mbHeight);
|
fTermView->MoveTo(0,mbHeight);
|
||||||
SetLook(fSavedLook);
|
SetLook(fSavedLook);
|
||||||
fSavedFrame = BRect(0,0,-1,-1);
|
fSavedFrame = BRect(0,0,-1,-1);
|
||||||
}
|
}
|
||||||
@@ -587,9 +580,9 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_COLOR_CHANGED: {
|
case MSG_COLOR_CHANGED: {
|
||||||
fBaseView->SetViewColor (PrefHandler::Default()->getRGB (PREF_TEXT_BACK_COLOR));
|
//fBaseView->SetViewColor (PrefHandler::Default()->getRGB (PREF_TEXT_BACK_COLOR));
|
||||||
fTermView->SetTermColor ();
|
fTermView->SetTermColor();
|
||||||
fBaseView->Invalidate();
|
//fBaseView->Invalidate();
|
||||||
fTermView->Invalidate();
|
fTermView->Invalidate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,72 +28,74 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef TERMWIN_H
|
#ifndef __TERMWINDOW_H
|
||||||
#define TERMWIN_H
|
#define __TERMWINDOW_H
|
||||||
|
|
||||||
|
|
||||||
#include <Menu.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <MessageRunner.h>
|
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
class BFont;
|
class BMenu;
|
||||||
class TermView;
|
class BMenuBar;
|
||||||
class TermParse;
|
class BMessageRunner;
|
||||||
class CodeConv;
|
class CodeConv;
|
||||||
class PrefWindow;
|
|
||||||
class FindWindow;
|
class FindWindow;
|
||||||
|
class PrefWindow;
|
||||||
class Shell;
|
class Shell;
|
||||||
|
class TermParse;
|
||||||
|
class TermView;
|
||||||
|
|
||||||
class TermWindow : public BWindow {
|
class TermWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
TermWindow(BRect frame, const char* title, const char *command);
|
TermWindow(BRect frame, const char* title, const char *command);
|
||||||
virtual ~TermWindow();
|
virtual ~TermWindow();
|
||||||
|
|
||||||
void TermWinActivate();
|
void TermWinActivate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
virtual void WindowActivated(bool);
|
virtual void WindowActivated(bool);
|
||||||
virtual void MenusBeginning(void);
|
virtual void MenusBeginning();
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
status_t GetSupportedSuites(BMessage *msg);
|
status_t GetSupportedSuites(BMessage *msg);
|
||||||
BHandler* ResolveSpecifier(BMessage *msg, int32 index,
|
BHandler* ResolveSpecifier(BMessage *msg, int32 index,
|
||||||
BMessage *specifier, int32 form,
|
BMessage *specifier, int32 form,
|
||||||
const char *property);
|
const char *property);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitWindow();
|
void InitWindow();
|
||||||
void SetupMenu();
|
void SetupMenu();
|
||||||
status_t DoPageSetup();
|
status_t DoPageSetup();
|
||||||
void DoPrint();
|
void DoPrint();
|
||||||
|
|
||||||
/*
|
Shell *fShell;
|
||||||
* data member
|
TermParse *fTermParse;
|
||||||
*/
|
BMenuBar *fMenubar;
|
||||||
Shell *fShell;
|
BMenu *fFilemenu,
|
||||||
TermParse *fTermParse;
|
*fEditmenu,
|
||||||
BMenuBar *fMenubar;
|
*fEncodingmenu,
|
||||||
BMenu *fFilemenu, *fEditmenu, *fEncodingmenu, *fHelpmenu, *fFontMenu, *fWindowSizeMenu, *fNewFontMenu;
|
*fHelpmenu,
|
||||||
TermView *fTermView;
|
*fFontMenu,
|
||||||
BView *fBaseView;
|
*fWindowSizeMenu,
|
||||||
CodeConv *fCodeConv;
|
*fNewFontMenu;
|
||||||
BMessage *fPrintSettings;
|
TermView *fTermView;
|
||||||
PrefWindow *fPrefWindow;
|
BView *fBaseView;
|
||||||
FindWindow *fFindPanel;
|
CodeConv *fCodeConv;
|
||||||
BMessageRunner *fWindowUpdate;
|
BMessage *fPrintSettings;
|
||||||
|
PrefWindow *fPrefWindow;
|
||||||
BRect fSavedFrame;
|
FindWindow *fFindPanel;
|
||||||
window_look fSavedLook;
|
BMessageRunner *fWindowUpdate;
|
||||||
//Saved search parameters
|
BRect fSavedFrame;
|
||||||
BString fFindString;
|
window_look fSavedLook;
|
||||||
BMenuItem *fFindForwardMenuItem;
|
|
||||||
BMenuItem *fFindBackwardMenuItem;
|
//Saved search parameters
|
||||||
bool fFindSelection;
|
BString fFindString;
|
||||||
bool fForwardSearch;
|
BMenuItem *fFindForwardMenuItem;
|
||||||
bool fMatchCase;
|
BMenuItem *fFindBackwardMenuItem;
|
||||||
bool fMatchWord;
|
bool fFindSelection;
|
||||||
|
bool fForwardSearch;
|
||||||
|
bool fMatchCase;
|
||||||
|
bool fMatchWord;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TERMWIN_H
|
#endif // __TERMWINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user