summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/DrawUtil.cc67
-rw-r--r--src/DrawUtil.hh6
2 files changed, 3 insertions, 70 deletions
diff --git a/src/DrawUtil.cc b/src/DrawUtil.cc
index 220a993..8c41bc2 100644
--- a/src/DrawUtil.cc
+++ b/src/DrawUtil.cc
@@ -19,10 +19,10 @@
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.7 2002/05/07 08:15:18 fluxgen Exp $ 22// $Id: DrawUtil.cc,v 1.8 2002/11/12 22:44:17 fluxgen Exp $
23 23
24#ifdef HAVE_CONFIG_H 24#ifdef HAVE_CONFIG_H
25# include "config.h" 25#include "config.h"
26#endif //HAVE_CONFIG_H 26#endif //HAVE_CONFIG_H
27 27
28#include "DrawUtil.hh" 28#include "DrawUtil.hh"
@@ -364,69 +364,6 @@ void XRotDrawString(Display *dpy, XRotFontStruct *rotfont, Drawable drawable,
364 } 364 }
365} 365}
366 366
367
368//Draw title string
369void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font,
370 unsigned int text_w, unsigned int size_w,
371 unsigned int bevel_w, const char *text) {
372
373 assert(display);
374 assert(font);
375
376 if (!text || text_w<1 || size_w < 1)
377 return;
378
379 unsigned int l = text_w;
380 int dlen=strlen(text);
381 int dx=bevel_w*2;
382
383
384 if (text_w > size_w) {
385 for (; dlen >= 0; dlen--) {
386 if (I18n::instance()->multibyte()) {
387 XRectangle ink, logical;
388 XmbTextExtents(font->set, text, dlen,
389 &ink, &logical);
390 l = logical.width;
391 } else
392 l = XTextWidth(font->fontstruct, text, dlen);
393
394 l += (dx * 4);
395
396 if (l < size_w)
397 break;
398 }
399 }
400
401 switch (font->justify) {
402 case DrawUtil::Font::RIGHT:
403 dx += size_w - l;
404 break;
405
406 case DrawUtil::Font::CENTER:
407 dx += (size_w - l) / 2;
408 break;
409 default:
410 break;
411 }
412
413 //Draw title to m_tabwin
414
415 XClearWindow(display, w);
416
417 if (I18n::instance()->multibyte()) {
418 XmbDrawString(display, w,
419 font->set, gc, dx, 1 - font->set_extents->max_ink_extent.y,
420 text, dlen);
421 } else {
422 XDrawString(display, w,
423 gc, dx, font->fontstruct->ascent + 1,
424 text, dlen);
425 }
426
427}
428
429
430void DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *font, 367void DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *font,
431 unsigned int align, unsigned int text_w, 368 unsigned int align, unsigned int text_w,
432 unsigned int size_w, unsigned int size_h, 369 unsigned int size_w, unsigned int size_h,
diff --git a/src/DrawUtil.hh b/src/DrawUtil.hh
index 8435796..d866961 100644
--- a/src/DrawUtil.hh
+++ b/src/DrawUtil.hh
@@ -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.hh,v 1.6 2002/07/10 14:38:43 fluxgen Exp $ 22// $Id: DrawUtil.hh,v 1.7 2002/11/12 22:44:17 fluxgen Exp $
23 23
24#ifndef DRAWUTIL_HH 24#ifndef DRAWUTIL_HH
25#define DRAWUTIL_HH 25#define DRAWUTIL_HH
@@ -38,10 +38,6 @@ namespace DrawUtil
38 FontJustify justify; 38 FontJustify justify;
39 }; 39 };
40 40
41void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font,
42 unsigned int text_w, unsigned int size_w,
43 unsigned int bevel_w, const char *text);
44
45// ---------------------------------------------------------------------- 41// ----------------------------------------------------------------------
46// xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma) 42// xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma)
47// ---------------------------------------------------------------------- 43// ----------------------------------------------------------------------