[haiku-commits] r40905 - in haiku/branches/features/package-management: build/jam src/apps/deskbar

  • From: zooey@xxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 10 Mar 2011 21:11:32 +0100 (CET)

Author: zooey
Date: 2011-03-10 21:11:32 +0100 (Thu, 10 Mar 2011)
New Revision: 40905
Changeset: http://dev.haiku-os.org/changeset/40905

Added:
   haiku/branches/features/package-management/src/apps/deskbar/DeskbarMenu.cpp
   haiku/branches/features/package-management/src/apps/deskbar/DeskbarMenu.h
   haiku/branches/features/package-management/src/apps/deskbar/DeskbarUtils.cpp
   haiku/branches/features/package-management/src/apps/deskbar/DeskbarUtils.h
Removed:
   haiku/branches/features/package-management/src/apps/deskbar/BeMenu.cpp
   haiku/branches/features/package-management/src/apps/deskbar/BeMenu.h
   haiku/branches/features/package-management/src/apps/deskbar/DeskBarUtils.cpp
   haiku/branches/features/package-management/src/apps/deskbar/DeskBarUtils.h
Modified:
   haiku/branches/features/package-management/build/jam/HaikuImage
   haiku/branches/features/package-management/src/apps/deskbar/BarApp.cpp
   haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.cpp
   haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.h
   haiku/branches/features/package-management/src/apps/deskbar/BarMenuTitle.cpp
   haiku/branches/features/package-management/src/apps/deskbar/BarView.cpp
   haiku/branches/features/package-management/src/apps/deskbar/BarView.h
   haiku/branches/features/package-management/src/apps/deskbar/BarWindow.cpp
   haiku/branches/features/package-management/src/apps/deskbar/BarWindow.h
   
haiku/branches/features/package-management/src/apps/deskbar/ExpandoMenuBar.cpp
   haiku/branches/features/package-management/src/apps/deskbar/ExpandoMenuBar.h
   haiku/branches/features/package-management/src/apps/deskbar/Jamfile
   haiku/branches/features/package-management/src/apps/deskbar/StatusView.cpp
   haiku/branches/features/package-management/src/apps/deskbar/TeamMenu.cpp
Log:
* fixed inconsistency introduced earlier with respect to name of the
  deskbar menu folder (it's called 'deskbar' now)
* replaced references to 'be' menu in Deskbar code accordingly

Modified: haiku/branches/features/package-management/build/jam/HaikuImage
===================================================================
--- haiku/branches/features/package-management/build/jam/HaikuImage     
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/build/jam/HaikuImage     
2011-03-10 20:11:32 UTC (rev 40905)
@@ -357,8 +357,9 @@
 AddDirectoryToHaikuImage home mail in ;
 AddDirectoryToHaikuImage home mail out ;
 
+AddSymlinkToHaikuImage home config settings : deskbar : be ;
 # Deskbar Application links
-AddDirectoryToHaikuImage home config settings deskbar-menu Applications ;
+AddDirectoryToHaikuImage home config settings deskbar Applications ;
 DESKBAR_APPLICATIONS = ActivityMonitor CharacterMap CodyCam CDPlayer DeskCalc
        Devices DiskProbe DriveSetup DiskUsage Expander Icon-O-Matic Installer
        Magnify Mail MediaConverter MediaPlayer MidiPlayer People PoorMan
@@ -366,33 +367,33 @@
 ;
 local linkTarget ;
 for linkTarget in $(DESKBAR_APPLICATIONS) {
-       AddSymlinkToHaikuImage home config settings deskbar-menu Applications
+       AddSymlinkToHaikuImage home config settings deskbar Applications
                : /boot/system/apps/$(linkTarget) : $(linkTarget) ;
 }
 
 # Deskbar Desktop applets links
-AddDirectoryToHaikuImage home config settings deskbar-menu Desktop\ applets ;
+AddDirectoryToHaikuImage home config settings deskbar Desktop\ applets ;
 DESKBAR_DESKTOP_APPLETS = LaunchBox NetworkStatus PowerStatus ProcessController
        Workspaces
 ;
 for linkTarget in $(DESKBAR_DESKTOP_APPLETS) {
-       AddSymlinkToHaikuImage home config settings deskbar-menu Desktop\ 
applets
+       AddSymlinkToHaikuImage home config settings deskbar Desktop\ applets
                : /boot/system/apps/$(linkTarget) : $(linkTarget) ;
 }
 
 # Deskbar Preferences links
-AddDirectoryToHaikuImage home config settings deskbar-menu Preferences ;
+AddDirectoryToHaikuImage home config settings deskbar Preferences ;
 DESKBAR_PREFERENCES = $(SYSTEM_PREFERENCES:B) ;
 for linkTarget in $(DESKBAR_PREFERENCES) {
-       AddSymlinkToHaikuImage home config settings deskbar-menu Preferences
+       AddSymlinkToHaikuImage home config settings deskbar Preferences
                : /boot/system/preferences/$(linkTarget)
                : $(linkTarget) ;
 }
 
 # Deskbar Demo links
-AddDirectoryToHaikuImage home config settings deskbar-menu Demos ;
+AddDirectoryToHaikuImage home config settings deskbar Demos ;
 for linkTarget in $(SYSTEM_DEMOS) {
-       AddSymlinkToHaikuImage home config settings deskbar-menu Demos
+       AddSymlinkToHaikuImage home config settings deskbar Demos
                : /boot/system/demos/$(linkTarget) : $(linkTarget) ;
 }
 

Modified: haiku/branches/features/package-management/src/apps/deskbar/BarApp.cpp
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/BarApp.cpp      
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/src/apps/deskbar/BarApp.cpp      
2011-03-10 20:11:32 UTC (rev 40905)
@@ -55,7 +55,7 @@
 #include "BarApp.h"
 #include "BarView.h"
 #include "BarWindow.h"
-#include "DeskBarUtils.h"
+#include "DeskbarUtils.h"
 #include "FSUtils.h"
 #include "PublicCommands.h"
 #include "ResourceSet.h"
@@ -69,7 +69,7 @@
 BList TBarApp::sSubscribers;
 
 
-const uint32 kShowBeMenu = 'BeMn';
+const uint32 kShowDeskbarMenu = 'BeMn';
 const uint32 kShowTeamMenu = 'TmMn';
 
 const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f);
@@ -338,9 +338,9 @@
                        fPreferencesWindow->PostMessage(kStateChanged);
                        break;
 
-               case kShowBeMenu:
+               case kShowDeskbarMenu:
                        if (fBarWindow->Lock()) {
-                               fBarWindow->ShowBeMenu();
+                               fBarWindow->ShowDeskbarMenu();
                                fBarWindow->Unlock();
                        }
                        break;

Modified: 
haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.cpp
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.cpp  
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.cpp  
2011-03-10 20:11:32 UTC (rev 40905)
@@ -44,8 +44,8 @@
 #include "icons.h"
 #include "icons_logo.h"
 #include "BarWindow.h"
-#include "BeMenu.h"
-#include "DeskBarUtils.h"
+#include "DeskbarMenu.h"
+#include "DeskbarUtils.h"
 #include "ResourceSet.h"
 #include "TeamMenu.h"
 
@@ -57,12 +57,12 @@
 {
        SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
 
-       TBeMenu* beMenu = new TBeMenu(bar);
-       TBarWindow::SetBeMenu(beMenu);
+       TDeskbarMenu* beMenu = new TDeskbarMenu(bar);
+       TBarWindow::SetDeskbarMenu(beMenu);
 
-       fBeMenuItem = new TBarMenuTitle(frame.Width(), frame.Height(),
+       fDeskbarMenuItem = new TBarMenuTitle(frame.Width(), frame.Height(),
                AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_BeLogoIcon), beMenu);
-       AddItem(fBeMenuItem);
+       AddItem(fDeskbarMenuItem);
 }
 
 
@@ -78,14 +78,14 @@
                BRect frame = Frame();
                width = frame.Width();
                height = frame.Height();
-       } else 
+       } else
                ResizeTo(width, height);
 
        width -= 1;
 
        int32 count = CountItems();
-       if (fBeMenuItem)
-               fBeMenuItem->SetWidthHeight(width / count, height);
+       if (fDeskbarMenuItem)
+               fDeskbarMenuItem->SetWidthHeight(width / count, height);
        if (fAppListMenuItem)
                fAppListMenuItem->SetWidthHeight(width / count, height);
 
@@ -96,7 +96,7 @@
 void
 TBarMenuBar::AddTeamMenu()
 {
-       if (CountItems() > 1) 
+       if (CountItems() > 1)
                return;
 
        BRect frame(Frame());
@@ -112,7 +112,7 @@
 void
 TBarMenuBar::RemoveTeamMenu()
 {
-       if (CountItems() < 2) 
+       if (CountItems() < 2)
                return;
 
        if (fAppListMenuItem) {
@@ -121,7 +121,7 @@
                fAppListMenuItem = NULL;
        }
 
-       BRect frame = Frame();  
+       BRect frame = Frame();
        SmartResize(frame.Width(), frame.Height());
 }
 
@@ -179,9 +179,9 @@
                return;
 
        BMenu* windowMenu = item->Submenu();
-       if (windowMenu) 
+       if (windowMenu)
                //      have a menu, set the tracking hook
-               windowMenu->SetTrackingHook(hookFunction, state);               
                        
+               windowMenu->SetTrackingHook(hookFunction, state);
 }
 
 
@@ -193,12 +193,12 @@
        uint32 buttons;
        GetMouse(&loc, &buttons);
        //      set the hook functions for the two menus
-       //      will always have the be menu
+       //      will always have the deskbar menu
        //      may have the app menu as well (mini mode)
-       if (fBeMenuItem->Frame().Contains(loc) || both) 
-               init_tracking_hook(fBeMenuItem, hookFunction, state);
+       if (fDeskbarMenuItem->Frame().Contains(loc) || both)
+               init_tracking_hook(fDeskbarMenuItem, hookFunction, state);
 
-       if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || 
both)) 
+       if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || 
both))
                init_tracking_hook(fAppListMenuItem, hookFunction, state);
 }
 

Modified: 
haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.h
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.h    
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/src/apps/deskbar/BarMenuBar.h    
2011-03-10 20:11:32 UTC (rev 40905)
@@ -66,7 +66,7 @@
        
        private:
                TBarView* fBarView;
-               TBarMenuTitle* fBeMenuItem;
+               TBarMenuTitle* fDeskbarMenuItem;
                TBarMenuTitle* fAppListMenuItem;
 };
 

Modified: 
haiku/branches/features/package-management/src/apps/deskbar/BarMenuTitle.cpp
===================================================================
--- 
haiku/branches/features/package-management/src/apps/deskbar/BarMenuTitle.cpp    
    2011-03-10 19:18:46 UTC (rev 40904)
+++ 
haiku/branches/features/package-management/src/apps/deskbar/BarMenuTitle.cpp    
    2011-03-10 20:11:32 UTC (rev 40905)
@@ -116,14 +116,14 @@
 
        if (be_control_look != NULL) {
                menu->SetDrawingMode(B_OP_ALPHA);
-       
+
                if (fIcon != NULL) {
                        BRect dstRect(fIcon->Bounds());
                        dstRect.OffsetTo(frame.LeftTop());
                        dstRect.OffsetBy(rintf(((frame.Width() - 
dstRect.Width()) / 2)
                                - 1.0f), rintf(((frame.Height() - 
dstRect.Height()) / 2)
                                - 0.0f));
-       
+
                        menu->DrawBitmapAsync(fIcon, dstRect);
                }
                return;
@@ -199,12 +199,12 @@
        if (barview) {
                BLooper* looper = barview->Looper();
                if (looper->Lock()) {
-                       // tell barview to add the refs to the be menu
-                       barview->HandleBeMenu(NULL);                    
+                       // tell barview to add the refs to the deskbar menu
+                       barview->HandleDeskbarMenu(NULL);
                        looper->Unlock();
                }
        }
-               
+
        return BMenuItem::Invoke(message);
 }
 

Modified: 
haiku/branches/features/package-management/src/apps/deskbar/BarView.cpp
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/BarView.cpp     
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/src/apps/deskbar/BarView.cpp     
2011-03-10 20:11:32 UTC (rev 40905)
@@ -52,8 +52,8 @@
 #include "BarApp.h"
 #include "BarMenuBar.h"
 #include "BarWindow.h"
-#include "BeMenu.h"
-#include "DeskBarUtils.h"
+#include "DeskbarMenu.h"
+#include "DeskbarUtils.h"
 #include "ExpandoMenuBar.h"
 #include "FSUtils.h"
 #include "ResourceSet.h"
@@ -135,9 +135,9 @@
        rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
 
        SetHighColor(hilite);
-       if (AcrossTop()) 
+       if (AcrossTop())
                StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
-       else if (AcrossBottom()) 
+       else if (AcrossBottom())
                StrokeLine(bounds.LeftTop(), bounds.RightTop());
 
        if (Vertical() && Expando()) {
@@ -156,7 +156,7 @@
                case B_REFS_RECEIVED:
                        // received when an item is selected during DnD
                        // message is targeted here from Be menu
-                       HandleBeMenu(message);
+                       HandleDeskbarMenu(message);
                        break;
 
                case B_ARCHIVED_OBJECT:
@@ -166,7 +166,7 @@
                        // so that I can follow the common pathway
                        // for adding icons to the tray
                        int32 id;
-                       AddItem(new BMessage(*message), B_DESKBAR_TRAY, &id); 
+                       AddItem(new BMessage(*message), B_DESKBAR_TRAY, &id);
                        break;
                }
 
@@ -197,7 +197,7 @@
 
 
 void
-TBarView::PlaceBeMenu()
+TBarView::PlaceDeskbarMenu()
 {
        // top or bottom, full
        if (!fVertical && fBarMenuBar) {
@@ -221,7 +221,7 @@
        //      DB should be in top/bottom mode, else error
        if (!fBarMenuBar)
                return;
-               
+
        float width = sMinimumWindowWidth;
        BPoint loc(B_ORIGIN);
        BRect menuFrame(fBarMenuBar->Frame());
@@ -237,8 +237,8 @@
                else
                        width = floorf(width) / 2;
                loc = Bounds().LeftTop();
-       } else 
-               // mini mode, BeMenu next to team menu
+       } else
+               // mini mode, DeskbarMenu next to team menu
                fBarMenuBar->AddTeamMenu();
 
        fBarMenuBar->SmartResize(width, menuFrame.Height());
@@ -257,13 +257,13 @@
                fDragRegion->MoveTo(statusLoc);
 
                if (!fReplicantTray->IsHidden())
-                       fReplicantTray->Hide(); 
+                       fReplicantTray->Hide();
 
                return;
        }
 
        if (fReplicantTray->IsHidden())
-               fReplicantTray->Show(); 
+               fReplicantTray->Show();
 
        if (fTrayLocation != 0) {
                fReplicantTray->SetMultiRow(fVertical);
@@ -347,7 +347,7 @@
                }
        } else {
                // four corners
-               if (fTrayLocation != 0)         
+               if (fTrayLocation != 0)
                        windowHeight = fDragRegion->Frame().bottom;
                else
                        windowHeight = fBarMenuBar->Frame().bottom;
@@ -404,7 +404,7 @@
        settings->state = (uint32)State();
        settings->width = 0;
        settings->showTime = ShowingClock();
-       
+
        fReplicantTray->RememberClockSettings();
        settings->alwaysOnTop = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL)
                != 0;
@@ -424,7 +424,7 @@
 void
 TBarView::UpdatePlacement()
 {
-       ChangeState(fState, fVertical, fLeft, fTop);    
+       ChangeState(fState, fVertical, fLeft, fTop);
 }
 
 
@@ -447,7 +447,7 @@
 
        BRect screenFrame = (BScreen(Window())).Frame();
 
-       PlaceBeMenu();
+       PlaceDeskbarMenu();
        PlaceTray(vertSwap, leftSwap, screenFrame);
 
        // We need to keep track of what apps are expanded.
@@ -455,7 +455,7 @@
        BString* signature = NULL;
        if (fVertical && Expando()
                && static_cast<TBarApp*>(be_app)->Settings()->superExpando) {
-               // Get a list of the signatures of expanded apps. Can't use 
+               // Get a list of the signatures of expanded apps. Can't use
                // team_id because there can be more than one team per 
application
                if (fVertical && Expando() && vertical && fExpando) {
                        for (int index = 0; index < fExpando->CountItems(); 
index++) {
@@ -558,7 +558,7 @@
 
 // optional functionality functions
 
-bool 
+bool
 TBarView::MilTime() const
 {
        return fShowInterval;
@@ -586,7 +586,7 @@
 TBarView::CacheDragData(const BMessage* incoming)
 {
        if (!incoming)
-               return; 
+               return;
 
        if (Dragging() && SpringLoadedFolderCompareMessages(incoming, 
fDragMessage))
                return;
@@ -614,7 +614,7 @@
 
 status_t
 TBarView::DragStart()
-{      
+{
        if (!Dragging())
                return B_OK;
 
@@ -624,7 +624,7 @@
 
        if (fExpando && fExpando->Frame().Contains(loc)) {
                ConvertToScreen(&loc);
-               BPoint expandoLocation = fExpando->ConvertFromScreen(loc);      
        
+               BPoint expandoLocation = fExpando->ConvertFromScreen(loc);
                TTeamMenuItem* item = 
fExpando->TeamItemAtPoint(expandoLocation);
 
                if (fLastDragItem)
@@ -634,8 +634,8 @@
                        if (item == fLastDragItem)
                                return B_OK;
 
-                       fLastDragItem = item;           
-               }                                       
+                       fLastDragItem = item;
+               }
        }
 
        return B_OK;
@@ -667,16 +667,16 @@
                // keep tracking
                endMenu = false;
        } else {
-               // see if the mouse is in the team/be menu item
+               // see if the mouse is in the team/deskbar menu item
                menu->ConvertToScreen(&location);
                if (barview->LockLooper()) {
                        TExpandoMenuBar* expando = barview->ExpandoMenuBar();
-                       TBeMenu* bemenu
-                               = 
(dynamic_cast<TBarWindow*>(barview->Window()))->BeMenu();
+                       TDeskbarMenu* bemenu
+                               = 
(dynamic_cast<TBarWindow*>(barview->Window()))->DeskbarMenu();
 
                        if (bemenu && bemenu->LockLooper()) {
                                bemenu->ConvertFromScreen(&location);
-                               if (bemenu->Frame().Contains(location)) 
+                               if (bemenu->Frame().Contains(location))
                                        endMenu = false;
 
                                bemenu->UnlockLooper();
@@ -685,7 +685,7 @@
                        if (endMenu && expando) {
                                expando->ConvertFromScreen(&location);
                                BMenuItem* item = 
expando->TeamItemAtPoint(location);
-                               if (item) 
+                               if (item)
                                        endMenu = false;
                        }
                        barview->UnlockLooper();
@@ -757,7 +757,7 @@
        if (appmime.GetAppHint(&hintref) != B_OK)
                return false;
 
-       // an app was found, now see if it supports any of 
+       // an app was found, now see if it supports any of
        // the refs in the message
        BFile file(&hintref, O_RDONLY);
        BAppFileInfo fileinfo(&file);
@@ -768,7 +768,7 @@
 
        int32 count = fCachedTypesList->CountItems();
        for (int32 i = 0 ; i < count ; i++) {
-               if 
(fileinfo.IsSupportedType(fCachedTypesList->ItemAt(i)->String())) 
+               if 
(fileinfo.IsSupportedType(fCachedTypesList->ItemAt(i)->String()))
                        return true;
        }
 
@@ -833,7 +833,7 @@
 
 
 void
-TBarView::HandleBeMenu(BMessage* messagewithdestination)
+TBarView::HandleDeskbarMenu(BMessage* messagewithdestination)
 {
        if (!Dragging())
                return;
@@ -857,13 +857,13 @@
                        if (entry.IsDirectory()) {
                                // if the ref received (should only be 1) is a 
directory
                                // then add the drag refs to the directory
-                               AddRefsToBeMenu(DragMessage(), &ref);
+                               AddRefsToDeskbarMenu(DragMessage(), &ref);
                        } else
                                SendDragMessage(NULL, &ref);
                }
        } else {
-               // adds drag refs to top level in be menu
-               AddRefsToBeMenu(DragMessage(), NULL);
+               // adds drag refs to top level in deskbar menu
+               AddRefsToDeskbarMenu(DragMessage(), NULL);
        }
 
        // clean up drag message and types list
@@ -910,9 +910,9 @@
 
 int32
 TBarView::CountItems(DeskbarShelf)
-{      
-       return fReplicantTray->IconCount();     
-}      
+{
+       return fReplicantTray->IconCount();
+}
 
 
 status_t

Modified: haiku/branches/features/package-management/src/apps/deskbar/BarView.h
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/BarView.h       
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/src/apps/deskbar/BarView.h       
2011-03-10 20:11:32 UTC (rev 40905)
@@ -108,7 +108,7 @@
                bool DragOverride();
                bool InvokeItem(const char* signature);
 
-               void HandleBeMenu(BMessage* targetmessage);
+               void HandleDeskbarMenu(BMessage* targetmessage);
 
                status_t ItemInfo(int32 id, const char** name, DeskbarShelf* 
shelf);
                status_t ItemInfo(const char* name, int32* id, DeskbarShelf* 
shelf);
@@ -137,12 +137,12 @@
                TDragRegion* DragRegion() const { return fDragRegion; }
 
        private:
-               friend class TBeMenu;
+               friend class TDeskbarMenu;
                friend class PreferencesWindow;
 
                status_t SendDragMessage(const char* signature, entry_ref* ref 
= NULL);
 
-               void PlaceBeMenu();
+               void PlaceDeskbarMenu();
                void PlaceTray(bool vertSwap, bool leftSwap, BRect screenFrame);
                void PlaceApplicationBar(BRect screenFrame);
 

Modified: 
haiku/branches/features/package-management/src/apps/deskbar/BarWindow.cpp
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/BarWindow.cpp   
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/src/apps/deskbar/BarWindow.cpp   
2011-03-10 20:11:32 UTC (rev 40905)
@@ -50,7 +50,7 @@
 #include "BarApp.h"
 #include "BarMenuBar.h"
 #include "BarView.h"
-#include "BeMenu.h"
+#include "DeskbarMenu.h"
 #include "PublicCommands.h"
 #include "StatusView.h"
 #include "tracker_private.h"
@@ -59,7 +59,7 @@
 
 
 // This is a very ugly hack to be able to call the private 
BMenuBar::StartMenuBar()
-// method from the TBarWindow::ShowBeMenu() method.
+// method from the TBarWindow::ShowDeskbarMenu() method.
 // Don't do this at home -- but why the hell is this method private?
 #if __MWERKS__
        #define BMenuBar_StartMenuBar_Hack StartMenuBar__8BMenuBarFlbbP5BRect
@@ -73,7 +73,7 @@
 extern "C" void BMenuBar_StartMenuBar_Hack(BMenuBar*,int32,bool,bool,BRect*);
 
 
-TBeMenu* TBarWindow::sBeMenu = NULL;
+TDeskbarMenu* TBarWindow::sDeskbarMenu = NULL;
 
 
 TBarWindow::TBarWindow()
@@ -134,18 +134,18 @@
        if (entry.InitCheck() == B_OK && entry.IsDirectory()) {
                //      need the entry_ref to the actual item
                entry.GetRef(&ref);
-               //      set the nav directory to the be folder
-               sBeMenu->SetNavDir(&ref);
+               //      set the nav directory to the deskbar folder
+               sDeskbarMenu->SetNavDir(&ref);
        } else if (!entry.Exists()) {
-               //      the Be folder does not exist
+               //      the deskbar folder does not exist
                //      create one now
                BDirectory dir;
                if (entry.GetParent(&dir) == B_OK) {
-                       BDirectory bedir;
-                       dir.CreateDirectory("be", &bedir);
-                       if (bedir.GetEntry(&entry) == B_OK
+                       BDirectory deskbarDir;
+                       dir.CreateDirectory("deskbar", &deskbarDir);
+                       if (deskbarDir.GetEntry(&entry) == B_OK
                                && entry.GetRef(&ref) == B_OK)
-                               sBeMenu->SetNavDir(&ref);
+                               sDeskbarMenu->SetNavDir(&ref);
                }
        } else {
                //      this really should never happen
@@ -153,8 +153,8 @@
                return;
        }
 
-       sBeMenu->NeedsToRebuild();
-       sBeMenu->ResetTargets();
+       sDeskbarMenu->NeedsToRebuild();
+       sDeskbarMenu->ResetTargets();
 
        fBarView->SetEventMask(0);
                // This works around a BeOS bug - the menu is quit with every
@@ -169,10 +169,10 @@
 {
        BWindow::MenusEnded();
 
-       if (sBeMenu->LockLooper()) {
+       if (sDeskbarMenu->LockLooper()) {
                // TODO: is this ok?
-               sBeMenu->RemoveItems(0, sBeMenu->CountItems(), true);
-               sBeMenu->UnlockLooper();
+               sDeskbarMenu->RemoveItems(0, sDeskbarMenu->CountItems(), true);
+               sDeskbarMenu->UnlockLooper();
        }
 
        fBarView->UpdateAutoRaise();
@@ -289,21 +289,21 @@
 
 
 void
-TBarWindow::SetBeMenu(TBeMenu* menu)
+TBarWindow::SetDeskbarMenu(TDeskbarMenu* menu)
 {
-       sBeMenu = menu;
+       sDeskbarMenu = menu;
 }
 
 
-TBeMenu*
-TBarWindow::BeMenu()
+TDeskbarMenu*
+TBarWindow::DeskbarMenu()
 {
-       return sBeMenu;
+       return sDeskbarMenu;
 }
 
 
 void
-TBarWindow::ShowBeMenu()
+TBarWindow::ShowDeskbarMenu()
 {
        BMenuBar* menuBar = fBarView->BarMenuBar();
        if (menuBar == NULL)

Modified: 
haiku/branches/features/package-management/src/apps/deskbar/BarWindow.h
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/BarWindow.h     
2011-03-10 19:18:46 UTC (rev 40904)
+++ haiku/branches/features/package-management/src/apps/deskbar/BarWindow.h     
2011-03-10 20:11:32 UTC (rev 40905)
@@ -39,7 +39,7 @@
 #include <Window.h>
 
 
-class TBeMenu;
+class TDeskbarMenu;
 class TBarView;
 
 
@@ -60,10 +60,10 @@
 
                        void                            SaveSettings();
                        TBarView*                       BarView() const { 
return fBarView; };
-       static  void                            SetBeMenu(TBeMenu* menu);
-                       TBeMenu*                        BeMenu();
+       static  void                            SetDeskbarMenu(TDeskbarMenu* 
menu);
+                       TDeskbarMenu*                   DeskbarMenu();
 
-                       void                            ShowBeMenu();
+                       void                            ShowDeskbarMenu();
                        void                            ShowTeamMenu();
 
                        void                            GetLocation(BMessage* 
message);
@@ -89,7 +89,7 @@
                        bool                            
_IsFocusMessage(BMessage* message);
 
 private:
-       static  TBeMenu*                        sBeMenu;
+       static  TDeskbarMenu*                   sDeskbarMenu;
                        TBarView*                       fBarView;
 };
 

Copied: 
haiku/branches/features/package-management/src/apps/deskbar/DeskbarMenu.cpp 
(from rev 40875, 
haiku/branches/features/package-management/src/apps/deskbar/BeMenu.cpp)
===================================================================
--- haiku/branches/features/package-management/src/apps/deskbar/DeskbarMenu.cpp 
                        (rev 0)
+++ haiku/branches/features/package-management/src/apps/deskbar/DeskbarMenu.cpp 
2011-03-10 20:11:32 UTC (rev 40905)
@@ -0,0 +1,670 @@
+/*
+Open Tracker License
+
+Terms and Conditions
+
+Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice applies to all licensees
+and shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN 
CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Be Incorporated shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from Be Incorporated.
+
+Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 
trademarks
+of Be Incorporated in the United States and other countries. Other brand 
product
+names are registered trademarks or trademarks of their respective holders.
+All rights reserved.
+*/
+
+#include <Debug.h>
+#include <Bitmap.h>
+#include <Catalog.h>
+#include <Dragger.h>
+#include <Locale.h>
+#include <Menu.h>
+#include <MenuItem.h>
+#include <Roster.h>
+
+#include "DeskbarMenu.h"
+#include "BarApp.h"
+#include "BarView.h"
+#include "DeskbarUtils.h"
+#include "IconMenuItem.h"
+#include "MountMenu.h"
+#include "PublicCommands.h"
+#include "RecentItems.h"
+#include "StatusView.h"
+#include "tracker_private.h"
+
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "DeskbarMenu"
+
+#define ROSTER_SIG "application/x-vnd.Be-ROST"
+
+#ifdef MOUNT_MENU_IN_DESKBAR
+
+class DeskbarMountMenu : public BPrivate::MountMenu {
+       public:
+               DeskbarMountMenu(const char* name);
+               virtual bool AddDynamicItem(add_state s);
+};
+
+#endif
+
+// #define SHOW_RECENT_FIND_ITEMS
+
+namespace BPrivate {
+       BMenu* TrackerBuildRecentFindItemsMenu(const char*);
+}
+
+
+using namespace BPrivate;
+
+
+//     #pragma mark -
+
+
+TDeskbarMenu::TDeskbarMenu(TBarView* barView)
+       : BNavMenu("DeskbarMenu", B_REFS_RECEIVED, DefaultTarget()),
+       fAddState(kStart),
+       fBarView(barView)
+{
+}
+
+
+void
+TDeskbarMenu::AttachedToWindow()
+{
+       if (fBarView && fBarView->LockLooper()) {
+               if (fBarView->Dragging()) {
+                       SetTypesList(fBarView->CachedTypesList());
+                       SetTarget(BMessenger(fBarView));
+                       SetTrackingHookDeep(this, fBarView->MenuTrackingHook,
+                               fBarView->GetTrackingHookData());
+                       fBarView->DragStart();
+               } else {
+                       SetTypesList(NULL);
+                       SetTarget(DefaultTarget());
+                       SetTrackingHookDeep(this, NULL, NULL);
+               }
+
+               fBarView->UnlockLooper();
+       }
+
+       BNavMenu::AttachedToWindow();
+}
+
+
+void
+TDeskbarMenu::DetachedFromWindow()
+{
+       if (fBarView) {
+               BLooper* looper = fBarView->Looper();
+               if (looper && looper->Lock()) {
+                       fBarView->DragStop();
+                       looper->Unlock();
+               }
+       }
+
+       // don't call BNavMenu::DetachedFromWindow
+       // it sets the TypesList to NULL
+       BMenu::DetachedFromWindow();
+}
+
+
+bool
+TDeskbarMenu::StartBuildingItemList()
+{
+       RemoveItems(0, CountItems(), true);
+       fAddState = kStart;
+       return BNavMenu::StartBuildingItemList();
+}
+
+
+void
+TDeskbarMenu::DoneBuildingItemList()
+{
+       if (fItemList->CountItems() <= 0) {
+               BMenuItem* item
+                       = new BMenuItem(B_TRANSLATE("<deskbar folder is 
empty>"), 0);
+               item->SetEnabled(false);
+               AddItem(item);
+       } else
+               BNavMenu::DoneBuildingItemList();
+}
+
+
+bool
+TDeskbarMenu::AddNextItem()
+{
+       if (fAddState == kStart)
+               return AddStandardDeskbarMenuItems();
+
+       TrackingHookData* data = fBarView->GetTrackingHookData();
+       if (fAddState == kAddingRecents) {
+               static const char* recentTitle[] = {
+                       B_TRANSLATE_MARK("Recent documents"),
+                       B_TRANSLATE_MARK("Recent folders"),
+                       B_TRANSLATE_MARK("Recent applications")};
+               const int recentType[] = {kRecentDocuments, kRecentFolders,
+                       kRecentApplications};
+               const int recentTypes = 3;
+               TRecentsMenu* recentItem[recentTypes];
+
+               bool enabled = false;
+
+               for (int i = 0; i < recentTypes; i++) {
+                       recentItem[i]
+                               = new 
TRecentsMenu(B_TRANSLATE_NOCOLLECT(recentTitle[i]),
+                                       fBarView, recentType[i]);
+
+                       if (recentItem[i])
+                               enabled |= recentItem[i]->RecentsEnabled();
+               }
+               if (enabled) {
+                       AddSeparatorItem();
+
+                       for (int i = 0; i < recentTypes; i++) {
+                               if (!recentItem[i])
+                                       continue;
+
+                               if (recentItem[i]->RecentsEnabled()) {
+                                       
recentItem[i]->SetTypesList(TypesList());
+                                       recentItem[i]->SetTarget(Target());
+                                       AddItem(recentItem[i]);
+                               }
+
+                               if (data && fBarView && fBarView->Dragging()) {
+                                       
recentItem[i]->InitTrackingHook(data->fTrackingHook,
+                                               &data->fTarget, 
data->fDragMessage);
+                               }
+                       }
+               }
+
+               AddSeparatorItem();
+               fAddState = kAddingDeskbarMenu;
+               return true;
+       }
+
+       if (fAddState == kAddingDeskbarMenu) {
+               // keep reentering and adding items
+               // until this returns false
+               bool done = BNavMenu::AddNextItem();
+               BMenuItem* item = ItemAt(CountItems() - 1);
+               if (item) {
+                       BNavMenu* menu = dynamic_cast<BNavMenu*>(item->Menu());
+                       if (menu) {
+                               if (data && fBarView->Dragging()) {
+                                       
menu->InitTrackingHook(data->fTrackingHook,
+                                               &data->fTarget, 
data->fDragMessage);
+                               } else
+                                       menu->InitTrackingHook(0, NULL, NULL);
+                       }
+               }
+
+               if (!done)
+                       fAddState = kDone;
+               return done;
+       }
+
+       return false;
+}
+
+
+bool
+TDeskbarMenu::AddStandardDeskbarMenuItems()
+{
+       bool dragging = false;
+       if (fBarView)
+               dragging = fBarView->Dragging();
+
+       BMenuItem* item;
+       BRoster roster;
+       if (!roster.IsRunning(kTrackerSignature)) {
+               item = new BMenuItem(B_TRANSLATE("Restart Tracker"),
+                       new BMessage(kRestartTracker));
+               AddItem(item);
+               AddSeparatorItem();
+       }
+
+#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
+       static const char* kAboutHaikuMenuItemStr = B_TRANSLATE_MARK(
+               "About Haiku" B_UTF8_ELLIPSIS);
+#else
+       static const char* kAboutThisSystemMenuItemStr = B_TRANSLATE_MARK(
+               "About this system" B_UTF8_ELLIPSIS);
+#endif
+
+       item = new BMenuItem(
+#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
+       B_TRANSLATE_NOCOLLECT(kAboutHaikuMenuItemStr)
+#else
+       B_TRANSLATE_NOCOLLECT(kAboutThisSystemMenuItemStr)
+#endif
+               , new BMessage(kShowSplash));
+       item->SetEnabled(!dragging);
+       AddItem(item);
+
+       static const char* kFindMenuItemStr
+               = B_TRANSLATE_MARK("Find" B_UTF8_ELLIPSIS);
+
+#ifdef SHOW_RECENT_FIND_ITEMS
+       item = new BMenuItem(
+               TrackerBuildRecentFindItemsMenu(kFindMenuItemStr),
+               new BMessage(kFindButton));
+#else
+       item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kFindMenuItemStr),
+               new BMessage(kFindButton));
+#endif
+       item->SetEnabled(!dragging);
+       AddItem(item);
+
+       item = new BMenuItem(B_TRANSLATE("Show replicants"),
+               new BMessage(kToggleDraggers));
+       item->SetEnabled(!dragging);
+       item->SetMarked(BDragger::AreDraggersDrawn());
+       AddItem(item);
+
+       static const char* kMountMenuStr = B_TRANSLATE_MARK("Mount");
+
+#ifdef MOUNT_MENU_IN_DESKBAR
+       DeskbarMountMenu* mountMenu = new DeskbarMountMenu(
+               B_TRANSLATE_NOCOLLECT(kMountMenuStr));
+       mountMenu->SetEnabled(!dragging);
+       AddItem(mountMenu);
+#endif
+
+       item = new BMenuItem(B_TRANSLATE("Deskbar preferences" B_UTF8_ELLIPSIS),
+               new BMessage(kConfigShow));
+       item->SetTarget(be_app);
+       AddItem(item);
+

[... truncated: 871 lines follow ...]

Other related posts:

  • » [haiku-commits] r40905 - in haiku/branches/features/package-management: build/jam src/apps/deskbar - zooey