File: FGridP.h

package info (click to toggle)
xmbdfed 3.3-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,412 kB
  • ctags: 2,109
  • sloc: ansic: 29,997; makefile: 98
file content (192 lines) | stat: -rw-r--r-- 4,476 bytes parent folder | download
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*
 * Copyright 1996, 1997, 1998 Computing Research Labs,
 * New Mexico State University
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef _h_XmuttFontGridP
#define _h_XmuttFontGridP

/*
 * $Id: FGridP.h,v 1.1 1998/07/24 16:12:05 mleisher Exp $
 */

#include <stdio.h>
#include <Xm/XmP.h>
#if (XmVERSION == 1) && (XmREVISION >= 2)
#include <Xm/PrimitiveP.h>
#else if (XmVERSION == 2)
#include <X11/CoreP.h>
#include <Xm/PrimitiveP.h>
#endif
#include "FGrid.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifndef MAX
#define MAX(h, i) ((h) > (i) ? (h) : (i))
#endif

#ifndef MIN
#define MIN(l, o) ((l) < (o) ? (l) : (o))
#endif

/*
 * The Font Grid clipboard for handling selections.
 */
#define XmuttFONTGRID_CLIPBOARD(dsp) \
    XInternAtom(dsp, "FONTGRID_CLIPBOARD", False)

/*
 * The only (currently) clipboard type available.
 */
#define XmuttFONTGRID_GLYPHLIST(dsp) \
        XInternAtom(dsp, "FONTGRID_GLYPHLIST", False)

#define FGRID_MAX_COLS     16
#define FGRID_MAX_ROWS     16
#define FGRID_DEFAULT_COLS 16
#define FGRID_DEFAULT_ROWS 8

#define FGRID_MODIFIED 1
#define FGRID_SELECTED 2

#define IsSelected(code, map) (map[(code) >> 5] & (1 << ((code) & 31)))
#define Select(code, map) (map[(code) >> 5] |= (1 << ((code) & 31)))
#define Unselect(code, map) (map[(code) >> 5] &= ~(1 << ((code) & 31)))

typedef struct {
    long minpage;
    long maxpage;
    long npage;
    long ppage;

    long pageno;
    long bcode;
    long sel_start;
    long sel_end;

    unsigned long selmap[2048];
} _XmuttFGridPageInfo;

/*
 * Class and instance structures.
 */
typedef struct _XmuttFGridClassPart {
    int ref_cnt;
    XtPointer extension;
} XmuttFGridClassPart;

typedef struct _XmuttFGridClassRec {
    CoreClassPart core_class;
    XmPrimitiveClassPart primitive_class;
    XmuttFGridClassPart fgrid_class;
} XmuttFGridClassRec;

typedef struct _XmuttFGridPart {
    /*
     * Public members.
     */
    int base;
    bdf_font_t *data;
    XtCallbackList activate;
    XtCallbackList page;
    XtCallbackList sel_start;
    XtCallbackList sel_extend;
    XtCallbackList sel_end;
    XtCallbackList modified;
    Dimension cell_rows;
    Dimension cell_cols;
    Dimension mwidth;
    Dimension mheight;

    Boolean noblanks;
    Boolean unencoded;
    Boolean overwrite_mode;

    /*
     * The horizontal and vertical resolutions, determined dynamically
     * if not supplied by user.
     */
    long hres;
    long vres;

    /*
     * The default point size.
     */
    long ptsize;

    /*
     * The font spacing.
     */
    long spacing;

    /*
     * The multi-click time.
     */
    int mclick;

    /*
     * Private members.
     */
    XFontStruct *idfnt;
    GC gc;
    GC invgc;
    XPoint *gpoints;
    unsigned long gpoints_size;
    unsigned long gpoints_used;

    Dimension label_height;
    Dimension cell_width;
    Dimension cell_height;

    long pagesize;

    _XmuttFGridPageInfo npage;
    _XmuttFGridPageInfo upage;

    Boolean owns_clipboard;
    Boolean hasfocus;
    Boolean resizing;
    Boolean clearwin;
    Boolean insert_paste;

    int mclick_time;
    Time last_click;

    long pxsize;
    long defhres;
    long defvres;

    bdf_glyphlist_t clipboard;
} XmuttFGridPart;

typedef struct _XmuttFGridRec {
    CorePart core;
    XmPrimitivePart primitive;
    XmuttFGridPart fgrid;
} XmuttFGridRec;

#ifdef __cplusplus
}
#endif

#endif /* _h_XmuttFontGridP */