Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsview
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raptor Engineering Public Development
dsview
Commits
bad63a6e
Commit
bad63a6e
authored
Apr 19, 2015
by
DreamSourceLab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix measure pricision issue @ LA mode
parent
153d1f9e
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
463 additions
and
732 deletions
+463
-732
.gitignore
.gitignore
+7
-5
DSView/pv/data/logicsnapshot.cpp
DSView/pv/data/logicsnapshot.cpp
+226
-530
DSView/pv/data/logicsnapshot.h
DSView/pv/data/logicsnapshot.h
+4
-8
DSView/pv/dock/measuredock.cpp
DSView/pv/dock/measuredock.cpp
+14
-7
DSView/pv/dock/measuredock.h
DSView/pv/dock/measuredock.h
+2
-1
DSView/pv/mainwindow.cpp
DSView/pv/mainwindow.cpp
+0
-2
DSView/pv/view/cursor.cpp
DSView/pv/view/cursor.cpp
+8
-2
DSView/pv/view/cursor.h
DSView/pv/view/cursor.h
+3
-1
DSView/pv/view/logicsignal.cpp
DSView/pv/view/logicsignal.cpp
+43
-0
DSView/pv/view/logicsignal.h
DSView/pv/view/logicsignal.h
+2
-0
DSView/pv/view/ruler.cpp
DSView/pv/view/ruler.cpp
+28
-11
DSView/pv/view/ruler.h
DSView/pv/view/ruler.h
+3
-0
DSView/pv/view/timemarker.cpp
DSView/pv/view/timemarker.cpp
+24
-6
DSView/pv/view/timemarker.h
DSView/pv/view/timemarker.h
+7
-2
DSView/pv/view/view.cpp
DSView/pv/view/view.cpp
+23
-31
DSView/pv/view/view.h
DSView/pv/view/view.h
+2
-6
DSView/pv/view/viewport.cpp
DSView/pv/view/viewport.cpp
+58
-112
DSView/pv/view/viewport.h
DSView/pv/view/viewport.h
+9
-8
No files found.
.gitignore
View file @
bad63a6e
...
...
@@ -31,16 +31,18 @@ Makefile.in
configure
aclocal.m4
DS
Logic-gui
/ui_*.h
DS
Logic-gui/DSLogic
DS
Logic-gui
/install_manifest.txt
DS
View
/ui_*.h
DS
View/DSView
DS
View
/install_manifest.txt
moc_*.cxx
moc_*.cxx_parameters
libsigrok4DSL
ogic
/version.h
libsigrok4DSL/version.h
libusbx-1.0.18/doc/doxygen.cfg
libusbx-1.0.18/m4/
DSView-prj
libsigrokdecode
build*
DSView/pv/data/logicsnapshot.cpp
View file @
bad63a6e
This diff is collapsed.
Click to expand it.
DSView/pv/data/logicsnapshot.h
View file @
bad63a6e
...
...
@@ -90,15 +90,11 @@ public:
uint64_t
start
,
uint64_t
end
,
float
min_length
,
int
sig_index
);
int
get_first_edge
(
uint64_t
&
edge_index
,
bool
&
edge
,
uint64_t
start
,
uint64_t
end
,
int
sig_index
,
int
edge_type
,
int
flag_index
,
int
flag
);
bool
get_nxt_edge
(
uint64_t
&
index
,
bool
last_sample
,
uint64_t
end
,
float
min_length
,
int
sig_index
);
void
get_edges
(
std
::
vector
<
EdgePair
>
&
edges
,
uint64_t
start
,
uint64_t
end
,
int
sig_index
,
int
edge_type
);
uint64_t
get_min_pulse
(
uint64_t
start
,
uint64_t
end
,
int
sig_index
);
bool
get_pre_edge
(
uint64_t
&
index
,
bool
last_sample
,
float
min_length
,
int
sig_index
);
private:
uint64_t
get_subsample
(
int
level
,
uint64_t
offset
)
const
;
...
...
DSView/pv/dock/measuredock.cpp
View file @
bad63a6e
...
...
@@ -26,6 +26,7 @@
#include "../sigsession.h"
#include "../view/cursor.h"
#include "../view/view.h"
#include "../view/viewport.h"
#include "../view/timemarker.h"
#include "../view/ruler.h"
#include "../view/logicsignal.h"
...
...
@@ -54,9 +55,10 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_mouse_groupBox
=
new
QGroupBox
(
"Mouse measurement"
,
this
);
_fen_checkBox
=
new
QCheckBox
(
"Enable floating measurement"
,
this
);
_fen_checkBox
->
setChecked
(
true
);
_width_label
=
new
QLabel
(
view
.
get_mm_width
(),
this
);
_period_label
=
new
QLabel
(
view
.
get_mm_period
(),
this
);
_freq_label
=
new
QLabel
(
view
.
get_mm_freq
(),
this
);
_width_label
=
new
QLabel
(
"#####"
,
this
);
_period_label
=
new
QLabel
(
"#####"
,
this
);
_freq_label
=
new
QLabel
(
"#####"
,
this
);
_duty_label
=
new
QLabel
(
"#####"
,
this
);
_mouse_layout
=
new
QGridLayout
();
_mouse_layout
->
addWidget
(
_fen_checkBox
,
0
,
0
,
1
,
2
);
...
...
@@ -66,10 +68,13 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_mouse_layout
->
addWidget
(
_period_label
,
2
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
"Frequency: "
,
this
),
3
,
0
);
_mouse_layout
->
addWidget
(
_freq_label
,
3
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
"Duty Cycle: "
,
this
),
4
,
0
);
_mouse_layout
->
addWidget
(
_duty_label
,
4
,
1
);
_mouse_layout
->
addWidget
(
new
QLabel
(
this
),
0
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
this
),
1
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
this
),
2
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
this
),
3
,
2
);
_mouse_layout
->
addWidget
(
new
QLabel
(
this
),
4
,
2
);
_mouse_layout
->
setColumnStretch
(
2
,
1
);
_mouse_groupBox
->
setLayout
(
_mouse_layout
);
...
...
@@ -134,6 +139,7 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
connect
(
_t3_comboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
delta_update
()));
connect
(
_fen_checkBox
,
SIGNAL
(
stateChanged
(
int
)),
&
_view
,
SLOT
(
set_measure_en
(
int
)));
connect
(
_view
.
get_viewport
(),
SIGNAL
(
mouse_measure
()),
this
,
SLOT
(
mouse_measure
()));
}
MeasureDock
::~
MeasureDock
()
...
...
@@ -216,11 +222,12 @@ void MeasureDock::cursor_update()
update
();
}
void
MeasureDock
::
mouse_m
oved
()
void
MeasureDock
::
mouse_m
easure
()
{
_width_label
->
setText
(
_view
.
get_mm_width
());
_period_label
->
setText
(
_view
.
get_mm_period
());
_freq_label
->
setText
(
_view
.
get_mm_freq
());
_width_label
->
setText
(
_view
.
get_viewport
()
->
get_measure
(
"width"
));
_period_label
->
setText
(
_view
.
get_viewport
()
->
get_measure
(
"period"
));
_freq_label
->
setText
(
_view
.
get_viewport
()
->
get_measure
(
"frequency"
));
_duty_label
->
setText
(
_view
.
get_viewport
()
->
get_measure
(
"duty"
));
}
void
MeasureDock
::
cursor_moved
()
...
...
DSView/pv/dock/measuredock.h
View file @
bad63a6e
...
...
@@ -74,7 +74,7 @@ private slots:
public
slots
:
void
cursor_update
();
void
cursor_moved
();
void
mouse_m
oved
();
void
mouse_m
easure
();
private:
SigSession
&
_session
;
...
...
@@ -86,6 +86,7 @@ private:
QLabel
*
_width_label
;
QLabel
*
_period_label
;
QLabel
*
_freq_label
;
QLabel
*
_duty_label
;
QGridLayout
*
_cursor_layout
;
QGroupBox
*
_cursor_groupBox
;
...
...
DSView/pv/mainwindow.cpp
View file @
bad63a6e
...
...
@@ -244,8 +244,6 @@ void MainWindow::setup_ui()
SLOT
(
cursor_update
()));
connect
(
_view
,
SIGNAL
(
cursor_moved
()),
_measure_widget
,
SLOT
(
cursor_moved
()));
connect
(
_view
,
SIGNAL
(
mouse_moved
()),
_measure_widget
,
SLOT
(
mouse_moved
()));
connect
(
_view
,
SIGNAL
(
mode_changed
()),
this
,
SLOT
(
update_device_list
()));
...
...
DSView/pv/view/cursor.cpp
View file @
bad63a6e
...
...
@@ -51,8 +51,14 @@ const int Cursor::ArrowSize = 10;
const
int
Cursor
::
CloseSize
=
10
;
Cursor
::
Cursor
(
View
&
view
,
QColor
color
,
double
time
)
:
TimeMarker
(
view
,
color
,
time
),
Cursor
::
Cursor
(
View
&
view
,
QColor
color
,
uint64_t
index
)
:
TimeMarker
(
view
,
color
,
index
),
_other
(
*
this
)
{
}
Cursor
::
Cursor
(
View
&
view
,
QColor
color
)
:
TimeMarker
(
view
,
color
),
_other
(
*
this
)
{
}
...
...
DSView/pv/view/cursor.h
View file @
bad63a6e
...
...
@@ -55,7 +55,9 @@ public:
* @param time The time to set the flag to.
* @param other A reference to the other cursor.
*/
Cursor
(
View
&
view
,
QColor
color
,
double
time
);
Cursor
(
View
&
view
,
QColor
color
);
Cursor
(
View
&
view
,
QColor
color
,
uint64_t
index
);
public:
/**
...
...
DSView/pv/view/logicsignal.cpp
View file @
bad63a6e
...
...
@@ -273,5 +273,48 @@ void LogicSignal::paint_type_options(QPainter &p, int right, bool hover, int act
edgeTrig_rect
.
right
()
-
5
,
edgeTrig_rect
.
bottom
()
-
5
);
}
bool
LogicSignal
::
measure
(
const
QPointF
&
p
,
uint64_t
&
index0
,
uint64_t
&
index1
,
uint64_t
&
index2
)
const
{
const
float
gap
=
abs
(
p
.
y
()
-
get_y
());
if
(
gap
<
get_signalHeight
()
*
0.5
)
{
const
deque
<
boost
::
shared_ptr
<
pv
::
data
::
LogicSnapshot
>
>
&
snapshots
=
_data
->
get_snapshots
();
if
(
snapshots
.
empty
())
return
false
;
const
boost
::
shared_ptr
<
pv
::
data
::
LogicSnapshot
>
&
snapshot
=
snapshots
.
front
();
if
(
snapshot
->
buf_null
())
return
false
;
uint64_t
index
=
_data
->
samplerate
()
*
(
_view
->
offset
()
-
_data
->
get_start_time
()
+
p
.
x
()
*
_view
->
scale
());
if
(
index
==
0
)
return
false
;
const
uint64_t
sig_mask
=
1ULL
<<
get_index
();
bool
sample
=
snapshot
->
get_sample
(
index
)
&
sig_mask
;
index
--
;
if
(
!
snapshot
->
get_pre_edge
(
index
,
sample
,
1
,
get_index
()))
return
false
;
index0
=
index
;
sample
=
snapshot
->
get_sample
(
index
)
&
sig_mask
;
index
++
;
if
(
!
snapshot
->
get_nxt_edge
(
index
,
sample
,
snapshot
->
get_sample_count
(),
1
,
get_index
()))
return
false
;
index1
=
index
;
sample
=
snapshot
->
get_sample
(
index
)
&
sig_mask
;
index
++
;
if
(
!
snapshot
->
get_nxt_edge
(
index
,
sample
,
snapshot
->
get_sample_count
(),
1
,
get_index
()))
index2
=
0
;
else
index2
=
index
;
return
true
;
}
return
false
;
}
}
// namespace view
}
// namespace pv
DSView/pv/view/logicsignal.h
View file @
bad63a6e
...
...
@@ -76,6 +76,8 @@ public:
const
std
::
vector
<
std
::
pair
<
uint64_t
,
bool
>
>
cur_edges
()
const
;
bool
measure
(
const
QPointF
&
p
,
uint64_t
&
index0
,
uint64_t
&
index1
,
uint64_t
&
index2
)
const
;
protected:
void
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
);
...
...
DSView/pv/view/ruler.cpp
View file @
bad63a6e
...
...
@@ -134,6 +134,29 @@ QString Ruler::format_time(double t)
return
format_time
(
t
,
_cur_prefix
);
}
QString
Ruler
::
format_real_time
(
uint64_t
delta_index
,
uint64_t
sample_rate
)
{
uint64_t
delta_time
=
delta_index
*
std
::
pow
(
10
,
12
)
/
sample_rate
;
if
(
delta_time
==
0
)
return
"0"
;
int
zero
=
0
;
int
prefix
=
(
int
)
floor
(
log10
(
delta_time
));
while
(
delta_time
==
(
delta_time
/
10
*
10
))
{
delta_time
/=
10
;
zero
++
;
}
return
format_time
(
delta_time
*
1.0
f
/
std
::
pow
(
10
,
12
-
zero
),
prefix
/
3
+
1
,
prefix
/
3
*
3
>
zero
?
prefix
/
3
*
3
-
zero
:
0
);
}
QString
Ruler
::
format_real_freq
(
uint64_t
delta_index
,
uint64_t
sample_rate
)
{
const
double
delta_period
=
delta_index
*
1.0
f
/
sample_rate
;
return
format_freq
(
delta_period
);
}
TimeMarker
*
Ruler
::
get_grabbed_cursor
()
{
return
_grabbed_marker
;
...
...
@@ -182,8 +205,8 @@ void Ruler::mouseMoveEvent(QMouseEvent *e)
(
void
)
e
;
if
(
_grabbed_marker
)
{
_grabbed_marker
->
set_
time
(
_view
.
offset
()
+
_view
.
hover_point
().
x
()
*
_view
.
scale
());
_grabbed_marker
->
set_
index
(
(
_view
.
offset
()
+
_view
.
hover_point
().
x
()
*
_view
.
scale
())
*
_view
.
session
().
get_device
()
->
get_sample_rate
())
;
}
update
();
...
...
@@ -242,19 +265,17 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event)
_cursor_sel_visible
=
true
;
}
else
{
int
overCursor
;
double
time
=
_view
.
offset
()
+
(
_cursor_sel_x
+
0.5
)
*
_view
.
scal
e
();
uint64_t
index
=
(
_view
.
offset
()
+
(
_cursor_sel_x
+
0.5
)
*
_view
.
scale
())
*
_view
.
session
().
get_device
()
->
get_sample_rat
e
();
overCursor
=
in_cursor_sel_rect
(
event
->
pos
());
if
(
overCursor
==
0
)
{
//Cursor *newCursor = new Cursor(_view, CursorColor[_view.get_cursorList().size() % 8], time);
//_view.get_cursorList().push_back(newCursor);
_view
.
add_cursor
(
CursorColor
[
_view
.
get_cursorList
().
size
()
%
8
],
time
);
_view
.
add_cursor
(
CursorColor
[
_view
.
get_cursorList
().
size
()
%
8
],
index
);
_view
.
show_cursors
(
true
);
addCursor
=
true
;
}
else
if
(
overCursor
>
0
)
{
list
<
Cursor
*>::
iterator
i
=
_view
.
get_cursorList
().
begin
();
while
(
--
overCursor
!=
0
)
i
++
;
(
*
i
)
->
set_
time
(
time
);
(
*
i
)
->
set_
index
(
index
);
}
_cursor_sel_visible
=
false
;
}
...
...
@@ -262,10 +283,6 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event)
int
overCursor
;
overCursor
=
in_cursor_sel_rect
(
event
->
pos
());
if
(
overCursor
>
0
)
{
// list<Cursor*>::iterator i = _view.get_cursorList().begin();
// while (--overCursor != 0)
// i++;
// _view.set_scale_offset(_view.scale(), (*i)->time() - _view.scale() * _view.viewport()->width() / 2);
_view
.
set_cursor_middle
(
overCursor
-
1
);
}
...
...
DSView/pv/view/ruler.h
View file @
bad63a6e
...
...
@@ -25,6 +25,7 @@
#define DSVIEW_PV_VIEW_RULER_H
#include <QWidget>
#include <stdint.h>
namespace
pv
{
namespace
view
{
...
...
@@ -66,6 +67,8 @@ public:
unsigned
precision
=
pricision
);
static
QString
format_freq
(
double
period
,
unsigned
precision
=
pricision
);
QString
format_time
(
double
t
);
static
QString
format_real_time
(
uint64_t
delta_index
,
uint64_t
sample_rate
);
static
QString
format_real_freq
(
uint64_t
delta_index
,
uint64_t
sample_rate
);
TimeMarker
*
get_grabbed_cursor
();
void
set_grabbed_cursor
(
TimeMarker
*
grabbed_marker
);
...
...
DSView/pv/view/timemarker.cpp
View file @
bad63a6e
...
...
@@ -24,6 +24,7 @@
#include "timemarker.h"
#include "view.h"
#include "../device/device.h"
#include <QPainter>
...
...
@@ -31,18 +32,29 @@ namespace pv {
namespace
view
{
TimeMarker
::
TimeMarker
(
View
&
view
,
QColor
&
colour
,
double
time
)
:
uint64_t
index
)
:
_view
(
view
),
_time
(
time
),
_grabbed
(
false
),
_time
(
index
*
1.0
f
/
view
.
session
().
get_device
()
->
get_sample_rate
()),
_index
(
index
),
_grabbed
(
false
),
_colour
(
colour
)
{
}
TimeMarker
::
TimeMarker
(
View
&
view
,
QColor
&
colour
)
:
_view
(
view
),
_time
(
0
),
_index
(
0
),
_grabbed
(
false
),
_colour
(
colour
)
{
}
TimeMarker
::
TimeMarker
(
const
TimeMarker
&
s
)
:
QObject
(),
_view
(
s
.
_view
),
_time
(
s
.
_time
),
_index
(
s
.
_index
),
_colour
(
s
.
_colour
)
{
}
...
...
@@ -61,10 +73,16 @@ double TimeMarker::time() const
return
_time
;
}
void
TimeMarker
::
set_time
(
double
time
)
uint64_t
TimeMarker
::
index
()
const
{
return
_index
;
}
void
TimeMarker
::
set_index
(
uint64_t
index
)
{
_time
=
time
;
time_changed
();
_index
=
index
;
_time
=
index
*
1.0
f
/
_view
.
session
().
get_device
()
->
get_sample_rate
();
time_changed
();
}
void
TimeMarker
::
paint
(
QPainter
&
p
,
const
QRect
&
rect
,
const
bool
highlight
)
...
...
DSView/pv/view/timemarker.h
View file @
bad63a6e
...
...
@@ -28,6 +28,8 @@
#include <QObject>
#include <QRectF>
#include <stdint.h>
class
QPainter
;
class
QRect
;
...
...
@@ -47,7 +49,8 @@ protected:
* @param colour A reference to the colour of this cursor.
* @param time The time to set the flag to.
*/
TimeMarker
(
View
&
view
,
QColor
&
colour
,
double
time
);
TimeMarker
(
View
&
view
,
QColor
&
colour
,
uint64_t
index
);
TimeMarker
(
View
&
view
,
QColor
&
colour
);
/**
* Copy constructor
...
...
@@ -59,11 +62,12 @@ public:
* Gets the time of the marker.
*/
double
time
()
const
;
uint64_t
index
()
const
;
/**
* Sets the time of the marker.
*/
void
set_time
(
double
time
);
void
set_index
(
uint64_t
index
);
/*
*
...
...
@@ -104,6 +108,7 @@ protected:
View
&
_view
;
double
_time
;
uint64_t
_index
;
QSizeF
_text_size
;
...
...
DSView/pv/view/view.cpp
View file @
bad63a6e
...
...
@@ -125,10 +125,10 @@ View::View(SigSession &session, pv::toolbars::SamplingBar *sampling_bar, QWidget
_header
->
setObjectName
(
tr
(
"ViewArea_header"
));
_show_trig_cursor
=
false
;
_trig_cursor
=
new
Cursor
(
*
this
,
Trace
::
dsLightRed
,
0
);
_trig_cursor
=
new
Cursor
(
*
this
,
Trace
::
dsLightRed
);
_show_search_cursor
=
false
;
_search_pos
=
0
;
_search_cursor
=
new
Cursor
(
*
this
,
Trace
::
dsLightBlue
,
_search_pos
);
_search_cursor
=
new
Cursor
(
*
this
,
Trace
::
dsLightBlue
);
}
SigSession
&
View
::
session
()
...
...
@@ -343,7 +343,7 @@ void View::set_trig_pos(quint64 trig_pos)
{
const
double
time
=
trig_pos
*
1.0
f
/
_session
.
get_device
()
->
get_sample_rate
();
_trig_pos
=
trig_pos
;
_trig_cursor
->
set_
time
(
time
);
_trig_cursor
->
set_
index
(
trig_pos
);
_show_trig_cursor
=
true
;
set_scale_offset
(
_scale
,
time
-
_scale
*
get_view_width
()
/
2
);
_ruler
->
update
();
...
...
@@ -356,7 +356,7 @@ void View::set_search_pos(uint64_t search_pos)
const
double
time
=
search_pos
*
1.0
f
/
_session
.
get_device
()
->
get_sample_rate
();
_search_pos
=
search_pos
;
_search_cursor
->
set_
time
(
time
);
_search_cursor
->
set_
index
(
search_pos
);
set_scale_offset
(
_scale
,
time
-
_scale
*
get_view_width
()
/
2
);
_ruler
->
update
();
_viewport
->
update
();
...
...
@@ -464,8 +464,7 @@ void View::update_scale()
_preScale
=
_scale
;
_preOffset
=
_offset
;
const
double
time
=
_trig_pos
*
1.0
f
/
sample_rate
;
_trig_cursor
->
set_time
(
time
);
_trig_cursor
->
set_index
(
_trig_pos
);
_ruler
->
update
();
_viewport
->
update
();
...
...
@@ -697,9 +696,9 @@ Ruler* View::get_ruler()
return
_ruler
;
}
void
View
::
add_cursor
(
QColor
color
,
double
time
)
void
View
::
add_cursor
(
QColor
color
,
uint64_t
index
)
{
Cursor
*
newCursor
=
new
Cursor
(
*
this
,
color
,
time
);
Cursor
*
newCursor
=
new
Cursor
(
*
this
,
color
,
index
);
_cursorList
.
push_back
(
newCursor
);
cursor_update
();
}
...
...
@@ -728,24 +727,14 @@ void View::receive_data(quint64 length)
_viewport
->
set_receive_len
(
length
);
}
QString
View
::
get_mm_width
()
Viewport
*
View
::
get_viewport
()
{
return
_viewport
->
get_mm_width
();
}
QString
View
::
get_mm_period
()
{
return
_viewport
->
get_mm_period
();
}
QString
View
::
get_mm_freq
()
{
return
_viewport
->
get_mm_freq
();
return
_viewport
;
}
QString
View
::
get_cm_time
(
int
index
)
{
return
_ruler
->
format_
time
(
get_cursor_time
(
index
));
return
_ruler
->
format_
real_time
(
get_cursor_samples
(
index
),
_session
.
get_device
()
->
get_sample_rate
(
));
}
QString
View
::
get_cm_delta
(
int
index1
,
int
index2
)
...
...
@@ -753,8 +742,10 @@ QString View::get_cm_delta(int index1, int index2)
if
(
index1
==
index2
)
return
"0"
;
return
_ruler
->
format_time
(
abs
(
get_cursor_time
(
index1
)
-
get_cursor_time
(
index2
)));
uint64_t
samples1
=
get_cursor_samples
(
index1
);
uint64_t
samples2
=
get_cursor_samples
(
index2
);
uint64_t
delta_sample
=
(
samples1
>
samples2
)
?
samples1
-
samples2
:
samples2
-
samples1
;
return
_ruler
->
format_real_time
(
delta_sample
,
_session
.
get_device
()
->
get_sample_rate
());
}
double
View
::
get_cursor_time
(
int
index
)
...
...
@@ -773,17 +764,18 @@ double View::get_cursor_time(int index)
uint64_t
View
::
get_cursor_samples
(
int
index
)
{
const
double
time
=
get_cursor_time
(
index
);
const
uint64_t
sample_rate
=
_session
.
get_device
()
->
get_sample_limit
();
assert
(
sample_rate
!=
0
);
assert
(
index
<
(
int
)
_cursorList
.
size
());
return
time
*
sample_rate
;
int
curIndex
=
0
;
for
(
list
<
Cursor
*>::
iterator
i
=
_cursorList
.
begin
();
i
!=
_cursorList
.
end
();
i
++
)
{
if
(
index
==
curIndex
)
{
return
(
*
i
)
->
index
();
}
curIndex
++
;
}
}
void
View
::
on_mouse_moved
()
{
mouse_moved
();
}
void
View
::
on_cursor_moved
()
{
cursor_moved
();
...
...
DSView/pv/view/view.h
View file @
bad63a6e
...
...
@@ -140,7 +140,7 @@ public:
* cursorList
*/
std
::
list
<
Cursor
*>&
get_cursorList
();
void
add_cursor
(
QColor
color
,
double
time
);
void
add_cursor
(
QColor
color
,
uint64_t
index
);
void
del_cursor
(
Cursor
*
cursor
);
void
set_cursor_middle
(
int
index
);
...
...
@@ -163,13 +163,10 @@ public:
bool
need_update
()
const
;
uint64_t
get_cursor_samples
(
int
index
);
QString
get_mm_width
();
QString
get_mm_period
();
QString
get_mm_freq
();
Viewport
*
get_viewport
();
QString
get_cm_time
(
int
index
);
QString
get_cm_delta
(
int
index1
,
int
index2
);
void
on_mouse_moved
();
void
on_cursor_moved
();
void
on_state_changed
(
bool
stop
);
...
...
@@ -189,7 +186,6 @@ signals:
void
cursor_update
();
void
mouse_moved
();
void
cursor_moved
();
void
mode_changed
();
...
...
DSView/pv/view/viewport.cpp
View file @
bad63a6e
This diff is collapsed.
Click to expand it.
DSView/pv/view/viewport.h
View file @
bad63a6e
...
...
@@ -47,7 +47,6 @@ class Viewport : public QWidget
public:
static
const
int
HitCursorMargin
=
10
;
static
const
double
HitCursorTimeMargin
=
0.3
;
public:
explicit
Viewport
(
View
&
parent
);
...
...
@@ -58,9 +57,7 @@ public:
void
set_receive_len
(
quint64
length
);
QString
get_mm_width
();
QString
get_mm_period
();
QString
get_mm_freq
();
QString
get_measure
(
QString
option
);
void
set_measure_en
(
int
enable
);
...
...
@@ -88,6 +85,9 @@ private slots:
void
on_traces_moved
();
void
on_trigger_timer
();
signals:
void
mouse_measure
();
private:
View
&
_view
;
...
...
@@ -109,13 +109,14 @@ private:
uint64_t
_cur_sample
;
uint64_t
_nxt_sample
;
uint64_t
_thd_sample
;
int64_t
_cur_preX
;
int64_t
_cur_aftX
;
int64_t
_cur_thdX
;
int64_t
_cur_midY
;
double
_cur_preX
;
double
_cur_aftX
;
double
_cur_thdX
;
double
_cur_midY
;
QString
_mm_width
;
QString
_mm_period
;
QString
_mm_freq
;
QString
_mm_duty
;
QTimer
trigger_timer
;
bool
triggered
;
...
...
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