From 12f03e5ac4a85147b8ee543e22cc1f3434f15d4a Mon Sep 17 00:00:00 2001 From: nwanua Date: Thu, 13 Jul 2000 23:54:20 +0000 Subject: [PATCH] added fontmanager.c --- WINGs/fontmanager.c | 81 +++++++++++++++++++++++++++++++++++++++++++++ WINGs/wruler.c | 35 +++++++++++++++----- WINGs/wtest.c | 4 +-- 3 files changed, 110 insertions(+), 10 deletions(-) create mode 100644 WINGs/fontmanager.c diff --git a/WINGs/fontmanager.c b/WINGs/fontmanager.c new file mode 100644 index 00000000..28a1928a --- /dev/null +++ b/WINGs/fontmanager.c @@ -0,0 +1,81 @@ + +#include "WINGsP.h" + + +static void +changeFontProp(char *fname, char *newprop, int which) +{ + char before[128], prop[128], after[128]; + char *ptr, *bptr; + int part=0; + + if(!fname || !prop) + return; + + ptr = fname; + bptr = before; + while (*ptr) { + if(*ptr == '-') { + *bptr = 0; + if(part==which) bptr = prop; + else if(part==which+1) bptr = after; + *bptr++ = *ptr; + part++; + } else { + *bptr++ = *ptr; + } ptr++; + }*bptr = 0; + snprintf(fname, 255, "%s-%s%s", before, newprop, after); +} + + +WMFont * +WMGetFontPlain(WMScreen *scrPtr, WMFont *font) +{ + WMFont *nfont=NULL; + if(!scrPtr|| !font) + return NULL; + return font; + +} + +WMFont * +WMGetFontBold(WMScreen *scrPtr, WMFont *font) +{ + WMFont *newfont=NULL; + char fname[256]; + if(!scrPtr || !font) + return NULL; + snprintf(fname, 255, font->name); + changeFontProp(fname, "bold", 2); + newfont = WMCreateNormalFont(scrPtr, fname); + if(!newfont) + newfont = font; + return newfont; +} + +WMFont * +WMGetFontItalic(WMScreen *scrPtr, WMFont *font) +{ + WMFont *newfont=NULL; + char fname[256]; + if(!scrPtr || !font) + return NULL; + snprintf(fname, 255, font->name); + changeFontProp(fname, "o", 3); + newfont = WMCreateNormalFont(scrPtr, fname); + if(!newfont) + newfont = font; + return newfont; +} + +WMFont * +WMGetFontOfSize(WMScreen *scrPtr, WMFont *font, int size) +{ + WMFont *nfont=NULL; + if(!scrPtr || !font || size<1) + return NULL; + return font; +} + + diff --git a/WINGs/wruler.c b/WINGs/wruler.c index 736e0fda..95354fe5 100644 --- a/WINGs/wruler.c +++ b/WINGs/wruler.c @@ -1,5 +1,22 @@ -/* WMRuler: nifty ruler widget for WINGs (OK, for WMText ;-) */ -/* Copyleft (>) 1999, 2000 Nwanua Elumeze */ +/* + * WINGs WMRuler nifty ruler widget for WINGs (OK, for WMText ;-) + * + * Copyright (c) 1999-2000 Nwanua Elumeze + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #include "WINGsP.h" @@ -26,8 +43,9 @@ typedef struct W_Ruler { struct { unsigned int buttonPressed:1; - /* 0, 1, 2, 3, 4, 5, 6 */ - unsigned int whichMarker:3; /* none, left, right, first, body, tabstop, both */ + unsigned int whichMarker:3; + /* 0, 1, 2, 3, 4, 5, 6 */ + /* none, left, right, first, body, tabstop, first & body */ unsigned int RESERVED:28; } flags; } Ruler; @@ -43,7 +61,8 @@ typedef struct W_Ruler { | */ -static void drawLeftMarker(Ruler * rPtr) +static void +drawLeftMarker(Ruler * rPtr) { XPoint points[4]; int xpos = (rPtr->flags.whichMarker == 1 ? @@ -66,9 +85,9 @@ static void drawLeftMarker(Ruler * rPtr) /* Marker for right margin - /| - / | - /__| + /| + / | +/__| | | diff --git a/WINGs/wtest.c b/WINGs/wtest.c index dd73f4da..b29aa52d 100644 --- a/WINGs/wtest.c +++ b/WINGs/wtest.c @@ -1075,7 +1075,9 @@ int main(int argc, char **argv) * * Put the testSomething() function you want to test here. */ + testTabView(scr); +#if 0 testDragAndDrop(scr); testDragAndDrop(scr); @@ -1084,13 +1086,11 @@ int main(int argc, char **argv) testButton(scr); -#if 0 testFrame(scr); testColorWell(scr); - testTabView(scr); testFontPanel(scr);