pv/view/rowitemowner.cpp
pv/view/rowitempaintparams.cpp
pv/view/ruler.cpp
- pv/view/selectableitem.cpp
pv/view/signal.cpp
pv/view/timeitem.cpp
pv/view/timemarker.cpp
pv/view/tracegroup.cpp
pv/view/tracepalette.cpp
pv/view/view.cpp
+ pv/view/viewitem.cpp
pv/view/viewport.cpp
pv/widgets/colourbutton.cpp
pv/widgets/colourpopup.cpp
pv/view/marginwidget.hpp
pv/view/rowitem.hpp
pv/view/ruler.hpp
- pv/view/selectableitem.hpp
pv/view/signal.hpp
pv/view/timeitem.hpp
pv/view/timemarker.hpp
pv/view/trace.hpp
pv/view/tracegroup.hpp
pv/view/view.hpp
+ pv/view/viewitem.hpp
pv/view/viewport.hpp
pv/widgets/colourbutton.hpp
pv/widgets/colourpopup.hpp
namespace pv {
namespace view {
-class SelectableItem;
+class ViewItem;
}
const char *MainWindow::SettingOpenDirectory = "MainWindow/OpenDirectory";
p.setPen(Cursor::FillColour.lighter());
p.drawRoundedRect(delta_rect, highlight_radius, highlight_radius);
- p.setPen(SelectableItem::select_text_colour(
+ p.setPen(ViewItem::select_text_colour(
Cursor::FillColour));
p.drawText(text_rect, Qt::AlignCenter | Qt::AlignVCenter,
pv::util::format_time(second_->time() - first_->time(), prefix, 2));
#include <QPropertyAnimation>
#include "rowitempaintparams.hpp"
-#include "selectableitem.hpp"
+#include "viewitem.hpp"
namespace pv {
namespace view {
class RowItemOwner;
-class RowItem : public SelectableItem,
+class RowItem : public ViewItem,
public std::enable_shared_from_this<pv::view::RowItem>
{
Q_OBJECT
+++ /dev/null
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "selectableitem.hpp"
-
-#include <climits>
-
-#include <QApplication>
-#include <QMenu>
-#include <QPalette>
-
-namespace pv {
-namespace view {
-
-const int SelectableItem::HighlightRadius = 6;
-
-SelectableItem::SelectableItem() :
- context_parent_(NULL),
- selected_(false),
- drag_point_(INT_MIN, INT_MIN)
-{
-}
-
-bool SelectableItem::selected() const
-{
- return selected_;
-}
-
-void SelectableItem::select(bool select)
-{
- selected_ = select;
-}
-
-bool SelectableItem::dragging() const
-{
- return drag_point_.x() != INT_MIN && drag_point_.y() != INT_MIN;
-}
-
-QPoint SelectableItem::drag_point() const
-{
- return drag_point_;
-}
-
-void SelectableItem::drag()
-{
- drag_point_ = point();
-}
-
-void SelectableItem::drag_release()
-{
- drag_point_ = QPoint(INT_MIN, INT_MIN);
-}
-
-QMenu* SelectableItem::create_context_menu(QWidget *parent)
-{
- context_parent_ = parent;
- return new QMenu(parent);
-}
-
-void SelectableItem::delete_pressed()
-{
-}
-
-QPen SelectableItem::highlight_pen()
-{
- return QPen(QApplication::palette().brush(
- QPalette::Highlight), HighlightRadius,
- Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
-}
-
-QColor SelectableItem::select_text_colour(QColor background)
-{
- return (background.lightness() > 64) ? Qt::black : Qt::white;
-}
-
-} // namespace view
-} // namespace pv
+++ /dev/null
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef PULSEVIEW_PV_SELECTABLEITEM_H
-#define PULSEVIEW_PV_SELECTABLEITEM_H
-
-#include <list>
-
-#include <QPen>
-
-class QAction;
-class QMenu;
-class QWidget;
-
-namespace pv {
-
-namespace widgets {
-class Popup;
-}
-
-namespace view {
-
-class SelectableItem : public QObject
-{
- Q_OBJECT
-
-private:
- static const int HighlightRadius;
-
-public:
- SelectableItem();
-
-public:
- /**
- * Returns true if the item is visible and enabled.
- */
- virtual bool enabled() const = 0;
-
- /**
- * Returns true if the item has been selected by the user.
- */
- bool selected() const;
-
- /**
- * Selects or deselects the signal.
- */
- void select(bool select = true);
-
- /**
- * Returns true if the item is being dragged.
- */
- bool dragging() const;
-
- /**
- * Retunrns the current drag point.
- */
- QPoint drag_point() const;
-
- /**
- * Sets this item into the dragged state.
- */
- void drag();
-
- /**
- * Sets this item into the un-dragged state.
- */
- void drag_release();
-
- /**
- * Get the drag point.
- */
- virtual QPoint point() const = 0;
-
- /**
- * Computes the outline rectangle of a label.
- * @param rect the rectangle of the header area.
- * @return Returns the rectangle of the signal label.
- */
- virtual QRectF label_rect(const QRectF &rect) const = 0;
-
-public:
- /**
- * Gets the text colour.
- * @remarks This colour is computed by comparing the lightness
- * of the trace colour against a threshold to determine whether
- * white or black would be more visible.
- */
- static QColor select_text_colour(QColor background);
-
-public:
- virtual QMenu* create_context_menu(QWidget *parent);
-
- virtual pv::widgets::Popup* create_popup(QWidget *parent) = 0;
-
- virtual void delete_pressed();
-
-protected:
- static QPen highlight_pen();
-
-protected:
- QWidget *context_parent_;
-
-private:
- bool selected_;
- QPoint drag_point_;
-};
-
-} // namespace view
-} // namespace pv
-
-#endif // PULSEVIEW_PV_SELECTABLEITEM_H
#ifndef PULSEVIEW_PV_VIEW_TIMEITEM_H
#define PULSEVIEW_PV_VIEW_TIMEITEM_H
-#include "selectableitem.hpp"
+#include "viewitem.hpp"
namespace pv {
namespace view {
class View;
-class TimeItem : public SelectableItem
+class TimeItem : public ViewItem
{
Q_OBJECT
QMenu* Trace::create_context_menu(QWidget *parent)
{
- QMenu *const menu = SelectableItem::create_context_menu(parent);
+ QMenu *const menu = ViewItem::create_context_menu(parent);
return menu;
}
--- /dev/null
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "viewitem.hpp"
+
+#include <climits>
+
+#include <QApplication>
+#include <QMenu>
+#include <QPalette>
+
+namespace pv {
+namespace view {
+
+const int ViewItem::HighlightRadius = 6;
+
+ViewItem::ViewItem() :
+ context_parent_(NULL),
+ selected_(false),
+ drag_point_(INT_MIN, INT_MIN)
+{
+}
+
+bool ViewItem::selected() const
+{
+ return selected_;
+}
+
+void ViewItem::select(bool select)
+{
+ selected_ = select;
+}
+
+bool ViewItem::dragging() const
+{
+ return drag_point_.x() != INT_MIN && drag_point_.y() != INT_MIN;
+}
+
+QPoint ViewItem::drag_point() const
+{
+ return drag_point_;
+}
+
+void ViewItem::drag()
+{
+ drag_point_ = point();
+}
+
+void ViewItem::drag_release()
+{
+ drag_point_ = QPoint(INT_MIN, INT_MIN);
+}
+
+QMenu* ViewItem::create_context_menu(QWidget *parent)
+{
+ context_parent_ = parent;
+ return new QMenu(parent);
+}
+
+void ViewItem::delete_pressed()
+{
+}
+
+QPen ViewItem::highlight_pen()
+{
+ return QPen(QApplication::palette().brush(
+ QPalette::Highlight), HighlightRadius,
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
+}
+
+QColor ViewItem::select_text_colour(QColor background)
+{
+ return (background.lightness() > 64) ? Qt::black : Qt::white;
+}
+
+} // namespace view
+} // namespace pv
--- /dev/null
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef PULSEVIEW_PV_VIEWITEM_H
+#define PULSEVIEW_PV_VIEWITEM_H
+
+#include <list>
+
+#include <QPen>
+
+class QAction;
+class QMenu;
+class QWidget;
+
+namespace pv {
+
+namespace widgets {
+class Popup;
+}
+
+namespace view {
+
+class ViewItem : public QObject
+{
+ Q_OBJECT
+
+private:
+ static const int HighlightRadius;
+
+public:
+ ViewItem();
+
+public:
+ /**
+ * Returns true if the item is visible and enabled.
+ */
+ virtual bool enabled() const = 0;
+
+ /**
+ * Returns true if the item has been selected by the user.
+ */
+ bool selected() const;
+
+ /**
+ * Selects or deselects the signal.
+ */
+ void select(bool select = true);
+
+ /**
+ * Returns true if the item is being dragged.
+ */
+ bool dragging() const;
+
+ /**
+ * Retunrns the current drag point.
+ */
+ QPoint drag_point() const;
+
+ /**
+ * Sets this item into the dragged state.
+ */
+ void drag();
+
+ /**
+ * Sets this item into the un-dragged state.
+ */
+ void drag_release();
+
+ /**
+ * Get the drag point.
+ */
+ virtual QPoint point() const = 0;
+
+ /**
+ * Computes the outline rectangle of a label.
+ * @param rect the rectangle of the header area.
+ * @return Returns the rectangle of the signal label.
+ */
+ virtual QRectF label_rect(const QRectF &rect) const = 0;
+
+public:
+ /**
+ * Gets the text colour.
+ * @remarks This colour is computed by comparing the lightness
+ * of the trace colour against a threshold to determine whether
+ * white or black would be more visible.
+ */
+ static QColor select_text_colour(QColor background);
+
+public:
+ virtual QMenu* create_context_menu(QWidget *parent);
+
+ virtual pv::widgets::Popup* create_popup(QWidget *parent) = 0;
+
+ virtual void delete_pressed();
+
+protected:
+ static QPen highlight_pen();
+
+protected:
+ QWidget *context_parent_;
+
+private:
+ bool selected_;
+ QPoint drag_point_;
+};
+
+} // namespace view
+} // namespace pv
+
+#endif // PULSEVIEW_PV_VIEWITEM_H
${PROJECT_SOURCE_DIR}/pv/view/rowitemowner.cpp
${PROJECT_SOURCE_DIR}/pv/view/rowitempaintparams.cpp
${PROJECT_SOURCE_DIR}/pv/view/ruler.cpp
- ${PROJECT_SOURCE_DIR}/pv/view/selectableitem.cpp
${PROJECT_SOURCE_DIR}/pv/view/signal.cpp
${PROJECT_SOURCE_DIR}/pv/view/timeitem.cpp
${PROJECT_SOURCE_DIR}/pv/view/timemarker.cpp
${PROJECT_SOURCE_DIR}/pv/view/tracegroup.cpp
${PROJECT_SOURCE_DIR}/pv/view/tracepalette.cpp
${PROJECT_SOURCE_DIR}/pv/view/view.cpp
+ ${PROJECT_SOURCE_DIR}/pv/view/viewitem.cpp
${PROJECT_SOURCE_DIR}/pv/view/viewport.cpp
${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.cpp
${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.cpp
${PROJECT_SOURCE_DIR}/pv/view/marginwidget.hpp
${PROJECT_SOURCE_DIR}/pv/view/rowitem.hpp
${PROJECT_SOURCE_DIR}/pv/view/ruler.hpp
- ${PROJECT_SOURCE_DIR}/pv/view/selectableitem.hpp
${PROJECT_SOURCE_DIR}/pv/view/signal.hpp
${PROJECT_SOURCE_DIR}/pv/view/timeitem.hpp
${PROJECT_SOURCE_DIR}/pv/view/timemarker.hpp
${PROJECT_SOURCE_DIR}/pv/view/trace.hpp
${PROJECT_SOURCE_DIR}/pv/view/tracegroup.hpp
${PROJECT_SOURCE_DIR}/pv/view/view.hpp
+ ${PROJECT_SOURCE_DIR}/pv/view/viewitem.hpp
${PROJECT_SOURCE_DIR}/pv/view/viewport.hpp
${PROJECT_SOURCE_DIR}/pv/widgets/colourbutton.hpp
${PROJECT_SOURCE_DIR}/pv/widgets/colourpopup.hpp