mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 22:28:02 +01:00
added text widget from nwanua
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
changes since wmaker 0.62.1:
|
||||||
|
............................
|
||||||
|
- added WRuler widget
|
||||||
|
- added WText widget (rtf multiline text widget)
|
||||||
|
Nwanua Elumeze <nwanua@colorado.edu>
|
||||||
|
- added a new AUTO option for the UseMultiByte option
|
||||||
|
|
||||||
changes since wmaker 0.62.0:
|
changes since wmaker 0.62.0:
|
||||||
............................
|
............................
|
||||||
- added WMSetWidgetDefaultFont(), WMSetWidgetDefaultBoldFont()
|
- added WMSetWidgetDefaultFont(), WMSetWidgetDefaultBoldFont()
|
||||||
|
|||||||
@@ -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
|
connect puzzle testtext
|
||||||
|
|
||||||
lib_LIBRARIES = libWINGs.a libWUtil.a
|
lib_LIBRARIES = libWINGs.a libWUtil.a
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ wtest_DEPENDENCIES = libWINGs.a
|
|||||||
connect_LDADD = libWUtil.a @LIBRARY_SEARCH_PATH@ @NETLIBS@ @LIBPL@
|
connect_LDADD = libWUtil.a @LIBRARY_SEARCH_PATH@ @NETLIBS@ @LIBPL@
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = logo.xpm BUGS
|
EXTRA_DIST = logo.xpm BUGS wm.png upbtn.xpm wm.html
|
||||||
|
|
||||||
# wbutton.c
|
# wbutton.c
|
||||||
libWINGs_a_SOURCES = \
|
libWINGs_a_SOURCES = \
|
||||||
@@ -65,11 +65,13 @@ libWINGs_a_SOURCES = \
|
|||||||
wpixmap.c \
|
wpixmap.c \
|
||||||
wpopupbutton.c \
|
wpopupbutton.c \
|
||||||
wprogressindicator.c \
|
wprogressindicator.c \
|
||||||
|
wruler.c \
|
||||||
wscroller.c \
|
wscroller.c \
|
||||||
wscrollview.c \
|
wscrollview.c \
|
||||||
wslider.c \
|
wslider.c \
|
||||||
wsplitview.c \
|
wsplitview.c \
|
||||||
wtabview.c \
|
wtabview.c \
|
||||||
|
wtext.c \
|
||||||
wtextfield.c \
|
wtextfield.c \
|
||||||
wwindow.c \
|
wwindow.c \
|
||||||
wview.c \
|
wview.c \
|
||||||
|
|||||||
128
WINGs/WINGs.h
128
WINGs/WINGs.h
@@ -193,6 +193,17 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
WRulerLeft=0,
|
||||||
|
WRulerBody,
|
||||||
|
WRulerFirst,
|
||||||
|
WRulerRight,
|
||||||
|
WRulerBoth,
|
||||||
|
WRulerDocLeft
|
||||||
|
} WMRulerMargins;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* drag operations */
|
/* drag operations */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
WDOperationNone,
|
WDOperationNone,
|
||||||
@@ -275,7 +286,9 @@ enum {
|
|||||||
WC_SplitView = 13,
|
WC_SplitView = 13,
|
||||||
WC_TabView = 14,
|
WC_TabView = 14,
|
||||||
WC_ProgressIndicator = 15,
|
WC_ProgressIndicator = 15,
|
||||||
WC_MenuView = 16
|
WC_MenuView = 16,
|
||||||
|
WC_Ruler = 17,
|
||||||
|
WC_Text = 18
|
||||||
};
|
};
|
||||||
|
|
||||||
/* All widgets must start with the following structure
|
/* All widgets must start with the following structure
|
||||||
@@ -319,6 +332,9 @@ typedef struct W_Slider WMSlider;
|
|||||||
typedef struct W_Matrix WMMatrix; /* not ready */
|
typedef struct W_Matrix WMMatrix; /* not ready */
|
||||||
typedef struct W_SplitView WMSplitView;
|
typedef struct W_SplitView WMSplitView;
|
||||||
typedef struct W_TabView WMTabView;
|
typedef struct W_TabView WMTabView;
|
||||||
|
typedef struct W_Ruler WMRuler;
|
||||||
|
typedef struct W_Text WMText;
|
||||||
|
|
||||||
|
|
||||||
/* not widgets */
|
/* not widgets */
|
||||||
typedef struct W_TabViewItem WMTabViewItem;
|
typedef struct W_TabViewItem WMTabViewItem;
|
||||||
@@ -492,6 +508,23 @@ typedef struct WMSelectionProcs {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 *(*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);
|
||||||
|
} WMParserActions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct W_DraggingInfo WMDraggingInfo;
|
typedef struct W_DraggingInfo WMDraggingInfo;
|
||||||
|
|
||||||
|
|
||||||
@@ -1348,6 +1381,99 @@ void WMSetSplitViewResizeSubviewsProc(WMSplitView *sPtr,
|
|||||||
|
|
||||||
int WMGetSplitViewDividerThickness(WMSplitView *sPtr);
|
int WMGetSplitViewDividerThickness(WMSplitView *sPtr);
|
||||||
|
|
||||||
|
/* ...................................................................... */
|
||||||
|
|
||||||
|
|
||||||
|
WMRuler *WMCreateRuler(WMWidget *parent);
|
||||||
|
|
||||||
|
void WMShowRulerTabs(WMRuler *rPtr, Bool Show);
|
||||||
|
|
||||||
|
int WMGetRulerMargin(WMRuler *rPtr, int which);
|
||||||
|
|
||||||
|
int WMGetReleasedRulerMargin(WMRuler *rPtr);
|
||||||
|
|
||||||
|
int WMGetGrabbedRulerMargin(WMRuler *rPtr);
|
||||||
|
|
||||||
|
int WMGetRulerOffset(WMRuler *rPtr);
|
||||||
|
|
||||||
|
void WMSetRulerOffset(WMRuler *rPtr, int pixels);
|
||||||
|
|
||||||
|
void WMSetRulerMargin(WMRuler *rPtr, int which, int pixels);
|
||||||
|
|
||||||
|
void WMSetRulerAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
||||||
|
|
||||||
|
void WMSetRulerMoveAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
||||||
|
|
||||||
|
|
||||||
|
/* ....................................................................... */
|
||||||
|
|
||||||
|
WMText *WMCreateText(WMWidget *parent);
|
||||||
|
|
||||||
|
int WMGetTextParagraphs(WMText *tPtr);
|
||||||
|
int WMGetTextCurrentParagraph(WMText *tPtr);
|
||||||
|
void WMSetTextCurrentParagraph(WMText *tPtr, int current);
|
||||||
|
void WMRemoveTextParagraph(WMText *tPtr, int which);
|
||||||
|
|
||||||
|
int WMGetTextChunks(WMText *tPtr);
|
||||||
|
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 WMSetTextParser(WMText *tPtr, WMParseAction *parser);
|
||||||
|
WMParserActions WMGetTextParserActions(WMText *tPtr);
|
||||||
|
#if 0
|
||||||
|
typedef enum {
|
||||||
|
WDPCreateParagraph=0,
|
||||||
|
WDPInsertParagraph=1,
|
||||||
|
WDPCreateText=2,
|
||||||
|
WDPCreateImage=3,
|
||||||
|
WDPInsertChunk
|
||||||
|
} WMDoParse;
|
||||||
|
void WMDoTextParse(WMText *tPtr, short action);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char * WMGetTextAll(WMText *tPtr);
|
||||||
|
void WMSetTextWriter(WMText *tPtr, WMParseAction *writer);
|
||||||
|
|
||||||
|
void WMSetTextHasHorizontalScroller(WMText *tPtr, Bool flag);
|
||||||
|
void WMSetTextHasVerticalScroller(WMText *tPtr, Bool flag);
|
||||||
|
|
||||||
|
void WMRefreshText(WMText *tPtr, int vpos, int hpos);
|
||||||
|
void WMFreezeText(WMText *tPtr);
|
||||||
|
void WMThawText(WMText *tPtr);
|
||||||
|
|
||||||
|
void WMSetTextMonoFont(WMText *tPtr, Bool mono);
|
||||||
|
Bool WMGetTextMonoFont(WMText *tPtr);
|
||||||
|
void WMSetTextEditable(WMText *tPtr, Bool editable);
|
||||||
|
Bool WMGetTextEditable(WMText *tPtr);
|
||||||
|
void WMForceTextFocus(WMText *tPtr);
|
||||||
|
|
||||||
|
void WMSetTextAlignment(WMText *tPtr, WMAlignment alignment);
|
||||||
|
void WMIgnoreTextNewline(WMText *tPtr, Bool ignore);
|
||||||
|
|
||||||
|
|
||||||
|
Bool WMScrollText(WMText *tPtr, int amount);
|
||||||
|
Bool WMPageText(WMText *tPtr, Bool scrollUp);
|
||||||
|
|
||||||
|
|
||||||
|
void WMShowTextRuler(WMText *tPtr, Bool show);
|
||||||
|
Bool WMGetTextRulerShown(WMText *tPtr);
|
||||||
|
void WMShowTextRulerTabs(WMText *tPtr, Bool show);
|
||||||
|
void WMSetTextRulerMargin(WMText *tPtr, char which, short pixels);
|
||||||
|
short WMGetTextRulerMargin(WMText *tPtr, char which);
|
||||||
|
|
||||||
|
void WMSetTextUseFixedPitchFont(WMText *tPtr, Bool fixed);
|
||||||
|
void WMSetTextDefaultColor(WMText *tPtr, WMColor *color);
|
||||||
|
void WMSetTextDefaultFont(WMText *tPtr, WMFont *font);
|
||||||
|
void WMSetTextDefaultAlignment(WMText *tPtr, WMAlignment alignment);
|
||||||
|
void WMSetTextBackgroundColor(WMText *tPtr, WMColor *color);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ....................................................................... */
|
/* ....................................................................... */
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "WINGsP.h"
|
#include "WINGsP.h"
|
||||||
|
|
||||||
|
#include <X11/Xlocale.h>
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <proplist.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -52,6 +54,7 @@ W_ReadConfigurations(void)
|
|||||||
if (defaults) {
|
if (defaults) {
|
||||||
char *buttonName;
|
char *buttonName;
|
||||||
unsigned button;
|
unsigned button;
|
||||||
|
char *str;
|
||||||
|
|
||||||
WINGsConfiguration.systemFont =
|
WINGsConfiguration.systemFont =
|
||||||
WMGetUDStringForKey(defaults, "SystemFont");
|
WMGetUDStringForKey(defaults, "SystemFont");
|
||||||
@@ -59,8 +62,26 @@ W_ReadConfigurations(void)
|
|||||||
WINGsConfiguration.boldSystemFont =
|
WINGsConfiguration.boldSystemFont =
|
||||||
WMGetUDStringForKey(defaults, "BoldSystemFont");
|
WMGetUDStringForKey(defaults, "BoldSystemFont");
|
||||||
|
|
||||||
WINGsConfiguration.useMultiByte =
|
WINGsConfiguration.useMultiByte = False;
|
||||||
WMGetUDBoolForKey(defaults, "MultiByteText");
|
str = WMGetUDStringForKey(defaults, "MultiByteText");
|
||||||
|
if (str) {
|
||||||
|
if (strcasecmp(str, "YES") == 0) {
|
||||||
|
WINGsConfiguration.useMultiByte = True;
|
||||||
|
} else if (strcasecmp(str, "AUTO") == 0) {
|
||||||
|
char *locale;
|
||||||
|
|
||||||
|
/* if it's a multibyte language (japanese, chinese or korean)
|
||||||
|
* then set it to True */
|
||||||
|
locale = setlocale(LC_CTYPE, NULL);
|
||||||
|
if (locale != NULL
|
||||||
|
&& (strncmp(locale, "ja", 2) == 0
|
||||||
|
|| strncmp(locale, "zh", 2) == 0
|
||||||
|
|| strncmp(locale, "ko", 2) == 0)) {
|
||||||
|
|
||||||
|
WINGsConfiguration.useMultiByte = True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WINGsConfiguration.doubleClickDelay =
|
WINGsConfiguration.doubleClickDelay =
|
||||||
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
|
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
|
||||||
|
|||||||
441
WINGs/testtext.c
Normal file
441
WINGs/testtext.c
Normal file
@@ -0,0 +1,441 @@
|
|||||||
|
#include <WINGs.h>
|
||||||
|
#include <WINGsP.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "wtext.h"
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
wAbort()
|
||||||
|
{
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Close(WMWidget *self, void *client)
|
||||||
|
{
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* =============== a rudimentary HTML parser ======================= */
|
||||||
|
|
||||||
|
/* due to the WMSetTextParser stuff, it should not
|
||||||
|
be too hard to add parsers. like dis :-] */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A hack to speed up caseless_equal. Thanks to Quincey Koziol for
|
||||||
|
* developing it for the "chimera" folks so I could use it 7 years later ;-)
|
||||||
|
* Constraint: nothing but '\0' may map to 0
|
||||||
|
*/
|
||||||
|
unsigned char map_table[256] =
|
||||||
|
{
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||||
|
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||||
|
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||||||
|
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
|
||||||
|
111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92,
|
||||||
|
93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
|
||||||
|
108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
|
||||||
|
122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
|
||||||
|
136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
||||||
|
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
|
||||||
|
164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
|
||||||
|
178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||||
|
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
|
||||||
|
206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
|
||||||
|
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
|
||||||
|
234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
|
||||||
|
248, 249, 250, 251, 252, 253, 254, 255};
|
||||||
|
|
||||||
|
#define TOLOWER(x) (map_table[(int)x])
|
||||||
|
static int
|
||||||
|
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 ! */
|
||||||
|
return 0;
|
||||||
|
s1++;
|
||||||
|
s2++;
|
||||||
|
}
|
||||||
|
return (*s1=='\0' ||!isalnum(*s1))?1:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _currentFormat {
|
||||||
|
void *para;
|
||||||
|
WMBag *fonts;
|
||||||
|
WMBag *colors;
|
||||||
|
WMColor *ccolor;
|
||||||
|
WMFont *cfont;
|
||||||
|
WMParserActions actions;
|
||||||
|
//WMBag *aligns; // for tables...
|
||||||
|
/* the following are "nested"
|
||||||
|
i.e.: <b><b><i></b><b></i>
|
||||||
|
1 2 1 1 2 0 get it? */
|
||||||
|
short i;
|
||||||
|
short b;
|
||||||
|
short u;
|
||||||
|
short fmargin;
|
||||||
|
short bmargin;
|
||||||
|
WMAlignment align:2;
|
||||||
|
short type:1;
|
||||||
|
short ul:3; /* how "nested"... up to 8 levels deep */
|
||||||
|
short comment:1; /* ignore text till --> */
|
||||||
|
short RESERVED:10;
|
||||||
|
} CFMT;
|
||||||
|
CFMT cfmt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
getArg(char *t, short type, void *arg)
|
||||||
|
{
|
||||||
|
short d=0;
|
||||||
|
while(*(++t) && !d) {
|
||||||
|
if(type==0) {
|
||||||
|
if(*t>='0' && *t<='9') {
|
||||||
|
sscanf(t, "%d", arg);
|
||||||
|
while(*t&& (*t<'0' || *t>'9'))
|
||||||
|
t++;
|
||||||
|
d=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void parseToken(WMText *tPtr, char *token, short tk)
|
||||||
|
{
|
||||||
|
short mode=0; /* 0 starts, 1 closes */
|
||||||
|
WMScreen *scr = (W_VIEW(tPtr))->screen;
|
||||||
|
|
||||||
|
while(*token && isspace(*(token))) token++;
|
||||||
|
if(*token == '/') {
|
||||||
|
token++;
|
||||||
|
mode = 1;
|
||||||
|
while(isspace(*(token))) token++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strlen(token)==1) {
|
||||||
|
/* 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);
|
||||||
|
WMPutInBag(cfmt.fonts, (void *)cfmt.cfont);
|
||||||
|
} else { /*dun wanna remove the baseFont eh? */
|
||||||
|
int count = WMGetBagItemCount(cfmt.fonts);
|
||||||
|
if(count>1)
|
||||||
|
WMDeleteFromBag(cfmt.fonts, count-1);
|
||||||
|
cfmt.cfont = (WMFont *)WMGetFromBag(cfmt.fonts,
|
||||||
|
WMGetBagItemCount(cfmt.fonts)-1);
|
||||||
|
} break;
|
||||||
|
case 'b':
|
||||||
|
if(!mode) {
|
||||||
|
cfmt.cfont = WMGetFontBold(scr, cfmt.cfont);
|
||||||
|
WMPutInBag(cfmt.fonts, (void *)cfmt.cfont);
|
||||||
|
} else { /*dun wanna remove the baseFont eh? */
|
||||||
|
int count = WMGetBagItemCount(cfmt.fonts);
|
||||||
|
if(count>1)
|
||||||
|
WMDeleteFromBag(cfmt.fonts, count-1);
|
||||||
|
cfmt.cfont = (WMFont *)WMGetFromBag(cfmt.fonts,
|
||||||
|
WMGetBagItemCount(cfmt.fonts)-1);
|
||||||
|
} break;
|
||||||
|
case 'p':
|
||||||
|
cfmt.para = (cfmt.actions.createParagraph) (cfmt.fmargin, cfmt.bmargin,
|
||||||
|
WMWidgetWidth(tPtr)-30, NULL, 0, cfmt.align);
|
||||||
|
(cfmt.actions.insertParagraph) (tPtr, cfmt.para, cfmt.type);
|
||||||
|
cfmt.para = (cfmt.actions.createParagraph) (cfmt.fmargin, cfmt.bmargin,
|
||||||
|
WMWidgetWidth(tPtr)-30, NULL, 0, cfmt.align);
|
||||||
|
(cfmt.actions.insertParagraph) (tPtr, cfmt.para, cfmt.type);
|
||||||
|
break;
|
||||||
|
case 'u': cfmt.u = !mode; break;
|
||||||
|
}
|
||||||
|
} else { /* the <HTML> tag is, as far as I'm concerned, useless */
|
||||||
|
if(mystrcasecmp(token, "br")) {
|
||||||
|
cfmt.para = (cfmt.actions.createParagraph) (cfmt.fmargin, cfmt.bmargin,
|
||||||
|
WMWidgetWidth(tPtr)-30, NULL, 0, cfmt.align);
|
||||||
|
(cfmt.actions.insertParagraph) (tPtr, cfmt.para, cfmt.type);
|
||||||
|
}
|
||||||
|
else if(mystrcasecmp(token, "ul")) {
|
||||||
|
if(mode) {
|
||||||
|
if(cfmt.ul>1) cfmt.ul--;
|
||||||
|
} else cfmt.ul++;
|
||||||
|
if(cfmt.ul) {
|
||||||
|
cfmt.bmargin = cfmt.ul*30;
|
||||||
|
cfmt.fmargin = cfmt.bmargin-10;
|
||||||
|
} else cfmt.fmargin = cfmt.bmargin = 0;
|
||||||
|
} else if(mystrcasecmp(token, "li")) {
|
||||||
|
cfmt.para = (cfmt.actions.createParagraph) (cfmt.fmargin, cfmt.bmargin,
|
||||||
|
WMWidgetWidth(tPtr)-30, NULL, 0, cfmt.align);
|
||||||
|
(cfmt.actions.insertParagraph) (tPtr, cfmt.para, cfmt.type);
|
||||||
|
} else if(mystrcasecmp(token, "align"))
|
||||||
|
;//printf("align");
|
||||||
|
else if(mystrcasecmp(token, "img")) {
|
||||||
|
if(!mode) {
|
||||||
|
char *mark=NULL;
|
||||||
|
WMPixmap *pixmap;
|
||||||
|
void *chunk;
|
||||||
|
token+=3;
|
||||||
|
while(isspace(*(token))) token++;
|
||||||
|
do {
|
||||||
|
switch(TOLOWER(*token)) {
|
||||||
|
case 's':
|
||||||
|
if(TOLOWER(*(1+token)) == 'r' && TOLOWER(*(2+token)) == 'c') {
|
||||||
|
mark = strchr(token, '=');
|
||||||
|
if(mark) {
|
||||||
|
char img[256], *iptr;
|
||||||
|
token = mark+1;
|
||||||
|
if(!token) return;
|
||||||
|
sscanf(token, "%s", img);
|
||||||
|
iptr = img;
|
||||||
|
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);
|
||||||
|
printf("[%s]\n", iptr);
|
||||||
|
} } break; } } while(*(token++));
|
||||||
|
}
|
||||||
|
} else if(mystrcasecmp(token, "font")) {
|
||||||
|
#if 0
|
||||||
|
if(mode) {
|
||||||
|
cfmt.cfont = (WMFont *)WMGetFromBag(cfmt.fonts,
|
||||||
|
WMGetBagItemCount(cfmt.fonts)-1);
|
||||||
|
} else
|
||||||
|
(WMColor *)WMGetFromBag(cfmt.colors,
|
||||||
|
WMGetBagItemCount(cfmt.colors)-1),
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if(mystrcasecmp(token, "center")) {
|
||||||
|
printf("center\n");
|
||||||
|
if(mode) cfmt.align = WALeft;
|
||||||
|
else cfmt.align = WACenter;
|
||||||
|
cfmt.para = (cfmt.actions.createParagraph) (cfmt.fmargin, cfmt.bmargin,
|
||||||
|
WMWidgetWidth(tPtr)-30, NULL, 0, cfmt.align);
|
||||||
|
(cfmt.actions.insertParagraph) (tPtr, cfmt.para, cfmt.type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//printf("parse token (%s)[%s]\n", mode?"close":"open", token);
|
||||||
|
#if 0
|
||||||
|
i=0;
|
||||||
|
//while(*token && !isspace(*(token))) token++;
|
||||||
|
//printf("A:%d a:%d z%d Z%d\n", '1', 'a', 'Z', 'z');
|
||||||
|
do {
|
||||||
|
if(!mm) {
|
||||||
|
if(c>=65 && c<=122) { major[i++] = c;
|
||||||
|
} else if(c==' ' || c=='='){ major[i] = 0; i=0; mm=1;
|
||||||
|
printf("\nmajor: [%s]", major);}
|
||||||
|
} else {
|
||||||
|
if(c!=' ') {
|
||||||
|
minor[i++] = c;
|
||||||
|
} else { minor[i] = 0; i=0; printf(" minor: [%s] ", minor);}
|
||||||
|
}
|
||||||
|
}while((c = *(++token)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//printf("parse token (%s)[%s]\n", mode?"close":"open", token);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HTMLParser(WMWidget *w, void *clientData, short type)
|
||||||
|
{
|
||||||
|
static short init=1; /* have we been here at least once before? */
|
||||||
|
char *stream = (char *) clientData;
|
||||||
|
WMText *tPtr = (WMText *)w;
|
||||||
|
WMScreen *scr;
|
||||||
|
void *chunk;
|
||||||
|
char c;
|
||||||
|
#define MAX_TOKEN_SIZE 255
|
||||||
|
char token[MAX_TOKEN_SIZE+1];
|
||||||
|
#define MAX_TEXT_SIZE 1023
|
||||||
|
char text[MAX_TEXT_SIZE+1];
|
||||||
|
short mode=0;
|
||||||
|
short tk=0, txt=0;
|
||||||
|
short wasspace=0;
|
||||||
|
|
||||||
|
if(!tPtr || !stream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scr = (W_VIEW(tPtr))->screen;
|
||||||
|
cfmt.type = type;
|
||||||
|
if(init) {
|
||||||
|
cfmt.actions = WMGetTextParserActions(tPtr);
|
||||||
|
cfmt.fonts = WMCreateBag(4); /* there sould always be at least 1 font... */
|
||||||
|
cfmt.cfont = WMSystemFontOfSize(scr, 12);
|
||||||
|
WMPutInBag(cfmt.fonts, (void *)cfmt.cfont);
|
||||||
|
cfmt.colors = WMCreateBag(4);
|
||||||
|
cfmt.ccolor = WMBlackColor(scr);
|
||||||
|
WMPutInBag(cfmt.colors, (void *)cfmt.ccolor);
|
||||||
|
cfmt.i = cfmt.b = cfmt.u = cfmt.ul = 0;
|
||||||
|
cfmt.align = WALeft;
|
||||||
|
cfmt.fmargin = cfmt.bmargin = 0;
|
||||||
|
cfmt.para = (cfmt.actions.createParagraph) (cfmt.fmargin, cfmt.bmargin,
|
||||||
|
WMWidgetWidth(tPtr)-30, NULL, 0, cfmt.align);
|
||||||
|
(cfmt.actions.insertParagraph) (tPtr, cfmt.para, cfmt.type);
|
||||||
|
init = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
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;
|
||||||
|
|
||||||
|
if(c == '<' && !mode) {
|
||||||
|
mode=1;
|
||||||
|
if(txt>0) {
|
||||||
|
text[txt] = 0;
|
||||||
|
chunk = (cfmt.actions.createTChunk)(text, txt, cfmt.cfont,
|
||||||
|
cfmt.ccolor, 0, (cfmt.u?1:0));
|
||||||
|
(cfmt.actions.insertChunk) (tPtr, chunk, cfmt.type);
|
||||||
|
//printf("%s\n", text);
|
||||||
|
}
|
||||||
|
txt = 0;
|
||||||
|
} else if(c == '>' && mode) {
|
||||||
|
token[tk] = 0;
|
||||||
|
if(tk>0) parseToken(tPtr, token, tk);
|
||||||
|
mode=0;
|
||||||
|
tk=0;
|
||||||
|
} else {
|
||||||
|
if(mode) {
|
||||||
|
if(tk < MAX_TOKEN_SIZE) token[tk++] = c;
|
||||||
|
} else if(txt < MAX_TEXT_SIZE) text[txt++] = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tk>0) { token[tk] = 0; parseToken(tPtr, token, tk);}
|
||||||
|
if(txt>0) {
|
||||||
|
text[txt] = 0;
|
||||||
|
//printf("%s\n", text);
|
||||||
|
chunk = (cfmt.actions.createTChunk)(text, txt,
|
||||||
|
(WMFont *)WMGetFromBag(cfmt.fonts,
|
||||||
|
WMGetBagItemCount(cfmt.fonts)-1),
|
||||||
|
(WMColor *)WMGetFromBag(cfmt.colors,
|
||||||
|
WMGetBagItemCount(cfmt.colors)-1),
|
||||||
|
0, (cfmt.u?1:0));
|
||||||
|
(cfmt.actions.insertChunk) (tPtr, chunk, cfmt.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ================= the driver ================== */
|
||||||
|
|
||||||
|
WMWidget *win;
|
||||||
|
WMText *text;
|
||||||
|
|
||||||
|
void NotificationObserver(void *self, WMNotification *notif)
|
||||||
|
{
|
||||||
|
void *object = WMGetNotificationObject(notif);
|
||||||
|
unsigned short w = WMWidgetWidth(win);
|
||||||
|
unsigned short h = WMWidgetHeight(win);
|
||||||
|
|
||||||
|
if (WMGetNotificationName(notif) == WMViewSizeDidChangeNotification) {
|
||||||
|
if (object == WMWidgetView(win)) {
|
||||||
|
WMResizeWidget(text, w-20, h-20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{static int i=0;
|
||||||
|
switch(i++) {
|
||||||
|
case 0: WMSetTextHasHorizontalScroller(text, False); break;
|
||||||
|
case 1: WMSetTextHasVerticalScroller(text, False); break;
|
||||||
|
case 2: WMSetTextHasVerticalScroller(text, True); break;
|
||||||
|
case 3: WMSetTextHasHorizontalScroller(text, True); break;
|
||||||
|
default: i=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
Display *dpy;
|
||||||
|
WMScreen *scr;
|
||||||
|
|
||||||
|
|
||||||
|
WMInitializeApplication("WMText", &argc, argv);
|
||||||
|
dpy = XOpenDisplay(NULL);
|
||||||
|
if(!dpy) exit(1);
|
||||||
|
|
||||||
|
scr = WMCreateSimpleApplicationScreen(dpy);
|
||||||
|
|
||||||
|
win = WMCreateWindow(scr, "WMText Test");
|
||||||
|
WMRealizeWidget(win);
|
||||||
|
WMResizeWidget(win, 500, 300);
|
||||||
|
//WMResizeWidget(win, 900, 600);
|
||||||
|
WMSetWindowTitle(win,"WMText Test");
|
||||||
|
WMSetWindowCloseAction(win, Close, NULL);
|
||||||
|
|
||||||
|
text = WMCreateText(win);
|
||||||
|
WMRealizeWidget(text);
|
||||||
|
WMResizeWidget(text, 480, 280);
|
||||||
|
WMMoveWidget(text, 10, 10);
|
||||||
|
WMSetTextUseFixedPitchFont(text, False);
|
||||||
|
WMSetTextMonoFont(text, False);
|
||||||
|
WMSetTextParser(text, HTMLParser);
|
||||||
|
WMSetTextEditable(text, True);
|
||||||
|
WMFreezeText(text);
|
||||||
|
if(1){
|
||||||
|
FILE *f = fopen("./wm.html", "r");
|
||||||
|
char data[1024];
|
||||||
|
if(f) {
|
||||||
|
while(fgets(data, 1022,f))
|
||||||
|
WMAppendTextStream(text, data);
|
||||||
|
fclose(f);
|
||||||
|
} else {
|
||||||
|
WMAppendTextStream(text, "<i>can't</i> open the <u>wm.html</u> file, but here's a <B>text <I>stream <img src=foo.bar></I><BR>that</B> <U>needs</U> parsing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//WMPrependTextStream(text, "this is prepended\n");
|
||||||
|
//WMAppendTextStream(text, "blueplanet.rtf");
|
||||||
|
|
||||||
|
|
||||||
|
WMThawText(text);
|
||||||
|
WMRefreshText(text, 0, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
WMAddNotificationObserver(NotificationObserver, win,
|
||||||
|
WMViewSizeDidChangeNotification, WMWidgetView(win));
|
||||||
|
*/
|
||||||
|
WMSetViewNotifySizeChanges(WMWidgetView(win), True);
|
||||||
|
WMMapSubwidgets(win);
|
||||||
|
WMMapWidget(win);
|
||||||
|
|
||||||
|
WMScreenMainLoop(scr);
|
||||||
|
}
|
||||||
|
|
||||||
57
WINGs/upbtn.xpm
Normal file
57
WINGs/upbtn.xpm
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char * upbtn_xpm[] = {
|
||||||
|
"20 22 32 1",
|
||||||
|
" c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #FFFFFF",
|
||||||
|
"@ c #4A485A",
|
||||||
|
"# c #524052",
|
||||||
|
"$ c #4A595A",
|
||||||
|
"% c #5A596A",
|
||||||
|
"& c #4A486A",
|
||||||
|
"* c #5A595A",
|
||||||
|
"= c #52556A",
|
||||||
|
"- c #52406A",
|
||||||
|
"; c #6A556A",
|
||||||
|
"> c #5A6D6A",
|
||||||
|
", c #5A597B",
|
||||||
|
"' c #5A6D7B",
|
||||||
|
") c #6A557B",
|
||||||
|
"! c #6A6D7B",
|
||||||
|
"~ c #6A697B",
|
||||||
|
"{ c #6A698B",
|
||||||
|
"] c #7B797B",
|
||||||
|
"^ c #C5C2C5",
|
||||||
|
"/ c #6A818B",
|
||||||
|
"( c #6A7D7B",
|
||||||
|
"_ c #7B698B",
|
||||||
|
": c #6A798B",
|
||||||
|
"< c #7B799C",
|
||||||
|
"[ c #7B798B",
|
||||||
|
"} c #7B8D94",
|
||||||
|
"| c #7B81A4",
|
||||||
|
"1 c #8B85A4",
|
||||||
|
"2 c #73899C",
|
||||||
|
"3 c #7B89A4",
|
||||||
|
" ",
|
||||||
|
" .+ ",
|
||||||
|
" .@#+ ",
|
||||||
|
" .$%$&+ ",
|
||||||
|
" .*=*-*-+ ",
|
||||||
|
" .%%%%%%$%+ ",
|
||||||
|
" .%=%;%=*=*-+ ",
|
||||||
|
" .>%>,''>,>%=%+ ",
|
||||||
|
" .%)>)!~>)>)>=*#+ ",
|
||||||
|
" .>~'~'{'{'~',>%$@+ ",
|
||||||
|
" ]+++^{!{!~!)>+++++ ",
|
||||||
|
" ./{/{({'~+ ",
|
||||||
|
" ._:_:_!~>+ ",
|
||||||
|
" ./</</{'~+ ",
|
||||||
|
" .<<<[_({!+ ",
|
||||||
|
" .}|}</{(~+ ",
|
||||||
|
" .12<[_:{'+ ",
|
||||||
|
" .31}</{'~+ ",
|
||||||
|
" .12<[_!~>+ ",
|
||||||
|
" .2</</{''+ ",
|
||||||
|
" ]+++++++++ ",
|
||||||
|
" "};
|
||||||
37
WINGs/wm.html
Normal file
37
WINGs/wm.html
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<HTML><font size=-1>
|
||||||
|
<center>
|
||||||
|
<Img src=wm.png></b><p>
|
||||||
|
<b>GNU Window Maker</B><br>
|
||||||
|
<i>X11 Window Manager</i><p>
|
||||||
|
<u>http://windowmaker.org<br>
|
||||||
|
ftp.windowmaker.org</u></font><Br>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<b><i>Window Maker</b>
|
||||||
|
<Img src=upbtn.xpm></i>is the GNU window manager
|
||||||
|
for the X Window System. It was
|
||||||
|
designed to emulate the look and feel of part of the NEXTSTEP(tm) GUI. It's
|
||||||
|
supposed to be relatively fast and small, feature rich, easy to configure and
|
||||||
|
easy to use, with a simple and elegant appearance borrowed from NEXTSTEP(tm).
|
||||||
|
<p>
|
||||||
|
<b>Window Maker</b> was designed keeping integration with GNUstep in
|
||||||
|
mind and is the
|
||||||
|
"official" window manager for it. It is also part of the GNU project
|
||||||
|
(<u>www.gnu.org</u>)
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b>What is <i>GNUstep?</i></b><p>
|
||||||
|
<i><b>G</i>NU</b>step is a complete object-oriented development system, based on the
|
||||||
|
OpenStep specification released by NeXT(tm) (now Apple(tm)) and Sun(tm). It will provide everything one needs to produce cross-platform, object-oriented, graphical (and non-graphical) applications; providing among other things, base system libraries, a high-level GUI application framework that uses a Display PostScript(tm)-like imaging model (DGS), objects for accessing relational databases, distributed objects and a graphical development environment, with tools like interface modeller, a project management system
|
||||||
|
(project center) and other tools.
|
||||||
|
<p>
|
||||||
|
The GNUstep development system will be used to create a user environment,
|
||||||
|
with everything needed for a complete graphical user interface, such as a
|
||||||
|
file viewer, text editors and other applications. Note that the user
|
||||||
|
environment (or "desktop environment") is only a small part of the whole
|
||||||
|
GNUstep project and therefore it does not "compete" with other projects like
|
||||||
|
KDE or GNOME, simply because they are completely different things.
|
||||||
|
<p>
|
||||||
|
For more information on the GNUstep project, visit:
|
||||||
|
<u>http://www.gnustep.org</u> and <u>http://gnustep.current.nu</u>
|
||||||
|
</HTML>
|
||||||
BIN
WINGs/wm.png
Normal file
BIN
WINGs/wm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
643
WINGs/wruler.c
Normal file
643
WINGs/wruler.c
Normal file
@@ -0,0 +1,643 @@
|
|||||||
|
|
||||||
|
/* WMRuler: nifty ruler widget for WINGs (OK, for WMText ;-) */
|
||||||
|
/* Copyleft (>) 1999, 2000 Nwanua Elumeze <nwanua@colorado.edu> */
|
||||||
|
|
||||||
|
|
||||||
|
#include <WINGsP.h>
|
||||||
|
#include <WUtil.h>
|
||||||
|
#include <WMaker.h>
|
||||||
|
|
||||||
|
#include "wruler.h"
|
||||||
|
|
||||||
|
#define DEFAULT_X_OFFSET 22
|
||||||
|
#define MIN_DOC_WIDTH 200
|
||||||
|
#define DEFAULT_RULER_WIDTH 240
|
||||||
|
#define DEFAULT_RULER_HEIGHT 40
|
||||||
|
|
||||||
|
|
||||||
|
/* a pixel is defined here as 1/8 of an "inch" */
|
||||||
|
/* an "inch" is not the British unit inch... just so you know :-P */
|
||||||
|
|
||||||
|
typedef struct W_Ruler {
|
||||||
|
W_Class widgetClass;
|
||||||
|
W_View *view;
|
||||||
|
|
||||||
|
W_View *pview;
|
||||||
|
|
||||||
|
void *clientData;
|
||||||
|
WMAction *action, *moveaction;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int left, body, first, right, dleft;
|
||||||
|
} margins;
|
||||||
|
int which_marker;
|
||||||
|
|
||||||
|
int end;
|
||||||
|
int pressed;
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
unsigned int showtabs:1;
|
||||||
|
unsigned int buttonPressed:1;
|
||||||
|
} flags;
|
||||||
|
|
||||||
|
} Ruler;
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
resizeRuler(W_ViewDelegate *self, WMView *view)
|
||||||
|
{
|
||||||
|
Ruler *rPtr = (Ruler *)view->self;
|
||||||
|
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
|
||||||
|
W_ResizeView(rPtr->view, view->size.width,
|
||||||
|
DEFAULT_RULER_HEIGHT); /* more like DEFACTO_RULER_HEIGHT ;-) */
|
||||||
|
|
||||||
|
rPtr->end = view->size.width;
|
||||||
|
rPtr->margins.right = view->size.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
W_ViewDelegate _RulerViewDelegate =
|
||||||
|
{
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
resizeRuler,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
paintRuler(Ruler *rPtr)
|
||||||
|
{
|
||||||
|
GC gc;
|
||||||
|
XPoint points[6];
|
||||||
|
WMFont *font;
|
||||||
|
int i, j, xpos;
|
||||||
|
char c[3];
|
||||||
|
int actual_x;
|
||||||
|
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
|
||||||
|
if(!rPtr->view->flags.mapped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gc = WMColorGC(WMBlackColor(rPtr->view->screen));
|
||||||
|
font = WMSystemFontOfSize(rPtr->view->screen, 8);
|
||||||
|
|
||||||
|
|
||||||
|
WMDrawString(rPtr->view->screen, rPtr->view->window, gc,
|
||||||
|
font, rPtr->margins.dleft+2, 25, "0 inches", 10);
|
||||||
|
|
||||||
|
/* marker ticks */
|
||||||
|
j=0;
|
||||||
|
for(i=80; i<rPtr->view->size.width; i+=80) {
|
||||||
|
if(j<10)
|
||||||
|
snprintf(c,3,"%d",++j);
|
||||||
|
else
|
||||||
|
snprintf(c,3,"%2d",++j);
|
||||||
|
WMDrawString(rPtr->view->screen, rPtr->view->window, gc,
|
||||||
|
font, rPtr->margins.dleft+2+i, 25, c, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rPtr->flags.showtabs){
|
||||||
|
points[0].y = 9;
|
||||||
|
points[1].y = 15;
|
||||||
|
points[2].y = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0; i<rPtr->view->size.width; i+=40) {
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, rPtr->margins.dleft+i, 21, rPtr->margins.dleft+i, 31);
|
||||||
|
|
||||||
|
if(rPtr->flags.showtabs){
|
||||||
|
points[0].x = rPtr->margins.dleft+i+40;
|
||||||
|
points[1].x = points[0].x+6;
|
||||||
|
points[2].x = points[0].x;
|
||||||
|
XFillPolygon (rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
WMColorGC(WMDarkGrayColor(rPtr->view->screen)),
|
||||||
|
points, 3, Convex, CoordModeOrigin);
|
||||||
|
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
WMColorGC(WMDarkGrayColor(rPtr->view->screen)),
|
||||||
|
rPtr->margins.dleft+i, 18, rPtr->margins.dleft+i, 21);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0; i<rPtr->view->size.width; i+=20)
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, rPtr->margins.dleft+i, 21, rPtr->margins.dleft+i, 27);
|
||||||
|
|
||||||
|
for(i=0; i<rPtr->view->size.width-20; i+=10)
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, rPtr->margins.dleft+i, 21, rPtr->margins.dleft+i, 24);
|
||||||
|
|
||||||
|
/* guide the end marker in future drawings till next resize */
|
||||||
|
rPtr->end = i+12;
|
||||||
|
|
||||||
|
/* base line */
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, rPtr->margins.dleft, 21, rPtr->margins.left+i-10, 21);
|
||||||
|
|
||||||
|
|
||||||
|
/* Marker for right margin
|
||||||
|
|
||||||
|
/|
|
||||||
|
/ |
|
||||||
|
/__|
|
||||||
|
|
|
||||||
|
| */
|
||||||
|
|
||||||
|
xpos = rPtr->margins.right;
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
WMColorGC(WMDarkGrayColor(rPtr->view->screen)), xpos, 10, xpos, 20);
|
||||||
|
|
||||||
|
points[0].x = xpos+1;
|
||||||
|
points[0].y = 2;
|
||||||
|
points[1].x = points[0].x-6;
|
||||||
|
points[1].y = 9;
|
||||||
|
points[2].x = points[0].x-6;
|
||||||
|
points[2].y = 11;
|
||||||
|
points[3].x = points[0].x;
|
||||||
|
points[3].y = 11;
|
||||||
|
XFillPolygon (rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, points, 4, Convex, CoordModeOrigin);
|
||||||
|
|
||||||
|
|
||||||
|
/* Marker for left margin
|
||||||
|
|
||||||
|
|\
|
||||||
|
| \
|
||||||
|
|__\
|
||||||
|
|
|
||||||
|
| */
|
||||||
|
|
||||||
|
xpos = rPtr->margins.left;
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
WMColorGC(WMDarkGrayColor(rPtr->view->screen)), xpos, 10, xpos, 20);
|
||||||
|
|
||||||
|
points[0].x = xpos;
|
||||||
|
points[0].y = 3;
|
||||||
|
points[1].x = points[0].x+6;
|
||||||
|
points[1].y = 10;
|
||||||
|
points[2].x = points[0].x+6;
|
||||||
|
points[2].y = 11;
|
||||||
|
points[3].x = points[0].x;
|
||||||
|
points[3].y = 11;
|
||||||
|
XFillPolygon (rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, points, 4, Convex, CoordModeOrigin);
|
||||||
|
|
||||||
|
/*
|
||||||
|
points[3].x =
|
||||||
|
|
||||||
|
/* Marker for first line only
|
||||||
|
_____
|
||||||
|
|___|
|
||||||
|
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
xpos = rPtr->margins.first + rPtr->margins.dleft;
|
||||||
|
XFillRectangle(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, xpos-5, 7, 11, 5);
|
||||||
|
|
||||||
|
XDrawLine(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, xpos, 10, xpos, 20);
|
||||||
|
|
||||||
|
|
||||||
|
/* Marker for rest of body
|
||||||
|
_____
|
||||||
|
\ /
|
||||||
|
\./ */
|
||||||
|
|
||||||
|
|
||||||
|
xpos = rPtr->margins.body + rPtr->margins.dleft;
|
||||||
|
points[0].x = xpos-5;
|
||||||
|
points[0].y = 14;
|
||||||
|
points[1].x = points[0].x+11;
|
||||||
|
points[1].y = 14;
|
||||||
|
points[2].x = points[0].x+5;
|
||||||
|
points[2].y = 20;
|
||||||
|
XFillPolygon (rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
gc, points, 3, Convex, CoordModeOrigin);
|
||||||
|
|
||||||
|
|
||||||
|
if(!rPtr->flags.buttonPressed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* actual_x is used as a shortcut is all... */
|
||||||
|
switch(rPtr->which_marker){
|
||||||
|
case WRulerLeft: actual_x = rPtr->margins.left; break;
|
||||||
|
case WRulerBody:
|
||||||
|
actual_x = rPtr->margins.body + rPtr->margins.dleft;
|
||||||
|
break;
|
||||||
|
case WRulerFirst:
|
||||||
|
actual_x = rPtr->margins.first + rPtr->margins.dleft;
|
||||||
|
break;
|
||||||
|
case WRulerRight: actual_x = rPtr->margins.right; break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gc = WMColorGC(WMDarkGrayColor(rPtr->view->screen)),
|
||||||
|
|
||||||
|
XSetLineAttributes(rPtr->view->screen->display, gc, 1,
|
||||||
|
LineOnOffDash, CapNotLast, JoinMiter);
|
||||||
|
|
||||||
|
XDrawLine(rPtr->pview->screen->display, rPtr->pview->window,
|
||||||
|
gc, actual_x+1, 45, actual_x+1, rPtr->pview->size.height-5);
|
||||||
|
|
||||||
|
XSetLineAttributes(rPtr->view->screen->display, gc, 1,
|
||||||
|
LineSolid, CapNotLast, JoinMiter);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
whichMarker(Ruler *rPtr, int x, int y)
|
||||||
|
{
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
|
||||||
|
if(y>22)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(x<0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( rPtr->margins.dleft-x >= -6 && y <= 9 &&
|
||||||
|
rPtr->margins.dleft-x <=0 && y>=4)
|
||||||
|
return WRulerLeft;
|
||||||
|
|
||||||
|
if( rPtr->margins.right-x >= -1 && y <= 11 &&
|
||||||
|
rPtr->margins.right-x <=5 && y>=4)
|
||||||
|
return WRulerRight;
|
||||||
|
|
||||||
|
x -= rPtr->margins.dleft;
|
||||||
|
if(x<0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( rPtr->margins.first-x <= 4 && y<=12 &&
|
||||||
|
rPtr->margins.first-x >= -5 && y>=5)
|
||||||
|
return WRulerFirst;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if( rPtr->margins.body-x <= 4 && y<=19 &&
|
||||||
|
rPtr->margins.body-x >= -5 && y>=15)
|
||||||
|
return WRulerBody;
|
||||||
|
|
||||||
|
|
||||||
|
/* both first and body? */
|
||||||
|
if( rPtr->margins.first-x <= 4 && rPtr->margins.first-x >= -5
|
||||||
|
&& rPtr->margins.body-x <= 4 && rPtr->margins.body-x >= -5
|
||||||
|
&& y>=13 && y<=14)
|
||||||
|
return WRulerBoth;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
verifyMarkerMove(Ruler *rPtr, int x)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(rPtr->which_marker){
|
||||||
|
case WRulerLeft:
|
||||||
|
if(x < rPtr->margins.right-MIN_DOC_WIDTH &&
|
||||||
|
rPtr->margins.body + x <= rPtr->margins.right-MIN_DOC_WIDTH &&
|
||||||
|
rPtr->margins.first + x <= rPtr->margins.right-MIN_DOC_WIDTH)
|
||||||
|
rPtr->margins.left = x;
|
||||||
|
else return False;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case WRulerBody:
|
||||||
|
if(x < rPtr->margins.right-MIN_DOC_WIDTH && x >= rPtr->margins.left)
|
||||||
|
rPtr->margins.body = x - rPtr->margins.dleft;
|
||||||
|
else return False;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WRulerFirst:
|
||||||
|
if(x < rPtr->margins.right-MIN_DOC_WIDTH && x >= rPtr->margins.left)
|
||||||
|
rPtr->margins.first = x - rPtr->margins.dleft;
|
||||||
|
else return False;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WRulerRight:
|
||||||
|
if( x >= rPtr->margins.first+MIN_DOC_WIDTH &&
|
||||||
|
x >= rPtr->margins.body+MIN_DOC_WIDTH &&
|
||||||
|
x >= rPtr->margins.left+MIN_DOC_WIDTH &&
|
||||||
|
x <= rPtr->end)
|
||||||
|
rPtr->margins.right = x;
|
||||||
|
else return False;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WRulerBoth:
|
||||||
|
if( x < rPtr->margins.right-MIN_DOC_WIDTH && x >= rPtr->margins.left) {
|
||||||
|
rPtr->margins.first = x - rPtr->margins.dleft;
|
||||||
|
rPtr->margins.body = x - rPtr->margins.dleft;
|
||||||
|
} else return False;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default : return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
moveMarker(Ruler *rPtr, int x)
|
||||||
|
{
|
||||||
|
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
|
||||||
|
if(x < rPtr->offset || x > rPtr->end)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* restrictive ticks */
|
||||||
|
/*
|
||||||
|
if(x%10-2 != 0)
|
||||||
|
return;
|
||||||
|
*/
|
||||||
|
if(!verifyMarkerMove(rPtr, x))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* clear around the motion area */
|
||||||
|
#if 0
|
||||||
|
XClearWindow(rPtr->view->screen->display, rPtr->view->window);
|
||||||
|
#else
|
||||||
|
|
||||||
|
XClearArea(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
x-10, 3, 20, rPtr->view->size.height-4, False);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
{ //while(1) {
|
||||||
|
if (QLength(rPtr->view->screen->display) > 0 ) {
|
||||||
|
XEvent * event;
|
||||||
|
while(QLength(rPtr->view->screen->display) > 0 ) {
|
||||||
|
XNextEvent(rPtr->view->screen->display, event);
|
||||||
|
if(event->type == MotionNotify ||
|
||||||
|
event->type == ButtonRelease)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rPtr->pressed = x;
|
||||||
|
|
||||||
|
if(rPtr->moveaction)
|
||||||
|
(rPtr->moveaction)(rPtr, rPtr->clientData);
|
||||||
|
|
||||||
|
paintRuler(rPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handleEvents(XEvent *event, void *data)
|
||||||
|
{
|
||||||
|
Ruler *rPtr = (Ruler*)data;
|
||||||
|
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
|
||||||
|
|
||||||
|
switch (event->type) {
|
||||||
|
|
||||||
|
case Expose:
|
||||||
|
if(event->xexpose.count)
|
||||||
|
break;
|
||||||
|
if(rPtr->view->flags.realized)
|
||||||
|
paintRuler(rPtr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ButtonPress:
|
||||||
|
if(event->xbutton.button != Button1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rPtr->flags.buttonPressed = True;
|
||||||
|
rPtr->which_marker =
|
||||||
|
whichMarker(rPtr, event->xmotion.x,
|
||||||
|
event->xmotion.y);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* clear around the clicked area */
|
||||||
|
if(rPtr->which_marker>=0 && rPtr->which_marker <= 4) {
|
||||||
|
|
||||||
|
XClearArea(rPtr->view->screen->display, rPtr->view->window,
|
||||||
|
WMGetRulerMargin(rPtr, rPtr->which_marker)-10, 2, 20, 21, True);
|
||||||
|
|
||||||
|
paintRuler(rPtr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
paintRuler(rPtr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ButtonRelease:
|
||||||
|
if(event->xbutton.button != Button1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rPtr->flags.buttonPressed = False;
|
||||||
|
rPtr->pressed = event->xmotion.x;
|
||||||
|
if(rPtr->which_marker == 0) {
|
||||||
|
rPtr->margins.dleft = rPtr->margins.left;
|
||||||
|
|
||||||
|
/* clear entire (moved) ruler */
|
||||||
|
XClearArea(rPtr->view->screen->display,
|
||||||
|
rPtr->view->window, 0, 0, rPtr->view->size.width,
|
||||||
|
rPtr->view->size.height, True);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rPtr->action)
|
||||||
|
(rPtr->action)(rPtr, rPtr->clientData);
|
||||||
|
|
||||||
|
paintRuler(rPtr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MotionNotify:
|
||||||
|
if(rPtr->flags.buttonPressed &&
|
||||||
|
(event->xmotion.state & Button1Mask)) {
|
||||||
|
moveMarker(rPtr, event->xmotion.x);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WMRuler *
|
||||||
|
WMCreateRuler(WMWidget *parent)
|
||||||
|
{
|
||||||
|
Ruler *rPtr = wmalloc(sizeof(Ruler));
|
||||||
|
|
||||||
|
memset(rPtr, 0, sizeof(Ruler));
|
||||||
|
|
||||||
|
rPtr->widgetClass = WC_Ruler;
|
||||||
|
|
||||||
|
rPtr->view = W_CreateView(W_VIEW(parent));
|
||||||
|
if (!rPtr->view) {
|
||||||
|
free(rPtr);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
rPtr->view->self = rPtr;
|
||||||
|
|
||||||
|
W_ResizeView(rPtr->view, DEFAULT_RULER_WIDTH, DEFAULT_RULER_HEIGHT);
|
||||||
|
|
||||||
|
WMCreateEventHandler(rPtr->view, ExposureMask|StructureNotifyMask
|
||||||
|
|EnterWindowMask|LeaveWindowMask|FocusChangeMask
|
||||||
|
|ButtonReleaseMask|ButtonPressMask|KeyReleaseMask
|
||||||
|
|KeyPressMask|Button1MotionMask, handleEvents, rPtr);
|
||||||
|
|
||||||
|
rPtr->view->delegate = &_RulerViewDelegate;
|
||||||
|
|
||||||
|
rPtr->which_marker = WRulerLeft; /* none */
|
||||||
|
rPtr->pressed = 0;
|
||||||
|
|
||||||
|
|
||||||
|
rPtr->offset = DEFAULT_X_OFFSET;
|
||||||
|
rPtr->margins.left = DEFAULT_X_OFFSET;
|
||||||
|
rPtr->margins.dleft = DEFAULT_X_OFFSET;
|
||||||
|
rPtr->margins.body = 0; /* relative */
|
||||||
|
rPtr->margins.first = 0; /* relative */
|
||||||
|
rPtr->margins.right = 300+DEFAULT_X_OFFSET;
|
||||||
|
rPtr->end = 320+DEFAULT_X_OFFSET;
|
||||||
|
|
||||||
|
rPtr->flags.showtabs = False;
|
||||||
|
rPtr->flags.buttonPressed = False;
|
||||||
|
|
||||||
|
rPtr->pview = W_VIEW(parent);
|
||||||
|
|
||||||
|
return rPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMShowRulerTabs(WMRuler *rPtr, Bool show)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return;
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
rPtr->flags.showtabs = show;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetRulerMargin(WMRuler *rPtr, int which, int pixels)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if(pixels<rPtr->offset)
|
||||||
|
pixels = rPtr->offset;
|
||||||
|
|
||||||
|
rPtr->which_marker = which;
|
||||||
|
if(!verifyMarkerMove(rPtr, pixels))
|
||||||
|
return;
|
||||||
|
|
||||||
|
rPtr->pressed = pixels;
|
||||||
|
if(which == WRulerLeft)
|
||||||
|
rPtr->margins.dleft = rPtr->margins.left;
|
||||||
|
|
||||||
|
if(!rPtr->view->flags.realized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XClearArea(rPtr->view->screen->display,
|
||||||
|
rPtr->view->window, 0, 0, rPtr->view->size.width,
|
||||||
|
rPtr->view->size.height, True);
|
||||||
|
|
||||||
|
paintRuler(rPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
WMGetRulerMargin(WMRuler *rPtr, int which)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
|
||||||
|
switch(which) {
|
||||||
|
case WRulerLeft: return rPtr->margins.left; break;
|
||||||
|
case WRulerBody: return rPtr->margins.body; break;
|
||||||
|
case WRulerFirst: return rPtr->margins.first; break;
|
||||||
|
case WRulerRight: return rPtr->margins.right; break;
|
||||||
|
case WRulerBoth: return rPtr->margins.body; break;
|
||||||
|
case WRulerDocLeft: return rPtr->margins.dleft; break;
|
||||||
|
default: return rPtr->margins.dleft;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* _which_ one was released */
|
||||||
|
int
|
||||||
|
WMGetReleasedRulerMargin(WMRuler *rPtr)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return WRulerLeft;
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
if(rPtr->which_marker != -1)
|
||||||
|
return rPtr->which_marker;
|
||||||
|
else
|
||||||
|
return WRulerLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* _which_ one is being grabbed */
|
||||||
|
int
|
||||||
|
WMGetGrabbedRulerMargin(WMRuler *rPtr)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return WRulerLeft;
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
if(rPtr->which_marker != -1)
|
||||||
|
return rPtr->which_marker;
|
||||||
|
else
|
||||||
|
return WRulerLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetRulerOffset(WMRuler *rPtr, int pixels)
|
||||||
|
{
|
||||||
|
if(!rPtr || pixels<0)
|
||||||
|
return;
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
rPtr->offset = pixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
WMGetRulerOffset(WMRuler *rPtr)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return;
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
return rPtr->offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetRulerAction(WMRuler *rPtr, WMAction *action, void *clientData)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
rPtr->action = action;
|
||||||
|
rPtr->clientData = clientData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetRulerMoveAction(WMRuler *rPtr, WMAction *moveaction, void *clientData)
|
||||||
|
{
|
||||||
|
if(!rPtr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CHECK_CLASS(rPtr, WC_Ruler);
|
||||||
|
rPtr->moveaction = moveaction;
|
||||||
|
rPtr->clientData = clientData;
|
||||||
|
}
|
||||||
|
|
||||||
2803
WINGs/wtext.c
Normal file
2803
WINGs/wtext.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user