void dialogAnalog::slotLoad(void) { if (capture()) { QMessageBox::warning(mainwindow, "PockEmul", tr("Capture is running.\n") + tr("Stop capture before loading a sample") ); return; } QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), ".", tr("Analogic Sample (*.ana)")); QFile file(fileName); file.open(QIODevice::ReadOnly); QDataStream in(&file); mainwindow->analogMutex.lock(); // Read the data in >> dataplot; mainwindow->analogMutex.unlock(); m_zoom = 1.0; ComputeScrollBar(); this->update(); }
void dialogAnalog::zoomout(void) { m_zoom /= 2; if (m_zoom <1.0) m_zoom=1.0; ComputeScrollBar(); this->update(); }
void dialogAnalog::fitmarkers(void) { int new_pos = XToState(m_leftMarker); m_zoom = (float)( dataplot.Read_state(dataplot.size()-1) - dataplot.Read_state(0) ) / ( XToState(m_rightMarker) - XToState(m_leftMarker) ); ComputeScrollBar(); hlScrollBar->setValue(new_pos); setLeftMarker(0); setRightMarker(frame_dataview->width()); this->update(); }
suic::Size ScrollViewer::ArrangeOverride(const suic::Size& availableSize) { ClearVisualChildren(); suic::ElementPtr cont(GetContent()); if (cont) { suic::Rect rect; rect.right = availableSize.cx; rect.bottom = availableSize.cy; _vScroll->SetVisible(false); _hScroll->SetVisible(false); suic::Size desiredSize = cont->GetDesiredSize(); // // 计算是否有滚动条 // _hScroll->UpdateScrollInfo(rect.right, desiredSize.cx, false); _vScroll->UpdateScrollInfo(rect.bottom, desiredSize.cy, false); ComputeScrollBar(rect.right, rect.bottom, desiredSize.cx, desiredSize.cy); suic::PanelPtr lay(cont); if (lay) { lay->SetHorizontalOffset(_hScroll->GetScrollSize()); lay->SetVerticalOffset(_vScroll->GetScrollSize()); } rect.left += _contentOffset.x; rect.top += _contentOffset.y; if (rect.bottom > rect.top) { AddVisualChild(cont.get()); cont->Arrange(rect); } } return availableSize; }
void dialogAnalog::updatecapture(int state) { mainwindow->analogMutex.lock(); if (state == Qt::Checked ) { setCapture(true); dataplot.Clear(); pbZoomIn->setEnabled(false); pbZoomOut->setEnabled(false); pbFit->setEnabled(false); pbSave->setEnabled(false); pbLoad->setEnabled(false); groupBox->setEnabled(false); chkBShowMarker->setEnabled(false); } else { setCapture(false); // Store timeref dataplot.timeUnit = ( pPC->pTIMER->CPUSpeed * pPC->getfrequency() ); ComputeScrollBar(); pbZoomIn->setEnabled(true); pbZoomOut->setEnabled(true); pbFit->setEnabled(true); pbSave->setEnabled(true); pbLoad->setEnabled(true); groupBox->setEnabled(true); chkBShowMarker->setEnabled(true); this->update(); } mainwindow->analogMutex.unlock(); }
void dialogAnalog::zoomin(void) { m_zoom *= 2; ComputeScrollBar(); this->update(); }