mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
fixed lots of compile bugs in wtext.c and made a few api changes to it
This commit is contained in:
@@ -13,7 +13,7 @@ include_HEADERS = WINGs.h WUtil.h WINGsP.h
|
|||||||
bin_SCRIPTS = get-wings-flags get-wutil-flags
|
bin_SCRIPTS = get-wings-flags get-wutil-flags
|
||||||
|
|
||||||
noinst_PROGRAMS = wtest wmquery wmfile fontl testmywidget testcolorpanel\
|
noinst_PROGRAMS = wtest wmquery wmfile fontl testmywidget testcolorpanel\
|
||||||
connect puzzle # testtext
|
connect puzzle testtext
|
||||||
|
|
||||||
lib_LIBRARIES = libWINGs.a libWUtil.a
|
lib_LIBRARIES = libWINGs.a libWUtil.a
|
||||||
|
|
||||||
|
|||||||
@@ -193,22 +193,16 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum {
|
typedef enum {
|
||||||
WRulerLeft=0,
|
WRulerLeft=0,
|
||||||
WRulerBody,
|
WRulerBody,
|
||||||
WRulerFirst,
|
WRulerFirst,
|
||||||
WRulerRight,
|
WRulerRight,
|
||||||
WRulerBoth,
|
WRulerBoth,
|
||||||
WRulerDocLeft
|
WRulerDocLeft
|
||||||
} WRulerMargins;
|
} WMRulerMarginType;
|
||||||
|
|
||||||
|
|
||||||
/* Insert type for WMText */
|
|
||||||
typedef enum {
|
|
||||||
itAppend=0,
|
|
||||||
itPrepend
|
|
||||||
} InsertType;
|
|
||||||
|
|
||||||
|
|
||||||
/* drag operations */
|
/* drag operations */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -536,13 +530,13 @@ typedef void WMParseAction(WMWidget *self, void *clientData, short type);
|
|||||||
/* these are the things parsers (for text) do */
|
/* these are the things parsers (for text) do */
|
||||||
|
|
||||||
typedef struct _parserActions {
|
typedef struct _parserActions {
|
||||||
void *(*createParagraph) (short fmargin, short bmargin, short rmargin,
|
void *(*createParagraph) (short fmargin, short bmargin,
|
||||||
short *tabstops, short numTabs, WMAlignment a);
|
short rmargin, short *tabstops, short numTabs, WMAlignment a);
|
||||||
void (*insertParagraph) (WMText *tPtr, void *para, InsertType type);
|
void (*insertParagraph) (WMText *tPtr, void *para, Bool prepend);
|
||||||
void *(*createPChunk) (WMPixmap *pixmap, short script, ushort ul);
|
void *(*createPChunk) (WMPixmap *pixmap, short script, ushort ul);
|
||||||
void *(*createTChunk) (char *text, short chars, WMFont *font,
|
void *(*createTChunk) (char *text, short chars, WMFont *font,
|
||||||
WMColor *color, short script, ushort ul);
|
WMColor *color, short script, ushort ul);
|
||||||
void (*insertChunk) (WMText *tPtr, void *chunk, InsertType type);
|
void (*insertChunk) (WMText *tPtr, void *chunk, Bool prepend);
|
||||||
} WMParserActions;
|
} WMParserActions;
|
||||||
|
|
||||||
|
|
||||||
@@ -1440,9 +1434,9 @@ int WMGetTextCurrentChunk(WMText *tPtr);
|
|||||||
void WMRemoveTextChunk(WMText *tPtr, int which);
|
void WMRemoveTextChunk(WMText *tPtr, int which);
|
||||||
void WMSetTextCurrentChunk(WMText *tPtr, int current);
|
void WMSetTextCurrentChunk(WMText *tPtr, int current);
|
||||||
|
|
||||||
void W_InsertText(WMText *tPtr, void *data, int position);/* position = -1||0*/
|
void W_InsertText(WMText *tPtr, void *data, Bool prepend);
|
||||||
#define WMAppendTextStream(t, d) W_InsertText(t, d, -1)
|
#define WMAppendTextStream(t, d) W_InsertText(t, d, False)
|
||||||
#define WMPrependTextStream(t, d) W_InsertText(t, d, 0)
|
#define WMPrependTextStream(t, d) W_InsertText(t, d, True)
|
||||||
|
|
||||||
|
|
||||||
void WMSetTextParser(WMText *tPtr, WMParseAction *parser);
|
void WMSetTextParser(WMText *tPtr, WMParseAction *parser);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
wAbort()
|
wAbort()
|
||||||
@@ -200,7 +200,7 @@ void parseToken(WMText *tPtr, char *token, short tk)
|
|||||||
if(*img == '\"') { img[strlen(img)-1] = 0; iptr++;}
|
if(*img == '\"') { img[strlen(img)-1] = 0; iptr++;}
|
||||||
pixmap = WMCreatePixmapFromFile(scr, iptr);
|
pixmap = WMCreatePixmapFromFile(scr, iptr);
|
||||||
chunk = (cfmt.actions.createPChunk)(pixmap, 0, False);
|
chunk = (cfmt.actions.createPChunk)(pixmap, 0, False);
|
||||||
(cfmt.actions.insertChunk) (tPtr, chunk, itAppend);
|
(cfmt.actions.insertChunk) (tPtr, chunk, False);
|
||||||
printf("[%s]\n", iptr);
|
printf("[%s]\n", iptr);
|
||||||
} } break; } } while(*(token++));
|
} } break; } } while(*(token++));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
/* WMRuler: nifty ruler widget for WINGs (OK, for WMText ;-) */
|
||||||
|
/* Copyleft (>) 1999, 2000 Nwanua Elumeze <nwanua@colorado.edu> */
|
||||||
|
|
||||||
|
|
||||||
#include "WINGsP.h"
|
#include "WINGsP.h"
|
||||||
|
|
||||||
#define MIN_DOC_WIDTH 10
|
#define MIN_DOC_WIDTH 10
|
||||||
|
|||||||
@@ -1094,7 +1094,7 @@ if(scroll) {
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
W_InsertText(WMText *tPtr, void *data, int position)
|
W_InsertText(WMText *tPtr, void *data, Bool prepend)
|
||||||
{
|
{
|
||||||
if(!tPtr) return;
|
if(!tPtr) return;
|
||||||
if(!data) {
|
if(!data) {
|
||||||
@@ -1127,9 +1127,9 @@ W_InsertText(WMText *tPtr, void *data, int position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(tPtr->parser)
|
if(tPtr->parser)
|
||||||
(tPtr->parser)(tPtr, data, position >= 0 ? 1 : 0);
|
(tPtr->parser)(tPtr, data, prepend);
|
||||||
else
|
else
|
||||||
defaultParser(tPtr, data, position >= 0 ? 1 : 0);
|
defaultParser(tPtr, data, prepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1894,8 +1894,9 @@ createParagraph(short fmargin, short bmargin, short rmargin,
|
|||||||
This function then sets currentPara as _this_ paragraph.
|
This function then sets currentPara as _this_ paragraph.
|
||||||
NOTE: this means careless parser implementors might lose previous
|
NOTE: this means careless parser implementors might lose previous
|
||||||
paragraphs... but this keeps stuff small and non-buggy :-) */
|
paragraphs... but this keeps stuff small and non-buggy :-) */
|
||||||
|
|
||||||
void
|
void
|
||||||
insertParagraph(WMText *tPtr, void *v, InsertType type)
|
insertParagraph(WMText *tPtr, void *v, Bool prepend)
|
||||||
//insertParagraph(WMText *tPtr, Paragraph *para, InsertType type)
|
//insertParagraph(WMText *tPtr, Paragraph *para, InsertType type)
|
||||||
{
|
{
|
||||||
Paragraph *tmp;
|
Paragraph *tmp;
|
||||||
@@ -1906,7 +1907,7 @@ insertParagraph(WMText *tPtr, void *v, InsertType type)
|
|||||||
tPtr->paragraphs = para;
|
tPtr->paragraphs = para;
|
||||||
} else {
|
} else {
|
||||||
tmp = tPtr->paragraphs;
|
tmp = tPtr->paragraphs;
|
||||||
if(type == itAppend) {
|
if(!prepend) {
|
||||||
while(tmp->next && tmp != tPtr->currentPara)
|
while(tmp->next && tmp != tPtr->currentPara)
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
|
|
||||||
@@ -1997,7 +1998,7 @@ createTChunk(char *text, short chars, WMFont *font,
|
|||||||
NOTE: this means careless parser implementors might lose previous
|
NOTE: this means careless parser implementors might lose previous
|
||||||
paragraphs/chunks... but this keeps stuff small and non-buggy :-) */
|
paragraphs/chunks... but this keeps stuff small and non-buggy :-) */
|
||||||
void
|
void
|
||||||
insertChunk(WMText *tPtr, void *v, InsertType type)
|
insertChunk(WMText *tPtr, void *v, Bool prepend)
|
||||||
{
|
{
|
||||||
Chunk *tmp;
|
Chunk *tmp;
|
||||||
Chunk *chunk = (Chunk *)v;
|
Chunk *chunk = (Chunk *)v;
|
||||||
@@ -2007,7 +2008,7 @@ insertChunk(WMText *tPtr, void *v, InsertType type)
|
|||||||
if(!tPtr->paragraphs) { /* i.e., first chunk via insertTextInteractively */
|
if(!tPtr->paragraphs) { /* i.e., first chunk via insertTextInteractively */
|
||||||
Paragraph *para = (tPtr->funcs.createParagraph) (0, 0, tPtr->visibleW,
|
Paragraph *para = (tPtr->funcs.createParagraph) (0, 0, tPtr->visibleW,
|
||||||
NULL, 0, WALeft);
|
NULL, 0, WALeft);
|
||||||
(tPtr->funcs.insertParagraph) (tPtr, para, itAppend);
|
(tPtr->funcs.insertParagraph) (tPtr, para, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tPtr->currentPara)
|
if(!tPtr->currentPara)
|
||||||
@@ -2020,7 +2021,7 @@ insertChunk(WMText *tPtr, void *v, InsertType type)
|
|||||||
} else {
|
} else {
|
||||||
tmp = tPtr->currentPara->chunks;
|
tmp = tPtr->currentPara->chunks;
|
||||||
|
|
||||||
if(type == itAppend) {
|
if(!prepend) {
|
||||||
while(tmp->next && tmp != tPtr->currentChunk)
|
while(tmp->next && tmp != tPtr->currentChunk)
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user