void diagwin_t::populate() { GnomeCanvasGroup *root = gnome_canvas_root(GNOME_CANVAS(canvas_)); _log.debug("diagwin_t::populate\n"); while (root->item_list != 0) { gtk_object_destroy(GTK_OBJECT(root->item_list->data)); } set_diagram_colors(diagram_); diagram_->prepare(); scenegen_t *sg = new canvas_scenegen_t(GNOME_CANVAS(canvas_)); diagram_->render(sg); delete sg; /* setup the canvas to show the whole diagram */ dbounds_t bounds; diagram_->get_bounds(&bounds); gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas_), bounds.x1, bounds.y1, bounds.x2, bounds.y2); if (!GTK_WIDGET_REALIZED(canvas_)) gtk_signal_connect(GTK_OBJECT(canvas_), "realize", GTK_SIGNAL_FUNC(diagwin_realize_cb), 0); else zoom_all(); }
void MainWindow::createActions() { //exportAct = new QAction(tr("&Export as ..."),this); //exportAct->setShortcut(tr("Ctrl+E")); //connect(exportAct, SIGNAL(triggered()), this, SLOT(export_as())); zoomAllAct = new QAction(QIcon(":/images/home.png"),tr("Zoom All"),this); connect(zoomAllAct, SIGNAL(triggered()), this, SLOT(zoom_all())); zoomBoxAct = new QAction(QIcon(":/images/zoombox.png"),tr("Zoom To Box"),this); zoomBoxAct->setCheckable(true); connect(zoomBoxAct, SIGNAL(triggered()), this, SLOT(zoom_to_box())); panAct = new QAction(QIcon(":/images/pan.png"),tr("Pan"),this); panAct->setCheckable(true); connect(panAct, SIGNAL(triggered()), this, SLOT(pan())); infoAct = new QAction(QIcon(":/images/info.png"),tr("Info"),this); infoAct->setCheckable(true); connect(infoAct, SIGNAL(triggered()), this, SLOT(info())); toolsGroup=new QActionGroup(this); toolsGroup->addAction(zoomBoxAct); toolsGroup->addAction(panAct); toolsGroup->addAction(infoAct); zoomBoxAct->setChecked(true); openAct=new QAction(tr("Open Map definition"),this); connect(openAct,SIGNAL(triggered()),this,SLOT(open())); saveAct=new QAction(tr("Save Map definition"),this); connect(saveAct,SIGNAL(triggered()),this,SLOT(save())); panLeftAct = new QAction(QIcon(":/images/left.png"),tr("&Pan Left"),this); connect(panLeftAct, SIGNAL(triggered()), this, SLOT(pan_left())); panRightAct = new QAction(QIcon(":/images/right.png"),tr("&Pan Right"),this); connect(panRightAct, SIGNAL(triggered()), this, SLOT(pan_right())); panUpAct = new QAction(QIcon(":/images/up.png"),tr("&Pan Up"),this); connect(panUpAct, SIGNAL(triggered()), this, SLOT(pan_up())); panDownAct = new QAction(QIcon(":/images/down.png"),tr("&Pan Down"),this); connect(panDownAct, SIGNAL(triggered()), this, SLOT(pan_down())); reloadAct = new QAction(QIcon(":/images/reload.png"),tr("Reload"),this); connect(reloadAct, SIGNAL(triggered()), this, SLOT(reload())); layerInfo = new QAction(QIcon(":/images/info.png"),tr("&Layer info"),layerTab_); connect(layerInfo, SIGNAL(triggered()), layerTab_,SLOT(layerInfo())); connect(layerTab_, SIGNAL(doubleClicked(QModelIndex const&)), layerTab_,SLOT(layerInfo2(QModelIndex const&))); foreach (QByteArray format, QImageWriter::supportedImageFormats()) { QString text = tr("%1...").arg(QString(format).toUpper()); QAction *action = new QAction(text, this); action->setData(format); connect(action, SIGNAL(triggered()), this, SLOT(export_as())); exportAsActs.append(action); }
void MainWindow::load_map_file(QString const& filename) { std::cout<<"loading "<< filename.toStdString() << std::endl; unsigned width = mapWidget_->width(); unsigned height = mapWidget_->height(); boost::shared_ptr<mapnik::Map> map(new mapnik::Map(width,height)); mapWidget_->setMap(map); try { mapnik::load_map(*map,filename.toStdString()); } catch (mapnik::config_error & ex) { std::cout << ex.what() << "\n"; } catch (...) { std::cerr << "Exception caught in load_map\n"; } layerTab_->setModel(new LayerListModel(map,this)); styleTab_->setModel(new StyleModel(map,this)); zoom_all(); }
GLADE_CALLBACK void diagwin_t::on_show_all_activate() { _log.debug("diagwin_t::on_show_all_activate\n"); zoom_all(); }