[haiku-commits] r39515 - haiku/trunk/src/apps/terminal

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 19 Nov 2010 16:30:10 +0100 (CET)

Author: bonefish
Date: 2010-11-19 16:30:09 +0100 (Fri, 19 Nov 2010)
New Revision: 39515
Changeset: http://dev.haiku-os.org/changeset/39515

Modified:
   haiku/trunk/src/apps/terminal/TermWindow.cpp
Log:
Added a "Close other tabs" item to the tab menu.


Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermWindow.cpp        2010-11-19 15:24:33 UTC 
(rev 39514)
+++ haiku/trunk/src/apps/terminal/TermWindow.cpp        2010-11-19 15:30:09 UTC 
(rev 39515)
@@ -55,6 +55,7 @@
 // messages constants
 static const uint32 kNewTab = 'NTab';
 static const uint32 kCloseView = 'ClVw';
+static const uint32 kCloseOtherViews = 'CloV';
 static const uint32 kIncreaseFontSize = 'InFs';
 static const uint32 kDecreaseFontSize = 'DcFs';
 static const uint32 kSetActiveTab = 'STab';
@@ -739,6 +740,21 @@
                        break;
                }
 
+               case kCloseOtherViews:
+               {
+                       Session* session = _SessionForID(SessionID(*message, 
"session"));
+                       if (session == NULL)
+                               break;
+
+                       int32 count = fSessions.CountItems();
+                       for (int32 i = count - 1; i >= 0; i--) {
+                               if (_SessionAt(i) != session)
+                                       _RemoveTab(i);
+                       }
+
+                       break;
+               }
+
                case kIncreaseFontSize:
                case kDecreaseFontSize:
                {
@@ -1167,12 +1183,17 @@
        BMessage* closeMessage = new BMessage(kCloseView);
        _SessionAt(index)->id.AddToMessage(*closeMessage, "session");
 
+       BMessage* closeOthersMessage = new BMessage(kCloseOtherViews);
+       _SessionAt(index)->id.AddToMessage(*closeOthersMessage, "session");
+
        BMessage* editTitleMessage = new BMessage(kEditTabTitle);
        _SessionAt(index)->id.AddToMessage(*editTitleMessage, "session");
 
        BPopUpMenu* popUpMenu = new BPopUpMenu("tab menu");
        BLayoutBuilder::Menu<>(popUpMenu)
                .AddItem(B_TRANSLATE("Close tab"), closeMessage)
+               .AddItem(B_TRANSLATE("Close other tabs"), closeOthersMessage)
+               .AddSeparator()
                .AddItem(B_TRANSLATE("Edit tab title" B_UTF8_ELLIPSIS),
                        editTitleMessage)
        ;


Other related posts:

  • » [haiku-commits] r39515 - haiku/trunk/src/apps/terminal - ingo_weinhold