Imported SettingsViews.cpp 1.10, FilePanelPriv.cpp 1.14, TrackerSettingsWindow.cpp 1.7,
SettingsViews.h 1.8, FSClipboard.cpp 1.12, PoseView.cpp 1.60, TrackerSettingsWindow.h 1.2, TrackerSettings.cpp 1.11 from the OpenTracker repository. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17688 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -61,6 +61,56 @@ FSClipboardCheckIntegrity()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
MakeNodeFromName(node_ref *node, char *name)
|
||||||
|
{
|
||||||
|
char *nodeString = strchr(name, '_');
|
||||||
|
if (nodeString != NULL) {
|
||||||
|
node->node = strtoll(nodeString + 1, (char **)NULL, 10);
|
||||||
|
node->device = atoi(name + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
sprintf(modeName, "m%ld_%Ld", node->device, node->node);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
MakeModeName(char *name)
|
||||||
|
{
|
||||||
|
name[0] = 'm';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
MakeModeNameFromRefName(char *modeName, char *refName)
|
||||||
|
{
|
||||||
|
strcpy(modeName, refName);
|
||||||
|
modeName[0] = 'm';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
CompareModeAndRefName(const char *modeName, const char *refName)
|
||||||
|
{
|
||||||
|
return !strcmp(refName + 1, modeName + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FSClipboardHasRefs()
|
FSClipboardHasRefs()
|
||||||
{
|
{
|
||||||
@@ -125,53 +175,6 @@ FSClipboardStopWatch(BMessenger target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
MakeNodeFromName(node_ref *node, char *name)
|
|
||||||
{
|
|
||||||
char *nodeString = strchr(name, '_');
|
|
||||||
if (nodeString != NULL) {
|
|
||||||
node->node = strtoll(nodeString + 1, (char **)NULL, 10);
|
|
||||||
node->device = atoi(name + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
sprintf(modeName, "m%ld_%Ld", node->device, node->node);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
MakeModeName(char *name)
|
|
||||||
{
|
|
||||||
name[0] = 'm';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
MakeModeNameFromRefName(char *modeName, char *refName)
|
|
||||||
{
|
|
||||||
strcpy(modeName, refName);
|
|
||||||
modeName[0] = 'm';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
CompareModeAndRefName(const char *modeName, const char *refName)
|
|
||||||
{
|
|
||||||
return !strcmp(refName + 1, modeName + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FSClipboardClear()
|
FSClipboardClear()
|
||||||
{
|
{
|
||||||
@@ -265,7 +268,7 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
|
|||||||
clipNode.moveMode = moveMode; // set it back to current value
|
clipNode.moveMode = moveMode; // set it back to current value
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// add if it doesn't exist
|
// add it if it doesn't exist
|
||||||
if (clip->AddRef(refName, model->EntryRef()) == B_OK
|
if (clip->AddRef(refName, model->EntryRef()) == B_OK
|
||||||
&& clip->AddInt32(modeName, (int32)moveMode) == B_OK) {
|
&& clip->AddInt32(modeName, (int32)moveMode) == B_OK) {
|
||||||
pose->SetClipboardMode(moveMode);
|
pose->SetClipboardMode(moveMode);
|
||||||
@@ -278,7 +281,8 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
|
|||||||
} else {
|
} else {
|
||||||
clip->RemoveName(modeName);
|
clip->RemoveName(modeName);
|
||||||
clip->RemoveName(refName);
|
clip->RemoveName(refName);
|
||||||
// here notifying delete isn't needed as node didn't exist in clipboard
|
// here notifying delete isn't needed as node didn't
|
||||||
|
// exist in clipboard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,7 +301,6 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
|
|||||||
uint32
|
uint32
|
||||||
FSClipboardRemovePoses(const node_ref *directory, PoseList *list)
|
FSClipboardRemovePoses(const node_ref *directory, PoseList *list)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!be_clipboard->Lock())
|
if (!be_clipboard->Lock())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
+123
-123
@@ -32,7 +32,24 @@ names are registered trademarks or trademarks of their respective holders.
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
#include "Attributes.h"
|
||||||
|
#include "AttributeStream.h"
|
||||||
|
#include "AutoLock.h"
|
||||||
|
#include "Commands.h"
|
||||||
|
#include "DesktopPoseView.h"
|
||||||
|
#include "DirMenu.h"
|
||||||
|
#include "FavoritesConfig.h"
|
||||||
|
#include "FavoritesMenu.h"
|
||||||
|
#include "FilePanelPriv.h"
|
||||||
|
#include "FSUtils.h"
|
||||||
|
#include "FSClipboard.h"
|
||||||
|
#include "IconMenuItem.h"
|
||||||
|
#include "MimeTypes.h"
|
||||||
|
#include "NavMenu.h"
|
||||||
|
#include "PoseView.h"
|
||||||
|
#include "Tracker.h"
|
||||||
|
#include "tracker_private.h"
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
@@ -57,23 +74,7 @@ All rights reserved.
|
|||||||
#include <Volume.h>
|
#include <Volume.h>
|
||||||
#include <VolumeRoster.h>
|
#include <VolumeRoster.h>
|
||||||
|
|
||||||
#include "Attributes.h"
|
#include <string.h>
|
||||||
#include "AttributeStream.h"
|
|
||||||
#include "AutoLock.h"
|
|
||||||
#include "Commands.h"
|
|
||||||
#include "DesktopPoseView.h"
|
|
||||||
#include "DirMenu.h"
|
|
||||||
#include "FavoritesConfig.h"
|
|
||||||
#include "FavoritesMenu.h"
|
|
||||||
#include "FilePanelPriv.h"
|
|
||||||
#include "FSUtils.h"
|
|
||||||
#include "FSClipboard.h"
|
|
||||||
#include "IconMenuItem.h"
|
|
||||||
#include "MimeTypes.h"
|
|
||||||
#include "NavMenu.h"
|
|
||||||
#include "PoseView.h"
|
|
||||||
#include "Tracker.h"
|
|
||||||
#include "tracker_private.h"
|
|
||||||
|
|
||||||
|
|
||||||
const char *kDefaultFilePanelTemplate = "FilePanelSettings";
|
const char *kDefaultFilePanelTemplate = "FilePanelSettings";
|
||||||
@@ -228,12 +229,12 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
|
|||||||
|
|
||||||
TFilePanel::~TFilePanel()
|
TFilePanel::~TFilePanel()
|
||||||
{
|
{
|
||||||
// regardless of the hide/close method
|
// regardless of the hide/close method
|
||||||
// always get rid of the config window
|
// always get rid of the config window
|
||||||
if (fConfigWindow) {
|
if (fConfigWindow) {
|
||||||
// moved from QuitRequested to ensure that
|
// moved from QuitRequested to ensure that
|
||||||
// if the config window is showing that
|
// if the config window is showing that
|
||||||
// it gets closed as well
|
// it gets closed as well
|
||||||
fConfigWindow->Lock();
|
fConfigWindow->Lock();
|
||||||
fConfigWindow->Quit();
|
fConfigWindow->Quit();
|
||||||
}
|
}
|
||||||
@@ -1028,10 +1029,8 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
// item was double clicked in file panel (PoseView)
|
// item was double clicked in file panel (PoseView)
|
||||||
if (message->FindRef("refs", &ref) == B_OK) {
|
if (message->FindRef("refs", &ref) == B_OK) {
|
||||||
|
|
||||||
BEntry entry(&ref, true);
|
BEntry entry(&ref, true);
|
||||||
if (entry.InitCheck() == B_OK) {
|
if (entry.InitCheck() == B_OK) {
|
||||||
|
|
||||||
// Double-click on dir or link-to-dir ALWAYS opens the dir.
|
// Double-click on dir or link-to-dir ALWAYS opens the dir.
|
||||||
// If more than one dir is selected, the
|
// If more than one dir is selected, the
|
||||||
// first is entered.
|
// first is entered.
|
||||||
@@ -1044,7 +1043,6 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
PoseView()->SwitchDir(&ref);
|
PoseView()->SwitchDir(&ref);
|
||||||
SwitchDirMenuTo(&ref);
|
SwitchDirMenuTo(&ref);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Otherwise, we have a file or a link to a file.
|
// Otherwise, we have a file or a link to a file.
|
||||||
// AdjustButton has already tested the flavor;
|
// AdjustButton has already tested the flavor;
|
||||||
// all we have to do is see if the button is enabled.
|
// all we have to do is see if the button is enabled.
|
||||||
@@ -1058,10 +1056,10 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
message->GetInfo("refs", &type, &count);
|
message->GetInfo("refs", &type, &count);
|
||||||
|
|
||||||
// Don't allow saves of multiple files
|
// Don't allow saves of multiple files
|
||||||
if (count > 1)
|
if (count > 1) {
|
||||||
ShowCenteredAlert("Sorry, saving of more than one item is not allowed.",
|
ShowCenteredAlert("Sorry, saving of more than one item is not allowed.",
|
||||||
"Cancel");
|
"Cancel");
|
||||||
else {
|
} else {
|
||||||
// if we are a savepanel, set up the filepanel correctly
|
// if we are a savepanel, set up the filepanel correctly
|
||||||
// then pass control so we follow the same path as if the user
|
// then pass control so we follow the same path as if the user
|
||||||
// clicked the save button
|
// clicked the save button
|
||||||
@@ -1076,7 +1074,6 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// send handler a message and close
|
// send handler a message and close
|
||||||
BMessage openMessage(*fMessage);
|
BMessage openMessage(*fMessage);
|
||||||
for (int32 index = 0; ; index++) {
|
for (int32 index = 0; ; index++) {
|
||||||
@@ -1091,121 +1088,122 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kSwitchDirectory:
|
case kSwitchDirectory:
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
// this comes from dir menu or nav menu, so switch directories
|
// this comes from dir menu or nav menu, so switch directories
|
||||||
if (message->FindRef("refs", &ref) == B_OK) {
|
if (message->FindRef("refs", &ref) == B_OK) {
|
||||||
BEntry entry(&ref, true);
|
BEntry entry(&ref, true);
|
||||||
if (entry.GetRef(&ref) == B_OK)
|
if (entry.GetRef(&ref) == B_OK)
|
||||||
SetTo(&ref);
|
SetTo(&ref);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kSwitchToHome:
|
case kSwitchToHome:
|
||||||
{
|
{
|
||||||
BPath homePath;
|
BPath homePath;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK
|
if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK
|
||||||
|| get_ref_for_path(homePath.Path(), &ref) != B_OK)
|
|| get_ref_for_path(homePath.Path(), &ref) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SetTo(&ref);
|
SetTo(&ref);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kAddCurrentDir:
|
case kAddCurrentDir:
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
path.Append(kGoDirectory);
|
path.Append(kGoDirectory);
|
||||||
BDirectory goDirectory(path.Path());
|
BDirectory goDirectory(path.Path());
|
||||||
|
|
||||||
if (goDirectory.InitCheck() == B_OK) {
|
if (goDirectory.InitCheck() == B_OK) {
|
||||||
BEntry entry(TargetModel()->EntryRef());
|
BEntry entry(TargetModel()->EntryRef());
|
||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
|
|
||||||
BSymLink link;
|
BSymLink link;
|
||||||
goDirectory.CreateSymLink(TargetModel()->Name(), path.Path(), &link);
|
goDirectory.CreateSymLink(TargetModel()->Name(), path.Path(), &link);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kConfigShow:
|
case kConfigShow:
|
||||||
{
|
{
|
||||||
if (fConfigWindow)
|
if (fConfigWindow) {
|
||||||
fConfigWindow->Activate();
|
fConfigWindow->Activate();
|
||||||
else {
|
break;
|
||||||
BPath path;
|
}
|
||||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
|
||||||
break;
|
|
||||||
|
|
||||||
path.Append(kGoDirectory);
|
BPath path;
|
||||||
BDirectory goDirectory(path.Path());
|
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
if (goDirectory.InitCheck() == B_OK) {
|
path.Append(kGoDirectory);
|
||||||
entry_ref startref;
|
BDirectory goDirectory(path.Path());
|
||||||
BEntry entry;
|
|
||||||
goDirectory.GetEntry(&entry);
|
|
||||||
entry.GetRef(&startref);
|
|
||||||
|
|
||||||
int32 apps, docs, folders;
|
if (goDirectory.InitCheck() == B_OK) {
|
||||||
TrackerSettings().RecentCounts(&apps, &docs, &folders);
|
entry_ref startref;
|
||||||
|
BEntry entry;
|
||||||
|
goDirectory.GetEntry(&entry);
|
||||||
|
entry.GetRef(&startref);
|
||||||
|
|
||||||
// if this is a save panel
|
int32 apps, docs, folders;
|
||||||
// then don't show recent docs controls
|
TrackerSettings().RecentCounts(&apps, &docs, &folders);
|
||||||
if (fIsSavePanel)
|
|
||||||
docs = -1;
|
|
||||||
|
|
||||||
fConfigWindow = new TFavoritesConfigWindow(BRect(0, 0, 320, 24),
|
// if this is a save panel
|
||||||
"Configure Favorites", Feel() == B_MODAL_APP_WINDOW_FEEL,
|
// then don't show recent docs controls
|
||||||
fNodeFlavors, BMessenger(this), &startref, -1, docs, folders);
|
if (fIsSavePanel)
|
||||||
}
|
docs = -1;
|
||||||
}
|
|
||||||
|
fConfigWindow = new TFavoritesConfigWindow(BRect(0, 0, 320, 24),
|
||||||
|
"Configure Favorites", Feel() == B_MODAL_APP_WINDOW_FEEL,
|
||||||
|
fNodeFlavors, BMessenger(this), &startref, -1, docs, folders);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kConfigClose:
|
case kConfigClose:
|
||||||
{
|
{
|
||||||
int32 count = 0;
|
int32 count = 0;
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
// save off whatever was last in the fields
|
// save off whatever was last in the fields
|
||||||
// do this just in case someone didn't tab out
|
// do this just in case someone didn't tab out
|
||||||
if (message->FindInt32("applications", &count) == B_OK)
|
if (message->FindInt32("applications", &count) == B_OK)
|
||||||
settings.SetRecentApplicationsCount(count);
|
settings.SetRecentApplicationsCount(count);
|
||||||
if (message->FindInt32("folders", &count) == B_OK)
|
if (message->FindInt32("folders", &count) == B_OK)
|
||||||
settings.SetRecentFoldersCount(count);
|
settings.SetRecentFoldersCount(count);
|
||||||
if (message->FindInt32("documents", &count) == B_OK)
|
if (message->FindInt32("documents", &count) == B_OK)
|
||||||
settings.SetRecentDocumentsCount(count);
|
settings.SetRecentDocumentsCount(count);
|
||||||
|
|
||||||
settings.SaveSettings(false);
|
settings.SaveSettings(false);
|
||||||
|
|
||||||
fConfigWindow = NULL;
|
fConfigWindow = NULL;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kUpdateAppsCount:
|
case kUpdateAppsCount:
|
||||||
case kUpdateDocsCount:
|
case kUpdateDocsCount:
|
||||||
case kUpdateFolderCount:
|
case kUpdateFolderCount:
|
||||||
{
|
{
|
||||||
// messages sent when the user changes the count
|
// messages sent when the user changes the count
|
||||||
int32 count;
|
int32 count;
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
if (message->FindInt32("count", &count) == B_OK) {
|
if (message->FindInt32("count", &count) == B_OK) {
|
||||||
if (message->what == kUpdateAppsCount)
|
if (message->what == kUpdateAppsCount)
|
||||||
settings.SetRecentApplicationsCount(count);
|
settings.SetRecentApplicationsCount(count);
|
||||||
else if (message->what == kUpdateDocsCount)
|
else if (message->what == kUpdateDocsCount)
|
||||||
settings.SetRecentDocumentsCount(count);
|
settings.SetRecentDocumentsCount(count);
|
||||||
else if (message->what == kUpdateFolderCount)
|
else if (message->what == kUpdateFolderCount)
|
||||||
settings.SetRecentFoldersCount(count);
|
settings.SetRecentFoldersCount(count);
|
||||||
settings.SaveSettings(false);
|
settings.SaveSettings(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kCancelButton:
|
case kCancelButton:
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
@@ -1234,26 +1232,25 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
HandleSaveButton();
|
HandleSaveButton();
|
||||||
} else
|
} else
|
||||||
HandleOpenButton();
|
HandleOpenButton();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_OBSERVER_NOTICE_CHANGE:
|
case B_OBSERVER_NOTICE_CHANGE:
|
||||||
{
|
{
|
||||||
int32 observerWhat;
|
int32 observerWhat;
|
||||||
if (message->FindInt32("be:observe_change_what", &observerWhat) == B_OK) {
|
if (message->FindInt32("be:observe_change_what", &observerWhat) == B_OK) {
|
||||||
switch (observerWhat) {
|
switch (observerWhat) {
|
||||||
case kDesktopFilePanelRootChanged:
|
case kDesktopFilePanelRootChanged:
|
||||||
{
|
{
|
||||||
bool desktopIsRoot = true;
|
bool desktopIsRoot = true;
|
||||||
message->FindBool("DesktopFilePanelRoot", &desktopIsRoot);
|
if (message->FindBool("DesktopFilePanelRoot", &desktopIsRoot) == B_OK)
|
||||||
TrackerSettings().SetDesktopFilePanelRoot(desktopIsRoot);
|
TrackerSettings().SetDesktopFilePanelRoot(desktopIsRoot);
|
||||||
SetTo(TargetModel()->EntryRef());
|
SetTo(TargetModel()->EntryRef());
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_inherited::MessageReceived(message);
|
_inherited::MessageReceived(message);
|
||||||
@@ -1558,9 +1555,12 @@ 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),
|
: BPoseView(model, frame, kListMode, resizeMask),
|
||||||
fIsDesktop(false)
|
fIsDesktop(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2272,22 +2272,36 @@ BPoseView::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kShowSelectionWhenInactiveChanged:
|
case kShowSelectionWhenInactiveChanged:
|
||||||
message->FindBool("ShowSelectionWhenInactive", &fShowSelectionWhenInactive);
|
{
|
||||||
TrackerSettings().SetShowSelectionWhenInactive(fShowSelectionWhenInactive);
|
// Updating the settings here will propagate setting changed
|
||||||
|
// from Tracker to all open file panels as well
|
||||||
|
bool showSelection;
|
||||||
|
if (message->FindBool("ShowSelectionWhenInactive", &showSelection) == B_OK) {
|
||||||
|
fShowSelectionWhenInactive = showSelection;
|
||||||
|
TrackerSettings().SetShowSelectionWhenInactive(fShowSelectionWhenInactive);
|
||||||
|
}
|
||||||
Invalidate();
|
Invalidate();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kTransparentSelectionChanged:
|
case kTransparentSelectionChanged:
|
||||||
message->FindBool("TransparentSelection", &fTransparentSelection);
|
{
|
||||||
TrackerSettings().SetTransparentSelection(fTransparentSelection);
|
bool transparentSelection;
|
||||||
|
if (message->FindBool("TransparentSelection", &transparentSelection) == B_OK) {
|
||||||
|
fTransparentSelection = transparentSelection;
|
||||||
|
TrackerSettings().SetTransparentSelection(fTransparentSelection);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kSortFolderNamesFirstChanged:
|
case kSortFolderNamesFirstChanged:
|
||||||
if (ViewMode() == kListMode) {
|
if (ViewMode() == kListMode) {
|
||||||
|
TrackerSettings settings;
|
||||||
bool sortFolderNamesFirst;
|
bool sortFolderNamesFirst;
|
||||||
message->FindBool("SortFolderNamesFirst", &sortFolderNamesFirst);
|
if (message->FindBool("SortFolderNamesFirst", &sortFolderNamesFirst) == B_OK)
|
||||||
TrackerSettings().SetSortFolderNamesFirst(sortFolderNamesFirst);
|
settings.SetSortFolderNamesFirst(sortFolderNamesFirst);
|
||||||
NameAttributeText::SetSortFolderNamesFirst(sortFolderNamesFirst);
|
|
||||||
|
NameAttributeText::SetSortFolderNamesFirst(settings.SortFolderNamesFirst());
|
||||||
SortPoses();
|
SortPoses();
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
@@ -2295,8 +2309,8 @@ BPoseView::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
case kShowVolumeSpaceBar:
|
case kShowVolumeSpaceBar:
|
||||||
bool enabled;
|
bool enabled;
|
||||||
message->FindBool("ShowVolumeSpaceBar", &enabled);
|
if (message->FindBool("ShowVolumeSpaceBar", &enabled) == B_OK)
|
||||||
TrackerSettings().SetShowVolumeSpaceBar(enabled);
|
TrackerSettings().SetShowVolumeSpaceBar(enabled);
|
||||||
// supposed to fall through
|
// supposed to fall through
|
||||||
case kSpaceBarColorChanged:
|
case kSpaceBarColorChanged:
|
||||||
UpdateVolumeIcons();
|
UpdateVolumeIcons();
|
||||||
|
|||||||
+403
-296
File diff suppressed because it is too large
Load Diff
+148
-140
@@ -51,203 +51,211 @@ class BStringView;
|
|||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
class SettingsView : public BView {
|
class SettingsView : public BView {
|
||||||
public:
|
public:
|
||||||
SettingsView(BRect, const char *);
|
SettingsView(BRect frame, const char *name);
|
||||||
virtual ~SettingsView();
|
virtual ~SettingsView();
|
||||||
|
|
||||||
virtual void SetDefaults();
|
virtual void SetDefaults();
|
||||||
virtual void Revert();
|
virtual void Revert();
|
||||||
virtual void ShowCurrentSettings(bool sendNotices = false);
|
virtual void ShowCurrentSettings();
|
||||||
virtual void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
virtual bool ShowsRevertSettings() const;
|
virtual bool IsRevertable() const;
|
||||||
protected:
|
|
||||||
|
|
||||||
typedef BView _inherited;
|
protected:
|
||||||
|
typedef BView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DesktopSettingsView : public SettingsView {
|
class DesktopSettingsView : public SettingsView {
|
||||||
public:
|
public:
|
||||||
DesktopSettingsView(BRect);
|
DesktopSettingsView(BRect frame);
|
||||||
|
|
||||||
void MessageReceived(BMessage *);
|
virtual void MessageReceived(BMessage *message);
|
||||||
void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
void SetDefaults();
|
virtual void SetDefaults();
|
||||||
void Revert();
|
virtual void Revert();
|
||||||
void ShowCurrentSettings(bool sendNotices = false);
|
virtual void ShowCurrentSettings();
|
||||||
void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
bool ShowsRevertSettings() const;
|
virtual bool IsRevertable() const;
|
||||||
private:
|
|
||||||
BRadioButton *fShowDisksIconRadioButton;
|
|
||||||
BRadioButton *fMountVolumesOntoDesktopRadioButton;
|
|
||||||
BCheckBox *fMountSharedVolumesOntoDesktopCheckBox;
|
|
||||||
BCheckBox *fIntegrateNonBootBeOSDesktopsCheckBox;
|
|
||||||
BCheckBox *fEjectWhenUnmountingCheckBox;
|
|
||||||
|
|
||||||
bool fShowDisksIcon;
|
private:
|
||||||
bool fMountVolumesOntoDesktop;
|
void _SendNotices();
|
||||||
bool fMountSharedVolumesOntoDesktop;
|
|
||||||
bool fIntegrateNonBootBeOSDesktops;
|
|
||||||
bool fEjectWhenUnmounting;
|
|
||||||
|
|
||||||
typedef SettingsView _inherited;
|
BRadioButton *fShowDisksIconRadioButton;
|
||||||
|
BRadioButton *fMountVolumesOntoDesktopRadioButton;
|
||||||
|
BCheckBox *fMountSharedVolumesOntoDesktopCheckBox;
|
||||||
|
BCheckBox *fIntegrateNonBootBeOSDesktopsCheckBox;
|
||||||
|
BCheckBox *fEjectWhenUnmountingCheckBox;
|
||||||
|
|
||||||
|
bool fShowDisksIcon;
|
||||||
|
bool fMountVolumesOntoDesktop;
|
||||||
|
bool fMountSharedVolumesOntoDesktop;
|
||||||
|
bool fIntegrateNonBootBeOSDesktops;
|
||||||
|
bool fEjectWhenUnmounting;
|
||||||
|
|
||||||
|
typedef SettingsView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WindowsSettingsView : public SettingsView {
|
class WindowsSettingsView : public SettingsView {
|
||||||
public:
|
public:
|
||||||
WindowsSettingsView(BRect);
|
WindowsSettingsView(BRect frame);
|
||||||
|
|
||||||
void MessageReceived(BMessage *);
|
virtual void MessageReceived(BMessage *message);
|
||||||
void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
void SetDefaults();
|
virtual void SetDefaults();
|
||||||
void Revert();
|
virtual void Revert();
|
||||||
void ShowCurrentSettings(bool sendNotices = false);
|
virtual void ShowCurrentSettings();
|
||||||
void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
bool ShowsRevertSettings() const;
|
virtual bool IsRevertable() const;
|
||||||
private:
|
|
||||||
BCheckBox *fShowFullPathInTitleBarCheckBox;
|
|
||||||
BCheckBox *fSingleWindowBrowseCheckBox;
|
|
||||||
BCheckBox *fShowNavigatorCheckBox;
|
|
||||||
BCheckBox *fShowSelectionWhenInactiveCheckBox;
|
|
||||||
BCheckBox *fTransparentSelectionCheckBox;
|
|
||||||
BCheckBox *fSortFolderNamesFirstCheckBox;
|
|
||||||
|
|
||||||
bool fShowFullPathInTitleBar;
|
private:
|
||||||
bool fSingleWindowBrowse;
|
BCheckBox *fShowFullPathInTitleBarCheckBox;
|
||||||
bool fShowNavigator;
|
BCheckBox *fSingleWindowBrowseCheckBox;
|
||||||
bool fShowSelectionWhenInactive;
|
BCheckBox *fShowNavigatorCheckBox;
|
||||||
bool fTransparentSelection;
|
BCheckBox *fShowSelectionWhenInactiveCheckBox;
|
||||||
bool fSortFolderNamesFirst;
|
BCheckBox *fOutlineSelectionCheckBox;
|
||||||
|
BCheckBox *fSortFolderNamesFirstCheckBox;
|
||||||
|
|
||||||
typedef SettingsView _inherited;
|
bool fShowFullPathInTitleBar;
|
||||||
|
bool fSingleWindowBrowse;
|
||||||
|
bool fShowNavigator;
|
||||||
|
bool fShowSelectionWhenInactive;
|
||||||
|
bool fTransparentSelection;
|
||||||
|
bool fSortFolderNamesFirst;
|
||||||
|
|
||||||
|
typedef SettingsView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FilePanelSettingsView : public SettingsView {
|
class FilePanelSettingsView : public SettingsView {
|
||||||
public:
|
public:
|
||||||
FilePanelSettingsView(BRect);
|
FilePanelSettingsView(BRect frame);
|
||||||
~FilePanelSettingsView();
|
virtual ~FilePanelSettingsView();
|
||||||
|
|
||||||
void MessageReceived(BMessage *);
|
virtual void MessageReceived(BMessage *message);
|
||||||
void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
void SetDefaults();
|
virtual void SetDefaults();
|
||||||
void Revert();
|
virtual void Revert();
|
||||||
void ShowCurrentSettings(bool sendNotices = false);
|
virtual void ShowCurrentSettings();
|
||||||
void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
bool ShowsRevertSettings() const;
|
virtual bool IsRevertable() const;
|
||||||
|
|
||||||
void GetAndRefreshDisplayedFigures() const;
|
|
||||||
private:
|
|
||||||
BCheckBox *fDesktopFilePanelRootCheckBox;
|
|
||||||
|
|
||||||
BTextControl *fRecentApplicationsTextControl; // Not used for the moment.
|
private:
|
||||||
BTextControl *fRecentDocumentsTextControl;
|
void _GetAndRefreshDisplayedFigures() const;
|
||||||
BTextControl *fRecentFoldersTextControl;
|
void _SendNotices();
|
||||||
|
|
||||||
bool fDesktopFilePanelRoot;
|
BCheckBox *fDesktopFilePanelRootCheckBox;
|
||||||
int32 fRecentApplications; // Not used for the moment,
|
|
||||||
int32 fRecentDocuments;
|
|
||||||
int32 fRecentFolders;
|
|
||||||
|
|
||||||
mutable int32 fDisplayedAppCount; // Not used for the moment.
|
BTextControl *fRecentApplicationsTextControl; // Not used for the moment.
|
||||||
mutable int32 fDisplayedDocCount;
|
BTextControl *fRecentDocumentsTextControl;
|
||||||
mutable int32 fDisplayedFolderCount;
|
BTextControl *fRecentFoldersTextControl;
|
||||||
|
|
||||||
typedef SettingsView _inherited;
|
bool fDesktopFilePanelRoot;
|
||||||
|
int32 fRecentApplications; // Not used for the moment,
|
||||||
|
int32 fRecentDocuments;
|
||||||
|
int32 fRecentFolders;
|
||||||
|
|
||||||
|
mutable int32 fDisplayedAppCount; // Not used for the moment.
|
||||||
|
mutable int32 fDisplayedDocCount;
|
||||||
|
mutable int32 fDisplayedFolderCount;
|
||||||
|
|
||||||
|
typedef SettingsView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TimeFormatSettingsView : public SettingsView {
|
class TimeFormatSettingsView : public SettingsView {
|
||||||
public:
|
public:
|
||||||
TimeFormatSettingsView(BRect);
|
TimeFormatSettingsView(BRect frame);
|
||||||
|
|
||||||
void MessageReceived(BMessage *);
|
virtual void MessageReceived(BMessage *message);
|
||||||
void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
void SetDefaults();
|
virtual void SetDefaults();
|
||||||
void Revert();
|
virtual void Revert();
|
||||||
void ShowCurrentSettings(bool sendNotices = false);
|
virtual void ShowCurrentSettings();
|
||||||
void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
bool ShowsRevertSettings() const;
|
virtual bool IsRevertable() const;
|
||||||
|
|
||||||
void UpdateExamples();
|
private:
|
||||||
private:
|
void _UpdateExamples();
|
||||||
BRadioButton *f24HrRadioButton;
|
void _SendNotices();
|
||||||
BRadioButton *f12HrRadioButton;
|
|
||||||
|
|
||||||
BRadioButton *fYMDRadioButton;
|
BRadioButton *f24HrRadioButton;
|
||||||
BRadioButton *fDMYRadioButton;
|
BRadioButton *f12HrRadioButton;
|
||||||
BRadioButton *fMDYRadioButton;
|
|
||||||
|
|
||||||
BMenuField *fSeparatorMenuField;
|
BRadioButton *fYMDRadioButton;
|
||||||
|
BRadioButton *fDMYRadioButton;
|
||||||
|
BRadioButton *fMDYRadioButton;
|
||||||
|
|
||||||
BStringView *fLongDateExampleView;
|
BMenuField *fSeparatorMenuField;
|
||||||
BStringView *fShortDateExampleView;
|
|
||||||
|
|
||||||
bool f24HrClock;
|
BStringView *fLongDateExampleView;
|
||||||
|
BStringView *fShortDateExampleView;
|
||||||
|
|
||||||
FormatSeparator fSeparator;
|
bool f24HrClock;
|
||||||
DateOrder fFormat;
|
|
||||||
|
|
||||||
typedef SettingsView _inherited;
|
FormatSeparator fSeparator;
|
||||||
|
DateOrder fFormat;
|
||||||
|
|
||||||
|
typedef SettingsView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpaceBarSettingsView : public SettingsView {
|
class SpaceBarSettingsView : public SettingsView {
|
||||||
public:
|
public:
|
||||||
SpaceBarSettingsView(BRect);
|
SpaceBarSettingsView(BRect frame);
|
||||||
~SpaceBarSettingsView();
|
virtual ~SpaceBarSettingsView();
|
||||||
|
|
||||||
void MessageReceived(BMessage *);
|
virtual void MessageReceived(BMessage *message);
|
||||||
void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
void SetDefaults();
|
virtual void SetDefaults();
|
||||||
void Revert();
|
virtual void Revert();
|
||||||
void ShowCurrentSettings(bool sendNotices = false);
|
virtual void ShowCurrentSettings();
|
||||||
void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
bool ShowsRevertSettings() const;
|
virtual bool IsRevertable() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BCheckBox *fSpaceBarShowCheckBox;
|
BCheckBox *fSpaceBarShowCheckBox;
|
||||||
BColorControl *fColorControl;
|
BColorControl *fColorControl;
|
||||||
BMenuField *fColorPicker;
|
BMenuField *fColorPicker;
|
||||||
// BRadioButton *fUsedRadio;
|
int32 fCurrentColor;
|
||||||
// BRadioButton *fWarningRadio;
|
|
||||||
// BRadioButton *fFreeRadio;
|
|
||||||
int32 fCurrentColor;
|
|
||||||
|
|
||||||
bool fSpaceBarShow;
|
bool fSpaceBarShow;
|
||||||
rgb_color fUsedSpaceColor;
|
rgb_color fUsedSpaceColor;
|
||||||
rgb_color fFreeSpaceColor;
|
rgb_color fFreeSpaceColor;
|
||||||
rgb_color fWarningSpaceColor;
|
rgb_color fWarningSpaceColor;
|
||||||
|
|
||||||
typedef SettingsView _inherited;
|
typedef SettingsView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TrashSettingsView : public SettingsView {
|
class TrashSettingsView : public SettingsView {
|
||||||
public:
|
public:
|
||||||
TrashSettingsView(BRect);
|
TrashSettingsView(BRect frame);
|
||||||
|
|
||||||
void MessageReceived(BMessage *);
|
virtual void MessageReceived(BMessage *message);
|
||||||
void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
void SetDefaults();
|
virtual void SetDefaults();
|
||||||
void Revert();
|
virtual void Revert();
|
||||||
void ShowCurrentSettings(bool sendNotices = false);
|
virtual void ShowCurrentSettings();
|
||||||
void RecordRevertSettings();
|
virtual void RecordRevertSettings();
|
||||||
bool ShowsRevertSettings() const;
|
virtual bool IsRevertable() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BCheckBox *fDontMoveFilesToTrashCheckBox;
|
void _SendNotices();
|
||||||
BCheckBox *fAskBeforeDeleteFileCheckBox;
|
|
||||||
|
|
||||||
bool fDontMoveFilesToTrash;
|
BCheckBox *fDontMoveFilesToTrashCheckBox;
|
||||||
bool fAskBeforeDeleteFile;
|
BCheckBox *fAskBeforeDeleteFileCheckBox;
|
||||||
|
|
||||||
typedef SettingsView _inherited;
|
bool fDontMoveFilesToTrash;
|
||||||
|
bool fAskBeforeDeleteFile;
|
||||||
|
|
||||||
|
typedef SettingsView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
#endif
|
#endif // _SETTINGS_VIEWS
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ TTrackerState::LoadSettingsIfNeeded()
|
|||||||
Add(fMountSharedVolumesOntoDesktop =
|
Add(fMountSharedVolumesOntoDesktop =
|
||||||
new BooleanValueSetting("MountSharedVolumesOntoDesktop", false));
|
new BooleanValueSetting("MountSharedVolumesOntoDesktop", false));
|
||||||
Add(fIntegrateNonBootBeOSDesktops = new BooleanValueSetting
|
Add(fIntegrateNonBootBeOSDesktops = new BooleanValueSetting
|
||||||
("IntegrateNonBootBeOSDesktops", true));
|
("IntegrateNonBootBeOSDesktops", false));
|
||||||
Add(fIntegrateAllNonBootDesktops = new BooleanValueSetting
|
Add(fIntegrateAllNonBootDesktops = new BooleanValueSetting
|
||||||
("IntegrateAllNonBootDesktops", false));
|
("IntegrateAllNonBootDesktops", false));
|
||||||
Add(fEjectWhenUnmounting = new BooleanValueSetting("EjectWhenUnmounting", true));
|
Add(fEjectWhenUnmounting = new BooleanValueSetting("EjectWhenUnmounting", true));
|
||||||
@@ -180,7 +180,7 @@ TTrackerState::LoadSettingsIfNeeded()
|
|||||||
Add(fDesktopFilePanelRoot = new BooleanValueSetting("DesktopFilePanelRoot", true));
|
Add(fDesktopFilePanelRoot = new BooleanValueSetting("DesktopFilePanelRoot", true));
|
||||||
Add(fShowFullPathInTitleBar = new BooleanValueSetting("ShowFullPathInTitleBar", false));
|
Add(fShowFullPathInTitleBar = new BooleanValueSetting("ShowFullPathInTitleBar", false));
|
||||||
Add(fShowSelectionWhenInactive = new BooleanValueSetting("ShowSelectionWhenInactive", true));
|
Add(fShowSelectionWhenInactive = new BooleanValueSetting("ShowSelectionWhenInactive", true));
|
||||||
Add(fTransparentSelection = new BooleanValueSetting("TransparentSelection", false));
|
Add(fTransparentSelection = new BooleanValueSetting("TransparentSelection", true));
|
||||||
Add(fSortFolderNamesFirst = new BooleanValueSetting("SortFolderNamesFirst", false));
|
Add(fSortFolderNamesFirst = new BooleanValueSetting("SortFolderNamesFirst", false));
|
||||||
Add(fHideDotFiles = new BooleanValueSetting("HideDotFiles", false));
|
Add(fHideDotFiles = new BooleanValueSetting("HideDotFiles", false));
|
||||||
Add(fSingleWindowBrowse = new BooleanValueSetting("SingleWindowBrowse", false));
|
Add(fSingleWindowBrowse = new BooleanValueSetting("SingleWindowBrowse", false));
|
||||||
|
|||||||
@@ -32,12 +32,14 @@ names are registered trademarks or trademarks of their respective holders.
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "SettingsViews.h"
|
#include "SettingsViews.h"
|
||||||
#include "TrackerSettings.h"
|
#include "TrackerSettings.h"
|
||||||
#include "TrackerSettingsWindow.h"
|
#include "TrackerSettingsWindow.h"
|
||||||
|
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
|
||||||
|
|
||||||
const BPoint kSettingsWindowOffset(30, 30);
|
const BPoint kSettingsWindowOffset(30, 30);
|
||||||
const float kSettingsWindowsWidth = 370;
|
const float kSettingsWindowsWidth = 370;
|
||||||
const float kSettingsWindowsHeight = 270;
|
const float kSettingsWindowsHeight = 270;
|
||||||
@@ -48,12 +50,12 @@ const uint32 kRevertButtonPressed = 'Rebp';
|
|||||||
|
|
||||||
|
|
||||||
TrackerSettingsWindow::TrackerSettingsWindow()
|
TrackerSettingsWindow::TrackerSettingsWindow()
|
||||||
: BWindow(BRect(kSettingsWindowOffset.x, kSettingsWindowOffset.y,
|
: BWindow(BRect(kSettingsWindowOffset.x, kSettingsWindowOffset.y,
|
||||||
kSettingsWindowOffset.x + kSettingsWindowsWidth,
|
kSettingsWindowOffset.x + kSettingsWindowsWidth,
|
||||||
kSettingsWindowOffset.y + kSettingsWindowsHeight),
|
kSettingsWindowOffset.y + kSettingsWindowsHeight),
|
||||||
"Tracker Settings", B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
"Tracker Settings", B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
||||||
| B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE
|
| B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE
|
||||||
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
||||||
{
|
{
|
||||||
BView *backgroundView = new BView(Bounds(), "Background", B_FOLLOW_ALL_SIDES, 0);
|
BView *backgroundView = new BView(Bounds(), "Background", B_FOLLOW_ALL_SIDES, 0);
|
||||||
|
|
||||||
@@ -154,7 +156,6 @@ TrackerSettingsWindow::QuitRequested()
|
|||||||
void
|
void
|
||||||
TrackerSettingsWindow::MessageReceived(BMessage *message)
|
TrackerSettingsWindow::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kSettingsContentsModified:
|
case kSettingsContentsModified:
|
||||||
HandleChangedContents();
|
HandleChangedContents();
|
||||||
@@ -182,10 +183,9 @@ void
|
|||||||
TrackerSettingsWindow::Show()
|
TrackerSettingsWindow::Show()
|
||||||
{
|
{
|
||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
|
|
||||||
int32 itemCount = fSettingsTypeListView->CountItems();
|
int32 itemCount = fSettingsTypeListView->CountItems();
|
||||||
|
|
||||||
for (int32 i = 0; i<itemCount; i++) {
|
for (int32 i = 0; i < itemCount; i++) {
|
||||||
ViewAt(i)->RecordRevertSettings();
|
ViewAt(i)->RecordRevertSettings();
|
||||||
ViewAt(i)->ShowCurrentSettings();
|
ViewAt(i)->ShowCurrentSettings();
|
||||||
}
|
}
|
||||||
@@ -219,8 +219,9 @@ TrackerSettingsWindow::HandleChangedContents()
|
|||||||
|
|
||||||
bool revertable = false;
|
bool revertable = false;
|
||||||
|
|
||||||
for (int32 i = 0; i < itemCount; i++)
|
for (int32 i = 0; i < itemCount; i++) {
|
||||||
revertable |= ! ViewAt(i)->ShowsRevertSettings();
|
revertable |= ViewAt(i)->IsRevertable();
|
||||||
|
}
|
||||||
|
|
||||||
fSettingsTypeListView->Invalidate();
|
fSettingsTypeListView->Invalidate();
|
||||||
fRevertButton->SetEnabled(revertable);
|
fRevertButton->SetEnabled(revertable);
|
||||||
@@ -246,22 +247,23 @@ TrackerSettingsWindow::HandlePressedRevertButton()
|
|||||||
{
|
{
|
||||||
int32 itemCount = fSettingsTypeListView->CountItems();
|
int32 itemCount = fSettingsTypeListView->CountItems();
|
||||||
|
|
||||||
for (int32 i = 0; i < itemCount; i++)
|
for (int32 i = 0; i < itemCount; i++) {
|
||||||
if (ViewAt(i)->ShowsRevertSettings() == false)
|
if (ViewAt(i)->IsRevertable())
|
||||||
ViewAt(i)->Revert();
|
ViewAt(i)->Revert();
|
||||||
|
}
|
||||||
|
|
||||||
HandleChangedContents();
|
HandleChangedContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackerSettingsWindow::HandleChangedSettingsView()
|
TrackerSettingsWindow::HandleChangedSettingsView()
|
||||||
{
|
{
|
||||||
int32 currentSelection = fSettingsTypeListView->CurrentSelection();
|
int32 currentSelection = fSettingsTypeListView->CurrentSelection();
|
||||||
|
|
||||||
if (currentSelection < 0)
|
if (currentSelection < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BView *oldView = fSettingsContainerBox->ChildAt(0);
|
BView *oldView = fSettingsContainerBox->ChildAt(0);
|
||||||
|
|
||||||
if (oldView)
|
if (oldView)
|
||||||
oldView->RemoveSelf();
|
oldView->RemoveSelf();
|
||||||
@@ -276,12 +278,17 @@ TrackerSettingsWindow::HandleChangedSettingsView()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
SettingsItem::SettingsItem(const char *label, SettingsView *view)
|
SettingsItem::SettingsItem(const char *label, SettingsView *view)
|
||||||
: BStringItem(label),
|
: BStringItem(label),
|
||||||
fSettingsView(view)
|
fSettingsView(view)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
||||||
{
|
{
|
||||||
@@ -290,7 +297,7 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
|||||||
const rgb_color kSelectedColor = {140, 140, 140, 0};
|
const rgb_color kSelectedColor = {140, 140, 140, 0};
|
||||||
|
|
||||||
if (fSettingsView) {
|
if (fSettingsView) {
|
||||||
bool showsRevertSettings = fSettingsView->ShowsRevertSettings();
|
bool isRevertable = fSettingsView->IsRevertable();
|
||||||
bool isSelected = IsSelected();
|
bool isSelected = IsSelected();
|
||||||
|
|
||||||
if (isSelected || drawEverything) {
|
if (isSelected || drawEverything) {
|
||||||
@@ -305,7 +312,7 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
|||||||
owner->FillRect(rect);
|
owner->FillRect(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showsRevertSettings)
|
if (isRevertable)
|
||||||
owner->SetHighColor(kModifiedColor);
|
owner->SetHighColor(kModifiedColor);
|
||||||
else
|
else
|
||||||
owner->SetHighColor(kBlack);
|
owner->SetHighColor(kBlack);
|
||||||
@@ -319,6 +326,7 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SettingsView *
|
SettingsView *
|
||||||
SettingsItem::View()
|
SettingsItem::View()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,46 +43,48 @@ All rights reserved.
|
|||||||
|
|
||||||
#include "SettingsViews.h"
|
#include "SettingsViews.h"
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
class TrackerSettingsWindow : public BWindow {
|
class TrackerSettingsWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
TrackerSettingsWindow();
|
TrackerSettingsWindow();
|
||||||
|
|
||||||
bool QuitRequested();
|
bool QuitRequested();
|
||||||
void MessageReceived(BMessage *);
|
void MessageReceived(BMessage *message);
|
||||||
void Show();
|
void Show();
|
||||||
|
|
||||||
SettingsView *ViewAt(int32 i);
|
SettingsView *ViewAt(int32 i);
|
||||||
|
|
||||||
void HandleChangedContents();
|
void HandleChangedContents();
|
||||||
void HandlePressedDefaultsButton();
|
void HandlePressedDefaultsButton();
|
||||||
void HandlePressedRevertButton();
|
void HandlePressedRevertButton();
|
||||||
void HandleChangedSettingsView();
|
void HandleChangedSettingsView();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BListView *fSettingsTypeListView;
|
BListView *fSettingsTypeListView;
|
||||||
BBox *fSettingsContainerBox;
|
BBox *fSettingsContainerBox;
|
||||||
BButton *fDefaultsButton;
|
BButton *fDefaultsButton;
|
||||||
BButton *fRevertButton;
|
BButton *fRevertButton;
|
||||||
|
|
||||||
typedef BWindow _inherited;
|
typedef BWindow _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SettingsItem : public BStringItem {
|
class SettingsItem : public BStringItem {
|
||||||
public:
|
public:
|
||||||
SettingsItem(const char *, SettingsView *);
|
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;
|
private:
|
||||||
|
SettingsView *fSettingsView;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
#endif
|
#endif // _TRACKER_SETTINGS_WINDOW
|
||||||
|
|||||||
Reference in New Issue
Block a user