summaryrefslogtreecommitdiff
path: root/psd.h
blob: a270441d8e9312c2e2208f224c9b8a9773e426b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
Copyright (c) 2003 Bruno T. C. de Oliveira

LICENSE INFORMATION:
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 General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
Copyright (c) 2002 Bruno T. C. de Oliveira

INFORMA��ES DE LICEN�A:
Este programa � um software de livre distribui��o; voc� pode
redistribu�-lo e/ou modific�-lo sob os termos da GNU General
Public License, conforme publicado pela Free Software Foundation,
pela vers�o 2 da licen�a ou qualquer vers�o posterior.

Este programa � distribu�do na esperan�a de que ele ser� �til
aos seus usu�rios, por�m, SEM QUAISQUER GARANTIAS; sem sequer
a garantia impl�cita de COMERCIABILIDADE ou DE ADEQUA��O A
QUALQUER FINALIDADE ESPEC�FICA. Consulte a GNU General Public
License para obter mais detalhes (uma c�pia acompanha este
programa, armazenada no arquivo COPYING).
*/


#ifndef _btco_aewan_psd_h
#define _btco_aewan_psd_h

#include "bores/bores.h"

#include "version.h"

/* selection modes: */
#define SM_NONE    0     /* no selection */
#define SM_SELECT  1     /* grow/shrink selection box */
#define SM_FLOAT   2     /* paste mode: clipboard floats around screen */

struct _Document;

/* global program state data declarations */
extern struct _Document *_doc; 
                         /* the current document. Must ALWAYS be non-null. */

extern char *_filename;  /* the name of the file from which it was loaded; 
                          * NULL if new file */

extern int _lyr;      /* currently active layer. This is a valid layer
                       * index if and only if _doc->layer_count >= 1 */
extern int _x, _y;    /* cursor position (logical coordinates) */
extern int _svx, _svy;/* "smallest visible x" and "smallest visible y"
                       * These are used in order to convert logical coordinates
                       * to screen coordinates. Logical coordinates _svx,_svy
                       * are mapped to screen (0,0). */
extern int _fg, _bg;  /* currently selected foreground and background colors */
extern int _selmode;  /* selection mode: SM_NONE, SM_SELECT, SM_FLOAT */
extern int _ax, _ay;  /* the anchor-point (i.e. where the selection begins).
                       * Valid only if _selmode == true */
extern bool _insmode;/* whether insert mode is on. In insert mode, typing
                       * a character on a line shifts the other characters
                       * to the right. */

extern bool _lgmode; /* line graphics mode. When this mode is active,
                         certain keystrokes produce different characters */

extern bool _compmode; /* composite mode. In this mode, all layers will
                         * be visible. */

extern struct _Layer *_clipboard; 
                      /* clipboard layer. NULL if nothing in clipboard. */

/* --- functions that operate on psd ------------------------------------- */

/* Zeroes program state data */
void zero_state(void);

/* Convenience function that returns whether document is empty or not */
bool doc_empty(void); 

/* Obtains normalized selection coordinates. Returned coordinates x0, y0,
 * x1, y1 represent the selection rectangle, with the property that
 * x0 <= x1 and y0 <= y1 */
void get_norm_sel(int *x0, int *y0, int *x1, int *y1);

/* Switches active layer to l. Does appropriate coordinate bound
 * checking and other administrative tasks */
void switch_to_layer(int l);

#endif