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
df05c5c9
Commit
df05c5c9
authored
Oct 24, 2015
by
DreamSourceLab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve operations of vDial/hDial
parent
705819fa
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
483 additions
and
356 deletions
+483
-356
DSView/pv/mainwindow.cpp
DSView/pv/mainwindow.cpp
+13
-2
DSView/pv/sigsession.cpp
DSView/pv/sigsession.cpp
+10
-5
DSView/pv/view/decodetrace.cpp
DSView/pv/view/decodetrace.cpp
+16
-4
DSView/pv/view/decodetrace.h
DSView/pv/view/decodetrace.h
+8
-1
DSView/pv/view/dsldial.cpp
DSView/pv/view/dsldial.cpp
+17
-3
DSView/pv/view/dsldial.h
DSView/pv/view/dsldial.h
+1
-1
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsosignal.cpp
+190
-22
DSView/pv/view/dsosignal.h
DSView/pv/view/dsosignal.h
+24
-1
DSView/pv/view/groupsignal.cpp
DSView/pv/view/groupsignal.cpp
+16
-4
DSView/pv/view/groupsignal.h
DSView/pv/view/groupsignal.h
+8
-1
DSView/pv/view/header.cpp
DSView/pv/view/header.cpp
+11
-120
DSView/pv/view/logicsignal.cpp
DSView/pv/view/logicsignal.cpp
+106
-25
DSView/pv/view/logicsignal.h
DSView/pv/view/logicsignal.h
+22
-2
DSView/pv/view/trace.cpp
DSView/pv/view/trace.cpp
+30
-138
DSView/pv/view/trace.h
DSView/pv/view/trace.h
+11
-27
No files found.
DSView/pv/mainwindow.cpp
View file @
df05c5c9
...
...
@@ -71,6 +71,7 @@
#include "view/trace.h"
#include "view/signal.h"
#include "view/dsosignal.h"
#include "view/logicsignal.h"
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
#define __STDC_FORMAT_MACROS
...
...
@@ -680,7 +681,12 @@ bool MainWindow::load_session(QString name)
if
((
s
->
get_index
()
==
obj
[
"index"
].
toDouble
())
&&
(
s
->
get_type
()
==
obj
[
"type"
].
toDouble
()))
{
s
->
set_colour
(
QColor
(
obj
[
"colour"
].
toString
()));
s
->
set_trig
(
obj
[
"strigger"
].
toDouble
());
boost
::
shared_ptr
<
view
::
LogicSignal
>
logicSig
;
if
(
logicSig
=
dynamic_pointer_cast
<
view
::
LogicSignal
>
(
s
))
{
logicSig
->
set_trig
(
obj
[
"strigger"
].
toDouble
());
}
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
s
))
{
dsoSig
->
load_settings
();
...
...
@@ -755,7 +761,12 @@ bool MainWindow::store_session(QString name)
s_obj
[
"enabled"
]
=
s
->
enabled
();
s_obj
[
"name"
]
=
s
->
get_name
();
s_obj
[
"colour"
]
=
QJsonValue
::
fromVariant
(
s
->
get_colour
());
s_obj
[
"strigger"
]
=
s
->
get_trig
();
boost
::
shared_ptr
<
view
::
LogicSignal
>
logicSig
;
if
(
logicSig
=
dynamic_pointer_cast
<
view
::
LogicSignal
>
(
s
))
{
s_obj
[
"strigger"
]
=
logicSig
->
get_trig
();
}
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
s
))
{
s_obj
[
"vdiv"
]
=
QJsonValue
::
fromVariant
(
static_cast
<
qulonglong
>
(
dsoSig
->
get_vDialValue
()));
...
...
DSView/pv/sigsession.cpp
View file @
df05c5c9
...
...
@@ -543,9 +543,12 @@ void SigSession::sample_thread_proc(boost::shared_ptr<device::DevInst> dev_inst,
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
view
::
Signal
>
s
,
_signals
)
{
assert
(
s
);
if
(
s
->
get_trig
()
!=
0
)
{
ds_trigger_set_en
(
true
);
s
->
set_trig
(
s
->
get_trig
());
boost
::
shared_ptr
<
view
::
LogicSignal
>
logicSig
;
if
(
logicSig
=
dynamic_pointer_cast
<
view
::
LogicSignal
>
(
s
))
{
if
(
logicSig
->
get_trig
()
!=
0
)
{
ds_trigger_set_en
(
true
);
logicSig
->
set_trig
(
logicSig
->
get_trig
());
}
}
}
}
else
{
...
...
@@ -799,8 +802,10 @@ void SigSession::reload()
std
::
vector
<
boost
::
shared_ptr
<
view
::
Signal
>
>::
iterator
i
=
_signals
.
begin
();
while
(
i
!=
_signals
.
end
())
{
if
((
*
i
)
->
get_index
()
==
probe
->
index
)
{
signal
=
boost
::
shared_ptr
<
view
::
Signal
>
(
new
view
::
LogicSignal
(
**
i
,
_logic_data
,
probe
));
boost
::
shared_ptr
<
view
::
LogicSignal
>
logicSig
;
if
(
logicSig
=
dynamic_pointer_cast
<
view
::
LogicSignal
>
(
*
i
))
signal
=
boost
::
shared_ptr
<
view
::
Signal
>
(
new
view
::
LogicSignal
(
logicSig
,
_logic_data
,
probe
));
break
;
}
i
++
;
...
...
DSView/pv/view/decodetrace.cpp
View file @
df05c5c9
...
...
@@ -821,13 +821,12 @@ int DecodeTrace::rows_size()
return
_decoder_stack
->
cur_rows_size
();
}
void
DecodeTrace
::
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
)
void
DecodeTrace
::
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
)
{
(
void
)
hover
;
(
void
)
action
;
(
void
)
pt
;
int
y
=
get_y
();
const
QRectF
group_index_rect
=
get_rect
(
"groupIndex"
,
y
,
right
);
const
QRectF
group_index_rect
=
get_rect
(
CHNLREG
,
y
,
right
);
QString
index_string
;
int
last_index
;
p
.
setPen
(
Qt
::
transparent
);
...
...
@@ -849,5 +848,18 @@ void DecodeTrace::paint_type_options(QPainter &p, int right, bool hover, int act
p
.
drawText
(
group_index_rect
,
Qt
::
AlignRight
|
Qt
::
AlignVCenter
,
index_string
);
}
QRectF
DecodeTrace
::
get_rect
(
DecodeSetRegions
type
,
int
y
,
int
right
)
{
const
QSizeF
name_size
(
right
-
get_leftWidth
()
-
get_rightWidth
(),
SquareWidth
);
if
(
type
==
CHNLREG
)
return
QRectF
(
get_leftWidth
()
+
name_size
.
width
()
+
Margin
,
y
-
SquareWidth
/
2
,
SquareWidth
*
SquareNum
,
SquareWidth
);
else
return
QRectF
(
0
,
0
,
0
,
0
);
}
}
// namespace view
}
// namespace pv
DSView/pv/view/decodetrace.h
View file @
df05c5c9
...
...
@@ -71,6 +71,11 @@ private:
const
srd_channel
*
_pdch
;
};
enum
DecodeSetRegions
{
NONEREG
=
-
1
,
CHNLREG
,
};
private:
static
const
QColor
DecodeColours
[
4
];
static
const
QColor
ErrorBgColour
;
...
...
@@ -125,8 +130,10 @@ public:
int
rows_size
();
QRectF
get_rect
(
DecodeSetRegions
type
,
int
y
,
int
right
);
protected:
void
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
);
void
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
);
private:
void
create_popup_form
();
...
...
DSView/pv/view/dsldial.cpp
View file @
df05c5c9
...
...
@@ -25,7 +25,7 @@ dslDial::~dslDial()
{
}
void
dslDial
::
paint
(
QPainter
&
p
,
QRectF
dialRect
,
QColor
dialColor
)
void
dslDial
::
paint
(
QPainter
&
p
,
QRectF
dialRect
,
QColor
dialColor
,
bool
hover
,
bool
inc
)
{
p
.
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
p
.
setPen
(
dialColor
);
...
...
@@ -64,8 +64,22 @@ void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor)
}
QString
pText
=
QString
::
number
(
displayValue
)
+
_unit
[
displayIndex
]
+
"/div"
;
QFontMetrics
fm
(
p
.
font
());
p
.
drawText
(
QRectF
(
dialRect
.
left
(),
dialRect
.
bottom
()
-
dialRect
.
width
()
*
0.3
+
fm
.
height
()
*
0.5
,
dialRect
.
width
(),
fm
.
height
()),
Qt
::
AlignCenter
,
pText
);
const
QRectF
valueRect
=
QRectF
(
dialRect
.
left
(),
dialRect
.
bottom
()
-
dialRect
.
width
()
*
0.3
+
fm
.
height
()
*
0.5
,
dialRect
.
width
(),
fm
.
height
());
p
.
drawText
(
valueRect
,
Qt
::
AlignCenter
,
pText
);
// draw +/-
if
(
hover
)
{
const
int
arcInc
=
15
;
const
QRectF
hoverRect
=
QRectF
(
dialRect
.
left
()
-
arcInc
,
dialRect
.
top
()
-
arcInc
,
dialRect
.
width
()
+
arcInc
*
2
,
dialRect
.
height
()
+
arcInc
*
2
);
const
double
arcSpan
=
hoverRect
.
width
()
/
(
2
*
sqrt
(
2
));
p
.
drawArc
(
hoverRect
,
135
*
16
,
-
90
*
16
);
if
(
inc
)
p
.
drawLine
(
hoverRect
.
center
().
x
()
+
arcSpan
,
hoverRect
.
center
().
y
()
-
arcSpan
,
hoverRect
.
center
().
x
()
+
arcSpan
-
4
,
hoverRect
.
center
().
y
()
-
arcSpan
-
10
);
else
p
.
drawLine
(
hoverRect
.
center
().
x
()
-
arcSpan
,
hoverRect
.
center
().
y
()
-
arcSpan
,
hoverRect
.
center
().
x
()
-
arcSpan
+
4
,
hoverRect
.
center
().
y
()
-
arcSpan
-
10
);
}
}
void
dslDial
::
set_sel
(
uint64_t
sel
)
...
...
DSView/pv/view/dsldial.h
View file @
df05c5c9
...
...
@@ -20,7 +20,7 @@ public:
* @param p the QPainter to paint into.
* @param dialRect the rectangle to draw the dial at.
**/
void
paint
(
QPainter
&
p
,
QRectF
dialRect
,
QColor
dialColor
);
void
paint
(
QPainter
&
p
,
QRectF
dialRect
,
QColor
dialColor
,
bool
hover
,
bool
inc
);
// set/get current select
void
set_sel
(
uint64_t
sel
);
...
...
DSView/pv/view/dsosignal.cpp
View file @
df05c5c9
This diff is collapsed.
Click to expand it.
DSView/pv/view/dsosignal.h
View file @
df05c5c9
...
...
@@ -75,6 +75,21 @@ public:
DSO_MS_END
,
};
enum
DsoSetRegions
{
DSO_NONE
=
-
1
,
DSO_VDIAL
,
DSO_HDIAL
,
DSO_VDEC
,
DSO_VINC
,
DSO_HDEC
,
DSO_HINC
,
DSO_CHEN
,
DSO_ACDC
,
DSO_X1
,
DSO_X10
,
DSO_X100
,
};
private:
static
const
uint16_t
MS_RectRad
=
5
;
static
const
uint16_t
MS_IconSize
=
16
;
...
...
@@ -184,8 +199,16 @@ public:
bool
get_ms_en
(
int
index
)
const
;
QString
get_ms_string
(
int
index
)
const
;
QRectF
get_rect
(
DsoSetRegions
type
,
int
y
,
int
right
);
bool
mouse_double_click
(
int
right
,
const
QPoint
pt
);
bool
mouse_press
(
int
right
,
const
QPoint
pt
);
bool
mouse_wheel
(
int
right
,
const
QPoint
pt
,
const
int
shift
);
protected:
void
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
);
void
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
);
private:
void
paint_trace
(
QPainter
&
p
,
...
...
DSView/pv/view/groupsignal.cpp
View file @
df05c5c9
...
...
@@ -196,13 +196,12 @@ const std::vector< std::pair<uint64_t, bool> > GroupSignal::cur_edges() const
}
void
GroupSignal
::
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
)
void
GroupSignal
::
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
)
{
(
void
)
hover
;
(
void
)
action
;
(
void
)
pt
;
int
y
=
get_y
();
const
QRectF
group_index_rect
=
get_rect
(
"groupIndex"
,
y
,
right
);
const
QRectF
group_index_rect
=
get_rect
(
CHNLREG
,
y
,
right
);
QString
index_string
;
int
last_index
;
p
.
setPen
(
Qt
::
transparent
);
...
...
@@ -224,5 +223,18 @@ void GroupSignal::paint_type_options(QPainter &p, int right, bool hover, int act
p
.
drawText
(
group_index_rect
,
Qt
::
AlignRight
|
Qt
::
AlignVCenter
,
index_string
);
}
QRectF
GroupSignal
::
get_rect
(
GroupSetRegions
type
,
int
y
,
int
right
)
{
const
QSizeF
name_size
(
right
-
get_leftWidth
()
-
get_rightWidth
(),
SquareWidth
);
if
(
type
==
CHNLREG
)
return
QRectF
(
get_leftWidth
()
+
name_size
.
width
()
+
Margin
,
y
-
SquareWidth
/
2
,
SquareWidth
*
SquareNum
,
SquareWidth
);
else
return
QRectF
(
0
,
0
,
0
,
0
);
}
}
// namespace view
}
// namespace pv
DSView/pv/view/groupsignal.h
View file @
df05c5c9
...
...
@@ -48,6 +48,11 @@ private:
static
const
float
EnvelopeThreshold
;
enum
GroupSetRegions
{
NONEREG
=
-
1
,
CHNLREG
,
};
public:
GroupSignal
(
QString
name
,
boost
::
shared_ptr
<
pv
::
data
::
Group
>
data
,
...
...
@@ -74,8 +79,10 @@ public:
const
std
::
vector
<
std
::
pair
<
uint64_t
,
bool
>
>
cur_edges
()
const
;
QRectF
get_rect
(
GroupSetRegions
type
,
int
y
,
int
right
);
protected:
void
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
);
void
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
);
private:
void
paint_trace
(
QPainter
&
p
,
...
...
DSView/pv/view/header.cpp
View file @
df05c5c9
...
...
@@ -118,7 +118,6 @@ void Header::paintEvent(QPaintEvent*)
style
()
->
drawPrimitive
(
QStyle
::
PE_Widget
,
&
o
,
&
painter
,
this
);
const
int
w
=
width
();
int
action
=
0
;
const
vector
<
boost
::
shared_ptr
<
Trace
>
>
traces
(
_view
.
get_traces
());
...
...
@@ -129,11 +128,7 @@ void Header::paintEvent(QPaintEvent*)
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
assert
(
t
);
const
int
y
=
t
->
get_y
();
const
bool
highlight
=
!
dragging
&&
(
action
=
t
->
pt_in_rect
(
y
,
w
,
_mouse_point
));
t
->
paint_label
(
painter
,
w
,
highlight
,
action
);
t
->
paint_label
(
painter
,
w
,
dragging
?
QPoint
(
-
1
,
-
1
)
:
_mouse_point
);
}
painter
.
end
();
...
...
@@ -157,14 +152,9 @@ void Header::mouseDoubleClickEvent(QMouseEvent *event)
make_pair
(
t
,
t
->
get_v_offset
()));
// Select the Trace if it has been clicked
const
boost
::
shared_ptr
<
Trace
>
mTrace
=
get_mTrace
(
action
,
event
->
pos
());
if
(
action
==
Trace
::
LABEL
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
dsoSig
->
auto_set
();
}
}
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
if
(
t
->
mouse_double_click
(
width
(),
event
->
pos
()))
break
;
}
}
...
...
@@ -213,93 +203,12 @@ void Header::mousePressEvent(QMouseEvent *event)
}
}
mTrace
->
set_old_v_offset
(
mTrace
->
get_v_offset
());
}
else
if
(
action
==
Trace
::
POSTRIG
&&
mTrace
)
{
if
(
mTrace
->
get_trig
()
==
Trace
::
POSTRIG
)
mTrace
->
set_trig
(
0
);
else
mTrace
->
set_trig
(
Trace
::
POSTRIG
);
}
else
if
(
action
==
Trace
::
HIGTRIG
&&
mTrace
)
{
if
(
mTrace
->
get_trig
()
==
Trace
::
HIGTRIG
)
mTrace
->
set_trig
(
0
);
else
mTrace
->
set_trig
(
Trace
::
HIGTRIG
);
}
else
if
(
action
==
Trace
::
NEGTRIG
&&
mTrace
)
{
if
(
mTrace
->
get_trig
()
==
Trace
::
NEGTRIG
)
mTrace
->
set_trig
(
0
);
else
mTrace
->
set_trig
(
Trace
::
NEGTRIG
);
}
else
if
(
action
==
Trace
::
LOWTRIG
&&
mTrace
)
{
if
(
mTrace
->
get_trig
()
==
Trace
::
LOWTRIG
)
mTrace
->
set_trig
(
0
);
else
mTrace
->
set_trig
(
Trace
::
LOWTRIG
);
}
else
if
(
action
==
Trace
::
EDGETRIG
&&
mTrace
)
{
if
(
mTrace
->
get_trig
()
==
Trace
::
EDGETRIG
)
mTrace
->
set_trig
(
0
);
else
mTrace
->
set_trig
(
Trace
::
EDGETRIG
);
}
else
if
(
action
==
Trace
::
VDIAL
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
set_hDialActive
(
false
);
if
(
t
!=
mTrace
)
{
dsoSig
->
set_vDialActive
(
false
);
}
}
}
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
dsoSig
->
set_vDialActive
(
!
dsoSig
->
get_vDialActive
());
}
else
if
(
action
==
Trace
::
HDIAL
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
if
(
dsoSig
->
get_hDialActive
())
{
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
set_vDialActive
(
false
);
dsoSig
->
set_hDialActive
(
false
);
}
}
}
else
{
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
dsoSig
->
set_vDialActive
(
false
);
dsoSig
->
set_hDialActive
(
true
);
}
}
}
}
}
else
if
(
action
==
Trace
::
CHEN
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
if
(
!
_view
.
session
().
get_data_lock
())
dsoSig
->
set_enable
(
!
dsoSig
->
enabled
());
}
}
else
if
(
action
==
Trace
::
ACDC
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
if
(
strcmp
(
_view
.
session
().
get_device
()
->
dev_inst
()
->
driver
->
name
,
"DSLogic"
)
==
0
)
dsoSig
->
set_acCoupling
((
dsoSig
->
get_acCoupling
()
+
1
)
%
2
);
else
dsoSig
->
set_acCoupling
((
dsoSig
->
get_acCoupling
()
+
1
)
%
3
);
}
}
else
if
(
action
==
Trace
::
X1
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
dsoSig
->
set_factor
(
1
);
}
}
else
if
(
action
==
Trace
::
X10
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
dsoSig
->
set_factor
(
10
);
}
}
else
if
(
action
==
Trace
::
X100
&&
mTrace
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
mTrace
))
{
dsoSig
->
set_factor
(
100
);
}
}
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
if
(
t
->
mouse_press
(
width
(),
event
->
pos
()))
break
;
if
(
~
QApplication
::
keyboardModifiers
()
&
Qt
::
ControlModifier
)
{
// Unselect all other Traces because the Ctrl is not
// pressed
...
...
@@ -350,27 +259,9 @@ void Header::wheelEvent(QWheelEvent *event)
_view
.
get_traces
());
// Vertical scrolling
double
shift
=
event
->
delta
()
/
20.0
;
bool
setted
=
false
;
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
{
boost
::
shared_ptr
<
view
::
DsoSignal
>
dsoSig
;
if
(
dsoSig
=
dynamic_pointer_cast
<
view
::
DsoSignal
>
(
t
))
{
if
(
dsoSig
->
get_vDialActive
())
{
if
(
shift
>
1.0
)
dsoSig
->
go_vDialNext
();
else
if
(
shift
<
-
1.0
)
dsoSig
->
go_vDialPre
();
break
;
}
else
if
(
dsoSig
->
get_hDialActive
()){
if
(
shift
>
1.0
)
dsoSig
->
go_hDialNext
(
setted
);
else
if
(
shift
<
-
1.0
)
dsoSig
->
go_hDialPre
(
setted
);
else
break
;
setted
=
true
;
}
}
}
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
Trace
>
t
,
traces
)
if
(
t
->
mouse_wheel
(
width
(),
event
->
pos
(),
shift
))
break
;
update
();
}
}
...
...
DSView/pv/view/logicsignal.cpp
View file @
df05c5c9
...
...
@@ -70,16 +70,18 @@ LogicSignal::LogicSignal(boost::shared_ptr<pv::device::DevInst> dev_inst,
boost
::
shared_ptr
<
data
::
Logic
>
data
,
const
sr_channel
*
const
probe
)
:
Signal
(
dev_inst
,
probe
,
SR_CHANNEL_LOGIC
),
_data
(
data
)
_data
(
data
),
_trig
(
NONTRIG
)
{
_colour
=
SignalColours
[
probe
->
index
%
countof
(
SignalColours
)];
}
LogicSignal
::
LogicSignal
(
const
Signal
&
s
,
LogicSignal
::
LogicSignal
(
boost
::
shared_ptr
<
view
::
LogicSignal
>
s
,
boost
::
shared_ptr
<
pv
::
data
::
Logic
>
data
,
const
sr_channel
*
const
probe
)
:
Signal
(
s
,
probe
),
_data
(
data
)
Signal
(
*
s
.
get
(),
probe
),
_data
(
data
),
_trig
(
s
->
get_trig
())
{
}
...
...
@@ -103,6 +105,32 @@ boost::shared_ptr<pv::data::Logic> LogicSignal::logic_data() const
return
_data
;
}
LogicSignal
::
LogicSetRegions
LogicSignal
::
get_trig
()
const
{
return
_trig
;
}
void
LogicSignal
::
set_trig
(
int
trig
)
{
if
(
trig
>
NONTRIG
&&
trig
<=
EDGTRIG
)
_trig
=
(
LogicSetRegions
)
trig
;
else
_trig
=
NONTRIG
;
if
(
trig
==
NONTRIG
)
ds_trigger_probe_set
(
_index_list
.
front
(),
'X'
,
'X'
);
else
if
(
trig
==
POSTRIG
)
ds_trigger_probe_set
(
_index_list
.
front
(),
'R'
,
'X'
);
else
if
(
trig
==
HIGTRIG
)
ds_trigger_probe_set
(
_index_list
.
front
(),
'1'
,
'X'
);
else
if
(
trig
==
NEGTRIG
)
ds_trigger_probe_set
(
_index_list
.
front
(),
'F'
,
'X'
);
else
if
(
trig
==
LOWTRIG
)
ds_trigger_probe_set
(
_index_list
.
front
(),
'0'
,
'X'
);
else
if
(
trig
==
EDGTRIG
)
ds_trigger_probe_set
(
_index_list
.
front
(),
'C'
,
'X'
);
}
void
LogicSignal
::
paint_mid
(
QPainter
&
p
,
int
left
,
int
right
)
{
using
pv
::
view
::
View
;
...
...
@@ -205,35 +233,30 @@ const std::vector< std::pair<uint64_t, bool> > LogicSignal::cur_edges() const
return
_cur_edges
;
}
void
LogicSignal
::
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
)
void
LogicSignal
::
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
)
{
int
y
=
get_y
();
const
QRectF
posTrig_rect
=
get_rect
(
"posTrig"
,
y
,
right
);
const
QRectF
higTrig_rect
=
get_rect
(
"higTrig"
,
y
,
right
);
const
QRectF
negTrig_rect
=
get_rect
(
"negTrig"
,
y
,
right
);
const
QRectF
lowTrig_rect
=
get_rect
(
"lowTrig"
,
y
,
right
);
const
QRectF
edgeTrig_rect
=
get_rect
(
"edgeTrig"
,
y
,
right
);
const
QRectF
posTrig_rect
=
get_rect
(
POSTRIG
,
y
,
right
);
const
QRectF
higTrig_rect
=
get_rect
(
HIGTRIG
,
y
,
right
);
const
QRectF
negTrig_rect
=
get_rect
(
NEGTRIG
,
y
,
right
);
const
QRectF
lowTrig_rect
=
get_rect
(
LOWTRIG
,
y
,
right
);
const
QRectF
edgeTrig_rect
=
get_rect
(
EDGTRIG
,
y
,
right
);
p
.
setPen
(
Qt
::
transparent
);
p
.
setBrush
(((
hover
&&
action
==
POSTRIG
)
||
(
_trig
==
POSTRIG
))
?
dsYellow
:
dsBlue
);
p
.
setBrush
(
posTrig_rect
.
contains
(
pt
)
?
dsYellow
.
darker
()
:
(
_trig
==
POSTRIG
)
?
dsYellow
:
dsBlue
);
p
.
drawRect
(
posTrig_rect
);
p
.
setBrush
(((
hover
&&
action
==
HIGTRIG
)
||
(
_trig
==
HIGTRIG
))
?
dsYellow
:
dsBlue
);
p
.
setBrush
(
higTrig_rect
.
contains
(
pt
)
?
dsYellow
.
darker
()
:
(
_trig
==
HIGTRIG
)
?
dsYellow
:
dsBlue
);
p
.
drawRect
(
higTrig_rect
);
p
.
setBrush
(((
hover
&&
action
==
NEGTRIG
)
||
(
_trig
==
NEGTRIG
))
?
dsYellow
:
dsBlue
);
p
.
setBrush
(
negTrig_rect
.
contains
(
pt
)
?
dsYellow
.
darker
()
:
(
_trig
==
NEGTRIG
)
?
dsYellow
:
dsBlue
);
p
.
drawRect
(
negTrig_rect
);
p
.
setBrush
(((
hover
&&
action
==
LOWTRIG
)
||
(
_trig
==
LOWTRIG
))
?
dsYellow
:
dsBlue
);
p
.
setBrush
(
lowTrig_rect
.
contains
(
pt
)
?
dsYellow
.
darker
()
:
(
_trig
==
LOWTRIG
)
?
dsYellow
:
dsBlue
);
p
.
drawRect
(
lowTrig_rect
);
p
.
setBrush
(((
hover
&&
action
==
EDGETRIG
)
||
(
_trig
==
EDGETRIG
))
?
dsYellow
:
dsBlue
);
p
.
setBrush
(
edgeTrig_rect
.
contains
(
pt
)
?
dsYellow
.
darker
()
:
(
_trig
==
EDGTRIG
)
?
dsYellow
:
dsBlue
);
p
.
drawRect
(
edgeTrig_rect
);
p
.
setPen
(
QPen
(
Qt
::
blue
,
1
,
Qt
::
DotLine
));
...
...
@@ -368,5 +391,63 @@ bool LogicSignal::edges(const QPointF &p, uint64_t start, uint64_t &rising, uint
return
false
;
}
bool
LogicSignal
::
mouse_press
(
int
right
,
const
QPoint
pt
)
{
int
y
=
get_y
();
const
QRectF
posTrig
=
get_rect
(
POSTRIG
,
y
,
right
);
const
QRectF
higTrig
=
get_rect
(
HIGTRIG
,
y
,
right
);
const
QRectF
negTrig
=
get_rect
(
NEGTRIG
,
y
,
right
);
const
QRectF
lowTrig
=
get_rect
(
LOWTRIG
,
y
,
right
);
const
QRectF
edgeTrig
=
get_rect
(
EDGTRIG
,
y
,
right
);
if
(
posTrig
.
contains
(
pt
))
set_trig
((
_trig
==
POSTRIG
)
?
NONTRIG
:
POSTRIG
);
else
if
(
higTrig
.
contains
(
pt
))
set_trig
((
_trig
==
HIGTRIG
)
?
NONTRIG
:
HIGTRIG
);
else
if
(
negTrig
.
contains
(
pt
))
set_trig
((
_trig
==
NEGTRIG
)
?
NONTRIG
:
NEGTRIG
);
else
if
(
lowTrig
.
contains
(
pt
))
set_trig
((
_trig
==
LOWTRIG
)
?
NONTRIG
:
LOWTRIG
);
else
if
(
edgeTrig
.
contains
(
pt
))
set_trig
((
_trig
==
EDGTRIG
)
?
NONTRIG
:
EDGTRIG
);
else
return
false
;
return
true
;
}
QRectF
LogicSignal
::
get_rect
(
LogicSetRegions
type
,
int
y
,
int
right
)
{
const
QSizeF
name_size
(
right
-
get_leftWidth
()
-
get_rightWidth
(),
SquareWidth
);
if
(
type
==
POSTRIG
)
return
QRectF
(
get_leftWidth
()
+
name_size
.
width
()
+
Margin
,
y
-
SquareWidth
/
2
,
SquareWidth
,
SquareWidth
);
else
if
(
type
==
HIGTRIG
)
return
QRectF
(
get_leftWidth
()
+
name_size
.
width
()
+
SquareWidth
+
Margin
,
y
-
SquareWidth
/
2
,
SquareWidth
,
SquareWidth
);
else
if
(
type
==
NEGTRIG
)
return
QRectF
(
get_leftWidth
()
+
name_size
.
width
()
+
2
*
SquareWidth
+
Margin
,
y
-
SquareWidth
/
2
,
SquareWidth
,
SquareWidth
);
else
if
(
type
==
LOWTRIG
)
return
QRectF
(
get_leftWidth
()
+
name_size
.
width
()
+
3
*
SquareWidth
+
Margin
,
y
-
SquareWidth
/
2
,
SquareWidth
,
SquareWidth
);
else
if
(
type
==
EDGTRIG
)
return
QRectF
(
get_leftWidth
()
+
name_size
.
width
()
+
4
*
SquareWidth
+
Margin
,
y
-
SquareWidth
/
2
,
SquareWidth
,
SquareWidth
);
else
return
QRectF
(
0
,
0
,
0
,
0
);
}
}
// namespace view
}
// namespace pv
DSView/pv/view/logicsignal.h
View file @
df05c5c9
...
...
@@ -53,12 +53,21 @@ private:
static
const
int
StateHeight
;
static
const
int
StateRound
;
enum
LogicSetRegions
{
NONTRIG
=
-
1
,
POSTRIG
,
HIGTRIG
,
NEGTRIG
,
LOWTRIG
,
EDGTRIG
,
};
public:
LogicSignal
(
boost
::
shared_ptr
<
pv
::
device
::
DevInst
>
dev_inst
,
boost
::
shared_ptr
<
pv
::
data
::
Logic
>
data
,
const
sr_channel
*
const
probe
);
LogicSignal
(
const
Signal
&
s
,
LogicSignal
(
boost
::
shared_ptr
<
view
::
LogicSignal
>
s
,
boost
::
shared_ptr
<
pv
::
data
::
Logic
>
data
,
const
sr_channel
*
const
probe
);
...
...
@@ -70,6 +79,12 @@ public:
boost
::
shared_ptr
<
pv
::
data
::
Logic
>
logic_data
()
const
;
/**
*
*/
LogicSetRegions
get_trig
()
const
;
void
set_trig
(
int
trig
);
/**
* Paints the signal with a QPainter
* @param p the QPainter to paint into.
...
...
@@ -84,8 +99,12 @@ public:
bool
edges
(
const
QPointF
&
p
,
uint64_t
start
,
uint64_t
&
rising
,
uint64_t
&
falling
)
const
;
bool
mouse_press
(
int
right
,
const
QPoint
pt
);
QRectF
get_rect
(
LogicSetRegions
type
,
int
y
,
int
right
);
protected:
void
paint_type_options
(
QPainter
&
p
,
int
right
,
bool
hover
,
int
action
);
void
paint_type_options
(
QPainter
&
p
,
int
right
,
const
QPoint
pt
);
private:
...
...
@@ -97,6 +116,7 @@ private:
private:
boost
::
shared_ptr
<
pv
::
data
::
Logic
>
_data
;
std
::
vector
<
std
::
pair
<
uint64_t
,
bool
>
>
_cur_edges
;
LogicSetRegions
_trig
;
};
}
// namespace view
...
...
DSView/pv/view/trace.cpp
View file @
df05c5c9
...
...
@@ -59,8 +59,7 @@ Trace::Trace(QString name, uint16_t index, int type) :
_v_offset
(
INT_MAX
),
_type
(
type
),
_sec_index
(
0
),
_signalHeight
(
30
),
_trig
(
0
)
_signalHeight
(
30
)
{
_index_list
.
push_back
(
index
);
}
...
...
@@ -72,8 +71,7 @@ Trace::Trace(QString name, std::list<int> index_list, int type, int sec_index) :
_type
(
type
),
_index_list
(
index_list
),
_sec_index
(
sec_index
),
_signalHeight
(
30
),
_trig
(
0
)
_signalHeight
(
30
)
{
}
...
...
@@ -87,7 +85,6 @@ Trace::Trace(const Trace &t) :
_sec_index
(
t
.
_sec_index
),
_old_v_offset
(
t
.
_old_v_offset
),
_signalHeight
(
t
.
_signalHeight
),
_trig
(
t
.
_trig
),
_text_size
(
t
.
_text_size
)
{
}