|  |  | @ -7,9 +7,11 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QMouseEvent> |  |  |  | #include <QMouseEvent> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QPainter> |  |  |  | #include <QPainter> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QScrollBar> |  |  |  | #include <QScrollBar> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #include <QShortcut> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QToolTip> |  |  |  | #include <QToolTip> | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "tools/cabana/commands.h" |  |  |  | #include "tools/cabana/commands.h" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #include "tools/cabana/signaledit.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "tools/cabana/streams/abstractstream.h" |  |  |  | #include "tools/cabana/streams/abstractstream.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | // BinaryView
 |  |  |  | // BinaryView
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -38,6 +40,63 @@ BinaryView::BinaryView(QWidget *parent) : QTableView(parent) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   QObject::connect(dbc(), &DBCManager::DBCFileChanged, this, &BinaryView::refresh); |  |  |  |   QObject::connect(dbc(), &DBCManager::DBCFileChanged, this, &BinaryView::refresh); | 
			
		
	
		
		
			
				
					
					|  |  |  |   QObject::connect(UndoStack::instance(), &QUndoStack::indexChanged, this, &BinaryView::refresh); |  |  |  |   QObject::connect(UndoStack::instance(), &QUndoStack::indexChanged, this, &BinaryView::refresh); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   addShortcuts(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | void BinaryView::addShortcuts() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   // Delete (x, backspace, delete)
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_delete_x = new QShortcut(QKeySequence(Qt::Key_X), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_delete_backspace = new QShortcut(QKeySequence(Qt::Key_Backspace), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_delete_delete = new QShortcut(QKeySequence(Qt::Key_Delete), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_delete_delete, &QShortcut::activated, shortcut_delete_x, &QShortcut::activated); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_delete_backspace, &QShortcut::activated, shortcut_delete_x, &QShortcut::activated); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_delete_x, &QShortcut::activated, [=]{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (hovered_sig != nullptr) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       emit removeSignal(hovered_sig); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       hovered_sig = nullptr; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   // Change endianness (e)
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_endian = new QShortcut(QKeySequence(Qt::Key_E), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_endian, &QShortcut::activated, [=]{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (hovered_sig != nullptr) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const Signal *hovered_sig_prev = hovered_sig; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       Signal s = *hovered_sig; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       s.is_little_endian = !s.is_little_endian; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       emit editSignal(hovered_sig, s); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       hovered_sig = nullptr; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       highlight(hovered_sig_prev); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   // Change signedness (s)
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_sign = new QShortcut(QKeySequence(Qt::Key_S), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_sign, &QShortcut::activated, [=]{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (hovered_sig != nullptr) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       const Signal *hovered_sig_prev = hovered_sig; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       Signal s = *hovered_sig; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       s.is_signed = !s.is_signed; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       emit editSignal(hovered_sig, s); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       hovered_sig = nullptr; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       highlight(hovered_sig_prev); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   // Open chart (c, p, g)
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_plot = new QShortcut(QKeySequence(Qt::Key_P), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_plot_g = new QShortcut(QKeySequence(Qt::Key_G), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QShortcut *shortcut_plot_c = new QShortcut(QKeySequence(Qt::Key_C), this); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_plot_g, &QShortcut::activated, shortcut_plot, &QShortcut::activated); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_plot_c, &QShortcut::activated, shortcut_plot, &QShortcut::activated); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   QObject::connect(shortcut_plot, &QShortcut::activated, [=]{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (hovered_sig != nullptr) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       emit showChart(model->msg_id, hovered_sig, true, false); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | QSize BinaryView::minimumSizeHint() const { |  |  |  | QSize BinaryView::minimumSizeHint() const { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |