* 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>
using std::deque;
namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
const QColor AnalogSignal::SignalColours[4] = {
QColor(0xC4, 0xA0, 0x00), // Yellow
AnalogSignal::AnalogSignal(
pv::Session &session,
- shared_ptr<data::SignalBase> base,
- shared_ptr<data::Analog> data) :
+ shared_ptr<data::SignalBase> base) :
Signal(session, base),
- data_(data),
scale_index_(4), // 20 per div
scale_index_drag_offset_(0),
div_height_(3 * QFontMetrics(QApplication::font()).height()),
shared_ptr<pv::data::SignalData> AnalogSignal::data() const
{
- return data_;
+ return base_->analog_data();
}
-shared_ptr<pv::data::Analog> AnalogSignal::analog_data() const
+void AnalogSignal::save_settings(QSettings &settings) const
{
- return data_;
+ settings.setValue("vdivs", vdivs_);
+ settings.setValue("scale_index", scale_index_);
+}
+
+void AnalogSignal::restore_settings(QSettings &settings)
+{
+ if (settings.contains("vdivs"))
+ vdivs_ = settings.value("vdivs").toInt();
+
+ if (settings.contains("scale_index")) {
+ scale_index_ = settings.value("scale_index").toInt();
+ update_scale();
+ }
}
std::pair<int, int> AnalogSignal::v_extents() const
void AnalogSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp)
{
- assert(data_);
+ assert(base_->analog_data());
assert(owner_);
const int y = get_visual_y();
paint_grid(p, y, pp.left(), pp.right());
const deque< shared_ptr<pv::data::AnalogSegment> > &segments =
- data_->analog_segments();
+ base_->analog_data()->analog_segments();
if (segments.empty())
return;
owner_->row_item_appearance_changed(false, true);
}
-} // namespace view
+} // namespace TraceView
+} // namespace views
} // namespace pv