diff --git a/src/apps/terminal/TermConst.h b/src/apps/terminal/TermConst.h index 3ca7a0565a..49c024bec6 100644 --- a/src/apps/terminal/TermConst.h +++ b/src/apps/terminal/TermConst.h @@ -91,6 +91,7 @@ const uint32 EIGHTYTWENTYFIVE = 'etfv'; const uint32 EIGHTYFORTY = 'efor'; const uint32 ONETHREETWOTWENTYFOUR = 'hunf'; const uint32 ONETHREETWOTWENTYFIVE = 'hunv'; +const uint32 FULLSCREEN = 'fscr'; const uint32 MSG_FONT_CHANGED = 'fntc'; diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index 55eabe66f3..a6c07c4d5c 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -113,6 +113,7 @@ public: void SetMouseCursor (void); // void SetIMAware (bool); void SetScrollBar (BScrollBar *scrbar); + BScrollBar *ScrollBar () const { return fScrollBar; }; // // Output Charactor. diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 17a37b2388..41693ff1c2 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -197,7 +198,7 @@ TermWindow::SetupMenu(void) fMenubar = new BMenuBar(Bounds(), "mbar"); /* - * Make Fiile Menu. + * Make File Menu. */ fFilemenu = new BMenu("Terminal"); fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G')); @@ -240,6 +241,7 @@ TermWindow::SetupMenu(void) fWindowSizeMenu->AddItem(new BMenuItem("80x40", new BMessage(EIGHTYFORTY))); fWindowSizeMenu->AddItem(new BMenuItem("132x24", new BMessage(ONETHREETWOTWENTYFOUR))); fWindowSizeMenu->AddItem(new BMenuItem("132x25", new BMessage(ONETHREETWOTWENTYFIVE))); + fWindowSizeMenu->AddItem(new BMenuItem("Fullscreen", new BMessage(FULLSCREEN), '\n')); // Considering we have this in the preferences window, this menu is not // needed and should not be shown if we are to not confuse the user @@ -437,6 +439,33 @@ TermWindow::MessageReceived(BMessage *message) this->PostMessage (MSG_COLS_CHANGED); break; + case FULLSCREEN: + if (!fSavedFrame.IsValid()) { // go fullscreen + float mbHeight = fMenubar->Bounds().Height() + 1; + fSavedFrame = Frame(); + BScreen screen(this); + fTermView->ScrollBar()->Hide(); + fMenubar->Hide(); + fBaseView->MoveTo(0,0); + fBaseView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight); + fSavedLook = Look(); + // done before ResizeTo to work around a Dano bug (not erasing the decor) + SetLook(B_NO_BORDER_WINDOW_LOOK); + ResizeTo(screen.Frame().Width()+1, screen.Frame().Height()+1); + MoveTo(screen.Frame().left, screen.Frame().top); + } else { // exit fullscreen + float mbHeight = fMenubar->Bounds().Height() + 1; + fMenubar->Show(); + fTermView->ScrollBar()->Show(); + ResizeTo(fSavedFrame.Width()+1, fSavedFrame.Height()+1); + MoveTo(fSavedFrame.left, fSavedFrame.top); + fBaseView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight); + fBaseView->MoveTo(0,mbHeight); + SetLook(fSavedLook); + fSavedFrame = BRect(0,0,-1,-1); + } + break; + case MSG_FONT_CHANGED: gTermPref->setString (PREF_HALF_FONT_FAMILY, fNewFontMenu->FindMarked()->Label()); this->PostMessage (MSG_HALF_FONT_CHANGED); diff --git a/src/apps/terminal/TermWindow.h b/src/apps/terminal/TermWindow.h index 738b487d96..6d5201717b 100644 --- a/src/apps/terminal/TermWindow.h +++ b/src/apps/terminal/TermWindow.h @@ -85,6 +85,8 @@ private: FindDlg *fFindPanel; BMessageRunner *fWindowUpdate; BMenuItem *item; + BRect fSavedFrame; + window_look fSavedLook; }; #endif // TERMWIN_H