All New Code by Michael Berg.

The clock and calendar work.  The Zone list is mostly there.  I haven't gotten it to apply changes yet, and the second timezone time view isn't updated.  It is almost a bit copy of the original, I couldn't work out some of the positioning.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7431 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway 2004-05-06 12:55:26 +00:00
parent 3211ef3088
commit b66afdfa2d
24 changed files with 2444 additions and 409 deletions

View File

@ -0,0 +1,46 @@
#ifndef ANALOG_CLOCK_H
#define ANALOG_CLOCK_H
#include <Message.h>
#include <View.h>
#include <time.h>
class TOffscreen: public BView
{
public:
TOffscreen(BRect frame, char *name);
virtual ~TOffscreen();
virtual void AttachedToWindow();
virtual void DrawX();
BPoint Position();
BPoint f_MinutePoints[60];
BPoint f_HourPoints[60];
short f_Hours;
short f_Minutes;
short f_Seconds;
private:
BBitmap *f_bitmap;
BPoint f_center;
BPoint f_offset;
float f_Offset;
};
class TAnalogClock: public BView
{
public:
TAnalogClock(BRect frame, const char *name, uint32 resizingmode, uint32 flags);
virtual ~TAnalogClock();
virtual void AttachedToWindow();
virtual void Draw(BRect updaterect);
void Update(tm *atm);
private:
BPoint f_drawpt;
BBitmap *f_bitmap;
TOffscreen *f_offscreen;
};
#endif //ANALOG_CLOCK_H

View File

@ -0,0 +1,30 @@
#include <Alert.h>
#include <stdio.h>
#include "BaseView.h"
TTimeBaseView::TTimeBaseView(BRect frame, const char *name)
: BView(frame, name, B_FOLLOW_ALL_SIDES, B_PULSE_NEEDED)
{
f_message = new BMessage(OB_TIME_UPDATE);
}
TTimeBaseView::~TTimeBaseView()
{ }
void
TTimeBaseView::Pulse()
{
time_t current;
struct tm *ltime;
current = time(0);
ltime = localtime(&current);
f_message->MakeEmpty();
f_message->AddPointer("_tm_", ltime);
if (IsWatched())
{
SendNotices(OB_TIME_UPDATE, f_message);
}
}

19
src/prefs/time/BaseView.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef TIMEBASE_H
#define TIMEBASE_H
#include <Message.h>
#include <View.h>
#include "TimeMessages.h"
class TTimeBaseView: public BView
{
public:
TTimeBaseView(BRect frmae, const char *name);
virtual ~TTimeBaseView();
virtual void Pulse();
private:
BMessage *f_message;
};
#endif //TIMEBASE_H

View File

@ -0,0 +1,19 @@
#include <Screen.h>
#include <Bitmap.h>
#include "Bitmaps.h"
void
ReplaceTransparentColor(BBitmap *bitmap, rgb_color with)
{
// ASSERT(bitmap->ColorSpace() == B_COLOR_8_BIT); // other color spaces not implemented yet
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++)
if (bits[index] == B_TRANSPARENT_8_BIT)
bits[index] = withIndex;
}

510
src/prefs/time/Bitmaps.h Normal file
View File

@ -0,0 +1,510 @@
void ReplaceTransparentColor(BBitmap *bitmap, rgb_color with);
const int32 kClockFaceWidth = 85;
const int32 kClockFaceHeight = 86;
const color_space kClockFaceColorSpace = B_CMAP8;
const unsigned char kClockFaceBits [] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x1d,0x3f,0x3f,0x3f,0x1e,0xff,0x18,0x16,0x13,0x12,0x11,
0x10,0x10,0x10,0x10,0x10,0x11,0x12,0x13,0x16,0x18,0x1a,0x1d,0x3f,0x1d,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1d,0x3f,0x3f,0x1e,0x1a,0x17,
0x13,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x13,0x17,0x19,0x1e,0x1d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1e,0x3f,0x3f,0x1a,0x16,0x12,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,
0x16,0x19,0x1e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x1e,0x18,0x13,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x13,0x16,0x1c,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1e,0x3f,0x1e,0x18,
0x12,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0d,0x0b,0x09,0x07,0x06,0x05,0x04,
0x03,0x03,0x03,0x04,0x05,0x06,0x07,0x09,0x0b,0x0d,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x12,0x15,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0x1d,0x3f,0x3f,0x19,0x13,0x10,0x10,0x10,0x10,0x10,0x10,0x0e,0x0b,0x08,
0x05,0x03,0x05,0x08,0x0c,0x11,0x15,0x19,0x1c,0x1e,0x3f,0x1e,0x1c,0x19,0x15,0x11,
0x0c,0x08,0x08,0x08,0x0b,0x0e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x13,0x15,
0x1d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x1b,0x14,0x10,0x10,0x10,
0x10,0x10,0x10,0x0c,0x08,0x05,0x04,0x08,0x0f,0x17,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x17,0x0f,0x0b,0x0a,0x0c,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x17,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1c,
0x3f,0x3f,0x18,0x11,0x10,0x10,0x10,0x10,0x0f,0x0b,0x07,0x03,0x06,0x0f,0x19,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x19,0x0f,0x0c,0x0b,0x0f,0x10,0x10,0x10,0x10,0x10,
0x10,0x11,0x14,0x1c,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0x1d,0x3f,0x1d,0x15,0x10,0x10,0x10,0x10,0x10,0x0b,
0x07,0x03,0x08,0x13,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x13,0x0e,0x0c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x18,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1d,0x3f,0x1b,
0x13,0x10,0x10,0x10,0x10,0x0d,0x08,0x03,0x08,0x13,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x14,0x0e,0x0d,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x16,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0x1e,0x3f,0x1a,0x12,0x10,0x10,0x10,0x10,0x0a,0x05,0x05,0x10,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x2b,
0x3f,0x3f,0xda,0x2b,0x2b,0xda,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x13,0x0e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x14,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,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x2b,0x1d,0x3f,0x2b,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1c,0x15,
0x10,0x10,0x10,0x10,0x0d,0x07,0x05,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0x13,0x0e,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x16,
0x1e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0xda,0x2b,0x2b,0xda,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x18,0x12,0x10,0x10,0x10,0x10,0x0c,0x06,0x06,0x10,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x14,
0x0e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x14,0x18,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1a,0x14,0x10,0x10,0x10,
0x10,0x10,0x0a,0x05,0x07,0x12,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x16,0x0e,0x0d,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x15,0x18,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x1a,0x14,0x10,0x10,0x10,0x10,0x10,0x0d,0x08,0x03,0x0a,0x16,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0x10,0x0d,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x13,0x17,0x1c,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1d,0x18,0x13,0x10,0x10,0x10,0x10,0x10,0x10,0x0b,
0x06,0x05,0x0d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x13,0x0d,0x0c,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x14,0x18,0x1b,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1c,0x18,0x14,0x11,0x10,
0x10,0x10,0x10,0x10,0x10,0x0c,0x07,0x03,0x09,0x13,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x10,0x0c,0x0d,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x11,0x14,0x17,0x19,0x1b,0x1d,0x1e,0x3f,0x3f,0x3f,0x1e,0x1d,0x1b,0x19,
0x17,0x14,0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0d,0x08,0x04,0x06,0x0f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x17,0x0e,
0x0b,0x0c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x0c,0x08,0x04,0x06,0x0d,0x17,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x17,0x0e,0x0a,0x0a,0x0d,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x0d,0x0a,0x06,0x03,0x07,0x0e,0x17,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x11,0x0b,0x09,0x09,0x0c,0x0e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0e,0x0c,0x09,0x06,0x04,0x05,
0x0a,0x11,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x18,0x11,0x0b,
0x08,0x07,0x08,0x0a,0x0b,0x0d,0x0e,0x0f,0x0f,0x10,0x0f,0x0f,0x0e,0x0d,0x0b,0x0a,
0x08,0x06,0x04,0x04,0x07,0x0b,0x11,0x18,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x17,0x12,0x0d,0x0a,0x08,0x06,0x05,
0x03,0x03,0x03,0x03,0x03,0x05,0x06,0x08,0x0a,0x0d,0x12,0x17,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0x3f
};
const int32 kUpArrowWidth = 16;
const int32 kUpArrowHeight = 7;
const color_space kUpArrowColorSpace = B_CMAP8;
const unsigned char kUpArrowBits [] = {
0xff,0xff,0xff,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0xff,0xff,0x13,0x1e,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0xff,0x13,0x1e,0xff,0x18,0x13,0xff,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0x13,0x1e,0xff,0xff,0xff,0x18,0x13,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0x13,0x1e,0x18,0x18,0x18,0x18,0x18,0x18,0x0b,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0x13,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x13,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0xff,0xff,0x18,0x3f,0xff,0xff
};
const int32 kDownArrowWidth = 16;
const int32 kDownArrowHeight = 7;
const color_space kDownArrowColorSpace = B_CMAP8;
const unsigned char kDownArrowBits [] = {
0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x0b,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0x13,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x16,0x0b,0x13,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0x13,0xff,0xff,0xff,0xff,0x16,0x0b,0x13,0x13,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0xff,0x13,0xff,0xff,0x16,0x0b,0x13,0x13,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0xff,0xff,0x13,0x16,0x0b,0x13,0x13,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0xff,0xff,0xff,0x0b,0x13,0x13,0xff,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0x18,0x3f,0xff,0xff
};

View File

@ -0,0 +1,330 @@
#include <Debug.h>
#include <Message.h>
#include <String.h>
#include <stdio.h>
#include "CalendarView.h"
#define SEGMENT_CHANGE 'ostd'
void
__printrect(BRect rect)
{
printf("%f, %f, %f, %f\n", rect.left, rect.top, rect.right, rect.bottom);
}
TDay::TDay(BRect frame, int day)
: BView(frame, B_EMPTY_STRING, B_FOLLOW_NONE, B_WILL_DRAW)
, f_day(day)
, f_isselected(false)
{ }
TDay::~TDay()
{ }
void
TDay::AttachedToWindow()
{
if (Parent())
SetViewColor(Parent()->ViewColor());
}
void
TDay::MouseDown(BPoint where)
{
if (f_day> 0)
{
f_isselected = !f_isselected;
Draw(Bounds());
}
}
void
TDay::Stroke3dFrame(BRect frame, rgb_color light, rgb_color dark, bool inset)
{
rgb_color color1;
rgb_color color2;
if (inset)
{
color1 = dark;
color2 = light;
}
else
{
color1 = light;
color2 = dark;
}
BeginLineArray(4);
AddLine(frame.LeftTop(), frame.RightTop(), color1);
AddLine(frame.LeftTop(), frame.LeftBottom(), color1);
AddLine(frame.LeftBottom(), frame.RightBottom(), color2);
AddLine(frame.RightBottom(), frame.RightTop(), color2);
EndLineArray();
}
void
TDay::Draw(BRect updaterect)
{
BRect bounds(Bounds());
SetHighColor(ViewColor());
FillRect(Bounds(), B_SOLID_HIGH);
rgb_color bgcolor;
rgb_color dark;
rgb_color light;
BString text;
if (f_isselected)
{
bgcolor = tint_color(ViewColor(), B_DARKEN_2_TINT);
}
else
{
bgcolor = tint_color(ViewColor(), B_DARKEN_1_TINT);
}
text << f_day;
dark = tint_color(bgcolor, B_DARKEN_1_TINT);
light = tint_color(bgcolor, B_LIGHTEN_MAX_TINT);
SetHighColor(bgcolor);
FillRect(bounds);
if (f_isselected)
Stroke3dFrame(bounds, light, dark, true);
if (f_day> 0)
{
if (!f_isselected)
SetHighColor(0, 0, 0, 255);
else
SetHighColor(255, 255, 255, 255);
SetLowColor(bgcolor);
// calc font size;
float width = be_plain_font->StringWidth(text.String());
font_height finfo;
be_plain_font->GetHeight(&finfo);
float height = finfo.descent +finfo.ascent +finfo.leading;
BPoint drawpt((bounds.Width()/2.0) -(width/2.0) +1, (bounds.Height()/2.0) +(height/2.0) -2);
DrawString(text.String(), drawpt);
}
}
void
TDay::SetTo(BRect frame, int day)
{
MoveTo(frame.LeftTop());
f_day = day;
Draw(Bounds());
}
void
TDay::SetDay(int day, bool selected = false)
{
f_day = day;
f_isselected = selected;
Draw(Bounds());
}
/*=====> TCalendarView <=====*/
TCalendarView::TCalendarView(BRect frame, const char *name, uint32 resizingmode, uint32 flags)
: BView(frame, name, resizingmode, flags)
{
InitView();
}
TCalendarView::~TCalendarView()
{
}
void
TCalendarView::AttachedToWindow()
{
if (Parent())
SetViewColor(Parent()->ViewColor());
}
const char days[7] = { 'S', 'M', 'T', 'W', 'T', 'F', 'S' };
void
TCalendarView::Draw(BRect updaterect)
{
BRect bounds(0.0, 0.0, f_dayrect.Width(), f_dayrect.Height());
float width = 0;
float x = bounds.Width()/2.0;
BPoint drawpt;
BString day;
SetLowColor(ViewColor());
SetHighColor(0, 0, 0);
for (int i = 0; i < 7; i++)
{
day = days[i];
width = be_plain_font->StringWidth(day.String());
drawpt.x = bounds.left +(x -width/2.0 +2);
drawpt.y = bounds.bottom;
DrawString(day.String(), drawpt);
bounds.OffsetBy(bounds.Width() +1, 0);
}
}
void
TCalendarView::ClearDays()
{
BView *child;
if (CountChildren()> 0)
{
if ((child = ChildAt(0)) != NULL)
{
while (child)
{
RemoveChild(child);
child = child->NextSibling();
}
}
}
}
void
TCalendarView::CalcFlags()
{
}
static bool
isLeapYear(const int year)
{
if ((year % 400 == 0)||(year % 4 == 0 && year % 100 == 0))
return true;
else
return false;
}
static int
GetDaysInMonth(const int month, const int year)
{
if (month == 2 && isLeapYear(year))
{
return 29;
}
static const int DaysinMonth[12] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
return DaysinMonth[month];
}
static int
GetFirstDay(const int month, const int year)
{
int l_century = year/100;
int l_decade = year%100;
int l_month = (month +10)%12;
int l_day = 1;
if (l_month == 1 || l_month == 2)
{
if (l_decade == 0)
{
l_decade = 99;
l_century -= 1;
}
else
l_decade-= 1;
}
float tmp = (l_day +(floor(((13 *l_month) -1)/5))
+l_decade +(floor(l_decade /4))
+(floor(l_century/4)) -(2 *l_century));
int result = static_cast<int>(tmp)%7;
if (result < 0)
result += 7;
return result;
}
void
TCalendarView::InitView()
{
font_height finfo;
be_plain_font->GetHeight(&finfo);
float text_height = finfo.ascent +finfo.descent +finfo.leading;
BRect bounds(Bounds());
float width = (bounds.Width() -7)/7;
float height = ((bounds.Height() -(text_height +4)) -6)/6;
f_dayrect.Set(0.0, text_height +6, width, text_height +6 +height);
__printrect(f_dayrect);
BRect dayrect(f_dayrect);
TDay *day;
for (int row = 0; row < 6; row++)
{
for (int col = 0; col < 7; col++)
{
day = new TDay(dayrect.InsetByCopy(1, 1), 0);
AddChild(day);
dayrect.OffsetBy(width +1, 0);
}
dayrect.OffsetBy(0, height +1);
dayrect.OffsetTo(0, dayrect.top);
}
}
void
TCalendarView::InitDates()
{
TDay *day;
int label = 0;
int idx = 0;
int first = GetFirstDay(f_month+1, f_year);
int daycnt = GetDaysInMonth(f_month, f_year);
printf("%d, %d\n", first, daycnt);
for (int row = 0; row < 6; row++)
{
for (int col = 0; col < 7; col++)
{
day = dynamic_cast<TDay *>(ChildAt((row *7) +col));
if (idx < first || idx > daycnt +first +1)
label = 0;
else
label = idx -(first +1);
idx++;
day->SetDay(label, (label == f_day));
}
}
}
void
TCalendarView::Update(tm *atm)
{
if (f_month != atm->tm_mon
||f_day != atm->tm_mday
||f_year != atm->tm_year)
{
f_month = atm->tm_mon;
f_day = atm->tm_mday;
f_wday = atm->tm_wday;
f_year = atm->tm_year;
InitDates();
}
printf("M: %d %d D: %d %d Y: %d %d\n",
f_month, atm->tm_mon, f_day, atm->tm_mday, f_year, atm->tm_year);
}

View File

@ -0,0 +1,48 @@
#ifndef CALENDAR_VIEW_H
#define CALENDAR_VIEW_H
#include <View.h>
#include <time.h>
class TDay: public BView
{
public:
TDay(BRect frame, int day);
virtual ~TDay();
virtual void Draw(BRect updaterect);
virtual void AttachedToWindow();
virtual void MouseDown(BPoint where);
void SetTo(BRect frame, int day);
void SetDay(int day, bool selected = false);
protected:
virtual void Stroke3dFrame(BRect frame, rgb_color light, rgb_color dark, bool inset);
private:
int f_day;
bool f_isselected;
};
class TCalendarView: public BView
{
public:
TCalendarView(BRect frame, const char *name, uint32 resizingmode, uint32 flags);
virtual ~TCalendarView();
virtual void AttachedToWindow();
virtual void Draw(BRect bounds);
void Update(tm *atm);
protected:
virtual void InitView();
private:
void InitDates();
void ClearDays();
void CalcFlags();
BRect f_dayrect;
int f_month;
int f_day;
int f_year;
int f_wday;
};
#endif // CALENDAR_VIEW_H

View File

@ -0,0 +1,607 @@
#include <Bitmap.h>
#include <String.h>
#include "DateTimeEdit.h"
#include "Bitmaps.h"
const int32 kArrowAreaWidth = 16;
/*=====> TDateTimeEdit <=====*/
TDateTimeEdit::TDateTimeEdit(BRect frame, const char *name)
: BView(frame, name, B_FOLLOW_NONE, B_NAVIGABLE|B_WILL_DRAW)
{
f_up = new BBitmap(BRect(0, 0, kUpArrowWidth -1, kUpArrowHeight -1), kUpArrowColorSpace);
f_up->SetBits(kUpArrowBits, (kUpArrowWidth) *(kUpArrowHeight+1), 0, kUpArrowColorSpace);
ReplaceTransparentColor(f_up, ui_color(B_PANEL_BACKGROUND_COLOR)); // should be set to parents back color
f_down = new BBitmap(BRect(0, 0, kDownArrowWidth -1, kDownArrowHeight -2), kDownArrowColorSpace);
f_down->SetBits(kDownArrowBits, (kDownArrowWidth) *(kDownArrowHeight), 0, kDownArrowColorSpace);
ReplaceTransparentColor(f_down, ui_color(B_PANEL_BACKGROUND_COLOR));
}
TDateTimeEdit::~TDateTimeEdit()
{ }
void
TDateTimeEdit::AttachedToWindow()
{
if (Parent())
SetViewColor(Parent()->ViewColor());
}
void
TDateTimeEdit::MouseDown(BPoint where)
{
MakeFocus(true);
if (f_uprect.Contains(where))
UpPress();
else
if (f_downrect.Contains(where))
DownPress();
}
void
TDateTimeEdit::UpPress()
{ }
void
TDateTimeEdit::DownPress()
{ }
void
TDateTimeEdit::MakeFocus(bool focused)
{
if (focused != IsFocus())
{
BView::MakeFocus(focused);
Draw(Bounds());
Flush();
}
}
void
TDateTimeEdit::Draw(BRect updaterect)
{
rgb_color bgcolor = ViewColor();
rgb_color light = tint_color(bgcolor, B_LIGHTEN_MAX_TINT);
rgb_color dark = tint_color(bgcolor, B_DARKEN_1_TINT);
rgb_color darker = tint_color(bgcolor, B_DARKEN_3_TINT);
// draw 3d border
BRect bounds(Bounds());
SetHighColor(light);
SetLowColor(dark);
Draw3dFrame(bounds, true);
StrokeLine(bounds.LeftBottom(), bounds.LeftBottom(), B_SOLID_LOW);
bounds.InsetBy(1, 1);
bounds.right -= kArrowAreaWidth;
if (IsFocus())
{
rgb_color navcolor = keyboard_navigation_color();
SetHighColor(navcolor);
StrokeRect(bounds);
}
else
{
// draw border thickening (erase focus)
SetHighColor(darker);
SetLowColor(bgcolor);
Draw3dFrame(bounds, false);
}
// draw up/down control
SetHighColor(light);
bounds.left = bounds.right +1;// -kArrowAreaWidth;
bounds.right = Bounds().right -1;
f_uprect.Set(bounds.left +3, bounds.top +2, bounds.right, bounds.bottom /2.0);
f_downrect = f_uprect.OffsetByCopy(0, f_uprect.Height()+2);
DrawBitmap(f_up, f_uprect.LeftTop());
DrawBitmap(f_down, f_downrect.LeftTop());
Draw3dFrame(bounds, false);
SetHighColor(dark);
StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
StrokeLine(bounds.RightBottom(), bounds.RightTop());
SetHighColor(light);
StrokeLine(bounds.RightTop(), bounds.RightTop());
}
void
TDateTimeEdit::Draw3dFrame(BRect frame, bool inset)
{
rgb_color color1, color2;
if (inset)
{
color1 = HighColor();
color2 = LowColor();
}
else
{
color1 = LowColor();
color2 = HighColor();
}
BeginLineArray(6);
// left side
AddLine(frame.LeftBottom(), frame.LeftTop(), color2);
// right side
AddLine(frame.RightTop(), frame.RightBottom(), color1);
// bottom side
AddLine(frame.RightBottom(), frame.LeftBottom(), color1);
// top side
AddLine(frame.LeftTop(), frame.RightTop(), color2);
EndLineArray();
}
/*=====> TTimeEdit <=====*/
TTimeEdit::TTimeEdit(BRect frame, const char *name)
: TDateTimeEdit(frame, name)
{
BRect bounds(Bounds().InsetByCopy(1, 2));
// all areas same width :)
float width = be_plain_font->StringWidth("00") +7;
// AM/PM rect
bounds.right = Bounds().right -(kArrowAreaWidth +3);
bounds.left = bounds.right -(width +4);
f_aprect = bounds;
// seconds rect
bounds.right = bounds.left;
bounds.left = bounds.right -width;
f_secrect = bounds;
float sep_width = 9;
//minutes rect
bounds.right = bounds.left -sep_width;
bounds.left = bounds.right -width;
f_minrect = bounds;
//hour rect
bounds.right = bounds.left -sep_width;
bounds.left = Bounds().left +2;
f_hourrect = bounds;
}
TTimeEdit::~TTimeEdit()
{ }
void
TTimeEdit::Draw(BRect updaterect)
{
TDateTimeEdit::Draw(Bounds());
SetHighColor(0, 0, 0, 255);
BRect bounds(Bounds());
BString text;
BPoint drawpt;
BPoint offset(0, f_hourrect.Height()/2.0 -6);
// seperator
BString septext(":");
float width;
rgb_color dark = tint_color(ViewColor(), B_DARKEN_1_TINT);
//draw hour
if (updaterect.Contains(f_hourrect))
{
if (f_hour> 12)
{
if (f_hour < 22) text << "0";
text << f_hour -12;
}
else
{
if (f_hour < 10) text << "0";
text << f_hour;
}
width = be_plain_font->StringWidth(text.String());
offset.x = -(f_hourrect.Width()/2.0 -width/2.0);
drawpt = f_hourrect.LeftBottom() -offset;
if (f_focus == FOCUS_HOUR)
SetLowColor(dark);
else
SetLowColor(ViewColor());
FillRect(f_hourrect, B_SOLID_LOW);
DrawString(text.String(), drawpt);
offset.x = -3;
SetLowColor(ViewColor());
DrawString(septext.String(), f_hourrect.RightBottom() -offset);
}
//draw min
if (updaterect.Contains(f_minrect))
{
text = "";
if (f_minute < 10) text << "0";
text << f_minute;
width = be_plain_font->StringWidth(text.String());
offset.x = -(f_minrect.Width()/2.0 -width/2.0);
drawpt = f_minrect.LeftBottom() -offset;
if (f_focus == FOCUS_MINUTE)
SetLowColor(dark);
else
SetLowColor(ViewColor());
FillRect(f_minrect, B_SOLID_LOW);
DrawString(text.String(), drawpt);
offset.x = -3;
SetLowColor(ViewColor());
DrawString(septext.String(), f_minrect.RightBottom() -offset);
}
//draw sec
if (updaterect.Contains(f_secrect))
{
text = "";
if (f_second < 10) text << "0";
text << f_second;
width = be_plain_font->StringWidth(text.String());
offset.x = -(f_secrect.Width()/2.0 -width/2.0);
drawpt = f_secrect.LeftBottom() -offset;
if (f_focus == FOCUS_SECOND)
SetLowColor(dark);
else
SetLowColor(ViewColor());
FillRect(f_secrect, B_SOLID_LOW);
DrawString(text.String(), drawpt);
}
//draw AM/PM
if (updaterect.Contains(f_aprect))
{
text = "";
if (f_isam)
text << "AM";
else
text << "PM";
width = be_plain_font->StringWidth(text.String());
offset.x = -(f_aprect.Width()/2.0 -width/2.0);
drawpt = f_aprect.LeftBottom() -offset;
if (f_focus == FOCUS_AMPM)
SetLowColor(dark);
else
SetLowColor(ViewColor());
FillRect(f_aprect, B_SOLID_LOW);
DrawString(text.String(), drawpt);
}
}
void
TTimeEdit::MouseDown(BPoint where)
{
TDateTimeEdit::MouseDown(where);
if (f_hourrect.Contains(where))
{
f_focus = FOCUS_HOUR;
}
else
if (f_minrect.Contains(where))
{
f_focus = FOCUS_MINUTE;
}
else
if (f_secrect.Contains(where))
{
f_focus = FOCUS_SECOND;
}
else
if (f_aprect.Contains(where))
{
f_focus = FOCUS_AMPM;
}
else
f_focus = FOCUS_NONE;
Draw(Bounds());
}
void
TTimeEdit::UpPress()
{
switch(f_focus)
{
case FOCUS_HOUR:
f_hour += 1;
Draw(f_hourrect);
break;
case FOCUS_MINUTE:
f_minute += 1;
Draw(f_minrect);
break;
case FOCUS_SECOND:
f_second += 1;
Draw(f_secrect);
break;
case FOCUS_AMPM:
f_isam = !f_isam;
Draw(f_aprect);
break;
default:
break;
}
}
void
TTimeEdit::DownPress()
{
switch(f_focus)
{
case FOCUS_HOUR:
f_hour -= 1;
Draw(f_hourrect);
break;
case FOCUS_MINUTE:
f_minute -= 1;
Draw(f_minrect);
break;
case FOCUS_SECOND:
f_second -= 1;
Draw(f_secrect);
break;
case FOCUS_AMPM:
f_isam = !f_isam;
Draw(f_aprect);
break;
default:
break;
}
}
void
TTimeEdit::SetTo(int hour, int minute, int second)
{
f_hour = hour;
f_minute = minute;
f_second = second;
f_isam = f_hour <= 12;
Draw(Bounds());
}
void
TTimeEdit::Update(tm *_tm)
{
if (f_hour != _tm->tm_hour
||f_minute != _tm->tm_min
||f_second != _tm->tm_sec)
{
SetTo(_tm->tm_hour, _tm->tm_min, _tm->tm_sec);
}
}
/*=====> TDateEdit <=====*/
const char *months[] =
{ "January", "Febuary", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" };
TDateEdit::TDateEdit(BRect frame, const char *name)
: TDateTimeEdit(frame, name)
{
BRect bounds(Bounds().InsetByCopy(1, 2));
float width;
// year rect
width = be_plain_font->StringWidth("0000") +8;
bounds.right = Bounds().right -(kArrowAreaWidth +2);
bounds.left = bounds.right -width;
f_yearrect = bounds;
// don't know how to determine system date sep char
float sep_width = be_plain_font->StringWidth("/") +4;
// day rect
//day is 2 digits 0 usually widest
width = be_plain_font->StringWidth("00") +4;
bounds.right = bounds.left -sep_width;
bounds.left = bounds.right -width;
f_dayrect = bounds;
//get september width (longest)
bounds.right = bounds.left -sep_width;
bounds.left = Bounds().left +2;
f_monthrect = bounds;
}
TDateEdit::~TDateEdit()
{ }
void
TDateEdit::MouseDown(BPoint where)
{
TDateTimeEdit::MouseDown(where);
if (f_monthrect.Contains(where))
{
f_focus = FOCUS_MONTH;
}
else
if (f_dayrect.Contains(where))
{
f_focus = FOCUS_DAY;
}
else
if (f_yearrect.Contains(where))
{
f_focus = FOCUS_YEAR;
}
else
f_focus = FOCUS_NONE;
Draw(Bounds());
}
void
TDateEdit::Draw(BRect updaterect)
{
TDateTimeEdit::Draw(Bounds());
SetHighColor(0, 0, 0, 255);
BRect bounds(Bounds());
BString text;
BPoint drawpt;
BPoint offset(0, f_monthrect.Height()/2.0 -6);
// seperator
BString septext("/");
float width;
rgb_color dark = tint_color(ViewColor(), B_DARKEN_1_TINT);
//draw month
if (updaterect.Contains(f_monthrect))
{
text << months[f_month];
width = be_plain_font->StringWidth(text.String());
offset.x = width +4;
drawpt = f_monthrect.RightBottom() -offset;
if (f_focus == FOCUS_MONTH)
SetLowColor(dark);
else
SetLowColor(ViewColor());
FillRect(f_monthrect, B_SOLID_LOW);
DrawString(text.String(), drawpt);
offset.x = -2;
SetLowColor(ViewColor());
DrawString(septext.String(), f_monthrect.RightBottom() -offset);
}
//draw day
if (updaterect.Contains(f_dayrect))
{
text = "";
text << f_day;
width = be_plain_font->StringWidth(text.String());
offset.x = -(f_dayrect.Width()/2.0 -width/2.0);
drawpt = f_dayrect.LeftBottom() -offset;
if (f_focus == FOCUS_DAY)
SetLowColor(dark);
else
SetLowColor(ViewColor());
FillRect(f_dayrect, B_SOLID_LOW);
DrawString(text.String(), drawpt);
offset.x = -2;
SetLowColor(ViewColor());
DrawString(septext.String(), f_dayrect.RightBottom() -offset);
}
//draw year
if (updaterect.Contains(f_yearrect))
{
text = "";
text << f_year +1900;
width = be_plain_font->StringWidth(text.String());
offset.x = -(f_yearrect.Width()/2.0 -width/2.0);
drawpt = f_yearrect.LeftBottom() -offset;
if (f_focus == FOCUS_YEAR)
SetLowColor(dark);
else
SetLowColor(ViewColor());
FillRect(f_yearrect, B_SOLID_LOW);
DrawString(text.String(), drawpt);
}
}
void
TDateEdit::UpPress()
{
switch(f_focus)
{
case FOCUS_MONTH:
f_month += 1;
Draw(f_monthrect);
break;
case FOCUS_DAY:
f_day += 1;
Draw(f_dayrect);
break;
case FOCUS_YEAR:
f_year += 1;
Draw(f_yearrect);
break;
default:
break;
}
}
void
TDateEdit::DownPress()
{
switch(f_focus)
{
case FOCUS_MONTH:
f_month -= 1;
Draw(f_monthrect);
break;
case FOCUS_DAY:
f_day -= 1;
Draw(f_dayrect);
break;
case FOCUS_YEAR:
f_year -= 1;
Draw(f_yearrect);
break;
default:
break;
}
}
void
TDateEdit::SetTo(int month, int day, int year)
{
f_month = month;
f_day = day;
f_year = year;
Draw(Bounds());
}
void
TDateEdit::Update(tm *_tm)
{
if (f_month != _tm->tm_mon
|| f_day != _tm->tm_mday
|| f_year != _tm->tm_year)
{
f_month = _tm->tm_mon;
f_day = _tm->tm_mday;
f_year = _tm->tm_year;
Draw(Bounds());
}
}

View File

@ -0,0 +1,94 @@
#ifndef DATETIME_EDIT_H
#define DATETIME_EDIT_H
#include <View.h>
#define OB_UP_PRESS 'obUP'
#define OB_DOWN_PRESS 'obDN'
enum FieldFocus
{
FOCUS_NONE,
FOCUS_MONTH,
FOCUS_DAY,
FOCUS_YEAR,
FOCUS_HOUR,
FOCUS_MINUTE,
FOCUS_SECOND,
FOCUS_AMPM
};
class TDateTimeEdit: public BView
{
public:
TDateTimeEdit(BRect frame, const char *name);
virtual ~TDateTimeEdit();
virtual void Draw(BRect updaterect);
virtual void AttachedToWindow();
virtual void MouseDown(BPoint where);
virtual void MakeFocus(bool focused);
virtual void UpPress();
virtual void DownPress();
protected:
virtual void Draw3dFrame(BRect frame, bool inset);
BBitmap *f_up;
BBitmap *f_down;
BRect f_uprect;
BRect f_downrect;
FieldFocus f_focus;
};
class TTimeEdit: public TDateTimeEdit
{
public:
TTimeEdit(BRect frame, const char *name);
virtual ~TTimeEdit();
virtual void Draw(BRect updaterect);
virtual void Update(tm *_tm);
virtual void MouseDown(BPoint where);
virtual void UpPress();
virtual void DownPress();
void SetTo(int hour, int minute, int second);
private:
BRect f_hourrect;
BRect f_minrect;
BRect f_secrect;
BRect f_aprect;
int f_hour;
int f_minute;
int f_second;
bool f_isam;
};
class TDateEdit: public TDateTimeEdit
{
public:
TDateEdit(BRect frame, const char *name);
virtual ~TDateEdit();
virtual void Draw(BRect updaterect);
virtual void MouseDown(BPoint where);
virtual void Update(tm *_tm);
virtual void UpPress();
virtual void DownPress();
void SetTo(int month, int day, int year);
private:
BRect f_monthrect;
BRect f_dayrect;
BRect f_yearrect;
int f_month;
int f_day;
int f_year;
};
#endif //DATETIME_EDIT_H

View File

@ -2,7 +2,6 @@ SubDir OBOS_TOP src prefs time ;
AddResources Time : Time.rsrc ;
Preference Time : SettingsView.cpp Time.cpp TimeSettings.cpp TimeView.cpp
TimeWindow.cpp ZoneView.cpp ;
Preference Time : Bitmaps.cpp BaseView.cpp DateTimeEdit.cpp CalendarView.cpp AnalogClock.cpp SettingsView.cpp Time.cpp TimeSettings.cpp TimeView.cpp TimeWindow.cpp ZoneView.cpp ;
LinkSharedOSLibs Time : be root ;

View File

@ -1,100 +1,215 @@
/*
SettingsView.cpp
*/
#ifndef _RADIO_BUTTON_H
#include <RadioButton.h>
#endif
#ifndef _STRING_VIEW_H
#include <StringView.h>
#endif
#ifndef _VIEW_H
#include <View.h>
#endif
////////
#ifndef SETTINGS_VIEW_H
#include <Box.h>
#include <String.h>
#include <RadioButton.h>
#include <AppDefs.h>
#include <Handler.h>
#include <stdio.h>
#include <Path.h>
#include <Entry.h>
#include <File.h>
#include <FindDirectory.h>
#include "SettingsView.h"
#endif
SettingsView::SettingsView(BRect frame):
BView(frame,"Settings",B_FOLLOW_ALL,B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP | B_PULSE_NEEDED)
{
buildView();
} //SettingsView::SettingsView()
#include "AnalogClock.h"
#include "CalendarView.h"
#include "TimeMessages.h"
TSettingsView::TSettingsView(BRect frame):
BView(frame,"Settings", B_FOLLOW_ALL,
B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE_JUMP|B_PULSE_NEEDED)
{
InitView();
} //SettingsView::SettingsView()
void
SettingsView:: buildView()
TSettingsView::AttachedToWindow()
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
if (Parent())
SetViewColor(Parent()->ViewColor());
}
void
TSettingsView::MessageReceived(BMessage *message)
{
int32 change;
switch(message->what)
{
case B_OBSERVER_NOTICE_CHANGE:
message->FindInt32(B_OBSERVE_WHAT_CHANGE, &change);
switch (change)
{
case OB_TIME_UPDATE:
{
UpdateDateTime(message);
break;
}
default:
BView::MessageReceived(message);
break;
}
break;
default:
BView::MessageReceived(message);
break;
}
}
void
TSettingsView::InitView()
{
ReadFiles();
//month/date/year
//BBox?
//BRect monthFrame(8.0, 1.0, 150.0, 20.0);
font_height finfo;
be_plain_font->GetHeight(&finfo);
float text_height = finfo.descent +finfo.ascent +finfo.leading;
BRect bounds(Bounds());
bounds.right = (bounds.Width()/2.0) -5;
BRect frame(bounds);
//the calender
// left side
frame.InsetBy(6, 6);
frame.bottom = frame.top +text_height +6;
f_dateedit = new TDateEdit(frame, "date_edit");
//hour/minute/second AM/PM
frame.top = f_dateedit->Frame().bottom;
frame.bottom = bounds.bottom;
frame.InsetBy(10, 8);
//the clock
f_calendar = new TCalendarView(frame, "calendar", B_FOLLOW_NONE, B_WILL_DRAW);
AddChild(f_dateedit);
AddChild(f_calendar);
//"Clock set to:"-label
BStringView *fClockSet;
// right side
bounds.OffsetBy(bounds.Width() +9, 0);
f_temp = bounds;
frame = bounds;
frame.InsetBy(26, 6);
frame.bottom = frame.top +text_height +6;
frame.right += 4;
f_timeedit = new TTimeEdit(frame, "time_edit");
const char *clockset= "Clock set to: ";
float csLength= be_plain_font->StringWidth(clockset);
BRect clockSetframe(178.0, 147.0, 178.0+csLength, 157.0);
fClockSet= new BStringView(clockSetframe, "clockset", clockset);
AddChild(fClockSet);
frame.top = f_timeedit->Frame().bottom;
frame.bottom = bounds.bottom -(text_height *3);
frame.InsetBy(10, 10);
f_clock = new TAnalogClock(frame, "analog clock",
B_FOLLOW_NONE, B_WILL_DRAW);
//the radiobuttons..
//local time
BRadioButton *locButton;
BRect locFrame(247.0, 144.0, 324.0, 154.0);
locButton= new BRadioButton(locFrame,"loc", "Local time", NULL);
AddChild(locButton);
//GMT
BRadioButton *gmtButton;
BRect gmtFrame(247.0, 160.0, 324.0, 170.0);
gmtButton= new BRadioButton(gmtFrame,"gmt", "GMT", NULL);
AddChild(gmtButton);
// clock radio buttons
frame = bounds.InsetByCopy(6, 10);
frame.top = f_clock->Frame().bottom +12;
frame.bottom = frame.top +text_height +2;
BString label = "Clock set to:";
float width = be_plain_font->StringWidth(label.String());
frame.right = frame.left +width;
BStringView *text = new BStringView(frame, "clockis", "Clock set to:");
frame.OffsetBy(frame.Width() +9, -1);
frame.right = bounds.right-2;
f_local = new BRadioButton(frame, "local", "Local time", NULL);
AddChild(f_local);
frame.OffsetBy(0, text_height +4);
f_gmt = new BRadioButton(frame, "gmt", "GMT", NULL);
AddChild(f_gmt);
AddChild(text);
AddChild(f_timeedit);
AddChild(f_clock);
f_clock->SetViewColor(200, 20, 200);
if (f_islocal)
f_local->SetValue(1);
else
f_gmt->SetValue(1);
}//SettingsView::buildView()
void
SettingsView::changeRTCSetting()
TSettingsView::Draw(BRect frame)
{
/*
edit file "RTC_time_settings" in B_USER_SETTINGS_DIRECTORY
if GMT is set, file reads "GMT", if set to local time, file reads "local"
If no such file exists, create one!
if(file_exists){
open file
read file
if content != msgstring
change content
}
else
create file RTC_time_settings
write string from msg to file
*/
}//SettingsView::changeRTCSetting()
void
SettingsView::Draw(BRect frame)
{
//inherited::Draw(updateFrame);
//draw a separator line
rgb_color black= {0,0,0,255};
SetLowColor(black);
BRect bounds(Bounds());
BPoint start(160.0, 5.0);
BPoint end(160.0, 175.0);
StrokeLine(start, end, B_SOLID_LOW);
rgb_color viewcolor = ViewColor();
rgb_color dark = tint_color(viewcolor, B_DARKEN_4_TINT);
rgb_color light = tint_color(viewcolor, B_LIGHTEN_MAX_TINT);
BPoint start(bounds.Width()/2.0 +2.0, bounds.top +1);
BPoint end(bounds.Width()/2.0 +2.0, bounds.bottom -1);
BeginLineArray(2);
AddLine(start, end, dark);
start.x++;
end.x++;
AddLine(start, end, light);
EndLineArray();
}//SettingsView::Draw(BRect frame)
void
TSettingsView::UpdateDateTime(BMessage *message)
{
struct tm *ltime;
message->FindPointer("_tm_", (void **)&ltime);
f_timeedit->Update(ltime);
f_clock->Update(ltime);
f_dateedit->Update(ltime);
f_calendar->Update(ltime);
}
void
TSettingsView::ReadFiles()
{
// do all file reading here
// read RTC_time_settings
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
{
return; // NO USER SETTINGS DIRECTORY!!!
}
path.Append("RTC_time_settings");
BEntry entry(path.Path());
BFile file;
if (entry.Exists())
{
//read file
file.SetTo(&entry, B_READ_ONLY);
status_t err = file.InitCheck();
if (err == B_OK)
{
char buff[6];
file.Read(buff, 6);
BString text;
text << buff;
if (text.Compare("local\n", 5) == 0)
f_islocal = true;
else
f_islocal = false;
printf("f_islocal >> (BS)%s, (BF)%s\n", text.String(), buff);
}
}
else
{
// create set to local
f_islocal = true;
file.SetTo(&entry, B_CREATE_FILE|B_READ_WRITE);
file.Write("local\n", 6);
}
// done reading RTC_time_settings
}

View File

@ -10,17 +10,32 @@
#include <View.h>
#endif
class SettingsView : public BView
#include "CalendarView.h"
#include "AnalogClock.h"
#include "DateTimeEdit.h"
class TSettingsView:public BView
{
public:
SettingsView(BRect frame);
virtual void Draw(BRect frame);
void changeRTCSetting();
public:
TSettingsView(BRect frame);
virtual void AttachedToWindow();
virtual void Draw(BRect frame);
virtual void MessageReceived(BMessage *message);
private:
void buildView();
void ChangeRTCSetting();
private:
void InitView();
void ReadFiles(); // reads RTC_time_settings
void UpdateDateTime(BMessage *message);
BRect f_temp;
BRadioButton *f_local;
BRadioButton *f_gmt;
TDateEdit *f_dateedit;
TTimeEdit *f_timeedit;
TCalendarView *f_calendar;
TAnalogClock *f_clock;
bool f_islocal; // local or gmt?
};
#endif

View File

@ -8,31 +8,31 @@
#include <Screen.h>
#include "Time.h"
#include "TimeWindow.h"
#include "TimeSettings.h"
#include "TimeMessages.h"
const char TimeApplication::kTimeApplicationSig[] = "application/x-vnd.OpenBeOS-TIME";
#define OBOS_APP_SIGNATURE "application/x-vnd.OpenBeOS-TIME"
int main(int, char**)
int main()
{
TimeApplication myApplication;
new TimeApplication();
myApplication.Run();
be_app->Run();
delete be_app;
return(0);
}
TimeApplication::TimeApplication()
:BApplication(kTimeApplicationSig)
:BApplication(OBOS_APP_SIGNATURE)
{
f_settings = new TimeSettings();
f_window = new TTimeWindow();
}
TimeWindow *window;
fSettings = new TimeSettings();
window = new TimeWindow();
TimeApplication::~TimeApplication()
{
delete f_settings;
}
void
@ -53,21 +53,19 @@ TimeApplication::MessageReceived(BMessage *message)
}
void
TimeApplication::SetWindowCorner(BPoint corner)
TimeApplication::ReadyToRun(void)
{
fSettings->SetWindowCorner(corner);
f_window->Show();
}
void
TimeApplication::AboutRequested(void)
{
(new BAlert("about", "...by Andrew Edward McCall", "Dig Deal"))->Go();
(new BAlert("about", "...by Andrew Edward McCall\n...Mike Berg too", "Big Deal"))->Go();
}
TimeApplication::~TimeApplication()
void
TimeApplication::SetWindowCorner(BPoint corner)
{
delete fSettings;
f_settings->SetWindowCorner(corner);
}

View File

@ -13,19 +13,15 @@ public:
virtual ~TimeApplication();
void MessageReceived(BMessage *message);
BPoint WindowCorner() const {return fSettings->WindowCorner(); }
void SetWindowCorner(BPoint corner);
void ReadyToRun(void);
void AboutRequested(void);
void SetWindowCorner(BPoint corner);
BPoint WindowCorner() const { return f_settings->WindowCorner(); }
private:
static const char kTimeApplicationSig[];
TimeSettings *fSettings;
TimeSettings* f_settings;
TTimeWindow* f_window;
};
#endif
#endif //TIME_H

View File

@ -24,7 +24,6 @@ const uint32 SET_TIME_ZONE ='SEti';
//local and GMT settings
const uint32 RTC_SETTINGS ='RTse';
const uint32 OB_TIME_UPDATE ='obTU';
#endif //TIME_MESSAGES_H

View File

@ -61,5 +61,3 @@ TimeSettings::SetWindowCorner(BPoint corner)
{
fCorner=corner;
}

View File

@ -17,6 +17,6 @@ private:
};
#endif
#endif //TIME_SETTINGS_H_

View File

@ -12,7 +12,7 @@
TimeView::TimeView(BRect rect)
: BBox(rect, "time_view",
B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
B_FOLLOW_ALL, B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
B_PLAIN_BORDER)
{
BTabView *fTabView;
@ -24,12 +24,13 @@ TimeView::TimeView(BRect rect)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
frame = Bounds();
frame.top = 100;
fTabView = new BTabView(frame,"tab_view");
// Settings Tab...
fTab = new BTab();
fView = new BView(BRect(fTabView->Bounds()),"settings_view",B_FOLLOW_ALL,
fView = new BView(BRect(fTabView->Bounds().InsetByCopy(10, 10)),"settings_view",B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP);
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTabView->AddTab(fView,fTab);
@ -37,7 +38,7 @@ TimeView::TimeView(BRect rect)
// Time Zone Tab...
fTab = new BTab();
fView = new BView(BRect(fTabView->Bounds()),"time_zone_view",B_FOLLOW_ALL,
fView = new BView(BRect(fTabView->Bounds().InsetByCopy(10, 10)),"time_zone_view",B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP);
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTabView->AddTab(fView,fTab);

View File

@ -18,8 +18,6 @@ public:
TimeView(BRect frame);
virtual void Draw(BRect frame);
private:
;
};
#endif

View File

@ -1,5 +1,5 @@
/*
* TimeWindow.cpp
* TTimeWindow.cpp
* Time mccall@@digitalparadise.co.uk
*
*/
@ -9,19 +9,21 @@
#include <Screen.h>
#include <TabView.h>
#include <stdio.h>
#include "TimeMessages.h"
#include "TimeWindow.h"
#include "TimeView.h"
#include "Time.h"
#include "BaseView.h"
#define TIME_WINDOW_RIGHT 332
#define TIME_WINDOW_BOTTTOM 208
#define TIME_WINDOW_RIGHT 361 //332
#define TIME_WINDOW_BOTTOM 227 //208
TimeWindow::TimeWindow()
: BWindow(BRect(0,0,TIME_WINDOW_RIGHT,TIME_WINDOW_BOTTTOM), "Time & Date", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE )
TTimeWindow::TTimeWindow()
: BWindow(BRect(0,0,TIME_WINDOW_RIGHT,TIME_WINDOW_BOTTOM), "Time & Date", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE )
{
BScreen screen;
//BSlider *slider=NULL;
MoveTo(dynamic_cast<TimeApplication *>(be_app)->WindowCorner());
@ -29,71 +31,83 @@ TimeWindow::TimeWindow()
if (!(screen.Frame().right >= Frame().right && screen.Frame().bottom >= Frame().bottom))
MoveTo((screen.Frame().right-Bounds().right)*.5,(screen.Frame().bottom-Bounds().bottom)*.5);
BuildViews();
SetPulseRate(500000); //pulse rate. Mattias Sundblad
Show();
InitWindow();
SetPulseRate(500000);
}
}//TimeWindow::TimeWindow()
TTimeWindow::~TTimeWindow()
{ /* empty */ }
void TimeWindow::BuildViews()
{
BRect viewRect= Bounds();
//the views:
fTimeSettings = new SettingsView(viewRect);
fTimeZones = new ZoneView(viewRect);
//The tabs:
BTabView *fTabView;
BTab *fTab;
fTabView = new BTabView(viewRect, "tab_view");
// Settings Tab;
fTab = new BTab();
fTabView -> AddTab(fTimeSettings,fTab);
fTab -> SetLabel("Settings");
//Time zone tab:
fTab = new BTab();
fTabView -> AddTab(fTimeZones,fTab);
fTab -> SetLabel("Time Zone");
AddChild(fTabView);
}//TimeWindow::BuildViews()
bool TimeWindow::QuitRequested()
{
dynamic_cast<TimeApplication *>(be_app)->SetWindowCorner(BPoint(Frame().left,Frame().top));
be_app->PostMessage(B_QUIT_REQUESTED);
return(true);
} //TimeWindow::QuitRequested()
void TimeWindow::MessageReceived(BMessage *message)
void
TTimeWindow::MessageReceived(BMessage *message)
{
switch(message->what) {
case REGION_CHANGED:
fTimeZones -> ChangeRegion(message);
fTimeZones->ChangeRegion(message);
break;
case SET_TIME_ZONE:
fTimeZones -> setTimeZone();
fTimeZones->SetTimeZone();
break;
case TIME_ZONE_CHANGED:
fTimeZones -> newTimeZone();
fTimeZones->NewTimeZone();
break;
default:
BWindow::MessageReceived(message);
break;
}
}//TimeWindow::MessageReceived(BMessage *message)
}//TTimeWindow::MessageReceived(BMessage *message)
TimeWindow::~TimeWindow()
bool
TTimeWindow::QuitRequested()
{
dynamic_cast<TimeApplication *>(be_app)->SetWindowCorner(BPoint(Frame().left,Frame().top));
f_BaseView->StopWatchingAll(fTimeSettings);
f_BaseView->StopWatchingAll(fTimeZones);
be_app->PostMessage(B_QUIT_REQUESTED);
return(true);
} //TTimeWindow::QuitRequested()
}//TimeWindow::~TimeWindow()
void
TTimeWindow::InitWindow()
{
BRect bounds(Bounds());
f_BaseView = new TTimeBaseView(bounds, "background view");
f_BaseView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(f_BaseView);
bounds.top = 9;
BTabView *tabview = new BTabView(bounds, "tab_view");
bounds = tabview->Bounds();
bounds.InsetBy(4, 6);
bounds.bottom -= tabview->TabHeight();
fTimeSettings = new TSettingsView(bounds);
if (f_BaseView->StartWatchingAll(fTimeSettings) != B_OK)
printf("StartWatchingAll(TimeSettings) failed!!!");
fTimeZones = new TZoneView(bounds);
if (f_BaseView->StartWatchingAll(fTimeZones) != B_OK)
printf("TimeZones->StartWatchingAll(TimeZone) failed!!!");
// add tabs
BTab *tab;
tab = new BTab();
tabview->AddTab(fTimeSettings, tab);
tab->SetLabel("Settings");
tab = new BTab();
tabview->AddTab(fTimeZones, tab);
tab->SetLabel("Time Zone");
f_BaseView->AddChild(tabview);
f_BaseView->Pulse();
}//TTimeWindow::BuildViews()

View File

@ -7,21 +7,24 @@
#include "SettingsView.h"
#include "TimeSettings.h"
#include "ZoneView.h"
#include "BaseView.h"
class TimeWindow : public BWindow
class TTimeWindow : public BWindow
{
public:
TimeWindow();
~TimeWindow();
public:
TTimeWindow();
~TTimeWindow();
bool QuitRequested();
void MessageReceived(BMessage *message);
void BuildViews();
private:
SettingsView *fTimeSettings;
ZoneView *fTimeZones;
bool QuitRequested();
void MessageReceived(BMessage *message);
private:
void InitWindow();
private:
TTimeBaseView *f_BaseView;
TSettingsView *fTimeSettings;
TZoneView *fTimeZones;
};
#endif

View File

@ -1,267 +1,415 @@
/*
ZoneView.cpp
TZoneView.cpp
*/
#include <AppDefs.h>
#include <Button.h>
#include <Directory.h>
#include <Entry.h>
#include <FindDirectory.h>
#include <Directory.h>
#include <Handler.h>
#include <ListItem.h>
#include <ListView.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <MenuBar.h>
#include <Path.h>
#include <PopUpMenu.h>
#include <ScrollView.h>
#include <string.h>
#include <String.h>
#include <StringView.h>
#include <time.h>
#include <View.h>
#include <stdio.h>
#include <time.h>
#include "TimeMessages.h"
#include "ZoneView.h"
ZoneView::ZoneView(BRect frame):
BView(frame,"",B_FOLLOW_ALL,B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP | B_PULSE_NEEDED)
{
buildView();
} //ZoneView::ZoneView()
void
ZoneView:: buildView()
/*=====> TZoneItem <=====*/
TZoneItem::TZoneItem(const char *text, const char *zonedata)
: BStringItem(text)
{
f_zonedata = new BPath(zonedata);
}
TZoneItem::~TZoneItem()
{
//viewcolor
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
//BMenuField with BPopUpMenu for the timezones.
//The box...
BRect boxrect(8.0, 1.0, 157.0, 20.0);
//popup menu
fZonePopUp = new BPopUpMenu("",true, true, B_ITEMS_IN_COLUMN);
//Menufield..
BMenuField *mField;
mField= new BMenuField(boxrect, "mfield", NULL, fZonePopUp, true, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
AddChild(mField);
//Adding listview. Matsu
BRect flistframe(10.0, 25.0, 140.0, 170.0);
//BListView *fCityList; to header
fCityList= new BListView(flistframe,"cities", B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS);
//selectionmessage
BMessage *cityChange = new BMessage(TIME_ZONE_CHANGED);
fCityList -> SetSelectionMessage(cityChange);
//place listview in a scrollview. matsu
BScrollView *scrollList;
scrollList = new BScrollView("scroll_list", fCityList, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true);
AddChild(scrollList);
//adding menuitems
BMenuItem *zoneItem;
BMessage *zoneMessage;
zoneItem= new BMenuItem("Africa", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Africa");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Antarctica", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Antarctica");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Arctic", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Arctic");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Asia", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Asia");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Atlantic Ocean", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Atlantic");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Australia", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Australia");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Europe", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Europe");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Greenland", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Greenland");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Indian Ocean", zoneMessage= new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Indian");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("North and Central America", zoneMessage= new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "North_and_Central_America");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("Pacific Ocean", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "Pacific");
fZonePopUp -> AddItem(zoneItem);
zoneItem= new BMenuItem("South America", zoneMessage = new BMessage(REGION_CHANGED));
zoneMessage -> AddString("region", "South_America");
fZonePopUp -> AddItem(zoneItem);
//label #1
BStringView *fCurrent;
const char *current= "Current time zone:";
float length = be_plain_font -> StringWidth(current);
BRect currframe(168.0, 43.0, 168.0+length, 53.0);
fCurrent = new BStringView(currframe, "current", current);
AddChild(fCurrent);
//label #2
BStringView *fTimeIn;
const char *timeIn= "Time in:";
float timeLength;
timeLength = be_plain_font -> StringWidth(timeIn);
BRect timeFrame(168.0, 87.0, 168.0+timeLength, 97.0);
fTimeIn= new BStringView(timeFrame, "time", timeIn);
AddChild(fTimeIn);
//The "Set" button:
BRect buttonFrame(247.0, 155.0, 324.0, 165.0);
fSetTimeZone = new BButton(buttonFrame, "set", "Set", new BMessage(SET_TIME_ZONE));
fSetTimeZone -> SetEnabled(false);
AddChild(fSetTimeZone);
//current time zone
getCurrentTZ();
}//ZoneView::buildView()
delete f_zonedata;
}
const char *
TZoneItem::GetZone() const
{
return f_zonedata->Path();
}
/*=====> TZoneView <=====*/
TZoneView::TZoneView(BRect frame)
: BView(frame,"",B_FOLLOW_ALL,
B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE_JUMP)
, f_citylist(NULL)
{
InitView();
} //TZoneView::TZoneView()
void
ZoneView::ChangeRegion(BMessage *message)
TZoneView::AttachedToWindow()
{
if (Parent())
SetViewColor(Parent()->ViewColor());
}
void
TZoneView::MessageReceived(BMessage *message)
{
int32 change;
switch(message->what)
{
case B_OBSERVER_NOTICE_CHANGE:
message->FindInt32(B_OBSERVE_WHAT_CHANGE, &change);
switch (change)
{
case OB_TIME_UPDATE:
{
UpdateDateTime(message);
break;
}
default:
BView::MessageReceived(message);
break;
}
break;
default:
BView::MessageReceived(message);
break;
}
}
void
TZoneView:: InitView()
{
font_height finfo;
be_plain_font->GetHeight(&finfo);
float text_height = finfo.ascent +finfo.descent +finfo.leading;
GetCurrentRegion();
BRect bounds(Bounds().InsetByCopy(4, 2));
BRect frame(bounds);
// Zone menu
f_zonepopup = new BPopUpMenu("", true, true, B_ITEMS_IN_COLUMN);
float widest = 0;
CreateZoneMenu(&widest);
frame.right = frame.left +widest +25;
frame.bottom = frame.top +text_height;
BMenuField *mField;
mField= new BMenuField(frame, "mfield", NULL, f_zonepopup, true);
mField->MenuBar()->SetBorder(B_BORDER_CONTENTS);
mField->MenuBar()->ResizeToPreferred();
AddChild(mField);
// City Listing
frame = mField->MenuBar()->Frame();
frame.top += frame.bottom +1;
frame.right = mField->Bounds().Width() -B_V_SCROLL_BAR_WIDTH +2;
frame.bottom = bounds.bottom;
frame.OffsetBy(2, 0);
frame.InsetBy(3, 5);
f_citylist = new BListView(frame, "cities", B_SINGLE_SELECTION_LIST,
B_FOLLOW_LEFT|B_FOLLOW_TOP,
B_WILL_DRAW|B_NAVIGABLE|B_FRAME_EVENTS);
BMessage *citychange = new BMessage(TIME_ZONE_CHANGED);
f_citylist->SetSelectionMessage(citychange);
BScrollView *scrollList;
scrollList = new BScrollView("scroll_list", f_citylist,
B_FOLLOW_LEFT|B_FOLLOW_TOP,
0, false, true);
AddChild(scrollList);
// Time displays
BStringView *displaytext;
BString labels = "Current time zone:";
frame.OffsetBy(scrollList->Bounds().Width() +9, 2);
frame.bottom = frame.top +text_height;
displaytext = new BStringView(frame, "current", labels.String());
AddChild(displaytext);
float oldleft = frame.left;
float width = be_plain_font->StringWidth("00:00 PM") +8;
frame.OffsetBy(0, text_height +2);
frame.right = bounds.right -(width +4);
f_curtext = new BStringView(frame, "currenttext", "Current time display");
frame.right = bounds.right;
frame.left = frame.right -width;
f_curtime = new BStringView(frame, "currenttime", "cTIME");
f_curtime->SetAlignment(B_ALIGN_RIGHT);
AddChild(f_curtext);
AddChild(f_curtime);
labels = "Time in:";
frame.OffsetTo(oldleft, frame.top +text_height *2);
displaytext = new BStringView(frame, "timein", labels.String());
AddChild(displaytext);
frame.OffsetBy(0, text_height +2);
frame.right = bounds.right - (width -2);
frame.bottom = frame.top +text_height;
f_seltext = new BStringView(frame, "selectedtext", "Selected time display");
frame.right = bounds.right;
frame.left = bounds.right -width;
f_seltime = new BStringView(frame, "selectedtime", "sTIME");
f_seltime->SetAlignment(B_ALIGN_RIGHT);
AddChild(f_seltext);
AddChild(f_seltime);
// set button
frame.Set(bounds.right -75, bounds.bottom -24,
bounds.right, bounds.bottom);
frame.OffsetBy(-2, -2);
f_settimezone = new BButton(frame, "set", "Set", new BMessage(SET_TIME_ZONE));
f_settimezone->SetEnabled(false);
AddChild(f_settimezone);
// update displays
FillZoneList(f_RegionStr.Leaf());
UpdateTimeDisplay(OB_CURRENT_TIME);
}
void
TZoneView::CreateZoneMenu(float *widest)
{
BPath path;
// return if /etc directory is not found
if (!(find_directory(B_BEOS_ETC_DIRECTORY, &path) == B_OK))
return;
path.Append("timezones");
float width = 0;
bool markitem;
BEntry entry;
BMenuItem *zoneItem;
BDirectory dir(path.Path());
dir.Rewind();
// walk timezones dir and add entries to menu
BString itemtext;
while (dir.GetNextEntry(&entry) == B_NO_ERROR)
{
if (entry.IsDirectory())
{
path.SetTo(&entry);
itemtext = path.Leaf();
if (itemtext.Compare("Etc", 3) == 0)
continue;
// add Ocean to oceans :)
markitem = itemtext.Compare(f_RegionStr.Leaf()) == 0;
itemtext = itemtext.ReplaceAll('_', ' ');
width = be_plain_font->StringWidth(itemtext.String());
if (width> *widest) *widest = width;
BMessage *zoneMessage = new BMessage(REGION_CHANGED);
zoneMessage->AddString("region", path.Leaf());
zoneItem = new BMenuItem(itemtext.String(), zoneMessage);
zoneItem->SetMarked(markitem);
f_zonepopup->AddItem(zoneItem);
}
}
}
void
TZoneView::ChangeRegion(BMessage *message)
{
//First: get the region name from the message:
const char *area;
message -> FindString("region",&area);
message->FindString("region", &area);
FillZoneList(area);
}
void
TZoneView::FillZoneList(const char *area)
{
//clear listview from previous items
fCityList -> MakeEmpty();
f_citylist->MakeEmpty();
//Enter time zones directory. Find subdir with name that matches string stored in area.
//Enter subdirectory and count the items. For each item, add a StringItem to fCityList
//Enter subdirectory and count the items. For each item, add a StringItem to f_CityList
//Time zones directory
BDirectory zoneDir("/boot/beos/etc/timezones/");
BDirectory cityDir;
BStringItem *city;
BString city_name;
entry_ref ref;
//locate subdirectory:
if ( zoneDir.Contains(area, B_DIRECTORY_NODE) ){
if ( zoneDir.Contains(area, B_DIRECTORY_NODE) )
{
cityDir.SetTo(&zoneDir, area); //There is a subdir with a name that matches 'area'. That's the one!!
//iterate over the items in the subdir and fill the listview with stringitems:
while(cityDir.GetNextRef(&ref) == B_NO_ERROR){
city = new BStringItem(ref.name);
fCityList -> AddItem(city);
//iterate over the items in the subdir and fill the listview with TZoneItems:
while(cityDir.GetNextRef(&ref) == B_NO_ERROR)
{
city_name = ref.name;
city_name.ReplaceAll("__", ", ");
city_name.ReplaceAll("_", " ");
city = new TZoneItem(city_name.String(), ref.name);
f_citylist->AddItem(city);
}
}
}
}//ZoneView::ChangeRegion()
void
ZoneView::getCurrentTime()
TZoneView::UpdateDateTime(BMessage *message)
{
char tmp[10];
struct tm locTime;
time_t current;
current= time(0);
locTime= *localtime(&current);
strftime(tmp, 10, "%I:%M %p", &locTime);
strcpy(fTimeStr, tmp);
//strftime(tmp, 10, "%z", &locTime);
//strcpy(fZoneStr,tmp);
}//ZoneView::getCurrentTime()
struct tm *ltime;
if (message->FindPointer("_tm_", (void **)&ltime) == B_OK)
{
if (f_hour != ltime->tm_hour || f_minutes != ltime->tm_min)
{
f_hour = ltime->tm_hour;
f_minutes = ltime->tm_min;
Update();
}
}
}
void
ZoneView::getCurrentTZ()
TZoneView::Update()
{
BString text;
if (f_hour -12 < 10)
text << "0";
text << f_hour-12 << ":";
if (f_minutes < 10)
text << "0";
text << f_minutes << " ";
if (f_hour> 12)
text << "PM";
else
text << "AM";
f_curtime->SetText(text.String());
}
void
TZoneView::GetCurrentTZ()
{
BPath path;
BEntry tzLink;
char buffer[B_FILE_NAME_LENGTH];
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK){
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK)
{
path.Append("timezone");
tzLink.SetTo(path.Path(), true);
tzLink.GetName(buffer);
strcpy(fZoneStr, buffer);
if (!tzLink.InitCheck()) // link is broken
{
// do something like set to a default GMT???
// return;
}
}
else
{
// set tzlink to default
}
// we need something in the current zone
f_ZoneStr.SetTo(&tzLink);
}//ZoneView::getCurrentTz()
}//TZoneView::getCurrentTz()
void
ZoneView::Draw(BRect rect)
TZoneView::GetCurrentRegion()
{
GetCurrentTZ();
BPoint tZone(170.0, 65.0);
BPoint tTime(280.0, 65.0);
//BPoint bZone(170.0, 107.0);
//BPoint bTime(280.0, 107.0);
SetHighColor(ViewColor());
SetLowColor(ViewColor());
FillRect(Bounds());
SetHighColor(0,0,0,255);
DrawString(fZoneStr, tZone);
DrawString(fTimeStr, tTime);
//DrawString(fZoneStr, bZone);
//DrawString(fTimeStr, bTime);
}//ZoneView:: Draw()
f_ZoneStr.GetParent(&f_RegionStr);
}
void
ZoneView::Pulse()
TZoneView::NewTimeZone()
{
getCurrentTime();
Draw(Bounds());
}//ZoneView:: Pulse()
UpdateTimeDisplay(OB_SELECTION_TIME);
}//TZoneView::newTimeZone()
void
ZoneView::newTimeZone()
{
int32 selection;
BStringItem *item;
const char *text;
selection = fCityList -> CurrentSelection();
item = (BStringItem *)fCityList -> ItemAt(selection);
text = item -> Text();
strcpy(fZoneStr, text);
Draw(Bounds());
fSetTimeZone -> SetEnabled(true);
}//ZoneView::newTimeZone()
void
ZoneView::setTimeZone()
TZoneView::SetTimeZone()
{
/*
set time based on supplied timezone. How to do this?
replace symlink, "timezone", in B_USER_SETTINGS_DIR with a link to the new timezone
*/
fSetTimeZone -> SetEnabled(false);
} //ZoneView::setTimeZone()
f_settimezone -> SetEnabled(false);
} //TZoneView::setTimeZone()
void
TZoneView::UpdateTimeDisplay(OB_TIME_TARGET target)
{
switch (target)
{
case OB_CURRENT_TIME:
{
BString text(f_ZoneStr.Leaf());
text.ReplaceAll("_", " ");
f_curtext->SetText(text.String());
Draw(Bounds());
}
break;
case OB_SELECTION_TIME:
{
BString text;
int32 selection = f_citylist->CurrentSelection();
text = ((TZoneItem *)f_citylist->ItemAt(selection))->Text();
f_seltext->SetText(text.String());
}
break;
default:
break;
}
}

View File

@ -1,31 +1,70 @@
/*
ZoneView.h
TZoneView.h
*/
#ifndef ZONE_VIEW_H
#define ZONE_VIEW_H
class ZoneView : public BView
#include <Path.h>
#include <String.h>
#include <ListItem.h>
enum OB_TIME_TARGET
{
public:
ZoneView(BRect frame);
void ChangeRegion(BMessage *region);
void setTimeZone();
void newTimeZone();
virtual void Pulse();
virtual void Draw(BRect updateRect);
private:
void buildView();
void getCurrentTime();
void getCurrentTZ();
OB_CURRENT_TIME,
OB_SELECTION_TIME
};
class TZoneItem: public BStringItem
{
public:
TZoneItem(const char *text, const char *zonedata);
virtual ~TZoneItem();
BPopUpMenu *fZonePopUp;
BListView *fCityList;
BButton *fSetTimeZone;
char fTimeStr[10];
char fZoneStr[B_FILE_NAME_LENGTH];
const char *GetZone() const;
private:
BPath *f_zonedata;
};
class TZoneView : public BView
{
public:
TZoneView(BRect frame);
virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message);
void ChangeRegion(BMessage *region);
void SetTimeZone();
void NewTimeZone();
private:
void InitView();
void GetCurrentTZ();
void GetCurrentRegion();
void FillZoneList(const char *area);
void CreateZoneMenu(float *widest);
void Update();
void UpdateTimeDisplay(OB_TIME_TARGET target);
void UpdateDateTime(BMessage *message);
private:
BPopUpMenu *f_zonepopup;
BListView *f_citylist;
BButton *f_settimezone;
BStringView *f_seltext;
BStringView *f_seltime;
BStringView *f_curtext;
BStringView *f_curtime;
private:
BString f_CurrentTime;
BPath f_ZoneStr;
BPath f_RegionStr;
int f_hour;
int f_minutes;
char f_TimeStr[10];
};
#endif

9
src/prefs/time/hierarchy Normal file
View File

@ -0,0 +1,9 @@
Time --
TimeWindow
-- TimeBaseView
-- SettingsView
-- TDateEdit
-- TTimeEdit
-- TCalendarView
-- TAnalogClock
-- ZoneView