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:
parent
155eb53fc9
commit
7befa79ace
|
@ -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
|
||||
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
|
||||
FSClipboardClear()
|
||||
{
|
||||
|
@ -265,7 +268,7 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
|
|||
clipNode.moveMode = moveMode; // set it back to current value
|
||||
}
|
||||
} else {
|
||||
// add if it doesn't exist
|
||||
// add it if it doesn't exist
|
||||
if (clip->AddRef(refName, model->EntryRef()) == B_OK
|
||||
&& clip->AddInt32(modeName, (int32)moveMode) == B_OK) {
|
||||
pose->SetClipboardMode(moveMode);
|
||||
|
@ -278,7 +281,8 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
|
|||
} else {
|
||||
clip->RemoveName(modeName);
|
||||
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
|
||||
FSClipboardRemovePoses(const node_ref *directory, PoseList *list)
|
||||
{
|
||||
|
||||
if (!be_clipboard->Lock())
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -32,7 +32,24 @@ names are registered trademarks or trademarks of their respective holders.
|
|||
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 <Application.h>
|
||||
|
@ -57,23 +74,7 @@ All rights reserved.
|
|||
#include <Volume.h>
|
||||
#include <VolumeRoster.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 <string.h>
|
||||
|
||||
|
||||
const char *kDefaultFilePanelTemplate = "FilePanelSettings";
|
||||
|
@ -228,12 +229,12 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger *target,
|
|||
|
||||
TFilePanel::~TFilePanel()
|
||||
{
|
||||
// regardless of the hide/close method
|
||||
// always get rid of the config window
|
||||
// regardless of the hide/close method
|
||||
// always get rid of the config window
|
||||
if (fConfigWindow) {
|
||||
// moved from QuitRequested to ensure that
|
||||
// if the config window is showing that
|
||||
// it gets closed as well
|
||||
// moved from QuitRequested to ensure that
|
||||
// if the config window is showing that
|
||||
// it gets closed as well
|
||||
fConfigWindow->Lock();
|
||||
fConfigWindow->Quit();
|
||||
}
|
||||
|
@ -1028,10 +1029,8 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||
case B_REFS_RECEIVED:
|
||||
// item was double clicked in file panel (PoseView)
|
||||
if (message->FindRef("refs", &ref) == B_OK) {
|
||||
|
||||
BEntry entry(&ref, true);
|
||||
if (entry.InitCheck() == B_OK) {
|
||||
|
||||
// Double-click on dir or link-to-dir ALWAYS opens the dir.
|
||||
// If more than one dir is selected, the
|
||||
// first is entered.
|
||||
|
@ -1044,24 +1043,23 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||
PoseView()->SwitchDir(&ref);
|
||||
SwitchDirMenuTo(&ref);
|
||||
} else {
|
||||
|
||||
// Otherwise, we have a file or a link to a file.
|
||||
// AdjustButton has already tested the flavor;
|
||||
// all we have to do is see if the button is enabled.
|
||||
BButton *button = dynamic_cast<BButton *>(FindView("default button"));
|
||||
if (!button)
|
||||
break;
|
||||
|
||||
|
||||
if (IsSavePanel()) {
|
||||
int32 count = 0;
|
||||
type_code type;
|
||||
message->GetInfo("refs", &type, &count);
|
||||
|
||||
// Don't allow saves of multiple files
|
||||
if (count > 1)
|
||||
if (count > 1) {
|
||||
ShowCenteredAlert("Sorry, saving of more than one item is not allowed.",
|
||||
"Cancel");
|
||||
else {
|
||||
} else {
|
||||
// if we are a savepanel, set up the filepanel correctly
|
||||
// then pass control so we follow the same path as if the user
|
||||
// clicked the save button
|
||||
|
@ -1075,8 +1073,7 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// send handler a message and close
|
||||
BMessage openMessage(*fMessage);
|
||||
for (int32 index = 0; ; index++) {
|
||||
|
@ -1089,124 +1086,125 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kSwitchDirectory:
|
||||
{
|
||||
entry_ref ref;
|
||||
// this comes from dir menu or nav menu, so switch directories
|
||||
if (message->FindRef("refs", &ref) == B_OK) {
|
||||
BEntry entry(&ref, true);
|
||||
if (entry.GetRef(&ref) == B_OK)
|
||||
SetTo(&ref);
|
||||
}
|
||||
{
|
||||
entry_ref ref;
|
||||
// this comes from dir menu or nav menu, so switch directories
|
||||
if (message->FindRef("refs", &ref) == B_OK) {
|
||||
BEntry entry(&ref, true);
|
||||
if (entry.GetRef(&ref) == B_OK)
|
||||
SetTo(&ref);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case kSwitchToHome:
|
||||
{
|
||||
BPath homePath;
|
||||
entry_ref ref;
|
||||
if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK
|
||||
|| get_ref_for_path(homePath.Path(), &ref) != B_OK)
|
||||
break;
|
||||
|
||||
SetTo(&ref);
|
||||
}
|
||||
{
|
||||
BPath homePath;
|
||||
entry_ref ref;
|
||||
if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK
|
||||
|| get_ref_for_path(homePath.Path(), &ref) != B_OK)
|
||||
break;
|
||||
|
||||
SetTo(&ref);
|
||||
break;
|
||||
}
|
||||
|
||||
case kAddCurrentDir:
|
||||
{
|
||||
BPath path;
|
||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||
break;
|
||||
|
||||
path.Append(kGoDirectory);
|
||||
BDirectory goDirectory(path.Path());
|
||||
{
|
||||
BPath path;
|
||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||
break;
|
||||
|
||||
if (goDirectory.InitCheck() == B_OK) {
|
||||
BEntry entry(TargetModel()->EntryRef());
|
||||
entry.GetPath(&path);
|
||||
|
||||
BSymLink link;
|
||||
goDirectory.CreateSymLink(TargetModel()->Name(), path.Path(), &link);
|
||||
}
|
||||
path.Append(kGoDirectory);
|
||||
BDirectory goDirectory(path.Path());
|
||||
|
||||
if (goDirectory.InitCheck() == B_OK) {
|
||||
BEntry entry(TargetModel()->EntryRef());
|
||||
entry.GetPath(&path);
|
||||
|
||||
BSymLink link;
|
||||
goDirectory.CreateSymLink(TargetModel()->Name(), path.Path(), &link);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case kConfigShow:
|
||||
{
|
||||
if (fConfigWindow)
|
||||
fConfigWindow->Activate();
|
||||
else {
|
||||
BPath path;
|
||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||
break;
|
||||
|
||||
path.Append(kGoDirectory);
|
||||
BDirectory goDirectory(path.Path());
|
||||
|
||||
if (goDirectory.InitCheck() == B_OK) {
|
||||
entry_ref startref;
|
||||
BEntry entry;
|
||||
goDirectory.GetEntry(&entry);
|
||||
entry.GetRef(&startref);
|
||||
|
||||
int32 apps, docs, folders;
|
||||
TrackerSettings().RecentCounts(&apps, &docs, &folders);
|
||||
{
|
||||
if (fConfigWindow) {
|
||||
fConfigWindow->Activate();
|
||||
break;
|
||||
}
|
||||
|
||||
// if this is a save panel
|
||||
// then don't show recent docs controls
|
||||
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);
|
||||
}
|
||||
}
|
||||
BPath path;
|
||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||
break;
|
||||
|
||||
path.Append(kGoDirectory);
|
||||
BDirectory goDirectory(path.Path());
|
||||
|
||||
if (goDirectory.InitCheck() == B_OK) {
|
||||
entry_ref startref;
|
||||
BEntry entry;
|
||||
goDirectory.GetEntry(&entry);
|
||||
entry.GetRef(&startref);
|
||||
|
||||
int32 apps, docs, folders;
|
||||
TrackerSettings().RecentCounts(&apps, &docs, &folders);
|
||||
|
||||
// if this is a save panel
|
||||
// then don't show recent docs controls
|
||||
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;
|
||||
}
|
||||
|
||||
case kConfigClose:
|
||||
{
|
||||
int32 count = 0;
|
||||
TrackerSettings settings;
|
||||
{
|
||||
int32 count = 0;
|
||||
TrackerSettings settings;
|
||||
|
||||
// save off whatever was last in the fields
|
||||
// do this just in case someone didn't tab out
|
||||
if (message->FindInt32("applications", &count) == B_OK)
|
||||
settings.SetRecentApplicationsCount(count);
|
||||
if (message->FindInt32("folders", &count) == B_OK)
|
||||
settings.SetRecentFoldersCount(count);
|
||||
if (message->FindInt32("documents", &count) == B_OK)
|
||||
settings.SetRecentDocumentsCount(count);
|
||||
|
||||
settings.SaveSettings(false);
|
||||
// save off whatever was last in the fields
|
||||
// do this just in case someone didn't tab out
|
||||
if (message->FindInt32("applications", &count) == B_OK)
|
||||
settings.SetRecentApplicationsCount(count);
|
||||
if (message->FindInt32("folders", &count) == B_OK)
|
||||
settings.SetRecentFoldersCount(count);
|
||||
if (message->FindInt32("documents", &count) == B_OK)
|
||||
settings.SetRecentDocumentsCount(count);
|
||||
|
||||
fConfigWindow = NULL;
|
||||
}
|
||||
settings.SaveSettings(false);
|
||||
|
||||
fConfigWindow = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
case kUpdateAppsCount:
|
||||
case kUpdateDocsCount:
|
||||
case kUpdateFolderCount:
|
||||
{
|
||||
// messages sent when the user changes the count
|
||||
int32 count;
|
||||
TrackerSettings settings;
|
||||
|
||||
if (message->FindInt32("count", &count) == B_OK) {
|
||||
if (message->what == kUpdateAppsCount)
|
||||
settings.SetRecentApplicationsCount(count);
|
||||
else if (message->what == kUpdateDocsCount)
|
||||
settings.SetRecentDocumentsCount(count);
|
||||
else if (message->what == kUpdateFolderCount)
|
||||
settings.SetRecentFoldersCount(count);
|
||||
settings.SaveSettings(false);
|
||||
}
|
||||
{
|
||||
// messages sent when the user changes the count
|
||||
int32 count;
|
||||
TrackerSettings settings;
|
||||
|
||||
if (message->FindInt32("count", &count) == B_OK) {
|
||||
if (message->what == kUpdateAppsCount)
|
||||
settings.SetRecentApplicationsCount(count);
|
||||
else if (message->what == kUpdateDocsCount)
|
||||
settings.SetRecentDocumentsCount(count);
|
||||
else if (message->what == kUpdateFolderCount)
|
||||
settings.SetRecentFoldersCount(count);
|
||||
settings.SaveSettings(false);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case kCancelButton:
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
break;
|
||||
|
@ -1234,26 +1232,25 @@ TFilePanel::MessageReceived(BMessage *message)
|
|||
HandleSaveButton();
|
||||
} else
|
||||
HandleOpenButton();
|
||||
|
||||
break;
|
||||
|
||||
case B_OBSERVER_NOTICE_CHANGE:
|
||||
{
|
||||
int32 observerWhat;
|
||||
if (message->FindInt32("be:observe_change_what", &observerWhat) == B_OK) {
|
||||
switch (observerWhat) {
|
||||
case kDesktopFilePanelRootChanged:
|
||||
{
|
||||
bool desktopIsRoot = true;
|
||||
message->FindBool("DesktopFilePanelRoot", &desktopIsRoot);
|
||||
{
|
||||
int32 observerWhat;
|
||||
if (message->FindInt32("be:observe_change_what", &observerWhat) == B_OK) {
|
||||
switch (observerWhat) {
|
||||
case kDesktopFilePanelRootChanged:
|
||||
{
|
||||
bool desktopIsRoot = true;
|
||||
if (message->FindBool("DesktopFilePanelRoot", &desktopIsRoot) == B_OK)
|
||||
TrackerSettings().SetDesktopFilePanelRoot(desktopIsRoot);
|
||||
SetTo(TargetModel()->EntryRef());
|
||||
break;
|
||||
}
|
||||
SetTo(TargetModel()->EntryRef());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
_inherited::MessageReceived(message);
|
||||
|
@ -1267,7 +1264,7 @@ TFilePanel::OpenDirectory()
|
|||
BObjectList<BPose> *list = PoseView()->SelectionList();
|
||||
if (list->CountItems() != 1)
|
||||
return;
|
||||
|
||||
|
||||
Model *model = list->FirstItem()->TargetModel();
|
||||
if (model->ResolveIfLink()->IsDirectory()) {
|
||||
BMessage message(B_REFS_RECEIVED);
|
||||
|
@ -1558,9 +1555,12 @@ TFilePanel::WindowActivated(bool active)
|
|||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
BFilePanelPoseView::BFilePanelPoseView(Model *model, BRect frame, uint32 resizeMask)
|
||||
: BPoseView(model, frame, kListMode, resizeMask),
|
||||
fIsDesktop(false)
|
||||
: BPoseView(model, frame, kListMode, resizeMask),
|
||||
fIsDesktop(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -2272,22 +2272,36 @@ BPoseView::MessageReceived(BMessage *message)
|
|||
break;
|
||||
|
||||
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();
|
||||
break;
|
||||
}
|
||||
|
||||
case kTransparentSelectionChanged:
|
||||
message->FindBool("TransparentSelection", &fTransparentSelection);
|
||||
TrackerSettings().SetTransparentSelection(fTransparentSelection);
|
||||
{
|
||||
bool transparentSelection;
|
||||
if (message->FindBool("TransparentSelection", &transparentSelection) == B_OK) {
|
||||
fTransparentSelection = transparentSelection;
|
||||
TrackerSettings().SetTransparentSelection(fTransparentSelection);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case kSortFolderNamesFirstChanged:
|
||||
if (ViewMode() == kListMode) {
|
||||
TrackerSettings settings;
|
||||
bool sortFolderNamesFirst;
|
||||
message->FindBool("SortFolderNamesFirst", &sortFolderNamesFirst);
|
||||
TrackerSettings().SetSortFolderNamesFirst(sortFolderNamesFirst);
|
||||
NameAttributeText::SetSortFolderNamesFirst(sortFolderNamesFirst);
|
||||
if (message->FindBool("SortFolderNamesFirst", &sortFolderNamesFirst) == B_OK)
|
||||
settings.SetSortFolderNamesFirst(sortFolderNamesFirst);
|
||||
|
||||
NameAttributeText::SetSortFolderNamesFirst(settings.SortFolderNamesFirst());
|
||||
SortPoses();
|
||||
Invalidate();
|
||||
}
|
||||
|
@ -2295,8 +2309,8 @@ BPoseView::MessageReceived(BMessage *message)
|
|||
|
||||
case kShowVolumeSpaceBar:
|
||||
bool enabled;
|
||||
message->FindBool("ShowVolumeSpaceBar", &enabled);
|
||||
TrackerSettings().SetShowVolumeSpaceBar(enabled);
|
||||
if (message->FindBool("ShowVolumeSpaceBar", &enabled) == B_OK)
|
||||
TrackerSettings().SetShowVolumeSpaceBar(enabled);
|
||||
// supposed to fall through
|
||||
case kSpaceBarColorChanged:
|
||||
UpdateVolumeIcons();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -51,203 +51,211 @@ class BStringView;
|
|||
namespace BPrivate {
|
||||
|
||||
class SettingsView : public BView {
|
||||
public:
|
||||
SettingsView(BRect, const char *);
|
||||
virtual ~SettingsView();
|
||||
public:
|
||||
SettingsView(BRect frame, const char *name);
|
||||
virtual ~SettingsView();
|
||||
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings(bool sendNotices = false);
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool ShowsRevertSettings() const;
|
||||
protected:
|
||||
|
||||
typedef BView _inherited;
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings();
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool IsRevertable() const;
|
||||
|
||||
protected:
|
||||
typedef BView _inherited;
|
||||
};
|
||||
|
||||
class DesktopSettingsView : public SettingsView {
|
||||
public:
|
||||
DesktopSettingsView(BRect);
|
||||
|
||||
void MessageReceived(BMessage *);
|
||||
void AttachedToWindow();
|
||||
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
void ShowCurrentSettings(bool sendNotices = false);
|
||||
void RecordRevertSettings();
|
||||
bool ShowsRevertSettings() const;
|
||||
private:
|
||||
BRadioButton *fShowDisksIconRadioButton;
|
||||
BRadioButton *fMountVolumesOntoDesktopRadioButton;
|
||||
BCheckBox *fMountSharedVolumesOntoDesktopCheckBox;
|
||||
BCheckBox *fIntegrateNonBootBeOSDesktopsCheckBox;
|
||||
BCheckBox *fEjectWhenUnmountingCheckBox;
|
||||
public:
|
||||
DesktopSettingsView(BRect frame);
|
||||
|
||||
bool fShowDisksIcon;
|
||||
bool fMountVolumesOntoDesktop;
|
||||
bool fMountSharedVolumesOntoDesktop;
|
||||
bool fIntegrateNonBootBeOSDesktops;
|
||||
bool fEjectWhenUnmounting;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings();
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool IsRevertable() const;
|
||||
|
||||
private:
|
||||
void _SendNotices();
|
||||
|
||||
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 {
|
||||
public:
|
||||
WindowsSettingsView(BRect);
|
||||
public:
|
||||
WindowsSettingsView(BRect frame);
|
||||
|
||||
void MessageReceived(BMessage *);
|
||||
void AttachedToWindow();
|
||||
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
void ShowCurrentSettings(bool sendNotices = false);
|
||||
void RecordRevertSettings();
|
||||
bool ShowsRevertSettings() const;
|
||||
private:
|
||||
BCheckBox *fShowFullPathInTitleBarCheckBox;
|
||||
BCheckBox *fSingleWindowBrowseCheckBox;
|
||||
BCheckBox *fShowNavigatorCheckBox;
|
||||
BCheckBox *fShowSelectionWhenInactiveCheckBox;
|
||||
BCheckBox *fTransparentSelectionCheckBox;
|
||||
BCheckBox *fSortFolderNamesFirstCheckBox;
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
bool fShowFullPathInTitleBar;
|
||||
bool fSingleWindowBrowse;
|
||||
bool fShowNavigator;
|
||||
bool fShowSelectionWhenInactive;
|
||||
bool fTransparentSelection;
|
||||
bool fSortFolderNamesFirst;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings();
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool IsRevertable() const;
|
||||
|
||||
private:
|
||||
BCheckBox *fShowFullPathInTitleBarCheckBox;
|
||||
BCheckBox *fSingleWindowBrowseCheckBox;
|
||||
BCheckBox *fShowNavigatorCheckBox;
|
||||
BCheckBox *fShowSelectionWhenInactiveCheckBox;
|
||||
BCheckBox *fOutlineSelectionCheckBox;
|
||||
BCheckBox *fSortFolderNamesFirstCheckBox;
|
||||
|
||||
bool fShowFullPathInTitleBar;
|
||||
bool fSingleWindowBrowse;
|
||||
bool fShowNavigator;
|
||||
bool fShowSelectionWhenInactive;
|
||||
bool fTransparentSelection;
|
||||
bool fSortFolderNamesFirst;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
};
|
||||
|
||||
class FilePanelSettingsView : public SettingsView {
|
||||
public:
|
||||
FilePanelSettingsView(BRect);
|
||||
~FilePanelSettingsView();
|
||||
public:
|
||||
FilePanelSettingsView(BRect frame);
|
||||
virtual ~FilePanelSettingsView();
|
||||
|
||||
void MessageReceived(BMessage *);
|
||||
void AttachedToWindow();
|
||||
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
void ShowCurrentSettings(bool sendNotices = false);
|
||||
void RecordRevertSettings();
|
||||
bool ShowsRevertSettings() const;
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
void GetAndRefreshDisplayedFigures() const;
|
||||
private:
|
||||
BCheckBox *fDesktopFilePanelRootCheckBox;
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings();
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool IsRevertable() const;
|
||||
|
||||
BTextControl *fRecentApplicationsTextControl; // Not used for the moment.
|
||||
BTextControl *fRecentDocumentsTextControl;
|
||||
BTextControl *fRecentFoldersTextControl;
|
||||
|
||||
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;
|
||||
private:
|
||||
void _GetAndRefreshDisplayedFigures() const;
|
||||
void _SendNotices();
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
BCheckBox *fDesktopFilePanelRootCheckBox;
|
||||
|
||||
BTextControl *fRecentApplicationsTextControl; // Not used for the moment.
|
||||
BTextControl *fRecentDocumentsTextControl;
|
||||
BTextControl *fRecentFoldersTextControl;
|
||||
|
||||
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 {
|
||||
public:
|
||||
TimeFormatSettingsView(BRect);
|
||||
public:
|
||||
TimeFormatSettingsView(BRect frame);
|
||||
|
||||
void MessageReceived(BMessage *);
|
||||
void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
void ShowCurrentSettings(bool sendNotices = false);
|
||||
void RecordRevertSettings();
|
||||
bool ShowsRevertSettings() const;
|
||||
|
||||
void UpdateExamples();
|
||||
private:
|
||||
BRadioButton *f24HrRadioButton;
|
||||
BRadioButton *f12HrRadioButton;
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings();
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool IsRevertable() const;
|
||||
|
||||
BRadioButton *fYMDRadioButton;
|
||||
BRadioButton *fDMYRadioButton;
|
||||
BRadioButton *fMDYRadioButton;
|
||||
private:
|
||||
void _UpdateExamples();
|
||||
void _SendNotices();
|
||||
|
||||
BMenuField *fSeparatorMenuField;
|
||||
|
||||
BStringView *fLongDateExampleView;
|
||||
BStringView *fShortDateExampleView;
|
||||
|
||||
bool f24HrClock;
|
||||
BRadioButton *f24HrRadioButton;
|
||||
BRadioButton *f12HrRadioButton;
|
||||
|
||||
FormatSeparator fSeparator;
|
||||
DateOrder fFormat;
|
||||
BRadioButton *fYMDRadioButton;
|
||||
BRadioButton *fDMYRadioButton;
|
||||
BRadioButton *fMDYRadioButton;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
BMenuField *fSeparatorMenuField;
|
||||
|
||||
BStringView *fLongDateExampleView;
|
||||
BStringView *fShortDateExampleView;
|
||||
|
||||
bool f24HrClock;
|
||||
|
||||
FormatSeparator fSeparator;
|
||||
DateOrder fFormat;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
};
|
||||
|
||||
class SpaceBarSettingsView : public SettingsView {
|
||||
public:
|
||||
SpaceBarSettingsView(BRect);
|
||||
~SpaceBarSettingsView();
|
||||
public:
|
||||
SpaceBarSettingsView(BRect frame);
|
||||
virtual ~SpaceBarSettingsView();
|
||||
|
||||
void MessageReceived(BMessage *);
|
||||
void AttachedToWindow();
|
||||
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
void ShowCurrentSettings(bool sendNotices = false);
|
||||
void RecordRevertSettings();
|
||||
bool ShowsRevertSettings() const;
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
private:
|
||||
BCheckBox *fSpaceBarShowCheckBox;
|
||||
BColorControl *fColorControl;
|
||||
BMenuField *fColorPicker;
|
||||
// BRadioButton *fUsedRadio;
|
||||
// BRadioButton *fWarningRadio;
|
||||
// BRadioButton *fFreeRadio;
|
||||
int32 fCurrentColor;
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings();
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool IsRevertable() const;
|
||||
|
||||
bool fSpaceBarShow;
|
||||
rgb_color fUsedSpaceColor;
|
||||
rgb_color fFreeSpaceColor;
|
||||
rgb_color fWarningSpaceColor;
|
||||
private:
|
||||
BCheckBox *fSpaceBarShowCheckBox;
|
||||
BColorControl *fColorControl;
|
||||
BMenuField *fColorPicker;
|
||||
int32 fCurrentColor;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
bool fSpaceBarShow;
|
||||
rgb_color fUsedSpaceColor;
|
||||
rgb_color fFreeSpaceColor;
|
||||
rgb_color fWarningSpaceColor;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
};
|
||||
|
||||
class TrashSettingsView : public SettingsView {
|
||||
public:
|
||||
TrashSettingsView(BRect);
|
||||
public:
|
||||
TrashSettingsView(BRect frame);
|
||||
|
||||
void MessageReceived(BMessage *);
|
||||
void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
void ShowCurrentSettings(bool sendNotices = false);
|
||||
void RecordRevertSettings();
|
||||
bool ShowsRevertSettings() const;
|
||||
virtual void SetDefaults();
|
||||
virtual void Revert();
|
||||
virtual void ShowCurrentSettings();
|
||||
virtual void RecordRevertSettings();
|
||||
virtual bool IsRevertable() const;
|
||||
|
||||
private:
|
||||
BCheckBox *fDontMoveFilesToTrashCheckBox;
|
||||
BCheckBox *fAskBeforeDeleteFileCheckBox;
|
||||
private:
|
||||
void _SendNotices();
|
||||
|
||||
bool fDontMoveFilesToTrash;
|
||||
bool fAskBeforeDeleteFile;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
BCheckBox *fDontMoveFilesToTrashCheckBox;
|
||||
BCheckBox *fAskBeforeDeleteFileCheckBox;
|
||||
|
||||
bool fDontMoveFilesToTrash;
|
||||
bool fAskBeforeDeleteFile;
|
||||
|
||||
typedef SettingsView _inherited;
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
using namespace BPrivate;
|
||||
|
||||
#endif
|
||||
#endif // _SETTINGS_VIEWS
|
||||
|
|
|
@ -172,7 +172,7 @@ TTrackerState::LoadSettingsIfNeeded()
|
|||
Add(fMountSharedVolumesOntoDesktop =
|
||||
new BooleanValueSetting("MountSharedVolumesOntoDesktop", false));
|
||||
Add(fIntegrateNonBootBeOSDesktops = new BooleanValueSetting
|
||||
("IntegrateNonBootBeOSDesktops", true));
|
||||
("IntegrateNonBootBeOSDesktops", false));
|
||||
Add(fIntegrateAllNonBootDesktops = new BooleanValueSetting
|
||||
("IntegrateAllNonBootDesktops", false));
|
||||
Add(fEjectWhenUnmounting = new BooleanValueSetting("EjectWhenUnmounting", true));
|
||||
|
@ -180,7 +180,7 @@ TTrackerState::LoadSettingsIfNeeded()
|
|||
Add(fDesktopFilePanelRoot = new BooleanValueSetting("DesktopFilePanelRoot", true));
|
||||
Add(fShowFullPathInTitleBar = new BooleanValueSetting("ShowFullPathInTitleBar", false));
|
||||
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(fHideDotFiles = new BooleanValueSetting("HideDotFiles", false));
|
||||
Add(fSingleWindowBrowse = new BooleanValueSetting("SingleWindowBrowse", false));
|
||||
|
|
|
@ -32,12 +32,14 @@ names are registered trademarks or trademarks of their respective holders.
|
|||
All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "SettingsViews.h"
|
||||
#include "TrackerSettings.h"
|
||||
#include "TrackerSettingsWindow.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
|
||||
|
||||
const BPoint kSettingsWindowOffset(30, 30);
|
||||
const float kSettingsWindowsWidth = 370;
|
||||
const float kSettingsWindowsHeight = 270;
|
||||
|
@ -48,27 +50,27 @@ const uint32 kRevertButtonPressed = 'Rebp';
|
|||
|
||||
|
||||
TrackerSettingsWindow::TrackerSettingsWindow()
|
||||
: BWindow(BRect(kSettingsWindowOffset.x, kSettingsWindowOffset.y,
|
||||
kSettingsWindowOffset.x + kSettingsWindowsWidth,
|
||||
kSettingsWindowOffset.y + kSettingsWindowsHeight),
|
||||
"Tracker Settings", B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
||||
| B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE
|
||||
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
||||
: BWindow(BRect(kSettingsWindowOffset.x, kSettingsWindowOffset.y,
|
||||
kSettingsWindowOffset.x + kSettingsWindowsWidth,
|
||||
kSettingsWindowOffset.y + kSettingsWindowsHeight),
|
||||
"Tracker Settings", B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
||||
| B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE
|
||||
| B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
||||
{
|
||||
BView *backgroundView = new BView(Bounds(), "Background", B_FOLLOW_ALL_SIDES, 0);
|
||||
|
||||
|
||||
backgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
AddChild(backgroundView);
|
||||
|
||||
|
||||
const float kBorderDistance = 12;
|
||||
const float kListViewWidth = 90;
|
||||
const float kListViewHeight = kSettingsWindowsHeight - 2 * kBorderDistance;
|
||||
const float kBoxWidth = kSettingsWindowsWidth - kListViewWidth - 3 * (kBorderDistance - 1);
|
||||
const float kBoxHeight = kListViewHeight - 30;
|
||||
|
||||
|
||||
BRect listViewRect(kBorderDistance, kBorderDistance, kBorderDistance + kListViewWidth,
|
||||
kBorderDistance + kListViewHeight);
|
||||
|
||||
|
||||
BBox *borderBox = new BBox(listViewRect.InsetByCopy(-2, -2));
|
||||
|
||||
backgroundView->AddChild(borderBox);
|
||||
|
@ -77,20 +79,20 @@ TrackerSettingsWindow::TrackerSettingsWindow()
|
|||
listViewRect.right -= 1;
|
||||
|
||||
fSettingsTypeListView = new BListView(listViewRect, "List View");
|
||||
|
||||
|
||||
borderBox->AddChild(fSettingsTypeListView);
|
||||
|
||||
|
||||
fSettingsContainerBox = new BBox(BRect(kBorderDistance + kListViewWidth + kBorderDistance,
|
||||
kBorderDistance, kBorderDistance + kListViewWidth + kBorderDistance + kBoxWidth,
|
||||
kBorderDistance + kBoxHeight));
|
||||
|
||||
|
||||
backgroundView->AddChild(fSettingsContainerBox);
|
||||
|
||||
|
||||
const float kButtonTop = fSettingsContainerBox->Frame().bottom + kBorderDistance;
|
||||
const float kDefaultsButtonLeft = fSettingsContainerBox->Frame().left;
|
||||
const float kButtonWidth = 45;
|
||||
const float kButtonHeight = 20;
|
||||
|
||||
|
||||
fDefaultsButton = new BButton(BRect(kDefaultsButtonLeft, kButtonTop,
|
||||
kDefaultsButtonLeft + kButtonWidth, kButtonTop + kButtonHeight),
|
||||
"Defaults", "Defaults", new BMessage(kDefaultsButtonPressed));
|
||||
|
@ -103,15 +105,15 @@ TrackerSettingsWindow::TrackerSettingsWindow()
|
|||
fRevertButton = new BButton(BRect(fDefaultsButton->Frame().right + kBorderDistance,
|
||||
kButtonTop, fDefaultsButton->Frame().right + kBorderDistance + kButtonWidth, kButtonTop
|
||||
+ kButtonHeight), "Revert", "Revert", new BMessage(kRevertButtonPressed));
|
||||
|
||||
|
||||
fRevertButton->SetEnabled(false);
|
||||
fRevertButton->ResizeToPreferred();
|
||||
backgroundView->AddChild(fRevertButton);
|
||||
|
||||
BRect SettingsViewSize = fSettingsContainerBox->Bounds().InsetByCopy(5, 5);
|
||||
|
||||
|
||||
SettingsViewSize.top += 10;
|
||||
|
||||
|
||||
fSettingsTypeListView->AddItem(new SettingsItem("Desktop",
|
||||
new DesktopSettingsView(SettingsViewSize)));
|
||||
fSettingsTypeListView->AddItem(new SettingsItem("Windows",
|
||||
|
@ -141,7 +143,7 @@ TrackerSettingsWindow::QuitRequested()
|
|||
Unlock();
|
||||
} else
|
||||
return true;
|
||||
|
||||
|
||||
if (isHidden)
|
||||
return true;
|
||||
|
||||
|
@ -154,16 +156,15 @@ TrackerSettingsWindow::QuitRequested()
|
|||
void
|
||||
TrackerSettingsWindow::MessageReceived(BMessage *message)
|
||||
{
|
||||
|
||||
switch (message->what) {
|
||||
case kSettingsContentsModified:
|
||||
HandleChangedContents();
|
||||
break;
|
||||
|
||||
|
||||
case kDefaultsButtonPressed:
|
||||
HandlePressedDefaultsButton();
|
||||
break;
|
||||
|
||||
|
||||
case kRevertButtonPressed:
|
||||
HandlePressedRevertButton();
|
||||
break;
|
||||
|
@ -171,7 +172,7 @@ TrackerSettingsWindow::MessageReceived(BMessage *message)
|
|||
case kSettingsViewChanged:
|
||||
HandleChangedSettingsView();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
_inherited::MessageReceived(message);
|
||||
}
|
||||
|
@ -182,16 +183,15 @@ void
|
|||
TrackerSettingsWindow::Show()
|
||||
{
|
||||
if (Lock()) {
|
||||
|
||||
int32 itemCount = fSettingsTypeListView->CountItems();
|
||||
|
||||
for (int32 i = 0; i<itemCount; i++) {
|
||||
|
||||
for (int32 i = 0; i < itemCount; i++) {
|
||||
ViewAt(i)->RecordRevertSettings();
|
||||
ViewAt(i)->ShowCurrentSettings();
|
||||
}
|
||||
|
||||
fSettingsTypeListView->Invalidate();
|
||||
|
||||
|
||||
Unlock();
|
||||
}
|
||||
_inherited::Show();
|
||||
|
@ -218,10 +218,11 @@ TrackerSettingsWindow::HandleChangedContents()
|
|||
int32 itemCount = fSettingsTypeListView->CountItems();
|
||||
|
||||
bool revertable = false;
|
||||
|
||||
for (int32 i = 0; i < itemCount; i++)
|
||||
revertable |= ! ViewAt(i)->ShowsRevertSettings();
|
||||
|
||||
|
||||
for (int32 i = 0; i < itemCount; i++) {
|
||||
revertable |= ViewAt(i)->IsRevertable();
|
||||
}
|
||||
|
||||
fSettingsTypeListView->Invalidate();
|
||||
fRevertButton->SetEnabled(revertable);
|
||||
|
||||
|
@ -245,24 +246,25 @@ void
|
|||
TrackerSettingsWindow::HandlePressedRevertButton()
|
||||
{
|
||||
int32 itemCount = fSettingsTypeListView->CountItems();
|
||||
|
||||
for (int32 i = 0; i < itemCount; i++)
|
||||
if (ViewAt(i)->ShowsRevertSettings() == false)
|
||||
|
||||
for (int32 i = 0; i < itemCount; i++) {
|
||||
if (ViewAt(i)->IsRevertable())
|
||||
ViewAt(i)->Revert();
|
||||
}
|
||||
|
||||
HandleChangedContents();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackerSettingsWindow::HandleChangedSettingsView()
|
||||
{
|
||||
int32 currentSelection = fSettingsTypeListView->CurrentSelection();
|
||||
|
||||
if (currentSelection < 0)
|
||||
return;
|
||||
|
||||
BView *oldView = fSettingsContainerBox->ChildAt(0);
|
||||
|
||||
|
||||
BView *oldView = fSettingsContainerBox->ChildAt(0);
|
||||
|
||||
if (oldView)
|
||||
oldView->RemoveSelf();
|
||||
|
||||
|
@ -276,13 +278,18 @@ TrackerSettingsWindow::HandleChangedSettingsView()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
SettingsItem::SettingsItem(const char *label, SettingsView *view)
|
||||
: BStringItem(label),
|
||||
fSettingsView(view)
|
||||
: BStringItem(label),
|
||||
fSettingsView(view)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
void
|
||||
SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
||||
{
|
||||
const rgb_color kModifiedColor = {0, 0, 255, 0};
|
||||
|
@ -290,7 +297,7 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
|||
const rgb_color kSelectedColor = {140, 140, 140, 0};
|
||||
|
||||
if (fSettingsView) {
|
||||
bool showsRevertSettings = fSettingsView->ShowsRevertSettings();
|
||||
bool isRevertable = fSettingsView->IsRevertable();
|
||||
bool isSelected = IsSelected();
|
||||
|
||||
if (isSelected || drawEverything) {
|
||||
|
@ -304,14 +311,14 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
|||
owner->SetLowColor(color);
|
||||
owner->FillRect(rect);
|
||||
}
|
||||
|
||||
if (!showsRevertSettings)
|
||||
|
||||
if (isRevertable)
|
||||
owner->SetHighColor(kModifiedColor);
|
||||
else
|
||||
owner->SetHighColor(kBlack);
|
||||
|
||||
owner->MovePenTo(rect.left + 4, rect.bottom - 2);
|
||||
|
||||
|
||||
owner->DrawString(Text());
|
||||
|
||||
owner->SetHighColor(kBlack);
|
||||
|
@ -319,6 +326,7 @@ SettingsItem::DrawItem(BView *owner, BRect rect, bool drawEverything)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
SettingsView *
|
||||
SettingsItem::View()
|
||||
{
|
||||
|
|
|
@ -43,46 +43,48 @@ All rights reserved.
|
|||
|
||||
#include "SettingsViews.h"
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class TrackerSettingsWindow : public BWindow {
|
||||
public:
|
||||
TrackerSettingsWindow();
|
||||
|
||||
bool QuitRequested();
|
||||
void MessageReceived(BMessage *);
|
||||
void Show();
|
||||
|
||||
SettingsView *ViewAt(int32 i);
|
||||
public:
|
||||
TrackerSettingsWindow();
|
||||
|
||||
void HandleChangedContents();
|
||||
void HandlePressedDefaultsButton();
|
||||
void HandlePressedRevertButton();
|
||||
void HandleChangedSettingsView();
|
||||
|
||||
private:
|
||||
BListView *fSettingsTypeListView;
|
||||
BBox *fSettingsContainerBox;
|
||||
BButton *fDefaultsButton;
|
||||
BButton *fRevertButton;
|
||||
bool QuitRequested();
|
||||
void MessageReceived(BMessage *message);
|
||||
void Show();
|
||||
|
||||
typedef BWindow _inherited;
|
||||
SettingsView *ViewAt(int32 i);
|
||||
|
||||
void HandleChangedContents();
|
||||
void HandlePressedDefaultsButton();
|
||||
void HandlePressedRevertButton();
|
||||
void HandleChangedSettingsView();
|
||||
|
||||
private:
|
||||
BListView *fSettingsTypeListView;
|
||||
BBox *fSettingsContainerBox;
|
||||
BButton *fDefaultsButton;
|
||||
BButton *fRevertButton;
|
||||
|
||||
typedef BWindow _inherited;
|
||||
};
|
||||
|
||||
|
||||
class SettingsItem : public BStringItem {
|
||||
public:
|
||||
SettingsItem(const char *, SettingsView *);
|
||||
public:
|
||||
SettingsItem(const char *label, SettingsView *view);
|
||||
|
||||
void DrawItem(BView *owner, BRect rect, bool drawEverything);
|
||||
void DrawItem(BView *owner, BRect rect, bool drawEverything);
|
||||
|
||||
SettingsView *View();
|
||||
private:
|
||||
SettingsView *fSettingsView;
|
||||
SettingsView *View();
|
||||
|
||||
private:
|
||||
SettingsView *fSettingsView;
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
using namespace BPrivate;
|
||||
|
||||
#endif
|
||||
#endif // _TRACKER_SETTINGS_WINDOW
|
||||
|
|
Loading…
Reference in New Issue