summaryrefslogtreecommitdiffstats
path: root/kiconedit/kiconcolors.cpp
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2014-02-06 17:28:41 -0600
committerDarrell Anderson <humanreadable@yahoo.com>2014-02-06 17:28:41 -0600
commit7ad9c00daa716f90e6b71af463c50eebc93f4250 (patch)
treef472270f99cab538f9db00a80e09d35f4d351d6b /kiconedit/kiconcolors.cpp
parent00af0dfbf87c62e25b5050102b7bd8df2ddcc1d0 (diff)
downloadtdegraphics-7ad9c00daa716f90e6b71af463c50eebc93f4250.tar.gz
tdegraphics-7ad9c00daa716f90e6b71af463c50eebc93f4250.zip
Finish renaming kiconedit->tdeiconedit.
Diffstat (limited to 'kiconedit/kiconcolors.cpp')
-rw-r--r--kiconedit/kiconcolors.cpp170
1 files changed, 0 insertions, 170 deletions
diff --git a/kiconedit/kiconcolors.cpp b/kiconedit/kiconcolors.cpp
deleted file mode 100644
index 6e0e2632..00000000
--- a/kiconedit/kiconcolors.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- TDE Icon Editor - a small graphics drawing program for the TDE
- Copyright (C) 1998 Thomas Tanghus (tanghus@kde.org)
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <tqpainter.h>
-#include <tqdrawutil.h>
-
-#include <kdebug.h>
-
-#include "kiconcolors.h"
-
-KDrawColors::KDrawColors(TQWidget *parent) : KColorGrid(parent, 0, 3)
-{
- kdDebug(4640) << "KDrawColors - constructor" << endl;
- setCellSize(17);
- setGrid(true);
- setGridState(KColorGrid::Shaded);
- selected = 0;
- kdDebug(4640) << "KDrawColors - constructor - done" << endl;
-}
-
-void KDrawColors::paintCell( TQPainter *painter, int row, int col )
-{
- //KColorGrid::paintCell(painter, row, col);
- uint c = colorAt( row * numCols() + col );
- TQBrush brush(c);
- int d = spacing();
-
- qDrawShadePanel( painter, d, d, cellSize()-d, cellSize()-d,
- colorGroup(), true, 1, &brush);
- if ( row * numCols() + col == selected)
- painter->drawWinFocusRect( d+1, d+1, cellSize()-(2*d)+1, cellSize()-(2*d)+1 );
-}
-
-void KDrawColors::mouseReleaseEvent( TQMouseEvent *e )
-{
- int row = findRow( e->pos().y() );
- int col = findCol( e->pos().x() );
- int cell = row * numCols() + col;
-
- if ( selected != cell )
- {
- int prevSel = selected;
- selected = cell;
- updateCell( prevSel/numCols(), prevSel%numCols(), FALSE );
- updateCell( row, col, FALSE );
- }
-
- emit newColor(colorAt(cell)|OPAQUE_MASK);
-}
-
-KSysColors::KSysColors(TQWidget *parent) : KDrawColors(parent)
-{
- kdDebug(4640) << "KSysColors - constructor" << endl;
-
- setNumRows(7);
- setNumCols(6);
- //fill(backgroundColor().rgb()|OPAQUE_MASK);
- setFixedSize(numCols()*cellSize(), numRows()*cellSize());
- fill(TRANSPARENT|OPAQUE_MASK);
-
- int numcells = 42;
-
- kdDebug(4640) << "KSysColors - constructor - before setColor" << endl;
- for(int i = 0; i < numcells; i++)
- {
- setColor(i, iconpalette[i]|OPAQUE_MASK);
- }
- kdDebug(4640) << "KSysColors - constructor - done" << endl;
-}
-
-KCustomColors::KCustomColors(TQWidget *parent) : KDrawColors(parent)
-{
- kdDebug(4640) << "KCustomColors - constructor" << endl;
- setNumRows(3);
- setNumCols(6);
- fill(TRANSPARENT|OPAQUE_MASK);
- setFixedSize(numCols()*cellSize(), numRows()*cellSize());
- freecells = new bool[numRows()*numCols()];
- for(int i = 0; i < numRows()*numCols(); i++)
- freecells[i] = true;
- kdDebug(4640) << "KCustomColors - constructor - done" << endl;
-}
-
-KCustomColors::~KCustomColors()
-{
- delete [] freecells;
-}
-
-void KCustomColors::mouseDoubleClickEvent(TQMouseEvent *e)
-{
- int row = findRow( e->pos().y() );
- int col = findCol( e->pos().x() );
- int cell = row * numCols() + col;
- TQColor color=colorAt(cell);
- if(KColorDialog::getColor(color))
- {
- setColor(cell, color.rgb());
- emit newColor(color.rgb()|OPAQUE_MASK);
- freecells[cell] = false;
- }
-}
-
-void KCustomColors::addColor(uint c)
-{
- if(!contains(c))
- {
- int f = getFreeCell();
- if(f != -1)
- {
- TQColor color(c);
- if(!color.isValid())
- {
- kdDebug(4640) << "KCustomColors::addColor: Not a valid color: " << c << endl;
- return;
- }
- //kdDebug(4640) << "KCustomColors::addColor: Adding color: " << c << " - " << tqRed(c) << " " << tqGreen(c) << " " << tqBlue(c) << endl;
- setColor(f, c);
- freecells[f] = false;
- }
- }
-}
-
-int KCustomColors::getFreeCell()
-{
- for (int i = 0; i < numRows()*numCols(); i++)
- {
- if(freecells[i])
- {
- if(i+1 < numRows()*numCols())
- freecells[i+1] = true;
- else
- freecells[0] = true;
- return i;
- break;
- }
- }
- freeAllCells(); // start over again - not very elegant
- return 0;
-}
-
-void KCustomColors::freeAllCells()
-{
- for (int i = 0; i < numRows()*numCols(); i++)
- freecells[i] = true;
-}
-
-void KCustomColors::clear()
-{
- fill(TRANSPARENT);
- freeAllCells();
- update();
-}
-#include "kiconcolors.moc"