]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/patternbox.cpp
Fixed hatch dialog, added snap/preview to circle tools.
[architektonas] / src / widgets / patternbox.cpp
index 0ce3a9e27ccf0b7176953bb4de73311e92fd8638..fe4e2498764874d8f1a2c7e22bda67695fbd0cfb 100644 (file)
 
 #include "patternbox.h"
 
-#include "rs_pattern.h"
-#include "rs_patternlist.h"
-#include "rs_debug.h"
+#include "pattern.h"
+#include "patternlist.h"
+#include "debug.h"
 
 /**
  * Default Constructor. You must call init manually if you choose
  * to use this constructor.
  */
-QG_PatternBox::QG_PatternBox(QWidget * parent, const char */*name*/): QComboBox(parent)
+PatternBox::PatternBox(QWidget * parent, const char */*name*/): QComboBox(parent)
 {
 }
 
 /**
  * Destructor
  */
-QG_PatternBox::~QG_PatternBox()
+PatternBox::~PatternBox()
 {
 }
 
 /**
- * Initialisation (called manually and only once).
+ * Initialization (called manually and only once).
  */
-void QG_PatternBox::init()
+void PatternBox::init()
 {
        QStringList patterns;
 
-       for(RS_Pattern * f=RS_PATTERNLIST->firstPattern(); f!=NULL; f=RS_PATTERNLIST->nextPattern())
+       for(Pattern * f=PATTERNLIST->firstPattern(); f!=NULL; f=PATTERNLIST->nextPattern())
                patterns.append(f->getFileName());
 
+#if 0
+std::cout << "patterns size = " << patterns.size() << std::endl;
+
+for(int i=0; i<patterns.size(); i++)
+       std::cout << patterns.at(i).toLocal8Bit().constData() << std::endl;
+
+std::cout.flush();
+#endif
        patterns.sort();
-//     insertStringList(patterns);
        addItems(patterns);
 
        connect(this, SIGNAL(activated(int)), this, SLOT(slotPatternChanged(int)));
@@ -55,7 +62,7 @@ void QG_PatternBox::init()
        slotPatternChanged(currentIndex());
 }
 
-RS_Pattern * QG_PatternBox::getPattern()
+Pattern * PatternBox::getPattern()
 {
        return currentPattern;
 }
@@ -63,10 +70,9 @@ RS_Pattern * QG_PatternBox::getPattern()
 /**
  * Sets the currently selected width item to the given width.
  */
-void QG_PatternBox::setPattern(const QString & pName)
+void PatternBox::setPattern(const QString & pName)
 {
-       RS_DEBUG->print("QG_PatternBox::setPattern %s\n", pName.toLatin1().data());
-//     setCurrentText(pName);
+       DEBUG->print("PatternBox::setPattern %s\n", pName.toAscii().data());
        setItemText(currentIndex(), pName);
        slotPatternChanged(currentIndex());
 }
@@ -75,13 +81,13 @@ void QG_PatternBox::setPattern(const QString & pName)
  * Called when the pattern has changed. This method
  * sets the current pattern to the value chosen.
  */
-void QG_PatternBox::slotPatternChanged(int index)
+void PatternBox::slotPatternChanged(int index)
 {
-       RS_DEBUG->print("QG_PatternBox::slotPatternChanged %d\n", index);
-       currentPattern = RS_PATTERNLIST->requestPattern(currentText());
+       DEBUG->print("PatternBox::slotPatternChanged %d\n", index);
+       currentPattern = PATTERNLIST->requestPattern(currentText());
 
-       if (currentPattern!=NULL)
-               RS_DEBUG->print("Current pattern is (%d): %s\n", index, currentPattern->getFileName().toLatin1().data());
+       if (currentPattern)
+               DEBUG->print("Current pattern is (%d): %s\n", index, currentPattern->getFileName().toAscii().data());
 
        emit patternChanged(currentPattern);
 }