changed the meaning of the "icon view label background" Tracker setting:

* it is replaced by a "icon view label outline" feature that renders a black
  or white outline around the text of a label under an icon. This can be used
  for background images that have a lot of contrast and is visually more
  pleasing (IMHO) than the text box in the workspace color (but the outline
  could of course still be improved as well)
  the outline or "false bold width" feature is a new BFont feature in Haiku
* Tracker appeared to have a disabled feature to install default background
  images, I enabled this feature and rewrote it a bit to use our big logo
  from the artwork folder, the placement is for 800x600, so not optimal for
  larger desktops, but at least it is shown by default on new installations
  or rather "fresh" images
* changed the way the dotted underline is rendered under links, accidentally,
  this fixes the bug that it was not dotted at all since a while, which is
  a bug in app_server or BView not tracking the need to update the drawing
  pattern in certain situations (this bug needs to be fixed too of course)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22040 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2007-08-22 15:01:38 +00:00
parent f148f628da
commit 5c34aef797
14 changed files with 180 additions and 178 deletions

View File

@ -45,11 +45,12 @@ All rights reserved.
/*----------------------------------------------------------------*/
/*----- Tracker background BMessage entries --------------------*/
#define B_BACKGROUND_IMAGE "be:bgndimginfopath" // string path
#define B_BACKGROUND_MODE "be:bgndimginfomode" // int32, the enum below
#define B_BACKGROUND_ORIGIN "be:bgndimginfooffset" // BPoint
#define B_BACKGROUND_ERASE_TEXT "be:bgndimginfoerasetext" // bool
#define B_BACKGROUND_WORKSPACES "be:bgndimginfoworkspaces" // uint32
#define B_BACKGROUND_IMAGE "be:bgndimginfopath" // string path
#define B_BACKGROUND_MODE "be:bgndimginfomode" // int32, the enum below
#define B_BACKGROUND_ORIGIN "be:bgndimginfooffset" // BPoint
#define B_BACKGROUND_TEXT_OUTLINE "be:bgndimginfoerasetext" // bool
// NOTE: the actual attribute name is kept for backwards compatible settings
#define B_BACKGROUND_WORKSPACES "be:bgndimginfoworkspaces" // uint32
/*----------------------------------------------------------------*/
/*----- Background mode values ---------------------------------*/

View File

@ -44,17 +44,19 @@ All rights reserved.
#include <fs_attr.h>
#include "BackgroundImage.h"
#include "Background.h"
#include "Commands.h"
#include "PoseView.h"
namespace BPrivate {
const char *kBackgroundImageInfo = "be:bgndimginfo";
const char *kBackgroundImageInfoOffset = "be:bgndimginfooffset";
const char *kBackgroundImageInfoEraseText = "be:bgndimginfoerasetext";
const char *kBackgroundImageInfoMode = "be:bgndimginfomode";
const char *kBackgroundImageInfoWorkspaces = "be:bgndimginfoworkspaces";
const char *kBackgroundImageInfoPath = "be:bgndimginfopath";
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;
}
@ -82,7 +84,7 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop)
const char *path;
uint32 workspaces = B_ALL_WORKSPACES;
Mode mode = kTiled;
bool eraseTextWidgetBackground = true;
bool textWidgetLabelOutline = false;
BPoint offset;
if (container.FindString(kBackgroundImageInfoPath, index, &path) != B_OK)
@ -96,12 +98,12 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop)
container.FindInt32(kBackgroundImageInfoWorkspaces, index, (int32 *)&workspaces);
container.FindInt32(kBackgroundImageInfoMode, index, (int32 *)&mode);
container.FindBool(kBackgroundImageInfoEraseText, index, &eraseTextWidgetBackground);
container.FindBool(kBackgroundImageInfoTextOutline, index, &textWidgetLabelOutline);
container.FindPoint(kBackgroundImageInfoOffset, index, &offset);
BackgroundImage::BackgroundImageInfo *imageInfo = new
BackgroundImage::BackgroundImageInfo(workspaces, bitmap, mode, offset,
eraseTextWidgetBackground);
textWidgetLabelOutline);
if (!result)
result = new BackgroundImage(node, isDesktop);
@ -113,12 +115,12 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop)
BackgroundImage::BackgroundImageInfo::BackgroundImageInfo(uint32 workspaces,
BBitmap *bitmap, Mode mode, BPoint offset, bool eraseTextWidget)
BBitmap *bitmap, Mode mode, BPoint offset, bool textWidgetOutline)
: fWorkspace(workspaces),
fBitmap(bitmap),
fMode(mode),
fOffset(offset),
fEraseTextWidgetBackground(eraseTextWidget)
fTextWidgetOutline(textWidgetOutline)
{
}
@ -158,7 +160,7 @@ BackgroundImage::Show(BView *view, int32 workspace)
if (info) {
BPoseView *poseView = dynamic_cast<BPoseView *>(fView);
if (poseView)
poseView->SetEraseWidgetTextBackground(info->fEraseTextWidgetBackground);
poseView->SetWidgetTextOutline(info->fTextWidgetOutline);
Show(info, fView);
}
}
@ -205,7 +207,7 @@ BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
BPoseView *poseView = dynamic_cast<BPoseView *>(view);
if (poseView)
poseView->SetEraseWidgetTextBackground(info->fEraseTextWidgetBackground);
poseView->SetWidgetTextOutline(info->fTextWidgetOutline);
// switch to the bitmap and force a redraw
view->SetViewBitmap(info->fBitmap, bitmapBounds, destinationBitmapBounds,
@ -224,7 +226,7 @@ BackgroundImage::Remove()
BPoseView *poseView = dynamic_cast<BPoseView *>(fView);
// make sure text widgets draw the default way, erasing their background
if (poseView)
poseView->SetEraseWidgetTextBackground(true);
poseView->SetWidgetTextOutline(true);
}
fShowingBitmap = NULL;
}
@ -271,7 +273,7 @@ BackgroundImage::WorkspaceActivated(BView *view, int32 workspace, bool state)
Show(info, view);
else {
if (BPoseView *poseView = dynamic_cast<BPoseView *>(view))
poseView->SetEraseWidgetTextBackground(true);
poseView->SetWidgetTextOutline(true);
view->ClearViewBitmap();
view->Invalidate();
}

View File

@ -52,7 +52,7 @@ class BPoseView;
extern const char *kBackgroundImageInfo;
extern const char *kBackgroundImageInfoOffset;
extern const char *kBackgroundImageInfoEraseText;
extern const char *kBackgroundImageInfoTextOutline;
extern const char *kBackgroundImageInfoMode;
extern const char *kBackgroundImageInfoWorkspaces;
extern const char *kBackgroundImageInfoPath;
@ -77,14 +77,14 @@ public:
// element of the per-workspace list
public:
BackgroundImageInfo(uint32 workspace, BBitmap *bitmap, Mode mode, BPoint offset,
bool eraseTextWidget);
bool textWidgetOutline);
~BackgroundImageInfo();
uint32 fWorkspace;
BBitmap *fBitmap;
Mode fMode;
BPoint fOffset;
bool fEraseTextWidgetBackground;
bool fTextWidgetOutline;
};
static BackgroundImage *GetBackgroundImage(const BNode *, bool isDesktop);

View File

@ -581,7 +581,7 @@ BPose::Draw(BRect rect, BPoseView *poseView, BView *drawView, bool fullDraw,
widget->RecalculateText(poseView);
bool selectDuringDraw = directDraw && selected
&& (windowActive && !poseView->EraseWidgetTextBackground());
&& (windowActive && !poseView->WidgetTextOutline());
if (index == 0 && selectDuringDraw) {
//draw with dark background to select text
@ -638,7 +638,7 @@ BPose::Draw(BRect rect, BPoseView *poseView, BView *drawView, bool fullDraw,
bool selectDuringDraw = directDraw && selected
&& (poseView->IsDesktopWindow()
|| (windowActive && !poseView->EraseWidgetTextBackground()));
|| (windowActive && !poseView->WidgetTextOutline()));
if (selectDuringDraw) {
// draw with dark background to select text

View File

@ -196,7 +196,7 @@ BPoseView::BPoseView(Model *model, BRect bounds, uint32 viewMode, uint32 resizeM
fRefFilter(NULL),
fAutoScrollInc(20),
fAutoScrollState(kAutoScrollOff),
fEraseWidgetBackground(true),
fWidgetTextOutline(false),
fSelectionPivotPose(NULL),
fRealPivotPose(NULL),
fKeyRunner(NULL),
@ -2873,7 +2873,7 @@ BPoseView::UpdatePosesClipboardModeFromClipboard(BMessage *clipboardReport)
|| bounds.Contains(poseRect.LeftBottom())
|| bounds.Contains(poseRect.RightBottom())
|| bounds.Contains(poseRect.RightTop())) {
if (!EraseWidgetTextBackground()
if (!WidgetTextOutline()
|| clipNode->moveMode == kMoveSelectionTo)
Invalidate(poseRect);
else
@ -3432,7 +3432,7 @@ BPoseView::SelectPoses(int32 start, int32 end)
poseRect = pose->CalcRect(loc, this);
if (bounds.Intersects(poseRect)) {
if (EraseWidgetTextBackground())
if (WidgetTextOutline())
Invalidate(poseRect);
else
pose->Draw(poseRect, this, false);
@ -6871,7 +6871,7 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList **oldList)
// using a vector class instead of BList
if ((selected != pose->IsSelected()) && poseRect.Intersects(bounds)) {
if (pose->IsSelected() || EraseWidgetTextBackground())
if (pose->IsSelected() || WidgetTextOutline())
pose->Draw(poseRect, this, false);
else
Invalidate(poseRect);
@ -6900,7 +6900,7 @@ BPoseView::SelectPosesListMode(BRect selectionRect, BList **oldList)
BRect poseRect(pose->CalcRect(loc, this));
if (poseRect.Intersects(bounds)) {
if (pose->IsSelected() || EraseWidgetTextBackground())
if (pose->IsSelected() || WidgetTextOutline())
pose->Draw(poseRect, this, false);
else
Invalidate(poseRect);
@ -6939,7 +6939,7 @@ BPoseView::SelectPosesIconMode(BRect selectionRect, BList **oldList)
newList->AddItem((void *)index);
if ((selected != pose->IsSelected()) && poseRect.Intersects(bounds)) {
if (pose->IsSelected() || EraseWidgetTextBackground())
if (pose->IsSelected() || WidgetTextOutline())
pose->Draw(poseRect, this, false);
else
Invalidate(poseRect);
@ -6967,7 +6967,7 @@ BPoseView::SelectPosesIconMode(BRect selectionRect, BList **oldList)
BRect poseRect(pose->CalcRect(this));
if (poseRect.Intersects(bounds)) {
if (pose->IsSelected() || EraseWidgetTextBackground())
if (pose->IsSelected() || WidgetTextOutline())
pose->Draw(poseRect, this, false);
else
Invalidate(poseRect);
@ -7725,7 +7725,7 @@ BPoseView::ClearSelection()
if (pose->IsSelected()) {
pose->Select(false);
BRect poseRect(pose->CalcRect(loc, this, false));
if (EraseWidgetTextBackground())
if (WidgetTextOutline())
pose->Draw(poseRect, this, false);
else
Invalidate(poseRect);
@ -7744,7 +7744,7 @@ BPoseView::ClearSelection()
if (pose->IsSelected()) {
pose->Select(false);
BRect poseRect(pose->CalcRect(this));
if (EraseWidgetTextBackground())
if (WidgetTextOutline())
pose->Draw(poseRect, this, false);
else
Invalidate(poseRect);
@ -7807,7 +7807,7 @@ BPoseView::ShowSelection(bool show)
if (pose->IsSelected() != show || fShowSelectionWhenInactive) {
if (!fShowSelectionWhenInactive)
pose->Select(show);
if (show && EraseWidgetTextBackground())
if (show && WidgetTextOutline())
pose->Draw(pose->CalcRect(this), this, false);
else
Invalidate(pose->CalcRect(this));
@ -7850,7 +7850,7 @@ BPoseView::AddRemovePoseFromSelection(BPose *pose, int32 index, bool select)
pose->Select(select);
// update display
if (EraseWidgetTextBackground())
if (WidgetTextOutline())
DrawPose(pose, index, false);
else
Invalidate(pose->CalcRect(this));
@ -8887,7 +8887,7 @@ BPoseView::HiliteDropTarget(bool hiliteState)
BPose *pose = fVSPoseList->ItemAt(index);
if (pose) {
if (pose == fDropTarget) {
if (!hiliteState && !EraseWidgetTextBackground())
if (!hiliteState && !WidgetTextOutline())
// deselecting an icon with widget drawn over background
// have to be a little tricky here - draw just the icon,
// invalidate the widget
@ -9210,16 +9210,16 @@ BPoseView::AdaptToDesktopIntegrationChange(BMessage *)
bool
BPoseView::EraseWidgetTextBackground() const
BPoseView::WidgetTextOutline() const
{
return fEraseWidgetBackground;
return fWidgetTextOutline;
}
void
BPoseView::SetEraseWidgetTextBackground(bool on)
BPoseView::SetWidgetTextOutline(bool on)
{
fEraseWidgetBackground = on;
fWidgetTextOutline = on;
}

View File

@ -207,8 +207,8 @@ class BPoseView : public BView {
rgb_color DeskTextColor() const;
rgb_color DeskTextBackColor() const;
bool EraseWidgetTextBackground() const;
void SetEraseWidgetTextBackground(bool);
bool WidgetTextOutline() const;
void SetWidgetTextOutline(bool);
// used to not erase when we have a background image and
// invalidate instead
@ -627,7 +627,7 @@ class BPoseView : public BView {
float fAutoScrollInc;
int32 fAutoScrollState;
std::set<thread_id> fAddPosesThreads;
bool fEraseWidgetBackground;
bool fWidgetTextOutline;
const BPose *fSelectionPivotPose;
const BPose *fRealPivotPose;
BMessageRunner *fKeyRunner;

View File

@ -477,12 +477,22 @@ void
BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView *view,
BView *drawView, bool selected, uint32 clipboardMode, BPoint offset, bool direct)
{
textRect.OffsetBy(offset);
if (direct) {
#if __HAIKU__
// draw selection box if selected
if (selected) {
#else
// erase area we're going to draw in
if (view->EraseWidgetTextBackground() || selected) {
// NOTE: WidgetTextOutline() is reused for
// erasing background on R5 here
if (view->WidgetTextOutline() || selected) {
#endif
drawView->SetDrawingMode(B_OP_COPY);
eraseRect.OffsetBy(offset);
drawView->FillRect(eraseRect, B_SOLID_LOW);
// drawView->FillRect(eraseRect, B_SOLID_LOW);
drawView->FillRect(textRect, B_SOLID_LOW);
} else
drawView->SetDrawingMode(B_OP_OVER);
@ -493,34 +503,74 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView *view,
highColor = kWhite;
else
highColor = view->DeskTextColor();
} else if (selected && view->Window()->IsActive() && !view->EraseWidgetTextBackground()) {
} else if (selected && view->Window()->IsActive()) {
highColor = kWhite;
} else
highColor = kBlack;
if (clipboardMode == kMoveSelectionTo && !selected) {
view->SetDrawingMode(B_OP_ALPHA);
view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
drawView->SetDrawingMode(B_OP_ALPHA);
drawView->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
highColor.alpha = 64;
}
drawView->SetHighColor(highColor);
}
BPoint loc;
textRect.OffsetBy(offset);
loc.y = textRect.bottom - view->FontInfo().descent;
loc.x = textRect.left + 1;
drawView->MovePenTo(loc);
drawView->DrawString(fText->FittingText(view));
const char* fittingText = fText->FittingText(view);
#if __HAIKU__
if (!selected && view->WidgetTextOutline()) {
// draw a halo around the text by using the "false bold"
// feature for text rendering. Either black or white is used for
// the glow (whatever acts as contrast) with a some alpha value,
// two passes are used to achive a blur effect
drawView->SetDrawingMode(B_OP_ALPHA);
drawView->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
BFont font;
drawView->GetFont(&font);
// NOTE: commented out first pass for halo, since just a plain
// outline looks better IMHO -stippi
// font.SetFalseBoldWidth(2.0);
// drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
rgb_color textColor = drawView->HighColor();
rgb_color glow = textColor.red
+ textColor.green + textColor.blue > 128 * 3 ? kBlack : kWhite;
// glow.alpha = 40;
// drawView->SetHighColor(glow);
// drawView->DrawString(fittingText, loc);
font.SetFalseBoldWidth(1.0);
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
glow.alpha = 220;
drawView->SetHighColor(glow);
drawView->DrawString(fittingText, loc);
font.SetFalseBoldWidth(0.0);
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
drawView->SetHighColor(textColor);
}
#endif // __HAIKU__
drawView->DrawString(fittingText, loc);
if (fSymLink && (fAttrHash == view->FirstColumn()->AttrHash())) {
// ToDo:
// this should be exported to the WidgetAttribute class, probably
// by having a per widget kind style
if (direct)
drawView->SetHighColor(125, 125, 125);
if (direct) {
rgb_color underlineColor = drawView->HighColor();
underlineColor.alpha = 180;
drawView->SetHighColor(underlineColor);
drawView->SetDrawingMode(B_OP_ALPHA);
drawView->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
}
textRect.right = textRect.left + fText->Width(view);
// only underline text part

View File

@ -86,7 +86,7 @@ public:
void SetActive(bool);
const char *Text() const;
// returns the untrucated version of the text
// returns the untruncated version of the text
float TextWidth(const BPoseView *) const;
float PreferredWidth(const BPoseView *) const;
int Compare(const BTextWidget &, BPoseView *) const;

View File

@ -1280,6 +1280,7 @@ TTracker::ReadyToRun()
InitMimeTypes();
InstallDefaultTemplates();
InstallIndices();
InstallTemporaryBackgroundImages();
HideVarDir();

View File

@ -41,6 +41,7 @@ All rights reserved.
#include <Message.h>
#include <Node.h>
#include <Path.h>
#include <Screen.h>
#include <VolumeRoster.h>
#include <fs_attr.h>
@ -429,24 +430,24 @@ InstallTemporaryBackgroundImages(BNode *node, BMessage *message)
static void
AddTemporaryBackgroundImages(BMessage *message, const char *imagePath,
BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool eraseTextWidgets)
BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool textWidgetOutlines)
{
message->AddString(kBackgroundImageInfoPath, imagePath);
message->AddInt32(kBackgroundImageInfoWorkspaces, (int32)workspaces);
message->AddInt32(kBackgroundImageInfoMode, mode);
message->AddBool(kBackgroundImageInfoEraseText, eraseTextWidgets);
message->AddBool(kBackgroundImageInfoTextOutline, textWidgetOutlines);
message->AddPoint(kBackgroundImageInfoOffset, offset);
}
static void
InstallTemporaryBackgroundImagesIfNeeded(BNode *node, const char *imagePath,
BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool eraseTextWidgets)
BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool textWidgetOutlines)
{
attr_info info;
if (node->GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) {
BMessage message;
AddTemporaryBackgroundImages(&message, imagePath, mode, offset, workspaces,
eraseTextWidgets);
textWidgetOutlines);
InstallTemporaryBackgroundImages(node, &message);
}
}
@ -454,97 +455,39 @@ InstallTemporaryBackgroundImagesIfNeeded(BNode *node, const char *imagePath,
void
TTracker::InstallTemporaryBackgroundImages()
{
// TODO: make the large Haiku Logo the default background
// make the large Haiku Logo the default background
// BPath path;
BPath path("/boot/beos/etc/artwork");
// FSFindTrackerSettingsDir(&path, false);
// path.Append(kDefaultFolderTemplate);
BString defaultBackgroundImage("/HAIKU logo - white on blue - big.png");
BString defaultBackgroundTexture("/backgroundTexture.tga");
BPath path;
FSFindTrackerSettingsDir(&path, false);
BString defaultFolderPath(path.Path());
defaultFolderPath << '/' << kDefaultFolderTemplate << '/';
BNode node;
if (BContainerWindow::DefaultStateSourceNode(kDefaultFolderTemplate, &node, true))
if (BContainerWindow::DefaultStateSourceNode(kDefaultFolderTemplate, &node, true)) {
// install a default background texture for folders in icon view mode
InstallTemporaryBackgroundImagesIfNeeded(&node,
(BString(defaultFolderPath) << "backgroundTexture.tga").String(),
(BString(path.Path()) << defaultBackgroundTexture).String(),
BackgroundImage::kTiled,
BPoint(0, 0), 0xffffffff, false);
}
BDirectory dir;
if (FSGetBootDeskDir(&dir) == B_OK) {
// install a default background if there is no background defined yet
attr_info info;
if (dir.GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) {
BScreen screen(B_MAIN_SCREEN_ID);
BPoint logoPos;
logoPos.x = floorf((screen.Frame().Width() - 605) * (sqrtf(5) - 1) / 2);
logoPos.y = floorf((screen.Frame().Height() - 190) * 0.9);
BMessage message;
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bgdefault.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0xffffffff, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg1.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000001, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg2.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000002, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg3.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000004, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg4.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000008, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg5.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000010, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg6.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000020, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg7.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000040, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg8.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000080, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg9.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000100, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg10.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000200, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg11.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000400, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg12.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00000800, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg12.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00001000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg13.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00002000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg14.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00002000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg15.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00004000, true);
AddTemporaryBackgroundImages(&message,
(BString(defaultFolderPath) << "bg16.tga").String(),
BackgroundImage::kScaledToFit,
BPoint(0, 0), 0x00008000, true);
(BString(path.Path()) << defaultBackgroundImage).String(),
BackgroundImage::kAtOffset,
logoPos, 0xffffffff, false);
::InstallTemporaryBackgroundImages(&dir, &message);
}
}

View File

@ -57,7 +57,11 @@ All rights reserved.
const char *kBackgroundImageInfo = "be:bgndimginfo";
const char *kBackgroundImageInfoOffset = "be:bgndimginfooffset";
const char *kBackgroundImageInfoEraseText = "be:bgndimginfoerasetext";
//const char *kBackgroundImageInfoTextOutline = "be:bgndimginfotextoutline";
const char *kBackgroundImageInfoTextOutline = "be:bgndimginfoerasetext";
// NOTE: the attribute keeps the old name for backwards compatibility,
// just in case some users spend time configuring a few windows with
// this feature on or off...
const char *kBackgroundImageInfoMode = "be:bgndimginfomode";
const char *kBackgroundImageInfoWorkspaces = "be:bgndimginfoworkspaces";
const char *kBackgroundImageInfoPath = "be:bgndimginfopath";
@ -107,7 +111,7 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
const char *path;
uint32 workspaces = B_ALL_WORKSPACES;
Mode mode = kTiled;
bool eraseTextWidgetBackground = true;
bool textWidgetLabelOutline = false;
BPoint offset;
uint32 imageSet = 0;
uint32 cacheMode = 0;
@ -122,8 +126,8 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
container.FindInt32(kBackgroundImageInfoWorkspaces, index,
(int32 *)&workspaces);
container.FindInt32(kBackgroundImageInfoMode, index, (int32 *)&mode);
container.FindBool(kBackgroundImageInfoEraseText, index,
&eraseTextWidgetBackground);
container.FindBool(kBackgroundImageInfoTextOutline, index,
&textWidgetLabelOutline);
container.FindPoint(kBackgroundImageInfoOffset, index, &offset);
if (isDesktop) {
@ -135,7 +139,7 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
BackgroundImage::BackgroundImageInfo *imageInfo = new
BackgroundImage::BackgroundImageInfo(workspaces, imageIndex,
mode, offset, eraseTextWidgetBackground, imageSet, cacheMode);
mode, offset, textWidgetLabelOutline, imageSet, cacheMode);
//imageInfo->UnloadBitmap(globalCacheMode);
@ -159,14 +163,14 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
BackgroundImage::BackgroundImageInfo::BackgroundImageInfo(uint32 workspaces,
int32 imageIndex, Mode mode, BPoint offset, bool eraseTextWidget,
int32 imageIndex, Mode mode, BPoint offset, bool textWidgetLabelOutline,
uint32 imageSet, uint32 cacheMode)
:
fWorkspace(workspaces),
fImageIndex(imageIndex),
fMode(mode),
fOffset(offset),
fEraseTextWidgetBackground(eraseTextWidget),
fTextWidgetLabelOutline(textWidgetLabelOutline),
fImageSet(imageSet),
fCacheMode(cacheMode)
{
@ -239,7 +243,7 @@ BackgroundImage::Show(BView *view, int32 workspace)
if (info) {
/*BPoseView *poseView = dynamic_cast<BPoseView *>(fView);
if (poseView)
poseView->SetEraseWidgetTextBackground(info->fEraseTextWidgetBackground);*/
poseView->SetEraseWidgetTextBackground(info->fTextWidgetLabelOutline);*/
Show(info, fView);
}
}
@ -425,8 +429,8 @@ BackgroundImage::SetBackgroundImage(BNode *node)
if (fBackgroundsView->GetImage(info->fImageIndex) == NULL)
continue;
container.AddBool(kBackgroundImageInfoEraseText,
info->fEraseTextWidgetBackground);
container.AddBool(kBackgroundImageInfoTextOutline,
info->fTextWidgetLabelOutline);
container.AddString(kBackgroundImageInfoPath,
fBackgroundsView->GetImage(info->fImageIndex)->GetPath().Path());
container.AddInt32(kBackgroundImageInfoWorkspaces, info->fWorkspace);

View File

@ -83,7 +83,7 @@ class BackgroundImage {
// element of the per-workspace list
public:
BackgroundImageInfo(uint32 workspace, int32 imageIndex, Mode mode,
BPoint offset, bool eraseTextWidget, uint32 imageSet,
BPoint offset, bool textWidgetLabelOutline, uint32 imageSet,
uint32 cacheMode);
~BackgroundImageInfo();
@ -94,7 +94,7 @@ class BackgroundImage {
int32 fImageIndex;
Mode fMode;
BPoint fOffset;
bool fEraseTextWidgetBackground;
bool fTextWidgetLabelOutline;
uint32 fImageSet;
uint32 fCacheMode; // image cache strategy (0 cache , 1 no cache)
};

View File

@ -42,7 +42,7 @@ static const uint32 kMsgCenterPlacement = 'cnpl';
static const uint32 kMsgManualPlacement = 'mnpl';
static const uint32 kMsgScalePlacement = 'scpl';
static const uint32 kMsgTilePlacement = 'tlpl';
static const uint32 kMsgIconLabelBackground = 'ilcb';
static const uint32 kMsgIconLabelOutline = 'ilol';
static const uint32 kMsgImagePlacement = 'xypl';
static const uint32 kMsgUpdatePreviewPlacement = 'pvpl';
@ -207,18 +207,18 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
rightbox->AddChild(placementMenuField);
rect.OffsetBy(offset, placementMenuField->Bounds().Height() + 5);
fIconLabelBackground = new BCheckBox(rect, "iconLabelBackground",
"Icon label background", new BMessage(kMsgIconLabelBackground));
fIconLabelBackground->SetValue(B_CONTROL_ON);
fIconLabelBackground->ResizeToPreferred();
rightbox->AddChild(fIconLabelBackground);
fIconLabelOutline = new BCheckBox(rect, "iconLabelOutline",
"Icon label outline", new BMessage(kMsgIconLabelOutline));
fIconLabelOutline->SetValue(B_CONTROL_OFF);
fIconLabelOutline->ResizeToPreferred();
rightbox->AddChild(fIconLabelOutline);
rect.top += fIconLabelBackground->Bounds().Height() + 15;
rect.top += fIconLabelOutline->Bounds().Height() + 15;
fPicker = new BColorControl(BPoint(10, rect.top), B_CELLS_32x8, 5.0, "Picker",
new BMessage(kMsgUpdateColor));
rightbox->AddChild(fPicker);
float xDelta = max_c(fIconLabelBackground->Frame().right, fPicker->Frame().right)
float xDelta = max_c(fIconLabelOutline->Frame().right, fPicker->Frame().right)
+ 10.0f - rightbox->Bounds().Width();
delta = fPicker->Frame().bottom + 10.0f - rightbox->Bounds().Height();
@ -273,7 +273,7 @@ BackgroundsView::AllAttached()
fWorkspaceMenu->SetTargetForItems(this);
fXPlacementText->SetTarget(this);
fYPlacementText->SetTarget(this);
fIconLabelBackground->SetTarget(this);
fIconLabelOutline->SetTarget(this);
fPicker->SetTarget(this);
fApply->SetTarget(this);
fRevert->SetTarget(this);
@ -326,7 +326,7 @@ BackgroundsView::MessageReceived(BMessage *msg)
UpdateButtons();
break;
case kMsgIconLabelBackground:
case kMsgIconLabelOutline:
UpdateButtons();
break;
@ -507,8 +507,9 @@ BackgroundsView::UpdateWithCurrent(void)
if (!fCurrentInfo) {
fImageMenu->FindItem(kMsgNoImage)->SetMarked(true);
fPlacementMenu->FindItem(kMsgManualPlacement)->SetMarked(true);
fIconLabelOutline->SetValue(B_CONTROL_OFF);
} else {
fIconLabelBackground->SetValue(fCurrentInfo->fEraseTextWidgetBackground
fIconLabelOutline->SetValue(fCurrentInfo->fTextWidgetLabelOutline
? B_CONTROL_ON : B_CONTROL_OFF);
BString xtext, ytext;
@ -557,18 +558,18 @@ BackgroundsView::UpdateWithCurrent(void)
void
BackgroundsView::Save()
{
bool eraseTextWidgetBackground =
fIconLabelBackground->Value() == B_CONTROL_ON;
bool textWidgetLabelOutline =
fIconLabelOutline->Value() == B_CONTROL_ON;
BackgroundImage::Mode mode = FindPlacementMode();
BPoint offset(atoi(fXPlacementText->Text()), atoi(fYPlacementText->Text()));
if (!fCurrent->IsDesktop()) {
if (fCurrentInfo == NULL) {
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(B_ALL_WORKSPACES,
fLastImageIndex, mode, offset, eraseTextWidgetBackground, 0, 0);
fLastImageIndex, mode, offset, textWidgetLabelOutline, 0, 0);
fCurrent->Add(fCurrentInfo);
} else {
fCurrentInfo->fEraseTextWidgetBackground = eraseTextWidgetBackground;
fCurrentInfo->fTextWidgetLabelOutline = textWidgetLabelOutline;
fCurrentInfo->fMode = mode;
if (fCurrentInfo->fMode == BackgroundImage::kAtOffset)
fCurrentInfo->fOffset = offset;
@ -588,14 +589,14 @@ BackgroundsView::Save()
if (fLastImageIndex > -1) {
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
workspaceMask, fLastImageIndex, mode, offset,
eraseTextWidgetBackground, fCurrentInfo->fImageSet,
textWidgetLabelOutline, fCurrentInfo->fImageSet,
fCurrentInfo->fCacheMode);
fCurrent->Add(fCurrentInfo);
}
} else {
if (fLastImageIndex > -1) {
fCurrentInfo->fEraseTextWidgetBackground =
eraseTextWidgetBackground;
fCurrentInfo->fTextWidgetLabelOutline =
textWidgetLabelOutline;
fCurrentInfo->fMode = mode;
if (fCurrentInfo->fMode == BackgroundImage::kAtOffset)
fCurrentInfo->fOffset = offset;
@ -610,7 +611,7 @@ BackgroundsView::Save()
fCurrent->RemoveAll();
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
B_ALL_WORKSPACES, fLastImageIndex, mode, offset,
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(),
textWidgetLabelOutline, fCurrent->GetShowingImageSet(),
fCurrentInfo->fCacheMode);
fCurrent->Add(fCurrentInfo);
}
@ -618,12 +619,12 @@ BackgroundsView::Save()
if (fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()) {
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
workspaceMask, fLastImageIndex, mode, offset,
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(), 0);
textWidgetLabelOutline, fCurrent->GetShowingImageSet(), 0);
} else {
fCurrent->RemoveAll();
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
B_ALL_WORKSPACES, fLastImageIndex, mode, offset,
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(), 0);
textWidgetLabelOutline, fCurrent->GetShowingImageSet(), 0);
}
fCurrent->Add(fCurrentInfo);
}
@ -836,8 +837,8 @@ BackgroundsView::UpdatePreview()
bool imageEnabled = !(fImageMenu->FindItem(kMsgNoImage)->IsMarked());
if (fPlacementMenu->IsEnabled() ^ imageEnabled)
fPlacementMenu->SetEnabled(imageEnabled);
if (fIconLabelBackground->IsEnabled() ^ imageEnabled)
fIconLabelBackground->SetEnabled(imageEnabled);
if (fIconLabelOutline->IsEnabled() ^ imageEnabled)
fIconLabelOutline->SetEnabled(imageEnabled);
bool textEnabled = (fPlacementMenu->FindItem(kMsgManualPlacement)->IsMarked())
&& imageEnabled;
@ -870,7 +871,7 @@ BackgroundsView::UpdatePreview()
new BackgroundImage::BackgroundImageInfo(0, index,
FindPlacementMode(), BPoint(atoi(fXPlacementText->Text()),
atoi(fYPlacementText->Text())),
fIconLabelBackground->Value() == B_CONTROL_ON, 0, 0);
fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0);
if (info->fMode == BackgroundImage::kAtOffset) {
fPreView->SetEnabled(true);
fPreView->fPoint.x = atoi(fXPlacementText->Text());
@ -923,8 +924,8 @@ BackgroundsView::UpdateButtons()
&& fPicker->ValueAsColor() != BScreen().DesktopColor()) {
hasChanged = true;
} else if (fCurrentInfo) {
if ((fIconLabelBackground->Value() == B_CONTROL_ON) ^
fCurrentInfo->fEraseTextWidgetBackground) {
if ((fIconLabelOutline->Value() == B_CONTROL_ON) ^
fCurrentInfo->fTextWidgetLabelOutline) {
hasChanged = true;
} else if (FindPlacementMode() != fCurrentInfo->fMode) {
hasChanged = true;

View File

@ -118,7 +118,7 @@ class BackgroundsView : public BBox {
BColorControl *fPicker; // color picker
BButton *fApply, *fRevert; // apply and revert buttons
BCheckBox *fIconLabelBackground; // label ckeckbox
BCheckBox *fIconLabelOutline; // label ckeckbox
BMenu* fPlacementMenu, *fImageMenu, *fWorkspaceMenu; // the three comboboxes
BTextControl *fXPlacementText, *fYPlacementText; // x and y textboxes
PreView *fPreView; // the view for previewing the result