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 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
|
/*
* Copyright 2001 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_XmuttGEdit
#define _h_XmuttGEdit
/*
* $Id: GEdit.h,v 1.7 2001/09/19 21:00:41 mleisher Exp $
*/
#include <Xm/Xm.h>
#include "bdfP.h"
#include "GEShared.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* A macro for prototypes.
*/
#undef __
#ifndef _NO_PROTO
#define __(x) x
#else
#define __(x) ()
#endif
/*
* Widget class and widget declarations.
*/
externalref WidgetClass xmuttGlyphEditWidgetClass;
typedef struct _XmuttGlyphEditClassRec *XmuttGlyphEditWidgetClass;
typedef struct _XmuttGlyphEditRec *XmuttGlyphEditWidget;
#ifndef XmuttIsGlyphEdit
#define XmuttIsGlyphEdit(w) XtIsSubclass(w, xmuttGlyphEditWidgetClass)
#endif /* XmuttIsGlyphEdit */
/**************************************************************************
*
* Resources.
*
**************************************************************************/
#define XmNglyphGrid "glyphGrid"
#define XmCGlyphGrid "GlyphGrid"
#define XmNcursorColor "cursorColor"
#define XmCCursorColor "CursorColor"
#define XmNbaselineColor "baselineColor"
#define XmCBaselineColor "BaselineColor"
#define XmNselectionColor "selectionColor"
#define XmCSelectionColor "SelectionColor"
#define XmNimageChangeCallback "imageChangeCallback"
#define XmCImageChangeCallback "ImageChangeCallback"
#define XmNpointerMovedCallback "pointerMovedCallback"
#define XmCPointerMovedCallback "PointerMovedCallback"
#define XmNoperationSwitchCallback "operationSwitchCallback"
#define XmCOperationSwitchCallback "OperationSwitchCallback"
#define XmNglyphModifiedCallback "glyphModifiedCallback"
#define XmCGlyphModifiedCallback "GlyphModifiedCallback"
#define XmNdefaultPixelSize "defaultPixelSize"
#define XmCDefaultPixelSize "DefaultPixelSize"
#define XmNshowXHeight "showXHeight"
#define XmCShowXHeight "ShowXHeight"
#define XmNshowCapHeight "showCapHeight"
#define XmCShowCapHeight "ShowCapHeight"
#define XmNcolorList "colorList"
#define XmCColorList "ColorList"
/**************************************************************************
*
* Callback macros and structures.
*
**************************************************************************/
/*
* Callback reasons.
*/
#define XmuttGLYPHEDIT_IMAGE_CHANGE -1
#define XmuttGLYPHEDIT_POINTER_MOVED -2
#define XmuttGLYPHEDIT_OPERATION_CHANGE -3
#define XmuttGLYPHEDIT_GLYPH_MODIFIED -4
#define XmuttGLYPHEDIT_COLOR_CHANGE -5
/*
* Callback structures.
*/
typedef struct {
int reason;
XEvent *event;
bdf_bitmap_t *image;
int operation;
bdf_metrics_t *metrics;
Position x;
Position y;
int color;
} XmuttGlyphEditUpdateCallbackStruct;
/**************************************************************************
*
* API.
*
**************************************************************************/
/*
* Macros used with the XmuttGlyphEditFlip() function.
*/
#define XmuttGLYPHEDIT_HORIZONTAL 1
#define XmuttGLYPHEDIT_VERTICAL 2
/*
* Get the encoding of the glyph.
*/
extern long XmuttGlyphEditEncoding __((Widget w));
/*
* Get the current set of metrics from the glyph editor.
*/
extern void XmuttGlyphEditMetrics __((Widget w, bdf_metrics_t *metrics,
Boolean font));
/*
* Changes the device width, width, and height values from the metrics
* supplied.
*/
extern void XmuttGlyphEditSetMetrics __((Widget w, bdf_metrics_t *metrics));
/*
* Adjust the font spacing and the mono width if necessary.
*/
extern void XmuttGlyphEditSetSpacing __((Widget w, unsigned short spacing,
unsigned short monowidth));
/*
* Check to see if the glyph was modified.
*/
extern Boolean XmuttGlyphEditModified __((Widget w));
/*
* Change the flag that indicates whether the glyph has been modified or not.
*/
extern void XmuttGlyphEditSetModified __((Widget w, Boolean modified));
/*
* Check to see if the glyph editor has a selection or not.
*/
extern Boolean XmuttGlyphEditHasSelection __((Widget w));
/*
* Check to see if the glyph edit clipboard is empty or not.
*/
extern Boolean XmuttGlyphEditClipboardEmpty __((Widget w));
/*
* Retrieve the image from the grid.
*/
extern void XmuttGlyphEditImage __((Widget w, bdf_bitmap_t *image));
/*
* Retrieve the grid.
*/
extern bdf_glyph_grid_t *XmuttGlyphEditGrid __((Widget w));
/*
* Retrieve the glyph from the grid.
*/
extern bdf_glyph_t *XmuttGlyphEditGlyph __((Widget w, Boolean *unencoded));
/*
* Crop the glyph bitmap to get rid of empty rows and columns around the
* glyph.
*/
extern void XmuttGlyphEditCrop __((Widget w));
/*
* Shift the bitmap horizontally, vertically or a combination of both.
*/
extern void XmuttGlyphEditShift __((Widget w, short xcount, short ycount));
/*
* Rotate the bitmap clockwise (positive count) or counter-clockwise
* (negative count).
*/
extern void XmuttGlyphEditRotate __((Widget w, short degrees));
/*
* Shear the bitmap clockwise (positive count) or counter-clockwise
* (negative count). Limited to the range of [-20,20] degrees.
*/
extern void XmuttGlyphEditShear __((Widget w, short degrees));
/*
* Make the glyph bold.
*/
extern void XmuttGlyphEditEmbolden __((Widget w));
/*
* Flip the bitmap horizontally or vertically.
*/
extern void XmuttGlyphEditFlip __((Widget w, short direction));
/*
* Change to the draw, select, move, or copy operation.
*/
extern void XmuttGlyphEditChangeOperation __((Widget w, int op));
/*
* Change the current color.
*/
extern void XmuttGlyphEditChangeColor __((Widget w, int color));
/*
* Insert a bitmap from some outside source.
*/
extern void XmuttGlyphEditInsertBitmap __((Widget w, bdf_bitmap_t *bitmap));
/*
* Functions explicitly for importing and exporting XBM bitmaps.
*/
extern int XmuttGlyphEditImportXBM __((Widget w, String filename));
extern int XmuttGlyphEditExportXBM __((Widget w, String filename));
extern void XmuttGlyphEditCopySelection __((Widget w));
extern void XmuttGlyphEditCutSelection __((Widget w));
extern void XmuttGlyphEditPasteSelection __((Widget w));
extern void XmuttGlyphEditSelectAll __((Widget w));
#undef __
#ifdef __cplusplus
}
#endif
#endif /* _h_XmuttGEdit */
|