* fixed bug #1554, it seems my patch didn't make it in completely even after several trials
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22560 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
20674e3150
commit
0c13f74dfb
@ -369,3 +369,4 @@ TOnscreenView::MessageReceived(BMessage *msg)
|
||||
BView::MessageReceived(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,3 +73,4 @@ class TOnscreenView : public BView {
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -4,26 +4,24 @@
|
||||
*/
|
||||
|
||||
#include "cl_wind.h"
|
||||
#include "cl_view.h"
|
||||
|
||||
#include <Application.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Path.h>
|
||||
#include <string.h>
|
||||
#include <Screen.h>
|
||||
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <Debug.h>
|
||||
|
||||
#include "cl_view.h"
|
||||
|
||||
|
||||
TClockWindow::TClockWindow(BRect frame, const char* title)
|
||||
: BWindow(frame, title, B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT, B_ALL_WORKSPACES)
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT, B_ALL_WORKSPACES),
|
||||
fOnScreenView(NULL)
|
||||
{
|
||||
SetPulseRate(500000);
|
||||
// half second pulse rate
|
||||
_InitWindow();
|
||||
}
|
||||
|
||||
|
||||
@ -42,9 +40,9 @@ TClockWindow::QuitRequested()
|
||||
if (ref >= 0) {
|
||||
BPoint lefttop = Frame().LeftTop();
|
||||
write(ref, (char *)&lefttop, sizeof(BPoint));
|
||||
short face = theOnscreenView->ReturnFace();
|
||||
short face = fOnScreenView->ReturnFace();
|
||||
write(ref, (char *)&face, sizeof(short));
|
||||
bool seconds = theOnscreenView->ReturnSeconds();
|
||||
bool seconds = fOnScreenView->ReturnSeconds();
|
||||
write(ref, (char *)&seconds, sizeof(bool));
|
||||
close(ref);
|
||||
}
|
||||
@ -52,3 +50,45 @@ TClockWindow::QuitRequested()
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TClockWindow::_InitWindow()
|
||||
{
|
||||
// half second pulse rate
|
||||
SetPulseRate(500000);
|
||||
|
||||
fOnScreenView = new TOnscreenView(BRect(0, 0, 82, 82), "Clock", 22, 15, 41);
|
||||
AddChild(fOnScreenView);
|
||||
|
||||
int ref;
|
||||
BPath path;
|
||||
if (find_directory (B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||
path.Append("Clock_settings");
|
||||
ref = open(path.Path(), O_RDONLY);
|
||||
if (ref >= 0) {
|
||||
BPoint leftTop;
|
||||
read(ref, (char*)&leftTop, sizeof(leftTop));
|
||||
|
||||
short face;
|
||||
read(ref, (char *)&face, sizeof(short));
|
||||
fOnScreenView->UseFace(face);
|
||||
|
||||
bool secs;
|
||||
read(ref, (char *)&secs, sizeof(bool));
|
||||
fOnScreenView->ShowSecs(secs);
|
||||
|
||||
close(ref);
|
||||
|
||||
MoveTo(leftTop);
|
||||
|
||||
BRect frame = Frame();
|
||||
frame.InsetBy(-4, -4);
|
||||
// it's not visible so reposition. I'm not going to get
|
||||
// fancy here, just place in the default location
|
||||
if (!frame.Intersects(BScreen(this).Frame()))
|
||||
MoveTo(100, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,8 @@ class TClockWindow : public BWindow {
|
||||
void _InitWindow();
|
||||
|
||||
private:
|
||||
TOnscreenView *theOnscreenView;
|
||||
TOnscreenView *fOnScreenView;
|
||||
};
|
||||
|
||||
#endif // _CLOCK_WINDOW_H
|
||||
|
||||
|
@ -43,3 +43,4 @@ main(int argc, char* argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -29,3 +29,4 @@ extern const char *kAppSignature;
|
||||
|
||||
|
||||
#endif // _CLOCK_APPLICATION_H
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user