Changeset 16909
- Timestamp:
- 03/28/06 06:32:21 (3 years ago)
- Location:
- haiku/trunk/src/kits/tracker
- Files:
-
- 8 modified
-
FSUtils.cpp (modified) (6 diffs)
-
FavoritesConfig.cpp (modified) (2 diffs)
-
IconMenuItem.cpp (modified) (9 diffs)
-
Model.cpp (modified) (1 diff)
-
MountMenu.cpp (modified) (2 diffs)
-
TrackerInitialState.cpp (modified) (1 diff)
-
Utilities.cpp (modified) (91 diffs)
-
Utilities.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
haiku/trunk/src/kits/tracker/FSUtils.cpp
r15873 r16909 2127 2127 if (result != B_OK) 2128 2128 return result; 2129 2129 2130 2130 BPath path; 2131 2131 result = find_directory(B_DESKTOP_DIRECTORY, &path, true, &volume); … … 2148 2148 2149 2149 if (data) 2150 deskDir->WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, data, size);2150 deskDir->WriteAttr(kAttrLargeIcon, 'ICON', 0, data, size); 2151 2151 2152 2152 data = GetTrackerResources()-> … … 2154 2154 2155 2155 if (data) 2156 deskDir->WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, data, size);2157 2156 deskDir->WriteAttr(kAttrMiniIcon, 'MICN', 0, data, size); 2157 2158 2158 return B_OK; 2159 2159 } … … 2632 2632 roster.Rewind(); 2633 2633 while (roster.GetNextVolume(&volume) == B_OK) { 2634 2635 2634 if (volume.IsReadOnly() || !volume.IsPersistent()) 2636 2635 continue; 2637 2636 2638 2637 BPath path; 2639 2638 find_directory(B_DESKTOP_DIRECTORY, &path, true, &volume); … … 2646 2645 LoadResource('ICON', kResTrashIcon, &size); 2647 2646 if (data) { 2648 trashDir.WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0,2647 trashDir.WriteAttr(kAttrLargeIcon, 'ICON', 0, 2649 2648 data, size); 2650 2649 } … … 2652 2651 LoadResource('MICN', kResTrashIcon, &size); 2653 2652 if (data) { 2654 trashDir.WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0,2653 trashDir.WriteAttr(kAttrMiniIcon, 'MICN', 0, 2655 2654 data, size); 2656 2655 } -
haiku/trunk/src/kits/tracker/FavoritesConfig.cpp
r12772 r16909 1050 1050 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 1051 1051 1052 fIcon = new BBitmap(BRect(0, 0, 31, 31), B_C OLOR_8_BIT);1053 fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_C OLOR_8_BIT);1052 fIcon = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8); 1053 fIcon->SetBits(kLargeNewGroupIcon, fIcon->BitsLength(), 0, B_CMAP8); 1054 1054 // calculate correct frame for icon and label 1055 1055 // sets icon rect and label rect for drawing … … 1251 1251 1252 1252 // cache the new group icon 1253 fSmallGroupIcon = new BBitmap(BRect(0, 0, 15, 15), B_C OLOR_8_BIT);1253 fSmallGroupIcon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); 1254 1254 fSmallGroupIcon->SetBits(kSmallNewGroupIcon, fSmallGroupIcon->BitsLength(), 1255 0, B_C OLOR_8_BIT);1255 0, B_CMAP8); 1256 1256 1257 1257 // cache the symlink icon 1258 1258 BMimeType symlink("application/x-vnd.Be-symlink"); 1259 1259 if (symlink.InitCheck() == B_OK) { 1260 fSymlinkIcon = new BBitmap(BRect(0, 0, 15, 15), B_C OLOR_8_BIT);1260 fSymlinkIcon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); 1261 1261 if (symlink.GetIcon(fSymlinkIcon, B_MINI_ICON) != B_OK) 1262 1262 fSymlinkIcon = NULL; -
haiku/trunk/src/kits/tracker/IconMenuItem.cpp
r12772 r16909 35 35 // menu items with small icons. 36 36 37 #include "IconCache.h" 38 #include "IconMenuItem.h" 39 37 40 #include <Debug.h> 38 41 #include <Menu.h> 39 42 #include <NodeInfo.h> 40 43 41 #include "IconCache.h"42 #include "IconMenuItem.h"43 44 44 45 45 ModelMenuItem::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) 53 53 { 54 54 ThrowOnInitCheckError(&fModel); 55 // The 'fExtraPad' field is used to when this menu item is added to56 // a menubar instead of a menu. Menus and MenuBars space out items57 // differently (more space around items in a menu). This class wants58 // to be able to space item the same, no matter where they are. The59 // 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. 60 60 61 61 if (model->IsRoot()) … … 190 190 clone.AddPointer("source", this); 191 191 192 if ((modifiers() & B_OPTION_KEY) == 0) 192 if ((modifiers() & B_OPTION_KEY) == 0) { 193 193 // if option not held, remove refs to close to prevent closing 194 194 // parent window 195 195 clone.RemoveData("nodeRefsToClose"); 196 } 196 197 197 198 return BInvoker::Invoke(&clone); … … 227 228 228 229 IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon) 229 : PositionPassingMenuItem(label, message),230 fDeviceIcon(icon)230 : PositionPassingMenuItem(label, message), 231 fDeviceIcon(icon) 231 232 { 232 233 // IconMenuItem is used in synchronously invoked menus, make sure … … 237 238 238 239 IconMenuItem::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) 242 243 { 243 244 if (nodeInfo) { 244 fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_C OLOR_8_BIT);245 fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8); 245 246 if (nodeInfo->GetTrackerIcon(fDeviceIcon, B_MINI_ICON)) { 246 247 delete fDeviceIcon; … … 248 249 } 249 250 } 250 251 251 252 // IconMenuItem is used in synchronously invoked menus, make sure 252 253 // we invoke with a timeout … … 256 257 257 258 IconMenuItem::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) 261 262 { 262 263 BMimeType mime(iconType); 263 fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_C OLOR_8_BIT);264 fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8); 264 265 265 266 if (mime.GetIcon(fDeviceIcon, which) != B_OK) { … … 267 268 fDeviceIcon = NULL; 268 269 } 269 270 270 271 // IconMenuItem is used in synchronously invoked menus, make sure 271 272 // we invoke with a timeout … … 275 276 276 277 IconMenuItem::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) 280 281 { 281 282 BMimeType mime(iconType); 282 fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_C OLOR_8_BIT);283 fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_CMAP8); 283 284 284 285 if (mime.GetIcon(fDeviceIcon, which) != B_OK) { … … 286 287 fDeviceIcon = NULL; 287 288 } 288 289 289 290 // IconMenuItem is used in synchronously invoked menus, make sure 290 291 // we invoke with a timeout -
haiku/trunk/src/kits/tracker/Model.cpp
r12772 r16909 1328 1328 rect.Set(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1); 1329 1329 1330 BBitmap bitmap(rect, B_C OLOR_8_BIT);1330 BBitmap bitmap(rect, B_CMAP8); 1331 1331 1332 1332 BModelOpener opener(this); -
haiku/trunk/src/kits/tracker/MountMenu.cpp
r16436 r16909 79 79 AddOneAsMenuItemParams *params = (AddOneAsMenuItemParams *)castToParams; 80 80 BBitmap *icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), 81 B_C OLOR_8_BIT);81 B_CMAP8); 82 82 get_device_icon(partition->GetDevice()->Name(), icon->Bits(), B_MINI_ICON); 83 83 … … 161 161 if (volume.IsShared()) { 162 162 needSeparator = true; 163 BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_C OLOR_8_BIT);163 BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); 164 164 fs_info info; 165 165 if (fs_stat_dev(volume.Device(), &info) != B_OK) { -
haiku/trunk/src/kits/tracker/TrackerInitialState.cpp
r12772 r16909 159 159 // be passed for attributes that don't matter; returns true if anything 160 160 // had to be changed 161 BBitmap largeIcon(BRect(0, 0, 31, 31), B_C OLOR_8_BIT);162 BBitmap miniIcon(BRect(0, 0, 15, 15), B_C OLOR_8_BIT);161 BBitmap largeIcon(BRect(0, 0, 31, 31), B_CMAP8); 162 BBitmap miniIcon(BRect(0, 0, 15, 15), B_CMAP8); 163 163 char tmp[B_MIME_TYPE_LENGTH]; 164 164 -
haiku/trunk/src/kits/tracker/Utilities.cpp
r15764 r16909 75 75 FILE *logFile = NULL; 76 76 77 static const float kMinSeparatorStubX = 10; 78 static const float kStubToStringSlotX = 5; 79 80 77 81 namespace BPrivate { 78 82 79 83 const rgb_color kBlack = {0, 0, 0, 255}; 80 84 const rgb_color kWhite = {255, 255, 255, 255}; 85 81 86 82 87 uint32 … … 95 100 } 96 101 102 97 103 uint32 98 104 AttrHashString(const char *string, uint32 type) … … 114 120 } 115 121 122 116 123 bool 117 124 ValidateStream(BMallocIO *stream, uint32 key, int32 version) … … 127 134 } 128 135 136 129 137 void 130 138 DisallowFilenameKeys(BTextView *textView) … … 133 141 textView->DisallowChar('/'); 134 142 } 143 135 144 136 145 void … … 150 159 } // namespace BPrivate 151 160 152 void 161 162 void 153 163 PoseInfo::EndianSwap(void *castToThis) 154 164 { … … 160 170 self->fInitedDirectory = SwapInt64(self->fInitedDirectory); 161 171 swap_data(B_POINT_TYPE, &self->fLocation, sizeof(BPoint), B_SWAP_ALWAYS); 162 172 163 173 // do a sanity check on the icon position 164 174 if (self->fLocation.x < -20000 || self->fLocation.x > 20000 … … 171 181 } 172 182 173 void 183 184 void 174 185 PoseInfo::PrintToStream() 175 186 { … … 178 189 } 179 190 191 180 192 // #pragma mark - 181 193 182 size_t 194 195 size_t 183 196 ExtendedPoseInfo::Size() const 184 197 { … … 186 199 } 187 200 188 size_t 201 202 size_t 189 203 ExtendedPoseInfo::Size(int32 count) 190 204 { … … 192 206 } 193 207 194 size_t 208 209 size_t 195 210 ExtendedPoseInfo::SizeWithHeadroom() const 196 211 { … … 198 213 } 199 214 200 size_t 215 216 size_t 201 217 ExtendedPoseInfo::SizeWithHeadroom(size_t oldSize) 202 218 { … … 206 222 else 207 223 count = 0; 208 224 209 225 return Size(count + 1); 210 226 } … … 214 230 ExtendedPoseInfo::HasLocationForFrame(BRect frame) const 215 231 { 216 for (int32 index = 0; index < fNumFrames; index++) 232 for (int32 index = 0; index < fNumFrames; index++) { 217 233 if (fLocations[index].fFrame == frame) 218 234 return true; 235 } 219 236 220 237 return false; 221 238 } 222 239 223 BPoint 240 241 BPoint 224 242 ExtendedPoseInfo::LocationForFrame(BRect frame) const 225 243 { 226 for (int32 index = 0; index < fNumFrames; index++) 244 for (int32 index = 0; index < fNumFrames; index++) { 227 245 if (fLocations[index].fFrame == frame) 228 246 return fLocations[index].fLocation; 247 } 229 248 230 249 TRESPASS(); … … 232 251 } 233 252 234 bool 253 254 bool 235 255 ExtendedPoseInfo::SetLocationForFrame(BPoint newLocation, BRect frame) 236 256 { 237 for (int32 index = 0; index < fNumFrames; index++) 257 for (int32 index = 0; index < fNumFrames; index++) { 238 258 if (fLocations[index].fFrame == frame) { 239 259 if (fLocations[index].fLocation == newLocation) 240 260 return false; 261 241 262 fLocations[index].fLocation = newLocation; 242 263 return true; 243 264 } 265 } 266 244 267 fLocations[fNumFrames].fFrame = frame; 245 268 fLocations[fNumFrames].fLocation = newLocation; … … 249 272 } 250 273 251 void 274 275 void 252 276 ExtendedPoseInfo::EndianSwap(void *castToThis) 253 277 { … … 258 282 self->fWorkspaces = SwapUInt32(self->fWorkspaces); 259 283 self->fNumFrames = SwapInt32(self->fNumFrames); 260 284 261 285 for (int32 index = 0; index < self->fNumFrames; index++) { 262 286 swap_data(B_POINT_TYPE, &self->fLocations[index].fLocation, … … 276 300 } 277 301 278 void 302 303 void 279 304 ExtendedPoseInfo::PrintToStream() 280 305 { 281 306 } 282 307 308 283 309 // #pragma mark - 284 310 311 285 312 OffscreenBitmap::OffscreenBitmap(BRect frame) 286 : fBitmap(NULL) 313 : 314 fBitmap(NULL) 287 315 { 288 316 NewBitmap(frame); 289 317 } 290 318 319 291 320 OffscreenBitmap::OffscreenBitmap() 292 : fBitmap(NULL) 293 { 294 } 321 : 322 fBitmap(NULL) 323 { 324 } 325 295 326 296 327 OffscreenBitmap::~OffscreenBitmap() … … 298 329 delete fBitmap; 299 330 } 331 300 332 301 333 void … … 320 352 } 321 353 354 322 355 BView * 323 356 OffscreenBitmap::BeginUsing(BRect frame) … … 325 358 if (!fBitmap || fBitmap->Bounds() != frame) 326 359 NewBitmap(frame); 360 327 361 fBitmap->Lock(); 328 362 return View(); 329 363 } 330 364 365 331 366 void 332 367 OffscreenBitmap::DoneUsing() … … 334 369 fBitmap->Unlock(); 335 370 } 371 336 372 337 373 BBitmap * … … 342 378 return fBitmap; 343 379 } 380 344 381 345 382 BView * … … 433 470 434 471 DraggableIcon::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) 440 477 { 441 478 fBitmap = new BBitmap(Bounds(), kDefaultIconDepth); … … 452 489 453 490 454 void 491 DraggableIcon::~DraggableIcon() 492 { 493 delete fBitmap; 494 } 495 496 497 void 455 498 DraggableIcon::SetTarget(BMessenger target) 456 499 { … … 458 501 } 459 502 460 DraggableIcon::~DraggableIcon() 461 { 462 delete fBitmap; 463 } 464 465 BRect 503 504 BRect 466 505 DraggableIcon::PreferredRect(BPoint offset, icon_size size) 467 506 { … … 471 510 } 472 511 473 void 512 513 void 474 514 DraggableIcon::AttachedToWindow() 475 515 { … … 481 521 } 482 522 483 void 523 524 void 484 525 DraggableIcon::MouseDown(BPoint point) 485 526 { … … 502 543 view->FillRect(view->Bounds()); 503 544 view->SetDrawingMode(B_OP_ALPHA); 504 view->SetHighColor(0, 0, 0, 128); // set the level of transparency by505 //value545 view->SetHighColor(0, 0, 0, 128); 546 // set the level of transparency by value 506 547 view->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE); 507 548 view->DrawBitmap(fBitmap); … … 511 552 } 512 553 513 bool 554 555 bool 514 556 DraggableIcon::DragStarted(BMessage *) 515 557 { 516 558 return true; 517 559 } 560 518 561 519 562 void … … 524 567 } 525 568 569 526 570 // #pragma mark - 527 571 572 528 573 FlickerFreeStringView::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)
