diff options
author | joye <joye> | 2014-02-14 19:34:32 (GMT) |
---|---|---|
committer | joye <joye> | 2014-02-14 19:34:32 (GMT) |
commit | 0b831e47eece8e8534c366928c75bb459036e29b (patch) | |
tree | 80b8f75b513c1d8ae7f241609ad10e0b50b4cabb /src | |
parent | 96eb8020c16d4c306635f335c1ce225784d7518e (diff) | |
download | blt-0b831e47eece8e8534c366928c75bb459036e29b.zip blt-0b831e47eece8e8534c366928c75bb459036e29b.tar.gz blt-0b831e47eece8e8534c366928c75bb459036e29b.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltConfig.C | 102 | ||||
-rw-r--r-- | src/bltGrElemBar.C | 38 | ||||
-rw-r--r-- | src/bltGrLegd.C | 34 | ||||
-rw-r--r-- | src/bltGrText.h | 2 |
4 files changed, 46 insertions, 130 deletions
diff --git a/src/bltConfig.C b/src/bltConfig.C index 7368173..a263ac1 100644 --- a/src/bltConfig.C +++ b/src/bltConfig.C @@ -82,48 +82,6 @@ #include <stdarg.h> #include "bltInt.h" -#include "bltBgStyle.h" - -// Background - -static Tk_CustomOptionSetProc BackgroundSetProc; -static Tk_CustomOptionGetProc BackgroundGetProc; -Tk_ObjCustomOption backgroundObjOption = - { - "background", BackgroundSetProc, BackgroundGetProc, NULL, NULL, NULL - }; - -static int BackgroundSetProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec, - int offset, char* save, int flags) -{ - Blt_Background* backgroundPtr = (Blt_Background*)(widgRec + offset); - - if (*backgroundPtr) - Blt_FreeBackground(*backgroundPtr); - *backgroundPtr = NULL; - - int length; - const char* string = Tcl_GetStringFromObj(*objPtr, &length); - if (string) - *backgroundPtr = Blt_GetBackground(interp, tkwin, string); - else - return TCL_ERROR; - - return TCL_OK; -} - -static Tcl_Obj* BackgroundGetProc(ClientData clientData, Tk_Window tkwin, - char *widgRec, int offset) -{ - Blt_Background* backgroundPtr = (Blt_Background*)(widgRec + offset); - if (*backgroundPtr) { - const char* string = Blt_NameOfBackground(*backgroundPtr); - return Tcl_NewStringObj(string, -1); - } - else - return Tcl_NewStringObj("", -1); -} // Point static Tk_CustomOptionSetProc PointSetProc; @@ -576,66 +534,6 @@ static void ListFreeProc(ClientData clientData, Display* display, } } -/* BACKGROUND */ - -static Blt_OptionParseProc ObjToBackgroundProc; -static Blt_OptionPrintProc BackgroundToObjProc; -static Blt_OptionFreeProc BackgroundFreeProc; -Blt_CustomOption backgroundOption = -{ - ObjToBackgroundProc, BackgroundToObjProc, BackgroundFreeProc, (ClientData)0 -}; - -static int ObjToBackgroundProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, Tcl_Obj *objPtr, char *widgRec, - int offset, int flags) -{ - const char* string; - int length; - Blt_Background* backgroundPtr; - - backgroundPtr = (Blt_Background*)(widgRec + offset); - - if (*backgroundPtr) - Blt_FreeBackground(*backgroundPtr); - *backgroundPtr = NULL; - - string = Tcl_GetStringFromObj(objPtr, &length); - if (string) - *backgroundPtr = Blt_GetBackground(interp, tkwin, string); - else - return TCL_ERROR; - - return TCL_OK; -} - -static Tcl_Obj* BackgroundToObjProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, char *widgRec, - int offset, int flags) -{ - const char* string; - Blt_Background* backgroundPtr; - - backgroundPtr = (Blt_Background*)(widgRec + offset); - if (*backgroundPtr) { - string = Blt_NameOfBackground(*backgroundPtr); - return Tcl_NewStringObj(string, -1); - } - else - return Tcl_NewStringObj("", -1); -} - -static void BackgroundFreeProc(ClientData clientData, Display* display, - char *widgRec, int offset) -{ - Blt_Background* backgroundPtr; - - backgroundPtr = (Blt_Background*)(widgRec + offset); - if (*backgroundPtr) - Blt_FreeBackground(*backgroundPtr); - *backgroundPtr = NULL; -} - /* OBJECT */ static Blt_OptionParseProc ObjToObjectProc; diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C index d428494..cbd916e 100644 --- a/src/bltGrElemBar.C +++ b/src/bltGrElemBar.C @@ -1704,6 +1704,35 @@ DrawSymbolProc(Graph *graphPtr, Drawable drawable, Element *basePtr, } } +static void SetBackgroundClipRegion(Tk_Window tkwin, Tk_3DBorder border, + TkRegion rgn) +{ + Display *display; + GC gc; + + display = Tk_Display(tkwin); + gc = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); + TkSetRegion(display, gc, rgn); + gc = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); + TkSetRegion(display, gc, rgn); + gc = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); + TkSetRegion(display, gc, rgn); +} + +static void UnsetBackgroundClipRegion(Tk_Window tkwin, Tk_3DBorder border) +{ + Display *display; + GC gc; + + display = Tk_Display(tkwin); + gc = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); + XSetClipMask(display, gc, None); + gc = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); + XSetClipMask(display, gc, None); + gc = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); + XSetClipMask(display, gc, None); +} + /* *--------------------------------------------------------------------------- * @@ -1716,9 +1745,8 @@ DrawSymbolProc(Graph *graphPtr, Drawable drawable, Element *basePtr, * *--------------------------------------------------------------------------- */ -static void -DrawBarSegments(Graph *graphPtr, Drawable drawable, BarPen *penPtr, - XRectangle *bars, int nBars) +static void DrawBarSegments(Graph *graphPtr, Drawable drawable, BarPen *penPtr, + XRectangle *bars, int nBars) { TkRegion rgn; @@ -1743,7 +1771,7 @@ DrawBarSegments(Graph *graphPtr, Drawable drawable, BarPen *penPtr, if (penPtr->stipple != None) { TkSetRegion(graphPtr->display, penPtr->fillGC, rgn); } - Blt_SetBackgroundClipRegion(graphPtr->tkwin, penPtr->fill, rgn); + SetBackgroundClipRegion(graphPtr->tkwin, penPtr->fill, rgn); if (hasOutline) { TkSetRegion(graphPtr->display, penPtr->outlineGC, rgn); } @@ -1761,7 +1789,7 @@ DrawBarSegments(Graph *graphPtr, Drawable drawable, BarPen *penPtr, rp->x, rp->y, rp->width, rp->height); } } - Blt_UnsetBackgroundClipRegion(graphPtr->tkwin, penPtr->fill); + UnsetBackgroundClipRegion(graphPtr->tkwin, penPtr->fill); if (hasOutline) { XSetClipMask(graphPtr->display, penPtr->outlineGC, None); } diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 0b34b19..d6c3659 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -129,8 +129,8 @@ struct _Legend { XColor *selInFocusFgColor; /* Text color of a selected entry. */ XColor *selOutFocusFgColor; - Blt_Background selInFocusBg; - Blt_Background selOutFocusBg; + Tk_3DBorder selInFocusBg; + Tk_3DBorder selOutFocusBg; XColor *focusColor; Blt_Dashes focusDashes; /* Dash on-off value. */ @@ -410,10 +410,10 @@ static Tk_OptionSpec optionSpecs[] = { DEF_LEGEND_IPADY, -1, Tk_Offset(Legend, iyPad), 0, NULL, RESET_WORLD | CACHE_DIRTY}, - {TK_OPTION_CUSTOM, "-nofocusselectbackground", "noFocusSelectBackground", + {TK_OPTION_BORDER, "-nofocusselectbackground", "noFocusSelectBackground", "NoFocusSelectBackground", DEF_LEGEND_SELECTBACKGROUND, - -1, Tk_Offset(Legend, selOutFocusBg), 0, &backgroundObjOption, 0}, + -1, Tk_Offset(Legend, selOutFocusBg), 0, NULL, 0}, {TK_OPTION_COLOR, "-nofocusselectforeground", "noFocusSelectForeground", "NoFocusSelectForeground", DEF_LEGEND_SELECTFOREGROUND, @@ -442,10 +442,10 @@ static Tk_OptionSpec optionSpecs[] = { DEF_LEGEND_ROWS, -1, Tk_Offset(Legend, reqRows), 0, NULL, RESET_WORLD | CACHE_DIRTY}, - {TK_OPTION_CUSTOM, "-selectbackground", "selectBackground", + {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "SelectBackground", DEF_LEGEND_SELECTBACKGROUND, - -1, Tk_Offset(Legend, selInFocusBg), 0, &backgroundObjOption, 0}, + -1, Tk_Offset(Legend, selInFocusBg), 0, NULL, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "SelectBorderWidth", DEF_LEGEND_SELECTBORDERWIDTH, @@ -1841,25 +1841,17 @@ void Blt_DrawLegend(Graph *graphPtr, Drawable drawable) isSelected = EntryIsSelected(legendPtr, elemPtr); if (elemPtr->flags & LABEL_ACTIVE) { Tk_Fill3DRectangle(tkwin, pixmap, legendPtr->activeBg, - x, y, legendPtr->entryWidth, legendPtr->entryHeight, - legendPtr->entryBW, legendPtr->activeRelief); + x, y, legendPtr->entryWidth, legendPtr->entryHeight, + legendPtr->entryBW, legendPtr->activeRelief); } else if (isSelected) { - int xOrigin, yOrigin; - Blt_Background bg; - XColor *fg; - - fg = (legendPtr->flags & FOCUS) ? + XColor* fg = (legendPtr->flags & FOCUS) ? legendPtr->selInFocusFgColor : legendPtr->selOutFocusFgColor; - bg = (legendPtr->flags & FOCUS) ? + Tk_3DBorder bg = (legendPtr->flags & FOCUS) ? legendPtr->selInFocusBg : legendPtr->selOutFocusBg; - Blt_GetBackgroundOrigin(bg, &xOrigin, &yOrigin); - Blt_SetBackgroundOrigin(tkwin, bg, xOrigin - legendPtr->x, - yOrigin - legendPtr->y); Blt_Ts_SetForeground(legendPtr->style, fg); - Blt_FillBackgroundRectangle(tkwin, pixmap, bg, x, y, - legendPtr->entryWidth, legendPtr->entryHeight, - legendPtr->selBW, legendPtr->selRelief); - Blt_SetBackgroundOrigin(tkwin, bg, xOrigin, yOrigin); + Tk_Fill3DRectangle(tkwin, pixmap, bg, x, y, + legendPtr->entryWidth, legendPtr->entryHeight, + legendPtr->selBW, legendPtr->selRelief); } else { Blt_Ts_SetForeground(legendPtr->style, legendPtr->fgColor); if (elemPtr->legendRelief != TK_RELIEF_FLAT) { diff --git a/src/bltGrText.h b/src/bltGrText.h index 3f574ec..ff71ada 100644 --- a/src/bltGrText.h +++ b/src/bltGrText.h @@ -33,8 +33,6 @@ #ifndef _BLT_TEXT_H #define _BLT_TEXT_H -#include "bltBgStyle.h" - #define DEF_TEXT_FLAGS (TK_PARTIAL_OK | TK_IGNORE_NEWLINES) #define UPDATE_GC 1 |