1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 06:38:05 +01:00

commiting WINGs.h

This commit is contained in:
nwanua
2000-07-21 15:29:51 +00:00
parent 70f8f029b1
commit c79c8aa74d
3 changed files with 40 additions and 34 deletions

View File

@@ -1391,8 +1391,6 @@ int WMGetSplitViewDividerThickness(WMSplitView *sPtr);
WMRuler *WMCreateRuler (WMWidget *parent);
void WMShowRulerTabs(WMRuler *rPtr, Bool Show);
WMRulerMargins WMGetRulerMargins(WMRuler *rPtr);
void WMSetRulerMargins(WMRuler *rPtr, WMRulerMargins margins);
@@ -1419,9 +1417,9 @@ void WMFreezeText(WMText *tPtr);
void WMThawText(WMText *tPtr);
Bool WMScrollText(WMText *tPtr, int amount);
int WMScrollText(WMText *tPtr, int amount);
Bool WMPageText(WMText *tPtr, Bool direction);
int WMPageText(WMText *tPtr, Bool direction);
void WMSetTextHasHorizontalScroller(WMText *tPtr, Bool shouldhave);
@@ -1431,6 +1429,8 @@ void WMSetTextHasRuler(WMText *tPtr, Bool shouldhave);
void WMShowTextRuler(WMText *tPtr, Bool show);
int WMGetTextRulerShown(WMText *tPtr);
void WMSetTextEditable(WMText *tPtr, Bool editable);
int WMGetTextEditable(WMText *tPtr);
@@ -1472,6 +1472,9 @@ WMBag * WMGetTextSelectedObjects(WMText *tPtr);
void *WMCreateTextBlockWithObject(WMWidget *w, char *description,
WMColor *color, unsigned short first, unsigned short reserved);
void *WMCreateTextBlockWithPixmap(WMPixmap *p, char *description,
WMColor *color, unsigned short first, unsigned short reserved);
void *WMCreateTextBlockWithText(char *text, WMFont *font,
WMColor *color, unsigned short first, unsigned short length);

View File

@@ -65,7 +65,7 @@ mystrcasecmp(const unsigned char *s1, const unsigned char *s2)
{
if (!*s1 || !*s2) return 0;
while (*s2 != '\0') {
if (TOLOWER (*s1) != TOLOWER (*s2)) /* true if *s1 == 0 ! */
if (TOLOWER (*s1) != TOLOWER (*s2))
return 0;
s1++;
s2++;
@@ -133,6 +133,7 @@ void parseToken(WMText *tPtr, char *token, short tk)
/* nice and fast for small tokens... no need for too much brain
power here */
switch(TOLOWER(*token)) {
case 'i':
if(!mode) {
cfmt.cfont = WMGetFontItalic(scr, cfmt.cfont);
@@ -144,6 +145,7 @@ void parseToken(WMText *tPtr, char *token, short tk)
cfmt.cfont = (WMFont *)WMGetFromBag(cfmt.fonts,
WMGetBagItemCount(cfmt.fonts)-1);
} break;
case 'b':
if(!mode) {
cfmt.cfont = WMGetFontBold(scr, cfmt.cfont);
@@ -193,7 +195,7 @@ void parseToken(WMText *tPtr, char *token, short tk)
switch(TOLOWER(*token)) {
case 's':
if(TOLOWER(*(1+token)) == 'r' && TOLOWER(*(2+token)) == 'c') {
mark = strchr(token, '=');
mark = (char *)strchr(token, '=');
if(mark) {
char img[256], *iptr;
token = mark+1;
@@ -289,34 +291,22 @@ void HTMLParser(WMWidget *w, void *clientData)
init = 0;
}
#if 0
if(strlen(stream) == 1 && stream[0] == '\n') {
/* sometimes if the text entered is a single char AND is a newline,
the user prolly typed it */
cfmt.para = (cfmt.actions.createParagraph) (cfmt.fmargin, cfmt.bmargin,
WMWidgetWidth(tPtr)-30, NULL, 0, cfmt.align);
(cfmt.actions.insertParagraph) (tPtr, cfmt.para, cfmt.type);
return;
}
#endif
/*
*/
while( (c=*(stream++))) {
//printf("%c", c);
if(c == '\n' || c =='\t')
//c = ' '; //continue;
continue;
if(c == ' ') {
if(wasspace)
continue;
wasspace = 1;
}else wasspace = 0;
} else
wasspace = 0;
if(c == '<' && !mode) {
mode=1;
mode = 1;
if(textlen>0) {
text[textlen] = 0;
tb = WMCreateTextBlockWithText(text, cfmt.cfont,
@@ -324,7 +314,6 @@ void HTMLParser(WMWidget *w, void *clientData)
WMSetTextBlockProperties(tb, cfmt.first, False, (cfmt.u?1:0), 0, 0);
WMAppendTextBlock(tPtr, tb);
cfmt.first = False;
//printf("%s\n", text);
}
textlen = 0;
} else if(c == '>' && mode) {

View File

@@ -61,7 +61,7 @@ typedef struct _TextBlock {
struct _TextBlock *next; /* next text block in linked list */
struct _TextBlock *prior; /* prior text block in linked list */
char *text; /* pointer to 8- or 16-bit text */
char *text; /* pointer to text (could be kanji) */
/* or to the object's description */
union {
WMFont *font; /* the font */
@@ -166,7 +166,7 @@ typedef struct W_Text {
unsigned int clickPos:1; /* clicked before=0 or after=1 a graphic: */
/* within counts as after too */
unsigned int ignoreNewLine:1;/* turn it into a ' ' when typed */
unsigned int ignoreNewLine:1;/* turn it into a ' ' in streams > 1 */
unsigned int laidOut:1; /* have the TextBlocks all been laid out */
unsigned int prepend:1; /* prepend=1, append=0 (for parsers) */
WMAlignment alignment:2; /* the alignment for text */
@@ -439,7 +439,6 @@ cursorToTextPosition(Text *tPtr, int x, int y)
int done=False, s, pos, len, _w, _y, dir=1; /* 1 == "down" */
char *text;
printf("%d %d\n",x,y);
y += (tPtr->vpos - tPtr->visible.y);
if (y<0)
y = 0;
@@ -507,8 +506,8 @@ dir = 1;
s = (dir? 0 : tb->nsections-1);
while (!done && (dir? (s<tb->nsections) : (s>=0) )) {
if ( y >= tb->sections[s]._y
&& y <= tb->sections[s]._y + tb->sections[s].h) {
if ( (dir? (y <= tb->sections[s]._y + tb->sections[s].h) :
( y >= tb->sections[s]._y ) ) ) {
done = True;
} else {
dir? s++ : s--;
@@ -765,7 +764,7 @@ dimple =where mouse is.
tPtr->view->size.width-24, tPtr->view->size.height-4, True);
}
*/
if (which == WSDecrementLine || which == WSIncrementLine)
if (dimple || which == WSDecrementLine || which == WSIncrementLine)
updateScrollers(tPtr);
paintText(tPtr);
}
@@ -1443,14 +1442,15 @@ handleTextKeyPress(Text *tPtr, XEvent *event)
buffer[XLookupString(&event->xkey, buffer, 1, &ksym, NULL)] = 0;
switch(ksym) {
case XK_Right:
case XK_Left:
case XK_Down:
case XK_Up: {
case XK_Left: {
TextBlock *tb = tPtr->currentTextBlock;
int x = tPtr->cursor.x + tPtr->visible.x;
int y = tPtr->visible.y + tPtr->cursor.y + tPtr->cursor.h;
int w, pos;
#if 0
if(!tb)
break;
if(tb->graphic) {
@@ -1465,16 +1465,30 @@ handleTextKeyPress(Text *tPtr, XEvent *event)
}
cursorToTextPosition(tPtr, w + tPtr->cursor.x + tPtr->visible.x,
tPtr->visible.y + tPtr->cursor.y + tPtr->cursor.h);
3 + tPtr->visible.y + tPtr->cursor.y
+ tPtr->cursor.h - tPtr->vpos);
if(x == tPtr->cursor.x + tPtr->visible.x) {
printf("same %d %d\n", x, tPtr->cursor.x + tPtr->visible.x);
cursorToTextPosition(tPtr, tPtr->visible.x,
3 + tPtr->visible.y + tPtr->cursor.y + tPtr->cursor.h);
}
paintText(tPtr);
#endif
}
break;
case XK_Down:
cursorToTextPosition(tPtr, tPtr->cursor.x + tPtr->visible.x,
tPtr->clicked.y + tPtr->cursor.h - tPtr->vpos);
paintText(tPtr);
break;
case XK_Up:
cursorToTextPosition(tPtr, tPtr->cursor.x + tPtr->visible.x,
tPtr->visible.y + tPtr->cursor.y - tPtr->vpos - 3);
paintText(tPtr);
break;
case XK_BackSpace:
case XK_Delete:
case XK_KP_Delete: