From e44561b2e98495666e2083769f5a01d8d64fca0a Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 20 Feb 2007 14:50:40 +0000 Subject: [PATCH] even more style changes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20182 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/BaseView.cpp | 8 ++++- src/preferences/time/BaseView.h | 3 +- src/preferences/time/TimeWindow.cpp | 51 +++++++++++++---------------- src/preferences/time/TimeWindow.h | 17 ++++------ src/preferences/time/ZoneView.cpp | 4 +-- src/preferences/time/ZoneView.h | 2 +- src/preferences/time/hierarchy | 9 ----- 7 files changed, 42 insertions(+), 52 deletions(-) delete mode 100644 src/preferences/time/hierarchy diff --git a/src/preferences/time/BaseView.cpp b/src/preferences/time/BaseView.cpp index 427062e3a6..bb29350ace 100644 --- a/src/preferences/time/BaseView.cpp +++ b/src/preferences/time/BaseView.cpp @@ -5,7 +5,6 @@ #include #include -#include #include "BaseView.h" #include "TimeMessages.h" @@ -33,6 +32,13 @@ TTimeBaseView::Pulse() } +void +TTimeBaseView::AttachedToWindow() +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} + + void TTimeBaseView::SetGMTime(bool gmt) { diff --git a/src/preferences/time/BaseView.h b/src/preferences/time/BaseView.h index 517bdc137b..d49cf842ff 100644 --- a/src/preferences/time/BaseView.h +++ b/src/preferences/time/BaseView.h @@ -11,7 +11,8 @@ class TTimeBaseView: public BView { virtual ~TTimeBaseView(); virtual void Pulse(); - + virtual void AttachedToWindow(); + void ChangeTime(BMessage *); void SetGMTime(bool); protected: diff --git a/src/preferences/time/TimeWindow.cpp b/src/preferences/time/TimeWindow.cpp index 2071eb6d24..d88cc59d29 100644 --- a/src/preferences/time/TimeWindow.cpp +++ b/src/preferences/time/TimeWindow.cpp @@ -8,25 +8,28 @@ #include #include #include + #include #include "BaseView.h" +#include "SettingsView.h" #include "Time.h" #include "TimeMessages.h" #include "TimeWindow.h" +#include "TimeSettings.h" +#include "ZoneView.h" #define TIME_WINDOW_RIGHT 361 //332 #define TIME_WINDOW_BOTTOM 227 //208 TTimeWindow::TTimeWindow() - : BWindow(BRect(0,0,TIME_WINDOW_RIGHT,TIME_WINDOW_BOTTOM), + : BWindow(BRect(0, 0, TIME_WINDOW_RIGHT, TIME_WINDOW_BOTTOM), "Time & Date", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE ) { - BScreen screen; - MoveTo(dynamic_cast(be_app)->WindowCorner()); + BScreen screen; // Code to make sure that the window doesn't get drawn off screen... if (!(screen.Frame().right >= Frame().right && screen.Frame().bottom >= Frame().bottom)) MoveTo((screen.Frame().right-Bounds().right)*.5,(screen.Frame().bottom-Bounds().bottom)*.5); @@ -36,11 +39,6 @@ TTimeWindow::TTimeWindow() } -TTimeWindow::~TTimeWindow() -{ -} - - void TTimeWindow::MessageReceived(BMessage *message) { @@ -49,12 +47,12 @@ TTimeWindow::MessageReceived(BMessage *message) { bool istime; if (message->FindBool("time", &istime) == B_OK) - f_BaseView->ChangeTime(message); + fBaseView->ChangeTime(message); break; } case H_RTC_CHANGE: - f_BaseView->SetGMTime(f_TimeSettings->GMTime()); + fBaseView->SetGMTime(fTimeSettings->GMTime()); break; default: @@ -69,12 +67,12 @@ TTimeWindow::QuitRequested() { dynamic_cast(be_app)->SetWindowCorner(BPoint(Frame().left,Frame().top)); - f_BaseView->StopWatchingAll(f_TimeSettings); - f_BaseView->StopWatchingAll(f_TimeZones); + fBaseView->StopWatchingAll(fTimeSettings); + fBaseView->StopWatchingAll(fTimeZones); be_app->PostMessage(B_QUIT_REQUESTED); - return(true); + return BWindow::QuitRequested(); } @@ -84,9 +82,8 @@ TTimeWindow::InitWindow() { BRect bounds(Bounds()); - f_BaseView = new TTimeBaseView(bounds, "background view"); - f_BaseView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - AddChild(f_BaseView); + fBaseView = new TTimeBaseView(bounds, "background view"); + AddChild(fBaseView); bounds.top = 9; BTabView *tabview = new BTabView(bounds, "tab_view"); @@ -95,24 +92,22 @@ TTimeWindow::InitWindow() bounds.InsetBy(4, 6); bounds.bottom -= tabview->TabHeight(); - f_TimeSettings = new TSettingsView(bounds); - if (f_BaseView->StartWatchingAll(f_TimeSettings) != B_OK) + fTimeSettings = new TSettingsView(bounds); + if (fBaseView->StartWatchingAll(fTimeSettings) != B_OK) printf("StartWatchingAll(TimeSettings) failed!!!\n"); - f_TimeZones = new TZoneView(bounds); - if (f_BaseView->StartWatchingAll(f_TimeZones) != B_OK) - printf("TimeZones->StartWatchingAll(TimeZone) failed!!!\n"); + fTimeZones = new TZoneView(bounds); + if (fBaseView->StartWatchingAll(fTimeZones) != B_OK) + printf("TimeZones->StartWatchingAll(TimeZone) failed!!!\n"); + // add tabs - BTab *tab; - tab = new BTab(); - tabview->AddTab(f_TimeSettings, tab); + BTab *tab = new BTab(); + tabview->AddTab(fTimeSettings, tab); tab->SetLabel("Settings"); tab = new BTab(); - tabview->AddTab(f_TimeZones, tab); + tabview->AddTab(fTimeZones, tab); tab->SetLabel("Time Zone"); - f_BaseView->AddChild(tabview); - f_BaseView->Pulse(); - + fBaseView->AddChild(tabview); } diff --git a/src/preferences/time/TimeWindow.h b/src/preferences/time/TimeWindow.h index 72a29b9eed..c58dd0889e 100644 --- a/src/preferences/time/TimeWindow.h +++ b/src/preferences/time/TimeWindow.h @@ -3,24 +3,21 @@ #include -#include "BaseView.h" -#include "SettingsView.h" -#include "TimeSettings.h" -#include "ZoneView.h" - +class TSettingsView; +class TTimeBaseView; +class TZoneView; class TTimeWindow : public BWindow { public: TTimeWindow(); - ~TTimeWindow(); bool QuitRequested(); - void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage *message); private: void InitWindow(); - TTimeBaseView *f_BaseView; - TSettingsView *f_TimeSettings; - TZoneView *f_TimeZones; + TTimeBaseView *fBaseView; + TSettingsView *fTimeSettings; + TZoneView *fTimeZones; }; #endif diff --git a/src/preferences/time/ZoneView.cpp b/src/preferences/time/ZoneView.cpp index 5be277c232..d24ddcf0aa 100644 --- a/src/preferences/time/ZoneView.cpp +++ b/src/preferences/time/ZoneView.cpp @@ -89,8 +89,8 @@ TZoneView::AttachedToWindow() if (Parent()) SetViewColor(Parent()->ViewColor()); - if (f_first) // stupid hack - { + if (f_first) { + // stupid hack f_regionpopup->SetTargetForItems(this); f_setzone->SetTarget(this); f_citylist->SetTarget(this); diff --git a/src/preferences/time/ZoneView.h b/src/preferences/time/ZoneView.h index 813c697d56..df4638db23 100644 --- a/src/preferences/time/ZoneView.h +++ b/src/preferences/time/ZoneView.h @@ -29,7 +29,7 @@ class TZoneItem: public BStringItem { -class TZoneView: public BView{ +class TZoneView: public BView { public: TZoneView(BRect frame); virtual ~TZoneView(); diff --git a/src/preferences/time/hierarchy b/src/preferences/time/hierarchy deleted file mode 100644 index 7468c87a51..0000000000 --- a/src/preferences/time/hierarchy +++ /dev/null @@ -1,9 +0,0 @@ -Time -- - TimeWindow - -- TimeBaseView - -- SettingsView - -- TDateEdit - -- TTimeEdit - -- TCalendarView - -- TAnalogClock - -- ZoneView