[haiku-commits] haiku: hrev44982 - src/apps/terminal

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 8 Dec 2012 21:24:54 +0100 (CET)

hrev44982 adds 1 changeset to branch 'master'
old head: abe053eb0332e522bb8be19b1dcbaadc1fd66250
new head: 1eccdc25feba35a3f3312dd18e014a883e99ef1d
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=1eccdc2+%5Eabe053e

----------------------------------------------------------------------------

1eccdc2: Increase the font size options in Terminal
  
  Sizes range from 8 to 36 but not all sizes are represented. The
  progression is not linear, the font size increases first by 1,
  then 2, and finally by 4.
  
  Works by keying command-(plus)/command-(minus) or selecting
  from Font size menu, or from selecting from Font menu in Terminal
  settings. If you alter the settings file to put in some other font
  size it should still work, but the menu item won't be checked.
  
  Fixes #8849

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44982
Commit:      1eccdc25feba35a3f3312dd18e014a883e99ef1d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1eccdc2
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Sat Dec  8 20:19:15 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/8849

----------------------------------------------------------------------------

2 files changed, 30 insertions(+), 12 deletions(-)
src/apps/terminal/AppearPrefView.cpp |  4 +++-
src/apps/terminal/TermWindow.cpp     | 38 +++++++++++++++++++++++---------

----------------------------------------------------------------------------

diff --git a/src/apps/terminal/AppearPrefView.cpp 
b/src/apps/terminal/AppearPrefView.cpp
index 0e548c4..78b0cfc 100644
--- a/src/apps/terminal/AppearPrefView.cpp
+++ b/src/apps/terminal/AppearPrefView.cpp
@@ -468,7 +468,9 @@ AppearancePrefView::_MakeFontSizeMenu(const char* label, 
uint32 command,
        menu->SetRadioMode(true);
        menu->SetLabelFromMarked(false);
 
-       int32 sizes[] = {9, 10, 11, 12, 14, 16, 18, 0};
+       int32 sizes[] = {
+               8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, 0
+       };
 
        bool found = false;
 
diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp
index d63d0f4..cd2701f 100644
--- a/src/apps/terminal/TermWindow.cpp
+++ b/src/apps/terminal/TermWindow.cpp
@@ -59,6 +59,9 @@
 const static int32 kMaxTabs = 6;
 const static int32 kTermViewOffset = 3;
 
+const static int32 kMinimumFontSize = 8;
+const static int32 kMaximumFontSize = 36;
+
 // messages constants
 static const uint32 kNewTab = 'NTab';
 static const uint32 kCloseView = 'ClVw';
@@ -403,8 +406,8 @@ TermWindow::MenusBeginning()
 
        float size = font.Size();
 
-       fDecreaseFontSizeMenuItem->SetEnabled(size > 9);
-       fIncreaseFontSizeMenuItem->SetEnabled(size < 18);
+       fDecreaseFontSizeMenuItem->SetEnabled(size > kMinimumFontSize);
+       fIncreaseFontSizeMenuItem->SetEnabled(size < kMaximumFontSize);
 
        BWindow::MenusBeginning();
 }
@@ -1011,16 +1014,27 @@ TermWindow::MessageReceived(BMessage *message)
                        _ActiveTermView()->GetTermFont(&font);
                        float size = font.Size();
 
-                       if (message->what == kIncreaseFontSize)
-                               size < 12 ? size += 1 : size += 2;
-                       else
-                               size < 14 ? size -= 1 : size -= 2;
+                       if (message->what == kIncreaseFontSize) {
+                               if (size < 12)
+                                       size += 1;
+                               else if (size < 24)
+                                       size += 2;
+                               else
+                                       size += 4;
+                       } else {
+                               if (size <= 12)
+                                       size -= 1;
+                               else if (size <= 24)
+                                       size -= 2;
+                               else
+                                       size -= 4;
+                       }
 
                        // constrain the font size
-                       if (size < 9)
-                               size = 9;
-                       if (size > 18)
-                               size = 18;
+                       if (size < kMinimumFontSize)
+                               size = kMinimumFontSize;
+                       if (size > kMaximumFontSize)
+                               size = kMaximumFontSize;
 
                        // mark the font size menu item
                        for (int32 i = 0; i < fFontSizeMenu->CountItems(); i++) 
{
@@ -1655,7 +1669,9 @@ TermWindow::_MakeFontSizeMenu(uint32 command, uint8 
defaultSize)
        if (menu == NULL)
                return NULL;
 
-       int32 sizes[] = {9, 10, 11, 12, 14, 16, 18, 0};
+       int32 sizes[] = {
+               8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, 0
+       };
 
        bool found = false;
 


Other related posts:

  • » [haiku-commits] haiku: hrev44982 - src/apps/terminal - jscipione