mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-06 22:04:12 +01:00
Text Selection 99% complete, replaceSelection added
This commit is contained in:
@@ -385,22 +385,17 @@ typedef struct WMInputPanel {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* WMRuler: a tabstop is a linked list of tabstops,
|
|
||||||
each containing the position of the tabstop */
|
|
||||||
|
|
||||||
|
/* WMRuler: */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int value;
|
unsigned int *tabs; /* a growable array of tabstops */
|
||||||
struct WMTabStops *next;
|
unsigned short ntabstops:4; /* how many there are */
|
||||||
} WMTabStops;
|
unsigned short left:15; /* left margin marker */
|
||||||
|
unsigned short right:15; /* right margin marker */
|
||||||
/* All indentation and tab markers are _relative_ to the left margin marker */
|
unsigned short first:15; /* indentation marker for first line only */
|
||||||
typedef struct {
|
unsigned short body:15; /* body indentation marker */
|
||||||
int left; /* left margin marker */
|
|
||||||
int right; /* right margin marker */
|
|
||||||
int first; /* indentation marker for first line only */
|
|
||||||
int body; /* body indentation marker */
|
|
||||||
WMTabStops *tabs;
|
|
||||||
} WMRulerMargins;
|
} WMRulerMargins;
|
||||||
|
/* All indentation and tab markers are _relative_ to the left margin marker */
|
||||||
|
|
||||||
|
|
||||||
typedef void *WMHandlerID;
|
typedef void *WMHandlerID;
|
||||||
@@ -1457,17 +1452,17 @@ void WMPrependTextStream(WMText *tPtr, char *text);
|
|||||||
|
|
||||||
void WMAppendTextStream(WMText *tPtr, char *text);
|
void WMAppendTextStream(WMText *tPtr, char *text);
|
||||||
|
|
||||||
/* free the returned text */
|
/* free the text */
|
||||||
char * WMGetTextStream(WMText *tPtr);
|
char * WMGetTextStream(WMText *tPtr);
|
||||||
|
|
||||||
/* destroy the bag */
|
/* free the text */
|
||||||
WMBag * WMGetTextStreamObjects(WMText *tPtr);
|
|
||||||
|
|
||||||
/* free the returned text */
|
|
||||||
char * WMGetTextSelected(WMText *tPtr);
|
char * WMGetTextSelected(WMText *tPtr);
|
||||||
|
|
||||||
/* destroy the bag */
|
/* destroy the bag */
|
||||||
WMBag * WMGetTextSelectedObjects(WMText *tPtr);
|
WMBag * WMGetTextStreamIntoBag(WMText *tPtr);
|
||||||
|
|
||||||
|
/* destroy the bag */
|
||||||
|
WMBag * WMGetTextSelectedIntoBag(WMText *tPtr);
|
||||||
|
|
||||||
void *WMCreateTextBlockWithObject(WMWidget *w, char *description,
|
void *WMCreateTextBlockWithObject(WMWidget *w, char *description,
|
||||||
WMColor *color, unsigned short first, unsigned short reserved);
|
WMColor *color, unsigned short first, unsigned short reserved);
|
||||||
@@ -1480,11 +1475,11 @@ void *WMCreateTextBlockWithText(char *text, WMFont *font,
|
|||||||
|
|
||||||
void WMSetTextBlockProperties(void *vtb, unsigned int first,
|
void WMSetTextBlockProperties(void *vtb, unsigned int first,
|
||||||
unsigned int kanji, unsigned int underlined, int script,
|
unsigned int kanji, unsigned int underlined, int script,
|
||||||
unsigned int marginN);
|
WMRulerMargins margins);
|
||||||
|
|
||||||
void WMGetTextBlockProperties(void *vtb, unsigned int *first,
|
void WMGetTextBlockProperties(void *vtb, unsigned int *first,
|
||||||
unsigned int *kanji, unsigned int *underlined, int *script,
|
unsigned int *kanji, unsigned int *underlined, int *script,
|
||||||
unsigned int *marginN);
|
WMRulerMargins *margins);
|
||||||
|
|
||||||
void WMSetTextSelectionColor(WMText *tPtr, WMColor *color);
|
void WMSetTextSelectionColor(WMText *tPtr, WMColor *color);
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ mystrcasecmp(const unsigned char *s1, const unsigned char *s2)
|
|||||||
{
|
{
|
||||||
if (!*s1 || !*s2) return 0;
|
if (!*s1 || !*s2) return 0;
|
||||||
while (*s2 != '\0') {
|
while (*s2 != '\0') {
|
||||||
if (TOLOWER (*s1) != TOLOWER (*s2))
|
if (TOLOWER (*s1) != TOLOWER (*s2)) /* true if *s1 == 0 ! */
|
||||||
return 0;
|
return 0;
|
||||||
s1++;
|
s1++;
|
||||||
s2++;
|
s2++;
|
||||||
@@ -79,6 +79,7 @@ typedef struct _currentFormat {
|
|||||||
WMBag *colors;
|
WMBag *colors;
|
||||||
WMColor *ccolor;
|
WMColor *ccolor;
|
||||||
WMFont *cfont;
|
WMFont *cfont;
|
||||||
|
WMRulerMargins margins;
|
||||||
//WMBag *aligns; // for tables...
|
//WMBag *aligns; // for tables...
|
||||||
/* the following are "nested"
|
/* the following are "nested"
|
||||||
i.e.: <b><b><i></b><b></i>
|
i.e.: <b><b><i></b><b></i>
|
||||||
@@ -133,7 +134,6 @@ void parseToken(WMText *tPtr, char *token, short tk)
|
|||||||
/* nice and fast for small tokens... no need for too much brain
|
/* nice and fast for small tokens... no need for too much brain
|
||||||
power here */
|
power here */
|
||||||
switch(TOLOWER(*token)) {
|
switch(TOLOWER(*token)) {
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
if(!mode) {
|
if(!mode) {
|
||||||
cfmt.cfont = WMGetFontItalic(scr, cfmt.cfont);
|
cfmt.cfont = WMGetFontItalic(scr, cfmt.cfont);
|
||||||
@@ -145,7 +145,6 @@ void parseToken(WMText *tPtr, char *token, short tk)
|
|||||||
cfmt.cfont = (WMFont *)WMGetFromBag(cfmt.fonts,
|
cfmt.cfont = (WMFont *)WMGetFromBag(cfmt.fonts,
|
||||||
WMGetBagItemCount(cfmt.fonts)-1);
|
WMGetBagItemCount(cfmt.fonts)-1);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
if(!mode) {
|
if(!mode) {
|
||||||
cfmt.cfont = WMGetFontBold(scr, cfmt.cfont);
|
cfmt.cfont = WMGetFontBold(scr, cfmt.cfont);
|
||||||
@@ -161,8 +160,8 @@ void parseToken(WMText *tPtr, char *token, short tk)
|
|||||||
cfmt.first = True;
|
cfmt.first = True;
|
||||||
tb = WMCreateTextBlockWithText(NULL, cfmt.cfont,
|
tb = WMCreateTextBlockWithText(NULL, cfmt.cfont,
|
||||||
cfmt.ccolor, cfmt.first, 0);
|
cfmt.ccolor, cfmt.first, 0);
|
||||||
WMSetTextBlockProperties(tb, cfmt.first, False, (cfmt.u?1:0), 0, 0);
|
WMSetTextBlockProperties(tb, cfmt.first, False, (cfmt.u?1:0), 0, cfmt.margins);
|
||||||
WMAppendTextBlock(tPtr, tb);
|
//WMAppendTextBlock(tPtr, tb);
|
||||||
cfmt.first = False;
|
cfmt.first = False;
|
||||||
break;
|
break;
|
||||||
case 'u': cfmt.u = !mode; break;
|
case 'u': cfmt.u = !mode; break;
|
||||||
@@ -195,7 +194,7 @@ void parseToken(WMText *tPtr, char *token, short tk)
|
|||||||
switch(TOLOWER(*token)) {
|
switch(TOLOWER(*token)) {
|
||||||
case 's':
|
case 's':
|
||||||
if(TOLOWER(*(1+token)) == 'r' && TOLOWER(*(2+token)) == 'c') {
|
if(TOLOWER(*(1+token)) == 'r' && TOLOWER(*(2+token)) == 'c') {
|
||||||
mark = (char *)strchr(token, '=');
|
mark = strchr(token, '=');
|
||||||
if(mark) {
|
if(mark) {
|
||||||
char img[256], *iptr;
|
char img[256], *iptr;
|
||||||
token = mark+1;
|
token = mark+1;
|
||||||
@@ -208,7 +207,7 @@ void parseToken(WMText *tPtr, char *token, short tk)
|
|||||||
tb = WMCreateTextBlockWithPixmap(pixmap,
|
tb = WMCreateTextBlockWithPixmap(pixmap,
|
||||||
iptr, cfmt.ccolor, cfmt.first, 0);
|
iptr, cfmt.ccolor, cfmt.first, 0);
|
||||||
WMSetTextBlockProperties(tb, cfmt.first,
|
WMSetTextBlockProperties(tb, cfmt.first,
|
||||||
False, (cfmt.u?1:0), 0, 0);
|
False, (cfmt.u?1:0), 0, cfmt.margins);
|
||||||
WMAppendTextBlock(tPtr, tb);
|
WMAppendTextBlock(tPtr, tb);
|
||||||
cfmt.first = False;
|
cfmt.first = False;
|
||||||
}
|
}
|
||||||
@@ -291,29 +290,42 @@ void HTMLParser(WMWidget *w, void *clientData)
|
|||||||
init = 0;
|
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++))) {
|
while( (c=*(stream++))) {
|
||||||
|
//printf("%c", c);
|
||||||
if(c == '\n' || c =='\t')
|
if(c == '\n' || c =='\t')
|
||||||
//c = ' '; //continue;
|
//c = ' '; //continue;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(c == ' ') {
|
if(c == ' ') {
|
||||||
if(wasspace)
|
if(wasspace)
|
||||||
continue;
|
continue;
|
||||||
wasspace = 1;
|
wasspace = 1;
|
||||||
} else
|
}else wasspace = 0;
|
||||||
wasspace = 0;
|
|
||||||
|
|
||||||
if(c == '<' && !mode) {
|
if(c == '<' && !mode) {
|
||||||
mode = 1;
|
mode=1;
|
||||||
|
|
||||||
if(textlen>0) {
|
if(textlen>0) {
|
||||||
text[textlen] = 0;
|
text[textlen] = 0;
|
||||||
tb = WMCreateTextBlockWithText(text, cfmt.cfont,
|
tb = WMCreateTextBlockWithText(text, cfmt.cfont,
|
||||||
cfmt.ccolor, cfmt.first, textlen);
|
cfmt.ccolor, cfmt.first, textlen);
|
||||||
WMSetTextBlockProperties(tb, cfmt.first, False, (cfmt.u?1:0), 0, 0);
|
WMSetTextBlockProperties(tb, cfmt.first, False, (cfmt.u?1:0), 0, cfmt.margins);
|
||||||
WMAppendTextBlock(tPtr, tb);
|
WMAppendTextBlock(tPtr, tb);
|
||||||
cfmt.first = False;
|
cfmt.first = False;
|
||||||
|
//printf("%s\n", text);
|
||||||
}
|
}
|
||||||
textlen = 0;
|
textlen = 0;
|
||||||
} else if(c == '>' && mode) {
|
} else if(c == '>' && mode) {
|
||||||
@@ -338,7 +350,7 @@ void HTMLParser(WMWidget *w, void *clientData)
|
|||||||
(WMColor *)WMGetFromBag(cfmt.colors,
|
(WMColor *)WMGetFromBag(cfmt.colors,
|
||||||
WMGetBagItemCount(cfmt.colors)-1),
|
WMGetBagItemCount(cfmt.colors)-1),
|
||||||
cfmt.first, textlen);
|
cfmt.first, textlen);
|
||||||
WMSetTextBlockProperties(tb, cfmt.first, False, (cfmt.u?1:0), 0, 0);
|
WMSetTextBlockProperties(tb, cfmt.first, False, (cfmt.u?1:0), 0, cfmt.margins);
|
||||||
WMAppendTextBlock(tPtr, tb);
|
WMAppendTextBlock(tPtr, tb);
|
||||||
cfmt.first = False;
|
cfmt.first = False;
|
||||||
}
|
}
|
||||||
@@ -399,9 +411,9 @@ main(int argc, char **argv)
|
|||||||
WMSetTextUsesMonoFont(text, !True);
|
WMSetTextUsesMonoFont(text, !True);
|
||||||
WMSetTextParser(text, HTMLParser);
|
WMSetTextParser(text, HTMLParser);
|
||||||
#if 0
|
#if 0
|
||||||
|
WMShowTextRuler(text, True);
|
||||||
WMSetTextUseFixedPitchFont(text, False);
|
WMSetTextUseFixedPitchFont(text, False);
|
||||||
WMSetTextHasRuler(text, True);
|
WMSetTextHasRuler(text, True);
|
||||||
WMShowTextRuler(text, True);
|
|
||||||
WMSetTextHasVerticalScroller(text, True);
|
WMSetTextHasVerticalScroller(text, True);
|
||||||
//WMSetTextHasHorizontalScroller(text, True);
|
//WMSetTextHasHorizontalScroller(text, True);
|
||||||
WMFreezeText(text);
|
WMFreezeText(text);
|
||||||
@@ -472,7 +484,8 @@ interesting widgets like this list widget: ");
|
|||||||
tb = WMCreateTextBlockWithObject(te, "{a text object}",
|
tb = WMCreateTextBlockWithObject(te, "{a text object}",
|
||||||
WMBlackColor(scr), False, 0);
|
WMBlackColor(scr), False, 0);
|
||||||
WMAppendTextBlock(text, tb);
|
WMAppendTextBlock(text, tb);
|
||||||
WMSetTextHasVerticalScroller(te, False);
|
WMSetTextHasVerticalScroller(te, True);
|
||||||
|
WMSetTextHasHorizontalScroller(te, True);
|
||||||
WMRefreshText(te, 0, 0);
|
WMRefreshText(te, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* WINGs WMRuler nifty ruler widget for WINGs (OK, for WMText ;-)
|
* WINGs WMRuler: nifty ruler widget for WINGs :-)
|
||||||
*
|
*
|
||||||
* Copyright (c) 1999-2000 Nwanua Elumeze
|
* Copyright (c) 1999-2000 Nwanua Elumeze
|
||||||
*
|
*
|
||||||
@@ -42,11 +42,13 @@ typedef struct W_Ruler {
|
|||||||
Pixmap drawBuffer;
|
Pixmap drawBuffer;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
unsigned int buttonPressed:1;
|
|
||||||
unsigned int whichMarker:3;
|
unsigned int whichMarker:3;
|
||||||
/* 0, 1, 2, 3, 4, 5, 6 */
|
/* 0, 1, 2, 3, 4, 5, 6 */
|
||||||
/* none, left, right, first, body, tabstop, first & body */
|
/* none, left, right, first, body, tabstop, first & body */
|
||||||
unsigned int RESERVED:28;
|
|
||||||
|
unsigned int buttonPressed:1;
|
||||||
|
unsigned int redraw:1;
|
||||||
|
unsigned int RESERVED:27;
|
||||||
} flags;
|
} flags;
|
||||||
} Ruler;
|
} Ruler;
|
||||||
|
|
||||||
@@ -154,8 +156,12 @@ static void drawBodyMarker(Ruler * rPtr)
|
|||||||
|
|
||||||
static void createDrawBuffer(Ruler * rPtr)
|
static void createDrawBuffer(Ruler * rPtr)
|
||||||
{
|
{
|
||||||
|
if(!rPtr->view->flags.realized)
|
||||||
|
return;
|
||||||
|
|
||||||
if (rPtr->drawBuffer)
|
if (rPtr->drawBuffer)
|
||||||
XFreePixmap(rPtr->view->screen->display, rPtr->drawBuffer);
|
XFreePixmap(rPtr->view->screen->display, rPtr->drawBuffer);
|
||||||
|
|
||||||
rPtr->drawBuffer = XCreatePixmap(rPtr->view->screen->display,
|
rPtr->drawBuffer = XCreatePixmap(rPtr->view->screen->display,
|
||||||
rPtr->view->window, rPtr->view->size.width, 40,
|
rPtr->view->window, rPtr->view->size.width, 40,
|
||||||
rPtr->view->screen->depth);
|
rPtr->view->screen->depth);
|
||||||
@@ -171,8 +177,9 @@ static void drawRulerOnPixmap(Ruler * rPtr)
|
|||||||
int marks[9] =
|
int marks[9] =
|
||||||
{11, 3, 5, 3, 7, 3, 5, 3};
|
{11, 3, 5, 3, 7, 3, 5, 3};
|
||||||
|
|
||||||
if (!rPtr->drawBuffer)
|
if (!rPtr->drawBuffer || !rPtr->view->flags.realized)
|
||||||
createDrawBuffer(rPtr);
|
return;
|
||||||
|
|
||||||
|
|
||||||
XFillRectangle(rPtr->view->screen->display, rPtr->drawBuffer,
|
XFillRectangle(rPtr->view->screen->display, rPtr->drawBuffer,
|
||||||
rPtr->bg, 0, 0, rPtr->view->size.width, 40);
|
rPtr->bg, 0, 0, rPtr->view->size.width, 40);
|
||||||
@@ -209,6 +216,8 @@ static void drawRulerOnPixmap(Ruler * rPtr)
|
|||||||
drawRightMarker(rPtr);
|
drawRightMarker(rPtr);
|
||||||
drawFirstMarker(rPtr);
|
drawFirstMarker(rPtr);
|
||||||
drawBodyMarker(rPtr);
|
drawBodyMarker(rPtr);
|
||||||
|
|
||||||
|
rPtr->flags.redraw = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -216,9 +225,11 @@ static void paintRuler(Ruler * rPtr)
|
|||||||
{
|
{
|
||||||
WMScreen *screen = rPtr->view->screen;
|
WMScreen *screen = rPtr->view->screen;
|
||||||
|
|
||||||
if (1 || !rPtr->drawBuffer) {
|
if (!rPtr->drawBuffer || !rPtr->view->flags.realized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (rPtr->flags.redraw)
|
||||||
drawRulerOnPixmap(rPtr);
|
drawRulerOnPixmap(rPtr);
|
||||||
}
|
|
||||||
XCopyArea(rPtr->view->screen->display, rPtr->drawBuffer,
|
XCopyArea(rPtr->view->screen->display, rPtr->drawBuffer,
|
||||||
rPtr->view->window, rPtr->bg, 0, 0, rPtr->view->size.width, 40,
|
rPtr->view->window, rPtr->bg, 0, 0, rPtr->view->size.width, 40,
|
||||||
0, 0);
|
0, 0);
|
||||||
@@ -312,6 +323,16 @@ static int whichMarker(Ruler * rPtr, int x, int y)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rulerDidResize(W_ViewDelegate * self, WMView * view)
|
||||||
|
{
|
||||||
|
Ruler *rPtr = (Ruler *) view->self;
|
||||||
|
|
||||||
|
createDrawBuffer(rPtr);
|
||||||
|
rPtr->flags.redraw = True;
|
||||||
|
paintRuler(rPtr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void handleEvents(XEvent * event, void *data)
|
static void handleEvents(XEvent * event, void *data)
|
||||||
{
|
{
|
||||||
@@ -320,7 +341,7 @@ static void handleEvents(XEvent * event, void *data)
|
|||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
paintRuler(rPtr);
|
rulerDidResize(rPtr->view->delegate, rPtr->view);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
@@ -331,6 +352,7 @@ static void handleEvents(XEvent * event, void *data)
|
|||||||
|
|
||||||
if (rPtr->moveAction)
|
if (rPtr->moveAction)
|
||||||
(rPtr->moveAction) (rPtr, rPtr->clientData);
|
(rPtr->moveAction) (rPtr, rPtr->clientData);
|
||||||
|
rPtr->flags.redraw = True;
|
||||||
paintRuler(rPtr);
|
paintRuler(rPtr);
|
||||||
XSetLineAttributes(rPtr->view->screen->display, gc, 1,
|
XSetLineAttributes(rPtr->view->screen->display, gc, 1,
|
||||||
LineSolid, CapNotLast, JoinMiter);
|
LineSolid, CapNotLast, JoinMiter);
|
||||||
@@ -362,6 +384,7 @@ static void handleEvents(XEvent * event, void *data)
|
|||||||
rPtr->margins.first -= change;
|
rPtr->margins.first -= change;
|
||||||
rPtr->margins.body -= change;
|
rPtr->margins.body -= change;
|
||||||
rPtr->margins.left = rPtr->motion;
|
rPtr->margins.left = rPtr->motion;
|
||||||
|
rPtr->flags.redraw = True;
|
||||||
paintRuler(rPtr);
|
paintRuler(rPtr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -385,15 +408,6 @@ static void handleEvents(XEvent * event, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rulerDidResize(W_ViewDelegate * self, WMView * view)
|
|
||||||
{
|
|
||||||
Ruler *rPtr = (Ruler *) view->self;
|
|
||||||
|
|
||||||
createDrawBuffer(rPtr);
|
|
||||||
paintRuler(rPtr);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
W_ViewDelegate _RulerViewDelegate =
|
W_ViewDelegate _RulerViewDelegate =
|
||||||
{
|
{
|
||||||
@@ -406,7 +420,7 @@ W_ViewDelegate _RulerViewDelegate =
|
|||||||
|
|
||||||
|
|
||||||
WMRuler *
|
WMRuler *
|
||||||
WMCreateRuler(WMWidget * parent)
|
WMCreateRuler(WMWidget * parent)
|
||||||
{
|
{
|
||||||
Ruler *rPtr = wmalloc(sizeof(Ruler));
|
Ruler *rPtr = wmalloc(sizeof(Ruler));
|
||||||
unsigned int w = WMWidgetWidth(parent);
|
unsigned int w = WMWidgetWidth(parent);
|
||||||
@@ -416,10 +430,12 @@ WMRuler *
|
|||||||
rPtr->widgetClass = WC_Ruler;
|
rPtr->widgetClass = WC_Ruler;
|
||||||
|
|
||||||
rPtr->view = W_CreateView(W_VIEW(parent));
|
rPtr->view = W_CreateView(W_VIEW(parent));
|
||||||
|
|
||||||
if (!rPtr->view) {
|
if (!rPtr->view) {
|
||||||
free(rPtr);
|
free(rPtr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rPtr->view->self = rPtr;
|
rPtr->view->self = rPtr;
|
||||||
|
|
||||||
rPtr->drawBuffer = (Pixmap) NULL;
|
rPtr->drawBuffer = (Pixmap) NULL;
|
||||||
@@ -442,9 +458,11 @@ WMRuler *
|
|||||||
rPtr->margins.body = 22;
|
rPtr->margins.body = 22;
|
||||||
rPtr->margins.first = 42;
|
rPtr->margins.first = 42;
|
||||||
rPtr->margins.right = (w < 502 ? w : 502);
|
rPtr->margins.right = (w < 502 ? w : 502);
|
||||||
|
rPtr->margins.tabs = NULL;
|
||||||
|
|
||||||
rPtr->flags.whichMarker = 0; /* none */
|
rPtr->flags.whichMarker = 0; /* none */
|
||||||
rPtr->flags.buttonPressed = False;
|
rPtr->flags.buttonPressed = False;
|
||||||
|
rPtr->flags.redraw = True;
|
||||||
|
|
||||||
rPtr->moveAction = NULL;
|
rPtr->moveAction = NULL;
|
||||||
rPtr->releaseAction = NULL;
|
rPtr->releaseAction = NULL;
|
||||||
@@ -464,6 +482,7 @@ void WMSetRulerMargins(WMRuler * rPtr, WMRulerMargins margins)
|
|||||||
rPtr->margins.first = margins.first + rPtr->offset;
|
rPtr->margins.first = margins.first + rPtr->offset;
|
||||||
rPtr->margins.body = margins.body + rPtr->offset;
|
rPtr->margins.body = margins.body + rPtr->offset;
|
||||||
rPtr->margins.tabs = margins.tabs; /*for loop */
|
rPtr->margins.tabs = margins.tabs; /*for loop */
|
||||||
|
rPtr->flags.redraw = True;
|
||||||
paintRuler(rPtr);
|
paintRuler(rPtr);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -474,8 +493,11 @@ WMGetRulerMargins(WMRuler * rPtr)
|
|||||||
{
|
{
|
||||||
WMRulerMargins margins;
|
WMRulerMargins margins;
|
||||||
|
|
||||||
if (!rPtr)
|
if (!rPtr) {
|
||||||
|
margins.first = margins.body = margins.left = 0;
|
||||||
|
margins.right = 100;
|
||||||
return margins;
|
return margins;
|
||||||
|
}
|
||||||
|
|
||||||
margins.left = rPtr->margins.left - rPtr->offset;
|
margins.left = rPtr->margins.left - rPtr->offset;
|
||||||
margins.right = rPtr->margins.right - rPtr->offset;
|
margins.right = rPtr->margins.right - rPtr->offset;
|
||||||
|
|||||||
745
WINGs/wtext.c
745
WINGs/wtext.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user