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
Michael Black
OpenXG-RAN
Commits
2e7ab60d
Commit
2e7ab60d
authored
May 17, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zoom in/out in timeline
parent
7d1665fe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
common/utils/T/tracer/gui/gui.h
common/utils/T/tracer/gui/gui.h
+2
-0
common/utils/T/tracer/gui/timeline.c
common/utils/T/tracer/gui/timeline.c
+16
-0
common/utils/T/tracer/view/time.c
common/utils/T/tracer/view/time.c
+26
-1
No files found.
common/utils/T/tracer/gui/gui.h
View file @
2e7ab60d
...
...
@@ -81,6 +81,8 @@ int new_color(gui *gui, char *color);
* - click { int: button } (if enabled)
* - timeline
* - resize { int: width }
* - scrollup { void *: NULL }
* - scrolldown { void *: NULL }
*/
/* same type as in gui_defs.h */
...
...
common/utils/T/tracer/gui/timeline.c
View file @
2e7ab60d
...
...
@@ -54,6 +54,21 @@ static void allocate(gui *_gui, widget *_this,
gui_notify
(
_gui
,
"resize"
,
_this
,
&
width
);
}
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
struct
gui
*
g
=
_g
;
struct
timeline_widget
*
this
=
_this
;
LOGD
(
"BUTTON timeline %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
);
}
/* scroll down */
if
(
button
==
5
&&
up
==
0
)
{
gui_notify
(
g
,
"scrolldown"
,
_this
,
NULL
);
}
}
/*************************************************************************/
/* creation function */
/*************************************************************************/
...
...
@@ -87,6 +102,7 @@ widget *new_timeline(gui *_gui, int width, int number_of_sublines,
w
->
common
.
paint
=
paint
;
w
->
common
.
hints
=
hints
;
w
->
common
.
allocate
=
allocate
;
w
->
common
.
button
=
button
;
gunlock
(
g
);
...
...
common/utils/T/tracer/view/time.c
View file @
2e7ab60d
...
...
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
/****************************************************************************/
/* timeview */
...
...
@@ -37,7 +38,7 @@ struct time {
time_t
tstart_time
;
/* timestamp (in seconds) of starting in t */
int
subcount
;
/* number of subviews */
struct
timespec
latest_time
;
/* time of latest received tick */
int64_t
pixel_length
;
/* unit: nanosecond (maximum 1 hour/pixel) */
double
pixel_length
;
/* unit: nanosecond (maximum 1 hour/pixel) */
};
/* TODO: put that function somewhere else (utils.c) */
...
...
@@ -150,6 +151,27 @@ gotit:
return
0
;
}
static
void
scroll
(
void
*
private
,
gui
*
g
,
char
*
notification
,
widget
*
w
,
void
*
notification_data
)
{
struct
time
*
this
=
private
;
double
mul
=
1
.
2
;
double
pixel_length
;
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
if
(
!
strcmp
(
notification
,
"scrollup"
))
mul
=
1
/
mul
;
pixel_length
=
this
->
pixel_length
*
mul
;
if
(
pixel_length
<
1
)
pixel_length
=
1
;
if
(
pixel_length
>
(
double
)
3600
*
1000000000
)
pixel_length
=
(
double
)
3600
*
1000000000
;
this
->
pixel_length
=
pixel_length
;
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
}
view
*
new_view_time
(
int
number_of_seconds
,
float
refresh_rate
,
gui
*
g
,
widget
*
w
)
{
...
...
@@ -168,6 +190,9 @@ view *new_view_time(int number_of_seconds, float refresh_rate,
ret
->
subcount
=
0
;
ret
->
pixel_length
=
10
*
1000000
;
/* 10ms */
register_notifier
(
g
,
"scrollup"
,
w
,
scroll
,
ret
);
register_notifier
(
g
,
"scrolldown"
,
w
,
scroll
,
ret
);
if
(
pthread_mutex_init
(
&
ret
->
lock
,
NULL
))
abort
();
new_thread
(
time_thread
,
ret
);
...
...
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