Cleanup, no functional change
* coding style adjustements * fixed all warnings git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37792 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1c6a53c07c
commit
6d6408d6bc
@ -26,11 +26,11 @@
|
||||
|
||||
class OffscreenClock : public BView {
|
||||
public:
|
||||
OffscreenClock(BRect frame, const char *name);
|
||||
OffscreenClock(BRect frame, const char* name);
|
||||
virtual ~OffscreenClock();
|
||||
|
||||
void SetTime(int32 hour, int32 minute, int32 second);
|
||||
void GetTime(int32 *hour, int32 *minute, int32 *second);
|
||||
void GetTime(int32* hour, int32* minute, int32* second);
|
||||
bool IsDirty() const { return fDirty; }
|
||||
void DrawClock();
|
||||
|
||||
@ -65,7 +65,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
OffscreenClock::OffscreenClock(BRect frame, const char *name)
|
||||
OffscreenClock::OffscreenClock(BRect frame, const char* name)
|
||||
:
|
||||
BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW),
|
||||
fHours(0),
|
||||
@ -108,7 +108,7 @@ OffscreenClock::SetTime(int32 hour, int32 minute, int32 second)
|
||||
|
||||
|
||||
void
|
||||
OffscreenClock::GetTime(int32 *hour, int32 *minute, int32 *second)
|
||||
OffscreenClock::GetTime(int32* hour, int32* minute, int32* second)
|
||||
{
|
||||
*hour = fHours;
|
||||
*minute = fMinutes;
|
||||
@ -359,7 +359,7 @@ OffscreenClock::_DrawHands(float x, float y, float radius,
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
TAnalogClock::TAnalogClock(BRect frame, const char *name)
|
||||
TAnalogClock::TAnalogClock(BRect frame, const char* name)
|
||||
:
|
||||
BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW | B_DRAW_ON_CHILDREN),
|
||||
fBitmap(NULL),
|
||||
@ -397,7 +397,7 @@ TAnalogClock::AttachedToWindow()
|
||||
|
||||
|
||||
void
|
||||
TAnalogClock::MessageReceived(BMessage *message)
|
||||
TAnalogClock::MessageReceived(BMessage* message)
|
||||
{
|
||||
int32 change;
|
||||
switch (message->what) {
|
||||
@ -468,7 +468,7 @@ TAnalogClock::MouseUp(BPoint point)
|
||||
|
||||
|
||||
void
|
||||
TAnalogClock::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
||||
TAnalogClock::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
||||
{
|
||||
|
||||
if (fDraggingMinuteHand)
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Mike Berg <mike@berg-net.us>
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*/
|
||||
#ifndef ANALOG_CLOCK_H
|
||||
#define ANALOG_CLOCK_H
|
||||
#ifndef _ANALOG_CLOCK_H
|
||||
#define _ANALOG_CLOCK_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
@ -18,32 +18,34 @@ class OffscreenClock;
|
||||
|
||||
|
||||
class TAnalogClock : public BView {
|
||||
public:
|
||||
TAnalogClock(BRect frame, const char *name);
|
||||
virtual ~TAnalogClock();
|
||||
public:
|
||||
TAnalogClock(BRect frame, const char* name);
|
||||
virtual ~TAnalogClock();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MouseUp(BPoint point);
|
||||
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MouseUp(BPoint point);
|
||||
virtual void MouseMoved(BPoint point, uint32 transit,
|
||||
const BMessage* message);
|
||||
|
||||
void SetTime(int32 hour, int32 minute, int32 second);
|
||||
void SetTime(int32 hour, int32 minute, int32 second);
|
||||
|
||||
bool IsChangingTime() { return fTimeChangeIsOngoing; }
|
||||
void ChangeTimeFinished();
|
||||
private:
|
||||
void _InitView(BRect frame);
|
||||
bool IsChangingTime()
|
||||
{ return fTimeChangeIsOngoing; }
|
||||
void ChangeTimeFinished();
|
||||
private:
|
||||
void _InitView(BRect frame);
|
||||
|
||||
BBitmap *fBitmap;
|
||||
OffscreenClock *fClock;
|
||||
BBitmap* fBitmap;
|
||||
OffscreenClock* fClock;
|
||||
|
||||
bool fDraggingHourHand;
|
||||
bool fDraggingMinuteHand;
|
||||
bool fDraggingHourHand;
|
||||
bool fDraggingMinuteHand;
|
||||
|
||||
bool fTimeChangeIsOngoing;
|
||||
bool fTimeChangeIsOngoing;
|
||||
};
|
||||
|
||||
#endif // ANALOG_CLOCK_H
|
||||
|
||||
#endif // _ANALOG_CLOCK_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
TTimeBaseView::TTimeBaseView(BRect frame, const char *name)
|
||||
TTimeBaseView::TTimeBaseView(BRect frame, const char* name)
|
||||
: BView(frame, name, B_FOLLOW_NONE, B_PULSE_NEEDED),
|
||||
fMessage(H_TIME_UPDATE)
|
||||
{
|
||||
@ -43,7 +43,7 @@ TTimeBaseView::AttachedToWindow()
|
||||
|
||||
|
||||
void
|
||||
TTimeBaseView::ChangeTime(BMessage *message)
|
||||
TTimeBaseView::ChangeTime(BMessage* message)
|
||||
{
|
||||
bool isTime;
|
||||
if (message->FindBool("time", &isTime) != B_OK)
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Mike Berg <mike@berg-net.us>
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*/
|
||||
#ifndef TIMEBASE_H
|
||||
#define TIMEBASE_H
|
||||
#ifndef _BASE_VIEW_H
|
||||
#define _BASE_VIEW_H
|
||||
|
||||
|
||||
#include <Message.h>
|
||||
@ -15,21 +15,21 @@
|
||||
|
||||
|
||||
class TTimeBaseView: public BView {
|
||||
public:
|
||||
TTimeBaseView(BRect frame, const char *name);
|
||||
virtual ~TTimeBaseView();
|
||||
|
||||
virtual void Pulse();
|
||||
virtual void AttachedToWindow();
|
||||
public:
|
||||
TTimeBaseView(BRect frame, const char* name);
|
||||
virtual ~TTimeBaseView();
|
||||
|
||||
void ChangeTime(BMessage *message);
|
||||
virtual void Pulse();
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
private:
|
||||
void _SendNotices();
|
||||
void ChangeTime(BMessage* message);
|
||||
|
||||
private:
|
||||
BMessage fMessage;
|
||||
private:
|
||||
void _SendNotices();
|
||||
|
||||
private:
|
||||
BMessage fMessage;
|
||||
};
|
||||
|
||||
#endif // TIMEBASE_H
|
||||
|
||||
#endif // _BASE_VIEW_H
|
||||
|
@ -16,18 +16,18 @@
|
||||
#include <Screen.h>
|
||||
|
||||
|
||||
void
|
||||
ReplaceTransparentColor(BBitmap *bitmap, rgb_color with)
|
||||
void
|
||||
ReplaceTransparentColor(BBitmap* bitmap, rgb_color with)
|
||||
{
|
||||
// other color spaces not implemented yet
|
||||
ASSERT(bitmap->ColorSpace() == B_COLOR_8_BIT);
|
||||
|
||||
|
||||
BScreen screen(B_MAIN_SCREEN_ID);
|
||||
uint32 withIndex = screen.IndexForColor(with);
|
||||
|
||||
uchar *bits = (uchar *)bitmap->Bits();
|
||||
int32 bitsLength = bitmap->BitsLength();
|
||||
for (int32 index = 0; index < bitsLength; index++)
|
||||
uint32 withIndex = screen.IndexForColor(with);
|
||||
|
||||
uchar* bits = (uchar*)bitmap->Bits();
|
||||
int32 bitsLength = bitmap->BitsLength();
|
||||
for (int32 index = 0; index < bitsLength; index++)
|
||||
if (bits[index] == B_TRANSPARENT_8_BIT)
|
||||
bits[index] = withIndex;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -8,14 +8,14 @@
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*
|
||||
*/
|
||||
#ifndef ANALOG_CLOCK_H
|
||||
#define ANALOG_CLOCK_H
|
||||
#ifndef _BITMAPS_H
|
||||
#define _BITMAPS_H
|
||||
|
||||
|
||||
#include <Bitmap.h>
|
||||
|
||||
|
||||
void ReplaceTransparentColor(BBitmap *bitmap, rgb_color with);
|
||||
void ReplaceTransparentColor(BBitmap* bitmap, rgb_color with);
|
||||
|
||||
const int32 kUpArrowWidth = 16;
|
||||
const int32 kUpArrowHeight = 7;
|
||||
@ -45,5 +45,6 @@ const unsigned char kDownArrowBits [] = {
|
||||
0xff,0xff,0xff,0xff,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff
|
||||
};
|
||||
|
||||
#endif // ANALOG_CLOCK_H
|
||||
|
||||
#endif // _BITMAPS_H
|
||||
|
||||
|
@ -87,7 +87,7 @@ TTimeEdit::InitView()
|
||||
void
|
||||
TTimeEdit::DrawSection(uint32 index, bool hasFocus)
|
||||
{
|
||||
TSection *section = NULL;
|
||||
TSection* section = NULL;
|
||||
section = static_cast<TSection*> (fSectionList->ItemAt(index));
|
||||
|
||||
if (!section)
|
||||
@ -110,7 +110,7 @@ TTimeEdit::DrawSection(uint32 index, bool hasFocus)
|
||||
country->FormatTime(&text, fieldPositions, fieldCount, time, true);
|
||||
// TODO : this should be cached somehow to not redo it for each field
|
||||
|
||||
if (index * 2 + 1 > fieldCount) {
|
||||
if (index * 2 + 1 > (uint32)fieldCount) {
|
||||
free(fieldPositions);
|
||||
return;
|
||||
}
|
||||
@ -135,7 +135,7 @@ TTimeEdit::DrawSection(uint32 index, bool hasFocus)
|
||||
void
|
||||
TTimeEdit::DrawSeparator(uint32 index)
|
||||
{
|
||||
TSection *section = NULL;
|
||||
TSection* section = NULL;
|
||||
section = static_cast<TSection*> (fSectionList->ItemAt(index));
|
||||
|
||||
if (!section)
|
||||
@ -154,7 +154,7 @@ TTimeEdit::DrawSeparator(uint32 index)
|
||||
country->FormatTime(&text, fieldPositions, fieldCount, time, true);
|
||||
// TODO : this should be cached somehow to not redo it for each field
|
||||
|
||||
if (index * 2 + 2 > fieldCount) {
|
||||
if (index * 2 + 2 > (uint32)fieldCount) {
|
||||
free(fieldPositions);
|
||||
return;
|
||||
}
|
||||
@ -257,9 +257,9 @@ TTimeEdit::DoDownPress()
|
||||
|
||||
|
||||
void
|
||||
TTimeEdit::BuildDispatch(BMessage *message)
|
||||
TTimeEdit::BuildDispatch(BMessage* message)
|
||||
{
|
||||
const char *fields[3] = { "hour", "minute", "second" };
|
||||
const char* fields[3] = { "hour", "minute", "second" };
|
||||
|
||||
message->AddBool("time", true);
|
||||
|
||||
@ -445,7 +445,7 @@ TTimeEdit::_SectionValue(int32 index) const
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
TDateEdit::TDateEdit(BRect frame, const char *name, uint32 sections)
|
||||
TDateEdit::TDateEdit(BRect frame, const char* name, uint32 sections)
|
||||
: TSectionEdit(frame, name, sections)
|
||||
{
|
||||
InitView();
|
||||
@ -484,7 +484,7 @@ TDateEdit::KeyDown(const char* bytes, int32 numBytes)
|
||||
}
|
||||
|
||||
// if year add 2000
|
||||
|
||||
|
||||
BDateElement* dateFormat;
|
||||
int fieldCount;
|
||||
BCountry* here;
|
||||
@ -523,7 +523,7 @@ TDateEdit::InitView()
|
||||
void
|
||||
TDateEdit::DrawSection(uint32 index, bool hasFocus)
|
||||
{
|
||||
TSection *section = NULL;
|
||||
TSection* section = NULL;
|
||||
section = static_cast<TSection*> (fSectionList->ItemAt(index));
|
||||
|
||||
if (!section)
|
||||
@ -547,7 +547,7 @@ TDateEdit::DrawSection(uint32 index, bool hasFocus)
|
||||
false);
|
||||
// TODO : this should be cached somehow to not redo it for each field
|
||||
|
||||
if (index * 2 + 1 > fieldCount) {
|
||||
if (index * 2 + 1 > (uint32)fieldCount) {
|
||||
free(fieldPositions);
|
||||
return;
|
||||
}
|
||||
@ -575,7 +575,7 @@ TDateEdit::DrawSeparator(uint32 index)
|
||||
if (index == 3)
|
||||
return;
|
||||
|
||||
TSection *section = NULL;
|
||||
TSection* section = NULL;
|
||||
section = static_cast<TSection*> (fSectionList->ItemAt(index));
|
||||
BRect bounds = section->Frame();
|
||||
|
||||
@ -594,7 +594,7 @@ TDateEdit::DrawSeparator(uint32 index)
|
||||
false);
|
||||
// TODO : this should be cached somehow to not redo it for each field
|
||||
|
||||
if (index * 2 + 2 > fieldCount) {
|
||||
if (index * 2 + 2 > (uint32)fieldCount) {
|
||||
free(fieldPositions);
|
||||
return;
|
||||
}
|
||||
@ -625,7 +625,7 @@ TDateEdit::SetSections(BRect area)
|
||||
float sepWidth = SeparatorWidth();
|
||||
|
||||
// year
|
||||
TSection *section = NULL;
|
||||
TSection* section = NULL;
|
||||
float width = be_plain_font->StringWidth("0000") +6;
|
||||
bounds.right = area.right;
|
||||
bounds.left = bounds.right -width;
|
||||
@ -708,9 +708,9 @@ TDateEdit::DoDownPress()
|
||||
|
||||
|
||||
void
|
||||
TDateEdit::BuildDispatch(BMessage *message)
|
||||
TDateEdit::BuildDispatch(BMessage* message)
|
||||
{
|
||||
const char *fields[3] = { "month", "day", "year" };
|
||||
const char* fields[3] = { "month", "day", "year" };
|
||||
|
||||
message->AddBool("time", false);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -8,8 +8,8 @@
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*
|
||||
*/
|
||||
#ifndef DATETIME_H
|
||||
#define DATETIME_H
|
||||
#ifndef _DATE_TIME_EDIT_H
|
||||
#define _DATE_TIME_EDIT_H
|
||||
|
||||
|
||||
#include "SectionEdit.h"
|
||||
@ -19,36 +19,37 @@
|
||||
|
||||
|
||||
class TTimeEdit : public TSectionEdit {
|
||||
public:
|
||||
TTimeEdit(BRect frame, const char *name,
|
||||
uint32 sections);
|
||||
virtual ~TTimeEdit();
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
public:
|
||||
TTimeEdit(BRect frame, const char* name,
|
||||
uint32 sections);
|
||||
virtual ~TTimeEdit();
|
||||
|
||||
virtual void InitView();
|
||||
virtual void DrawSection(uint32 index, bool isfocus);
|
||||
virtual void DrawSeparator(uint32 index);
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
|
||||
virtual void SetSections(BRect area);
|
||||
virtual void SectionFocus(uint32 index);
|
||||
virtual float SeparatorWidth() const;
|
||||
virtual void InitView();
|
||||
virtual void DrawSection(uint32 index, bool isfocus);
|
||||
virtual void DrawSeparator(uint32 index);
|
||||
|
||||
virtual void DoUpPress();
|
||||
virtual void DoDownPress();
|
||||
virtual void SetSections(BRect area);
|
||||
virtual void SectionFocus(uint32 index);
|
||||
virtual float SeparatorWidth() const;
|
||||
|
||||
virtual void BuildDispatch(BMessage *message);
|
||||
virtual void DoUpPress();
|
||||
virtual void DoDownPress();
|
||||
|
||||
void SetTime(int32 hour, int32 minute, int32 second);
|
||||
virtual void BuildDispatch(BMessage* message);
|
||||
|
||||
private:
|
||||
void _CheckRange();
|
||||
bool _IsValidDoubleDigi(int32 value);
|
||||
int32 _SectionValue(int32 index) const;
|
||||
void SetTime(int32 hour, int32 minute, int32 second);
|
||||
|
||||
private:
|
||||
BDateTime fTime;
|
||||
bigtime_t fLastKeyDownTime;
|
||||
int32 fLastKeyDownInt;
|
||||
private:
|
||||
void _CheckRange();
|
||||
bool _IsValidDoubleDigi(int32 value);
|
||||
int32 _SectionValue(int32 index) const;
|
||||
|
||||
private:
|
||||
BDateTime fTime;
|
||||
bigtime_t fLastKeyDownTime;
|
||||
int32 fLastKeyDownInt;
|
||||
};
|
||||
|
||||
|
||||
@ -85,5 +86,5 @@ class TDateEdit : public TSectionEdit {
|
||||
int32 fLastKeyDownInt;
|
||||
};
|
||||
|
||||
#endif // DATETIME_H
|
||||
#endif // _DATE_TIME_EDIT_H
|
||||
|
||||
|
@ -39,7 +39,7 @@ using BPrivate::B_LOCAL_TIME;
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
# include <syscalls.h>
|
||||
#else
|
||||
extern "C" void _kset_tzfilename_(const char *name, size_t length, bool isGMT);
|
||||
extern "C" void _kset_tzfilename_(const char* name, size_t length, bool isGMT);
|
||||
# define _kern_set_tzfilename _kset_tzfilename_
|
||||
#endif
|
||||
|
||||
@ -105,7 +105,7 @@ DateTimeView::Draw(BRect /*updateRect*/)
|
||||
|
||||
|
||||
void
|
||||
DateTimeView::MessageReceived(BMessage *message)
|
||||
DateTimeView::MessageReceived(BMessage* message)
|
||||
{
|
||||
int32 change;
|
||||
switch (message->what) {
|
||||
@ -249,7 +249,7 @@ DateTimeView::_InitView()
|
||||
|
||||
// clock radio buttons
|
||||
bounds.top = fClock->Frame().bottom + 10.0;
|
||||
BStringView *text = new BStringView(bounds, "clockSetTo", "Clock set to:");
|
||||
BStringView* text = new BStringView(bounds, "clockSetTo", "Clock set to:");
|
||||
AddChild(text);
|
||||
text->ResizeToPreferred();
|
||||
|
||||
@ -342,7 +342,7 @@ DateTimeView::_UpdateGmtSettings()
|
||||
|
||||
|
||||
void
|
||||
DateTimeView::_UpdateDateTime(BMessage *message)
|
||||
DateTimeView::_UpdateDateTime(BMessage* message)
|
||||
{
|
||||
int32 day;
|
||||
int32 month;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -8,8 +8,8 @@
|
||||
* Julun <host.haiku@gmx.de>
|
||||
* Philippe Saint-Pierre <stpere@gmail.com>
|
||||
*/
|
||||
#ifndef DATE_TIME_VIEW_H
|
||||
#define DATE_TIME_VIEW_H
|
||||
#ifndef _DATE_TIME_VIEW_H
|
||||
#define _DATE_TIME_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
@ -28,41 +28,41 @@ using BPrivate::BCalendarView;
|
||||
|
||||
|
||||
class DateTimeView : public BView {
|
||||
public:
|
||||
DateTimeView(BRect frame);
|
||||
virtual ~DateTimeView();
|
||||
public:
|
||||
DateTimeView(BRect frame);
|
||||
virtual ~DateTimeView();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect updaterect);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect updaterect);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
bool CheckCanRevert();
|
||||
bool GetUseGmtTime();
|
||||
bool CheckCanRevert();
|
||||
bool GetUseGmtTime();
|
||||
|
||||
private:
|
||||
void _InitView();
|
||||
void _ReadRTCSettings();
|
||||
void _WriteRTCSettings();
|
||||
void _UpdateGmtSettings();
|
||||
void _UpdateDateTime(BMessage *message);
|
||||
void _Revert();
|
||||
time_t _PrefletUptime() const;
|
||||
private:
|
||||
void _InitView();
|
||||
void _ReadRTCSettings();
|
||||
void _WriteRTCSettings();
|
||||
void _UpdateGmtSettings();
|
||||
void _UpdateDateTime(BMessage* message);
|
||||
void _Revert();
|
||||
time_t _PrefletUptime() const;
|
||||
|
||||
private:
|
||||
BRadioButton *fLocalTime;
|
||||
BRadioButton *fGmtTime;
|
||||
TDateEdit *fDateEdit;
|
||||
TTimeEdit *fTimeEdit;
|
||||
BCalendarView *fCalendarView;
|
||||
TAnalogClock *fClock;
|
||||
private:
|
||||
BRadioButton* fLocalTime;
|
||||
BRadioButton* fGmtTime;
|
||||
TDateEdit* fDateEdit;
|
||||
TTimeEdit* fTimeEdit;
|
||||
BCalendarView* fCalendarView;
|
||||
TAnalogClock* fClock;
|
||||
|
||||
bool fUseGmtTime;
|
||||
bool fOldUseGmtTime;
|
||||
bool fInitialized;
|
||||
bool fUseGmtTime;
|
||||
bool fOldUseGmtTime;
|
||||
bool fInitialized;
|
||||
|
||||
time_t fTimeAtStart;
|
||||
bigtime_t fSystemTimeAtStart;
|
||||
time_t fTimeAtStart;
|
||||
bigtime_t fSystemTimeAtStart;
|
||||
};
|
||||
|
||||
#endif // DATE_TIME_VIEW_H
|
||||
|
||||
#endif // _DATE_TIME_VIEW_H
|
||||
|
@ -18,10 +18,39 @@
|
||||
#include "TimeMessages.h"
|
||||
|
||||
|
||||
TSection::TSection(BRect frame)
|
||||
:
|
||||
fFrame(frame)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BRect
|
||||
TSection::Bounds() const
|
||||
{
|
||||
BRect frame(fFrame);
|
||||
return frame.OffsetByCopy(B_ORIGIN);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TSection::SetFrame(BRect frame)
|
||||
{
|
||||
fFrame = frame;
|
||||
}
|
||||
|
||||
|
||||
BRect
|
||||
TSection::Frame() const
|
||||
{
|
||||
return fFrame;
|
||||
}
|
||||
|
||||
|
||||
const uint32 kArrowAreaWidth = 16;
|
||||
|
||||
|
||||
TSectionEdit::TSectionEdit(BRect frame, const char *name, uint32 sections)
|
||||
TSectionEdit::TSectionEdit(BRect frame, const char* name, uint32 sections)
|
||||
:
|
||||
BControl(frame, name, NULL, NULL, B_FOLLOW_NONE, B_NAVIGABLE | B_WILL_DRAW),
|
||||
fSectionList(NULL),
|
||||
@ -74,9 +103,9 @@ TSectionEdit::MouseDown(BPoint where)
|
||||
else if (fDownRect.Contains(where))
|
||||
DoDownPress();
|
||||
else if (fSectionList->CountItems()> 0) {
|
||||
TSection *section;
|
||||
TSection* section;
|
||||
for (uint32 idx = 0; idx < fSectionCount; idx++) {
|
||||
section = (TSection *)fSectionList->ItemAt(idx);
|
||||
section = (TSection*)fSectionList->ItemAt(idx);
|
||||
if (section->Frame().Contains(where)) {
|
||||
SectionFocus(idx);
|
||||
return;
|
||||
@ -102,7 +131,7 @@ TSectionEdit::MakeFocus(bool focused)
|
||||
|
||||
|
||||
void
|
||||
TSectionEdit::KeyDown(const char *bytes, int32 numbytes)
|
||||
TSectionEdit::KeyDown(const char* bytes, int32 numbytes)
|
||||
{
|
||||
if (fFocus == -1)
|
||||
SectionFocus(0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -7,8 +7,8 @@
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*
|
||||
*/
|
||||
#ifndef SECTIONEDIT_H
|
||||
#define SECTIONEDIT_H
|
||||
#ifndef _SECTION_EDIT_H
|
||||
#define _SECTION_EDIT_H
|
||||
|
||||
|
||||
#include <Control.h>
|
||||
@ -19,75 +19,66 @@ class BList;
|
||||
|
||||
|
||||
class TSection {
|
||||
public:
|
||||
TSection(BRect frame)
|
||||
: fFrame(frame) {}
|
||||
public:
|
||||
TSection(BRect frame);
|
||||
|
||||
BRect Bounds() const
|
||||
{
|
||||
BRect frame(fFrame);
|
||||
return frame.OffsetByCopy(B_ORIGIN);
|
||||
}
|
||||
BRect Bounds() const;
|
||||
void SetFrame(BRect frame);
|
||||
BRect Frame() const;
|
||||
|
||||
void SetFrame(BRect frame)
|
||||
{ fFrame = frame; }
|
||||
|
||||
BRect Frame() const
|
||||
{ return fFrame; }
|
||||
|
||||
private:
|
||||
BRect fFrame;
|
||||
private:
|
||||
BRect fFrame;
|
||||
};
|
||||
|
||||
|
||||
class TSectionEdit: public BControl {
|
||||
public:
|
||||
TSectionEdit(BRect frame, const char *name,
|
||||
uint32 sections);
|
||||
virtual ~TSectionEdit();
|
||||
public:
|
||||
TSectionEdit(BRect frame, const char* name,
|
||||
uint32 sections);
|
||||
virtual ~TSectionEdit();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MakeFocus(bool focused = true);
|
||||
virtual void KeyDown(const char *bytes, int32 numBytes);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MakeFocus(bool focused = true);
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
|
||||
uint32 CountSections() const;
|
||||
int32 FocusIndex() const;
|
||||
BRect SectionArea() const;
|
||||
uint32 CountSections() const;
|
||||
int32 FocusIndex() const;
|
||||
BRect SectionArea() const;
|
||||
|
||||
protected:
|
||||
virtual void InitView();
|
||||
protected:
|
||||
virtual void InitView();
|
||||
|
||||
// hooks
|
||||
virtual void DrawBorder(const BRect& updateRect);
|
||||
virtual void DrawSection(uint32 index, bool isFocus) {}
|
||||
virtual void DrawSeparator(uint32 index) {}
|
||||
// hooks
|
||||
virtual void DrawBorder(const BRect& updateRect);
|
||||
virtual void DrawSection(uint32 index, bool isFocus) {}
|
||||
virtual void DrawSeparator(uint32 index) {}
|
||||
|
||||
virtual void SectionFocus(uint32 index) {}
|
||||
virtual void SectionChange(uint32 index, uint32 value) {}
|
||||
virtual void SetSections(BRect area) {}
|
||||
virtual float SeparatorWidth() const;
|
||||
virtual void SectionFocus(uint32 index) {}
|
||||
virtual void SectionChange(uint32 index, uint32 value) {}
|
||||
virtual void SetSections(BRect area) {}
|
||||
virtual float SeparatorWidth() const;
|
||||
|
||||
virtual void DoUpPress() {}
|
||||
virtual void DoDownPress() {}
|
||||
virtual void DoUpPress() {}
|
||||
virtual void DoDownPress() {}
|
||||
|
||||
virtual void DispatchMessage();
|
||||
virtual void BuildDispatch(BMessage *message) = 0;
|
||||
virtual void DispatchMessage();
|
||||
virtual void BuildDispatch(BMessage* message) = 0;
|
||||
|
||||
protected:
|
||||
BList *fSectionList;
|
||||
protected:
|
||||
BList* fSectionList;
|
||||
|
||||
BRect fUpRect;
|
||||
BRect fDownRect;
|
||||
BRect fSectionArea;
|
||||
BRect fUpRect;
|
||||
BRect fDownRect;
|
||||
BRect fSectionArea;
|
||||
|
||||
int32 fFocus;
|
||||
uint32 fSectionCount;
|
||||
uint32 fHoldValue;
|
||||
int32 fFocus;
|
||||
uint32 fSectionCount;
|
||||
uint32 fHoldValue;
|
||||
|
||||
bool fShowFocus;
|
||||
bool fShowFocus;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _SECTION_EDIT_H
|
||||
|
@ -26,7 +26,7 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
TTZDisplay::TTZDisplay(BRect frame, const char *name, const char *label)
|
||||
TTZDisplay::TTZDisplay(BRect frame, const char* name, const char* label)
|
||||
: BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW),
|
||||
fLabel(label),
|
||||
fText(""),
|
||||
@ -62,7 +62,7 @@ TTZDisplay::Draw(BRect /* updateRect */)
|
||||
|
||||
BRect bounds = Bounds();
|
||||
FillRect(Bounds(), B_SOLID_LOW);
|
||||
|
||||
|
||||
float fontHeight = _FontHeight();
|
||||
|
||||
BPoint pt(bounds.left + 2.0, fontHeight / 2.0 + 2.0);
|
||||
@ -70,7 +70,7 @@ TTZDisplay::Draw(BRect /* updateRect */)
|
||||
|
||||
pt.y += fontHeight;
|
||||
DrawString(fText.String(), pt);
|
||||
|
||||
|
||||
pt.x = bounds.right - StringWidth(fTime.String()) - 2.0;
|
||||
DrawString(fTime.String(), pt);
|
||||
}
|
||||
@ -84,7 +84,7 @@ TTZDisplay::Label() const
|
||||
|
||||
|
||||
void
|
||||
TTZDisplay::SetLabel(const char *label)
|
||||
TTZDisplay::SetLabel(const char* label)
|
||||
{
|
||||
fLabel.SetTo(label);
|
||||
Draw(Bounds());
|
||||
@ -99,7 +99,7 @@ TTZDisplay::Text() const
|
||||
|
||||
|
||||
void
|
||||
TTZDisplay::SetText(const char *text)
|
||||
TTZDisplay::SetText(const char* text)
|
||||
{
|
||||
fText.SetTo(text);
|
||||
Draw(Bounds());
|
||||
@ -119,11 +119,11 @@ TTZDisplay::SetTime(int32 hour, int32 minute)
|
||||
int32 ahour = hour;
|
||||
if (hour > 12)
|
||||
ahour = hour -12;
|
||||
|
||||
|
||||
if (ahour == 0)
|
||||
ahour = 12;
|
||||
|
||||
const char *ap = "AM";
|
||||
const char* ap = "AM";
|
||||
if (hour > 11)
|
||||
ap = "PM";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -8,8 +8,8 @@
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*
|
||||
*/
|
||||
#ifndef TTZDISPLAY_H
|
||||
#define TTZDISPLAY_H
|
||||
#ifndef _TZ_DISPLAY_H
|
||||
#define _TZ_DISPLAY_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
@ -17,29 +17,30 @@
|
||||
|
||||
|
||||
class TTZDisplay : public BView {
|
||||
public:
|
||||
TTZDisplay(BRect frame, const char *name, const char *label);
|
||||
virtual ~TTZDisplay();
|
||||
public:
|
||||
TTZDisplay(BRect frame, const char* name,
|
||||
const char* label);
|
||||
virtual ~TTZDisplay();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void Draw(BRect updateRect);
|
||||
|
||||
const char* Label() const;
|
||||
void SetLabel(const char *label);
|
||||
const char* Label() const;
|
||||
void SetLabel(const char* label);
|
||||
|
||||
const char* Text() const;
|
||||
void SetText(const char *text);
|
||||
const char* Text() const;
|
||||
void SetText(const char* text);
|
||||
|
||||
const char* Time() const;
|
||||
void SetTime(int32 hour, int32 minute);
|
||||
|
||||
private:
|
||||
BString fLabel;
|
||||
BString fText;
|
||||
BString fTime;
|
||||
const char* Time() const;
|
||||
void SetTime(int32 hour, int32 minute);
|
||||
|
||||
private:
|
||||
BString fLabel;
|
||||
BString fText;
|
||||
BString fTime;
|
||||
};
|
||||
|
||||
#endif // TTZDISPLAY_H
|
||||
|
||||
#endif // _TZ_DISPLAY_H
|
||||
|
||||
|
@ -44,7 +44,7 @@ TimeApplication::ReadyToRun()
|
||||
void
|
||||
TimeApplication::AboutRequested()
|
||||
{
|
||||
BAlert *alert = new BAlert("about",
|
||||
BAlert* alert = new BAlert("about",
|
||||
"Time & Date, writen by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t"
|
||||
"Julun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2008, Haiku.", "OK");
|
||||
alert->Go();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007, Haiku. All rights reserved.
|
||||
* Copyright 2002-2010, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -7,8 +7,8 @@
|
||||
* Mike Berg <mike@berg-net.us>
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*/
|
||||
#ifndef TIME_H
|
||||
#define TIME_H
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
@ -18,16 +18,17 @@ class TTimeWindow;
|
||||
|
||||
|
||||
class TimeApplication : public BApplication {
|
||||
public:
|
||||
TimeApplication();
|
||||
virtual ~TimeApplication();
|
||||
public:
|
||||
TimeApplication();
|
||||
virtual ~TimeApplication();
|
||||
|
||||
virtual void ReadyToRun();
|
||||
virtual void AboutRequested();
|
||||
virtual void ReadyToRun();
|
||||
virtual void AboutRequested();
|
||||
|
||||
private:
|
||||
TTimeWindow *fWindow;
|
||||
private:
|
||||
TTimeWindow* fWindow;
|
||||
};
|
||||
|
||||
#endif // TIME_H
|
||||
|
||||
#endif // _TIME_H
|
||||
|
||||
|
@ -15,7 +15,7 @@ resource app_version {
|
||||
internal = 0,
|
||||
|
||||
short_info = "Time",
|
||||
long_info = "Time ©2002-2009 Haiku"
|
||||
long_info = "Time ©2002-2010 Haiku"
|
||||
};
|
||||
|
||||
resource vector_icon {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007, Haiku. All rights reserved.
|
||||
* Copyright 2002-2010, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -8,14 +8,14 @@
|
||||
* Julun <host.haiku@gmx.de>
|
||||
* Philippe Saint-Pierre <stpere@gmail.com>
|
||||
*/
|
||||
#ifndef TIME_MESSAGES_H
|
||||
#define TIME_MESSAGES_H
|
||||
#ifndef _TIME_MESSAGES_H
|
||||
#define _TIME_MESSAGES_H
|
||||
|
||||
|
||||
//Timezone messages
|
||||
const uint32 H_CITY_CHANGED = 'h_CC';
|
||||
const uint32 H_CITY_SET = 'h_CS';
|
||||
|
||||
|
||||
//SetButton
|
||||
const uint32 H_SET_TIME_ZONE = 'hSTZ';
|
||||
|
||||
@ -46,5 +46,6 @@ const uint32 kMsgRevert = 'rvrt';
|
||||
// change time finished
|
||||
const uint32 kChangeTimeFinished = 'tcfi';
|
||||
|
||||
#endif //TIME_MESSAGES_H
|
||||
|
||||
#endif // _TIME_MESSAGES_H
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007, Haiku. All rights reserved.
|
||||
* Copyright 2002-2010, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -7,8 +7,8 @@
|
||||
* Mike Berg <mike@berg-net.us>
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*/
|
||||
#ifndef TIME_SETTINGS_H
|
||||
#define TIME_SETTINGS_H
|
||||
#ifndef _TIME_SETTINGS_H
|
||||
#define _TIME_SETTINGS_H
|
||||
|
||||
|
||||
#include <Point.h>
|
||||
@ -16,16 +16,17 @@
|
||||
|
||||
|
||||
class TimeSettings {
|
||||
public :
|
||||
TimeSettings();
|
||||
~TimeSettings();
|
||||
public :
|
||||
TimeSettings();
|
||||
~TimeSettings();
|
||||
|
||||
BPoint LeftTop() const;
|
||||
void SetLeftTop(const BPoint leftTop);
|
||||
BPoint LeftTop() const;
|
||||
void SetLeftTop(const BPoint leftTop);
|
||||
|
||||
private:
|
||||
BString fSettingsFile;
|
||||
private:
|
||||
BString fSettingsFile;
|
||||
};
|
||||
|
||||
#endif // TIME_SETTINGS_H
|
||||
|
||||
#endif // _TIME_SETTINGS_H
|
||||
|
||||
|
@ -41,13 +41,13 @@ TTimeWindow::~TTimeWindow()
|
||||
void
|
||||
TTimeWindow::SetRevertStatus()
|
||||
{
|
||||
fRevertButton->SetEnabled(fDateTimeView->CheckCanRevert()
|
||||
fRevertButton->SetEnabled(fDateTimeView->CheckCanRevert()
|
||||
|| fTimeZoneView->CheckCanRevert());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TTimeWindow::MessageReceived(BMessage *message)
|
||||
void
|
||||
TTimeWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch(message->what) {
|
||||
case H_USER_CHANGE:
|
||||
@ -56,7 +56,7 @@ TTimeWindow::MessageReceived(BMessage *message)
|
||||
_SendTimeChangeFinished();
|
||||
SetRevertStatus();
|
||||
break;
|
||||
|
||||
|
||||
case B_ABOUT_REQUESTED:
|
||||
be_app->PostMessage(B_ABOUT_REQUESTED);
|
||||
break;
|
||||
@ -79,41 +79,41 @@ TTimeWindow::MessageReceived(BMessage *message)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
TTimeWindow::QuitRequested()
|
||||
{
|
||||
TimeSettings().SetLeftTop(Frame().LeftTop());
|
||||
|
||||
fBaseView->StopWatchingAll(fTimeZoneView);
|
||||
fBaseView->StopWatchingAll(fDateTimeView);
|
||||
|
||||
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
|
||||
|
||||
return BWindow::QuitRequested();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TTimeWindow::_InitWindow()
|
||||
{
|
||||
SetPulseRate(500000);
|
||||
|
||||
fDateTimeView = new DateTimeView(Bounds());
|
||||
|
||||
|
||||
BRect bounds = fDateTimeView->Bounds();
|
||||
fTimeZoneView = new TimeZoneView(bounds);
|
||||
|
||||
fBaseView = new TTimeBaseView(bounds, "baseView");
|
||||
AddChild(fBaseView);
|
||||
|
||||
|
||||
fBaseView->StartWatchingAll(fDateTimeView);
|
||||
fBaseView->StartWatchingAll(fTimeZoneView);
|
||||
|
||||
bounds.OffsetBy(10.0, 10.0);
|
||||
BTabView *tabView = new BTabView(bounds.InsetByCopy(-5.0, -5.0),
|
||||
BTabView* tabView = new BTabView(bounds.InsetByCopy(-5.0, -5.0),
|
||||
"tabView" , B_WIDTH_AS_USUAL, B_FOLLOW_NONE);
|
||||
|
||||
BTab *tab = new BTab();
|
||||
|
||||
BTab* tab = new BTab();
|
||||
tabView->AddTab(fDateTimeView, tab);
|
||||
tab->SetLabel("Date & Time");
|
||||
|
||||
@ -131,7 +131,7 @@ TTimeWindow::_InitWindow()
|
||||
|
||||
fRevertButton = new BButton(rect, "revert", "Revert",
|
||||
new BMessage(kMsgRevert), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
|
||||
|
||||
|
||||
fRevertButton->ResizeToPreferred();
|
||||
fRevertButton->SetEnabled(false);
|
||||
float buttonHeight = fRevertButton->Bounds().Height();
|
||||
@ -139,7 +139,7 @@ TTimeWindow::_InitWindow()
|
||||
fBaseView->AddChild(fRevertButton);
|
||||
fRevertButton->SetTarget(this);
|
||||
|
||||
fBaseView->ResizeTo(tabView->Bounds().Width() + 10.0,
|
||||
fBaseView->ResizeTo(tabView->Bounds().Width() + 10.0,
|
||||
tabView->Bounds().Height() + buttonHeight + 30.0);
|
||||
|
||||
ResizeTo(fBaseView->Bounds().Width(), fBaseView->Bounds().Height());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -7,8 +7,8 @@
|
||||
* Julun <host.haiku@gmx.de>
|
||||
*
|
||||
*/
|
||||
#ifndef TIME_WINDOW_H
|
||||
#define TIME_WINDOW_H
|
||||
#ifndef _TIME_WINDOW_H
|
||||
#define _TIME_WINDOW_H
|
||||
|
||||
|
||||
#include <Window.h>
|
||||
@ -21,26 +21,27 @@ class TimeZoneView;
|
||||
|
||||
|
||||
class TTimeWindow : public BWindow {
|
||||
public:
|
||||
TTimeWindow(BRect rect);
|
||||
virtual ~TTimeWindow();
|
||||
public:
|
||||
TTimeWindow(BRect rect);
|
||||
virtual ~TTimeWindow();
|
||||
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
void SetRevertStatus();
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
void SetRevertStatus();
|
||||
|
||||
private:
|
||||
void _InitWindow();
|
||||
void _AlignWindow();
|
||||
private:
|
||||
void _InitWindow();
|
||||
void _AlignWindow();
|
||||
|
||||
void _SendTimeChangeFinished();
|
||||
void _SendTimeChangeFinished();
|
||||
|
||||
private:
|
||||
TTimeBaseView *fBaseView;
|
||||
DateTimeView *fDateTimeView;
|
||||
TimeZoneView *fTimeZoneView;
|
||||
BButton *fRevertButton;
|
||||
private:
|
||||
TTimeBaseView* fBaseView;
|
||||
DateTimeView* fDateTimeView;
|
||||
TimeZoneView* fTimeZoneView;
|
||||
BButton* fRevertButton;
|
||||
};
|
||||
|
||||
#endif // TIME_WINDOW_H
|
||||
|
||||
#endif // _TIME_WINDOW_H
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
* Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
||||
*/
|
||||
|
||||
#ifndef __TIMEZONELISTITEM_H__
|
||||
#define __TIMEZONELISTITEM_H__
|
||||
#ifndef _TIME_ZONE_LIST_ITEM_H
|
||||
#define _TIME_ZONE_LIST_ITEM_H
|
||||
|
||||
|
||||
#include <StringItem.h>
|
||||
@ -19,17 +19,19 @@ class BTimeZone;
|
||||
|
||||
|
||||
class TimeZoneListItem : public BStringItem {
|
||||
public:
|
||||
TimeZoneListItem(const char* text, BCountry* country,
|
||||
BTimeZone* timeZone);
|
||||
~TimeZoneListItem();
|
||||
public:
|
||||
TimeZoneListItem(const char* text,
|
||||
BCountry* country, BTimeZone* timeZone);
|
||||
~TimeZoneListItem();
|
||||
|
||||
void DrawItem(BView* owner, BRect frame, bool complete = false);
|
||||
void Code(char* buffer);
|
||||
void DrawItem(BView* owner, BRect frame,
|
||||
bool complete = false);
|
||||
void Code(char* buffer);
|
||||
|
||||
private:
|
||||
BBitmap* fIcon;
|
||||
BTimeZone* fTimeZone;
|
||||
private:
|
||||
BBitmap* fIcon;
|
||||
BTimeZone* fTimeZone;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _TIME_ZONE_LIST_ITEM_H
|
||||
|
@ -49,7 +49,7 @@ TimeZoneView::TimeZoneView(BRect frame)
|
||||
fCurrentZone = NULL;
|
||||
fOldZone = NULL;
|
||||
// TODO : get default timezone from locale kit
|
||||
InitView();
|
||||
_InitView();
|
||||
}
|
||||
|
||||
|
||||
@ -73,9 +73,9 @@ TimeZoneView::_Revert()
|
||||
// TODO : else, select ??!
|
||||
|
||||
fCityList->ScrollToSelection();
|
||||
fCurrent->SetText(((TimeZoneListItem *)fCityList->ItemAt(czone))->Text());
|
||||
SetPreview();
|
||||
SetTimeZone();
|
||||
fCurrent->SetText(((TimeZoneListItem*)fCityList->ItemAt(czone))->Text());
|
||||
_SetPreview();
|
||||
_SetTimeZone();
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ TimeZoneView::AttachedToWindow()
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::MessageReceived(BMessage *message)
|
||||
TimeZoneView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
case B_OBSERVER_NOTICE_CHANGE:
|
||||
@ -126,7 +126,7 @@ TimeZoneView::MessageReceived(BMessage *message)
|
||||
message->FindInt32(B_OBSERVE_WHAT_CHANGE, &change);
|
||||
switch(change) {
|
||||
case H_TM_CHANGED:
|
||||
UpdateDateTime(message);
|
||||
_UpdateDateTime(message);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -138,7 +138,7 @@ TimeZoneView::MessageReceived(BMessage *message)
|
||||
|
||||
case H_SET_TIME_ZONE:
|
||||
{
|
||||
SetTimeZone();
|
||||
_SetTimeZone();
|
||||
((TTimeWindow*)Window())->SetRevertStatus();
|
||||
break;
|
||||
}
|
||||
@ -148,7 +148,7 @@ TimeZoneView::MessageReceived(BMessage *message)
|
||||
break;
|
||||
|
||||
case H_CITY_CHANGED:
|
||||
SetPreview();
|
||||
_SetPreview();
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -159,7 +159,7 @@ TimeZoneView::MessageReceived(BMessage *message)
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::UpdateDateTime(BMessage *message)
|
||||
TimeZoneView::_UpdateDateTime(BMessage* message)
|
||||
{
|
||||
int32 hour;
|
||||
int32 minute;
|
||||
@ -174,14 +174,14 @@ TimeZoneView::UpdateDateTime(BMessage *message)
|
||||
|
||||
// do calc to get other zone time
|
||||
if (fCityList->CurrentSelection() > -1)
|
||||
SetPreview();
|
||||
_SetPreview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::InitView()
|
||||
TimeZoneView::_InitView()
|
||||
{
|
||||
// left side
|
||||
BRect frameLeft(Bounds());
|
||||
@ -194,9 +194,9 @@ TimeZoneView::InitView()
|
||||
fCityList->SetSelectionMessage(new BMessage(H_CITY_CHANGED));
|
||||
fCityList->SetInvocationMessage(new BMessage(H_SET_TIME_ZONE));
|
||||
|
||||
BuildRegionMenu();
|
||||
_BuildRegionMenu();
|
||||
|
||||
BScrollView *scrollList = new BScrollView("scrollList", fCityList,
|
||||
BScrollView* scrollList = new BScrollView("scrollList", fCityList,
|
||||
B_FOLLOW_ALL, 0, false, true);
|
||||
AddChild(scrollList);
|
||||
|
||||
@ -229,7 +229,7 @@ TimeZoneView::InitView()
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::BuildRegionMenu()
|
||||
TimeZoneView::_BuildRegionMenu()
|
||||
{
|
||||
// Get a list of countries
|
||||
// For each country, get all the timezones and AddItemUnder them
|
||||
@ -266,7 +266,9 @@ TimeZoneView::BuildRegionMenu()
|
||||
fCityList->AddItem(countryItem);
|
||||
|
||||
BTimeZone* timeZone;
|
||||
for (int j = 0; timeZone = (BTimeZone*)tzList.ItemAt(j); j++) {
|
||||
for (int j = 0;
|
||||
(timeZone = (BTimeZone*)tzList.ItemAt(j)) != NULL;
|
||||
j++) {
|
||||
BString readableName;
|
||||
timeZone->GetName(readableName);
|
||||
BStringItem* tzItem = new TimeZoneListItem(readableName,
|
||||
@ -283,17 +285,17 @@ TimeZoneView::BuildRegionMenu()
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::SetPreview()
|
||||
TimeZoneView::_SetPreview()
|
||||
{
|
||||
int32 selection = fCityList->CurrentSelection();
|
||||
if (selection >= 0) {
|
||||
TimeZoneListItem *item = (TimeZoneListItem *)fCityList->ItemAt(
|
||||
TimeZoneListItem* item = (TimeZoneListItem*)fCityList->ItemAt(
|
||||
selection);
|
||||
|
||||
// set timezone to selection
|
||||
char buffer[50];
|
||||
item->Code(buffer);
|
||||
SetTimeZone(buffer);
|
||||
_SetTimeZone(buffer);
|
||||
|
||||
// calc preview time
|
||||
time_t current = time(NULL);
|
||||
@ -305,7 +307,7 @@ TimeZoneView::SetPreview()
|
||||
fPreview->SetTime(localTime.tm_hour, localTime.tm_min);
|
||||
|
||||
fCurrentZone->Code(buffer);
|
||||
SetTimeZone(buffer);
|
||||
_SetTimeZone(buffer);
|
||||
|
||||
fSetZone->SetEnabled((strcmp(fCurrent->Text(), item->Text()) != 0));
|
||||
}
|
||||
@ -313,11 +315,11 @@ TimeZoneView::SetPreview()
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::SetCurrent(const char *text)
|
||||
TimeZoneView::_SetCurrent(const char* text)
|
||||
{
|
||||
char buffer[50];
|
||||
fCurrentZone->Code(buffer);
|
||||
SetTimeZone(buffer);
|
||||
_SetTimeZone(buffer);
|
||||
|
||||
time_t current = time(NULL);
|
||||
struct tm localTime;
|
||||
@ -329,7 +331,7 @@ TimeZoneView::SetCurrent(const char *text)
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::SetTimeZone()
|
||||
TimeZoneView::_SetTimeZone()
|
||||
{
|
||||
/* set time based on supplied timezone. How to do this?
|
||||
1) replace symlink "timezone" in B_USER_SETTINGS_DIR with a link to the
|
||||
@ -344,10 +346,10 @@ TimeZoneView::SetTimeZone()
|
||||
return;
|
||||
|
||||
char timeZoneCode[50];
|
||||
((TimeZoneListItem *)fCityList->ItemAt(selection))->Code(timeZoneCode);
|
||||
((TimeZoneListItem*)fCityList->ItemAt(selection))->Code(timeZoneCode);
|
||||
|
||||
// update environment
|
||||
SetTimeZone(timeZoneCode);
|
||||
_SetTimeZone(timeZoneCode);
|
||||
|
||||
// update display
|
||||
time_t current = time(NULL);
|
||||
@ -365,12 +367,12 @@ TimeZoneView::SetTimeZone()
|
||||
fHour = localTime.tm_hour;
|
||||
fMinute = localTime.tm_min;
|
||||
fCurrentZone = (TimeZoneListItem*)(fCityList->ItemAt(selection));
|
||||
SetCurrent(((TimeZoneListItem *)fCityList->ItemAt(selection))->Text());
|
||||
_SetCurrent(((TimeZoneListItem*)fCityList->ItemAt(selection))->Text());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TimeZoneView::SetTimeZone(const char *zone)
|
||||
TimeZoneView::_SetTimeZone(const char* zone)
|
||||
{
|
||||
putenv(BString("TZ=").Append(zone).String());
|
||||
tzset();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2009, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -23,36 +23,36 @@ class TimeZoneListItem;
|
||||
|
||||
|
||||
class TimeZoneView : public BView {
|
||||
public:
|
||||
TimeZoneView(BRect frame);
|
||||
virtual ~TimeZoneView();
|
||||
public:
|
||||
TimeZoneView(BRect frame);
|
||||
virtual ~TimeZoneView();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
bool CheckCanRevert();
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
bool CheckCanRevert();
|
||||
|
||||
private:
|
||||
void UpdateDateTime(BMessage *message);
|
||||
void SetTimeZone();
|
||||
void SetTimeZone(const char *zone);
|
||||
void SetPreview();
|
||||
void SetCurrent(const char *text);
|
||||
void InitView();
|
||||
void BuildRegionMenu();
|
||||
void _Revert();
|
||||
private:
|
||||
void _UpdateDateTime(BMessage* message);
|
||||
void _SetTimeZone();
|
||||
void _SetTimeZone(const char* zone);
|
||||
void _SetPreview();
|
||||
void _SetCurrent(const char* text);
|
||||
void _InitView();
|
||||
void _BuildRegionMenu();
|
||||
void _Revert();
|
||||
|
||||
private:
|
||||
BOutlineListView *fCityList;
|
||||
BButton *fSetZone;
|
||||
TTZDisplay *fCurrent;
|
||||
TTZDisplay *fPreview;
|
||||
private:
|
||||
BOutlineListView* fCityList;
|
||||
BButton* fSetZone;
|
||||
TTZDisplay* fCurrent;
|
||||
TTZDisplay* fPreview;
|
||||
|
||||
int32 fHour;
|
||||
int32 fMinute;
|
||||
TimeZoneListItem *fCurrentZone;
|
||||
TimeZoneListItem *fOldZone;
|
||||
bool fInitialized;
|
||||
int32 fHour;
|
||||
int32 fMinute;
|
||||
TimeZoneListItem* fCurrentZone;
|
||||
TimeZoneListItem* fOldZone;
|
||||
bool fInitialized;
|
||||
};
|
||||
|
||||
#endif //Zone_View_H
|
||||
|
||||
#endif // ZONE_VIEW_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user