aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DrawUtil.cc20
-rw-r--r--src/DrawUtil.hh20
2 files changed, 22 insertions, 18 deletions
diff --git a/src/DrawUtil.cc b/src/DrawUtil.cc
index a276e48..1c29567 100644
--- a/src/DrawUtil.cc
+++ b/src/DrawUtil.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: DrawUtil.cc,v 1.4 2002/01/09 14:11:20 fluxgen Exp $ 22// $Id: DrawUtil.cc,v 1.5 2002/03/22 11:51:46 fluxgen Exp $
23 23
24#ifdef HAVE_CONFIG_H 24#ifdef HAVE_CONFIG_H
25# include "config.h" 25# include "config.h"
@@ -37,14 +37,16 @@
37 37
38using namespace std; 38using namespace std;
39 39
40namespace DrawUtil
41{
42
40// ---------------------------------------------------------------------- 43// ----------------------------------------------------------------------
41// xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma) 44// xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma)
42// ---------------------------------------------------------------------- 45// ----------------------------------------------------------------------
43
44//------- XRotLoadFont ------------------- 46//------- XRotLoadFont -------------------
45// Load the rotated version of a given font 47// Load the rotated version of a given font
46//---------------------------------------- 48//----------------------------------------
47DrawUtil::XRotFontStruct *DrawUtil::XRotLoadFont(Display *dpy, char *fontname, float angle) { 49XRotFontStruct *XRotLoadFont(Display *dpy, char *fontname, float angle) {
48 char val; 50 char val;
49 XImage *I1, *I2; 51 XImage *I1, *I2;
50 Pixmap canvas; 52 Pixmap canvas;
@@ -252,7 +254,7 @@ DrawUtil::XRotFontStruct *DrawUtil::XRotLoadFont(Display *dpy, char *fontname, f
252// Free the resources associated with a 254// Free the resources associated with a
253// rotated font 255// rotated font
254//---------------------------------------- 256//----------------------------------------
255void DrawUtil::XRotUnloadFont(Display *dpy, XRotFontStruct *rotfont) 257void XRotUnloadFont(Display *dpy, XRotFontStruct *rotfont)
256{ 258{
257 int ichar; 259 int ichar;
258 260
@@ -272,7 +274,7 @@ void DrawUtil::XRotUnloadFont(Display *dpy, XRotFontStruct *rotfont)
272//------- XRotTextWidth ------------------ 274//------- XRotTextWidth ------------------
273// Returns the width of a rotated string 275// Returns the width of a rotated string
274//---------------------------------------- 276//----------------------------------------
275unsigned int DrawUtil::XRotTextWidth(XRotFontStruct *rotfont, char *str, int len) 277unsigned int XRotTextWidth(XRotFontStruct *rotfont, char *str, int len)
276{ 278{
277 int i, width = 0, ichar; 279 int i, width = 0, ichar;
278 280
@@ -297,7 +299,7 @@ unsigned int DrawUtil::XRotTextWidth(XRotFontStruct *rotfont, char *str, int len
297//------- XRotDrawString ----------------- 299//------- XRotDrawString -----------------
298// A front end to XRotDrawString : mimics XDrawString 300// A front end to XRotDrawString : mimics XDrawString
299//---------------------------------------- 301//----------------------------------------
300void DrawUtil::XRotDrawString(Display *dpy, XRotFontStruct *rotfont, Drawable drawable, 302void XRotDrawString(Display *dpy, XRotFontStruct *rotfont, Drawable drawable,
301 GC gc, int x, int y, char *str, int len) 303 GC gc, int x, int y, char *str, int len)
302{ 304{
303 static GC my_gc = 0; 305 static GC my_gc = 0;
@@ -364,7 +366,7 @@ void DrawUtil::XRotDrawString(Display *dpy, XRotFontStruct *rotfont, Drawable dr
364 366
365 367
366//Draw title string 368//Draw title string
367void DrawUtil::DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font, 369void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font,
368 unsigned int text_w, unsigned int size_w, 370 unsigned int text_w, unsigned int size_w,
369 unsigned int bevel_w, char *text) { 371 unsigned int bevel_w, char *text) {
370 372
@@ -425,7 +427,7 @@ void DrawUtil::DrawString(Display *display, Window w, GC gc, DrawUtil::Font *fon
425} 427}
426 428
427 429
428void DrawUtil::DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *font, 430void DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *font,
429 unsigned int align, unsigned int text_w, 431 unsigned int align, unsigned int text_w,
430 unsigned int size_w, unsigned int size_h, 432 unsigned int size_w, unsigned int size_h,
431 unsigned int bevel_w, char *text) { 433 unsigned int bevel_w, char *text) {
@@ -465,3 +467,5 @@ void DrawUtil::DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *
465 XClearWindow(display, w); 467 XClearWindow(display, w);
466 XRotDrawString(display, font, w, gc, size_w, size_h, text, dlen); 468 XRotDrawString(display, font, w, gc, size_w, size_h, text, dlen);
467} 469}
470
471}; //end namespace DrawUtil
diff --git a/src/DrawUtil.hh b/src/DrawUtil.hh
index 5131c70..3b3d32c 100644
--- a/src/DrawUtil.hh
+++ b/src/DrawUtil.hh
@@ -19,14 +19,14 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: DrawUtil.hh,v 1.3 2002/02/17 19:00:14 fluxgen Exp $ 22// $Id: DrawUtil.hh,v 1.4 2002/03/22 11:51:46 fluxgen Exp $
23 23
24#ifndef DRAWUTIL_HH 24#ifndef DRAWUTIL_HH
25#define DRAWUTIL_HH 25#define DRAWUTIL_HH
26 26
27#include <X11/Xlib.h> 27#include <X11/Xlib.h>
28 28
29struct DrawUtil 29namespace DrawUtil
30{ 30{
31 struct Font 31 struct Font
32 { 32 {
@@ -38,7 +38,7 @@ struct DrawUtil
38 FontJustify justify; 38 FontJustify justify;
39 }; 39 };
40 40
41static void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font, 41void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font,
42 unsigned int text_w, unsigned int size_w, 42 unsigned int text_w, unsigned int size_w,
43 unsigned int bevel_w, char *text); 43 unsigned int bevel_w, char *text);
44 44
@@ -78,18 +78,18 @@ static void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font,
78 78
79 DrawUtil::XRotCharStruct per_char[95]; 79 DrawUtil::XRotCharStruct per_char[95];
80 }; 80 };
81static unsigned int XRotTextWidth(DrawUtil::XRotFontStruct *rotfont, char *str, int len); 81unsigned int XRotTextWidth(DrawUtil::XRotFontStruct *rotfont, char *str, int len);
82static void XRotDrawString(Display *dpy, DrawUtil::XRotFontStruct *rotfont, Drawable drawable, 82void XRotDrawString(Display *dpy, DrawUtil::XRotFontStruct *rotfont, Drawable drawable,
83 GC gc, int x, int y, char *str, int len); 83 GC gc, int x, int y, char *str, int len);
84 84
85static void DrawRotString(Display *display, Window w, GC gc, DrawUtil::XRotFontStruct *font, 85void DrawRotString(Display *display, Window w, GC gc, DrawUtil::XRotFontStruct *font,
86 unsigned int align, unsigned int text_w, 86 unsigned int align, unsigned int text_w,
87 unsigned int size_w, unsigned int size_h, 87 unsigned int size_w, unsigned int size_h,
88 unsigned int bevel_w, char *text); 88 unsigned int bevel_w, char *text);
89 89
90static DrawUtil::XRotFontStruct *XRotLoadFont(Display *dpy, char *fontname, float angle); 90DrawUtil::XRotFontStruct *XRotLoadFont(Display *dpy, char *fontname, float angle);
91static void XRotUnloadFont(Display *dpy, DrawUtil::XRotFontStruct *rotfont); 91void XRotUnloadFont(Display *dpy, DrawUtil::XRotFontStruct *rotfont);
92 92
93}; 93}; //end namespace DrawUtil
94 94
95#endif //_DRAWUTIL_HH_ 95#endif //DRAWUTIL_HH