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
+10 -38
View File
@@ -752,7 +752,7 @@ TermView::_InitViewThread()
resume_thread(fMouseThread); resume_thread(fMouseThread);
return fViewThread; return B_OK;
} }
@@ -1675,34 +1675,6 @@ TermView::DoClearAll(void)
fScrollBar->SetProportion(1); 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 /*! Write strings to PTY device. If encoding system isn't UTF8, change
encoding to UTF8 before writing PTY. encoding to UTF8 before writing PTY.
@@ -2143,20 +2115,16 @@ TermView::GetFontInfo(int *width, int *height)
// Find a string, and select it if found // Find a string, and select it if found
bool 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 //Get the buffer contents
BString buffer;
fTextBuffer->ToString(buffer); fTextBuffer->ToString(buffer);
selectionstart = fTextBuffer->GetSelectionStart(); CurPos selectionstart = fTextBuffer->GetSelectionStart();
selectionend = fTextBuffer->GetSelectionEnd(); CurPos selectionend = fTextBuffer->GetSelectionEnd();
int offset = 0;
if (selectionstart.x >= 0 || selectionstart.y >= 0) { if (selectionstart.x >= 0 || selectionstart.y >= 0) {
if (forwardSearch) if (forwardSearch)
//Set the offset to the end of the selection //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; offset = (selectionstart.y) * fTermColumns + selectionstart.x;
} }
int initialresult = -1;
int result = B_ERROR;
for (;;) { for (;;) {
//Actual search //Actual search
if (forwardSearch) { if (forwardSearch) {
@@ -2263,3 +2234,4 @@ TermView::SendDataToDrawEngine(int x1, int y1, int x2, int y2)
release_sem(fDrawRectSem); release_sem(fDrawRectSem);
} }
-9
View File
@@ -195,7 +195,6 @@ class TermView : public BView {
void DoSelectAll(); void DoSelectAll();
void DoClearAll(); void DoClearAll();
int SubstMetaChar (const char *p, char *q);
void WritePTY (const uchar *text, int num_byteses); void WritePTY (const uchar *text, int num_byteses);
// Comunicate Input Method // Comunicate Input Method
@@ -208,9 +207,6 @@ class TermView : public BView {
int32 GetCharFromUTF8String (const char *, char *); int32 GetCharFromUTF8String (const char *, char *);
int32 GetWidthFromUTF8String (const char *); int32 GetWidthFromUTF8String (const char *);
// mouse operation
int32 SetupMouseButton(const char *bname);
// Mouse select // Mouse select
void Select(CurPos start, CurPos end); void Select(CurPos start, CurPos end);
void AddSelectRegion(CurPos); void AddSelectRegion(CurPos);
@@ -304,11 +300,6 @@ class TermView : public BView {
int fScrBufSize; int fScrBufSize;
bool fScrRegionSet; bool fScrRegionSet;
// mouse
int32 mSelectButton;
int32 mSubMenuButton;
int32 mPasteMenuButton;
bool fMouseImage; bool fMouseImage;
BPoint fPreviousMousePoint; BPoint fPreviousMousePoint;
+42 -54
View File
@@ -688,76 +688,64 @@ void SetCoding (int coding)
return; return;
} }
////////////////////////////////////////////////////////////////////////////
// DoPageSetUp ()
//
////////////////////////////////////////////////////////////////////////////
status_t status_t
TermWindow::DoPageSetup() TermWindow::DoPageSetup()
{ {
status_t rv; BPrintJob job("PageSetup");
BPrintJob job("PageSetup");
/* display the page configure panel */ // display the page configure panel
rv = job.ConfigPage(); status_t status = job.ConfigPage();
/* save a pointer to the settings */ // save a pointer to the settings
fPrintSettings = job.Settings(); fPrintSettings = job.Settings();
return rv; return status;
} }
////////////////////////////////////////////////////////////////////////////
// DoPrint ()
//
////////////////////////////////////////////////////////////////////////////
void void
TermWindow::DoPrint() TermWindow::DoPrint()
{ {
//#if B_BEOS_VERSION < 0x0460 if (!fPrintSettings || (DoPageSetup() != B_NO_ERROR)) {
BPrintJob job("Print"); (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 pageRect = job.PrintableRect();
BRect curPageRect = pageRect; BRect curPageRect = pageRect;
int pHeight = (int)pageRect.Height(); int pHeight = (int)pageRect.Height();
int pWidth = (int)pageRect.Width(); int pWidth = (int)pageRect.Width();
float w,h; float w,h;
fTermView->GetFrameSize (&w, &h); fTermView->GetFrameSize(&w, &h);
int xPages = (int)ceil(w / pWidth); int xPages = (int)ceil(w / pWidth);
int yPages = (int)ceil(h / pHeight); int yPages = (int)ceil(h / pHeight);
/* engage the print server */ job.BeginJob();
job.BeginJob();
/* loop through and draw each page, and write to spool */ // loop through and draw each page, and write to spool
for(int x = 0; x < xPages; x++) for (int x = 0; x < xPages; x++) {
for(int y = 0; y < yPages; y++){ for (int y = 0; y < yPages; y++) {
curPageRect.OffsetTo(x * pWidth, y * pHeight); curPageRect.OffsetTo(x * pWidth, y * pHeight);
job.DrawView(fTermView, curPageRect, BPoint(0, 0)); job.DrawView(fTermView, curPageRect, B_ORIGIN);
job.SpoolPage(); job.SpoolPage();
if(!job.CanContinue()){ if (!job.CanContinue()){
// It is likely that the only way that the job was cancelled is // 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 // 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. // case, the user does *not* need to be told that it was cancelled.
// He/she will simply expect that it was done. // He/she will simply expect that it was done.
// (new BAlert("Cancel", "Print job cancelled", "OK"))->Go(); // (new BAlert("Cancel", "Print job cancelled", "OK"))->Go();
return; return;
} }
} }
}
/* commit the job, send the spool file */
job.CommitJob(); job.CommitJob();
//#endif
} }
+2 -2
View File
@@ -86,13 +86,13 @@ class TermWindow : public BWindow {
PrefWindow *fPrefWindow; PrefWindow *fPrefWindow;
FindWindow *fFindPanel; FindWindow *fFindPanel;
BMessageRunner *fWindowUpdate; BMessageRunner *fWindowUpdate;
BMenuItem *item;
BRect fSavedFrame; BRect fSavedFrame;
window_look fSavedLook; window_look fSavedLook;
//Saved search parameters //Saved search parameters
BString fFindString; BString fFindString;
BMenuItem *fFindForwardMenuItem; BMenuItem *fFindForwardMenuItem;
BMenuItem *fFindBackwardMenuItem; BMenuItem *fFindBackwardMenuItem;
bool fFindSelection; bool fFindSelection;
bool fForwardSearch; bool fForwardSearch;
bool fMatchCase; bool fMatchCase;
+8 -10
View File
@@ -36,15 +36,13 @@
PrefHandler *gTermPref; /* Preference temporary */ 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;
} }