Go to the FreeLists Home Page Home Signup Help Login
 



[haiku-development] || [Date Prev] [09-2007 Date Index] [Date Next] || [Thread Prev] [09-2007 Thread Index] [Thread Next]

[haiku-development] Terminal Patch

  • From: "HOST Team" <HOST.HAIKU@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 16 Sep 2007 01:59:18 +0200
Hi all,
attached is a diff which allows the Terminal to be resized until only one line 
is shown. The previous attempt was hardcoded to a specific number of lines. It 
respects the tab view in case it is present.

Best Regards,
Bek

-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
diff --git a/src/apps/terminal/TermConst.h b/src/apps/terminal/TermConst.h
index b225f97..c97b0c3 100644
--- a/src/apps/terminal/TermConst.h
+++ b/src/apps/terminal/TermConst.h
@@ -141,6 +141,8 @@ enum{
 
 #define MIN_COLS 10
 #define MAX_COLS 256
+#define MIN_ROWS 1
+#define MAX_ROWS 256
 
 // Insert mode flag
 #define MODE_OVER 0
diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp
index b6b0306..4a34398 100644
--- a/src/apps/terminal/TermWindow.cpp
+++ b/src/apps/terminal/TermWindow.cpp
@@ -389,8 +389,14 @@ TermWindow::MessageReceived(BMessage *message)
                        int width, height;
                        _ActiveTermView()->GetFontSize(&width, &height);
                        
+                       float minimumHeight = 0;
+                       if (fMenubar)
+                               minimumHeight += fMenubar->Bounds().Height();
+                       if (fTabView && fTabView->CountTabs() > 1)
+                               minimumHeight += fTabView->TabHeight();
                        SetSizeLimits (MIN_COLS * width, MAX_COLS * width,
-                                                       MIN_COLS * height, 
MAX_COLS * height);
+                                                       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);
@@ -623,13 +629,22 @@ TermWindow::_AddTab(Arguments *args)
                
                _SetTermColors(view);
                
-               // If it's the first time we're called, setup the window
-               if (fTabView->CountTabs() == 1) {
+               if (fTabView->CountTabs() >= 1) {
                        int width, height;
                        view->GetFontSize(&width, &height);
-                       SetSizeLimits(MIN_COLS * width, MAX_COLS * width,
-                               MIN_COLS * height, MAX_COLS * height);
-               
+
+                       float minimumHeight = 0;
+                       if (fMenubar)
+                               minimumHeight += fMenubar->Bounds().Height();
+                       if (fTabView && fTabView->CountTabs() > 1)
+                               minimumHeight += fTabView->TabHeight();
+                       SetSizeLimits (MIN_COLS * width, MAX_COLS * width,
+                                                       minimumHeight + 
MIN_ROWS * height, 
+                                                       minimumHeight + 
MAX_ROWS * height);
+               }
+
+               // If it's the first time we're called, setup the window
+               if (fTabView->CountTabs() == 1) {
                        float fWidth, fHeight;
                        view->GetPreferredSize(&fWidth, &fHeight);
                        




[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.