diff --git a/WINGs/ChangeLog b/WINGs/ChangeLog index c3fbd9b6..b92dd7af 100644 --- a/WINGs/ChangeLog +++ b/WINGs/ChangeLog @@ -40,7 +40,10 @@ Changes since wmaker 0.80.1: meant to replaces the obsoleted WMEmphasizeFont(), WMNormalizeFont(), WMStrenghtenFont() and the other similar functions. To get the same effect you pass some predefined structs to it: WFANormal, WFABold, WFAEmphasized, - etc) + etc which are declared in WINGs.h). +- Fixed a bug with empty frame titles (Alexey Voinov ) +- Added WMGetWidgetBackgroundColor() +- Code cleanup in wtext.c Changes since wmaker 0.80.0: diff --git a/WINGs/NEWS b/WINGs/NEWS index b1183ea2..5f1488fa 100644 --- a/WINGs/NEWS +++ b/WINGs/NEWS @@ -218,9 +218,9 @@ WMSendConnectionData() can return 3 values: -1, 0, 1 if the return value is 1, you can continue to send the next message, and so on, until the return value of such a send call will be 0. -In this case you can continue sending, however, the data will not be sent -over the connection because the operating system cannot accept any more data -for the moment. Instead it will be queued inside the library, making your +After it returns 0 you can continue sending, however, the data will not be +sent over the connection because the operating system cannot accept any more +data for the moment. Instead it will be queued inside the library, making your program's memory footprint increase. If the ammount of data you need to send is limited and not too big, this shouldn't be a problem, because your data will be queued and sent when the operating system will notify the diff --git a/WINGs/README b/WINGs/README index 03ebd685..f62edb21 100644 --- a/WINGs/README +++ b/WINGs/README @@ -13,7 +13,7 @@ is inspired in OpenStep and it's implementation borrows some ideas from Tk. It has a reasonable set of widgets, sufficient for building small applications (like a CDPlayer or hacking something like rxvt). It also has other functions that are usefull for applications, like a -User Defaults like configuration manager and a notification system. +User Defaults alike configuration manager and a notification system. The library is limited and it's design is a little sloppy, so it's not intended to build large or complex applications, like diff --git a/WINGs/Tests/wtest.c b/WINGs/Tests/wtest.c index ac0268a8..7f9f56d3 100644 --- a/WINGs/Tests/wtest.c +++ b/WINGs/Tests/wtest.c @@ -104,7 +104,7 @@ testFrame(WMScreen *scr) frame = WMCreateFrame(win); WMMoveWidget(frame, 8+(i%3)*130, 8+(i/3)*130); WMResizeWidget(frame, 120, 120); - WMSetFrameTitle(frame, titles[i]); + WMSetFrameTitle(frame, titles[i]); WMSetFrameTitlePosition(frame, pos[i]); } @@ -604,14 +604,18 @@ testText(WMScreen *scr) WMSetTextHasVerticalScroller(text, True); WMSetTextEditable(text, False); - if (1) { + { WMFont *font, *ifont; font = WMDefaultSystemFont(scr); ifont = WMCopyFontWithChanges(scr, font, WFAEmphasized); - WMSetTextDefaultFont(text, ifont); + if (ifont) { + WMSetTextDefaultFont(text, ifont); + WMReleaseFont(ifont); + } else { + WMSetTextDefaultFont(text, font); + } WMReleaseFont(font); - WMReleaseFont(ifont); } if(file) { diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h index 24b57e2b..70decbbd 100644 --- a/WINGs/WINGs/WINGs.h +++ b/WINGs/WINGs/WINGs.h @@ -7,7 +7,7 @@ #include #include -#define WINGS_H_VERSION 20021008 +#define WINGS_H_VERSION 20021124 #ifdef __cplusplus @@ -463,11 +463,12 @@ typedef struct WMFontAttributes { char *encoding; } WMFontAttributes; +/* A few useful constant font attributes masks */ extern const WMFontAttributes *WFANormal; extern const WMFontAttributes *WFABold; -extern const WMFontAttributes *WFANonBold; +extern const WMFontAttributes *WFANotBold; extern const WMFontAttributes *WFAEmphasized; -extern const WMFontAttributes *WFANonEmphasized; +extern const WMFontAttributes *WFANotEmphasized; extern const WMFontAttributes *WFABoldEmphasized; @@ -908,6 +909,8 @@ void WMResizeWidget(WMWidget *w, unsigned int width, unsigned int height); void WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color); +WMColor* WMGetWidgetBackgroundColor(WMWidget *w); + void WMMapSubwidgets(WMWidget *w); void WMUnmapSubwidgets(WMWidget *w); diff --git a/WINGs/WINGs/WINGsP.h b/WINGs/WINGs/WINGsP.h index 61ef7cbf..a9a70be7 100644 --- a/WINGs/WINGs/WINGsP.h +++ b/WINGs/WINGs/WINGsP.h @@ -8,7 +8,7 @@ #include -#if WINGS_H_VERSION < 20021008 +#if WINGS_H_VERSION < 20021124 #error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it. #endif diff --git a/WINGs/wfont.c b/WINGs/wfont.c index 8a2da659..9d51b579 100644 --- a/WINGs/wfont.c +++ b/WINGs/wfont.c @@ -1061,126 +1061,54 @@ WMCopyFontWithChanges(WMScreen *scrPtr, WMFont *font, +// should WFANormal also set "normal" or leave it alone? static const WMFontAttributes W_FANormal = { - WFAUnchanged, - WFAUnchanged, - "medium,normal,regular", - "r", - "normal", /* not sure about this */ - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged + WFAUnchanged, WFAUnchanged, "medium,normal,regular", "r", "normal", + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged }; static const WMFontAttributes W_FABold = { - WFAUnchanged, - WFAUnchanged, - "bold", - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged + WFAUnchanged, WFAUnchanged, "bold", WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged }; -static const WMFontAttributes W_FANonBold = { - WFAUnchanged, - WFAUnchanged, - "medium,normal,regular", - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged +static const WMFontAttributes W_FANotBold = { + WFAUnchanged, WFAUnchanged, "medium,normal,regular", WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged }; static const WMFontAttributes W_FAEmphasized = { - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - "o,i", - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged + WFAUnchanged, WFAUnchanged, WFAUnchanged, "o,i", + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged }; -static const WMFontAttributes W_FANonEmphasized = { - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - "r", - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged +static const WMFontAttributes W_FANotEmphasized = { + WFAUnchanged, WFAUnchanged, WFAUnchanged, "r", + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged }; static const WMFontAttributes W_FABoldEmphasized = { - WFAUnchanged, - WFAUnchanged, - "bold", - "o,i", - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged, - WFAUnchanged + WFAUnchanged, WFAUnchanged, "bold", "o,i", + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, + WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged }; -// by exposing a ptr to them we can allow one to alter their content -// const doesn't prevent this effectively. -// altering the content doesn't effectively work because it will core dump -// if one tries, but still is not clean. -// however passing the whole struct to the function instead of just the -// pointer means passing a strcut with 14 pointers to char* -// const WMFontAttributes *WFANormal = &W_FANormal; const WMFontAttributes *WFABold = &W_FABold; -const WMFontAttributes *WFANonBold = &W_FANonBold; +const WMFontAttributes *WFANotBold = &W_FANotBold; const WMFontAttributes *WFAEmphasized = &W_FAEmphasized; -const WMFontAttributes *WFANonEmphasized = &W_FANonEmphasized; +const WMFontAttributes *WFANotEmphasized = &W_FANotEmphasized; const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized; diff --git a/WINGs/wframe.c b/WINGs/wframe.c index af3ac63b..8dbf343c 100644 --- a/WINGs/wframe.c +++ b/WINGs/wframe.c @@ -142,7 +142,7 @@ paintFrame(Frame *fPtr) fh = view->size.height; } - if (fPtr->caption!=NULL && fPtr->flags.titlePosition!=WTPNoTitle) { + if (tlen>0 && fPtr->flags.titlePosition!=WTPNoTitle) { tw = WMWidthOfString(font, fPtr->caption, tlen); tx = (view->size.width - tw) / 2; diff --git a/WINGs/widgets.c b/WINGs/widgets.c index 1f88c925..6c9fe137 100644 --- a/WINGs/widgets.c +++ b/WINGs/widgets.c @@ -1067,6 +1067,14 @@ WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color) } +WMColor* +WMGetWidgetBackgroundColor(WMWidget *w) +{ + // shoul retain? + return W_VIEW(w)->backColor; +} + + void WMRaiseWidget(WMWidget *w) { diff --git a/WINGs/wtext.c b/WINGs/wtext.c index 6ed43802..2edd631a 100644 --- a/WINGs/wtext.c +++ b/WINGs/wtext.c @@ -422,7 +422,7 @@ setSelectionProperty(WMText *tPtr, WMFont *font, WMColor *color, int underlined) if (!tb || !tPtr->flags.ownsSelection) return; - if(font && (!color || underlined==-1)) + if (font && (!color || underlined==-1)) isFont = True; while (tb) { @@ -567,9 +567,10 @@ removeSelection(Text *tPtr) tb = tb->next; } return True; -} - -static TextBlock * +} + + +static TextBlock* getFirstNonGraphicBlockFor(TextBlock *tb, short dir) { TextBlock *hold = tb; @@ -3303,31 +3304,37 @@ WMAppendTextStream(WMText *tPtr, char *text) } -char * +char* WMGetTextStream(WMText *tPtr) -{ +{ CHECK_CLASS(tPtr, WC_Text); + return getStream(tPtr, 0, 0); } -char * + +char* WMGetTextSelectedStream(WMText *tPtr) -{ +{ CHECK_CLASS(tPtr, WC_Text); + return getStream(tPtr, 1, 0); } -WMArray * + +WMArray* WMGetTextObjects(WMText *tPtr) { CHECK_CLASS(tPtr, WC_Text); + return getStreamObjects(tPtr, 0); } -WMArray * +WMArray* WMGetTextSelectedObjects(WMText *tPtr) { CHECK_CLASS(tPtr, WC_Text); + return getStreamObjects(tPtr, 1); } @@ -3341,7 +3348,7 @@ WMSetTextDelegate(WMText *tPtr, WMTextDelegate *delegate) } -void * +void* WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, char *description, WMColor *color, unsigned short first, unsigned short extraInfo) @@ -3352,8 +3359,6 @@ WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, return NULL; tb = wmalloc(sizeof(TextBlock)); - if (!tb) - return NULL; tb->text = wstrdup(description); tb->used = strlen(description); @@ -3376,9 +3381,9 @@ WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, return tb; } - -void * + +void* WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p, char *description, WMColor *color, unsigned short first, unsigned short extraInfo) @@ -3389,8 +3394,6 @@ WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p, return NULL; tb = wmalloc(sizeof(TextBlock)); - if (!tb) - return NULL; tb->text = wstrdup(description); tb->used = strlen(description); @@ -3425,8 +3428,6 @@ WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font, WMColor *color return NULL; tb = wmalloc(sizeof(TextBlock)); - if (!tb) - return NULL; tb->allocated = reqBlockSize(len); tb->text = (char *)wmalloc(tb->allocated); @@ -3459,6 +3460,7 @@ WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font, WMColor *color return tb; } + void WMSetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int first, unsigned int kanji, unsigned int underlined, int script, @@ -3474,8 +3476,9 @@ WMSetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int first, tb->script = script; tb->marginN = newMargin(tPtr, margins); } - -void + + +void WMGetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int *first, unsigned int *kanji, unsigned int *underlined, int *script, WMRulerMargins *margins) @@ -3490,15 +3493,14 @@ WMGetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int *first, if (script) *script = tb->script; if (margins) margins = &tPtr->margins[tb->marginN]; } - -void +void WMPrependTextBlock(WMText *tPtr, void *vtb) { TextBlock *tb = (TextBlock *)vtb; - if (!tPtr || !tb) + if (!tb) return; if (tb->graphic) { @@ -3539,14 +3541,14 @@ WMPrependTextBlock(WMText *tPtr, void *vtb) tPtr->currentTextBlock = tb; } - -void + +void WMAppendTextBlock(WMText *tPtr, void *vtb) { TextBlock *tb = (TextBlock *)vtb; - if (!tPtr || !tb) + if (!tb) return; if (tb->graphic) { @@ -3597,8 +3599,8 @@ WMRemoveTextBlock(WMText *tPtr) { TextBlock *tb = NULL; - if (!tPtr || !tPtr->firstTextBlock || !tPtr->lastTextBlock - || !tPtr->currentTextBlock) { + if (!tPtr->firstTextBlock || !tPtr->lastTextBlock || + !tPtr->currentTextBlock) { return NULL; } @@ -3646,7 +3648,7 @@ void WMDestroyTextBlock(WMText *tPtr, void *vtb) { TextBlock *tb = (TextBlock *)vtb; - if (!tPtr || !tb) + if (!tb) return; if (tb->graphic) { @@ -3679,33 +3681,31 @@ WMDestroyTextBlock(WMText *tPtr, void *vtb) void WMSetTextForegroundColor(WMText *tPtr, WMColor *color) { - if (!tPtr) - return; + if (tPtr->fgColor) + WMReleaseColor(tPtr->fgColor); - WMReleaseColor(tPtr->fgColor); tPtr->fgColor = WMRetainColor(color ? color : tPtr->view->screen->black); paintText(tPtr); } + void WMSetTextBackgroundColor(WMText *tPtr, WMColor *color) { - if (!tPtr) - return; + if (tPtr->bgColor) + WMReleaseColor(tPtr->bgColor); - WMReleaseColor(tPtr->bgColor); tPtr->bgColor = WMRetainColor(color ? color : tPtr->view->screen->white); W_SetViewBackgroundColor(tPtr->view, tPtr->bgColor); paintText(tPtr); } -void WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap) -{ - if (!tPtr) - return; +void +WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap) +{ if (tPtr->bgPixmap) WMReleasePixmap(tPtr->bgPixmap); @@ -3715,21 +3715,18 @@ void WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap) tPtr->bgPixmap = NULL; } + void WMSetTextRelief(WMText *tPtr, WMReliefType relief) { - if (!tPtr) - return; tPtr->flags.relief = relief; textDidResize(tPtr->view->delegate, tPtr->view); } + void WMSetTextHasHorizontalScroller(WMText *tPtr, Bool shouldhave) { - if (!tPtr) - return; - if (shouldhave && !tPtr->hS) { tPtr->hS = WMCreateScroller(tPtr); (W_VIEW(tPtr->hS))->attribs.cursor = tPtr->view->screen->defaultCursor; @@ -3752,9 +3749,6 @@ WMSetTextHasHorizontalScroller(WMText *tPtr, Bool shouldhave) void WMSetTextHasRuler(WMText *tPtr, Bool shouldhave) { - if (!tPtr) - return; - if(shouldhave && !tPtr->ruler) { tPtr->ruler = WMCreateRuler(tPtr); (W_VIEW(tPtr->ruler))->attribs.cursor = @@ -3773,8 +3767,6 @@ WMSetTextHasRuler(WMText *tPtr, Bool shouldhave) void WMShowTextRuler(WMText *tPtr, Bool show) { - if(!tPtr) - return; if(!tPtr->ruler) return; @@ -3789,16 +3781,14 @@ WMShowTextRuler(WMText *tPtr, Bool show) } textDidResize(tPtr->view->delegate, tPtr->view); -} +} + Bool WMGetTextRulerShown(WMText *tPtr) { - if(!tPtr) - return 0; - if(!tPtr->ruler) - return 0; + return False; return tPtr->flags.rulerShown; } @@ -3807,9 +3797,6 @@ WMGetTextRulerShown(WMText *tPtr) void WMSetTextHasVerticalScroller(WMText *tPtr, Bool shouldhave) { - if (!tPtr) - return; - if (shouldhave && !tPtr->vS) { tPtr->vS = WMCreateScroller(tPtr); (W_VIEW(tPtr->vS))->attribs.cursor = tPtr->view->screen->defaultCursor; @@ -3828,17 +3815,15 @@ WMSetTextHasVerticalScroller(WMText *tPtr, Bool shouldhave) textDidResize(tPtr->view->delegate, tPtr->view); } - Bool WMScrollText(WMText *tPtr, int amount) { Bool scroll=False; - if (!tPtr) - return False; + if (amount == 0 || !tPtr->view->flags.realized) return False; - + if (amount < 0) { if (tPtr->vpos > 0) { if (tPtr->vpos > abs(amount)) tPtr->vpos += amount; @@ -3860,63 +3845,53 @@ WMScrollText(WMText *tPtr, int amount) } tPtr->prevVpos = tPtr->vpos; return scroll; -} +} -Bool + +Bool WMPageText(WMText *tPtr, Bool direction) { - if (!tPtr) return False; - if (!tPtr->view->flags.realized) return False; + if (!tPtr->view->flags.realized) + return False; return WMScrollText(tPtr, direction?tPtr->visible.h:-tPtr->visible.h); } + void WMSetTextEditable(WMText *tPtr, Bool editable) { - if (!tPtr) - return; tPtr->flags.editable = editable; } - -int + + +int WMGetTextEditable(WMText *tPtr) { - if (!tPtr) - return 0; return tPtr->flags.editable; } void WMSetTextIndentNewLines(WMText *tPtr, Bool indent) { - if (!tPtr) - return; tPtr->flags.indentNewLine = indent; } void WMSetTextIgnoresNewline(WMText *tPtr, Bool ignore) { - if (!tPtr) - return; tPtr->flags.ignoreNewLine = ignore; } Bool WMGetTextIgnoresNewline(WMText *tPtr) { - if (!tPtr) - return True; return tPtr->flags.ignoreNewLine; } void WMSetTextUsesMonoFont(WMText *tPtr, Bool mono) { - if (!tPtr) - return; - if (mono) { if(tPtr->flags.rulerShown) WMShowTextRuler(tPtr, False); @@ -3931,8 +3906,6 @@ WMSetTextUsesMonoFont(WMText *tPtr, Bool mono) Bool WMGetTextUsesMonoFont(WMText *tPtr) { - if (!tPtr) - return True; return tPtr->flags.monoFont; } @@ -3940,52 +3913,48 @@ WMGetTextUsesMonoFont(WMText *tPtr) void WMSetTextDefaultFont(WMText *tPtr, WMFont *font) { - if (!tPtr) - return; - - WMReleaseFont(tPtr->dFont); - if (font) + if (tPtr->dFont) + WMReleaseFont(tPtr->dFont); + + if (font) { tPtr->dFont = WMRetainFont(font); - else - tPtr->dFont = WMRetainFont(WMSystemFontOfSize(tPtr->view->screen, 12)); + } else { + tPtr->dFont = WMSystemFontOfSize(tPtr->view->screen, 12); + } } -WMFont * + +WMFont* WMGetTextDefaultFont(WMText *tPtr) { - if (!tPtr) - return NULL; - else - return WMRetainFont(tPtr->dFont); + return WMRetainFont(tPtr->dFont); } + void WMSetTextDefaultColor(WMText *tPtr, WMColor *color) { - if (!tPtr) - return; - - WMReleaseColor(tPtr->dColor); - if (color) + if (tPtr->dColor) + WMReleaseColor(tPtr->dColor); + + if (color) { tPtr->dColor = WMRetainColor(color); - else + } else { tPtr->dColor = WMBlackColor(tPtr->view->screen); + } } -WMColor * + +WMColor* WMGetTextDefaultColor(WMText *tPtr) { - if (!tPtr) - return NULL; - else - return WMRetainColor(tPtr->dColor); + return WMRetainColor(tPtr->dColor); } + void WMSetTextAlignment(WMText *tPtr, WMAlignment alignment) { - if (!tPtr) - return; if(tPtr->flags.monoFont) tPtr->flags.alignment = WALeft; else @@ -3993,32 +3962,26 @@ WMSetTextAlignment(WMText *tPtr, WMAlignment alignment) WMThawText(tPtr); } -int + +int WMGetTextInsertType(WMText *tPtr) { - if (!tPtr) - return 0; return tPtr->flags.prepend; } - + void WMSetTextSelectionColor(WMText *tPtr, WMColor *color) { - if (!tPtr || !color) - return; - setSelectionProperty(tPtr, NULL, color, -1); } -WMColor * + +WMColor* WMGetTextSelectionColor(WMText *tPtr) { TextBlock *tb; - if (!tPtr) - return NULL; - tb = tPtr->currentTextBlock; if (!tb || !tPtr->flags.ownsSelection) @@ -4030,24 +3993,19 @@ WMGetTextSelectionColor(WMText *tPtr) return tb->color; } - -void + +void WMSetTextSelectionFont(WMText *tPtr, WMFont *font) { - if (!tPtr || !font) - return; - setSelectionProperty(tPtr, font, NULL, -1) ; } -WMFont * + +WMFont* WMGetTextSelectionFont(WMText *tPtr) { TextBlock *tb; - if (!tPtr) - return NULL; - tb = tPtr->currentTextBlock; if (!tb || !tPtr->flags.ownsSelection) @@ -4064,25 +4022,23 @@ WMGetTextSelectionFont(WMText *tPtr) return (tb->selected ? tb->d.font : NULL); } - -void + +void WMSetTextSelectionUnderlined(WMText *tPtr, int underlined) { - if (!tPtr || (underlined!=0 && underlined !=1)) + // check this + if (underlined!=0 && underlined!=1) return; - + setSelectionProperty(tPtr, NULL, NULL, underlined); } -int +int WMGetTextSelectionUnderlined(WMText *tPtr) { TextBlock *tb; - if (!tPtr) - return 0; - tb = tPtr->currentTextBlock; if (!tb || !tPtr->flags.ownsSelection) @@ -4098,9 +4054,6 @@ WMGetTextSelectionUnderlined(WMText *tPtr) void WMFreezeText(WMText *tPtr) { - if (!tPtr) - return; - tPtr->flags.frozen = True; } @@ -4108,9 +4061,6 @@ WMFreezeText(WMText *tPtr) void WMThawText(WMText *tPtr) { - if (!tPtr) - return; - tPtr->flags.frozen = False; if(tPtr->flags.monoFont) { @@ -4186,16 +4136,14 @@ mystrrstr(char *haystack, char *needle, unsigned short len, char *end, } -Bool -WMFindInTextStream(WMText *tPtr, char *needle, Bool direction, - Bool caseSensitive) +Bool +WMFindInTextStream(WMText *tPtr, char *needle, Bool direction, + Bool caseSensitive) { TextBlock *tb; char *mark=NULL; unsigned short pos; - if (!tPtr || !needle) - return False; #if 0 if (! (tb = tPtr->currentTextBlock)) { @@ -4280,9 +4228,6 @@ WMFindInTextStream(WMText *tPtr, char *needle, Bool direction, Bool WMReplaceTextSelection(WMText *tPtr, char *replacement) { - if (!tPtr) - return False; - if (!tPtr->flags.ownsSelection) return False;