1
/***************************************************************************
2
* Copyright (C) 2003 by Stephen Allewell *
3
* stephen@mirramar.fsnet.co.uk *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
9
***************************************************************************/
16
#include <qvaluevector.h>
22
/** Display the colors from the patterns floss list.
23
@author Stephen Allewell
25
class PaletteView : public QFrame, public QToolTip
30
@param doc A pointer to the document object.
31
@param parent A pointer to the parent widget.
33
PaletteView(KXStitchDoc* doc,QWidget *parent);
36
virtual ~PaletteView();
38
/** Print the floss palette to a printer
39
@return The number of pages printed so far
40
@param printer Pointer to the KPrinter object being printed to
41
@param painter Pointer to the QPainter object that is to be drawn on
42
@param width Width of the page (from the device metrics)
43
@param height Height of the page (from the device metrics)
44
@param page The number of pages printed so far
46
int print(KPrinter *printer, QPainter *painter, int width, int height, int page);
47
/** Set the current color to the color index specified.
48
@param i Index into the document color palette.
50
void setCurrentColor(int);
51
/** Reconfigure the view in response to the users configuration
56
/** Reimplemented from the base class.
58
@param p Pointer to the QPainter to use.
60
virtual void drawContents(QPainter *p);
61
/** Reimplemented from the base class.
62
Display the context menu for the paletteView
63
@param e QContextMouseEvent describing the mouse action
65
virtual void contextMenuEvent(QContextMenuEvent* e);
66
/** Reimplemented from the base class.
67
Check if the left mouse button was pressed on a displayed color, and if so,
68
set the current color.
69
@param e QMouseEvent describing the mouse action.
71
virtual void mousePressEvent(QMouseEvent *e);
72
/** Reimplemented from the base class.
73
Checks if the mouse is over a displayed color, and if so, display a tooltip
74
describing details about the color.
75
@param p QPoint defining the position of the mouse.
77
virtual void maybeTip(const QPoint &p);
80
/** Save the palette to a scheme
82
void slotSavePalette();
83
/** Load a scheme to the palette
85
void slotLoadPalette();
86
/** Create a new palette
88
void slotCreatePalette();
89
/** Toggle the show symbols flag and repaint the view.
91
void slotShowSymbols();
92
/** Set the flag to indicate that a color swap is to be done. Will change the cursor
93
to indicate that color swap is in progress.
95
void slotPrepareToSwap();
96
/** Set the flag to indicate that a color replace is to be done. Will change the cursor
97
to indicate that color replace is in progress.
99
void slotPrepareToReplace();
100
/** Add colour to palette
103
/** remove colors from the palette
105
void slotRemoveColors();
106
/** clear the unused colors from the palette
108
void slotClearUnused();
111
KAction* m_savePalette;
112
KAction* m_loadPalette;
113
KAction* m_createPalette;
115
bool m_waitingToSwap;
116
bool m_waitingToReplace;
122
QValueVector<int> m_flosses;