projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix #942 by making sure we always have at least one positive div
[pulseview.git]
/
pv
/
view
/
ruler.cpp
diff --git
a/pv/view/ruler.cpp
b/pv/view/ruler.cpp
index 393af57711c699732c84cfd05c1ee9933dff0f6d..712244a9df8cc9a4399d80217ac413467abd0f5d 100644
(file)
--- a/
pv/view/ruler.cpp
+++ b/
pv/view/ruler.cpp
@@
-14,8
+14,7
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <extdef.h>
*/
#include <extdef.h>
@@
-29,16
+28,18
@@
using namespace Qt;
using namespace Qt;
+using std::function;
using std::shared_ptr;
using std::vector;
namespace pv {
using std::shared_ptr;
using std::vector;
namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
-const float Ruler::RulerHeight = 2.5f;
// x Text Height
+const float Ruler::RulerHeight = 2.5f; // x Text Height
const int Ruler::MinorTickSubdivision = 4;
const int Ruler::MinorTickSubdivision = 4;
-const float Ruler::HoverArrowSize = 0.5f;
// x Text Height
+const float Ruler::HoverArrowSize = 0.5f; // x Text Height
Ruler::Ruler(View &parent) :
MarginWidget(parent)
Ruler::Ruler(View &parent) :
MarginWidget(parent)
@@
-70,7
+71,7
@@
QSize Ruler::sizeHint() const
QSize Ruler::extended_size_hint() const
{
QRectF max_rect;
QSize Ruler::extended_size_hint() const
{
QRectF max_rect;
-
std::vector< std::
shared_ptr<TimeItem> > items(view_.time_items());
+
vector<
shared_ptr<TimeItem> > items(view_.time_items());
for (auto &i : items)
max_rect = max_rect.united(i->label_rect(QRect()));
return QSize(0, sizeHint().height() - max_rect.top() / 2 +
for (auto &i : items)
max_rect = max_rect.united(i->label_rect(QRect()));
return QSize(0, sizeHint().height() - max_rect.top() / 2 +
@@
-128,8
+129,7
@@
shared_ptr<ViewItem> Ruler::get_mouse_over_item(const QPoint &pt)
void Ruler::paintEvent(QPaintEvent*)
{
if (!tick_position_cache_) {
void Ruler::paintEvent(QPaintEvent*)
{
if (!tick_position_cache_) {
- auto ffunc = [this](const pv::util::Timestamp& t)
- {
+ auto ffunc = [this](const pv::util::Timestamp& t) {
return format_time_with_distance(
this->view_.tick_period(),
t,
return format_time_with_distance(
this->view_.tick_period(),
t,
@@
-194,7
+194,7
@@
Ruler::TickPositions Ruler::calculate_tick_positions(
const pv::util::Timestamp& offset,
const double scale,
const int width,
const pv::util::Timestamp& offset,
const double scale,
const int width,
-
std::
function<QString(const pv::util::Timestamp&)> format_function)
+ function<QString(const pv::util::Timestamp&)> format_function)
{
TickPositions tp;
{
TickPositions tp;
@@
-226,9
+226,9
@@
Ruler::TickPositions Ruler::calculate_tick_positions(
return tp;
}
return tp;
}
-void Ruler::mouseDoubleClickEvent(QMouseEvent *e)
+void Ruler::mouseDoubleClickEvent(QMouseEvent *e
vent
)
{
{
- view_.add_flag(view_.offset() + ((double)e->x() + 0.5) * view_.scale());
+ view_.add_flag(view_.offset() + ((double)e
vent
->x() + 0.5) * view_.scale());
}
void Ruler::draw_hover_mark(QPainter &p, int text_height)
}
void Ruler::draw_hover_mark(QPainter &p, int text_height)
@@
-272,5
+272,6
@@
void Ruler::resizeEvent(QResizeEvent*)
invalidate_tick_position_cache();
}
invalidate_tick_position_cache();
}
-} // namespace view
+} // namespace TraceView
+} // namespace views
} // namespace pv
} // namespace pv