32#include <tqdatetime.h>
34#include <tqstringlist.h>
37#include <ksqueezedtextlabel.h>
39#include <kxmlguibuilder.h>
40#include <kxmlguiclient.h>
43#include "kis_canvas_controller.h"
44#include "kis_canvas_subject.h"
45#include "kis_global.h"
48#include "kis_profile.h"
49#include "kis_opengl_image_context.h"
51#include "koffice_export.h"
53#include "kis_input_device.h"
70class KoPartSelectAction;
74class KoPaletteManager;
81class KisButtonPressEvent;
82class KisButtonReleaseEvent;
88class KisDoubleClickEvent;
90class KisFilterStrategy;
93class KisPerspectiveGridManager;
94class KisLabelProgress;
106class KisToolControllerInterface;
110class KisPartLayerHandler;
111class KisPaintOpSettings;
113class KRITA_EXPORT KisView
116 public KXMLGUIBuilder,
123 typedef KoView super;
125 typedef std::list<KisCanvasObserver*> vKisCanvasObserver;
126 typedef vKisCanvasObserver::iterator vKisCanvasObserver_it;
127 typedef vKisCanvasObserver::const_iterator vKisCanvasObserver_cit;
130 KisView(KisDoc *doc, KisUndoAdapter *adapter, TQWidget *parent = 0,
const char *name = 0);
135 virtual TQWidget *createContainer( TQWidget *parent,
int index,
const TQDomElement &element,
int &
id );
136 virtual void removeContainer( TQWidget *container, TQWidget *parent, TQDomElement &element,
int id );
139 virtual bool eventFilter(TQObject *o, TQEvent *e);
141 virtual DCOPObject* dcopObject();
143 virtual void print(KPrinter &printer);
144 virtual void setupPrinter(KPrinter &printer);
146 virtual void updateReadWrite(
bool readwrite);
147 virtual void guiActivateEvent(KParts::GUIActivateEvent *event);
149 virtual int leftBorder()
const;
150 virtual int rightBorder()
const;
151 virtual int topBorder()
const;
152 virtual int bottomBorder()
const;
154 TQ_INT32 docWidth()
const;
155 TQ_INT32 docHeight()
const;
157 void updateStatusBarSelectionLabel();
159 virtual TQPoint applyViewTransformations(
const TQPoint& p)
const;
160 virtual TQPoint reverseViewTransformations(
const TQPoint& p)
const;
161 virtual void canvasAddChild(KoViewChild *child);
165 void brushChanged(KisBrush * brush);
166 void gradientChanged(KisGradient * gradient);
167 void patternChanged(KisPattern * pattern);
168 void paintopChanged(
KisID paintop,
const KisPaintOpSettings *paintopSettings);
174 void cursorPosition(TQ_INT32 xpos, TQ_INT32 ypos);
176 void sigFGQColorChanged(
const TQColor &);
177 void sigBGQColorChanged(
const TQColor &);
179 void sigInputDeviceChanged(
const KisInputDevice& inputDevice);
184 void viewTransformationsChanged();
188 void slotSetFGColor(
const KisColor& c);
189 void slotSetBGColor(
const KisColor& c);
191 void rotateLayer180();
192 void rotateLayerLeft90();
193 void rotateLayerRight90();
196 void scaleLayer(
double sx,
double sy, KisFilterStrategy *filterStrategy);
197 void rotateLayer(
double radians);
198 void shearLayer(
double angleX,
double angleY);
200 void slotCreateMask();
201 void slotMaskFromSelection();
202 void slotMaskToSelection();
203 void slotApplyMask();
204 void slotRemoveMask();
211 void paintopActivated(
const KisID & paintop,
const KisPaintOpSettings *paintopSettings);
215 virtual void mouseMoveEvent(TQMouseEvent *e);
217 void resizeCurrentImage(TQ_INT32 w, TQ_INT32 h,
bool cropLayers =
false);
218 void scaleCurrentImage(
double sx,
double sy, KisFilterStrategy *filterStrategy);
219 void rotateCurrentImage(
double radians);
220 void shearCurrentImage(
double angleX,
double angleY);
222 void insertPart(
const TQRect& viewRect,
const KoDocumentEntry& entry,
223 KisGroupLayerSP parent, KisLayerSP above);
233 TQ_INT32 importImage(
const KURL& url = KURL());
236 virtual void resizeEvent(TQResizeEvent*);
237 virtual void styleChange(TQStyle& oldStyle);
238 virtual void paletteChange(
const TQPalette& oldPalette);
239 virtual void showEvent(TQShowEvent *);
242 virtual void slotChildActivated(
bool a);
285 inline KisGridManager * gridManager() {
return m_gridManager; }
307 void updateStatusBarZoomLabel();
308 void updateStatusBarProfileLabel();
316 virtual void scrollTo(TQ_INT32 x, TQ_INT32 y);
318 virtual void updateCanvas(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
322 virtual void zoomIn(TQ_INT32 x, TQ_INT32 y);
325 virtual void zoomOut(TQ_INT32 x, TQ_INT32 y);
327 virtual void zoomTo(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
328 virtual void zoomTo(
const TQRect& r);
357 void connectCurrentImg();
358 void disconnectCurrentImg();
366 void layerUpdateGUI(
bool enable);
367 void createLayerBox();
368 void createDockers();
370 void paintToolOverlay(
const TQRegion& region);
372 void paintTQPaintDeviceView(
const TQRegion& canvasRegion);
373 void paintOpenGLView(
const TQRect& canvasRect);
375 void updateTQPaintDeviceCanvas(
const TQRect& imageRect);
376 void updateOpenGLCanvas(
const TQRect& imageRect);
381 void refreshKisCanvas();
383 void selectionDisplayToggled(
bool displaySelection);
385 bool activeLayerHasSelection();
390 void resetMonitorProfile();
395 void setupScrollBars();
396 void setupStatusBar();
400 void setCurrentImage(KisImageSP image);
405 double nextZoomInLevel()
const;
410 double nextZoomOutLevel()
const;
415 double nextZoomOutLevel(
double zoomLevel)
const;
420 double fitToCanvasZoomLevel()
const;
425 void setInitialZoomLevel();
427 void startInitialZoomTimerIfReady();
430 void layersUpdated();
433 void slotSetFGQColor(
const TQColor & c);
434 void slotSetBGQColor(
const TQColor & c);
436 void imgUpdated(TQRect rc);
437 void slotOpenGLImageUpdated(TQRect rc);
439 void imgResizeToActiveLayer();
441 void canvasGotMoveEvent(KisMoveEvent *e);
442 void canvasGotButtonPressEvent(KisButtonPressEvent *e);
443 void canvasGotButtonReleaseEvent(KisButtonReleaseEvent *e);
444 void canvasGotDoubleClickEvent(KisDoubleClickEvent *e);
445 void canvasGotPaintEvent(TQPaintEvent *e);
446 void canvasGotEnterEvent(TQEvent *e);
447 void canvasGotLeaveEvent(TQEvent *e);
448 void canvasGotMouseWheelEvent(TQWheelEvent *e);
449 void canvasGotKeyPressEvent(TQKeyEvent*);
450 void canvasGotKeyReleaseEvent(TQKeyEvent*);
451 void canvasGotDragEnterEvent(TQDragEnterEvent*);
452 void canvasGotDropEvent(TQDropEvent*);
454 void reconnectAfterPartInsert();
456 TQPoint mapToScreen(
const TQPoint& pt);
457 void slotImageProperties();
459 void layerCompositeOp(
const KisCompositeOp& compositeOp);
460 void layerOpacity(
int opacity,
bool dontundo);
461 void layerOpacityFinishedChanging(
int previous,
int opacity);
463 void layerToggleVisible();
464 void layerToggleLocked();
465 void actLayerVisChanged(
int show);
466 void layerProperties();
467 void showLayerProperties(KisLayerSP layer);
469 void addLayer(KisGroupLayerSP parent, KisLayerSP above);
470 void addGroupLayer(KisGroupLayerSP parent, KisLayerSP above);
472 void addPartLayer(KisGroupLayerSP parent, KisLayerSP above,
const KoDocumentEntry& entry);
473 void addAdjustmentLayer();
474 void addAdjustmentLayer(KisGroupLayerSP parent, KisLayerSP above);
475 void addAdjustmentLayer(KisGroupLayerSP parent, KisLayerSP above,
const TQString & name,
KisFilterConfiguration * filter, KisSelectionSP selection = 0);
477 void layerDuplicate();
484 void saveLayerAsImage();
486 void slotUpdateFullScreen(
bool toggle);
491 void slotActualPixels();
492 void slotActualSize();
493 void slotFitToCanvas();
495 void slotImageSizeChanged(TQ_INT32 w, TQ_INT32 h);
497 void scrollH(
int value);
498 void scrollV(
int value);
500 void slotInsertImageAsLayer();
501 void profileChanged(KisProfile * profile);
503 void slotAddPalette();
504 void slotEditPalette();
508 void slotAutoScroll(
const TQPoint &p);
510 void handlePartLayerAdded(KisLayerSP layer);
513 void slotLoadingFinished();
515 void slotInitialZoomTimeout();
525 KisPartLayerHandler* m_partHandler;
527 KisGridManager * m_gridManager;
528 KisPerspectiveGridManager * m_perspectiveGridManager;
531 KoPaletteManager * m_paletteManager;
538 TQ_INT32 m_rulerThickness;
539 TQ_INT32 m_vScrollBarExtent;
540 TQ_INT32 m_hScrollBarExtent;
543 TDEAction *m_imgFlatten;
544 TDEAction *m_imgMergeLayer;
545 TDEAction *m_imgRename;
546 TDEAction *m_imgResizeToLayer;
547 TDEAction *m_imgScan;
549 KoPartSelectAction * m_actionPartLayer;
550 TDEAction * m_actionAdjustmentLayer;
551 TDEAction *m_layerAdd;
552 TDEAction *m_layerBottom;
553 TDEAction *m_layerDup;
554 TDEToggleAction *m_layerHide;
555 TDEAction *m_layerLower;
556 TDEAction *m_layerProperties;
557 TDEAction *m_layerRaise;
558 TDEAction *m_layerRm;
559 TDEAction *m_layerSaveAs;
560 TDEAction *m_layerTop;
562 TDEAction *m_createMask;
563 TDEAction *m_maskFromSelection;
564 TDEAction *m_maskToSelection;
565 TDEAction *m_applyMask;
566 TDEAction *m_removeMask;
567 TDEToggleAction *m_editMask;
568 TDEToggleAction *m_showMask;
571 TDEAction *m_zoomOut;
572 TDEAction *m_actualPixels;
573 TDEAction *m_actualSize;
574 TDEAction *m_fitToCanvas;
576 TDEAction *m_fullScreen;
577 TDEAction *m_imgProperties;
579 TDEToggleAction *m_RulerAction;
580 TDEToggleAction *m_guideAction;
585 TQScrollBar *m_hScroll;
586 TQScrollBar *m_vScroll;
592 bool m_paintViewEnabled;
593 bool m_guiActivateEventReceived;
594 bool m_showEventReceived;
597 TQTimer m_initialZoomTimer;
602 KisUndoAdapter *m_adapter;
603 vKisCanvasObserver m_observers;
604 TQLabel *m_statusBarZoomLabel;
605 KSqueezedTextLabel *m_statusBarSelectionLabel;
606 KSqueezedTextLabel *m_statusBarProfileLabel;
607 KisLabelProgress *m_progress;
610 KisLayerBox *m_layerBox;
611 KoToolBox * m_toolBox;
620 KisPattern *m_pattern;
621 KisGradient *m_gradient;
624 const KisPaintOpSettings *m_paintopSettings;
626 TQTime m_tabletEventTimer;
627 TQTabletEvent::TabletDevice m_lastTabletEventDevice;
629 TQPixmap m_canvasPixmap;
630 bool m_toolIsPainting;
635 KisOpenGLImageContextSP m_OpenGLImageContext;
639 KisProfile * m_monitorProfile;
644 KisInputDevice m_inputDevice;
646 KisBirdEyeBox * m_birdEyeBox;
647 KoHSVWidget *m_hsvwidget;
648 KoRGBWidget *m_rgbwidget;
649 KoGrayWidget *m_graywidget;
651 KisID m_currentColorChooserDisplay;
660 friend class KisGridManager;
661 friend class KisPerspectiveGridManager;
Interface for classes that implement a canvas; i.e., a widget where KisImages are painted onto.
virtual TQPoint viewToWindow(const TQPoint &pt)=0
Conversion functions from view coordinates to image coordinates.
virtual TQ_INT32 vertValue() const =0
virtual TQPoint windowToView(const TQPoint &pt)=0
Conversion functions from image coordinates to view coordinates.
virtual TQCursor setCanvasCursor(const TQCursor &cursor)=0
Set the cursor shown when the pointer is over the canvas widget to the specified cursor.
virtual void zoomOut()=0
Decrease the zoomlevel one step.
virtual KisInputDevice currentInputDevice() const =0
virtual void zoomIn()=0
Increase the zoomlevel one step.
virtual void updateCanvas()=0
Tell all of the canvas to repaint itself.
virtual void setInputDevice(KisInputDevice inputDevice)=0
Set the active input device to the specified input device, This could be a mouse, a stylus,...
virtual void zoomAroundPoint(double x, double y, double zf)=0
To centre the view on the given point with the given zoom factor.
virtual void zoomTo(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h)=0
Make the rect defined by x, y, w and h visible, zooming in or out as necessary.
virtual void scrollTo(TQ_INT32 x, TQ_INT32 y)=0
Sets the horizontal and vertical scrollbars to the specified values.
virtual TQ_INT32 horzValue() const =0
virtual KisCanvas * kiscanvas() const =0
This is the base interface plugins use to implement the Observer design pattern.
KisCanvasSubject is part of the Observer pattern.
virtual double zoomFactor() const =0
virtual float HDRExposure() const =0
virtual void setHDRExposure(float exposure)=0
Set the exposure value.
virtual void setFGColor(const KisColor &c)=0
Set the foreground or painting color.
virtual KisUndoAdapter * undoAdapter() const =0
retrieve the undo adapater – there is one undo adapter per document, and it collects all transactions
virtual KisDoc * document() const =0
XXX: Remove this method.
virtual KisPattern * currentPattern() const =0
virtual const KisPaintOpSettings * currentPaintopSettings() const =0
virtual KisToolControllerInterface * toolController() const =0
XXX: Remove this method.
virtual KisGradient * currentGradient() const =0
virtual KisProgressDisplayInterface * progressDisplay() const =0
XXX: Remove this method.
virtual void setBGColor(const KisColor &c)=0
Set the background color.
virtual KisColor fgColor() const =0
virtual KisPerspectiveGridManager * perspectiveGridManager()=0
Get the perspective grid manager.
virtual KoPaletteManager * paletteManager()=0
XXX: Remove this method.
virtual KisCanvasController * canvasController() const =0
virtual void detach(KisCanvasObserver *observer)=0
From now on, the specified observer will no longer be informed of changes.
virtual KisColor bgColor() const =0
virtual KisProfile * monitorProfile()=0
Get the profile that this view uses to display itself on he monitor.
virtual KisImageSP currentImg() const =0
virtual KisBrush * currentBrush() const =0
virtual KisSelectionManager * selectionManager()=0
XXX: Remove this method.
virtual void attach(KisCanvasObserver *observer)=0
From now on, the observer will be notified of changes in brush, foreground color, background color,...
virtual void notifyObservers()=0
Calling this method will notify all observers.
virtual KisID currentPaintop() const =0
A colorspace is the definition of a certain color model in Chalk.
A KisColor describes a color in a certain colorspace.
Control Frame - status display with access to color selector, brushes, patterns, and preview.
A KisFilterConfiguration is the serializable representation of the filter parameters.
Create all the filter actions for the specified view and implement re-apply filter.
Chalk has a large number of extensible resources.
A double-based point class that can return it's coordinates approximated to integers.
A double-based rect class that can return a TQRect that encloses the KisRect.
The KisResource class provides a representation of Chalk image resources.
The selection manager is responsible selections and the clipboard.