From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/grapher-nsplugin-example.html | 234 ++++++++++++++++----------------- 1 file changed, 117 insertions(+), 117 deletions(-) (limited to 'doc/html/grapher-nsplugin-example.html') diff --git a/doc/html/grapher-nsplugin-example.html b/doc/html/grapher-nsplugin-example.html index eef68856c..03759058c 100644 --- a/doc/html/grapher-nsplugin-example.html +++ b/doc/html/grapher-nsplugin-example.html @@ -72,17 +72,17 @@ to an image at the server.
Implementation:

// Include TQt Netscape Plugin classes.
-#include "qnp.h"
+#include "ntqnp.h"
 
 // Include other TQt classes.
-#include <qpainter.h>
-#include <qtextstream.h>
-#include <qbuffer.h>
-#include <qpixmap.h>
-#include <qmenubar.h>
-#include <qpushbutton.h>
-#include <qptrlist.h>
-#include <qmessagebox.h>
+#include <ntqpainter.h>
+#include <ntqtextstream.h>
+#include <ntqbuffer.h>
+#include <ntqpixmap.h>
+#include <ntqmenubar.h>
+#include <ntqpushbutton.h>
+#include <ntqptrlist.h>
+#include <ntqmessagebox.h>
 
 // Include some C library functions.
 #include <math.h>
@@ -105,7 +105,7 @@ public:
 
     union Datum {
         double dbl;
-        TQString* str;
+        TQString* str;
     };
 
     virtual TQPtrList<Datum>& graphData()=0;
@@ -164,12 +164,12 @@ signals:
 
 private:
     GraphModel& model;
-    TQMenuBar *menubar;
+    TQMenuBar *menubar;
     Style style;
-    TQPopupMenu* stylemenu;
+    TQPopupMenu* stylemenu;
     int pieRotationTimer;
     int pieRotation;
-    TQPixmap pm;
+    TQPixmap pm;
 
 private slots:
     void setStyleFromMenu(int id);
@@ -178,62 +178,62 @@ private slots:
 
 Graph::Graph( GraphModel& mdl ) :
     model(mdl),
-    style(Bar),
+    style(Bar),
     pieRotationTimer(0),
     pieRotation(0)
 {
     // Create a menubar for the widget
     //
-    menubar = new TQMenuBar( this );
-    stylemenu = new TQPopupMenu;
-    stylemenu->setCheckable(TRUE);
+    menubar = new TQMenuBar( this );
+    stylemenu = new TQPopupMenu;
+    stylemenu->setCheckable(TRUE);
     for ( Style s = Pie; styleName[s]; s = Style(s+1)) {
-        stylemenu->insertItem(styleName[s], s+100);
+        stylemenu->insertItem(styleName[s], s+100);
     }
-    connect(stylemenu, SIGNAL(activated(int)),
+    connect(stylemenu, SIGNAL(activated(int)),
         this, SLOT(setStyleFromMenu(int)));
-    setStyle(Pie);
+    setStyle(Pie);
 
-    menubar->insertItem("Style", stylemenu);
-    menubar->insertSeparator();
+    menubar->insertItem("Style", stylemenu);
+    menubar->insertSeparator();
 
-    TQPopupMenu* help = new TQPopupMenu;
-    help->insertItem( "About plugin...", this, SIGNAL(aboutPlugin()) );
-    help->insertItem( "About data...", this, SIGNAL(aboutData()) );
-    menubar->insertItem("Help", help);
-    menubar->hide();
+    TQPopupMenu* help = new TQPopupMenu;
+    help->insertItem( "About plugin...", this, SIGNAL(aboutPlugin()) );
+    help->insertItem( "About data...", this, SIGNAL(aboutData()) );
+    menubar->insertItem("Help", help);
+    menubar->hide();
 }
 
 Graph::~Graph()
 {
 }
 
-void Graph::setStyle(Style s)
+void Graph::setStyle(Style s)
 {
     if (style != s) {
         if (pieRotationTimer)
-            killTimer(pieRotationTimer);
-        stylemenu->setItemChecked(100+style, FALSE);
+            killTimer(pieRotationTimer);
+        stylemenu->setItemChecked(100+style, FALSE);
         style = s;
         if ( style == Pie )
-            pieRotationTimer = startTimer( 80 );
+            pieRotationTimer = startTimer( 80 );
         else
             pieRotationTimer = 0;
-        stylemenu->setItemChecked(100+style, TRUE);
-        update();
+        stylemenu->setItemChecked(100+style, TRUE);
+        update();
     }
 }
 
-void Graph::timerEvent(TQTimerEvent*)
+void Graph::timerEvent(TQTimerEvent*)
 {
     pieRotation = ( pieRotation + 6 ) % 360; repaint(FALSE);
 }
 
-void Graph::setStyle(const char* stext)
+void Graph::setStyle(const char* stext)
 {
     for ( Style s = Pie; styleName[s]; s = Style(s+1) ) {
-        if ( qstricmp(stext,styleName[s])==0 ) {
-            setStyle(s);
+        if ( qstricmp(stext,styleName[s])==0 ) {
+            setStyle(s);
             return;
         }
     }
@@ -241,19 +241,19 @@ void Graph::setStyle(const char* stext)
 
 void Graph::enterInstance()
 {
-    menubar->show();
+    menubar->show();
 }
 
 void Graph::leaveInstance()
 {
-    menubar->hide();
+    menubar->hide();
 }
 
 void Graph::paintError(const char* e)
 {
-    TQPainter p(this);
-    int w = width();
-    p.drawText(w/8, 0, w-w/4, height(), AlignCenter|WordBreak, e);
+    TQPainter p(this);
+    int w = width();
+    p.drawText(w/8, 0, w-w/4, height(), AlignCenter|WordBreak, e);
 }
 
 void Graph::paintBar(TQPaintEvent* event)
@@ -263,39 +263,39 @@ void Graph::paintBar(TQPaintEvent* event)
         return;
     }
 
-    TQPtrList<GraphModel::Datum>& data = model.graphData();
+    TQPtrList<GraphModel::Datum>& data = model.graphData();
 
     double max = 0.0;
 
-    for (GraphModel::Datum* rowdata = data.first();
-        rowdata; rowdata = data.next())
+    for (GraphModel::Datum* rowdata = data.first();
+        rowdata; rowdata = data.next())
     {
         if (rowdata[0].dbl > max) max = rowdata[0].dbl;
     }
 
-    const uint w = width();
-    const uint h = height();
+    const uint w = width();
+    const uint h = height();
 
-    TQPainter p(this);
+    TQPainter p(this);
 
-    p.setClipRect(event->rect());
+    p.setClipRect(event->rect());
 
-    if ( w > data.count() ) {
+    if ( w > data.count() ) {
         // More pixels than data
         int x = 0;
         int i = 0;
-        TQFontMetrics fm=fontMetrics();
-        int fh = fm.height();
+        TQFontMetrics fm=fontMetrics();
+        int fh = fm.height();
 
-        for (GraphModel::Datum* rowdata = data.first();
-            rowdata; rowdata = data.next())
+        for (GraphModel::Datum* rowdata = data.first();
+            rowdata; rowdata = data.next())
         {
-            TQColor c;
-            c.setHsv( (i * 255)/data.count(), 255, 255 );// rainbow effect
-            p.setBrush(c);
-            int bw = (w-w/4-x)/(data.count()-i);
+            TQColor c;
+            c.setHsv( (i * 255)/data.count(), 255, 255 );// rainbow effect
+            p.setBrush(c);
+            int bw = (w-w/4-x)/(data.count()-i);
             int bh = int((h-h/4-1)*rowdata[0].dbl/max);
-            p.drawRect( w/8+x, h-h/8-1-bh, bw, bh );
+            p.drawRect( w/8+x, h-h/8-1-bh, bw, bh );
 
             i++;
             x+=bw;
@@ -306,18 +306,18 @@ void Graph::paintBar(TQPaintEvent* event)
         int i = 0;
         double av = 0.0;
         int n = 0;
-        for (GraphModel::Datum* rowdata = data.first(); rowdata;
-            rowdata = data.next())
+        for (GraphModel::Datum* rowdata = data.first(); rowdata;
+            rowdata = data.next())
         {
-            int bx = i*w/data.count();
+            int bx = i*w/data.count();
 
             if (bx > x) {
-                TQColor c;
-                c.setHsv( (x * 255)/w, 255, 255 );// rainbow effect
-                p.setPen(c);
+                TQColor c;
+                c.setHsv( (x * 255)/w, 255, 255 );// rainbow effect
+                p.setPen(c);
                 int bh = int(h*av/n/max);
 
-                p.drawLine(x,h-1,x,h-bh);
+                p.drawLine(x,h-1,x,h-bh);
 
                 av = 0.0;
                 n = 0;
@@ -339,14 +339,14 @@ void Graph::paintPie(TQPaintEvent* event)
         return;
     }
 
-    TQPtrList<GraphModel::Datum>& data = model.graphData();
+    TQPtrList<GraphModel::Datum>& data = model.graphData();
 
     double total = 0.0;
 
     GraphModel::Datum* rowdata;
 
-    for (rowdata = data.first();
-        rowdata; rowdata = data.next())
+    for (rowdata = data.first();
+        rowdata; rowdata = data.next())
     {
         total += rowdata[0].dbl;
     }
@@ -356,31 +356,31 @@ void Graph::paintPie(TQPaintEvent* event)
 
     int apos = (pieRotation-90)*16;
 
-    const int w = width();
-    const int h = height();
+    const int w = width();
+    const int h = height();
 
     const int xd = w - w/5;
     const int yd = h - h/5;
 
-    pm.resize(width(),height());
-    pm.fill(backgroundColor());
-    TQPainter p(&pm);
-    p.setFont(font());
+    pm.resize(width(),height());
+    pm.fill(backgroundColor());
+    TQPainter p(&pm);
+    p.setFont(font());
 
-    p.setClipRect(event->rect());
+    p.setClipRect(event->rect());
 
     int i = 0;
 
-    for (rowdata = data.first();
-        rowdata; rowdata = data.next())
+    for (rowdata = data.first();
+        rowdata; rowdata = data.next())
     {
-        TQColor c;
+        TQColor c;
 
-        c.setHsv( ( i * 255)/data.count(), 255, 255 );// rainbow effect
-        p.setBrush( c );                        // solid fill with color c
+        c.setHsv( ( i * 255)/data.count(), 255, 255 );// rainbow effect
+        p.setBrush( c );                        // solid fill with color c
 
         int a = int(( rowdata[0].dbl * 360.0 ) / total * 16.0 + 0.5);
-        p.drawPie( w/10, h/10, xd, yd, -apos, -a );
+        p.drawPie( w/10, h/10, xd, yd, -apos, -a );
         apos += a;
         i++;
     }
@@ -388,33 +388,33 @@ void Graph::paintPie(TQPaintEvent* event)
     if (model.colType(1) == GraphModel::Label) {
         double apos = (pieRotation-90)*M_PI/180;
 
-        for (rowdata = data.first();
-            rowdata; rowdata = data.next())
+        for (rowdata = data.first();
+            rowdata; rowdata = data.next())
         {
             double a = rowdata[0].dbl * 360 / total * M_PI / 180;
             int x = int(cos(apos+a/2)*w*5/16 + w/2 + 0.5);
             int y = int(sin(apos+a/2)*h*5/16 + h/2 + 0.5);
 
             // ### This causes a crash, so comment out for now
-            /*p.drawText(x-w/8, y-h/8, w/4, h/4,
+            /*p.drawText(x-w/8, y-h/8, w/4, h/4,
                 WordBreak|AlignCenter,
                 *rowdata[1].str);*/
             apos += a;
         }
     }
 
-    TQPainter p2(this);
-    p2.setClipRect(event->rect());
-    p2.drawPixmap(0,0,pm);
+    TQPainter p2(this);
+    p2.setClipRect(event->rect());
+    p2.drawPixmap(0,0,pm);
 }
 
 void Graph::paintWait(TQPaintEvent*)
 {
-    TQPainter p(this);
-    p.drawText(rect(), AlignCenter, "Loading...");
+    TQPainter p(this);
+    p.drawText(rect(), AlignCenter, "Loading...");
 }
 
-void Graph::paintEvent(TQPaintEvent* event)
+void Graph::paintEvent(TQPaintEvent* event)
 {
     if (!model.nCols()) {
         paintWait(event);
@@ -471,13 +471,13 @@ private:
     // Grapher is a GraphModel, so it implements the pure virtual
     // functions of that class.
     //
-    TQPtrList<Datum>& graphData();
+    TQPtrList<Datum>& graphData();
     ColType colType(int col) const;
     int nCols() const;
 
     void consumeLine();
-    TQPtrList<Datum> data;
-    TQBuffer line;
+    TQPtrList<Datum> data;
+    TQBuffer line;
     int ncols;
     ColType *coltype;
 
@@ -490,9 +490,9 @@ private slots:
 
 Grapher::Grapher()
 {
-    data.setAutoDelete(TRUE);
+    data.setAutoDelete(TRUE);
     ncols = 0;
-    line.open(IO_WriteOnly|IO_Truncate);
+    line.open(IO_WriteOnly|IO_Truncate);
 }
 
 Grapher::~Grapher()
@@ -525,32 +525,32 @@ int Grapher::nCols() const
     //   FONTFAMILY and FONTSIZE choose the font
     //
     const char* style = arg("GRAPHSTYLE");
-    if ( style ) graph->setStyle(style);
+    if ( style ) graph->setStyle(style);
 
     const char* fontfamily = arg("FONTFAMILY");
     const char* fontsize = arg("FONTSIZE");
-    int ptsize = fontsize ? atoi(fontsize) : graph->font().pointSize();
-    if (fontfamily) graph->setFont(TQFont(fontfamily, ptsize));
+    int ptsize = fontsize ? atoi(fontsize) : graph->font().pointSize();
+    if (fontfamily) graph->setFont(TQFont(fontfamily, ptsize));
 
-    connect(graph, SIGNAL(aboutPlugin()), this, SLOT(aboutPlugin()));
-    connect(graph, SIGNAL(aboutData()), this, SLOT(aboutData()));
+    connect(graph, SIGNAL(aboutPlugin()), this, SLOT(aboutPlugin()));
+    connect(graph, SIGNAL(aboutData()), this, SLOT(aboutData()));
 
     return graph;
 }
 
 void Grapher::consumeLine()
 {
-    line.close();
-    line.open(IO_ReadOnly);
+    line.close();
+    line.open(IO_ReadOnly);
 
-    TQTextStream ts( &line );
+    TQTextStream ts( &line );
 
     if (ncols == 0 ) {
         ncols=0;
-        TQPtrList<ColType> typelist;
-        typelist.setAutoDelete(TRUE);
+        TQPtrList<ColType> typelist;
+        typelist.setAutoDelete(TRUE);
         do {
-            TQString typestr;
+            TQString typestr;
             ts >> typestr >> ws;
             ColType* t = 0;
             if ( typestr == "num" ) {
@@ -558,16 +558,16 @@ void Grapher::consumeLine()
             } else if ( typestr == "label" ) {
                 t = new ColType(Label);
             }
-            if (t) typelist.append(t);
-        } while (!ts.atEnd());
+            if (t) typelist.append(t);
+        } while (!ts.atEnd());
         coltype = new ColType[ncols];
-        for (ColType* t = typelist.first(); t; t = typelist.next()) {
+        for (ColType* t = typelist.first(); t; t = typelist.next()) {
             coltype[ncols++] = *t;
         }
     } else {
         int col=0;
         Datum *rowdata = new Datum[ncols];
-        while ( col < ncols && !ts.atEnd() ) {
+        while ( col < ncols && !ts.atEnd() ) {
             switch (coltype[col]) {
               case Numeric: {
                 double value;
@@ -576,7 +576,7 @@ void Grapher::consumeLine()
                 break;
               }
               case Label: {
-                TQString* value = new TQString;
+                TQString* value = new TQString;
                 ts >> *value >> ws;
                 rowdata[col].str = value;
                 break;
@@ -585,11 +585,11 @@ void Grapher::consumeLine()
             col++;
         }
 
-        data.append(rowdata);
+        data.append(rowdata);
     }
 
-    line.close();
-    line.open(IO_WriteOnly|IO_Truncate);
+    line.close();
+    line.open(IO_WriteOnly|IO_Truncate);
 }
 
 int Grapher::write(TQNPStream* /*str*/, int /*offset*/, int len, void* buffer)
@@ -611,7 +611,7 @@ void Grapher::consumeLine()
           case '\r': // ignore;
             break;
           default:
-            line.putch(ch);
+            line.putch(ch);
         }
     }
     if ( widget() )
@@ -631,7 +631,7 @@ void Grapher::aboutData()
     if (page)
         getURL( page, "_blank" );
     else
-        TQMessageBox::message("Help", "No help for this data");
+        TQMessageBox::message("Help", "No help for this data");
 }
 
 
-- 
cgit v1.2.3