Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fehlersuche_U7
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Gräbner
Fehlersuche_U7
Commits
54543cf2
Commit
54543cf2
authored
18 years ago
by
siflfran
Browse files
Options
Downloads
Patches
Plain Diff
draw_dial() neu implementiert
parent
ecff83ee
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
01_git/astime_x.c
+104
-171
104 additions, 171 deletions
01_git/astime_x.c
01_git/autoconf/Makefile.defines.in
+2
-2
2 additions, 2 deletions
01_git/autoconf/Makefile.defines.in
01_git/beo.astimerc
+1
-1
1 addition, 1 deletion
01_git/beo.astimerc
with
107 additions
and
174 deletions
01_git/astime_x.c
+
104
−
171
View file @
54543cf2
...
@@ -117,8 +117,13 @@ void draw_sunriset(Window win,
...
@@ -117,8 +117,13 @@ void draw_sunriset(Window win,
float
size
,
float
size
,
int
type
);
int
type
);
void
draw_window
(
Window
win
);
void
draw_window
(
Window
win
);
/* convert the position on 0-60 scale into xy coordinates */
inline
float
convert2x
(
float
tim
);
inline
float
convert2x
(
float
tim
);
inline
float
convert2y
(
float
tim
);
inline
float
convert2y
(
float
tim
);
/* convert time units to degrees * 64 */
inline
short
hour_to_deg64
(
unsigned
short
hour
);
inline
short
min_to_deg64
(
unsigned
short
hour
);
inline
short
sec_to_deg64
(
unsigned
short
hour
);
void
constants
(
void
);
void
constants
(
void
);
void
calculate_hands
(
void
);
void
calculate_hands
(
void
);
void
refresh
(
void
);
void
refresh
(
void
);
...
@@ -472,7 +477,6 @@ void draw_window(Window win)
...
@@ -472,7 +477,6 @@ void draw_window(Window win)
}
}
}
}
/* convert the position on 0-60 scale into xy coordinates */
inline
float
convert2x
(
float
tim
)
inline
float
convert2x
(
float
tim
)
{
{
return
cos
(
M_PI
*
(((
tim
-
15
))
*
6
)
/
180
);
return
cos
(
M_PI
*
(((
tim
-
15
))
*
6
)
/
180
);
...
@@ -482,6 +486,25 @@ inline float convert2y(float tim)
...
@@ -482,6 +486,25 @@ inline float convert2y(float tim)
return
sin
(
M_PI
*
(((
tim
-
15
))
*
6
)
/
180
);
return
sin
(
M_PI
*
(((
tim
-
15
))
*
6
)
/
180
);
}
}
inline
short
hour_to_deg64
(
unsigned
short
hour
)
{
if
(
state
.
twentyfour
)
{
return
(
hour
*
960
)
%
23040
;
}
else
{
return
(
hour
*
1920
)
%
23040
;
}
}
inline
short
min_to_deg64
(
unsigned
short
min
)
{
return
min
*
384
;
}
inline
short
sec_to_deg64
(
unsigned
short
sec
)
{
return
sec
*
384
;
}
float
hwidth
[
3
];
float
hwidth
[
3
];
float
hlength
[
3
];
float
hlength
[
3
];
float
hback
[
3
];
float
hback
[
3
];
...
@@ -719,132 +742,41 @@ void update(void)
...
@@ -719,132 +742,41 @@ void update(void)
*/
*/
void
draw_dial
(
void
)
void
draw_dial
(
void
)
{
{
float
tmp
,
tinc
;
short
base_size
,
i
;
struct
coordinates
tmp_coord
;
float
xrate
,
yrate
;
float
xrate
,
yrate
;
XPoint
coord
;
mainGCV
.
foreground
=
fore_pix
;
XChangeGC
(
mainDisplay
,
mainGC
,
GCForeground
,
&
mainGCV
);
base_size
=
5
*
fmin
(
watch_size
.
x
,
watch_size
.
y
)
/
397
;
switch
(
state
.
tprop
)
{
for
(
i
=
0
;
i
<
120
;
i
++
)
{
case
2
:
int
size
;
tinc
=
1
.
0
;
if
(
state
.
twentyfour
?
i
%
15
==
0
:
i
%
30
==
0
)
{
break
;
mainGCV
.
foreground
=
pix
[
8
];
case
1
:
size
=
fmax
(
base_size
*
3
,
6
);
if
(
state
.
twentyfour
)
{
}
else
if
(
state
.
twentyfour
?
i
%
5
==
0
:
i
%
10
==
0
)
{
tinc
=
2
.
5
;
mainGCV
.
foreground
=
pix
[
7
];
}
else
{
size
=
fmax
(
base_size
*
2
,
4
);
tinc
=
5
.
0
;
}
else
if
(
i
%
2
==
0
)
{
}
break
;
case
0
:
tinc
=
60
.
0
;
break
;
default:
tinc
=
1
.
0
;
break
;
}
if
(
state
.
tprop
)
{
for
(
tmp
=
0
.
0
;
tmp
<
60
.
0
;
tmp
+=
tinc
)
{
xrate
=
convert2x
(
tmp
);
yrate
=
convert2y
(
tmp
);
tmp_coord
.
x
=
rint
((
watch_size
.
x
+
1
)
*
xrate
)
+
center
.
x
;
tmp_coord
.
y
=
rint
((
watch_size
.
y
+
1
)
*
yrate
)
+
center
.
y
;
#ifdef DEBUG
printf
(
"dot at %d %d
\n
"
,
tmp_coord
.
x
,
tmp_coord
.
y
);
#endif
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
tmp_coord
.
x
,
tmp_coord
.
y
);
if
(
state
.
tprop
==
2
)
{
if
(
state
.
tprop
==
2
)
{
if
(
!
((
int
)
tmp
%
5
))
{
mainGCV
.
foreground
=
pix
[
6
];
XDrawPoint
(
mainDisplay
,
size
=
base_size
;
backgroundWindow
,
}
else
{
mainGC
,
continue
;
tmp_coord
.
x
,
tmp_coord
.
y
+
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
tmp_coord
.
x
+
1
,
tmp_coord
.
y
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
tmp_coord
.
x
,
tmp_coord
.
y
-
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
tmp_coord
.
x
-
1
,
tmp_coord
.
y
);
}
}
}
}
else
{
continue
;
}
}
XChangeGC
(
mainDisplay
,
mainGC
,
GCForeground
,
&
mainGCV
);
if
(
state
.
tprop
==
1
)
{
xrate
=
convert2x
(
i
/
2
.
0
);
XDrawPoint
(
mainDisplay
,
yrate
=
convert2y
(
i
/
2
.
0
);
backgroundWindow
,
coord
.
x
=
center
.
x
+
rint
((
watch_size
.
x
+
1
)
*
xrate
);
mainGC
,
coord
.
y
=
center
.
y
+
rint
((
watch_size
.
y
+
1
)
*
yrate
);
center
.
x
-
watch_size
.
x
-
1
,
if
(
size
<
4
||
size
==
base_size
)
{
center
.
y
-
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
coord
.
x
,
coord
.
y
);
XDrawPoint
(
mainDisplay
,
}
else
{
backgroundWindow
,
FillTriangle
(
mainDisplay
,
backgroundWindow
,
mainGC
,
mainGC
,
coord
.
x
,
coord
.
y
,
size
,
rint
(.
5
*
size
),
center
.
x
-
watch_size
.
x
-
1
,
sec_to_deg64
(
60
-
i
/
2
.
0
));
center
.
y
+
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
-
watch_size
.
x
,
center
.
y
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
+
watch_size
.
x
+
1
,
center
.
y
-
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
+
watch_size
.
x
+
1
,
center
.
y
+
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
+
watch_size
.
x
,
center
.
y
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
-
1
,
center
.
y
-
watch_size
.
y
-
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
+
1
,
center
.
y
-
watch_size
.
y
-
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
,
center
.
y
-
watch_size
.
y
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
-
1
,
center
.
y
+
watch_size
.
y
+
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
+
1
,
center
.
y
+
watch_size
.
y
+
1
);
XDrawPoint
(
mainDisplay
,
backgroundWindow
,
mainGC
,
center
.
x
,
center
.
y
+
watch_size
.
y
);
}
}
}
}
}
}
...
@@ -1286,54 +1218,8 @@ void initialize(int argc, char **argv,
...
@@ -1286,54 +1218,8 @@ void initialize(int argc, char **argv,
state
.
total_size
.
y
-
1
state
.
total_size
.
y
-
1
);
);
}
}
/* Finish up the background (the dial) */
/* Get colors */
draw_dial
();
status
=
XSetCommand
(
mainDisplay
,
mainWindow
,
argv
,
argc
);
/* Set up the event for quitting the window */
wm_delete_window
=
XInternAtom
(
mainDisplay
,
"WM_DELETE_WINDOW"
,
/* atom_name */
False
/* only_if_exists */
);
wm_protocols
=
XInternAtom
(
mainDisplay
,
"WM_PROTOCOLS"
,
/* atom_name */
False
/* only_if_exists */
);
status
=
XSetWMProtocols
(
mainDisplay
,
mainWindow
,
&
wm_delete_window
,
1
);
status
=
XSetWMProtocols
(
mainDisplay
,
iconWindow
,
&
wm_delete_window
,
1
);
WmHints
.
flags
=
StateHint
|
IconWindowHint
;
WmHints
.
initial_state
=
withdrawn
?
WithdrawnState
:
iconic
?
IconicState
:
NormalState
;
WmHints
.
icon_window
=
iconWindow
;
if
(
withdrawn
)
{
WmHints
.
window_group
=
mainWindow
;
WmHints
.
flags
|=
WindowGroupHint
;
}
if
(
iconic
||
withdrawn
)
{
WmHints
.
icon_x
=
SizeHints
.
x
;
WmHints
.
icon_y
=
SizeHints
.
y
;
WmHints
.
flags
|=
IconPositionHint
;
}
XSetWMHints
(
mainDisplay
,
mainWindow
,
&
WmHints
);
/* Finally show the window */
status
=
XMapWindow
(
mainDisplay
,
mainWindow
);
/* Get colors while waiting for Expose */
if
(
state
.
neon
)
{
if
(
state
.
neon
)
{
pix
[
0
]
=
DarkenColor
(
state
.
seccolor
,
1
.
8
,
mainDisplay
,
Root
);
pix
[
0
]
=
DarkenColor
(
state
.
seccolor
,
1
.
8
,
mainDisplay
,
Root
);
pix
[
1
]
=
DarkenColor
(
state
.
mincolor
,
1
.
8
,
mainDisplay
,
Root
);
pix
[
1
]
=
DarkenColor
(
state
.
mincolor
,
1
.
8
,
mainDisplay
,
Root
);
...
@@ -1379,6 +1265,53 @@ void initialize(int argc, char **argv,
...
@@ -1379,6 +1265,53 @@ void initialize(int argc, char **argv,
/* Get the label color */
/* Get the label color */
label_pix
=
GetColor
(
state
.
label_color
,
mainDisplay
,
Root
);
label_pix
=
GetColor
(
state
.
label_color
,
mainDisplay
,
Root
);
/* Finish up the background (the dial) */
if
(
state
.
tprop
)
{
draw_dial
();
}
status
=
XSetCommand
(
mainDisplay
,
mainWindow
,
argv
,
argc
);
/* Set up the event for quitting the window */
wm_delete_window
=
XInternAtom
(
mainDisplay
,
"WM_DELETE_WINDOW"
,
/* atom_name */
False
/* only_if_exists */
);
wm_protocols
=
XInternAtom
(
mainDisplay
,
"WM_PROTOCOLS"
,
/* atom_name */
False
/* only_if_exists */
);
status
=
XSetWMProtocols
(
mainDisplay
,
mainWindow
,
&
wm_delete_window
,
1
);
status
=
XSetWMProtocols
(
mainDisplay
,
iconWindow
,
&
wm_delete_window
,
1
);
WmHints
.
flags
=
StateHint
|
IconWindowHint
;
WmHints
.
initial_state
=
withdrawn
?
WithdrawnState
:
iconic
?
IconicState
:
NormalState
;
WmHints
.
icon_window
=
iconWindow
;
if
(
withdrawn
)
{
WmHints
.
window_group
=
mainWindow
;
WmHints
.
flags
|=
WindowGroupHint
;
}
if
(
iconic
||
withdrawn
)
{
WmHints
.
icon_x
=
SizeHints
.
x
;
WmHints
.
icon_y
=
SizeHints
.
y
;
WmHints
.
flags
|=
IconPositionHint
;
}
XSetWMHints
(
mainDisplay
,
mainWindow
,
&
WmHints
);
/* Finally show the window */
status
=
XMapWindow
(
mainDisplay
,
mainWindow
);
/* try to read the time */
/* try to read the time */
curTime
=
time
(
0
);
curTime
=
time
(
0
);
last_time
=
curTime
;
last_time
=
curTime
;
...
...
This diff is collapsed.
Click to expand it.
01_git/autoconf/Makefile.defines.in
+
2
−
2
View file @
54543cf2
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#
#
CC
=
@CC@
CC
=
@CC@
CCFLAGS
=
@CFLAGS@
-std
=
c99
-DNDEBUG
-D_BSD_SOURCE
-D_XOPEN_SOURCE
=
600
-Wall
-Werror
-pedantic-errors
CCFLAGS
=
@CFLAGS@
-std
=
c99
-DNDEBUG
-D_BSD_SOURCE
-D_XOPEN_SOURCE
=
600
-D_ISO99_SOURCE
-Wall
-Werror
-pedantic-errors
#CCFLAGS += -W -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wno-variadic-macros -Wold-style-definition
#CCFLAGS += -W -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wno-variadic-macros -Wold-style-definition
RANLIB
=
@RANLIB@
RANLIB
=
@RANLIB@
AR
=
ar clq
AR
=
ar clq
...
@@ -33,7 +33,7 @@ LIBS_JPEG = @JPEG_LIB@
...
@@ -33,7 +33,7 @@ LIBS_JPEG = @JPEG_LIB@
LIBS_XEXTS
=
LIBS_XEXTS
=
LIBS_AFTERSTEP
=
LIBS_AFTERSTEP
=
LIBS_M
=
-lm
LIBS_M
=
-lm
LIBRARIES
=
$(
LIBS_X
)
$(
LIBS_XPM
)
$(
LIBS_JPEG
)
$(
LIBS_XEXTS
)
$(
LIBS_AFTERSTEP
)
$(
LIBS_M
)
LIBRARIES
=
$(
LIBS_X
)
$(
LIBS_XPM
)
$(
LIBS_JPEG
)
$(
LIBS_XEXTS
)
$(
LIBS_AFTERSTEP
)
$(
LIBS_M
)
-lbsd-compat
AFTER_BIN_DIR
=
@bindir@
AFTER_BIN_DIR
=
@bindir@
AFTER_MAN_DIR
=
@mandir@/man1
AFTER_MAN_DIR
=
@mandir@/man1
...
...
This diff is collapsed.
Click to expand it.
01_git/beo.astimerc
+
1
−
1
View file @
54543cf2
...
@@ -42,7 +42,7 @@ title astime
...
@@ -42,7 +42,7 @@ title astime
twentyfourHour 1
twentyfourHour 1
sunriset 1
sunriset 1
sunrisetDay
green
sunrisetDay
orange
sunrisetNight black
sunrisetNight black
latitude 11.05
latitude 11.05
longitude 49.6972222
longitude 49.6972222
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment