kwave  18.07.70
Kwave::SignalView Class Reference

#include <SignalView.h>

Inheritance diagram for Kwave::SignalView:
Inheritance graph
Collaboration diagram for Kwave::SignalView:
Collaboration graph

Classes

class  PositionWidget
 

Public Types

enum  Location {
  UpperDockTop, UpperDockBottom, Top, AboveTrackTop,
  AboveTrackBottom, BelowTrackTop, BelowTrackBottom, Bottom,
  LowerDockTop, LowerDockBottom
}
 

Public Slots

virtual void setTrack (int track)
 
virtual void setZoomAndOffset (double zoom, sample_index_t offset)
 
virtual void setVerticalZoom (double zoom)
 
virtual void showCursor (sample_index_t pos=SAMPLE_INDEX_MAX)
 

Signals

void contentSizeChanged ()
 
void sigCursorChanged (sample_index_t pos)
 
void sigNeedRepaint (Kwave::SignalView *view)
 
void sigCommand (const QString &command)
 

Public Member Functions

 SignalView (QWidget *parent, QWidget *controls, Kwave::SignalManager *signal_manager, Location preferred_location, int track=-1)
 
virtual ~SignalView () Q_DECL_OVERRIDE
 
virtual void refresh ()
 
Location preferredLocation () const
 
Kwave::SignalManagersignalManager () const
 
int track () const
 
sample_index_t offset () const
 
double zoom () const
 
double verticalZoom () const
 
sample_index_t firstVisible () const
 
sample_index_t lastVisible () const
 
int samples2pixels (sample_index_t samples) const
 
sample_index_t pixels2samples (int pixels) const
 
double samples2ms (sample_index_t samples)
 
virtual bool canHandleSelection () const
 
virtual QSharedPointer< Kwave::ViewItemfindItem (const QPoint &pos)
 
virtual void mouseMoveEvent (QMouseEvent *e) Q_DECL_OVERRIDE
 
virtual void mousePressEvent (QMouseEvent *e) Q_DECL_OVERRIDE
 
virtual void mouseReleaseEvent (QMouseEvent *e) Q_DECL_OVERRIDE
 
virtual void leaveEvent (QEvent *e) Q_DECL_OVERRIDE
 
virtual void keyPressEvent (QKeyEvent *e) Q_DECL_OVERRIDE
 
virtual int selectionTolerance () const
 
virtual void handleContextMenu (const QPoint &pos, QMenu *menu)
 
virtual void addSibling (QWidget *widget)
 

Protected Types

enum  SelectionPosEnum { None = 0x0000, LeftBorder = 0x0001, RightBorder = 0x0002, Selection = 0x8000 }
 

Protected Slots

virtual void showPosition (const QString &text, sample_index_t pos, const QPoint &mouse)
 
virtual void hidePosition ()
 

Protected Member Functions

virtual void dragEnterEvent (QDragEnterEvent *event) Q_DECL_OVERRIDE
 
virtual void dragLeaveEvent (QDragLeaveEvent *event) Q_DECL_OVERRIDE
 
virtual void dropEvent (QDropEvent *event) Q_DECL_OVERRIDE
 
virtual void dragMoveEvent (QDragMoveEvent *event) Q_DECL_OVERRIDE
 
SelectionPos selectionPosition (int x)
 
bool isInSelection (int x)
 
void findNewItem (const QPoint &mouse_pos, bool active)
 

Protected Attributes

QWidget * m_controls
 
Kwave::SignalManagerm_signal_manager
 
Location m_preferred_location
 
int m_track_index
 
sample_index_t m_offset
 
double m_zoom
 

Private Types

enum  { MouseNormal = 0, MouseMoveItem, MouseDragItem }
 

Private Attributes

double m_vertical_zoom
 
enum Kwave::SignalView:: { ... }  m_mouse_mode
 
Kwave::MouseMark m_mouse_selection
 
int m_mouse_down_x
 
PositionWidget m_position_widget
 
QTimer m_position_widget_timer
 
QList< QPointer< QWidget > > m_siblings
 
QSharedPointer< Kwave::ViewItemm_selected_item
 

Detailed Description

Definition at line 50 of file SignalView.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

mode of the mouse cursor

Enumerator
MouseNormal 

over the signal [default]

MouseMoveItem 

while moving an item

MouseDragItem 

while dragging an item

Definition at line 413 of file SignalView.h.

◆ Location

preferred location of the SignalView

Enumerator
UpperDockTop 

upper dock area, top

UpperDockBottom 

upper dock area, bottom

Top 

above all others

AboveTrackTop 

above the associated track, top

AboveTrackBottom 

above the associated track, bottom

BelowTrackTop 

below the associated track, top

BelowTrackBottom 

below the associated track, bottom

Bottom 

below all others

LowerDockTop 

lower dock area, top

LowerDockBottom 

lower dock area, bottom

Definition at line 56 of file SignalView.h.

◆ SelectionPosEnum

Relationship between a screen position and the current selection.

Enumerator
None 

not near a border

LeftBorder 

close to start of selection

RightBorder 

close to end of selection

Selection 

within the selection

Definition at line 295 of file SignalView.h.

Constructor & Destructor Documentation

◆ SignalView()

Kwave::SignalView::SignalView ( QWidget *  parent,
QWidget *  controls,
Kwave::SignalManager signal_manager,
Location  preferred_location,
int  track = -1 
)

Constructor

Parameters
parentpointer to the parent widget
controlscontainer widget for associated controls
signal_managerthe signal manager
preferred_locationthe location where to insert the view
track(optional) index of the associated track or -1 if not related to a specific track (default)

Definition at line 52 of file SignalView.cpp.

References Kwave::connect(), m_position_widget, and m_position_widget_timer.

56  :QWidget(parent),
57  m_controls(controls),
58  m_signal_manager(signal_manager),
59  m_preferred_location(preferred_location),
61  m_offset(0),
62  m_zoom(1.0),
63  m_vertical_zoom(1.0),
66  m_mouse_down_x(0),
67  m_position_widget(this),
69  m_siblings(),
70  m_selected_item(Q_NULLPTR)
71 {
72  // connect the timer of the position widget
73  connect(&m_position_widget_timer, SIGNAL(timeout()),
74  &m_position_widget, SLOT(hide()));
75 
76  setMouseTracking(true);
77  setAcceptDrops(true); // enable drag&drop
78  setFocusPolicy(Qt::StrongFocus); // enabled keyboard events
79 }
sample_index_t m_offset
Definition: SignalView.h:348
double m_vertical_zoom
Definition: SignalView.h:410
PositionWidget m_position_widget
Definition: SignalView.h:429
QList< QPointer< QWidget > > m_siblings
Definition: SignalView.h:435
QTimer m_position_widget_timer
Definition: SignalView.h:432
bool connect(Kwave::StreamObject &source, const char *output, Kwave::StreamObject &sink, const char *input)
Definition: Connect.cpp:48
QSharedPointer< Kwave::ViewItem > m_selected_item
Definition: SignalView.h:438
enum Kwave::SignalView::@0 m_mouse_mode
Location m_preferred_location
Definition: SignalView.h:339
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
Kwave::MouseMark m_mouse_selection
Definition: SignalView.h:420
QWidget * m_controls
Definition: SignalView.h:333
int track() const
Definition: SignalView.h:105
Here is the call graph for this function:

◆ ~SignalView()

Kwave::SignalView::~SignalView ( )
virtual

Destructor

Definition at line 82 of file SignalView.cpp.

References hidePosition(), m_mouse_mode, m_selected_item, m_siblings, and MouseNormal.

83 {
85  setCursor(Qt::ArrowCursor);
86  hidePosition();
87  m_selected_item.clear();
88 
89  if (!m_siblings.isEmpty()) {
90  QMutableListIterator<QPointer<QWidget> > it(m_siblings);
91  it.toBack();
92  while (it.hasPrevious()) {
93  QWidget *widget = it.previous();
94  it.remove();
95  if (widget) delete widget;
96  }
97  }
98 }
QList< QPointer< QWidget > > m_siblings
Definition: SignalView.h:435
QSharedPointer< Kwave::ViewItem > m_selected_item
Definition: SignalView.h:438
enum Kwave::SignalView::@0 m_mouse_mode
virtual void hidePosition()
Definition: SignalView.h:272
Here is the call graph for this function:

Member Function Documentation

◆ addSibling()

void Kwave::SignalView::addSibling ( QWidget *  widget)
virtual

Adds a widget to the list of associated widgets

Parameters
widgeta QWidget that is associated to this view

Definition at line 107 of file SignalView.cpp.

References m_siblings.

Referenced by Kwave::SignalWidget::insertRow().

108 {
109  m_siblings.append(QPointer<QWidget>(widget));
110 }
QList< QPointer< QWidget > > m_siblings
Definition: SignalView.h:435
Here is the caller graph for this function:

◆ canHandleSelection()

virtual bool Kwave::SignalView::canHandleSelection ( ) const
inlinevirtual

Should be overwritten by subclasses that can display the currently selected range and allow the user to change the selection by mouse.

Returns
true if mouse selection is handled

Reimplemented in Kwave::TrackView.

Definition at line 164 of file SignalView.h.

References SAMPLE_INDEX_MAX.

Referenced by mousePressEvent(), mouseReleaseEvent(), and selectionPosition().

164 { return false; }
Here is the caller graph for this function:

◆ contentSizeChanged

void Kwave::SignalView::contentSizeChanged ( )
signal

emitted whenever the size of the content has changed

Referenced by Kwave::TrackView::setVerticalZoom().

Here is the caller graph for this function:

◆ dragEnterEvent()

void Kwave::SignalView::dragEnterEvent ( QDragEnterEvent *  event)
protectedvirtual
See also
Qt XDND documentation

Definition at line 555 of file SignalView.cpp.

References Kwave::FileDrag::canDecode(), SAMPLE_INDEX_MAX, and sigCursorChanged().

556 {
557  if (!event) return;
558  if ((event->proposedAction() != Qt::MoveAction) &&
559  (event->proposedAction() != Qt::CopyAction))
560  return; /* unsupported action */
561 
562  if (Kwave::FileDrag::canDecode(event->mimeData()))
563  event->acceptProposedAction();
565 }
static bool canDecode(const QMimeData *source)
Definition: FileDrag.h:34
void sigCursorChanged(sample_index_t pos)
#define SAMPLE_INDEX_MAX
Definition: Sample.h:31
Here is the call graph for this function:

◆ dragLeaveEvent()

void Kwave::SignalView::dragLeaveEvent ( QDragLeaveEvent *  event)
protectedvirtual
See also
Qt XDND documentation

Definition at line 568 of file SignalView.cpp.

References m_mouse_mode, MouseNormal, SAMPLE_INDEX_MAX, and sigCursorChanged().

569 {
570  Q_UNUSED(event);
572  setCursor(Qt::ArrowCursor);
574 }
enum Kwave::SignalView::@0 m_mouse_mode
void sigCursorChanged(sample_index_t pos)
#define SAMPLE_INDEX_MAX
Definition: Sample.h:31

◆ dragMoveEvent()

void Kwave::SignalView::dragMoveEvent ( QDragMoveEvent *  event)
protectedvirtual
See also
Qt XDND documentation

Definition at line 634 of file SignalView.cpp.

References Kwave::FileDrag::canDecode(), Kwave::Drag::canDecode(), Kwave::Selection::first(), isInSelection(), Kwave::Selection::last(), m_offset, m_signal_manager, pixels2samples(), rect(), SAMPLE_INDEX_MAX, samples2pixels(), Kwave::SignalManager::selection(), and sigCursorChanged().

635 {
636  if (!event) return;
637  const int x = event->pos().x();
638 
639  if ((event->source() == this) && isInSelection(x)) {
640  // disable drag&drop into the selection itself
641  // this would be nonsense
642 
643  Q_ASSERT(m_signal_manager);
644  if (!m_signal_manager) {
645  event->ignore();
647  return;
648  }
649 
652  const sample_index_t w = pixels2samples(width());
653  QRect rect(this->rect());
654 
655  // crop selection to widget borders
656  if (left < m_offset) left = m_offset;
657  if (right > m_offset + w) right = m_offset + w - 1;
658 
659  // transform to pixel coordinates
660  int l = qMin(samples2pixels(left - m_offset), width() - 1);
661  int r = qMin(samples2pixels(right - m_offset), l);
662  rect.setLeft(l);
663  rect.setRight(r);
664  event->ignore(rect);
666  } else if (Kwave::Drag::canDecode(event->mimeData())) {
667  // accept if it is decodeable within the
668  // current range (if it's outside our own selection)
669  event->acceptProposedAction();
670 
671  // show a cursor at the possible drop location
672  sample_index_t item_pos = m_offset + pixels2samples(x);
673  emit sigCursorChanged(item_pos);
674  } else if (Kwave::FileDrag::canDecode(event->mimeData())) {
675  // file drag
676  event->accept();
678  } else {
679  event->ignore();
681  }
682 }
sample_index_t m_offset
Definition: SignalView.h:348
sample_index_t first() const
Definition: Selection.h:71
sample_index_t last() const
Definition: Selection.h:76
Kwave::Selection & selection()
quint64 sample_index_t
Definition: Sample.h:28
static bool canDecode(const QMimeData *data)
Definition: Drag.cpp:42
bool isInSelection(int x)
Definition: SignalView.cpp:209
sample_index_t pixels2samples(int pixels) const
Definition: SignalView.cpp:155
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
static bool canDecode(const QMimeData *source)
Definition: FileDrag.h:34
void sigCursorChanged(sample_index_t pos)
#define SAMPLE_INDEX_MAX
Definition: Sample.h:31
static double rect(double param)
Definition: Functions.cpp:29
int samples2pixels(sample_index_t samples) const
Definition: SignalView.cpp:149
Here is the call graph for this function:

◆ dropEvent()

void Kwave::SignalView::dropEvent ( QDropEvent *  event)
protectedvirtual
See also
Qt XDND documentation

Definition at line 577 of file SignalView.cpp.

References _, Kwave::Drag::canDecode(), Kwave::CodecManager::canDecode(), DBG, Kwave::Drag::decode(), Kwave::Parser::escape(), m_mouse_mode, m_offset, m_signal_manager, Kwave::CodecManager::mimeTypeOf(), MouseNormal, pixels2samples(), SAMPLE_INDEX_MAX, Kwave::SignalManager::selectRange(), sigCommand(), and sigCursorChanged().

578 {
579  if (!event) return;
580  const QMimeData *mime_data = event->mimeData();
581  if (!mime_data) return;
582  Q_ASSERT(m_signal_manager);
583  if (!m_signal_manager) return;
584 
585  if (Kwave::Drag::canDecode(mime_data)) {
587  i18n("Drag and Drop"));
588  sample_index_t pos = m_offset + pixels2samples(event->pos().x());
589  sample_index_t len = 0;
590 
591  if ((len = Kwave::Drag::decode(this, mime_data,
592  *m_signal_manager, pos)))
593  {
594  // set selection to the new area where the drop was done
595  m_signal_manager->selectRange(pos, len);
596  event->acceptProposedAction();
597  } else {
598  QStringList formats = mime_data->formats();
599  qWarning("SignalView::dropEvent(%s): failed !",
600  DBG(formats.join(_("; "))));
601  }
602  } else if (mime_data->hasUrls()) {
603  bool first = true;
604  foreach (const QUrl &url, mime_data->urls()) {
605  QString filename = url.toLocalFile();
606  QString mimetype = Kwave::CodecManager::mimeTypeOf(url);
607  if (Kwave::CodecManager::canDecode(mimetype)) {
608  if (first) {
609  // first dropped URL -> open in this window
610  emit sigCommand(_("open(") +
611  Kwave::Parser::escape(filename) +
612  _(")"));
613  first = false;
614  event->acceptProposedAction();
615  } else {
616  // all others -> open a new window
617  emit sigCommand(_("newwindow(") +
618  Kwave::Parser::escape(filename) +
619  _(")"));
620  }
621  }
622  }
623  }
624 
625  qDebug("SignalView::dropEvent(): done");
627  setCursor(Qt::ArrowCursor);
629 
630  if (!event->isAccepted()) event->ignore();
631 }
void sigCommand(const QString &command)
void selectRange(sample_index_t offset, sample_index_t length)
sample_index_t m_offset
Definition: SignalView.h:348
static sample_index_t decode(QWidget *widget, const QMimeData *e, Kwave::SignalManager &sig, sample_index_t pos)
Definition: Drag.cpp:76
quint64 sample_index_t
Definition: Sample.h:28
static bool canDecode(const QMimeData *data)
Definition: Drag.cpp:42
static QString mimeTypeOf(const QUrl &url)
enum Kwave::SignalView::@0 m_mouse_mode
sample_index_t pixels2samples(int pixels) const
Definition: SignalView.cpp:155
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
#define _(m)
Definition: memcpy.c:66
#define DBG(qs)
Definition: String.h:55
static QString escape(const QString &text)
Definition: Parser.cpp:277
void sigCursorChanged(sample_index_t pos)
static bool canDecode(const QString &mimetype_name)
#define SAMPLE_INDEX_MAX
Definition: Sample.h:31
Here is the call graph for this function:

◆ findItem()

QSharedPointer< Kwave::ViewItem > Kwave::SignalView::findItem ( const QPoint &  pos)
virtual

Tries to find the nearest item that is visible in this view at a given position

Parameters
posposition to look at, relative to view [pixels]
Returns
the nearest ViewObject in range or a null pointer if nothing found

Reimplemented in Kwave::TrackView.

Definition at line 215 of file SignalView.cpp.

Referenced by findNewItem().

216 {
217  Q_UNUSED(pos);
218  return QSharedPointer<Kwave::ViewItem>(Q_NULLPTR);
219 }
Here is the caller graph for this function:

◆ findNewItem()

void Kwave::SignalView::findNewItem ( const QPoint &  mouse_pos,
bool  active 
)
protected

Tries to find the nearest item that is visible in this view at a given position and show or hide the corresponding tool tip.

Parameters
mouse_posposition to look at, relative to view [pixels]
activeif true an operation (move or drag&drop) is active, otherwise it is only a hover over an item

Definition at line 287 of file SignalView.cpp.

References Kwave::ViewItem::CanDragAndDrop, Kwave::ViewItem::CanGrabAndMove, findItem(), hidePosition(), m_mouse_mode, m_offset, m_selected_item, MouseMoveItem, MouseNormal, pixels2samples(), and showPosition().

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

288 {
289  m_selected_item = QSharedPointer<Kwave::ViewItem>(Q_NULLPTR);
290  if (!active) m_mouse_mode = MouseNormal;
291 
292  m_selected_item = findItem(mouse_pos);
293  if (m_selected_item) {
294  // we have an item to show, activate the position window
295  sample_index_t item_pos = m_offset + pixels2samples(mouse_pos.x());
296  QString item_text = m_selected_item->toolTip(item_pos);
297  showPosition(item_text, item_pos, mouse_pos);
298 
299  // update the mouse cursor
300  Kwave::ViewItem::Flags flags = m_selected_item->flags();
302  setCursor(active ? Qt::ClosedHandCursor : Qt::ArrowCursor);
303  else if (flags & Kwave::ViewItem::CanGrabAndMove)
304  setCursor(m_selected_item->mouseCursor());
305  else
306  setCursor(Qt::ArrowCursor);
307 
308  if (active) m_mouse_mode = MouseMoveItem;
309  } else {
310  // out of scope
311  hidePosition();
313  setCursor(Qt::ArrowCursor);
314  }
315 }
sample_index_t m_offset
Definition: SignalView.h:348
quint64 sample_index_t
Definition: Sample.h:28
QSharedPointer< Kwave::ViewItem > m_selected_item
Definition: SignalView.h:438
enum Kwave::SignalView::@0 m_mouse_mode
virtual QSharedPointer< Kwave::ViewItem > findItem(const QPoint &pos)
Definition: SignalView.cpp:215
virtual void hidePosition()
Definition: SignalView.h:272
sample_index_t pixels2samples(int pixels) const
Definition: SignalView.cpp:155
virtual void showPosition(const QString &text, sample_index_t pos, const QPoint &mouse)
Definition: SignalView.cpp:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ firstVisible()

sample_index_t Kwave::SignalView::firstVisible ( ) const
inline

returns the index of the first visible sample

Definition at line 125 of file SignalView.h.

125  {
126  return m_offset;
127  }
sample_index_t m_offset
Definition: SignalView.h:348

◆ handleContextMenu()

void Kwave::SignalView::handleContextMenu ( const QPoint &  pos,
QMenu *  menu 
)
virtual

Called when the context menu has been activated over this view

Parameters
posa position in pixel within this widget
menupointer to the context menu

Reimplemented in Kwave::TrackView.

Definition at line 548 of file SignalView.cpp.

549 {
550  Q_UNUSED(pos);
551  Q_UNUSED(menu);
552 }

◆ hidePosition

virtual void Kwave::SignalView::hidePosition ( )
inlineprotectedvirtualslot

Hide the current position marker

See also
showPosition

Definition at line 272 of file SignalView.h.

Referenced by findNewItem(), keyPressEvent(), leaveEvent(), mouseMoveEvent(), setZoomAndOffset(), and ~SignalView().

272  {
273  showPosition(QString(), 0, QPoint(-1,-1));
274  }
virtual void showPosition(const QString &text, sample_index_t pos, const QPoint &mouse)
Definition: SignalView.cpp:222
Here is the caller graph for this function:

◆ isInSelection()

bool Kwave::SignalView::isInSelection ( int  x)
protected

Checks if a pixel position is within the left and right border of a selection. The tolerance is 2% of the currently visible area.

Parameters
xpixel position to be tested
Returns
true if the position is within range

Definition at line 209 of file SignalView.cpp.

References selectionPosition().

Referenced by dragMoveEvent().

210 {
211  return (selectionPosition(x) & Selection) != 0;
212 }
SelectionPos selectionPosition(int x)
Definition: SignalView.cpp:173
Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyPressEvent()

void Kwave::SignalView::keyPressEvent ( QKeyEvent *  e)
virtual

handles key press events (e.g. the Escape key)

Definition at line 527 of file SignalView.cpp.

References hidePosition(), m_mouse_mode, m_selected_item, and MouseNormal.

528 {
529  if (!e) return;
530  if (e->matches(QKeySequence::Cancel)) {
531  // Cancel key (Escape) -> reset all view item operations
533  setCursor(Qt::ArrowCursor);
534  m_selected_item = QSharedPointer<Kwave::ViewItem>(Q_NULLPTR);
535  } else {
536  QWidget::keyPressEvent(e);
537  }
538  hidePosition();
539 }
QSharedPointer< Kwave::ViewItem > m_selected_item
Definition: SignalView.h:438
enum Kwave::SignalView::@0 m_mouse_mode
virtual void hidePosition()
Definition: SignalView.h:272
Here is the call graph for this function:

◆ lastVisible()

sample_index_t Kwave::SignalView::lastVisible ( ) const
inline

returns the index of the last visible sample

Definition at line 130 of file SignalView.h.

Referenced by Kwave::TrackView::paintEvent().

130  {
131  const sample_index_t w = pixels2samples(width());
132  return m_offset + ((w) ? (w - 1) : 0);
133  }
sample_index_t m_offset
Definition: SignalView.h:348
quint64 sample_index_t
Definition: Sample.h:28
sample_index_t pixels2samples(int pixels) const
Definition: SignalView.cpp:155
Here is the caller graph for this function:

◆ leaveEvent()

void Kwave::SignalView::leaveEvent ( QEvent *  e)
virtual

slot when the mouse leaves the widget

Definition at line 518 of file SignalView.cpp.

References hidePosition(), m_mouse_mode, and MouseNormal.

519 {
521  setCursor(Qt::ArrowCursor);
522  hidePosition();
523  QWidget::leaveEvent(e);
524 }
enum Kwave::SignalView::@0 m_mouse_mode
virtual void hidePosition()
Definition: SignalView.h:272
Here is the call graph for this function:

◆ mouseMoveEvent()

void Kwave::SignalView::mouseMoveEvent ( QMouseEvent *  e)
virtual

slot for mouse moves, used for selection and drag&drop

Definition at line 318 of file SignalView.cpp.

References Kwave::ViewItem::CanDragAndDrop, Kwave::ViewItem::CanGrabAndMove, findNewItem(), hidePosition(), Kwave::SignalManager::length(), m_mouse_down_x, m_mouse_mode, m_offset, m_selected_item, m_signal_manager, MouseDragItem, MouseMoveItem, MouseNormal, pixels2samples(), and showPosition().

319 {
320  Q_ASSERT(e);
321  if (!e) return;
322 
323  // abort if no signal is loaded
324  Q_ASSERT(m_signal_manager);
326  e->ignore();
327  return;
328  }
329 
330  // there seems to be a BUG in Qt, sometimes e->pos() produces flicker/wrong
331  // coordinates on the start of a fast move!?
332  // globalPos() seems not to have this effect
333  const QPoint mouse_pos(
334  qBound(0, mapFromGlobal(e->globalPos()).x(), width() - 1),
335  qBound(0, mapFromGlobal(e->globalPos()).y(), height() - 1)
336  );
337 
338  // bail out if the position did not change
339  static QPoint last_pos = QPoint(-1, -1);
340  if (mouse_pos == last_pos) {
341  e->ignore();
342  return;
343  }
344 
345  switch (m_mouse_mode) {
346  case MouseDragItem: /* FALLTHROUGH */
347  case MouseMoveItem: {
348  // move mode
349 
350  if (m_selected_item.isNull()) {
351  hidePosition();
352  break;
353  }
354 
355  bool hide_position = true;
356  Kwave::ViewItem::Flags flags = m_selected_item->flags();
357  if (flags & Kwave::ViewItem::CanDragAndDrop) {
358  const int dmin = QApplication::startDragDistance();
359  if ((e->buttons() & Qt::LeftButton) &&
360  ((mouse_pos.x() < (m_mouse_down_x - dmin)) ||
361  (mouse_pos.x() > (m_mouse_down_x + dmin))) )
362  {
363  m_selected_item->startDragging();
364  }
365  }
366 
367  if (flags & Kwave::ViewItem::CanGrabAndMove) {
368  // update the position of the item
369  m_selected_item->moveTo(mouse_pos);
370 
371  // show the position window, so that we see the coordinates
372  // where we move the item to
373  sample_index_t pos = m_offset + pixels2samples(mouse_pos.x());
374  QString item_text = m_selected_item->toolTip(pos);
375  showPosition(item_text, pos, mouse_pos);
376  hide_position = false;
377  }
378 
379  if (hide_position) hidePosition();
380  break;
381  }
382  case MouseNormal: /* FALLTHROUGH */
383  default:
384  findNewItem(mouse_pos, false);
385  break;
386  }
387  e->accept();
388 }
sample_index_t m_offset
Definition: SignalView.h:348
quint64 sample_index_t
Definition: Sample.h:28
QSharedPointer< Kwave::ViewItem > m_selected_item
Definition: SignalView.h:438
enum Kwave::SignalView::@0 m_mouse_mode
sample_index_t length()
virtual void hidePosition()
Definition: SignalView.h:272
sample_index_t pixels2samples(int pixels) const
Definition: SignalView.cpp:155
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
void findNewItem(const QPoint &mouse_pos, bool active)
Definition: SignalView.cpp:287
virtual void showPosition(const QString &text, sample_index_t pos, const QPoint &mouse)
Definition: SignalView.cpp:222
Here is the call graph for this function:

◆ mousePressEvent()

void Kwave::SignalView::mousePressEvent ( QMouseEvent *  e)
virtual

slot for mouse press, used for selection and drag&drop

Definition at line 391 of file SignalView.cpp.

References Kwave::ViewItem::CanDragAndDrop, canHandleSelection(), findNewItem(), Kwave::Selection::first(), Kwave::MouseMark::grep(), Kwave::Selection::last(), Kwave::MouseMark::left(), Kwave::MouseMark::length(), Kwave::SignalManager::length(), m_mouse_down_x, m_mouse_mode, m_mouse_selection, m_offset, m_selected_item, m_signal_manager, MouseMoveItem, pixels2samples(), Kwave::SignalManager::playbackController(), Kwave::PlaybackController::running(), Kwave::SignalManager::selection(), Kwave::SignalManager::selectRange(), and Kwave::MouseMark::set().

392 {
393  Q_ASSERT(e);
394  Q_ASSERT(m_signal_manager);
395  if (!e) return;
396 
397  // abort if no signal is loaded
399  e->ignore();
400  return;
401  }
402 
403  // ignore all mouse press events in playback mode
405  e->ignore();
406  return;
407  }
408 
409  const QPoint mouse_pos(
410  qBound(0, mapFromGlobal(e->globalPos()).x(), width() - 1),
411  qBound(0, mapFromGlobal(e->globalPos()).y(), height() - 1)
412  );
413 
414  findNewItem(mouse_pos, false);
415 
416  if (e->button() == Qt::LeftButton) {
417  sample_index_t ofs = m_offset + pixels2samples(mouse_pos.x());
418  sample_index_t selection_first = m_signal_manager->selection().first();
419  sample_index_t selection_last = m_signal_manager->selection().last();
420 
421  switch (e->modifiers()) {
422  case Qt::ShiftModifier: {
423  // expand the selection to "here"
424  m_mouse_selection.set(selection_first, selection_last);
425  m_mouse_selection.grep(ofs);
429  );
430 
431  // this probably changes to "adjust selection border"
432  findNewItem(mouse_pos, true);
433  break;
434  }
435  case Qt::NoModifier: {
436  // check whether there is some object near this position
437  if (m_selected_item) {
438  // we have an item here:
440 
441  Kwave::ViewItem::Flags flags = m_selected_item->flags();
442  if (flags & Kwave::ViewItem::CanDragAndDrop) {
443  // store the x position for later drag&drop
444  m_mouse_down_x = mouse_pos.x();
445  setCursor(Qt::DragMoveCursor);
446  }
447  } else if (canHandleSelection()) {
448  // start a new selection
449  m_mouse_selection.set(ofs, ofs);
450  m_signal_manager->selectRange(ofs, 0);
451 
452  // this probably changes to "adjust selection border"
453  findNewItem(mouse_pos, true);
454  }
455  break;
456  }
457  default:
458  break;
459  }
460  }
461  e->accept();
462 }
void selectRange(sample_index_t offset, sample_index_t length)
sample_index_t m_offset
Definition: SignalView.h:348
sample_index_t first() const
Definition: Selection.h:71
void set(sample_index_t l, sample_index_t r)
Definition: MouseMark.cpp:36
sample_index_t last() const
Definition: Selection.h:76
Kwave::Selection & selection()
void grep(sample_index_t x)
Definition: MouseMark.cpp:55
quint64 sample_index_t
Definition: Sample.h:28
Kwave::PlaybackController & playbackController()
QSharedPointer< Kwave::ViewItem > m_selected_item
Definition: SignalView.h:438
enum Kwave::SignalView::@0 m_mouse_mode
virtual bool canHandleSelection() const
Definition: SignalView.h:164
sample_index_t length()
sample_index_t pixels2samples(int pixels) const
Definition: SignalView.cpp:155
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
Kwave::MouseMark m_mouse_selection
Definition: SignalView.h:420
sample_index_t length() const
Definition: MouseMark.h:77
void findNewItem(const QPoint &mouse_pos, bool active)
Definition: SignalView.cpp:287
sample_index_t left() const
Definition: MouseMark.cpp:43
Here is the call graph for this function:

◆ mouseReleaseEvent()

void Kwave::SignalView::mouseReleaseEvent ( QMouseEvent *  e)
virtual

slot for mouse release, used for selection and drag&drop

Definition at line 465 of file SignalView.cpp.

References Kwave::ViewItem::CanGrabAndMove, canHandleSelection(), findNewItem(), Kwave::SignalManager::length(), m_mouse_mode, m_mouse_selection, m_offset, m_selected_item, m_signal_manager, MouseDragItem, MouseMoveItem, pixels2samples(), Kwave::SignalManager::playbackController(), Kwave::PlaybackController::running(), Kwave::SignalManager::selectRange(), and Kwave::MouseMark::set().

466 {
467  Q_ASSERT(e);
468  Q_ASSERT(m_signal_manager);
469  if (!e) return;
470 
471  // abort if no signal is loaded
473  e->ignore();
474  return;
475  }
476 
477  // ignore all mouse release events in playback mode
479  e->ignore();
480  return;
481  }
482 
483  const QPoint mouse_pos(
484  qBound(0, mapFromGlobal(e->globalPos()).x(), width() - 1),
485  qBound(0, mapFromGlobal(e->globalPos()).y(), height() - 1)
486  );
487 
488  switch (m_mouse_mode) {
489  case MouseDragItem:
490  // released after dragging
491  if (m_selected_item) m_selected_item->done();
492  findNewItem(mouse_pos, false);
493  break;
494  case MouseMoveItem:
495  if (m_selected_item) {
496  // released after move
498  m_selected_item->done();
499  else if (canHandleSelection()) {
500  // maybe started dragging, but released before reaching
501  // the minimum drag distance -> start a new selection
502  sample_index_t ofs = m_offset +
503  pixels2samples(mouse_pos.x());
504  m_mouse_selection.set(ofs, ofs);
505  m_signal_manager->selectRange(ofs, 0);
506  }
507  }
508  findNewItem(mouse_pos, false);
509  break;
510  default:
511  break;
512  }
513 
514  e->accept();
515 }
void selectRange(sample_index_t offset, sample_index_t length)
sample_index_t m_offset
Definition: SignalView.h:348
void set(sample_index_t l, sample_index_t r)
Definition: MouseMark.cpp:36
quint64 sample_index_t
Definition: Sample.h:28
Kwave::PlaybackController & playbackController()
QSharedPointer< Kwave::ViewItem > m_selected_item
Definition: SignalView.h:438
enum Kwave::SignalView::@0 m_mouse_mode
virtual bool canHandleSelection() const
Definition: SignalView.h:164
sample_index_t length()
sample_index_t pixels2samples(int pixels) const
Definition: SignalView.cpp:155
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
Kwave::MouseMark m_mouse_selection
Definition: SignalView.h:420
void findNewItem(const QPoint &mouse_pos, bool active)
Definition: SignalView.cpp:287
Here is the call graph for this function:

◆ offset()

sample_index_t Kwave::SignalView::offset ( ) const
inline

returns the current start position

Definition at line 110 of file SignalView.h.

Referenced by Kwave::TrackView::findItem(), Kwave::SelectionBorderItem::moveTo(), Kwave::LabelItem::moveTo(), and setZoomAndOffset().

110  {
111  return m_offset;
112  }
sample_index_t m_offset
Definition: SignalView.h:348
Here is the caller graph for this function:

◆ pixels2samples()

sample_index_t Kwave::SignalView::pixels2samples ( int  pixels) const

Converts a number of pixels into a number of samples, based on the current zoom factor

Parameters
pixelsnumber of pixels (should be positive)
Returns
number of samples

Definition at line 155 of file SignalView.cpp.

References m_zoom.

Referenced by dragMoveEvent(), dropEvent(), Kwave::TrackView::findItem(), findNewItem(), Kwave::TrackView::handleContextMenu(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), Kwave::SelectionBorderItem::moveTo(), Kwave::LabelItem::moveTo(), and Kwave::TrackView::paintEvent().

156 {
157  if ((pixels <= 0) || (m_zoom <= 0.0)) return 0;
158  return static_cast<sample_index_t>(static_cast<double>(pixels) * m_zoom);
159 }
quint64 sample_index_t
Definition: Sample.h:28
Here is the caller graph for this function:

◆ preferredLocation()

Location Kwave::SignalView::preferredLocation ( ) const
inline

returns the preferred location

Definition at line 95 of file SignalView.h.

Referenced by Kwave::SignalWidget::insertView().

95  {
96  return m_preferred_location;
97  }
Location m_preferred_location
Definition: SignalView.h:339
Here is the caller graph for this function:

◆ refresh()

void Kwave::SignalView::refresh ( )
virtual

refresh the content of the view. The default implementation calls repaint(). Can be overwritten to trigger more complex refresh scenarios.

See also
TrackView::refresh() for an example

Reimplemented in Kwave::TrackView.

Definition at line 101 of file SignalView.cpp.

Referenced by Kwave::SignalWidget::repaintTimerElapsed().

102 {
103  repaint();
104 }
Here is the caller graph for this function:

◆ samples2ms()

double Kwave::SignalView::samples2ms ( sample_index_t  samples)

Converts a number of samples to a time in milliseconds, based on the current signal rate.

Parameters
samplesnumber of samples
Returns
time in milliseconds

Definition at line 162 of file SignalView.cpp.

References m_signal_manager, and Kwave::SignalManager::rate().

Referenced by Kwave::SelectionBorderItem::toolTip(), and Kwave::LabelItem::toolTip().

163 {
164  Q_ASSERT(m_signal_manager);
165  if (!m_signal_manager) return 0.0;
166 
167  double rate = m_signal_manager->rate();
168  if (rate == 0.0) return 0.0;
169  return static_cast<double>(samples) * 1E3 / rate;
170 }
double rate() const
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
Here is the call graph for this function:
Here is the caller graph for this function:

◆ samples2pixels()

int Kwave::SignalView::samples2pixels ( sample_index_t  samples) const

converts a number of samples into a number of pixels, based on the current zoom factor

Parameters
samplesa small number of samples (must be positive)
Returns
number of pixels

Definition at line 149 of file SignalView.cpp.

References m_zoom, and Kwave::toInt().

Referenced by dragMoveEvent(), Kwave::TrackView::paintEvent(), and showPosition().

150 {
151  return Kwave::toInt((m_zoom > 0.0) ? (samples / m_zoom) : 0);
152 }
int toInt(T x)
Definition: Utils.h:127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectionPosition()

Kwave::SignalView::SelectionPos Kwave::SignalView::selectionPosition ( int  x)
protected

Determines the relationship between a screen position and the current selection.

Parameters
xscreen position
Returns
a SelectionPos

Definition at line 173 of file SignalView.cpp.

References canHandleSelection(), Kwave::Selection::first(), Kwave::Selection::last(), LeftBorder, m_offset, m_signal_manager, m_zoom, None, RightBorder, Kwave::SignalManager::selection(), Selection, and selectionTolerance().

Referenced by isInSelection(), and showPosition().

174 {
175  // shortcut: if this view can't handle selection...
176  if (!canHandleSelection()) return Q_NULLPTR;
177 
178  Q_ASSERT(m_signal_manager);
179  if (!m_signal_manager) return None;
180 
181  const double p = (m_zoom * x) + m_offset;
182  const double tol = m_zoom * selectionTolerance();
183  const double first = m_signal_manager->selection().first();
184  const double last = m_signal_manager->selection().last();
185  Q_ASSERT(first <= last);
186 
187  // get distance to left/right selection border
188  double d_left = (p > first) ? (p - first) : (first - p);
189  double d_right = (p > last) ? (p - last) : (last - p);
190 
191  // the simple cases...
192  Kwave::SignalView::SelectionPos pos = None;
193  if ((d_left <= tol) && (p < last)) pos |= LeftBorder;
194  if ((d_right <= tol) && (p > first)) pos |= RightBorder;
195  if ((p >= first) && (p <= last)) pos |= Selection;
196 
197  if ((pos & LeftBorder) && (pos & RightBorder)) {
198  // special case: determine which border is nearer
199  if (d_left < d_right)
200  pos &= ~RightBorder; // more on the left
201  else
202  pos &= ~LeftBorder; // more on the right
203  }
204 
205  return pos;
206 }
sample_index_t m_offset
Definition: SignalView.h:348
sample_index_t first() const
Definition: Selection.h:71
virtual int selectionTolerance() const
Definition: SignalView.cpp:542
sample_index_t last() const
Definition: Selection.h:76
Kwave::Selection & selection()
virtual bool canHandleSelection() const
Definition: SignalView.h:164
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectionTolerance()

int Kwave::SignalView::selectionTolerance ( ) const
virtual

tolerance in pixel for snapping to a label or selection border

Returns
number of pixels

Definition at line 542 of file SignalView.cpp.

Referenced by Kwave::TrackView::findItem(), and selectionPosition().

543 {
544  return (2 * QApplication::startDragDistance());
545 }
Here is the caller graph for this function:

◆ setTrack

void Kwave::SignalView::setTrack ( int  track)
virtualslot

changes the association to a track

Parameters
trackthe new track index, or -1 if not associated

Definition at line 113 of file SignalView.cpp.

References m_track_index.

Referenced by Kwave::SignalWidget::slotTrackDeleted(), and Kwave::SignalWidget::slotTrackInserted().

114 {
115  m_track_index = (track >= 0) ? track : -1;
116 }
int track() const
Definition: SignalView.h:105
Here is the caller graph for this function:

◆ setVerticalZoom

void Kwave::SignalView::setVerticalZoom ( double  zoom)
virtualslot

sets new vertical zoom factor

Parameters
zoomvertical zoom factor

Reimplemented in Kwave::TrackView.

Definition at line 137 of file SignalView.cpp.

References m_vertical_zoom, and zoom().

Referenced by Kwave::SignalWidget::insertView(), and Kwave::TrackView::setVerticalZoom().

138 {
140 }
double m_vertical_zoom
Definition: SignalView.h:410
double zoom() const
Definition: SignalView.h:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setZoomAndOffset

void Kwave::SignalView::setZoomAndOffset ( double  zoom,
sample_index_t  offset 
)
virtualslot

sets new zoom factor and offset

Parameters
zoomthe new zoom factor in pixels/sample
offsetthe index of the first visible sample

Reimplemented in Kwave::TrackView.

Definition at line 119 of file SignalView.cpp.

References hidePosition(), m_offset, m_zoom, offset(), and zoom().

Referenced by Kwave::SignalWidget::insertView(), and Kwave::TrackView::setZoomAndOffset().

120 {
121  if (qFuzzyCompare(zoom, m_zoom) && (offset == m_offset)) return;
122  m_zoom = zoom;
123  m_offset = offset;
124 
125 // sample_index_t visible = ((width() - 1) * zoom) + 1;
126 // sample_index_t last = offset + visible - 1;
127 // qDebug("SignalView::setZoomAndOffset(%g, %lu), last visible=%lu",
128 // zoom,
129 // static_cast<unsigned long int>(offset),
130 // static_cast<unsigned long int>(last));
131 
132  // the relation to the position widget has become invalid
133  hidePosition();
134 }
sample_index_t m_offset
Definition: SignalView.h:348
sample_index_t offset() const
Definition: SignalView.h:110
virtual void hidePosition()
Definition: SignalView.h:272
double zoom() const
Definition: SignalView.h:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ showCursor

void Kwave::SignalView::showCursor ( sample_index_t  pos = SAMPLE_INDEX_MAX)
virtualslot

shows the cursor at a given position

Parameters
poscurrent position of the cursor

Definition at line 143 of file SignalView.cpp.

144 {
145  Q_UNUSED(pos);
146 }

◆ showPosition

void Kwave::SignalView::showPosition ( const QString &  text,
sample_index_t  pos,
const QPoint &  mouse 
)
protectedvirtualslot

Shows the current cursor position as a tooltip

Parameters
textdescription of the position
posmarker position [samples]
mousethe coordinates of the mouse cursor, relative to this widget [pixel]

Definition at line 222 of file SignalView.cpp.

References LeftBorder, m_offset, m_position_widget, m_position_widget_timer, POSITION_WIDGET_TIME, RightBorder, samples2pixels(), selectionPosition(), and Kwave::SignalView::PositionWidget::setText().

Referenced by findNewItem(), and mouseMoveEvent().

224 {
225  // check: showPosition() must be called from the GUI thread only!
226  Q_ASSERT(this->thread() == QThread::currentThread());
227  Q_ASSERT(this->thread() == qApp->thread());
228 
229  int x = mouse.x();
230  int y = mouse.y();
231 
232  // x/y == -1/-1 or empty text -> reset/hide the position
233  if (((x < 0) && (y < 0)) || !text.length()) {
235  m_position_widget.hide();
236  return;
237  }
238 
239  setUpdatesEnabled(false);
240  m_position_widget.hide();
241 
242  switch (selectionPosition(mouse.x()) & ~Selection) {
243  case LeftBorder:
244  m_position_widget.setText(text, Qt::AlignRight);
245  x = samples2pixels(pos - m_offset) - m_position_widget.width();
246  if (x < 0) {
247  // switch to left aligned mode
248  m_position_widget.setText(text, Qt::AlignLeft);
249  x = samples2pixels(pos - m_offset);
250  }
251  break;
252  case RightBorder:
253  default:
254  m_position_widget.setText(text, Qt::AlignLeft);
255  x = samples2pixels(pos - m_offset);
256  if (x + m_position_widget.width() > width()) {
257  // switch to right aligned mode
258  m_position_widget.setText(text, Qt::AlignRight);
259  x = samples2pixels(pos - m_offset) - m_position_widget.width();
260  }
261  break;
262  }
263 
264  // adjust the position to avoid vertical clipping
265  int lh = m_position_widget.height();
266  if (y - lh/2 < 0) {
267  y = 0;
268  } else if (y + lh/2 > height()) {
269  y = height() - lh;
270  } else {
271  y -= lh/2;
272  }
273 
274  m_position_widget.move(x, y);
275 
276  if (!m_position_widget.isVisible())
277  m_position_widget.show();
278 
280  m_position_widget_timer.setSingleShot(true);
282 
283  setUpdatesEnabled(true);
284 }
sample_index_t m_offset
Definition: SignalView.h:348
PositionWidget m_position_widget
Definition: SignalView.h:429
virtual void setText(const QString &text, Qt::Alignment alignment)
Definition: SignalView.cpp:717
QTimer m_position_widget_timer
Definition: SignalView.h:432
SelectionPos selectionPosition(int x)
Definition: SignalView.cpp:173
#define POSITION_WIDGET_TIME
Definition: SignalView.cpp:48
int samples2pixels(sample_index_t samples) const
Definition: SignalView.cpp:149
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigCommand

void Kwave::SignalView::sigCommand ( const QString &  command)
signal

forward a sigCommand to the next layer

Referenced by Kwave::TrackView::contextMenuLabelNew(), and dropEvent().

Here is the caller graph for this function:

◆ sigCursorChanged

void Kwave::SignalView::sigCursorChanged ( sample_index_t  pos)
signal

emitted to request update of the cursor

Referenced by dragEnterEvent(), dragLeaveEvent(), dragMoveEvent(), and dropEvent().

Here is the caller graph for this function:

◆ signalManager()

Kwave::SignalManager* Kwave::SignalView::signalManager ( ) const
inline

returns the associated signal manager

Definition at line 100 of file SignalView.h.

Referenced by Kwave::SelectionItem::startDragging().

100  {
101  return m_signal_manager;
102  }
Kwave::SignalManager * m_signal_manager
Definition: SignalView.h:336
Here is the caller graph for this function:

◆ sigNeedRepaint

void Kwave::SignalView::sigNeedRepaint ( Kwave::SignalView view)
signal

Can be emitted to signal that this view needs to be repainted, probably after synchronizing with other views and additionally throttled to reduce GUI load

Parameters
viewpointer to the view that needs to be repainted

Referenced by Kwave::TrackView::refreshAllLayers(), Kwave::TrackView::refreshMarkersLayer(), Kwave::TrackView::refreshSelectionLayer(), Kwave::TrackView::refreshSignalLayer(), and Kwave::TrackView::showCursor().

Here is the caller graph for this function:

◆ track()

int Kwave::SignalView::track ( ) const
inline

returns the index of the associated track (or -1)

Definition at line 105 of file SignalView.h.

Referenced by Kwave::SignalWidget::insertView(), and Kwave::SignalWidget::slotTrackDeleted().

105  {
106  return m_track_index;
107  }
Here is the caller graph for this function:

◆ verticalZoom()

double Kwave::SignalView::verticalZoom ( ) const
inline

returns the current vertical zoom factor

Definition at line 120 of file SignalView.h.

Referenced by Kwave::TrackView::setVerticalZoom().

120  {
121  return m_vertical_zoom;
122  }
double m_vertical_zoom
Definition: SignalView.h:410
Here is the caller graph for this function:

◆ zoom()

double Kwave::SignalView::zoom ( ) const
inline

returns the current zoom [pixels/sample]

Definition at line 115 of file SignalView.h.

Referenced by setVerticalZoom(), and setZoomAndOffset().

115  {
116  return m_zoom;
117  }
Here is the caller graph for this function:

Member Data Documentation

◆ m_controls

QWidget* Kwave::SignalView::m_controls
protected

widget for displaying associated controls

Definition at line 333 of file SignalView.h.

◆ m_mouse_down_x

int Kwave::SignalView::m_mouse_down_x
private

x position where the user clicked the last time, needed for finding out where to start a drag&drop operation [pixel]

Definition at line 426 of file SignalView.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

◆ m_mouse_mode

enum { ... } Kwave::SignalView::m_mouse_mode

◆ m_mouse_selection

Kwave::MouseMark Kwave::SignalView::m_mouse_selection
private

selection handler

Definition at line 420 of file SignalView.h.

Referenced by mousePressEvent(), and mouseReleaseEvent().

◆ m_offset

sample_index_t Kwave::SignalView::m_offset
protected

Offset from which signal is being displayed. This is equal to the index of the first visible sample.

Definition at line 348 of file SignalView.h.

Referenced by dragMoveEvent(), dropEvent(), Kwave::TrackView::findItem(), findNewItem(), Kwave::TrackView::handleContextMenu(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), Kwave::TrackView::paintEvent(), selectionPosition(), setZoomAndOffset(), and showPosition().

◆ m_position_widget

PositionWidget Kwave::SignalView::m_position_widget
private

small widget for showing the mouse cursor position

Definition at line 429 of file SignalView.h.

Referenced by showPosition(), and SignalView().

◆ m_position_widget_timer

QTimer Kwave::SignalView::m_position_widget_timer
private

timer for automatic hiding

Definition at line 432 of file SignalView.h.

Referenced by showPosition(), and SignalView().

◆ m_preferred_location

Location Kwave::SignalView::m_preferred_location
protected

the preferred location, as per construction

Definition at line 339 of file SignalView.h.

◆ m_selected_item

QSharedPointer<Kwave::ViewItem> Kwave::SignalView::m_selected_item
private

currently selected view item or null

Definition at line 438 of file SignalView.h.

Referenced by findNewItem(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and ~SignalView().

◆ m_siblings

QList<QPointer<QWidget> > Kwave::SignalView::m_siblings
private

list of associated widgets, e.g. controls etc

Definition at line 435 of file SignalView.h.

Referenced by addSibling(), and ~SignalView().

◆ m_signal_manager

◆ m_track_index

int Kwave::SignalView::m_track_index
protected

index of the associated track or -1 if no relation to a track

Definition at line 342 of file SignalView.h.

Referenced by setTrack().

◆ m_vertical_zoom

double Kwave::SignalView::m_vertical_zoom
private

zoom factor for vertical size

Definition at line 410 of file SignalView.h.

Referenced by setVerticalZoom().

◆ m_zoom

double Kwave::SignalView::m_zoom
protected

number of samples per pixel

Definition at line 351 of file SignalView.h.

Referenced by Kwave::TrackView::findItem(), pixels2samples(), samples2pixels(), selectionPosition(), and setZoomAndOffset().


The documentation for this class was generated from the following files: