diff --git a/src/preferences/time/Jamfile b/src/preferences/time/Jamfile index dc23491d5f..5d32a5efec 100644 --- a/src/preferences/time/Jamfile +++ b/src/preferences/time/Jamfile @@ -20,7 +20,6 @@ Preference Time : TZDisplay.cpp ZoneView.cpp DateTime.cpp - SettingsView.cpp : be : Time.rdef ; diff --git a/src/preferences/time/SettingsView.cpp b/src/preferences/time/SettingsView.cpp deleted file mode 100644 index dad0f25000..0000000000 --- a/src/preferences/time/SettingsView.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 2007, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Julun - */ - -#include "SettingsView.h" -#include "TimeMessages.h" - - -#include -#include -#include -#include -#include -#include - - -const uint32 kMsgMilTime = 'MilT'; -const uint32 kMsgShowSeconds = 'ShSc'; - - -const uint32 kMsgIsoDate = 'IDat'; -const uint32 kMsgEuroDate = 'EDat'; -const uint32 kMonthDayYear = '_mdy'; -const uint32 kSeparatorChanged = '_tsc'; -const uint32 kTrackerDateFormatChanged = 'TDFC'; - - -const char* kDeskbarSignature = "application/x-vnd.Be-TSKB"; -const char* kTrackerSignature = "application/x-vnd.Be-TRAK"; - - -SettingsView::SettingsView(BRect frame) - : BView(frame, "Settings", B_FOLLOW_ALL, - B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP), - fInitialized(false), - fRecentDateWhat(kMonthDayYear) -{ -} - - -SettingsView::~SettingsView() -{ -} - - -void -SettingsView::AttachedToWindow() -{ - if (Parent()) - SetViewColor(Parent()->ViewColor()); - - if (!fInitialized) { - _InitView(); - fInitialized = true; - } -} - - -void -SettingsView::MessageReceived(BMessage *message) -{ - switch (message->what) { - case kMsgMilTime: - case kMsgIsoDate: - _UpdateTimeSettings(message->what); - break; - - case kMsgEuroDate: - case kMonthDayYear: - case kMsgShowSeconds: - _UpdateDateSettings(message->what); - break; - - default: - BView::MessageReceived(message); - break; - } -} - - -void -SettingsView::_InitView() -{ - BRect bounds(Bounds()); - bounds.InsetBy(10.0, 10.0); - - BRect frameLeft(Bounds()); - frameLeft.right = frameLeft.Width() / 2; - frameLeft.InsetBy(10.0f, 10.0f); - - BStringView *timeSettings = new BStringView(frameLeft, "time", "Time:"); - AddChild(timeSettings); - timeSettings->ResizeToPreferred(); - - frameLeft.OffsetBy(10.0, timeSettings->Bounds().Height() + 5.0); - fShow24Hours = new BCheckBox(frameLeft, "show24Hours", "24 Hour Clock" - , new BMessage(kMsgMilTime)); - AddChild(fShow24Hours); - fShow24Hours->SetTarget(this); - fShow24Hours->ResizeToPreferred(); - - frameLeft.OffsetBy(0.0, fShow24Hours->Bounds().Height() + 5.0); - fShowSeconds = new BCheckBox(frameLeft, "showSeconds", "Show Seconds" - , new BMessage(kMsgShowSeconds)); - AddChild(fShowSeconds); - fShowSeconds->SetTarget(this); - fShowSeconds->ResizeToPreferred(); - - frameLeft.OffsetBy(0.0, 2 * fShowSeconds->Bounds().Height() + 5.0); - fGmtTime = new BRadioButton(frameLeft, "gmtTime", "Set clock to GMT" - , new BMessage(kRTCUpdate)); - AddChild(fGmtTime); - fGmtTime->ResizeToPreferred(); - - frameLeft.OffsetBy(0.0, fGmtTime->Bounds().Height() + 5.0); - fLocalTime = new BRadioButton(frameLeft, "local", "Set clock to local time", - new BMessage(kRTCUpdate)); - AddChild(fLocalTime); - fLocalTime->ResizeToPreferred(); - fLocalTime->SetValue(B_CONTROL_ON); - - BRect frameRight(Bounds()); - frameRight.left = frameRight.Width() / 2; - frameRight.InsetBy(10.0f, 10.0f); - - BView *dateView = new BView(frameRight, "dateView", B_FOLLOW_ALL, - B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP); - AddChild(dateView); - if (Parent()) - dateView->SetViewColor(Parent()->ViewColor()); - - frameRight.OffsetTo(B_ORIGIN); - BStringView *dateSettings = new BStringView(frameRight, "date", "Date:"); - dateView->AddChild(dateSettings); - dateSettings->ResizeToPreferred(); - - frameRight.OffsetBy(10.0, dateSettings->Bounds().Height() + 5.0); - fYearMonthDay = new BRadioButton(frameRight, "yearMonthDay", "Year-Month-Day" - , new BMessage(kMsgIsoDate)); - dateView->AddChild(fYearMonthDay); - fYearMonthDay->SetTarget(this); - fYearMonthDay->ResizeToPreferred(); - - frameRight.OffsetBy(0.0, fYearMonthDay->Bounds().Height() + 5.0); - fDayMonthYear = new BRadioButton(frameRight, "dayMonthYear", "Day-Month-Year" - , new BMessage(kMsgEuroDate)); - dateView->AddChild(fDayMonthYear); - fDayMonthYear->SetTarget(this); - fDayMonthYear->ResizeToPreferred(); - - frameRight.OffsetBy(0.0, fDayMonthYear->Bounds().Height() + 5.0); - fMonthDayYear = new BRadioButton(frameRight, "monthDayYear", "Month-Day-Year" - , new BMessage(kMonthDayYear)); - dateView->AddChild(fMonthDayYear); - fMonthDayYear->SetTarget(this); - fMonthDayYear->ResizeToPreferred(); - fMonthDayYear->SetValue(B_CONTROL_ON); - - frameRight.OffsetBy(0.0, fMonthDayYear->Bounds().Height() + 5.0); - fStartWeekMonday = new BCheckBox(frameRight, "startWeekMonday" - , "Start week with Monday", new BMessage(kWeekStart)); - dateView->AddChild(fStartWeekMonday); - fStartWeekMonday->SetTarget(this); - fStartWeekMonday->ResizeToPreferred(); - - fDateSeparator = new BPopUpMenu("Separator"); - fDateSeparator->AddItem(new BMenuItem("-", new BMessage(kSeparatorChanged))); - BMenuItem *item = new BMenuItem("/", new BMessage(kSeparatorChanged)); - fDateSeparator->AddItem(item); - item->SetMarked(true); - fDateSeparator->AddItem(new BMenuItem("\\", new BMessage(kSeparatorChanged))); - fDateSeparator->AddItem(new BMenuItem(".", new BMessage(kSeparatorChanged))); - fDateSeparator->AddItem(new BMenuItem("None", new BMessage(kSeparatorChanged))); - fDateSeparator->AddItem(new BMenuItem("Space", new BMessage(kSeparatorChanged))); - - frameRight.OffsetBy(0.0, fStartWeekMonday->Bounds().Height() + 5.0); - BMenuField *menuField = new BMenuField(frameRight, "regions", "Date separator:" - , fDateSeparator, false); - dateView->AddChild(menuField); - menuField->ResizeToPreferred(); -} - - -void -SettingsView::_UpdateDateSettings(const uint32 _what) -{ - uint32 what = _what; - if (_what == kMonthDayYear) - what = fRecentDateWhat; - - fRecentDateWhat = _what; - - BMessenger messenger(kDeskbarSignature); - messenger.SendMessage(what); -} - - -void -SettingsView::_UpdateTimeSettings(const uint32 what) const -{ - BMessenger messenger(kDeskbarSignature); - messenger.SendMessage(what); -} diff --git a/src/preferences/time/SettingsView.h b/src/preferences/time/SettingsView.h deleted file mode 100644 index acbde0544b..0000000000 --- a/src/preferences/time/SettingsView.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2007, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Julun - */ -#ifndef SETTINGS_VIEW_H -#define SETTINGS_VIEW_H - - -#include - - -class BCheckBox; -class BMessage; -class BPopUpMenu; -class BRadioButton; - - -class SettingsView : public BView { - public: - SettingsView(BRect frame); - virtual ~SettingsView(); - - virtual void AttachedToWindow(); - virtual void MessageReceived(BMessage *message); - - private: - void _InitView(); - void _UpdateDateSettings(const uint32 what); - void _UpdateTimeSettings(const uint32 what) const; - - private: - BCheckBox *fShow24Hours; - BCheckBox *fShowSeconds; - BRadioButton *fGmtTime; - BRadioButton *fLocalTime; - - BRadioButton *fYearMonthDay; - BRadioButton *fDayMonthYear; - BRadioButton *fMonthDayYear; - BCheckBox *fStartWeekMonday; - - BPopUpMenu *fDateSeparator; - - bool fInitialized; - uint32 fRecentDateWhat; -}; - -#endif // SETTINGS_VIEW_H diff --git a/src/preferences/time/TimeWindow.cpp b/src/preferences/time/TimeWindow.cpp index 9c2bdcf749..5248682625 100644 --- a/src/preferences/time/TimeWindow.cpp +++ b/src/preferences/time/TimeWindow.cpp @@ -13,7 +13,6 @@ #include "DateTimeView.h" #include "TimeMessages.h" #include "ZoneView.h" -#include "SettingsView.h" #include @@ -103,12 +102,6 @@ TTimeWindow::_InitWindow() tabview->AddTab(fTimeZones, tab); tab->SetLabel("Time Zone"); - fSettingsView = new SettingsView(bounds); - - tab = new BTab(); - tabview->AddTab(fSettingsView, tab); - tab->SetLabel("Settings"); - fBaseView->AddChild(tabview); float width; diff --git a/src/preferences/time/TimeWindow.h b/src/preferences/time/TimeWindow.h index 2a46913d98..251b6c25eb 100644 --- a/src/preferences/time/TimeWindow.h +++ b/src/preferences/time/TimeWindow.h @@ -18,7 +18,6 @@ class BMessage; class DateTimeView; class TTimeBaseView; class TZoneView; -class SettingsView; class TTimeWindow : public BWindow { @@ -35,7 +34,6 @@ class TTimeWindow : public BWindow { TTimeBaseView *fBaseView; DateTimeView *fDateTimeView; TZoneView *fTimeZones; - SettingsView *fSettingsView; }; #endif // TIME_WINDOW_H