Removed unused methods and variables, small style cleanups

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20843 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-04-26 19:51:09 +00:00
parent e3c5e99110
commit 5240f11543
5 changed files with 62 additions and 113 deletions

View File

@ -752,7 +752,7 @@ TermView::_InitViewThread()
resume_thread(fMouseThread);
return fViewThread;
return B_OK;
}
@ -1675,34 +1675,6 @@ TermView::DoClearAll(void)
fScrollBar->SetProportion(1);
}
// Substitution meta character
int
TermView::SubstMetaChar(const char *p, char *q)
{
char *metachar = " ~`#$&*()\\|[]{};'\"<>?!";
int num_char = 0;
while(*p) {
char *mp = metachar;
for(int i = 0; i < 22; i++){
if (*p == *mp++) {
*q++ = '\\';
num_char++;
break;
}
}
*q++ = *p++;
num_char++;
}
// Add null string
*q = *p;
return num_char + 1;
}
/*! Write strings to PTY device. If encoding system isn't UTF8, change
encoding to UTF8 before writing PTY.
@ -2143,20 +2115,16 @@ TermView::GetFontInfo(int *width, int *height)
// Find a string, and select it if found
bool
TermView::Find (const BString &str, bool forwardSearch, bool matchCase, bool matchWord)
TermView::Find(const BString &str, bool forwardSearch, bool matchCase, bool matchWord)
{
BString buffer;
CurPos selectionstart, selectionend;
int offset = 0;
int initialresult = -1;
int result = B_ERROR;
//Get the buffer contents
BString buffer;
fTextBuffer->ToString(buffer);
selectionstart = fTextBuffer->GetSelectionStart();
selectionend = fTextBuffer->GetSelectionEnd();
CurPos selectionstart = fTextBuffer->GetSelectionStart();
CurPos selectionend = fTextBuffer->GetSelectionEnd();
int offset = 0;
if (selectionstart.x >= 0 || selectionstart.y >= 0) {
if (forwardSearch)
//Set the offset to the end of the selection
@ -2165,6 +2133,9 @@ TermView::Find (const BString &str, bool forwardSearch, bool matchCase, bool mat
offset = (selectionstart.y) * fTermColumns + selectionstart.x;
}
int initialresult = -1;
int result = B_ERROR;
for (;;) {
//Actual search
if (forwardSearch) {
@ -2263,3 +2234,4 @@ TermView::SendDataToDrawEngine(int x1, int y1, int x2, int y2)
release_sem(fDrawRectSem);
}

View File

@ -195,7 +195,6 @@ class TermView : public BView {
void DoSelectAll();
void DoClearAll();
int SubstMetaChar (const char *p, char *q);
void WritePTY (const uchar *text, int num_byteses);
// Comunicate Input Method
@ -208,9 +207,6 @@ class TermView : public BView {
int32 GetCharFromUTF8String (const char *, char *);
int32 GetWidthFromUTF8String (const char *);
// mouse operation
int32 SetupMouseButton(const char *bname);
// Mouse select
void Select(CurPos start, CurPos end);
void AddSelectRegion(CurPos);
@ -304,11 +300,6 @@ class TermView : public BView {
int fScrBufSize;
bool fScrRegionSet;
// mouse
int32 mSelectButton;
int32 mSubMenuButton;
int32 mPasteMenuButton;
bool fMouseImage;
BPoint fPreviousMousePoint;

View File

@ -688,76 +688,64 @@ void SetCoding (int coding)
return;
}
////////////////////////////////////////////////////////////////////////////
// DoPageSetUp ()
//
////////////////////////////////////////////////////////////////////////////
status_t
TermWindow::DoPageSetup()
{
status_t rv;
BPrintJob job("PageSetup");
BPrintJob job("PageSetup");
/* display the page configure panel */
rv = job.ConfigPage();
// display the page configure panel
status_t status = job.ConfigPage();
/* save a pointer to the settings */
fPrintSettings = job.Settings();
// save a pointer to the settings
fPrintSettings = job.Settings();
return rv;
return status;
}
////////////////////////////////////////////////////////////////////////////
// DoPrint ()
//
////////////////////////////////////////////////////////////////////////////
void
TermWindow::DoPrint()
{
//#if B_BEOS_VERSION < 0x0460
BPrintJob job("Print");
if((! fPrintSettings) || (DoPageSetup() != B_NO_ERROR)) {
(new BAlert("Cancel", "Print cancelled.", "OK"))->Go();
return;
}
if (!fPrintSettings || (DoPageSetup() != B_NO_ERROR)) {
(new BAlert("Cancel", "Print cancelled.", "OK"))->Go();
return;
}
job.SetSettings(new BMessage(*fPrintSettings));
BPrintJob job("Print");
job.SetSettings(new BMessage(*fPrintSettings));
BRect pageRect = job.PrintableRect();
BRect curPageRect = pageRect;
BRect pageRect = job.PrintableRect();
BRect curPageRect = pageRect;
int pHeight = (int)pageRect.Height();
int pWidth = (int)pageRect.Width();
float w,h;
fTermView->GetFrameSize (&w, &h);
int xPages = (int)ceil(w / pWidth);
int yPages = (int)ceil(h / pHeight);
int pHeight = (int)pageRect.Height();
int pWidth = (int)pageRect.Width();
float w,h;
fTermView->GetFrameSize(&w, &h);
int xPages = (int)ceil(w / pWidth);
int yPages = (int)ceil(h / pHeight);
/* engage the print server */
job.BeginJob();
job.BeginJob();
/* loop through and draw each page, and write to spool */
for(int x = 0; x < xPages; x++)
for(int y = 0; y < yPages; y++){
curPageRect.OffsetTo(x * pWidth, y * pHeight);
job.DrawView(fTermView, curPageRect, BPoint(0, 0));
job.SpoolPage();
// loop through and draw each page, and write to spool
for (int x = 0; x < xPages; x++) {
for (int y = 0; y < yPages; y++) {
curPageRect.OffsetTo(x * pWidth, y * pHeight);
job.DrawView(fTermView, curPageRect, B_ORIGIN);
job.SpoolPage();
if(!job.CanContinue()){
// It is likely that the only way that the job was cancelled is
// because the user hit 'Cancel' in the page setup window, in which
// case, the user does *not* need to be told that it was cancelled.
// He/she will simply expect that it was done.
// (new BAlert("Cancel", "Print job cancelled", "OK"))->Go();
return;
}
}
/* commit the job, send the spool file */
job.CommitJob();
//#endif
if (!job.CanContinue()){
// It is likely that the only way that the job was cancelled is
// because the user hit 'Cancel' in the page setup window, in which
// case, the user does *not* need to be told that it was cancelled.
// He/she will simply expect that it was done.
// (new BAlert("Cancel", "Print job cancelled", "OK"))->Go();
return;
}
}
}
job.CommitJob();
}

View File

@ -86,13 +86,13 @@ class TermWindow : public BWindow {
PrefWindow *fPrefWindow;
FindWindow *fFindPanel;
BMessageRunner *fWindowUpdate;
BMenuItem *item;
BRect fSavedFrame;
window_look fSavedLook;
//Saved search parameters
BString fFindString;
BMenuItem *fFindForwardMenuItem;
BMenuItem *fFindBackwardMenuItem;
BMenuItem *fFindBackwardMenuItem;
bool fFindSelection;
bool fForwardSearch;
bool fMatchCase;

View File

@ -36,15 +36,13 @@
PrefHandler *gTermPref; /* Preference temporary */
////////////////////////////////////////////////////////////////////////////
// main (int argc, char **argv)
// main routine of MuTerminal.
////////////////////////////////////////////////////////////////////////////
int
main ()
{
TermApp app;
app.Run ();
return 0;
int
main()
{
TermApp app;
app.Run();
return 0;
}