kwave
18.07.70
|
#include <CurveWidget.h>
Public Slots | |
void | selectInterpolationType (QAction *action) |
void | scaleFit () |
void | VFlip () |
void | HFlip () |
void | deleteLast () |
void | deleteSecond () |
void | firstHalf () |
void | secondHalf () |
void | savePreset () |
void | loadPreset (QAction *action) |
Public Member Functions | |
CurveWidget (QWidget *parent) | |
virtual | ~CurveWidget () Q_DECL_OVERRIDE |
QString | getCommand () |
void | setCurve (const QString &command) |
void | addPoint (double x, double y) |
Kwave::Curve::Point | findPoint (int sx, int sy) |
Protected Slots | |
virtual void | mousePressEvent (QMouseEvent *) Q_DECL_OVERRIDE |
virtual void | mouseReleaseEvent (QMouseEvent *) Q_DECL_OVERRIDE |
virtual void | mouseMoveEvent (QMouseEvent *) Q_DECL_OVERRIDE |
virtual void | paintEvent (QPaintEvent *) Q_DECL_OVERRIDE |
Protected Member Functions | |
void | loadPresetList () |
Private Attributes | |
int | m_width |
int | m_height |
Kwave::Curve | m_curve |
QMenu * | m_menu |
QMenu * | m_preset_menu |
Kwave::Curve::Point | m_current |
Kwave::Curve::Point | m_last |
bool | m_down |
QPixmap | m_knob |
QPixmap | m_selected_knob |
Definition at line 37 of file CurveWidget.h.
|
explicit |
Constructor
Definition at line 55 of file CurveWidget.cpp.
References _, Kwave::connect(), deleteLast(), deleteSecond(), Kwave::Interpolation::descriptions(), firstHalf(), Kwave::Curve::fromCommand(), HFlip(), loadPreset(), loadPresetList(), m_curve, m_knob, m_menu, m_preset_menu, m_selected_knob, savePreset(), scaleFit(), secondHalf(), selectInterpolationType(), and VFlip().
|
virtual |
void Kwave::CurveWidget::addPoint | ( | double | x, |
double | y | ||
) |
Adds a new point to the curve.
x | the point's x coordinate, should be [0.0...1.0] |
y | the point's y coordinate, should be [0.0...1.0] |
Definition at line 341 of file CurveWidget.cpp.
References Kwave::Curve::insert(), m_curve, m_last, and Kwave::Curve::NoPoint.
Referenced by mousePressEvent().
|
slot |
Deletes the last point of the curve.
Definition at line 310 of file CurveWidget.cpp.
References Kwave::Curve::deletePoint(), m_curve, m_last, and Kwave::Curve::NoPoint.
Referenced by CurveWidget().
|
slot |
Deletes the every second (even) point of the curve.
Definition at line 302 of file CurveWidget.cpp.
References Kwave::Curve::deleteSecondPoint(), m_curve, m_last, and Kwave::Curve::NoPoint.
Referenced by CurveWidget().
Kwave::Curve::Point Kwave::CurveWidget::findPoint | ( | int | sx, |
int | sy | ||
) |
Tries to find a point that is nearest to the given widget coordinates and within a tolerance.
sx | screen x coordinate, left is 0 |
sy | screen y coordinate, top is 0 |
Definition at line 349 of file CurveWidget.cpp.
References Kwave::Curve::findPoint(), m_curve, m_height, m_width, and Kwave::Curve::NoPoint.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
slot |
Scales the x coordinates of all points to 50% so that the curve's points move into the first half of the curve. A new "last" point with the y value of the previous last point will be inserted at x coordinate 1.0.
Definition at line 294 of file CurveWidget.cpp.
References Kwave::Curve::firstHalf(), m_curve, m_last, and Kwave::Curve::NoPoint.
Referenced by CurveWidget().
QString Kwave::CurveWidget::getCommand | ( | ) |
Returns a command string for the curve.
Definition at line 156 of file CurveWidget.cpp.
References Kwave::Curve::getCommand(), and m_curve.
|
slot |
Mirrors the curve on the y axis
Definition at line 320 of file CurveWidget.cpp.
References Kwave::Curve::HFlip(), and m_curve.
Referenced by CurveWidget().
|
slot |
Loads an existing preset.
action | the menu actio of the corresponding menu entry |
Definition at line 256 of file CurveWidget.cpp.
References DBG, Kwave::Curve::fromCommand(), m_current, m_curve, m_last, m_preset_menu, and Kwave::Curve::NoPoint.
Referenced by CurveWidget().
|
protected |
(Re-)Loads the list of preset files and fills the popup menu with all preset files.
Definition at line 226 of file CurveWidget.cpp.
References _, m_preset_menu, and name.
Referenced by CurveWidget(), and savePreset().
|
protectedvirtualslot |
Definition at line 397 of file CurveWidget.cpp.
References Kwave::Curve::deletePoint(), findPoint(), Kwave::Curve::findPoint(), Kwave::Curve::insert(), m_current, m_curve, m_height, m_width, and Kwave::Curve::NoPoint.
|
protectedvirtualslot |
Definition at line 361 of file CurveWidget.cpp.
References addPoint(), findPoint(), m_current, m_down, m_height, m_menu, m_width, and Kwave::Curve::NoPoint.
|
protectedvirtualslot |
Definition at line 388 of file CurveWidget.cpp.
References m_current, m_down, m_last, and Kwave::Curve::NoPoint.
|
protectedvirtualslot |
Definition at line 448 of file CurveWidget.cpp.
References Kwave::Curve::interpolation(), m_current, m_curve, m_down, m_height, m_knob, m_last, m_selected_knob, m_width, rect(), and Kwave::toInt().
|
slot |
Definition at line 182 of file CurveWidget.cpp.
References _, DBG, Kwave::Curve::getCommand(), Kwave::Logger::Info, loadPresetList(), Kwave::Logger::log(), m_curve, name, and Kwave::FileDialog::SaveFile.
Referenced by CurveWidget().
|
slot |
Scales the size of the curve so that all interpolated points are between 0.0 and 1.0 in x and y direction.
Definition at line 334 of file CurveWidget.cpp.
References m_curve, and Kwave::Curve::scaleFit().
Referenced by CurveWidget().
|
slot |
Like firstHalf(), but moves points to the right half.
Definition at line 286 of file CurveWidget.cpp.
References m_curve, m_last, Kwave::Curve::NoPoint, and Kwave::Curve::secondHalf().
Referenced by CurveWidget().
|
slot |
Selects a new interpolation type by it's numeric index. Used from the mouse context menu.
Definition at line 169 of file CurveWidget.cpp.
References Kwave::Interpolation::findByIndex(), m_curve, and Kwave::Curve::setInterpolationType().
Referenced by CurveWidget().
void Kwave::CurveWidget::setCurve | ( | const QString & | command | ) |
Sets the curve parameters/points from a command string.
Definition at line 162 of file CurveWidget.cpp.
References Kwave::Curve::fromCommand(), and m_curve.
|
slot |
Mirrors the curve on the y axis
Definition at line 327 of file CurveWidget.cpp.
References m_curve, and Kwave::Curve::VFlip().
Referenced by CurveWidget().
|
private |
Currently selected point or null if none selected
Definition at line 151 of file CurveWidget.h.
Referenced by loadPreset(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and paintEvent().
|
private |
The curve to be edited
Definition at line 139 of file CurveWidget.h.
Referenced by addPoint(), CurveWidget(), deleteLast(), deleteSecond(), findPoint(), firstHalf(), getCommand(), HFlip(), loadPreset(), mouseMoveEvent(), paintEvent(), savePreset(), scaleFit(), secondHalf(), selectInterpolationType(), setCurve(), and VFlip().
|
private |
State of the left mouse button (when moving points)
Definition at line 157 of file CurveWidget.h.
Referenced by mousePressEvent(), mouseReleaseEvent(), and paintEvent().
|
private |
Cached height of the widget
Definition at line 136 of file CurveWidget.h.
Referenced by findPoint(), mouseMoveEvent(), mousePressEvent(), and paintEvent().
|
private |
pixmap for the unselected knob
Definition at line 160 of file CurveWidget.h.
Referenced by CurveWidget(), and paintEvent().
|
private |
Last selected point, remembered for deleting.
Definition at line 154 of file CurveWidget.h.
Referenced by addPoint(), deleteLast(), deleteSecond(), firstHalf(), loadPreset(), mouseReleaseEvent(), paintEvent(), and secondHalf().
|
private |
Popup (context) menu for the right mouse button
Definition at line 142 of file CurveWidget.h.
Referenced by CurveWidget(), mousePressEvent(), and ~CurveWidget().
|
private |
Part of the popup (context) menu for the right mouse button with the list of preset files
Definition at line 148 of file CurveWidget.h.
Referenced by CurveWidget(), loadPreset(), and loadPresetList().
|
private |
pixmap for the selected knob
Definition at line 163 of file CurveWidget.h.
Referenced by CurveWidget(), and paintEvent().
|
private |
Cached width of the widget
Definition at line 133 of file CurveWidget.h.
Referenced by findPoint(), mouseMoveEvent(), mousePressEvent(), and paintEvent().