From 558e33f79f7c4c9334b2d28069162c721a709d4b Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Sat, 9 Jun 2012 13:49:22 +0200 Subject: [PATCH 01/65] Add MikMod to libs available at build time. Going to use it for a media decoder, and there is no way to do that outside of Haiku sourcetree so far... --- build/jam/OptionalBuildFeatures | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 350a781260..9e461e095a 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -333,6 +333,38 @@ if $(TARGET_ARCH) = x86 { } +# MikMod +local mikmodBaseURL = http://haiku-files.org/files/optional-packages/lib ; +if $(TARGET_ARCH) = x86 { + if $(HAIKU_GCC_VERSION[1]) >= 4 { + HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a3-x86-gcc4-2011-05-26.zip ; + } else { + HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a3-x86-gcc2-2011-05-19.zip ; + } + + local mikmodZipFile = [ DownloadFile $(HAIKU_MIKMOD_FILE) + : $(mikmodBaseURL)/$(HAIKU_MIKMOD_FILE) ] ; + + HAIKU_MIKMOD_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) + $(HAIKU_MIKMOD_FILE:B) ] ; + + HAIKU_MIKMOD_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MIKMOD_DIR) + : common/include/ : $(mikmodZipFile) : extracted-mikmod ] ; + + HAIKU_MIKMOD_LIBS = [ ExtractArchive $(HAIKU_MIKMOD_DIR) + : + common/lib/libmikmod.a + : $(mikmodZipFile) + : extracted-ffmpeg ] ; + Depends $(HAIKU_MIKMOD_LIBS) : $(HAIKU_MIKMOD_HEADERS_DEPENDENCY) ; + + HAIKU_MIKMOD_HEADERS = [ FDirName $(HAIKU_MIKMOD_DIR) common include ] ; + +} else { + Echo "MikMod support not available on $(TARGET_ARCH)" ; +} + + # Freetype local freetypeBaseURL = http://haiku-files.org/files/optional-packages/lib ; if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 { From 6b0362305fa9f8a35ce0f2b7052b4c901d040fe9 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sat, 21 Jul 2012 11:13:41 -0400 Subject: [PATCH 02/65] FontDemo: make it multibyte chars compliant (UTF-8) fixes #8146. --- src/apps/fontdemo/FontDemoView.cpp | 11 +++++++++-- src/apps/fontdemo/Jamfile | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/apps/fontdemo/FontDemoView.cpp b/src/apps/fontdemo/FontDemoView.cpp index 1dae1a56ed..077ac6e1c1 100644 --- a/src/apps/fontdemo/FontDemoView.cpp +++ b/src/apps/fontdemo/FontDemoView.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include "messages.h" #undef B_TRANSLATION_CONTEXT @@ -99,7 +101,7 @@ FontDemoView::_DrawView(BView* view) view->SetFont(&fFont, B_FONT_ALL); - const size_t size = strlen(fString); + const size_t size = UTF8CountChars(fString, -1); BRect boundBoxes[size]; if (OutLineLevel()) @@ -137,6 +139,8 @@ FontDemoView::_DrawView(BView* view) fBoxRegion.MakeEmpty(); + char *tmpString = fString; + for (size_t i = 0; i < size; i++) { xCoordArray[i] = 0.0f; yCoordArray[i] = 0.0f; @@ -159,7 +163,10 @@ FontDemoView::_DrawView(BView* view) } else { view->SetHighColor(0, 0, 0); view->SetDrawingMode(fDrawingMode); - view->DrawChar(fString[i], BPoint(xCoordArray[i], yCoordArray[i])); + int32 length = UTF8NextCharLen(tmpString); + view->DrawString(tmpString, length, + BPoint(xCoordArray[i], yCoordArray[i])); + tmpString += length; } if (BoundingBoxes() && !OutLineLevel()) { diff --git a/src/apps/fontdemo/Jamfile b/src/apps/fontdemo/Jamfile index 616621f2b0..a02fa1f33f 100644 --- a/src/apps/fontdemo/Jamfile +++ b/src/apps/fontdemo/Jamfile @@ -2,6 +2,8 @@ SubDir HAIKU_TOP src apps fontdemo ; SetSubDirSupportedPlatformsBeOSCompatible ; +UsePrivateHeaders interface ; + Application FontDemo : ControlView.cpp FontDemo.cpp From c5e8e32acd64dbbf41b67aee6dd7badb66c1ca7b Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sat, 21 Jul 2012 12:23:18 -0400 Subject: [PATCH 03/65] FontDemo: Cleanup of previous UTF-8 compliancy fix Avoid using the private API, rather use the public BString. Thanks mmlr. --- src/apps/fontdemo/FontDemoView.cpp | 14 ++++++-------- src/apps/fontdemo/Jamfile | 2 -- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/apps/fontdemo/FontDemoView.cpp b/src/apps/fontdemo/FontDemoView.cpp index 077ac6e1c1..5294eca5ff 100644 --- a/src/apps/fontdemo/FontDemoView.cpp +++ b/src/apps/fontdemo/FontDemoView.cpp @@ -19,8 +19,7 @@ #include #include #include - -#include +#include #include "messages.h" @@ -101,7 +100,8 @@ FontDemoView::_DrawView(BView* view) view->SetFont(&fFont, B_FONT_ALL); - const size_t size = UTF8CountChars(fString, -1); + BString tmpString(fString); + const size_t size = tmpString.CountChars(); BRect boundBoxes[size]; if (OutLineLevel()) @@ -138,8 +138,6 @@ FontDemoView::_DrawView(BView* view) // region area instead of the whole view. fBoxRegion.MakeEmpty(); - - char *tmpString = fString; for (size_t i = 0; i < size; i++) { xCoordArray[i] = 0.0f; @@ -163,10 +161,10 @@ FontDemoView::_DrawView(BView* view) } else { view->SetHighColor(0, 0, 0); view->SetDrawingMode(fDrawingMode); - int32 length = UTF8NextCharLen(tmpString); - view->DrawString(tmpString, length, + int32 charLength; + const char* charAt = tmpString.CharAt(i, &charLength); + view->DrawString(charAt, charLength, BPoint(xCoordArray[i], yCoordArray[i])); - tmpString += length; } if (BoundingBoxes() && !OutLineLevel()) { diff --git a/src/apps/fontdemo/Jamfile b/src/apps/fontdemo/Jamfile index a02fa1f33f..616621f2b0 100644 --- a/src/apps/fontdemo/Jamfile +++ b/src/apps/fontdemo/Jamfile @@ -2,8 +2,6 @@ SubDir HAIKU_TOP src apps fontdemo ; SetSubDirSupportedPlatformsBeOSCompatible ; -UsePrivateHeaders interface ; - Application FontDemo : ControlView.cpp FontDemo.cpp From 5cf20610e113bcf3bddddf323fdf348ac283c4be Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sat, 21 Jul 2012 12:58:05 -0400 Subject: [PATCH 04/65] FontDemo: Further cleanup the strlen was used also in _AddShapes. Widen use of BString. Sorry for the noise! --- src/apps/fontdemo/FontDemoView.cpp | 29 ++++++++++++----------------- src/apps/fontdemo/FontDemoView.h | 9 +++++---- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/apps/fontdemo/FontDemoView.cpp b/src/apps/fontdemo/FontDemoView.cpp index 5294eca5ff..af4205ed3d 100644 --- a/src/apps/fontdemo/FontDemoView.cpp +++ b/src/apps/fontdemo/FontDemoView.cpp @@ -30,7 +30,6 @@ FontDemoView::FontDemoView(BRect rect) : BView(rect, "FontDemoView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS), fBitmap(NULL), fBufferView(NULL), - fString(NULL), fFontSize(50.0), fSpacing(0.0), fOutLineLevel(0), @@ -51,7 +50,6 @@ FontDemoView::FontDemoView(BRect rect) FontDemoView::~FontDemoView() { - free(fString); free(fShapes); fBitmap->Lock(); @@ -100,8 +98,7 @@ FontDemoView::_DrawView(BView* view) view->SetFont(&fFont, B_FONT_ALL); - BString tmpString(fString); - const size_t size = tmpString.CountChars(); + const size_t size = fString.CountChars(); BRect boundBoxes[size]; if (OutLineLevel()) @@ -118,8 +115,8 @@ FontDemoView::_DrawView(BView* view) escapeDeltas[j].space = 0.0f; } */ - fFont.GetEdges(fString, size, edgeInfo); - fFont.GetEscapements(fString, size, /*escapeDeltas,*/ escapementArray); + fFont.GetEdges(fString.String(), size, edgeInfo); + fFont.GetEscapements(fString.String(), size, /*escapeDeltas,*/ escapementArray); font_height fh; fFont.GetHeight(&fh); @@ -162,7 +159,7 @@ FontDemoView::_DrawView(BView* view) view->SetHighColor(0, 0, 0); view->SetDrawingMode(fDrawingMode); int32 charLength; - const char* charAt = tmpString.CharAt(i, &charLength); + const char* charAt = fString.CharAt(i, &charLength); view->DrawString(charAt, charLength, BPoint(xCoordArray[i], yCoordArray[i])); } @@ -192,7 +189,7 @@ FontDemoView::MessageReceived(BMessage* msg) switch (msg->what) { case TEXT_CHANGED_MSG: { - const char* text = NULL; + BString text; if (msg->FindString("_text", &text) == B_OK) { SetString(text); Invalidate(/*&fBoxRegion*/); @@ -358,16 +355,15 @@ FontDemoView::MessageReceived(BMessage* msg) void -FontDemoView::SetString(const char* string) +FontDemoView::SetString(BString string) { - free(fString); - fString = strdup(string); + fString = string; free(fShapes); _AddShapes(fString); } -const char* +BString FontDemoView::String() const { return fString; @@ -424,10 +420,10 @@ FontDemoView::SetOutlineLevel(int8 outline) void -FontDemoView::_AddShapes(const char* string) +FontDemoView::_AddShapes(BString string) { - const size_t size = strlen(string); - fShapes = (BShape**)malloc(sizeof(BShape*)*size); + const size_t size = string.CountChars(); + fShapes = (BShape**)malloc(sizeof(BShape*) * size); for (size_t i = 0; i < size; i++) { fShapes[i] = new BShape(); @@ -460,5 +456,4 @@ FontDemoView::_NewBitmap(BRect rect) delete fBitmap; fBitmap = NULL; } -} - +} \ No newline at end of file diff --git a/src/apps/fontdemo/FontDemoView.h b/src/apps/fontdemo/FontDemoView.h index 66d3daca9e..23b1395eff 100644 --- a/src/apps/fontdemo/FontDemoView.h +++ b/src/apps/fontdemo/FontDemoView.h @@ -11,6 +11,7 @@ #include #include +#include class BShape; class BBitmap; @@ -37,8 +38,8 @@ class FontDemoView : public BView { void SetFontRotation(float rotation); const float Rotation() const { return fFont.Rotation(); } - void SetString(const char* string); - const char* String() const; + void SetString(BString string); + BString String() const; void SetAntialiasing(bool state); @@ -49,7 +50,7 @@ class FontDemoView : public BView { const int8 OutLineLevel() const { return fOutLineLevel; } private: - void _AddShapes(const char* string); + void _AddShapes(BString string); void _DrawView(BView* view); BView* _GetView(BRect rect); @@ -58,7 +59,7 @@ class FontDemoView : public BView { BBitmap* fBitmap; BView* fBufferView; - char* fString; + BString fString; float fFontSize; float fSpacing; int8 fOutLineLevel; From 7050e3cd84cbf0bfdbe4aee9406a9c7240de6e5c Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 21 Jul 2012 19:27:06 +0200 Subject: [PATCH 05/65] Fix wrong assignment. CID 702303. --- src/apps/mediaplayer/interface/SubtitleBitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/mediaplayer/interface/SubtitleBitmap.cpp b/src/apps/mediaplayer/interface/SubtitleBitmap.cpp index 4d9af3998d..839af6896d 100644 --- a/src/apps/mediaplayer/interface/SubtitleBitmap.cpp +++ b/src/apps/mediaplayer/interface/SubtitleBitmap.cpp @@ -316,7 +316,7 @@ parse_text(const BString& string, BTextView* textView, const BFont& font, // Cleanup states in case the input text had non-matching tags. while (state->previous != NULL) { - ParseState* oldState = state->previous; + ParseState* oldState = state; state = state->previous; delete oldState; } From 55d6e32c7d1d4e62bfee83d36142ca0953fda0dc Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 21 Jul 2012 17:27:13 -0400 Subject: [PATCH 06/65] Fix name generation for void pointer parameters. --- src/apps/debugger/dwarf/DwarfUtils.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index 233a41ca13..f32816101e 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.cpp +++ b/src/apps/debugger/dwarf/DwarfUtils.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2012, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -102,7 +102,7 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) type)) { DIEType* baseType = type; while ((modifiedType = dynamic_cast( - baseType)) != NULL && modifiedType->GetType() != NULL) { + baseType)) != NULL) { switch (modifiedType->Tag()) { case DW_TAG_pointer_type: modifier.Prepend("*"); @@ -122,7 +122,13 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) type = baseType; } - GetFullyQualifiedDIEName(type, paramName); + // if the parameter has no type associated, + // then it's the unspecified type. + if (type == NULL) + paramName = "void"; + else + GetFullyQualifiedDIEName(type, paramName); + if (modifier.Length() > 0) { if (modifier[modifier.Length() - 1] == ' ') modifier.Truncate(modifier.Length() - 1); From 1236c746afccdcf1ef33244cb1da655f3cf596dd Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sat, 21 Jul 2012 21:56:03 -0400 Subject: [PATCH 07/65] Tracker: a file leaving Trash won't appear in QueryPoseView Fixing #1592. A feedback FSNotification()->EntryMoved->PendingNodeMonitorCache->FSNotification was seemingly introducing some race condition, as it was working 1 time on several tries. --- src/kits/tracker/PoseView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 07bacbb1ac..1bc5078d98 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -5323,6 +5323,7 @@ BPoseView::EntryMoved(const BMessage *message) ReadPoseInfo(pose->TargetModel(), &poseInfo); if (!ShouldShowPose(pose->TargetModel(), &poseInfo)) return DeletePose(&itemNode, pose, index); + return true; } BPoint loc(0, index * fListElemHeight); @@ -5354,7 +5355,6 @@ BPoseView::EntryMoved(const BMessage *message) return DeletePose(&itemNode); else if (dirNode.node == thisDirNode.node) EntryCreated(&dirNode, &itemNode, name); - return true; } From b3b04af940fef90e722a590596527c6cc79920a3 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 22 Jul 2012 11:06:48 -0500 Subject: [PATCH 08/65] usb_serial: Add new Option driver * Option devices are generally WWAN serial devices for 3G or lower. * Picks up my CMOTECH Sprint 3G adaptor, need to wire up endpoints so disabled for now. --- .../kernel/drivers/ports/usb_serial/Jamfile | 1 + .../drivers/ports/usb_serial/Option.cpp | 37 ++++++++++ .../kernel/drivers/ports/usb_serial/Option.h | 68 +++++++++++++++++++ .../drivers/ports/usb_serial/SerialDevice.cpp | 15 ++++ 4 files changed, 121 insertions(+) create mode 100644 src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp create mode 100644 src/add-ons/kernel/drivers/ports/usb_serial/Option.h diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile b/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile index c9521a221f..7fea83c129 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile @@ -14,6 +14,7 @@ KernelAddon usb_serial : ACM.cpp FTDI.cpp KLSI.cpp + Option.cpp Prolific.cpp Silicon.cpp ; diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp new file mode 100644 index 0000000000..2b09e67b6c --- /dev/null +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2011-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com + */ + + +#include "Option.h" + + +OptionDevice::OptionDevice(usb_device device, uint16 vendorID, + uint16 productID, const char *description) + : + ACMDevice(device, vendorID, productID, description) +{ + TRACE_FUNCALLS("> OptionDevice found: %s\n", description); +} + + +status_t +OptionDevice::AddDevice(const usb_configuration_info *config) +{ + TRACE_FUNCALLS("> OptionDevice::AddDevice(%08x, %08x)\n", this, config); + + status_t status = B_OK; + return status; +} + + +status_t +OptionDevice::ResetDevice() +{ + TRACE_FUNCALLS("> OptionDevice::ResetDevice(%08x)\n", this); + return B_OK; +} diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.h b/src/add-ons/kernel/drivers/ports/usb_serial/Option.h new file mode 100644 index 0000000000..31204ed56f --- /dev/null +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.h @@ -0,0 +1,68 @@ +/* + * Copyright 2011-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com + */ +#ifndef _USB_OPTION_H_ +#define _USB_OPTION_H_ + + +#include "ACM.h" + + +/* supported vendor and product ids */ +#define VENDOR_AIRPLUS 0x1011 +#define VENDOR_ALCATEL 0x1bbb +#define VENDOR_ALINK 0x1e0e +#define VENDOR_AMOI 0x1614 +#define VENDOR_ANYDATA 0x16d5 +#define VENDOR_AXESSTEL 0x1726 +#define VENDOR_BANDRICH 0x1A8D +#define VENDOR_BENQ 0x04a5 +#define VENDOR_CELOT 0x211f +#define VENDOR_CMOTECH 0x16d8 +#define VENDOR_DELL 0x413C +#define VENDOR_DLINK 0x1186 +#define VENDOR_HAIER 0x201e +#define VENDOR_HUAWEI 0x12D1 +#define VENDOR_KYOCERA 0x0c88 +#define VENDOR_LG 0x1004 +#define VENDOR_LONGCHEER 0x1c9e +#define VENDOR_MEDIATEK 0x0e8d +#define VENDOR_NOVATEL 0x1410 +#define VENDOR_OLIVETTI 0x0b3c +#define VENDOR_ONDA 0x1ee8 +#define VENDOR_OPTION 0x0AF0 +#define VENDOR_QISDA 0x1da5 +#define VENDOR_QUALCOMM 0x05C6 +#define VENDOR_SAMSUNG 0x04e8 +#define VENDOR_TELIT 0x1bc7 +#define VENDOR_TLAYTECH 0x20B9 +#define VENDOR_TOSHIBA 0x0930 +#define VENDOR_VIETTEL 0x2262 +#define VENDOR_YISO 0x0EAB +#define VENDOR_YUGA 0x257A +#define VENDOR_ZD 0x0685 +#define VENDOR_ZTE 0x19d2 + +const usb_serial_device kOptionDevices[] = { + {VENDOR_CMOTECH, 0x6008, "CMOTECH CDMA Modem"}, + {VENDOR_CMOTECH, 0x5553, "CMOTECH CDU550"}, + {VENDOR_CMOTECH, 0x6512, "CMOTECH CDX650"} +}; + + +class OptionDevice : public ACMDevice { +public: + OptionDevice(usb_device device, + uint16 vendorID, uint16 productID, + const char *description); + + virtual status_t AddDevice(const usb_configuration_info *config); + virtual status_t ResetDevice(); +}; + + +#endif /*_USB_OPTION_H_ */ diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp index 2d8e62e528..9c888789ed 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp @@ -18,6 +18,7 @@ #include "ACM.h" #include "FTDI.h" #include "KLSI.h" +#include "Option.h" #include "Prolific.h" #include "Silicon.h" @@ -759,6 +760,20 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, } } + #if 0 + // Not yet working + + // Option Serial Device + for (uint32 i = 0; i < sizeof(kOptionDevices) + / sizeof(kOptionDevices[0]); i++) { + if (vendorID == kOptionDevices[i].vendorID + && productID == kOptionDevices[i].productID) { + return new(std::nothrow) OptionDevice(device, vendorID, productID, + kOptionDevices[i].deviceName); + } + } + #endif + // Otherwise, return standard ACM device return new(std::nothrow) ACMDevice(device, vendorID, productID, "CDC ACM compatible device"); From 52b7ccf49e8215e58c9c341e013999ee1795848b Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 22 Jul 2012 11:57:25 -0500 Subject: [PATCH 09/65] usb_serial: Probe for USB endpoints on Option device * More then one serial port is common, for now we only work off of the first one detected. * Still disabled as some setup is needed. --- .../drivers/ports/usb_serial/Option.cpp | 54 ++++++++++++++++++- .../drivers/ports/usb_serial/SerialDevice.cpp | 10 ++-- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp index 2b09e67b6c..8c0de2a0f7 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp @@ -24,8 +24,58 @@ OptionDevice::AddDevice(const usb_configuration_info *config) { TRACE_FUNCALLS("> OptionDevice::AddDevice(%08x, %08x)\n", this, config); - status_t status = B_OK; - return status; + if (config->interface_count > 0) { + for (size_t index = 0; index < config->interface_count; index++) { + usb_interface_info *interface = config->interface[index].active; + + int txEndpointID = -1; + int rxEndpointID = -1; + int irEndpointID = -1; + + for (size_t i = 0; i < interface->endpoint_count; i++) { + usb_endpoint_info *endpoint = &interface->endpoint[i]; + + // Find our Interrupt endpoint + if (endpoint->descr->attributes == USB_ENDPOINT_ATTR_INTERRUPT + && (endpoint->descr->endpoint_address + & USB_ENDPOINT_ADDR_DIR_IN) != 0) { + irEndpointID = i; + continue; + } + + // Find our Transmit / Receive endpoints + if (endpoint->descr->attributes == USB_ENDPOINT_ATTR_BULK) { + if ((endpoint->descr->endpoint_address + & USB_ENDPOINT_ADDR_DIR_IN) != 0) { + rxEndpointID = i; + } else { + txEndpointID = i; + } + continue; + } + } + + TRACE("> OptionDevice::%s: endpoint %d, tx: %d, rx: %d, ir: %d\n", + __func__, index, txEndpointID, rxEndpointID, irEndpointID); + + if (txEndpointID < 0 || rxEndpointID < 0 || irEndpointID < 0) + continue; + + TRACE("> OptionDevice::%s: found at interface %d\n", __func__, + index); + usb_endpoint_info *irEndpoint = &interface->endpoint[irEndpointID]; + usb_endpoint_info *txEndpoint = &interface->endpoint[irEndpointID]; + usb_endpoint_info *rxEndpoint = &interface->endpoint[irEndpointID]; + SetControlPipe(irEndpoint->handle); + SetReadPipe(rxEndpoint->handle); + SetWritePipe(txEndpoint->handle); + + // We accept the first found serial interface + // TODO: We should set each matching interface up (can be > 1) + return B_OK; + } + } + return ENODEV; } diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp index 9c888789ed..e3d1694195 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp @@ -725,7 +725,7 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, / sizeof(kFTDIDevices[0]); i++) { if (vendorID == kFTDIDevices[i].vendorID && productID == kFTDIDevices[i].productID) { - return new(std::nothrow) FTDIDevice(device, vendorID, productID, + return new(std::nothrow) FTDIDevice(device, vendorID, productID, kFTDIDevices[i].deviceName); } } @@ -735,7 +735,7 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, / sizeof(kKLSIDevices[0]); i++) { if (vendorID == kKLSIDevices[i].vendorID && productID == kKLSIDevices[i].productID) { - return new(std::nothrow) KLSIDevice(device, vendorID, productID, + return new(std::nothrow) KLSIDevice(device, vendorID, productID, kKLSIDevices[i].deviceName); } } @@ -745,7 +745,7 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, / sizeof(kProlificDevices[0]); i++) { if (vendorID == kProlificDevices[i].vendorID && productID == kProlificDevices[i].productID) { - return new(std::nothrow) ProlificDevice(device, vendorID, productID, + return new(std::nothrow) ProlificDevice(device, vendorID, productID, kProlificDevices[i].deviceName); } } @@ -755,7 +755,7 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, / sizeof(kSiliconDevices[0]); i++) { if (vendorID == kSiliconDevices[i].vendorID && productID == kSiliconDevices[i].productID) { - return new(std::nothrow) SiliconDevice(device, vendorID, productID, + return new(std::nothrow) SiliconDevice(device, vendorID, productID, kSiliconDevices[i].deviceName); } } @@ -768,7 +768,7 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, / sizeof(kOptionDevices[0]); i++) { if (vendorID == kOptionDevices[i].vendorID && productID == kOptionDevices[i].productID) { - return new(std::nothrow) OptionDevice(device, vendorID, productID, + return new(std::nothrow) OptionDevice(device, vendorID, productID, kOptionDevices[i].deviceName); } } From 8899214980d031c69441a29c5c122e3fd592d0b7 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 22 Jul 2012 12:06:27 -0500 Subject: [PATCH 10/65] usb_serial: Fix typo, set up endpoints properly * Can successfully send data to Option USB serial device now (I need to do some testing before turning it on though) --- src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp index 8c0de2a0f7..d82812d6dd 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp @@ -64,8 +64,8 @@ OptionDevice::AddDevice(const usb_configuration_info *config) TRACE("> OptionDevice::%s: found at interface %d\n", __func__, index); usb_endpoint_info *irEndpoint = &interface->endpoint[irEndpointID]; - usb_endpoint_info *txEndpoint = &interface->endpoint[irEndpointID]; - usb_endpoint_info *rxEndpoint = &interface->endpoint[irEndpointID]; + usb_endpoint_info *txEndpoint = &interface->endpoint[txEndpointID]; + usb_endpoint_info *rxEndpoint = &interface->endpoint[rxEndpointID]; SetControlPipe(irEndpoint->handle); SetReadPipe(rxEndpoint->handle); SetWritePipe(txEndpoint->handle); From 7e67ec90a46ec4202ab7e4f7b0e07cf398200f45 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 22 Jul 2012 13:48:57 -0500 Subject: [PATCH 11/65] usb_serial: Set option driver to use the last found port. * Add a warning when >1 port is found (as we only use the last found serial port) * Verified working, remove if 0. --- .../kernel/drivers/ports/usb_serial/Option.cpp | 16 +++++++++++++--- .../drivers/ports/usb_serial/SerialDevice.cpp | 4 ---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp index d82812d6dd..2041d8fe24 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp @@ -24,6 +24,7 @@ OptionDevice::AddDevice(const usb_configuration_info *config) { TRACE_FUNCALLS("> OptionDevice::AddDevice(%08x, %08x)\n", this, config); + int portsFound = 0; if (config->interface_count > 0) { for (size_t index = 0; index < config->interface_count; index++) { usb_interface_info *interface = config->interface[index].active; @@ -61,17 +62,26 @@ OptionDevice::AddDevice(const usb_configuration_info *config) if (txEndpointID < 0 || rxEndpointID < 0 || irEndpointID < 0) continue; - TRACE("> OptionDevice::%s: found at interface %d\n", __func__, + TRACE("> OptionDevice::%s: found port at interface %d\n", __func__, index); + portsFound++; + usb_endpoint_info *irEndpoint = &interface->endpoint[irEndpointID]; usb_endpoint_info *txEndpoint = &interface->endpoint[txEndpointID]; usb_endpoint_info *rxEndpoint = &interface->endpoint[rxEndpointID]; SetControlPipe(irEndpoint->handle); SetReadPipe(rxEndpoint->handle); SetWritePipe(txEndpoint->handle); + } - // We accept the first found serial interface - // TODO: We should set each matching interface up (can be > 1) + // TODO: We need to handle multiple ports + // We use the last found serial port for now + if (portsFound > 0) { + if (portsFound > 1) { + TRACE_ALWAYS("> OptionDevice::%s: Warning: Found more than one " + "serial port on this device (%d). Only the last one is " + "is used.\n", __func__, portsFound); + } return B_OK; } } diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp index e3d1694195..e8bb192c35 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp @@ -760,9 +760,6 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, } } - #if 0 - // Not yet working - // Option Serial Device for (uint32 i = 0; i < sizeof(kOptionDevices) / sizeof(kOptionDevices[0]); i++) { @@ -772,7 +769,6 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID, kOptionDevices[i].deviceName); } } - #endif // Otherwise, return standard ACM device return new(std::nothrow) ACMDevice(device, vendorID, productID, From d7ed9414a3260efaed0fa9de5dde9bb8c0bc11ef Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 22 Jul 2012 15:53:19 -0400 Subject: [PATCH 12/65] Fix #8523. - When the message filter would receive and process a mouse moved message, if the message resulted in causing the deskbar to relocate or reorient itself, it was possible for the expando view to become detached from the looper. Consequently, if the intercepted mouse moved happened to have come from the latter, when returning out of the filter the view would no longer have a target looper, triggering a debugger condition in BLooper. In order to prevent this situation, we now dispatch a message asking for the layout change to occur asynchronously. --- src/apps/deskbar/BarView.cpp | 75 ++++++++++++++++++++++++--------- src/apps/deskbar/BarView.h | 5 ++- src/apps/deskbar/StatusView.cpp | 2 +- 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 8fb1715936..44248e06d0 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -69,6 +69,8 @@ const int32 kDefaultRecentAppCount = 10; const int32 kMenuTrackMargin = 20; +const uint32 kUpdateOrientation = 'UpOr'; + class BarViewMessageFilter : public BMessageFilter { @@ -102,7 +104,7 @@ BarViewMessageFilter::Filter(BMessage* message, BHandler** target) if (message->what == B_MOUSE_DOWN || message->what == B_MOUSE_MOVED) { BPoint where = message->FindPoint("be:view_where"); uint32 transit = message->FindInt32("be:transit"); - BMessage *dragMessage = NULL; + BMessage* dragMessage = NULL; if (message->HasMessage("be:drag_message")) { dragMessage = new BMessage(); message->FindMessage("be:drag_message", dragMessage); @@ -140,7 +142,8 @@ TBarView::TBarView(BRect frame, bool vertical, bool left, bool top, fCachedTypesList(NULL), fMaxRecentDocs(kDefaultRecentDocCount), fMaxRecentApps(kDefaultRecentAppCount), - fLastDragItem(NULL) + fLastDragItem(NULL), + fMouseFilter(NULL) { fReplicantTray = new TReplicantTray(this, fVertical); fDragRegion = new TDragRegion(this, fReplicantTray); @@ -167,7 +170,8 @@ TBarView::AttachedToWindow() SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); SetFont(be_plain_font); - Window()->AddCommonFilter(new BarViewMessageFilter(this)); + fMouseFilter = new BarViewMessageFilter(this); + Window()->AddCommonFilter(fMouseFilter); UpdatePlacement(); @@ -180,6 +184,9 @@ TBarView::AttachedToWindow() void TBarView::DetachedFromWindow() { + Window()->RemoveCommonFilter(fMouseFilter); + delete fMouseFilter; + fMouseFilter = NULL; delete fTrackingHookData.fDragMessage; fTrackingHookData.fDragMessage = NULL; } @@ -232,6 +239,12 @@ TBarView::MessageReceived(BMessage* message) break; } + case kUpdateOrientation: + { + _ChangeState(message); + break; + } + default: BView::MessageReceived(message); } @@ -588,25 +601,19 @@ TBarView::UpdatePlacement() void -TBarView::ChangeState(int32 state, bool vertical, bool left, bool top) +TBarView::ChangeState(int32 state, bool vertical, bool left, bool top, + bool async) { - bool vertSwap = (fVertical != vertical); - bool leftSwap = (fLeft != left); - bool stateChanged = (fState != state); + BMessage message(kUpdateOrientation); + message.AddInt32("state", state); + message.AddBool("vertical", vertical); + message.AddBool("left", left); + message.AddBool("top", top); - fState = state; - fVertical = vertical; - fLeft = left; - fTop = top; - - // Send a message to the preferences window to let it know to enable - // or disable preference items - if (stateChanged || vertSwap) - be_app->PostMessage(kStateChanged); - - PlaceDeskbarMenu(); - PlaceTray(vertSwap, leftSwap); - PlaceApplicationBar(); + if (async) + BMessenger(this).SendMessage(&message); + else + _ChangeState(&message); } @@ -677,6 +684,34 @@ TBarView::ExpandItems() } +void +TBarView::_ChangeState(BMessage* message) +{ + int32 state = message->FindInt32("state"); + bool vertical = message->FindBool("vertical"); + bool left = message->FindBool("left"); + bool top = message->FindBool("top"); + + bool vertSwap = (fVertical != vertical); + bool leftSwap = (fLeft != left); + bool stateChanged = (fState != state); + + fState = state; + fVertical = vertical; + fLeft = left; + fTop = top; + + // Send a message to the preferences window to let it know to enable + // or disable preference items + if (stateChanged || vertSwap) + be_app->PostMessage(kStateChanged); + + PlaceDeskbarMenu(); + PlaceTray(vertSwap, leftSwap); + PlaceApplicationBar(); +} + + void TBarView::AddExpandedItem(const char* signature) { diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h index 293bed7ea5..f375c872d4 100644 --- a/src/apps/deskbar/BarView.h +++ b/src/apps/deskbar/BarView.h @@ -90,7 +90,8 @@ class TBarView : public BView { void SaveSettings(); void UpdatePlacement(); - void ChangeState(int32 state, bool vertical, bool left, bool top); + void ChangeState(int32 state, bool vertical, bool left, bool top, + bool aSync = false); void RaiseDeskbar(bool raise); void HideDeskbar(bool hide); @@ -165,6 +166,7 @@ class TBarView : public BView { void SaveExpandedItems(); void RemoveExpandedItems(); void ExpandItems(); + void _ChangeState(BMessage* message); TBarMenuBar* fBarMenuBar; TExpandoMenuBar* fExpando; @@ -190,6 +192,7 @@ class TBarView : public BView { TTeamMenuItem* fLastDragItem; BList fExpandedItems; + BMessageFilter* fMouseFilter; }; diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index e32b769839..4b2df60065 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -1483,7 +1483,7 @@ TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect, return true; } - fBarView->ChangeState(newState, newVertical, newLeft, newTop); + fBarView->ChangeState(newState, newVertical, newLeft, newTop, true); return true; } From 47a394ec139b7defdd57aeea2587f435716aa172 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 22 Jul 2012 13:22:48 -0400 Subject: [PATCH 13/65] Replace calls to DragRegion() with fDragRegion avoiding a function call. Move variables in MouseMoved down to just before they are used. --- src/apps/deskbar/BarView.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 44248e06d0..c2a9e26141 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -254,19 +254,19 @@ TBarView::MessageReceived(BMessage* message) void TBarView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage) { - desk_settings* settings = ((TBarApp*)be_app)->Settings(); - bool alwaysOnTop = settings->alwaysOnTop; - bool autoRaise = settings->autoRaise; - bool autoHide = settings->autoHide; - - if (DragRegion()->IsDragging()) { - DragRegion()->MouseMoved(where, transit, dragMessage); + if (fDragRegion->IsDragging()) { + fDragRegion->MouseMoved(where, transit, dragMessage); return; } if (transit == B_ENTERED_VIEW && EventMask() == 0) SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); + desk_settings* settings = ((TBarApp*)be_app)->Settings(); + bool alwaysOnTop = settings->alwaysOnTop; + bool autoRaise = settings->autoRaise; + bool autoHide = settings->autoHide; + if (!autoRaise && !autoHide) { if (transit == B_EXITED_VIEW || transit == B_OUTSIDE_VIEW) SetEventMask(0); @@ -324,8 +324,7 @@ TBarView::MouseDown(BPoint where) if ((modifiers() & (B_CONTROL_KEY | B_COMMAND_KEY | B_OPTION_KEY | B_SHIFT_KEY)) == (B_CONTROL_KEY | B_COMMAND_KEY)) { // The window key was pressed - enter dragging code - DragRegion()->MouseDown( - DragRegion()->DragRegion().LeftTop()); + fDragRegion->MouseDown(fDragRegion->DragRegion().LeftTop()); return; } } else { @@ -504,7 +503,7 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width, float* height) float windowHeight = 0; float windowWidth = sMinimumWindowWidth; bool setToHiddenSize = ((TBarApp*)be_app)->Settings()->autoHide - && IsHidden() && !DragRegion()->IsDragging(); + && IsHidden() && !fDragRegion->IsDragging(); int32 iconSize = static_cast(be_app)->IconSize(); if (setToHiddenSize) { From 8f29b6e639c5fb96e5f5ccd3f197ad94fee6ce15 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 22 Jul 2012 13:53:06 -0400 Subject: [PATCH 14/65] indent break statements. Only delete dragMessage if not NULL. --- src/apps/deskbar/BarView.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index c2a9e26141..4e913035bb 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -113,14 +113,15 @@ BarViewMessageFilter::Filter(BMessage* message, BHandler** target) switch (message->what) { case B_MOUSE_DOWN: fBarView->MouseDown(where); - break; + break; case B_MOUSE_MOVED: fBarView->MouseMoved(where, transit, dragMessage); - break; + break; } - delete dragMessage; + if (message->HasMessage("be:drag_message")) + delete dragMessage; } return B_DISPATCH_MESSAGE; From 8cf6d28f996f132095d5f61c0b5622168c39ae91 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sun, 22 Jul 2012 15:58:31 -0400 Subject: [PATCH 15/65] It is okay to delete dragMessage even if it is NULL. Not worth the branch. --- src/apps/deskbar/BarView.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 4e913035bb..0bc16d2f6f 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -120,8 +120,7 @@ BarViewMessageFilter::Filter(BMessage* message, BHandler** target) break; } - if (message->HasMessage("be:drag_message")) - delete dragMessage; + delete dragMessage; } return B_DISPATCH_MESSAGE; From 674ff0df2f2eb00cbc78b4384fcf5b148a2139ff Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sun, 22 Jul 2012 22:04:28 -0400 Subject: [PATCH 16/65] Tracker: Various sorting issues in Tracker When sorting files by Modified dates, right clicking on a file was leading to a sorting issue where files were changing positions (without reason). 1. Any changes to stats (size, modification, creation, mode) was triggering the sorting. Now only stats fields currently used as a Sort criteria will trigger such event. 2. The Mimeset of file was set (in case of unknown file format) once per checked add-on when building AddOn Menu. Now it's checked once per file in selection. (so, once per file, rather then once per file, per add-on). 3. Now rely on registrar to force the mimeset (to trigger the sniffer in case the attribute already exist) rather than trying to duplicate the feature in Tracker. 4. When Sorting, if there is a old position known, check if it's working by looking if you should come after the previous item, and before the following item. Previously, the item would be pushed at the top if the group of item all fitting the criteria (same file size, same file kind, etc.. depending on the sorting criteria). Fixes #8478. --- src/kits/tracker/ContainerWindow.cpp | 32 +++++++++--- src/kits/tracker/ContainerWindow.h | 2 + src/kits/tracker/Model.cpp | 11 +---- src/kits/tracker/PoseView.cpp | 74 ++++++++++++++++++++++------ src/kits/tracker/PoseView.h | 3 +- 5 files changed, 92 insertions(+), 30 deletions(-) diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index bcbb092d4f..b48b683e77 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -318,12 +318,7 @@ static void AddMimeTypeString(BObjectList &list, Model *model) { BString *mimeType = new BString(model->MimeType()); - if (!mimeType->Length() || !mimeType->ICompare(B_FILE_MIMETYPE)) { - // if model is of unknown type, try mimeseting it first - model->Mimeset(true); - mimeType->SetTo(model->MimeType()); - } - + if (mimeType->Length()) { // only add the type if it's not already there for (int32 i = list.CountItems(); i-- > 0;) { @@ -2975,6 +2970,8 @@ BContainerWindow::BuildAddOnMenu(BMenu *menu) break; delete item; } + + _UpdateSelectionMIMEInfo(); BObjectList primaryList; BObjectList secondaryList; @@ -3141,6 +3138,29 @@ BContainerWindow::LoadAddOn(BMessage *message) } +void +BContainerWindow::_UpdateSelectionMIMEInfo() +{ + BPose* pose; + int32 index = 0; + while ((pose = PoseView()->SelectionList()->ItemAt(index++)) != NULL) { + BString mimeType(pose->TargetModel()->MimeType()); + if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0) { + pose->TargetModel()->Mimeset(true); + if (pose->TargetModel()->IsSymLink()) { + Model* resolved = new Model(pose->TargetModel()->EntryRef(), true, true); + if (resolved->InitCheck() == B_OK) { + mimeType.SetTo(resolved->MimeType()); + if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0) + resolved->Mimeset(true); + } + delete resolved; + } + } + } +} + + BMenuItem * BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, int32 type, float width, int32 align, bool editable, bool statField) diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index 5bee938731..373b81a7a1 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -303,6 +303,8 @@ class BContainerWindow : public BWindow { friend int32 show_context_menu(void*); friend class BackgroundView; + + void _UpdateSelectionMIMEInfo(); }; class WindowStateNodeOpener { diff --git a/src/kits/tracker/Model.cpp b/src/kits/tracker/Model.cpp index 392b8e4d08..7f5ea56b7f 100644 --- a/src/kits/tracker/Model.cpp +++ b/src/kits/tracker/Model.cpp @@ -1178,18 +1178,11 @@ bool Model::Mimeset(bool force) { BString oldType = MimeType(); - ModelNodeLazyOpener opener(this); BPath path; GetPath(&path); - if (force) { - if (opener.OpenNode(true) != B_OK) - return false; - - Node()->RemoveAttr(kAttrMIMEType); - update_mime_info(path.Path(), 0, 1, 1); - } else - update_mime_info(path.Path(), 0, 1, 0); + update_mime_info(path.Path(), 0, 1, force ? 2 : 0); + AttrChanged(0); return !oldType.ICompare(MimeType()); diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 1bc5078d98..0a69b0eaf2 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -1674,7 +1674,7 @@ BPoseView::AddPoseToList(PoseList *list, bool visibleList, bool insertionSort, bool needToDraw = true; if (insertionSort && list->CountItems()) { - int32 orientation = BSearchList(list, pose, &poseIndex); + int32 orientation = BSearchList(list, pose, &poseIndex, 0); if (orientation == kInsertAfter) poseIndex++; @@ -5359,6 +5359,12 @@ BPoseView::EntryMoved(const BMessage *message) } +struct attrColumnRelation { + uint32 attrHash; + int32 fieldMask; +}; + + bool BPoseView::AttributeChanged(const BMessage *message) { @@ -5430,7 +5436,6 @@ BPoseView::AttributeChanged(const BMessage *message) return false; } - uint32 attrHash; if (attrName) { // rebuild the MIME type list, if the MIME type has changed if (strcmp(attrName, kAttrMIMEType) == 0) @@ -5438,14 +5443,41 @@ BPoseView::AttributeChanged(const BMessage *message) // note: the following code is wrong, because this sort of hashing // may overlap and we get aliasing - attrHash = AttrHashString(attrName, info.type); - } + uint32 attrHash = AttrHashString(attrName, info.type); + if (attrHash == PrimarySort() || attrHash == SecondarySort()) { + _CheckPoseSortOrder(fPoseList, pose, poseListIndex); + if (fFiltering && visible) + _CheckPoseSortOrder(fFilteredPoseList, pose, index); + } + } else { + int32 fields; + if (message->FindInt32("fields", &fields) != B_OK) + return true; - if (!attrName || attrHash == PrimarySort() - || attrHash == SecondarySort()) { - _CheckPoseSortOrder(fPoseList, pose, poseListIndex); - if (fFiltering && visible) - _CheckPoseSortOrder(fFilteredPoseList, pose, index); + static struct attrColumnRelation attributs[] = { + { AttrHashString(kAttrStatModified, B_TIME_TYPE), + B_STAT_MODIFICATION_TIME }, + { AttrHashString(kAttrStatSize, B_OFF_T_TYPE), + B_STAT_SIZE }, + { AttrHashString(kAttrStatCreated, B_TIME_TYPE), + B_STAT_CREATION_TIME }, + { AttrHashString(kAttrStatMode, B_STRING_TYPE), + B_STAT_MODE } + }; + + for (int32 i = sizeof(attributs) / sizeof(attrColumnRelation); + i--;) { + if (attributs[i].attrHash == PrimarySort() + || attributs[i].attrHash == SecondarySort()) { + + if (fields & attributs[i].fieldMask) { + _CheckPoseSortOrder(fPoseList, pose, poseListIndex); + if (fFiltering && visible) + _CheckPoseSortOrder(fFilteredPoseList, pose, index); + return true; + } + } + } } } else { // we received an attr changed notification for a zombie model, it means @@ -8667,7 +8699,7 @@ BPoseView::_CheckPoseSortOrder(PoseList *poseList, BPose *pose, int32 oldIndex) // take pose out of list for BSearch poseList->RemoveItemAt(oldIndex); int32 afterIndex; - int32 orientation = BSearchList(poseList, pose, &afterIndex); + int32 orientation = BSearchList(poseList, pose, &afterIndex, oldIndex); int32 newIndex; if (orientation == kInsertAtFront) @@ -8777,19 +8809,33 @@ BSearch(PoseList *table, const BPose* key, BPoseView *view, int32 BPoseView::BSearchList(PoseList *poseList, const BPose *pose, - int32 *resultingIndex) + int32 *resultingIndex, int32 oldIndex) { // check to see if insertion should be at beginning of list const BPose *firstPose = poseList->FirstItem(); if (!firstPose) - return kInsertAtFront; - - if (PoseCompareAddWidget(pose, firstPose, this) <= 0) { + return kInsertAtFront; + + if (PoseCompareAddWidget(pose, firstPose, this) < 0) { *resultingIndex = 0; return kInsertAtFront; } int32 count = poseList->CountItems(); + + // look if old position is still ok, by comparing to siblings + bool valid = oldIndex > 0 && oldIndex < count - 1; + valid = valid && PoseCompareAddWidget(pose, + poseList->ItemAt(oldIndex - 1), this) >= 0; + // the current item is gone, so not oldIndex+1 + valid = valid && PoseCompareAddWidget(pose, + poseList->ItemAt(oldIndex), this) <= 0; + + if (valid) { + *resultingIndex = oldIndex - 1; + return kInsertAfter; + } + *resultingIndex = count - 1; const BPose *searchResult = BSearch(poseList, pose, this, diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index 65a7f6a802..ce6fd0b728 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -520,7 +520,8 @@ class BPoseView : public BView { void DrawViewCommon(const BRect &updateRect); // pose list handling - int32 BSearchList(PoseList *poseList, const BPose *, int32 *index); + int32 BSearchList(PoseList *poseList, const BPose *, int32 *index, + int32 oldIndex); void InsertPoseAfter(BPose *pose, int32 *index, int32 orientation, BRect *invalidRect); // does a CopyBits to scroll poses making room for a new pose, From 516cac7817d0b2f54e8b59acfff5cf803ef7d2ab Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 08:21:43 -0400 Subject: [PATCH 17/65] Tracker: Coding style violations fixes and typos No functional changes, thanks Axel! --- src/kits/tracker/PoseView.cpp | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 0a69b0eaf2..592c04b0d0 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -149,6 +149,24 @@ const BPoint kTransparentDragThreshold(256, 192); // if larger in any direction +struct attr_column_relation { + uint32 attrHash; + int32 fieldMask; +}; + + +static struct attr_column_relation attributes[] = { + { AttrHashString(kAttrStatModified, B_TIME_TYPE), + B_STAT_MODIFICATION_TIME }, + { AttrHashString(kAttrStatSize, B_OFF_T_TYPE), + B_STAT_SIZE }, + { AttrHashString(kAttrStatCreated, B_TIME_TYPE), + B_STAT_CREATION_TIME }, + { AttrHashString(kAttrStatMode, B_STRING_TYPE), + B_STAT_MODE } +}; + + struct AddPosesResult { ~AddPosesResult(); void ReleaseModels(); @@ -5359,12 +5377,6 @@ BPoseView::EntryMoved(const BMessage *message) } -struct attrColumnRelation { - uint32 attrHash; - int32 fieldMask; -}; - - bool BPoseView::AttributeChanged(const BMessage *message) { @@ -5454,23 +5466,11 @@ BPoseView::AttributeChanged(const BMessage *message) if (message->FindInt32("fields", &fields) != B_OK) return true; - static struct attrColumnRelation attributs[] = { - { AttrHashString(kAttrStatModified, B_TIME_TYPE), - B_STAT_MODIFICATION_TIME }, - { AttrHashString(kAttrStatSize, B_OFF_T_TYPE), - B_STAT_SIZE }, - { AttrHashString(kAttrStatCreated, B_TIME_TYPE), - B_STAT_CREATION_TIME }, - { AttrHashString(kAttrStatMode, B_STRING_TYPE), - B_STAT_MODE } - }; - - for (int32 i = sizeof(attributs) / sizeof(attrColumnRelation); + for (int32 i = sizeof(attributes) / sizeof(attr_column_relation); i--;) { - if (attributs[i].attrHash == PrimarySort() - || attributs[i].attrHash == SecondarySort()) { - - if (fields & attributs[i].fieldMask) { + if (attributes[i].attrHash == PrimarySort() + || attributes[i].attrHash == SecondarySort()) { + if ((fields & attributes[i].fieldMask) != 0) { _CheckPoseSortOrder(fPoseList, pose, poseListIndex); if (fFiltering && visible) _CheckPoseSortOrder(fFilteredPoseList, pose, index); From b6a70ecba9f72f2350e95e8060ecf72b45183448 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 10:16:37 -0400 Subject: [PATCH 18/65] ProcessController: fix display of CPU bars for systems having 3 cores Generalize the drawing of separator lines for every number of cores requesting them. Fix the layout for 3 cores systems. Should fix #8763. --- src/apps/processcontroller/ProcessController.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index d70c7361a0..1a5d5d20cc 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -124,7 +124,7 @@ layoutT layout[] = { { 1, 1, 1 }, { 5, 1, 5 }, // 1 { 3, 1, 4 }, // 2 - { 1, 1, 1 }, + { 2, 1, 3 }, { 2, 0, 3 }, // 4 { 1, 1, 1 }, { 1, 1, 1 }, @@ -542,16 +542,17 @@ ProcessController::DoDraw(bool force) float right = left + gCPUcount * (barWidth + layout[gCPUcount].cpu_inter) - layout[gCPUcount].cpu_inter; // right of CPU frame... if (force && Parent()) { - SetHighColor(Parent()->ViewColor ()); + SetHighColor(Parent()->ViewColor()); FillRect(BRect(right + 1, top - 1, right + 2, bottom + 1)); } if (force) { SetHighColor(frame_color); StrokeRect(BRect(left - 1, top - 1, right, bottom + 1)); - if (gCPUcount == 2) { - StrokeLine(BPoint(left + barWidth, top), BPoint(left + barWidth, - bottom)); + if (gCPUcount > 1 && layout[gCPUcount].cpu_inter == 1) { + for (int x = 1; x < gCPUcount; x++) + StrokeLine(BPoint(left + x * barWidth + x - 1, top), + BPoint(left + x * barWidth + x - 1, bottom)); } } float leftMem = bounds.Width() - layout[gCPUcount].mem_width; @@ -592,9 +593,9 @@ ProcessController::DoDraw(bool force) fLastBarHeight[x] = barHeight; } - float rightMem = bounds.Width () - 1; + float rightMem = bounds.Width() - 1; float rem = fMemoryUsage * (h + 1); - float barHeight = floorf (rem); + float barHeight = floorf(rem); rem -= barHeight; rgb_color used_memory_color; From 5cdd07a8148b04cd1b7e29778ec0661df7dbe46d Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 14:47:24 -0400 Subject: [PATCH 19/65] Tracker: Optimisation of AddonMenu menu construction 1. Build the list of mimetypes of files in selection only once and reuse it for all further tests. 2. Fix a regression introduced in hrev44384 where the MimeType() wouldn't get recognized when just changed by tracker (by that same right click). It would be on subsequent clicks. 3. Rename the static map variable to better fit our coding style and be more understandable. --- src/kits/tracker/ContainerWindow.cpp | 64 +++++++++++++++------------- src/kits/tracker/Model.cpp | 2 + src/kits/tracker/PoseView.cpp | 10 ++--- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index b48b683e77..e5b044bc8d 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -130,6 +130,7 @@ class DraggableContainerIcon : public BView { struct AddOneAddonParams { BObjectList *primaryList; BObjectList *secondaryList; + BObjectList *mimeTypes; }; struct StaggerOneParams { @@ -2838,34 +2839,12 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, BDirectory dir; BEntry entry; + + BObjectList *mimeTypes = ((AddOneAddonParams *)params)->mimeTypes; if (dir.SetTo(path.Path()) != B_OK) return false; - // build a list of the MIME types of the selected items - - BObjectList mimeTypes(10, true); - - int32 count = PoseView()->SelectionList()->CountItems(); - if (!count) { - // just add the type of the current directory - AddMimeTypeString(mimeTypes, TargetModel()); - } else { - for (int32 index = 0; index < count; index++) { - BPose *pose = PoseView()->SelectionList()->ItemAt(index); - AddMimeTypeString(mimeTypes, pose->TargetModel()); - // If it's a symlink, resolves it and add the Target's MimeType - if (pose->TargetModel()->IsSymLink()) { - Model* resolved = new Model( - pose->TargetModel()->EntryRef(), true, true); - if (resolved->InitCheck() == B_OK) { - AddMimeTypeString(mimeTypes, resolved); - } - delete resolved; - } - } - } - dir.Rewind(); while (dir.GetNextEntry(&entry) == B_OK) { Model *model = new Model(&entry); @@ -2887,7 +2866,7 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, bool primary = false; - if (mimeTypes.CountItems()) { + if (mimeTypes->CountItems()) { BFile file(&entry, B_READ_ONLY); if (file.InitCheck() == B_OK) { BAppFileInfo info(&file); @@ -2905,8 +2884,8 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, // check all supported types if it has some set if (!secondary) { - for (int32 i = mimeTypes.CountItems(); !primary && i-- > 0;) { - BString *type = mimeTypes.ItemAt(i); + for (int32 i = mimeTypes->CountItems(); !primary && i-- > 0;) { + BString *type = mimeTypes->ItemAt(i); if (info.IsSupportedType(type->String())) { BMimeType mimeType(type->String()); if (info.Supports(&mimeType)) @@ -2970,8 +2949,6 @@ BContainerWindow::BuildAddOnMenu(BMenu *menu) break; delete item; } - - _UpdateSelectionMIMEInfo(); BObjectList primaryList; BObjectList secondaryList; @@ -2980,12 +2957,39 @@ BContainerWindow::BuildAddOnMenu(BMenu *menu) params.primaryList = &primaryList; params.secondaryList = &secondaryList; + // build a list of the MIME types of the selected items + BObjectList mimeTypes(10, true); + + int32 count = PoseView()->SelectionList()->CountItems(); + if (!count) { + // just add the type of the current directory + AddMimeTypeString(mimeTypes, TargetModel()); + } else { + _UpdateSelectionMIMEInfo(); + for (int32 index = 0; index < count; index++) { + BPose *pose = PoseView()->SelectionList()->ItemAt(index); + + AddMimeTypeString(mimeTypes, pose->TargetModel()); + // If it's a symlink, resolves it and add the Target's MimeType + if (pose->TargetModel()->IsSymLink()) { + Model* resolved = new Model( + pose->TargetModel()->EntryRef(), true, true); + if (resolved->InitCheck() == B_OK) { + AddMimeTypeString(mimeTypes, resolved); + } + delete resolved; + } + } + } + + params.mimeTypes = &mimeTypes; + EachAddon(AddOneAddon, ¶ms); primaryList.SortItems(CompareLabels); secondaryList.SortItems(CompareLabels); - int32 count = primaryList.CountItems(); + count = primaryList.CountItems(); for (int32 index = 0; index < count; index++) menu->AddItem(primaryList.ItemAt(index)); diff --git a/src/kits/tracker/Model.cpp b/src/kits/tracker/Model.cpp index 7f5ea56b7f..dcf5e3e889 100644 --- a/src/kits/tracker/Model.cpp +++ b/src/kits/tracker/Model.cpp @@ -883,6 +883,8 @@ Model::AttrChanged(const char *attrName) if (!attrName || strcmp(attrName, kAttrMIMEType) == 0 || strcmp(attrName, kAttrPreferredApp) == 0) { + ModelNodeLazyOpener opener(this); + opener.OpenNode(); char mimeString[B_MIME_TYPE_LENGTH]; BNodeInfo info(fNode); if (info.GetType(mimeString) != B_OK) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 592c04b0d0..fba21fe3db 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -155,7 +155,7 @@ struct attr_column_relation { }; -static struct attr_column_relation attributes[] = { +static struct attr_column_relation sAttrColumnMap[] = { { AttrHashString(kAttrStatModified, B_TIME_TYPE), B_STAT_MODIFICATION_TIME }, { AttrHashString(kAttrStatSize, B_OFF_T_TYPE), @@ -5466,11 +5466,11 @@ BPoseView::AttributeChanged(const BMessage *message) if (message->FindInt32("fields", &fields) != B_OK) return true; - for (int32 i = sizeof(attributes) / sizeof(attr_column_relation); + for (int i = sizeof(sAttrColumnMap) / sizeof(attr_column_relation); i--;) { - if (attributes[i].attrHash == PrimarySort() - || attributes[i].attrHash == SecondarySort()) { - if ((fields & attributes[i].fieldMask) != 0) { + if (sAttrColumnMap[i].attrHash == PrimarySort() + || sAttrColumnMap[i].attrHash == SecondarySort()) { + if ((fields & sAttrColumnMap[i].fieldMask) != 0) { _CheckPoseSortOrder(fPoseList, pose, poseListIndex); if (fFiltering && visible) _CheckPoseSortOrder(fFilteredPoseList, pose, index); From dae0a4e0abda9ce3dff8e31007a8f66bc14421c8 Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Mon, 23 Jul 2012 21:36:40 +0200 Subject: [PATCH 20/65] WIP version of SerialConnect. Not working, but added to the tree anyway so : * You can code review it * You can help developping Uses libvterm as the backend for parsing ANSI escape sequences. The lib was changed slightly to build with GCC2. It could be used by Terminal as well as it seems cleaner and more reliable than our current parser. --- src/apps/Jamfile | 1 + src/apps/serialconnect/Jamfile | 21 + src/apps/serialconnect/SerialApp.cpp | 87 + src/apps/serialconnect/SerialApp.h | 35 + src/apps/serialconnect/SerialWindow.cpp | 118 ++ src/apps/serialconnect/SerialWindow.h | 17 + src/apps/serialconnect/TermView.cpp | 120 ++ src/apps/serialconnect/TermView.h | 37 + .../serialconnect/libvterm/include/vterm.h | 245 +++ .../libvterm/include/vterm_input.h | 39 + .../serialconnect/libvterm/src/encoding.c | 221 +++ .../libvterm/src/encoding/DECdrawing.inc | 36 + .../libvterm/src/encoding/DECdrawing.tbl | 31 + .../libvterm/src/encoding/uk.inc | 6 + .../libvterm/src/encoding/uk.tbl | 1 + src/apps/serialconnect/libvterm/src/input.c | 171 ++ src/apps/serialconnect/libvterm/src/parser.c | 344 ++++ src/apps/serialconnect/libvterm/src/pen.c | 373 +++++ src/apps/serialconnect/libvterm/src/rect.h | 56 + src/apps/serialconnect/libvterm/src/screen.c | 664 ++++++++ src/apps/serialconnect/libvterm/src/state.c | 1416 +++++++++++++++++ src/apps/serialconnect/libvterm/src/unicode.c | 332 ++++ src/apps/serialconnect/libvterm/src/utf8.h | 41 + src/apps/serialconnect/libvterm/src/vterm.c | 322 ++++ .../libvterm/src/vterm_internal.h | 167 ++ 25 files changed, 4901 insertions(+) create mode 100644 src/apps/serialconnect/Jamfile create mode 100644 src/apps/serialconnect/SerialApp.cpp create mode 100644 src/apps/serialconnect/SerialApp.h create mode 100644 src/apps/serialconnect/SerialWindow.cpp create mode 100644 src/apps/serialconnect/SerialWindow.h create mode 100644 src/apps/serialconnect/TermView.cpp create mode 100644 src/apps/serialconnect/TermView.h create mode 100644 src/apps/serialconnect/libvterm/include/vterm.h create mode 100644 src/apps/serialconnect/libvterm/include/vterm_input.h create mode 100644 src/apps/serialconnect/libvterm/src/encoding.c create mode 100644 src/apps/serialconnect/libvterm/src/encoding/DECdrawing.inc create mode 100644 src/apps/serialconnect/libvterm/src/encoding/DECdrawing.tbl create mode 100644 src/apps/serialconnect/libvterm/src/encoding/uk.inc create mode 100644 src/apps/serialconnect/libvterm/src/encoding/uk.tbl create mode 100644 src/apps/serialconnect/libvterm/src/input.c create mode 100644 src/apps/serialconnect/libvterm/src/parser.c create mode 100644 src/apps/serialconnect/libvterm/src/pen.c create mode 100644 src/apps/serialconnect/libvterm/src/rect.h create mode 100644 src/apps/serialconnect/libvterm/src/screen.c create mode 100644 src/apps/serialconnect/libvterm/src/state.c create mode 100644 src/apps/serialconnect/libvterm/src/unicode.c create mode 100644 src/apps/serialconnect/libvterm/src/utf8.h create mode 100644 src/apps/serialconnect/libvterm/src/vterm.c create mode 100644 src/apps/serialconnect/libvterm/src/vterm_internal.h diff --git a/src/apps/Jamfile b/src/apps/Jamfile index cd66b3e6c1..0f90365340 100644 --- a/src/apps/Jamfile +++ b/src/apps/Jamfile @@ -50,6 +50,7 @@ HaikuSubInclude readonlybootprompt ; HaikuSubInclude remotedesktop ; HaikuSubInclude resedit ; HaikuSubInclude screenshot ; +HaikuSubInclude serialconnect ; HaikuSubInclude showimage ; HaikuSubInclude soundrecorder ; HaikuSubInclude stylededit ; diff --git a/src/apps/serialconnect/Jamfile b/src/apps/serialconnect/Jamfile new file mode 100644 index 0000000000..20043b14bc --- /dev/null +++ b/src/apps/serialconnect/Jamfile @@ -0,0 +1,21 @@ +SubDir HAIKU_TOP src apps serialconnect ; + +SubDirSysHdrs [ FDirName $(HAIKU_TOP) src apps serialconnect libvterm include ] ; + +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps serialconnect libvterm src ] ; + +Application SerialConnect : + SerialApp.cpp + SerialWindow.cpp + TermView.cpp + encoding.c + input.c + parser.c + pen.c + screen.c + state.c + unicode.c + vterm.c + : be device $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) +; + diff --git a/src/apps/serialconnect/SerialApp.cpp b/src/apps/serialconnect/SerialApp.cpp new file mode 100644 index 0000000000..7697168b75 --- /dev/null +++ b/src/apps/serialconnect/SerialApp.cpp @@ -0,0 +1,87 @@ +/* + * Copyright 2012, Adrien Destugues, pulkomandy@gmail.com + * Distributed under the terms of the MIT licence. + */ + + +#include "SerialApp.h" + +#include "SerialWindow.h" + + +SerialApp::SerialApp() + : + BApplication(SerialApp::kApplicationSignature) +{ + fWindow = new SerialWindow(); + + serialLock = create_sem(0, "Serial port lock"); + thread_id id = spawn_thread(PollSerial, "Serial port poller", + B_LOW_PRIORITY, this); + resume_thread(id); +} + + +void SerialApp::ReadyToRun() +{ + fWindow->Show(); +} + + +void SerialApp::MessageReceived(BMessage* message) +{ + switch(message->what) + { + case kMsgOpenPort: + { + const char* portName; + message->FindString("port name", &portName); + serialPort.Open(portName); + release_sem(serialLock); + break; + } + case kMsgDataRead: + { + // TODO forward to the window + break; + } + default: + BApplication::MessageReceived(message); + } +} + + +/* static */ +status_t SerialApp::PollSerial(void*) +{ + SerialApp* application = (SerialApp*)be_app; + char buffer[256]; + + for(;;) + { + ssize_t bytesRead; + + bytesRead = application->serialPort.Read(buffer, 256); + if (bytesRead == B_FILE_ERROR) + { + // Port is not open - wait for it and start over + acquire_sem(application->serialLock); + } else { + // We read something, forward it to the app for handling + BMessage* serialData = new BMessage(kMsgDataRead); + // TODO bytesRead is not nul terminated. Use generic data rather + serialData->AddString("data", buffer); + be_app_messenger.SendMessage(serialData); + } + } +} + +const char* SerialApp::kApplicationSignature + = "application/x-vnd.haiku.SerialConnect"; + + +int main(int argc, char** argv) +{ + SerialApp app; + app.Run(); +} diff --git a/src/apps/serialconnect/SerialApp.h b/src/apps/serialconnect/SerialApp.h new file mode 100644 index 0000000000..a210feb36c --- /dev/null +++ b/src/apps/serialconnect/SerialApp.h @@ -0,0 +1,35 @@ +/* + * Copyright 2012, Adrien Destugues, pulkomandy@gmail.com + * Distributed under the terms of the MIT licence. + */ + + +#include +#include + + +class SerialWindow; + + +class SerialApp: public BApplication +{ + public: + SerialApp(); + void ReadyToRun(); + void MessageReceived(BMessage* message); + + private: + BSerialPort serialPort; + static status_t PollSerial(void*); + + sem_id serialLock; + SerialWindow* fWindow; + + static const char* kApplicationSignature; +}; + +enum messageConstants { + kMsgOpenPort = 'open', + kMsgDataRead = 'dare', +}; + diff --git a/src/apps/serialconnect/SerialWindow.cpp b/src/apps/serialconnect/SerialWindow.cpp new file mode 100644 index 0000000000..bb30691b5e --- /dev/null +++ b/src/apps/serialconnect/SerialWindow.cpp @@ -0,0 +1,118 @@ +/* + * Copyright 2012, Adrien Destugues, pulkomandy@gmail.com + * Distributed under the terms of the MIT licence. + */ + + +#include "SerialWindow.h" + +#include +#include +#include +#include +#include + +#include "TermView.h" + + +SerialWindow::SerialWindow() + : + BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle, + B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE) +{ + SetLayout(new BGroupLayout(B_VERTICAL, 0.0f)); + + BMenuBar* menuBar = new BMenuBar("menuBar"); + TermView* termView = new TermView(); + + AddChild(menuBar); + AddChild(termView); + + BMenu* connectionMenu = new BMenu("Connections"); + BMenu* editMenu = new BMenu("Edit"); + BMenu* settingsMenu = new BMenu("Settings"); + + menuBar->AddItem(connectionMenu); + menuBar->AddItem(editMenu); + menuBar->AddItem(settingsMenu); + + // TODO messages + BMenu* connect = new BMenu("Connect"); + connectionMenu->AddItem(connect); + + BSerialPort serialPort; + int deviceCount = serialPort.CountDevices(); + + for(int i = 0; i < deviceCount; i++) + { + char buffer[256]; + serialPort.GetDeviceName(i, buffer, 256); + + BMenuItem* portItem = new BMenuItem(buffer, NULL); + + connect->AddItem(portItem); + } + +#if SUPPORTS_MODEM + BMenuItem* connectModem = new BMenuItem( + "Connect via modem" B_UTF8_ELLIPSIS, NULL, 'M', 0); + connectionMenu->AddItem(connectModem); +#endif + BMenuItem* Disconnect = new BMenuItem("Disconnect", NULL, + 'Z', B_OPTION_KEY); + connectionMenu->AddItem(Disconnect); + + // TODO edit menu - what's in it ? + + // Configuring all this by menus may be a bit unhandy. Make a setting + // window instead ? + BMenu* parity = new BMenu("Parity"); + settingsMenu->AddItem(parity); + BMenu* dataBits = new BMenu("Data bits"); + settingsMenu->AddItem(dataBits); + BMenu* stopBits = new BMenu("Stop bits"); + settingsMenu->AddItem(stopBits); + BMenu* baudRate = new BMenu("Baud rate"); + settingsMenu->AddItem(baudRate); + BMenu* flowControl = new BMenu("Flow control"); + settingsMenu->AddItem(flowControl); + + BMenuItem* parityNone = new BMenuItem("None", NULL); + parity->AddItem(parityNone); + BMenuItem* parityOdd = new BMenuItem("Odd", NULL); + parity->AddItem(parityOdd); + BMenuItem* parityEven = new BMenuItem("Even", NULL); + parity->AddItem(parityEven); + + BMenuItem* data7 = new BMenuItem("7", NULL); + dataBits->AddItem(data7); + BMenuItem* data8 = new BMenuItem("8", NULL); + dataBits->AddItem(data8); + + BMenuItem* stop1 = new BMenuItem("1", NULL); + stopBits->AddItem(stop1); + BMenuItem* stop2 = new BMenuItem("2", NULL); + stopBits->AddItem(stop2); + + static const char* baudrates[] = { "50", "75", "110", "134", "150", "200", + "300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "31250", + "38400", "57600", "115200", "230400" + }; + + // Loop backwards to add fastest rates at top of menu + for (int i = sizeof(baudrates) / sizeof(char*); --i >= 0;) + { + BMenuItem* item = new BMenuItem(baudrates[i], NULL); + baudRate->AddItem(item); + } + + BMenuItem* rtsCts = new BMenuItem("RTS/CTS", NULL); + flowControl->AddItem(rtsCts); + BMenuItem* noFlow = new BMenuItem("None", NULL); + flowControl->AddItem(noFlow); + + CenterOnScreen(); +} + + +const char* SerialWindow::kWindowTitle = "SerialConnect"; diff --git a/src/apps/serialconnect/SerialWindow.h b/src/apps/serialconnect/SerialWindow.h new file mode 100644 index 0000000000..c54129010b --- /dev/null +++ b/src/apps/serialconnect/SerialWindow.h @@ -0,0 +1,17 @@ +/* + * Copyright 2012, Adrien Destugues, pulkomandy@gmail.com + * Distributed under the terms of the MIT licence. + */ + + +#include + + +class SerialWindow: public BWindow +{ + public: + SerialWindow::SerialWindow(); + + private: + static const char* kWindowTitle; +}; diff --git a/src/apps/serialconnect/TermView.cpp b/src/apps/serialconnect/TermView.cpp new file mode 100644 index 0000000000..7899bf0a5d --- /dev/null +++ b/src/apps/serialconnect/TermView.cpp @@ -0,0 +1,120 @@ +/* + * Copyright 2012, Adrien Destugues, pulkomandy@gmail.com + * Distributed under the terms of the MIT licence. + */ + + +#include "TermView.h" + +#include + +#include + + +TermView::TermView() + : + BView("TermView", B_WILL_DRAW) +{ + fTerm = vterm_new(kDefaultWidth, kDefaultHeight); + vterm_parser_set_utf8(fTerm, 1); + + fTermScreen = vterm_obtain_screen(fTerm); + vterm_screen_set_callbacks(fTermScreen, &sScreenCallbacks, this); + vterm_screen_reset(fTermScreen, 1); + + SetFont(be_fixed_font); + + font_height height; + GetFontHeight(&height); + fFontHeight = height.ascent + height.descent + height.leading; + fFontWidth = be_fixed_font->StringWidth("X"); + + // TEST + //vterm_push_bytes(fTerm,"Hello World!",11); +} + + +TermView::~TermView() +{ + vterm_free(fTerm); +} + + +void TermView::Draw(BRect updateRect) +{ + VTermRect updatedChars = PixelsToGlyphs(updateRect); + + VTermPos pos; + font_height height; + GetFontHeight(&height); + MovePenTo(kBorderSpacing, height.ascent + kBorderSpacing); + for (pos.row = updatedChars.start_row; pos.row < updatedChars.end_row; + pos.row++) + { + for (pos.col = updatedChars.start_col; + pos.col < updatedChars.end_col; pos.col++) + { + VTermScreenCell cell; + vterm_screen_get_cell(fTermScreen, pos, &cell); + + char buffer[6]; + wcstombs(buffer, (wchar_t*)cell.chars, 6); + + DrawString(buffer); + } + } +} + + +VTermRect TermView::PixelsToGlyphs(BRect pixels) const +{ + pixels.OffsetBy(-kBorderSpacing, -kBorderSpacing); + + VTermRect rect; + rect.start_col = (int)floor(pixels.left / fFontWidth); + rect.end_col = (int)ceil(pixels.right / fFontWidth); + rect.start_row = (int)floor(pixels.top / fFontHeight); + rect.end_row = (int)ceil(pixels.bottom / fFontHeight); + +#if 0 + printf("pixels:\t%d\t%d\t%d\t%d\n" + "glyps:\t%d\t%d\t%d\t%d\n", + (int)pixels.top, (int)pixels.bottom, (int)pixels.left, (int)pixels.right, + rect.start_row, rect.end_row, rect.start_col, rect.end_col); +#endif + return rect; +} + + +BRect TermView::GlyphsToPixels(const VTermRect& glyphs) const +{ + BRect rect; + rect.top = glyphs.start_row * fFontHeight; + rect.bottom = glyphs.end_row * fFontHeight; + rect.left = glyphs.start_col * fFontWidth; + rect.right = glyphs.end_col * fFontWidth; + + return rect; +} + + +BRect TermView::GlyphsToPixels(const int width, const int height) const +{ + VTermRect rect; + rect.start_row = 0; + rect.start_col = 0; + rect.end_row = height; + rect.end_col = width; + return GlyphsToPixels(rect); +} + + +const VTermScreenCallbacks TermView::sScreenCallbacks = { + /*.damage =*/ NULL, + /*.moverect =*/ NULL, + /*.movecursor =*/ NULL, + /*.settermprop =*/ NULL, + /*.setmousefunc =*/ NULL, + /*.bell =*/ NULL, + /*.resize =*/ NULL, +}; diff --git a/src/apps/serialconnect/TermView.h b/src/apps/serialconnect/TermView.h new file mode 100644 index 0000000000..4e485c7e79 --- /dev/null +++ b/src/apps/serialconnect/TermView.h @@ -0,0 +1,37 @@ +/* + * Copyright 2012, Adrien Destugues, pulkomandy@gmail.com + * Distributed under the terms of the MIT licence. + */ + + +#include + +extern "C" { + #include +} + +class TermView: public BView +{ + public: + TermView(); + ~TermView(); + + void Draw(BRect updateRect); + + private: + VTermRect PixelsToGlyphs(BRect pixels) const; + BRect GlyphsToPixels(const VTermRect& glyphs) const; + BRect GlyphsToPixels(const int width, const int height) const; + + private: + VTerm* fTerm; + VTermScreen* fTermScreen; + float fFontWidth; + float fFontHeight; + + static const VTermScreenCallbacks sScreenCallbacks; + + static const int kDefaultWidth = 80; + static const int kDefaultHeight = 25; + static const int kBorderSpacing = 3; +}; diff --git a/src/apps/serialconnect/libvterm/include/vterm.h b/src/apps/serialconnect/libvterm/include/vterm.h new file mode 100644 index 0000000000..47286511f0 --- /dev/null +++ b/src/apps/serialconnect/libvterm/include/vterm.h @@ -0,0 +1,245 @@ +#ifndef __VTERM_H__ +#define __VTERM_H__ + +#include +#include + +#include "vterm_input.h" + +typedef struct VTerm VTerm; +typedef struct VTermState VTermState; +typedef struct VTermScreen VTermScreen; + +typedef struct { + int row; + int col; +} VTermPos; + +/* some small utility functions; we can just keep these static here */ + +/* order points by on-screen flow order */ +static inline int vterm_pos_cmp(VTermPos a, VTermPos b) +{ + return (a.row == b.row) ? a.col - b.col : a.row - b.row; +} + +typedef struct { + int start_row; + int end_row; + int start_col; + int end_col; +} VTermRect; + +/* true if the rect contains the point */ +static inline int vterm_rect_contains(VTermRect r, VTermPos p) +{ + return p.row >= r.start_row && p.row < r.end_row && + p.col >= r.start_col && p.col < r.end_col; +} + +/* move a rect */ +static inline void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta) +{ + rect->start_row += row_delta; rect->end_row += row_delta; + rect->start_col += col_delta; rect->end_col += col_delta; +} + +/* Flag to indicate non-final subparameters in a single CSI parameter. + * Consider + * CSI 1;2:3:4;5a + * 1 4 and 5 are final. + * 2 and 3 are non-final and will have this bit set + * + * Don't confuse this with the final byte of the CSI escape; 'a' in this case. + */ +#define CSI_ARG_FLAG_MORE (1<<31) +#define CSI_ARG_MASK (~(1<<31)) + +#define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE) +#define CSI_ARG(a) ((a) & CSI_ARG_MASK) + +/* Can't use -1 to indicate a missing argument; use this instead */ +#define CSI_ARG_MISSING ((1UL<<31)-1) + +#define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING) +#define CSI_ARG_OR(a,def) (CSI_ARG(a) == CSI_ARG_MISSING ? (def) : CSI_ARG(a)) +#define CSI_ARG_COUNT(a) (CSI_ARG(a) == CSI_ARG_MISSING || CSI_ARG(a) == 0 ? 1 : CSI_ARG(a)) + +typedef struct { + int (*text)(const char *bytes, size_t len, void *user); + int (*control)(unsigned char control, void *user); + int (*escape)(const char *bytes, size_t len, void *user); + int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user); + int (*osc)(const char *command, size_t cmdlen, void *user); + int (*dcs)(const char *command, size_t cmdlen, void *user); + int (*resize)(int rows, int cols, void *user); +} VTermParserCallbacks; + +typedef struct { + uint8_t red, green, blue; +} VTermColor; + +typedef enum { + /* VTERM_VALUETYPE_NONE = 0 */ + VTERM_VALUETYPE_BOOL = 1, + VTERM_VALUETYPE_INT, + VTERM_VALUETYPE_STRING, + VTERM_VALUETYPE_COLOR, +} VTermValueType; + +typedef union { + int boolean; + int number; + char *string; + VTermColor color; +} VTermValue; + +typedef enum { + /* VTERM_ATTR_NONE = 0 */ + VTERM_ATTR_BOLD = 1, // bool: 1, 22 + VTERM_ATTR_UNDERLINE, // number: 4, 21, 24 + VTERM_ATTR_ITALIC, // bool: 3, 23 + VTERM_ATTR_BLINK, // bool: 5, 25 + VTERM_ATTR_REVERSE, // bool: 7, 27 + VTERM_ATTR_STRIKE, // bool: 9, 29 + VTERM_ATTR_FONT, // number: 10-19 + VTERM_ATTR_FOREGROUND, // color: 30-39 90-97 + VTERM_ATTR_BACKGROUND, // color: 40-49 100-107 +} VTermAttr; + +typedef enum { + /* VTERM_PROP_NONE = 0 */ + VTERM_PROP_CURSORVISIBLE = 1, // bool + VTERM_PROP_CURSORBLINK, // bool + VTERM_PROP_ALTSCREEN, // bool + VTERM_PROP_TITLE, // string + VTERM_PROP_ICONNAME, // string + VTERM_PROP_REVERSE, // bool + VTERM_PROP_CURSORSHAPE, // number +} VTermProp; + +enum { + VTERM_PROP_CURSORSHAPE_BLOCK = 1, + VTERM_PROP_CURSORSHAPE_UNDERLINE, +}; + +typedef void (*VTermMouseFunc)(int x, int y, int button, int pressed, int modifiers, void *data); + +typedef struct { + int (*putglyph)(const uint32_t chars[], int width, VTermPos pos, void *user); + int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); + int (*scrollrect)(VTermRect rect, int downward, int rightward, void *user); + int (*moverect)(VTermRect dest, VTermRect src, void *user); + int (*erase)(VTermRect rect, void *user); + int (*initpen)(void *user); + int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user); + int (*settermprop)(VTermProp prop, VTermValue *val, void *user); + int (*setmousefunc)(VTermMouseFunc func, void *data, void *user); + int (*bell)(void *user); + int (*resize)(int rows, int cols, void *user); +} VTermStateCallbacks; + +typedef struct { + int (*damage)(VTermRect rect, void *user); + int (*moverect)(VTermRect dest, VTermRect src, void *user); + int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); + int (*settermprop)(VTermProp prop, VTermValue *val, void *user); + int (*setmousefunc)(VTermMouseFunc func, void *data, void *user); + int (*bell)(void *user); + int (*resize)(int rows, int cols, void *user); +} VTermScreenCallbacks; + +typedef struct { + /* libvterm relies on this memory to be zeroed out before it is returned + * by the allocator. */ + void *(*malloc)(size_t size, void *allocdata); + void (*free)(void *ptr, void *allocdata); +} VTermAllocatorFunctions; + +VTerm *vterm_new(int rows, int cols); +VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata); +void vterm_free(VTerm* vt); + +void vterm_get_size(VTerm *vt, int *rowsp, int *colsp); +void vterm_set_size(VTerm *vt, int rows, int cols); + +void vterm_set_parser_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user); + +VTermState *vterm_obtain_state(VTerm *vt); + +void vterm_state_reset(VTermState *state, int hard); +void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user); +void vterm_state_get_cursorpos(VTermState *state, VTermPos *cursorpos); +void vterm_state_set_default_colors(VTermState *state, VTermColor *default_fg, VTermColor *default_bg); +void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright); +int vterm_state_get_penattr(VTermState *state, VTermAttr attr, VTermValue *val); + +VTermValueType vterm_get_attr_type(VTermAttr attr); +VTermValueType vterm_get_prop_type(VTermProp prop); + +VTermScreen *vterm_obtain_screen(VTerm *vt); + +void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen); +void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user); + +typedef enum { + VTERM_DAMAGE_CELL, /* every cell */ + VTERM_DAMAGE_ROW, /* entire rows */ + VTERM_DAMAGE_SCREEN, /* entire screen */ + VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */ +} VTermDamageSize; + +void vterm_screen_flush_damage(VTermScreen *screen); +void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size); + +void vterm_screen_reset(VTermScreen *screen, int hard); +size_t vterm_screen_get_chars(VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect); +size_t vterm_screen_get_text(VTermScreen *screen, char *str, size_t len, const VTermRect rect); + +typedef struct { +#define VTERM_MAX_CHARS_PER_CELL 6 + uint32_t chars[VTERM_MAX_CHARS_PER_CELL]; + char width; + struct { + unsigned int bold : 1; + unsigned int underline : 2; + unsigned int italic : 1; + unsigned int blink : 1; + unsigned int reverse : 1; + unsigned int strike : 1; + unsigned int font : 4; /* 0 to 9 */ + } attrs; + VTermColor fg, bg; +} VTermScreenCell; + +void vterm_screen_get_cell(VTermScreen *screen, VTermPos pos, VTermScreenCell *cell); + +int vterm_screen_is_eol(VTermScreen *screen, VTermPos pos); + +void vterm_input_push_char(VTerm *vt, VTermModifier state, uint32_t c); +void vterm_input_push_key(VTerm *vt, VTermModifier state, VTermKey key); + +void vterm_parser_set_utf8(VTerm *vt, int is_utf8); +void vterm_push_bytes(VTerm *vt, const char *bytes, size_t len); + +size_t vterm_output_bufferlen(VTerm *vt); /* deprecated */ + +size_t vterm_output_get_buffer_size(VTerm *vt); +size_t vterm_output_get_buffer_current(VTerm *vt); +size_t vterm_output_get_buffer_remaining(VTerm *vt); + +size_t vterm_output_bufferread(VTerm *vt, char *buffer, size_t len); + +void vterm_scroll_rect(VTermRect rect, + int downward, + int rightward, + int (*moverect)(VTermRect src, VTermRect dest, void *user), + int (*eraserect)(VTermRect rect, void *user), + void *user); + +void vterm_copy_cells(VTermRect dest, + VTermRect src, + void (*copycell)(VTermPos dest, VTermPos src, void *user), + void *user); + +#endif diff --git a/src/apps/serialconnect/libvterm/include/vterm_input.h b/src/apps/serialconnect/libvterm/include/vterm_input.h new file mode 100644 index 0000000000..69cc6cb914 --- /dev/null +++ b/src/apps/serialconnect/libvterm/include/vterm_input.h @@ -0,0 +1,39 @@ +#ifndef __VTERM_INPUT_H__ +#define __VTERM_INPUT_H__ + +typedef enum { + VTERM_MOD_NONE = 0x00, + VTERM_MOD_SHIFT = 0x01, + VTERM_MOD_ALT = 0x02, + VTERM_MOD_CTRL = 0x04, +} VTermModifier; + +typedef enum { + VTERM_KEY_NONE, + + VTERM_KEY_ENTER, + VTERM_KEY_TAB, + VTERM_KEY_BACKSPACE, + VTERM_KEY_ESCAPE, + + VTERM_KEY_UP, + VTERM_KEY_DOWN, + VTERM_KEY_LEFT, + VTERM_KEY_RIGHT, + + VTERM_KEY_INS, + VTERM_KEY_DEL, + VTERM_KEY_HOME, + VTERM_KEY_END, + VTERM_KEY_PAGEUP, + VTERM_KEY_PAGEDOWN, + + VTERM_KEY_FUNCTION_0, + VTERM_KEY_FUNCTION_MAX = VTERM_KEY_FUNCTION_0 + 255, + + VTERM_KEY_MAX, // Must be last +} VTermKey; + +#define VTERM_KEY_FUNCTION(n) (VTERM_KEY_FUNCTION_0+(n)) + +#endif diff --git a/src/apps/serialconnect/libvterm/src/encoding.c b/src/apps/serialconnect/libvterm/src/encoding.c new file mode 100644 index 0000000000..373c9bcd77 --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/encoding.c @@ -0,0 +1,221 @@ +#include "vterm_internal.h" + +#include + +#define UNICODE_INVALID 0xFFFD + +#ifdef DEBUG +# define DEBUG_PRINT_UTF8 +#endif + +struct UTF8DecoderData { + // number of bytes remaining in this codepoint + int bytes_remaining; + + // number of bytes total in this codepoint once it's finished + // (for detecting overlongs) + int bytes_total; + + int this_cp; +}; + +static void init_utf8(VTermEncoding *enc, void *data_) +{ + struct UTF8DecoderData *data = data_; + + data->bytes_remaining = 0; + data->bytes_total = 0; +} + +static void decode_utf8(VTermEncoding *enc, void *data_, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t bytelen) +{ + struct UTF8DecoderData *data = data_; + +#ifdef DEBUG_PRINT_UTF8 + printf("BEGIN UTF-8\n"); +#endif + + for( ; *pos < bytelen; (*pos)++) { + unsigned char c = bytes[*pos]; + +#ifdef DEBUG_PRINT_UTF8 + printf(" pos=%zd c=%02x rem=%d\n", *pos, c, data->bytes_remaining); +#endif + + if(c < 0x20) + return; + + else if(c >= 0x20 && c < 0x80) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + cp[(*cpi)++] = c; +#ifdef DEBUG_PRINT_UTF8 + printf(" UTF-8 char: U+%04x\n", c); +#endif + data->bytes_remaining = 0; + } + + else if(c >= 0x80 && c < 0xc0) { + if(!data->bytes_remaining) { + cp[(*cpi)++] = UNICODE_INVALID; + continue; + } + + data->this_cp <<= 6; + data->this_cp |= c & 0x3f; + data->bytes_remaining--; + + if(!data->bytes_remaining) { +#ifdef DEBUG_PRINT_UTF8 + printf(" UTF-8 raw char U+%04x bytelen=%d ", data->this_cp, data->bytes_total); +#endif + // Check for overlong sequences + switch(data->bytes_total) { + case 2: + if(data->this_cp < 0x0080) data->this_cp = UNICODE_INVALID; break; + case 3: + if(data->this_cp < 0x0800) data->this_cp = UNICODE_INVALID; break; + case 4: + if(data->this_cp < 0x10000) data->this_cp = UNICODE_INVALID; break; + case 5: + if(data->this_cp < 0x200000) data->this_cp = UNICODE_INVALID; break; + case 6: + if(data->this_cp < 0x4000000) data->this_cp = UNICODE_INVALID; break; + } + // Now look for plain invalid ones + if((data->this_cp >= 0xD800 && data->this_cp <= 0xDFFF) || + data->this_cp == 0xFFFE || + data->this_cp == 0xFFFF) + data->this_cp = UNICODE_INVALID; +#ifdef DEBUG_PRINT_UTF8 + printf(" char: U+%04x\n", data->this_cp); +#endif + cp[(*cpi)++] = data->this_cp; + } + } + + else if(c >= 0xc0 && c < 0xe0) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x1f; + data->bytes_total = 2; + data->bytes_remaining = 1; + } + + else if(c >= 0xe0 && c < 0xf0) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x0f; + data->bytes_total = 3; + data->bytes_remaining = 2; + } + + else if(c >= 0xf0 && c < 0xf8) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x07; + data->bytes_total = 4; + data->bytes_remaining = 3; + } + + else if(c >= 0xf8 && c < 0xfc) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x03; + data->bytes_total = 5; + data->bytes_remaining = 4; + } + + else if(c >= 0xfc && c < 0xfe) { + if(data->bytes_remaining) + cp[(*cpi)++] = UNICODE_INVALID; + + data->this_cp = c & 0x01; + data->bytes_total = 6; + data->bytes_remaining = 5; + } + + else { + cp[(*cpi)++] = UNICODE_INVALID; + } + } +} + +static VTermEncoding encoding_utf8 = { + .init = &init_utf8, + .decode = &decode_utf8, +}; + +static void decode_usascii(VTermEncoding *enc, void *data, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t bytelen) +{ + for(; *pos < bytelen; (*pos)++) { + unsigned char c = bytes[*pos]; + + if(c < 0x20 || c >= 0x80) + return; + + cp[(*cpi)++] = c; + } +} + +static VTermEncoding encoding_usascii = { + .decode = &decode_usascii, +}; + +struct StaticTableEncoding { + const VTermEncoding enc; + const uint32_t chars[128]; +}; + +static void decode_table(VTermEncoding *enc, void *data, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t bytelen) +{ + struct StaticTableEncoding *table = (struct StaticTableEncoding *)enc; + + for(; *pos < bytelen; (*pos)++) { + unsigned char c = (bytes[*pos]) & 0x7f; + + if(c < 0x20) + return; + + if(table->chars[c]) + cp[(*cpi)++] = table->chars[c]; + else + cp[(*cpi)++] = c; + } +} + +#include "encoding/DECdrawing.inc" +#include "encoding/uk.inc" + +static struct { + VTermEncodingType type; + char designation; + VTermEncoding *enc; +} +encodings[] = { + { ENC_UTF8, 'u', &encoding_utf8 }, + { ENC_SINGLE_94, '0', (VTermEncoding*)&encoding_DECdrawing }, + { ENC_SINGLE_94, 'A', (VTermEncoding*)&encoding_uk }, + { ENC_SINGLE_94, 'B', &encoding_usascii }, + { 0, 0 }, +}; + +VTermEncoding *vterm_lookup_encoding(VTermEncodingType type, char designation) +{ + int i; + for(i = 0; encodings[i].designation; i++) + if(encodings[i].type == type && encodings[i].designation == designation) + return encodings[i].enc; + return NULL; +} diff --git a/src/apps/serialconnect/libvterm/src/encoding/DECdrawing.inc b/src/apps/serialconnect/libvterm/src/encoding/DECdrawing.inc new file mode 100644 index 0000000000..47093ed0a8 --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/encoding/DECdrawing.inc @@ -0,0 +1,36 @@ +static const struct StaticTableEncoding encoding_DECdrawing = { + { .decode = &decode_table }, + { + [0x60] = 0x25C6, + [0x61] = 0x2592, + [0x62] = 0x2409, + [0x63] = 0x240C, + [0x64] = 0x240D, + [0x65] = 0x240A, + [0x66] = 0x00B0, + [0x67] = 0x00B1, + [0x68] = 0x2424, + [0x69] = 0x240B, + [0x6a] = 0x2518, + [0x6b] = 0x2510, + [0x6c] = 0x250C, + [0x6d] = 0x2514, + [0x6e] = 0x253C, + [0x6f] = 0x23BA, + [0x70] = 0x23BB, + [0x71] = 0x2500, + [0x72] = 0x23BC, + [0x73] = 0x23BD, + [0x74] = 0x251C, + [0x75] = 0x2524, + [0x76] = 0x2534, + [0x77] = 0x252C, + [0x78] = 0x2502, + [0x79] = 0x2A7D, + [0x7a] = 0x2A7E, + [0x7b] = 0x03C0, + [0x7c] = 0x2260, + [0x7d] = 0x00A3, + [0x7e] = 0x00B7, + } +}; diff --git a/src/apps/serialconnect/libvterm/src/encoding/DECdrawing.tbl b/src/apps/serialconnect/libvterm/src/encoding/DECdrawing.tbl new file mode 100644 index 0000000000..6e19c5066e --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/encoding/DECdrawing.tbl @@ -0,0 +1,31 @@ +6/0 = U+25C6 # BLACK DIAMOND +6/1 = U+2592 # MEDIUM SHADE (checkerboard) +6/2 = U+2409 # SYMBOL FOR HORIZONTAL TAB +6/3 = U+240C # SYMBOL FOR FORM FEED +6/4 = U+240D # SYMBOL FOR CARRIAGE RETURN +6/5 = U+240A # SYMBOL FOR LINE FEED +6/6 = U+00B0 # DEGREE SIGN +6/7 = U+00B1 # PLUS-MINUS SIGN (plus or minus) +6/8 = U+2424 # SYMBOL FOR NEW LINE +6/9 = U+240B # SYMBOL FOR VERTICAL TAB +6/10 = U+2518 # BOX DRAWINGS LIGHT UP AND LEFT (bottom-right corner) +6/11 = U+2510 # BOX DRAWINGS LIGHT DOWN AND LEFT (top-right corner) +6/12 = U+250C # BOX DRAWINGS LIGHT DOWN AND RIGHT (top-left corner) +6/13 = U+2514 # BOX DRAWINGS LIGHT UP AND RIGHT (bottom-left corner) +6/14 = U+253C # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL (crossing lines) +6/15 = U+23BA # HORIZONTAL SCAN LINE-1 +7/0 = U+23BB # HORIZONTAL SCAN LINE-3 +7/1 = U+2500 # BOX DRAWINGS LIGHT HORIZONTAL +7/2 = U+23BC # HORIZONTAL SCAN LINE-7 +7/3 = U+23BD # HORIZONTAL SCAN LINE-9 +7/4 = U+251C # BOX DRAWINGS LIGHT VERTICAL AND RIGHT +7/5 = U+2524 # BOX DRAWINGS LIGHT VERTICAL AND LEFT +7/6 = U+2534 # BOX DRAWINGS LIGHT UP AND HORIZONTAL +7/7 = U+252C # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL +7/8 = U+2502 # BOX DRAWINGS LIGHT VERTICAL +7/9 = U+2A7D # LESS-THAN OR SLANTED EQUAL-TO +7/10 = U+2A7E # GREATER-THAN OR SLANTED EQUAL-TO +7/11 = U+03C0 # GREEK SMALL LETTER PI +7/12 = U+2260 # NOT EQUAL TO +7/13 = U+00A3 # POUND SIGN +7/14 = U+00B7 # MIDDLE DOT diff --git a/src/apps/serialconnect/libvterm/src/encoding/uk.inc b/src/apps/serialconnect/libvterm/src/encoding/uk.inc new file mode 100644 index 0000000000..da1445deca --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/encoding/uk.inc @@ -0,0 +1,6 @@ +static const struct StaticTableEncoding encoding_uk = { + { .decode = &decode_table }, + { + [0x23] = 0x00a3, + } +}; diff --git a/src/apps/serialconnect/libvterm/src/encoding/uk.tbl b/src/apps/serialconnect/libvterm/src/encoding/uk.tbl new file mode 100644 index 0000000000..b27b1a2193 --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/encoding/uk.tbl @@ -0,0 +1 @@ +2/3 = "£" diff --git a/src/apps/serialconnect/libvterm/src/input.c b/src/apps/serialconnect/libvterm/src/input.c new file mode 100644 index 0000000000..f85116284b --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/input.c @@ -0,0 +1,171 @@ +#include "vterm_internal.h" + +#include + +#include "utf8.h" + +void vterm_input_push_char(VTerm *vt, VTermModifier mod, uint32_t c) +{ + int needs_CSIu; + /* The shift modifier is never important for Unicode characters + * apart from Space + */ + if(c != ' ') + mod &= ~VTERM_MOD_SHIFT; + /* However, since Shift-Space is too easy to mistype accidentally, remove + * shift if it's the only modifier + */ + else if(mod == VTERM_MOD_SHIFT) + mod = 0; + + if(mod == 0) { + // Normal text - ignore just shift + char str[6]; + int seqlen = fill_utf8(c, str); + vterm_push_output_bytes(vt, str, seqlen); + return; + } + + switch(c) { + /* Special Ctrl- letters that can't be represented elsewise */ + case 'h': case 'i': case 'j': case 'm': case '[': + needs_CSIu = 1; + break; + /* Ctrl-\ ] ^ _ don't need CSUu */ + case '\\': case ']': case '^': case '_': + needs_CSIu = 0; + break; + /* All other characters needs CSIu except for letters a-z */ + default: + needs_CSIu = (c < 'a' || c > 'z'); + } + + /* ALT we can just prefix with ESC; anything else requires CSI u */ + if(needs_CSIu && (mod & ~VTERM_MOD_ALT)) { + vterm_push_output_sprintf(vt, "\e[%d;%du", c, mod+1); + return; + } + + if(mod & VTERM_MOD_CTRL) + c &= 0x1f; + + vterm_push_output_sprintf(vt, "%s%c", mod & VTERM_MOD_ALT ? "\e" : "", c); +} + +typedef struct { + enum { + KEYCODE_NONE, + KEYCODE_LITERAL, + KEYCODE_TAB, + KEYCODE_ENTER, + KEYCODE_CSI, + KEYCODE_CSI_CURSOR, + KEYCODE_CSINUM, + } type; + char literal; + int csinum; +} keycodes_s; + +keycodes_s keycodes[] = { + { KEYCODE_NONE }, // NONE + + { KEYCODE_ENTER, '\r' }, // ENTER + { KEYCODE_TAB, '\t' }, // TAB + { KEYCODE_LITERAL, '\x7f' }, // BACKSPACE == ASCII DEL + { KEYCODE_LITERAL, '\e' }, // ESCAPE + + { KEYCODE_CSI_CURSOR, 'A' }, // UP + { KEYCODE_CSI_CURSOR, 'B' }, // DOWN + { KEYCODE_CSI_CURSOR, 'D' }, // LEFT + { KEYCODE_CSI_CURSOR, 'C' }, // RIGHT + + { KEYCODE_CSINUM, '~', 2 }, // INS + { KEYCODE_CSINUM, '~', 3 }, // DEL + { KEYCODE_CSI_CURSOR, 'H' }, // HOME + { KEYCODE_CSI_CURSOR, 'F' }, // END + { KEYCODE_CSINUM, '~', 5 }, // PAGEUP + { KEYCODE_CSINUM, '~', 6 }, // PAGEDOWN + + { KEYCODE_NONE }, // F0 - shouldn't happen + { KEYCODE_CSI_CURSOR, 'P' }, // F1 + { KEYCODE_CSI_CURSOR, 'Q' }, // F2 + { KEYCODE_CSI_CURSOR, 'R' }, // F3 + { KEYCODE_CSI_CURSOR, 'S' }, // F4 + { KEYCODE_CSINUM, '~', 15 }, // F5 + { KEYCODE_CSINUM, '~', 17 }, // F6 + { KEYCODE_CSINUM, '~', 18 }, // F7 + { KEYCODE_CSINUM, '~', 19 }, // F8 + { KEYCODE_CSINUM, '~', 20 }, // F9 + { KEYCODE_CSINUM, '~', 21 }, // F10 + { KEYCODE_CSINUM, '~', 23 }, // F11 + { KEYCODE_CSINUM, '~', 24 }, // F12 +}; + +void vterm_input_push_key(VTerm *vt, VTermModifier mod, VTermKey key) +{ + keycodes_s k; + /* Since Shift-Enter and Shift-Backspace are too easy to mistype + * accidentally, remove shift if it's the only modifier + */ + if((key == VTERM_KEY_ENTER || key == VTERM_KEY_BACKSPACE) && mod == VTERM_MOD_SHIFT) + mod = 0; + + if(key == VTERM_KEY_NONE || key >= VTERM_KEY_MAX) + return; + + if(key >= sizeof(keycodes)/sizeof(keycodes[0])) + return; + + k = keycodes[key]; + + switch(k.type) { + case KEYCODE_NONE: + break; + + case KEYCODE_TAB: + /* Shift-Tab is CSI Z but plain Tab is 0x09 */ + if(mod == VTERM_MOD_SHIFT) + vterm_push_output_sprintf(vt, "\e[Z"); + else if(mod & VTERM_MOD_SHIFT) + vterm_push_output_sprintf(vt, "\e[1;%dZ", mod+1); + else + goto literal; + break; + + case KEYCODE_ENTER: + /* Enter is CRLF in newline mode, but just LF in linefeed */ + if(vt->state->mode.newline) + vterm_push_output_sprintf(vt, "\r\n"); + else + goto literal; + break; + +literal: + case KEYCODE_LITERAL: + if(mod & (VTERM_MOD_SHIFT|VTERM_MOD_CTRL)) + vterm_push_output_sprintf(vt, "\e[%d;%du", k.literal, mod+1); + else + vterm_push_output_sprintf(vt, mod & VTERM_MOD_ALT ? "\e%c" : "%c", k.literal); + break; + + case KEYCODE_CSI_CURSOR: + if(vt->state->mode.cursor && mod == 0) { + vterm_push_output_sprintf(vt, "\eO%c", k.literal); + break; + } + /* else FALLTHROUGH */ + case KEYCODE_CSI: + if(mod == 0) + vterm_push_output_sprintf(vt, "\e[%c", k.literal); + else + vterm_push_output_sprintf(vt, "\e[1;%d%c", mod + 1, k.literal); + break; + + case KEYCODE_CSINUM: + if(mod == 0) + vterm_push_output_sprintf(vt, "\e[%d%c", k.csinum, k.literal); + else + vterm_push_output_sprintf(vt, "\e[%d;%d%c", k.csinum, mod + 1, k.literal); + break; + } +} diff --git a/src/apps/serialconnect/libvterm/src/parser.c b/src/apps/serialconnect/libvterm/src/parser.c new file mode 100644 index 0000000000..cfd7e2ca5f --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/parser.c @@ -0,0 +1,344 @@ +#include "vterm_internal.h" + +#include +#include +#include + +#define CSI_ARGS_MAX 16 +#define CSI_LEADER_MAX 16 +#define CSI_INTERMED_MAX 16 + +static void do_control(VTerm *vt, unsigned char control) +{ + if(vt->parser_callbacks && vt->parser_callbacks->control) + if((*vt->parser_callbacks->control)(control, vt->cbdata)) + return; + + fprintf(stderr, "libvterm: Unhandled control 0x%02x\n", control); +} + +static void do_string_csi(VTerm *vt, const char *args, size_t arglen, char command) +{ + size_t i = 0; + + int leaderlen = 0; + char leader[CSI_LEADER_MAX]; + int argcount = 1; // Always at least 1 arg + long csi_args[CSI_ARGS_MAX]; + int argi; + int intermedlen = 0; + char intermed[CSI_INTERMED_MAX]; + + // Extract leader bytes 0x3c to 0x3f + for( ; i < arglen; i++) { + if(args[i] < 0x3c || args[i] > 0x3f) + break; + if(leaderlen < CSI_LEADER_MAX-1) + leader[leaderlen++] = args[i]; + } + + leader[leaderlen] = 0; + + for( ; i < arglen; i++) + if(args[i] == 0x3b || args[i] == 0x3a) // ; or : + argcount++; + + /* TODO: Consider if these buffers should live in the VTerm struct itself */ + if(argcount > CSI_ARGS_MAX) + argcount = CSI_ARGS_MAX; + + for(argi = 0; argi < argcount; argi++) + csi_args[argi] = CSI_ARG_MISSING; + + argi = 0; + for(i = leaderlen; i < arglen && argi < argcount; i++) { + switch(args[i]) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + if(csi_args[argi] == CSI_ARG_MISSING) + csi_args[argi] = 0; + csi_args[argi] *= 10; + csi_args[argi] += args[i] - '0'; + break; + case 0x3a: + csi_args[argi] |= CSI_ARG_FLAG_MORE; + /* FALLTHROUGH */ + case 0x3b: + argi++; + break; + default: + goto done_leader; + } + } +done_leader: ; + + + for( ; i < arglen; i++) { + if((args[i] & 0xf0) != 0x20) + break; + + if(intermedlen < CSI_INTERMED_MAX-1) + intermed[intermedlen++] = args[i]; + } + + intermed[intermedlen] = 0; + + if(i < arglen) { + fprintf(stderr, "libvterm: TODO unhandled CSI bytes \"%.*s\"\n", (int)(arglen - i), args + i); + } + + //printf("Parsed CSI args %.*s as:\n", arglen, args); + //printf(" leader: %s\n", leader); + //for(argi = 0; argi < argcount; argi++) { + // printf(" %lu", CSI_ARG(csi_args[argi])); + // if(!CSI_ARG_HAS_MORE(csi_args[argi])) + // printf("\n"); + //printf(" intermed: %s\n", intermed); + //} + + if(vt->parser_callbacks && vt->parser_callbacks->csi) + if((*vt->parser_callbacks->csi)(leaderlen ? leader : NULL, csi_args, argcount, intermedlen ? intermed : NULL, command, vt->cbdata)) + return; + + fprintf(stderr, "libvterm: Unhandled CSI %.*s %c\n", (int)arglen, args, command); +} + +static void append_strbuffer(VTerm *vt, const char *str, size_t len) +{ + if(len > vt->strbuffer_len - vt->strbuffer_cur) { + len = vt->strbuffer_len - vt->strbuffer_cur; + fprintf(stderr, "Truncating strbuffer preserve to %zd bytes\n", len); + } + + if(len > 0) { + strncpy(vt->strbuffer + vt->strbuffer_cur, str, len); + vt->strbuffer_cur += len; + } +} + +static size_t do_string(VTerm *vt, const char *str_frag, size_t len) +{ + size_t eaten; + + if(vt->strbuffer_cur) { + if(str_frag) + append_strbuffer(vt, str_frag, len); + + str_frag = vt->strbuffer; + len = vt->strbuffer_cur; + } + else if(!str_frag) { + fprintf(stderr, "parser.c: TODO: No strbuffer _and_ no final fragment???\n"); + len = 0; + } + + vt->strbuffer_cur = 0; + + switch(vt->parser_state) { + case NORMAL: + if(vt->parser_callbacks && vt->parser_callbacks->text) + if((eaten = (*vt->parser_callbacks->text)(str_frag, len, vt->cbdata))) + return eaten; + + fprintf(stderr, "libvterm: Unhandled text (%zu chars)\n", len); + return 0; + + case ESC: + if(len == 1 && str_frag[0] >= 0x40 && str_frag[0] < 0x60) { + // C1 emulations using 7bit clean + // ESC 0x40 == 0x80 + do_control(vt, str_frag[0] + 0x40); + return 0; + } + + if(vt->parser_callbacks && vt->parser_callbacks->escape) + if((*vt->parser_callbacks->escape)(str_frag, len, vt->cbdata)) + return 0; + + fprintf(stderr, "libvterm: Unhandled escape ESC 0x%02x\n", str_frag[len-1]); + return 0; + + case CSI: + do_string_csi(vt, str_frag, len - 1, str_frag[len - 1]); + return 0; + + case OSC: + if(vt->parser_callbacks && vt->parser_callbacks->osc) + if((*vt->parser_callbacks->osc)(str_frag, len, vt->cbdata)) + return 0; + + fprintf(stderr, "libvterm: Unhandled OSC %.*s\n", (int)len, str_frag); + return 0; + + case DCS: + if(vt->parser_callbacks && vt->parser_callbacks->dcs) + if((*vt->parser_callbacks->dcs)(str_frag, len, vt->cbdata)) + return 0; + + fprintf(stderr, "libvterm: Unhandled DCS %.*s\n", (int)len, str_frag); + return 0; + + case ESC_IN_OSC: + case ESC_IN_DCS: + fprintf(stderr, "libvterm: ARGH! Should never do_string() in ESC_IN_{OSC,DCS}\n"); + return 0; + } + + return 0; +} + +void vterm_push_bytes(VTerm *vt, const char *bytes, size_t len) +{ + size_t pos = 0; + const char *string_start = NULL; + + switch(vt->parser_state) { + case NORMAL: + string_start = NULL; + break; + case ESC: + case ESC_IN_OSC: + case ESC_IN_DCS: + case CSI: + case OSC: + case DCS: + string_start = bytes; + break; + } + +#define ENTER_STRING_STATE(st) do { vt->parser_state = st; string_start = bytes + pos + 1; } while(0) +#define ENTER_NORMAL_STATE() do { vt->parser_state = NORMAL; string_start = NULL; } while(0) + + for( ; pos < len; pos++) { + unsigned char c = bytes[pos]; + + if(c == 0x00 || c == 0x7f) { // NUL, DEL + if(vt->parser_state != NORMAL) { + append_strbuffer(vt, string_start, bytes + pos - string_start); + string_start = bytes + pos + 1; + } + continue; + } + if(c == 0x18 || c == 0x1a) { // CAN, SUB + ENTER_NORMAL_STATE(); + continue; + } + else if(c == 0x1b) { // ESC + if(vt->parser_state == OSC) + vt->parser_state = ESC_IN_OSC; + else if(vt->parser_state == DCS) + vt->parser_state = ESC_IN_DCS; + else + ENTER_STRING_STATE(ESC); + continue; + } + else if(c == 0x07 && // BEL, can stand for ST in OSC or DCS state + (vt->parser_state == OSC || vt->parser_state == DCS)) { + // fallthrough + } + else if(c < 0x20) { // other C0 + if(vt->parser_state != NORMAL) + append_strbuffer(vt, string_start, bytes + pos - string_start); + do_control(vt, c); + if(vt->parser_state != NORMAL) + string_start = bytes + pos + 1; + continue; + } + // else fallthrough + + switch(vt->parser_state) { + case ESC_IN_OSC: + case ESC_IN_DCS: + if(c == 0x5c) { // ST + switch(vt->parser_state) { + case ESC_IN_OSC: vt->parser_state = OSC; break; + case ESC_IN_DCS: vt->parser_state = DCS; break; + default: break; + } + do_string(vt, string_start, bytes + pos - string_start - 1); + ENTER_NORMAL_STATE(); + break; + } + vt->parser_state = ESC; + string_start = bytes + pos; + // else fallthrough + + case ESC: + switch(c) { + case 0x50: // DCS + ENTER_STRING_STATE(DCS); + break; + case 0x5b: // CSI + ENTER_STRING_STATE(CSI); + break; + case 0x5d: // OSC + ENTER_STRING_STATE(OSC); + break; + default: + if(c >= 0x30 && c < 0x7f) { + /* +1 to pos because we want to include this command byte as well */ + do_string(vt, string_start, bytes + pos - string_start + 1); + ENTER_NORMAL_STATE(); + } + else if(c >= 0x20 && c < 0x30) { + /* intermediate byte */ + } + else { + fprintf(stderr, "TODO: Unhandled byte %02x in Escape\n", c); + } + } + break; + + case CSI: + if(c >= 0x40 && c <= 0x7f) { + /* +1 to pos because we want to include this command byte as well */ + do_string(vt, string_start, bytes + pos - string_start + 1); + ENTER_NORMAL_STATE(); + } + break; + + case OSC: + case DCS: + if(c == 0x07 || (c == 0x9c && !vt->is_utf8)) { + do_string(vt, string_start, bytes + pos - string_start); + ENTER_NORMAL_STATE(); + } + break; + + case NORMAL: + if(c >= 0x80 && c < 0xa0 && !vt->is_utf8) { + switch(c) { + case 0x90: // DCS + ENTER_STRING_STATE(DCS); + break; + case 0x9b: // CSI + ENTER_STRING_STATE(CSI); + break; + case 0x9d: // OSC + ENTER_STRING_STATE(OSC); + break; + default: + do_control(vt, c); + break; + } + } + else { + size_t text_eaten = do_string(vt, bytes + pos, len - pos); + + if(text_eaten == 0) { + string_start = bytes + pos; + goto pause; + } + + pos += (text_eaten - 1); // we'll ++ it again in a moment + } + break; + } + } + +pause: + if(string_start && string_start < len + bytes) { + size_t remaining = len - (string_start - bytes); + append_strbuffer(vt, string_start, remaining); + } +} diff --git a/src/apps/serialconnect/libvterm/src/pen.c b/src/apps/serialconnect/libvterm/src/pen.c new file mode 100644 index 0000000000..3f42b6051f --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/pen.c @@ -0,0 +1,373 @@ +#include "vterm_internal.h" + +#include + +static const VTermColor ansi_colors[] = { + /* R G B */ + { 0, 0, 0 }, // black + { 224, 0, 0 }, // red + { 0, 224, 0 }, // green + { 224, 224, 0 }, // yellow + { 0, 0, 224 }, // blue + { 224, 0, 224 }, // magenta + { 0, 224, 224 }, // cyan + { 224, 224, 224 }, // white == light grey + + // high intensity + { 128, 128, 128 }, // black + { 255, 64, 64 }, // red + { 64, 255, 64 }, // green + { 255, 255, 64 }, // yellow + { 64, 64, 255 }, // blue + { 255, 64, 255 }, // magenta + { 64, 255, 255 }, // cyan + { 255, 255, 255 }, // white for real +}; + +static int ramp6[] = { + 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF, +}; + +static int ramp24[] = { + 0x00, 0x0B, 0x16, 0x21, 0x2C, 0x37, 0x42, 0x4D, 0x58, 0x63, 0x6E, 0x79, + 0x85, 0x90, 0x9B, 0xA6, 0xB1, 0xBC, 0xC7, 0xD2, 0xDD, 0xE8, 0xF3, 0xFF, +}; + +static void lookup_colour_ansi(long index, char is_bg, VTermColor *col) +{ + if(index >= 0 && index < 16) { + *col = ansi_colors[index]; + } +} + +static int lookup_colour(int palette, const long args[], int argcount, char is_bg, VTermColor *col) +{ + long index; + + switch(palette) { + case 2: // RGB mode - 3 args contain colour values directly + if(argcount < 3) + return argcount; + + col->red = CSI_ARG(args[0]); + col->green = CSI_ARG(args[1]); + col->blue = CSI_ARG(args[2]); + + return 3; + + case 5: // XTerm 256-colour mode + index = argcount ? CSI_ARG_OR(args[0], -1) : -1; + + if(index >= 0 && index < 16) { + // Normal 8 colours or high intensity - parse as palette 0 + lookup_colour_ansi(index, is_bg, col); + } + else if(index >= 16 && index < 232) { + // 216-colour cube + index -= 16; + + col->blue = ramp6[index % 6]; + col->green = ramp6[index/6 % 6]; + col->red = ramp6[index/6/6 % 6]; + } + else if(index >= 232 && index < 256) { + // 24 greyscales + index -= 232; + + col->red = ramp24[index]; + col->green = ramp24[index]; + col->blue = ramp24[index]; + } + + return argcount ? 1 : 0; + + default: + fprintf(stderr, "Unrecognised colour palette %d\n", palette); + return 0; + } +} + +// Some conveniences + +static void setpenattr(VTermState *state, VTermAttr attr, VTermValueType type, VTermValue *val) +{ +#ifdef DEBUG + if(type != vterm_get_attr_type(attr)) { + fprintf(stderr, "Cannot set attr %d as it has type %d, not type %d\n", + attr, vterm_get_attr_type(attr), type); + return; + } +#endif + if(state->callbacks && state->callbacks->setpenattr) + (*state->callbacks->setpenattr)(attr, val, state->cbdata); +} + +static void setpenattr_bool(VTermState *state, VTermAttr attr, int boolean) +{ + VTermValue val = { .boolean = boolean }; + setpenattr(state, attr, VTERM_VALUETYPE_BOOL, &val); +} + +static void setpenattr_int(VTermState *state, VTermAttr attr, int number) +{ + VTermValue val = { .number = number }; + setpenattr(state, attr, VTERM_VALUETYPE_INT, &val); +} + +static void setpenattr_col(VTermState *state, VTermAttr attr, VTermColor color) +{ + VTermValue val = { .color = color }; + setpenattr(state, attr, VTERM_VALUETYPE_COLOR, &val); +} + +static void set_pen_col_ansi(VTermState *state, VTermAttr attr, long col) +{ + VTermColor *colp = (attr == VTERM_ATTR_BACKGROUND) ? &state->pen.bg : &state->pen.fg; + + lookup_colour_ansi(col, attr == VTERM_ATTR_BACKGROUND, colp); + + setpenattr_col(state, attr, *colp); +} + +void vterm_state_resetpen(VTermState *state) +{ + state->pen.bold = 0; setpenattr_bool(state, VTERM_ATTR_BOLD, 0); + state->pen.underline = 0; setpenattr_int( state, VTERM_ATTR_UNDERLINE, 0); + state->pen.italic = 0; setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); + state->pen.blink = 0; setpenattr_bool(state, VTERM_ATTR_BLINK, 0); + state->pen.reverse = 0; setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); + state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); + state->pen.font = 0; setpenattr_int( state, VTERM_ATTR_FONT, 0); + + state->fg_ansi = -1; + state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->default_fg); + state->pen.bg = state->default_bg; setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->default_bg); +} + +void vterm_state_savepen(VTermState *state, int save) +{ + if(save) { + state->saved.pen = state->pen; + } + else { + state->pen = state->saved.pen; + + setpenattr_bool(state, VTERM_ATTR_BOLD, state->pen.bold); + setpenattr_int( state, VTERM_ATTR_UNDERLINE, state->pen.underline); + setpenattr_bool(state, VTERM_ATTR_ITALIC, state->pen.italic); + setpenattr_bool(state, VTERM_ATTR_BLINK, state->pen.blink); + setpenattr_bool(state, VTERM_ATTR_REVERSE, state->pen.reverse); + setpenattr_bool(state, VTERM_ATTR_STRIKE, state->pen.strike); + setpenattr_int( state, VTERM_ATTR_FONT, state->pen.font); + setpenattr_col( state, VTERM_ATTR_FOREGROUND, state->pen.fg); + setpenattr_col( state, VTERM_ATTR_BACKGROUND, state->pen.bg); + } +} + +void vterm_state_set_default_colors(VTermState *state, VTermColor *default_fg, VTermColor *default_bg) +{ + state->default_fg = *default_fg; + state->default_bg = *default_bg; +} + +void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright) +{ + state->bold_is_highbright = bold_is_highbright; +} + +void vterm_state_setpen(VTermState *state, const long args[], int argcount) +{ + // SGR - ECMA-48 8.3.117 + + int argi = 0; + int value; + + while(argi < argcount) { + // This logic is easier to do 'done' backwards; set it true, and make it + // false again in the 'default' case + int done = 1; + + long arg; + switch(arg = CSI_ARG(args[argi])) { + case CSI_ARG_MISSING: + case 0: // Reset + vterm_state_resetpen(state); + break; + + case 1: // Bold on + state->pen.bold = 1; + setpenattr_bool(state, VTERM_ATTR_BOLD, 1); + if(state->fg_ansi > -1 && state->bold_is_highbright) + set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, state->fg_ansi + (state->pen.bold ? 8 : 0)); + break; + + case 3: // Italic on + state->pen.italic = 1; + setpenattr_bool(state, VTERM_ATTR_ITALIC, 1); + break; + + case 4: // Underline single + state->pen.underline = 1; + setpenattr_int(state, VTERM_ATTR_UNDERLINE, 1); + break; + + case 5: // Blink + state->pen.blink = 1; + setpenattr_bool(state, VTERM_ATTR_BLINK, 1); + break; + + case 7: // Reverse on + state->pen.reverse = 1; + setpenattr_bool(state, VTERM_ATTR_REVERSE, 1); + break; + + case 9: // Strikethrough on + state->pen.strike = 1; + setpenattr_bool(state, VTERM_ATTR_STRIKE, 1); + break; + + case 10: case 11: case 12: case 13: case 14: + case 15: case 16: case 17: case 18: case 19: // Select font + state->pen.font = CSI_ARG(args[argi]) - 10; + setpenattr_int(state, VTERM_ATTR_FONT, state->pen.font); + break; + + case 21: // Underline double + state->pen.underline = 2; + setpenattr_int(state, VTERM_ATTR_UNDERLINE, 2); + break; + + case 22: // Bold off + state->pen.bold = 0; + setpenattr_bool(state, VTERM_ATTR_BOLD, 0); + break; + + case 23: // Italic and Gothic (currently unsupported) off + state->pen.italic = 0; + setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); + break; + + case 24: // Underline off + state->pen.underline = 0; + setpenattr_int(state, VTERM_ATTR_UNDERLINE, 0); + break; + + case 25: // Blink off + state->pen.blink = 0; + setpenattr_bool(state, VTERM_ATTR_BLINK, 0); + break; + + case 27: // Reverse off + state->pen.reverse = 0; + setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); + break; + + case 29: // Strikethrough off + state->pen.strike = 0; + setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); + break; + + case 30: case 31: case 32: case 33: + case 34: case 35: case 36: case 37: // Foreground colour palette + value = CSI_ARG(args[argi]) - 30; + state->fg_ansi = value; + if(state->pen.bold && state->bold_is_highbright) + value += 8; + set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); + break; + + case 38: // Foreground colour alternative palette + state->fg_ansi = -1; + if(argcount - argi < 1) + return; + argi += 1 + lookup_colour(CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, 0, &state->pen.fg); + setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); + break; + + case 39: // Foreground colour default + state->fg_ansi = -1; + state->pen.fg = state->default_fg; + setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); + break; + + case 40: case 41: case 42: case 43: + case 44: case 45: case 46: case 47: // Background colour palette + set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, CSI_ARG(args[argi]) - 40); + break; + + case 48: // Background colour alternative palette + if(argcount - argi < 1) + return; + argi += 1 + lookup_colour(CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, 1, &state->pen.bg); + setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); + break; + + case 49: // Default background + state->pen.bg = state->default_bg; + setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); + break; + + case 90: case 91: case 92: case 93: + case 94: case 95: case 96: case 97: // Foreground colour high-intensity palette + set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, CSI_ARG(args[argi]) - 90 + 8); + break; + + case 100: case 101: case 102: case 103: + case 104: case 105: case 106: case 107: // Background colour high-intensity palette + set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, CSI_ARG(args[argi]) - 100 + 8); + break; + + default: + done = 0; + break; + } + + if(!done) + fprintf(stderr, "libvterm: Unhandled CSI SGR %lu\n", arg); + + while(CSI_ARG_HAS_MORE(args[argi++])); + } +} + +int vterm_state_get_penattr(VTermState *state, VTermAttr attr, VTermValue *val) +{ + switch(attr) { + case VTERM_ATTR_BOLD: + val->boolean = state->pen.bold; + return 1; + + case VTERM_ATTR_UNDERLINE: + val->number = state->pen.underline; + return 1; + + case VTERM_ATTR_ITALIC: + val->boolean = state->pen.italic; + return 1; + + case VTERM_ATTR_BLINK: + val->boolean = state->pen.blink; + return 1; + + case VTERM_ATTR_REVERSE: + val->boolean = state->pen.reverse; + return 1; + + case VTERM_ATTR_STRIKE: + val->boolean = state->pen.strike; + return 1; + + case VTERM_ATTR_FONT: + val->number = state->pen.font; + return 1; + + case VTERM_ATTR_FOREGROUND: + val->color = state->pen.fg; + return 1; + + case VTERM_ATTR_BACKGROUND: + val->color = state->pen.bg; + return 1; + } + + return 0; +} diff --git a/src/apps/serialconnect/libvterm/src/rect.h b/src/apps/serialconnect/libvterm/src/rect.h new file mode 100644 index 0000000000..2114f24c1b --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/rect.h @@ -0,0 +1,56 @@ +/* + * Some utility functions on VTermRect structures + */ + +#define STRFrect "(%d,%d-%d,%d)" +#define ARGSrect(r) (r).start_row, (r).start_col, (r).end_row, (r).end_col + +/* Expand dst to contain src as well */ +static void rect_expand(VTermRect *dst, VTermRect *src) +{ + if(dst->start_row > src->start_row) dst->start_row = src->start_row; + if(dst->start_col > src->start_col) dst->start_col = src->start_col; + if(dst->end_row < src->end_row) dst->end_row = src->end_row; + if(dst->end_col < src->end_col) dst->end_col = src->end_col; +} + +/* Clip the dst to ensure it does not step outside of bounds */ +static void rect_clip(VTermRect *dst, VTermRect *bounds) +{ + if(dst->start_row < bounds->start_row) dst->start_row = bounds->start_row; + if(dst->start_col < bounds->start_col) dst->start_col = bounds->start_col; + if(dst->end_row > bounds->end_row) dst->end_row = bounds->end_row; + if(dst->end_col > bounds->end_col) dst->end_col = bounds->end_col; + /* Ensure it doesn't end up negatively-sized */ + if(dst->end_row < dst->start_row) dst->end_row = dst->start_row; + if(dst->end_col < dst->start_col) dst->end_col = dst->start_col; +} + +/* True if the two rectangles are equal */ +static int rect_equal(VTermRect *a, VTermRect *b) +{ + return (a->start_row == b->start_row) && + (a->start_col == b->start_col) && + (a->end_row == b->end_row) && + (a->end_col == b->end_col); +} + +/* True if small is contained entirely within big */ +static int rect_contains(VTermRect *big, VTermRect *small) +{ + if(small->start_row < big->start_row) return 0; + if(small->start_col < big->start_col) return 0; + if(small->end_row > big->end_row) return 0; + if(small->end_col > big->end_col) return 0; + return 1; +} + +/* True if the rectangles overlap at all */ +static int rect_intersects(VTermRect *a, VTermRect *b) +{ + if(a->start_row > b->end_row || b->start_row > a->end_row) + return 0; + if(a->start_col > b->end_col || b->start_col > a->end_col) + return 0; + return 1; +} diff --git a/src/apps/serialconnect/libvterm/src/screen.c b/src/apps/serialconnect/libvterm/src/screen.c new file mode 100644 index 0000000000..439d586530 --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/screen.c @@ -0,0 +1,664 @@ +#include "vterm_internal.h" + +#include + +#include "rect.h" +#include "utf8.h" + +#define UNICODE_SPACE 0x20 +#define UNICODE_LINEFEED 0x0a + +/* State of the pen at some moment in time, also used in a cell */ +typedef struct +{ + /* After the bitfield */ + VTermColor fg, bg; + + unsigned int bold : 1; + unsigned int underline : 2; + unsigned int italic : 1; + unsigned int blink : 1; + unsigned int reverse : 1; + unsigned int strike : 1; + unsigned int font : 4; /* 0 to 9 */ +} ScreenPen; + +/* Internal representation of a screen cell */ +typedef struct +{ + uint32_t chars[VTERM_MAX_CHARS_PER_CELL]; + ScreenPen pen; +} ScreenCell; + +struct VTermScreen +{ + VTerm *vt; + VTermState *state; + + const VTermScreenCallbacks *callbacks; + void *cbdata; + + VTermDamageSize damage_merge; + /* start_row == -1 => no damage */ + VTermRect damaged; + VTermRect pending_scrollrect; + int pending_scroll_downward, pending_scroll_rightward; + + int rows; + int cols; + int global_reverse; + + /* Primary and Altscreen. buffers[1] is lazily allocated as needed */ + ScreenCell *buffers[2]; + + /* buffer will == buffers[0] or buffers[1], depending on altscreen */ + ScreenCell *buffer; + + ScreenPen pen; +}; + +static inline ScreenCell *getcell(VTermScreen *screen, int row, int col) +{ + /* TODO: Bounds checking */ + return screen->buffer + (screen->cols * row) + col; +} + +static ScreenCell *realloc_buffer(VTermScreen *screen, ScreenCell *buffer, int new_rows, int new_cols) +{ + ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols); + int row, col; + + for(row = 0; row < new_rows; row++) { + for(col = 0; col < new_cols; col++) { + ScreenCell *new_cell = new_buffer + row*new_cols + col; + + if(buffer && row < screen->rows && col < screen->cols) + *new_cell = buffer[row * screen->cols + col]; + else { + new_cell->chars[0] = 0; + new_cell->pen = screen->pen; + } + } + } + + if(buffer) + vterm_allocator_free(screen->vt, buffer); + + return new_buffer; +} + +static void damagerect(VTermScreen *screen, VTermRect rect) +{ + VTermRect emit; + + switch(screen->damage_merge) { + case VTERM_DAMAGE_CELL: + /* Always emit damage event */ + emit = rect; + break; + + case VTERM_DAMAGE_ROW: + /* Emit damage longer than one row. Try to merge with existing damage in + * the same row */ + if(rect.end_row > rect.start_row + 1) { + // Bigger than 1 line - flush existing, emit this + vterm_screen_flush_damage(screen); + emit = rect; + } + else if(screen->damaged.start_row == -1) { + // None stored yet + screen->damaged = rect; + return; + } + else if(rect.start_row == screen->damaged.start_row) { + // Merge with the stored line + if(screen->damaged.start_col > rect.start_col) + screen->damaged.start_col = rect.start_col; + if(screen->damaged.end_col < rect.end_col) + screen->damaged.end_col = rect.end_col; + return; + } + else { + // Emit the currently stored line, store a new one + emit = screen->damaged; + screen->damaged = rect; + } + break; + + case VTERM_DAMAGE_SCREEN: + case VTERM_DAMAGE_SCROLL: + /* Never emit damage event */ + if(screen->damaged.start_row == -1) + screen->damaged = rect; + else { + rect_expand(&screen->damaged, &rect); + } + return; + + default: + fprintf(stderr, "TODO: Maybe merge damage for level %d\n", screen->damage_merge); + return; + } + + if(screen->callbacks && screen->callbacks->damage) + (*screen->callbacks->damage)(emit, screen->cbdata); +} + +static void damagescreen(VTermScreen *screen) +{ + VTermRect rect = { + .start_row = 0, + .end_row = screen->rows, + .start_col = 0, + .end_col = screen->cols, + }; + + damagerect(screen, rect); +} + +static int putglyph(const uint32_t chars[], int width, VTermPos pos, void *user) +{ + VTermScreen *screen = user; + ScreenCell *cell = getcell(screen, pos.row, pos.col); + int i; + int col; + + VTermRect rect = { + .start_row = pos.row, + .end_row = pos.row+1, + .start_col = pos.col, + .end_col = pos.col+width, + }; + + for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && chars[i]; i++) { + cell->chars[i] = chars[i]; + cell->pen = screen->pen; + } + if(i < VTERM_MAX_CHARS_PER_CELL) + cell->chars[i] = 0; + + for(col = 1; col < width; col++) + getcell(screen, pos.row, pos.col + col)->chars[0] = (uint32_t)-1; + + damagerect(screen, rect); + + return 1; +} + +static void copycell(VTermPos dest, VTermPos src, void *user) +{ + VTermScreen *screen = user; + ScreenCell *destcell = getcell(screen, dest.row, dest.col); + ScreenCell *srccell = getcell(screen, src.row, src.col); + + *destcell = *srccell; +} + +static int moverect_internal(VTermRect dest, VTermRect src, void *user) +{ + VTermScreen *screen = user; + + vterm_copy_cells(dest, src, ©cell, screen); + + return 1; +} + +static int moverect_user(VTermRect dest, VTermRect src, void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->moverect) { + if(screen->damage_merge != VTERM_DAMAGE_SCROLL) + // Avoid an infinite loop + vterm_screen_flush_damage(screen); + + if((*screen->callbacks->moverect)(dest, src, screen->cbdata)) + return 1; + } + + damagerect(screen, dest); + + return 1; +} + +static int erase_internal(VTermRect rect, void *user) +{ + VTermScreen *screen = user; + int row, col; + + for(row = rect.start_row; row < rect.end_row; row++) + for(col = rect.start_col; col < rect.end_col; col++) { + ScreenCell *cell = getcell(screen, row, col); + cell->chars[0] = 0; + cell->pen = screen->pen; + } + + return 1; +} + +static int erase_user(VTermRect rect, void *user) +{ + VTermScreen *screen = user; + + damagerect(screen, rect); + + return 1; +} + +static int erase(VTermRect rect, void *user) +{ + erase_internal(rect, user); + return erase_user(rect, user); +} + +static int scrollrect(VTermRect rect, int downward, int rightward, void *user) +{ + VTermScreen *screen = user; + + vterm_scroll_rect(rect, downward, rightward, + moverect_internal, erase_internal, screen); + + if(screen->damage_merge == VTERM_DAMAGE_SCROLL) { + if(screen->damaged.start_row != -1 && + !rect_intersects(&rect, &screen->damaged)) { + vterm_screen_flush_damage(screen); + } + + if(screen->pending_scrollrect.start_row == -1) { + screen->pending_scrollrect = rect; + screen->pending_scroll_downward = downward; + screen->pending_scroll_rightward = rightward; + } + else if(rect_equal(&screen->pending_scrollrect, &rect) && + ((screen->pending_scroll_downward == 0 && downward == 0) || + (screen->pending_scroll_rightward == 0 && rightward == 0))) { + screen->pending_scroll_downward += downward; + screen->pending_scroll_rightward += rightward; + } + else { + vterm_screen_flush_damage(screen); + + screen->pending_scrollrect = rect; + screen->pending_scroll_downward = downward; + screen->pending_scroll_rightward = rightward; + } + + if(screen->damaged.start_row != -1) { + if(rect_contains(&rect, &screen->damaged)) { + vterm_rect_move(&screen->damaged, -downward, -rightward); + rect_clip(&screen->damaged, &rect); + } + else { + fprintf(stderr, "TODO: scrollrect split damage\n"); + } + } + + return 1; + } + + vterm_screen_flush_damage(screen); + + vterm_scroll_rect(rect, downward, rightward, + moverect_user, erase_user, screen); + + return 1; +} + +static int movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->movecursor) + return (*screen->callbacks->movecursor)(pos, oldpos, visible, screen->cbdata); + + return 0; +} + +static int setpenattr(VTermAttr attr, VTermValue *val, void *user) +{ + VTermScreen *screen = user; + + switch(attr) { + case VTERM_ATTR_BOLD: + screen->pen.bold = val->boolean; + return 1; + case VTERM_ATTR_UNDERLINE: + screen->pen.underline = val->number; + return 1; + case VTERM_ATTR_ITALIC: + screen->pen.italic = val->boolean; + return 1; + case VTERM_ATTR_BLINK: + screen->pen.blink = val->boolean; + return 1; + case VTERM_ATTR_REVERSE: + screen->pen.reverse = val->boolean; + return 1; + case VTERM_ATTR_STRIKE: + screen->pen.strike = val->boolean; + return 1; + case VTERM_ATTR_FONT: + screen->pen.font = val->number; + return 1; + case VTERM_ATTR_FOREGROUND: + screen->pen.fg = val->color; + return 1; + case VTERM_ATTR_BACKGROUND: + screen->pen.bg = val->color; + return 1; + } + + return 0; +} + +static int settermprop(VTermProp prop, VTermValue *val, void *user) +{ + VTermScreen *screen = user; + + switch(prop) { + case VTERM_PROP_ALTSCREEN: + if(val->boolean && !screen->buffers[1]) + return 0; + + screen->buffer = val->boolean ? screen->buffers[1] : screen->buffers[0]; + /* only send a damage event on disable; because during enable there's an + * erase that sends a damage anyway + */ + if(!val->boolean) + damagescreen(screen); + break; + case VTERM_PROP_REVERSE: + screen->global_reverse = val->boolean; + damagescreen(screen); + break; + default: + ; /* ignore */ + } + + if(screen->callbacks && screen->callbacks->settermprop) + return (*screen->callbacks->settermprop)(prop, val, screen->cbdata); + + return 1; +} + +static int setmousefunc(VTermMouseFunc func, void *data, void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->setmousefunc) + return (*screen->callbacks->setmousefunc)(func, data, screen->cbdata); + + return 0; +} + +static int bell(void *user) +{ + VTermScreen *screen = user; + + if(screen->callbacks && screen->callbacks->bell) + return (*screen->callbacks->bell)(screen->cbdata); + + return 0; +} + +static int resize(int new_rows, int new_cols, void *user) +{ + VTermScreen *screen = user; + int old_rows, old_cols; + + int is_altscreen = (screen->buffers[1] && screen->buffer == screen->buffers[1]); + + screen->buffers[0] = realloc_buffer(screen, screen->buffers[0], new_rows, new_cols); + if(screen->buffers[1]) + screen->buffers[1] = realloc_buffer(screen, screen->buffers[1], new_rows, new_cols); + + screen->buffer = is_altscreen ? screen->buffers[1] : screen->buffers[0]; + + old_rows = screen->rows; + old_cols = screen->cols; + + screen->rows = new_rows; + screen->cols = new_cols; + + if(new_cols > old_cols) { + VTermRect rect = { + .start_row = 0, + .end_row = old_rows, + .start_col = old_cols, + .end_col = new_cols, + }; + damagerect(screen, rect); + } + + if(new_rows > old_rows) { + VTermRect rect = { + .start_row = old_rows, + .end_row = new_rows, + .start_col = 0, + .end_col = new_cols, + }; + damagerect(screen, rect); + } + + if(screen->callbacks && screen->callbacks->resize) + return (*screen->callbacks->resize)(new_rows, new_cols, screen->cbdata); + + return 1; +} + +static VTermStateCallbacks state_cbs = { + .putglyph = &putglyph, + .movecursor = &movecursor, + .scrollrect = &scrollrect, + .erase = &erase, + .setpenattr = &setpenattr, + .settermprop = &settermprop, + .setmousefunc = &setmousefunc, + .bell = &bell, + .resize = &resize, +}; + +static VTermScreen *screen_new(VTerm *vt) +{ + VTermState *state = vterm_obtain_state(vt); + VTermScreen *screen; + int rows, cols; + + if(!state) + return NULL; + + screen = vterm_allocator_malloc(vt, sizeof(VTermScreen)); + + vterm_get_size(vt, &rows, &cols); + + screen->vt = vt; + screen->state = state; + + screen->damage_merge = VTERM_DAMAGE_CELL; + screen->damaged.start_row = -1; + screen->pending_scrollrect.start_row = -1; + + screen->rows = rows; + screen->cols = cols; + + screen->buffers[0] = realloc_buffer(screen, NULL, rows, cols); + + screen->buffer = screen->buffers[0]; + + vterm_state_set_callbacks(screen->state, &state_cbs, screen); + + return screen; +} + +void vterm_screen_free(VTermScreen *screen) +{ + vterm_allocator_free(screen->vt, screen->buffers[0]); + if(screen->buffers[1]) + vterm_allocator_free(screen->vt, screen->buffers[1]); + + vterm_allocator_free(screen->vt, screen); +} + +void vterm_screen_reset(VTermScreen *screen, int hard) +{ + screen->damaged.start_row = -1; + screen->pending_scrollrect.start_row = -1; + vterm_state_reset(screen->state, hard); + vterm_screen_flush_damage(screen); +} + +static size_t _get_chars(VTermScreen *screen, const int utf8, void *buffer, size_t len, const VTermRect rect) +{ + size_t outpos = 0; + int padding = 0; + int row, col; + int i; + +#define PUT(c) \ + if(utf8) { \ + size_t thislen = utf8_seqlen(c); \ + if(buffer && outpos + thislen <= len) \ + outpos += fill_utf8((c), (char *)buffer + outpos); \ + else \ + outpos += thislen; \ + } \ + else { \ + if(buffer && outpos + 1 <= len) \ + ((uint32_t*)buffer)[outpos++] = (c); \ + else \ + outpos++; \ + } + + for(row = rect.start_row; row < rect.end_row; row++) { + for(col = rect.start_col; col < rect.end_col; col++) { + ScreenCell *cell = getcell(screen, row, col); + + if(cell->chars[0] == 0) + // Erased cell, might need a space + padding++; + else if(cell->chars[0] == (uint32_t)-1) + // Gap behind a double-width char, do nothing + ; + else { + while(padding) { + PUT(UNICODE_SPACE); + padding--; + } + for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell->chars[i]; i++) { + PUT(cell->chars[i]); + } + } + } + + if(row < rect.end_row - 1) { + PUT(UNICODE_LINEFEED); + padding = 0; + } + } + + return outpos; +} + +size_t vterm_screen_get_chars(VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect) +{ + return _get_chars(screen, 0, chars, len, rect); +} + +size_t vterm_screen_get_text(VTermScreen *screen, char *str, size_t len, const VTermRect rect) +{ + return _get_chars(screen, 1, str, len, rect); +} + +/* Copy internal to external representation of a screen cell */ +void vterm_screen_get_cell(VTermScreen *screen, VTermPos pos, VTermScreenCell *cell) +{ + ScreenCell *intcell = getcell(screen, pos.row, pos.col); + int i; + + for(i = 0; ; i++) { + cell->chars[i] = intcell->chars[i]; + if(!intcell->chars[i]) + break; + } + + cell->attrs.bold = intcell->pen.bold; + cell->attrs.underline = intcell->pen.underline; + cell->attrs.italic = intcell->pen.italic; + cell->attrs.blink = intcell->pen.blink; + cell->attrs.reverse = intcell->pen.reverse ^ screen->global_reverse; + cell->attrs.strike = intcell->pen.strike; + cell->attrs.font = intcell->pen.font; + + cell->fg = intcell->pen.fg; + cell->bg = intcell->pen.bg; + + if(pos.col < (screen->cols - 1) && + getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) + cell->width = 2; + else + cell->width = 1; +} + +int vterm_screen_is_eol(VTermScreen *screen, VTermPos pos) +{ + /* This cell is EOL if this and every cell to the right is black */ + for(; pos.col < screen->cols; pos.col++) { + ScreenCell *cell = getcell(screen, pos.row, pos.col); + if(cell->chars[0] != 0) + return 0; + } + + return 1; +} + +VTermScreen *vterm_obtain_screen(VTerm *vt) +{ + VTermScreen *screen; + if(vt->screen) + return vt->screen; + + screen = screen_new(vt); + vt->screen = screen; + + return screen; +} + +void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen) +{ + + if(!screen->buffers[1] && altscreen) { + int rows, cols; + vterm_get_size(screen->vt, &rows, &cols); + + screen->buffers[1] = realloc_buffer(screen, NULL, rows, cols); + } +} + +void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user) +{ + screen->callbacks = callbacks; + screen->cbdata = user; +} + +void vterm_screen_flush_damage(VTermScreen *screen) +{ + if(screen->pending_scrollrect.start_row != -1) { + vterm_scroll_rect(screen->pending_scrollrect, screen->pending_scroll_downward, screen->pending_scroll_rightward, + moverect_user, erase_user, screen); + + screen->pending_scrollrect.start_row = -1; + } + + if(screen->damaged.start_row != -1) { + if(screen->callbacks && screen->callbacks->damage) + (*screen->callbacks->damage)(screen->damaged, screen->cbdata); + + screen->damaged.start_row = -1; + } +} + +void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size) +{ + vterm_screen_flush_damage(screen); + screen->damage_merge = size; +} diff --git a/src/apps/serialconnect/libvterm/src/state.c b/src/apps/serialconnect/libvterm/src/state.c new file mode 100644 index 0000000000..47c0a49575 --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/state.c @@ -0,0 +1,1416 @@ +#include "vterm_internal.h" + +#include +#include + +#define strneq(a,b,n) (strncmp(a,b,n)==0) + +#include "utf8.h" + +#ifdef DEBUG +# define DEBUG_GLYPH_COMBINE +#endif + +#define MOUSE_WANT_DRAG 0x01 +#define MOUSE_WANT_MOVE 0x02 + +/* Some convenient wrappers to make callback functions easier */ + +static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos) +{ + if(state->callbacks && state->callbacks->putglyph) + if((*state->callbacks->putglyph)(chars, width, pos, state->cbdata)) + return; + + fprintf(stderr, "libvterm: Unhandled putglyph U+%04x at (%d,%d)\n", chars[0], pos.col, pos.row); +} + +static void updatecursor(VTermState *state, VTermPos *oldpos, int cancel_phantom) +{ + if(state->pos.col == oldpos->col && state->pos.row == oldpos->row) + return; + + if(cancel_phantom) + state->at_phantom = 0; + + if(state->callbacks && state->callbacks->movecursor) + if((*state->callbacks->movecursor)(state->pos, *oldpos, state->mode.cursor_visible, state->cbdata)) + return; +} + +static void erase(VTermState *state, VTermRect rect) +{ + if(state->callbacks && state->callbacks->erase) + if((*state->callbacks->erase)(rect, state->cbdata)) + return; +} + +static VTermState *vterm_state_new(VTerm *vt) +{ + VTermState *state = vterm_allocator_malloc(vt, sizeof(VTermState)); + + state->vt = vt; + + state->rows = vt->rows; + state->cols = vt->cols; + + // 90% grey so that pure white is brighter + state->default_fg.red = state->default_fg.green = state->default_fg.blue = 240; + state->default_bg.red = state->default_bg.green = state->default_bg.blue = 0; + + state->bold_is_highbright = 0; + + return state; +} + +void vterm_state_free(VTermState *state) +{ + vterm_allocator_free(state->vt, state->combine_chars); + vterm_allocator_free(state->vt, state); +} + +static void scroll(VTermState *state, VTermRect rect, int downward, int rightward) +{ + if(!downward && !rightward) + return; + + if(state->callbacks && state->callbacks->scrollrect) + if((*state->callbacks->scrollrect)(rect, downward, rightward, state->cbdata)) + return; + + if(state->callbacks) + vterm_scroll_rect(rect, downward, rightward, + state->callbacks->moverect, state->callbacks->erase, state->cbdata); +} + +static void linefeed(VTermState *state) +{ + if(state->pos.row == SCROLLREGION_END(state) - 1) { + VTermRect rect = { + .start_row = state->scrollregion_start, + .end_row = SCROLLREGION_END(state), + .start_col = 0, + .end_col = state->cols, + }; + + scroll(state, rect, 1, 0); + } + else if(state->pos.row < state->rows-1) + state->pos.row++; +} + +static void grow_combine_buffer(VTermState *state) +{ + size_t new_size = state->combine_chars_size * 2; + uint32_t *new_chars = vterm_allocator_malloc(state->vt, new_size * sizeof(new_chars[0])); + + memcpy(new_chars, state->combine_chars, state->combine_chars_size * sizeof(new_chars[0])); + + vterm_allocator_free(state->vt, state->combine_chars); + state->combine_chars = new_chars; +} + +static void set_col_tabstop(VTermState *state, int col) +{ + unsigned char mask = 1 << (col & 7); + state->tabstops[col >> 3] |= mask; +} + +static void clear_col_tabstop(VTermState *state, int col) +{ + unsigned char mask = 1 << (col & 7); + state->tabstops[col >> 3] &= ~mask; +} + +static int is_col_tabstop(VTermState *state, int col) +{ + unsigned char mask = 1 << (col & 7); + return state->tabstops[col >> 3] & mask; +} + +static void tab(VTermState *state, int count, int direction) +{ + while(count--) + while(state->pos.col >= 0 && state->pos.col < state->cols-1) { + state->pos.col += direction; + + if(is_col_tabstop(state, state->pos.col)) + break; + } +} + +static int on_text(const char bytes[], size_t len, void *user) +{ + VTermState *state = user; + uint32_t* chars; + + VTermPos oldpos = state->pos; + + // We'll have at most len codepoints + uint32_t codepoints[len]; + int npoints = 0; + size_t eaten = 0; + int i = 0; + + VTermEncodingInstance *encoding = + !(bytes[eaten] & 0x80) ? &state->encoding[state->gl_set] : + state->vt->is_utf8 ? &state->encoding_utf8 : + &state->encoding[state->gr_set]; + + (*encoding->enc->decode)(encoding->enc, encoding->data, + codepoints, &npoints, len, bytes, &eaten, len); + + /* This is a combining char. that needs to be merged with the previous + * glyph output */ + if(vterm_unicode_is_combining(codepoints[i])) { + /* See if the cursor has moved since */ + if(state->pos.row == state->combine_pos.row && state->pos.col == state->combine_pos.col + state->combine_width) { + size_t saved_i = 0; +#ifdef DEBUG_GLYPH_COMBINE + int printpos; + printf("DEBUG: COMBINING SPLIT GLYPH of chars {"); + for(printpos = 0; state->combine_chars[printpos]; printpos++) + printf("U+%04x ", state->combine_chars[printpos]); + printf("} + {"); +#endif + + /* Find where we need to append these combining chars */ + while(state->combine_chars[saved_i]) + saved_i++; + + /* Add extra ones */ + while(i < npoints && vterm_unicode_is_combining(codepoints[i])) { + if(saved_i >= state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[saved_i++] = codepoints[i++]; + } + if(saved_i >= state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[saved_i] = 0; + +#ifdef DEBUG_GLYPH_COMBINE + for(; state->combine_chars[printpos]; printpos++) + printf("U+%04x ", state->combine_chars[printpos]); + printf("}\n"); +#endif + + /* Now render it */ + putglyph(state, state->combine_chars, state->combine_width, state->combine_pos); + } + else { + fprintf(stderr, "libvterm: TODO: Skip over split char+combining\n"); + } + } + + for(; i < npoints; i++) { + // Try to find combining characters following this + int glyph_starts = i; + int glyph_ends; + int width = 0; + + for(glyph_ends = i + 1; glyph_ends < npoints; glyph_ends++) + if(!vterm_unicode_is_combining(codepoints[glyph_ends])) + break; + + chars = alloca(sizeof(uint32_t) * (glyph_ends - glyph_starts + 1)); + + for( ; i < glyph_ends; i++) { + chars[i - glyph_starts] = codepoints[i]; + width += vterm_unicode_width(codepoints[i]); + } + + chars[glyph_ends - glyph_starts] = 0; + i--; + +#ifdef DEBUG_GLYPH_COMBINE + { + int printpos; + printf("DEBUG: COMBINED GLYPH of %d chars {", glyph_ends - glyph_starts); + for(printpos = 0; printpos < glyph_ends - glyph_starts; printpos++) + printf("U+%04x ", chars[printpos]); + printf("}, onscreen width %d\n", width); + } +#endif + + if(state->at_phantom) { + linefeed(state); + state->pos.col = 0; + state->at_phantom = 0; + } + + if(state->mode.insert) { + /* TODO: This will be a little inefficient for large bodies of text, as + * it'll have to 'ICH' effectively before every glyph. We should scan + * ahead and ICH as many times as required + */ + VTermRect rect = { + .start_row = state->pos.row, + .end_row = state->pos.row + 1, + .start_col = state->pos.col, + .end_col = state->cols, + }; + scroll(state, rect, 0, -1); + } + putglyph(state, chars, width, state->pos); + + if(i == npoints - 1) { + /* End of the buffer. Save the chars in case we have to combine with + * more on the next call */ + unsigned int save_i; + for(save_i = 0; chars[save_i]; save_i++) { + if(save_i >= state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[save_i] = chars[save_i]; + } + if(save_i >= state->combine_chars_size) + grow_combine_buffer(state); + state->combine_chars[save_i] = 0; + state->combine_width = width; + state->combine_pos = state->pos; + } + + if(state->pos.col + width >= state->cols) { + if(state->mode.autowrap) + state->at_phantom = 1; + } + else { + state->pos.col += width; + } + } + + updatecursor(state, &oldpos, 0); + + return eaten; +} + +static int on_control(unsigned char control, void *user) +{ + VTermState *state = user; + + VTermPos oldpos = state->pos; + + switch(control) { + case 0x07: // BEL - ECMA-48 8.3.3 + if(state->callbacks && state->callbacks->bell) + (*state->callbacks->bell)(state->cbdata); + break; + + case 0x08: // BS - ECMA-48 8.3.5 + if(state->pos.col > 0) + state->pos.col--; + break; + + case 0x09: // HT - ECMA-48 8.3.60 + tab(state, 1, +1); + break; + + case 0x0a: // LF - ECMA-48 8.3.74 + case 0x0b: // VT + case 0x0c: // FF + linefeed(state); + if(state->mode.newline) + state->pos.col = 0; + break; + + case 0x0d: // CR - ECMA-48 8.3.15 + state->pos.col = 0; + break; + + case 0x0e: // LS1 - ECMA-48 8.3.76 + state->gl_set = 1; + break; + + case 0x0f: // LS0 - ECMA-48 8.3.75 + state->gl_set = 0; + break; + + case 0x84: // IND - DEPRECATED but implemented for completeness + linefeed(state); + break; + + case 0x85: // NEL - ECMA-48 8.3.86 + linefeed(state); + state->pos.col = 0; + break; + + case 0x88: // HTS - ECMA-48 8.3.62 + set_col_tabstop(state, state->pos.col); + break; + + case 0x8d: // RI - ECMA-48 8.3.104 + if(state->pos.row == state->scrollregion_start) { + VTermRect rect = { + .start_row = state->scrollregion_start, + .end_row = SCROLLREGION_END(state), + .start_col = 0, + .end_col = state->cols, + }; + + scroll(state, rect, -1, 0); + } + else if(state->pos.row > 0) + state->pos.row--; + break; + + default: + return 0; + } + + updatecursor(state, &oldpos, 1); + + return 1; +} + +static void output_mouse(VTermState *state, int code, int pressed, int modifiers, int col, int row) +{ + modifiers <<= 2; + + switch(state->mouse_protocol) { + case MOUSE_X10: + if(col + 0x21 > 0xff) + col = 0xff - 0x21; + if(row + 0x21 > 0xff) + row = 0xff - 0x21; + + if(!pressed) + code = 3; + + vterm_push_output_sprintf(state->vt, "\e[M%c%c%c", + (code | modifiers) + 0x20, col + 0x21, row + 0x21); + break; + + case MOUSE_UTF8: + { + char utf8[18]; size_t len = 0; + + if(!pressed) + code = 3; + + len += fill_utf8((code | modifiers) + 0x20, utf8 + len); + len += fill_utf8(col + 0x21, utf8 + len); + len += fill_utf8(row + 0x21, utf8 + len); + + vterm_push_output_sprintf(state->vt, "\e[M%s", utf8); + } + break; + + case MOUSE_SGR: + vterm_push_output_sprintf(state->vt, "\e[<%d;%d;%d%c", + code | modifiers, col + 1, row + 1, pressed ? 'M' : 'm'); + break; + + case MOUSE_RXVT: + if(!pressed) + code = 3; + + vterm_push_output_sprintf(state->vt, "\e[%d;%d;%dM", + code | modifiers, col + 1, row + 1); + break; + } +} + +static void mousefunc(int col, int row, int button, int pressed, int modifiers, void *data) +{ + VTermState *state = data; + + int old_col = state->mouse_col; + int old_row = state->mouse_row; + int old_buttons = state->mouse_buttons; + + state->mouse_col = col; + state->mouse_row = row; + + if(button > 0 && button <= 3) { + if(pressed) + state->mouse_buttons |= (1 << (button-1)); + else + state->mouse_buttons &= ~(1 << (button-1)); + } + + modifiers &= 0x7; + + + /* Most of the time we don't get button releases from 4/5 */ + if(state->mouse_buttons != old_buttons || button >= 4) { + if(button < 4) { + output_mouse(state, button-1, pressed, modifiers, col, row); + } + else if(button < 6) { + output_mouse(state, button-4 + 0x40, pressed, modifiers, col, row); + } + } + else if(col != old_col || row != old_row) { + if((state->mouse_flags & MOUSE_WANT_DRAG && state->mouse_buttons) || + (state->mouse_flags & MOUSE_WANT_MOVE)) { + int button = state->mouse_buttons & 0x01 ? 1 : + state->mouse_buttons & 0x02 ? 2 : + state->mouse_buttons & 0x04 ? 3 : 4; + output_mouse(state, button-1 + 0x20, 1, modifiers, col, row); + } + } +} + +static int settermprop_bool(VTermState *state, VTermProp prop, int v) +{ + VTermValue val; + val.boolean = v; + +#ifdef DEBUG + if(VTERM_VALUETYPE_BOOL != vterm_get_prop_type(prop)) { + fprintf(stderr, "Cannot set prop %d as it has type %d, not type BOOL\n", + prop, vterm_get_prop_type(prop)); + return -1; + } +#endif + + if(state->callbacks && state->callbacks->settermprop) + if((*state->callbacks->settermprop)(prop, &val, state->cbdata)) + return 1; + + return 0; +} + +static int settermprop_int(VTermState *state, VTermProp prop, int v) +{ + VTermValue val; + val.number = v; + +#ifdef DEBUG + if(VTERM_VALUETYPE_INT != vterm_get_prop_type(prop)) { + fprintf(stderr, "Cannot set prop %d as it has type %d, not type int\n", + prop, vterm_get_prop_type(prop)); + return -1; + } +#endif + + if(state->callbacks && state->callbacks->settermprop) + if((*state->callbacks->settermprop)(prop, &val, state->cbdata)) + return 1; + + return 0; +} + +static int settermprop_string(VTermState *state, VTermProp prop, const char *str, size_t len) +{ + char strvalue[len+1]; + VTermValue val; + + strncpy(strvalue, str, len); + strvalue[len] = 0; + + val.string = strvalue; + +#ifdef DEBUG + if(VTERM_VALUETYPE_STRING != vterm_get_prop_type(prop)) { + fprintf(stderr, "Cannot set prop %d as it has type %d, not type STRING\n", + prop, vterm_get_prop_type(prop)); + return -1; + } +#endif + + if(state->callbacks && state->callbacks->settermprop) + if((*state->callbacks->settermprop)(prop, &val, state->cbdata)) + return 1; + + return 0; +} + +static void savecursor(VTermState *state, int save) +{ + if(save) { + state->saved.pos = state->pos; + state->saved.mode.cursor_visible = state->mode.cursor_visible; + state->saved.mode.cursor_blink = state->mode.cursor_blink; + state->saved.mode.cursor_shape = state->mode.cursor_shape; + + vterm_state_savepen(state, 1); + } + else { + VTermPos oldpos = state->pos; + + state->pos = state->saved.pos; + state->mode.cursor_visible = state->saved.mode.cursor_visible; + state->mode.cursor_blink = state->saved.mode.cursor_blink; + state->mode.cursor_shape = state->saved.mode.cursor_shape; + + settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, state->mode.cursor_visible); + settermprop_bool(state, VTERM_PROP_CURSORBLINK, state->mode.cursor_blink); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, state->mode.cursor_shape); + + vterm_state_savepen(state, 0); + + updatecursor(state, &oldpos, 1); + } +} + +static void altscreen(VTermState *state, int alt) +{ + /* Only store that we're on the alternate screen if the usercode said it + * switched */ + if(!settermprop_bool(state, VTERM_PROP_ALTSCREEN, alt)) + return; + + state->mode.alt_screen = alt; + if(alt) { + VTermRect rect = { + .start_row = 0, + .start_col = 0, + .end_row = state->rows, + .end_col = state->cols, + }; + erase(state, rect); + } +} + +static int on_escape(const char *bytes, size_t len, void *user) +{ + VTermState *state = user; + + /* Easier to decode this from the first byte, even though the final + * byte terminates it + */ + switch(bytes[0]) { + case '#': + if(len != 2) + return 0; + + switch(bytes[1]) { + case '8': // DECALN + { + VTermPos pos; + uint32_t E[] = { 'E', 0 }; + for(pos.row = 0; pos.row < state->rows; pos.row++) + for(pos.col = 0; pos.col < state->cols; pos.col++) + putglyph(state, E, 1, pos); + break; + } + + default: + return 0; + } + return 2; + + case '(': case ')': case '*': case '+': // SCS + if(len != 2) + return 0; + + { + int setnum = bytes[0] - 0x28; + VTermEncoding *newenc = vterm_lookup_encoding(ENC_SINGLE_94, bytes[1]); + + if(newenc) { + state->encoding[setnum].enc = newenc; + + if(newenc->init) + (*newenc->init)(newenc, state->encoding[setnum].data); + } + } + + return 2; + + case '7': // DECSC + savecursor(state, 1); + return 1; + + case '8': // DECRC + savecursor(state, 0); + return 1; + + case '=': // DECKPAM + state->mode.keypad = 1; + return 1; + + case '>': // DECKPNM + state->mode.keypad = 0; + return 1; + + case 'c': // RIS - ECMA-48 8.3.105 + { + VTermPos oldpos = state->pos; + vterm_state_reset(state, 1); + if(state->callbacks && state->callbacks->movecursor) + (*state->callbacks->movecursor)(state->pos, oldpos, state->mode.cursor_visible, state->cbdata); + return 1; + } + + case 'n': // LS2 - ECMA-48 8.3.78 + state->gl_set = 2; + return 1; + + case 'o': // LS3 - ECMA-48 8.3.80 + state->gl_set = 3; + return 1; + + default: + return 0; + } +} + +static void set_mode(VTermState *state, int num, int val) +{ + switch(num) { + case 4: // IRM - ECMA-48 7.2.10 + state->mode.insert = val; + break; + + case 20: // LNM - ANSI X3.4-1977 + state->mode.newline = val; + break; + + default: + fprintf(stderr, "libvterm: Unknown mode %d\n", num); + return; + } +} + +static void set_dec_mode(VTermState *state, int num, int val) +{ + switch(num) { + case 1: + state->mode.cursor = val; + break; + + case 5: + settermprop_bool(state, VTERM_PROP_REVERSE, val); + break; + + case 6: // DECOM - origin mode + { + VTermPos oldpos = state->pos; + state->mode.origin = val; + state->pos.row = state->mode.origin ? state->scrollregion_start : 0; + state->pos.col = 0; + updatecursor(state, &oldpos, 1); + } + break; + + case 7: + state->mode.autowrap = val; + break; + + case 12: + state->mode.cursor_blink = val; + settermprop_bool(state, VTERM_PROP_CURSORBLINK, val); + break; + + case 25: + state->mode.cursor_visible = val; + settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, val); + break; + + case 1000: + case 1002: + case 1003: + if(val) { + state->mouse_col = 0; + state->mouse_row = 0; + state->mouse_buttons = 0; + + state->mouse_flags = 0; + state->mouse_protocol = MOUSE_X10; + + if(num == 1002) + state->mouse_flags |= MOUSE_WANT_DRAG; + if(num == 1003) + state->mouse_flags |= MOUSE_WANT_MOVE; + } + + if(state->callbacks && state->callbacks->setmousefunc) + (*state->callbacks->setmousefunc)(val ? mousefunc : NULL, state, state->cbdata); + + break; + + case 1005: + state->mouse_protocol = val ? MOUSE_UTF8 : MOUSE_X10; + break; + + case 1006: + state->mouse_protocol = val ? MOUSE_SGR : MOUSE_X10; + break; + + case 1015: + state->mouse_protocol = val ? MOUSE_RXVT : MOUSE_X10; + break; + + case 1047: + altscreen(state, val); + break; + + case 1048: + savecursor(state, val); + break; + + case 1049: + altscreen(state, val); + savecursor(state, val); + break; + + default: + fprintf(stderr, "libvterm: Unknown DEC mode %d\n", num); + return; + } +} + +static int on_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) +{ + VTermState *state = user; + int leader_byte = 0; + int intermed_byte = 0; + VTermPos oldpos; + + // Some temporaries for later code + int count, val; + int row, col; + VTermRect rect; + + if(leader && leader[0]) { + if(leader[1]) // longer than 1 char + return 0; + + switch(leader[0]) { + case '?': + case '>': + leader_byte = leader[0]; + break; + default: + return 0; + } + } + + if(intermed && intermed[0]) { + if(intermed[1]) // longer than 1 char + return 0; + + switch(intermed[0]) { + case ' ': + intermed_byte = intermed[0]; + break; + default: + return 0; + } + } + + oldpos = state->pos; + +#define LEADER(l,b) ((l << 8) | b) +#define INTERMED(i,b) ((i << 16) | b) + + switch(intermed_byte << 16 | leader_byte << 8 | command) { + case 0x40: // ICH - ECMA-48 8.3.64 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; + rect.end_col = state->cols; + + scroll(state, rect, 0, -count); + + break; + + case 0x41: // CUU - ECMA-48 8.3.22 + count = CSI_ARG_COUNT(args[0]); + state->pos.row -= count; + state->at_phantom = 0; + break; + + case 0x42: // CUD - ECMA-48 8.3.19 + count = CSI_ARG_COUNT(args[0]); + state->pos.row += count; + state->at_phantom = 0; + break; + + case 0x43: // CUF - ECMA-48 8.3.20 + count = CSI_ARG_COUNT(args[0]); + state->pos.col += count; + state->at_phantom = 0; + break; + + case 0x44: // CUB - ECMA-48 8.3.18 + count = CSI_ARG_COUNT(args[0]); + state->pos.col -= count; + state->at_phantom = 0; + break; + + case 0x45: // CNL - ECMA-48 8.3.12 + count = CSI_ARG_COUNT(args[0]); + state->pos.col = 0; + state->pos.row += count; + state->at_phantom = 0; + break; + + case 0x46: // CPL - ECMA-48 8.3.13 + count = CSI_ARG_COUNT(args[0]); + state->pos.col = 0; + state->pos.row -= count; + state->at_phantom = 0; + break; + + case 0x47: // CHA - ECMA-48 8.3.9 + val = CSI_ARG_OR(args[0], 1); + state->pos.col = val-1; + state->at_phantom = 0; + break; + + case 0x48: // CUP - ECMA-48 8.3.21 + row = CSI_ARG_OR(args[0], 1); + col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); + // zero-based + state->pos.row = row-1; + state->pos.col = col-1; + if(state->mode.origin) + state->pos.row += state->scrollregion_start; + state->at_phantom = 0; + break; + + case 0x49: // CHT - ECMA-48 8.3.10 + count = CSI_ARG_COUNT(args[0]); + tab(state, count, +1); + break; + + case 0x4a: // ED - ECMA-48 8.3.39 + switch(CSI_ARG(args[0])) { + case CSI_ARG_MISSING: + case 0: + rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; rect.end_col = state->cols; + if(rect.end_col > rect.start_col) + erase(state, rect); + + rect.start_row = state->pos.row + 1; rect.end_row = state->rows; + rect.start_col = 0; + if(rect.end_row > rect.start_row) + erase(state, rect); + break; + + case 1: + rect.start_row = 0; rect.end_row = state->pos.row; + rect.start_col = 0; rect.end_col = state->cols; + if(rect.end_col > rect.start_col) + erase(state, rect); + + rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; + rect.end_col = state->pos.col + 1; + if(rect.end_row > rect.start_row) + erase(state, rect); + break; + + case 2: + rect.start_row = 0; rect.end_row = state->rows; + rect.start_col = 0; rect.end_col = state->cols; + erase(state, rect); + break; + } + break; + + case 0x4b: // EL - ECMA-48 8.3.41 + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + + switch(CSI_ARG(args[0])) { + case CSI_ARG_MISSING: + case 0: + rect.start_col = state->pos.col; rect.end_col = state->cols; break; + case 1: + rect.start_col = 0; rect.end_col = state->pos.col + 1; break; + case 2: + rect.start_col = 0; rect.end_col = state->cols; break; + default: + return 0; + } + + if(rect.end_col > rect.start_col) + erase(state, rect); + + break; + + case 0x4c: // IL - ECMA-48 8.3.67 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->pos.row; + rect.end_row = SCROLLREGION_END(state); + rect.start_col = 0; + rect.end_col = state->cols; + + scroll(state, rect, -count, 0); + + break; + + case 0x4d: // DL - ECMA-48 8.3.32 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->pos.row; + rect.end_row = SCROLLREGION_END(state); + rect.start_col = 0; + rect.end_col = state->cols; + + scroll(state, rect, count, 0); + + break; + + case 0x50: // DCH - ECMA-48 8.3.26 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; + rect.end_col = state->cols; + + scroll(state, rect, 0, count); + + break; + + case 0x53: // SU - ECMA-48 8.3.147 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->scrollregion_start; + rect.end_row = SCROLLREGION_END(state); + rect.start_col = 0; + rect.end_col = state->cols; + + scroll(state, rect, count, 0); + + break; + + case 0x54: // SD - ECMA-48 8.3.113 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->scrollregion_start; + rect.end_row = SCROLLREGION_END(state); + rect.start_col = 0; + rect.end_col = state->cols; + + scroll(state, rect, -count, 0); + + break; + + case 0x58: // ECH - ECMA-48 8.3.38 + count = CSI_ARG_COUNT(args[0]); + + rect.start_row = state->pos.row; + rect.end_row = state->pos.row + 1; + rect.start_col = state->pos.col; + rect.end_col = state->pos.col + count; + + erase(state, rect); + break; + + case 0x5a: // CBT - ECMA-48 8.3.7 + count = CSI_ARG_COUNT(args[0]); + tab(state, count, -1); + break; + + case 0x60: // HPA - ECMA-48 8.3.57 + col = CSI_ARG_OR(args[0], 1); + state->pos.col = col-1; + state->at_phantom = 0; + break; + + case 0x61: // HPR - ECMA-48 8.3.59 + count = CSI_ARG_COUNT(args[0]); + state->pos.col += count; + state->at_phantom = 0; + break; + + case 0x63: // DA - ECMA-48 8.3.24 + val = CSI_ARG_OR(args[0], 0); + if(val == 0) + // DEC VT100 response + vterm_push_output_sprintf(state->vt, "\e[?1;2c"); + break; + + case LEADER('>', 0x63): // DEC secondary Device Attributes + vterm_push_output_sprintf(state->vt, "\e[>%d;%d;%dc", 0, 100, 0); + break; + + case 0x64: // VPA - ECMA-48 8.3.158 + row = CSI_ARG_OR(args[0], 1); + state->pos.row = row-1; + if(state->mode.origin) + state->pos.row += state->scrollregion_start; + state->at_phantom = 0; + break; + + case 0x65: // VPR - ECMA-48 8.3.160 + count = CSI_ARG_COUNT(args[0]); + state->pos.row += count; + state->at_phantom = 0; + break; + + case 0x66: // HVP - ECMA-48 8.3.63 + row = CSI_ARG_OR(args[0], 1); + col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); + // zero-based + state->pos.row = row-1; + state->pos.col = col-1; + if(state->mode.origin) + state->pos.row += state->scrollregion_start; + state->at_phantom = 0; + break; + + case 0x67: // TBC - ECMA-48 8.3.154 + val = CSI_ARG_OR(args[0], 0); + + switch(val) { + case 0: + clear_col_tabstop(state, state->pos.col); + break; + case 3: + case 5: + for(col = 0; col < state->cols; col++) + clear_col_tabstop(state, col); + break; + case 1: + case 2: + case 4: + break; + /* TODO: 1, 2 and 4 aren't meaningful yet without line tab stops */ + default: + return 0; + } + break; + + case 0x68: // SM - ECMA-48 8.3.125 + if(!CSI_ARG_IS_MISSING(args[0])) + set_mode(state, CSI_ARG(args[0]), 1); + break; + + case LEADER('?', 0x68): // DEC private mode set + if(!CSI_ARG_IS_MISSING(args[0])) + set_dec_mode(state, CSI_ARG(args[0]), 1); + break; + + case 0x6a: // HPB - ECMA-48 8.3.58 + count = CSI_ARG_COUNT(args[0]); + state->pos.col -= count; + state->at_phantom = 0; + break; + + case 0x6b: // VPB - ECMA-48 8.3.159 + count = CSI_ARG_COUNT(args[0]); + state->pos.row -= count; + state->at_phantom = 0; + break; + + case 0x6c: // RM - ECMA-48 8.3.106 + if(!CSI_ARG_IS_MISSING(args[0])) + set_mode(state, CSI_ARG(args[0]), 0); + break; + + case LEADER('?', 0x6c): // DEC private mode reset + if(!CSI_ARG_IS_MISSING(args[0])) + set_dec_mode(state, CSI_ARG(args[0]), 0); + break; + + case 0x6d: // SGR - ECMA-48 8.3.117 + vterm_state_setpen(state, args, argcount); + break; + + case 0x6e: // DSR - ECMA-48 8.3.35 + val = CSI_ARG_OR(args[0], 0); + + switch(val) { + case 0: case 1: case 2: case 3: case 4: + // ignore - these are replies + break; + case 5: + vterm_push_output_sprintf(state->vt, "\e[0n"); + break; + case 6: + vterm_push_output_sprintf(state->vt, "\e[%d;%dR", state->pos.row + 1, state->pos.col + 1); + break; + } + break; + + case LEADER('!', 0x70): // DECSTR - DEC soft terminal reset + vterm_state_reset(state, 0); + break; + + case INTERMED(' ', 0x71): // DECSCUSR - DEC set cursor shape + val = CSI_ARG_OR(args[0], 1); + + switch(val) { + case 0: case 1: + state->mode.cursor_blink = 1; + state->mode.cursor_shape = VTERM_PROP_CURSORSHAPE_BLOCK; + break; + case 2: + state->mode.cursor_blink = 0; + state->mode.cursor_shape = VTERM_PROP_CURSORSHAPE_BLOCK; + break; + case 3: + state->mode.cursor_blink = 1; + state->mode.cursor_shape = VTERM_PROP_CURSORSHAPE_UNDERLINE; + break; + case 4: + state->mode.cursor_blink = 0; + state->mode.cursor_shape = VTERM_PROP_CURSORSHAPE_UNDERLINE; + break; + } + + settermprop_bool(state, VTERM_PROP_CURSORBLINK, state->mode.cursor_blink); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, state->mode.cursor_shape); + break; + + case 0x72: // DECSTBM - DEC custom + state->scrollregion_start = CSI_ARG_OR(args[0], 1) - 1; + state->scrollregion_end = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); + if(state->scrollregion_start == 0 && state->scrollregion_end == state->rows) + state->scrollregion_end = -1; + break; + + case 0x73: // ANSI SAVE + savecursor(state, 1); + break; + + case 0x75: // ANSI RESTORE + savecursor(state, 0); + break; + + default: + return 0; + } + +#define LBOUND(v,min) if((v) < (min)) (v) = (min) +#define UBOUND(v,max) if((v) > (max)) (v) = (max) + + LBOUND(state->pos.col, 0); + UBOUND(state->pos.col, state->cols-1); + + if(state->mode.origin) { + LBOUND(state->pos.row, state->scrollregion_start); + UBOUND(state->pos.row, state->scrollregion_end-1); + } + else { + LBOUND(state->pos.row, 0); + UBOUND(state->pos.row, state->rows-1); + } + + updatecursor(state, &oldpos, 1); + + return 1; +} + +static int on_osc(const char *command, size_t cmdlen, void *user) +{ + VTermState *state = user; + + if(cmdlen < 2) + return 0; + + if(strneq(command, "0;", 2)) { + settermprop_string(state, VTERM_PROP_ICONNAME, command + 2, cmdlen - 2); + settermprop_string(state, VTERM_PROP_TITLE, command + 2, cmdlen - 2); + return 1; + } + else if(strneq(command, "1;", 2)) { + settermprop_string(state, VTERM_PROP_ICONNAME, command + 2, cmdlen - 2); + return 1; + } + else if(strneq(command, "2;", 2)) { + settermprop_string(state, VTERM_PROP_TITLE, command + 2, cmdlen - 2); + return 1; + } + + return 0; +} + +static void request_status_string(VTermState *state, const char *command, size_t cmdlen) +{ + if(cmdlen == 1) + switch(command[0]) { + case 'r': // Query DECSTBM + vterm_push_output_sprintf(state->vt, "\eP1$r%d;%dr\e\\", state->scrollregion_start+1, SCROLLREGION_END(state)); + return; + } + + if(cmdlen == 2) + if(strneq(command, " q", 2)) { + int reply = 0; + switch(state->mode.cursor_shape) { + case VTERM_PROP_CURSORSHAPE_BLOCK: reply = 2; break; + case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break; + } + if(state->mode.cursor_blink) + reply--; + vterm_push_output_sprintf(state->vt, "\eP1$r%d q\e\\", reply); + return; + } + + vterm_push_output_sprintf(state->vt, "\eP0$r%.s\e\\", (int)cmdlen, command); +} + +static int on_dcs(const char *command, size_t cmdlen, void *user) +{ + VTermState *state = user; + + if(cmdlen >= 2 && strneq(command, "$q", 2)) { + request_status_string(state, command+2, cmdlen-2); + return 1; + } + + return 0; +} + +static int on_resize(int rows, int cols, void *user) +{ + VTermState *state = user; + VTermPos oldpos = state->pos; + + if(cols != state->cols) { + unsigned char *newtabstops = vterm_allocator_malloc(state->vt, (cols + 7) / 8); + + /* TODO: This can all be done much more efficiently bytewise */ + int col; + for(col = 0; col < state->cols && col < cols; col++) { + unsigned char mask = 1 << (col & 7); + if(state->tabstops[col >> 3] & mask) + newtabstops[col >> 3] |= mask; + else + newtabstops[col >> 3] &= ~mask; + } + + for( ; col < cols; col++) { + unsigned char mask = 1 << (col & 7); + if(col % 8 == 0) + newtabstops[col >> 3] |= mask; + else + newtabstops[col >> 3] &= ~mask; + } + + vterm_allocator_free(state->vt, state->tabstops); + state->tabstops = newtabstops; + } + + state->rows = rows; + state->cols = cols; + + if(state->pos.row >= rows) + state->pos.row = rows - 1; + if(state->pos.col >= cols) + state->pos.col = cols - 1; + + if(state->at_phantom && state->pos.col < cols-1) { + state->at_phantom = 0; + state->pos.col++; + } + + if(state->callbacks && state->callbacks->resize) + (*state->callbacks->resize)(rows, cols, state->cbdata); + + updatecursor(state, &oldpos, 1); + + return 1; +} + +static const VTermParserCallbacks parser_callbacks = { + .text = on_text, + .control = on_control, + .escape = on_escape, + .csi = on_csi, + .osc = on_osc, + .dcs = on_dcs, + .resize = on_resize, +}; + +VTermState *vterm_obtain_state(VTerm *vt) +{ + VTermState *state; + if(vt->state) + return vt->state; + + state = vterm_state_new(vt); + vt->state = state; + + state->combine_chars_size = 16; + state->combine_chars = vterm_allocator_malloc(state->vt, state->combine_chars_size * sizeof(state->combine_chars[0])); + + state->tabstops = vterm_allocator_malloc(state->vt, (state->cols + 7) / 8); + + state->encoding_utf8.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); + if(*state->encoding_utf8.enc->init) + (*state->encoding_utf8.enc->init)(state->encoding_utf8.enc, state->encoding_utf8.data); + + vterm_set_parser_callbacks(vt, &parser_callbacks, state); + + return state; +} + +void vterm_state_reset(VTermState *state, int hard) +{ + int col, i; + VTermEncoding *default_enc; + + state->scrollregion_start = 0; + state->scrollregion_end = -1; + + state->mode.keypad = 0; + state->mode.cursor = 0; + state->mode.autowrap = 1; + state->mode.insert = 0; + state->mode.newline = 0; + state->mode.cursor_visible = 1; + state->mode.cursor_blink = 1; + state->mode.cursor_shape = VTERM_PROP_CURSORSHAPE_BLOCK; + state->mode.alt_screen = 0; + state->mode.origin = 0; + + for(col = 0; col < state->cols; col++) + if(col % 8 == 0) + set_col_tabstop(state, col); + else + clear_col_tabstop(state, col); + + if(state->callbacks && state->callbacks->initpen) + (*state->callbacks->initpen)(state->cbdata); + + vterm_state_resetpen(state); + + default_enc = state->vt->is_utf8 ? + vterm_lookup_encoding(ENC_UTF8, 'u') : + vterm_lookup_encoding(ENC_SINGLE_94, 'B'); + + for(i = 0; i < 4; i++) { + state->encoding[i].enc = default_enc; + if(default_enc->init) + (*default_enc->init)(default_enc, state->encoding[i].data); + } + + state->gl_set = 0; + state->gr_set = 0; + + // Initialise the props + settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, state->mode.cursor_visible); + settermprop_bool(state, VTERM_PROP_CURSORBLINK, state->mode.cursor_blink); + settermprop_int (state, VTERM_PROP_CURSORSHAPE, state->mode.cursor_shape); + + if(hard) { + VTermRect rect = { 0, state->rows, 0, state->cols }; + + state->pos.row = 0; + state->pos.col = 0; + state->at_phantom = 0; + + erase(state, rect); + } +} + +void vterm_state_get_cursorpos(VTermState *state, VTermPos *cursorpos) +{ + *cursorpos = state->pos; +} + +void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user) +{ + if(callbacks) { + state->callbacks = callbacks; + state->cbdata = user; + + if(state->callbacks && state->callbacks->initpen) + (*state->callbacks->initpen)(state->cbdata); + } + else { + state->callbacks = NULL; + state->cbdata = NULL; + } +} diff --git a/src/apps/serialconnect/libvterm/src/unicode.c b/src/apps/serialconnect/libvterm/src/unicode.c new file mode 100644 index 0000000000..d50e80d5d9 --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/unicode.c @@ -0,0 +1,332 @@ +#include "vterm_internal.h" + +// ### The following from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c +// With modifications: +// made functions static +// moved 'combining' table to file scope, so other functions can see it +// ################################################################### + +/* + * This is an implementation of wcwidth() and wcswidth() (defined in + * IEEE Std 1002.1-2001) for Unicode. + * + * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html + * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html + * + * In fixed-width output devices, Latin characters all occupy a single + * "cell" position of equal width, whereas ideographic CJK characters + * occupy two such cells. Interoperability between terminal-line + * applications and (teletype-style) character terminals using the + * UTF-8 encoding requires agreement on which character should advance + * the cursor by how many cell positions. No established formal + * standards exist at present on which Unicode character shall occupy + * how many cell positions on character terminals. These routines are + * a first attempt of defining such behavior based on simple rules + * applied to data provided by the Unicode Consortium. + * + * For some graphical characters, the Unicode standard explicitly + * defines a character-cell width via the definition of the East Asian + * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. + * In all these cases, there is no ambiguity about which width a + * terminal shall use. For characters in the East Asian Ambiguous (A) + * class, the width choice depends purely on a preference of backward + * compatibility with either historic CJK or Western practice. + * Choosing single-width for these characters is easy to justify as + * the appropriate long-term solution, as the CJK practice of + * displaying these characters as double-width comes from historic + * implementation simplicity (8-bit encoded characters were displayed + * single-width and 16-bit ones double-width, even for Greek, + * Cyrillic, etc.) and not any typographic considerations. + * + * Much less clear is the choice of width for the Not East Asian + * (Neutral) class. Existing practice does not dictate a width for any + * of these characters. It would nevertheless make sense + * typographically to allocate two character cells to characters such + * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be + * represented adequately with a single-width glyph. The following + * routines at present merely assign a single-cell width to all + * neutral characters, in the interest of simplicity. This is not + * entirely satisfactory and should be reconsidered before + * establishing a formal standard in this area. At the moment, the + * decision which Not East Asian (Neutral) characters should be + * represented by double-width glyphs cannot yet be answered by + * applying a simple rule from the Unicode database content. Setting + * up a proper standard for the behavior of UTF-8 character terminals + * will require a careful analysis not only of each Unicode character, + * but also of each presentation form, something the author of these + * routines has avoided to do so far. + * + * http://www.unicode.org/unicode/reports/tr11/ + * + * Markus Kuhn -- 2007-05-26 (Unicode 5.0) + * + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c + */ + +#include + +struct interval { + int first; + int last; +}; + +/* sorted list of non-overlapping intervals of non-spacing characters */ +/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ +static const struct interval combining[] = { + { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, + { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, + { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, + { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, + { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, + { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, + { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, + { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, + { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, + { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, + { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, + { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, + { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, + { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, + { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, + { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, + { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, + { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, + { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, + { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, + { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, + { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, + { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, + { 0xE0100, 0xE01EF } +}; + + +/* auxiliary function for binary search in interval table */ +static int bisearch(wchar_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + + return 0; +} + + +/* The following two functions define the column width of an ISO 10646 + * character as follows: + * + * - The null character (U+0000) has a column width of 0. + * + * - Other C0/C1 control characters and DEL will lead to a return + * value of -1. + * + * - Non-spacing and enclosing combining characters (general + * category code Mn or Me in the Unicode database) have a + * column width of 0. + * + * - SOFT HYPHEN (U+00AD) has a column width of 1. + * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * + * - Spacing characters in the East Asian Wide (W) or East Asian + * Full-width (F) category as defined in Unicode Technical + * Report #11 have a column width of 2. + * + * - All remaining characters (including all printable + * ISO 8859-1 and WGL4 characters, Unicode control characters, + * etc.) have a column width of 1. + * + * This implementation assumes that wchar_t characters are encoded + * in ISO 10646. + */ + + +static int mk_wcwidth(wchar_t ucs) +{ + /* test for 8-bit control characters */ + if (ucs == 0) + return 0; + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) + return -1; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) + return 0; + + /* if we arrive here, ucs is not a combining or C0/C1 control character */ + + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + ucs == 0x2329 || ucs == 0x232a || + (ucs >= 0x2e80 && ucs <= 0xa4cf && + ucs != 0x303f) || /* CJK ... Yi */ + (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ + (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ + (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ + (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ + (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ + (ucs >= 0xffe0 && ucs <= 0xffe6) || + (ucs >= 0x20000 && ucs <= 0x2fffd) || + (ucs >= 0x30000 && ucs <= 0x3fffd))); +} + +#if 0 +static int mk_wcswidth(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + +/* + * The following functions are the same as mk_wcwidth() and + * mk_wcswidth(), except that spacing characters in the East Asian + * Ambiguous (A) category as defined in Unicode Technical Report #11 + * have a column width of 2. This variant might be useful for users of + * CJK legacy encodings who want to migrate to UCS without changing + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. + */ +static int mk_wcwidth_cjk(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, + { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, + { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, + { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, + { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, + { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) + return 2; + + return mk_wcwidth(ucs); +} + + +static int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} +#endif + +// ################################ +// ### The rest added by Paul Evans + +int vterm_unicode_width(int codepoint) +{ + return mk_wcwidth(codepoint); +} + +int vterm_unicode_is_combining(int codepoint) +{ + return bisearch(codepoint, combining, sizeof(combining) / sizeof(struct interval) - 1); +} diff --git a/src/apps/serialconnect/libvterm/src/utf8.h b/src/apps/serialconnect/libvterm/src/utf8.h new file mode 100644 index 0000000000..f8cfe4659a --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/utf8.h @@ -0,0 +1,41 @@ +/* The following functions copied and adapted from libtermkey + * + * http://www.leonerd.org.uk/code/libtermkey/ + */ +static inline unsigned int utf8_seqlen(long codepoint) +{ + if(codepoint < 0x0000080) return 1; + if(codepoint < 0x0000800) return 2; + if(codepoint < 0x0010000) return 3; + if(codepoint < 0x0200000) return 4; + if(codepoint < 0x4000000) return 5; + return 6; +} + +static int fill_utf8(long codepoint, char *str) +{ + int b; + int nbytes = utf8_seqlen(codepoint); + + str[nbytes] = 0; + + // This is easier done backwards + b = nbytes; + while(b > 1) { + b--; + str[b] = 0x80 | (codepoint & 0x3f); + codepoint >>= 6; + } + + switch(nbytes) { + case 1: str[0] = (codepoint & 0x7f); break; + case 2: str[0] = 0xc0 | (codepoint & 0x1f); break; + case 3: str[0] = 0xe0 | (codepoint & 0x0f); break; + case 4: str[0] = 0xf0 | (codepoint & 0x07); break; + case 5: str[0] = 0xf8 | (codepoint & 0x03); break; + case 6: str[0] = 0xfc | (codepoint & 0x01); break; + } + + return nbytes; +} +/* end copy */ diff --git a/src/apps/serialconnect/libvterm/src/vterm.c b/src/apps/serialconnect/libvterm/src/vterm.c new file mode 100644 index 0000000000..a3f3edb345 --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/vterm.c @@ -0,0 +1,322 @@ +#include "vterm_internal.h" + +#include +#include +#include +#include + +/***************** + * API functions * + *****************/ + +static void *default_malloc(size_t size, void *allocdata) +{ + void *ptr = malloc(size); + if(ptr) + memset(ptr, 0, size); + return ptr; +} + +static void default_free(void *ptr, void *allocdata) +{ + free(ptr); +} + +static VTermAllocatorFunctions default_allocator = { + .malloc = &default_malloc, + .free = &default_free, +}; + +VTerm *vterm_new(int rows, int cols) +{ + return vterm_new_with_allocator(rows, cols, &default_allocator, NULL); +} + +VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata) +{ + /* Need to bootstrap using the allocator function directly */ + VTerm *vt = (*funcs->malloc)(sizeof(VTerm), allocdata); + + vt->allocator = funcs; + vt->allocdata = allocdata; + + vt->rows = rows; + vt->cols = cols; + + vt->parser_state = NORMAL; + + vt->strbuffer_len = 64; + vt->strbuffer_cur = 0; + vt->strbuffer = vterm_allocator_malloc(vt, vt->strbuffer_len); + + vt->outbuffer_len = 64; + vt->outbuffer_cur = 0; + vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len); + + return vt; +} + +void vterm_free(VTerm *vt) +{ + if(vt->screen) + vterm_screen_free(vt->screen); + + if(vt->state) + vterm_state_free(vt->state); + + vterm_allocator_free(vt, vt->strbuffer); + vterm_allocator_free(vt, vt->outbuffer); + + vterm_allocator_free(vt, vt); +} + +void *vterm_allocator_malloc(VTerm *vt, size_t size) +{ + return (*vt->allocator->malloc)(size, vt->allocdata); +} + +void vterm_allocator_free(VTerm *vt, void *ptr) +{ + (*vt->allocator->free)(ptr, vt->allocdata); +} + +void vterm_get_size(VTerm *vt, int *rowsp, int *colsp) +{ + if(rowsp) + *rowsp = vt->rows; + if(colsp) + *colsp = vt->cols; +} + +void vterm_set_size(VTerm *vt, int rows, int cols) +{ + vt->rows = rows; + vt->cols = cols; + + if(vt->parser_callbacks && vt->parser_callbacks->resize) + (*vt->parser_callbacks->resize)(rows, cols, vt->cbdata); +} + +void vterm_set_parser_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user) +{ + vt->parser_callbacks = callbacks; + vt->cbdata = user; +} + +void vterm_parser_set_utf8(VTerm *vt, int is_utf8) +{ + vt->is_utf8 = is_utf8; +} + +void vterm_push_output_bytes(VTerm *vt, const char *bytes, size_t len) +{ + if(len > vt->outbuffer_len - vt->outbuffer_cur) { + fprintf(stderr, "vterm_push_output(): buffer overflow; truncating output\n"); + len = vt->outbuffer_len - vt->outbuffer_cur; + } + + memcpy(vt->outbuffer + vt->outbuffer_cur, bytes, len); + vt->outbuffer_cur += len; +} + +void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args) +{ + int written = vsnprintf(vt->outbuffer + vt->outbuffer_cur, + vt->outbuffer_len - vt->outbuffer_cur, + format, args); + vt->outbuffer_cur += written; +} + +void vterm_push_output_sprintf(VTerm *vt, const char *format, ...) +{ + va_list args; + va_start(args, format); + vterm_push_output_vsprintf(vt, format, args); + va_end(args); +} + +size_t vterm_output_bufferlen(VTerm *vt) +{ + return vterm_output_get_buffer_current(vt); +} + +size_t vterm_output_get_buffer_size(VTerm *vt) +{ + return vt->outbuffer_len; +} + +size_t vterm_output_get_buffer_current(VTerm *vt) +{ + return vt->outbuffer_cur; +} + +size_t vterm_output_get_buffer_remaining(VTerm *vt) +{ + return vt->outbuffer_len - vt->outbuffer_cur; +} + +size_t vterm_output_bufferread(VTerm *vt, char *buffer, size_t len) +{ + if(len > vt->outbuffer_cur) + len = vt->outbuffer_cur; + + memcpy(buffer, vt->outbuffer, len); + + if(len < vt->outbuffer_cur) + memmove(vt->outbuffer, vt->outbuffer + len, vt->outbuffer_cur - len); + + vt->outbuffer_cur -= len; + + return len; +} + +VTermValueType vterm_get_attr_type(VTermAttr attr) +{ + switch(attr) { + case VTERM_ATTR_BOLD: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_UNDERLINE: return VTERM_VALUETYPE_INT; + case VTERM_ATTR_ITALIC: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_BLINK: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_REVERSE: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_STRIKE: return VTERM_VALUETYPE_BOOL; + case VTERM_ATTR_FONT: return VTERM_VALUETYPE_INT; + case VTERM_ATTR_FOREGROUND: return VTERM_VALUETYPE_COLOR; + case VTERM_ATTR_BACKGROUND: return VTERM_VALUETYPE_COLOR; + } + return 0; /* UNREACHABLE */ +} + +VTermValueType vterm_get_prop_type(VTermProp prop) +{ + switch(prop) { + case VTERM_PROP_CURSORVISIBLE: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_CURSORBLINK: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_ALTSCREEN: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_TITLE: return VTERM_VALUETYPE_STRING; + case VTERM_PROP_ICONNAME: return VTERM_VALUETYPE_STRING; + case VTERM_PROP_REVERSE: return VTERM_VALUETYPE_BOOL; + case VTERM_PROP_CURSORSHAPE: return VTERM_VALUETYPE_INT; + } + return 0; /* UNREACHABLE */ +} + +void vterm_scroll_rect(VTermRect rect, + int downward, + int rightward, + int (*moverect)(VTermRect src, VTermRect dest, void *user), + int (*eraserect)(VTermRect rect, void *user), + void *user) +{ + VTermRect src; + VTermRect dest; + + if(abs(downward) >= rect.end_row - rect.start_row || + abs(rightward) >= rect.end_col - rect.start_col) { + /* Scroll more than area; just erase the lot */ + (*eraserect)(rect, user); + return; + } + + if(rightward >= 0) { + /* rect: [XXX................] + * src: [----------------] + * dest: [----------------] + */ + dest.start_col = rect.start_col; + dest.end_col = rect.end_col - rightward; + src.start_col = rect.start_col + rightward; + src.end_col = rect.end_col; + } + else { + /* rect: [................XXX] + * src: [----------------] + * dest: [----------------] + */ + int leftward = -rightward; + dest.start_col = rect.start_col + leftward; + dest.end_col = rect.end_col; + src.start_col = rect.start_col; + src.end_col = rect.end_col - leftward; + } + + if(downward >= 0) { + dest.start_row = rect.start_row; + dest.end_row = rect.end_row - downward; + src.start_row = rect.start_row + downward; + src.end_row = rect.end_row; + } + else { + int upward = -downward; + dest.start_row = rect.start_row + upward; + dest.end_row = rect.end_row; + src.start_row = rect.start_row; + src.end_row = rect.end_row - upward; + } + + if(moverect) + (*moverect)(dest, src, user); + + if(downward > 0) + rect.start_row = rect.end_row - downward; + else if(downward < 0) + rect.end_row = rect.start_row - downward; + + if(rightward > 0) + rect.start_col = rect.end_col - rightward; + else if(rightward < 0) + rect.end_col = rect.start_col - rightward; + + (*eraserect)(rect, user); +} + +void vterm_copy_cells(VTermRect dest, + VTermRect src, + void (*copycell)(VTermPos dest, VTermPos src, void *user), + void *user) +{ + int downward = src.start_row - dest.start_row; + int rightward = src.start_col - dest.start_col; + + int init_row, test_row, init_col, test_col; + int inc_row, inc_col; + + VTermPos pos; + + if(downward < 0) { + init_row = dest.end_row - 1; + test_row = dest.start_row - 1; + inc_row = -1; + } + else if(downward == 0) { + init_row = dest.start_row; + test_row = dest.end_row; + inc_row = +1; + } + else /* downward > 0 */ { + init_row = dest.start_row; + test_row = dest.end_row; + inc_row = +1; + } + + if(rightward < 0) { + init_col = dest.end_col - 1; + test_col = dest.start_col - 1; + inc_col = -1; + } + else if(rightward == 0) { + init_col = dest.start_col; + test_col = dest.end_col; + inc_col = +1; + } + else /* rightward > 0 */ { + init_col = dest.start_col; + test_col = dest.end_col; + inc_col = +1; + } + + for(pos.row = init_row; pos.row != test_row; pos.row += inc_row) + for(pos.col = init_col; pos.col != test_col; pos.col += inc_col) { + VTermPos srcpos = { pos.row + downward, pos.col + rightward }; + (*copycell)(pos, srcpos, user); + } +} diff --git a/src/apps/serialconnect/libvterm/src/vterm_internal.h b/src/apps/serialconnect/libvterm/src/vterm_internal.h new file mode 100644 index 0000000000..03f14af1ac --- /dev/null +++ b/src/apps/serialconnect/libvterm/src/vterm_internal.h @@ -0,0 +1,167 @@ +#ifndef __VTERM_INTERNAL_H__ +#define __VTERM_INTERNAL_H__ + +#include "vterm.h" + +#include + +typedef struct VTermEncoding VTermEncoding; + +typedef struct { + VTermEncoding *enc; + + // This size should be increased if required by other stateful encodings + char data[4*sizeof(uint32_t)]; +} VTermEncodingInstance; + +struct VTermPen +{ + VTermColor fg; + VTermColor bg; + unsigned int bold:1; + unsigned int underline:2; + unsigned int italic:1; + unsigned int blink:1; + unsigned int reverse:1; + unsigned int strike:1; + unsigned int font:4; /* To store 0-9 */ +}; + +struct VTermState +{ + VTerm *vt; + + const VTermStateCallbacks *callbacks; + void *cbdata; + + int rows; + int cols; + + /* Current cursor position */ + VTermPos pos; + + int at_phantom; /* True if we're on the "81st" phantom column to defer a wraparound */ + + int scrollregion_start; + int scrollregion_end; /* -1 means unbounded */ +#define SCROLLREGION_END(state) ((state)->scrollregion_end > -1 ? (state)->scrollregion_end : (state)->rows) + + /* Bitvector of tab stops */ + unsigned char *tabstops; + + /* Mouse state */ + int mouse_col, mouse_row; + int mouse_buttons; + int mouse_flags; + enum { MOUSE_X10, MOUSE_UTF8, MOUSE_SGR, MOUSE_RXVT } mouse_protocol; + + /* Last glyph output, for Unicode recombining purposes */ + uint32_t *combine_chars; + size_t combine_chars_size; // Number of ELEMENTS in the above + int combine_width; // The width of the glyph above + VTermPos combine_pos; // Position before movement + + struct { + int keypad:1; + int cursor:1; + int autowrap:1; + int insert:1; + int newline:1; + int cursor_visible:1; + int cursor_blink:1; + unsigned int cursor_shape:2; + int alt_screen:1; + int origin:1; + } mode; + + VTermEncodingInstance encoding[4], encoding_utf8; + int gl_set, gr_set; + + struct VTermPen pen; + + VTermColor default_fg; + VTermColor default_bg; + int fg_ansi; + int bold_is_highbright; + + /* Saved state under DEC mode 1048/1049 */ + struct { + VTermPos pos; + struct VTermPen pen; + + struct { + int cursor_visible:1; + int cursor_blink:1; + unsigned int cursor_shape:2; + } mode; + } saved; +}; + +struct VTerm +{ + VTermAllocatorFunctions *allocator; + void *allocdata; + + int rows; + int cols; + + int is_utf8; + + enum VTermParserState { + NORMAL, + CSI, + OSC, + DCS, + ESC, + ESC_IN_OSC, + ESC_IN_DCS, + } parser_state; + const VTermParserCallbacks *parser_callbacks; + void *cbdata; + + /* len == malloc()ed size; cur == number of valid bytes */ + char *strbuffer; + size_t strbuffer_len; + size_t strbuffer_cur; + + char *outbuffer; + size_t outbuffer_len; + size_t outbuffer_cur; + + VTermState *state; + VTermScreen *screen; +}; + +struct VTermEncoding { + void (*init) (VTermEncoding *enc, void *data); + void (*decode)(VTermEncoding *enc, void *data, + uint32_t cp[], int *cpi, int cplen, + const char bytes[], size_t *pos, size_t len); +}; + +typedef enum { + ENC_UTF8, + ENC_SINGLE_94 +} VTermEncodingType; + +void *vterm_allocator_malloc(VTerm *vt, size_t size); +void vterm_allocator_free(VTerm *vt, void *ptr); + +void vterm_push_output_bytes(VTerm *vt, const char *bytes, size_t len); +void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args); +void vterm_push_output_sprintf(VTerm *vt, const char *format, ...); + +void vterm_state_free(VTermState *state); + +void vterm_state_resetpen(VTermState *state); +void vterm_state_setpen(VTermState *state, const long args[], int argcount); +void vterm_state_savepen(VTermState *state, int save); + +void vterm_screen_free(VTermScreen *screen); + +VTermEncoding *vterm_lookup_encoding(VTermEncodingType type, char designation); + +int vterm_unicode_width(int codepoint); +int vterm_unicode_is_combining(int codepoint); + +#endif From 50d739dee5fe3c635a052dfd435bcf6557f11639 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 16:12:47 -0400 Subject: [PATCH 21/65] Tracker: Regression fix A crash of Tracker was triggered when accessing AddOn menu (by shortcut or context-menu) for Pose on Desktop, because of it's incapacity to read the mime type list (that wasn't built in those cases). --- src/kits/tracker/ContainerWindow.cpp | 78 ++++++++++++++-------------- src/kits/tracker/ContainerWindow.h | 6 ++- src/kits/tracker/DeskWindow.cpp | 6 ++- 3 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index e5b044bc8d..fc9649e375 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -130,7 +130,6 @@ class DraggableContainerIcon : public BView { struct AddOneAddonParams { BObjectList *primaryList; BObjectList *secondaryList; - BObjectList *mimeTypes; }; struct StaggerOneParams { @@ -2814,33 +2813,33 @@ BContainerWindow::AddTrashContextMenus(BMenu *menu) void BContainerWindow::EachAddon(bool (*eachAddon)(const Model *, const char *, - uint32 shortcut, bool primary, void *context), void *passThru) + uint32 shortcut, bool primary, void *context), void *passThru, + BObjectList &mimeTypes) { BObjectList uniqueList(10, true); BPath path; bool bail = false; if (find_directory(B_BEOS_ADDONS_DIRECTORY, &path) == B_OK) - bail = EachAddon(path, eachAddon, &uniqueList, passThru); + bail = EachAddon(path, eachAddon, &uniqueList, passThru, mimeTypes); if (!bail && find_directory(B_USER_ADDONS_DIRECTORY, &path) == B_OK) - bail = EachAddon(path, eachAddon, &uniqueList, passThru); + bail = EachAddon(path, eachAddon, &uniqueList, passThru, mimeTypes); if (!bail && find_directory(B_COMMON_ADDONS_DIRECTORY, &path) == B_OK) - EachAddon(path, eachAddon, &uniqueList, passThru); + EachAddon(path, eachAddon, &uniqueList, passThru, mimeTypes); } bool BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, const char *, uint32 shortcut, bool primary, void *), - BObjectList *uniqueList, void *params) + BObjectList *uniqueList, void *params, + BObjectList &mimeTypes) { path.Append("Tracker"); BDirectory dir; BEntry entry; - - BObjectList *mimeTypes = ((AddOneAddonParams *)params)->mimeTypes; if (dir.SetTo(path.Path()) != B_OK) return false; @@ -2866,7 +2865,7 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, bool primary = false; - if (mimeTypes->CountItems()) { + if (mimeTypes.CountItems()) { BFile file(&entry, B_READ_ONLY); if (file.InitCheck() == B_OK) { BAppFileInfo info(&file); @@ -2884,8 +2883,8 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, // check all supported types if it has some set if (!secondary) { - for (int32 i = mimeTypes->CountItems(); !primary && i-- > 0;) { - BString *type = mimeTypes->ItemAt(i); + for (int32 i = mimeTypes.CountItems(); !primary && i-- > 0;) { + BString *type = mimeTypes.ItemAt(i); if (info.IsSupportedType(type->String())) { BMimeType mimeType(type->String()); if (info.Supports(&mimeType)) @@ -2923,6 +2922,32 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, } +void +BContainerWindow::BuildMimeTypeList(BObjectList &mimeTypes) +{ + int32 count = PoseView()->SelectionList()->CountItems(); + if (!count) { + // just add the type of the current directory + AddMimeTypeString(mimeTypes, TargetModel()); + } else { + _UpdateSelectionMIMEInfo(); + for (int32 index = 0; index < count; index++) { + BPose *pose = PoseView()->SelectionList()->ItemAt(index); + AddMimeTypeString(mimeTypes, pose->TargetModel()); + // If it's a symlink, resolves it and add the Target's MimeType + if (pose->TargetModel()->IsSymLink()) { + Model* resolved = new Model( + pose->TargetModel()->EntryRef(), true, true); + if (resolved->InitCheck() == B_OK) { + AddMimeTypeString(mimeTypes, resolved); + } + delete resolved; + } + } + } +} + + void BContainerWindow::BuildAddOnMenu(BMenu *menu) { @@ -2952,44 +2977,21 @@ BContainerWindow::BuildAddOnMenu(BMenu *menu) BObjectList primaryList; BObjectList secondaryList; + BObjectList mimeTypes(10, true); + BuildMimeTypeList(mimeTypes); AddOneAddonParams params; params.primaryList = &primaryList; params.secondaryList = &secondaryList; // build a list of the MIME types of the selected items - BObjectList mimeTypes(10, true); - int32 count = PoseView()->SelectionList()->CountItems(); - if (!count) { - // just add the type of the current directory - AddMimeTypeString(mimeTypes, TargetModel()); - } else { - _UpdateSelectionMIMEInfo(); - for (int32 index = 0; index < count; index++) { - BPose *pose = PoseView()->SelectionList()->ItemAt(index); - - AddMimeTypeString(mimeTypes, pose->TargetModel()); - // If it's a symlink, resolves it and add the Target's MimeType - if (pose->TargetModel()->IsSymLink()) { - Model* resolved = new Model( - pose->TargetModel()->EntryRef(), true, true); - if (resolved->InitCheck() == B_OK) { - AddMimeTypeString(mimeTypes, resolved); - } - delete resolved; - } - } - } - - params.mimeTypes = &mimeTypes; - - EachAddon(AddOneAddon, ¶ms); + EachAddon(AddOneAddon, ¶ms, mimeTypes); primaryList.SortItems(CompareLabels); secondaryList.SortItems(CompareLabels); - count = primaryList.CountItems(); + int32 count = primaryList.CountItems(); for (int32 index = 0; index < count; index++) menu->AddItem(primaryList.ItemAt(index)); diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index 373b81a7a1..e312ab213e 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -169,7 +169,8 @@ class BContainerWindow : public BWindow { bool createNew = false, bool createFolder = true); // add-on iteration - void EachAddon(bool(*)(const Model *, const char *, uint32 shortcut, bool primary, void *), void *); + void EachAddon(bool(*)(const Model *, const char *, uint32 shortcut, + bool primary, void *), void *, BObjectList &); BPopUpMenu *ContextMenu(); @@ -233,6 +234,7 @@ class BContainerWindow : public BWindow { virtual void SetUpDiskMenu(BMenu *); virtual void BuildAddOnMenu(BMenu *); + void BuildMimeTypeList(BObjectList& mimeTypes); enum UpdateMenuContext { kMenuBarContext, @@ -249,7 +251,7 @@ class BContainerWindow : public BWindow { const char *); bool EachAddon(BPath &path, bool(*)(const Model *, const char *, uint32, bool, void *), - BObjectList *, void *); + BObjectList *, void *, BObjectList &); void LoadAddOn(BMessage *); BPopUpMenu *fFileContextMenu; diff --git a/src/kits/tracker/DeskWindow.cpp b/src/kits/tracker/DeskWindow.cpp index fa16d62c56..bddc16471c 100644 --- a/src/kits/tracker/DeskWindow.cpp +++ b/src/kits/tracker/DeskWindow.cpp @@ -204,7 +204,11 @@ BDeskWindow::MenusBeginning() AddOneShortcutParams params; params.window = this; params.currentAddonShortcuts = &fCurrentAddonShortcuts; - EachAddon(&AddOneShortcut, ¶ms); + + BObjectList mimeTypes(10, true); + BuildMimeTypeList(mimeTypes); + + EachAddon(&AddOneShortcut, ¶ms, mimeTypes); } } From c082e8f2e24d1855ef255a5292b259acbc5ba7d9 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 17:05:57 -0400 Subject: [PATCH 22/65] Tracker: Variation between Saved and Restored widths When restored, an overlap was wrongly detected in offsets for failure to take into account the width of the border line. This was causing the horizontal scrollbar to show unnecessarily. --- src/kits/tracker/PoseView.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index fba21fe3db..3e5ededf3d 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -117,6 +117,7 @@ const int32 kMaxAddPosesChunk = 50; const uint32 kMsgMouseDragged = 'Mdrg'; const uint32 kMsgMouseLongDown = 'Mold'; +const int32 kRoomForLine = 2; namespace BPrivate { extern bool delete_point(void *); @@ -478,7 +479,7 @@ BPoseView::AddColumnList(BObjectList *list) column->SetOffset(nextLeftEdge); } - nextLeftEdge = column->Offset() + column->Width() + nextLeftEdge = column->Offset() + column->Width() - kRoomForLine / 2.0f + kTitleColumnExtraMargin; fColumnList->AddItem(column); @@ -8314,9 +8315,6 @@ BPoseView::RecalcExtent() } -const int32 kRoomForLine = 2; - - BRect BPoseView::Extent() const { From abbcb2caf536311e45a4a25b68339fc92e74bbb1 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 23 Jul 2012 22:44:06 +0200 Subject: [PATCH 23/65] Debugger: Use readline in the CLI This is a bit hacky, since gdb's readline is used. It would probably be best to prepare an optional build package. --- src/apps/debugger/Jamfile | 10 +++++++++- .../cli/CommandLineUserInterface.cpp | 17 +++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 80c98fe660..8e489e862b 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -6,6 +6,9 @@ C++FLAGS += -Werror ; UsePrivateHeaders app debug interface kernel shared libroot ; UsePrivateSystemHeaders ; +# Use gdb's readline. It would be better to use an optional build feature. +UseHeaders [ FDirName $(HAIKU_TOP) src bin gdb ] : true ; + SEARCH_SOURCE += [ FDirName $(SUBDIR) arch ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) arch x86 ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) debug_info ] ; @@ -273,9 +276,14 @@ Application Debugger : debug_utils.a libcolumnlistview.a libshared.a + libshared.a + libexpression_parser.a + libmapm.a + libreadline.a + libtermcap.a $(TARGET_LIBSTDC++) - be tracker libdebug.so libshared.a libexpression_parser.a libmapm.a + be tracker libdebug.so : Debugger.rdef ; diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 09db85f913..614a227544 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -11,7 +11,11 @@ #include +#include +#include + #include +#include #include #include "CliCommand.h" @@ -226,16 +230,15 @@ CommandLineUserInterface::_InputLoop() { while (!fTerminating) { // read a command line - printf("debugger> "); - fflush(stdout); - char buffer[256]; - if (fgets(buffer, sizeof(buffer), stdin) == NULL) + char* line = readline("debugger> "); + if (line == NULL) break; + MemoryDeleter lineDeleter(line); // parse the command line ArgumentVector args; const char* parseErrorLocation; - switch (args.Parse(buffer, &parseErrorLocation)) { + switch (args.Parse(line, &parseErrorLocation)) { case ArgumentVector::NO_ERROR: break; case ArgumentVector::NO_MEMORY: @@ -243,7 +246,7 @@ CommandLineUserInterface::_InputLoop() continue; case ArgumentVector::UNTERMINATED_QUOTED_STRING: printf("Parse error: Unterminated quoted string starting at " - "character %zu.\n", parseErrorLocation - buffer + 1); + "character %zu.\n", parseErrorLocation - line + 1); continue; case ArgumentVector::TRAILING_BACKSPACE: printf("Parse error: trailing backspace.\n"); @@ -253,6 +256,8 @@ CommandLineUserInterface::_InputLoop() if (args.ArgumentCount() == 0) continue; + add_history(line); + _ExecuteCommand(args.ArgumentCount(), args.Arguments()); } From d0ef75400b4136bac523bb2f71cd55af2262543a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 23 Jul 2012 23:09:08 +0200 Subject: [PATCH 24/65] Debugger CLI: Start to imbue CliContext with life --- src/apps/debugger/Jamfile | 1 + .../user_interface/cli/CliContext.cpp | 32 +++++++++++++++++++ .../debugger/user_interface/cli/CliContext.h | 18 +++++++++++ .../cli/CommandLineUserInterface.cpp | 8 ++--- .../cli/CommandLineUserInterface.h | 4 +-- 5 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 src/apps/debugger/user_interface/cli/CliContext.cpp diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 8e489e862b..0f626b57cd 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -174,6 +174,7 @@ Application Debugger : # user_interface/cli CliCommand.cpp + CliContext.cpp CommandLineUserInterface.cpp # user_interface/gui diff --git a/src/apps/debugger/user_interface/cli/CliContext.cpp b/src/apps/debugger/user_interface/cli/CliContext.cpp new file mode 100644 index 0000000000..cb099bf4ae --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliContext.cpp @@ -0,0 +1,32 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "CliContext.h" + +#include "UserInterface.h" + + +CliContext::CliContext() + : + fTeam(NULL), + fListener(NULL) +{ +} + + +void +CliContext::Init(Team* team, UserInterfaceListener* listener) +{ + fTeam = team; + fListener = listener; +} + + +void +CliContext::QuitSession() +{ + fListener->UserInterfaceQuitRequested(); +} diff --git a/src/apps/debugger/user_interface/cli/CliContext.h b/src/apps/debugger/user_interface/cli/CliContext.h index df318160a9..93d06af3fa 100644 --- a/src/apps/debugger/user_interface/cli/CliContext.h +++ b/src/apps/debugger/user_interface/cli/CliContext.h @@ -6,7 +6,25 @@ #define CLI_CONTEXT_H +class Team; +class UserInterfaceListener; + + class CliContext { +public: + CliContext(); + + void Init(Team* team, + UserInterfaceListener* listener); + + Team* GetTeam() const { return fTeam; } + + void QuitSession(); + + +private: + Team* fTeam; + UserInterfaceListener* fListener; }; diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 614a227544..0be51f9d0f 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -100,8 +100,6 @@ private: CommandLineUserInterface::CommandLineUserInterface() : - fTeam(NULL), - fListener(NULL), fCommands(20, true), fShowSemaphore(-1), fShown(false), @@ -127,8 +125,7 @@ CommandLineUserInterface::ID() const status_t CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener) { - fTeam = team; - fListener = listener; + fContext.Init(team, listener); status_t error = _RegisterCommands(); if (error != B_OK) @@ -318,8 +315,7 @@ CommandLineUserInterface::_ExecuteCommand(int argc, const char* const* argv) return; } - CliContext context; - firstEntry->Command()->Execute(argc, argv, context); + firstEntry->Command()->Execute(argc, argv, fContext); } diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h index 9d0c0714b5..35899c0871 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h @@ -10,6 +10,7 @@ #include #include +#include "CliContext.h" #include "UserInterface.h" @@ -68,8 +69,7 @@ private: void _PrintHelp(); private: - Team* fTeam; - UserInterfaceListener* fListener; + CliContext fContext; CommandList fCommands; sem_id fShowSemaphore; bool fShown; From a6de32b06c65d62f585d77eb77870f171a5f0e3b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 23 Jul 2012 23:10:54 +0200 Subject: [PATCH 25/65] Debugger CLI: Pull QuitCommand out of CommandLineUserInterface --- src/apps/debugger/Jamfile | 1 + .../user_interface/cli/CliQuitCommand.cpp | 25 +++++++++++++++++ .../user_interface/cli/CliQuitCommand.h | 20 ++++++++++++++ .../cli/CommandLineUserInterface.cpp | 27 ++----------------- .../cli/CommandLineUserInterface.h | 2 -- 5 files changed, 48 insertions(+), 27 deletions(-) create mode 100644 src/apps/debugger/user_interface/cli/CliQuitCommand.cpp create mode 100644 src/apps/debugger/user_interface/cli/CliQuitCommand.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 0f626b57cd..907865cbe3 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -175,6 +175,7 @@ Application Debugger : # user_interface/cli CliCommand.cpp CliContext.cpp + CliQuitCommand.cpp CommandLineUserInterface.cpp # user_interface/gui diff --git a/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp b/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp new file mode 100644 index 0000000000..d3a8cb83f7 --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp @@ -0,0 +1,25 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "CliQuitCommand.h" + +#include "CliContext.h" + + +CliQuitCommand::CliQuitCommand() + : + CliCommand("quit Debugger", + "%s\n" + "Quits Debugger.") +{ +} + + +void +CliQuitCommand::Execute(int argc, const char* const* argv, CliContext& context) +{ + context.QuitSession(); +} diff --git a/src/apps/debugger/user_interface/cli/CliQuitCommand.h b/src/apps/debugger/user_interface/cli/CliQuitCommand.h new file mode 100644 index 0000000000..6f8f68445c --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliQuitCommand.h @@ -0,0 +1,20 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef CLI_QUIT_COMMAND_H +#define CLI_QUIT_COMMAND_H + + +#include "CliCommand.h" + + +class CliQuitCommand : public CliCommand { +public: + CliQuitCommand(); + virtual void Execute(int argc, const char* const* argv, + CliContext& context); +}; + + +#endif // CLI_QUIT_COMMAND_H diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 0be51f9d0f..0cb77f6a9e 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -18,8 +18,8 @@ #include #include -#include "CliCommand.h" #include "CliContext.h" +#include "CliQuitCommand.h" // #pragma mark - CommandEntry @@ -72,29 +72,6 @@ private: }; -// #pragma mark - HelpCommand - - -struct CommandLineUserInterface::QuitCommand : CliCommand { - QuitCommand(CommandLineUserInterface* userInterface) - : - CliCommand("quit Debugger", - "%s\n" - "Quits Debugger."), - fUserInterface(userInterface) - { - } - - virtual void Execute(int argc, const char* const* argv, CliContext& context) - { - fUserInterface->fListener->UserInterfaceQuitRequested(); - } - -private: - CommandLineUserInterface* fUserInterface; -}; - - // #pragma mark - CommandLineUserInterface @@ -266,7 +243,7 @@ status_t CommandLineUserInterface::_RegisterCommands() { if (_RegisterCommand("help", new(std::nothrow) HelpCommand(this)) && - _RegisterCommand("quit", new(std::nothrow) QuitCommand(this))) { + _RegisterCommand("quit", new(std::nothrow) CliQuitCommand)) { return B_OK; } diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h index 35899c0871..7f0c0acbf2 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h @@ -51,11 +51,9 @@ private: typedef BObjectList CommandList; struct HelpCommand; - struct QuitCommand; // GCC 2 support friend struct HelpCommand; - friend struct QuitCommand; private: static status_t _InputLoopEntry(void* data); From 533a73766d9c6c75e93fce67a16fa5c97a5a0b75 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 23 Jul 2012 23:50:18 +0200 Subject: [PATCH 26/65] Debugger: Create UiUtils helper class Currently only a method to get a description for a thread state lives there (code pulled from ThreadListView). --- src/apps/debugger/Jamfile | 4 ++ .../gui/team_window/ThreadListView.cpp | 34 +++-------------- .../debugger/user_interface/util/UiUtils.cpp | 37 +++++++++++++++++++ .../debugger/user_interface/util/UiUtils.h | 19 ++++++++++ 4 files changed, 65 insertions(+), 29 deletions(-) create mode 100644 src/apps/debugger/user_interface/util/UiUtils.cpp create mode 100644 src/apps/debugger/user_interface/util/UiUtils.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 907865cbe3..2ddf9c8843 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -30,6 +30,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface gui team_window ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface gui teams_window ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface gui util ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface gui value ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface util ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) util ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) value ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) value type_handlers ] ; @@ -221,6 +222,9 @@ Application Debugger : TableCellValueRenderer.cpp TableCellValueRendererUtils.cpp + # user_interface/util + UiUtils.cpp + # util ArchivingUtils.cpp BitBuffer.cpp diff --git a/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp b/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp index 4799286ffa..7ef001c405 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp @@ -18,6 +18,7 @@ #include "GUISettingsUtils.h" #include "table/TableColumns.h" +#include "UiUtils.h" enum { @@ -114,35 +115,10 @@ public: return true; case 1: { - switch (thread->State()) { - case THREAD_STATE_RUNNING: - value.SetTo("Running", B_VARIANT_DONT_COPY_DATA); - return true; - case THREAD_STATE_STOPPED: - break; - case THREAD_STATE_UNKNOWN: - default: - value.SetTo("?", B_VARIANT_DONT_COPY_DATA); - return true; - } - - // thread is stopped -- get the reason - switch (thread->StoppedReason()) { - case THREAD_STOPPED_DEBUGGER_CALL: - value.SetTo("Call", B_VARIANT_DONT_COPY_DATA); - return true; - case THREAD_STOPPED_EXCEPTION: - value.SetTo("Exception", B_VARIANT_DONT_COPY_DATA); - return true; - case THREAD_STOPPED_BREAKPOINT: - case THREAD_STOPPED_WATCHPOINT: - case THREAD_STOPPED_SINGLE_STEP: - case THREAD_STOPPED_DEBUGGED: - case THREAD_STOPPED_UNKNOWN: - default: - value.SetTo("Debugged", B_VARIANT_DONT_COPY_DATA); - return true; - } + const char* string = UiUtils::ThreadStateToString( + thread->State(), thread->StoppedReason()); + value.SetTo(string, B_VARIANT_DONT_COPY_DATA); + return true; } case 2: value.SetTo(thread->Name(), B_VARIANT_DONT_COPY_DATA); diff --git a/src/apps/debugger/user_interface/util/UiUtils.cpp b/src/apps/debugger/user_interface/util/UiUtils.cpp new file mode 100644 index 0000000000..e92d4bdb4f --- /dev/null +++ b/src/apps/debugger/user_interface/util/UiUtils.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "UiUtils.h" + + +/*static*/ const char* +UiUtils::ThreadStateToString(int state, int stoppedReason) +{ + switch (state) { + case THREAD_STATE_RUNNING: + return "Running"; + case THREAD_STATE_STOPPED: + break; + case THREAD_STATE_UNKNOWN: + default: + return "?"; + } + + // thread is stopped -- get the reason + switch (stoppedReason) { + case THREAD_STOPPED_DEBUGGER_CALL: + return "Call"; + case THREAD_STOPPED_EXCEPTION: + return "Exception"; + case THREAD_STOPPED_BREAKPOINT: + case THREAD_STOPPED_WATCHPOINT: + case THREAD_STOPPED_SINGLE_STEP: + case THREAD_STOPPED_DEBUGGED: + case THREAD_STOPPED_UNKNOWN: + default: + return "Debugged"; + } +} diff --git a/src/apps/debugger/user_interface/util/UiUtils.h b/src/apps/debugger/user_interface/util/UiUtils.h new file mode 100644 index 0000000000..a7f74b4d54 --- /dev/null +++ b/src/apps/debugger/user_interface/util/UiUtils.h @@ -0,0 +1,19 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef UI_UTILS_H +#define UI_UTILS_H + + +#include "Thread.h" + + +class UiUtils { +public: + static const char* ThreadStateToString(int state, + int stoppedReason); +}; + + +#endif // UI_UTILS_H From 48b4d20480441b4525de6b90cab9539a834ab8fd Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 23 Jul 2012 23:51:05 +0200 Subject: [PATCH 27/65] Debugger CLI: Add "threads" command It just lists the team's thread. --- src/apps/debugger/Jamfile | 1 + .../user_interface/cli/CliThreadsCommand.cpp | 44 +++++++++++++++++++ .../user_interface/cli/CliThreadsCommand.h | 20 +++++++++ .../cli/CommandLineUserInterface.cpp | 4 +- 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp create mode 100644 src/apps/debugger/user_interface/cli/CliThreadsCommand.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 2ddf9c8843..f9c017f665 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -176,6 +176,7 @@ Application Debugger : # user_interface/cli CliCommand.cpp CliContext.cpp + CliThreadsCommand.cpp CliQuitCommand.cpp CommandLineUserInterface.cpp diff --git a/src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp b/src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp new file mode 100644 index 0000000000..6bb84f3a87 --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp @@ -0,0 +1,44 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "CliThreadsCommand.h" + +#include + +#include + +#include "CliContext.h" +#include "Team.h" +#include "UiUtils.h" + + +CliThreadsCommand::CliThreadsCommand() + : + CliCommand("list the team's threads", + "%s\n" + "Lists the team's threads.") +{ +} + + +void +CliThreadsCommand::Execute(int argc, const char* const* argv, + CliContext& context) +{ + Team* team = context.GetTeam(); + AutoLocker teamLocker(team); + + printf(" ID state name\n"); + printf("----------------------------\n"); + + for (ThreadList::ConstIterator it = team->Threads().GetIterator(); + Thread* thread = it.Next();) { + const char* stateString = UiUtils::ThreadStateToString( + thread->State(), thread->StoppedReason()); + printf("%10" B_PRId32 " %-9s \"%s\"\n", thread->ID(), stateString, + thread->Name()); + } +} diff --git a/src/apps/debugger/user_interface/cli/CliThreadsCommand.h b/src/apps/debugger/user_interface/cli/CliThreadsCommand.h new file mode 100644 index 0000000000..d22cd44b37 --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliThreadsCommand.h @@ -0,0 +1,20 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef CLI_THREADS_COMMAND_H +#define CLI_THREADS_COMMAND_H + + +#include "CliCommand.h" + + +class CliThreadsCommand : public CliCommand { +public: + CliThreadsCommand(); + virtual void Execute(int argc, const char* const* argv, + CliContext& context); +}; + + +#endif // CLI_THREADS_COMMAND_H diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 0cb77f6a9e..98103065fe 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -20,6 +20,7 @@ #include "CliContext.h" #include "CliQuitCommand.h" +#include "CliThreadsCommand.h" // #pragma mark - CommandEntry @@ -243,7 +244,8 @@ status_t CommandLineUserInterface::_RegisterCommands() { if (_RegisterCommand("help", new(std::nothrow) HelpCommand(this)) && - _RegisterCommand("quit", new(std::nothrow) CliQuitCommand)) { + _RegisterCommand("quit", new(std::nothrow) CliQuitCommand) && + _RegisterCommand("threads", new(std::nothrow) CliThreadsCommand)) { return B_OK; } From 1615cec9ccc313a086192c0775fdc32bb267a260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Mod=C3=A9en?= Date: Tue, 24 Jul 2012 00:05:56 +0000 Subject: [PATCH 28/65] Fixing #7984 and some code guidelines. --- src/apps/codycam/CodyCam.cpp | 45 ++++++++++++++++++++++++------------ src/apps/codycam/CodyCam.h | 9 ++++++-- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp index 2b79880cd9..a00dfd80d3 100644 --- a/src/apps/codycam/CodyCam.cpp +++ b/src/apps/codycam/CodyCam.cpp @@ -65,7 +65,6 @@ ErrorAlert(const char* message, status_t err, BWindow *window = NULL) alert->Go(); printf("%s\n%s [%lx]", message, strerror(err), err); -// be_app->PostMessage(B_QUIT_REQUESTED); } @@ -122,13 +121,15 @@ AddTranslationItems(BMenu* intoMenu, uint32 fromType) // functions for EnumeratedStringValueSettings -const char* CaptureRateAt(int32 i) +const char* +CaptureRateAt(int32 i) { return (i >= 0 && i < kCaptureRatesCount) ? kCaptureRates[i].name : NULL; } -const char* UploadClientAt(int32 i) +const char* +UploadClientAt(int32 i) { return (i >= 0 && i < kUploadClientsCount) ? kUploadClients[i] : NULL; } @@ -200,7 +201,8 @@ CodyCam::ReadyToRun() (const char*) B_TRANSLATE_SYSTEM_NAME("CodyCam"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, &fPort); - _SetUpNodes(); + if(_SetUpNodes() != B_OK) + fWindow->ToggleMenuOnOff(); ((VideoWindow*)fWindow)->ApplyControls(); } @@ -490,33 +492,33 @@ VideoWindow::VideoWindow(BRect frame, const char* title, window_type type, BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "menu bar"); BMenuItem* menuItem; - BMenu* menu = new BMenu(B_TRANSLATE("File")); + fMenu = new BMenu(B_TRANSLATE("File")); menuItem = new BMenuItem(B_TRANSLATE("Video settings"), new BMessage(msg_video), 'P'); menuItem->SetTarget(be_app); - menu->AddItem(menuItem); + fMenu->AddItem(menuItem); - menu->AddSeparatorItem(); + fMenu->AddSeparatorItem(); menuItem = new BMenuItem(B_TRANSLATE("Start video"), new BMessage(msg_start), 'A'); menuItem->SetTarget(be_app); - menu->AddItem(menuItem); + fMenu->AddItem(menuItem); menuItem = new BMenuItem(B_TRANSLATE("Stop video"), new BMessage(msg_stop), 'O'); menuItem->SetTarget(be_app); - menu->AddItem(menuItem); + fMenu->AddItem(menuItem); - menu->AddSeparatorItem(); + fMenu->AddSeparatorItem(); menuItem = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q'); menuItem->SetTarget(be_app); - menu->AddItem(menuItem); + fMenu->AddItem(menuItem); - menuBar->AddItem(menu); + menuBar->AddItem(fMenu); /* add some controls */ _BuildCaptureControls(); @@ -717,6 +719,7 @@ VideoWindow::_BuildCaptureControls() // FTP setup box fFtpSetupBox = new BBox("FTP Setup", B_WILL_DRAW); + fFtpSetupBox->SetLabel(B_TRANSLATE("Output")); fUploadClientMenu = new BPopUpMenu(B_TRANSLATE("Send to" B_UTF8_ELLIPSIS)); for (int i = 0; i < kUploadClientsCount; i++) { @@ -724,14 +727,12 @@ VideoWindow::_BuildCaptureControls() m->AddInt32("client", i); fUploadClientMenu->AddItem(new BMenuItem(kUploadClients[i], m)); } + fUploadClientMenu->SetTargetForItems(this); fUploadClientMenu->FindItem(fUploadClientSetting->Value())->SetMarked(true); fUploadClientSelector = new BMenuField("UploadClient", NULL, fUploadClientMenu); - fFtpSetupBox->SetLabel(B_TRANSLATE("Output")); - // this doesn't work with the layout manager - // fFtpSetupBox->SetLabel(fUploadClientSelector); fUploadClientSelector->SetLabel(B_TRANSLATE("Type:")); BGridLayout *ftpLayout = new BGridLayout(kXBuffer, 0); @@ -875,6 +876,20 @@ VideoWindow::_QuitSettings() } +void +VideoWindow::ToggleMenuOnOff() +{ + BMenuItem* item = fMenu->FindItem(msg_video); + item->SetEnabled(!item->IsEnabled()); + + item = fMenu->FindItem(msg_start); + item->SetEnabled(!item->IsEnabled()); + + item = fMenu->FindItem(msg_stop); + item->SetEnabled(!item->IsEnabled()); +} + + // #pragma mark - diff --git a/src/apps/codycam/CodyCam.h b/src/apps/codycam/CodyCam.h index b87f4c327e..c6bd96393a 100644 --- a/src/apps/codycam/CodyCam.h +++ b/src/apps/codycam/CodyCam.h @@ -84,6 +84,8 @@ const char* kUploadClients[] = { const int32 kUploadClientsCount = sizeof(kUploadClients) / sizeof(char*); +class VideoWindow; +class ControlWindow; class CodyCam : public BApplication { public: @@ -104,9 +106,9 @@ private: VideoConsumer* fVideoConsumer; media_output fProducerOut; media_input fConsumerIn; - BWindow* fWindow; + VideoWindow* fWindow; port_id fPort; - BWindow* fVideoControlWindow; + ControlWindow* fVideoControlWindow; }; @@ -124,6 +126,7 @@ public: BView* VideoView(); BStringView* StatusLine(); + void ToggleMenuOnOff(); private: void _BuildCaptureControls(); @@ -159,6 +162,8 @@ private: ftp_msg_info fFtpInfo; Settings* fSettings; + + BMenu* fMenu; StringValueSetting* fServerSetting; StringValueSetting* fLoginSetting; From 2c1dcd1feee12acb2e344d09482769cac705549f Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Mon, 23 Jul 2012 21:51:33 +0000 Subject: [PATCH 29/65] Added hgrep and lgrep as OptionalPackages, this fixes #3376. --- build/jam/OptionalPackages | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index caf1e5e71a..eeb58f634e 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -53,8 +53,10 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 # GitDoc - documentation for the distributed version control system # GPerf - the perfect hash function generator. # Groff - text formatter used for man pages +# HGrep - header grep tool # ICU-devel - the headers and lib-links for ICU (for development) # KeymapSwitcher - Easy to use keymap switcher +# LGrep - Library Grep tool # LibEvent - An event notification library # LibIconv - text encoding conversion library # LibLayout - GCC2 package needed by some BeOS apps to compile @@ -1057,6 +1059,18 @@ if [ IsOptionalHaikuImagePackageAdded Groff ] { } +# HGgrep +if [ IsOptionalHaikuImagePackageAdded HGrep ] { + if $(TARGET_ARCH) != x86 { + Echo "No optional package HGrep available for $(TARGET_ARCH)" ; + } else { + InstallOptionalHaikuImagePackage + hgrep-1.0-x86-gcc2-2012-07-23.zip + : $(baseURL)/hgrep-1.0-x86-gcc2-2012-07-23.zip ; + } +} + + # ICU if [ IsOptionalHaikuImagePackageAdded ICU ] { if $(TARGET_ARCH) != x86 { @@ -1132,6 +1146,18 @@ if [ IsOptionalHaikuImagePackageAdded KeymapSwitcher ] { } +# LGrep +if [ IsOptionalHaikuImagePackageAdded LGrep ] { + if $(TARGET_ARCH) != x86 { + Echo "No optional package LGrep available for $(TARGET_ARCH)" ; + } else { + InstallOptionalHaikuImagePackage + lgrep-1.0-x86-gcc2-2012-07-23.zip + : $(baseURL)/lgrep-1.0-x86-gcc2-2012-07-23.zip ; + } +} + + # LibEvent if [ IsOptionalHaikuImagePackageAdded LibEvent ] { if $(TARGET_ARCH) != x86 { From f4b1ddb580a6a390c7b11b66c799de95014c2c29 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 24 Jul 2012 00:28:16 +0200 Subject: [PATCH 30/65] Debugger: Coding style: normalize naming, some whitespace fixes * TeamUISettings[Factory] -> TeamUiSettings[Factory] * GUITeamUISettings -> GuiTeamUiSettings * GUISettingsUtils -> GuiSettingsUtils --- src/apps/debugger/Jamfile | 8 ++-- src/apps/debugger/TeamDebugger.cpp | 18 ++++---- ...amUISettings.cpp => GuiTeamUiSettings.cpp} | 38 +++++++-------- ...UITeamUISettings.h => GuiTeamUiSettings.h} | 18 ++++---- src/apps/debugger/settings/TeamSettings.cpp | 46 +++++++++---------- src/apps/debugger/settings/TeamSettings.h | 14 +++--- ...{TeamUISettings.cpp => TeamUiSettings.cpp} | 6 +-- .../{TeamUISettings.h => TeamUiSettings.h} | 8 ++-- ...sFactory.cpp => TeamUiSettingsFactory.cpp} | 23 +++++----- ...tingsFactory.h => TeamUiSettingsFactory.h} | 10 ++-- .../debugger/user_interface/UserInterface.h | 6 +-- .../cli/CommandLineUserInterface.cpp | 4 +- .../cli/CommandLineUserInterface.h | 4 +- .../gui/GraphicalUserInterface.cpp | 12 ++--- .../gui/GraphicalUserInterface.h | 4 +- .../gui/inspector_window/InspectorWindow.cpp | 4 +- .../gui/inspector_window/InspectorWindow.h | 4 +- .../gui/team_window/BreakpointListView.cpp | 6 +-- .../gui/team_window/ImageFunctionsView.cpp | 6 +-- .../gui/team_window/ImageListView.cpp | 6 +-- .../gui/team_window/RegistersView.cpp | 6 +-- .../gui/team_window/StackTraceView.cpp | 6 +-- .../gui/team_window/TeamWindow.cpp | 32 ++++++------- .../gui/team_window/TeamWindow.h | 8 ++-- .../gui/team_window/ThreadListView.cpp | 6 +-- .../gui/team_window/VariablesView.cpp | 6 +-- ...SettingsUtils.cpp => GuiSettingsUtils.cpp} | 10 ++-- ...{GUISettingsUtils.h => GuiSettingsUtils.h} | 2 +- 28 files changed, 161 insertions(+), 160 deletions(-) rename src/apps/debugger/settings/{GUITeamUISettings.cpp => GuiTeamUiSettings.cpp} (62%) rename src/apps/debugger/settings/{GUITeamUISettings.h => GuiTeamUiSettings.h} (68%) rename src/apps/debugger/settings/{TeamUISettings.cpp => TeamUiSettings.cpp} (56%) rename src/apps/debugger/settings/{TeamUISettings.h => TeamUiSettings.h} (81%) rename src/apps/debugger/settings/{TeamUISettingsFactory.cpp => TeamUiSettingsFactory.cpp} (69%) rename src/apps/debugger/settings/{TeamUISettingsFactory.h => TeamUiSettingsFactory.h} (68%) rename src/apps/debugger/user_interface/gui/util/{GUISettingsUtils.cpp => GuiSettingsUtils.cpp} (79%) rename src/apps/debugger/user_interface/gui/util/{GUISettingsUtils.h => GuiSettingsUtils.h} (96%) diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index f9c017f665..62aa4c3386 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -145,11 +145,11 @@ Application Debugger : # settings BreakpointSetting.cpp - GUITeamUISettings.cpp + GuiTeamUiSettings.cpp SettingsManager.cpp TeamSettings.cpp - TeamUISettings.cpp - TeamUISettingsFactory.cpp + TeamUiSettings.cpp + TeamUiSettingsFactory.cpp # settings/generic Setting.cpp @@ -209,7 +209,7 @@ Application Debugger : # user_interface/gui/util ActionMenuItem.cpp - GUISettingsUtils.cpp + GuiSettingsUtils.cpp SettingsMenu.cpp TargetAddressTableColumn.cpp diff --git a/src/apps/debugger/TeamDebugger.cpp b/src/apps/debugger/TeamDebugger.cpp index 628678d245..4f3caa5415 100644 --- a/src/apps/debugger/TeamDebugger.cpp +++ b/src/apps/debugger/TeamDebugger.cpp @@ -40,7 +40,7 @@ #include "TeamMemoryBlock.h" #include "TeamMemoryBlockManager.h" #include "TeamSettings.h" -#include "TeamUISettings.h" +#include "TeamUiSettings.h" #include "Tracing.h" #include "ValueNode.h" #include "ValueNodeContainer.h" @@ -1408,7 +1408,7 @@ TeamDebugger::_LoadSettings() breakpointSetting->IsEnabled()); } - const TeamUISettings* uiSettings = fTeamSettings.UISettingFor( + const TeamUiSettings* uiSettings = fTeamSettings.UiSettingFor( fUserInterface->ID()); if (uiSettings != NULL) fUserInterface->LoadSettings(uiSettings); @@ -1424,19 +1424,19 @@ TeamDebugger::_SaveSettings() if (settings.SetTo(fTeam) != B_OK) return; - TeamUISettings* uiSettings = NULL; + TeamUiSettings* uiSettings = NULL; if (fUserInterface->SaveSettings(uiSettings) != B_OK) return; if (uiSettings != NULL) - settings.AddUISettings(uiSettings); + settings.AddUiSettings(uiSettings); // preserve the UI settings from our cached copy. - for (int32 i = 0; i < fTeamSettings.CountUISettings(); i++) { - const TeamUISettings* oldUISettings = fTeamSettings.UISettingAt(i); - if (strcmp(oldUISettings->ID(), fUserInterface->ID()) != 0) { - TeamUISettings* clonedSettings = oldUISettings->Clone(); + for (int32 i = 0; i < fTeamSettings.CountUiSettings(); i++) { + const TeamUiSettings* oldUiSettings = fTeamSettings.UiSettingAt(i); + if (strcmp(oldUiSettings->ID(), fUserInterface->ID()) != 0) { + TeamUiSettings* clonedSettings = oldUiSettings->Clone(); if (clonedSettings != NULL) - settings.AddUISettings(clonedSettings); + settings.AddUiSettings(clonedSettings); } } locker.Unlock(); diff --git a/src/apps/debugger/settings/GUITeamUISettings.cpp b/src/apps/debugger/settings/GuiTeamUiSettings.cpp similarity index 62% rename from src/apps/debugger/settings/GUITeamUISettings.cpp rename to src/apps/debugger/settings/GuiTeamUiSettings.cpp index 93941e83fa..d714f53fa1 100644 --- a/src/apps/debugger/settings/GUITeamUISettings.cpp +++ b/src/apps/debugger/settings/GuiTeamUiSettings.cpp @@ -4,52 +4,52 @@ */ -#include "GUITeamUISettings.h" +#include "GuiTeamUiSettings.h" #include -GUITeamUISettings::GUITeamUISettings() +GuiTeamUiSettings::GuiTeamUiSettings() { } -GUITeamUISettings::GUITeamUISettings(const char* settingsID) +GuiTeamUiSettings::GuiTeamUiSettings(const char* settingsID) : fID(settingsID) { } -GUITeamUISettings::GUITeamUISettings(const GUITeamUISettings& other) +GuiTeamUiSettings::GuiTeamUiSettings(const GuiTeamUiSettings& other) { if (_SetTo(other) != B_OK) throw std::bad_alloc(); } -GUITeamUISettings::~GUITeamUISettings() +GuiTeamUiSettings::~GuiTeamUiSettings() { _Unset(); } team_ui_settings_type -GUITeamUISettings::Type() const +GuiTeamUiSettings::Type() const { return TEAM_UI_SETTINGS_TYPE_GUI; } const char* -GUITeamUISettings::ID() const +GuiTeamUiSettings::ID() const { return fID.String(); } status_t -GUITeamUISettings::SetTo(const BMessage& archive) +GuiTeamUiSettings::SetTo(const BMessage& archive) { status_t error = archive.FindString("ID", &fID); if (error != B_OK) @@ -62,7 +62,7 @@ GUITeamUISettings::SetTo(const BMessage& archive) status_t -GUITeamUISettings::WriteTo(BMessage& archive) const +GuiTeamUiSettings::WriteTo(BMessage& archive) const { archive.MakeEmpty(); status_t error = archive.AddString("ID", fID); @@ -79,10 +79,10 @@ GUITeamUISettings::WriteTo(BMessage& archive) const } -TeamUISettings* -GUITeamUISettings::Clone() const +TeamUiSettings* +GuiTeamUiSettings::Clone() const { - GUITeamUISettings* settings = new(std::nothrow) GUITeamUISettings(fID); + GuiTeamUiSettings* settings = new(std::nothrow) GuiTeamUiSettings(fID); if (settings == NULL) return NULL; @@ -97,7 +97,7 @@ GUITeamUISettings::Clone() const bool -GUITeamUISettings::AddSettings(const char* settingID, const BMessage& data) +GuiTeamUiSettings::AddSettings(const char* settingID, const BMessage& data) { fValues.RemoveName(settingID); @@ -106,21 +106,21 @@ GUITeamUISettings::AddSettings(const char* settingID, const BMessage& data) status_t -GUITeamUISettings::Settings(const char* settingID, BMessage &data) const +GuiTeamUiSettings::Settings(const char* settingID, BMessage &data) const { return fValues.FindMessage(settingID, &data); } const BMessage& -GUITeamUISettings::Values() const +GuiTeamUiSettings::Values() const { return fValues; } -GUITeamUISettings& -GUITeamUISettings::operator=(const GUITeamUISettings& other) +GuiTeamUiSettings& +GuiTeamUiSettings::operator=(const GuiTeamUiSettings& other) { if (_SetTo(other) != B_OK) throw std::bad_alloc(); @@ -130,7 +130,7 @@ GUITeamUISettings::operator=(const GUITeamUISettings& other) status_t -GUITeamUISettings::_SetTo(const GUITeamUISettings& other) +GuiTeamUiSettings::_SetTo(const GuiTeamUiSettings& other) { _Unset(); @@ -143,7 +143,7 @@ GUITeamUISettings::_SetTo(const GUITeamUISettings& other) void -GUITeamUISettings::_Unset() +GuiTeamUiSettings::_Unset() { fID.Truncate(0); diff --git a/src/apps/debugger/settings/GUITeamUISettings.h b/src/apps/debugger/settings/GuiTeamUiSettings.h similarity index 68% rename from src/apps/debugger/settings/GUITeamUISettings.h rename to src/apps/debugger/settings/GuiTeamUiSettings.h index dbf365ee8b..4e9eaffdf6 100644 --- a/src/apps/debugger/settings/GUITeamUISettings.h +++ b/src/apps/debugger/settings/GuiTeamUiSettings.h @@ -12,23 +12,23 @@ #include #include "Setting.h" -#include "TeamUISettings.h" +#include "TeamUiSettings.h" -class GUITeamUISettings : public TeamUISettings { +class GuiTeamUiSettings : public TeamUiSettings { public: - GUITeamUISettings(); - GUITeamUISettings(const char* settingsID); - GUITeamUISettings(const GUITeamUISettings& + GuiTeamUiSettings(); + GuiTeamUiSettings(const char* settingsID); + GuiTeamUiSettings(const GuiTeamUiSettings& other); // throws std::bad_alloc - ~GUITeamUISettings(); + ~GuiTeamUiSettings(); virtual team_ui_settings_type Type() const; virtual const char* ID() const; virtual status_t SetTo(const BMessage& archive); virtual status_t WriteTo(BMessage& archive) const; - virtual TeamUISettings* Clone() const; + virtual TeamUiSettings* Clone() const; bool AddSettings(const char* settingID, const BMessage& data); @@ -37,12 +37,12 @@ public: const BMessage& Values() const; - GUITeamUISettings& operator=(const GUITeamUISettings& other); + GuiTeamUiSettings& operator=(const GuiTeamUiSettings& other); // throws std::bad_alloc private: - status_t _SetTo(const GUITeamUISettings& other); + status_t _SetTo(const GuiTeamUiSettings& other); void _Unset(); BMessage fValues; diff --git a/src/apps/debugger/settings/TeamSettings.cpp b/src/apps/debugger/settings/TeamSettings.cpp index 4e4d5c9ab9..605202dcf8 100644 --- a/src/apps/debugger/settings/TeamSettings.cpp +++ b/src/apps/debugger/settings/TeamSettings.cpp @@ -15,8 +15,8 @@ #include "ArchivingUtils.h" #include "BreakpointSetting.h" #include "Team.h" -#include "TeamUISettings.h" -#include "TeamUISettingsFactory.h" +#include "TeamUiSettings.h" +#include "TeamUiSettingsFactory.h" #include "UserBreakpoint.h" @@ -104,9 +104,9 @@ TeamSettings::SetTo(const BMessage& archive) // add UI settings for (int32 i = 0; archive.FindMessage("uisettings", i, &childArchive) == B_OK; i++) { - TeamUISettings* setting = NULL; - error = TeamUISettingsFactory::Create(childArchive, setting); - if (error == B_OK && !fUISettings.AddItem(setting)) + TeamUiSettings* setting = NULL; + error = TeamUiSettingsFactory::Create(childArchive, setting); + if (error == B_OK && !fUiSettings.AddItem(setting)) error = B_NO_MEMORY; if (error != B_OK) { delete setting; @@ -137,7 +137,7 @@ TeamSettings::WriteTo(BMessage& archive) const return error; } - for (int32 i = 0; TeamUISettings* uiSetting = fUISettings.ItemAt(i); + for (int32 i = 0; TeamUiSettings* uiSetting = fUiSettings.ItemAt(i); i++) { error = uiSetting->WriteTo(childArchive); if (error != B_OK) @@ -167,24 +167,24 @@ TeamSettings::BreakpointAt(int32 index) const int32 -TeamSettings::CountUISettings() const +TeamSettings::CountUiSettings() const { - return fUISettings.CountItems(); + return fUiSettings.CountItems(); } -const TeamUISettings* -TeamSettings::UISettingAt(int32 index) const +const TeamUiSettings* +TeamSettings::UiSettingAt(int32 index) const { - return fUISettings.ItemAt(index); + return fUiSettings.ItemAt(index); } -const TeamUISettings* -TeamSettings::UISettingFor(const char* id) const +const TeamUiSettings* +TeamSettings::UiSettingFor(const char* id) const { - for (int32 i = 0; i < fUISettings.CountItems(); i++) { - TeamUISettings* settings = fUISettings.ItemAt(i); + for (int32 i = 0; i < fUiSettings.CountItems(); i++) { + TeamUiSettings* settings = fUiSettings.ItemAt(i); if (strcmp(settings->ID(), id) == 0) return settings; } @@ -194,9 +194,9 @@ TeamSettings::UISettingFor(const char* id) const status_t -TeamSettings::AddUISettings(TeamUISettings* settings) +TeamSettings::AddUiSettings(TeamUiSettings* settings) { - if (!fUISettings.AddItem(settings)) + if (!fUiSettings.AddItem(settings)) return B_NO_MEMORY; return B_OK; @@ -223,11 +223,11 @@ TeamSettings::operator=(const TeamSettings& other) } } - for (int32 i = 0; TeamUISettings* uiSetting - = other.fUISettings.ItemAt(i); i++) { - TeamUISettings* clonedSetting + for (int32 i = 0; TeamUiSettings* uiSetting + = other.fUiSettings.ItemAt(i); i++) { + TeamUiSettings* clonedSetting = uiSetting->Clone(); - if (!fUISettings.AddItem(clonedSetting)) { + if (!fUiSettings.AddItem(clonedSetting)) { delete clonedSetting; throw std::bad_alloc(); } @@ -245,11 +245,11 @@ TeamSettings::_Unset() delete breakpoint; } - for (int32 i = 0; TeamUISettings* uiSetting = fUISettings.ItemAt(i); i++) + for (int32 i = 0; TeamUiSettings* uiSetting = fUiSettings.ItemAt(i); i++) delete uiSetting; fBreakpoints.MakeEmpty(); - fUISettings.MakeEmpty(); + fUiSettings.MakeEmpty(); fTeamName.Truncate(0); } diff --git a/src/apps/debugger/settings/TeamSettings.h b/src/apps/debugger/settings/TeamSettings.h index 6c266b017a..f41f2bf8bd 100644 --- a/src/apps/debugger/settings/TeamSettings.h +++ b/src/apps/debugger/settings/TeamSettings.h @@ -14,7 +14,7 @@ class BMessage; class Team; class BreakpointSetting; -class TeamUISettings; +class TeamUiSettings; class TeamSettings { @@ -33,24 +33,24 @@ public: int32 CountBreakpoints() const; const BreakpointSetting* BreakpointAt(int32 index) const; - int32 CountUISettings() const; - const TeamUISettings* UISettingAt(int32 index) const; - const TeamUISettings* UISettingFor(const char* id) const; - status_t AddUISettings(TeamUISettings* settings); + int32 CountUiSettings() const; + const TeamUiSettings* UiSettingAt(int32 index) const; + const TeamUiSettings* UiSettingFor(const char* id) const; + status_t AddUiSettings(TeamUiSettings* settings); TeamSettings& operator=(const TeamSettings& other); // throws std::bad_alloc private: typedef BObjectList BreakpointList; - typedef BObjectList UISettingsList; + typedef BObjectList UiSettingsList; private: void _Unset(); private: BreakpointList fBreakpoints; - UISettingsList fUISettings; + UiSettingsList fUiSettings; BString fTeamName; }; diff --git a/src/apps/debugger/settings/TeamUISettings.cpp b/src/apps/debugger/settings/TeamUiSettings.cpp similarity index 56% rename from src/apps/debugger/settings/TeamUISettings.cpp rename to src/apps/debugger/settings/TeamUiSettings.cpp index a417e8c9ee..76b96e0266 100644 --- a/src/apps/debugger/settings/TeamUISettings.cpp +++ b/src/apps/debugger/settings/TeamUiSettings.cpp @@ -4,14 +4,14 @@ */ -#include "TeamUISettings.h" +#include "TeamUiSettings.h" -TeamUISettings::TeamUISettings() +TeamUiSettings::TeamUiSettings() { } -TeamUISettings::~TeamUISettings() +TeamUiSettings::~TeamUiSettings() { } diff --git a/src/apps/debugger/settings/TeamUISettings.h b/src/apps/debugger/settings/TeamUiSettings.h similarity index 81% rename from src/apps/debugger/settings/TeamUISettings.h rename to src/apps/debugger/settings/TeamUiSettings.h index 06913d7b39..d842dbd15d 100644 --- a/src/apps/debugger/settings/TeamUISettings.h +++ b/src/apps/debugger/settings/TeamUiSettings.h @@ -18,17 +18,17 @@ enum team_ui_settings_type { }; -class TeamUISettings { +class TeamUiSettings { public: - TeamUISettings(); - virtual ~TeamUISettings(); + TeamUiSettings(); + virtual ~TeamUiSettings(); virtual team_ui_settings_type Type() const = 0; virtual const char* ID() const = 0; virtual status_t SetTo(const BMessage& archive) = 0; virtual status_t WriteTo(BMessage& archive) const = 0; - virtual TeamUISettings* Clone() const = 0; + virtual TeamUiSettings* Clone() const = 0; // throws std::bad_alloc }; diff --git a/src/apps/debugger/settings/TeamUISettingsFactory.cpp b/src/apps/debugger/settings/TeamUiSettingsFactory.cpp similarity index 69% rename from src/apps/debugger/settings/TeamUISettingsFactory.cpp rename to src/apps/debugger/settings/TeamUiSettingsFactory.cpp index 4651e8c383..4ff393e968 100644 --- a/src/apps/debugger/settings/TeamUISettingsFactory.cpp +++ b/src/apps/debugger/settings/TeamUiSettingsFactory.cpp @@ -2,36 +2,37 @@ * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ - -#include "TeamUISettingsFactory.h" + + +#include "TeamUiSettingsFactory.h" #include -#include "GUITeamUISettings.h" +#include "GuiTeamUiSettings.h" -TeamUISettingsFactory::TeamUISettingsFactory() +TeamUiSettingsFactory::TeamUiSettingsFactory() { } -TeamUISettingsFactory::~TeamUISettingsFactory() +TeamUiSettingsFactory::~TeamUiSettingsFactory() { } status_t -TeamUISettingsFactory::Create(const BMessage& archive, TeamUISettings*& - settings) +TeamUiSettingsFactory::Create(const BMessage& archive, + TeamUiSettings*& settings) { int32 type; status_t error = archive.FindInt32("type", &type); if (error != B_OK) return error; - + switch (type) { case TEAM_UI_SETTINGS_TYPE_GUI: - settings = new(std::nothrow) GUITeamUISettings(); + settings = new(std::nothrow) GuiTeamUiSettings(); if (settings == NULL) return B_NO_MEMORY; @@ -42,7 +43,7 @@ TeamUISettingsFactory::Create(const BMessage& archive, TeamUISettings*& return error; } break; - + case TEAM_UI_SETTINGS_TYPE_CLI: // TODO: implement once we have a CLI interface // (and corresponding settings) @@ -51,6 +52,6 @@ TeamUISettingsFactory::Create(const BMessage& archive, TeamUISettings*& default: return B_BAD_DATA; } - + return B_OK; } diff --git a/src/apps/debugger/settings/TeamUISettingsFactory.h b/src/apps/debugger/settings/TeamUiSettingsFactory.h similarity index 68% rename from src/apps/debugger/settings/TeamUISettingsFactory.h rename to src/apps/debugger/settings/TeamUiSettingsFactory.h index 40054db462..8ec0b3cb9e 100644 --- a/src/apps/debugger/settings/TeamUISettingsFactory.h +++ b/src/apps/debugger/settings/TeamUiSettingsFactory.h @@ -10,15 +10,15 @@ class BMessage; -class TeamUISettings; +class TeamUiSettings; -class TeamUISettingsFactory { +class TeamUiSettingsFactory { public: - TeamUISettingsFactory(); - ~TeamUISettingsFactory(); + TeamUiSettingsFactory(); + ~TeamUiSettingsFactory(); static status_t Create(const BMessage& archive, - TeamUISettings*& settings); + TeamUiSettings*& settings); }; #endif // TEAM_UI_SETTINGS_FACTORY_H diff --git a/src/apps/debugger/user_interface/UserInterface.h b/src/apps/debugger/user_interface/UserInterface.h index d116d3bf4d..054aba752a 100644 --- a/src/apps/debugger/user_interface/UserInterface.h +++ b/src/apps/debugger/user_interface/UserInterface.h @@ -19,7 +19,7 @@ class FunctionInstance; class Image; class StackFrame; class Team; -class TeamUISettings; +class TeamUiSettings; class Thread; class TypeComponentPath; class UserBreakpoint; @@ -49,9 +49,9 @@ public: // shut down the UI *now* -- no more user // feedback - virtual status_t LoadSettings(const TeamUISettings* settings) + virtual status_t LoadSettings(const TeamUiSettings* settings) = 0; - virtual status_t SaveSettings(TeamUISettings*& settings) + virtual status_t SaveSettings(TeamUiSettings*& settings) const = 0; virtual void NotifyUser(const char* title, diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 98103065fe..e45995f1d9 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -145,14 +145,14 @@ CommandLineUserInterface::Terminate() status_t -CommandLineUserInterface::LoadSettings(const TeamUISettings* settings) +CommandLineUserInterface::LoadSettings(const TeamUiSettings* settings) { return B_OK; } status_t -CommandLineUserInterface::SaveSettings(TeamUISettings*& settings) const +CommandLineUserInterface::SaveSettings(TeamUiSettings*& settings) const { return B_OK; } diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h index 7f0c0acbf2..f6a1c8b2c9 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h @@ -31,8 +31,8 @@ public: // shut down the UI *now* -- no more user // feedback - virtual status_t LoadSettings(const TeamUISettings* settings); - virtual status_t SaveSettings(TeamUISettings*& settings) const; + virtual status_t LoadSettings(const TeamUiSettings* settings); + virtual status_t SaveSettings(TeamUiSettings*& settings) const; virtual void NotifyUser(const char* title, const char* message, diff --git a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp index 2267f65f45..136c72138f 100644 --- a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp +++ b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp @@ -9,7 +9,7 @@ #include -#include "GUITeamUISettings.h" +#include "GuiTeamUiSettings.h" #include "TeamWindow.h" #include "Tracing.h" @@ -72,22 +72,22 @@ GraphicalUserInterface::Terminate() status_t -GraphicalUserInterface::LoadSettings(const TeamUISettings* settings) +GraphicalUserInterface::LoadSettings(const TeamUiSettings* settings) { - status_t result = fTeamWindow->LoadSettings((GUITeamUISettings*)settings); + status_t result = fTeamWindow->LoadSettings((GuiTeamUiSettings*)settings); return result; } status_t -GraphicalUserInterface::SaveSettings(TeamUISettings*& settings) const +GraphicalUserInterface::SaveSettings(TeamUiSettings*& settings) const { - settings = new(std::nothrow) GUITeamUISettings(ID()); + settings = new(std::nothrow) GuiTeamUiSettings(ID()); if (settings == NULL) return B_NO_MEMORY; - fTeamWindow->SaveSettings((GUITeamUISettings*)settings); + fTeamWindow->SaveSettings((GuiTeamUiSettings*)settings); return B_OK; } diff --git a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h index d02c29fec1..60b7d5b415 100644 --- a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h +++ b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h @@ -27,8 +27,8 @@ public: // shut down the UI *now* -- no more user // feedback - virtual status_t LoadSettings(const TeamUISettings* settings); - virtual status_t SaveSettings(TeamUISettings*& settings) const; + virtual status_t LoadSettings(const TeamUiSettings* settings); + virtual status_t SaveSettings(TeamUiSettings*& settings) const; virtual void NotifyUser(const char* title, const char* message, diff --git a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp index 224cb0a88f..5d2893258d 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp +++ b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp @@ -19,7 +19,7 @@ #include #include "Architecture.h" -#include "GUITeamUISettings.h" +#include "GuiTeamUiSettings.h" #include "MemoryView.h" #include "MessageCodes.h" #include "Team.h" @@ -285,7 +285,7 @@ InspectorWindow::MemoryBlockRetrieved(TeamMemoryBlock* block) status_t -InspectorWindow::LoadSettings(const GUITeamUISettings& settings) +InspectorWindow::LoadSettings(const GuiTeamUiSettings& settings) { AutoLocker lock(this); if (!lock.IsLocked()) diff --git a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h index 9c85112cb3..a145e1899c 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h +++ b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h @@ -16,7 +16,7 @@ class BButton; class BMenuField; class BMessenger; class BTextControl; -class GUITeamUISettings; +class GuiTeamUiSettings; class MemoryView; class Team; class UserInterfaceListener; @@ -41,7 +41,7 @@ public: virtual void MemoryBlockRetrieved(TeamMemoryBlock* block); status_t LoadSettings( - const GUITeamUISettings& settings); + const GuiTeamUiSettings& settings); status_t SaveSettings( BMessage& settings); private: diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp b/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp index e05ca08dce..a9ef8f870b 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp @@ -15,7 +15,7 @@ #include #include "FunctionID.h" -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include "LocatableFile.h" #include "table/TableColumns.h" #include "Team.h" @@ -241,7 +241,7 @@ BreakpointListView::LoadSettings(const BMessage& settings) { BMessage tableSettings; if (settings.FindMessage("breakpointsTable", &tableSettings) == B_OK) { - GUISettingsUtils::UnarchiveTableSettings(tableSettings, + GuiSettingsUtils::UnarchiveTableSettings(tableSettings, fBreakpointsTable); } } @@ -253,7 +253,7 @@ BreakpointListView::SaveSettings(BMessage& settings) settings.MakeEmpty(); BMessage tableSettings; - status_t result = GUISettingsUtils::ArchiveTableSettings(tableSettings, + status_t result = GuiSettingsUtils::ArchiveTableSettings(tableSettings, fBreakpointsTable); if (result == B_OK) result = settings.AddMessage("breakpointsTable", &tableSettings); diff --git a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp index 79315020fc..9d21acb028 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp @@ -16,7 +16,7 @@ #include "table/TableColumns.h" #include "FunctionInstance.h" -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include "Image.h" #include "ImageDebugInfo.h" #include "LocatableFile.h" @@ -398,7 +398,7 @@ ImageFunctionsView::LoadSettings(const BMessage& settings) { BMessage tableSettings; if (settings.FindMessage("functionsTable", &tableSettings) == B_OK) { - GUISettingsUtils::UnarchiveTableSettings(tableSettings, + GuiSettingsUtils::UnarchiveTableSettings(tableSettings, fFunctionsTable); } } @@ -410,7 +410,7 @@ ImageFunctionsView::SaveSettings(BMessage& settings) settings.MakeEmpty(); BMessage tableSettings; - status_t result = GUISettingsUtils::ArchiveTableSettings(tableSettings, + status_t result = GuiSettingsUtils::ArchiveTableSettings(tableSettings, fFunctionsTable); if (result == B_OK) result = settings.AddMessage("functionsTable", &tableSettings); diff --git a/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp b/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp index 4371ac8a83..1588aefb04 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp @@ -16,7 +16,7 @@ #include #include -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include "table/TableColumns.h" #include "Tracing.h" @@ -231,7 +231,7 @@ ImageListView::LoadSettings(const BMessage& settings) { BMessage tableSettings; if (settings.FindMessage("imagesTable", &tableSettings) == B_OK) { - GUISettingsUtils::UnarchiveTableSettings(tableSettings, + GuiSettingsUtils::UnarchiveTableSettings(tableSettings, fImagesTable); } } @@ -243,7 +243,7 @@ ImageListView::SaveSettings(BMessage& settings) settings.MakeEmpty(); BMessage tableSettings; - status_t result = GUISettingsUtils::ArchiveTableSettings(tableSettings, + status_t result = GuiSettingsUtils::ArchiveTableSettings(tableSettings, fImagesTable); if (result == B_OK) result = settings.AddMessage("imagesTable", &tableSettings); diff --git a/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp b/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp index 12a86550a7..a2349e0089 100644 --- a/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp @@ -16,7 +16,7 @@ #include "Architecture.h" #include "CpuState.h" -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include "Register.h" @@ -233,7 +233,7 @@ RegistersView::LoadSettings(const BMessage& settings) { BMessage tableSettings; if (settings.FindMessage("registerTable", &tableSettings) == B_OK) { - GUISettingsUtils::UnarchiveTableSettings(tableSettings, + GuiSettingsUtils::UnarchiveTableSettings(tableSettings, fRegisterTable); } } @@ -245,7 +245,7 @@ RegistersView::SaveSettings(BMessage& settings) settings.MakeEmpty(); BMessage tableSettings; - status_t result = GUISettingsUtils::ArchiveTableSettings(tableSettings, + status_t result = GuiSettingsUtils::ArchiveTableSettings(tableSettings, fRegisterTable); if (result == B_OK) result = settings.AddMessage("registerTable", &tableSettings); diff --git a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp index 0ac14d923c..70cb01afe2 100644 --- a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp @@ -16,7 +16,7 @@ #include "table/TableColumns.h" #include "FunctionInstance.h" -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include "Image.h" #include "StackTrace.h" #include "TargetAddressTableColumn.h" @@ -203,7 +203,7 @@ StackTraceView::LoadSettings(const BMessage& settings) { BMessage tableSettings; if (settings.FindMessage("framesTable", &tableSettings) == B_OK) { - GUISettingsUtils::UnarchiveTableSettings(tableSettings, + GuiSettingsUtils::UnarchiveTableSettings(tableSettings, fFramesTable); } } @@ -215,7 +215,7 @@ StackTraceView::SaveSettings(BMessage& settings) settings.MakeEmpty(); BMessage tableSettings; - status_t result = GUISettingsUtils::ArchiveTableSettings(tableSettings, + status_t result = GuiSettingsUtils::ArchiveTableSettings(tableSettings, fFramesTable); if (result == B_OK) result = settings.AddMessage("framesTable", &tableSettings); diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index e4363313d2..9c0338ce37 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -30,8 +30,8 @@ #include "CpuState.h" #include "DisassembledCode.h" #include "FileSourceCode.h" -#include "GUISettingsUtils.h" -#include "GUITeamUISettings.h" +#include "GuiSettingsUtils.h" +#include "GuiTeamUiSettings.h" #include "Image.h" #include "ImageDebugInfo.h" #include "InspectorWindow.h" @@ -224,7 +224,7 @@ TeamWindow::MessageReceived(BMessage* message) fListener, this); if (fInspectorWindow != NULL) { BMessage settings; - fInspectorWindow->LoadSettings(fUISettings); + fInspectorWindow->LoadSettings(fUiSettings); fInspectorWindow->Show(); } } catch (...) { @@ -357,7 +357,7 @@ TeamWindow::QuitRequested() status_t -TeamWindow::LoadSettings(const GUITeamUISettings* settings) +TeamWindow::LoadSettings(const GuiTeamUiSettings* settings) { AutoLocker lock(this); if (!lock.IsLocked()) @@ -376,16 +376,16 @@ TeamWindow::LoadSettings(const GUITeamUISettings* settings) BMessage archive; if (teamWindowSettings.FindMessage("sourceSplit", &archive) == B_OK) - GUISettingsUtils::UnarchiveSplitView(archive, fSourceSplitView); + GuiSettingsUtils::UnarchiveSplitView(archive, fSourceSplitView); if (teamWindowSettings.FindMessage("functionSplit", &archive) == B_OK) - GUISettingsUtils::UnarchiveSplitView(archive, fFunctionSplitView); + GuiSettingsUtils::UnarchiveSplitView(archive, fFunctionSplitView); if (teamWindowSettings.FindMessage("imageSplit", &archive) == B_OK) - GUISettingsUtils::UnarchiveSplitView(archive, fImageSplitView); + GuiSettingsUtils::UnarchiveSplitView(archive, fImageSplitView); if (teamWindowSettings.FindMessage("threadSplit", &archive) == B_OK) - GUISettingsUtils::UnarchiveSplitView(archive, fThreadSplitView); + GuiSettingsUtils::UnarchiveSplitView(archive, fThreadSplitView); if (teamWindowSettings.FindMessage("imageListView", &archive) == B_OK) fImageListView->LoadSettings(archive); @@ -408,21 +408,21 @@ TeamWindow::LoadSettings(const GUITeamUISettings* settings) if (teamWindowSettings.FindMessage("breakpointsView", &archive) == B_OK) fBreakpointsView->LoadSettings(archive); - fUISettings = *settings; + fUiSettings = *settings; return B_OK; } status_t -TeamWindow::SaveSettings(GUITeamUISettings* settings) +TeamWindow::SaveSettings(GuiTeamUiSettings* settings) { AutoLocker lock(this); if (!lock.IsLocked()) return B_ERROR; BMessage inspectorSettings; - if (fUISettings.Settings("inspectorWindow", inspectorSettings) == B_OK) { + if (fUiSettings.Settings("inspectorWindow", inspectorSettings) == B_OK) { if (!settings->AddSettings("inspectorWindow", inspectorSettings)) return B_NO_MEMORY; } @@ -432,22 +432,22 @@ TeamWindow::SaveSettings(GUITeamUISettings* settings) if (teamWindowSettings.AddRect("frame", Frame()) != B_OK) return B_NO_MEMORY; - if (GUISettingsUtils::ArchiveSplitView(archive, fSourceSplitView) != B_OK) + if (GuiSettingsUtils::ArchiveSplitView(archive, fSourceSplitView) != B_OK) return B_NO_MEMORY; if (teamWindowSettings.AddMessage("sourceSplit", &archive) != B_OK) return B_NO_MEMORY; - if (GUISettingsUtils::ArchiveSplitView(archive, fFunctionSplitView) != B_OK) + if (GuiSettingsUtils::ArchiveSplitView(archive, fFunctionSplitView) != B_OK) return B_NO_MEMORY; if (teamWindowSettings.AddMessage("functionSplit", &archive) != B_OK) return B_NO_MEMORY; - if (GUISettingsUtils::ArchiveSplitView(archive, fImageSplitView) != B_OK) + if (GuiSettingsUtils::ArchiveSplitView(archive, fImageSplitView) != B_OK) return B_NO_MEMORY; if (teamWindowSettings.AddMessage("imageSplit", &archive)) return B_NO_MEMORY; - if (GUISettingsUtils::ArchiveSplitView(archive, fThreadSplitView) != B_OK) + if (GuiSettingsUtils::ArchiveSplitView(archive, fThreadSplitView) != B_OK) return B_NO_MEMORY; if (teamWindowSettings.AddMessage("threadSplit", &archive)) return B_NO_MEMORY; @@ -1265,7 +1265,7 @@ TeamWindow::_HandleResolveMissingSourceFile(entry_ref& locatedPath) status_t TeamWindow::_SaveInspectorSettings(const BMessage* settings) { - if (fUISettings.AddSettings("inspectorWindow", *settings) != B_OK) + if (fUiSettings.AddSettings("inspectorWindow", *settings) != B_OK) return B_NO_MEMORY; return B_OK; diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h index 14635d4a77..9d979723e6 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h @@ -12,7 +12,7 @@ #include "BreakpointsView.h" #include "Function.h" -#include "GUITeamUISettings.h" +#include "GuiTeamUiSettings.h" #include "ImageFunctionsView.h" #include "ImageListView.h" #include "SourceView.h" @@ -59,9 +59,9 @@ public: virtual bool QuitRequested(); status_t LoadSettings( - const GUITeamUISettings* settings); + const GuiTeamUiSettings* settings); status_t SaveSettings( - GUITeamUISettings* settings); + GuiTeamUiSettings* settings); private: @@ -179,7 +179,7 @@ private: BSplitView* fImageSplitView; BSplitView* fThreadSplitView; InspectorWindow* fInspectorWindow; - GUITeamUISettings fUISettings; + GuiTeamUiSettings fUiSettings; BFilePanel* fSourceLocatePanel; }; diff --git a/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp b/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp index 7ef001c405..a229f855dc 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp @@ -16,7 +16,7 @@ #include #include -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include "table/TableColumns.h" #include "UiUtils.h" @@ -289,7 +289,7 @@ ThreadListView::LoadSettings(const BMessage& settings) { BMessage tableSettings; if (settings.FindMessage("threadsTable", &tableSettings) == B_OK) { - GUISettingsUtils::UnarchiveTableSettings(tableSettings, + GuiSettingsUtils::UnarchiveTableSettings(tableSettings, fThreadsTable); } } @@ -301,7 +301,7 @@ ThreadListView::SaveSettings(BMessage& settings) settings.MakeEmpty(); BMessage tableSettings; - status_t result = GUISettingsUtils::ArchiveTableSettings(tableSettings, + status_t result = GuiSettingsUtils::ArchiveTableSettings(tableSettings, fThreadsTable); if (result == B_OK) result = settings.AddMessage("threadsTable", &tableSettings); diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index b0beb9c0e9..1c83d0d503 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -24,7 +24,7 @@ #include "Architecture.h" #include "FunctionID.h" #include "FunctionInstance.h" -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include "MessageCodes.h" #include "Register.h" #include "SettingsMenu.h" @@ -1687,7 +1687,7 @@ VariablesView::LoadSettings(const BMessage& settings) { BMessage tableSettings; if (settings.FindMessage("variableTable", &tableSettings) == B_OK) { - GUISettingsUtils::UnarchiveTableSettings(tableSettings, + GuiSettingsUtils::UnarchiveTableSettings(tableSettings, fVariableTable); } } @@ -1699,7 +1699,7 @@ VariablesView::SaveSettings(BMessage& settings) settings.MakeEmpty(); BMessage tableSettings; - status_t result = GUISettingsUtils::ArchiveTableSettings(tableSettings, + status_t result = GuiSettingsUtils::ArchiveTableSettings(tableSettings, fVariableTable); if (result == B_OK) result = settings.AddMessage("variableTable", &tableSettings); diff --git a/src/apps/debugger/user_interface/gui/util/GUISettingsUtils.cpp b/src/apps/debugger/user_interface/gui/util/GuiSettingsUtils.cpp similarity index 79% rename from src/apps/debugger/user_interface/gui/util/GUISettingsUtils.cpp rename to src/apps/debugger/user_interface/gui/util/GuiSettingsUtils.cpp index 7d84b99c73..0528efb586 100644 --- a/src/apps/debugger/user_interface/gui/util/GUISettingsUtils.cpp +++ b/src/apps/debugger/user_interface/gui/util/GuiSettingsUtils.cpp @@ -4,7 +4,7 @@ */ -#include "GUISettingsUtils.h" +#include "GuiSettingsUtils.h" #include #include @@ -13,7 +13,7 @@ /*static*/ status_t -GUISettingsUtils::ArchiveSplitView(BMessage& settings, BSplitView* view) +GuiSettingsUtils::ArchiveSplitView(BMessage& settings, BSplitView* view) { settings.MakeEmpty(); for (int32 i = 0; i < view->CountItems(); i++) { @@ -29,7 +29,7 @@ GUISettingsUtils::ArchiveSplitView(BMessage& settings, BSplitView* view) /*static*/ void -GUISettingsUtils::UnarchiveSplitView(const BMessage& settings, +GuiSettingsUtils::UnarchiveSplitView(const BMessage& settings, BSplitView* view) { for (int32 i = 0; i < view->CountItems(); i++) { @@ -45,7 +45,7 @@ GUISettingsUtils::UnarchiveSplitView(const BMessage& settings, /*static*/ status_t -GUISettingsUtils::ArchiveTableSettings(BMessage& settings, +GuiSettingsUtils::ArchiveTableSettings(BMessage& settings, AbstractTable* table) { settings.MakeEmpty(); @@ -56,7 +56,7 @@ GUISettingsUtils::ArchiveTableSettings(BMessage& settings, /*static*/ void -GUISettingsUtils::UnarchiveTableSettings(const BMessage& settings, +GuiSettingsUtils::UnarchiveTableSettings(const BMessage& settings, AbstractTable* table) { BMessage settingsCopy(settings); diff --git a/src/apps/debugger/user_interface/gui/util/GUISettingsUtils.h b/src/apps/debugger/user_interface/gui/util/GuiSettingsUtils.h similarity index 96% rename from src/apps/debugger/user_interface/gui/util/GUISettingsUtils.h rename to src/apps/debugger/user_interface/gui/util/GuiSettingsUtils.h index 454047915b..9035c38d56 100644 --- a/src/apps/debugger/user_interface/gui/util/GUISettingsUtils.h +++ b/src/apps/debugger/user_interface/gui/util/GuiSettingsUtils.h @@ -14,7 +14,7 @@ class BMessage; class BSplitView; -class GUISettingsUtils { +class GuiSettingsUtils { public: static status_t ArchiveSplitView(BMessage& settings, From fb678bc3d02979476bd15a181ba053ae77557705 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 19:04:45 -0400 Subject: [PATCH 31/65] Tracker: Sorting in filtered view led to crash Fixes #6992. --- src/kits/tracker/PoseView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 3e5ededf3d..2349d73631 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -8941,7 +8941,7 @@ BPoseView::SortPoses() if (fFiltering) { poses = reinterpret_cast( PoseList::Private(fFilteredPoseList).AsBList()->Items()); - std::stable_sort(poses, &poses[fPoseList->CountItems()], + std::stable_sort(poses, &poses[fFilteredPoseList->CountItems()], PoseComparator(this)); } } From dc321a67d62048d4afb6ede3a59368029446ea96 Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Mon, 23 Jul 2012 22:22:53 +0000 Subject: [PATCH 32/65] Fixed pair of typos in hgrep script. --- build/jam/OptionalPackages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index eeb58f634e..6f27127193 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -1065,8 +1065,8 @@ if [ IsOptionalHaikuImagePackageAdded HGrep ] { Echo "No optional package HGrep available for $(TARGET_ARCH)" ; } else { InstallOptionalHaikuImagePackage - hgrep-1.0-x86-gcc2-2012-07-23.zip - : $(baseURL)/hgrep-1.0-x86-gcc2-2012-07-23.zip ; + hgrep-1.0.1-x86-gcc2-2012-07-23.zip + : $(baseURL)/hgrep-1.0.1-x86-gcc2-2012-07-23.zip ; } } From e32c26f1c7ab66f202877f88565ad65fa5532318 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 21:50:23 -0400 Subject: [PATCH 33/65] Notification preflet: add margin to views in TabView --- src/preferences/notifications/DisplayView.cpp | 1 + src/preferences/notifications/GeneralView.cpp | 2 +- src/preferences/notifications/NotificationsView.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/preferences/notifications/DisplayView.cpp b/src/preferences/notifications/DisplayView.cpp index e7972157e6..cde5bcfe36 100644 --- a/src/preferences/notifications/DisplayView.cpp +++ b/src/preferences/notifications/DisplayView.cpp @@ -65,6 +65,7 @@ DisplayView::DisplayView(SettingsHost* host) .Add(fIconSizeField->CreateLabelLayoutItem(), 0, 1) .Add(fIconSizeField->CreateMenuBarLayoutItem(), 1, 1) .Add(BSpaceLayoutItem::CreateGlue(), 0, 2, 2, 1) + .SetInsets(inset, inset, inset, inset) ); } diff --git a/src/preferences/notifications/GeneralView.cpp b/src/preferences/notifications/GeneralView.cpp index 081bf89681..7d1eb8df6f 100644 --- a/src/preferences/notifications/GeneralView.cpp +++ b/src/preferences/notifications/GeneralView.cpp @@ -107,7 +107,7 @@ GeneralView::GeneralView(SettingsHost* host) .End() .End() .End() - + .SetInsets(inset, inset, inset, inset) .AddGlue() ); } diff --git a/src/preferences/notifications/NotificationsView.cpp b/src/preferences/notifications/NotificationsView.cpp index be9f1b1c11..b032666a50 100644 --- a/src/preferences/notifications/NotificationsView.cpp +++ b/src/preferences/notifications/NotificationsView.cpp @@ -118,6 +118,7 @@ NotificationsView::NotificationsView() .End() .Add(fApplications) .Add(fNotifications) + .SetInsets(inset, inset, inset, inset) ); } From 4c45f003ede5fdc1ca9da3f51a8b7d5764a0e0a2 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 22:38:44 -0400 Subject: [PATCH 34/65] Tracker: Right clicking on Pose triggered Rename prompts Right clicking on a Pose to get the contextual menu would quite often trigger a rename action of that pose. Don't allow to rename a pose by releasing the secondary mouse button. --- src/kits/tracker/PoseView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 2349d73631..0e7304bf52 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -6929,10 +6929,11 @@ BPoseView::MouseUp(BPoint where) int32 index; BPose* pose = FindPose(where, &index); - if (pose != NULL && fAllowPoseEditing) + uint32 lastButtons = Window()->CurrentMessage()->FindInt32("last_buttons"); + if (pose != NULL && fAllowPoseEditing && !fTrackRightMouseUp) pose->MouseUp(BPoint(0, index * fListElemHeight), this, where, index); - uint32 lastButtons = Window()->CurrentMessage()->FindInt32("last_buttons"); + // this handy field has been added by the tracking filter. // we need lastButtons for right button mouse-up tracking, // because there's currently no way to know wich buttons were From 846b2f90f670827f5ddc6b22772ffb0038c70745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 7 Jul 2012 12:37:54 +0200 Subject: [PATCH 35/65] Changed the kernel's file_map.cpp to be usable from the fs_shell as well. * This should reduce our maintenance burden a tiny bit :-) * It also fixes a bug in the fs_shell, see hrev43395. --- src/system/kernel/cache/file_map.cpp | 37 +- src/tools/fs_shell/Jamfile | 2 + src/tools/fs_shell/file_cache.cpp | 2 +- src/tools/fs_shell/file_map.cpp | 511 --------------------------- src/tools/fs_shell/vfs.cpp | 3 +- src/tools/fs_shell/vfs.h | 4 +- 6 files changed, 30 insertions(+), 529 deletions(-) delete mode 100644 src/tools/fs_shell/file_map.cpp diff --git a/src/system/kernel/cache/file_map.cpp b/src/system/kernel/cache/file_map.cpp index d9e0ddca01..a80f51a921 100644 --- a/src/system/kernel/cache/file_map.cpp +++ b/src/system/kernel/cache/file_map.cpp @@ -1,29 +1,36 @@ /* - * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2004-2012, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ -#include +#include #include #include -#include +#ifdef FS_SHELL +# include "vfs.h" +# include "fssh_api_wrapper.h" -#include -#include +using namespace FSShell; +#else +# include -#include -#include -#include -#include -#include -#include -#include -#include -#include +# include +# include -#include "kernel_debug_config.h" +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "kernel_debug_config.h" +#endif //#define TRACE_FILE_MAP diff --git a/src/tools/fs_shell/Jamfile b/src/tools/fs_shell/Jamfile index 1ef5e33e1e..cfa12b67ec 100644 --- a/src/tools/fs_shell/Jamfile +++ b/src/tools/fs_shell/Jamfile @@ -85,6 +85,8 @@ BuildPlatformStaticLibrary fs_shell.a : SEARCH on [ FGristFiles rootfs.cpp ] = [ FDirName $(HAIKU_TOP) src system kernel fs ] ; +SEARCH on [ FGristFiles file_map.cpp ] + = [ FDirName $(HAIKU_TOP) src system kernel cache ] ; BuildPlatformMain fs_shell_command : fs_shell_command.cpp $(fsShellCommandSources) diff --git a/src/tools/fs_shell/file_cache.cpp b/src/tools/fs_shell/file_cache.cpp index 4f82cfae83..0854d832d9 100644 --- a/src/tools/fs_shell/file_cache.cpp +++ b/src/tools/fs_shell/file_cache.cpp @@ -64,7 +64,7 @@ struct file_cache_ref { fssh_mutex lock; fssh_mount_id mountID; fssh_vnode_id nodeID; - void* node; + struct vnode* node; fssh_off_t virtual_size; }; diff --git a/src/tools/fs_shell/file_map.cpp b/src/tools/fs_shell/file_map.cpp deleted file mode 100644 index a1f3fb0de8..0000000000 --- a/src/tools/fs_shell/file_map.cpp +++ /dev/null @@ -1,511 +0,0 @@ -/* - * Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de. - * Distributed under the terms of the MIT License. - */ - - -#include "fssh_fs_cache.h" - -#include -#include -#include - -#include "fssh_kernel_export.h" -#include "vfs.h" - - -//#define TRACE_FILE_MAP -#ifdef TRACE_FILE_MAP -# define TRACE(x) fssh_dprintf x -#else -# define TRACE(x) ; -#endif - -#define CACHED_FILE_EXTENTS 2 - // must be smaller than MAX_FILE_IO_VECS - // ToDo: find out how much of these are typically used - -using namespace FSShell; - -namespace FSShell { - -struct file_extent { - fssh_off_t offset; - fssh_file_io_vec disk; -}; - -struct file_extent_array { - file_extent* array; - fssh_size_t max_count; -}; - -class FileMap { -public: - FileMap(void* vnode, fssh_off_t size); - ~FileMap(); - - void Invalidate(fssh_off_t offset, fssh_off_t size); - void SetSize(fssh_off_t size); - - fssh_status_t Translate(fssh_off_t offset, fssh_size_t size, - fssh_file_io_vec* vecs, fssh_size_t* _count, - fssh_size_t align); - - file_extent* ExtentAt(uint32_t index); - - fssh_size_t Count() const { return fCount; } - void* Vnode() const { return fVnode; } - fssh_off_t Size() const { return fSize; } - - fssh_status_t SetMode(uint32_t mode); - -private: - file_extent* _FindExtent(fssh_off_t offset, uint32_t* _index); - fssh_status_t _MakeSpace(fssh_size_t count); - fssh_status_t _Add(fssh_file_io_vec* vecs, fssh_size_t vecCount, - fssh_off_t& lastOffset); - fssh_status_t _Cache(fssh_off_t offset, fssh_off_t size); - void _InvalidateAfter(fssh_off_t offset); - void _Free(); - - union { - file_extent fDirect[CACHED_FILE_EXTENTS]; - file_extent_array fIndirect; - }; - fssh_mutex fLock; - fssh_size_t fCount; - void* fVnode; - fssh_off_t fSize; - bool fCacheAll; -}; - - -FileMap::FileMap(void* vnode, fssh_off_t size) - : - fCount(0), - fVnode(vnode), - fSize(size), - fCacheAll(false) -{ - fssh_mutex_init(&fLock, "file map"); -} - - -FileMap::~FileMap() -{ - _Free(); - fssh_mutex_destroy(&fLock); -} - - -file_extent* -FileMap::ExtentAt(uint32_t index) -{ - if (index >= fCount) - return NULL; - - if (fCount > CACHED_FILE_EXTENTS) - return &fIndirect.array[index]; - - return &fDirect[index]; -} - - -file_extent* -FileMap::_FindExtent(fssh_off_t offset, uint32_t *_index) -{ - int32_t left = 0; - int32_t right = fCount - 1; - - while (left <= right) { - int32_t index = (left + right) / 2; - file_extent* extent = ExtentAt(index); - - if (extent->offset > offset) { - // search in left part - right = index - 1; - } else if (extent->offset + extent->disk.length <= offset) { - // search in right part - left = index + 1; - } else { - // found extent - if (_index) - *_index = index; - - return extent; - } - } - - return NULL; -} - - -fssh_status_t -FileMap::_MakeSpace(fssh_size_t count) -{ - if (count <= CACHED_FILE_EXTENTS) { - // just use the reserved area in the file_cache_ref structure - if (fCount > CACHED_FILE_EXTENTS) { - // the new size is smaller than the minimal array size - file_extent *array = fIndirect.array; - memcpy(fDirect, array, sizeof(file_extent) * count); - free(array); - } - } else { - // resize array if needed - file_extent* oldArray = NULL; - fssh_size_t maxCount = CACHED_FILE_EXTENTS; - if (fCount > CACHED_FILE_EXTENTS) { - oldArray = fIndirect.array; - maxCount = fIndirect.max_count; - } - - if (count > maxCount) { - // allocate new array - while (maxCount < count) { - if (maxCount < 32768) - maxCount <<= 1; - else - maxCount += 32768; - } - - file_extent* newArray = (file_extent *)realloc(oldArray, - maxCount * sizeof(file_extent)); - if (newArray == NULL) - return FSSH_B_NO_MEMORY; - - if (fCount > 0 && fCount <= CACHED_FILE_EXTENTS) - memcpy(newArray, fDirect, sizeof(file_extent) * fCount); - - fIndirect.array = newArray; - fIndirect.max_count = maxCount; - } - } - - fCount = count; - return FSSH_B_OK; -} - - -fssh_status_t -FileMap::_Add(fssh_file_io_vec* vecs, fssh_size_t vecCount, - fssh_off_t& lastOffset) -{ - TRACE(("FileMap@%p::Add(vecCount = %ld)\n", this, vecCount)); - - uint32_t start = fCount; - fssh_off_t offset = 0; - - fssh_status_t status = _MakeSpace(fCount + vecCount); - if (status != FSSH_B_OK) - return status; - - file_extent* lastExtent = NULL; - if (start != 0) { - lastExtent = ExtentAt(start - 1); - offset = lastExtent->offset + lastExtent->disk.length; - } - - for (uint32_t i = 0; i < vecCount; i++) { - if (lastExtent != NULL) { - if (lastExtent->disk.offset + lastExtent->disk.length - == vecs[i].offset) { - lastExtent->disk.length += vecs[i].length; - offset += vecs[i].length; - start--; - _MakeSpace(fCount - 1); - continue; - } - } - - file_extent* extent = ExtentAt(start + i); - extent->offset = offset; - extent->disk = vecs[i]; - - offset += extent->disk.length; - lastExtent = extent; - } - -#ifdef TRACE_FILE_MAP - for (uint32 i = 0; i < fCount; i++) { - file_extent* extent = ExtentAt(i); - dprintf("[%ld] extent offset %Ld, disk offset %Ld, length %Ld\n", - i, extent->offset, extent->disk.offset, extent->disk.length); - } -#endif - - lastOffset = offset; - return FSSH_B_OK; -} - - -void -FileMap::_InvalidateAfter(fssh_off_t offset) -{ - uint32_t index; - file_extent* extent = _FindExtent(offset, &index); - if (extent != NULL) { - _MakeSpace(index + 1); - - if (extent->offset + extent->disk.length > offset) { - extent->disk.length = offset - extent->offset; - if (extent->disk.length == 0) - _MakeSpace(index); - } - } -} - - -/*! Invalidates or removes the specified part of the file map. -*/ -void -FileMap::Invalidate(fssh_off_t offset, fssh_off_t size) -{ - MutexLocker _(fLock); - - // TODO: honour size, we currently always remove everything after "offset" - if (offset == 0) { - _Free(); - return; - } - - _InvalidateAfter(offset); -} - - -void -FileMap::SetSize(fssh_off_t size) -{ - MutexLocker _(fLock); - - if (size < fSize) - _InvalidateAfter(size); - - fSize = size; -} - - -void -FileMap::_Free() -{ - if (fCount > CACHED_FILE_EXTENTS) - free(fIndirect.array); - - fCount = 0; -} - - -fssh_status_t -FileMap::_Cache(fssh_off_t offset, fssh_off_t size) -{ - file_extent* lastExtent = NULL; - if (fCount > 0) - lastExtent = ExtentAt(fCount - 1); - - fssh_off_t mapEnd = 0; - if (lastExtent != NULL) - mapEnd = lastExtent->offset + lastExtent->disk.length; - - fssh_off_t end = offset + size; - - if (fCacheAll && mapEnd < end) - return FSSH_B_ERROR; - - fssh_status_t status = FSSH_B_OK; - fssh_file_io_vec vecs[8]; - const fssh_size_t kMaxVecs = 8; - - while (status == FSSH_B_OK && mapEnd < end) { - // We don't have the requested extents yet, retrieve them - fssh_size_t vecCount = kMaxVecs; - status = vfs_get_file_map(Vnode(), mapEnd, FSSH_SIZE_MAX, vecs, - &vecCount); - if (status == FSSH_B_OK || status == FSSH_B_BUFFER_OVERFLOW) - status = _Add(vecs, vecCount, mapEnd); - } - - return status; -} - - -fssh_status_t -FileMap::SetMode(uint32_t mode) -{ - if (mode != FSSH_FILE_MAP_CACHE_ALL - && mode != FSSH_FILE_MAP_CACHE_ON_DEMAND) - return FSSH_B_BAD_VALUE; - - MutexLocker _(fLock); - - if ((mode == FSSH_FILE_MAP_CACHE_ALL && fCacheAll) - || (mode == FSSH_FILE_MAP_CACHE_ON_DEMAND && !fCacheAll)) - return FSSH_B_OK; - - if (mode == FSSH_FILE_MAP_CACHE_ALL) { - fssh_status_t status = _Cache(0, fSize); - if (status != FSSH_B_OK) - return status; - - fCacheAll = true; - } else - fCacheAll = false; - - return FSSH_B_OK; -} - - -fssh_status_t -FileMap::Translate(fssh_off_t offset, fssh_size_t size, fssh_file_io_vec* vecs, - fssh_size_t* _count, fssh_size_t align) -{ - MutexLocker _(fLock); - - fssh_size_t maxVecs = *_count; - fssh_size_t padLastVec = 0; - - if ((uint64_t)offset >= (uint64_t)Size()) { - *_count = 0; - return FSSH_B_OK; - } - if ((uint64_t)offset + size > (uint64_t)fSize) { - if (align > 1) { - fssh_off_t alignedSize = (fSize + align - 1) & ~(fssh_off_t)(align - 1); - if ((uint64_t)offset + size >= (uint64_t)alignedSize) - padLastVec = alignedSize - fSize; - } - size = fSize - offset; - } - - // First, we need to make sure that we have already cached all file - // extents needed for this request. - - fssh_status_t status = _Cache(offset, size); - if (status != FSSH_B_OK) - return status; - - // We now have cached the map of this file as far as we need it, now - // we need to translate it for the requested access. - - uint32_t index; - file_extent* fileExtent = _FindExtent(offset, &index); - - offset -= fileExtent->offset; - vecs[0].offset = fileExtent->disk.offset + offset; - vecs[0].length = fileExtent->disk.length - offset; - - if ((uint64_t)vecs[0].length >= (uint64_t)size) { - vecs[0].length = size + padLastVec; - *_count = 1; - return FSSH_B_OK; - } - - // copy the rest of the vecs - - size -= vecs[0].length; - uint32_t vecIndex = 1; - - while (true) { - fileExtent++; - - vecs[vecIndex++] = fileExtent->disk; - - if ((uint64_t)size <= (uint64_t)fileExtent->disk.length) { - vecs[vecIndex - 1].length = size + padLastVec; - break; - } - - if (vecIndex >= maxVecs) { - *_count = vecIndex; - return FSSH_B_BUFFER_OVERFLOW; - } - - size -= fileExtent->disk.length; - } - - *_count = vecIndex; - return FSSH_B_OK; -} - - -} // namespace FSShell - - -// #pragma mark - public FS API - - -extern "C" void* -fssh_file_map_create(fssh_mount_id mountID, fssh_vnode_id vnodeID, - fssh_off_t size) -{ - TRACE(("file_map_create(mountID = %ld, vnodeID = %Ld, size = %Ld)\n", - mountID, vnodeID, size)); - - // Get the vnode for the object - // (note, this does not grab a reference to the node) - void* vnode; - if (vfs_lookup_vnode(mountID, vnodeID, &vnode) != FSSH_B_OK) - return NULL; - - return new(std::nothrow) FileMap(vnode, size); -} - - -extern "C" void -fssh_file_map_delete(void* _map) -{ - FileMap* map = (FileMap*)_map; - if (map == NULL) - return; - - TRACE(("file_map_delete(map = %p)\n", map)); - delete map; -} - - -extern "C" void -fssh_file_map_set_size(void* _map, fssh_off_t size) -{ - FileMap* map = (FileMap*)_map; - if (map == NULL) - return; - - map->SetSize(size); -} - - -extern "C" void -fssh_file_map_invalidate(void* _map, fssh_off_t offset, fssh_off_t size) -{ - FileMap* map = (FileMap*)_map; - if (map == NULL) - return; - - map->Invalidate(offset, size); -} - - -extern "C" fssh_status_t -fssh_file_map_set_mode(void* _map, uint32_t mode) -{ - FileMap* map = (FileMap*)_map; - if (map == NULL) - return FSSH_B_BAD_VALUE; - - return map->SetMode(mode); -} - - -extern "C" fssh_status_t -fssh_file_map_translate(void* _map, fssh_off_t offset, fssh_size_t size, - fssh_file_io_vec* vecs, fssh_size_t* _count, fssh_size_t align) -{ - TRACE(("file_map_translate(map %p, offset %Ld, size %ld)\n", - _map, offset, size)); - - FileMap* map = (FileMap*)_map; - if (map == NULL) - return FSSH_B_BAD_VALUE; - - return map->Translate(offset, size, vecs, _count, align); -} - diff --git a/src/tools/fs_shell/vfs.cpp b/src/tools/fs_shell/vfs.cpp index 23e05724c0..fb3fd80786 100644 --- a/src/tools/fs_shell/vfs.cpp +++ b/src/tools/fs_shell/vfs.cpp @@ -2384,7 +2384,8 @@ vfs_fs_vnode_to_node_ref(void *_vnode, fssh_mount_id *_mountID, */ fssh_status_t -vfs_lookup_vnode(fssh_mount_id mountID, fssh_vnode_id vnodeID, void **_vnode) +vfs_lookup_vnode(fssh_mount_id mountID, fssh_vnode_id vnodeID, + struct vnode **_vnode) { fssh_mutex_lock(&sVnodeMutex); struct vnode *vnode = lookup_vnode(mountID, vnodeID); diff --git a/src/tools/fs_shell/vfs.h b/src/tools/fs_shell/vfs.h index a6edaa6d87..b768d4f88a 100644 --- a/src/tools/fs_shell/vfs.h +++ b/src/tools/fs_shell/vfs.h @@ -45,6 +45,8 @@ struct fd_info { fssh_ino_t node; }; +struct vnode; + /* macro to allocate a iovec array on the stack */ #define IOVECS(name, size) \ uint8_t _##name[sizeof(fssh_iovecs) + (size)*sizeof(fssh_iovec)]; \ @@ -69,7 +71,7 @@ void vfs_vnode_to_node_ref(void *_vnode, fssh_mount_id *_mountID, fssh_vnode_id *_vnodeID); fssh_status_t vfs_lookup_vnode(fssh_mount_id mountID, fssh_vnode_id vnodeID, - void **_vnode); + struct vnode **_vnode); void vfs_put_vnode(void *vnode); void vfs_acquire_vnode(void *vnode); fssh_status_t vfs_get_cookie_from_fd(int fd, void **_cookie); From b866f1fa5493c354c9425b17e6563aac540406ab Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Tue, 24 Jul 2012 14:52:18 -0400 Subject: [PATCH 36/65] Tracker: Files created from templates are now monitored fixes #2796. --- src/kits/tracker/PoseView.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 0e7304bf52..cef804fb78 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -3227,6 +3227,7 @@ BPoseView::NewFileFromTemplate(const BMessage *message) if (destDir.InitCheck() != B_OK) return; + // TODO: Localise this char fileName[B_FILE_NAME_LENGTH] = "New "; strlcat(fileName, message->FindString("name"), sizeof(fileName)); FSMakeOriginalName(fileName, &destDir, " copy"); @@ -3280,6 +3281,7 @@ BPoseView::NewFileFromTemplate(const BMessage *message) destEntryRef.name, &index); if (pose) { + WatchNewNode(pose->TargetModel()->NodeRef()); UpdateScrollRange(); CommitActivePose(); SelectPose(pose, index); From aacf2782d8022d7178125948daac67533ef3e473 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 25 Jul 2012 00:11:14 +0200 Subject: [PATCH 37/65] Debugger: Switch from readline to libedit --- src/apps/debugger/Jamfile | 8 ++- .../cli/CommandLineUserInterface.cpp | 52 ++++++++++++++++--- .../cli/CommandLineUserInterface.h | 6 +++ 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 62aa4c3386..335827b106 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -3,12 +3,10 @@ SubDir HAIKU_TOP src apps debugger ; CCFLAGS += -Werror ; C++FLAGS += -Werror ; +UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ; UsePrivateHeaders app debug interface kernel shared libroot ; UsePrivateSystemHeaders ; -# Use gdb's readline. It would be better to use an optional build feature. -UseHeaders [ FDirName $(HAIKU_TOP) src bin gdb ] : true ; - SEARCH_SOURCE += [ FDirName $(SUBDIR) arch ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) arch x86 ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) debug_info ] ; @@ -286,11 +284,11 @@ Application Debugger : libshared.a libexpression_parser.a libmapm.a - libreadline.a + libedit.a libtermcap.a $(TARGET_LIBSTDC++) - be tracker libdebug.so + be tracker libbsd.so libdebug.so : Debugger.rdef ; diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index e45995f1d9..a381d676a9 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -11,9 +11,6 @@ #include -#include -#include - #include #include #include @@ -23,6 +20,13 @@ #include "CliThreadsCommand.h" +static const char* +get_prompt(EditLine* editLine) +{ + return "debugger> "; +} + + // #pragma mark - CommandEntry @@ -79,6 +83,8 @@ private: CommandLineUserInterface::CommandLineUserInterface() : fCommands(20, true), + fEditLine(NULL), + fHistory(NULL), fShowSemaphore(-1), fShown(false), fTerminating(false) @@ -90,6 +96,12 @@ CommandLineUserInterface::~CommandLineUserInterface() { if (fShowSemaphore >= 0) delete_sem(fShowSemaphore); + + if (fEditLine != NULL) + el_end(fEditLine); + + if (fHistory != NULL) + history_end(fHistory); } @@ -113,6 +125,21 @@ CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener) if (fShowSemaphore < 0) return fShowSemaphore; + fEditLine = el_init("Debugger", stdin, stdout, stderr); + if (fEditLine == NULL) + return B_ERROR; + + fHistory = history_init(); + if (fHistory == NULL) + return B_ERROR; + + HistEvent historyEvent; + history(fHistory, &historyEvent, H_SETSIZE, 100); + + el_set(fEditLine, EL_HIST, &history, fHistory); + el_set(fEditLine, EL_EDITOR, "emacs"); + el_set(fEditLine, EL_PROMPT, &get_prompt); + return B_OK; } @@ -141,6 +168,16 @@ CommandLineUserInterface::Terminate() delete_sem(fShowSemaphore); fShowSemaphore = -1; } + + if (fEditLine != NULL) { + el_end(fEditLine); + fEditLine = NULL; + } + + if (fHistory != NULL) { + history_end(fHistory); + fHistory = NULL; + } } @@ -205,10 +242,10 @@ CommandLineUserInterface::_InputLoop() { while (!fTerminating) { // read a command line - char* line = readline("debugger> "); + int count; + const char* line = el_gets(fEditLine, &count); if (line == NULL) break; - MemoryDeleter lineDeleter(line); // parse the command line ArgumentVector args; @@ -231,8 +268,11 @@ CommandLineUserInterface::_InputLoop() if (args.ArgumentCount() == 0) continue; - add_history(line); + // add line to history + HistEvent historyEvent; + history(fHistory, &historyEvent, H_ENTER, line); + // execute command _ExecuteCommand(args.ArgumentCount(), args.Arguments()); } diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h index f6a1c8b2c9..fb5da34da9 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h @@ -7,6 +7,10 @@ #define COMMAND_LINE_USER_INTERFACE_H +#include + // Needed in histedit.h. +#include + #include #include @@ -69,6 +73,8 @@ private: private: CliContext fContext; CommandList fCommands; + EditLine* fEditLine; + History* fHistory; sem_id fShowSemaphore; bool fShown; bool fTerminating; From e2c343a22a731d4ec7f6ede64adb36dbf275021e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Mod=C3=A9en?= Date: Wed, 25 Jul 2012 00:48:24 +0000 Subject: [PATCH 38/65] Fixing #6913. * Checking and setting a default value if both icon and text are false. --- src/apps/powerstatus/PowerStatusView.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index f0362e8b3b..647dae5399 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2012, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -419,6 +419,10 @@ PowerStatusView::FromMessage(const BMessage* archive) fShowStatusIcon = value; if (archive->FindBool("show time", &value) == B_OK) fShowTime = value; + + //Incase we have a bad saving and none are showed.. + if (!fShowLabel && !fShowStatusIcon) + fShowLabel = true; int32 intValue; if (archive->FindInt32("battery id", &intValue) == B_OK) @@ -539,7 +543,11 @@ PowerStatusReplicant::MessageReceived(BMessage *message) { switch (message->what) { case kMsgToggleLabel: - fShowLabel = !fShowLabel; + if (fShowStatusIcon) + fShowLabel = !fShowLabel; + else + fShowLabel = true; + Update(true); break; @@ -549,7 +557,11 @@ PowerStatusReplicant::MessageReceived(BMessage *message) break; case kMsgToggleStatusIcon: - fShowStatusIcon = !fShowStatusIcon; + if (fShowLabel) + fShowStatusIcon = !fShowStatusIcon; + else + fShowStatusIcon = true; + Update(true); break; From 003dedca933ed3bd3afc8f9bc7f27dba679a61f3 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 24 Jul 2012 19:09:53 -0400 Subject: [PATCH 39/65] Fix #8768. - When invoking ProcessController's menu, we now only show the "Live in Deskbar" menu item if we're either running within Deskbar itself or from PC's standalone window. This allows replicant PC instances to be usable in the case where Deskbar is deadlocked for whatever reason (previously it would hang while trying to query for the deskbar item's presence/status). --- .../processcontroller/ProcessController.cpp | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index 1a5d5d20cc..48f77976a2 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -772,16 +772,31 @@ thread_popup(void *arg) addtopbottom(new BSeparatorItem()); - if (be_roster->IsRunning(kDeskbarSig)) { - item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"), - new BMessage('AlDb')); - BDeskbar deskbar; - item->SetMarked(gInDeskbar || deskbar.HasItem(kDeskbarItemName)); - item->SetTarget(gPCView); - addtopbottom(item); - addtopbottom(new BSeparatorItem ()); + int32 cookie = 0; + image_info info; + while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + if (info.type == B_APP_IMAGE) { + // only show the Live in Deskbar item if a) we're running in + // deskbar itself, or b) we're running in PC's team. + if (strstr(info.name, "Deskbar") == NULL + && strstr(info.name, "ProcessController") == NULL) { + break; + } + + if (be_roster->IsRunning(kDeskbarSig)) { + item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"), + new BMessage('AlDb')); + BDeskbar deskbar; + item->SetMarked(gInDeskbar + || deskbar.HasItem(kDeskbarItemName)); + item->SetTarget(gPCView); + addtopbottom(item); + addtopbottom(new BSeparatorItem ()); + } + } } + item = new IconMenuItem(gPCView->fProcessControllerIcon, B_TRANSLATE("About ProcessController"B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED)); From 542ee077064750901552bf0edcdb19ce8152e699 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 24 Jul 2012 19:23:39 -0400 Subject: [PATCH 40/65] Slight cleanup of previous commit. --- .../processcontroller/ProcessController.cpp | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index 48f77976a2..168a4ef78b 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -772,30 +772,32 @@ thread_popup(void *arg) addtopbottom(new BSeparatorItem()); - int32 cookie = 0; - image_info info; - while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { - if (info.type == B_APP_IMAGE) { - // only show the Live in Deskbar item if a) we're running in - // deskbar itself, or b) we're running in PC's team. - if (strstr(info.name, "Deskbar") == NULL - && strstr(info.name, "ProcessController") == NULL) { - break; - } - - if (be_roster->IsRunning(kDeskbarSig)) { - item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"), - new BMessage('AlDb')); - BDeskbar deskbar; - item->SetMarked(gInDeskbar - || deskbar.HasItem(kDeskbarItemName)); - item->SetTarget(gPCView); - addtopbottom(item); - addtopbottom(new BSeparatorItem ()); + bool showLiveInDeskbarItem = gInDeskbar; + if (!showLiveInDeskbarItem) { + int32 cookie = 0; + image_info info; + while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + if (info.type == B_APP_IMAGE) { + // only show the Live in Deskbar item if a) we're running in + // deskbar itself, or b) we're running in PC's team. + if (strstr(info.name, "ProcessController") != NULL) { + showLiveInDeskbarItem = true; + break; + } } } } + if (showLiveInDeskbarItem && be_roster->IsRunning(kDeskbarSig)) { + item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"), + new BMessage('AlDb')); + BDeskbar deskbar; + item->SetMarked(gInDeskbar || deskbar.HasItem(kDeskbarItemName)); + item->SetTarget(gPCView); + addtopbottom(item); + addtopbottom(new BSeparatorItem ()); + } + item = new IconMenuItem(gPCView->fProcessControllerIcon, B_TRANSLATE("About ProcessController"B_UTF8_ELLIPSIS), From f081f8b731d7d7ca46c939ff07227fb46a279de1 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 25 Jul 2012 08:26:07 -0500 Subject: [PATCH 41/65] efi: Add more GPT partition GUID's * Create a new Haiku GPT GUID (BeOS type not defined atm) * Haiku BFS UUID by Andre Braga circa 2009 ML post "Defining the Haiku UUID for GPT and other uses" * I'm putting this GUID on wikipedia and pushing to the linux gpt partition tools... should be a good way to kickstart it in the ecosystem --- .../kernel/partitioning_systems/efi/efi_gpt.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp b/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp index a80bcd7e62..e268c23da6 100644 --- a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp +++ b/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp @@ -49,7 +49,19 @@ const static struct type_map { static_guid guid; const char *type; } kTypeMap[] = { - {{0x48465300, 0x0000, 0x11aa, 0xaa1100306543ECACLL}, "HFS+ File System"} + {{0xC12A7328, 0xF81F, 0x11D2, 0xBA4B00A0C93EC93BLL}, "EFI System Data"}, + {{0x21686148, 0x6449, 0x6E6F, 0x744E656564454649LL}, "BIOS Boot Data"}, + {{0x024DEE41, 0x33E7, 0x11D3, 0x9D690008C781F39FLL}, "MBR Partition Nest"}, + {{0x42465331, 0xbb23, 0x1601, 0x802A4861696B7521LL}, "Haiku BFS"}, + {{0x0FC63DAF, 0x8483, 0x4772, 0x8E793D69D8477DE4LL}, "Linux File System"}, + {{0xA19D880F, 0x05FC, 0x4D3B, 0xA006743F0F84911ELL}, "Linux RAID"}, + {{0x0657FD6D, 0xA4AB, 0x43C4, 0x84E50933C84B4F4FLL}, "Linux Swap"}, + {{0xE6D6D379, 0xF507, 0x44C2, 0xA23C238F2A3DF928LL}, "Linux LVM"}, + {{0xEBD0A0A2, 0xB9E5, 0x4433, 0x87C068B6B72699C7LL}, "Windows Data"}, + {{0x48465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "HFS+ File System"}, + {{0x55465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "UFS File System"}, + {{0x52414944, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID"}, + {{0x52414944, 0x5F4F, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID, offline"} }; From a736c8aa6bdaaba029f8f651f6018422697478e9 Mon Sep 17 00:00:00 2001 From: Humdinger Date: Wed, 25 Jul 2012 18:48:24 +0200 Subject: [PATCH 42/65] Patch by x-ist, thanks! Fixes non-terminating ReplaceAll, #8141. --- src/apps/stylededit/StyledEditWindow.cpp | 23 ++++++++++++++++++----- src/apps/stylededit/StyledEditWindow.h | 3 ++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 3ac854199f..37fa6ac150 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -1408,7 +1408,7 @@ StyledEditWindow::_RevertToSaved() bool StyledEditWindow::_Search(BString string, bool caseSensitive, bool wrap, - bool backSearch) + bool backSearch, bool scrollToOccurence) { int32 start; int32 finish; @@ -1450,7 +1450,9 @@ StyledEditWindow::_Search(BString string, bool caseSensitive, bool wrap, if (start != B_ERROR) { finish = start + length; fTextView->Select(start, finish); - fTextView->ScrollToSelection(); + + if (scrollToOccurence) + fTextView->ScrollToSelection(); return true; } @@ -1501,17 +1503,28 @@ StyledEditWindow::_ReplaceAll(BString findThis, BString replaceWith, { bool first = true; fTextView->SetSuppressChanges(true); - while (_Search(findThis, caseSensitive, true, false)) { + + // start from the beginning of text + fTextView->Select(0,0); + + int32 start, finish; + + // iterate occurences of findThis without wrapping around + while (_Search(findThis, caseSensitive, false, false, false)) { if (first) { _UpdateCleanUndoRedoSaveRevert(); first = false; } - int32 start, finish; + fTextView->GetSelection(&start, &finish); - fTextView->Delete(start, start + findThis.Length()); fTextView->Insert(start, replaceWith.String(), replaceWith.Length()); + + // advance the caret behind the inserted text + start += replaceWith.Length(); + fTextView->Select(start, start); } + fTextView->ScrollToSelection(); fTextView->SetSuppressChanges(false); } diff --git a/src/apps/stylededit/StyledEditWindow.h b/src/apps/stylededit/StyledEditWindow.h index 241de3044a..d107917b1b 100644 --- a/src/apps/stylededit/StyledEditWindow.h +++ b/src/apps/stylededit/StyledEditWindow.h @@ -57,7 +57,8 @@ private: status_t _LoadFile(entry_ref* ref); void _RevertToSaved(); bool _Search(BString searchFor, bool caseSensitive, - bool wrap, bool backSearch); + bool wrap, bool backSearch, + bool scrollToOccurence = true); void _FindSelection(); bool _Replace(BString findThis, BString replaceWith, bool caseSensitive, bool wrap, From 48249b20646d5a6a58b084eee73827953df407ca Mon Sep 17 00:00:00 2001 From: Humdinger Date: Wed, 25 Jul 2012 19:16:11 +0200 Subject: [PATCH 43/65] Stylefixes, no functional change. --- src/apps/stylededit/ColorMenuItem.cpp | 5 +++-- src/apps/stylededit/ColorMenuItem.h | 4 ++-- src/apps/stylededit/Constants.h | 8 ++++---- src/apps/stylededit/FindWindow.h | 5 +++-- src/apps/stylededit/ReplaceWindow.cpp | 2 +- src/apps/stylededit/ReplaceWindow.h | 6 +++--- src/apps/stylededit/StyledEditApp.cpp | 6 +++--- src/apps/stylededit/StyledEditView.cpp | 9 +++++---- src/apps/stylededit/StyledEditView.h | 6 +++--- src/apps/stylededit/StyledEditWindow.cpp | 13 +++++++------ src/apps/stylededit/StyledEditWindow.h | 10 +++++----- 11 files changed, 39 insertions(+), 35 deletions(-) diff --git a/src/apps/stylededit/ColorMenuItem.cpp b/src/apps/stylededit/ColorMenuItem.cpp index 923bdcd816..863a2afcd5 100644 --- a/src/apps/stylededit/ColorMenuItem.cpp +++ b/src/apps/stylededit/ColorMenuItem.cpp @@ -11,7 +11,8 @@ #include -ColorMenuItem::ColorMenuItem(const char *label, rgb_color color, BMessage *message) +ColorMenuItem::ColorMenuItem(const char *label, rgb_color color, + BMessage *message) : BMenuItem(label, message, 0, 0), fItemColor(color) { @@ -21,7 +22,7 @@ ColorMenuItem::ColorMenuItem(const char *label, rgb_color color, BMessage *messa void ColorMenuItem::DrawContent() { - BMenu *menu = Menu(); + BMenu* menu = Menu(); if (menu) { rgb_color menuColor = menu->HighColor(); diff --git a/src/apps/stylededit/ColorMenuItem.h b/src/apps/stylededit/ColorMenuItem.h index 257d91cb78..45b4715cd6 100644 --- a/src/apps/stylededit/ColorMenuItem.h +++ b/src/apps/stylededit/ColorMenuItem.h @@ -18,8 +18,8 @@ class BMessage; class ColorMenuItem: public BMenuItem { public: - ColorMenuItem(const char *label, rgb_color color, - BMessage *message); + ColorMenuItem(const char* label, rgb_color color, + BMessage* message); protected: virtual void DrawContent(); diff --git a/src/apps/stylededit/Constants.h b/src/apps/stylededit/Constants.h index cbd4776a0d..7863a1a60f 100644 --- a/src/apps/stylededit/Constants.h +++ b/src/apps/stylededit/Constants.h @@ -54,10 +54,10 @@ const uint32 kMsgSetBold = 'Fbld'; // fontcolors const rgb_color BLACK = {0, 0, 0, 255}; const rgb_color RED = {255, 0, 0, 255}; -const rgb_color GREEN = {0, 255, 0, 255}; -const rgb_color BLUE = {0, 0, 255, 255}; -const rgb_color CYAN = {0, 255, 255, 255}; -const rgb_color MAGENTA = {255, 0, 255, 255}; +const rgb_color GREEN = {0, 255, 0, 255}; +const rgb_color BLUE = {0, 0, 255, 255}; +const rgb_color CYAN = {0, 255, 255, 255}; +const rgb_color MAGENTA = {255, 0, 255, 255}; const rgb_color YELLOW = {255, 255, 0, 255}; // "Document"-menu diff --git a/src/apps/stylededit/FindWindow.h b/src/apps/stylededit/FindWindow.h index f63dc879af..e8720c8434 100644 --- a/src/apps/stylededit/FindWindow.h +++ b/src/apps/stylededit/FindWindow.h @@ -20,8 +20,9 @@ class BTextControl; class FindWindow : public BWindow { public: - FindWindow(BRect frame, BHandler* handler, BString *searchString, - bool caseState, bool wrapState, bool backState); + FindWindow(BRect frame, BHandler* handler, + BString* searchString, bool caseState, + bool wrapState, bool backState); virtual void MessageReceived(BMessage* message); virtual void DispatchMessage(BMessage* message, BHandler* handler); diff --git a/src/apps/stylededit/ReplaceWindow.cpp b/src/apps/stylededit/ReplaceWindow.cpp index b35e28f046..9b63c5be4c 100644 --- a/src/apps/stylededit/ReplaceWindow.cpp +++ b/src/apps/stylededit/ReplaceWindow.cpp @@ -29,7 +29,7 @@ #define B_TRANSLATION_CONTEXT "FindandReplaceWindow" ReplaceWindow::ReplaceWindow(BRect frame, BHandler* _handler, - BString* searchString, BString *replaceString, + BString* searchString, BString* replaceString, bool caseState, bool wrapState, bool backState) : BWindow(frame, "ReplaceWindow", B_MODAL_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS, diff --git a/src/apps/stylededit/ReplaceWindow.h b/src/apps/stylededit/ReplaceWindow.h index bb51f057c6..ddcff4c23c 100644 --- a/src/apps/stylededit/ReplaceWindow.h +++ b/src/apps/stylededit/ReplaceWindow.h @@ -23,12 +23,12 @@ class BTextControl; class ReplaceWindow : public BWindow { public: - ReplaceWindow(BRect frame, BHandler *_handler, - BString *searchString, BString *replaceString, + ReplaceWindow(BRect frame, BHandler* _handler, + BString* searchString, BString* replaceString, bool caseState, bool wrapState, bool backState); virtual void MessageReceived(BMessage* message); - virtual void DispatchMessage(BMessage* message, BHandler *handler); + virtual void DispatchMessage(BMessage* message, BHandler* handler); private: void _SendMessage(uint32 what); diff --git a/src/apps/stylededit/StyledEditApp.cpp b/src/apps/stylededit/StyledEditApp.cpp index ff66954e17..49294e9927 100644 --- a/src/apps/stylededit/StyledEditApp.cpp +++ b/src/apps/stylededit/StyledEditApp.cpp @@ -32,7 +32,7 @@ using namespace BPrivate; -BRect gWindowRect(7-15, 26-15, 507, 426); +BRect gWindowRect(7 - 15, 26 - 15, 507, 426); namespace @@ -117,8 +117,8 @@ StyledEditApp::StyledEditApp() name.Append(mime); name.Append(")"); } - BMenuItem* item = - new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING)); + BMenuItem* item + = new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING)); item->SetTarget(this); fOpenPanelEncodingMenu->AddItem(item); if (charset.GetFontID() == fOpenAsEncoding) diff --git a/src/apps/stylededit/StyledEditView.cpp b/src/apps/stylededit/StyledEditView.cpp index 66b871db5f..10258247e6 100644 --- a/src/apps/stylededit/StyledEditView.cpp +++ b/src/apps/stylededit/StyledEditView.cpp @@ -30,7 +30,8 @@ using namespace BPrivate; -StyledEditView::StyledEditView(BRect viewFrame, BRect textBounds, BHandler *handler) +StyledEditView::StyledEditView(BRect viewFrame, BRect textBounds, + BHandler* handler) : BTextView(viewFrame, "textview", textBounds, B_FOLLOW_ALL, B_FRAME_EVENTS | B_WILL_DRAW) { @@ -162,7 +163,7 @@ StyledEditView::GetEncoding() const const BCharacterSet* set = BCharacterSetRoster::FindCharacterSetByName(fEncoding.String()); - if(set != NULL) + if (set != NULL) return set->GetFontID(); return 0; @@ -181,8 +182,8 @@ StyledEditView::DeleteText(int32 start, int32 finish) void -StyledEditView::InsertText(const char *text, int32 length, int32 offset, - const text_run_array *runs) +StyledEditView::InsertText(const char* text, int32 length, int32 offset, + const text_run_array* runs) { if (!fSuppressChanges) fMessenger->SendMessage(TEXT_CHANGED); diff --git a/src/apps/stylededit/StyledEditView.h b/src/apps/stylededit/StyledEditView.h index 945f34dda3..b0482fb13e 100644 --- a/src/apps/stylededit/StyledEditView.h +++ b/src/apps/stylededit/StyledEditView.h @@ -23,14 +23,14 @@ class BPositionIO; class StyledEditView : public BTextView { public: StyledEditView(BRect viewframe, BRect textframe, - BHandler *handler); + BHandler* handler); virtual ~StyledEditView(); virtual void Select(int32 start, int32 finish); virtual void DeleteText(int32 start, int32 finish); virtual void FrameResized(float width, float height); - virtual void InsertText(const char *text, int32 length, int32 offset, - const text_run_array *runs = NULL); + virtual void InsertText(const char* text, int32 length, int32 offset, + const text_run_array* runs = NULL); void Reset(); void SetSuppressChanges(bool suppressChanges); diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 37fa6ac150..61e7c1a6c9 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -862,7 +862,8 @@ StyledEditWindow::Print(const char* documentName) int32 currentLine = 0; while (currentLine < linesInDocument) { float currentHeight = 0; - while (currentHeight < printableRect.Height() && currentLine < linesInDocument) { + while (currentHeight < printableRect.Height() && currentLine + < linesInDocument) { currentHeight += fTextView->LineHeight(currentLine); if (currentHeight < printableRect.Height()) currentLine++; @@ -1027,8 +1028,8 @@ StyledEditWindow::_InitWindow(uint32 encoding) new BMessage(MENU_NEW), 'N')); menuItem->SetTarget(be_app); - menu->AddItem(menuItem = new BMenuItem(fRecentMenu = - new BMenu(B_TRANSLATE("Open" B_UTF8_ELLIPSIS)), + menu->AddItem(menuItem = new BMenuItem(fRecentMenu + = new BMenu(B_TRANSLATE("Open" B_UTF8_ELLIPSIS)), new BMessage(MENU_OPEN))); menuItem->SetShortcut('O', 0); menuItem->SetTarget(be_app); @@ -1042,8 +1043,8 @@ StyledEditWindow::_InitWindow(uint32 encoding) menuItem->SetShortcut('S', B_SHIFT_KEY); menuItem->SetEnabled(true); - menu->AddItem(fRevertItem = - new BMenuItem(B_TRANSLATE("Revert to saved" B_UTF8_ELLIPSIS), + menu->AddItem(fRevertItem + = new BMenuItem(B_TRANSLATE("Revert to saved" B_UTF8_ELLIPSIS), new BMessage(MENU_REVERT))); fRevertItem->SetEnabled(false); menu->AddItem(new BMenuItem(B_TRANSLATE("Close"), @@ -1505,7 +1506,7 @@ StyledEditWindow::_ReplaceAll(BString findThis, BString replaceWith, fTextView->SetSuppressChanges(true); // start from the beginning of text - fTextView->Select(0,0); + fTextView->Select(0, 0); int32 start, finish; diff --git a/src/apps/stylededit/StyledEditWindow.h b/src/apps/stylededit/StyledEditWindow.h index d107917b1b..19f0ad8bf8 100644 --- a/src/apps/stylededit/StyledEditWindow.h +++ b/src/apps/stylededit/StyledEditWindow.h @@ -118,17 +118,17 @@ private: BString fReplaceString; // undo modes - bool fUndoFlag; // we just did an undo action - bool fCanUndo; // we can do an undo action next - bool fRedoFlag; // we just did a redo action - bool fCanRedo; // we can do a redo action next + bool fUndoFlag; // we just did an undo action + bool fCanUndo; // we can do an undo action next + bool fRedoFlag; // we just did a redo action + bool fCanRedo; // we can do a redo action next // clean modes bool fUndoCleans; // an undo action will put us in a clean state bool fRedoCleans; // a redo action will put us in a clean state - bool fClean; // we are in a clean state + bool fClean; // we are in a clean state bool fCaseSensitive; bool fWrapAround; From bed0d7384bb16feb34e1e1d84fcd50039159d99c Mon Sep 17 00:00:00 2001 From: Humdinger Date: Wed, 25 Jul 2012 20:24:00 +0200 Subject: [PATCH 44/65] Pulling declarations back into loop, plus small style change. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pointed out by Jérô and John. Thanks, --- src/apps/stylededit/StyledEditWindow.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 61e7c1a6c9..0601b0bdec 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -1481,7 +1481,8 @@ StyledEditWindow::_Replace(BString findThis, BString replaceWith, bool caseSensitive, bool wrap, bool backSearch) { if (_Search(findThis, caseSensitive, wrap, backSearch)) { - int32 start, finish; + int32 start; + int32 finish; fTextView->GetSelection(&start, &finish); _UpdateCleanUndoRedoSaveRevert(); @@ -1507,8 +1508,6 @@ StyledEditWindow::_ReplaceAll(BString findThis, BString replaceWith, // start from the beginning of text fTextView->Select(0, 0); - - int32 start, finish; // iterate occurences of findThis without wrapping around while (_Search(findThis, caseSensitive, false, false, false)) { @@ -1516,7 +1515,9 @@ StyledEditWindow::_ReplaceAll(BString findThis, BString replaceWith, _UpdateCleanUndoRedoSaveRevert(); first = false; } - + int32 start; + int32 finish; + fTextView->GetSelection(&start, &finish); fTextView->Delete(start, start + findThis.Length()); fTextView->Insert(start, replaceWith.String(), replaceWith.Length()); From f441fd03b6a6b31341c3f1d58d30395d220bcf50 Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Wed, 25 Jul 2012 23:15:44 +0200 Subject: [PATCH 45/65] Working serial connection. Still need some work on displaying the right chars at the right place. --- src/apps/serialconnect/SerialApp.cpp | 29 +++++--- src/apps/serialconnect/SerialApp.h | 14 ++-- src/apps/serialconnect/SerialWindow.cpp | 35 ++++++++-- src/apps/serialconnect/SerialWindow.h | 7 ++ src/apps/serialconnect/TermView.cpp | 93 +++++++++++++++++++++---- src/apps/serialconnect/TermView.h | 7 ++ 6 files changed, 151 insertions(+), 34 deletions(-) diff --git a/src/apps/serialconnect/SerialApp.cpp b/src/apps/serialconnect/SerialApp.cpp index 7697168b75..2153571f9b 100644 --- a/src/apps/serialconnect/SerialApp.cpp +++ b/src/apps/serialconnect/SerialApp.cpp @@ -4,6 +4,8 @@ */ +#include + #include "SerialApp.h" #include "SerialWindow.h" @@ -15,7 +17,7 @@ SerialApp::SerialApp() { fWindow = new SerialWindow(); - serialLock = create_sem(0, "Serial port lock"); + fSerialLock = create_sem(0, "Serial port lock"); thread_id id = spawn_thread(PollSerial, "Serial port poller", B_LOW_PRIORITY, this); resume_thread(id); @@ -36,15 +38,25 @@ void SerialApp::MessageReceived(BMessage* message) { const char* portName; message->FindString("port name", &portName); - serialPort.Open(portName); - release_sem(serialLock); + fSerialPort.Open(portName); + release_sem(fSerialLock); break; } case kMsgDataRead: { - // TODO forward to the window + // forward the message to the window, which will display the + // incoming data + fWindow->PostMessage(message); break; } + case kMsgDataWrite: + { + const char* bytes; + ssize_t size; + + message->FindData("data", B_RAW_TYPE, &(const void*)bytes, &size); + fSerialPort.Write(bytes, size); + } default: BApplication::MessageReceived(message); } @@ -61,16 +73,15 @@ status_t SerialApp::PollSerial(void*) { ssize_t bytesRead; - bytesRead = application->serialPort.Read(buffer, 256); + bytesRead = application->fSerialPort.Read(buffer, 256); if (bytesRead == B_FILE_ERROR) { // Port is not open - wait for it and start over - acquire_sem(application->serialLock); - } else { + acquire_sem(application->fSerialLock); + } else if (bytesRead > 0) { // We read something, forward it to the app for handling BMessage* serialData = new BMessage(kMsgDataRead); - // TODO bytesRead is not nul terminated. Use generic data rather - serialData->AddString("data", buffer); + serialData->AddData("data", B_RAW_TYPE, buffer, bytesRead); be_app_messenger.SendMessage(serialData); } } diff --git a/src/apps/serialconnect/SerialApp.h b/src/apps/serialconnect/SerialApp.h index a210feb36c..a08069a33b 100644 --- a/src/apps/serialconnect/SerialApp.h +++ b/src/apps/serialconnect/SerialApp.h @@ -19,17 +19,19 @@ class SerialApp: public BApplication void MessageReceived(BMessage* message); private: - BSerialPort serialPort; - static status_t PollSerial(void*); - - sem_id serialLock; + BSerialPort fSerialPort; + sem_id fSerialLock; SerialWindow* fWindow; + static status_t PollSerial(void*); + static const char* kApplicationSignature; }; + enum messageConstants { - kMsgOpenPort = 'open', - kMsgDataRead = 'dare', + kMsgOpenPort = 'open', + kMsgDataRead = 'dare', + kMsgDataWrite = 'dawr', }; diff --git a/src/apps/serialconnect/SerialWindow.cpp b/src/apps/serialconnect/SerialWindow.cpp index bb30691b5e..b26f9f60a4 100644 --- a/src/apps/serialconnect/SerialWindow.cpp +++ b/src/apps/serialconnect/SerialWindow.cpp @@ -12,21 +12,22 @@ #include #include +#include "SerialApp.h" #include "TermView.h" SerialWindow::SerialWindow() : BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle, - B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE) + B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS) { SetLayout(new BGroupLayout(B_VERTICAL, 0.0f)); BMenuBar* menuBar = new BMenuBar("menuBar"); - TermView* termView = new TermView(); + fTermView = new TermView(); AddChild(menuBar); - AddChild(termView); + AddChild(fTermView); BMenu* connectionMenu = new BMenu("Connections"); BMenu* editMenu = new BMenu("Edit"); @@ -48,7 +49,9 @@ SerialWindow::SerialWindow() char buffer[256]; serialPort.GetDeviceName(i, buffer, 256); - BMenuItem* portItem = new BMenuItem(buffer, NULL); + BMessage* message = new BMessage(kMsgOpenPort); + message->AddString("port name", buffer); + BMenuItem* portItem = new BMenuItem(buffer, message); connect->AddItem(portItem); } @@ -115,4 +118,28 @@ SerialWindow::SerialWindow() } +void SerialWindow::MessageReceived(BMessage* message) +{ + switch(message->what) + { + case kMsgDataRead: + { + const char* bytes; + ssize_t length; + message->FindData("data", B_RAW_TYPE, &(const void*)bytes, &length); + fTermView->PushBytes(bytes, length); + break; + } + case kMsgOpenPort: + { + // Forward message to application + be_app->PostMessage(message); + break; + } + default: + BWindow::MessageReceived(message); + } +} + + const char* SerialWindow::kWindowTitle = "SerialConnect"; diff --git a/src/apps/serialconnect/SerialWindow.h b/src/apps/serialconnect/SerialWindow.h index c54129010b..d6fed4f9da 100644 --- a/src/apps/serialconnect/SerialWindow.h +++ b/src/apps/serialconnect/SerialWindow.h @@ -7,11 +7,18 @@ #include +class TermView; + + class SerialWindow: public BWindow { public: SerialWindow::SerialWindow(); + void MessageReceived(BMessage* message); + private: + TermView* fTermView; + static const char* kWindowTitle; }; diff --git a/src/apps/serialconnect/TermView.cpp b/src/apps/serialconnect/TermView.cpp index 7899bf0a5d..da04c90b68 100644 --- a/src/apps/serialconnect/TermView.cpp +++ b/src/apps/serialconnect/TermView.cpp @@ -10,12 +10,19 @@ #include +#include "SerialApp.h" + TermView::TermView() : BView("TermView", B_WILL_DRAW) { + font_height height; + GetFontHeight(&height); + fFontHeight = height.ascent + height.descent + height.leading; + fFontWidth = be_fixed_font->StringWidth("X"); fTerm = vterm_new(kDefaultWidth, kDefaultHeight); + vterm_parser_set_utf8(fTerm, 1); fTermScreen = vterm_obtain_screen(fTerm); @@ -23,14 +30,6 @@ TermView::TermView() vterm_screen_reset(fTermScreen, 1); SetFont(be_fixed_font); - - font_height height; - GetFontHeight(&height); - fFontHeight = height.ascent + height.descent + height.leading; - fFontWidth = be_fixed_font->StringWidth("X"); - - // TEST - //vterm_push_bytes(fTerm,"Hello World!",11); } @@ -40,6 +39,12 @@ TermView::~TermView() } +void TermView::AttachedToWindow() +{ + MakeFocus(); +} + + void TermView::Draw(BRect updateRect) { VTermRect updatedChars = PixelsToGlyphs(updateRect); @@ -66,6 +71,29 @@ void TermView::Draw(BRect updateRect) } +void TermView::GetPreferredSize(float* width, float* height) +{ + if (width != NULL) + *width = kDefaultWidth * fFontWidth; + if (height != NULL) + *height = kDefaultHeight * fFontHeight; +} + + +void TermView::KeyDown(const char* bytes, int32 numBytes) +{ + BMessage* keyEvent = new BMessage(kMsgDataWrite); + keyEvent->AddData("data", B_RAW_TYPE, bytes, numBytes); + be_app_messenger.SendMessage(keyEvent); +} + + +void TermView::PushBytes(const char* bytes, size_t length) +{ + vterm_push_bytes(fTerm, bytes, length); +} + + VTermRect TermView::PixelsToGlyphs(BRect pixels) const { pixels.OffsetBy(-kBorderSpacing, -kBorderSpacing); @@ -76,12 +104,17 @@ VTermRect TermView::PixelsToGlyphs(BRect pixels) const rect.start_row = (int)floor(pixels.top / fFontHeight); rect.end_row = (int)ceil(pixels.bottom / fFontHeight); -#if 0 - printf("pixels:\t%d\t%d\t%d\t%d\n" - "glyps:\t%d\t%d\t%d\t%d\n", - (int)pixels.top, (int)pixels.bottom, (int)pixels.left, (int)pixels.right, - rect.start_row, rect.end_row, rect.start_col, rect.end_col); -#endif + printf( + "TOP %d ch < %f px\n" + "BTM %d ch < %f px\n" + "LFT %d ch < %f px\n" + "RGH %d ch < %f px\n", + rect.start_row, pixels.top, + rect.end_row, pixels.bottom, + rect.start_col, pixels.left, + rect.end_col, pixels.right + ); + return rect; } @@ -94,6 +127,19 @@ BRect TermView::GlyphsToPixels(const VTermRect& glyphs) const rect.left = glyphs.start_col * fFontWidth; rect.right = glyphs.end_col * fFontWidth; + rect.OffsetBy(kBorderSpacing, kBorderSpacing); + + printf( + "TOP %d ch > %f px (%f)\n" + "BTM %d ch > %f px\n" + "LFT %d ch > %f px (%f)\n" + "RGH %d ch > %f px\n", + glyphs.start_row, rect.top, fFontHeight, + glyphs.end_row, rect.bottom, + glyphs.start_col, rect.left, fFontWidth, + glyphs.end_col, rect.right + ); + return rect; } @@ -109,8 +155,25 @@ BRect TermView::GlyphsToPixels(const int width, const int height) const } +void TermView::Damage(VTermRect rect) +{ + Invalidate(); +// Invalidate(GlyphsToPixels(rect)); +} + + +/* static */ +int TermView::Damage(VTermRect rect, void* user) +{ + TermView* view = (TermView*)user; + view->Damage(rect); + + return 0; +} + + const VTermScreenCallbacks TermView::sScreenCallbacks = { - /*.damage =*/ NULL, + &TermView::Damage, /*.moverect =*/ NULL, /*.movecursor =*/ NULL, /*.settermprop =*/ NULL, diff --git a/src/apps/serialconnect/TermView.h b/src/apps/serialconnect/TermView.h index 4e485c7e79..985863d19e 100644 --- a/src/apps/serialconnect/TermView.h +++ b/src/apps/serialconnect/TermView.h @@ -16,12 +16,19 @@ class TermView: public BView TermView(); ~TermView(); + void AttachedToWindow(); void Draw(BRect updateRect); + void GetPreferredSize(float* width, float* height); + void KeyDown(const char* bytes, int32 numBytes); + void PushBytes(const char* bytes, const size_t length); private: VTermRect PixelsToGlyphs(BRect pixels) const; BRect GlyphsToPixels(const VTermRect& glyphs) const; BRect GlyphsToPixels(const int width, const int height) const; + void Damage(VTermRect rect); + + static int Damage(VTermRect rect, void* user); private: VTerm* fTerm; From 48e4132e2877df4c5309639174e3e78378bffe4e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 25 Jul 2012 21:08:53 -0500 Subject: [PATCH 46/65] efi: Correct Haiku UUID in hrev44405 * I was working off of an old mailing list post * This is the *final* Haiku BFS1 UUID --- src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp b/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp index e268c23da6..6ab4665971 100644 --- a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp +++ b/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp @@ -52,7 +52,7 @@ const static struct type_map { {{0xC12A7328, 0xF81F, 0x11D2, 0xBA4B00A0C93EC93BLL}, "EFI System Data"}, {{0x21686148, 0x6449, 0x6E6F, 0x744E656564454649LL}, "BIOS Boot Data"}, {{0x024DEE41, 0x33E7, 0x11D3, 0x9D690008C781F39FLL}, "MBR Partition Nest"}, - {{0x42465331, 0xbb23, 0x1601, 0x802A4861696B7521LL}, "Haiku BFS"}, + {{0x42465331, 0x3BA3, 0x10F1, 0x802A4861696B7521LL}, "Haiku BFS"}, {{0x0FC63DAF, 0x8483, 0x4772, 0x8E793D69D8477DE4LL}, "Linux File System"}, {{0xA19D880F, 0x05FC, 0x4D3B, 0xA006743F0F84911ELL}, "Linux RAID"}, {{0x0657FD6D, 0xA4AB, 0x43C4, 0x84E50933C84B4F4FLL}, "Linux Swap"}, From 429212969e9f30a00170ab7ba77124a2caf7f28e Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 30 Jun 2012 21:25:09 +0200 Subject: [PATCH 47/65] Update translations from Pootle --- .../mail_daemon/inbound_filters/spam_filter/ja.catkeys | 4 +++- .../add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys | 5 ++++- .../add-ons/mail_daemon/outbound_protocols/smtp/de.catkeys | 5 ++++- .../add-ons/mail_daemon/outbound_protocols/smtp/ja.catkeys | 4 +++- data/catalogs/apps/deskbar/be.catkeys | 4 +++- data/catalogs/apps/deskbar/de.catkeys | 4 +++- data/catalogs/apps/deskbar/ja.catkeys | 4 +++- data/catalogs/apps/diskprobe/ja.catkeys | 4 +++- data/catalogs/apps/icon-o-matic/de.catkeys | 3 ++- data/catalogs/apps/installer/be.catkeys | 4 +++- data/catalogs/apps/installer/de.catkeys | 7 ++++++- data/catalogs/apps/installer/ja.catkeys | 7 ++++++- data/catalogs/apps/mediaplayer/de.catkeys | 3 ++- data/catalogs/apps/mediaplayer/ja.catkeys | 3 ++- data/catalogs/preferences/appearance/de.catkeys | 4 +++- data/catalogs/preferences/appearance/ja.catkeys | 4 +++- 16 files changed, 53 insertions(+), 16 deletions(-) diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/ja.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/ja.catkeys index 4e94fd4bde..7f1fa6fcae 100644 --- a/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/ja.catkeys +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/spam_filter/ja.catkeys @@ -1,6 +1,8 @@ -1 japanese x-vnd.Haiku-SpamFilter 1119442397 +1 japanese x-vnd.Haiku-SpamFilter 1975155212 or empty e-mail SpamFilterConfig または空のメール Spam Filter (AGMS Bayesian) SpamFilter スパムフィルター (AGMS Bayesian) +Genuine below and uncertain above: SpamFilterConfig 正規のを下に、疑わしいものを上に: +Spam above: SpamFilterConfig スパムを上に: Add spam rating to start of subject SpamFilterConfig 件名の最初にスパムの格付けを加える Learn from all incoming e-mail SpamFilterConfig 受信メールすべてから学習する Sorry, unable to launch the spamdbm program to let you edit the server settings. SpamFilterConfig すみません、サーバー設定編集のための spamdbm プログラムを起動できませんでした。 diff --git a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys index f397a6c00a..df55ef7c70 100644 --- a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys +++ b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/be.catkeys @@ -1,6 +1,8 @@ -1 belarusian x-vnd.Haiku-SMTP 1052586247 +1 belarusian x-vnd.Haiku-SMTP 2740407895 SMTP server: ConfigView Сервер SMTP: +STARTTLS ConfigView STARTTLS Error while logging in to %serv smtp Памылка падчас лагіну ў %serv +Unencrypted ConfigView Некрыптаваны . The server says:\n smtp . Паведамленне сервера:\n ESMTP ConfigView ESMTP Connecting to server… smtp Далучэнне да сервера… @@ -10,4 +12,5 @@ Destination: ConfigView Прызначэнне: : Connection refused or host not found. smtp : Адмоўлена ў злучэнні ці сервер не знойдзены. None ConfigView Няма POP3 before SMTP ConfigView POP3 перад SMTP +SSL ConfigView SSL . The server said:\n smtp . Паведамленне сервера:\n diff --git a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/de.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/de.catkeys index f35575602b..2988ae4db2 100644 --- a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/de.catkeys +++ b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/de.catkeys @@ -1,6 +1,8 @@ -1 german x-vnd.Haiku-SMTP 1052586247 +1 german x-vnd.Haiku-SMTP 2740407895 SMTP server: ConfigView SMTP-Server: +STARTTLS ConfigView STARTTLS Error while logging in to %serv smtp Fehler beim Anmelden an %serv +Unencrypted ConfigView Unverschlüsselt . The server says:\n smtp . Servermeldung:\n ESMTP ConfigView ESMTP Connecting to server… smtp Mit Server verbinden… @@ -10,4 +12,5 @@ Destination: ConfigView Zielverzeichnis: : Connection refused or host not found. smtp : Verbindung abgelehnt oder Host nicht gefunden. None ConfigView Keine POP3 before SMTP ConfigView POP3 vor SMTP +SSL ConfigView SSL . The server said:\n smtp . Servermeldung:\n diff --git a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/ja.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/ja.catkeys index 8aa1cbe05e..7708e5d85b 100644 --- a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/ja.catkeys +++ b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/ja.catkeys @@ -1,5 +1,6 @@ -1 japanese x-vnd.Haiku-SMTP 1052586247 +1 japanese x-vnd.Haiku-SMTP 1802799722 SMTP server: ConfigView SMTPサーバー: +STARTTLS ConfigView STARTTLS Error while logging in to %serv smtp %serv へのログイン中にエラーが発生しました . The server says:\n smtp サーバーからのメッセージです\n ESMTP ConfigView ESMTP @@ -10,4 +11,5 @@ Destination: ConfigView メッセージの保存先: : Connection refused or host not found. smtp 接続が拒否されたかサーバーが見つかりません。 None ConfigView 無し POP3 before SMTP ConfigView 送信前に受信する +SSL ConfigView SSL . The server said:\n smtp サーバーからのメッセージです\n diff --git a/data/catalogs/apps/deskbar/be.catkeys b/data/catalogs/apps/deskbar/be.catkeys index 03c1bcf275..5ecc1e21d4 100644 --- a/data/catalogs/apps/deskbar/be.catkeys +++ b/data/catalogs/apps/deskbar/be.catkeys @@ -1,9 +1,11 @@ -1 belarusian x-vnd.Be-TSKB 359782181 +1 belarusian x-vnd.Be-TSKB 3197510812 Power off DeskbarMenu Выключыць Show day of week PreferencesWindow Паказваць дзень тыдню Edit menu… PreferencesWindow Змяніць меню... +Suspend DeskbarMenu Прыпыніць Applications PreferencesWindow Праграмы Time preferences… TimeView Наладкі Часу… +About Haiku DeskbarMenu Пра Haiku Recent documents: PreferencesWindow Нядаўнія дакументы: Recent applications DeskbarMenu Нядаўнія праграмы Sort running applications PreferencesWindow Сартыравать запушчаныя праграмы diff --git a/data/catalogs/apps/deskbar/de.catkeys b/data/catalogs/apps/deskbar/de.catkeys index 2ebfa8c2be..0536d4d719 100644 --- a/data/catalogs/apps/deskbar/de.catkeys +++ b/data/catalogs/apps/deskbar/de.catkeys @@ -1,9 +1,11 @@ -1 german x-vnd.Be-TSKB 359782181 +1 german x-vnd.Be-TSKB 3197510812 Power off DeskbarMenu Ausschalten Show day of week PreferencesWindow Wochentag anzeigen Edit menu… PreferencesWindow Menü bearbeiten… +Suspend DeskbarMenu Ruhezustand Applications PreferencesWindow Anwendungen Time preferences… TimeView Datum & Zeit Einstellungen… +About Haiku DeskbarMenu Über Haiku Recent documents: PreferencesWindow Letzte Dokumente: Recent applications DeskbarMenu Letzte Anwendungen Sort running applications PreferencesWindow Laufende Anwendungen sortieren diff --git a/data/catalogs/apps/deskbar/ja.catkeys b/data/catalogs/apps/deskbar/ja.catkeys index a48fa7a264..f52d646965 100644 --- a/data/catalogs/apps/deskbar/ja.catkeys +++ b/data/catalogs/apps/deskbar/ja.catkeys @@ -1,9 +1,11 @@ -1 japanese x-vnd.Be-TSKB 359782181 +1 japanese x-vnd.Be-TSKB 3197510812 Power off DeskbarMenu 電源を切る Show day of week PreferencesWindow 曜日を表示する Edit menu… PreferencesWindow メニューの編集… +Suspend DeskbarMenu サスペンド Applications PreferencesWindow アプリケーション Time preferences… TimeView 日付と時刻の設定… +About Haiku DeskbarMenu Haiku について Recent documents: PreferencesWindow 最近使ったドキュメント Recent applications DeskbarMenu 最近使ったアプリケーション Sort running applications PreferencesWindow 実行中のアプリケーションを名前順に並び換える diff --git a/data/catalogs/apps/diskprobe/ja.catkeys b/data/catalogs/apps/diskprobe/ja.catkeys index 42ca5ceced..efa9c7f78b 100644 --- a/data/catalogs/apps/diskprobe/ja.catkeys +++ b/data/catalogs/apps/diskprobe/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-DiskProbe 559191070 +1 japanese x-vnd.Haiku-DiskProbe 969240855 File offset: ProbeView ファイルオフセット: %ld (native) ProbeView %ld (ネイティブ) 64 bit unsigned value: TypeEditors 符号なし 64 ビット値: @@ -121,6 +121,8 @@ View ProbeView This is the last menubar item 'File Edit Block View' 表示 Redo ProbeView やり直し File: ProbeView ファイル: 32 bit unsigned pointer: TypeEditors 符号なし 32 ビットポインタ: +Writing to the file failed:\n%s\n\nAll changes will be lost when you quit. ProbeView ファイルの書き込みに失敗しました:\n%s\n\nすべての変更は終了時に失われます。 +32 bit TypeEditors 32 ビット Cancel ProbeView 中止 Grayscale TypeEditors グレースケール 32 bit signed value: TypeEditors 符号つき 32 ビット値: diff --git a/data/catalogs/apps/icon-o-matic/de.catkeys b/data/catalogs/apps/icon-o-matic/de.catkeys index 795d62eebf..86422954e6 100644 --- a/data/catalogs/apps/icon-o-matic/de.catkeys +++ b/data/catalogs/apps/icon-o-matic/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.haiku-icon_o_matic 3736361491 +1 german x-vnd.haiku-icon_o_matic 4233739176 Select All Icon-O-Matic-PathManipulator Alles auswählen Add Style Icon-O-Matic-AddStylesCmd Stil hinzufügen Color (#%02x%02x%02x) Style name after dropping a color Farbe (#%02x%02x%02x) @@ -117,6 +117,7 @@ Gradient Icon-O-Matic-StyleTypes Farbverlauf Min LOD Icon-O-Matic-PropertyNames Min. LOD BEOS:ICON Attribute Icon-O-Matic-SavePanel BEOS:ICON Attribut Invert selection Icon-O-Matic-Properties Auswahl umkehren +Drop shapes Icon-O-Matic-ShapesList Formen ablegen Export as… Icon-O-Matic-Menu-File Exportieren als… Transformation Transformation Transformation Click on an object in Empty property list - 1st line Auf ein Objekt klicken in diff --git a/data/catalogs/apps/installer/be.catkeys b/data/catalogs/apps/installer/be.catkeys index ae23c70dc4..d35d4ef9a7 100644 --- a/data/catalogs/apps/installer/be.catkeys +++ b/data/catalogs/apps/installer/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Installer 2099988747 +1 belarusian x-vnd.Haiku-Installer 3440510165 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp Дадайце ў канец кожнага з ніжэйшых запісаў меню нешта падобнае да гэтага: Are you sure you want to abort the installation and restart the system? InstallerWindow Сапраўды спыніць усталёўку і перазагрузіць сістэму? \t}\n\n InstallerApp \t}\n\n @@ -12,6 +12,7 @@ With GRUB it's: (hdN,n)\n\n InstallerApp У GRUB гэта: (hdN,n)\n\n \tsudo update-grub\n\n\n InstallerApp \tsudo update-grub\n\n\n Stop InstallerWindow In alert after pressing Stop Стоп Install progress: InstallerWindow Прагрэс усталёўкі: +2.2) GRUB 1\n InstallerApp 2.1) GRUB 1\n Starting Installation. InstallProgress Пачынаецца Ўсталёўка. This is alpha-quality software! It means there is a high risk of losing important data. Make frequent backups! You have been warned.\n\n\n InstallerApp Гэта праграма знаходзіцца ў альфа-версіі! Гэта значыць, вы рызыкуеце згубіць важныя даныя. Часцей рабіце рэзервовыя копіі! Мы вас папярэдзілі.\n\n\n Are you sure you want to abort the installation? InstallerWindow Вы насамрэч жадаеце перарваць усталёўку? @@ -48,6 +49,7 @@ README InstallerApp README The destination disk may not have enough space. Try choosing a different disk or choose to not install optional items. InstallProgress Дыск прызначэння, пэўна, не мае патрэбнага месца. Паспрабуйце выбраць іншы дыск або адмяніце ўсталёўку дадатковых пунктаў. Please close the Boot Manager and DriveSetup windows before closing the Installer window. InstallerWindow Калі ласка, закрыйце Boot Manager і DriveSetup перад закрыццём Усталёўшчыка. Scanning for disks… InstallerWindow Сканіраванне дыскаў... +2.3) GRUB 2\n InstallerApp 2.2) GRUB 2\n The disk can't be mounted. Please choose a different disk. InstallProgress Немагчыма замантаваць дыск. Калі ласка, выберыце іншы. ?? of ?? InstallerWindow Unknown progress ?? з ?? \tmenuentry \"Haiku Alpha\" {\n InstallerApp \tmenuentry \"Haiku Alpha\" {\n diff --git a/data/catalogs/apps/installer/de.catkeys b/data/catalogs/apps/installer/de.catkeys index dbd034021f..cba7814454 100644 --- a/data/catalogs/apps/installer/de.catkeys +++ b/data/catalogs/apps/installer/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-Installer 2099988747 +1 german x-vnd.Haiku-Installer 3488795908 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp Gegen Ende der Datei fügt man unter den anderen Menüeinträgen etwas in dieser Art an:\n\n Are you sure you want to abort the installation and restart the system? InstallerWindow Soll die Installation tatsächlich abgebrochen und der Rechner neu gestartet werden? \t}\n\n InstallerApp \t}\n\n @@ -12,6 +12,7 @@ With GRUB it's: (hdN,n)\n\n InstallerApp Bei GRUB ist es: (hdN,n)\n\n \tsudo update-grub\n\n\n InstallerApp \tsudo update-grub\n\n\n Stop InstallerWindow In alert after pressing Stop Installation abbrechen Install progress: InstallerWindow Installationsverlauf: +2.2) GRUB 1\n InstallerApp 2.2) GRUB 1\n Starting Installation. InstallProgress Installation wird vorbereitet. This is alpha-quality software! It means there is a high risk of losing important data. Make frequent backups! You have been warned.\n\n\n InstallerApp Dies ist eine Alpha-Version! Es besteht ein hohes Risiko, dass wichtige Daten verloren gehen können. Man sollte seine Daten unbedingt regelmäßig sichern!\n\n\n Are you sure you want to abort the installation? InstallerWindow Soll die Installation wirklich abgebrochen werden? @@ -37,6 +38,7 @@ Boot sector successfully written. InstallProgress Der Bootsektor wurde erfolgre Performing installation. InstallProgress Installation läuft. scanning… InstallerWindow Untersuchung läuft… Set up boot menu InstallerWindow Bootmenü einrichten +2.1) GRUB (since os-prober v1.44)\n InstallerApp 2.1) GRUB (seit os-prober v1.44)\n The first logical partition always has the number \"4\", regardless of the number of primary partitions.\n\n InstallerApp Die erste logische Partition trägt immer die Nummer \"4\", unabhängig von der Anzahl primärer Partitionen.\n\n GRUB's naming scheme is still: (hdN,n)\n\n InstallerApp Das Benennungsschema von GRUB ist immer noch: (hdN,n)\n\n \tsudo /boot/grub/menu.lst\n\n InstallerApp \tsudo /boot/grub/menu.lst\n\n @@ -48,6 +50,7 @@ README InstallerApp LIESMICH The destination disk may not have enough space. Try choosing a different disk or choose to not install optional items. InstallProgress Auf dem Ziellaufwerk ist anscheinend nicht genügend Platz. Entweder ein anderes Laufwerk wählen oder einige optionale Pakete deaktivieren. Please close the Boot Manager and DriveSetup windows before closing the Installer window. InstallerWindow Bitte BootManger und DriveSetup vor dem Installer-Fenster schließen. Scanning for disks… InstallerWindow Es wird nach Laufwerken gesucht… +2.3) GRUB 2\n InstallerApp 2.3) GRUB 2\n The disk can't be mounted. Please choose a different disk. InstallProgress Das Laufwerk konnte nicht eingehängt werden. Bitte ein anderes Laufwerk wählen. ?? of ?? InstallerWindow Unknown progress ?? von ?? \tmenuentry \"Haiku Alpha\" {\n InstallerApp \tmenuentry \"Haiku Alpha\" {\n @@ -67,6 +70,7 @@ Installer System name Installer You can't install the contents of a disk onto itself. Please choose a different disk. InstallProgress Der Inhalt eines Laufwerks kann nicht auf sich selbst installiert werden. Bitte ein anderes Ziellaufwerk wählen. ??? InstallerWindow Unknown currently copied item ??? \"n\" is the partition number, which for GRUB 2 starts with \"1\"\n InstallerApp \"n\" ist die Partitionsnummer, die für GRUB 2 mit \"1\" beginnt\n +Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku should be recognized out of the box. To add Haiku to the GRUB menu, open a Terminal and enter:\n\n InstallerApp Seit es den os-prober v1.44 gibt (bei Ubuntu beispielsweise ab Version 11.04 dabei), sollte Haiku automatisch erkannt werden. Damit ein Haiku-Eintrag im GRUB Menü erscheint, folgendes in ein Terminal eingeben:\n\n Quit DriveSetup InstallerWindow DriveSetup beenden \"N\" is the hard disk number, starting with \"0\".\n InstallerApp \"N\" ist die Festplattennummer, beginnend bei \"0\".\n Hide optional packages InstallerWindow Optionale Pakete ausblenden @@ -109,6 +113,7 @@ So below the heading that must not be edited, add something similar to these lin Are you sure you want to to stop the installation? InstallerWindow Soll die Installation tatsächlich abgebrochen werden? Onto: InstallerWindow Nach: Please close the Boot Manager window before closing the Installer window. InstallerWindow Bitte BootManager vor dem Installer-Fenster schließen. +3) When you successfully boot into Haiku for the first time, make sure to read our \"Welcome\" and \"Userguide\" documentation. There are links on the Desktop and in WebPositive's bookmarks.\n\n InstallerApp 3) Wurde Haiku das erste Mal erfolgreich gestartet, sollte man sich die \"Welcome\" und \"Userguide\" Dokumentation ansehen. Verknüpfungen darauf befinden sich auf dem Desktop und in WebPositives Bookmarks.\n\n Tools InstallerWindow Werkzeuge The mount point could not be retrieved. InstallProgress Der Einhängeort wurde nicht gefunden. The target volume is not empty. Are you sure you want to install anyway?\n\nNote: The 'system' folder will be a clean copy from the source volume, all other folders will be merged, whereas files and links that exist on both the source and target volume will be overwritten with the source volume version. InstallProgress Das Ziellaufwerk ist nicht leer. Soll trotzdem hierher installiert werden?\n\nHinweis: Der 'system'-Ordner wird mit einer sauberen Kopie aus dem Quelllaufwerk überschrieben; alle anderen Ordner werden zusammengeführt, wobei Dateien und Verknüpfungen, die auf beiden Laufwerken existieren, mit der Version des Quelllaufwerks überschrieben werden. diff --git a/data/catalogs/apps/installer/ja.catkeys b/data/catalogs/apps/installer/ja.catkeys index 2d9c3e1928..414d724f24 100644 --- a/data/catalogs/apps/installer/ja.catkeys +++ b/data/catalogs/apps/installer/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-Installer 2099988747 +1 japanese x-vnd.Haiku-Installer 3488795908 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp したがって、Haikuを GRUBメニューに追加するには、ファイルの最後に下記のような記述をしてください。\n\n Are you sure you want to abort the installation and restart the system? InstallerWindow インストールを中止して、システムを再起動しますか? \t}\n\n InstallerApp \t}\n\n @@ -12,6 +12,7 @@ With GRUB it's: (hdN,n)\n\n InstallerApp GRUBではこのような表記をし \tsudo update-grub\n\n\n InstallerApp \tsudo update-grub\n\n\n Stop InstallerWindow In alert after pressing Stop 中断 Install progress: InstallerWindow 進行状況: +2.2) GRUB 1\n InstallerApp 2.1) GRUB 1\n Starting Installation. InstallProgress 準備をしています… This is alpha-quality software! It means there is a high risk of losing important data. Make frequent backups! You have been warned.\n\n\n InstallerApp 品質のソフトウェアです。高い確率で重要なデータを失う恐れがあります。こまめにバックアップをとってください! さらに、次の点に留意してください。\n\n\n Are you sure you want to abort the installation? InstallerWindow 本当にインストールを中断してよいですか ? @@ -37,6 +38,7 @@ Boot sector successfully written. InstallProgress ブートセクターの書 Performing installation. InstallProgress インストールを実行しています。 scanning… InstallerWindow ディスクを検出しています… Set up boot menu InstallerWindow ブートメニューの設定 +2.1) GRUB (since os-prober v1.44)\n InstallerApp 2.1) GRUB (os-prober v1.44 以降)\n The first logical partition always has the number \"4\", regardless of the number of primary partitions.\n\n InstallerApp プライマリーパーティションの数にもかかわらず、最初の論理パーティションは常に\"4\"という数字が付きます。\n\n GRUB's naming scheme is still: (hdN,n)\n\n InstallerApp GRUBの命名規則はまだ: (hdN,n) です。\n\n \tsudo /boot/grub/menu.lst\n\n InstallerApp \tsudo <好みのテキストエディタ> /boot/grub/menu.lst\n\n @@ -48,6 +50,7 @@ README InstallerApp README The destination disk may not have enough space. Try choosing a different disk or choose to not install optional items. InstallProgress インストール先ディスクの空き容量が不足している可能性があります。他のディスクを選択するか、インストールするオプションを減らしてください。 Please close the Boot Manager and DriveSetup windows before closing the Installer window. InstallerWindow Haiku インストーラーを閉じる前に Boot Manager と DriveSetup を終了してください。 Scanning for disks… InstallerWindow ディスクを検出しています… +2.3) GRUB 2\n InstallerApp 2.2) GRUB 2\n The disk can't be mounted. Please choose a different disk. InstallProgress このディスクをマウントできません。他のディスクを選択してください。 ?? of ?? InstallerWindow Unknown progress ?? / ?? \tmenuentry \"Haiku Alpha\" {\n InstallerApp \tmenuentry \"Haiku Alpha\" {\n @@ -67,6 +70,7 @@ Installer System name インストーラー You can't install the contents of a disk onto itself. Please choose a different disk. InstallProgress インストール元ディスクへのインストールはできません。他のディスクを選んでください。 ??? InstallerWindow Unknown currently copied item ??? \"n\" is the partition number, which for GRUB 2 starts with \"1\"\n InstallerApp \"n\"はパーティション番号で、GRUB 2は\"1\"から数えます。\n +Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku should be recognized out of the box. To add Haiku to the GRUB menu, open a Terminal and enter:\n\n InstallerApp os-prober v1.44 以降 (たとえば、Ubuntu 11.04 以降) では、Haiku は設定なしで認識するはずです。Haiku を GRUB メニューに追加するには、ターミナルを立ち上げて以下を入力します:\n\n Quit DriveSetup InstallerWindow DriveSetup の終了 \"N\" is the hard disk number, starting with \"0\".\n InstallerApp \"N\"はハードディスクの番号で、\"0\"から数えます。\n Hide optional packages InstallerWindow オプショナルパッケージを隠す @@ -109,6 +113,7 @@ So below the heading that must not be edited, add something similar to these lin Are you sure you want to to stop the installation? InstallerWindow 本当にインストールを中断してよいですか ? Onto: InstallerWindow インストール先: Please close the Boot Manager window before closing the Installer window. InstallerWindow ブートマネージャーウィンドウを閉じてから、インストーラーウィンドウを閉じてください。 +3) When you successfully boot into Haiku for the first time, make sure to read our \"Welcome\" and \"Userguide\" documentation. There are links on the Desktop and in WebPositive's bookmarks.\n\n InstallerApp 3) はじめて Haiku のブートに成功したら、 \"Welcome\" と \"Userguide\" を必ず読んでください。これらは、デスクトップ上のリンクおよび、WebPositive のブックマーク中にあります。\n\n Tools InstallerWindow ツール The mount point could not be retrieved. InstallProgress マウントポイントを取得できませんでした。 The target volume is not empty. Are you sure you want to install anyway?\n\nNote: The 'system' folder will be a clean copy from the source volume, all other folders will be merged, whereas files and links that exist on both the source and target volume will be overwritten with the source volume version. InstallProgress インストール先パーティションにはデータがあります。それでもインストールしますか?\n\n注意:システムフォルダーはインストール元からそのままクリーンコピーされますが、その他のフォルダーはマージされ、両方のボリュームに存在するファイルやリンクはインストール元のバージョンで上書きされます。 diff --git a/data/catalogs/apps/mediaplayer/de.catkeys b/data/catalogs/apps/mediaplayer/de.catkeys index cb4679f638..96546baa50 100644 --- a/data/catalogs/apps/mediaplayer/de.catkeys +++ b/data/catalogs/apps/mediaplayer/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-MediaPlayer 607764928 +1 german x-vnd.Haiku-MediaPlayer 2389197979 raw audio MediaPlayer-InfoWin Raw-Audio Location MediaPlayer-InfoWin Ort 1.85 : 1 (American) MediaPlayer-Main 1,85 : 1 (Amerikanisch) @@ -70,6 +70,7 @@ Select all MediaPlayer-PlaylistWindow Alles auswählen Move Entry MediaPlayer-MovePLItemsCmd Eintrag verschieben Open MediaPlayer-PlaylistWindow Öffnen Stop playing. MediaPlayer-Main Wiedergabe stoppen. +The file '%filename' could not be opened.\n\n MediaPlayer-Main Die Datei '%filename' konnte nicht geöffnet werden.\n\n Error: MediaPlayer-RemovePLItemsCmd Fehler: Audio MediaPlayer-InfoWin Audio Internal error (malformed message). Saving the playlist failed. MediaPlayer-PlaylistWindow Interner Fehler (falsche Nachrichtenstruktur). Speichern der Playliste fehlgeschlagen. diff --git a/data/catalogs/apps/mediaplayer/ja.catkeys b/data/catalogs/apps/mediaplayer/ja.catkeys index 4a46a393b3..393321273b 100644 --- a/data/catalogs/apps/mediaplayer/ja.catkeys +++ b/data/catalogs/apps/mediaplayer/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-MediaPlayer 1271117245 +1 japanese x-vnd.Haiku-MediaPlayer 3052550296 Location MediaPlayer-InfoWin 場所 1.85 : 1 (American) MediaPlayer-Main 1.85 : 1 (American) %d kHz MediaPlayer-InfoWin %d kHz @@ -69,6 +69,7 @@ Select all MediaPlayer-PlaylistWindow すべて選択 Move Entry MediaPlayer-MovePLItemsCmd 項目の移動 Open MediaPlayer-PlaylistWindow 開く Stop playing. MediaPlayer-Main 再生を停止 +The file '%filename' could not be opened.\n\n MediaPlayer-Main ファイル'%filename'を開けませんでした。\n\n Error: MediaPlayer-RemovePLItemsCmd エラー: Audio MediaPlayer-InfoWin オーディオ Internal error (malformed message). Saving the playlist failed. MediaPlayer-PlaylistWindow 内部エラー (不正なメッセージ)。プレイリストの保存に失敗しました。 diff --git a/data/catalogs/preferences/appearance/de.catkeys b/data/catalogs/preferences/appearance/de.catkeys index 1da44d6ffa..2da15fb277 100644 --- a/data/catalogs/preferences/appearance/de.catkeys +++ b/data/catalogs/preferences/appearance/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-Appearance 3882211276 +1 german x-vnd.Haiku-Appearance 1557879521 Plain font: Font view Normal: Control highlight Colors tab Steuerelement - Ausgewählt Control border Colors tab Steuerelement - Rahmen @@ -27,6 +27,7 @@ Window border Colors tab Fenster - Rahmen Window tab text Colors tab Reiter - Text Document text Colors tab Dokument - Text Navigation pulse Colors tab Navigation - Leuchtfarbe +Window decorator: DecorSettingsView Fenster-Dekorator: Selected menu item text Colors tab Menü - Text (ausgewählt) Menu background Colors tab Menü - Hintergrund OK DecorSettingsView OK @@ -50,6 +51,7 @@ LCD subpixel AntialiasingSettingsView LCD-Subpixel Selected menu item border Colors tab Menü - Rahmen (ausgewählt) Strong AntialiasingSettingsView Stark Panel text Colors tab Fenster - Text +Decorators APRWindow Dekoratoren Monospaced fonts only AntialiasingSettingsView Nur nicht-proportionale Schriften Antialiasing menu AntialiasingSettingsView Kantenglättungs-Menü Fonts APRWindow Schriftarten diff --git a/data/catalogs/preferences/appearance/ja.catkeys b/data/catalogs/preferences/appearance/ja.catkeys index 5fd1f42696..9711ddf81d 100644 --- a/data/catalogs/preferences/appearance/ja.catkeys +++ b/data/catalogs/preferences/appearance/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-Appearance 3882211276 +1 japanese x-vnd.Haiku-Appearance 1557879521 Plain font: Font view 標準フォント: Control highlight Colors tab コントロールのハイライト Control border Colors tab コントロールの境界 @@ -27,6 +27,7 @@ Window border Colors tab ウィンドウ枠 Window tab text Colors tab ウィンドウタブの文字 Document text Colors tab ドキュメントの文字 Navigation pulse Colors tab ナビゲーションの点滅 +Window decorator: DecorSettingsView ウィンドウデコレーター: Selected menu item text Colors tab メニュー選択項目の文字 Menu background Colors tab メニューの背景 OK DecorSettingsView OK @@ -50,6 +51,7 @@ LCD subpixel AntialiasingSettingsView LCD サブピクセル Selected menu item border Colors tab メニュー選択項目の境界 Strong AntialiasingSettingsView 強い Panel text Colors tab パネルの文字 +Decorators APRWindow デコレーター Monospaced fonts only AntialiasingSettingsView 等幅フォントのみ有効 Antialiasing menu AntialiasingSettingsView アンチエイリアスメニュー Fonts APRWindow フォント From 910d677e3ef50c3b05b562bc01105c3c56350cad Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Thu, 26 Jul 2012 10:02:14 +0200 Subject: [PATCH 48/65] Update translations from Pootle --- .../outbound_protocols/smtp/fi.catkeys | 5 +++- .../outbound_protocols/smtp/pl.catkeys | 5 +++- .../add-ons/translators/tga/ru.catkeys | 3 ++- .../translators/wonderbrush/ru.catkeys | 3 ++- data/catalogs/apps/aboutsystem/ru.catkeys | 5 +++- data/catalogs/apps/deskbar/fi.catkeys | 4 ++- data/catalogs/apps/deskbar/pl.catkeys | 3 ++- data/catalogs/apps/deskbar/ru.catkeys | 25 ++++++++++++++++++- data/catalogs/apps/deskcalc/ru.catkeys | 5 +++- data/catalogs/apps/devices/ru.catkeys | 6 ++++- data/catalogs/apps/diskprobe/ru.catkeys | 3 ++- data/catalogs/apps/diskusage/ru.catkeys | 3 ++- data/catalogs/apps/expander/ru.catkeys | 6 ++++- data/catalogs/apps/icon-o-matic/fi.catkeys | 3 ++- data/catalogs/apps/icon-o-matic/ru.catkeys | 4 ++- data/catalogs/apps/installer/fi.catkeys | 7 +++++- data/catalogs/apps/installer/pl.catkeys | 5 +++- data/catalogs/apps/installer/ru.catkeys | 7 +++++- data/catalogs/apps/launchbox/ru.catkeys | 3 ++- data/catalogs/apps/mail/ru.catkeys | 6 ++++- data/catalogs/apps/mediaconverter/ru.catkeys | 3 ++- data/catalogs/apps/mediaplayer/fi.catkeys | 3 ++- data/catalogs/apps/mediaplayer/pl.catkeys | 3 ++- data/catalogs/apps/mediaplayer/ru.catkeys | 15 ++++++++++- data/catalogs/apps/networkstatus/ru.catkeys | 3 ++- data/catalogs/apps/poorman/ru.catkeys | 10 ++++++-- data/catalogs/apps/powerstatus/ru.catkeys | 7 +++++- .../apps/screenshot/Screenshot/ru.catkeys | 3 ++- data/catalogs/apps/soundrecorder/ru.catkeys | 11 +++++++- data/catalogs/apps/terminal/ru.catkeys | 3 ++- data/catalogs/apps/workspaces/ru.catkeys | 4 ++- data/catalogs/kits/tracker/be.catkeys | 9 +------ data/catalogs/kits/tracker/de.catkeys | 9 +------ data/catalogs/kits/tracker/el.catkeys | 8 +----- data/catalogs/kits/tracker/fi.catkeys | 9 +------ data/catalogs/kits/tracker/fr.catkeys | 3 +-- data/catalogs/kits/tracker/hi.catkeys | 9 +------ data/catalogs/kits/tracker/ja.catkeys | 9 +------ data/catalogs/kits/tracker/lt.catkeys | 9 +------ data/catalogs/kits/tracker/nb.catkeys | 9 +------ data/catalogs/kits/tracker/nl.catkeys | 9 +------ data/catalogs/kits/tracker/pl.catkeys | 9 +------ data/catalogs/kits/tracker/ru.catkeys | 16 ++++++++++-- data/catalogs/kits/tracker/sk.catkeys | 9 +------ data/catalogs/kits/tracker/uk.catkeys | 9 +------ data/catalogs/kits/tracker/zh-Hans.catkeys | 3 +-- .../preferences/3drendering/ru.catkeys | 4 ++- .../preferences/appearance/fi.catkeys | 4 ++- .../preferences/appearance/pl.catkeys | 4 ++- .../preferences/appearance/ru.catkeys | 15 ++++++++++- .../preferences/datatranslations/ru.catkeys | 3 ++- data/catalogs/preferences/keymap/ru.catkeys | 17 ++++++++++++- data/catalogs/preferences/mail/ru.catkeys | 3 ++- data/catalogs/preferences/printers/ru.catkeys | 3 ++- data/catalogs/preferences/time/ru.catkeys | 5 +++- 55 files changed, 221 insertions(+), 142 deletions(-) diff --git a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/fi.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/fi.catkeys index 98479f7785..b3282f484d 100644 --- a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/fi.catkeys +++ b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/fi.catkeys @@ -1,6 +1,8 @@ -1 finnish x-vnd.Haiku-SMTP 1052586247 +1 finnish x-vnd.Haiku-SMTP 2740407895 SMTP server: ConfigView SMTP-palvelin: +STARTTLS ConfigView STARTTLS Error while logging in to %serv smtp Virhe kirjauduttaessa palvelimeen %serv +Unencrypted ConfigView Salaamaton . The server says:\n smtp . Palvelin sanoo:\n ESMTP ConfigView ESMTP Connecting to server… smtp Yhdistetään palvelimeen... @@ -10,4 +12,5 @@ Destination: ConfigView Kohde: : Connection refused or host not found. smtp : Yhteys torjuttiin tai tietokonetta ei löytynyt. None ConfigView Ei mitään POP3 before SMTP ConfigView POP3-yhteyskäytäntö ennen SMTP-yhteyskäytäntöä +SSL ConfigView SSL . The server said:\n smtp . Palvelin sanoi:\n diff --git a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/pl.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/pl.catkeys index 0fcb448cf8..7972b6d143 100644 --- a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/pl.catkeys +++ b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/pl.catkeys @@ -1,6 +1,8 @@ -1 polish x-vnd.Haiku-SMTP 1052586247 +1 polish x-vnd.Haiku-SMTP 2740407895 SMTP server: ConfigView Serwer SMTP: +STARTTLS ConfigView STARTTLS Error while logging in to %serv smtp Błąd podczas logowania do %serv +Unencrypted ConfigView Niezaszyfrowane . The server says:\n smtp . Serwer mówi:\n ESMTP ConfigView ESMTP Connecting to server… smtp Łączenie ze serwerem… @@ -10,4 +12,5 @@ Destination: ConfigView Przeznaczenie: : Connection refused or host not found. smtp : Połączenie odrzucone lub nie znaleziono hosta. None ConfigView Brak POP3 before SMTP ConfigView POP3 przed SMTP +SSL ConfigView SSL . The server said:\n smtp . Serwer odpowiedział:\n diff --git a/data/catalogs/add-ons/translators/tga/ru.catkeys b/data/catalogs/add-ons/translators/tga/ru.catkeys index 81bfc99fe5..26e0fb7a1d 100644 --- a/data/catalogs/add-ons/translators/tga/ru.catkeys +++ b/data/catalogs/add-ons/translators/tga/ru.catkeys @@ -1,8 +1,9 @@ -1 russian x-vnd.Haiku-TGATranslator 2221210336 +1 russian x-vnd.Haiku-TGATranslator 4159874267 Targa image (%d bits truecolor) TGATranslator Targa изображение (%d битный истинный цвет) Version %d.%d.%d %s TGAView Версия %d.%d.%d %s Ignore TGA alpha channel TGAView Игнорировать альфа канал TGA Targa image (%d bits colormap) TGATranslator Targa изображение (%d битная цветовая карта) +TGA Image Translator TGAView Транслятор TGA изображений Targa image (%d bits RLE colormap) TGATranslator Targa изображение (%d битная цветовая карта RLE) Targa image (%d bits gray) TGATranslator Targa изображение (%d битное серое) Written by the Haiku Translation Kit Team TGAView Разработан командой Haiku Translation Kit diff --git a/data/catalogs/add-ons/translators/wonderbrush/ru.catkeys b/data/catalogs/add-ons/translators/wonderbrush/ru.catkeys index c1d3a88d69..255c0f73b1 100644 --- a/data/catalogs/add-ons/translators/wonderbrush/ru.catkeys +++ b/data/catalogs/add-ons/translators/wonderbrush/ru.catkeys @@ -1,2 +1,3 @@ -1 russian x-vnd.Haiku-WonderBrushTranslator 3131198329 +1 russian x-vnd.Haiku-WonderBrushTranslator 1203851513 +WonderBrush image translator WonderBrushTranslator Транслятор WonderBrush изображений WonderBrush images WonderBrushTranslator WonderBrush изображения diff --git a/data/catalogs/apps/aboutsystem/ru.catkeys b/data/catalogs/apps/aboutsystem/ru.catkeys index 6702135edf..1ce7300b05 100644 --- a/data/catalogs/apps/aboutsystem/ru.catkeys +++ b/data/catalogs/apps/aboutsystem/ru.catkeys @@ -1,4 +1,5 @@ -1 russian x-vnd.Haiku-About 2392344107 +1 russian x-vnd.Haiku-About 4105576244 +Copyright © 1999-2010 by the authors of Gutenprint. All rights reserved. AboutView Все права защищены © 1999-2010 Авторы Gutenprint. Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (за его ядро NewOS)\n BSD (4-clause) AboutView 4-пунктовая BSD %ld Processors: AboutView Процессоров: %ld @@ -37,7 +38,9 @@ Copyright © 2002-2003 Steve Lhomme. All rights reserved. AboutView Все пр \nCopyrights\n\n AboutView \nАвторские права\n\n Current maintainers:\n AboutView Текущие разработчики:\n Time running: AboutView Время работы: +Contains software from the FreeBSD Project, released under the BSD license:\ncal, ftpd, ping, telnet, telnetd, traceroute\nCopyright © 1994-2008 The FreeBSD Project. All rights reserved. AboutView Содержит программное обеспечение из проекта FreeBSD, выпущен под лицензией BSD:\ncal, ftpd, ping, telnet, telnetd, tracerout\nВсе права защищены © 1994-2008 Проект FreeBSD. The Haikuware team and their bounty program\n AboutView Команде Haikuware и их программе пожертвований\n +Copyright © 2010-2011 Google Inc. All rights reserved. AboutView Все права защищены © 2010-2011 Google Inc. About this system AboutWindow Об этой системе Version: AboutView Версия: Copyright © 1994-2008 Xiph.Org. All rights reserved. AboutView Все права защищены © 1994-2008 Xiph.Org. diff --git a/data/catalogs/apps/deskbar/fi.catkeys b/data/catalogs/apps/deskbar/fi.catkeys index c3bf8d469e..2b7e9886f4 100644 --- a/data/catalogs/apps/deskbar/fi.catkeys +++ b/data/catalogs/apps/deskbar/fi.catkeys @@ -1,9 +1,11 @@ -1 finnish x-vnd.Be-TSKB 359782181 +1 finnish x-vnd.Be-TSKB 3197510812 Power off DeskbarMenu Sammuta virta Show day of week PreferencesWindow Näytä viikonpäivä Edit menu… PreferencesWindow Muokkaa valikkoa... +Suspend DeskbarMenu Keskeytystila Applications PreferencesWindow Sovellukset Time preferences… TimeView Aika-asetukset... +About Haiku DeskbarMenu Haikusta Recent documents: PreferencesWindow Äskettäiset asiakirjat: Recent applications DeskbarMenu Äskettäiset sovellukset Sort running applications PreferencesWindow Lajittele suoritettavat sovellukset diff --git a/data/catalogs/apps/deskbar/pl.catkeys b/data/catalogs/apps/deskbar/pl.catkeys index 4e7778d9ce..6094b25e83 100644 --- a/data/catalogs/apps/deskbar/pl.catkeys +++ b/data/catalogs/apps/deskbar/pl.catkeys @@ -1,9 +1,10 @@ -1 polish x-vnd.Be-TSKB 359782181 +1 polish x-vnd.Be-TSKB 3726855474 Power off DeskbarMenu Wyłącz komputer Show day of week PreferencesWindow Pokaż dzień tygodnia Edit menu… PreferencesWindow Edytuj zawartość menu… Applications PreferencesWindow Lista aplikacji Time preferences… TimeView Ustawienia czasu... +About Haiku DeskbarMenu O Haiku Recent documents: PreferencesWindow Ostatnio przeglądane dokumenty: Recent applications DeskbarMenu Ostatnio uruchomione aplikacje Sort running applications PreferencesWindow Sortuj uruchomione aplikacje alfabetycznie diff --git a/data/catalogs/apps/deskbar/ru.catkeys b/data/catalogs/apps/deskbar/ru.catkeys index e802318d48..3e5169e623 100644 --- a/data/catalogs/apps/deskbar/ru.catkeys +++ b/data/catalogs/apps/deskbar/ru.catkeys @@ -1,29 +1,52 @@ -1 russian x-vnd.Be-TSKB 1193384805 +1 russian x-vnd.Be-TSKB 3197510812 +Power off DeskbarMenu Выключить компьютер +Show day of week PreferencesWindow Отображать день недели Edit menu… PreferencesWindow Изменить меню… +Suspend DeskbarMenu Приостановить Applications PreferencesWindow Приложения +Time preferences… TimeView Настроить часы… +About Haiku DeskbarMenu О системе Haiku Recent documents: PreferencesWindow Недавние документы: +Recent applications DeskbarMenu Недавние приложения: Sort running applications PreferencesWindow Сортировать запущенные приложения +Show time Tray Отображать время Applications B_USER_DESKBAR_DIRECTORY/Applications Приложения +Find… DeskbarMenu Найти… Window PreferencesWindow Окно Menu PreferencesWindow Меню +Recent documents DeskbarMenu Недавние документы +Show seconds PreferencesWindow Отображать секунды Auto-hide PreferencesWindow Скрывать автоматически Always on top PreferencesWindow Всегда сверху + DeskbarMenu <Папка Deskbar пуста> Show all WindowMenu Показать все No windows WindowMenu Нет окон Deskbar System name Deskbar +Restart system DeskbarMenu Перезагрузить компьютер +Large PreferencesWindow Крупные Auto-raise PreferencesWindow Всплывать при наведении Hide time TimeView Скрыть часы Recent folders: PreferencesWindow Недавние папки: Show application expander PreferencesWindow Отображать список окон приложений +Restart Tracker DeskbarMenu Перезапустить Tracker Close all WindowMenu Закрыть все Deskbar preferences PreferencesWindow Настройки Deskbar +Mount DeskbarMenu Подключить +Small PreferencesWindow Маленькие Recent applications: PreferencesWindow Недавние приложения: +Shutdown… DeskbarMenu Завершение работы… Tracker always first PreferencesWindow Tracker всегда первый Preferences B_USER_DESKBAR_DIRECTORY/Preferences Настройки +Recent folders DeskbarMenu Недавние папки +About this system DeskbarMenu Об этой системе Show calendar… TimeView Показать календарь… +Deskbar preferences… DeskbarMenu Настроить Deskbar… Expand new applications PreferencesWindow Раскрывать список окон при запуске +Show replicants DeskbarMenu Отображать репликанты +Hide application names PreferencesWindow Скрыть имена приложений Clock PreferencesWindow Часы Demos B_USER_DESKBAR_DIRECTORY/Demos Демо +Icon size PreferencesWindow Размер значков Desktop applets B_USER_DESKBAR_DIRECTORY/Desktop applets Апплеты Hide all WindowMenu Скрыть все Quit application WindowMenu Закрыть приложение diff --git a/data/catalogs/apps/deskcalc/ru.catkeys b/data/catalogs/apps/deskcalc/ru.catkeys index 387d82dddd..67bb235dd8 100644 --- a/data/catalogs/apps/deskcalc/ru.catkeys +++ b/data/catalogs/apps/deskcalc/ru.catkeys @@ -1,4 +1,7 @@ -1 russian x-vnd.Haiku-DeskCalc 2021462472 +1 russian x-vnd.Haiku-DeskCalc 1916192649 +Compact CalcView Компактный +Scientific CalcView Научный DeskCalc System name Калькулятор +Basic CalcView Простой Enable Num Lock on startup CalcView Включать Num Lock при запуске Audio Feedback CalcView Звуковая реакция diff --git a/data/catalogs/apps/devices/ru.catkeys b/data/catalogs/apps/devices/ru.catkeys index 63ea431e36..6a4ecc5dae 100644 --- a/data/catalogs/apps/devices/ru.catkeys +++ b/data/catalogs/apps/devices/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Devices 2473502333 +1 russian x-vnd.Haiku-Devices 865240481 Manufacturer DeviceSCSI Производитель Order by: DevicesView Сортировать по: ACPI controller Device Контроллер ACPI @@ -13,6 +13,7 @@ Computer Device Компьютер Unknown device Device Неизвестное устройство Class Info:\t\t\t\t: %classInfo% DeviceACPI Информация о классе:\t\t\t\t: %classInfo% Processor DeviceSCSI Процессор +RBC DeviceSCSI RBC Detailed DevicesView Подробности Category DevicesView категориям Quit DevicesView Выход @@ -53,8 +54,10 @@ Basic information DevicesView Основная информация PCI Information DevicePCI PCI информация Manufacturer: Device Производитель: ACPI bus DevicesView Шина ACPI +Changer DeviceSCSI Changer ACPI System Bus DeviceACPI Системная шина ACPI Devices System name Устройства +Worm DeviceSCSI Worm Multimedia controller Device Мультимедийный контроллер Unknown DevicePCI Неизвестное Device name: Device Название устройства: @@ -73,6 +76,7 @@ Manufacturer DevicePCI Производитель Intelligent controller Device Интеллектуальный контроллер Satellite communications controller Device Контроллер спутниковой связи SCSI Information DeviceSCSI SCSI информация +Enclosure DeviceSCSI Enclosure Array DeviceSCSI Массив Bridge Device Мост Refresh devices DevicesView Обновить список устройств diff --git a/data/catalogs/apps/diskprobe/ru.catkeys b/data/catalogs/apps/diskprobe/ru.catkeys index 287bb88b24..05b09797d7 100644 --- a/data/catalogs/apps/diskprobe/ru.catkeys +++ b/data/catalogs/apps/diskprobe/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-DiskProbe 2706202187 +1 russian x-vnd.Haiku-DiskProbe 2306672993 File offset: ProbeView Смещение файла: %ld (native) ProbeView %ld (родной) 64 bit unsigned value: TypeEditors 64-х битное беззнаковое значение: @@ -59,6 +59,7 @@ Boolean value: TypeEditors Булевое значение: 8 bit palette TypeEditors 8 битная палитра Fit ProbeView Size of fonts, fits to available room Подгонять Probe device OpenWindow Исследовать устройство + (native) ProbeView (нативный) Unknown format TypeEditors Неизвестный формат Hexadecimal FindWindow A menu item, as short as possible, noun is recommended if it is shorter than adjective. Шестнадцатеричный MIME type: TypeEditors MIME тип: diff --git a/data/catalogs/apps/diskusage/ru.catkeys b/data/catalogs/apps/diskusage/ru.catkeys index d05128ac54..7589725d99 100644 --- a/data/catalogs/apps/diskusage/ru.catkeys +++ b/data/catalogs/apps/diskusage/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-DiskUsage 3634416251 +1 russian x-vnd.Haiku-DiskUsage 3399777733 Scanning %refName% Scanner Сканируется раздел %refName% Size Info Window Размер Rescan Pie View Пересканировать @@ -14,6 +14,7 @@ Scan Status View Сканировать file unavailable Status View файл недоступен Get Info Pie View Информация DiskUsage System name Использование диска + in %d files Info Window в %d файлах %d files Status View %d файлов Created Info Window Создан Modified Info Window Изменен diff --git a/data/catalogs/apps/expander/ru.catkeys b/data/catalogs/apps/expander/ru.catkeys index f6ced04126..61a9ec9b09 100644 --- a/data/catalogs/apps/expander/ru.catkeys +++ b/data/catalogs/apps/expander/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Expander 386826896 +1 russian x-vnd.Haiku-Expander 2398100010 Expand ExpanderMenu Распаковать Close window when done expanding ExpanderPreferences Закрывать окно после распаковки Set destination… ExpanderMenu Путь для извлечения… @@ -6,6 +6,7 @@ Use: ExpanderPreferences Использовать: File expanded ExpanderWindow Файл распакован The destination is read only. ExpanderWindow Путь назначения доступен только для чтения. Expander: Open ExpanderWindow Распаковщик: Открыть + is not supported ExpanderWindow не поддерживается Expander settings ExpanderPreferences Настройки извлечения Select current DirectoryFilePanel Выбрать текущий Source ExpanderWindow Источник @@ -15,8 +16,11 @@ Cancel ExpanderWindow Отмена Automatically expand files ExpanderPreferences Автоматически распаковывать файлы Creating listing for '%s' ExpanderWindow Создается список файлов для '%s' Continue ExpanderWindow Продолжить +Destination folder ExpanderPreferences Путь для извлечения The destination folder does not exist. ExpanderWindow Папка назначения не существует. +Other ExpanderPreferences Другое Cancel ExpanderPreferences Отмена +Expansion ExpanderPreferences Извлечение Are you sure you want to stop expanding this\narchive? The expanded items may not be complete. ExpanderWindow Вы уверены, что хотите остановить распаковку этого\nархива? Некоторые файлы могли быть извлечены не полностью. Select DirectoryFilePanel Выбрать Same directory as source (archive) file ExpanderPreferences Использовать ту же папку где находится архив diff --git a/data/catalogs/apps/icon-o-matic/fi.catkeys b/data/catalogs/apps/icon-o-matic/fi.catkeys index d4e2fb9b4c..97f9008902 100644 --- a/data/catalogs/apps/icon-o-matic/fi.catkeys +++ b/data/catalogs/apps/icon-o-matic/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.haiku-icon_o_matic 3736361491 +1 finnish x-vnd.haiku-icon_o_matic 4233739176 Select All Icon-O-Matic-PathManipulator Valitse kaikki Add Style Icon-O-Matic-AddStylesCmd Lisää tyyli Color (#%02x%02x%02x) Style name after dropping a color Väri (#%02x%02x%02x) @@ -117,6 +117,7 @@ Gradient Icon-O-Matic-StyleTypes Kaltevuus Min LOD Icon-O-Matic-PropertyNames Minimi LOD BEOS:ICON Attribute Icon-O-Matic-SavePanel BEOS:ICON -attribuutti Invert selection Icon-O-Matic-Properties Käännä valinta +Drop shapes Icon-O-Matic-ShapesList Pudota hahmot Export as… Icon-O-Matic-Menu-File Vie nimellä... Transformation Transformation Muodonmuutos Click on an object in Empty property list - 1st line Napsauta objektia kohteessa diff --git a/data/catalogs/apps/icon-o-matic/ru.catkeys b/data/catalogs/apps/icon-o-matic/ru.catkeys index 8c34cab80d..0149957160 100644 --- a/data/catalogs/apps/icon-o-matic/ru.catkeys +++ b/data/catalogs/apps/icon-o-matic/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.haiku-icon_o_matic 2326864078 +1 russian x-vnd.haiku-icon_o_matic 4233739176 Select All Icon-O-Matic-PathManipulator Выделить всё Add Style Icon-O-Matic-AddStylesCmd Добавить стиль Color (#%02x%02x%02x) Style name after dropping a color Цвет (#%02x%02x%02x) @@ -117,6 +117,7 @@ Gradient Icon-O-Matic-StyleTypes Градиент Min LOD Icon-O-Matic-PropertyNames Мин. LOD BEOS:ICON Attribute Icon-O-Matic-SavePanel Атрибут BEOS:ICON Invert selection Icon-O-Matic-Properties Инвертировать выделение +Drop shapes Icon-O-Matic-ShapesList Удалить формы Export as… Icon-O-Matic-Menu-File Экспортировать как… Transformation Transformation Изменение Click on an object in Empty property list - 1st line Нажмите на объект в @@ -158,6 +159,7 @@ Snap to grid Icon-O-Matic-Menu-Settings Выровнять по сетке Remove Icon-O-Matic-ShapesList Удалить Yes Icon-O-Matic-StyledTextImport Да Transformation Icon-O-Matic-TransformersList Изменение +Save image Icon-O-Matic-SavePanel Сохранить изображение Add Styles Icon-O-Matic-AddStylesCmd Добавить стили Remove Control Points Icon-O-Matic-RemovePointsCmd Удалить точки Format Icon-O-Matic-SavePanel Формат diff --git a/data/catalogs/apps/installer/fi.catkeys b/data/catalogs/apps/installer/fi.catkeys index 1874aa89aa..66cd1f949e 100644 --- a/data/catalogs/apps/installer/fi.catkeys +++ b/data/catalogs/apps/installer/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-Installer 2099988747 +1 finnish x-vnd.Haiku-Installer 3488795908 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp Joten lisää muiden valikkorivien alapuolelle tiedoston loppuun joitakin seuraavanlaisia rivejä:\n\n Are you sure you want to abort the installation and restart the system? InstallerWindow Oletko varma, että haluat keskeyttää asennuksen ja käynnistää järjestelmän uudelleen? \t}\n\n InstallerApp \t}\n\n @@ -12,6 +12,7 @@ With GRUB it's: (hdN,n)\n\n InstallerApp GRUB-ohjelmalla se on: (hdN,n)\n\n \tsudo update-grub\n\n\n InstallerApp \tsudo update-grub\n\n\n Stop InstallerWindow In alert after pressing Stop Pysäytä Install progress: InstallerWindow Asennuksen eteneminen: +2.2) GRUB 1\n InstallerApp 2.2) GRUB 1\n Starting Installation. InstallProgress Aloitetaan asennus. This is alpha-quality software! It means there is a high risk of losing important data. Make frequent backups! You have been warned.\n\n\n InstallerApp Tämä on alfa-laatuinen ohjelmisto! Se tarkoittaa, että on olemassa korkea riski menettää tärkeitä tietoja. Tee usein varmuuskopioita! Sinua on varoitettu.\n\n\n Are you sure you want to abort the installation? InstallerWindow Oletko varma, että haluat keskeyttää asentamisen? @@ -37,6 +38,7 @@ Boot sector successfully written. InstallProgress Alkulataussektori kirjoitetti Performing installation. InstallProgress Suoritetaan asennus. scanning… InstallerWindow etsitään… Set up boot menu InstallerWindow Aseta alkulatausvalikko +2.1) GRUB (since os-prober v1.44)\n InstallerApp 2.1) GRUB (sitten os-prober v1.44)\n The first logical partition always has the number \"4\", regardless of the number of primary partitions.\n\n InstallerApp Ensimmäisellä loogisella osiolla on numero ”4”, riippumatta ensisijaisten osioiden lukumäärästä.\n\n GRUB's naming scheme is still: (hdN,n)\n\n InstallerApp GRUB:in nimeämiskaava on yhä: (hdN,n)\n\n \tsudo /boot/grub/menu.lst\n\n InstallerApp \tsudo /boot/grub/menu.lst\n\n @@ -48,6 +50,7 @@ README InstallerApp LUEMINUT The destination disk may not have enough space. Try choosing a different disk or choose to not install optional items. InstallProgress Kohdelevyllä ei ehkä ole riittävästi tilaa. Yritä valita eri levy tai älä valitse valinnaisten alkioiden asentamista. Please close the Boot Manager and DriveSetup windows before closing the Installer window. InstallerWindow Sulje ensin Alkulataushallinta- ja Levyasema-asetusikkunat ennen asennusohjelman ikkunan sulkemista. Scanning for disks… InstallerWindow Etsitään levyjä… +2.3) GRUB 2\n InstallerApp 2.3) GRUB 2\n The disk can't be mounted. Please choose a different disk. InstallProgress Levyä ei voitu liittää. Valitse eri levy. ?? of ?? InstallerWindow Unknown progress ?? / ?? \tmenuentry \"Haiku Alpha\" {\n InstallerApp \tmenuentry ”Haiku Alfa” {\n @@ -67,6 +70,7 @@ Installer System name Asennusohjelma You can't install the contents of a disk onto itself. Please choose a different disk. InstallProgress Et voi asentaa levyn sisältö itseensä. Valitse eri levy. ??? InstallerWindow Unknown currently copied item ??? \"n\" is the partition number, which for GRUB 2 starts with \"1\"\n InstallerApp ”n” on osionumero, joka GRUB 2 -ohjelmassa alkaa numerosta ”1”\n +Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku should be recognized out of the box. To add Haiku to the GRUB menu, open a Terminal and enter:\n\n InstallerApp Alkaen os-prober-ohjelman versiosta v1.44 (esim.: Ubuntussa 11.04 tai myöhäisemmissä versioissa), Haiku-käyttöjärjestelmän tunnistaminen onnistuu ilman pulmia. Avaa Pääteikkuna Haikun lisäämiseksi GRUB-valikkoon ja kirjoita:\n\n Quit DriveSetup InstallerWindow Poistu Levyasema-asetuksista \"N\" is the hard disk number, starting with \"0\".\n InstallerApp ”N” on kiintolevynumero, alkaen numerosta ”0”.\n Hide optional packages InstallerWindow Piilota valinnaiset pakkaukset @@ -109,6 +113,7 @@ So below the heading that must not be edited, add something similar to these lin Are you sure you want to to stop the installation? InstallerWindow Oletko varma, että haluat pysäyttää asennuksen? Onto: InstallerWindow Kohteeseen: Please close the Boot Manager window before closing the Installer window. InstallerWindow Sulje Alkulataushallintaikkuna ennen Asennusohjelmaikkunan sulkemista. +3) When you successfully boot into Haiku for the first time, make sure to read our \"Welcome\" and \"Userguide\" documentation. There are links on the Desktop and in WebPositive's bookmarks.\n\n InstallerApp 3) Kun alkulataat Haikun onnistuneesti ensimmäisen kerran, lue varmuuden vuoksi \"Tervetuloa\" ja \"Käyttäjäopas\" -asiakirjamme. Niihin löytyy linkit työpöydältä ja WebPositive-selaimen kirjanmerkeistä.\n\n Tools InstallerWindow Työkalut The mount point could not be retrieved. InstallProgress Liittämispistettä ei voitu noutaa. The target volume is not empty. Are you sure you want to install anyway?\n\nNote: The 'system' folder will be a clean copy from the source volume, all other folders will be merged, whereas files and links that exist on both the source and target volume will be overwritten with the source volume version. InstallProgress Kohdetaltio ei ole tyhjä. Oletko varma, että haluat asentaa siitä huolimatta?\n\nHuomaa: ’system’-kansio on oleva puhdas kopio lähdetaltiolta, kaikki muut kansiot yhdistetään, kun taas tiedostot ja linkit, jotka esiintyvät sekä lähde- että kohdetaltiolla korvataan lähdetaltion versiolla. diff --git a/data/catalogs/apps/installer/pl.catkeys b/data/catalogs/apps/installer/pl.catkeys index a3eab6cd44..99982d524e 100644 --- a/data/catalogs/apps/installer/pl.catkeys +++ b/data/catalogs/apps/installer/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Installer 2099988747 +1 polish x-vnd.Haiku-Installer 2066726304 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp Więc za innymi wpisami na samym dole pliku, dodaj coś podobnego do tych linii:\n\n Are you sure you want to abort the installation and restart the system? InstallerWindow Na pewno chcesz przerwać instalację i uruchomić ponownie system? \t}\n\n InstallerApp \t}\n\n @@ -12,6 +12,7 @@ With GRUB it's: (hdN,n)\n\n InstallerApp Z GRUBem jest: (hdN,n)\n\n \tsudo update-grub\n\n\n InstallerApp \tsudo update-grub\n\n\n Stop InstallerWindow In alert after pressing Stop Zatrzymaj Install progress: InstallerWindow Postęp instalacji: +2.2) GRUB 1\n InstallerApp 2.2) GRUB 1\n Starting Installation. InstallProgress Rozpoczęcie instalacji. This is alpha-quality software! It means there is a high risk of losing important data. Make frequent backups! You have been warned.\n\n\n InstallerApp To wciąż oprogramowanie w wersji alpha! Oznacza to, że występuje wysokie ryzyko utraty danych. Rób częste kopie zapasowe! Zostałeś ostrzeżony.\n\n\n Are you sure you want to abort the installation? InstallerWindow Czy na pewno chcesz przerwać instalację? @@ -37,6 +38,7 @@ Boot sector successfully written. InstallProgress Sektor rozruchowy został pom Performing installation. InstallProgress Wykonywanie instalacji. scanning… InstallerWindow skanowanie… Set up boot menu InstallerWindow Konfiguruj menu rozruchu +2.1) GRUB (since os-prober v1.44)\n InstallerApp 2.1) GRUB (od os-prober v1.44)\n The first logical partition always has the number \"4\", regardless of the number of primary partitions.\n\n InstallerApp Pierwsza partycja logiczna ma zawsze numer \"4\", niezależnie od liczby partycji podstawowych.\n\n GRUB's naming scheme is still: (hdN,n)\n\n InstallerApp Sposób nazewnictwa GRUBa to wciąż: (hdN,n)\n\n \tsudo /boot/grub/menu.lst\n\n InstallerApp \tsudo /boot/grub/menu.lst\n\n @@ -48,6 +50,7 @@ README InstallerApp README The destination disk may not have enough space. Try choosing a different disk or choose to not install optional items. InstallProgress Dysk docelowy może nie mieć wystarczającej ilości wolnego miejsca. Proszę wybrać inny dysk lub odznaczyć pakiety dodatkowe. Please close the Boot Manager and DriveSetup windows before closing the Installer window. InstallerWindow Proszę zamknąć Menedżer Rozruchu i DriveSetup przed zamknięciem okna Instalatora. Scanning for disks… InstallerWindow Skanowanie w poszukiwaniu dysków… +2.3) GRUB 2\n InstallerApp 2.3) GRUB 2\n The disk can't be mounted. Please choose a different disk. InstallProgress Dysk nie może zostać zamontowany. Proszę spróbować wybrać inny dysk. ?? of ?? InstallerWindow Unknown progress ?? z ?? \tmenuentry \"Haiku Alpha\" {\n InstallerApp \tmenuentry \"Haiku Alpha\" {\n diff --git a/data/catalogs/apps/installer/ru.catkeys b/data/catalogs/apps/installer/ru.catkeys index 882cabdee1..251b4dbe1d 100644 --- a/data/catalogs/apps/installer/ru.catkeys +++ b/data/catalogs/apps/installer/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Installer 2099988747 +1 russian x-vnd.Haiku-Installer 3488795908 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp Поэтому в самом конце файла /boot/grub/menu.lst добавьте что-то вроде этого:\n\n Are you sure you want to abort the installation and restart the system? InstallerWindow Вы уверены, что хотите прервать установку и перезагрузить компьютер? \t}\n\n InstallerApp \t}\n\n @@ -12,6 +12,7 @@ With GRUB it's: (hdN,n)\n\n InstallerApp В GRUB это: (hdN,n)\n\n \tsudo update-grub\n\n\n InstallerApp \tsudo update-grub\n\n Stop InstallerWindow In alert after pressing Stop Остановить Install progress: InstallerWindow Прогресс установки: +2.2) GRUB 1\n InstallerApp 2.2) GRUB 1\n Starting Installation. InstallProgress Запуск установки. This is alpha-quality software! It means there is a high risk of losing important data. Make frequent backups! You have been warned.\n\n\n InstallerApp Это программное обеспечение пока еще находится в состоянии альфа качества! Это значит, что есть большой риск потери данных. Чаще делайте резервные копии! Мы вас предупредили.\n\n Are you sure you want to abort the installation? InstallerWindow Вы уверены, что хотите прервать установку @@ -37,6 +38,7 @@ Boot sector successfully written. InstallProgress Загрузочный сек Performing installation. InstallProgress Выполняется установка. scanning… InstallerWindow сканирование… Set up boot menu InstallerWindow Установить загрузочное меню +2.1) GRUB (since os-prober v1.44)\n InstallerApp 2.1) GRUB (начиная с os-prober v1.44)\n The first logical partition always has the number \"4\", regardless of the number of primary partitions.\n\n InstallerApp Первый логический (расширенный) раздел всегда имеет номер \"4\", вне зависимости от количества первичных разделов.\n\n GRUB's naming scheme is still: (hdN,n)\n\n InstallerApp Схема именования GRUB по-прежнему такая: (hdN,n)\n\n \tsudo /boot/grub/menu.lst\n\n InstallerApp \tsudo <ваш текстовый редактор> /boot/grub/menu.lst\n\n @@ -48,6 +50,7 @@ README InstallerApp Cопроводительная инструкция The destination disk may not have enough space. Try choosing a different disk or choose to not install optional items. InstallProgress На выбранном диске недостаточно места. Попробуйте выбрать другой диск или не устанавливайте опциональные пакеты. Please close the Boot Manager and DriveSetup windows before closing the Installer window. InstallerWindow Пожалуйста, закройте Менеджер загрузки и Разметки диска перед закрытием окна установщика. Scanning for disks… InstallerWindow Сканирование дисков… +2.3) GRUB 2\n InstallerApp 2.3) GRUB 2\n The disk can't be mounted. Please choose a different disk. InstallProgress Диск не может быть подключен. Пожалуйста, выберите другой диск. ?? of ?? InstallerWindow Unknown progress ?? из ?? \tmenuentry \"Haiku Alpha\" {\n InstallerApp \tmenuentry \"Haiku Alpha\" {\n @@ -67,6 +70,7 @@ Installer System name Установщик You can't install the contents of a disk onto itself. Please choose a different disk. InstallProgress Вы не можете установить содержимое диска на тот же самый диск. Пожалуйста, выберите другой диск. ??? InstallerWindow Unknown currently copied item ??? \"n\" is the partition number, which for GRUB 2 starts with \"1\"\n InstallerApp \"n\" это номер раздела, который в GRUB 2 начинается с \"1\"\n +Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku should be recognized out of the box. To add Haiku to the GRUB menu, open a Terminal and enter:\n\n InstallerApp Начиная с os-prober v1.44 (т.е. в Ubuntu 11.04 и старше), Haiku должна распознаваться из коробки. Чтобы добавить Haiku в меню GRUB, откройте Терминал и введите:\n\n Quit DriveSetup InstallerWindow Закройте Разметку диска \"N\" is the hard disk number, starting with \"0\".\n InstallerApp \"N\" это номер жесткого диска, начинающийся с \"0\".\n\ Hide optional packages InstallerWindow Скрыть опциональные пакеты @@ -109,6 +113,7 @@ So below the heading that must not be edited, add something similar to these lin Are you sure you want to to stop the installation? InstallerWindow Вы уверены, что хотите прервать установку? Onto: InstallerWindow На диск: Please close the Boot Manager window before closing the Installer window. InstallerWindow Пожалуйста, закройте Менеджер Загрузки перед закрытием окна установщика. +3) When you successfully boot into Haiku for the first time, make sure to read our \"Welcome\" and \"Userguide\" documentation. There are links on the Desktop and in WebPositive's bookmarks.\n\n InstallerApp 3) Когда вы первый раз успешно загрузитесь в установленную Haiku, не забудьте прочесть нашу документацию, доступную в файлах \"Welcome\" и \"Userguide\". Ссылки на них находятся на рабочем столе и в закладках WebPositive.\n Tools InstallerWindow Инструменты The mount point could not be retrieved. InstallProgress Невозможно определить точку подключения. The target volume is not empty. Are you sure you want to install anyway?\n\nNote: The 'system' folder will be a clean copy from the source volume, all other folders will be merged, whereas files and links that exist on both the source and target volume will be overwritten with the source volume version. InstallProgress Выбранный диск не является пустым.\nВы уверены, что хотите продолжить?\n\nВнимание: Папка 'system' будет полностью перезаписана, все остальные папки будут объединены, а файлы и папки, которые существуют на обоих носителях будут перезаписаны с установочного диска. diff --git a/data/catalogs/apps/launchbox/ru.catkeys b/data/catalogs/apps/launchbox/ru.catkeys index db77ce9fef..d5ca531019 100644 --- a/data/catalogs/apps/launchbox/ru.catkeys +++ b/data/catalogs/apps/launchbox/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-LaunchBox 4192523522 +1 russian x-vnd.Haiku-LaunchBox 3016105370 New LaunchBox Создать Set description… LaunchBox Изменить описание… Vertical layout LaunchBox Расположить вертикально @@ -24,6 +24,7 @@ Name Panel LaunchBox Название панели Add button here LaunchBox Добавить кнопку Description for '%3' LaunchBox Описание для '%3' Settings LaunchBox Настройки +Failed to launch 'something', error in Pad data. LaunchBox Не удалось запустить 'something', ошибка в данных панели. Pad %1 LaunchBox Панель %1 Close LaunchBox Закрыть Failed to send 'open folder' command to Tracker.\n\nError: LaunchBox Не удалось послать команду "открыть папку" в Tracker.\n\nОшибка: diff --git a/data/catalogs/apps/mail/ru.catkeys b/data/catalogs/apps/mail/ru.catkeys index 3f0583a0aa..8dd6e6dff6 100644 --- a/data/catalogs/apps/mail/ru.catkeys +++ b/data/catalogs/apps/mail/ru.catkeys @@ -1,10 +1,11 @@ -1 russian x-vnd.Be-MAIL 1799353819 +1 russian x-vnd.Be-MAIL 2834665561 View Mail Вид %d - Date Mail %d - Дата Attach attributes: Mail Прикрепление атрибутов: Inconsistency occurred in the undo/redo buffer. Mail Произошло несоответствие в буфере отмены/повтора. An error occurred trying to save the attachment. Mail Произошла ошибка при попытке сохранить вложение. Copy to new Mail Копировать в новое +Leave as 'New' Mail Do not translate New - this is non-localizable e-mail status Оставить как 'New' Edit Mail Изменить Print Mail Печать Mail <пусто> @@ -62,12 +63,15 @@ Print… Mail Печать… Warn unencodable: Mail Предупреждать о невозможности декодировать: Quit Mail Выход %n - Full name Mail %n - Полное имя + Read Mail Прочитанным +UTF-8 Mail This string is used as a key to set default message compose encoding. It must be correct IANA name from http://cgit.haiku-os.org/haiku/tree/src/kits/textencoding/character_sets.cpp Translate it only if you want to change default message compose encoding for your locale. If you don't know what is it and why it may needs changing, just leave \"UTF-8\". UTF-8 Trash Mail Корзина Default account: Mail Аккаунт по умолчанию: Size: Mail Размер: Account from mail Mail Использовать аккаунт из письма Edit signatures… Mail Изменить подписи… New Mail Новое +Attachments: Mail Вложения: On Mail Включить Set to %s Mail Пометить как %s Forward Mail Переслать diff --git a/data/catalogs/apps/mediaconverter/ru.catkeys b/data/catalogs/apps/mediaconverter/ru.catkeys index a9ae414112..d530837aef 100644 --- a/data/catalogs/apps/mediaconverter/ru.catkeys +++ b/data/catalogs/apps/mediaconverter/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-MediaConverter 3564609505 +1 russian x-vnd.Haiku-MediaConverter 296071315 Video using parameters form settings MediaConverter Видео использует параметры из настроек Video encoding: MediaConverter Кодирование видео: No audio Audio codecs list Без аудио @@ -21,6 +21,7 @@ Low MediaConverter Низкое Conversion completed MediaConverter Конвертация завершена Audio: MediaConverter-FileInfo Аудио: OK MediaConverter-FileInfo ОК + seconds MediaFileInfo секунд Source files MediaConverter Исходящие файлы Cancelling MediaConverter Отменяется %d byte MediaFileInfo %d байт diff --git a/data/catalogs/apps/mediaplayer/fi.catkeys b/data/catalogs/apps/mediaplayer/fi.catkeys index 18527bef0e..8fc63e2c94 100644 --- a/data/catalogs/apps/mediaplayer/fi.catkeys +++ b/data/catalogs/apps/mediaplayer/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-MediaPlayer 607764928 +1 finnish x-vnd.Haiku-MediaPlayer 2389197979 raw audio MediaPlayer-InfoWin raakaääni Location MediaPlayer-InfoWin Sijainti 1.85 : 1 (American) MediaPlayer-Main 1.85 : 1 (amerikkalainen) @@ -70,6 +70,7 @@ Select all MediaPlayer-PlaylistWindow Valitse kaikki Move Entry MediaPlayer-MovePLItemsCmd Siirrä kappale Open MediaPlayer-PlaylistWindow Avaa Stop playing. MediaPlayer-Main Lopeta soittaminen. +The file '%filename' could not be opened.\n\n MediaPlayer-Main Tiedostoa ’%filename’ ei voitu avata.\n\n Error: MediaPlayer-RemovePLItemsCmd Virhe: Audio MediaPlayer-InfoWin Ääni Internal error (malformed message). Saving the playlist failed. MediaPlayer-PlaylistWindow Sisäinen virhe (vääränmuotoinen viesti). Soittoluettelon tallentaminen epäonnistui. diff --git a/data/catalogs/apps/mediaplayer/pl.catkeys b/data/catalogs/apps/mediaplayer/pl.catkeys index c01dd1af6b..efb1654132 100644 --- a/data/catalogs/apps/mediaplayer/pl.catkeys +++ b/data/catalogs/apps/mediaplayer/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-MediaPlayer 607764928 +1 polish x-vnd.Haiku-MediaPlayer 2389197979 raw audio MediaPlayer-InfoWin czysty dźwięk Location MediaPlayer-InfoWin Położenie 1.85 : 1 (American) MediaPlayer-Main 1.85 : 1 (amerykańskie) @@ -70,6 +70,7 @@ Select all MediaPlayer-PlaylistWindow Zaznacz wszystko Move Entry MediaPlayer-MovePLItemsCmd Przeniesienie wpisu Open MediaPlayer-PlaylistWindow Otwórz Stop playing. MediaPlayer-Main Zatrzymaj odtwarzanie. +The file '%filename' could not be opened.\n\n MediaPlayer-Main Plik '%filename' nie może być otwarty.\n\n Error: MediaPlayer-RemovePLItemsCmd Błąd: Audio MediaPlayer-InfoWin Dźwięk Internal error (malformed message). Saving the playlist failed. MediaPlayer-PlaylistWindow Błąd wewnętrzny (nieprawidłowa wiadomość). Zapisywanie listy odtwarzania nie powiodło się. diff --git a/data/catalogs/apps/mediaplayer/ru.catkeys b/data/catalogs/apps/mediaplayer/ru.catkeys index 8c078991b7..b954583d64 100644 --- a/data/catalogs/apps/mediaplayer/ru.catkeys +++ b/data/catalogs/apps/mediaplayer/ru.catkeys @@ -1,13 +1,19 @@ -1 russian x-vnd.Haiku-MediaPlayer 4123753294 +1 russian x-vnd.Haiku-MediaPlayer 3699683348 +raw audio MediaPlayer-InfoWin raw аудио +Location MediaPlayer-InfoWin Путь 1.85 : 1 (American) MediaPlayer-Main 1.85 : 1 (Американский) +%d kHz MediaPlayer-InfoWin %d кГц Stream settings MediaPlayer-Main Настройки потока PlaylistItem-album <неизвестно> Scale controls in full screen mode MediaPlayer-SettingsWindow Масштабировать кнопки управления в полноэкранном режиме Video MediaPlayer-InfoWin Видео Subtitle size: MediaPlayer-SettingsWindow Размер субтитров: Save Playlist MediaPlayer-PlaylistWindow Сохранить плейлист + MediaPlayer-InfoWin <нет данных> +(not supported) MediaPlayer-InfoWin (не поддерживается) None of the files you wanted to play appear to be media files. MediaPlayer-Main Ни один из файлов, которые вы хотели проиграть, не является медиа файлом. Saving the playlist failed.\n\nError: MediaPlayer-PlaylistWindow Ошибка сохранения плейлиста.\n\nОшибка: +%.3f kHz MediaPlayer-InfoWin %.3f кГц New player… MediaPlayer-Main Новый плеер… 100% scale MediaPlayer-Main Масштаб 100% Subtitle placement: MediaPlayer-SettingsWindow Расположение субтитров: @@ -32,8 +38,10 @@ Close window after playing audio MediaPlayer-SettingsWindow Закрыть ок Full volume MediaPlayer-SettingsWindow На полной громкости Drop files to play MediaPlayer-Main Перетащите файлы для проигрывания TogglePlaying MediaPlayer-Main Переключить воспроизведение +Copyright MediaPlayer-InfoWin Авторские права Cancel MediaPlayer-SettingsWindow Отмена Loop audio MediaPlayer-SettingsWindow Зацикливать аудио +Container MediaPlayer-InfoWin Контейнер Nothing to Play MediaPlayer-Main Нечего проигрывать Muted MediaPlayer-SettingsWindow Без звука Quit MediaPlayer-Main Выход @@ -90,6 +98,7 @@ Play MediaPlayer-Main Играть Remove Entries into Trash MediaPlayer-RemovePLItemsCmd Удалить записи в корзину 200% scale MediaPlayer-Main Масштаб 200% It appears the media server is not running.\nWould you like to start it ? MediaPlayer-Main Похоже, что медиа сервер не запущен\nВы хотите его запустить? +Duration MediaPlayer-InfoWin Длительность Aspect ratio MediaPlayer-Main Соотношение сторон Error: MediaPlayer-Main Ошибка: Large MediaPlayer-SettingsWindow крупный @@ -104,6 +113,7 @@ Move file to Trash MediaPlayer-PlaylistWindow Переместить в кор URI MediaPlayer-Main URI Mute MediaPlayer-Main Выключить звук Toggle pause/play. MediaPlayer-Main Переключить паузу/проигрывание. +min MediaPlayer-InfoWin Minutes мин Small MediaPlayer-SettingsWindow маленький Randomize MediaPlayer-PlaylistWindow Перемешать Off Subtitles menu Выключить @@ -125,7 +135,10 @@ Always on top MediaPlayer-Main Всегда сверху Remove Entry into Trash MediaPlayer-RemovePLItemsCmd Переместить запись в корзину Save MediaPlayer-Main Сохранить MediaPlayer-PlaylistWindow <нечего отменять> +Mono MediaPlayer-InfoWin Моно +File info MediaPlayer-InfoWin Информация о файле Save MediaPlayer-PlaylistWindow Сохранить +%d Bit MediaPlayer-InfoWin %d Бит Remove MediaPlayer-PlaylistWindow Удалить Full screen MediaPlayer-Main На весь экран Open file… MediaPlayer-Main Открыть файл… diff --git a/data/catalogs/apps/networkstatus/ru.catkeys b/data/catalogs/apps/networkstatus/ru.catkeys index 879bbc90de..96193b0a09 100644 --- a/data/catalogs/apps/networkstatus/ru.catkeys +++ b/data/catalogs/apps/networkstatus/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-NetworkStatus 853756860 +1 russian x-vnd.Haiku-NetworkStatus 2931949650 NetworkStatus options:\n\t--deskbar\tautomatically add replicant to Deskbar\n\t--help\t\tprint this info and exit\n NetworkStatus NetworkStatus опции:\n\t--deskbar\tавтоматически добавить репликант в Deskbar\n\t--help\t\tвывести этот текст и выйти\n You can run NetworkStatus in a window or install it in the Deskbar. NetworkStatus Вы можете запустить состояние сети в окне или установить его в Deskbar. NetworkStatusView <беспроводные сети не обнаружены> @@ -10,6 +10,7 @@ NetworkStatus\n\twritten by %1 and Hugo Santos\n\t%2, Haiku, Inc.\n NetworkStatu Netmask NetworkStatusView Маска подсети Broadcast NetworkStatusView Широковещательный Unknown NetworkStatusView Неизвестно +Network Status NetworkStatusView Статус сети Ready NetworkStatusView Подключен No stateful configuration NetworkStatusView Нет полноценной конфигурации %ifaceName information:\n NetworkStatusView Информация о %ifaceName:\n diff --git a/data/catalogs/apps/poorman/ru.catkeys b/data/catalogs/apps/poorman/ru.catkeys index 194081c543..a3eaacf3d8 100644 --- a/data/catalogs/apps/poorman/ru.catkeys +++ b/data/catalogs/apps/poorman/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-PoorMan 995747556 +1 russian x-vnd.Haiku-PoorMan 1267330937 Website location PoorMan Расположение сайта Error Server PoorMan Ошибка сервера Settings… PoorMan Настройки… @@ -8,7 +8,7 @@ Hits: %lu PoorMan Посещений: %lu Web folder: PoorMan Веб-папка: Default PoorMan По умолчанию Save log console selection PoorMan Сохранить выделенную часть лога консоли -Run server PoorMan Запустиь сервер +Run server PoorMan Запустить сервер PoorMan settings PoorMan Настройки PoorMan Clear hit counter PoorMan Очистить счетчик посещений Copy PoorMan Копировать @@ -24,13 +24,17 @@ Advanced PoorMan Дополнительно OK PoorMan ОК Status: Stopped PoorMan Статус: остановлен Dir Created PoorMan Создана директория +Log to file PoorMan Сохранять лог в файл Quit PoorMan Выход Hits: 0 PoorMan Посещений: 0 Save log console PoorMan Сохранить лог консоли Edit PoorMan Изменить +Create Log File PoorMan Создать лог файл +Log to console PoorMan Выводить лог в консоль Directory: (none) PoorMan Директория: (отсутствует) Please choose the folder to publish on the web.\n\nYou can have PoorMan create a default \"public_html\" in your home folder.\nOr you select one of your own folders instead. PoorMan Пожалуйста, выберите папку для публикации.\n\nPoorMan может создать папку по умолчанию public_html в вашей домашней папке.\nИли вы можете выбрать любую другую папку. Log To Console PoorMan Выводить лог в консоль +Connections PoorMan Соединения Status: Running PoorMan Статус: работает connections PoorMan соединения Controls PoorMan Управление @@ -38,6 +42,7 @@ Send file listing if there's no start page PoorMan Отобразить спи Error Dir PoorMan Ошибка директории Select all PoorMan Выделить всё File PoorMan Файл +File Logging PoorMan Логирование в файл Save console selections as… PoorMan Сохранить выделение консоли как… File logging PoorMan Логирование в файл Select web folder PoorMan Выбрать папку для публикации @@ -53,6 +58,7 @@ Create log file PoorMan Создать лог файл… Starting up... PoorMan Запуск... Site PoorMan Сайт Cancel PoorMan Отмена +Console logging PoorMan Логирование в консоль Cannot start the server PoorMan Не удалось запустить сервер Select PoorMan Выбрать Save console as… PoorMan Сохранить содержимое консоли как… diff --git a/data/catalogs/apps/powerstatus/ru.catkeys b/data/catalogs/apps/powerstatus/ru.catkeys index 584095f948..04f11c3c68 100644 --- a/data/catalogs/apps/powerstatus/ru.catkeys +++ b/data/catalogs/apps/powerstatus/ru.catkeys @@ -1,26 +1,31 @@ -1 russian x-vnd.Haiku-PowerStatus 751886234 +1 russian x-vnd.Haiku-PowerStatus 3419486861 Design capacity low warning: PowerStatus Уровень полного разряда: Show percent PowerStatus Показать в процентах Design capacity: PowerStatus Штатная емкость: + mW PowerStatus мВт Type: PowerStatus Тип: non-rechargeable PowerStatus неперезаряжаемая Empty battery slot PowerStatus Пустой слот батареи + mV PowerStatus мВ Run in window PowerStatus Запустить в окне About PowerStatus О программе PowerStatus System name Электропитание PowerStatus PowerStatus Электропитание + mWh PowerStatus мВтч Battery info… PowerStatus Информация о батарее… Damaged battery PowerStatus Поврежденная батарея Show time PowerStatus Показать время Last full charge: PowerStatus Последняя полная зарядка: Battery unused PowerStatus Батарея не используется Extended battery info PowerStatus Расширенная информация о батарее + mA PowerStatus мА Current rate: PowerStatus Текущее значение: discharging PowerStatus разрядка Show text label PowerStatus Показать текстовую метку About… PowerStatus О программе… Model number: PowerStatus Номер модели: Install in Deskbar PowerStatus Установить в Deskbar + mAh PowerStatus мАч Capacity: PowerStatus Емкость: Battery discharging PowerStatus Батарея разряжается Serial number: PowerStatus Серийный номер: diff --git a/data/catalogs/apps/screenshot/Screenshot/ru.catkeys b/data/catalogs/apps/screenshot/Screenshot/ru.catkeys index c91a8fa7d1..f464645691 100644 --- a/data/catalogs/apps/screenshot/Screenshot/ru.catkeys +++ b/data/catalogs/apps/screenshot/Screenshot/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.haiku-screenshot 1697748405 +1 russian x-vnd.haiku-screenshot 1721618877 seconds ScreenshotWindow секунд Desktop ScreenshotWindow Рабочий стол Include window border ScreenshotWindow Включая заголовок окна @@ -9,6 +9,7 @@ Cancel ScreenshotWindow Отмена Name: ScreenshotWindow Имя: Choose folder ScreenshotWindow Выбрать папку Save ScreenshotWindow Сохранить +Overwrite ScreenshotWindow Перезаписать Choose folder... ScreenshotWindow Выбрать папку… Please select ScreenshotWindow Пожалуйста выберите Save as: ScreenshotWindow Сохранить как: diff --git a/data/catalogs/apps/soundrecorder/ru.catkeys b/data/catalogs/apps/soundrecorder/ru.catkeys index db66c238ea..98f09a4f25 100644 --- a/data/catalogs/apps/soundrecorder/ru.catkeys +++ b/data/catalogs/apps/soundrecorder/ru.catkeys @@ -1,16 +1,22 @@ -1 russian x-vnd.Haiku-SoundRecorder 4189888707 +1 russian x-vnd.Haiku-SoundRecorder 2149017672 Loop RecorderWindow Закольцевать Cannot find default audio hardware RecorderWindow Не найдено аудио оборудование Cannot find the temporary file created to hold the new recording RecorderWindow Не найден временный файл, созданный для хранения новой записи +Sample size: RecorderWindow Размер сэмпла: Nothing to play RecorderWindow Нечего играть +Duration: RecorderWindow Продолжительность: Some of the files don't appear to be audio files RecorderWindow Некоторые из файлов не являются аудио файлами File info RecorderWindow Информация о файле: Drop files here SoundListView Перенесите сюда файлы Input RecorderWindow Вход Stop RecorderWindow Стоп +Format: RecorderWindow Формат: Sound List RecorderWindow Список звуков +Compression: RecorderWindow Сжатие: Rewind RecorderWindow Перемотка +Sample rate: RecorderWindow Частота дискретизации: Invalid audio files RecorderWindow Неверные аудио файлы + seconds RecorderWindow секунд OK RecorderWindow ОК Cannot open the temporary file created to hold the new recording RecorderWindow Невозможно открыть временный файл, созданный для хранения новой записи None of the files appear to be audio files RecorderWindow Ни один из файлов не является файлом аудио @@ -18,11 +24,14 @@ Input: RecorderWindow Звуковой вход: Forward RecorderWindow Вперед Play RecorderWindow Играть SoundRecorder System name Звукозапись +Channels: RecorderWindow Каналы: + bits RecorderWindow бит None RecorderWindow Нет Record RecorderWindow Запись Sample size: RecorderWindow Размер сэмпла: Cannot recognize this file as a media file RecorderWindow Не удается распознать файл как файл медиа Format: RecorderWindow Формат: +File name: RecorderWindow Имя файла: Cannot connect to the selected sound input RecorderWindow Невозможно подключиться к выбранному звуковому входу Cannot get the file to play RecorderWindow Невозможно воспроизвести файл Cannot record a sound that long RecorderWindow Невозможно записать звук такой длины diff --git a/data/catalogs/apps/terminal/ru.catkeys b/data/catalogs/apps/terminal/ru.catkeys index 881da764ed..f814e5e638 100644 --- a/data/catalogs/apps/terminal/ru.catkeys +++ b/data/catalogs/apps/terminal/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Terminal 516768360 +1 russian x-vnd.Haiku-Terminal 1054657081 Not found. Terminal TermWindow Текст не найден Switch Terminals Terminal TermWindow Переключить терминалы Change directory Terminal TermView Сменить каталог @@ -38,6 +38,7 @@ Color schema: Terminal AppearancePrefView Цветовая схема: OK Terminal SetTitleWindow ОК Background Terminal AppearancePrefView Фона Use selection Terminal FindWindow Использовать выделенный текст +Green on Black Terminal colors schema Зелёный на чёрном The process \"%1\" is still running.\nIf you close the tab, the process will be killed. Terminal TermWindow Процесс \"%1\" все еще работает.\nЕсли вы закроете вкладку, то этот процесс будет уничтожен. Size: Terminal AppearancePrefView Размер: Cannot execute \"%command\":\n\t%error Terminal Shell Невозможно выполнить \"%command\":\n\t%error diff --git a/data/catalogs/apps/workspaces/ru.catkeys b/data/catalogs/apps/workspaces/ru.catkeys index e1b117f3c0..09082e80ef 100644 --- a/data/catalogs/apps/workspaces/ru.catkeys +++ b/data/catalogs/apps/workspaces/ru.catkeys @@ -1,12 +1,14 @@ -1 russian x-vnd.Be-WORK 932379173 +1 russian x-vnd.Be-WORK 4170489135 Invalid argument: %s\n Workspaces Неверный аргумент: %s\n Quit Workspaces Выход Workspaces System name Рабочие столы Change workspace count… Workspaces Изменить количество столов… +Remove replicant Workspaces Удалить репликант About Workspaces… Workspaces О программе… Workspaces\nwritten by %1, and %2.\n\nCopyright %3, Haiku.\n\nSend windows behind using the Option key. Move windows to front using the Control key.\n Workspaces Workspaces\n\nразработал %1 и %2.\n\nCopyright %3, Haiku.\n\nДля отправки окна в фон используйте клавишу Windows.\nДля активации окна используйте клавишу Ctrl.\n Show window border Workspaces Показывать рамку окна Auto-raise Workspaces Всплывать при наведении OK Workspaces ОК Always on top Workspaces Всегда сверху +Live in the Deskbar Workspaces Жить в Deskbar Show window tab Workspaces Показывать заголовок окна diff --git a/data/catalogs/kits/tracker/be.catkeys b/data/catalogs/kits/tracker/be.catkeys index 7990517ef1..83f354aa16 100644 --- a/data/catalogs/kits/tracker/be.catkeys +++ b/data/catalogs/kits/tracker/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-libtracker 3695303004 +1 belarusian x-vnd.Haiku-libtracker 3778030996 common B_COMMON_DIRECTORY агульны OK WidgetAttributeText ОК Icon view VolumeWindow Від іконак @@ -171,7 +171,6 @@ Edit favorites… FilePanelPriv Правіць Выбранае... Create relative link ContainerWindow Стварыць адносную спасылку Copy ContainerWindow Капіяваць Size PoseView Памер -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction хатні каталог, %osName можа паводзіць сябе неадэкватна! Вы ўпэўнены што жадаеце зрабіць гэта? Каб %toDoAction хатні каталог, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". Location OpenWithWindow Месцазнаходжанне Force identify ContainerWindow ідэнтыфікаваць прымусова Duplicate ContainerWindow Дуплікаваць @@ -195,7 +194,6 @@ New DeskWindow Новы Open InfoWindow Адкрыць 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Замяніць усё -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Праграма \"%appname\" не падтрымлівае тып дакументу які вы жадаеце адкрыць. Сапраўды жадаеце пряцягваць? Калі вы упэўнены, што праграма сумяшчальна з гэтым тыпам файлаў, паведаміце пра гэта аўтарам праграмы і папрасіце дакументаваць гэта ў новай версіі. Preparing to restore items… StatusWindow Падрыхтоўка да аднаўлення элементаў... Replace other file WidgetAttributeText Замяніць іншы файл Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Некаторыя з выбраных элементаў нельга адправіць у Сметніцу. Жадаеце выдаліць іх беззваротна? @@ -220,7 +218,6 @@ Name PoseView Імя Group FilePermissionsView Група Version: InfoWindow Версія: Created: InfoWindow Створана: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction наладкі mime, %osName можа паводзіць сябе неадэкватна! Вы ўпэўнены што жадаеце зрабіць гэта? Каб %toDoAction наладкі mime, клікніце \"%toConfirmAction\". \nShould this be fixed? FSUtils \nЦі трэба гэта паправіць? Copying: StatusWindow Капіяванне: Capacity: InfoWindow Ёмістасць: @@ -280,7 +277,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Перайме Paused: click to resume or stop StatusWindow Паўза: клікніце, каб працягваць або спыніцца Preferred for %type OpenWithWindow Пажаданая для %type GiB WidgetAttributeText ГіБ -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction агульны каталог, %osName можа паводзіць сябе неадэкватна! Вы ўпэўнены што жадаеце зрабіць гэта? Каб %toDoAction агульны каталог, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". There was an error deleting \"%name\":\n\t%error FSUtils Адбылася памылка пры выдаленні \"%name\":\n\t%error Paste FilePanelPriv Уставіць Copy more ContainerWindow Капіяваць яшчэ @@ -407,7 +403,6 @@ Select… FilePanelPriv Выбраць... Don't move files to Trash SettingsView Не перамяшчаць файлы ў Сметніцу There was an error resolving the link. Tracker Адбылася памылка пры разборы спасылкі. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction сістэмны каталог або яго змеціва, вы не зможаце запусціць %osName! Вы ўпэўнены што жадаеце зрабіць гэта? Каб %toDoAction сістэмны каталог, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". You can't move or copy the trash. FSUtils Вы не можаце перамяшчаць ці капіяваць у Сметніцу. ends with SelectionWindow заканчваецца на Volume icons TrackerSettingsWindow Іконкі тамоў @@ -429,7 +424,6 @@ Modified ContainerWindow Зменены Edit Query template FindPanel Правіць шаблон Запыту Prompt FSUtils Падказка Edit query ContainerWindow Правіць запыт -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction каталог канфігурацыі, %osName можа паводзіць сябе неадэкватна! Вы ўпэўнены што жадаеце зрабіць гэта? Каб %toDoAction каталог канфігурацыі, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". Find… ContainerWindow Знайсці... Create a Query FindPanel Стварыць Запыт Move to Trash FSUtils Адправіць у Сметніцу @@ -448,7 +442,6 @@ Mount ContainerWindow Змантаваць %capacity (%used used -- %free free) InfoWindow %capacity (%used выкарыстана -- %free свабодна) Cancel FSClipBoard Адмена Cut more ContainerWindow Выразаць яшчэ -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction каталог наладак, %osName можа паводзіць сябе неадэкватна! Вы ўпэўнены што жадаеце зрабіць гэта? Каб %toDoAction каталог наладак, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". Deleting: StatusWindow Выдаляецца: Empty Trash InfoWindow Ачысціць сметніцу Add FindPanel Дадаць diff --git a/data/catalogs/kits/tracker/de.catkeys b/data/catalogs/kits/tracker/de.catkeys index 417ee0aad8..cfd16dc7ab 100644 --- a/data/catalogs/kits/tracker/de.catkeys +++ b/data/catalogs/kits/tracker/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-libtracker 3695303004 +1 german x-vnd.Haiku-libtracker 3778030996 common B_COMMON_DIRECTORY Allgemein OK WidgetAttributeText OK Icon view VolumeWindow Icon-Ansicht @@ -171,7 +171,6 @@ Edit favorites… FilePanelPriv Favoriten bearbeiten… Create relative link ContainerWindow Relative Verknüpfung erstellen Copy ContainerWindow Kopieren Size PoseView Größe -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Wird der Benutzer-Ordner %ifYouDoAction, kann %osName vielleicht nicht mehr fehlerfrei arbeiten. Um ihn und seine Inhalte dennoch %toDoAction, Shift-Taste gedrückt halten und \"%toConfirmAction\" klicken. Location OpenWithWindow Ort Force identify ContainerWindow Identifizierung erzwingen Duplicate ContainerWindow Duplizieren @@ -195,7 +194,6 @@ New DeskWindow Neu Open InfoWindow Öffnen 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Alle ersetzen -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Die Anwendung \"%appname\" unterstützt den Typ des zu öffnenden Dokuments nicht. Soll dennoch fortgefahren werden? Wenn die Anwendung den Typ eigentlich unterstützen müsste, sollte deren Autor gebeten werden, diesen Typ zur Liste der unterstützten Dokumente hinzuzufügen. Preparing to restore items… StatusWindow Wiederherstellen wird vorbereitet… Replace other file WidgetAttributeText Andere Datei ersetzen Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Einige der ausgewählten Objekte können nicht in den Papierkorb verschoben werden. Sollen sie stattdessen gelöscht werden? (Diese Aktion kann nicht rückgängig gemacht werden.) @@ -220,7 +218,6 @@ Name PoseView Name Group FilePermissionsView Gruppe Version: InfoWindow Version: Created: InfoWindow Erstellt: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Wird der MIME-Ordner %ifYouDoAction, kann %osName vielleicht nicht mehr fehlerfrei arbeiten! Um ihn dennoch %toDoAction, \"%toConfirmAction\" klicken. \nShould this be fixed? FSUtils \nSoll das behoben werden? Copying: StatusWindow Kopieren: Capacity: InfoWindow Kapazität: @@ -280,7 +277,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Umbenennen Paused: click to resume or stop StatusWindow Pausiert: Klicken zum Fortfahren oder Abbrechen Preferred for %type OpenWithWindow Bevorzugt für %type GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Wird der Allgemein-Ordner %ifYouDoAction, kann %osName vielleicht nicht mehr fehlerfrei arbeiten! Um ihn dennoch %toDoAction, Shift-Taste gedrückt halten und \"%toConfirmAction\" klicken. There was an error deleting \"%name\":\n\t%error FSUtils Fehler beim Löschen von \"%name\":\n\t%error Paste FilePanelPriv Einfügen Copy more ContainerWindow Mehr kopieren @@ -407,7 +403,6 @@ Select… FilePanelPriv Auswählen… Don't move files to Trash SettingsView Dateien nicht in den Papierkorb verschieben There was an error resolving the link. Tracker Fehler beim Auflösen der Verknüpfung. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Der System-Ordner oder seine Inhalte sollen %ifYouDoAction werden. Dadurch kann %osName nicht mehr gestartet werden! Um ihn oder seine Inhalte dennoch %toDoAction, Shift-Taste gedrückt halten und \"%toConfirmAction\" klicken. You can't move or copy the trash. FSUtils Der Papierkorb kann nicht verschoben oder kopiert werden. ends with SelectionWindow endet mit Volume icons TrackerSettingsWindow Datenträger-Icons @@ -429,7 +424,6 @@ Modified ContainerWindow Geändert Edit Query template FindPanel Query-Vorlage bearbeiten Prompt FSUtils Nachfragen Edit query ContainerWindow Query bearbeiten -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Wird der Konfigurations-Ordner %ifYouDoAction, kann %osName vielleicht nicht mehr fehlerfrei arbeiten! Um ihn dennoch %toDoAction, \"%toConfirmAction\" klicken. Find… ContainerWindow Suchen… Create a Query FindPanel Query erstellen Move to Trash FSUtils In Papierkorb verschieben @@ -448,7 +442,6 @@ Mount ContainerWindow Einhängen %capacity (%used used -- %free free) InfoWindow %capacity (%used benutzt -- %free frei) Cancel FSClipBoard Abbrechen Cut more ContainerWindow Mehr ausschneiden -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Wird der Settings-Ordner %ifYouDoAction, kann %osName vielleicht nicht mehr fehlerfrei arbeiten! Um ihn dennoch %toDoAction, \"%toConfirmAction\" klicken. Deleting: StatusWindow Löschen: Empty Trash InfoWindow Papierkorb leeren Add FindPanel Hinzu diff --git a/data/catalogs/kits/tracker/el.catkeys b/data/catalogs/kits/tracker/el.catkeys index 92dc7530a3..b5cb48949d 100644 --- a/data/catalogs/kits/tracker/el.catkeys +++ b/data/catalogs/kits/tracker/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-libtracker 859055013 +1 greek, modern (1453-) x-vnd.Haiku-libtracker 2160148895 common B_COMMON_DIRECTORY κοινό OK WidgetAttributeText Εντάξει Icon view VolumeWindow Προβολή εικονιδίου @@ -165,7 +165,6 @@ Edit favorites… FilePanelPriv Επεξεργασία αγαπημένων... Create relative link ContainerWindow Δημιουργία συγγενικού συνδέσμου Copy ContainerWindow Αντιγραφή Size PoseView Μέγεθος -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Εάν %ifYouDoAction στον αρχικό κατάλογο, το %osName μπορεί να μην συμπεριφερθεί σωστά! Είστε βέβαιος ότι θέλετε να το κάνετε αυτό; Για να %toDoAction στον αρχικό κατάλογο ούτως ή άλλως, κρατήστε πατημένο το πλήκτρο Shift και κάντε κλικ στο \"%toConfirmAction\". Location OpenWithWindow Τοποθεσία Force identify ContainerWindow Εξαναγκασμός αναγνώρισης Duplicate ContainerWindow Διπλότυπο @@ -213,7 +212,6 @@ Name PoseView Όνομα Group FilePermissionsView Ομάδα Version: InfoWindow Έκδοση Created: InfoWindow Δημιουργήθηκε: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Εάν %ifYouDoAction στις απλές ρυθμίσεις, το %osName μπορεί να μην συμπεριφερθεί σωστά! Είστε βέβαιος ότι θέλετε να το κάνετε αυτό; Για να %toDoAction στις απλές ρυθμίσεις ούτως ή άλλως, κρατήστε πατημένο το πλήκτρο Shift και κάντε κλικ στο \"toConfirmAction% \". \nShould this be fixed? FSUtils \nΠρέπει αυτό να διορθωθεί; Copying: StatusWindow Αντιγραφή: Capacity: InfoWindow Χωρητικότητα: @@ -271,7 +269,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Μετονομ Paused: click to resume or stop StatusWindow Σταματημένο: κάντε κλικ για συνέχεια ή διακοπή Preferred for %type OpenWithWindow Προτινόμενο για %type GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Εάν %ifYouDoAction στον κοινό φάκελο, το %osName μπορεί να μην συμπεριφερθεί σωστά! Είστε βέβαιος ότι θέλετε να το κάνετε αυτό; Για να %toDoAction στον κοινό φάκελο ούτως ή άλλως, κρατήστε πατημένο το πλήκτρο Shift και κάντε κλικ στο \"toConfirmAction% \". There was an error deleting \"%name\":\n\t%error FSUtils Υπήρξε κάποιο σφάλμα κατά τη διαγραφή \"%name\":\n\t%error Paste FilePanelPriv Επικόλληση Copy more ContainerWindow Αντιγραφή κι άλλων @@ -396,7 +393,6 @@ Select… FilePanelPriv Επιλογή... Don't move files to Trash SettingsView Να μη μετακινόυνται αρχεία στα απορρίματα There was an error resolving the link. Tracker Υπήρξε κάποιο σφάλμα κατά την επίλυση του συνδέσμου. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Εάν %ifYouDoAction στο φάκελο συστήματος, το %osName μπορεί να μην συμπεριφερθεί σωστά! Είστε βέβαιος ότι θέλετε να το κάνετε αυτό; Για να %toDoAction στο φάκελο συστήματος ούτως ή άλλως, κρατήστε πατημένο το πλήκτρο Shift και κάντε κλικ στο \"toConfirmAction% \". You can't move or copy the trash. FSUtils Δεν μπορείτε να μετακινήσετε ή να αντιγράψετε στο καλάθι αχρήστων. ends with SelectionWindow τελειώνει με Volume icons TrackerSettingsWindow Εικονίδια τόμου @@ -418,7 +414,6 @@ Modified ContainerWindow Τροποποιήθηκε Edit Query template FindPanel Επεξεργασία προτύπου ερωτήματος Prompt FSUtils Προτροπή Edit query ContainerWindow Επεξεργασία ερωτήματος -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Εάν %ifYouDoAction στο φάκελο διαμόρφωσης, το %osName μπορεί να μην συμπεριφερθεί σωστά! Είστε βέβαιος ότι θέλετε να το κάνετε αυτό; Για να %toDoAction στο φάκελο φάκελο διαμόρφωσης ούτως ή άλλως, κρατήστε πατημένο το πλήκτρο Shift και κάντε κλικ στο \"toConfirmAction% \". Find… ContainerWindow Εύρεση... Create a Query FindPanel Δημιούργησε ένα ερώτημα Move to Trash FSUtils Μεταφορά στο Καλάθι αχρήστων @@ -437,7 +432,6 @@ Mount ContainerWindow Προσάρτηση %capacity (%used used -- %free free) InfoWindow %capacity (%used χρησιμοποιημένα -- %free fελεύθερα) Cancel FSClipBoard Άκυρο Cut more ContainerWindow Αποκοπή περισσότερων -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Εάν %ifYouDoAction στο φάκελο ρυθμίσεων, το %osName μπορεί να μην συμπεριφερθεί σωστά! Είστε βέβαιος ότι θέλετε να το κάνετε αυτό; Για να %toDoAction στο φάκελο ρυθμίσεων ούτως ή άλλως, κρατήστε πατημένο το πλήκτρο Shift και κάντε κλικ στο \"toConfirmAction% \". Deleting: StatusWindow Διαγραφή: Empty Trash InfoWindow Άδειασμα κάδου Add FindPanel Προσθήκη diff --git a/data/catalogs/kits/tracker/fi.catkeys b/data/catalogs/kits/tracker/fi.catkeys index f6368cc768..a80213adc0 100644 --- a/data/catalogs/kits/tracker/fi.catkeys +++ b/data/catalogs/kits/tracker/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-libtracker 3695303004 +1 finnish x-vnd.Haiku-libtracker 3778030996 common B_COMMON_DIRECTORY yhteinen OK WidgetAttributeText Valmis Icon view VolumeWindow Kuvakenäkymä @@ -171,7 +171,6 @@ Edit favorites… FilePanelPriv Muokkaa suosikkeja... Create relative link ContainerWindow Luo suhteellinen linkki Copy ContainerWindow Kopioi Size PoseView Koko -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jos teet toiminnon %ifYouDoAction kotikansiolle, %osName ei ehkä toimi enää oikein! Oletko varma, että haluat tehdä tämän? Jos kuitenkin haluat tehdä toiminnon %toDoAction kotikansiolle, pidä vaihtonäppäin alhaalla ja napsauta painiketta \"%toConfirmAction\". Location OpenWithWindow Sijainti Force identify ContainerWindow Pakota tunnistus Duplicate ContainerWindow Kaksoiskappale @@ -195,7 +194,6 @@ New DeskWindow Uusi Open InfoWindow Avaa 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Korvaa kaikki -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Sovellus ”%appname” ei tue sen tyyppistä asiakirjaa, jota olet avaamassa. Oletko varma, että haluat jatkaa? Jos tiedät, että sovellus tukee dokumenttityyppiä, sinun pitäisi ottaa yhteyttä sovelluksen julkaisijaan ja pyytää heitä päivittämään dokumenttisi tyyppi tuettujen tyyppien luetteloon. Preparing to restore items… StatusWindow Valmistaudutaan palauttamaan kohteita... Replace other file WidgetAttributeText Korvaa muu tiedosto Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Joitakin valittuja kohteita ei voi siirtää roskakoriin. Haluaisitko sen sijaan poistaa ne? (Tätä toimintoa ei voi palauttaa.) @@ -220,7 +218,6 @@ Name PoseView Nimi Group FilePermissionsView Ryhmä Version: InfoWindow Versio: Created: InfoWindow Luotu: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Jos teet toiminnon %ifYouDoAction mime-asetuksille, %osName ei ehkä toimi enää oikein! Oletko varma, että haluat tehdä tämän? Jos kuitenkin haluat tehdä toiminnon %toDoAction mime-asetuksille, napsauta painiketta \"%toConfirmAction\". \nShould this be fixed? FSUtils \nPitäisikö tämä korjata? Copying: StatusWindow Kopioidaan: Capacity: InfoWindow Kapasiteetti: @@ -280,7 +277,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Nimeä uudellee Paused: click to resume or stop StatusWindow Keskeytetty: napsauta painiketta resume tai stop Preferred for %type OpenWithWindow Ensisijainen tyypille %type GiB WidgetAttributeText gibitavua -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jos teet toiminnon %ifYouDoAction yhteiskansiolle, %osName ei ehkä toimi enää oikein! Oletko varma, että haluat tehdä tämän? Jos kuitenkin haluat tehdä toiminnon %toDoAction yhteiskansiolle, pidä vaihtonäppäin alhaalla ja napsauta painiketta \"%toConfirmAction\". There was an error deleting \"%name\":\n\t%error FSUtils Kohdetta ”%name” poistettaessa tapahtui virhe:\n\t%error Paste FilePanelPriv Liitä Copy more ContainerWindow Kopioi lisää @@ -407,7 +403,6 @@ Select… FilePanelPriv Valitse... Don't move files to Trash SettingsView Älä siirrä tiedostoja roskakoriin There was an error resolving the link. Tracker Virhe linkin ratkaisemisessa. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jos teet toiminnon %ifYouDoAction järjestelmäkansiolle tai sen sisällölle, %osName ei ehkä alkulataa enää oikein! Oletko varma, että haluat tehdä tämän? Jos kuitenkin haluat tehdä toiminnon %toDoAction järjestelmäkansiolle tai sen sisällölle, pidä vaihtonäppäin alhaalla ja napsauta painiketta \"%toConfirmAction\". You can't move or copy the trash. FSUtils Et voi siirtää tai kopioida roskakoriin. ends with SelectionWindow loppuu kohteella Volume icons TrackerSettingsWindow Taltiokuvakkeet @@ -429,7 +424,6 @@ Modified ContainerWindow Muokattu Edit Query template FindPanel Muokkaa kyselymallinnetta Prompt FSUtils Kehoite Edit query ContainerWindow Muokkaa kyselyä -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Jos teet toiminnon %ifYouDoAction konfigurointikansiolle, %osName ei ehkä toimi enää oikein! Oletko varma, että haluat tehdä tämän? Jos kuitenkin haluat tehdä toiminnon %toDoAction konfigurointikansiolle, napsauta painiketta \"%toConfirmAction\". Find… ContainerWindow Etsi... Create a Query FindPanel Lue kysely Move to Trash FSUtils Siirrä roskakoriin @@ -448,7 +442,6 @@ Mount ContainerWindow Liitä %capacity (%used used -- %free free) InfoWindow %capacity (%used käytetty -- %free vapaana) Cancel FSClipBoard Peru Cut more ContainerWindow Leikkaa lisää -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Jos teet toiminnon %ifYouDoAction asetuskansiolle, %osName ei ehkä toimi enää oikein! Oletko varma, että haluat tehdä tämän? Jos kuitenkin haluat tehdä toiminnon %toDoAction asetuskansiolle, napsauta painiketta \"%toConfirmAction\". Deleting: StatusWindow Poistetaan: Empty Trash InfoWindow Tyhjennä roskakori Add FindPanel Lisää diff --git a/data/catalogs/kits/tracker/fr.catkeys b/data/catalogs/kits/tracker/fr.catkeys index d78530fe4e..2aeb88efb3 100644 --- a/data/catalogs/kits/tracker/fr.catkeys +++ b/data/catalogs/kits/tracker/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-libtracker 1951892978 +1 french x-vnd.Haiku-libtracker 733527088 common B_COMMON_DIRECTORY commun OK WidgetAttributeText OK Icon view VolumeWindow Vue en icônes @@ -190,7 +190,6 @@ New DeskWindow Nouveau Open InfoWindow Ouvrir 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Remplacer tout -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow L'application « %appname » ne supporte pas le type de document que vous êtes sur le point d'ouvrir. Êtes vous sûr de vouloir continuer ? Si vous savez que l'application prend en charge ce type de document, vous devriez contacter son éditeur pour lui demander de mettre à jour l'application afin d'ajouter le type de votre document à la liste de ceux pris en charge. Preparing to restore items… StatusWindow Restauration des éléments en préparation... Replace other file WidgetAttributeText Remplacer un autre fichier Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Certains des éléments sélectionnés ne peuvent pas être envoyés à la Corbeille. Voulez vous les supprimer ? (Cette opération est irrémédiable.) diff --git a/data/catalogs/kits/tracker/hi.catkeys b/data/catalogs/kits/tracker/hi.catkeys index bf55074d2e..4db3126892 100644 --- a/data/catalogs/kits/tracker/hi.catkeys +++ b/data/catalogs/kits/tracker/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-libtracker 520218895 +1 hindi x-vnd.Haiku-libtracker 602946887 common B_COMMON_DIRECTORY सामान्य OK WidgetAttributeText ठीक है Icon view VolumeWindow चिह्न दृश्य @@ -165,7 +165,6 @@ Edit favorites… FilePanelPriv फेवरिट संपादित कर Create relative link ContainerWindow संबंधित लिंक बनाएँ Copy ContainerWindow अनुकृति बनाना Size PoseView आकार -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils अगर आप %ifYouDoAction होम फोल्डर, %osName ठीक से नहीं पेश आएगी! क्या आप पक्का से यह करना चाहते हैं? To %toDoAction होम फोल्डर किसी भी तरह, Shift पकड़ कर रखें और क्लिक करें \"%toConfirmAction\". Location OpenWithWindow स्थान Force identify ContainerWindow फोर्स पहचाने Duplicate ContainerWindow नकल @@ -189,7 +188,6 @@ New DeskWindow नया Open InfoWindow खोलें 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils सभी बदलें -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow \ अनुप्रयोग "% \ APPNAME" आप जिस दस्तावेज़ के प्रकार के बारे में खोलने के लिए कर रहे हैं यह का समर्थन नहीं करता. क्या आप आगे बढ़ना चाहते हैं? यदि आप जानते हैं कि आवेदन दस्तावेज़ प्रकार का समर्थन करता है, तो आप आवेदन के प्रकाशक से संपर्क करें और उन्हें अपने अपने रूप में समर्थित दस्तावेज़ के प्रकार सूची आवेदन अद्यतन करने के लिए पूछना चाहिए. Preparing to restore items… StatusWindow आइटम बहाल की तैयारी ... Replace other file WidgetAttributeText अन्य फ़ाइल बदलें Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView चयनित आइटम में से कुछ रद्दी में स्थानांतरित नहीं किया जा सकता है. क्या आप के बजाय उन्हें मिटाना चाहते हैं? (यह आपरेशन किया जाना है. नहीं लौट सकते हैं) @@ -214,7 +212,6 @@ Name PoseView नाम Group FilePermissionsView समूह Version: InfoWindow संस्करण: Created: InfoWindow बनाया गया: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils अगर आप %ifYouDoAction मिमे सेत्तिंग्स, %osName ठीक से नहीं पेश आएगी! क्या आप पक्का से यह करना चाहते हैं? To %toDoAction माईम फोल्डर किसी भी तरह, Shift पकड़ कर रखें और क्लिक करें \"%toConfirmAction\". \nShould this be fixed? FSUtils क्या Copying: StatusWindow प्रतिलिपि बनाई जा रही: Capacity: InfoWindow क्षमता: @@ -273,7 +270,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) फिर स Paused: click to resume or stop StatusWindow रुका हुआ: क्लिक करें फिर से शुरू या बंद करने के लिए Preferred for %type OpenWithWindow के लिए पसंदीदा %type GiB WidgetAttributeText गीबाइट्स -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils अगर आप %ifYouDoAction कोम्मन फोल्डर, %osName ठीक से नहीं पेश आएगी! क्या आप पक्का से यह करना चाहते हैं? To %toDoAction कॉमन फोल्डर किसी भी तरह, Shift पकड़ कर रखें और क्लिक करें \"%toConfirmAction\". There was an error deleting \"%name\":\n\t%error FSUtils वहाँ एक को हटाने में त्रुटि \"%name\":\n\t%error Paste FilePanelPriv चिपकाएँ Copy more ContainerWindow और अधिक प्रति करें @@ -400,7 +396,6 @@ Select… FilePanelPriv चुनें ... Don't move files to Trash SettingsView रद्दी में फाइलों मत डालें There was an error resolving the link. Tracker एक कड़ी को हल करने में त्रुटि हुई. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils अगर आप %ifYouDoAction सिस्टम फोल्डर या फिर उसके कंटेंट्स, आप उससे बूट नहीं कर पाएंगे %osName! क्या आप यह करना चाहते है? के लिए %toDoAction सिस्टम फोल्डर या फिर उसके कंटेंट्स केसे भी, Shift पकड़ कर रखें और क्लिक करें \"%toConfirmAction\". You can't move or copy the trash. FSUtils आप रद्दी को कॉपी या स्थानांतरित नहीं कर सकते हैं. ends with SelectionWindow के साथ समाप्त होता है Volume icons TrackerSettingsWindow मात्रा प्रतीक @@ -422,7 +417,6 @@ Modified ContainerWindow संशोधित किया गया Edit Query template FindPanel प्रश्न आकार पट्ट संपादित करें Prompt FSUtils शीघ्र Edit query ContainerWindow प्रश्न संपादित करें -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils अगर आप %ifYouDoAction कॉन्फिग फोल्डर, आप उससे बूट नहीं कर पाएंगे %osName! क्या आप यह करना चाहते है? के लिए %toDoAction कॉन्फिग फोल्डर या फिर उसके कंटेंट्स केसे भी, Shift पकड़ कर रखें और क्लिक करें \"%toConfirmAction\". Find… ContainerWindow खोजें... Create a Query FindPanel प्रश्न बनाये Move to Trash FSUtils रद्दी मे ले जाएँ @@ -441,7 +435,6 @@ Mount ContainerWindow चिपकाना %capacity (%used used -- %free free) InfoWindow %क्षमता Cancel FSClipBoard रद्द करें Cut more ContainerWindow और अधिक काटे -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils अगर आप %ifYouDoAction कोम्मन फोल्डर, %osName ठीक से नहीं पेश आएगी! क्या आप पक्का से यह करना चाहते हैं? To %toDoAction सेटिंग्स फोल्डर किसी भी तरह, Shift पकड़ कर रखें और क्लिक करें \"%toConfirmAction\". Deleting: StatusWindow हटा रहा है Empty Trash InfoWindow रद्दी खाली करें Add FindPanel जोड़े diff --git a/data/catalogs/kits/tracker/ja.catkeys b/data/catalogs/kits/tracker/ja.catkeys index 24532dcb08..0fee4290ee 100644 --- a/data/catalogs/kits/tracker/ja.catkeys +++ b/data/catalogs/kits/tracker/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-libtracker 4074946557 +1 japanese x-vnd.Haiku-libtracker 4157674549 OK WidgetAttributeText OK Icon view VolumeWindow アイコン表示 Add-ons FilePanelPriv アドオン @@ -167,7 +167,6 @@ Edit favorites… FilePanelPriv お気に入りの編集… Create relative link ContainerWindow 相対リンクを作成 Copy ContainerWindow コピー Size PoseView サイズ -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils ホームフォルダーを%ifYouDoActionすると、%osName は正しく動かなくなるかもしれません。本当に行いますか? どうしてもホームフォルダーを%toDoActionするには、シフトキーを押したまま、\"%toConfirmAction\" をクリックしてください。 Location OpenWithWindow 場所 Force identify ContainerWindow ファイル形式を判別 Duplicate ContainerWindow 複製 @@ -191,7 +190,6 @@ New DeskWindow 新規作成 Open InfoWindow 開く 64 x 64 ContainerWindow 64 × 64 Replace all FSUtils すべて置換 -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow アプリケーション \"%appname\" は開こうとしているドキュメントの形式をサポートしていません。進めても良いですか? アプリケーションがサポートすることがわかっている場合は、アプリケーションの製作元にドキュメントタイプをサポートに加えるように問い合わせてください。 Preparing to restore items… StatusWindow 復元の準備をしています… Replace other file WidgetAttributeText 既存の項目を置き換える Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView いくつかの選択項目はごみ箱に捨てられません。完全に削除してもよろしいですか?元に戻せませんので、ご注意ください。 @@ -216,7 +214,6 @@ Name PoseView 名前 Group FilePermissionsView グループ Version: InfoWindow バージョン: Created: InfoWindow 作成日時: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils mime 設定を%ifYouDoActionすると、%osName は正しく動かなくなるかもしれません。本当に行いますか? どうしても mime 設定を%toDoActionするには、\"%toConfirmAction\" をクリックしてください。 \nShould this be fixed? FSUtils \n修復しますか? Copying: StatusWindow コピー中: Capacity: InfoWindow 容量: @@ -275,7 +272,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) 名前の変更 Paused: click to resume or stop StatusWindow 一時停止中:クリックで動作の再開また中断をしてください Preferred for %type OpenWithWindow %type対応優先アプリ GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils common フォルダーを%ifYouDoActionすると、%osName は正しく動かなくなるかもしれません。本当に行いますか? どうしても common フォルダーを%toDoActionするには、シフトキーを押したまま、\"%toConfirmAction\" をクリックしてください。 There was an error deleting \"%name\":\n\t%error FSUtils \"%name\" の移動中にエラーが発生しました:\n\t%error Paste FilePanelPriv 貼り付け Copy more ContainerWindow さらにコピー @@ -402,7 +398,6 @@ Select… FilePanelPriv 選択… Don't move files to Trash SettingsView ごみ箱を経由せずに削除する There was an error resolving the link. Tracker リンクの解釈に失敗しました。 %BytesPerSecond/s StatusWindow %BytesPerSecond/秒 -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils システムフォルダーやその内容を%ifYouDoActionすると、%osName は起動しなくなるでしょう。本当に行いますか? どうしてもシステムフォルダーやその内容を%toDoActionするには、シフトキーを押したまま、\"%toConfirmAction\" をクリックしてください。 You can't move or copy the trash. FSUtils ごみ箱の移動やコピーはできません。 ends with SelectionWindow 指定文字列で終わる Volume icons TrackerSettingsWindow ディスクアイコン @@ -424,7 +419,6 @@ Modified ContainerWindow 更新日時 Edit Query template FindPanel クエリテンプレートを編集 Prompt FSUtils プロンプト Edit query ContainerWindow クエリを編集 -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils config フォルダーを%ifYouDoActionすると、%osName は正しく動かなくなるかもしれません。本当に行いますか? どうしても config フォルダーを%toDoActionするには、シフトキーを押したまま、\"%toConfirmAction\" をクリックしてください。 Find… ContainerWindow 検索… Create a Query FindPanel クエリを作成 Move to Trash FSUtils ごみ箱に移動 @@ -443,7 +437,6 @@ Mount ContainerWindow マウント %capacity (%used used -- %free free) InfoWindow %capacity (%used 使用中 -- %free 使用可能) Cancel FSClipBoard 中止 Cut more ContainerWindow さらに切り取る -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils settings フォルダーを%ifYouDoActionすると、%osName は正しく動かなくなるかもしれません。本当に行いますか? どうしても settings フォルダーを%toDoActionするには、シフトキーを押したまま、\"%toConfirmAction\" をクリックしてください。 Deleting: StatusWindow 削除中: Empty Trash InfoWindow ごみ箱を空にする Add FindPanel 追加 diff --git a/data/catalogs/kits/tracker/lt.catkeys b/data/catalogs/kits/tracker/lt.catkeys index b687fc8e18..f64416b6b1 100644 --- a/data/catalogs/kits/tracker/lt.catkeys +++ b/data/catalogs/kits/tracker/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-libtracker 3695303004 +1 lithuanian x-vnd.Haiku-libtracker 3778030996 common B_COMMON_DIRECTORY Bendra OK WidgetAttributeText Gerai Icon view VolumeWindow Rodyti piktogramas @@ -171,7 +171,6 @@ Edit favorites… FilePanelPriv Tvarkyti parankinius… Create relative link ContainerWindow Kurti santykinę nuorodą Copy ContainerWindow Kopijuoti Size PoseView Dydis -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jeigu %ifYouDoAction Namų aplanką, „%osName“ elgesys taps nenuspėjamas! Ar tikrai to norite? Jeigu vis tiek norite %toDoAction Namų aplanką, spustelėkite mygtuką „%toConfirmAction“, laikydami nuspaustą Lyg2 klavišą. Location OpenWithWindow Vieta Force identify ContainerWindow Priverstinai atpažinti Duplicate ContainerWindow Dubliuoti @@ -195,7 +194,6 @@ New DeskWindow Naujas Open InfoWindow Atverti 64 x 64 ContainerWindow 64×64 Replace all FSUtils Pakeisti visus -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Programa „%appname“ nepalaiko bandomo atverti dokumento tipo. Ar tikrai norite tęsti? Jeigu tikrai žinote, jog ši programa palaiko šio tipo dokumentus, galbūt Jums vertėtų susisiekti su programos leidėju ir paprašyti, kad šis papildytų programos deklaruojamą ja leidžiamų atverti dokumentų tipų sąrašą, įtraukdamas į jį šio dokumento tipą. Preparing to restore items… StatusWindow Ruošiamasi atkurti objektus… Replace other file WidgetAttributeText Pakeisti kitą failą Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Kai kurių pažymėtų elementų išmesti Šiukšlinėn negalima. Ar norite vietoje to juos pašalinti? Neužmirškite, jog šis veiksmas negrįžtamas! @@ -220,7 +218,6 @@ Name PoseView Vardas Group FilePermissionsView Grupė Version: InfoWindow Versija: Created: InfoWindow Sukūrimo data: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Jeigu %ifYouDoAction MIME nuostatas, „%osName“ elgesys taps nenuspėjamas! Ar tikrai to norite? Jeigu vis tiek norite %toDoAction MIME nuostatas, spustelėkite mygtuką „%toConfirmAction“. \nShould this be fixed? FSUtils \nAr pašalinti šį nesklandumą? Copying: StatusWindow Kopijuojama: Capacity: InfoWindow Talpa: @@ -280,7 +277,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Pervardinti Paused: click to resume or stop StatusWindow Pristabdyta. Galite pratęsti arba nutraukti Preferred for %type OpenWithWindow Numatytoji %type objektams GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jeigu %ifYouDoAction aplanką „Bendra“, „%osName“ elgesys taps nenuspėjamas! Ar tikrai to norite? Jeigu vis tiek norite %toDoAction aplanką „Bendra“, spustelėkite mygtuką „%toConfirmAction“, laikydami nuspaustą Lyg2 klavišą. There was an error deleting \"%name\":\n\t%error FSUtils Šalinant „%name“ įvyko klaida:\n\t%error Paste FilePanelPriv Įdėti Copy more ContainerWindow Kopijuoti dar @@ -407,7 +403,6 @@ Select… FilePanelPriv Pažymėti… Don't move files to Trash SettingsView Šiukšlinėn objektų nemesti There was an error resolving the link. Tracker Nustatant nuorodos tikslą, įvyko klaida. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jeigu %ifYouDoAction Sistemos aplanką, „%osName“ elgesys taps nenuspėjamas! Ar tikrai to norite? Jeigu vis tiek norite %toDoAction Sistemos aplanką, spustelėkite mygtuką „%toConfirmAction“, laikydami nuspaustą Lyg2 klavišą. You can't move or copy the trash. FSUtils Šiukšlinės negalima nei perkelti, nei nukopijuoti. ends with SelectionWindow baigiasi Volume icons TrackerSettingsWindow Tomų piktogramos @@ -429,7 +424,6 @@ Modified ContainerWindow Modifikavimo data Edit Query template FindPanel Taisyti užklausos šabloną Prompt FSUtils Klausti Edit query ContainerWindow Taisyti užklausą -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Jeigu %ifYouDoAction Konfigūracijos aplanką, „%osName“ elgesys taps nenuspėjamas! Ar tikrai to norite? Jeigu vis tiek norite %toDoAction Konfigūracijos aplanką, spustelėkite mygtuką „%toConfirmAction“. Find… ContainerWindow Ieškti… Create a Query FindPanel Kurti užklausą Move to Trash FSUtils Išmesti Šiukšlinėn @@ -448,7 +442,6 @@ Mount ContainerWindow Prijungti %capacity (%used used -- %free free) InfoWindow %capacity (užpildyta %used, laisva %free) Cancel FSClipBoard Atsisakyti Cut more ContainerWindow Iškirpti dar -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Jeigu %ifYouDoAction Nuostatų aplanką, „%osName“ elgesys taps nenuspėjamas! Ar tikrai to norite? Jeigu vis tiek norite %toDoAction Nuostatų aplanką, spustelėkite mygtuką „%toConfirmAction“. Deleting: StatusWindow Šalinama: Empty Trash InfoWindow Ištuštinti šiukšlinę Add FindPanel Pridėti diff --git a/data/catalogs/kits/tracker/nb.catkeys b/data/catalogs/kits/tracker/nb.catkeys index 73c17b9128..336e7df761 100644 --- a/data/catalogs/kits/tracker/nb.catkeys +++ b/data/catalogs/kits/tracker/nb.catkeys @@ -1,4 +1,4 @@ -1 bokmål, norwegian; norwegian bokmål x-vnd.Haiku-libtracker 3603368351 +1 bokmål, norwegian; norwegian bokmål x-vnd.Haiku-libtracker 3686096343 common B_COMMON_DIRECTORY felles OK WidgetAttributeText OK Icon view VolumeWindow Ikonvisning @@ -167,7 +167,6 @@ Edit favorites… FilePanelPriv Rediger favoritter Create relative link ContainerWindow Lag relativ lenke Copy ContainerWindow Kopier Size PoseView Størrelse -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Dersom du gjennomfører %ifYouDoAction hjemmemappe, %osName kan opptre seg unormalt! Er du sikker på at du vil gjennomføre dette? For å %toDoAction hjemmemappe allikevel, hold ned shift tast og klikk \"%toConfirmAction\". Location OpenWithWindow Sted Force identify ContainerWindow Tving identifisering Duplicate ContainerWindow Dupliser @@ -191,7 +190,6 @@ New DeskWindow Ny Open InfoWindow Åpne 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Erstatt alle -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Programmet \"%appname\" støtter ikke den dokumenttypen du er i ferd med å åpne. Er du sikker på at du vil fortsette? Hvis du er sikker på at programmet støtter dokumenttypen bør du kontakte utgiveren av programmet og be dem om å oppdatere programmet til å oppgi at dokumenttypen er støttet. Preparing to restore items… StatusWindow Forbereder gjenoppretting av oppføringer... Replace other file WidgetAttributeText Erstatt annen fil Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Noen av de valgte oppføringene kan ikke flyttes til søppelkurven. Ønsker du å slette dem i stedet? (Denne operasjonen kan ikke angres.) @@ -216,7 +214,6 @@ Name PoseView Navn Group FilePermissionsView Gruppe Version: InfoWindow Versjon: Created: InfoWindow Opprettet: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Dersom du gjennomfører %ifYouDoAction mime settingene, %osName kan opptre seg unormalt! Er du sikker på at du vil gjennomføre dette? For å %toDoAction mime settingsene alikevel, klikk \"%toConfirmAction\". \nShould this be fixed? FSUtils \nSkal dette repareres? Copying: StatusWindow Kopierer: Capacity: InfoWindow Kapasitet: @@ -275,7 +272,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Gi nytt navn Paused: click to resume or stop StatusWindow Pauset: klikk for å fortsette eller stoppe Preferred for %type OpenWithWindow Foretrukket for %type GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Dersom du gjennomfører %ifYouDoAction felles mappen, %osName kan opptre seg unormalt! Er du sikker på at du vil gjennomføre dette? For å %toDoAction felles mappe, hold ned shift tast og klikk \"%toConfirmAction\". There was an error deleting \"%name\":\n\t%error FSUtils Det oppsto en feil ved sletting av \"%name\":\n\t%error Paste FilePanelPriv Lim inn Copy more ContainerWindow Kopier flere @@ -401,7 +397,6 @@ Could not update permissions of file \"%name\". %error FSUtils Kunne ikke oppda Select… FilePanelPriv Velg... Don't move files to Trash SettingsView Ikke flytt filer til søppelkurven. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Dersom du gjennomfører %ifYouDoAction system mappen eller dens innhold, vil du ikke kunne starte %osName! Are you sure you want to do this? For å %toDoAction system mappe, hold ned shift tast og klikk \"%toConfirmAction\". You can't move or copy the trash. FSUtils Du kan ikke flytte eller kopiere søppelkurven. ends with SelectionWindow slutter med Volume icons TrackerSettingsWindow Volumikoner @@ -422,7 +417,6 @@ less than FindPanel mindre enn Modified ContainerWindow Endret Edit Query template FindPanel Rediger mal for spørringer Edit query ContainerWindow Rediger spørring -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Dersom du gjennomfører %ifYouDoAction config mappen, %osName kan opptre seg unormalt! Er du sikker på at du vil gjennomføre dette? For å %toDoAction config mappen uansett, klikk \"%toConfirmAction\". Find… ContainerWindow Finn... Create a Query FindPanel Opprett en spørring Move to Trash FSUtils Flytt til søppelkurven @@ -441,7 +435,6 @@ Mount ContainerWindow Monter %capacity (%used used -- %free free) InfoWindow %capacity (%used brukt -- %free ledig) Cancel FSClipBoard Avbryt Cut more ContainerWindow Klipp mer -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Dersom du gjennomfører %ifYouDoAction settings mappen, %osName kan opptre seg unormalt! Er du sikker på at du vil gjennomføre dette? For å %toDoAction settings mappen uansett, klikk \"%toConfirmAction\". Deleting: StatusWindow Sletter: Empty Trash InfoWindow Tøm søppelkurven Add FindPanel Legg til diff --git a/data/catalogs/kits/tracker/nl.catkeys b/data/catalogs/kits/tracker/nl.catkeys index 0c78aaa1a3..41c3d280c1 100644 --- a/data/catalogs/kits/tracker/nl.catkeys +++ b/data/catalogs/kits/tracker/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-libtracker 3121200791 +1 dutch; flemish x-vnd.Haiku-libtracker 3203928783 common B_COMMON_DIRECTORY algemeen OK WidgetAttributeText OK Icon view VolumeWindow Icoonweergave @@ -168,7 +168,6 @@ Edit favorites… FilePanelPriv Favorieten bewerken... Create relative link ContainerWindow Maak een relatieve link Copy ContainerWindow Kopiëren Size PoseView Grootte -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Als je de gebruikersmap %ifYouDoAction, kan het zijn dat %osName niet meer correct functioneert! Ben je zeker dat je dit wilt doen? Om de gebruikersmap toch te %toDoAction, druk de Shifttoets in en klik op \"%toConfirmAction\". Location OpenWithWindow Locatie Force identify ContainerWindow Forceer identificatie Duplicate ContainerWindow Dupliceer @@ -192,7 +191,6 @@ New DeskWindow Nieuw Open InfoWindow Openen 64 x 64 ContainerWindow 64 x64 Replace all FSUtils Alles vervangen -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Het documenttype dat u wilt openen, wordt niet ondersteund door het programma \"%appname\". Bent u zeker dat u verder wilt gaan? Als u zeker weet dat de toepassing het documenttype ondersteunt, kun u contact opnemen met de uitgever van de toepassing met de vraag of ze hun toepassing zodanig willen bijwerken dat dit documenttype opgenomen wordt in de lijst van ondersteunde documenttypen. Preparing to restore items… StatusWindow Herstel van items wordt voorbereid... Replace other file WidgetAttributeText Ander bestand vervangen Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Sommige van de geselecteerde items kunnen niet naar de prullenbak verplaatst worden. Wilt u ze in plaats daarvan verwijderen? (Deze actie kan niet ongedaan gemaakt worden.) @@ -217,7 +215,6 @@ Name PoseView Naam Group FilePermissionsView Groep Version: InfoWindow Versie: Created: InfoWindow Gemaakt: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Als je de mime-instellingen %ifYouDoAction, kan het zijn dat %osName niet meer correct functioneert! Ben je zeker dat je dit wilt doen? Om de mime-instellingen toch te %toDoAction, klik \"%toConfirmAction\". \nShould this be fixed? FSUtils \nMoet dit opgelost worden? Copying: StatusWindow Aan het kopiëren: Capacity: InfoWindow Capaciteit: @@ -276,7 +273,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Hernoemen Paused: click to resume or stop StatusWindow Gepauzeerd: klik om te hervatten of te stoppen Preferred for %type OpenWithWindow Geschikt voor %type GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Als je de algemene map %ifYouDoAction, kan het zijn dat %osName niet meer correct functioneert! Ben je zeker dat je dit wilt doen? Om de algemene map toch te %toDoAction, houd de Shifttoets ingedrukt en klik op \"%toConfirmAction\". There was an error deleting \"%name\":\n\t%error FSUtils Er is een fout opgetreden bij het verwijderen van \"%name\":\n\t%error Paste FilePanelPriv Plakken Copy more ContainerWindow Meer kopiëren @@ -403,7 +399,6 @@ Select… FilePanelPriv Selecteren... Don't move files to Trash SettingsView Verplaats geen bestanden naar de prullenbak There was an error resolving the link. Tracker Er is een fout opgetreden bij het toekennen van de link. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Als je de systeemmap of haar inhoud %ifYouDoAction, zul je niet meer in staat zijn om %osName op te starten! Ben je zeker dat je dit wilt doen? Om de systeemmap of haar inhoud toch te %toDoAction, houd de Shifttoets ingedrukt en klik op \"%toConfirmAction\". You can't move or copy the trash. FSUtils U kunt de prullenbak niet verplaatsen of kopiëren. ends with SelectionWindow eindigt met Volume icons TrackerSettingsWindow Gegevensdrager-iconen @@ -425,7 +420,6 @@ Modified ContainerWindow Gewijzigd Edit Query template FindPanel Zoekopdracht-sjabloon aanpassen Prompt FSUtils Bevestigen Edit query ContainerWindow Zoekopdracht aanpassen -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Als je de configuratiemap %ifYouDoAction, kan het zijn dat %osName niet meer correct functioneert! Ben je zeker dat je dit wilt doen? Om de configuratiemap toch te %toDoAction, klik op \"%toConfirmAction\". Find… ContainerWindow Zoeken... Create a Query FindPanel Maak een Zoekopdracht Move to Trash FSUtils Verplaats naar Prullenbak @@ -444,7 +438,6 @@ Mount ContainerWindow Betrekken %capacity (%used used -- %free free) InfoWindow %capacity (%used gebruikt -- %free vrij) Cancel FSClipBoard Annuleren Cut more ContainerWindow Knip meer -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Als je de instellingenmap %ifYouDoAction, kan het zijn dat %osName niet meer correct functioneert! Ben je zeker dat je dit wilt doen? Om de instellingenmap toch te %toDoAction, klik \"%toConfirmAction\". Deleting: StatusWindow Verwijdert: Empty Trash InfoWindow Prullenbak leegmaken: Add FindPanel Toevoegen diff --git a/data/catalogs/kits/tracker/pl.catkeys b/data/catalogs/kits/tracker/pl.catkeys index 5768a9a25d..f53f0591af 100644 --- a/data/catalogs/kits/tracker/pl.catkeys +++ b/data/catalogs/kits/tracker/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-libtracker 3695303004 +1 polish x-vnd.Haiku-libtracker 3778030996 common B_COMMON_DIRECTORY common OK WidgetAttributeText OK Icon view VolumeWindow Widok ikon @@ -171,7 +171,6 @@ Edit favorites… FilePanelPriv Edytuj ulubione… Create relative link ContainerWindow Utwórz wględny skrót Copy ContainerWindow Kopiuj Size PoseView Rozmiar -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jeśli %ifYouDoAction katalogu domowego, %osName może nie zachowywać się poprawnie! Czy na pewno chcesz to zrobić? Aby %toDoAction katalogu domowego mimo wszystko, przytrzymaj klawisz Shift i kliknij \"%toConfirmAction\". Location OpenWithWindow Lokacja Force identify ContainerWindow Identyfikuj Duplicate ContainerWindow Zduplikuj @@ -195,7 +194,6 @@ New DeskWindow Nowy Open InfoWindow Otwórz 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Zastąp wszystko -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Aplikacja \"%appname\" nie obsługuje typu pliku który masz zamiar otworzyć. Jesteś pewien, że chcesz kontynuować? Jeśli wiesz, że aplikacja obsługuje ten typ plików, skontaktuj się z pomocą techniczną i poinformuj o zaistniałej sytuacji. Preparing to restore items… StatusWindow Przygotowanie do odzyskania elementów… Replace other file WidgetAttributeText Zastąp pozostałe pliki Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Część zaznaczonych plików nie może zostać przeniesiona do kosza. Czy chcesz je usunąć zamiast tego? (Ta operacja nie może zostać cofnięta) @@ -220,7 +218,6 @@ Name PoseView Nazwa Group FilePermissionsView Grupa Version: InfoWindow Wersja: Created: InfoWindow Stworzono: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Jeśli %ifYouDoAction typ mime, %osName może nie zachowywać się poprawnie! Czy na pewno chcesz to zrobić? Aby %toDoAction typ mime mimo wszystko kliknij \"%toConfirmAction\". \nShould this be fixed? FSUtils \nCzy naprawić to? Copying: StatusWindow Kopiowanie: Capacity: InfoWindow Pojemność: @@ -280,7 +277,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Zmiana nazwy Paused: click to resume or stop StatusWindow Pauza: kliknij by kontynuować lub zatrzymać Preferred for %type OpenWithWindow Preferowane dla %type GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jeśli %ifYouDoAction katalog common, %osName może nie zachowywać się poprawnie! Czy na pewno chcesz to zrobić? Aby %toDoAction katalog common mimo wszystko, przytrzymaj klawisz Shift i kliknij \"%toConfirmAction\". There was an error deleting \"%name\":\n\t%error FSUtils Pojawił się błąd przy usuwaniu \"%name\":\n\t%error Paste FilePanelPriv Wklej Copy more ContainerWindow Kopiuj więcej @@ -407,7 +403,6 @@ Select… FilePanelPriv Wybierz… Don't move files to Trash SettingsView Nie przenoś plików do kosza There was an error resolving the link. Tracker Pojawił się problem przy przetwarzaniu skrótu. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Jeśli %ifYouDoAction folder systemowy lub jego zawartość, nie będziesz mógł uruchomić %osName! Czy na pewno chcesz to zrobić? Aby %toDoAction katalogu domowego mimo wszystko, przytrzymaj klawisz Shift i kliknij \"%toConfirmAction\". You can't move or copy the trash. FSUtils nie możesz przenieść ani skopiować kosza. ends with SelectionWindow kończy się na Volume icons TrackerSettingsWindow Ikony dysków @@ -429,7 +424,6 @@ Modified ContainerWindow Zmodyfikowane Edit Query template FindPanel Edytuj szablon Zapytania Prompt FSUtils Ostrzegaj Edit query ContainerWindow Edytuj zapytanie -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Jeśli %ifYouDoAction katalog config, %osName może nie zachowywać się poprawnie! Czy na pewno chcesz to zrobić? Aby %toDoAction katalog config mimo wszystko, kliknij \"%toConfirmAction\". Find… ContainerWindow Znajdź… Create a Query FindPanel Stwórz zapytanie Move to Trash FSUtils Przenieś do kosza @@ -448,7 +442,6 @@ Mount ContainerWindow Zamontuj %capacity (%used used -- %free free) InfoWindow %capacity (%used zajęte -- %free wolne) Cancel FSClipBoard Anuluj Cut more ContainerWindow Wytnij więcej -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Jeśli %ifYouDoAction katalog settings, %osName może nie zachowywać się poprawnie! Czy na pewno chcesz to zrobić? Aby %toDoAction katalog config mimo wszystko, kliknij \"%toConfirmAction\". Deleting: StatusWindow Usuwanie: Empty Trash InfoWindow Opróżnij kosz Add FindPanel Dodaj diff --git a/data/catalogs/kits/tracker/ru.catkeys b/data/catalogs/kits/tracker/ru.catkeys index 02bf91fe46..6866725083 100644 --- a/data/catalogs/kits/tracker/ru.catkeys +++ b/data/catalogs/kits/tracker/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-libtracker 4130438504 +1 russian x-vnd.Haiku-libtracker 3778030996 common B_COMMON_DIRECTORY Общие OK WidgetAttributeText ОК Icon view VolumeWindow Большие значки @@ -19,6 +19,7 @@ Invert selection VolumeWindow Инвертировать Recent documents FavoritesMenu Недавние документы Modified QueryPoseView Изменён Created ContainerWindow Создан +Error %error loading add-On %name. ContainerWindow Ошибка %error при запуске дополнения %name. contains SelectionWindow содержит Sorry, you can't save things at the root of your system. FilePanelPriv Извините, сохранение объектов в корневой папке системы невозможно. Show shared volumes on Desktop SettingsView Показывать значки общих дисков @@ -46,7 +47,9 @@ Select all ContainerWindow Выделить все Sorry, the 'Character' attribute cannot store a multi-byte glyph. WidgetAttributeText Извините, но атрибут 'Character' не может хранить многобайтовый глиф. Clean up DeskWindow Выстроить You cannot copy or move the root directory. FSUtils Вы не можете перемещать или копировать корневую папку. +%SizeProcessed of %TotalSize, %BytesPerSecond/s StatusWindow %SizeProcessed из %TotalSize, %BytesPerSecond/с Invert selection FilePanelPriv Инвертировать +Rename InfoWindow Button label, 'Rename' (en), 'Umbenennen' (de) Переименовать save text FilePanelPriv сохранить текст Select all FilePanelPriv Выделить все Link to: InfoWindow Ссылка на: @@ -74,6 +77,7 @@ Decrease size DeskWindow Уменьшить размер Size ContainerWindow Размер All disks AutoMounterSettings Все диски Would you like to find some other suitable application? FSUtils Хотите найти какое-нибудь другое подходящее приложение? +Finish: %time - %finishtime left StatusWindow Окончание: %time - осталось %finishtime Could not open \"%document\" with application \"%app\" (Missing libraries: %library). \n FSUtils Невозможно открыть \"%document\" приложением \"%app\" (Отсутствуют библиотеки: %library). \n no items CountView нет объектов Ignore case SelectionWindow Игнорировать регистр @@ -94,6 +98,7 @@ Add-ons VolumeWindow Дополнения Sorry, you can't copy items to the Trash. PoseView Извините, но вы не можете копировать объекты в корзину. List view VolumeWindow Список matches wildcard expression SelectionWindow совпадает с шаблонным выражением +rename TextWidget As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) переименуете You cannot replace a folder or a symbolic link with a file. FSUtils Невозможно заменить папку или символическую ссылку файлом. Show space bars on volumes SettingsView Показывать индикаторы занятого места Invert selection ContainerWindow Инвертировать @@ -104,6 +109,7 @@ Add printer… ContainerWindow Добавить принтер… Open VolumeWindow Открыть New folder ContainerWindow Новая папка Kind ContainerWindow Тип +rename TextWidget As in 'to rename this folder...' (en) 'Um diesen Ordner umzubenennen...' (de) переименовать home B_USER_DIRECTORY Домашняя Select… ContainerWindow Выделить… Copy to ContainerWindow Копировать в @@ -114,6 +120,7 @@ Set new link target InfoWindow Изменить цель ссылки Save as Query template: FindPanel Сохранить запрос как шаблон: preferences B_PREFERENCES_DIRECTORY Настройки Cancel FSUtils Отмена +move FSUtils As in 'to move this folder...' (en) Um diesen Ordner zu verschieben...' (de) переместить Edit name ContainerWindow Переименовать Show volumes on Desktop SettingsView Показывать значки разделов KiB WidgetAttributeText Кбайт @@ -126,6 +133,7 @@ OK TrackerInitialState ОК Could not open \"%name\". The file is mistakenly marked as executable. FSUtils Невозможно открыть \"%name\". Файл ошибочно помечен как исполняемый. Add-ons ContainerWindow Дополнения Edit templates… TemplatesMenu Изменить шаблоны… +Finish: %time - Over %finishtime left StatusWindow Окончание: %time - Осталось более %finishtime An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils Объект с именем \"%name\" уже существует в этой папке. Заменить его ссылкой, которую вы создаёте?" Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils Извините, но на принимающем разделе недостаточно свободного места для копирования выделенных файлов. Could not open \"%document\" with application \"%app\" (%error). FSUtils Невозможно открыть \"%document\" приложением \"%app\" (%error). @@ -186,7 +194,6 @@ New DeskWindow Создать Open InfoWindow Открыть 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Заменить все -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Программа \"%appname\" не поддерживает открытие документов данного типа. Вы действительно хотите открыть документ в ней? Если вы знаете, что программа поддерживает этот тип документов, то вы должны связаться с разработчиком программы и просить его обновить список типов, поддерживаемых программой. Preparing to restore items… StatusWindow Подготовка к восстановлению файлов… Replace other file WidgetAttributeText Заменить существующий файл Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Некоторые из выбранных объектов не могут быть перемещены в корзину. Хотите ли вы вместо этого удалить эти объекты? (Эту операцию будет невозможно отменить) @@ -197,6 +204,7 @@ Could not find application \"%appname\" OpenWithWindow Невозможно н The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Выбранный объект не может быть перемещён в корзину. Хотите ли вы вместо этого удалить его? (Эту операцию будет невозможно отменить) Invert SelectionWindow Инвертировать Save Query as template… FindPanel Сохранить запрос как шаблон… +rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) переименуете Find FindPanel Найти Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Переместить Get info ContainerWindow Информация @@ -244,6 +252,7 @@ Trash TrackerSettingsWindow Корзина Unmount ContainerWindow Отключить Copy layout ContainerWindow Копировать вид папки label too long PoseView слишком длинное имя +Finish: %time StatusWindow Осталось: %time Cancel Tracker Отмена Sorry, you cannot edit that attribute. WidgetAttributeText Извините, но вы не можете изменить этот атрибут. Name ContainerWindow Имя @@ -264,6 +273,7 @@ Unknown WidgetAttributeText Неизвестно Could not open \"%document\" (Missing symbol: %symbol). \n FSUtils Невозможно открыть \"%document\" (Отсутствует символ: %symbol). \n by name FindPanel по имени Creating links: StatusWindow Создание ссылок: +Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Переименовать Paused: click to resume or stop StatusWindow Пауза: нажмите повторно для продолжения Preferred for %type OpenWithWindow Предпочтительный для %type GiB WidgetAttributeText Гбайт @@ -286,6 +296,7 @@ Previously mounted disks AutoMounterSettings Подключенные ране %Ld B WidgetAttributeText %Ld байт copying FSUtils копируемый Error copying folder \"%name\":\n\t%error\n\nWould you like to continue? FSUtils Ошибка при копировании папки \"%name\":\n\t%error\n\nВы хотите продолжить? +move FSUtils As in 'if you move this folder...' (en) 'Wird dieser Ordner verschoben...' (de) Переместите Show Disks icon SettingsView Показывать значок дисков Mount VolumeWindow Подключить Cancel PoseView Отмена @@ -301,6 +312,7 @@ Permissions ContainerWindow Права moving FSUtils перемещаемый Identify InfoWindow Опознать Recent folders ContainerWindow Недавнюю папку +rename InfoWindow As in 'to rename this folder...' (en) 'Um diesen Ordner umzubenennen...' (de) переименовать Close all ContainerWindow Закрыть все Include trash FindPanel Включая корзину Query template FindPanel Шаблон запроса diff --git a/data/catalogs/kits/tracker/sk.catkeys b/data/catalogs/kits/tracker/sk.catkeys index 2103668adf..756249b60a 100644 --- a/data/catalogs/kits/tracker/sk.catkeys +++ b/data/catalogs/kits/tracker/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-libtracker 3968420507 +1 slovak x-vnd.Haiku-libtracker 4051148499 common B_COMMON_DIRECTORY spoločné OK WidgetAttributeText OK Icon view VolumeWindow Zobrazenie ikon @@ -170,7 +170,6 @@ Edit favorites… FilePanelPriv Upraviť obľúbené… Create relative link ContainerWindow Vytvoriť relatívny odkaz Copy ContainerWindow Kopírovať Size PoseView Veľkosť -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Ak %ifYouDoAction domovský priečinok, %osName sa nemusí správať korektne! Ste si istý, že to chcete? Ak chcete napriek tomu %toDoAction domovský priečinok, podržte kláves Shift a kliknite na „%toConfirmAction“. Location OpenWithWindow Umiestnenie Force identify ContainerWindow Vynútiť identifikáciu Duplicate ContainerWindow Duplikovať @@ -194,7 +193,6 @@ New DeskWindow Nový Open InfoWindow Otvoriť 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Nahradiť všetky -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Aplikácia „%appname“ nepodporuje typ dokumentu, ktorý sa pokúšate otvoriť. Ste si istý, že chcete pokračovať? Ak viete, že aplikácia tento typ dokumentu podporuje, mali by ste kontaktovať dodávateľa aplikácie a požiadať ho, aby aktualizoval aplikáciu, aby uvádzala tento typ dokumentu ako podporovaný. Preparing to restore items… StatusWindow Prebieha príprava na obnovenie položiek… Replace other file WidgetAttributeText Nahradiť iný súbor Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Niektoré z vybraných položiek nemožno presunúť do Koša. Chcete ich namiesto toho zmazať? (Túto operáciu nemožno vrátiť.) @@ -219,7 +217,6 @@ Name PoseView Názov Group FilePermissionsView Skupina Version: InfoWindow Verzia: Created: InfoWindow Vytvorené: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Ak %ifYouDoAction nastavenia MIME, %osName sa nemusí správať korektne! Ste si istý, že to chcete? Ak chcete napriek tomu %toDoAction nastavenia MIME, kliknite na „%toConfirmAction“. \nShould this be fixed? FSUtils \nMalo by sa to opraviť? Copying: StatusWindow Kopíruje sa: Capacity: InfoWindow Kapacita: @@ -279,7 +276,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Premenovať Paused: click to resume or stop StatusWindow Pozastavené: kliknutím môžete pokračovať alebo zastaviť Preferred for %type OpenWithWindow Preferovaná pre %type GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Ak %ifYouDoAction spoločný priečinok, %osName sa nemusí správať korektne! Ste si istý, že to chcete? Ak chcete napriek tomu %toDoAction spoločný priečinok, podržte kláves Shift a kliknite na „%toConfirmAction“. There was an error deleting \"%name\":\n\t%error FSUtils Vyskytla sa chyba pri mazaní „%name“:\n\t%error Paste FilePanelPriv Vložiť Copy more ContainerWindow Kopírovať viac @@ -406,7 +402,6 @@ Select… FilePanelPriv Vybrať… Don't move files to Trash SettingsView Nepresúvať súbory do Koša There was an error resolving the link. Tracker Vyskytla sa chyba pri preklade odkazu. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Ak %ifYouDoAction systémový priečinok, %osName sa nemusí správať korektne! Ste si istý, že to chcete? Ak chcete napriek tomu %toDoAction systémový priečinok alebo jeho obsah, podržte kláves Shift a kliknite na „%toConfirmAction“. You can't move or copy the trash. FSUtils Nemôžete presunúť alebo skopírovať Kôš. ends with SelectionWindow končí Volume icons TrackerSettingsWindow Ikony zväzkov @@ -428,7 +423,6 @@ Modified ContainerWindow Zmenené Edit Query template FindPanel Upraviť šablónu Požiadavky Prompt FSUtils Výzva Edit query ContainerWindow Upraviť Požiadavku -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Ak %ifYouDoAction konfiguračný priečinok, %osName sa nemusí správať korektne! Ste si istý, že to chcete? Ak chcete napriek tomu %toDoAction konfiguračný priečinok, kliknite na „%toConfirmAction“. Find… ContainerWindow Nájsť… Create a Query FindPanel Vytvoriť Požiadavku Move to Trash FSUtils Presunúť do Koša @@ -447,7 +441,6 @@ Mount ContainerWindow Pripojiť %capacity (%used used -- %free free) InfoWindow %capacity (%used využité -- %free voľné) Cancel FSClipBoard Zrušiť Cut more ContainerWindow Vystrihnúť viac -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Ak %ifYouDoAction priečinok nastavení, %osName sa nemusí správať korektne! Ste si istý, že to chcete? Ak chcete napriek tomu %toDoAction priečinok nastavení, kliknite na „%toConfirmAction“. Deleting: StatusWindow Maže sa: Empty Trash InfoWindow Vyprázdniť Kôš Add FindPanel Pridať diff --git a/data/catalogs/kits/tracker/uk.catkeys b/data/catalogs/kits/tracker/uk.catkeys index cd5e037410..883663544d 100644 --- a/data/catalogs/kits/tracker/uk.catkeys +++ b/data/catalogs/kits/tracker/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-libtracker 2162044751 +1 ukrainian x-vnd.Haiku-libtracker 2244772743 common B_COMMON_DIRECTORY common OK WidgetAttributeText Гаразд Icon view VolumeWindow У вигляді іконок @@ -167,7 +167,6 @@ Edit favorites… FilePanelPriv Редагувати вибране… Create relative link ContainerWindow Створити відносне посилання Copy ContainerWindow Копіювати Size PoseView Розмір -If you %ifYouDoAction the home folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Якщо ви %ifYouDoAction теку home, %osName може працювати неправильно! Ви впевнені, що хочете це зробити? Щоб все одно %toDoAction домашню теку, клацніть \"%toConfirmAction\", утримуючи натиснутим Shift. Location OpenWithWindow Розташування Force identify ContainerWindow Ідентифікувати примусово Duplicate ContainerWindow Дублювати @@ -191,7 +190,6 @@ New DeskWindow Новий Open InfoWindow Відкрити 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils Замінити все -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Програма \"%appname\" не підтримує тип документу який ви хочете відкрити. Ви впевнені що хочете продовжити? Якщо ви знаєте що додаток підтримує тип документу, вам потрібно зконтактуватися з його розробниками і запитати про обновлення списку документів що він підтримує. Preparing to restore items… StatusWindow Підготовка до відновлення елементів… Replace other file WidgetAttributeText Замінити інший файл Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView Деякі з вибраних елементів не можуть бути переміщені до корзини. Можливо ви хочете видалити їх все одно? (Операція необоротна.) @@ -216,7 +214,6 @@ Name PoseView Ім'я Group FilePermissionsView Група Version: InfoWindow Версія: Created: InfoWindow Створений: -If you %ifYouDoAction the mime settings, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the mime settings anyway, click \"%toConfirmAction\". FSUtils Якщо ви %ifYouDoAction параметри MIME, %osName може працювати неправильно! Ви впевнені, що хочете це зробити? Щоб все одно %toDoAction параметри MIME, клацніть \"%toConfirmAction\". \nShould this be fixed? FSUtils \nЧи треба це виправити? Copying: StatusWindow Копіювання: Capacity: InfoWindow Ємність: @@ -275,7 +272,6 @@ Rename TextWidget Button label, 'Rename' (en), 'Umbenennen' (de) Перейме Paused: click to resume or stop StatusWindow Зупинено: натисніть щоб відновити або зупинити Preferred for %type OpenWithWindow Бажаний для %type GiB WidgetAttributeText GiB -If you %ifYouDoAction the common folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Якщо ви %ifYouDoAction теку common, %osName може працювати неправильно! Ви впевнені, що хочете це зробити? Щоб все одно %toDoAction спільну теку, клацніть \"%toConfirmAction\", утримуючи натиснутим Shift. There was an error deleting \"%name\":\n\t%error FSUtils Виникла помилка при видаленні \"%name\":\n\t%error Paste FilePanelPriv Вставити Copy more ContainerWindow Копіювати ще @@ -402,7 +398,6 @@ Select… FilePanelPriv Вибрати… Don't move files to Trash SettingsView Не переміщайте файли до Кошика There was an error resolving the link. Tracker Виникла проблема відтворення посилання. %BytesPerSecond/s StatusWindow %BytesPerSecond/s -If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName! Are you sure you want to do this? To %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Якщо ви %ifYouDoAction теку system або її вміст, ви не зможете завантажити %osName! Ви впевнені, що хочете це зробити? Щоб все одно %toDoAction системну теку або ї вміст, клацніть \"%toConfirmAction\", утримуючи натиснутим Shift. You can't move or copy the trash. FSUtils Ви не можете копіювати або переміщати Кошик. ends with SelectionWindow закінчити з Volume icons TrackerSettingsWindow Іконки томів @@ -424,7 +419,6 @@ Modified ContainerWindow Змінений Edit Query template FindPanel Редагувати запит шаблону Prompt FSUtils Підказка Edit query ContainerWindow Редагувати запит -If you %ifYouDoAction the config folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the config folder anyway, click \"%toConfirmAction\". FSUtils Якщо ви %ifYouDoAction теку config, %osName може працювати неправильно! Ви впевнені, що хочете це зробити? Щоб все одно %toDoAction теку конфігурації, клацніть \"%toConfirmAction\". Find… ContainerWindow Знайти… Create a Query FindPanel Створити запит Move to Trash FSUtils Перемістити до Кошика @@ -443,7 +437,6 @@ Mount ContainerWindow Підмонтувати %capacity (%used used -- %free free) InfoWindow %capacity (%used викор. -- %free вільно) Cancel FSClipBoard Відмінити Cut more ContainerWindow Вирізати ще -If you %ifYouDoAction the settings folder, %osName may not behave properly! Are you sure you want to do this? To %toDoAction the settings folder anyway, click \"%toConfirmAction\". FSUtils Якщо ви %ifYouDoAction теку settings, %osName може працювати неправильно! Ви впевнені, що хочете це зробити? Щоб все одно %toDoAction теку параметрів, клацніть \"%toConfirmAction\". Deleting: StatusWindow Видалення: Empty Trash InfoWindow Очистити Кошик Add FindPanel Додати diff --git a/data/catalogs/kits/tracker/zh-Hans.catkeys b/data/catalogs/kits/tracker/zh-Hans.catkeys index 3a458ebeae..c23ae24c85 100644 --- a/data/catalogs/kits/tracker/zh-Hans.catkeys +++ b/data/catalogs/kits/tracker/zh-Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-libtracker 3343389761 +1 english x-vnd.Haiku-libtracker 2125023871 common B_COMMON_DIRECTORY 常用 OK WidgetAttributeText 确定 Icon view VolumeWindow 图标视图 @@ -185,7 +185,6 @@ New DeskWindow 新建 Open InfoWindow 打开 64 x 64 ContainerWindow 64 x 64 Replace all FSUtils 替换所有 -The application \"%appname\" does not support the type of document you are about to open. Are you sure you want to proceed? If you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow \"%appname\" 程序不支持即将打开的文档类型。您确定要继续吗?如果您知道,此文件支持该文档类型,您应该联系程序发行商,并要求他们更新程序以支持您的文档类型。 Preparing to restore items… StatusWindow 准备恢复项目... Replace other file WidgetAttributeText 替换其他文件 Some of the selected items cannot be moved to the Trash. Would you like to delete them instead? (This operation cannot be reverted.) PoseView 某些选中项目无法移动到垃圾箱。您希望删除它们吗?(该操作将无法恢复。) diff --git a/data/catalogs/preferences/3drendering/ru.catkeys b/data/catalogs/preferences/3drendering/ru.catkeys index 8c952c4a5a..4aac618125 100644 --- a/data/catalogs/preferences/3drendering/ru.catkeys +++ b/data/catalogs/preferences/3drendering/ru.catkeys @@ -1,7 +1,8 @@ -1 russian x-vnd.Haiku-3DRendering 1539891217 +1 russian x-vnd.Haiku-3DRendering 1725618140 List stack size: Capabilities Размер стека списка: Information InfoView Информация Max. clipping planes: Capabilities Максимальное количество отсечений: +GL version: InfoView Версия GL: Max. texture units: Capabilities Максимальное количество текстурных блоков: Renderer name: InfoView Название рендера: Vendor name: InfoView Имя поставщика: @@ -19,6 +20,7 @@ GLUT API version: InfoView Версия GLUT API: Texture stack size: Capabilities Размер стека текстуры: Max. evaluators equation order: Capabilities Максимальный оценочный блок команд: Max. 3D texture size: Capabilities Максимальный размер 3D текстуры: +3D Rendering System name 3D Отрисовка Capabilities Capabilities Возможности Max. recommended index elements: Capabilities Максимальное рекомендованное количество индексов: Available Extensions Доступно diff --git a/data/catalogs/preferences/appearance/fi.catkeys b/data/catalogs/preferences/appearance/fi.catkeys index a4ec3a38ae..80fd41c1ea 100644 --- a/data/catalogs/preferences/appearance/fi.catkeys +++ b/data/catalogs/preferences/appearance/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-Appearance 3882211276 +1 finnish x-vnd.Haiku-Appearance 1557879521 Plain font: Font view Pelkkä kirjasin: Control highlight Colors tab Kontrollin korostus Control border Colors tab Kontrollin reuna @@ -27,6 +27,7 @@ Window border Colors tab Ikkunaraja Window tab text Colors tab Ikkunakahvan teksti Document text Colors tab Dokumentin teksti Navigation pulse Colors tab Navigoinnin välke +Window decorator: DecorSettingsView Ikkunan kehystäjä: Selected menu item text Colors tab Valitun valikkovalinnan teksti Menu background Colors tab Valikon tausta OK DecorSettingsView Valmis @@ -50,6 +51,7 @@ LCD subpixel AntialiasingSettingsView LCD alipikseli Selected menu item border Colors tab Valitun valikkovalinnan reuna Strong AntialiasingSettingsView Vahva Panel text Colors tab Paneelin teksti +Decorators APRWindow Kehykset Monospaced fonts only AntialiasingSettingsView Vain monospace-kirjasimet Antialiasing menu AntialiasingSettingsView Reunanpehmennysvalikko Fonts APRWindow Kirjasimet diff --git a/data/catalogs/preferences/appearance/pl.catkeys b/data/catalogs/preferences/appearance/pl.catkeys index 2cf5361b48..adf15e43a0 100644 --- a/data/catalogs/preferences/appearance/pl.catkeys +++ b/data/catalogs/preferences/appearance/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Appearance 3882211276 +1 polish x-vnd.Haiku-Appearance 1557879521 Plain font: Font view Czcionka zwykła: Control highlight Colors tab Podkreślenie kontrolki Control border Colors tab Obramowanie kontrolki @@ -27,6 +27,7 @@ Window border Colors tab Obramowanie okna Window tab text Colors tab Tekst zakładki okna Document text Colors tab Tekst dokumentu Navigation pulse Colors tab Puls nawigacji +Window decorator: DecorSettingsView Dekorator okna: Selected menu item text Colors tab Tekst zaznaczonego elementu menu Menu background Colors tab Tło menu OK DecorSettingsView OK @@ -50,6 +51,7 @@ LCD subpixel AntialiasingSettingsView Podpikselowe LCD Selected menu item border Colors tab Obramowanie zaznaczonego elementu menu Strong AntialiasingSettingsView Silny Panel text Colors tab Tekst panelu +Decorators APRWindow Dekoratory Monospaced fonts only AntialiasingSettingsView Tylko czcionki o stałej szerokości Antialiasing menu AntialiasingSettingsView Menu antyaliasingu Fonts APRWindow Czcionki diff --git a/data/catalogs/preferences/appearance/ru.catkeys b/data/catalogs/preferences/appearance/ru.catkeys index 10cf64498f..0d056c7f3b 100644 --- a/data/catalogs/preferences/appearance/ru.catkeys +++ b/data/catalogs/preferences/appearance/ru.catkeys @@ -1,4 +1,5 @@ -1 russian x-vnd.Haiku-Appearance 4135695718 +1 russian x-vnd.Haiku-Appearance 1557879521 +Plain font: Font view Простой шрифт: Control highlight Colors tab Подсветка элемента Control border Colors tab Граница элемента Antialiasing type: AntialiasingSettingsView Тип сглаживания: @@ -12,6 +13,7 @@ Off AntialiasingSettingsView Выключить Choose Decorator DecorSettingsView Выберите декоратор Success Colors tab Успех Inactive window tab text Colors tab Текст заголовка неактивного окна +About Decorator DecorSettingsView Об этом декораторе Failure Colors tab Неудача Hinting menu AntialiasingSettingsView Корректировка (хинтинг) Document background Colors tab Фон документа @@ -21,25 +23,36 @@ Tooltip background Colors tab Фон подсказки Selected menu item background Colors tab Фон выбранного пункта меню Antialiasing APRWindow Сглаживание Navigation base Colors tab Основа навигации +Window border Colors tab Рамка окна Window tab text Colors tab Текст заголовка окна Document text Colors tab Текст документа Navigation pulse Colors tab Навигационная пульсация +Window decorator: DecorSettingsView Оконный декоратор: Selected menu item text Colors tab Текст выделенного пункта меню Menu background Colors tab Фон меню OK DecorSettingsView ОК +Size: Font Selection view Размер: Panel background Colors tab Фон панели +Menu font: Font view Шрифт меню: Colors APRWindow Цвета Control background Colors tab Фон элемента Inactive window tab Colors tab Заголовок неактивного окна Appearance System name Внешний вид +Fixed font: Font view Моноширинный шрифт: +The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. Эй, жлоб! Где туз? Прячь юных съёмщиц в шкаф. Reduce colored edges filter strength: AntialiasingSettingsView Фильтрация цветных краев: +Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Субпиксельное сглаживание в комбинации с уточнением глифов недоступно в этой сборке Haiku во избежание возможных патентных проблем. Для включения этой возможности вам придется собрать Haiku самостоятельно, включив особые опции в заголовке конфигурации libfreetype. Control text Colors tab Текст элемента Tooltip text Colors tab Текст подсказки +Bold font: Font view Жирный шрифт: +Inactive window border Colors tab Рамка неактивного окна Menu item text Colors tab Текст пункта меню LCD subpixel AntialiasingSettingsView Субпиксельное сглаживание Selected menu item border Colors tab Рамка выделенного пункта меню Strong AntialiasingSettingsView Сильная Panel text Colors tab Текст панели +Decorators APRWindow Декораторы Monospaced fonts only AntialiasingSettingsView Только моноширинные шрифты Antialiasing menu AntialiasingSettingsView Сглаживание меню +Fonts APRWindow Шрифты Glyph hinting: AntialiasingSettingsView Уточнение: diff --git a/data/catalogs/preferences/datatranslations/ru.catkeys b/data/catalogs/preferences/datatranslations/ru.catkeys index b166c1de3e..b3e53603ac 100644 --- a/data/catalogs/preferences/datatranslations/ru.catkeys +++ b/data/catalogs/preferences/datatranslations/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-DataTranslations 3820343452 +1 russian x-vnd.Haiku-DataTranslations 458105477 DataTranslations System name Трансляция данных Cancel DataTranslations Отмена Name: DataTranslations Имя: @@ -14,5 +14,6 @@ Info DataTranslations Инфо Path: DataTranslations Путь: The new translator has been installed successfully. DataTranslations Новый транслятор был успешно установлен. DataTranslations - Error DataTranslations Трансляция данных - ошибка +Ok DataTranslations OК OK DataTranslations ОК Version: DataTranslations Версия: diff --git a/data/catalogs/preferences/keymap/ru.catkeys b/data/catalogs/preferences/keymap/ru.catkeys index dfe16e77d9..cac8499d46 100644 --- a/data/catalogs/preferences/keymap/ru.catkeys +++ b/data/catalogs/preferences/keymap/ru.catkeys @@ -1,23 +1,38 @@ -1 russian x-vnd.Haiku-Keymap 140876782 +1 russian x-vnd.Haiku-Keymap 4022885915 +Shift: Modifier keys window Shift key role name Shift: Revert Modifier keys window Вернуть Tilde trigger Keymap window Тильда Grave trigger Keymap window Апостроф +Role Modifier keys window As in the role of a modifier key Роль Select dead keys Keymap window Выбор мертвых клавиш +Cancel Modifier keys window Отмена Quit Keymap window Выйти Switch shortcut keys to Haiku mode Keymap window Переключить раскладку в режим Haiku Circumflex trigger Keymap window Циркумфлекс Diaeresis trigger Keymap window Диерезис +Disabled Modifier keys window Do nothing Отключено Open… Keymap window Открыть… System: Keymap window Системные: +Set modifier keys… Keymap window Назначить клавиши-модификаторы… +Option: Modifier keys window Option key role name Option: Switch shortcut keys Keymap window Переключение горячих клавиш +Shift key Modifier keys window Label of key above Ctrl, usually Shift Клавиша Shift User: Keymap window Пользовательские: +Key Modifier keys window As in a computer keyboard key Клавиша +Ctrl key Modifier keys window Label of key farthest from the spacebar, usually Ctrle.g. Strg for German keyboard Клавиша Ctrl +Control: Modifier keys window Control key role name Control: Sample and clipboard: Keymap window Пример и буфер обмена: +Alt/Opt key Modifier keys window Label of Alt key (PC)/Option key (Mac) Клавиша Alt/Opt Layout Keymap window Макет Switch shortcut keys to Windows/Linux mode Keymap window Переключить раскладку в режим Windows/Linux Revert Keymap window Вернуть +Command: Modifier keys window Command key role name Command: Save as… Keymap window Сохранить как… +Win/Cmd key Modifier keys window Label of the \"Windows\" key (PC)/Command key (Mac) Клавиша Win/Cmd File Keymap window Файл (Current) Keymap window (Текущая) Font Keymap window Шрифт Keymap System name Раскладка +Set modifier keys Modifier keys window Назначить клавиши-модификаторы +Modifier keys Modifier keys window Клавиши-модификаторы Acute trigger Keymap window Аксант эгю diff --git a/data/catalogs/preferences/mail/ru.catkeys b/data/catalogs/preferences/mail/ru.catkeys index 7d0762bbe8..30f22d075e 100644 --- a/data/catalogs/preferences/mail/ru.catkeys +++ b/data/catalogs/preferences/mail/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Mail 3957822883 +1 russian x-vnd.Haiku-Mail 2592587573 Mail checking Config Window Проверка почты Settings Config Window Настройки Never Config Window show status window никогда @@ -6,6 +6,7 @@ Only when dial-up is connected Config Window Только при наличии While sending and receiving Config Window во время отправки и получения days Config Window дней Incoming Config Window Входящие +Server name: E-Mail Имя сервера: OK Config Window ОК Start mail services on startup Config Window Запускать почтовые службы при загрузке E-mail address: E-Mail E-mail адрес: diff --git a/data/catalogs/preferences/printers/ru.catkeys b/data/catalogs/preferences/printers/ru.catkeys index b69e31167a..f8a53ad1b7 100644 --- a/data/catalogs/preferences/printers/ru.catkeys +++ b/data/catalogs/preferences/printers/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Be-PRNT 2906062670 +1 russian x-vnd.Be-PRNT 2674539197 Printer: %printer_name%\nDriver: %driver%\n TestPageView Принтер: %printer_name%\nДрайвер: %driver%\n Waiting JobListView Ожидание Print test page PrintersWindow Пробная страница @@ -18,6 +18,7 @@ Processing JobListView Обрабатывается Red TestPageView Красный Printer name: AddPrinterDialog Название принтера: Driver: %driver% PrinterListView Драйвер: %driver% + pending jobs. PrinterListView нет заданий в очереди. Black TestPageView Черный Restart job PrintersWindow Перезапустить Add AddPrinterDialog Добавить diff --git a/data/catalogs/preferences/time/ru.catkeys b/data/catalogs/preferences/time/ru.catkeys index 51d15b69c6..d6bb32c543 100644 --- a/data/catalogs/preferences/time/ru.catkeys +++ b/data/catalogs/preferences/time/ru.catkeys @@ -1,4 +1,5 @@ -1 russian x-vnd.Haiku-Time 472387788 +1 russian x-vnd.Haiku-Time 3249243267 +GMT (UNIX compatible) Time По Гринвичу (совместимо с UNIX) OK Time ОК Asia Time Азия \nNow: Time \nСейчас: @@ -13,6 +14,7 @@ Pacific Time Тихий океан Add Time Добавить Date and time Time Дата и время about Time о программе +Local time (Windows compatible) Time Местное время (совместимо с Windows) Message receiving failed Time Не удалось получить данные Set time zone Time Установить часовой пояс Waiting for answer failed Time Истекло время ожидания @@ -28,6 +30,7 @@ Time System name Время America Time Америка Reset Time Сбросить Synchronize at boot Time Синхронизировать при загрузке +Time & Date, written by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\tJulun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2012, Haiku. Time Дата & Время, разработан:\n\n\t Andrew Edward McCall\n\t Mike Berg\n\t Julun\n\t Philippe Saint-Pierre\n\nВсе права защищены 2004-2012, Haiku. Received invalid time Time Получено неверное время Antarctica Time Антарктида The following error occured while synchronizing:r\n%s: %s Time При синхронизации произошла следующая ошибка:r\n%s: %s From aabe9c1b92090f5ce7ac519fd36f89e343fff9ff Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Thu, 26 Jul 2012 17:06:35 +0200 Subject: [PATCH 49/65] Generate translation catalogs for WebPositive Change suggested by Rene Gollent --- src/apps/webpositive/Jamfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/apps/webpositive/Jamfile b/src/apps/webpositive/Jamfile index c13bb56bf9..bba0c66f86 100644 --- a/src/apps/webpositive/Jamfile +++ b/src/apps/webpositive/Jamfile @@ -69,3 +69,9 @@ Application WebPositive : : WebPositive.rdef ; + +DoCatalogs WebPositive : + x-vnd.Haiku-WebPositive + : + $(sources) +; From 059d39f1b913001ab3added2dfdbb8ce0a3914a3 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Thu, 26 Jul 2012 18:37:40 +0200 Subject: [PATCH 50/65] Localize strings in the GLife screensaver --- .../screen_savers/glife/GLifeConfig.cpp | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/add-ons/screen_savers/glife/GLifeConfig.cpp b/src/add-ons/screen_savers/glife/GLifeConfig.cpp index d303e2a4b2..e287f28802 100644 --- a/src/add-ons/screen_savers/glife/GLifeConfig.cpp +++ b/src/add-ons/screen_savers/glife/GLifeConfig.cpp @@ -10,6 +10,7 @@ #include "GLifeConfig.h" +#include #include #include #include @@ -19,6 +20,9 @@ #include "GLifeState.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "GLife ScreenSaver" + // ------------------------------------------------------ // GLifeConfig Class Constructor Definition @@ -32,23 +36,24 @@ GLifeConfig::GLifeConfig(BRect frame, GLifeState* pglsState) // Info text BStringView* name = new BStringView(frame, B_EMPTY_STRING, - "OpenGL \"Game of Life\"", B_FOLLOW_LEFT); + B_TRANSLATE("OpenGL \"Game of Life\""), B_FOLLOW_LEFT); BStringView* author = new BStringView(frame, B_EMPTY_STRING, - "by Aaron Hill", B_FOLLOW_LEFT); + B_TRANSLATE("by Aaron Hill"), B_FOLLOW_LEFT); // Sliders fGridDelay = new BSlider(frame, "GridDelay", - "Grid Life Delay: ", + B_TRANSLATE("Grid Life Delay: "), new BMessage(kGridDelay), 0, 4, B_BLOCK_THUMB); fGridDelay->SetHashMarks(B_HASH_MARKS_BOTTOM); - fGridDelay->SetLimitLabels("None", "4x"); + fGridDelay->SetLimitLabels(B_TRANSLATE("None"), B_TRANSLATE_COMMENT("4x", + "This is a factor: the x represents 'times'")); fGridDelay->SetValue(pglsState->GridDelay()); fGridDelay->SetHashMarkCount(5); fGridBorder = new BSlider(frame, "GridBorder", - "Grid Border: ", + B_TRANSLATE("Grid Border: "), new BMessage(kGridBorder), 0, 10, B_BLOCK_THUMB); @@ -58,7 +63,7 @@ GLifeConfig::GLifeConfig(BRect frame, GLifeState* pglsState) fGridBorder->SetHashMarkCount(11); fGridWidth = new BSlider(frame, "GridWidth", - "Grid Width: ", + B_TRANSLATE("Grid Width: "), new BMessage(kGridWidth), 10, 100, B_BLOCK_THUMB); @@ -68,7 +73,7 @@ GLifeConfig::GLifeConfig(BRect frame, GLifeState* pglsState) fGridWidth->SetHashMarkCount(10); fGridHeight = new BSlider(frame, "GridHeight", - "Grid Height: ", + B_TRANSLATE("Grid Height: "), new BMessage(kGridHeight), 10, 100, B_BLOCK_THUMB); @@ -121,22 +126,26 @@ void GLifeConfig::_UpdateLabels() { char newLabel[64]; - snprintf(newLabel, sizeof(newLabel), "Grid Width: %li", + snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Width: %li"), fGridWidth->Value()); fGridWidth->SetLabel(newLabel); - snprintf(newLabel, sizeof(newLabel), "Grid Height: %li", + snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Height: %li"), fGridHeight->Value()); fGridHeight->SetLabel(newLabel); - snprintf(newLabel, sizeof(newLabel), "Grid Border: %li", + snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Border: %li"), fGridBorder->Value()); fGridBorder->SetLabel(newLabel); char delay[16]; if (fGridDelay->Value() <= 0) - sprintf(delay, "none"); - else - sprintf(delay, "%" B_PRId32 "x", fGridDelay->Value()); - snprintf(newLabel, sizeof(newLabel), "Grid Life Delay: %s", delay); + sprintf(delay, B_TRANSLATE("none")); + else { + sprintf(delay, "%" B_PRId32, fGridDelay->Value()); + sprintf(delay, B_TRANSLATE_COMMENT("%sx", + "This is a factor: the x represents 'times'"), delay); + } + snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Life Delay: %s"), + delay); fGridDelay->SetLabel(newLabel); } From a2021beee2e3391ebb2b2da1ed29438b6c4338e9 Mon Sep 17 00:00:00 2001 From: Adrien Destugues - PulkoMandy Date: Thu, 26 Jul 2012 23:16:47 +0200 Subject: [PATCH 51/65] Fix display for basic stuff. --- src/apps/serialconnect/SerialWindow.cpp | 8 +--- src/apps/serialconnect/TermView.cpp | 50 ++++++++++++++++--------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/apps/serialconnect/SerialWindow.cpp b/src/apps/serialconnect/SerialWindow.cpp index b26f9f60a4..62d360e1af 100644 --- a/src/apps/serialconnect/SerialWindow.cpp +++ b/src/apps/serialconnect/SerialWindow.cpp @@ -54,6 +54,8 @@ SerialWindow::SerialWindow() BMenuItem* portItem = new BMenuItem(buffer, message); connect->AddItem(portItem); + + portItem->SetTarget(be_app); } #if SUPPORTS_MODEM @@ -130,12 +132,6 @@ void SerialWindow::MessageReceived(BMessage* message) fTermView->PushBytes(bytes, length); break; } - case kMsgOpenPort: - { - // Forward message to application - be_app->PostMessage(message); - break; - } default: BWindow::MessageReceived(message); } diff --git a/src/apps/serialconnect/TermView.cpp b/src/apps/serialconnect/TermView.cpp index da04c90b68..cb655251ea 100644 --- a/src/apps/serialconnect/TermView.cpp +++ b/src/apps/serialconnect/TermView.cpp @@ -21,7 +21,7 @@ TermView::TermView() GetFontHeight(&height); fFontHeight = height.ascent + height.descent + height.leading; fFontWidth = be_fixed_font->StringWidth("X"); - fTerm = vterm_new(kDefaultWidth, kDefaultHeight); + fTerm = vterm_new(kDefaultHeight, kDefaultWidth); vterm_parser_set_utf8(fTerm, 1); @@ -52,20 +52,34 @@ void TermView::Draw(BRect updateRect) VTermPos pos; font_height height; GetFontHeight(&height); - MovePenTo(kBorderSpacing, height.ascent + kBorderSpacing); - for (pos.row = updatedChars.start_row; pos.row < updatedChars.end_row; - pos.row++) - { + for (pos.row = updatedChars.start_row; pos.row <= updatedChars.end_row; + pos.row++) { + float x = updatedChars.start_col * fFontWidth + kBorderSpacing; + float y = pos.row * fFontHeight + height.ascent + kBorderSpacing; + MovePenTo(x, y); + for (pos.col = updatedChars.start_col; - pos.col < updatedChars.end_col; pos.col++) - { - VTermScreenCell cell; - vterm_screen_get_cell(fTermScreen, pos, &cell); + pos.col <= updatedChars.end_col;) { + if (pos.col < 0 || pos.row < 0 || pos.col >= kDefaultWidth + || pos.row >= kDefaultHeight) { + DrawString(" "); + pos.col ++; + } else { + VTermScreenCell cell; + vterm_screen_get_cell(fTermScreen, pos, &cell); - char buffer[6]; - wcstombs(buffer, (wchar_t*)cell.chars, 6); + if (cell.chars[0] == 0) { + DrawString(" "); + pos.col ++; + } else { + char buffer[VTERM_MAX_CHARS_PER_CELL]; + wcstombs(buffer, (wchar_t*)cell.chars, + VTERM_MAX_CHARS_PER_CELL); - DrawString(buffer); + DrawString(buffer); + pos.col += cell.width; + } + } } } } @@ -74,9 +88,9 @@ void TermView::Draw(BRect updateRect) void TermView::GetPreferredSize(float* width, float* height) { if (width != NULL) - *width = kDefaultWidth * fFontWidth; + *width = kDefaultWidth * fFontWidth + 2 * kBorderSpacing; if (height != NULL) - *height = kDefaultHeight * fFontHeight; + *height = kDefaultHeight * fFontHeight + 2 * kBorderSpacing; } @@ -103,7 +117,7 @@ VTermRect TermView::PixelsToGlyphs(BRect pixels) const rect.end_col = (int)ceil(pixels.right / fFontWidth); rect.start_row = (int)floor(pixels.top / fFontHeight); rect.end_row = (int)ceil(pixels.bottom / fFontHeight); - +/* printf( "TOP %d ch < %f px\n" "BTM %d ch < %f px\n" @@ -114,7 +128,7 @@ VTermRect TermView::PixelsToGlyphs(BRect pixels) const rect.start_col, pixels.left, rect.end_col, pixels.right ); - +*/ return rect; } @@ -128,7 +142,7 @@ BRect TermView::GlyphsToPixels(const VTermRect& glyphs) const rect.right = glyphs.end_col * fFontWidth; rect.OffsetBy(kBorderSpacing, kBorderSpacing); - +/* printf( "TOP %d ch > %f px (%f)\n" "BTM %d ch > %f px\n" @@ -139,7 +153,7 @@ BRect TermView::GlyphsToPixels(const VTermRect& glyphs) const glyphs.start_col, rect.left, fFontWidth, glyphs.end_col, rect.right ); - +*/ return rect; } From a3b73ff9d1848ab3a6cba17e80fc521bb0d407ad Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Thu, 26 Jul 2012 23:28:31 +0200 Subject: [PATCH 52/65] Fix insets --- src/apps/installer/InstallerWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 61ca7b315b..707e03dc5d 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -252,6 +252,7 @@ InstallerWindow::InstallerWindow() .Add(logoGroup) .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER)) .AddGroup(B_VERTICAL, spacing) + .SetInsets(spacing) .AddGrid(new BGridView(0.0f, spacing)) .Add(fSrcMenuField->CreateLabelLayoutItem(), 0, 0) .Add(fSrcMenuField->CreateMenuBarLayoutItem(), 1, 0) @@ -267,7 +268,6 @@ InstallerWindow::InstallerWindow() .End() .AddGroup(B_HORIZONTAL, spacing) - .SetInsets(spacing) .Add(fLaunchDriveSetupButton) .AddGlue() .Add(fBeginButton); From 47b44bbedb1a865f522191905b3d5f7067826691 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Thu, 26 Jul 2012 23:55:39 +0200 Subject: [PATCH 53/65] Fix SerialConnect gcc4 build. --- src/apps/serialconnect/SerialApp.cpp | 5 ++++- src/apps/serialconnect/SerialWindow.cpp | 2 +- src/apps/serialconnect/SerialWindow.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/apps/serialconnect/SerialApp.cpp b/src/apps/serialconnect/SerialApp.cpp index 2153571f9b..67a96fa929 100644 --- a/src/apps/serialconnect/SerialApp.cpp +++ b/src/apps/serialconnect/SerialApp.cpp @@ -54,7 +54,7 @@ void SerialApp::MessageReceived(BMessage* message) const char* bytes; ssize_t size; - message->FindData("data", B_RAW_TYPE, &(const void*)bytes, &size); + message->FindData("data", B_RAW_TYPE, (const void**)&bytes, &size); fSerialPort.Write(bytes, size); } default: @@ -85,6 +85,9 @@ status_t SerialApp::PollSerial(void*) be_app_messenger.SendMessage(serialData); } } + + // Should not reach this line anyway... + return B_OK; } const char* SerialApp::kApplicationSignature diff --git a/src/apps/serialconnect/SerialWindow.cpp b/src/apps/serialconnect/SerialWindow.cpp index 62d360e1af..0dafcd6ebf 100644 --- a/src/apps/serialconnect/SerialWindow.cpp +++ b/src/apps/serialconnect/SerialWindow.cpp @@ -128,7 +128,7 @@ void SerialWindow::MessageReceived(BMessage* message) { const char* bytes; ssize_t length; - message->FindData("data", B_RAW_TYPE, &(const void*)bytes, &length); + message->FindData("data", B_RAW_TYPE, (const void**)&bytes, &length); fTermView->PushBytes(bytes, length); break; } diff --git a/src/apps/serialconnect/SerialWindow.h b/src/apps/serialconnect/SerialWindow.h index d6fed4f9da..557b0eabc1 100644 --- a/src/apps/serialconnect/SerialWindow.h +++ b/src/apps/serialconnect/SerialWindow.h @@ -13,7 +13,7 @@ class TermView; class SerialWindow: public BWindow { public: - SerialWindow::SerialWindow(); + SerialWindow(); void MessageReceived(BMessage* message); From 1484de58a8b3493604e3ea2a0b7eba97bb2bc4e4 Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Thu, 26 Jul 2012 22:51:45 -0400 Subject: [PATCH 54/65] Focus the Team Monitor list view on Show(). Fixes #8775. --- .../devices/keyboard/TeamMonitorWindow.cpp | 10 ++++++++-- .../input_server/devices/keyboard/TeamMonitorWindow.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp b/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp index 80984041ea..25706d9cd9 100644 --- a/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp +++ b/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.cpp @@ -260,6 +260,14 @@ TeamMonitorWindow::~TeamMonitorWindow() } +void +TeamMonitorWindow::Show() +{ + fListView->MakeFocus(); + BWindow::Show(); +} + + void TeamMonitorWindow::MessageReceived(BMessage* msg) { @@ -416,8 +424,6 @@ TeamMonitorWindow::UpdateList() } fRestartButton->SetEnabled(!desktopRunning); - - fListView->MakeFocus(); } diff --git a/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.h b/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.h index 69c551e4c0..6a79829b65 100644 --- a/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.h +++ b/src/add-ons/input_server/devices/keyboard/TeamMonitorWindow.h @@ -27,6 +27,7 @@ public: virtual ~TeamMonitorWindow(); virtual void MessageReceived(BMessage* message); + virtual void Show(); virtual bool QuitRequested(); void Enable(); From 8c663339c8ddc0d07a9261d58b64fe35273a8656 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Fri, 27 Jul 2012 09:14:49 +0200 Subject: [PATCH 55/65] Update translations from Pootle --- .../mail_daemon/outbound_protocols/smtp/nl.catkeys | 5 ++++- data/catalogs/apps/aboutsystem/be.catkeys | 4 +++- data/catalogs/apps/aboutsystem/de.catkeys | 4 +++- data/catalogs/apps/aboutsystem/ja.catkeys | 3 ++- data/catalogs/apps/diskprobe/ru.catkeys | 2 +- data/catalogs/apps/icon-o-matic/be.catkeys | 3 ++- data/catalogs/apps/installer/be.catkeys | 5 ++++- data/catalogs/apps/mediaplayer/be.catkeys | 3 ++- data/catalogs/kits/tracker/be.catkeys | 9 ++++++++- data/catalogs/kits/tracker/ja.catkeys | 12 ++++++------ data/catalogs/preferences/appearance/be.catkeys | 5 ++++- data/catalogs/preferences/appearance/nl.catkeys | 3 ++- data/catalogs/preferences/keymap/nl.catkeys | 6 +++++- 13 files changed, 46 insertions(+), 18 deletions(-) diff --git a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/nl.catkeys b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/nl.catkeys index 2a60e46bb2..b3f826421a 100644 --- a/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/nl.catkeys +++ b/data/catalogs/add-ons/mail_daemon/outbound_protocols/smtp/nl.catkeys @@ -1,6 +1,8 @@ -1 dutch; flemish x-vnd.Haiku-SMTP 1052586247 +1 dutch; flemish x-vnd.Haiku-SMTP 2740407895 SMTP server: ConfigView SMTP server: +STARTTLS ConfigView STARTTLS Error while logging in to %serv smtp Fout bij het inloggen in %serv +Unencrypted ConfigView Onversleuteld . The server says:\n smtp . De server zegt:\n ESMTP ConfigView ESMTP Connecting to server… smtp Verbinden met de server... @@ -10,4 +12,5 @@ Destination: ConfigView Doel: : Connection refused or host not found. smtp : Verbinding afgewezen of host niet gevonden. None ConfigView Geen POP3 before SMTP ConfigView POP3 voor SMTP +SSL ConfigView SSL . The server said:\n smtp . De server zei:\n diff --git a/data/catalogs/apps/aboutsystem/be.catkeys b/data/catalogs/apps/aboutsystem/be.catkeys index 6807d4d21c..b791d37ef1 100644 --- a/data/catalogs/apps/aboutsystem/be.catkeys +++ b/data/catalogs/apps/aboutsystem/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-About 3434348710 +1 belarusian x-vnd.Haiku-About 519561637 Copyright © 1999-2010 by the authors of Gutenprint. All rights reserved. AboutView Аўтарскае права © 1999-2010 by the authors of Gutenprint. Правы захаваныя. Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (асабіста за ядро NewOS)\n BSD (4-clause) AboutView BSD (4 часткі) @@ -11,6 +11,7 @@ The Haiku-Ports team\n AboutView Каманда Haiku-Ports\n Copyright © 1998-2003 Daniel Veillard. All rights reserved. AboutView Аўтарскае права © 1998-2003 Daniel Veillard. Правы захаваныя. %d MiB used (%d%%) AboutView %d MiB выкарыстана (%d%%) Website, marketing & documentation:\n AboutView Web-сайт, маркетынг і дакументацыя:\n +GNU LGPL v2.1 AboutView GNU LGPL v2.1 AboutSystem System name Пра Сістэму MIT (no promotion) AboutView MIT (без рэкламы) Copyright © 2003 Peter Hanappe and others. AboutView Аўтарскае права © 2003 Peter Hanappe і іншыя. @@ -39,6 +40,7 @@ Copyright © 2002-2004 Vivek Mohan. All rights reserved. AboutView Аўтарс %.2f GHz AboutView %.2f ГГц Memory: AboutView Памяць: Copyright © 1996-1997 Jeff Prosise. All rights reserved. AboutView Аўтарскае права © 1996-1997 Jeff Prosise. Правы захаваныя. +Copyright © 2006-2012 Kentaro Fukuchi AboutView Copyright © 2006-2012 Kentaro Fukuchi Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. This software is based in part on the work of the Independent JPEG Group. AboutView Аўтарскае права © 1994-2009, Thomas G. Lane, Guido Vollbeding. This software is based in part on the work of the Independent JPEG Group. Past maintainers:\n AboutView Былыя дагляднікі:\n \n\nSpecial thanks to:\n AboutView \n\nАсабістыя падзякі:\n diff --git a/data/catalogs/apps/aboutsystem/de.catkeys b/data/catalogs/apps/aboutsystem/de.catkeys index 7d070e2a90..42711949cf 100644 --- a/data/catalogs/apps/aboutsystem/de.catkeys +++ b/data/catalogs/apps/aboutsystem/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-About 3434348710 +1 german x-vnd.Haiku-About 519561637 Copyright © 1999-2010 by the authors of Gutenprint. All rights reserved. AboutView Copyright © 1999-2010 durch die Autoren von Gutenprint. Alle Rechte vorbehalten. Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (und seinen NewOS-Kernel)\n BSD (4-clause) AboutView 4-Klausel-BSD @@ -11,6 +11,7 @@ The Haiku-Ports team\n AboutView Das Haiku-Ports-Team\n Copyright © 1998-2003 Daniel Veillard. All rights reserved. AboutView Copyright © 1998-2003 Daniel Veillard. Alle Rechte vorbehalten. %d MiB used (%d%%) AboutView %d MiB benutzt (%d%%) Website, marketing & documentation:\n AboutView Webseite, Marketing & Dokumentation:\n +GNU LGPL v2.1 AboutView GNU LGPL v2.1 AboutSystem System name Über Haiku MIT (no promotion) AboutView MIT (ohne Werbeklausel) Copyright © 2003 Peter Hanappe and others. AboutView Copyright © 2003 Peter Hanappe und andere. @@ -39,6 +40,7 @@ Copyright © 2002-2004 Vivek Mohan. All rights reserved. AboutView Copyright © %.2f GHz AboutView %.2f GHz Memory: AboutView Arbeitsspeicher: Copyright © 1996-1997 Jeff Prosise. All rights reserved. AboutView Copyright © 1996-1997 Jeff Prosise. Alle Rechte vorbehalten. +Copyright © 2006-2012 Kentaro Fukuchi AboutView Copyright © 2006-2012 Kentaro Fukuchi Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. This software is based in part on the work of the Independent JPEG Group. AboutView Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. Die Software basiert teilweise auf der Arbeit der Independent JPEG Group. Past maintainers:\n AboutView Ehemalige Betreuer:\n \n\nSpecial thanks to:\n AboutView \n\nBesonderer Dank an:\n diff --git a/data/catalogs/apps/aboutsystem/ja.catkeys b/data/catalogs/apps/aboutsystem/ja.catkeys index 0c69112038..6d6d6fb6c9 100644 --- a/data/catalogs/apps/aboutsystem/ja.catkeys +++ b/data/catalogs/apps/aboutsystem/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-About 3434348710 +1 japanese x-vnd.Haiku-About 2330231195 Copyright © 1999-2010 by the authors of Gutenprint. All rights reserved. AboutView Copyright © 1999-2010 Gutenprintの著者たち. All rights reserved. Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (ならびに彼が開発した NewOS カーネル)\n BSD (4-clause) AboutView BSD (4条項) @@ -11,6 +11,7 @@ The Haiku-Ports team\n AboutView Haiku-Ports チーム\n Copyright © 1998-2003 Daniel Veillard. All rights reserved. AboutView Copyright © 1998-2003 Daniel Veillard. All rights reserved. %d MiB used (%d%%) AboutView %d MiB 使用中 (%d%%) Website, marketing & documentation:\n AboutView ウェブサイト、広報 & ドキュメント:\n +GNU LGPL v2.1 AboutView GNU LGPL v2.1 AboutSystem System name このシステムについて MIT (no promotion) AboutView MIT (非商用利用) Copyright © 2003 Peter Hanappe and others. AboutView Copyright © 2003 Peter Hanappe他. diff --git a/data/catalogs/apps/diskprobe/ru.catkeys b/data/catalogs/apps/diskprobe/ru.catkeys index 05b09797d7..00c2a4ea13 100644 --- a/data/catalogs/apps/diskprobe/ru.catkeys +++ b/data/catalogs/apps/diskprobe/ru.catkeys @@ -59,7 +59,7 @@ Boolean value: TypeEditors Булевое значение: 8 bit palette TypeEditors 8 битная палитра Fit ProbeView Size of fonts, fits to available room Подгонять Probe device OpenWindow Исследовать устройство - (native) ProbeView (нативный) + (native) ProbeView (родной) Unknown format TypeEditors Неизвестный формат Hexadecimal FindWindow A menu item, as short as possible, noun is recommended if it is shorter than adjective. Шестнадцатеричный MIME type: TypeEditors MIME тип: diff --git a/data/catalogs/apps/icon-o-matic/be.catkeys b/data/catalogs/apps/icon-o-matic/be.catkeys index 2c9e4e71b2..08002c4ed5 100644 --- a/data/catalogs/apps/icon-o-matic/be.catkeys +++ b/data/catalogs/apps/icon-o-matic/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.haiku-icon_o_matic 3736361491 +1 belarusian x-vnd.haiku-icon_o_matic 4233739176 Select All Icon-O-Matic-PathManipulator Выбраць Усё Add Style Icon-O-Matic-AddStylesCmd Дадаць Стыль Color (#%02x%02x%02x) Style name after dropping a color Колер (#%02x%02x%02x) @@ -117,6 +117,7 @@ Gradient Icon-O-Matic-StyleTypes Градыентны Min LOD Icon-O-Matic-PropertyNames Мін. LOD BEOS:ICON Attribute Icon-O-Matic-SavePanel Атрыбут BEOS:ICON Invert selection Icon-O-Matic-Properties Інвертаваць выдзяленне +Drop shapes Icon-O-Matic-ShapesList Падаючыя формы Export as… Icon-O-Matic-Menu-File Экспартаваць як... Transformation Transformation Трансфармацыя Click on an object in Empty property list - 1st line Клікніце па аб'екце у diff --git a/data/catalogs/apps/installer/be.catkeys b/data/catalogs/apps/installer/be.catkeys index d35d4ef9a7..25317dae59 100644 --- a/data/catalogs/apps/installer/be.catkeys +++ b/data/catalogs/apps/installer/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Installer 3440510165 +1 belarusian x-vnd.Haiku-Installer 3488795908 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp Дадайце ў канец кожнага з ніжэйшых запісаў меню нешта падобнае да гэтага: Are you sure you want to abort the installation and restart the system? InstallerWindow Сапраўды спыніць усталёўку і перазагрузіць сістэму? \t}\n\n InstallerApp \t}\n\n @@ -38,6 +38,7 @@ Boot sector successfully written. InstallProgress Загрузачны сект Performing installation. InstallProgress Выконваецца ўсталёўка. scanning… InstallerWindow сканіраванне... Set up boot menu InstallerWindow Наладзіць меню запуску +2.1) GRUB (since os-prober v1.44)\n InstallerApp 2.1) GRUB (пачынаючы з os-prober v1.44)\n The first logical partition always has the number \"4\", regardless of the number of primary partitions.\n\n InstallerApp Першы лагічны падзел заўсёды пад нумарам \"4\", нягледзячы на нумары асноўных падзелаў.\n\n GRUB's naming scheme is still: (hdN,n)\n\n InstallerApp Для GRUB схема імёнаў тая ж: (hdN,n)\n\n \tsudo /boot/grub/menu.lst\n\n InstallerApp \tsudo <пажаданы рэдактар> /boot/grub/menu.lst\n\n @@ -69,6 +70,7 @@ Installer System name Усталёўшчык You can't install the contents of a disk onto itself. Please choose a different disk. InstallProgress Вы не можаце капіяваць файлы на зыходны дыск. Выберыце, калі ласка, іншы. ??? InstallerWindow Unknown currently copied item ??? \"n\" is the partition number, which for GRUB 2 starts with \"1\"\n InstallerApp \"n\" - нумар падзелу, у GRUB 2 пачынаецца з \"1\"\n +Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku should be recognized out of the box. To add Haiku to the GRUB menu, open a Terminal and enter:\n\n InstallerApp Пачынаючы з os-prober v1.44 (т.б. Ubuntu 11.04 ці пазней), Haiku павінна падтрымлівацца штатна. Каб дадаць Haiku у меню GRUB, адкрыйце Тэрмінал і ўвядзіце:\n\n Quit DriveSetup InstallerWindow Выйсці з DriveSetup \"N\" is the hard disk number, starting with \"0\".\n InstallerApp \"N\" - нумар дыска, пачынаецца з \"0\".\n Hide optional packages InstallerWindow Схаваць дадатковыя пакункі @@ -111,6 +113,7 @@ So below the heading that must not be edited, add something similar to these lin Are you sure you want to to stop the installation? InstallerWindow Сапраўды астанавіць усталёўку? Onto: InstallerWindow На: Please close the Boot Manager window before closing the Installer window. InstallerWindow Калі ласка, закрыйце Boot Manager перад закрыццём Усталёўшчыка. +3) When you successfully boot into Haiku for the first time, make sure to read our \"Welcome\" and \"Userguide\" documentation. There are links on the Desktop and in WebPositive's bookmarks.\n\n InstallerApp 3) Пасля першай паспяховай загрузкі Haiku, азнаёмцеся, калі ласка з дакументацыей ў \"Welcome\" і \"Userguide\" файлах. Спасылі на іх знаходзяцца на рабочым стале і ў закладках WebPositive.\n\n Tools InstallerWindow Прылады The mount point could not be retrieved. InstallProgress Не ўдалося атрымаць пункт мантавання. The target volume is not empty. Are you sure you want to install anyway?\n\nNote: The 'system' folder will be a clean copy from the source volume, all other folders will be merged, whereas files and links that exist on both the source and target volume will be overwritten with the source volume version. InstallProgress Дыск прызначэння не пусты. Сапраўды жадаеце усталяваць туды?\n\nЗаметка: каталог 'system' будзе поўнай копіяй каталога з крыніцы, усе іншыя каталогі будуць сумешчаны, існуючыя файлы будуць замененыя на версіі з крыніцы. diff --git a/data/catalogs/apps/mediaplayer/be.catkeys b/data/catalogs/apps/mediaplayer/be.catkeys index 24e74486e1..59f2149766 100644 --- a/data/catalogs/apps/mediaplayer/be.catkeys +++ b/data/catalogs/apps/mediaplayer/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-MediaPlayer 607764928 +1 belarusian x-vnd.Haiku-MediaPlayer 2389197979 raw audio MediaPlayer-InfoWin нефарматаване аўдыё Location MediaPlayer-InfoWin Месцазнаходжанне 1.85 : 1 (American) MediaPlayer-Main 1.85 : 1 (Амерыка) @@ -70,6 +70,7 @@ Select all MediaPlayer-PlaylistWindow Пазначыць усе Move Entry MediaPlayer-MovePLItemsCmd Перамясціць элемент Open MediaPlayer-PlaylistWindow Адкрыць Stop playing. MediaPlayer-Main Спыніць прайгранне. +The file '%filename' could not be opened.\n\n MediaPlayer-Main Файл '%filename' немагчыма адкрыць.\n\n Error: MediaPlayer-RemovePLItemsCmd Памылка: Audio MediaPlayer-InfoWin Аўдыё Internal error (malformed message). Saving the playlist failed. MediaPlayer-PlaylistWindow Унутраная памылка (няправільнае паведамленне). Плэйліст не захаваны. diff --git a/data/catalogs/kits/tracker/be.catkeys b/data/catalogs/kits/tracker/be.catkeys index 83f354aa16..a881cca4dc 100644 --- a/data/catalogs/kits/tracker/be.catkeys +++ b/data/catalogs/kits/tracker/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-libtracker 3778030996 +1 belarusian x-vnd.Haiku-libtracker 2415801168 common B_COMMON_DIRECTORY агульны OK WidgetAttributeText ОК Icon view VolumeWindow Від іконак @@ -20,6 +20,7 @@ Recent documents FavoritesMenu Нядаўнія дакменты Modified QueryPoseView Зменены Created ContainerWindow Створаны Error %error loading add-On %name. ContainerWindow Памылка %error пры загрузцы add-On %name +If you %ifYouDoAction the settings folder, %osName may not behave properly!\n\nAre you sure you want to do this? FSUtils Калi вы %ifYouDoAction каталог наладак, %osName можа паводзіць сябе неадэкватна!\n\nВы ўпэўнены што жадаеце зрабіць гэта? contains SelectionWindow месціць Sorry, you can't save things at the root of your system. FilePanelPriv Прабачце, вы не можаце захоўваць нешта ў карнявым каталозе сістэмы. Show shared volumes on Desktop SettingsView Паказаць на Дэсктопе тамы з агульным доступам @@ -89,6 +90,7 @@ Cut FilePanelPriv Выразаць Replace FilePanelPriv Замяніць Select all VolumeWindow Выбраць усё Opens with: InfoWindow Адкрыць з: +If you %ifYouDoAction the mime settings, %osName may not behave properly!\n\nAre you sure you want to do this? FSUtils Калi вы %ifYouDoAction наладкі mime, %osName можа паводзіць сябе неадэкватна!\n\nВы ўпэўнены што жадаеце зрабіць гэта? Open ContainerWindow Адкрыць Error calculating folder size. InfoWindow Памылка пры падліку памеру каталога. New folder FilePanelPriv Новы каталог @@ -117,6 +119,7 @@ Move to Trash ContainerWindow Перамясціць у Сметніцу Move to ContainerWindow Перамясціць у Create %s clipping PoseView Стварыць %s выразку Set new link target InfoWindow Пазначыць новы адрас спасылкі +If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName!\n\nAre you sure you want to do this?\n\nTo %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction сістэмны каталог або яго змеціва, вы не зможаце запусціць %osName!\n\nВы ўпэўнены што жадаеце зрабіць гэта?\n\nКаб %toDoAction сістэмны каталог, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". Save as Query template: FindPanel Захаваць як шаблон Запыту preferences B_PREFERENCES_DIRECTORY наладкі Cancel FSUtils Адмена @@ -140,6 +143,7 @@ Could not open \"%document\" with application \"%app\" (%error). FSUtils Не Sorry, saving more than one item is not allowed. FilePanelPriv Прабачце, захаванне больш чым аднаго элемента не дазволена. Searching for disks to mount… StatusWindow Пошук дыскаў для мантавання... New folder FSUtils Новы каталог +If you %ifYouDoAction the common folder, %osName may not behave properly!\n\nAre you sure you want to do this?\n\nTo %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction агульны каталог, %osName можа паводзіць сябе неадэкватна!\n\nВы ўпэўнены што жадаеце зрабіць гэта?\n\nКаб %toDoAction агульны каталог, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". Free space color SettingsView Колер свабоднага месца Cut ContainerWindow Выразаць Remove FindPanel Выдаліць @@ -249,6 +253,7 @@ The file \"%name\" already exists in the specified folder. Do you want to replac Cancel ContainerWindow Адмена Only the boot disk AutoMounterSettings Толькі загрузачны дыск Trash TrackerSettingsWindow Сметніца +If you %ifYouDoAction the config folder, %osName may not behave properly!\n\nAre you sure you want to do this? FSUtils Калi вы %ifYouDoAction каталог канфігурацыі, %osName можа паводзіць сябе неадэкватна!\n\nВы ўпэўнены што жадаеце зрабіць гэта? Unmount ContainerWindow Размантаваць Copy layout ContainerWindow Капіяваць макет label too long PoseView метка занадта доўгая @@ -334,6 +339,7 @@ Handles any file OpenWithWindow Працуе з любым файлам Get info FilePanelPriv Атрымаць інфармацыю 32 x 32 DeskWindow 32 x 32 Cancel FilePanelPriv Адмена +The application \"%appname\" does not support the type of document you are about to open.\nAre you sure you want to proceed?\n\nIf you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow Праграма \"%appname\" не падтрымлівае тып дакументу які вы жадаеце адкрыць.\n\nСапраўды жадаеце пряцягваць?\n\nКалі вы упэўнены, што праграма сумяшчальна з гэтым тыпам файлаў, паведаміце пра гэта аўтарам праграмы і папрасіце дакументаваць гэта ў новай версіі. Disks DirMenu Дыскі New folder %ld FSUtils Новы каталог %ld All BeOS disks AutoMounterSettings Усе дыскі BeOS @@ -371,6 +377,7 @@ Preferences… ContainerWindow Наладкі... Move PoseView Перамясціць Open and make preferred OpenWithWindow Адкрыць і зрабіць пажаданай Are you sure you want to delete the selected item(s)? This operation cannot be reverted. FSUtils Вы ўпэўненыя, что жадаеце беззваротна выдаліць выбраны(я) элемент(ы)? +If you %ifYouDoAction the home folder, %osName may not behave properly!\n\nAre you sure you want to do this?\n\nTo %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils Калi вы %ifYouDoAction хатні каталог, %osName можа паводзіць сябе неадэкватна!\n\nВы ўпэўнены што жадаеце зрабіць гэта?\n\nКаб %toDoAction хатні каталог, націсніце клавiшу Shift і клікніце \"%toConfirmAction\". Add-ons DeskWindow Дапаўненні Name FindPanel Імя And FindPanel І diff --git a/data/catalogs/kits/tracker/ja.catkeys b/data/catalogs/kits/tracker/ja.catkeys index 0fee4290ee..e1cd451e5b 100644 --- a/data/catalogs/kits/tracker/ja.catkeys +++ b/data/catalogs/kits/tracker/ja.catkeys @@ -7,13 +7,13 @@ Identify ContainerWindow ファイル形式を判別 Warning space color SettingsView 空き容量警告の色 Close VolumeWindow 閉じる Open OpenWithWindow 開く -Tracker status StatusWindow Trackerの動作状況 +Tracker status StatusWindow Tracker の動作状況 Eject when unmounting AutoMounterSettings マウント解除時メディアを取り出す Window ContainerWindow ウィンドウ -Decrease size ContainerWindow サイズを縮小 +Decrease size ContainerWindow サイズを小さく Mini icon view VolumeWindow ミニアイコン表示 You must have at least one attribute showing. PoseView 最低一つの属性を表示する必要があります。 -Permissions InfoWindow アクセス許可 +Permissions InfoWindow アクセス権 Invert selection VolumeWindow 選択範囲を反転 Recent documents FavoritesMenu 最近開いたドキュメント Modified QueryPoseView 更新日時 @@ -69,8 +69,8 @@ Mount server error AutoMounterSettings マウントサーバーエラー Search FindPanel 検索 Preparing to empty Trash… StatusWindow ごみ箱を空にする準備をしています… Disks Model ディスク -Create link ContainerWindow 指定先にリンクを作成 -Decrease size DeskWindow サイズを縮小 +Create link ContainerWindow リンクの作成 +Decrease size DeskWindow サイズを小さく Size ContainerWindow サイズ All disks AutoMounterSettings 全パーティション Would you like to find some other suitable application? FSUtils 他に適切なアプリケーションを検索しますか? @@ -99,7 +99,7 @@ rename TextWidget As in 'if you rename this folder...' (en) 'Wird dieser Ordner You cannot replace a folder or a symbolic link with a file. FSUtils フォルダーをリンクまたはファイルと置き換えることはできません。 Show space bars on volumes SettingsView ディスクの容量グラフを表示する Invert selection ContainerWindow 選択範囲を反転 -Increase size DeskWindow サイズを拡大 +Increase size DeskWindow サイズを大きく Resize to fit ContainerWindow 最適な表示サイズに変更 %Ld bytes WidgetAttributeText %Ld バイト Add printer… ContainerWindow プリンターの追加… diff --git a/data/catalogs/preferences/appearance/be.catkeys b/data/catalogs/preferences/appearance/be.catkeys index 4f36949761..a8d7676bea 100644 --- a/data/catalogs/preferences/appearance/be.catkeys +++ b/data/catalogs/preferences/appearance/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Appearance 3882211276 +1 belarusian x-vnd.Haiku-Appearance 2671941221 Plain font: Font view Просты шрыфт: Control highlight Colors tab Выдзяленне кнопак Control border Colors tab Аблямоўка кнопак @@ -27,9 +27,11 @@ Window border Colors tab Мяжа вакна Window tab text Colors tab Тэкст загалоўку акна Document text Colors tab Тэкст дакументу Navigation pulse Colors tab Колер падсветкі навігацыі +Window decorator: DecorSettingsView Дэкаратар вокнаў: Selected menu item text Colors tab Тэкст пазначанага пункту меню Menu background Colors tab Фон меню OK DecorSettingsView Так +Control mark Colors tab Адзнакі кнопак Size: Font Selection view Памер: Panel background Colors tab Фон панэлі Menu font: Font view Шрыфт меню: @@ -50,6 +52,7 @@ LCD subpixel AntialiasingSettingsView Субпіксельнае (LCD) Selected menu item border Colors tab Аблямоўка пазначанага пункту меню Strong AntialiasingSettingsView Жырны Panel text Colors tab Тэкст панэлі +Decorators APRWindow Дэкаратары Monospaced fonts only AntialiasingSettingsView Толькі монашырынныя шрыфты Antialiasing menu AntialiasingSettingsView Меню згладжвання Fonts APRWindow Шрыфты diff --git a/data/catalogs/preferences/appearance/nl.catkeys b/data/catalogs/preferences/appearance/nl.catkeys index b504db4511..dd98a530ec 100644 --- a/data/catalogs/preferences/appearance/nl.catkeys +++ b/data/catalogs/preferences/appearance/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-Appearance 3882211276 +1 dutch; flemish x-vnd.Haiku-Appearance 1933110481 Plain font: Font view Standaardlettertype: Control highlight Colors tab Keuze-accent Control border Colors tab Keuzerand @@ -27,6 +27,7 @@ Window border Colors tab Vensterrand Window tab text Colors tab Tekst venstertab Document text Colors tab Tekst document Navigation pulse Colors tab Puls navigatie +Window decorator: DecorSettingsView Vensterdecorator: Selected menu item text Colors tab Tekst geselecteerd menu-item Menu background Colors tab Achtergrond menu OK DecorSettingsView OK diff --git a/data/catalogs/preferences/keymap/nl.catkeys b/data/catalogs/preferences/keymap/nl.catkeys index d8237ada6b..46f599e5c1 100644 --- a/data/catalogs/preferences/keymap/nl.catkeys +++ b/data/catalogs/preferences/keymap/nl.catkeys @@ -1,12 +1,16 @@ -1 dutch; flemish x-vnd.Haiku-Keymap 140876782 +1 dutch; flemish x-vnd.Haiku-Keymap 247520798 +Shift: Modifier keys window Shift key role name Shift: Revert Modifier keys window Herstellen Tilde trigger Keymap window Tilde-activeerder Grave trigger Keymap window Accent grave-activeerder +Role Modifier keys window As in the role of a modifier key Rol Select dead keys Keymap window Selecteer dode toetsen +Cancel Modifier keys window Annuleren Quit Keymap window Afsluiten Switch shortcut keys to Haiku mode Keymap window Snelkoppelingstoetsen omschakelen naar Haiku-modus Circumflex trigger Keymap window Circumflex-activeerder Diaeresis trigger Keymap window Trema-activeerder +Disabled Modifier keys window Do nothing Uitgeschakeld Open… Keymap window Openen... System: Keymap window Systeem: Switch shortcut keys Keymap window Snelkoppelingstoetsen omschakelen From 71e5d26b5fb7e6a6b4cfb5b25633003b5499f964 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 27 Jul 2012 22:56:01 +0200 Subject: [PATCH 56/65] Debugger: Add utility class SignalSet --- src/apps/debugger/util/SignalSet.h | 152 +++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 src/apps/debugger/util/SignalSet.h diff --git a/src/apps/debugger/util/SignalSet.h b/src/apps/debugger/util/SignalSet.h new file mode 100644 index 0000000000..082c9026e8 --- /dev/null +++ b/src/apps/debugger/util/SignalSet.h @@ -0,0 +1,152 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef SIGNAL_SET_H +#define SIGNAL_SET_H + + +#include + + +class SignalSet { +public: + SignalSet(); + SignalSet(int signal); + SignalSet(const sigset_t& signals); + + void SetTo(const sigset_t& signals); + void SetTo(int signal); + + const sigset_t& Signals() const { return fSignals; } + + bool ContainsSignal(int signal) const; + + SignalSet& AddSignal(int signal); + SignalSet& AddSignals(const SignalSet& signals); + SignalSet& RemoveSignal(int signal); + SignalSet& RemoveSignals(const SignalSet& signals); + + status_t BlockInCurrentThread( + SignalSet* oldMask = NULL) const; + status_t UnblockInCurrentThread( + SignalSet* oldMask = NULL) const; + status_t SetCurrentThreadSignalMask( + SignalSet* oldMask = NULL) const; + + static SignalSet CurrentThreadSignalMask(); + +private: + sigset_t fSignals; +}; + + +SignalSet::SignalSet() +{ + sigemptyset(&fSignals); +} + + +SignalSet::SignalSet(int signal) +{ + SetTo(signal); +} + + +SignalSet::SignalSet(const sigset_t& signals) + : + fSignals(signals) +{ +} + + +void +SignalSet::SetTo(const sigset_t& signals) +{ + fSignals = signals; +} + + +void +SignalSet::SetTo(int signal) +{ + sigemptyset(&fSignals); + sigaddset(&fSignals, signal); +} + + +bool +SignalSet::ContainsSignal(int signal) const +{ + return sigismember(&fSignals, signal) != 0; +} + + +SignalSet& +SignalSet::AddSignal(int signal) +{ + sigaddset(&fSignals, signal); + return *this; +} + + +SignalSet& +SignalSet::AddSignals(const SignalSet& signals) +{ + // NOTE: That is not portable. + fSignals |= signals.fSignals; + return *this; +} + + +SignalSet& +SignalSet::RemoveSignal(int signal) +{ + sigdelset(&fSignals, signal); + return *this; +} + + +SignalSet& +SignalSet::RemoveSignals(const SignalSet& signals) +{ + // NOTE: That is not portable. + fSignals &= ~signals.fSignals; + return *this; +} + + +status_t +SignalSet::BlockInCurrentThread(SignalSet* oldMask) const +{ + return pthread_sigmask(SIG_BLOCK, &fSignals, + oldMask != NULL ? &oldMask->fSignals : NULL); +} + + +status_t +SignalSet::UnblockInCurrentThread(SignalSet* oldMask) const +{ + return pthread_sigmask(SIG_UNBLOCK, &fSignals, + oldMask != NULL ? &oldMask->fSignals : NULL); +} + + +status_t +SignalSet::SetCurrentThreadSignalMask(SignalSet* oldMask) const +{ + return pthread_sigmask(SIG_SETMASK, &fSignals, + oldMask != NULL ? &oldMask->fSignals : NULL); +} + + +/*static*/ SignalSet +SignalSet::CurrentThreadSignalMask() +{ + SignalSet signals; + pthread_sigmask(SIG_BLOCK, NULL, &signals.fSignals); + return signals; +} + + +#endif // SIGNAL_SET_H From f58478507cd4406bd5b2ddb415f4f6cb43456a86 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 27 Jul 2012 22:57:17 +0200 Subject: [PATCH 57/65] Debugger: In CLI mode block SIGINT in all threads It is supposed to be handled in the input loop thread only (eventually). --- src/apps/debugger/Debugger.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/Debugger.cpp b/src/apps/debugger/Debugger.cpp index bac8ac0d13..888db4acf5 100644 --- a/src/apps/debugger/Debugger.cpp +++ b/src/apps/debugger/Debugger.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -24,6 +24,7 @@ #include "GraphicalUserInterface.h" #include "MessageCodes.h" #include "SettingsManager.h" +#include "SignalSet.h" #include "TeamDebugger.h" #include "TeamsWindow.h" #include "TypeHandlerRoster.h" @@ -558,6 +559,11 @@ CliDebugger::~CliDebugger() bool CliDebugger::Run(const Options& options) { + // Block SIGINT, in this thread so all threads created by it inherit the + // a block mask with the signal blocked. In the input loop the signal will + // be unblocked again. + SignalSet(SIGINT).BlockInCurrentThread(); + // initialize global objects and settings manager status_t error = global_init(); if (error != B_OK) { From eba38eb503254ad8fba4466c6b983b76c3510af1 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 27 Jul 2012 23:04:16 +0200 Subject: [PATCH 58/65] Debugger: Change user interface quit and ask user semantics * UserInterface::SynchronouslyAskUser() is now allowed to return -1 to indicate that the user cannot be asked at this point for whatever reason. The caller needs to handle that case. * UserInterfaceListener::UserInterfaceQuitRequested(): Add new parameter "quitOption" to specify what is supposed to happen. The previous behavior (ask user) is only one of the options. The others are to kill the debugged team or to resume it. --- src/apps/debugger/TeamDebugger.cpp | 69 ++++++++++++------- src/apps/debugger/TeamDebugger.h | 3 +- .../debugger/user_interface/UserInterface.h | 13 +++- .../cli/CommandLineUserInterface.cpp | 2 +- 4 files changed, 58 insertions(+), 29 deletions(-) diff --git a/src/apps/debugger/TeamDebugger.cpp b/src/apps/debugger/TeamDebugger.cpp index 4f3caa5415..f0853fb296 100644 --- a/src/apps/debugger/TeamDebugger.cpp +++ b/src/apps/debugger/TeamDebugger.cpp @@ -707,39 +707,56 @@ TeamDebugger::InspectRequested(target_addr_t address, bool -TeamDebugger::UserInterfaceQuitRequested() +TeamDebugger::UserInterfaceQuitRequested(QuitOption quitOption) { - AutoLocker< ::Team> locker(fTeam); - BString name(fTeam->Name()); - locker.Unlock(); + bool askUser = false; + switch (quitOption) { + case QUIT_OPTION_ASK_USER: + askUser = true; + break; - BString message; - message << "What shall be done about the debugged team '"; - message << name; - message << "'?"; - - name.Remove(0, name.FindLast('/') + 1); - - BString killLabel("Kill "); - killLabel << name; - - BString resumeLabel("Resume "); - resumeLabel << name; - - int32 choice = fUserInterface->SynchronouslyAskUser("Quit Debugger", - message, killLabel, "Cancel", resumeLabel); - - switch (choice) { - case 0: + case QUIT_OPTION_ASK_KILL_TEAM: fKillTeamOnQuit = true; break; - case 1: - return false; - case 2: - // Detach from the team and resume and stopped threads. + + case QUIT_OPTION_ASK_RESUME_TEAM: break; } + if (askUser) { + AutoLocker< ::Team> locker(fTeam); + BString name(fTeam->Name()); + locker.Unlock(); + + BString message; + message << "What shall be done about the debugged team '"; + message << name; + message << "'?"; + + name.Remove(0, name.FindLast('/') + 1); + + BString killLabel("Kill "); + killLabel << name; + + BString resumeLabel("Resume "); + resumeLabel << name; + + int32 choice = fUserInterface->SynchronouslyAskUser("Quit Debugger", + message, killLabel, "Cancel", resumeLabel); + + switch (choice) { + case 0: + fKillTeamOnQuit = true; + break; + case 1: + case -1: + return false; + case 2: + // Detach from the team and resume and stopped threads. + break; + } + } + PostMessage(B_QUIT_REQUESTED); return true; diff --git a/src/apps/debugger/TeamDebugger.h b/src/apps/debugger/TeamDebugger.h index 468c243abf..189a448fc1 100644 --- a/src/apps/debugger/TeamDebugger.h +++ b/src/apps/debugger/TeamDebugger.h @@ -69,7 +69,8 @@ private: UserBreakpoint* breakpoint); virtual void InspectRequested(target_addr_t address, TeamMemoryBlock::Listener* listener); - virtual bool UserInterfaceQuitRequested(); + virtual bool UserInterfaceQuitRequested( + QuitOption quitOption); // JobListener virtual void JobDone(Job* job); diff --git a/src/apps/debugger/user_interface/UserInterface.h b/src/apps/debugger/user_interface/UserInterface.h index 054aba752a..2f69266a02 100644 --- a/src/apps/debugger/user_interface/UserInterface.h +++ b/src/apps/debugger/user_interface/UserInterface.h @@ -61,10 +61,19 @@ public: const char* message, const char* choice1, const char* choice2, const char* choice3) = 0; + // returns -1, if not implemented or user + // cannot be asked }; class UserInterfaceListener { +public: + enum QuitOption { + QUIT_OPTION_ASK_USER, + QUIT_OPTION_ASK_KILL_TEAM, + QUIT_OPTION_ASK_RESUME_TEAM + }; + public: virtual ~UserInterfaceListener(); @@ -95,7 +104,9 @@ public: target_addr_t address, TeamMemoryBlock::Listener* listener) = 0; - virtual bool UserInterfaceQuitRequested() = 0; + virtual bool UserInterfaceQuitRequested( + QuitOption quitOption + = QUIT_OPTION_ASK_USER) = 0; }; diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index a381d676a9..9e27749494 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -207,7 +207,7 @@ CommandLineUserInterface::SynchronouslyAskUser(const char* title, const char* message, const char* choice1, const char* choice2, const char* choice3) { - return 0; + return -1; } From 8fe9f8b2d0e3c8f88406f5720a1d2027638c43b6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 27 Jul 2012 23:41:11 +0200 Subject: [PATCH 59/65] Debugger CLI: Move more stuff to and extend CliContext * Move the libedit interface there and provide nicer to use methods. * Also start adding utility methods for the input loop. It is going to manage all interactions of the input loop with outside events. * Fix the "quit" command. The user is now prompted what to do with the debugged team and the input loop thread avoids reentering the input loop. --- .../user_interface/cli/CliContext.cpp | 141 +++++++++++++++++- .../debugger/user_interface/cli/CliContext.h | 31 +++- .../user_interface/cli/CliQuitCommand.cpp | 26 +++- .../cli/CommandLineUserInterface.cpp | 56 ++----- .../cli/CommandLineUserInterface.h | 8 +- 5 files changed, 204 insertions(+), 58 deletions(-) diff --git a/src/apps/debugger/user_interface/cli/CliContext.cpp b/src/apps/debugger/user_interface/cli/CliContext.cpp index cb099bf4ae..ad14f82919 100644 --- a/src/apps/debugger/user_interface/cli/CliContext.cpp +++ b/src/apps/debugger/user_interface/cli/CliContext.cpp @@ -6,27 +6,160 @@ #include "CliContext.h" +#include + #include "UserInterface.h" +// NOTE: This is a simple work-around for EditLine not having any kind of user +// data field. Hence in _GetPrompt() we don't have access to the context object. +// ATM only one CLI is possible in Debugger, so a static variable works well +// enough. Should that ever change, we would need a thread-safe +// EditLine* -> CliContext* map. +static CliContext* sCurrentContext; + + CliContext::CliContext() : + fLock("CliContext"), fTeam(NULL), - fListener(NULL) + fListener(NULL), + fEditLine(NULL), + fHistory(NULL), + fPrompt(NULL), + fBlockingSemaphore(-1), + fInputLoopWaiting(false), + fTerminating(false) { + sCurrentContext = this; +} + +CliContext::~CliContext() +{ + Cleanup(); + sCurrentContext = NULL; } -void +status_t CliContext::Init(Team* team, UserInterfaceListener* listener) { fTeam = team; fListener = listener; + + status_t error = fLock.InitCheck(); + if (error != B_OK) + return error; + + fBlockingSemaphore = create_sem(0, "CliContext block"); + if (fBlockingSemaphore < 0) + return fBlockingSemaphore; + + fEditLine = el_init("Debugger", stdin, stdout, stderr); + if (fEditLine == NULL) + return B_ERROR; + + fHistory = history_init(); + if (fHistory == NULL) + return B_ERROR; + + HistEvent historyEvent; + history(fHistory, &historyEvent, H_SETSIZE, 100); + + el_set(fEditLine, EL_HIST, &history, fHistory); + el_set(fEditLine, EL_EDITOR, "emacs"); + el_set(fEditLine, EL_PROMPT, &_GetPrompt); + + return B_OK; } void -CliContext::QuitSession() +CliContext::Cleanup() { - fListener->UserInterfaceQuitRequested(); + Terminating(); + + if (fEditLine != NULL) { + el_end(fEditLine); + fEditLine = NULL; + } + + if (fHistory != NULL) { + history_end(fHistory); + fHistory = NULL; + } +} + + +void +CliContext::Terminating() +{ + AutoLocker locker(fLock); + + fTerminating = true; + + if (fBlockingSemaphore >= 0) { + delete_sem(fBlockingSemaphore); + fBlockingSemaphore = -1; + } + + fInputLoopWaiting = false; + + // TODO: Signal the input loop, should it be in PromptUser()! +} + + +const char* +CliContext::PromptUser(const char* prompt) +{ + fPrompt = prompt; + + int count; + const char* line = el_gets(fEditLine, &count); + + fPrompt = NULL; + + return line; +} + + +void +CliContext::AddLineToInputHistory(const char* line) +{ + HistEvent historyEvent; + history(fHistory, &historyEvent, H_ENTER, line); +} + + +void +CliContext::QuitSession(bool killTeam) +{ + AutoLocker locker(fLock); + + sem_id blockingSemaphore = fBlockingSemaphore; + fInputLoopWaiting = true; + + locker.Unlock(); + + fListener->UserInterfaceQuitRequested( + killTeam + ? UserInterfaceListener::QUIT_OPTION_ASK_KILL_TEAM + : UserInterfaceListener::QUIT_OPTION_ASK_RESUME_TEAM); + + while (acquire_sem(blockingSemaphore) == B_INTERRUPTED) { + } +} + + +void +CliContext::WaitForThreadOrUser() +{ + // TODO:... +} + + +/*static*/ const char* +CliContext::_GetPrompt(EditLine* editLine) +{ + return sCurrentContext != NULL ? sCurrentContext->fPrompt : NULL; } diff --git a/src/apps/debugger/user_interface/cli/CliContext.h b/src/apps/debugger/user_interface/cli/CliContext.h index 93d06af3fa..e3617fe6f7 100644 --- a/src/apps/debugger/user_interface/cli/CliContext.h +++ b/src/apps/debugger/user_interface/cli/CliContext.h @@ -6,6 +6,13 @@ #define CLI_CONTEXT_H +#include + // Needed in histedit.h. +#include + +#include + + class Team; class UserInterfaceListener; @@ -13,18 +20,38 @@ class UserInterfaceListener; class CliContext { public: CliContext(); + ~CliContext(); - void Init(Team* team, + status_t Init(Team* team, UserInterfaceListener* listener); + void Cleanup(); + + void Terminating(); + + // service methods for the input loop thread follow Team* GetTeam() const { return fTeam; } - void QuitSession(); + const char* PromptUser(const char* prompt); + void AddLineToInputHistory(const char* line); + void QuitSession(bool killTeam); + + void WaitForThreadOrUser(); private: + static const char* _GetPrompt(EditLine* editLine); + +private: + BLocker fLock; Team* fTeam; UserInterfaceListener* fListener; + EditLine* fEditLine; + History* fHistory; + const char* fPrompt; + sem_id fBlockingSemaphore; + bool fInputLoopWaiting; + volatile bool fTerminating; }; diff --git a/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp b/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp index d3a8cb83f7..49d8d825da 100644 --- a/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp +++ b/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp @@ -6,6 +6,8 @@ #include "CliQuitCommand.h" +#include + #include "CliContext.h" @@ -21,5 +23,27 @@ CliQuitCommand::CliQuitCommand() void CliQuitCommand::Execute(int argc, const char* const* argv, CliContext& context) { - context.QuitSession(); + // Ask the user what to do with the debugged team. + printf("Kill or resume the debugged team?\n"); + for (;;) { + const char* line = context.PromptUser("(k)ill, (r)esume, (c)ancel? "); + if (line == NULL) + return; + + BString trimmedLine(line); + trimmedLine.Trim(); + + if (trimmedLine == "k") { + context.QuitSession(true); + break; + } + + if (trimmedLine == "r") { + context.QuitSession(false); + break; + } + + if (trimmedLine == "d") + break; + } } diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 9e27749494..c00111291f 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -20,11 +20,7 @@ #include "CliThreadsCommand.h" -static const char* -get_prompt(EditLine* editLine) -{ - return "debugger> "; -} +static const char* kDebuggerPrompt = "debugger> "; // #pragma mark - CommandEntry @@ -83,8 +79,6 @@ private: CommandLineUserInterface::CommandLineUserInterface() : fCommands(20, true), - fEditLine(NULL), - fHistory(NULL), fShowSemaphore(-1), fShown(false), fTerminating(false) @@ -96,12 +90,6 @@ CommandLineUserInterface::~CommandLineUserInterface() { if (fShowSemaphore >= 0) delete_sem(fShowSemaphore); - - if (fEditLine != NULL) - el_end(fEditLine); - - if (fHistory != NULL) - history_end(fHistory); } @@ -115,9 +103,11 @@ CommandLineUserInterface::ID() const status_t CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener) { - fContext.Init(team, listener); + status_t error = fContext.Init(team, listener); + if (error != B_OK) + return error; - status_t error = _RegisterCommands(); + error = _RegisterCommands(); if (error != B_OK) return error; @@ -125,21 +115,6 @@ CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener) if (fShowSemaphore < 0) return fShowSemaphore; - fEditLine = el_init("Debugger", stdin, stdout, stderr); - if (fEditLine == NULL) - return B_ERROR; - - fHistory = history_init(); - if (fHistory == NULL) - return B_ERROR; - - HistEvent historyEvent; - history(fHistory, &historyEvent, H_SETSIZE, 100); - - el_set(fEditLine, EL_HIST, &history, fHistory); - el_set(fEditLine, EL_EDITOR, "emacs"); - el_set(fEditLine, EL_PROMPT, &get_prompt); - return B_OK; } @@ -158,7 +133,7 @@ CommandLineUserInterface::Terminate() fTerminating = true; if (fShown) { - // TODO: Signal the thread so it wakes up! + fContext.Terminating(); // Wait for input loop to finish. while (acquire_sem(fShowSemaphore) == B_INTERRUPTED) { @@ -169,15 +144,7 @@ CommandLineUserInterface::Terminate() fShowSemaphore = -1; } - if (fEditLine != NULL) { - el_end(fEditLine); - fEditLine = NULL; - } - - if (fHistory != NULL) { - history_end(fHistory); - fHistory = NULL; - } + fContext.Cleanup(); } @@ -241,9 +208,11 @@ status_t CommandLineUserInterface::_InputLoop() { while (!fTerminating) { + // Wait for a thread or Ctrl-C. + fContext.WaitForThreadOrUser(); + // read a command line - int count; - const char* line = el_gets(fEditLine, &count); + const char* line = fContext.PromptUser(kDebuggerPrompt); if (line == NULL) break; @@ -269,8 +238,7 @@ CommandLineUserInterface::_InputLoop() continue; // add line to history - HistEvent historyEvent; - history(fHistory, &historyEvent, H_ENTER, line); + fContext.AddLineToInputHistory(line); // execute command _ExecuteCommand(args.ArgumentCount(), args.Arguments()); diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h index fb5da34da9..736429b0b4 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h @@ -7,10 +7,6 @@ #define COMMAND_LINE_USER_INTERFACE_H -#include - // Needed in histedit.h. -#include - #include #include @@ -73,11 +69,9 @@ private: private: CliContext fContext; CommandList fCommands; - EditLine* fEditLine; - History* fHistory; sem_id fShowSemaphore; bool fShown; - bool fTerminating; + volatile bool fTerminating; }; From b05aa8b5b16e5b4f420a35c37805c6387df98737 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 27 Jul 2012 19:07:09 -0400 Subject: [PATCH 60/65] Style changes in Tracker, no functional change. Manual whitespace cleanup Change instances of const char * to const char* Convert /* */ C style comments to // C++ style comments --- src/kits/tracker/AttributeStream.cpp | 248 ++-- src/kits/tracker/AttributeStream.h | 242 ++-- src/kits/tracker/Attributes.h | 216 ++-- src/kits/tracker/AutoMounterSettings.cpp | 1 + src/kits/tracker/AutoMounterSettings.h | 5 +- src/kits/tracker/Background.h | 2 +- src/kits/tracker/BackgroundImage.cpp | 74 +- src/kits/tracker/BackgroundImage.h | 48 +- src/kits/tracker/Bitmaps.cpp | 41 +- src/kits/tracker/Bitmaps.h | 36 +- src/kits/tracker/Commands.h | 2 +- src/kits/tracker/ContainerWindow.cpp | 392 +++--- src/kits/tracker/ContainerWindow.h | 202 ++-- src/kits/tracker/CountView.cpp | 12 +- src/kits/tracker/CountView.h | 17 +- src/kits/tracker/Cursors.h | 1 + src/kits/tracker/DeskWindow.cpp | 34 +- src/kits/tracker/DeskWindow.h | 26 +- src/kits/tracker/DesktopPoseView.cpp | 38 +- src/kits/tracker/DesktopPoseView.h | 32 +- src/kits/tracker/DialogPane.cpp | 107 +- src/kits/tracker/DialogPane.h | 8 +- src/kits/tracker/DirMenu.cpp | 29 +- src/kits/tracker/DirMenu.h | 18 +- src/kits/tracker/EntryIterator.cpp | 53 +- src/kits/tracker/EntryIterator.h | 75 +- src/kits/tracker/FBCPadding.cpp | 16 +- src/kits/tracker/FSClipboard.cpp | 166 ++- src/kits/tracker/FSClipboard.h | 27 +- src/kits/tracker/FSUndoRedo.cpp | 68 +- src/kits/tracker/FSUndoRedo.h | 24 +- src/kits/tracker/FSUtils.cpp | 433 ++++--- src/kits/tracker/FSUtils.h | 139 +-- src/kits/tracker/FavoritesMenu.cpp | 26 +- src/kits/tracker/FavoritesMenu.h | 37 +- src/kits/tracker/FilePanel.cpp | 93 +- src/kits/tracker/FilePanelPriv.cpp | 167 ++- src/kits/tracker/FilePanelPriv.h | 166 +-- src/kits/tracker/FilePermissionsView.cpp | 12 +- src/kits/tracker/FilePermissionsView.h | 45 +- src/kits/tracker/FindPanel.cpp | 467 ++++---- src/kits/tracker/FindPanel.h | 137 ++- src/kits/tracker/FunctionObject.h | 122 +- src/kits/tracker/GroupedMenu.cpp | 56 +- src/kits/tracker/GroupedMenu.h | 38 +- src/kits/tracker/IconCache.cpp | 384 +++--- src/kits/tracker/IconCache.h | 298 ++--- src/kits/tracker/IconMenuItem.cpp | 32 +- src/kits/tracker/IconMenuItem.h | 38 +- src/kits/tracker/InfoWindow.cpp | 145 ++- src/kits/tracker/InfoWindow.h | 34 +- src/kits/tracker/LockingList.h | 18 +- src/kits/tracker/MimeTypeList.cpp | 34 +- src/kits/tracker/MimeTypeList.h | 28 +- src/kits/tracker/MimeTypes.h | 34 +- src/kits/tracker/MiniMenuField.cpp | 51 +- src/kits/tracker/MiniMenuField.h | 12 +- src/kits/tracker/Model.cpp | 94 +- src/kits/tracker/Model.h | 115 +- src/kits/tracker/MountMenu.cpp | 26 +- src/kits/tracker/MountMenu.h | 7 +- src/kits/tracker/NavMenu.cpp | 41 +- src/kits/tracker/Navigator.cpp | 112 +- src/kits/tracker/Navigator.h | 43 +- src/kits/tracker/NodePreloader.cpp | 88 +- src/kits/tracker/NodePreloader.h | 16 +- src/kits/tracker/NodeWalker.cpp | 59 +- src/kits/tracker/NodeWalker.h | 71 +- src/kits/tracker/OpenWithWindow.cpp | 259 ++-- src/kits/tracker/OpenWithWindow.h | 176 +-- src/kits/tracker/OverrideAlert.cpp | 31 +- src/kits/tracker/OverrideAlert.h | 25 +- src/kits/tracker/PendingNodeMonitorCache.cpp | 30 +- src/kits/tracker/PendingNodeMonitorCache.h | 21 +- src/kits/tracker/Pose.cpp | 193 ++- src/kits/tracker/Pose.h | 97 +- src/kits/tracker/PoseList.cpp | 31 +- src/kits/tracker/PoseList.h | 67 +- src/kits/tracker/PoseView.cpp | 1129 +++++++++--------- src/kits/tracker/PoseView.h | 536 ++++----- src/kits/tracker/PoseViewScripting.cpp | 246 ++-- src/kits/tracker/PublicCommands.h | 5 +- src/kits/tracker/QueryContainerWindow.cpp | 30 +- src/kits/tracker/QueryContainerWindow.h | 27 +- src/kits/tracker/QueryPoseView.cpp | 172 +-- src/kits/tracker/QueryPoseView.h | 91 +- src/kits/tracker/RecentItems.cpp | 138 +-- src/kits/tracker/RecentItems.h | 125 +- src/kits/tracker/RegExp.cpp | 184 +-- src/kits/tracker/RegExp.h | 98 +- src/kits/tracker/SelectionWindow.cpp | 10 +- src/kits/tracker/SelectionWindow.h | 31 +- src/kits/tracker/Settings.cpp | 146 ++- src/kits/tracker/Settings.h | 67 +- src/kits/tracker/SettingsHandler.cpp | 125 +- src/kits/tracker/SettingsHandler.h | 77 +- src/kits/tracker/SettingsViews.cpp | 32 +- src/kits/tracker/SettingsViews.h | 46 +- src/kits/tracker/SlowContextPopup.cpp | 84 +- src/kits/tracker/SlowContextPopup.h | 68 +- src/kits/tracker/SlowMenu.cpp | 36 +- src/kits/tracker/SlowMenu.h | 14 +- src/kits/tracker/StatusWindow.cpp | 10 +- src/kits/tracker/StatusWindow.h | 3 +- src/kits/tracker/TaskLoop.cpp | 60 +- src/kits/tracker/TaskLoop.h | 114 +- src/kits/tracker/TemplatesMenu.cpp | 44 +- src/kits/tracker/TemplatesMenu.h | 16 +- src/kits/tracker/Tests.cpp | 67 +- src/kits/tracker/TextWidget.cpp | 71 +- src/kits/tracker/TextWidget.h | 59 +- src/kits/tracker/Thread.cpp | 50 +- src/kits/tracker/Thread.h | 86 +- src/kits/tracker/TitleView.cpp | 108 +- src/kits/tracker/TitleView.h | 76 +- src/kits/tracker/Tracker.cpp | 219 ++-- src/kits/tracker/Tracker.h | 127 +- src/kits/tracker/TrackerInitialState.cpp | 98 +- src/kits/tracker/TrackerScripting.cpp | 74 +- src/kits/tracker/TrackerSettings.cpp | 50 +- src/kits/tracker/TrackerSettings.h | 23 +- src/kits/tracker/TrackerSettingsWindow.cpp | 54 +- src/kits/tracker/TrackerSettingsWindow.h | 15 +- src/kits/tracker/TrackerString.cpp | 254 ++-- src/kits/tracker/TrackerString.h | 89 +- src/kits/tracker/TrashWatcher.cpp | 40 +- src/kits/tracker/TrashWatcher.h | 11 +- src/kits/tracker/Utilities.cpp | 230 ++-- src/kits/tracker/Utilities.h | 211 ++-- src/kits/tracker/ViewState.cpp | 108 +- src/kits/tracker/ViewState.h | 82 +- src/kits/tracker/VolumeWindow.cpp | 10 +- src/kits/tracker/VolumeWindow.h | 22 +- src/kits/tracker/WidgetAttributeText.cpp | 1 - src/kits/tracker/WidgetAttributeText.h | 201 ++-- 135 files changed, 6806 insertions(+), 6302 deletions(-) diff --git a/src/kits/tracker/AttributeStream.cpp b/src/kits/tracker/AttributeStream.cpp index 8c429e10ec..47a8ce0896 100644 --- a/src/kits/tracker/AttributeStream.cpp +++ b/src/kits/tracker/AttributeStream.cpp @@ -32,11 +32,13 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "AttributeStream.h" #include #include + // ToDo: // lazy Rewind from Drive, only if data is available // BMessage node @@ -49,14 +51,15 @@ AttributeInfo::AttributeInfo(const AttributeInfo &cloneThis) { } -AttributeInfo::AttributeInfo(const char *name, attr_info info) + +AttributeInfo::AttributeInfo(const char* name, attr_info info) : fName(name), fInfo(info) { } -AttributeInfo::AttributeInfo(const char *name, uint32 type, off_t size) +AttributeInfo::AttributeInfo(const char* name, uint32 type, off_t size) : fName(name) { fInfo.size = size; @@ -64,7 +67,7 @@ AttributeInfo::AttributeInfo(const char *name, uint32 type, off_t size) } -const char * +const char* AttributeInfo::Name() const { return fName.String(); @@ -91,14 +94,14 @@ AttributeInfo::SetTo(const AttributeInfo &attr) } void -AttributeInfo::SetTo(const char *name, attr_info info) +AttributeInfo::SetTo(const char* name, attr_info info) { fName = name; fInfo = info; } void -AttributeInfo::SetTo(const char *name, uint32 type, off_t size) +AttributeInfo::SetTo(const char* name, uint32 type, off_t size) { fName = name; fInfo.type = type; @@ -118,7 +121,7 @@ AttributeStreamNode::~AttributeStreamNode() Detach(); } -AttributeStreamNode & +AttributeStreamNode& AttributeStreamNode::operator<<(AttributeStreamNode &source) { fReadFrom = &source; @@ -143,7 +146,7 @@ AttributeStreamFileNode::MakeEmpty() } off_t -AttributeStreamNode::Contains(const char *name, uint32 type) +AttributeStreamNode::Contains(const char* name, uint32 type) { if (!fReadFrom) return 0; @@ -153,8 +156,8 @@ AttributeStreamNode::Contains(const char *name, uint32 type) off_t -AttributeStreamNode::Read(const char *name, const char *foreignName, uint32 type, - off_t size, void *buffer, void (*swapFunc)(void *)) +AttributeStreamNode::Read(const char* name, const char* foreignName, uint32 type, + off_t size, void* buffer, void (*swapFunc)(void*)) { if (!fReadFrom) return 0; @@ -162,9 +165,10 @@ AttributeStreamNode::Read(const char *name, const char *foreignName, uint32 type return fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc); } + off_t -AttributeStreamNode::Write(const char *name, const char *foreignName, uint32 type, - off_t size, const void *buffer) +AttributeStreamNode::Write(const char* name, const char* foreignName, uint32 type, + off_t size, const void* buffer) { if (!fWriteTo) return 0; @@ -172,6 +176,7 @@ AttributeStreamNode::Write(const char *name, const char *foreignName, uint32 typ return fWriteTo->Write(name, foreignName, type, size, buffer); } + bool AttributeStreamNode::Drive() { @@ -183,7 +188,8 @@ AttributeStreamNode::Drive() return true; } -const AttributeInfo * + +const AttributeInfo* AttributeStreamNode::Next() { if (fReadFrom) @@ -192,7 +198,8 @@ AttributeStreamNode::Next() return NULL; } -const char * + +const char* AttributeStreamNode::Get() { ASSERT(fReadFrom); @@ -202,13 +209,15 @@ AttributeStreamNode::Get() return fReadFrom->Get(); } + bool -AttributeStreamNode::Fill(char *buffer) const +AttributeStreamNode::Fill(char* buffer) const { ASSERT(fReadFrom); return fReadFrom->Fill(buffer); } + bool AttributeStreamNode::Start() { @@ -219,11 +228,12 @@ AttributeStreamNode::Start() return fWriteTo->Start(); } + void AttributeStreamNode::Detach() { - AttributeStreamNode *tmpFrom = fReadFrom; - AttributeStreamNode *tmpTo = fWriteTo; + AttributeStreamNode* tmpFrom = fReadFrom; + AttributeStreamNode* tmpTo = fWriteTo; fReadFrom = NULL; fWriteTo = NULL; @@ -240,12 +250,13 @@ AttributeStreamFileNode::AttributeStreamFileNode() } -AttributeStreamFileNode::AttributeStreamFileNode(BNode *node) +AttributeStreamFileNode::AttributeStreamFileNode(BNode* node) : fNode(node) { ASSERT(fNode); } + void AttributeStreamFileNode::Rewind() { @@ -253,15 +264,16 @@ AttributeStreamFileNode::Rewind() fNode->RewindAttrs(); } + void -AttributeStreamFileNode::SetTo(BNode *node) +AttributeStreamFileNode::SetTo(BNode* node) { fNode = node; } off_t -AttributeStreamFileNode::Contains(const char *name, uint32 type) +AttributeStreamFileNode::Contains(const char* name, uint32 type) { ASSERT(fNode); attr_info info; @@ -274,9 +286,10 @@ AttributeStreamFileNode::Contains(const char *name, uint32 type) return info.size; } + off_t -AttributeStreamFileNode::Read(const char *name, const char *foreignName, uint32 type, - off_t size, void *buffer, void (*swapFunc)(void *)) +AttributeStreamFileNode::Read(const char* name, const char* foreignName, uint32 type, + off_t size, void* buffer, void (*swapFunc)(void*)) { if (name && fNode->ReadAttr(name, type, 0, buffer, (size_t)size) == size) return size; @@ -291,12 +304,13 @@ AttributeStreamFileNode::Read(const char *name, const char *foreignName, uint32 return 0; } + off_t -AttributeStreamFileNode::Write(const char *name, const char *foreignName, uint32 type, - off_t size, const void *buffer) +AttributeStreamFileNode::Write(const char* name, const char* foreignName, uint32 type, + off_t size, const void* buffer) { ASSERT(fNode); - ASSERT(dynamic_cast(fNode)); + ASSERT(dynamic_cast(fNode)); off_t result = fNode->WriteAttr(name, type, 0, buffer, (size_t)size); if (result == size && foreignName) // the write operation worked fine, remove the foreign attribute @@ -306,6 +320,7 @@ AttributeStreamFileNode::Write(const char *name, const char *foreignName, uint32 return result; } + bool AttributeStreamFileNode::Drive() { @@ -313,9 +328,9 @@ AttributeStreamFileNode::Drive() if (!_inherited::Drive()) return false; - const AttributeInfo *attr; + const AttributeInfo* attr; while ((attr = fReadFrom->Next()) != 0) { - const char *data = fReadFrom->Get(); + const char* data = fReadFrom->Get(); off_t result = fNode->WriteAttr(attr->Name(), attr->Type(), 0, data, (size_t)attr->Size()); if (result < attr->Size()) @@ -324,7 +339,8 @@ AttributeStreamFileNode::Drive() return true; } -const char * + +const char* AttributeStreamFileNode::Get() { ASSERT(fNode); @@ -332,15 +348,17 @@ AttributeStreamFileNode::Get() return NULL; } + bool -AttributeStreamFileNode::Fill(char *buffer) const +AttributeStreamFileNode::Fill(char* buffer) const { ASSERT(fNode); return fNode->ReadAttr(fCurrentAttr.Name(), fCurrentAttr.Type(), 0, buffer, (size_t)fCurrentAttr.Size()) == (ssize_t)fCurrentAttr.Size(); } -const AttributeInfo * + +const AttributeInfo* AttributeStreamFileNode::Next() { ASSERT(fNode); @@ -364,12 +382,14 @@ AttributeStreamMemoryNode::AttributeStreamMemoryNode() { } + void AttributeStreamMemoryNode::MakeEmpty() { fAttributes.MakeEmpty(); } + void AttributeStreamMemoryNode::Rewind() { @@ -377,8 +397,9 @@ AttributeStreamMemoryNode::Rewind() fCurrentIndex = -1; } + int32 -AttributeStreamMemoryNode::Find(const char *name, uint32 type) const +AttributeStreamMemoryNode::Find(const char* name, uint32 type) const { int32 count = fAttributes.CountItems(); for (int32 index = 0; index < count; index++) @@ -389,8 +410,9 @@ AttributeStreamMemoryNode::Find(const char *name, uint32 type) const return -1; } + off_t -AttributeStreamMemoryNode::Contains(const char *name, uint32 type) +AttributeStreamMemoryNode::Contains(const char* name, uint32 type) { int32 index = Find(name, type); if (index < 0) @@ -400,13 +422,13 @@ AttributeStreamMemoryNode::Contains(const char *name, uint32 type) off_t -AttributeStreamMemoryNode::Read(const char *name, const char *DEBUG_ONLY(foreignName), - uint32 type, off_t bufferSize, void *buffer, void (*DEBUG_ONLY(swapFunc))(void *)) +AttributeStreamMemoryNode::Read(const char* name, const char* DEBUG_ONLY(foreignName), + uint32 type, off_t bufferSize, void* buffer, void (*DEBUG_ONLY(swapFunc))(void*)) { ASSERT(!foreignName); ASSERT(!swapFunc); - AttrNode *attrNode = NULL; + AttrNode* attrNode = NULL; int32 index = Find(name, type); if (index < 0) { @@ -429,18 +451,20 @@ AttributeStreamMemoryNode::Read(const char *name, const char *DEBUG_ONLY(foreign return attrNode->fAttr.Size(); } + off_t -AttributeStreamMemoryNode::Write(const char *name, const char *, uint32 type, - off_t size, const void *buffer) +AttributeStreamMemoryNode::Write(const char* name, const char*, uint32 type, + off_t size, const void* buffer) { - char *newBuffer = new char[size]; + char* newBuffer = new char[size]; memcpy(newBuffer, buffer, (size_t)size); - AttrNode *attrNode = new AttrNode(name, type, size, newBuffer); + AttrNode* attrNode = new AttrNode(name, type, size, newBuffer); fAttributes.AddItem(attrNode); return size; } + bool AttributeStreamMemoryNode::Drive() { @@ -453,35 +477,37 @@ AttributeStreamMemoryNode::Drive() return true; } -AttributeStreamMemoryNode::AttrNode * -AttributeStreamMemoryNode::BufferingGet(const char *name, uint32 type, off_t size) + +AttributeStreamMemoryNode::AttrNode* +AttributeStreamMemoryNode::BufferingGet(const char* name, uint32 type, off_t size) { - char *newBuffer = new char[size]; + char* newBuffer = new char[size]; if (!fReadFrom->Fill(newBuffer)) { delete[] newBuffer; return NULL; } - AttrNode *attrNode = new AttrNode(name, type, size, newBuffer); + AttrNode* attrNode = new AttrNode(name, type, size, newBuffer); fAttributes.AddItem(attrNode); return fAttributes.LastItem(); } -AttributeStreamMemoryNode::AttrNode * +AttributeStreamMemoryNode::AttrNode* AttributeStreamMemoryNode::BufferingGet() { if (!fReadFrom) return NULL; - const AttributeInfo *attr = fReadFrom->Next(); + const AttributeInfo* attr = fReadFrom->Next(); if (!attr) return NULL; return BufferingGet(attr->Name(), attr->Type(), attr->Size()); } -const AttributeInfo * + +const AttributeInfo* AttributeStreamMemoryNode::Next() { if (fReadFrom) @@ -495,15 +521,17 @@ AttributeStreamMemoryNode::Next() return &fAttributes.ItemAt(++fCurrentIndex)->fAttr; } -const char * + +const char* AttributeStreamMemoryNode::Get() { ASSERT(fCurrentIndex < fAttributes.CountItems()); return fAttributes.ItemAt(fCurrentIndex)->fData; } + bool -AttributeStreamMemoryNode::Fill(char *buffer) const +AttributeStreamMemoryNode::Fill(char* buffer) const { ASSERT(fCurrentIndex < fAttributes.CountItems()); memcpy(buffer, fAttributes.ItemAt(fCurrentIndex)->fData, @@ -513,16 +541,17 @@ AttributeStreamMemoryNode::Fill(char *buffer) const } -AttributeStreamTemplateNode::AttributeStreamTemplateNode(const AttributeTemplate * - attrTemplates, int32 count) +AttributeStreamTemplateNode::AttributeStreamTemplateNode( + const AttributeTemplate* attrTemplates, int32 count) : fAttributes(attrTemplates), fCurrentIndex(-1), fCount(count) { } + off_t -AttributeStreamTemplateNode::Contains(const char *name, uint32 type) +AttributeStreamTemplateNode::Contains(const char* name, uint32 type) { int32 index = Find(name, type); if (index < 0) @@ -531,13 +560,15 @@ AttributeStreamTemplateNode::Contains(const char *name, uint32 type) return fAttributes[index].fSize; } + void AttributeStreamTemplateNode::Rewind() { fCurrentIndex = -1; } -const AttributeInfo * + +const AttributeInfo* AttributeStreamTemplateNode::Next() { if (fCurrentIndex + 1 >= fCount) @@ -546,53 +577,62 @@ AttributeStreamTemplateNode::Next() ++fCurrentIndex; fCurrentAttr.SetTo(fAttributes[fCurrentIndex].fAttributeName, - fAttributes[fCurrentIndex].fAttributeType, fAttributes[fCurrentIndex].fSize); + fAttributes[fCurrentIndex].fAttributeType, + fAttributes[fCurrentIndex].fSize); return &fCurrentAttr; } -const char * + +const char* AttributeStreamTemplateNode::Get() { ASSERT(fCurrentIndex < fCount); return fAttributes[fCurrentIndex].fBits; } + bool -AttributeStreamTemplateNode::Fill(char *buffer) const +AttributeStreamTemplateNode::Fill(char* buffer) const { ASSERT(fCurrentIndex < fCount); - memcpy(buffer, fAttributes[fCurrentIndex].fBits, (size_t)fAttributes[fCurrentIndex].fSize); + memcpy(buffer, fAttributes[fCurrentIndex].fBits, + (size_t)fAttributes[fCurrentIndex].fSize); return true; } + int32 -AttributeStreamTemplateNode::Find(const char *name, uint32 type) const +AttributeStreamTemplateNode::Find(const char* name, uint32 type) const { - for (int32 index = 0; index < fCount; index++) + for (int32 index = 0; index < fCount; index++) { if (fAttributes[index].fAttributeType == type && - strcmp(name, fAttributes[index].fAttributeName) == 0) + strcmp(name, fAttributes[index].fAttributeName) == 0) { return index; + } + } return -1; } + bool -AttributeStreamFilterNode::Reject(const char *, uint32 , off_t ) +AttributeStreamFilterNode::Reject(const char*, uint32, off_t) { // simple pass everything filter return false; } -const AttributeInfo * + +const AttributeInfo* AttributeStreamFilterNode::Next() { if (!fReadFrom) return NULL; for (;;) { - const AttributeInfo *attr = fReadFrom->Next(); + const AttributeInfo* attr = fReadFrom->Next(); if (!attr) break; @@ -602,8 +642,9 @@ AttributeStreamFilterNode::Next() return NULL; } + off_t -AttributeStreamFilterNode::Contains(const char *name, uint32 type) +AttributeStreamFilterNode::Contains(const char* name, uint32 type) { if (!fReadFrom) return 0; @@ -616,9 +657,10 @@ AttributeStreamFilterNode::Contains(const char *name, uint32 type) return 0; } + off_t -AttributeStreamFilterNode::Read(const char *name, const char *foreignName, uint32 type, - off_t size, void *buffer, void (*swapFunc)(void *)) +AttributeStreamFilterNode::Read(const char* name, const char* foreignName, uint32 type, + off_t size, void* buffer, void (*swapFunc)(void*)) { if (!fReadFrom) return 0; @@ -629,9 +671,10 @@ AttributeStreamFilterNode::Read(const char *name, const char *foreignName, uint3 return 0; } + off_t -AttributeStreamFilterNode::Write(const char *name, const char *foreignName, uint32 type, - off_t size, const void *buffer) +AttributeStreamFilterNode::Write(const char* name, const char* foreignName, uint32 type, + off_t size, const void* buffer) { if (!fWriteTo) return 0; @@ -643,30 +686,34 @@ AttributeStreamFilterNode::Write(const char *name, const char *foreignName, uint } -NamesToAcceptAttrFilter::NamesToAcceptAttrFilter(const char **nameList) +NamesToAcceptAttrFilter::NamesToAcceptAttrFilter(const char** nameList) : fNameList(nameList) { } + bool -NamesToAcceptAttrFilter::Reject(const char *name, uint32 , off_t ) +NamesToAcceptAttrFilter::Reject(const char* name, uint32 , off_t ) { for (int32 index = 0; ;index++) { if (!fNameList[index]) break; if (strcmp(name, fNameList[index]) == 0) { -// PRINT(("filter passing through %s\n", name)); + //PRINT(("filter passing through %s\n", name)); return false; } } -// PRINT(("filter rejecting %s\n", name)); + + //PRINT(("filter rejecting %s\n", name)); return true; } -SelectiveAttributeTransformer::SelectiveAttributeTransformer(const char *attributeName, - bool (*transformFunc)(const char * , uint32 , off_t, void *, void *), void *params) +SelectiveAttributeTransformer::SelectiveAttributeTransformer( + const char* attributeName, + bool (*transformFunc)(const char* , uint32 , off_t, void*, void*), + void* params) : fAttributeNameToTransform(attributeName), fTransformFunc(transformFunc), fTransformParams(params), @@ -677,54 +724,62 @@ SelectiveAttributeTransformer::SelectiveAttributeTransformer(const char *attribu SelectiveAttributeTransformer::~SelectiveAttributeTransformer() { - for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0; index--) + for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0; + index--) { delete [] fTransformedBuffers.ItemAt(index); + } } + void SelectiveAttributeTransformer::Rewind() { - for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0; index--) + for (int32 index = fTransformedBuffers.CountItems() - 1; index >= 0; + index--) { delete [] fTransformedBuffers.ItemAt(index); + } fTransformedBuffers.MakeEmpty(); } off_t -SelectiveAttributeTransformer::Read(const char *name, const char *foreignName, - uint32 type, off_t size, void *buffer, void (*swapFunc)(void *)) +SelectiveAttributeTransformer::Read(const char* name, const char* foreignName, + uint32 type, off_t size, void* buffer, void (*swapFunc)(void*)) { if (!fReadFrom) return 0; - off_t result = fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc); + off_t result = fReadFrom->Read(name, foreignName, type, size, buffer, + swapFunc); - if (WillTransform(name, type, size, (const char *)buffer)) - ApplyTransformer(name, type, size, (char *)buffer); + if (WillTransform(name, type, size, (const char*)buffer)) + ApplyTransformer(name, type, size, (char*)buffer); return result; } + bool -SelectiveAttributeTransformer::WillTransform(const char *name, uint32 , off_t , - const char *) const +SelectiveAttributeTransformer::WillTransform(const char* name, uint32, off_t, + const char*) const { return strcmp(name, fAttributeNameToTransform) == 0; } + bool -SelectiveAttributeTransformer::ApplyTransformer(const char *name, uint32 type, off_t size, - char *data) +SelectiveAttributeTransformer::ApplyTransformer(const char* name, uint32 type, + off_t size, char* data) { return (fTransformFunc)(name, type, size, data, fTransformParams); } -char * -SelectiveAttributeTransformer::CopyAndApplyTransformer(const char *name, uint32 type, - off_t size, const char *data) +char* +SelectiveAttributeTransformer::CopyAndApplyTransformer(const char* name, + uint32 type, off_t size, const char* data) { - char *result = NULL; + char* result = NULL; if (data) { result = new char[size]; memcpy(result, data, (size_t)size); @@ -734,13 +789,15 @@ SelectiveAttributeTransformer::CopyAndApplyTransformer(const char *name, uint32 delete [] result; return NULL; } + return result; } -const AttributeInfo * + +const AttributeInfo* SelectiveAttributeTransformer::Next() { - const AttributeInfo *result = fReadFrom->Next(); + const AttributeInfo* result = fReadFrom->Next(); if (!result) return NULL; @@ -748,19 +805,22 @@ SelectiveAttributeTransformer::Next() return result; } -const char * + +const char* SelectiveAttributeTransformer::Get() { if (!fReadFrom) return NULL; - const char *result = fReadFrom->Get(); + const char* result = fReadFrom->Get(); - if (!WillTransform(fCurrentAttr.Name(), fCurrentAttr.Type(), fCurrentAttr.Size(), result)) + if (!WillTransform(fCurrentAttr.Name(), fCurrentAttr.Type(), + fCurrentAttr.Size(), result)) { return result; + } - char *transformedData = CopyAndApplyTransformer(fCurrentAttr.Name(), fCurrentAttr.Type(), - fCurrentAttr.Size(), result); + char* transformedData = CopyAndApplyTransformer(fCurrentAttr.Name(), + fCurrentAttr.Type(), fCurrentAttr.Size(), result); // enlist for proper disposal when our job is done if (transformedData) { diff --git a/src/kits/tracker/AttributeStream.h b/src/kits/tracker/AttributeStream.h index 1c31a851c4..0102ba8972 100644 --- a/src/kits/tracker/AttributeStream.h +++ b/src/kits/tracker/AttributeStream.h @@ -46,11 +46,10 @@ All rights reserved. // // In addition to the whacky (but usefull) << syntax, calls like Read, Write are also // available - - #ifndef __ATTRIBUTE_STREAM__ #define __ATTRIBUTE_STREAM__ + #include #include #include @@ -60,14 +59,15 @@ All rights reserved. #include "ObjectList.h" + namespace BPrivate { struct AttributeTemplate { // used for read-only attribute source - const char *fAttributeName; + const char* fAttributeName; uint32 fAttributeType; off_t fSize; - const char *fBits; + const char* fBits; }; @@ -77,26 +77,27 @@ public: AttributeInfo() {} AttributeInfo(const AttributeInfo &); - AttributeInfo(const char *, attr_info); - AttributeInfo(const char *, uint32, off_t); + AttributeInfo(const char*, attr_info); + AttributeInfo(const char*, uint32, off_t); void SetTo(const AttributeInfo &); - void SetTo(const char *, attr_info); - void SetTo(const char *, uint32, off_t); - const char *Name() const; + void SetTo(const char*, attr_info); + void SetTo(const char*, uint32, off_t); + const char* Name() const; uint32 Type() const; off_t Size() const; private: BString fName; attr_info fInfo; -}; - +}; + + class AttributeStreamNode { public: AttributeStreamNode(); virtual ~AttributeStreamNode(); - + AttributeStreamNode &operator<<(AttributeStreamNode &source); // workhorse call // to the outside makes this node a part of the stream, passing on @@ -104,35 +105,34 @@ public: // // under the hood sets up streaming into the next node; hooking // up source and destination, forces the stream head to start streaming - + virtual void Rewind(); // get ready to start all over again virtual void MakeEmpty() {} // remove any attributes the node may have - - virtual off_t Contains(const char *, uint32); + + virtual off_t Contains(const char*, uint32); // returns size of attribute if found - virtual off_t Read(const char *name, const char *foreignName, uint32 type, off_t size, - void *buffer, void (*swapFunc)(void *) = 0); + virtual off_t Read(const char* name, const char* foreignName, uint32 type, off_t size, + void* buffer, void (*swapFunc)(void*) = 0); // read from this node - virtual off_t Write(const char *name, const char *foreignName, uint32 type, off_t size, - const void *buffer); + virtual off_t Write(const char* name, const char* foreignName, uint32 type, off_t size, + const void* buffer); // write to this node - // work calls virtual bool Drive(); // node at the head of the stream makes the entire stream // feed it - virtual const AttributeInfo *Next(); + virtual const AttributeInfo* Next(); // give me the next attribute in the stream - virtual const char *Get(); + virtual const char* Get(); // give me the data of the attribute in the stream that was just returned // by Next // assumes there is a buffering node somewhere on the way to // the source, from which the resulting buffer is borrowed - virtual bool Fill(char *buffer) const; + virtual bool Fill(char* buffer) const; // fill the buffer with data of the attribute in the stream that was just returned // by next // is big enough to hold the entire attribute data @@ -148,47 +148,49 @@ private: void Detach(); protected: - AttributeStreamNode *fReadFrom; - AttributeStreamNode *fWriteTo; + AttributeStreamNode* fReadFrom; + AttributeStreamNode* fWriteTo; }; + class AttributeStreamFileNode : public AttributeStreamNode { // handles reading and writing attributes to and from the // stream public: AttributeStreamFileNode(); - AttributeStreamFileNode(BNode *); - + AttributeStreamFileNode(BNode*); + virtual void MakeEmpty(); virtual void Rewind(); - virtual off_t Contains(const char *name, uint32 type); - virtual off_t Read(const char *name, const char *foreignName, uint32 type, off_t size, - void *buffer, void (*swapFunc)(void *) = 0); - virtual off_t Write(const char *name, const char *foreignName, uint32 type, off_t size, - const void *buffer); + virtual off_t Contains(const char* name, uint32 type); + virtual off_t Read(const char* name, const char* foreignName, uint32 type, + off_t size, void* buffer, void (*swapFunc)(void*) = 0); + virtual off_t Write(const char* name, const char* foreignName, uint32 type, + off_t size, const void* buffer); - void SetTo(BNode *); + void SetTo(BNode*); - BNode *Node() + BNode* Node() { return fNode; } - + protected: virtual bool CanFeed() const { return true; } virtual bool Drive(); // give me all the attributes, I'll write them into myself - virtual const AttributeInfo *Next(); + virtual const AttributeInfo* Next(); // return the info for the next attribute I can read for you - virtual const char *Get(); - virtual bool Fill(char *buffer) const; + virtual const char* Get(); + virtual bool Fill(char* buffer) const; private: AttributeInfo fCurrentAttr; - BNode *fNode; + BNode* fNode; typedef AttributeStreamNode _inherited; }; + class AttributeStreamMemoryNode : public AttributeStreamNode { // in memory attribute buffer; can be both target of writing and source // of reading at the same time @@ -196,24 +198,23 @@ public: AttributeStreamMemoryNode(); virtual void MakeEmpty(); - virtual off_t Contains(const char *name, uint32 type); - virtual off_t Read(const char *name, const char *foreignName, uint32 type, off_t size, - void *buffer, void (*swapFunc)(void *) = 0); - virtual off_t Write(const char *name, const char *foreignName, uint32 type, off_t size, - const void *buffer); - -protected: + virtual off_t Contains(const char* name, uint32 type); + virtual off_t Read(const char* name, const char* foreignName, uint32 type, off_t size, + void* buffer, void (*swapFunc)(void*) = 0); + virtual off_t Write(const char* name, const char* foreignName, uint32 type, off_t size, + const void* buffer); +protected: virtual bool CanFeed() const { return true; } virtual void Rewind(); virtual bool Drive(); - virtual const AttributeInfo *Next(); - virtual const char *Get(); - virtual bool Fill(char *buffer) const; + virtual const AttributeInfo* Next(); + virtual const char* Get(); + virtual bool Fill(char* buffer) const; class AttrNode { public: - AttrNode(const char *name, uint32 type, off_t size, char *data) + AttrNode(const char* name, uint32 type, off_t size, char* data) : fAttr(name, type, size), fData(data) { @@ -225,129 +226,132 @@ protected: } AttributeInfo fAttr; - char *fData; + char* fData; }; - + // utility calls - virtual AttrNode *BufferingGet(); - virtual AttrNode *BufferingGet(const char *name, uint32 type, off_t size); - int32 Find(const char *name, uint32 type) const; + virtual AttrNode* BufferingGet(); + virtual AttrNode* BufferingGet(const char* name, uint32 type, off_t size); + int32 Find(const char* name, uint32 type) const; private: - BObjectList fAttributes; int32 fCurrentIndex; typedef AttributeStreamNode _inherited; }; + class AttributeStreamTemplateNode : public AttributeStreamNode { // in read-only memory attribute source // can only be used as a source for Next and Get public: - AttributeStreamTemplateNode(const AttributeTemplate *, int32 count); + AttributeStreamTemplateNode(const AttributeTemplate*, int32 count); + + virtual off_t Contains(const char* name, uint32 type); - virtual off_t Contains(const char *name, uint32 type); - protected: - virtual bool CanFeed() const { return true; } virtual void Rewind(); - virtual const AttributeInfo *Next(); - virtual const char *Get(); - virtual bool Fill(char *buffer) const; + virtual const AttributeInfo* Next(); + virtual const char* Get(); + virtual bool Fill(char* buffer) const; - int32 Find(const char *name, uint32 type) const; + int32 Find(const char* name, uint32 type) const; private: AttributeInfo fCurrentAttr; - const AttributeTemplate *fAttributes; + const AttributeTemplate* fAttributes; int32 fCurrentIndex; int32 fCount; typedef AttributeStreamNode _inherited; }; + class AttributeStreamFilterNode : public AttributeStreamNode { // filter node may not pass thru specified attributes public: AttributeStreamFilterNode() {} - virtual off_t Contains(const char *name, uint32 type); - virtual off_t Read(const char *name, const char *foreignName, uint32 type, off_t size, - void *buffer, void (*swapFunc)(void *) = 0); - virtual off_t Write(const char *name, const char *foreignName, uint32 type, off_t size, - const void *buffer); + virtual off_t Contains(const char* name, uint32 type); + virtual off_t Read(const char* name, const char* foreignName, uint32 type, off_t size, + void* buffer, void (*swapFunc)(void*) = 0); + virtual off_t Write(const char* name, const char* foreignName, uint32 type, off_t size, + const void* buffer); protected: - virtual bool Reject(const char *name, uint32 type, off_t size); + virtual bool Reject(const char* name, uint32 type, off_t size); // override to implement filtering - virtual const AttributeInfo *Next(); - + virtual const AttributeInfo* Next(); + private: typedef AttributeStreamNode _inherited; }; + class NamesToAcceptAttrFilter : public AttributeStreamFilterNode { // filter node that only passes thru attributes that match // a list of names public: - NamesToAcceptAttrFilter(const char **); + NamesToAcceptAttrFilter(const char**); protected: - virtual bool Reject(const char *name, uint32 type, off_t size); + virtual bool Reject(const char* name, uint32 type, off_t size); private: - const char **fNameList; + const char** fNameList; }; + class SelectiveAttributeTransformer : public AttributeStreamNode { // node applies a transformation on specified attributes public: - SelectiveAttributeTransformer(const char *attributeName, bool (*)(const char *, - uint32 , off_t , void *, void *), void *params); + SelectiveAttributeTransformer(const char* attributeName, bool (*)(const char*, + uint32 , off_t , void*, void*), void* params); virtual ~SelectiveAttributeTransformer(); - virtual off_t Read(const char *name, const char *foreignName, uint32 type, off_t size, - void *buffer, void (*swapFunc)(void *) = 0); + virtual off_t Read(const char* name, const char* foreignName, uint32 type, off_t size, + void* buffer, void (*swapFunc)(void*) = 0); virtual void Rewind(); protected: - virtual bool WillTransform(const char *name, uint32 type, off_t size, const char *data) const; + virtual bool WillTransform(const char* name, uint32 type, off_t size, const char* data) const; // override to implement filtering; should only return true if transformation will // occur - virtual char *CopyAndApplyTransformer(const char *name, uint32 type, off_t size, const char *data); + virtual char* CopyAndApplyTransformer(const char* name, uint32 type, off_t size, const char* data); // makes a copy of data - virtual bool ApplyTransformer(const char *name, uint32 type, off_t size, char *data); + virtual bool ApplyTransformer(const char* name, uint32 type, off_t size, char* data); // transforms in place - virtual const AttributeInfo *Next(); - virtual const char *Get(); - + virtual const AttributeInfo* Next(); + virtual const char* Get(); + private: AttributeInfo fCurrentAttr; - const char *fAttributeNameToTransform; - bool (*fTransformFunc)(const char *, uint32 , off_t , void *, void *); - void *fTransformParams; + const char* fAttributeNameToTransform; + bool (*fTransformFunc)(const char*, uint32 , off_t , void*, void*); + void* fTransformParams; BObjectList fTransformedBuffers; typedef AttributeStreamNode _inherited; }; + template class AttributeStreamConstValue : public AttributeStreamNode { public: - AttributeStreamConstValue(const char *name, uint32 attributeType, Type value); -protected: + AttributeStreamConstValue(const char* name, uint32 attributeType, Type value); +protected: virtual bool CanFeed() const { return true; } virtual void Rewind() { fRewound = true; } - virtual const AttributeInfo *Next(); - virtual const char *Get(); - virtual bool Fill(char *buffer) const; + virtual const AttributeInfo* Next(); + virtual const char* Get(); + virtual bool Fill(char* buffer) const; - int32 Find(const char *name, uint32 type) const; + int32 Find(const char* name, uint32 type) const; private: AttributeInfo fAttr; @@ -357,8 +361,9 @@ private: typedef AttributeStreamNode _inherited; }; + template -AttributeStreamConstValue::AttributeStreamConstValue(const char *name, +AttributeStreamConstValue::AttributeStreamConstValue(const char* name, uint32 attributeType, Type value) : fAttr(name, attributeType, sizeof(Type)), fValue(value), @@ -366,35 +371,39 @@ AttributeStreamConstValue::AttributeStreamConstValue(const char *name, { } + template -const AttributeInfo * +const AttributeInfo* AttributeStreamConstValue::Next() { if (!fRewound) return NULL; - + fRewound = false; return &fAttr; } -template -const char * -AttributeStreamConstValue::Get() -{ - return (const char *)&fValue; -} template -bool -AttributeStreamConstValue::Fill(char *buffer) const +const char* +AttributeStreamConstValue::Get() +{ + return (const char*)&fValue; +} + + +template +bool +AttributeStreamConstValue::Fill(char* buffer) const { memcpy(buffer, &fValue, sizeof(Type)); return true; } + template -int32 -AttributeStreamConstValue::Find(const char *name, uint32 type) const +int32 +AttributeStreamConstValue::Find(const char* name, uint32 type) const { if (strcmp(fAttr.Name(), name) == 0 && type == fAttr.Type()) return 0; @@ -402,42 +411,47 @@ AttributeStreamConstValue::Find(const char *name, uint32 type) const return -1; } + class AttributeStreamBoolValue : public AttributeStreamConstValue { public: - AttributeStreamBoolValue(const char *name, bool value) + AttributeStreamBoolValue(const char* name, bool value) : AttributeStreamConstValue(name, B_BOOL_TYPE, value) {} }; + class AttributeStreamInt32Value : public AttributeStreamConstValue { public: - AttributeStreamInt32Value(const char *name, int32 value) + AttributeStreamInt32Value(const char* name, int32 value) : AttributeStreamConstValue(name, B_INT32_TYPE, value) {} }; + class AttributeStreamInt64Value : public AttributeStreamConstValue { public: - AttributeStreamInt64Value(const char *name, int64 value) + AttributeStreamInt64Value(const char* name, int64 value) : AttributeStreamConstValue(name, B_INT64_TYPE, value) {} }; + class AttributeStreamRectValue : public AttributeStreamConstValue { public: - AttributeStreamRectValue(const char *name, BRect value) + AttributeStreamRectValue(const char* name, BRect value) : AttributeStreamConstValue(name, B_RECT_TYPE, value) {} }; + class AttributeStreamFloatValue : public AttributeStreamConstValue { public: - AttributeStreamFloatValue(const char *name, float value) + AttributeStreamFloatValue(const char* name, float value) : AttributeStreamConstValue(name, B_FLOAT_TYPE, value) {} }; -} +} // namespace BPrivate using namespace BPrivate; diff --git a/src/kits/tracker/Attributes.h b/src/kits/tracker/Attributes.h index 2a513a38e6..b79f2ebc0b 100644 --- a/src/kits/tracker/Attributes.h +++ b/src/kits/tracker/Attributes.h @@ -31,157 +31,157 @@ 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. */ - #ifndef _ATTRIBUTES_H #define _ATTRIBUTES_H + namespace BPrivate { // viewable attributes -#define kAttrStatName "_stat/name" -#define kAttrRealName "_stat/realname" -#define kAttrStatSize "_stat/size" -#define kAttrStatModified "_stat/modified" -#define kAttrStatCreated "_stat/created" -#define kAttrStatMode "_stat/mode" -#define kAttrStatOwner "_stat/owner" -#define kAttrStatGroup "_stat/group" -#define kAttrPath "_trk/path" -#define kAttrOriginalPath "_trk/original_path" -#define kAttrAppVersion "_trk/app_version" -#define kAttrSystemVersion "_trk/system_version" -#define kAttrOpenWithRelation "_trk/open_with_relation" +#define kAttrStatName "_stat/name" +#define kAttrRealName "_stat/realname" +#define kAttrStatSize "_stat/size" +#define kAttrStatModified "_stat/modified" +#define kAttrStatCreated "_stat/created" +#define kAttrStatMode "_stat/mode" +#define kAttrStatOwner "_stat/owner" +#define kAttrStatGroup "_stat/group" +#define kAttrPath "_trk/path" +#define kAttrOriginalPath "_trk/original_path" +#define kAttrAppVersion "_trk/app_version" +#define kAttrSystemVersion "_trk/system_version" +#define kAttrOpenWithRelation "_trk/open_with_relation" // private attributes -#define kAttrWindowFrame "_trk/windframe" -#define kAttrWindowWorkspace "_trk/windwkspc" -#define kAttrWindowDecor "_trk/winddecor" +#define kAttrWindowFrame "_trk/windframe" +#define kAttrWindowWorkspace "_trk/windwkspc" +#define kAttrWindowDecor "_trk/winddecor" -#define kAttrQueryString "_trk/qrystr" -#define kAttrQueryVolume "_trk/qryvol1" +#define kAttrQueryString "_trk/qrystr" +#define kAttrQueryVolume "_trk/qryvol1" -#define kAttrMIMEType "BEOS:TYPE" -#define kAttrAppSignature "BEOS:APP_SIG" -#define kAttrPreferredApp "BEOS:PREF_APP" -#define kAttrLargeIcon "BEOS:L:STD_ICON" -#define kAttrMiniIcon "BEOS:M:STD_ICON" -#define kAttrIcon "BEOS:ICON" +#define kAttrMIMEType "BEOS:TYPE" +#define kAttrAppSignature "BEOS:APP_SIG" +#define kAttrPreferredApp "BEOS:PREF_APP" +#define kAttrLargeIcon "BEOS:L:STD_ICON" +#define kAttrMiniIcon "BEOS:M:STD_ICON" +#define kAttrIcon "BEOS:ICON" -#define kAttrDisksFrame "_trk/d_windframe" -#define kAttrDisksWorkspace "_trk/d_windwkspc" +#define kAttrDisksFrame "_trk/d_windframe" +#define kAttrDisksWorkspace "_trk/d_windwkspc" -#define kAttrOpenWindows "_trk/_windows_to_open_" +#define kAttrOpenWindows "_trk/_windows_to_open_" -#define kAttrClippingFile "_trk/_clipping_file_" +#define kAttrClippingFile "_trk/_clipping_file_" -#define kAttrQueryInitialMode "_trk/qryinitmode" -#define kAttrQueryInitialString "_trk/qryinitstr" -#define kAttrQueryInitialNumAttrs "_trk/qryinitnumattrs" -#define kAttrQueryInitialAttrs "_trk/qryinitattrs" -#define kAttrQueryInitialMime "_trk/qryinitmime" -#define kAttrQueryLastChange "_trk/qrylastchange" +#define kAttrQueryInitialMode "_trk/qryinitmode" +#define kAttrQueryInitialString "_trk/qryinitstr" +#define kAttrQueryInitialNumAttrs "_trk/qryinitnumattrs" +#define kAttrQueryInitialAttrs "_trk/qryinitattrs" +#define kAttrQueryInitialMime "_trk/qryinitmime" +#define kAttrQueryLastChange "_trk/qrylastchange" -#define kAttrQueryMoreOptions_le "_trk/qrymoreoptions_le" -#define kAttrQueryMoreOptions_be "_trk/qrymoreoptions" +#define kAttrQueryMoreOptions_le "_trk/qrymoreoptions_le" +#define kAttrQueryMoreOptions_be "_trk/qrymoreoptions" -#define kAttrQueryTemplate "_trk/queryTemplate" -#define kAttrQueryTemplateName "_trk/queryTemplateName" -#define kAttrDynamicDateQuery "_trk/queryDynamicDate" +#define kAttrQueryTemplate "_trk/queryTemplate" +#define kAttrQueryTemplateName "_trk/queryTemplateName" +#define kAttrDynamicDateQuery "_trk/queryDynamicDate" // attributes that need endian swapping (stored as raw) -#define kAttrPoseInfo_be "_trk/pinfo" -#define kAttrPoseInfo_le "_trk/pinfo_le" -#define kAttrDisksPoseInfo_be "_trk/d_pinfo" -#define kAttrDisksPoseInfo_le "_trk/d_pinfo_le" -#define kAttrTrashPoseInfo_be "_trk/t_pinfo" -#define kAttrTrashPoseInfo_le "_trk/t_pinfo_le" -#define kAttrColumns_be "_trk/columns" -#define kAttrColumns_le "_trk/columns_le" -#define kAttrViewState_be "_trk/viewstate" -#define kAttrViewState_le "_trk/viewstate_le" -#define kAttrDisksViewState_be "_trk/d_viewstate" -#define kAttrDisksViewState_le "_trk/d_viewstate_le" -#define kAttrDesktopViewState_be "_trk/desk_viewstate" -#define kAttrDesktopViewState_le "_trk/desk_viewstate_le" -#define kAttrDisksColumns_be "_trk/d_columns" -#define kAttrDisksColumns_le "_trk/d_columns_le" +#define kAttrPoseInfo_be "_trk/pinfo" +#define kAttrPoseInfo_le "_trk/pinfo_le" +#define kAttrDisksPoseInfo_be "_trk/d_pinfo" +#define kAttrDisksPoseInfo_le "_trk/d_pinfo_le" +#define kAttrTrashPoseInfo_be "_trk/t_pinfo" +#define kAttrTrashPoseInfo_le "_trk/t_pinfo_le" +#define kAttrColumns_be "_trk/columns" +#define kAttrColumns_le "_trk/columns_le" +#define kAttrViewState_be "_trk/viewstate" +#define kAttrViewState_le "_trk/viewstate_le" +#define kAttrDisksViewState_be "_trk/d_viewstate" +#define kAttrDisksViewState_le "_trk/d_viewstate_le" +#define kAttrDesktopViewState_be "_trk/desk_viewstate" +#define kAttrDesktopViewState_le "_trk/desk_viewstate_le" +#define kAttrDisksColumns_be "_trk/d_columns" +#define kAttrDisksColumns_le "_trk/d_columns_le" -#define kAttrExtendedPoseInfo_be "_trk/xtpinfo" -#define kAttrExtendedPoseInfo_le "_trk/xtpinfo_le" -#define kAttrExtendedDisksPoseInfo_be "_trk/xt_d_pinfo" -#define kAttrExtendedDisksPoseInfo_le "_trk/xt_d_pinfo_le" +#define kAttrExtendedPoseInfo_be "_trk/xtpinfo" +#define kAttrExtendedPoseInfo_le "_trk/xtpinfo_le" +#define kAttrExtendedDisksPoseInfo_be "_trk/xt_d_pinfo" +#define kAttrExtendedDisksPoseInfo_le "_trk/xt_d_pinfo_le" #if B_HOST_IS_LENDIAN -#define kEndianSuffix "_le" -#define kForeignEndianSuffix "" +#define kEndianSuffix "_le" +#define kForeignEndianSuffix "" -#define kAttrDisksPoseInfo kAttrDisksPoseInfo_le -#define kAttrDisksPoseInfoForeign kAttrDisksPoseInfo_be +#define kAttrDisksPoseInfo kAttrDisksPoseInfo_le +#define kAttrDisksPoseInfoForeign kAttrDisksPoseInfo_be -#define kAttrTrashPoseInfo kAttrTrashPoseInfo_le -#define kAttrTrashPoseInfoForeign kAttrTrashPoseInfo_be +#define kAttrTrashPoseInfo kAttrTrashPoseInfo_le +#define kAttrTrashPoseInfoForeign kAttrTrashPoseInfo_be -#define kAttrPoseInfo kAttrPoseInfo_le -#define kAttrPoseInfoForeign kAttrPoseInfo_be +#define kAttrPoseInfo kAttrPoseInfo_le +#define kAttrPoseInfoForeign kAttrPoseInfo_be -#define kAttrColumns kAttrColumns_le -#define kAttrColumnsForeign kAttrColumns_be +#define kAttrColumns kAttrColumns_le +#define kAttrColumnsForeign kAttrColumns_be -#define kAttrViewState kAttrViewState_le -#define kAttrViewStateForeign kAttrViewState_be +#define kAttrViewState kAttrViewState_le +#define kAttrViewStateForeign kAttrViewState_be -#define kAttrDisksViewState kAttrDisksViewState_le -#define kAttrDisksViewStateForeign kAttrDisksViewState_be +#define kAttrDisksViewState kAttrDisksViewState_le +#define kAttrDisksViewStateForeign kAttrDisksViewState_be -#define kAttrDisksColumns kAttrDisksColumns_le -#define kAttrDisksColumnsForeign kAttrDisksColumns_be +#define kAttrDisksColumns kAttrDisksColumns_le +#define kAttrDisksColumnsForeign kAttrDisksColumns_be -#define kAttrDesktopViewState kAttrDesktopViewState_le -#define kAttrDesktopViewStateForeign kAttrDesktopViewState_be +#define kAttrDesktopViewState kAttrDesktopViewState_le +#define kAttrDesktopViewStateForeign kAttrDesktopViewState_be -#define kAttrQueryMoreOptions kAttrQueryMoreOptions_le -#define kAttrQueryMoreOptionsForeign kAttrQueryMoreOptions_be -#define kAttrExtendedPoseInfo kAttrExtendedPoseInfo_le -#define kAttrExtendedPoseInfoForegin kAttrExtendedPoseInfo_be -#define kAttrExtendedDisksPoseInfo kAttrExtendedDisksPoseInfo_le -#define kAttrExtendedDisksPoseInfoForegin kAttrExtendedDisksPoseInfo_be +#define kAttrQueryMoreOptions kAttrQueryMoreOptions_le +#define kAttrQueryMoreOptionsForeign kAttrQueryMoreOptions_be +#define kAttrExtendedPoseInfo kAttrExtendedPoseInfo_le +#define kAttrExtendedPoseInfoForegin kAttrExtendedPoseInfo_be +#define kAttrExtendedDisksPoseInfo kAttrExtendedDisksPoseInfo_le +#define kAttrExtendedDisksPoseInfoForegin kAttrExtendedDisksPoseInfo_be #else -#define kEndianSuffix "" -#define kForeignEndianSuffix "_le" +#define kEndianSuffix "" +#define kForeignEndianSuffix "_le" -#define kAttrDisksPoseInfo kAttrDisksPoseInfo_be -#define kAttrDisksPoseInfoForeign kAttrDisksPoseInfo_le +#define kAttrDisksPoseInfo kAttrDisksPoseInfo_be +#define kAttrDisksPoseInfoForeign kAttrDisksPoseInfo_le -#define kAttrTrashPoseInfo kAttrTrashPoseInfo_be -#define kAttrTrashPoseInfoForeign kAttrTrashPoseInfo_le +#define kAttrTrashPoseInfo kAttrTrashPoseInfo_be +#define kAttrTrashPoseInfoForeign kAttrTrashPoseInfo_le -#define kAttrPoseInfo kAttrPoseInfo_be -#define kAttrPoseInfoForeign kAttrPoseInfo_le +#define kAttrPoseInfo kAttrPoseInfo_be +#define kAttrPoseInfoForeign kAttrPoseInfo_le -#define kAttrColumns kAttrColumns_be -#define kAttrColumnsForeign kAttrColumns_le +#define kAttrColumns kAttrColumns_be +#define kAttrColumnsForeign kAttrColumns_le -#define kAttrViewState kAttrViewState_be -#define kAttrViewStateForeign kAttrViewState_le +#define kAttrViewState kAttrViewState_be +#define kAttrViewStateForeign kAttrViewState_le -#define kAttrDisksViewState kAttrDisksViewState_be -#define kAttrDisksViewStateForeign kAttrDisksViewState_le +#define kAttrDisksViewState kAttrDisksViewState_be +#define kAttrDisksViewStateForeign kAttrDisksViewState_le -#define kAttrDisksColumns kAttrDisksColumns_be -#define kAttrDisksColumnsForeign kAttrDisksColumns_le +#define kAttrDisksColumns kAttrDisksColumns_be +#define kAttrDisksColumnsForeign kAttrDisksColumns_le -#define kAttrDesktopViewState kAttrViewState_be -#define kAttrDesktopViewStateForeign kAttrViewState_le +#define kAttrDesktopViewState kAttrViewState_be +#define kAttrDesktopViewStateForeign kAttrViewState_le -#define kAttrQueryMoreOptions kAttrQueryMoreOptions_be -#define kAttrQueryMoreOptionsForeign kAttrQueryMoreOptions_le -#define kAttrExtendedPoseInfo kAttrExtendedPoseInfo_be -#define kAttrExtendedPoseInfoForegin kAttrExtendedPoseInfo_le -#define kAttrExtendedDisksPoseInfo kAttrExtendedDisksPoseInfo_be -#define kAttrExtendedDisksPoseInfoForegin kAttrExtendedDisksPoseInfo_le +#define kAttrQueryMoreOptions kAttrQueryMoreOptions_be +#define kAttrQueryMoreOptionsForeign kAttrQueryMoreOptions_le +#define kAttrExtendedPoseInfo kAttrExtendedPoseInfo_be +#define kAttrExtendedPoseInfoForegin kAttrExtendedPoseInfo_le +#define kAttrExtendedDisksPoseInfo kAttrExtendedDisksPoseInfo_be +#define kAttrExtendedDisksPoseInfoForegin kAttrExtendedDisksPoseInfo_le #endif diff --git a/src/kits/tracker/AutoMounterSettings.cpp b/src/kits/tracker/AutoMounterSettings.cpp index 795870fa44..33730b3bcd 100644 --- a/src/kits/tracker/AutoMounterSettings.cpp +++ b/src/kits/tracker/AutoMounterSettings.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "AutoMounterSettings.h" #include diff --git a/src/kits/tracker/AutoMounterSettings.h b/src/kits/tracker/AutoMounterSettings.h index 88fa68de11..75cfbb90cb 100644 --- a/src/kits/tracker/AutoMounterSettings.h +++ b/src/kits/tracker/AutoMounterSettings.h @@ -31,7 +31,6 @@ 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. */ - #ifndef AUTOMOUNTER_SETTINGS_H #define AUTOMOUNTER_SETTINGS_H @@ -43,13 +42,13 @@ namespace BPrivate { class AutomountSettingsDialog : public BWindow { public: - AutomountSettingsDialog(BMessage *settings, const BMessenger &target); + AutomountSettingsDialog(BMessage* settings, const BMessenger &target); virtual ~AutomountSettingsDialog(); static void RunAutomountSettings(const BMessenger &target); private: - static AutomountSettingsDialog *sOneCopyOnly; + static AutomountSettingsDialog* sOneCopyOnly; }; } // namespace BPrivate diff --git a/src/kits/tracker/Background.h b/src/kits/tracker/Background.h index cf8afccddb..b850313ff4 100644 --- a/src/kits/tracker/Background.h +++ b/src/kits/tracker/Background.h @@ -68,4 +68,4 @@ enum { const int32 B_RESTORE_BACKGROUND_IMAGE = 'Tbgr'; // force a Tracker window to // use a new background image -#endif /* _TRACKER_BACKGROUND_H */ +#endif // _TRACKER_BACKGROUND_H diff --git a/src/kits/tracker/BackgroundImage.cpp b/src/kits/tracker/BackgroundImage.cpp index 565ee90dc3..f12d110bb0 100644 --- a/src/kits/tracker/BackgroundImage.cpp +++ b/src/kits/tracker/BackgroundImage.cpp @@ -33,7 +33,7 @@ All rights reserved. */ // Classes used for setting up and managing background images -// + #include #include @@ -50,26 +50,28 @@ All rights reserved. #include "Commands.h" #include "PoseView.h" + namespace BPrivate { -const char *kBackgroundImageInfo = B_BACKGROUND_INFO; -const char *kBackgroundImageInfoOffset = B_BACKGROUND_ORIGIN; -const char *kBackgroundImageInfoTextOutline = B_BACKGROUND_TEXT_OUTLINE; -const char *kBackgroundImageInfoMode = B_BACKGROUND_MODE; -const char *kBackgroundImageInfoWorkspaces = B_BACKGROUND_WORKSPACES; -const char *kBackgroundImageInfoPath = B_BACKGROUND_IMAGE; +const char* kBackgroundImageInfo = B_BACKGROUND_INFO; +const char* kBackgroundImageInfoOffset = B_BACKGROUND_ORIGIN; +const char* kBackgroundImageInfoTextOutline = B_BACKGROUND_TEXT_OUTLINE; +const char* kBackgroundImageInfoMode = B_BACKGROUND_MODE; +const char* kBackgroundImageInfoWorkspaces = B_BACKGROUND_WORKSPACES; +const char* kBackgroundImageInfoPath = B_BACKGROUND_IMAGE; -} +} // namespace BPrivate -BackgroundImage * -BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop) + +BackgroundImage* +BackgroundImage::GetBackgroundImage(const BNode* node, bool isDesktop) { attr_info info; if (node->GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) return NULL; BMessage container; - char *buffer = new char [info.size]; + char* buffer = new char [info.size]; status_t error = node->ReadAttr(kBackgroundImageInfo, info.type, 0, buffer, (size_t)info.size); if (error == info.size) @@ -80,14 +82,14 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop) if (error != B_OK) return NULL; - BackgroundImage *result = NULL; + BackgroundImage* result = NULL; for (int32 index = 0; ; index++) { - const char *path; + const char* path; uint32 workspaces = B_ALL_WORKSPACES; Mode mode = kTiled; bool textWidgetLabelOutline = false; BPoint offset; - BBitmap *bitmap = NULL; + BBitmap* bitmap = NULL; if (container.FindString(kBackgroundImageInfoPath, index, &path) == B_OK) { bitmap = BTranslationUtils::GetBitmap(path); @@ -102,12 +104,12 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop) be_control_look->SetBackgroundInfo(container); } - container.FindInt32(kBackgroundImageInfoWorkspaces, index, (int32 *)&workspaces); - container.FindInt32(kBackgroundImageInfoMode, index, (int32 *)&mode); + container.FindInt32(kBackgroundImageInfoWorkspaces, index, (int32*)&workspaces); + container.FindInt32(kBackgroundImageInfoMode, index, (int32*)&mode); container.FindBool(kBackgroundImageInfoTextOutline, index, &textWidgetLabelOutline); container.FindPoint(kBackgroundImageInfoOffset, index, &offset); - BackgroundImage::BackgroundImageInfo *imageInfo = new + BackgroundImage::BackgroundImageInfo* imageInfo = new BackgroundImage::BackgroundImageInfo(workspaces, bitmap, mode, offset, textWidgetLabelOutline); @@ -121,7 +123,7 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop) BackgroundImage::BackgroundImageInfo::BackgroundImageInfo(uint32 workspaces, - BBitmap *bitmap, Mode mode, BPoint offset, bool textWidgetOutline) + BBitmap* bitmap, Mode mode, BPoint offset, bool textWidgetOutline) : fWorkspace(workspaces), fBitmap(bitmap), fMode(mode), @@ -137,7 +139,7 @@ BackgroundImage::BackgroundImageInfo::~BackgroundImageInfo() } -BackgroundImage::BackgroundImage(const BNode *node, bool desktop) +BackgroundImage::BackgroundImage(const BNode* node, bool desktop) : fIsDesktop(desktop), fDefinedByNode(*node), fView(NULL), @@ -153,20 +155,20 @@ BackgroundImage::~BackgroundImage() void -BackgroundImage::Add(BackgroundImageInfo *info) +BackgroundImage::Add(BackgroundImageInfo* info) { fBitmapForWorkspaceList.AddItem(info); } void -BackgroundImage::Show(BView *view, int32 workspace) +BackgroundImage::Show(BView* view, int32 workspace) { fView = view; - BackgroundImageInfo *info = ImageInfoForWorkspace(workspace); + BackgroundImageInfo* info = ImageInfoForWorkspace(workspace); if (info) { - BPoseView *poseView = dynamic_cast(fView); + BPoseView* poseView = dynamic_cast(fView); if (poseView) poseView->SetWidgetTextOutline(info->fTextWidgetOutline); Show(info, fView); @@ -174,9 +176,9 @@ BackgroundImage::Show(BView *view, int32 workspace) } void -BackgroundImage::Show(BackgroundImageInfo *info, BView *view) +BackgroundImage::Show(BackgroundImageInfo* info, BView* view) { - BPoseView *poseView = dynamic_cast(view); + BPoseView* poseView = dynamic_cast(view); if (poseView) poseView->SetWidgetTextOutline(info->fTextWidgetOutline); @@ -271,7 +273,7 @@ BackgroundImage::Remove() if (fShowingBitmap) { fView->ClearViewBitmap(); fView->Invalidate(); - BPoseView *poseView = dynamic_cast(fView); + BPoseView* poseView = dynamic_cast(fView); // make sure text widgets draw the default way, erasing their background if (poseView) poseView->SetWidgetTextOutline(true); @@ -279,7 +281,7 @@ BackgroundImage::Remove() fShowingBitmap = NULL; } -BackgroundImage::BackgroundImageInfo * +BackgroundImage::BackgroundImageInfo* BackgroundImage::ImageInfoForWorkspace(int32 workspace) const { uint32 workspaceMask = 1; @@ -292,9 +294,9 @@ BackgroundImage::ImageInfoForWorkspace(int32 workspace) const // do a simple lookup for the most likely candidate bitmap - // pick the imageInfo that is only defined for this workspace over one // that supports multiple workspaces - BackgroundImageInfo *result = NULL; + BackgroundImageInfo* result = NULL; for (int32 index = 0; index < count; index++) { - BackgroundImageInfo *info = fBitmapForWorkspaceList.ItemAt(index); + BackgroundImageInfo* info = fBitmapForWorkspaceList.ItemAt(index); if (info->fWorkspace == workspaceMask) return info; if (info->fWorkspace & workspaceMask) @@ -305,7 +307,7 @@ BackgroundImage::ImageInfoForWorkspace(int32 workspace) const } void -BackgroundImage::WorkspaceActivated(BView *view, int32 workspace, bool state) +BackgroundImage::WorkspaceActivated(BView* view, int32 workspace, bool state) { if (!fIsDesktop) // we only care for desktop bitmaps @@ -315,13 +317,13 @@ BackgroundImage::WorkspaceActivated(BView *view, int32 workspace, bool state) // we only care comming into a new workspace, not leaving one return; - BackgroundImageInfo *info = ImageInfoForWorkspace(workspace); + BackgroundImageInfo* info = ImageInfoForWorkspace(workspace); if (info != fShowingBitmap) { if (info) Show(info, view); else { - if (BPoseView *poseView = dynamic_cast(view)) + if (BPoseView* poseView = dynamic_cast(view)) poseView->SetWidgetTextOutline(true); view->ClearViewBitmap(); view->Invalidate(); @@ -350,16 +352,16 @@ BackgroundImage::ScreenChanged(BRect, color_space) } } -BackgroundImage * -BackgroundImage::Refresh(BackgroundImage *oldBackgroundImage, - const BNode *fromNode, bool desktop, BPoseView *poseView) +BackgroundImage* +BackgroundImage::Refresh(BackgroundImage* oldBackgroundImage, + const BNode* fromNode, bool desktop, BPoseView* poseView) { if (oldBackgroundImage) { oldBackgroundImage->Remove(); delete oldBackgroundImage; } - BackgroundImage *result = GetBackgroundImage(fromNode, desktop); + BackgroundImage* result = GetBackgroundImage(fromNode, desktop); if (result && poseView->ViewMode() != kListMode) result->Show(poseView, current_workspace()); diff --git a/src/kits/tracker/BackgroundImage.h b/src/kits/tracker/BackgroundImage.h index cba8f75405..d5857caa23 100644 --- a/src/kits/tracker/BackgroundImage.h +++ b/src/kits/tracker/BackgroundImage.h @@ -31,16 +31,17 @@ 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. */ - -// Classes used for setting up and managing background images -// - #ifndef __BACKGROUND_IMAGE__ #define __BACKGROUND_IMAGE__ + +// Classes used for setting up and managing background images + + #include #include "ObjectList.h" + class BNode; class BView; class BBitmap; @@ -50,12 +51,12 @@ namespace BPrivate { class BackgroundImage; class BPoseView; -extern const char *kBackgroundImageInfo; -extern const char *kBackgroundImageInfoOffset; -extern const char *kBackgroundImageInfoTextOutline; -extern const char *kBackgroundImageInfoMode; -extern const char *kBackgroundImageInfoWorkspaces; -extern const char *kBackgroundImageInfoPath; +extern const char* kBackgroundImageInfo; +extern const char* kBackgroundImageInfoOffset; +extern const char* kBackgroundImageInfoTextOutline; +extern const char* kBackgroundImageInfoMode; +extern const char* kBackgroundImageInfoWorkspaces; +extern const char* kBackgroundImageInfoPath; const uint32 kRestoreBackgroundImage = 'Tbgr'; @@ -76,44 +77,44 @@ public: class BackgroundImageInfo { // element of the per-workspace list public: - BackgroundImageInfo(uint32 workspace, BBitmap *bitmap, Mode mode, BPoint offset, + BackgroundImageInfo(uint32 workspace, BBitmap* bitmap, Mode mode, BPoint offset, bool textWidgetOutline); ~BackgroundImageInfo(); uint32 fWorkspace; - BBitmap *fBitmap; + BBitmap* fBitmap; Mode fMode; BPoint fOffset; bool fTextWidgetOutline; }; - static BackgroundImage *GetBackgroundImage(const BNode *node, + static BackgroundImage* GetBackgroundImage(const BNode* node, bool isDesktop); // create a BackgroundImage object by reading it from a node virtual ~BackgroundImage(); - void Show(BView *view, int32 workspace); + void Show(BView* view, int32 workspace); // display the right background for a given workspace void Remove(); // remove the background from it's current view - void WorkspaceActivated(BView *view, int32 workspace, bool state); + void WorkspaceActivated(BView* view, int32 workspace, bool state); // respond to a workspace change void ScreenChanged(BRect rect, color_space space); // respond to a screen size change - static BackgroundImage *Refresh(BackgroundImage *oldBackgroundImage, - const BNode *fromNode, bool desktop, BPoseView *poseView); + static BackgroundImage* Refresh(BackgroundImage* oldBackgroundImage, + const BNode* fromNode, bool desktop, BPoseView* poseView); // respond to a background image setting change private: - BackgroundImageInfo *ImageInfoForWorkspace(int32) const; - void Show(BackgroundImageInfo *, BView *view); + BackgroundImageInfo* ImageInfoForWorkspace(int32) const; + void Show(BackgroundImageInfo*, BView* view); - BackgroundImage(const BNode *, bool); + BackgroundImage(const BNode*, bool); // no public constructor, GetBackgroundImage factory function is // used instead - void Add(BackgroundImageInfo *); + void Add(BackgroundImageInfo*); float BRectRatio(BRect rect); float BRectHorizontalOverlap(BRect hostRect, BRect resizedRect); @@ -121,13 +122,12 @@ private: bool fIsDesktop; BNode fDefinedByNode; - BView *fView; - BackgroundImageInfo *fShowingBitmap; + BView* fView; + BackgroundImageInfo* fShowingBitmap; BObjectList fBitmapForWorkspaceList; }; - } // namespace BPrivate using namespace BPrivate; diff --git a/src/kits/tracker/Bitmaps.cpp b/src/kits/tracker/Bitmaps.cpp index ed22d54217..2f4f68cbf5 100644 --- a/src/kits/tracker/Bitmaps.cpp +++ b/src/kits/tracker/Bitmaps.cpp @@ -48,7 +48,7 @@ All rights reserved. #endif -BImageResources::BImageResources(void *memAddr) +BImageResources::BImageResources(void* memAddr) { image_id image = find_image(memAddr); image_info info; @@ -71,7 +71,7 @@ BImageResources::~BImageResources() } -const BResources * +const BResources* BImageResources::ViewResources() const { if (fLock.Lock() != B_OK) @@ -81,7 +81,7 @@ BImageResources::ViewResources() const } -BResources * +BResources* BImageResources::ViewResources() { if (fLock.Lock() != B_OK) @@ -92,7 +92,7 @@ BImageResources::ViewResources() status_t -BImageResources::FinishResources(BResources *res) const +BImageResources::FinishResources(BResources* res) const { ASSERT(res == &fResources); if (res != &fResources) @@ -103,8 +103,8 @@ BImageResources::FinishResources(BResources *res) const } -const void * -BImageResources::LoadResource(type_code type, int32 id, size_t *out_size) const +const void* +BImageResources::LoadResource(type_code type, int32 id, size_t* out_size) const { // Serialize execution. // Looks like BResources is not really thread safe. We should @@ -116,12 +116,12 @@ BImageResources::LoadResource(type_code type, int32 id, size_t *out_size) const // Return the resource. Because we never change the BResources // object, the returned data will not change until TTracker is // destroyed. - return const_cast(&fResources)->LoadResource(type, id, out_size); + return const_cast(&fResources)->LoadResource(type, id, out_size); } -const void * -BImageResources::LoadResource(type_code type, const char *name, size_t *out_size) const +const void* +BImageResources::LoadResource(type_code type, const char* name, size_t* out_size) const { // Serialize execution. BAutolock lock(fLock); @@ -131,15 +131,15 @@ BImageResources::LoadResource(type_code type, const char *name, size_t *out_size // Return the resource. Because we never change the BResources // object, the returned data will not change until TTracker is // destroyed. - return const_cast(&fResources)->LoadResource(type, name, out_size); + return const_cast(&fResources)->LoadResource(type, name, out_size); } status_t -BImageResources::GetIconResource(int32 id, icon_size size, BBitmap *dest) const +BImageResources::GetIconResource(int32 id, icon_size size, BBitmap* dest) const { size_t length = 0; - const void *data; + const void* data; #ifdef __HAIKU__ // try to load vector icon @@ -194,27 +194,30 @@ BImageResources::GetIconResource(int32 id, const uint8** iconData, image_id -BImageResources::find_image(void *memAddr) const +BImageResources::find_image(void* memAddr) const { image_info info; int32 cookie = 0; while (get_next_image_info(0, &cookie, &info) == B_OK) - if ((info.text <= memAddr && (((uint8 *)info.text)+info.text_size) > memAddr) - ||(info.data <= memAddr && (((uint8 *)info.data)+info.data_size) > memAddr)) + if ((info.text <= memAddr + && (((uint8*)info.text)+info.text_size) > memAddr) + || (info.data <= memAddr + && (((uint8*)info.data)+info.data_size) > memAddr)) { // Found the image. return info.id; + } return -1; } status_t -BImageResources::GetBitmapResource(type_code type, int32 id, BBitmap **out) const +BImageResources::GetBitmapResource(type_code type, int32 id, BBitmap** out) const { *out = NULL; size_t len = 0; - const void *data = LoadResource(type, id, &len); + const void* data = LoadResource(type, id, &len); if (data == NULL) { TRESPASS(); @@ -245,7 +248,7 @@ BImageResources::GetBitmapResource(type_code type, int32 id, BBitmap **out) cons static BLocker resLock; -static BImageResources *resources = NULL; +static BImageResources* resources = NULL; // This class is used as a static instance to delete the resources // global object when the image is getting unloaded. @@ -265,7 +268,7 @@ namespace BPrivate { static _TTrackerCleanupResources CleanupResources; -BImageResources *GetTrackerResources() +BImageResources* GetTrackerResources() { if (!resources) { BAutolock lock(&resLock); diff --git a/src/kits/tracker/Bitmaps.h b/src/kits/tracker/Bitmaps.h index 3f3ced9219..c04331fd67 100644 --- a/src/kits/tracker/Bitmaps.h +++ b/src/kits/tracker/Bitmaps.h @@ -31,7 +31,6 @@ 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. */ - #ifndef __BITS__ #define __BITS__ @@ -43,31 +42,32 @@ All rights reserved. #include "TrackerIcons.h" + class BBitmap; namespace BPrivate { class BImageResources { - // convenience class for accessing + // convenience class for accessing public: - BImageResources(void *memAddr); + BImageResources(void* memAddr); ~BImageResources(); - - BResources *ViewResources(); - const BResources *ViewResources() const; - - status_t FinishResources(BResources *) const; - - const void *LoadResource(type_code type, int32 id, - size_t *outSize) const; - const void *LoadResource(type_code type, const char *name, - size_t *outSize) const; + + BResources* ViewResources(); + const BResources* ViewResources() const; + + status_t FinishResources(BResources*) const; + + const void* LoadResource(type_code type, int32 id, + size_t* outSize) const; + const void* LoadResource(type_code type, const char* name, + size_t* outSize) const; // load a resource from the Tracker executable, just like the // corresponding functions in BResources. These methods are // thread-safe. - - status_t GetIconResource(int32 id, icon_size size, BBitmap *dest) const; + + status_t GetIconResource(int32 id, icon_size size, BBitmap* dest) const; // this is a wrapper around LoadResource(), for retrieving // B_LARGE_ICON and B_MINI_ICON ('ICON' and 'MICN' respectively) // resources. this does sanity checking on the found data, @@ -78,7 +78,7 @@ public: // this is a wrapper around LoadResource(), for retrieving // the vector icon data - status_t GetBitmapResource(type_code type, int32 id, BBitmap **out) const; + status_t GetBitmapResource(type_code type, int32 id, BBitmap** out) const; // this is a wrapper around LoadResource(), for retrieving // arbitrary bitmaps. the resource with the given type and // id is looked up, and a BBitmap created from it and returned @@ -86,13 +86,12 @@ public: // that is an archived bitmap object. private: - image_id find_image(void *memAddr) const; + image_id find_image(void* memAddr) const; mutable BLocker fLock; BResources fResources; }; - extern #ifdef _IMPEXP_TRACKER @@ -100,6 +99,7 @@ _IMPEXP_TRACKER #endif BImageResources* GetTrackerResources(); + } // namespace BPrivate using namespace BPrivate; diff --git a/src/kits/tracker/Commands.h b/src/kits/tracker/Commands.h index c2e19d3646..208cbb68ff 100644 --- a/src/kits/tracker/Commands.h +++ b/src/kits/tracker/Commands.h @@ -31,10 +31,10 @@ 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. */ - #ifndef _COMMANDS_H #define _COMMANDS_H + #include "PublicCommands.h" #include diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index fc9649e375..34d9b28550 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -110,12 +110,12 @@ namespace BPrivate { class DraggableContainerIcon : public BView { public: - DraggableContainerIcon(BRect rect, const char *name, uint32 resizeMask); + DraggableContainerIcon(BRect rect, const char* name, uint32 resizeMask); virtual void AttachedToWindow(); virtual void MouseDown(BPoint where); virtual void MouseUp(BPoint where); - virtual void MouseMoved(BPoint point, uint32 /*transit*/, const BMessage *message); + virtual void MouseMoved(BPoint point, uint32 /*transit*/, const BMessage* message); virtual void FrameMoved(BPoint newLocation); virtual void Draw(BRect updateRect); @@ -128,8 +128,8 @@ class DraggableContainerIcon : public BView { } // namespace BPrivate struct AddOneAddonParams { - BObjectList *primaryList; - BObjectList *secondaryList; + BObjectList* primaryList; + BObjectList* secondaryList; }; struct StaggerOneParams { @@ -147,9 +147,9 @@ BRect BContainerWindow::sNewWindRect(85, 50, 548, 280); namespace BPrivate { filter_result -ActivateWindowFilter(BMessage *, BHandler **target, BMessageFilter *) +ActivateWindowFilter(BMessage*, BHandler** target, BMessageFilter*) { - BView *view = dynamic_cast(*target); + BView* view = dynamic_cast(*target); // activate the window if no PoseView or DraggableContainerIcon had been pressed // (those will activate the window themselves, if necessary) @@ -164,7 +164,7 @@ ActivateWindowFilter(BMessage *, BHandler **target, BMessageFilter *) static void -StripShortcut(const Model *model, char *result, uint32 &shortcut) +StripShortcut(const Model* model, char* result, uint32 &shortcut) { // model name (possibly localized) for the menu item label strlcpy(result, model->Name(), B_FILE_NAME_LENGTH); @@ -189,14 +189,14 @@ StripShortcut(const Model *model, char *result, uint32 &shortcut) } -static const Model * -MatchOne(const Model *model, void *castToName) +static const Model* +MatchOne(const Model* model, void* castToName) { char buffer[B_FILE_NAME_LENGTH]; uint32 dummy; StripShortcut(model, buffer, dummy); - if (strcmp(buffer, (const char *)castToName) == 0) { + if (strcmp(buffer, (const char*)castToName) == 0) { // found match, bail out return model; } @@ -206,7 +206,7 @@ MatchOne(const Model *model, void *castToName) int -CompareLabels(const BMenuItem *item1, const BMenuItem *item2) +CompareLabels(const BMenuItem* item1, const BMenuItem* item2) { return strcasecmp(item1->Label(), item2->Label()); } @@ -215,14 +215,14 @@ CompareLabels(const BMenuItem *item1, const BMenuItem *item2) static bool -AddOneAddon(const Model *model, const char *name, uint32 shortcut, bool primary, void *context) +AddOneAddon(const Model* model, const char* name, uint32 shortcut, bool primary, void* context) { - AddOneAddonParams *params = (AddOneAddonParams *)context; + AddOneAddonParams* params = (AddOneAddonParams*)context; - BMessage *message = new BMessage(kLoadAddOn); + BMessage* message = new BMessage(kLoadAddOn); message->AddRef("refs", model->EntryRef()); - ModelMenuItem *item = new ModelMenuItem(model, name, message, + ModelMenuItem* item = new ModelMenuItem(model, name, message, (char)shortcut, B_OPTION_KEY); if (primary) @@ -235,7 +235,7 @@ AddOneAddon(const Model *model, const char *name, uint32 shortcut, bool primary, static int32 -AddOnThread(BMessage *refsMessage, entry_ref addonRef, entry_ref dirRef) +AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref dirRef) { std::auto_ptr refsMessagePtr(refsMessage); @@ -248,15 +248,15 @@ AddOnThread(BMessage *refsMessage, entry_ref addonRef, entry_ref dirRef) if (result == B_OK) { image_id addonImage = load_add_on(path.Path()); if (addonImage >= 0) { - void (*processRefs)(entry_ref, BMessage *, void *); - result = get_image_symbol(addonImage, "process_refs", 2, (void **)&processRefs); + void (*processRefs)(entry_ref, BMessage*, void*); + result = get_image_symbol(addonImage, "process_refs", 2, (void**)&processRefs); #ifndef __INTEL__ if (result < 0) { PRINT(("trying old legacy ppc signature\n")); // try old-style addon signature result = get_image_symbol(addonImage, - "process_refs__F9entry_refP8BMessagePv", 2, (void **)&processRefs); + "process_refs__F9entry_refP8BMessagePv", 2, (void**)&processRefs); } #endif @@ -289,7 +289,7 @@ AddOnThread(BMessage *refsMessage, entry_ref addonRef, entry_ref dirRef) static bool -NodeHasSavedState(const BNode *node) +NodeHasSavedState(const BNode* node) { attr_info info; return node->GetAttrInfo(kAttrWindowFrame, &info) == B_OK; @@ -297,11 +297,11 @@ NodeHasSavedState(const BNode *node) static bool -OffsetFrameOne(const char *DEBUG_ONLY(name), uint32, off_t, void *castToRect, - void *castToParams) +OffsetFrameOne(const char* DEBUG_ONLY(name), uint32, off_t, void* castToRect, + void* castToParams) { ASSERT(strcmp(name, kAttrWindowFrame) == 0); - StaggerOneParams *params = (StaggerOneParams *)castToParams; + StaggerOneParams* params = (StaggerOneParams*)castToParams; if (!params->rectFromParent) return false; @@ -309,20 +309,20 @@ OffsetFrameOne(const char *DEBUG_ONLY(name), uint32, off_t, void *castToRect, if (!castToRect) return false; - ((BRect *)castToRect)->OffsetBy(kWindowStaggerBy, kWindowStaggerBy); + ((BRect*)castToRect)->OffsetBy(kWindowStaggerBy, kWindowStaggerBy); return true; } static void -AddMimeTypeString(BObjectList &list, Model *model) +AddMimeTypeString(BObjectList &list, Model* model) { - BString *mimeType = new BString(model->MimeType()); - + BString* mimeType = new BString(model->MimeType()); + if (mimeType->Length()) { // only add the type if it's not already there for (int32 i = list.CountItems(); i-- > 0;) { - BString *string = list.ItemAt(i); + BString* string = list.ItemAt(i); if (string != NULL && !string->ICompare(*mimeType)) { delete mimeType; return; @@ -336,7 +336,7 @@ AddMimeTypeString(BObjectList &list, Model *model) // #pragma mark - -DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char *name, +DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char* name, uint32 resizeMask) : BView(rect, name, resizeMask, B_WILL_DRAW | B_FRAME_EVENTS), fDragButton(0), @@ -358,7 +358,7 @@ void DraggableContainerIcon::MouseDown(BPoint point) { // we only like container windows - BContainerWindow *window = dynamic_cast(Window()); + BContainerWindow* window = dynamic_cast(Window()); if (window == NULL) return; @@ -367,7 +367,7 @@ DraggableContainerIcon::MouseDown(BPoint point) return; uint32 buttons; - window->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons); + window->CurrentMessage()->FindInt32("buttons", (int32*)&buttons); if (IconCache::sIconCache->IconHitTest(point, window->TargetModel(), kNormalIcon, B_MINI_ICON)) { @@ -396,16 +396,16 @@ DraggableContainerIcon::MouseUp(BPoint /*point*/) void DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/, - const BMessage */*message*/) + const BMessage* /*message*/) { if (fDragButton == 0 || fDragStarted || (abs((int32)(point.x - fClickPoint.x)) <= kDragSlop && abs((int32)(point.y - fClickPoint.y)) <= kDragSlop)) return; - BContainerWindow *window = static_cast(Window()); + BContainerWindow* window = static_cast(Window()); // we can only get here in a BContainerWindow - Model *model = window->TargetModel(); + Model* model = window->TargetModel(); // Find the required height BFont font; @@ -417,10 +417,10 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/, + Bounds().Height() + 8; BRect rect(0, 0, max_c(Bounds().Width(), font.StringWidth(model->Name()) + 4), height); - BBitmap *dragBitmap = new BBitmap(rect, B_RGBA32, true); + BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true); dragBitmap->Lock(); - BView *view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0); + BView* view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0); dragBitmap->AddChild(view); view->SetOrigin(0, 0); BRect clipRect(view->Bounds()); @@ -480,7 +480,7 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/, void DraggableContainerIcon::FrameMoved(BPoint /*newLocation*/) { - BMenuBar* bar = dynamic_cast(Parent()); + BMenuBar* bar = dynamic_cast(Parent()); if (bar == NULL) return; @@ -493,11 +493,10 @@ DraggableContainerIcon::FrameMoved(BPoint /*newLocation*/) bar->GetPreferredSize(&width, &height); bar->SetResizingMode(resizingMode); -/* - BMenuItem* item = bar->ItemAt(bar->CountItems() - 1); - if (item == NULL) - return; -*/ + //BMenuItem* item = bar->ItemAt(bar->CountItems() - 1); + //if (item == NULL) + // return; + // BeOS shifts the coordinates for hidden views, so we cannot // use them to decide if we should be visible or not... @@ -513,7 +512,7 @@ DraggableContainerIcon::FrameMoved(BPoint /*newLocation*/) void DraggableContainerIcon::Draw(BRect updateRect) { - BContainerWindow *window = dynamic_cast(Window()); + BContainerWindow* window = dynamic_cast(Window()); if (window == NULL) return; @@ -540,7 +539,7 @@ DraggableContainerIcon::Draw(BRect updateRect) // #pragma mark - -BContainerWindow::BContainerWindow(LockingList *list, +BContainerWindow::BContainerWindow(LockingList* list, uint32 containerWindowFlags, window_look look, window_feel feel, uint32 flags, uint32 workspace) : BWindow(InitialWindowRect(feel), "TrackerWindow", look, feel, flags, @@ -590,7 +589,7 @@ BContainerWindow::BContainerWindow(LockingList *list, Run(); // Watch out for settings changes: - if (TTracker *app = dynamic_cast(be_app)) { + if (TTracker* app = dynamic_cast(be_app)) { app->Lock(); app->StartWatching(this, kWindowsShowFullPathChanged); app->StartWatching(this, kSingleWindowBrowseChanged); @@ -611,7 +610,7 @@ BContainerWindow::~BContainerWindow() ASSERT(IsLocked()); // stop the watchers - if (TTracker *app = dynamic_cast(be_app)) { + if (TTracker* app = dynamic_cast(be_app)) { app->Lock(); app->StopWatching(this, kWindowsShowFullPathChanged); app->StopWatching(this, kSingleWindowBrowseChanged); @@ -676,7 +675,7 @@ BContainerWindow::Quit() { // get rid of context menus if (fNavigationItem) { - BMenu *menu = fNavigationItem->Menu(); + BMenu* menu = fNavigationItem->Menu(); if (menu) menu->RemoveItem(fNavigationItem); delete fNavigationItem; @@ -741,15 +740,15 @@ BContainerWindow::Quit() } -BPoseView * -BContainerWindow::NewPoseView(Model *model, BRect rect, uint32 viewMode) +BPoseView* +BContainerWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) { return new BPoseView(model, rect, viewMode); } void -BContainerWindow::UpdateIfTrash(Model *model) +BContainerWindow::UpdateIfTrash(Model* model) { BEntry entry(model->EntryRef()); @@ -762,7 +761,7 @@ BContainerWindow::UpdateIfTrash(Model *model) void -BContainerWindow::CreatePoseView(Model *model) +BContainerWindow::CreatePoseView(Model* model) { UpdateIfTrash(model); BRect rect(Bounds()); @@ -843,10 +842,10 @@ BContainerWindow::RepopulateMenus() } if (fNavigationItem) { - BMenu *menu = fNavigationItem->Menu(); + BMenu* menu = fNavigationItem->Menu(); if (menu) { menu->RemoveItem(fNavigationItem); - BMenuItem *item = menu->RemoveItem((int32)0); + BMenuItem* item = menu->RemoveItem((int32)0); ASSERT(item != fNavigationItem); delete item; } @@ -894,7 +893,7 @@ BContainerWindow::RepopulateMenus() void -BContainerWindow::Init(const BMessage *message) +BContainerWindow::Init(const BMessage* message) { float y_delta; BEntry entry; @@ -948,7 +947,7 @@ BContainerWindow::Init(const BMessage *message) if (iconSize < 16) iconSize = 16; float iconPosY = 1 + (fMenuBar->Bounds().Height() - 2 - iconSize) / 2; - BView *icon = new DraggableContainerIcon(BRect(Bounds().Width() - 4 - iconSize + 1, + BView* icon = new DraggableContainerIcon(BRect(Bounds().Width() - 4 - iconSize + 1, iconPosY, Bounds().Width() - 4, iconPosY + iconSize - 1), "ThisContainer", B_FOLLOW_RIGHT); fMenuBar->AddChild(icon); @@ -993,7 +992,7 @@ BContainerWindow::Init(const BMessage *message) MarkAttributeMenu(fAttrMenu); CheckScreenIntersect(); - if (fBackgroundImage && !dynamic_cast(this) + if (fBackgroundImage && !dynamic_cast(this) && PoseView()->ViewMode() != kListMode) fBackgroundImage->Show(PoseView(), current_workspace()); @@ -1043,7 +1042,7 @@ BContainerWindow::RestoreStateCommon() WindowStateNodeOpener opener(this, false); - bool isDesktop = dynamic_cast(this); + bool isDesktop = dynamic_cast(this); if (!TargetModel()->IsRoot() && opener.Node()) // don't pick up background image for root disks // to do this, would have to have a unique attribute for the @@ -1086,7 +1085,7 @@ BContainerWindow::UpdateBackgroundImage() if (BootedInSafeMode()) return; - bool isDesktop = dynamic_cast(this) != NULL; + bool isDesktop = dynamic_cast(this) != NULL; WindowStateNodeOpener opener(this, false); if (!TargetModel()->IsRoot() && opener.Node()) @@ -1106,7 +1105,7 @@ BContainerWindow::UpdateBackgroundImage() void BContainerWindow::FrameResized(float, float) { - if (PoseView() && dynamic_cast(this) == NULL) { + if (PoseView() && dynamic_cast(this) == NULL) { BRect extent = PoseView()->Extent(); float offsetX = extent.left - PoseView()->Bounds().left; float offsetY = extent.top - PoseView()->Bounds().top; @@ -1153,7 +1152,7 @@ BContainerWindow::WorkspacesChanged(uint32, uint32) void BContainerWindow::ViewModeChanged(uint32 oldMode, uint32 newMode) { - BView *view = FindView("MenuBar"); + BView* view = FindView("MenuBar"); if (view != NULL) { // make sure the draggable icon hides if it doesn't have space left anymore view = view->FindView("ThisContainer"); @@ -1224,7 +1223,7 @@ BContainerWindow::StateNeedsSaving() const status_t -BContainerWindow::GetLayoutState(BNode *node, BMessage *message) +BContainerWindow::GetLayoutState(BNode* node, BMessage* message) { // ToDo: // get rid of this, use AttrStream instead @@ -1248,7 +1247,7 @@ BContainerWindow::GetLayoutState(BNode *node, BMessage *message) && strcmp(attrName, kAttrViewStateForeign) != 0) continue; - char *buffer = new char[info.size]; + char* buffer = new char[info.size]; if (node->ReadAttr(attrName, info.type, 0, buffer, (size_t)info.size) == info.size) message->AddData(attrName, info.type, buffer, (ssize_t)info.size); delete [] buffer; @@ -1258,7 +1257,7 @@ BContainerWindow::GetLayoutState(BNode *node, BMessage *message) status_t -BContainerWindow::SetLayoutState(BNode *node, const BMessage *message) +BContainerWindow::SetLayoutState(BNode* node, const BMessage* message) { status_t result = node->InitCheck(); if (result != B_OK) @@ -1266,9 +1265,9 @@ BContainerWindow::SetLayoutState(BNode *node, const BMessage *message) for (int32 globalIndex = 0; ;) { #if B_BEOS_VERSION_DANO - const char *name; + const char* name; #else - char *name; + char* name; #endif type_code type; int32 count; @@ -1278,7 +1277,7 @@ BContainerWindow::SetLayoutState(BNode *node, const BMessage *message) break; for (int32 index = 0; index < count; index++) { - const void *buffer; + const void* buffer; int32 size; result = message->FindData(name, type, index, &buffer, &size); if (result != B_OK) { @@ -1318,7 +1317,7 @@ BContainerWindow::ShouldAddCountView() const } -Model * +Model* BContainerWindow::TargetModel() const { return fPoseView->TargetModel(); @@ -1386,7 +1385,7 @@ BContainerWindow::ResizeToFit() void -BContainerWindow::MessageReceived(BMessage *message) +BContainerWindow::MessageReceived(BMessage* message) { switch (message->what) { case B_CUT: @@ -1396,7 +1395,7 @@ BContainerWindow::MessageReceived(BMessage *message) case kCopyMoreSelectionToClipboard: case kPasteLinksFromClipboard: { - BView *view = CurrentFocus(); + BView* view = CurrentFocus(); if (view->LockLooper()) { view->MessageReceived(message); view->UnlockLooper(); @@ -1545,7 +1544,7 @@ BContainerWindow::MessageReceived(BMessage *message) SetSingleWindowBrowseShortcuts(settings.SingleWindowBrowse()); // Update draggable folder icon - BView *view = FindView("MenuBar"); + BView* view = FindView("MenuBar"); if (view != NULL) { view = view->FindView("ThisContainer"); if (view != NULL) { @@ -1634,7 +1633,7 @@ BContainerWindow::MessageReceived(BMessage *message) { bool dontMoveToTrash = settings.DontMoveFilesToTrash(); - BMenuItem *item = fFileContextMenu->FindItem(kMoveToTrash); + BMenuItem* item = fFileContextMenu->FindItem(kMoveToTrash); if (item) { item->SetLabel(dontMoveToTrash ? B_TRANSLATE("Delete") @@ -1668,7 +1667,7 @@ BContainerWindow::MessageReceived(BMessage *message) FSUndo(); break; - //case B_REDO: /* only defined in Dano/Zeta/OpenBeOS */ + //case B_REDO: // only defined in Dano/Zeta/OpenBeOS case kRedo: FSRedo(); break; @@ -1680,9 +1679,9 @@ BContainerWindow::MessageReceived(BMessage *message) void -BContainerWindow::SetCutItem(BMenu *menu) +BContainerWindow::SetCutItem(BMenu* menu) { - BMenuItem *item; + BMenuItem* item; if ((item = menu->FindItem(B_CUT)) == NULL && (item = menu->FindItem(kCutMoreSelectionToClipboard)) == NULL) return; @@ -1703,9 +1702,9 @@ BContainerWindow::SetCutItem(BMenu *menu) void -BContainerWindow::SetCopyItem(BMenu *menu) +BContainerWindow::SetCopyItem(BMenu* menu) { - BMenuItem *item; + BMenuItem* item; if ((item = menu->FindItem(B_COPY)) == NULL && (item = menu->FindItem(kCopyMoreSelectionToClipboard)) == NULL) return; @@ -1726,9 +1725,9 @@ BContainerWindow::SetCopyItem(BMenu *menu) void -BContainerWindow::SetPasteItem(BMenu *menu) +BContainerWindow::SetPasteItem(BMenu* menu) { - BMenuItem *item; + BMenuItem* item; if ((item = menu->FindItem(B_PASTE)) == NULL && (item = menu->FindItem(kPasteLinksFromClipboard)) == NULL) return; @@ -1748,9 +1747,9 @@ BContainerWindow::SetPasteItem(BMenu *menu) void -BContainerWindow::SetArrangeMenu(BMenu *menu) +BContainerWindow::SetArrangeMenu(BMenu* menu) { - BMenuItem *item; + BMenuItem* item; if ((item = menu->FindItem(kCleanup)) == NULL && (item = menu->FindItem(kCleanupAll)) == NULL) return; @@ -1776,9 +1775,9 @@ BContainerWindow::SetArrangeMenu(BMenu *menu) void -BContainerWindow::SetCloseItem(BMenu *menu) +BContainerWindow::SetCloseItem(BMenu* menu) { - BMenuItem *item; + BMenuItem* item; if ((item = menu->FindItem(B_QUIT_REQUESTED)) == NULL && (item = menu->FindItem(kCloseAllWindows)) == NULL) return; @@ -1798,14 +1797,14 @@ BContainerWindow::SetCloseItem(BMenu *menu) bool -BContainerWindow::IsShowing(const node_ref *node) const +BContainerWindow::IsShowing(const node_ref* node) const { return PoseView()->Represents(node); } bool -BContainerWindow::IsShowing(const entry_ref *entry) const +BContainerWindow::IsShowing(const entry_ref* entry) const { return PoseView()->Represents(entry); } @@ -1828,7 +1827,7 @@ BContainerWindow::AddMenus() void -BContainerWindow::AddFileMenu(BMenu *menu) +BContainerWindow::AddFileMenu(BMenu* menu) { if (!PoseView()->IsFilePanel()) { menu->AddItem(new BMenuItem(B_TRANSLATE("Find" B_UTF8_ELLIPSIS), @@ -1885,7 +1884,7 @@ BContainerWindow::AddFileMenu(BMenu *menu) // BContainerWindow::SetupMoveCopyMenus() } - BMenuItem *cutItem = NULL, *copyItem = NULL, *pasteItem = NULL; + BMenuItem* cutItem = NULL,* copyItem = NULL,* pasteItem = NULL; if (!IsPrintersDir()) { menu->AddSeparatorItem(); @@ -1916,9 +1915,9 @@ BContainerWindow::AddFileMenu(BMenu *menu) void -BContainerWindow::AddWindowMenu(BMenu *menu) +BContainerWindow::AddWindowMenu(BMenu* menu) { - BMenuItem *item; + BMenuItem* item; BMenu* iconSizeMenu = new BMenu(B_TRANSLATE("Icon view")); @@ -2100,14 +2099,14 @@ BContainerWindow::MenusEnded() void -BContainerWindow::SetupNavigationMenu(const entry_ref *ref, BMenu *parent) +BContainerWindow::SetupNavigationMenu(const entry_ref* ref, BMenu* parent) { // start by removing nav item (and separator) from old menu if (fNavigationItem) { - BMenu *menu = fNavigationItem->Menu(); + BMenu* menu = fNavigationItem->Menu(); if (menu) { menu->RemoveItem(fNavigationItem); - BMenuItem *item = menu->RemoveItem((int32)0); + BMenuItem* item = menu->RemoveItem((int32)0); ASSERT(item != fNavigationItem); delete item; } @@ -2148,7 +2147,7 @@ BContainerWindow::SetupNavigationMenu(const entry_ref *ref, BMenu *parent) // setup a navigation menu item which will dynamically load items // as menu items are traversed - BNavMenu *navMenu = dynamic_cast(fNavigationItem->Submenu()); + BNavMenu* navMenu = dynamic_cast(fNavigationItem->Submenu()); navMenu->SetNavDir(ref); fNavigationItem->SetLabel(model.Name()); fNavigationItem->SetEntry(&entry); @@ -2156,7 +2155,7 @@ BContainerWindow::SetupNavigationMenu(const entry_ref *ref, BMenu *parent) parent->AddItem(fNavigationItem, 0); parent->AddItem(new BSeparatorItem(), 1); - BMessage *message = new BMessage(B_REFS_RECEIVED); + BMessage* message = new BMessage(B_REFS_RECEIVED); message->AddRef("refs", ref); fNavigationItem->SetMessage(message); fNavigationItem->SetTarget(be_app); @@ -2167,7 +2166,7 @@ BContainerWindow::SetupNavigationMenu(const entry_ref *ref, BMenu *parent) void -BContainerWindow::SetUpEditQueryItem(BMenu *menu) +BContainerWindow::SetUpEditQueryItem(BMenu* menu) { ASSERT(menu); // File menu @@ -2180,7 +2179,7 @@ BContainerWindow::SetUpEditQueryItem(BMenu *menu) // if any queries selected, add an edit query menu item for (int32 index = 0; index < selectCount; index++) { - BPose *pose = PoseView()->SelectionList()->ItemAt(index); + BPose* pose = PoseView()->SelectionList()->ItemAt(index); Model model(pose->TargetModel()->EntryRef(), true); if (model.InitCheck() != B_OK) continue; @@ -2215,11 +2214,11 @@ BContainerWindow::SetUpEditQueryItem(BMenu *menu) void -BContainerWindow::SetupOpenWithMenu(BMenu *parent) +BContainerWindow::SetupOpenWithMenu(BMenu* parent) { // start by removing nav item (and separator) from old menu if (fOpenWithItem) { - BMenu *menu = fOpenWithItem->Menu(); + BMenu* menu = fOpenWithItem->Menu(); if (menu) menu->RemoveItem(fOpenWithItem); @@ -2240,7 +2239,7 @@ BContainerWindow::SetupOpenWithMenu(BMenu *parent) // and do not add if true // add after "Open" - BMenuItem *item = parent->FindItem(kOpenSelection); + BMenuItem* item = parent->FindItem(kOpenSelection); int32 count = PoseView()->SelectionList()->CountItems(); if (!count) @@ -2249,7 +2248,7 @@ BContainerWindow::SetupOpenWithMenu(BMenu *parent) // build a list of all refs to open BMessage message(B_REFS_RECEIVED); for (int32 index = 0; index < count; index++) { - BPose *pose = PoseView()->SelectionList()->ItemAt(index); + BPose* pose = PoseView()->SelectionList()->ItemAt(index); message.AddRef("refs", pose->TargetModel()->EntryRef()); } @@ -2268,8 +2267,8 @@ BContainerWindow::SetupOpenWithMenu(BMenu *parent) void -BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu *navMenu, uint32 what, - const entry_ref *ref, bool addLocalOnly) +BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu* navMenu, uint32 what, + const entry_ref* ref, bool addLocalOnly) { BVolume volume; BVolumeRoster volumeRoster; @@ -2298,7 +2297,7 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu *navMenu, uint32 what, menu->SetNavDir(model.EntryRef()); menu->SetShowParent(true); - BMenuItem *item = new SpecialModelMenuItem(&model,menu); + BMenuItem* item = new SpecialModelMenuItem(&model,menu); item->SetMessage(new BMessage((uint32)what)); navMenu->AddItem(item); @@ -2313,7 +2312,7 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu *navMenu, uint32 what, BMenu* menu = new RecentsMenu(B_TRANSLATE("Recent folders"), kRecentFolders, what, this); - BMenuItem *item = new SpecialModelMenuItem(&model,menu); + BMenuItem* item = new SpecialModelMenuItem(&model,menu); item->SetMessage(new BMessage((uint32)what)); navMenu->AddItem(item); @@ -2370,20 +2369,22 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu *navMenu, uint32 what, void -BContainerWindow::SetupMoveCopyMenus(const entry_ref *item_ref, BMenu *parent) +BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent) { - if (IsTrash() || InTrash() || IsPrintersDir() || !fMoveToItem || !fCopyToItem || !fCreateLinkItem) + if (IsTrash() || InTrash() || IsPrintersDir() || !fMoveToItem + || !fCopyToItem || !fCreateLinkItem) { return; + } // Grab the modifiers state since we use it twice uint32 modifierKeys = modifiers(); // re-parent items to this menu since they're shared - int32 index; - BMenuItem *trash = parent->FindItem(kMoveToTrash); - if (trash) - index = parent->IndexOf(trash) + 2; - else + int32 index; + BMenuItem* trash = parent->FindItem(kMoveToTrash); + if (trash) + index = parent->IndexOf(trash) + 2; + else index = 0; if (fMoveToItem->Menu() != parent) { @@ -2432,23 +2433,23 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref *item_ref, BMenu *parent) return; // configure "Move to" menu item - PopulateMoveCopyNavMenu(dynamic_cast(fMoveToItem->Submenu()), + PopulateMoveCopyNavMenu(dynamic_cast(fMoveToItem->Submenu()), kMoveSelectionTo, item_ref, true); // configure "Copy to" menu item // add all mounted volumes (except the one this item lives on) - PopulateMoveCopyNavMenu(dynamic_cast(fCopyToItem->Submenu()), + PopulateMoveCopyNavMenu(dynamic_cast(fCopyToItem->Submenu()), kCopySelectionTo, item_ref, false); // Set "Create Link" menu item message and // add all mounted volumes (except the one this item lives on) if (modifierKeys & B_SHIFT_KEY) { fCreateLinkItem->SetMessage(new BMessage(kCreateRelativeLink)); - PopulateMoveCopyNavMenu(dynamic_cast(fCreateLinkItem->Submenu()), + PopulateMoveCopyNavMenu(dynamic_cast(fCreateLinkItem->Submenu()), kCreateRelativeLink, item_ref, false); } else { fCreateLinkItem->SetMessage(new BMessage(kCreateLink)); - PopulateMoveCopyNavMenu(dynamic_cast(fCreateLinkItem->Submenu()), + PopulateMoveCopyNavMenu(dynamic_cast(fCreateLinkItem->Submenu()), kCreateLink, item_ref, false); } @@ -2457,7 +2458,7 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref *item_ref, BMenu *parent) fCreateLinkItem->SetEnabled(true); // Set the "Identify" item label - BMenuItem *identifyItem = parent->FindItem(kIdentifyEntry); + BMenuItem* identifyItem = parent->FindItem(kIdentifyEntry); if (identifyItem != NULL) { if (modifierKeys & B_SHIFT_KEY) identifyItem->SetLabel(B_TRANSLATE("Force identify")); @@ -2477,7 +2478,7 @@ BContainerWindow::ShowDropContextMenu(BPoint loc) // Change the "Create Link" item - allow user to // create relative links with the Shift key down. - BMenuItem *item = fDropContextMenu->FindItem(kCreateLink); + BMenuItem* item = fDropContextMenu->FindItem(kCreateLink); if (item == NULL) item = fDropContextMenu->FindItem(kCreateRelativeLink); if (item && (modifiers() & B_SHIFT_KEY)) { @@ -2497,7 +2498,7 @@ BContainerWindow::ShowDropContextMenu(BPoint loc) void -BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *) +BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref* ref, BView*) { ASSERT(IsLocked()); BPoint global(loc); @@ -2518,7 +2519,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *) // selected item was trash, show the trash context menu instead EnableNamedMenuItem(fTrashContextMenu, kEmptyTrash, - static_cast(be_app)->TrashFull()); + static_cast(be_app)->TrashFull()); SetupNavigationMenu(ref, fTrashContextMenu); fTrashContextMenu->Go(global, true, true, true); @@ -2562,7 +2563,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *) fDragContextMenu->SetNavDir(&resolvedRef); fDragContextMenu->SetTypesList(fCachedTypesList); fDragContextMenu->SetTarget(BMessenger(this)); - BPoseView *poseView = PoseView(); + BPoseView* poseView = PoseView(); if (poseView) { BMessenger target(poseView); fDragContextMenu->InitTrackingHook( @@ -2639,7 +2640,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *) void -BContainerWindow::AddFileContextMenus(BMenu *menu) +BContainerWindow::AddFileContextMenus(BMenu* menu) { menu->AddItem(new BMenuItem(B_TRANSLATE("Open"), new BMessage(kOpenSelection), 'O')); @@ -2669,7 +2670,7 @@ BContainerWindow::AddFileContextMenus(BMenu *menu) #ifdef CUT_COPY_PASTE_IN_CONTEXT_MENU menu->AddSeparatorItem(); - BMenuItem *cutItem, *copyItem; + BMenuItem* cutItem,* copyItem; menu->AddItem(cutItem = new BMenuItem(B_TRANSLATE("Cut"), new BMessage(B_CUT), 'X')); menu->AddItem(copyItem = new BMenuItem(B_TRANSLATE("Copy"), @@ -2693,7 +2694,7 @@ BContainerWindow::AddFileContextMenus(BMenu *menu) void -BContainerWindow::AddVolumeContextMenus(BMenu *menu) +BContainerWindow::AddVolumeContextMenus(BMenu* menu) { menu->AddItem(new BMenuItem(B_TRANSLATE("Open"), new BMessage(kOpenSelection), 'O')); @@ -2705,7 +2706,7 @@ BContainerWindow::AddVolumeContextMenus(BMenu *menu) menu->AddSeparatorItem(); menu->AddItem(new MountMenu(B_TRANSLATE("Mount"))); - BMenuItem *item = new BMenuItem(B_TRANSLATE("Unmount"), + BMenuItem* item = new BMenuItem(B_TRANSLATE("Unmount"), new BMessage(kUnmountVolume), 'U'); item->SetEnabled(false); menu->AddItem(item); @@ -2718,7 +2719,7 @@ BContainerWindow::AddVolumeContextMenus(BMenu *menu) void -BContainerWindow::AddWindowContextMenus(BMenu *menu) +BContainerWindow::AddWindowContextMenus(BMenu* menu) { // create context sensitive menu for empty area of window // since we check view mode before display, this should be a radio @@ -2745,7 +2746,7 @@ BContainerWindow::AddWindowContextMenus(BMenu *menu) menu->AddSeparatorItem(); #if 0 - BMenuItem *pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'); + BMenuItem* pasteItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'); menu->AddItem(pasteItem); menu->AddSeparatorItem(); #endif @@ -2770,7 +2771,7 @@ BContainerWindow::AddWindowContextMenus(BMenu *menu) #if DEBUG menu->AddSeparatorItem(); - BMenuItem *testing = new BMenuItem("Test icon cache", new BMessage(kTestIconCache)); + BMenuItem* testing = new BMenuItem("Test icon cache", new BMessage(kTestIconCache)); menu->AddItem(testing); #endif @@ -2783,7 +2784,7 @@ BContainerWindow::AddWindowContextMenus(BMenu *menu) void -BContainerWindow::AddDropContextMenus(BMenu *menu) +BContainerWindow::AddDropContextMenus(BMenu* menu) { menu->AddItem(new BMenuItem(B_TRANSLATE("Create link here"), new BMessage(kCreateLink))); @@ -2798,7 +2799,7 @@ BContainerWindow::AddDropContextMenus(BMenu *menu) void -BContainerWindow::AddTrashContextMenus(BMenu *menu) +BContainerWindow::AddTrashContextMenus(BMenu* menu) { // setup special trash context menu menu->AddItem(new BMenuItem(B_TRANSLATE("Empty Trash"), @@ -2812,8 +2813,8 @@ BContainerWindow::AddTrashContextMenus(BMenu *menu) void -BContainerWindow::EachAddon(bool (*eachAddon)(const Model *, const char *, - uint32 shortcut, bool primary, void *context), void *passThru, +BContainerWindow::EachAddon(bool (*eachAddon)(const Model*, const char*, + uint32 shortcut, bool primary, void* context), void* passThru, BObjectList &mimeTypes) { BObjectList uniqueList(10, true); @@ -2831,9 +2832,9 @@ BContainerWindow::EachAddon(bool (*eachAddon)(const Model *, const char *, bool -BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, - const char *, uint32 shortcut, bool primary, void *), - BObjectList *uniqueList, void *params, +BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model*, + const char*, uint32 shortcut, bool primary, void*), + BObjectList* uniqueList, void* params, BObjectList &mimeTypes) { path.Append("Tracker"); @@ -2846,7 +2847,7 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, dir.Rewind(); while (dir.GetNextEntry(&entry) == B_OK) { - Model *model = new Model(&entry); + Model* model = new Model(&entry); if (model->InitCheck() == B_OK && model->IsSymLink()) { // resolve symlinks @@ -2884,7 +2885,7 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, // check all supported types if it has some set if (!secondary) { for (int32 i = mimeTypes.CountItems(); !primary && i-- > 0;) { - BString *type = mimeTypes.ItemAt(i); + BString* type = mimeTypes.ItemAt(i); if (info.IsSupportedType(type->String())) { BMimeType mimeType(type->String()); if (info.Supports(&mimeType)) @@ -2932,7 +2933,7 @@ BContainerWindow::BuildMimeTypeList(BObjectList &mimeTypes) } else { _UpdateSelectionMIMEInfo(); for (int32 index = 0; index < count; index++) { - BPose *pose = PoseView()->SelectionList()->ItemAt(index); + BPose* pose = PoseView()->SelectionList()->ItemAt(index); AddMimeTypeString(mimeTypes, pose->TargetModel()); // If it's a symlink, resolves it and add the Target's MimeType if (pose->TargetModel()->IsSymLink()) { @@ -2949,7 +2950,7 @@ BContainerWindow::BuildMimeTypeList(BObjectList &mimeTypes) void -BContainerWindow::BuildAddOnMenu(BMenu *menu) +BContainerWindow::BuildAddOnMenu(BMenu* menu) { BMenuItem* item = menu->FindItem(B_TRANSLATE("Add-ons")); if (menu->IndexOf(item) == 0) { @@ -3007,7 +3008,7 @@ BContainerWindow::BuildAddOnMenu(BMenu *menu) void -BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context) +BContainerWindow::UpdateMenu(BMenu* menu, UpdateMenuContext context) { const int32 selectCount = PoseView()->SelectionList()->CountItems(); const int32 count = PoseView()->CountItems(); @@ -3022,7 +3023,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context) EnableNamedMenuItem(menu, kDuplicateSelection, selectCount > 0); } - Model *selectedModel = NULL; + Model* selectedModel = NULL; if (selectCount == 1) selectedModel = PoseView()->SelectionList()->FirstItem()->TargetModel(); @@ -3078,7 +3079,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context) BEntry entry(TargetModel()->EntryRef()); BDirectory parent; entry_ref ref; - BEntry root("/"); + BEntry root("/"); bool parentIsRoot = (entry.GetParent(&parent) == B_OK && parent.GetEntry(&entry) == B_OK @@ -3097,7 +3098,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context) BMenuItem* item = menu->FindItem(B_TRANSLATE("New")); if (item) { - TemplatesMenu *templateMenu = dynamic_cast( + TemplatesMenu* templateMenu = dynamic_cast( item->Submenu()); if (templateMenu) templateMenu->UpdateMenuState(); @@ -3109,7 +3110,7 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context) void -BContainerWindow::LoadAddOn(BMessage *message) +BContainerWindow::LoadAddOn(BMessage* message) { UpdateIfNeeded(); @@ -3128,12 +3129,12 @@ BContainerWindow::LoadAddOn(BMessage *message) } // add selected refs to message - BMessage *refs = new BMessage(B_REFS_RECEIVED); + BMessage* refs = new BMessage(B_REFS_RECEIVED); - BObjectList *list = PoseView()->SelectionList(); + BObjectList* list = PoseView()->SelectionList(); int32 index = 0; - BPose *pose; + BPose* pose; while ((pose = list->ItemAt(index++)) != NULL) refs->AddRef("refs", pose->TargetModel()->EntryRef()); @@ -3167,8 +3168,8 @@ BContainerWindow::_UpdateSelectionMIMEInfo() } -BMenuItem * -BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, +BMenuItem* +BContainerWindow::NewAttributeMenuItem(const char* label, const char* name, int32 type, float width, int32 align, bool editable, bool statField) { return NewAttributeMenuItem(label, name, type, NULL, width, align, @@ -3176,12 +3177,12 @@ BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, } -BMenuItem * -BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, +BMenuItem* +BContainerWindow::NewAttributeMenuItem(const char* label, const char* name, int32 type, const char* displayAs, float width, int32 align, bool editable, bool statField) { - BMessage *message = new BMessage(kAttributeItem); + BMessage* message = new BMessage(kAttributeItem); message->AddString("attr_name", name); message->AddInt32("attr_type", type); message->AddInt32("attr_hash", (int32)AttrHashString(name, (uint32)type)); @@ -3192,7 +3193,7 @@ BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, message->AddBool("attr_editable", editable); message->AddBool("attr_statfield", statField); - BMenuItem *menuItem = new BMenuItem(label, message); + BMenuItem* menuItem = new BMenuItem(label, message); menuItem->SetTarget(PoseView()); return menuItem; @@ -3200,11 +3201,11 @@ BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, void -BContainerWindow::NewAttributeMenu(BMenu *menu) +BContainerWindow::NewAttributeMenu(BMenu* menu) { ASSERT(PoseView()); - BMenuItem *item; + BMenuItem* item; menu->AddItem(item = new BMenuItem(B_TRANSLATE("Copy layout"), new BMessage(kCopyAttributes))); item->SetTarget(PoseView()); @@ -3278,14 +3279,14 @@ BContainerWindow::MarkAttributeMenu() void -BContainerWindow::MarkAttributeMenu(BMenu *menu) +BContainerWindow::MarkAttributeMenu(BMenu* menu) { if (!menu) return; int32 count = menu->CountItems(); for (int32 index = 0; index < count; index++) { - BMenuItem *item = menu->ItemAt(index); + BMenuItem* item = menu->ItemAt(index); int32 attrHash; if (item->Message()) { if (item->Message()->FindInt32("attr_hash", &attrHash) == B_OK) @@ -3294,7 +3295,7 @@ BContainerWindow::MarkAttributeMenu(BMenu *menu) item->SetMarked(false); } - BMenu *submenu = item->Submenu(); + BMenu* submenu = item->Submenu(); if (submenu) { int32 count2 = submenu->CountItems(); for (int32 subindex = 0; subindex < count2; subindex++) { @@ -3327,7 +3328,7 @@ BContainerWindow::MarkArrangeByMenu(BMenu* menu) if (item->Message()->FindInt32("attr_hash", (int32*)&attrHash) == B_OK) item->SetMarked(PoseView()->PrimarySort() == attrHash); else if (item->Command() == kArrangeReverseOrder) - item->SetMarked(PoseView()->ReverseSort()); + item->SetMarked(PoseView()->ReverseSort()); } } } @@ -3340,9 +3341,8 @@ BContainerWindow::AddMimeTypesToMenu() } -/*! Adds a menu for a specific MIME type if it doesn't exist already. - Returns the menu, if it existed or not. -*/ +// Adds a menu for a specific MIME type if it doesn't exist already. +// Returns the menu, if it existed or not. BMenu* BContainerWindow::AddMimeMenu(const BMimeType& mimeType, bool isSuperType, BMenu* menu, int32 start) @@ -3438,7 +3438,7 @@ BContainerWindow::AddMimeMenu(const BMimeType& mimeType, bool isSuperType, void -BContainerWindow::AddMimeTypesToMenu(BMenu *menu) +BContainerWindow::AddMimeTypesToMenu(BMenu* menu) { if (!menu) return; @@ -3452,7 +3452,7 @@ BContainerWindow::AddMimeTypesToMenu(BMenu *menu) // Add a separator item if there is none yet if (start > 0 - && dynamic_cast(menu->ItemAt(start - 1)) == NULL) + && dynamic_cast(menu->ItemAt(start - 1)) == NULL) menu->AddSeparatorItem(); // Add MIME type in case we're a default query type window @@ -3522,8 +3522,8 @@ BContainerWindow::AddMimeTypesToMenu(BMenu *menu) } // remove separator if it's the only item in menu - BMenuItem *item = menu->ItemAt(menu->CountItems() - 1); - if (dynamic_cast(item) != NULL) { + BMenuItem* item = menu->ItemAt(menu->CountItems() - 1); + if (dynamic_cast(item) != NULL) { menu->RemoveItem(item); delete item; } @@ -3532,9 +3532,9 @@ BContainerWindow::AddMimeTypesToMenu(BMenu *menu) } -BHandler * -BContainerWindow::ResolveSpecifier(BMessage *message, int32 index, - BMessage *specifier, int32 form, const char *property) +BHandler* +BContainerWindow::ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 form, const char* property) { if (strcmp(property, "Poses") == 0) { // PRINT(("BContainerWindow::ResolveSpecifier %s\n", property)); @@ -3547,7 +3547,7 @@ BContainerWindow::ResolveSpecifier(BMessage *message, int32 index, } -PiggybackTaskLoop * +PiggybackTaskLoop* BContainerWindow::DelayedTaskLoop() { if (!fTaskLoop) @@ -3577,7 +3577,7 @@ BContainerWindow::NeedsDefaultStateSetup() bool -BContainerWindow::DefaultStateSourceNode(const char *name, BNode *result, +BContainerWindow::DefaultStateSourceNode(const char* name, BNode* result, bool createNew, bool createFolder) { // PRINT(("looking for default state in tracker settings dir\n")); @@ -3596,7 +3596,7 @@ BContainerWindow::DefaultStateSourceNode(const char *name, BNode *result, BPath tmpPath(settingsPath); for (;;) { // deal with several levels of folders - const char *nextSlash = strchr(name, '/'); + const char* nextSlash = strchr(name, '/'); if (!nextSlash) break; @@ -3678,7 +3678,7 @@ BContainerWindow::SetUpDefaultState() // copy over the attributes // set up a filter of the attributes we want copied - const char *allowAttrs[] = { + const char* allowAttrs[] = { kAttrWindowFrame, kAttrWindowWorkspace, kAttrViewState, @@ -3708,14 +3708,14 @@ BContainerWindow::SetUpDefaultState() void -BContainerWindow::RestoreWindowState(AttributeStreamNode *node) +BContainerWindow::RestoreWindowState(AttributeStreamNode* node) { - if (!node || dynamic_cast(this)) + if (!node || dynamic_cast(this)) // don't restore any window state if we are a desktop window return; - const char *rectAttributeName; - const char *workspaceAttributeName; + const char* rectAttributeName; + const char* workspaceAttributeName; if (TargetModel()->IsRoot()) { rectAttributeName = kAttrDisksFrame; workspaceAttributeName = kAttrDisksWorkspace; @@ -3760,12 +3760,12 @@ BContainerWindow::RestoreWindowState(AttributeStreamNode *node) void BContainerWindow::RestoreWindowState(const BMessage &message) { - if (dynamic_cast(this)) + if (dynamic_cast(this)) // don't restore any window state if we are a desktop window return; - const char *rectAttributeName; - const char *workspaceAttributeName; + const char* rectAttributeName; + const char* workspaceAttributeName; if (TargetModel()->IsRoot()) { rectAttributeName = kAttrDisksFrame; workspaceAttributeName = kAttrDisksWorkspace; @@ -3783,7 +3783,7 @@ BContainerWindow::RestoreWindowState(const BMessage &message) uint32 workspace; if ((fContainerWindowFlags & kRestoreWorkspace) - && message.FindInt32(workspaceAttributeName, (int32 *)&workspace) == B_OK) + && message.FindInt32(workspaceAttributeName, (int32*)&workspace) == B_OK) SetWorkspaces(workspace); if (fContainerWindowFlags & kIsHidden) @@ -3801,11 +3801,11 @@ BContainerWindow::RestoreWindowState(const BMessage &message) void -BContainerWindow::SaveWindowState(AttributeStreamNode *node) +BContainerWindow::SaveWindowState(AttributeStreamNode* node) { ASSERT(node); - const char *rectAttributeName; - const char *workspaceAttributeName; + const char* rectAttributeName; + const char* workspaceAttributeName; if (TargetModel() && TargetModel()->IsRoot()) { rectAttributeName = kAttrDisksFrame; workspaceAttributeName = kAttrDisksWorkspace; @@ -3838,8 +3838,8 @@ BContainerWindow::SaveWindowState(AttributeStreamNode *node) void BContainerWindow::SaveWindowState(BMessage &message) const { - const char *rectAttributeName; - const char *workspaceAttributeName; + const char* rectAttributeName; + const char* workspaceAttributeName; if (TargetModel() && TargetModel()->IsRoot()) { rectAttributeName = kAttrDisksFrame; @@ -4085,7 +4085,7 @@ BContainerWindow::PopulateArrangeByMenu(BMenu* menu) message->what = kArrangeBy; BMenuItem* newItem = new BMenuItem(item->Label(), message); newItem->SetTarget(PoseView()); - menu->AddItem(newItem); + menu->AddItem(newItem); } } @@ -4108,7 +4108,7 @@ BContainerWindow::PopulateArrangeByMenu(BMenu* menu) // #pragma mark - -WindowStateNodeOpener::WindowStateNodeOpener(BContainerWindow *window, bool forWriting) +WindowStateNodeOpener::WindowStateNodeOpener(BContainerWindow* window, bool forWriting) : fModelOpener(NULL), fNode(NULL), fStreamNode(NULL) @@ -4135,7 +4135,7 @@ WindowStateNodeOpener::~WindowStateNodeOpener() void -WindowStateNodeOpener::SetTo(const BDirectory *node) +WindowStateNodeOpener::SetTo(const BDirectory* node) { delete fModelOpener; delete fNode; @@ -4148,7 +4148,7 @@ WindowStateNodeOpener::SetTo(const BDirectory *node) void -WindowStateNodeOpener::SetTo(const BEntry *entry, bool forWriting) +WindowStateNodeOpener::SetTo(const BEntry* entry, bool forWriting) { delete fModelOpener; delete fNode; @@ -4161,7 +4161,7 @@ WindowStateNodeOpener::SetTo(const BEntry *entry, bool forWriting) void -WindowStateNodeOpener::SetTo(Model *model, bool forWriting) +WindowStateNodeOpener::SetTo(Model* model, bool forWriting) { delete fModelOpener; delete fNode; @@ -4170,19 +4170,21 @@ WindowStateNodeOpener::SetTo(Model *model, bool forWriting) fNode = NULL; fStreamNode = NULL; fModelOpener = new ModelNodeLazyOpener(model, forWriting, false); - if (fModelOpener->IsOpen(forWriting)) - fStreamNode = new AttributeStreamFileNode(fModelOpener->TargetModel()->Node()); + if (fModelOpener->IsOpen(forWriting)) { + fStreamNode = new AttributeStreamFileNode( + fModelOpener->TargetModel()->Node()); + } } -AttributeStreamNode * +AttributeStreamNode* WindowStateNodeOpener::StreamNode() const { return fStreamNode; } -BNode * +BNode* WindowStateNodeOpener::Node() const { if (!fStreamNode) @@ -4252,7 +4254,7 @@ BackgroundView::WindowActivated(bool) void BackgroundView::Draw(BRect updateRect) { - BContainerWindow *window = dynamic_cast(Window()); + BContainerWindow* window = dynamic_cast(Window()); if (!window) return; @@ -4308,7 +4310,7 @@ BackgroundView::Draw(BRect updateRect) void BackgroundView::Pulse() { - BContainerWindow *window = dynamic_cast(Window()); + BContainerWindow* window = dynamic_cast(Window()); if (window) window->PulseTaskLoop(); } diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index e312ab213e..3fe8fc52ed 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -31,10 +31,10 @@ 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. */ - -#ifndef _CONTAINER_WINDOW_H +#ifndef _CONTAINER_WINDOW_H #define _CONTAINER_WINDOW_H + #include #include "LockingList.h" @@ -58,7 +58,7 @@ class SelectionWindow; #define kDefaultFolderTemplate "DefaultFolderTemplate" -extern const char *kAddOnsMenuName; +extern const char* kAddOnsMenuName; const window_feel kPrivateDesktopWindowFeel = window_feel(1024); const window_look kPrivateDesktopWindowLook = window_look(4); @@ -74,7 +74,7 @@ enum { class BContainerWindow : public BWindow { public: - BContainerWindow(LockingList *windowList, + BContainerWindow(LockingList* windowList, uint32 containerWindowFlags, window_look look = B_DOCUMENT_WINDOW_LOOK, window_feel feel = B_NORMAL_WINDOW_FEEL, @@ -83,7 +83,7 @@ class BContainerWindow : public BWindow { virtual ~BContainerWindow(); - virtual void Init(const BMessage *message = NULL); + virtual void Init(const BMessage* message = NULL); static BRect InitialWindowRect(window_feel); @@ -91,15 +91,15 @@ class BContainerWindow : public BWindow { virtual void Quit(); virtual bool QuitRequested(); - virtual void UpdateIfTrash(Model *); + virtual void UpdateIfTrash(Model*); - virtual void CreatePoseView(Model *); + virtual void CreatePoseView(Model*); - virtual void ShowContextMenu(BPoint, const entry_ref *, BView *); + virtual void ShowContextMenu(BPoint, const entry_ref*, BView*); virtual uint32 ShowDropContextMenu(BPoint); virtual void MenusBeginning(); virtual void MenusEnded(); - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); virtual void FrameResized(float, float); virtual void FrameMoved(BPoint); virtual void Zoom(BPoint, float, float); @@ -116,14 +116,14 @@ class BContainerWindow : public BWindow { bool InTrash() const; bool IsPrintersDir() const; - virtual bool IsShowing(const node_ref *) const; - virtual bool IsShowing(const entry_ref *) const; + virtual bool IsShowing(const node_ref*) const; + virtual bool IsShowing(const entry_ref*) const; void ResizeToFit(); - Model *TargetModel() const; - BPoseView *PoseView() const; - BNavigator *Navigator() const; + Model* TargetModel() const; + BPoseView* PoseView() const; + BNavigator* Navigator() const; virtual void SelectionChanged(); virtual void ViewModeChanged(uint32 oldMode, uint32 newMode); @@ -141,44 +141,44 @@ class BContainerWindow : public BWindow { void UpdateBackgroundImage(); - static status_t GetLayoutState(BNode *, BMessage *); - static status_t SetLayoutState(BNode *, const BMessage *); + static status_t GetLayoutState(BNode*, BMessage*); + static status_t SetLayoutState(BNode*, const BMessage*); // calls for inheriting window size, attribute layout, etc. // deprecated - virtual void AddMimeTypesToMenu(BMenu *); + virtual void AddMimeTypesToMenu(BMenu*); void AddMimeTypesToMenu(); - virtual void MarkAttributeMenu(BMenu *); + virtual void MarkAttributeMenu(BMenu*); void MarkAttributeMenu(); - void MarkArrangeByMenu(BMenu *); - BMenuItem *NewAttributeMenuItem(const char *label, const char *name, + void MarkArrangeByMenu(BMenu*); + BMenuItem* NewAttributeMenuItem(const char* label, const char* name, int32 type, float width, int32 align, bool editable, bool statField); - BMenuItem *NewAttributeMenuItem(const char *label, const char *name, + BMenuItem* NewAttributeMenuItem(const char* label, const char* name, int32 type, const char* displayAs, float width, int32 align, bool editable, bool statField); - virtual void NewAttributeMenu(BMenu *); + virtual void NewAttributeMenu(BMenu*); void HideAttributeMenu(); void ShowAttributeMenu(); - PiggybackTaskLoop *DelayedTaskLoop(); + PiggybackTaskLoop* DelayedTaskLoop(); // use for RunLater queueing void PulseTaskLoop(); // called by some view that has pulse, either BackgroundView or BPoseView - static bool DefaultStateSourceNode(const char *name, BNode *result, + static bool DefaultStateSourceNode(const char* name, BNode* result, bool createNew = false, bool createFolder = true); // add-on iteration - void EachAddon(bool(*)(const Model *, const char *, uint32 shortcut, - bool primary, void *), void *, BObjectList &); + void EachAddon(bool (*)(const Model*, const char*, uint32 shortcut, + bool primary, void*), void*, BObjectList &); - BPopUpMenu *ContextMenu(); + BPopUpMenu* ContextMenu(); // drag&drop support - status_t DragStart(const BMessage *); + status_t DragStart(const BMessage*); void DragStop(); bool Dragging() const; - BMessage *DragMessage() const; + BMessage* DragMessage() const; void ShowSelectionWindow(); @@ -189,14 +189,14 @@ class BContainerWindow : public BWindow { bool IsPathWatchingEnabled(void) const; protected: - virtual BPoseView *NewPoseView(Model *, BRect, uint32); + virtual BPoseView* NewPoseView(Model*, BRect, uint32); // instantiate a different flavor of BPoseView for different // ContainerWindows - virtual void RestoreWindowState(AttributeStreamNode *); + virtual void RestoreWindowState(AttributeStreamNode*); virtual void RestoreWindowState(const BMessage &); - virtual void SaveWindowState(AttributeStreamNode *); - virtual void SaveWindowState(BMessage &) const; + virtual void SaveWindowState(AttributeStreamNode*); + virtual void SaveWindowState(BMessage&) const; virtual bool NeedsDefaultStateSetup(); virtual void SetUpDefaultState(); @@ -206,34 +206,34 @@ class BContainerWindow : public BWindow { virtual void AddMenus(); virtual void AddShortcuts(); // add equivalents of the menu shortcuts to the menuless desktop window - virtual void AddFileMenu(BMenu *menu); - virtual void AddWindowMenu(BMenu *menu); + virtual void AddFileMenu(BMenu* menu); + virtual void AddWindowMenu(BMenu* menu); virtual void AddContextMenus(); - virtual void AddFileContextMenus(BMenu *); - virtual void AddWindowContextMenus(BMenu *); - virtual void AddVolumeContextMenus(BMenu *); - virtual void AddDropContextMenus(BMenu *); - virtual void AddTrashContextMenus(BMenu *); + virtual void AddFileContextMenus(BMenu*); + virtual void AddWindowContextMenus(BMenu*); + virtual void AddVolumeContextMenus(BMenu*); + virtual void AddDropContextMenus(BMenu*); + virtual void AddTrashContextMenus(BMenu*); virtual void RepopulateMenus(); - void PopulateArrangeByMenu(BMenu* ); + void PopulateArrangeByMenu(BMenu*); - virtual void SetCutItem(BMenu *); - virtual void SetCopyItem(BMenu *); - virtual void SetPasteItem(BMenu *); - virtual void SetArrangeMenu(BMenu *); - virtual void SetCloseItem(BMenu *); - virtual void SetupNavigationMenu(const entry_ref *, BMenu *); - virtual void SetupMoveCopyMenus(const entry_ref *, BMenu *); - virtual void PopulateMoveCopyNavMenu(BNavMenu *, uint32, const entry_ref *, bool); + virtual void SetCutItem(BMenu*); + virtual void SetCopyItem(BMenu*); + virtual void SetPasteItem(BMenu*); + virtual void SetArrangeMenu(BMenu*); + virtual void SetCloseItem(BMenu*); + virtual void SetupNavigationMenu(const entry_ref*, BMenu*); + virtual void SetupMoveCopyMenus(const entry_ref*, BMenu*); + virtual void PopulateMoveCopyNavMenu(BNavMenu*, uint32, const entry_ref*, bool); - virtual void SetupOpenWithMenu(BMenu *); - virtual void SetUpEditQueryItem(BMenu *); - virtual void SetUpDiskMenu(BMenu *); + virtual void SetupOpenWithMenu(BMenu*); + virtual void SetUpEditQueryItem(BMenu*); + virtual void SetUpDiskMenu(BMenu*); - virtual void BuildAddOnMenu(BMenu *); + virtual void BuildAddOnMenu(BMenu*); void BuildMimeTypeList(BObjectList& mimeTypes); enum UpdateMenuContext { @@ -242,48 +242,48 @@ class BContainerWindow : public BWindow { kWindowPopUpContext }; - virtual void UpdateMenu(BMenu *menu, UpdateMenuContext context); + virtual void UpdateMenu(BMenu* menu, UpdateMenuContext context); BMenu* AddMimeMenu(const BMimeType& mimeType, bool isSuperType, BMenu* menu, int32 start); - BHandler *ResolveSpecifier(BMessage *, int32, BMessage *, int32, - const char *); + BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, int32, + const char*); - bool EachAddon(BPath &path, bool(*)(const Model *, const char *, uint32, bool, void *), - BObjectList *, void *, BObjectList &); - void LoadAddOn(BMessage *); + bool EachAddon(BPath &path, bool(*)(const Model*, const char*, uint32, bool, void*), + BObjectList*, void*, BObjectList &); + void LoadAddOn(BMessage*); - BPopUpMenu *fFileContextMenu; - BPopUpMenu *fWindowContextMenu; - BPopUpMenu *fDropContextMenu; - BPopUpMenu *fVolumeContextMenu; - BPopUpMenu *fTrashContextMenu; - BSlowContextMenu *fDragContextMenu; - BMenuItem *fMoveToItem; - BMenuItem *fCopyToItem; - BMenuItem *fCreateLinkItem; - BMenuItem *fOpenWithItem; - ModelMenuItem *fNavigationItem; - BMenuBar *fMenuBar; - BNavigator *fNavigator; - BPoseView *fPoseView; - LockingList *fWindowList; - BMenu *fAttrMenu; - BMenu *fWindowMenu; - BMenu *fFileMenu; - BMenu *fArrangeByMenu; + BPopUpMenu* fFileContextMenu; + BPopUpMenu* fWindowContextMenu; + BPopUpMenu* fDropContextMenu; + BPopUpMenu* fVolumeContextMenu; + BPopUpMenu* fTrashContextMenu; + BSlowContextMenu* fDragContextMenu; + BMenuItem* fMoveToItem; + BMenuItem* fCopyToItem; + BMenuItem* fCreateLinkItem; + BMenuItem* fOpenWithItem; + ModelMenuItem* fNavigationItem; + BMenuBar* fMenuBar; + BNavigator* fNavigator; + BPoseView* fPoseView; + LockingList* fWindowList; + BMenu* fAttrMenu; + BMenu* fWindowMenu; + BMenu* fFileMenu; + BMenu* fArrangeByMenu; - SelectionWindow *fSelectionWindow; + SelectionWindow* fSelectionWindow; - PiggybackTaskLoop *fTaskLoop; + PiggybackTaskLoop* fTaskLoop; bool fIsTrash; bool fInTrash; bool fIsPrinters; uint32 fContainerWindowFlags; - BackgroundImage *fBackgroundImage; + BackgroundImage* fBackgroundImage; private: BRect fSavedZoomRect; @@ -291,9 +291,9 @@ class BContainerWindow : public BWindow { static BRect sNewWindRect; - BPopUpMenu *fContextMenu; - BMessage *fDragMessage; - BObjectList *fCachedTypesList; + BPopUpMenu* fContextMenu; + BMessage* fDragMessage; + BObjectList* fCachedTypesList; bool fWaitingForRefs; bool fStateNeedsSaving; @@ -316,20 +316,20 @@ class WindowStateNodeOpener { // setter calls used when no attributes can be read from a node and defaults // are to be substituted public: - WindowStateNodeOpener(BContainerWindow *window, bool forWriting); + WindowStateNodeOpener(BContainerWindow* window, bool forWriting); virtual ~WindowStateNodeOpener(); - void SetTo(const BDirectory *); - void SetTo(const BEntry *entry, bool forWriting); - void SetTo(Model *, bool forWriting); + void SetTo(const BDirectory*); + void SetTo(const BEntry* entry, bool forWriting); + void SetTo(Model*, bool forWriting); - AttributeStreamNode *StreamNode() const; - BNode *Node() const; + AttributeStreamNode* StreamNode() const; + BNode* Node() const; private: - ModelNodeLazyOpener *fModelOpener; - BNode *fNode; - AttributeStreamNode *fStreamNode; + ModelNodeLazyOpener* fModelOpener; + BNode* fNode; + AttributeStreamNode* fStreamNode; }; class BackgroundView : public BView { @@ -350,17 +350,17 @@ class BackgroundView : public BView { typedef BView _inherited; }; -int CompareLabels(const BMenuItem *, const BMenuItem *); +int CompareLabels(const BMenuItem*, const BMenuItem*); // inlines --------- -inline BNavigator * +inline BNavigator* BContainerWindow::Navigator() const { return fNavigator; } -inline BPoseView * +inline BPoseView* BContainerWindow::PoseView() const { return fPoseView; @@ -385,12 +385,12 @@ BContainerWindow::IsPrintersDir() const } inline void -BContainerWindow::SetUpDiskMenu(BMenu *) +BContainerWindow::SetUpDiskMenu(BMenu*) { // nothing at this level } -inline BPopUpMenu * +inline BPopUpMenu* BContainerWindow::ContextMenu() { return fContextMenu; @@ -402,7 +402,7 @@ BContainerWindow::Dragging() const return fDragMessage && fCachedTypesList; } -inline BMessage * +inline BMessage* BContainerWindow::DragMessage() const { return fDragMessage; @@ -428,8 +428,8 @@ BContainerWindow::IsPathWatchingEnabled() const return fIsWatchingPath; } -filter_result ActivateWindowFilter(BMessage *message, BHandler **target, - BMessageFilter *messageFilter); +filter_result ActivateWindowFilter(BMessage* message, BHandler**target, + BMessageFilter* messageFilter); } // namespace BPrivate diff --git a/src/kits/tracker/CountView.cpp b/src/kits/tracker/CountView.cpp index c633d5c30a..d9044d0f3e 100644 --- a/src/kits/tracker/CountView.cpp +++ b/src/kits/tracker/CountView.cpp @@ -300,7 +300,7 @@ BCountView::Draw(BRect updateRect) void BCountView::MouseDown(BPoint) { - BContainerWindow *window = dynamic_cast(Window()); + BContainerWindow* window = dynamic_cast(Window()); window->Activate(); window->UpdateIfNeeded(); @@ -308,7 +308,7 @@ BCountView::MouseDown(BPoint) return; if (!window->TargetModel()->IsRoot()) { - BDirMenu *menu = new BDirMenu(NULL, be_app, B_REFS_RECEIVED); + BDirMenu* menu = new BDirMenu(NULL, be_app, B_REFS_RECEIVED); BEntry entry; if (entry.SetTo(window->TargetModel()->EntryRef()) == B_OK) menu->Populate(&entry, Window(), false, false, true, false, true); @@ -340,14 +340,14 @@ BCountView::AttachedToWindow() void -BCountView::SetTypeAhead(const char *string) +BCountView::SetTypeAhead(const char* string) { fTypeAheadString = string; Invalidate(); } -const char * +const char* BCountView::TypeAhead() const { return fTypeAheadString.String(); @@ -362,7 +362,7 @@ BCountView::IsTypingAhead() const void -BCountView::AddFilterCharacter(const char *character) +BCountView::AddFilterCharacter(const char* character) { fFilterString.AppendChars(character, 1); Invalidate(); @@ -385,7 +385,7 @@ BCountView::CancelFilter() } -const char * +const char* BCountView::Filter() const { return fFilterString.String(); diff --git a/src/kits/tracker/CountView.h b/src/kits/tracker/CountView.h index f876c486d5..451fdcd42f 100644 --- a/src/kits/tracker/CountView.h +++ b/src/kits/tracker/CountView.h @@ -31,13 +31,14 @@ 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. */ - #ifndef __COUNT_VIEW__ #define __COUNT_VIEW__ + #include #include + namespace BPrivate { class BPoseView; @@ -46,7 +47,7 @@ class BCountView : public BView { // displays the item count and a barber pole while the view is updating public: - BCountView(BRect, BPoseView *); + BCountView(BRect, BPoseView*); ~BCountView(); virtual void Draw(BRect); @@ -59,14 +60,14 @@ public: void StartBarberPole(); void EndBarberPole(); - void SetTypeAhead(const char *); - const char *TypeAhead() const; + void SetTypeAhead(const char*); + const char* TypeAhead() const; bool IsTypingAhead() const; - void AddFilterCharacter(const char *character); + void AddFilterCharacter(const char* character); void RemoveFilterCharacter(); void CancelFilter(); - const char *Filter() const; + const char* Filter() const; bool IsFiltering() const; void SetBorderHighlighted(bool highlighted); @@ -79,10 +80,10 @@ private: void TrySpinningBarberPole(); int32 fLastCount; - BPoseView *fPoseView; + BPoseView* fPoseView; bool fShowingBarberPole : 1; bool fBorderHighlighted : 1; - BBitmap *fBarberPoleMap; + BBitmap* fBarberPoleMap; float fLastBarberPoleOffset; bigtime_t fStartSpinningAfter; BString fTypeAheadString; diff --git a/src/kits/tracker/Cursors.h b/src/kits/tracker/Cursors.h index c6dbd148a6..9e7076781b 100644 --- a/src/kits/tracker/Cursors.h +++ b/src/kits/tracker/Cursors.h @@ -8,6 +8,7 @@ #ifndef CURSORS_H #define CURSORS_H + // Exported with Wonderbrush from haiku/data/artwork/cursors/Overlays_Tracker // TODO: Don't use these, there are new cursors, which you can use by ID. // (Except for the kMoveCursor, which has different meaning here.) diff --git a/src/kits/tracker/DeskWindow.cpp b/src/kits/tracker/DeskWindow.cpp index bddc16471c..6680aff9c6 100644 --- a/src/kits/tracker/DeskWindow.cpp +++ b/src/kits/tracker/DeskWindow.cpp @@ -60,12 +60,12 @@ All rights reserved. #include "TemplatesMenu.h" -const char *kShelfPath = "tracker_shelf"; +const char* kShelfPath = "tracker_shelf"; // replicant support static void -WatchAddOnDir(directory_which dirName, BDeskWindow *window) +WatchAddOnDir(directory_which dirName, BDeskWindow* window) { BPath path; if (find_directory(dirName, &path) == B_OK) { @@ -79,19 +79,19 @@ WatchAddOnDir(directory_which dirName, BDeskWindow *window) struct AddOneShortcutParams { - BDeskWindow *window; - std::set *currentAddonShortcuts; + BDeskWindow* window; + std::set* currentAddonShortcuts; }; static bool -AddOneShortcut(const Model *model, const char *, uint32 shortcut, bool /*primary*/, void *context) +AddOneShortcut(const Model* model, const char*, uint32 shortcut, bool /*primary*/, void* context) { if (!shortcut) // no shortcut, bail return false; - AddOneShortcutParams *params = (AddOneShortcutParams *)context; - BMessage *runAddon = new BMessage(kLoadAddOn); + AddOneShortcutParams* params = (AddOneShortcutParams*)context; + BMessage* runAddon = new BMessage(kLoadAddOn); runAddon->AddRef("refs", model->EntryRef()); params->window->AddShortcut(shortcut, B_OPTION_KEY | B_COMMAND_KEY, @@ -108,7 +108,7 @@ AddOneShortcut(const Model *model, const char *, uint32 shortcut, bool /*primary #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "DeskWindow" -BDeskWindow::BDeskWindow(LockingList *windowList) +BDeskWindow::BDeskWindow(LockingList* windowList) : BContainerWindow(windowList, 0, kPrivateDesktopWindowLook, kPrivateDesktopWindowFeel, B_NOT_MOVABLE | B_WILL_ACCEPT_FIRST_CLICK @@ -149,7 +149,7 @@ BDeskWindow::~BDeskWindow() void -BDeskWindow::Init(const BMessage *) +BDeskWindow::Init(const BMessage*) { // // Set the size of the screen before calling the container window's @@ -220,7 +220,7 @@ BDeskWindow::Quit() // this duplicates BContainerWindow::Quit because // fNavigationItem can be part of fTrashContextMenu // and would get deleted with it - BMenu *menu = fNavigationItem->Menu(); + BMenu* menu = fNavigationItem->Menu(); if (menu) menu->RemoveItem(fNavigationItem); delete fNavigationItem; @@ -235,15 +235,15 @@ BDeskWindow::Quit() } -BPoseView * -BDeskWindow::NewPoseView(Model *model, BRect rect, uint32 viewMode) +BPoseView* +BDeskWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) { return new DesktopPoseView(model, rect, viewMode); } void -BDeskWindow::CreatePoseView(Model *model) +BDeskWindow::CreatePoseView(Model* model) { fPoseView = NewPoseView(model, Bounds(), kIconMode); fPoseView->SetIconMapping(false); @@ -272,7 +272,7 @@ BDeskWindow::CreatePoseView(Model *model) void -BDeskWindow::AddWindowContextMenus(BMenu *menu) +BDeskWindow::AddWindowContextMenus(BMenu* menu) { TemplatesMenu* tempateMenu = new TemplatesMenu(PoseView(), B_TRANSLATE("New")); @@ -444,14 +444,14 @@ BDeskWindow::ShouldAddContainerView() const void -BDeskWindow::MessageReceived(BMessage *message) +BDeskWindow::MessageReceived(BMessage* message) { if (message->WasDropped()) { - const rgb_color *color; + const rgb_color* color; int32 size; // handle "roColour"-style color drops if (message->FindData("RGBColor", 'RGBC', - (const void **)&color, &size) == B_OK) { + (const void**)&color, &size) == B_OK) { BScreen(this).SetDesktopColor(*color); fPoseView->SetViewColor(*color); fPoseView->SetLowColor(*color); diff --git a/src/kits/tracker/DeskWindow.h b/src/kits/tracker/DeskWindow.h index e490b0a051..472b31d0c9 100644 --- a/src/kits/tracker/DeskWindow.h +++ b/src/kits/tracker/DeskWindow.h @@ -31,38 +31,39 @@ 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. */ - #ifndef _DESK_WINDOW_H #define _DESK_WINDOW_H + #include #include #include "ContainerWindow.h" #include "DesktopPoseView.h" + class BPopUpMenu; namespace BPrivate { class BDeskWindow : public BContainerWindow { public: - BDeskWindow(LockingList *windowList); + BDeskWindow(LockingList* windowList); virtual ~BDeskWindow(); - virtual void Init(const BMessage *message = NULL); + virtual void Init(const BMessage* message = NULL); virtual void Show(); virtual void Quit(); virtual void ScreenChanged(BRect, color_space); - virtual void CreatePoseView(Model *); + virtual void CreatePoseView(Model*); virtual bool ShouldAddMenus() const; virtual bool ShouldAddScrollBars() const; virtual bool ShouldAddContainerView() const; - DesktopPoseView *PoseView() const; + DesktopPoseView* PoseView() const; void UpdateDesktopBackgroundImages(); // Desktop window has special background image handling @@ -70,17 +71,17 @@ public: void SaveDesktopPoseLocations(); protected: - virtual void AddWindowContextMenus(BMenu *); - virtual BPoseView *NewPoseView(Model *, BRect, uint32); + virtual void AddWindowContextMenus(BMenu*); + virtual BPoseView* NewPoseView(Model*, BRect, uint32); virtual void WorkspaceActivated(int32, bool); virtual void MenusBeginning(); - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); private: - BShelf *fDeskShelf; + BShelf* fDeskShelf; // shelf for replicant support - BPopUpMenu *fTrashContextMenu; + BPopUpMenu* fTrashContextMenu; BRect fOldFrame; @@ -95,10 +96,11 @@ private: typedef BContainerWindow _inherited; }; -inline DesktopPoseView * + +inline DesktopPoseView* BDeskWindow::PoseView() const { - return dynamic_cast(_inherited::PoseView()); + return dynamic_cast(_inherited::PoseView()); } } // namespace BPrivate diff --git a/src/kits/tracker/DesktopPoseView.cpp b/src/kits/tracker/DesktopPoseView.cpp index c2bb9423ac..ad9bedf2eb 100644 --- a/src/kits/tracker/DesktopPoseView.cpp +++ b/src/kits/tracker/DesktopPoseView.cpp @@ -55,7 +55,7 @@ All rights reserved. // #pragma mark - -DesktopPoseView::DesktopPoseView(Model *model, BRect frame, uint32 viewMode, +DesktopPoseView::DesktopPoseView(Model* model, BRect frame, uint32 viewMode, uint32 resizeMask) : BPoseView(model, frame, viewMode, resizeMask) @@ -64,9 +64,9 @@ DesktopPoseView::DesktopPoseView(Model *model, BRect frame, uint32 viewMode, } -EntryListBase * -DesktopPoseView::InitDesktopDirentIterator(BPoseView *nodeMonitoringTarget, - const entry_ref *ref) +EntryListBase* +DesktopPoseView::InitDesktopDirentIterator(BPoseView* nodeMonitoringTarget, + const entry_ref* ref) { // the desktop dirent iterator knows how to iterate over all the volumes, // integrated onto the desktop @@ -75,16 +75,16 @@ DesktopPoseView::InitDesktopDirentIterator(BPoseView *nodeMonitoringTarget, if (sourceModel.InitCheck() != B_OK) return NULL; - CachedEntryIteratorList *result = new CachedEntryIteratorList(); + CachedEntryIteratorList* result = new CachedEntryIteratorList(); ASSERT(!sourceModel.IsQuery()); ASSERT(sourceModel.Node()); - BDirectory *sourceDirectory = dynamic_cast(sourceModel.Node()); + BDirectory* sourceDirectory = dynamic_cast(sourceModel.Node()); ASSERT(sourceDirectory); // build an iterator list, start with boot - EntryListBase *perDesktopIterator = new CachedDirectoryEntryList( + EntryListBase* perDesktopIterator = new CachedDirectoryEntryList( *sourceDirectory); result->AddItem(perDesktopIterator); @@ -106,15 +106,15 @@ DesktopPoseView::InitDesktopDirentIterator(BPoseView *nodeMonitoringTarget, } -EntryListBase * -DesktopPoseView::InitDirentIterator(const entry_ref *ref) +EntryListBase* +DesktopPoseView::InitDirentIterator(const entry_ref* ref) { return InitDesktopDirentIterator(this, ref); } bool -DesktopPoseView::FSNotification(const BMessage *message) +DesktopPoseView::FSNotification(const BMessage* message) { switch (message->FindInt32("opcode")) { case B_DEVICE_MOUNTED: @@ -144,7 +144,7 @@ DesktopPoseView::FSNotification(const BMessage *message) bool -DesktopPoseView::AddPosesThreadValid(const entry_ref *) const +DesktopPoseView::AddPosesThreadValid(const entry_ref*) const { return true; } @@ -159,7 +159,7 @@ DesktopPoseView::AddPosesCompleted() bool -DesktopPoseView::Represents(const node_ref *ref) const +DesktopPoseView::Represents(const node_ref* ref) const { // When the Tracker is set up to integrate non-boot beos volumes, // it represents the home/Desktop folders of all beos volumes @@ -169,7 +169,7 @@ DesktopPoseView::Represents(const node_ref *ref) const bool -DesktopPoseView::Represents(const entry_ref *ref) const +DesktopPoseView::Represents(const entry_ref* ref) const { BEntry entry(ref); node_ref nref; @@ -183,7 +183,7 @@ DesktopPoseView::ShowVolumes(bool visible, bool showShared) { if (LockLooper()) { SavePoseLocations(); - if (!visible) + if (!visible) RemoveRootPoses(); else AddRootPoses(true, showShared); @@ -215,9 +215,9 @@ DesktopPoseView::StopSettingsWatch() void -DesktopPoseView::AdaptToVolumeChange(BMessage *message) +DesktopPoseView::AdaptToVolumeChange(BMessage* message) { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -241,7 +241,7 @@ DesktopPoseView::AdaptToVolumeChange(BMessage *message) entryMessage.AddInt32("opcode", B_ENTRY_REMOVED); entry_ref ref; if (entry.GetRef(&ref) == B_OK) { - BContainerWindow *disksWindow = tracker->FindContainerWindow(&ref); + BContainerWindow* disksWindow = tracker->FindContainerWindow(&ref); if (disksWindow) { disksWindow->Lock(); disksWindow->Close(); @@ -252,7 +252,7 @@ DesktopPoseView::AdaptToVolumeChange(BMessage *message) entryMessage.AddInt64("node", model.NodeRef()->node); entryMessage.AddInt64("directory", model.EntryRef()->directory); entryMessage.AddString("name", model.EntryRef()->name); - BContainerWindow *deskWindow = dynamic_cast(Window()); + BContainerWindow* deskWindow = dynamic_cast(Window()); if (deskWindow) deskWindow->PostMessage(&entryMessage, deskWindow->PoseView()); } @@ -262,7 +262,7 @@ DesktopPoseView::AdaptToVolumeChange(BMessage *message) void -DesktopPoseView::AdaptToDesktopIntegrationChange(BMessage *message) +DesktopPoseView::AdaptToDesktopIntegrationChange(BMessage* message) { bool mountVolumesOnDesktop = true; bool mountSharedVolumesOntoDesktop = true; diff --git a/src/kits/tracker/DesktopPoseView.h b/src/kits/tracker/DesktopPoseView.h index 3b611129af..8d7ffad52e 100644 --- a/src/kits/tracker/DesktopPoseView.h +++ b/src/kits/tracker/DesktopPoseView.h @@ -34,49 +34,51 @@ All rights reserved. // DesktopPoseView adds support for displaying integrated desktops // from multiple volumes to BPoseView - #ifndef _DESKTOP_POSE_VIEW_H #define _DESKTOP_POSE_VIEW_H + #include "EntryIterator.h" #include "PoseView.h" + namespace BPrivate { class DesktopPoseView : public BPoseView { // overrides BPoseView to add desktop-view specific code public: - DesktopPoseView(Model *, BRect, uint32 viewMode, uint32 resizeMask = B_FOLLOW_ALL); + DesktopPoseView(Model*, BRect, uint32 viewMode, + uint32 resizeMask = B_FOLLOW_ALL); - static EntryListBase *InitDesktopDirentIterator(BPoseView *, const entry_ref *); + static EntryListBase* InitDesktopDirentIterator(BPoseView*, + const entry_ref*); void ShowVolumes(bool visible, bool showShared); - + void StartSettingsWatch(); void StopSettingsWatch(); - - virtual bool AddPosesThreadValid(const entry_ref *) const; + + virtual bool AddPosesThreadValid(const entry_ref*) const; virtual void AddPosesCompleted(); - + protected: - virtual EntryListBase *InitDirentIterator(const entry_ref *); - virtual bool FSNotification(const BMessage *); + virtual EntryListBase* InitDirentIterator(const entry_ref*); + virtual bool FSNotification(const BMessage*); virtual bool IsDesktopView() const; - virtual bool Represents(const node_ref *) const; - virtual bool Represents(const entry_ref *) const; + virtual bool Represents(const node_ref*) const; + virtual bool Represents(const entry_ref*) const; - void AdaptToVolumeChange(BMessage *); - void AdaptToDesktopIntegrationChange(BMessage *); + void AdaptToVolumeChange(BMessage*); + void AdaptToDesktopIntegrationChange(BMessage*); private: typedef BPoseView _inherited; - }; -inline bool +inline bool DesktopPoseView::IsDesktopView() const { return true; diff --git a/src/kits/tracker/DialogPane.cpp b/src/kits/tracker/DialogPane.cpp index 18dd586aae..06b60369a2 100644 --- a/src/kits/tracker/DialogPane.cpp +++ b/src/kits/tracker/DialogPane.cpp @@ -48,21 +48,21 @@ const rgb_color kHighlightColor = {100, 100, 0, 255}; static void -AddSelf(BView *self, BView *to) +AddSelf(BView* self, BView* to) { to->AddChild(self); } void -ViewList::RemoveAll(BView *) +ViewList::RemoveAll(BView*) { EachListItemIgnoreResult(this, &BView::RemoveSelf); } void -ViewList::AddAll(BView *toParent) +ViewList::AddAll(BView* toParent) { EachListItem(this, &AddSelf, toParent); } @@ -72,7 +72,7 @@ ViewList::AddAll(BView *toParent) DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode, - const char *name, uint32 followFlags, uint32 flags) + const char* name, uint32 followFlags, uint32 flags) : BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode2Frame), name, followFlags, flags), fMode(initialMode), @@ -85,7 +85,7 @@ DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, int32 initialMode, DialogPane::DialogPane(BRect mode1Frame, BRect mode2Frame, BRect mode3Frame, - int32 initialMode, const char *name, uint32 followFlags, uint32 flags) + int32 initialMode, const char* name, uint32 followFlags, uint32 flags) : BView(FrameForMode(initialMode, mode1Frame, mode2Frame, mode3Frame), name, followFlags, flags), fMode(initialMode), @@ -134,7 +134,7 @@ DialogPane::SetMode(int32 mode, bool initialSetup) if (delta != 0) { MoveBy(0, delta); if (fLatch && (fLatch->ResizingMode() & B_FOLLOW_BOTTOM)) - fLatch->MoveBy(0, delta); + fLatch->MoveBy(0, delta); } switch (fMode) { @@ -145,7 +145,7 @@ DialogPane::SetMode(int32 mode, bool initialSetup) if (oldMode > 0) fMode2Items.RemoveAll(this); - BView *separator = FindView("separatorLine"); + BView* separator = FindView("separatorLine"); if (separator) { BRect frame(separator->Frame()); frame.InsetBy(-1, -1); @@ -160,34 +160,34 @@ DialogPane::SetMode(int32 mode, bool initialSetup) } case 1: { - if (oldMode > 1) + if (oldMode > 1) fMode3Items.RemoveAll(this); - else + else fMode2Items.AddAll(this); - BView *separator = FindView("separatorLine"); + BView* separator = FindView("separatorLine"); if (separator) { BRect frame(separator->Frame()); frame.InsetBy(-1, -1); RemoveChild(separator); Invalidate(); } - break; + break; } case 2: { fMode3Items.AddAll(this); - if (oldMode < 1) + if (oldMode < 1) fMode2Items.AddAll(this); - BView *separator = FindView("separatorLine"); + BView* separator = FindView("separatorLine"); if (separator) { BRect frame(separator->Frame()); frame.InsetBy(-1, -1); RemoveChild(separator); Invalidate(); } - break; + break; } } } @@ -196,7 +196,7 @@ DialogPane::SetMode(int32 mode, bool initialSetup) void DialogPane::AttachedToWindow() { - BView *parent = Parent(); + BView* parent = Parent(); if (parent) { SetViewColor(parent->ViewColor()); SetLowColor(parent->LowColor()); @@ -220,7 +220,7 @@ DialogPane::ResizeParentWindow(int32 from, int32 to) void -DialogPane::AddItem(BView *view, int32 toMode) +DialogPane::AddItem(BView* view, int32 toMode) { if (toMode == 1) fMode2Items.AddItem(view); @@ -283,16 +283,16 @@ DialogPane::FrameForMode(int32 mode, BRect mode1Frame, BRect mode2Frame, void -DialogPane::SetSwitch(BControl *control) +DialogPane::SetSwitch(BControl* control) { - fLatch = control; + fLatch = control; control->SetMessage(new BMessage(kValueChanged)); control->SetTarget(this); } void -DialogPane::MessageReceived(BMessage *message) +DialogPane::MessageReceived(BMessage* message) { if (message->what == kValueChanged) { int32 value; @@ -306,7 +306,7 @@ DialogPane::MessageReceived(BMessage *message) // #pragma mark - PaneSwitch -PaneSwitch::PaneSwitch(BRect frame, const char *name, bool leftAligned, +PaneSwitch::PaneSwitch(BRect frame, const char* name, bool leftAligned, uint32 resizeMask, uint32 flags) : BControl(frame, name, "", 0, resizeMask, flags), @@ -318,7 +318,7 @@ PaneSwitch::PaneSwitch(BRect frame, const char *name, bool leftAligned, } -PaneSwitch::PaneSwitch(const char *name, bool leftAligned, uint32 flags) +PaneSwitch::PaneSwitch(const char* name, bool leftAligned, uint32 flags) : BControl(name, "", 0, flags), fLeftAligned(leftAligned), @@ -507,32 +507,32 @@ PaneSwitch::DrawInState(PaneSwitch::State state) BeginLineArray(6); if (fLeftAligned) { - AddLine(BPoint(rect.left + 3, rect.top + 1), + AddLine(BPoint(rect.left + 3, rect.top + 1), BPoint(rect.left + 3, rect.bottom - 1), outlineColor); - AddLine(BPoint(rect.left + 3, rect.top + 1), + AddLine(BPoint(rect.left + 3, rect.top + 1), BPoint(rect.left + 7, rect.top + 5), outlineColor); - AddLine(BPoint(rect.left + 7, rect.top + 5), + AddLine(BPoint(rect.left + 7, rect.top + 5), BPoint(rect.left + 3, rect.bottom - 1), outlineColor); - AddLine(BPoint(rect.left + 4, rect.top + 3), + AddLine(BPoint(rect.left + 4, rect.top + 3), BPoint(rect.left + 4, rect.bottom - 3), middleColor); - AddLine(BPoint(rect.left + 5, rect.top + 4), + AddLine(BPoint(rect.left + 5, rect.top + 4), BPoint(rect.left + 5, rect.bottom - 4), middleColor); - AddLine(BPoint(rect.left + 5, rect.top + 5), + AddLine(BPoint(rect.left + 5, rect.top + 5), BPoint(rect.left + 6, rect.top + 5), middleColor); } else { - AddLine(BPoint(rect.right - 3, rect.top + 1), + AddLine(BPoint(rect.right - 3, rect.top + 1), BPoint(rect.right - 3, rect.bottom - 1), outlineColor); - AddLine(BPoint(rect.right - 3, rect.top + 1), + AddLine(BPoint(rect.right - 3, rect.top + 1), BPoint(rect.right - 7, rect.top + 5), outlineColor); - AddLine(BPoint(rect.right - 7, rect.top + 5), + AddLine(BPoint(rect.right - 7, rect.top + 5), BPoint(rect.right - 3, rect.bottom - 1), outlineColor); - AddLine(BPoint(rect.right - 4, rect.top + 3), + AddLine(BPoint(rect.right - 4, rect.top + 3), BPoint(rect.right - 4, rect.bottom - 3), middleColor); - AddLine(BPoint(rect.right - 5, rect.top + 4), + AddLine(BPoint(rect.right - 5, rect.top + 4), BPoint(rect.right - 5, rect.bottom - 4), middleColor); - AddLine(BPoint(rect.right - 5, rect.top + 5), + AddLine(BPoint(rect.right - 5, rect.top + 5), BPoint(rect.right - 6, rect.top + 5), middleColor); } EndLineArray(); @@ -541,36 +541,36 @@ PaneSwitch::DrawInState(PaneSwitch::State state) case kPressed: BeginLineArray(7); if (fLeftAligned) { - AddLine(BPoint(rect.left + 1, rect.top + 7), + AddLine(BPoint(rect.left + 1, rect.top + 7), BPoint(rect.left + 7, rect.top + 7), outlineColor); - AddLine(BPoint(rect.left + 7, rect.top + 1), + AddLine(BPoint(rect.left + 7, rect.top + 1), BPoint(rect.left + 7, rect.top + 7), outlineColor); - AddLine(BPoint(rect.left + 1, rect.top + 7), + AddLine(BPoint(rect.left + 1, rect.top + 7), BPoint(rect.left + 7, rect.top + 1), outlineColor); - AddLine(BPoint(rect.left + 3, rect.top + 6), + AddLine(BPoint(rect.left + 3, rect.top + 6), BPoint(rect.left + 6, rect.top + 6), middleColor); - AddLine(BPoint(rect.left + 4, rect.top + 5), + AddLine(BPoint(rect.left + 4, rect.top + 5), BPoint(rect.left + 6, rect.top + 5), middleColor); - AddLine(BPoint(rect.left + 5, rect.top + 4), + AddLine(BPoint(rect.left + 5, rect.top + 4), BPoint(rect.left + 6, rect.top + 4), middleColor); - AddLine(BPoint(rect.left + 6, rect.top + 3), + AddLine(BPoint(rect.left + 6, rect.top + 3), BPoint(rect.left + 6, rect.top + 4), middleColor); } else { - AddLine(BPoint(rect.right - 1, rect.top + 7), + AddLine(BPoint(rect.right - 1, rect.top + 7), BPoint(rect.right - 7, rect.top + 7), outlineColor); - AddLine(BPoint(rect.right - 7, rect.top + 1), + AddLine(BPoint(rect.right - 7, rect.top + 1), BPoint(rect.right - 7, rect.top + 7), outlineColor); - AddLine(BPoint(rect.right - 1, rect.top + 7), + AddLine(BPoint(rect.right - 1, rect.top + 7), BPoint(rect.right - 7, rect.top + 1), outlineColor); - AddLine(BPoint(rect.right - 3, rect.top + 6), + AddLine(BPoint(rect.right - 3, rect.top + 6), BPoint(rect.right - 6, rect.top + 6), middleColor); - AddLine(BPoint(rect.right - 4, rect.top + 5), + AddLine(BPoint(rect.right - 4, rect.top + 5), BPoint(rect.right - 6, rect.top + 5), middleColor); - AddLine(BPoint(rect.right - 5, rect.top + 4), + AddLine(BPoint(rect.right - 5, rect.top + 4), BPoint(rect.right - 6, rect.top + 4), middleColor); - AddLine(BPoint(rect.right - 6, rect.top + 3), + AddLine(BPoint(rect.right - 6, rect.top + 3), BPoint(rect.right - 6, rect.top + 4), middleColor); } EndLineArray(); @@ -578,21 +578,20 @@ PaneSwitch::DrawInState(PaneSwitch::State state) case kExpanded: BeginLineArray(6); - AddLine(BPoint(rect.left + 1, rect.top + 3), + AddLine(BPoint(rect.left + 1, rect.top + 3), BPoint(rect.right - 1, rect.top + 3), outlineColor); - AddLine(BPoint(rect.left + 1, rect.top + 3), + AddLine(BPoint(rect.left + 1, rect.top + 3), BPoint(rect.left + 5, rect.top + 7), outlineColor); - AddLine(BPoint(rect.left + 5, rect.top + 7), + AddLine(BPoint(rect.left + 5, rect.top + 7), BPoint(rect.right - 1, rect.top + 3), outlineColor); - AddLine(BPoint(rect.left + 3, rect.top + 4), + AddLine(BPoint(rect.left + 3, rect.top + 4), BPoint(rect.right - 3, rect.top + 4), middleColor); - AddLine(BPoint(rect.left + 4, rect.top + 5), + AddLine(BPoint(rect.left + 4, rect.top + 5), BPoint(rect.right - 4, rect.top + 5), middleColor); - AddLine(BPoint(rect.left + 5, rect.top + 5), + AddLine(BPoint(rect.left + 5, rect.top + 5), BPoint(rect.left + 5, rect.top + 6), middleColor); EndLineArray(); break; } } - diff --git a/src/kits/tracker/DialogPane.h b/src/kits/tracker/DialogPane.h index 21ca1c7e3d..c9d12a0b8a 100644 --- a/src/kits/tracker/DialogPane.h +++ b/src/kits/tracker/DialogPane.h @@ -31,14 +31,15 @@ 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. */ - #ifndef _DIALOG_PANE_ #define _DIALOG_PANE_ + #include #include "ObjectList.h" + namespace BPrivate { class ViewList : public BObjectList { @@ -51,6 +52,7 @@ public: void AddAll(BView* toParent); }; + class DialogPane : public BView { // dialog with collapsible panes public: @@ -101,7 +103,7 @@ private: }; -inline int32 +inline int32 DialogPane::Mode() const { return fMode; @@ -113,7 +115,7 @@ public: PaneSwitch(BRect frame, const char* name, bool leftAligned = true, uint32 resizeMask - = B_FOLLOW_LEFT | B_FOLLOW_TOP, + = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_NAVIGABLE); PaneSwitch(const char* name, diff --git a/src/kits/tracker/DirMenu.cpp b/src/kits/tracker/DirMenu.cpp index 1d3a4d99da..38ae18b346 100644 --- a/src/kits/tracker/DirMenu.cpp +++ b/src/kits/tracker/DirMenu.cpp @@ -58,8 +58,8 @@ All rights reserved. #define B_TRANSLATION_CONTEXT "DirMenu" -BDirMenu::BDirMenu(BMenuBar *bar, BMessenger target, uint32 command, - const char *entryName) +BDirMenu::BDirMenu(BMenuBar* bar, BMessenger target, uint32 command, + const char* entryName) : BPopUpMenu("directories"), fTarget(target), @@ -80,7 +80,7 @@ BDirMenu::~BDirMenu() void -BDirMenu::Populate(const BEntry *startEntry, BWindow *originatingWindow, +BDirMenu::Populate(const BEntry* startEntry, BWindow* originatingWindow, bool includeStartEntry, bool select, bool reverse, bool addShortcuts, bool navMenuEntries) { @@ -91,7 +91,7 @@ BDirMenu::Populate(const BEntry *startEntry, BWindow *originatingWindow, Model model(startEntry); ThrowOnInitCheckError(&model); - ModelMenuItem *menu = new ModelMenuItem(&model, this, true, true); + ModelMenuItem* menu = new ModelMenuItem(&model, this, true, true); if (fMenuBar) fMenuBar->AddItem(menu); @@ -139,7 +139,8 @@ BDirMenu::Populate(const BEntry *startEntry, BWindow *originatingWindow, // if we're at the root directory skip "mnt" and go straight to "/" BDirectory dir(&entry); - if (!showDesktop && dir.InitCheck() == B_OK && dir.IsRootDirectory()) { + if (!showDesktop && dir.InitCheck() == B_OK + && dir.IsRootDirectory()) { hitRoot = true; parent.SetTo("/"); } @@ -176,7 +177,8 @@ BDirMenu::Populate(const BEntry *startEntry, BWindow *originatingWindow, if (!select) return; - ModelMenuItem *item = dynamic_cast(ItemAt(CountItems() - 1)); + ModelMenuItem* item + = dynamic_cast(ItemAt(CountItems() - 1)); if (item) { item->SetMarked(true); if (menu) { @@ -196,24 +198,24 @@ BDirMenu::Populate(const BEntry *startEntry, BWindow *originatingWindow, void -BDirMenu::AddItemToDirMenu(const BEntry *entry, BWindow *originatingWindow, +BDirMenu::AddItemToDirMenu(const BEntry* entry, BWindow* originatingWindow, bool atEnd, bool addShortcuts, bool navMenuEntries) { Model model(entry); if (model.InitCheck() != B_OK) return; - BMessage *message = new BMessage(fCommand); + BMessage* message = new BMessage(fCommand); message->AddRef(fEntryName.String(), model.EntryRef()); // add reference to the container windows model so that we can // close the window if - BContainerWindow *window = originatingWindow ? - dynamic_cast(originatingWindow) : 0; + BContainerWindow* window = originatingWindow ? + dynamic_cast(originatingWindow) : 0; if (window) message->AddData("nodeRefsToClose", B_RAW_TYPE, window->TargetModel()->NodeRef(), sizeof (node_ref)); - ModelMenuItem *item; + ModelMenuItem* item; if (navMenuEntries) { BNavMenu* subMenu = new BNavMenu(model.Name(), B_REFS_RECEIVED, fTarget, window); @@ -242,7 +244,7 @@ BDirMenu::AddItemToDirMenu(const BEntry *entry, BWindow *originatingWindow, item->SetTarget(fTarget); if (fMenuBar) { - ModelMenuItem *menu = dynamic_cast(fMenuBar->ItemAt(0)); + ModelMenuItem* menu = dynamic_cast(fMenuBar->ItemAt(0)); if (menu) { ThrowOnError(menu->SetEntry(entry)); item->SetMarked(true); @@ -259,7 +261,7 @@ BDirMenu::AddDisksIconToMenu(bool atEnd) if (model.InitCheck() != B_OK) return; - BMessage *message = new BMessage(fCommand); + BMessage* message = new BMessage(fCommand); message->AddRef(fEntryName.String(), model.EntryRef()); ModelMenuItem* item = new ModelMenuItem(&model, B_TRANSLATE("Disks"), @@ -269,4 +271,3 @@ BDirMenu::AddDisksIconToMenu(bool atEnd) else AddItem(item, 0); } - diff --git a/src/kits/tracker/DirMenu.h b/src/kits/tracker/DirMenu.h index 7cef53b352..597cd4e509 100644 --- a/src/kits/tracker/DirMenu.h +++ b/src/kits/tracker/DirMenu.h @@ -31,41 +31,43 @@ 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. */ - #ifndef DIR_MENU_H #define DIR_MENU_H + #include #include + class MenuBar; namespace BPrivate { class BDirMenu : public BPopUpMenu { public: - BDirMenu(BMenuBar *, BMessenger target, uint32 command, - const char *entryName = 0); + BDirMenu(BMenuBar*, BMessenger target, uint32 command, + const char* entryName = 0); virtual ~BDirMenu(); - void Populate(const BEntry *startDir, BWindow *originatingWindow, + void Populate(const BEntry* startDir, BWindow* originatingWindow, bool includeStartDir = false, bool select = false, bool reverse = false, bool addShortcuts = false, bool navMenuEntries = false); - void AddItemToDirMenu(const BEntry *, BWindow *originatingWindow, + void AddItemToDirMenu(const BEntry*, BWindow* originatingWindow, bool atEnd, bool addShortcuts, bool navMenuEntries = false); void AddDisksIconToMenu(bool reverse = false); - void SetMenuBar(BMenuBar *); + void SetMenuBar(BMenuBar*); private: BMessenger fTarget; - BMenuBar *fMenuBar; + BMenuBar* fMenuBar; uint32 fCommand; BString fEntryName; }; + inline void -BDirMenu::SetMenuBar(BMenuBar *bar) +BDirMenu::SetMenuBar(BMenuBar* bar) { fMenuBar = bar; } diff --git a/src/kits/tracker/EntryIterator.cpp b/src/kits/tracker/EntryIterator.cpp index 88063ce9af..ee328ec458 100644 --- a/src/kits/tracker/EntryIterator.cpp +++ b/src/kits/tracker/EntryIterator.cpp @@ -44,7 +44,7 @@ All rights reserved. #include "ObjectList.h" -TWalkerWrapper::TWalkerWrapper(BTrackerPrivate::TWalker *walker) +TWalkerWrapper::TWalkerWrapper(BTrackerPrivate::TWalker* walker) : fWalker(walker), fStatus(B_OK) @@ -66,7 +66,7 @@ TWalkerWrapper::InitCheck() const status_t -TWalkerWrapper::GetNextEntry(BEntry *entry, bool traverse) +TWalkerWrapper::GetNextEntry(BEntry* entry, bool traverse) { fStatus = fWalker->GetNextEntry(entry, traverse); return fStatus; @@ -74,7 +74,7 @@ TWalkerWrapper::GetNextEntry(BEntry *entry, bool traverse) status_t -TWalkerWrapper::GetNextRef(entry_ref *ref) +TWalkerWrapper::GetNextRef(entry_ref* ref) { fStatus = fWalker->GetNextRef(ref); return fStatus; @@ -82,7 +82,7 @@ TWalkerWrapper::GetNextRef(entry_ref *ref) int32 -TWalkerWrapper::GetNextDirents(struct dirent *buffer, size_t length, +TWalkerWrapper::GetNextDirents(struct dirent* buffer, size_t length, int32 count) { int32 result = fWalker->GetNextDirents(buffer, length, count); @@ -121,17 +121,17 @@ EntryListBase::InitCheck() const } -dirent * -EntryListBase::Next(dirent *ent) +dirent* +EntryListBase::Next(dirent* ent) { - return (dirent *)((char *)ent + ent->d_reclen); + return (dirent*)((char*)ent + ent->d_reclen); } // #pragma mark - -CachedEntryIterator::CachedEntryIterator(BEntryList *iterator, int32 numEntries, +CachedEntryIterator::CachedEntryIterator(BEntryList* iterator, int32 numEntries, bool sortInodes) : fIterator(iterator), @@ -158,7 +158,7 @@ CachedEntryIterator::~CachedEntryIterator() status_t -CachedEntryIterator::GetNextEntry(BEntry *result, bool traverse) +CachedEntryIterator::GetNextEntry(BEntry* result, bool traverse) { ASSERT(!fDirentBuffer); ASSERT(!fEntryRefBuffer); @@ -191,7 +191,7 @@ CachedEntryIterator::GetNextEntry(BEntry *result, bool traverse) status_t -CachedEntryIterator::GetNextRef(entry_ref *ref) +CachedEntryIterator::GetNextRef(entry_ref* ref) { ASSERT(!fDirentBuffer); ASSERT(!fEntryBuffer); @@ -223,7 +223,7 @@ CachedEntryIterator::GetNextRef(entry_ref *ref) /*static*/ int -CachedEntryIterator::_CompareInodes(const dirent *ent1, const dirent *ent2) +CachedEntryIterator::_CompareInodes(const dirent* ent1, const dirent* ent2) { if (ent1->d_ino < ent2->d_ino) return -1; @@ -235,12 +235,12 @@ CachedEntryIterator::_CompareInodes(const dirent *ent1, const dirent *ent2) int32 -CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size, +CachedEntryIterator::GetNextDirents(struct dirent* ent, size_t size, int32 count) { ASSERT(!fEntryRefBuffer); if (!fDirentBuffer) { - fDirentBuffer = (dirent *)malloc(kDirentBufferSize); + fDirentBuffer = (dirent*)malloc(kDirentBufferSize); ASSERT(fIndex == 0 && fNumEntries == 0); ASSERT(size > sizeof(dirent) + B_FILE_NAME_LENGTH); } @@ -272,7 +272,7 @@ CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size, } fCurrentDirent - = (dirent *)((char *)fCurrentDirent + currentDirentSize); + = (dirent*)((char*)fCurrentDirent + currentDirentSize); } fCurrentDirent = fDirentBuffer; if (fSortInodes) { @@ -307,7 +307,7 @@ CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size, memcpy(ent, fCurrentDirent, currentDirentSize); if (!fSortInodes) - fCurrentDirent = (dirent *)((char *)fCurrentDirent + currentDirentSize); + fCurrentDirent = (dirent*)((char*)fCurrentDirent + currentDirentSize); return 1; } @@ -336,7 +336,7 @@ CachedEntryIterator::CountEntries() void -CachedEntryIterator::SetTo(BEntryList *iterator) +CachedEntryIterator::SetTo(BEntryList* iterator) { fIndex = 0; fNumEntries = 0; @@ -374,7 +374,7 @@ DirectoryEntryList::DirectoryEntryList(const BDirectory &dir) status_t -DirectoryEntryList::GetNextEntry(BEntry *entry, bool traverse) +DirectoryEntryList::GetNextEntry(BEntry* entry, bool traverse) { fStatus = fDir.GetNextEntry(entry, traverse); return fStatus; @@ -382,7 +382,7 @@ DirectoryEntryList::GetNextEntry(BEntry *entry, bool traverse) status_t -DirectoryEntryList::GetNextRef(entry_ref *ref) +DirectoryEntryList::GetNextRef(entry_ref* ref) { fStatus = fDir.GetNextRef(ref); return fStatus; @@ -390,7 +390,7 @@ DirectoryEntryList::GetNextRef(entry_ref *ref) int32 -DirectoryEntryList::GetNextDirents(struct dirent *buffer, size_t length, +DirectoryEntryList::GetNextDirents(struct dirent* buffer, size_t length, int32 count) { fStatus = fDir.GetNextDirents(buffer, length, count); @@ -429,8 +429,8 @@ EntryIteratorList::~EntryIteratorList() int32 count = fList.CountItems(); for (;count; count--) { // workaround for BEntryList not having a proper destructor - BEntryList *entry = fList.RemoveItemAt(count - 1); - EntryListBase *fixedEntry = dynamic_cast(entry); + BEntryList* entry = fList.RemoveItemAt(count - 1); + EntryListBase* fixedEntry = dynamic_cast(entry); if (fixedEntry) delete fixedEntry; @@ -441,14 +441,14 @@ EntryIteratorList::~EntryIteratorList() void -EntryIteratorList::AddItem(BEntryList *walker) +EntryIteratorList::AddItem(BEntryList* walker) { fList.AddItem(walker); } status_t -EntryIteratorList::GetNextEntry(BEntry *entry, bool traverse) +EntryIteratorList::GetNextEntry(BEntry* entry, bool traverse) { while (true) { if (fCurrentIndex >= fList.CountItems()) { @@ -467,7 +467,7 @@ EntryIteratorList::GetNextEntry(BEntry *entry, bool traverse) status_t -EntryIteratorList::GetNextRef(entry_ref *ref) +EntryIteratorList::GetNextRef(entry_ref* ref) { while (true) { if (fCurrentIndex >= fList.CountItems()) { @@ -486,7 +486,7 @@ EntryIteratorList::GetNextRef(entry_ref *ref) int32 -EntryIteratorList::GetNextDirents(struct dirent *buffer, size_t length, +EntryIteratorList::GetNextDirents(struct dirent* buffer, size_t length, int32 count) { int32 result = 0; @@ -546,8 +546,7 @@ CachedEntryIteratorList::CachedEntryIteratorList(bool sortInodes) void -CachedEntryIteratorList::AddItem(BEntryList *walker) +CachedEntryIteratorList::AddItem(BEntryList* walker) { fIteratorList.AddItem(walker); } - diff --git a/src/kits/tracker/EntryIterator.h b/src/kits/tracker/EntryIterator.h index d38f88170d..843480bb56 100644 --- a/src/kits/tracker/EntryIterator.h +++ b/src/kits/tracker/EntryIterator.h @@ -31,20 +31,22 @@ 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. */ +#ifndef __ENTRY_ITERATOR__ +#define __ENTRY_ITERATOR__ + // A lot of the code in here wouldn't be needed if the destructor // for BEntryList was virtual -// ToDo: -// get rid of all BEntryList API's in here, replace them with EntryListBase ones +// TODO: get rid of all BEntryList API's in here, replace them with +// EntryListBase ones -#ifndef __ENTRY_ITERATOR__ -#define __ENTRY_ITERATOR__ #include #include "ObjectList.h" #include "NodeWalker.h" + namespace BPrivate { class EntryListBase : public BEntryList { @@ -55,41 +57,44 @@ public: virtual status_t InitCheck() const; - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false) = 0; - virtual status_t GetNextRef(entry_ref *ref) = 0; - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false) = 0; + virtual status_t GetNextRef(entry_ref* ref) = 0; + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX) = 0; virtual status_t Rewind() = 0; virtual int32 CountEntries() = 0; - static dirent *Next(dirent *); + static dirent* Next(dirent*); protected: status_t fStatus; }; + class TWalkerWrapper : public EntryListBase { // this is to be able to use TWalker polymorfically as BEntryListBase public: - TWalkerWrapper(BTrackerPrivate::TWalker *walker); + TWalkerWrapper(BTrackerPrivate::TWalker* walker); virtual ~TWalkerWrapper(); virtual status_t InitCheck() const; - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false); + virtual status_t GetNextRef(entry_ref* ref); + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX); virtual status_t Rewind(); virtual int32 CountEntries(); protected: - BTrackerPrivate::TWalker *fWalker; + BTrackerPrivate::TWalker* fWalker; status_t fStatus; }; + const int32 kDirentBufferSize = 10 * 1024; + class CachedEntryIterator : public EntryListBase { public: // takes any iterator and runs it through a cache of a specified size @@ -100,46 +105,47 @@ public: // better performance over just using the order in which they show up using // the default BEntryList iterator subclass - CachedEntryIterator(BEntryList *iterator, int32 numEntries, + CachedEntryIterator(BEntryList* iterator, int32 numEntries, bool sortInodes = false); // CachedEntryIterator does not get to own the virtual ~CachedEntryIterator(); - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false); + virtual status_t GetNextRef(entry_ref* ref); + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX); virtual status_t Rewind(); virtual int32 CountEntries(); - virtual void SetTo(BEntryList *iterator); + virtual void SetTo(BEntryList* iterator); // CachedEntryIterator does not get to own the private: - static int _CompareInodes(const dirent *ent1, const dirent *ent2); + static int _CompareInodes(const dirent* ent1, const dirent* ent2); - BEntryList *fIterator; - entry_ref *fEntryRefBuffer; + BEntryList* fIterator; + entry_ref* fEntryRefBuffer; int32 fCacheSize; int32 fNumEntries; int32 fIndex; - dirent *fDirentBuffer; - dirent *fCurrentDirent; + dirent* fDirentBuffer; + dirent* fCurrentDirent; bool fSortInodes; - BObjectList *fSortedList; + BObjectList* fSortedList; - BEntry *fEntryBuffer; + BEntry* fEntryBuffer; }; + class DirectoryEntryList : public EntryListBase { public: DirectoryEntryList(const BDirectory &); - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false); + virtual status_t GetNextRef(entry_ref* ref); + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX); virtual status_t Rewind(); @@ -149,6 +155,7 @@ private: BDirectory fDir; }; + class CachedDirectoryEntryList : public CachedEntryIterator { // this class is to work around not being able to delete // BEntryList polymorfically - need to have a special @@ -161,6 +168,7 @@ private: BDirectory fDir; }; + class EntryIteratorList : public EntryListBase { // This wraps up several BEntryList style iterators and // iterates them all, going from one to the other as it finishes @@ -169,12 +177,12 @@ public: EntryIteratorList(); virtual ~EntryIteratorList(); - void AddItem(BEntryList *); + void AddItem(BEntryList*); // list gets to own walkers - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false); + virtual status_t GetNextRef(entry_ref* ref); + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX); virtual status_t Rewind(); @@ -185,10 +193,11 @@ protected: int32 fCurrentIndex; }; + class CachedEntryIteratorList : public CachedEntryIterator { public: CachedEntryIteratorList(bool sortInodes = true); - void AddItem(BEntryList *list); + void AddItem(BEntryList* list); protected: EntryIteratorList fIteratorList; diff --git a/src/kits/tracker/FBCPadding.cpp b/src/kits/tracker/FBCPadding.cpp index fcc2a3c45a..9b1ac457cb 100644 --- a/src/kits/tracker/FBCPadding.cpp +++ b/src/kits/tracker/FBCPadding.cpp @@ -32,11 +32,13 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include "FilePanelPriv.h" #include "RecentItems.h" + // FBC fluff, stick it here to not pollute real .cpp files void BRecentItemsList::_r1() {} @@ -100,10 +102,10 @@ __10BFilePanel15file_panel_modeP10BMessengerP9entry_refUlbP8BMessageP10BRefFilte #elif __MWERKS__ __ct__10BFilePanelF15file_panel_modeP10BMessengerP9entry_refUlbP8BMessageP10BRefFilterbb #endif -(void *self, - file_panel_mode mode, BMessenger *target, - entry_ref *ref, uint32 nodeFlavors, bool multipleSelection, - BMessage *message, BRefFilter *filter, bool modal, +(void* self, + file_panel_mode mode, BMessenger* target, + entry_ref* ref, uint32 nodeFlavors, bool multipleSelection, + BMessage* message, BRefFilter* filter, bool modal, bool hideWhenDone) { return new (self) BFilePanel(mode, target, ref, nodeFlavors, @@ -117,7 +119,7 @@ SetPanelDirectory__10BFilePanelP10BDirectory #elif __MWERKS__ SetPanelDirectory__10BFilePanelFP10BDirectory #endif -(BFilePanel *self, BDirectory *d) +(BFilePanel* self, BDirectory* d) { self->SetPanelDirectory(d); } @@ -128,7 +130,7 @@ SetPanelDirectory__10BFilePanelP6BEntry #elif __MWERKS__ SetPanelDirectory__10BFilePanelFP6BEntry #endif -(BFilePanel *self, BEntry *e) +(BFilePanel* self, BEntry* e) { self->SetPanelDirectory(e); } @@ -139,7 +141,7 @@ SetPanelDirectory__10BFilePanelP9entry_ref #elif __MWERKS__ SetPanelDirectory__10BFilePanelFP9entry_ref #endif -(BFilePanel *self, entry_ref *r) +(BFilePanel* self, entry_ref* r) { self->SetPanelDirectory(r); } diff --git a/src/kits/tracker/FSClipboard.cpp b/src/kits/tracker/FSClipboard.cpp index 4921922fdc..f20f7b188a 100644 --- a/src/kits/tracker/FSClipboard.cpp +++ b/src/kits/tracker/FSClipboard.cpp @@ -44,11 +44,11 @@ All rights reserved. // prototypes -static void MakeNodeFromName(node_ref *node, char *name); -static inline void MakeRefName(char *refName, const node_ref *node); -static inline void MakeModeName(char *modeName, const node_ref *node); -static inline void MakeModeNameFromRefName(char *modeName, char *refName); -static inline bool CompareModeAndRefName(const char *modeName, const char *refName); +static void MakeNodeFromName(node_ref* node, char* name); +static inline void MakeRefName(char* refName, const node_ref* node); +static inline void MakeModeName(char* modeName, const node_ref* node); +static inline void MakeModeNameFromRefName(char* modeName, char* refName); +static inline bool CompareModeAndRefName(const char* modeName, const char* refName); /* static bool @@ -59,39 +59,39 @@ FSClipboardCheckIntegrity() */ static void -MakeNodeFromName(node_ref *node, char *name) +MakeNodeFromName(node_ref* node, char* name) { - char *nodeString = strchr(name, '_'); + char* nodeString = strchr(name, '_'); if (nodeString != NULL) { - node->node = strtoll(nodeString + 1, (char **)NULL, 10); + node->node = strtoll(nodeString + 1, (char**)NULL, 10); node->device = atoi(name + 1); } } static inline void -MakeRefName(char *refName, const node_ref *node) +MakeRefName(char* refName, const node_ref* node) { sprintf(refName, "r%ld_%Ld", node->device, node->node); } static inline void -MakeModeName(char *modeName, const node_ref *node) +MakeModeName(char* modeName, const node_ref* node) { sprintf(modeName, "m%ld_%Ld", node->device, node->node); } static inline void -MakeModeName(char *name) +MakeModeName(char* name) { name[0] = 'm'; } static inline void -MakeModeNameFromRefName(char *modeName, char *refName) +MakeModeNameFromRefName(char* modeName, char* refName) { strcpy(modeName, refName); modeName[0] = 'm'; @@ -99,7 +99,7 @@ MakeModeNameFromRefName(char *modeName, char *refName) static inline bool -CompareModeAndRefName(const char *modeName, const char *refName) +CompareModeAndRefName(const char* modeName, const char* refName) { return !strcmp(refName + 1, modeName + 1); } @@ -117,16 +117,16 @@ FSClipboardHasRefs() bool result = false; if (be_clipboard->Lock()) { - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { #ifdef B_BEOS_VERSION_DANO const #endif - char *refName; + char* refName; #ifdef B_BEOS_VERSION_DANO const #endif - char *modeName; + char* modeName; uint32 type; int32 count; if (clip->GetInfo(B_REF_TYPE, 0, &refName, &type, &count) == B_OK @@ -142,8 +142,8 @@ FSClipboardHasRefs() void FSClipboardStartWatch(BMessenger target) { - if (dynamic_cast(be_app) != NULL) - ((TTracker *)be_app)->ClipboardRefsWatcher()->AddToNotifyList(target); + if (dynamic_cast(be_app) != NULL) + ((TTracker*)be_app)->ClipboardRefsWatcher()->AddToNotifyList(target); else { // this code is used by external apps using objects using FSClipboard functions // i.e: applications using FilePanel @@ -160,8 +160,8 @@ FSClipboardStartWatch(BMessenger target) void FSClipboardStopWatch(BMessenger target) { - if (dynamic_cast(be_app) != NULL) - ((TTracker *)be_app)->ClipboardRefsWatcher()->AddToNotifyList(target); + if (dynamic_cast(be_app) != NULL) + ((TTracker*)be_app)->ClipboardRefsWatcher()->AddToNotifyList(target); else { // this code is used by external apps using objects using FSClipboard functions // i.e: applications using FilePanel @@ -195,7 +195,7 @@ FSClipboardClear() */ uint32 -FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode, +FSClipboardAddPoses(const node_ref* directory, PoseList* list, uint32 moveMode, bool clearClipboard) { uint32 refsAdded = 0; @@ -216,13 +216,13 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode, if (clearClipboard) be_clipboard->Clear(); - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { for (int32 index = 0; index < listCount; index++) { char refName[64], modeName[64]; - BPose *pose = (BPose *)list->ItemAt(index); - Model *model = pose->TargetModel(); - const node_ref *node = model->NodeRef(); + BPose* pose = (BPose*)list->ItemAt(index); + Model* model = pose->TargetModel(); + const node_ref* node = model->NodeRef(); BEntry entry; model->GetEntry(&entry); @@ -294,7 +294,7 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode, } } be_clipboard->Commit(); - } + } be_clipboard->Unlock(); BMessenger(kTrackerSignature).SendMessage(&updateMessage); @@ -305,7 +305,7 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode, uint32 -FSClipboardRemovePoses(const node_ref *directory, PoseList *list) +FSClipboardRemovePoses(const node_ref* directory, PoseList* list) { if (!be_clipboard->Lock()) return 0; @@ -321,13 +321,13 @@ FSClipboardRemovePoses(const node_ref *directory, PoseList *list) uint32 refsRemoved = 0; - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { int32 listCount = list->CountItems(); for (int32 index = 0; index < listCount; index++) { char refName[64], modeName[64]; - BPose *pose = (BPose *)list->ItemAt(index); + BPose* pose = (BPose*)list->ItemAt(index); clipNode.node = *pose->TargetModel()->NodeRef(); MakeRefName(refName, &clipNode.node); @@ -355,35 +355,35 @@ FSClipboardRemovePoses(const node_ref *directory, PoseList *list) */ bool -FSClipboardPaste(Model *model, uint32 linksMode) +FSClipboardPaste(Model* model, uint32 linksMode) { if (!FSClipboardHasRefs()) return false; BMessenger tracker(kTrackerSignature); - node_ref *destNodeRef = (node_ref *)model->NodeRef(); + node_ref* destNodeRef = (node_ref*)model->NodeRef(); // these will be passed to the asynchronous copy/move process - BObjectList *moveList = new BObjectList(0, true); - BObjectList *copyList = new BObjectList(0, true); + BObjectList* moveList = new BObjectList(0, true); + BObjectList* copyList = new BObjectList(0, true); if ((be_clipboard->Lock())) { - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { char modeName[64]; uint32 moveMode = 0; - BMessage *updateMessage = NULL; + BMessage* updateMessage = NULL; node_ref updateNodeRef; updateNodeRef.device = -1; - char *refName; + char* refName; type_code type; int32 count; for (int32 index = 0; clip->GetInfo(B_REF_TYPE, index, #ifdef B_BEOS_VERSION_DANO - (const char **) + (const char**) #endif &refName, &type, &count) == B_OK; index++) { entry_ref ref; @@ -404,12 +404,12 @@ FSClipboardPaste(Model *model, uint32 linksMode) updateMessage = new BMessage(kFSClipboardChanges); updateMessage->AddInt32("device", updateNodeRef.device); - updateMessage->AddInt64("directory", updateNodeRef.node); + updateMessage->AddInt64("directory", updateNodeRef.node); } // we need this data later on MakeModeNameFromRefName(modeName, refName); - if (!linksMode && clip->FindInt32(modeName, (int32 *)&moveMode) != B_OK) + if (!linksMode && clip->FindInt32(modeName, (int32*)&moveMode) != B_OK) continue; BEntry entry(&ref); @@ -474,7 +474,7 @@ FSClipboardPaste(Model *model, uint32 linksMode) B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); alert->Go(); - okToMove = false; + okToMove = false; } BEntry entry; @@ -513,12 +513,10 @@ FSClipboardPaste(Model *model, uint32 linksMode) } -/** Seek node in clipboard, if found return it's moveMode - * else return 0 - */ - +// Seek node in clipboard, if found return it's moveMode +// else return 0 uint32 -FSClipboardFindNodeMode(Model *model, bool autoLock, bool updateRefIfNeeded) +FSClipboardFindNodeMode(Model* model, bool autoLock, bool updateRefIfNeeded) { int32 moveMode = 0; if (autoLock) { @@ -528,13 +526,13 @@ FSClipboardFindNodeMode(Model *model, bool autoLock, bool updateRefIfNeeded) bool remove = false; bool change = false; - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { - const node_ref *node = model->NodeRef(); + const node_ref* node = model->NodeRef(); char modeName[64]; MakeModeName(modeName, node); if ((clip->FindInt32(modeName, &moveMode) == B_OK)) { - const entry_ref *ref = model->EntryRef(); + const entry_ref* ref = model->EntryRef(); entry_ref clipref; char refName[64]; MakeRefName(refName, node); @@ -573,15 +571,15 @@ FSClipboardFindNodeMode(Model *model, bool autoLock, bool updateRefIfNeeded) void -FSClipboardRemove(Model *model) +FSClipboardRemove(Model* model) { BMessenger messenger(kTrackerSignature); if (messenger.IsValid()) { - BMessage *report = new BMessage(kFSClipboardChanges); + BMessage* report = new BMessage(kFSClipboardChanges); TClipboardNodeRef tcnode; tcnode.node = *model->NodeRef(); tcnode.moveMode = kDelete; - const entry_ref *ref = model->EntryRef(); + const entry_ref* ref = model->EntryRef(); report->AddInt32("device", ref->device); report->AddInt64("directory", ref->directory); report->AddBool("clearClipboard", false); @@ -618,7 +616,7 @@ BClipboardRefsWatcher::AddToNotifyList(BMessenger target) if (Lock()) { // add the messenger if it's not already in the list // ToDo: why do we have to care about that? - BMessenger *messenger; + BMessenger* messenger; bool found = false; for (int32 index = 0;(messenger = fNotifyList.ItemAt(index)) != NULL; index++) { @@ -639,7 +637,7 @@ void BClipboardRefsWatcher::RemoveFromNotifyList(BMessenger target) { if (Lock()) { - BMessenger *messenger; + BMessenger* messenger; for (int32 index = 0;(messenger = fNotifyList.ItemAt(index)) != NULL; index++) { if (*messenger == target) { @@ -653,7 +651,7 @@ BClipboardRefsWatcher::RemoveFromNotifyList(BMessenger target) void -BClipboardRefsWatcher::AddNode(const node_ref *node) +BClipboardRefsWatcher::AddNode(const node_ref* node) { TTracker::WatchNode(node, B_WATCH_NAME, this); fRefsInClipboard = true; @@ -661,7 +659,7 @@ BClipboardRefsWatcher::AddNode(const node_ref *node) void -BClipboardRefsWatcher::RemoveNode(node_ref *node, bool removeFromClipboard) +BClipboardRefsWatcher::RemoveNode(node_ref* node, bool removeFromClipboard) { watch_node(node, B_STOP_WATCHING, this); @@ -669,7 +667,7 @@ BClipboardRefsWatcher::RemoveNode(node_ref *node, bool removeFromClipboard) return; if (be_clipboard->Lock()) { - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { char name[64]; MakeRefName(name, node); @@ -690,18 +688,18 @@ BClipboardRefsWatcher::RemoveNodesByDevice(dev_t device) if (!be_clipboard->Lock()) return; - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { char deviceName[6]; sprintf(deviceName, "r%ld_", device); int32 index = 0; - char *refName; + char* refName; type_code type; int32 count; while (clip->GetInfo(B_REF_TYPE, index, #ifdef B_BEOS_VERSION_DANO - (const char **) + (const char**) #endif &refName, &type, &count) == B_OK) { if (!strncmp(deviceName, refName, strlen(deviceName))) { @@ -722,12 +720,12 @@ BClipboardRefsWatcher::RemoveNodesByDevice(dev_t device) void -BClipboardRefsWatcher::UpdateNode(node_ref *node, entry_ref *ref) +BClipboardRefsWatcher::UpdateNode(node_ref* node, entry_ref* ref) { if (!be_clipboard->Lock()) return; - BMessage *clip = be_clipboard->Data(); + BMessage* clip = be_clipboard->Data(); if (clip != NULL) { char name[64]; MakeRefName(name, node); @@ -761,27 +759,27 @@ BClipboardRefsWatcher::Clear() } } -/* -void -BClipboardRefsWatcher::UpdatePoseViews(bool clearClipboard, const node_ref *node) -{ - BMessage message(kFSClipboardChanges); - message.AddInt32("device", node->device); - message.AddInt64("directory", node->node); - message.AddBool("clearClipboard", clearClipboard); - if (Lock()) { - int32 items = fNotifyList.CountItems(); - for (int32 i = 0;i < items;i++) { - fNotifyList.ItemAt(i)->SendMessage(&message); - } - Unlock(); - } -} -*/ +//void +//BClipboardRefsWatcher::UpdatePoseViews(bool clearClipboard, const node_ref* node) +//{ +// BMessage message(kFSClipboardChanges); +// message.AddInt32("device", node->device); +// message.AddInt64("directory", node->node); +// message.AddBool("clearClipboard", clearClipboard); +// +// if (Lock()) { +// int32 items = fNotifyList.CountItems(); +// for (int32 i = 0;i < items;i++) { +// fNotifyList.ItemAt(i)->SendMessage(&message); +// } +// Unlock(); +// } +//} + void -BClipboardRefsWatcher::UpdatePoseViews(BMessage *reportMessage) +BClipboardRefsWatcher::UpdatePoseViews(BMessage* reportMessage) { if (Lock()) { // check if it was cleared, if so clear watching @@ -796,7 +794,7 @@ BClipboardRefsWatcher::UpdatePoseViews(BMessage *reportMessage) // move or copy: start watching node_ref // remove: stop watching node_ref int32 index = 0; - TClipboardNodeRef *tcnode = NULL; + TClipboardNodeRef* tcnode = NULL; ssize_t size; while (reportMessage->FindData("tcnode", T_CLIPBOARD_NODE, index, (const void**)&tcnode, &size) == B_OK) { if (tcnode->moveMode == kDelete) { @@ -820,7 +818,7 @@ BClipboardRefsWatcher::UpdatePoseViews(BMessage *reportMessage) void -BClipboardRefsWatcher::MessageReceived(BMessage *message) +BClipboardRefsWatcher::MessageReceived(BMessage* message) { if (message->what == B_CLIPBOARD_CHANGED && fRefsInClipboard) { if (!(fRefsInClipboard = FSClipboardHasRefs())) @@ -831,13 +829,13 @@ BClipboardRefsWatcher::MessageReceived(BMessage *message) return; } - switch (message->FindInt32("opcode")) { + switch (message->FindInt32("opcode")) { case B_ENTRY_MOVED: { ino_t toDir; ino_t fromDir; node_ref node; - const char *name = NULL; + const char* name = NULL; message->FindInt64("from directory", &fromDir); message->FindInt64("to directory", &toDir); message->FindInt64("node", &node.node); @@ -846,7 +844,7 @@ BClipboardRefsWatcher::MessageReceived(BMessage *message) entry_ref ref(node.device, toDir, name); UpdateNode(&node, &ref); break; - } + } case B_DEVICE_UNMOUNTED: { diff --git a/src/kits/tracker/FSClipboard.h b/src/kits/tracker/FSClipboard.h index bdc4b85e7a..acb40126c1 100644 --- a/src/kits/tracker/FSClipboard.h +++ b/src/kits/tracker/FSClipboard.h @@ -31,10 +31,10 @@ 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. */ - #ifndef FS_CLIPBOARD_H #define FS_CLIPBOARD_H + #include #include "Model.h" #include "ObjectList.h" @@ -50,6 +50,7 @@ typedef struct { } TClipboardNodeRef; const int32 T_CLIPBOARD_NODE = 'TCNR'; + class BClipboardRefsWatcher : public BLooper { public: BClipboardRefsWatcher(); @@ -57,16 +58,16 @@ class BClipboardRefsWatcher : public BLooper { void AddToNotifyList(BMessenger target); void RemoveFromNotifyList(BMessenger target); - void AddNode(const node_ref *node); - void RemoveNode(node_ref *node, bool removeFromClipboard = false); + void AddNode(const node_ref* node); + void RemoveNode(node_ref* node, bool removeFromClipboard = false); void RemoveNodesByDevice(dev_t device); - void UpdateNode(node_ref *node, entry_ref *ref); + void UpdateNode(node_ref* node, entry_ref* ref); void Clear(); -// void UpdatePoseViews(bool clearClipboard, const node_ref *node); - void UpdatePoseViews(BMessage *reportMessage); +// void UpdatePoseViews(bool clearClipboard, const node_ref* node); + void UpdatePoseViews(BMessage* reportMessage); protected: - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); private: bool fRefsInClipboard; @@ -86,10 +87,10 @@ void FSClipboardStartWatch(BMessenger target); void FSClipboardStopWatch(BMessenger target); void FSClipboardClear(); -uint32 FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode, bool clearClipboard); -uint32 FSClipboardRemovePoses(const node_ref *directory, PoseList *list); -bool FSClipboardPaste(Model *model, uint32 linksMode = 0); -void FSClipboardRemove(Model *model); -uint32 FSClipboardFindNodeMode(Model *model, bool autoLock, bool updateRefIfNeeded); +uint32 FSClipboardAddPoses(const node_ref* directory, PoseList* list, uint32 moveMode, bool clearClipboard); +uint32 FSClipboardRemovePoses(const node_ref* directory, PoseList* list); +bool FSClipboardPaste(Model* model, uint32 linksMode = 0); +void FSClipboardRemove(Model* model); +uint32 FSClipboardFindNodeMode(Model* model, bool autoLock, bool updateRefIfNeeded); -#endif /* FS_CLIPBOARD_H */ +#endif // FS_CLIPBOARD_H diff --git a/src/kits/tracker/FSUndoRedo.cpp b/src/kits/tracker/FSUndoRedo.cpp index a3fe28e9e8..cf6f895803 100644 --- a/src/kits/tracker/FSUndoRedo.cpp +++ b/src/kits/tracker/FSUndoRedo.cpp @@ -20,8 +20,8 @@ class UndoItem { virtual status_t Undo() = 0; virtual status_t Redo() = 0; - virtual void UpdateEntry(BEntry */*entry*/, const char */*name*/) {} - // updates the name of the target from the source entry "entry" + virtual void UpdateEntry(BEntry* /*entry*/, const char* /*name*/) {} + // updates the name of the target from the source entry "entry" }; static BObjectList sUndoList, sRedoList; @@ -29,13 +29,13 @@ static BLocker sLock("undo"); class UndoItemCopy : public UndoItem { public: - UndoItemCopy(BObjectList *sourceList, BDirectory &target, - BList *pointList, uint32 moveMode); + UndoItemCopy(BObjectList* sourceList, BDirectory &target, + BList* pointList, uint32 moveMode); virtual ~UndoItemCopy(); virtual status_t Undo(); virtual status_t Redo(); - virtual void UpdateEntry(BEntry *entry, const char *name); + virtual void UpdateEntry(BEntry* entry, const char* name); private: BObjectList fSourceList; @@ -44,12 +44,13 @@ class UndoItemCopy : public UndoItem { uint32 fMoveMode; }; + class UndoItemMove : public UndoItem { public: /** source - list of file(s) that were moved. Assumes ownership. * origfolder - location it was moved from */ - UndoItemMove(BObjectList *sourceList, BDirectory &target, BList *pointList); + UndoItemMove(BObjectList* sourceList, BDirectory &target, BList* pointList); virtual ~UndoItemMove(); virtual status_t Undo(); @@ -60,6 +61,7 @@ class UndoItemMove : public UndoItem { entry_ref fSourceRef, fTargetRef; }; + class UndoItemFolder : public UndoItem { public: UndoItemFolder(const entry_ref &ref); @@ -77,22 +79,24 @@ class UndoItemFolder : public UndoItem { entry_ref fRef; }; + class UndoItemRename : public UndoItem { public: UndoItemRename(const entry_ref &origRef, const entry_ref &ref); - UndoItemRename(const BEntry &entry, const char *newName); + UndoItemRename(const BEntry &entry, const char* newName); virtual ~UndoItemRename(); virtual status_t Undo(); virtual status_t Redo(); private: - entry_ref fRef, fOrigRef; + entry_ref fRef, fOrigRef; }; + class UndoItemRenameVolume : public UndoItem { public: - UndoItemRenameVolume(BVolume &volume, const char *newName); + UndoItemRenameVolume(BVolume &volume, const char* newName); virtual ~UndoItemRenameVolume(); virtual status_t Undo(); @@ -115,18 +119,18 @@ ChangeListSource(BObjectList &list, BEntry &entry) return B_ERROR; for (int32 index = 0; index < list.CountItems(); index++) { - entry_ref *ref = list.ItemAt(index); + entry_ref* ref = list.ItemAt(index); ref->device = source.device; ref->directory = source.node; } - return B_OK; + return B_OK; } static void -AddUndoItem(UndoItem *item) +AddUndoItem(UndoItem* item) { BAutolock locker(sLock); @@ -149,15 +153,15 @@ Undo::~Undo() } -void -Undo::UpdateEntry(BEntry *entry, const char *destName) +void +Undo::UpdateEntry(BEntry* entry, const char* destName) { if (fUndo != NULL) fUndo->UpdateEntry(entry, destName); } -void +void Undo::Remove() { delete fUndo; @@ -165,8 +169,8 @@ Undo::Remove() } -MoveCopyUndo::MoveCopyUndo(BObjectList *sourceList, BDirectory &dest, - BList *pointList, uint32 moveMode) +MoveCopyUndo::MoveCopyUndo(BObjectList* sourceList, BDirectory &dest, + BList* pointList, uint32 moveMode) { if (moveMode == kMoveSelectionTo) fUndo = new UndoItemMove(sourceList, dest, pointList); @@ -181,13 +185,13 @@ NewFolderUndo::NewFolderUndo(const entry_ref &ref) } -RenameUndo::RenameUndo(BEntry &entry, const char *newName) +RenameUndo::RenameUndo(BEntry &entry, const char* newName) { fUndo = new UndoItemRename(entry, newName); } -RenameVolumeUndo::RenameVolumeUndo(BVolume &volume, const char *newName) +RenameVolumeUndo::RenameVolumeUndo(BVolume &volume, const char* newName) { fUndo = new UndoItemRenameVolume(volume, newName); } @@ -196,8 +200,8 @@ RenameVolumeUndo::RenameVolumeUndo(BVolume &volume, const char *newName) // #pragma mark - -UndoItemCopy::UndoItemCopy(BObjectList *sourceList, BDirectory &target, - BList */*pointList*/, uint32 moveMode) +UndoItemCopy::UndoItemCopy(BObjectList* sourceList, BDirectory &target, + BList* /*pointList*/, uint32 moveMode) : fSourceList(*sourceList), fTargetList(*sourceList), @@ -239,15 +243,15 @@ UndoItemCopy::Redo() } -void -UndoItemCopy::UpdateEntry(BEntry *entry, const char *name) +void +UndoItemCopy::UpdateEntry(BEntry* entry, const char* name) { entry_ref changedRef; if (entry->GetRef(&changedRef) != B_OK) return; for (int32 index = 0; index < fSourceList.CountItems(); index++) { - entry_ref *ref = fSourceList.ItemAt(index); + entry_ref* ref = fSourceList.ItemAt(index); if (changedRef != *ref) continue; @@ -260,8 +264,8 @@ UndoItemCopy::UpdateEntry(BEntry *entry, const char *name) // #pragma mark - -UndoItemMove::UndoItemMove(BObjectList *sourceList, BDirectory &target, - BList */*pointList*/) +UndoItemMove::UndoItemMove(BObjectList* sourceList, BDirectory &target, + BList* /*pointList*/) : fSourceList(*sourceList) { @@ -284,7 +288,7 @@ UndoItemMove::~UndoItemMove() status_t UndoItemMove::Undo() { - BObjectList *list = new BObjectList(fSourceList); + BObjectList* list = new BObjectList(fSourceList); BEntry entry(&fTargetRef); ChangeListSource(*list, entry); @@ -347,7 +351,7 @@ UndoItemRename::UndoItemRename(const entry_ref &origRef, const entry_ref &ref) } -UndoItemRename::UndoItemRename(const BEntry &entry, const char *newName) +UndoItemRename::UndoItemRename(const BEntry &entry, const char* newName) { entry.GetRef(&fOrigRef); @@ -380,12 +384,12 @@ UndoItemRename::Redo() // #pragma mark - -UndoItemRenameVolume::UndoItemRenameVolume(BVolume &volume, const char *newName) +UndoItemRenameVolume::UndoItemRenameVolume(BVolume &volume, const char* newName) : fVolume(volume), fNewName(newName) { - char *buffer = fOldName.LockBuffer(B_FILE_NAME_LENGTH); + char* buffer = fOldName.LockBuffer(B_FILE_NAME_LENGTH); if (buffer != NULL) { fVolume.GetName(buffer); fOldName.UnlockBuffer(); @@ -420,7 +424,7 @@ FSUndo() { BAutolock locker(sLock); - UndoItem *undoItem = sUndoList.FirstItem(); + UndoItem* undoItem = sUndoList.FirstItem(); if (undoItem == NULL) return; @@ -441,7 +445,7 @@ FSRedo() { BAutolock locker(sLock); - UndoItem *undoItem = sRedoList.FirstItem(); + UndoItem* undoItem = sRedoList.FirstItem(); if (undoItem == NULL) return; diff --git a/src/kits/tracker/FSUndoRedo.h b/src/kits/tracker/FSUndoRedo.h index 80c539402e..5c91203ebe 100644 --- a/src/kits/tracker/FSUndoRedo.h +++ b/src/kits/tracker/FSUndoRedo.h @@ -1,9 +1,11 @@ #ifndef _FS_UNDO_REDO_H #define _FS_UNDO_REDO_H + #include "ObjectList.h" #include + namespace BPrivate { class UndoItem; @@ -11,55 +13,63 @@ class UndoItem; class Undo { public: ~Undo(); - void UpdateEntry(BEntry *entry, const char *destName); + void UpdateEntry(BEntry* entry, const char* destName); void Remove(); protected: - UndoItem *fUndo; + UndoItem* fUndo; }; + class MoveCopyUndo : public Undo { public: - MoveCopyUndo(BObjectList *sourceList, BDirectory &dest, - BList *pointList, uint32 moveMode); + MoveCopyUndo(BObjectList* sourceList, BDirectory &dest, + BList* pointList, uint32 moveMode); }; + class NewFolderUndo : public Undo { public: NewFolderUndo(const entry_ref &ref); }; + class RenameUndo : public Undo { public: - RenameUndo(BEntry &entry, const char *newName); + RenameUndo(BEntry &entry, const char* newName); }; + class RenameVolumeUndo : public Undo { public: - RenameVolumeUndo(BVolume &volume, const char *newName); + RenameVolumeUndo(BVolume &volume, const char* newName); }; + static inline bool FSIsUndoMoveMode(uint32 moveMode) { return (moveMode & '\xff\0\0\0') == 'U\0\0\0'; } + static inline uint32 FSUndoMoveMode(uint32 moveMode) { return (moveMode & ~'\xff\0\0\0') | 'U\0\0\0'; } + static inline uint32 FSMoveMode(uint32 moveMode) { return (moveMode & ~'\xff\0\0\0') | 'T\0\0\0'; } + extern void FSUndo(); extern void FSRedo(); } // namespace BPrivate -#endif /* _FS_UNDO_REDO_H */ +#endif // _FS_UNDO_REDO_H diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp index fb4e9d2fd0..a5170c3748 100644 --- a/src/kits/tracker/FSUtils.cpp +++ b/src/kits/tracker/FSUtils.cpp @@ -34,15 +34,16 @@ respective holders. All rights reserved. // Tracker file system calls. -// Note - APIs/code in FSUtils.h and FSUtils.cpp is slated for a major cleanup -// -- in other words, you will find a lot of ugly cruft in here +// APIs/code in FSUtils.h and FSUtils.cpp is slated for a major cleanup -- in +// other words, you will find a lot of ugly cruft in here // ToDo: // Move most of preflight error checks to the Model level and only keep those -// that have to do with size, reading/writing and name collisions. +// that have to do with size, reading/writing and name collisions. // Get rid of all the BList based APIs, use BObjectLists. // Clean up the error handling, push most of the user interaction out of the -// low level FS calls. +// low level FS calls. + #include #include @@ -105,36 +106,36 @@ namespace BPrivate { #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "FSUtils" -static status_t FSDeleteFolder(BEntry *, CopyLoopControl *, bool updateStatus, +static status_t FSDeleteFolder(BEntry*, CopyLoopControl*, bool updateStatus, bool deleteTopDir = true, bool upateFileNameInStatus = false); -static status_t MoveEntryToTrash(BEntry *, BPoint *, Undo &undo); -static void LowLevelCopy(BEntry *, StatStruct *, BDirectory *, char *destName, - CopyLoopControl *, BPoint *); -status_t DuplicateTask(BObjectList *srcList); -static status_t MoveTask(BObjectList *, BEntry *, BList *, uint32); -static status_t _DeleteTask(BObjectList *, bool); -static status_t _RestoreTask(BObjectList *); +static status_t MoveEntryToTrash(BEntry*, BPoint*, Undo &undo); +static void LowLevelCopy(BEntry*, StatStruct*, BDirectory*, char* destName, + CopyLoopControl*, BPoint*); +status_t DuplicateTask(BObjectList* srcList); +static status_t MoveTask(BObjectList*, BEntry*, BList*, uint32); +static status_t _DeleteTask(BObjectList*, bool); +static status_t _RestoreTask(BObjectList*); status_t CalcItemsAndSize(CopyLoopControl* loopControl, - BObjectList *refList, ssize_t blockSize, int32 *totalCount, - off_t *totalSize); -status_t MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, - uint32 moveMode, const char *newName, Undo &undo, + BObjectList* refList, ssize_t blockSize, int32* totalCount, + off_t* totalSize); +status_t MoveItem(BEntry* entry, BDirectory* destDir, BPoint* loc, + uint32 moveMode, const char* newName, Undo &undo, CopyLoopControl* loopControl); -ConflictCheckResult PreFlightNameCheck(BObjectList *srcList, - const BDirectory *destDir, int32 *collisionCount, uint32 moveMode); -status_t CheckName(uint32 moveMode, const BEntry *srcEntry, - const BDirectory *destDir, bool multipleCollisions, ConflictCheckResult &); -void CopyAttributes(CopyLoopControl *control, BNode *srcNode, BNode* destNode, void *buffer, +ConflictCheckResult PreFlightNameCheck(BObjectList* srcList, + const BDirectory* destDir, int32* collisionCount, uint32 moveMode); +status_t CheckName(uint32 moveMode, const BEntry* srcEntry, + const BDirectory* destDir, bool multipleCollisions, ConflictCheckResult &); +void CopyAttributes(CopyLoopControl* control, BNode* srcNode, BNode* destNode, void* buffer, size_t bufsize); -void CopyPoseLocation(BNode *src, BNode *dest); -bool DirectoryMatchesOrContains(const BEntry *, directory_which); -bool DirectoryMatchesOrContains(const BEntry *, const char *additionalPath, +void CopyPoseLocation(BNode* src, BNode* dest); +bool DirectoryMatchesOrContains(const BEntry*, directory_which); +bool DirectoryMatchesOrContains(const BEntry*, const char* additionalPath, directory_which); -bool DirectoryMatches(const BEntry *, directory_which); -bool DirectoryMatches(const BEntry *, const char *additionalPath, +bool DirectoryMatches(const BEntry*, directory_which); +bool DirectoryMatches(const BEntry*, const char* additionalPath, directory_which); -status_t empty_trash(void *); +status_t empty_trash(void*); static const char* kDeleteConfirmationStr = @@ -182,12 +183,12 @@ static const char* kReplaceManyStr = static const char* kFindAlternativeStr = B_TRANSLATE_MARK("Would you like to find some other suitable application?"); -static const char *kFindApplicationStr = +static const char* kFindApplicationStr = B_TRANSLATE_MARK("Would you like to find a suitable application " "to open the file?"); // Skip these attributes when copying in Tracker -const char *kSkipAttributes[] = { +const char* kSkipAttributes[] = { kAttrPoseInfo, NULL }; @@ -337,7 +338,7 @@ TrackerCopyLoopControl::Init(int32 totalItems, off_t totalSize, bool -TrackerCopyLoopControl::FileError(const char *message, const char *name, +TrackerCopyLoopControl::FileError(const char* message, const char* name, status_t error, bool allowContinue) { BString buffer(message); @@ -360,7 +361,7 @@ TrackerCopyLoopControl::FileError(const char *message, const char *name, void -TrackerCopyLoopControl::UpdateStatus(const char *name, const entry_ref&, +TrackerCopyLoopControl::UpdateStatus(const char* name, const entry_ref&, int32 count, bool optional) { if (gStatusWindow != NULL) @@ -387,9 +388,9 @@ TrackerCopyLoopControl::CheckUserCanceled() bool -TrackerCopyLoopControl::SkipAttribute(const char *attributeName) +TrackerCopyLoopControl::SkipAttribute(const char* attributeName) { - for (const char **skipAttribute = kSkipAttributes; *skipAttribute; + for (const char** skipAttribute = kSkipAttributes; *skipAttribute; skipAttribute++) { if (strcmp(*skipAttribute, attributeName) == 0) return true; @@ -409,8 +410,8 @@ TrackerCopyLoopControl::SetSourceList(EntryList* list) // #pragma mark - -static BNode * -GetWritableNode(BEntry *entry, StatStruct *statBuf = 0) +static BNode* +GetWritableNode(BEntry* entry, StatStruct* statBuf = 0) { // utility call that works around the problem with BNodes not being // universally writeable @@ -433,7 +434,7 @@ GetWritableNode(BEntry *entry, StatStruct *statBuf = 0) bool -CheckDevicesEqual(const entry_ref *srcRef, const Model *targetModel) +CheckDevicesEqual(const entry_ref* srcRef, const Model* targetModel) { BDirectory destDir (targetModel->EntryRef()); struct stat deststat; @@ -444,7 +445,7 @@ CheckDevicesEqual(const entry_ref *srcRef, const Model *targetModel) status_t -FSSetPoseLocation(ino_t destDirInode, BNode *destNode, BPoint point) +FSSetPoseLocation(ino_t destDirInode, BNode* destNode, BPoint point) { PoseInfo poseInfo; poseInfo.fInvisible = false; @@ -462,7 +463,7 @@ FSSetPoseLocation(ino_t destDirInode, BNode *destNode, BPoint point) status_t -FSSetPoseLocation(BEntry *entry, BPoint point) +FSSetPoseLocation(BEntry* entry, BPoint point) { BNode node(entry); status_t result = node.InitCheck(); @@ -484,7 +485,7 @@ FSSetPoseLocation(BEntry *entry, BPoint point) bool -FSGetPoseLocation(const BNode *node, BPoint *point) +FSGetPoseLocation(const BNode* node, BPoint* point) { PoseInfo poseInfo; if (ReadAttr(node, kAttrPoseInfo, kAttrPoseInfoForeign, @@ -503,7 +504,7 @@ FSGetPoseLocation(const BNode *node, BPoint *point) static void SetUpPoseLocation(ino_t sourceParentIno, ino_t destParentIno, - const BNode *sourceNode, BNode *destNode, BPoint *loc) + const BNode* sourceNode, BNode* destNode, BPoint* loc) { BPoint point; if (!loc @@ -515,7 +516,7 @@ SetUpPoseLocation(ino_t sourceParentIno, ino_t destParentIno, loc = &point; // copy the originals location - if (loc && loc != (BPoint *)-1) { + if (loc && loc != (BPoint*)-1) { // loc of -1 is used when copying/moving into a window in list mode // where copying positions would not work // ToSo: @@ -526,8 +527,8 @@ SetUpPoseLocation(ino_t sourceParentIno, ino_t destParentIno, void -FSMoveToFolder(BObjectList *srcList, BEntry *destEntry, - uint32 moveMode, BList *pointList) +FSMoveToFolder(BObjectList* srcList, BEntry* destEntry, + uint32 moveMode, BList* pointList) { if (srcList->IsEmpty()) { delete srcList; @@ -542,16 +543,16 @@ FSMoveToFolder(BObjectList *srcList, BEntry *destEntry, void -FSDelete(entry_ref *ref, bool async, bool confirm) +FSDelete(entry_ref* ref, bool async, bool confirm) { - BObjectList *list = new BObjectList(1, true); + BObjectList* list = new BObjectList(1, true); list->AddItem(ref); FSDeleteRefList(list, async, confirm); } void -FSDeleteRefList(BObjectList *list, bool async, bool confirm) +FSDeleteRefList(BObjectList* list, bool async, bool confirm) { if (async) { LaunchInNewThread("DeleteTask", B_NORMAL_PRIORITY, _DeleteTask, list, @@ -562,7 +563,7 @@ FSDeleteRefList(BObjectList *list, bool async, bool confirm) void -FSRestoreRefList(BObjectList *list, bool async) +FSRestoreRefList(BObjectList* list, bool async) { if (async) { LaunchInNewThread("RestoreTask", B_NORMAL_PRIORITY, _RestoreTask, @@ -573,7 +574,7 @@ FSRestoreRefList(BObjectList *list, bool async) void -FSMoveToTrash(BObjectList *srcList, BList *pointList, bool async) +FSMoveToTrash(BObjectList* srcList, BList* pointList, bool async) { if (srcList->IsEmpty()) { delete srcList; @@ -583,14 +584,14 @@ FSMoveToTrash(BObjectList *srcList, BList *pointList, bool async) if (async) LaunchInNewThread("MoveTask", B_NORMAL_PRIORITY, MoveTask, srcList, - (BEntry *)0, pointList, kMoveSelectionTo); + (BEntry*)0, pointList, kMoveSelectionTo); else MoveTask(srcList, 0, pointList, kMoveSelectionTo); } static bool -IsDisksWindowIcon(BEntry *entry) +IsDisksWindowIcon(BEntry* entry) { BPath path; if (entry->InitCheck() != B_OK || entry->GetPath(&path) != B_OK) @@ -607,9 +608,9 @@ enum { bool -ConfirmChangeIfWellKnownDirectory(const BEntry *entry, - const char *ifYouDoAction, const char *toDoAction, - const char *toConfirmAction, bool dontAsk, int32 *confirmedAlready) +ConfirmChangeIfWellKnownDirectory(const BEntry* entry, + const char* ifYouDoAction, const char* toDoAction, + const char* toConfirmAction, bool dontAsk, int32* confirmedAlready) { // Don't let the user casually move/change important files/folders // @@ -701,7 +702,7 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, BString buttonLabel(toConfirmAction); - OverrideAlert *alert = new OverrideAlert("", warning.String(), + OverrideAlert* alert = new OverrideAlert("", warning.String(), buttonLabel.String(), (requireOverride ? B_SHIFT_KEY : 0), B_TRANSLATE("Cancel"), 0, NULL, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(1, B_ESCAPE); @@ -724,9 +725,9 @@ ConfirmChangeIfWellKnownDirectory(const BEntry *entry, static status_t InitCopy(CopyLoopControl* loopControl, uint32 moveMode, - BObjectList *srcList, BVolume *dstVol, BDirectory *destDir, - entry_ref *destRef, bool preflightNameCheck, bool needSizeCalculation, - int32 *collisionCount, ConflictCheckResult *preflightResult) + BObjectList* srcList, BVolume* dstVol, BDirectory* destDir, + entry_ref* destRef, bool preflightNameCheck, bool needSizeCalculation, + int32* collisionCount, ConflictCheckResult* preflightResult) { if (dstVol->IsReadOnly()) { BAlert* alert = new BAlert("", @@ -742,7 +743,7 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode, for (int32 index = 0; index < numItems; index++) { // we could check for this while iterating through items in each of // the copy loops, except it takes forever to call CalcItemsAndSize - BEntry entry((entry_ref *)srcList->ItemAt(index)); + BEntry entry((entry_ref*)srcList->ItemAt(index)); if (IsDisksWindowIcon(&entry)) { BString errorStr; if (moveMode == kCreateLink) { @@ -806,7 +807,7 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode, } // check for free space before starting copy - if ((totalSize + (4 * kKBSize)) >= dstVol->FreeBytes()) { + if ((totalSize + (4* kKBSize)) >= dstVol->FreeBytes()) { BAlert* alert = new BAlert("", B_TRANSLATE_NOCOLLECT(kNoFreeSpace), B_TRANSLATE("Cancel"), @@ -837,7 +838,7 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode, // ToDo: // get rid of this cruft bool -delete_ref(void *ref) +delete_ref(void* ref) { delete (entry_ref*)ref; return false; @@ -845,7 +846,7 @@ delete_ref(void *ref) bool -delete_point(void *point) +delete_point(void* point) { delete (BPoint*)point; return false; @@ -853,7 +854,7 @@ delete_point(void *point) static status_t -MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, +MoveTask(BObjectList* srcList, BEntry* destEntry, BList* pointList, uint32 moveMode) { ASSERT(!srcList->IsEmpty()); @@ -870,7 +871,7 @@ MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, bool destIsTrash = false; BDirectory destDir; - BDirectory *destDirToCheck = NULL; + BDirectory* destDirToCheck = NULL; bool needPreflightNameCheck = false; bool sourceIsReadOnly = volume.IsReadOnly(); volume.Unset(); @@ -945,7 +946,7 @@ MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, if (result == B_OK) { for (int32 i = 0; i < srcList->CountItems(); i++) { - BPoint *loc = (BPoint *)-1; + BPoint* loc = (BPoint*)-1; // a loc of -1 forces autoplacement, rather than copying the // position of the original node // TODO: @@ -955,7 +956,7 @@ MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, // location or other stuff. It should not be a job of the // copy-engine. - entry_ref *srcRef = srcList->ItemAt(i); + entry_ref* srcRef = srcList->ItemAt(i); if (moveMode == kDuplicateSelection) { BEntry entry(srcRef); @@ -992,7 +993,7 @@ MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, // are we moving item to trash? if (destIsTrash) { if (pointList) - loc = (BPoint *)pointList->ItemAt(i); + loc = (BPoint*)pointList->ItemAt(i); result = MoveEntryToTrash(&sourceEntry, loc, undo); if (result != B_OK) { @@ -1024,9 +1025,9 @@ MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, // get location to place this item if (pointList && moveMode != kCopySelectionTo) { - loc = (BPoint *)pointList->ItemAt(i); + loc = (BPoint*)pointList->ItemAt(i); - BNode *src_node = GetWritableNode(&sourceEntry); + BNode* src_node = GetWritableNode(&sourceEntry); if (src_node && src_node->InitCheck() == B_OK) { PoseInfo poseInfo; poseInfo.fInvisible = false; @@ -1063,22 +1064,22 @@ MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, class FailWithAlert { public: - static void FailOnError(status_t error, const char *string, - const char *name = NULL) + static void FailOnError(status_t error, const char* string, + const char* name = NULL) { if (error != B_OK) throw FailWithAlert(error, string, name); } - FailWithAlert(status_t error, const char *string, const char *name) + FailWithAlert(status_t error, const char* string, const char* name) : fString(string), fName(name), fError(error) { } - const char *fString; - const char *fName; + const char* fString; + const char* fName; status_t fError; }; @@ -1099,8 +1100,8 @@ class MoveError { void -CopyFile(BEntry *srcFile, StatStruct *srcStat, BDirectory *destDir, - CopyLoopControl *loopControl, BPoint *loc, bool makeOriginalName, +CopyFile(BEntry* srcFile, StatStruct* srcStat, BDirectory* destDir, + CopyLoopControl* loopControl, BPoint* loc, bool makeOriginalName, Undo &undo) { if (loopControl->SkipEntry(srcFile, true)) @@ -1173,7 +1174,7 @@ CopyFile(BEntry *srcFile, StatStruct *srcStat, BDirectory *destDir, #ifdef _SILENTLY_CORRECT_FILE_NAMES static bool -CreateFileSystemCompatibleName(const BDirectory *destDir, char *destName) +CreateFileSystemCompatibleName(const BDirectory* destDir, char* destName) { // Is it a FAT32 file system? (this is the only one we currently now about) @@ -1195,7 +1196,7 @@ CreateFileSystemCompatibleName(const BDirectory *destDir, char *destName) wasInvalid = true; } - char *invalid = destName; + char* invalid = destName; while ((invalid = strpbrk(invalid, "?<>\\:\"|*")) != NULL) { invalid[0] = '_'; wasInvalid = true; @@ -1210,8 +1211,8 @@ CreateFileSystemCompatibleName(const BDirectory *destDir, char *destName) static void -LowLevelCopy(BEntry *srcEntry, StatStruct *srcStat, BDirectory *destDir, - char *destName, CopyLoopControl *loopControl, BPoint *loc) +LowLevelCopy(BEntry* srcEntry, StatStruct* srcStat, BDirectory* destDir, + char* destName, CopyLoopControl* loopControl, BPoint* loc) { entry_ref ref; ThrowOnError(srcEntry->GetRef(&ref)); @@ -1248,8 +1249,8 @@ LowLevelCopy(BEntry *srcEntry, StatStruct *srcStat, BDirectory *destDir, BFile srcFile(srcEntry, O_RDONLY); ThrowOnInitCheckError(&srcFile); - const size_t kMinBufferSize = 1024 * 128; - const size_t kMaxBufferSize = 1024 * 1024; + const size_t kMinBufferSize = 1024* 128; + const size_t kMaxBufferSize = 1024* 1024; size_t bufsize = kMinBufferSize; if (bufsize < srcStat->st_size) { @@ -1259,7 +1260,7 @@ LowLevelCopy(BEntry *srcEntry, StatStruct *srcStat, BDirectory *destDir, size_t freesize = static_cast( (sinfo.max_pages - sinfo.used_pages) * B_PAGE_SIZE); bufsize = freesize / 4; // take 1/4 of RAM max - bufsize -= bufsize % (16 * 1024); // Round to 16 KB boundaries + bufsize -= bufsize % (16* 1024); // Round to 16 KB boundaries if (bufsize < kMinBufferSize) // at least kMinBufferSize bufsize = kMinBufferSize; else if (bufsize > kMaxBufferSize) // no more than kMaxBufferSize @@ -1283,7 +1284,7 @@ LowLevelCopy(BEntry *srcEntry, StatStruct *srcStat, BDirectory *destDir, SetUpPoseLocation(ref.directory, destNodeRef.node, &srcFile, &destFile, loc); - char *buffer = new char[bufsize]; + char* buffer = new char[bufsize]; try { // copy data portion of file while (true) { @@ -1303,7 +1304,7 @@ LowLevelCopy(BEntry *srcEntry, StatStruct *srcStat, BDirectory *destDir, if (bytes > 0) { ssize_t updateBytes = 0; - if (bytes > 32 * 1024) { + if (bytes > 32* 1024) { // when copying large chunks, update after read and after // write to get better update granularity updateBytes = bytes / 2; @@ -1354,8 +1355,8 @@ LowLevelCopy(BEntry *srcEntry, StatStruct *srcStat, BDirectory *destDir, void -CopyAttributes(CopyLoopControl *control, BNode *srcNode, BNode *destNode, - void *buffer, size_t bufsize) +CopyAttributes(CopyLoopControl* control, BNode* srcNode, BNode* destNode, + void* buffer, size_t bufsize) { // ToDo: // Add error checking @@ -1411,8 +1412,8 @@ CopyAttributes(CopyLoopControl *control, BNode *srcNode, BNode *destNode, static void -CopyFolder(BEntry *srcEntry, BDirectory *destDir, CopyLoopControl *loopControl, - BPoint *loc, bool makeOriginalName, Undo &undo, bool removeSource = false) +CopyFolder(BEntry* srcEntry, BDirectory* destDir, CopyLoopControl* loopControl, + BPoint* loc, bool makeOriginalName, Undo &undo, bool removeSource = false) { BDirectory newDir; BEntry entry; @@ -1491,7 +1492,7 @@ CopyFolder(BEntry *srcEntry, BDirectory *destDir, CopyLoopControl *loopControl, } } - char *buffer; + char* buffer; if (createDirectory && err == B_OK && (buffer = (char*)malloc(32768)) != 0) { CopyAttributes(loopControl, &srcDir, &newDir, buffer, 32768); @@ -1543,7 +1544,7 @@ CopyFolder(BEntry *srcEntry, BDirectory *destDir, CopyLoopControl *loopControl, status_t -RecursiveMove(BEntry *entry, BDirectory *destDir, +RecursiveMove(BEntry* entry, BDirectory* destDir, CopyLoopControl* loopControl) { char name[B_FILE_NAME_LENGTH]; @@ -1582,8 +1583,8 @@ RecursiveMove(BEntry *entry, BDirectory *destDir, } status_t -MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode, - const char *newName, Undo &undo, CopyLoopControl* loopControl) +MoveItem(BEntry* entry, BDirectory* destDir, BPoint* loc, uint32 moveMode, + const char* newName, Undo &undo, CopyLoopControl* loopControl) { entry_ref ref; try { @@ -1606,7 +1607,7 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode, BPath path; entry->GetPath(&path); - if (loc && loc != (BPoint *)-1) { + if (loc && loc != (BPoint*)-1) { poseInfo.fInvisible = false; poseInfo.fInitedDirectory = destNode.node; poseInfo.fLocation = *loc; @@ -1636,10 +1637,10 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode, // find index while paths are the same - const char *src = srcString.String(); - const char *dest = destString.String(); - const char *lastFolderSrc = src; - const char *lastFolderDest = dest; + const char* src = srcString.String(); + const char* dest = destString.String(); + const char* lastFolderSrc = src; + const char* lastFolderDest = dest; while (*src && *dest && *src == *dest) { ++src; @@ -1690,7 +1691,7 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode, B_TRANSLATE("Error creating link to \"%name\"."), ref.name); - if (loc && loc != (BPoint *)-1) { + if (loc && loc != (BPoint*)-1) { link.WriteAttr(kAttrPoseInfo, B_RAW_TYPE, 0, &poseInfo, sizeof(PoseInfo)); } @@ -1748,17 +1749,17 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode, void -FSDuplicate(BObjectList *srcList, BList *pointList) +FSDuplicate(BObjectList* srcList, BList* pointList) { LaunchInNewThread("DupTask", B_NORMAL_PRIORITY, MoveTask, srcList, - (BEntry *)NULL, pointList, kDuplicateSelection); + (BEntry*)NULL, pointList, kDuplicateSelection); } #if 0 status_t -FSCopyFolder(BEntry *srcEntry, BDirectory *destDir, - CopyLoopControl *loopControl, BPoint *loc, bool makeOriginalName) +FSCopyFolder(BEntry* srcEntry, BDirectory* destDir, + CopyLoopControl* loopControl, BPoint* loc, bool makeOriginalName) { try CopyFolder(srcEntry, destDir, loopControl, loc, makeOriginalName); @@ -1771,9 +1772,9 @@ FSCopyFolder(BEntry *srcEntry, BDirectory *destDir, status_t -FSCopyAttributesAndStats(BNode *srcNode, BNode *destNode) +FSCopyAttributesAndStats(BNode* srcNode, BNode* destNode) { - char *buffer = new char[1024]; + char* buffer = new char[1024]; // copy the attributes srcNode->RewindAttrs(); @@ -1823,8 +1824,8 @@ FSCopyAttributesAndStats(BNode *srcNode, BNode *destNode) #if 0 status_t -FSCopyFile(BEntry* srcFile, StatStruct *srcStat, BDirectory* destDir, - CopyLoopControl *loopControl, BPoint *loc, bool makeOriginalName) +FSCopyFile(BEntry* srcFile, StatStruct* srcStat, BDirectory* destDir, + CopyLoopControl* loopControl, BPoint* loc, bool makeOriginalName) { try { CopyFile(srcFile, srcStat, destDir, loopControl, loc, @@ -1839,7 +1840,7 @@ FSCopyFile(BEntry* srcFile, StatStruct *srcStat, BDirectory* destDir, static status_t -MoveEntryToTrash(BEntry *entry, BPoint *loc, Undo &undo) +MoveEntryToTrash(BEntry* entry, BPoint* loc, Undo &undo) { BDirectory trash_dir; entry_ref ref; @@ -1929,8 +1930,8 @@ MoveEntryToTrash(BEntry *entry, BPoint *loc, Undo &undo) undo.UpdateEntry(entry, name); } - BNode *src_node = 0; - if (loc && loc != (BPoint *)-1 + BNode* src_node = 0; + if (loc && loc != (BPoint*)-1 && (src_node = GetWritableNode(entry, &statbuf)) != 0) { trash_dir.GetStat(&statbuf); PoseInfo poseInfo; @@ -1959,8 +1960,8 @@ MoveEntryToTrash(BEntry *entry, BPoint *loc, Undo &undo) ConflictCheckResult -PreFlightNameCheck(BObjectList *srcList, const BDirectory *destDir, - int32 *collisionCount, uint32 moveMode) +PreFlightNameCheck(BObjectList* srcList, const BDirectory* destDir, + int32* collisionCount, uint32 moveMode) { // count the number of name collisions in dest folder @@ -1968,7 +1969,7 @@ PreFlightNameCheck(BObjectList *srcList, const BDirectory *destDir, int32 count = srcList->CountItems(); for (int32 i = 0; i < count; i++) { - entry_ref *srcRef = srcList->ItemAt(i); + entry_ref* srcRef = srcList->ItemAt(i); BEntry entry(srcRef); BDirectory parent; entry.GetParent(&parent); @@ -2010,7 +2011,7 @@ PreFlightNameCheck(BObjectList *srcList, const BDirectory *destDir, void -FileStatToString(StatStruct *stat, char *buffer, int32 length) +FileStatToString(StatStruct* stat, char* buffer, int32 length) { tm timeData; localtime_r(&stat->st_mtime, &timeData); @@ -2023,8 +2024,8 @@ FileStatToString(StatStruct *stat, char *buffer, int32 length) status_t -CheckName(uint32 moveMode, const BEntry *sourceEntry, - const BDirectory *destDir, bool multipleCollisions, +CheckName(uint32 moveMode, const BEntry* sourceEntry, + const BDirectory* destDir, bool multipleCollisions, ConflictCheckResult &replaceAll) { if (moveMode == kDuplicateSelection) @@ -2145,7 +2146,7 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry, } // special case single collision (don't need Replace All shortcut) - BAlert *alert; + BAlert* alert; if (multipleCollisions || sourceIsDirectory) { alert = new BAlert("", replaceMsg.String(), B_TRANSLATE("Skip"), B_TRANSLATE("Replace all")); @@ -2188,7 +2189,7 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry, status_t -FSDeleteFolder(BEntry *dir_entry, CopyLoopControl *loopControl, +FSDeleteFolder(BEntry* dir_entry, CopyLoopControl* loopControl, bool update_status, bool delete_top_dir, bool upateFileNameInStatus) { entry_ref ref; @@ -2245,20 +2246,20 @@ FSDeleteFolder(BEntry *dir_entry, CopyLoopControl *loopControl, void -FSMakeOriginalName(BString &string, const BDirectory *destDir, - const char *suffix) +FSMakeOriginalName(BString &string, const BDirectory* destDir, + const char* suffix) { if (!destDir->Contains(string.String())) return; FSMakeOriginalName(string.LockBuffer(B_FILE_NAME_LENGTH), - const_cast(destDir), suffix ? suffix : " copy"); + const_cast(destDir), suffix ? suffix : " copy"); string.UnlockBuffer(); } void -FSMakeOriginalName(char *name, BDirectory *destDir, const char *suffix) +FSMakeOriginalName(char* name, BDirectory* destDir, const char* suffix) { char root[B_FILE_NAME_LENGTH]; char copybase[B_FILE_NAME_LENGTH]; @@ -2278,7 +2279,7 @@ FSMakeOriginalName(char *name, BDirectory *destDir, const char *suffix) bool copycopy = false; // are we copying a copy? int32 len = (int32)strlen(name); - char *p = name + len - 1; // get pointer to end os name + char* p = name + len - 1; // get pointer to end os name // eat up optional numbers (if were copying " copy 34") while ((p > name) && isdigit(*p)) @@ -2307,12 +2308,10 @@ FSMakeOriginalName(char *name, BDirectory *destDir, const char *suffix) } if (!copycopy) { - /* - The name can't be longer than B_FILE_NAME_LENGTH. - The algoritm adds " copy XX" to the name. That's 8 characters. - B_FILE_NAME_LENGTH already accounts for NULL termination so we - don't need to save an extra char at the end. - */ + // The name can't be longer than B_FILE_NAME_LENGTH. + // The algoritm adds " copy XX" to the name. That's 8 characters. + // B_FILE_NAME_LENGTH already accounts for NULL termination so we + // don't need to save an extra char at the end. if (strlen(name) > B_FILE_NAME_LENGTH - 8) { // name is too long - truncate it! name[B_FILE_NAME_LENGTH - 8] = '\0'; @@ -2331,13 +2330,11 @@ FSMakeOriginalName(char *name, BDirectory *destDir, const char *suffix) sprintf(temp_name, "%s %ld", copybase, ++fnum); if (strlen(temp_name) > (B_FILE_NAME_LENGTH - 1)) { - /* - The name has grown too long. Maybe we just went from - " copy 9" to " copy 10" and that extra - character was too much. The solution is to further - truncate the 'root' name and continue. - ??? should we reset fnum or not ??? - */ + // The name has grown too long. Maybe we just went from + // " copy 9" to " copy 10" and that extra + // character was too much. The solution is to further + // truncate the 'root' name and continue. + // ??? should we reset fnum or not ??? root[strlen(root) - 1] = '\0'; sprintf(temp_name, "%s%s %ld", root, suffix, fnum); } @@ -2367,7 +2364,7 @@ FSRecursiveCalcSize(BInfoWindow* window, CopyLoopControl* loopControl, if (status != B_OK) return status; - (*_runningSize) += statbuf.st_blocks * 512; + (*_runningSize) += statbuf.st_blocks* 512; if (S_ISDIR(statbuf.st_mode)) { BDirectory subdir(&entry); @@ -2384,8 +2381,8 @@ FSRecursiveCalcSize(BInfoWindow* window, CopyLoopControl* loopControl, status_t -CalcItemsAndSize(CopyLoopControl* loopControl, BObjectList *refList, - ssize_t blockSize, int32 *totalCount, off_t *totalSize) +CalcItemsAndSize(CopyLoopControl* loopControl, BObjectList* refList, + ssize_t blockSize, int32* totalCount, off_t* totalSize) { int32 fileCount = 0; int32 dirCount = 0; @@ -2414,7 +2411,7 @@ CalcItemsAndSize(CopyLoopControl* loopControl, BObjectList *refList, int32 num_items = refList->CountItems(); for (int32 i = 0; i < num_items; i++) { - entry_ref *ref = refList->ItemAt(i); + entry_ref* ref = refList->ItemAt(i); BEntry entry(ref); StatStruct statbuf; entry.GetStat(&statbuf); @@ -2442,7 +2439,7 @@ CalcItemsAndSize(CopyLoopControl* loopControl, BObjectList *refList, status_t -FSGetTrashDir(BDirectory *trashDir, dev_t dev) +FSGetTrashDir(BDirectory* trashDir, dev_t dev) { BVolume volume(dev); status_t result = volume.InitCheck(); @@ -2504,7 +2501,7 @@ FSGetTrashDir(BDirectory *trashDir, dev_t dev) // obsolete version of FSGetDeskDir retained for bin compat with // BeIDE and a few other apps that apparently use it status_t -FSGetDeskDir(BDirectory *deskDir, dev_t) +FSGetDeskDir(BDirectory* deskDir, dev_t) { // since we no longer keep a desktop directory on any volume other // than /boot, redirect to FSGetDeskDir ignoring the volume argument @@ -2514,7 +2511,7 @@ FSGetDeskDir(BDirectory *deskDir, dev_t) status_t -FSGetDeskDir(BDirectory *deskDir) +FSGetDeskDir(BDirectory* deskDir) { BPath path; status_t result = find_directory(B_DESKTOP_DIRECTORY, &path, true); @@ -2548,7 +2545,7 @@ FSGetDeskDir(BDirectory *deskDir) status_t -FSGetBootDeskDir(BDirectory *deskDir) +FSGetBootDeskDir(BDirectory* deskDir) { BVolume bootVol; BVolumeRoster().GetBootVolume(&bootVol); @@ -2564,7 +2561,7 @@ FSGetBootDeskDir(BDirectory *deskDir) static bool -FSIsDirFlavor(const BEntry *entry, directory_which directoryType) +FSIsDirFlavor(const BEntry* entry, directory_which directoryType) { StatStruct dir_stat; StatStruct entry_stat; @@ -2588,21 +2585,21 @@ FSIsDirFlavor(const BEntry *entry, directory_which directoryType) bool -FSIsPrintersDir(const BEntry *entry) +FSIsPrintersDir(const BEntry* entry) { return FSIsDirFlavor(entry, B_USER_PRINTERS_DIRECTORY); } bool -FSIsTrashDir(const BEntry *entry) +FSIsTrashDir(const BEntry* entry) { return FSIsDirFlavor(entry, B_TRASH_DIRECTORY); } bool -FSIsDeskDir(const BEntry *entry) +FSIsDeskDir(const BEntry* entry) { BPath path; status_t result = find_directory(B_DESKTOP_DIRECTORY, &path, true); @@ -2615,14 +2612,14 @@ FSIsDeskDir(const BEntry *entry) bool -FSIsHomeDir(const BEntry *entry) +FSIsHomeDir(const BEntry* entry) { return FSIsDirFlavor(entry, B_USER_DIRECTORY); } bool -FSIsRootDir(const BEntry *entry) +FSIsRootDir(const BEntry* entry) { BPath path(entry); return path == "/"; @@ -2630,7 +2627,7 @@ FSIsRootDir(const BEntry *entry) bool -DirectoryMatchesOrContains(const BEntry *entry, directory_which which) +DirectoryMatchesOrContains(const BEntry* entry, directory_which which) { BPath path; if (find_directory(which, &path, false, NULL) != B_OK) @@ -2650,7 +2647,7 @@ DirectoryMatchesOrContains(const BEntry *entry, directory_which which) bool -DirectoryMatchesOrContains(const BEntry *entry, const char *additionalPath, +DirectoryMatchesOrContains(const BEntry* entry, const char* additionalPath, directory_which which) { BPath path; @@ -2672,7 +2669,7 @@ DirectoryMatchesOrContains(const BEntry *entry, const char *additionalPath, bool -DirectoryMatches(const BEntry *entry, directory_which which) +DirectoryMatches(const BEntry* entry, directory_which which) { BPath path; if (find_directory(which, &path, false, NULL) != B_OK) @@ -2687,7 +2684,7 @@ DirectoryMatches(const BEntry *entry, directory_which which) bool -DirectoryMatches(const BEntry *entry, const char *additionalPath, +DirectoryMatches(const BEntry* entry, const char* additionalPath, directory_which which) { BPath path; @@ -2704,7 +2701,7 @@ DirectoryMatches(const BEntry *entry, const char *additionalPath, extern status_t -FSFindTrackerSettingsDir(BPath *path, bool autoCreate) +FSFindTrackerSettingsDir(BPath* path, bool autoCreate) { status_t result = find_directory (B_USER_SETTINGS_DIRECTORY, path, autoCreate); @@ -2718,7 +2715,7 @@ FSFindTrackerSettingsDir(BPath *path, bool autoCreate) bool -FSInTrashDir(const entry_ref *ref) +FSInTrashDir(const entry_ref* ref) { BEntry entry(ref); if (entry.InitCheck() != B_OK) @@ -2743,7 +2740,7 @@ FSEmptyTrash() status_t -empty_trash(void *) +empty_trash(void*) { // empty trash on all mounted volumes status_t err = B_OK; @@ -2801,7 +2798,7 @@ empty_trash(void *) } if (err != B_OK && err != kTrashCanceled && err != kUserCanceled) { - (new BAlert("", B_TRANSLATE("Error emptying Trash!"), + (new BAlert("", B_TRANSLATE("Error emptying Trash!"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); } @@ -2811,7 +2808,7 @@ empty_trash(void *) status_t -_DeleteTask(BObjectList *list, bool confirm) +_DeleteTask(BObjectList* list, bool confirm) { if (confirm) { bool dontMoveToTrash = TrackerSettings().DontMoveFilesToTrash(); @@ -2915,7 +2912,7 @@ FSRecursiveCreateFolder(BPath path) } status_t -_RestoreTask(BObjectList *list) +_RestoreTask(BObjectList* list) { TrackerCopyLoopControl loopControl(kRestoreFromTrashState); @@ -2996,7 +2993,7 @@ FSCreateTrashDirs() status_t -FSCreateNewFolder(const entry_ref *ref) +FSCreateNewFolder(const entry_ref* ref) { node_ref node; node.device = ref->device; @@ -3024,8 +3021,8 @@ FSCreateNewFolder(const entry_ref *ref) status_t -FSCreateNewFolderIn(const node_ref *dirNode, entry_ref *newRef, - node_ref *newNode) +FSCreateNewFolderIn(const node_ref* dirNode, entry_ref* newRef, + node_ref* newNode) { BDirectory dir(dirNode); status_t result = dir.InitCheck(); @@ -3074,9 +3071,9 @@ FSCreateNewFolderIn(const node_ref *dirNode, entry_ref *newRef, ReadAttrResult -ReadAttr(const BNode *node, const char *hostAttrName, - const char *foreignAttrName, type_code type, off_t offset, void *buffer, - size_t length, void (*swapFunc)(void *), bool isForeign) +ReadAttr(const BNode* node, const char* hostAttrName, + const char* foreignAttrName, type_code type, off_t offset, void* buffer, + size_t length, void (*swapFunc)(void*), bool isForeign) { if (!isForeign && node->ReadAttr(hostAttrName, type, offset, buffer, length) == (ssize_t)length) { @@ -3102,8 +3099,8 @@ ReadAttr(const BNode *node, const char *hostAttrName, ReadAttrResult -GetAttrInfo(const BNode *node, const char *hostAttrName, - const char *foreignAttrName, type_code *type, size_t *size) +GetAttrInfo(const BNode* node, const char* hostAttrName, + const char* foreignAttrName, type_code* type, size_t* size) { attr_info info; @@ -3130,10 +3127,10 @@ GetAttrInfo(const BNode *node, const char *hostAttrName, // launching code static status_t -TrackerOpenWith(const BMessage *refs) +TrackerOpenWith(const BMessage* refs) { BMessage clone(*refs); - ASSERT(dynamic_cast(be_app)); + ASSERT(dynamic_cast(be_app)); ASSERT(clone.what); clone.AddInt32("launchUsingSelector", 0); // runs the Open With window @@ -3144,22 +3141,22 @@ TrackerOpenWith(const BMessage *refs) static void -AsynchLaunchBinder(void (*func)(const entry_ref *, const BMessage *, bool on), - const entry_ref *appRef, const BMessage *refs, bool openWithOK) +AsynchLaunchBinder(void (*func)(const entry_ref*, const BMessage*, bool on), + const entry_ref* appRef, const BMessage* refs, bool openWithOK) { - BMessage *task = new BMessage; - task->AddPointer("function", (void *)func); + BMessage* task = new BMessage; + task->AddPointer("function", (void*)func); task->AddMessage("refs", refs); task->AddBool("openWithOK", openWithOK); if (appRef != NULL) task->AddRef("appRef", appRef); - extern BLooper *gLaunchLooper; + extern BLooper* gLaunchLooper; gLaunchLooper->PostMessage(task); } static bool -SniffIfGeneric(const entry_ref *ref) +SniffIfGeneric(const entry_ref* ref) { BNode node(ref); char type[B_MIME_TYPE_LENGTH]; @@ -3181,7 +3178,7 @@ SniffIfGeneric(const entry_ref *ref) } static void -SniffIfGeneric(const BMessage *refs) +SniffIfGeneric(const BMessage* refs) { entry_ref ref; for (int32 index = 0; ; index++) { @@ -3192,7 +3189,7 @@ SniffIfGeneric(const BMessage *refs) } static void -_TrackerLaunchAppWithDocuments(const entry_ref *appRef, const BMessage *refs, +_TrackerLaunchAppWithDocuments(const entry_ref* appRef, const BMessage* refs, bool openWithOK) { team_id team; @@ -3218,12 +3215,12 @@ _TrackerLaunchAppWithDocuments(const entry_ref *appRef, const BMessage *refs, if (error == B_OK) { // close possible parent window, if specified - const node_ref *nodeToClose = 0; + const node_ref* nodeToClose = 0; int32 numBytes; refs->FindData("nodeRefsToClose", B_RAW_TYPE, - (const void **)&nodeToClose, &numBytes); + (const void**)&nodeToClose, &numBytes); if (nodeToClose) - dynamic_cast(be_app)->CloseParent(*nodeToClose); + dynamic_cast(be_app)->CloseParent(*nodeToClose); } else { alertString.SetTo(B_TRANSLATE("Could not open \"%name\" (%error). ")); alertString.ReplaceFirst("%name", appRef->name); @@ -3247,16 +3244,16 @@ _TrackerLaunchAppWithDocuments(const entry_ref *appRef, const BMessage *refs, extern "C" char** environ; -extern "C" status_t _kern_load_image(const char * const *flatArgs, +extern "C" status_t _kern_load_image(const char* const* flatArgs, size_t flatArgsSize, int32 argCount, int32 envCount, int32 priority, uint32 flags, port_id errorPort, uint32 errorToken); -extern "C" status_t __flatten_process_args(const char * const *args, - int32 argCount, const char * const *env, int32 envCount, char ***_flatArgs, - size_t *_flatSize); +extern "C" status_t __flatten_process_args(const char* const* args, + int32 argCount, const char* const* env, int32 envCount, char***_flatArgs, + size_t* _flatSize); static status_t -LoaderErrorDetails(const entry_ref *app, BString &details) +LoaderErrorDetails(const entry_ref* app, BString &details) { BPath path; BEntry appEntry(app, true); @@ -3265,7 +3262,7 @@ LoaderErrorDetails(const entry_ref *app, BString &details) if (result != B_OK) return result; - char *argv[2] = { const_cast(path.Path()), 0}; + char* argv[2] = { const_cast(path.Path()), 0}; port_id errorPort = create_port(1, "Tracker loader error"); @@ -3276,7 +3273,7 @@ LoaderErrorDetails(const entry_ref *app, BString &details) char** flatArgs = NULL; size_t flatArgsSize; - result = __flatten_process_args((const char **)argv, 1, + result = __flatten_process_args((const char**)argv, 1, environ, envCount, &flatArgs, &flatArgsSize); if (result != B_OK) return result; @@ -3301,7 +3298,7 @@ LoaderErrorDetails(const entry_ref *app, BString &details) return bufferSize; } - uint8 *buffer = (uint8 *)malloc(bufferSize); + uint8* buffer = (uint8*)malloc(bufferSize); if (buffer == NULL) { delete_port(errorPort); return B_NO_MEMORY; @@ -3317,7 +3314,7 @@ LoaderErrorDetails(const entry_ref *app, BString &details) } BMessage message; - result = message.Unflatten((const char *)buffer); + result = message.Unflatten((const char*)buffer); free(buffer); if (result != B_OK) @@ -3328,7 +3325,7 @@ LoaderErrorDetails(const entry_ref *app, BString &details) if (result != B_OK) return result; - const char *detailName = NULL; + const char* detailName = NULL; switch (errorCode) { case B_MISSING_LIBRARY: detailName = "missing library"; @@ -3342,7 +3339,7 @@ LoaderErrorDetails(const entry_ref *app, BString &details) if (detailName == NULL) return B_ERROR; - const char *detail; + const char* detail; for (int32 i = 0; message.FindString(detailName, i, &detail) == B_OK; i++) { if (i > 0) @@ -3355,7 +3352,7 @@ LoaderErrorDetails(const entry_ref *app, BString &details) static void -_TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs, +_TrackerLaunchDocuments(const entry_ref* /*doNotUse*/, const BMessage* refs, bool openWithOK) { BMessage copyOfRefs(*refs); @@ -3367,9 +3364,9 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs, status_t error = B_ERROR; entry_ref app; - BMessage *refsToPass = NULL; + BMessage* refsToPass = NULL; BString alertString; - const char *alternative = 0; + const char* alternative = 0; for (int32 mimesetIt = 0; ; mimesetIt++) { alertString = ""; @@ -3546,7 +3543,7 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs, // should fix that, making them void status_t -TrackerLaunch(const entry_ref *appRef, const BMessage *refs, bool async, +TrackerLaunch(const entry_ref* appRef, const BMessage* refs, bool async, bool openWithOK) { if (!async) @@ -3560,7 +3557,7 @@ TrackerLaunch(const entry_ref *appRef, const BMessage *refs, bool async, } status_t -TrackerLaunch(const entry_ref *appRef, bool async) +TrackerLaunch(const entry_ref* appRef, bool async) { if (!async) _TrackerLaunchAppWithDocuments(appRef, 0, false); @@ -3571,7 +3568,7 @@ TrackerLaunch(const entry_ref *appRef, bool async) } status_t -TrackerLaunch(const BMessage *refs, bool async, bool openWithOK) +TrackerLaunch(const BMessage* refs, bool async, bool openWithOK) { if (!async) _TrackerLaunchDocuments(0, refs, openWithOK); @@ -3582,11 +3579,11 @@ TrackerLaunch(const BMessage *refs, bool async, bool openWithOK) } status_t -LaunchBrokenLink(const char *signature, const BMessage *refs) +LaunchBrokenLink(const char* signature, const BMessage* refs) { // This call is to support a hacky workaround for double-clicking // broken refs for cifs - be_roster->Launch(signature, const_cast(refs)); + be_roster->Launch(signature, const_cast(refs)); return B_OK; } @@ -3596,7 +3593,7 @@ LaunchBrokenLink(const char *signature, const BMessage *refs) _IMPEXP_TRACKER #endif status_t -FSLaunchItem(const entry_ref *application, const BMessage *refsReceived, +FSLaunchItem(const entry_ref* application, const BMessage* refsReceived, bool async, bool openWithOK) { return TrackerLaunch(application, refsReceived, async, openWithOK); @@ -3607,12 +3604,12 @@ FSLaunchItem(const entry_ref *application, const BMessage *refsReceived, _IMPEXP_TRACKER #endif status_t -FSOpenWith(BMessage *listOfRefs) +FSOpenWith(BMessage* listOfRefs) { status_t result = B_ERROR; listOfRefs->what = B_REFS_RECEIVED; - if (dynamic_cast(be_app)) + if (dynamic_cast(be_app)) result = TrackerOpenWith(listOfRefs); else ASSERT(!"not yet implemented"); @@ -3623,14 +3620,14 @@ FSOpenWith(BMessage *listOfRefs) // legacy calls, need for compatibility void -FSOpenWithDocuments(const entry_ref *executable, BMessage *documents) +FSOpenWithDocuments(const entry_ref* executable, BMessage* documents) { TrackerLaunch(executable, documents, true); delete documents; } status_t -FSLaunchUsing(const entry_ref *ref, BMessage *listOfRefs) +FSLaunchUsing(const entry_ref* ref, BMessage* listOfRefs) { BMessage temp(B_REFS_RECEIVED); if (!listOfRefs) { @@ -3643,7 +3640,7 @@ FSLaunchUsing(const entry_ref *ref, BMessage *listOfRefs) } status_t -FSLaunchItem(const entry_ref *ref, BMessage* message, int32, bool async) +FSLaunchItem(const entry_ref* ref, BMessage* message, int32, bool async) { if (message) message->what = B_REFS_RECEIVED; @@ -3655,14 +3652,14 @@ FSLaunchItem(const entry_ref *ref, BMessage* message, int32, bool async) void -FSLaunchItem(const entry_ref *ref, BMessage *message, int32 workspace) +FSLaunchItem(const entry_ref* ref, BMessage* message, int32 workspace) { FSLaunchItem(ref, message, workspace, true); } // Get the original path of an entry in the trash status_t -FSGetOriginalPath(BEntry *entry, BPath *result) +FSGetOriginalPath(BEntry* entry, BPath* result) { status_t err; entry_ref ref; @@ -3728,17 +3725,17 @@ FSGetOriginalPath(BEntry *entry, BPath *result) } directory_which -WellKnowEntryList::Match(const node_ref *node) +WellKnowEntryList::Match(const node_ref* node) { - const WellKnownEntry *result = MatchEntry(node); + const WellKnownEntry* result = MatchEntry(node); if (result) return result->which; return (directory_which)-1; } -const WellKnowEntryList::WellKnownEntry * -WellKnowEntryList::MatchEntry(const node_ref *node) +const WellKnowEntryList::WellKnownEntry* +WellKnowEntryList::MatchEntry(const node_ref* node) { if (!self) self = new WellKnowEntryList(); @@ -3746,8 +3743,8 @@ WellKnowEntryList::MatchEntry(const node_ref *node) return self->MatchEntryCommon(node); } -const WellKnowEntryList::WellKnownEntry * -WellKnowEntryList::MatchEntryCommon(const node_ref *node) +const WellKnowEntryList::WellKnownEntry* +WellKnowEntryList::MatchEntryCommon(const node_ref* node) { uint32 count = entries.size(); for (uint32 index = 0; index < count; index++) @@ -3767,7 +3764,7 @@ WellKnowEntryList::Quit() void -WellKnowEntryList::AddOne(directory_which which, const char *name) +WellKnowEntryList::AddOne(directory_which which, const char* name) { BPath path; if (find_directory(which, &path, true) != B_OK) @@ -3784,7 +3781,7 @@ WellKnowEntryList::AddOne(directory_which which, const char *name) void WellKnowEntryList::AddOne(directory_which which, directory_which base, - const char *extra, const char *name) + const char* extra, const char* name) { BPath path; if (find_directory(base, &path, true) != B_OK) @@ -3801,8 +3798,8 @@ WellKnowEntryList::AddOne(directory_which which, directory_which base, void -WellKnowEntryList::AddOne(directory_which which, const char *path, - const char *name) +WellKnowEntryList::AddOne(directory_which which, const char* path, + const char* name) { BEntry entry(path, true); node_ref node; @@ -3859,6 +3856,6 @@ WellKnowEntryList::WellKnowEntryList() "downloads", "downloads"); } -WellKnowEntryList *WellKnowEntryList::self = NULL; +WellKnowEntryList* WellKnowEntryList::self = NULL; } // namespace BPrivate diff --git a/src/kits/tracker/FSUtils.h b/src/kits/tracker/FSUtils.h index d033e0be2b..da95902cb4 100644 --- a/src/kits/tracker/FSUtils.h +++ b/src/kits/tracker/FSUtils.h @@ -31,9 +31,9 @@ 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. */ +#ifndef FS_UTILS_H +#define FS_UTILS_H -#ifndef FS_UTILS_H -#define FS_UTILS_H #include #include @@ -45,6 +45,7 @@ All rights reserved. #include "Model.h" #include "ObjectList.h" + // Note - APIs/code in FSUtils.h and FSUtils.cpp is slated for a major cleanup // -- in other words, you will find a lot of ugly cruft in here @@ -97,7 +98,7 @@ public: bool srcIsDir, bool dstIsDir); //! Override to prevent copying of a given file or directory - virtual bool SkipEntry(const BEntry *, bool file); + virtual bool SkipEntry(const BEntry*, bool file); //! During a file copy, this is called every time a chunk of data // is copied. Users may override to keep a running checksum. @@ -128,17 +129,17 @@ public: const entry_ref* destDir = NULL, bool showCount = true); - virtual bool FileError(const char *message, - const char *name, status_t error, + virtual bool FileError(const char* message, + const char* name, status_t error, bool allowContinue); - virtual void UpdateStatus(const char *name, + virtual void UpdateStatus(const char* name, const entry_ref& ref, int32 count, bool optional = false); virtual bool CheckUserCanceled(); - virtual bool SkipAttribute(const char *attributeName); + virtual bool SkipAttribute(const char* attributeName); // One can specify an entry_ref list with the source entries. This will @@ -162,54 +163,54 @@ private: #ifndef _IMPEXP_TRACKER #define _IMPEXP_TRACKER #endif -_IMPEXP_TRACKER status_t FSCopyAttributesAndStats(BNode *, BNode *); +_IMPEXP_TRACKER status_t FSCopyAttributesAndStats(BNode*, BNode*); -_IMPEXP_TRACKER void FSDuplicate(BObjectList *srcList, BList *pointList); -_IMPEXP_TRACKER void FSMoveToFolder(BObjectList *srcList, BEntry *, uint32 moveMode, - BList *pointList = NULL); -_IMPEXP_TRACKER void FSMakeOriginalName(char *name, BDirectory *destDir, const char *suffix); -_IMPEXP_TRACKER bool FSIsTrashDir(const BEntry *); -_IMPEXP_TRACKER bool FSIsPrintersDir(const BEntry *); -_IMPEXP_TRACKER bool FSIsDeskDir(const BEntry *); -_IMPEXP_TRACKER bool FSIsHomeDir(const BEntry *); -_IMPEXP_TRACKER bool FSIsRootDir(const BEntry *); -_IMPEXP_TRACKER void FSMoveToTrash(BObjectList *srcList, BList *pointList = NULL, +_IMPEXP_TRACKER void FSDuplicate(BObjectList* srcList, BList* pointList); +_IMPEXP_TRACKER void FSMoveToFolder(BObjectList* srcList, BEntry*, uint32 moveMode, + BList* pointList = NULL); +_IMPEXP_TRACKER void FSMakeOriginalName(char* name, BDirectory* destDir, const char* suffix); +_IMPEXP_TRACKER bool FSIsTrashDir(const BEntry*); +_IMPEXP_TRACKER bool FSIsPrintersDir(const BEntry*); +_IMPEXP_TRACKER bool FSIsDeskDir(const BEntry*); +_IMPEXP_TRACKER bool FSIsHomeDir(const BEntry*); +_IMPEXP_TRACKER bool FSIsRootDir(const BEntry*); +_IMPEXP_TRACKER void FSMoveToTrash(BObjectList* srcList, BList* pointList = NULL, bool async = true); // Deprecated -void FSDeleteRefList(BObjectList *, bool, bool confirm = true); -void FSDelete(entry_ref *, bool, bool confirm = true); -void FSRestoreRefList(BObjectList *list, bool async); +void FSDeleteRefList(BObjectList*, bool, bool confirm = true); +void FSDelete(entry_ref*, bool, bool confirm = true); +void FSRestoreRefList(BObjectList* list, bool async); -_IMPEXP_TRACKER status_t FSLaunchItem(const entry_ref *application, const BMessage *refsReceived, +_IMPEXP_TRACKER status_t FSLaunchItem(const entry_ref* application, const BMessage* refsReceived, bool async, bool openWithOK); // Preferred way of launching; only pass an actual application in , not // a document; to open documents with the preferred app, pase 0 in and // stuff all the document refs into // Consider having silent mode that does not show alerts, just returns error code -_IMPEXP_TRACKER status_t FSOpenWith(BMessage *listOfRefs); +_IMPEXP_TRACKER status_t FSOpenWith(BMessage* listOfRefs); // runs the Open With window; pas a list of refs _IMPEXP_TRACKER void FSEmptyTrash(); -_IMPEXP_TRACKER status_t FSCreateNewFolderIn(const node_ref *destDir, entry_ref *newRef, - node_ref *new_node); +_IMPEXP_TRACKER status_t FSCreateNewFolderIn(const node_ref* destDir, entry_ref* newRef, + node_ref* new_node); _IMPEXP_TRACKER void FSCreateTrashDirs(); -_IMPEXP_TRACKER status_t FSGetTrashDir(BDirectory *trashDir, dev_t volume); -_IMPEXP_TRACKER status_t FSGetDeskDir(BDirectory *deskDir); -_IMPEXP_TRACKER status_t FSRecursiveCalcSize(BInfoWindow *, - CopyLoopControl* loopControl, BDirectory *, off_t *runningSize, - int32 *fileCount, int32 *dirCount); +_IMPEXP_TRACKER status_t FSGetTrashDir(BDirectory* trashDir, dev_t volume); +_IMPEXP_TRACKER status_t FSGetDeskDir(BDirectory* deskDir); +_IMPEXP_TRACKER status_t FSRecursiveCalcSize(BInfoWindow*, + CopyLoopControl* loopControl, BDirectory*, off_t* runningSize, + int32* fileCount, int32* dirCount); -bool FSInTrashDir(const entry_ref *); +bool FSInTrashDir(const entry_ref*); // doesn't need to be exported -bool FSGetPoseLocation(const BNode *node, BPoint *point); -status_t FSSetPoseLocation(BEntry *entry, BPoint point); -status_t FSSetPoseLocation(ino_t destDirInode, BNode *destNode, BPoint point); -status_t FSGetBootDeskDir(BDirectory *deskDir); +bool FSGetPoseLocation(const BNode* node, BPoint* point); +status_t FSSetPoseLocation(BEntry* entry, BPoint point); +status_t FSSetPoseLocation(ino_t destDirInode, BNode* destNode, BPoint point); +status_t FSGetBootDeskDir(BDirectory* deskDir); -status_t FSGetOriginalPath(BEntry *entry, BPath *path); +status_t FSGetOriginalPath(BEntry* entry, BPath* path); enum ReadAttrResult { kReadAttrFailed, @@ -217,48 +218,48 @@ enum ReadAttrResult { kReadAttrForeignOK }; -ReadAttrResult ReadAttr(const BNode *, const char *hostAttrName, const char *foreignAttrName, - type_code , off_t , void *, size_t , void (*swapFunc)(void *) = 0, +ReadAttrResult ReadAttr(const BNode*, const char* hostAttrName, const char* foreignAttrName, + type_code , off_t , void*, size_t , void (*swapFunc)(void*) = 0, bool isForeign = false); // Endian swapping ReadAttr call; endianness is determined by trying first the // native attribute name, then the foreign one; an endian swapping function can // be passed, if null data won't be swapped; if set the foreign endianness // will be read directly without first trying the native one -ReadAttrResult GetAttrInfo(const BNode *, const char *hostAttrName, const char *foreignAttrName, - type_code * = NULL, size_t * = NULL); +ReadAttrResult GetAttrInfo(const BNode*, const char* hostAttrName, const char* foreignAttrName, + type_code* = NULL, size_t* = NULL); -status_t FSCreateNewFolder(const entry_ref *); -status_t FSRecursiveCreateFolder(const char *path); -void FSMakeOriginalName(BString &name, const BDirectory *destDir, const char *suffix = 0); +status_t FSCreateNewFolder(const entry_ref*); +status_t FSRecursiveCreateFolder(const char* path); +void FSMakeOriginalName(BString &name, const BDirectory* destDir, const char* suffix = 0); -status_t TrackerLaunch(const entry_ref *app, bool async); -status_t TrackerLaunch(const BMessage *refs, bool async, bool okToRunOpenWith = true); -status_t TrackerLaunch(const entry_ref *app, const BMessage *refs, bool async, +status_t TrackerLaunch(const entry_ref* app, bool async); +status_t TrackerLaunch(const BMessage* refs, bool async, bool okToRunOpenWith = true); +status_t TrackerLaunch(const entry_ref* app, const BMessage* refs, bool async, bool okToRunOpenWith = true); -status_t LaunchBrokenLink(const char *, const BMessage *); +status_t LaunchBrokenLink(const char*, const BMessage*); -status_t FSFindTrackerSettingsDir(BPath *, bool autoCreate = true); +status_t FSFindTrackerSettingsDir(BPath*, bool autoCreate = true); -bool FSIsDeskDir(const BEntry *); +bool FSIsDeskDir(const BEntry*); // two separate ifYouDoAction and toDoAction versions are needed for localization // purposes. The first one is used in "If you do action ..." sentence, // the second one in the "To do action" sentence. -bool ConfirmChangeIfWellKnownDirectory(const BEntry *entry, - const char *ifYouDoAction, const char *toDoAction, - const char *toConfirmAction, bool dontAsk = false, - int32 *confirmedAlready = NULL); +bool ConfirmChangeIfWellKnownDirectory(const BEntry* entry, + const char* ifYouDoAction, const char* toDoAction, + const char* toConfirmAction, bool dontAsk = false, + int32* confirmedAlready = NULL); -bool CheckDevicesEqual(const entry_ref *entry, const Model *targetModel); +bool CheckDevicesEqual(const entry_ref* entry, const Model* targetModel); // Deprecated calls use newer calls above instead -_IMPEXP_TRACKER void FSLaunchItem(const entry_ref *, BMessage * = NULL, int32 workspace = -1); -_IMPEXP_TRACKER status_t FSLaunchItem(const entry_ref *, BMessage *, +_IMPEXP_TRACKER void FSLaunchItem(const entry_ref*, BMessage* = NULL, int32 workspace = -1); +_IMPEXP_TRACKER status_t FSLaunchItem(const entry_ref*, BMessage*, int32 workspace, bool asynch); -_IMPEXP_TRACKER void FSOpenWithDocuments(const entry_ref *executableToLaunch, - BMessage *documentEntryRefs); -_IMPEXP_TRACKER status_t FSLaunchUsing(const entry_ref *ref, BMessage *listOfRefs); +_IMPEXP_TRACKER void FSOpenWithDocuments(const entry_ref* executableToLaunch, + BMessage* documentEntryRefs); +_IMPEXP_TRACKER status_t FSLaunchUsing(const entry_ref* ref, BMessage* listOfRefs); // some extra directory_which values @@ -278,7 +279,7 @@ class WellKnowEntryList { // system hierarchy public: struct WellKnownEntry { - WellKnownEntry(const node_ref *node, directory_which which, const char *name) + WellKnownEntry(const node_ref* node, directory_which which, const char* name) : node(*node), which(which), @@ -304,20 +305,20 @@ class WellKnowEntryList { BString name; }; - static directory_which Match(const node_ref *); - static const WellKnownEntry *MatchEntry(const node_ref *); + static directory_which Match(const node_ref*); + static const WellKnownEntry* MatchEntry(const node_ref*); static void Quit(); private: - const WellKnownEntry *MatchEntryCommon(const node_ref *); + const WellKnownEntry* MatchEntryCommon(const node_ref*); WellKnowEntryList(); - void AddOne(directory_which, const char *name); - void AddOne(directory_which, const char *path, const char *name); - void AddOne(directory_which, directory_which base, const char *extension, - const char *name); + void AddOne(directory_which, const char* name); + void AddOne(directory_which, const char* path, const char* name); + void AddOne(directory_which, directory_which base, const char* extension, + const char* name); std::vector entries; - static WellKnowEntryList *self; + static WellKnowEntryList* self; }; #if B_BEOS_VERSION_DANO @@ -328,4 +329,4 @@ class WellKnowEntryList { using namespace BPrivate; -#endif /* FS_UTILS_H */ +#endif // FS_UTILS_H diff --git a/src/kits/tracker/FavoritesMenu.cpp b/src/kits/tracker/FavoritesMenu.cpp index 0e716622cf..44a0924840 100644 --- a/src/kits/tracker/FavoritesMenu.cpp +++ b/src/kits/tracker/FavoritesMenu.cpp @@ -60,9 +60,9 @@ All rights reserved. #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "FavoritesMenu" -FavoritesMenu::FavoritesMenu(const char *title, BMessage *openFolderMessage, - BMessage *openFileMessage, const BMessenger &target, - bool isSavePanel, BRefFilter *filter) +FavoritesMenu::FavoritesMenu(const char* title, BMessage* openFolderMessage, + BMessage* openFileMessage, const BMessenger &target, + bool isSavePanel, BRefFilter* filter) : BSlowMenu(title), fOpenFolderMessage(openFolderMessage), fOpenFileMessage(openFileMessage), @@ -84,7 +84,7 @@ FavoritesMenu::~FavoritesMenu() void -FavoritesMenu::SetRefFilter(BRefFilter *filter) +FavoritesMenu::SetRefFilter(BRefFilter* filter) { fRefFilter = filter; } @@ -138,7 +138,7 @@ FavoritesMenu::AddNextItem() if (startModel.IsQuery()) fContainer = new QueryEntryListCollection(&startModel); else - fContainer = new DirectoryEntryList(*dynamic_cast + fContainer = new DirectoryEntryList(*dynamic_cast (startModel.Node())); ThrowOnInitCheckError(fContainer); @@ -162,7 +162,7 @@ FavoritesMenu::AddNextItem() if (!ShouldShowModel(&model)) return true; - BMenuItem *item = BNavMenu::NewModelItem(&model, + BMenuItem* item = BNavMenu::NewModelItem(&model, model.IsDirectory() ? fOpenFolderMessage : fOpenFileMessage, fTarget); @@ -214,7 +214,7 @@ FavoritesMenu::AddNextItem() if (!ShouldShowModel(&model)) return true; - BMenuItem *item = BNavMenu::NewModelItem(&model, fOpenFileMessage, fTarget); + BMenuItem* item = BNavMenu::NewModelItem(&model, fOpenFileMessage, fTarget); if (item) { if (!fAddedSeparatorForSection) { fAddedSeparatorForSection = true; @@ -262,7 +262,7 @@ FavoritesMenu::AddNextItem() if (!ShouldShowModel(&model)) return true; - BMenuItem *item = BNavMenu::NewModelItem(&model, fOpenFolderMessage, + BMenuItem* item = BNavMenu::NewModelItem(&model, fOpenFolderMessage, fTarget, true); if (item) { if (!fAddedSeparatorForSection) { @@ -302,7 +302,7 @@ FavoritesMenu::ClearMenuBuildingState() bool -FavoritesMenu::ShouldShowModel(const Model *model) +FavoritesMenu::ShouldShowModel(const Model* model) { if (fIsSavePanel && model->IsFile()) return false; @@ -321,7 +321,8 @@ FavoritesMenu::ShouldShowModel(const Model *model) // #pragma mark - -RecentsMenu::RecentsMenu(const char *name,int32 which,uint32 what,BHandler *target) +RecentsMenu::RecentsMenu(const char* name, int32 which, uint32 what, + BHandler* target) : BNavMenu(name, what, target), fWhich(which), fRecentsCount(0), @@ -356,7 +357,7 @@ RecentsMenu::StartBuildingItemList() { int32 count = CountItems()-1; for (int32 index = count; index >= 0; index--) { - BMenuItem *item = ItemAt(index); + BMenuItem* item = ItemAt(index); ASSERT(item); RemoveItem(index); @@ -413,7 +414,7 @@ RecentsMenu::AddRecents(int32 count) if (ref.name && strlen(ref.name) > 0) { Model model(&ref, true); - ModelMenuItem *item = BNavMenu::NewModelItem(&model, + ModelMenuItem* item = BNavMenu::NewModelItem(&model, new BMessage(fMessage.what), Target(), false, NULL, TypesList()); @@ -459,4 +460,3 @@ RecentsMenu::ClearMenuBuildingState() fMenuBuilt = false; BNavMenu::ClearMenuBuildingState(); } - diff --git a/src/kits/tracker/FavoritesMenu.h b/src/kits/tracker/FavoritesMenu.h index df68e52aaf..4a416f7424 100644 --- a/src/kits/tracker/FavoritesMenu.h +++ b/src/kits/tracker/FavoritesMenu.h @@ -31,15 +31,16 @@ 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. */ - #ifndef __FAVORITES_MENU__ #define __FAVORITES_MENU__ + #include #include "NavMenu.h" #include "ObjectList.h" + class BRefFilter; namespace BPrivate { @@ -48,28 +49,29 @@ class EntryListBase; #define kGoDirectory "Tracker/Go" + class FavoritesMenu : public BSlowMenu { // FavoritesMenu is used in the FilePanel - // displays recent files, recent folders and favorites items public: - FavoritesMenu(const char *title, BMessage *openFolderMessage, - BMessage *openFileMessage, const BMessenger &, - bool isSavePanel, BRefFilter *filter = NULL); + FavoritesMenu(const char* title, BMessage* openFolderMessage, + BMessage* openFileMessage, const BMessenger &, + bool isSavePanel, BRefFilter* filter = NULL); virtual ~FavoritesMenu(); - void SetRefFilter(BRefFilter *filter); + void SetRefFilter(BRefFilter* filter); private: // override the necessary SlowMenu hooks virtual bool StartBuildingItemList(); virtual bool AddNextItem(); - virtual void DoneBuildingItemList(); + virtual void DoneBuildingItemList(); virtual void ClearMenuBuildingState(); - bool ShouldShowModel(const Model *model); + bool ShouldShowModel(const Model* model); - BMessage *fOpenFolderMessage; - BMessage *fOpenFileMessage; + BMessage* fOpenFolderMessage; + BMessage* fOpenFileMessage; BMessenger fTarget; enum State { @@ -89,12 +91,12 @@ class FavoritesMenu : public BSlowMenu { // next inserted item BMessage fItems; - EntryListBase *fContainer; - BObjectList *fItemList; + EntryListBase* fContainer; + BObjectList* fItemList; int32 fInitialItemCount; std::vector fUniqueRefCheck; bool fIsSavePanel; - BRefFilter *fRefFilter; + BRefFilter* fRefFilter; typedef BSlowMenu _inherited; }; @@ -106,22 +108,23 @@ enum recent_type { kRecentFolders = 2 }; + class RecentsMenu : public BNavMenu { public: - RecentsMenu(const char *name,int32 which,uint32 what,BHandler *target); + RecentsMenu(const char* name,int32 which,uint32 what,BHandler* target); void DetachedFromWindow(); - int32 RecentsCount(); + int32 RecentsCount(); - private: + private: virtual bool StartBuildingItemList(); virtual bool AddNextItem(); bool AddRecents(int32 count); - virtual void DoneBuildingItemList(); + virtual void DoneBuildingItemList(); virtual void ClearMenuBuildingState(); - private: + private: int32 fWhich; int32 fRecentsCount; diff --git a/src/kits/tracker/FilePanel.cpp b/src/kits/tracker/FilePanel.cpp index 4c0b7af977..ae89580f9e 100644 --- a/src/kits/tracker/FilePanel.cpp +++ b/src/kits/tracker/FilePanel.cpp @@ -34,6 +34,7 @@ All rights reserved. // Implementation for the public FilePanel object. + #include #include @@ -64,6 +65,7 @@ run_open_panel() (new TFilePanel())->Show(); } + void run_save_panel() { @@ -74,9 +76,9 @@ run_save_panel() // #pragma mark - -BFilePanel::BFilePanel(file_panel_mode mode, BMessenger *target, - const entry_ref *ref, uint32 nodeFlavors, bool multipleSelection, - BMessage *message, BRefFilter *filter, bool modal, +BFilePanel::BFilePanel(file_panel_mode mode, BMessenger* target, + const entry_ref* ref, uint32 nodeFlavors, bool multipleSelection, + BMessage* message, BRefFilter* filter, bool modal, bool hideWhenDone) { // boost file descriptor limit so file panels in other apps don't have @@ -92,17 +94,19 @@ BFilePanel::BFilePanel(file_panel_mode mode, BMessenger *target, modal ? B_MODAL_APP_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL, hideWhenDone); - static_cast(fWindow)->SetClientObject(this); + static_cast(fWindow)->SetClientObject(this); fWindow->SetIsFilePanel(true); } + BFilePanel::~BFilePanel() { if (fWindow->Lock()) fWindow->Quit(); } + void BFilePanel::Show() { @@ -124,6 +128,7 @@ BFilePanel::Show() fWindow->Activate(); } + void BFilePanel::Hide() { @@ -135,6 +140,7 @@ BFilePanel::Hide() fWindow->QuitRequested(); } + bool BFilePanel::IsShowing() const { @@ -147,11 +153,12 @@ BFilePanel::IsShowing() const void -BFilePanel::SendMessage(const BMessenger *messenger, BMessage *message) +BFilePanel::SendMessage(const BMessenger* messenger, BMessage* message) { messenger->SendMessage(message); } + file_panel_mode BFilePanel::PanelMode() const { @@ -159,12 +166,13 @@ BFilePanel::PanelMode() const if (!lock) return B_OPEN_PANEL; - if (static_cast(fWindow)->IsSavePanel()) + if (static_cast(fWindow)->IsSavePanel()) return B_SAVE_PANEL; return B_OPEN_PANEL; } + BMessenger BFilePanel::Messenger() const { @@ -174,9 +182,10 @@ BFilePanel::Messenger() const if (!lock) return target; - return *static_cast(fWindow)->Target(); + return *static_cast(fWindow)->Target(); } + void BFilePanel::SetTarget(BMessenger target) { @@ -184,19 +193,21 @@ BFilePanel::SetTarget(BMessenger target) if (!lock) return; - static_cast(fWindow)->SetTarget(target); + static_cast(fWindow)->SetTarget(target); } + void -BFilePanel::SetMessage(BMessage *message) +BFilePanel::SetMessage(BMessage* message) { AutoLock lock(fWindow); if (!lock) return; - static_cast(fWindow)->SetMessage(message); + static_cast(fWindow)->SetMessage(message); } + void BFilePanel::Refresh() { @@ -204,71 +215,78 @@ BFilePanel::Refresh() if (!lock) return; - static_cast(fWindow)->Refresh(); + static_cast(fWindow)->Refresh(); } -BRefFilter * + +BRefFilter* BFilePanel::RefFilter() const { AutoLock lock(fWindow); if (!lock) return 0; - return static_cast(fWindow)->Filter(); + return static_cast(fWindow)->Filter(); } + void -BFilePanel::SetRefFilter(BRefFilter *filter) +BFilePanel::SetRefFilter(BRefFilter* filter) { AutoLock lock(fWindow); if (!lock) return; - static_cast(fWindow)->SetRefFilter(filter); + static_cast(fWindow)->SetRefFilter(filter); } + void -BFilePanel::SetButtonLabel(file_panel_button button, const char *text) +BFilePanel::SetButtonLabel(file_panel_button button, const char* text) { AutoLock lock(fWindow); if (!lock) return; - static_cast(fWindow)->SetButtonLabel(button, text); + static_cast(fWindow)->SetButtonLabel(button, text); } + void -BFilePanel::GetPanelDirectory(entry_ref *ref) const +BFilePanel::GetPanelDirectory(entry_ref* ref) const { AutoLock lock(fWindow); if (!lock) return; - *ref = *static_cast(fWindow)->TargetModel()->EntryRef(); + *ref = *static_cast(fWindow)->TargetModel()->EntryRef(); } + void -BFilePanel::SetSaveText(const char *text) +BFilePanel::SetSaveText(const char* text) { AutoLock lock(fWindow); if (!lock) return; - static_cast(fWindow)->SetSaveText(text); + static_cast(fWindow)->SetSaveText(text); } + void -BFilePanel::SetPanelDirectory(const entry_ref *ref) +BFilePanel::SetPanelDirectory(const entry_ref* ref) { AutoLock lock(fWindow); if (!lock) return; - static_cast(fWindow)->SetTo(ref); + static_cast(fWindow)->SetTo(ref); } + void -BFilePanel::SetPanelDirectory(const char *path) +BFilePanel::SetPanelDirectory(const char* path) { entry_ref ref; status_t err = get_ref_for_path(path, &ref); @@ -279,11 +297,12 @@ BFilePanel::SetPanelDirectory(const char *path) if (!lock) return; - static_cast(fWindow)->SetTo(&ref); + static_cast(fWindow)->SetTo(&ref); } + void -BFilePanel::SetPanelDirectory(const BEntry *entry) +BFilePanel::SetPanelDirectory(const BEntry* entry) { entry_ref ref; @@ -291,8 +310,9 @@ BFilePanel::SetPanelDirectory(const BEntry *entry) SetPanelDirectory(&ref); } + void -BFilePanel::SetPanelDirectory(const BDirectory *dir) +BFilePanel::SetPanelDirectory(const BDirectory* dir) { BEntry entry; @@ -300,12 +320,14 @@ BFilePanel::SetPanelDirectory(const BDirectory *dir) SetPanelDirectory(&entry); } -BWindow * + +BWindow* BFilePanel::Window() const { return fWindow; } + void BFilePanel::Rewind() { @@ -313,17 +335,18 @@ BFilePanel::Rewind() if (!lock) return; - static_cast(fWindow)->Rewind(); + static_cast(fWindow)->Rewind(); } + status_t -BFilePanel::GetNextSelectedRef(entry_ref *ref) +BFilePanel::GetNextSelectedRef(entry_ref* ref) { AutoLock lock(fWindow); if (!lock) return B_ERROR; - return static_cast(fWindow)->GetNextEntryRef(ref); + return static_cast(fWindow)->GetNextEntryRef(ref); } @@ -335,9 +358,10 @@ BFilePanel::SetHideWhenDone(bool on) if (!lock) return; - static_cast(fWindow)->SetHideWhenDone(on); + static_cast(fWindow)->SetHideWhenDone(on); } + bool BFilePanel::HidesWhenDone(void) const { @@ -345,18 +369,19 @@ BFilePanel::HidesWhenDone(void) const if (!lock) return false; - return static_cast(fWindow)->HidesWhenDone(); + return static_cast(fWindow)->HidesWhenDone(); } + void BFilePanel::WasHidden() { // hook function } + void BFilePanel::SelectionChanged() { // hook function } - diff --git a/src/kits/tracker/FilePanelPriv.cpp b/src/kits/tracker/FilePanelPriv.cpp index a4a9b419b5..5131a96855 100644 --- a/src/kits/tracker/FilePanelPriv.cpp +++ b/src/kits/tracker/FilePanelPriv.cpp @@ -79,11 +79,11 @@ All rights reserved. #include -const char *kDefaultFilePanelTemplate = "FilePanelSettings"; +const char* kDefaultFilePanelTemplate = "FilePanelSettings"; static uint32 -GetLinkFlavor(const Model *model, bool resolve = true) +GetLinkFlavor(const Model* model, bool resolve = true) { if (model && model->IsSymLink()) { if (!resolve) @@ -101,17 +101,17 @@ GetLinkFlavor(const Model *model, bool resolve = true) static filter_result -key_down_filter(BMessage *message, BHandler **handler, BMessageFilter *filter) +key_down_filter(BMessage* message, BHandler** handler, BMessageFilter* filter) { - TFilePanel *panel = dynamic_cast(filter->Looper()); + TFilePanel* panel = dynamic_cast(filter->Looper()); ASSERT(panel); - BPoseView *view = panel->PoseView(); + BPoseView* view = panel->PoseView(); if (panel->TrackingMenu()) return B_DISPATCH_MESSAGE; uchar key; - if (message->FindInt8("byte", (int8 *)&key) != B_OK) + if (message->FindInt8("byte", (int8*)&key) != B_OK) return B_DISPATCH_MESSAGE; int32 modifier = 0; @@ -141,9 +141,9 @@ key_down_filter(BMessage *message, BHandler **handler, BMessageFilter *filter) #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "FilePanelPriv" -TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target, - const BEntry *startDir, uint32 nodeFlavors, bool multipleSelection, - BMessage *message, BRefFilter *filter, uint32 containerWindowFlags, +TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target, + const BEntry* startDir, uint32 nodeFlavors, bool multipleSelection, + BMessage* message, BRefFilter* filter, uint32 containerWindowFlags, window_look look, window_feel feel, bool hideWhenDone) : BContainerWindow(0, containerWindowFlags, look, feel, 0, B_CURRENT_WORKSPACE), fDirMenu(NULL), @@ -181,7 +181,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target, = BLocaleRoster::Default()->IsFilesystemTranslationPreferred(); // check for legal starting directory - Model *model = new Model(); + Model* model = new Model(); bool useRoot = true; if (startDir) { @@ -246,9 +246,9 @@ TFilePanel::~TFilePanel() filter_result -TFilePanel::MessageDropFilter(BMessage *message, BHandler **, BMessageFilter *filter) +TFilePanel::MessageDropFilter(BMessage* message, BHandler**, BMessageFilter* filter) { - TFilePanel *panel = dynamic_cast(filter->Looper()); + TFilePanel* panel = dynamic_cast(filter->Looper()); if (panel == NULL || !message->WasDropped()) return B_SKIP_MESSAGE; @@ -300,8 +300,8 @@ TFilePanel::MessageDropFilter(BMessage *message, BHandler **, BMessageFilter *fi panel->fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TFilePanel::SelectChildInParent, panel, - const_cast(&ref), - const_cast(&child)), + const_cast(&ref), + const_cast(&child)), ref == *panel->TargetModel()->EntryRef() ? 0 : 100000, 200000, 5000000); // if the target directory is already current, we won't // delay the initial selection try @@ -318,20 +318,20 @@ TFilePanel::MessageDropFilter(BMessage *message, BHandler **, BMessageFilter *fi filter_result -TFilePanel::FSFilter(BMessage *message, BHandler **, BMessageFilter *filter) +TFilePanel::FSFilter(BMessage* message, BHandler**, BMessageFilter* filter) { switch (message->FindInt32("opcode")) { case B_ENTRY_MOVED: { node_ref itemNode; node_ref dirNode; - TFilePanel *panel = dynamic_cast(filter->Looper()); + TFilePanel* panel = dynamic_cast(filter->Looper()); message->FindInt32("device", &dirNode.device); itemNode.device = dirNode.device; - message->FindInt64("to directory", (int64 *)&dirNode.node); - message->FindInt64("node", (int64 *)&itemNode.node); - const char *name; + message->FindInt64("to directory", (int64*)&dirNode.node); + message->FindInt64("node", (int64*)&itemNode.node); + const char* name; if (message->FindString("name", &name) != B_OK) break; @@ -347,9 +347,9 @@ TFilePanel::FSFilter(BMessage *message, BHandler **, BMessageFilter *filter) case B_ENTRY_REMOVED: { node_ref itemNode; - TFilePanel *panel = dynamic_cast(filter->Looper()); + TFilePanel* panel = dynamic_cast(filter->Looper()); message->FindInt32("device", &itemNode.device); - message->FindInt64("node", (int64 *)&itemNode.node); + message->FindInt64("node", (int64*)&itemNode.node); // if folder we're watching is deleted, switch to root // or Desktop @@ -379,7 +379,7 @@ TFilePanel::FSFilter(BMessage *message, BHandler **, BMessageFilter *filter) void -TFilePanel::DispatchMessage(BMessage *message, BHandler *handler) +TFilePanel::DispatchMessage(BMessage* message, BHandler* handler) { _inherited::DispatchMessage(message, handler); if (message->what == B_KEY_DOWN || message->what == B_MOUSE_DOWN) @@ -387,11 +387,11 @@ TFilePanel::DispatchMessage(BMessage *message, BHandler *handler) } -BFilePanelPoseView * +BFilePanelPoseView* TFilePanel::PoseView() const { - ASSERT(dynamic_cast(fPoseView)); - return static_cast(fPoseView); + ASSERT(dynamic_cast(fPoseView)); + return static_cast(fPoseView); } @@ -421,7 +421,7 @@ TFilePanel::QuitRequested() } -BRefFilter * +BRefFilter* TFilePanel::Filter() const { return fPoseView->RefFilter(); @@ -436,7 +436,7 @@ TFilePanel::SetTarget(BMessenger target) void -TFilePanel::SetMessage(BMessage *message) +TFilePanel::SetMessage(BMessage* message) { delete fMessage; fMessage = new BMessage(*message); @@ -444,7 +444,7 @@ TFilePanel::SetMessage(BMessage *message) void -TFilePanel::SetRefFilter(BRefFilter *filter) +TFilePanel::SetRefFilter(BRefFilter* filter) { if (!filter) return; @@ -452,7 +452,7 @@ TFilePanel::SetRefFilter(BRefFilter *filter) fPoseView->SetRefFilter(filter); fPoseView->CommitActivePose(); fPoseView->Refresh(); - FavoritesMenu* menu = dynamic_cast + FavoritesMenu* menu = dynamic_cast (fMenuBar->FindItem(B_TRANSLATE("Favorites"))->Submenu()); if (menu) menu->SetRefFilter(filter); @@ -460,7 +460,7 @@ TFilePanel::SetRefFilter(BRefFilter *filter) void -TFilePanel::SetTo(const entry_ref *ref) +TFilePanel::SetTo(const entry_ref* ref) { if (!ref) return; @@ -493,7 +493,7 @@ TFilePanel::Rewind() void -TFilePanel::SetClientObject(BFilePanel *panel) +TFilePanel::SetClientObject(BFilePanel* panel) { fClientObject = panel; } @@ -503,12 +503,12 @@ void TFilePanel::AdjustButton() { // adjust button state - BButton *button = dynamic_cast(FindView("default button")); + BButton* button = dynamic_cast(FindView("default button")); if (!button) return; - BTextControl *textControl = dynamic_cast(FindView("text view")); - BObjectList *selectionList = fPoseView->SelectionList(); + BTextControl* textControl = dynamic_cast(FindView("text view")); + BObjectList* selectionList = fPoseView->SelectionList(); BString buttonText = fButtonText; bool enabled = false; @@ -517,7 +517,7 @@ TFilePanel::AdjustButton() if (fPoseView->IsFocus()) { fPoseView->ShowSelection(true); if (selectionList->CountItems() == 1) { - Model *model = selectionList->FirstItem()->TargetModel(); + Model* model = selectionList->FirstItem()->TargetModel(); if (model->ResolveIfLink()->IsDirectory()) { enabled = true; buttonText = B_TRANSLATE("Open"); @@ -536,7 +536,7 @@ TFilePanel::AdjustButton() // go through selection list looking at content for (int32 index = 0; index < count; index++) { - Model *model = selectionList->ItemAt(index)->TargetModel(); + Model* model = selectionList->ItemAt(index)->TargetModel(); uint32 modelFlavor = GetLinkFlavor(model, false); uint32 linkFlavor = GetLinkFlavor(model, true); @@ -573,12 +573,12 @@ TFilePanel::SelectionChanged() status_t -TFilePanel::GetNextEntryRef(entry_ref *ref) +TFilePanel::GetNextEntryRef(entry_ref* ref) { if (!ref) return B_ERROR; - BPose *pose = fPoseView->SelectionList()->ItemAt(fSelectionIterator++); + BPose* pose = fPoseView->SelectionList()->ItemAt(fSelectionIterator++); if (!pose) return B_ERROR; @@ -587,15 +587,15 @@ TFilePanel::GetNextEntryRef(entry_ref *ref) } -BPoseView * -TFilePanel::NewPoseView(Model *model, BRect rect, uint32) +BPoseView* +TFilePanel::NewPoseView(Model* model, BRect rect, uint32) { return new BFilePanelPoseView(model, rect); } void -TFilePanel::Init(const BMessage *) +TFilePanel::Init(const BMessage*) { BRect windRect(Bounds()); AddChild(fBackView = new BackgroundView(windRect)); @@ -628,7 +628,7 @@ TFilePanel::Init(const BMessage *) item = fMenuBar->FindItem(B_TRANSLATE("File")); if (item) { - BMenu *menu = item->Submenu(); + BMenu* menu = item->Submenu(); if (menu) { item = menu->FindItem(kOpenSelection); if (item && menu->RemoveItem(item)) @@ -753,7 +753,7 @@ TFilePanel::Init(const BMessage *) float default_width = be_plain_font->StringWidth(fButtonText.String()) + 20; rect.left = (default_width > 75) ? (rect.right - default_width) : (rect.right - 75); - BButton *default_button = new BButton(rect, "default button", fButtonText.String(), + BButton* default_button = new BButton(rect, "default button", fButtonText.String(), new BMessage(kDefaultButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); fBackView->AddChild(default_button); @@ -836,13 +836,13 @@ TFilePanel::SaveState(BMessage &message) const void -TFilePanel::RestoreWindowState(AttributeStreamNode *node) +TFilePanel::RestoreWindowState(AttributeStreamNode* node) { SetSizeLimits(360, 10000, 200, 10000); if (!node) return; - const char *rectAttributeName = kAttrWindowFrame; + const char* rectAttributeName = kAttrWindowFrame; BRect frame(Frame()); if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame) == sizeof(BRect)) { @@ -867,7 +867,7 @@ TFilePanel::RestoreWindowState(const BMessage &message) void -TFilePanel::AddFileContextMenus(BMenu *menu) +TFilePanel::AddFileContextMenus(BMenu* menu) { menu->AddItem(new BMenuItem(B_TRANSLATE("Get info"), new BMessage(kGetInfo), 'I')); @@ -889,7 +889,7 @@ TFilePanel::AddFileContextMenus(BMenu *menu) void -TFilePanel::AddVolumeContextMenus(BMenu *menu) +TFilePanel::AddVolumeContextMenus(BMenu* menu) { menu->AddItem(new BMenuItem(B_TRANSLATE("Open"), new BMessage(kOpenSelection), 'O')); @@ -908,7 +908,7 @@ TFilePanel::AddVolumeContextMenus(BMenu *menu) void -TFilePanel::AddWindowContextMenus(BMenu *menu) +TFilePanel::AddWindowContextMenus(BMenu* menu) { BMenuItem* item = new BMenuItem(B_TRANSLATE("New folder"), new BMessage(kNewFolder), 'N'); @@ -944,7 +944,7 @@ TFilePanel::AddWindowContextMenus(BMenu *menu) void -TFilePanel::AddDropContextMenus(BMenu *) +TFilePanel::AddDropContextMenus(BMenu*) { } @@ -975,7 +975,7 @@ TFilePanel::MenusEnded() void -TFilePanel::ShowContextMenu(BPoint point, const entry_ref *ref, BView *view) +TFilePanel::ShowContextMenu(BPoint point, const entry_ref* ref, BView* view) { EnableNamedMenuItem(fWindowContextMenu, kNewFolder, !TargetModel()->IsRoot()); EnableNamedMenuItem(fWindowContextMenu, kOpenParentDir, !TargetModel()->IsRoot()); @@ -986,19 +986,19 @@ TFilePanel::ShowContextMenu(BPoint point, const entry_ref *ref, BView *view) void -TFilePanel::SetupNavigationMenu(const entry_ref *, BMenu *) +TFilePanel::SetupNavigationMenu(const entry_ref*, BMenu*) { // do nothing here so nav menu doesn't get added } void -TFilePanel::SetButtonLabel(file_panel_button selector, const char *text) +TFilePanel::SetButtonLabel(file_panel_button selector, const char* text) { switch (selector) { case B_CANCEL_BUTTON: { - BButton *button = dynamic_cast(FindView("cancel button")); + BButton* button = dynamic_cast(FindView("cancel button")); if (!button) break; @@ -1016,7 +1016,7 @@ TFilePanel::SetButtonLabel(file_panel_button selector, const char *text) { fButtonText = text; float delta = 0; - BButton *button = dynamic_cast(FindView("default button")); + BButton* button = dynamic_cast(FindView("default button")); if (button) { float old_width = button->StringWidth(button->Label()); button->SetLabel(text); @@ -1028,7 +1028,7 @@ TFilePanel::SetButtonLabel(file_panel_button selector, const char *text) } // now must move cancel button - button = dynamic_cast(FindView("cancel button")); + button = dynamic_cast(FindView("cancel button")); if (button) button->MoveBy(delta, 0); } @@ -1038,19 +1038,19 @@ TFilePanel::SetButtonLabel(file_panel_button selector, const char *text) void -TFilePanel::SetSaveText(const char *text) +TFilePanel::SetSaveText(const char* text) { if (!text) return; - BTextControl *textControl = dynamic_cast(FindView("text view")); + BTextControl* textControl = dynamic_cast(FindView("text view")); textControl->SetText(text); textControl->TextView()->SelectAll(); } void -TFilePanel::MessageReceived(BMessage *message) +TFilePanel::MessageReceived(BMessage* message) { entry_ref ref; @@ -1075,7 +1075,7 @@ TFilePanel::MessageReceived(BMessage *message) // Otherwise, we have a file or a link to a file. // AdjustButton has already tested the flavor; // all we have to do is see if the button is enabled. - BButton *button = dynamic_cast(FindView("default button")); + BButton* button = dynamic_cast(FindView("default button")); if (!button) break; @@ -1199,7 +1199,7 @@ TFilePanel::MessageReceived(BMessage *message) if (fIsSavePanel) { if (PoseView()->IsFocus() && PoseView()->SelectionList()->CountItems() == 1) { - Model *model = (PoseView()->SelectionList()->FirstItem())->TargetModel(); + Model* model = (PoseView()->SelectionList()->FirstItem())->TargetModel(); if (model->ResolveIfLink()->IsDirectory()) { PoseView()->CommitActivePose(); PoseView()->OpenSelection(); @@ -1239,11 +1239,11 @@ TFilePanel::MessageReceived(BMessage *message) void TFilePanel::OpenDirectory() { - BObjectList *list = PoseView()->SelectionList(); + BObjectList* list = PoseView()->SelectionList(); if (list->CountItems() != 1) return; - Model *model = list->FirstItem()->TargetModel(); + Model* model = list->FirstItem()->TargetModel(); if (model->ResolveIfLink()->IsDirectory()) { BMessage message(B_REFS_RECEIVED); message.AddRef("refs", model->EntryRef()); @@ -1280,7 +1280,7 @@ TFilePanel::OpenParent() // shows up fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TFilePanel::SelectChildInParent, this, - const_cast(&ref), + const_cast(&ref), oldModel.NodeRef()), 100000, 200000, 5000000); } } @@ -1334,7 +1334,7 @@ TFilePanel::SwitchDirToDesktopIfNeeded(entry_ref &ref) bool -TFilePanel::SelectChildInParent(const entry_ref *, const node_ref *child) +TFilePanel::SelectChildInParent(const entry_ref*, const node_ref* child) { AutoLock lock(this); @@ -1342,7 +1342,7 @@ TFilePanel::SelectChildInParent(const entry_ref *, const node_ref *child) return false; int32 index; - BPose *pose = PoseView()->FindPose(child, &index); + BPose* pose = PoseView()->FindPose(child, &index); if (!pose) return false; @@ -1355,10 +1355,10 @@ TFilePanel::SelectChildInParent(const entry_ref *, const node_ref *child) int32 -TFilePanel::ShowCenteredAlert(const char *text, const char *button1, - const char *button2, const char *button3) +TFilePanel::ShowCenteredAlert(const char* text, const char* button1, + const char* button2, const char* button3) { - BAlert *alert = new BAlert("", text, button1, button2, button3, + BAlert* alert = new BAlert("", text, button1, button2, button3, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->MoveTo(Frame().left + 10, Frame().top + 10); @@ -1447,7 +1447,7 @@ TFilePanel::HandleSaveButton() void -TFilePanel::OpenSelectionCommon(BMessage *openMessage) +TFilePanel::OpenSelectionCommon(BMessage* openMessage) { if (!openMessage->HasRef("refs")) return; @@ -1483,12 +1483,12 @@ void TFilePanel::HandleOpenButton() { PoseView()->CommitActivePose(); - BObjectList *selection = PoseView()->SelectionList(); + BObjectList* selection = PoseView()->SelectionList(); // if we have only one directory and we're not opening dirs, enter. if ((fNodeFlavors & B_DIRECTORY_NODE) == 0 && selection->CountItems() == 1) { - Model *model = selection->FirstItem()->TargetModel(); + Model* model = selection->FirstItem()->TargetModel(); if (model->IsDirectory() || (model->IsSymLink() && !(fNodeFlavors & B_SYMLINK_NODE) @@ -1507,7 +1507,7 @@ TFilePanel::HandleOpenButton() BMessage message(*fMessage); // go through selection and add appropriate items for (int32 index = 0; index < selection->CountItems(); index++) { - Model *model = selection->ItemAt(index)->TargetModel(); + Model* model = selection->ItemAt(index)->TargetModel(); if (((fNodeFlavors & B_DIRECTORY_NODE) != 0 && model->ResolveIfLink()->IsDirectory()) @@ -1522,7 +1522,7 @@ TFilePanel::HandleOpenButton() void -TFilePanel::SwitchDirMenuTo(const entry_ref *ref) +TFilePanel::SwitchDirMenuTo(const entry_ref* ref) { BEntry entry(ref); for (int32 index = fDirMenu->CountItems() - 1; index >= 0; index--) @@ -1531,7 +1531,7 @@ TFilePanel::SwitchDirMenuTo(const entry_ref *ref) fDirMenuField->MenuBar()->RemoveItem((int32)0); fDirMenu->Populate(&entry, 0, true, true, false, true); - ModelMenuItem *item = dynamic_cast( + ModelMenuItem* item = dynamic_cast( fDirMenuField->MenuBar()->ItemAt(0)); ASSERT(item); item->SetEntry(&entry); @@ -1550,7 +1550,7 @@ TFilePanel::WindowActivated(bool active) // #pragma mark - -BFilePanelPoseView::BFilePanelPoseView(Model *model, BRect frame, uint32 resizeMask) +BFilePanelPoseView::BFilePanelPoseView(Model* model, BRect frame, uint32 resizeMask) : BPoseView(model, frame, kListMode, resizeMask), fIsDesktop(model->IsDesktop()) { @@ -1580,7 +1580,7 @@ BFilePanelPoseView::StopWatching() bool -BFilePanelPoseView::FSNotification(const BMessage *message) +BFilePanelPoseView::FSNotification(const BMessage* message) { if (IsDesktopView()) { // Pretty much copied straight from DesktopPoseView. Would be better @@ -1613,7 +1613,7 @@ BFilePanelPoseView::FSNotification(const BMessage *message) void -BFilePanelPoseView::RestoreState(AttributeStreamNode *node) +BFilePanelPoseView::RestoreState(AttributeStreamNode* node) { _inherited::RestoreState(node); fViewState->SetViewMode(kListMode); @@ -1628,13 +1628,13 @@ BFilePanelPoseView::RestoreState(const BMessage &message) void -BFilePanelPoseView::SavePoseLocations(BRect *) +BFilePanelPoseView::SavePoseLocations(BRect*) { } -EntryListBase * -BFilePanelPoseView::InitDirentIterator(const entry_ref *ref) +EntryListBase* +BFilePanelPoseView::InitDirentIterator(const entry_ref* ref) { if (IsDesktopView()) return DesktopPoseView::InitDesktopDirentIterator(this, ref); @@ -1677,14 +1677,14 @@ BFilePanelPoseView::ShowVolumes(bool visible, bool showShared) } - TFilePanel *filepanel = dynamic_cast(Window()); + TFilePanel* filepanel = dynamic_cast(Window()); if (filepanel) filepanel->SetTo(TargetModel()->EntryRef()); } void -BFilePanelPoseView::AdaptToVolumeChange(BMessage *message) +BFilePanelPoseView::AdaptToVolumeChange(BMessage* message) { bool showDisksIcon; bool mountVolumesOnDesktop; @@ -1719,7 +1719,7 @@ BFilePanelPoseView::AdaptToVolumeChange(BMessage *message) void -BFilePanelPoseView::AdaptToDesktopIntegrationChange(BMessage *message) +BFilePanelPoseView::AdaptToDesktopIntegrationChange(BMessage* message) { bool mountVolumesOnDesktop = true; bool mountSharedVolumesOntoDesktop = true; @@ -1730,4 +1730,3 @@ BFilePanelPoseView::AdaptToDesktopIntegrationChange(BMessage *message) ShowVolumes(false, mountSharedVolumesOntoDesktop); ShowVolumes(mountVolumesOnDesktop, mountSharedVolumesOntoDesktop); } - diff --git a/src/kits/tracker/FilePanelPriv.h b/src/kits/tracker/FilePanelPriv.h index 7756980c63..b9de5c944b 100644 --- a/src/kits/tracker/FilePanelPriv.h +++ b/src/kits/tracker/FilePanelPriv.h @@ -31,16 +31,17 @@ 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. */ - #ifndef _FILE_PANEL_PRIV_H #define _FILE_PANEL_PRIV_H + #include #include "ContainerWindow.h" #include "PoseView.h" #include "TaskLoop.h" + class BTextControl; class BFilePanel; class BRefFilter; @@ -57,9 +58,9 @@ class BFilePanelPoseView; class TFilePanel : public BContainerWindow { public: TFilePanel(file_panel_mode = B_OPEN_PANEL, - BMessenger *target = NULL, const BEntry *startDirectory = NULL, + BMessenger* target = NULL, const BEntry* startDirectory = NULL, uint32 nodeFlavors = B_FILE_NODE | B_SYMLINK_NODE, - bool multipleSelection = true, BMessage * = NULL, BRefFilter * = NULL, + bool multipleSelection = true, BMessage* = NULL, BRefFilter* = NULL, uint32 containerWindowFlags = 0, window_look look = B_DOCUMENT_WINDOW_LOOK, window_feel feel = B_NORMAL_WINDOW_FEEL, @@ -67,33 +68,33 @@ public: virtual ~TFilePanel(); - BFilePanelPoseView *PoseView() const; + BFilePanelPoseView* PoseView() const; virtual bool QuitRequested(); virtual void MenusBeginning(); - virtual void MenusEnded(); - virtual void DispatchMessage(BMessage *message, BHandler *handler); - virtual void ShowContextMenu(BPoint, const entry_ref *, BView *); + virtual void MenusEnded(); + virtual void DispatchMessage(BMessage* message, BHandler* handler); + virtual void ShowContextMenu(BPoint, const entry_ref*, BView*); - void SetClientObject(BFilePanel *); - void SetRefFilter(BRefFilter *); - void SetSaveText(const char *text); - void SetButtonLabel(file_panel_button, const char *text); - void SetTo(const entry_ref *ref); + void SetClientObject(BFilePanel*); + void SetRefFilter(BRefFilter*); + void SetSaveText(const char* text); + void SetButtonLabel(file_panel_button, const char* text); + void SetTo(const entry_ref* ref); virtual void SelectionChanged(); - void HandleOpenButton(); - void HandleSaveButton(); - void Rewind(); - bool IsSavePanel() const; - void Refresh(); - const BMessenger *Target() const; - BRefFilter *Filter() const; + void HandleOpenButton(); + void HandleSaveButton(); + void Rewind(); + bool IsSavePanel() const; + void Refresh(); + const BMessenger* Target() const; + BRefFilter* Filter() const; void SetTarget(BMessenger); - void SetMessage(BMessage *message); + void SetMessage(BMessage* message); - virtual status_t GetNextEntryRef(entry_ref *); - virtual void MessageReceived(BMessage *); + virtual status_t GetNextEntryRef(entry_ref*); + virtual void MessageReceived(BMessage*); void SetHideWhenDone(bool); bool HidesWhenDone(void); @@ -101,96 +102,97 @@ public: bool TrackingMenu() const; protected: - BPoseView *NewPoseView(Model *model, BRect rect, uint32 viewMode); - virtual void Init(const BMessage *message = NULL); + BPoseView* NewPoseView(Model* model, BRect rect, uint32 viewMode); + virtual void Init(const BMessage* message = NULL); virtual void SaveState(bool hide = true); virtual void SaveState(BMessage &) const; virtual void RestoreState(); - virtual void RestoreWindowState(AttributeStreamNode *); - virtual void RestoreWindowState(const BMessage &); - virtual void RestoreState(const BMessage &); + virtual void RestoreWindowState(AttributeStreamNode*); + virtual void RestoreWindowState(const BMessage&); + virtual void RestoreState(const BMessage&); - virtual void AddFileContextMenus(BMenu *); - virtual void AddWindowContextMenus(BMenu *); - virtual void AddDropContextMenus(BMenu *); - virtual void AddVolumeContextMenus(BMenu *); + virtual void AddFileContextMenus(BMenu*); + virtual void AddWindowContextMenus(BMenu*); + virtual void AddDropContextMenus(BMenu*); + virtual void AddVolumeContextMenus(BMenu*); - virtual void SetupNavigationMenu(const entry_ref *, BMenu *); - virtual void OpenDirectory(); - virtual void OpenParent(); + virtual void SetupNavigationMenu(const entry_ref*, BMenu*); + virtual void OpenDirectory(); + virtual void OpenParent(); virtual void WindowActivated(bool state); - static filter_result FSFilter(BMessage *, BHandler **, BMessageFilter *); - static filter_result MessageDropFilter(BMessage *, BHandler **, BMessageFilter *); - int32 ShowCenteredAlert(const char *text, const char *button1, const char *button2 = NULL, - const char *button3 = NULL); + static filter_result FSFilter(BMessage*, BHandler**, BMessageFilter*); + static filter_result MessageDropFilter(BMessage*, BHandler**, BMessageFilter*); + int32 ShowCenteredAlert(const char* text, const char* button1, + const char* button2 = NULL, const char* button3 = NULL); private: - bool SwitchDirToDesktopIfNeeded(entry_ref &ref); - bool CanOpenParent() const; - void SwitchDirMenuTo(const entry_ref *ref); - void AdjustButton(); - bool SelectChildInParent(const entry_ref *parent, const node_ref *child); - void OpenSelectionCommon(BMessage *); + bool SwitchDirToDesktopIfNeeded(entry_ref &ref); + bool CanOpenParent() const; + void SwitchDirMenuTo(const entry_ref* ref); + void AdjustButton(); + bool SelectChildInParent(const entry_ref* parent, + const node_ref* child); + void OpenSelectionCommon(BMessage*); + bool fIsSavePanel; + uint32 fNodeFlavors; + BackgroundView* fBackView; + BDirMenu* fDirMenu; + BMenuField* fDirMenuField; + BTextControl* fTextControl; + BMessenger fTarget; + BFilePanel* fClientObject; + int32 fSelectionIterator; + BMessage* fMessage; + BString fButtonText; + bool fHideWhenDone; + bool fIsTrackingMenu; - bool fIsSavePanel; - uint32 fNodeFlavors; - BackgroundView *fBackView; - BDirMenu *fDirMenu; - BMenuField *fDirMenuField; - BTextControl *fTextControl; - BMessenger fTarget; - BFilePanel *fClientObject; - int32 fSelectionIterator; - BMessage *fMessage; - BString fButtonText; - bool fHideWhenDone; - bool fIsTrackingMenu; + typedef BContainerWindow _inherited; - typedef BContainerWindow _inherited; - -friend class BackgroundView; + friend class BackgroundView; }; class BFilePanelPoseView : public BPoseView { public: - BFilePanelPoseView(Model *, BRect, uint32 resizeMask = B_FOLLOW_ALL); + BFilePanelPoseView(Model*, BRect, uint32 resizeMask = B_FOLLOW_ALL); virtual bool IsFilePanel() const; - virtual bool FSNotification(const BMessage *); + virtual bool FSNotification(const BMessage*); void SetIsDesktop(bool); protected: // don't do any volume watching and memtamime watching in file panels for now - virtual void StartWatching(); - virtual void StopWatching(); + virtual void StartWatching(); + virtual void StopWatching(); - virtual void RestoreState(AttributeStreamNode *); - virtual void RestoreState(const BMessage &); - virtual void SavePoseLocations(BRect * = NULL); + virtual void RestoreState(AttributeStreamNode*); + virtual void RestoreState(const BMessage &); + virtual void SavePoseLocations(BRect* = NULL); - virtual EntryListBase *InitDirentIterator(const entry_ref *); - virtual void AddPosesCompleted(); - virtual bool IsDesktopView() const; + virtual EntryListBase* InitDirentIterator(const entry_ref*); + virtual void AddPosesCompleted(); + virtual bool IsDesktopView() const; - void ShowVolumes(bool visible, bool showShared); + void ShowVolumes(bool visible, bool showShared); - void AdaptToVolumeChange(BMessage *); - void AdaptToDesktopIntegrationChange(BMessage *); + void AdaptToVolumeChange(BMessage*); + void AdaptToDesktopIntegrationChange(BMessage*); private: - bool fIsDesktop; - // this flags makes the distinction between the Desktop as the Root of - // the world and "/boot/home/Desktop" to which we might have navigated - // from the home dir + bool fIsDesktop; + // This flags makes the distinction between the Desktop as + // the root of the world and "/boot/home/Desktop" to which + // we might have navigated from the home dir. - typedef BPoseView _inherited; + typedef BPoseView _inherited; }; + // inlines follow inline bool @@ -199,36 +201,42 @@ BFilePanelPoseView::IsFilePanel() const return true; } + inline bool TFilePanel::IsSavePanel() const { return fIsSavePanel; } -inline const BMessenger * + +inline const BMessenger* TFilePanel::Target() const { return &fTarget; } + inline void TFilePanel::Refresh() { fPoseView->Refresh(); } + inline bool TFilePanel::HidesWhenDone(void) { return fHideWhenDone; } + inline void TFilePanel::SetHideWhenDone(bool on) { fHideWhenDone = on; } + inline bool TFilePanel::TrackingMenu() const { diff --git a/src/kits/tracker/FilePermissionsView.cpp b/src/kits/tracker/FilePermissionsView.cpp index 069ceecb8c..6efe30810c 100644 --- a/src/kits/tracker/FilePermissionsView.cpp +++ b/src/kits/tracker/FilePermissionsView.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "FilePermissionsView.h" #include @@ -50,7 +51,7 @@ const uint32 kNewGroupEntered = 'nwgr'; #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "FilePermissionsView" -FilePermissionsView::FilePermissionsView(BRect rect, Model *model) +FilePermissionsView::FilePermissionsView(BRect rect, Model* model) : BView(rect, "FilePermissionsView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW), fModel(model) { @@ -58,7 +59,7 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model) const float kColumnLabelMiddle = 77, kColumnLabelTop = 6, kColumnLabelSpacing = 37, kColumnLabelBottom = 20, kColumnLabelWidth = 35, kAttribFontHeight = 10; - BStringView *strView; + BStringView* strView; strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2, kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2, kColumnLabelBottom), @@ -116,7 +117,7 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model) kHorizontalSpacing = kColumnLabelSpacing, kVerticalSpacing = kRowLabelVerticalSpacing, kCheckBoxWidth = 18, kCheckBoxHeight = 18; - FocusCheckBox **checkBoxArray[3][3] = { + FocusCheckBox** checkBoxArray[3][3] = { { &fReadUserCheckBox, &fReadGroupCheckBox, &fReadOtherCheckBox }, { &fWriteUserCheckBox, &fWriteGroupCheckBox, &fWriteOtherCheckBox }, { &fExecuteUserCheckBox, &fExecuteGroupCheckBox, &fExecuteOtherCheckBox }}; @@ -172,7 +173,7 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model) void -FilePermissionsView::ModelChanged(Model *model) +FilePermissionsView::ModelChanged(Model* model) { fModel = model; @@ -270,7 +271,7 @@ FilePermissionsView::ModelChanged(Model *model) void -FilePermissionsView::MessageReceived(BMessage *message) +FilePermissionsView::MessageReceived(BMessage* message) { switch(message->what) { case kPermissionsChanged: @@ -358,4 +359,3 @@ FilePermissionsView::AttachedToWindow() fOwnerTextControl->SetTarget(this); fGroupTextControl->SetTarget(this); } - diff --git a/src/kits/tracker/FilePermissionsView.h b/src/kits/tracker/FilePermissionsView.h index a3f00c3542..06ce35469f 100644 --- a/src/kits/tracker/FilePermissionsView.h +++ b/src/kits/tracker/FilePermissionsView.h @@ -31,21 +31,22 @@ 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. */ - #ifndef FILE_PERMISSIONS_VIEW_H #define FILE_PERMISSIONS_VIEW_H + #include #include #include "Model.h" + namespace BPrivate { class FocusCheckBox : public BCheckBox { public: - FocusCheckBox(BRect rect, const char *name, const char *label, - BMessage *message) + FocusCheckBox(BRect rect, const char* name, const char* label, + BMessage* message) : BCheckBox(rect, name, label, message) { } @@ -56,44 +57,46 @@ class FocusCheckBox : public BCheckBox { if (IsFocus()) { SetHighColor(0, 0, 255); - StrokeRect(BRect(2 , 4, 12, 14)); - } + StrokeRect(BRect(2 , 4, 12, 14)); + } } }; + class FilePermissionsView : public BView { public: - FilePermissionsView(BRect, Model *); + FilePermissionsView(BRect, Model*); - void ModelChanged(Model *); + void ModelChanged(Model*); protected: - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); virtual void AttachedToWindow(); private: - Model *fModel; + Model* fModel; - FocusCheckBox *fReadUserCheckBox; - FocusCheckBox *fReadGroupCheckBox; - FocusCheckBox *fReadOtherCheckBox; + FocusCheckBox* fReadUserCheckBox; + FocusCheckBox* fReadGroupCheckBox; + FocusCheckBox* fReadOtherCheckBox; - FocusCheckBox *fWriteUserCheckBox; - FocusCheckBox *fWriteGroupCheckBox; - FocusCheckBox *fWriteOtherCheckBox; + FocusCheckBox* fWriteUserCheckBox; + FocusCheckBox* fWriteGroupCheckBox; + FocusCheckBox* fWriteOtherCheckBox; - FocusCheckBox *fExecuteUserCheckBox; - FocusCheckBox *fExecuteGroupCheckBox; - FocusCheckBox *fExecuteOtherCheckBox; + FocusCheckBox* fExecuteUserCheckBox; + FocusCheckBox* fExecuteGroupCheckBox; + FocusCheckBox* fExecuteOtherCheckBox; - BTextControl *fOwnerTextControl; - BTextControl *fGroupTextControl; + BTextControl* fOwnerTextControl; + BTextControl* fGroupTextControl; typedef BView _inherited; }; + } // namespace BPrivate using namespace BPrivate; -#endif /* FILE_PERMISSIONS_VIEW_H */ +#endif // FILE_PERMISSIONS_VIEW_H diff --git a/src/kits/tracker/FindPanel.cpp b/src/kits/tracker/FindPanel.cpp index 1f74cf32cd..55643e2a4b 100644 --- a/src/kits/tracker/FindPanel.cpp +++ b/src/kits/tracker/FindPanel.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include @@ -79,7 +80,7 @@ All rights reserved. #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "FindPanel" -const char *kAllMimeTypes = "mime/ALLTYPES"; +const char* kAllMimeTypes = "mime/ALLTYPES"; const BRect kInitialRect(100, 100, 530, 210); const int32 kInitialAttrModeWindowHeight = 140; @@ -94,7 +95,7 @@ const uint32 kRunSaveAsTemplatePanel = 'svtm'; const char* kDragNDropTypes [] = { B_QUERY_MIMETYPE, B_QUERY_TEMPLATE_MIMETYPE }; -static const char *kDragNDropActionSpecifiers [] = { +static const char* kDragNDropActionSpecifiers [] = { B_TRANSLATE_MARK("Create a Query"), B_TRANSLATE_MARK("Create a Query template") }; @@ -105,26 +106,26 @@ namespace BPrivate { class MostUsedNames { public: - MostUsedNames(const char *fileName, const char *directory, int32 maxCount = 5); + MostUsedNames(const char* fileName, const char* directory, int32 maxCount = 5); ~MostUsedNames(); - bool ObtainList(BList *list); + bool ObtainList(BList* list); void ReleaseList(); - void AddName(const char *); + void AddName(const char*); protected: struct list_entry { - char *name; + char* name; int32 count; }; - static int CompareNames(const void *a, const void *b); + static int CompareNames(const void* a, const void* b); void LoadList(); void UpdateList(); - const char *fFileName; - const char *fDirectory; + const char* fFileName; + const char* fDirectory; bool fLoaded; mutable Benaphore fLock; BList fList; @@ -135,14 +136,14 @@ MostUsedNames gMostUsedMimeTypes("MostUsedMimeTypes", "Tracker"); void -MoreOptionsStruct::EndianSwap(void *) +MoreOptionsStruct::EndianSwap(void*) { // noop for now } void -MoreOptionsStruct::SetQueryTemporary(BNode *node, bool on) +MoreOptionsStruct::SetQueryTemporary(BNode* node, bool on) { MoreOptionsStruct saveMoreOptions; @@ -156,7 +157,7 @@ MoreOptionsStruct::SetQueryTemporary(BNode *node, bool on) bool -MoreOptionsStruct::QueryTemporary(const BNode *node) +MoreOptionsStruct::QueryTemporary(const BNode* node) { MoreOptionsStruct saveMoreOptions; @@ -229,13 +230,13 @@ FindWindow::~FindWindow() } -BFile * -FindWindow::TryOpening(const entry_ref *ref) +BFile* +FindWindow::TryOpening(const entry_ref* ref) { if (!ref) return NULL; - BFile *result = new BFile(ref, O_RDWR); + BFile* result = new BFile(ref, O_RDWR); if (result->InitCheck() != B_OK) { delete result; result = NULL; @@ -258,7 +259,7 @@ FindWindow::GetDefaultQuery(BEntry &entry) bool -FindWindow::IsQueryTemplate(BNode *file) +FindWindow::IsQueryTemplate(BNode* file) { char type[B_MIME_TYPE_LENGTH]; if (BNodeInfo(file).GetType(type) != B_OK) @@ -269,7 +270,7 @@ FindWindow::IsQueryTemplate(BNode *file) void -FindWindow::SwitchToTemplate(const entry_ref *ref) +FindWindow::SwitchToTemplate(const entry_ref* ref) { try { BEntry entry(ref, true); @@ -287,7 +288,7 @@ FindWindow::SwitchToTemplate(const entry_ref *ref) } -const char * +const char* FindWindow::QueryName() const { if (fFromTemplate) { @@ -303,7 +304,7 @@ FindWindow::QueryName() const } -static const char * +static const char* MakeValidFilename(BString &string) { // make a file name that is legal under bfs and hfs - possibly could @@ -315,7 +316,7 @@ MakeValidFilename(BString &string) // replace slashes int32 length = string.Length(); - char *buf = string.LockBuffer(length); + char* buf = string.LockBuffer(length); for (int32 index = length; index-- > 0;) if (buf[index] == '/' /*|| buf[index] == ':'*/) buf[index] = '_'; @@ -329,7 +330,7 @@ void FindWindow::GetPredicateString(BString &predicate, bool &dynamicDate) { BQuery query; - BTextControl *textControl = dynamic_cast(FindView("TextControl")); + BTextControl* textControl = dynamic_cast(FindView("TextControl")); switch (fBackground->Mode()) { case kByNameItem: fBackground->GetByNamePredicate(&query); @@ -367,7 +368,7 @@ FindWindow::GetDefaultName(BString &result) void -FindWindow::SaveQueryAttributes(BNode *file, bool queryTemplate) +FindWindow::SaveQueryAttributes(BNode* file, bool queryTemplate) { ThrowOnError( BNodeInfo(file).SetType( queryTemplate ? B_QUERY_TEMPLATE_MIMETYPE : B_QUERY_MIMETYPE) ); @@ -381,8 +382,8 @@ FindWindow::SaveQueryAttributes(BNode *file, bool queryTemplate) status_t -FindWindow::SaveQueryAsAttributes(BNode *file, BEntry *entry, bool queryTemplate, - const BMessage *oldAttributes, const BPoint *oldLocation) +FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry, bool queryTemplate, + const BMessage* oldAttributes, const BPoint* oldLocation) { if (oldAttributes) // revive old window settings @@ -407,7 +408,7 @@ FindWindow::SaveQueryAsAttributes(BNode *file, BEntry *entry, bool queryTemplate file->WriteAttr("_trk/recentQuery", B_INT32_TYPE, 0, &tmp, sizeof(int32)); // write some useful info to help locate the volume to query - BMenuItem *item = fBackground->VolMenu()->FindMarked(); + BMenuItem* item = fBackground->VolMenu()->FindMarked(); if (item) { dev_t dev; BMessage message; @@ -415,7 +416,7 @@ FindWindow::SaveQueryAsAttributes(BNode *file, BEntry *entry, bool queryTemplate int32 itemCount = fBackground->VolMenu()->CountItems(); for (int32 index = 2; index < itemCount; index++) { - BMenuItem *item = fBackground->VolMenu()->ItemAt(index); + BMenuItem* item = fBackground->VolMenu()->ItemAt(index); if (!item->IsMarked()) continue; @@ -448,17 +449,17 @@ FindWindow::SaveQueryAsAttributes(BNode *file, BEntry *entry, bool queryTemplate // write out all the dialog items as attributes so that the query can // be reopened and edited later - BView *focusedItem = CurrentFocus(); + BView* focusedItem = CurrentFocus(); if (focusedItem) { // text controls never get the focus, their internal text views do - BView *parent = focusedItem->Parent(); - if (dynamic_cast(parent)) + BView* parent = focusedItem->Parent(); + if (dynamic_cast(parent)) focusedItem = parent; // write out the current focus and, if text control, selection BString name(focusedItem->Name()); file->WriteAttrString("_trk/focusedView", &name); - BTextControl *textControl = dynamic_cast(focusedItem); + BTextControl* textControl = dynamic_cast(focusedItem); if (textControl) { int32 selStart, selEnd; textControl->TextView()->GetSelection(&selStart, &selEnd); @@ -488,7 +489,7 @@ FindWindow::Find() if (!FindSaveCommon(true)) { // have to wait for the node monitor to force old query to close // to avoid a race condition - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); ASSERT(tracker); for (int32 timeOut = 0; ; timeOut++) { if (!tracker->EntryHasWindowOpen(&fRef)) @@ -533,7 +534,7 @@ FindWindow::FindSaveCommon(bool find) BMessage oldAttributes; BPoint location; bool hadLocation = false; - const char *userSpecifiedName = fBackground->UserSpecifiedName(); + const char* userSpecifiedName = fBackground->UserSpecifiedName(); if (readFromOldFile) { entry.SetTo(&fRef); @@ -587,7 +588,7 @@ FindWindow::FindSaveCommon(bool find) void -FindWindow::MessageReceived(BMessage *message) +FindWindow::MessageReceived(BMessage* message) { switch (message->what) { case kFindButton: @@ -601,7 +602,7 @@ FindWindow::MessageReceived(BMessage *message) case kAttachFile: { entry_ref dir; - const char *name; + const char* name; bool queryTemplate; if (message->FindString("name", &name) == B_OK && message->FindRef("directory", &dir) == B_OK @@ -657,7 +658,7 @@ FindWindow::MessageReceived(BMessage *message) // #pragma mark - -FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent, +FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent, bool , bool editTemplateOnly) : BView(frame, "MainView", B_FOLLOW_ALL, B_WILL_DRAW), fMode(kByNameItem), @@ -714,7 +715,7 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent, rect.left = rect.right + 10; rect.right = rect.left + 100; rect.bottom = rect.top + 15; - BMenuField *menuField = new BMenuField(rect, "", "", fSearchModeMenu); + BMenuField* menuField = new BMenuField(rect, "", "", fSearchModeMenu); menuField->SetDivider(0.0f); AddChild(menuField); @@ -811,7 +812,7 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent, rect.top = rect.bottom - 30; rect.right = rect.left + 60; rect.bottom = rect.top + 20; - BButton *button; + BButton* button; if (editTemplateOnly) { button = new BButton(rect, "save", B_TRANSLATE("Save"), new BMessage(kSaveButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); @@ -832,7 +833,7 @@ FindPanel::~FindPanel() void FindPanel::AttachedToWindow() { - BNode *node = dynamic_cast(Window())->QueryNode(); + BNode* node = dynamic_cast(Window())->QueryNode(); fSearchModeMenu->SetTargetForItems(this); fQueryName->SetTarget(this); fLatch->SetTarget(fMoreOptionsPane); @@ -844,22 +845,22 @@ FindPanel::AttachedToWindow() if (!Window()->CurrentFocus()) { // try to pick a good focus if we restore to one already - BTextControl *textControl = dynamic_cast(FindView("TextControl")); + BTextControl* textControl = dynamic_cast(FindView("TextControl")); if (!textControl) { // pick the last text control in the attribute view BString title("TextEntry"); title << (fAttrViewList.CountItems() - 1); - textControl = dynamic_cast(FindView(title.String())); + textControl = dynamic_cast(FindView(title.String())); } if (textControl) textControl->MakeFocus(); } - BButton *button = dynamic_cast(FindView("remove")); + BButton* button = dynamic_cast(FindView("remove")); if (button) button->SetTarget(this); - button = dynamic_cast(FindView("add")); + button = dynamic_cast(FindView("add")); if (button) button->SetTarget(this); @@ -867,7 +868,7 @@ FindPanel::AttachedToWindow() // set target for MIME type items for (int32 index = MimeTypeMenu()->CountItems();index-- > 2;) { - BMenu *submenu = MimeTypeMenu()->ItemAt(index)->Submenu(); + BMenu* submenu = MimeTypeMenu()->ItemAt(index)->Submenu(); if (submenu != NULL) submenu->SetTargetForItems(this); } @@ -883,7 +884,7 @@ FindPanel::AttachedToWindow() const float kAttrViewDelta = 30; BRect -FindPanel::InitialViewSize(const BNode *node) +FindPanel::InitialViewSize(const BNode* node) { if (!node || InitialMode(node) != (int32)kByAttributeItem) return kInitialRect; @@ -936,10 +937,10 @@ FindPanel::BoxHeightForMode(uint32 mode, bool /*moreOptions*/) static void -PopUpMenuSetTitle(BMenu *menu, const char *title) +PopUpMenuSetTitle(BMenu* menu, const char* title) { // This should really be in BMenuField - BMenu *bar = menu->Supermenu(); + BMenu* bar = menu->Supermenu(); ASSERT(bar); ASSERT(bar->ItemAt(0)); @@ -962,9 +963,9 @@ FindPanel::ShowVolumeMenuLabel() // find out if more than one items are marked int32 count = fVolMenu->CountItems(); int32 countSelected = 0; - BMenuItem *tmpItem = NULL; + BMenuItem* tmpItem = NULL; for (int32 index = 2; index < count; index++) { - BMenuItem *item = fVolMenu->ItemAt(index); + BMenuItem* item = fVolMenu->ItemAt(index); if (item->IsMarked()) { countSelected++; tmpItem = item; @@ -989,24 +990,24 @@ FindPanel::ShowVolumeMenuLabel() void -FindPanel::MessageReceived(BMessage *message) +FindPanel::MessageReceived(BMessage* message) { entry_ref dir; - const char *name; + const char* name; switch (message->what) { case kVolumeItem: { // volume changed - BMenuItem *invokedItem; + BMenuItem* invokedItem; dev_t dev; - if (message->FindPointer("source", (void **)&invokedItem) != B_OK) + if (message->FindPointer("source", (void**)&invokedItem) != B_OK) return; if (message->FindInt32("device", &dev) != B_OK) break; - BMenu *menu = invokedItem->Menu(); + BMenu* menu = invokedItem->Menu(); ASSERT(menu); if (dev == -1) { @@ -1027,7 +1028,7 @@ FindPanel::MessageReceived(BMessage *message) // toggle mark on invoked item int32 count = menu->CountItems(); for (int32 index = 2; index < count; index++) { - BMenuItem *item = menu->ItemAt(index); + BMenuItem* item = menu->ItemAt(index); if (invokedItem == item) { // we just selected this @@ -1058,8 +1059,8 @@ FindPanel::MessageReceived(BMessage *message) case kMIMETypeItem: { - BMenuItem *item; - if (message->FindPointer("source", (void **)&item) == B_OK) { + BMenuItem* item; + if (message->FindPointer("source", (void**)&item) == B_OK) { // don't add the "All files and folders" to the list if (fMimeTypeMenu->IndexOf(item) != 0) gMostUsedMimeTypes.AddName(item->Label()); @@ -1077,7 +1078,7 @@ FindPanel::MessageReceived(BMessage *message) Window()->ResizeTo(Window()->Frame().Width(), ViewHeightForMode(kByAttributeItem, fLatch->Value() != 0)); - BBox *box = dynamic_cast(FindView("Box")); + BBox* box = dynamic_cast(FindView("Box")); ASSERT(box); box->ResizeTo(box->Bounds().Width(), BoxHeightForMode(kByAttributeItem, fLatch->Value() != 0)); @@ -1119,9 +1120,9 @@ FindPanel::MessageReceived(BMessage *message) case B_COPY_TARGET: { // finish drag&drop - const char *str; - const char *mimeType = NULL; - const char *actionSpecifier = NULL; + const char* str; + const char* mimeType = NULL; + const char* actionSpecifier = NULL; if (message->FindString("be:types", &str) == B_OK && strcasecmp(str, B_FILE_MIME_TYPE) == 0 && (message->FindString("be:actionspecifier", &actionSpecifier) == B_OK @@ -1162,7 +1163,7 @@ FindPanel::MessageReceived(BMessage *message) void -FindPanel::SaveAsQueryOrTemplate(const entry_ref *dir, const char *name, bool queryTemplate) +FindPanel::SaveAsQueryOrTemplate(const entry_ref* dir, const char* name, bool queryTemplate) { BDirectory directory(dir); BFile file(&directory, name, O_RDWR | O_CREAT | O_TRUNC); @@ -1177,35 +1178,35 @@ FindPanel::SaveAsQueryOrTemplate(const entry_ref *dir, const char *name, bool qu void -FindPanel::BuildAttrQuery(BQuery *query, bool &dynamicDate) const +FindPanel::BuildAttrQuery(BQuery* query, bool &dynamicDate) const { dynamicDate = false; // go through each attrview and add the attr and comparison info for (int32 index = 0; index < fAttrViewList.CountItems(); index++) { - TAttrView *view = fAttrViewList.ItemAt(index); + TAttrView* view = fAttrViewList.ItemAt(index); BString title; title << "TextEntry" << index; - BTextControl *textControl = dynamic_cast + BTextControl* textControl = dynamic_cast (view->FindView(title.String())); if (!textControl) return; - BMenuField *menuField = dynamic_cast(view->FindView("MenuField")); + BMenuField* menuField = dynamic_cast(view->FindView("MenuField")); if (!menuField) return; - BMenuItem *item = menuField->Menu()->FindMarked(); + BMenuItem* item = menuField->Menu()->FindMarked(); if (!item) continue; - BMessage *message = item->Message(); + BMessage* message = item->Message(); int32 type; if (message->FindInt32("type", &type) == B_OK) { - const char *str; + const char* str; if (message->FindString("name", &str) == B_OK) query->PushAttr(str); else @@ -1286,22 +1287,22 @@ FindPanel::BuildAttrQuery(BQuery *query, bool &dynamicDate) const } query_op theOperator; - BMenuItem *operatorItem = item->Submenu()->FindMarked(); + BMenuItem* operatorItem = item->Submenu()->FindMarked(); if (operatorItem && operatorItem->Message() != NULL) { - operatorItem->Message()->FindInt32("operator", (int32 *)&theOperator); + operatorItem->Message()->FindInt32("operator", (int32*)&theOperator); query->PushOp(theOperator); } else query->PushOp(B_EQ); // add logic based on selection in Logic menufield if (index > 0) { - TAttrView *prevView = fAttrViewList.ItemAt(index - 1); - menuField = dynamic_cast(prevView->FindView("Logic")); + TAttrView* prevView = fAttrViewList.ItemAt(index - 1); + menuField = dynamic_cast(prevView->FindView("Logic")); if (menuField) { item = menuField->Menu()->FindMarked(); if (item) { message = item->Message(); - message->FindInt32("combine", (int32 *)&theOperator); + message->FindInt32("combine", (int32*)&theOperator); query->PushOp(theOperator); } } else @@ -1312,9 +1313,9 @@ FindPanel::BuildAttrQuery(BQuery *query, bool &dynamicDate) const void -FindPanel::PushMimeType(BQuery *query) const +FindPanel::PushMimeType(BQuery* query) const { - const char *type; + const char* type; if (CurrentMimeType(&type) == NULL) return; @@ -1336,7 +1337,7 @@ FindPanel::PushMimeType(BQuery *query) const void -FindPanel::GetByAttrPredicate(BQuery *query, bool &dynamicDate) const +FindPanel::GetByAttrPredicate(BQuery* query, bool &dynamicDate) const { ASSERT(Mode() == (int32)kByAttributeItem); BuildAttrQuery(query, dynamicDate); @@ -1347,7 +1348,7 @@ FindPanel::GetByAttrPredicate(BQuery *query, bool &dynamicDate) const void FindPanel::GetDefaultName(BString &result) const { - BTextControl *textControl = dynamic_cast(FindView("TextControl")); + BTextControl* textControl = dynamic_cast(FindView("TextControl")); switch (Mode()) { case kByNameItem: result.SetTo(B_TRANSLATE_COMMENT("Name = %name", @@ -1363,7 +1364,7 @@ FindPanel::GetDefaultName(BString &result) const case kByAttributeItem: { - BMenuItem *item = fMimeTypeMenu->FindMarked(); + BMenuItem* item = fMimeTypeMenu->FindMarked(); if (item != NULL) result << item->Label() << ": "; @@ -1378,7 +1379,7 @@ FindPanel::GetDefaultName(BString &result) const } -const char * +const char* FindPanel::UserSpecifiedName() const { if (fQueryName->Text()[0] == '\0') @@ -1389,10 +1390,10 @@ FindPanel::UserSpecifiedName() const void -FindPanel::GetByNamePredicate(BQuery *query) const +FindPanel::GetByNamePredicate(BQuery* query) const { ASSERT(Mode() == (int32)kByNameItem); - BTextControl *textControl = dynamic_cast(FindView("TextControl")); + BTextControl* textControl = dynamic_cast(FindView("TextControl")); ASSERT(textControl); query->PushAttr("name"); @@ -1415,7 +1416,7 @@ FindPanel::SwitchMode(uint32 mode) // no work, bail return; - BBox *box = dynamic_cast(FindView("Box")); + BBox* box = dynamic_cast(FindView("Box")); ASSERT(box); uint32 oldMode = fMode; @@ -1453,7 +1454,7 @@ FindPanel::SwitchMode(uint32 mode) if (buffer.Length()) { ASSERT(mode == kByFormulaItem || oldMode == kByAttributeItem); - BTextControl *textControl = dynamic_cast + BTextControl* textControl = dynamic_cast (FindView("TextControl")); textControl->SetText(buffer.String()); } @@ -1469,7 +1470,7 @@ FindPanel::SwitchMode(uint32 mode) Window()->ResizeTo(Window()->Frame().Width(), ViewHeightForMode(mode, fLatch->Value() != 0)); - BTextControl *textControl = dynamic_cast + BTextControl* textControl = dynamic_cast (FindView("TextControl")); if (textControl) { @@ -1485,11 +1486,11 @@ FindPanel::SwitchMode(uint32 mode) } -BMenuItem * -FindPanel::CurrentMimeType(const char **type) const +BMenuItem* +FindPanel::CurrentMimeType(const char** type) const { // search for marked item in the list - BMenuItem *item = MimeTypeMenu()->FindMarked(); + BMenuItem* item = MimeTypeMenu()->FindMarked(); // if it's one of the most used items, ignore it if (item != NULL && MimeTypeMenu()->IndexOf(item) != 0 && item->Submenu() == NULL) @@ -1497,14 +1498,14 @@ FindPanel::CurrentMimeType(const char **type) const if (item == NULL) { for (int32 index = MimeTypeMenu()->CountItems(); index-- > 0;) { - BMenu *submenu = MimeTypeMenu()->ItemAt(index)->Submenu(); + BMenu* submenu = MimeTypeMenu()->ItemAt(index)->Submenu(); if (submenu != NULL && (item = submenu->FindMarked()) != NULL) break; } } if (type && item != NULL) { - BMessage *message = item->Message(); + BMessage* message = item->Message(); if (!message) return NULL; @@ -1516,11 +1517,11 @@ FindPanel::CurrentMimeType(const char **type) const status_t -FindPanel::SetCurrentMimeType(BMenuItem *item) +FindPanel::SetCurrentMimeType(BMenuItem* item) { // unmark old MIME type (in most used list, and the tree) - BMenuItem *marked = CurrentMimeType(); + BMenuItem* marked = CurrentMimeType(); if (marked != NULL) { marked->SetMarked(false); @@ -1534,7 +1535,7 @@ FindPanel::SetCurrentMimeType(BMenuItem *item) item->SetMarked(true); fMimeTypeField->MenuItem()->SetLabel(item->Label()); - BMenuItem *search; + BMenuItem* search; for (int32 i = 2;(search = MimeTypeMenu()->ItemAt(i)) != NULL;i++) { if (item == search || !search->Label()) continue; @@ -1542,10 +1543,10 @@ FindPanel::SetCurrentMimeType(BMenuItem *item) search->SetMarked(true); break; } - BMenu *submenu = search->Submenu(); + BMenu* submenu = search->Submenu(); if (submenu) { for (int32 j = submenu->CountItems();j-- > 0;) { - BMenuItem *sub = submenu->ItemAt(j); + BMenuItem* sub = submenu->ItemAt(j); if (!strcmp(item->Label(),sub->Label())) { sub->SetMarked(true); break; @@ -1559,11 +1560,11 @@ FindPanel::SetCurrentMimeType(BMenuItem *item) status_t -FindPanel::SetCurrentMimeType(const char *label) +FindPanel::SetCurrentMimeType(const char* label) { // unmark old MIME type (in most used list, and the tree) - BMenuItem *marked = CurrentMimeType(); + BMenuItem* marked = CurrentMimeType(); if (marked != NULL) { marked->SetMarked(false); @@ -1577,11 +1578,11 @@ FindPanel::SetCurrentMimeType(const char *label) bool found = false; for (int32 index = MimeTypeMenu()->CountItems(); index-- > 0;) { - BMenuItem *item = MimeTypeMenu()->ItemAt(index); - BMenu *submenu = item->Submenu(); + BMenuItem* item = MimeTypeMenu()->ItemAt(index); + BMenu* submenu = item->Submenu(); if (submenu != NULL && !found) { for (int32 subIndex = submenu->CountItems(); subIndex-- > 0;) { - BMenuItem *subItem = submenu->ItemAt(subIndex); + BMenuItem* subItem = submenu->ItemAt(subIndex); if (subItem->Label() != NULL && !strcmp(label, subItem->Label())) { subItem->SetMarked(true); found = true; @@ -1599,9 +1600,9 @@ FindPanel::SetCurrentMimeType(const char *label) bool -FindPanel::AddOneMimeTypeToMenu(const ShortMimeInfo *info, void *castToMenu) +FindPanel::AddOneMimeTypeToMenu(const ShortMimeInfo* info, void* castToMenu) { - BPopUpMenu *menu = static_cast(castToMenu); + BPopUpMenu* menu = static_cast(castToMenu); BMimeType type(info->InternalName()); BMimeType super; @@ -1609,9 +1610,9 @@ FindPanel::AddOneMimeTypeToMenu(const ShortMimeInfo *info, void *castToMenu) if (super.InitCheck() < B_OK) return false; - BMenuItem *superItem = menu->FindItem(super.Type()); + BMenuItem* superItem = menu->FindItem(super.Type()); if (superItem != NULL) { - BMessage *msg = new BMessage(kMIMETypeItem); + BMessage* msg = new BMessage(kMIMETypeItem); msg->AddString("mimetype", info->InternalName()); superItem->Submenu()->AddItem(new IconMenuItem(info->ShortDescription(), @@ -1625,7 +1626,7 @@ FindPanel::AddOneMimeTypeToMenu(const ShortMimeInfo *info, void *castToMenu) void FindPanel::AddMimeTypesToMenu() { - BMessage *itemMessage = new BMessage(kMIMETypeItem); + BMessage* itemMessage = new BMessage(kMIMETypeItem); itemMessage->AddString("mimetype", kAllMimeTypes); MimeTypeMenu()->AddItem(new BMenuItem(B_TRANSLATE("All files and folders"), itemMessage)); @@ -1634,19 +1635,19 @@ FindPanel::AddMimeTypesToMenu() // add recent MIME types - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); BList list; if (gMostUsedMimeTypes.ObtainList(&list) && tracker) { int32 count = 0; for (int32 index = 0; index < list.CountItems(); index++) { - const char *name = (const char *)list.ItemAt(index); + const char* name = (const char*)list.ItemAt(index); - const ShortMimeInfo *info; + const ShortMimeInfo* info; if ((info = tracker->MimeTypes()->FindMimeType(name)) == NULL) continue; - BMessage *message = new BMessage(kMIMETypeItem); + BMessage* message = new BMessage(kMIMETypeItem); message->AddString("mimetype", info->InternalName()); MimeTypeMenu()->AddItem(new BMenuItem(name, message)); @@ -1662,13 +1663,13 @@ FindPanel::AddMimeTypesToMenu() BMessage types; if (BMimeType::GetInstalledSupertypes(&types) == B_OK) { - const char *superType; + const char* superType; int32 index = 0; while (types.FindString("super_types",index++,&superType) == B_OK) { - BMenu *superMenu = new BMenu(superType); + BMenu* superMenu = new BMenu(superType); - BMessage *message = new BMessage(kMIMETypeItem); + BMessage* message = new BMessage(kMIMETypeItem); message->AddString("mimetype", superType); MimeTypeMenu()->AddItem(new IconMenuItem(superMenu, message, @@ -1686,8 +1687,8 @@ FindPanel::AddMimeTypesToMenu() // remove empty super type menus (and set target) for (int32 index = MimeTypeMenu()->CountItems();index-- > 2;) { - BMenuItem *item = MimeTypeMenu()->ItemAt(index); - BMenu *submenu = item->Submenu(); + BMenuItem* item = MimeTypeMenu()->ItemAt(index); + BMenu* submenu = item->Submenu(); if (submenu != NULL) { if (submenu->CountItems() == 0) { MimeTypeMenu()->RemoveItem(item); @@ -1702,11 +1703,11 @@ FindPanel::AddMimeTypesToMenu() void -FindPanel::AddVolumes(BMenu *menu) +FindPanel::AddVolumes(BMenu* menu) { // ToDo: add calls to this to rebuild the menu when a volume gets mounted - BMessage *message = new BMessage(kVolumeItem); + BMessage* message = new BMessage(kVolumeItem); message->AddInt32("device", -1); menu->AddItem(new BMenuItem(B_TRANSLATE("All disks"), message)); menu->AddSeparatorItem(); @@ -1744,30 +1745,30 @@ FindPanel::AddVolumes(BMenu *menu) typedef std::pair EntryWithDate; static int -SortByDatePredicate(const EntryWithDate *entry1, const EntryWithDate *entry2) +SortByDatePredicate(const EntryWithDate* entry1, const EntryWithDate* entry2) { return entry1->second > entry2->second ? -1 : (entry1->second == entry2->second ? 0 : 1); } struct AddOneRecentParams { - BMenu *menu; - const BMessenger *target; + BMenu* menu; + const BMessenger* target; uint32 what; }; -static const entry_ref * -AddOneRecentItem(const entry_ref *ref, void *castToParams) +static const entry_ref* +AddOneRecentItem(const entry_ref* ref, void* castToParams) { - AddOneRecentParams *params = (AddOneRecentParams *)castToParams; + AddOneRecentParams* params = (AddOneRecentParams*)castToParams; - BMessage *message = new BMessage(params->what); + BMessage* message = new BMessage(params->what); message->AddRef("refs", ref); char type[B_MIME_TYPE_LENGTH]; BNode node(ref); BNodeInfo(&node).GetType(type); - BMenuItem *item = new IconMenuItem(ref->name, message, type, B_MINI_ICON); + BMenuItem* item = new IconMenuItem(ref->name, message, type, B_MINI_ICON); item->SetTarget(*params->target); params->menu->AddItem(item); @@ -1776,7 +1777,7 @@ AddOneRecentItem(const entry_ref *ref, void *castToParams) void -FindPanel::AddRecentQueries(BMenu *menu, bool addSaveAsItem, const BMessenger *target, +FindPanel::AddRecentQueries(BMenu* menu, bool addSaveAsItem, const BMessenger* target, uint32 what) { BObjectList templates(10, true); @@ -1847,7 +1848,7 @@ FindPanel::AddRecentQueries(BMenu *menu, bool addSaveAsItem, const BMessenger *t if (count || templates.CountItems()) menu->AddSeparatorItem(); - BMessage *message = new BMessage(kRunSaveAsTemplatePanel); + BMessage* message = new BMessage(kRunSaveAsTemplatePanel); BMenuItem* item = new BMenuItem( B_TRANSLATE("Save Query as template"B_UTF8_ELLIPSIS), message); menu->AddItem(item); @@ -1856,9 +1857,9 @@ FindPanel::AddRecentQueries(BMenu *menu, bool addSaveAsItem, const BMessenger *t void -FindPanel::AddOneAttributeItem(BBox *box, BRect rect) +FindPanel::AddOneAttributeItem(BBox* box, BRect rect) { - TAttrView *attrView = new TAttrView(rect, fAttrViewList.CountItems()); + TAttrView* attrView = new TAttrView(rect, fAttrViewList.CountItems()); fAttrViewList.AddItem(attrView); box->AddChild(attrView); @@ -1867,10 +1868,10 @@ FindPanel::AddOneAttributeItem(BBox *box, BRect rect) void -FindPanel::SetUpAddRemoveButtons(BBox *box) +FindPanel::SetUpAddRemoveButtons(BBox* box) { - BButton *button = Window() != NULL - ? dynamic_cast(Window()->FindView("remove")) + BButton* button = Window() != NULL + ? dynamic_cast(Window()->FindView("remove")) : NULL; if (button == NULL) { BRect rect = box->Bounds(); @@ -1880,7 +1881,7 @@ FindPanel::SetUpAddRemoveButtons(BBox *box) + be_plain_font->StringWidth(B_TRANSLATE("Add")); button = new BButton(rect, "add", B_TRANSLATE("Add"), - new BMessage(kAddItem), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); + new BMessage(kAddItem), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); button->SetTarget(this); box->AddChild(button); @@ -1900,7 +1901,7 @@ FindPanel::SetUpAddRemoveButtons(BBox *box) void -FindPanel::FillCurrentQueryName(BTextControl *queryName, FindWindow *window) +FindPanel::FillCurrentQueryName(BTextControl* queryName, FindWindow* window) { ASSERT(window); queryName->SetText(window->QueryName()); @@ -1910,10 +1911,10 @@ FindPanel::FillCurrentQueryName(BTextControl *queryName, FindWindow *window) void FindPanel::AddAttrView() { - BBox *box = dynamic_cast(FindView("Box")); + BBox* box = dynamic_cast(FindView("Box")); BRect bounds(Bounds()); - TAttrView *previous = fAttrViewList.LastItem(); + TAttrView* previous = fAttrViewList.LastItem(); if (previous) Window()->ResizeBy(0, 30); @@ -1940,7 +1941,7 @@ FindPanel::AddAttrView() SetUpAddRemoveButtons(box); // populate mime popup - TAttrView *last = fAttrViewList.LastItem(); + TAttrView* last = fAttrViewList.LastItem(); last->AddMimeTypeAttrs(); } @@ -1951,8 +1952,8 @@ FindPanel::RemoveAttrView() if (fAttrViewList.CountItems() < 2) return; - BBox *box = dynamic_cast(FindView("Box")); - TAttrView *attrView = fAttrViewList.LastItem(); + BBox* box = dynamic_cast(FindView("Box")); + TAttrView* attrView = fAttrViewList.LastItem(); if (!box || !attrView) return; @@ -1973,21 +1974,21 @@ FindPanel::RemoveAttrView() if (fAttrViewList.CountItems() != 1) return; - BButton *button = dynamic_cast(Window()->FindView("remove")); + BButton* button = dynamic_cast(Window()->FindView("remove")); if (button) button->SetEnabled(false); } uint32 -FindPanel::InitialMode(const BNode *node) +FindPanel::InitialMode(const BNode* node) { if (!node || node->InitCheck() != B_OK) return kByNameItem; uint32 result; if (node->ReadAttr(kAttrQueryInitialMode, B_INT32_TYPE, 0, - (int32 *)&result, sizeof(int32)) <= 0) + (int32*)&result, sizeof(int32)) <= 0) return kByNameItem; return result; @@ -1995,7 +1996,7 @@ FindPanel::InitialMode(const BNode *node) int32 -FindPanel::InitialAttrCount(const BNode *node) +FindPanel::InitialAttrCount(const BNode* node) { if (!node || node->InitCheck() != B_OK) return 1; @@ -2010,10 +2011,10 @@ FindPanel::InitialAttrCount(const BNode *node) static int32 -SelectItemWithLabel(BMenu *menu, const char *label) +SelectItemWithLabel(BMenu* menu, const char* label) { for (int32 index = menu->CountItems(); index-- > 0;) { - BMenuItem *item = menu->ItemAt(index); + BMenuItem* item = menu->ItemAt(index); if (strcmp(label, item->Label()) == 0) { item->SetMarked(true); @@ -2025,11 +2026,11 @@ SelectItemWithLabel(BMenu *menu, const char *label) void -FindPanel::SaveWindowState(BNode *node, bool editTemplate) +FindPanel::SaveWindowState(BNode* node, bool editTemplate) { ASSERT(node->InitCheck() == B_OK); - BMenuItem *item = CurrentMimeType(); + BMenuItem* item = CurrentMimeType(); if (item) { BString label(item->Label()); node->WriteAttrString(kAttrQueryInitialMime, &label); @@ -2037,7 +2038,7 @@ FindPanel::SaveWindowState(BNode *node, bool editTemplate) uint32 mode = Mode(); node->WriteAttr(kAttrQueryInitialMode, B_INT32_TYPE, 0, - (int32 *)&mode, sizeof(int32)); + (int32*)&mode, sizeof(int32)); MoreOptionsStruct saveMoreOptions; saveMoreOptions.showMoreOptions = fLatch->Value() != 0; @@ -2068,7 +2069,7 @@ FindPanel::SaveWindowState(BNode *node, bool editTemplate) fAttrViewList.ItemAt(index)->SaveState(&message, index); ssize_t size = message.FlattenedSize(); - char *buffer = new char[size]; + char* buffer = new char[size]; status_t result = message.Flatten(buffer, size); if (result == B_OK) { node->WriteAttr(kAttrQueryInitialAttrs, B_MESSAGE_TYPE, 0, @@ -2081,7 +2082,7 @@ FindPanel::SaveWindowState(BNode *node, bool editTemplate) case kByNameItem: case kByFormulaItem: { - BTextControl *textControl = dynamic_cast + BTextControl* textControl = dynamic_cast (FindView("TextControl")); ASSERT(textControl); BString formula(textControl->TextView()->Text()); @@ -2093,7 +2094,7 @@ FindPanel::SaveWindowState(BNode *node, bool editTemplate) void -FindPanel::SwitchToTemplate(const BNode *node) +FindPanel::SwitchToTemplate(const BNode* node) { if (fLatch->Value()) { // this is kind of a hack - the following code up to @@ -2122,7 +2123,7 @@ FindPanel::SwitchToTemplate(const BNode *node) void -FindPanel::RestoreMimeTypeMenuSelection(const BNode *node) +FindPanel::RestoreMimeTypeMenuSelection(const BNode* node) { if (Mode() == (int32)kByFormulaItem || node == NULL || node->InitCheck() != B_OK) return; @@ -2134,7 +2135,7 @@ FindPanel::RestoreMimeTypeMenuSelection(const BNode *node) void -FindPanel::RestoreWindowState(const BNode *node) +FindPanel::RestoreWindowState(const BNode* node) { fMode = InitialMode(node); if (!node || node->InitCheck() != B_OK) @@ -2163,7 +2164,7 @@ FindPanel::RestoreWindowState(const BNode *node) fTemporaryCheck->SetValue(saveMoreOptions.temporary); fQueryName->SetModificationMessage(NULL); - FillCurrentQueryName(fQueryName, dynamic_cast(Window())); + FillCurrentQueryName(fQueryName, dynamic_cast(Window())); // set modification message after checking the temporary check box, // and filling out the text control so that we do not @@ -2176,7 +2177,7 @@ FindPanel::RestoreWindowState(const BNode *node) attr_info info; if (node->GetAttrInfo(kAttrQueryVolume, &info) == B_OK) { - char *buffer = new char[info.size]; + char* buffer = new char[info.size]; if (node->ReadAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0, buffer, (size_t)info.size) == info.size) { BMessage message; @@ -2213,7 +2214,7 @@ FindPanel::RestoreWindowState(const BNode *node) attr_info info; if (node->GetAttrInfo(kAttrQueryInitialAttrs, &info) != B_OK) break; - char *buffer = new char[info.size]; + char* buffer = new char[info.size]; if (node->ReadAttr(kAttrQueryInitialAttrs, B_MESSAGE_TYPE, 0, buffer, (size_t)info.size) == info.size) { BMessage message; @@ -2230,7 +2231,7 @@ FindPanel::RestoreWindowState(const BNode *node) { BString buffer; if (node->ReadAttrString(kAttrQueryInitialString, &buffer) == B_OK) { - BTextControl *textControl = dynamic_cast + BTextControl* textControl = dynamic_cast (FindView("TextControl")); ASSERT(textControl); @@ -2243,10 +2244,10 @@ FindPanel::RestoreWindowState(const BNode *node) // try to restore focus and possibly text selection BString focusedView; if (node->ReadAttrString("_trk/focusedView", &focusedView) == B_OK) { - BView *view = FindView(focusedView.String()); + BView* view = FindView(focusedView.String()); if (view != NULL) { view->MakeFocus(); - BTextControl *textControl = dynamic_cast(view); + BTextControl* textControl = dynamic_cast(view); if (textControl != NULL && Mode() == kByFormulaItem) { int32 selStart = 0; int32 selEnd = LONG_MAX; @@ -2262,9 +2263,9 @@ FindPanel::RestoreWindowState(const BNode *node) void -FindPanel::ResizeAttributeBox(const BNode *node) +FindPanel::ResizeAttributeBox(const BNode* node) { - BBox *box = dynamic_cast(FindView("Box")); + BBox* box = dynamic_cast(FindView("Box")); BRect bounds(box->Bounds()); int32 count = InitialAttrCount(node); @@ -2274,9 +2275,9 @@ FindPanel::ResizeAttributeBox(const BNode *node) void -FindPanel::AddByAttributeItems(const BNode *node) +FindPanel::AddByAttributeItems(const BNode* node) { - BBox *box = dynamic_cast(FindView("Box")); + BBox* box = dynamic_cast(FindView("Box")); ASSERT(box); BRect bounds(box->Bounds()); @@ -2299,11 +2300,11 @@ FindPanel::AddByAttributeItems(const BNode *node) void FindPanel::AddByNameOrFormulaItems() { - BBox *box = dynamic_cast(FindView("Box")); + BBox* box = dynamic_cast(FindView("Box")); BRect bounds(box->Bounds()); bounds.InsetBy(10, 10); - BTextControl *textControl = new BTextControl(bounds, "TextControl", "", "", NULL); + BTextControl* textControl = new BTextControl(bounds, "TextControl", "", "", NULL); textControl->SetDivider(0.0f); box->AddChild(textControl); textControl->MakeFocus(); @@ -2314,7 +2315,7 @@ void FindPanel::RemoveAttrViewItems() { for (;;) { - BView *view = FindView("AttrView"); + BView* view = FindView("AttrView"); if (view == NULL) break; view->RemoveSelf(); @@ -2329,7 +2330,7 @@ void FindPanel::RemoveByAttributeItems() { RemoveAttrViewItems(); - BView *view = FindView("add"); + BView* view = FindView("add"); if (view) { view->RemoveSelf(); delete view; @@ -2341,7 +2342,7 @@ FindPanel::RemoveByAttributeItems() delete view; } - view = dynamic_cast(FindView("TextControl")); + view = dynamic_cast(FindView("TextControl")); if (view) { view->RemoveSelf(); delete view; @@ -2352,7 +2353,7 @@ FindPanel::RemoveByAttributeItems() void FindPanel::ShowOrHideMimeTypeMenu() { - BMenuField *menuField = dynamic_cast(FindView("MimeTypeMenu")); + BMenuField* menuField = dynamic_cast(FindView("MimeTypeMenu")); if (Mode() == (int32)kByFormulaItem && !menuField->IsHidden()) menuField->Hide(); else if (menuField->IsHidden()) @@ -2369,16 +2370,16 @@ TAttrView::TAttrView(BRect frame, int32 index) SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - BPopUpMenu *menu = new BPopUpMenu("PopUp"); + BPopUpMenu* menu = new BPopUpMenu("PopUp"); // add NAME attribute to popup BMenu* submenu = new BMenu(B_TRANSLATE("Name")); submenu->SetRadioMode(true); submenu->SetFont(be_plain_font); - BMessage *message = new BMessage(kAttributeItemMain); + BMessage* message = new BMessage(kAttributeItemMain); message->AddString("name", "name"); message->AddInt32("type", B_STRING_TYPE); - BMenuItem *item = new BMenuItem(submenu, message); + BMenuItem* item = new BMenuItem(submenu, message); menu->AddItem(item); const int32 operators[] = { @@ -2387,7 +2388,7 @@ TAttrView::TAttrView(BRect frame, int32 index) B_NE, B_BEGINS_WITH, B_ENDS_WITH}; - static const char *operatorLabels[] = { + static const char* operatorLabels[] = { B_TRANSLATE_MARK("contains"), B_TRANSLATE_MARK("is"), B_TRANSLATE_MARK("is not"), @@ -2475,7 +2476,7 @@ TAttrView::~TAttrView() void TAttrView::AttachedToWindow() { - BMenu *menu = fMenuField->Menu(); + BMenu* menu = fMenuField->Menu(); // target everything menu->SetTargetForItems(this); @@ -2494,12 +2495,12 @@ TAttrView::MakeTextViewFocus() void TAttrView::RestoreState(const BMessage &message, int32 index) { - BMenu *menu = fMenuField->Menu(); + BMenu* menu = fMenuField->Menu(); // decode menu selections AddMimeTypeAttrs(menu); - const char *label; + const char* label; if (message.FindString("menuSelection", index, &label) == B_OK) { int32 itemIndex = SelectItemWithLabel(menu, label); if (itemIndex >=0) { @@ -2512,12 +2513,12 @@ TAttrView::RestoreState(const BMessage &message, int32 index) // decode attribute text ASSERT(fTextControl); - const char *string; + const char* string; if (message.FindString("attrViewText", index, &string) == B_OK) fTextControl->TextView()->SetText(string); int32 logicMenuSelectedIndex; - BMenuField *field = dynamic_cast(FindView("Logic")); + BMenuField* field = dynamic_cast(FindView("Logic")); if (message.FindInt32("logicalRelation", index, &logicMenuSelectedIndex) == B_OK) { if (field) @@ -2529,18 +2530,18 @@ TAttrView::RestoreState(const BMessage &message, int32 index) void -TAttrView::SaveState(BMessage *message, int32) +TAttrView::SaveState(BMessage* message, int32) { - BMenu *menu = fMenuField->Menu(); + BMenu* menu = fMenuField->Menu(); // encode main attribute menu selection - BMenuItem *item = menu->FindMarked(); + BMenuItem* item = menu->FindMarked(); message->AddString("menuSelection", item ? item->Label() : ""); // encode submenu selection - const char *label = ""; + const char* label = ""; if (item) { - BMenu *submenu = menu->SubmenuAt(menu->IndexOf(item)); + BMenu* submenu = menu->SubmenuAt(menu->IndexOf(item)); if (submenu) { item = submenu->FindMarked(); if (item) @@ -2553,9 +2554,9 @@ TAttrView::SaveState(BMessage *message, int32) ASSERT(fTextControl); message->AddString("attrViewText", fTextControl->TextView()->Text()); - BMenuField *field = dynamic_cast(FindView("Logic")); + BMenuField* field = dynamic_cast(FindView("Logic")); if (field) { - BMenuItem *item = field->Menu()->FindMarked(); + BMenuItem* item = field->Menu()->FindMarked(); ASSERT(item); message->AddInt32("logicalRelation", item ? field->Menu()->IndexOf(item) : 0); } @@ -2565,8 +2566,8 @@ void TAttrView::AddLogicMenu(bool selectAnd) { // add "AND/OR" menu - BPopUpMenu *menu = new BPopUpMenu(""); - BMessage *message = new BMessage(); + BPopUpMenu* menu = new BPopUpMenu(""); + BMessage* message = new BMessage(); message->AddInt32("combine", B_AND); BMenuItem* item = new BMenuItem(B_TRANSLATE("And"), message); menu->AddItem(item); @@ -2585,7 +2586,7 @@ TAttrView::AddLogicMenu(bool selectAnd) BRect bounds(Bounds()); bounds.left = bounds.right - 40; bounds.bottom = bounds.top + 15; - BMenuField *menufield = new BMenuField(bounds, "Logic", "", menu); + BMenuField* menufield = new BMenuField(bounds, "Logic", "", menu); menufield->SetDivider(0.0f); menufield->HidePopUpMarker(); AddChild(menufield); @@ -2595,7 +2596,7 @@ TAttrView::AddLogicMenu(bool selectAnd) void TAttrView::RemoveLogicMenu() { - BMenuField *menufield = dynamic_cast(FindView("Logic")); + BMenuField* menufield = dynamic_cast(FindView("Logic")); if (menufield) { menufield->RemoveSelf(); delete menufield; @@ -2606,7 +2607,7 @@ TAttrView::RemoveLogicMenu() void TAttrView::Draw(BRect) { - BMenuItem *item = fMenuField->Menu()->FindMarked(); + BMenuItem* item = fMenuField->Menu()->FindMarked(); if (!item) return; @@ -2623,13 +2624,13 @@ TAttrView::Draw(BRect) void -TAttrView::MessageReceived(BMessage *message) +TAttrView::MessageReceived(BMessage* message) { - BMenuItem *item; + BMenuItem* item; switch (message->what) { case kAttributeItem: - if (message->FindPointer("source", (void **)&item) != B_OK) + if (message->FindPointer("source", (void**)&item) != B_OK) return; item->Menu()->Superitem()->SetMarked(true); @@ -2639,7 +2640,7 @@ TAttrView::MessageReceived(BMessage *message) case kAttributeItemMain: // in case someone selected just and attribute without the // comparator - if (message->FindPointer("source", (void **)&item) != B_OK) + if (message->FindPointer("source", (void**)&item) != B_OK) return; if (item->Submenu()->ItemAt(0)) @@ -2657,13 +2658,13 @@ TAttrView::MessageReceived(BMessage *message) void TAttrView::AddMimeTypeAttrs() { - BMenu *menu = fMenuField->Menu(); + BMenu* menu = fMenuField->Menu(); AddMimeTypeAttrs(menu); } void -TAttrView::AddAttributes(BMenu *menu, const BMimeType &mimeType) +TAttrView::AddAttributes(BMenu* menu, const BMimeType &mimeType) { // only add things to menu which have "user-visible" data BMessage attributeMessage; @@ -2675,14 +2676,14 @@ TAttrView::AddAttributes(BMenu *menu, const BMimeType &mimeType) // go through each field in meta mime and add it to a menu for (int32 index = 0; ; index++) { - const char *publicName; + const char* publicName; if (attributeMessage.FindString("attr:public_name", index, &publicName) != B_OK) break; if (!attributeMessage.FindBool("attr:viewable")) continue; - const char *attributeName; + const char* attributeName; if (attributeMessage.FindString("attr:name", index, &attributeName) != B_OK) continue; @@ -2690,13 +2691,13 @@ TAttrView::AddAttributes(BMenu *menu, const BMimeType &mimeType) if (attributeMessage.FindInt32("attr:type", index, &type) != B_OK) continue; - BMenu *submenu = new BMenu(publicName); + BMenu* submenu = new BMenu(publicName); submenu->SetRadioMode(true); submenu->SetFont(be_plain_font); - BMessage *message = new BMessage(kAttributeItemMain); + BMessage* message = new BMessage(kAttributeItemMain); message->AddString("name", attributeName); message->AddInt32("type", type); - BMenuItem *item = new BMenuItem(submenu, message); + BMenuItem* item = new BMenuItem(submenu, message); menu->AddItem(item); menu->SetTargetForItems(this); @@ -2771,14 +2772,14 @@ TAttrView::AddAttributes(BMenu *menu, const BMimeType &mimeType) void -TAttrView::AddMimeTypeAttrs(BMenu *menu) +TAttrView::AddMimeTypeAttrs(BMenu* menu) { - FindPanel *mainView = dynamic_cast(Parent()-> + FindPanel* mainView = dynamic_cast(Parent()-> Parent()->FindView("MainView")); if (!mainView) return; - const char *typeName; + const char* typeName; if (mainView->CurrentMimeType(&typeName) == NULL) return; @@ -2800,7 +2801,7 @@ TAttrView::AddMimeTypeAttrs(BMenu *menu) void TAttrView::GetDefaultName(BString &result) const { - BMenuItem *item = NULL; + BMenuItem* item = NULL; if (fMenuField->Menu() != NULL) item = fMenuField->Menu()->FindMarked(); if (item != NULL) @@ -2904,7 +2905,7 @@ DeleteTransientQueriesTask::GetSome() const int32 kDaysToExpire = 7; static bool -QueryOldEnough(Model *model) +QueryOldEnough(Model* model) { // check if it is old and ready to be deleted time_t now = time(0); @@ -2925,7 +2926,7 @@ QueryOldEnough(Model *model) bool -DeleteTransientQueriesTask::ProcessOneRef(Model *model) +DeleteTransientQueriesTask::ProcessOneRef(Model* model) { BModelOpener opener(model); @@ -2938,10 +2939,10 @@ DeleteTransientQueriesTask::ProcessOneRef(Model *model) if (!QueryOldEnough(model)) return false; - ASSERT(dynamic_cast(be_app)); + ASSERT(dynamic_cast(be_app)); // check that it is not showing - if (dynamic_cast(be_app)->EntryHasWindowOpen(model->EntryRef())) { + if (dynamic_cast(be_app)->EntryHasWindowOpen(model->EntryRef())) { PRINT(("query %s, showing, can't delete\n", model->Name())); return false; } @@ -2956,7 +2957,7 @@ DeleteTransientQueriesTask::ProcessOneRef(Model *model) class DeleteTransientQueriesFunctor : public FunctionObjectWithResult { public: - DeleteTransientQueriesFunctor(DeleteTransientQueriesTask *task) + DeleteTransientQueriesFunctor(DeleteTransientQueriesTask* task) : task(task) {} @@ -2969,7 +2970,7 @@ public: { result = task->DoSomeWork(); } private: - DeleteTransientQueriesTask *task; + DeleteTransientQueriesTask* task; }; @@ -2978,9 +2979,9 @@ DeleteTransientQueriesTask::StartUpTransientQueryCleaner() { // set up a task that wakes up when the machine is idle and starts // killing off old transient queries - DeleteTransientQueriesFunctor *worker + DeleteTransientQueriesFunctor* worker = new DeleteTransientQueriesFunctor(new DeleteTransientQueriesTask()); - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); ASSERT(tracker); tracker->MainTaskLoop()->RunWhenIdle(worker, 30 * 60 * 1000000, // half an hour initial delay @@ -2992,7 +2993,7 @@ DeleteTransientQueriesTask::StartUpTransientQueryCleaner() // #pragma mark - -RecentFindItemsMenu::RecentFindItemsMenu(const char *title, const BMessenger *target, +RecentFindItemsMenu::RecentFindItemsMenu(const char* title, const BMessenger* target, uint32 what) : BMenu(title, B_ITEMS_IN_COLUMN), fTarget(*target), @@ -3016,8 +3017,8 @@ RecentFindItemsMenu::AttachedToWindow() #if !B_BEOS_VERSION_DANO _IMPEXP_TRACKER #endif -BMenu * -TrackerBuildRecentFindItemsMenu(const char *title) +BMenu* +TrackerBuildRecentFindItemsMenu(const char* title) { BMessenger tracker(kTrackerSignature); return new RecentFindItemsMenu(title, &tracker, B_REFS_RECEIVED); @@ -3027,8 +3028,8 @@ TrackerBuildRecentFindItemsMenu(const char *title) // #pragma mark - -DraggableQueryIcon::DraggableQueryIcon(BRect frame, const char *name, - const BMessage *message, BMessenger messenger, uint32 resizeFlags, uint32 flags) +DraggableQueryIcon::DraggableQueryIcon(BRect frame, const char* name, + const BMessage* message, BMessenger messenger, uint32 resizeFlags, uint32 flags) : DraggableIcon(frame, name, B_QUERY_MIMETYPE, B_LARGE_ICON, message, messenger, resizeFlags, flags) { @@ -3036,12 +3037,12 @@ DraggableQueryIcon::DraggableQueryIcon(BRect frame, const char *name, bool -DraggableQueryIcon::DragStarted(BMessage *dragMessage) +DraggableQueryIcon::DragStarted(BMessage* dragMessage) { // override to substitute the user-specified query name dragMessage->RemoveData("be:clip_name"); - FindWindow *window = dynamic_cast(Window()); + FindWindow* window = dynamic_cast(Window()); ASSERT(window); dragMessage->AddString("be:clip_name", window->BackgroundView()->UserSpecifiedName() ? @@ -3055,7 +3056,7 @@ DraggableQueryIcon::DragStarted(BMessage *dragMessage) // #pragma mark - -MostUsedNames::MostUsedNames(const char *fileName, const char *directory, int32 maxCount) +MostUsedNames::MostUsedNames(const char* fileName, const char* directory, int32 maxCount) : fFileName(fileName), fDirectory(directory), @@ -3082,7 +3083,7 @@ MostUsedNames::~MostUsedNames() BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); if (file.InitCheck() == B_OK) { for (int32 i = 0; i < fList.CountItems(); i++) { - list_entry *entry = static_cast(fList.ItemAt(i)); + list_entry* entry = static_cast(fList.ItemAt(i)); char line[B_FILE_NAME_LENGTH + 5]; @@ -3105,7 +3106,7 @@ MostUsedNames::~MostUsedNames() // free data for (int32 i = fList.CountItems(); i-- > 0;) { - list_entry *entry = static_cast(fList.ItemAt(i)); + list_entry* entry = static_cast(fList.ItemAt(i)); free(entry->name); delete entry; } @@ -3113,7 +3114,7 @@ MostUsedNames::~MostUsedNames() bool -MostUsedNames::ObtainList(BList *list) +MostUsedNames::ObtainList(BList* list) { if (!list) return false; @@ -3125,7 +3126,7 @@ MostUsedNames::ObtainList(BList *list) list->MakeEmpty(); for (int32 i = 0; i < fCount; i++) { - list_entry *entry = static_cast(fList.ItemAt(i)); + list_entry* entry = static_cast(fList.ItemAt(i)); if (entry == NULL) return true; @@ -3143,7 +3144,7 @@ MostUsedNames::ReleaseList() void -MostUsedNames::AddName(const char *name) +MostUsedNames::AddName(const char* name) { fLock.Lock(); @@ -3153,10 +3154,10 @@ MostUsedNames::AddName(const char *name) // remove last entry if there are more than // 2*fCount entries in the list - list_entry *entry = NULL; + list_entry* entry = NULL; if (fList.CountItems() > fCount * 2) { - entry = static_cast(fList.RemoveItem(fList.CountItems() - 1)); + entry = static_cast(fList.RemoveItem(fList.CountItems() - 1)); // is this the name we want to add here? if (strcmp(name, entry->name)) { @@ -3168,7 +3169,7 @@ MostUsedNames::AddName(const char *name) } if (entry == NULL) { - for (int32 i = 0; (entry = static_cast(fList.ItemAt(i))) != NULL; i++) + for (int32 i = 0; (entry = static_cast(fList.ItemAt(i))) != NULL; i++) if (!strcmp(entry->name, name)) break; } @@ -3190,10 +3191,10 @@ MostUsedNames::AddName(const char *name) int -MostUsedNames::CompareNames(const void *a,const void *b) +MostUsedNames::CompareNames(const void* a,const void* b) { - list_entry *entryA = *(list_entry **)a; - list_entry *entryB = *(list_entry **)b; + list_entry* entryA = *(list_entry**)a; + list_entry* entryB = *(list_entry**)b; if (entryA->count == entryB->count) return strcasecmp(entryA->name,entryB->name); @@ -3218,7 +3219,7 @@ MostUsedNames::LoadList() path.Append(fDirectory); path.Append(fFileName); - FILE *file = fopen(path.Path(), "r"); + FILE* file = fopen(path.Path(), "r"); if (file == NULL) return; @@ -3230,11 +3231,11 @@ MostUsedNames::LoadList() int32 count = atoi(line); - char *name = strchr(line, ' '); + char* name = strchr(line, ' '); if (name == NULL || *(++name) == '\0') continue; - list_entry *entry = new list_entry; + list_entry* entry = new list_entry; entry->name = strdup(name); entry->count = count; diff --git a/src/kits/tracker/FindPanel.h b/src/kits/tracker/FindPanel.h index 8819702159..a858e5d45f 100644 --- a/src/kits/tracker/FindPanel.h +++ b/src/kits/tracker/FindPanel.h @@ -31,7 +31,6 @@ 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. */ - #ifndef _FIND_PANEL_H #define _FIND_PANEL_H @@ -40,13 +39,13 @@ All rights reserved. #include #include - #include "DialogPane.h" #include "ObjectList.h" #include "MimeTypeList.h" #include "Utilities.h" #include "NodeWalker.h" + class BFilePanel; class BQuery; class BBox; @@ -74,7 +73,7 @@ const uint32 kRemoveItem = 'Frem'; #ifdef _IMPEXP_TRACKER _IMPEXP_TRACKER #endif -BMenu *TrackerBuildRecentFindItemsMenu(const char *title); +BMenu* TrackerBuildRecentFindItemsMenu(const char* title); struct MoreOptionsStruct { bool showMoreOptions; @@ -110,62 +109,62 @@ struct MoreOptionsStruct { reserved8(0) {} - static void EndianSwap(void *castToThis); + static void EndianSwap(void* castToThis); - static void SetQueryTemporary(BNode *, bool on); - static bool QueryTemporary(const BNode *); + static void SetQueryTemporary(BNode*, bool on); + static bool QueryTemporary(const BNode*); }; class FindWindow : public BWindow { public: - FindWindow(const entry_ref *ref = NULL, + FindWindow(const entry_ref* ref = NULL, bool editIfTemplateOnly = false); virtual ~FindWindow(); - FindPanel *BackgroundView() const + FindPanel* BackgroundView() const { return fBackground; } - BNode *QueryNode() const + BNode* QueryNode() const { return fFile; } - const char *QueryName() const; + const char* QueryName() const; // reads in the query name from either a saved name in a template or // form a saved query name - static bool IsQueryTemplate(BNode *file); + static bool IsQueryTemplate(BNode* file); protected: - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); private: - static BFile *TryOpening(const entry_ref *ref); + static BFile* TryOpening(const entry_ref* ref); static void GetDefaultQuery(BEntry &entry); // when opening an empty panel, use the default query to set the panel up - void SaveQueryAttributes(BNode *file, bool templateQuery); + void SaveQueryAttributes(BNode* file, bool templateQuery); void Find(); // retrieve the results void Save(); // save the contents of the find window into the query file - void SwitchToTemplate(const entry_ref *); + void SwitchToTemplate(const entry_ref*); bool FindSaveCommon(bool find); - status_t SaveQueryAsAttributes(BNode *, BEntry *, bool queryTemplate, - const BMessage *oldAttributes = 0, const BPoint *oldLocation = 0); + status_t SaveQueryAsAttributes(BNode*, BEntry*, bool queryTemplate, + const BMessage* oldAttributes = 0, const BPoint* oldLocation = 0); void GetDefaultName(BString &); void GetPredicateString(BString &, bool &dynamicDate); // dynamic date is a date such as 'today' - BFile *fFile; + BFile* fFile; entry_ref fRef; bool fFromTemplate; bool fEditTemplateOnly; - FindPanel *fBackground; + FindPanel* fBackground; mutable BString fQueryNameFromTemplate; - BFilePanel *fSaveAsTemplatePanel; + BFilePanel* fSaveAsTemplatePanel; typedef BWindow _inherited; }; @@ -173,45 +172,45 @@ class FindWindow : public BWindow { class FindPanel : public BView { public: - FindPanel(BRect, BFile *, FindWindow *parent, bool fromTemplate, + FindPanel(BRect, BFile*, FindWindow* parent, bool fromTemplate, bool editTemplateOnly); virtual ~FindPanel(); virtual void AttachedToWindow(); virtual void MessageReceived(BMessage*); - void BuildAttrQuery(BQuery *, bool &dynamicDate) const; - BPopUpMenu *MimeTypeMenu() const + void BuildAttrQuery(BQuery*, bool &dynamicDate) const; + BPopUpMenu* MimeTypeMenu() const { return fMimeTypeMenu; } - BMenuItem *CurrentMimeType(const char **type = NULL) const; - status_t SetCurrentMimeType(BMenuItem *item); - status_t SetCurrentMimeType(const char *label); + BMenuItem* CurrentMimeType(const char** type = NULL) const; + status_t SetCurrentMimeType(BMenuItem* item); + status_t SetCurrentMimeType(const char* label); - BPopUpMenu *VolMenu() const + BPopUpMenu* VolMenu() const { return fVolMenu; } uint32 Mode() const { return fMode; } - static BRect InitialViewSize(const BNode *); + static BRect InitialViewSize(const BNode*); // used when showing window, does not account for more options, // those if used will force a resize later - static uint32 InitialMode(const BNode *entry); - void SaveWindowState(BNode *, bool editTemplate); + static uint32 InitialMode(const BNode* entry); + void SaveWindowState(BNode*, bool editTemplate); - void SwitchToTemplate(const BNode *); + void SwitchToTemplate(const BNode*); - void GetByAttrPredicate(BQuery *, bool &dynamicDate) const; + void GetByAttrPredicate(BQuery*, bool &dynamicDate) const; // build up a query from by-attribute items void GetByNamePredicate(BQuery *) const; // build up a simple query from the name we are searching for void GetDefaultName(BString &) const; - const char *UserSpecifiedName() const; + const char* UserSpecifiedName() const; // name filled out in the query name text field - static void AddRecentQueries(BMenu *, bool addSaveAsItem, - const BMessenger *target, uint32 what); + static void AddRecentQueries(BMenu*, bool addSaveAsItem, + const BMessenger* target, uint32 what); // populate the recent query menu with query templates and recent // queries @@ -223,9 +222,9 @@ class FindPanel : public BView { void AddMimeTypesToMenu(); // populates the type menu - static bool AddOneMimeTypeToMenu(const ShortMimeInfo *, void *); + static bool AddOneMimeTypeToMenu(const ShortMimeInfo*, void*); - void AddVolumes(BMenu *); + void AddVolumes(BMenu*); // populates the volume menu void ShowVolumeMenuLabel(); @@ -236,10 +235,10 @@ class FindPanel : public BView { void AddFirstAttr(); // panel building/restoring calls - void RestoreWindowState(const BNode *); - void RestoreMimeTypeMenuSelection(const BNode *); - void AddByAttributeItems(const BNode *); - void ResizeAttributeBox(const BNode *); + void RestoreWindowState(const BNode*); + void RestoreMimeTypeMenuSelection(const BNode*); + void AddByAttributeItems(const BNode*); + void ResizeAttributeBox(const BNode*); void RemoveByAttributeItems(); void RemoveAttrViewItems(); void ShowOrHideMimeTypeMenu(); @@ -247,35 +246,35 @@ class FindPanel : public BView { void ShowOrHideMoreOptions(bool show); // fMode gets set by this and the call relies on it being up-to-date - static int32 InitialAttrCount(const BNode *); - void FillCurrentQueryName(BTextControl *, FindWindow *); + static int32 InitialAttrCount(const BNode*); + void FillCurrentQueryName(BTextControl*, FindWindow*); void AddByNameOrFormulaItems(); - void AddOneAttributeItem(BBox *box, BRect); - void SetUpAddRemoveButtons(BBox *box); + void AddOneAttributeItem(BBox* box, BRect); + void SetUpAddRemoveButtons(BBox* box); void SwitchMode(uint32); // go from search by name to search by attribute, etc. - void PushMimeType(BQuery *query) const; + void PushMimeType(BQuery* query) const; - void SaveAsQueryOrTemplate(const entry_ref *, const char *, bool queryTemplate); + void SaveAsQueryOrTemplate(const entry_ref*, const char*, bool queryTemplate); uint32 fMode; BObjectList fAttrViewList; - BPopUpMenu *fMimeTypeMenu; - BMenuField *fMimeTypeField; - BPopUpMenu *fVolMenu; - BPopUpMenu *fSearchModeMenu; - BPopUpMenu *fRecentQueries; - DialogPane *fMoreOptionsPane; - BTextControl *fQueryName; + BPopUpMenu* fMimeTypeMenu; + BMenuField* fMimeTypeField; + BPopUpMenu* fVolMenu; + BPopUpMenu* fSearchModeMenu; + BPopUpMenu* fRecentQueries; + DialogPane* fMoreOptionsPane; + BTextControl* fQueryName; BString fInitialQueryName; - BCheckBox *fTemporaryCheck; - BCheckBox *fSearchTrashCheck; + BCheckBox* fTemporaryCheck; + BCheckBox* fSearchTrashCheck; - PaneSwitch *fLatch; - DraggableIcon *fDraggableIcon; + PaneSwitch* fLatch; + DraggableIcon* fDraggableIcon; typedef BView _inherited; @@ -292,10 +291,10 @@ class TAttrView : public BView { virtual void AttachedToWindow(); void RestoreState(const BMessage &settings, int32 index); - void SaveState(BMessage *settings, int32 index); + void SaveState(BMessage* settings, int32 index); virtual void Draw(BRect updateRect); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); void AddLogicMenu(bool selectAnd = true); void RemoveLogicMenu(); @@ -305,11 +304,11 @@ class TAttrView : public BView { void GetDefaultName(BString &result) const; private: - void AddAttributes(BMenu *menu, const BMimeType &type); - void AddMimeTypeAttrs(BMenu *menu); + void AddAttributes(BMenu* menu, const BMimeType &type); + void AddMimeTypeAttrs(BMenu* menu); - BMenuField *fMenuField; - BTextControl *fTextControl; + BMenuField* fMenuField; + BTextControl* fTextControl; typedef BView _inherited; }; @@ -340,16 +339,16 @@ class DeleteTransientQueriesTask { void Initialize(); bool GetSome(); - bool ProcessOneRef(Model *); + bool ProcessOneRef(Model*); private: - BTrackerPrivate::TNodeWalker *fWalker; + BTrackerPrivate::TNodeWalker* fWalker; }; class RecentFindItemsMenu : public BMenu { public: - RecentFindItemsMenu(const char *title, const BMessenger *target, uint32 what); + RecentFindItemsMenu(const char* title, const BMessenger* target, uint32 what); protected: virtual void AttachedToWindow(); @@ -363,12 +362,12 @@ class RecentFindItemsMenu : public BMenu { class DraggableQueryIcon : public DraggableIcon { // query/query template drag&drop helper public: - DraggableQueryIcon(BRect frame, const char *name, const BMessage *message, + DraggableQueryIcon(BRect frame, const char* name, const BMessage* message, BMessenger target, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW); protected: - virtual bool DragStarted(BMessage *); + virtual bool DragStarted(BMessage*); }; } // namespace BPrivate diff --git a/src/kits/tracker/FunctionObject.h b/src/kits/tracker/FunctionObject.h index bcd8f6e6ef..0e8241a18e 100644 --- a/src/kits/tracker/FunctionObject.h +++ b/src/kits/tracker/FunctionObject.h @@ -31,10 +31,10 @@ 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. */ - #ifndef __FUNCTION_OBJECT__ #define __FUNCTION_OBJECT__ + #include #include #include @@ -42,6 +42,7 @@ All rights reserved. #include #include + // parameter binders serve to store a copy of a struct and // pass it in and out by pointers, allowing struct parameters to share // the same syntax as scalar ones @@ -71,17 +72,17 @@ private: template<> -class ParameterBinder { +class ParameterBinder { public: ParameterBinder() {} - ParameterBinder(const BEntry *p) + ParameterBinder(const BEntry* p) : p(*p) {} - ParameterBinder &operator=(const BEntry *newp) + ParameterBinder &operator=(const BEntry* newp) { p = *newp; return *this; } - const BEntry *Pass() const + const BEntry* Pass() const { return &p; } private: BEntry p; @@ -89,19 +90,19 @@ private: template<> -class ParameterBinder { +class ParameterBinder { public: ParameterBinder() {} - ParameterBinder(const entry_ref *p) + ParameterBinder(const entry_ref* p) { if (p) this->p = *p; } - ParameterBinder &operator=(const entry_ref *newp) + ParameterBinder &operator=(const entry_ref* newp) { p = *newp; return *this; } - const entry_ref *Pass() const + const entry_ref* Pass() const { return &p; } private: entry_ref p; @@ -109,17 +110,17 @@ private: template<> -class ParameterBinder { +class ParameterBinder { public: ParameterBinder() {} - ParameterBinder(const node_ref * p) + ParameterBinder(const node_ref* p) : p(*p) {} - ParameterBinder &operator=(const node_ref *newp) + ParameterBinder &operator=(const node_ref* newp) { p = *newp; return *this; } - const node_ref *Pass() const + const node_ref* Pass() const { return &p; } private: node_ref p; @@ -127,10 +128,10 @@ private: template<> -class ParameterBinder { +class ParameterBinder { public: ParameterBinder() {} - ParameterBinder(const BMessage *p) + ParameterBinder(const BMessage* p) : p(p ? new BMessage(*p) : NULL) {} @@ -139,18 +140,18 @@ public: delete p; } - ParameterBinder &operator=(const BMessage *newp) + ParameterBinder &operator=(const BMessage* newp) { delete p; p = (newp ? new BMessage(*newp) : NULL); return *this; } - const BMessage *Pass() const + const BMessage* Pass() const { return p; } private: - BMessage *p; + BMessage* p; }; @@ -164,8 +165,7 @@ public: template class FunctionObjectWithResult : public FunctionObject { public: - const R &Result() const - { return result; } + const R &Result() const { return result; } protected: R result; @@ -181,10 +181,8 @@ public: p1(p1) { } - - - virtual void operator()() - { (function)(p1.Pass()); } + + virtual void operator()() { (function)(p1.Pass()); } private: void (*function)(Param1); @@ -193,15 +191,15 @@ private: template -class SingleParamFunctionObjectWithResult : public FunctionObjectWithResult { +class SingleParamFunctionObjectWithResult : public + FunctionObjectWithResult { public: SingleParamFunctionObjectWithResult(Result (*function)(Param1), Param1 p1) : function(function), p1(p1) { } - - + virtual void operator()() { FunctionObjectWithResult::result = (function)(p1.Pass()); } @@ -222,8 +220,7 @@ public: { } - virtual void operator()() - { (function)(p1.Pass(), p2.Pass()); } + virtual void operator()() { (function)(p1.Pass(), p2.Pass()); } private: void (*function)(Param1, Param2); @@ -244,9 +241,7 @@ public: { } - - virtual void operator()() - { (function)(p1.Pass(), p2.Pass(), p3.Pass()); } + virtual void operator()() { (function)(p1.Pass(), p2.Pass(), p3.Pass()); } private: void (*function)(Param1, Param2, Param3); @@ -267,7 +262,7 @@ public: p3(p3) { } - + virtual void operator()() { FunctionObjectWithResult::result = (function)(p1.Pass(), p2.Pass(), p3.Pass()); } @@ -292,7 +287,7 @@ public: p4(p4) { } - + virtual void operator()() { (function)(p1.Pass(), p2.Pass(), p3.Pass(), p4.Pass()); } @@ -317,7 +312,7 @@ public: p4(p4) { } - + virtual void operator()() { FunctionObjectWithResult::result = (function)(p1.Pass(), p2.Pass(), p3.Pass(), p4.Pass()); } @@ -334,7 +329,7 @@ private: template class PlainMemberFunctionObject : public FunctionObject { public: - PlainMemberFunctionObject(void (T::*function)(), T *onThis) + PlainMemberFunctionObject(void (T::*function)(), T* onThis) : function(function), target(onThis) { @@ -345,14 +340,14 @@ public: private: void (T::*function)(); - T *target; + T* target; }; template class PlainLockingMemberFunctionObject : public FunctionObject { public: - PlainLockingMemberFunctionObject(void (T::*function)(), T *target) + PlainLockingMemberFunctionObject(void (T::*function)(), T* target) : function(function), messenger(target) { @@ -360,7 +355,7 @@ public: virtual void operator()() { - T *target = dynamic_cast(messenger.Target(NULL)); + T* target = dynamic_cast(messenger.Target(NULL)); if (!target || !messenger.LockTarget()) return; (target->*function)(); @@ -376,7 +371,7 @@ private: template class PlainMemberFunctionObjectWithResult : public FunctionObjectWithResult { public: - PlainMemberFunctionObjectWithResult(R (T::*function)(), T *onThis) + PlainMemberFunctionObjectWithResult(R (T::*function)(), T* onThis) : function(function), target(onThis) { @@ -388,14 +383,14 @@ public: private: R (T::*function)(); - T *target; + T* target; }; template class SingleParamMemberFunctionObject : public FunctionObject { public: - SingleParamMemberFunctionObject(void (T::*function)(Param1), T *onThis, Param1 p1) + SingleParamMemberFunctionObject(void (T::*function)(Param1), T* onThis, Param1 p1) : function(function), target(onThis), p1(p1) @@ -407,7 +402,7 @@ public: private: void (T::*function)(Param1); - T *target; + T* target; ParameterBinder p1; }; @@ -415,7 +410,7 @@ private: template class TwoParamMemberFunctionObject : public FunctionObject { public: - TwoParamMemberFunctionObject(void (T::*function)(Param1, Param2), T *onThis, + TwoParamMemberFunctionObject(void (T::*function)(Param1, Param2), T* onThis, Param1 p1, Param2 p2) : function(function), target(onThis), @@ -430,7 +425,7 @@ public: protected: void (T::*function)(Param1, Param2); - T *target; + T* target; ParameterBinder p1; ParameterBinder p2; }; @@ -439,7 +434,7 @@ protected: template class SingleParamMemberFunctionObjectWithResult : public FunctionObjectWithResult { public: - SingleParamMemberFunctionObjectWithResult(R (T::*function)(Param1), T *onThis, + SingleParamMemberFunctionObjectWithResult(R (T::*function)(Param1), T* onThis, Param1 p1) : function(function), target(onThis), @@ -452,7 +447,7 @@ public: protected: R (T::*function)(Param1); - T *target; + T* target; ParameterBinder p1; }; @@ -460,7 +455,7 @@ protected: template class TwoParamMemberFunctionObjectWithResult : public FunctionObjectWithResult { public: - TwoParamMemberFunctionObjectWithResult(R (T::*function)(Param1, Param2), T *onThis, + TwoParamMemberFunctionObjectWithResult(R (T::*function)(Param1, Param2), T* onThis, Param1 p1, Param2 p2) : function(function), target(onThis), @@ -475,7 +470,7 @@ public: protected: R (T::*function)(Param1, Param2); - T *target; + T* target; ParameterBinder p1; ParameterBinder p2; }; @@ -490,7 +485,7 @@ protected: // ... add the missing ones as needed template -SingleParamFunctionObject * +SingleParamFunctionObject* NewFunctionObject(void (*function)(Param1), Param1 p1) { return new SingleParamFunctionObject(function, p1); @@ -498,7 +493,7 @@ NewFunctionObject(void (*function)(Param1), Param1 p1) template -TwoParamFunctionObject * +TwoParamFunctionObject* NewFunctionObject(void (*function)(Param1, Param2), Param1 p1, Param2 p2) { return new TwoParamFunctionObject(function, p1, p2); @@ -506,7 +501,7 @@ NewFunctionObject(void (*function)(Param1, Param2), Param1 p1, Param2 p2) template -ThreeParamFunctionObject * +ThreeParamFunctionObject* NewFunctionObject(void (*function)(Param1, Param2, Param3), Param1 p1, Param2 p2, Param3 p3) { @@ -515,24 +510,24 @@ NewFunctionObject(void (*function)(Param1, Param2, Param3), template -PlainMemberFunctionObject * -NewMemberFunctionObject(void (T::*function)(), T *onThis) +PlainMemberFunctionObject* +NewMemberFunctionObject(void (T::*function)(), T* onThis) { return new PlainMemberFunctionObject(function, onThis); } template -SingleParamMemberFunctionObject * -NewMemberFunctionObject(void (T::*function)(Param1), T *onThis, Param1 p1) +SingleParamMemberFunctionObject* +NewMemberFunctionObject(void (T::*function)(Param1), T* onThis, Param1 p1) { return new SingleParamMemberFunctionObject(function, onThis, p1); } template -TwoParamMemberFunctionObject * -NewMemberFunctionObject(void (T::*function)(Param1, Param2), T *onThis, +TwoParamMemberFunctionObject* +NewMemberFunctionObject(void (T::*function)(Param1, Param2), T* onThis, Param1 p1, Param2 p2) { return new TwoParamMemberFunctionObject(function, onThis, @@ -541,9 +536,9 @@ NewMemberFunctionObject(void (T::*function)(Param1, Param2), T *onThis, template -TwoParamMemberFunctionObjectWithResult * +TwoParamMemberFunctionObjectWithResult* NewMemberFunctionObjectWithResult(R (T::*function)(Param1, Param2), - T *onThis, Param1 p1, Param2 p2) + T* onThis, Param1 p1, Param2 p2) { return new TwoParamMemberFunctionObjectWithResult (function, onThis, p1, p2); @@ -551,9 +546,9 @@ NewMemberFunctionObjectWithResult(R (T::*function)(Param1, Param2), template -PlainLockingMemberFunctionObject * +PlainLockingMemberFunctionObject* NewLockingMemberFunctionObject(void (HandlerOrSubclass::*function)(), - HandlerOrSubclass *onThis) + HandlerOrSubclass* onThis) { return new PlainLockingMemberFunctionObject(function, onThis); } @@ -562,5 +557,4 @@ NewLockingMemberFunctionObject(void (HandlerOrSubclass::*function)(), using namespace BPrivate; -#endif - +#endif // __FUNCTION_OBJECT__ diff --git a/src/kits/tracker/GroupedMenu.cpp b/src/kits/tracker/GroupedMenu.cpp index 4bbd430953..8eb4dfbcb3 100644 --- a/src/kits/tracker/GroupedMenu.cpp +++ b/src/kits/tracker/GroupedMenu.cpp @@ -7,7 +7,7 @@ using namespace BPrivate; -TMenuItemGroup::TMenuItemGroup(const char *name) +TMenuItemGroup::TMenuItemGroup(const char* name) : fMenu(NULL), fFirstItemIndex(-1), @@ -23,10 +23,10 @@ TMenuItemGroup::TMenuItemGroup(const char *name) TMenuItemGroup::~TMenuItemGroup() { - free((char *)fName); + free((char*)fName); if (fMenu == NULL) { - BMenuItem *item; + BMenuItem* item; while ((item = RemoveItem(0L)) != NULL) delete item; } @@ -34,7 +34,7 @@ TMenuItemGroup::~TMenuItemGroup() bool -TMenuItemGroup::AddItem(BMenuItem *item) +TMenuItemGroup::AddItem(BMenuItem* item) { if (!fList.AddItem(item)) return false; @@ -48,7 +48,7 @@ TMenuItemGroup::AddItem(BMenuItem *item) bool -TMenuItemGroup::AddItem(BMenuItem *item, int32 atIndex) +TMenuItemGroup::AddItem(BMenuItem* item, int32 atIndex) { if (!fList.AddItem(item, atIndex)) return false; @@ -62,9 +62,9 @@ TMenuItemGroup::AddItem(BMenuItem *item, int32 atIndex) bool -TMenuItemGroup::AddItem(BMenu *menu) +TMenuItemGroup::AddItem(BMenu* menu) { - BMenuItem *item = new BMenuItem(menu); + BMenuItem* item = new BMenuItem(menu); if (item == NULL) return false; @@ -78,9 +78,9 @@ TMenuItemGroup::AddItem(BMenu *menu) bool -TMenuItemGroup::AddItem(BMenu *menu, int32 atIndex) +TMenuItemGroup::AddItem(BMenu* menu, int32 atIndex) { - BMenuItem *item = new BMenuItem(menu); + BMenuItem* item = new BMenuItem(menu); if (item == NULL) return false; @@ -94,7 +94,7 @@ TMenuItemGroup::AddItem(BMenu *menu, int32 atIndex) bool -TMenuItemGroup::RemoveItem(BMenuItem *item) +TMenuItemGroup::RemoveItem(BMenuItem* item) { if (fMenu) fMenu->RemoveGroupItem(this, item); @@ -104,9 +104,9 @@ TMenuItemGroup::RemoveItem(BMenuItem *item) bool -TMenuItemGroup::RemoveItem(BMenu *menu) +TMenuItemGroup::RemoveItem(BMenu* menu) { - BMenuItem *item = menu->Superitem(); + BMenuItem* item = menu->Superitem(); if (item == NULL) return false; @@ -114,10 +114,10 @@ TMenuItemGroup::RemoveItem(BMenu *menu) } -BMenuItem * +BMenuItem* TMenuItemGroup::RemoveItem(int32 index) { - BMenuItem *item = ItemAt(index); + BMenuItem* item = ItemAt(index); if (item == NULL) return NULL; @@ -128,10 +128,10 @@ TMenuItemGroup::RemoveItem(int32 index) } -BMenuItem * +BMenuItem* TMenuItemGroup::ItemAt(int32 index) { - return static_cast(fList.ItemAt(index)); + return static_cast(fList.ItemAt(index)); } @@ -167,7 +167,7 @@ TMenuItemGroup::HasSeparator() // #pragma mark - -TGroupedMenu::TGroupedMenu(const char *name) +TGroupedMenu::TGroupedMenu(const char* name) : BMenu(name) { } @@ -175,14 +175,14 @@ TGroupedMenu::TGroupedMenu(const char *name) TGroupedMenu::~TGroupedMenu() { - TMenuItemGroup *group; - while ((group = static_cast(fGroups.RemoveItem(0L))) != NULL) + TMenuItemGroup* group; + while ((group = static_cast(fGroups.RemoveItem(0L))) != NULL) delete group; } bool -TGroupedMenu::AddGroup(TMenuItemGroup *group) +TGroupedMenu::AddGroup(TMenuItemGroup* group) { if (!fGroups.AddItem(group)) return false; @@ -198,7 +198,7 @@ TGroupedMenu::AddGroup(TMenuItemGroup *group) bool -TGroupedMenu::AddGroup(TMenuItemGroup *group, int32 atIndex) +TGroupedMenu::AddGroup(TMenuItemGroup* group, int32 atIndex) { if (!fGroups.AddItem(group, atIndex)) return false; @@ -214,7 +214,7 @@ TGroupedMenu::AddGroup(TMenuItemGroup *group, int32 atIndex) bool -TGroupedMenu::RemoveGroup(TMenuItemGroup *group) +TGroupedMenu::RemoveGroup(TMenuItemGroup* group) { if (group->HasSeparator()) { delete RemoveItem(group->fFirstItemIndex); @@ -232,10 +232,10 @@ TGroupedMenu::RemoveGroup(TMenuItemGroup *group) } -TMenuItemGroup * +TMenuItemGroup* TGroupedMenu::GroupAt(int32 index) { - return static_cast(fGroups.ItemAt(index)); + return static_cast(fGroups.ItemAt(index)); } @@ -247,7 +247,7 @@ TGroupedMenu::CountGroups() void -TGroupedMenu::AddGroupItem(TMenuItemGroup *group, BMenuItem *item, int32 atIndex) +TGroupedMenu::AddGroupItem(TMenuItemGroup* group, BMenuItem* item, int32 atIndex) { int32 groupIndex = fGroups.IndexOf(group); bool addSeparator = false; @@ -256,12 +256,12 @@ TGroupedMenu::AddGroupItem(TMenuItemGroup *group, BMenuItem *item, int32 atIndex // find new home for this group if (groupIndex > 0) { // add this group after an existing one - TMenuItemGroup *previous = GroupAt(groupIndex - 1); + TMenuItemGroup* previous = GroupAt(groupIndex - 1); group->fFirstItemIndex = previous->fFirstItemIndex + previous->fItemsTotal; addSeparator = true; } else { // this is the first group - TMenuItemGroup *successor = GroupAt(groupIndex + 1); + TMenuItemGroup* successor = GroupAt(groupIndex + 1); if (successor != NULL) { group->fFirstItemIndex = successor->fFirstItemIndex; if (successor->fHasSeparator) { @@ -295,7 +295,7 @@ TGroupedMenu::AddGroupItem(TMenuItemGroup *group, BMenuItem *item, int32 atIndex void -TGroupedMenu::RemoveGroupItem(TMenuItemGroup *group, BMenuItem *item) +TGroupedMenu::RemoveGroupItem(TMenuItemGroup* group, BMenuItem* item) { int32 groupIndex = fGroups.IndexOf(group); bool removedSeparator = false; diff --git a/src/kits/tracker/GroupedMenu.h b/src/kits/tracker/GroupedMenu.h index ab6e2e765a..908eac88ae 100644 --- a/src/kits/tracker/GroupedMenu.h +++ b/src/kits/tracker/GroupedMenu.h @@ -13,19 +13,19 @@ class TGroupedMenu; class TMenuItemGroup { public: - TMenuItemGroup(const char *name); + TMenuItemGroup(const char* name); ~TMenuItemGroup(); - bool AddItem(BMenuItem *item); - bool AddItem(BMenuItem *item, int32 atIndex); - bool AddItem(BMenu *menu); - bool AddItem(BMenu *menu, int32 atIndex); + bool AddItem(BMenuItem* item); + bool AddItem(BMenuItem* item, int32 atIndex); + bool AddItem(BMenu* menu); + bool AddItem(BMenu* menu, int32 atIndex); - bool RemoveItem(BMenuItem *item); - bool RemoveItem(BMenu *menu); - BMenuItem *RemoveItem(int32 index); + bool RemoveItem(BMenuItem* item); + bool RemoveItem(BMenu* menu); + BMenuItem* RemoveItem(int32 index); - BMenuItem *ItemAt(int32 index); + BMenuItem* ItemAt(int32 index); int32 CountItems(); private: @@ -34,9 +34,9 @@ class TMenuItemGroup { bool HasSeparator(); private: - const char *fName; + const char* fName; BList fList; - TGroupedMenu *fMenu; + TGroupedMenu* fMenu; int32 fFirstItemIndex; int32 fItemsTotal; bool fHasSeparator; @@ -45,21 +45,21 @@ class TMenuItemGroup { class TGroupedMenu : public BMenu { public: - TGroupedMenu(const char *name); + TGroupedMenu(const char* name); ~TGroupedMenu(); - bool AddGroup(TMenuItemGroup *group); - bool AddGroup(TMenuItemGroup *group, int32 atIndex); + bool AddGroup(TMenuItemGroup* group); + bool AddGroup(TMenuItemGroup* group, int32 atIndex); - bool RemoveGroup(TMenuItemGroup *group); + bool RemoveGroup(TMenuItemGroup* group); - TMenuItemGroup *GroupAt(int32 index); + TMenuItemGroup* GroupAt(int32 index); int32 CountGroups(); private: friend class TMenuItemGroup; - void AddGroupItem(TMenuItemGroup *group, BMenuItem *item, int32 atIndex); - void RemoveGroupItem(TMenuItemGroup *group, BMenuItem *item); + void AddGroupItem(TMenuItemGroup* group, BMenuItem* item, int32 atIndex); + void RemoveGroupItem(TMenuItemGroup* group, BMenuItem* item); private: BList fGroups; @@ -67,4 +67,4 @@ class TGroupedMenu : public BMenu { } // namespace BPrivate -#endif /* GROUPED_MENU_H */ +#endif // GROUPED_MENU_H diff --git a/src/kits/tracker/IconCache.cpp b/src/kits/tracker/IconCache.cpp index e9ad7801d9..bfdc610f3d 100644 --- a/src/kits/tracker/IconCache.cpp +++ b/src/kits/tracker/IconCache.cpp @@ -128,24 +128,24 @@ IconCacheEntry::~IconCacheEntry() void -IconCacheEntry::SetAliasFor(const SharedIconCache *sharedCache, - const SharedCacheEntry *entry) +IconCacheEntry::SetAliasFor(const SharedIconCache* sharedCache, + const SharedCacheEntry* entry) { sharedCache->SetAliasFor(this, entry); ASSERT(fAliasForIndex >= 0); } -IconCacheEntry * -IconCacheEntry::ResolveIfAlias(const SharedIconCache *sharedCache) +IconCacheEntry* +IconCacheEntry::ResolveIfAlias(const SharedIconCache* sharedCache) { return sharedCache->ResolveIfAlias(this); } -IconCacheEntry * -IconCacheEntry::ResolveIfAlias(const SharedIconCache *sharedCache, - IconCacheEntry *entry) +IconCacheEntry* +IconCacheEntry::ResolveIfAlias(const SharedIconCache* sharedCache, + IconCacheEntry* entry) { if (!entry) return NULL; @@ -188,7 +188,7 @@ IconCacheEntry::HaveIconBitmap(IconDrawMode mode, icon_size size) const } -BBitmap * +BBitmap* IconCacheEntry::IconForMode(IconDrawMode mode, icon_size size) const { ASSERT(mode == kSelected || mode == kNormalIcon); @@ -213,11 +213,11 @@ bool IconCacheEntry::IconHitTest(BPoint where, IconDrawMode mode, icon_size size) const { ASSERT(where.x < size && where.y < size); - BBitmap *bitmap = IconForMode(mode, size); + BBitmap* bitmap = IconForMode(mode, size); if (!bitmap) return false; - uchar *bits = (uchar *)bitmap->Bits(); + uchar* bits = (uchar*)bitmap->Bits(); ASSERT(bits); BRect bounds(bitmap->Bounds()); @@ -241,9 +241,9 @@ IconCacheEntry::IconHitTest(BPoint where, IconDrawMode mode, icon_size size) con } -BBitmap * -IconCacheEntry::ConstructBitmap(BBitmap *constructFrom, IconDrawMode requestedMode, - IconDrawMode constructFromMode, icon_size size, LazyBitmapAllocator *lazyBitmap) +BBitmap* +IconCacheEntry::ConstructBitmap(BBitmap* constructFrom, IconDrawMode requestedMode, + IconDrawMode constructFromMode, icon_size size, LazyBitmapAllocator* lazyBitmap) { ASSERT(requestedMode == kSelected && constructFromMode == kNormalIcon); // for now @@ -254,11 +254,11 @@ IconCacheEntry::ConstructBitmap(BBitmap *constructFrom, IconDrawMode requestedMo } -BBitmap * +BBitmap* IconCacheEntry::ConstructBitmap(IconDrawMode requestedMode, icon_size size, - LazyBitmapAllocator *lazyBitmap) + LazyBitmapAllocator* lazyBitmap) { - BBitmap *source = (size == B_MINI_ICON) ? fMiniIcon : fLargeIcon; + BBitmap* source = (size == B_MINI_ICON) ? fMiniIcon : fLargeIcon; ASSERT(source); return ConstructBitmap(source, requestedMode, kNormalIcon, size, lazyBitmap); } @@ -278,7 +278,7 @@ IconCacheEntry::AlternateModeForIconConstructing(IconDrawMode requestedMode, void -IconCacheEntry::SetIcon(BBitmap *bitmap, IconDrawMode mode, icon_size size, +IconCacheEntry::SetIcon(BBitmap* bitmap, IconDrawMode mode, icon_size size, bool /*create*/) { if (mode == kNormalIcon) { @@ -311,10 +311,10 @@ IconCache::IconCache() // icon is not available // for now the code only looks for normal icons, selected icons are auto-generated -IconCacheEntry * -IconCache::GetIconForPreferredApp(const char *fileTypeSignature, - const char *preferredApp, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *lazyBitmap, IconCacheEntry *entry) +IconCacheEntry* +IconCache::GetIconForPreferredApp(const char* fileTypeSignature, + const char* preferredApp, IconDrawMode mode, icon_size size, + LazyBitmapAllocator* lazyBitmap, IconCacheEntry* entry) { ASSERT(fSharedCache.IsLocked()); @@ -346,7 +346,7 @@ IconCache::GetIconForPreferredApp(const char *fileTypeSignature, size) != B_OK) return NULL; - BBitmap *bitmap = lazyBitmap->Adopt(); + BBitmap* bitmap = lazyBitmap->Adopt(); if (!entry) { PRINT_ADD_ITEM(("File %s; Line %d # adding entry for preferredApp %s, type %s\n", __FILE__, __LINE__, preferredApp, fileTypeSignature)); @@ -365,9 +365,9 @@ IconCache::GetIconForPreferredApp(const char *fileTypeSignature, } -IconCacheEntry * -IconCache::GetIconFromMetaMime(const char *fileType, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *lazyBitmap, IconCacheEntry *entry) +IconCacheEntry* +IconCache::GetIconFromMetaMime(const char* fileType, IconDrawMode mode, + icon_size size, LazyBitmapAllocator* lazyBitmap, IconCacheEntry* entry) { ASSERT(fSharedCache.IsLocked()); @@ -393,12 +393,12 @@ IconCache::GetIconFromMetaMime(const char *fileType, IconDrawMode mode, if (mime.GetPreferredApp(preferredAppSig) != B_OK) return NULL; - SharedCacheEntry *aliasTo = NULL; + SharedCacheEntry* aliasTo = NULL; if (entry) - aliasTo = (SharedCacheEntry *)entry->ResolveIfAlias(&fSharedCache); + aliasTo = (SharedCacheEntry*)entry->ResolveIfAlias(&fSharedCache); // look for icon defined by preferred app from metamime - aliasTo = (SharedCacheEntry *)GetIconForPreferredApp(fileType, + aliasTo = (SharedCacheEntry*)GetIconForPreferredApp(fileType, preferredAppSig, mode, size, lazyBitmap, aliasTo); if (aliasTo == NULL) @@ -417,7 +417,7 @@ IconCache::GetIconFromMetaMime(const char *fileType, IconDrawMode mode, } // at this point, we've found an icon for the MIME type - BBitmap *bitmap = lazyBitmap->Adopt(); + BBitmap* bitmap = lazyBitmap->Adopt(); if (!entry) { PRINT_ADD_ITEM(("File %s; Line %d # adding entry for type %s\n", __FILE__, __LINE__, fileType)); @@ -443,17 +443,17 @@ IconCache::GetIconFromMetaMime(const char *fileType, IconDrawMode mode, } -IconCacheEntry * -IconCache::GetIconFromFileTypes(ModelNodeLazyOpener *modelOpener, +IconCacheEntry* +IconCache::GetIconFromFileTypes(ModelNodeLazyOpener* modelOpener, IconSource &source, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *lazyBitmap, IconCacheEntry *entry) + LazyBitmapAllocator* lazyBitmap, IconCacheEntry* entry) { ASSERT(fSharedCache.IsLocked()); // use file types to get the icon - Model *model = modelOpener->TargetModel(); + Model* model = modelOpener->TargetModel(); - const char *fileType = model->MimeType(); - const char *nodePreferredApp = model->PreferredAppSignature(); + const char* fileType = model->MimeType(); + const char* nodePreferredApp = model->PreferredAppSignature(); if (source == kUnknownSource || source == kUnknownNotFromNode || source == kPreferredAppForNode) { @@ -483,7 +483,7 @@ IconCache::GetIconFromFileTypes(ModelNodeLazyOpener *modelOpener, if (!mime.IsSupertypeOnly()) { BMimeType superType; mime.GetSupertype(&superType); - const char *superTypeFileType = superType.Type(); + const char* superTypeFileType = superType.Type(); if (superTypeFileType) entry = GetIconFromMetaMime(superTypeFileType, mode, size, lazyBitmap, entry); @@ -505,9 +505,9 @@ IconCache::GetIconFromFileTypes(ModelNodeLazyOpener *modelOpener, PRINT_ADD_ITEM(("File %s; Line %d # adding entry as alias for preferredApp %s, type %s\n", __FILE__, __LINE__, nodePreferredApp, fileType)); - IconCacheEntry *aliasedEntry = fSharedCache.AddItem((SharedCacheEntry **)&entry, + IconCacheEntry* aliasedEntry = fSharedCache.AddItem((SharedCacheEntry**)&entry, fileType, nodePreferredApp); - aliasedEntry->SetAliasFor(&fSharedCache, (SharedCacheEntry *)entry); + aliasedEntry->SetAliasFor(&fSharedCache, (SharedCacheEntry*)entry); // OK to cast here, have a runtime check source = kPreferredAppForNode; // set source as preferred for node, so that next time we get a hit in @@ -523,17 +523,17 @@ IconCache::GetIconFromFileTypes(ModelNodeLazyOpener *modelOpener, return entry; } -IconCacheEntry * -IconCache::GetVolumeIcon(AutoLock *nodeCacheLocker, - AutoLock *sharedCacheLocker, - AutoLock **resultingOpenCache, - Model *model, IconSource &source, - IconDrawMode mode, icon_size size, LazyBitmapAllocator *lazyBitmap) +IconCacheEntry* +IconCache::GetVolumeIcon(AutoLock*nodeCacheLocker, + AutoLock* sharedCacheLocker, + AutoLock** resultingOpenCache, + Model* model, IconSource &source, + IconDrawMode mode, icon_size size, LazyBitmapAllocator* lazyBitmap) { *resultingOpenCache = nodeCacheLocker; nodeCacheLocker->Lock(); - IconCacheEntry *entry = 0; + IconCacheEntry* entry = 0; if (source != kUnknownSource) { // cached in the node cache entry = fNodeCache.FindItem(model->NodeRef()); @@ -560,7 +560,7 @@ IconCache::GetVolumeIcon(AutoLock *nodeCacheLocker, if (volume.IsShared()) { // Check if it's a network share and give it a special icon - BBitmap *bitmap = lazyBitmap->Get(); + BBitmap* bitmap = lazyBitmap->Get(); GetTrackerResources()->GetIconResource(R_ShareIcon, size, bitmap); if (!entry) { PRINT_ADD_ITEM(("File %s; Line %d # adding entry for model %s\n", @@ -570,7 +570,7 @@ IconCache::GetVolumeIcon(AutoLock *nodeCacheLocker, entry->SetIcon(lazyBitmap->Adopt(), kNormalIcon, size); } else if (volume.GetIcon(lazyBitmap->Get(), size) == B_OK) { // Ask the device for an icon - BBitmap *bitmap = lazyBitmap->Adopt(); + BBitmap* bitmap = lazyBitmap->Adopt(); ASSERT(bitmap); if (!entry) { PRINT_ADD_ITEM(("File %s; Line %d # adding entry for model %s\n", @@ -599,12 +599,12 @@ IconCache::GetVolumeIcon(AutoLock *nodeCacheLocker, } -IconCacheEntry * -IconCache::GetRootIcon(AutoLock *, - AutoLock *sharedCacheLocker, - AutoLock **resultingOpenCache, - Model *, IconSource &source, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *lazyBitmap) +IconCacheEntry* +IconCache::GetRootIcon(AutoLock*, + AutoLock* sharedCacheLocker, + AutoLock** resultingOpenCache, + Model*, IconSource &source, IconDrawMode mode, + icon_size size, LazyBitmapAllocator* lazyBitmap) { *resultingOpenCache = sharedCacheLocker; (*resultingOpenCache)->Lock(); @@ -614,19 +614,19 @@ IconCache::GetRootIcon(AutoLock *, } -IconCacheEntry * -IconCache::GetWellKnownIcon(AutoLock *, - AutoLock *sharedCacheLocker, - AutoLock **resultingOpenCache, - Model *model, IconSource &source, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *lazyBitmap) +IconCacheEntry* +IconCache::GetWellKnownIcon(AutoLock*, + AutoLock* sharedCacheLocker, + AutoLock** resultingOpenCache, + Model* model, IconSource &source, IconDrawMode mode, icon_size size, + LazyBitmapAllocator* lazyBitmap) { - const WellKnowEntryList::WellKnownEntry *wellKnownEntry + const WellKnowEntryList::WellKnownEntry* wellKnownEntry = WellKnowEntryList::MatchEntry(model->NodeRef()); if (!wellKnownEntry) return NULL; - IconCacheEntry *entry = NULL; + IconCacheEntry* entry = NULL; BString type("tracker/active_"); type += wellKnownEntry->name; @@ -709,7 +709,7 @@ IconCache::GetWellKnownIcon(AutoLock *, entry = fSharedCache.AddItem(type.String()); - BBitmap *bitmap = lazyBitmap->Get(); + BBitmap* bitmap = lazyBitmap->Get(); GetTrackerResources()->GetIconResource(resid, size, bitmap); entry->SetIcon(lazyBitmap->Adopt(), kNormalIcon, size); } @@ -725,13 +725,13 @@ IconCache::GetWellKnownIcon(AutoLock *, } -IconCacheEntry * -IconCache::GetNodeIcon(ModelNodeLazyOpener *modelOpener, - AutoLock *nodeCacheLocker, - AutoLock **resultingOpenCache, - Model *model, IconSource &source, +IconCacheEntry* +IconCache::GetNodeIcon(ModelNodeLazyOpener* modelOpener, + AutoLock* nodeCacheLocker, + AutoLock** resultingOpenCache, + Model* model, IconSource &source, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *lazyBitmap, IconCacheEntry *entry, bool permanent) + LazyBitmapAllocator* lazyBitmap, IconCacheEntry* entry, bool permanent) { *resultingOpenCache = nodeCacheLocker; (*resultingOpenCache)->Lock(); @@ -740,13 +740,13 @@ IconCache::GetNodeIcon(ModelNodeLazyOpener *modelOpener, if (!entry || !entry->HaveIconBitmap(NORMAL_ICON_ONLY, size)) { modelOpener->OpenNode(); - BFile *file = NULL; + BFile* file = NULL; // if we are dealing with an application, use the BAppFileInfo // superset of node; this makes GetIcon grab the proper icon for // an app if (model->IsExecutable()) - file = dynamic_cast(model->Node()); + file = dynamic_cast(model->Node()); PRINT_DISK_HITS(("File %s; Line %d # hitting disk for node %s\n", __FILE__, __LINE__, model->Name())); @@ -760,7 +760,7 @@ IconCache::GetNodeIcon(ModelNodeLazyOpener *modelOpener, if (result == B_OK) { // node has it's own icon, use it - BBitmap *bitmap = lazyBitmap->Adopt(); + BBitmap* bitmap = lazyBitmap->Adopt(); PRINT_ADD_ITEM(("File %s; Line %d # adding entry for model %s\n", __FILE__, __LINE__, model->Name())); entry = fNodeCache.AddItem(model->NodeRef(), permanent); @@ -788,12 +788,12 @@ IconCache::GetNodeIcon(ModelNodeLazyOpener *modelOpener, } -IconCacheEntry * -IconCache::GetGenericIcon(AutoLock *sharedCacheLocker, - AutoLock **resultingOpenCache, - Model *model, IconSource &source, +IconCacheEntry* +IconCache::GetGenericIcon(AutoLock* sharedCacheLocker, + AutoLock** resultingOpenCache, + Model* model, IconSource &source, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *lazyBitmap, IconCacheEntry *entry) + LazyBitmapAllocator* lazyBitmap, IconCacheEntry* entry) { *resultingOpenCache = sharedCacheLocker; (*resultingOpenCache)->Lock(); @@ -809,10 +809,10 @@ IconCache::GetGenericIcon(AutoLock *sharedCacheLocker, PRINT_ADD_ITEM(("File %s; Line %d # adding entry for preferredApp %s, type %s\n", __FILE__, __LINE__, model->PreferredAppSignature(), model->MimeType())); - IconCacheEntry *aliasedEntry = fSharedCache.AddItem( - (SharedCacheEntry **)&entry, model->MimeType(), + IconCacheEntry* aliasedEntry = fSharedCache.AddItem( + (SharedCacheEntry**)&entry, model->MimeType(), model->PreferredAppSignature()); - aliasedEntry->SetAliasFor(&fSharedCache, (SharedCacheEntry *)entry); + aliasedEntry->SetAliasFor(&fSharedCache, (SharedCacheEntry*)entry); source = kMetaMime; @@ -821,11 +821,11 @@ IconCache::GetGenericIcon(AutoLock *sharedCacheLocker, } -IconCacheEntry * -IconCache::GetFallbackIcon(AutoLock *sharedCacheLocker, - AutoLock **resultingOpenCache, - Model *model, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *lazyBitmap, IconCacheEntry *entry) +IconCacheEntry* +IconCache::GetFallbackIcon(AutoLock* sharedCacheLocker, + AutoLock** resultingOpenCache, + Model* model, IconDrawMode mode, icon_size size, + LazyBitmapAllocator* lazyBitmap, IconCacheEntry* entry) { *resultingOpenCache = sharedCacheLocker; (*resultingOpenCache)->Lock(); @@ -833,7 +833,7 @@ IconCache::GetFallbackIcon(AutoLock *sharedCacheLocker, entry = fSharedCache.AddItem(model->MimeType(), model->PreferredAppSignature()); - BBitmap *bitmap = lazyBitmap->Get(); + BBitmap* bitmap = lazyBitmap->Get(); GetTrackerResources()->GetIconResource(R_FileIcon, size, bitmap); entry->SetIcon(lazyBitmap->Adopt(), kNormalIcon, size); @@ -847,16 +847,16 @@ IconCache::GetFallbackIcon(AutoLock *sharedCacheLocker, } -IconCacheEntry * -IconCache::Preload(AutoLock *nodeCacheLocker, - AutoLock *sharedCacheLocker, - AutoLock **resultingCache, - Model *model, IconDrawMode mode, icon_size size, +IconCacheEntry* +IconCache::Preload(AutoLock* nodeCacheLocker, + AutoLock* sharedCacheLocker, + AutoLock** resultingCache, + Model* model, IconDrawMode mode, icon_size size, bool permanent) { - IconCacheEntry *entry = NULL; + IconCacheEntry* entry = NULL; - AutoLock *resultingOpenCache = NULL; + AutoLock* resultingOpenCache = NULL; // resultingOpenCache is the locker that points to the cache that // ended with a hit and will be used for the drawing @@ -1031,7 +1031,7 @@ IconCache::Preload(AutoLock *nodeCacheLocker, void -IconCache::Draw(Model *model, BView *view, BPoint where, IconDrawMode mode, +IconCache::Draw(Model* model, BView* view, BPoint where, IconDrawMode mode, icon_size size, bool async) { // the following does not actually lock the caches, we are using the @@ -1040,8 +1040,8 @@ IconCache::Draw(Model *model, BView *view, BPoint where, IconDrawMode mode, AutoLock nodeCacheLocker(&fNodeCache, false); AutoLock sharedCacheLocker(&fSharedCache, false); - AutoLock *resultingCacheLocker; - IconCacheEntry *entry = Preload(&nodeCacheLocker, &sharedCacheLocker, + AutoLock* resultingCacheLocker; + IconCacheEntry* entry = Preload(&nodeCacheLocker, &sharedCacheLocker, &resultingCacheLocker, model, mode, size, false); // Preload finds/creates the appropriate entry, locking down the // cache it is in and returns the whole state back to here @@ -1061,15 +1061,15 @@ IconCache::Draw(Model *model, BView *view, BPoint where, IconDrawMode mode, void -IconCache::SyncDraw(Model *model, BView *view, BPoint where, IconDrawMode mode, - icon_size size, void (*blitFunc)(BView *, BPoint, BBitmap *, void *), - void *passThruState) +IconCache::SyncDraw(Model* model, BView* view, BPoint where, IconDrawMode mode, + icon_size size, void (*blitFunc)(BView*, BPoint, BBitmap*, void*), + void* passThruState) { AutoLock nodeCacheLocker(&fNodeCache, false); AutoLock sharedCacheLocker(&fSharedCache, false); - AutoLock *resultingCacheLocker; - IconCacheEntry *entry = Preload(&nodeCacheLocker, &sharedCacheLocker, + AutoLock* resultingCacheLocker; + IconCacheEntry* entry = Preload(&nodeCacheLocker, &sharedCacheLocker, &resultingCacheLocker, model, mode, size, false); if (!entry) @@ -1083,7 +1083,7 @@ IconCache::SyncDraw(Model *model, BView *view, BPoint where, IconDrawMode mode, void -IconCache::Preload(Model *model, IconDrawMode mode, icon_size size, bool permanent) +IconCache::Preload(Model* model, IconDrawMode mode, icon_size size, bool permanent) { AutoLock nodeCacheLocker(&fNodeCache, false); AutoLock sharedCacheLocker(&fSharedCache, false); @@ -1093,7 +1093,7 @@ IconCache::Preload(Model *model, IconDrawMode mode, icon_size size, bool permane status_t -IconCache::Preload(const char *fileType, IconDrawMode mode, icon_size size) +IconCache::Preload(const char* fileType, IconDrawMode mode, icon_size size) { AutoLock sharedCacheLocker(&fSharedCache); LazyBitmapAllocator lazyBitmap(size); @@ -1105,7 +1105,7 @@ IconCache::Preload(const char *fileType, IconDrawMode mode, icon_size size) return result; // try getting the icon from the preferred app for the signature - IconCacheEntry *entry = GetIconForPreferredApp(fileType, preferredAppSig, + IconCacheEntry* entry = GetIconForPreferredApp(fileType, preferredAppSig, mode, size, &lazyBitmap, 0); if (entry) return B_OK; @@ -1117,7 +1117,7 @@ IconCache::Preload(const char *fileType, IconDrawMode mode, icon_size size) return result; entry = fSharedCache.AddItem(fileType); - BBitmap *bitmap = lazyBitmap.Adopt(); + BBitmap* bitmap = lazyBitmap.Adopt(); entry->SetIcon(bitmap, kNormalIcon, size); if (mode != kNormalIcon) { entry->ConstructBitmap(mode, size, &lazyBitmap); @@ -1129,7 +1129,7 @@ IconCache::Preload(const char *fileType, IconDrawMode mode, icon_size size) void -IconCache::Deleting(const Model *model) +IconCache::Deleting(const Model* model) { AutoLock lock(&fNodeCache); @@ -1141,7 +1141,7 @@ IconCache::Deleting(const Model *model) void -IconCache::Removing(const Model *model) +IconCache::Removing(const Model* model) { AutoLock lock(&fNodeCache); @@ -1151,7 +1151,7 @@ IconCache::Removing(const Model *model) void -IconCache::Deleting(const BView *view) +IconCache::Deleting(const BView* view) { AutoLock lock(&fNodeCache); fNodeCache.Deleting(view); @@ -1159,7 +1159,7 @@ IconCache::Deleting(const BView *view) void -IconCache::IconChanged(Model *model) +IconCache::IconChanged(Model* model) { AutoLock lock(&fNodeCache); @@ -1171,16 +1171,16 @@ IconCache::IconChanged(Model *model) void -IconCache::IconChanged(const char *mimeType, const char *appSignature) +IconCache::IconChanged(const char* mimeType, const char* appSignature) { AutoLock sharedLock(&fSharedCache); - SharedCacheEntry *entry = fSharedCache.FindItem(mimeType, appSignature); + SharedCacheEntry* entry = fSharedCache.FindItem(mimeType, appSignature); if (!entry) return; AutoLock nodeLock(&fNodeCache); - entry = (SharedCacheEntry *)fSharedCache.ResolveIfAlias(entry); + entry = (SharedCacheEntry*)fSharedCache.ResolveIfAlias(entry); ASSERT(entry); int32 index = fSharedCache.EntryIndex(entry); @@ -1191,9 +1191,9 @@ IconCache::IconChanged(const char *mimeType, const char *appSignature) } -BBitmap * -IconCache::MakeSelectedIcon(const BBitmap *normal, icon_size size, - LazyBitmapAllocator *lazyBitmap) +BBitmap* +IconCache::MakeSelectedIcon(const BBitmap* normal, icon_size size, + LazyBitmapAllocator* lazyBitmap) { return MakeTransformedIcon(normal, size, fHiliteTable, lazyBitmap); } @@ -1201,7 +1201,7 @@ IconCache::MakeSelectedIcon(const BBitmap *normal, icon_size size, #if xDEBUG static void -DumpBitmap(const BBitmap *bitmap) +DumpBitmap(const BBitmap* bitmap) { if (!bitmap){ printf("NULL bitmap passed to DumpBitmap\n"); @@ -1212,7 +1212,7 @@ DumpBitmap(const BBitmap *bitmap) printf("data length %ld \n", length); int32 columns = (int32)bitmap->Bounds().Width() + 1; - const unsigned char *bitPtr = (const unsigned char *)bitmap->Bits(); + const unsigned char* bitPtr = (const unsigned char*)bitmap->Bits(); for (; length >= 0; length--) { for (int32 columnIndex = 0; columnIndex < columns; columnIndex++, length--) @@ -1242,7 +1242,7 @@ IconCache::InitHiliteTable() } -BBitmap * +BBitmap* IconCache::MakeTransformedIcon(const BBitmap* source, icon_size /*size*/, int32 colorTransformTable[], LazyBitmapAllocator* lazyBitmap) { @@ -1306,15 +1306,15 @@ IconCache::MakeTransformedIcon(const BBitmap* source, icon_size /*size*/, bool -IconCache::IconHitTest(BPoint where, const Model *model, IconDrawMode mode, +IconCache::IconHitTest(BPoint where, const Model* model, IconDrawMode mode, icon_size size) { AutoLock nodeCacheLocker(&fNodeCache, false); AutoLock sharedCacheLocker(&fSharedCache, false); - AutoLock *resultingCacheLocker; - IconCacheEntry *entry = Preload(&nodeCacheLocker, &sharedCacheLocker, - &resultingCacheLocker, const_cast(model), mode, size, false); + AutoLock* resultingCacheLocker; + IconCacheEntry* entry = Preload(&nodeCacheLocker, &sharedCacheLocker, + &resultingCacheLocker, const_cast(model), mode, size, false); // Preload finds/creates the appropriate entry, locking down the // cache it is in and returns the whole state back to here @@ -1326,7 +1326,7 @@ IconCache::IconHitTest(BPoint where, const Model *model, IconDrawMode mode, void -IconCacheEntry::RetireIcons(BObjectList *retiredBitmapList) +IconCacheEntry::RetireIcons(BObjectList* retiredBitmapList) { if (fLargeIcon) { retiredBitmapList->AddItem(fLargeIcon); @@ -1379,31 +1379,31 @@ SharedIconCache::SharedIconCache() void -SharedIconCache::Draw(IconCacheEntry *entry, BView *view, BPoint where, +SharedIconCache::Draw(IconCacheEntry* entry, BView* view, BPoint where, IconDrawMode mode, icon_size size, bool async) { - ((SharedCacheEntry *)entry)->Draw(view, where, mode, size, async); + ((SharedCacheEntry*)entry)->Draw(view, where, mode, size, async); } void -SharedIconCache::Draw(IconCacheEntry *entry, BView *view, BPoint where, - IconDrawMode mode, icon_size size, void (*blitFunc)(BView *, BPoint, - BBitmap *, void *), void *passThruState) +SharedIconCache::Draw(IconCacheEntry* entry, BView* view, BPoint where, + IconDrawMode mode, icon_size size, void (*blitFunc)(BView*, BPoint, + BBitmap*, void*), void* passThruState) { - ((SharedCacheEntry *)entry)->Draw(view, where, mode, size, + ((SharedCacheEntry*)entry)->Draw(view, where, mode, size, blitFunc, passThruState); } -SharedCacheEntry * -SharedIconCache::FindItem(const char *fileType, const char *appSignature) const +SharedCacheEntry* +SharedIconCache::FindItem(const char* fileType, const char* appSignature) const { ASSERT(fileType); if (!fileType) fileType = B_FILE_MIMETYPE; - SharedCacheEntry *result = fHashTable.FindFirst(SharedCacheEntry::Hash(fileType, + SharedCacheEntry* result = fHashTable.FindFirst(SharedCacheEntry::Hash(fileType, appSignature)); if (!result) @@ -1416,30 +1416,30 @@ SharedIconCache::FindItem(const char *fileType, const char *appSignature) const if (result->fNext < 0) break; - result = const_cast(&fElementArray.At(result->fNext)); + result = const_cast(&fElementArray.At(result->fNext)); } return NULL; } -SharedCacheEntry * -SharedIconCache::AddItem(const char *fileType, const char *appSignature) +SharedCacheEntry* +SharedIconCache::AddItem(const char* fileType, const char* appSignature) { ASSERT(fileType); if (!fileType) fileType = B_FILE_MIMETYPE; - SharedCacheEntry *result = fHashTable.Add(SharedCacheEntry::Hash(fileType, + SharedCacheEntry* result = fHashTable.Add(SharedCacheEntry::Hash(fileType, appSignature)); result->SetTo(fileType, appSignature); return result; } -SharedCacheEntry * -SharedIconCache::AddItem(SharedCacheEntry **outstandingEntry, const char *fileType, - const char *appSignature) +SharedCacheEntry* +SharedIconCache::AddItem(SharedCacheEntry** outstandingEntry, const char* fileType, + const char* appSignature) { int32 entryToken = fHashTable.ElementIndex(*outstandingEntry); ASSERT(entryToken >= 0); @@ -1448,7 +1448,7 @@ SharedIconCache::AddItem(SharedCacheEntry **outstandingEntry, const char *fileTy if (!fileType) fileType = B_FILE_MIMETYPE; - SharedCacheEntry *result = fHashTable.Add(SharedCacheEntry::Hash(fileType, + SharedCacheEntry* result = fHashTable.Add(SharedCacheEntry::Hash(fileType, appSignature)); result->SetTo(fileType, appSignature); *outstandingEntry = fHashTable.ElementAt(entryToken); @@ -1458,7 +1458,7 @@ SharedIconCache::AddItem(SharedCacheEntry **outstandingEntry, const char *fileTy void -SharedIconCache::IconChanged(SharedCacheEntry *entry) +SharedIconCache::IconChanged(SharedCacheEntry* entry) { // by now there should be no aliases to entry, just remove entry // itself @@ -1473,7 +1473,7 @@ SharedIconCache::RemoveAliasesTo(int32 aliasIndex) { int32 count = fHashTable.VectorSize(); for (int32 index = 0; index < count; index++) { - SharedCacheEntry *entry = fHashTable.ElementAt(index); + SharedCacheEntry* entry = fHashTable.ElementAt(index); if (entry->fAliasForIndex == aliasIndex) fHashTable.Remove(entry); } @@ -1481,7 +1481,7 @@ SharedIconCache::RemoveAliasesTo(int32 aliasIndex) void -SharedIconCache::SetAliasFor(IconCacheEntry *alias, const SharedCacheEntry *original) const +SharedIconCache::SetAliasFor(IconCacheEntry* alias, const SharedCacheEntry* original) const { alias->fAliasForIndex = fHashTable.ElementIndex(original); } @@ -1493,7 +1493,7 @@ SharedCacheEntry::SharedCacheEntry() } -SharedCacheEntry::SharedCacheEntry(const char *fileType, const char *appSignature) +SharedCacheEntry::SharedCacheEntry(const char* fileType, const char* appSignature) : fNext(-1), fFileType(fileType), fAppSignature(appSignature) @@ -1529,10 +1529,10 @@ SharedCacheEntry::Draw(BView* view, BPoint where, IconDrawMode mode, icon_size s void -SharedCacheEntry::Draw(BView *view, BPoint where, IconDrawMode mode, icon_size size, - void (*blitFunc)(BView *, BPoint ,BBitmap *, void *), void *passThruState) +SharedCacheEntry::Draw(BView* view, BPoint where, IconDrawMode mode, icon_size size, + void (*blitFunc)(BView*, BPoint, BBitmap*, void*), void* passThruState) { - BBitmap *bitmap = IconForMode(mode, size); + BBitmap* bitmap = IconForMode(mode, size); if (!bitmap) return; @@ -1548,7 +1548,7 @@ SharedCacheEntry::Draw(BView *view, BPoint where, IconDrawMode mode, icon_size s uint32 -SharedCacheEntry::Hash(const char *fileType, const char *appSignature) +SharedCacheEntry::Hash(const char* fileType, const char* appSignature) { uint32 hash = HashString(fileType, 0); if (appSignature && appSignature[0]) @@ -1577,7 +1577,7 @@ SharedCacheEntry::operator==(const SharedCacheEntry &entry) const void -SharedCacheEntry::SetTo(const char *fileType, const char *appSignature) +SharedCacheEntry::SetTo(const char* fileType, const char* appSignature) { fFileType = fileType; fAppSignature = appSignature; @@ -1590,7 +1590,7 @@ SharedCacheEntryArray::SharedCacheEntryArray(int32 initialSize) } -SharedCacheEntry * +SharedCacheEntry* SharedCacheEntryArray::Add() { return OpenHashElementArray::Add(); @@ -1607,7 +1607,7 @@ NodeCacheEntry::NodeCacheEntry(bool permanent) } -NodeCacheEntry::NodeCacheEntry(const node_ref *node, bool permanent) +NodeCacheEntry::NodeCacheEntry(const node_ref* node, bool permanent) : fNext(-1), fRef(*node), fPermanent(permanent) @@ -1616,10 +1616,10 @@ NodeCacheEntry::NodeCacheEntry(const node_ref *node, bool permanent) void -NodeCacheEntry::Draw(BView *view, BPoint where, IconDrawMode mode, icon_size size, +NodeCacheEntry::Draw(BView* view, BPoint where, IconDrawMode mode, icon_size size, bool async) { - BBitmap *bitmap = IconForMode(mode, size); + BBitmap* bitmap = IconForMode(mode, size); if (!bitmap) return; @@ -1646,10 +1646,10 @@ NodeCacheEntry::Draw(BView *view, BPoint where, IconDrawMode mode, icon_size siz void -NodeCacheEntry::Draw(BView *view, BPoint where, IconDrawMode mode, icon_size size, - void (*blitFunc)(BView *, BPoint ,BBitmap *, void *), void *passThruState) +NodeCacheEntry::Draw(BView* view, BPoint where, IconDrawMode mode, icon_size size, + void (*blitFunc)(BView*, BPoint, BBitmap*, void*), void* passThruState) { - BBitmap *bitmap = IconForMode(mode, size); + BBitmap* bitmap = IconForMode(mode, size); if (!bitmap) return; @@ -1664,7 +1664,7 @@ NodeCacheEntry::Draw(BView *view, BPoint where, IconDrawMode mode, icon_size siz } -const node_ref * +const node_ref* NodeCacheEntry::Node() const { return &fRef; @@ -1679,10 +1679,10 @@ NodeCacheEntry::Hash() const uint32 -NodeCacheEntry::Hash(const node_ref *node) +NodeCacheEntry::Hash(const node_ref* node) { - return node->device ^ ((uint32 *)&node->node)[0] - ^ ((uint32 *)&node->node)[1]; + return node->device ^ ((uint32*)&node->node)[0] + ^ ((uint32*)&node->node)[1]; } @@ -1694,7 +1694,7 @@ NodeCacheEntry::operator==(const NodeCacheEntry &entry) const void -NodeCacheEntry::SetTo(const node_ref *node) +NodeCacheEntry::SetTo(const node_ref* node) { fRef = *node; } @@ -1733,28 +1733,28 @@ NodeIconCache::NodeIconCache() void -NodeIconCache::Draw(IconCacheEntry *entry, BView *view, BPoint where, +NodeIconCache::Draw(IconCacheEntry* entry, BView* view, BPoint where, IconDrawMode mode, icon_size size, bool async) { - ((NodeCacheEntry *)entry)->Draw(view, where, mode, size, async); + ((NodeCacheEntry*)entry)->Draw(view, where, mode, size, async); } void -NodeIconCache::Draw(IconCacheEntry *entry, BView *view, BPoint where, - IconDrawMode mode, icon_size size, void (*blitFunc)(BView *, BPoint, - BBitmap *, void *), void *passThruState) +NodeIconCache::Draw(IconCacheEntry* entry, BView* view, BPoint where, + IconDrawMode mode, icon_size size, void (*blitFunc)(BView*, BPoint, + BBitmap*, void*), void* passThruState) { - ((NodeCacheEntry *)entry)->Draw(view, where, mode, size, + ((NodeCacheEntry*)entry)->Draw(view, where, mode, size, blitFunc, passThruState); } -NodeCacheEntry * -NodeIconCache::FindItem(const node_ref *node) const +NodeCacheEntry* +NodeIconCache::FindItem(const node_ref* node) const { - NodeCacheEntry *result = fHashTable.FindFirst(NodeCacheEntry::Hash(node)); + NodeCacheEntry* result = fHashTable.FindFirst(NodeCacheEntry::Hash(node)); if (!result) return NULL; @@ -1766,17 +1766,17 @@ NodeIconCache::FindItem(const node_ref *node) const if (result->fNext < 0) break; - result = const_cast(&fElementArray.At(result->fNext)); + result = const_cast(&fElementArray.At(result->fNext)); } return NULL; } -NodeCacheEntry * -NodeIconCache::AddItem(const node_ref *node, bool permanent) +NodeCacheEntry* +NodeIconCache::AddItem(const node_ref* node, bool permanent) { - NodeCacheEntry *result = fHashTable.Add(NodeCacheEntry::Hash(node)); + NodeCacheEntry* result = fHashTable.Add(NodeCacheEntry::Hash(node)); result->SetTo(node); if (permanent) result->MakePermanent(); @@ -1785,12 +1785,12 @@ NodeIconCache::AddItem(const node_ref *node, bool permanent) } -NodeCacheEntry * -NodeIconCache::AddItem(NodeCacheEntry **outstandingEntry, const node_ref *node) +NodeCacheEntry* +NodeIconCache::AddItem(NodeCacheEntry** outstandingEntry, const node_ref* node) { int32 entryToken = fHashTable.ElementIndex(*outstandingEntry); - NodeCacheEntry *result = fHashTable.Add(NodeCacheEntry::Hash(node)); + NodeCacheEntry* result = fHashTable.Add(NodeCacheEntry::Hash(node)); result->SetTo(node); *outstandingEntry = fHashTable.ElementAt(entryToken); @@ -1799,9 +1799,9 @@ NodeIconCache::AddItem(NodeCacheEntry **outstandingEntry, const node_ref *node) void -NodeIconCache::Deleting(const node_ref *node) +NodeIconCache::Deleting(const node_ref* node) { - NodeCacheEntry *entry = FindItem(node); + NodeCacheEntry* entry = FindItem(node); ASSERT(entry); if (!entry || entry->Permanent()) return; @@ -1811,9 +1811,9 @@ NodeIconCache::Deleting(const node_ref *node) void -NodeIconCache::Removing(const node_ref *node) +NodeIconCache::Removing(const node_ref* node) { - NodeCacheEntry *entry = FindItem(node); + NodeCacheEntry* entry = FindItem(node); ASSERT(entry); if (!entry) return; @@ -1823,7 +1823,7 @@ NodeIconCache::Removing(const node_ref *node) void -NodeIconCache::Deleting(const BView *) +NodeIconCache::Deleting(const BView*) { #ifdef NODE_CACHE_ASYNC_DRAWS TRESPASS(); @@ -1832,7 +1832,7 @@ NodeIconCache::Deleting(const BView *) void -NodeIconCache::IconChanged(const Model *model) +NodeIconCache::IconChanged(const Model* model) { Deleting(model->NodeRef()); } @@ -1843,7 +1843,7 @@ NodeIconCache::RemoveAliasesTo(int32 aliasIndex) { int32 count = fHashTable.VectorSize(); for (int32 index = 0; index < count; index++) { - NodeCacheEntry *entry = fHashTable.ElementAt(index); + NodeCacheEntry* entry = fHashTable.ElementAt(index); if (entry->fAliasForIndex == aliasIndex) fHashTable.Remove(entry); } @@ -1859,7 +1859,7 @@ NodeCacheEntryArray::NodeCacheEntryArray(int32 initialSize) } -NodeCacheEntry * +NodeCacheEntry* NodeCacheEntryArray::Add() { return OpenHashElementArray::Add(); @@ -1869,14 +1869,14 @@ NodeCacheEntryArray::Add() // #pragma mark - -SimpleIconCache::SimpleIconCache(const char *name) +SimpleIconCache::SimpleIconCache(const char* name) : fLock(name) { } void -SimpleIconCache::Draw(IconCacheEntry *, BView *, BPoint, IconDrawMode , +SimpleIconCache::Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode , icon_size , bool ) { TRESPASS(); @@ -1885,8 +1885,8 @@ SimpleIconCache::Draw(IconCacheEntry *, BView *, BPoint, IconDrawMode , void -SimpleIconCache::Draw(IconCacheEntry *, BView *, BPoint, IconDrawMode, icon_size, - void(*)(BView *, BPoint, BBitmap *, void *), void *) +SimpleIconCache::Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode, icon_size, + void(*)(BView*, BPoint, BBitmap*, void*), void*) { TRESPASS(); // pure virtual, do nothing @@ -1934,7 +1934,7 @@ LazyBitmapAllocator::~LazyBitmapAllocator() } -BBitmap * +BBitmap* LazyBitmapAllocator::Get() { if (!fBitmap) @@ -1944,16 +1944,16 @@ LazyBitmapAllocator::Get() } -BBitmap * +BBitmap* LazyBitmapAllocator::Adopt() { if (!fBitmap) Get(); - BBitmap *result = fBitmap; + BBitmap* result = fBitmap; fBitmap = NULL; return result; } -IconCache *IconCache::sIconCache; +IconCache* IconCache::sIconCache; diff --git a/src/kits/tracker/IconCache.h b/src/kits/tracker/IconCache.h index 100c120089..94690f609e 100644 --- a/src/kits/tracker/IconCache.h +++ b/src/kits/tracker/IconCache.h @@ -31,13 +31,14 @@ 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. */ - -// Icon cache is used for drawing node icons; it caches icons -// and reuses them for successive draws - #ifndef __NU_ICON_CACHE__ #define __NU_ICON_CACHE__ + +// Icon cache is used for drawing node icons; it caches icons +// and reuses them for successive draws + + #include #include #include @@ -47,6 +48,7 @@ All rights reserved. #include "OpenHashTable.h" #include "Utilities.h" + // Icon cache splits icons into two caches - the shared cache, likely to get the // most hits and the node cache. Every icon that is found in a mime based // structure goes into the shared cache, only files that have their own private @@ -89,6 +91,7 @@ enum IconDrawMode { kDimmedIcon }; + #define NORMAL_ICON_ONLY kNormalIcon // replace use of these defines with mode once the respective getters // can get non-plain icons @@ -110,6 +113,7 @@ enum IconSource { kNode }; + class IconCacheEntry { // aliased entries don't own their icons, just point // to some other entry that does @@ -122,46 +126,46 @@ public: IconCacheEntry(); ~IconCacheEntry(); - void SetAliasFor(const SharedIconCache *, const SharedCacheEntry *); - static IconCacheEntry *ResolveIfAlias(const SharedIconCache *, IconCacheEntry *); - IconCacheEntry *ResolveIfAlias(const SharedIconCache *); + void SetAliasFor(const SharedIconCache*, const SharedCacheEntry*); + static IconCacheEntry* ResolveIfAlias(const SharedIconCache*, IconCacheEntry*); + IconCacheEntry* ResolveIfAlias(const SharedIconCache*); - void SetIcon(BBitmap *bitmap, IconDrawMode mode, icon_size size, + void SetIcon(BBitmap* bitmap, IconDrawMode mode, icon_size size, bool create = false); bool HaveIconBitmap(IconDrawMode mode, icon_size size) const; bool CanConstructBitmap(IconDrawMode mode, icon_size size) const; static bool AlternateModeForIconConstructing(IconDrawMode requestedMode, IconDrawMode &alternate, icon_size size); - BBitmap *ConstructBitmap(BBitmap *constructFrom, IconDrawMode requestedMode, + BBitmap* ConstructBitmap(BBitmap* constructFrom, IconDrawMode requestedMode, IconDrawMode constructFromMode, icon_size size, - LazyBitmapAllocator *); - BBitmap *ConstructBitmap(IconDrawMode requestedMode, icon_size size, - LazyBitmapAllocator *); - // same as above, always uses normal icon as source + LazyBitmapAllocator*); + BBitmap* ConstructBitmap(IconDrawMode requestedMode, icon_size size, + LazyBitmapAllocator*); + // same as above, always uses normal icon as source bool IconHitTest(BPoint, IconDrawMode, icon_size) const; // given a point, returns true if a non-transparent pixel was hit - void RetireIcons(BObjectList *retiredBitmapList); + void RetireIcons(BObjectList* retiredBitmapList); // can't just delete icons, they may be still drawing // async; instead, put them on the retired list and // only delete the list if it grows too much, way after // the icon finishes drawing - // + // // This could fail if we retire a lot of icons (10 * 1024) // while we are drawing them, shouldn't be a practical problem protected: - BBitmap *IconForMode(IconDrawMode mode, icon_size size) const; - void SetIconForMode(BBitmap *bitmap, IconDrawMode mode, icon_size size); + BBitmap* IconForMode(IconDrawMode mode, icon_size size) const; + void SetIconForMode(BBitmap* bitmap, IconDrawMode mode, icon_size size); // list of most common icons - BBitmap *fLargeIcon; - BBitmap *fMiniIcon; - BBitmap *fHilitedLargeIcon; - BBitmap *fHilitedMiniIcon; + BBitmap* fLargeIcon; + BBitmap* fMiniIcon; + BBitmap* fHilitedLargeIcon; + BBitmap* fHilitedMiniIcon; int32 fAliasForIndex; // list of other icon kinds would be added here @@ -170,15 +174,17 @@ protected: friend class NodeIconCache; }; + class SimpleIconCache { public: - SimpleIconCache(const char *); + SimpleIconCache(const char*); virtual ~SimpleIconCache() {} - virtual void Draw(IconCacheEntry *, BView *, BPoint, IconDrawMode mode, + virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode mode, icon_size size, bool async = false) = 0; - virtual void Draw(IconCacheEntry *, BView *, BPoint , IconDrawMode , - icon_size , void (*)(BView *, BPoint, BBitmap *, void *), void * = NULL) = 0; + virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode, + icon_size, void (*)(BView*, BPoint, BBitmap*, void*), + void* = NULL) = 0; bool Lock(); void Unlock(); @@ -188,25 +194,26 @@ private: Benaphore fLock; }; + class SharedCacheEntry : public IconCacheEntry { public: SharedCacheEntry(); - SharedCacheEntry(const char *fileType, const char *appSignature = 0); + SharedCacheEntry(const char* fileType, const char* appSignature = 0); - void Draw(BView *, BPoint, IconDrawMode mode, icon_size size, + void Draw(BView*, BPoint, IconDrawMode mode, icon_size size, bool async = false); - void Draw(BView *, BPoint , IconDrawMode , icon_size , - void (*)(BView *, BPoint, BBitmap *, void *), void * = NULL); + void Draw(BView*, BPoint, IconDrawMode, icon_size, + void (*)(BView*, BPoint, BBitmap*, void*), void* = NULL); - const char *FileType() const; - const char *AppSignature() const; + const char* FileType() const; + const char* AppSignature() const; // hash table support uint32 Hash() const; - static uint32 Hash(const char *fileType, const char *appSignature = 0); + static uint32 Hash(const char* fileType, const char* appSignature = 0); bool operator==(const SharedCacheEntry &) const; - void SetTo(const char *fileType, const char *appSignature = 0); + void SetTo(const char* fileType, const char* appSignature = 0); int32 fNext; private: @@ -216,35 +223,37 @@ private: friend class SharedIconCache; }; + class SharedCacheEntryArray : public OpenHashElementArray { // SharedIconCache stores all it's elements in this array public: SharedCacheEntryArray(int32 initialSize); - SharedCacheEntry *Add(); + SharedCacheEntry* Add(); }; + class SharedIconCache : public SimpleIconCache { // SharedIconCache is used for icons that come from the mime database public: SharedIconCache(); - virtual void Draw(IconCacheEntry *, BView *, BPoint, IconDrawMode mode, + virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode mode, icon_size size, bool async = false); - virtual void Draw(IconCacheEntry *, BView *, BPoint , IconDrawMode , - icon_size , void (*)(BView *, BPoint, BBitmap *, void *), void * = NULL); + virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode, + icon_size, void (*)(BView*, BPoint, BBitmap*, void*), void* = NULL); - SharedCacheEntry *FindItem(const char *fileType, const char *appSignature = 0) + SharedCacheEntry* FindItem(const char* fileType, const char* appSignature = 0) const; - SharedCacheEntry *AddItem(const char *fileType, const char *appSignature = 0); - SharedCacheEntry *AddItem(SharedCacheEntry **outstandingEntry, const char *fileType, - const char *appSignature = 0); + SharedCacheEntry* AddItem(const char* fileType, const char* appSignature = 0); + SharedCacheEntry* AddItem(SharedCacheEntry** outstandingEntry, const char* fileType, + const char* appSignature = 0); // same as previous AddItem, updates the pointer to outstandingEntry, because // adding to the hash table makes any pending pointer invalid - void IconChanged(SharedCacheEntry *); + void IconChanged(SharedCacheEntry*); - void SetAliasFor(IconCacheEntry *alias, const SharedCacheEntry *original) const; - IconCacheEntry *ResolveIfAlias(IconCacheEntry *entry) const; - int32 EntryIndex(const SharedCacheEntry *entry) const; + void SetAliasFor(IconCacheEntry* alias, const SharedCacheEntry* original) const; + IconCacheEntry* ResolveIfAlias(IconCacheEntry* entry) const; + int32 EntryIndex(const SharedCacheEntry* entry) const; void RemoveAliasesTo(int32 index); @@ -257,22 +266,23 @@ private: // and wait for the next sync to delete them }; + class NodeCacheEntry : public IconCacheEntry { public: NodeCacheEntry(bool permanent = false); - NodeCacheEntry(const node_ref *, bool permanent = false); - void Draw(BView *, BPoint, IconDrawMode mode, icon_size size, + NodeCacheEntry(const node_ref*, bool permanent = false); + void Draw(BView*, BPoint, IconDrawMode mode, icon_size size, bool async = false); - void Draw(BView *, BPoint , IconDrawMode , icon_size , - void (*)(BView *, BPoint, BBitmap *, void *), void * = NULL); + void Draw(BView*, BPoint, IconDrawMode, icon_size, + void (*)(BView*, BPoint, BBitmap*, void*), void* = NULL); - const node_ref *Node() const; + const node_ref* Node() const; uint32 Hash() const; - static uint32 Hash(const node_ref *); - bool operator==(const NodeCacheEntry &) const; - void SetTo(const node_ref *); + static uint32 Hash(const node_ref*); + bool operator==(const NodeCacheEntry&) const; + void SetTo(const node_ref*); void MakePermanent(); bool Permanent() const; @@ -285,35 +295,37 @@ private: friend class NodeIconCache; }; + class NodeCacheEntryArray : public OpenHashElementArray { // NodeIconCache stores all it's elements in this array public: NodeCacheEntryArray(int32 initialSize); - NodeCacheEntry *Add(); + NodeCacheEntry* Add(); }; + class NodeIconCache : public SimpleIconCache { // NodeIconCache is used for nodes that define their own icons public: NodeIconCache(); - virtual void Draw(IconCacheEntry *, BView *, BPoint, IconDrawMode , - icon_size , bool async = false); + virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode, + icon_size, bool async = false); - virtual void Draw(IconCacheEntry *, BView *, BPoint , IconDrawMode , - icon_size , void (*)(BView *, BPoint, BBitmap *, void *), void * = 0); + virtual void Draw(IconCacheEntry*, BView*, BPoint, IconDrawMode, + icon_size, void (*)(BView*, BPoint, BBitmap*, void*), void* = 0); - NodeCacheEntry *FindItem(const node_ref *) const; - NodeCacheEntry *AddItem(const node_ref *, bool permanent = false); - NodeCacheEntry *AddItem(NodeCacheEntry **outstandingEntry, const node_ref *); + NodeCacheEntry* FindItem(const node_ref*) const; + NodeCacheEntry* AddItem(const node_ref*, bool permanent = false); + NodeCacheEntry* AddItem(NodeCacheEntry** outstandingEntry, const node_ref*); // same as previous AddItem, updates the pointer to outstandingEntry, because // adding to the hash table makes any pending pointer invalid - void Deleting(const node_ref *); + void Deleting(const node_ref*); // model for this node is getting deleted (not necessarily the node itself) - void Removing(const node_ref *); + void Removing(const node_ref*); // used by permanent NodeIconCache entries, when an entry gets deleted - void Deleting(const BView *); - void IconChanged(const Model *); + void Deleting(const BView*); + void IconChanged(const Model*); void RemoveAliasesTo(int32 index); @@ -323,20 +335,22 @@ private: NodeCacheEntryArray fElementArray; }; + const int32 kColorTransformTableSize = 256; + class IconCache { public: IconCache(); - void Draw(Model *, BView *, BPoint where, IconDrawMode mode, + void Draw(Model*, BView*, BPoint where, IconDrawMode mode, icon_size size, bool async = false); // draw an icon for a model, load the icon from the appropriate // location if not cached already - void SyncDraw(Model *, BView *, BPoint , IconDrawMode , - icon_size , void (*)(BView *, BPoint, BBitmap *, void *), - void *passThruState = 0); + void SyncDraw(Model*, BView*, BPoint, IconDrawMode, + icon_size, void (*)(BView*, BPoint, BBitmap*, void*), + void* passThruState = 0); // draw an icon for a model, load the icon from the appropriate // location if not cached already; only works for sync draws, // once the call returns, the bitmap may be deleted @@ -344,92 +358,91 @@ public: // preload calls used to ensure successive cache hit for the respective // icon, used for common tracker types, etc; Not calling these should only // cause a slowdown - void Preload(Model *, IconDrawMode mode, icon_size size, bool permanent = false); - status_t Preload(const char *mimeType, IconDrawMode mode, icon_size size); + void Preload(Model*, IconDrawMode mode, icon_size size, + bool permanent = false); + status_t Preload(const char* mimeType, IconDrawMode mode, icon_size size); - void Deleting(const Model *); - // hook to manage unloading icons for nodes that are going away - void Removing(const Model *model); + void Deleting(const Model*); + // hook to manage unloading icons for nodes that are going away + void Removing(const Model* model); // used by permanent NodeIconCache entries, when an entry gets // deleted - void Deleting(const BView *); + void Deleting(const BView*); // hook to manage deleting draw view caches for views that are // going away // icon changed calls, used when a node or a file type has an icon changed // the icons for the node/file type will be flushed and re-cached during // the next draw - void IconChanged(Model *); - void IconChanged(const char *mimeType, const char *appSignature); + void IconChanged(Model*); + void IconChanged(const char* mimeType, const char* appSignature); - bool IsIconFrom(const Model *, const char *mimeType, - const char *appSignature) const; + bool IsIconFrom(const Model*, const char* mimeType, + const char* appSignature) const; // called when metamime database changed to figure out which models // to redraw - bool IconHitTest(BPoint, const Model *, IconDrawMode , icon_size ); + bool IconHitTest(BPoint, const Model*, IconDrawMode, icon_size); // utility calls for building specialized icons - BBitmap *MakeSelectedIcon(const BBitmap *normal, icon_size, - LazyBitmapAllocator *); - - + BBitmap* MakeSelectedIcon(const BBitmap* normal, icon_size, + LazyBitmapAllocator*); + static bool NeedsDeletionNotification(IconSource); - static IconCache *sIconCache; + static IconCache* sIconCache; private: - // shared calls - IconCacheEntry *Preload(AutoLock *nodeCache, - AutoLock *sharedCache, - AutoLock **resultingLockedCache, - Model *, IconDrawMode mode, icon_size size, bool permanent); + IconCacheEntry* Preload(AutoLock* nodeCache, + AutoLock* sharedCache, + AutoLock** resultingLockedCache, + Model*, IconDrawMode mode, icon_size size, bool permanent); // preload uses lazy locking, returning the cache we decided // to use to get the icon // may be null if we don't care // shared mime-based icon retrieval calls - IconCacheEntry *GetIconForPreferredApp(const char *mimeTypeSignature, - const char *preferredApp, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *, IconCacheEntry *); - IconCacheEntry *GetIconFromFileTypes(ModelNodeLazyOpener *, IconSource &source, - IconDrawMode mode, icon_size size, LazyBitmapAllocator *, - IconCacheEntry *); - IconCacheEntry *GetIconFromMetaMime(const char *fileType, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *, - IconCacheEntry *); - IconCacheEntry *GetVolumeIcon(AutoLock *nodeCache, - AutoLock *sharedCache, - AutoLock **resultingLockedCache, - Model *, IconSource &, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *); - IconCacheEntry *GetRootIcon(AutoLock *nodeCache, - AutoLock *sharedCache, - AutoLock **resultingLockedCache, - Model *, IconSource &, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *); - IconCacheEntry *GetWellKnownIcon(AutoLock *nodeCache, - AutoLock *sharedCache, - AutoLock **resultingLockedCache, - Model *, IconSource &, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *); - IconCacheEntry *GetNodeIcon(ModelNodeLazyOpener *, - AutoLock *nodeCache, - AutoLock **resultingLockedCache, - Model *, IconSource &, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *, IconCacheEntry *, bool permanent); - IconCacheEntry *GetGenericIcon(AutoLock *sharedCache, - AutoLock **resultingLockedCache, - Model *, IconSource &, IconDrawMode mode, - icon_size size, LazyBitmapAllocator *, IconCacheEntry *); - IconCacheEntry *GetFallbackIcon(AutoLock *sharedCacheLocker, - AutoLock **resultingOpenCache, - Model *model, IconDrawMode mode, icon_size size, - LazyBitmapAllocator *lazyBitmap, IconCacheEntry *entry); + IconCacheEntry* GetIconForPreferredApp(const char* mimeTypeSignature, + const char* preferredApp, IconDrawMode mode, icon_size size, + LazyBitmapAllocator*, IconCacheEntry*); + IconCacheEntry* GetIconFromFileTypes(ModelNodeLazyOpener*, IconSource &source, + IconDrawMode mode, icon_size size, LazyBitmapAllocator*, + IconCacheEntry*); + IconCacheEntry* GetIconFromMetaMime(const char* fileType, IconDrawMode mode, + icon_size size, LazyBitmapAllocator*, + IconCacheEntry*); + IconCacheEntry* GetVolumeIcon(AutoLock* nodeCache, + AutoLock* sharedCache, + AutoLock** resultingLockedCache, + Model*, IconSource&, IconDrawMode mode, + icon_size size, LazyBitmapAllocator*); + IconCacheEntry* GetRootIcon(AutoLock* nodeCache, + AutoLock* sharedCache, + AutoLock** resultingLockedCache, + Model*, IconSource&, IconDrawMode mode, + icon_size size, LazyBitmapAllocator*); + IconCacheEntry* GetWellKnownIcon(AutoLock *nodeCache, + AutoLock* sharedCache, + AutoLock** resultingLockedCache, + Model*, IconSource&, IconDrawMode mode, + icon_size size, LazyBitmapAllocator*); + IconCacheEntry* GetNodeIcon(ModelNodeLazyOpener *, + AutoLock* nodeCache, + AutoLock** resultingLockedCache, + Model*, IconSource&, IconDrawMode mode, + icon_size size, LazyBitmapAllocator*, IconCacheEntry*, bool permanent); + IconCacheEntry* GetGenericIcon(AutoLock* sharedCache, + AutoLock** resultingLockedCache, + Model*, IconSource&, IconDrawMode mode, + icon_size size, LazyBitmapAllocator*, IconCacheEntry*); + IconCacheEntry* GetFallbackIcon(AutoLock* sharedCacheLocker, + AutoLock** resultingOpenCache, + Model* model, IconDrawMode mode, icon_size size, + LazyBitmapAllocator* lazyBitmap, IconCacheEntry* entry); - BBitmap *MakeTransformedIcon(const BBitmap *, icon_size, - int32 colorTransformTable [], LazyBitmapAllocator *); + BBitmap* MakeTransformedIcon(const BBitmap*, icon_size, + int32 colorTransformTable [], LazyBitmapAllocator*); NodeIconCache fNodeCache; SharedIconCache fSharedCache; @@ -451,37 +464,41 @@ public: bool preallocate = false); ~LazyBitmapAllocator(); - BBitmap *Get(); - BBitmap *Adopt(); + BBitmap* Get(); + BBitmap* Adopt(); private: - BBitmap *fBitmap; + BBitmap* fBitmap; icon_size fSize; color_space fColorSpace; }; -// nothing but inlines after here -inline const char * +// inlines follow + +inline const char* SharedCacheEntry::FileType() const { return fFileType.String(); } -inline const char * + +inline const char* SharedCacheEntry::AppSignature() const { return fAppSignature.String(); } -inline bool + +inline bool IconCache::NeedsDeletionNotification(IconSource from) { return from == kNode; } -inline IconCacheEntry * -SharedIconCache::ResolveIfAlias(IconCacheEntry *entry) const + +inline IconCacheEntry* +SharedIconCache::ResolveIfAlias(IconCacheEntry* entry) const { if (entry->fAliasForIndex < 0) return entry; @@ -489,8 +506,9 @@ SharedIconCache::ResolveIfAlias(IconCacheEntry *entry) const return fHashTable.ElementAt(entry->fAliasForIndex); } -inline int32 -SharedIconCache::EntryIndex(const SharedCacheEntry *entry) const + +inline int32 +SharedIconCache::EntryIndex(const SharedCacheEntry* entry) const { return fHashTable.ElementIndex(entry); } diff --git a/src/kits/tracker/IconMenuItem.cpp b/src/kits/tracker/IconMenuItem.cpp index 615d07f565..f28c0e01a0 100644 --- a/src/kits/tracker/IconMenuItem.cpp +++ b/src/kits/tracker/IconMenuItem.cpp @@ -43,7 +43,7 @@ All rights reserved. static void -DimmedIconBlitter(BView *view, BPoint where, BBitmap *bitmap, void *) +DimmedIconBlitter(BView* view, BPoint where, BBitmap* bitmap, void*) { if (bitmap->ColorSpace() == B_RGBA32) { rgb_color oldHighColor = view->HighColor(); @@ -63,8 +63,8 @@ DimmedIconBlitter(BView *view, BPoint where, BBitmap *bitmap, void *) // #pragma mark - -ModelMenuItem::ModelMenuItem(const Model *model, const char *title, - BMessage *message, char shortcut, uint32 modifiers, +ModelMenuItem::ModelMenuItem(const Model* model, const char* title, + BMessage* message, char shortcut, uint32 modifiers, bool drawText, bool extraPad) : BMenuItem(title, message, shortcut, modifiers), fModel(*model), @@ -88,7 +88,7 @@ ModelMenuItem::ModelMenuItem(const Model *model, const char *title, } -ModelMenuItem::ModelMenuItem(const Model *model, BMenu *menu, bool drawText, +ModelMenuItem::ModelMenuItem(const Model* model, BMenu* menu, bool drawText, bool extraPad) : BMenuItem(menu), fModel(*model), @@ -109,7 +109,7 @@ ModelMenuItem::~ModelMenuItem() status_t -ModelMenuItem::SetEntry(const BEntry *entry) +ModelMenuItem::SetEntry(const BEntry* entry) { return fModel.SetTo(entry); } @@ -171,7 +171,7 @@ ModelMenuItem::DrawIcon() void -ModelMenuItem::GetContentSize(float *width, float *height) +ModelMenuItem::GetContentSize(float* width, float* height) { _inherited::GetContentSize(width, height); fHeightDelta = 16 - *height; @@ -182,7 +182,7 @@ ModelMenuItem::GetContentSize(float *width, float *height) status_t -ModelMenuItem::Invoke(BMessage *message) +ModelMenuItem::Invoke(BMessage* message) { if (!Menu()) return B_ERROR; @@ -219,7 +219,7 @@ ModelMenuItem::Invoke(BMessage *message) It's used for example in the "Copy To" menu to indicate some special folders like the parent folder. */ -SpecialModelMenuItem::SpecialModelMenuItem(const Model *model, BMenu *menu) +SpecialModelMenuItem::SpecialModelMenuItem(const Model* model, BMenu* menu) : ModelMenuItem(model, menu) { } @@ -247,7 +247,7 @@ SpecialModelMenuItem::DrawContent() A menu item that draws an icon alongside the label. It's currently used in the mount and new file template menus. */ -IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon) +IconMenuItem::IconMenuItem(const char* label, BMessage* message, BBitmap* icon) : PositionPassingMenuItem(label, message), fDeviceIcon(icon), fHeightDelta(0) @@ -258,8 +258,8 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message, BBitmap *icon) } -IconMenuItem::IconMenuItem(const char *label, BMessage *message, - const BNodeInfo *nodeInfo, icon_size which) +IconMenuItem::IconMenuItem(const char* label, BMessage* message, + const BNodeInfo* nodeInfo, icon_size which) : PositionPassingMenuItem(label, message), fDeviceIcon(NULL), fHeightDelta(0) @@ -283,8 +283,8 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message, } -IconMenuItem::IconMenuItem(const char *label, BMessage *message, - const char *iconType, icon_size which) +IconMenuItem::IconMenuItem(const char* label, BMessage* message, + const char* iconType, icon_size which) : PositionPassingMenuItem(label, message), fDeviceIcon(NULL), fHeightDelta(0) @@ -311,8 +311,8 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message, } -IconMenuItem::IconMenuItem(BMenu *submenu, BMessage *message, - const char *iconType, icon_size which) +IconMenuItem::IconMenuItem(BMenu* submenu, BMessage* message, + const char* iconType, icon_size which) : PositionPassingMenuItem(submenu, message), fDeviceIcon(NULL), fHeightDelta(0) @@ -346,7 +346,7 @@ IconMenuItem::~IconMenuItem() void -IconMenuItem::GetContentSize(float *width, float *height) +IconMenuItem::GetContentSize(float* width, float* height) { _inherited::GetContentSize(width, height); diff --git a/src/kits/tracker/IconMenuItem.h b/src/kits/tracker/IconMenuItem.h index a8fb8745da..2dc0ee1292 100644 --- a/src/kits/tracker/IconMenuItem.h +++ b/src/kits/tracker/IconMenuItem.h @@ -31,37 +31,39 @@ 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. */ +#ifndef ICON_MENU_ITEM_H +#define ICON_MENU_ITEM_H + // Menu item class with small icons. -#ifndef ICON_MENU_ITEM_H -#define ICON_MENU_ITEM_H #include #include "Model.h" #include "Utilities.h" -class BNodeInfo; +class BNodeInfo; + namespace BPrivate { const bigtime_t kSynchMenuInvokeTimeout = 5000000; class IconMenuItem : public PositionPassingMenuItem { public: - IconMenuItem(const char *label, BMessage *message, BBitmap *icon); - IconMenuItem(const char *label, BMessage *message, const char *iconType, + IconMenuItem(const char* label, BMessage* message, BBitmap* icon); + IconMenuItem(const char* label, BMessage* message, const char* iconType, icon_size which); - IconMenuItem(const char *label, BMessage *message, - const BNodeInfo *nodeInfo, icon_size which); - IconMenuItem(BMenu *, BMessage *, const char *iconType, icon_size which); + IconMenuItem(const char* label, BMessage* message, + const BNodeInfo* nodeInfo, icon_size which); + IconMenuItem(BMenu*, BMessage*, const char* iconType, icon_size which); virtual ~IconMenuItem(); - virtual void GetContentSize(float *width, float *height); + virtual void GetContentSize(float* width, float* height); virtual void DrawContent(); private: - BBitmap *fDeviceIcon; + BBitmap* fDeviceIcon; float fHeightDelta; typedef BMenuItem _inherited; @@ -70,20 +72,20 @@ class IconMenuItem : public PositionPassingMenuItem { class ModelMenuItem : public BMenuItem { public: - ModelMenuItem(const Model *, const char *title, BMessage *, char shortcut = '\0', + ModelMenuItem(const Model*, const char* title, BMessage*, char shortcut = '\0', uint32 modifiers = 0, bool drawText = true, bool extraPad = false); - ModelMenuItem(const Model *, BMenu *, bool drawText = true, bool extraPad = false); + ModelMenuItem(const Model*, BMenu*, bool drawText = true, bool extraPad = false); virtual ~ModelMenuItem(); - virtual status_t SetEntry(const BEntry *); + virtual status_t SetEntry(const BEntry*); virtual void DrawContent(); virtual void Highlight(bool isHighlighted); - virtual void GetContentSize(float *width, float *height); + virtual void GetContentSize(float* width, float* height); - const Model *TargetModel() const; + const Model* TargetModel() const; protected: - virtual status_t Invoke(BMessage * = NULL); + virtual status_t Invoke(BMessage* = NULL); // overriden to support B_OPTION_KEY private: @@ -98,7 +100,7 @@ class ModelMenuItem : public BMenuItem { }; -inline const Model * +inline const Model* ModelMenuItem::TargetModel() const { return &fModel; @@ -107,7 +109,7 @@ ModelMenuItem::TargetModel() const class SpecialModelMenuItem : public ModelMenuItem { public: - SpecialModelMenuItem(const Model *model, BMenu *menu); + SpecialModelMenuItem(const Model* model, BMenu* menu); virtual void DrawContent(); diff --git a/src/kits/tracker/InfoWindow.cpp b/src/kits/tracker/InfoWindow.cpp index 44db4c55df..fdb755165c 100644 --- a/src/kits/tracker/InfoWindow.cpp +++ b/src/kits/tracker/InfoWindow.cpp @@ -95,10 +95,10 @@ enum track_state { class TrackingView : public BControl { public: - TrackingView(BRect, const char *str, BMessage *message); + TrackingView(BRect, const char* str, BMessage* message); virtual void MouseDown(BPoint); - virtual void MouseMoved(BPoint, uint32 transit, const BMessage *message); + virtual void MouseMoved(BPoint, uint32 transit, const BMessage* message); virtual void MouseUp(BPoint); virtual void Draw(BRect); @@ -109,33 +109,33 @@ class TrackingView : public BControl { class AttributeView : public BView { public: - AttributeView(BRect, Model *); + AttributeView(BRect, Model*); ~AttributeView(); - void ModelChanged(Model *, BMessage *); - void ReLinkTargetModel(Model *); + void ModelChanged(Model*, BMessage*); + void ReLinkTargetModel(Model*); void BeginEditingTitle(); void FinishEditingTitle(bool); float CurrentFontHeight(float size = -1); - BTextView *TextView() const { return fTitleEditView; } + BTextView* TextView() const { return fTitleEditView; } - static filter_result TextViewFilter(BMessage *, BHandler **, BMessageFilter *); + static filter_result TextViewFilter(BMessage*, BHandler**, BMessageFilter*); off_t LastSize() const; void SetLastSize(off_t); - void SetSizeStr(const char *); + void SetSizeStr(const char*); - status_t BuildContextMenu(BMenu *parent); + status_t BuildContextMenu(BMenu* parent); void SetPermissionsSwitchState(int32 state); protected: virtual void MouseDown(BPoint); - virtual void MouseMoved(BPoint, uint32, const BMessage *); + virtual void MouseMoved(BPoint, uint32, const BMessage*); virtual void MouseUp(BPoint); - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); virtual void AttachedToWindow(); virtual void Draw(BRect); virtual void Pulse(); @@ -143,7 +143,7 @@ class AttributeView : public BView { virtual void WindowActivated(bool); private: - void InitStrings(const Model *); + void InitStrings(const Model*); void CheckAndSetSize(); void OpenLinkSource(); void OpenLinkTarget(); @@ -168,20 +168,20 @@ class AttributeView : public BView { BPoint fClickPoint; float fDivider; - BMenuField *fPreferredAppMenu; - Model *fModel; - Model *fIconModel; - BBitmap *fIcon; + BMenuField* fPreferredAppMenu; + Model* fModel; + Model* fIconModel; + BBitmap* fIcon; bool fMouseDown; bool fDragging; bool fDoubleClick; track_state fTrackingState; bool fIsDropTarget; - BTextView *fTitleEditView; - PaneSwitch *fPermissionsSwitch; - BWindow *fPathWindow; - BWindow *fLinkWindow; - BWindow *fDescWindow; + BTextView* fTitleEditView; + PaneSwitch* fPermissionsSwitch; + BWindow* fPathWindow; + BWindow* fLinkWindow; + BWindow* fDescWindow; typedef BView _inherited; }; @@ -222,7 +222,7 @@ const uint32 kPaneSwitchOpen = 2; static void -OpenParentAndSelectOriginal(const entry_ref *ref) +OpenParentAndSelectOriginal(const entry_ref* ref) { BEntry entry(ref); node_ref node; @@ -241,9 +241,9 @@ OpenParentAndSelectOriginal(const entry_ref *ref) } -static BWindow * -OpenToolTipWindow(BScreen& screen, BRect rect, const char *name, - const char *string, BMessenger target, BMessage *message) +static BWindow* +OpenToolTipWindow(BScreen& screen, BRect rect, const char* name, + const char* string, BMessenger target, BMessage* message) { font_height fontHeight; be_plain_font->GetHeight(&fontHeight); @@ -257,13 +257,13 @@ OpenToolTipWindow(BScreen& screen, BRect rect, const char *name, else if (rect.right > screen.Frame().right) rect.OffsetBy(screen.Frame().right - rect.right, 0); - BWindow *window = new BWindow(rect, name, B_BORDERED_WINDOW_LOOK, + BWindow* window = new BWindow(rect, name, B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_AVOID_FOCUS | B_NO_WORKSPACE_ACTIVATION | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS); - TrackingView *trackingView = new TrackingView(window->Bounds(), + TrackingView* trackingView = new TrackingView(window->Bounds(), string, message); trackingView->SetTarget(target); window->AddChild(trackingView); @@ -278,7 +278,7 @@ OpenToolTipWindow(BScreen& screen, BRect rect, const char *name, // #pragma mark - -BInfoWindow::BInfoWindow(Model *model, int32 group_index, LockingList *list) +BInfoWindow::BInfoWindow(Model* model, int32 group_index, LockingList* list) : BWindow(BInfoWindow::InfoWindowRect(false), "InfoWindow", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_CURRENT_WORKSPACE), @@ -344,7 +344,7 @@ BInfoWindow::Quit() bool -BInfoWindow::IsShowing(const node_ref *node) const +BInfoWindow::IsShowing(const node_ref* node) const { return *TargetModel()->NodeRef() == *node; } @@ -409,7 +409,7 @@ BInfoWindow::Show() void -BInfoWindow::MessageReceived(BMessage *message) +BInfoWindow::MessageReceived(BMessage* message) { switch (message->what) { case kRestoreState: @@ -701,9 +701,9 @@ BInfoWindow::GetSizeString(BString &result, off_t size, int32 fileCount) int32 -BInfoWindow::CalcSize(void *castToWindow) +BInfoWindow::CalcSize(void* castToWindow) { - BInfoWindow *window = static_cast(castToWindow); + BInfoWindow* window = static_cast(castToWindow); BDirectory dir(window->TargetModel()->EntryRef()); BDirectory trashDir; FSGetTrashDir(&trashDir, window->TargetModel()->EntryRef()->device); @@ -782,16 +782,16 @@ BInfoWindow::CalcSize(void *castToWindow) void -BInfoWindow::SetSizeStr(const char *sizeStr) +BInfoWindow::SetSizeStr(const char* sizeStr) { - AttributeView *view = dynamic_cast(FindView("attr_view")); + AttributeView* view = dynamic_cast(FindView("attr_view")); if (view) view->SetSizeStr(sizeStr); } void -BInfoWindow::OpenFilePanel(const entry_ref *ref) +BInfoWindow::OpenFilePanel(const entry_ref* ref) { // Open a file dialog box to allow the user to select a new target // for the sym link @@ -825,7 +825,7 @@ BInfoWindow::OpenFilePanel(const entry_ref *ref) // #pragma mark - -AttributeView::AttributeView(BRect rect, Model *model) +AttributeView::AttributeView(BRect rect, Model* model) : BView(rect, "attr_view", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_PULSE_NEEDED), fDivider(0), fPreferredAppMenu(NULL), @@ -847,7 +847,7 @@ AttributeView::AttributeView(BRect rect, Model *model) // If the model is a symlink, then we deference the model to // get the targets icon if (fModel->IsSymLink()) { - Model *resolvedModel = new Model(model->EntryRef(), true, true); + Model* resolvedModel = new Model(model->EntryRef(), true, true); if (resolvedModel->InitCheck() == B_OK) fIconModel = resolvedModel; // broken link, just show the symlink @@ -919,7 +919,7 @@ AttributeView::AttributeView(BRect rect, Model *model) mime.GetSupportingApps(&supportingAppList); // Add the default menu item and set it to marked - BMenuItem *result; + BMenuItem* result; result = new BMenuItem(B_TRANSLATE("Default application"), new BMessage(kSetPreferredApp)); result->SetTarget(this); @@ -927,7 +927,7 @@ AttributeView::AttributeView(BRect rect, Model *model) result->SetMarked(true); for (int32 index = 0; ; index++) { - const char *signature; + const char* signature; if (supportingAppList.FindString("applications", index, &signature) != B_OK) break; @@ -935,7 +935,7 @@ AttributeView::AttributeView(BRect rect, Model *model) if (index == 0) fPreferredAppMenu->Menu()->AddSeparatorItem(); - BMessage *itemMessage = new BMessage(kSetPreferredApp); + BMessage* itemMessage = new BMessage(kSetPreferredApp); itemMessage->AddString("signature", signature); status_t err = B_ERROR; @@ -988,7 +988,7 @@ AttributeView::~AttributeView() void -AttributeView::InitStrings(const Model *model) +AttributeView::InitStrings(const Model* model) { BMimeType mime; char kind[B_MIME_TYPE_LENGTH]; @@ -1076,7 +1076,7 @@ AttributeView::Pulse() void -AttributeView::ModelChanged(Model *model, BMessage *message) +AttributeView::ModelChanged(Model* model, BMessage* message) { BRect drawBounds(Bounds()); drawBounds.left = fDivider; @@ -1090,7 +1090,7 @@ AttributeView::ModelChanged(Model *model, BMessage *message) message->FindInt64("to directory", &dirNode.node); message->FindInt64("node", &itemNode.node); - const char *name; + const char* name; if (message->FindString("name", &name) != B_OK) return; @@ -1136,7 +1136,7 @@ AttributeView::ModelChanged(Model *model, BMessage *message) case B_ATTR_CHANGED: { // watch for icon updates - const char *attrName; + const char* attrName; if (message->FindString("attr", &attrName) == B_OK) { if (strcmp(attrName, kAttrLargeIcon) == 0 || strcmp(attrName, kAttrIcon) == 0) { @@ -1169,7 +1169,7 @@ AttributeView::ModelChanged(Model *model, BMessage *message) if (fModel->IsSymLink()) { // if we are looking at a symlink, deference the model and look at the // target - Model *resolvedModel = new Model(model->EntryRef(), true, true); + Model* resolvedModel = new Model(model->EntryRef(), true, true); if (resolvedModel->InitCheck() == B_OK) { if (fIconModel != fModel) delete fIconModel; @@ -1194,11 +1194,11 @@ AttributeView::ModelChanged(Model *model, BMessage *message) // would be nice) void -AttributeView::ReLinkTargetModel(Model *model) +AttributeView::ReLinkTargetModel(Model* model) { fModel = model; if (fModel->IsSymLink()) { - Model *resolvedModel = new Model(model->EntryRef(), true, true); + Model* resolvedModel = new Model(model->EntryRef(), true, true); if (resolvedModel->InitCheck() == B_OK) { if (fIconModel != fModel) delete fIconModel; @@ -1252,10 +1252,10 @@ AttributeView::MouseDown(BPoint point) fTrackingState = no_track; } else if (fIconRect.Contains(point)) { uint32 buttons; - Window()->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons); + Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons); if (((modifiers() & B_CONTROL_KEY) != 0) || (buttons & B_SECONDARY_MOUSE_BUTTON) != 0) { // Show contextual menu - BPopUpMenu *contextMenu = new BPopUpMenu("FileContext", false, false); + BPopUpMenu* contextMenu = new BPopUpMenu("FileContext", false, false); if (contextMenu) { BuildContextMenu(contextMenu); contextMenu->SetAsyncAutoDestruct(true); @@ -1278,7 +1278,7 @@ AttributeView::MouseDown(BPoint point) int32 clickCount; Window()->CurrentMessage()->FindInt32("clicks", &clickCount); - // This checks the *previous* click point + // This checks the* previous* click point if (clickCount == 2) { offsetPoint.x = fClickPoint.x - fIconRect.left; offsetPoint.y = fClickPoint.y - fIconRect.top; @@ -1296,7 +1296,7 @@ AttributeView::MouseDown(BPoint point) void -AttributeView::MouseMoved(BPoint point, uint32, const BMessage *message) +AttributeView::MouseMoved(BPoint point, uint32, const BMessage* message) { // Highlight Drag target if (message && message->ReturnAddress() != BMessenger(this) @@ -1344,9 +1344,9 @@ AttributeView::MouseMoved(BPoint point, uint32, const BMessage *message) float height = CurrentFontHeight(kAttribFontHeight) + fIconRect.Height() + 8; BRect rect(0, 0, min_c(fIconRect.Width() + font.StringWidth(fModel->Name()) + 4, fIconRect.Width() * 3), height); - BBitmap *dragBitmap = new BBitmap(rect, B_RGBA32, true); + BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true); dragBitmap->Lock(); - BView *view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0); + BView* view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0); dragBitmap->AddChild(view); view->SetOrigin(0, 0); BRect clipRect(view->Bounds()); @@ -1486,7 +1486,7 @@ AttributeView::OpenLinkTarget() } if (entry.InitCheck() != B_OK || !entry.Exists()) { // Open a file dialog panel to allow the user to relink. - BInfoWindow *window = dynamic_cast(Window()); + BInfoWindow* window = dynamic_cast(Window()); if (window) window->OpenFilePanel(fModel->EntryRef()); } else { @@ -1512,7 +1512,7 @@ AttributeView::MouseUp(BPoint point) } else if ((fTrackingState == icon_track || fTrackingState == open_only_track) && fIconRect.Contains(point)) { // If it was a double click, then tell Tracker to open the item - // The CurrentMessage() here does *not* have a "clicks" field, + // The CurrentMessage() here does* not* have a "clicks" field, // which is why we are tracking the clicks with this temp var if (fDoubleClick){ // Double click, launch. @@ -1600,7 +1600,7 @@ AttributeView::CheckAndSetSize() void -AttributeView::MessageReceived(BMessage *message) +AttributeView::MessageReceived(BMessage* message) { if (message->WasDropped() && message->what == B_SIMPLE_DATA @@ -1618,7 +1618,7 @@ AttributeView::MessageReceived(BMessage *message) BNode node(fModel->EntryRef()); BNodeInfo nodeInfo(&node); - const char *newSignature; + const char* newSignature; if (message->FindString("signature", &newSignature) != B_OK) newSignature = NULL; @@ -1891,7 +1891,7 @@ AttributeView::BeginEditingTitle() fTitleEditView->AddFilter( new BMessageFilter(B_KEY_DOWN, AttributeView::TextViewFilter)); - BScrollView *scrollView = new BScrollView("BorderView", fTitleEditView, + BScrollView* scrollView = new BScrollView("BorderView", fTitleEditView, 0, 0, false, false, B_PLAIN_BORDER); AddChild(scrollView); fTitleEditView->SelectAll(); @@ -1909,7 +1909,7 @@ AttributeView::FinishEditingTitle(bool commit) bool reopen = false; - const char *text = fTitleEditView->Text(); + const char* text = fTitleEditView->Text(); uint32 length = strlen(text); if (commit && strcmp(text, fModel->Name()) != 0 && length < B_FILE_NAME_LENGTH) { BEntry entry(fModel->EntryRef()); @@ -1949,7 +1949,7 @@ AttributeView::FinishEditingTitle(bool commit) } // Remove view - BView *scrollView = fTitleEditView->Parent(); + BView* scrollView = fTitleEditView->Parent(); RemoveChild(scrollView); delete scrollView; fTitleEditView = NULL; @@ -2008,7 +2008,7 @@ AttributeView::CurrentFontHeight(float size) status_t -AttributeView::BuildContextMenu(BMenu *parent) +AttributeView::BuildContextMenu(BMenu* parent) { // Add navigation menu if this is not a symlink // Symlink's to directories are OK however! @@ -2027,14 +2027,14 @@ AttributeView::BuildContextMenu(BMenu *parent) } else if (model.IsDirectory() || model.IsVolume()) navigate = true; } - ModelMenuItem *navigationItem = NULL; + ModelMenuItem* navigationItem = NULL; if (navigate) { navigationItem = new ModelMenuItem(new Model(model), new BNavMenu(model.Name(), B_REFS_RECEIVED, be_app, Window())); // setup a navigation menu item which will dynamically load items // as menu items are traversed - BNavMenu *navMenu = dynamic_cast(navigationItem->Submenu()); + BNavMenu* navMenu = dynamic_cast(navigationItem->Submenu()); navMenu->SetNavDir(&ref); navigationItem->SetLabel(model.Name()); navigationItem->SetEntry(&entry); @@ -2042,7 +2042,7 @@ AttributeView::BuildContextMenu(BMenu *parent) parent->AddItem(navigationItem, 0); parent->AddItem(new BSeparatorItem(), 1); - BMessage *message = new BMessage(B_REFS_RECEIVED); + BMessage* message = new BMessage(B_REFS_RECEIVED); message->AddRef("refs", &ref); navigationItem->SetMessage(message); navigationItem->SetTarget(be_app); @@ -2079,7 +2079,7 @@ AttributeView::BuildContextMenu(BMenu *parent) parent->AddItem(new BMenuItem(B_TRANSLATE("Empty Trash"), new BMessage(kEmptyTrash))); - BMenuItem *sizeItem = NULL; + BMenuItem* sizeItem = NULL; if (model.IsDirectory() && !model.IsVolume() && !model.IsRoot()) { parent->AddItem(sizeItem = new BMenuItem(B_TRANSLATE("Recalculate folder size"), new BMessage(kRecalculateSize))); @@ -2116,11 +2116,11 @@ AttributeView::SetPermissionsSwitchState(int32 state) filter_result -AttributeView::TextViewFilter(BMessage *message, BHandler **, BMessageFilter *filter) +AttributeView::TextViewFilter(BMessage* message, BHandler**, BMessageFilter* filter) { uchar key; - AttributeView *attribView = static_cast( - static_cast(filter->Looper())->FindView("attr_view")); + AttributeView* attribView = static_cast( + static_cast(filter->Looper())->FindView("attr_view")); // Adjust the size of the text rect BRect nuRect(attribView->TextView()->TextRect()); @@ -2129,7 +2129,7 @@ AttributeView::TextViewFilter(BMessage *message, BHandler **, BMessageFilter *fi // Make sure the cursor is in view attribView->TextView()->ScrollToSelection(); - if (message->FindInt8("byte", (int8 *)&key) != B_OK) + if (message->FindInt8("byte", (int8*)&key) != B_OK) return B_DISPATCH_MESSAGE; if (key == B_RETURN || key == B_ESCAPE) { @@ -2156,7 +2156,7 @@ AttributeView::SetLastSize(off_t lastSize) void -AttributeView::SetSizeStr(const char *sizeStr) +AttributeView::SetSizeStr(const char* sizeStr) { fSizeStr = sizeStr; @@ -2170,7 +2170,7 @@ AttributeView::SetSizeStr(const char *sizeStr) // #pragma mark - -TrackingView::TrackingView(BRect frame, const char *str, BMessage *message) +TrackingView::TrackingView(BRect frame, const char* str, BMessage* message) : BControl(frame, "trackingView", str, message, B_FOLLOW_ALL, B_WILL_DRAW), fMouseDown(false), fMouseInView(false) @@ -2192,7 +2192,7 @@ TrackingView::MouseDown(BPoint) void -TrackingView::MouseMoved(BPoint, uint32 transit, const BMessage *) +TrackingView::MouseMoved(BPoint, uint32 transit, const BMessage*) { if ((transit == B_ENTERED_VIEW || transit == B_EXITED_VIEW) && fMouseDown) InvertRect(Bounds()); @@ -2231,4 +2231,3 @@ TrackingView::Draw(BRect) DrawString(Label(), BPoint(3, Bounds().Height() - fontHeight.descent)); } - diff --git a/src/kits/tracker/InfoWindow.h b/src/kits/tracker/InfoWindow.h index b5d1df85bb..4f13a2a15f 100644 --- a/src/kits/tracker/InfoWindow.h +++ b/src/kits/tracker/InfoWindow.h @@ -52,48 +52,52 @@ namespace BPrivate { class Model; class AttributeView; + class BInfoWindow : public BWindow { public: - BInfoWindow(Model *, int32 groupIndex, LockingList *list = NULL); + BInfoWindow(Model*, int32 groupIndex, LockingList* list = NULL); ~BInfoWindow(); - virtual bool IsShowing(const node_ref *) const; - Model *TargetModel() const; - void SetSizeStr(const char *); + virtual bool IsShowing(const node_ref*) const; + Model* TargetModel() const; + void SetSizeStr(const char*); bool StopCalc(); - void OpenFilePanel(const entry_ref *); + void OpenFilePanel(const entry_ref*); static void GetSizeString(BString &result, off_t size, int32 fileCount); protected: virtual void Quit(); - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); virtual void Show(); private: static BRect InfoWindowRect(bool displayingSymlink); - static int32 CalcSize(void *); + static int32 CalcSize(void*); - Model *fModel; + Model* fModel; volatile bool fStopCalc; - int32 fIndex; // tells where it lives with respect to other + int32 fIndex; + // tells where it lives with respect to other thread_id fCalcThreadID; - LockingList *fWindowList; - FilePermissionsView *fPermissionsView; - AttributeView *fAttributeView; - BFilePanel *fFilePanel; + LockingList* fWindowList; + FilePermissionsView* fPermissionsView; + AttributeView* fAttributeView; + BFilePanel* fFilePanel; bool fFilePanelOpen; typedef BWindow _inherited; }; + inline bool BInfoWindow::StopCalc() { return fStopCalc; } -inline Model * + +inline Model* BInfoWindow::TargetModel() const { return fModel; @@ -103,4 +107,4 @@ BInfoWindow::TargetModel() const using namespace BPrivate; -#endif +#endif // INFO_WINDOW_H diff --git a/src/kits/tracker/LockingList.h b/src/kits/tracker/LockingList.h index 05d5992d36..620dba785b 100644 --- a/src/kits/tracker/LockingList.h +++ b/src/kits/tracker/LockingList.h @@ -31,13 +31,14 @@ 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. */ - -#ifndef _LOCKING_LIST_H +#ifndef _LOCKING_LIST_H #define _LOCKING_LIST_H + #include #include "ObjectList.h" + namespace BPrivate { template @@ -57,36 +58,39 @@ private: BLocker lock; }; + template LockingList::LockingList(int32 itemsPerBlock, bool owning) : BObjectList(itemsPerBlock, owning) { } + template -bool +bool LockingList::Lock() { return lock.Lock(); } + template -void +void LockingList::Unlock() { lock.Unlock(); } + template -bool +bool LockingList::IsLocked() const { return lock.IsLocked(); } - } // namespace BPrivate using namespace BPrivate; -#endif +#endif // _LOCKING_LIST_H diff --git a/src/kits/tracker/MimeTypeList.cpp b/src/kits/tracker/MimeTypeList.cpp index a837c3ffaf..aeecfece6a 100644 --- a/src/kits/tracker/MimeTypeList.cpp +++ b/src/kits/tracker/MimeTypeList.cpp @@ -59,30 +59,30 @@ ShortMimeInfo::ShortMimeInfo(const BMimeType &mimeType) } -ShortMimeInfo::ShortMimeInfo(const char *shortDescription) +ShortMimeInfo::ShortMimeInfo(const char* shortDescription) : fShortDescription(shortDescription) { } -const char * +const char* ShortMimeInfo::InternalName() const { return fPrivateName.String(); } -const char * +const char* ShortMimeInfo::ShortDescription() const { return fShortDescription.String(); } -int -ShortMimeInfo::CompareShortDescription(const ShortMimeInfo *a, const ShortMimeInfo *b) +int +ShortMimeInfo::CompareShortDescription(const ShortMimeInfo* a, const ShortMimeInfo* b) { return a->fShortDescription.ICompare(b->fShortDescription); } -bool +bool ShortMimeInfo::IsCommonMimeType() const { return fCommonMimeType; @@ -103,24 +103,24 @@ MimeTypeList::MimeTypeList() } static int -MatchOneShortDescription(const ShortMimeInfo *a, const ShortMimeInfo *b) +MatchOneShortDescription(const ShortMimeInfo* a, const ShortMimeInfo* b) { return strcasecmp(a->ShortDescription(), b->ShortDescription()); } -const ShortMimeInfo * -MimeTypeList::FindMimeType(const char *shortDescription) const +const ShortMimeInfo* +MimeTypeList::FindMimeType(const char* shortDescription) const { ShortMimeInfo tmp(shortDescription); - const ShortMimeInfo *result = fCommonMimeList.BinarySearch(tmp, + const ShortMimeInfo* result = fCommonMimeList.BinarySearch(tmp, &MatchOneShortDescription); return result; } -const ShortMimeInfo * -MimeTypeList::EachCommonType(bool (*func)(const ShortMimeInfo *, void *), - void *state) const +const ShortMimeInfo* +MimeTypeList::EachCommonType(bool (*func)(const ShortMimeInfo*, void*), + void* state) const { AutoLock locker(fLock); int32 count = fCommonMimeList.CountItems(); @@ -131,7 +131,7 @@ MimeTypeList::EachCommonType(bool (*func)(const ShortMimeInfo *, void *), return NULL; } -void +void MimeTypeList::Build() { ASSERT(fLock.IsLocked()); @@ -144,7 +144,7 @@ MimeTypeList::Build() message.GetInfo("types", &type, &count); for (int32 index = 0; index < count; index++) { - const char *str; + const char* str; if (message.FindString("types", index, &str) != B_OK) continue; @@ -152,9 +152,9 @@ MimeTypeList::Build() if (mimetype.InitCheck() != B_OK) continue; - ShortMimeInfo *mimeInfo = new ShortMimeInfo(mimetype); + ShortMimeInfo* mimeInfo = new ShortMimeInfo(mimetype); fMimeList.AddItem(mimeInfo); - if (mimeInfo->IsCommonMimeType()) + if (mimeInfo->IsCommonMimeType()) fCommonMimeList.AddItem(mimeInfo); } fCommonMimeList.SortItems(&ShortMimeInfo::CompareShortDescription); diff --git a/src/kits/tracker/MimeTypeList.h b/src/kits/tracker/MimeTypeList.h index 1b9ddb45b0..1275280500 100644 --- a/src/kits/tracker/MimeTypeList.h +++ b/src/kits/tracker/MimeTypeList.h @@ -31,14 +31,15 @@ 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. */ - #ifndef __MIME_TYPE_LIST__ #define __MIME_TYPE_LIST__ + #include #include "ObjectList.h" #include "Utilities.h" + namespace BPrivate { class MimeTypeList; @@ -46,15 +47,15 @@ class MimeTypeList; class ShortMimeInfo { public: ShortMimeInfo(const BMimeType &); - - const char *InternalName() const; - const char *ShortDescription() const; + + const char* InternalName() const; + const char* ShortDescription() const; bool IsCommonMimeType() const; - static int CompareShortDescription(const ShortMimeInfo *, - const ShortMimeInfo *); + static int CompareShortDescription(const ShortMimeInfo*, + const ShortMimeInfo*); private: - ShortMimeInfo(const char *shortDescription); + ShortMimeInfo(const char* shortDescription); BString fPrivateName; BString fShortDescription; @@ -63,21 +64,22 @@ private: friend class MimeTypeList; }; + class MimeTypeList { public: MimeTypeList(); - + // attributes for type // internal name from short description // update notification - const ShortMimeInfo *FindMimeType(const char *shortDescription) const; - const ShortMimeInfo *EachCommonType(bool (*)(const ShortMimeInfo *, void *), - void *) const; + const ShortMimeInfo* FindMimeType(const char* shortDescription) const; + const ShortMimeInfo* EachCommonType(bool (*)(const ShortMimeInfo*, void*), + void*) const; protected: void Build(); - + private: BObjectList fMimeList; BObjectList fCommonMimeList; @@ -88,4 +90,4 @@ private: using namespace BPrivate; -#endif +#endif // __MIME_TYPE_LIST__ diff --git a/src/kits/tracker/MimeTypes.h b/src/kits/tracker/MimeTypes.h index 47ab641312..22b200d34c 100644 --- a/src/kits/tracker/MimeTypes.h +++ b/src/kits/tracker/MimeTypes.h @@ -31,33 +31,33 @@ 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. */ - #ifndef _MIME_TYPES_H #define _MIME_TYPES_H + namespace BPrivate { -#define B_FILE_MIMETYPE "application/octet-stream" -#define B_DIR_MIMETYPE "application/x-vnd.Be-directory" -#define B_VOLUME_MIMETYPE "application/x-vnd.Be-volume" -#define B_QUERY_MIMETYPE "application/x-vnd.Be-query" -#define B_QUERY_TEMPLATE_MIMETYPE "application/x-vnd.Be-queryTemplate" -#define B_LINK_MIMETYPE "application/x-vnd.Be-symlink" -#define B_ROOT_MIMETYPE "application/x-vnd.Be-root" -#define B_BOOKMARK_MIMETYPE "application/x-vnd.Be-bookmark" -#define B_PERSON_MIMETYPE "application/x-person" +#define B_FILE_MIMETYPE "application/octet-stream" +#define B_DIR_MIMETYPE "application/x-vnd.Be-directory" +#define B_VOLUME_MIMETYPE "application/x-vnd.Be-volume" +#define B_QUERY_MIMETYPE "application/x-vnd.Be-query" +#define B_QUERY_TEMPLATE_MIMETYPE "application/x-vnd.Be-queryTemplate" +#define B_LINK_MIMETYPE "application/x-vnd.Be-symlink" +#define B_ROOT_MIMETYPE "application/x-vnd.Be-root" +#define B_BOOKMARK_MIMETYPE "application/x-vnd.Be-bookmark" +#define B_PERSON_MIMETYPE "application/x-person" -#define B_PRINTER_MIMETYPE "application/x-vnd.Be.printer" -#define B_PRINTER_SPOOL_MIMETYPE "application/x-vnd.Be.printer-spool" +#define B_PRINTER_MIMETYPE "application/x-vnd.Be.printer" +#define B_PRINTER_SPOOL_MIMETYPE "application/x-vnd.Be.printer-spool" -#define kPlainTextMimeType "text/plain" +#define kPlainTextMimeType "text/plain" -#define kBitmapMimeType "image/x-vnd.Be-bitmap" -#define kLargeIconType "icon/large" -#define kMiniIconType "icon/mini" +#define kBitmapMimeType "image/x-vnd.Be-bitmap" +#define kLargeIconType "icon/large" +#define kMiniIconType "icon/mini" } // namespace BPrivate using namespace BPrivate; -#endif +#endif // _MIME_TYPES_H diff --git a/src/kits/tracker/MiniMenuField.cpp b/src/kits/tracker/MiniMenuField.cpp index 13d45807bd..c67af408c7 100644 --- a/src/kits/tracker/MiniMenuField.cpp +++ b/src/kits/tracker/MiniMenuField.cpp @@ -32,13 +32,15 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include "MiniMenuField.h" #include "Utilities.h" -MiniMenuField::MiniMenuField(BRect frame, const char *name, BPopUpMenu *menu, + +MiniMenuField::MiniMenuField(BRect frame, const char* name, BPopUpMenu* menu, uint32 resizeFlags, uint32 flags) : BView(frame, name, resizeFlags, flags), fMenu(menu) @@ -46,12 +48,14 @@ MiniMenuField::MiniMenuField(BRect frame, const char *name, BPopUpMenu *menu, SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE); } + MiniMenuField::~MiniMenuField() { delete fMenu; } -void + +void MiniMenuField::AttachedToWindow() { if (Parent()) { @@ -61,16 +65,18 @@ MiniMenuField::AttachedToWindow() SetHighColor(0, 0, 0); } -void + +void MiniMenuField::MakeFocus(bool on) { Invalidate(); BView::MakeFocus(on); } + void -MiniMenuField::KeyDown(const char *bytes, int32 numBytes) -{ +MiniMenuField::KeyDown(const char* bytes, int32 numBytes) +{ switch (bytes[0]) { case B_SPACE: case B_DOWN_ARROW: @@ -85,7 +91,8 @@ MiniMenuField::KeyDown(const char *bytes, int32 numBytes) } } -void + +void MiniMenuField::Draw(BRect) { BRect bounds(Bounds()); @@ -103,16 +110,16 @@ MiniMenuField::Draw(BRect) // draw frame and shadow BeginLineArray(10); - AddLine(rect.RightTop(), rect.RightBottom(), darkest); - AddLine(rect.RightBottom(), rect.LeftBottom(), darkest); - AddLine(rect.LeftBottom(), rect.LeftTop(), medium); + AddLine(rect.RightTop(), rect.RightBottom(), darkest); + AddLine(rect.RightBottom(), rect.LeftBottom(), darkest); + AddLine(rect.LeftBottom(), rect.LeftTop(), medium); AddLine(rect.LeftTop(), rect.RightTop(), medium); - AddLine(bounds.LeftBottom() + BPoint(2, 0), bounds.RightBottom(), dark); - AddLine(bounds.RightTop() + BPoint(0, 1), bounds.RightBottom(), dark); + AddLine(bounds.LeftBottom() + BPoint(2, 0), bounds.RightBottom(), dark); + AddLine(bounds.RightTop() + BPoint(0, 1), bounds.RightBottom(), dark); rect.InsetBy(1, 1); - AddLine(rect.RightTop(), rect.RightBottom(), medium); - AddLine(rect.RightBottom(), rect.LeftBottom(), medium); - AddLine(rect.LeftBottom(), rect.LeftTop(), light); + AddLine(rect.RightTop(), rect.RightBottom(), medium); + AddLine(rect.RightBottom(), rect.LeftBottom(), medium); + AddLine(rect.LeftBottom(), rect.LeftTop(), light); AddLine(rect.LeftTop(), rect.RightTop(), light); EndLineArray(); @@ -123,16 +130,16 @@ MiniMenuField::Draw(BRect) const rgb_color middleColor = {150, 150, 150, 255}; BeginLineArray(5); - AddLine(BPoint(rect.left + 3, rect.top + 1), + AddLine(BPoint(rect.left + 3, rect.top + 1), BPoint(rect.left + 3, rect.top + 7), outlineColor); - AddLine(BPoint(rect.left + 3, rect.top + 1), + AddLine(BPoint(rect.left + 3, rect.top + 1), BPoint(rect.left + 6, rect.top + 4), outlineColor); - AddLine(BPoint(rect.left + 6, rect.top + 4), + AddLine(BPoint(rect.left + 6, rect.top + 4), BPoint(rect.left + 3, rect.top + 7), outlineColor); - - AddLine(BPoint(rect.left + 4, rect.top + 3), + + AddLine(BPoint(rect.left + 4, rect.top + 3), BPoint(rect.left + 4, rect.top + 5), middleColor); - AddLine(BPoint(rect.left + 5, rect.top + 4), + AddLine(BPoint(rect.left + 5, rect.top + 4), BPoint(rect.left + 5, rect.top + 4), middleColor); EndLineArray(); @@ -151,10 +158,10 @@ MiniMenuField::Draw(BRect) AddLine(BPoint(bounds.left, bounds.bottom), BPoint(bounds.left, bounds.top), focused ? markColor : viewColor); EndLineArray(); - } -void + +void MiniMenuField::MouseDown(BPoint) { fMenu->Go(ConvertToScreen(BPoint(4, 4)), true); diff --git a/src/kits/tracker/MiniMenuField.h b/src/kits/tracker/MiniMenuField.h index b034b9a48a..d9689b76c5 100644 --- a/src/kits/tracker/MiniMenuField.h +++ b/src/kits/tracker/MiniMenuField.h @@ -31,20 +31,20 @@ 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. */ - #ifndef __MINI_MENU_FIELD__ #define __MINI_MENU_FIELD__ + #include + class BPopUpMenu; namespace BPrivate { - class MiniMenuField : public BView { public: - MiniMenuField(BRect frame, const char *name, BPopUpMenu *menu, + MiniMenuField(BRect frame, const char* name, BPopUpMenu* menu, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_NAVIGABLE); // ToDo: @@ -57,14 +57,14 @@ protected: virtual void Draw(BRect); virtual void MouseDown(BPoint ); virtual void MakeFocus(bool); - virtual void KeyDown(const char *, int32); + virtual void KeyDown(const char*, int32); private: - BPopUpMenu *fMenu; + BPopUpMenu* fMenu; }; } // namespace BPrivate using namespace BPrivate; -#endif +#endif // __MINI_MENU_FIELD__ diff --git a/src/kits/tracker/Model.cpp b/src/kits/tracker/Model.cpp index dcf5e3e889..ffe56b2d25 100644 --- a/src/kits/tracker/Model.cpp +++ b/src/kits/tracker/Model.cpp @@ -72,8 +72,8 @@ All rights reserved. #include "Utilities.h" #ifdef CHECK_OPEN_MODEL_LEAKS -BObjectList *writableOpenModelList = NULL; -BObjectList *readOnlyOpenModelList = NULL; +BObjectList* writableOpenModelList = NULL; +BObjectList* readOnlyOpenModelList = NULL; #endif namespace BPrivate { @@ -81,7 +81,7 @@ extern #ifdef _IMPEXP_BE _IMPEXP_BE #endif -bool CheckNodeIconHintPrivate(const BNode *, bool); +bool CheckNodeIconHintPrivate(const BNode*, bool); } @@ -131,7 +131,7 @@ Model::Model(const Model &cloneThis) } -Model::Model(const node_ref *dirNode, const node_ref *node, const char *name, +Model::Model(const node_ref* dirNode, const node_ref* node, const char* name, bool open, bool writable) : fPreferredAppName(NULL), @@ -143,7 +143,7 @@ Model::Model(const node_ref *dirNode, const node_ref *node, const char *name, } -Model::Model(const BEntry *entry, bool open, bool writable) +Model::Model(const BEntry* entry, bool open, bool writable) : fPreferredAppName(NULL), fWritable(false), @@ -154,7 +154,7 @@ Model::Model(const BEntry *entry, bool open, bool writable) } -Model::Model(const entry_ref *ref, bool traverse, bool open, bool writable) +Model::Model(const entry_ref* ref, bool traverse, bool open, bool writable) : fPreferredAppName(NULL), fBaseType(kUnknownNode), @@ -174,7 +174,7 @@ void Model::DeletePreferredAppVolumeNameLinkTo() { if (IsSymLink()) { - Model *tmp = fLinkTo; + Model* tmp = fLinkTo; // deal with link to link to self fLinkTo = NULL; delete tmp; @@ -212,7 +212,7 @@ Model::~Model() status_t -Model::SetTo(const BEntry *entry, bool open, bool writable) +Model::SetTo(const BEntry* entry, bool open, bool writable) { delete fNode; fNode = NULL; @@ -238,7 +238,7 @@ Model::SetTo(const BEntry *entry, bool open, bool writable) status_t -Model::SetTo(const entry_ref *newRef, bool traverse, bool open, bool writable) +Model::SetTo(const entry_ref* newRef, bool traverse, bool open, bool writable) { delete fNode; fNode = NULL; @@ -270,7 +270,7 @@ Model::SetTo(const entry_ref *newRef, bool traverse, bool open, bool writable) status_t -Model::SetTo(const node_ref *dirNode, const node_ref *nodeRef, const char *name, +Model::SetTo(const node_ref* dirNode, const node_ref* nodeRef, const char* name, bool open, bool writable) { delete fNode; @@ -312,13 +312,13 @@ Model::InitCheck() const int -Model::CompareFolderNamesFirst(const Model *compareModel) const +Model::CompareFolderNamesFirst(const Model* compareModel) const { if (compareModel == NULL) return -1; - const Model *resolvedCompareModel = compareModel->ResolveIfLink(); - const Model *resolvedMe = ResolveIfLink(); + const Model* resolvedCompareModel = compareModel->ResolveIfLink(); + const Model* resolvedMe = ResolveIfLink(); if (resolvedMe->IsVolume()) { if (!resolvedCompareModel->IsVolume()) @@ -336,7 +336,7 @@ Model::CompareFolderNamesFirst(const Model *compareModel) const } -const char * +const char* Model::Name() const { static const char* kRootNodeName = B_TRANSLATE_MARK("Disks"); @@ -437,7 +437,7 @@ Model::OpenNodeCommon(bool writable) fNode = new BDirectory(&fEntryRef); if (fBaseType == kDirectoryNode - && static_cast(fNode)->IsRootDirectory()) { + && static_cast(fNode)->IsRootDirectory()) { // promote from directory to volume fBaseType = kVolumeNode; } @@ -576,7 +576,7 @@ Model::CacheLocalizedName() static bool -HasVectorIconHint(BNode *node) +HasVectorIconHint(BNode* node) { attr_info info; return node->GetAttrInfo(kAttrIcon, &info) == B_OK; @@ -596,7 +596,7 @@ Model::FinishSettingUpType() // disk again for models that do not have an icon defined by the node if (IsNodeOpen() && fBaseType != kLinkNode - && !CheckNodeIconHintPrivate(fNode, dynamic_cast(be_app) == NULL) + && !CheckNodeIconHintPrivate(fNode, dynamic_cast(be_app) == NULL) && !HasVectorIconHint(fNode)) { // when checking for the node icon hint, if we are libtracker, only check // for small icons - checking for the large icons is a little more @@ -695,7 +695,7 @@ Model::FinishSettingUpType() case kExecutableNode: if (IsNodeOpen()) { char signature[B_MIME_TYPE_LENGTH]; - if (GetAppSignatureFromAttr(dynamic_cast(fNode), signature) + if (GetAppSignatureFromAttr(dynamic_cast(fNode), signature) == B_OK) { if (fPreferredAppName) @@ -728,11 +728,11 @@ Model::ResetIconFrom() // mirror the logic from FinishSettingUpType if ((fBaseType == kDirectoryNode || fBaseType == kVolumeNode || fBaseType == kTrashNode || fBaseType == kDesktopNode) - && !CheckNodeIconHintPrivate(fNode, dynamic_cast(be_app) == NULL)) { + && !CheckNodeIconHintPrivate(fNode, dynamic_cast(be_app) == NULL)) { if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) { fIconFrom = kTrackerSupplied; return; - } else if (dynamic_cast(fNode)->IsRootDirectory()) { + } else if (dynamic_cast(fNode)->IsRootDirectory()) { fIconFrom = kVolume; return; } @@ -741,7 +741,7 @@ Model::ResetIconFrom() } -const char * +const char* Model::PreferredAppSignature() const { if (IsVolume() || IsSymLink()) @@ -752,7 +752,7 @@ Model::PreferredAppSignature() const void -Model::SetPreferredAppSignature(const char *signature) +Model::SetPreferredAppSignature(const char* signature) { ASSERT(!IsVolume() && !IsSymLink()); ASSERT(signature != fPreferredAppName); @@ -766,7 +766,7 @@ Model::SetPreferredAppSignature(const char *signature) } -const Model * +const Model* Model::ResolveIfLink() const { if (!IsSymLink()) @@ -779,7 +779,7 @@ Model::ResolveIfLink() const } -Model * +Model* Model::ResolveIfLink() { if (!IsSymLink()) @@ -793,7 +793,7 @@ Model::ResolveIfLink() void -Model::SetLinkTo(Model *model) +Model::SetLinkTo(Model* model) { ASSERT(IsSymLink()); ASSERT(!fLinkTo || (fLinkTo != model)); @@ -825,7 +825,7 @@ Model::GetPreferredAppForBrokenSymLink(BString &result) // Node monitor updating stuff void -Model::UpdateEntryRef(const node_ref *dirNode, const char *name) +Model::UpdateEntryRef(const node_ref* dirNode, const char* name) { if (IsVolume()) { if (fVolumeName) @@ -845,7 +845,7 @@ Model::UpdateEntryRef(const node_ref *dirNode, const char *name) status_t -Model::WatchVolumeAndMountPoint(uint32 , BHandler *target) +Model::WatchVolumeAndMountPoint(uint32 , BHandler* target) { ASSERT(IsVolume()); @@ -867,7 +867,7 @@ Model::WatchVolumeAndMountPoint(uint32 , BHandler *target) bool -Model::AttrChanged(const char *attrName) +Model::AttrChanged(const char* attrName) { // called on an attribute changed node monitor // sync up cached values of mime type and preferred app and @@ -936,7 +936,7 @@ Model::StatChanged() // Mime handling stuff bool -Model::IsDropTarget(const Model *forDocument, bool traverse) const +Model::IsDropTarget(const Model* forDocument, bool traverse) const { switch (CanHandleDrops()) { case kCanHandle: @@ -968,7 +968,7 @@ Model::IsDropTarget(const Model *forDocument, bool traverse) const return SupportsMimeType(mimeType, 0) != kDoesNotSupportType; } // do some mime-based matching - const char *documentMimeType = forDocument->MimeType(); + const char* documentMimeType = forDocument->MimeType(); if (!documentMimeType) return false; @@ -1011,7 +1011,7 @@ Model::CanHandleDrops() const inline bool -IsSuperHandlerSignature(const char *signature) +IsSuperHandlerSignature(const char* signature) { return strcasecmp(signature, B_FILE_MIMETYPE) == 0; } @@ -1024,7 +1024,7 @@ enum { }; static int32 -MatchMimeTypeString(/*const */BString *documentType, const char *handlerType) +MatchMimeTypeString(/*const */BString* documentType, const char* handlerType) { // perform a mime type wildcard match // handler types of the form "text" @@ -1032,7 +1032,7 @@ MatchMimeTypeString(/*const */BString *documentType, const char *handlerType) // for everything else a full string match is used int32 supertypeOnlyLength = 0; - const char *tmp = strstr(handlerType, "/"); + const char* tmp = strstr(handlerType, "/"); if (!tmp) // no subtype - supertype string only @@ -1057,7 +1057,7 @@ MatchMimeTypeString(/*const */BString *documentType, const char *handlerType) int32 -Model::SupportsMimeType(const char *type, const BObjectList *list, +Model::SupportsMimeType(const char* type, const BObjectList* list, bool exactReason) const { ASSERT((type == 0) != (list == 0)); @@ -1075,10 +1075,10 @@ Model::SupportsMimeType(const char *type, const BObjectList *list, for (int32 index = 0; ; index++) { // check if this model lists the type of dropped document as supported - const char *mimeSignature; + const char* mimeSignature; int32 bufferLength; - if (message.FindData("types", 'CSTR', index, (const void **)&mimeSignature, + if (message.FindData("types", 'CSTR', index, (const void**)&mimeSignature, &bufferLength)) return result; @@ -1096,7 +1096,7 @@ Model::SupportsMimeType(const char *type, const BObjectList *list, BString typeString(type); match = MatchMimeTypeString(&typeString, mimeSignature); } else - match = WhileEachListItem(const_cast *>(list), + match = WhileEachListItem(const_cast*>(list), MatchMimeTypeString, mimeSignature); // const_cast shouldnt be here, have to have it until MW cleans up @@ -1118,7 +1118,7 @@ Model::SupportsMimeType(const char *type, const BObjectList *list, bool -Model::IsDropTargetForList(const BObjectList *list) const +Model::IsDropTargetForList(const BObjectList* list) const { switch (CanHandleDrops()) { case kCanHandle: @@ -1147,10 +1147,10 @@ Model::IsSuperHandler() const return false; for (int32 index = 0; ; index++) { - const char *mimeSignature; + const char* mimeSignature; int32 bufferLength; - if (message.FindData("types", 'CSTR', index, (const void **)&mimeSignature, + if (message.FindData("types", 'CSTR', index, (const void**)&mimeSignature, &bufferLength)) return false; @@ -1162,14 +1162,14 @@ Model::IsSuperHandler() const void -Model::GetEntry(BEntry *entry) const +Model::GetEntry(BEntry* entry) const { entry->SetTo(EntryRef()); } void -Model::GetPath(BPath *path) const +Model::GetPath(BPath* path) const { BEntry entry(EntryRef()); entry.GetPath(path); @@ -1184,7 +1184,7 @@ Model::Mimeset(bool force) GetPath(&path); update_mime_info(path.Path(), 0, 1, force ? 2 : 0); - + AttrChanged(0); return !oldType.ICompare(MimeType()); @@ -1192,8 +1192,8 @@ Model::Mimeset(bool force) ssize_t -Model::WriteAttr(const char *attr, type_code type, off_t offset, - const void *buffer, size_t length) +Model::WriteAttr(const char* attr, type_code type, off_t offset, + const void* buffer, size_t length) { BModelWriteOpener opener(this); if (!fNode) @@ -1205,8 +1205,8 @@ Model::WriteAttr(const char *attr, type_code type, off_t offset, ssize_t -Model::WriteAttrKillForeign(const char *attr, const char *foreignAttr, - type_code type, off_t offset, const void *buffer, size_t length) +Model::WriteAttrKillForeign(const char* attr, const char* foreignAttr, + type_code type, off_t offset, const void* buffer, size_t length) { BModelWriteOpener opener(this); if (!fNode) diff --git a/src/kits/tracker/Model.h b/src/kits/tracker/Model.h index 31f8a3481e..cfe7a27c4f 100644 --- a/src/kits/tracker/Model.h +++ b/src/kits/tracker/Model.h @@ -31,11 +31,12 @@ 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. */ +#ifndef _NU_MODEL_H +#define _NU_MODEL_H + // Dedicated to BModel -#ifndef _NU_MODEL_H -#define _NU_MODEL_H #include #include @@ -76,24 +77,24 @@ class Model { public: Model(); Model(const Model &); - Model(const BEntry *entry, bool open = false, bool writable = false); - Model(const entry_ref *, bool traverse = false, bool open = false, + Model(const BEntry* entry, bool open = false, bool writable = false); + Model(const entry_ref*, bool traverse = false, bool open = false, bool writable = false); - Model(const node_ref *dirNode, const node_ref *node, const char *name, + Model(const node_ref* dirNode, const node_ref* node, const char* name, bool open = false, bool writable = false); ~Model(); - Model& operator=(const Model &); + Model& operator=(const Model&); status_t InitCheck() const; - status_t SetTo(const BEntry *, bool open = false, bool writable = false); - status_t SetTo(const entry_ref *, bool traverse = false, bool open = false, + status_t SetTo(const BEntry*, bool open = false, bool writable = false); + status_t SetTo(const entry_ref*, bool traverse = false, bool open = false, bool writable = false); - status_t SetTo(const node_ref *dirNode, const node_ref *node, const char *name, + status_t SetTo(const node_ref* dirNode, const node_ref* node, const char* name, bool open = false, bool writable = false); - int CompareFolderNamesFirst(const Model *compareModel) const; + int CompareFolderNamesFirst(const Model* compareModel) const; // node management status_t OpenNode(bool writable = false); @@ -107,20 +108,20 @@ class Model { // real, starts by rereading the stat structure // basic getters - const char *Name() const; - const entry_ref *EntryRef() const; - const node_ref *NodeRef() const; - const StatStruct *StatBuf() const; + const char* Name() const; + const entry_ref* EntryRef() const; + const node_ref* NodeRef() const; + const StatStruct* StatBuf() const; - BNode *Node() const; + BNode* Node() const; // returns null if not Open - void GetPath(BPath *) const; - void GetEntry(BEntry *) const; + void GetPath(BPath*) const; + void GetEntry(BEntry*) const; - const char *MimeType() const; - const char *PreferredAppSignature() const; + const char* MimeType() const; + const char* PreferredAppSignature() const; // only not-null if not default for type and not self for app - void SetPreferredAppSignature(const char *); + void SetPreferredAppSignature(const char*); void GetPreferredAppForBrokenSymLink(BString &result); // special purpose call - if a symlink is unresolvable, it makes sense @@ -149,36 +150,36 @@ class Model { // a new icon // symlink handling calls, mainly used by the IconCache - const Model *ResolveIfLink() const; - Model *ResolveIfLink(); + const Model* ResolveIfLink() const; + Model* ResolveIfLink(); // works on anything - Model *LinkTo() const; + Model* LinkTo() const; // fast, works only on symlinks - void SetLinkTo(Model *); + void SetLinkTo(Model*); status_t GetLongVersionString(BString &, version_kind); status_t GetVersionString(BString &, version_kind); - status_t AttrAsString(BString &, int64 *value, const char *attributeName, + status_t AttrAsString(BString &, int64* value, const char* attributeName, uint32 attributeType); // Node monitor update call - void UpdateEntryRef(const node_ref *dirRef, const char *name); - bool AttrChanged(const char *); + void UpdateEntryRef(const node_ref* dirRef, const char* name); + bool AttrChanged(const char*); // returns true if pose needs to update it's icon, etc. // pass null to force full update bool StatChanged(); // returns true if pose needs to update it's icon - status_t WatchVolumeAndMountPoint(uint32, BHandler *); + status_t WatchVolumeAndMountPoint(uint32, BHandler*); // correctly handles boot volume name watching - bool IsDropTarget(const Model *forDocument = 0, + bool IsDropTarget(const Model* forDocument = 0, bool traverse = false) const; // if nonzero passed, mime info is used to // resolve if document can be opened // if zero, all executables, directories and volumes pass // if traverse, dereference symlinks - bool IsDropTargetForList(const BObjectList *list) const; + bool IsDropTargetForList(const BObjectList* list) const; // contains mime types of all documents about to be handled // by model @@ -188,19 +189,19 @@ class Model { #endif bool IsSuperHandler() const; - int32 SupportsMimeType(const char *type, const BObjectList *list, + int32 SupportsMimeType(const char* type, const BObjectList* list, bool exactReason = false) const; // pass in one string in or a bunch in // if false, returns as soon as it figures out that // app supports a given type, if true, returns an exact reason // get rid of this?? - ssize_t WriteAttr(const char *attr, type_code type, off_t, - const void *buffer, size_t ); + ssize_t WriteAttr(const char* attr, type_code type, off_t, + const void* buffer, size_t ); // cover call, creates a writable node and writes out attributes // into it; work around for file nodes not being writeable - ssize_t WriteAttrKillForeign(const char *attr, const char *foreignAttr, - type_code type, off_t, const void *buffer, size_t); + ssize_t WriteAttrKillForeign(const char* attr, const char* foreignAttr, + type_code type, off_t, const void* buffer, size_t); bool Mimeset(bool force); // returns true if mime type changed @@ -214,8 +215,8 @@ class Model { void DeletePreferredAppVolumeNameLinkTo(); void CacheLocalizedName(); - status_t FetchOneQuery(const BQuery *, BHandler *target, - BObjectList*, BVolume *); + status_t FetchOneQuery(const BQuery*, BHandler* target, + BObjectList*, BVolume*); enum CanHandleResult { kCanHandle, @@ -245,15 +246,15 @@ class Model { // bit of overloading hackery here to save on footprint union { - char *fPreferredAppName; // used if we are neither a volume nor a symlink - char *fVolumeName; // used if we are a volume - Model *fLinkTo; // used if we are a symlink + char* fPreferredAppName; // used if we are neither a volume nor a symlink + char* fVolumeName; // used if we are a volume + Model* fLinkTo; // used if we are a symlink }; uint8 fBaseType; uint8 fIconFrom; bool fWritable; - BNode *fNode; + BNode* fNode; status_t fStatus; BString fLocalizedName; bool fHasLocalizedName; @@ -266,17 +267,17 @@ class ModelNodeLazyOpener { public: // consider failing when open does not succeed - ModelNodeLazyOpener(Model *model, bool writable = false, bool openLater = true); + ModelNodeLazyOpener(Model* model, bool writable = false, bool openLater = true); ~ModelNodeLazyOpener(); bool IsOpen() const; bool IsOpenForWriting() const; bool IsOpen(bool forWriting) const; - Model *TargetModel() const; + Model* TargetModel() const; status_t OpenNode(bool writable = false); private: - Model *fModel; + Model* fModel; bool fWasOpen; bool fWasOpenForWriting; }; @@ -284,7 +285,7 @@ class ModelNodeLazyOpener { // handy flavors of openers class BModelOpener : public ModelNodeLazyOpener { public: - BModelOpener(Model *model) + BModelOpener(Model* model) : ModelNodeLazyOpener(model, false, false) { } @@ -292,7 +293,7 @@ class BModelOpener : public ModelNodeLazyOpener { class BModelWriteOpener : public ModelNodeLazyOpener { public: - BModelWriteOpener(Model *model) + BModelWriteOpener(Model* model) : ModelNodeLazyOpener(model, true, false) { } @@ -310,36 +311,36 @@ void InitOpenModelDumping(); // inlines follow ----------------------------------- -inline const char * +inline const char* Model::MimeType() const { return fMimeType.String(); } -inline const entry_ref * +inline const entry_ref* Model::EntryRef() const { return &fEntryRef; } -inline const node_ref * +inline const node_ref* Model::NodeRef() const { // the stat structure begins with a node_ref - return (node_ref *)&fStatBuf; + return (node_ref*)&fStatBuf; } -inline BNode * +inline BNode* Model::Node() const { return fNode; } -inline const StatStruct * +inline const StatStruct* Model::StatBuf() const { return &fStatBuf; @@ -360,7 +361,7 @@ Model::SetIconFrom(IconSource from) } -inline Model * +inline Model* Model::LinkTo() const { ASSERT(IsSymLink()); @@ -462,7 +463,7 @@ Model::HasLocalizedName() const inline -ModelNodeLazyOpener::ModelNodeLazyOpener(Model *model, bool writable, bool openLater) +ModelNodeLazyOpener::ModelNodeLazyOpener(Model* model, bool writable, bool openLater) : fModel(model), fWasOpen(model->IsNodeOpen()), fWasOpenForWriting(model->IsNodeOpenForWriting()) @@ -505,7 +506,7 @@ ModelNodeLazyOpener::IsOpen(bool forWriting) const } -inline Model * +inline Model* ModelNodeLazyOpener::TargetModel() const { return fModel; @@ -524,8 +525,6 @@ ModelNodeLazyOpener::OpenNode(bool writable) return B_OK; } - } // namespace BPrivate - -#endif +#endif // _NU_MODEL_H diff --git a/src/kits/tracker/MountMenu.cpp b/src/kits/tracker/MountMenu.cpp index d0b32a71ac..6c0a84a4ee 100644 --- a/src/kits/tracker/MountMenu.cpp +++ b/src/kits/tracker/MountMenu.cpp @@ -61,8 +61,8 @@ class AddMenuItemVisitor : public BDiskDeviceVisitor { AddMenuItemVisitor(BMenu* menu); virtual ~AddMenuItemVisitor(); - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); + virtual bool Visit(BDiskDevice* device); + virtual bool Visit(BPartition* partition, int32 level); private: BMenu* fMenu; @@ -82,14 +82,14 @@ AddMenuItemVisitor::~AddMenuItemVisitor() bool -AddMenuItemVisitor::Visit(BDiskDevice *device) +AddMenuItemVisitor::Visit(BDiskDevice* device) { return Visit(device, 0); } bool -AddMenuItemVisitor::Visit(BPartition *partition, int32 level) +AddMenuItemVisitor::Visit(BPartition* partition, int32 level) { if (!partition->ContainsFileSystem()) return false; @@ -99,7 +99,7 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level) if (name.Length() == 0) { name = partition->Name(); if (name.Length() == 0) { - const char *type = partition->ContentType(); + const char* type = partition->ContentType(); if (type == NULL) return false; @@ -119,19 +119,19 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level) } // get icon - BBitmap *icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), + BBitmap* icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1), B_RGBA32); if (partition->GetIcon(icon, B_MINI_ICON) != B_OK) { delete icon; icon = NULL; } - BMessage *message = new BMessage(partition->IsMounted() ? + BMessage* message = new BMessage(partition->IsMounted() ? kUnmountVolume : kMountVolume); message->AddInt32("id", partition->ID()); // TODO: for now, until we actually have disk device icons - BMenuItem *item; + BMenuItem* item; if (icon != NULL) item = new IconMenuItem(name.String(), message, icon); else @@ -159,7 +159,7 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level) #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "MountMenu" -MountMenu::MountMenu(const char *name) +MountMenu::MountMenu(const char* name) : BMenu(name) { SetFont(be_plain_font); @@ -171,7 +171,7 @@ MountMenu::AddDynamicItem(add_state) { // remove old items for (;;) { - BMenuItem *item = RemoveItem(0L); + BMenuItem* item = RemoveItem(0L); if (item == NULL) break; delete item; @@ -192,7 +192,7 @@ MountMenu::AddDynamicItem(add_state) BVolume volume; while (volumeRoster.GetNextVolume(&volume) == B_OK) { if (volume.IsShared()) { - BBitmap *icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); + BBitmap* icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); fs_info info; if (fs_stat_dev(volume.Device(), &info) != B_OK) { PRINT(("Cannot get mount menu item icon; bad device ID\n")); @@ -203,12 +203,12 @@ MountMenu::AddDynamicItem(add_state) if (get_device_icon(info.device_name, icon->Bits(), B_MINI_ICON) != B_OK) GetTrackerResources()->GetIconResource(R_ShareIcon, B_MINI_ICON, icon); - BMessage *message = new BMessage(kUnmountVolume); + BMessage* message = new BMessage(kUnmountVolume); message->AddInt32("device_id", volume.Device()); char volumeName[B_FILE_NAME_LENGTH]; volume.GetName(volumeName); - BMenuItem *item = new IconMenuItem(volumeName, message, icon); + BMenuItem* item = new IconMenuItem(volumeName, message, icon); item->SetMarked(true); AddItem(item); } diff --git a/src/kits/tracker/MountMenu.h b/src/kits/tracker/MountMenu.h index ea25fdbaff..1d4d093bad 100644 --- a/src/kits/tracker/MountMenu.h +++ b/src/kits/tracker/MountMenu.h @@ -31,18 +31,19 @@ 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. */ - #ifndef MOUNTMENU_H #define MOUNTMENU_H + #include + namespace BPrivate { class MountMenu : public BMenu { public: - MountMenu(const char *); + MountMenu(const char*); protected: @@ -54,4 +55,4 @@ protected: using namespace BPrivate; -#endif +#endif // MOUNTMENU_H diff --git a/src/kits/tracker/NavMenu.cpp b/src/kits/tracker/NavMenu.cpp index abe86fff11..aa6526d383 100644 --- a/src/kits/tracker/NavMenu.cpp +++ b/src/kits/tracker/NavMenu.cpp @@ -128,7 +128,7 @@ SpringLoadedFolderCompareMessages(const BMessage* incoming, void SpringLoadedFolderSetMenuStates(const BMenu* menu, - const BObjectList *typeslist) + const BObjectList* typeslist) { if (!menu || !typeslist) return; @@ -139,7 +139,7 @@ SpringLoadedFolderSetMenuStates(const BMenu* menu, // set the enabled state of the item int32 count = menu->CountItems(); for (int32 index = 0 ; index < count ; index++) { - ModelMenuItem* item = dynamic_cast(menu->ItemAt(index)); + ModelMenuItem* item = dynamic_cast(menu->ItemAt(index)); if (!item) continue; @@ -177,7 +177,7 @@ SpringLoadedFolderSetMenuStates(const BMenu* menu, void SpringLoadedFolderAddUniqueTypeToList(entry_ref* ref, - BObjectList *typeslist) + BObjectList* typeslist) { if (!ref || !typeslist) return; @@ -221,17 +221,17 @@ SpringLoadedFolderAddUniqueTypeToList(entry_ref* ref, void -SpringLoadedFolderCacheDragData(const BMessage* incoming, BMessage* *message, - BObjectList **typeslist) +SpringLoadedFolderCacheDragData(const BMessage* incoming, BMessage** message, + BObjectList** typeslist) { if (!incoming) return; - delete *message; - delete *typeslist; + delete* message; + delete* typeslist; BMessage* localMessage = new BMessage(*incoming); - BObjectList *localTypesList = new BObjectList(10, true); + BObjectList* localTypesList = new BObjectList(10, true); for (int32 index = 0; incoming->HasRef("refs", index); index++) { entry_ref ref; @@ -255,7 +255,7 @@ SpringLoadedFolderCacheDragData(const BMessage* incoming, BMessage* *message, #define B_TRANSLATION_CONTEXT "NavMenu" BNavMenu::BNavMenu(const char* title, uint32 message, const BHandler* target, - BWindow* parentWindow, const BObjectList *list) + BWindow* parentWindow, const BObjectList* list) : BSlowMenu(title), fMessage(message), fMessenger(target, target->Looper()), @@ -272,7 +272,7 @@ BNavMenu::BNavMenu(const char* title, uint32 message, const BHandler* target, // add the parent window to the invocation message so that it // can be closed if option modifier held down during invocation BContainerWindow* originatingWindow = - dynamic_cast(fParentWindow); + dynamic_cast(fParentWindow); if (originatingWindow) fMessage.AddData("nodeRefsToClose", B_RAW_TYPE, originatingWindow->TargetModel()->NodeRef(), sizeof (node_ref)); @@ -284,7 +284,7 @@ BNavMenu::BNavMenu(const char* title, uint32 message, const BHandler* target, BNavMenu::BNavMenu(const char* title, uint32 message, const BMessenger& messenger, BWindow* parentWindow, - const BObjectList *list) + const BObjectList* list) : BSlowMenu(title), fMessage(message), fMessenger(messenger), @@ -301,7 +301,7 @@ BNavMenu::BNavMenu(const char* title, uint32 message, // add the parent window to the invocation message so that it // can be closed if option modifier held down during invocation BContainerWindow* originatingWindow = - dynamic_cast(fParentWindow); + dynamic_cast(fParentWindow); if (originatingWindow) fMessage.AddData("nodeRefsToClose", B_RAW_TYPE, originatingWindow->TargetModel()->NodeRef(), sizeof (node_ref)); @@ -443,11 +443,11 @@ BNavMenu::StartBuildingItemList() BDirectory trashDir; if (FSGetTrashDir(&trashDir, volume.Device()) == B_OK) - dynamic_cast(fContainer)-> + dynamic_cast(fContainer)-> AddItem(new DirectoryEntryList(trashDir)); } } else - fContainer = new DirectoryEntryList(*dynamic_cast + fContainer = new DirectoryEntryList(*dynamic_cast (startModel.Node())); if (fContainer == NULL || fContainer->InitCheck() != B_OK) @@ -549,7 +549,7 @@ void BNavMenu::AddOneItem(Model* model) { BMenuItem* item = NewModelItem(model, &fMessage, fMessenger, false, - dynamic_cast(fParentWindow), + dynamic_cast(fParentWindow), fTypesList, &fTrackingHook); if (item) @@ -560,7 +560,7 @@ BNavMenu::AddOneItem(Model* model) ModelMenuItem* BNavMenu::NewModelItem(Model* model, const BMessage* invokeMessage, const BMessenger& target, bool suppressFolderHierarchy, - BContainerWindow* parentWindow, const BObjectList *typeslist, + BContainerWindow* parentWindow, const BObjectList* typeslist, TrackingHookData* hook) { if (model->InitCheck() != B_OK) @@ -691,8 +691,8 @@ BNavMenu::BuildVolumeMenu() int BNavMenu::CompareFolderNamesFirstOne(const BMenuItem* i1, const BMenuItem* i2) { - const ModelMenuItem* item1 = dynamic_cast(i1); - const ModelMenuItem* item2 = dynamic_cast(i2); + const ModelMenuItem* item1 = dynamic_cast(i1); + const ModelMenuItem* item2 = dynamic_cast(i2); if (item1 != NULL && item2 != NULL) return item1->TargetModel()->CompareFolderNamesFirst(item2->TargetModel()); @@ -812,13 +812,13 @@ BNavMenu::SetShowParent(bool show) void -BNavMenu::SetTypesList(const BObjectList *list) +BNavMenu::SetTypesList(const BObjectList* list) { fTypesList = list; } -const BObjectList * +const BObjectList* BNavMenu::TypesList() const { return fTypesList; @@ -868,4 +868,3 @@ BNavMenu::SetTrackingHookDeep(BMenu* menu, bool (*func)(BMenu*, void*), SetTrackingHookDeep(submenu, func, state); } } - diff --git a/src/kits/tracker/Navigator.cpp b/src/kits/tracker/Navigator.cpp index bb684347de..81d8e01c09 100644 --- a/src/kits/tracker/Navigator.cpp +++ b/src/kits/tracker/Navigator.cpp @@ -31,6 +31,8 @@ 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 "Bitmaps.h" #include "Commands.h" #include "ContainerWindow.h" @@ -38,9 +40,11 @@ All rights reserved. #include "Model.h" #include "Navigator.h" #include "Tracker.h" -#include + #include #include +#include + namespace BPrivate { @@ -49,50 +53,53 @@ static const int32 kMaxHistory = 32; } // BPictureButton() will crash when giving zero pointers, -// although we really want and have to set up the +// although we really want and have to set up the // pictures when we can, e.g. on a AttachedToWindow. static BPicture sPicture; -BNavigatorButton::BNavigatorButton(BRect rect, const char *name, BMessage *message, + +BNavigatorButton::BNavigatorButton(BRect rect, const char* name, BMessage* message, int32 resIDon, int32 resIDoff, int32 resIDdisabled) : BPictureButton(rect, name, &sPicture, &sPicture, message), fResIDOn(resIDon), fResIDOff(resIDoff), fResIDDisabled(resIDdisabled) { - // Clear to background color to - // avoid ugly border on click + // Clear to background color to avoid ugly border on click SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } + BNavigatorButton::~BNavigatorButton() { } + void BNavigatorButton::AttachedToWindow() { - BBitmap *bmpOn = 0; + BBitmap* bmpOn = 0; GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDOn, &bmpOn); SetPicture(bmpOn, true, true); delete bmpOn; - BBitmap *bmpOff = 0; + BBitmap* bmpOff = 0; GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDOff, &bmpOff); SetPicture(bmpOff, true, false); delete bmpOff; - BBitmap *bmpDisabled = 0; + BBitmap* bmpDisabled = 0; GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDDisabled, &bmpDisabled); SetPicture(bmpDisabled, false, false); SetPicture(bmpDisabled, false, true); delete bmpDisabled; } + void -BNavigatorButton::SetPicture(BBitmap *bitmap, bool enabled, bool on) +BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on) { if (bitmap) { BPicture picture; @@ -115,11 +122,11 @@ BNavigatorButton::SetPicture(BBitmap *bitmap, bool enabled, bool on) SetDisabledOn(&picture); else SetDisabledOff(&picture); - } + } } -BNavigator::BNavigator(const Model *model, BRect rect, uint32 resizeMask) +BNavigator::BNavigator(const Model* model, BRect rect, uint32 resizeMask) : BView(rect, "Navigator", resizeMask, B_WILL_DRAW), fBack(0), fForw(0), @@ -158,16 +165,17 @@ BNavigator::BNavigator(const Model *model, BRect rect, uint32 resizeMask) B_FOLLOW_LEFT_RIGHT); fLocation->SetDivider(0); AddChild(fLocation); - } + BNavigator::~BNavigator() { } -void + +void BNavigator::AttachedToWindow() -{ +{ // Inital setup of widget states UpdateLocation(0, kActionSet); @@ -178,7 +186,8 @@ BNavigator::AttachedToWindow() fLocation->SetTarget(this); } -void + +void BNavigator::Draw(BRect) { rgb_color bgColor = ui_color(B_PANEL_BACKGROUND_COLOR); @@ -194,8 +203,9 @@ BNavigator::Draw(BRect) EndLineArray(); } -void -BNavigator::MessageReceived(BMessage *message) + +void +BNavigator::MessageReceived(BMessage* message) { switch (message->what) { case kNavigatorCommandBackward: @@ -213,30 +223,30 @@ BNavigator::MessageReceived(BMessage *message) case kNavigatorCommandLocation: GoTo(); break; - + default: - { - // Catch any dropped refs and try - // to switch to this new directory - entry_ref ref; - if (message->FindRef("refs", &ref) == B_OK) { - BMessage message(kSwitchDirectory); - BEntry entry(&ref, true); - if (!entry.IsDirectory()) { - entry.GetRef(&ref); - BPath path(&ref); - path.GetParent(&path); - get_ref_for_path(path.Path(), &ref); - } - message.AddRef("refs", &ref); - message.AddInt32("action", kActionSet); - Window()->PostMessage(&message); + { + // Catch any dropped refs and try to switch to this new directory + entry_ref ref; + if (message->FindRef("refs", &ref) == B_OK) { + BMessage message(kSwitchDirectory); + BEntry entry(&ref, true); + if (!entry.IsDirectory()) { + entry.GetRef(&ref); + BPath path(&ref); + path.GetParent(&path); + get_ref_for_path(path.Path(), &ref); } + message.AddRef("refs", &ref); + message.AddInt32("action", kActionSet); + Window()->PostMessage(&message); } + } } } -void + +void BNavigator::GoBackward(bool option) { int32 itemCount = fBackHistory.CountItems(); @@ -247,7 +257,8 @@ BNavigator::GoBackward(bool option) } } -void + +void BNavigator::GoForward(bool option) { if (fForwHistory.CountItems() >= 1) { @@ -257,7 +268,8 @@ BNavigator::GoForward(bool option) } } -void + +void BNavigator::GoUp(bool option) { BEntry entry; @@ -268,8 +280,9 @@ BNavigator::GoUp(bool option) } } + void -BNavigator::SendNavigationMessage(NavigationAction action, BEntry *entry, bool option) +BNavigator::SendNavigationMessage(NavigationAction action, BEntry* entry, bool option) { entry_ref ref; @@ -279,7 +292,7 @@ BNavigator::SendNavigationMessage(NavigationAction action, BEntry *entry, bool o message.AddInt32("action", action); // get the node of this folder for selecting it in the new location - const node_ref *nodeRef; + const node_ref* nodeRef; if (Window() && Window()->TargetModel()) nodeRef = Window()->TargetModel()->NodeRef(); else @@ -306,13 +319,14 @@ BNavigator::SendNavigationMessage(NavigationAction action, BEntry *entry, bool o // Todo: Change the locking behaviour of StandAloneTaskLoop::Run() and sub- // sequently called functions. if (nodeRef) - dynamic_cast(be_app)->SelectChildInParentSoon(&ref, nodeRef); + dynamic_cast(be_app)->SelectChildInParentSoon(&ref, nodeRef); LockLooper(); } } } -void + +void BNavigator::GoTo() { BString pathname = fLocation->Text(); @@ -329,25 +343,24 @@ BNavigator::GoTo() BMessage message(kSwitchDirectory); message.AddRef("refs", &ref); message.AddInt32("action", kActionLocation); - Window()->PostMessage(&message); + Window()->PostMessage(&message); } else { BPath path; - if (Window() - && Window()->TargetModel()) { + if (Window() && Window()->TargetModel()) { Window()->TargetModel()->GetPath(&path); fLocation->SetText(path.Path()); } } } -void -BNavigator::UpdateLocation(const Model *newmodel, int32 action) + +void +BNavigator::UpdateLocation(const Model* newmodel, int32 action) { if (newmodel) newmodel->GetPath(&fPath); - // Modify history according to commands switch (action) { case kActionBackward: @@ -362,9 +375,9 @@ BNavigator::UpdateLocation(const Model *newmodel, int32 action) fForwHistory.MakeEmpty(); fBackHistory.AddItem(new BPath(fPath)); - for (;fBackHistory.CountItems()>kMaxHistory;) + for (; fBackHistory.CountItems() > kMaxHistory;) fBackHistory.RemoveItem(fBackHistory.FirstItem(), true); - break; + break; } // Enable Up button when there is any parent @@ -383,6 +396,7 @@ BNavigator::UpdateLocation(const Model *newmodel, int32 action) fLocation->SetText(fPath.Path()); } + float BNavigator::CalcNavigatorHeight(void) { diff --git a/src/kits/tracker/Navigator.h b/src/kits/tracker/Navigator.h index 1242324fa0..be31770547 100644 --- a/src/kits/tracker/Navigator.h +++ b/src/kits/tracker/Navigator.h @@ -34,11 +34,13 @@ All rights reserved. #ifndef _NAVIGATOR_H_ #define _NAVIGATOR_H_ + #include "Model.h" #include #include + class BTextControl; class BEntry; @@ -59,18 +61,19 @@ enum NavigationAction kNavigatorCommandLocation = 'NVLC' }; + // Custom BPictureButton which takes // bitmap resource IDs as arguments class BNavigatorButton : public BPictureButton { public: - BNavigatorButton(BRect rect, const char *name, BMessage *message, int32 resIDon, + BNavigatorButton(BRect rect, const char* name, BMessage* message, int32 resIDon, int32 resIDoff, int32 resIDdisabled); ~BNavigatorButton(); virtual void AttachedToWindow(); - void SetPicture(BBitmap *, bool enabled, bool on); + void SetPicture(BBitmap*, bool enabled, bool on); private: int32 fResIDOn; @@ -78,36 +81,37 @@ private: int32 fResIDDisabled; }; + class BNavigator : public BView { public: - BNavigator(const Model *model, BRect rect, uint32 resizeMask = B_FOLLOW_LEFT_RIGHT); + BNavigator(const Model* model, BRect rect, + uint32 resizeMask = B_FOLLOW_LEFT_RIGHT); ~BNavigator(); - - void UpdateLocation(const Model *newmodel, int32 action); + + void UpdateLocation(const Model* newmodel, int32 action); static float CalcNavigatorHeight(void); - BContainerWindow *Window() const; + BContainerWindow* Window() const; protected: virtual void Draw(BRect rect); - virtual void MessageReceived(BMessage *msg); + virtual void MessageReceived(BMessage* msg); virtual void AttachedToWindow(); - + void GoForward(bool option); // is option key held down? void GoBackward(bool option); void GoUp(bool option); - void SendNavigationMessage(NavigationAction, BEntry *, bool option); - + void SendNavigationMessage(NavigationAction, BEntry*, bool option); + void GoTo(); private: - - BPath fPath; - BNavigatorButton *fBack; - BNavigatorButton *fForw; - BNavigatorButton *fUp; - BTextControl *fLocation; + BPath fPath; + BNavigatorButton* fBack; + BNavigatorButton* fForw; + BNavigatorButton* fUp; + BTextControl* fLocation; BObjectList fBackHistory; BObjectList fForwHistory; @@ -115,11 +119,12 @@ private: typedef BView _inherited; }; + inline -BContainerWindow * +BContainerWindow* BNavigator::Window() const { - return dynamic_cast(_inherited::Window()); + return dynamic_cast(_inherited::Window()); } @@ -127,4 +132,4 @@ BNavigator::Window() const using namespace BPrivate; -#endif +#endif // _NAVIGATOR_H_ diff --git a/src/kits/tracker/NodePreloader.cpp b/src/kits/tracker/NodePreloader.cpp index 4a090a740a..d01333868a 100644 --- a/src/kits/tracker/NodePreloader.cpp +++ b/src/kits/tracker/NodePreloader.cpp @@ -51,10 +51,10 @@ All rights reserved. #include "Tracker.h" -NodePreloader * -NodePreloader::InstallNodePreloader(const char *name, BLooper *host) +NodePreloader* +NodePreloader::InstallNodePreloader(const char* name, BLooper* host) { - NodePreloader *result = new NodePreloader(name); + NodePreloader* result = new NodePreloader(name); { AutoLock lock(host); if (!lock) @@ -66,7 +66,7 @@ NodePreloader::InstallNodePreloader(const char *name, BLooper *host) } -NodePreloader::NodePreloader(const char *name) +NodePreloader::NodePreloader(const char* name) : BHandler(name), fModelList(20, true), fQuitRequested(false) @@ -82,7 +82,7 @@ NodePreloader::~NodePreloader() } -void +void NodePreloader::Run() { fLock.Lock(); @@ -90,72 +90,74 @@ NodePreloader::Run() } -Model * +Model* NodePreloader::FindModel(node_ref itemNode) const { for (int32 count = fModelList.CountItems() - 1; count >= 0; count--) { - Model *model = fModelList.ItemAt(count); - if (*model->NodeRef() == itemNode) + Model* model = fModelList.ItemAt(count); + if (*model->NodeRef() == itemNode) return model; } return NULL; } -void -NodePreloader::MessageReceived(BMessage *message) +void +NodePreloader::MessageReceived(BMessage* message) { // respond to node monitor notifications node_ref itemNode; switch (message->what) { case B_NODE_MONITOR: + { switch (message->FindInt32("opcode")) { case B_ENTRY_REMOVED: - { - AutoLock locker(fLock); - message->FindInt32("device", &itemNode.device); - message->FindInt64("node", &itemNode.node); - Model *model = FindModel(itemNode); - if (!model) - break; -// PRINT(("preloader removing file %s\n", model->Name())); - IconCache::sIconCache->Removing(model); - fModelList.RemoveItem(model); + { + AutoLock locker(fLock); + message->FindInt32("device", &itemNode.device); + message->FindInt64("node", &itemNode.node); + Model* model = FindModel(itemNode); + if (!model) break; - } + //PRINT(("preloader removing file %s\n", model->Name())); + IconCache::sIconCache->Removing(model); + fModelList.RemoveItem(model); + break; + } case B_ATTR_CHANGED: case B_STAT_CHANGED: - { - AutoLock locker(fLock); - message->FindInt32("device", &itemNode.device); - message->FindInt64("node", &itemNode.node); + { + AutoLock locker(fLock); + message->FindInt32("device", &itemNode.device); + message->FindInt64("node", &itemNode.node); - const char *attrName; - message->FindString("attr", &attrName); - Model *model = FindModel(itemNode); - if (!model) - break; - BModelOpener opener(model); - IconCache::sIconCache->IconChanged(model->ResolveIfLink()); -// PRINT(("preloader updating file %s\n", model->Name())); + const char* attrName; + message->FindString("attr", &attrName); + Model* model = FindModel(itemNode); + if (!model) break; - } + BModelOpener opener(model); + IconCache::sIconCache->IconChanged(model->ResolveIfLink()); + //PRINT(("preloader updating file %s\n", model->Name())); + break; + } } break; + } default: _inherited::MessageReceived(message); - break; + break; } } -void -NodePreloader::PreloadOne(const char *dirPath) +void +NodePreloader::PreloadOne(const char* dirPath) { -// PRINT(("preloading directory %s\n", dirPath)); + //PRINT(("preloading directory %s\n", dirPath)); BDirectory dir(dirPath); if (!dir.InitCheck() == B_OK) return; @@ -177,7 +179,7 @@ NodePreloader::PreloadOne(const char *dirPath) // only interrested in files continue; - Model *model = new Model(&ref, true); + Model* model = new Model(&ref, true); if (model->InitCheck() == B_OK && model->IconFrom() == kUnknownSource) { TTracker::WatchNode(model->NodeRef(), B_WATCH_STAT | B_WATCH_ATTR, this); @@ -187,11 +189,10 @@ NodePreloader::PreloadOne(const char *dirPath) } else delete model; } - } -void +void NodePreloader::Preload() { for (int32 count = 100; count >= 0; count--) { @@ -211,11 +212,10 @@ NodePreloader::Preload() ASSERT(fLock.IsLocked()); BPath path; - if (find_directory(B_BEOS_APPS_DIRECTORY, &path) == B_OK) + if (find_directory(B_BEOS_APPS_DIRECTORY, &path) == B_OK) PreloadOne(path.Path()); if (find_directory(B_BEOS_PREFERENCES_DIRECTORY, &path) == B_OK) PreloadOne(path.Path()); - + fLock.Unlock(); } - diff --git a/src/kits/tracker/NodePreloader.h b/src/kits/tracker/NodePreloader.h index 3de1c7c8cc..b4e2b224ba 100644 --- a/src/kits/tracker/NodePreloader.h +++ b/src/kits/tracker/NodePreloader.h @@ -42,34 +42,34 @@ All rights reserved. // aliasing after a deletion, etc. // // The node preloader knows which icons to preload - #ifndef __NODE_CACHE_PRELOADER__ #define __NODE_CACHE_PRELOADER__ + #include #include "ObjectList.h" #include "Model.h" + namespace BPrivate { class NodePreloader : public BHandler { public: - static NodePreloader *InstallNodePreloader(const char *name, BLooper *host); + static NodePreloader* InstallNodePreloader(const char* name, BLooper* host); virtual ~NodePreloader(); protected: - NodePreloader(const char *name); - virtual void MessageReceived(BMessage *); + NodePreloader(const char* name); + virtual void MessageReceived(BMessage*); void Run(); private: - void PreloadOne(const char *dirPath); + void PreloadOne(const char* dirPath); virtual void Preload(); // for now just preload apps and prefs - Model *FindModel(node_ref) const; - + Model* FindModel(node_ref) const; BObjectList fModelList; Benaphore fLock; @@ -82,4 +82,4 @@ private: using namespace BPrivate; -#endif +#endif // __NODE_CACHE_PRELOADER__ diff --git a/src/kits/tracker/NodeWalker.cpp b/src/kits/tracker/NodeWalker.cpp index bba97a47f8..e95ef660a8 100644 --- a/src/kits/tracker/NodeWalker.cpp +++ b/src/kits/tracker/NodeWalker.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include @@ -40,6 +41,7 @@ All rights reserved. #include "NodeWalker.h" + namespace BTrackerPrivate { TWalker::~TWalker() @@ -48,21 +50,21 @@ TWalker::~TWalker() // all the following calls are pure viruals, should not get called status_t -TWalker::GetNextEntry(BEntry *, bool ) +TWalker::GetNextEntry(BEntry*, bool ) { TRESPASS(); return B_ERROR; } status_t -TWalker::GetNextRef(entry_ref *) +TWalker::GetNextRef(entry_ref*) { TRESPASS(); return B_ERROR; } int32 -TWalker::GetNextDirents(struct dirent *, size_t, int32) +TWalker::GetNextDirents(struct dirent*, size_t, int32) { TRESPASS(); return 0; @@ -96,7 +98,7 @@ TNodeWalker::TNodeWalker(bool includeTopDirectory) } -TNodeWalker::TNodeWalker(const char *path, bool includeTopDirectory) +TNodeWalker::TNodeWalker(const char* path, bool includeTopDirectory) : fDirs(20), fTopIndex(-1), fTopDir(0), @@ -122,7 +124,7 @@ TNodeWalker::TNodeWalker(const char *path, bool includeTopDirectory) } -TNodeWalker::TNodeWalker(const entry_ref *ref, bool includeTopDirectory) +TNodeWalker::TNodeWalker(const entry_ref* ref, bool includeTopDirectory) : fDirs(20), fTopIndex(-1), fTopDir(0), @@ -148,7 +150,7 @@ TNodeWalker::TNodeWalker(const entry_ref *ref, bool includeTopDirectory) } -TNodeWalker::TNodeWalker(const BDirectory *dir, bool includeTopDirectory) +TNodeWalker::TNodeWalker(const BDirectory* dir, bool includeTopDirectory) : fDirs(20), fTopIndex(-1), fTopDir(0), @@ -175,7 +177,7 @@ TNodeWalker::TNodeWalker() { } -TNodeWalker::TNodeWalker(const char *path) +TNodeWalker::TNodeWalker(const char* path) : fDirs(20), fTopIndex(-1), fTopDir(0), @@ -200,7 +202,7 @@ TNodeWalker::TNodeWalker(const char *path) } } -TNodeWalker::TNodeWalker(const entry_ref *ref) +TNodeWalker::TNodeWalker(const entry_ref* ref) : fDirs(20), fTopIndex(-1), fTopDir(0), @@ -225,7 +227,7 @@ TNodeWalker::TNodeWalker(const entry_ref *ref) } } -TNodeWalker::TNodeWalker(const BDirectory *dir) +TNodeWalker::TNodeWalker(const BDirectory* dir) : fDirs(20), fTopIndex(-1), fTopDir(0), @@ -245,7 +247,7 @@ TNodeWalker::~TNodeWalker() delete fOriginalJustFile; for (;;) { - BDirectory *directory = fDirs.RemoveItemAt(fTopIndex--); + BDirectory* directory = fDirs.RemoveItemAt(fTopIndex--); if (directory == NULL) break; delete directory; @@ -274,7 +276,7 @@ TNodeWalker::PopDirCommon() } void -TNodeWalker::PushDirCommon(const entry_ref *ref) +TNodeWalker::PushDirCommon(const entry_ref* ref) { fTopDir = new BDirectory(ref); // OK to ignore error here. Will @@ -284,7 +286,7 @@ TNodeWalker::PushDirCommon(const entry_ref *ref) } status_t -TNodeWalker::GetNextEntry(BEntry *entry, bool traverse) +TNodeWalker::GetNextEntry(BEntry* entry, bool traverse) { if (fJustFile) { *entry = *fJustFile; @@ -316,14 +318,14 @@ TNodeWalker::GetNextEntry(BEntry *entry, bool traverse) entry_ref ref; err = entry->GetRef(&ref); - if (err == B_OK && fTopDir->Contains(ref.name, B_DIRECTORY_NODE)) + if (err == B_OK && fTopDir->Contains(ref.name, B_DIRECTORY_NODE)) PushDirCommon(&ref); return err; } status_t -TNodeWalker::GetNextRef(entry_ref *ref) +TNodeWalker::GetNextRef(entry_ref* ref) { if (fJustFile) { fJustFile->GetRef(ref); @@ -363,7 +365,7 @@ TNodeWalker::GetNextRef(entry_ref *ref) } static int32 -build_dirent(const BEntry *source, struct dirent *ent, +build_dirent(const BEntry* source, struct dirent* ent, size_t size, int32 count) { entry_ref ref; @@ -397,7 +399,7 @@ build_dirent(const BEntry *source, struct dirent *ent, } int32 -TNodeWalker::GetNextDirents(struct dirent *ent, size_t size, int32 count) +TNodeWalker::GetNextDirents(struct dirent* ent, size_t size, int32 count) { if (fJustFile) { if (!count) @@ -440,7 +442,7 @@ TNodeWalker::GetNextDirents(struct dirent *ent, size_t size, int32 count) entry_ref ref(ent->d_dev, ent->d_ino, ent->d_name); PushDirCommon(&ref); } - ent = (dirent *)((char *)ent + ent->d_reclen); + ent = (dirent*)((char*)ent + ent->d_reclen); } return result; @@ -457,7 +459,7 @@ TNodeWalker::Rewind() // pop all the directories and point to the initial one for (;;) { - BDirectory *directory = fDirs.RemoveItemAt(fTopIndex--); + BDirectory* directory = fDirs.RemoveItemAt(fTopIndex--); if (!directory) break; delete directory; @@ -484,11 +486,8 @@ TVolWalker::TVolWalker(bool knowsAttributes, bool writable, bool includeTopDirec fKnowsAttr(knowsAttributes), fWritable(writable) { - - /* - Get things initialized. Find first volume, or find the first volume - that supports attributes. - */ + // Get things initialized. Find first volume, or find the first volume + // that supports attributes. NextVolume(); } @@ -528,7 +527,7 @@ TVolWalker::NextVolume() } status_t -TVolWalker::GetNextEntry(BEntry *entry, bool traverse) +TVolWalker::GetNextEntry(BEntry* entry, bool traverse) { if (!fTopDir) return B_ENTRY_NOT_FOUND; @@ -548,7 +547,7 @@ TVolWalker::GetNextEntry(BEntry *entry, bool traverse) } status_t -TVolWalker::GetNextRef(entry_ref *ref) +TVolWalker::GetNextRef(entry_ref* ref) { if (!fTopDir) return B_ENTRY_NOT_FOUND; @@ -568,7 +567,7 @@ TVolWalker::GetNextRef(entry_ref *ref) } int32 -TVolWalker::GetNextDirents(struct dirent *ent, size_t size, int32 count) +TVolWalker::GetNextDirents(struct dirent* ent, size_t size, int32 count) { if (!fTopDir) return B_ENTRY_NOT_FOUND; @@ -594,7 +593,7 @@ TVolWalker::Rewind() return NextVolume(); } -TQueryWalker::TQueryWalker(const char *predicate) +TQueryWalker::TQueryWalker(const char* predicate) : TWalker(), fQuery(), fVolRoster(), fVol() { fPredicate = strdup(predicate); @@ -608,7 +607,7 @@ TQueryWalker::~TQueryWalker() } status_t -TQueryWalker::GetNextEntry(BEntry *entry, bool traverse) +TQueryWalker::GetNextEntry(BEntry* entry, bool traverse) { status_t err; @@ -624,7 +623,7 @@ TQueryWalker::GetNextEntry(BEntry *entry, bool traverse) } status_t -TQueryWalker::GetNextRef(entry_ref *ref) +TQueryWalker::GetNextRef(entry_ref* ref) { status_t err; @@ -642,7 +641,7 @@ TQueryWalker::GetNextRef(entry_ref *ref) } int32 -TQueryWalker::GetNextDirents(struct dirent *ent, size_t size, int32 count) +TQueryWalker::GetNextDirents(struct dirent* ent, size_t size, int32 count) { int32 result; diff --git a/src/kits/tracker/NodeWalker.h b/src/kits/tracker/NodeWalker.h index 0b3449ad0e..f13f65e23b 100644 --- a/src/kits/tracker/NodeWalker.h +++ b/src/kits/tracker/NodeWalker.h @@ -31,10 +31,10 @@ 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. */ - #ifndef WALKER_H #define WALKER_H + #ifndef _BE_BUILD_H #include #endif @@ -48,8 +48,8 @@ All rights reserved. #include "ObjectList.h" -namespace BTrackerPrivate { +namespace BTrackerPrivate { class TWalker : public BEntryList { // adds a virtual destructor that is severely missing in BEntryList @@ -58,40 +58,41 @@ class TWalker : public BEntryList { public: virtual ~TWalker(); - virtual status_t GetNextEntry(BEntry *, bool traverse = false) = 0; - virtual status_t GetNextRef(entry_ref *) = 0; - virtual int32 GetNextDirents(struct dirent *, size_t, + virtual status_t GetNextEntry(BEntry*, bool traverse = false) = 0; + virtual status_t GetNextRef(entry_ref*) = 0; + virtual int32 GetNextDirents(struct dirent*, size_t, int32 count = INT_MAX) = 0; virtual status_t Rewind() = 0; virtual int32 CountEntries() = 0; }; + class TNodeWalker : public TWalker { // TNodeWalker supports iterating a single volume, starting from a specified // entry; if passed a non-directory entry it returns just that one entry public: TNodeWalker(bool includeTopDirectory); - TNodeWalker(const char *path, bool includeTopDirectory); - TNodeWalker(const entry_ref *ref, bool includeTopDirectory); - TNodeWalker(const BDirectory *dir, bool includeTopDirectory); + TNodeWalker(const char* path, bool includeTopDirectory); + TNodeWalker(const entry_ref* ref, bool includeTopDirectory); + TNodeWalker(const BDirectory* dir, bool includeTopDirectory); virtual ~TNodeWalker(); // Backwards compatibility with Tracker compiled for R5 (remove when this // gets integrated into the official release). TNodeWalker(); - TNodeWalker(const char *path); - TNodeWalker(const entry_ref *ref); - TNodeWalker(const BDirectory *dir); + TNodeWalker(const char* path); + TNodeWalker(const entry_ref* ref); + TNodeWalker(const BDirectory* dir); - virtual status_t GetNextEntry(BEntry *, bool traverse = false); - virtual status_t GetNextRef(entry_ref *); - virtual int32 GetNextDirents(struct dirent *, size_t, + virtual status_t GetNextEntry(BEntry*, bool traverse = false); + virtual status_t GetNextRef(entry_ref*); + virtual int32 GetNextDirents(struct dirent*, size_t, int32 count = INT_MAX); virtual status_t Rewind(); protected: status_t PopDirCommon(); - void PushDirCommon(const entry_ref *); + void PushDirCommon(const entry_ref*); private: virtual int32 CountEntries(); @@ -100,17 +101,18 @@ private: protected: BObjectList fDirs; int32 fTopIndex; - BDirectory *fTopDir; + BDirectory* fTopDir; bool fIncludeTopDir; bool fOriginalIncludeTopDir; - -private: - BEntry *fJustFile; + +private: + BEntry* fJustFile; BDirectory fOriginalDirCopy; - BEntry *fOriginalJustFile; + BEntry* fOriginalJustFile; // keep around to support Rewind }; + class TVolWalker : public TNodeWalker { // TNodeWalker supports iterating over all the mounted volumes; // non-attribute and read-only volumes may optionaly be filtered out @@ -119,15 +121,15 @@ public: bool includeTopDirectory = true); virtual ~TVolWalker(); - virtual status_t GetNextEntry(BEntry *, bool traverse = false); - virtual status_t GetNextRef(entry_ref *); - virtual int32 GetNextDirents(struct dirent *, size_t, + virtual status_t GetNextEntry(BEntry*, bool traverse = false); + virtual status_t GetNextRef(entry_ref*); + virtual int32 GetNextDirents(struct dirent*, size_t, int32 count = INT_MAX); - virtual status_t Rewind(); + virtual status_t Rewind(); - virtual status_t NextVolume(); + virtual status_t NextVolume(); // skips to the next volume - // Note: it would be cool to return const BVolume * + // Note: it would be cool to return const BVolume* // that way a subclass could implement a volume filter - // it would just override, call inherited for as long as there // are volumes and it does not like them @@ -139,19 +141,20 @@ private: BVolume fVol; bool fKnowsAttr; bool fWritable; - + typedef TNodeWalker _inherited; }; + class TQueryWalker : public TWalker { public: - TQueryWalker(const char *predicate); + TQueryWalker(const char* predicate); virtual ~TQueryWalker(); // Does an in-fix walk of all entries - virtual status_t GetNextEntry(BEntry *, bool traverse = false); - virtual status_t GetNextRef(entry_ref *); - virtual int32 GetNextDirents(struct dirent *, size_t, + virtual status_t GetNextEntry(BEntry*, bool traverse = false); + virtual status_t GetNextRef(entry_ref*); + virtual int32 GetNextDirents(struct dirent*, size_t, int32 count = INT_MAX); virtual status_t NextVolume(); @@ -159,16 +162,16 @@ public: virtual status_t Rewind(); private: - virtual int32 CountEntries(); + virtual int32 CountEntries(); // can't count BQuery fQuery; BVolumeRoster fVolRoster; BVolume fVol; bigtime_t fTime; - const char *fPredicate; + const char* fPredicate; - typedef TQueryWalker _inherited; + typedef TQueryWalker _inherited; }; } // namespace BTrackerPrivate diff --git a/src/kits/tracker/OpenWithWindow.cpp b/src/kits/tracker/OpenWithWindow.cpp index 9b9b8ac478..ff957d0205 100644 --- a/src/kits/tracker/OpenWithWindow.cpp +++ b/src/kits/tracker/OpenWithWindow.cpp @@ -58,7 +58,7 @@ All rights reserved. #include -const char *kDefaultOpenWithTemplate = "OpenWithSettings"; +const char* kDefaultOpenWithTemplate = "OpenWithSettings"; // ToDo: // filter out trash @@ -76,8 +76,8 @@ const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255}; #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "OpenWithWindow" -OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen, - LockingList *windowList, window_look look, window_feel feel, +OpenWithContainerWindow::OpenWithContainerWindow(BMessage* entriesToOpen, + LockingList* windowList, window_look look, window_feel feel, uint32 flags, uint32 workspace) : BContainerWindow(windowList, 0, look, feel, flags, workspace), fEntriesToOpen(entriesToOpen) @@ -91,7 +91,7 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen, // add a background view; use the standard BackgroundView here, the same // as the file panel is using BRect rect(Bounds()); - BackgroundView *backgroundView = new BackgroundView(rect); + BackgroundView* backgroundView = new BackgroundView(rect); AddChild(backgroundView); rect = Bounds(); @@ -118,7 +118,7 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen, fLaunchAndMakeDefaultButton->SetEnabled(false); buttonRect = fLaunchAndMakeDefaultButton->Frame(); - BButton *button = new BButton(buttonRect, "cancel", B_TRANSLATE("Cancel"), + BButton* button = new BButton(buttonRect, "cancel", B_TRANSLATE("Cancel"), new BMessage(kCancelButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); button->ResizeToPreferred(); button->MoveBy(- 10 - button->Bounds().Width(), 0); @@ -166,22 +166,22 @@ OpenWithContainerWindow::~OpenWithContainerWindow() } -BPoseView * -OpenWithContainerWindow::NewPoseView(Model *, BRect rect, uint32) +BPoseView* +OpenWithContainerWindow::NewPoseView(Model*, BRect rect, uint32) { return new OpenWithPoseView(rect); } -OpenWithPoseView * +OpenWithPoseView* OpenWithContainerWindow::PoseView() const { - ASSERT(dynamic_cast(fPoseView)); - return static_cast(fPoseView); + ASSERT(dynamic_cast(fPoseView)); + return static_cast(fPoseView); } -const BMessage * +const BMessage* OpenWithContainerWindow::EntryList() const { return fEntriesToOpen; @@ -200,20 +200,20 @@ OpenWithContainerWindow::OpenWithSelection() } -static const BString * -FindOne(const BString *element, void *castToString) +static const BString* +FindOne(const BString* element, void* castToString) { - if (strcasecmp(element->String(), (const char *)castToString) == 0) + if (strcasecmp(element->String(), (const char*)castToString) == 0) return element; return 0; } -static const entry_ref * -AddOneUniqueDocumentType(const entry_ref *ref, void *castToList) +static const entry_ref* +AddOneUniqueDocumentType(const entry_ref* ref, void* castToList) { - BObjectList *list = (BObjectList *)castToList; + BObjectList* list = (BObjectList*)castToList; BEntry entry(ref, true); // traverse symlinks @@ -238,10 +238,10 @@ AddOneUniqueDocumentType(const entry_ref *ref, void *castToList) } -static const BString * -SetDefaultAppForOneType(const BString *element, void *castToEntryRef) +static const BString* +SetDefaultAppForOneType(const BString* element, void* castToEntryRef) { - const entry_ref *appRef = (const entry_ref *)castToEntryRef; + const entry_ref* appRef = (const entry_ref*)castToEntryRef; // set entry as default handler for one mime string BMimeType mime(element->String()); @@ -288,7 +288,7 @@ OpenWithContainerWindow::MakeDefaultAndOpen() if (!count) return; - BPose *selectedAppPose = PoseView()->SelectionList()->FirstItem(); + BPose* selectedAppPose = PoseView()->SelectionList()->FirstItem(); ASSERT(selectedAppPose); if (!selectedAppPose) return; @@ -300,7 +300,7 @@ OpenWithContainerWindow::MakeDefaultAndOpen() // set the default application to be the selected pose for all the // mime types in the list openedFileTypes.EachElement(SetDefaultAppForOneType, - (void *)selectedAppPose->TargetModel()->EntryRef()); + (void*)selectedAppPose->TargetModel()->EntryRef()); // done setting the default application, now launch the app with the // documents @@ -309,7 +309,7 @@ OpenWithContainerWindow::MakeDefaultAndOpen() void -OpenWithContainerWindow::MessageReceived(BMessage *message) +OpenWithContainerWindow::MessageReceived(BMessage* message) { switch (message->what) { case kDefaultButton: @@ -338,11 +338,11 @@ OpenWithContainerWindow::MessageReceived(BMessage *message) filter_result -OpenWithContainerWindow::KeyDownFilter(BMessage *message, BHandler **, - BMessageFilter *filter) +OpenWithContainerWindow::KeyDownFilter(BMessage* message, BHandler**, + BMessageFilter* filter) { uchar key; - if (message->FindInt8("byte", (int8 *)&key) != B_OK) + if (message->FindInt8("byte", (int8*)&key) != B_OK) return B_DISPATCH_MESSAGE; int32 modifier=0; @@ -364,7 +364,7 @@ OpenWithContainerWindow::ShouldAddMenus() const void -OpenWithContainerWindow::ShowContextMenu(BPoint, const entry_ref *, BView *) +OpenWithContainerWindow::ShowContextMenu(BPoint, const entry_ref*, BView*) { } @@ -378,10 +378,10 @@ OpenWithContainerWindow::AddShortcuts() void -OpenWithContainerWindow::NewAttributeMenu(BMenu *menu) +OpenWithContainerWindow::NewAttributeMenu(BMenu* menu) { _inherited::NewAttributeMenu(menu); - BMessage *message = new BMessage(kAttributeItem); + BMessage* message = new BMessage(kAttributeItem); message->AddString("attr_name", kAttrOpenWithRelation); message->AddInt32("attr_type", B_STRING_TYPE); message->AddInt32("attr_hash", (int32)AttrHashString(kAttrOpenWithRelation, B_STRING_TYPE)); @@ -389,7 +389,7 @@ OpenWithContainerWindow::NewAttributeMenu(BMenu *menu) message->AddInt32("attr_align", B_ALIGN_LEFT); message->AddBool("attr_editable", false); message->AddBool("attr_statfield", false); - BMenuItem *item = new BMenuItem(B_TRANSLATE("Relation"), message); + BMenuItem* item = new BMenuItem(B_TRANSLATE("Relation"), message); menu->AddItem(item); message = new BMessage(kAttributeItem); message->AddString("attr_name", kAttrAppVersion); @@ -425,7 +425,7 @@ OpenWithContainerWindow::SaveState(BMessage &message) const void -OpenWithContainerWindow::Init(const BMessage *message) +OpenWithContainerWindow::Init(const BMessage* message) { _inherited::Init(message); } @@ -454,13 +454,13 @@ OpenWithContainerWindow::RestoreState(const BMessage &message) void -OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode *node) +OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode* node) { SetSizeLimits(fMinimalWidth, 10000, 160, 10000); if (!node) return; - const char *rectAttributeName = kAttrWindowFrame; + const char* rectAttributeName = kAttrWindowFrame; BRect frame(Frame()); if (node->Read(rectAttributeName, 0, B_RECT_TYPE, sizeof(BRect), &frame) == sizeof(BRect)) { @@ -491,14 +491,14 @@ OpenWithContainerWindow::SetUpDefaultState() bool -OpenWithContainerWindow::IsShowing(const node_ref *) const +OpenWithContainerWindow::IsShowing(const node_ref*) const { return false; } bool -OpenWithContainerWindow::IsShowing(const entry_ref *) const +OpenWithContainerWindow::IsShowing(const entry_ref*) const { return false; } @@ -532,11 +532,11 @@ OpenWithPoseView::OpenWithPoseView(BRect frame, uint32 resizeMask) } -OpenWithContainerWindow * +OpenWithContainerWindow* OpenWithPoseView::ContainerWindow() const { - ASSERT(dynamic_cast(Window())); - return static_cast(Window()); + ASSERT(dynamic_cast(Window())); + return static_cast(Window()); } @@ -550,15 +550,15 @@ OpenWithPoseView::AttachedToWindow() bool -OpenWithPoseView::CanHandleDragSelection(const Model *, const BMessage *, bool) +OpenWithPoseView::CanHandleDragSelection(const Model*, const BMessage*, bool) { return false; } static void -AddSupportingAppForTypeToQuery(SearchForSignatureEntryList *queryIterator, - const char *type) +AddSupportingAppForTypeToQuery(SearchForSignatureEntryList* queryIterator, + const char* type) { // get supporting apps for type BMimeType mime(type); @@ -570,7 +570,7 @@ AddSupportingAppForTypeToQuery(SearchForSignatureEntryList *queryIterator, // push each of the supporting apps signature uniquely - const char *signature; + const char* signature; for (int32 index = 0; message.FindString("applications", index, &signature) == B_OK; index++) { queryIterator->PushUniqueSignature(signature); @@ -578,14 +578,14 @@ AddSupportingAppForTypeToQuery(SearchForSignatureEntryList *queryIterator, } -static const entry_ref * -AddOneRefSignatures(const entry_ref *ref, void *castToIterator) +static const entry_ref* +AddOneRefSignatures(const entry_ref* ref, void* castToIterator) { // TODO: resolve cases where each entry has a different type and // their supporting apps are disjoint sets - SearchForSignatureEntryList *queryIterator = - (SearchForSignatureEntryList *)castToIterator; + SearchForSignatureEntryList* queryIterator = + (SearchForSignatureEntryList*)castToIterator; Model model(ref, true, true); if (model.InitCheck() != B_OK) @@ -625,12 +625,12 @@ AddOneRefSignatures(const entry_ref *ref, void *castToIterator) } -EntryListBase * -OpenWithPoseView::InitDirentIterator(const entry_ref *) +EntryListBase* +OpenWithPoseView::InitDirentIterator(const entry_ref*) { - OpenWithContainerWindow *window = ContainerWindow(); + OpenWithContainerWindow* window = ContainerWindow(); - const BMessage *entryList = window->EntryList(); + const BMessage* entryList = window->EntryList(); fIterator = new SearchForSignatureEntryList(true); @@ -653,9 +653,9 @@ OpenWithPoseView::InitDirentIterator(const entry_ref *) void -OpenWithPoseView::OpenSelection(BPose *pose, int32 *) +OpenWithPoseView::OpenSelection(BPose* pose, int32*) { - OpenWithContainerWindow *window = ContainerWindow(); + OpenWithContainerWindow* window = ContainerWindow(); int32 count = fSelectionList->CountItems(); if (!count) @@ -723,7 +723,7 @@ OpenWithPoseView::Pulse() // // disable the Open button if no apps selected - OpenWithContainerWindow *window = ContainerWindow(); + OpenWithContainerWindow* window = ContainerWindow(); if (!fSelectionList->CountItems()) { window->SetCanSetAppAsDefault(false); @@ -734,7 +734,7 @@ OpenWithPoseView::Pulse() // if we selected a non-handling application, don't allow setting // it as preferred - Model *firstSelected = fSelectionList->FirstItem()->TargetModel(); + Model* firstSelected = fSelectionList->FirstItem()->TargetModel(); if (OpenWithRelation(firstSelected) == kNoRelation) { window->SetCanSetAppAsDefault(false); window->SetCanOpen(true); @@ -768,10 +768,10 @@ OpenWithPoseView::SetUpDefaultColumnsIfNeeded() if (fColumnList->CountItems() != 0) return; - BColumn *nameColumn = new BColumn(B_TRANSLATE("Name"), kColumnStart, 125, + BColumn* nameColumn = new BColumn(B_TRANSLATE("Name"), kColumnStart, 125, B_ALIGN_LEFT, kAttrStatName, B_STRING_TYPE, true, true); fColumnList->AddItem(nameColumn); - BColumn *relationColumn = new BColumn(B_TRANSLATE("Relation"), 180, 100, + BColumn* relationColumn = new BColumn(B_TRANSLATE("Relation"), 180, 100, B_ALIGN_LEFT, kAttrOpenWithRelation, B_STRING_TYPE, false, false); fColumnList->AddItem(relationColumn); fColumnList->AddItem(new BColumn(B_TRANSLATE("Location"), 290, 225, @@ -786,16 +786,16 @@ OpenWithPoseView::SetUpDefaultColumnsIfNeeded() bool -OpenWithPoseView::AddPosesThreadValid(const entry_ref *) const +OpenWithPoseView::AddPosesThreadValid(const entry_ref*) const { return true; } void -OpenWithPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, - BPose **resultingPoses, bool insertionSort, int32 *lastPoseIndexPtr, - BRect *boundsPtr, bool forceDraw) +OpenWithPoseView::CreatePoses(Model** models, PoseInfo* poseInfoArray, int32 count, + BPose** resultingPoses, bool insertionSort, int32* lastPoseIndexPtr, + BRect* boundsPtr, bool forceDraw) { // overridden to try to select the preferred handling app _inherited::CreatePoses(models, poseInfoArray, count, resultingPoses, insertionSort, @@ -814,7 +814,7 @@ OpenWithPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 cou void -OpenWithPoseView::KeyDown(const char *bytes, int32 count) +OpenWithPoseView::KeyDown(const char* bytes, int32 count) { if (bytes[0] == B_TAB) { // just shift the focus, don't tab to the next pose @@ -825,14 +825,14 @@ OpenWithPoseView::KeyDown(const char *bytes, int32 count) void -OpenWithPoseView::SaveState(AttributeStreamNode *node) +OpenWithPoseView::SaveState(AttributeStreamNode* node) { _inherited::SaveState(node); } void -OpenWithPoseView::RestoreState(AttributeStreamNode *node) +OpenWithPoseView::RestoreState(AttributeStreamNode* node) { _inherited::RestoreState(node); fViewState->SetViewMode(kListMode); @@ -855,7 +855,7 @@ OpenWithPoseView::RestoreState(const BMessage &message) void -OpenWithPoseView::SavePoseLocations(BRect *) +OpenWithPoseView::SavePoseLocations(BRect*) { // do nothing } @@ -868,40 +868,40 @@ OpenWithPoseView::MoveSelectionToTrash(bool) void -OpenWithPoseView::MoveSelectionTo(BPoint, BPoint, BContainerWindow *) +OpenWithPoseView::MoveSelectionTo(BPoint, BPoint, BContainerWindow*) { } void -OpenWithPoseView::MoveSelectionInto(Model *, BContainerWindow *, bool, bool) +OpenWithPoseView::MoveSelectionInto(Model*, BContainerWindow*, bool, bool) { } bool -OpenWithPoseView::Represents(const node_ref *) const +OpenWithPoseView::Represents(const node_ref*) const { return false; } bool -OpenWithPoseView::Represents(const entry_ref *) const +OpenWithPoseView::Represents(const entry_ref*) const { return false; } bool -OpenWithPoseView::HandleMessageDropped(BMessage *DEBUG_ONLY(message)) +OpenWithPoseView::HandleMessageDropped(BMessage* DEBUG_ONLY(message)) { #if DEBUG // in debug mode allow tweaking the colors - const rgb_color *color; + const rgb_color* color; int32 size; // handle roColour-style color drops - if (message->FindData("RGBColor", 'RGBC', (const void **)&color, &size) == B_OK) { + if (message->FindData("RGBColor", 'RGBC', (const void**)&color, &size) == B_OK) { SetViewColor(*color); SetLowColor(*color); Invalidate(); @@ -913,9 +913,9 @@ OpenWithPoseView::HandleMessageDropped(BMessage *DEBUG_ONLY(message)) int32 -OpenWithPoseView::OpenWithRelation(const Model *model) const +OpenWithPoseView::OpenWithRelation(const Model* model) const { - OpenWithContainerWindow *window = ContainerWindow(); + OpenWithContainerWindow* window = ContainerWindow(); return SearchForSignatureEntryList::Relation(window->EntryList(), model, fHaveCommonPreferredApp ? &fPreferredRef : 0, 0); @@ -923,10 +923,10 @@ OpenWithPoseView::OpenWithRelation(const Model *model) const void -OpenWithPoseView::OpenWithRelationDescription(const Model *model, - BString *description) const +OpenWithPoseView::OpenWithRelationDescription(const Model* model, + BString* description) const { - OpenWithContainerWindow *window = ContainerWindow(); + OpenWithContainerWindow* window = ContainerWindow(); SearchForSignatureEntryList::RelationDescription(window->EntryList(), model, description, fHaveCommonPreferredApp ? &fPreferredRef : 0, 0); @@ -934,9 +934,9 @@ OpenWithPoseView::OpenWithRelationDescription(const Model *model, bool -OpenWithPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) +OpenWithPoseView::ShouldShowPose(const Model* model, const PoseInfo* poseInfo) { - OpenWithContainerWindow *window = ContainerWindow(); + OpenWithContainerWindow* window = ContainerWindow(); // filter for add_poses if (!fIterator->CanOpenWithFilter(model, window->EntryList(), fHaveCommonPreferredApp ? &fPreferredRef : 0)) @@ -949,7 +949,7 @@ OpenWithPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) // #pragma mark - -RelationCachingModelProxy::RelationCachingModelProxy(Model *model) +RelationCachingModelProxy::RelationCachingModelProxy(Model* model) : fModel(model), fRelation(kUnknownRelation) @@ -964,8 +964,8 @@ RelationCachingModelProxy::~RelationCachingModelProxy() int32 -RelationCachingModelProxy::Relation(SearchForSignatureEntryList *iterator, - BMessage *entries) const +RelationCachingModelProxy::Relation(SearchForSignatureEntryList* iterator, + BMessage* entries) const { if (fRelation == kUnknownRelation) fRelation = iterator->Relation(entries, fModel); @@ -977,8 +977,8 @@ RelationCachingModelProxy::Relation(SearchForSignatureEntryList *iterator, // #pragma mark - -OpenWithMenu::OpenWithMenu(const char *label, const BMessage *entriesToOpen, - BWindow *parentWindow, BHandler *target) +OpenWithMenu::OpenWithMenu(const char* label, const BMessage* entriesToOpen, + BWindow* parentWindow, BHandler* target) : BSlowMenu(label), fEntriesToOpen(*entriesToOpen), target(target), @@ -995,8 +995,8 @@ OpenWithMenu::OpenWithMenu(const char *label, const BMessage *entriesToOpen, } -OpenWithMenu::OpenWithMenu(const char *label, const BMessage *entriesToOpen, - BWindow *parentWindow, const BMessenger &messenger) +OpenWithMenu::OpenWithMenu(const char* label, const BMessage* entriesToOpen, + BWindow* parentWindow, const BMessenger &messenger) : BSlowMenu(label), fEntriesToOpen(*entriesToOpen), target(NULL), @@ -1017,10 +1017,10 @@ OpenWithMenu::OpenWithMenu(const char *label, const BMessage *entriesToOpen, namespace BPrivate { int -SortByRelationAndName(const RelationCachingModelProxy *model1, - const RelationCachingModelProxy *model2, void *castToMenu) +SortByRelationAndName(const RelationCachingModelProxy* model1, + const RelationCachingModelProxy* model2, void* castToMenu) { - OpenWithMenu *menu = (OpenWithMenu *)castToMenu; + OpenWithMenu* menu = (OpenWithMenu*)castToMenu; // find out the relations of app models to the opened entries int32 relation1 = model1->Relation(menu->fIterator, &menu->fEntriesToOpen); @@ -1070,7 +1070,7 @@ OpenWithMenu::AddNextItem() if (fIterator->GetNextEntry(&entry) != B_OK) return false; - Model *model = new Model(&entry, true); + Model* model = new Model(&entry, true); if (model->InitCheck() != B_OK || !fIterator->CanOpenWithFilter(model, &fEntriesToOpen, fHaveCommonPreferredApp ? &fPreferredRef : 0)) { @@ -1109,11 +1109,11 @@ OpenWithMenu::DoneBuildingItemList() int32 lastRelation = -1; for (int32 index = 0; index < count ; index++) { - RelationCachingModelProxy *modelProxy = fSupportingAppList->ItemAt(index); - Model *model = modelProxy->fModel; - BMessage *message = new BMessage(fEntriesToOpen); + RelationCachingModelProxy* modelProxy = fSupportingAppList->ItemAt(index); + Model* model = modelProxy->fModel; + BMessage* message = new BMessage(fEntriesToOpen); message->AddRef("handler", model->EntryRef()); - BContainerWindow *window = dynamic_cast(fParentWindow); + BContainerWindow* window = dynamic_cast(fParentWindow); if (window) message->AddData("nodeRefsToClose", B_RAW_TYPE, window->TargetModel()->NodeRef(), sizeof (node_ref)); @@ -1148,7 +1148,7 @@ OpenWithMenu::DoneBuildingItemList() AddSeparatorItem(); lastRelation = relation; - ModelMenuItem *item = new ModelMenuItem(model, result.String(), message); + ModelMenuItem* item = new ModelMenuItem(model, result.String(), message); AddItem(item); // mark item if it represents the preferred app if (fHaveCommonPreferredApp && *(model->EntryRef()) == fPreferredRef) { @@ -1204,10 +1204,10 @@ SearchForSignatureEntryList::~SearchForSignatureEntryList() void -SearchForSignatureEntryList::PushUniqueSignature(const char *str) +SearchForSignatureEntryList::PushUniqueSignature(const char* str) { // do a unique add - if (fSignatures.EachElement(FindOne, (void *)str)) + if (fSignatures.EachElement(FindOne, (void*)str)) return; fSignatures.AddItem(new BString(str)); @@ -1215,21 +1215,21 @@ SearchForSignatureEntryList::PushUniqueSignature(const char *str) status_t -SearchForSignatureEntryList::GetNextEntry(BEntry *entry, bool) +SearchForSignatureEntryList::GetNextEntry(BEntry* entry, bool) { return fIteratorList->GetNextEntry(entry); } status_t -SearchForSignatureEntryList::GetNextRef(entry_ref *ref) +SearchForSignatureEntryList::GetNextRef(entry_ref* ref) { return fIteratorList->GetNextRef(ref); } int32 -SearchForSignatureEntryList::GetNextDirents(struct dirent *buffer, +SearchForSignatureEntryList::GetNextDirents(struct dirent* buffer, size_t length, int32 count) { return fIteratorList->GetNextDirents(buffer, length, count); @@ -1237,14 +1237,14 @@ SearchForSignatureEntryList::GetNextDirents(struct dirent *buffer, struct AddOneTermParams { - BString *result; + BString* result; bool first; }; -static const BString * -AddOnePredicateTerm(const BString *item, void *castToParams) +static const BString* +AddOnePredicateTerm(const BString* item, void* castToParams) { - AddOneTermParams *params = (AddOneTermParams *)castToParams; + AddOneTermParams* params = (AddOneTermParams*)castToParams; if (!params->first) (*params->result) << " || "; (*params->result) << kAttrAppSignature << " = " << item->String(); @@ -1297,7 +1297,7 @@ SearchForSignatureEntryList::CountEntries() bool -SearchForSignatureEntryList::GetPreferredApp(entry_ref *ref) const +SearchForSignatureEntryList::GetPreferredApp(entry_ref* ref) const { if (fPreferredAppCount == 1) *ref = fPreferredRef; @@ -1307,7 +1307,7 @@ SearchForSignatureEntryList::GetPreferredApp(entry_ref *ref) const void -SearchForSignatureEntryList::TrySettingPreferredApp(const entry_ref *ref) +SearchForSignatureEntryList::TrySettingPreferredApp(const entry_ref* ref) { if (!fPreferredAppCount) { fPreferredRef = *ref; @@ -1319,7 +1319,7 @@ SearchForSignatureEntryList::TrySettingPreferredApp(const entry_ref *ref) void -SearchForSignatureEntryList::TrySettingPreferredAppForFile(const entry_ref *ref) +SearchForSignatureEntryList::TrySettingPreferredAppForFile(const entry_ref* ref) { if (!fPreferredAppForFileCount) { fPreferredRefForFile = *ref; @@ -1353,8 +1353,8 @@ SearchForSignatureEntryList::ShowAllApplications() const int32 -SearchForSignatureEntryList::Relation(const Model *nodeModel, - const Model *applicationModel) +SearchForSignatureEntryList::Relation(const Model* nodeModel, + const Model* applicationModel) { switch (applicationModel->SupportsMimeType(nodeModel->MimeType(), 0, true)) { case kDoesNotSupportType: @@ -1376,8 +1376,8 @@ SearchForSignatureEntryList::Relation(const Model *nodeModel, int32 -SearchForSignatureEntryList::Relation(const BMessage *entriesToOpen, - const Model *model) const +SearchForSignatureEntryList::Relation(const BMessage* entriesToOpen, + const Model* model) const { return Relation(entriesToOpen, model, fPreferredAppCount == 1 ? &fPreferredRef : 0, @@ -1386,8 +1386,8 @@ SearchForSignatureEntryList::Relation(const BMessage *entriesToOpen, void -SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen, - const Model *model, BString *description) const +SearchForSignatureEntryList::RelationDescription(const BMessage* entriesToOpen, + const Model* model, BString* description) const { RelationDescription(entriesToOpen, model, description, fPreferredAppCount == 1 ? &fPreferredRef : 0, @@ -1396,9 +1396,9 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen, int32 -SearchForSignatureEntryList::Relation(const BMessage *entriesToOpen, - const Model *applicationModel, const entry_ref *preferredApp, - const entry_ref *preferredAppForFile) +SearchForSignatureEntryList::Relation(const BMessage* entriesToOpen, + const Model* applicationModel, const entry_ref* preferredApp, + const entry_ref* preferredAppForFile) { for (int32 index = 0; ; index++) { entry_ref ref; @@ -1432,9 +1432,9 @@ SearchForSignatureEntryList::Relation(const BMessage *entriesToOpen, void -SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen, - const Model *applicationModel, BString *description, const entry_ref *preferredApp, - const entry_ref *preferredAppForFile) +SearchForSignatureEntryList::RelationDescription(const BMessage* entriesToOpen, + const Model* applicationModel, BString* description, const entry_ref* preferredApp, + const entry_ref* preferredAppForFile) { for (int32 index = 0; ;index++) { entry_ref ref; @@ -1465,8 +1465,8 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen, mimeType.SetTo(model.MimeType()); // status_t result = mimeType.GetSupertype(&mimeType); - char *type = (char *)mimeType.Type(); - char *tmp = strchr(type, '/'); + char* type = (char*)mimeType.Type(); + char* tmp = strchr(type, '/'); if (tmp) *tmp = '\0'; @@ -1503,8 +1503,8 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen, bool -SearchForSignatureEntryList::CanOpenWithFilter(const Model *appModel, - const BMessage *entriesToOpen, const entry_ref *preferredApp) +SearchForSignatureEntryList::CanOpenWithFilter(const Model* appModel, + const BMessage* entriesToOpen, const entry_ref* preferredApp) { if (!appModel->IsExecutable() || !appModel->Node()) { // weed out non-executable @@ -1522,10 +1522,10 @@ SearchForSignatureEntryList::CanOpenWithFilter(const Model *appModel, return false; } - ASSERT(dynamic_cast(appModel->Node())); + ASSERT(dynamic_cast(appModel->Node())); char signature[B_MIME_TYPE_LENGTH]; status_t result = GetAppSignatureFromAttr( - dynamic_cast(appModel->Node()), signature); + dynamic_cast(appModel->Node()), signature); if (result == B_OK && strcasecmp(signature, kTrackerSignature) == 0) { // special case the Tracker - make sure only the running copy is @@ -1558,7 +1558,7 @@ SearchForSignatureEntryList::CanOpenWithFilter(const Model *appModel, // don't check for these if we didn't look for every single app // to not slow filtering down uint32 flags; - BAppFileInfo appFileInfo(dynamic_cast(appModel->Node())); + BAppFileInfo appFileInfo(dynamic_cast(appModel->Node())); if (appFileInfo.GetAppFlags(&flags) != B_OK) return false; @@ -1597,7 +1597,7 @@ SearchForSignatureEntryList::CanOpenWithFilter(const Model *appModel, ConditionalAllAppsIterator::ConditionalAllAppsIterator( - SearchForSignatureEntryList *parent) + SearchForSignatureEntryList* parent) : fParent(parent), fWalker(NULL) @@ -1625,7 +1625,7 @@ ConditionalAllAppsIterator::~ConditionalAllAppsIterator() status_t -ConditionalAllAppsIterator::GetNextEntry(BEntry *entry, bool traverse) +ConditionalAllAppsIterator::GetNextEntry(BEntry* entry, bool traverse) { if (!Iterate()) return B_ENTRY_NOT_FOUND; @@ -1636,7 +1636,7 @@ ConditionalAllAppsIterator::GetNextEntry(BEntry *entry, bool traverse) status_t -ConditionalAllAppsIterator::GetNextRef(entry_ref *ref) +ConditionalAllAppsIterator::GetNextRef(entry_ref* ref) { if (!Iterate()) return B_ENTRY_NOT_FOUND; @@ -1647,7 +1647,7 @@ ConditionalAllAppsIterator::GetNextRef(entry_ref *ref) int32 -ConditionalAllAppsIterator::GetNextDirents(struct dirent *buffer, size_t length, +ConditionalAllAppsIterator::GetNextDirents(struct dirent* buffer, size_t length, int32 count) { if (!Iterate()) @@ -1685,4 +1685,3 @@ ConditionalAllAppsIterator::Iterate() const { return fParent->ShowAllApplications(); } - diff --git a/src/kits/tracker/OpenWithWindow.h b/src/kits/tracker/OpenWithWindow.h index b644b7bfff..ade2d702be 100644 --- a/src/kits/tracker/OpenWithWindow.h +++ b/src/kits/tracker/OpenWithWindow.h @@ -31,10 +31,13 @@ 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. */ - -#ifndef _OPEN_WITH_WINDOW_H +#ifndef _OPEN_WITH_WINDOW_H #define _OPEN_WITH_WINDOW_H + +// OpenWithContainerWindow supports the Open With feature + + #include #include "ContainerWindow.h" @@ -45,12 +48,11 @@ All rights reserved. #include "SlowMenu.h" #include "Utilities.h" + namespace BPrivate { class OpenWithPoseView; -// OpenWithContainerWindow supports the Open With feature - enum { kUnknownRelation = -1, kNoRelation = 0, @@ -61,6 +63,7 @@ enum { kPreferredForFile }; + // pass in a predicate; a query will search for matches // matches will be returned in iteration class SearchForSignatureEntryList : public EntryListBase { @@ -68,43 +71,43 @@ class SearchForSignatureEntryList : public EntryListBase { SearchForSignatureEntryList(bool canAddAllApps); virtual ~SearchForSignatureEntryList(); - void PushUniqueSignature(const char *); + void PushUniqueSignature(const char*); // add one signature to search for // entry list iterators - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false); + virtual status_t GetNextRef(entry_ref* ref); + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX); virtual status_t Rewind(); virtual int32 CountEntries(); - bool GetPreferredApp(entry_ref *ref) const; + bool GetPreferredApp(entry_ref* ref) const; // gets the preferred app for all the files it was asked to // find supporting apps for, returns false if no preferred app // found or if more than one found - void TrySettingPreferredApp(const entry_ref *); - void TrySettingPreferredAppForFile(const entry_ref *); + void TrySettingPreferredApp(const entry_ref*); + void TrySettingPreferredAppForFile(const entry_ref*); - int32 Relation(const BMessage *entriesToOpen, const Model *) const; + int32 Relation(const BMessage* entriesToOpen, const Model*) const; // returns the reason why an application is shown in Open With window - void RelationDescription(const BMessage *entriesToOpen, const Model *, - BString *) const; + void RelationDescription(const BMessage* entriesToOpen, const Model*, + BString*) const; // returns a string describing why application handles files to open - static int32 Relation(const BMessage *entriesToOpen, - const Model *, const entry_ref *preferredApp, - const entry_ref *preferredAppForFile); + static int32 Relation(const BMessage* entriesToOpen, + const Model*, const entry_ref* preferredApp, + const entry_ref* preferredAppForFile); // returns the reason why an application is shown in Open With window // static version, needs the preferred app for preformance - static void RelationDescription(const BMessage *entriesToOpen, - const Model *, BString *, const entry_ref *preferredApp, - const entry_ref *preferredAppForFile); + static void RelationDescription(const BMessage* entriesToOpen, + const Model*, BString*, const entry_ref* preferredApp, + const entry_ref* preferredAppForFile); // returns a string describing why application handles files to open - bool CanOpenWithFilter(const Model *appModel, const BMessage *entriesToOpen, - const entry_ref *preferredApp); + bool CanOpenWithFilter(const Model* appModel, const BMessage* entriesToOpen, + const entry_ref* preferredApp); void NonGenericFileFound(); bool GenericFilesOnly() const; @@ -112,10 +115,10 @@ class SearchForSignatureEntryList : public EntryListBase { bool ShowAllApplications() const; private: - static int32 Relation(const Model *node, const Model *app); + static int32 Relation(const Model* node, const Model* app); // returns the reason why an application is shown in Open With window - CachedEntryIteratorList *fIteratorList; + CachedEntryIteratorList* fIteratorList; BObjectList fSignatures; entry_ref fPreferredRef; @@ -127,47 +130,48 @@ class SearchForSignatureEntryList : public EntryListBase { bool fFoundOneNonSuperHandler; }; + class OpenWithContainerWindow : public BContainerWindow { public: - OpenWithContainerWindow(BMessage *entriesToOpen, - LockingList *windowList, + OpenWithContainerWindow(BMessage* entriesToOpen, + LockingList* windowList, window_look look = B_DOCUMENT_WINDOW_LOOK, window_feel feel = B_NORMAL_WINDOW_FEEL, uint32 flags = 0, uint32 workspace = B_CURRENT_WORKSPACE); // eventually get opened by the selected app virtual ~OpenWithContainerWindow(); - virtual void Init(const BMessage *message); + virtual void Init(const BMessage* message); - const BMessage *EntryList() const; + const BMessage* EntryList() const; // return the list of the entries we are supposed to open void SetCanSetAppAsDefault(bool); void SetCanOpen(bool); - OpenWithPoseView *PoseView() const; + OpenWithPoseView* PoseView() const; protected: - virtual BPoseView *NewPoseView(Model *model, BRect rect, uint32 viewMode); + virtual BPoseView* NewPoseView(Model* model, BRect rect, uint32 viewMode); virtual bool ShouldAddMenus() const; - virtual void ShowContextMenu(BPoint, const entry_ref *, BView *); + virtual void ShowContextMenu(BPoint, const entry_ref*, BView*); virtual void AddShortcuts(); - virtual void NewAttributeMenu(BMenu *); + virtual void NewAttributeMenu(BMenu*); virtual void RestoreState(); - virtual void RestoreState(const BMessage &); - virtual void RestoreWindowState(AttributeStreamNode *); - virtual void RestoreWindowState(const BMessage &); + virtual void RestoreState(const BMessage&); + virtual void RestoreWindowState(AttributeStreamNode*); + virtual void RestoreWindowState(const BMessage&); virtual bool NeedsDefaultStateSetup(); virtual void SaveState(bool hide = true); - virtual void SaveState(BMessage &) const; + virtual void SaveState(BMessage&) const; virtual void SetUpDefaultState(); - virtual bool IsShowing(const node_ref *) const; - virtual bool IsShowing(const entry_ref *) const; + virtual bool IsShowing(const node_ref*) const; + virtual bool IsShowing(const entry_ref*) const; - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); void OpenWithSelection(); // open entries with the selected app @@ -175,31 +179,32 @@ class OpenWithContainerWindow : public BContainerWindow { // open entries with the selected app and make it the default handler private: - static filter_result KeyDownFilter(BMessage *, BHandler **, BMessageFilter *); + static filter_result KeyDownFilter(BMessage*, BHandler**, BMessageFilter*); - BMessage *fEntriesToOpen; - BButton *fLaunchButton; - BButton *fLaunchAndMakeDefaultButton; + BMessage* fEntriesToOpen; + BButton* fLaunchButton; + BButton* fLaunchAndMakeDefaultButton; float fMinimalWidth; typedef BContainerWindow _inherited; }; + class OpenWithPoseView : public BPoseView { public: OpenWithPoseView(BRect, uint32 resizeMask = B_FOLLOW_ALL); - virtual void OpenSelection(BPose *, int32 *); + virtual void OpenSelection(BPose*, int32*); // open entries with the selected app - int32 OpenWithRelation(const Model *) const; + int32 OpenWithRelation(const Model*) const; // returns the reason why an application is shown in Open With window - void OpenWithRelationDescription(const Model *, BString *) const; + void OpenWithRelationDescription(const Model*, BString*) const; // returns a string describing why application handles files to open - OpenWithContainerWindow *ContainerWindow() const; + OpenWithContainerWindow* ContainerWindow() const; - virtual bool AddPosesThreadValid(const entry_ref *) const; + virtual bool AddPosesThreadValid(const entry_ref*) const; protected: // don't do any volume watching and memtamime watching in open with panels for now @@ -207,69 +212,71 @@ class OpenWithPoseView : public BPoseView { virtual void FinalStopWatching() {} virtual void AttachedToWindow(); - EntryListBase *InitDirentIterator(const entry_ref *ref); + EntryListBase* InitDirentIterator(const entry_ref* ref); virtual void SetUpDefaultColumnsIfNeeded(); // show launch window specific columns // empty overrides for functions that depend on having an fModel - virtual void SaveState(AttributeStreamNode *); - virtual void RestoreState(AttributeStreamNode *); - virtual void SaveState(BMessage &) const; - virtual void RestoreState(const BMessage &); - virtual void SavePoseLocations(BRect * = NULL); + virtual void SaveState(AttributeStreamNode*); + virtual void RestoreState(AttributeStreamNode*); + virtual void SaveState(BMessage&) const; + virtual void RestoreState(const BMessage&); + virtual void SavePoseLocations(BRect* = NULL); virtual void MoveSelectionToTrash(bool selectNext = true); virtual void MoveSelectionTo(BPoint, BPoint, BContainerWindow*); - virtual void MoveSelectionInto(Model* destFolder, BContainerWindow *srcWindow, + virtual void MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow, bool forceCopy, bool create_link = false); - virtual bool HandleMessageDropped(BMessage *); - virtual bool CanHandleDragSelection(const Model *, const BMessage *, bool); + virtual bool HandleMessageDropped(BMessage*); + virtual bool CanHandleDragSelection(const Model*, const BMessage*, bool); - virtual bool Represents(const node_ref *) const; - virtual bool Represents(const entry_ref *) const; + virtual bool Represents(const node_ref*) const; + virtual bool Represents(const entry_ref*) const; - virtual void CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, - BPose **resultingPoses, bool insertionSort = true, int32 *lastPoseIndexPtr = NULL, - BRect *boundsPtr = NULL, bool forceDraw = false); + virtual void CreatePoses(Model** models, PoseInfo* poseInfoArray, int32 count, + BPose** resultingPoses, bool insertionSort = true, int32* lastPoseIndexPtr = NULL, + BRect* boundsPtr = NULL, bool forceDraw = false); // override to add selecting the default handling app for selection - virtual bool ShouldShowPose(const Model *, const PoseInfo *); + virtual bool ShouldShowPose(const Model*, const PoseInfo*); virtual void Pulse(); - virtual void KeyDown(const char *bytes, int32 count); + virtual void KeyDown(const char* bytes, int32 count); private: entry_ref fPreferredRef; bool fHaveCommonPreferredApp; - SearchForSignatureEntryList *fIterator; + SearchForSignatureEntryList* fIterator; // private copy of the iterator pointer typedef BPoseView _inherited; }; + class RelationCachingModelProxy { public: - RelationCachingModelProxy(Model *model); + RelationCachingModelProxy(Model* model); ~RelationCachingModelProxy(); - int32 Relation(SearchForSignatureEntryList *iterator, BMessage *entries) const; + int32 Relation(SearchForSignatureEntryList* iterator, BMessage* entries) const; - Model *fModel; + Model* fModel; mutable int32 fRelation; }; + class OpenWithMenu : public BSlowMenu { public: - OpenWithMenu(const char *label, const BMessage *entriesToOpen, - BWindow *parentWindow, BHandler *target); - OpenWithMenu(const char *label, const BMessage *entriesToOpen, - BWindow *parentWindow, const BMessenger &target); + OpenWithMenu(const char* label, const BMessage* entriesToOpen, + BWindow* parentWindow, BHandler* target); + OpenWithMenu(const char* label, const BMessage* entriesToOpen, + BWindow* parentWindow, const BMessenger &target); private: - friend int SortByRelationAndName(const RelationCachingModelProxy *, - const RelationCachingModelProxy *, void *); + friend int SortByRelationAndName(const RelationCachingModelProxy*, + const RelationCachingModelProxy*, void*); virtual bool StartBuildingItemList(); virtual bool AddNextItem(); @@ -277,29 +284,30 @@ class OpenWithMenu : public BSlowMenu { virtual void ClearMenuBuildingState(); BMessage fEntriesToOpen; - BHandler *target; + BHandler* target; BMessenger fMessenger; // menu building state - SearchForSignatureEntryList *fIterator; + SearchForSignatureEntryList* fIterator; entry_ref fPreferredRef; - BObjectList *fSupportingAppList; + BObjectList* fSupportingAppList; bool fHaveCommonPreferredApp; - BWindow *fParentWindow; + BWindow* fParentWindow; typedef BSlowMenu _inherited; }; + // used for optionally showing the list of all apps. Do nothing // until asked to iterate and only if supposed to do so class ConditionalAllAppsIterator : public EntryListBase { public: - ConditionalAllAppsIterator(SearchForSignatureEntryList *parent); + ConditionalAllAppsIterator(SearchForSignatureEntryList* parent); ~ConditionalAllAppsIterator(); - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false); + virtual status_t GetNextRef(entry_ref* ref); + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX); virtual status_t Rewind(); @@ -310,8 +318,8 @@ class ConditionalAllAppsIterator : public EntryListBase { void Instantiate(); private: - SearchForSignatureEntryList *fParent; - BTrackerPrivate::TWalker *fWalker; + SearchForSignatureEntryList* fParent; + BTrackerPrivate::TWalker* fWalker; }; } // namespace BPrivate diff --git a/src/kits/tracker/OverrideAlert.cpp b/src/kits/tracker/OverrideAlert.cpp index 0e2de3d19f..8431b3bc1f 100644 --- a/src/kits/tracker/OverrideAlert.cpp +++ b/src/kits/tracker/OverrideAlert.cpp @@ -34,15 +34,17 @@ All rights reserved. // defines the status area drawn in the bottom left corner of a Tracker window + #include #include #include "OverrideAlert.h" -OverrideAlert::OverrideAlert(const char *title, const char *text, - const char *button1, uint32 modifiers1, - const char *button2, uint32 modifiers2, - const char *button3, uint32 modifiers3, + +OverrideAlert::OverrideAlert(const char* title, const char* text, + const char* button1, uint32 modifiers1, + const char* button2, uint32 modifiers2, + const char* button3, uint32 modifiers3, button_width width, alert_type type) : BAlert(title, text, button1, button2, button3, width, type), fCurModifiers(0) @@ -56,10 +58,11 @@ OverrideAlert::OverrideAlert(const char *title, const char *text, MoveTo(where.x, where.y); } -OverrideAlert::OverrideAlert(const char *title, const char *text, - const char *button1, uint32 modifiers1, - const char *button2, uint32 modifiers2, - const char *button3, uint32 modifiers3, + +OverrideAlert::OverrideAlert(const char* title, const char* text, + const char* button1, uint32 modifiers1, + const char* button2, uint32 modifiers2, + const char* button3, uint32 modifiers3, button_width width, button_spacing spacing, alert_type type) : BAlert(title, text, button1, button2, button3, width, spacing, type), fCurModifiers(0) @@ -73,30 +76,33 @@ OverrideAlert::OverrideAlert(const char *title, const char *text, MoveTo(where.x, where.y); } + OverrideAlert::~OverrideAlert() { } + void -OverrideAlert::DispatchMessage(BMessage *message, BHandler *handler) +OverrideAlert::DispatchMessage(BMessage* message, BHandler* handler) { if (message->what == B_KEY_DOWN || message->what == B_KEY_UP || message->what == B_UNMAPPED_KEY_DOWN || message->what == B_UNMAPPED_KEY_UP) { uint32 modifiers; - if (message->FindInt32("modifiers", (int32 *)&modifiers) == B_OK) + if (message->FindInt32("modifiers", (int32*)&modifiers) == B_OK) UpdateButtons(modifiers); } BAlert::DispatchMessage(message, handler); } + BPoint OverrideAlert::OverPosition(float width, float height) { // This positions the alert window like a normal alert, put // places it on top of the calling window if possible. - BWindow *window = dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); + BWindow* window = dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); BRect screenFrame; BRect desirableRect; screenFrame = BScreen(window).Frame(); @@ -133,6 +139,7 @@ OverrideAlert::OverPosition(float width, float height) return desirableRect.LeftTop(); } + void OverrideAlert::UpdateButtons(uint32 modifiers, bool force) { @@ -141,7 +148,7 @@ OverrideAlert::UpdateButtons(uint32 modifiers, bool force) fCurModifiers = modifiers; for (int32 i = 0; i < 3; i++) { - BButton *button = ButtonAt(i); + BButton* button = ButtonAt(i); if (button) button->SetEnabled(((fButtonModifiers[i] & fCurModifiers) == fButtonModifiers[i])); } diff --git a/src/kits/tracker/OverrideAlert.h b/src/kits/tracker/OverrideAlert.h index 5109d5474b..6c2ae5d7e5 100644 --- a/src/kits/tracker/OverrideAlert.h +++ b/src/kits/tracker/OverrideAlert.h @@ -31,7 +31,6 @@ 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. */ - #ifndef _OVERRIDE_ALERT_H #define _OVERRIDE_ALERT_H @@ -45,33 +44,35 @@ All rights reserved. // This allows it to work when confirming rename operations with // Focus Follows Mouse turned on. + #include + namespace BPrivate { class OverrideAlert : public BAlert { public: - OverrideAlert(const char *title, const char *text, - const char *button1, uint32 modifiers1, - const char *button2, uint32 modifiers2, - const char *button3, uint32 modifiers3, + OverrideAlert(const char* title, const char* text, + const char* button1, uint32 modifiers1, + const char* button2, uint32 modifiers2, + const char* button3, uint32 modifiers3, button_width width = B_WIDTH_AS_USUAL, alert_type type = B_INFO_ALERT); - OverrideAlert(const char *title, const char *text, - const char *button1, uint32 modifiers1, - const char *button2, uint32 modifiers2, - const char *button3, uint32 modifiers3, + OverrideAlert(const char* title, const char* text, + const char* button1, uint32 modifiers1, + const char* button2, uint32 modifiers2, + const char* button3, uint32 modifiers3, button_width width, button_spacing spacing, alert_type type = B_INFO_ALERT); virtual ~OverrideAlert(); - virtual void DispatchMessage(BMessage *, BHandler *); + virtual void DispatchMessage(BMessage*, BHandler*); static BPoint OverPosition(float width, float height); private: void UpdateButtons(uint32 modifiers, bool force = false); - + uint32 fCurModifiers; uint32 fButtonModifiers[3]; }; @@ -80,4 +81,4 @@ private: using namespace BPrivate; -#endif +#endif // _OVERRIDE_ALERT_H diff --git a/src/kits/tracker/PendingNodeMonitorCache.cpp b/src/kits/tracker/PendingNodeMonitorCache.cpp index 4586323ec3..a3005c15d0 100644 --- a/src/kits/tracker/PendingNodeMonitorCache.cpp +++ b/src/kits/tracker/PendingNodeMonitorCache.cpp @@ -32,33 +32,39 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "PendingNodeMonitorCache.h" #include "PoseView.h" + const bigtime_t kDelayedNodeMonitorLifetime = 10000000; // after this much the pending node monitor gets discarded as // too old -PendingNodeMonitorEntry::PendingNodeMonitorEntry(const node_ref *node, - const BMessage *nodeMonitor) + +PendingNodeMonitorEntry::PendingNodeMonitorEntry(const node_ref* node, + const BMessage* nodeMonitor) : fExpiresAfter(system_time() + kDelayedNodeMonitorLifetime), fNodeMonitor(*nodeMonitor), fNode(*node) { } -const BMessage * + +const BMessage* PendingNodeMonitorEntry::NodeMonitor() const { return &fNodeMonitor; } + bool -PendingNodeMonitorEntry::Match(const node_ref *node) const +PendingNodeMonitorEntry::Match(const node_ref* node) const { return fNode == *node; } + bool PendingNodeMonitorEntry::TooOld(bigtime_t now) const { @@ -76,8 +82,9 @@ PendingNodeMonitorCache::~PendingNodeMonitorCache() { } + void -PendingNodeMonitorCache::Add(const BMessage *message) +PendingNodeMonitorCache::Add(const BMessage* message) { #if xDEBUG PRINT(("adding pending node monitor\n")); @@ -85,14 +92,15 @@ PendingNodeMonitorCache::Add(const BMessage *message) #endif node_ref node; if (message->FindInt32("device", &node.device) != B_OK - || message->FindInt64("node", (int64 *)&node.node) != B_OK) + || message->FindInt64("node", (int64*)&node.node) != B_OK) return; fList.AddItem(new PendingNodeMonitorEntry(&node, message)); } + void -PendingNodeMonitorCache::RemoveEntries(const node_ref *nodeRef) +PendingNodeMonitorCache::RemoveEntries(const node_ref* nodeRef) { int32 count = fList.CountItems(); for (int32 index = count - 1; index >= 0; index--) @@ -100,6 +108,7 @@ PendingNodeMonitorCache::RemoveEntries(const node_ref *nodeRef) delete fList.RemoveItemAt(index); } + void PendingNodeMonitorCache::RemoveOldEntries() { @@ -112,12 +121,14 @@ PendingNodeMonitorCache::RemoveOldEntries() } } + void -PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView *poseView, const BPose *pose) +PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView* poseView, + const BPose* pose) { bigtime_t now = system_time(); for (int32 index = 0; index < fList.CountItems();) { - PendingNodeMonitorEntry *item = fList.ItemAt(index); + PendingNodeMonitorEntry* item = fList.ItemAt(index); if (item->TooOld(now)) { PRINT(("removing old entry from pending node monitor cache\n")); delete fList.RemoveItemAt(index); @@ -136,4 +147,3 @@ PendingNodeMonitorCache::PoseCreatedOrMoved(BPoseView *poseView, const BPose *po index++; } } - diff --git a/src/kits/tracker/PendingNodeMonitorCache.h b/src/kits/tracker/PendingNodeMonitorCache.h index 3d56c28c43..68d598e150 100644 --- a/src/kits/tracker/PendingNodeMonitorCache.h +++ b/src/kits/tracker/PendingNodeMonitorCache.h @@ -39,15 +39,16 @@ All rights reserved. // The respective node montior messages are stored in a list and applied // later, when their target shows up. They get nuked when they become too // old. - #ifndef __PENDING_NODEMONITOR_CACHE_H__ #define __PENDING_NODEMONITOR_CACHE_H__ + #include #include #include "ObjectList.h" + namespace BPrivate { class BPoseView; @@ -55,27 +56,28 @@ class BPose; class PendingNodeMonitorEntry { public: - PendingNodeMonitorEntry(const node_ref *node, const BMessage *); - const BMessage *NodeMonitor() const; - bool Match(const node_ref *) const; + PendingNodeMonitorEntry(const node_ref* node, const BMessage*); + const BMessage* NodeMonitor() const; + bool Match(const node_ref*) const; bool TooOld(bigtime_t now) const; - + private: bigtime_t fExpiresAfter; BMessage fNodeMonitor; node_ref fNode; }; + class PendingNodeMonitorCache { public: PendingNodeMonitorCache(); ~PendingNodeMonitorCache(); - void Add(const BMessage *); - void RemoveEntries(const node_ref *); + void Add(const BMessage*); + void RemoveEntries(const node_ref*); void RemoveOldEntries(); - void PoseCreatedOrMoved(BPoseView *, const BPose *); + void PoseCreatedOrMoved(BPoseView*, const BPose*); private: BObjectList fList; @@ -85,5 +87,4 @@ private: using namespace BPrivate; -#endif - +#endif // __PENDING_NODEMONITOR_CACHE_H__ diff --git a/src/kits/tracker/Pose.cpp b/src/kits/tracker/Pose.cpp index 45230b410d..f35bd15607 100644 --- a/src/kits/tracker/Pose.cpp +++ b/src/kits/tracker/Pose.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include @@ -49,7 +50,7 @@ All rights reserved. int32 -CalcFreeSpace(BVolume *volume) +CalcFreeSpace(BVolume* volume) { off_t capacity = volume->Capacity(); if (capacity == 0) @@ -68,8 +69,7 @@ CalcFreeSpace(BVolume *volume) // symlink pose uses the resolved model to retrieve the icon, if not broken // everything else, like the attributes, etc. is retrieved directly from the // symlink itself - -BPose::BPose(Model *model, BPoseView *view, uint32 clipboardMode, bool selected) +BPose::BPose(Model* model, BPoseView* view, uint32 clipboardMode, bool selected) : fModel(model), fWidgetList(4, true), fClipboardMode(clipboardMode), @@ -88,13 +88,13 @@ BPose::BPose(Model *model, BPoseView *view, uint32 clipboardMode, bool selected) if (model->IsVolume()) { fs_info info; dev_t device = model->NodeRef()->device; - BVolume *volume = new BVolume(device); + BVolume* volume = new BVolume(device); if (volume->InitCheck() == B_OK && fs_stat_dev(device, &info) == B_OK) { // Philosophy here: // Bars go on all read/write volumes // Exceptions: Not on CDDA - if (strcmp(info.fsh_name,"cdda") != 0 + if (strcmp(info.fsh_name,"cdda") != 0 && !volume->IsReadOnly()) { // The volume is ok and we want space bars on it gPeriodicUpdatePoses.AddPose(this, view, @@ -113,8 +113,8 @@ BPose::~BPose() { if (fModel->IsVolume()) { // we might be registered for periodic updates - BVolume *volume = NULL; - if (gPeriodicUpdatePoses.RemovePose(this, (void **)&volume)) + BVolume* volume = NULL; + if (gPeriodicUpdatePoses.RemovePose(this, (void**)&volume)) delete volume; } @@ -123,10 +123,10 @@ BPose::~BPose() void -BPose::CreateWidgets(BPoseView *poseView) +BPose::CreateWidgets(BPoseView* poseView) { for (int32 index = 0; ; index++) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; fWidgetList.AddItem(new BTextWidget(fModel, column, poseView)); @@ -134,48 +134,48 @@ BPose::CreateWidgets(BPoseView *poseView) } -BTextWidget * -BPose::AddWidget(BPoseView *poseView, BColumn *column) +BTextWidget* +BPose::AddWidget(BPoseView* poseView, BColumn* column) { BModelOpener opener(fModel); if (fModel->InitCheck() != B_OK) return NULL; - BTextWidget *widget = new BTextWidget(fModel, column, poseView); + BTextWidget* widget = new BTextWidget(fModel, column, poseView); fWidgetList.AddItem(widget); return widget; } -BTextWidget * -BPose::AddWidget(BPoseView *poseView, BColumn *column, ModelNodeLazyOpener &opener) +BTextWidget* +BPose::AddWidget(BPoseView* poseView, BColumn* column, ModelNodeLazyOpener &opener) { opener.OpenNode(); if (fModel->InitCheck() != B_OK) return NULL; - BTextWidget *widget = new BTextWidget(fModel, column, poseView); + BTextWidget* widget = new BTextWidget(fModel, column, poseView); fWidgetList.AddItem(widget); return widget; } void -BPose::RemoveWidget(BPoseView *, BColumn *column) +BPose::RemoveWidget(BPoseView*, BColumn* column) { int32 index; - BTextWidget *widget = WidgetFor(column->AttrHash(), &index); - if (widget) + BTextWidget* widget = WidgetFor(column->AttrHash(), &index); + if (widget) delete fWidgetList.RemoveItemAt(index); } void -BPose::Commit(bool saveChanges, BPoint loc, BPoseView *poseView, int32 poseIndex) +BPose::Commit(bool saveChanges, BPoint loc, BPoseView* poseView, int32 poseIndex) { int32 count = fWidgetList.CountItems(); for (int32 index = 0; index < count; index++) { - BTextWidget *widget = fWidgetList.ItemAt(index); + BTextWidget* widget = fWidgetList.ItemAt(index); if (widget->IsActive()) { widget->StopEdit(saveChanges, loc, poseView, this, poseIndex); break; @@ -185,7 +185,7 @@ BPose::Commit(bool saveChanges, BPoint loc, BPoseView *poseView, int32 poseIndex inline bool -OneMouseUp(BTextWidget *widget, BPose *pose, BPoseView *poseView, BColumn *column, +OneMouseUp(BTextWidget* widget, BPose* pose, BPoseView* poseView, BColumn* column, BPoint poseLoc, BPoint where) { BRect rect; @@ -203,22 +203,22 @@ OneMouseUp(BTextWidget *widget, BPose *pose, BPoseView *poseView, BColumn *colum void -BPose::MouseUp(BPoint poseLoc, BPoseView *poseView, BPoint where, int32) +BPose::MouseUp(BPoint poseLoc, BPoseView* poseView, BPoint where, int32) { WhileEachTextWidget(this, poseView, OneMouseUp, poseLoc, where); } inline void -OneCheckAndUpdate(BTextWidget *widget, BPose *, BPoseView *poseView, - BColumn *column, BPoint poseLoc) +OneCheckAndUpdate(BTextWidget* widget, BPose*, BPoseView* poseView, + BColumn* column, BPoint poseLoc) { widget->CheckAndUpdate(poseLoc, column, poseView, true); } void -BPose::UpdateAllWidgets(int32, BPoint poseLoc, BPoseView *poseView) +BPose::UpdateAllWidgets(int32, BPoint poseLoc, BPoseView* poseView) { if (poseView->ViewMode() != kListMode) poseLoc = Location(poseView); @@ -229,8 +229,8 @@ BPose::UpdateAllWidgets(int32, BPoint poseLoc, BPoseView *poseView) void -BPose::UpdateWidgetAndModel(Model *resolvedModel, const char *attrName, - uint32 attrType, int32, BPoint poseLoc, BPoseView *poseView, bool visible) +BPose::UpdateWidgetAndModel(Model* resolvedModel, const char* attrName, + uint32 attrType, int32, BPoint poseLoc, BPoseView* poseView, bool visible) { if (poseView->ViewMode() != kListMode) poseLoc = Location(poseView); @@ -245,18 +245,18 @@ BPose::UpdateWidgetAndModel(Model *resolvedModel, const char *attrName, // ToDo: the following code is wrong, because this sort of hashing // may overlap and we get aliasing uint32 attrHash = AttrHashString(attrName, attrType); - BTextWidget *widget = WidgetFor(attrHash); + BTextWidget* widget = WidgetFor(attrHash); if (widget) { - BColumn *column = poseView->ColumnFor(attrHash); - if (column) + BColumn* column = poseView->ColumnFor(attrHash); + if (column) widget->CheckAndUpdate(poseLoc, column, poseView, visible); } else if (attrType == 0) { // attribute got likely removed, so let's search the // column for the matching attribute name int32 count = fWidgetList.CountItems(); for (int32 i = 0; i < count; i++) { - BTextWidget *widget = fWidgetList.ItemAt(i); - BColumn *column = poseView->ColumnFor(widget->AttrHash()); + BTextWidget* widget = fWidgetList.ItemAt(i); + BColumn* column = poseView->ColumnFor(widget->AttrHash()); if (column != NULL && !strcmp(column->AttrName(), attrName)) { widget->CheckAndUpdate(poseLoc, column, poseView, visible); break; @@ -277,13 +277,13 @@ BPose::UpdateWidgetAndModel(Model *resolvedModel, const char *attrName, // distribute stat changes for (int32 index = 0; ; index++) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; if (column->StatField()) { - BTextWidget *widget = WidgetFor(column->AttrHash()); - if (widget) + BTextWidget* widget = WidgetFor(column->AttrHash()); + if (widget) widget->CheckAndUpdate(poseLoc, column, poseView, visible); } } @@ -292,14 +292,14 @@ BPose::UpdateWidgetAndModel(Model *resolvedModel, const char *attrName, bool -BPose::_PeriodicUpdateCallback(BPose *pose, void *cookie) +BPose::_PeriodicUpdateCallback(BPose* pose, void* cookie) { - return pose->UpdateVolumeSpaceBar((BVolume *)cookie); + return pose->UpdateVolumeSpaceBar((BVolume*)cookie); } bool -BPose::UpdateVolumeSpaceBar(BVolume *volume) +BPose::UpdateVolumeSpaceBar(BVolume* volume) { bool enabled = TrackerSettings().ShowVolumeSpaceBar(); if (!enabled) { @@ -319,12 +319,12 @@ BPose::UpdateVolumeSpaceBar(BVolume *volume) return true; } - return false; + return false; } void -BPose::UpdateIcon(BPoint poseLoc, BPoseView *poseView) +BPose::UpdateIcon(BPoint poseLoc, BPoseView* poseView) { IconCache::sIconCache->IconChanged(ResolvedModel()); @@ -348,8 +348,8 @@ BPose::UpdateIcon(BPoint poseLoc, BPoseView *poseView) } -void -BPose::UpdateBrokenSymLink(BPoint poseLoc, BPoseView *poseView) +void +BPose::UpdateBrokenSymLink(BPoint poseLoc, BPoseView* poseView) { ASSERT(TargetModel()->IsSymLink()); ASSERT(!TargetModel()->LinkTo()); @@ -357,8 +357,8 @@ BPose::UpdateBrokenSymLink(BPoint poseLoc, BPoseView *poseView) } -void -BPose::UpdateWasBrokenSymlink(BPoint poseLoc, BPoseView *poseView) +void +BPose::UpdateWasBrokenSymlink(BPoint poseLoc, BPoseView* poseView) { if (!fModel->IsSymLink()) return; @@ -376,12 +376,12 @@ BPose::UpdateWasBrokenSymlink(BPoint poseLoc, BPoseView *poseView) void -BPose::EditFirstWidget(BPoint poseLoc, BPoseView *poseView) +BPose::EditFirstWidget(BPoint poseLoc, BPoseView* poseView) { // find first editable widget - BColumn *column; + BColumn* column; for (int32 i = 0;(column = poseView->ColumnAt(i)) != NULL;i++) { - BTextWidget *widget = WidgetFor(column->AttrHash()); + BTextWidget* widget = WidgetFor(column->AttrHash()); if (widget && widget->IsEditable()) { BRect bounds; @@ -399,16 +399,16 @@ BPose::EditFirstWidget(BPoint poseLoc, BPoseView *poseView) void -BPose::EditPreviousNextWidgetCommon(BPoseView *poseView, bool next) +BPose::EditPreviousNextWidgetCommon(BPoseView* poseView, bool next) { bool found = false; int32 delta = next ? 1 : -1; for (int32 index = next ? 0 : poseView->CountColumns() - 1; ; index += delta) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; - BTextWidget *widget = WidgetFor(column->AttrHash()); + BTextWidget* widget = WidgetFor(column->AttrHash()); if (widget && widget->IsActive()) { poseView->CommitActivePose(); found = true; @@ -419,7 +419,7 @@ BPose::EditPreviousNextWidgetCommon(BPoseView *poseView, bool next) BRect bounds; if (poseView->ViewMode() == kListMode) { int32 poseIndex = poseView->IndexOfPose(this); - BPoint poseLoc(0, poseIndex * poseView->ListElemHeight()); + BPoint poseLoc(0, poseIndex* poseView->ListElemHeight()); bounds = widget->CalcRect(poseLoc, column, poseView); } else bounds = widget->CalcRect(Location(poseView), 0, poseView); @@ -432,21 +432,21 @@ BPose::EditPreviousNextWidgetCommon(BPoseView *poseView, bool next) void -BPose::EditNextWidget(BPoseView *poseView) +BPose::EditNextWidget(BPoseView* poseView) { EditPreviousNextWidgetCommon(poseView, true); } void -BPose::EditPreviousWidget(BPoseView *poseView) +BPose::EditPreviousWidget(BPoseView* poseView) { EditPreviousNextWidgetCommon(poseView, false); } bool -BPose::PointInPose(const BPoseView *poseView, BPoint where) const +BPose::PointInPose(const BPoseView* poseView, BPoint where) const { ASSERT(poseView->ViewMode() != kListMode); @@ -464,11 +464,11 @@ BPose::PointInPose(const BPoseView *poseView, BPoint where) const kNormalIcon, poseView->IconSize()); - BTextWidget *widget = WidgetFor(poseView->FirstColumn()->AttrHash()); + BTextWidget* widget = WidgetFor(poseView->FirstColumn()->AttrHash()); if (widget) { float textWidth = ceilf(widget->TextWidth(poseView) + 1); rect.left += (poseView->IconSizeInt() - textWidth) / 2; - rect.right = rect.left + textWidth; + rect.right = rect.left + textWidth; } rect.top = location.y + poseView->IconSizeInt(); @@ -481,7 +481,7 @@ BPose::PointInPose(const BPoseView *poseView, BPoint where) const BRect rect(location, location); rect.right += B_MINI_ICON + kMiniIconSeparator; rect.bottom += poseView->IconPoseHeight(); - BTextWidget *widget = WidgetFor(poseView->FirstColumn()->AttrHash()); + BTextWidget* widget = WidgetFor(poseView->FirstColumn()->AttrHash()); if (widget) rect.right += ceil(widget->TextWidth(poseView) + 1); @@ -490,8 +490,8 @@ BPose::PointInPose(const BPoseView *poseView, BPoint where) const bool -BPose::PointInPose(BPoint loc, const BPoseView *poseView, BPoint where, - BTextWidget **hitWidget) const +BPose::PointInPose(BPoint loc, const BPoseView* poseView, BPoint where, + BTextWidget** hitWidget) const { if (hitWidget) *hitWidget = NULL; @@ -506,10 +506,10 @@ BPose::PointInPose(BPoint loc, const BPoseView *poseView, BPoint where, return true; for (int32 index = 0; ; index++) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; - BTextWidget *widget = WidgetFor(column->AttrHash()); + BTextWidget* widget = WidgetFor(column->AttrHash()); if (widget && widget->CalcClickRect(loc, column, poseView).Contains(where)) { if (hitWidget) *hitWidget = widget; @@ -522,7 +522,7 @@ BPose::PointInPose(BPoint loc, const BPoseView *poseView, BPoint where, void -BPose::Draw(BRect rect, const BRect& updateRect, BPoseView *poseView, BView *drawView, +BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView, BView* drawView, bool fullDraw, BPoint offset, bool selected) { // If the background wasn't cleared and Draw() is not called after @@ -559,12 +559,12 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView *poseView, BView *dra columnsToDraw = poseView->CountColumns(); for (int32 index = 0; index < columnsToDraw; index++) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; // if widget doesn't exist, create it - BTextWidget *widget = WidgetFor(column, poseView, modelOpener); + BTextWidget* widget = WidgetFor(column, poseView, modelOpener); if (widget && widget->IsVisible()) { BRect widgetRect(widget->ColumnRect(rect.LeftTop(), column, @@ -618,11 +618,11 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView *poseView, BView *dra DrawIcon(iconOrigin, drawView, poseView->IconSize(), directDraw, !windowActive && !showSelectionWhenInactive); - BColumn *column = poseView->FirstColumn(); + BColumn* column = poseView->FirstColumn(); if (!column) return; - BTextWidget *widget = WidgetFor(column, poseView, modelOpener); + BTextWidget* widget = WidgetFor(column, poseView, modelOpener); if (!widget || !widget->IsVisible()) return; @@ -659,7 +659,7 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView *poseView, BView *dra void -BPose::DeselectWithoutErasingBackground(BRect, BPoseView *poseView) +BPose::DeselectWithoutErasingBackground(BRect, BPoseView* poseView) { ASSERT(poseView->ViewMode() != kListMode); ASSERT(!IsSelected()); @@ -672,11 +672,11 @@ BPose::DeselectWithoutErasingBackground(BRect, BPoseView *poseView) else UpdateIcon(location, poseView); - BColumn *column = poseView->FirstColumn(); + BColumn* column = poseView->FirstColumn(); if (!column) return; - BTextWidget *widget = WidgetFor(column->AttrHash()); + BTextWidget* widget = WidgetFor(column->AttrHash()); if (!widget || !widget->IsVisible()) return; @@ -686,7 +686,7 @@ BPose::DeselectWithoutErasingBackground(BRect, BPoseView *poseView) void -BPose::MoveTo(BPoint point, BPoseView *poseView, bool inval) +BPose::MoveTo(BPoint point, BPoseView* poseView, bool inval) { point.x = floorf(point.x); point.y = floorf(point.y); @@ -704,7 +704,7 @@ BPose::MoveTo(BPoint point, BPoseView *poseView, bool inval) // might need to move a text view if we're active if (poseView->ActivePose() == this) { - BView *border_view = poseView->FindView("BorderView"); + BView* border_view = poseView->FindView("BorderView"); if (border_view) border_view->MoveBy(point.x - oldLocation.x, point.y - oldLocation.y); } @@ -726,11 +726,11 @@ BPose::MoveTo(BPoint point, BPoseView *poseView, bool inval) } -BTextWidget * +BTextWidget* BPose::ActiveWidget() const { for (int32 i = fWidgetList.CountItems(); i-- > 0;) { - BTextWidget *widget = fWidgetList.ItemAt(i); + BTextWidget* widget = fWidgetList.ItemAt(i); if (widget->IsActive()) return widget; } @@ -738,12 +738,12 @@ BPose::ActiveWidget() const } -BTextWidget * -BPose::WidgetFor(uint32 attr, int32 *index) const +BTextWidget* +BPose::WidgetFor(uint32 attr, int32* index) const { int32 count = fWidgetList.CountItems(); for (int32 i = 0; i < count; i++) { - BTextWidget *widget = fWidgetList.ItemAt(i); + BTextWidget* widget = fWidgetList.ItemAt(i); if (widget->AttrHash() == attr) { if (index) *index = i; @@ -755,11 +755,11 @@ BPose::WidgetFor(uint32 attr, int32 *index) const } -BTextWidget * -BPose::WidgetFor(BColumn *column, BPoseView *poseView, ModelNodeLazyOpener &opener, - int32 *index) +BTextWidget* +BPose::WidgetFor(BColumn* column, BPoseView* poseView, ModelNodeLazyOpener &opener, + int32* index) { - BTextWidget *widget = WidgetFor(column->AttrHash(), index); + BTextWidget* widget = WidgetFor(column->AttrHash(), index); if (!widget) widget = AddWidget(poseView, column, opener); @@ -767,18 +767,17 @@ BPose::WidgetFor(BColumn *column, BPoseView *poseView, ModelNodeLazyOpener &open } -/* deprecated */ +// the following method is deprecated bool BPose::TestLargeIconPixel(BPoint point) const { return IconCache::sIconCache->IconHitTest(point, ResolvedModel(), kNormalIcon, B_LARGE_ICON); } -/* deprecated */ void -BPose::DrawIcon(BPoint where, BView *view, icon_size kind, bool direct, bool drawUnselected) +BPose::DrawIcon(BPoint where, BView* view, icon_size kind, bool direct, bool drawUnselected) { if (fClipboardMode == kMoveSelectionTo) { view->SetDrawingMode(B_OP_ALPHA); @@ -795,8 +794,8 @@ BPose::DrawIcon(BPoint where, BView *view, icon_size kind, bool direct, bool dra } -void -BPose::DrawBar(BPoint where,BView *view,icon_size kind) +void +BPose::DrawBar(BPoint where,BView* view,icon_size kind) { view->PushState(); @@ -813,7 +812,7 @@ BPose::DrawBar(BPoint where,BView *view,icon_size kind) barHeight = size - 4 - 2 * yOffset; } - // the black shadowed line + // the black shadowed line view->SetHighColor(32, 32, 32, 92); view->MovePenTo(BPoint(where.x + size, where.y + 1 + yOffset)); view->StrokeLine(BPoint(where.x + size, where.y + size - yOffset)); @@ -855,14 +854,14 @@ BPose::DrawBar(BPoint where,BView *view,icon_size kind) void -BPose::DrawToggleSwitch(BRect, BPoseView *) +BPose::DrawToggleSwitch(BRect, BPoseView*) { return; } BPoint -BPose::Location(const BPoseView *poseView) const +BPose::Location(const BPoseView* poseView) const { float scale = 1.0; if (poseView->ViewMode() == kIconMode) @@ -873,7 +872,7 @@ BPose::Location(const BPoseView *poseView) const void -BPose::SetLocation(BPoint point, const BPoseView *poseView) +BPose::SetLocation(BPoint point, const BPoseView* poseView) { float scale = 1.0; if (poseView->ViewMode() == kIconMode) @@ -887,11 +886,11 @@ debugger("BPose::SetLocation() - infinite location"); BRect -BPose::CalcRect(BPoint loc, const BPoseView *poseView, bool minimalRect) const +BPose::CalcRect(BPoint loc, const BPoseView* poseView, bool minimalRect) const { ASSERT(poseView->ViewMode() == kListMode); - BColumn *column = poseView->LastColumn(); + BColumn* column = poseView->LastColumn(); BRect rect; rect.left = loc.x; rect.top = loc.y; @@ -899,8 +898,8 @@ BPose::CalcRect(BPoint loc, const BPoseView *poseView, bool minimalRect) const rect.bottom = rect.top + poseView->ListElemHeight(); if (minimalRect) { - BTextWidget *widget = WidgetFor(poseView->FirstColumn()->AttrHash()); - if (widget) + BTextWidget* widget = WidgetFor(poseView->FirstColumn()->AttrHash()); + if (widget) rect.right = widget->CalcRect(loc, poseView->FirstColumn(), poseView).right; } @@ -909,7 +908,7 @@ BPose::CalcRect(BPoint loc, const BPoseView *poseView, bool minimalRect) const BRect -BPose::CalcRect(const BPoseView *poseView) const +BPose::CalcRect(const BPoseView* poseView) const { ASSERT(poseView->ViewMode() != kListMode); @@ -919,12 +918,12 @@ BPose::CalcRect(const BPoseView *poseView) const rect.left = location.x; rect.right = rect.left + poseView->IconSizeInt(); - BTextWidget *widget = WidgetFor(poseView->FirstColumn()->AttrHash()); + BTextWidget* widget = WidgetFor(poseView->FirstColumn()->AttrHash()); if (widget) { float textWidth = ceilf(widget->TextWidth(poseView) + 1); if (textWidth > poseView->IconSizeInt()) { rect.left += (poseView->IconSizeInt() - textWidth) / 2; - rect.right = rect.left + textWidth; + rect.right = rect.left + textWidth; } } @@ -936,7 +935,7 @@ BPose::CalcRect(const BPoseView *poseView) const rect.top = location.y; rect.right = rect.left + B_MINI_ICON + kMiniIconSeparator; rect.bottom = rect.top + poseView->IconPoseHeight(); - BTextWidget *widget = WidgetFor(poseView->FirstColumn()->AttrHash()); + BTextWidget* widget = WidgetFor(poseView->FirstColumn()->AttrHash()); if (widget) rect.right += ceil(widget->TextWidth(poseView) + 1); } diff --git a/src/kits/tracker/Pose.h b/src/kits/tracker/Pose.h index d9957062b5..d03a6ef5d0 100644 --- a/src/kits/tracker/Pose.h +++ b/src/kits/tracker/Pose.h @@ -31,16 +31,17 @@ 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. */ - -#ifndef _POSE_H +#ifndef _POSE_H #define _POSE_H + #include #include "TextWidget.h" #include "Model.h" #include "Utilities.h" + namespace BPrivate { class BPoseView; @@ -54,28 +55,28 @@ enum { class BPose { public: - BPose(Model *adopt, BPoseView *, uint32 clipboardMode, bool selected = false); + BPose(Model* adopt, BPoseView*, uint32 clipboardMode, bool selected = false); virtual ~BPose(); - BTextWidget *AddWidget(BPoseView *, BColumn *); - BTextWidget *AddWidget(BPoseView *, BColumn *, ModelNodeLazyOpener &opener); - void RemoveWidget(BPoseView *, BColumn *); - void SetLocation(BPoint, const BPoseView *); - void MoveTo(BPoint, BPoseView *, bool inval = true); + BTextWidget* AddWidget(BPoseView*, BColumn*); + BTextWidget* AddWidget(BPoseView*, BColumn*, ModelNodeLazyOpener &opener); + void RemoveWidget(BPoseView*, BColumn*); + void SetLocation(BPoint, const BPoseView*); + void MoveTo(BPoint, BPoseView*, bool inval = true); - void Draw(BRect poseRect, const BRect& updateRect, BPoseView *, + void Draw(BRect poseRect, const BRect& updateRect, BPoseView*, bool fullDraw = true); - void Draw(BRect poseRect, const BRect& updateRect, BPoseView *, - BView *drawView, bool fullDraw, BPoint offset, bool selected); - void DeselectWithoutErasingBackground(BRect rect, BPoseView *poseView); + void Draw(BRect poseRect, const BRect& updateRect, BPoseView*, + BView* drawView, bool fullDraw, BPoint offset, bool selected); + void DeselectWithoutErasingBackground(BRect rect, BPoseView* poseView); // special purpose draw call for deselecting over a textured // background - void DrawBar(BPoint where,BView *view,icon_size kind); + void DrawBar(BPoint where, BView* view, icon_size kind); - void DrawIcon(BPoint, BView *, icon_size, bool direct, bool drawUnselected = false); - void DrawToggleSwitch(BRect, BPoseView *); - void MouseUp(BPoint poseLoc, BPoseView *, BPoint where, int32 index); + void DrawIcon(BPoint, BView*, icon_size, bool direct, bool drawUnselected = false); + void DrawToggleSwitch(BRect, BPoseView*); + void MouseUp(BPoint poseLoc, BPoseView*, BPoint where, int32 index); Model* TargetModel() const; Model* ResolvedModel() const; void Select(bool selected); @@ -83,35 +84,35 @@ class BPose { // Rename to IsHighlighted bigtime_t SelectionTime() const; - BTextWidget *ActiveWidget() const; - BTextWidget *WidgetFor(uint32 hashAttr, int32 *index = 0) const; - BTextWidget *WidgetFor(BColumn *column, BPoseView *poseView, ModelNodeLazyOpener &opener, - int32 *index = NULL); + BTextWidget* ActiveWidget() const; + BTextWidget* WidgetFor(uint32 hashAttr, int32* index = 0) const; + BTextWidget* WidgetFor(BColumn* column, BPoseView* poseView, + ModelNodeLazyOpener &opener, int32* index = NULL); // adds the widget if needed - bool PointInPose(BPoint poseLoc, const BPoseView *, BPoint where, - BTextWidget ** = NULL) const; - bool PointInPose(const BPoseView *, BPoint where) const ; - BRect CalcRect(BPoint loc, const BPoseView *, + bool PointInPose(BPoint poseLoc, const BPoseView*, BPoint where, + BTextWidget** = NULL) const; + bool PointInPose(const BPoseView*, BPoint where) const; + BRect CalcRect(BPoint loc, const BPoseView*, bool minimal_rect = false) const; - BRect CalcRect(const BPoseView *) const; - void UpdateAllWidgets(int32 poseIndex, BPoint poseLoc, BPoseView *); - void UpdateWidgetAndModel(Model *resolvedModel, const char *attrName, + BRect CalcRect(const BPoseView*) const; + void UpdateAllWidgets(int32 poseIndex, BPoint poseLoc, BPoseView*); + void UpdateWidgetAndModel(Model* resolvedModel, const char* attrName, uint32 attrType, int32 poseIndex, BPoint poseLoc, - BPoseView *view, bool visible); - bool UpdateVolumeSpaceBar(BVolume *volume); - void UpdateIcon(BPoint poseLoc, BPoseView *); + BPoseView* view, bool visible); + bool UpdateVolumeSpaceBar(BVolume* volume); + void UpdateIcon(BPoint poseLoc, BPoseView*); - //void UpdateFixedSymlink(BPoint poseLoc, BPoseView *); - void UpdateBrokenSymLink(BPoint poseLoc, BPoseView *); - void UpdateWasBrokenSymlink(BPoint poseLoc, BPoseView *poseView); + //void UpdateFixedSymlink(BPoint poseLoc, BPoseView*); + void UpdateBrokenSymLink(BPoint poseLoc, BPoseView*); + void UpdateWasBrokenSymlink(BPoint poseLoc, BPoseView* poseView); - void Commit(bool saveChanges, BPoint loc, BPoseView *, int32 index); - void EditFirstWidget(BPoint poseLoc, BPoseView *); - void EditNextWidget(BPoseView *); - void EditPreviousWidget(BPoseView *); + void Commit(bool saveChanges, BPoint loc, BPoseView*, int32 index); + void EditFirstWidget(BPoint poseLoc, BPoseView*); + void EditNextWidget(BPoseView*); + void EditPreviousWidget(BPoseView*); - BPoint Location(const BPoseView *poseView) const; + BPoint Location(const BPoseView* poseView) const; bool DelayedEdit() const; void SetDelayedEdit(bool delay); bool ListModeInited() const; @@ -129,12 +130,12 @@ class BPose { #endif private: - static bool _PeriodicUpdateCallback(BPose *pose, void *cookie); - void EditPreviousNextWidgetCommon(BPoseView *poseView, bool next); - void CreateWidgets(BPoseView *); + static bool _PeriodicUpdateCallback(BPose* pose, void* cookie); + void EditPreviousNextWidgetCommon(BPoseView* poseView, bool next); + void CreateWidgets(BPoseView*); bool TestLargeIconPixel(BPoint) const; - Model *fModel; + Model* fModel; BObjectList fWidgetList; BPoint fLocation; @@ -152,14 +153,14 @@ class BPose { }; -inline Model * +inline Model* BPose::TargetModel() const { return fModel; } -inline Model * +inline Model* BPose::ResolvedModel() const { return fModel->IsSymLink() ? @@ -233,16 +234,16 @@ BPose::HasLocation() const inline void -BPose::Draw(BRect poseRect, const BRect& updateRect, BPoseView *view, +BPose::Draw(BRect poseRect, const BRect& updateRect, BPoseView* view, bool fullDraw) { - Draw(poseRect, updateRect, view, (BView *)view, fullDraw, BPoint(0, 0), + Draw(poseRect, updateRect, view, (BView*)view, fullDraw, BPoint(0, 0), IsSelected()); } inline uint32 -BPose::ClipboardMode() const +BPose::ClipboardMode() const { return fClipboardMode; } @@ -258,4 +259,4 @@ BPose::SetClipboardMode(uint32 clipboardMode) using namespace BPrivate; -#endif +#endif // _POSE_H diff --git a/src/kits/tracker/PoseList.cpp b/src/kits/tracker/PoseList.cpp index 987308fd7e..9d0f83e766 100644 --- a/src/kits/tracker/PoseList.cpp +++ b/src/kits/tracker/PoseList.cpp @@ -41,54 +41,60 @@ All rights reserved. #include "Pose.h" -BPose * -PoseList::FindPose(const node_ref *node, int32 *resultingIndex) const +BPose* +PoseList::FindPose(const node_ref* node, int32* resultingIndex) const { int32 count = CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = ItemAt(index); + BPose* pose = ItemAt(index); ASSERT(pose->TargetModel()); if (*pose->TargetModel()->NodeRef() == *node) { if (resultingIndex) *resultingIndex = index; + return pose; } } return NULL; } -BPose * -PoseList::FindPose(const entry_ref *entry, int32 *resultingIndex) const + +BPose* +PoseList::FindPose(const entry_ref* entry, int32* resultingIndex) const { int32 count = CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = ItemAt(index); + BPose* pose = ItemAt(index); ASSERT(pose->TargetModel()); if (*pose->TargetModel()->EntryRef() == *entry) { if (resultingIndex) *resultingIndex = index; + return pose; } } return NULL; } -BPose * -PoseList::FindPose(const Model *model, int32 *resultingIndex) const + +BPose* +PoseList::FindPose(const Model* model, int32* resultingIndex) const { return FindPose(model->NodeRef(), resultingIndex); } -BPose * -PoseList::DeepFindPose(const node_ref *node, int32 *resultingIndex) const + +BPose* +PoseList::DeepFindPose(const node_ref* node, int32* resultingIndex) const { int32 count = CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = ItemAt(index); - Model *model = pose->TargetModel(); + BPose* pose = ItemAt(index); + Model* model = pose->TargetModel(); if (*model->NodeRef() == *node) { if (resultingIndex) *resultingIndex = index; + return pose; } // if model is a symlink, try matching node with the target @@ -98,6 +104,7 @@ PoseList::DeepFindPose(const node_ref *node, int32 *resultingIndex) const if (model && *model->NodeRef() == *node) { if (resultingIndex) *resultingIndex = index; + return pose; } } diff --git a/src/kits/tracker/PoseList.h b/src/kits/tracker/PoseList.h index b16b5d89f7..4e8c287073 100644 --- a/src/kits/tracker/PoseList.h +++ b/src/kits/tracker/PoseList.h @@ -31,16 +31,18 @@ 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. */ +#ifndef _POSE_LIST_H +#define _POSE_LIST_H + // PoseList is a commonly used instance of BObjectList // Defines convenience find and iteration calls -#ifndef _POSE_LIST_H -#define _POSE_LIST_H #include "ObjectList.h" #include "Pose.h" + struct node_ref; struct entry_ref; @@ -58,50 +60,53 @@ public: : BObjectList(list) {} - BPose *FindPose(const node_ref *node, int32 *index = NULL) const; - BPose *FindPose(const entry_ref *entry, int32 *index = NULL) const; - BPose *FindPose(const Model *model, int32 *index = NULL) const; - BPose *DeepFindPose(const node_ref *node, int32 *index = NULL) const; + BPose* FindPose(const node_ref* node, int32* index = NULL) const; + BPose* FindPose(const entry_ref* entry, int32* index = NULL) const; + BPose* FindPose(const Model* model, int32* index = NULL) const; + BPose* DeepFindPose(const node_ref* node, int32* index = NULL) const; // same as FindPose, node can be a target of the actual // pose if the pose is a symlink }; // iteration glue, add permutations as needed + template void -EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, EachParam1), +EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1), EachParam1 eachParam1) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel(); if (model) (eachFunction)(pose, model, eachParam1); } } + template void -EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, int32 , +EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, int32 , EachParam1), EachParam1 eachParam1) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel(); if (model) (eachFunction)(pose, model, index, eachParam1); } } + template void -EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, EachParam1, +EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1, EachParam2), EachParam1 eachParam1, EachParam2 eachParam2) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel(); if (model) (eachFunction)(pose, model, eachParam1, eachParam2); } @@ -109,12 +114,12 @@ EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, EachPara template void -EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, int32, +EachPoseAndModel(PoseList* list, void (*eachFunction)(BPose*, Model*, int32, EachParam1, EachParam2), EachParam1 eachParam1, EachParam2 eachParam2) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel(); if (model) (eachFunction)(pose, model, index, eachParam1, eachParam2); } @@ -122,12 +127,12 @@ EachPoseAndModel(PoseList *list, void (*eachFunction)(BPose *, Model *, int32, template void -EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, EachParam1), +EachPoseAndResolvedModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1), EachParam1 eachParam1) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel()->ResolveIfLink(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel()->ResolveIfLink(); if (model) (eachFunction)(pose, model, eachParam1); } @@ -135,12 +140,12 @@ EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, template void -EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, int32 , +EachPoseAndResolvedModel(PoseList* list, void (*eachFunction)(BPose*, Model*, int32 , EachParam1), EachParam1 eachParam1) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel()->ResolveIfLink(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel()->ResolveIfLink(); if (model) (eachFunction)(pose, model, index, eachParam1); } @@ -148,12 +153,12 @@ EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, template void -EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, EachParam1, +EachPoseAndResolvedModel(PoseList* list, void (*eachFunction)(BPose*, Model*, EachParam1, EachParam2), EachParam1 eachParam1, EachParam2 eachParam2) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel()->ResolveIfLink(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel()->ResolveIfLink(); if (model) (eachFunction)(pose, model, eachParam1, eachParam2); } @@ -161,12 +166,12 @@ EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, template void -EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, int32, +EachPoseAndResolvedModel(PoseList* list, void (*eachFunction)(BPose*, Model*, int32, EachParam1, EachParam2), EachParam1 eachParam1, EachParam2 eachParam2) { for (int32 index = list->CountItems() - 1; index >= 0; index--) { - BPose *pose = list->ItemAt(index); - Model *model = pose->TargetModel()->ResolveIfLink(); + BPose* pose = list->ItemAt(index); + Model* model = pose->TargetModel()->ResolveIfLink(); if (model) (eachFunction)(pose, model, index, eachParam1, eachParam2); } @@ -176,4 +181,4 @@ EachPoseAndResolvedModel(PoseList *list, void (*eachFunction)(BPose *, Model *, using namespace BPrivate; -#endif +#endif // _POSE_LIST_H diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index cef804fb78..47d15731c6 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "PoseView.h" #include @@ -120,7 +121,7 @@ const uint32 kMsgMouseLongDown = 'Mold'; const int32 kRoomForLine = 2; namespace BPrivate { -extern bool delete_point(void *); +extern bool delete_point(void*); // TODO: exterminate this } @@ -149,13 +150,11 @@ const BPoint kTransparentDragThreshold(256, 192); // maximum size of the transparent drag bitmap, use a drag rect // if larger in any direction - struct attr_column_relation { uint32 attrHash; int32 fieldMask; }; - static struct attr_column_relation sAttrColumnMap[] = { { AttrHashString(kAttrStatModified, B_TIME_TYPE), B_STAT_MODIFICATION_TIME }, @@ -167,12 +166,11 @@ static struct attr_column_relation sAttrColumnMap[] = { B_STAT_MODE } }; - struct AddPosesResult { ~AddPosesResult(); void ReleaseModels(); - Model *fModels[kMaxAddPosesChunk]; + Model* fModels[kMaxAddPosesChunk]; PoseInfo fPoseInfos[kMaxAddPosesChunk]; int32 fCount; }; @@ -193,19 +191,19 @@ AddPosesResult::ReleaseModels(void) } -static BPose * -BSearch(PoseList *table, const BPose* key, BPoseView *view, - int (*cmp)(const BPose *, const BPose *, BPoseView *), +static BPose* +BSearch(PoseList* table, const BPose* key, BPoseView* view, + int (*cmp)(const BPose*, const BPose*, BPoseView*), bool returnClosest = true); static int -PoseCompareAddWidget(const BPose *p1, const BPose *p2, BPoseView *view); +PoseCompareAddWidget(const BPose* p1, const BPose* p2, BPoseView* view); // #pragma mark - -BPoseView::BPoseView(Model *model, BRect bounds, uint32 viewMode, uint32 resizeMask) +BPoseView::BPoseView(Model* model, BRect bounds, uint32 viewMode, uint32 resizeMask) : BView(bounds, "PoseView", resizeMask, B_WILL_DRAW | B_PULSE_NEEDED), fIsDrawingSelectionRect(false), fHScrollBar(NULL), @@ -291,7 +289,7 @@ BPoseView::~BPoseView() void -BPoseView::Init(AttributeStreamNode *node) +BPoseView::Init(AttributeStreamNode* node) { RestoreState(node); InitCommon(); @@ -309,7 +307,7 @@ BPoseView::Init(const BMessage &message) void BPoseView::InitCommon() { - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); // create title view for window BRect rect(Frame()); @@ -366,7 +364,7 @@ BPoseView::InitCommon() static int -CompareColumns(const BColumn *c1, const BColumn *c2) +CompareColumns(const BColumn* c1, const BColumn* c2) { if (c1->Offset() > c2->Offset()) return 1; @@ -378,12 +376,12 @@ CompareColumns(const BColumn *c1, const BColumn *c2) void -BPoseView::RestoreColumnState(AttributeStreamNode *node) +BPoseView::RestoreColumnState(AttributeStreamNode* node) { fColumnList->MakeEmpty(); if (node) { - const char *columnsAttr; - const char *columnsAttrForeign; + const char* columnsAttr; + const char* columnsAttrForeign; if (TargetModel() && TargetModel()->IsRoot()) { columnsAttr = kAttrDisksColumns; columnsAttrForeign = kAttrDisksColumnsForeign; @@ -393,7 +391,7 @@ BPoseView::RestoreColumnState(AttributeStreamNode *node) } bool wrongEndianness = false; - const char *name = columnsAttr; + const char* name = columnsAttr; size_t size = (size_t)node->Contains(name, B_RAW_TYPE); if (!size) { name = columnsAttrForeign; @@ -403,7 +401,7 @@ BPoseView::RestoreColumnState(AttributeStreamNode *node) if (size > 0 && size < 10000) { // check for invalid sizes here to protect against munged attributes - char *buffer = new char[size]; + char* buffer = new char[size]; off_t result = node->Read(name, 0, B_RAW_TYPE, size, buffer); if (result) { BMallocIO stream; @@ -416,7 +414,7 @@ BPoseView::RestoreColumnState(AttributeStreamNode *node) // for overlaps below. BObjectList tempSortedList; for (;;) { - BColumn *column = BColumn::InstantiateFromStream(&stream, + BColumn* column = BColumn::InstantiateFromStream(&stream, wrongEndianness); if (!column) break; @@ -445,7 +443,7 @@ BPoseView::RestoreColumnState(const BMessage &message) BObjectList tempSortedList; for (int32 index = 0; ; index++) { - BColumn *column = BColumn::InstantiateFromMessage(message, index); + BColumn* column = BColumn::InstantiateFromMessage(message, index); if (!column) break; tempSortedList.AddItem(column); @@ -465,13 +463,13 @@ BPoseView::RestoreColumnState(const BMessage &message) void -BPoseView::AddColumnList(BObjectList *list) +BPoseView::AddColumnList(BObjectList* list) { list->SortItems(&CompareColumns); float nextLeftEdge = 0; for (int32 columIndex = 0; columIndex < list->CountItems(); columIndex++) { - BColumn *column = list->ItemAt(columIndex); + BColumn* column = list->ItemAt(columIndex); // Make sure that columns don't overlap if (column->Offset() < nextLeftEdge) { @@ -490,13 +488,13 @@ BPoseView::AddColumnList(BObjectList *list) void -BPoseView::RestoreState(AttributeStreamNode *node) +BPoseView::RestoreState(AttributeStreamNode* node) { RestoreColumnState(node); if (node) { - const char *viewStateAttr; - const char *viewStateAttrForeign; + const char* viewStateAttr; + const char* viewStateAttrForeign; if (TargetModel() && TargetModel()->IsRoot()) { viewStateAttr = kAttrDisksViewState; @@ -507,7 +505,7 @@ BPoseView::RestoreState(AttributeStreamNode *node) } bool wrongEndianness = false; - const char *name = viewStateAttr; + const char* name = viewStateAttr; size_t size = (size_t)node->Contains(name, B_RAW_TYPE); if (!size) { name = viewStateAttrForeign; @@ -517,13 +515,13 @@ BPoseView::RestoreState(AttributeStreamNode *node) if (size > 0 && size < 10000) { // check for invalid sizes here to protect against munged attributes - char *buffer = new char[size]; + char* buffer = new char[size]; off_t result = node->Read(name, 0, B_RAW_TYPE, size, buffer); if (result) { BMallocIO stream; stream.WriteAt(0, buffer, size); stream.Seek(0, SEEK_SET); - BViewState *viewstate = BViewState::InstantiateFromStream(&stream, + BViewState* viewstate = BViewState::InstantiateFromStream(&stream, wrongEndianness); if (viewstate) { delete fViewState; @@ -545,7 +543,7 @@ BPoseView::RestoreState(const BMessage &message) { RestoreColumnState(message); - BViewState *viewstate = BViewState::InstantiateFromMessage(message); + BViewState* viewstate = BViewState::InstantiateFromMessage(message); if (viewstate) { delete fViewState; @@ -562,8 +560,8 @@ BPoseView::RestoreState(const BMessage &message) namespace BPrivate { bool -ClearViewOriginOne(const char *DEBUG_ONLY(name), uint32 type, off_t size, - void *viewStateArchive, void *) +ClearViewOriginOne(const char* DEBUG_ONLY(name), uint32 type, off_t size, + void* viewStateArchive, void*) { ASSERT(strcmp(name, kAttrViewState) == 0); @@ -576,7 +574,7 @@ ClearViewOriginOne(const char *DEBUG_ONLY(name), uint32 type, off_t size, BMallocIO stream; stream.WriteAt(0, viewStateArchive, (size_t)size); stream.Seek(0, SEEK_SET); - BViewState *viewstate = BViewState::InstantiateFromStream(&stream, false); + BViewState* viewstate = BViewState::InstantiateFromStream(&stream, false); if (!viewstate) return false; @@ -613,14 +611,14 @@ BPoseView::SetUpDefaultColumnsIfNeeded() } -const char * +const char* BPoseView::ViewStateAttributeName() const { return IsDesktopView() ? kAttrDesktopViewState : kAttrViewState; } -const char * +const char* BPoseView::ForeignViewStateAttributeName() const { return IsDesktopView() ? kAttrDesktopViewStateForeign @@ -629,17 +627,17 @@ BPoseView::ForeignViewStateAttributeName() const void -BPoseView::SaveColumnState(AttributeStreamNode *node) +BPoseView::SaveColumnState(AttributeStreamNode* node) { BMallocIO stream; for (int32 index = 0; ; index++) { - const BColumn *column = ColumnAt(index); + const BColumn* column = ColumnAt(index); if (!column) break; column->ArchiveToStream(&stream); } - const char *columnsAttr; - const char *columnsAttrForeign; + const char* columnsAttr; + const char* columnsAttrForeign; if (TargetModel() && TargetModel()->IsRoot()) { columnsAttr = kAttrDisksColumns; columnsAttrForeign = kAttrDisksColumnsForeign; @@ -656,7 +654,7 @@ void BPoseView::SaveColumnState(BMessage &message) const { for (int32 index = 0; ; index++) { - const BColumn *column = ColumnAt(index); + const BColumn* column = ColumnAt(index); if (!column) break; column->ArchiveToMessage(message); @@ -665,7 +663,7 @@ BPoseView::SaveColumnState(BMessage &message) const void -BPoseView::SaveState(AttributeStreamNode *node) +BPoseView::SaveState(AttributeStreamNode* node) { SaveColumnState(node); @@ -675,8 +673,8 @@ BPoseView::SaveState(AttributeStreamNode *node) stream.Seek(0, SEEK_SET); fViewState->ArchiveToStream(&stream); - const char *viewStateAttr; - const char *viewStateAttrForeign; + const char* viewStateAttr; + const char* viewStateAttrForeign; if (TargetModel() && TargetModel()->IsRoot()) { viewStateAttr = kAttrDisksViewState; viewStateAttrForeign = kAttrDisksViewStateForeign; @@ -701,7 +699,7 @@ BPoseView::SaveState(BMessage &message) const float -BPoseView::StringWidth(const char *str) const +BPoseView::StringWidth(const char* str) const { return BPrivate::gWidthBuffer->StringWidth(str, 0, (int32)strlen(str), &sCurrentFont); @@ -709,7 +707,7 @@ BPoseView::StringWidth(const char *str) const float -BPoseView::StringWidth(const char *str, int32 len) const +BPoseView::StringWidth(const char* str, int32 len) const { ASSERT(strlen(str) == (uint32)len); return BPrivate::gWidthBuffer->StringWidth(str, 0, len, &sCurrentFont); @@ -717,7 +715,7 @@ BPoseView::StringWidth(const char *str, int32 len) const void -BPoseView::SavePoseLocations(BRect *frameIfDesktop) +BPoseView::SavePoseLocations(BRect* frameIfDesktop) { PoseInfo poseInfo; @@ -743,9 +741,9 @@ BPoseView::SavePoseLocations(BRect *frameIfDesktop) int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); if (pose->NeedsSaveLocation() && pose->HasLocation()) { - Model *model = pose->TargetModel(); + Model* model = pose->TargetModel(); poseInfo.fInvisible = false; if (model->IsRoot()) @@ -755,7 +753,7 @@ BPoseView::SavePoseLocations(BRect *frameIfDesktop) poseInfo.fLocation = pose->Location(this); - ExtendedPoseInfo *extendedPoseInfo = NULL; + ExtendedPoseInfo* extendedPoseInfo = NULL; size_t extendedPoseInfoSize = 0; ModelNodeLazyOpener opener(model, true); @@ -768,7 +766,7 @@ BPoseView::SavePoseLocations(BRect *frameIfDesktop) if (!extendedPoseInfo) { // don't have one yet, allocate one size_t size = ExtendedPoseInfo::Size(1); - extendedPoseInfo = (ExtendedPoseInfo *) + extendedPoseInfo = (ExtendedPoseInfo*) new char [size]; memset(extendedPoseInfo, 0, size); @@ -785,7 +783,7 @@ BPoseView::SavePoseLocations(BRect *frameIfDesktop) } if (model->InitCheck() != B_OK) { - delete[] (char *)extendedPoseInfo; + delete[] (char*)extendedPoseInfo; continue; } @@ -797,9 +795,9 @@ BPoseView::SavePoseLocations(BRect *frameIfDesktop) if (model->IsRoot() || isTrash) { BDirectory dir; if (FSGetDeskDir(&dir) == B_OK) { - const char *poseInfoAttr = isTrash ? kAttrTrashPoseInfo + const char* poseInfoAttr = isTrash ? kAttrTrashPoseInfo : kAttrDisksPoseInfo; - const char *poseInfoAttrForeign = isTrash + const char* poseInfoAttrForeign = isTrash ? kAttrTrashPoseInfoForeign : kAttrDisksPoseInfoForeign; if (dir.WriteAttr(poseInfoAttr, B_RAW_TYPE, 0, @@ -825,7 +823,7 @@ BPoseView::SavePoseLocations(BRect *frameIfDesktop) } } - delete [] (char *)extendedPoseInfo; + delete [] (char*)extendedPoseInfo; // TODO: fix up this mess } } @@ -859,7 +857,7 @@ BPoseView::DetachedFromWindow() if (fTitleView && !fTitleView->Window()) delete fTitleView; - if (TTracker *app = dynamic_cast(be_app)) { + if (TTracker* app = dynamic_cast(be_app)) { app->Lock(); app->StopWatching(this, kShowSelectionWhenInactiveChanged); app->StopWatching(this, kTransparentSelectionChanged); @@ -879,7 +877,7 @@ BPoseView::DetachedFromWindow() void BPoseView::Pulse() { - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); if (!window) return; @@ -933,7 +931,7 @@ BPoseView::ScrollTo(BPoint point) void BPoseView::AttachedToWindow() { - fIsDesktopWindow = (dynamic_cast(Window()) != 0); + fIsDesktopWindow = (dynamic_cast(Window()) != 0); if (fIsDesktopWindow) AddFilter(new TPoseViewFilter(this)); @@ -959,7 +957,7 @@ BPoseView::AttachedToWindow() sFontHeight = sFontInfo.ascent + sFontInfo.descent + sFontInfo.leading; } - if (TTracker *app = dynamic_cast(be_app)) { + if (TTracker* app = dynamic_cast(be_app)) { app->Lock(); app->StartWatching(this, kShowSelectionWhenInactiveChanged); app->StartWatching(this, kTransparentSelectionChanged); @@ -995,7 +993,7 @@ BPoseView::SetIconPoseHeight() void -BPoseView::GetLayoutInfo(uint32 mode, BPoint *grid, BPoint *offset) const +BPoseView::GetLayoutInfo(uint32 mode, BPoint* grid, BPoint* offset) const { switch (mode) { case kMiniIconMode: @@ -1026,7 +1024,7 @@ BPoseView::MakeFocus(bool focused) _inherited::MakeFocus(focused); if (inval) { - BackgroundView *view = dynamic_cast(Parent()); + BackgroundView* view = dynamic_cast(Parent()); if (view) view->PoseViewFocused(focused); } @@ -1048,7 +1046,7 @@ BPoseView::WindowActivated(bool activated) void -BPoseView::SetActivePose(BPose *pose) +BPoseView::SetActivePose(BPose* pose) { if (pose != ActivePose()) { CommitActivePose(); @@ -1072,8 +1070,8 @@ BPoseView::CommitActivePose(bool saveChanges) } -EntryListBase * -BPoseView::InitDirentIterator(const entry_ref *ref) +EntryListBase* +BPoseView::InitDirentIterator(const entry_ref* ref) { // set up a directory iteration Model sourceModel(ref, false, true); @@ -1083,10 +1081,10 @@ BPoseView::InitDirentIterator(const entry_ref *ref) ASSERT(!sourceModel.IsQuery()); ASSERT(sourceModel.Node()); - BDirectory *directory = dynamic_cast(sourceModel.Node()); + BDirectory* directory = dynamic_cast(sourceModel.Node()); ASSERT(directory); - EntryListBase *result = new CachedDirectoryEntryList(*directory); + EntryListBase* result = new CachedDirectoryEntryList(*directory); if (result->Rewind() != B_OK) { delete result; @@ -1113,14 +1111,14 @@ BPoseView::WatchNewNodeMask() status_t -BPoseView::WatchNewNode(const node_ref *item) +BPoseView::WatchNewNode(const node_ref* item) { return WatchNewNode(item, WatchNewNodeMask(), BMessenger(this)); } status_t -BPoseView::WatchNewNode(const node_ref *item, uint32 mask, BMessenger messenger) +BPoseView::WatchNewNode(const node_ref* item, uint32 mask, BMessenger messenger) { status_t result = TTracker::WatchNode(item, mask, messenger); @@ -1147,7 +1145,7 @@ BPoseView::IsValidAddPosesThread(thread_id currentThread) const void -BPoseView::AddPoses(Model *model) +BPoseView::AddPoses(Model* model) { // if model is zero, PoseView has other means of iterating through all // the entries that it adds @@ -1164,7 +1162,7 @@ BPoseView::AddPoses(Model *model) ShowBarberPole(); - AddPosesParams *params = new AddPosesParams(); + AddPosesParams* params = new AddPosesParams(); BMessenger tmp(this); params->target = tmp; @@ -1202,7 +1200,7 @@ class AutoLockingMessenger { ~AutoLockingMessenger() { if (hasLock) { - BLooper *looper; + BLooper* looper; messenger.Target(&looper); ASSERT(looper->IsLocked()); looper->Unlock(); @@ -1225,7 +1223,7 @@ class AutoLockingMessenger { void Unlock() { if (hasLock) { - BLooper *looper; + BLooper* looper; messenger.Target(&looper); ASSERT(looper); looper->Unlock(); @@ -1233,14 +1231,14 @@ class AutoLockingMessenger { } } - BLooper *Looper() const + BLooper* Looper() const { - BLooper *looper; + BLooper* looper; messenger.Target(&looper); return looper; } - BHandler *Handler() const + BHandler* Handler() const { ASSERT(hasLock); return messenger.Target(0); @@ -1261,12 +1259,12 @@ class failToLock { /* exception in AddPoses*/ }; status_t -BPoseView::AddPosesTask(void *castToParams) +BPoseView::AddPosesTask(void* castToParams) { // AddPosesTask reeds a bunch of models and passes them off to // the pose placing and drawing routine. // - AddPosesParams *params = (AddPosesParams *)castToParams; + AddPosesParams* params = (AddPosesParams*)castToParams; BMessenger target(params->target); entry_ref ref(params->ref); @@ -1279,23 +1277,23 @@ BPoseView::AddPosesTask(void *castToParams) thread_id threadID = find_thread(NULL); - BPoseView *view = dynamic_cast(lock.Handler()); + BPoseView* view = dynamic_cast(lock.Handler()); ASSERT(view); - // BWindow *window = dynamic_cast(lock.Looper()); - ASSERT(dynamic_cast(lock.Looper())); + // BWindow* window = dynamic_cast(lock.Looper()); + ASSERT(dynamic_cast(lock.Looper())); // allocate the iterator we will use for adding poses; this // can be a directory or any other collection of entry_refs, such // as results of a query; subclasses override this to provide // other than standard directory iterations - EntryListBase *container = view->InitDirentIterator(&ref); + EntryListBase* container = view->InitDirentIterator(&ref); if (!container) { view->HideBarberPole(); return B_ERROR; } - AddPosesResult *posesResult = new AddPosesResult; + AddPosesResult* posesResult = new AddPosesResult; posesResult->fCount = 0; int32 modelChunkIndex = 0; bigtime_t nextChunkTime = 0; @@ -1305,7 +1303,7 @@ BPoseView::AddPosesTask(void *castToParams) #if DEBUG for (int32 index = 0; index < kMaxAddPosesChunk; index++) - posesResult->fModels[index] = (Model *)0xdeadbeef; + posesResult->fModels[index] = (Model*)0xdeadbeef; #endif try { @@ -1314,8 +1312,8 @@ BPoseView::AddPosesTask(void *castToParams) status_t result = B_OK; char entBuf[1024]; - dirent *eptr = (dirent *)entBuf; - Model *model = 0; + dirent* eptr = (dirent*)entBuf; + Model* model = 0; node_ref dirNode; node_ref itemNode; @@ -1517,9 +1515,9 @@ BPoseView::RemoveRootPoses() int32 index; int32 count = fPoseList->CountItems(); for (index = 0; index < count;) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); if (pose) { - Model *model = pose->TargetModel(); + Model* model = pose->TargetModel(); if (model) { if (model->IsVolume()) { DeletePose(model->NodeRef()); @@ -1563,7 +1561,7 @@ BPoseView::AddTrashPoses() void BPoseView::AddPosesCompleted() { - BContainerWindow *containerWindow = ContainerWindow(); + BContainerWindow* containerWindow = ContainerWindow(); if (containerWindow) containerWindow->AddMimeTypesToMenu(); @@ -1587,7 +1585,7 @@ BPoseView::AddPosesCompleted() void -BPoseView::CreateVolumePose(BVolume *volume, bool watchIndividually) +BPoseView::CreateVolumePose(BVolume* volume, bool watchIndividually) { if (volume->InitCheck() != B_OK || !volume->IsPersistent()) { // We never want to create poses for those volumes; the file @@ -1610,7 +1608,7 @@ BPoseView::CreateVolumePose(BVolume *volume, bool watchIndividually) dirNode.device = ref.device; dirNode.node = ref.directory; - BPose *pose = EntryCreated(&dirNode, &itemNode, ref.name, 0); + BPose* pose = EntryCreated(&dirNode, &itemNode, ref.name, 0); if (pose && watchIndividually) { // make sure volume names still get watched, even though @@ -1633,7 +1631,7 @@ BPoseView::CreateTrashPose() if (FSGetTrashDir(&trash, volume.Device()) == B_OK && trash.GetEntry(&entry) == B_OK && entry.GetNodeRef(&ref) == B_OK) { WatchNewNode(&ref); - Model *model = new Model(&entry); + Model* model = new Model(&entry); PoseInfo info; ReadPoseInfo(model, &info); CreatePose(model, &info, false, NULL, NULL, true); @@ -1642,11 +1640,11 @@ BPoseView::CreateTrashPose() } -BPose * -BPoseView::CreatePose(Model *model, PoseInfo *poseInfo, bool insertionSort, - int32 *indexPtr, BRect *boundsPtr, bool forceDraw) +BPose* +BPoseView::CreatePose(Model* model, PoseInfo* poseInfo, bool insertionSort, + int32* indexPtr, BRect* boundsPtr, bool forceDraw) { - BPose *result; + BPose* result; CreatePoses(&model, poseInfo, 1, &result, insertionSort, indexPtr, boundsPtr, forceDraw); return result; @@ -1675,15 +1673,15 @@ BPoseView::FinishPendingScroll(float &listViewScrollBy, BRect srcRect) bool -BPoseView::AddPosesThreadValid(const entry_ref *ref) const +BPoseView::AddPosesThreadValid(const entry_ref* ref) const { return *(TargetModel()->EntryRef()) == *ref || ContainerWindow()->IsTrash(); } void -BPoseView::AddPoseToList(PoseList *list, bool visibleList, bool insertionSort, - BPose *pose, BRect &viewBounds, float &listViewScrollBy, bool forceDraw, int32 *indexPtr) +BPoseView::AddPoseToList(PoseList* list, bool visibleList, bool insertionSort, + BPose* pose, BRect &viewBounds, float &listViewScrollBy, bool forceDraw, int32* indexPtr) { int32 poseIndex = list->CountItems(); @@ -1770,9 +1768,9 @@ BPoseView::AddPoseToList(PoseList *list, bool visibleList, bool insertionSort, void -BPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, - BPose **resultingPoses, bool insertionSort, int32 *lastPoseIndexPtr, - BRect *boundsPtr, bool forceDraw) +BPoseView::CreatePoses(Model** models, PoseInfo* poseInfoArray, int32 count, + BPose** resultingPoses, bool insertionSort, int32* lastPoseIndexPtr, + BRect* boundsPtr, bool forceDraw) { // were we passed the bounds of the view? BRect viewBounds; @@ -1787,7 +1785,7 @@ BPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, uint32 clipboardMode = 0; float listViewScrollBy = 0; for (int32 modelIndex = 0; modelIndex < count; modelIndex++) { - Model *model = models[modelIndex]; + Model* model = models[modelIndex]; // pose adopts model and deletes it when done if (fInsertedNodes.find(*(model->NodeRef())) != fInsertedNodes.end() @@ -1807,8 +1805,8 @@ BPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, model->OpenNode(); ASSERT(model->IsNodeOpen()); - PoseInfo *poseInfo = &poseInfoArray[modelIndex]; - BPose *pose = new BPose(model, this, clipboardMode); + PoseInfo* poseInfo = &poseInfoArray[modelIndex]; + BPose* pose = new BPose(model, this, clipboardMode); if (resultingPoses) resultingPoses[modelIndex] = pose; @@ -1901,14 +1899,14 @@ BPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, bool -BPoseView::PoseVisible(const Model *model, const PoseInfo *poseInfo) +BPoseView::PoseVisible(const Model* model, const PoseInfo* poseInfo) { return !poseInfo->fInvisible; } bool -BPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) +BPoseView::ShouldShowPose(const Model* model, const PoseInfo* poseInfo) { if (!PoseVisible(model, poseInfo)) return false; @@ -1925,7 +1923,7 @@ BPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) } -const char * +const char* BPoseView::MimeTypeAt(int32 index) { if (fMimeTypeListIsDirty) @@ -1946,7 +1944,7 @@ BPoseView::CountMimeTypes() void -BPoseView::AddMimeType(const char *mimeType) +BPoseView::AddMimeType(const char* mimeType) { int32 count = fMimeTypeList->CountItems(); for (int32 index = 0; index < count; index++) { @@ -1965,7 +1963,7 @@ BPoseView::RefreshMimeTypeList() fMimeTypeListIsDirty = false; for (int32 index = 0;; index++) { - BPose *pose = PoseAtIndex(index); + BPose* pose = PoseAtIndex(index); if (!pose) break; @@ -1976,8 +1974,8 @@ BPoseView::RefreshMimeTypeList() void -BPoseView::InsertPoseAfter(BPose *pose, int32 *index, int32 orientation, - BRect *invalidRect) +BPoseView::InsertPoseAfter(BPose* pose, int32* index, int32 orientation, + BRect* invalidRect) { if (orientation == kInsertAfter) { // TODO: get rid of this @@ -2005,9 +2003,9 @@ void BPoseView::DisableScrollBars() { if (fHScrollBar) - fHScrollBar->SetTarget((BView *)NULL); + fHScrollBar->SetTarget((BView*)NULL); if (fVScrollBar) - fVScrollBar->SetTarget((BView *)NULL); + fVScrollBar->SetTarget((BView*)NULL); } @@ -2087,7 +2085,7 @@ BPoseView::AddCountView() void -BPoseView::MessageReceived(BMessage *message) +BPoseView::MessageReceived(BMessage* message) { if (message->WasDropped() && HandleMessageDropped(message)) return; @@ -2098,10 +2096,10 @@ BPoseView::MessageReceived(BMessage *message) switch (message->what) { case kAddNewPoses: { - AddPosesResult *currentPoses; + AddPosesResult* currentPoses; entry_ref ref; message->FindPointer("currentPoses", - reinterpret_cast(¤tPoses)); + reinterpret_cast(¤tPoses)); message->FindRef("ref", &ref); // check if CreatePoses should be called (abort if dir has been @@ -2196,7 +2194,7 @@ BPoseView::MessageReceived(BMessage *message) case B_SELECT_ALL: { // Select widget if there is an active one - BTextWidget *widget; + BTextWidget* widget; if (ActivePose() && ((widget = ActivePose()->ActiveWidget())) != 0) widget->SelectAll(this); else @@ -2347,7 +2345,7 @@ BPoseView::MessageReceived(BMessage *message) if (ActivePose()) break; - BPose *pose = fSelectionList->FirstItem(); + BPose* pose = fSelectionList->FirstItem(); if (pose) { pose->EditFirstWidget(BPoint(0, CurrentPoseList()->IndexOf(pose) * fListElemHeight), this); @@ -2362,7 +2360,7 @@ BPoseView::MessageReceived(BMessage *message) case kCopyAttributes: if (be_clipboard->Lock()) { be_clipboard->Clear(); - BMessage *data = be_clipboard->Data(); + BMessage* data = be_clipboard->Data(); if (data != NULL) { // copy attributes to the clipboard BMessage state; @@ -2380,16 +2378,16 @@ BPoseView::MessageReceived(BMessage *message) break; case kPasteAttributes: if (be_clipboard->Lock()) { - BMessage *data = be_clipboard->Data(); + BMessage* data = be_clipboard->Data(); if (data != NULL) { // find the attributes in the clipboard - const void *buffer; + const void* buffer; ssize_t size; if (data->FindData("application/tracker-columns", B_MIME_TYPE, &buffer, &size) == B_OK) { BMessage state; - if (state.Unflatten((const char *)buffer) == B_OK) { + if (state.Unflatten((const char*)buffer) == B_OK) { // remove all current columns (one always stays) - BColumn *old; + BColumn* old; while ((old = ColumnAt(0)) != NULL) { if (!RemoveColumn(old, false)) break; @@ -2397,7 +2395,7 @@ BPoseView::MessageReceived(BMessage *message) // add new columns for (int32 index = 0; ; index++) { - BColumn *column = BColumn::InstantiateFromMessage(state, index); + BColumn* column = BColumn::InstantiateFromMessage(state, index); if (!column) break; AddColumn(column); @@ -2407,7 +2405,7 @@ BPoseView::MessageReceived(BMessage *message) RemoveColumn(old, false); // set sorting mode - BViewState *viewState = BViewState::InstantiateFromMessage(state); + BViewState* viewState = BViewState::InstantiateFromMessage(state); if (viewState != NULL) { SetPrimarySort(viewState->PrimarySort()); SetSecondarySort(viewState->SecondarySort()); @@ -2571,12 +2569,12 @@ BPoseView::MessageReceived(BMessage *message) bool -BPoseView::RemoveColumn(BColumn *columnToRemove, bool runAlert) +BPoseView::RemoveColumn(BColumn* columnToRemove, bool runAlert) { // make sure last column is not removed if (CountColumns() == 1) { if (runAlert) { - BAlert *alert = new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("You must have at least one attribute showing."), B_TRANSLATE("Cancel"), 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); @@ -2601,7 +2599,7 @@ BPoseView::RemoveColumn(BColumn *columnToRemove, bool runAlert) count = CountColumns(); for (int32 index = columnIndex; index < count; index++) { - BColumn *column = ColumnAt(index); + BColumn* column = ColumnAt(index); column->SetOffset(column->Offset() - (attrWidth + kTitleColumnExtraMargin)); } @@ -2616,7 +2614,7 @@ BPoseView::RemoveColumn(BColumn *columnToRemove, bool runAlert) bool anyDateAttributesLeft = false; for (int32 i = 0; iAttrType() == B_TIME_TYPE) anyDateAttributesLeft = true; @@ -2636,7 +2634,7 @@ BPoseView::RemoveColumn(BColumn *columnToRemove, bool runAlert) bool -BPoseView::AddColumn(BColumn *newColumn, const BColumn *after) +BPoseView::AddColumn(BColumn* newColumn, const BColumn* after) { if (!after) after = LastColumn(); @@ -2659,13 +2657,13 @@ BPoseView::AddColumn(BColumn *newColumn, const BColumn *after) BRect rect(Bounds()); // add widget for all visible poses - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); int32 startIndex = (int32)(rect.top / fListElemHeight); - BPoint loc(0, startIndex * fListElemHeight); + BPoint loc(0, startIndex* fListElemHeight); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); if (!pose->WidgetFor(newColumn->AttrHash())) pose->AddWidget(this, newColumn); @@ -2680,7 +2678,7 @@ BPoseView::AddColumn(BColumn *newColumn, const BColumn *after) count = CountColumns(); for (int32 index = afterColumnIndex + 2; index < count; index++) { - BColumn *column = ColumnAt(index); + BColumn* column = ColumnAt(index); ASSERT(newColumn != column); column->SetOffset(column->Offset() + (attrWidth + kTitleColumnExtraMargin)); @@ -2702,30 +2700,30 @@ BPoseView::AddColumn(BColumn *newColumn, const BColumn *after) void -BPoseView::HandleAttrMenuItemSelected(BMessage *message) +BPoseView::HandleAttrMenuItemSelected(BMessage* message) { // see if source was a menu item - BMenuItem *item; - if (message->FindPointer("source", (void **)&item) != B_OK) + BMenuItem* item; + if (message->FindPointer("source", (void**)&item) != B_OK) item = NULL; // find out which column was selected uint32 attrHash; - if (message->FindInt32("attr_hash", (int32 *)&attrHash) != B_OK) + if (message->FindInt32("attr_hash", (int32*)&attrHash) != B_OK) return; - BColumn *column = ColumnFor(attrHash); + BColumn* column = ColumnFor(attrHash); if (column) { RemoveColumn(column, true); return; } else { // collect info about selected attribute - const char *attrName; + const char* attrName; if (message->FindString("attr_name", &attrName) != B_OK) return; uint32 attrType; - if (message->FindInt32("attr_type", (int32 *)&attrType) != B_OK) + if (message->FindInt32("attr_type", (int32*)&attrType) != B_OK) return; float attrWidth; @@ -2733,7 +2731,7 @@ BPoseView::HandleAttrMenuItemSelected(BMessage *message) return; alignment attrAlign; - if (message->FindInt32("attr_align", (int32 *)&attrAlign) != B_OK) + if (message->FindInt32("attr_align", (int32*)&attrAlign) != B_OK) return; bool isEditable; @@ -2760,7 +2758,7 @@ const int32 kSanePoseLocation = 50000; void -BPoseView::ReadPoseInfo(Model *model, PoseInfo *poseInfo) +BPoseView::ReadPoseInfo(Model* model, PoseInfo* poseInfo) { BModelOpener opener(model); if (!model->Node()) @@ -2776,9 +2774,9 @@ BPoseView::ReadPoseInfo(Model *model, PoseInfo *poseInfo) if (model->IsRoot() || isTrash) { BDirectory dir; if (FSGetDeskDir(&dir) == B_OK) { - const char *poseInfoAttr = isTrash ? kAttrTrashPoseInfo + const char* poseInfoAttr = isTrash ? kAttrTrashPoseInfo : kAttrDisksPoseInfo; - const char *poseInfoAttrForeign = isTrash ? kAttrTrashPoseInfoForeign + const char* poseInfoAttrForeign = isTrash ? kAttrTrashPoseInfoForeign : kAttrDisksPoseInfoForeign; result = ReadAttr(&dir, poseInfoAttr, poseInfoAttrForeign, B_RAW_TYPE, 0, poseInfo, sizeof(*poseInfo), &PoseInfo::EndianSwap); @@ -2805,7 +2803,7 @@ BPoseView::ReadPoseInfo(Model *model, PoseInfo *poseInfo) if (ViewMode() == kListMode) break; - const StatStruct *stat = model->StatBuf(); + const StatStruct* stat = model->StatBuf(); if (stat->st_crtime < now - 5 || stat->st_crtime > now) break; @@ -2832,8 +2830,8 @@ BPoseView::ReadPoseInfo(Model *model, PoseInfo *poseInfo) } -ExtendedPoseInfo * -BPoseView::ReadExtendedPoseInfo(Model *model) +ExtendedPoseInfo* +BPoseView::ReadExtendedPoseInfo(Model* model) { BModelOpener opener(model); if (!model->Node()) @@ -2841,8 +2839,8 @@ BPoseView::ReadExtendedPoseInfo(Model *model) ReadAttrResult result = kReadAttrFailed; - const char *extendedPoseInfoAttrName; - const char *extendedPoseInfoAttrForeignName; + const char* extendedPoseInfoAttrName; + const char* extendedPoseInfoAttrForeignName; // special case the "root" disks icon if (model->IsRoot()) { @@ -2865,8 +2863,8 @@ BPoseView::ReadExtendedPoseInfo(Model *model) if (result == kReadAttrFailed) return NULL; - char *buffer = new char[ExtendedPoseInfo::SizeWithHeadroom(size)]; - ExtendedPoseInfo *poseInfo = reinterpret_cast(buffer); + char* buffer = new char[ExtendedPoseInfo::SizeWithHeadroom(size)]; + ExtendedPoseInfo* poseInfo = reinterpret_cast(buffer); result = ReadAttr(model->Node(), extendedPoseInfoAttrName, extendedPoseInfoAttrForeignName, @@ -2927,7 +2925,7 @@ BPoseView::SetViewMode(uint32 newMode) } // toggle view layout between listmode and non-listmode, if necessary - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); if (oldMode == kListMode) { if (fFiltering) ClearFilter(); @@ -2979,7 +2977,7 @@ BPoseView::SetViewMode(uint32 newMode) if (newMode != kListMode) { int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); if (pose->HasLocation() == false) { newPoseList.AddItem(pose); } else if (checkLocations && !IsValidLocation(pose)) { @@ -3018,7 +3016,7 @@ BPoseView::SetViewMode(uint32 newMode) ResetPosePlacementHint(); int32 count = newPoseList.CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = newPoseList.ItemAt(index); + BPose* pose = newPoseList.ItemAt(index); PlacePose(pose, bounds); AddToVSList(pose); } @@ -3035,7 +3033,7 @@ BPoseView::SetViewMode(uint32 newMode) void -BPoseView::MapToNewIconMode(BPose *pose, BPoint oldGrid, BPoint oldOffset) +BPoseView::MapToNewIconMode(BPose* pose, BPoint oldGrid, BPoint oldOffset) { BPoint delta; BPoint poseLoc; @@ -3078,12 +3076,12 @@ void BPoseView::SetPosesClipboardMode(uint32 clipboardMode) { if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); BPoint loc(0,0); for (int32 index = 0; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); if (pose->ClipboardMode() != clipboardMode) { pose->SetClipboardMode(clipboardMode); Invalidate(pose->CalcRect(loc, this, false)); @@ -3093,7 +3091,7 @@ BPoseView::SetPosesClipboardMode(uint32 clipboardMode) } else { int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); if (pose->ClipboardMode() != clipboardMode) { pose->SetClipboardMode(clipboardMode); BRect poseRect(pose->CalcRect(this)); @@ -3105,7 +3103,7 @@ BPoseView::SetPosesClipboardMode(uint32 clipboardMode) void -BPoseView::UpdatePosesClipboardModeFromClipboard(BMessage *clipboardReport) +BPoseView::UpdatePosesClipboardModeFromClipboard(BMessage* clipboardReport) { CommitActivePose(); fSelectionPivotPose = NULL; @@ -3123,7 +3121,7 @@ BPoseView::UpdatePosesClipboardModeFromClipboard(BMessage *clipboardReport) // clear all poses int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); pose->Select(false); pose->SetClipboardMode(0); } @@ -3137,11 +3135,11 @@ BPoseView::UpdatePosesClipboardModeFromClipboard(BMessage *clipboardReport) bool hasPosesInClipboard = false; int32 foundNodeIndex = 0; - TClipboardNodeRef *clipNode = NULL; + TClipboardNodeRef* clipNode = NULL; ssize_t size; for (int32 index = 0; clipboardReport->FindData("tcnode", T_CLIPBOARD_NODE, index, - (const void **)&clipNode, &size) == B_OK; index++) { - BPose *pose = fPoseList->FindPose(&clipNode->node, &foundNodeIndex); + (const void**)&clipNode, &size) == B_OK; index++) { + BPose* pose = fPoseList->FindPose(&clipNode->node, &foundNodeIndex); if (pose == NULL) continue; @@ -3187,7 +3185,7 @@ BPoseView::UpdatePosesClipboardModeFromClipboard(BMessage *clipboardReport) void -BPoseView::PlaceFolder(const entry_ref *ref, const BMessage *message) +BPoseView::PlaceFolder(const entry_ref* ref, const BMessage* message) { BNode node(ref); BPoint location; @@ -3216,7 +3214,7 @@ BPoseView::PlaceFolder(const entry_ref *ref, const BMessage *message) void -BPoseView::NewFileFromTemplate(const BMessage *message) +BPoseView::NewFileFromTemplate(const BMessage* message) { ASSERT(TargetModel()); @@ -3248,7 +3246,7 @@ BPoseView::NewFileFromTemplate(const BMessage *message) BFile destFile(&destDir, fileName, B_READ_WRITE | B_CREATE_FILE); // copy the data from the template file - char *buffer = new char[1024]; + char* buffer = new char[1024]; ssize_t result; do { result = srcFile.Read(buffer, 1024); @@ -3277,7 +3275,7 @@ BPoseView::NewFileFromTemplate(const BMessage *message) // start renaming the entry int32 index; - BPose *pose = EntryCreated(TargetModel()->NodeRef(), &destNodeRef, + BPose* pose = EntryCreated(TargetModel()->NodeRef(), &destNodeRef, destEntryRef.name, &index); if (pose) { @@ -3291,7 +3289,7 @@ BPoseView::NewFileFromTemplate(const BMessage *message) void -BPoseView::NewFolder(const BMessage *message) +BPoseView::NewFolder(const BMessage* message) { ASSERT(TargetModel()); @@ -3304,7 +3302,7 @@ BPoseView::NewFolder(const BMessage *message) PlaceFolder(&ref, message); int32 index; - BPose *pose = EntryCreated(TargetModel()->NodeRef(), &nodeRef, ref.name, &index); + BPose* pose = EntryCreated(TargetModel()->NodeRef(), &nodeRef, ref.name, &index); if (pose) { UpdateScrollRange(); CommitActivePose(); @@ -3321,7 +3319,7 @@ BPoseView::Cleanup(bool doAll) if (ViewMode() == kListMode) return; - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); if (!window) return; @@ -3344,7 +3342,7 @@ BPoseView::Cleanup(bool doAll) fVSPoseList->MakeEmpty(); int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); PlacePose(pose, viewBounds); AddToVSList(pose); } @@ -3370,7 +3368,7 @@ BPoseView::Cleanup(bool doAll) BRect viewBounds(Bounds()); int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); BPoint location(pose->Location(this)); BPoint newLocation(PinToGrid(location, fGrid, fOffset)); @@ -3406,7 +3404,7 @@ BPoseView::Cleanup(bool doAll) void -BPoseView::PlacePose(BPose *pose, BRect &viewBounds) +BPoseView::PlacePose(BPose* pose, BRect &viewBounds) { // move pose to probable location pose->SetLocation(fHintLocation, this); @@ -3443,7 +3441,7 @@ BPoseView::PlacePose(BPose *pose, BRect &viewBounds) bool -BPoseView::IsValidLocation(const BPose *pose) +BPoseView::IsValidLocation(const BPose* pose) { if (!IsDesktopWindow()) return true; @@ -3512,7 +3510,7 @@ BPoseView::CheckAutoPlacedPoses() int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); if (pose->WasAutoPlaced()) { RemoveFromVSList(pose); fHintLocation = pose->Location(this); @@ -3532,7 +3530,7 @@ BPoseView::CheckAutoPlacedPoses() void -BPoseView::CheckPoseVisibility(BRect *newFrame) +BPoseView::CheckPoseVisibility(BRect* newFrame) { bool desktop = IsDesktopWindow() && newFrame != 0; @@ -3549,15 +3547,15 @@ BPoseView::CheckPoseVisibility(BRect *newFrame) int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); BPoint newLocation(pose->Location(this)); bool locationNeedsUpdating = false; if (desktop) { // we just switched screen resolution, pick up the right // icon locations for the new resolution - Model *model = pose->TargetModel(); - ExtendedPoseInfo *info = ReadExtendedPoseInfo(model); + Model* model = pose->TargetModel(); + ExtendedPoseInfo* info = ReadExtendedPoseInfo(model); if (info && info->HasLocationForFrame(deskFrame)) { BPoint locationForFrame = info->LocationForFrame(deskFrame); if (locationForFrame != newLocation) { @@ -3571,7 +3569,7 @@ BPoseView::CheckPoseVisibility(BRect *newFrame) // set the new location } } - delete [] (char *)info; + delete [] (char*)info; // TODO: fix up this mess } @@ -3638,7 +3636,7 @@ BPoseView::SlotOccupied(BRect poseRect, BRect viewBounds) const void -BPoseView::NextSlot(BPose *pose, BRect &poseRect, BRect viewBounds) +BPoseView::NextSlot(BPose* pose, BRect &poseRect, BRect viewBounds) { // move to next slot poseRect.OffsetBy(fGrid.x, 0); @@ -3699,7 +3697,7 @@ BPoseView::FirstIndexAtOrBelow(int32 y, bool constrainIndex) const void -BPoseView::AddToVSList(BPose *pose) +BPoseView::AddToVSList(BPose* pose) { int32 index = FirstIndexAtOrBelow((int32)pose->Location(this).y, false); fVSPoseList->AddItem(pose, index); @@ -3707,7 +3705,7 @@ BPoseView::AddToVSList(BPose *pose) int32 -BPoseView::RemoveFromVSList(const BPose *pose) +BPoseView::RemoveFromVSList(const BPose* pose) { //int32 index = FirstIndexAtOrBelow((int32)pose->Location(this).y); // This optimisation is buggy and the index returned can be greater @@ -3719,7 +3717,7 @@ BPoseView::RemoveFromVSList(const BPose *pose) int32 count = fVSPoseList->CountItems(); for (; index < count; index++) { - BPose *matchingPose = fVSPoseList->ItemAt(index); + BPose* matchingPose = fVSPoseList->ItemAt(index); ASSERT(matchingPose); if (!matchingPose) return -1; @@ -3779,10 +3777,10 @@ BPoseView::SelectPoses(int32 start, int32 end) BPoint loc(0, start * fListElemHeight); BRect bounds(Bounds()); - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 index = start; index < end && index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); fSelectionList->AddItem(pose); if (index == start) fSelectionPivotPose = pose; @@ -3805,7 +3803,7 @@ BPoseView::SelectPoses(int32 start, int32 end) void -BPoseView::ScrollIntoView(BPose *pose, int32 index) +BPoseView::ScrollIntoView(BPose* pose, int32 index) { ScrollIntoView(CalcPoseRect(pose, index, true)); } @@ -3830,7 +3828,7 @@ BPoseView::ScrollIntoView(BRect poseRect) void -BPoseView::SelectPose(BPose *pose, int32 index, bool scrollIntoView) +BPoseView::SelectPose(BPose* pose, int32 index, bool scrollIntoView) { if (!pose || fSelectionList->CountItems() > 1 || !pose->IsSelected()) ClearSelection(); @@ -3840,7 +3838,7 @@ BPoseView::SelectPose(BPose *pose, int32 index, bool scrollIntoView) void -BPoseView::AddPoseToSelection(BPose *pose, int32 index, bool scrollIntoView) +BPoseView::AddPoseToSelection(BPose* pose, int32 index, bool scrollIntoView) { // TODO: need to check if pose is member of selection list if (pose && !pose->IsSelected()) { @@ -3860,7 +3858,7 @@ BPoseView::AddPoseToSelection(BPose *pose, int32 index, bool scrollIntoView) void -BPoseView::RemovePoseFromSelection(BPose *pose) +BPoseView::RemovePoseFromSelection(BPose* pose) { if (fSelectionPivotPose == pose) fSelectionPivotPose = NULL; @@ -3875,7 +3873,7 @@ BPoseView::RemovePoseFromSelection(BPose *pose) if (ViewMode() == kListMode) { // TODO: need a simple call to CalcRect that works both in listView and // icon view modes without the need for an index/pos - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); BPoint loc(0, 0); for (int32 index = 0; index < count; index++) { @@ -3894,21 +3892,21 @@ BPoseView::RemovePoseFromSelection(BPose *pose) bool -BPoseView::EachItemInDraggedSelection(const BMessage *message, - bool (*func)(BPose *, BPoseView *, void *), BPoseView *poseView, void *passThru) +BPoseView::EachItemInDraggedSelection(const BMessage* message, + bool (*func)(BPose*, BPoseView*, void*), BPoseView* poseView, void* passThru) { - BContainerWindow *srcWindow; - message->FindPointer("src_window", (void **)&srcWindow); + BContainerWindow* srcWindow; + message->FindPointer("src_window", (void**)&srcWindow); AutoLock lock(srcWindow); if (!lock) return false; - PoseList *selectionList = srcWindow->PoseView()->SelectionList(); + PoseList* selectionList = srcWindow->PoseView()->SelectionList(); int32 count = selectionList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = selectionList->ItemAt(index); + BPose* pose = selectionList->ItemAt(index); if (func(pose, poseView, passThru)) // early iteration termination return true; @@ -3918,14 +3916,14 @@ BPoseView::EachItemInDraggedSelection(const BMessage *message, static bool -ContainsOne(BString *string, const char *matchString) +ContainsOne(BString* string, const char* matchString) { return strcmp(string->String(), matchString) == 0; } bool -BPoseView::FindDragNDropAction(const BMessage *dragMessage, bool &canCopy, +BPoseView::FindDragNDropAction(const BMessage* dragMessage, bool &canCopy, bool &canMove, bool &canLink, bool &canErase) { canCopy = false; @@ -3961,15 +3959,15 @@ BPoseView::FindDragNDropAction(const BMessage *dragMessage, bool &canCopy, bool -BPoseView::CanTrashForeignDrag(const Model *targetModel) +BPoseView::CanTrashForeignDrag(const Model* targetModel) { return targetModel->IsTrash(); } bool -BPoseView::CanCopyOrMoveForeignDrag(const Model *targetModel, - const BMessage *dragMessage) +BPoseView::CanCopyOrMoveForeignDrag(const Model* targetModel, + const BMessage* dragMessage) { if (!targetModel->IsDirectory()) return false; @@ -3977,7 +3975,7 @@ BPoseView::CanCopyOrMoveForeignDrag(const Model *targetModel, // in order to handle a clipping file, the drag initiator must be able // do deal with B_FILE_MIME_TYPE for (int32 index = 0; ; index++) { - const char *type; + const char* type; if (dragMessage->FindString("be:types", index, &type) != B_OK) break; @@ -3990,7 +3988,7 @@ BPoseView::CanCopyOrMoveForeignDrag(const Model *targetModel, bool -BPoseView::CanHandleDragSelection(const Model *target, const BMessage *dragMessage, +BPoseView::CanHandleDragSelection(const Model* target, const BMessage* dragMessage, bool ignoreTypes) { if (ignoreTypes) @@ -3998,8 +3996,8 @@ BPoseView::CanHandleDragSelection(const Model *target, const BMessage *dragMessa ASSERT(dragMessage); - BContainerWindow *srcWindow; - dragMessage->FindPointer("src_window", (void **)&srcWindow); + BContainerWindow* srcWindow; + dragMessage->FindPointer("src_window", (void**)&srcWindow); if (!srcWindow) { // handle a foreign drag bool canCopy; @@ -4041,9 +4039,9 @@ BPoseView::CanHandleDragSelection(const Model *target, const BMessage *dragMessa AutoLock lock(srcWindow); if (!lock) return false; - BObjectList *mimeTypeList = srcWindow->PoseView()->MimeTypesInSelection(); + BObjectList* mimeTypeList = srcWindow->PoseView()->MimeTypesInSelection(); if (mimeTypeList->IsEmpty()) { - PoseList *selectionList = srcWindow->PoseView()->SelectionList(); + PoseList* selectionList = srcWindow->PoseView()->SelectionList(); if (!selectionList->IsEmpty()) { // no cached data yet, build the cache int32 count = selectionList->CountItems(); @@ -4064,8 +4062,8 @@ BPoseView::CanHandleDragSelection(const Model *target, const BMessage *dragMessa mime.GetType(mimeType); // add unique type string - if (!WhileEachListItem(mimeTypeList, ContainsOne, (const char *)mimeType)) { - BString *newMimeString = new BString(mimeType); + if (!WhileEachListItem(mimeTypeList, ContainsOne, (const char*)mimeType)) { + BString* newMimeString = new BString(mimeType); mimeTypeList->AddItem(newMimeString); } } @@ -4077,7 +4075,7 @@ BPoseView::CanHandleDragSelection(const Model *target, const BMessage *dragMessa void -BPoseView::TrySettingPoseLocation(BNode *node, BPoint point) +BPoseView::TrySettingPoseLocation(BNode* node, BPoint point) { if (ViewMode() == kListMode) return; @@ -4093,13 +4091,13 @@ BPoseView::TrySettingPoseLocation(BNode *node, BPoint point) status_t -BPoseView::CreateClippingFile(BPoseView *poseView, BFile &result, char *resultingName, - BDirectory *dir, BMessage *message, const char *fallbackName, +BPoseView::CreateClippingFile(BPoseView* poseView, BFile &result, char* resultingName, + BDirectory* dir, BMessage* message, const char* fallbackName, bool setLocation, BPoint dropPoint) { // build a file name // try picking it up from the message - const char *suggestedName; + const char* suggestedName; if (message && message->FindString("be:clip_name", &suggestedName) == B_OK) strncpy(resultingName, suggestedName, B_FILE_NAME_LENGTH - 1); else @@ -4120,8 +4118,8 @@ BPoseView::CreateClippingFile(BPoseView *poseView, BFile &result, char *resultin static int32 -RunMimeTypeDestinationMenu(const char *actionText, const BObjectList *types, - const BObjectList *specificItems, BPoint where) +RunMimeTypeDestinationMenu(const char* actionText, const BObjectList* types, + const BObjectList* specificItems, BPoint where) { int32 count; @@ -4133,12 +4131,12 @@ RunMimeTypeDestinationMenu(const char *actionText, const BObjectList *t if (!count) return 0; - BPopUpMenu *menu = new BPopUpMenu("create clipping"); + BPopUpMenu* menu = new BPopUpMenu("create clipping"); menu->SetFont(be_plain_font); for (int32 index = 0; index < count; index++) { - const char *embedTypeAs = NULL; + const char* embedTypeAs = NULL; char buffer[256]; if (types) { types->ItemAt(index)->String(); @@ -4177,7 +4175,7 @@ RunMimeTypeDestinationMenu(const char *actionText, const BObjectList *t menu->AddItem(new BMenuItem(B_TRANSLATE("Cancel"), 0)); int32 result = -1; - BMenuItem *resultingItem = menu->Go(where, false, true); + BMenuItem* resultingItem = menu->Go(where, false, true); if (resultingItem) { int32 index = menu->IndexOf(resultingItem); if (index < count) @@ -4191,7 +4189,7 @@ RunMimeTypeDestinationMenu(const char *actionText, const BObjectList *t bool -BPoseView::HandleMessageDropped(BMessage *message) +BPoseView::HandleMessageDropped(BMessage* message) { ASSERT(message->WasDropped()); @@ -4207,8 +4205,8 @@ BPoseView::HandleMessageDropped(BMessage *message) if (message->HasData("RGBColor", 'RGBC')) { // do not handle roColor-style drops here, pass them on to the desktop - if (dynamic_cast(Window())) - BMessenger((BHandler *)Window()).SendMessage(message); + if (dynamic_cast(Window())) + BMessenger((BHandler*)Window()).SendMessage(message); return true; } @@ -4225,9 +4223,9 @@ BPoseView::HandleMessageDropped(BMessage *message) // tenatively figure out the pose we dropped the file onto int32 index; - BPose *targetPose = FindPose(dropPt, &index); + BPose* targetPose = FindPose(dropPt, &index); Model tmpTarget; - Model *targetModel = NULL; + Model* targetModel = NULL; if (targetPose) { targetModel = targetPose->TargetModel(); if (targetModel->IsSymLink() @@ -4240,19 +4238,19 @@ BPoseView::HandleMessageDropped(BMessage *message) bool -BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *targetPose, - BView *view, BPoint dropPt) +BPoseView::HandleDropCommon(BMessage* message, Model* targetModel, BPose* targetPose, + BView* view, BPoint dropPt) { uint32 buttons = (uint32)message->FindInt32("buttons"); - BContainerWindow *containerWindow = NULL; - BPoseView *poseView = dynamic_cast(view); + BContainerWindow* containerWindow = NULL; + BPoseView* poseView = dynamic_cast(view); if (poseView) containerWindow = poseView->ContainerWindow(); // look for srcWindow to determine whether drag was initiated in tracker - BContainerWindow *srcWindow = NULL; - message->FindPointer("src_window", (void **)&srcWindow); + BContainerWindow* srcWindow = NULL; + message->FindPointer("src_window", (void**)&srcWindow); if (!srcWindow) { // drag was from another app @@ -4290,7 +4288,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target // fish for specification of specialized menu items BObjectList actionSpecifiers(10, true); for (int32 index = 0; ; index++) { - const char *string; + const char* string; if (message->FindString("be:actionspecifier", index, &string) != B_OK) break; @@ -4302,14 +4300,14 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target BObjectList types(10, true); BObjectList typeNames(10, true); for (int32 index = 0; ; index++) { - const char *string; + const char* string; if (message->FindString("be:filetypes", index, &string) != B_OK) break; ASSERT(string); types.AddItem(new BString(string)); - const char *typeName = ""; + const char* typeName = ""; message->FindString("be:type_descriptions", index, &typeName); typeNames.AddItem(new BString(typeName)); } @@ -4377,7 +4375,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target // copy over all the file types the drag initiator claimed to // support for (int32 index = 0; ; index++) { - const char *type; + const char* type; if (message->FindString("be:filetypes", index, &type) != B_OK) break; reply.AddString("be:filetypes", type); @@ -4438,7 +4436,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target } // handle refs by performing a copy - BObjectList *entryList = new BObjectList(10, true); + BObjectList* entryList = new BObjectList(10, true); for (int32 index = 0; ; index++) { // copy all enclosed refs into a list @@ -4450,7 +4448,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target int32 count = entryList->CountItems(); if (count) { - BList *pointList = 0; + BList* pointList = 0; if (poseView && !targetPose) { // calculate a pointList to make the icons land were we dropped them pointList = new BList(count); @@ -4484,8 +4482,8 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target // find the text int32 textLength; - const char *text; - if (message->FindData(kPlainTextMimeType, B_MIME_TYPE, (const void **)&text, + const char* text; + if (message->FindData(kPlainTextMimeType, B_MIME_TYPE, (const void**)&text, &textLength) != B_OK) return false; @@ -4509,12 +4507,12 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target } // pick up TextView styles if available and save them with the file - const text_run_array *textRuns = NULL; + const text_run_array* textRuns = NULL; int32 dataSize = 0; if (message->FindData("application/x-vnd.Be-text_run_array", B_MIME_TYPE, - (const void **)&textRuns, &dataSize) == B_OK && textRuns && dataSize) { + (const void**)&textRuns, &dataSize) == B_OK && textRuns && dataSize) { // save styles the same way StyledEdit does - void *data = BTextView::FlattenRunArray(textRuns, &dataSize); + void* data = BTextView::FlattenRunArray(textRuns, &dataSize); file.WriteAttr("styles", B_RAW_TYPE, 0, data, (size_t)dataSize); free(data); } @@ -4555,7 +4553,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target // bail if too large return false; - char *buffer = new char [size]; + char* buffer = new char [size]; embeddedBitmap.Flatten(buffer, size); // write out the file @@ -4625,16 +4623,16 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target struct LaunchParams { - Model *app; + Model* app; bool checkTypes; - BMessage *refsMessage; + BMessage* refsMessage; }; static bool -AddOneToLaunchMessage(BPose *pose, BPoseView *, void *castToParams) +AddOneToLaunchMessage(BPose* pose, BPoseView*, void* castToParams) { - LaunchParams *params = (LaunchParams *)castToParams; + LaunchParams* params = (LaunchParams*)castToParams; ASSERT(pose->TargetModel()); if (params->app->IsDropTarget(params->checkTypes ? pose->TargetModel() : 0, true)) @@ -4645,7 +4643,7 @@ AddOneToLaunchMessage(BPose *pose, BPoseView *, void *castToParams) void -BPoseView::LaunchAppWithSelection(Model *appModel, const BMessage *dragMessage, +BPoseView::LaunchAppWithSelection(Model* appModel, const BMessage* dragMessage, bool checkTypes) { // launch items from the current selection with ; only pass the same @@ -4657,8 +4655,8 @@ BPoseView::LaunchAppWithSelection(Model *appModel, const BMessage *dragMessage, params.refsMessage = &refs; // add Tracker token so that refs received recipients can script us - BContainerWindow *srcWindow; - dragMessage->FindPointer("src_window", (void **)&srcWindow); + BContainerWindow* srcWindow; + dragMessage->FindPointer("src_window", (void**)&srcWindow); if (srcWindow) params.refsMessage->AddMessenger("TrackerViewToken", BMessenger( srcWindow->PoseView())); @@ -4670,22 +4668,22 @@ BPoseView::LaunchAppWithSelection(Model *appModel, const BMessage *dragMessage, static bool -OneMatches(BPose *pose, BPoseView *, void *castToPose) +OneMatches(BPose* pose, BPoseView*, void* castToPose) { - return pose == (const BPose *)castToPose; + return pose == (const BPose*)castToPose; } bool -BPoseView::DragSelectionContains(const BPose *target, - const BMessage *dragMessage) +BPoseView::DragSelectionContains(const BPose* target, + const BMessage* dragMessage) { - return EachItemInDraggedSelection(dragMessage, OneMatches, 0, (void *)target); + return EachItemInDraggedSelection(dragMessage, OneMatches, 0, (void*)target); } static void -CopySelectionListToBListAsEntryRefs(const PoseList *original, BObjectList *copy) +CopySelectionListToBListAsEntryRefs(const PoseList* original, BObjectList* copy) { int32 count = original->CountItems(); for (int32 index = 0; index < count; index++) @@ -4694,7 +4692,7 @@ CopySelectionListToBListAsEntryRefs(const PoseList *original, BObjectList lock(srcWindow); @@ -4750,7 +4748,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, // make sure source and destination folders are different if (!createLink && !createRelativeLink && (*srcWindow->PoseView()->TargetModel()->NodeRef() == *destFolder->NodeRef())) { - BPoseView *targetView = srcWindow->PoseView(); + BPoseView* targetView = srcWindow->PoseView(); if (forceCopy) { targetView->DuplicateSelection(&clickPt, &loc); return; @@ -4762,7 +4760,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, BPoint delta = loc - clickPt; int32 count = targetView->fSelectionList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = targetView->fSelectionList->ItemAt(index); + BPose* pose = targetView->fSelectionList->ItemAt(index); // remove pose from VSlist before changing location // so that we "find" the correct pose to remove @@ -4789,7 +4787,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, } - BEntry *destEntry = new BEntry(destFolder->EntryRef()); + BEntry* destEntry = new BEntry(destFolder->EntryRef()); bool destIsTrash = destFolder->IsTrash(); // perform asynchronous copy/move @@ -4798,7 +4796,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, bool okToMove = true; if (destFolder->IsRoot()) { - BAlert *alert = new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("You must drop items on one of the disk icons " "in the \"Disks\" window."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -4809,7 +4807,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, // can't copy items into the trash if (forceCopy && destIsTrash) { - BAlert *alert = new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Sorry, you can't copy items to the Trash."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -4820,7 +4818,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, // can't create symlinks into the trash if (createLink && destIsTrash) { - BAlert *alert = new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Sorry, you can't create links in the Trash."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -4833,7 +4831,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, if (srcWindow->TargetModel()->IsQuery() && !forceCopy && !destIsTrash && !createLink) { srcWindow->UpdateIfNeeded(); - BAlert *alert = new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("Are you sure you want to move or copy the selected " "item(s) to this folder?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Move"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -4842,10 +4840,10 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, } if (okToMove) { - PoseList *selectionList = srcWindow->PoseView()->SelectionList(); - BList *pointList = destWindow->PoseView()->GetDropPointList(clickPt, loc, selectionList, + PoseList* selectionList = srcWindow->PoseView()->SelectionList(); + BList* pointList = destWindow->PoseView()->GetDropPointList(clickPt, loc, selectionList, srcWindow->PoseView()->ViewMode() == kListMode, dropOnGrid); - BObjectList *srcList = new BObjectList( + BObjectList* srcList = new BObjectList( selectionList->CountItems(), true); CopySelectionListToBListAsEntryRefs(selectionList, srcList); @@ -4878,7 +4876,7 @@ BPoseView::MoveSelectionTo(BPoint dropPt, BPoint clickPt, { // Moves selection from srcWindow into this window, copying if necessary. - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); if (!window) return; @@ -4897,8 +4895,8 @@ BPoseView::MoveSelectionTo(BPoint dropPt, BPoint clickPt, inline void -UpdateWasBrokenSymlinkBinder(BPose *pose, Model *, BPoseView *poseView, - BPoint *loc) +UpdateWasBrokenSymlinkBinder(BPose* pose, Model*, BPoseView* poseView, + BPoint* loc) { pose->UpdateWasBrokenSymlink(*loc, poseView); loc->y += poseView->ListElemHeight(); @@ -4919,8 +4917,8 @@ BPoseView::TryUpdatingBrokenLinks() void -BPoseView::PoseHandleDeviceUnmounted(BPose *pose, Model *model, int32 index, - BPoseView *poseView, dev_t device) +BPoseView::PoseHandleDeviceUnmounted(BPose* pose, Model* model, int32 index, + BPoseView* poseView, dev_t device) { if (model->NodeRef()->device == device) poseView->DeletePose(model->NodeRef()); @@ -4932,8 +4930,8 @@ BPoseView::PoseHandleDeviceUnmounted(BPose *pose, Model *model, int32 index, static void -OneMetaMimeChanged(BPose *pose, Model *model, int32 index, - BPoseView *poseView, const char *type) +OneMetaMimeChanged(BPose* pose, Model* model, int32 index, + BPoseView* poseView, const char* type) { ASSERT(model); if (model->IconFrom() != kNode @@ -4950,7 +4948,7 @@ OneMetaMimeChanged(BPose *pose, Model *model, int32 index, void -BPoseView::MetaMimeChanged(const char *type, const char *preferredApp) +BPoseView::MetaMimeChanged(const char* type, const char* preferredApp) { IconCache::sIconCache->IconChanged(type, preferredApp); // wait for other windows to do the same before we start @@ -4967,25 +4965,25 @@ class MetaMimeChangedAccumulator : public AccumulatingFunctionObject { // pools up matching metamime change notices, executing them as a single // update public: - MetaMimeChangedAccumulator(void (BPoseView::*func)(const char *type, - const char *preferredApp), - BContainerWindow *window, const char *type, const char *preferredApp) + MetaMimeChangedAccumulator(void (BPoseView::*func)(const char* type, + const char* preferredApp), + BContainerWindow* window, const char* type, const char* preferredApp) : fCallOnThis(window), fFunc(func), fType(type), fPreferredApp(preferredApp) {} - virtual bool CanAccumulate(const AccumulatingFunctionObject *functor) const + virtual bool CanAccumulate(const AccumulatingFunctionObject* functor) const { - return dynamic_cast(functor) - && dynamic_cast(functor)->fType + return dynamic_cast(functor) + && dynamic_cast(functor)->fType == fType - && dynamic_cast(functor)-> + && dynamic_cast(functor)-> fPreferredApp == fPreferredApp; } - virtual void Accumulate(AccumulatingFunctionObject *DEBUG_ONLY(functor)) + virtual void Accumulate(AccumulatingFunctionObject* DEBUG_ONLY(functor)) { ASSERT(CanAccumulate(functor)); // do nothing, no further accumulating needed @@ -5007,15 +5005,15 @@ protected: } private: - BContainerWindow *fCallOnThis; - void (BPoseView::*fFunc)(const char *type, const char *preferredApp); + BContainerWindow* fCallOnThis; + void (BPoseView::*fFunc)(const char* type, const char* preferredApp); BString fType; BString fPreferredApp; }; bool -BPoseView::NoticeMetaMimeChanged(const BMessage *message) +BPoseView::NoticeMetaMimeChanged(const BMessage* message) { int32 change; if (message->FindInt32("be:which", &change) != B_OK) @@ -5026,8 +5024,8 @@ BPoseView::NoticeMetaMimeChanged(const BMessage *message) bool preferredAppChanged = (change & B_APP_HINT_CHANGED) || (change & B_PREFERRED_APP_CHANGED); - const char *type = NULL; - const char *preferredApp = NULL; + const char* type = NULL; + const char* preferredApp = NULL; if (iconChanged || preferredAppChanged) message->FindString("be:type", &type); @@ -5038,7 +5036,7 @@ BPoseView::NoticeMetaMimeChanged(const BMessage *message) } if (iconChanged || preferredAppChanged || iconForTypeChanged) { - TaskLoop *taskLoop = ContainerWindow()->DelayedTaskLoop(); + TaskLoop* taskLoop = ContainerWindow()->DelayedTaskLoop(); ASSERT(taskLoop); taskLoop->AccumulatedRunLater(new MetaMimeChangedAccumulator( &BPoseView::MetaMimeChanged, ContainerWindow(), type, preferredApp), @@ -5049,7 +5047,7 @@ BPoseView::NoticeMetaMimeChanged(const BMessage *message) bool -BPoseView::FSNotification(const BMessage *message) +BPoseView::FSNotification(const BMessage* message) { node_ref itemNode; dev_t device; @@ -5060,8 +5058,8 @@ BPoseView::FSNotification(const BMessage *message) message->FindInt32("device", &itemNode.device); node_ref dirNode; dirNode.device = itemNode.device; - message->FindInt64("directory", (int64 *)&dirNode.node); - message->FindInt64("node", (int64 *)&itemNode.node); + message->FindInt64("directory", (int64*)&dirNode.node); + message->FindInt64("node", (int64*)&itemNode.node); ASSERT(TargetModel()); @@ -5076,7 +5074,7 @@ BPoseView::FSNotification(const BMessage *message) // stray notification break; - const char *name; + const char* name; if (message->FindString("name", &name) == B_OK) EntryCreated(&dirNode, &itemNode, name); #if DEBUG @@ -5091,7 +5089,7 @@ BPoseView::FSNotification(const BMessage *message) case B_ENTRY_REMOVED: message->FindInt32("device", &itemNode.device); - message->FindInt64("node", (int64 *)&itemNode.node); + message->FindInt64("node", (int64*)&itemNode.node); // our window itself may be deleted // we must check to see if this comes as a query @@ -5114,7 +5112,7 @@ BPoseView::FSNotification(const BMessage *message) } } else { int32 index; - BPose *pose = fPoseList->FindPose(&itemNode, &index); + BPose* pose = fPoseList->FindPose(&itemNode, &index); if (!pose) { // couldn't find pose, first check if the node might be // target of a symlink pose; @@ -5157,7 +5155,7 @@ BPoseView::FSNotification(const BMessage *message) AddPoses(&model); } } - TaskLoop *taskLoop = ContainerWindow()->DelayedTaskLoop(); + TaskLoop* taskLoop = ContainerWindow()->DelayedTaskLoop(); ASSERT(taskLoop); taskLoop->RunLater(NewMemberFunctionObject( &BPoseView::TryUpdatingBrokenLinks, this), 500000); @@ -5189,10 +5187,10 @@ BPoseView::FSNotification(const BMessage *message) bool -BPoseView::CreateSymlinkPoseTarget(Model *symlink) +BPoseView::CreateSymlinkPoseTarget(Model* symlink) { - Model *newResolvedModel = NULL; - Model *result = symlink->LinkTo(); + Model* newResolvedModel = NULL; + Model* result = symlink->LinkTo(); if (!result) { newResolvedModel = new Model(symlink->EntryRef(), true, true); @@ -5228,9 +5226,9 @@ BPoseView::CreateSymlinkPoseTarget(Model *symlink) } -BPose * -BPoseView::EntryCreated(const node_ref *dirNode, const node_ref *itemNode, - const char *name, int32 *indexPtr) +BPose* +BPoseView::EntryCreated(const node_ref* dirNode, const node_ref* itemNode, + const char* name, int32* indexPtr) { // reject notification if pose already exists if (fPoseList->FindPose(itemNode) || FindZombie(itemNode)) @@ -5238,7 +5236,7 @@ BPoseView::EntryCreated(const node_ref *dirNode, const node_ref *itemNode, BPoseView::WatchNewNode(itemNode); // have to node monitor ahead of time because Model will // cache up the file type and preferred app - Model *model = new Model(dirNode, itemNode, name, true); + Model* model = new Model(dirNode, itemNode, name, true); if (model->InitCheck() != B_OK) { // if we have trouble setting up model then we stuff it into @@ -5276,7 +5274,7 @@ BPoseView::EntryCreated(const node_ref *dirNode, const node_ref *itemNode, bool -BPoseView::EntryMoved(const BMessage *message) +BPoseView::EntryMoved(const BMessage* message) { ino_t oldDir; node_ref dirNode; @@ -5284,11 +5282,11 @@ BPoseView::EntryMoved(const BMessage *message) message->FindInt32("device", &dirNode.device); itemNode.device = dirNode.device; - message->FindInt64("to directory", (int64 *)&dirNode.node); - message->FindInt64("node", (int64 *)&itemNode.node); - message->FindInt64("from directory", (int64 *)&oldDir); + message->FindInt64("to directory", (int64*)&dirNode.node); + message->FindInt64("node", (int64*)&itemNode.node); + message->FindInt64("from directory", (int64*)&oldDir); - const char *name; + const char* name; if (message->FindString("name", &name) != B_OK) return true; // handle special case of notifying a name change for a volume @@ -5327,14 +5325,14 @@ BPoseView::EntryMoved(const BMessage *message) if (thisDirNode == itemNode) { TargetModel()->UpdateEntryRef(&dirNode, name); - assert_cast(Window())->UpdateTitle(); + assert_cast(Window())->UpdateTitle(); } if (oldDir == dirNode.node || TargetModel()->IsQuery()) { // rename or move of entry in this directory (or query) int32 index; - BPose *pose = fPoseList->FindPose(&itemNode, &index); + BPose* pose = fPoseList->FindPose(&itemNode, &index); if (pose) { pose->TargetModel()->UpdateEntryRef(&dirNode, name); @@ -5362,7 +5360,7 @@ BPoseView::EntryMoved(const BMessage *message) } } else { // also must watch for renames on zombies - Model *zombie = FindZombie(&itemNode, &index); + Model* zombie = FindZombie(&itemNode, &index); if (zombie) { PRINT(("converting model %s from a zombie\n", zombie->Name())); zombie->UpdateEntryRef(&dirNode, name); @@ -5381,20 +5379,20 @@ BPoseView::EntryMoved(const BMessage *message) bool -BPoseView::AttributeChanged(const BMessage *message) +BPoseView::AttributeChanged(const BMessage* message) { node_ref itemNode; message->FindInt32("device", &itemNode.device); - message->FindInt64("node", (int64 *)&itemNode.node); + message->FindInt64("node", (int64*)&itemNode.node); - const char *attrName; + const char* attrName; message->FindString("attr", &attrName); if (TargetModel() != NULL && *TargetModel()->NodeRef() == itemNode && TargetModel()->AttrChanged(attrName)) { // the icon of our target has changed, update drag icon // TODO: make this simpler (ie. store the icon with the window) - BView *view = Window()->FindView("MenuBar"); + BView* view = Window()->FindView("MenuBar"); if (view != NULL) { view = view->FindView("ThisContainer"); if (view != NULL) { @@ -5405,7 +5403,7 @@ BPoseView::AttributeChanged(const BMessage *message) } int32 index; - BPose *pose = fPoseList->DeepFindPose(&itemNode, &index); + BPose* pose = fPoseList->DeepFindPose(&itemNode, &index); attr_info info; memset(&info, 0, sizeof(attr_info)); if (pose) { @@ -5416,7 +5414,7 @@ BPoseView::AttributeChanged(const BMessage *message) BPoint loc(0, index * fListElemHeight); - Model *model = pose->TargetModel(); + Model* model = pose->TargetModel(); if (model->IsSymLink() && *model->NodeRef() != itemNode) // change happened on symlink's target model = model->ResolveIfLink(); @@ -5487,7 +5485,7 @@ BPoseView::AttributeChanged(const BMessage *message) // that although we couldn't open the node the first time, it seems // to be fine now since we're receiving notifications about it, it might // be a good time to convert it to a non-zombie state. cf. test in #4130 - Model *zombie = FindZombie(&itemNode, &index); + Model* zombie = FindZombie(&itemNode, &index); if (zombie) { PRINT(("converting model %s from a zombie\n", zombie->Name())); return ConvertZombieToPose(zombie, index) != NULL; @@ -5502,13 +5500,13 @@ BPoseView::AttributeChanged(const BMessage *message) void -BPoseView::UpdateIcon(BPose *pose) +BPoseView::UpdateIcon(BPose* pose) { BPoint location; if (ViewMode() == kListMode) { // need to find the index of the pose in the pose list bool found = false; - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 index = 0; index < count; index++) { if (poseList->ItemAt(index) == pose) { @@ -5526,8 +5524,8 @@ BPoseView::UpdateIcon(BPose *pose) } -BPose * -BPoseView::ConvertZombieToPose(Model *zombie, int32 index) +BPose* +BPoseView::ConvertZombieToPose(Model* zombie, int32 index) { if (zombie->UpdateStatAndOpenNode() != B_OK) return NULL; @@ -5547,17 +5545,17 @@ BPoseView::ConvertZombieToPose(Model *zombie, int32 index) } -BList * -BPoseView::GetDropPointList(BPoint dropStart, BPoint dropEnd, const PoseList *poses, +BList* +BPoseView::GetDropPointList(BPoint dropStart, BPoint dropEnd, const PoseList* poses, bool sourceInListMode, bool dropOnGrid) const { if (ViewMode() == kListMode) return NULL; int32 count = poses->CountItems(); - BList *pointList = new BList(count); + BList* pointList = new BList(count); for (int32 index = 0; index < count; index++) { - BPose *pose = poses->ItemAt(index); + BPose* pose = poses->ItemAt(index); BPoint poseLoc; if (sourceInListMode) poseLoc = dropEnd + BPoint(0, index * (IconPoseHeight() + 3)); @@ -5575,14 +5573,14 @@ BPoseView::GetDropPointList(BPoint dropStart, BPoint dropEnd, const PoseList *po void -BPoseView::DuplicateSelection(BPoint *dropStart, BPoint *dropEnd) +BPoseView::DuplicateSelection(BPoint* dropStart, BPoint* dropEnd) { // If there is a volume or trash folder, remove them from the list // because they cannot get copied int32 selectionSize = fSelectionList->CountItems(); for (int32 index = 0; index < selectionSize; index++) { - BPose *pose = (BPose*)fSelectionList->ItemAt(index); - Model *model = pose->TargetModel(); + BPose* pose = (BPose*)fSelectionList->ItemAt(index); + Model* model = pose->TargetModel(); // can't duplicate a volume or the trash if (model->IsTrash() || model->IsVolume()) { @@ -5603,7 +5601,7 @@ BPoseView::DuplicateSelection(BPoint *dropStart, BPoint *dropEnd) fSelectionList->CountItems(), true); CopySelectionListToBListAsEntryRefs(fSelectionList, srcList); - BList *dropPoints = NULL; + BList* dropPoints = NULL; if (dropStart) dropPoints = GetDropPointList(*dropStart, *dropEnd, fSelectionList, ViewMode() == kListMode, (modifiers() & B_COMMAND_KEY) != 0); @@ -5618,7 +5616,7 @@ void BPoseView::SelectPoseAtLocation(BPoint point) { int32 index; - BPose *pose = FindPose(point, &index); + BPose* pose = FindPose(point, &index); if (pose) SelectPose(pose, index); } @@ -5640,18 +5638,18 @@ BPoseView::MoveListToTrash(BObjectList *list, bool selectNext, taskList->AddItem(NewFunctionObject(FSDeleteRefList, list, false, true)); else taskList->AddItem(NewFunctionObject(FSMoveToTrash, list, - (BList *)NULL, false)); + (BList*)NULL, false)); if (selectNext && ViewMode() == kListMode) { // next, if in list view mode try selecting the next item after - BPose *pose = fSelectionList->ItemAt(0); + BPose* pose = fSelectionList->ItemAt(0); // find a point in the pose BPoint pointInPose(kListOffset + 5, 5); int32 index = IndexOfPose(pose); pointInPose.y += fListElemHeight * index; - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); ASSERT(TargetModel()); if (tracker) @@ -5669,8 +5667,8 @@ BPoseView::MoveListToTrash(BObjectList *list, bool selectNext, inline void -CopyOneTrashedRefAsEntry(const entry_ref *ref, BObjectList *trashList, - BObjectList *noTrashList, std::map *deviceHasTrash) +CopyOneTrashedRefAsEntry(const entry_ref* ref, BObjectList* trashList, + BObjectList* noTrashList, std::map* deviceHasTrash) { std::map &deviceHasTrashTmp = *deviceHasTrash; // work around stupid binding problems with EachListItem @@ -5697,8 +5695,8 @@ CopyOneTrashedRefAsEntry(const entry_ref *ref, BObjectList *trashList static void -CopyPoseOneAsEntry(BPose *pose, BObjectList *trashList, - BObjectList *noTrashList, std::map *deviceHasTrash) +CopyPoseOneAsEntry(BPose* pose, BObjectList* trashList, + BObjectList* noTrashList, std::map* deviceHasTrash) { CopyOneTrashedRefAsEntry(pose->TargetModel()->EntryRef(), trashList, noTrashList, deviceHasTrash); @@ -5706,11 +5704,11 @@ CopyPoseOneAsEntry(BPose *pose, BObjectList *trashList, static bool -CheckVolumeReadOnly(const entry_ref *ref) +CheckVolumeReadOnly(const entry_ref* ref) { BVolume volume (ref->device); if (volume.IsReadOnly()) { - BAlert *alert = new BAlert ("", + BAlert* alert = new BAlert ("", B_TRANSLATE("Files cannot be moved or deleted from a read-only " "volume."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); @@ -5724,11 +5722,11 @@ CheckVolumeReadOnly(const entry_ref *ref) void -BPoseView::MoveSelectionOrEntryToTrash(const entry_ref *ref, bool selectNext) +BPoseView::MoveSelectionOrEntryToTrash(const entry_ref* ref, bool selectNext) { - BObjectList *entriesToTrash = new + BObjectList* entriesToTrash = new BObjectList(fSelectionList->CountItems()); - BObjectList *entriesToDeleteOnTheSpot = new + BObjectList* entriesToDeleteOnTheSpot = new BObjectList(20, true); std::map deviceHasTrash; @@ -5762,7 +5760,7 @@ BPoseView::MoveSelectionOrEntryToTrash(const entry_ref *ref, bool selectNext) "(This operation cannot be reverted.)")); } - BAlert *alert = new BAlert("", alertText.String(), + BAlert* alert = new BAlert("", alertText.String(), B_TRANSLATE("Cancel"), B_TRANSLATE("Delete")); alert->SetShortcut(0, B_ESCAPE); if (alert->Go() == 0) @@ -5788,7 +5786,7 @@ BPoseView::MoveSelectionToTrash(bool selectNext) void -BPoseView::MoveEntryToTrash(const entry_ref *ref, bool selectNext) +BPoseView::MoveEntryToTrash(const entry_ref* ref, bool selectNext) { MoveSelectionOrEntryToTrash(ref, selectNext); } @@ -5804,7 +5802,7 @@ BPoseView::DeleteSelection(bool selectNext, bool askUser) if (!CheckVolumeReadOnly(fSelectionList->ItemAt(0)->TargetModel()->EntryRef())) return; - BObjectList *entriesToDelete = new BObjectList(count, true); + BObjectList* entriesToDelete = new BObjectList(count, true); for (int32 index = 0; index < count; index++) entriesToDelete->AddItem(new entry_ref((*fSelectionList->ItemAt(index) @@ -5821,7 +5819,7 @@ BPoseView::RestoreSelectionFromTrash(bool selectNext) if (count <= 0) return; - BObjectList *entriesToRestore = new BObjectList(count, true); + BObjectList* entriesToRestore = new BObjectList(count, true); for (int32 index = 0; index < count; index++) entriesToRestore->AddItem(new entry_ref((*fSelectionList->ItemAt(index) @@ -5834,7 +5832,7 @@ BPoseView::RestoreSelectionFromTrash(bool selectNext) void BPoseView::Delete(const entry_ref &ref, bool selectNext, bool askUser) { - BObjectList *entriesToDelete = new BObjectList(1, true); + BObjectList* entriesToDelete = new BObjectList(1, true); entriesToDelete->AddItem(new entry_ref(ref)); Delete(entriesToDelete, selectNext, askUser); @@ -5842,14 +5840,14 @@ BPoseView::Delete(const entry_ref &ref, bool selectNext, bool askUser) void -BPoseView::Delete(BObjectList *list, bool selectNext, bool askUser) +BPoseView::Delete(BObjectList* list, bool selectNext, bool askUser) { if (list->CountItems() == 0) { delete list; return; } - BObjectList *taskList = + BObjectList* taskList = new BObjectList(2, true); // first move selection to trash, @@ -5857,14 +5855,14 @@ BPoseView::Delete(BObjectList *list, bool selectNext, bool askUser) if (selectNext && ViewMode() == kListMode) { // next, if in list view mode try selecting the next item after - BPose *pose = fSelectionList->ItemAt(0); + BPose* pose = fSelectionList->ItemAt(0); // find a point in the pose BPoint pointInPose(kListOffset + 5, 5); int32 index = IndexOfPose(pose); pointInPose.y += fListElemHeight * index; - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); ASSERT(TargetModel()); if (tracker) @@ -5882,14 +5880,14 @@ BPoseView::Delete(BObjectList *list, bool selectNext, bool askUser) void -BPoseView::RestoreItemsFromTrash(BObjectList *list, bool selectNext) +BPoseView::RestoreItemsFromTrash(BObjectList* list, bool selectNext) { if (list->CountItems() == 0) { delete list; return; } - BObjectList *taskList = + BObjectList* taskList = new BObjectList(2, true); // first restoree selection @@ -5897,14 +5895,14 @@ BPoseView::RestoreItemsFromTrash(BObjectList *list, bool selectNext) if (selectNext && ViewMode() == kListMode) { // next, if in list view mode try selecting the next item after - BPose *pose = fSelectionList->ItemAt(0); + BPose* pose = fSelectionList->ItemAt(0); // find a point in the pose BPoint pointInPose(kListOffset + 5, 5); int32 index = IndexOfPose(pose); pointInPose.y += fListElemHeight * index; - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); ASSERT(TargetModel()); if (tracker) @@ -5937,10 +5935,10 @@ BPoseView::SelectAll() bool iconMode = ViewMode() != kListMode; - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); fSelectionList->AddItem(pose); if (index == startIndex) fSelectionPivotPose = pose; @@ -5986,10 +5984,10 @@ BPoseView::InvertSelection() bool iconMode = ViewMode() != kListMode; - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); if (pose->IsSelected()) { fSelectionList->RemoveItem(pose); @@ -6019,7 +6017,7 @@ BPoseView::InvertSelection() int32 -BPoseView::SelectMatchingEntries(const BMessage *message) +BPoseView::SelectMatchingEntries(const BMessage* message) { int32 matchCount = 0; SetMultipleSelection(true); @@ -6028,7 +6026,7 @@ BPoseView::SelectMatchingEntries(const BMessage *message) TrackerStringExpressionType expressionType; BString expression; - const char *expressionPointer; + const char* expressionPointer; bool invertSelection; bool ignoreCase; @@ -6039,7 +6037,7 @@ BPoseView::SelectMatchingEntries(const BMessage *message) expression = expressionPointer; - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); TrackerString name; @@ -6065,7 +6063,7 @@ BPoseView::SelectMatchingEntries(const BMessage *message) // TrackerString::CompileRegExp and reuse the expression. However, then we // have to take care of the case sensitivity ourselves. for (int32 index = 0; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); name = pose->TargetModel()->Name(); if (name.Matches(expression.String(), !ignoreCase, expressionType) ^ invertSelection) { matchCount++; @@ -6090,7 +6088,7 @@ BPoseView::ShowSelectionWindow() void -BPoseView::KeyDown(const char *bytes, int32 count) +BPoseView::KeyDown(const char* bytes, int32 count) { char key = bytes[0]; @@ -6101,7 +6099,7 @@ BPoseView::KeyDown(const char *bytes, int32 count) case B_DOWN_ARROW: { int32 index; - BPose *pose = FindNearbyPose(key, &index); + BPose* pose = FindNearbyPose(key, &index); if (pose == NULL) break; @@ -6131,8 +6129,8 @@ BPoseView::KeyDown(const char *bytes, int32 count) // select the first entry (if in listview mode), and // scroll to the top of the view if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); - BPose *pose = fSelectionList->LastItem(); + PoseList* poseList = CurrentPoseList(); + BPose* pose = fSelectionList->LastItem(); if (pose != NULL && fMultipleSelection && (modifiers() & B_SHIFT_KEY) != 0) { int32 index = poseList->IndexOf(pose); @@ -6157,8 +6155,8 @@ BPoseView::KeyDown(const char *bytes, int32 count) // select the last entry (if in listview mode), and // scroll to the bottom of the view if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); - BPose *pose = fSelectionList->FirstItem(); + PoseList* poseList = CurrentPoseList(); + BPose* pose = fSelectionList->FirstItem(); if (pose != NULL && fMultipleSelection && (modifiers() & B_SHIFT_KEY) != 0) { int32 index = poseList->IndexOf(pose); @@ -6211,14 +6209,14 @@ BPoseView::KeyDown(const char *bytes, int32 count) if (fSelectionList->IsEmpty()) sMatchString.Truncate(0); else { - BPose *pose = fSelectionList->FirstItem(); + BPose* pose = fSelectionList->FirstItem(); sMatchString.SetTo(pose->TargetModel()->Name()); } bool reverse = (Window()->CurrentMessage()->FindInt32("modifiers") & B_SHIFT_KEY) != 0; int32 index; - BPose *pose = FindNextMatch(&index, reverse); + BPose* pose = FindNextMatch(&index, reverse); if (!pose) { // wrap around if (reverse) sMatchString.SetTo(0x7f, 1); @@ -6252,7 +6250,7 @@ BPoseView::KeyDown(const char *bytes, int32 count) case B_BACKSPACE: { if (fFiltering) { - BString *lastString = fFilterStrings.LastItem(); + BString* lastString = fFilterStrings.LastItem(); if (lastString->Length() == 0) { int32 stringCount = fFilterStrings.CountItems(); if (stringCount > 1) @@ -6279,7 +6277,7 @@ BPoseView::KeyDown(const char *bytes, int32 count) // select our new string int32 index; - BPose *pose = FindBestMatch(&index); + BPose* pose = FindBestMatch(&index); if (!pose) break; @@ -6288,7 +6286,7 @@ BPoseView::KeyDown(const char *bytes, int32 count) } case B_FUNCTION_KEY: - if (BMessage *message = Window()->CurrentMessage()) { + if (BMessage* message = Window()->CurrentMessage()) { int32 key; if (message->FindInt32("key", &key) == B_OK) { switch (key) { @@ -6354,7 +6352,7 @@ BPoseView::KeyDown(const char *bytes, int32 count) fCountView->SetTypeAhead(sMatchString.String()); int32 index; - BPose *pose = FindBestMatch(&index); + BPose* pose = FindBestMatch(&index); if (!pose) break; @@ -6365,16 +6363,16 @@ BPoseView::KeyDown(const char *bytes, int32 count) } -BPose * -BPoseView::FindNextMatch(int32 *matchingIndex, bool reverse) +BPose* +BPoseView::FindNextMatch(int32* matchingIndex, bool reverse) { char bestSoFar[B_FILE_NAME_LENGTH] = { 0 }; - BPose *poseToSelect = NULL; + BPose* poseToSelect = NULL; // loop through all poses to find match int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); if (reverse) { if (sMatchString.ICompare(pose->TargetModel()->Name()) > 0) @@ -6398,25 +6396,25 @@ BPoseView::FindNextMatch(int32 *matchingIndex, bool reverse) } -BPose * -BPoseView::FindBestMatch(int32 *index) +BPose* +BPoseView::FindBestMatch(int32* index) { - BPose *poseToSelect = NULL; + BPose* poseToSelect = NULL; float bestScore = -1; int32 count = fPoseList->CountItems(); // loop through all poses to find match for (int32 j = 0; j < CountColumns(); j++) { - BColumn *column = ColumnAt(j); + BColumn* column = ColumnAt(j); for (int32 i = 0; i < count; i++) { - BPose *pose = fPoseList->ItemAt(i); + BPose* pose = fPoseList->ItemAt(i); float score = -1; if (ViewMode() == kListMode) { ModelNodeLazyOpener modelOpener(pose->TargetModel()); - BTextWidget *widget = pose->WidgetFor(column, this, modelOpener); - const char *text = NULL; + BTextWidget* widget = pose->WidgetFor(column, this, modelOpener); + const char* text = NULL; if (widget != NULL) text = widget->Text(this); @@ -6456,15 +6454,15 @@ LinesIntersect(float s1, float e1, float s2, float e2) } -BPose * -BPoseView::FindNearbyPose(char arrowKey, int32 *poseIndex) +BPose* +BPoseView::FindNearbyPose(char arrowKey, int32* poseIndex) { int32 resultingIndex = -1; - BPose *poseToSelect = NULL; - BPose *selectedPose = fSelectionList->LastItem(); + BPose* poseToSelect = NULL; + BPose* selectedPose = fSelectionList->LastItem(); if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); switch (arrowKey) { case B_UP_ARROW: @@ -6508,7 +6506,7 @@ BPoseView::FindNearbyPose(char arrowKey, int32 *poseIndex) // find the upper-left pose (I know it's ugly!) poseToSelect = fVSPoseList->FirstItem(); for (int32 index = 0; ;index++) { - BPose *pose = fVSPoseList->ItemAt(++index); + BPose* pose = fVSPoseList->ItemAt(++index); if (!pose) break; @@ -6531,7 +6529,7 @@ BPoseView::FindNearbyPose(char arrowKey, int32 *poseIndex) // we're not in list mode so scan visually for pose to select int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); BRect poseRect(pose->CalcRect(this)); switch (arrowKey) { @@ -6591,13 +6589,13 @@ BPoseView::FindNearbyPose(char arrowKey, int32 *poseIndex) void BPoseView::ShowContextMenu(BPoint where) { - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); if (!window) return; // handle pose selection int32 index; - BPose *pose = FindPose(where, &index); + BPose* pose = FindPose(where, &index); if (pose) { if (!pose->IsSelected()) { ClearSelection(); @@ -6644,7 +6642,7 @@ BPoseView::_BeginSelectionRect(const BPoint& point, bool shouldExtend) static void -AddIfPoseSelected(BPose *pose, PoseList *list) +AddIfPoseSelected(BPose* pose, PoseList* list) { if (pose->IsSelected()) list->AddItem(pose); @@ -6806,7 +6804,7 @@ BPoseView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage) void -BPoseView::MouseDragged(const BMessage *message) +BPoseView::MouseDragged(const BMessage* message) { fTrackRightMouseUp = false; @@ -6828,7 +6826,7 @@ BPoseView::MouseDragged(const BMessage *message) void -BPoseView::MouseLongDown(const BMessage *message) +BPoseView::MouseLongDown(const BMessage* message) { fTrackRightMouseUp = false; @@ -6841,7 +6839,7 @@ BPoseView::MouseLongDown(const BMessage *message) void -BPoseView::MouseIdle(const BMessage *message) +BPoseView::MouseIdle(const BMessage* message) { BPoint where; uint32 buttons = 0; @@ -6867,7 +6865,7 @@ BPoseView::MouseDown(BPoint where) { // handle disposing of drag data lazily DragStop(); - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); if (!window) return; @@ -6891,7 +6889,7 @@ BPoseView::MouseDown(BPoint where) CommitActivePose(); int32 index; - BPose *pose = FindPose(where, &index); + BPose* pose = FindPose(where, &index); if (pose) { AddRemoveSelectionRange(where, extendSelection, pose); @@ -6959,13 +6957,13 @@ BPoseView::MouseUp(BPoint where) bool -BPoseView::WasClickInPath(const BPose *pose, int32 index, BPoint mouseLoc) const +BPoseView::WasClickInPath(const BPose* pose, int32 index, BPoint mouseLoc) const { if (!pose || (ViewMode() != kListMode)) return false; BPoint loc(0, index * fListElemHeight); - BTextWidget *widget; + BTextWidget* widget; if (!pose->PointInPose(loc, this, mouseLoc, &widget) || !widget) return false; @@ -6991,7 +6989,7 @@ BPoseView::WasClickInPath(const BPose *pose, int32 index, BPoint mouseLoc) const bool -BPoseView::WasDoubleClick(const BPose *pose, BPoint point) +BPoseView::WasDoubleClick(const BPose* pose, BPoint point) { // check time and proximity BPoint delta = point - fLastClickPt; @@ -7022,7 +7020,7 @@ BPoseView::WasDoubleClick(const BPose *pose, BPoint point) static void -AddPoseRefToMessage(BPose *, Model *model, BMessage *message) +AddPoseRefToMessage(BPose *, Model* model, BMessage* message) { // Make sure that every file added to the message has its // MIME type set. @@ -7042,7 +7040,7 @@ AddPoseRefToMessage(BPose *, Model *model, BMessage *message) void -BPoseView::DragSelectedPoses(const BPose *pose, BPoint clickPoint) +BPoseView::DragSelectedPoses(const BPose* pose, BPoint clickPoint) { if (!fDragEnabled) return; @@ -7072,7 +7070,7 @@ BPoseView::DragSelectedPoses(const BPose *pose, BPoint clickPoint) int32 index = CurrentPoseList()->IndexOf(pose); message.AddInt32("buttons", (int32)button); BRect dragRect(GetDragRect(index)); - BBitmap *dragBitmap = NULL; + BBitmap* dragBitmap = NULL; BPoint offset; // The bitmap is now always created (if DRAG_FRAME is not defined) @@ -7096,7 +7094,7 @@ BPoseView::DragSelectedPoses(const BPose *pose, BPoint clickPoint) } -BBitmap * +BBitmap* BPoseView::MakeDragBitmap(BRect dragRect, BPoint clickedPoint, int32 clickedPoseIndex, BPoint &offset) { @@ -7143,9 +7141,9 @@ BPoseView::MakeDragBitmap(BRect dragRect, BPoint clickedPoint, BRect rect(inner); rect.OffsetTo(B_ORIGIN); - BBitmap *bitmap = new BBitmap(rect, B_RGBA32, true); + BBitmap* bitmap = new BBitmap(rect, B_RGBA32, true); bitmap->Lock(); - BView *view = new BView(bitmap->Bounds(), "", B_FOLLOW_NONE, 0); + BView* view = new BView(bitmap->Bounds(), "", B_FOLLOW_NONE, 0); bitmap->AddChild(view); view->SetOrigin(0, 0); @@ -7164,8 +7162,8 @@ BPoseView::MakeDragBitmap(BRect dragRect, BPoint clickedPoint, BRect bounds(Bounds()); - PoseList *poseList = CurrentPoseList(); - BPose *pose = poseList->ItemAt(clickedPoseIndex); + PoseList* poseList = CurrentPoseList(); + BPose* pose = poseList->ItemAt(clickedPoseIndex); if (ViewMode() == kListMode) { int32 count = poseList->CountItems(); int32 startIndex = (int32)(bounds.top / fListElemHeight); @@ -7208,7 +7206,7 @@ BPoseView::MakeDragBitmap(BRect dragRect, BPoint clickedPoint, // Fade out the contents if necessary if (fade) { - uint32 *bits = (uint32 *)bitmap->Bits(); + uint32* bits = (uint32*)bitmap->Bits(); int32 width = bitmap->BytesPerRow() / 4; if (fadeLeft) @@ -7235,8 +7233,8 @@ BPoseView::GetDragRect(int32 clickedPoseIndex) BRect result; BRect bounds(Bounds()); - PoseList *poseList = CurrentPoseList(); - BPose *pose = poseList->ItemAt(clickedPoseIndex); + PoseList* poseList = CurrentPoseList(); + BPose* pose = poseList->ItemAt(clickedPoseIndex); if (ViewMode() == kListMode) { // get starting rect of clicked pose result = CalcPoseRectList(pose, clickedPoseIndex, true); @@ -7263,7 +7261,7 @@ BPoseView::GetDragRect(int32 clickedPoseIndex) int32 count = fVSPoseList->CountItems(); for (int32 index = FirstIndexAtOrBelow((int32)(bounds.top - IconPoseHeight())); index < count; index++) { - BPose *pose = fVSPoseList->ItemAt(index); + BPose* pose = fVSPoseList->ItemAt(index); if (pose) { if (pose->IsSelected()) result = result | pose->CalcRect(this); @@ -7281,12 +7279,12 @@ BPoseView::GetDragRect(int32 clickedPoseIndex) // TODO: SelectPosesListMode and SelectPosesIconMode are terrible and share // most code void -BPoseView::SelectPosesListMode(BRect selectionRect, BList **oldList) +BPoseView::SelectPosesListMode(BRect selectionRect, BList** oldList) { ASSERT(ViewMode() == kListMode); // collect all the poses which are enclosed inside the selection rect - BList *newList = new BList; + BList* newList = new BList; BRect bounds(Bounds()); SetDrawingMode(B_OP_COPY); // TODO: I _think_ there is no more synchronous drawing here, @@ -7298,17 +7296,18 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList **oldList) BPoint loc(0, startIndex * fListElemHeight); - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); BRect poseRect(pose->CalcRect(loc, this)); if (selectionRect.Intersects(poseRect)) { bool selected = pose->IsSelected(); pose->Select(!fSelectionList->HasItem(pose)); - newList->AddItem((void *)index); // this sucks, need to clean up - // using a vector class instead of BList + newList->AddItem((void*)index); + // this sucks, need to clean up using a vector class instead + // of BList if ((selected != pose->IsSelected()) && poseRect.Intersects(bounds)) { Invalidate(poseRect); @@ -7330,8 +7329,8 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList **oldList) for (int32 index = 0; index < count; index++) { int32 oldIndex = (int32)(*oldList)->ItemAt(index); - if (!newList->HasItem((void *)oldIndex)) { - BPose *pose = poseList->ItemAt(oldIndex); + if (!newList->HasItem((void*)oldIndex)) { + BPose* pose = poseList->ItemAt(oldIndex); pose->Select(!pose->IsSelected()); loc.Set(0, oldIndex * fListElemHeight); BRect poseRect(pose->CalcRect(loc, this)); @@ -7342,18 +7341,18 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList **oldList) } } - delete *oldList; + delete* oldList; *oldList = newList; } void -BPoseView::SelectPosesIconMode(BRect selectionRect, BList **oldList) +BPoseView::SelectPosesIconMode(BRect selectionRect, BList** oldList) { ASSERT(ViewMode() != kListMode); // collect all the poses which are enclosed inside the selection rect - BList *newList = new BList; + BList* newList = new BList; BRect bounds(Bounds()); SetDrawingMode(B_OP_COPY); @@ -7363,14 +7362,14 @@ BPoseView::SelectPosesIconMode(BRect selectionRect, BList **oldList) int32 count = fPoseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = fVSPoseList->ItemAt(index); + BPose* pose = fVSPoseList->ItemAt(index); if (pose) { BRect poseRect(pose->CalcRect(this)); if (selectionRect.Intersects(poseRect)) { bool selected = pose->IsSelected(); pose->Select(!fSelectionList->HasItem(pose)); - newList->AddItem((void *)index); + newList->AddItem((void*)index); if ((selected != pose->IsSelected()) && poseRect.Intersects(bounds)) { @@ -7393,8 +7392,8 @@ BPoseView::SelectPosesIconMode(BRect selectionRect, BList **oldList) for (int32 index = 0; index < count; index++) { int32 oldIndex = (int32)(*oldList)->ItemAt(index); - if (!newList->HasItem((void *)oldIndex)) { - BPose *pose = fVSPoseList->ItemAt(oldIndex); + if (!newList->HasItem((void*)oldIndex)) { + BPose* pose = fVSPoseList->ItemAt(oldIndex); pose->Select(!pose->IsSelected()); BRect poseRect(pose->CalcRect(this)); @@ -7403,13 +7402,13 @@ BPoseView::SelectPosesIconMode(BRect selectionRect, BList **oldList) } } - delete *oldList; + delete* oldList; *oldList = newList; } void -BPoseView::AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose *pose) +BPoseView::AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose* pose) { ASSERT(pose); @@ -7427,13 +7426,13 @@ BPoseView::AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose *po if (!extendSelection) { // Remember fSelectionPivotPose because ClearSelection() NULLs it // and we need it to be preserved. - const BPose *savedPivotPose = fSelectionPivotPose; + const BPose* savedPivotPose = fSelectionPivotPose; ClearSelection(); fSelectionPivotPose = savedPivotPose; } if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 currSelIndex = poseList->IndexOf(pose); int32 lastSelIndex = poseList->IndexOf(fSelectionPivotPose); @@ -7479,7 +7478,7 @@ BPoseView::AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose *po int32 count = fPoseList->CountItems(); for (int32 index = count - 1; index >= 0; index--) { - BPose *currPose = fPoseList->ItemAt(index); + BPose* currPose = fPoseList->ItemAt(index); // TODO: works only in non-list mode? if (selection.Intersects(currPose->CalcRect(this))) AddRemovePoseFromSelection(currPose, index, select); @@ -7514,7 +7513,7 @@ BPoseView::AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose *po void -BPoseView::DeleteSymLinkPoseTarget(const node_ref *itemNode, BPose *pose, +BPoseView::DeleteSymLinkPoseTarget(const node_ref* itemNode, BPose* pose, int32 index) { ASSERT(pose->TargetModel()->IsSymLink()); @@ -7526,7 +7525,7 @@ BPoseView::DeleteSymLinkPoseTarget(const node_ref *itemNode, BPose *pose, bool -BPoseView::DeletePose(const node_ref *itemNode, BPose *pose, int32 index) +BPoseView::DeletePose(const node_ref* itemNode, BPose* pose, int32 index) { watch_node(itemNode, B_STOP_WATCHING, this); @@ -7536,7 +7535,7 @@ BPoseView::DeletePose(const node_ref *itemNode, BPose *pose, int32 index) if (pose) { fInsertedNodes.erase(fInsertedNodes.find(*itemNode)); if (TargetModel()->IsSymLink()) { - Model *target = pose->TargetModel()->LinkTo(); + Model* target = pose->TargetModel()->LinkTo(); if (target) watch_node(target->NodeRef(), B_STOP_WATCHING, this); } @@ -7597,7 +7596,7 @@ BPoseView::DeletePose(const node_ref *itemNode, BPose *pose, int32 index) if (ViewMode() == kListMode) { BRect bounds(Bounds()); int32 index = (int32)(bounds.bottom / fListElemHeight); - BPose *pose = CurrentPoseList()->ItemAt(index); + BPose* pose = CurrentPoseList()->ItemAt(index); if (!pose && bounds.top > 0) // scroll up a little BView::ScrollTo(bounds.left, @@ -7609,7 +7608,7 @@ BPoseView::DeletePose(const node_ref *itemNode, BPose *pose, int32 index) } else { // we might be getting a delete for an item in the zombie list - Model *zombie = FindZombie(itemNode, &index); + Model* zombie = FindZombie(itemNode, &index); if (zombie) { PRINT(("deleting zombie model %s\n", zombie->Name())); fZombieList->RemoveItemAt(index); @@ -7621,12 +7620,12 @@ BPoseView::DeletePose(const node_ref *itemNode, BPose *pose, int32 index) } -Model * -BPoseView::FindZombie(const node_ref *itemNode, int32 *resultingIndex) +Model* +BPoseView::FindZombie(const node_ref* itemNode, int32* resultingIndex) { int32 count = fZombieList->CountItems(); for (int32 index = 0; index < count; index++) { - Model *zombie = fZombieList->ItemAt(index); + Model* zombie = fZombieList->ItemAt(index); if (*zombie->NodeRef() == *itemNode) { if (resultingIndex) *resultingIndex = index; @@ -7640,8 +7639,8 @@ BPoseView::FindZombie(const node_ref *itemNode, int32 *resultingIndex) // return pose at location h,v (search list starting from bottom so // drawing and hit detection reflect the same pose ordering) -BPose * -BPoseView::FindPose(BPoint point, int32 *poseIndex) const +BPose* +BPoseView::FindPose(BPoint point, int32* poseIndex) const { if (ViewMode() == kListMode) { int32 index = (int32)(point.y / fListElemHeight); @@ -7649,13 +7648,13 @@ BPoseView::FindPose(BPoint point, int32 *poseIndex) const *poseIndex = index; BPoint loc(0, index * fListElemHeight); - BPose *pose = CurrentPoseList()->ItemAt(index); + BPose* pose = CurrentPoseList()->ItemAt(index); if (pose && pose->PointInPose(loc, this, point)) return pose; } else { int32 count = fPoseList->CountItems(); for (int32 index = count - 1; index >= 0; index--) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); if (pose->PointInPose(this, point)) { if (poseIndex) *poseIndex = index; @@ -7669,9 +7668,9 @@ BPoseView::FindPose(BPoint point, int32 *poseIndex) const void -BPoseView::OpenSelection(BPose *clickedPose, int32 *index) +BPoseView::OpenSelection(BPose* clickedPose, int32* index) { - BPose *singleWindowBrowsePose = clickedPose; + BPose* singleWindowBrowsePose = clickedPose; TrackerSettings settings; // Get first selected pose in selection if none was clicked @@ -7702,26 +7701,26 @@ BPoseView::OpenSelection(BPose *clickedPose, int32 *index) void -BPoseView::OpenSelectionUsing(BPose *clickedPose, int32 *index) +BPoseView::OpenSelectionUsing(BPose* clickedPose, int32* index) { OpenSelectionCommon(clickedPose, index, true); } void -BPoseView::OpenSelectionCommon(BPose *clickedPose, int32 *poseIndex, +BPoseView::OpenSelectionCommon(BPose* clickedPose, int32* poseIndex, bool openWith) { int32 count = fSelectionList->CountItems(); if (!count) return; - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); BMessage message(B_REFS_RECEIVED); for (int32 index = 0; index < count; index++) { - BPose *pose = fSelectionList->ItemAt(index); + BPose* pose = fSelectionList->ItemAt(index); message.AddRef("refs", pose->TargetModel()->EntryRef()); @@ -7794,11 +7793,11 @@ BPoseView::UnmountSelectedVolumes() int32 select_count = fSelectionList->CountItems(); for (int32 index = 0; index < select_count; index++) { - BPose *pose = fSelectionList->ItemAt(index); + BPose* pose = fSelectionList->ItemAt(index); if (!pose) continue; - Model *model = pose->TargetModel(); + Model* model = pose->TargetModel(); if (model->IsVolume()) { BVolume volume(model->NodeRef()->device); if (volume != boot) { @@ -7844,14 +7843,14 @@ BPoseView::ClearPoses() void -BPoseView::SwitchDir(const entry_ref *newDirRef, AttributeStreamNode *node) +BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node) { ASSERT(TargetModel()); if (*newDirRef == *TargetModel()->EntryRef()) // no change return; - Model *model = new Model(newDirRef, true); + Model* model = new Model(newDirRef, true); if (model->InitCheck() != B_OK || !model->IsDirectory()) { delete model; return; @@ -7881,7 +7880,7 @@ BPoseView::SwitchDir(const entry_ref *newDirRef, AttributeStreamNode *node) uint32 oldMode = ViewMode(); bool viewStateRestored = false; if (node) { - BViewState *previousState = fViewState; + BViewState* previousState = fViewState; RestoreState(node); viewStateRestored = (fViewState != previousState); } @@ -8012,7 +8011,7 @@ BPoseView::SendSelectionAsRefs(uint32 what, bool onlyQueries) message.what = what; for (int32 index = 0; index < numItems; index++) { - BPose *pose = fSelectionList->ItemAt(index); + BPose* pose = fSelectionList->ItemAt(index); if (onlyQueries) { // to check if pose is a query, follow any symlink first BEntry resolvedEntry(pose->TargetModel()->EntryRef(), true); @@ -8042,7 +8041,7 @@ BPoseView::OpenInfoWindows() { BMessenger tracker(kTrackerSignature); if (!tracker.IsValid()) { - BAlert *alert = new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("The Tracker must be running to see Info windows."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -8059,7 +8058,7 @@ BPoseView::SetDefaultPrinter() { BMessenger tracker(kTrackerSignature); if (!tracker.IsValid()) { - BAlert *alert = new BAlert("", + BAlert* alert = new BAlert("", B_TRANSLATE("The Tracker must be running to see set the default " "printer."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -8098,7 +8097,7 @@ BPoseView::OpenParent() BMessage message(B_REFS_RECEIVED); message.AddRef("refs", &ref); - if (dynamic_cast(be_app)) { + if (dynamic_cast(be_app)) { // add information about the child, so that we can select it // in the parent view message.AddData("nodeRefToSelect", B_RAW_TYPE, TargetModel()->NodeRef(), @@ -8126,7 +8125,7 @@ BPoseView::IdentifySelection() bool force = (modifiers() & B_SHIFT_KEY) != 0; int32 count = fSelectionList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fSelectionList->ItemAt(index); + BPose* pose = fSelectionList->ItemAt(index); BEntry entry(pose->TargetModel()->EntryRef()); if (entry.InitCheck() == B_OK) { BPath path; @@ -8153,10 +8152,10 @@ BPoseView::ClearSelection() int32 startIndex = (int32)(bounds.top / fListElemHeight); BPoint loc(0, startIndex * fListElemHeight); - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); if (pose->IsSelected()) { pose->Select(false); Invalidate(pose->CalcRect(loc, this, false)); @@ -8170,7 +8169,7 @@ BPoseView::ClearSelection() int32 startIndex = FirstIndexAtOrBelow((int32)(bounds.top - IconPoseHeight()), true); int32 count = fVSPoseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = fVSPoseList->ItemAt(index); + BPose* pose = fVSPoseList->ItemAt(index); if (pose) { if (pose->IsSelected()) { pose->Select(false); @@ -8211,10 +8210,10 @@ BPoseView::ShowSelection(bool show) int32 startIndex = (int32)(bounds.top / fListElemHeight); BPoint loc(0, startIndex * fListElemHeight); - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); if (fSelectionList->HasItem(pose)) if (pose->IsSelected() != show || fShowSelectionWhenInactive) { if (!fShowSelectionWhenInactive) @@ -8232,7 +8231,7 @@ BPoseView::ShowSelection(bool show) (int32)(bounds.top - IconPoseHeight()), true); int32 count = fVSPoseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = fVSPoseList->ItemAt(index); + BPose* pose = fVSPoseList->ItemAt(index); if (pose) { if (fSelectionList->HasItem(pose)) if (pose->IsSelected() != show || fShowSelectionWhenInactive) { @@ -8250,7 +8249,7 @@ BPoseView::ShowSelection(bool show) // now set all other poses int32 count = fSelectionList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fSelectionList->ItemAt(index); + BPose* pose = fSelectionList->ItemAt(index); if (pose->IsSelected() != show && !fShowSelectionWhenInactive) pose->Select(show); } @@ -8269,7 +8268,7 @@ BPoseView::ShowSelection(bool show) void -BPoseView::AddRemovePoseFromSelection(BPose *pose, int32 index, bool select) +BPoseView::AddRemovePoseFromSelection(BPose* pose, int32 index, bool select) { // Do not allow double selection/deselection. if (select == pose->IsSelected()) @@ -8324,7 +8323,7 @@ BPoseView::Extent() const BRect rect; if (ViewMode() == kListMode) { - BColumn *column = fColumnList->LastItem(); + BColumn* column = fColumnList->LastItem(); if (column) { rect.left = rect.top = 0; rect.right = column->Offset() + column->Width() @@ -8452,7 +8451,7 @@ BPoseView::UpdateScrollRange() void -BPoseView::DrawPose(BPose *pose, int32 index, bool fullDraw) +BPoseView::DrawPose(BPose* pose, int32 index, bool fullDraw) { BRect rect = CalcPoseRect(pose, index, fullDraw); @@ -8468,7 +8467,7 @@ rgb_color BPoseView::DeskTextColor() const { rgb_color color = ViewColor(); - float thresh = color.red + (color.green * 1.5f) + (color.blue * .50f); + float thresh = color.red + (color.green * 1.5f) + (color.blue * 0.50f); if (thresh >= 300) { color.red = 0; @@ -8573,7 +8572,7 @@ void BPoseView::DrawViewCommon(const BRect &updateRect) { if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); int32 startIndex = (int32)((updateRect.top - fListElemHeight) / fListElemHeight); if (startIndex < 0) @@ -8582,7 +8581,7 @@ BPoseView::DrawViewCommon(const BRect &updateRect) BPoint loc(0, startIndex * fListElemHeight); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); BRect poseRect(pose->CalcRect(loc, this, true)); pose->Draw(poseRect, updateRect, this, true); loc.y += fListElemHeight; @@ -8592,7 +8591,7 @@ BPoseView::DrawViewCommon(const BRect &updateRect) } else { int32 count = fPoseList->CountItems(); for (int32 index = 0; index < count; index++) { - BPose *pose = fPoseList->ItemAt(index); + BPose* pose = fPoseList->ItemAt(index); BRect poseRect(pose->CalcRect(this)); if (updateRect.Intersects(poseRect)) pose->Draw(poseRect, updateRect, this, true); @@ -8618,7 +8617,7 @@ BPoseView::ColumnRedraw(BRect updateRect) if (startIndex < 0) startIndex = 0; - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); if (!count) return; @@ -8627,14 +8626,14 @@ BPoseView::ColumnRedraw(BRect updateRect) BRect srcRect = poseList->ItemAt(0)->CalcRect(BPoint(0, 0), this, false); srcRect.right += 1024; // need this to erase correctly sOffscreen->BeginUsing(srcRect); - BView *offscreenView = sOffscreen->View(); + BView* offscreenView = sOffscreen->View(); BRegion updateRegion; updateRegion.Set(updateRect); ConstrainClippingRegion(&updateRegion); for (int32 index = startIndex; index < count; index++) { - BPose *pose = poseList->ItemAt(index); + BPose* pose = poseList->ItemAt(index); offscreenView->SetDrawingMode(B_OP_COPY); offscreenView->SetLowColor(LowColor()); @@ -8660,7 +8659,7 @@ BPoseView::ColumnRedraw(BRect updateRect) void -BPoseView::CloseGapInList(BRect *invalidRect) +BPoseView::CloseGapInList(BRect* invalidRect) { (*invalidRect).bottom = Extent().bottom + fListElemHeight; BRect bounds(Bounds()); @@ -8683,14 +8682,14 @@ BPoseView::CloseGapInList(BRect *invalidRect) void -BPoseView::CheckPoseSortOrder(BPose *pose, int32 oldIndex) +BPoseView::CheckPoseSortOrder(BPose* pose, int32 oldIndex) { _CheckPoseSortOrder(CurrentPoseList(), pose, oldIndex); } void -BPoseView::_CheckPoseSortOrder(PoseList *poseList, BPose *pose, int32 oldIndex) +BPoseView::_CheckPoseSortOrder(PoseList* poseList, BPose* pose, int32 oldIndex) { if (ViewMode() != kListMode) return; @@ -8729,33 +8728,33 @@ BPoseView::_CheckPoseSortOrder(PoseList *poseList, BPose *pose, int32 oldIndex) static int -PoseCompareAddWidget(const BPose *p1, const BPose *p2, BPoseView *view) +PoseCompareAddWidget(const BPose* p1, const BPose* p2, BPoseView* view) { // pose comparison and lazy text widget adding uint32 sort = view->PrimarySort(); - BColumn *column = view->ColumnFor(sort); + BColumn* column = view->ColumnFor(sort); if (!column) return 0; - BPose *primary; - BPose *secondary; + BPose* primary; + BPose* secondary; if (!view->ReverseSort()) { - primary = const_cast(p1); - secondary = const_cast(p2); + primary = const_cast(p1); + secondary = const_cast(p2); } else { - primary = const_cast(p2); - secondary = const_cast(p1); + primary = const_cast(p2); + secondary = const_cast(p1); } int32 result = 0; for (int32 count = 0; ; count++) { - BTextWidget *widget1 = primary->WidgetFor(sort); + BTextWidget* widget1 = primary->WidgetFor(sort); if (!widget1) widget1 = primary->AddWidget(view, column); - BTextWidget *widget2 = secondary->WidgetFor(sort); + BTextWidget* widget2 = secondary->WidgetFor(sort); if (!widget2) widget2 = secondary->AddWidget(view, column); @@ -8783,12 +8782,12 @@ PoseCompareAddWidget(const BPose *p1, const BPose *p2, BPoseView *view) } -static BPose * -BSearch(PoseList *table, const BPose* key, BPoseView *view, - int (*cmp)(const BPose *, const BPose *, BPoseView *), bool returnClosest) +static BPose* +BSearch(PoseList* table, const BPose* key, BPoseView* view, + int (*cmp)(const BPose*, const BPose*, BPoseView*), bool returnClosest) { int32 r = table->CountItems(); - BPose *result = 0; + BPose* result = 0; for (int32 l = 1; l <= r;) { int32 m = (l + r) / 2; @@ -8809,14 +8808,14 @@ BSearch(PoseList *table, const BPose* key, BPoseView *view, int32 -BPoseView::BSearchList(PoseList *poseList, const BPose *pose, - int32 *resultingIndex, int32 oldIndex) +BPoseView::BSearchList(PoseList* poseList, const BPose* pose, + int32* resultingIndex, int32 oldIndex) { // check to see if insertion should be at beginning of list - const BPose *firstPose = poseList->FirstItem(); + const BPose* firstPose = poseList->FirstItem(); if (!firstPose) - return kInsertAtFront; - + return kInsertAtFront; + if (PoseCompareAddWidget(pose, firstPose, this) < 0) { *resultingIndex = 0; return kInsertAtFront; @@ -8836,10 +8835,10 @@ BPoseView::BSearchList(PoseList *poseList, const BPose *pose, *resultingIndex = oldIndex - 1; return kInsertAfter; } - + *resultingIndex = count - 1; - const BPose *searchResult = BSearch(poseList, pose, this, + const BPose* searchResult = BSearch(poseList, pose, this, PoseCompareAddWidget); if (searchResult) { @@ -8867,7 +8866,7 @@ BPoseView::BSearchList(PoseList *poseList, const BPose *pose, void BPoseView::SetPrimarySort(uint32 attrHash) { - BColumn *column = ColumnFor(attrHash); + BColumn* column = ColumnFor(attrHash); if (column) { fViewState->SetPrimarySort(attrHash); @@ -8879,7 +8878,7 @@ BPoseView::SetPrimarySort(uint32 attrHash) void BPoseView::SetSecondarySort(uint32 attrHash) { - BColumn *column = ColumnFor(attrHash); + BColumn* column = ColumnFor(attrHash); if (column) { fViewState->SetSecondarySort(attrHash); @@ -8899,28 +8898,28 @@ BPoseView::SetReverseSort(bool reverse) inline int -PoseCompareAddWidgetBinder(const BPose *p1, const BPose *p2, void *castToPoseView) +PoseCompareAddWidgetBinder(const BPose* p1, const BPose* p2, void* castToPoseView) { - return PoseCompareAddWidget(p1, p2, (BPoseView *)castToPoseView); + return PoseCompareAddWidget(p1, p2, (BPoseView*)castToPoseView); } -struct PoseComparator : public std::binary_function +struct PoseComparator : public std::binary_function { - PoseComparator(BPoseView *poseView): fPoseView(poseView) { } + PoseComparator(BPoseView* poseView): fPoseView(poseView) { } - bool operator() (const BPose *p1, const BPose *p2) { + bool operator() (const BPose* p1, const BPose* p2) { return PoseCompareAddWidget(p1, p2, fPoseView) < 0; } - BPoseView * fPoseView; + BPoseView* fPoseView; }; #if xDEBUG -static BPose * -DumpOne(BPose *pose, void *) +static BPose* +DumpOne(BPose* pose, void*) { pose->TargetModel()->PrintToStream(0); return 0; @@ -8938,11 +8937,11 @@ BPoseView::SortPoses() PRINT(("===================\n")); #endif - BPose **poses = reinterpret_cast( + BPose** poses = reinterpret_cast( PoseList::Private(fPoseList).AsBList()->Items()); std::stable_sort(poses, &poses[fPoseList->CountItems()], PoseComparator(this)); if (fFiltering) { - poses = reinterpret_cast( + poses = reinterpret_cast( PoseList::Private(fFilteredPoseList).AsBList()->Items()); std::stable_sort(poses, &poses[fFilteredPoseList->CountItems()], PoseComparator(this)); @@ -8950,12 +8949,12 @@ BPoseView::SortPoses() } -BColumn * +BColumn* BPoseView::ColumnFor(uint32 attr) const { int32 count = fColumnList->CountItems(); for (int32 index = 0; index < count; index++) { - BColumn *column = ColumnAt(index); + BColumn* column = ColumnAt(index); if (column->AttrHash() == attr) return column; } @@ -8965,16 +8964,16 @@ BPoseView::ColumnFor(uint32 attr) const bool // returns true if actually resized -BPoseView::ResizeColumnToWidest(BColumn *column) +BPoseView::ResizeColumnToWidest(BColumn* column) { ASSERT(ViewMode() == kListMode); float maxWidth = kMinColumnWidth; - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); for (int32 i = 0; i < count; ++i) { - BTextWidget *widget = poseList->ItemAt(i)->WidgetFor(column->AttrHash()); + BTextWidget* widget = poseList->ItemAt(i)->WidgetFor(column->AttrHash()); if (widget) { float width = widget->PreferredWidth(this); if (width > maxWidth) @@ -8992,10 +8991,10 @@ BPoseView::ResizeColumnToWidest(BColumn *column) BPoint -BPoseView::ResizeColumn(BColumn *column, float newSize, - float *lastLineDrawPos, - void (*drawLineFunc)(BPoseView *, BPoint, BPoint), - void (*undrawLineFunc)(BPoseView *, BPoint, BPoint)) +BPoseView::ResizeColumn(BColumn* column, float newSize, + float* lastLineDrawPos, + void (*drawLineFunc)(BPoseView*, BPoint, BPoint), + void (*undrawLineFunc)(BPoseView*, BPoint, BPoint)) { BRect sourceRect(Bounds()); BPoint result(sourceRect.RightBottom()); @@ -9021,7 +9020,7 @@ BPoseView::ResizeColumn(BColumn *column, float newSize, column->SetWidth(newSize); float offset = kColumnStart; - BColumn *last = fColumnList->FirstItem(); + BColumn* last = fColumnList->FirstItem(); int32 count = fColumnList->CountItems(); @@ -9069,7 +9068,7 @@ BPoseView::ResizeColumn(BColumn *column, float newSize, void -BPoseView::MoveColumnTo(BColumn *src, BColumn *dest) +BPoseView::MoveColumnTo(BColumn* src, BColumn* dest) { // find the leftmost boundary of columns we are about to reshuffle float miny = src->Offset(); @@ -9082,11 +9081,11 @@ BPoseView::MoveColumnTo(BColumn *src, BColumn *dest) fColumnList->AddItem(src, index); float offset = kColumnStart; - BColumn *last = fColumnList->FirstItem(); + BColumn* last = fColumnList->FirstItem(); int32 count = fColumnList->CountItems(); for (int32 index = 0; index < count; index++) { - BColumn *column = fColumnList->ItemAt(index); + BColumn* column = fColumnList->ItemAt(index); column->SetOffset(offset); last = column; offset = last->Offset() + last->Width() + kTitleColumnExtraMargin; @@ -9102,13 +9101,13 @@ BPoseView::MoveColumnTo(BColumn *src, BColumn *dest) bool -BPoseView::UpdateDropTarget(BPoint mouseLoc, const BMessage *dragMessage, +BPoseView::UpdateDropTarget(BPoint mouseLoc, const BMessage* dragMessage, bool trackingContextMenu) { ASSERT(dragMessage); int32 index; - BPose *targetPose = FindPose(mouseLoc, &index); + BPose* targetPose = FindPose(mouseLoc, &index); if (targetPose != NULL && DragSelectionContains(targetPose, dragMessage)) targetPose = NULL; @@ -9125,7 +9124,7 @@ BPoseView::UpdateDropTarget(BPoint mouseLoc, const BMessage *dragMessage, fDropTarget = targetPose; // dereference if symlink - Model *targetModel = NULL; + Model* targetModel = NULL; if (targetPose) targetModel = targetPose->TargetModel(); Model tmpTarget; @@ -9170,13 +9169,13 @@ BPoseView::UpdateDropTarget(BPoint mouseLoc, const BMessage *dragMessage, bool -BPoseView::FrameForPose(BPose *targetpose, bool convert, BRect *poseRect) +BPoseView::FrameForPose(BPose* targetpose, bool convert, BRect* poseRect) { bool returnvalue = false; BRect bounds(Bounds()); if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); int32 startIndex = (int32)(bounds.top / fListElemHeight); @@ -9198,7 +9197,7 @@ BPoseView::FrameForPose(BPose *targetpose, bool convert, BRect *poseRect) int32 count = fVSPoseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = fVSPoseList->ItemAt(index); + BPose* pose = fVSPoseList->ItemAt(index); if (pose) { if (pose == fDropTarget) { *poseRect = pose->CalcRect(this); @@ -9223,7 +9222,7 @@ BPoseView::FrameForPose(BPose *targetpose, bool convert, BRect *poseRect) const int32 kMenuTrackMargin = 20; bool -BPoseView::MenuTrackingHook(BMenu *menu, void *) +BPoseView::MenuTrackingHook(BMenu* menu, void*) { // return true if the menu should go away if (!menu->LockLooper()) @@ -9250,9 +9249,9 @@ BPoseView::MenuTrackingHook(BMenu *menu, void *) for (int32 index = 0 ; index < count; index++) { // iterate through all of the items in the menu // if the submenu is showing, see if the mouse is in the submenu - BMenuItem *item = menu->ItemAt(index); + BMenuItem* item = menu->ItemAt(index); if (item && item->Submenu()) { - BWindow *window = item->Submenu()->Window(); + BWindow* window = item->Submenu()->Window(); bool inSubmenu = false; if (window && window->Lock()) { if (!window->IsHidden()) { @@ -9282,7 +9281,7 @@ void BPoseView::DragStop() { fStartFrame.Set(0, 0, 0, 0); - BContainerWindow *window = ContainerWindow(); + BContainerWindow* window = ContainerWindow(); if (window) window->DragStop(); } @@ -9321,7 +9320,7 @@ BPoseView::HiliteDropTarget(bool hiliteState) BRect bounds(Bounds()); if (ViewMode() == kListMode) { - PoseList *poseList = CurrentPoseList(); + PoseList* poseList = CurrentPoseList(); int32 count = poseList->CountItems(); int32 startIndex = (int32)(bounds.top / fListElemHeight); @@ -9343,7 +9342,7 @@ BPoseView::HiliteDropTarget(bool hiliteState) int32 count = fVSPoseList->CountItems(); for (int32 index = startIndex; index < count; index++) { - BPose *pose = fVSPoseList->ItemAt(index); + BPose* pose = fVSPoseList->ItemAt(index); if (pose) { if (pose == fDropTarget) { BRect poseRect = pose->CalcRect(this); @@ -9545,7 +9544,7 @@ BPoseView::HandleAutoScroll() BRect -BPoseView::CalcPoseRect(const BPose *pose, int32 index, +BPoseView::CalcPoseRect(const BPose* pose, int32 index, bool firstColumnOnly) const { if (ViewMode() == kListMode) @@ -9556,14 +9555,14 @@ BPoseView::CalcPoseRect(const BPose *pose, int32 index, BRect -BPoseView::CalcPoseRectIcon(const BPose *pose) const +BPoseView::CalcPoseRectIcon(const BPose* pose) const { return pose->CalcRect(this); } BRect -BPoseView::CalcPoseRectList(const BPose *pose, int32 index, +BPoseView::CalcPoseRectList(const BPose* pose, int32 index, bool firstColumnOnly) const { return pose->CalcRect(BPoint(0, index * fListElemHeight), this, @@ -9572,14 +9571,14 @@ BPoseView::CalcPoseRectList(const BPose *pose, int32 index, bool -BPoseView::Represents(const node_ref *node) const +BPoseView::Represents(const node_ref* node) const { return *(fModel->NodeRef()) == *node; } bool -BPoseView::Represents(const entry_ref *ref) const +BPoseView::Represents(const entry_ref* ref) const { return *fModel->EntryRef() == *ref; } @@ -9655,14 +9654,14 @@ BPoseView::StopWatchDateFormatChange() void -BPoseView::UpdateDateColumns(BMessage *message) +BPoseView::UpdateDateColumns(BMessage* message) { int32 columnCount = CountColumns(); BRect columnRect(Bounds()); for (int32 i = 0; i < columnCount; i++) { - BColumn *col = ColumnAt(i); + BColumn* col = ColumnAt(i); if (col && col->AttrType() == B_TIME_TYPE) { columnRect.left = col->Offset(); columnRect.right = columnRect.left + col->Width(); @@ -9673,13 +9672,13 @@ BPoseView::UpdateDateColumns(BMessage *message) void -BPoseView::AdaptToVolumeChange(BMessage *) +BPoseView::AdaptToVolumeChange(BMessage*) { } void -BPoseView::AdaptToDesktopIntegrationChange(BMessage *) +BPoseView::AdaptToDesktopIntegrationChange(BMessage*) { } @@ -9699,7 +9698,7 @@ BPoseView::SetWidgetTextOutline(bool on) void -BPoseView::EnsurePoseUnselected(BPose *pose) +BPoseView::EnsurePoseUnselected(BPose* pose) { if (pose == fDropTarget) fDropTarget = NULL; @@ -9722,7 +9721,7 @@ BPoseView::EnsurePoseUnselected(BPose *pose) void -BPoseView::RemoveFilteredPose(BPose *pose, int32 index) +BPoseView::RemoveFilteredPose(BPose* pose, int32 index) { EnsurePoseUnselected(pose); fFilteredPoseList->RemoveItemAt(index); @@ -9758,7 +9757,7 @@ BPoseView::FilterChanged() } else { int32 count = fFilteredPoseList->CountItems(); for (int32 i = count - 1; i >= 0; i--) { - BPose *pose = fFilteredPoseList->ItemAt(i); + BPose* pose = fFilteredPoseList->ItemAt(i); if (!FilterPose(pose)) RemoveFilteredPose(pose, i); } @@ -9776,7 +9775,7 @@ BPoseView::UpdateAfterFilterChange() { UpdateCount(); - BPose *pose = fFilteredPoseList->LastItem(); + BPose* pose = fFilteredPoseList->LastItem(); if (pose == NULL) BView::ScrollTo(0, 0); else { @@ -9791,7 +9790,7 @@ BPoseView::UpdateAfterFilterChange() bool -BPoseView::FilterPose(BPose *pose) +BPoseView::FilterPose(BPose* pose) { if (!fFiltering || pose == NULL) return false; @@ -9804,8 +9803,8 @@ BPoseView::FilterPose(BPose *pose) ModelNodeLazyOpener modelOpener(pose->TargetModel()); for (int32 i = 0; i < CountColumns(); i++) { - BTextWidget *widget = pose->WidgetFor(ColumnAt(i), this, modelOpener); - const char *text = NULL; + BTextWidget* widget = pose->WidgetFor(ColumnAt(i), this, modelOpener); + const char* text = NULL; if (widget == NULL) continue; @@ -9839,7 +9838,7 @@ BPoseView::StartFiltering() fFiltering = true; int32 count = fPoseList->CountItems(); for (int32 i = 0; i < count; i++) { - BPose *pose = fPoseList->ItemAt(i); + BPose* pose = fPoseList->ItemAt(i); if (FilterPose(pose)) fFilteredPoseList->AddItem(pose); else @@ -9891,7 +9890,7 @@ BPoseView::ClearFilter() // #pragma mark - -BHScrollBar::BHScrollBar(BRect bounds, const char *name, BView *target) +BHScrollBar::BHScrollBar(BRect bounds, const char* name, BView* target) : BScrollBar(bounds, name, target, 0, 1, B_HORIZONTAL), fTitleView(0) { @@ -9910,7 +9909,7 @@ BHScrollBar::ValueChanged(float value) } -TPoseViewFilter::TPoseViewFilter(BPoseView *pose) +TPoseViewFilter::TPoseViewFilter(BPoseView* pose) : BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), fPoseView(pose) { @@ -9923,7 +9922,7 @@ TPoseViewFilter::~TPoseViewFilter() filter_result -TPoseViewFilter::Filter(BMessage *message, BHandler **) +TPoseViewFilter::Filter(BMessage* message, BHandler**) { filter_result result = B_DISPATCH_MESSAGE; @@ -9944,5 +9943,5 @@ TPoseViewFilter::Filter(BMessage *message, BHandler **) float BPoseView::sFontHeight = -1; font_height BPoseView::sFontInfo = { 0, 0, 0 }; BFont BPoseView::sCurrentFont; -OffscreenBitmap *BPoseView::sOffscreen = new OffscreenBitmap; +OffscreenBitmap* BPoseView::sOffscreen = new OffscreenBitmap; BString BPoseView::sMatchString = ""; diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index ce6fd0b728..81e3b3de18 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -31,17 +31,17 @@ 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. */ - -// -// BPoseView is a container for poses, handling all of the interaction, drawing, -// etc. The three different view modes are handled here. -// -// this is by far the fattest Tracker class and over time will undergo a lot of -// trimming - #ifndef _POSE_VIEW_H #define _POSE_VIEW_H + +// BPoseView is a container for poses, handling all of the interaction, drawing, +// etc. The three different view modes are handled here. +// +// this is by far the fattest Tracker class and over time will undergo a lot of +// trimming + + #include "AttributeStream.h" #include "ContainerWindow.h" #include "Model.h" @@ -104,42 +104,42 @@ const uint32 kCheckTypeahead = 'Tcty'; class BPoseView : public BView { public: - BPoseView(Model *, BRect, uint32 viewMode, uint32 resizeMask = B_FOLLOW_ALL); + BPoseView(Model*, BRect, uint32 viewMode, uint32 resizeMask = B_FOLLOW_ALL); virtual ~BPoseView(); // setup, teardown - virtual void Init(AttributeStreamNode *); - virtual void Init(const BMessage &); + virtual void Init(AttributeStreamNode*); + virtual void Init(const BMessage&); void InitCommon(); virtual void DetachedFromWindow(); // Returns true if for instance, node ref is a remote desktop directory and // this is a desktop pose view. - virtual bool Represents(const node_ref *) const; - virtual bool Represents(const entry_ref *) const; + virtual bool Represents(const node_ref*) const; + virtual bool Represents(const entry_ref*) const; - BContainerWindow *ContainerWindow() const; - const char *ViewStateAttributeName() const; - const char *ForeignViewStateAttributeName() const; - Model *TargetModel() const; + BContainerWindow* ContainerWindow() const; + const char* ViewStateAttributeName() const; + const char* ForeignViewStateAttributeName() const; + Model* TargetModel() const; virtual bool IsFilePanel() const; bool IsDesktopWindow() const; virtual bool IsDesktopView() const; // state saving/restoring - virtual void SaveState(AttributeStreamNode *node); - virtual void RestoreState(AttributeStreamNode *); - virtual void RestoreColumnState(AttributeStreamNode *); - void AddColumnList(BObjectList *list); - virtual void SaveColumnState(AttributeStreamNode *); - virtual void SavePoseLocations(BRect *frameIfDesktop = NULL); + virtual void SaveState(AttributeStreamNode* node); + virtual void RestoreState(AttributeStreamNode*); + virtual void RestoreColumnState(AttributeStreamNode*); + void AddColumnList(BObjectList*list); + virtual void SaveColumnState(AttributeStreamNode*); + virtual void SavePoseLocations(BRect* frameIfDesktop = NULL); void DisableSaveLocation(); - virtual void SaveState(BMessage &) const; - virtual void RestoreState(const BMessage &); - virtual void RestoreColumnState(const BMessage &); - virtual void SaveColumnState(BMessage &) const; + virtual void SaveState(BMessage&) const; + virtual void RestoreState(const BMessage&); + virtual void RestoreColumnState(const BMessage&); + virtual void SaveColumnState(BMessage&) const; bool StateNeedsSaving(); @@ -148,8 +148,8 @@ class BPoseView : public BView { uint32 ViewMode() const; // re-use the pose view for a new directory - virtual void SwitchDir(const entry_ref *, - AttributeStreamNode *node = NULL); + virtual void SwitchDir(const entry_ref*, + AttributeStreamNode* node = NULL); // in the rare cases where a pose view needs to be explicitly refreshed // (for instance in a query window with a dynamic date query), this is @@ -157,19 +157,19 @@ class BPoseView : public BView { virtual void Refresh(); // callbacks - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); virtual void AttachedToWindow(); virtual void WindowActivated(bool); virtual void MakeFocus(bool = true); virtual void Draw(BRect update_rect); virtual void DrawAfterChildren(BRect update_rect); - virtual void MouseMoved(BPoint, uint32, const BMessage *); + virtual void MouseMoved(BPoint, uint32, const BMessage*); virtual void MouseDown(BPoint where); virtual void MouseUp(BPoint where); - virtual void MouseDragged(const BMessage *); - virtual void MouseLongDown(const BMessage *); - virtual void MouseIdle(const BMessage *); - virtual void KeyDown(const char *, int32); + virtual void MouseDragged(const BMessage*); + virtual void MouseLongDown(const BMessage*); + virtual void MouseIdle(const BMessage*); + virtual void KeyDown(const char*, int32); virtual void Pulse(); virtual void MoveBy(float, float); virtual void ScrollTo(BPoint point); @@ -187,10 +187,10 @@ class BPoseView : public BView { void SetAutoScroll(bool); void SetPoseEditing(bool); - void UpdateIcon(BPose *pose); + void UpdateIcon(BPose* pose); // file change notification handler - virtual bool FSNotification(const BMessage *); + virtual bool FSNotification(const BMessage*); // scrollbars virtual void UpdateScrollRange(); @@ -212,8 +212,8 @@ class BPoseView : public BView { uint32 SecondarySort() const; uint32 SecondarySortType() const; bool ReverseSort() const; - void CheckPoseSortOrder(BPose *, int32 index); - void CheckPoseVisibility(BRect * = NULL); + void CheckPoseSortOrder(BPose*, int32 index); + void CheckPoseVisibility(BRect* = NULL); // make sure pose fits the screen and/or window bounds if needed // view metrics @@ -228,7 +228,7 @@ class BPoseView : public BView { icon_size IconSize() const; BRect Extent() const; - void GetLayoutInfo(uint32 viewMode, BPoint *grid, BPoint *offset) const; + void GetLayoutInfo(uint32 viewMode, BPoint* grid, BPoint* offset) const; int32 CountItems() const; void UpdateCount(); @@ -243,37 +243,37 @@ class BPoseView : public BView { // column handling void ColumnRedraw(BRect updateRect); - bool AddColumn(BColumn *, const BColumn *after = NULL); - bool RemoveColumn(BColumn *column, bool runAlert); - void MoveColumnTo(BColumn *src, BColumn *dest); - bool ResizeColumnToWidest(BColumn *column); - BPoint ResizeColumn(BColumn *, float, float *lastLineDrawPos = NULL, - void (*drawLineFunc)(BPoseView *, BPoint, BPoint) = 0, - void (*undrawLineFunc)(BPoseView *, BPoint, BPoint) = 0); + bool AddColumn(BColumn*, const BColumn* after = NULL); + bool RemoveColumn(BColumn* column, bool runAlert); + void MoveColumnTo(BColumn* src, BColumn* dest); + bool ResizeColumnToWidest(BColumn* column); + BPoint ResizeColumn(BColumn*, float, float* lastLineDrawPos = NULL, + void (*drawLineFunc)(BPoseView*, BPoint, BPoint) = 0, + void (*undrawLineFunc)(BPoseView*, BPoint, BPoint) = 0); // returns the bottom right of the last pose drawn or bottom right of // bounds - BColumn *ColumnAt(int32 index) const; - BColumn *ColumnFor(uint32 attribute_hash) const; - BColumn *FirstColumn() const; - BColumn *LastColumn() const; - int32 IndexOfColumn(const BColumn *) const; + BColumn* ColumnAt(int32 index) const; + BColumn* ColumnFor(uint32 attribute_hash) const; + BColumn* FirstColumn() const; + BColumn* LastColumn() const; + int32 IndexOfColumn(const BColumn*) const; int32 CountColumns() const; // pose access - int32 IndexOfPose(const BPose *) const; - BPose *PoseAtIndex(int32 index) const; + int32 IndexOfPose(const BPose*) const; + BPose* PoseAtIndex(int32 index) const; - BPose *FindPose(BPoint where, int32 *index = NULL) const; + BPose* FindPose(BPoint where, int32* index = NULL) const; // return pose at location h, v (search list starting from bottom so // drawing and hit detection reflect the same pose ordering) - BPose *FindPose(const Model *, int32 *index = NULL) const; - BPose *FindPose(const node_ref *, int32 *index = NULL) const; - BPose *FindPose(const entry_ref *, int32 *index = NULL) const; - BPose *FindPose(const entry_ref *, int32 specifierForm, int32 *index) const; + BPose* FindPose(const Model*, int32* index = NULL) const; + BPose* FindPose(const node_ref*, int32* index = NULL) const; + BPose* FindPose(const entry_ref*, int32* index = NULL) const; + BPose* FindPose(const entry_ref*, int32 specifierForm, int32* index) const; // special form of FindPose used for scripting, may // ask for previous or next pose - BPose *DeepFindPose(const node_ref *node, int32 *index = NULL) const; + BPose* DeepFindPose(const node_ref* node, int32* index = NULL) const; // same as FindPose, node can be a target of the actual // pose if the pose is a symlink @@ -284,108 +284,108 @@ class BPoseView : public BView { void UnmountSelectedVolumes(); virtual void OpenParent(); - virtual void OpenSelection(BPose *clicked_pose = NULL, int32 *index = NULL); - void OpenSelectionUsing(BPose *clicked_pose = NULL, int32 *index = NULL); + virtual void OpenSelection(BPose* clicked_pose = NULL, int32* index = NULL); + void OpenSelectionUsing(BPose* clicked_pose = NULL, int32* index = NULL); // launches the open with window - virtual void MoveSelectionTo(BPoint, BPoint, BContainerWindow *); - void DuplicateSelection(BPoint *dropStart = NULL, BPoint *dropEnd = NULL); + virtual void MoveSelectionTo(BPoint, BPoint, BContainerWindow*); + void DuplicateSelection(BPoint* dropStart = NULL, BPoint* dropEnd = NULL); // Move to trash calls try to select the next pose in the view when they // are dones virtual void MoveSelectionToTrash(bool selectNext = true); virtual void DeleteSelection(bool selectNext = true, bool askUser = true); - virtual void MoveEntryToTrash(const entry_ref *, bool selectNext = true); + virtual void MoveEntryToTrash(const entry_ref*, bool selectNext = true); void RestoreSelectionFromTrash(bool selectNext = true); // selection - PoseList *SelectionList() const; + PoseList* SelectionList() const; void SelectAll(); void InvertSelection(); - int32 SelectMatchingEntries(const BMessage *); + int32 SelectMatchingEntries(const BMessage*); void ShowSelectionWindow(); void ClearSelection(); void ShowSelection(bool); - void AddRemovePoseFromSelection(BPose *pose, int32 index, bool select); + void AddRemovePoseFromSelection(BPose* pose, int32 index, bool select); - BLooper *SelectionHandler(); - void SetSelectionHandler(BLooper *); + BLooper* SelectionHandler(); + void SetSelectionHandler(BLooper*); - BObjectList *MimeTypesInSelection(); + BObjectList*MimeTypesInSelection(); // pose selection - void SelectPose(BPose *, int32 index, bool scrollIntoView = true); - void AddPoseToSelection(BPose *, int32 index, + void SelectPose(BPose*, int32 index, bool scrollIntoView = true); + void AddPoseToSelection(BPose*, int32 index, bool scrollIntoView = true); - void RemovePoseFromSelection(BPose *); + void RemovePoseFromSelection(BPose*); void SelectPoseAtLocation(BPoint); void SelectPoses(int32 start, int32 end); // pose handling - void ScrollIntoView(BPose *pose, int32 index); + void ScrollIntoView(BPose* pose, int32 index); void ScrollIntoView(BRect poseRect); - void SetActivePose(BPose *); - BPose *ActivePose() const; + void SetActivePose(BPose*); + BPose* ActivePose() const; void CommitActivePose(bool saveChanges = true); - static bool PoseVisible(const Model *, const PoseInfo *); - bool FrameForPose(BPose *targetpose, bool convert, BRect *poseRect); - bool CreateSymlinkPoseTarget(Model *symlink); + static bool PoseVisible(const Model*, const PoseInfo*); + bool FrameForPose(BPose* targetpose, bool convert, BRect* poseRect); + bool CreateSymlinkPoseTarget(Model* symlink); // used to complete a symlink pose; returns true if // target symlink should not be shown void ResetPosePlacementHint(); - void PlaceFolder(const entry_ref *, const BMessage *); + void PlaceFolder(const entry_ref*, const BMessage*); // clipboard handling for poses inline bool HasPosesInClipboard(); inline void SetHasPosesInClipboard(bool hasPoses); void SetPosesClipboardMode(uint32 clipboardMode); - void UpdatePosesClipboardModeFromClipboard(BMessage *clipboardReport = NULL); + void UpdatePosesClipboardModeFromClipboard(BMessage* clipboardReport = NULL); // filtering - void SetRefFilter(BRefFilter *); - BRefFilter *RefFilter() const; + void SetRefFilter(BRefFilter*); + BRefFilter* RefFilter() const; // access for mime types represented in the pose view void AddMimeType(const char* mimeType); - const char *MimeTypeAt(int32 index); + const char* MimeTypeAt(int32 index); int32 CountMimeTypes(); void RefreshMimeTypeList(); // drag&drop handling - virtual bool HandleMessageDropped(BMessage *); - static bool HandleDropCommon(BMessage *dragMessage, Model *target, BPose *, - BView *view, BPoint dropPt); + virtual bool HandleMessageDropped(BMessage*); + static bool HandleDropCommon(BMessage* dragMessage, Model* target, BPose*, + BView* view, BPoint dropPt); // used by pose views and info windows - static bool CanHandleDragSelection(const Model *target, - const BMessage *dragMessage, bool ignoreTypes); - virtual void DragSelectedPoses(const BPose *clickedPose, BPoint); + static bool CanHandleDragSelection(const Model* target, + const BMessage* dragMessage, bool ignoreTypes); + virtual void DragSelectedPoses(const BPose* clickedPose, BPoint); - void MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, + void MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow, bool forceCopy, bool forceMove = false, bool createLink = false, bool relativeLink = false); - static void MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, - BContainerWindow *destWindow, uint32 buttons, BPoint loc, + static void MoveSelectionInto(Model* destFolder, BContainerWindow* srcWindow, + BContainerWindow* destWindow, uint32 buttons, BPoint loc, bool forceCopy, bool forceMove = false, bool createLink = false, bool relativeLink = false, BPoint clickPt = BPoint(0, 0), bool pinToGrid = false); - bool UpdateDropTarget(BPoint, const BMessage *, bool trackingContextMenu); + bool UpdateDropTarget(BPoint, const BMessage*, bool trackingContextMenu); // return true if drop target changed void HiliteDropTarget(bool hiliteState); void DragStop(); // throw away cached up structures - static bool MenuTrackingHook(BMenu *menu, void *castToThis); + static bool MenuTrackingHook(BMenu* menu, void* castToThis); // hook for spring loaded nav-menus // scripting - virtual BHandler *ResolveSpecifier(BMessage *message, int32 index, - BMessage *specifier, int32 form, const char *property); - virtual status_t GetSupportedSuites(BMessage *); + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 form, const char* property); + virtual status_t GetSupportedSuites(BMessage*); // string width calls that use local width caches, faster than using // the general purpose BView::StringWidth - float StringWidth(const char *) const; - float StringWidth(const char *, int32) const; + float StringWidth(const char*) const; + float StringWidth(const char*, int32) const; // deliberately hide the BView StringWidth here - this makes it // easy to have the right StringWidth picked up by // template instantiation, as used by WidgetAttributeText @@ -405,73 +405,73 @@ class BPoseView : public BView { // type ahead filtering bool IsFiltering() const; - void UpdateDateColumns(BMessage *); - virtual void AdaptToVolumeChange(BMessage *); - virtual void AdaptToDesktopIntegrationChange(BMessage *); + void UpdateDateColumns(BMessage*); + virtual void AdaptToVolumeChange(BMessage*); + virtual void AdaptToDesktopIntegrationChange(BMessage*); protected: // view setup virtual void SetUpDefaultColumnsIfNeeded(); - virtual EntryListBase *InitDirentIterator(const entry_ref *); + virtual EntryListBase* InitDirentIterator(const entry_ref*); // sets up an entry iterator for _add_poses_ // overriden by QueryPoseView, etc. to provide different iteration void Cleanup(bool doAll = false); // clean up poses - void NewFolder(const BMessage *); + void NewFolder(const BMessage*); // create a new folder, optionally specify a location - void NewFileFromTemplate(const BMessage *); + void NewFileFromTemplate(const BMessage*); // create a new file based on a template, optionally specify a location void ShowContextMenu(BPoint); // scripting handlers - virtual bool HandleScriptingMessage(BMessage *message); - bool SetProperty(BMessage *message, BMessage *specifier, int32 form, - const char *property, BMessage *reply); - bool GetProperty(BMessage *, int32, const char *, BMessage *); - bool CreateProperty(BMessage *message, BMessage *specifier, int32, - const char *, BMessage *reply); - bool ExecuteProperty(BMessage *specifier, int32, const char *, BMessage *reply); - bool CountProperty(BMessage *, int32, const char *, BMessage *); - bool DeleteProperty(BMessage *, int32, const char *, BMessage *); + virtual bool HandleScriptingMessage(BMessage* message); + bool SetProperty(BMessage* message, BMessage* specifier, int32 form, + const char* property, BMessage* reply); + bool GetProperty(BMessage*, int32, const char*, BMessage*); + bool CreateProperty(BMessage* message, BMessage* specifier, int32, + const char*, BMessage* reply); + bool ExecuteProperty(BMessage* specifier, int32, const char*, BMessage* reply); + bool CountProperty(BMessage*, int32, const char*, BMessage*); + bool DeleteProperty(BMessage*, int32, const char*, BMessage*); void ClearPoses(); // remove all the current poses from the view // pose info read/write calls - void ReadPoseInfo(Model *, PoseInfo *); - ExtendedPoseInfo *ReadExtendedPoseInfo(Model *); + void ReadPoseInfo(Model*, PoseInfo*); + ExtendedPoseInfo* ReadExtendedPoseInfo(Model*); - void _CheckPoseSortOrder(PoseList *list, BPose *, int32 index); + void _CheckPoseSortOrder(PoseList* list, BPose*, int32 index); // pose creation - BPose *EntryCreated(const node_ref *, const node_ref *, const char *, int32 *index = 0); + BPose* EntryCreated(const node_ref*, const node_ref*, const char*, int32* index = 0); - void AddPoseToList(PoseList *list, bool visibleList, bool insertionSort, - BPose *pose, BRect &viewBounds, float &listViewScrollBy, - bool forceDraw, int32 *indexPtr = NULL); - BPose *CreatePose(Model *, PoseInfo *, bool insertionSort = true, - int32 *index = 0, BRect *boundsPtr = 0, bool forceDraw = true); - virtual void CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 count, - BPose **resultingPoses, bool insertionSort = true, int32 *lastPoseIndexPtr = 0, - BRect *boundsPtr = 0, bool forceDraw = false); - virtual bool ShouldShowPose(const Model *, const PoseInfo *); + void AddPoseToList(PoseList* list, bool visibleList, bool insertionSort, + BPose* pose, BRect&viewBounds, float&listViewScrollBy, + bool forceDraw, int32* indexPtr = NULL); + BPose* CreatePose(Model*, PoseInfo*, bool insertionSort = true, + int32* index = 0, BRect* boundsPtr = 0, bool forceDraw = true); + virtual void CreatePoses(Model**models, PoseInfo* poseInfoArray, int32 count, + BPose**resultingPoses, bool insertionSort = true, int32* lastPoseIndexPtr = 0, + BRect* boundsPtr = 0, bool forceDraw = false); + virtual bool ShouldShowPose(const Model*, const PoseInfo*); // filter, subclasses override to control which poses show up // subclasses should always call inherited - void CreateVolumePose(BVolume *, bool watchIndividually); + void CreateVolumePose(BVolume*, bool watchIndividually); void CreateTrashPose(); - virtual bool AddPosesThreadValid(const entry_ref *) const; + virtual bool AddPosesThreadValid(const entry_ref*) const; // verifies whether or not the current set of AddPoses threads // are valid and allowed to be adding poses -- returns false // in the case where the directory has been switched while populating // the view - virtual void AddPoses(Model *model = NULL); + virtual void AddPoses(Model* model = NULL); // if is zero, PoseView has other means of iterating through all // the entries thaat it adds @@ -483,109 +483,109 @@ class BPoseView : public BView { virtual void RemoveRootPoses(); virtual void AddTrashPoses(); - virtual bool DeletePose(const node_ref *, BPose *pose = NULL, int32 index = 0); - virtual void DeleteSymLinkPoseTarget(const node_ref *itemNode, BPose *pose, + virtual bool DeletePose(const node_ref*, BPose* pose = NULL, int32 index = 0); + virtual void DeleteSymLinkPoseTarget(const node_ref* itemNode, BPose* pose, int32 index); // the pose itself wasn't deleted but it's target node was - the // pose must be a symlink - static void PoseHandleDeviceUnmounted(BPose *pose, Model *model, int32 index, - BPoseView *poseView, dev_t device); - static void RemoveNonBootDesktopModels(BPose *, Model *model, int32, - BPoseView *poseView, dev_t); + static void PoseHandleDeviceUnmounted(BPose* pose, Model* model, int32 index, + BPoseView* poseView, dev_t device); + static void RemoveNonBootDesktopModels(BPose*, Model* model, int32, + BPoseView* poseView, dev_t); // pose placement void CheckAutoPlacedPoses(); // find poses that need placing and place them in a new spot - void PlacePose(BPose *, BRect &); + void PlacePose(BPose*, BRect&); // find a new place for a pose, starting at fHintLocation and place it - bool IsValidLocation(const BPose *pose); + bool IsValidLocation(const BPose* pose); bool IsValidLocation(const BRect& rect); status_t GetDeskbarFrame(BRect* frame); bool SlotOccupied(BRect poseRect, BRect viewBounds) const; - void NextSlot(BPose *, BRect &poseRect, BRect viewBounds); - void TrySettingPoseLocation(BNode *node, BPoint point); + void NextSlot(BPose*, BRect&poseRect, BRect viewBounds); + void TrySettingPoseLocation(BNode* node, BPoint point); BPoint PinToGrid(BPoint, BPoint grid, BPoint offset) const; // zombie pose handling - Model *FindZombie(const node_ref *, int32 *index = 0); - BPose *ConvertZombieToPose(Model *zombie, int32 index); + Model* FindZombie(const node_ref*, int32* index = 0); + BPose* ConvertZombieToPose(Model* zombie, int32 index); // pose handling - BRect CalcPoseRect(const BPose *, int32 index, + BRect CalcPoseRect(const BPose*, int32 index, bool firstColumnOnly = false) const; - BRect CalcPoseRectIcon(const BPose *) const; - BRect CalcPoseRectList(const BPose *, int32 index, + BRect CalcPoseRectIcon(const BPose*) const; + BRect CalcPoseRectList(const BPose*, int32 index, bool firstColumnOnly = false) const; - void DrawPose(BPose *, int32 index, bool fullDraw = true); - void DrawViewCommon(const BRect &updateRect); + void DrawPose(BPose*, int32 index, bool fullDraw = true); + void DrawViewCommon(const BRect&updateRect); // pose list handling - int32 BSearchList(PoseList *poseList, const BPose *, int32 *index, + int32 BSearchList(PoseList* poseList, const BPose*, int32* index, int32 oldIndex); - void InsertPoseAfter(BPose *pose, int32 *index, int32 orientation, - BRect *invalidRect); + void InsertPoseAfter(BPose* pose, int32* index, int32 orientation, + BRect* invalidRect); // does a CopyBits to scroll poses making room for a new pose, // returns rectangle that needs invalidating - void CloseGapInList(BRect *invalidRect); + void CloseGapInList(BRect* invalidRect); int32 FirstIndexAtOrBelow(int32 y, bool constrainIndex = true) const; - void AddToVSList(BPose *); - int32 RemoveFromVSList(const BPose *); - BPose *FindNearbyPose(char arrow, int32 *index); - BPose *FindBestMatch(int32 *index); - BPose *FindNextMatch(int32 *index, bool reverse = false); + void AddToVSList(BPose*); + int32 RemoveFromVSList(const BPose*); + BPose* FindNearbyPose(char arrow, int32* index); + BPose* FindBestMatch(int32* index); + BPose* FindNextMatch(int32* index, bool reverse = false); // node monitoring calls virtual void StartWatching(); virtual void StopWatching(); - status_t WatchNewNode(const node_ref *item); + status_t WatchNewNode(const node_ref* item); // the above would ideally be the only call of these three and it would // be a virtual, overriding the specific watch mask in query pose view, etc. // however we need to call WatchNewNode from inside AddPosesTask while // the window is unlocked - we have to use the static and a cached // messenger and masks. - static status_t WatchNewNode(const node_ref *, uint32, BMessenger); + static status_t WatchNewNode(const node_ref*, uint32, BMessenger); virtual uint32 WatchNewNodeMask(); // override to change different watch modes for query pose view, etc. // drag&drop handling - static bool EachItemInDraggedSelection(const BMessage *message, - bool (*)(BPose *, BPoseView *, void *), BPoseView *poseView, - void * = NULL); + static bool EachItemInDraggedSelection(const BMessage* message, + bool (*)(BPose*, BPoseView*, void*), BPoseView* poseView, + void* = NULL); // iterates through each pose in current selectiond in the source // window of the current drag message; locks the window // add const version BRect GetDragRect(int32 clickedPoseIndex); - BBitmap *MakeDragBitmap(BRect dragRect, BPoint clickedPoint, int32 clickedPoseIndex, BPoint &offset); - static bool FindDragNDropAction(const BMessage *dragMessage, bool &canCopy, - bool &canMove, bool &canLink, bool &canErase); + BBitmap* MakeDragBitmap(BRect dragRect, BPoint clickedPoint, int32 clickedPoseIndex, BPoint&offset); + static bool FindDragNDropAction(const BMessage* dragMessage, bool&canCopy, + bool&canMove, bool&canLink, bool&canErase); - static bool CanTrashForeignDrag(const Model *); - static bool CanCopyOrMoveForeignDrag(const Model *, const BMessage *); - static bool DragSelectionContains(const BPose *target, const BMessage *dragMessage); - static status_t CreateClippingFile(BPoseView *poseView, BFile &result, - char *resultingName, BDirectory *dir, BMessage *message, const char *fallbackName, + static bool CanTrashForeignDrag(const Model*); + static bool CanCopyOrMoveForeignDrag(const Model*, const BMessage*); + static bool DragSelectionContains(const BPose* target, const BMessage* dragMessage); + static status_t CreateClippingFile(BPoseView* poseView, BFile&result, + char* resultingName, BDirectory* dir, BMessage* message, const char* fallbackName, bool setLocation = false, BPoint dropPoint = BPoint(0, 0)); // opening files, lanunching - void OpenSelectionCommon(BPose *, int32 *, bool); + void OpenSelectionCommon(BPose*, int32*, bool); // used by OpenSelection and OpenSelectionUsing - static void LaunchAppWithSelection(Model *, const BMessage *, bool checkTypes = true); + static void LaunchAppWithSelection(Model*, const BMessage*, bool checkTypes = true); // node monitoring calls - virtual bool EntryMoved(const BMessage *); - virtual bool AttributeChanged(const BMessage *); - virtual bool NoticeMetaMimeChanged(const BMessage *); - virtual void MetaMimeChanged(const char *, const char *); + virtual bool EntryMoved(const BMessage*); + virtual bool AttributeChanged(const BMessage*); + virtual bool NoticeMetaMimeChanged(const BMessage*); + virtual void MetaMimeChanged(const char*, const char*); // click handling - bool WasDoubleClick(const BPose *, BPoint); - bool WasClickInPath(const BPose *, int32 index, BPoint) const; + bool WasDoubleClick(const BPose*, BPoint); + bool WasClickInPath(const BPose*, int32 index, BPoint) const; // selection - void SelectPosesListMode(BRect, BList **); - void SelectPosesIconMode(BRect, BList **); - void AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose *); + void SelectPosesListMode(BRect, BList**); + void SelectPosesIconMode(BRect, BList**); + void AddRemoveSelectionRange(BPoint where, bool extendSelection, BPose*); void _BeginSelectionRect(const BPoint& point, bool extendSelection); void _UpdateSelectionRect(const BPoint& point); @@ -600,90 +600,90 @@ class BPoseView : public BView { // view extent handling void RecalcExtent(); - void AddToExtent(const BRect &); + void AddToExtent(const BRect&); void ClearExtent(); - void RemoveFromExtent(const BRect &); + void RemoveFromExtent(const BRect&); virtual void EditQueries(); virtual void AddCountView(); - void HandleAttrMenuItemSelected(BMessage *); + void HandleAttrMenuItemSelected(BMessage*); void TryUpdatingBrokenLinks(); // ran a little after a volume gets mounted - void MapToNewIconMode(BPose *, BPoint oldGrid, BPoint oldOffset); + void MapToNewIconMode(BPose*, BPoint oldGrid, BPoint oldOffset); void ResetOrigin(); - void PinPointToValidRange(BPoint &); + void PinPointToValidRange(BPoint&); // used to ensure pose locations make sense after getting them // in pose info from attributes, etc. - void FinishPendingScroll(float &listViewScrollBy, BRect bounds); + void FinishPendingScroll(float&listViewScrollBy, BRect bounds); // utility call for CreatePoses // background AddPoses task calls - static status_t AddPosesTask(void *); + static status_t AddPosesTask(void*); virtual void AddPosesCompleted(); bool IsValidAddPosesThread(thread_id) const; // typeahead filtering - void EnsurePoseUnselected(BPose *pose); - void RemoveFilteredPose(BPose *pose, int32 index); + void EnsurePoseUnselected(BPose* pose); + void RemoveFilteredPose(BPose* pose, int32 index); void FilterChanged(); void UpdateAfterFilterChange(); - bool FilterPose(BPose *pose); + bool FilterPose(BPose* pose); void StartFiltering(); void StopFiltering(); void ClearFilter(); - PoseList *CurrentPoseList() const; + PoseList* CurrentPoseList() const; // misc - BList *GetDropPointList(BPoint dropPoint, BPoint startPoint, const PoseList *, + BList* GetDropPointList(BPoint dropPoint, BPoint startPoint, const PoseList*, bool sourceInListMode, bool dropOnGrid) const; void SendSelectionAsRefs(uint32 what, bool onlyQueries = false); - void MoveListToTrash(BObjectList *, bool selectNext, bool deleteDirectly); - void Delete(BObjectList *, bool selectNext, bool askUser); - void Delete(const entry_ref &ref, bool selectNext, bool askUser); - void RestoreItemsFromTrash(BObjectList *, bool selectNext); + void MoveListToTrash(BObjectList*, bool selectNext, bool deleteDirectly); + void Delete(BObjectList*, bool selectNext, bool askUser); + void Delete(const entry_ref&ref, bool selectNext, bool askUser); + void RestoreItemsFromTrash(BObjectList*, bool selectNext); private: void DrawOpenAnimation(BRect); - void MoveSelectionOrEntryToTrash(const entry_ref *ref, bool selectNext); + void MoveSelectionOrEntryToTrash(const entry_ref* ref, bool selectNext); protected: - BHScrollBar *fHScrollBar; - BScrollBar *fVScrollBar; - Model *fModel; - BPose *fActivePose; + BHScrollBar* fHScrollBar; + BScrollBar* fVScrollBar; + Model* fModel; + BPose* fActivePose; BRect fExtent; // the following should probably be just member lists, not pointers - PoseList *fPoseList; - PoseList *fFilteredPoseList; - PoseList *fVSPoseList; - PoseList *fSelectionList; + PoseList* fPoseList; + PoseList* fFilteredPoseList; + PoseList* fVSPoseList; + PoseList* fSelectionList; NodeSet fInsertedNodes; BObjectList fMimeTypesInSelectionCache; // used for mime string based icon highliting during a drag - BObjectList *fZombieList; + BObjectList* fZombieList; PendingNodeMonitorCache pendingNodeMonitorCache; - BObjectList *fColumnList; - BObjectList *fMimeTypeList; + BObjectList* fColumnList; + BObjectList* fMimeTypeList; bool fMimeTypeListIsDirty; - BViewState *fViewState; + BViewState* fViewState; bool fStateNeedsSaving; - BCountView *fCountView; + BCountView* fCountView; float fListElemHeight; float fIconPoseHeight; - BPose *fDropTarget; - BPose *fAlreadySelectedDropTarget; - BLooper *fSelectionHandler; + BPose* fDropTarget; + BPose* fAlreadySelectedDropTarget; + BLooper* fSelectionHandler; BPoint fLastClickPt; bigtime_t fLastClickTime; - const BPose *fLastClickedPose; + const BPose* fLastClickedPose; BPoint fLastLeftTop; BRect fLastExtent; - BTitleView *fTitleView; - BRefFilter *fRefFilter; + BTitleView* fTitleView; + BRefFilter* fRefFilter; BPoint fGrid; BPoint fOffset; BPoint fHintLocation; @@ -691,9 +691,9 @@ class BPoseView : public BView { int32 fAutoScrollState; std::set fAddPosesThreads; bool fWidgetTextOutline; - const BPose *fSelectionPivotPose; - const BPose *fRealPivotPose; - BMessageRunner *fKeyRunner; + const BPose* fSelectionPivotPose; + const BPose* fRealPivotPose; + BMessageRunner* fKeyRunner; bool fTrackRightMouseUp; struct SelectionRectInfo { @@ -743,7 +743,7 @@ class BPoseView : public BView { bigtime_t fLastDeskbarFrameCheckTime; BRect fDeskbarFrame; - static OffscreenBitmap *sOffscreen; + static OffscreenBitmap* sOffscreen; typedef BView _inherited; }; @@ -751,14 +751,14 @@ class BPoseView : public BView { class BHScrollBar : public BScrollBar { public: - BHScrollBar(BRect, const char *, BView *); - void SetTitleView(BView *); + BHScrollBar(BRect, const char*, BView*); + void SetTitleView(BView*); // BScrollBar overrides virtual void ValueChanged(float); private: - BView *fTitleView; + BView* fTitleView; typedef BScrollBar _inherited; }; @@ -766,30 +766,30 @@ class BHScrollBar : public BScrollBar { class TPoseViewFilter : public BMessageFilter { public: - TPoseViewFilter(BPoseView *pose); + TPoseViewFilter(BPoseView* pose); ~TPoseViewFilter(); - filter_result Filter(BMessage *, BHandler **); + filter_result Filter(BMessage*, BHandler**); private: - filter_result ObjectDropFilter(BMessage *, BHandler **); + filter_result ObjectDropFilter(BMessage*, BHandler**); - BPoseView *fPoseView; + BPoseView* fPoseView; }; extern bool -ClearViewOriginOne(const char *name, uint32 type, off_t size, void *data, void *params); +ClearViewOriginOne(const char* name, uint32 type, off_t size, void* data, void* params); // inlines follow -inline BContainerWindow * +inline BContainerWindow* BPoseView::ContainerWindow() const { - return dynamic_cast(Window()); + return dynamic_cast(Window()); } -inline Model * +inline Model* BPoseView::TargetModel() const { return fModel; @@ -819,16 +819,16 @@ BPoseView::IconSize() const return (icon_size)fViewState->IconSize(); } -inline PoseList * +inline PoseList* BPoseView::SelectionList() const { return fSelectionList; } -inline BObjectList * +inline BObjectList* BPoseView::MimeTypesInSelection() { - return &fMimeTypesInSelectionCache; + return&fMimeTypesInSelectionCache; } inline BHScrollBar* @@ -873,7 +873,7 @@ BPoseView::FontHeight() const return sFontHeight; } -inline BPose * +inline BPose* BPoseView::ActivePose() const { return fActivePose; @@ -946,7 +946,7 @@ BPoseView::SetIconMapping(bool on) } inline void -BPoseView::AddToExtent(const BRect &rect) +BPoseView::AddToExtent(const BRect&rect) { fExtent = fExtent | rect; } @@ -966,34 +966,34 @@ BPoseView::CountColumns() const inline int32 BPoseView::IndexOfColumn(const BColumn* column) const { - return fColumnList->IndexOf(const_cast(column)); + return fColumnList->IndexOf(const_cast(column)); } inline int32 -BPoseView::IndexOfPose(const BPose *pose) const +BPoseView::IndexOfPose(const BPose* pose) const { return CurrentPoseList()->IndexOf(pose); } -inline BPose * +inline BPose* BPoseView::PoseAtIndex(int32 index) const { return CurrentPoseList()->ItemAt(index); } -inline BColumn * +inline BColumn* BPoseView::ColumnAt(int32 index) const { return fColumnList->ItemAt(index); } -inline BColumn * +inline BColumn* BPoseView::FirstColumn() const { return fColumnList->FirstItem(); } -inline BColumn * +inline BColumn* BPoseView::LastColumn() const { return fColumnList->LastItem(); @@ -1061,43 +1061,43 @@ BPoseView::SetEnsurePosesVisible(bool state) } inline void -BPoseView::SetSelectionHandler(BLooper *looper) +BPoseView::SetSelectionHandler(BLooper* looper) { fSelectionHandler = looper; } inline void -BPoseView::SetRefFilter(BRefFilter *filter) +BPoseView::SetRefFilter(BRefFilter* filter) { fRefFilter = filter; } -inline BRefFilter * +inline BRefFilter* BPoseView::RefFilter() const { return fRefFilter; } inline void -BHScrollBar::SetTitleView(BView *view) +BHScrollBar::SetTitleView(BView* view) { fTitleView = view; } -inline BPose * -BPoseView::FindPose(const Model *model, int32 *index) const +inline BPose* +BPoseView::FindPose(const Model* model, int32* index) const { return CurrentPoseList()->FindPose(model, index); } -inline BPose * -BPoseView::FindPose(const node_ref *node, int32 *index) const +inline BPose* +BPoseView::FindPose(const node_ref* node, int32* index) const { return CurrentPoseList()->FindPose(node, index); } -inline BPose * -BPoseView::FindPose(const entry_ref *entry, int32 *index) const +inline BPose* +BPoseView::FindPose(const entry_ref* entry, int32* index) const { return CurrentPoseList()->FindPose(entry, index); } @@ -1117,7 +1117,7 @@ BPoseView::SetHasPosesInClipboard(bool hasPoses) } -inline PoseList * +inline PoseList* BPoseView::CurrentPoseList() const { return fFiltering ? fFilteredPoseList : fPoseList; @@ -1126,15 +1126,15 @@ BPoseView::CurrentPoseList() const template void -EachTextWidget(BPose *pose, BPoseView *poseView, - void (*func)(BTextWidget *, BPose *, BPoseView *, BColumn *, Param1), Param1 p1) +EachTextWidget(BPose* pose, BPoseView* poseView, + void (*func)(BTextWidget*, BPose*, BPoseView*, BColumn*, Param1), Param1 p1) { for (int32 index = 0; ;index++) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; - BTextWidget *widget = pose->WidgetFor(column->AttrHash()); + BTextWidget* widget = pose->WidgetFor(column->AttrHash()); if (widget) (func)(widget, pose, poseView, column, p1); } @@ -1143,16 +1143,16 @@ EachTextWidget(BPose *pose, BPoseView *poseView, template void -EachTextWidget(BPose *pose, BPoseView *poseView, - void (*func)(BTextWidget *, BPose *, BPoseView *, BColumn *, +EachTextWidget(BPose* pose, BPoseView* poseView, + void (*func)(BTextWidget*, BPose*, BPoseView*, BColumn*, Param1, Param2), Param1 p1, Param2 p2) { for (int32 index = 0; ;index++) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; - BTextWidget *widget = pose->WidgetFor(column->AttrHash()); + BTextWidget* widget = pose->WidgetFor(column->AttrHash()); if (widget) (func)(widget, pose, poseView, column, p1, p2); } @@ -1161,16 +1161,16 @@ EachTextWidget(BPose *pose, BPoseView *poseView, template Result -WhileEachTextWidget(BPose *pose, BPoseView *poseView, - Result (*func)(BTextWidget *, BPose *, BPoseView *, BColumn *, +WhileEachTextWidget(BPose* pose, BPoseView* poseView, + Result (*func)(BTextWidget*, BPose*, BPoseView*, BColumn*, Param1, Param2), Param1 p1, Param2 p2) { for (int32 index = 0; ;index++) { - BColumn *column = poseView->ColumnAt(index); + BColumn* column = poseView->ColumnAt(index); if (!column) break; - BTextWidget *widget = pose->WidgetFor(column->AttrHash()); + BTextWidget* widget = pose->WidgetFor(column->AttrHash()); if (widget) { Result result = (func)(widget, pose, poseView, column, p1, p2); if (result) @@ -1185,4 +1185,4 @@ WhileEachTextWidget(BPose *pose, BPoseView *poseView, using namespace BPrivate; -#endif /* _POSE_VIEW_H */ +#endif // _POSE_VIEW_H diff --git a/src/kits/tracker/PoseViewScripting.cpp b/src/kits/tracker/PoseViewScripting.cpp index 51a76d493c..d668e6dd9a 100644 --- a/src/kits/tracker/PoseViewScripting.cpp +++ b/src/kits/tracker/PoseViewScripting.cpp @@ -203,12 +203,13 @@ const property_info kPosesPropertyList[] = { #endif + status_t -BPoseView::GetSupportedSuites(BMessage *_SCRIPTING_ONLY(data)) +BPoseView::GetSupportedSuites(BMessage* _SCRIPTING_ONLY(data)) { #if _SUPPORTS_FEATURE_SCRIPTING data->AddString("suites", kPosesSuites); - BPropertyInfo propertyInfo(const_cast(kPosesPropertyList)); + BPropertyInfo propertyInfo(const_cast(kPosesPropertyList)); data->AddFlat("messages", &propertyInfo); return _inherited::GetSupportedSuites(data); @@ -217,8 +218,9 @@ BPoseView::GetSupportedSuites(BMessage *_SCRIPTING_ONLY(data)) #endif } + bool -BPoseView::HandleScriptingMessage(BMessage *_SCRIPTING_ONLY(message)) +BPoseView::HandleScriptingMessage(BMessage* _SCRIPTING_ONLY(message)) { #if _SUPPORTS_FEATURE_SCRIPTING if (message->what != B_GET_PROPERTY @@ -231,7 +233,7 @@ BPoseView::HandleScriptingMessage(BMessage *_SCRIPTING_ONLY(message)) // dispatch scripting messages BMessage reply(B_REPLY); - const char *property = 0; + const char* property = 0; bool handled = false; int32 index = 0; @@ -240,7 +242,7 @@ BPoseView::HandleScriptingMessage(BMessage *_SCRIPTING_ONLY(message)) status_t result = message->GetCurrentSpecifier(&index, &specifier, &form, &property); - if (result != B_OK || index == -1) + if (result != B_OK || index == -1) return false; ASSERT(property); @@ -271,19 +273,22 @@ BPoseView::HandleScriptingMessage(BMessage *_SCRIPTING_ONLY(message)) break; } - if (handled) + if (handled) { // done handling message, send a reply message->SendReply(&reply); + } + return handled; #else return false; #endif } + bool -BPoseView::ExecuteProperty(BMessage *_SCRIPTING_ONLY(specifier), - int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property), - BMessage *_SCRIPTING_ONLY(reply)) +BPoseView::ExecuteProperty(BMessage* _SCRIPTING_ONLY(specifier), + int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), + BMessage* _SCRIPTING_ONLY(reply)) { #if _SUPPORTS_FEATURE_SCRIPTING status_t error = B_OK; @@ -303,7 +308,7 @@ BPoseView::ExecuteProperty(BMessage *_SCRIPTING_ONLY(specifier), int32 specifyingIndex; for (int32 index = 0; specifier->FindInt32("index", index, &specifyingIndex) == B_OK; index++) { - BPose *pose = PoseAtIndex(specifyingIndex); + BPose* pose = PoseAtIndex(specifyingIndex); if (!pose) { error = B_ENTRY_NOT_FOUND; @@ -334,10 +339,11 @@ BPoseView::ExecuteProperty(BMessage *_SCRIPTING_ONLY(specifier), #endif } + bool -BPoseView::CreateProperty(BMessage *_SCRIPTING_ONLY(specifier), BMessage *, - int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property), - BMessage *_SCRIPTING_ONLY(reply)) +BPoseView::CreateProperty(BMessage* _SCRIPTING_ONLY(specifier), BMessage*, + int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), + BMessage* _SCRIPTING_ONLY(reply)) { #if _SUPPORTS_FEATURE_SCRIPTING status_t error = B_OK; @@ -357,7 +363,7 @@ BPoseView::CreateProperty(BMessage *_SCRIPTING_ONLY(specifier), BMessage *, == B_OK; index++) { int32 poseIndex; - BPose *pose = FindPose(&ref, form, &poseIndex); + BPose* pose = FindPose(&ref, form, &poseIndex); if (!pose) { error = B_ENTRY_NOT_FOUND; @@ -374,7 +380,7 @@ BPoseView::CreateProperty(BMessage *_SCRIPTING_ONLY(specifier), BMessage *, for (int32 index = 0; specifier->FindInt32("data", index, &specifyingIndex) == B_OK; index++) { - BPose *pose = PoseAtIndex(specifyingIndex); + BPose* pose = PoseAtIndex(specifyingIndex); if (!pose) { error = B_BAD_INDEX; handled = true; @@ -396,10 +402,11 @@ BPoseView::CreateProperty(BMessage *_SCRIPTING_ONLY(specifier), BMessage *, #endif } + bool -BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier), - int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property), - BMessage *_SCRIPTING_ONLY(reply)) +BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier), + int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), + BMessage* _SCRIPTING_ONLY(reply)) { #if _SUPPORTS_FEATURE_SCRIPTING status_t error = B_OK; @@ -416,7 +423,7 @@ BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier), == B_OK; index++) { int32 poseIndex; - BPose *pose = FindPose(&ref, form, &poseIndex); + BPose* pose = FindPose(&ref, form, &poseIndex); if (!pose) { error = B_ENTRY_NOT_FOUND; @@ -432,7 +439,7 @@ BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier), int32 specifyingIndex; for (int32 index = 0; specifier->FindInt32("index", index, &specifyingIndex) == B_OK; index++) { - BPose *pose = PoseAtIndex(specifyingIndex); + BPose* pose = PoseAtIndex(specifyingIndex); if (!pose) { error = B_BAD_INDEX; @@ -449,8 +456,8 @@ BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier), // deleting entries is handled by moving entries to trash // build a list of entries, specified by the specifier - BObjectList *entryList = new BObjectList(); - // list will be deleted for us by the trashing thread + BObjectList* entryList = new BObjectList(); + // list will be deleted for us by the trashing thread if (form == (int32)B_ENTRY_SPECIFIER) { // move all poses specified by entry_ref to Trash @@ -464,7 +471,7 @@ BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier), int32 specifyingIndex; for (int32 index = 0; specifier->FindInt32("index", index, &specifyingIndex) == B_OK; index++) { - BPose *pose = PoseAtIndex(specifyingIndex); + BPose* pose = PoseAtIndex(specifyingIndex); if (!pose) { error = B_BAD_INDEX; @@ -498,9 +505,10 @@ BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier), #endif } + bool -BPoseView::CountProperty(BMessage *, int32, const char *_SCRIPTING_ONLY(property), - BMessage *_SCRIPTING_ONLY(reply)) +BPoseView::CountProperty(BMessage*, int32, const char* _SCRIPTING_ONLY(property), + BMessage* _SCRIPTING_ONLY(reply)) { #if _SUPPORTS_FEATURE_SCRIPTING bool handled = false; @@ -520,10 +528,11 @@ BPoseView::CountProperty(BMessage *, int32, const char *_SCRIPTING_ONLY(property #endif } + bool -BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier), - int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property), - BMessage *_SCRIPTING_ONLY(reply)) +BPoseView::GetProperty(BMessage* _SCRIPTING_ONLY(specifier), + int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), + BMessage* _SCRIPTING_ONLY(reply)) { #if _SUPPORTS_FEATURE_SCRIPTING // PRINT(("GetProperty %s\n", property)); @@ -535,7 +544,7 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier), handled = true; if (!TargetModel()) error = B_NOT_A_DIRECTORY; - else + else reply->AddRef("result", TargetModel()->EntryRef()); } } else if (strcmp(property, kPropertySelection) == 0) { @@ -543,7 +552,7 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier), switch (form) { case B_DIRECT_SPECIFIER: // return entries of all poses in selection - for (int32 index = 0; index < count; index++) + for (int32 index = 0; index < count; index++) reply->AddRef("result", fSelectionList->ItemAt(index)-> TargetModel()->EntryRef()); @@ -560,7 +569,7 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier), break; int32 poseIndex; - BPose *pose = FindPose(&ref, &poseIndex); + BPose* pose = FindPose(&ref, &poseIndex); for (;;) { if (form == (int32)kPreviousSpecifier) @@ -588,52 +597,56 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier), int32 count = fPoseList->CountItems(); switch (form) { case B_DIRECT_SPECIFIER: + { // return all entries of all poses in PoseView - for (int32 index = 0; index < count; index++) + for (int32 index = 0; index < count; index++) reply->AddRef("result", PoseAtIndex(index)->TargetModel()->EntryRef()); handled = true; break; + } + case B_INDEX_SPECIFIER: - { - // return entry at index - int32 index; - if (specifier->FindInt32("index", &index) != B_OK) - break; - - if (!PoseAtIndex(index)) { - error = B_BAD_INDEX; - handled = true; - break; - } - reply->AddRef("result", PoseAtIndex(index)->TargetModel()->EntryRef()); - + { + // return entry at index + int32 index; + if (specifier->FindInt32("index", &index) != B_OK) + break; + + if (!PoseAtIndex(index)) { + error = B_BAD_INDEX; handled = true; break; } + reply->AddRef("result", PoseAtIndex(index)->TargetModel()->EntryRef()); + + handled = true; + break; + } + case kPreviousSpecifier: case kNextSpecifier: - { - // return entry and index of pose before or after specified pose - entry_ref ref; - if (specifier->FindRef("data", &ref) != B_OK) - break; - - int32 tmp; - BPose *pose = FindPose(&ref, form, &tmp); - - if (!pose) { - error = B_ENTRY_NOT_FOUND; - handled = true; - break; - } - - reply->AddRef("result", pose->TargetModel()->EntryRef()); - reply->AddInt32("index", IndexOfPose(pose)); - + { + // return entry and index of pose before or after specified pose + entry_ref ref; + if (specifier->FindRef("data", &ref) != B_OK) + break; + + int32 tmp; + BPose* pose = FindPose(&ref, form, &tmp); + + if (!pose) { + error = B_ENTRY_NOT_FOUND; handled = true; break; } + + reply->AddRef("result", pose->TargetModel()->EntryRef()); + reply->AddInt32("index", IndexOfPose(pose)); + + handled = true; + break; + } } } @@ -646,10 +659,11 @@ BPoseView::GetProperty(BMessage *_SCRIPTING_ONLY(specifier), #endif } + bool -BPoseView::SetProperty(BMessage *_SCRIPTING_ONLY(message), BMessage *, - int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property), - BMessage *_SCRIPTING_ONLY(reply)) +BPoseView::SetProperty(BMessage* _SCRIPTING_ONLY(message), BMessage*, + int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property), + BMessage* _SCRIPTING_ONLY(reply)) { #if _SUPPORTS_FEATURE_SCRIPTING status_t error = B_OK; @@ -660,56 +674,55 @@ BPoseView::SetProperty(BMessage *_SCRIPTING_ONLY(message), BMessage *, switch (form) { case B_DIRECT_SPECIFIER: - { - int32 selStart; - int32 selEnd; - if (message->FindInt32("data", 0, &selStart) == B_OK - && message->FindInt32("data", 1, &selEnd) == B_OK) { + { + int32 selStart; + int32 selEnd; + if (message->FindInt32("data", 0, &selStart) == B_OK + && message->FindInt32("data", 1, &selEnd) == B_OK) { - if (selStart < 0 || selStart >= fPoseList->CountItems() - || selEnd < 0 || selEnd >= fPoseList->CountItems()) { - error = B_BAD_INDEX; - handled = true; - break; - } - - SelectPoses(selStart, selEnd); + if (selStart < 0 || selStart >= fPoseList->CountItems() + || selEnd < 0 || selEnd >= fPoseList->CountItems()) { + error = B_BAD_INDEX; handled = true; break; } + + SelectPoses(selStart, selEnd); + handled = true; + break; } - // fall thru + } // fall thru case kPreviousSpecifier: case kNextSpecifier: - { - // PRINT(("SetProperty direct/previous/next %s\n", property)); - // select/unselect poses specified by entries - bool clearSelection = true; - for (int32 index = 0; message->FindRef("data", index, &ref) - == B_OK; index++) { - - int32 poseIndex; - BPose *pose = FindPose(&ref, form, &poseIndex); - - if (!pose) { - error = B_ENTRY_NOT_FOUND; - handled = true; - break; - } - - if (clearSelection) { - // first selected item must call SelectPose so the selection - // gets cleared first - SelectPose(pose, poseIndex); - clearSelection = false; - } else - AddPoseToSelection(pose, poseIndex); + { + // PRINT(("SetProperty direct/previous/next %s\n", property)); + // select/unselect poses specified by entries + bool clearSelection = true; + for (int32 index = 0; message->FindRef("data", index, &ref) + == B_OK; index++) { + int32 poseIndex; + BPose* pose = FindPose(&ref, form, &poseIndex); + + if (!pose) { + error = B_ENTRY_NOT_FOUND; handled = true; + break; } - break; - } - } + + if (clearSelection) { + // first selected item must call SelectPose so the selection + // gets cleared first + SelectPose(pose, poseIndex); + clearSelection = false; + } else + AddPoseToSelection(pose, poseIndex); + + handled = true; + } + break; + } + } } if (error != B_OK) @@ -721,13 +734,14 @@ BPoseView::SetProperty(BMessage *_SCRIPTING_ONLY(message), BMessage *, #endif } -BHandler * -BPoseView::ResolveSpecifier(BMessage *_SCRIPTING_ONLY(message), - int32 _SCRIPTING_ONLY(index), BMessage *_SCRIPTING_ONLY(specifier), - int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property)) + +BHandler* +BPoseView::ResolveSpecifier(BMessage* _SCRIPTING_ONLY(message), + int32 _SCRIPTING_ONLY(index), BMessage* _SCRIPTING_ONLY(specifier), + int32 _SCRIPTING_ONLY(form), const char* _SCRIPTING_ONLY(property)) { #if _SUPPORTS_FEATURE_SCRIPTING - BPropertyInfo propertyInfo(const_cast(kPosesPropertyList)); + BPropertyInfo propertyInfo(const_cast(kPosesPropertyList)); int32 result = propertyInfo.FindMatch(message, index, specifier, form, property); if (result < 0) { @@ -742,14 +756,15 @@ BPoseView::ResolveSpecifier(BMessage *_SCRIPTING_ONLY(message), #endif } -BPose * -BPoseView::FindPose(const entry_ref *_SCRIPTING_ONLY(ref), - int32 _SCRIPTING_ONLY(specifierForm), int32 *_SCRIPTING_ONLY(index)) const + +BPose* +BPoseView::FindPose(const entry_ref* _SCRIPTING_ONLY(ref), + int32 _SCRIPTING_ONLY(specifierForm), int32* _SCRIPTING_ONLY(index)) const { #if _SUPPORTS_FEATURE_SCRIPTING // flavor of FindPose, used by previous/next specifiers - BPose *pose = FindPose(ref, index); + BPose* pose = FindPose(ref, index); if (specifierForm == (int32)kPreviousSpecifier) return PoseAtIndex(--*index); @@ -761,4 +776,3 @@ BPoseView::FindPose(const entry_ref *_SCRIPTING_ONLY(ref), return NULL; #endif } - diff --git a/src/kits/tracker/PublicCommands.h b/src/kits/tracker/PublicCommands.h index bb18e0eafc..daa7be0c2a 100644 --- a/src/kits/tracker/PublicCommands.h +++ b/src/kits/tracker/PublicCommands.h @@ -31,12 +31,13 @@ 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. */ - #ifndef __PUBLIC_COMMANDS__ #define __PUBLIC_COMMANDS__ + #include + // commands that may be issued to the tracker by other apps using messengers namespace BPrivate { @@ -56,4 +57,4 @@ const uint32 kFSClipboardChanges = 'TCch'; using namespace BPrivate; -#endif /* __PUBLIC_COMMANDS__ */ +#endif // __PUBLIC_COMMANDS__ diff --git a/src/kits/tracker/QueryContainerWindow.cpp b/src/kits/tracker/QueryContainerWindow.cpp index 5f5763a719..748de2b8f1 100644 --- a/src/kits/tracker/QueryContainerWindow.cpp +++ b/src/kits/tracker/QueryContainerWindow.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include @@ -50,7 +51,7 @@ All rights reserved. #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "QueryContainerWindow" -BQueryContainerWindow::BQueryContainerWindow(LockingList *windowList, +BQueryContainerWindow::BQueryContainerWindow(LockingList* windowList, uint32 containerWindowFlags, window_look look, window_feel feel, uint32 flags, uint32 workspace) : BContainerWindow(windowList, containerWindowFlags, look, feel, @@ -59,22 +60,22 @@ BQueryContainerWindow::BQueryContainerWindow(LockingList *windowList, } -BPoseView * -BQueryContainerWindow::NewPoseView(Model *model, BRect rect, uint32) +BPoseView* +BQueryContainerWindow::NewPoseView(Model* model, BRect rect, uint32) { return new BQueryPoseView(model, rect); } -BQueryPoseView * +BQueryPoseView* BQueryContainerWindow::PoseView() const { - return static_cast(fPoseView); + return static_cast(fPoseView); } void -BQueryContainerWindow::CreatePoseView(Model *model) +BQueryContainerWindow::CreatePoseView(Model* model) { BRect rect(Bounds()); rect.right -= B_V_SCROLL_BAR_WIDTH; @@ -86,9 +87,9 @@ BQueryContainerWindow::CreatePoseView(Model *model) void -BQueryContainerWindow::AddWindowMenu(BMenu *menu) +BQueryContainerWindow::AddWindowMenu(BMenu* menu) { - BMenuItem *item; + BMenuItem* item; item = new BMenuItem(B_TRANSLATE("Resize to fit"), new BMessage(kResizeToFit), 'Y'); @@ -117,8 +118,8 @@ BQueryContainerWindow::AddWindowMenu(BMenu *menu) } -void -BQueryContainerWindow::AddWindowContextMenus(BMenu *menu) +void +BQueryContainerWindow::AddWindowContextMenus(BMenu* menu) { BMenuItem* resizeItem = new BMenuItem(B_TRANSLATE("Resize to fit"), new BMessage(kResizeToFit), 'Y'); @@ -137,7 +138,7 @@ BQueryContainerWindow::AddWindowContextMenus(BMenu *menu) } -void +void BQueryContainerWindow::SetUpDefaultState() { BNode defaultingNode; @@ -152,7 +153,7 @@ BQueryContainerWindow::SetUpDefaultState() defaultStatePath += '/'; int32 length = sanitizedType.Length(); - char *buf = sanitizedType.LockBuffer(length); + char* buf = sanitizedType.LockBuffer(length); for (int32 index = length - 1; index >= 0; index--) if (buf[index] == '/') buf[index] = '_'; @@ -170,7 +171,7 @@ BQueryContainerWindow::SetUpDefaultState() // copy over the attributes // set up a filter of the attributes we want copied - const char *allowAttrs[] = { + const char* allowAttrs[] = { kAttrWindowFrame, kAttrViewState, kAttrViewStateForeign, @@ -187,9 +188,8 @@ BQueryContainerWindow::SetUpDefaultState() } -bool +bool BQueryContainerWindow::ActiveOnDevice(dev_t device) const { return PoseView()->ActiveOnDevice(device); } - diff --git a/src/kits/tracker/QueryContainerWindow.h b/src/kits/tracker/QueryContainerWindow.h index 228c1d1d09..dfbb1a6acf 100644 --- a/src/kits/tracker/QueryContainerWindow.h +++ b/src/kits/tracker/QueryContainerWindow.h @@ -31,39 +31,40 @@ 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. */ - -#ifndef _QUERY_CONTAINER_WINDOW_H +#ifndef _QUERY_CONTAINER_WINDOW_H #define _QUERY_CONTAINER_WINDOW_H -#include "ContainerWindow.h" - -namespace BPrivate { // Container window specificaly used for displaying BQueryPoseViews // Adds query window specific menus +#include "ContainerWindow.h" + + +namespace BPrivate { + #define kQueryTemplates "DefaultQueryTemplates" class BQueryPoseView; class BQueryContainerWindow : public BContainerWindow { public: - BQueryContainerWindow(LockingList *windowList, + BQueryContainerWindow(LockingList* windowList, uint32 containerWindowFlags, window_look look = B_DOCUMENT_WINDOW_LOOK, - window_feel feel = B_NORMAL_WINDOW_FEEL, + window_feel feel = B_NORMAL_WINDOW_FEEL, uint32 flags = B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION, uint32 workspace = B_CURRENT_WORKSPACE); - BQueryPoseView *PoseView() const; + BQueryPoseView* PoseView() const; bool ActiveOnDevice(dev_t) const; protected: - virtual void CreatePoseView(Model *); - virtual BPoseView *NewPoseView(Model *model, BRect rect, uint32 viewMode); - virtual void AddWindowMenu(BMenu *menu); - virtual void AddWindowContextMenus(BMenu *menu); + virtual void CreatePoseView(Model*); + virtual BPoseView* NewPoseView(Model* model, BRect rect, uint32 viewMode); + virtual void AddWindowMenu(BMenu* menu); + virtual void AddWindowContextMenus(BMenu* menu); virtual void SetUpDefaultState(); @@ -75,4 +76,4 @@ private: using namespace BPrivate; -#endif +#endif // _QUERY_CONTAINER_WINDOW_H diff --git a/src/kits/tracker/QueryPoseView.cpp b/src/kits/tracker/QueryPoseView.cpp index 80948de6a0..bd17d1da77 100644 --- a/src/kits/tracker/QueryPoseView.cpp +++ b/src/kits/tracker/QueryPoseView.cpp @@ -31,6 +31,8 @@ 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 "QueryPoseView.h" #include @@ -69,7 +71,7 @@ using std::nothrow; // query results and add/remove appropriately. Right now only moving to // Trash is supported -BQueryPoseView::BQueryPoseView(Model *model, BRect frame, uint32 resizeMask) +BQueryPoseView::BQueryPoseView(Model* model, BRect frame, uint32 resizeMask) : BPoseView(model, frame, kListMode, resizeMask), fShowResultsFromTrash(false), fQueryList(NULL), @@ -85,8 +87,8 @@ BQueryPoseView::~BQueryPoseView() } -void -BQueryPoseView::MessageReceived(BMessage *message) +void +BQueryPoseView::MessageReceived(BMessage* message) { switch (message->what) { case kFSClipboardChanges: @@ -103,7 +105,7 @@ BQueryPoseView::MessageReceived(BMessage *message) } -void +void BQueryPoseView::EditQueries() { BMessage message(kEditQuery); @@ -139,15 +141,15 @@ BQueryPoseView::AttachedToWindow() } -void -BQueryPoseView::RestoreState(AttributeStreamNode *node) +void +BQueryPoseView::RestoreState(AttributeStreamNode* node) { _inherited::RestoreState(node); fViewState->SetViewMode(kListMode); } -void +void BQueryPoseView::RestoreState(const BMessage &message) { _inherited::RestoreState(message); @@ -155,25 +157,25 @@ BQueryPoseView::RestoreState(const BMessage &message) } -void -BQueryPoseView::SavePoseLocations(BRect *) +void +BQueryPoseView::SavePoseLocations(BRect*) { } -void +void BQueryPoseView::SetViewMode(uint32) { } -void +void BQueryPoseView::OpenParent() { } -void +void BQueryPoseView::Refresh() { PRINT(("refreshing dynamic date query\n")); @@ -182,7 +184,7 @@ BQueryPoseView::Refresh() fAddPosesThreads.clear(); delete fQueryListContainer; fQueryListContainer = NULL; - + fCreateOldPoseList = true; AddPoses(TargetModel()); TargetModel()->CloseNode(); @@ -193,22 +195,22 @@ BQueryPoseView::Refresh() bool -BQueryPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) +BQueryPoseView::ShouldShowPose(const Model* model, const PoseInfo* poseInfo) { // add_poses, etc. filter ASSERT(TargetModel()); if (!fShowResultsFromTrash - && dynamic_cast(be_app)->InTrashNode(model->EntryRef())) + && dynamic_cast(be_app)->InTrashNode(model->EntryRef())) return false; bool result = _inherited::ShouldShowPose(model, poseInfo); - PoseList *oldPoseList = fQueryListContainer->OldPoseList(); + PoseList* oldPoseList = fQueryListContainer->OldPoseList(); if (result && oldPoseList) { // pose will get added - remove it from the old pose list // because it is supposed to be showing - BPose *pose = oldPoseList->FindPose(model); + BPose* pose = oldPoseList->FindPose(model); if (pose) oldPoseList->RemoveItem(pose); } @@ -216,16 +218,16 @@ BQueryPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) } -void +void BQueryPoseView::AddPosesCompleted() { ASSERT(Window()->IsLocked()); - PoseList *oldPoseList = fQueryListContainer->OldPoseList(); + PoseList* oldPoseList = fQueryListContainer->OldPoseList(); if (oldPoseList) { int32 count = oldPoseList->CountItems(); for (int32 index = count - 1; index >= 0; index--) { - BPose *pose = oldPoseList->ItemAt(index); + BPose* pose = oldPoseList->ItemAt(index); DeletePose(pose->TargetModel()->NodeRef()); } fQueryListContainer->ClearOldPoseList(); @@ -238,22 +240,22 @@ BQueryPoseView::AddPosesCompleted() // When using dynamic dates, such as "today", need to refresh the query // window every now and then -EntryListBase * -BQueryPoseView::InitDirentIterator(const entry_ref *ref) +EntryListBase* +BQueryPoseView::InitDirentIterator(const entry_ref* ref) { BEntry entry(ref); - if (entry.InitCheck() != B_OK) + if (entry.InitCheck() != B_OK) return NULL; Model sourceModel(&entry, true); - if (sourceModel.InitCheck() != B_OK) + if (sourceModel.InitCheck() != B_OK) return NULL; ASSERT(sourceModel.IsQuery()); // old pose list is used for finding poses that no longer match a // dynamic date query during a Refresh call - PoseList *oldPoseList = NULL; + PoseList* oldPoseList = NULL; if (fCreateOldPoseList) { oldPoseList = new PoseList(10, false); oldPoseList->AddList(fPoseList); @@ -280,30 +282,33 @@ BQueryPoseView::InitDirentIterator(const entry_ref *ref) // calculate the time to trigger the query refresh - next midnight time_t now = time(0); - time_t nextMidnight = now + 60 * 60 * 24; // move ahead by a day + time_t nextMidnight = now + 60 * 60 * 24; + // move ahead by a day tm timeData; localtime_r(&nextMidnight, &timeData); timeData.tm_sec = 0; timeData.tm_min = 0; timeData.tm_hour = 0; - nextMidnight = mktime(&timeData); + nextMidnight = mktime(&timeData); - time_t nextHour = now + 60 * 60; // move ahead by a hour + time_t nextHour = now + 60 * 60; + // move ahead by a hour localtime_r(&nextHour, &timeData); timeData.tm_sec = 0; timeData.tm_min = 0; - nextHour = mktime(&timeData); + nextHour = mktime(&timeData); PRINT(("%ld minutes, %ld seconds till next hour\n", (nextHour - now) / 60, (nextHour - now) % 60)); - time_t nextMinute = now + 60; // move ahead by a minute + time_t nextMinute = now + 60; + // move ahead by a minute localtime_r(&nextMinute, &timeData); timeData.tm_sec = 0; - nextMinute = mktime(&timeData); - + nextMinute = mktime(&timeData); + PRINT(("%ld seconds till next minute\n", nextMinute - now)); - + bigtime_t delta; if (fQueryListContainer->DynamicDateRefreshEveryMinute()) delta = nextMinute - now; @@ -330,11 +335,11 @@ BQueryPoseView::InitDirentIterator(const entry_ref *ref) PRINT(("next refresh in %ld hours, %ld minutes, %ld seconds\n", refreshInHours, refreshInMinutes, refreshInSeconds)); #endif - + // bump up to microseconds delta *= 1000000; - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); ASSERT(tracker); tracker->MainTaskLoop()->RunLater( NewLockingMemberFunctionObject(&BQueryPoseView::Refresh, this), delta); @@ -344,34 +349,35 @@ BQueryPoseView::InitDirentIterator(const entry_ref *ref) } -uint32 +uint32 BQueryPoseView::WatchNewNodeMask() { return B_WATCH_NAME | B_WATCH_STAT | B_WATCH_ATTR; } -const char * +const char* BQueryPoseView::SearchForType() const { if (!fSearchForMimeType.Length()) { BModelOpener opener(TargetModel()); BString buffer; attr_info attrInfo; + // read the type of files we are looking for status_t status = TargetModel()->Node()->GetAttrInfo(kAttrQueryInitialMime, &attrInfo); - if (status == B_OK) + if (status == B_OK) TargetModel()->Node()->ReadAttrString(kAttrQueryInitialMime, &buffer); - + if (buffer.Length()) { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (tracker) { - const ShortMimeInfo *info = tracker->MimeTypes()->FindMimeType(buffer.String()); - if (info) + const ShortMimeInfo* info = tracker->MimeTypes()->FindMimeType(buffer.String()); + if (info) fSearchForMimeType = info->InternalName(); - } } + if (!fSearchForMimeType.Length()) fSearchForMimeType = B_FILE_MIMETYPE; } @@ -380,11 +386,11 @@ BQueryPoseView::SearchForType() const } -bool +bool BQueryPoseView::ActiveOnDevice(dev_t device) const { int32 count = fQueryList->CountItems(); - for (int32 index = 0; index < count; index++) + for (int32 index = 0; index < count; index++) if (fQueryList->ItemAt(index)->TargetDevice() == device) return true; @@ -395,8 +401,8 @@ BQueryPoseView::ActiveOnDevice(dev_t device) const // #pragma mark - -QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *target, - PoseList *oldPoseList) +QueryEntryListCollection::QueryEntryListCollection(Model* model, BHandler* target, + PoseList* oldPoseList) : fQueryListRep(new QueryListRep(new BObjectList(5, true))) { Rewind(); @@ -410,7 +416,7 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe // read the actual query string fStatus = model->Node()->GetAttrInfo(kAttrQueryString, &info); - if (fStatus != B_OK) + if (fStatus != B_OK) return; BString buffer; @@ -426,11 +432,12 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe MoreOptionsStruct saveMoreOptions; if (ReadAttr(model->Node(), kAttrQueryMoreOptions, kAttrQueryMoreOptionsForeign, B_RAW_TYPE, 0, &saveMoreOptions, sizeof(MoreOptionsStruct), - &MoreOptionsStruct::EndianSwap) != kReadAttrFailed) + &MoreOptionsStruct::EndianSwap) != kReadAttrFailed) { fQueryListRep->fShowResultsFromTrash = saveMoreOptions.searchTrash; - + } + fStatus = query.SetPredicate(buffer.String()); - + fQueryListRep->fOldPoseList = oldPoseList; fQueryListRep->fDynamicDateQuery = false; @@ -438,8 +445,9 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe fQueryListRep->fRefreshEveryMinute = false; if (model->Node()->ReadAttr(kAttrDynamicDateQuery, B_BOOL_TYPE, 0, - &fQueryListRep->fDynamicDateQuery, sizeof(bool)) != sizeof(bool)) + &fQueryListRep->fDynamicDateQuery, sizeof(bool)) != sizeof(bool)) { fQueryListRep->fDynamicDateQuery = false; + } if (fQueryListRep->fDynamicDateQuery) { // only refresh every minute on debug builds @@ -453,7 +461,7 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe fQueryListRep->fRefreshEveryMinute = false; #endif } - + if (fStatus != B_OK) return; @@ -462,11 +470,11 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe // get volumes to perform query on if (model->Node()->GetAttrInfo(kAttrQueryVolume, &info) == B_OK) { - char *buffer = NULL; + char* buffer = NULL; - if ((buffer = (char *)malloc((size_t)info.size)) != NULL + if ((buffer = (char*)malloc((size_t)info.size)) != NULL && model->Node()->ReadAttr(kAttrQueryVolume, B_MESSAGE_TYPE, 0, buffer, - (size_t)info.size) == info.size) { + (size_t)info.size) == info.size) { BMessage message; if (message.Unflatten(buffer) == B_OK) { @@ -478,16 +486,17 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe if (result == B_OK) { // start the query on this volume result = FetchOneQuery(&query, target, - fQueryListRep->fQueryList, &volume); + fQueryListRep->fQueryList, &volume); if (result != B_OK) continue; searchAllVolumes = false; - } else if (result != B_DEV_BAD_DRIVE_NUM) + } else if (result != B_DEV_BAD_DRIVE_NUM) { // if B_DEV_BAD_DRIVE_NUM, the volume just isn't mounted this // time around, keep looking for more // if other error, bail break; + } } } } @@ -503,7 +512,8 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe roster.Rewind(); while (roster.GetNextVolume(&volume) == B_OK) if (volume.IsPersistent() && volume.KnowsQuery()) { - result = FetchOneQuery(&query, target, fQueryListRep->fQueryList, &volume); + result = FetchOneQuery(&query, target, + fQueryListRep->fQueryList, &volume); if (result != B_OK) continue; } @@ -515,28 +525,29 @@ QueryEntryListCollection::QueryEntryListCollection(Model *model, BHandler *targe status_t -QueryEntryListCollection::FetchOneQuery(const BQuery *copyThis, - BHandler *target, BObjectList *list, BVolume *volume) +QueryEntryListCollection::FetchOneQuery(const BQuery* copyThis, + BHandler* target, BObjectList* list, BVolume* volume) { - BQuery *query = new (nothrow) BQuery; + BQuery* query = new (nothrow) BQuery; if (query == NULL) return B_NO_MEMORY; + // have to fake a copy constructor here because BQuery doesn't have // a copy constructor - BString buffer; - const_cast(copyThis)->GetPredicate(&buffer); + const_cast(copyThis)->GetPredicate(&buffer); query->SetPredicate(buffer.String()); query->SetTarget(BMessenger(target)); query->SetVolume(volume); - + status_t result = query->Fetch(); if (result != B_OK) { PRINT(("fetch error %s\n", strerror(result))); delete query; return result; } + list->AddItem(query); return B_OK; @@ -545,12 +556,12 @@ QueryEntryListCollection::FetchOneQuery(const BQuery *copyThis, QueryEntryListCollection::~QueryEntryListCollection() { - if (fQueryListRep->CloseQueryList()) + if (fQueryListRep->CloseQueryList()) delete fQueryListRep; } -QueryEntryListCollection * +QueryEntryListCollection* QueryEntryListCollection::Clone() { fQueryListRep->OpenQueryList(); @@ -567,7 +578,7 @@ QueryEntryListCollection::QueryEntryListCollection( } -void +void QueryEntryListCollection::ClearOldPoseList() { delete fQueryListRep->fOldPoseList; @@ -575,8 +586,8 @@ QueryEntryListCollection::ClearOldPoseList() } -status_t -QueryEntryListCollection::GetNextEntry(BEntry *entry, bool traverse) +status_t +QueryEntryListCollection::GetNextEntry(BEntry* entry, bool traverse) { status_t result = B_ERROR; @@ -592,8 +603,8 @@ QueryEntryListCollection::GetNextEntry(BEntry *entry, bool traverse) } -int32 -QueryEntryListCollection::GetNextDirents(struct dirent *buffer, size_t length, +int32 +QueryEntryListCollection::GetNextDirents(struct dirent* buffer, size_t length, int32 count) { int32 result = 0; @@ -611,8 +622,8 @@ QueryEntryListCollection::GetNextDirents(struct dirent *buffer, size_t length, } -status_t -QueryEntryListCollection::GetNextRef(entry_ref *ref) +status_t +QueryEntryListCollection::GetNextRef(entry_ref* ref) { status_t result = B_ERROR; @@ -630,7 +641,7 @@ QueryEntryListCollection::GetNextRef(entry_ref *ref) } -status_t +status_t QueryEntryListCollection::Rewind() { fQueryListRep->fQueryListIndex = 0; @@ -639,37 +650,36 @@ QueryEntryListCollection::Rewind() } -int32 +int32 QueryEntryListCollection::CountEntries() { return 0; } -bool +bool QueryEntryListCollection::ShowResultsFromTrash() const { return fQueryListRep->fShowResultsFromTrash; } -bool +bool QueryEntryListCollection::DynamicDateQuery() const { return fQueryListRep->fDynamicDateQuery; } -bool +bool QueryEntryListCollection::DynamicDateRefreshEveryHour() const { return fQueryListRep->fRefreshEveryHour; } -bool +bool QueryEntryListCollection::DynamicDateRefreshEveryMinute() const { return fQueryListRep->fRefreshEveryMinute; } - diff --git a/src/kits/tracker/QueryPoseView.h b/src/kits/tracker/QueryPoseView.h index c1473d94d1..48c1a91db6 100644 --- a/src/kits/tracker/QueryPoseView.h +++ b/src/kits/tracker/QueryPoseView.h @@ -31,15 +31,16 @@ 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. */ - -#ifndef _QUERY_POSE_VIEW_H +#ifndef _QUERY_POSE_VIEW_H #define _QUERY_POSE_VIEW_H -class BQuery; #include "EntryIterator.h" #include "PoseView.h" + +class BQuery; + namespace BPrivate { class BQueryContainerWindow; @@ -47,13 +48,13 @@ class QueryEntryListCollection; class BQueryPoseView : public BPoseView { public: - BQueryPoseView(Model *, BRect, uint32 resizeMask = B_FOLLOW_ALL); + BQueryPoseView(Model*, BRect, uint32 resizeMask = B_FOLLOW_ALL); virtual ~BQueryPoseView(); - - virtual void MessageReceived(BMessage *message); - const char *SearchForType() const; - BQueryContainerWindow *ContainerWindow() const; + virtual void MessageReceived(BMessage* message); + + const char* SearchForType() const; + BQueryContainerWindow* ContainerWindow() const; bool ActiveOnDevice(dev_t) const; void Refresh(); @@ -64,16 +65,16 @@ public: protected: virtual void AttachedToWindow(); - virtual void RestoreState(AttributeStreamNode *); - virtual void RestoreState(const BMessage &); - virtual void SavePoseLocations(BRect * = NULL); + virtual void RestoreState(AttributeStreamNode*); + virtual void RestoreState(const BMessage&); + virtual void SavePoseLocations(BRect* = NULL); virtual void SetUpDefaultColumnsIfNeeded(); virtual void SetViewMode(uint32); virtual void OpenParent(); virtual void EditQueries(); - virtual EntryListBase *InitDirentIterator(const entry_ref *); + virtual EntryListBase* InitDirentIterator(const entry_ref*); virtual uint32 WatchNewNodeMask(); - virtual bool ShouldShowPose(const Model *, const PoseInfo *); + virtual bool ShouldShowPose(const Model*, const PoseInfo*); virtual void AddPosesCompleted(); private: @@ -84,9 +85,9 @@ private: bool fShowResultsFromTrash; mutable BString fSearchForMimeType; - BObjectList *fQueryList; - QueryEntryListCollection *fQueryListContainer; - + BObjectList* fQueryList; + QueryEntryListCollection* fQueryListContainer; + bool fCreateOldPoseList; typedef BPoseView _inherited; @@ -98,36 +99,35 @@ class QueryEntryListCollection : public EntryListBase { // PoseView, allowing PoseView to have an arbitrary collection of // elements that behave as an EntryList // For now just manage a list of BQueries - class QueryListRep { public: - QueryListRep(BObjectList *queryList) + QueryListRep(BObjectList* queryList) : fQueryList(queryList), fRefCount(0), fShowResultsFromTrash(0), fOldPoseList(NULL) {} - + ~QueryListRep() { ASSERT(fRefCount <= 0); delete fQueryList; delete fOldPoseList; } - - BObjectList *OpenQueryList() + + BObjectList* OpenQueryList() { fRefCount++; return fQueryList; } - + bool CloseQueryList() - { - return atomic_add(&fRefCount, -1) == 0; - } - - BObjectList *fQueryList; + { + return atomic_add(&fRefCount, -1) == 0; + } + + BObjectList* fQueryList; int32 fRefCount; bool fShowResultsFromTrash; int32 fQueryListIndex; @@ -135,30 +135,29 @@ class QueryEntryListCollection : public EntryListBase { bool fRefreshEveryHour; bool fRefreshEveryMinute; - PoseList *fOldPoseList; + PoseList* fOldPoseList; // when doing a Refresh, this list is used to detect poses that // are no longer a part of a fDynamicDateQuery and need to be removed }; public: - - QueryEntryListCollection(Model *, BHandler * = NULL, PoseList *oldPoseList = NULL); + QueryEntryListCollection(Model*, BHandler* = NULL, PoseList* oldPoseList = NULL); virtual ~QueryEntryListCollection(); - QueryEntryListCollection *Clone(); + QueryEntryListCollection* Clone(); - BObjectList *QueryList() const + BObjectList* QueryList() const { return fQueryListRep->fQueryList; } - PoseList *OldPoseList() const + PoseList* OldPoseList() const { return fQueryListRep->fOldPoseList; } void ClearOldPoseList(); - - virtual status_t GetNextEntry(BEntry *entry, bool traverse = false); - virtual status_t GetNextRef(entry_ref *ref); - virtual int32 GetNextDirents(struct dirent *buffer, size_t length, + + virtual status_t GetNextEntry(BEntry* entry, bool traverse = false); + virtual status_t GetNextRef(entry_ref* ref); + virtual int32 GetNextDirents(struct dirent* buffer, size_t length, int32 count = INT_MAX); - + virtual status_t Rewind(); virtual int32 CountEntries(); @@ -166,18 +165,18 @@ public: bool DynamicDateQuery() const; bool DynamicDateRefreshEveryHour() const; bool DynamicDateRefreshEveryMinute() const; - -private: - QueryEntryListCollection(const QueryEntryListCollection &); - // only to be used by the Clone routine - status_t FetchOneQuery(const BQuery *, BHandler *target, - BObjectList *, BVolume *); - QueryListRep *fQueryListRep; +private: + QueryEntryListCollection(const QueryEntryListCollection&); + // only to be used by the Clone routine + status_t FetchOneQuery(const BQuery*, BHandler* target, + BObjectList*, BVolume*); + + QueryListRep* fQueryListRep; }; } // namespace BPrivate using namespace BPrivate; -#endif +#endif // _QUERY_POSE_VIEW_H diff --git a/src/kits/tracker/RecentItems.cpp b/src/kits/tracker/RecentItems.cpp index 1b8c8cd036..244d2675eb 100644 --- a/src/kits/tracker/RecentItems.cpp +++ b/src/kits/tracker/RecentItems.cpp @@ -49,8 +49,8 @@ All rights reserved. class RecentItemsMenu : public BSlowMenu { public: - RecentItemsMenu(const char *title, BMessage *openMessage, - BHandler *itemTarget, int32 maxItems) + RecentItemsMenu(const char* title, BMessage* openMessage, + BHandler* itemTarget, int32 maxItems) : BSlowMenu(title), fTargetMesage(openMessage), fItemTarget(itemTarget), @@ -64,14 +64,14 @@ public: virtual void ClearMenuBuildingState(); protected: - virtual const BMessage *FileMessage() + virtual const BMessage* FileMessage() { return fTargetMesage; } - virtual const BMessage *ContainerMessage() + virtual const BMessage* ContainerMessage() { return fTargetMesage; } - BRecentItemsList *fTterator; - BMessage *fTargetMesage; - BHandler *fItemTarget; + BRecentItemsList* fTterator; + BMessage* fTargetMesage; + BHandler* fItemTarget; int32 fCount; int32 fSanityCount; int32 fMaxCount; @@ -80,39 +80,39 @@ protected: class RecentFilesMenu : public RecentItemsMenu { public: - RecentFilesMenu(const char *title, BMessage *openFileMessage, - BMessage *openFolderMessage, BHandler *target, - int32 maxItems, bool navMenuFolders, const char *ofType, - const char *openedByAppSig); + RecentFilesMenu(const char* title, BMessage* openFileMessage, + BMessage* openFolderMessage, BHandler* target, + int32 maxItems, bool navMenuFolders, const char* ofType, + const char* openedByAppSig); - RecentFilesMenu(const char *title, BMessage *openFileMessage, - BMessage *openFolderMessage, BHandler *target, - int32 maxItems, bool navMenuFolders, const char *ofTypeList[], - int32 ofTypeListCount, const char *openedByAppSig); + RecentFilesMenu(const char* title, BMessage* openFileMessage, + BMessage* openFolderMessage, BHandler* target, + int32 maxItems, bool navMenuFolders, const char* ofTypeList[], + int32 ofTypeListCount, const char* openedByAppSig); virtual ~RecentFilesMenu(); protected: - virtual const BMessage *ContainerMessage() + virtual const BMessage* ContainerMessage() { return openFolderMessage; } private: - BMessage *openFolderMessage; + BMessage* openFolderMessage; }; class RecentFoldersMenu : public RecentItemsMenu { public: - RecentFoldersMenu(const char *title, BMessage *openMessage, - BHandler *target, int32 maxItems, bool navMenuFolders, - const char *openedByAppSig); + RecentFoldersMenu(const char* title, BMessage* openMessage, + BHandler* target, int32 maxItems, bool navMenuFolders, + const char* openedByAppSig); }; class RecentAppsMenu : public RecentItemsMenu { public: - RecentAppsMenu(const char *title, BMessage *openMessage, - BHandler *target, int32 maxItems); + RecentAppsMenu(const char* title, BMessage* openMessage, + BHandler* target, int32 maxItems); }; @@ -129,7 +129,7 @@ RecentItemsMenu::~RecentItemsMenu() bool RecentItemsMenu::AddNextItem() { - BMenuItem *item = fTterator->GetNextMenuItem(FileMessage(), + BMenuItem* item = fTterator->GetNextMenuItem(FileMessage(), ContainerMessage(), fItemTarget); if (item) { @@ -171,9 +171,9 @@ RecentItemsMenu::ClearMenuBuildingState() // #pragma mark - -RecentFilesMenu::RecentFilesMenu(const char *title, BMessage *openFileMessage, - BMessage *openFolderMessage, BHandler *target, int32 maxItems, - bool navMenuFolders, const char *ofType, const char *openedByAppSig) +RecentFilesMenu::RecentFilesMenu(const char* title, BMessage* openFileMessage, + BMessage* openFolderMessage, BHandler* target, int32 maxItems, + bool navMenuFolders, const char* ofType, const char* openedByAppSig) : RecentItemsMenu(title, openFileMessage, target, maxItems), openFolderMessage(openFolderMessage) @@ -183,10 +183,10 @@ RecentFilesMenu::RecentFilesMenu(const char *title, BMessage *openFileMessage, } -RecentFilesMenu::RecentFilesMenu(const char *title, BMessage *openFileMessage, - BMessage *openFolderMessage, BHandler *target, int32 maxItems, - bool navMenuFolders, const char *ofTypeList[], int32 ofTypeListCount, - const char *openedByAppSig) +RecentFilesMenu::RecentFilesMenu(const char* title, BMessage* openFileMessage, + BMessage* openFolderMessage, BHandler* target, int32 maxItems, + bool navMenuFolders, const char* ofTypeList[], int32 ofTypeListCount, + const char* openedByAppSig) : RecentItemsMenu(title, openFileMessage, target, maxItems), openFolderMessage(openFolderMessage) @@ -205,9 +205,9 @@ RecentFilesMenu::~RecentFilesMenu() // #pragma mark - -RecentFoldersMenu::RecentFoldersMenu(const char *title, BMessage *openMessage, - BHandler *target, int32 maxItems, bool navMenuFolders, - const char *openedByAppSig) +RecentFoldersMenu::RecentFoldersMenu(const char* title, BMessage* openMessage, + BHandler* target, int32 maxItems, bool navMenuFolders, + const char* openedByAppSig) : RecentItemsMenu(title, openMessage, target, maxItems) { @@ -219,8 +219,8 @@ RecentFoldersMenu::RecentFoldersMenu(const char *title, BMessage *openMessage, // #pragma mark - -RecentAppsMenu::RecentAppsMenu(const char *title, BMessage *openMessage, - BHandler *target, int32 maxItems) +RecentAppsMenu::RecentAppsMenu(const char* title, BMessage* openMessage, + BHandler* target, int32 maxItems) : RecentItemsMenu(title, openMessage, target, maxItems) { fTterator = new BRecentAppsList(maxItems); @@ -249,10 +249,10 @@ BRecentItemsList::Rewind() } -BMenuItem * -BRecentItemsList::GetNextMenuItem(const BMessage *fileOpenInvokeMessage, - const BMessage *containerOpenInvokeMessage, BHandler *target, - entry_ref *currentItemRef) +BMenuItem* +BRecentItemsList::GetNextMenuItem(const BMessage* fileOpenInvokeMessage, + const BMessage* containerOpenInvokeMessage, BHandler* target, + entry_ref* currentItemRef) { entry_ref ref; if (GetNextRef(&ref) != B_OK) @@ -265,8 +265,8 @@ BRecentItemsList::GetNextMenuItem(const BMessage *fileOpenInvokeMessage, bool container = false; if (model.IsSymLink()) { - Model *newResolvedModel = NULL; - Model *result = model.LinkTo(); + Model* newResolvedModel = NULL; + Model* result = model.LinkTo(); if (!result) { newResolvedModel = new Model(model.EntryRef(), true, true); @@ -305,7 +305,7 @@ BRecentItemsList::GetNextMenuItem(const BMessage *fileOpenInvokeMessage, if (currentItemRef) *currentItemRef = ref; - BMessage *message; + BMessage* message; if (container && containerOpenInvokeMessage) message = new BMessage(*containerOpenInvokeMessage); else if (!container && fileOpenInvokeMessage) @@ -320,12 +320,12 @@ BRecentItemsList::GetNextMenuItem(const BMessage *fileOpenInvokeMessage, be_plain_font->TruncateString(&truncatedString, B_TRUNCATE_END, BNavMenu::GetMaxMenuWidth()); - ModelMenuItem *item = NULL; + ModelMenuItem* item = NULL; if (!container || !fNavMenuFolders) item = new ModelMenuItem(&model, truncatedString.String(), message); else { // add another nav menu item if it's a directory - BNavMenu *menu = new BNavMenu(truncatedString.String(), message->what, + BNavMenu* menu = new BNavMenu(truncatedString.String(), message->what, target, 0); menu->SetNavDir(&ref); @@ -341,7 +341,7 @@ BRecentItemsList::GetNextMenuItem(const BMessage *fileOpenInvokeMessage, status_t -BRecentItemsList::GetNextRef(entry_ref *result) +BRecentItemsList::GetNextRef(entry_ref* result) { return fItems.FindRef("refs", fIndex++, result); } @@ -351,7 +351,7 @@ BRecentItemsList::GetNextRef(entry_ref *result) BRecentFilesList::BRecentFilesList(int32 maxItems, bool navMenuFolders, - const char *ofType, const char *openedByAppSig) + const char* ofType, const char* openedByAppSig) : BRecentItemsList(maxItems, navMenuFolders), fType(ofType), @@ -363,7 +363,7 @@ BRecentFilesList::BRecentFilesList(int32 maxItems, bool navMenuFolders, BRecentFilesList::BRecentFilesList(int32 maxItems, bool navMenuFolders, - const char *ofTypeList[], int32 ofTypeListCount, const char *openedByAppSig) + const char* ofTypeList[], int32 ofTypeListCount, const char* openedByAppSig) : BRecentItemsList(maxItems, navMenuFolders), fType(NULL), @@ -390,13 +390,13 @@ BRecentFilesList::~BRecentFilesList() status_t -BRecentFilesList::GetNextRef(entry_ref *ref) +BRecentFilesList::GetNextRef(entry_ref* ref) { if (fIndex == 0) { // Lazy roster Get if (fTypes) BRoster().GetRecentDocuments(&fItems, fMaxItems, - const_cast(fTypes), + const_cast(fTypes), fTypeCount, fAppSig.Length() ? fAppSig.String() : NULL); else BRoster().GetRecentDocuments(&fItems, fMaxItems, @@ -408,22 +408,22 @@ BRecentFilesList::GetNextRef(entry_ref *ref) } -BMenu * -BRecentFilesList::NewFileListMenu(const char *title, - BMessage *openFileMessage, BMessage *openFolderMessage, - BHandler *target, int32 maxItems, bool navMenuFolders, const char *ofType, - const char *openedByAppSig) +BMenu* +BRecentFilesList::NewFileListMenu(const char* title, + BMessage* openFileMessage, BMessage* openFolderMessage, + BHandler* target, int32 maxItems, bool navMenuFolders, const char* ofType, + const char* openedByAppSig) { return new RecentFilesMenu(title, openFileMessage, openFolderMessage, target, maxItems, navMenuFolders, ofType, openedByAppSig); } -BMenu * -BRecentFilesList::NewFileListMenu(const char *title, - BMessage *openFileMessage, BMessage *openFolderMessage, - BHandler *target, int32 maxItems, bool navMenuFolders, const char *ofTypeList[], - int32 ofTypeListCount, const char *openedByAppSig) +BMenu* +BRecentFilesList::NewFileListMenu(const char* title, + BMessage* openFileMessage, BMessage* openFolderMessage, + BHandler* target, int32 maxItems, bool navMenuFolders, const char* ofTypeList[], + int32 ofTypeListCount, const char* openedByAppSig) { return new RecentFilesMenu(title, openFileMessage, openFolderMessage, target, maxItems, navMenuFolders, ofTypeList, @@ -434,10 +434,10 @@ BRecentFilesList::NewFileListMenu(const char *title, // #pragma mark - -BMenu * -BRecentFoldersList::NewFolderListMenu(const char *title, - BMessage *openMessage, BHandler *target, int32 maxItems, - bool navMenuFolders, const char *openedByAppSig) +BMenu* +BRecentFoldersList::NewFolderListMenu(const char* title, + BMessage* openMessage, BHandler* target, int32 maxItems, + bool navMenuFolders, const char* openedByAppSig) { return new RecentFoldersMenu(title, openMessage, target, maxItems, navMenuFolders, openedByAppSig); @@ -445,7 +445,7 @@ BRecentFoldersList::NewFolderListMenu(const char *title, BRecentFoldersList::BRecentFoldersList(int32 maxItems, bool navMenuFolders, - const char *openedByAppSig) + const char* openedByAppSig) : BRecentItemsList(maxItems, navMenuFolders), fAppSig(openedByAppSig) @@ -454,7 +454,7 @@ BRecentFoldersList::BRecentFoldersList(int32 maxItems, bool navMenuFolders, status_t -BRecentFoldersList::GetNextRef(entry_ref *ref) +BRecentFoldersList::GetNextRef(entry_ref* ref) { if (fIndex == 0) { // Lazy roster Get @@ -477,7 +477,7 @@ BRecentAppsList::BRecentAppsList(int32 maxItems) status_t -BRecentAppsList::GetNextRef(entry_ref *ref) +BRecentAppsList::GetNextRef(entry_ref* ref) { if (fIndex == 0) { // Lazy roster Get @@ -487,9 +487,9 @@ BRecentAppsList::GetNextRef(entry_ref *ref) } -BMenu * -BRecentAppsList::NewAppListMenu(const char *title, BMessage *openMessage, - BHandler *target, int32 maxItems) +BMenu* +BRecentAppsList::NewAppListMenu(const char* title, BMessage* openMessage, + BHandler* target, int32 maxItems) { return new RecentAppsMenu(title, openMessage, target, maxItems); } diff --git a/src/kits/tracker/RecentItems.h b/src/kits/tracker/RecentItems.h index 8a94d942b0..e392419568 100644 --- a/src/kits/tracker/RecentItems.h +++ b/src/kits/tracker/RecentItems.h @@ -31,19 +31,20 @@ 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. */ - #ifndef __RECENT_ITEMS_LIST__ #define __RECENT_ITEMS_LIST__ + +// BRecentItemsList classes allow creating an entire menu with +// recent files, folders, apps. If the user wishes to add items to +// their own menu, they can instead use the GetNextMenuItem call to +// get one menu at a time to add it to their app. + + #include #include #include -/* BRecentItemsList classes allow creating an entire menu with - * recent files, folders, apps. If the user wishes to add items to - * their own menu, they can instead use the GetNextMenuItem call to - * get one menu at a time to add it to their app. - */ class BMenuItem; class BMenu; @@ -51,29 +52,27 @@ class BMenu; class BRecentItemsList { public: BRecentItemsList(int32 maxItems, bool navMenuFolders); - /* if passed, folder items get NavMenu-style - * subdirectories attached to them - */ + // if passed, folder items get NavMenu-style + // subdirectories attached to them virtual ~BRecentItemsList() {} - - virtual void Rewind(); - /* resets the iteration */ - - virtual BMenuItem *GetNextMenuItem(const BMessage *fileOpenMessage = NULL, - const BMessage *containerOpenMessage = NULL, - BHandler *target = NULL, entry_ref *currentItemRef = NULL); - /* if specified, the item for a file gets a copy with - * the item ref attached as "refs", otherwise a default B_REFS_RECEIVED - * message message gets attached - * if specified, the item for a folder, volume or query - * gets a copy with the item ref attached as "refs", otherwise a default - * B_REFS_RECEIVED message message gets attached - * if gets passed, the caller gets to look at the - * entry_ref corresponding to the item - */ - virtual status_t GetNextRef(entry_ref *); + virtual void Rewind(); + // resets the iteration + + virtual BMenuItem* GetNextMenuItem(const BMessage* fileOpenMessage = NULL, + const BMessage* containerOpenMessage = NULL, + BHandler* target = NULL, entry_ref* currentItemRef = NULL); + // if specified, the item for a file gets a copy with + // the item ref attached as "refs", otherwise a default B_REFS_RECEIVED + // message message gets attached + // if specified, the item for a folder, volume or query + // gets a copy with the item ref attached as "refs", otherwise a default + // B_REFS_RECEIVED message message gets attached + // if gets passed, the caller gets to look at the + // entry_ref corresponding to the item + + virtual status_t GetNextRef(entry_ref*); protected: BMessage fItems; @@ -82,7 +81,6 @@ protected: bool fNavMenuFolders; private: - virtual void _r1(); virtual void _r2(); virtual void _r3(); @@ -94,39 +92,38 @@ private: virtual void _r9(); virtual void _r10(); - uint32 _reserved[20]; + uint32 _reserved[20]; }; + class BRecentFilesList : public BRecentItemsList { public: - - /* use one of the two constructors to set up next item iteration */ + // use one of the two constructors to set up next item iteration BRecentFilesList(int32 maxItems = 10, bool navMenuFolders = false, - const char *ofType = NULL, const char *openedByAppSig = NULL); - BRecentFilesList(int32 maxItems, bool navMenuFolders, const char *ofTypeList[], - int32 ofTypeListCount, const char *openedByAppSig = NULL); + const char* ofType = NULL, const char* openedByAppSig = NULL); + BRecentFilesList(int32 maxItems, bool navMenuFolders, const char* ofTypeList[], + int32 ofTypeListCount, const char* openedByAppSig = NULL); virtual ~BRecentFilesList(); - /* use one of the two NewFileListMenu calls to get an entire menu */ - static BMenu *NewFileListMenu(const char *title, - BMessage *openFileMessage = NULL, BMessage *openFolderMessage = NULL, - BHandler *target = NULL, + // use one of the two NewFileListMenu calls to get an entire menu + static BMenu* NewFileListMenu(const char* title, + BMessage* openFileMessage = NULL, BMessage* openFolderMessage = NULL, + BHandler* target = NULL, int32 maxItems = 10, bool navMenuFolders = false, - const char *ofType = NULL, const char *openedByAppSig = NULL); + const char* ofType = NULL, const char* openedByAppSig = NULL); - static BMenu *NewFileListMenu(const char *title, - BMessage *openFileMessage, BMessage *openFolderMessage, - BHandler *target, + static BMenu* NewFileListMenu(const char* title, + BMessage* openFileMessage, BMessage* openFolderMessage, + BHandler* target, int32 maxItems, bool navMenuFolders, - const char *ofTypeList[], int32 ofTypeListCount, - const char *openedByAppSig); + const char* ofTypeList[], int32 ofTypeListCount, + const char* openedByAppSig); - virtual status_t GetNextRef(entry_ref *); + virtual status_t GetNextRef(entry_ref*); protected: - BString fType; - char **fTypes; + char** fTypes; int32 fTypeCount; BString fAppSig; @@ -142,24 +139,25 @@ private: virtual void _r19(); virtual void _r110(); - uint32 _reserved[20]; + uint32 _reserved[20]; }; + class BRecentFoldersList : public BRecentItemsList { public: - /* use the constructor to set up next item iteration */ + // use the constructor to set up next item iteration BRecentFoldersList(int32 maxItems, bool navMenuFolders = false, - const char *openedByAppSig = NULL); + const char* openedByAppSig = NULL); - /* use NewFolderListMenu to get an entire menu */ - static BMenu *NewFolderListMenu(const char *title, - BMessage *openMessage = NULL, BHandler *target = NULL, + // use NewFolderListMenu to get an entire menu + static BMenu* NewFolderListMenu(const char* title, + BMessage* openMessage = NULL, BHandler* target = NULL, int32 maxItems = 10, bool navMenuFolders = false, - const char *openedByAppSig = NULL); + const char* openedByAppSig = NULL); - virtual status_t GetNextRef(entry_ref *); + virtual status_t GetNextRef(entry_ref*); -protected: +protected: BString fAppSig; private: @@ -174,20 +172,21 @@ private: virtual void _r29(); virtual void _r210(); - uint32 _reserved[20]; + uint32 _reserved[20]; }; + class BRecentAppsList : public BRecentItemsList { public: - /* use the constructor to set up next item iteration */ + // use the constructor to set up next item iteration BRecentAppsList(int32 maxItems); - /* use NewFolderListMenu to get an entire menu */ - static BMenu *NewAppListMenu(const char *title, - BMessage *openMessage = NULL, BHandler *target = NULL, + // use NewFolderListMenu to get an entire menu + static BMenu* NewAppListMenu(const char* title, + BMessage* openMessage = NULL, BHandler* target = NULL, int32 maxItems = 10); - virtual status_t GetNextRef(entry_ref *); + virtual status_t GetNextRef(entry_ref*); private: virtual void _r31(); @@ -201,7 +200,7 @@ private: virtual void _r39(); virtual void _r310(); - uint32 _reserved[20]; + uint32 _reserved[20]; }; -#endif +#endif // __RECENT_ITEMS_LIST__ diff --git a/src/kits/tracker/RegExp.cpp b/src/kits/tracker/RegExp.cpp index 573a3e00ed..0359c04f21 100644 --- a/src/kits/tracker/RegExp.cpp +++ b/src/kits/tracker/RegExp.cpp @@ -61,6 +61,7 @@ All rights reserved. // ALTERED VERSION: Adapted to ANSI C and C++ for the OpenTracker // project (www.opentracker.org), Jul 11, 2000. + #include #include #include @@ -69,6 +70,7 @@ All rights reserved. #include "RegExp.h" + // The first byte of the regexp internal "program" is actually this magic // number; the start node begins in the second byte. @@ -105,7 +107,7 @@ const uint8 kRegExpMagic = 0234; // because of operator precedence.) The operand of some types of node is // a literal string; for others, it is a node leading into a sub-FSM. In // particular, the operand of a kRegExpBranch node is the first node of the branch. -// (NB this is *not* a tree structure: the tail of the branch connects +// (NB this is* not* a tree structure: the tail of the branch connects // to the thing following the set of kRegExpBranches.) The opcodes are: // @@ -161,7 +163,7 @@ enum { // but allows patterns to get big without disasters. // -const char *kMeta = "^$.[()|?+*\\"; +const char* kMeta = "^$.[()|?+*\\"; const int32 kMaxSize = 32767L; // Probably could be 65535L. // Flags to be passed up and down: @@ -172,7 +174,7 @@ enum { kWorst = 0 // Worst case. }; -const char *kRegExpErrorStringArray[] = { +const char* kRegExpErrorStringArray[] = { "Unmatched parenthesis.", "Expression too long.", "Too many parenthesis.", @@ -200,13 +202,15 @@ RegExp::RegExp() { } -RegExp::RegExp(const char *pattern) + +RegExp::RegExp(const char* pattern) : fError(B_OK), fRegExp(NULL) { fRegExp = Compile(pattern); } + RegExp::RegExp(const BString &pattern) : fError(B_OK), fRegExp(NULL) @@ -214,21 +218,22 @@ RegExp::RegExp(const BString &pattern) fRegExp = Compile(pattern.String()); } + RegExp::~RegExp() { free(fRegExp); } - status_t RegExp::InitCheck() const { return fError; } + status_t -RegExp::SetTo(const char *pattern) +RegExp::SetTo(const char* pattern) { fError = B_OK; free(fRegExp); @@ -236,6 +241,7 @@ RegExp::SetTo(const char *pattern) return fError; } + status_t RegExp::SetTo(const BString &pattern) { @@ -245,8 +251,9 @@ RegExp::SetTo(const BString &pattern) return fError; } + bool -RegExp::Matches(const char *string) const +RegExp::Matches(const char* string) const { if (!fRegExp || !string) return false; @@ -254,6 +261,7 @@ RegExp::Matches(const char *string) const return RunMatcher(fRegExp, string) == 1; } + bool RegExp::Matches(const BString &string) const { @@ -278,13 +286,12 @@ RegExp::Matches(const BString &string) const // // Beware that the optimization-preparation code in here knows about some // of the structure of the compiled regexp. - -regexp * -RegExp::Compile(const char *exp) +regexp* +RegExp::Compile(const char* exp) { - regexp *r; - const char *scan; - const char *longest; + regexp* r; + const char* scan; + const char* longest; int32 len; int32 flags; @@ -308,8 +315,8 @@ RegExp::Compile(const char *exp) return NULL; } - // Allocate space. - r = (regexp *)malloc(sizeof(regexp) + fCodeSize); + r = (regexp*)malloc(sizeof(regexp) + fCodeSize); + // Allocate space if (!r) { SetError(B_NO_MEMORY); @@ -331,8 +338,10 @@ RegExp::Compile(const char *exp) r->reganch = 0; r->regmust = NULL; r->regmlen = 0; - scan = r->program + 1; // First kRegExpBranch. - if (*Next((char *)scan) == kRegExpEnd) { // Only one top-level choice. + scan = r->program + 1; + // First kRegExpBranch. + if (*Next((char*)scan) == kRegExpEnd) { + // Only one top-level choice. scan = Operand(scan); // Starting-point info. @@ -341,18 +350,16 @@ RegExp::Compile(const char *exp) else if (*scan == kRegExpBol) r->reganch++; - // // If there's something expensive in the r.e., find the // longest literal string that must appear and make it the // regmust. Resolve ties in favor of later strings, since // the regstart check works with the beginning of the r.e. // and avoiding duplication strengthens checking. Not a // strong reason, but sufficient in the absence of others. - // if (flags&kSPStart) { longest = NULL; len = 0; - for (; scan != NULL; scan = Next((char *)scan)) + for (; scan != NULL; scan = Next((char*)scan)) if (*scan == kRegExpExactly && (int32)strlen(Operand(scan)) >= len) { longest = Operand(scan); len = (int32)strlen(Operand(scan)); @@ -365,13 +372,15 @@ RegExp::Compile(const char *exp) return r; } -regexp * + +regexp* RegExp::Expression() const { return fRegExp; } -const char * + +const char* RegExp::ErrorString() const { if (fError >= REGEXP_UNMATCHED_PARENTHESIS @@ -398,12 +407,12 @@ RegExp::SetError(status_t error) const // is a trifle forced, but the need to tie the tails of the branches to what // follows makes it hard to avoid. // -char * -RegExp::Reg(int32 paren, int32 *flagp) +char* +RegExp::Reg(int32 paren, int32* flagp) { - char *ret; - char *br; - char *ender; + char* ret; + char* br; + char* ender; int32 parno = 0; int32 flags; @@ -469,17 +478,18 @@ RegExp::Reg(int32 paren, int32 *flagp) return ret; } + // // - Branch - one alternative of an | operator // // Implements the concatenation operator. // -char * -RegExp::Branch(int32 *flagp) +char* +RegExp::Branch(int32* flagp) { - char *ret; - char *chain; - char *latest; + char* ret; + char* chain; + char* latest; int32 flags; *flagp = kWorst; // Tentatively. @@ -505,6 +515,7 @@ RegExp::Branch(int32 *flagp) return ret; } + // // - Piece - something followed by possible [*+?] // @@ -514,12 +525,12 @@ RegExp::Branch(int32 *flagp) // It might seem that this node could be dispensed with entirely, but the // endmarker role is not redundant. // -char * -RegExp::Piece(int32 *flagp) +char* +RegExp::Piece(int32* flagp) { - char *ret; + char* ret; char op; - char *next; + char* next; int32 flags; ret = Atom(&flags); @@ -572,6 +583,7 @@ RegExp::Piece(int32 *flagp) return ret; } + // // - Atom - the lowest level // @@ -580,10 +592,10 @@ RegExp::Piece(int32 *flagp) // faster to run. Backslashed characters are exceptions, each becoming a // separate node; the code is simpler that way and it's not worth fixing. // -char * -RegExp::Atom(int32 *flagp) +char* +RegExp::Atom(int32* flagp) { - char *ret; + char* ret; int32 flags; *flagp = kWorst; // Tentatively. @@ -695,14 +707,15 @@ RegExp::Atom(int32 *flagp) return ret; } + // // - Node - emit a node // -char * // Location. +char* // Location. RegExp::Node(char op) { - char *ret; - char *ptr; + char* ret; + char* ptr; ret = fCodeEmitPointer; if (ret == &fDummy) { @@ -719,6 +732,7 @@ RegExp::Node(char op) return ret; } + // // - Char - emit (if appropriate) a byte of code // @@ -731,17 +745,18 @@ RegExp::Char(char b) fCodeSize++; } + // // - Insert - insert an operator in front of already-emitted operand // // Means relocating the operand. // void -RegExp::Insert(char op, char *opnd) +RegExp::Insert(char op, char* opnd) { - char *src; - char *dst; - char *place; + char* src; + char* dst; + char* place; if (fCodeEmitPointer == &fDummy) { fCodeSize += 3; @@ -760,14 +775,15 @@ RegExp::Insert(char op, char *opnd) *place++ = '\0'; } + // // - Tail - set the next-pointer at the end of a node chain // void -RegExp::Tail(char *p, char *val) +RegExp::Tail(char* p, char* val) { - char *scan; - char *temp; + char* scan; + char* temp; int32 offset; if (p == &fDummy) @@ -791,11 +807,12 @@ RegExp::Tail(char *p, char *val) scan[2] = (char)(offset & 0377); } + // // - OpTail - Tail on operand of first argument; nop if operandless // void -RegExp::OpTail(char *p, char *val) +RegExp::OpTail(char* p, char* val) { // "Operandless" and "op != kRegExpBranch" are synonymous in practice. if (p == NULL || p == &fDummy || *p != kRegExpBranch) @@ -807,13 +824,14 @@ RegExp::OpTail(char *p, char *val) // RunMatcher and friends // + // // - RunMatcher - match a regexp against a string // int32 -RegExp::RunMatcher(regexp *prog, const char *string) const +RegExp::RunMatcher(regexp* prog, const char* string) const { - const char *s; + const char* s; // Be paranoid... if (prog == NULL || string == NULL) { @@ -866,11 +884,12 @@ RegExp::RunMatcher(regexp *prog, const char *string) const return 0; } + // // - Try - try match at specific point // int32 // 0 failure, 1 success -RegExp::Try(regexp *prog, const char *string) const +RegExp::Try(regexp* prog, const char* string) const { int32 i; const char **sp; @@ -894,6 +913,7 @@ RegExp::Try(regexp *prog, const char *string) const return 0; } + // // - Match - main matching routine // @@ -905,10 +925,10 @@ RegExp::Try(regexp *prog, const char *string) const // by recursion. /// int32 // 0 failure, 1 success -RegExp::Match(const char *prog) const +RegExp::Match(const char* prog) const { - const char *scan; // Current node. - const char *next; // Next node. + const char* scan; // Current node. + const char* next; // Next node. scan = prog; #ifdef DEBUG @@ -938,7 +958,7 @@ RegExp::Match(const char *prog) const break; case kRegExpExactly: { - const char *opnd = Operand(scan); + const char* opnd = Operand(scan); // Inline the first character, for speed. if (*opnd != *fStringInputPointer) return 0; @@ -977,7 +997,7 @@ RegExp::Match(const char *prog) const case kRegExpOpen + 9: { int32 no; - const char *save; + const char* save; no = *scan - kRegExpOpen; save = fStringInputPointer; @@ -1006,7 +1026,7 @@ RegExp::Match(const char *prog) const case kRegExpClose + 9: { int32 no; - const char *save; + const char* save; no = *scan - kRegExpClose; save = fStringInputPointer; @@ -1026,7 +1046,7 @@ RegExp::Match(const char *prog) const break; case kRegExpBranch: { - const char *save; + const char* save; if (*next != kRegExpBranch) // No choice. next = Operand(scan); // Avoid recursion. @@ -1048,7 +1068,7 @@ RegExp::Match(const char *prog) const { char nextch; int32 no; - const char *save; + const char* save; int32 min; // @@ -1092,15 +1112,16 @@ RegExp::Match(const char *prog) const return 0; } + // // - Repeat - repeatedly match something simple, report how many // int32 -RegExp::Repeat(const char *p) const +RegExp::Repeat(const char* p) const { int32 count = 0; - const char *scan; - const char *opnd; + const char* scan; + const char* opnd; scan = fStringInputPointer; opnd = Operand(p); @@ -1141,11 +1162,12 @@ RegExp::Repeat(const char *p) const return count; } + // // - Next - dig the "next" pointer out of a node // -char * -RegExp::Next(char *p) +char* +RegExp::Next(char* p) { int32 offset; @@ -1162,8 +1184,9 @@ RegExp::Next(char *p) return p + offset; } -const char * -RegExp::Next(const char *p) const + +const char* +RegExp::Next(const char* p) const { int32 offset; @@ -1180,24 +1203,28 @@ RegExp::Next(const char *p) const return p + offset; } + inline int32 -RegExp::UCharAt(const char *p) const +RegExp::UCharAt(const char* p) const { return (int32)*(unsigned char *)p; } -inline char * + +inline char* RegExp::Operand(char* p) const { return p + 3; } -inline const char * + +inline const char* RegExp::Operand(const char* p) const { return p + 3; } + inline bool RegExp::IsMult(char c) const { @@ -1207,15 +1234,16 @@ RegExp::IsMult(char c) const #ifdef DEBUG + // // - Dump - dump a regexp onto stdout in vaguely comprehensible form // void RegExp::Dump() { - const char *s; + const char* s; char op = kRegExpExactly; // Arbitrary non-kRegExpEnd op. - const char *next; + const char* next; s = fRegExp->program + 1; while (op != kRegExpEnd) { // While that wasn't kRegExpEnd last time... @@ -1248,13 +1276,14 @@ RegExp::Dump() printf("\n"); } + // // - Prop - printable representation of opcode // -char * -RegExp::Prop(const char *op) const +char* +RegExp::Prop(const char* op) const { - const char *p = NULL; + const char* p = NULL; static char buf[50]; (void) strcpy(buf, ":"); @@ -1331,8 +1360,9 @@ RegExp::Prop(const char *op) const return buf; } + void -RegExp::RegExpError(const char *) const +RegExp::RegExpError(const char*) const { // does nothing now, perhaps it should printf? } diff --git a/src/kits/tracker/RegExp.h b/src/kits/tracker/RegExp.h index 509f496768..699e0d66ad 100644 --- a/src/kits/tracker/RegExp.h +++ b/src/kits/tracker/RegExp.h @@ -31,6 +31,8 @@ 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. */ +#ifndef _REG_EXP_H +#define _REG_EXP_H // This code is based on regexp.c, v.1.3 by Henry Spencer: @@ -62,13 +64,13 @@ All rights reserved. // ALTERED VERSION: Adapted to ANSI C and C++ for the OpenTracker // project (www.opentracker.org), Jul 11, 2000. -#ifndef _REG_EXP_H -#define _REG_EXP_H #include + namespace BPrivate { + enum { REGEXP_UNMATCHED_PARENTHESIS = B_ERRORS_END, REGEXP_TOO_BIG, @@ -90,21 +92,21 @@ enum { const int32 kSubExpressionMax = 10; struct regexp { - const char *startp[kSubExpressionMax]; - const char *endp[kSubExpressionMax]; - char regstart; /* Internal use only. See RegExp.cpp for details. */ - char reganch; /* Internal use only. */ - const char *regmust;/* Internal use only. */ - int regmlen; /* Internal use only. */ - char program[1]; /* Unwarranted chumminess with compiler. */ + const char* startp[kSubExpressionMax]; + const char* endp[kSubExpressionMax]; + char regstart; // Internal use only. See RegExp.cpp for details. + char reganch; // Internal use only. + const char* regmust;// Internal use only. + int regmlen; // Internal use only. + char program[1]; // Unwarranted chumminess with compiler. }; -class RegExp { +class RegExp { public: RegExp(); - RegExp(const char *); - RegExp(const BString &); + RegExp(const char*); + RegExp(const BString&); ~RegExp(); status_t InitCheck() const; @@ -112,73 +114,73 @@ public: status_t SetTo(const char*); status_t SetTo(const BString &); - bool Matches(const char *string) const; + bool Matches(const char* string) const; bool Matches(const BString &) const; - int32 RunMatcher(regexp *, const char *) const; - regexp *Compile(const char *); - regexp *Expression() const; - const char *ErrorString() const; + int32 RunMatcher(regexp*, const char*) const; + regexp* Compile(const char*); + regexp* Expression() const; + const char* ErrorString() const; #ifdef DEBUG void Dump(); #endif private: - void SetError(status_t error) const; // Working functions for Compile(): - char *Reg(int32, int32 *); - char *Branch(int32 *); - char *Piece(int32 *); - char *Atom(int32 *); - char *Node(char); - char *Next(char *); - const char *Next(const char *) const; + char* Reg(int32, int32*); + char* Branch(int32*); + char* Piece(int32*); + char* Atom(int32*); + char* Node(char); + char* Next(char*); + const char* Next(const char*) const; void Char(char); - void Insert(char, char *); - void Tail(char *, char *); - void OpTail(char *, char *); + void Insert(char, char*); + void Tail(char*, char*); + void OpTail(char*, char*); // Working functions for RunMatcher(): - int32 Try(regexp *, const char *) const; - int32 Match(const char *) const; - int32 Repeat(const char *) const; + int32 Try(regexp*, const char*) const; + int32 Match(const char*) const; + int32 Repeat(const char*) const; // Utility functions: #ifdef DEBUG - char *Prop(const char *) const; - void RegExpError(const char *) const; + char* Prop(const char*) const; + void RegExpError(const char*) const; #endif - inline int32 UCharAt(const char *p) const; - inline char *Operand(char* p) const; - inline const char *Operand(const char* p) const; + inline int32 UCharAt(const char* p) const; + inline char* Operand(char* p) const; + inline const char* Operand(const char* p) const; inline bool IsMult(char c) const; // --------- Variables ------------- mutable status_t fError; - regexp *fRegExp; + regexp* fRegExp; // Work variables for Compile(). - - const char *fInputScanPointer; - int32 fParenthesisCount; + const char* fInputScanPointer; + int32 fParenthesisCount; char fDummy; - char *fCodeEmitPointer; // &fDummy = don't. - long fCodeSize; + char* fCodeEmitPointer; + // &fDummy = don't. + long fCodeSize; // Work variables for RunMatcher(). - - mutable const char *fStringInputPointer; - mutable const char *fRegBol; // Beginning of input, for ^ check. - mutable const char **fStartPArrayPointer; - mutable const char **fEndPArrayPointer; + mutable const char* fStringInputPointer; + mutable const char* fRegBol; + // Beginning of input, for ^ check. + mutable const char** fStartPArrayPointer; + mutable const char** fEndPArrayPointer; }; + } // namespace BPrivate using namespace BPrivate; -#endif +#endif // _REG_EXP_H diff --git a/src/kits/tracker/SelectionWindow.cpp b/src/kits/tracker/SelectionWindow.cpp index 6743d65865..f3ca9f6a29 100644 --- a/src/kits/tracker/SelectionWindow.cpp +++ b/src/kits/tracker/SelectionWindow.cpp @@ -70,11 +70,11 @@ SelectionWindow::SelectionWindow(BContainerWindow* window) AddToSubset(fParentWindow); - BView *backgroundView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW); + BView* backgroundView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW); backgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(backgroundView); - BMenu *menu = new BPopUpMenu(""); + BMenu* menu = new BPopUpMenu(""); menu->AddItem(new BMenuItem(B_TRANSLATE("starts with"), NULL)); menu->AddItem(new BMenuItem(B_TRANSLATE("ends with"), NULL)); menu->AddItem(new BMenuItem(B_TRANSLATE("contains"), NULL)); @@ -188,7 +188,7 @@ SelectionWindow::SelectionWindow(BContainerWindow* window) void -SelectionWindow::MessageReceived(BMessage *message) +SelectionWindow::MessageReceived(BMessage* message) { switch (message->what) { case kSelectButtonPressed: @@ -200,7 +200,7 @@ SelectionWindow::MessageReceived(BMessage *message) // (Hide is synhcronous, while PostMessage is not.) // See PoseView::SelectMatchingEntries(). - BMessage *selectionInfo = new BMessage(kSelectMatchingEntries); + BMessage* selectionInfo = new BMessage(kSelectMatchingEntries); selectionInfo->AddInt32("ExpressionType", ExpressionType()); BString expression; Expression(expression); @@ -256,7 +256,7 @@ SelectionWindow::ExpressionType() const if (!fMatchingTypeMenuField->LockLooper()) return kNone; - BMenuItem *item = fMatchingTypeMenuField->Menu()->FindMarked(); + BMenuItem* item = fMatchingTypeMenuField->Menu()->FindMarked(); if (!item) { fMatchingTypeMenuField->UnlockLooper(); return kNone; diff --git a/src/kits/tracker/SelectionWindow.h b/src/kits/tracker/SelectionWindow.h index 2ac72d35fa..c4f37ef2d3 100644 --- a/src/kits/tracker/SelectionWindow.h +++ b/src/kits/tracker/SelectionWindow.h @@ -31,10 +31,10 @@ 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. */ - -#ifndef _SELECTION_WINDOW_H +#ifndef _SELECTION_WINDOW_H #define _SELECTION_WINDOW_H + #include #include #include @@ -44,32 +44,33 @@ All rights reserved. #include "TrackerString.h" + namespace BPrivate { class BContainerWindow; class SelectionWindow : public BWindow { public: - SelectionWindow(BContainerWindow *); + SelectionWindow(BContainerWindow*); - void MessageReceived(BMessage *); + void MessageReceived(BMessage*); bool QuitRequested(); - + void MoveCloseToMouse(); - + TrackerStringExpressionType ExpressionType() const; void Expression(BString &result) const; bool IgnoreCase() const; bool Invert() const; - -private: - BContainerWindow *fParentWindow; - BMenuField *fMatchingTypeMenuField; - BTextControl *fExpressionTextControl; - BCheckBox *fInverseCheckBox; - BCheckBox *fIgnoreCaseCheckBox; - BButton *fSelectButton; +private: + BContainerWindow* fParentWindow; + + BMenuField* fMatchingTypeMenuField; + BTextControl* fExpressionTextControl; + BCheckBox* fInverseCheckBox; + BCheckBox* fIgnoreCaseCheckBox; + BButton* fSelectButton; typedef BWindow _inherited; }; @@ -78,4 +79,4 @@ private: using namespace BPrivate; -#endif +#endif // _SELECTION_WINDOW_H diff --git a/src/kits/tracker/Settings.cpp b/src/kits/tracker/Settings.cpp index c67c2f0805..ef07761dcd 100644 --- a/src/kits/tracker/Settings.cpp +++ b/src/kits/tracker/Settings.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include @@ -40,12 +41,13 @@ All rights reserved. #include "TrackerSettings.h" -Settings *settings = NULL; + +Settings* settings = NULL; // generic setting handler classes -StringValueSetting::StringValueSetting(const char *name, const char *defaultValue, - const char *valueExpectedErrorString, const char *wrongValueErrorString) +StringValueSetting::StringValueSetting(const char* name, const char* defaultValue, + const char* valueExpectedErrorString, const char* wrongValueErrorString) : SettingsArgvDispatcher(name), fDefaultValue(defaultValue), fValueExpectedErrorString(valueExpectedErrorString), @@ -54,57 +56,67 @@ StringValueSetting::StringValueSetting(const char *name, const char *defaultValu { } + StringValueSetting::~StringValueSetting() { } -void -StringValueSetting::ValueChanged(const char *newValue) + +void +StringValueSetting::ValueChanged(const char* newValue) { fValue = newValue; } -const char * + +const char* StringValueSetting::Value() const { return fValue.String(); } -void -StringValueSetting::SaveSettingValue(Settings *settings) + +void +StringValueSetting::SaveSettingValue(Settings* settings) { settings->Write("\"%s\"", fValue.String()); } -bool + +bool StringValueSetting::NeedsSaving() const { // needs saving if different than default return fValue != fDefaultValue; } -const char * -StringValueSetting::Handle(const char *const *argv) + +const char* +StringValueSetting::Handle(const char* const* argv) { - if (!*++argv) + if (!*++argv) return fValueExpectedErrorString; - ValueChanged(*argv); + ValueChanged(*argv); return 0; } + // #pragma mark - -EnumeratedStringValueSetting::EnumeratedStringValueSetting(const char *name, - const char *defaultValue, const char *const *values, const char *valueExpectedErrorString, - const char *wrongValueErrorString) - : StringValueSetting(name, defaultValue, valueExpectedErrorString, wrongValueErrorString), + +EnumeratedStringValueSetting::EnumeratedStringValueSetting(const char* name, + const char* defaultValue, const char* const* values, + const char* valueExpectedErrorString, const char* wrongValueErrorString) + : StringValueSetting(name, defaultValue, valueExpectedErrorString, + wrongValueErrorString), fValues(values) { } -void -EnumeratedStringValueSetting::ValueChanged(const char *newValue) + +void +EnumeratedStringValueSetting::ValueChanged(const char* newValue) { #if DEBUG // must be one of the enumerated values @@ -112,8 +124,10 @@ EnumeratedStringValueSetting::ValueChanged(const char *newValue) for (int32 index = 0; ; index++) { if (!fValues[index]) break; - if (strcmp(fValues[index], newValue) != 0) + + if (strcmp(fValues[index], newValue) != 0) continue; + found = true; break; } @@ -122,33 +136,38 @@ EnumeratedStringValueSetting::ValueChanged(const char *newValue) StringValueSetting::ValueChanged(newValue); } -const char * -EnumeratedStringValueSetting::Handle(const char *const *argv) + +const char* +EnumeratedStringValueSetting::Handle(const char* const* argv) { - if (!*++argv) + if (!*++argv) return fValueExpectedErrorString; bool found = false; for (int32 index = 0; ; index++) { if (!fValues[index]) break; - if (strcmp(fValues[index], *argv) != 0) + + if (strcmp(fValues[index], *argv) != 0) continue; + found = true; break; - } - + } + if (!found) return fWrongValueErrorString; - - ValueChanged(*argv); + + ValueChanged(*argv); return 0; } + // #pragma mark - -ScalarValueSetting::ScalarValueSetting(const char *name, int32 defaultValue, - const char *valueExpectedErrorString, const char *wrongValueErrorString, + +ScalarValueSetting::ScalarValueSetting(const char* name, int32 defaultValue, + const char* valueExpectedErrorString, const char* wrongValueErrorString, int32 min, int32 max) : SettingsArgvDispatcher(name), fDefaultValue(defaultValue), @@ -160,7 +179,8 @@ ScalarValueSetting::ScalarValueSetting(const char *name, int32 defaultValue, { } -void + +void ScalarValueSetting::ValueChanged(int32 newValue) { ASSERT(newValue > fMin); @@ -168,22 +188,25 @@ ScalarValueSetting::ValueChanged(int32 newValue) fValue = newValue; } + int32 ScalarValueSetting::Value() const { return fValue; } -void -ScalarValueSetting::GetValueAsString(char *buffer) const + +void +ScalarValueSetting::GetValueAsString(char* buffer) const { sprintf(buffer, "%ld", fValue); } -const char * -ScalarValueSetting::Handle(const char *const *argv) + +const char* +ScalarValueSetting::Handle(const char* const* argv) { - if (!*++argv) + if (!*++argv) return fValueExpectedErrorString; int32 newValue; @@ -194,68 +217,79 @@ ScalarValueSetting::Handle(const char *const *argv) if (newValue < fMin || newValue > fMax) return fWrongValueErrorString; - - fValue = newValue; + + fValue = newValue; return NULL; } -void -ScalarValueSetting::SaveSettingValue(Settings *settings) + +void +ScalarValueSetting::SaveSettingValue(Settings* settings) { settings->Write("%ld", fValue); } -bool + +bool ScalarValueSetting::NeedsSaving() const { return fValue != fDefaultValue; } + // #pragma mark - -HexScalarValueSetting::HexScalarValueSetting(const char *name, int32 defaultValue, - const char *valueExpectedErrorString, const char *wrongValueErrorString, + +HexScalarValueSetting::HexScalarValueSetting(const char* name, int32 defaultValue, + const char* valueExpectedErrorString, const char* wrongValueErrorString, int32 min, int32 max) : ScalarValueSetting(name, defaultValue, valueExpectedErrorString, wrongValueErrorString, min, max) { } -void -HexScalarValueSetting::GetValueAsString(char *buffer) const + +void +HexScalarValueSetting::GetValueAsString(char* buffer) const { sprintf(buffer, "0x%08lx", fValue); } -void -HexScalarValueSetting::SaveSettingValue(Settings *settings) + +void +HexScalarValueSetting::SaveSettingValue(Settings* settings) { settings->Write("0x%08lx", fValue); } + // #pragma mark - -BooleanValueSetting::BooleanValueSetting(const char *name, bool defaultValue) + +BooleanValueSetting::BooleanValueSetting(const char* name, bool defaultValue) : ScalarValueSetting(name, defaultValue, 0, 0) { } -bool + +bool BooleanValueSetting::Value() const { return fValue != 0; } + void BooleanValueSetting::SetValue(bool value) { - fValue = value; + fValue = value; } -const char * -BooleanValueSetting::Handle(const char *const *argv) + +const char* +BooleanValueSetting::Handle(const char* const* argv) { - if (!*++argv) + if (!*++argv) return "on or off expected"; if (strcmp(*argv, "on") == 0) @@ -268,9 +302,9 @@ BooleanValueSetting::Handle(const char *const *argv) return 0; } -void -BooleanValueSetting::SaveSettingValue(Settings *settings) + +void +BooleanValueSetting::SaveSettingValue(Settings* settings) { settings->Write(fValue ? "on" : "off"); } - diff --git a/src/kits/tracker/Settings.h b/src/kits/tracker/Settings.h index 3fc385796a..3758b6f938 100644 --- a/src/kits/tracker/Settings.h +++ b/src/kits/tracker/Settings.h @@ -31,37 +31,38 @@ 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. */ - #ifndef _SETTINGS_H_ #define _SETTINGS_H_ + #include #include "SettingsHandler.h" + namespace BPrivate { -extern Settings *settings; +extern Settings* settings; class StringValueSetting : public SettingsArgvDispatcher { // simple string setting public: - StringValueSetting(const char *name, const char *defaultValue, - const char *valueExpectedErrorString, - const char *wrongValueErrorString); + StringValueSetting(const char* name, const char* defaultValue, + const char* valueExpectedErrorString, + const char* wrongValueErrorString); virtual ~StringValueSetting(); - void ValueChanged(const char *newValue); - const char *Value() const; - virtual const char *Handle(const char *const *argv); + void ValueChanged(const char* newValue); + const char* Value() const; + virtual const char* Handle(const char* const *argv); protected: - virtual void SaveSettingValue(Settings *); + virtual void SaveSettingValue(Settings*); virtual bool NeedsSaving() const; - const char *fDefaultValue; - const char *fValueExpectedErrorString; - const char *fWrongValueErrorString; + const char* fDefaultValue; + const char* fValueExpectedErrorString; + const char* fWrongValueErrorString; BString fValue; }; @@ -69,31 +70,31 @@ class EnumeratedStringValueSetting : public StringValueSetting { // string setting, values that do not match string enumeration // are rejected public: - EnumeratedStringValueSetting(const char *name, const char *defaultValue, - const char *const *values, const char *valueExpectedErrorString, - const char *wrongValueErrorString); + EnumeratedStringValueSetting(const char* name, const char* defaultValue, + const char* const* values, const char* valueExpectedErrorString, + const char* wrongValueErrorString); - void ValueChanged(const char *newValue); - virtual const char *Handle(const char *const *argv); + void ValueChanged(const char* newValue); + virtual const char* Handle(const char* const *argv); protected: - const char *const *fValues; + const char* const* fValues; }; class ScalarValueSetting : public SettingsArgvDispatcher { // simple int32 setting public: - ScalarValueSetting(const char *name, int32 defaultValue, - const char *valueExpectedErrorString, const char *wrongValueErrorString, + ScalarValueSetting(const char* name, int32 defaultValue, + const char* valueExpectedErrorString, const char* wrongValueErrorString, int32 min = LONG_MIN, int32 max = LONG_MAX); void ValueChanged(int32 newValue); int32 Value() const; - void GetValueAsString(char *) const; - virtual const char *Handle(const char *const *argv); + void GetValueAsString(char*) const; + virtual const char* Handle(const char* const *argv); protected: - virtual void SaveSettingValue(Settings *); + virtual void SaveSettingValue(Settings*); virtual bool NeedsSaving() const; int32 fDefaultValue; @@ -101,38 +102,38 @@ protected: int32 fMax; int32 fMin; - const char *fValueExpectedErrorString; - const char *fWrongValueErrorString; + const char* fValueExpectedErrorString; + const char* fWrongValueErrorString; }; class HexScalarValueSetting : public ScalarValueSetting { // hexadecimal int32 setting public: - HexScalarValueSetting(const char *name, int32 defaultValue, - const char *valueExpectedErrorString, const char *wrongValueErrorString, + HexScalarValueSetting(const char* name, int32 defaultValue, + const char* valueExpectedErrorString, const char* wrongValueErrorString, int32 min = LONG_MIN, int32 max = LONG_MAX); - void GetValueAsString(char *buffer) const; + void GetValueAsString(char* buffer) const; protected: - virtual void SaveSettingValue(Settings *settings); + virtual void SaveSettingValue(Settings* settings); }; class BooleanValueSetting : public ScalarValueSetting { // on-off setting public: - BooleanValueSetting(const char *name, bool defaultValue); + BooleanValueSetting(const char* name, bool defaultValue); bool Value() const; void SetValue(bool value); - virtual const char *Handle(const char *const *argv); + virtual const char* Handle(const char* const *argv); protected: - virtual void SaveSettingValue(Settings *); + virtual void SaveSettingValue(Settings*); }; } using namespace BPrivate; -#endif /* _SETTINGS_H_ */ +#endif // _SETTINGS_H_ diff --git a/src/kits/tracker/SettingsHandler.cpp b/src/kits/tracker/SettingsHandler.cpp index 4bfba1cfc1..d2b2cdf9d0 100644 --- a/src/kits/tracker/SettingsHandler.cpp +++ b/src/kits/tracker/SettingsHandler.cpp @@ -49,7 +49,7 @@ All rights reserved. #include "SettingsHandler.h" -ArgvParser::ArgvParser(const char *name) +ArgvParser::ArgvParser(const char* name) : fFile(0), fBuffer(NULL), fPos(-1), @@ -84,7 +84,8 @@ ArgvParser::~ArgvParser() fclose(fFile); } -void + +void ArgvParser::MakeArgvEmpty() { // done with current argv, free it up @@ -94,13 +95,14 @@ ArgvParser::MakeArgvEmpty() fArgc = 0; } -status_t -ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void *passThru) + +status_t +ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru) { if (fArgc) { NextArgv(); fCurrentArgv[fArgc] = 0; - const char *result = (argvHandlerFunc)(fArgc, fCurrentArgv, passThru); + const char* result = (argvHandlerFunc)(fArgc, fCurrentArgv, passThru); if (result) printf("File %s; Line %ld # %s", fFileName, fLineNo, result); MakeArgvEmpty(); @@ -111,7 +113,8 @@ ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void *passThru) return B_OK; } -void + +void ArgvParser::NextArgv() { if (fSawBackslash) { @@ -128,7 +131,8 @@ ArgvParser::NextArgv() fArgc++; } -void + +void ArgvParser::NextArgvIfNotEmpty() { if (!fSawBackslash && fCurrentArgsPos < 0) @@ -137,7 +141,8 @@ ArgvParser::NextArgvIfNotEmpty() NextArgv(); } -char + +char ArgvParser::GetCh() { if (fPos < 0 || fBuffer[fPos] == 0) { @@ -150,15 +155,19 @@ ArgvParser::GetCh() return fBuffer[fPos++]; } -status_t -ArgvParser::EachArgv(const char *name, ArgvHandler argvHandlerFunc, void *passThru) + +status_t +ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc, + void* passThru) { ArgvParser parser(name); return parser.EachArgvPrivate(name, argvHandlerFunc, passThru); } -status_t -ArgvParser::EachArgvPrivate(const char *name, ArgvHandler argvHandlerFunc, void *passThru) + +status_t +ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc, + void* passThru) { status_t result; @@ -183,17 +192,19 @@ ArgvParser::EachArgvPrivate(const char *name, ArgvHandler argvHandlerFunc, void result = B_ERROR; break; } - fLineNo++; + + fLineNo++; if (fSawBackslash) { fSawBackslash = false; continue; } + // end of line, flush all argv result = SendArgv(argvHandlerFunc, passThru); continue; } - + if (fEatComment) continue; @@ -241,13 +252,14 @@ ArgvParser::EachArgvPrivate(const char *name, ArgvHandler argvHandlerFunc, void } -SettingsArgvDispatcher::SettingsArgvDispatcher(const char *name) +SettingsArgvDispatcher::SettingsArgvDispatcher(const char* name) : name(name) { } -void -SettingsArgvDispatcher::SaveSettings(Settings *settings, bool onlyIfNonDefault) + +void +SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault) { if (!onlyIfNonDefault || NeedsSaving()) { settings->Write("%s ", Name()); @@ -256,8 +268,9 @@ SettingsArgvDispatcher::SaveSettings(Settings *settings, bool onlyIfNonDefault) } } -bool -SettingsArgvDispatcher::HandleRectValue(BRect &result, const char *const *argv, + +bool +SettingsArgvDispatcher::HandleRectValue(BRect &result, const char* const* argv, bool printError) { if (!*argv) { @@ -266,35 +279,41 @@ SettingsArgvDispatcher::HandleRectValue(BRect &result, const char *const *argv, return false; } result.left = atoi(*argv); + if (!*++argv) { if (printError) printf("rect top expected"); return false; } result.top = atoi(*argv); + if (!*++argv) { if (printError) printf("rect right expected"); return false; } result.right = atoi(*argv); + if (!*++argv) { if (printError) printf("rect bottom expected"); return false; } result.bottom = atoi(*argv); + return true; } -void -SettingsArgvDispatcher::WriteRectValue(Settings *setting, BRect rect) + +void +SettingsArgvDispatcher::WriteRectValue(Settings* setting, BRect rect) { setting->Write("%d %d %d %d", (int32)rect.left, (int32)rect.top, (int32)rect.right, (int32)rect.bottom); } -Settings::Settings(const char *filename, const char *settingsDirName) + +Settings::Settings(const char* filename, const char* settingsDirName) : fFileName(filename), fSettingsDir(settingsDirName), fList(0), @@ -302,7 +321,8 @@ Settings::Settings(const char *filename, const char *settingsDirName) fListSize(30), fCurrentSettings(0) { - fList = (SettingsArgvDispatcher **)calloc((size_t)fListSize, sizeof(SettingsArgvDispatcher *)); + fList = (SettingsArgvDispatcher**)calloc((size_t)fListSize, + sizeof(SettingsArgvDispatcher*)); } @@ -310,25 +330,27 @@ Settings::~Settings() { for (int32 index = 0; index < fCount; index++) delete fList[index]; - + free(fList); } -const char * -Settings::ParseUserSettings(int, const char *const *argv, void *castToThis) +const char* +Settings::ParseUserSettings(int, const char* const* argv, void* castToThis) { if (!*argv) return 0; - SettingsArgvDispatcher *handler = ((Settings *)castToThis)->Find(*argv); + SettingsArgvDispatcher* handler = ((Settings*)castToThis)->Find(*argv); if (!handler) return "unknown command"; + return handler->Handle(argv); } -bool -Settings::Add(SettingsArgvDispatcher *setting) + +bool +Settings::Add(SettingsArgvDispatcher* setting) { // check for uniqueness if (Find(setting->Name())) @@ -336,15 +358,16 @@ Settings::Add(SettingsArgvDispatcher *setting) if (fCount >= fListSize) { fListSize += 30; - fList = (SettingsArgvDispatcher **)realloc(fList, - fListSize * sizeof(SettingsArgvDispatcher *)); + fList = (SettingsArgvDispatcher**)realloc(fList, + fListSize * sizeof(SettingsArgvDispatcher*)); } fList[fCount++] = setting; return true; } -SettingsArgvDispatcher * -Settings::Find(const char *name) + +SettingsArgvDispatcher* +Settings::Find(const char* name) { for (int32 index = 0; index < fCount; index++) if (strcmp(name, fList[index]->Name()) == 0) @@ -353,7 +376,8 @@ Settings::Find(const char *name) return NULL; } -void + +void Settings::TryReadingSettings() { BPath prefsPath; @@ -366,14 +390,16 @@ Settings::TryReadingSettings() } } -void + +void Settings::SaveSettings(bool onlyIfNonDefault) { SaveCurrentSettings(onlyIfNonDefault); } -void -Settings::MakeSettingsDirectory(BDirectory *resultingSettingsDir) + +void +Settings::MakeSettingsDirectory(BDirectory* resultingSettingsDir) { BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) @@ -382,10 +408,10 @@ Settings::MakeSettingsDirectory(BDirectory *resultingSettingsDir) // make sure there is a directory // mkdir() will only make one leaf at a time, unfortunately path.Append(fSettingsDir); - char * ptr = (char *)alloca(strlen(path.Path()) + 1); + char* ptr = (char *)alloca(strlen(path.Path()) + 1); strcpy(ptr, path.Path()); - char * end = ptr+strlen(ptr); - char * mid = ptr+1; + char* end = ptr+strlen(ptr); + char* mid = ptr+1; while (mid < end) { mid = strchr(mid, '/'); if (!mid) break; @@ -398,7 +424,8 @@ Settings::MakeSettingsDirectory(BDirectory *resultingSettingsDir) resultingSettingsDir->SetTo(path.Path()); } -void + +void Settings::SaveCurrentSettings(bool onlyIfNonDefault) { BDirectory settingsDir; @@ -406,24 +433,25 @@ Settings::SaveCurrentSettings(bool onlyIfNonDefault) if (settingsDir.InitCheck() != B_OK) return; - + // nuke old settings BEntry entry(&settingsDir, fFileName); entry.Remove(); - + BFile prefs(&entry, O_RDWR | O_CREAT); if (prefs.InitCheck() != B_OK) return; fCurrentSettings = &prefs; - for (int32 index = 0; index < fCount; index++) + for (int32 index = 0; index < fCount; index++) fList[index]->SaveSettings(this, onlyIfNonDefault); fCurrentSettings = NULL; } -void -Settings::Write(const char *format, ...) + +void +Settings::Write(const char* format, ...) { va_list args; @@ -432,8 +460,9 @@ Settings::Write(const char *format, ...) va_end(args); } -void -Settings::VSWrite(const char *format, va_list arg) + +void +Settings::VSWrite(const char* format, va_list arg) { char fBuffer[2048]; vsprintf(fBuffer, format, arg); diff --git a/src/kits/tracker/SettingsHandler.h b/src/kits/tracker/SettingsHandler.h index 399398f2a3..255d889e09 100644 --- a/src/kits/tracker/SettingsHandler.h +++ b/src/kits/tracker/SettingsHandler.h @@ -31,16 +31,17 @@ 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. */ - #ifndef __SETTINGS_FILE__ #define __SETTINGS_FILE__ + #include #include #include #include #include + class BFile; class BDirectory; class BRect; @@ -49,9 +50,8 @@ namespace BPrivate { class Settings; -typedef const char *(*ArgvHandler)(int argc, const char *const *argv, void *params); +typedef const char* (*ArgvHandler)(int argc, const char* const *argv, void* params); // return 0 or error string if parsing failed - const int32 kBufferSize = 1024; @@ -59,18 +59,18 @@ class ArgvParser { // this class opens a text file and passes the context in argv // format to a specified handler public: - static status_t EachArgv(const char *name, - ArgvHandler argvHandlerFunc, void *passThru); + static status_t EachArgv(const char* name, + ArgvHandler argvHandlerFunc, void* passThru); private: - ArgvParser(const char *name); + ArgvParser(const char* name); ~ArgvParser(); - status_t EachArgvPrivate(const char *name, - ArgvHandler argvHandlerFunc, void *passThru); + status_t EachArgvPrivate(const char* name, + ArgvHandler argvHandlerFunc, void* passThru); char GetCh(); - - status_t SendArgv(ArgvHandler argvHandlerFunc, void *passThru); + + status_t SendArgv(ArgvHandler argvHandlerFunc, void* passThru); // done with a whole line of argv, send it off and get ready // to build a new one @@ -81,15 +81,15 @@ private: void MakeArgvEmpty(); - FILE *fFile; - char *fBuffer; + FILE* fFile; + char* fBuffer; int32 fPos; int fArgc; - char **fCurrentArgv; + char** fCurrentArgv; int32 fCurrentArgsPos; - char fCurrentArgs [1024]; + char fCurrentArgs[1024]; bool fSawBackslash; bool fEatComment; @@ -97,77 +97,78 @@ private: bool fInSingleQuote; int32 fLineNo; - const char *fFileName; + const char* fFileName; }; class SettingsArgvDispatcher { // base class for a single setting item public: - SettingsArgvDispatcher(const char *name); + SettingsArgvDispatcher(const char* name); virtual ~SettingsArgvDispatcher() {}; - void SaveSettings(Settings *settings, bool onlyIfNonDefault); + void SaveSettings(Settings* settings, bool onlyIfNonDefault); - const char *Name() const - { return name; } + const char* Name() const { return name; } // name as it appears in the settings file - virtual const char *Handle(const char *const *argv) = 0; + virtual const char* Handle(const char* const *argv) = 0; // override this adding an argv parser that reads in the // values in argv format for this setting // return a pointer to an error message or null if parsed OK - // some handy reader/writer calls - bool HandleRectValue(BRect &, const char *const *argv, bool printError = true); - void WriteRectValue(Settings *, BRect); + bool HandleRectValue(BRect&, const char* const *argv, bool printError = true); + void WriteRectValue(Settings*, BRect); protected: - virtual void SaveSettingValue(Settings *settings) = 0; + virtual void SaveSettingValue(Settings* settings) = 0; // override this to save the current value of this setting in a // text format - + virtual bool NeedsSaving() const { return true; } // override to return false if current value is equal to the default // and does not need saving + private: - const char *name; + const char* name; }; + class Settings { // this class is a list of all the settings handlers, reads and // saves the settings file public: - Settings(const char *filename, const char *settingsDirName); + Settings(const char* filename, const char* settingsDirName); ~Settings(); void TryReadingSettings(); void SaveSettings(bool onlyIfNonDefault = true); - bool Add(SettingsArgvDispatcher *); + bool Add(SettingsArgvDispatcher*); // return false if argv dispatcher with the same name already // registered - void Write(const char *format, ...); - void VSWrite(const char *, va_list); + void Write(const char* format, ...); + void VSWrite(const char*, va_list); private: - void MakeSettingsDirectory(BDirectory *); + void MakeSettingsDirectory(BDirectory*); - SettingsArgvDispatcher *Find(const char *); - static const char *ParseUserSettings(int, const char *const *argv, void *); + SettingsArgvDispatcher* Find(const char*); + static const char* ParseUserSettings(int, const char* const *argv, void*); void SaveCurrentSettings(bool onlyIfNonDefault); - const char *fFileName; - const char *fSettingsDir; // currently unused - SettingsArgvDispatcher **fList; + const char* fFileName; + const char* fSettingsDir; + // currently unused + SettingsArgvDispatcher** fList; int32 fCount; int32 fListSize; - BFile *fCurrentSettings; + BFile* fCurrentSettings; }; } using namespace BPrivate; -#endif +#endif // __SETTINGS_FILE__ diff --git a/src/kits/tracker/SettingsViews.cpp b/src/kits/tracker/SettingsViews.cpp index 5249f67b6f..28f1b9b261 100644 --- a/src/kits/tracker/SettingsViews.cpp +++ b/src/kits/tracker/SettingsViews.cpp @@ -67,9 +67,9 @@ static const rgb_color kDefaultWarningSpaceColor = {203, 0, 0, kSpaceBarAlpha}; static void -send_bool_notices(uint32 what, const char *name, bool value) +send_bool_notices(uint32 what, const char* name, bool value) { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -220,9 +220,9 @@ DesktopSettingsView::AttachedToWindow() void -DesktopSettingsView::MessageReceived(BMessage *message) +DesktopSettingsView::MessageReceived(BMessage* message) { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -345,7 +345,7 @@ DesktopSettingsView::Revert() void DesktopSettingsView::_SendNotices() { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -467,9 +467,9 @@ WindowsSettingsView::AttachedToWindow() void -WindowsSettingsView::MessageReceived(BMessage *message) +WindowsSettingsView::MessageReceived(BMessage* message) { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; TrackerSettings settings; @@ -545,7 +545,7 @@ WindowsSettingsView::MessageReceived(BMessage *message) void WindowsSettingsView::SetDefaults() { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -605,7 +605,7 @@ WindowsSettingsView::IsDefaultable() const void WindowsSettingsView::Revert() { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -757,9 +757,9 @@ SpaceBarSettingsView::AttachedToWindow() void -SpaceBarSettingsView::MessageReceived(BMessage *message) +SpaceBarSettingsView::MessageReceived(BMessage* message) { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; TrackerSettings settings; @@ -823,7 +823,7 @@ SpaceBarSettingsView::MessageReceived(BMessage *message) void SpaceBarSettingsView::SetDefaults() { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -862,7 +862,7 @@ SpaceBarSettingsView::IsDefaultable() const void SpaceBarSettingsView::Revert() { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; @@ -969,9 +969,9 @@ TrashSettingsView::AttachedToWindow() void -TrashSettingsView::MessageReceived(BMessage *message) +TrashSettingsView::MessageReceived(BMessage* message) { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; TrackerSettings settings; @@ -1037,7 +1037,7 @@ TrashSettingsView::Revert() void TrashSettingsView::_SendNotices() { - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) return; diff --git a/src/kits/tracker/SettingsViews.h b/src/kits/tracker/SettingsViews.h index 89299ab945..bc3474bb26 100644 --- a/src/kits/tracker/SettingsViews.h +++ b/src/kits/tracker/SettingsViews.h @@ -31,10 +31,10 @@ 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. */ - #ifndef _SETTINGS_VIEWS #define _SETTINGS_VIEWS + #include #include #include @@ -43,6 +43,7 @@ All rights reserved. #include "TrackerSettings.h" + const uint32 kSettingsContentsModified = 'Scmo'; class BButton; @@ -72,7 +73,7 @@ class DesktopSettingsView : public SettingsView { public: DesktopSettingsView(); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); virtual void AttachedToWindow(); virtual void SetDefaults(); @@ -85,11 +86,11 @@ class DesktopSettingsView : public SettingsView { private: void _SendNotices(); - BRadioButton *fShowDisksIconRadioButton; - BRadioButton *fMountVolumesOntoDesktopRadioButton; - BCheckBox *fMountSharedVolumesOntoDesktopCheckBox; - BCheckBox *fIntegrateNonBootBeOSDesktopsCheckBox; - BButton *fMountButton; + BRadioButton* fShowDisksIconRadioButton; + BRadioButton* fMountVolumesOntoDesktopRadioButton; + BCheckBox* fMountSharedVolumesOntoDesktopCheckBox; + BCheckBox* fIntegrateNonBootBeOSDesktopsCheckBox; + BButton* fMountButton; bool fShowDisksIcon; bool fMountVolumesOntoDesktop; @@ -104,7 +105,7 @@ class WindowsSettingsView : public SettingsView { public: WindowsSettingsView(); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); virtual void AttachedToWindow(); virtual void SetDefaults(); @@ -115,13 +116,13 @@ class WindowsSettingsView : public SettingsView { virtual bool IsRevertable() const; private: - BCheckBox *fShowFullPathInTitleBarCheckBox; - BCheckBox *fSingleWindowBrowseCheckBox; - BCheckBox *fShowNavigatorCheckBox; - BCheckBox *fShowSelectionWhenInactiveCheckBox; - BCheckBox *fOutlineSelectionCheckBox; - BCheckBox *fSortFolderNamesFirstCheckBox; - BCheckBox *fTypeAheadFilteringCheckBox; + BCheckBox* fShowFullPathInTitleBarCheckBox; + BCheckBox* fSingleWindowBrowseCheckBox; + BCheckBox* fShowNavigatorCheckBox; + BCheckBox* fShowSelectionWhenInactiveCheckBox; + BCheckBox* fOutlineSelectionCheckBox; + BCheckBox* fSortFolderNamesFirstCheckBox; + BCheckBox* fTypeAheadFilteringCheckBox; bool fShowFullPathInTitleBar; bool fSingleWindowBrowse; @@ -138,7 +139,7 @@ class SpaceBarSettingsView : public SettingsView { SpaceBarSettingsView(); virtual ~SpaceBarSettingsView(); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); virtual void AttachedToWindow(); virtual void SetDefaults(); @@ -149,9 +150,9 @@ class SpaceBarSettingsView : public SettingsView { virtual bool IsRevertable() const; private: - BCheckBox *fSpaceBarShowCheckBox; - BColorControl *fColorControl; - BMenuField *fColorPicker; + BCheckBox* fSpaceBarShowCheckBox; + BColorControl* fColorControl; + BMenuField* fColorPicker; int32 fCurrentColor; bool fSpaceBarShow; @@ -162,11 +163,12 @@ class SpaceBarSettingsView : public SettingsView { typedef SettingsView _inherited; }; + class TrashSettingsView : public SettingsView { public: TrashSettingsView(); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); virtual void AttachedToWindow(); virtual void SetDefaults(); @@ -179,8 +181,8 @@ class TrashSettingsView : public SettingsView { private: void _SendNotices(); - BCheckBox *fDontMoveFilesToTrashCheckBox; - BCheckBox *fAskBeforeDeleteFileCheckBox; + BCheckBox* fDontMoveFilesToTrashCheckBox; + BCheckBox* fAskBeforeDeleteFileCheckBox; bool fDontMoveFilesToTrash; bool fAskBeforeDeleteFile; diff --git a/src/kits/tracker/SlowContextPopup.cpp b/src/kits/tracker/SlowContextPopup.cpp index e81201dbaf..95c33668aa 100644 --- a/src/kits/tracker/SlowContextPopup.cpp +++ b/src/kits/tracker/SlowContextPopup.cpp @@ -65,7 +65,7 @@ All rights reserved. #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "SlowContextPopup" -BSlowContextMenu::BSlowContextMenu(const char *title) +BSlowContextMenu::BSlowContextMenu(const char* title) : BPopUpMenu(title, false, false), fMenuBuilt(false), fMessage(B_REFS_RECEIVED), @@ -130,7 +130,7 @@ BSlowContextMenu::DetachedFromWindow() void -BSlowContextMenu::SetNavDir(const entry_ref *ref) +BSlowContextMenu::SetNavDir(const entry_ref* ref) { ForceRebuild(); // reset the slow menu building mechanism so we can add more stuff @@ -139,7 +139,7 @@ BSlowContextMenu::SetNavDir(const entry_ref *ref) } -void +void BSlowContextMenu::ForceRebuild() { ClearMenuBuildingState(); @@ -147,7 +147,7 @@ BSlowContextMenu::ForceRebuild() } -bool +bool BSlowContextMenu::NeedsToRebuild() const { return !fMenuBuilt; @@ -178,10 +178,12 @@ BSlowContextMenu::ClearMenuBuildingState() } } + const int32 kItemsToAddChunk = 20; const bigtime_t kMaxTimeBuildingMenu = 200000; -bool + +bool BSlowContextMenu::AddDynamicItem(add_state state) { if (fMenuBuilt) @@ -218,12 +220,13 @@ BSlowContextMenu::AddDynamicItem(add_state state) bool BSlowContextMenu::StartBuildingItemList() { - // return false when done building + // return false when done building BEntry entry; if (fNavDir.device < 0 || entry.SetTo(&fNavDir) != B_OK - || !entry.Exists()) + || !entry.Exists()) { return false; + } fIteratingDesktop = false; @@ -236,13 +239,13 @@ BSlowContextMenu::StartBuildingItemList() if (fVolsOnly) return true; - + Model startModel(&entry, true); if (startModel.InitCheck() == B_OK) { if (!startModel.IsContainer()) return false; - if (startModel.IsQuery()) + if (startModel.IsQuery()) fContainer = new QueryEntryListCollection(&startModel); else if (startModel.IsDesktop()) { fIteratingDesktop = true; @@ -250,10 +253,11 @@ BSlowContextMenu::StartBuildingItemList() startModel.EntryRef()); AddRootItemsIfNeeded(); AddTrashItem(); - } else - fContainer = new DirectoryEntryList(*dynamic_cast + } else { + fContainer = new DirectoryEntryList(*dynamic_cast (startModel.Node())); - + } + if (fContainer->InitCheck() != B_OK) return false; @@ -338,24 +342,24 @@ BSlowContextMenu::AddNextItem() } -void -BSlowContextMenu::AddOneItem(Model *model) +void +BSlowContextMenu::AddOneItem(Model* model) { - BMenuItem *item = NewModelItem(model, &fMessage, fMessenger, false, - dynamic_cast(fParentWindow) ? - dynamic_cast(fParentWindow) : 0, + BMenuItem* item = NewModelItem(model, &fMessage, fMessenger, false, + dynamic_cast(fParentWindow) ? + dynamic_cast(fParentWindow) : 0, fTypesList, &fTrackingHook); - if (item) + if (item) fItemList->AddItem(item); } -ModelMenuItem * -BSlowContextMenu::NewModelItem(Model *model, const BMessage *invokeMessage, +ModelMenuItem* +BSlowContextMenu::NewModelItem(Model* model, const BMessage* invokeMessage, const BMessenger &target, bool suppressFolderHierarchy, - BContainerWindow *parentWindow, const BObjectList *typeslist, - TrackingHookData *hook) + BContainerWindow* parentWindow, const BObjectList* typeslist, + TrackingHookData* hook) { if (model->InitCheck() != B_OK) return NULL; @@ -364,8 +368,8 @@ BSlowContextMenu::NewModelItem(Model *model, const BMessage *invokeMessage, bool container = false; if (model->IsSymLink()) { - Model *newResolvedModel = NULL; - Model *result = model->LinkTo(); + Model* newResolvedModel = NULL; + Model* result = model->LinkTo(); if (!result) { newResolvedModel = new Model(model->EntryRef(), true, true); @@ -401,7 +405,7 @@ BSlowContextMenu::NewModelItem(Model *model, const BMessage *invokeMessage, container = model->IsContainer(); } - BMessage *message = new BMessage(*invokeMessage); + BMessage* message = new BMessage(*invokeMessage); message->AddRef("refs", model->EntryRef()); // Truncate the name if necessary @@ -409,13 +413,13 @@ BSlowContextMenu::NewModelItem(Model *model, const BMessage *invokeMessage, be_plain_font->TruncateString(&truncatedString, B_TRUNCATE_END, BNavMenu::GetMaxMenuWidth()); - ModelMenuItem *item = NULL; + ModelMenuItem* item = NULL; if (!container || suppressFolderHierarchy) { item = new ModelMenuItem(model, truncatedString.String(), message); if (invokeMessage->what != B_REFS_RECEIVED) item->SetEnabled(false); } else { - BNavMenu *menu = new BNavMenu(truncatedString.String(), + BNavMenu* menu = new BNavMenu(truncatedString.String(), invokeMessage->what, target, parentWindow, typeslist); menu->SetNavDir(&ref); @@ -448,13 +452,13 @@ BSlowContextMenu::BuildVolumeMenu() BEntry entry; startDir.GetEntry(&entry); - Model *model = new Model(&entry); + Model* model = new Model(&entry); if (model->InitCheck() != B_OK) { delete model; continue; } - BNavMenu *menu = new BNavMenu(model->Name(), fMessage.what, + BNavMenu* menu = new BNavMenu(model->Name(), fMessage.what, fMessenger, fParentWindow, fTypesList); menu->SetNavDir(model->EntryRef()); @@ -463,8 +467,8 @@ BSlowContextMenu::BuildVolumeMenu() ASSERT(menu->Name()); - ModelMenuItem *item = new ModelMenuItem(model, menu); - BMessage *message = new BMessage(fMessage); + ModelMenuItem* item = new ModelMenuItem(model, menu); + BMessage* message = new BMessage(fMessage); message->AddRef("refs", model->EntryRef()); item->SetMessage(message); @@ -485,7 +489,7 @@ BSlowContextMenu::DoneBuildingItemList() fItemList->SortItems(&BNavMenu::CompareOne); int32 count = fItemList->CountItems(); - for (int32 index = 0; index < count; index++) + for (int32 index = 0; index < count; index++) AddItem(fItemList->ItemAt(index)); fItemList->MakeEmpty(); @@ -501,7 +505,7 @@ BSlowContextMenu::DoneBuildingItemList() void -BSlowContextMenu::SetTypesList(const BObjectList *list) +BSlowContextMenu::SetTypesList(const BObjectList* list) { fTypesList = list; } @@ -514,9 +518,9 @@ BSlowContextMenu::SetTarget(const BMessenger &target) } -TrackingHookData * -BSlowContextMenu::InitTrackingHook(bool (*hook)(BMenu *, void *), const BMessenger *target, - const BMessage *dragMessage) +TrackingHookData* +BSlowContextMenu::InitTrackingHook(bool (*hook)(BMenu*, void*), const BMessenger* target, + const BMessage* dragMessage) { fTrackingHook.fTrackingHook = hook; if (target) @@ -527,17 +531,17 @@ BSlowContextMenu::InitTrackingHook(bool (*hook)(BMenu *, void *), const BMesseng } -void -BSlowContextMenu::SetTrackingHookDeep(BMenu *menu, bool (*func)(BMenu *, void *), void *state) +void +BSlowContextMenu::SetTrackingHookDeep(BMenu* menu, bool (*func)(BMenu*, void*), void* state) { menu->SetTrackingHook(func, state); int32 count = menu->CountItems(); for (int32 index = 0; index < count; index++) { - BMenuItem *item = menu->ItemAt(index); + BMenuItem* item = menu->ItemAt(index); if (!item) continue; - BMenu *submenu = item->Submenu(); + BMenu* submenu = item->Submenu(); if (submenu) SetTrackingHookDeep(submenu, func, state); } diff --git a/src/kits/tracker/SlowContextPopup.h b/src/kits/tracker/SlowContextPopup.h index 2f980f3845..d03fd8e65a 100644 --- a/src/kits/tracker/SlowContextPopup.h +++ b/src/kits/tracker/SlowContextPopup.h @@ -31,24 +31,25 @@ 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. */ - #ifndef SLOW_CONTEXT_POPUP_H #define SLOW_CONTEXT_POPUP_H + #include #include "NavMenu.h" + namespace BPrivate { class BSlowContextMenu : public BPopUpMenu { public: - BSlowContextMenu(const char *title); - virtual ~BSlowContextMenu(); + BSlowContextMenu(const char* title); + virtual ~BSlowContextMenu(); virtual void AttachedToWindow(); virtual void DetachedFromWindow(); - - void SetNavDir(const entry_ref *); + + void SetNavDir(const entry_ref*); void ClearMenu(); @@ -58,53 +59,53 @@ public: void SetTarget(const BMessenger &); const BMessenger Target() const; - - void SetTypesList(const BObjectList *list); - const BObjectList *TypesList() const; - - static ModelMenuItem *NewModelItem(Model *, const BMessage *, const BMessenger &, - bool suppressFolderHierarchy=false, BContainerWindow * = NULL, - const BObjectList *typeslist = NULL, - TrackingHookData *hook = NULL); - - TrackingHookData *InitTrackingHook(bool (*)(BMenu *, void *), - const BMessenger *target, const BMessage *dragMessage); + + void SetTypesList(const BObjectList* list); + const BObjectList* TypesList() const; + + static ModelMenuItem* NewModelItem(Model*, const BMessage*, const BMessenger&, + bool suppressFolderHierarchy = false, BContainerWindow* = NULL, + const BObjectList* typeslist = NULL, + TrackingHookData* hook = NULL); + + TrackingHookData* InitTrackingHook(bool (*)(BMenu*, void*), + const BMessenger* target, const BMessage* dragMessage); const bool IsShowing() const; - + protected: virtual bool AddDynamicItem(add_state state); virtual bool StartBuildingItemList(); virtual bool AddNextItem(); - virtual void DoneBuildingItemList(); + virtual void DoneBuildingItemList(); virtual void ClearMenuBuildingState(); void BuildVolumeMenu(); - - void AddOneItem(Model *); + + void AddOneItem(Model*); void AddRootItemsIfNeeded(); void AddTrashItem(); - static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *); - + static void SetTrackingHookDeep(BMenu*, bool (*)(BMenu*, void*), void*); + bool fMenuBuilt; -private: +private: entry_ref fNavDir; BMessage fMessage; BMessenger fMessenger; - BWindow *fParentWindow; - + BWindow* fParentWindow; + // menu building state bool fVolsOnly; - BObjectList *fItemList; - EntryListBase *fContainer; + BObjectList* fItemList; + EntryListBase* fContainer; bool fIteratingDesktop; - const BObjectList *fTypesList; - + const BObjectList* fTypesList; + TrackingHookData fTrackingHook; bool fIsShowing; - // see note in AttachedToWindow + // see note in AttachedToWindow }; @@ -112,22 +113,25 @@ private: using namespace BPrivate; -inline const BObjectList * + +inline const BObjectList* BSlowContextMenu::TypesList() const { return fTypesList; } + inline const BMessenger BSlowContextMenu::Target() const { return fMessenger; } + inline const bool BSlowContextMenu::IsShowing() const { return fIsShowing; } -#endif +#endif // SLOW_CONTEXT_POPUP_H diff --git a/src/kits/tracker/SlowMenu.cpp b/src/kits/tracker/SlowMenu.cpp index e4705ff732..45a4f52c0c 100644 --- a/src/kits/tracker/SlowMenu.cpp +++ b/src/kits/tracker/SlowMenu.cpp @@ -32,18 +32,22 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "SlowMenu.h" -BSlowMenu::BSlowMenu(const char *title, menu_layout layout) + +BSlowMenu::BSlowMenu(const char* title, menu_layout layout) : BMenu(title, layout), fMenuBuilt(false) { } + const int32 kItemsToAddChunk = 20; const bigtime_t kMaxTimeBuildingMenu = 200000; -bool + +bool BSlowMenu::AddDynamicItem(add_state state) { if (fMenuBuilt) @@ -68,39 +72,45 @@ BSlowMenu::AddDynamicItem(add_state state) return false; // done with menu, don't call again } - if (system_time() > timeToBail) - // we have been in here long enough, come back later + + if (system_time() > timeToBail) { + // we've been in here long enough, come back later break; + } } - return true; // call me again, got more to show + return true; + // call me again, got more to show } -bool + +bool BSlowMenu::StartBuildingItemList() { return true; } -bool + +bool BSlowMenu::AddNextItem() { TRESPASS(); - // pure virtual, shouldn't be here + // pure virtual, shouldn't be here return true; } -void + +void BSlowMenu::DoneBuildingItemList() { TRESPASS(); - // pure virtual, shouldn't be here + // pure virtual, shouldn't be here } -void + +void BSlowMenu::ClearMenuBuildingState() { TRESPASS(); - // pure virtual, shouldn't be here + // pure virtual, shouldn't be here } - diff --git a/src/kits/tracker/SlowMenu.h b/src/kits/tracker/SlowMenu.h index 62e9156b07..46c2c37a0d 100644 --- a/src/kits/tracker/SlowMenu.h +++ b/src/kits/tracker/SlowMenu.h @@ -31,24 +31,26 @@ 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. */ - #ifndef __SLOW_MENU__ #define __SLOW_MENU__ -#include -#include -#include // SlowMenu is a convenience class that makes it easier to // use the AddDynamicItem callback to implement a menu that can // checks periodically between creating new items and quits // early if needed + +#include +#include +#include + + namespace BPrivate { class BSlowMenu : public BMenu { public: - BSlowMenu(const char *title, menu_layout layout = B_ITEMS_IN_COLUMN); + BSlowMenu(const char* title, menu_layout layout = B_ITEMS_IN_COLUMN); protected: virtual bool StartBuildingItemList(); @@ -73,4 +75,4 @@ class BSlowMenu : public BMenu { using namespace BPrivate; -#endif /* __SLOW_MENU__ */ +#endif // __SLOW_MENU__ diff --git a/src/kits/tracker/StatusWindow.cpp b/src/kits/tracker/StatusWindow.cpp index 74d6151de0..755da3f150 100644 --- a/src/kits/tracker/StatusWindow.cpp +++ b/src/kits/tracker/StatusWindow.cpp @@ -86,7 +86,7 @@ public: namespace BPrivate { -BStatusWindow *gStatusWindow = NULL; +BStatusWindow* gStatusWindow = NULL; } @@ -246,7 +246,7 @@ BStatusWindow::CreateStatusItem(thread_id thread, StatusWindowState type) AutoLock lock(be_app); int32 count = be_app->CountWindows(); for (int32 index = 0; index < count; index++) { - if (dynamic_cast(be_app->WindowAt(index)) + if (dynamic_cast(be_app->WindowAt(index)) && be_app->WindowAt(index)->IsActive()) { desktopActive = true; break; @@ -842,7 +842,7 @@ BStatusView::AttachedToWindow() void -BStatusView::MessageReceived(BMessage *message) +BStatusView::MessageReceived(BMessage* message) { switch (message->what) { case kPauseButton: @@ -888,7 +888,7 @@ BStatusView::MessageReceived(BMessage *message) void -BStatusView::UpdateStatus(const char *curItem, off_t itemSize, bool optional) +BStatusView::UpdateStatus(const char* curItem, off_t itemSize, bool optional) { if (!fShowCount) { fStatusBar->Update((float)fItemSize / fTotalSize); @@ -911,7 +911,7 @@ BStatusView::UpdateStatus(const char *curItem, off_t itemSize, bool optional) buffer << fCurItem << " "; // if we don't have curItem, take the one from the stash - const char *statusItem = curItem != NULL + const char* statusItem = curItem != NULL ? curItem : fPendingStatusString; fStatusBar->Update((float)fItemSize / fTotalSize, statusItem, diff --git a/src/kits/tracker/StatusWindow.h b/src/kits/tracker/StatusWindow.h index 75019ad4c0..4f8af426fa 100644 --- a/src/kits/tracker/StatusWindow.h +++ b/src/kits/tracker/StatusWindow.h @@ -31,7 +31,7 @@ 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. */ -#ifndef STATUS_WINDOW_H +#ifndef STATUS_WINDOW_H #define STATUS_WINDOW_H @@ -203,4 +203,5 @@ extern BStatusWindow* gStatusWindow; using namespace BPrivate; + #endif // STATUS_WINDOW_H diff --git a/src/kits/tracker/TaskLoop.cpp b/src/kits/tracker/TaskLoop.cpp index 08eb249eb5..dfcc7fab38 100644 --- a/src/kits/tracker/TaskLoop.cpp +++ b/src/kits/tracker/TaskLoop.cpp @@ -48,7 +48,7 @@ DelayedTask::~DelayedTask() { } -OneShotDelayedTask::OneShotDelayedTask(FunctionObject *functor, bigtime_t delay) +OneShotDelayedTask::OneShotDelayedTask(FunctionObject* functor, bigtime_t delay) : DelayedTask(delay), fFunctor(functor) { @@ -72,8 +72,9 @@ OneShotDelayedTask::RunIfNeeded(bigtime_t currentTime) } -PeriodicDelayedTask::PeriodicDelayedTask(FunctionObjectWithResult *functor, - bigtime_t initialDelay, bigtime_t period) +PeriodicDelayedTask::PeriodicDelayedTask( + FunctionObjectWithResult* functor, bigtime_t initialDelay, + bigtime_t period) : DelayedTask(initialDelay), fPeriod(period), fFunctor(functor) @@ -100,7 +101,7 @@ PeriodicDelayedTask::RunIfNeeded(bigtime_t currentTime) PeriodicDelayedTaskWithTimeout::PeriodicDelayedTaskWithTimeout( - FunctionObjectWithResult *functor, bigtime_t initialDelay, + FunctionObjectWithResult* functor, bigtime_t initialDelay, bigtime_t period, bigtime_t timeout) : PeriodicDelayedTask(functor, initialDelay, period), fTimeoutAfter(system_time() + timeout) @@ -124,8 +125,8 @@ PeriodicDelayedTaskWithTimeout::RunIfNeeded(bigtime_t currentTime) } -RunWhenIdleTask::RunWhenIdleTask(FunctionObjectWithResult *functor, bigtime_t - initialDelay, bigtime_t idleFor, bigtime_t heartBeat) +RunWhenIdleTask::RunWhenIdleTask(FunctionObjectWithResult* functor, + bigtime_t initialDelay, bigtime_t idleFor, bigtime_t heartBeat) : PeriodicDelayedTask(functor, initialDelay, heartBeat), fIdleFor(idleFor), fState(kInitialDelay) @@ -251,21 +252,21 @@ TaskLoop::~TaskLoop() void -TaskLoop::RunLater(DelayedTask *task) +TaskLoop::RunLater(DelayedTask* task) { AddTask(task); } void -TaskLoop::RunLater(FunctionObject *functor, bigtime_t delay) +TaskLoop::RunLater(FunctionObject* functor, bigtime_t delay) { RunLater(new OneShotDelayedTask(functor, delay)); } void -TaskLoop::RunLater(FunctionObjectWithResult *functor, +TaskLoop::RunLater(FunctionObjectWithResult* functor, bigtime_t delay, bigtime_t period) { RunLater(new PeriodicDelayedTask(functor, delay, period)); @@ -273,16 +274,17 @@ TaskLoop::RunLater(FunctionObjectWithResult *functor, void -TaskLoop::RunLater(FunctionObjectWithResult *functor, bigtime_t delay, +TaskLoop::RunLater(FunctionObjectWithResult* functor, bigtime_t delay, bigtime_t period, bigtime_t timeout) { - RunLater(new PeriodicDelayedTaskWithTimeout(functor, delay, period, timeout)); + RunLater(new PeriodicDelayedTaskWithTimeout(functor, delay, period, + timeout)); } void -TaskLoop::RunWhenIdle(FunctionObjectWithResult *functor, bigtime_t initialDelay, - bigtime_t idleTime, bigtime_t heartBeat) +TaskLoop::RunWhenIdle(FunctionObjectWithResult* functor, + bigtime_t initialDelay, bigtime_t idleTime, bigtime_t heartBeat) { RunLater(new RunWhenIdleTask(functor, initialDelay, idleTime, heartBeat)); } @@ -291,7 +293,7 @@ TaskLoop::RunWhenIdle(FunctionObjectWithResult *functor, bigtime_t initial class AccumulatedOneShotDelayedTask : public OneShotDelayedTask { // supports accumulating functors public: - AccumulatedOneShotDelayedTask(AccumulatingFunctionObject *functor, bigtime_t delay, + AccumulatedOneShotDelayedTask(AccumulatingFunctionObject* functor, bigtime_t delay, bigtime_t maxAccumulatingTime = 0, int32 maxAccumulateCount = 0) : OneShotDelayedTask(functor, delay), maxAccumulateCount(maxAccumulateCount), @@ -300,7 +302,7 @@ public: initialTime(system_time()) {} - bool CanAccumulate(const AccumulatingFunctionObject *accumulateThis) const + bool CanAccumulate(const AccumulatingFunctionObject* accumulateThis) const { if (maxAccumulateCount && accumulateCount > maxAccumulateCount) // don't accumulate if too may accumulated already @@ -310,15 +312,15 @@ public: // don't accumulate if too late past initial task return false; - return static_cast(fFunctor)->CanAccumulate(accumulateThis); + return static_cast(fFunctor)->CanAccumulate(accumulateThis); } - virtual void Accumulate(AccumulatingFunctionObject *accumulateThis, bigtime_t delay) + virtual void Accumulate(AccumulatingFunctionObject* accumulateThis, bigtime_t delay) { fRunAfter = system_time() + delay; // reset fRunAfter accumulateCount++; - static_cast(fFunctor)->Accumulate(accumulateThis); + static_cast(fFunctor)->Accumulate(accumulateThis); } private: @@ -329,7 +331,7 @@ private: }; void -TaskLoop::AccumulatedRunLater(AccumulatingFunctionObject *functor, bigtime_t delay, +TaskLoop::AccumulatedRunLater(AccumulatingFunctionObject* functor, bigtime_t delay, bigtime_t maxAccumulatingTime, int32 maxAccumulateCount) { AutoLock autoLock(&fLock); @@ -338,8 +340,9 @@ TaskLoop::AccumulatedRunLater(AccumulatingFunctionObject *functor, bigtime_t del } int32 count = fTaskList.CountItems(); for (int32 index = 0; index < count; index++) { - AccumulatedOneShotDelayedTask *task = dynamic_cast - (fTaskList.ItemAt(index)); + AccumulatedOneShotDelayedTask* task + = dynamic_cast( + fTaskList.ItemAt(index)); if (!task) continue; @@ -362,7 +365,7 @@ TaskLoop::Pulse() if (count > 0) { bigtime_t currentTime = system_time(); for (int32 index = 0; index < count; ) { - DelayedTask *task = fTaskList.ItemAt(index); + DelayedTask* task = fTaskList.ItemAt(index); // give every task a try if (task->RunIfNeeded(currentTime)) { // if done, remove from list @@ -384,7 +387,7 @@ TaskLoop::LatestRunTime() const bigtime_t result = kInfinity; #if xDEBUG - DelayedTask *nextTask = 0; + DelayedTask* nextTask = 0; #endif int32 count = fTaskList.CountItems(); for (int32 index = 0; index < count; index++) { @@ -411,7 +414,7 @@ TaskLoop::LatestRunTime() const void -TaskLoop::RemoveTask(DelayedTask *task) +TaskLoop::RemoveTask(DelayedTask* task) { ASSERT(fLock.IsLocked()); // remove the task @@ -419,7 +422,7 @@ TaskLoop::RemoveTask(DelayedTask *task) } void -TaskLoop::AddTask(DelayedTask *task) +TaskLoop::AddTask(DelayedTask* task) { AutoLock autoLock(&fLock); if (!autoLock.IsLocked()) { @@ -489,9 +492,9 @@ StandAloneTaskLoop::KeepPulsingWhenEmpty() const } status_t -StandAloneTaskLoop::RunBinder(void *castToThis) +StandAloneTaskLoop::RunBinder(void* castToThis) { - StandAloneTaskLoop *self = (StandAloneTaskLoop *)castToThis; + StandAloneTaskLoop* self = (StandAloneTaskLoop*)castToThis; self->Run(); return B_OK; } @@ -535,7 +538,7 @@ StandAloneTaskLoop::Run() } void -StandAloneTaskLoop::AddTask(DelayedTask *delayedTask) +StandAloneTaskLoop::AddTask(DelayedTask* delayedTask) { _inherited::AddTask(delayedTask); if (fScanThread < 0) @@ -589,4 +592,3 @@ PiggybackTaskLoop::StartPulsingIfNeeded() { fPulseMe = true; } - diff --git a/src/kits/tracker/TaskLoop.h b/src/kits/tracker/TaskLoop.h index e0b65ecbef..30b8d99bfd 100644 --- a/src/kits/tracker/TaskLoop.h +++ b/src/kits/tracker/TaskLoop.h @@ -31,23 +31,23 @@ 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. */ - -// -// Delayed Tasks, Periodic Delayed Tasks, Periodic Delayed Tasks with timeout, -// Run when idle tasks, accumulating delayed tasks -// - - #ifndef __TASK_LOOP__ #define __TASK_LOOP__ + +// Delayed Tasks, Periodic Delayed Tasks, Periodic Delayed Tasks with timeout, +// Run when idle tasks, accumulating delayed tasks + + #include #include "FunctionObject.h" #include "ObjectList.h" + namespace BPrivate { + // Task flavors class DelayedTask { @@ -57,29 +57,31 @@ public: virtual bool RunIfNeeded(bigtime_t currentTime) = 0; // returns true if done and should not be called again - + bigtime_t RunAfterTime() const; protected: bigtime_t fRunAfter; }; -class OneShotDelayedTask : public DelayedTask { + // called once after a specified delay +class OneShotDelayedTask : public DelayedTask { public: - OneShotDelayedTask(FunctionObject *functor, bigtime_t delay); + OneShotDelayedTask(FunctionObject* functor, bigtime_t delay); virtual ~OneShotDelayedTask(); virtual bool RunIfNeeded(bigtime_t currentTime); protected: - FunctionObject *fFunctor; + FunctionObject* fFunctor; }; -class PeriodicDelayedTask : public DelayedTask { + // called periodically till functor return true +class PeriodicDelayedTask : public DelayedTask { public: - PeriodicDelayedTask(FunctionObjectWithResult *functor, + PeriodicDelayedTask(FunctionObjectWithResult* functor, bigtime_t initialDelay, bigtime_t period); virtual ~PeriodicDelayedTask(); @@ -87,13 +89,14 @@ public: protected: bigtime_t fPeriod; - FunctionObjectWithResult *fFunctor; + FunctionObjectWithResult* fFunctor; }; -class PeriodicDelayedTaskWithTimeout : public PeriodicDelayedTask { + // called periodically till functor returns true or till time out +class PeriodicDelayedTaskWithTimeout : public PeriodicDelayedTask { public: - PeriodicDelayedTaskWithTimeout(FunctionObjectWithResult *functor, + PeriodicDelayedTaskWithTimeout(FunctionObjectWithResult* functor, bigtime_t initialDelay, bigtime_t period, bigtime_t timeout); virtual bool RunIfNeeded(bigtime_t currentTime); @@ -102,11 +105,12 @@ protected: bigtime_t fTimeoutAfter; }; -class RunWhenIdleTask : public PeriodicDelayedTask { + // after initial delay starts periodically calling functor if system is idle // until functor returns true +class RunWhenIdleTask : public PeriodicDelayedTask { public: - RunWhenIdleTask(FunctionObjectWithResult *functor, bigtime_t initialDelay, + RunWhenIdleTask(FunctionObjectWithResult* functor, bigtime_t initialDelay, bigtime_t idleFor, bigtime_t heartBeat); virtual ~RunWhenIdleTask(); @@ -125,8 +129,8 @@ protected: kInitialIdleWait, kInIdleState }; - - State fState; + + State fState; bigtime_t fActivityLevelStart; bigtime_t fActivityLevel; bigtime_t fLastCPUTooBusyTime; @@ -135,15 +139,16 @@ private: typedef PeriodicDelayedTask _inherited; }; + +// This class is used for clumping up function objects that +// can be done as a single object. For instance the mime +// notification mechanism sends out multiple notifications on +// a single change and we need to accumulate the resulting +// icon update into a single one class AccumulatingFunctionObject : public FunctionObject { - // This class is used for clumping up function objects that - // can be done as a single object. For instance the mime - // notification mechanism sends out multiple notifications on - // a single change and we need to accumulate the resulting - // icon update into a single one public: - virtual bool CanAccumulate(const AccumulatingFunctionObject *) const = 0; - virtual void Accumulate(AccumulatingFunctionObject *) = 0; + virtual bool CanAccumulate(const AccumulatingFunctionObject*) const = 0; + virtual void Accumulate(AccumulatingFunctionObject*) = 0; }; @@ -155,37 +160,39 @@ public: TaskLoop(bigtime_t heartBeat = 10000); virtual ~TaskLoop(); - void RunLater(DelayedTask *); - void RunLater(FunctionObject *functor, bigtime_t delay); + void RunLater(DelayedTask*); + void RunLater(FunctionObject* functor, bigtime_t delay); // execute a function object after a delay - - void RunLater(FunctionObjectWithResult *functor, bigtime_t delay, - bigtime_t period); - // periodically execute function object after initial delay until function - // object returns true - - void RunLater(FunctionObjectWithResult *functor, bigtime_t delay, - bigtime_t period, bigtime_t timeout); - // periodically execute function object after initial delay until function - // object returns true or timeout is reached - void AccumulatedRunLater(AccumulatingFunctionObject *functor, bigtime_t delay, - bigtime_t maxAccumulatingTime = 0, int32 maxAccumulateCount = 0); + void RunLater(FunctionObjectWithResult* functor, bigtime_t delay, + bigtime_t period); + // periodically execute function object after initial delay until + // function object returns true + + void RunLater(FunctionObjectWithResult* functor, bigtime_t delay, + bigtime_t period, bigtime_t timeout); + // periodically execute function object after initial delay until + // function object returns true or timeout is reached + + void AccumulatedRunLater(AccumulatingFunctionObject* functor, + bigtime_t delay, bigtime_t maxAccumulatingTime = 0, + int32 maxAccumulateCount = 0); // will search the delayed task loop for other accumulating functors // and will accumulate with them, else will create a new delayed task - // the task will no longer accumulate if past the delay - // unless is zero + // the task will no longer accumulate if past the + // delay unless is zero // no more than will get accumulated, unless // is zero - - void RunWhenIdle(FunctionObjectWithResult *functor, bigtime_t initialDelay, - bigtime_t idleTime, bigtime_t heartBeat = 1000000); + + void RunWhenIdle(FunctionObjectWithResult* functor, + bigtime_t initialDelay, bigtime_t idleTime, + bigtime_t heartBeat = 1000000); // after initialDelay starts looking for a slot when the system is // idle for at least idleTime protected: - void AddTask(DelayedTask *); - void RemoveTask(DelayedTask *); + void AddTask(DelayedTask*); + void RemoveTask(DelayedTask*); bool Pulse(); // return true if quitting @@ -199,6 +206,7 @@ protected: bigtime_t fHeartBeat; }; + class StandAloneTaskLoop : public TaskLoop { // this task loop can work on it's own, just instantiate it // and use it; It has to start it's own thread @@ -207,10 +215,10 @@ public: ~StandAloneTaskLoop(); protected: - void AddTask(DelayedTask *); + void AddTask(DelayedTask*); private: - static status_t RunBinder(void *); + static status_t RunBinder(void*); void Run(); virtual bool KeepPulsingWhenEmpty() const; @@ -223,6 +231,7 @@ private: typedef TaskLoop _inherited; }; + class PiggybackTaskLoop : public TaskLoop { // this TaskLoop needs periodic calls from a viewable's Pulse // or some similar pulsing mechanism @@ -241,14 +250,15 @@ private: }; -inline bigtime_t +inline bigtime_t DelayedTask::RunAfterTime() const { return fRunAfter; } + } // namespace BPrivate using namespace BPrivate; -#endif +#endif // __TASK_LOOP__ diff --git a/src/kits/tracker/TemplatesMenu.cpp b/src/kits/tracker/TemplatesMenu.cpp index 9315029b74..fb251abd31 100644 --- a/src/kits/tracker/TemplatesMenu.cpp +++ b/src/kits/tracker/TemplatesMenu.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include @@ -59,22 +60,23 @@ All rights reserved. namespace BPrivate { -const char *kTemplatesDirectory = "Tracker/Tracker New Templates"; +const char* kTemplatesDirectory = "Tracker/Tracker New Templates"; +} // namespace BPrivate -} - -TemplatesMenu::TemplatesMenu(const BMessenger &target, const char *label) +TemplatesMenu::TemplatesMenu(const BMessenger &target, const char* label) : BMenu(label), fTarget(target), fOpenItem(NULL) { } + TemplatesMenu::~TemplatesMenu() { } + void TemplatesMenu::AttachedToWindow() { @@ -83,30 +85,36 @@ TemplatesMenu::AttachedToWindow() SetTargetForItems(fTarget); } + status_t -TemplatesMenu::SetTargetForItems(BHandler *target) +TemplatesMenu::SetTargetForItems(BHandler* target) { status_t result = BMenu::SetTargetForItems(target); if (fOpenItem) fOpenItem->SetTarget(be_app_messenger); + return result; } + status_t TemplatesMenu::SetTargetForItems(BMessenger messenger) { status_t result = BMenu::SetTargetForItems(messenger); if (fOpenItem) fOpenItem->SetTarget(be_app_messenger); + return result; } + void TemplatesMenu::UpdateMenuState() { BuildMenu(false); } + bool TemplatesMenu::BuildMenu(bool addItems) { @@ -127,9 +135,9 @@ TemplatesMenu::BuildMenu(bool addItems) find_directory (B_USER_SETTINGS_DIRECTORY, &path, true); path.Append(kTemplatesDirectory); mkdir(path.Path(), 0777); - + count = 0; - + BEntry entry; BDirectory templatesDir(path.Path()); while (templatesDir.GetNextEntry(&entry) == B_OK) { @@ -140,48 +148,46 @@ TemplatesMenu::BuildMenu(bool addItems) if (nodeInfo.InitCheck() == B_OK) { char mimeType[B_MIME_TYPE_LENGTH]; nodeInfo.GetType(mimeType); - + BMimeType mime(mimeType); if (mime.IsValid()) { - if (count == 0) AddSeparatorItem(); - + count++; - + // If not adding items, we are just seeing if there // are any to list. So if we find one, immediately // bail and return the result. if (!addItems) break; - + entry_ref ref; entry.GetRef(&ref); - BMessage *message = new BMessage(kNewEntryFromTemplate); + BMessage* message = new BMessage(kNewEntryFromTemplate); message->AddRef("refs_template", &ref); message->AddString("name", fileName); AddItem(new IconMenuItem(fileName, message, &nodeInfo, B_MINI_ICON)); } - } } - + AddSeparatorItem(); - + // This is the message sent to open the templates folder. - BMessage *message = new BMessage(B_REFS_RECEIVED); + BMessage* message = new BMessage(B_REFS_RECEIVED); entry_ref dirRef; if (templatesDir.GetEntry(&entry) == B_OK) entry.GetRef(&dirRef); message->AddRef("refs", &dirRef); - + // Add item to show templates folder. fOpenItem = new BMenuItem(B_TRANSLATE("Edit templates" B_UTF8_ELLIPSIS), message); AddItem(fOpenItem); if (dirRef == entry_ref()) fOpenItem->SetEnabled(false); - + return count > 0; } diff --git a/src/kits/tracker/TemplatesMenu.h b/src/kits/tracker/TemplatesMenu.h index edf1c44dab..5f453ccb93 100644 --- a/src/kits/tracker/TemplatesMenu.h +++ b/src/kits/tracker/TemplatesMenu.h @@ -31,13 +31,13 @@ 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. */ - #ifndef __TEMPLATES_MENU__ #define __TEMPLATES_MENU__ #include + namespace BPrivate { extern const char* kTemplatesDirectory; @@ -45,27 +45,25 @@ extern const char* kTemplatesMenuName; class TemplatesMenu : public BMenu { public: - TemplatesMenu(const BMessenger &target, - const char *label); - virtual ~TemplatesMenu(); - + TemplatesMenu(const BMessenger& target, const char* label); + virtual ~TemplatesMenu(); virtual void AttachedToWindow(); - virtual status_t SetTargetForItems(BHandler *); + virtual status_t SetTargetForItems(BHandler*); virtual status_t SetTargetForItems(BMessenger); void UpdateMenuState(); private: bool BuildMenu(bool addItems = true); - + BMessenger fTarget; - BMenuItem *fOpenItem; + BMenuItem* fOpenItem; }; } // namespace BPrivate using namespace BPrivate; -#endif +#endif // __TEMPLATES_MENU__ diff --git a/src/kits/tracker/Tests.cpp b/src/kits/tracker/Tests.cpp index f45887d991..2591229286 100644 --- a/src/kits/tracker/Tests.cpp +++ b/src/kits/tracker/Tests.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #if DEBUG #include "Tests.h" @@ -51,9 +52,7 @@ All rights reserved. #include "Thread.h" - - -const char *pathsToSearch[] = { +const char* pathsToSearch[] = { // "/boot/home/config/settings/NetPositive/Bookmarks/", #ifdef __HAIKU__ "/boot/system", @@ -65,13 +64,14 @@ const char *pathsToSearch[] = { 0 }; + namespace BTrackerPrivate { class IconSpewer : public SimpleThread { public: IconSpewer(bool newCache = true); ~IconSpewer(); - void SetTarget(BWindow *target) + void SetTarget(BWindow* target) { this->target = target; } void Quit(); @@ -80,13 +80,13 @@ public: protected: void DrawSomeNew(); void DrawSomeOld(); - const entry_ref *NextRef(); + const entry_ref* NextRef(); private: BLocker locker; bool quitting; - BWindow *target; - TNodeWalker *walker; - CachedEntryIterator *cachingIterator; + BWindow* target; + TNodeWalker* walker; + CachedEntryIterator* cachingIterator; int32 searchPathIndex; bigtime_t cycleTime; bigtime_t lastCycleLap; @@ -98,6 +98,7 @@ private: entry_ref ref; }; + class IconTestWindow : public BWindow { public: IconTestWindow(); @@ -120,7 +121,7 @@ IconSpewer::IconSpewer(bool newCache) newCache(newCache) { walker = new TNodeWalker(pathsToSearch[searchPathIndex++]); - if (newCache) + if (newCache) cachingIterator = new CachedEntryIterator(walker, 40); } @@ -131,16 +132,17 @@ IconSpewer::~IconSpewer() delete cachingIterator; } -void + +void IconSpewer::Run() { BStopWatch watch("", true); for (;;) { AutoLock lock(locker); - + if (!lock || quitting) break; - + lock.Unlock(); if (newCache) DrawSomeNew(); @@ -149,22 +151,25 @@ IconSpewer::Run() } } -void + +void IconSpewer::Quit() { kill_thread(fScanThread); fScanThread = -1; } + const icon_size kIconSize = B_LARGE_ICON; const int32 kRowCount = 10; const int32 kColumnCount = 10; -void + +void IconSpewer::DrawSomeNew() { target->Lock(); - BView *view = target->FindView("iconView"); + BView* view = target->FindView("iconView"); ASSERT(view); BRect bounds(target->Bounds()); @@ -177,15 +182,17 @@ IconSpewer::DrawSomeNew() sprintf(buffer, "last cycle time %Ld ms", cycleTime/1000); view->DrawString(buffer, BPoint(20, bounds.bottom - 20)); } + if (numDrawn) { sprintf(buffer, "average draw time %Ld us per icon", watch.ElapsedTime() / numDrawn); view->DrawString(buffer, BPoint(20, bounds.bottom - 30)); } + sprintf(buffer, "directory: %s", currentPath.Path()); view->DrawString(buffer, BPoint(20, bounds.bottom - 40)); target->Unlock(); - + for (int32 row = 0; row < kRowCount; row++) { for (int32 column = 0; column < kColumnCount; column++) { BEntry entry(NextRef()); @@ -194,7 +201,7 @@ IconSpewer::DrawSomeNew() if (!target->Lock()) return; - if (model.IsDirectory()) + if (model.IsDirectory()) entry.GetPath(¤tPath); IconCache::sIconCache->Draw(&model, view, BPoint(column * (kIconSize + 2), @@ -205,8 +212,11 @@ IconSpewer::DrawSomeNew() } } + bool oldIconCacheInited = false; -void + + +void IconSpewer::DrawSomeOld() { #if 0 @@ -215,7 +225,7 @@ IconSpewer::DrawSomeOld() target->Lock(); target->SetTitle("old cache"); - BView *view = target->FindView("iconView"); + BView* view = target->FindView("iconView"); ASSERT(view); BRect bounds(target->Bounds()); @@ -236,20 +246,20 @@ IconSpewer::DrawSomeOld() view->DrawString(buffer, BPoint(20, bounds.bottom - 40)); target->Unlock(); - + for (int32 row = 0; row < kRowCount; row++) { for (int32 column = 0; column < kColumnCount; column++) { BEntry entry(NextRef()); BModel model(&entry, true); - + if (!target->Lock()) return; - if (model.IsDirectory()) + if (model.IsDirectory()) entry.GetPath(¤tPath); BIconCache::LockIconCache(); - BIconCache *iconCache = BIconCache::GetIconCache(&model, kIconSize); + BIconCache* iconCache = BIconCache::GetIconCache(&model, kIconSize); iconCache->Draw(view, BPoint(column * (kIconSize + 2), row * (kIconSize + 2)), B_NORMAL_ICON, kIconSize, true); BIconCache::UnlockIconCache(); @@ -261,7 +271,8 @@ IconSpewer::DrawSomeOld() #endif } -const entry_ref * + +const entry_ref* IconSpewer::NextRef() { status_t result; @@ -295,6 +306,8 @@ IconSpewer::NextRef() } +// #pragma mark - + IconTestWindow::IconTestWindow() : BWindow(BRect(100, 100, 500, 600), "icon cache test", B_TITLED_WINDOW_LOOK, @@ -302,18 +315,20 @@ IconTestWindow::IconTestWindow() iconSpewer(modifiers() == 0) { iconSpewer.SetTarget(this); - BView *view = new BView(Bounds(), "iconView", B_FOLLOW_ALL, B_WILL_DRAW); + BView* view = new BView(Bounds(), "iconView", B_FOLLOW_ALL, B_WILL_DRAW); AddChild(view); iconSpewer.Go(); } -bool + +bool IconTestWindow::QuitRequested() { iconSpewer.Quit(); return true; } + void RunIconCacheTests() { diff --git a/src/kits/tracker/TextWidget.cpp b/src/kits/tracker/TextWidget.cpp index da368cfbcc..c788972ac5 100644 --- a/src/kits/tracker/TextWidget.cpp +++ b/src/kits/tracker/TextWidget.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include @@ -61,7 +62,7 @@ All rights reserved. const float kWidthMargin = 20; -BTextWidget::BTextWidget(Model *model, BColumn *column, BPoseView *view) +BTextWidget::BTextWidget(Model* model, BColumn* column, BPoseView* view) : fText(WidgetAttributeText::NewWidgetText(model, column, view)), fAttrHash(column->AttrHash()), @@ -81,16 +82,16 @@ BTextWidget::~BTextWidget() int -BTextWidget::Compare(const BTextWidget &with, BPoseView *view) const +BTextWidget::Compare(const BTextWidget& with, BPoseView* view) const { return fText->Compare(*with.fText, view); } -const char * -BTextWidget::Text(const BPoseView *view) const +const char* +BTextWidget::Text(const BPoseView* view) const { - StringAttributeText *textAttribute = dynamic_cast(fText); + StringAttributeText* textAttribute = dynamic_cast(fText); if (textAttribute == NULL) return NULL; @@ -99,22 +100,22 @@ BTextWidget::Text(const BPoseView *view) const float -BTextWidget::TextWidth(const BPoseView *pose) const +BTextWidget::TextWidth(const BPoseView* pose) const { return fText->Width(pose); } float -BTextWidget::PreferredWidth(const BPoseView *pose) const +BTextWidget::PreferredWidth(const BPoseView* pose) const { return fText->PreferredWidth(pose) + 1; } BRect -BTextWidget::ColumnRect(BPoint poseLoc, const BColumn *column, - const BPoseView *view) +BTextWidget::ColumnRect(BPoint poseLoc, const BColumn* column, + const BPoseView* view) { if (view->ViewMode() != kListMode) { // ColumnRect only makes sense in list view, return @@ -131,8 +132,8 @@ BTextWidget::ColumnRect(BPoint poseLoc, const BColumn *column, BRect -BTextWidget::CalcRectCommon(BPoint poseLoc, const BColumn *column, - const BPoseView *view, float textWidth) +BTextWidget::CalcRectCommon(BPoint poseLoc, const BColumn* column, + const BPoseView* view, float textWidth) { BRect result; if (view->ViewMode() == kListMode) { @@ -182,23 +183,23 @@ BTextWidget::CalcRectCommon(BPoint poseLoc, const BColumn *column, BRect -BTextWidget::CalcRect(BPoint poseLoc, const BColumn *column, - const BPoseView *view) +BTextWidget::CalcRect(BPoint poseLoc, const BColumn* column, + const BPoseView* view) { return CalcRectCommon(poseLoc, column, view, fText->Width(view)); } BRect -BTextWidget::CalcOldRect(BPoint poseLoc, const BColumn *column, - const BPoseView *view) +BTextWidget::CalcOldRect(BPoint poseLoc, const BColumn* column, + const BPoseView* view) { return CalcRectCommon(poseLoc, column, view, fText->CurrentWidth()); } BRect -BTextWidget::CalcClickRect(BPoint poseLoc, const BColumn *column, +BTextWidget::CalcClickRect(BPoint poseLoc, const BColumn* column, const BPoseView* view) { BRect result = CalcRect(poseLoc, column, view); @@ -215,7 +216,7 @@ BTextWidget::CalcClickRect(BPoint poseLoc, const BColumn *column, void -BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint) +BTextWidget::MouseUp(BRect bounds, BPoseView* view, BPose* pose, BPoint) { // Start editing without delay if the pose was selected recently and this // click is not the second click of a doubleclick. @@ -270,13 +271,13 @@ BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint) static filter_result -TextViewFilter(BMessage *message, BHandler **, BMessageFilter *filter) +TextViewFilter(BMessage* message, BHandler**, BMessageFilter* filter) { uchar key; - if (message->FindInt8("byte", (int8 *)&key) != B_OK) + if (message->FindInt8("byte", (int8*)&key) != B_OK) return B_DISPATCH_MESSAGE; - BPoseView *poseView = dynamic_cast(filter->Looper())-> + BPoseView* poseView = dynamic_cast(filter->Looper())-> PoseView(); if (key == B_RETURN || key == B_ESCAPE) { @@ -299,9 +300,9 @@ TextViewFilter(BMessage *message, BHandler **, BMessageFilter *filter) // we try to work-around this "bug" here. // find the text editing view - BView *scrollView = poseView->FindView("BorderView"); + BView* scrollView = poseView->FindView("BorderView"); if (scrollView != NULL) { - BTextView *textView = dynamic_cast(scrollView->FindView("WidgetTextView")); + BTextView* textView = dynamic_cast(scrollView->FindView("WidgetTextView")); if (textView != NULL) { BRect rect = scrollView->Frame(); @@ -316,7 +317,7 @@ TextViewFilter(BMessage *message, BHandler **, BMessageFilter *filter) void -BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose) +BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose) { if (!IsEditable()) return; @@ -342,7 +343,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose) BFont font; view->GetFont(&font); - BTextView *textView = new BTextView(rect, "WidgetTextView", textRect, &font, 0, + BTextView* textView = new BTextView(rect, "WidgetTextView", textRect, &font, 0, B_FOLLOW_ALL, B_WILL_DRAW); textView->SetWordWrap(false); @@ -374,7 +375,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose) textView->MoveTo(rect.LeftTop()); textView->ResizeTo(rect.Width(), rect.Height()); - BScrollView *scrollView = new BScrollView("BorderView", textView, 0, 0, false, + BScrollView* scrollView = new BScrollView("BorderView", textView, 0, 0, false, false, B_PLAIN_BORDER); view->AddChild(scrollView); @@ -412,21 +413,21 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose) void -BTextWidget::StopEdit(bool saveChanges, BPoint poseLoc, BPoseView *view, - BPose *pose, int32 poseIndex) +BTextWidget::StopEdit(bool saveChanges, BPoint poseLoc, BPoseView* view, + BPose* pose, int32 poseIndex) { // find the text editing view - BView *scrollView = view->FindView("BorderView"); + BView* scrollView = view->FindView("BorderView"); ASSERT(scrollView); if (!scrollView) return; - BTextView *textView = dynamic_cast(scrollView->FindView("WidgetTextView")); + BTextView* textView = dynamic_cast(scrollView->FindView("WidgetTextView")); ASSERT(textView); if (!textView) return; - BColumn *column = view->ColumnFor(fAttrHash); + BColumn* column = view->ColumnFor(fAttrHash); ASSERT(column); if (!column) return; @@ -453,7 +454,7 @@ BTextWidget::StopEdit(bool saveChanges, BPoint poseLoc, BPoseView *view, void -BTextWidget::CheckAndUpdate(BPoint loc, const BColumn *column, BPoseView *view, +BTextWidget::CheckAndUpdate(BPoint loc, const BColumn* column, BPoseView* view, bool visible) { BRect oldRect; @@ -471,17 +472,17 @@ BTextWidget::CheckAndUpdate(BPoint loc, const BColumn *column, BPoseView *view, void -BTextWidget::SelectAll(BPoseView *view) +BTextWidget::SelectAll(BPoseView* view) { - BTextView *text = dynamic_cast(view->FindView("WidgetTextView")); + BTextView* text = dynamic_cast(view->FindView("WidgetTextView")); if (text) text->SelectAll(); } void -BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView *view, - BView *drawView, bool selected, uint32 clipboardMode, BPoint offset, bool direct) +BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view, + BView* drawView, bool selected, uint32 clipboardMode, BPoint offset, bool direct) { textRect.OffsetBy(offset); diff --git a/src/kits/tracker/TextWidget.h b/src/kits/tracker/TextWidget.h index 24fc2f8239..9fdc10a052 100644 --- a/src/kits/tracker/TextWidget.h +++ b/src/kits/tracker/TextWidget.h @@ -32,7 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ -#ifndef _TEXT_WIDGET_H +#ifndef _TEXT_WIDGET_H #define _TEXT_WIDGET_H #include "Model.h" @@ -46,36 +46,36 @@ class BColumn; class BTextWidget { public: - BTextWidget(Model *, BColumn *, BPoseView *); + BTextWidget(Model*, BColumn*, BPoseView*); virtual ~BTextWidget(); - void Draw(BRect widgetRect, BRect widgetTextRect, float width, BPoseView *, + void Draw(BRect widgetRect, BRect widgetTextRect, float width, BPoseView*, bool selected, uint32 clipboardMode); - void Draw(BRect widgetRect, BRect widgetTextRect, float width, BPoseView *, - BView *drawView, bool selected, uint32 clipboardMode, BPoint offset, bool direct); + void Draw(BRect widgetRect, BRect widgetTextRect, float width, BPoseView*, + BView* drawView, bool selected, uint32 clipboardMode, BPoint offset, bool direct); // second call is used for offscreen drawing, where PoseView // and current drawing view are different - void MouseUp(BRect bounds, BPoseView *, BPose *, BPoint mouseLoc); + void MouseUp(BRect bounds, BPoseView*, BPose*, BPoint mouseLoc); - BRect CalcRect(BPoint poseLoc, const BColumn *, const BPoseView *); + BRect CalcRect(BPoint poseLoc, const BColumn*, const BPoseView*); // returns the rect derived from the formatted string width // may force WidgetAttributeText recalculation - BRect CalcClickRect(BPoint poseLoc, const BColumn *, const BPoseView *); + BRect CalcClickRect(BPoint poseLoc, const BColumn*, const BPoseView*); // calls CalcRect, if result too narow, returns a wider rect for // easy clicking - BRect ColumnRect(BPoint poseLoc, const BColumn *, const BPoseView *); + BRect ColumnRect(BPoint poseLoc, const BColumn*, const BPoseView*); // returns the rect of the widget in a column, regardless // of the string width; faster than CalcRect - BRect CalcOldRect(BPoint poseLoc, const BColumn *, const BPoseView *); + BRect CalcOldRect(BPoint poseLoc, const BColumn*, const BPoseView*); // after an update call this to determine the old rect so that // we can invalidate properly - void StartEdit(BRect bounds, BPoseView *, BPose *); - void StopEdit(bool saveChanges, BPoint loc, BPoseView *, BPose *, int32 index); + void StartEdit(BRect bounds, BPoseView*, BPose*); + void StopEdit(bool saveChanges, BPoint loc, BPoseView*, BPose*, int32 index); - void SelectAll(BPoseView *view); - void CheckAndUpdate(BPoint, const BColumn *, BPoseView *, bool visible); + void SelectAll(BPoseView* view); + void CheckAndUpdate(BPoint, const BColumn*, BPoseView*, bool visible); uint32 AttrHash() const; bool IsEditable() const; @@ -84,19 +84,21 @@ public: void SetVisible(bool); bool IsActive() const; void SetActive(bool); - - const char *Text(const BPoseView *view) const; + + const char* Text(const BPoseView* view) const; // returns the untruncated version of the text - float TextWidth(const BPoseView *) const; - float PreferredWidth(const BPoseView *) const; - int Compare(const BTextWidget &, BPoseView *) const; + float TextWidth(const BPoseView*) const; + float PreferredWidth(const BPoseView*) const; + int Compare(const BTextWidget&, BPoseView*) const; // used for sorting in PoseViews private: - BRect CalcRectCommon(BPoint poseLoc, const BColumn *, const BPoseView *, float width); + BRect CalcRectCommon(BPoint poseLoc, const BColumn*, const BPoseView*, + float width); - WidgetAttributeText *fText; - uint32 fAttrHash; // ToDo: get rid of this + WidgetAttributeText* fText; + uint32 fAttrHash; + // TODO: get rid of this alignment fAlignment; bool fEditable : 1; @@ -105,42 +107,49 @@ private: bool fSymLink : 1; }; + inline uint32 BTextWidget::AttrHash() const { return fAttrHash; } + inline void BTextWidget::SetEditable(bool on) { fEditable = on; } + inline bool BTextWidget::IsEditable() const { return fEditable && fText->IsEditable(); } + inline bool BTextWidget::IsVisible() const { return fVisible; } + inline void BTextWidget::SetVisible(bool on) { fVisible = on; } + inline bool BTextWidget::IsActive() const { return fActive; } + inline void BTextWidget::SetActive(bool on) { @@ -150,9 +159,9 @@ BTextWidget::SetActive(bool on) inline void BTextWidget::Draw(BRect widgetRect, BRect widgetTextRect, float width, - BPoseView *view, bool selected, uint32 clipboardMode) + BPoseView* view, bool selected, uint32 clipboardMode) { - Draw(widgetRect, widgetTextRect, width, view, (BView *)view, selected, + Draw(widgetRect, widgetTextRect, width, view, (BView*)view, selected, clipboardMode, BPoint(0, 0), true); } @@ -160,4 +169,4 @@ BTextWidget::Draw(BRect widgetRect, BRect widgetTextRect, float width, using namespace BPrivate; -#endif +#endif // _TEXT_WIDGET_H diff --git a/src/kits/tracker/Thread.cpp b/src/kits/tracker/Thread.cpp index c5caee4e2b..79e64d5e66 100644 --- a/src/kits/tracker/Thread.cpp +++ b/src/kits/tracker/Thread.cpp @@ -32,10 +32,12 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "Thread.h" #include "FunctionObject.h" -SimpleThread::SimpleThread(int32 priority, const char *name) + +SimpleThread::SimpleThread(int32 priority, const char* name) : fScanThread(-1), fPriority(priority), fName(name) @@ -45,48 +47,53 @@ SimpleThread::SimpleThread(int32 priority, const char *name) SimpleThread::~SimpleThread() { - if (fScanThread > 0 && fScanThread != find_thread(NULL)) + if (fScanThread > 0 && fScanThread != find_thread(NULL)) { // kill the thread if it is not the one we are running in kill_thread(fScanThread); + } } -void + +void SimpleThread::Go() { - fScanThread = spawn_thread(SimpleThread::RunBinder, fName ? fName : "TrackerTaskLoop", - fPriority, this); + fScanThread = spawn_thread(SimpleThread::RunBinder, + fName ? fName : "TrackerTaskLoop", fPriority, this); resume_thread(fScanThread); } -status_t -SimpleThread::RunBinder(void *castToThis) + +status_t +SimpleThread::RunBinder(void* castToThis) { - SimpleThread *self = static_cast(castToThis); + SimpleThread* self = static_cast(castToThis); self->Run(); return B_OK; } -void -Thread::Launch(FunctionObject *functor, int32 priority, const char *name) + +void +Thread::Launch(FunctionObject* functor, int32 priority, const char* name) { new Thread(functor, priority, name); } -Thread::Thread(FunctionObject *functor, int32 priority, const char *name) +Thread::Thread(FunctionObject* functor, int32 priority, const char* name) : SimpleThread(priority, name), fFunctor(functor) { Go(); } + Thread::~Thread() { delete fFunctor; } -void +void Thread::Run() { (*fFunctor)(); @@ -94,18 +101,19 @@ Thread::Run() // commit suicide } -void -ThreadSequence::Launch(BObjectList *list, bool async, int32 priority) + +void +ThreadSequence::Launch(BObjectList* list, bool async, int32 priority) { - if (!async) + if (!async) { // if not async, don't even create a thread, just do it right away Run(list); - else + } else new ThreadSequence(list, priority); } -ThreadSequence::ThreadSequence(BObjectList *list, int32 priority) +ThreadSequence::ThreadSequence(BObjectList* list, int32 priority) : SimpleThread(priority), fFunctorList(list) { @@ -118,15 +126,17 @@ ThreadSequence::~ThreadSequence() delete fFunctorList; } -void -ThreadSequence::Run(BObjectList *list) + +void +ThreadSequence::Run(BObjectList* list) { int32 count = list->CountItems(); for (int32 index = 0; index < count; index++) (*list->ItemAt(index))(); } -void + +void ThreadSequence::Run() { Run(fFunctorList); diff --git a/src/kits/tracker/Thread.h b/src/kits/tracker/Thread.h index b71c57c176..c35bcdce81 100644 --- a/src/kits/tracker/Thread.h +++ b/src/kits/tracker/Thread.h @@ -31,10 +31,10 @@ 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. */ - #ifndef __THREAD__ #define __THREAD__ + #include #include @@ -42,54 +42,55 @@ All rights reserved. #include "FunctionObject.h" #include "Utilities.h" + namespace BPrivate { class SimpleThread { // this should only be used as a base class, // subclass needs to add proper locking mechanism public: - SimpleThread(int32 priority = B_LOW_PRIORITY, const char *name = 0); + SimpleThread(int32 priority = B_LOW_PRIORITY, const char* name = 0); virtual ~SimpleThread(); void Go(); private: - static status_t RunBinder(void *); + static status_t RunBinder(void*); virtual void Run() = 0; protected: thread_id fScanThread; int32 fPriority; - const char *fName; + const char* fName; }; class Thread : private SimpleThread { public: - static void Launch(FunctionObject *functor, - int32 priority = B_LOW_PRIORITY, const char *name = 0); + static void Launch(FunctionObject* functor, + int32 priority = B_LOW_PRIORITY, const char* name = 0); private: - Thread(FunctionObject *, int32 priority, const char *name); + Thread(FunctionObject*, int32 priority, const char* name); ~Thread(); virtual void Run(); - FunctionObject *fFunctor; + FunctionObject* fFunctor; }; class ThreadSequence : private SimpleThread { public: - static void Launch(BObjectList *, bool async = true, + static void Launch(BObjectList*, bool async = true, int32 priority = B_LOW_PRIORITY); private: - ThreadSequence(BObjectList *, int32 priority); + ThreadSequence(BObjectList*, int32 priority); ~ThreadSequence(); virtual void Run(); - static void Run(BObjectList *list); + static void Run(BObjectList*list); - BObjectList *fFunctorList; + BObjectList* fFunctorList; }; // would use SingleParamFunctionObjectWithResult, except mwcc won't handle this @@ -116,13 +117,12 @@ private: template class SimpleMemberFunctionObjectWorkaround : public FunctionObjectWithResult { public: - SimpleMemberFunctionObjectWorkaround(status_t (T::*function)(), T *onThis) + SimpleMemberFunctionObjectWorkaround(status_t (T::*function)(), T* onThis) : fFunction(function), fOnThis(onThis) { } - virtual void operator()() { (fOnThis->*fFunction)(); } @@ -133,6 +133,7 @@ private: T fOnThis; }; + template class TwoParamFunctionObjectWorkaround : public FunctionObjectWithResult { public: @@ -155,6 +156,7 @@ private: Param2 fParam2; }; + template class ThreeParamFunctionObjectWorkaround : public FunctionObjectWithResult { public: @@ -179,6 +181,7 @@ private: Param3 fParam3; }; + template class FourParamFunctionObjectWorkaround : public FunctionObjectWithResult { public: @@ -205,35 +208,42 @@ private: Param4 fParam4; }; + template void -LaunchInNewThread(const char *name, int32 priority, status_t (*func)(Param1), Param1 p1) +LaunchInNewThread(const char* name, int32 priority, status_t (*func)(Param1), + Param1 p1) { Thread::Launch(new SingleParamFunctionObjectWorkaround(func, p1), priority, name); } + template void -LaunchInNewThread(const char *name, int32 priority, status_t (T::*function)(), T *onThis) +LaunchInNewThread(const char* name, int32 priority, status_t (T::*function)(), + T* onThis) { - Thread::Launch(new SimpleMemberFunctionObjectWorkaround(function, onThis), - priority, name); + Thread::Launch(new SimpleMemberFunctionObjectWorkaround(function, + onThis), priority, name); } + template void -LaunchInNewThread(const char *name, int32 priority, +LaunchInNewThread(const char* name, int32 priority, status_t (*func)(Param1, Param2), Param1 p1, Param2 p2) { - Thread::Launch(new TwoParamFunctionObjectWorkaround(func, p1, p2), - priority, name); + Thread::Launch(new + TwoParamFunctionObjectWorkaround(func, p1, p2), + priority, name); } + template void -LaunchInNewThread(const char *name, int32 priority, +LaunchInNewThread(const char* name, int32 priority, status_t (*func)(Param1, Param2, Param3), Param1 p1, Param2 p2, Param3 p3) { @@ -241,9 +251,10 @@ LaunchInNewThread(const char *name, int32 priority, Param3>(func, p1, p2, p3), priority, name); } + template void -LaunchInNewThread(const char *name, int32 priority, +LaunchInNewThread(const char* name, int32 priority, status_t (*func)(Param1, Param2, Param3, Param4), Param1 p1, Param2 p2, Param3 p3, Param4 p4) { @@ -251,14 +262,15 @@ LaunchInNewThread(const char *name, int32 priority, Param3, Param4>(func, p1, p2, p3, p4), priority, name); } + template class MouseDownThread { public: - static void TrackMouse(View *view, void (View::*)(BPoint), + static void TrackMouse(View* view, void (View::*)(BPoint), void (View::*)(BPoint, uint32) = 0, bigtime_t pressingPeriod = 100000); protected: - MouseDownThread(View *view, void (View::*)(BPoint), + MouseDownThread(View* view, void (View::*)(BPoint), void (View::*)(BPoint, uint32), bigtime_t pressingPeriod); virtual ~MouseDownThread(); @@ -266,9 +278,9 @@ protected: void Go(); virtual void Track(); - static status_t TrackBinder(void *); -private: + static status_t TrackBinder(void*); +private: BMessenger fOwner; void (View::*fDonePressing)(BPoint); void (View::*fPressing)(BPoint, uint32); @@ -279,7 +291,7 @@ private: template void -MouseDownThread::TrackMouse(View *view, +MouseDownThread::TrackMouse(View* view, void(View::*donePressing)(BPoint), void(View::*pressing)(BPoint, uint32), bigtime_t pressingPeriod) { @@ -288,7 +300,7 @@ MouseDownThread::TrackMouse(View *view, template -MouseDownThread::MouseDownThread(View *view, +MouseDownThread::MouseDownThread(View* view, void (View::*donePressing)(BPoint), void (View::*pressing)(BPoint, uint32), bigtime_t pressingPeriod) : fOwner(view, view->Window()), @@ -314,25 +326,27 @@ template void MouseDownThread::Go() { - fThreadID = spawn_thread(&MouseDownThread::TrackBinder, "MouseTrackingThread", - B_NORMAL_PRIORITY, this); + fThreadID = spawn_thread(&MouseDownThread::TrackBinder, + "MouseTrackingThread", B_NORMAL_PRIORITY, this); if (fThreadID <= 0 || resume_thread(fThreadID) != B_OK) // didn't start, don't leak self delete this; } + template status_t -MouseDownThread::TrackBinder(void *castToThis) +MouseDownThread::TrackBinder(void* castToThis) { - MouseDownThread *self = static_cast(castToThis); + MouseDownThread* self = static_cast(castToThis); self->Track(); // dead at this point TRESPASS(); return B_OK; } + template void MouseDownThread::Track() @@ -342,8 +356,8 @@ MouseDownThread::Track() if (!lock) break; - BLooper *looper; - View *view = dynamic_cast(fOwner.Target(&looper)); + BLooper* looper; + View* view = dynamic_cast(fOwner.Target(&looper)); if (!view) break; @@ -369,4 +383,4 @@ MouseDownThread::Track() using namespace BPrivate; -#endif +#endif // __THREAD__ diff --git a/src/kits/tracker/TitleView.cpp b/src/kits/tracker/TitleView.cpp index 6b015d90c5..f22cd61aa4 100644 --- a/src/kits/tracker/TitleView.cpp +++ b/src/kits/tracker/TitleView.cpp @@ -32,7 +32,10 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + // ListView title drawing and mouse manipulation classes + + #include "TitleView.h" #include @@ -50,6 +53,7 @@ All rights reserved. #include "PoseView.h" #include "Utilities.h" + #define APP_SERVER_CLEARS_BACKGROUND 1 static rgb_color sTitleBackground; @@ -63,7 +67,7 @@ const rgb_color kHighlightColor = {100, 100, 210, 255}; static void -_DrawLine(BPoseView *view, BPoint from, BPoint to) +_DrawLine(BPoseView* view, BPoint from, BPoint to) { rgb_color highColor = view->HighColor(); view->SetHighColor(tint_color(view->LowColor(), B_DARKEN_1_TINT)); @@ -73,14 +77,14 @@ _DrawLine(BPoseView *view, BPoint from, BPoint to) static void -_UndrawLine(BPoseView *view, BPoint from, BPoint to) +_UndrawLine(BPoseView* view, BPoint from, BPoint to) { view->StrokeLine(from, to, B_SOLID_LOW); } static void -_DrawOutline(BView *view, BRect where) +_DrawOutline(BView* view, BRect where) { if (be_control_look != NULL) { where.right++; @@ -97,7 +101,7 @@ _DrawOutline(BView *view, BRect where) // #pragma mark - -BTitleView::BTitleView(BRect frame, BPoseView *view) +BTitleView::BTitleView(BRect frame, BPoseView* view) : BView(frame, "TitleView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW), fPoseView(view), fTitleList(10, true), @@ -140,7 +144,7 @@ BTitleView::Reset() fTitleList.MakeEmpty(); for (int32 index = 0; ; index++) { - BColumn *column = fPoseView->ColumnAt(index); + BColumn* column = fPoseView->ColumnAt(index); if (!column) break; fTitleList.AddItem(new BColumnTitle(this, column)); @@ -150,13 +154,13 @@ BTitleView::Reset() void -BTitleView::AddTitle(BColumn *column, const BColumn *after) +BTitleView::AddTitle(BColumn* column, const BColumn* after) { int32 count = fTitleList.CountItems(); int32 index; if (after) { for (index = 0; index < count; index++) { - BColumn *titleColumn = fTitleList.ItemAt(index)->Column(); + BColumn* titleColumn = fTitleList.ItemAt(index)->Column(); if (after == titleColumn) { index++; @@ -172,11 +176,11 @@ BTitleView::AddTitle(BColumn *column, const BColumn *after) void -BTitleView::RemoveTitle(BColumn *column) +BTitleView::RemoveTitle(BColumn* column) { int32 count = fTitleList.CountItems(); for (int32 index = 0; index < count; index++) { - BColumnTitle *title = fTitleList.ItemAt(index); + BColumnTitle* title = fTitleList.ItemAt(index); if (title->Column() == column) { fTitleList.RemoveItem(title); break; @@ -194,13 +198,13 @@ BTitleView::Draw(BRect rect) } -void +void BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly, - const BColumnTitle *pressedColumn, - void (*trackRectBlitter)(BView *, BRect), BRect passThru) + const BColumnTitle* pressedColumn, + void (*trackRectBlitter)(BView*, BRect), BRect passThru) { BRect bounds(Bounds()); - BView *view; + BView* view; if (useOffscreen) { ASSERT(sOffscreen); @@ -246,7 +250,7 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly, float minx = bounds.right; float maxx = bounds.left; for (int32 index = 0; index < count; index++) { - BColumnTitle *title = fTitleList.ItemAt(index); + BColumnTitle* title = fTitleList.ItemAt(index); title->Draw(view, title == pressedColumn); BRect titleBounds(title->Bounds()); if (titleBounds.left < minx) @@ -280,6 +284,7 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly, if (useOffscreen) { if (trackRectBlitter) (trackRectBlitter)(view, passThru); + view->Sync(); DrawBitmap(sOffscreen->Bitmap()); sOffscreen->DoneUsing(); @@ -300,8 +305,8 @@ BTitleView::MouseDown(BPoint where) // finish any pending edits fPoseView->CommitActivePose(); - BColumnTitle *title = FindColumnTitle(where); - BColumnTitle *resizedTitle = InColumnResizeArea(where); + BColumnTitle* title = FindColumnTitle(where); + BColumnTitle* resizedTitle = InColumnResizeArea(where); uint32 buttons; GetMouse(&where, &buttons); @@ -310,9 +315,9 @@ BTitleView::MouseDown(BPoint where) // if so, display the attribute menu: if (buttons & B_SECONDARY_MOUSE_BUTTON) { - BContainerWindow *window = dynamic_cast + BContainerWindow* window = dynamic_cast (Window()); - BPopUpMenu *menu = new BPopUpMenu("Attributes", false, false); + BPopUpMenu* menu = new BPopUpMenu("Attributes", false, false); menu->SetFont(be_plain_font); window->NewAttributeMenu(menu); window->AddMimeTypesToMenu(menu); @@ -369,7 +374,7 @@ BTitleView::MouseUp(BPoint where) void -BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage *message) +BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage* message) { if (fTrackingState != NULL) { int32 buttons = 0; @@ -395,12 +400,12 @@ BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage *message) } -BColumnTitle * +BColumnTitle* BTitleView::InColumnResizeArea(BPoint where) const { int32 count = fTitleList.CountItems(); for (int32 index = 0; index < count; index++) { - BColumnTitle *title = fTitleList.ItemAt(index); + BColumnTitle* title = fTitleList.ItemAt(index); if (title->InColumnResizeArea(where)) return title; } @@ -409,12 +414,12 @@ BTitleView::InColumnResizeArea(BPoint where) const } -BColumnTitle * +BColumnTitle* BTitleView::FindColumnTitle(BPoint where) const { int32 count = fTitleList.CountItems(); for (int32 index = 0; index < count; index++) { - BColumnTitle *title = fTitleList.ItemAt(index); + BColumnTitle* title = fTitleList.ItemAt(index); if (title->Bounds().Contains(where)) return title; } @@ -423,12 +428,12 @@ BTitleView::FindColumnTitle(BPoint where) const } -BColumnTitle * -BTitleView::FindColumnTitle(const BColumn *column) const +BColumnTitle* +BTitleView::FindColumnTitle(const BColumn* column) const { int32 count = fTitleList.CountItems(); for (int32 index = 0; index < count; index++) { - BColumnTitle *title = fTitleList.ItemAt(index); + BColumnTitle* title = fTitleList.ItemAt(index); if (title->Column() == column) return title; } @@ -440,7 +445,7 @@ BTitleView::FindColumnTitle(const BColumn *column) const // #pragma mark - -BColumnTitle::BColumnTitle(BTitleView *view, BColumn *column) +BColumnTitle::BColumnTitle(BTitleView* view, BColumn* column) : fColumn(column), fParent(view) @@ -448,7 +453,7 @@ BColumnTitle::BColumnTitle(BTitleView *view, BColumn *column) } -bool +bool BColumnTitle::InColumnResizeArea(BPoint where) const { BRect edge(Bounds()); @@ -470,7 +475,7 @@ BColumnTitle::Bounds() const void -BColumnTitle::Draw(BView *view, bool pressed) +BColumnTitle::Draw(BView* view, bool pressed) { BRect bounds(Bounds()); BPoint loc(0, bounds.bottom - 4); @@ -555,7 +560,7 @@ BColumnTitle::Draw(BView *view, bool pressed) view->BeginLineArray(4); // draw lighter gray and white inset lines - rect.InsetBy(1, 1); + rect.InsetBy(1, 1); view->AddLine(rect.LeftBottom(), rect.RightBottom(), pressed ? sLightShadowColor : sLightShadowColor); view->AddLine(rect.LeftTop(), rect.RightTop(), @@ -574,7 +579,7 @@ BColumnTitle::Draw(BView *view, bool pressed) // #pragma mark - -ColumnTrackState::ColumnTrackState(BTitleView *view, BColumnTitle *title, +ColumnTrackState::ColumnTrackState(BTitleView* view, BColumnTitle* title, BPoint where, bigtime_t pastClickTime) : fTitleView(view), @@ -589,9 +594,9 @@ ColumnTrackState::ColumnTrackState(BTitleView *view, BColumnTitle *title, void ColumnTrackState::MouseUp(BPoint where) { - // if it is pressed shortly and not moved, it is a click - // all else is a track - if (system_time() <= fPastClickTime && !fHasMoved) + // if it is pressed shortly and not moved, it is a click + // else it is a track + if (system_time() <= fPastClickTime && !fHasMoved) Clicked(where); else Done(where); @@ -617,7 +622,7 @@ ColumnTrackState::MouseMoved(BPoint where, uint32 buttons) // #pragma mark - -ColumnResizeState::ColumnResizeState(BTitleView *view, BColumnTitle *title, +ColumnResizeState::ColumnResizeState(BTitleView* view, BColumnTitle* title, BPoint where, bigtime_t pastClickTime) : ColumnTrackState(view, title, where, pastClickTime), fLastLineDrawPos(-1), @@ -644,12 +649,12 @@ ColumnResizeState::Moved(BPoint where, uint32) float newWidth = where.x + fInitialTrackOffset - fTitle->fColumn->Offset(); if (newWidth < kMinColumnWidth) newWidth = kMinColumnWidth; - - BPoseView *poseView = fTitleView->PoseView(); -// bool shrink = (newWidth < fTitle->fColumn->Width()); + BPoseView* poseView = fTitleView->PoseView(); - // resize the column + //bool shrink = (newWidth < fTitle->fColumn->Width()); + + // resize the column poseView->ResizeColumn(fTitle->fColumn, newWidth, &fLastLineDrawPos, _DrawLine, _UndrawLine); @@ -657,7 +662,7 @@ ColumnResizeState::Moved(BPoint where, uint32) bounds.left = fTitle->fColumn->Offset(); // force title redraw - fTitleView->Draw(bounds, true, false); + fTitleView->Draw(bounds, true, false); } @@ -678,7 +683,7 @@ ColumnResizeState::Clicked(BPoint /*where*/) void ColumnResizeState::DrawLine() { - BPoseView *poseView = fTitleView->PoseView(); + BPoseView* poseView = fTitleView->PoseView(); ASSERT(!poseView->IsDesktopWindow()); BRect poseViewBounds(poseView->Bounds()); @@ -708,7 +713,7 @@ ColumnResizeState::UndrawLine() // #pragma mark - -ColumnDragState::ColumnDragState(BTitleView *view, BColumnTitle *columnTitle, +ColumnDragState::ColumnDragState(BTitleView* view, BColumnTitle* columnTitle, BPoint where, bigtime_t pastClickTime) : ColumnTrackState(view, columnTitle, where, pastClickTime), fInitialMouseTrackOffset(where.x), @@ -731,7 +736,7 @@ ColumnDragState::Moved(BPoint where, uint32) // figure out where we are with the mouse BRect titleBounds(fTitleView->Bounds()); bool overTitleView = titleBounds.Contains(where); - BColumnTitle *overTitle = overTitleView + BColumnTitle* overTitle = overTitleView ? fTitleView->FindColumnTitle(where) : 0; BRect titleBoundsWithMargin(titleBounds); titleBoundsWithMargin.InsetBy(0, -kRemoveTitleMargin); @@ -746,11 +751,12 @@ ColumnDragState::Moved(BPoint where, uint32) // back fTitleView->EndRectTracking(); fColumnArchive.Seek(0, SEEK_SET); - BColumn *column = BColumn::InstantiateFromStream(&fColumnArchive); + BColumn* column = BColumn::InstantiateFromStream(&fColumnArchive); ASSERT(column); - const BColumn *after = NULL; - if (overTitle) + const BColumn* after = NULL; + if (overTitle) after = overTitle->Column(); + fTitleView->PoseView()->AddColumn(column, after); fTrackingRemovedColumn = false; fTitle = fTitleView->FindColumnTitle(column); @@ -761,7 +767,7 @@ ColumnDragState::Moved(BPoint where, uint32) if (!inMarginRect) { // dragged a title out of the hysteresis margin around the // title bar - remove it and start dragging it as a dotted outline - + BRect rect(fTitle->Bounds()); rect.OffsetBy(where.x - fInitialMouseTrackOffset, where.y - 5); fColumnArchive.Seek(0, SEEK_SET); @@ -780,7 +786,7 @@ ColumnDragState::Moved(BPoint where, uint32) || where.x < overTitle->Bounds().left + fTitle->Bounds().Width())){ // over the one to the left, far enough to not snap right back - BColumn *column = fTitle->Column(); + BColumn* column = fTitle->Column(); fInitialMouseTrackOffset -= fTitle->Bounds().left; // swap the columns fTitleView->PoseView()->MoveColumnTo(column, overTitle->Column()); @@ -812,7 +818,7 @@ ColumnDragState::Done(BPoint /*where*/) void ColumnDragState::Clicked(BPoint /*where*/) { - BPoseView *poseView = fTitleView->PoseView(); + BPoseView* poseView = fTitleView->PoseView(); uint32 hash = fTitle->Column()->AttrHash(); uint32 primarySort = poseView->PrimarySort(); uint32 secondarySort = poseView->SecondarySort(); @@ -871,11 +877,11 @@ ColumnDragState::DrawOutline(float pos) } -void +void ColumnDragState::UndrawOutline() { fTitleView->Draw(fTitleView->Bounds(), true, false); } -OffscreenBitmap *BTitleView::sOffscreen = new OffscreenBitmap; +OffscreenBitmap* BTitleView::sOffscreen = new OffscreenBitmap; diff --git a/src/kits/tracker/TitleView.h b/src/kits/tracker/TitleView.h index baabfe6d88..9df1d20141 100644 --- a/src/kits/tracker/TitleView.h +++ b/src/kits/tracker/TitleView.h @@ -31,18 +31,20 @@ 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. */ - #ifndef _TITLE_VIEW_H #define _TITLE_VIEW_H + #include #include #include #include "ObjectList.h" + namespace BPrivate { + class BPoseView; class BColumn; class BColumnTitle; @@ -62,7 +64,7 @@ const int32 kColumnStart = 40; class BTitleView : public BView { public: - BTitleView(BRect, BPoseView *); + BTitleView(BRect, BPoseView*); virtual ~BTitleView(); virtual void MouseDown(BPoint where); @@ -71,33 +73,33 @@ public: void Draw(BRect, bool useOffscreen = false, bool updateOnly = true, - const BColumnTitle *pressedColumn = 0, - void (*trackRectBlitter)(BView *, BRect) = 0, + const BColumnTitle* pressedColumn = 0, + void (*trackRectBlitter)(BView*, BRect) = 0, BRect passThru = BRect(0, 0, 0, 0)); - void AddTitle(BColumn *, const BColumn *after = 0); - void RemoveTitle(BColumn *); + void AddTitle(BColumn*, const BColumn* after = 0); + void RemoveTitle(BColumn*); void Reset(); - BPoseView *PoseView() const; + BPoseView* PoseView() const; protected: - void MouseMoved(BPoint, uint32, const BMessage *); + void MouseMoved(BPoint, uint32, const BMessage*); private: - BColumnTitle *FindColumnTitle(BPoint) const; - BColumnTitle *InColumnResizeArea(BPoint) const; - BColumnTitle *FindColumnTitle(const BColumn *) const; + BColumnTitle* FindColumnTitle(BPoint) const; + BColumnTitle* InColumnResizeArea(BPoint) const; + BColumnTitle* FindColumnTitle(const BColumn*) const; - BPoseView *fPoseView; + BPoseView* fPoseView; BObjectList fTitleList; BCursor fHorizontalResizeCursor; - - BColumnTitle *fPreviouslyClickedColumnTitle; + + BColumnTitle* fPreviouslyClickedColumnTitle; bigtime_t fPreviousLeftClickTime; ColumnTrackState* fTrackingState; - static OffscreenBitmap *sOffscreen; + static OffscreenBitmap* sOffscreen; typedef BView _inherited; @@ -105,30 +107,31 @@ private: friend class ColumnDragState; }; + class BColumnTitle { public: - BColumnTitle(BTitleView *, BColumn *); + BColumnTitle(BTitleView*, BColumn*); virtual ~BColumnTitle() {} - virtual void Draw(BView *, bool pressed = false); + virtual void Draw(BView*, bool pressed = false); - - BColumn *Column() const; + BColumn* Column() const; BRect Bounds() const; - + bool InColumnResizeArea(BPoint) const; private: - BColumn *fColumn; - BTitleView *fParent; + BColumn* fColumn; + BTitleView* fParent; friend class ColumnResizeState; }; + // Utility classes to handle dragging state class ColumnTrackState { public: - ColumnTrackState(BTitleView *titleView, BColumnTitle *columnTitle, + ColumnTrackState(BTitleView* titleView, BColumnTitle* columnTitle, BPoint where, bigtime_t pastClickTime); virtual ~ColumnTrackState() {} @@ -139,15 +142,16 @@ protected: virtual void Moved(BPoint where, uint32 buttons) = 0; virtual void Clicked(BPoint where) = 0; virtual void Done(BPoint where) = 0; - virtual bool ValueChanged(BPoint where) = 0; + virtual bool ValueChanged(BPoint where) = 0; - BTitleView *fTitleView; - BColumnTitle *fTitle; - BPoint fFirstClickPoint; - bigtime_t fPastClickTime; - bool fHasMoved; + BTitleView* fTitleView; + BColumnTitle* fTitle; + BPoint fFirstClickPoint; + bigtime_t fPastClickTime; + bool fHasMoved; }; + class ColumnResizeState : public ColumnTrackState { public: ColumnResizeState(BTitleView* titleView, BColumnTitle* columnTitle, @@ -157,7 +161,7 @@ protected: virtual void Moved(BPoint where, uint32 buttons); virtual void Done(BPoint where); virtual void Clicked(BPoint where); - virtual bool ValueChanged(BPoint); + virtual bool ValueChanged(BPoint); void DrawLine(); void UndrawLine(); @@ -169,6 +173,7 @@ private: typedef ColumnTrackState _inherited; }; + class ColumnDragState : public ColumnTrackState { public: ColumnDragState(BTitleView* titleView, BColumnTitle* columnTitle, @@ -178,8 +183,8 @@ protected: virtual void Moved(BPoint where, uint32 buttons); virtual void Done(BPoint where); virtual void Clicked(BPoint where); - virtual bool ValueChanged(BPoint); - + virtual bool ValueChanged(BPoint); + void DrawOutline(float); void UndrawOutline(); void DrawPressNoOutline(); @@ -192,18 +197,21 @@ private: typedef ColumnTrackState _inherited; }; -inline BColumn * + +inline BColumn* BColumnTitle::Column() const { return fColumn; } -inline BPoseView * + +inline BPoseView* BTitleView::PoseView() const { return fPoseView; } + } // namespace BPrivate using namespace BPrivate; diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp index 178afe2690..552081a8cc 100644 --- a/src/kits/tracker/Tracker.cpp +++ b/src/kits/tracker/Tracker.cpp @@ -32,12 +32,15 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include #include #include +#include "Tracker.h" + #include #include #include @@ -75,7 +78,6 @@ All rights reserved. #include "PoseView.h" #include "QueryContainerWindow.h" #include "StatusWindow.h" -#include "Tracker.h" #include "TrackerSettings.h" #include "TrashWatcher.h" #include "FunctionObject.h" @@ -104,7 +106,7 @@ const uint32 PSV_MAKE_PRINTER_ACTIVE_QUIETLY = 'pmaq'; namespace BPrivate { -NodePreloader *gPreloader = NULL; +NodePreloader* gPreloader = NULL; class LaunchLooper : public BLooper { public: @@ -115,14 +117,14 @@ public: } virtual void - MessageReceived(BMessage *message) + MessageReceived(BMessage* message) { - void (*function)(const entry_ref *, const BMessage *, bool); + void (*function)(const entry_ref*, const BMessage*, bool); BMessage refs; bool openWithOK; entry_ref appRef; - if (message->FindPointer("function", (void **)&function) != B_OK + if (message->FindPointer("function", (void**)&function) != B_OK || message->FindMessage("refs", &refs) != B_OK || message->FindBool("openWithOK", &openWithOK) != B_OK) { printf("incomplete launch message\n"); @@ -136,10 +138,12 @@ public: } }; -BLooper *gLaunchLooper = NULL; +BLooper* gLaunchLooper = NULL; + // #pragma mark - + void InitIconPreloader() { @@ -159,7 +163,7 @@ InitIconPreloader() // only start the node preloader if its Tracker or the Deskbar itself - don't // start it for file panels - bool preload = dynamic_cast(be_app) != NULL; + bool preload = dynamic_cast(be_app) != NULL; if (!preload) { // check for deskbar app_info info; @@ -179,7 +183,7 @@ InitIconPreloader() uint32 -GetVolumeFlags(Model *model) +GetVolumeFlags(Model* model) { fs_info info; if (model->IsVolume()) { @@ -263,7 +267,7 @@ TTracker::QuitRequested() if (CurrentMessage() && CurrentMessage()->FindBool("shortcut")) { // but allow quitting to hide fSettingsWindow int32 index = 0; - BWindow *window = NULL; + BWindow* window = NULL; while ((window = WindowAt(index++)) != NULL) { if (window == fSettingsWindow) { if (fSettingsWindow->Lock()) { @@ -286,7 +290,7 @@ TTracker::QuitRequested() // save open windows in a message inside an attribute of the desktop int32 count = fWindowList.CountItems(); for (int32 i = 0; i < count; i++) { - BContainerWindow *window = dynamic_cast + BContainerWindow* window = dynamic_cast (fWindowList.ItemAt(i)); if (window && window->Lock()) { @@ -297,7 +301,7 @@ TTracker::QuitRequested() else { BEntry entry; BPath path; - const entry_ref *ref = window->TargetModel()->EntryRef(); + const entry_ref* ref = window->TargetModel()->EntryRef(); if (entry.SetTo(ref) == B_OK && entry.GetPath(&path) == B_OK) { int8 flags = window->IsMinimized() ? kOpenWindowMinimized : kOpenWindowNoFlags; uint32 deviceFlags = GetVolumeFlags(window->TargetModel()); @@ -314,7 +318,7 @@ TTracker::QuitRequested() message.AddMessage("window state", &stateMessage); flags |= kOpenWindowHasState; } - const char *target; + const char* target; bool pathAlreadyExists = false; for (int32 index = 0;message.FindString("paths", index, &target) == B_OK;index++) { if (!strcmp(target,path.Path())) { @@ -339,7 +343,7 @@ TTracker::QuitRequested() // if message is empty, delete the corresponding attribute if (message.CountNames(B_ANY_TYPE)) { size_t size = (size_t)message.FlattenedSize(); - char *buffer = new char[size]; + char* buffer = new char[size]; message.Flatten(buffer, (ssize_t)size); deskDir.WriteAttr(kAttrOpenWindows, B_MESSAGE_TYPE, 0, buffer, size); delete [] buffer; @@ -381,7 +385,7 @@ TTracker::Quit() void -TTracker::MessageReceived(BMessage *message) +TTracker::MessageReceived(BMessage* message) { if (HandleScriptingMessage(message)) return; @@ -397,10 +401,10 @@ TTracker::MessageReceived(BMessage *message) case kCloseWindowAndChildren: { - const node_ref *itemNode; + const node_ref* itemNode; int32 bytes; message->FindData("node_ref", B_RAW_TYPE, - (const void **)&itemNode, &bytes); + (const void**)&itemNode, &bytes); CloseWindowAndChildren(itemNode); break; } @@ -467,7 +471,7 @@ TTracker::MessageReceived(BMessage *message) case kRestoreBackgroundImage: { - BDeskWindow *desktop = GetDeskWindow(); + BDeskWindow* desktop = GetDeskWindow(); AutoLock lock(desktop); desktop->UpdateDesktopBackgroundImages(); break; @@ -536,7 +540,7 @@ TTracker::Pulse() void -TTracker::SetDefaultPrinter(const BMessage *message) +TTracker::SetDefaultPrinter(const BMessage* message) { // get the first item selected int32 count = 0; @@ -571,7 +575,7 @@ TTracker::SetDefaultPrinter(const BMessage *message) void -TTracker::MoveRefsToTrash(const BMessage *message) +TTracker::MoveRefsToTrash(const BMessage* message) { int32 count; uint32 type; @@ -580,7 +584,7 @@ TTracker::MoveRefsToTrash(const BMessage *message) if (count <= 0) return; - BObjectList *srcList = new BObjectList(count, true); + BObjectList* srcList = new BObjectList(count, true); for (int32 index = 0; index < count; index++) { @@ -590,7 +594,7 @@ TTracker::MoveRefsToTrash(const BMessage *message) continue; AutoLock lock(&fWindowList); - BContainerWindow *window = FindParentContainerWindow(&ref); + BContainerWindow* window = FindParentContainerWindow(&ref); if (window) // if we have a window open for this entry, ask the pose to // delete it, this will select the next entry @@ -608,8 +612,8 @@ TTracker::MoveRefsToTrash(const BMessage *message) template class EntryAndNodeDoSoonWithMessageFunctor : public FunctionObjectWithResult { public: - EntryAndNodeDoSoonWithMessageFunctor(FT func, T *target, const entry_ref *child, - const node_ref *parent, const BMessage *message) + EntryAndNodeDoSoonWithMessageFunctor(FT func, T* target, const entry_ref* child, + const node_ref* parent, const BMessage* message) : fFunc(func), fTarget(target), fNode(*parent), @@ -626,7 +630,7 @@ public: protected: FT fFunc; - T *fTarget; + T* fTarget; node_ref fNode; entry_ref fEntry; BMessage fMessage; @@ -635,8 +639,8 @@ protected: bool -TTracker::LaunchAndCloseParentIfOK(const entry_ref *launchThis, - const node_ref *closeThis, const BMessage *messageToBundle) +TTracker::LaunchAndCloseParentIfOK(const entry_ref* launchThis, + const node_ref* closeThis, const BMessage* messageToBundle) { BMessage refsReceived(B_REFS_RECEIVED); if (messageToBundle) { @@ -655,11 +659,11 @@ TTracker::LaunchAndCloseParentIfOK(const entry_ref *launchThis, status_t -TTracker::OpenRef(const entry_ref *ref, const node_ref *nodeToClose, - const node_ref *nodeToSelect, OpenSelector selector, - const BMessage *messageToBundle) +TTracker::OpenRef(const entry_ref* ref, const node_ref* nodeToClose, + const node_ref* nodeToSelect, OpenSelector selector, + const BMessage* messageToBundle) { - Model *model = NULL; + Model* model = NULL; BEntry entry(ref, true); status_t result = entry.InitCheck(); @@ -727,8 +731,8 @@ TTracker::OpenRef(const entry_ref *ref, const node_ref *nodeToClose, // and close parent if successfull if (nodeToClose) Thread::Launch(new EntryAndNodeDoSoonWithMessageFunctor(&TTracker::LaunchAndCloseParentIfOK, this, + bool (TTracker::*)(const entry_ref*, const node_ref*, + const BMessage*)>(&TTracker::LaunchAndCloseParentIfOK, this, ref, nodeToClose, messageToBundle)); else { BMessage refsReceived(B_REFS_RECEIVED); @@ -753,7 +757,7 @@ TTracker::OpenRef(const entry_ref *ref, const node_ref *nodeToClose, void -TTracker::RefsReceived(BMessage *message) +TTracker::RefsReceived(BMessage* message) { OpenSelector selector = kOpen; if (message->HasInt32("launchUsingSelector")) @@ -802,7 +806,7 @@ TTracker::RefsReceived(BMessage *message) { // copy over "Poses" messenger so that refs received recipients know // where the open came from - BMessage *bundleThis = NULL; + BMessage* bundleThis = NULL; BMessenger messenger; if (message->FindMessenger("TrackerViewToken", &messenger) == B_OK) { bundleThis = new BMessage(); @@ -813,14 +817,14 @@ TTracker::RefsReceived(BMessage *message) entry_ref ref; message->FindRef("refs", index, &ref); - const node_ref *nodeToClose = NULL; - const node_ref *nodeToSelect = NULL; + const node_ref* nodeToClose = NULL; + const node_ref* nodeToSelect = NULL; ssize_t numBytes; message->FindData("nodeRefsToClose", B_RAW_TYPE, index, - (const void **)&nodeToClose, &numBytes); + (const void**)&nodeToClose, &numBytes); message->FindData("nodeRefToSelect", B_RAW_TYPE, index, - (const void **)&nodeToSelect, &numBytes); + (const void**)&nodeToSelect, &numBytes); OpenRef(&ref, nodeToClose, nodeToSelect, selector, bundleThis); } @@ -833,10 +837,10 @@ TTracker::RefsReceived(BMessage *message) void -TTracker::ArgvReceived(int32 argc, char **argv) +TTracker::ArgvReceived(int32 argc, char** argv) { - BMessage *message = CurrentMessage(); - const char *currentWorkingDirectoryPath = NULL; + BMessage* message = CurrentMessage(); + const char* currentWorkingDirectoryPath = NULL; entry_ref ref; if (message->FindString("cwd", ¤tWorkingDirectoryPath) == B_OK) { @@ -853,12 +857,12 @@ TTracker::ArgvReceived(int32 argc, char **argv) } void -TTracker::OpenContainerWindow(Model *model, BMessage *originalRefsList, +TTracker::OpenContainerWindow(Model* model, BMessage* originalRefsList, OpenSelector openSelector, uint32 openFlags, bool checkAlreadyOpen, - const BMessage *stateMessage) + const BMessage* stateMessage) { AutoLock lock(&fWindowList); - BContainerWindow *window = NULL; + BContainerWindow* window = NULL; if (checkAlreadyOpen && openSelector != kRunOpenWithWindow) // find out if window already open window = FindContainerWindow(model->NodeRef()); @@ -886,7 +890,7 @@ TTracker::OpenContainerWindow(Model *model, BMessage *originalRefsList, // we open a new one. if (openSelector == kRunOpenWithWindow) { - BMessage *refList = NULL; + BMessage* refList = NULL; if (!originalRefsList) { // when passing just a single model, stuff it's entry in a single // element list anyway @@ -922,7 +926,7 @@ TTracker::OpenContainerWindow(Model *model, BMessage *originalRefsList, void -TTracker::EditQueries(const BMessage *message) +TTracker::EditQueries(const BMessage* message) { bool editOnlyIfTemplate; if (message->FindBool("editQueryOnPose", &editOnlyIfTemplate) != B_OK) @@ -942,7 +946,7 @@ TTracker::EditQueries(const BMessage *message) void -TTracker::OpenInfoWindows(BMessage *message) +TTracker::OpenInfoWindows(BMessage* message) { type_code type; int32 count; @@ -953,14 +957,14 @@ TTracker::OpenInfoWindows(BMessage *message) message->FindRef("refs", index, &ref); BEntry entry; if (entry.SetTo(&ref) == B_OK) { - Model *model = new Model(&entry); + Model* model = new Model(&entry); if (model->InitCheck() != B_OK) { delete model; continue; } AutoLock lock(&fWindowList); - BInfoWindow *wind = FindInfoWindow(model->NodeRef()); + BInfoWindow* wind = FindInfoWindow(model->NodeRef()); if (wind) { wind->Activate(); @@ -974,12 +978,12 @@ TTracker::OpenInfoWindows(BMessage *message) } -BDeskWindow * +BDeskWindow* TTracker::GetDeskWindow() const { int32 count = fWindowList.CountItems(); for (int32 index = 0; index < count; index++) { - BDeskWindow *window = dynamic_cast + BDeskWindow* window = dynamic_cast (fWindowList.ItemAt(index)); if (window) @@ -990,8 +994,8 @@ TTracker::GetDeskWindow() const } -BContainerWindow * -TTracker::FindContainerWindow(const node_ref *node, int32 number) const +BContainerWindow* +TTracker::FindContainerWindow(const node_ref* node, int32 number) const { ASSERT(fWindowList.IsLocked()); @@ -1000,7 +1004,7 @@ TTracker::FindContainerWindow(const node_ref *node, int32 number) const int32 windowsFound = 0; for (int32 index = 0; index < count; index++) { - BContainerWindow *window = dynamic_cast + BContainerWindow* window = dynamic_cast (fWindowList.ItemAt(index)); if (window && window->IsShowing(node) && number == windowsFound++) @@ -1010,8 +1014,8 @@ TTracker::FindContainerWindow(const node_ref *node, int32 number) const } -BContainerWindow * -TTracker::FindContainerWindow(const entry_ref *entry, int32 number) const +BContainerWindow* +TTracker::FindContainerWindow(const entry_ref* entry, int32 number) const { ASSERT(fWindowList.IsLocked()); @@ -1020,7 +1024,7 @@ TTracker::FindContainerWindow(const entry_ref *entry, int32 number) const int32 windowsFound = 0; for (int32 index = 0; index < count; index++) { - BContainerWindow *window = dynamic_cast + BContainerWindow* window = dynamic_cast (fWindowList.ItemAt(index)); if (window && window->IsShowing(entry) && number == windowsFound++) @@ -1031,15 +1035,15 @@ TTracker::FindContainerWindow(const entry_ref *entry, int32 number) const bool -TTracker::EntryHasWindowOpen(const entry_ref *entry) +TTracker::EntryHasWindowOpen(const entry_ref* entry) { AutoLock lock(&fWindowList); return FindContainerWindow(entry) != NULL; } -BContainerWindow * -TTracker::FindParentContainerWindow(const entry_ref *ref) const +BContainerWindow* +TTracker::FindParentContainerWindow(const entry_ref* ref) const { BEntry entry(ref); BEntry parent; @@ -1054,7 +1058,7 @@ TTracker::FindParentContainerWindow(const entry_ref *ref) const int32 count = fWindowList.CountItems(); for (int32 index = 0; index < count; index++) { - BContainerWindow *window = dynamic_cast + BContainerWindow* window = dynamic_cast (fWindowList.ItemAt(index)); if (window && window->IsShowing(&parentRef)) return window; @@ -1063,14 +1067,14 @@ TTracker::FindParentContainerWindow(const entry_ref *ref) const } -BInfoWindow * +BInfoWindow* TTracker::FindInfoWindow(const node_ref* node) const { ASSERT(fWindowList.IsLocked()); int32 count = fWindowList.CountItems(); for (int32 index = 0; index < count; index++) { - BInfoWindow *window = dynamic_cast + BInfoWindow* window = dynamic_cast (fWindowList.ItemAt(index)); if (window && window->IsShowing(node)) return window; @@ -1085,8 +1089,8 @@ TTracker::QueryActiveForDevice(dev_t device) AutoLock lock(&fWindowList); int32 count = fWindowList.CountItems(); for (int32 index = 0; index < count; index++) { - BQueryContainerWindow *window = dynamic_cast - (fWindowList.ItemAt(index)); + BQueryContainerWindow* window + = dynamic_cast(fWindowList.ItemAt(index)); if (window) { AutoLock lock(window); if (window->ActiveOnDevice(device)) @@ -1105,8 +1109,8 @@ TTracker::CloseActiveQueryWindows(dev_t device) bool closed = false; AutoLock lock(fWindowList); for (int32 index = fWindowList.CountItems(); index >= 0; index--) { - BQueryContainerWindow *window = dynamic_cast - (fWindowList.ItemAt(index)); + BQueryContainerWindow* window + = dynamic_cast(fWindowList.ItemAt(index)); if (window) { AutoLock lock(window); if (window->ActiveOnDevice(device)) { @@ -1131,12 +1135,12 @@ TTracker::SaveAllPoseLocations() { int32 numWindows = fWindowList.CountItems(); for (int32 windowIndex = 0; windowIndex < numWindows; windowIndex++) { - BContainerWindow *window = dynamic_cast - (fWindowList.ItemAt(windowIndex)); + BContainerWindow* window + = dynamic_cast(fWindowList.ItemAt(windowIndex)); if (window) { AutoLock lock(window); - BDeskWindow *deskWindow = dynamic_cast(window); + BDeskWindow* deskWindow = dynamic_cast(window); if (deskWindow) deskWindow->SaveDesktopPoseLocations(); @@ -1148,7 +1152,7 @@ TTracker::SaveAllPoseLocations() void -TTracker::CloseWindowAndChildren(const node_ref *node) +TTracker::CloseWindowAndChildren(const node_ref* node) { BDirectory dir(node); if (dir.InitCheck() != B_OK) @@ -1160,7 +1164,7 @@ TTracker::CloseWindowAndChildren(const node_ref *node) // make a list of all windows to be closed // count from end to beginning so we can remove items safely for (int32 index = fWindowList.CountItems() - 1; index >= 0; index--) { - BContainerWindow *window = dynamic_cast + BContainerWindow* window = dynamic_cast (fWindowList.ItemAt(index)); if (window && window->TargetModel()) { BEntry wind_entry; @@ -1180,7 +1184,7 @@ TTracker::CloseWindowAndChildren(const node_ref *node) // now really close the windows int32 numItems = closeList.CountItems(); for (int32 index = 0; index < numItems; index++) { - BContainerWindow *window = closeList.ItemAt(index); + BContainerWindow* window = closeList.ItemAt(index); window->PostMessage(B_QUIT_REQUESTED); } } @@ -1194,11 +1198,11 @@ TTracker::CloseAllInWorkspace() int32 currentWorkspace = 1 << current_workspace(); // count from end to beginning so we can remove items safely for (int32 index = fWindowList.CountItems() - 1; index >= 0; index--) { - BWindow *window = fWindowList.ItemAt(index); + BWindow* window = fWindowList.ItemAt(index); if (window->Workspaces() & currentWorkspace) // avoid the desktop - if (!dynamic_cast(window) - && !dynamic_cast(window)) + if (!dynamic_cast(window) + && !dynamic_cast(window)) window->PostMessage(B_QUIT_REQUESTED); } } @@ -1215,17 +1219,17 @@ TTracker::CloseAllWindows() int32 count = CountWindows(); for (int32 index = 0; index < count; index++) { - BWindow *window = WindowAt(index); + BWindow* window = WindowAt(index); // avoid the desktop - if (!dynamic_cast(window) - && !dynamic_cast(window)) + if (!dynamic_cast(window) + && !dynamic_cast(window)) window->PostMessage(B_QUIT_REQUESTED); } // count from end to beginning so we can remove items safely for (int32 index = fWindowList.CountItems() - 1; index >= 0; index--) { - BWindow *window = fWindowList.ItemAt(index); - if (!dynamic_cast(window) - && !dynamic_cast(window)) + BWindow* window = fWindowList.ItemAt(index); + if (!dynamic_cast(window) + && !dynamic_cast(window)) // ToDo: // get rid of the Remove here, BContainerWindow::Quit does it fWindowList.RemoveItemAt(index); @@ -1246,7 +1250,7 @@ TTracker::_OpenPreviouslyOpenedWindows(const char* pathFilter) || deskDir.GetAttrInfo(kAttrOpenWindows, &attrInfo) != B_OK) return; - char *buffer = (char *)malloc((size_t)attrInfo.size); + char* buffer = (char*)malloc((size_t)attrInfo.size); BMessage message; if (deskDir.ReadAttr(kAttrOpenWindows, B_MESSAGE_TYPE, 0, buffer, (size_t)attrInfo.size) != attrInfo.size @@ -1261,7 +1265,7 @@ TTracker::_OpenPreviouslyOpenedWindows(const char* pathFilter) deskDir.GetNodeRef(&nodeRef); int32 stateMessageCounter = 0; - const char *path; + const char* path; for (int32 i = 0; message.FindString("paths", i, &path) == B_OK; i++) { if (strncmp(path, pathFilter, filterLength)) continue; @@ -1272,7 +1276,7 @@ TTracker::_OpenPreviouslyOpenedWindows(const char* pathFilter) int8 flags = 0; for (int32 j = 0; message.FindInt8(path, j, &flags) == B_OK; j++) { - Model *model = new Model(&entry); + Model* model = new Model(&entry); if (model->InitCheck() == B_OK && model->IsContainer()) { BMessage state; bool restoreStateFromMessage = false; @@ -1327,13 +1331,13 @@ TTracker::ReadyToRun() fTaskLoop = new StandAloneTaskLoop(true); // open desktop window - BContainerWindow *deskWindow = NULL; + BContainerWindow* deskWindow = NULL; BDirectory deskDir; if (FSGetDeskDir(&deskDir) == B_OK) { // create desktop BEntry entry; deskDir.GetEntry(&entry); - Model *model = new Model(&entry, true); + Model* model = new Model(&entry, true); if (model->InitCheck() == B_OK) { AutoLock lock(&fWindowList); deskWindow = new BDeskWindow(&fWindowList); @@ -1372,15 +1376,15 @@ TTracker::ReadyToRun() } } -MimeTypeList * +MimeTypeList* TTracker::MimeTypes() const { return fMimeTypeList; } void -TTracker::SelectChildInParentSoon(const entry_ref *parent, - const node_ref *child) +TTracker::SelectChildInParentSoon(const entry_ref* parent, + const node_ref* child) { fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TTracker::SelectChildInParent, this, parent, child), @@ -1388,8 +1392,8 @@ TTracker::SelectChildInParentSoon(const entry_ref *parent, } void -TTracker::CloseParentWaitingForChildSoon(const entry_ref *child, - const node_ref *parent) +TTracker::CloseParentWaitingForChildSoon(const entry_ref* child, + const node_ref* parent) { fTaskLoop->RunLater(NewMemberFunctionObjectWithResult (&TTracker::CloseParentWaitingForChild, this, child, parent), @@ -1408,7 +1412,7 @@ void TTracker::SelectPoseAtLocationInParent(node_ref parent, BPoint pointInPose) { AutoLock lock(&fWindowList); - BContainerWindow *parentWindow = FindContainerWindow(&parent); + BContainerWindow* parentWindow = FindContainerWindow(&parent); if (parentWindow) { AutoLock lock(parentWindow); parentWindow->PoseView()->SelectPoseAtLocation(pointInPose); @@ -1416,12 +1420,12 @@ TTracker::SelectPoseAtLocationInParent(node_ref parent, BPoint pointInPose) } bool -TTracker::CloseParentWaitingForChild(const entry_ref *child, - const node_ref *parent) +TTracker::CloseParentWaitingForChild(const entry_ref* child, + const node_ref* parent) { AutoLock lock(&fWindowList); - BContainerWindow *parentWindow = FindContainerWindow(parent); + BContainerWindow* parentWindow = FindContainerWindow(parent); if (!parentWindow) // parent window already closed, give up return true; @@ -1433,7 +1437,7 @@ TTracker::CloseParentWaitingForChild(const entry_ref *child, if (entry.GetRef(&resolvedChild) != B_OK) resolvedChild = *child; - BContainerWindow *window = FindContainerWindow(&resolvedChild); + BContainerWindow* window = FindContainerWindow(&resolvedChild); if (window) { AutoLock lock(window); if (!window->IsHidden()) @@ -1470,11 +1474,11 @@ TTracker::ShowSettingsWindow() } bool -TTracker::CloseParentWindowCommon(BContainerWindow *window) +TTracker::CloseParentWindowCommon(BContainerWindow* window) { ASSERT(fWindowList.IsLocked()); - if (dynamic_cast(window)) + if (dynamic_cast(window)) // don't close the destop return false; @@ -1483,11 +1487,11 @@ TTracker::CloseParentWindowCommon(BContainerWindow *window) } bool -TTracker::SelectChildInParent(const entry_ref *parent, const node_ref *child) +TTracker::SelectChildInParent(const entry_ref* parent, const node_ref* child) { AutoLock lock(&fWindowList); - BContainerWindow *window = FindContainerWindow(parent); + BContainerWindow* window = FindContainerWindow(parent); if (!window) // parent window already closed, give up return false; @@ -1495,9 +1499,9 @@ TTracker::SelectChildInParent(const entry_ref *parent, const node_ref *child) AutoLock windowLock(window); if (windowLock.IsLocked()) { - BPoseView *view = window->PoseView(); + BPoseView* view = window->PoseView(); int32 index; - BPose *pose = view->FindPose(child, &index); + BPose* pose = view->FindPose(child, &index); if (pose) { view->SelectPose(pose, index); return true; @@ -1526,7 +1530,7 @@ TTracker::NeedMoreNodeMonitors() } status_t -TTracker::WatchNode(const node_ref *node, uint32 flags, +TTracker::WatchNode(const node_ref* node, uint32 flags, BMessenger target) { status_t result = watch_node(node, flags, target); @@ -1539,7 +1543,7 @@ TTracker::WatchNode(const node_ref *node, uint32 flags, PRINT(("failed to start monitoring, trying to allocate more " "node monitors\n")); - TTracker *tracker = dynamic_cast(be_app); + TTracker* tracker = dynamic_cast(be_app); if (!tracker) { // we are the file panel only, just fail return result; @@ -1566,7 +1570,7 @@ TTracker::MountServer() const bool -TTracker::InTrashNode(const entry_ref *node) const +TTracker::InTrashNode(const entry_ref* node) const { return FSInTrashDir(node); } @@ -1580,8 +1584,7 @@ TTracker::TrashFull() const bool -TTracker::IsTrashNode(const node_ref *node) const +TTracker::IsTrashNode(const node_ref* node) const { return fTrashWatcher->IsTrashNode(node); } - diff --git a/src/kits/tracker/Tracker.h b/src/kits/tracker/Tracker.h index e3995767f7..5a31f782cc 100644 --- a/src/kits/tracker/Tracker.h +++ b/src/kits/tracker/Tracker.h @@ -31,9 +31,9 @@ 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. */ +#ifndef _TRACKER_H +#define _TRACKER_H -#ifndef _TRACKER_H -#define _TRACKER_H #include #include @@ -83,25 +83,25 @@ class TTracker : public BApplication { virtual void Quit(); virtual bool QuitRequested(); virtual void ReadyToRun(); - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); virtual void Pulse(); - virtual void RefsReceived(BMessage *); - virtual void ArgvReceived(int32 argc, char **argv); + virtual void RefsReceived(BMessage*); + virtual void ArgvReceived(int32 argc, char** argv); - MimeTypeList *MimeTypes() const; + MimeTypeList* MimeTypes() const; // list of mime types that have a description and do not have // themselves as a preferred handler (case of applications) bool TrashFull() const; - bool IsTrashNode(const node_ref *) const; - bool InTrashNode(const entry_ref *) const; + bool IsTrashNode(const node_ref*) const; + bool InTrashNode(const entry_ref*) const; - void CloseParentWaitingForChildSoon(const entry_ref *child, - const node_ref *parent); + void CloseParentWaitingForChildSoon(const entry_ref* child, + const node_ref* parent); // closes parent, waits for child to open first - void SelectChildInParentSoon(const entry_ref *child, - const node_ref *parent); + void SelectChildInParentSoon(const entry_ref* child, + const node_ref* parent); // waits till child shows up in parent and selects it void SelectPoseAtLocationSoon(node_ref parent, BPoint location); @@ -113,19 +113,19 @@ class TTracker : public BApplication { kRunOpenWithWindow }; - bool EntryHasWindowOpen(const entry_ref *); + bool EntryHasWindowOpen(const entry_ref*); // return true if there is an open window for an entry status_t NeedMoreNodeMonitors(); // call if ran out of node monitors to allocate more // return false if already using all we can get - static status_t WatchNode(const node_ref *, uint32 flags, + static status_t WatchNode(const node_ref*, uint32 flags, BMessenger target); // cover call for watch_node; if first watch_node fails, // tries bumping the node monitor limit and calls watch_node // again - TaskLoop *MainTaskLoop() const; + TaskLoop* MainTaskLoop() const; BMessenger MountServer() const; bool QueryActiveForDevice(dev_t); @@ -137,45 +137,45 @@ class TTracker : public BApplication { void ShowSettingsWindow(); - BContainerWindow *FindContainerWindow(const node_ref *, int32 number = 0) const; - BContainerWindow *FindContainerWindow(const entry_ref *, int32 number = 0) const; - BContainerWindow *FindParentContainerWindow(const entry_ref *) const; + BContainerWindow* FindContainerWindow(const node_ref*, int32 number = 0) const; + BContainerWindow* FindContainerWindow(const entry_ref*, int32 number = 0) const; + BContainerWindow* FindParentContainerWindow(const entry_ref*) const; // right now works just on plain windows, not on query windows - BClipboardRefsWatcher *ClipboardRefsWatcher() const; + BClipboardRefsWatcher* ClipboardRefsWatcher() const; protected: // scripting - virtual BHandler *ResolveSpecifier(BMessage *, int32, BMessage *, - int32, const char *); - virtual status_t GetSupportedSuites(BMessage *); + virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, + int32, const char*); + virtual status_t GetSupportedSuites(BMessage*); - bool HandleScriptingMessage(BMessage *); + bool HandleScriptingMessage(BMessage*); - bool ExecuteProperty(BMessage *, int32, const char *, BMessage *); - bool CreateProperty(BMessage *, BMessage *, int32, const char *, - BMessage *); - bool DeleteProperty(BMessage *, int32, - const char *, BMessage *); - bool CountProperty(BMessage *, int32, const char *, BMessage *); - bool GetProperty(BMessage *, int32, const char *, BMessage *); - bool SetProperty(BMessage *, BMessage *, int32, const char *, BMessage *); + bool ExecuteProperty(BMessage*, int32, const char*, BMessage*); + bool CreateProperty(BMessage*, BMessage*, int32, const char*, + BMessage*); + bool DeleteProperty(BMessage*, int32, + const char*, BMessage*); + bool CountProperty(BMessage*, int32, const char*, BMessage*); + bool GetProperty(BMessage*, int32, const char*, BMessage*); + bool SetProperty(BMessage*, BMessage*, int32, const char*, BMessage*); private: // callbacks for ChildParentSoon calls - bool CloseParentWaitingForChild(const entry_ref *child, - const node_ref *parent); - bool LaunchAndCloseParentIfOK(const entry_ref *launchThis, - const node_ref *closeThis, const BMessage *messageToBundle); - bool SelectChildInParent(const entry_ref *child, - const node_ref *parent); + bool CloseParentWaitingForChild(const entry_ref* child, + const node_ref* parent); + bool LaunchAndCloseParentIfOK(const entry_ref* launchThis, + const node_ref* closeThis, const BMessage* messageToBundle); + bool SelectChildInParent(const entry_ref* child, + const node_ref* parent); void SelectPoseAtLocationInParent(node_ref parent, BPoint location); - bool CloseParentWindowCommon(BContainerWindow *); + bool CloseParentWindowCommon(BContainerWindow*); void InitMimeTypes(); - bool InstallMimeIfNeeded(const char *type, int32 bitsID, - const char *shortDescription, const char *longDescription, - const char *preferredAppSignature, uint32 forceMask = 0); + bool InstallMimeIfNeeded(const char* type, int32 bitsID, + const char* shortDescription, const char* longDescription, + const char* preferredAppSignature, uint32 forceMask = 0); // used by InitMimeTypes - checks if a metamime of a given is // installed and if it has all the specified attributes; if not, the // whole mime type is installed and all attributes are set; nulls can @@ -190,47 +190,48 @@ class TTracker : public BApplication { void InstallIndices(dev_t); void CloseAllWindows(); - void CloseWindowAndChildren(const node_ref *); + void CloseWindowAndChildren(const node_ref*); void CloseAllInWorkspace(); void OpenInfoWindows(BMessage*); - void MoveRefsToTrash(const BMessage *); - void OpenContainerWindow(Model *, BMessage *refsList = NULL, - OpenSelector openSelector = kOpen, uint32 openFlags = 0, - bool checkAlreadyOpen = true, const BMessage *stateMessage = NULL); + void MoveRefsToTrash(const BMessage*); + void OpenContainerWindow(Model*, BMessage* refsList = NULL, + OpenSelector openSelector = kOpen, uint32 openFlags = 0, + bool checkAlreadyOpen = true, const BMessage* stateMessage = NULL); // pass either a Model or a list of entries to open void _OpenPreviouslyOpenedWindows(const char* pathFilter = NULL); - void SetDefaultPrinter(const BMessage *); - void EditQueries(const BMessage *); + void SetDefaultPrinter(const BMessage*); + void EditQueries(const BMessage*); - BInfoWindow *FindInfoWindow(const node_ref *) const; + BInfoWindow* FindInfoWindow(const node_ref*) const; - BDeskWindow *GetDeskWindow() const; + BDeskWindow* GetDeskWindow() const; - status_t OpenRef(const entry_ref *, const node_ref *nodeToClose = NULL, - const node_ref *nodeToSelect = NULL, OpenSelector selector = kOpen, - const BMessage *messageToBundle = NULL); + status_t OpenRef(const entry_ref*, const node_ref* nodeToClose = NULL, + const node_ref* nodeToSelect = NULL, OpenSelector selector = kOpen, + const BMessage* messageToBundle = NULL); - MimeTypeList *fMimeTypeList; - WindowList fWindowList; - BClipboardRefsWatcher *fClipboardRefsWatcher; - BTrashWatcher *fTrashWatcher; - TaskLoop *fTaskLoop; - int32 fNodeMonitorCount; + MimeTypeList* fMimeTypeList; + WindowList fWindowList; + BClipboardRefsWatcher* fClipboardRefsWatcher; + BTrashWatcher* fTrashWatcher; + TaskLoop* fTaskLoop; + int32 fNodeMonitorCount; - TrackerSettingsWindow *fSettingsWindow; + TrackerSettingsWindow* fSettingsWindow; typedef BApplication _inherited; }; -inline TaskLoop * +inline TaskLoop* TTracker::MainTaskLoop() const { return fTaskLoop; } -inline BClipboardRefsWatcher * + +inline BClipboardRefsWatcher* TTracker::ClipboardRefsWatcher() const { return fClipboardRefsWatcher; @@ -240,4 +241,4 @@ TTracker::ClipboardRefsWatcher() const using namespace BPrivate; -#endif /* _TRACKER_H */ +#endif // _TRACKER_H diff --git a/src/kits/tracker/TrackerInitialState.cpp b/src/kits/tracker/TrackerInitialState.cpp index 9229de3e5c..1c0c12abac 100644 --- a/src/kits/tracker/TrackerInitialState.cpp +++ b/src/kits/tracker/TrackerInitialState.cpp @@ -36,6 +36,7 @@ All rights reserved. // add code to initialize a subset of the mime database, including // important sniffer rules + #include #include #include @@ -62,6 +63,7 @@ All rights reserved. #include "QueryContainerWindow.h" #include "Tracker.h" + enum { kForceLargeIcon = 0x1, kForceMiniIcon = 0x2, @@ -71,23 +73,23 @@ enum { }; -const char *kAttrName = "META:name"; -const char *kAttrCompany = "META:company"; -const char *kAttrAddress = "META:address"; -const char *kAttrCity = "META:city"; -const char *kAttrState = "META:state"; -const char *kAttrZip = "META:zip"; -const char *kAttrCountry = "META:country"; -const char *kAttrHomePhone = "META:hphone"; -const char *kAttrWorkPhone = "META:wphone"; -const char *kAttrFax = "META:fax"; -const char *kAttrEmail = "META:email"; -const char *kAttrURL = "META:url"; -const char *kAttrGroup = "META:group"; -const char *kAttrNickname = "META:nickname"; +const char* kAttrName = "META:name"; +const char* kAttrCompany = "META:company"; +const char* kAttrAddress = "META:address"; +const char* kAttrCity = "META:city"; +const char* kAttrState = "META:state"; +const char* kAttrZip = "META:zip"; +const char* kAttrCountry = "META:country"; +const char* kAttrHomePhone = "META:hphone"; +const char* kAttrWorkPhone = "META:wphone"; +const char* kAttrFax = "META:fax"; +const char* kAttrEmail = "META:email"; +const char* kAttrURL = "META:url"; +const char* kAttrGroup = "META:group"; +const char* kAttrNickname = "META:nickname"; -const char *kNetPositiveSignature = "application/x-vnd.Be-NPOS"; -const char *kPeopleSignature = "application/x-vnd.Be-PEPL"; +const char* kNetPositiveSignature = "application/x-vnd.Be-NPOS"; +const char* kPeopleSignature = "application/x-vnd.Be-PEPL"; // the following templates are in big endian and we rely on the Tracker // translation support to swap them on little endian machines @@ -102,13 +104,15 @@ const int32 kDefaultQueryTemplateCount = 3; const AttributeTemplate kDefaultQueryTemplate[] = /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_octet-stream */ { - { /* default frame */ + { + // default frame kAttrWindowFrame, B_RECT_TYPE, 16, - (const char *)&kDefaultFrame + (const char*)&kDefaultFrame }, - { /* attr: _trk/viewstate */ + { + // attr: _trk/viewstate kAttrViewState_be, B_RAW_TYPE, 49, @@ -116,7 +120,8 @@ const AttributeTemplate kDefaultQueryTemplate[] = "\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000" "\000\000\000\000\000\000" }, - { /* attr: _trk/columns */ + { + // attr: _trk/columns kAttrColumns_be, B_RAW_TYPE, 223, @@ -135,13 +140,15 @@ const AttributeTemplate kDefaultQueryTemplate[] = const AttributeTemplate kBookmarkQueryTemplate[] = /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */ { - { /* default frame */ + { + // default frame kAttrWindowFrame, B_RECT_TYPE, 16, - (const char *)&kDefaultFrame + (const char*)&kDefaultFrame }, - { /* attr: _trk/viewstate */ + { + // attr: _trk/viewstate kAttrViewState_be, B_RAW_TYPE, 49, @@ -149,7 +156,8 @@ const AttributeTemplate kBookmarkQueryTemplate[] = "\000\000\000\000\000\000\000\000\000\000w\373\175RCSTR\000\000\000" "\000\000\000\000\000\000" }, - { /* attr: _trk/columns */ + { + // attr: _trk/columns kAttrColumns_be, B_RAW_TYPE, 163, @@ -166,13 +174,15 @@ const AttributeTemplate kBookmarkQueryTemplate[] = const AttributeTemplate kPersonQueryTemplate[] = /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */ { - { /* default frame */ + { + // default frame kAttrWindowFrame, B_RECT_TYPE, 16, - (const char *)&kDefaultFrame + (const char*)&kDefaultFrame }, - { /* attr: _trk/viewstate */ + { + // attr: _trk/viewstate kAttrViewState_be, B_RAW_TYPE, 49, @@ -180,7 +190,8 @@ const AttributeTemplate kPersonQueryTemplate[] = "\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000" "\000\000\000\000\000\000" }, - { /* attr: _trk/columns */ + { + // attr: _trk/columns kAttrColumns_be, B_RAW_TYPE, 230, @@ -199,13 +210,15 @@ const AttributeTemplate kPersonQueryTemplate[] = const AttributeTemplate kEmailQueryTemplate[] = /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/text_x-email */ { - { /* default frame */ + { + // default frame kAttrWindowFrame, B_RECT_TYPE, 16, - (const char *)&kDefaultFrame + (const char*)&kDefaultFrame }, - { /* attr: _trk/viewstate */ + { + // attr: _trk/viewstate kAttrViewState_be, B_RAW_TYPE, 49, @@ -213,7 +226,8 @@ const AttributeTemplate kEmailQueryTemplate[] = "\000\000\000\000\000\000\000\000\000\000\366_\377ETIME\000\000\000" "\000\000\000\000\000\000" }, - { /* attr: _trk/columns */ + { + // attr: _trk/columns kAttrColumns_be, B_RAW_TYPE, 222, @@ -234,10 +248,10 @@ namespace BPrivate { class ExtraAttributeLazyInstaller { public: - ExtraAttributeLazyInstaller(const char *type); + ExtraAttributeLazyInstaller(const char* type); ~ExtraAttributeLazyInstaller(); - bool AddExtraAttribute(const char *publicName, const char *name, + bool AddExtraAttribute(const char* publicName, const char* name, uint32 type, bool viewable, bool editable, float width, int32 alignment, bool extra); @@ -251,7 +265,7 @@ public: } // namespace BPrivate -ExtraAttributeLazyInstaller::ExtraAttributeLazyInstaller(const char *type) +ExtraAttributeLazyInstaller::ExtraAttributeLazyInstaller(const char* type) : fMimeType(type), fDirty(false) @@ -269,12 +283,12 @@ ExtraAttributeLazyInstaller::~ExtraAttributeLazyInstaller() bool -ExtraAttributeLazyInstaller::AddExtraAttribute(const char *publicName, - const char *name, uint32 type, bool viewable, bool editable, float width, +ExtraAttributeLazyInstaller::AddExtraAttribute(const char* publicName, + const char* name, uint32 type, bool viewable, bool editable, float width, int32 alignment, bool extra) { for (int32 index = 0; ; index++) { - const char *oldPublicName; + const char* oldPublicName; if (fExtraAttrs.FindString("attr:public_name", index, &oldPublicName) != B_OK) break; @@ -317,7 +331,7 @@ InstallTemporaryBackgroundImages(BNode* node, BMessage* message) static void -AddTemporaryBackgroundImages(BMessage *message, const char *imagePath, +AddTemporaryBackgroundImages(BMessage* message, const char* imagePath, BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool textWidgetOutlines) { @@ -336,9 +350,9 @@ AddTemporaryBackgroundImages(BMessage *message, const char *imagePath, #define B_TRANSLATION_CONTEXT "TrackerInitialState" bool -TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID, - const char *shortDescription, const char *longDescription, - const char *preferredAppSignature, uint32 forceMask) +TTracker::InstallMimeIfNeeded(const char* type, int32 bitsID, + const char* shortDescription, const char* longDescription, + const char* preferredAppSignature, uint32 forceMask) { // used by InitMimeTypes - checks if a metamime of a given is // installed and if it has all the specified attributes; if not, the diff --git a/src/kits/tracker/TrackerScripting.cpp b/src/kits/tracker/TrackerScripting.cpp index b59a71da7c..0776e13f08 100644 --- a/src/kits/tracker/TrackerScripting.cpp +++ b/src/kits/tracker/TrackerScripting.cpp @@ -50,7 +50,7 @@ doo Tracker create Folder to '/boot/home/Desktop/hello' ToDo: Create file: on a "Tracker" "File" "B_CREATE_PROPERTY" "name" Create query: on a "Tracker" "Query" "B_CREATE_PROPERTY" "name" -Open a folder: Tracker Execute "Folder" bla +Open a folder: Tracker Execute "Folder" bla Find a window for a path #endif @@ -98,21 +98,21 @@ const property_info kTrackerPropertyList[] = { status_t -TTracker::GetSupportedSuites(BMessage *data) +TTracker::GetSupportedSuites(BMessage* data) { data->AddString("suites", kTrackerSuites); - BPropertyInfo propertyInfo(const_cast(kTrackerPropertyList)); + BPropertyInfo propertyInfo(const_cast(kTrackerPropertyList)); data->AddFlat("messages", &propertyInfo); return _inherited::GetSupportedSuites(data); } -BHandler * -TTracker::ResolveSpecifier(BMessage *message, int32 index, - BMessage *specifier, int32 form, const char *property) +BHandler* +TTracker::ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 form, const char* property) { - BPropertyInfo propertyInfo(const_cast(kTrackerPropertyList)); + BPropertyInfo propertyInfo(const_cast(kTrackerPropertyList)); int32 result = propertyInfo.FindMatch(message, index, specifier, form, property); if (result < 0) { @@ -126,7 +126,7 @@ TTracker::ResolveSpecifier(BMessage *message, int32 index, bool -TTracker::HandleScriptingMessage(BMessage *message) +TTracker::HandleScriptingMessage(BMessage* message) { if (message->what != B_GET_PROPERTY && message->what != B_SET_PROPERTY @@ -138,7 +138,7 @@ TTracker::HandleScriptingMessage(BMessage *message) // dispatch scripting messages BMessage reply(B_REPLY); - const char *property = 0; + const char* property = 0; bool handled = false; int32 index = 0; @@ -148,7 +148,7 @@ TTracker::HandleScriptingMessage(BMessage *message) status_t result = message->GetCurrentSpecifier(&index, &specifier, &form, &property); - if (result != B_OK || index == -1) + if (result != B_OK || index == -1) return false; ASSERT(property); @@ -179,17 +179,18 @@ TTracker::HandleScriptingMessage(BMessage *message) break; } - if (handled) + if (handled) { // done handling message, send a reply message->SendReply(&reply); + } return handled; } bool -TTracker::CreateProperty(BMessage *message, BMessage *, int32 form, - const char *property, BMessage *reply) +TTracker::CreateProperty(BMessage* message, BMessage* , int32 form, + const char* property, BMessage* reply) { bool handled = false; status_t error = B_OK; @@ -203,7 +204,7 @@ TTracker::CreateProperty(BMessage *message, BMessage *, int32 form, message->FindRef("data", index, &ref) == B_OK; index++) { BEntry entry(&ref); - if (!entry.Exists()) + if (!entry.Exists()) error = FSCreateNewFolder(&ref); if (error != B_OK) @@ -221,8 +222,8 @@ TTracker::CreateProperty(BMessage *message, BMessage *, int32 form, bool -TTracker::DeleteProperty(BMessage */*specifier*/, int32 form, - const char *property, BMessage */*reply*/) +TTracker::DeleteProperty(BMessage* /*specifier*/, int32 form, + const char* property, BMessage* /*reply*/) { if (strcmp(property, kPropertyTrash) == 0) { // deleting on a selection is handled as removing a part of the selection @@ -237,54 +238,54 @@ TTracker::DeleteProperty(BMessage */*specifier*/, int32 form, return true; } - return false; + return false; } -#else /* _SUPPORTS_FEATURE_SCRIPTING */ +#else // _SUPPORTS_FEATURE_SCRIPTING status_t -TTracker::GetSupportedSuites(BMessage */*data*/) +TTracker::GetSupportedSuites(BMessage* /*data*/) { return B_UNSUPPORTED; } -BHandler * -TTracker::ResolveSpecifier(BMessage */*message*/, - int32 /*index*/, BMessage */*specifier*/, - int32 /*form*/, const char */*property*/) +BHandler* +TTracker::ResolveSpecifier(BMessage* /*message*/, + int32 /*index*/, BMessage* /*specifier*/, + int32 /*form*/, const char* /*property*/) { return NULL; } bool -TTracker::HandleScriptingMessage(BMessage */*message*/) +TTracker::HandleScriptingMessage(BMessage* /*message*/) { return false; } bool -TTracker::CreateProperty(BMessage */*message*/, BMessage *, int32 /*form*/, - const char */*property*/, BMessage */*reply*/) +TTracker::CreateProperty(BMessage* /*message*/, BMessage*, int32 /*form*/, + const char* /*property*/, BMessage* /*reply*/) { return false; } bool -TTracker::DeleteProperty(BMessage */*specifier*/, int32 /*form*/, - const char */*property*/, BMessage *) +TTracker::DeleteProperty(BMessage* /*specifier*/, int32 /*form*/, + const char* /*property*/, BMessage*) { return false; } -#endif /* _SUPPORTS_FEATURE_SCRIPTING */ +#endif // _SUPPORTS_FEATURE_SCRIPTING bool -TTracker::ExecuteProperty(BMessage *, int32 form, const char *property, BMessage *) +TTracker::ExecuteProperty(BMessage*, int32 form, const char* property, BMessage*) { if (strcmp(property, kPropertyPreferences) == 0) { @@ -301,22 +302,21 @@ TTracker::ExecuteProperty(BMessage *, int32 form, const char *property, BMessage bool -TTracker::CountProperty(BMessage *, int32, const char *, BMessage *) +TTracker::CountProperty(BMessage*, int32, const char*, BMessage*) { - return false; + return false; } bool -TTracker::GetProperty(BMessage *, int32, const char *, BMessage *) +TTracker::GetProperty(BMessage*, int32, const char*, BMessage*) { - return false; + return false; } bool -TTracker::SetProperty(BMessage *, BMessage *, int32, const char *, BMessage *) +TTracker::SetProperty(BMessage*, BMessage*, int32, const char*, BMessage*) { - return false; + return false; } - diff --git a/src/kits/tracker/TrackerSettings.cpp b/src/kits/tracker/TrackerSettings.cpp index b63ca2e7bd..3792eae6a6 100644 --- a/src/kits/tracker/TrackerSettings.cpp +++ b/src/kits/tracker/TrackerSettings.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "TrackerSettings.h" #include @@ -42,7 +43,7 @@ All rights reserved. class TTrackerState : public Settings { public: - static TTrackerState *Get(); + static TTrackerState* Get(); void Release(); void LoadSettingsIfNeeded(); @@ -57,32 +58,32 @@ class TTrackerState : public Settings { static void InitIfNeeded(); TTrackerState(const TTrackerState&); - BooleanValueSetting *fShowDisksIcon; - BooleanValueSetting *fMountVolumesOntoDesktop; - BooleanValueSetting *fDesktopFilePanelRoot; - BooleanValueSetting *fMountSharedVolumesOntoDesktop; - BooleanValueSetting *fEjectWhenUnmounting; + BooleanValueSetting* fShowDisksIcon; + BooleanValueSetting* fMountVolumesOntoDesktop; + BooleanValueSetting* fDesktopFilePanelRoot; + BooleanValueSetting* fMountSharedVolumesOntoDesktop; + BooleanValueSetting* fEjectWhenUnmounting; - BooleanValueSetting *fShowFullPathInTitleBar; - BooleanValueSetting *fSingleWindowBrowse; - BooleanValueSetting *fShowNavigator; - BooleanValueSetting *fShowSelectionWhenInactive; - BooleanValueSetting *fTransparentSelection; - BooleanValueSetting *fSortFolderNamesFirst; - BooleanValueSetting *fHideDotFiles; - BooleanValueSetting *fTypeAheadFiltering; + BooleanValueSetting* fShowFullPathInTitleBar; + BooleanValueSetting* fSingleWindowBrowse; + BooleanValueSetting* fShowNavigator; + BooleanValueSetting* fShowSelectionWhenInactive; + BooleanValueSetting* fTransparentSelection; + BooleanValueSetting* fSortFolderNamesFirst; + BooleanValueSetting* fHideDotFiles; + BooleanValueSetting* fTypeAheadFiltering; - ScalarValueSetting *fRecentApplicationsCount; - ScalarValueSetting *fRecentDocumentsCount; - ScalarValueSetting *fRecentFoldersCount; + ScalarValueSetting* fRecentApplicationsCount; + ScalarValueSetting* fRecentDocumentsCount; + ScalarValueSetting* fRecentFoldersCount; - BooleanValueSetting *fShowVolumeSpaceBar; - HexScalarValueSetting *fUsedSpaceColor; - HexScalarValueSetting *fFreeSpaceColor; - HexScalarValueSetting *fWarningSpaceColor; + BooleanValueSetting* fShowVolumeSpaceBar; + HexScalarValueSetting* fUsedSpaceColor; + HexScalarValueSetting* fFreeSpaceColor; + HexScalarValueSetting* fWarningSpaceColor; - BooleanValueSetting *fDontMoveFilesToTrash; - BooleanValueSetting *fAskBeforeDeleteFile; + BooleanValueSetting* fDontMoveFilesToTrash; + BooleanValueSetting* fAskBeforeDeleteFile; Benaphore fInitLock; bool fInited; @@ -455,7 +456,7 @@ TrackerSettings::SetShowNavigator(bool enabled) void -TrackerSettings::RecentCounts(int32 *applications, int32 *documents, int32 *folders) +TrackerSettings::RecentCounts(int32* applications, int32* documents, int32* folders) { if (applications) *applications = gTrackerState.fRecentApplicationsCount->Value(); @@ -513,4 +514,3 @@ TrackerSettings::SetAskBeforeDeleteFile(bool enabled) { gTrackerState.fAskBeforeDeleteFile->SetValue(enabled); } - diff --git a/src/kits/tracker/TrackerSettings.h b/src/kits/tracker/TrackerSettings.h index ed8ae4650e..efec805a58 100644 --- a/src/kits/tracker/TrackerSettings.h +++ b/src/kits/tracker/TrackerSettings.h @@ -31,9 +31,8 @@ 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. */ - -#ifndef _TRACKER_SETTINGS_H -#define _TRACKER_SETTINGS_H +#ifndef _TRACKER_SETTINGS_H +#define _TRACKER_SETTINGS_H #include "Utilities.h" @@ -51,7 +50,7 @@ enum FormatSeparator { kDotSeparator, kSeparatorsEnd }; - + enum DateOrder { kYMDFormat, kDMYFormat, @@ -60,12 +59,11 @@ enum DateOrder { }; - class TrackerSettings { public: TrackerSettings(); - //TTrackerState *Settings() const { return fSettings; } + //TTrackerState* Settings() const { return fSettings; } void SaveSettings(bool onlyIfNonDefault = true); bool ShowDisksIcon(); @@ -101,17 +99,18 @@ class TrackerSettings { void SetShowSelectionWhenInactive(bool); bool TransparentSelection(); void SetTransparentSelection(bool); - + bool SingleWindowBrowse(); void SetSingleWindowBrowse(bool); bool ShowNavigator(); void SetShowNavigator(bool); - - void RecentCounts(int32 *applications, int32 *documents, int32 *folders); + + void RecentCounts(int32* applications, int32* documents, + int32* folders); void SetRecentApplicationsCount(int32); void SetRecentDocumentsCount(int32); void SetRecentFoldersCount(int32); - + FormatSeparator TimeFormatSeparator(); void SetTimeFormatSeparator(FormatSeparator); DateOrder DateOrderFormat(); @@ -125,9 +124,9 @@ class TrackerSettings { void SetAskBeforeDeleteFile(bool); private: - //TTrackerState *fSettings; + //TTrackerState* fSettings; }; } // namespace BPrivate -#endif /* _TRACKER_SETTINGS_H */ +#endif // _TRACKER_SETTINGS_H diff --git a/src/kits/tracker/TrackerSettingsWindow.cpp b/src/kits/tracker/TrackerSettingsWindow.cpp index 42cc6904b3..84973a582e 100644 --- a/src/kits/tracker/TrackerSettingsWindow.cpp +++ b/src/kits/tracker/TrackerSettingsWindow.cpp @@ -32,30 +32,30 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include #include +#include #include "SettingsViews.h" #include "TrackerSettings.h" #include "TrackerSettingsWindow.h" -#include - namespace BPrivate { class SettingsItem : public BStringItem { public: - SettingsItem(const char *label, SettingsView *view); + SettingsItem(const char* label, SettingsView* view); - void DrawItem(BView *owner, BRect rect, bool drawEverything); + void DrawItem(BView* owner, BRect rect, bool drawEverything); - SettingsView *View(); + SettingsView* View(); private: - SettingsView *fSettingsView; + SettingsView* fSettingsView; }; } // namespace BPrivate @@ -149,7 +149,7 @@ TrackerSettingsWindow::QuitRequested() void -TrackerSettingsWindow::MessageReceived(BMessage *message) +TrackerSettingsWindow::MessageReceived(BMessage* message) { switch (message->what) { case kSettingsContentsModified: @@ -195,13 +195,13 @@ TrackerSettingsWindow::Show() } -SettingsView * +SettingsView* TrackerSettingsWindow::_ViewAt(int32 i) { if (!Lock()) return NULL; - SettingsItem *item = dynamic_cast(fSettingsTypeListView->ItemAt(i)); + SettingsItem* item = dynamic_cast(fSettingsTypeListView->ItemAt(i)); Unlock(); @@ -212,7 +212,7 @@ TrackerSettingsWindow::_ViewAt(int32 i) void TrackerSettingsWindow::_HandleChangedContents() { - fSettingsTypeListView->Invalidate(); + fSettingsTypeListView->Invalidate(); _UpdateButtons(); TrackerSettings().SaveSettings(false); @@ -272,18 +272,18 @@ TrackerSettingsWindow::_HandleChangedSettingsView() if (currentSelection < 0) return; - BView *oldView = fSettingsContainerBox->ChildAt(0); + BView* oldView = fSettingsContainerBox->ChildAt(0); if (oldView) oldView->RemoveSelf(); - SettingsItem *selectedItem = + SettingsItem* selectedItem = dynamic_cast(fSettingsTypeListView->ItemAt(currentSelection)); if (selectedItem) { fSettingsContainerBox->SetLabel(selectedItem->Text()); - BView *view = selectedItem->View(); + BView* view = selectedItem->View(); view->SetViewColor(fSettingsContainerBox->ViewColor()); view->Hide(); fSettingsContainerBox->AddChild(view); @@ -296,7 +296,7 @@ TrackerSettingsWindow::_HandleChangedSettingsView() // #pragma mark - -SettingsItem::SettingsItem(const char *label, SettingsView *view) +SettingsItem::SettingsItem(const char* label, SettingsView* view) : BStringItem(label), fSettingsView(view) { @@ -304,7 +304,7 @@ SettingsItem::SettingsItem(const char *label, SettingsView *view) void -SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything) +SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything) { const rgb_color kModifiedColor = {0, 0, 255, 0}; const rgb_color kBlack = {0, 0, 0, 0}; @@ -314,27 +314,27 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything) bool isRevertable = fSettingsView->IsRevertable(); bool isSelected = IsSelected(); - if (isSelected || drawEverything) { - rgb_color color; - if (isSelected) - color = kSelectedColor; - else - color = owner->ViewColor(); + if (isSelected || drawEverything) { + rgb_color color; + if (isSelected) + color = kSelectedColor; + else + color = owner->ViewColor(); - owner->SetHighColor(color); - owner->SetLowColor(color); - owner->FillRect(rect); + owner->SetHighColor(color); + owner->SetLowColor(color); + owner->FillRect(rect); } if (isRevertable) owner->SetHighColor(kModifiedColor); - else + else owner->SetHighColor(kBlack); font_height fheight; owner->GetFontHeight(&fheight); - owner->DrawString(Text(), BPoint(rect.left + 4, rect.top + owner->DrawString(Text(), BPoint(rect.left + 4, rect.top + fheight.ascent + 2 + floorf(fheight.leading / 2))); owner->SetHighColor(kBlack); @@ -343,7 +343,7 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything) } -SettingsView * +SettingsView* SettingsItem::View() { return fSettingsView; diff --git a/src/kits/tracker/TrackerSettingsWindow.h b/src/kits/tracker/TrackerSettingsWindow.h index 7817ecdf2d..45600cdd3b 100644 --- a/src/kits/tracker/TrackerSettingsWindow.h +++ b/src/kits/tracker/TrackerSettingsWindow.h @@ -31,10 +31,10 @@ 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. */ - #ifndef TRACKER_SETTINGS_WINDOW_H #define TRACKER_SETTINGS_WINDOW_H + #include #include #include @@ -51,12 +51,11 @@ class TrackerSettingsWindow : public BWindow { TrackerSettingsWindow(); bool QuitRequested(); - void MessageReceived(BMessage *message); + void MessageReceived(BMessage* message); void Show(); - private: - SettingsView *_ViewAt(int32 i); + SettingsView* _ViewAt(int32 i); void _HandleChangedContents(); void _HandlePressedDefaultsButton(); @@ -64,10 +63,10 @@ class TrackerSettingsWindow : public BWindow { void _HandleChangedSettingsView(); void _UpdateButtons(); - BListView *fSettingsTypeListView; - BBox *fSettingsContainerBox; - BButton *fDefaultsButton; - BButton *fRevertButton; + BListView* fSettingsTypeListView; + BBox* fSettingsContainerBox; + BButton* fDefaultsButton; + BButton* fRevertButton; typedef BWindow _inherited; }; diff --git a/src/kits/tracker/TrackerString.cpp b/src/kits/tracker/TrackerString.cpp index 2168ebbe82..14b4291f89 100644 --- a/src/kits/tracker/TrackerString.cpp +++ b/src/kits/tracker/TrackerString.cpp @@ -42,7 +42,7 @@ TrackerString::TrackerString() } -TrackerString::TrackerString(const char *string) +TrackerString::TrackerString(const char* string) : BString(string) { } @@ -54,7 +54,7 @@ TrackerString::TrackerString(const TrackerString &string) } -TrackerString::TrackerString(const char *string, int32 maxLength) +TrackerString::TrackerString(const char* string, int32 maxLength) : BString(string, maxLength) { } @@ -66,7 +66,7 @@ TrackerString::~TrackerString() bool -TrackerString::Matches(const char *string, bool caseSensitivity, +TrackerString::Matches(const char* string, bool caseSensitivity, TrackerStringExpressionType expressionType) const { switch (expressionType) { @@ -93,7 +93,7 @@ TrackerString::Matches(const char *string, bool caseSensitivity, bool -TrackerString::MatchesRegExp(const char *pattern, bool caseSensitivity) const +TrackerString::MatchesRegExp(const char* pattern, bool caseSensitivity) const { BString patternString(pattern); BString textString(String()); @@ -113,14 +113,14 @@ TrackerString::MatchesRegExp(const char *pattern, bool caseSensitivity) const bool -TrackerString::MatchesGlob(const char *string, bool caseSensitivity) const +TrackerString::MatchesGlob(const char* string, bool caseSensitivity) const { return StringMatchesPattern(String(), string, caseSensitivity); } bool -TrackerString::EndsWith(const char *string, bool caseSensitivity) const +TrackerString::EndsWith(const char* string, bool caseSensitivity) const { // If "string" is longer than "this", // we should simply return false @@ -136,17 +136,17 @@ TrackerString::EndsWith(const char *string, bool caseSensitivity) const bool -TrackerString::StartsWith(const char *string, bool caseSensitivity) const +TrackerString::StartsWith(const char* string, bool caseSensitivity) const { if (caseSensitivity) return FindFirst(string) == 0; - else + else return IFindFirst(string) == 0; } bool -TrackerString::Contains(const char *string, bool caseSensitivity) const +TrackerString::Contains(const char* string, bool caseSensitivity) const { if (caseSensitivity) return FindFirst(string) > -1; @@ -175,7 +175,7 @@ TrackerString::FindFirst(const BString &string) const int32 -TrackerString::FindFirst(const char *string) const +TrackerString::FindFirst(const char* string) const { return FindFirst(string, 0); } @@ -189,7 +189,7 @@ TrackerString::FindFirst(const BString &string, int32 fromOffset) const int32 -TrackerString::FindFirst(const char *string, int32 fromOffset) const +TrackerString::FindFirst(const char* string, int32 fromOffset) const { if (!string) return -1; @@ -246,7 +246,7 @@ TrackerString::FindLast(const BString &string) const int32 -TrackerString::FindLast(const char *string) const +TrackerString::FindLast(const char* string) const { return FindLast(string, Length() - 1); } @@ -260,7 +260,7 @@ TrackerString::FindLast(const BString &string, int32 beforeOffset) const int32 -TrackerString::FindLast(const char *string, int32 beforeOffset) const +TrackerString::FindLast(const char* string, int32 beforeOffset) const { if (!string) return -1; @@ -276,7 +276,7 @@ TrackerString::FindLast(const char *string, int32 beforeOffset) const if (stringLength == 0) return beforeOffset; - int32 start = MIN(beforeOffset, length - static_cast(stringLength)); + int32 start = MIN(beforeOffset, length - static_cast(stringLength)); int32 stop = 0; int32 position = -1; @@ -316,7 +316,7 @@ TrackerString::IFindFirst(const BString &string) const int32 -TrackerString::IFindFirst(const char *string) const +TrackerString::IFindFirst(const char* string) const { return IFindFirst(string, 0); } @@ -330,7 +330,7 @@ TrackerString::IFindFirst(const BString &string, int32 fromOffset) const int32 -TrackerString::IFindFirst(const char *string, int32 fromOffset) const +TrackerString::IFindFirst(const char* string, int32 fromOffset) const { if (!string) return -1; @@ -346,7 +346,7 @@ TrackerString::IFindFirst(const char *string, int32 fromOffset) const if (stringLength == 0) return fromOffset; - int32 stop = length - static_cast(stringLength); + int32 stop = length - static_cast(stringLength); int32 start = MAX(0, MIN(fromOffset, stop)); int32 position = -1; @@ -370,7 +370,7 @@ TrackerString::IFindLast(const BString &string) const int32 -TrackerString::IFindLast(const char *string) const +TrackerString::IFindLast(const char* string) const { return IFindLast(string, Length() - 1); } @@ -384,7 +384,7 @@ TrackerString::IFindLast(const BString &string, int32 beforeOffset) const int32 -TrackerString::IFindLast(const char *string, int32 beforeOffset) const +TrackerString::IFindLast(const char* string, int32 beforeOffset) const { if (!string) return -1; @@ -400,7 +400,7 @@ TrackerString::IFindLast(const char *string, int32 beforeOffset) const if (stringLength == 0) return beforeOffset; - int32 start = MIN(beforeOffset, length - static_cast(stringLength)); + int32 start = MIN(beforeOffset, length - static_cast(stringLength)); int32 stop = 0; int32 position = -1; @@ -421,7 +421,7 @@ TrackerString::IFindLast(const char *string, int32 beforeOffset) const // The reason is that an encountered '[' will be taken literally. // (Makes it possible to match a '[' with the expression '[[]'). bool -TrackerString::MatchesBracketExpression(const char *string, const char *pattern, +TrackerString::MatchesBracketExpression(const char* string, const char* pattern, bool caseSensitivity) const { bool GlyphMatch = IsStartOfGlyph(string[0]); @@ -436,7 +436,7 @@ TrackerString::MatchesBracketExpression(const char *string, const char *pattern, // We allow both ^ and ! as a initial inverting character. if (inverse) - pattern++; + pattern++; while (!match && *pattern != ']' && *pattern != '\0') { switch (*pattern) { @@ -473,7 +473,7 @@ TrackerString::MatchesBracketExpression(const char *string, const char *pattern, if (IsInsideGlyph(pattern[0])) pattern = MoveToEndOfGlyph(pattern); } - } + } // Consider an unmatched bracket a failure // (i.e. when detecting a '\0' instead of a ']'.) if (*pattern == '\0') @@ -484,102 +484,108 @@ TrackerString::MatchesBracketExpression(const char *string, const char *pattern, bool -TrackerString::StringMatchesPattern(const char *string, const char *pattern, +TrackerString::StringMatchesPattern(const char* string, const char* pattern, bool caseSensitivity) const { // One could do this dynamically, counting the number of *'s, // but then you have to free them at every exit of this // function, which is awkward and ugly. const int32 kWildCardMaximum = 100; - const char *pStorage[kWildCardMaximum]; - const char *sStorage[kWildCardMaximum]; + const char* pStorage[kWildCardMaximum]; + const char* sStorage[kWildCardMaximum]; int32 patternLevel = 0; - + if (string == NULL || pattern == NULL) return false; - - while (*pattern != '\0') { + while (*pattern != '\0') { switch (*pattern) { - case '?': pattern++; string++; if (IsInsideGlyph(string[0])) string = MoveToEndOfGlyph(string); + break; case '*': - { - // Collapse any ** and *? constructions: - while (*pattern == '*' || *pattern == '?') { - pattern++; - if (*pattern == '?' && string != '\0') { - string++; - if (IsInsideGlyph(string[0])) - string = MoveToEndOfGlyph(string); - } - } - - if (*pattern == '\0') - // An ending * matches all strings. - return true; - - bool match = false; - const char *pBefore = pattern - 1; - - if (*pattern == '[') { - pattern++; - - while (!match && *string != '\0') - match = MatchesBracketExpression(string++, pattern, caseSensitivity); - - // Skip the rest of the bracket: - while (*pattern != ']' && *pattern != '\0') - pattern++; - - // Failure if no closing bracket; - if (*pattern == '\0') - return false; - - } - else { - // No bracket, just one character: - while (!match && *string != '\0') { - if (IsGlyph(string[0])) - match = UTF8CharsAreEqual(string++, pattern); - else - match = CharsAreEqual(*string++, *pattern, caseSensitivity); - } - } - if (!match) - return false; - else { - pStorage[patternLevel] = pBefore; + { + // Collapse any ** and *? constructions: + while (*pattern == '*' || *pattern == '?') { + pattern++; + if (*pattern == '?' && string != '\0') { + string++; if (IsInsideGlyph(string[0])) string = MoveToEndOfGlyph(string); - sStorage[patternLevel++] = string; - if (patternLevel > kWildCardMaximum) - return false; - pattern++; - if (IsInsideGlyph(pattern[0])) - pattern = MoveToEndOfGlyph(pattern); } } - break; + + if (*pattern == '\0') { + // An ending * matches all strings. + return true; + } + + bool match = false; + const char* pBefore = pattern - 1; + + if (*pattern == '[') { + pattern++; + + while (!match && *string != '\0') { + match = MatchesBracketExpression(string++, pattern, + caseSensitivity); + } + + while (*pattern != ']' && *pattern != '\0') { + // Skip the rest of the bracket: + pattern++; + } + + if (*pattern == '\0') { + // Failure if no closing bracket; + return false; + } + } else { + // No bracket, just one character: + while (!match && *string != '\0') { + if (IsGlyph(string[0])) + match = UTF8CharsAreEqual(string++, pattern); + else { + match = CharsAreEqual(*string++, *pattern, + caseSensitivity); + } + } + } + + if (!match) + return false; + else { + pStorage[patternLevel] = pBefore; + if (IsInsideGlyph(string[0])) + string = MoveToEndOfGlyph(string); + + sStorage[patternLevel++] = string; + if (patternLevel > kWildCardMaximum) + return false; + + pattern++; + if (IsInsideGlyph(pattern[0])) + pattern = MoveToEndOfGlyph(pattern); + } + break; + } case '[': pattern++; - - if (!MatchesBracketExpression(string, pattern, caseSensitivity)) + + if (!MatchesBracketExpression(string, pattern, caseSensitivity)) { if (patternLevel > 0) { pattern = pStorage[--patternLevel]; string = sStorage[patternLevel]; } else return false; - else { - + } else { // Skip the rest of the bracket: while (*pattern != ']' && *pattern != '\0') pattern++; @@ -587,78 +593,78 @@ TrackerString::StringMatchesPattern(const char *string, const char *pattern, // Failure if no closing bracket; if (*pattern == '\0') return false; - + string++; if (IsInsideGlyph(string[0])) string = MoveToEndOfGlyph(string); pattern++; } break; - + default: - { - bool equal = false; - if (IsGlyph(string[0])) - equal = UTF8CharsAreEqual(string, pattern); - else - equal = CharsAreEqual(*string, *pattern, caseSensitivity); - - if (equal) { - pattern++; - if (IsInsideGlyph(pattern[0])) - pattern = MoveToEndOfGlyph(pattern); - string++; - if (IsInsideGlyph(string[0])) - string = MoveToEndOfGlyph(string); - } else if (patternLevel > 0) { - pattern = pStorage[--patternLevel]; - string = sStorage[patternLevel]; - } else - return false; - } - break; + { + bool equal = false; + if (IsGlyph(string[0])) + equal = UTF8CharsAreEqual(string, pattern); + else + equal = CharsAreEqual(*string, *pattern, caseSensitivity); + + if (equal) { + pattern++; + if (IsInsideGlyph(pattern[0])) + pattern = MoveToEndOfGlyph(pattern); + string++; + if (IsInsideGlyph(string[0])) + string = MoveToEndOfGlyph(string); + } else if (patternLevel > 0) { + pattern = pStorage[--patternLevel]; + string = sStorage[patternLevel]; + } else + return false; + + break; + } } - + if (*pattern == '\0' && *string != '\0' && patternLevel > 0) { pattern = pStorage[--patternLevel]; string = sStorage[patternLevel]; } } - + return *string == '\0' && *pattern == '\0'; } bool -TrackerString::UTF8CharsAreEqual(const char *string1, const char *string2) const +TrackerString::UTF8CharsAreEqual(const char* string1, const char* string2) const { - const char *s1 = string1; - const char *s2 = string2; - + const char* s1 = string1; + const char* s2 = string2; + if (IsStartOfGlyph(*s1) && *s1 == *s2) { s1++; s2++; - + while (IsInsideGlyph(*s1) && *s1 == *s2) { s1++; s2++; } - + return !IsInsideGlyph(*s1) && !IsInsideGlyph(*s2) && *(s1 - 1) == *(s2 - 1); - } else return false; } -const char * -TrackerString::MoveToEndOfGlyph(const char *string) const +const char* +TrackerString::MoveToEndOfGlyph(const char* string) const { - const char *ptr = string; - + const char* ptr = string; + while (IsInsideGlyph(*ptr)) ptr++; - + return ptr; } diff --git a/src/kits/tracker/TrackerString.h b/src/kits/tracker/TrackerString.h index ed32241ec2..b3df746064 100644 --- a/src/kits/tracker/TrackerString.h +++ b/src/kits/tracker/TrackerString.h @@ -31,10 +31,10 @@ 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. */ - #ifndef _TRACKER_STRING_H #define _TRACKER_STRING_H + #include #include @@ -42,6 +42,7 @@ All rights reserved. #include "RegExp.h" + namespace BPrivate { enum TrackerStringExpressionType { @@ -53,70 +54,73 @@ enum TrackerStringExpressionType { kRegexpMatch }; -class TrackerString : public BString + +class TrackerString : public BString { public: TrackerString(); - TrackerString(const char *); - TrackerString(const TrackerString &); - TrackerString(const char *, int32 maxLength); + TrackerString(const char*); + TrackerString(const TrackerString&); + TrackerString(const char*, int32 maxLength); ~TrackerString(); - - bool Matches(const char *, bool caseSensitivity = false, + + bool Matches(const char*, bool caseSensitivity = false, TrackerStringExpressionType expressionType = kGlobMatch) const; - bool MatchesRegExp(const char *, bool caseSensitivity = true) const; - bool MatchesRegExp(const RegExp &) const; - bool MatchesRegExp(const RegExp *) const; + bool MatchesRegExp(const char*, bool caseSensitivity = true) const; + bool MatchesRegExp(const RegExp&) const; + bool MatchesRegExp(const RegExp*) const; - bool MatchesGlob(const char *, bool caseSensitivity = false) const; - bool EndsWith(const char *, bool caseSensitivity = false) const; - bool StartsWith(const char *, bool caseSensitivity = false) const; - bool Contains(const char *, bool caseSensitivity = false) const; + bool MatchesGlob(const char*, bool caseSensitivity = false) const; + bool EndsWith(const char*, bool caseSensitivity = false) const; + bool StartsWith(const char*, bool caseSensitivity = false) const; + bool Contains(const char*, bool caseSensitivity = false) const; - int32 FindFirst(const BString &) const; - int32 FindFirst(const char *) const; - int32 FindFirst(const BString &, int32 fromOffset) const; - int32 FindFirst(const char *, int32 fromOffset) const; + int32 FindFirst(const BString&) const; + int32 FindFirst(const char*) const; + int32 FindFirst(const BString&, int32 fromOffset) const; + int32 FindFirst(const char*, int32 fromOffset) const; int32 FindFirst(char) const; int32 FindFirst(char, int32 fromOffset) const; - int32 FindLast(const BString &) const; - int32 FindLast(const char *) const; - int32 FindLast(const BString &, int32 beforeOffset) const; - int32 FindLast(const char *, int32 beforeOffset) const; + int32 FindLast(const BString&) const; + int32 FindLast(const char*) const; + int32 FindLast(const BString&, int32 beforeOffset) const; + int32 FindLast(const char*, int32 beforeOffset) const; int32 FindLast(char) const; int32 FindLast(char, int32 beforeOffset) const; - int32 IFindFirst(const BString &) const; - int32 IFindFirst(const char *) const; - int32 IFindFirst(const BString &, int32 fromOffset) const; - int32 IFindFirst(const char *, int32 fromOffset) const; + int32 IFindFirst(const BString&) const; + int32 IFindFirst(const char*) const; + int32 IFindFirst(const BString&, int32 fromOffset) const; + int32 IFindFirst(const char*, int32 fromOffset) const; - int32 IFindLast(const BString &) const; - int32 IFindLast(const char *) const; - int32 IFindLast(const BString &, int32 beforeOffset) const; - int32 IFindLast(const char *, int32 beforeOffset) const; + int32 IFindLast(const BString&) const; + int32 IFindLast(const char*) const; + int32 IFindLast(const BString&, int32 beforeOffset) const; + int32 IFindLast(const char*, int32 beforeOffset) const; private: bool IsGlyph(char) const; - bool IsInsideGlyph(char) const; // Not counting start! + bool IsInsideGlyph(char) const; + // Not counting start! bool IsStartOfGlyph(char) const; - const char *MoveToEndOfGlyph(const char *) const; + const char* MoveToEndOfGlyph(const char*) const; // Functions for Glob matching: - bool MatchesBracketExpression(const char *string, const char *pattern, + bool MatchesBracketExpression(const char* string, const char* pattern, bool caseSensitivity) const; - bool StringMatchesPattern(const char *string, const char *pattern, + bool StringMatchesPattern(const char* string, const char* pattern, bool caseSensitivity) const; char ConditionalToLower(char c, bool toLower) const; - bool CharsAreEqual(char char1, char char2, bool toLower) const; - bool UTF8CharsAreEqual(const char *string1, const char *string2) const; + bool CharsAreEqual(char char1, char char2, bool toLower) const; + bool UTF8CharsAreEqual(const char* string1, const char* string2) const; }; + inline bool -TrackerString::MatchesRegExp(const RegExp *expression) const +TrackerString::MatchesRegExp(const RegExp* expression) const { if (expression == NULL || expression->InitCheck() != B_OK) return false; @@ -124,30 +128,33 @@ TrackerString::MatchesRegExp(const RegExp *expression) const return expression->Matches(*this); } + inline bool TrackerString::MatchesRegExp(const RegExp &expression) const { if (expression.InitCheck() != B_OK) return false; - return expression.Matches(*this); + return expression.Matches(*this); } + inline char TrackerString::ConditionalToLower(char c, bool caseSensitivity) const { return caseSensitivity ? c : (char)tolower(c); -} +} + inline bool TrackerString::CharsAreEqual(char char1, char char2, bool caseSensitivity) const { return ConditionalToLower(char1, caseSensitivity) == ConditionalToLower(char2, caseSensitivity); -} +} } // namespace BPrivate using namespace BPrivate; -#endif +#endif // _TRACKER_STRING_H diff --git a/src/kits/tracker/TrashWatcher.cpp b/src/kits/tracker/TrashWatcher.cpp index 145f1235b1..6decfe2290 100644 --- a/src/kits/tracker/TrashWatcher.cpp +++ b/src/kits/tracker/TrashWatcher.cpp @@ -70,11 +70,11 @@ BTrashWatcher::~BTrashWatcher() bool -BTrashWatcher::IsTrashNode(const node_ref *testNode) const +BTrashWatcher::IsTrashNode(const node_ref* testNode) const { int32 count = fTrashNodeList.CountItems(); for (int32 index = 0; index < count; index++) { - node_ref *nref = fTrashNodeList.ItemAt(index); + node_ref* nref = fTrashNodeList.ItemAt(index); if (nref->node == testNode->node && nref->device == testNode->device) return true; } @@ -84,7 +84,7 @@ BTrashWatcher::IsTrashNode(const node_ref *testNode) const void -BTrashWatcher::MessageReceived(BMessage *message) +BTrashWatcher::MessageReceived(BMessage* message) { if (message->what != B_NODE_MONITOR) { _inherited::MessageReceived(message); @@ -109,12 +109,8 @@ BTrashWatcher::MessageReceived(BMessage *message) message->FindInt64("to directory", &toDir); if (fromDir == toDir) break; - } - // fall thru - - case B_DEVICE_UNMOUNTED: - // fall thru - + } // fall thru + case B_DEVICE_UNMOUNTED: // fall thru case B_ENTRY_REMOVED: { bool full = CheckTrashDirs(); @@ -153,7 +149,7 @@ void BTrashWatcher::UpdateTrashIcons() { BVolumeRoster roster; - BVolume volume; + BVolume volume; roster.Rewind(); BDirectory trashDir; @@ -163,35 +159,35 @@ BTrashWatcher::UpdateTrashIcons() // apply them onto the trash directory node size_t largeSize = 0; size_t smallSize = 0; - const void *largeData = GetTrackerResources()->LoadResource('ICON', + const void* largeData = GetTrackerResources()->LoadResource('ICON', fTrashFull ? R_TrashFullIcon : R_TrashIcon, &largeSize); - - const void *smallData = GetTrackerResources()->LoadResource('MICN', + + const void* smallData = GetTrackerResources()->LoadResource('MICN', fTrashFull ? R_TrashFullIcon : R_TrashIcon, &smallSize); - + #ifdef HAIKU_TARGET_PLATFORM_HAIKU size_t vectorSize = 0; - const void *vectorData = GetTrackerResources()->LoadResource( + const void* vectorData = GetTrackerResources()->LoadResource( B_VECTOR_ICON_TYPE, fTrashFull ? R_TrashFullIcon : R_TrashIcon, &vectorSize); - if (vectorData) + if (vectorData) { trashDir.WriteAttr(kAttrIcon, B_VECTOR_ICON_TYPE, 0, vectorData, vectorSize); - else + } else TRESPASS(); #endif - - if (largeData) + + if (largeData) { trashDir.WriteAttr(kAttrLargeIcon, 'ICON', 0, largeData, largeSize); - else + } else TRESPASS(); - if (smallData) + if (smallData) { trashDir.WriteAttr(kAttrMiniIcon, 'MICN', 0, smallData, smallSize); - else + } else TRESPASS(); } } diff --git a/src/kits/tracker/TrashWatcher.h b/src/kits/tracker/TrashWatcher.h index d252eaea57..789666a9a4 100644 --- a/src/kits/tracker/TrashWatcher.h +++ b/src/kits/tracker/TrashWatcher.h @@ -31,13 +31,14 @@ 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. */ - -#ifndef _TRASH_WATCHER_H +#ifndef _TRASH_WATCHER_H #define _TRASH_WATCHER_H + #include #include "ObjectList.h" + namespace BPrivate { class BTrashWatcher : public BLooper { @@ -48,10 +49,10 @@ public: virtual ~BTrashWatcher(); bool CheckTrashDirs(); - bool IsTrashNode(const node_ref *) const; + bool IsTrashNode(const node_ref*) const; protected: - virtual void MessageReceived(BMessage *); + virtual void MessageReceived(BMessage*); private: void WatchTrashDirs(); @@ -67,4 +68,4 @@ private: using namespace BPrivate; -#endif +#endif // _TRASH_WATCHER_H diff --git a/src/kits/tracker/Utilities.cpp b/src/kits/tracker/Utilities.cpp index 4d37dc9e93..17020a289a 100644 --- a/src/kits/tracker/Utilities.cpp +++ b/src/kits/tracker/Utilities.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include "Attributes.h" #include "MimeTypes.h" #include "Model.h" @@ -71,7 +72,7 @@ extern _IMPEXP_BE const uint32 LARGE_ICON_TYPE; extern _IMPEXP_BE const uint32 MINI_ICON_TYPE; -FILE *logFile = NULL; +FILE* logFile = NULL; static const float kMinSeparatorStubX = 10; static const float kStubToStringSlotX = 5; @@ -86,7 +87,7 @@ bool gLocalizedNamePreferred; uint32 -HashString(const char *string, uint32 seed) +HashString(const char* string, uint32 seed) { char ch; uint32 result = seed; @@ -102,7 +103,7 @@ HashString(const char *string, uint32 seed) uint32 -AttrHashString(const char *string, uint32 type) +AttrHashString(const char* string, uint32 type) { char c; uint32 hash = 0; @@ -122,7 +123,7 @@ AttrHashString(const char *string, uint32 type) bool -ValidateStream(BMallocIO *stream, uint32 key, int32 version) +ValidateStream(BMallocIO* stream, uint32 key, int32 version) { uint32 testKey; int32 testVersion; @@ -136,14 +137,14 @@ ValidateStream(BMallocIO *stream, uint32 key, int32 version) void -DisallowFilenameKeys(BTextView *textView) +DisallowFilenameKeys(BTextView* textView) { textView->DisallowChar('/'); } void -DisallowMetaKeys(BTextView *textView) +DisallowMetaKeys(BTextView* textView) { textView->DisallowChar(B_TAB); textView->DisallowChar(B_ESCAPE); @@ -174,10 +175,10 @@ PeriodicUpdatePoses::~PeriodicUpdatePoses() void -PeriodicUpdatePoses::AddPose(BPose *pose, BPoseView *poseView, - PeriodicUpdateCallback callback, void *cookie) +PeriodicUpdatePoses::AddPose(BPose* pose, BPoseView* poseView, + PeriodicUpdateCallback callback, void* cookie) { - periodic_pose *periodic = new periodic_pose; + periodic_pose* periodic = new periodic_pose; periodic->pose = pose; periodic->pose_view = poseView; periodic->callback = callback; @@ -187,7 +188,7 @@ PeriodicUpdatePoses::AddPose(BPose *pose, BPoseView *poseView, bool -PeriodicUpdatePoses::RemovePose(BPose *pose, void **cookie) +PeriodicUpdatePoses::RemovePose(BPose* pose, void** cookie) { int32 count = fPoseList.CountItems(); for (int32 index = 0; index < count; index++) { @@ -195,7 +196,7 @@ PeriodicUpdatePoses::RemovePose(BPose *pose, void **cookie) if (!fLock->Lock()) return false; - periodic_pose *periodic = fPoseList.RemoveItemAt(index); + periodic_pose* periodic = fPoseList.RemoveItemAt(index); if (cookie) *cookie = periodic->cookie; delete periodic; @@ -216,7 +217,7 @@ PeriodicUpdatePoses::DoPeriodicUpdate(bool forceRedraw) int32 count = fPoseList.CountItems(); for (int32 index = 0; index < count; index++) { - periodic_pose *periodic = fPoseList.ItemAt(index); + periodic_pose* periodic = fPoseList.ItemAt(index); if (periodic->callback(periodic->pose, periodic->cookie) || forceRedraw) { periodic->pose_view->LockLooper(); @@ -236,9 +237,9 @@ PeriodicUpdatePoses gPeriodicUpdatePoses; void -PoseInfo::EndianSwap(void *castToThis) +PoseInfo::EndianSwap(void* castToThis) { - PoseInfo *self = (PoseInfo *)castToThis; + PoseInfo* self = (PoseInfo*)castToThis; PRINT(("swapping PoseInfo\n")); @@ -349,9 +350,9 @@ ExtendedPoseInfo::SetLocationForFrame(BPoint newLocation, BRect frame) void -ExtendedPoseInfo::EndianSwap(void *castToThis) +ExtendedPoseInfo::EndianSwap(void* castToThis) { - ExtendedPoseInfo *self = (ExtendedPoseInfo *)castToThis; + ExtendedPoseInfo* self = (ExtendedPoseInfo *)castToThis; PRINT(("swapping ExtendedPoseInfo\n")); @@ -412,7 +413,7 @@ OffscreenBitmap::NewBitmap(BRect bounds) delete fBitmap; fBitmap = new(std::nothrow) BBitmap(bounds, B_RGB32, true); if (fBitmap && fBitmap->Lock()) { - BView *view = new BView(fBitmap->Bounds(), "", B_FOLLOW_NONE, 0); + BView* view = new BView(fBitmap->Bounds(), "", B_FOLLOW_NONE, 0); fBitmap->AddChild(view); BRect clipRect = view->Bounds(); @@ -428,7 +429,7 @@ OffscreenBitmap::NewBitmap(BRect bounds) } -BView * +BView* OffscreenBitmap::BeginUsing(BRect frame) { if (!fBitmap || fBitmap->Bounds() != frame) @@ -446,7 +447,7 @@ OffscreenBitmap::DoneUsing() } -BBitmap * +BBitmap* OffscreenBitmap::Bitmap() const { ASSERT(fBitmap); @@ -455,7 +456,7 @@ OffscreenBitmap::Bitmap() const } -BView * +BView* OffscreenBitmap::View() const { ASSERT(fBitmap); @@ -468,12 +469,11 @@ OffscreenBitmap::View() const namespace BPrivate { -/*! Changes the alpha value of the given bitmap to create a nice - horizontal fade out in the specified region. - "from" is always transparent, "to" opaque. -*/ +// Changes the alpha value of the given bitmap to create a nice +// horizontal fade out in the specified region. +// "from" is always transparent, "to" opaque. void -FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, +FadeRGBA32Horizontal(uint32* bits, int32 width, int32 height, int32 from, int32 to) { // check parameters @@ -507,7 +507,7 @@ FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, "from" is always transparent, "to" opaque. */ void -FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, +FadeRGBA32Vertical(uint32* bits, int32 width, int32 height, int32 from, int32 to) { // check parameters @@ -545,8 +545,8 @@ FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, // #pragma mark - -DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType, - icon_size size, const BMessage *message, BMessenger target, +DraggableIcon::DraggableIcon(BRect rect, const char* name, const char* mimeType, + icon_size size, const BMessage* message, BMessenger target, uint32 resizeMask, uint32 flags) : BView(rect, name, resizeMask, flags), @@ -591,7 +591,7 @@ DraggableIcon::PreferredRect(BPoint offset, icon_size size) void DraggableIcon::AttachedToWindow() { - BView *parent = Parent(); + BView* parent = Parent(); if (parent != NULL) { SetViewColor(parent->ViewColor()); SetLowColor(parent->LowColor()); @@ -606,9 +606,9 @@ DraggableIcon::MouseDown(BPoint point) return; BRect rect(Bounds()); - BBitmap *dragBitmap = new BBitmap(rect, B_RGBA32, true); + BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true); dragBitmap->Lock(); - BView *view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0); + BView* view = new BView(dragBitmap->Bounds(), "", B_FOLLOW_NONE, 0); dragBitmap->AddChild(view); view->SetOrigin(0, 0); BRect clipRect(view->Bounds()); @@ -631,7 +631,7 @@ DraggableIcon::MouseDown(BPoint point) bool -DraggableIcon::DragStarted(BMessage *) +DraggableIcon::DragStarted(BMessage*) { return true; } @@ -649,8 +649,8 @@ DraggableIcon::Draw(BRect) // #pragma mark - -FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, - const char *text, uint32 resizeFlags, uint32 flags) +FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char* name, + const char* text, uint32 resizeFlags, uint32 flags) : BStringView(bounds, name, text, resizeFlags, flags), fBitmap(NULL), @@ -659,8 +659,8 @@ FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, } -FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, - const char *text, BBitmap *inBitmap, uint32 resizeFlags, uint32 flags) +FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char* name, + const char* text, BBitmap* inBitmap, uint32 resizeFlags, uint32 flags) : BStringView(bounds, name, text, resizeFlags, flags), fBitmap(NULL), @@ -682,7 +682,7 @@ FlickerFreeStringView::Draw(BRect) if (!fBitmap) fBitmap = new OffscreenBitmap(Bounds()); - BView *offscreen = fBitmap->BeginUsing(bounds); + BView* offscreen = fBitmap->BeginUsing(bounds); if (Parent()) { fViewColor = Parent()->ViewColor(); @@ -785,7 +785,7 @@ FlickerFreeStringView::SetLowColor(rgb_color color) // #pragma mark - -TitledSeparatorItem::TitledSeparatorItem(const char *label) +TitledSeparatorItem::TitledSeparatorItem(const char* label) : BMenuItem(label, 0) { @@ -806,7 +806,7 @@ TitledSeparatorItem::SetEnabled(bool) void -TitledSeparatorItem::GetContentSize(float *width, float *height) +TitledSeparatorItem::GetContentSize(float* width, float* height) { _inherited::GetContentSize(width, height); } @@ -824,7 +824,7 @@ TitledSeparatorItem::Draw() { BRect frame(Frame()); - BMenu *parent = Menu(); + BMenu* parent = Menu(); ASSERT(parent); menu_info minfo; @@ -918,7 +918,7 @@ TitledSeparatorItem::Draw() ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier, - uint32 shortcutWhat, BHandler *target) + uint32 shortcutWhat, BHandler* target) : BMessageFilter(B_KEY_DOWN), fShortcutKey(shortcutKey), @@ -930,7 +930,7 @@ ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier, filter_result -ShortcutFilter::Filter(BMessage *message, BHandler **) +ShortcutFilter::Filter(BMessage* message, BHandler**) { if (message->what == B_KEY_DOWN) { uint32 modifiers; @@ -938,9 +938,9 @@ ShortcutFilter::Filter(BMessage *message, BHandler **) uint8 byte = 0; int32 key = 0; - if (message->FindInt32("modifiers", (int32 *)&modifiers) != B_OK - || message->FindInt32("raw_char", (int32 *)&rawKeyChar) != B_OK - || message->FindInt8("byte", (int8 *)&byte) != B_OK + if (message->FindInt32("modifiers", (int32*)&modifiers) != B_OK + || message->FindInt32("raw_char", (int32*)&rawKeyChar) != B_OK + || message->FindInt8("byte", (int8*)&byte) != B_OK || message->FindInt32("key", &key) != B_OK) return B_DISPATCH_MESSAGE; @@ -966,7 +966,7 @@ namespace BPrivate { void -EmbedUniqueVolumeInfo(BMessage *message, const BVolume *volume) +EmbedUniqueVolumeInfo(BMessage* message, const BVolume* volume) { BDirectory rootDirectory; time_t created; @@ -985,7 +985,7 @@ EmbedUniqueVolumeInfo(BMessage *message, const BVolume *volume) status_t -MatchArchivedVolume(BVolume *result, const BMessage *message, int32 index) +MatchArchivedVolume(BVolume* result, const BMessage* message, int32 index) { time_t created; off_t capacity; @@ -1069,7 +1069,7 @@ MatchArchivedVolume(BVolume *result, const BMessage *message, int32 index) void -StringFromStream(BString *string, BMallocIO *stream, bool endianSwap) +StringFromStream(BString* string, BMallocIO* stream, bool endianSwap) { int32 length; stream->Read(&length, sizeof(length)); @@ -1083,14 +1083,14 @@ StringFromStream(BString *string, BMallocIO *stream, bool endianSwap) return; } - char *buffer = string->LockBuffer(length + 1); + char* buffer = string->LockBuffer(length + 1); stream->Read(buffer, (size_t)length + 1); string->UnlockBuffer(length); } void -StringToStream(const BString *string, BMallocIO *stream) +StringToStream(const BString* string, BMallocIO* stream) { int32 length = string->Length(); stream->Write(&length, sizeof(int32)); @@ -1099,14 +1099,14 @@ StringToStream(const BString *string, BMallocIO *stream) int32 -ArchiveSize(const BString *string) +ArchiveSize(const BString* string) { return string->Length() + 1 + (ssize_t)sizeof(int32); } int32 -CountRefs(const BMessage *message) +CountRefs(const BMessage* message) { uint32 type; int32 count; @@ -1116,9 +1116,9 @@ CountRefs(const BMessage *message) } -static entry_ref * -EachEntryRefCommon(BMessage *message, entry_ref *(*func)(entry_ref *, void *), - void *passThru, int32 maxCount) +static entry_ref* +EachEntryRefCommon(BMessage* message, entry_ref *(*func)(entry_ref*, void*), + void* passThru, int32 maxCount) { uint32 type; int32 count; @@ -1130,7 +1130,7 @@ EachEntryRefCommon(BMessage *message, entry_ref *(*func)(entry_ref *, void *), for (int32 index = 0; index < count; index++) { entry_ref ref; message->FindRef("refs", index, &ref); - entry_ref *result = (func)(&ref, passThru); + entry_ref* result = (func)(&ref, passThru); if (result) return result; } @@ -1140,7 +1140,7 @@ EachEntryRefCommon(BMessage *message, entry_ref *(*func)(entry_ref *, void *), bool -ContainsEntryRef(const BMessage *message, const entry_ref *ref) +ContainsEntryRef(const BMessage* message, const entry_ref* ref) { entry_ref match; for (int32 index = 0; (message->FindRef("refs", index, &match) == B_OK); @@ -1153,35 +1153,36 @@ ContainsEntryRef(const BMessage *message, const entry_ref *ref) } -entry_ref * -EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *), - void *passThru) +entry_ref* +EachEntryRef(BMessage* message, entry_ref* (*func)(entry_ref*, void*), + void* passThru) { return EachEntryRefCommon(message, func, passThru, -1); } typedef entry_ref *(*EachEntryIteratee)(entry_ref *, void *); -const entry_ref * -EachEntryRef(const BMessage *message, - const entry_ref *(*func)(const entry_ref *, void *), void *passThru) + +const entry_ref* +EachEntryRef(const BMessage* message, + const entry_ref* (*func)(const entry_ref*, void*), void* passThru) { - return EachEntryRefCommon(const_cast(message), + return EachEntryRefCommon(const_cast(message), (EachEntryIteratee)func, passThru, -1); } -entry_ref * -EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *), - void *passThru, int32 maxCount) +entry_ref* +EachEntryRef(BMessage* message, entry_ref* (*func)(entry_ref*, void*), + void* passThru, int32 maxCount) { return EachEntryRefCommon(message, func, passThru, maxCount); } const entry_ref * -EachEntryRef(const BMessage *message, - const entry_ref *(*func)(const entry_ref *, void *), void *passThru, +EachEntryRef(const BMessage* message, + const entry_ref *(*func)(const entry_ref *, void *), void* passThru, int32 maxCount) { return EachEntryRefCommon(const_cast(message), @@ -1190,7 +1191,7 @@ EachEntryRef(const BMessage *message, void -TruncateLeaf(BString *string) +TruncateLeaf(BString* string) { for (int32 index = string->Length(); index >= 0; index--) { if ((*string)[index] == '/') { @@ -1202,12 +1203,12 @@ TruncateLeaf(BString *string) int64 -StringToScalar(const char *text) +StringToScalar(const char* text) { - char *end; + char* end; int64 val; - char *buffer = new char [strlen(text) + 1]; + char* buffer = new char [strlen(text) + 1]; strcpy(buffer, text); if (strstr(buffer, "k") || strstr(buffer, "K")) { @@ -1248,7 +1249,7 @@ LineBounds(BPoint where, float length, bool vertical) SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, - const char *name) + const char* name) : BView(LineBounds(where, length, vertical), name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW) @@ -1280,11 +1281,11 @@ SeparatorLine::Draw(BRect) void -HexDump(const void *buf, int32 length) +HexDump(const void* buf, int32 length) { const int32 kBytesPerLine = 16; int32 offset; - unsigned char *buffer = (unsigned char *)buf; + unsigned char* buffer = (unsigned char*)buf; for (offset = 0; ; offset += kBytesPerLine, buffer += kBytesPerLine) { int32 remain = length; @@ -1318,53 +1319,53 @@ HexDump(const void *buf, int32 length) void -EnableNamedMenuItem(BMenu *menu, const char *itemName, bool on) +EnableNamedMenuItem(BMenu* menu, const char* itemName, bool on) { - BMenuItem *item = menu->FindItem(itemName); + BMenuItem* item = menu->FindItem(itemName); if (item) item->SetEnabled(on); } void -MarkNamedMenuItem(BMenu *menu, const char *itemName, bool on) +MarkNamedMenuItem(BMenu* menu, const char* itemName, bool on) { - BMenuItem *item = menu->FindItem(itemName); + BMenuItem* item = menu->FindItem(itemName); if (item) item->SetMarked(on); } void -EnableNamedMenuItem(BMenu *menu, uint32 commandName, bool on) +EnableNamedMenuItem(BMenu* menu, uint32 commandName, bool on) { - BMenuItem *item = menu->FindItem(commandName); + BMenuItem* item = menu->FindItem(commandName); if (item) item->SetEnabled(on); } void -MarkNamedMenuItem(BMenu *menu, uint32 commandName, bool on) +MarkNamedMenuItem(BMenu* menu, uint32 commandName, bool on) { - BMenuItem *item = menu->FindItem(commandName); + BMenuItem* item = menu->FindItem(commandName); if (item) item->SetMarked(on); } void -DeleteSubmenu(BMenuItem *submenuItem) +DeleteSubmenu(BMenuItem* submenuItem) { if (!submenuItem) return; - BMenu *menu = submenuItem->Submenu(); + BMenu* menu = submenuItem->Submenu(); if (!menu) return; for (;;) { - BMenuItem *item = menu->RemoveItem((int32)0); + BMenuItem* item = menu->RemoveItem((int32)0); if (!item) return; @@ -1374,7 +1375,7 @@ DeleteSubmenu(BMenuItem *submenuItem) status_t -GetAppSignatureFromAttr(BFile *file, char *result) +GetAppSignatureFromAttr(BFile* file, char* result) { // This call is a performance improvement that // avoids using the BAppFileInfo API when retrieving the @@ -1397,7 +1398,7 @@ GetAppSignatureFromAttr(BFile *file, char *result) status_t -GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size) +GetAppIconFromAttr(BFile* file, BBitmap* result, icon_size size) { // This call is a performance improvement that // avoids using the BAppFileInfo API when retrieving the @@ -1409,7 +1410,7 @@ GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size) return appFileInfo.GetIcon(result, size); //#else // -// const char *attrName = kAttrIcon; +// const char* attrName = kAttrIcon; // uint32 type = B_VECTOR_ICON_TYPE; // // // try vector icon @@ -1452,7 +1453,7 @@ GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size) status_t -GetFileIconFromAttr(BNode *file, BBitmap *result, icon_size size) +GetFileIconFromAttr(BNode* file, BBitmap* result, icon_size size) { BNodeInfo fileInfo(file); return fileInfo.GetIcon(result, size); @@ -1467,18 +1468,18 @@ PrintToStream(rgb_color color) } -extern BMenuItem * -EachMenuItem(BMenu *menu, bool recursive, BMenuItem *(*func)(BMenuItem *)) +extern BMenuItem* +EachMenuItem(BMenu* menu, bool recursive, BMenuItem* (*func)(BMenuItem *)) { int32 count = menu->CountItems(); for (int32 index = 0; index < count; index++) { - BMenuItem *item = menu->ItemAt(index); - BMenuItem *result = (func)(item); + BMenuItem* item = menu->ItemAt(index); + BMenuItem* result = (func)(item); if (result) return result; if (recursive) { - BMenu *submenu = menu->SubmenuAt(index); + BMenu* submenu = menu->SubmenuAt(index); if (submenu) return EachMenuItem(submenu, true, func); } @@ -1488,19 +1489,19 @@ EachMenuItem(BMenu *menu, bool recursive, BMenuItem *(*func)(BMenuItem *)) } -extern const BMenuItem * -EachMenuItem(const BMenu *menu, bool recursive, - BMenuItem *(*func)(const BMenuItem *)) +extern const BMenuItem* +EachMenuItem(const BMenu* menu, bool recursive, + BMenuItem* (*func)(const BMenuItem *)) { int32 count = menu->CountItems(); for (int32 index = 0; index < count; index++) { - BMenuItem *item = menu->ItemAt(index); - BMenuItem *result = (func)(item); + BMenuItem* item = menu->ItemAt(index); + BMenuItem* result = (func)(item); if (result) return result; if (recursive) { - BMenu *submenu = menu->SubmenuAt(index); + BMenu* submenu = menu->SubmenuAt(index); if (submenu) return EachMenuItem(submenu, true, func); } @@ -1510,15 +1511,15 @@ EachMenuItem(const BMenu *menu, bool recursive, } -PositionPassingMenuItem::PositionPassingMenuItem(const char *title, - BMessage *message, char shortcut, uint32 modifiers) +PositionPassingMenuItem::PositionPassingMenuItem(const char* title, + BMessage* message, char shortcut, uint32 modifiers) : BMenuItem(title, message, shortcut, modifiers) { } -PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu, BMessage *message) +PositionPassingMenuItem::PositionPassingMenuItem(BMenu* menu, BMessage* message) : BMenuItem(menu, message) { @@ -1526,7 +1527,7 @@ PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu, BMessage *message) status_t -PositionPassingMenuItem::Invoke(BMessage *message) +PositionPassingMenuItem::Invoke(BMessage* message) { if (!Menu()) return B_ERROR; @@ -1547,7 +1548,7 @@ PositionPassingMenuItem::Invoke(BMessage *message) // embed the invoke location of the menu so that we can create // a new folder, etc. on the spot - BMenu *menu = Menu(); + BMenu* menu = Menu(); for (;;) { if (!menu->Supermenu()) @@ -1557,7 +1558,7 @@ PositionPassingMenuItem::Invoke(BMessage *message) // use the window position only, if the item was invoked from the menu // menu->Window() points to the window the item was invoked from - if (dynamic_cast(menu->Window()) == NULL) { + if (dynamic_cast(menu->Window()) == NULL) { LooperAutoLocker lock(menu); if (lock.IsLocked()) { BPoint invokeOrigin(menu->Window()->Frame().LeftTop()); @@ -1572,13 +1573,13 @@ PositionPassingMenuItem::Invoke(BMessage *message) bool BootedInSafeMode() { - const char *safeMode = getenv("SAFEMODE"); + const char* safeMode = getenv("SAFEMODE"); return (safeMode && strcmp(safeMode, "yes") == 0); } float -ComputeTypeAheadScore(const char *text, const char *match, bool wordMode) +ComputeTypeAheadScore(const char* text, const char* match, bool wordMode) { // highest score: exact match const char* found = strcasestr(text, match); @@ -1627,7 +1628,7 @@ ComputeTypeAheadScore(const char *text, const char *match, bool wordMode) void -_ThrowOnError(status_t error, const char *DEBUG_ONLY(file), +_ThrowOnError(status_t error, const char* DEBUG_ONLY(file), int32 DEBUG_ONLY(line)) { if (error != B_OK) { @@ -1638,7 +1639,7 @@ _ThrowOnError(status_t error, const char *DEBUG_ONLY(file), void -_ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), +_ThrowIfNotSize(ssize_t size, const char* DEBUG_ONLY(file), int32 DEBUG_ONLY(line)) { if (size < B_OK) { @@ -1649,8 +1650,8 @@ _ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), void -_ThrowOnError(status_t error, const char *DEBUG_ONLY(debugString), - const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line)) +_ThrowOnError(status_t error, const char* DEBUG_ONLY(debugString), + const char* DEBUG_ONLY(file), int32 DEBUG_ONLY(line)) { if (error != B_OK) { PRINT(("failing %s, %s at %s:%d\n", debugString, strerror(error), file, @@ -1659,5 +1660,4 @@ _ThrowOnError(status_t error, const char *DEBUG_ONLY(debugString), } } - } // namespace BPrivate diff --git a/src/kits/tracker/Utilities.h b/src/kits/tracker/Utilities.h index 1a6a2dbb89..51ed40dd45 100644 --- a/src/kits/tracker/Utilities.h +++ b/src/kits/tracker/Utilities.h @@ -31,7 +31,6 @@ 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. */ - #ifndef _UTILITIES_H #define _UTILITIES_H @@ -104,23 +103,23 @@ class PeriodicUpdatePoses { PeriodicUpdatePoses(); ~PeriodicUpdatePoses(); - typedef bool (*PeriodicUpdateCallback)(BPose *pose, void *cookie); + typedef bool (*PeriodicUpdateCallback)(BPose* pose, void* cookie); - void AddPose(BPose *pose, BPoseView *poseView, - PeriodicUpdateCallback callback, void *cookie); - bool RemovePose(BPose *pose, void **cookie); + void AddPose(BPose* pose, BPoseView* poseView, + PeriodicUpdateCallback callback, void* cookie); + bool RemovePose(BPose* pose, void** cookie); void DoPeriodicUpdate(bool forceRedraw); private: struct periodic_pose { - BPose *pose; - BPoseView *pose_view; + BPose* pose; + BPoseView* pose_view; PeriodicUpdateCallback callback; - void *cookie; + void* cookie; }; - Benaphore *fLock; + Benaphore* fLock; BObjectList fPoseList; }; @@ -131,7 +130,7 @@ extern PeriodicUpdatePoses gPeriodicUpdatePoses; // disk, defining the node's position and visibility class PoseInfo { public: - static void EndianSwap(void *castToThis); + static void EndianSwap(void* castToThis); void PrintToStream(); bool fInvisible; @@ -158,7 +157,7 @@ class ExtendedPoseInfo { BPoint LocationForFrame(BRect) const; bool SetLocationForFrame(BPoint, BRect); - static void EndianSwap(void *castToThis); + static void EndianSwap(void* castToThis); void PrintToStream(); uint32 fWorkspaces; @@ -183,15 +182,15 @@ class ExtendedPoseInfo { }; // misc functions -void DisallowMetaKeys(BTextView *); -void DisallowFilenameKeys(BTextView *); +void DisallowMetaKeys(BTextView*); +void DisallowFilenameKeys(BTextView*); -bool ValidateStream(BMallocIO *, uint32, int32 version); +bool ValidateStream(BMallocIO*, uint32, int32 version); -uint32 HashString(const char *string, uint32 seed); -uint32 AttrHashString(const char *string, uint32 type); +uint32 HashString(const char* string, uint32 seed); +uint32 AttrHashString(const char* string, uint32 type); class OffscreenBitmap { @@ -201,33 +200,33 @@ class OffscreenBitmap { OffscreenBitmap(); ~OffscreenBitmap(); - BView *BeginUsing(BRect bounds); + BView* BeginUsing(BRect bounds); void DoneUsing(); - BBitmap *Bitmap() const; + BBitmap* Bitmap() const; // blit this to your view when you are done rendering - BView *View() const; + BView* View() const; // use this to render your image private: void NewBitmap(BRect frame); - BBitmap *fBitmap; + BBitmap* fBitmap; }; // bitmap functions -extern void FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, int32 to); -extern void FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to); +extern void FadeRGBA32Horizontal(uint32* bits, int32 width, int32 height, int32 from, int32 to); +extern void FadeRGBA32Vertical(uint32* bits, int32 width, int32 height, int32 from, int32 to); class FlickerFreeStringView : public BStringView { // Adds support for offscreen bitmap drawing for string views that update often // this would be better implemented as an option of BStringView public: - FlickerFreeStringView(BRect bounds, const char *name, - const char *text, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, + FlickerFreeStringView(BRect bounds, const char* name, + const char* text, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW); - FlickerFreeStringView(BRect bounds, const char *name, - const char *text, BBitmap *existingOffscreen, + FlickerFreeStringView(BRect bounds, const char* name, + const char* text, BBitmap* existingOffscreen, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW); virtual ~FlickerFreeStringView(); @@ -237,10 +236,10 @@ class FlickerFreeStringView : public BStringView { virtual void SetLowColor(rgb_color); private: - OffscreenBitmap *fBitmap; + OffscreenBitmap* fBitmap; rgb_color fViewColor; rgb_color fLowColor; - BBitmap *fOrigBitmap; + BBitmap* fOrigBitmap; typedef BStringView _inherited; }; @@ -249,8 +248,8 @@ class FlickerFreeStringView : public BStringView { class DraggableIcon : public BView { // used to determine a save location for a file public: - DraggableIcon(BRect, const char *, const char *mimeType, icon_size, - const BMessage *, BMessenger, + DraggableIcon(BRect, const char*, const char* mimeType, icon_size, + const BMessage*, BMessenger, uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW); virtual ~DraggableIcon(); @@ -263,10 +262,10 @@ class DraggableIcon : public BView { virtual void MouseDown(BPoint); virtual void Draw(BRect); - virtual bool DragStarted(BMessage *dragMessage); + virtual bool DragStarted(BMessage* dragMessage); protected: - BBitmap *fBitmap; + BBitmap* fBitmap; BMessage fMessage; BMessenger fTarget; }; @@ -274,13 +273,13 @@ class DraggableIcon : public BView { class PositionPassingMenuItem : public BMenuItem { public: - PositionPassingMenuItem(const char *title, BMessage *, char shortcut = 0, + PositionPassingMenuItem(const char* title, BMessage*, char shortcut = 0, uint32 modifiers = 0); - PositionPassingMenuItem(BMenu *, BMessage *); + PositionPassingMenuItem(BMenu*, BMessage*); protected: - virtual status_t Invoke(BMessage * = 0); + virtual status_t Invoke(BMessage* = 0); // appends the invoke location for NewFolder, etc. to use private: @@ -291,7 +290,7 @@ class PositionPassingMenuItem : public BMenuItem { class Benaphore { // aka benaphore public: - Benaphore(const char *name = "Light Lock") + Benaphore(const char* name = "Light Lock") : fSemaphore(create_sem(0, name)), fCount(1) { @@ -329,21 +328,21 @@ class Benaphore { class SeparatorLine : public BView { public: - SeparatorLine(BPoint , float , bool vertical, const char *name = ""); - virtual void Draw(BRect bounds); + SeparatorLine(BPoint, float, bool vertical, const char* name = ""); + virtual void Draw(BRect bounds); }; class TitledSeparatorItem : public BMenuItem { public: - TitledSeparatorItem(const char *); + TitledSeparatorItem(const char*); virtual ~TitledSeparatorItem(); virtual void SetEnabled(bool state); protected: - virtual void GetContentSize(float *width, float *height); - virtual void Draw(); + virtual void GetContentSize(float* width, float* height); + virtual void Draw(); private: typedef BMenuItem _inherited; @@ -352,7 +351,7 @@ class TitledSeparatorItem : public BMenuItem { class LooperAutoLocker { public: - LooperAutoLocker(BHandler *handler) + LooperAutoLocker(BHandler* handler) : fHandler(handler), fHasLock(handler->LockLooper()) { @@ -375,7 +374,7 @@ class LooperAutoLocker { } private: - BHandler *fHandler; + BHandler* fHandler; bool fHasLock; }; @@ -383,10 +382,10 @@ class LooperAutoLocker { class MessengerAutoLocker { // move this into AutoLock.h public: - MessengerAutoLocker(BMessenger *messenger) + MessengerAutoLocker(BMessenger* messenger) : fMessenger(messenger), fHasLock(messenger->LockTarget()) - { } + {} ~MessengerAutoLocker() { @@ -406,7 +405,7 @@ class MessengerAutoLocker { void Unlock() { if (fHasLock) { - BLooper *looper; + BLooper* looper; fMessenger->Target(&looper); if (looper) looper->Unlock(); @@ -415,7 +414,7 @@ class MessengerAutoLocker { } private: - BMessenger *fMessenger; + BMessenger* fMessenger; bool fHasLock; }; @@ -423,54 +422,54 @@ class MessengerAutoLocker { class ShortcutFilter : public BMessageFilter { public: ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier, - uint32 shortcutWhat, BHandler *target); + uint32 shortcutWhat, BHandler* target); protected: - filter_result Filter(BMessage *, BHandler **); + filter_result Filter(BMessage*, BHandler**); private: uint32 fShortcutKey; uint32 fShortcutModifier; uint32 fShortcutWhat; - BHandler *fTarget; + BHandler* fTarget; }; // iterates over all the refs in a message -entry_ref *EachEntryRef(BMessage *, entry_ref *(*)(entry_ref *, void *), - void *passThru = 0); -const entry_ref *EachEntryRef(const BMessage *, - const entry_ref *(*)(const entry_ref *, void *), void *passThru = 0); +entry_ref* EachEntryRef(BMessage*, entry_ref* (*)(entry_ref*, void*), + void* passThru = 0); +const entry_ref* EachEntryRef(const BMessage*, + const entry_ref* (*)(const entry_ref*, void*), void* passThru = 0); -entry_ref *EachEntryRef(BMessage *, entry_ref *(*)(entry_ref *, void *), - void *passThru, int32 maxCount); -const entry_ref *EachEntryRef(const BMessage *, - const entry_ref *(*)(const entry_ref *, void *), void *passThru, int32 maxCount); +entry_ref* EachEntryRef(BMessage*, entry_ref* (*)(entry_ref*, void*), + void* passThru, int32 maxCount); +const entry_ref* EachEntryRef(const BMessage*, + const entry_ref* (*)(const entry_ref*, void*), void* passThru, int32 maxCount); -bool ContainsEntryRef(const BMessage *, const entry_ref *); -int32 CountRefs(const BMessage *); +bool ContainsEntryRef(const BMessage*, const entry_ref*); +int32 CountRefs(const BMessage*); -BMenuItem *EachMenuItem(BMenu *menu, bool recursive, BMenuItem *(*func)(BMenuItem *)); -const BMenuItem *EachMenuItem(const BMenu *menu, bool recursive, - BMenuItem *(*func)(const BMenuItem *)); +BMenuItem* EachMenuItem(BMenu* menu, bool recursive, BMenuItem* (*func)(BMenuItem*)); +const BMenuItem* EachMenuItem(const BMenu* menu, bool recursive, + BMenuItem* (*func)(const BMenuItem*)); -int64 StringToScalar(const char *text); +int64 StringToScalar(const char* text); // string to num, understands kB, MB, etc. // misc calls -void EmbedUniqueVolumeInfo(BMessage *, const BVolume *); -status_t MatchArchivedVolume(BVolume *, const BMessage *, int32 index = 0); -void TruncateLeaf(BString *string); +void EmbedUniqueVolumeInfo(BMessage*, const BVolume*); +status_t MatchArchivedVolume(BVolume*, const BMessage*, int32 index = 0); +void TruncateLeaf(BString* string); -void StringFromStream(BString *, BMallocIO *, bool endianSwap = false); -void StringToStream(const BString *, BMallocIO *); -int32 ArchiveSize(const BString *); +void StringFromStream(BString*, BMallocIO*, bool endianSwap = false); +void StringToStream(const BString*, BMallocIO*); +int32 ArchiveSize(const BString*); -extern void EnableNamedMenuItem(BMenu *menu, const char *itemName, bool on); -extern void MarkNamedMenuItem(BMenu *menu, const char *itemName, bool on); -extern void EnableNamedMenuItem(BMenu *menu, uint32 commandName, bool on); -extern void MarkNamedMenuItem(BMenu *menu, uint32 commandName, bool on); -extern void DeleteSubmenu(BMenuItem *submenuItem); +extern void EnableNamedMenuItem(BMenu* menu, const char* itemName, bool on); +extern void MarkNamedMenuItem(BMenu* menu, const char* itemName, bool on); +extern void EnableNamedMenuItem(BMenu* menu, uint32 commandName, bool on); +extern void MarkNamedMenuItem(BMenu* menu, uint32 commandName, bool on); +extern void DeleteSubmenu(BMenuItem* submenuItem); extern bool BootedInSafeMode(); @@ -478,8 +477,8 @@ extern bool BootedInSafeMode(); #if B_BEOS_VERSION <= B_BEOS_VERSION_MAUI && !defined(__HAIKU__) // Should be in kits -bool operator==(const rgb_color &, const rgb_color &); -bool operator!=(const rgb_color &, const rgb_color &); +bool operator==(const rgb_color&, const rgb_color&); +bool operator!=(const rgb_color&, const rgb_color&); #endif @@ -499,10 +498,11 @@ void PrintToStream(rgb_color color); template void -ThrowOnInitCheckError(InitCheckable *item) +ThrowOnInitCheckError(InitCheckable* item) { if (!item) throw (status_t)B_ERROR; + status_t error = item->InitCheck(); if (error != B_OK) throw (status_t)error; @@ -518,52 +518,57 @@ ThrowOnInitCheckError(InitCheckable *item) #define ThrowOnErrorWithMessage(error, debugStr) _ThrowOnError(error, debugStr, __FILE__, __LINE__) #endif -void _ThrowOnError(status_t, const char *, int32); -void _ThrowIfNotSize(ssize_t, const char *, int32); -void _ThrowOnError(status_t, const char *debugStr, const char *, int32); +void _ThrowOnError(status_t, const char*, int32); +void _ThrowIfNotSize(ssize_t, const char*, int32); +void _ThrowOnError(status_t, const char* debugStr, const char*, int32); // stub calls that work around BAppFile info inefficiency -status_t GetAppSignatureFromAttr(BFile *, char *); -status_t GetAppIconFromAttr(BFile *, BBitmap *, icon_size); -status_t GetFileIconFromAttr(BNode *, BBitmap *, icon_size); +status_t GetAppSignatureFromAttr(BFile*, char*); +status_t GetAppIconFromAttr(BFile*, BBitmap*, icon_size); +status_t GetFileIconFromAttr(BNode*, BBitmap*, icon_size); // debugging -void HexDump(const void *buffer, int32 length); +void HexDump(const void* buffer, int32 length); #if xDEBUG inline void -PrintRefToStream(const entry_ref *ref, const char *trailer = "\n") +PrintRefToStream(const entry_ref* ref, const char* trailer = "\n") { - if (!ref) { + if (ref == NULL) { PRINT(("NULL entry_ref%s", trailer)); return; } + BPath path; BEntry entry(ref); entry.GetPath(&path); PRINT(("%s%s", path.Path(), trailer)); } + inline void -PrintEntryToStream(const BEntry *entry, const char *trailer = "\n") +PrintEntryToStream(const BEntry* entry, const char* trailer = "\n") { - if (!entry) { + if (entry == NULL) { PRINT(("NULL entry%s", trailer)); return; } + BPath path; entry->GetPath(&path); PRINT(("%s%s", path.Path(), trailer)); } + inline void -PrintDirToStream(const BDirectory *dir, const char *trailer = "\n") +PrintDirToStream(const BDirectory* dir, const char* trailer = "\n") { - if (!dir) { + if (dir == NULL) { PRINT(("NULL entry_ref%s", trailer)); return; } + BPath path; BEntry entry; dir->GetEntry(&entry); @@ -573,20 +578,20 @@ PrintDirToStream(const BDirectory *dir, const char *trailer = "\n") #else -inline void PrintRefToStream(const entry_ref *, const char * = 0) {} -inline void PrintEntryToStream(const BEntry *, const char * = 0) {} -inline void PrintDirToStream(const BDirectory *, const char * = 0) {} +inline void PrintRefToStream(const entry_ref*, const char* = 0) {} +inline void PrintEntryToStream(const BEntry*, const char* = 0) {} +inline void PrintDirToStream(const BDirectory*, const char* = 0) {} #endif #ifdef xDEBUG - extern FILE *logFile; + extern FILE* logFile; - inline void PrintToLogFile(const char *fmt, ...) + inline void PrintToLogFile(const char* format, ...) { - va_list ap; - va_start(ap, fmt); + va_list ap; + va_start(ap, fmt); vfprintf(logFile, fmt, ap); va_end(ap); } @@ -606,7 +611,7 @@ inline void PrintDirToStream(const BDirectory *, const char * = 0) {} #else - #define WRITELOG(_ARGS_) +#define WRITELOG(_ARGS_) #endif @@ -621,14 +626,16 @@ inline NewType assert_cast(OldType castedPointer) { // B_SWAP_INT32 have broken signedness, simple cover calls to fix that // should fix up in ByteOrder.h -inline int32 SwapInt32(int32 value) { return (int32)B_SWAP_INT32((uint32)value); } +inline int32 SwapInt32(int32 value) + { return (int32)B_SWAP_INT32((uint32)value); } inline uint32 SwapUInt32(uint32 value) { return B_SWAP_INT32(value); } -inline int64 SwapInt64(int64 value) { return (int64)B_SWAP_INT64((uint64)value); } +inline int64 SwapInt64(int64 value) + { return (int64)B_SWAP_INT64((uint64)value); } inline uint64 SwapUInt64(uint64 value) { return B_SWAP_INT64(value); } extern const float kExactMatchScore; -float ComputeTypeAheadScore(const char *text, const char *match, +float ComputeTypeAheadScore(const char* text, const char* match, bool wordMode = false); } // namespace BPrivate diff --git a/src/kits/tracker/ViewState.cpp b/src/kits/tracker/ViewState.cpp index 20fc4d5aae..ae80f1cbcf 100644 --- a/src/kits/tracker/ViewState.cpp +++ b/src/kits/tracker/ViewState.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include @@ -47,38 +48,38 @@ All rights reserved. #include -const char *kColumnVersionName = "BColumn:version"; -const char *kColumnTitleName = "BColumn:fTitle"; -const char *kColumnOffsetName = "BColumn:fOffset"; -const char *kColumnWidthName = "BColumn:fWidth"; -const char *kColumnAlignmentName = "BColumn:fAlignment"; -const char *kColumnAttrName = "BColumn:fAttrName"; -const char *kColumnAttrHashName = "BColumn:fAttrHash"; -const char *kColumnAttrTypeName = "BColumn:fAttrType"; -const char *kColumnDisplayAsName = "BColumn:fDisplayAs"; -const char *kColumnStatFieldName = "BColumn:fStatField"; -const char *kColumnEditableName = "BColumn:fEditable"; +const char* kColumnVersionName = "BColumn:version"; +const char* kColumnTitleName = "BColumn:fTitle"; +const char* kColumnOffsetName = "BColumn:fOffset"; +const char* kColumnWidthName = "BColumn:fWidth"; +const char* kColumnAlignmentName = "BColumn:fAlignment"; +const char* kColumnAttrName = "BColumn:fAttrName"; +const char* kColumnAttrHashName = "BColumn:fAttrHash"; +const char* kColumnAttrTypeName = "BColumn:fAttrType"; +const char* kColumnDisplayAsName = "BColumn:fDisplayAs"; +const char* kColumnStatFieldName = "BColumn:fStatField"; +const char* kColumnEditableName = "BColumn:fEditable"; -const char *kViewStateVersionName = "ViewState:version"; -const char *kViewStateViewModeName = "ViewState:fViewMode"; -const char *kViewStateLastIconModeName = "ViewState:fLastIconMode"; -const char *kViewStateListOriginName = "ViewState:fListOrigin"; -const char *kViewStateIconOriginName = "ViewState:fIconOrigin"; -const char *kViewStatePrimarySortAttrName = "ViewState:fPrimarySortAttr"; -const char *kViewStatePrimarySortTypeName = "ViewState:fPrimarySortType"; -const char *kViewStateSecondarySortAttrName = "ViewState:fSecondarySortAttr"; -const char *kViewStateSecondarySortTypeName = "ViewState:fSecondarySortType"; -const char *kViewStateReverseSortName = "ViewState:fReverseSort"; -const char *kViewStateIconSizeName = "ViewState:fIconSize"; -const char *kViewStateLastIconSizeName = "ViewState:fLastIconSize"; +const char* kViewStateVersionName = "ViewState:version"; +const char* kViewStateViewModeName = "ViewState:fViewMode"; +const char* kViewStateLastIconModeName = "ViewState:fLastIconMode"; +const char* kViewStateListOriginName = "ViewState:fListOrigin"; +const char* kViewStateIconOriginName = "ViewState:fIconOrigin"; +const char* kViewStatePrimarySortAttrName = "ViewState:fPrimarySortAttr"; +const char* kViewStatePrimarySortTypeName = "ViewState:fPrimarySortType"; +const char* kViewStateSecondarySortAttrName = "ViewState:fSecondarySortAttr"; +const char* kViewStateSecondarySortTypeName = "ViewState:fSecondarySortType"; +const char* kViewStateReverseSortName = "ViewState:fReverseSort"; +const char* kViewStateIconSizeName = "ViewState:fIconSize"; +const char* kViewStateLastIconSizeName = "ViewState:fLastIconSize"; static const int32 kColumnStateMinArchiveVersion = 21; // bump version when layout changes -BColumn::BColumn(const char *title, float offset, float width, - alignment align, const char *attributeName, uint32 attrType, +BColumn::BColumn(const char* title, float offset, float width, + alignment align, const char* attributeName, uint32 attrType, const char* displayAs, bool statField, bool editable) { _Init(title, offset, width, align, attributeName, attrType, displayAs, @@ -86,8 +87,8 @@ BColumn::BColumn(const char *title, float offset, float width, } -BColumn::BColumn(const char *title, float offset, float width, - alignment align, const char *attributeName, uint32 attrType, +BColumn::BColumn(const char* title, float offset, float width, + alignment align, const char* attributeName, uint32 attrType, bool statField, bool editable) { _Init(title, offset, width, align, attributeName, attrType, NULL, @@ -100,7 +101,7 @@ BColumn::~BColumn() } -BColumn::BColumn(BMallocIO *stream, int32 version, bool endianSwap) +BColumn::BColumn(BMallocIO* stream, int32 version, bool endianSwap) { StringFromStream(&fTitle, stream, endianSwap); stream->Read(&fOffset, sizeof(float)); @@ -131,10 +132,10 @@ BColumn::BColumn(const BMessage &message, int32 index) message.FindString(kColumnTitleName, index, &fTitle); message.FindFloat(kColumnOffsetName, index, &fOffset); message.FindFloat(kColumnWidthName, index, &fWidth); - message.FindInt32(kColumnAlignmentName, index, (int32 *)&fAlignment); + message.FindInt32(kColumnAlignmentName, index, (int32*)&fAlignment); message.FindString(kColumnAttrName, index, &fAttrName); - message.FindInt32(kColumnAttrHashName, index, (int32 *)&fAttrHash); - message.FindInt32(kColumnAttrTypeName, index, (int32 *)&fAttrType); + message.FindInt32(kColumnAttrHashName, index, (int32*)&fAttrHash); + message.FindInt32(kColumnAttrTypeName, index, (int32*)&fAttrType); message.FindString(kColumnDisplayAsName, index, &fDisplayAs); message.FindBool(kColumnStatFieldName, index, &fStatField); message.FindBool(kColumnEditableName, index, &fEditable); @@ -142,8 +143,8 @@ BColumn::BColumn(const BMessage &message, int32 index) void -BColumn::_Init(const char *title, float offset, float width, - alignment align, const char *attributeName, uint32 attrType, +BColumn::_Init(const char* title, float offset, float width, + alignment align, const char* attributeName, uint32 attrType, const char* displayAs, bool statField, bool editable) { fTitle = title; @@ -159,8 +160,8 @@ BColumn::_Init(const char *title, float offset, float width, } -BColumn * -BColumn::InstantiateFromStream(BMallocIO *stream, bool endianSwap) +BColumn* +BColumn::InstantiateFromStream(BMallocIO* stream, bool endianSwap) { // compare stream header in canonical form @@ -185,7 +186,7 @@ BColumn::InstantiateFromStream(BMallocIO *stream, bool endianSwap) } -BColumn * +BColumn* BColumn::InstantiateFromMessage(const BMessage &message, int32 index) { int32 version = kColumnStateArchiveVersion; @@ -202,7 +203,7 @@ BColumn::InstantiateFromMessage(const BMessage &message, int32 index) void -BColumn::ArchiveToStream(BMallocIO *stream) const +BColumn::ArchiveToStream(BMallocIO* stream) const { // write class identifier and version info uint32 key = AttrHashString("BColumn", B_OBJECT_TYPE); @@ -245,7 +246,7 @@ BColumn::ArchiveToMessage(BMessage &message) const BColumn * -BColumn::_Sanitize(BColumn *column) +BColumn::_Sanitize(BColumn* column) { if (column == NULL) return NULL; @@ -283,7 +284,7 @@ BViewState::BViewState() } -BViewState::BViewState(BMallocIO *stream, bool endianSwap) +BViewState::BViewState(BMallocIO* stream, bool endianSwap) { _Init(); stream->Read(&fViewMode, sizeof(uint32)); @@ -322,20 +323,20 @@ BViewState::BViewState(BMallocIO *stream, bool endianSwap) BViewState::BViewState(const BMessage &message) { _Init(); - message.FindInt32(kViewStateViewModeName, (int32 *)&fViewMode); - message.FindInt32(kViewStateLastIconModeName, (int32 *)&fLastIconMode); - message.FindInt32(kViewStateLastIconSizeName,(int32 *)&fLastIconSize); - message.FindInt32(kViewStateIconSizeName, (int32 *)&fIconSize); + message.FindInt32(kViewStateViewModeName, (int32*)&fViewMode); + message.FindInt32(kViewStateLastIconModeName, (int32*)&fLastIconMode); + message.FindInt32(kViewStateLastIconSizeName,(int32*)&fLastIconSize); + message.FindInt32(kViewStateIconSizeName, (int32*)&fIconSize); message.FindPoint(kViewStateListOriginName, &fListOrigin); message.FindPoint(kViewStateIconOriginName, &fIconOrigin); message.FindInt32(kViewStatePrimarySortAttrName, - (int32 *)&fPrimarySortAttr); + (int32*)&fPrimarySortAttr); message.FindInt32(kViewStatePrimarySortTypeName, - (int32 *)&fPrimarySortType); + (int32*)&fPrimarySortType); message.FindInt32(kViewStateSecondarySortAttrName, - (int32 *)&fSecondarySortAttr); + (int32*)&fSecondarySortAttr); message.FindInt32(kViewStateSecondarySortTypeName, - (int32 *)&fSecondarySortType); + (int32*)&fSecondarySortType); message.FindBool(kViewStateReverseSortName, &fReverseSort); _StorePreviousState(); @@ -344,7 +345,7 @@ BViewState::BViewState(const BMessage &message) void -BViewState::ArchiveToStream(BMallocIO *stream) const +BViewState::ArchiveToStream(BMallocIO* stream) const { // write class identifier and verison info uint32 key = AttrHashString("BViewState", B_OBJECT_TYPE); @@ -391,8 +392,8 @@ BViewState::ArchiveToMessage(BMessage &message) const } -BViewState * -BViewState::InstantiateFromStream(BMallocIO *stream, bool endianSwap) +BViewState* +BViewState::InstantiateFromStream(BMallocIO* stream, bool endianSwap) { // compare stream header in canonical form uint32 key = AttrHashString("BViewState", B_OBJECT_TYPE); @@ -410,7 +411,7 @@ BViewState::InstantiateFromStream(BMallocIO *stream, bool endianSwap) } -BViewState * +BViewState* BViewState::InstantiateFromMessage(const BMessage &message) { int32 version = kViewStateArchiveVersion; @@ -460,8 +461,8 @@ BViewState::_StorePreviousState() } -BViewState * -BViewState::_Sanitize(BViewState *state, bool fixOnly) +BViewState* +BViewState::_Sanitize(BViewState* state, bool fixOnly) { if (state == NULL) return NULL; @@ -508,4 +509,3 @@ BViewState::_Sanitize(BViewState *state, bool fixOnly) return state; } - diff --git a/src/kits/tracker/ViewState.h b/src/kits/tracker/ViewState.h index dbdfb65724..396438dd8d 100644 --- a/src/kits/tracker/ViewState.h +++ b/src/kits/tracker/ViewState.h @@ -46,21 +46,21 @@ const int32 kColumnStateArchiveVersion = 22; class BColumn { public: - BColumn(const char *title, float offset, float width, - alignment align, const char *attributeName, uint32 attrType, + BColumn(const char* title, float offset, float width, + alignment align, const char* attributeName, uint32 attrType, const char* displayAs, bool statField, bool editable); - BColumn(const char *title, float offset, float width, - alignment align, const char *attributeName, uint32 attrType, + BColumn(const char* title, float offset, float width, + alignment align, const char* attributeName, uint32 attrType, bool statField, bool editable); ~BColumn(); - BColumn(BMallocIO *stream, int32 version, bool endianSwap = false); + BColumn(BMallocIO* stream, int32 version, bool endianSwap = false); BColumn(const BMessage &, int32 index = 0); - static BColumn *InstantiateFromStream(BMallocIO *stream, + static BColumn* InstantiateFromStream(BMallocIO* stream, bool endianSwap = false); - static BColumn *InstantiateFromMessage(const BMessage &archive, + static BColumn* InstantiateFromMessage(const BMessage &archive, int32 index = 0); - void ArchiveToStream(BMallocIO *stream) const; + void ArchiveToStream(BMallocIO* stream) const; void ArchiveToMessage(BMessage &) const; const char* Title() const; @@ -78,8 +78,8 @@ class BColumn { void SetWidth(float); private: - void _Init(const char *title, float offset, float width, - alignment align, const char *attributeName, uint32 attrType, + void _Init(const char* title, float offset, float width, + alignment align, const char* attributeName, uint32 attrType, const char* displayAs, bool statField, bool editable); static BColumn* _Sanitize(BColumn* column); @@ -103,11 +103,11 @@ class BViewState { public: BViewState(); - BViewState(BMallocIO *stream, bool endianSwap = false); + BViewState(BMallocIO* stream, bool endianSwap = false); BViewState(const BMessage &message); - static BViewState *InstantiateFromStream(BMallocIO *stream, bool endianSwap = false); - static BViewState *InstantiateFromMessage(const BMessage &message); - void ArchiveToStream(BMallocIO *stream) const; + static BViewState* InstantiateFromStream(BMallocIO* stream, bool endianSwap = false); + static BViewState* InstantiateFromMessage(const BMessage &message); + void ArchiveToStream(BMallocIO* stream) const; void ArchiveToMessage(BMessage &message) const; uint32 ViewMode() const; @@ -137,38 +137,38 @@ class BViewState { bool StateNeedsSaving(); private: - static BViewState *_Sanitize(BViewState *state, bool fixOnly = false); + static BViewState* _Sanitize(BViewState* state, bool fixOnly = false); - uint32 fViewMode; - uint32 fLastIconMode; - uint32 fIconSize; - uint32 fLastIconSize; - BPoint fListOrigin; - BPoint fIconOrigin; - uint32 fPrimarySortAttr; - uint32 fSecondarySortAttr; - uint32 fPrimarySortType; - uint32 fSecondarySortType; - bool fReverseSort; + uint32 fViewMode; + uint32 fLastIconMode; + uint32 fIconSize; + uint32 fLastIconSize; + BPoint fListOrigin; + BPoint fIconOrigin; + uint32 fPrimarySortAttr; + uint32 fSecondarySortAttr; + uint32 fPrimarySortType; + uint32 fSecondarySortType; + bool fReverseSort; void _Init(); void _StorePreviousState(); - uint32 fPreviousViewMode; - uint32 fPreviousLastIconMode; - uint32 fPreviousIconSize; - uint32 fPreviousLastIconSize; - BPoint fPreviousListOrigin; - BPoint fPreviousIconOrigin; - uint32 fPreviousPrimarySortAttr; - uint32 fPreviousSecondarySortAttr; - uint32 fPreviousPrimarySortType; - uint32 fPreviousSecondarySortType; - bool fPreviousReverseSort; + uint32 fPreviousViewMode; + uint32 fPreviousLastIconMode; + uint32 fPreviousIconSize; + uint32 fPreviousLastIconSize; + BPoint fPreviousListOrigin; + BPoint fPreviousIconOrigin; + uint32 fPreviousPrimarySortAttr; + uint32 fPreviousSecondarySortAttr; + uint32 fPreviousPrimarySortType; + uint32 fPreviousSecondarySortType; + bool fPreviousReverseSort; }; -inline const char * +inline const char* BColumn::Title() const { return fTitle.String(); @@ -196,7 +196,7 @@ BColumn::Alignment() const } -inline const char * +inline const char* BColumn::AttrName() const { return fAttrName.String(); @@ -217,7 +217,7 @@ BColumn::AttrType() const } -inline const char * +inline const char* BColumn::DisplayAs() const { return fDisplayAs.String(); @@ -422,4 +422,4 @@ BViewState::StateNeedsSaving() using namespace BPrivate; -#endif +#endif // _VIEW_STATE_H diff --git a/src/kits/tracker/VolumeWindow.cpp b/src/kits/tracker/VolumeWindow.cpp index a43bc87148..453f21b6db 100644 --- a/src/kits/tracker/VolumeWindow.cpp +++ b/src/kits/tracker/VolumeWindow.cpp @@ -32,6 +32,7 @@ names are registered trademarks or trademarks of their respective holders. All rights reserved. */ + #include #include #include @@ -53,7 +54,7 @@ All rights reserved. #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "VolumeWindow" -BVolumeWindow::BVolumeWindow(LockingList *windowList, uint32 openFlags) +BVolumeWindow::BVolumeWindow(LockingList* windowList, uint32 openFlags) : BContainerWindow(windowList, openFlags) { } @@ -74,7 +75,7 @@ BVolumeWindow::MenusBeginning() int32 count = PoseView()->SelectionList()->CountItems(); for (int32 index = 0; index < count; index++) { - Model *model = PoseView()->SelectionList()->ItemAt(index)->TargetModel(); + Model* model = PoseView()->SelectionList()->ItemAt(index)->TargetModel(); if (model->IsVolume()) { BVolume volume; volume.SetTo(model->NodeRef()->device); @@ -92,7 +93,7 @@ BVolumeWindow::MenusBeginning() void -BVolumeWindow::AddFileMenu(BMenu *menu) +BVolumeWindow::AddFileMenu(BMenu* menu) { menu->AddItem(new BMenuItem(B_TRANSLATE("Find"B_UTF8_ELLIPSIS), new BMessage(kFindButton), 'F')); @@ -120,7 +121,7 @@ BVolumeWindow::AddFileMenu(BMenu *menu) void -BVolumeWindow::AddWindowContextMenus(BMenu *menu) +BVolumeWindow::AddWindowContextMenus(BMenu* menu) { if (fPoseView != NULL && fPoseView->TargetModel() != NULL && !fPoseView->TargetModel()->IsRoot()) { @@ -163,4 +164,3 @@ BVolumeWindow::AddWindowContextMenus(BMenu *menu) closeItem->SetTarget(this); resizeItem->SetTarget(this); } - diff --git a/src/kits/tracker/VolumeWindow.h b/src/kits/tracker/VolumeWindow.h index d8f683995b..53dc0117c2 100644 --- a/src/kits/tracker/VolumeWindow.h +++ b/src/kits/tracker/VolumeWindow.h @@ -31,24 +31,28 @@ 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. */ - -#ifndef _VOLUME_WINDOW_H +#ifndef _VOLUME_WINDOW_H #define _VOLUME_WINDOW_H + +// The volume window displays the virtual file system root with +// all mounted volumes. Does not show up unless the corresponding Tracker +// setting is enabled + + #include "ContainerWindow.h" + namespace BPrivate { class BVolumeWindow : public BContainerWindow { - // The volume window displays the virtual file system root with - // all mounted volumes. Does not show up unless the corresponding Tracker - // setting is enabled public: - BVolumeWindow(LockingList *windowList, uint32 containerWindowFlags); + BVolumeWindow(LockingList* windowList, + uint32 containerWindowFlags); protected: - virtual void AddFileMenu(BMenu *menu); - virtual void AddWindowContextMenus(BMenu *); + virtual void AddFileMenu(BMenu* menu); + virtual void AddWindowContextMenus(BMenu*); virtual void MenusBeginning(); @@ -60,4 +64,4 @@ class BVolumeWindow : public BContainerWindow { using namespace BPrivate; -#endif +#endif // _VOLUME_WINDOW_H diff --git a/src/kits/tracker/WidgetAttributeText.cpp b/src/kits/tracker/WidgetAttributeText.cpp index 6fd7df3e80..98e34c5dd4 100644 --- a/src/kits/tracker/WidgetAttributeText.cpp +++ b/src/kits/tracker/WidgetAttributeText.cpp @@ -2129,4 +2129,3 @@ VersionAttributeText::ReadValue(BString* result) } *result = "-"; } - diff --git a/src/kits/tracker/WidgetAttributeText.h b/src/kits/tracker/WidgetAttributeText.h index 1d85d7ddce..49c0518f72 100644 --- a/src/kits/tracker/WidgetAttributeText.h +++ b/src/kits/tracker/WidgetAttributeText.h @@ -31,14 +31,15 @@ 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. */ - #ifndef __TEXT_WIDGET_ATTRIBUTE__ #define __TEXT_WIDGET_ATTRIBUTE__ + #include #include "TrackerSettings.h" + namespace BPrivate { class Model; @@ -56,50 +57,50 @@ class WidgetAttributeText { // view // It is being asked for the string value by the TextWidget object public: - WidgetAttributeText(const Model *, const BColumn *); + WidgetAttributeText(const Model*, const BColumn*); virtual ~WidgetAttributeText(); virtual bool CheckAttributeChanged() = 0; // returns true if attribute value changed - bool CheckViewChanged(const BPoseView *); + bool CheckViewChanged(const BPoseView*); // returns true if fitted text changed, either because value // changed or because width/view changed virtual bool CheckSettingsChanged(); // override if the text rendering depends on a setting - const char *FittingText(const BPoseView *); + const char* FittingText(const BPoseView*); // returns text, recalculating if not yet calculated - virtual int Compare(WidgetAttributeText &, BPoseView *view) = 0; + virtual int Compare(WidgetAttributeText&, BPoseView* view) = 0; // override to define a compare of two different attributes for // sorting - static WidgetAttributeText *NewWidgetText(const Model *, const BColumn *, - const BPoseView *); + static WidgetAttributeText* NewWidgetText(const Model*, const BColumn*, + const BPoseView*); // WidgetAttributeText factory // call this to make the right WidgetAttributeText type for a // given column - float Width(const BPoseView *); + float Width(const BPoseView*); // respects the width of the corresponding column float CurrentWidth() const; // return the item width we got during our last fitting attempt - virtual void SetUpEditing(BTextView *); + virtual void SetUpEditing(BTextView*); // set up the passed textView for the specifics of a given // attribute editing - virtual bool CommitEditedText(BTextView *) = 0; + virtual bool CommitEditedText(BTextView*) = 0; // return true if attribute actually changed - virtual float PreferredWidth(const BPoseView *) const = 0; + virtual float PreferredWidth(const BPoseView*) const = 0; - static status_t AttrAsString(const Model *model, BString *result, - const char *attrName, int32 attrType, float width, - BView *view, int64 *value = 0); + static status_t AttrAsString(const Model* model, BString* result, + const char* attrName, int32 attrType, float width, + BView* view, int64* value = 0); - Model *TargetModel() const; + Model* TargetModel() const; virtual bool IsEditable() const; @@ -107,23 +108,24 @@ class WidgetAttributeText { protected: // generic fitting routines used by the different attributes - static float TruncString(BString *result, const char *src, - int32 length, const BPoseView *, float width, + static float TruncString(BString* result, const char* src, + int32 length, const BPoseView*, float width, uint32 truncMode = B_TRUNCATE_MIDDLE); - static float TruncTime(BString *result, int64 src, - const BPoseView *view, float width); + static float TruncTime(BString* result, int64 src, + const BPoseView* view, float width); - static float TruncFileSize(BString *result, int64 src, - const BPoseView *view, float width); + static float TruncFileSize(BString* result, int64 src, + const BPoseView* view, float width); - virtual void FitValue(BString *result, const BPoseView *) = 0; + virtual void FitValue(BString* result, const BPoseView*) = 0; // override FitValue to do a specific text fitting for a given // attribute - mutable Model *fModel; - const BColumn *fColumn; - float fOldWidth; // ToDo: make these int32 only + mutable Model* fModel; + const BColumn* fColumn; + // TODO: make these int32 only + float fOldWidth; float fTruncatedWidth; bool fDirty; // if true, need to recalculate text next time we try to use it @@ -133,7 +135,7 @@ class WidgetAttributeText { // in the last FittingText call }; -inline Model * +inline Model* WidgetAttributeText::TargetModel() const { return fModel; @@ -142,25 +144,25 @@ WidgetAttributeText::TargetModel() const class StringAttributeText : public WidgetAttributeText { public: - StringAttributeText(const Model *, const BColumn *); + StringAttributeText(const Model*, const BColumn*); - virtual const char *ValueAsText(const BPoseView *view); - // returns the untrucated text that corresponds to the attribute - // value + virtual const char* ValueAsText(const BPoseView* view); + // returns the untrucated text that corresponds to + // the attribute value virtual bool CheckAttributeChanged(); - virtual float PreferredWidth(const BPoseView *) const; + virtual float PreferredWidth(const BPoseView*) const; - virtual bool CommitEditedText(BTextView *); + virtual bool CommitEditedText(BTextView*); protected: - virtual bool CommitEditedTextFlavor(BTextView *) { return false; } + virtual bool CommitEditedTextFlavor(BTextView*) { return false; } - virtual void FitValue(BString *result, const BPoseView *); - virtual void ReadValue(BString *result) = 0; + virtual void FitValue(BString* result, const BPoseView*); + virtual void ReadValue(BString* result) = 0; - virtual int Compare(WidgetAttributeText &, BPoseView *view); + virtual int Compare(WidgetAttributeText &, BPoseView* view); BString fFullValueText; bool fValueDirty; @@ -170,17 +172,17 @@ class StringAttributeText : public WidgetAttributeText { class ScalarAttributeText : public WidgetAttributeText { public: - ScalarAttributeText(const Model *, const BColumn *); + ScalarAttributeText(const Model*, const BColumn*); int64 Value(); virtual bool CheckAttributeChanged(); - virtual float PreferredWidth(const BPoseView *) const; + virtual float PreferredWidth(const BPoseView*) const; - virtual bool CommitEditedText(BTextView *) { return false; } + virtual bool CommitEditedText(BTextView*) { return false; } // return true if attribute actually changed protected: virtual int64 ReadValue() = 0; - virtual int Compare(WidgetAttributeText &, BPoseView *view); + virtual int Compare(WidgetAttributeText&, BPoseView* view); int64 fValue; bool fValueDirty; // used for lazy read, managed by ReadValue @@ -188,21 +190,21 @@ class ScalarAttributeText : public WidgetAttributeText { union GenericValueStruct { - time_t time_tt; - off_t off_tt; + time_t time_tt; + off_t off_tt; - bool boolt; - int8 int8t; - uint8 uint8t; - int16 int16t; - int16 uint16t; - int32 int32t; - int32 uint32t; - int64 int64t; - int64 uint64t; + bool boolt; + int8 int8t; + uint8 uint8t; + int16 int16t; + int16 uint16t; + int32 int32t; + int32 uint32t; + int64 int64t; + int64 uint64t; - float floatt; - double doublet; + float floatt; + double doublet; }; @@ -287,10 +289,10 @@ private: class TimeAttributeText : public ScalarAttributeText { public: - TimeAttributeText(const Model *, const BColumn *); + TimeAttributeText(const Model*, const BColumn*); protected: - virtual float PreferredWidth(const BPoseView *) const; - virtual void FitValue(BString *result, const BPoseView *); + virtual float PreferredWidth(const BPoseView*) const; + virtual void FitValue(BString* result, const BPoseView*); virtual bool CheckSettingsChanged(); TrackerSettings fSettings; @@ -302,40 +304,40 @@ class TimeAttributeText : public ScalarAttributeText { class PathAttributeText : public StringAttributeText { public: - PathAttributeText(const Model *, const BColumn *); + PathAttributeText(const Model*, const BColumn*); protected: - virtual void ReadValue(BString *result); + virtual void ReadValue(BString* result); }; class OriginalPathAttributeText : public StringAttributeText { public: - OriginalPathAttributeText(const Model *, const BColumn *); + OriginalPathAttributeText(const Model*, const BColumn*); protected: - virtual void ReadValue(BString *result); + virtual void ReadValue(BString* result); }; class KindAttributeText : public StringAttributeText { public: - KindAttributeText(const Model *, const BColumn *); + KindAttributeText(const Model*, const BColumn*); protected: - virtual void ReadValue(BString *result); + virtual void ReadValue(BString* result); }; class NameAttributeText : public StringAttributeText { public: - NameAttributeText(const Model *, const BColumn *); - virtual void SetUpEditing(BTextView *); - virtual void FitValue(BString *result, const BPoseView *); + NameAttributeText(const Model*, const BColumn*); + virtual void SetUpEditing(BTextView*); + virtual void FitValue(BString* result, const BPoseView*); virtual bool IsEditable() const; static void SetSortFolderNamesFirst(bool); protected: - virtual bool CommitEditedTextFlavor(BTextView *); - virtual int Compare(WidgetAttributeText &, BPoseView *view); - virtual void ReadValue(BString *result); + virtual bool CommitEditedTextFlavor(BTextView*); + virtual int Compare(WidgetAttributeText&, BPoseView* view); + virtual void ReadValue(BString* result); static bool sSortFolderNamesFirst; }; @@ -343,17 +345,17 @@ class NameAttributeText : public StringAttributeText { class RealNameAttributeText : public StringAttributeText { public: - RealNameAttributeText(const Model *, - const BColumn *); - virtual void SetUpEditing(BTextView *); - virtual void FitValue(BString *result, const BPoseView *); + RealNameAttributeText(const Model*, + const BColumn*); + virtual void SetUpEditing(BTextView*); + virtual void FitValue(BString* result, const BPoseView*); static void SetSortFolderNamesFirst(bool); protected: - virtual bool CommitEditedTextFlavor(BTextView *); - virtual int Compare(WidgetAttributeText &, BPoseView *view); - virtual void ReadValue(BString *result); + virtual bool CommitEditedTextFlavor(BTextView*); + virtual int Compare(WidgetAttributeText&, BPoseView* view); + virtual void ReadValue(BString* result); static bool sSortFolderNamesFirst; }; @@ -363,47 +365,50 @@ protected: class OwnerAttributeText : public StringAttributeText { public: - OwnerAttributeText(const Model *, const BColumn *); + OwnerAttributeText(const Model*, const BColumn*); protected: - virtual void ReadValue(BString *result); + virtual void ReadValue(BString* result); }; class GroupAttributeText : public StringAttributeText { public: - GroupAttributeText(const Model *, const BColumn *); + GroupAttributeText(const Model*, const BColumn*); protected: - virtual void ReadValue(BString *result); + virtual void ReadValue(BString* result); }; -#endif /* OWNER_GROUP_ATTRIBUTES */ +#endif // OWNER_GROUP_ATTRIBUTES + class ModeAttributeText : public StringAttributeText { public: - ModeAttributeText(const Model *, const BColumn *); + ModeAttributeText(const Model*, const BColumn*); protected: - virtual void ReadValue(BString *result); + virtual void ReadValue(BString* result); }; + const int64 kUnknownSize = -1; + class SizeAttributeText : public ScalarAttributeText { public: - SizeAttributeText(const Model *, const BColumn *); + SizeAttributeText(const Model*, const BColumn*); protected: - virtual void FitValue(BString *result, const BPoseView *); + virtual void FitValue(BString* result, const BPoseView*); virtual int64 ReadValue(); - virtual float PreferredWidth(const BPoseView *) const; + virtual float PreferredWidth(const BPoseView*) const; }; class CreationTimeAttributeText : public TimeAttributeText { public: - CreationTimeAttributeText(const Model *, const BColumn *); + CreationTimeAttributeText(const Model*, const BColumn*); protected: virtual int64 ReadValue(); }; @@ -411,7 +416,7 @@ class CreationTimeAttributeText : public TimeAttributeText { class ModificationTimeAttributeText : public TimeAttributeText { public: - ModificationTimeAttributeText(const Model *, const BColumn *); + ModificationTimeAttributeText(const Model*, const BColumn*); protected: virtual int64 ReadValue(); @@ -420,25 +425,26 @@ class ModificationTimeAttributeText : public TimeAttributeText { class OpenWithRelationAttributeText : public ScalarAttributeText { public: - OpenWithRelationAttributeText(const Model *, const BColumn *, - const BPoseView *); + OpenWithRelationAttributeText(const Model*, const BColumn*, + const BPoseView*); protected: - virtual void FitValue(BString *result, const BPoseView *); + virtual void FitValue(BString* result, const BPoseView*); virtual int64 ReadValue(); - virtual float PreferredWidth(const BPoseView *) const; + virtual float PreferredWidth(const BPoseView*) const; - const BPoseView *fPoseView; + const BPoseView* fPoseView; BString fRelationText; }; class VersionAttributeText : public StringAttributeText { public: - VersionAttributeText(const Model *, const BColumn *, bool appVersion); + VersionAttributeText(const Model*, const BColumn*, bool appVersion); protected: - virtual void ReadValue(BString *result); + virtual void ReadValue(BString* result); + private: bool fAppVersion; }; @@ -446,7 +452,8 @@ class VersionAttributeText : public StringAttributeText { class AppShortVersionAttributeText : public VersionAttributeText { public: - AppShortVersionAttributeText(const Model *model, const BColumn *column) + AppShortVersionAttributeText(const Model* model, + const BColumn* column) : VersionAttributeText(model, column, true) { } @@ -455,7 +462,7 @@ class AppShortVersionAttributeText : public VersionAttributeText { class SystemShortVersionAttributeText : public VersionAttributeText { public: - SystemShortVersionAttributeText(const Model *model, const BColumn *column) + SystemShortVersionAttributeText(const Model* model, const BColumn* column) : VersionAttributeText(model, column, false) { } @@ -469,4 +476,4 @@ extern status_t TimeFormat(BString &string, int32 index, FormatSeparator format, using namespace BPrivate; -#endif /* __TEXT_WIDGET_ATTRIBUTE__ */ +#endif // __TEXT_WIDGET_ATTRIBUTE__ From caaec0198e99172abb5b06af3bfb229712e687da Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 27 Jul 2012 20:40:58 -0400 Subject: [PATCH 61/65] A for loop with just an end condition is better as a while loop. --- src/kits/tracker/Navigator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kits/tracker/Navigator.cpp b/src/kits/tracker/Navigator.cpp index 81d8e01c09..844b233f5b 100644 --- a/src/kits/tracker/Navigator.cpp +++ b/src/kits/tracker/Navigator.cpp @@ -366,16 +366,19 @@ BNavigator::UpdateLocation(const Model* newmodel, int32 action) case kActionBackward: fForwHistory.AddItem(fBackHistory.RemoveItemAt(fBackHistory.CountItems()-1)); break; + case kActionForward: fBackHistory.AddItem(fForwHistory.RemoveItemAt(fForwHistory.CountItems()-1)); break; + case kActionUpdatePath: break; + default: fForwHistory.MakeEmpty(); fBackHistory.AddItem(new BPath(fPath)); - for (; fBackHistory.CountItems() > kMaxHistory;) + while (fBackHistory.CountItems() > kMaxHistory) fBackHistory.RemoveItem(fBackHistory.FirstItem(), true); break; } From 96a1e39a63f093e57d351cf79b0e7ee51b80145a Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 27 Jul 2012 20:41:38 -0400 Subject: [PATCH 62/65] An error while emptying trash is not that dramatic. --- src/kits/tracker/FSUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp index a5170c3748..c6ae7cbe2f 100644 --- a/src/kits/tracker/FSUtils.cpp +++ b/src/kits/tracker/FSUtils.cpp @@ -2798,7 +2798,7 @@ empty_trash(void*) } if (err != B_OK && err != kTrashCanceled && err != kUserCanceled) { - (new BAlert("", B_TRANSLATE("Error emptying Trash!"), + (new BAlert("", B_TRANSLATE("Error emptying Trash"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); } From 9468090b43e8da113bdbe72b64acb768cc7a7455 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Fri, 27 Jul 2012 11:01:40 +0200 Subject: [PATCH 63/65] Update translations from Pootle --- .../inbound_filters/match_header/ru.catkeys | 15 +++++++++++++ .../inbound_filters/notifier/ru.catkeys | 10 +++++++++ data/catalogs/apps/fontdemo/ru.catkeys | 22 +++++++++++++++++++ data/catalogs/apps/packagemanager/ru.catkeys | 2 ++ data/catalogs/servers/debug/ru.catkeys | 4 ++++ data/catalogs/servers/mail/ru.catkeys | 8 +++++++ .../tests/kits/opengl/glinfo/be.catkeys | 9 ++++++++ .../tests/kits/opengl/glinfo/fi.catkeys | 9 ++++++++ .../tests/kits/opengl/glinfo/fr.catkeys | 9 ++++++++ .../tests/kits/opengl/glinfo/lt.catkeys | 9 ++++++++ .../tests/kits/opengl/glinfo/sk.catkeys | 9 ++++++++ 11 files changed, 106 insertions(+) create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/ru.catkeys create mode 100644 data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/ru.catkeys create mode 100644 data/catalogs/apps/fontdemo/ru.catkeys create mode 100644 data/catalogs/apps/packagemanager/ru.catkeys create mode 100644 data/catalogs/servers/debug/ru.catkeys create mode 100644 data/catalogs/servers/mail/ru.catkeys create mode 100644 data/catalogs/tests/kits/opengl/glinfo/be.catkeys create mode 100644 data/catalogs/tests/kits/opengl/glinfo/fi.catkeys create mode 100644 data/catalogs/tests/kits/opengl/glinfo/fr.catkeys create mode 100644 data/catalogs/tests/kits/opengl/glinfo/lt.catkeys create mode 100644 data/catalogs/tests/kits/opengl/glinfo/sk.catkeys diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/ru.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/ru.catkeys new file mode 100644 index 0000000000..218cf3e080 --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/match_header/ru.catkeys @@ -0,0 +1,15 @@ +1 russian x-vnd.Haiku-MatchHeader 1205906732 + ConfigView <Выберите действие> +has ConfigView содержит +Move to ConfigView Переместить в +Then ConfigView Тогда +value (use REGEX: in from of regular expressions like *spam*) ConfigView значение (используйте регулярные выражения, например *спам*) +this field is based on the action ConfigView это поле зависит от действия +Delete message ConfigView Удалить сообщение +Rule filter RuleFilter Правило фильтрации + ConfigView <Выберите аккаунт> +Set flags to ConfigView Установить флаги в +Set as read ConfigView Отметить как прочитанное +Reply with ConfigView Ответить с +If ConfigView Если +header (e.g. Subject) ConfigView заголовок (например Тема) diff --git a/data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/ru.catkeys b/data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/ru.catkeys new file mode 100644 index 0000000000..534be7573b --- /dev/null +++ b/data/catalogs/add-ons/mail_daemon/inbound_filters/notifier/ru.catkeys @@ -0,0 +1,10 @@ +1 russian x-vnd.Haiku-NewMailNotification 3801190717 +%num new message filter %num новое сообщение +%num new messages filter %num новых сообщений +Keyboard LEDs ConfigView Клавиатурные светодиоды +You have %num new message for %name. filter У вас есть %num новое сообщение для %name. +Log window ConfigView Окно журнала +Central beep ConfigView Центральный звуковой сигнал +Beep ConfigView Звуковой сигнал +Method: ConfigView Метод: +Alert ConfigView Оповещение diff --git a/data/catalogs/apps/fontdemo/ru.catkeys b/data/catalogs/apps/fontdemo/ru.catkeys new file mode 100644 index 0000000000..f4d08f8560 --- /dev/null +++ b/data/catalogs/apps/fontdemo/ru.catkeys @@ -0,0 +1,22 @@ +1 russian x-vnd.Haiku-FontDemo 1769653414 +Outline: ControlView Контур: +Size: 50 ControlView Размер: 50 +Stop cycling ControlView Остановить цикл +Shear: 90 ControlView Shear: 90 +Spacing: 0 ControlView Интервал: 0 +Haiku, Inc. FontDemoView Haiku, Inc. +Rotation: %d ControlView Поворот: %d +Shear: %d ControlView Сдвиг: %d +Spacing: %d ControlView Интервал: %d +Cycle fonts ControlView Циклрировать шрифты +Font: ControlView Шрифт: +Rotation: 0 ControlView Поворот: 0 +Drawing mode: ControlView Режим отрисовки: +FontDemo FontDemo ШрифтДемо +Haiku, Inc. ControlView Haiku, Inc. +Controls FontDemo Управление +Outline: %d ControlView Контур: %d +Text: ControlView Текст: +Antialiased text ControlView Сглаженный текст +Bounding boxes ControlView Ограничивающий параллелепипед +Size: %d ControlView Размер: %d diff --git a/data/catalogs/apps/packagemanager/ru.catkeys b/data/catalogs/apps/packagemanager/ru.catkeys new file mode 100644 index 0000000000..df4c1045d0 --- /dev/null +++ b/data/catalogs/apps/packagemanager/ru.catkeys @@ -0,0 +1,2 @@ +1 russian x-vnd.Haiku-PackageManager 501934476 +PackageManager System name Пакетный менеджер diff --git a/data/catalogs/servers/debug/ru.catkeys b/data/catalogs/servers/debug/ru.catkeys new file mode 100644 index 0000000000..70a4616978 --- /dev/null +++ b/data/catalogs/servers/debug/ru.catkeys @@ -0,0 +1,4 @@ +1 russian x-vnd.Haiku-debug_server 1035915338 +OK DebugServer ОК +Debug DebugServer Отладить +The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer Программа:\n\n %app\n\nобнаружила ошибку, которая мешает продолжению её работы. Haiku завершит эту программу и немного приберется за ней. diff --git a/data/catalogs/servers/mail/ru.catkeys b/data/catalogs/servers/mail/ru.catkeys new file mode 100644 index 0000000000..23c0522606 --- /dev/null +++ b/data/catalogs/servers/mail/ru.catkeys @@ -0,0 +1,8 @@ +1 russian x-vnd.Be-POST 933996868 +Fetching mail for %name Notifier Получение почты для %name +Check for mails only DeskbarView Только проверить почту +Send pending mails DeskbarView Отправить почту в ожидании +New Messages MailDaemon Новые Сообщения + DeskbarView <нет аккаунтов> +%num new messages DeskbarView %num новых сообщений +Mail status MailDaemon Статус почты diff --git a/data/catalogs/tests/kits/opengl/glinfo/be.catkeys b/data/catalogs/tests/kits/opengl/glinfo/be.catkeys new file mode 100644 index 0000000000..c2ddfff33f --- /dev/null +++ b/data/catalogs/tests/kits/opengl/glinfo/be.catkeys @@ -0,0 +1,9 @@ +1 belarusian x-vnd.Haiku-GLInfo 3678488342 +Capability Capabilities Магчымасць +Information InfoView Інфармацыя +GL Info System name Инфа пра GL +Capabilities Capabilities Магчымасці +Maximum convolution Capabilities Максімальная канвалюцыя +Available extensions Extensions Наяўныя пашырэнні +Value Capabilities Значэнне +Extensions Extensions Пашырэньні diff --git a/data/catalogs/tests/kits/opengl/glinfo/fi.catkeys b/data/catalogs/tests/kits/opengl/glinfo/fi.catkeys new file mode 100644 index 0000000000..7c15f91885 --- /dev/null +++ b/data/catalogs/tests/kits/opengl/glinfo/fi.catkeys @@ -0,0 +1,9 @@ +1 finnish x-vnd.Haiku-GLInfo 3678488342 +Capability Capabilities Kyky +Information InfoView Tiedot +GL Info System name GL-tiedot +Capabilities Capabilities Ominaisuudet +Maximum convolution Capabilities Enimmäismonimutkaisuus +Available extensions Extensions Käytettävissä olevat laajennukset +Value Capabilities Arvo +Extensions Extensions Laajennukset diff --git a/data/catalogs/tests/kits/opengl/glinfo/fr.catkeys b/data/catalogs/tests/kits/opengl/glinfo/fr.catkeys new file mode 100644 index 0000000000..f330eb74e6 --- /dev/null +++ b/data/catalogs/tests/kits/opengl/glinfo/fr.catkeys @@ -0,0 +1,9 @@ +1 french x-vnd.Haiku-GLInfo 3678488342 +Capability Capabilities Aptitude +Information InfoView Information +GL Info System name GL Info +Capabilities Capabilities Aptitudes +Maximum convolution Capabilities Nombre maximum de convolution +Available extensions Extensions Extensions disponibles +Value Capabilities Valeur +Extensions Extensions Extensions diff --git a/data/catalogs/tests/kits/opengl/glinfo/lt.catkeys b/data/catalogs/tests/kits/opengl/glinfo/lt.catkeys new file mode 100644 index 0000000000..b43652fa0e --- /dev/null +++ b/data/catalogs/tests/kits/opengl/glinfo/lt.catkeys @@ -0,0 +1,9 @@ +1 lithuanian x-vnd.Haiku-GLInfo 3678488342 +Capability Capabilities Galimybė +Information InfoView Informacija +GL Info System name GL informacija +Capabilities Capabilities Galimybės +Maximum convolution Capabilities Didžiausias susukimas +Available extensions Extensions Galimi plėtiniai +Value Capabilities Reikšmė +Extensions Extensions Plėtiniai diff --git a/data/catalogs/tests/kits/opengl/glinfo/sk.catkeys b/data/catalogs/tests/kits/opengl/glinfo/sk.catkeys new file mode 100644 index 0000000000..72d7fb4b84 --- /dev/null +++ b/data/catalogs/tests/kits/opengl/glinfo/sk.catkeys @@ -0,0 +1,9 @@ +1 slovak x-vnd.Haiku-GLInfo 3678488342 +Capability Capabilities Schopnosť +Information InfoView Informácie +GL Info System name Info GL +Capabilities Capabilities Schopnosti +Maximum convolution Capabilities Maximálna konvolúcia +Available extensions Extensions Dostupné rozšírenia +Value Capabilities Hodnota +Extensions Extensions Rozšírenia From 343892dc2d8258845efb52390a64333c47d374a4 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 28 Jul 2012 06:22:49 +0200 Subject: [PATCH 64/65] Update translations from Pootle --- data/catalogs/apps/aboutsystem/ja.catkeys | 3 +- data/catalogs/apps/webpositive/ja.catkeys | 112 ++++++++++++++++++++++ data/catalogs/kits/tracker/ja.catkeys | 9 +- 3 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 data/catalogs/apps/webpositive/ja.catkeys diff --git a/data/catalogs/apps/aboutsystem/ja.catkeys b/data/catalogs/apps/aboutsystem/ja.catkeys index 6d6d6fb6c9..ef827953dc 100644 --- a/data/catalogs/apps/aboutsystem/ja.catkeys +++ b/data/catalogs/apps/aboutsystem/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-About 2330231195 +1 japanese x-vnd.Haiku-About 519561637 Copyright © 1999-2010 by the authors of Gutenprint. All rights reserved. AboutView Copyright © 1999-2010 Gutenprintの著者たち. All rights reserved. Travis Geiselbrecht (and his NewOS kernel)\n AboutView Travis Geiselbrecht (ならびに彼が開発した NewOS カーネル)\n BSD (4-clause) AboutView BSD (4条項) @@ -40,6 +40,7 @@ Copyright © 2002-2004 Vivek Mohan. All rights reserved. AboutView Copyright © %.2f GHz AboutView %.2f GHz Memory: AboutView メモリー: Copyright © 1996-1997 Jeff Prosise. All rights reserved. AboutView Copyright © 1996-1997 Jeff Prosise. All rights reserved. +Copyright © 2006-2012 Kentaro Fukuchi AboutView Copyright © 2006-2012 Kentaro Fukuchi Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. This software is based in part on the work of the Independent JPEG Group. AboutView Copyright © 1994-2009, Thomas G. Lane, Guido Vollbeding. このソフトウェアの一部はIndependent JPEG Groupの著作物に基づいています. Past maintainers:\n AboutView 過去のメンテナー\n \n\nSpecial thanks to:\n AboutView \n\n下記の協力者の方々に深く感謝します:\n diff --git a/data/catalogs/apps/webpositive/ja.catkeys b/data/catalogs/apps/webpositive/ja.catkeys new file mode 100644 index 0000000000..e70d6b4c78 --- /dev/null +++ b/data/catalogs/apps/webpositive/ja.catkeys @@ -0,0 +1,112 @@ +1 japanese x-vnd.Haiku-WebPositive 2461471851 +Username: Authentication Panel ユーザー名: +Show tabs if only one page is open. Settings Window ページが一つだけ開いている場合もタブを表示する。 +Copy URL to clipboard Download Window URL をクリップボードにコピー +Cancel Settings Window キャンセル +Close window WebPositive Window ウィンドウを閉じる +Quit WebPositive 終了 +The downloads folder could not be opened.\n\nError: %error Download Window Don't translate variable %error ダウンロードフォルダーを開けませんでした。\n\nエラー: %error +Clear history WebPositive Window 履歴のクリア +WebPositive System name WebPositive +Yesterday WebPositive Window 昨日 +Authentication Required Authentication Panel 認証が必要です +Default standard font size: Settings Window 規定の標準フォントサイズ: +Start page: Settings Window スタートページ: +History WebPositive Window 履歴 +Error opening downloads folder Download Window ダウンロードフォルダーを開く際にエラーが発生しました +Paste WebPositive Window 貼り付け +Settings Settings Window 設定 +%seconds seconds left Download Window 残り %seconds 秒 +Window WebPositive Window ウィンドウ +Decrease size WebPositive Window サイズを小さく +Serif font: Settings Window セリフフォント: +Use proxy server to connect to the internet. Settings Window インターネット接続にプロキシーサーバーを使用する。 +Page source WebPositive Window ページのソース +Next WebPositive Window 次 +Find next WebPositive Window 次を検索 +Download folder: Settings Window ダウンロードフォルダ: +Edit WebPositive Window 編集 +Over %hours hours left Download Window 残り %hours 時間以上 +Cancel Authentication Panel キャンセル +Match case WebPositive Window 大文字小文字を区別 +Search page: Settings Window 検索ページ: +Show Home Button Settings Window ホームボタンを表示する +Zoom text only WebPositive Window テキストのみ拡大 +Requesting: WebPositive Window 要求中: +Default fixed font size: Settings Window 規定の固定フォントサイズ: +Close tab WebPositive Window タブを閉じる +Over 1 hour left Download Window 残り 1 時間以上 +Quit WebPositive Window 終了 +Standard font: Settings Window 標準フォント: +Restart Download Window 再起動 +Proxy server Settings Window プロキシサーバー +New window WebPositive Window 新規ウィンドウ +Open Download Window 開く +Reload WebPositive Window 再読み込み +Downloads Download Window ダウンロード +Sans serif font: Settings Window サンセリフフォント: +Over %days days left Download Window 残り %days 日以上 +Forward WebPositive Window 進む +Revert Settings Window 元に戻す +Fixed font: Settings Window 固定幅フォント: +Cut WebPositive Window 切り取り +Bookmark this page WebPositive Window このページをブックマーク +Open downloads folder Download Window ダウンロードフォルダーを開く +Auto-hide interface in fullscreen mode. Settings Window フルスクリーンモードで自動的にインターフェースを隠す。 +Number of days to keep links in History menu: Settings Window 履歴メニューにリンクを残す日数: +Hide Download Window 隠す +Reset size WebPositive Window サイズをリセット +Find: WebPositive Window 検索: +Increase size WebPositive Window サイズを大きく +Over 1 day left Download Window 残り 1 日以上 +Downloads WebPositive Window ダウンロード +Apply Settings Window 適用 +Bookmark info WebPositive Window ブックマーク情報 +Size: Font Selection view サイズ: +Fonts Settings Window フォント +Close WebPositive Window 閉じる +OK Download Window OK +Open blank page Settings Window 空白のページを開く +New tabs: Settings Window 新しいタブ: +Cancel WebPositive Window キャンセル +Open all WebPositive Window すべて開く +Clear URL Bar クリア +Cut URL Bar 切り取り +Clear WebPositive Window クリア +Remove Download Window 削除 +Find WebPositive Window 検索 +Find previous WebPositive Window 前を検索 +Settings WebPositive Window 設定 +Proxy server address: Settings Window プロキシサーバのアドレス: +Proxy server port: Settings Window プロキシサーバポート: +Bookmarks WebPositive Window ブックマーク +%minutes minutes Download Window %minutes 分 +Paste URL Bar 貼り付け +/s) Download Window ...as in 'per second' /s) +Hide password text Authentication Panel パスワードテキストを隠す +The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. The quick brown fox jumps over the lazy dog. +Over 1 minute left Download Window 残り 1 分以上 +Open start page Settings Window スタートページを開く +Continue downloads WebPositive ダウンロードを続ける +Cancel Download Window キャンセル +Open search page Settings Window 検索ページを開く +Password: Authentication Panel パスワード: +Back WebPositive Window 戻る +New browser window Download Window 新規ブラウザウィンドウ +Today WebPositive Window 今日 +1 second left Download Window 残り 1 秒 +Remember username and password for this site Authentication Panel このサイトのユーザー名とパスワードを記憶する +New tab WebPositive Window 新規タブ +Downloads in progress WebPositive ダウンロードが進行中です +Style: Font Selection view スタイル: +General Settings Window 一般 +Fullscreen WebPositive Window 全画面表示 +View WebPositive Window 表示 +Previous WebPositive Window 前へ +Copy WebPositive Window コピー +OK Authentication Panel OK +Auto-hide mouse pointer. Settings Window マウスポインターを自動的に隠す。 +Copy URL Bar コピー +OK WebPositive Window OK +Manage bookmarks WebPositive Window ブックマークの管理 +New windows: Settings Window 新規ウィンドウ: diff --git a/data/catalogs/kits/tracker/ja.catkeys b/data/catalogs/kits/tracker/ja.catkeys index e1cd451e5b..79bb94c13d 100644 --- a/data/catalogs/kits/tracker/ja.catkeys +++ b/data/catalogs/kits/tracker/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-libtracker 4157674549 +1 japanese x-vnd.Haiku-libtracker 2795444721 OK WidgetAttributeText OK Icon view VolumeWindow アイコン表示 Add-ons FilePanelPriv アドオン @@ -19,6 +19,7 @@ Recent documents FavoritesMenu 最近開いたドキュメント Modified QueryPoseView 更新日時 Created ContainerWindow 作成日時 Error %error loading add-On %name. ContainerWindow %nameアドオンの読み込み中に%errorエラーが発生 +If you %ifYouDoAction the settings folder, %osName may not behave properly!\n\nAre you sure you want to do this? FSUtils settings フォルダーを%ifYouDoActionした場合、%osName が正常に動作しなくなる可能性があります!\n\n本当に続けますか? contains SelectionWindow 含む Sorry, you can't save things at the root of your system. FilePanelPriv システムのルートフォルダーに保存は許可されていません。 Show shared volumes on Desktop SettingsView 共有ディスクをデスクトップに表示する @@ -86,6 +87,7 @@ Cut FilePanelPriv 切り取り Replace FilePanelPriv 置換 Select all VolumeWindow すべて選択 Opens with: InfoWindow アプリケーション: +If you %ifYouDoAction the mime settings, %osName may not behave properly!\n\nAre you sure you want to do this? FSUtils MIME 設定を%ifYouDoActionした場合、%osName が正常に動作しなくなる可能性があります!\n\n本当に続けますか? Open ContainerWindow 開く Error calculating folder size. InfoWindow フォルダーサイズの計算中にエラー発生。 New folder FilePanelPriv 新規フォルダー @@ -114,6 +116,7 @@ Move to Trash ContainerWindow ごみ箱に捨てる Move to ContainerWindow 指定先に移動 Create %s clipping PoseView %s クリップを作成 Set new link target InfoWindow リンク先を変更 +If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName!\n\nAre you sure you want to do this?\n\nTo %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils システムフォルダーおよびその中身を%ifYouDoActionした場合、%osName が起動しなくなります!\n\n本当に続けますか?\n\nそれでもシステムフォルダーまたはその中身の%toDoActionを実行するなら、Shift キーを押しながら \"%toConfirmAction\" をクリックしてください。 Save as Query template: FindPanel クエリ雛型として保存する: Cancel FSUtils 中止 move FSUtils As in 'to move this folder...' (en) Um diesen Ordner zu verschieben...' (de) 移動 @@ -136,6 +139,7 @@ Could not open \"%document\" with application \"%app\" (%error). FSUtils ア Sorry, saving more than one item is not allowed. FilePanelPriv 2 項目以上は保存できません。 Searching for disks to mount… StatusWindow マウントできるディスクを探しています… New folder FSUtils 新規フォルダー +If you %ifYouDoAction the common folder, %osName may not behave properly!\n\nAre you sure you want to do this?\n\nTo %toDoAction the common folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils common フォルダーおよびその中身を%ifYouDoActionした場合、%osName が起動しなくなります!\n\n本当に続けますか?\n \n それでも common フォルダーまたはその中身の%toDoActionを実行するなら、Shift キーを押しながら \"%toConfirmAction\" をクリックしてください。 Free space color SettingsView 空き容量の色 Cut ContainerWindow 切り取り Remove FindPanel 削除 @@ -244,6 +248,7 @@ The file \"%name\" already exists in the specified folder. Do you want to replac Cancel ContainerWindow 中止 Only the boot disk AutoMounterSettings 起動ディスクのみ Trash TrackerSettingsWindow ごみ箱 +If you %ifYouDoAction the config folder, %osName may not behave properly!\n\nAre you sure you want to do this? FSUtils config フォルダーを%ifYouDoAction した場合、%osName が正常に動作しなくなる可能性があります!\n\n本当に続けますか? Unmount ContainerWindow マウント解除 Copy layout ContainerWindow レイアウトをコピー label too long PoseView ラベルが長すぎます @@ -329,6 +334,7 @@ Handles any file OpenWithWindow すべてのファイルに対応 Get info FilePanelPriv 詳細情報… 32 x 32 DeskWindow 32 × 32 Cancel FilePanelPriv 中止 +The application \"%appname\" does not support the type of document you are about to open.\nAre you sure you want to proceed?\n\nIf you know that the application supports the document type, you should contact the publisher of the application and ask them to update their application to list the type of your document as supported. OpenWithWindow アプリケーション \"%appname\" は開こうとしているドキュメントタイプをサポートしていません。\n本当に進めても良いですか?\n\n アプリケーションがサポートすることがわかっている場合は、アプリケーションの製作元にドキュメントタイプをサポートに加えるように問い合わせてください。 Disks DirMenu ディスク New folder %ld FSUtils 新規フォルダー %ld All BeOS disks AutoMounterSettings 全 BFS パーティション @@ -366,6 +372,7 @@ Preferences… ContainerWindow 設定… Move PoseView 移動 Open and make preferred OpenWithWindow 関連づけて開く Are you sure you want to delete the selected item(s)? This operation cannot be reverted. FSUtils 選択した項目を削除してもよろしいですか?削除した項目は復元できませんので、ご注意ください。 +If you %ifYouDoAction the home folder, %osName may not behave properly!\n\nAre you sure you want to do this?\n\nTo %toDoAction the home folder anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils ホームフォルダーを%ifYouDoActionした場合、%osName が正常に動作しなくなる可能性があります!\n\n本当に続けますか?\n\nそれでもホームフォルダーの%toDoActionを実行するなら、Shift キーを押しながら \"%toConfirmAction\" をクリックしてください。 Add-ons DeskWindow アドオン Name FindPanel 名前 And FindPanel かつ From 0d47dc5dd23f53a6bbd999b44b010d68229a4f83 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Sat, 28 Jul 2012 16:26:07 +0100 Subject: [PATCH 65/65] Fixed incorrect variable name in generated BuildConfig. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 05f1e06a03..16394aa7d8 100755 --- a/configure +++ b/configure @@ -562,7 +562,7 @@ HAIKU_RANLIB ?= ${HAIKU_RANLIB} ; HAIKU_YASM ?= ${HAIKU_YASM} ; HAIKU_CPPFLAGS ?= ${HAIKU_CPPFLAGS} ; HAIKU_CCFLAGS ?= ${HAIKU_CCFLAGS} ; -HAIKU_CXXFLAGS ?= ${HAIKU_CXXFLAGS} ; +HAIKU_C++FLAGS ?= ${HAIKU_CXXFLAGS} ; HAIKU_LDFLAGS ?= ${HAIKU_LDFLAGS} ; HAIKU_ARFLAGS ?= ${HAIKU_ARFLAGS} ; HAIKU_UNARFLAGS ?= ${HAIKU_UNARFLAGS} ;