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