From e43840c7360f2c1042aea3a228e157d37e0c5a86 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Tue, 4 Sep 2012 11:27:46 +0100 Subject: [PATCH] Renamed SigView to SigViewport --- CMakeLists.txt | 4 +-- mainwindow.cpp | 4 +-- mainwindow.h | 4 +-- sigview.cpp => sigviewport.cpp | 46 +++++++++++++++++----------------- sigview.h => sigviewport.h | 10 ++++---- 5 files changed, 34 insertions(+), 34 deletions(-) rename sigview.cpp => sigviewport.cpp (82%) rename sigview.h => sigviewport.h (91%) diff --git a/CMakeLists.txt b/CMakeLists.txt index eda85202..5ae27aab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ set(pulseview_SOURCES signaldata.cpp sigsession.cpp signal.cpp - sigview.cpp + sigviewport.cpp ) set(pulseview_HEADERS @@ -34,7 +34,7 @@ set(pulseview_HEADERS mainwindow.h samplingbar.h sigsession.h - sigview.h + sigviewport.h ) set(pulseview_FORMS diff --git a/mainwindow.cpp b/mainwindow.cpp index 54cc39ec..865d6e2a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -35,7 +35,7 @@ extern "C" { #include "about.h" #include "mainwindow.h" #include "samplingbar.h" -#include "sigview.h" +#include "sigviewport.h" extern "C" { /* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ @@ -138,7 +138,7 @@ void MainWindow::setup_ui() _menu_view->setTitle(QApplication::translate("MainWindow", "&View", 0, QApplication::UnicodeUTF8)); _menu_help->setTitle(QApplication::translate("MainWindow", "&Help", 0, QApplication::UnicodeUTF8)); - _view = new SigView(_session, this); + _view = new SigViewport(_session, this); _vertical_layout->addWidget(_view); } diff --git a/mainwindow.h b/mainwindow.h index 6a1e52ca..811ea15e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -26,7 +26,7 @@ #include "sigsession.h" class SamplingBar; -class SigView; +class SigViewport; namespace Ui { class MainWindow; @@ -53,7 +53,7 @@ private: private: SigSession _session; - SigView *_view; + SigViewport *_view; QAction *_action_open; QAction *_action_view_zoom_in; diff --git a/sigview.cpp b/sigviewport.cpp similarity index 82% rename from sigview.cpp rename to sigviewport.cpp index 5601be57..1ec93129 100644 --- a/sigview.cpp +++ b/sigviewport.cpp @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "sigview.h" +#include "sigviewport.h" #include "sigsession.h" #include "signal.h" @@ -35,21 +35,21 @@ using namespace boost; using namespace std; -const double SigView::MaxScale = 1e9; -const double SigView::MinScale = 1e-15; +const double SigViewport::MaxScale = 1e9; +const double SigViewport::MinScale = 1e-15; -const int SigView::SignalHeight = 50; -const int SigView::LabelMarginWidth = 70; -const int SigView::RulerHeight = 30; +const int SigViewport::SignalHeight = 50; +const int SigViewport::LabelMarginWidth = 70; +const int SigViewport::RulerHeight = 30; -const int SigView::MinorTickSubdivision = 4; -const int SigView::ScaleUnits[3] = {1, 2, 5}; +const int SigViewport::MinorTickSubdivision = 4; +const int SigViewport::ScaleUnits[3] = {1, 2, 5}; -const QString SigView::SIPrefixes[9] = +const QString SigViewport::SIPrefixes[9] = {"f", "p", "n", QChar(0x03BC), "m", "", "k", "M", "G"}; -const int SigView::FirstSIPrefixPower = -15; +const int SigViewport::FirstSIPrefixPower = -15; -SigView::SigView(SigSession &session, QWidget *parent) : +SigViewport::SigViewport(SigSession &session, QWidget *parent) : QGLWidget(parent), _session(session), _scale(1e-6), @@ -62,21 +62,21 @@ SigView::SigView(SigSession &session, QWidget *parent) : setAutoFillBackground(false); } -void SigView::zoom(double steps) +void SigViewport::zoom(double steps) { zoom(steps, (width() - LabelMarginWidth) / 2); } -void SigView::initializeGL() +void SigViewport::initializeGL() { } -void SigView::resizeGL(int width, int height) +void SigViewport::resizeGL(int width, int height) { setup_viewport(width, height); } -void SigView::paintEvent(QPaintEvent *event) +void SigViewport::paintEvent(QPaintEvent *event) { int offset; @@ -137,12 +137,12 @@ void SigView::paintEvent(QPaintEvent *event) painter.end(); } -void SigView::data_updated() +void SigViewport::data_updated() { update(); } -void SigView::mousePressEvent(QMouseEvent *event) +void SigViewport::mousePressEvent(QMouseEvent *event) { assert(event); @@ -150,7 +150,7 @@ void SigView::mousePressEvent(QMouseEvent *event) _mouse_down_offset = _offset; } -void SigView::mouseMoveEvent(QMouseEvent *event) +void SigViewport::mouseMoveEvent(QMouseEvent *event) { assert(event); @@ -161,18 +161,18 @@ void SigView::mouseMoveEvent(QMouseEvent *event) } } -void SigView::mouseReleaseEvent(QMouseEvent *event) +void SigViewport::mouseReleaseEvent(QMouseEvent *event) { assert(event); } -void SigView::wheelEvent(QWheelEvent *event) +void SigViewport::wheelEvent(QWheelEvent *event) { assert(event); zoom(event->delta() / 120, event->x() - LabelMarginWidth); } -void SigView::setup_viewport(int width, int height) +void SigViewport::setup_viewport(int width, int height) { glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); @@ -181,7 +181,7 @@ void SigView::setup_viewport(int width, int height) glMatrixMode(GL_MODELVIEW); } -void SigView::paint_ruler(QPainter &p) +void SigViewport::paint_ruler(QPainter &p) { const double MinSpacing = 80; @@ -243,7 +243,7 @@ void SigView::paint_ruler(QPainter &p) } } -void SigView::zoom(double steps, int offset) +void SigViewport::zoom(double steps, int offset) { const double cursor_offset = _offset + _scale * offset; _scale *= pow(3.0/2.0, -steps); diff --git a/sigview.h b/sigviewport.h similarity index 91% rename from sigview.h rename to sigviewport.h index 3630d17e..0846ca51 100644 --- a/sigview.h +++ b/sigviewport.h @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef SIGVIEW_H -#define SIGVIEW_H +#ifndef SIGVIEWPORT_H +#define SIGVIEWPORT_H #include #include @@ -28,7 +28,7 @@ class QPainter; class QPaintEvent; class SigSession; -class SigView : public QGLWidget +class SigViewport : public QGLWidget { Q_OBJECT @@ -47,7 +47,7 @@ private: static const int FirstSIPrefixPower; public: - explicit SigView(SigSession &session, QWidget *parent = 0); + explicit SigViewport(SigSession &session, QWidget *parent = 0); void zoom(double steps); @@ -85,4 +85,4 @@ private: double _mouse_down_offset; }; -#endif // SIGVIEW_H +#endif // SIGVIEWPORT_H -- 2.30.2