mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58:08 +01:00
- Fixed a bug with empty frame titles (Alexey Voinov <voins@voins.program.ru>)
- Added WMGetWidgetBackgroundColor() - Code cleanup in wtext.c - Renamed WFANonBold and WFANonEmphasized to WFANotBold and WFANotEmphasized
This commit is contained in:
@@ -40,7 +40,10 @@ Changes since wmaker 0.80.1:
|
|||||||
meant to replaces the obsoleted WMEmphasizeFont(), WMNormalizeFont(),
|
meant to replaces the obsoleted WMEmphasizeFont(), WMNormalizeFont(),
|
||||||
WMStrenghtenFont() and the other similar functions. To get the same effect
|
WMStrenghtenFont() and the other similar functions. To get the same effect
|
||||||
you pass some predefined structs to it: WFANormal, WFABold, WFAEmphasized,
|
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 <voins@voins.program.ru>)
|
||||||
|
- Added WMGetWidgetBackgroundColor()
|
||||||
|
- Code cleanup in wtext.c
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.80.0:
|
Changes since wmaker 0.80.0:
|
||||||
|
|||||||
@@ -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
|
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.
|
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
|
After it returns 0 you can continue sending, however, the data will not be
|
||||||
over the connection because the operating system cannot accept any more data
|
sent over the connection because the operating system cannot accept any more
|
||||||
for the moment. Instead it will be queued inside the library, making your
|
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
|
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
|
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
|
data will be queued and sent when the operating system will notify the
|
||||||
|
|||||||
@@ -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
|
from Tk. It has a reasonable set of widgets, sufficient for building
|
||||||
small applications (like a CDPlayer or hacking something like rxvt). It
|
small applications (like a CDPlayer or hacking something like rxvt). It
|
||||||
also has other functions that are usefull for applications, like a
|
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,
|
The library is limited and it's design is a little sloppy,
|
||||||
so it's not intended to build large or complex applications, like
|
so it's not intended to build large or complex applications, like
|
||||||
|
|||||||
@@ -604,14 +604,18 @@ testText(WMScreen *scr)
|
|||||||
WMSetTextHasVerticalScroller(text, True);
|
WMSetTextHasVerticalScroller(text, True);
|
||||||
WMSetTextEditable(text, False);
|
WMSetTextEditable(text, False);
|
||||||
|
|
||||||
if (1) {
|
{
|
||||||
WMFont *font, *ifont;
|
WMFont *font, *ifont;
|
||||||
|
|
||||||
font = WMDefaultSystemFont(scr);
|
font = WMDefaultSystemFont(scr);
|
||||||
ifont = WMCopyFontWithChanges(scr, font, WFAEmphasized);
|
ifont = WMCopyFontWithChanges(scr, font, WFAEmphasized);
|
||||||
|
if (ifont) {
|
||||||
WMSetTextDefaultFont(text, ifont);
|
WMSetTextDefaultFont(text, ifont);
|
||||||
WMReleaseFont(font);
|
|
||||||
WMReleaseFont(ifont);
|
WMReleaseFont(ifont);
|
||||||
|
} else {
|
||||||
|
WMSetTextDefaultFont(text, font);
|
||||||
|
}
|
||||||
|
WMReleaseFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file) {
|
if(file) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#define WINGS_H_VERSION 20021008
|
#define WINGS_H_VERSION 20021124
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -463,11 +463,12 @@ typedef struct WMFontAttributes {
|
|||||||
char *encoding;
|
char *encoding;
|
||||||
} WMFontAttributes;
|
} WMFontAttributes;
|
||||||
|
|
||||||
|
/* A few useful constant font attributes masks */
|
||||||
extern const WMFontAttributes *WFANormal;
|
extern const WMFontAttributes *WFANormal;
|
||||||
extern const WMFontAttributes *WFABold;
|
extern const WMFontAttributes *WFABold;
|
||||||
extern const WMFontAttributes *WFANonBold;
|
extern const WMFontAttributes *WFANotBold;
|
||||||
extern const WMFontAttributes *WFAEmphasized;
|
extern const WMFontAttributes *WFAEmphasized;
|
||||||
extern const WMFontAttributes *WFANonEmphasized;
|
extern const WMFontAttributes *WFANotEmphasized;
|
||||||
extern const WMFontAttributes *WFABoldEmphasized;
|
extern const WMFontAttributes *WFABoldEmphasized;
|
||||||
|
|
||||||
|
|
||||||
@@ -908,6 +909,8 @@ void WMResizeWidget(WMWidget *w, unsigned int width, unsigned int height);
|
|||||||
|
|
||||||
void WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color);
|
void WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color);
|
||||||
|
|
||||||
|
WMColor* WMGetWidgetBackgroundColor(WMWidget *w);
|
||||||
|
|
||||||
void WMMapSubwidgets(WMWidget *w);
|
void WMMapSubwidgets(WMWidget *w);
|
||||||
|
|
||||||
void WMUnmapSubwidgets(WMWidget *w);
|
void WMUnmapSubwidgets(WMWidget *w);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGs.h>
|
||||||
|
|
||||||
#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.
|
#error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
118
WINGs/wfont.c
118
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 = {
|
static const WMFontAttributes W_FANormal = {
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, "medium,normal,regular", "r", "normal",
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
||||||
"medium,normal,regular",
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
||||||
"r",
|
|
||||||
"normal", /* not sure about this */
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FABold = {
|
static const WMFontAttributes W_FABold = {
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, "bold", WFAUnchanged,
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
||||||
"bold",
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FANonBold = {
|
static const WMFontAttributes W_FANotBold = {
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, "medium,normal,regular", WFAUnchanged,
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
||||||
"medium,normal,regular",
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FAEmphasized = {
|
static const WMFontAttributes W_FAEmphasized = {
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, "o,i",
|
||||||
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 = {
|
static const WMFontAttributes W_FANotEmphasized = {
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, "r",
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
||||||
"r",
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged,
|
|
||||||
WFAUnchanged
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const WMFontAttributes W_FABoldEmphasized = {
|
static const WMFontAttributes W_FABoldEmphasized = {
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, "bold", "o,i",
|
||||||
WFAUnchanged,
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged,
|
||||||
"bold",
|
WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged, WFAUnchanged
|
||||||
"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 *WFANormal = &W_FANormal;
|
||||||
const WMFontAttributes *WFABold = &W_FABold;
|
const WMFontAttributes *WFABold = &W_FABold;
|
||||||
const WMFontAttributes *WFANonBold = &W_FANonBold;
|
const WMFontAttributes *WFANotBold = &W_FANotBold;
|
||||||
const WMFontAttributes *WFAEmphasized = &W_FAEmphasized;
|
const WMFontAttributes *WFAEmphasized = &W_FAEmphasized;
|
||||||
const WMFontAttributes *WFANonEmphasized = &W_FANonEmphasized;
|
const WMFontAttributes *WFANotEmphasized = &W_FANotEmphasized;
|
||||||
const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized;
|
const WMFontAttributes *WFABoldEmphasized = &W_FABoldEmphasized;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ paintFrame(Frame *fPtr)
|
|||||||
fh = view->size.height;
|
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);
|
tw = WMWidthOfString(font, fPtr->caption, tlen);
|
||||||
|
|
||||||
tx = (view->size.width - tw) / 2;
|
tx = (view->size.width - tw) / 2;
|
||||||
|
|||||||
@@ -1067,6 +1067,14 @@ WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WMColor*
|
||||||
|
WMGetWidgetBackgroundColor(WMWidget *w)
|
||||||
|
{
|
||||||
|
// shoul retain?
|
||||||
|
return W_VIEW(w)->backColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMRaiseWidget(WMWidget *w)
|
WMRaiseWidget(WMWidget *w)
|
||||||
{
|
{
|
||||||
|
|||||||
159
WINGs/wtext.c
159
WINGs/wtext.c
@@ -569,6 +569,7 @@ removeSelection(Text *tPtr)
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TextBlock*
|
static TextBlock*
|
||||||
getFirstNonGraphicBlockFor(TextBlock *tb, short dir)
|
getFirstNonGraphicBlockFor(TextBlock *tb, short dir)
|
||||||
{
|
{
|
||||||
@@ -3307,20 +3308,25 @@ char *
|
|||||||
WMGetTextStream(WMText *tPtr)
|
WMGetTextStream(WMText *tPtr)
|
||||||
{
|
{
|
||||||
CHECK_CLASS(tPtr, WC_Text);
|
CHECK_CLASS(tPtr, WC_Text);
|
||||||
|
|
||||||
return getStream(tPtr, 0, 0);
|
return getStream(tPtr, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
WMGetTextSelectedStream(WMText *tPtr)
|
WMGetTextSelectedStream(WMText *tPtr)
|
||||||
{
|
{
|
||||||
CHECK_CLASS(tPtr, WC_Text);
|
CHECK_CLASS(tPtr, WC_Text);
|
||||||
|
|
||||||
return getStream(tPtr, 1, 0);
|
return getStream(tPtr, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WMArray*
|
WMArray*
|
||||||
WMGetTextObjects(WMText *tPtr)
|
WMGetTextObjects(WMText *tPtr)
|
||||||
{
|
{
|
||||||
CHECK_CLASS(tPtr, WC_Text);
|
CHECK_CLASS(tPtr, WC_Text);
|
||||||
|
|
||||||
return getStreamObjects(tPtr, 0);
|
return getStreamObjects(tPtr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3328,6 +3334,7 @@ WMArray *
|
|||||||
WMGetTextSelectedObjects(WMText *tPtr)
|
WMGetTextSelectedObjects(WMText *tPtr)
|
||||||
{
|
{
|
||||||
CHECK_CLASS(tPtr, WC_Text);
|
CHECK_CLASS(tPtr, WC_Text);
|
||||||
|
|
||||||
return getStreamObjects(tPtr, 1);
|
return getStreamObjects(tPtr, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3352,8 +3359,6 @@ WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
tb = wmalloc(sizeof(TextBlock));
|
tb = wmalloc(sizeof(TextBlock));
|
||||||
if (!tb)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tb->text = wstrdup(description);
|
tb->text = wstrdup(description);
|
||||||
tb->used = strlen(description);
|
tb->used = strlen(description);
|
||||||
@@ -3389,8 +3394,6 @@ WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
tb = wmalloc(sizeof(TextBlock));
|
tb = wmalloc(sizeof(TextBlock));
|
||||||
if (!tb)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tb->text = wstrdup(description);
|
tb->text = wstrdup(description);
|
||||||
tb->used = strlen(description);
|
tb->used = strlen(description);
|
||||||
@@ -3425,8 +3428,6 @@ WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font, WMColor *color
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
tb = wmalloc(sizeof(TextBlock));
|
tb = wmalloc(sizeof(TextBlock));
|
||||||
if (!tb)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tb->allocated = reqBlockSize(len);
|
tb->allocated = reqBlockSize(len);
|
||||||
tb->text = (char *)wmalloc(tb->allocated);
|
tb->text = (char *)wmalloc(tb->allocated);
|
||||||
@@ -3459,6 +3460,7 @@ WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font, WMColor *color
|
|||||||
return tb;
|
return tb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int first,
|
WMSetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int first,
|
||||||
unsigned int kanji, unsigned int underlined, int script,
|
unsigned int kanji, unsigned int underlined, int script,
|
||||||
@@ -3475,6 +3477,7 @@ WMSetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int first,
|
|||||||
tb->marginN = newMargin(tPtr, margins);
|
tb->marginN = newMargin(tPtr, margins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMGetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int *first,
|
WMGetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int *first,
|
||||||
unsigned int *kanji, unsigned int *underlined, int *script,
|
unsigned int *kanji, unsigned int *underlined, int *script,
|
||||||
@@ -3492,13 +3495,12 @@ WMGetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int *first,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMPrependTextBlock(WMText *tPtr, void *vtb)
|
WMPrependTextBlock(WMText *tPtr, void *vtb)
|
||||||
{
|
{
|
||||||
TextBlock *tb = (TextBlock *)vtb;
|
TextBlock *tb = (TextBlock *)vtb;
|
||||||
|
|
||||||
if (!tPtr || !tb)
|
if (!tb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tb->graphic) {
|
if (tb->graphic) {
|
||||||
@@ -3546,7 +3548,7 @@ WMAppendTextBlock(WMText *tPtr, void *vtb)
|
|||||||
{
|
{
|
||||||
TextBlock *tb = (TextBlock *)vtb;
|
TextBlock *tb = (TextBlock *)vtb;
|
||||||
|
|
||||||
if (!tPtr || !tb)
|
if (!tb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tb->graphic) {
|
if (tb->graphic) {
|
||||||
@@ -3597,8 +3599,8 @@ WMRemoveTextBlock(WMText *tPtr)
|
|||||||
{
|
{
|
||||||
TextBlock *tb = NULL;
|
TextBlock *tb = NULL;
|
||||||
|
|
||||||
if (!tPtr || !tPtr->firstTextBlock || !tPtr->lastTextBlock
|
if (!tPtr->firstTextBlock || !tPtr->lastTextBlock ||
|
||||||
|| !tPtr->currentTextBlock) {
|
!tPtr->currentTextBlock) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3646,7 +3648,7 @@ void
|
|||||||
WMDestroyTextBlock(WMText *tPtr, void *vtb)
|
WMDestroyTextBlock(WMText *tPtr, void *vtb)
|
||||||
{
|
{
|
||||||
TextBlock *tb = (TextBlock *)vtb;
|
TextBlock *tb = (TextBlock *)vtb;
|
||||||
if (!tPtr || !tb)
|
if (!tb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tb->graphic) {
|
if (tb->graphic) {
|
||||||
@@ -3679,33 +3681,31 @@ WMDestroyTextBlock(WMText *tPtr, void *vtb)
|
|||||||
void
|
void
|
||||||
WMSetTextForegroundColor(WMText *tPtr, WMColor *color)
|
WMSetTextForegroundColor(WMText *tPtr, WMColor *color)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
if (tPtr->fgColor)
|
||||||
return;
|
|
||||||
|
|
||||||
WMReleaseColor(tPtr->fgColor);
|
WMReleaseColor(tPtr->fgColor);
|
||||||
|
|
||||||
tPtr->fgColor = WMRetainColor(color ? color : tPtr->view->screen->black);
|
tPtr->fgColor = WMRetainColor(color ? color : tPtr->view->screen->black);
|
||||||
|
|
||||||
paintText(tPtr);
|
paintText(tPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextBackgroundColor(WMText *tPtr, WMColor *color)
|
WMSetTextBackgroundColor(WMText *tPtr, WMColor *color)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
if (tPtr->bgColor)
|
||||||
return;
|
|
||||||
|
|
||||||
WMReleaseColor(tPtr->bgColor);
|
WMReleaseColor(tPtr->bgColor);
|
||||||
|
|
||||||
tPtr->bgColor = WMRetainColor(color ? color : tPtr->view->screen->white);
|
tPtr->bgColor = WMRetainColor(color ? color : tPtr->view->screen->white);
|
||||||
W_SetViewBackgroundColor(tPtr->view, tPtr->bgColor);
|
W_SetViewBackgroundColor(tPtr->view, tPtr->bgColor);
|
||||||
|
|
||||||
paintText(tPtr);
|
paintText(tPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap)
|
|
||||||
{
|
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap)
|
||||||
|
{
|
||||||
if (tPtr->bgPixmap)
|
if (tPtr->bgPixmap)
|
||||||
WMReleasePixmap(tPtr->bgPixmap);
|
WMReleasePixmap(tPtr->bgPixmap);
|
||||||
|
|
||||||
@@ -3715,21 +3715,18 @@ void WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap)
|
|||||||
tPtr->bgPixmap = NULL;
|
tPtr->bgPixmap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextRelief(WMText *tPtr, WMReliefType relief)
|
WMSetTextRelief(WMText *tPtr, WMReliefType relief)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
tPtr->flags.relief = relief;
|
tPtr->flags.relief = relief;
|
||||||
textDidResize(tPtr->view->delegate, tPtr->view);
|
textDidResize(tPtr->view->delegate, tPtr->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextHasHorizontalScroller(WMText *tPtr, Bool shouldhave)
|
WMSetTextHasHorizontalScroller(WMText *tPtr, Bool shouldhave)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (shouldhave && !tPtr->hS) {
|
if (shouldhave && !tPtr->hS) {
|
||||||
tPtr->hS = WMCreateScroller(tPtr);
|
tPtr->hS = WMCreateScroller(tPtr);
|
||||||
(W_VIEW(tPtr->hS))->attribs.cursor = tPtr->view->screen->defaultCursor;
|
(W_VIEW(tPtr->hS))->attribs.cursor = tPtr->view->screen->defaultCursor;
|
||||||
@@ -3752,9 +3749,6 @@ WMSetTextHasHorizontalScroller(WMText *tPtr, Bool shouldhave)
|
|||||||
void
|
void
|
||||||
WMSetTextHasRuler(WMText *tPtr, Bool shouldhave)
|
WMSetTextHasRuler(WMText *tPtr, Bool shouldhave)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(shouldhave && !tPtr->ruler) {
|
if(shouldhave && !tPtr->ruler) {
|
||||||
tPtr->ruler = WMCreateRuler(tPtr);
|
tPtr->ruler = WMCreateRuler(tPtr);
|
||||||
(W_VIEW(tPtr->ruler))->attribs.cursor =
|
(W_VIEW(tPtr->ruler))->attribs.cursor =
|
||||||
@@ -3773,8 +3767,6 @@ WMSetTextHasRuler(WMText *tPtr, Bool shouldhave)
|
|||||||
void
|
void
|
||||||
WMShowTextRuler(WMText *tPtr, Bool show)
|
WMShowTextRuler(WMText *tPtr, Bool show)
|
||||||
{
|
{
|
||||||
if(!tPtr)
|
|
||||||
return;
|
|
||||||
if(!tPtr->ruler)
|
if(!tPtr->ruler)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -3791,14 +3783,12 @@ WMShowTextRuler(WMText *tPtr, Bool show)
|
|||||||
textDidResize(tPtr->view->delegate, tPtr->view);
|
textDidResize(tPtr->view->delegate, tPtr->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
WMGetTextRulerShown(WMText *tPtr)
|
WMGetTextRulerShown(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if(!tPtr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(!tPtr->ruler)
|
if(!tPtr->ruler)
|
||||||
return 0;
|
return False;
|
||||||
|
|
||||||
return tPtr->flags.rulerShown;
|
return tPtr->flags.rulerShown;
|
||||||
}
|
}
|
||||||
@@ -3807,9 +3797,6 @@ WMGetTextRulerShown(WMText *tPtr)
|
|||||||
void
|
void
|
||||||
WMSetTextHasVerticalScroller(WMText *tPtr, Bool shouldhave)
|
WMSetTextHasVerticalScroller(WMText *tPtr, Bool shouldhave)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (shouldhave && !tPtr->vS) {
|
if (shouldhave && !tPtr->vS) {
|
||||||
tPtr->vS = WMCreateScroller(tPtr);
|
tPtr->vS = WMCreateScroller(tPtr);
|
||||||
(W_VIEW(tPtr->vS))->attribs.cursor = tPtr->view->screen->defaultCursor;
|
(W_VIEW(tPtr->vS))->attribs.cursor = tPtr->view->screen->defaultCursor;
|
||||||
@@ -3829,13 +3816,11 @@ WMSetTextHasVerticalScroller(WMText *tPtr, Bool shouldhave)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
WMScrollText(WMText *tPtr, int amount)
|
WMScrollText(WMText *tPtr, int amount)
|
||||||
{
|
{
|
||||||
Bool scroll=False;
|
Bool scroll=False;
|
||||||
if (!tPtr)
|
|
||||||
return False;
|
|
||||||
if (amount == 0 || !tPtr->view->flags.realized)
|
if (amount == 0 || !tPtr->view->flags.realized)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
@@ -3862,61 +3847,51 @@ WMScrollText(WMText *tPtr, int amount)
|
|||||||
return scroll;
|
return scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
WMPageText(WMText *tPtr, Bool direction)
|
WMPageText(WMText *tPtr, Bool direction)
|
||||||
{
|
{
|
||||||
if (!tPtr) return False;
|
if (!tPtr->view->flags.realized)
|
||||||
if (!tPtr->view->flags.realized) return False;
|
return False;
|
||||||
|
|
||||||
return WMScrollText(tPtr, direction?tPtr->visible.h:-tPtr->visible.h);
|
return WMScrollText(tPtr, direction?tPtr->visible.h:-tPtr->visible.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextEditable(WMText *tPtr, Bool editable)
|
WMSetTextEditable(WMText *tPtr, Bool editable)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
tPtr->flags.editable = editable;
|
tPtr->flags.editable = editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WMGetTextEditable(WMText *tPtr)
|
WMGetTextEditable(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return 0;
|
|
||||||
return tPtr->flags.editable;
|
return tPtr->flags.editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextIndentNewLines(WMText *tPtr, Bool indent)
|
WMSetTextIndentNewLines(WMText *tPtr, Bool indent)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
tPtr->flags.indentNewLine = indent;
|
tPtr->flags.indentNewLine = indent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextIgnoresNewline(WMText *tPtr, Bool ignore)
|
WMSetTextIgnoresNewline(WMText *tPtr, Bool ignore)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
tPtr->flags.ignoreNewLine = ignore;
|
tPtr->flags.ignoreNewLine = ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
WMGetTextIgnoresNewline(WMText *tPtr)
|
WMGetTextIgnoresNewline(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return True;
|
|
||||||
return tPtr->flags.ignoreNewLine;
|
return tPtr->flags.ignoreNewLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextUsesMonoFont(WMText *tPtr, Bool mono)
|
WMSetTextUsesMonoFont(WMText *tPtr, Bool mono)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (mono) {
|
if (mono) {
|
||||||
if(tPtr->flags.rulerShown)
|
if(tPtr->flags.rulerShown)
|
||||||
WMShowTextRuler(tPtr, False);
|
WMShowTextRuler(tPtr, False);
|
||||||
@@ -3931,8 +3906,6 @@ WMSetTextUsesMonoFont(WMText *tPtr, Bool mono)
|
|||||||
Bool
|
Bool
|
||||||
WMGetTextUsesMonoFont(WMText *tPtr)
|
WMGetTextUsesMonoFont(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return True;
|
|
||||||
return tPtr->flags.monoFont;
|
return tPtr->flags.monoFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3940,52 +3913,48 @@ WMGetTextUsesMonoFont(WMText *tPtr)
|
|||||||
void
|
void
|
||||||
WMSetTextDefaultFont(WMText *tPtr, WMFont *font)
|
WMSetTextDefaultFont(WMText *tPtr, WMFont *font)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
if (tPtr->dFont)
|
||||||
return;
|
|
||||||
|
|
||||||
WMReleaseFont(tPtr->dFont);
|
WMReleaseFont(tPtr->dFont);
|
||||||
if (font)
|
|
||||||
|
if (font) {
|
||||||
tPtr->dFont = WMRetainFont(font);
|
tPtr->dFont = WMRetainFont(font);
|
||||||
else
|
} else {
|
||||||
tPtr->dFont = WMRetainFont(WMSystemFontOfSize(tPtr->view->screen, 12));
|
tPtr->dFont = WMSystemFontOfSize(tPtr->view->screen, 12);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
WMFont*
|
||||||
WMGetTextDefaultFont(WMText *tPtr)
|
WMGetTextDefaultFont(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return WMRetainFont(tPtr->dFont);
|
return WMRetainFont(tPtr->dFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextDefaultColor(WMText *tPtr, WMColor *color)
|
WMSetTextDefaultColor(WMText *tPtr, WMColor *color)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
if (tPtr->dColor)
|
||||||
return;
|
|
||||||
|
|
||||||
WMReleaseColor(tPtr->dColor);
|
WMReleaseColor(tPtr->dColor);
|
||||||
if (color)
|
|
||||||
|
if (color) {
|
||||||
tPtr->dColor = WMRetainColor(color);
|
tPtr->dColor = WMRetainColor(color);
|
||||||
else
|
} else {
|
||||||
tPtr->dColor = WMBlackColor(tPtr->view->screen);
|
tPtr->dColor = WMBlackColor(tPtr->view->screen);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WMColor*
|
WMColor*
|
||||||
WMGetTextDefaultColor(WMText *tPtr)
|
WMGetTextDefaultColor(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return WMRetainColor(tPtr->dColor);
|
return WMRetainColor(tPtr->dColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetTextAlignment(WMText *tPtr, WMAlignment alignment)
|
WMSetTextAlignment(WMText *tPtr, WMAlignment alignment)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
if(tPtr->flags.monoFont)
|
if(tPtr->flags.monoFont)
|
||||||
tPtr->flags.alignment = WALeft;
|
tPtr->flags.alignment = WALeft;
|
||||||
else
|
else
|
||||||
@@ -3993,11 +3962,10 @@ WMSetTextAlignment(WMText *tPtr, WMAlignment alignment)
|
|||||||
WMThawText(tPtr);
|
WMThawText(tPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WMGetTextInsertType(WMText *tPtr)
|
WMGetTextInsertType(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return 0;
|
|
||||||
return tPtr->flags.prepend;
|
return tPtr->flags.prepend;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4005,20 +3973,15 @@ WMGetTextInsertType(WMText *tPtr)
|
|||||||
void
|
void
|
||||||
WMSetTextSelectionColor(WMText *tPtr, WMColor *color)
|
WMSetTextSelectionColor(WMText *tPtr, WMColor *color)
|
||||||
{
|
{
|
||||||
if (!tPtr || !color)
|
|
||||||
return;
|
|
||||||
|
|
||||||
setSelectionProperty(tPtr, NULL, color, -1);
|
setSelectionProperty(tPtr, NULL, color, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WMColor*
|
WMColor*
|
||||||
WMGetTextSelectionColor(WMText *tPtr)
|
WMGetTextSelectionColor(WMText *tPtr)
|
||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
|
|
||||||
if (!tPtr)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tb = tPtr->currentTextBlock;
|
tb = tPtr->currentTextBlock;
|
||||||
|
|
||||||
if (!tb || !tPtr->flags.ownsSelection)
|
if (!tb || !tPtr->flags.ownsSelection)
|
||||||
@@ -4034,20 +3997,15 @@ WMGetTextSelectionColor(WMText *tPtr)
|
|||||||
void
|
void
|
||||||
WMSetTextSelectionFont(WMText *tPtr, WMFont *font)
|
WMSetTextSelectionFont(WMText *tPtr, WMFont *font)
|
||||||
{
|
{
|
||||||
if (!tPtr || !font)
|
|
||||||
return;
|
|
||||||
|
|
||||||
setSelectionProperty(tPtr, font, NULL, -1) ;
|
setSelectionProperty(tPtr, font, NULL, -1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WMFont*
|
WMFont*
|
||||||
WMGetTextSelectionFont(WMText *tPtr)
|
WMGetTextSelectionFont(WMText *tPtr)
|
||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
|
|
||||||
if (!tPtr)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tb = tPtr->currentTextBlock;
|
tb = tPtr->currentTextBlock;
|
||||||
|
|
||||||
if (!tb || !tPtr->flags.ownsSelection)
|
if (!tb || !tPtr->flags.ownsSelection)
|
||||||
@@ -4068,7 +4026,8 @@ WMGetTextSelectionFont(WMText *tPtr)
|
|||||||
void
|
void
|
||||||
WMSetTextSelectionUnderlined(WMText *tPtr, int underlined)
|
WMSetTextSelectionUnderlined(WMText *tPtr, int underlined)
|
||||||
{
|
{
|
||||||
if (!tPtr || (underlined!=0 && underlined !=1))
|
// check this
|
||||||
|
if (underlined!=0 && underlined!=1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setSelectionProperty(tPtr, NULL, NULL, underlined);
|
setSelectionProperty(tPtr, NULL, NULL, underlined);
|
||||||
@@ -4080,9 +4039,6 @@ WMGetTextSelectionUnderlined(WMText *tPtr)
|
|||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
|
|
||||||
if (!tPtr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
tb = tPtr->currentTextBlock;
|
tb = tPtr->currentTextBlock;
|
||||||
|
|
||||||
if (!tb || !tPtr->flags.ownsSelection)
|
if (!tb || !tPtr->flags.ownsSelection)
|
||||||
@@ -4098,9 +4054,6 @@ WMGetTextSelectionUnderlined(WMText *tPtr)
|
|||||||
void
|
void
|
||||||
WMFreezeText(WMText *tPtr)
|
WMFreezeText(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tPtr->flags.frozen = True;
|
tPtr->flags.frozen = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4108,9 +4061,6 @@ WMFreezeText(WMText *tPtr)
|
|||||||
void
|
void
|
||||||
WMThawText(WMText *tPtr)
|
WMThawText(WMText *tPtr)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tPtr->flags.frozen = False;
|
tPtr->flags.frozen = False;
|
||||||
|
|
||||||
if(tPtr->flags.monoFont) {
|
if(tPtr->flags.monoFont) {
|
||||||
@@ -4194,8 +4144,6 @@ WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
|||||||
char *mark=NULL;
|
char *mark=NULL;
|
||||||
unsigned short pos;
|
unsigned short pos;
|
||||||
|
|
||||||
if (!tPtr || !needle)
|
|
||||||
return False;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (! (tb = tPtr->currentTextBlock)) {
|
if (! (tb = tPtr->currentTextBlock)) {
|
||||||
@@ -4280,9 +4228,6 @@ WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
|||||||
Bool
|
Bool
|
||||||
WMReplaceTextSelection(WMText *tPtr, char *replacement)
|
WMReplaceTextSelection(WMText *tPtr, char *replacement)
|
||||||
{
|
{
|
||||||
if (!tPtr)
|
|
||||||
return False;
|
|
||||||
|
|
||||||
if (!tPtr->flags.ownsSelection)
|
if (!tPtr->flags.ownsSelection)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user