1 #ifndef LIBRARIES_PATTEDITCLASS_H
2 #define LIBRARIES_PATTEDITCLASS_H
6 ** Copyright (C) 1995 by Bernardo Innocenti
8 ** Pattern editor class built on top of the "gadgetclass".
10 ** Note: Use 4 chars wide TABs to read this file.
13 #ifndef DATATYPES_DATATYPESCLASS_H
14 #include <datatypes/datatypesclass.h>
18 #define PATTEDITNAME "gadgets/pattedit.gadget"
19 #define PATTEDITCLASS "patteditclass"
20 #define PATTEDITVERS 2
23 /********************/
24 /* Class Attributes */
25 /********************/
27 #define PEA_Dummy (TAG_USER + 'PE' << 8)
29 #define PEA_CursTrack (PEA_Dummy+1)
30 #define PEA_CursColumn (PEA_Dummy+2)
31 #define PEA_CursLine (PEA_Dummy+3)
32 /* (IGSNU) Cursor position.
35 #define PEA_LeftTrack DTA_TopHoriz
36 #define PEA_TopLine DTA_TopVert
37 /* (IGSNU) Top line and leftmost track of the editor view.
40 #define PEA_Left (PEA_Dummy+6)
41 #define PEA_Right (PEA_Dummy+7)
42 #define PEA_Up (PEA_Dummy+8)
43 #define PEA_Down (PEA_Dummy+9)
44 #define PEA_CursLeft (PEA_Dummy+10)
45 #define PEA_CursRight (PEA_Dummy+11)
46 #define PEA_CursUp (PEA_Dummy+12)
47 #define PEA_CursDown (PEA_Dummy+13)
48 /* (S) PEA_Left and PEA_Right scroll the view left and right one
49 * line. The cursor is positioned to the leftmost or rightmost
50 * position, respectively. PEA_Up and PEA_Down scroll the view up
51 * and down of one line. The cursor is positioned to the upper or
52 * lower visible line, respectively. PEA_Curs#? attributes move
53 * the cursor one position towards the direction specified. The
54 * contents of ti_Data is meaningless for all these attributes.
57 #define PEA_UndoChange (PEA_Dummy+14)
58 /* (S) If ti_Data is > 0, one change made to the pattern is
59 * undone. If ti_Data is < 0, a previously undone change is
60 * redone. The cursor is always moved on the affected position.
63 #define PEA_Changes (PEA_Dummy+15)
64 /* (IGS) ti_Data contains the number of changes made to the pattern.
67 #define PEA_MarkRegion (PEA_Dummy+16)
68 /* (GS) ti_Data points to a struct Rectangle containing the limits
69 * (tracks and lines) of a pattern sub-region. When set, this
70 * attribute automatically starts range mode. Passing NULL in
71 * ti_Data causes the editor to clear the marked region. Passing
72 * ~0 in ti_Data toggles mark mode on and off.
73 * Getting this attribute returns a copy of the currently
74 * marked region, or {0,0,0,0} if no region is currently
75 * selected. The following relations must be true when setting
76 * this attribute and are guaranteed when getting it:
84 #define PEA_Flags (PEA_Dummy+17)
85 /* (IGSN) See PEF_#? flags definitions below.
88 #define PEA_DisplayTracks DTA_VisibleHoriz
89 #define PEA_DisplayLines DTA_VisibleVert
90 /* (GN) Maximum number of tracks and lines that fit in the gadget
94 #define PEA_Pattern (PEA_Dummy+20)
95 /* (ISGU) ti_Data is a pointer to the Pattern
96 * structure to be displayed by the PatternEditor.
99 #define PEA_CurrentInst (PEA_Dummy+21)
100 /* (IS) ti_Data is the default instrument
101 * number to be used when entering notes in the
105 #define PEA_MaxUndoLevels (PEA_Dummy+22)
106 /* (IS) ti_Data is the maximum size of the undo buffer in number
107 * of slots. 0 disables undo feature. Defaults to 16.
110 #define PEA_MaxUndoMem (PEA_Dummy+23)
111 /* (IS) ti_Data is the maximum memory used by the undo buffers.
112 * Setting it to 0 means unlimited memory. Defaults to 8192 bytes.
115 #define PEA_TextFont DTA_TextFont
116 /* (I) ti_Data points to the TextFont to be
117 * used with the PatternEditor. The font must
121 #define PEA_AdvanceCurs (PEA_Dummy+25)
122 /* (IS) The lower 16 bits of ti_Data contain the number of lines
123 * the cursor moves when a note is typed. The upper 16 bits contain
124 * the number of tracks. Both numbers are signed, so backwards
125 * cursor advancement is possible.
128 #define PEA_CursWrap (PEA_Dummy+26)
129 /* (IS) Can be 0 for no wrapping, PEF_HWRAP, PEF_VWRAP or both.
132 #define PEA_BGPen (PEA_Dummy+27)
133 #define PEA_TextPen (PEA_Dummy+28)
134 #define PEA_LinesPen (PEA_Dummy+29)
135 #define PEA_TinyLinesPen (PEA_Dummy+30)
136 /* (IS) Pens to be used to render the various editor elements.
137 * PEA_TextPen must be a power of two (1, 2, 4, 8...) because
138 * the text is rendered on one bitplane only. PEA_LinesPen
139 * and PEA_TinyLinesPen must not have the PEA_TextPen bit
140 * set because text scrolling happens on the text bitplane only
141 * and must not disturb the other elements. The defaults are
142 * 1 for PEA_TextPen and 2 for both PEA_LinesPen and
146 #define PEA_KeyboardMap (PEA_Dummy+31)
147 /* (IS) ti_Data points to a table which describes the notes associated
148 * to of the keys. The table starts with 1 Word specifying the number
151 * Each key definition has this format:
153 * 1 Byte with the note associated with the first key.
154 * 1 Byte with the instrument associated with the first key.
155 * This value may be 0, in which case the current instrument
158 * Passing NULL in ti_Data disables keyboard mapping.
160 * NOTE: The table is referenced, not copied, so it must stay in
161 * memory until the pattern editor is disposed or the table is
165 #define PEA_TrackChars (PEA_Dummy+32)
166 /* (IGSNU) Number of straight characters in a track. Minimum
167 * value is MINTRACKCHARS, maximum is MAXTRACKCHARS.
171 #define PEA_ChangeNote (PEA_Dummy+33)
172 /* (GNU) ti_Data contains a packed track/line pair of coordinates
173 * (the line in the low order 16 bits and the track in the upper
174 * 16bits). The editor sends update messages containing this tag
175 * whenever a note has been changed, and redraws the specified note
176 * when it receives this tag. This is a way to keep two or more
177 * editors synchronized while they display the same pattern. It can
178 * also be used to count the changes made to the song.
179 * ti_Data will be -1L when more than one note has changed (for
180 * istance when the user has pasted a block), and other editors
181 * will have to redraw their display completely.
184 #define PEA_SongInfo (PEA_Dummy+34)
185 /* (ISGU) ti_Data is a pointer to the songclass object which
186 * contains the pattern to be displayed. Without this tag, the
187 * pattern editor is unable to do some operations.
190 #define PEA_PattNum (PEA_Dummy+35)
191 /* (ISGNU) The pattern number to display. To use this tag,
192 * the editor needs to be passed the PEA_SongInfo tag too.
196 /* Definitions for PEA_Flags attribute */
198 #define PEF_MARKING (1<<0) /* Range mode */
199 #define PEF_HWRAP (1<<1) /* Horizontal cursor wrap */
200 #define PEF_VWRAP (1<<2) /* Vertical cursor wrap */
201 #define PEF_HEXMODE (1<<3) /* Use hexadecimal numbers */
202 #define PEF_BLANKZERO (1<<4) /* Blank zero digits */
203 #define PEF_INVERSETEXT (1<<5) /* Show backfilled text */
204 #define PEF_DOTINYLINES (1<<6) /* Show tiny separator lines */
205 #define PEF_DOCURSORRULER (1<<7) /* Show a ruler under the cursor */
206 #define PEF_MARKFULLTRACKS (1<<8) /* Mark full tracks only */
208 /* Private flags - Not settable by application */
209 #define PEF_ADJUSTSCROLLBOX (1<<28) /* User is adjusting the scroll box */
210 #define PEF_RESIZETRACKS (1<<29) /* User is resizing the tracks */
211 #define PEF_SCROLLING (1<<30) /* View is scrolling (read only) */
212 #define PEF_DRAGGING (1<<31) /* Cursor drag mode (read only) */
216 /* Width of a track expressed in chars */
217 #define MAXTRACKCHARS 14
218 #define MINTRACKCHARS 4
221 /* Cursor column names */
223 COL_NOTE, /* Cursor on note field */
224 COL_INSTH, /* Cursor on instrument high nibble */
225 COL_INSTL, /* Cursor on instrument low nibble */
226 COL_EFF, /* Cursor on effect field */
227 COL_VALH, /* Cursor on effect value high nibble */
228 COL_VALL, /* Cursor on effect value low nibble */
233 #endif /* !LIBRARIES_PATTEDITCLASS_H */