diff --git a/src/apps/terminal/AppearPrefView.cpp b/src/apps/terminal/AppearPrefView.cpp index 554beec3b2..850a8078ec 100644 --- a/src/apps/terminal/AppearPrefView.cpp +++ b/src/apps/terminal/AppearPrefView.cpp @@ -106,7 +106,7 @@ AppearancePrefView::MessageReceived(BMessage *msg) switch (msg->what) { case MSG_HALF_FONT_CHANGED: - PrefHandler::Default()->setString (PREF_HALF_FONT_FAMILY, + PrefHandler::Default()->setString(PREF_HALF_FONT_FAMILY, fFont->Menu()->FindMarked()->Label()); modified = true; break; @@ -135,10 +135,7 @@ AppearancePrefView::MessageReceived(BMessage *msg) if (modified) { fAppearancePrefViewMessenger.SendMessage(msg); - // send message to fTermWindow - - // send the MSG_PREF_MODIFIED message - // to fPrefWindow + BMessenger messenger(this); messenger.SendMessage(MSG_PREF_MODIFIED); } @@ -156,10 +153,13 @@ AppearancePrefView::_MakeFontMenu(uint32 command, const char *defaultFontName) uint32 flags; if (get_font_family(i, &family, &flags) == B_OK) { - menu->AddItem(new BMenuItem(family, new BMessage(command))); - if (!strcmp(defaultFontName, family)) { - BMenuItem* item = menu->ItemAt(i); - item->SetMarked(true); + BFont font; + font.SetFamilyAndStyle(family, NULL); + if (font.IsFixed()) { + BMenuItem *item = new BMenuItem(family, new BMessage(command)); + menu->AddItem(item); + if (!strcmp(defaultFontName, family)) + item->SetMarked(true); } } } diff --git a/src/apps/terminal/CodeConv.cpp b/src/apps/terminal/CodeConv.cpp index 0c16ab943b..e5b343096d 100644 --- a/src/apps/terminal/CodeConv.cpp +++ b/src/apps/terminal/CodeConv.cpp @@ -38,6 +38,7 @@ extern char gUTF8WidthTable[]; // defined in UTF8WidthTbl.c int32 CodeConv::UTF8GetFontWidth(const char *string) { + return 1; ushort unicode = UTF8toUnicode(string); uchar width = gUTF8WidthTable[unicode >> 3]; ushort offset = unicode & 0x07; diff --git a/src/apps/terminal/PrefHandler.cpp b/src/apps/terminal/PrefHandler.cpp index d30335a825..acb8169938 100644 --- a/src/apps/terminal/PrefHandler.cpp +++ b/src/apps/terminal/PrefHandler.cpp @@ -36,8 +36,6 @@ static const pref_defaults kTermDefaults[] = { { PREF_HALF_FONT_FAMILY, "Courier10 BT" }, { PREF_HALF_FONT_SIZE, "12" }, - { PREF_FULL_FONT_FAMILY, "Haru Tohaba" }, - { PREF_FULL_FONT_SIZE, "12" }, { PREF_TEXT_FORE_COLOR, " 0, 0, 0" }, { PREF_TEXT_BACK_COLOR, "255, 255, 255" }, @@ -75,7 +73,6 @@ PrefHandler::PrefHandler() OpenText(path.Path()); _ConfirmFont(PREF_HALF_FONT_FAMILY, be_fixed_font); - _ConfirmFont(PREF_FULL_FONT_FAMILY, be_fixed_font); } @@ -388,11 +385,8 @@ PrefHandler::_LoadFromFile(const char* path) setInt32(PREF_COLS, prefs.cols); setInt32(PREF_ROWS, prefs.rows); setInt32(PREF_HALF_FONT_SIZE, prefs.font_size); - setInt32(PREF_FULL_FONT_SIZE, prefs.font_size); char *font_family = strtok(prefs.font, "/"); char *font_style = strtok(NULL, ""); - setString(PREF_FULL_FONT_FAMILY, font_family); - setString(PREF_FULL_FONT_STYLE, font_style); setString(PREF_HALF_FONT_FAMILY, font_family); setString(PREF_HALF_FONT_STYLE, font_style); setRGB(PREF_TEXT_BACK_COLOR, prefs.bg); diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp index 03fdbe81ba..e04a03b7b8 100644 --- a/src/apps/terminal/Shell.cpp +++ b/src/apps/terminal/Shell.cpp @@ -526,7 +526,7 @@ Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **arg break; case PTY_NG: - printf("%s\n", handshake.msg); + fprintf(stderr, "%s\n", handshake.msg); done = -1; break; diff --git a/src/apps/terminal/ShellPrefView.cpp b/src/apps/terminal/ShellPrefView.cpp deleted file mode 100644 index 98d1f6e181..0000000000 --- a/src/apps/terminal/ShellPrefView.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2003-2004 Kian Duffy - * Copyright (c) 1998,99 Kazuho Okui and Takashi Murai. - * - * Distributed unter the terms of the MIT license. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ShellPrefView.h" -#include "PrefHandler.h" -#include "TermWindow.h" -#include "TermBuffer.h" -#include "TermConst.h" -#include "MenuUtil.h" -#include "TTextControl.h" - - - -ShellPrefView::ShellPrefView(BRect frame, const char *name, - TermWindow *window) - : PrefView(frame, name) -{ - fTermWindow = window; - - mCols = new TTextControl(BRect(0, 0, 160, 20), "cols", "Columns", "", - new BMessage(MSG_COLS_CHANGED)); - AddChild(mCols); - mCols->SetText(PrefHandler::Default()->getString(PREF_COLS)); - - mRows = new TTextControl(BRect(0, 30, 160, 50), "rows", "Rows", "", - new BMessage(MSG_ROWS_CHANGED)); - AddChild(mRows); - mRows->SetText(PrefHandler::Default()->getString(PREF_ROWS)); - - mHistory = new TTextControl(BRect(0, 60, 160, 80), "history", "History", "", - new BMessage(MSG_HISTORY_CHANGED)); - AddChild(mHistory); - mHistory->SetText(PrefHandler::Default()->getString(PREF_HISTORY_SIZE)); -} - - -void -ShellPrefView::Revert() -{ - mCols->SetText(PrefHandler::Default()->getString(PREF_COLS)); - mRows->SetText(PrefHandler::Default()->getString(PREF_ROWS)); - mHistory->SetText(PrefHandler::Default()->getString(PREF_HISTORY_SIZE)); -} - - -void -ShellPrefView::SaveIfModified() -{ - BMessenger messenger(fTermWindow); - - if (mCols->IsModified()) { - PrefHandler::Default()->setString(PREF_COLS, mCols->Text()); - messenger.SendMessage(MSG_COLS_CHANGED); - mCols->ModifiedText(false); - } - if (mRows->IsModified()) { - PrefHandler::Default()->setString(PREF_ROWS, mRows->Text()); - messenger.SendMessage(MSG_ROWS_CHANGED); - mRows->ModifiedText(false); - } - //if (mShell->IsModified()) - // PrefHandler::Default()->setString (PREF_SHELL, mShell->Text()); - - if (mHistory->IsModified()) { - int size = atoi(mHistory->Text()); - if (size < 512) - mHistory->SetText("512"); - if (size > 1048575) - mHistory->SetText("1048575"); - - PrefHandler::Default()->setString (PREF_HISTORY_SIZE, mHistory->Text()); - } -} - - -void -ShellPrefView::SetControlLabels(PrefHandler& labels) -{ - mCols->SetLabel("Columns"); - mRows->SetLabel("Rows"); - //mShell->SetLabel("Shell"); - mHistory->SetLabel("History Size"); -} - - -void -ShellPrefView::AttachedToWindow() -{ - mCols->SetTarget(this); - mRows->SetTarget(this); - //mShell->SetTarget(this); - mHistory->SetTarget(this); -} - - -void -ShellPrefView::MessageReceived(BMessage *msg) -{ - bool modified = false; - int size; - - switch (msg->what) { - case MSG_COLS_CHANGED: - size = atoi (mCols->Text()); - if (size >= MAX_COLS || size < MIN_COLS) { - mCols->SetText (PrefHandler::Default()->getString (PREF_COLS)); - beep (); - } else { - PrefHandler::Default()->setString (PREF_COLS, mCols->Text()); - modified = true; - } - break; - - case MSG_ROWS_CHANGED: - size = atoi (mRows->Text()); - if (size >= MAX_COLS || size < MIN_COLS) { - mRows->SetText(PrefHandler::Default()->getString(PREF_ROWS)); - beep (); - } else { - PrefHandler::Default()->setString(PREF_ROWS, mRows->Text()); - modified = true; - } - break; - -// case MSG_SHELL_CHANGED: -// PrefHandler::Default()->setString (PREF_SHELL, mShell->Text()); -// Window()->PostMessage(MSG_PREF_MODIFIED); -// break; - - case MSG_HISTORY_CHANGED: - size = atoi(mHistory->Text()); - - if (size < 512 || size > 1048575) { - mHistory->SetText(PrefHandler::Default()->getString(PREF_HISTORY_SIZE)); - beep (); - } else { - PrefHandler::Default()->setString(PREF_HISTORY_SIZE, mHistory->Text()); - Window()->PostMessage(MSG_PREF_MODIFIED); - } - break; - - default: - PrefView::MessageReceived(msg); - break; - } - - if (modified) { - fTermWindow->PostMessage(msg); - Window()->PostMessage(MSG_PREF_MODIFIED); - } -} diff --git a/src/apps/terminal/ShellPrefView.h b/src/apps/terminal/ShellPrefView.h deleted file mode 100644 index c5ba02686f..0000000000 --- a/src/apps/terminal/ShellPrefView.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2003-2004 Kian Duffy - * Copyright (c) 1998,99 Kazuho Okui and Takashi Murai. - * - * Distributed unter the terms of the MIT license. - */ -#ifndef SHELLPREFVIEW_H -#define SHELLPREFVIEW_H_ - - -#include "PrefView.h" - - -class TermWindow; -class TTextControl; - -class ShellPrefView : public PrefView { - public: - ShellPrefView(BRect frame, const char* name, TermWindow* window); - - virtual void AttachedToWindow(); - virtual void MessageReceived(BMessage* message); - - void Revert(); - void SetControlLabels(PrefHandler& Labels); - - virtual void SaveIfModified(); - - private: - TTextControl* mCols; - TTextControl* mRows; - - TTextControl* mShell; - TTextControl* mHistory; - - TermWindow* fTermWindow; -}; - -#endif // SHELLPREFVIEW_H diff --git a/src/apps/terminal/SmartTabView.cpp b/src/apps/terminal/SmartTabView.cpp index 6df8557cb2..4ee5ac59bf 100644 --- a/src/apps/terminal/SmartTabView.cpp +++ b/src/apps/terminal/SmartTabView.cpp @@ -52,10 +52,6 @@ SmartTabView::MouseDown(BPoint point) popUpMenu->AddItem(new BMenuItem("Close Tab", message)); popUpMenu->SetAsyncAutoDestruct(true); popUpMenu->SetTargetForItems(BMessenger(this)); - - // TODO: I thought I'd get a "sticky" menu with this call... - // Bug in our implementation or I just have to use the "other" - // Go() method? popUpMenu->Go(ConvertToScreen(point), true, true, true); handled = true; diff --git a/src/apps/terminal/TermConst.h b/src/apps/terminal/TermConst.h index c97b0c35c2..bcd3aa9166 100644 --- a/src/apps/terminal/TermConst.h +++ b/src/apps/terminal/TermConst.h @@ -66,9 +66,7 @@ const uint32 M_GET_DEVICE_NUM = 'Mgdn'; const ulong PSET__COLS = 'pcol'; const ulong PSET__ROWS = 'prow'; const ulong PSET__HFONT = 'phfn'; -const ulong PSET__FFONT = 'pffn'; const ulong PSET__HFONT_SIZE = 'phfs'; -const ulong PSET__FFONT_SIZE = 'pffs'; const ulong PSET_FORE_COLOR = 'pfcl'; const ulong PSET_BACK_COLOR = 'pbcl'; const ulong PSET__CODING = 'pcod'; @@ -90,10 +88,6 @@ const char* const PREF_HALF_FONT_FAMILY = "Half Font Famly"; const char* const PREF_HALF_FONT_STYLE = "Half Font Style"; const char* const PREF_HALF_FONT_SIZE = "Half Font Size"; -const char* const PREF_FULL_FONT_FAMILY = "Full Font Famly"; -const char* const PREF_FULL_FONT_STYLE = "Full Font Style"; -const char* const PREF_FULL_FONT_SIZE = "Full Font Size"; - const char* const PREF_TEXT_FORE_COLOR = "Text Foreground Color"; const char* const PREF_TEXT_BACK_COLOR = "Text Background Color"; const char* const PREF_SELECT_FORE_COLOR = "Selection Foreground Color"; diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp index be7b75804d..dc855934f7 100644 --- a/src/apps/terminal/TermParse.cpp +++ b/src/apps/terminal/TermParse.cpp @@ -349,8 +349,7 @@ TermParse::EscParse() case CASE_PRINT: cbuf[0] = c; cbuf[1] = '\0'; - width = HALF_WIDTH; - fView->PutChar(cbuf, attr, width); + fView->PutChar(cbuf, attr); break; case CASE_PRINT_GR: @@ -363,7 +362,6 @@ TermParse::EscParse() *ptr++ = curess; *ptr++ = c; *ptr = 0; - width = 1; curess = 0; break; @@ -372,7 +370,6 @@ TermParse::EscParse() *ptr++ = c; GetReaderBuf(*ptr++); *ptr = 0; - width = 2; curess = 0; break; @@ -380,14 +377,12 @@ TermParse::EscParse() *ptr++ = c; GetReaderBuf(*ptr++); *ptr = 0; - width = 2; break; } } else { /* ISO-8859-1...10 and MacRoman */ *ptr++ = c; *ptr = 0; - width = 1; } if (now_coding != B_JIS_CONVERSION) @@ -395,7 +390,7 @@ TermParse::EscParse() else CodeConv::ConvertToInternal((char*)cbuf, -1, (char*)dstbuf, B_EUC_CONVERSION); - fView->PutChar(dstbuf, attr, width); + fView->PutChar(dstbuf, attr); break; case CASE_PRINT_CS96: @@ -403,9 +398,8 @@ TermParse::EscParse() GetReaderBuf(cbuf[1]); cbuf[1] |= 0x80; cbuf[2] = 0; - width = 2; CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, B_EUC_CONVERSION); - fView->PutChar(dstbuf, attr, width); + fView->PutChar(dstbuf, attr); break; case CASE_LF: @@ -420,8 +414,7 @@ TermParse::EscParse() cbuf[0] = (uchar)c; cbuf[1] = '\0'; CodeConv::ConvertToInternal((char*)cbuf, 1, (char*)dstbuf, now_coding); - width = 1; - fView->PutChar(dstbuf, attr, width); + fView->PutChar(dstbuf, attr); break; case CASE_SJIS_INSTRING: @@ -429,8 +422,7 @@ TermParse::EscParse() GetReaderBuf(cbuf[1]); cbuf[2] = '\0'; CodeConv::ConvertToInternal((char*)cbuf, 2, (char*)dstbuf, now_coding); - width = 2; - fView->PutChar(dstbuf, attr, width); + fView->PutChar(dstbuf, attr); break; case CASE_UTF8_2BYTE: @@ -440,8 +432,8 @@ TermParse::EscParse() break; cbuf[1] = (uchar)c; cbuf[2] = '\0'; - width = CodeConv::UTF8GetFontWidth((char*)cbuf); - fView->PutChar(cbuf, attr, width); + + fView->PutChar(cbuf, attr); break; case CASE_UTF8_3BYTE: @@ -456,8 +448,7 @@ TermParse::EscParse() break; cbuf[2] = c; cbuf[3] = '\0'; - width = CodeConv::UTF8GetFontWidth((char*)cbuf); - fView->PutChar(cbuf, attr, width); + fView->PutChar(cbuf, attr); break; case CASE_MBCS: diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 95df15cdb5..a167bf3915 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -243,7 +243,7 @@ TermView::TermView(BMessage *archive) status_t TermView::_InitObject(int32 argc, const char **argv) { - SetTermFont(be_fixed_font, be_fixed_font); + SetTermFont(be_fixed_font); fTextBuffer = new (std::nothrow) TermBuffer(fTermRows, fTermColumns, fScrBufSize); if (fTextBuffer == NULL) @@ -406,19 +406,17 @@ TermView::SetEncoding(int encoding) } -//! Sets half and full fonts for terminal +//! Sets font for terminal void -TermView::SetTermFont(const BFont *halfFont, const BFont *fullFont) +TermView::SetTermFont(const BFont *font) { char buf[4]; int halfWidth = 0; - fHalfFont = halfFont; - fFullFont = fullFont; - + fHalfFont = font; + _FixFontAttributes(fHalfFont); - _FixFontAttributes(fFullFont); - + // calculate half font's max width // Not Bounding, check only A-Z(For case of fHalfFont is KanjiFont. ) for (int c = 0x20 ; c <= 0x7e; c++){ @@ -428,30 +426,27 @@ TermView::SetTermFont(const BFont *halfFont, const BFont *fullFont) halfWidth = tmpWidth; } - // How to calculate FullWidth ? fFontWidth = halfWidth; - // Second, Calc Font Height - font_height fh, hh; + font_height hh; fHalfFont.GetHeight(&hh); - fFullFont.GetHeight(&fh); - - int font_ascent =(int)((fh.ascent > hh.ascent) ? fh.ascent : hh.ascent); - int font_descent =(int)((fh.descent > hh.descent) ? fh.descent : hh.descent); - int font_leading =(int)((fh.leading > hh.leading) ? fh.leading : hh.leading); - + + int font_ascent = (int)hh.ascent; + int font_descent =(int)hh.descent; + int font_leading =(int)hh.leading; + if (font_leading == 0) font_leading = 1; if (fTop) fTop = fTop / fFontHeight; - + + fFontAscent = font_ascent; fFontHeight = font_ascent + font_descent + font_leading + 1; fTop = fTop * fFontHeight; - fFontAscent = font_ascent; - fCursorHeight = font_ascent + font_descent + font_leading + 1; + fCursorHeight = fFontHeight; } @@ -572,8 +567,9 @@ TermView::Clear() //! Print one character void -TermView::PutChar(uchar *string, ushort attr, int width) +TermView::PutChar(uchar *string, ushort attr) { + int width = CodeConv::UTF8GetFontWidth((char*)string); if (width == FULL_WIDTH) attr |= A_WIDTH; @@ -1082,11 +1078,7 @@ TermView::_DrawLines(int x1, int y1, ushort attr, uchar *buf, int forecolor, backcolor; rgb_color rgb_fore = fTextForeColor, rgb_back = fTextBackColor, rgb_tmp; - // Set Font. - if (IS_WIDTH(attr)) - inView->SetFont(&fFullFont); - else - inView->SetFont(&fHalfFont); + inView->SetFont(&fHalfFont); // Set pen point x2 = x1 + fFontWidth * width; @@ -1300,42 +1292,39 @@ TermView::Draw(BRect updateRect) return; } - int x1, x2, y1, y2; - int i, j, k, count; - ushort attr; - uchar buf[256]; - int m_flag; - BRect eraseRect; + int x1 =(int)updateRect.left / fFontWidth; + int x2 =(int)updateRect.right / fFontWidth; - x1 =(int)updateRect.left / fFontWidth; - x2 =(int)updateRect.right / fFontWidth; - - y1 =(int)updateRect.top / fFontHeight; - y2 =(int)updateRect.bottom / fFontHeight; + int y1 =(int)updateRect.top / fFontHeight; + int y2 =(int)updateRect.bottom / fFontHeight; Window()->BeginViewTransaction(); - for (j = y1; j <= y2; j++) { + for (int j = y1; j <= y2; j++) { // If(x1, y1) Buffer is in string full width character, // alignment start position. - k = x1; + int k = x1; + uchar buf[256]; + + ushort attr; if (fTextBuffer->GetChar(j, k, buf, &attr) == IN_STRING) k--; if (k < 0) k = 0; - for (i = k; i <= x2;) { - count = fTextBuffer->GetString(j, i, x2, buf, &attr); - m_flag = _CheckSelectedRegion(CurPos(i, j)); + for (int i = k; i <= x2;) { + int count = fTextBuffer->GetString(j, i, x2, buf, &attr); + bool insideSelection = _CheckSelectedRegion(CurPos(i, j)); if (count < 0) { - if (m_flag) { + if (insideSelection) { + BRect eraseRect; eraseRect.Set(fFontWidth * i, fFontHeight * j, - fFontWidth *(i - count) -1, - fFontHeight *(j + 1) -1); + fFontWidth * (i - count) -1, + fFontHeight * (j + 1) -1); SetHighColor(fSelectBackColor); FillRect(eraseRect); @@ -1345,7 +1334,7 @@ TermView::Draw(BRect updateRect) } _DrawLines(fFontWidth * i, fFontHeight * j, - attr, buf, count, m_flag, false, this); + attr, buf, count, insideSelection, false, this); i += count; if (i >= fTermColumns) break; diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index cdf68949e4..bae9d7bd3a 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -40,7 +40,7 @@ public: const char *TerminalName() const; - void SetTermFont(const BFont *halfFont, const BFont *fullFont); + void SetTermFont(const BFont *font); void GetFontSize(int *width, int *height); BRect SetTermSize(int rows, int cols, bool resize); @@ -65,7 +65,7 @@ public: void Clear(); // Output Charactor - void PutChar(uchar *string, ushort attr, int width); + void PutChar(uchar *string, ushort attr); void PutCR(void); void PutLF(void); void PutNL(int num); @@ -198,7 +198,6 @@ private: // Font and Width BFont fHalfFont; - BFont fFullFont; int fFontWidth; int fFontHeight; int fFontAscent; diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 2ae568a70b..8660dc25c2 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -39,14 +39,6 @@ #include #include -// -// help and GPL URL -// -//#define URL_PREFIX "file:///boot/home/config/settings/MuTerminal/help/" -//#define INDEX_FILE "/index.html" -//#define GPL_FILE "/gpl.html" -//#define CHLP_FILE "file:///boot/beos/documentation/Shell%20Tools/index.html" - const static float kViewOffset = 3; const static uint32 kNewTab = 'NTab'; @@ -199,25 +191,16 @@ TermWindow::_SetupMenu() void -TermWindow::_GetPreferredFonts(BFont &fullFont, BFont &halfFont) +TermWindow::_GetPreferredFont(BFont &font) { const char *family = PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY); - halfFont.SetFamilyAndStyle(family, NULL); + font.SetFamilyAndStyle(family, NULL); float size = PrefHandler::Default()->getFloat(PREF_HALF_FONT_SIZE); if (size < 6.0f) size = 6.0f; - halfFont.SetSize(size); - halfFont.SetSpacing(B_FIXED_SPACING); - - family = PrefHandler::Default()->getString(PREF_FULL_FONT_FAMILY); - - fullFont.SetFamilyAndStyle(family, NULL); - size = PrefHandler::Default()->getFloat(PREF_FULL_FONT_SIZE); - if (size < 6.0f) - size = 6.0f; - fullFont.SetSize(size); - fullFont.SetSpacing(B_FIXED_SPACING); + font.SetSize(size); + font.SetSpacing(B_FIXED_SPACING); } @@ -380,9 +363,9 @@ TermWindow::MessageReceived(BMessage *message) case MSG_HALF_SIZE_CHANGED: case MSG_FULL_SIZE_CHANGED: { - BFont halfFont, fullFont; - _GetPreferredFonts(fullFont, halfFont); - _ActiveTermView()->SetTermFont (&halfFont, &fullFont); + BFont font; + _GetPreferredFont(font); + _ActiveTermView()->SetTermFont(&font); BRect rect = _ActiveTermView()->SetTermSize(0, 0, 0); int width, height; @@ -393,12 +376,13 @@ TermWindow::MessageReceived(BMessage *message) minimumHeight += fMenubar->Bounds().Height(); if (fTabView && fTabView->CountTabs() > 1) minimumHeight += fTabView->TabHeight(); - SetSizeLimits (MIN_COLS * width, MAX_COLS * width, + + SetSizeLimits(MIN_COLS * width, MAX_COLS * width, minimumHeight + MIN_ROWS * height, minimumHeight + MAX_ROWS * height); - ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, - rect.Height()+fMenubar->Bounds().Height() + kViewOffset * 2); + ResizeTo(rect.Width() + B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, + rect.Height() +fMenubar->Bounds().Height() + kViewOffset * 2); _ActiveTermView()->Invalidate(); break; @@ -406,31 +390,31 @@ TermWindow::MessageReceived(BMessage *message) case EIGHTYTWENTYFOUR: PrefHandler::Default()->setString(PREF_COLS, "80"); PrefHandler::Default()->setString(PREF_ROWS, "24"); - PostMessage (MSG_COLS_CHANGED); + PostMessage(MSG_COLS_CHANGED); break; case EIGHTYTWENTYFIVE: PrefHandler::Default()->setString(PREF_COLS, "80"); PrefHandler::Default()->setString(PREF_ROWS, "25"); - PostMessage (MSG_COLS_CHANGED); + PostMessage(MSG_COLS_CHANGED); break; case EIGHTYFORTY: PrefHandler::Default()->setString(PREF_COLS, "80"); PrefHandler::Default()->setString(PREF_ROWS, "40"); - PostMessage (MSG_COLS_CHANGED); + PostMessage(MSG_COLS_CHANGED); break; case ONETHREETWOTWENTYFOUR: PrefHandler::Default()->setString(PREF_COLS, "132"); PrefHandler::Default()->setString(PREF_ROWS, "24"); - PostMessage (MSG_COLS_CHANGED); + PostMessage(MSG_COLS_CHANGED); break; case ONETHREETWOTWENTYFIVE: PrefHandler::Default()->setString(PREF_COLS, "132"); PrefHandler::Default()->setString(PREF_ROWS, "25"); - PostMessage (MSG_COLS_CHANGED); + PostMessage(MSG_COLS_CHANGED); break; case FULLSCREEN: @@ -461,7 +445,7 @@ TermWindow::MessageReceived(BMessage *message) break; case MSG_FONT_CHANGED: - PostMessage(MSG_HALF_FONT_CHANGED); + PostMessage(MSG_HALF_FONT_CHANGED); break; case MSG_COLOR_CHANGED: @@ -622,9 +606,9 @@ TermWindow::_AddTab(Arguments *args) view->SetEncoding(longname2id(PrefHandler::Default()->getString(PREF_TEXT_ENCODING))); - BFont fullFont, halfFont; - _GetPreferredFonts(fullFont, halfFont); - view->SetTermFont(&halfFont, &fullFont); + BFont font; + _GetPreferredFont(font); + view->SetTermFont(&font); _SetTermColors(view); @@ -637,7 +621,7 @@ TermWindow::_AddTab(Arguments *args) minimumHeight += fMenubar->Bounds().Height(); if (fTabView && fTabView->CountTabs() > 1) minimumHeight += fTabView->TabHeight(); - SetSizeLimits (MIN_COLS * width, MAX_COLS * width, + SetSizeLimits(MIN_COLS * width, MAX_COLS * width, minimumHeight + MIN_ROWS * height, minimumHeight + MAX_ROWS * height); } diff --git a/src/apps/terminal/TermWindow.h b/src/apps/terminal/TermWindow.h index 7b7c648022..df88a63b22 100644 --- a/src/apps/terminal/TermWindow.h +++ b/src/apps/terminal/TermWindow.h @@ -61,7 +61,7 @@ private: void _SetTermColors(TermView *termView); void _InitWindow(); void _SetupMenu(); - void _GetPreferredFonts(BFont &full, BFont &half); + void _GetPreferredFont(BFont &font); status_t _DoPageSetup(); void _DoPrint(); void _AddTab(Arguments *args);