forgotten commit. disabled until egl is adapted.
[AROS-Contrib.git] / gfx / lunapaint / src / app / canvas.h
blob4091172f5b9b47d2479ffaa25fe2e34eea89a90e
1 /****************************************************************************
2 * *
3 * canvas.h -- Lunapaint, *
4 * http://developer.berlios.de/projects/lunapaintami/ *
5 * Copyright (C) 2006, 2007, Hogne Titlestad <hogga@sub-ether.org> *
6 * Copyright (C) 2009-2011 LunaPaint Development Team *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the Free Software Foundation, *
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 * *
22 ****************************************************************************/
24 #ifndef _aros_canvas_h_
25 #define _aros_canvas_h_
27 #define LNCATAGBASE (TAG_USER+300)
29 #define MUIM_Luna_Canvas_ClearActiveCanvas (LNCATAGBASE+0)
30 #define MUIM_Luna_Canvas_SetPaintMode (LNCATAGBASE+1)
31 #define MUIM_Luna_Canvas_AlterBrushShape (LNCATAGBASE+2)
32 #define MUIM_Luna_Canvas_AlterBrushStep (LNCATAGBASE+3)
33 #define MUIM_Luna_Canvas_AlterBrushStrength (LNCATAGBASE+4)
34 #define MUIM_Luna_Canvas_CanvasAddLayer (LNCATAGBASE+5)
35 #define MUIM_Luna_Canvas_CanvasSwapLayer (LNCATAGBASE+6)
36 #define MUIM_Luna_Canvas_CanvasDeleteLayer (LNCATAGBASE+7)
37 #define MUIM_Luna_Canvas_CanvasMergeLayer (LNCATAGBASE+8)
38 #define MUIM_Luna_Canvas_CanvasCopyLayer (LNCATAGBASE+9)
39 #define MUIM_Luna_Canvas_ChangeOnionskin (LNCATAGBASE+10)
40 #define MUIM_Luna_Canvas_ChangeScrollOffset (LNCATAGBASE+11)
41 #define MUIM_Luna_Canvas_SetGlobalGrid (LNCATAGBASE+12)
42 #define MUIM_Luna_Canvas_SetGridSize (LNCATAGBASE+13)
43 #define MUIM_Luna_Canvas_SetColorMode (LNCATAGBASE+14)
44 #define MUIM_Luna_Canvas_NextFrame (LNCATAGBASE+15)
45 #define MUIM_Luna_Canvas_PrevFrame (LNCATAGBASE+16)
46 #define MUIM_Luna_Canvas_GotoFrame (LNCATAGBASE+17)
47 #define MUIM_Luna_Canvas_EffectOffset (LNCATAGBASE+18)
48 #define MUIM_Luna_Canvas_OpenPaletteEditor (LNCATAGBASE+19)
49 #define MUIM_Luna_Canvas_ScrollingNotify (LNCATAGBASE+20)
50 #define MUIM_Luna_Canvas_RedrawArea (LNCATAGBASE+21)
51 #define MUIM_Luna_Canvas_Redraw (LNCATAGBASE+22)
53 // Paint tool keys
54 #define MUIA_Key_F 1001
55 #define MUIA_Key_D 1002
56 #define MUIA_Key_V 1003
57 #define MUIA_Key_L 1004
58 #define MUIA_Key_E 1005
59 #define MUIA_Key_R 1006
60 #define MUIA_Key_O 1007
61 #define MUIA_Key_B 1008
62 // Buffer keys
63 #define MUIA_Key_J 1050
64 #define MUIA_Key_Shift_J 1051
65 #define MUIA_Key_X 1052
66 #define MUIA_Key_Y 1053
67 #define MUIA_Key_Up 1054
68 #define MUIA_Key_Left 1055
69 #define MUIA_Key_Right 1056
70 #define MUIA_Key_Down 1057
71 // Effect keys
72 #define MUIA_Key_F1 1100
73 #define MUIA_Key_F2 1101
74 #define MUIA_Key_F3 1102
75 #define MUIA_Key_F4 1103
76 #define MUIA_Key_F5 1104
77 #define MUIA_Key_F6 1105
78 #define MUIA_Key_F7 1106
79 #define MUIA_Key_F8 1107
80 #define MUIA_Key_F9 1108
81 // Color keys
82 #define MUIA_Key_Shift_Comma 1200
83 #define MUIA_Key_Comma 1201
85 #include <stdio.h>
86 #include <stdlib.h>
88 #include <exec/types.h>
89 #include <datatypes/datatypes.h>
90 #include <libraries/asl.h>
91 #include <libraries/mui.h>
92 #include <cybergraphx/cybergraphics.h>
94 #include <math.h>
95 #include <devices/rawkeycodes.h>
96 #include <proto/exec.h>
97 #include <proto/intuition.h>
98 #include <proto/datatypes.h>
99 #include <proto/gadtools.h>
100 #include <proto/muimaster.h>
101 #include <proto/graphics.h>
102 #include <proto/cybergraphics.h>
103 #include <clib/alib_protos.h>
104 #include <string.h>
106 #ifdef __AROS__
107 #define DEBUG 1
108 #include <aros/debug.h>
109 #endif
111 #ifndef __AROS__
112 #include "aros/aros.h"
113 #endif
115 #include "parts.h"
116 #include "toolbox.h"
117 #include "layers.h"
118 #include "project.h"
120 #include "config.h"
122 #include "core/canvas.h"
123 #include "core/tools.h"
124 #include "math/math.h"
125 #include "common.h"
127 extern BOOL isZooming;
128 extern BOOL isScrolling;
129 extern BOOL fullscreenEditing;
130 extern int AskMinMaxTimes;
133 For editing in fullscreen mode
135 extern Object *windowFullscreen;
136 extern Object *fullscreenGroup;
139 For our dispatcher:
141 IPTR MUIM_RGB_Draw ( Class *CLASS, Object *self, Msg message );
142 IPTR MUIM_RGB_Redraw ( );
143 IPTR MUIM_RGB_RedrawArea ( );
144 IPTR MUIM_RGB_HandleInput ( Class *CLASS, Object *self, Msg message );
145 IPTR MUIM_RGB_Setup ( Class *CLASS, Object *self, Msg message );
146 IPTR MUIM_RGB_Cleanup ( Class *CLASS, Object *self, Msg message );
147 IPTR MUIM_RGB_ScrollingNotify ( );
148 IPTR MUIM_RGB_CanvasActivate ( Class *CLASS, Object *self, Msg message );
149 IPTR MUIM_RGB_CanvasDeactivate ( Class *CLASS, Object *self, Msg message );
150 IPTR MUIM_RGB_ZoomIn ( );
151 IPTR MUIM_RGB_ZoomOut ( );
152 IPTR MUIM_RGB_ShowAll ( );
153 IPTR MUIM_RGB_AskMinMax ( Class *CLASS, Object *self, Msg message );
154 IPTR MUIM_RGB_CloseCanvasWin ( Class *CLASS, Object *self, Msg message );
157 Setup keyboard shortcuts on canvas and toolbox
159 void checkKeyboardShortcuts ( UWORD stri );
162 Move canvas
164 void moveScrollbarUp ( );
165 void moveScrollbarDown ( );
166 void moveScrollbarLeft ( );
167 void moveScrollbarRight ( );
170 Redraw the area object with canvas data
171 Private function!!
173 IPTR _RGBitmapRedraw ( Class *CLASS, Object *self );
176 Update Frame: 1/1 etc
178 void UpdateCanvasInfo ( struct WindowList *win );
181 Scroll the active canvas
183 IPTR ScrollCanvas ( int x, int y );
186 Snap offset coords to zoom (globalactivecanvas)
188 void SnapOffsetToZoom ( struct oCanvas *canv );
191 Check if active window has changed and
192 redraw if it has
194 void winHasChanged ( );
197 Store mouse coordinates into the global variables
199 void getMouseCoordinates ( );
202 This function adds a canvas window to the canvas window list
203 ( canwinlist )
205 void addCanvaswindow (
206 unsigned int width, unsigned int height,
207 unsigned int layers, unsigned int frames,
208 BOOL generateCanvas
212 Show/Hide the fullscreen editing window
214 void showFullscreenWindow ( struct oCanvas *canvas );
215 void hideFullscreenWindow ( );
218 Contstrain offset values within scope of canvas
220 void constrainOffset ( struct oCanvas *canvas );
223 Test if we're hitting "walls"
225 void snapToBounds ( int *x, int *y );
228 This function sends back a pointer to a window object
230 Object *getCanvaswindowById ( unsigned int id );
233 This function sends back a pointer to the window struct
235 struct WindowList *getCanvasDataById ( unsigned int id );
238 Import an image rawly! :-D
240 void importImageRAW ( unsigned int w, unsigned int h, unsigned long long int *buffer );
243 Load an image through datatypes
245 BOOL loadDatatypeImage ( );
248 Free memory
250 void deleteCanvaswindows ( );
253 Remove a single canvas window and it's structure
255 IPTR removeActiveWindow ( Class *CLASS, Object *self );
258 Blit over a rect to the area from a canvas
260 void blitAreaRect (
261 int x, int y, int w, int h,
262 struct oCanvas* canvas, struct RastPort *rp
266 Special mode, blit overlay toolpreview
268 void blitToolPreview ( int x, int y, int w, int h );
271 Removes previous tool preview blit from the painting
273 void removePrevToolPreview ( );
276 Calls blitAreaRect over a hovered over part of the screen
277 to show the current brush or a clipbrush
279 void callToolPreview ( );
282 Get geometry of the canvas area
283 PRIVATE functions
285 ULONG _getAreaWidth ( );
286 ULONG _getAreaHeight ( );
287 ULONG _getAreaTop ( );
288 ULONG _getAreaLeft ( );
289 ULONG _getAreaOffsetX ( );
290 ULONG _getAreaOffsetY ( );
292 #endif