void MapWidget::init() { _canvas.setBackgroundColor(palette().color(QPalette::Window)); connect(&_canvas, SIGNAL(bufferUpdated()), this, SLOT(bufferUpdated())); connect(&_canvas, SIGNAL(projectionChanged(Seiscomp::Gui::Map::Projection*)), this, SLOT(projectionChanged(Seiscomp::Gui::Map::Projection*))); connect(&_canvas, SIGNAL(customLayer(QPainter*)), this, SLOT(drawCustomLayer(QPainter*))); connect(&_canvas, SIGNAL(updateRequested()), this, SLOT(update())); _isDragging = false; _isMeasuring = false; _isMeasureDragging = false; _filterMap = SCScheme.map.bilinearFilter; _canvas.setBilinearFilter(_filterMap); setMouseTracking(true); setFocusPolicy(Qt::StrongFocus); //setAttribute(Qt::WA_PaintOnScreen); try { _zoomSensitivity = SCApp->configGetDouble("map.zoom.sensitivity"); } catch ( ... ) { _zoomSensitivity = 0.5; } _zoomControls = new QWidget(this); QToolButton *zoomIn = new QToolButton; QToolButton *zoomOut = new QToolButton; QVBoxLayout *zoomLayout = new QVBoxLayout; _zoomControls->setLayout(zoomLayout); zoomLayout->addWidget(zoomIn); zoomLayout->addWidget(zoomOut); zoomIn->setIcon(QIcon(":/map/icons/zoomin.png")); zoomOut->setIcon(QIcon(":/map/icons/zoomout.png")); _zoomControls->move(0,0); _zoomControls->hide(); connect(zoomIn, SIGNAL(pressed()), this, SLOT(zoomIn())); connect(zoomOut, SIGNAL(pressed()), this, SLOT(zoomOut())); _measureBNADialog = NULL; _forceGrayScale = false; }
void DocTabView::setBuffer(int index, BufferID id) { if (index < 0 || index >= (int)_nbItem) return; TCITEM tie; tie.lParam = (LPARAM)id; tie.mask = TCIF_PARAM; ::SendMessage(_hSelf, TCM_SETITEM, index, reinterpret_cast<LPARAM>(&tie)); bufferUpdated(MainFileManager->getBufferByID(id), BufferChangeMask); //update tab, everything has changed ::SendMessage(_hParent, WM_SIZE, 0, 0); }
void DocTabView::addBuffer(BufferID buffer) { if (buffer == BUFFER_INVALID) //valid only return; if (this->getIndexByBuffer(buffer) != -1) //no duplicates return; Buffer * buf = MainFileManager->getBufferByID(buffer); TCITEM tie; tie.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; int index = -1; if (_hasImgLst) index = 0; tie.iImage = index; tie.pszText = (TCHAR *)buf->getFileName(); tie.lParam = (LPARAM)buffer; ::SendMessage(_hSelf, TCM_INSERTITEM, _nbItem++, reinterpret_cast<LPARAM>(&tie)); bufferUpdated(buf, BufferChangeMask); ::SendMessage(_hParent, WM_SIZE, 0, 0); }