[Kst] kdeextragear-2/kst
George Staikos
staikos at kde.org
Fri Jul 11 09:44:08 CEST 2003
CVS commit by staikos:
Kst provides its own palette now, and use KPalette in kstcolorsequence.
A misc/.cvsignore 1.1
A misc/Makefile.am 1.1
M +1 -1 Makefile.am 1.6
M +17 -5 kst/kstcolorsequence.cpp 1.3
M +4 -0 kst/kstcolorsequence.h 1.3
--- kdeextragear-2/kst/Makefile.am #1.5:1.6
@@ -1,5 +1,5 @@
####### kdevelop will overwrite this part!!! (begin)##########
-SUBDIRS = kst plugins
+SUBDIRS = kst plugins misc
EXTRA_DIST = kst.kdevprj AUTHORS COPYING ChangeLog INSTALL README TODO kst.lsm
--- kdeextragear-2/kst/kst/kstcolorsequence.cpp #1.2:1.3
@@ -17,5 +17,7 @@
#include "kstcolorsequence.h"
+#include <kpalette.h>
+// Default palette that is used if "Kst Colors" is not found.
static const int colorcnt = 8;
static const char *const colors[colorcnt] = { "red",
@@ -38,23 +40,33 @@ QColor KstColorSequence::next() {
}
- if (_self->_ptr >= colorcnt * 2) {
+ if (_self->_ptr >= _self->_count * 2) {
_self->_ptr = 0;
- } else if (_self->_ptr >= colorcnt) {
+ } else if (_self->_ptr >= _self->_count) {
shift = true;
}
if (shift) {
- return QColor(colors[_self->_ptr++ % colorcnt]).dark();
+ return _self->_pal->color(_self->_ptr++ % _self->_count).dark();
}
-return QColor(colors[_self->_ptr++]);
+return _self->_pal->color(_self->_ptr++);
}
KstColorSequence::KstColorSequence() : _ptr(0) {
+ _pal = new KPalette("Kst Colors");
+
+ if (_pal->nrColors() <= 0) {
+ for (int i = 0; i < colorcnt; i++) {
+ _pal->addColor(QColor(colors[i]));
+ }
+ }
+ _count = _pal->nrColors();
}
KstColorSequence::~KstColorSequence() {
+ delete _pal;
+ _pal = 0L;
}
--- kdeextragear-2/kst/kst/kstcolorsequence.h #1.2:1.3
@@ -22,4 +22,6 @@
#include <kstaticdeleter.h>
+class KPalette;
+
class KstColorSequence {
friend class KStaticDeleter<KstColorSequence>;
@@ -32,4 +34,6 @@ friend class KStaticDeleter<KstColorSequ
static KstColorSequence* _self;
int _ptr; // pointer to the next color
+ KPalette *_pal;
+ int _count;
};
More information about the Kst
mailing list