[Rinside-commits] r200 - pkg/inst/examples/qt/qtdensitySVG

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Apr 2 05:33:43 CEST 2011


Author: edd
Date: 2011-04-02 05:33:43 +0200 (Sat, 02 Apr 2011)
New Revision: 200

Modified:
   pkg/inst/examples/qt/qtdensitySVG/qtdensity.cpp
   pkg/inst/examples/qt/qtdensitySVG/qtdensity.h
Log:
minor polish


Modified: pkg/inst/examples/qt/qtdensitySVG/qtdensity.cpp
===================================================================
--- pkg/inst/examples/qt/qtdensitySVG/qtdensity.cpp	2011-04-02 03:29:07 UTC (rev 199)
+++ pkg/inst/examples/qt/qtdensitySVG/qtdensity.cpp	2011-04-02 03:33:43 UTC (rev 200)
@@ -17,9 +17,10 @@
     m_R["bw"] = m_bw;		// pass bandwidth to R, and have R compute a temp.file name
     m_tempfile = QString::fromStdString(Rcpp::as<std::string>(m_R.parseEval("tfile <- tempfile()")));
     m_svgfile = QString::fromStdString(Rcpp::as<std::string>(m_R.parseEval("sfile <- tempfile()")));
-    m_has_svg = false; //m_R.parseEval("require(cairoDevice)");
-    if ( ! m_has_svg)
-	std::cerr << "Consider installing the 'cairoDevice' package from CRAN for SVG graphics." << std::endl;
+    m_use_svg = m_R.parseEval("require(cairoDevice)");
+    if (!m_use_svg) {
+	std::cerr << "Consider installing the 'cairoDevice' package from CRAN to create SVG graphics." << std::endl;
+    }
     setupDisplay();
 }
 
@@ -67,7 +68,7 @@
     kernelGroup->addButton(radio5, 4);
     QObject::connect(kernelGroup, SIGNAL(buttonClicked(int)), this, SLOT(getKernel(int)));
 
-    if (m_has_svg) {		// svg case
+    if (m_use_svg) {		// svg case
 	m_svg = new QSvgWidget();
     } else {			// png default
 	m_imageLabel = new QLabel;
@@ -95,7 +96,7 @@
     upperlayout->addWidget(estimationBox);
 
     QHBoxLayout *lowerlayout = new QHBoxLayout;
-    if (m_has_svg) {
+    if (m_use_svg) {
 	lowerlayout->addWidget(m_svg);
     } else {
 	lowerlayout->addWidget(m_imageLabel);
@@ -106,7 +107,7 @@
     outer->addLayout(lowerlayout);
     window->setLayout(outer);
     window->show();
-    if (!m_has_svg) {
+    if (!m_use_svg) {
 	window->resize(650, 750);
     }
 }
@@ -116,7 +117,7 @@
     m_R["bw"] = m_bw;
     m_R["kernel"] = kernelstrings[m_kernel]; // that passes the string to R
     std::string cmd0;
-    if (m_has_svg) {	     // select device based on whether cairoDevice is available or not
+    if (m_use_svg) {	     // select device based on whether cairoDevice is available or not
 	cmd0 = "Cairo(width=6,height=6,pointsize=10,surface='svg',filename=tfile); ";
     } else {
 	cmd0 = "png(filename=tfile,width=600,height=600);";
@@ -125,7 +126,7 @@
     std::string cmd2 = "\"); points(y, rep(0, length(y)), pch=16, col=rgb(0,0,0,1/4));  dev.off()";
     std::string cmd = cmd0 + cmd1 + kernelstrings[m_kernel] + cmd2; // stick the selected kernel in the middle
     m_R.parseEvalQ(cmd);
-    if (m_has_svg) {
+    if (m_use_svg) {
 	filterFile();		// we need to simplify the svg file for display by Qt 
 	m_svg->load(m_svgfile);
     } else {

Modified: pkg/inst/examples/qt/qtdensitySVG/qtdensity.h
===================================================================
--- pkg/inst/examples/qt/qtdensitySVG/qtdensity.h	2011-04-02 03:29:07 UTC (rev 199)
+++ pkg/inst/examples/qt/qtdensitySVG/qtdensity.h	2011-04-02 03:33:43 UTC (rev 200)
@@ -46,7 +46,7 @@
     QString m_svgfile;		// another temp file, this time from Qt
     int m_bw, m_kernel;		// parameters used to estimate the density
     QString m_cmd;		// random draw command string
-    bool m_has_svg;		// create SVG if cairoDevice can be loaded
+    bool m_use_svg;		// create SVG if cairoDevice can be loaded
 };
 
 #endif



More information about the Rinside-commits mailing list