Backgrounds: style fixes.
Change-Id: Id032524dc7278f843ce4fcd6132e273088d2256e Reviewed-on: https://review.haiku-os.org/c/haiku/+/2693 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
parent
e44ab82455
commit
92db199052
@ -7,7 +7,7 @@
|
|||||||
* Jerome Duval, jerome.duval@free.fr
|
* Jerome Duval, jerome.duval@free.fr
|
||||||
* Jonas Sundström, jonas@kirilla.se
|
* Jonas Sundström, jonas@kirilla.se
|
||||||
* John Scipione, jscipione@gmail.com
|
* John Scipione, jscipione@gmail.com
|
||||||
* Brian Hill <supernova@warpmail.net>
|
* Brian Hill, supernova@warpmail.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -411,10 +411,10 @@ BackgroundsView::MessageReceived(BMessage* message)
|
|||||||
_Save();
|
_Save();
|
||||||
|
|
||||||
// Notify the server and Screen preflet
|
// Notify the server and Screen preflet
|
||||||
thread_id notify_thread;
|
thread_id notifyThread;
|
||||||
notify_thread = spawn_thread(BackgroundsView::_NotifyThread,
|
notifyThread = spawn_thread(BackgroundsView::_NotifyThread,
|
||||||
"notifyThread", B_NORMAL_PRIORITY, this);
|
"notifyThread", B_NORMAL_PRIORITY, this);
|
||||||
resume_thread(notify_thread);
|
resume_thread(notifyThread);
|
||||||
_UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -434,9 +434,8 @@ BackgroundsView::_LoadDesktopFolder()
|
|||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_DESKTOP_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_DESKTOP_DIRECTORY, &path) == B_OK) {
|
||||||
status_t err;
|
status_t error = get_ref_for_path(path.Path(), &fCurrentRef);
|
||||||
err = get_ref_for_path(path.Path(), &fCurrentRef);
|
if (error != B_OK)
|
||||||
if (err != B_OK)
|
|
||||||
printf("error in LoadDesktopSettings\n");
|
printf("error in LoadDesktopSettings\n");
|
||||||
_LoadFolder(true);
|
_LoadFolder(true);
|
||||||
}
|
}
|
||||||
@ -450,9 +449,8 @@ BackgroundsView::_LoadDefaultFolder()
|
|||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||||
BString pathString = path.Path();
|
BString pathString = path.Path();
|
||||||
pathString << "/Tracker/DefaultFolderTemplate";
|
pathString << "/Tracker/DefaultFolderTemplate";
|
||||||
status_t err;
|
status_t error = get_ref_for_path(pathString.String(), &fCurrentRef);
|
||||||
err = get_ref_for_path(pathString.String(), &fCurrentRef);
|
if (error != B_OK)
|
||||||
if (err != B_OK)
|
|
||||||
printf("error in LoadDefaultFolderSettings\n");
|
printf("error in LoadDefaultFolderSettings\n");
|
||||||
_LoadFolder(false);
|
_LoadFolder(false);
|
||||||
}
|
}
|
||||||
@ -462,9 +460,8 @@ BackgroundsView::_LoadDefaultFolder()
|
|||||||
void
|
void
|
||||||
BackgroundsView::_LoadRecentFolder(BPath path)
|
BackgroundsView::_LoadRecentFolder(BPath path)
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t error = get_ref_for_path(path.Path(), &fCurrentRef);
|
||||||
err = get_ref_for_path(path.Path(), &fCurrentRef);
|
if (error != B_OK)
|
||||||
if (err != B_OK)
|
|
||||||
printf("error in LoadRecentFolder\n");
|
printf("error in LoadRecentFolder\n");
|
||||||
_LoadFolder(false);
|
_LoadFolder(false);
|
||||||
}
|
}
|
||||||
@ -574,8 +571,7 @@ BackgroundsView::_UpdateWithCurrent(void)
|
|||||||
void
|
void
|
||||||
BackgroundsView::_Save()
|
BackgroundsView::_Save()
|
||||||
{
|
{
|
||||||
bool textWidgetLabelOutline
|
bool textWidgetLabelOutline = fIconLabelOutline->Value() == B_CONTROL_ON;
|
||||||
= fIconLabelOutline->Value() == B_CONTROL_ON;
|
|
||||||
|
|
||||||
BackgroundImage::Mode mode = _FindPlacementMode();
|
BackgroundImage::Mode mode = _FindPlacementMode();
|
||||||
BPoint offset(atoi(fXPlacementText->Text()), atoi(fYPlacementText->Text()));
|
BPoint offset(atoi(fXPlacementText->Text()), atoi(fYPlacementText->Text()));
|
||||||
@ -676,36 +672,36 @@ BackgroundsView::_NotifyServer()
|
|||||||
} else {
|
} else {
|
||||||
int32 i = -1;
|
int32 i = -1;
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
int32 err;
|
int32 error;
|
||||||
BEntry currentEntry(&fCurrentRef);
|
BEntry currentEntry(&fCurrentRef);
|
||||||
BPath currentPath(¤tEntry);
|
BPath currentPath(¤tEntry);
|
||||||
bool isCustomFolder
|
bool isCustomFolder
|
||||||
= !fWorkspaceMenu->FindItem(kMsgDefaultFolder)->IsMarked();
|
= !fWorkspaceMenu->FindItem(kMsgDefaultFolder)->IsMarked();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
BMessage msg(B_GET_PROPERTY);
|
BMessage message(B_GET_PROPERTY);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// look at the "Poses" in every Tracker window
|
// look at the "Poses" in every Tracker window
|
||||||
msg.AddSpecifier("Poses");
|
message.AddSpecifier("Poses");
|
||||||
msg.AddSpecifier("Window", i);
|
message.AddSpecifier("Window", i);
|
||||||
|
|
||||||
reply.MakeEmpty();
|
reply.MakeEmpty();
|
||||||
tracker.SendMessage(&msg, &reply);
|
tracker.SendMessage(&message, &reply);
|
||||||
|
|
||||||
// break out of the loop when we're at the end of
|
// break out of the loop when we're at the end of
|
||||||
// the windows
|
// the windows
|
||||||
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD
|
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD
|
||||||
&& reply.FindInt32("error", &err) == B_OK
|
&& reply.FindInt32("error", &error) == B_OK
|
||||||
&& err == B_BAD_INDEX)
|
&& error == B_BAD_INDEX)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// don't stop for windows that don't understand
|
// don't stop for windows that don't understand
|
||||||
// a request for "Poses"; they're not displaying
|
// a request for "Poses"; they're not displaying
|
||||||
// folders
|
// folders
|
||||||
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD
|
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD
|
||||||
&& reply.FindInt32("error", &err) == B_OK
|
&& reply.FindInt32("error", &error) == B_OK
|
||||||
&& err != B_BAD_SCRIPT_SYNTAX)
|
&& error != B_BAD_SCRIPT_SYNTAX)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BMessenger trackerWindow;
|
BMessenger trackerWindow;
|
||||||
@ -714,14 +710,14 @@ BackgroundsView::_NotifyServer()
|
|||||||
|
|
||||||
if (isCustomFolder) {
|
if (isCustomFolder) {
|
||||||
// found a window with poses, ask for its path
|
// found a window with poses, ask for its path
|
||||||
msg.MakeEmpty();
|
message.MakeEmpty();
|
||||||
msg.what = B_GET_PROPERTY;
|
message.what = B_GET_PROPERTY;
|
||||||
msg.AddSpecifier("Path");
|
message.AddSpecifier("Path");
|
||||||
msg.AddSpecifier("Poses");
|
message.AddSpecifier("Poses");
|
||||||
msg.AddSpecifier("Window", i);
|
message.AddSpecifier("Window", i);
|
||||||
|
|
||||||
reply.MakeEmpty();
|
reply.MakeEmpty();
|
||||||
tracker.SendMessage(&msg, &reply);
|
tracker.SendMessage(&message, &reply);
|
||||||
|
|
||||||
// go on with the next if this din't have a path
|
// go on with the next if this din't have a path
|
||||||
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD)
|
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD)
|
||||||
@ -862,6 +858,7 @@ BackgroundsView::_UpdatePreview()
|
|||||||
&& imageEnabled;
|
&& imageEnabled;
|
||||||
if (fXPlacementText->IsEnabled() ^ textEnabled)
|
if (fXPlacementText->IsEnabled() ^ textEnabled)
|
||||||
fXPlacementText->SetEnabled(textEnabled);
|
fXPlacementText->SetEnabled(textEnabled);
|
||||||
|
|
||||||
if (fYPlacementText->IsEnabled() ^ textEnabled)
|
if (fYPlacementText->IsEnabled() ^ textEnabled)
|
||||||
fYPlacementText->SetEnabled(textEnabled);
|
fYPlacementText->SetEnabled(textEnabled);
|
||||||
|
|
||||||
@ -917,10 +914,13 @@ BackgroundsView::_FindPlacementMode()
|
|||||||
|
|
||||||
if (fPlacementMenu->FindItem(kMsgCenterPlacement)->IsMarked())
|
if (fPlacementMenu->FindItem(kMsgCenterPlacement)->IsMarked())
|
||||||
mode = BackgroundImage::kCentered;
|
mode = BackgroundImage::kCentered;
|
||||||
|
|
||||||
if (fPlacementMenu->FindItem(kMsgScalePlacement)->IsMarked())
|
if (fPlacementMenu->FindItem(kMsgScalePlacement)->IsMarked())
|
||||||
mode = BackgroundImage::kScaledToFit;
|
mode = BackgroundImage::kScaledToFit;
|
||||||
|
|
||||||
if (fPlacementMenu->FindItem(kMsgManualPlacement)->IsMarked())
|
if (fPlacementMenu->FindItem(kMsgManualPlacement)->IsMarked())
|
||||||
mode = BackgroundImage::kAtOffset;
|
mode = BackgroundImage::kAtOffset;
|
||||||
|
|
||||||
if (fPlacementMenu->FindItem(kMsgTilePlacement)->IsMarked())
|
if (fPlacementMenu->FindItem(kMsgTilePlacement)->IsMarked())
|
||||||
mode = BackgroundImage::kTiled;
|
mode = BackgroundImage::kTiled;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class FramePart : public BView {
|
|||||||
public:
|
public:
|
||||||
FramePart(int32 part);
|
FramePart(int32 part);
|
||||||
|
|
||||||
void Draw(BRect rect);
|
virtual void Draw(BRect rect);
|
||||||
void SetDesktop(bool isDesktop);
|
void SetDesktop(bool isDesktop);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -86,11 +86,11 @@ public:
|
|||||||
BRect fImageBounds;
|
BRect fImageBounds;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void MouseDown(BPoint point);
|
virtual void MouseDown(BPoint point);
|
||||||
void MouseUp(BPoint point);
|
virtual void MouseUp(BPoint point);
|
||||||
void MouseMoved(BPoint point, uint32 transit,
|
virtual void MouseMoved(BPoint point, uint32 transit,
|
||||||
const BMessage* message);
|
const BMessage* message);
|
||||||
void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
BPoint fOldPoint;
|
BPoint fOldPoint;
|
||||||
float fXRatio;
|
float fXRatio;
|
||||||
|
Loading…
Reference in New Issue
Block a user