Partial clean-up.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33911 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
dca191e9b7
commit
71a1ec0dd3
@ -305,8 +305,8 @@ BackgroundsView::AllAttached()
|
|||||||
B_DIRECTORY_NODE, false, NULL, new CustomRefFilter(false));
|
B_DIRECTORY_NODE, false, NULL, new CustomRefFilter(false));
|
||||||
fFolderPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
fFolderPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||||
|
|
||||||
LoadSettings();
|
_LoadSettings();
|
||||||
LoadDesktopFolder();
|
_LoadDesktopFolder();
|
||||||
|
|
||||||
BPoint point;
|
BPoint point;
|
||||||
if (fSettings.FindPoint("pos", &point) == B_OK) {
|
if (fSettings.FindPoint("pos", &point) == B_OK) {
|
||||||
@ -335,31 +335,31 @@ BackgroundsView::MessageReceived(BMessage* msg)
|
|||||||
ystring << (int)fPreView->fPoint.y;
|
ystring << (int)fPreView->fPoint.y;
|
||||||
fXPlacementText->SetText(xstring.String());
|
fXPlacementText->SetText(xstring.String());
|
||||||
fYPlacementText->SetText(ystring.String());
|
fYPlacementText->SetText(ystring.String());
|
||||||
UpdatePreview();
|
_UpdatePreview();
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kMsgManualPlacement:
|
case kMsgManualPlacement:
|
||||||
UpdatePreview();
|
_UpdatePreview();
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgTilePlacement:
|
case kMsgTilePlacement:
|
||||||
case kMsgScalePlacement:
|
case kMsgScalePlacement:
|
||||||
case kMsgCenterPlacement:
|
case kMsgCenterPlacement:
|
||||||
UpdatePreview();
|
_UpdatePreview();
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgIconLabelOutline:
|
case kMsgIconLabelOutline:
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgUpdateColor:
|
case kMsgUpdateColor:
|
||||||
case kMsgImagePlacement:
|
case kMsgImagePlacement:
|
||||||
UpdatePreview();
|
_UpdatePreview();
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgCurrentWorkspace:
|
case kMsgCurrentWorkspace:
|
||||||
@ -368,10 +368,10 @@ BackgroundsView::MessageReceived(BMessage* msg)
|
|||||||
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(
|
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(
|
||||||
fWorkspaceMenu->FindMarked());
|
fWorkspaceMenu->FindMarked());
|
||||||
if (fCurrent && fCurrent->IsDesktop()) {
|
if (fCurrent && fCurrent->IsDesktop()) {
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
} else {
|
} else {
|
||||||
SetDesktop(true);
|
_SetDesktop(true);
|
||||||
LoadDesktopFolder();
|
_LoadDesktopFolder();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -379,8 +379,8 @@ BackgroundsView::MessageReceived(BMessage* msg)
|
|||||||
fImageMenu->FindItem(kMsgNoImage)->SetLabel("None");
|
fImageMenu->FindItem(kMsgNoImage)->SetLabel("None");
|
||||||
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(
|
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(
|
||||||
fWorkspaceMenu->FindMarked());
|
fWorkspaceMenu->FindMarked());
|
||||||
SetDesktop(false);
|
_SetDesktop(false);
|
||||||
LoadDefaultFolder();
|
_LoadDefaultFolder();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgOtherFolder:
|
case kMsgOtherFolder:
|
||||||
@ -398,7 +398,7 @@ BackgroundsView::MessageReceived(BMessage* msg)
|
|||||||
msg->FindPointer("source", &pointer);
|
msg->FindPointer("source", &pointer);
|
||||||
if (pointer == fPanel) {
|
if (pointer == fPanel) {
|
||||||
if (fLastImageIndex >= 0)
|
if (fLastImageIndex >= 0)
|
||||||
FindImageItem(fLastImageIndex)->SetMarked(true);
|
_FindImageItem(fLastImageIndex)->SetMarked(true);
|
||||||
else
|
else
|
||||||
fImageMenu->ItemAt(0)->SetMarked(true);
|
fImageMenu->ItemAt(0)->SetMarked(true);
|
||||||
} else if (pointer == fFolderPanel) {
|
} else if (pointer == fFolderPanel) {
|
||||||
@ -413,34 +413,34 @@ BackgroundsView::MessageReceived(BMessage* msg)
|
|||||||
case kMsgNoImage:
|
case kMsgNoImage:
|
||||||
fLastImageIndex = ((BGImageMenuItem*)fImageMenu->FindMarked())
|
fLastImageIndex = ((BGImageMenuItem*)fImageMenu->FindMarked())
|
||||||
->ImageIndex();
|
->ImageIndex();
|
||||||
UpdatePreview();
|
_UpdatePreview();
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgFolderSelected:
|
case kMsgFolderSelected:
|
||||||
fImageMenu->FindItem(kMsgNoImage)->SetLabel("Default");
|
fImageMenu->FindItem(kMsgNoImage)->SetLabel("Default");
|
||||||
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(
|
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(
|
||||||
fWorkspaceMenu->FindMarked());
|
fWorkspaceMenu->FindMarked());
|
||||||
SetDesktop(false);
|
_SetDesktop(false);
|
||||||
|
|
||||||
LoadRecentFolder(*fPathList.ItemAt(fWorkspaceMenu->IndexOf(
|
_LoadRecentFolder(*fPathList.ItemAt(fWorkspaceMenu->IndexOf(
|
||||||
fWorkspaceMenu->FindMarked()) - 6));
|
fWorkspaceMenu->FindMarked()) - 6));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgApplySettings:
|
case kMsgApplySettings:
|
||||||
{
|
{
|
||||||
Save();
|
_Save();
|
||||||
|
|
||||||
//NotifyServer();
|
//_NotifyServer();
|
||||||
thread_id notify_thread;
|
thread_id notify_thread;
|
||||||
notify_thread = spawn_thread(BackgroundsView::NotifyThread,
|
notify_thread = spawn_thread(BackgroundsView::_NotifyThread,
|
||||||
"notifyServer", B_NORMAL_PRIORITY, this);
|
"notifyServer", B_NORMAL_PRIORITY, this);
|
||||||
resume_thread(notify_thread);
|
resume_thread(notify_thread);
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kMsgRevertSettings:
|
case kMsgRevertSettings:
|
||||||
UpdateWithCurrent();
|
_UpdateWithCurrent();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -451,7 +451,7 @@ BackgroundsView::MessageReceived(BMessage* msg)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::LoadDesktopFolder()
|
BackgroundsView::_LoadDesktopFolder()
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_DESKTOP_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_DESKTOP_DIRECTORY, &path) == B_OK) {
|
||||||
@ -459,13 +459,13 @@ BackgroundsView::LoadDesktopFolder()
|
|||||||
err = get_ref_for_path(path.Path(), &fCurrentRef);
|
err = get_ref_for_path(path.Path(), &fCurrentRef);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
printf("error in LoadDesktopSettings\n");
|
printf("error in LoadDesktopSettings\n");
|
||||||
LoadFolder(true);
|
_LoadFolder(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::LoadDefaultFolder()
|
BackgroundsView::_LoadDefaultFolder()
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||||
@ -475,24 +475,24 @@ BackgroundsView::LoadDefaultFolder()
|
|||||||
err = get_ref_for_path(pathString.String(), &fCurrentRef);
|
err = get_ref_for_path(pathString.String(), &fCurrentRef);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
printf("error in LoadDefaultFolderSettings\n");
|
printf("error in LoadDefaultFolderSettings\n");
|
||||||
LoadFolder(false);
|
_LoadFolder(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::LoadRecentFolder(BPath path)
|
BackgroundsView::_LoadRecentFolder(BPath path)
|
||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
err = get_ref_for_path(path.Path(), &fCurrentRef);
|
err = get_ref_for_path(path.Path(), &fCurrentRef);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
printf("error in LoadRecentFolder\n");
|
printf("error in LoadRecentFolder\n");
|
||||||
LoadFolder(false);
|
_LoadFolder(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::LoadFolder(bool isDesktop)
|
BackgroundsView::_LoadFolder(bool isDesktop)
|
||||||
{
|
{
|
||||||
if (fCurrent) {
|
if (fCurrent) {
|
||||||
delete fCurrent;
|
delete fCurrent;
|
||||||
@ -503,12 +503,12 @@ BackgroundsView::LoadFolder(bool isDesktop)
|
|||||||
if (node.InitCheck() == B_OK)
|
if (node.InitCheck() == B_OK)
|
||||||
fCurrent = BackgroundImage::GetBackgroundImage(&node, isDesktop, this);
|
fCurrent = BackgroundImage::GetBackgroundImage(&node, isDesktop, this);
|
||||||
|
|
||||||
UpdateWithCurrent();
|
_UpdateWithCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::UpdateWithCurrent(void)
|
BackgroundsView::_UpdateWithCurrent(void)
|
||||||
{
|
{
|
||||||
if (fCurrent == NULL)
|
if (fCurrent == NULL)
|
||||||
return;
|
return;
|
||||||
@ -529,7 +529,7 @@ BackgroundsView::UpdateWithCurrent(void)
|
|||||||
|
|
||||||
for (int32 i = fImageList.CountItems() - 1; i >= 0; i--) {
|
for (int32 i = fImageList.CountItems() - 1; i >= 0; i--) {
|
||||||
BMessage* message = new BMessage(kMsgImageSelected);
|
BMessage* message = new BMessage(kMsgImageSelected);
|
||||||
AddItem(new BGImageMenuItem(GetImage(i)->GetName(), i, message));
|
_AddItem(new BGImageMenuItem(GetImage(i)->GetName(), i, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
fImageMenu->SetTargetForItems(this);
|
fImageMenu->SetTargetForItems(this);
|
||||||
@ -545,7 +545,7 @@ BackgroundsView::UpdateWithCurrent(void)
|
|||||||
? B_CONTROL_ON : B_CONTROL_OFF);
|
? B_CONTROL_ON : B_CONTROL_OFF);
|
||||||
|
|
||||||
fLastImageIndex = fCurrentInfo->fImageIndex;
|
fLastImageIndex = fCurrentInfo->fImageIndex;
|
||||||
FindImageItem(fLastImageIndex)->SetMarked(true);
|
_FindImageItem(fLastImageIndex)->SetMarked(true);
|
||||||
|
|
||||||
if (fLastImageIndex > -1) {
|
if (fLastImageIndex > -1) {
|
||||||
|
|
||||||
@ -587,18 +587,18 @@ BackgroundsView::UpdateWithCurrent(void)
|
|||||||
|
|
||||||
fPicker->SetValue(color);
|
fPicker->SetValue(color);
|
||||||
|
|
||||||
UpdatePreview();
|
_UpdatePreview();
|
||||||
UpdateButtons();
|
_UpdateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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()));
|
||||||
|
|
||||||
if (!fCurrent->IsDesktop()) {
|
if (!fCurrent->IsDesktop()) {
|
||||||
@ -682,7 +682,7 @@ BackgroundsView::Save()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::NotifyServer()
|
BackgroundsView::_NotifyServer()
|
||||||
{
|
{
|
||||||
BMessenger tracker("application/x-vnd.Be-TRAK");
|
BMessenger tracker("application/x-vnd.Be-TRAK");
|
||||||
|
|
||||||
@ -760,11 +760,11 @@ BackgroundsView::NotifyServer()
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
BackgroundsView::NotifyThread(void* data)
|
BackgroundsView::_NotifyThread(void* data)
|
||||||
{
|
{
|
||||||
BackgroundsView* view = (BackgroundsView*)data;
|
BackgroundsView* view = (BackgroundsView*)data;
|
||||||
|
|
||||||
view->NotifyServer();
|
view->_NotifyServer();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -807,7 +807,7 @@ BackgroundsView::SaveSettings(void)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::LoadSettings()
|
BackgroundsView::_LoadSettings()
|
||||||
{
|
{
|
||||||
fSettings.MakeEmpty();
|
fSettings.MakeEmpty();
|
||||||
|
|
||||||
@ -840,7 +840,7 @@ BackgroundsView::LoadSettings()
|
|||||||
fWorkspaceMenu->AddSeparatorItem();
|
fWorkspaceMenu->AddSeparatorItem();
|
||||||
|
|
||||||
path.SetTo(string.String());
|
path.SetTo(string.String());
|
||||||
int32 i = AddPath(path);
|
int32 i = _AddPath(path);
|
||||||
BString s;
|
BString s;
|
||||||
s << "Folder: " << path.Leaf();
|
s << "Folder: " << path.Leaf();
|
||||||
BMenuItem* item = new BMenuItem(s.String(),
|
BMenuItem* item = new BMenuItem(s.String(),
|
||||||
@ -857,12 +857,12 @@ BackgroundsView::LoadSettings()
|
|||||||
void
|
void
|
||||||
BackgroundsView::WorkspaceActivated(uint32 oldWorkspaces, bool active)
|
BackgroundsView::WorkspaceActivated(uint32 oldWorkspaces, bool active)
|
||||||
{
|
{
|
||||||
UpdateWithCurrent();
|
_UpdateWithCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::UpdatePreview()
|
BackgroundsView::_UpdatePreview()
|
||||||
{
|
{
|
||||||
bool imageEnabled = !(fImageMenu->FindItem(kMsgNoImage)->IsMarked());
|
bool imageEnabled = !(fImageMenu->FindItem(kMsgNoImage)->IsMarked());
|
||||||
if (fPlacementMenu->IsEnabled() ^ imageEnabled)
|
if (fPlacementMenu->IsEnabled() ^ imageEnabled)
|
||||||
@ -898,7 +898,7 @@ BackgroundsView::UpdatePreview()
|
|||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
BackgroundImage::BackgroundImageInfo* info
|
BackgroundImage::BackgroundImageInfo* info
|
||||||
= new BackgroundImage::BackgroundImageInfo(0, index,
|
= new BackgroundImage::BackgroundImageInfo(0, index,
|
||||||
FindPlacementMode(), BPoint(atoi(fXPlacementText->Text()),
|
_FindPlacementMode(), BPoint(atoi(fXPlacementText->Text()),
|
||||||
atoi(fYPlacementText->Text())),
|
atoi(fYPlacementText->Text())),
|
||||||
fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0);
|
fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0);
|
||||||
if (info->fMode == BackgroundImage::kAtOffset) {
|
if (info->fMode == BackgroundImage::kAtOffset) {
|
||||||
@ -920,7 +920,7 @@ BackgroundsView::UpdatePreview()
|
|||||||
|
|
||||||
|
|
||||||
BackgroundImage::Mode
|
BackgroundImage::Mode
|
||||||
BackgroundsView::FindPlacementMode()
|
BackgroundsView::_FindPlacementMode()
|
||||||
{
|
{
|
||||||
BackgroundImage::Mode mode = BackgroundImage::kAtOffset;
|
BackgroundImage::Mode mode = BackgroundImage::kAtOffset;
|
||||||
|
|
||||||
@ -938,7 +938,7 @@ BackgroundsView::FindPlacementMode()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::UpdateButtons()
|
BackgroundsView::_UpdateButtons()
|
||||||
{
|
{
|
||||||
bool hasChanged = false;
|
bool hasChanged = false;
|
||||||
if (fPicker->IsEnabled()
|
if (fPicker->IsEnabled()
|
||||||
@ -948,7 +948,7 @@ BackgroundsView::UpdateButtons()
|
|||||||
if ((fIconLabelOutline->Value() == B_CONTROL_ON)
|
if ((fIconLabelOutline->Value() == B_CONTROL_ON)
|
||||||
^ fCurrentInfo->fTextWidgetLabelOutline) {
|
^ fCurrentInfo->fTextWidgetLabelOutline) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if (FindPlacementMode() != fCurrentInfo->fMode) {
|
} else if (_FindPlacementMode() != fCurrentInfo->fMode) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if (fCurrentInfo->fImageIndex
|
} else if (fCurrentInfo->fImageIndex
|
||||||
!= ((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex()) {
|
!= ((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex()) {
|
||||||
@ -1012,13 +1012,13 @@ BackgroundsView::RefsReceived(BMessage* msg)
|
|||||||
BGImageMenuItem* item;
|
BGImageMenuItem* item;
|
||||||
int32 index = AddImage(path);
|
int32 index = AddImage(path);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
item = FindImageItem(index);
|
item = _FindImageItem(index);
|
||||||
fLastImageIndex = index;
|
fLastImageIndex = index;
|
||||||
} else {
|
} else {
|
||||||
const char* name = GetImage(-index - 1)->GetName();
|
const char* name = GetImage(-index - 1)->GetName();
|
||||||
item = new BGImageMenuItem(name, -index - 1,
|
item = new BGImageMenuItem(name, -index - 1,
|
||||||
new BMessage(kMsgImageSelected));
|
new BMessage(kMsgImageSelected));
|
||||||
AddItem(item);
|
_AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
fLastImageIndex = -index - 1;
|
fLastImageIndex = -index - 1;
|
||||||
}
|
}
|
||||||
@ -1039,7 +1039,7 @@ BackgroundsView::RefsReceived(BMessage* msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
int32 index = AddPath(path);
|
int32 index = _AddPath(path);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
item = fWorkspaceMenu->ItemAt(index + 6);
|
item = fWorkspaceMenu->ItemAt(index + 6);
|
||||||
fLastWorkspaceIndex = index + 6;
|
fLastWorkspaceIndex = index + 6;
|
||||||
@ -1063,7 +1063,7 @@ BackgroundsView::RefsReceived(BMessage* msg)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
BackgroundsView::AddPath(BPath path)
|
BackgroundsView::_AddPath(BPath path)
|
||||||
{
|
{
|
||||||
int32 count = fPathList.CountItems();
|
int32 count = fPathList.CountItems();
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
@ -1105,7 +1105,7 @@ BackgroundsView::GetImage(int32 imageIndex)
|
|||||||
|
|
||||||
|
|
||||||
BGImageMenuItem*
|
BGImageMenuItem*
|
||||||
BackgroundsView::FindImageItem(const int32 imageIndex)
|
BackgroundsView::_FindImageItem(const int32 imageIndex)
|
||||||
{
|
{
|
||||||
if (imageIndex < 0)
|
if (imageIndex < 0)
|
||||||
return (BGImageMenuItem*)fImageMenu->ItemAt(0);
|
return (BGImageMenuItem*)fImageMenu->ItemAt(0);
|
||||||
@ -1122,7 +1122,7 @@ BackgroundsView::FindImageItem(const int32 imageIndex)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BackgroundsView::AddItem(BGImageMenuItem* item)
|
BackgroundsView::_AddItem(BGImageMenuItem* item)
|
||||||
{
|
{
|
||||||
int32 count = fImageMenu->CountItems() - 2;
|
int32 count = fImageMenu->CountItems() - 2;
|
||||||
int32 index = 2;
|
int32 index = 2;
|
||||||
@ -1142,7 +1142,7 @@ BackgroundsView::AddItem(BGImageMenuItem* item)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::SetDesktop(bool isDesktop)
|
BackgroundsView::_SetDesktop(bool isDesktop)
|
||||||
{
|
{
|
||||||
fTopLeft->SetDesktop(isDesktop);
|
fTopLeft->SetDesktop(isDesktop);
|
||||||
fTop->SetDesktop(isDesktop);
|
fTop->SetDesktop(isDesktop);
|
||||||
@ -1200,9 +1200,9 @@ PreView::MouseDown(BPoint point)
|
|||||||
if (buttons & B_PRIMARY_MOUSE_BUTTON) {
|
if (buttons & B_PRIMARY_MOUSE_BUTTON) {
|
||||||
fOldPoint = point;
|
fOldPoint = point;
|
||||||
SetTracking(true);
|
SetTracking(true);
|
||||||
BScreen().GetMode(&mode);
|
BScreen().GetMode(&fMode);
|
||||||
x_ratio = Bounds().Width() / mode.virtual_width;
|
fXRatio = Bounds().Width() / fMode.virtual_width;
|
||||||
y_ratio = Bounds().Height() / mode.virtual_height;
|
fYRatio = Bounds().Height() / fMode.virtual_height;
|
||||||
SetMouseEventMask(B_POINTER_EVENTS,
|
SetMouseEventMask(B_POINTER_EVENTS,
|
||||||
B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
|
B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
|
||||||
}
|
}
|
||||||
@ -1228,11 +1228,11 @@ PreView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
|||||||
|
|
||||||
if (IsTracking()) {
|
if (IsTracking()) {
|
||||||
float x, y;
|
float x, y;
|
||||||
x = fPoint.x + (point.x - fOldPoint.x) / x_ratio;
|
x = fPoint.x + (point.x - fOldPoint.x) / fXRatio;
|
||||||
y = fPoint.y + (point.y - fOldPoint.y) / y_ratio;
|
y = fPoint.y + (point.y - fOldPoint.y) / fYRatio;
|
||||||
bool min, max, mustSend = false;
|
bool min, max, mustSend = false;
|
||||||
min = (x > -fImageBounds.Width());
|
min = (x > -fImageBounds.Width());
|
||||||
max = (x < mode.virtual_width);
|
max = (x < fMode.virtual_width);
|
||||||
if (min && max) {
|
if (min && max) {
|
||||||
fOldPoint.x = point.x;
|
fOldPoint.x = point.x;
|
||||||
fPoint.x = x;
|
fPoint.x = x;
|
||||||
@ -1240,18 +1240,18 @@ PreView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
|||||||
} else {
|
} else {
|
||||||
if (!min && fPoint.x > -fImageBounds.Width()) {
|
if (!min && fPoint.x > -fImageBounds.Width()) {
|
||||||
fPoint.x = -fImageBounds.Width();
|
fPoint.x = -fImageBounds.Width();
|
||||||
fOldPoint.x = point.x - (x - fPoint.x) * x_ratio;
|
fOldPoint.x = point.x - (x - fPoint.x) * fXRatio;
|
||||||
mustSend = true;
|
mustSend = true;
|
||||||
}
|
}
|
||||||
if (!max && fPoint.x < mode.virtual_width) {
|
if (!max && fPoint.x < fMode.virtual_width) {
|
||||||
fPoint.x = mode.virtual_width;
|
fPoint.x = fMode.virtual_width;
|
||||||
fOldPoint.x = point.x - (x - fPoint.x) * x_ratio;
|
fOldPoint.x = point.x - (x - fPoint.x) * fXRatio;
|
||||||
mustSend = true;
|
mustSend = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
min = (y > -fImageBounds.Height());
|
min = (y > -fImageBounds.Height());
|
||||||
max = (y < mode.virtual_height);
|
max = (y < fMode.virtual_height);
|
||||||
if (min && max) {
|
if (min && max) {
|
||||||
fOldPoint.y = point.y;
|
fOldPoint.y = point.y;
|
||||||
fPoint.y = y;
|
fPoint.y = y;
|
||||||
@ -1259,12 +1259,12 @@ PreView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
|||||||
} else {
|
} else {
|
||||||
if (!min && fPoint.y > -fImageBounds.Height()) {
|
if (!min && fPoint.y > -fImageBounds.Height()) {
|
||||||
fPoint.y = -fImageBounds.Height();
|
fPoint.y = -fImageBounds.Height();
|
||||||
fOldPoint.y = point.y - (y - fPoint.y) * y_ratio;
|
fOldPoint.y = point.y - (y - fPoint.y) * fYRatio;
|
||||||
mustSend = true;
|
mustSend = true;
|
||||||
}
|
}
|
||||||
if (!max && fPoint.y < mode.virtual_height) {
|
if (!max && fPoint.y < fMode.virtual_height) {
|
||||||
fPoint.y = mode.virtual_height;
|
fPoint.y = fMode.virtual_height;
|
||||||
fOldPoint.y = point.y - (y - fPoint.y) * y_ratio;
|
fOldPoint.y = point.y - (y - fPoint.y) * fYRatio;
|
||||||
mustSend = true;
|
mustSend = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,9 +93,9 @@ protected:
|
|||||||
void AttachedToWindow();
|
void AttachedToWindow();
|
||||||
|
|
||||||
BPoint fOldPoint;
|
BPoint fOldPoint;
|
||||||
float x_ratio;
|
float fXRatio;
|
||||||
float y_ratio;
|
float fYRatio;
|
||||||
display_mode mode;
|
display_mode fMode;
|
||||||
|
|
||||||
BCursor fMoveHandCursor;
|
BCursor fMoveHandCursor;
|
||||||
};
|
};
|
||||||
@ -106,6 +106,9 @@ public:
|
|||||||
BackgroundsView();
|
BackgroundsView();
|
||||||
~BackgroundsView();
|
~BackgroundsView();
|
||||||
|
|
||||||
|
void AllAttached();
|
||||||
|
void MessageReceived(BMessage* msg);
|
||||||
|
|
||||||
void RefsReceived(BMessage* msg);
|
void RefsReceived(BMessage* msg);
|
||||||
|
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
@ -117,28 +120,26 @@ public:
|
|||||||
bool FoundPositionSetting();
|
bool FoundPositionSetting();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Save();
|
void _Save();
|
||||||
void NotifyServer();
|
void _NotifyServer();
|
||||||
void LoadSettings();
|
void _LoadSettings();
|
||||||
void AllAttached();
|
void _LoadDesktopFolder();
|
||||||
void MessageReceived(BMessage* msg);
|
void _LoadDefaultFolder();
|
||||||
void LoadDesktopFolder();
|
void _LoadFolder(bool isDesktop);
|
||||||
void LoadDefaultFolder();
|
void _LoadRecentFolder(BPath path);
|
||||||
void LoadFolder(bool isDesktop);
|
void _UpdateWithCurrent();
|
||||||
void LoadRecentFolder(BPath path);
|
void _UpdatePreview();
|
||||||
void UpdateWithCurrent();
|
void _UpdateButtons();
|
||||||
void UpdatePreview();
|
void _SetDesktop(bool isDesktop);
|
||||||
void UpdateButtons();
|
int32 _AddPath(BPath path);
|
||||||
void SetDesktop(bool isDesktop);
|
|
||||||
int32 AddPath(BPath path);
|
|
||||||
|
|
||||||
static int32 NotifyThread(void* data);
|
static int32 _NotifyThread(void* data);
|
||||||
|
|
||||||
BGImageMenuItem* FindImageItem(const int32 imageIndex);
|
BGImageMenuItem* _FindImageItem(const int32 imageIndex);
|
||||||
|
|
||||||
bool AddItem(BGImageMenuItem* item);
|
bool _AddItem(BGImageMenuItem* item);
|
||||||
|
|
||||||
BackgroundImage::Mode FindPlacementMode();
|
BackgroundImage::Mode _FindPlacementMode();
|
||||||
|
|
||||||
BColorControl* fPicker;
|
BColorControl* fPicker;
|
||||||
BButton* fApply;
|
BButton* fApply;
|
||||||
|
Loading…
Reference in New Issue
Block a user