Changeset 16909

Show
Ignore:
Timestamp:
03/28/06 06:32:21 (3 years ago)
Author:
axeld
Message:

* Tracker wrote icons with the wrong type at several places.
* Also replaced all B_COLOR_8_BIT with the B_CMAP8 constant.

Location:
haiku/trunk/src/kits/tracker
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/src/kits/tracker/FSUtils.cpp

    r15873 r16909  
    21272127        if (result != B_OK) 
    21282128                return result; 
    2129                  
     2129 
    21302130        BPath path; 
    21312131        result = find_directory(B_DESKTOP_DIRECTORY, &path, true, &volume); 
     
    21482148 
    21492149        if (data) 
    2150                 deskDir->WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, data, size); 
     2150                deskDir->WriteAttr(kAttrLargeIcon, 'ICON', 0, data, size); 
    21512151 
    21522152        data = GetTrackerResources()-> 
     
    21542154 
    21552155        if (data) 
    2156                 deskDir->WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, data, size); 
    2157          
     2156                deskDir->WriteAttr(kAttrMiniIcon, 'MICN', 0, data, size); 
     2157 
    21582158        return B_OK; 
    21592159} 
     
    26322632        roster.Rewind(); 
    26332633        while (roster.GetNextVolume(&volume) == B_OK) { 
    2634                  
    26352634                if (volume.IsReadOnly() || !volume.IsPersistent()) 
    26362635                        continue; 
    2637                  
     2636 
    26382637                BPath path; 
    26392638                find_directory(B_DESKTOP_DIRECTORY, &path, true, &volume); 
     
    26462645                                LoadResource('ICON', kResTrashIcon, &size); 
    26472646                        if (data) { 
    2648                                 trashDir.WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, 
     2647                                trashDir.WriteAttr(kAttrLargeIcon, 'ICON', 0, 
    26492648                                        data, size); 
    26502649                        } 
     
    26522651                                LoadResource('MICN', kResTrashIcon, &size); 
    26532652                        if (data) { 
    2654                                 trashDir.WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, 
     2653                                trashDir.WriteAttr(kAttrMiniIcon, 'MICN', 0, 
    26552654                                        data, size); 
    26562655                        } 
  • haiku/trunk/src/kits/tracker/FavoritesConfig.cpp

    r12772 r16909  
    10501050                SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 
    10511051 
    1052         fIcon = new BBitmap(BRect(0, 0, 31, 31), B_COLOR_8_BIT); 
    1053         fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_COLOR_8_BIT); 
     1052        fIcon = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8); 
     1053        fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_CMAP8); 
    10541054        //      calculate correct frame for icon and label 
    10551055        //      sets icon rect and label rect for drawing 
     
    12511251 
    12521252        //      cache the new group icon 
    1253         fSmallGroupIcon = new BBitmap(BRect(0, 0, 15, 15), B_COLOR_8_BIT); 
     1253        fSmallGroupIcon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); 
    12541254        fSmallGroupIcon->SetBits(kSmallNewGroupIcon, fSmallGroupIcon->BitsLength(), 
    1255                 0, B_COLOR_8_BIT); 
     1255                0, B_CMAP8); 
    12561256 
    12571257        //      cache the symlink icon 
    12581258        BMimeType symlink("application/x-vnd.Be-symlink"); 
    12591259        if (symlink.InitCheck() == B_OK) { 
    1260                 fSymlinkIcon = new BBitmap(BRect(0, 0, 15, 15), B_COLOR_8_BIT); 
     1260                fSymlinkIcon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); 
    12611261                if (symlink.GetIcon(fSymlinkIcon, B_MINI_ICON) != B_OK) 
    12621262                        fSymlinkIcon = NULL;             
  • haiku/trunk/src/kits/tracker/IconMenuItem.cpp

    r12772 r16909  
    3535// menu items with small icons. 
    3636 
     37#include "IconCache.h" 
     38#include "IconMenuItem.h" 
     39 
    3740#include <Debug.h> 
    3841#include <Menu.h> 
    3942#include <NodeInfo.h> 
    4043 
    41 #include "IconCache.h" 
    42 #include "IconMenuItem.h" 
    43  
    4444 
    4545ModelMenuItem::ModelMenuItem(const Model *model, const char *title, 
    46         BMessage *message, char shortcut, uint32 modifiers, 
    47         bool drawText, bool extraPad) 
    48         :       BMenuItem(title, message, shortcut, modifiers), 
    49                 fModel(*model), 
    50                 fHeightDelta(0), 
    51                 fDrawText(drawText), 
    52                 fExtraPad(extraPad) 
     46                BMessage *message, char shortcut, uint32 modifiers, 
     47                bool drawText, bool extraPad) 
     48        : BMenuItem(title, message, shortcut, modifiers), 
     49        fModel(*model), 
     50        fHeightDelta(0), 
     51        fDrawText(drawText), 
     52        fExtraPad(extraPad) 
    5353{ 
    5454        ThrowOnInitCheckError(&fModel); 
    55         //      The 'fExtraPad' field is used to when this menu item is added to 
    56         //      a menubar instead of a menu. Menus and MenuBars space out items 
    57         //      differently (more space around items in a menu). This class wants 
    58         //      to be able to space item the same, no matter where they are. The 
    59         //      fExtraPad field allows for that. 
     55        // The 'fExtraPad' field is used to when this menu item is added to 
     56        // a menubar instead of a menu. Menus and MenuBars space out items 
     57        // differently (more space around items in a menu). This class wants 
     58        // to be able to space item the same, no matter where they are. The 
     59        // fExtraPad field allows for that. 
    6060 
    6161        if (model->IsRoot()) 
     
    190190        clone.AddPointer("source", this); 
    191191 
    192         if ((modifiers() & B_OPTION_KEY) == 0) 
     192        if ((modifiers() & B_OPTION_KEY) == 0) { 
    193193                // if option not held, remove refs to close to prevent closing 
    194194                // parent window 
    195195                clone.RemoveData("nodeRefsToClose"); 
     196        } 
    196197 
    197198        return BInvoker::Invoke(&clone); 
     
    227228 
    228229IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon) 
    229         :       PositionPassingMenuItem(label, message), 
    230                 fDeviceIcon(icon) 
     230        : PositionPassingMenuItem(label, message), 
     231        fDeviceIcon(icon) 
    231232{ 
    232233        // IconMenuItem is used in synchronously invoked menus, make sure 
     
    237238 
    238239IconMenuItem::IconMenuItem(const char *label, BMessage *message, 
    239         const BNodeInfo *nodeInfo, icon_size which) 
    240         :       PositionPassingMenuItem(label, message), 
    241                 fDeviceIcon(NULL) 
     240                const BNodeInfo *nodeInfo, icon_size which) 
     241        : PositionPassingMenuItem(label, message), 
     242        fDeviceIcon(NULL) 
    242243{ 
    243244        if (nodeInfo) { 
    244                 fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_COLOR_8_BIT); 
     245                fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8); 
    245246                if (nodeInfo->GetTrackerIcon(fDeviceIcon, B_MINI_ICON)) { 
    246247                        delete fDeviceIcon; 
     
    248249                } 
    249250        } 
    250          
     251 
    251252        // IconMenuItem is used in synchronously invoked menus, make sure 
    252253        // we invoke with a timeout 
     
    256257 
    257258IconMenuItem::IconMenuItem(const char *label, BMessage *message, 
    258         const char *iconType, icon_size which) 
    259         :       PositionPassingMenuItem(label, message), 
    260                 fDeviceIcon(NULL) 
     259                const char *iconType, icon_size which) 
     260        : PositionPassingMenuItem(label, message), 
     261        fDeviceIcon(NULL) 
    261262{ 
    262263        BMimeType mime(iconType); 
    263         fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_COLOR_8_BIT); 
     264        fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8); 
    264265 
    265266        if (mime.GetIcon(fDeviceIcon, which) != B_OK) { 
     
    267268                fDeviceIcon = NULL; 
    268269        } 
    269          
     270 
    270271        // IconMenuItem is used in synchronously invoked menus, make sure 
    271272        // we invoke with a timeout 
     
    275276 
    276277IconMenuItem::IconMenuItem(BMenu *submenu, BMessage *message, 
    277         const char *iconType, icon_size which) 
    278         :       PositionPassingMenuItem(submenu, message), 
    279                 fDeviceIcon(NULL) 
     278                const char *iconType, icon_size which) 
     279        : PositionPassingMenuItem(submenu, message), 
     280        fDeviceIcon(NULL) 
    280281{ 
    281282        BMimeType mime(iconType); 
    282         fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_COLOR_8_BIT); 
     283        fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8); 
    283284 
    284285        if (mime.GetIcon(fDeviceIcon, which) != B_OK) { 
     
    286287                fDeviceIcon = NULL; 
    287288        } 
    288          
     289 
    289290        // IconMenuItem is used in synchronously invoked menus, make sure 
    290291        // we invoke with a timeout 
  • haiku/trunk/src/kits/tracker/Model.cpp

    r12772 r16909  
    13281328                rect.Set(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1); 
    13291329 
    1330         BBitmap bitmap(rect, B_COLOR_8_BIT); 
     1330        BBitmap bitmap(rect, B_CMAP8); 
    13311331 
    13321332        BModelOpener opener(this); 
  • haiku/trunk/src/kits/tracker/MountMenu.cpp

    r16436 r16909  
    7979        AddOneAsMenuItemParams *params = (AddOneAsMenuItemParams *)castToParams; 
    8080        BBitmap *icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), 
    81                 B_COLOR_8_BIT); 
     81                B_CMAP8); 
    8282        get_device_icon(partition->GetDevice()->Name(), icon->Bits(), B_MINI_ICON);      
    8383 
     
    161161                if (volume.IsShared()) { 
    162162                        needSeparator = true; 
    163                         BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_COLOR_8_BIT); 
     163                        BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); 
    164164                        fs_info info; 
    165165                        if (fs_stat_dev(volume.Device(), &info) != B_OK) { 
  • haiku/trunk/src/kits/tracker/TrackerInitialState.cpp

    r12772 r16909  
    159159        // be passed for attributes that don't matter; returns true if anything 
    160160        // had to be changed 
    161         BBitmap largeIcon(BRect(0, 0, 31, 31), B_COLOR_8_BIT); 
    162         BBitmap miniIcon(BRect(0, 0, 15, 15), B_COLOR_8_BIT); 
     161        BBitmap largeIcon(BRect(0, 0, 31, 31), B_CMAP8); 
     162        BBitmap miniIcon(BRect(0, 0, 15, 15), B_CMAP8); 
    163163        char tmp[B_MIME_TYPE_LENGTH]; 
    164164 
  • haiku/trunk/src/kits/tracker/Utilities.cpp

    r15764 r16909  
    7575FILE *logFile = NULL; 
    7676 
     77static const float kMinSeparatorStubX = 10; 
     78static const float kStubToStringSlotX = 5; 
     79 
     80 
    7781namespace BPrivate { 
    7882 
    7983const rgb_color kBlack = {0, 0, 0, 255}; 
    8084const rgb_color kWhite = {255, 255, 255, 255}; 
     85 
    8186 
    8287uint32 
     
    95100} 
    96101 
     102 
    97103uint32 
    98104AttrHashString(const char *string, uint32 type) 
     
    114120} 
    115121 
     122 
    116123bool 
    117124ValidateStream(BMallocIO *stream, uint32 key, int32 version) 
     
    127134} 
    128135 
     136 
    129137void 
    130138DisallowFilenameKeys(BTextView *textView) 
     
    133141        textView->DisallowChar('/'); 
    134142} 
     143 
    135144 
    136145void 
     
    150159}       // namespace BPrivate 
    151160 
    152 void  
     161 
     162void 
    153163PoseInfo::EndianSwap(void *castToThis) 
    154164{ 
     
    160170        self->fInitedDirectory = SwapInt64(self->fInitedDirectory); 
    161171        swap_data(B_POINT_TYPE, &self->fLocation, sizeof(BPoint), B_SWAP_ALWAYS); 
    162          
     172 
    163173        // do a sanity check on the icon position 
    164174        if (self->fLocation.x < -20000 || self->fLocation.x > 20000 
     
    171181} 
    172182 
    173 void  
     183 
     184void 
    174185PoseInfo::PrintToStream() 
    175186{ 
     
    178189} 
    179190 
     191 
    180192// #pragma mark - 
    181193 
    182 size_t  
     194 
     195size_t 
    183196ExtendedPoseInfo::Size() const 
    184197{ 
     
    186199} 
    187200 
    188 size_t  
     201 
     202size_t 
    189203ExtendedPoseInfo::Size(int32 count) 
    190204{ 
     
    192206} 
    193207 
    194 size_t  
     208 
     209size_t 
    195210ExtendedPoseInfo::SizeWithHeadroom() const 
    196211{ 
     
    198213} 
    199214 
    200 size_t  
     215 
     216size_t 
    201217ExtendedPoseInfo::SizeWithHeadroom(size_t oldSize) 
    202218{ 
     
    206222        else 
    207223                count = 0; 
    208                  
     224 
    209225        return Size(count + 1); 
    210226} 
     
    214230ExtendedPoseInfo::HasLocationForFrame(BRect frame) const 
    215231{ 
    216         for (int32 index = 0; index < fNumFrames; index++) 
     232        for (int32 index = 0; index < fNumFrames; index++) { 
    217233                if (fLocations[index].fFrame == frame) 
    218234                        return true; 
     235        } 
    219236 
    220237        return false; 
    221238} 
    222239 
    223 BPoint  
     240 
     241BPoint 
    224242ExtendedPoseInfo::LocationForFrame(BRect frame) const 
    225243{ 
    226         for (int32 index = 0; index < fNumFrames; index++) 
     244        for (int32 index = 0; index < fNumFrames; index++) { 
    227245                if (fLocations[index].fFrame == frame) 
    228246                        return fLocations[index].fLocation; 
     247        } 
    229248 
    230249        TRESPASS(); 
     
    232251} 
    233252 
    234 bool  
     253 
     254bool 
    235255ExtendedPoseInfo::SetLocationForFrame(BPoint newLocation, BRect frame) 
    236256{ 
    237         for (int32 index = 0; index < fNumFrames; index++) 
     257        for (int32 index = 0; index < fNumFrames; index++) { 
    238258                if (fLocations[index].fFrame == frame) { 
    239259                        if (fLocations[index].fLocation == newLocation) 
    240260                                return false; 
     261 
    241262                        fLocations[index].fLocation = newLocation; 
    242263                        return true; 
    243264                } 
     265        } 
     266 
    244267        fLocations[fNumFrames].fFrame = frame; 
    245268        fLocations[fNumFrames].fLocation = newLocation; 
     
    249272} 
    250273 
    251 void  
     274 
     275void 
    252276ExtendedPoseInfo::EndianSwap(void *castToThis) 
    253277{ 
     
    258282        self->fWorkspaces = SwapUInt32(self->fWorkspaces); 
    259283        self->fNumFrames = SwapInt32(self->fNumFrames); 
    260          
     284 
    261285        for (int32 index = 0; index < self->fNumFrames; index++) { 
    262286                swap_data(B_POINT_TYPE, &self->fLocations[index].fLocation, 
     
    276300} 
    277301 
    278 void  
     302 
     303void 
    279304ExtendedPoseInfo::PrintToStream() 
    280305{ 
    281306} 
    282307 
     308 
    283309// #pragma mark - 
    284310 
     311 
    285312OffscreenBitmap::OffscreenBitmap(BRect frame) 
    286         :       fBitmap(NULL) 
     313        : 
     314        fBitmap(NULL) 
    287315{ 
    288316        NewBitmap(frame); 
    289317} 
    290318 
     319 
    291320OffscreenBitmap::OffscreenBitmap() 
    292         :       fBitmap(NULL) 
    293 { 
    294 } 
     321        : 
     322        fBitmap(NULL) 
     323{ 
     324} 
     325 
    295326 
    296327OffscreenBitmap::~OffscreenBitmap() 
     
    298329        delete fBitmap; 
    299330} 
     331 
    300332 
    301333void 
     
    320352} 
    321353 
     354 
    322355BView * 
    323356OffscreenBitmap::BeginUsing(BRect frame) 
     
    325358        if (!fBitmap || fBitmap->Bounds() != frame) 
    326359                NewBitmap(frame); 
     360 
    327361        fBitmap->Lock(); 
    328362        return View(); 
    329363} 
    330364 
     365 
    331366void 
    332367OffscreenBitmap::DoneUsing() 
     
    334369        fBitmap->Unlock(); 
    335370} 
     371 
    336372 
    337373BBitmap * 
     
    342378        return fBitmap; 
    343379} 
     380 
    344381 
    345382BView * 
     
    433470 
    434471DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType, 
    435         icon_size size, const BMessage *message, BMessenger target, uint32 resizeMask, 
    436         uint32 flags) 
    437         :       BView(rect, name, resizeMask, flags), 
    438                 fMessage(*message), 
    439                 fTarget(target) 
     472                icon_size size, const BMessage *message, BMessenger target, 
     473                uint32 resizeMask, uint32 flags) 
     474        : BView(rect, name, resizeMask, flags), 
     475        fMessage(*message), 
     476        fTarget(target) 
    440477{ 
    441478        fBitmap = new BBitmap(Bounds(), kDefaultIconDepth); 
     
    452489 
    453490 
    454 void  
     491DraggableIcon::~DraggableIcon() 
     492{ 
     493        delete fBitmap; 
     494} 
     495 
     496 
     497void 
    455498DraggableIcon::SetTarget(BMessenger target) 
    456499{ 
     
    458501} 
    459502 
    460 DraggableIcon::~DraggableIcon() 
    461 { 
    462         delete fBitmap; 
    463 } 
    464  
    465 BRect  
     503 
     504BRect 
    466505DraggableIcon::PreferredRect(BPoint offset, icon_size size) 
    467506{ 
     
    471510} 
    472511 
    473 void  
     512 
     513void 
    474514DraggableIcon::AttachedToWindow() 
    475515{ 
     
    481521} 
    482522 
    483 void  
     523 
     524void 
    484525DraggableIcon::MouseDown(BPoint point) 
    485526{ 
     
    502543        view->FillRect(view->Bounds()); 
    503544        view->SetDrawingMode(B_OP_ALPHA); 
    504         view->SetHighColor(0, 0, 0, 128);       // set the level of transparency by 
    505                                                                                 // value 
     545        view->SetHighColor(0, 0, 0, 128); 
     546                // set the level of transparency by value 
    506547        view->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE); 
    507548        view->DrawBitmap(fBitmap); 
     
    511552} 
    512553 
    513 bool  
     554 
     555bool 
    514556DraggableIcon::DragStarted(BMessage *) 
    515557{ 
    516558        return true; 
    517559} 
     560 
    518561 
    519562void 
     
    524567} 
    525568 
     569 
    526570// #pragma mark - 
    527571 
     572 
    528573FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, 
    529         const char *text, uint32 resizeFlags, uint32 flags) 
    530         :       BStringView(bounds, name, text, resizeFlags, flags), 
    531                 fBitmap(NULL), 
    532                 fOrigBitmap(NULL) 
    533 { 
    534 } 
     574                const char *text, uint32 resizeFlags, uint32 flags) 
     575        : BStringView(bounds, name, text, resizeFlags, flags), 
     576        fBitmap(NULL), 
     577        fOrigBitmap(NULL)