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;
|
||||||
|
|
||||||
|
|||||||
@@ -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";
|
||||||
@@ -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++) {
|
||||||
@@ -1099,8 +1096,8 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
if (entry.GetRef(&ref) == B_OK)
|
if (entry.GetRef(&ref) == B_OK)
|
||||||
SetTo(&ref);
|
SetTo(&ref);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kSwitchToHome:
|
case kSwitchToHome:
|
||||||
{
|
{
|
||||||
@@ -1111,8 +1108,8 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
SetTo(&ref);
|
SetTo(&ref);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kAddCurrentDir:
|
case kAddCurrentDir:
|
||||||
{
|
{
|
||||||
@@ -1130,14 +1127,16 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
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;
|
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;
|
||||||
@@ -1163,9 +1162,8 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
"Configure Favorites", Feel() == B_MODAL_APP_WINDOW_FEEL,
|
"Configure Favorites", Feel() == B_MODAL_APP_WINDOW_FEEL,
|
||||||
fNodeFlavors, BMessenger(this), &startref, -1, docs, folders);
|
fNodeFlavors, BMessenger(this), &startref, -1, docs, folders);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kConfigClose:
|
case kConfigClose:
|
||||||
{
|
{
|
||||||
@@ -1184,8 +1182,8 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
settings.SaveSettings(false);
|
settings.SaveSettings(false);
|
||||||
|
|
||||||
fConfigWindow = NULL;
|
fConfigWindow = NULL;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kUpdateAppsCount:
|
case kUpdateAppsCount:
|
||||||
case kUpdateDocsCount:
|
case kUpdateDocsCount:
|
||||||
@@ -1204,8 +1202,8 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
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,7 +1232,6 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
HandleSaveButton();
|
HandleSaveButton();
|
||||||
} else
|
} else
|
||||||
HandleOpenButton();
|
HandleOpenButton();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_OBSERVER_NOTICE_CHANGE:
|
case B_OBSERVER_NOTICE_CHANGE:
|
||||||
@@ -1245,15 +1242,15 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||||||
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,6 +1555,9 @@ 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);
|
{
|
||||||
|
// 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);
|
TrackerSettings().SetShowSelectionWhenInactive(fShowSelectionWhenInactive);
|
||||||
|
}
|
||||||
Invalidate();
|
Invalidate();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kTransparentSelectionChanged:
|
case kTransparentSelectionChanged:
|
||||||
message->FindBool("TransparentSelection", &fTransparentSelection);
|
{
|
||||||
|
bool transparentSelection;
|
||||||
|
if (message->FindBool("TransparentSelection", &transparentSelection) == B_OK) {
|
||||||
|
fTransparentSelection = transparentSelection;
|
||||||
TrackerSettings().SetTransparentSelection(fTransparentSelection);
|
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,7 +2309,7 @@ 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:
|
||||||
|
|||||||
+347
-240
@@ -48,7 +48,28 @@ All rights reserved.
|
|||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
const uint32 kSpaceBarSwitchColor = 'SBsc';
|
|
||||||
|
static const uint32 kSpaceBarSwitchColor = 'SBsc';
|
||||||
|
static const float kBorderSpacing = 5.0f;
|
||||||
|
static const float kItemHeight = 18.0f;
|
||||||
|
static const float kItemExtraSpacing = 2.0f;
|
||||||
|
static const float kIndentSpacing = 12.0f;
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
send_bool_notices(uint32 what, const char *name, bool value)
|
||||||
|
{
|
||||||
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
|
if (!tracker)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BMessage message;
|
||||||
|
message.AddBool(name, value);
|
||||||
|
tracker->SendNotices(what, &message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
SettingsView::SettingsView(BRect rect, const char *name)
|
SettingsView::SettingsView(BRect rect, const char *name)
|
||||||
@@ -56,44 +77,70 @@ SettingsView::SettingsView(BRect rect, const char *name)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SettingsView::~SettingsView()
|
SettingsView::~SettingsView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// The inherited functions should set the default values
|
|
||||||
// and update the UI gadgets. The latter can by done by
|
|
||||||
// calling ShowCurrentSettings().
|
|
||||||
void SettingsView::SetDefaults() {}
|
|
||||||
|
|
||||||
// The inherited functions should set the values that was
|
/*!
|
||||||
// active when the settings window opened. It should also
|
The inherited functions should set the default values
|
||||||
// update the UI widgets accordingly, preferrable by calling
|
and update the UI gadgets. The latter can by done by
|
||||||
// ShowCurrentSettings().
|
calling ShowCurrentSettings().
|
||||||
void SettingsView::Revert() {}
|
*/
|
||||||
|
void
|
||||||
// This function is called when the window is shown to let
|
SettingsView::SetDefaults()
|
||||||
// the settings views record the state to revert to.
|
{
|
||||||
void SettingsView::RecordRevertSettings() {}
|
|
||||||
|
|
||||||
// This function is used by the window to tell the view
|
|
||||||
// to display the current settings in the tracker.
|
|
||||||
void SettingsView::ShowCurrentSettings(bool) {}
|
|
||||||
|
|
||||||
// This function is used by the window to tell whether
|
|
||||||
// it can ghost the revert button or not. It it shows the
|
|
||||||
// reverted settings, this function should return true.
|
|
||||||
bool SettingsView::ShowsRevertSettings() const { return true; }
|
|
||||||
|
|
||||||
namespace BPrivate {
|
|
||||||
const float kBorderSpacing = 5.0f;
|
|
||||||
const float kItemHeight = 18.0f;
|
|
||||||
const float kItemExtraSpacing = 2.0f;
|
|
||||||
const float kIndentSpacing = 12.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
/*!
|
||||||
|
The inherited functions should set the values that was
|
||||||
|
active when the settings window opened. It should also
|
||||||
|
update the UI widgets accordingly, preferrable by calling
|
||||||
|
ShowCurrentSettings().
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
SettingsView::Revert()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
This function is called when the window is shown to let
|
||||||
|
the settings views record the state to revert to.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
SettingsView::RecordRevertSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
This function is used by the window to tell the view
|
||||||
|
to display the current settings in the tracker.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
SettingsView::ShowCurrentSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
This function is used by the window to tell whether
|
||||||
|
it can ghost the revert button or not. It it shows the
|
||||||
|
reverted settings, this function should return true.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
SettingsView::IsRevertable() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
DesktopSettingsView::DesktopSettingsView(BRect rect)
|
DesktopSettingsView::DesktopSettingsView(BRect rect)
|
||||||
: SettingsView(rect, "DesktopSettingsView")
|
: SettingsView(rect, "DesktopSettingsView")
|
||||||
{
|
{
|
||||||
@@ -150,9 +197,9 @@ DesktopSettingsView::DesktopSettingsView(BRect rect)
|
|||||||
button->ResizeToPreferred();
|
button->ResizeToPreferred();
|
||||||
button->MoveBy(0, rect.Height() - kBorderSpacing - button->Frame().bottom);
|
button->MoveBy(0, rect.Height() - kBorderSpacing - button->Frame().bottom);
|
||||||
button->SetTarget(be_app);
|
button->SetTarget(be_app);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DesktopSettingsView::AttachedToWindow()
|
DesktopSettingsView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
@@ -163,6 +210,7 @@ DesktopSettingsView::AttachedToWindow()
|
|||||||
fEjectWhenUnmountingCheckBox->SetTarget(this);
|
fEjectWhenUnmountingCheckBox->SetTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DesktopSettingsView::MessageReceived(BMessage *message)
|
DesktopSettingsView::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -252,10 +300,10 @@ DesktopSettingsView::MessageReceived(BMessage *message)
|
|||||||
notificationMessage.AddBool("IntegrateNonBootBeOSDesktops",
|
notificationMessage.AddBool("IntegrateNonBootBeOSDesktops",
|
||||||
fIntegrateNonBootBeOSDesktopsCheckBox->Value() == 1);
|
fIntegrateNonBootBeOSDesktopsCheckBox->Value() == 1);
|
||||||
|
|
||||||
// Send the notification message:
|
// Send the notification message
|
||||||
tracker->SendNotices(kDesktopIntegrationChanged, ¬ificationMessage);
|
tracker->SendNotices(kDesktopIntegrationChanged, ¬ificationMessage);
|
||||||
|
|
||||||
// Tell the settings window the contents have changed:
|
// Tell the settings window the contents have changed
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -265,15 +313,11 @@ DesktopSettingsView::MessageReceived(BMessage *message)
|
|||||||
settings.SetEjectWhenUnmounting(
|
settings.SetEjectWhenUnmounting(
|
||||||
fEjectWhenUnmountingCheckBox->Value() == 1);
|
fEjectWhenUnmountingCheckBox->Value() == 1);
|
||||||
|
|
||||||
// Construct the notification message:
|
// Send the notification message
|
||||||
BMessage notificationMessage;
|
send_bool_notices(kEjectWhenUnmountingChanged,
|
||||||
notificationMessage.AddBool("EjectWhenUnmounting",
|
"EjectWhenUnmounting", fEjectWhenUnmountingCheckBox->Value() == 1);
|
||||||
fEjectWhenUnmountingCheckBox->Value() == 1);
|
|
||||||
|
|
||||||
// Send the notification message:
|
// Tell the settings window the contents have changed
|
||||||
tracker->SendNotices(kEjectWhenUnmountingChanged, ¬ificationMessage);
|
|
||||||
|
|
||||||
// Tell the settings window the contents have changed:
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -293,11 +337,11 @@ DesktopSettingsView::SetDefaults()
|
|||||||
settings.SetShowDisksIcon(false);
|
settings.SetShowDisksIcon(false);
|
||||||
settings.SetMountVolumesOntoDesktop(true);
|
settings.SetMountVolumesOntoDesktop(true);
|
||||||
settings.SetMountSharedVolumesOntoDesktop(false);
|
settings.SetMountSharedVolumesOntoDesktop(false);
|
||||||
settings.SetIntegrateNonBootBeOSDesktops(true);
|
settings.SetIntegrateNonBootBeOSDesktops(false);
|
||||||
settings.SetEjectWhenUnmounting(true);
|
settings.SetEjectWhenUnmounting(true);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -312,26 +356,14 @@ DesktopSettingsView::Revert()
|
|||||||
settings.SetIntegrateNonBootBeOSDesktops(fIntegrateNonBootBeOSDesktops);
|
settings.SetIntegrateNonBootBeOSDesktops(fIntegrateNonBootBeOSDesktops);
|
||||||
settings.SetEjectWhenUnmounting(fEjectWhenUnmounting);
|
settings.SetEjectWhenUnmounting(fEjectWhenUnmounting);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DesktopSettingsView::ShowCurrentSettings(bool sendNotices)
|
DesktopSettingsView::_SendNotices()
|
||||||
{
|
{
|
||||||
TrackerSettings settings;
|
|
||||||
|
|
||||||
fShowDisksIconRadioButton->SetValue(settings.ShowDisksIcon());
|
|
||||||
fMountVolumesOntoDesktopRadioButton->SetValue(settings.MountVolumesOntoDesktop());
|
|
||||||
|
|
||||||
fMountSharedVolumesOntoDesktopCheckBox->SetValue(settings.MountSharedVolumesOntoDesktop());
|
|
||||||
fMountSharedVolumesOntoDesktopCheckBox->SetEnabled(settings.MountVolumesOntoDesktop());
|
|
||||||
|
|
||||||
fIntegrateNonBootBeOSDesktopsCheckBox->SetValue(settings.IntegrateNonBootBeOSDesktops());
|
|
||||||
|
|
||||||
fEjectWhenUnmountingCheckBox->SetValue(settings.EjectWhenUnmounting());
|
|
||||||
|
|
||||||
if (sendNotices) {
|
|
||||||
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
if (!tracker)
|
if (!tracker)
|
||||||
return;
|
return;
|
||||||
@@ -352,7 +384,23 @@ DesktopSettingsView::ShowCurrentSettings(bool sendNotices)
|
|||||||
// Send notices to the tracker about the change:
|
// Send notices to the tracker about the change:
|
||||||
tracker->SendNotices(kVolumesOnDesktopChanged, ¬ificationMessage);
|
tracker->SendNotices(kVolumesOnDesktopChanged, ¬ificationMessage);
|
||||||
tracker->SendNotices(kDesktopIntegrationChanged, ¬ificationMessage);
|
tracker->SendNotices(kDesktopIntegrationChanged, ¬ificationMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DesktopSettingsView::ShowCurrentSettings()
|
||||||
|
{
|
||||||
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
fShowDisksIconRadioButton->SetValue(settings.ShowDisksIcon());
|
||||||
|
fMountVolumesOntoDesktopRadioButton->SetValue(settings.MountVolumesOntoDesktop());
|
||||||
|
|
||||||
|
fMountSharedVolumesOntoDesktopCheckBox->SetValue(settings.MountSharedVolumesOntoDesktop());
|
||||||
|
fMountSharedVolumesOntoDesktopCheckBox->SetEnabled(settings.MountVolumesOntoDesktop());
|
||||||
|
|
||||||
|
fIntegrateNonBootBeOSDesktopsCheckBox->SetValue(settings.IntegrateNonBootBeOSDesktops());
|
||||||
|
|
||||||
|
fEjectWhenUnmountingCheckBox->SetValue(settings.EjectWhenUnmounting());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -370,23 +418,20 @@ DesktopSettingsView::RecordRevertSettings()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DesktopSettingsView::ShowsRevertSettings() const
|
DesktopSettingsView::IsRevertable() const
|
||||||
{
|
{
|
||||||
return
|
return fShowDisksIcon != (fShowDisksIconRadioButton->Value() > 0)
|
||||||
(fShowDisksIcon ==
|
|| fMountVolumesOntoDesktop !=
|
||||||
(fShowDisksIconRadioButton->Value() > 0))
|
(fMountVolumesOntoDesktopRadioButton->Value() > 0)
|
||||||
&& (fMountVolumesOntoDesktop ==
|
|| fMountSharedVolumesOntoDesktop !=
|
||||||
(fMountVolumesOntoDesktopRadioButton->Value() > 0))
|
(fMountSharedVolumesOntoDesktopCheckBox->Value() > 0)
|
||||||
&& (fMountSharedVolumesOntoDesktop ==
|
|| fIntegrateNonBootBeOSDesktops !=
|
||||||
(fMountSharedVolumesOntoDesktopCheckBox->Value() > 0))
|
(fIntegrateNonBootBeOSDesktopsCheckBox->Value() > 0)
|
||||||
&& (fIntegrateNonBootBeOSDesktops ==
|
|| fEjectWhenUnmounting !=
|
||||||
(fIntegrateNonBootBeOSDesktopsCheckBox->Value() > 0))
|
(fEjectWhenUnmountingCheckBox->Value() > 0);
|
||||||
&& (fEjectWhenUnmounting ==
|
|
||||||
(fEjectWhenUnmountingCheckBox->Value() > 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -419,7 +464,6 @@ WindowsSettingsView::WindowsSettingsView(BRect rect)
|
|||||||
|
|
||||||
frame.OffsetBy(-20, itemSpacing);
|
frame.OffsetBy(-20, itemSpacing);
|
||||||
|
|
||||||
|
|
||||||
fShowSelectionWhenInactiveCheckBox = new BCheckBox(frame, "", "Show Selection When Inactive",
|
fShowSelectionWhenInactiveCheckBox = new BCheckBox(frame, "", "Show Selection When Inactive",
|
||||||
new BMessage(kShowSelectionWhenInactiveChanged));
|
new BMessage(kShowSelectionWhenInactiveChanged));
|
||||||
AddChild(fShowSelectionWhenInactiveCheckBox);
|
AddChild(fShowSelectionWhenInactiveCheckBox);
|
||||||
@@ -427,10 +471,10 @@ WindowsSettingsView::WindowsSettingsView(BRect rect)
|
|||||||
|
|
||||||
frame.OffsetBy(0, itemSpacing);
|
frame.OffsetBy(0, itemSpacing);
|
||||||
|
|
||||||
fTransparentSelectionCheckBox = new BCheckBox(frame, "", "Transparent Selection Box",
|
fOutlineSelectionCheckBox = new BCheckBox(frame, "", "Outline Selection Rectangle Only",
|
||||||
new BMessage(kTransparentSelectionChanged));
|
new BMessage(kTransparentSelectionChanged));
|
||||||
AddChild(fTransparentSelectionCheckBox);
|
AddChild(fOutlineSelectionCheckBox);
|
||||||
fTransparentSelectionCheckBox->ResizeToPreferred();
|
fOutlineSelectionCheckBox->ResizeToPreferred();
|
||||||
|
|
||||||
frame.OffsetBy(0, itemSpacing);
|
frame.OffsetBy(0, itemSpacing);
|
||||||
|
|
||||||
@@ -448,7 +492,7 @@ WindowsSettingsView::AttachedToWindow()
|
|||||||
fShowNavigatorCheckBox->SetTarget(this);
|
fShowNavigatorCheckBox->SetTarget(this);
|
||||||
fShowFullPathInTitleBarCheckBox->SetTarget(this);
|
fShowFullPathInTitleBarCheckBox->SetTarget(this);
|
||||||
fShowSelectionWhenInactiveCheckBox->SetTarget(this);
|
fShowSelectionWhenInactiveCheckBox->SetTarget(this);
|
||||||
fTransparentSelectionCheckBox->SetTarget(this);
|
fOutlineSelectionCheckBox->SetTarget(this);
|
||||||
fSortFolderNamesFirstCheckBox->SetTarget(this);
|
fSortFolderNamesFirstCheckBox->SetTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,10 +538,8 @@ WindowsSettingsView::MessageReceived(BMessage *message)
|
|||||||
fShowSelectionWhenInactiveCheckBox->Value() == 1);
|
fShowSelectionWhenInactiveCheckBox->Value() == 1);
|
||||||
|
|
||||||
// Make the notification message and send it to the tracker:
|
// Make the notification message and send it to the tracker:
|
||||||
BMessage notificationMessage;
|
send_bool_notices(kShowSelectionWhenInactiveChanged,
|
||||||
notificationMessage.AddBool("ShowSelectionWhenInactive",
|
"ShowSelectionWhenInactive", fShowSelectionWhenInactiveCheckBox->Value() == 1);
|
||||||
fShowSelectionWhenInactiveCheckBox->Value() == 1);
|
|
||||||
tracker->SendNotices(kShowSelectionWhenInactiveChanged, ¬ificationMessage);
|
|
||||||
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
break;
|
break;
|
||||||
@@ -506,13 +548,11 @@ WindowsSettingsView::MessageReceived(BMessage *message)
|
|||||||
case kTransparentSelectionChanged:
|
case kTransparentSelectionChanged:
|
||||||
{
|
{
|
||||||
settings.SetTransparentSelection(
|
settings.SetTransparentSelection(
|
||||||
fTransparentSelectionCheckBox->Value() == 1);
|
fOutlineSelectionCheckBox->Value() == B_CONTROL_OFF);
|
||||||
|
|
||||||
// Make the notification message and send it to the tracker:
|
// Make the notification message and send it to the tracker:
|
||||||
BMessage notificationMessage;
|
send_bool_notices(kTransparentSelectionChanged,
|
||||||
notificationMessage.AddBool("TransparentSelection",
|
"TransparentSelection", settings.TransparentSelection());
|
||||||
fTransparentSelectionCheckBox->Value() == 1);
|
|
||||||
tracker->SendNotices(kTransparentSelectionChanged, ¬ificationMessage);
|
|
||||||
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
break;
|
break;
|
||||||
@@ -523,10 +563,8 @@ WindowsSettingsView::MessageReceived(BMessage *message)
|
|||||||
settings.SetSortFolderNamesFirst(fSortFolderNamesFirstCheckBox->Value() == 1);
|
settings.SetSortFolderNamesFirst(fSortFolderNamesFirstCheckBox->Value() == 1);
|
||||||
|
|
||||||
// Make the notification message and send it to the tracker:
|
// Make the notification message and send it to the tracker:
|
||||||
BMessage notificationMessage;
|
send_bool_notices(kSortFolderNamesFirstChanged, "SortFolderNamesFirst",
|
||||||
notificationMessage.AddBool("SortFolderNamesFirst",
|
|
||||||
fSortFolderNamesFirstCheckBox->Value() == 1);
|
fSortFolderNamesFirstCheckBox->Value() == 1);
|
||||||
tracker->SendNotices(kSortFolderNamesFirstChanged, ¬ificationMessage);
|
|
||||||
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
break;
|
break;
|
||||||
@@ -542,43 +580,98 @@ WindowsSettingsView::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
WindowsSettingsView::SetDefaults()
|
WindowsSettingsView::SetDefaults()
|
||||||
{
|
{
|
||||||
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
|
if (!tracker)
|
||||||
|
return;
|
||||||
|
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
if (settings.ShowFullPathInTitleBar()) {
|
||||||
settings.SetShowFullPathInTitleBar(false);
|
settings.SetShowFullPathInTitleBar(false);
|
||||||
settings.SetSingleWindowBrowse(false);
|
tracker->SendNotices(kWindowsShowFullPathChanged);
|
||||||
settings.SetShowNavigator(false);
|
}
|
||||||
settings.SetShowSelectionWhenInactive(true);
|
|
||||||
settings.SetTransparentSelection(false);
|
|
||||||
settings.SetSortFolderNamesFirst(false);
|
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
if (settings.SingleWindowBrowse()) {
|
||||||
// true -> send notices about the change
|
settings.SetSingleWindowBrowse(false);
|
||||||
|
tracker->SendNotices(kSingleWindowBrowseChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.ShowNavigator()) {
|
||||||
|
settings.SetShowNavigator(false);
|
||||||
|
tracker->SendNotices(kShowNavigatorChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!settings.ShowSelectionWhenInactive()) {
|
||||||
|
settings.SetShowSelectionWhenInactive(true);
|
||||||
|
send_bool_notices(kShowSelectionWhenInactiveChanged,
|
||||||
|
"ShowSelectionWhenInactive", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!settings.TransparentSelection()) {
|
||||||
|
settings.SetTransparentSelection(true);
|
||||||
|
send_bool_notices(kTransparentSelectionChanged,
|
||||||
|
"TransparentSelection", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.SortFolderNamesFirst()) {
|
||||||
|
settings.SetSortFolderNamesFirst(false);
|
||||||
|
send_bool_notices(kSortFolderNamesFirstChanged,
|
||||||
|
"SortFolderNamesFirst", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowCurrentSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowsSettingsView::Revert()
|
WindowsSettingsView::Revert()
|
||||||
{
|
{
|
||||||
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
|
if (!tracker)
|
||||||
|
return;
|
||||||
|
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
if (settings.ShowFullPathInTitleBar() != fShowFullPathInTitleBar) {
|
||||||
settings.SetShowFullPathInTitleBar(fShowFullPathInTitleBar);
|
settings.SetShowFullPathInTitleBar(fShowFullPathInTitleBar);
|
||||||
settings.SetSingleWindowBrowse(fSingleWindowBrowse);
|
tracker->SendNotices(kWindowsShowFullPathChanged);
|
||||||
settings.SetShowNavigator(fShowNavigator);
|
}
|
||||||
settings.SetShowSelectionWhenInactive(fShowSelectionWhenInactive);
|
|
||||||
settings.SetTransparentSelection(fTransparentSelection);
|
|
||||||
settings.SetSortFolderNamesFirst(fSortFolderNamesFirst);
|
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
if (settings.SingleWindowBrowse() != fSingleWindowBrowse) {
|
||||||
// true -> send notices about the change
|
settings.SetSingleWindowBrowse(fSingleWindowBrowse);
|
||||||
|
tracker->SendNotices(kSingleWindowBrowseChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.ShowNavigator() != fShowNavigator) {
|
||||||
|
settings.SetShowNavigator(fShowNavigator);
|
||||||
|
tracker->SendNotices(kShowNavigatorChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.ShowSelectionWhenInactive() != fShowSelectionWhenInactive) {
|
||||||
|
settings.SetShowSelectionWhenInactive(fShowSelectionWhenInactive);
|
||||||
|
send_bool_notices(kShowSelectionWhenInactiveChanged,
|
||||||
|
"ShowSelectionWhenInactive", fShowSelectionWhenInactive);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.TransparentSelection() != fTransparentSelection) {
|
||||||
|
settings.SetTransparentSelection(fTransparentSelection);
|
||||||
|
send_bool_notices(kTransparentSelectionChanged,
|
||||||
|
"TransparentSelection", fTransparentSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.SortFolderNamesFirst() != fSortFolderNamesFirst) {
|
||||||
|
settings.SetSortFolderNamesFirst(fSortFolderNamesFirst);
|
||||||
|
send_bool_notices(kSortFolderNamesFirstChanged,
|
||||||
|
"SortFolderNamesFirst", fSortFolderNamesFirst);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowCurrentSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowsSettingsView::ShowCurrentSettings(bool sendNotices)
|
WindowsSettingsView::ShowCurrentSettings()
|
||||||
{
|
{
|
||||||
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
|
||||||
if (!tracker)
|
|
||||||
return;
|
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
fShowFullPathInTitleBarCheckBox->SetValue(settings.ShowFullPathInTitleBar());
|
fShowFullPathInTitleBarCheckBox->SetValue(settings.ShowFullPathInTitleBar());
|
||||||
@@ -586,17 +679,9 @@ WindowsSettingsView::ShowCurrentSettings(bool sendNotices)
|
|||||||
fShowNavigatorCheckBox->SetEnabled(settings.SingleWindowBrowse());
|
fShowNavigatorCheckBox->SetEnabled(settings.SingleWindowBrowse());
|
||||||
fShowNavigatorCheckBox->SetValue(settings.ShowNavigator());
|
fShowNavigatorCheckBox->SetValue(settings.ShowNavigator());
|
||||||
fShowSelectionWhenInactiveCheckBox->SetValue(settings.ShowSelectionWhenInactive());
|
fShowSelectionWhenInactiveCheckBox->SetValue(settings.ShowSelectionWhenInactive());
|
||||||
fTransparentSelectionCheckBox->SetValue(settings.TransparentSelection());
|
fOutlineSelectionCheckBox->SetValue(settings.TransparentSelection()
|
||||||
|
? B_CONTROL_OFF : B_CONTROL_ON);
|
||||||
fSortFolderNamesFirstCheckBox->SetValue(settings.SortFolderNamesFirst());
|
fSortFolderNamesFirstCheckBox->SetValue(settings.SortFolderNamesFirst());
|
||||||
|
|
||||||
if (sendNotices) {
|
|
||||||
tracker->SendNotices(kSingleWindowBrowseChanged);
|
|
||||||
tracker->SendNotices(kShowNavigatorChanged);
|
|
||||||
tracker->SendNotices(kWindowsShowFullPathChanged);
|
|
||||||
tracker->SendNotices(kShowSelectionWhenInactiveChanged);
|
|
||||||
tracker->SendNotices(kTransparentSelectionChanged);
|
|
||||||
tracker->SendNotices(kSortFolderNamesFirstChanged);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -615,25 +700,19 @@ WindowsSettingsView::RecordRevertSettings()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowsSettingsView::ShowsRevertSettings() const
|
WindowsSettingsView::IsRevertable() const
|
||||||
{
|
{
|
||||||
return
|
TrackerSettings settings;
|
||||||
(fShowFullPathInTitleBar ==
|
|
||||||
(fShowFullPathInTitleBarCheckBox->Value() > 0))
|
return fShowFullPathInTitleBar != settings.ShowFullPathInTitleBar()
|
||||||
&& (fSingleWindowBrowse ==
|
|| fSingleWindowBrowse != settings.SingleWindowBrowse()
|
||||||
(fSingleWindowBrowseCheckBox->Value() > 0))
|
|| fShowNavigator != settings.ShowNavigator()
|
||||||
&& (fShowNavigator ==
|
|| fShowSelectionWhenInactive != settings.ShowSelectionWhenInactive()
|
||||||
(fShowNavigatorCheckBox->Value() > 0))
|
|| fTransparentSelection != settings.TransparentSelection()
|
||||||
&& (fShowSelectionWhenInactive ==
|
|| fSortFolderNamesFirst != settings.SortFolderNamesFirst();
|
||||||
(fShowSelectionWhenInactiveCheckBox->Value() > 0))
|
|
||||||
&& (fTransparentSelection ==
|
|
||||||
(fTransparentSelectionCheckBox->Value() > 0))
|
|
||||||
&& (fSortFolderNamesFirst ==
|
|
||||||
(fSortFolderNamesFirstCheckBox->Value() > 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -724,12 +803,12 @@ FilePanelSettingsView::MessageReceived(BMessage *message)
|
|||||||
tracker->SendNotices(kDesktopFilePanelRootChanged, &message);
|
tracker->SendNotices(kDesktopFilePanelRootChanged, &message);
|
||||||
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kFavoriteCountChanged:
|
case kFavoriteCountChanged:
|
||||||
{
|
{
|
||||||
GetAndRefreshDisplayedFigures();
|
_GetAndRefreshDisplayedFigures();
|
||||||
settings.SetRecentDocumentsCount(fDisplayedDocCount);
|
settings.SetRecentDocumentsCount(fDisplayedDocCount);
|
||||||
settings.SetRecentFoldersCount(fDisplayedFolderCount);
|
settings.SetRecentFoldersCount(fDisplayedFolderCount);
|
||||||
|
|
||||||
@@ -740,16 +819,14 @@ FilePanelSettingsView::MessageReceived(BMessage *message)
|
|||||||
tracker->SendNotices(kFavoriteCountChanged, &message);
|
tracker->SendNotices(kFavoriteCountChanged, &message);
|
||||||
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
}
|
|
||||||
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) {
|
&& (uint32)observerWhat == kFavoriteCountChangedExternally) {
|
||||||
case kFavoriteCountChangedExternally:
|
|
||||||
{
|
|
||||||
int32 count;
|
int32 count;
|
||||||
if (message->FindInt32("RecentApplications", &count) == B_OK) {
|
if (message->FindInt32("RecentApplications", &count) == B_OK) {
|
||||||
settings.SetRecentApplicationsCount(count);
|
settings.SetRecentApplicationsCount(count);
|
||||||
@@ -768,9 +845,6 @@ FilePanelSettingsView::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_inherited::MessageReceived(message);
|
_inherited::MessageReceived(message);
|
||||||
@@ -788,8 +862,8 @@ FilePanelSettingsView::SetDefaults()
|
|||||||
settings.SetRecentDocumentsCount(10);
|
settings.SetRecentDocumentsCount(10);
|
||||||
settings.SetRecentFoldersCount(10);
|
settings.SetRecentFoldersCount(10);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -802,17 +876,38 @@ FilePanelSettingsView::Revert()
|
|||||||
settings.SetRecentDocumentsCount(fRecentDocuments);
|
settings.SetRecentDocumentsCount(fRecentDocuments);
|
||||||
settings.SetRecentFoldersCount(fRecentFolders);
|
settings.SetRecentFoldersCount(fRecentFolders);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FilePanelSettingsView::ShowCurrentSettings(bool sendNotices)
|
FilePanelSettingsView::_SendNotices()
|
||||||
{
|
{
|
||||||
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
if (!tracker)
|
if (!tracker)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
// Make the notification message and send it to the tracker:
|
||||||
|
|
||||||
|
BMessage message;
|
||||||
|
message.AddBool("DesktopFilePanelRoot", fDesktopFilePanelRootCheckBox->Value() == 1);
|
||||||
|
tracker->SendNotices(kDesktopFilePanelRootChanged, &message);
|
||||||
|
|
||||||
|
int32 recentApplications, recentDocuments, recentFolders;
|
||||||
|
settings.RecentCounts(&recentApplications, &recentDocuments, &recentFolders);
|
||||||
|
|
||||||
|
message.AddInt32("RecentDocuments", recentDocuments);
|
||||||
|
message.AddInt32("RecentFolders", recentFolders);
|
||||||
|
tracker->SendNotices(kFavoriteCountChanged, &message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FilePanelSettingsView::ShowCurrentSettings()
|
||||||
|
{
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
fDesktopFilePanelRootCheckBox->SetValue(settings.DesktopFilePanelRoot());
|
fDesktopFilePanelRootCheckBox->SetValue(settings.DesktopFilePanelRoot());
|
||||||
@@ -827,18 +922,6 @@ FilePanelSettingsView::ShowCurrentSettings(bool sendNotices)
|
|||||||
BString folderCountText;
|
BString folderCountText;
|
||||||
folderCountText << recentFolders;
|
folderCountText << recentFolders;
|
||||||
fRecentFoldersTextControl->SetText(folderCountText.String());
|
fRecentFoldersTextControl->SetText(folderCountText.String());
|
||||||
|
|
||||||
if (sendNotices) {
|
|
||||||
// Make the notification message and send it to the tracker:
|
|
||||||
|
|
||||||
BMessage message;
|
|
||||||
message.AddBool("DesktopFilePanelRoot", fDesktopFilePanelRootCheckBox->Value() == 1);
|
|
||||||
tracker->SendNotices(kDesktopFilePanelRootChanged, &message);
|
|
||||||
|
|
||||||
message.AddInt32("RecentDocuments", recentDocuments);
|
|
||||||
message.AddInt32("RecentFolders", recentFolders);
|
|
||||||
tracker->SendNotices(kFavoriteCountChanged, &message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -853,19 +936,18 @@ FilePanelSettingsView::RecordRevertSettings()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FilePanelSettingsView::ShowsRevertSettings() const
|
FilePanelSettingsView::IsRevertable() const
|
||||||
{
|
{
|
||||||
GetAndRefreshDisplayedFigures();
|
_GetAndRefreshDisplayedFigures();
|
||||||
|
|
||||||
return
|
return fDesktopFilePanelRoot != (fDesktopFilePanelRootCheckBox->Value() > 0)
|
||||||
(fDesktopFilePanelRoot == (fDesktopFilePanelRootCheckBox->Value() > 0))
|
|| fDisplayedDocCount != fRecentDocuments
|
||||||
&& (fDisplayedDocCount == fRecentDocuments)
|
|| fDisplayedFolderCount != fRecentFolders;
|
||||||
&& (fDisplayedFolderCount == fRecentFolders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FilePanelSettingsView::GetAndRefreshDisplayedFigures() const
|
FilePanelSettingsView::_GetAndRefreshDisplayedFigures() const
|
||||||
{
|
{
|
||||||
sscanf(fRecentDocumentsTextControl->Text(), "%ld", &fDisplayedDocCount);
|
sscanf(fRecentDocumentsTextControl->Text(), "%ld", &fDisplayedDocCount);
|
||||||
sscanf(fRecentFoldersTextControl->Text(), "%ld", &fDisplayedFolderCount);
|
sscanf(fRecentFoldersTextControl->Text(), "%ld", &fDisplayedFolderCount);
|
||||||
@@ -880,7 +962,6 @@ FilePanelSettingsView::GetAndRefreshDisplayedFigures() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -914,7 +995,6 @@ TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
|
|||||||
|
|
||||||
clockBox->ResizeTo(clockBox->Bounds().Width(), f12HrRadioButton->Frame().bottom + kBorderSpacing);
|
clockBox->ResizeTo(clockBox->Bounds().Width(), f12HrRadioButton->Frame().bottom + kBorderSpacing);
|
||||||
|
|
||||||
|
|
||||||
BRect dateFormatBoxFrame = BRect(clockBoxFrame.right + kBorderSpacing, kBorderSpacing,
|
BRect dateFormatBoxFrame = BRect(clockBoxFrame.right + kBorderSpacing, kBorderSpacing,
|
||||||
rect.right - kBorderSpacing, kBorderSpacing + 5 * itemSpacing);
|
rect.right - kBorderSpacing, kBorderSpacing + 5 * itemSpacing);
|
||||||
|
|
||||||
@@ -981,7 +1061,7 @@ TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
|
|||||||
AddChild(fShortDateExampleView);
|
AddChild(fShortDateExampleView);
|
||||||
fShortDateExampleView->ResizeToPreferred();
|
fShortDateExampleView->ResizeToPreferred();
|
||||||
|
|
||||||
UpdateExamples();
|
_UpdateExamples();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1031,7 +1111,7 @@ TimeFormatSettingsView::MessageReceived(BMessage *message)
|
|||||||
notificationMessage.AddBool("24HrClock", f24HrRadioButton->Value() == 1);
|
notificationMessage.AddBool("24HrClock", f24HrRadioButton->Value() == 1);
|
||||||
tracker->SendNotices(kDateFormatChanged, ¬ificationMessage);
|
tracker->SendNotices(kDateFormatChanged, ¬ificationMessage);
|
||||||
|
|
||||||
UpdateExamples();
|
_UpdateExamples();
|
||||||
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
Window()->PostMessage(kSettingsContentsModified);
|
||||||
break;
|
break;
|
||||||
@@ -1052,8 +1132,8 @@ TimeFormatSettingsView::SetDefaults()
|
|||||||
settings.SetDateOrderFormat(kMDYFormat);
|
settings.SetDateOrderFormat(kMDYFormat);
|
||||||
settings.SetClockTo24Hr(false);
|
settings.SetClockTo24Hr(false);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1066,13 +1146,31 @@ TimeFormatSettingsView::Revert()
|
|||||||
settings.SetDateOrderFormat(fFormat);
|
settings.SetDateOrderFormat(fFormat);
|
||||||
settings.SetClockTo24Hr(f24HrClock);
|
settings.SetClockTo24Hr(f24HrClock);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::ShowCurrentSettings(bool sendNotices)
|
TimeFormatSettingsView::_SendNotices()
|
||||||
|
{
|
||||||
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
|
if (!tracker)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
// Make the notification message and send it to the tracker:
|
||||||
|
BMessage notificationMessage;
|
||||||
|
notificationMessage.AddInt32("TimeFormatSeparator", (int32)settings.TimeFormatSeparator());
|
||||||
|
notificationMessage.AddInt32("DateOrderFormat", (int32)settings.DateOrderFormat());
|
||||||
|
notificationMessage.AddBool("24HrClock", settings.ClockIs24Hr());
|
||||||
|
tracker->SendNotices(kDateFormatChanged, ¬ificationMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TimeFormatSettingsView::ShowCurrentSettings()
|
||||||
{
|
{
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
@@ -1099,20 +1197,7 @@ TimeFormatSettingsView::ShowCurrentSettings(bool sendNotices)
|
|||||||
if (separator >= kNoSeparator && separator < kSeparatorsEnd)
|
if (separator >= kNoSeparator && separator < kSeparatorsEnd)
|
||||||
fSeparatorMenuField->Menu()->ItemAt((int32)separator)->SetMarked(true);
|
fSeparatorMenuField->Menu()->ItemAt((int32)separator)->SetMarked(true);
|
||||||
|
|
||||||
UpdateExamples();
|
_UpdateExamples();
|
||||||
|
|
||||||
if (sendNotices) {
|
|
||||||
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
|
||||||
if (!tracker)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Make the notification message and send it to the tracker:
|
|
||||||
BMessage notificationMessage;
|
|
||||||
notificationMessage.AddInt32("TimeFormatSeparator", (int32)settings.TimeFormatSeparator());
|
|
||||||
notificationMessage.AddInt32("DateOrderFormat", (int32)settings.DateOrderFormat());
|
|
||||||
notificationMessage.AddBool("24HrClock", settings.ClockIs24Hr());
|
|
||||||
tracker->SendNotices(kDateFormatChanged, ¬ificationMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1128,7 +1213,7 @@ TimeFormatSettingsView::RecordRevertSettings()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TimeFormatSettingsView::ShowsRevertSettings() const
|
TimeFormatSettingsView::IsRevertable() const
|
||||||
{
|
{
|
||||||
FormatSeparator separator;
|
FormatSeparator separator;
|
||||||
|
|
||||||
@@ -1138,23 +1223,22 @@ TimeFormatSettingsView::ShowsRevertSettings() const
|
|||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
separator = (FormatSeparator)index;
|
separator = (FormatSeparator)index;
|
||||||
else
|
else
|
||||||
return false;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return true;
|
||||||
|
|
||||||
DateOrder format =
|
DateOrder format =
|
||||||
fYMDRadioButton->Value() ? kYMDFormat :
|
fYMDRadioButton->Value() ? kYMDFormat :
|
||||||
(fDMYRadioButton->Value() ? kDMYFormat : kMDYFormat);
|
(fDMYRadioButton->Value() ? kDMYFormat : kMDYFormat);
|
||||||
|
|
||||||
return
|
return f24HrClock != (f24HrRadioButton->Value() > 0)
|
||||||
f24HrClock == (f24HrRadioButton->Value() > 0)
|
|| separator != fSeparator
|
||||||
&& separator == fSeparator
|
|| format != fFormat;
|
||||||
&& format == fFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::UpdateExamples()
|
TimeFormatSettingsView::_UpdateExamples()
|
||||||
{
|
{
|
||||||
time_t timeValue = (time_t)time(NULL);
|
time_t timeValue = (time_t)time(NULL);
|
||||||
tm timeData;
|
tm timeData;
|
||||||
@@ -1194,7 +1278,6 @@ TimeFormatSettingsView::UpdateExamples()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -1222,16 +1305,17 @@ SpaceBarSettingsView::SpaceBarSettingsView(BRect rect)
|
|||||||
menu->AddItem(new BMenuItem("Warning Space Color", new BMessage(kSpaceBarSwitchColor)));
|
menu->AddItem(new BMenuItem("Warning Space Color", new BMessage(kSpaceBarSwitchColor)));
|
||||||
|
|
||||||
BBox *box = new BBox(frame);
|
BBox *box = new BBox(frame);
|
||||||
box->SetLabel(fColorPicker = new BMenuField(frame,NULL,NULL,menu));
|
box->SetLabel(fColorPicker = new BMenuField(frame, NULL, NULL, menu));
|
||||||
AddChild(box);
|
AddChild(box);
|
||||||
|
|
||||||
fColorControl = new BColorControl(
|
fColorControl = new BColorControl(BPoint(8, fColorPicker->Bounds().Height()
|
||||||
BPoint(8,fColorPicker->Bounds().Height() + 8 + kItemExtraSpacing),
|
+ 8 + kItemExtraSpacing),
|
||||||
B_CELLS_16x16,1,"SpaceColorControl",new BMessage(kSpaceBarColorChanged));
|
B_CELLS_16x16, 1, "SpaceColorControl", new BMessage(kSpaceBarColorChanged));
|
||||||
fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
|
fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
|
||||||
fColorControl->ResizeToPreferred();
|
fColorControl->ResizeToPreferred();
|
||||||
box->AddChild(fColorControl);
|
box->AddChild(fColorControl);
|
||||||
box->ResizeTo(fColorControl->Bounds().Width() + 16,fColorControl->Frame().bottom + 8);
|
box->ResizeTo(fColorControl->Bounds().Width() + 16,
|
||||||
|
fColorControl->Frame().bottom + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1314,40 +1398,60 @@ SpaceBarSettingsView::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
SpaceBarSettingsView::SetDefaults()
|
SpaceBarSettingsView::SetDefaults()
|
||||||
{
|
{
|
||||||
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
|
if (!tracker)
|
||||||
|
return;
|
||||||
|
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
if (settings.ShowVolumeSpaceBar()) {
|
||||||
settings.SetShowVolumeSpaceBar(false);
|
settings.SetShowVolumeSpaceBar(false);
|
||||||
|
send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar", false);
|
||||||
|
}
|
||||||
|
|
||||||
settings.SetUsedSpaceColor(Color(0,0xcb,0,192));
|
if (settings.UsedSpaceColor() != Color(0, 203, 0, 192)
|
||||||
settings.SetFreeSpaceColor(Color(0xff,0xff,0xff,192));
|
|| settings.FreeSpaceColor() != Color(255, 255, 255, 192)
|
||||||
settings.SetWarningSpaceColor(Color(0xcb,0,0,192));
|
|| settings.WarningSpaceColor() != Color(203, 0, 0, 192)) {
|
||||||
|
settings.SetUsedSpaceColor(Color(0, 203, 0, 192));
|
||||||
|
settings.SetFreeSpaceColor(Color(255, 255, 255, 192));
|
||||||
|
settings.SetWarningSpaceColor(Color(203, 0, 0, 192));
|
||||||
|
tracker->SendNotices(kSpaceBarColorChanged);
|
||||||
|
}
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpaceBarSettingsView::Revert()
|
SpaceBarSettingsView::Revert()
|
||||||
{
|
{
|
||||||
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
|
if (!tracker)
|
||||||
|
return;
|
||||||
|
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
if (settings.ShowVolumeSpaceBar() != fSpaceBarShow) {
|
||||||
settings.SetShowVolumeSpaceBar(fSpaceBarShow);
|
settings.SetShowVolumeSpaceBar(fSpaceBarShow);
|
||||||
|
send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar", fSpaceBarShow);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.UsedSpaceColor() != fUsedSpaceColor
|
||||||
|
|| settings.FreeSpaceColor() != fFreeSpaceColor
|
||||||
|
|| settings.WarningSpaceColor() != fWarningSpaceColor) {
|
||||||
settings.SetUsedSpaceColor(fUsedSpaceColor);
|
settings.SetUsedSpaceColor(fUsedSpaceColor);
|
||||||
settings.SetFreeSpaceColor(fFreeSpaceColor);
|
settings.SetFreeSpaceColor(fFreeSpaceColor);
|
||||||
settings.SetWarningSpaceColor(fWarningSpaceColor);
|
settings.SetWarningSpaceColor(fWarningSpaceColor);
|
||||||
|
tracker->SendNotices(kSpaceBarColorChanged);
|
||||||
|
}
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpaceBarSettingsView::ShowCurrentSettings(bool sendNotices)
|
SpaceBarSettingsView::ShowCurrentSettings()
|
||||||
{
|
{
|
||||||
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
|
||||||
if (!tracker)
|
|
||||||
return;
|
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
fSpaceBarShowCheckBox->SetValue(settings.ShowVolumeSpaceBar());
|
fSpaceBarShowCheckBox->SetValue(settings.ShowVolumeSpaceBar());
|
||||||
@@ -1363,16 +1467,6 @@ SpaceBarSettingsView::ShowCurrentSettings(bool sendNotices)
|
|||||||
fColorControl->SetValue(settings.WarningSpaceColor());
|
fColorControl->SetValue(settings.WarningSpaceColor());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendNotices) {
|
|
||||||
BMessage notificationMessage;
|
|
||||||
notificationMessage.AddBool("ShowVolumeSpaceBar", settings.ShowVolumeSpaceBar());
|
|
||||||
tracker->SendNotices(kShowVolumeSpaceBar, ¬ificationMessage);
|
|
||||||
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
|
||||||
BMessage notificationMessage2;
|
|
||||||
tracker->SendNotices(kSpaceBarColorChanged, ¬ificationMessage2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1389,13 +1483,17 @@ SpaceBarSettingsView::RecordRevertSettings()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SpaceBarSettingsView::ShowsRevertSettings() const
|
SpaceBarSettingsView::IsRevertable() const
|
||||||
{
|
{
|
||||||
return (fSpaceBarShow == (fSpaceBarShowCheckBox->Value() == 1));
|
TrackerSettings settings;
|
||||||
|
|
||||||
|
return fSpaceBarShow != (fSpaceBarShowCheckBox->Value() == B_CONTROL_ON)
|
||||||
|
|| fUsedSpaceColor != settings.UsedSpaceColor()
|
||||||
|
|| fFreeSpaceColor != settings.FreeSpaceColor()
|
||||||
|
|| fWarningSpaceColor != settings.WarningSpaceColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -1465,8 +1563,8 @@ TrashSettingsView::SetDefaults()
|
|||||||
settings.SetDontMoveFilesToTrash(false);
|
settings.SetDontMoveFilesToTrash(false);
|
||||||
settings.SetAskBeforeDeleteFile(true);
|
settings.SetAskBeforeDeleteFile(true);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1478,21 +1576,30 @@ TrashSettingsView::Revert()
|
|||||||
settings.SetDontMoveFilesToTrash(fDontMoveFilesToTrash);
|
settings.SetDontMoveFilesToTrash(fDontMoveFilesToTrash);
|
||||||
settings.SetAskBeforeDeleteFile(fAskBeforeDeleteFile);
|
settings.SetAskBeforeDeleteFile(fAskBeforeDeleteFile);
|
||||||
|
|
||||||
ShowCurrentSettings(true);
|
ShowCurrentSettings();
|
||||||
// true -> send notices about the change
|
_SendNotices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrashSettingsView::ShowCurrentSettings(bool sendNotices)
|
TrashSettingsView::_SendNotices()
|
||||||
|
{
|
||||||
|
TTracker *tracker = dynamic_cast<TTracker *>(be_app);
|
||||||
|
if (!tracker)
|
||||||
|
return;
|
||||||
|
|
||||||
|
tracker->SendNotices(kDontMoveFilesToTrashChanged);
|
||||||
|
tracker->SendNotices(kAskBeforeDeleteFileChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TrashSettingsView::ShowCurrentSettings()
|
||||||
{
|
{
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
|
|
||||||
fDontMoveFilesToTrashCheckBox->SetValue(settings.DontMoveFilesToTrash());
|
fDontMoveFilesToTrashCheckBox->SetValue(settings.DontMoveFilesToTrash());
|
||||||
fAskBeforeDeleteFileCheckBox->SetValue(settings.AskBeforeDeleteFile());
|
fAskBeforeDeleteFileCheckBox->SetValue(settings.AskBeforeDeleteFile());
|
||||||
|
|
||||||
if (sendNotices)
|
|
||||||
Window()->PostMessage(kSettingsContentsModified);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1507,9 +1614,9 @@ TrashSettingsView::RecordRevertSettings()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TrashSettingsView::ShowsRevertSettings() const
|
TrashSettingsView::IsRevertable() const
|
||||||
{
|
{
|
||||||
return (fDontMoveFilesToTrash == (fDontMoveFilesToTrashCheckBox->Value() > 0))
|
return fDontMoveFilesToTrash != (fDontMoveFilesToTrashCheckBox->Value() > 0)
|
||||||
&& (fAskBeforeDeleteFile == (fAskBeforeDeleteFileCheckBox->Value() > 0));
|
|| fAskBeforeDeleteFile != (fAskBeforeDeleteFileCheckBox->Value() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,33 +51,36 @@ 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:
|
|
||||||
|
|
||||||
|
protected:
|
||||||
typedef BView _inherited;
|
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();
|
||||||
|
|
||||||
|
virtual void SetDefaults();
|
||||||
|
virtual void Revert();
|
||||||
|
virtual void ShowCurrentSettings();
|
||||||
|
virtual void RecordRevertSettings();
|
||||||
|
virtual bool IsRevertable() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _SendNotices();
|
||||||
|
|
||||||
void SetDefaults();
|
|
||||||
void Revert();
|
|
||||||
void ShowCurrentSettings(bool sendNotices = false);
|
|
||||||
void RecordRevertSettings();
|
|
||||||
bool ShowsRevertSettings() const;
|
|
||||||
private:
|
|
||||||
BRadioButton *fShowDisksIconRadioButton;
|
BRadioButton *fShowDisksIconRadioButton;
|
||||||
BRadioButton *fMountVolumesOntoDesktopRadioButton;
|
BRadioButton *fMountVolumesOntoDesktopRadioButton;
|
||||||
BCheckBox *fMountSharedVolumesOntoDesktopCheckBox;
|
BCheckBox *fMountSharedVolumesOntoDesktopCheckBox;
|
||||||
@@ -94,23 +97,24 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
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:
|
|
||||||
|
private:
|
||||||
BCheckBox *fShowFullPathInTitleBarCheckBox;
|
BCheckBox *fShowFullPathInTitleBarCheckBox;
|
||||||
BCheckBox *fSingleWindowBrowseCheckBox;
|
BCheckBox *fSingleWindowBrowseCheckBox;
|
||||||
BCheckBox *fShowNavigatorCheckBox;
|
BCheckBox *fShowNavigatorCheckBox;
|
||||||
BCheckBox *fShowSelectionWhenInactiveCheckBox;
|
BCheckBox *fShowSelectionWhenInactiveCheckBox;
|
||||||
BCheckBox *fTransparentSelectionCheckBox;
|
BCheckBox *fOutlineSelectionCheckBox;
|
||||||
BCheckBox *fSortFolderNamesFirstCheckBox;
|
BCheckBox *fSortFolderNamesFirstCheckBox;
|
||||||
|
|
||||||
bool fShowFullPathInTitleBar;
|
bool fShowFullPathInTitleBar;
|
||||||
@@ -124,21 +128,24 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _GetAndRefreshDisplayedFigures() const;
|
||||||
|
void _SendNotices();
|
||||||
|
|
||||||
void GetAndRefreshDisplayedFigures() const;
|
|
||||||
private:
|
|
||||||
BCheckBox *fDesktopFilePanelRootCheckBox;
|
BCheckBox *fDesktopFilePanelRootCheckBox;
|
||||||
|
|
||||||
BTextControl *fRecentApplicationsTextControl; // Not used for the moment.
|
BTextControl *fRecentApplicationsTextControl; // Not used for the moment.
|
||||||
@@ -158,20 +165,22 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _UpdateExamples();
|
||||||
|
void _SendNotices();
|
||||||
|
|
||||||
void UpdateExamples();
|
|
||||||
private:
|
|
||||||
BRadioButton *f24HrRadioButton;
|
BRadioButton *f24HrRadioButton;
|
||||||
BRadioButton *f12HrRadioButton;
|
BRadioButton *f12HrRadioButton;
|
||||||
|
|
||||||
@@ -193,26 +202,23 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
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;
|
|
||||||
// BRadioButton *fWarningRadio;
|
|
||||||
// BRadioButton *fFreeRadio;
|
|
||||||
int32 fCurrentColor;
|
int32 fCurrentColor;
|
||||||
|
|
||||||
bool fSpaceBarShow;
|
bool fSpaceBarShow;
|
||||||
@@ -224,19 +230,21 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
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:
|
||||||
|
void _SendNotices();
|
||||||
|
|
||||||
private:
|
|
||||||
BCheckBox *fDontMoveFilesToTrashCheckBox;
|
BCheckBox *fDontMoveFilesToTrashCheckBox;
|
||||||
BCheckBox *fAskBeforeDeleteFileCheckBox;
|
BCheckBox *fAskBeforeDeleteFileCheckBox;
|
||||||
|
|
||||||
@@ -250,4 +258,4 @@ private:
|
|||||||
|
|
||||||
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;
|
||||||
@@ -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,18 +247,19 @@ 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;
|
||||||
|
|
||||||
@@ -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,14 +43,15 @@ 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);
|
||||||
@@ -60,7 +61,7 @@ public:
|
|||||||
void HandlePressedRevertButton();
|
void HandlePressedRevertButton();
|
||||||
void HandleChangedSettingsView();
|
void HandleChangedSettingsView();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BListView *fSettingsTypeListView;
|
BListView *fSettingsTypeListView;
|
||||||
BBox *fSettingsContainerBox;
|
BBox *fSettingsContainerBox;
|
||||||
BButton *fDefaultsButton;
|
BButton *fDefaultsButton;
|
||||||
@@ -71,13 +72,14 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
private:
|
||||||
SettingsView *fSettingsView;
|
SettingsView *fSettingsView;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,4 +87,4 @@ private:
|
|||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
#endif
|
#endif // _TRACKER_SETTINGS_WINDOW
|
||||||
|
|||||||
Reference in New Issue
Block a user