Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
e4e46473
Commit
e4e46473
authored
May 02, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup logging in the GUI
parent
c3e59b16
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
55 deletions
+56
-55
common/utils/T/tracer/gui/container.c
common/utils/T/tracer/gui/container.c
+9
-9
common/utils/T/tracer/gui/event.c
common/utils/T/tracer/gui/event.c
+4
-4
common/utils/T/tracer/gui/gui.c
common/utils/T/tracer/gui/gui.c
+2
-0
common/utils/T/tracer/gui/gui_defs.h
common/utils/T/tracer/gui/gui_defs.h
+3
-0
common/utils/T/tracer/gui/label.c
common/utils/T/tracer/gui/label.c
+2
-2
common/utils/T/tracer/gui/notify.c
common/utils/T/tracer/gui/notify.c
+4
-8
common/utils/T/tracer/gui/text_list.c
common/utils/T/tracer/gui/text_list.c
+4
-4
common/utils/T/tracer/gui/toplevel_window.c
common/utils/T/tracer/gui/toplevel_window.c
+4
-4
common/utils/T/tracer/gui/x.c
common/utils/T/tracer/gui/x.c
+14
-14
common/utils/T/tracer/gui/xy_plot.c
common/utils/T/tracer/gui/xy_plot.c
+10
-10
No files found.
common/utils/T/tracer/gui/container.c
View file @
e4e46473
...
...
@@ -8,7 +8,7 @@
static
void
repack
(
gui
*
g
,
widget
*
_this
)
{
printf
(
"REPACK container %p
\n
"
,
_this
);
LOGD
(
"REPACK container %p
\n
"
,
_this
);
struct
container_widget
*
this
=
_this
;
this
->
hints_are_valid
=
0
;
return
this
->
common
.
parent
->
repack
(
g
,
this
->
common
.
parent
);
...
...
@@ -16,7 +16,7 @@ printf("REPACK container %p\n", _this);
static
void
add_child
(
gui
*
g
,
widget
*
_this
,
widget
*
child
,
int
position
)
{
printf
(
"ADD_CHILD container
\n
"
);
LOGD
(
"ADD_CHILD container
\n
"
);
struct
container_widget
*
this
=
_this
;
this
->
hints_are_valid
=
0
;
widget_add_child_internal
(
g
,
this
,
child
,
position
);
...
...
@@ -78,7 +78,7 @@ static void compute_horizontal_hints(struct gui *g,
static
void
vertical_allocate
(
gui
*
_gui
,
widget
*
_this
,
int
x
,
int
y
,
int
width
,
int
height
)
{
printf
(
"ALLOCATE container vertical %p
\n
"
,
_this
);
LOGD
(
"ALLOCATE container vertical %p
\n
"
,
_this
);
int
cy
=
0
;
int
cwidth
,
cheight
;
struct
gui
*
g
=
_gui
;
...
...
@@ -126,7 +126,7 @@ hints_ok:
static
void
horizontal_allocate
(
gui
*
_gui
,
widget
*
_this
,
int
x
,
int
y
,
int
width
,
int
height
)
{
printf
(
"ALLOCATE container horizontal %p
\n
"
,
_this
);
LOGD
(
"ALLOCATE container horizontal %p
\n
"
,
_this
);
int
cx
=
0
;
int
cwidth
,
cheight
;
struct
gui
*
g
=
_gui
;
...
...
@@ -173,7 +173,7 @@ hints_ok:
static
void
vertical_hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
{
printf
(
"HINTS container vertical %p
\n
"
,
_w
);
LOGD
(
"HINTS container vertical %p
\n
"
,
_w
);
struct
gui
*
g
=
_gui
;
struct
container_widget
*
this
=
_w
;
...
...
@@ -191,7 +191,7 @@ printf("HINTS container vertical %p\n", _w);
static
void
horizontal_hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
{
printf
(
"HINTS container horizontal %p
\n
"
,
_w
);
LOGD
(
"HINTS container horizontal %p
\n
"
,
_w
);
struct
gui
*
g
=
_gui
;
struct
container_widget
*
this
=
_w
;
...
...
@@ -210,7 +210,7 @@ printf("HINTS container horizontal %p\n", _w);
static
void
horizontal_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
printf
(
"BUTTON container horizontal %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
LOGD
(
"BUTTON container horizontal %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
container_widget
*
this
=
_this
;
struct
widget_list
*
l
;
...
...
@@ -228,7 +228,7 @@ printf("BUTTON container horizontal %p xy %d %d button %d up %d\n", _this, x, y,
static
void
vertical_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
printf
(
"BUTTON container vertical %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
LOGD
(
"BUTTON container vertical %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
container_widget
*
this
=
_this
;
struct
widget_list
*
l
;
...
...
@@ -245,7 +245,7 @@ printf("BUTTON container vertical %p xy %d %d button %d up %d\n", _this, x, y, b
static
void
paint
(
gui
*
_gui
,
widget
*
_this
)
{
printf
(
"PAINT container
\n
"
);
LOGD
(
"PAINT container
\n
"
);
struct
gui
*
g
=
_gui
;
struct
widget
*
this
=
_this
;
struct
widget_list
*
l
;
...
...
common/utils/T/tracer/gui/event.c
View file @
e4e46473
...
...
@@ -63,7 +63,7 @@ static event *new_event_dirty(int id)
void
send_event
(
gui
*
_gui
,
enum
event_type
type
,
...)
{
printf
(
"send_event %d
\n
"
,
type
);
LOGD
(
"send_event %d
\n
"
,
type
);
struct
gui
*
g
=
_gui
;
int
do_write
=
0
;
va_list
ap
;
...
...
@@ -140,7 +140,7 @@ static void dirty_event(struct gui *g, int id)
static
void
process_event
(
struct
gui
*
g
,
struct
event
*
e
)
{
printf
(
"processing event type %d
\n
"
,
e
->
type
);
LOGD
(
"processing event type %d
\n
"
,
e
->
type
);
switch
(
e
->
type
)
{
case
REPACK
:
repack_event
(
g
,
((
struct
repack_event
*
)
e
)
->
id
);
break
;
case
DIRTY
:
dirty_event
(
g
,
((
struct
dirty_event
*
)
e
)
->
id
);
break
;
...
...
@@ -152,7 +152,7 @@ void gui_events(gui *_gui)
{
struct
gui
*
g
=
_gui
;
printf
(
"gui_events START: head %p
\n
"
,
g
->
queued_events
);
LOGD
(
"gui_events START: head %p
\n
"
,
g
->
queued_events
);
while
(
g
->
queued_events
)
{
struct
event_list
*
cur
=
g
->
queued_events
;
...
...
@@ -162,5 +162,5 @@ printf("gui_events START: head %p\n", g->queued_events);
free_event
(
cur
->
item
);
free
(
cur
);
}
printf
(
"gui_events DONE
\n
"
);
LOGD
(
"gui_events DONE
\n
"
);
}
common/utils/T/tracer/gui/gui.c
View file @
e4e46473
...
...
@@ -5,6 +5,8 @@
#include <stdlib.h>
#include <pthread.h>
int
volatile
gui_logd
;
void
glock
(
gui
*
_gui
)
{
struct
gui
*
g
=
_gui
;
...
...
common/utils/T/tracer/gui/gui_defs.h
View file @
e4e46473
...
...
@@ -3,6 +3,9 @@
/* defines the private API of the GUI */
extern
int
volatile
gui_logd
;
#define LOGD(...) do { if (gui_logd) printf(__VA_ARGS__); } while (0)
/*************************************************************************/
/* logging macros */
/*************************************************************************/
...
...
common/utils/T/tracer/gui/label.c
View file @
e4e46473
...
...
@@ -9,7 +9,7 @@ static void paint(gui *_gui, widget *_w)
{
struct
gui
*
g
=
_gui
;
struct
label_widget
*
l
=
_w
;
printf
(
"PAINT label '%s'
\n
"
,
l
->
t
);
LOGD
(
"PAINT label '%s'
\n
"
,
l
->
t
);
x_draw_string
(
g
->
x
,
g
->
xwin
,
l
->
color
,
l
->
common
.
x
,
l
->
common
.
y
+
l
->
baseline
,
l
->
t
);
}
...
...
@@ -17,7 +17,7 @@ printf("PAINT label '%s'\n", l->t);
static
void
hints
(
gui
*
_gui
,
widget
*
_w
,
int
*
width
,
int
*
height
)
{
struct
label_widget
*
l
=
_w
;
printf
(
"HINTS label '%s'
\n
"
,
l
->
t
);
LOGD
(
"HINTS label '%s'
\n
"
,
l
->
t
);
*
width
=
l
->
width
;
*
height
=
l
->
height
;
}
...
...
common/utils/T/tracer/gui/notify.c
View file @
e4e46473
...
...
@@ -13,7 +13,7 @@ unsigned long register_notifier(gui *_g, char *notification, widget *w,
glock
(
g
);
if
(
g
->
next_notifier_id
==
2UL
*
1024
*
1024
*
1024
)
{
printf
(
"%s:%d: report a bug
\n
"
,
__FILE__
,
__LINE__
);
abort
();
}
ERR
(
"%s:%d: report a bug
\n
"
,
__FILE__
,
__LINE__
);
g
->
notifiers
=
realloc
(
g
->
notifiers
,
(
g
->
notifiers_count
+
1
)
*
sizeof
(
struct
notifier
));
...
...
@@ -50,11 +50,8 @@ void unregister_notifier(gui *_g, unsigned long notifier_id)
for
(
i
=
0
;
i
<
g
->
notifiers_count
;
i
++
)
if
(
g
->
notifiers
[
i
].
id
==
notifier_id
)
break
;
if
(
i
==
g
->
notifiers_count
)
{
printf
(
"%s:%d: notifier_id %ld not found
\n
"
,
__FILE__
,
__LINE__
,
notifier_id
);
abort
();
}
if
(
i
==
g
->
notifiers_count
)
ERR
(
"%s:%d: notifier_id %ld not found
\n
"
,
__FILE__
,
__LINE__
,
notifier_id
);
free
(
g
->
notifiers
[
i
].
notification
);
...
...
@@ -83,8 +80,7 @@ void gui_notify(struct gui *g, char *notification, widget *w,
* for now let's crash in case of recursive call
*/
static
int
inside
=
0
;
if
(
inside
)
{
printf
(
"%s:%d: BUG! contact the authors
\n
"
,
__FILE__
,
__LINE__
);
abort
();}
if
(
inside
)
ERR
(
"%s:%d: BUG! contact the authors
\n
"
,
__FILE__
,
__LINE__
);
inside
=
1
;
/* clear all handlers */
...
...
common/utils/T/tracer/gui/text_list.c
View file @
e4e46473
...
...
@@ -10,7 +10,7 @@ static void paint(gui *_gui, widget *_this)
struct
gui
*
g
=
_gui
;
struct
text_list_widget
*
this
=
_this
;
int
i
,
j
;
printf
(
"PAINT text_list %p xywh %d %d %d %d
\n
"
,
_this
,
this
->
common
.
x
,
this
->
common
.
y
,
this
->
common
.
width
,
this
->
common
.
height
);
LOGD
(
"PAINT text_list %p xywh %d %d %d %d
\n
"
,
_this
,
this
->
common
.
x
,
this
->
common
.
y
,
this
->
common
.
width
,
this
->
common
.
height
);
x_fill_rectangle
(
g
->
x
,
g
->
xwin
,
this
->
background_color
,
this
->
common
.
x
,
this
->
common
.
y
,
this
->
common
.
width
,
this
->
common
.
height
);
...
...
@@ -29,7 +29,7 @@ static void hints(gui *_gui, widget *_w, int *width, int *height)
struct
text_list_widget
*
w
=
_w
;
*
width
=
w
->
wanted_width
;
*
height
=
w
->
wanted_nlines
*
w
->
line_height
;
printf
(
"HINTS text_list wh %d %d
\n
"
,
*
width
,
*
height
);
LOGD
(
"HINTS text_list wh %d %d
\n
"
,
*
width
,
*
height
);
}
static
void
allocate
(
...
...
@@ -41,14 +41,14 @@ static void allocate(
this
->
common
.
width
=
width
;
this
->
common
.
height
=
height
;
this
->
allocated_nlines
=
height
/
this
->
line_height
;
printf
(
"ALLOCATE text_list %p xywh %d %d %d %d nlines %d
\n
"
,
this
,
x
,
y
,
width
,
height
,
this
->
allocated_nlines
);
LOGD
(
"ALLOCATE text_list %p xywh %d %d %d %d nlines %d
\n
"
,
this
,
x
,
y
,
width
,
height
,
this
->
allocated_nlines
);
}
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
struct
gui
*
g
=
_g
;
struct
text_list_widget
*
this
=
_this
;
printf
(
"BUTTON test_list %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
LOGD
(
"BUTTON test_list %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
/* scroll up */
if
(
button
==
4
&&
up
==
0
)
{
gui_notify
(
g
,
"scrollup"
,
_this
,
NULL
);
...
...
common/utils/T/tracer/gui/toplevel_window.c
View file @
e4e46473
...
...
@@ -10,7 +10,7 @@
static
void
repack
(
gui
*
g
,
widget
*
_this
)
{
printf
(
"REPACK toplevel_window
\n
"
);
LOGD
(
"REPACK toplevel_window
\n
"
);
struct
toplevel_window_widget
*
this
=
_this
;
if
(
this
->
common
.
children
==
NULL
)
ERR
(
"toplevel window has no child
\n
"
);
if
(
this
->
common
.
children
->
next
!=
NULL
)
...
...
@@ -22,7 +22,7 @@ printf("REPACK toplevel_window\n");
static
void
add_child
(
gui
*
_gui
,
widget
*
_this
,
widget
*
child
,
int
position
)
{
printf
(
"ADD_CHILD toplevel_window
\n
"
);
LOGD
(
"ADD_CHILD toplevel_window
\n
"
);
struct
widget
*
this
=
_this
;
if
(
this
->
children
!=
NULL
)
{
WARN
(
"toplevel window already has a child
\n
"
);
...
...
@@ -35,7 +35,7 @@ printf("ADD_CHILD toplevel_window\n");
static
void
allocate
(
gui
*
_gui
,
widget
*
_this
,
int
x
,
int
y
,
int
width
,
int
height
)
{
printf
(
"ALLOCATE toplevel_window
\n
"
);
LOGD
(
"ALLOCATE toplevel_window
\n
"
);
struct
toplevel_window_widget
*
this
=
_this
;
this
->
common
.
width
=
width
;
this
->
common
.
height
=
height
;
...
...
@@ -47,7 +47,7 @@ static void paint(gui *_gui, widget *_this)
{
struct
gui
*
g
=
_gui
;
struct
toplevel_window_widget
*
this
=
_this
;
printf
(
"PAINT toplevel_window (%d %d)
\n
"
,
this
->
common
.
width
,
this
->
common
.
height
);
LOGD
(
"PAINT toplevel_window (%d %d)
\n
"
,
this
->
common
.
width
,
this
->
common
.
height
);
x_fill_rectangle
(
g
->
x
,
this
->
x
,
BACKGROUND_COLOR
,
0
,
0
,
this
->
common
.
width
,
this
->
common
.
height
);
g
->
xwin
=
this
->
x
;
...
...
common/utils/T/tracer/gui/x.c
View file @
e4e46473
...
...
@@ -46,7 +46,7 @@ x_connection *x_open(void)
if
(
ret
==
NULL
)
OOM
;
ret
->
d
=
XOpenDisplay
(
0
);
printf
(
"XOpenDisplay display %p return x_connection %p
\n
"
,
ret
->
d
,
ret
);
LOGD
(
"XOpenDisplay display %p return x_connection %p
\n
"
,
ret
->
d
,
ret
);
if
(
ret
->
d
==
NULL
)
ERR
(
"error calling XOpenDisplay: no X? you root?
\n
"
);
x_new_color
(
ret
,
"white"
);
/* background color */
...
...
@@ -96,16 +96,16 @@ x_window *x_create_window(x_connection *_x, int width, int height,
#if 0
/* wait for window to be mapped */
printf
("wait for map\n");
LOGD
("wait for map\n");
while (1) {
XEvent ev;
//XWindowEvent(x->d, ret->w, StructureNotifyMask, &ev);
XWindowEvent(x->d, ret->w, ExposureMask, &ev);
printf
("got ev %d\n", ev.type);
LOGD
("got ev %d\n", ev.type);
//if (ev.type == MapNotify) break;
if (ev.type == Expose) break;
}
printf
("XXX create connection %p window %p (win id %d pixmap %d) w h %d %d\n", x, ret, (int)ret->w, (int)ret->p, width, height);
LOGD
("XXX create connection %p window %p (win id %d pixmap %d) w h %d %d\n", x, ret, (int)ret->w, (int)ret->p, width, height);
#endif
return
ret
;
...
...
@@ -133,7 +133,7 @@ void x_events(gui *_gui)
struct
x_connection
*
x
=
g
->
x
;
struct
toplevel_window_widget
*
w
;
printf
(
"x_events START
\n
"
);
LOGD
(
"x_events START
\n
"
);
/* preprocessing (to "compress" events) */
cur
=
g
->
toplevel
;
while
(
cur
)
{
...
...
@@ -149,7 +149,7 @@ printf("x_events START\n");
while
(
XPending
(
x
->
d
))
{
XEvent
ev
;
XNextEvent
(
x
->
d
,
&
ev
);
printf
(
"XEV %d
\n
"
,
ev
.
type
);
LOGD
(
"XEV %d
\n
"
,
ev
.
type
);
switch
(
ev
.
type
)
{
case
MapNotify
:
case
Expose
:
...
...
@@ -166,7 +166,7 @@ printf("XEV %d\n", ev.type);
xw
->
new_height
=
ev
.
xconfigure
.
height
;
if
(
xw
->
new_width
<
10
)
xw
->
new_width
=
10
;
if
(
xw
->
new_height
<
10
)
xw
->
new_height
=
10
;
printf
(
"ConfigureNotify %d %d
\n
"
,
ev
.
xconfigure
.
width
,
ev
.
xconfigure
.
height
);
LOGD
(
"ConfigureNotify %d %d
\n
"
,
ev
.
xconfigure
.
width
,
ev
.
xconfigure
.
height
);
}
break
;
case
ButtonPress
:
...
...
@@ -194,14 +194,14 @@ printf("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
}
/* postprocessing */
printf
(
"post processing
\n
"
);
LOGD
(
"post processing
\n
"
);
cur
=
g
->
toplevel
;
while
(
cur
)
{
struct
toplevel_window_widget
*
w
=
(
struct
toplevel_window_widget
*
)
cur
->
item
;
struct
x_window
*
xw
=
w
->
x
;
if
(
xw
->
resize
)
{
printf
(
"resize old %d %d new %d %d
\n
"
,
xw
->
width
,
xw
->
height
,
xw
->
new_width
,
xw
->
new_height
);
LOGD
(
"resize old %d %d new %d %d
\n
"
,
xw
->
width
,
xw
->
height
,
xw
->
new_width
,
xw
->
new_height
);
if
(
xw
->
width
!=
xw
->
new_width
||
xw
->
height
!=
xw
->
new_height
)
{
w
->
common
.
allocate
(
g
,
w
,
0
,
0
,
xw
->
new_width
,
xw
->
new_height
);
xw
->
width
=
xw
->
new_width
;
...
...
@@ -220,13 +220,13 @@ printf("resize old %d %d new %d %d\n", xw->width, xw->height, xw->new_width, xw-
}
if
(
xw
->
redraw
)
{
struct
x_connection
*
x
=
g
->
x
;
printf
(
"XCopyArea w h %d %d
\n
"
,
xw
->
width
,
xw
->
height
);
LOGD
(
"XCopyArea w h %d %d
\n
"
,
xw
->
width
,
xw
->
height
);
XCopyArea
(
x
->
d
,
xw
->
p
,
xw
->
w
,
x
->
colors
[
1
],
0
,
0
,
xw
->
width
,
xw
->
height
,
0
,
0
);
}
cur
=
cur
->
next
;
}
printf
(
"x_events DONE
\n
"
);
LOGD
(
"x_events DONE
\n
"
);
}
void
x_flush
(
x_connection
*
_x
)
...
...
@@ -248,7 +248,7 @@ void x_text_get_dimensions(x_connection *_c, const char *t,
XQueryTextExtents
(
c
->
d
,
XGContextFromGC
(
c
->
colors
[
1
]),
t
,
strlen
(
t
),
&
dir
,
&
ascent
,
&
descent
,
&
overall
);
//
printf
("dir %d ascent %d descent %d lbearing %d rbearing %d width %d ascent %d descent %d\n", dir, ascent, descent, overall.lbearing, overall.rbearing, overall.width, overall.ascent, overall.descent);
//
LOGD
("dir %d ascent %d descent %d lbearing %d rbearing %d width %d ascent %d descent %d\n", dir, ascent, descent, overall.lbearing, overall.rbearing, overall.width, overall.ascent, overall.descent);
*
width
=
overall
.
width
;
*
height
=
ascent
+
descent
;
...
...
@@ -308,7 +308,7 @@ void x_draw(x_connection *_c, x_window *_w)
{
struct
x_connection
*
c
=
_c
;
struct
x_window
*
w
=
_w
;
printf
(
"x_draw XCopyArea w h %d %d display %p window %d pixmap %d
\n
"
,
w
->
width
,
w
->
height
,
c
->
d
,
(
int
)
w
->
w
,
(
int
)
w
->
p
);
LOGD
(
"x_draw XCopyArea w h %d %d display %p window %d pixmap %d
\n
"
,
w
->
width
,
w
->
height
,
c
->
d
,
(
int
)
w
->
w
,
(
int
)
w
->
p
);
XCopyArea
(
c
->
d
,
w
->
p
,
w
->
w
,
c
->
colors
[
1
],
0
,
0
,
w
->
width
,
w
->
height
,
0
,
0
);
}
...
...
@@ -333,7 +333,7 @@ void x_add_point(x_connection *_c, int x, int y)
void
x_plot_points
(
x_connection
*
_c
,
x_window
*
_w
,
int
color
)
{
struct
x_connection
*
c
=
_c
;
fprintf
(
stderr
,
"x_plot_points %d points
\n
"
,
c
->
pts_size
);
LOGD
(
"x_plot_points %d points
\n
"
,
c
->
pts_size
);
struct
x_window
*
w
=
_w
;
XDrawPoints
(
c
->
d
,
w
->
p
,
c
->
colors
[
color
],
c
->
pts
,
c
->
pts_size
,
CoordModeOrigin
);
...
...
common/utils/T/tracer/gui/xy_plot.c
View file @
e4e46473
...
...
@@ -24,7 +24,7 @@ static void paint(gui *_gui, widget *_this)
# define FLIP(v) (-(v) + allocated_plot_height-1)
printf
(
"PAINT xy plot xywh %d %d %d %d
\n
"
,
this
->
common
.
x
,
this
->
common
.
y
,
this
->
common
.
width
,
this
->
common
.
height
);
LOGD
(
"PAINT xy plot xywh %d %d %d %d
\n
"
,
this
->
common
.
x
,
this
->
common
.
y
,
this
->
common
.
width
,
this
->
common
.
height
);
//x_draw_rectangle(g->x, g->xwin, 1, this->common.x, this->common.y, this->common.width, this->common.height);
...
...
@@ -52,14 +52,14 @@ printf("PAINT xy plot xywh %d %d %d %d\n", this->common.x, this->common.y, this-
allocated_xmax
=
center
+
((
this
->
xmax
-
this
->
xmin
)
*
allocated_plot_width
/
wanted_plot_width
)
/
2
;
/* adjust tic if too tight */
printf
(
"pre x ticstep %g
\n
"
,
ticstep
);
LOGD
(
"pre x ticstep %g
\n
"
,
ticstep
);
while
(
1
)
{
if
(
ticstep
/
(
allocated_xmax
-
allocated_xmin
)
*
(
allocated_plot_width
-
1
)
>
40
)
break
;
ticstep
*=
2
;
}
printf
(
"post x ticstep %g
\n
"
,
ticstep
);
printf
(
"xmin/max %g %g width wanted allocated %d %d alloc xmin/max %g %g ticstep %g
\n
"
,
this
->
xmin
,
this
->
xmax
,
wanted_plot_width
,
allocated_plot_width
,
allocated_xmin
,
allocated_xmax
,
ticstep
);
LOGD
(
"post x ticstep %g
\n
"
,
ticstep
);
LOGD
(
"xmin/max %g %g width wanted allocated %d %d alloc xmin/max %g %g ticstep %g
\n
"
,
this
->
xmin
,
this
->
xmax
,
wanted_plot_width
,
allocated_plot_width
,
allocated_xmin
,
allocated_xmax
,
ticstep
);
kmin
=
ceil
(
allocated_xmin
/
ticstep
);
kmax
=
floor
(
allocated_xmax
/
ticstep
);
for
(
k
=
kmin
;
k
<=
kmax
;
k
++
)
{
...
...
@@ -84,7 +84,7 @@ printf("xmin/max %g %g width wanted allocated %d %d alloc xmin/max %g %g ticstep
this
->
common
.
y
+
this
->
common
.
height
-
this
->
label_height
*
2
+
this
->
label_baseline
,
v
);
printf
(
"tic k %d val %g x %g
\n
"
,
k
,
k
*
ticstep
,
x
);
LOGD
(
"tic k %d val %g x %g
\n
"
,
k
,
k
*
ticstep
,
x
);
}
/* vertical tics */
...
...
@@ -98,14 +98,14 @@ printf("tic k %d val %g x %g\n", k, k * ticstep, x);
allocated_ymax
=
center
+
((
this
->
ymax
-
this
->
ymin
)
*
allocated_plot_height
/
wanted_plot_height
)
/
2
;
/* adjust tic if too tight */
printf
(
"pre y ticstep %g
\n
"
,
ticstep
);
LOGD
(
"pre y ticstep %g
\n
"
,
ticstep
);
while
(
1
)
{
if
(
ticstep
/
(
allocated_ymax
-
allocated_ymin
)
*
(
allocated_plot_height
-
1
)
>
20
)
break
;
ticstep
*=
2
;
}
printf
(
"post y ticstep %g
\n
"
,
ticstep
);
printf
(
"ymin/max %g %g height wanted allocated %d %d alloc ymin/max %g %g ticstep %g
\n
"
,
this
->
ymin
,
this
->
ymax
,
wanted_plot_height
,
allocated_plot_height
,
allocated_ymin
,
allocated_ymax
,
ticstep
);
LOGD
(
"post y ticstep %g
\n
"
,
ticstep
);
LOGD
(
"ymin/max %g %g height wanted allocated %d %d alloc ymin/max %g %g ticstep %g
\n
"
,
this
->
ymin
,
this
->
ymax
,
wanted_plot_height
,
allocated_plot_height
,
allocated_ymin
,
allocated_ymax
,
ticstep
);
kmin
=
ceil
(
allocated_ymin
/
ticstep
);
kmax
=
floor
(
allocated_ymax
/
ticstep
);
for
(
k
=
kmin
;
k
<=
kmax
;
k
++
)
{
...
...
@@ -158,7 +158,7 @@ static void hints(gui *_gui, widget *_w, int *width, int *height)
struct
xy_plot_widget
*
w
=
_w
;
*
width
=
w
->
wanted_width
+
w
->
vrule_width
;
*
height
=
w
->
wanted_height
+
w
->
label_height
*
2
;
/* TODO: refine */
printf
(
"HINTS xy plot wh %d %d (vrule_width %d) (wanted wh %d %d)
\n
"
,
*
width
,
*
height
,
w
->
vrule_width
,
w
->
wanted_width
,
w
->
wanted_height
);
LOGD
(
"HINTS xy plot wh %d %d (vrule_width %d) (wanted wh %d %d)
\n
"
,
*
width
,
*
height
,
w
->
vrule_width
,
w
->
wanted_width
,
w
->
wanted_height
);
}
widget
*
new_xy_plot
(
gui
*
_gui
,
int
width
,
int
height
,
char
*
label
,
...
...
@@ -176,7 +176,7 @@ widget *new_xy_plot(gui *_gui, int width, int height, char *label,
* not in the "gui thread") */
x_text_get_dimensions
(
g
->
x
,
label
,
&
w
->
label_width
,
&
w
->
label_height
,
&
w
->
label_baseline
);
printf
(
"XY PLOT label wh %d %d
\n
"
,
w
->
label_width
,
w
->
label_height
);
LOGD
(
"XY PLOT label wh %d %d
\n
"
,
w
->
label_width
,
w
->
label_height
);
w
->
wanted_width
=
width
;
w
->
wanted_height
=
height
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment