mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-04 04:44:16 +01:00
lotsa new features
This commit is contained in:
@@ -632,6 +632,7 @@ paintText(Text *tPtr)
|
|||||||
done = False;
|
done = False;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* first, which direction? Don't waste time looking all over,
|
/* first, which direction? Don't waste time looking all over,
|
||||||
since the parts to be drawn will most likely be near what
|
since the parts to be drawn will most likely be near what
|
||||||
was previously drawn */
|
was previously drawn */
|
||||||
@@ -669,7 +670,8 @@ _getSibling:
|
|||||||
/* first, place all text that can be viewed */
|
/* first, place all text that can be viewed */
|
||||||
while (!done && tb) {
|
while (!done && tb) {
|
||||||
|
|
||||||
if(tb->blank) {tb->text[0] = 'F'; }
|
/* paragraph diagnostic
|
||||||
|
if(tb->blank) {tb->text[0] = 'F'; } */
|
||||||
|
|
||||||
if (tb->graphic) {
|
if (tb->graphic) {
|
||||||
tb = tb->next;
|
tb = tb->next;
|
||||||
@@ -870,6 +872,7 @@ mouseOverObject(Text *tPtr, int x, int y)
|
|||||||
if(!result)
|
if(!result)
|
||||||
tPtr->flags.isOverGraphic = 0;
|
tPtr->flags.isOverGraphic = 0;
|
||||||
|
|
||||||
|
|
||||||
tPtr->view->attribs.cursor = (result?
|
tPtr->view->attribs.cursor = (result?
|
||||||
tPtr->view->screen->defaultCursor
|
tPtr->view->screen->defaultCursor
|
||||||
: tPtr->view->screen->textCursor);
|
: tPtr->view->screen->textCursor);
|
||||||
@@ -936,7 +939,7 @@ updateCursorPosition(Text *tPtr)
|
|||||||
if(tPtr->tpos > tb->used)
|
if(tPtr->tpos > tb->used)
|
||||||
tPtr->tpos = tb->used;
|
tPtr->tpos = tb->used;
|
||||||
|
|
||||||
for(s=0; s<tb->nsections; s++) {
|
for(s=0; s<tb->nsections-1; s++) {
|
||||||
|
|
||||||
if(tPtr->tpos >= tb->sections[s].begin
|
if(tPtr->tpos >= tb->sections[s].begin
|
||||||
&& tPtr->tpos <= tb->sections[s].end)
|
&& tPtr->tpos <= tb->sections[s].end)
|
||||||
@@ -955,9 +958,20 @@ updateCursorPosition(Text *tPtr)
|
|||||||
tPtr->cursor.h = h;
|
tPtr->cursor.h = h;
|
||||||
tPtr->cursor.x = x;
|
tPtr->cursor.x = x;
|
||||||
|
|
||||||
// printf("y:%d vpos%d\n", y,
|
|
||||||
//tPtr->vpos-tPtr->visible.h+tPtr->visible.y);
|
/* scroll the bars if the cursor is not visible */
|
||||||
// tPtr->vpos = y - tPtr->visible.y;
|
if(tPtr->flags.editable && tPtr->cursor.x != -23) {
|
||||||
|
if(tPtr->cursor.y+tPtr->cursor.h
|
||||||
|
> tPtr->vpos+tPtr->visible.y+tPtr->visible.h) {
|
||||||
|
tPtr->vpos +=
|
||||||
|
(tPtr->cursor.y+tPtr->cursor.h+10
|
||||||
|
- (tPtr->vpos+tPtr->visible.y+tPtr->visible.h));
|
||||||
|
} else if(tPtr->cursor.y < tPtr->vpos+tPtr->visible.y) {
|
||||||
|
tPtr->vpos -= (tPtr->vpos+tPtr->visible.y-tPtr->cursor.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
updateScrollers(tPtr);
|
updateScrollers(tPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,10 +1091,7 @@ _doneV:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (tb->sections[s].x <= x)
|
if (tb->sections[s].x <= x)
|
||||||
{
|
|
||||||
printf("BREAK\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dir? tb->next : tb->prior)) {
|
if ((dir? tb->next : tb->prior)) {
|
||||||
@@ -1153,6 +1164,21 @@ _doneH:
|
|||||||
tPtr->cursor.h = tb->sections[s].h;
|
tPtr->cursor.h = tb->sections[s].h;
|
||||||
tPtr->cursor.y = tb->sections[s]._y;
|
tPtr->cursor.y = tb->sections[s]._y;
|
||||||
|
|
||||||
|
/* scroll the bars if the cursor is not visible */
|
||||||
|
if(tPtr->flags.editable && tPtr->cursor.x != -23) {
|
||||||
|
if(tPtr->cursor.y+tPtr->cursor.h
|
||||||
|
> tPtr->vpos+tPtr->visible.y+tPtr->visible.h) {
|
||||||
|
tPtr->vpos +=
|
||||||
|
(tPtr->cursor.y+tPtr->cursor.h+10
|
||||||
|
- (tPtr->vpos+tPtr->visible.y+tPtr->visible.h));
|
||||||
|
updateScrollers(tPtr);
|
||||||
|
} else if(tPtr->cursor.y < tPtr->vpos+tPtr->visible.y) {
|
||||||
|
tPtr->vpos -= (tPtr->vpos+tPtr->visible.y-tPtr->cursor.y);
|
||||||
|
updateScrollers(tPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1470,7 +1496,8 @@ layOutLine(Text *tPtr, myLineItems *items, int nitems, int x, int y)
|
|||||||
+ line_height - WMWidgetHeight(wdt);
|
+ line_height - WMWidgetHeight(wdt);
|
||||||
tb->sections[n].w = WMWidgetWidth(wdt);
|
tb->sections[n].w = WMWidgetWidth(wdt);
|
||||||
} else {
|
} else {
|
||||||
tb->sections[n].y = y + line_height -tb->d.pixmap->height + max_d;
|
tb->sections[n].y = y + line_height
|
||||||
|
+ max_d - tb->d.pixmap->height;
|
||||||
tb->sections[n].w = tb->d.pixmap->width;
|
tb->sections[n].w = tb->d.pixmap->width;
|
||||||
}
|
}
|
||||||
x += tb->sections[n].w;
|
x += tb->sections[n].w;
|
||||||
@@ -1506,7 +1533,6 @@ layOutDocument(Text *tPtr)
|
|||||||
WMFont *font;
|
WMFont *font;
|
||||||
unsigned int x, y=0, lw = 0, width=0, bmargin;
|
unsigned int x, y=0, lw = 0, width=0, bmargin;
|
||||||
char *start=NULL, *mark=NULL;
|
char *start=NULL, *mark=NULL;
|
||||||
unsigned int old_y;
|
|
||||||
|
|
||||||
if ( tPtr->flags.frozen || (!(tb = tPtr->firstTextBlock)) )
|
if ( tPtr->flags.frozen || (!(tb = tPtr->firstTextBlock)) )
|
||||||
return;
|
return;
|
||||||
@@ -1542,15 +1568,6 @@ layOutDocument(Text *tPtr)
|
|||||||
tb = tb->prior;
|
tb = tb->prior;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a hack to get to the bottom, fix */
|
|
||||||
if(!tb->graphic) {
|
|
||||||
;
|
|
||||||
#if 0
|
|
||||||
WMFont *font = tPtr->flags.monoFont?tPtr->dFont:tb->d.font;
|
|
||||||
y -= 2*(font->height - tb->d.font->y);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tb->prior && tb->prior->sections && tb->prior->nsections>0) {
|
if(tb->prior && tb->prior->sections && tb->prior->nsections>0) {
|
||||||
y = tb->prior->sections[tb->prior->nsections-1]._y +
|
y = tb->prior->sections[tb->prior->nsections-1]._y +
|
||||||
tb->prior->sections[tb->prior->nsections-1].h -
|
tb->prior->sections[tb->prior->nsections-1].h -
|
||||||
@@ -1575,7 +1592,6 @@ _layOut:
|
|||||||
WMDestroyTextBlock(tPtr, WMRemoveTextBlock(tPtr));
|
WMDestroyTextBlock(tPtr, WMRemoveTextBlock(tPtr));
|
||||||
tb = next;
|
tb = next;
|
||||||
tb->first = True;
|
tb->first = True;
|
||||||
printf("yep that was me :-)\n");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1621,7 +1637,7 @@ printf("yep that was me :-)\n");
|
|||||||
font = tPtr->flags.monoFont?tPtr->dFont:tb->d.font;
|
font = tPtr->flags.monoFont?tPtr->dFont:tb->d.font;
|
||||||
|
|
||||||
while (start) {
|
while (start) {
|
||||||
mark = strchr(start, ' ');//, tb->used);
|
mark = strchr(start, ' ');
|
||||||
if (mark) {
|
if (mark) {
|
||||||
end += (int)(mark-start)+1;
|
end += (int)(mark-start)+1;
|
||||||
start = mark+1;
|
start = mark+1;
|
||||||
@@ -1675,7 +1691,8 @@ printf("yep that was me :-)\n");
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(tPtr->flags.laidOut
|
/* not yet fully ready. but is already VERY FAST for a 3Mbyte file ;-) */
|
||||||
|
if(0&&tPtr->flags.laidOut
|
||||||
&& tb->next && tb->next->sections && tb->next->nsections>0
|
&& tb->next && tb->next->sections && tb->next->nsections>0
|
||||||
&& (tPtr->vpos + tPtr->visible.h
|
&& (tPtr->vpos + tPtr->visible.h
|
||||||
< tb->next->sections[0]._y)) {
|
< tb->next->sections[0]._y)) {
|
||||||
@@ -2249,6 +2266,12 @@ handleWidgetPress(XEvent *event, void *data)
|
|||||||
tPtr->flags.isOverGraphic = 2;
|
tPtr->flags.isOverGraphic = 2;
|
||||||
tPtr->tpos = 0;
|
tPtr->tpos = 0;
|
||||||
output(tb->text, tb->used);
|
output(tb->text, tb->used);
|
||||||
|
#if 0
|
||||||
|
if (!tPtr->flags.focused) {
|
||||||
|
WMSetFocusToWidget(tPtr);
|
||||||
|
tPtr->flags.focused = True;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2339,14 +2362,11 @@ handleActionEvents(XEvent *event, void *data)
|
|||||||
char desc[tb->used+1];
|
char desc[tb->used+1];
|
||||||
memcpy(desc, tb->text, tb->used);
|
memcpy(desc, tb->text, tb->used);
|
||||||
desc[tb->used] = 0;
|
desc[tb->used] = 0;
|
||||||
printf("has delegate %p\n", tPtr->delegate);
|
|
||||||
if(tPtr->delegate) {
|
if(tPtr->delegate) {
|
||||||
if(tPtr->delegate->didDoubleClickOnPicture)
|
if(tPtr->delegate->didDoubleClickOnPicture)
|
||||||
printf("has didDoubleClickOnPicture%p\n",
|
|
||||||
tPtr->delegate->didDoubleClickOnPicture);
|
|
||||||
(*tPtr->delegate->didDoubleClickOnPicture)
|
(*tPtr->delegate->didDoubleClickOnPicture)
|
||||||
(tPtr->delegate, desc);
|
(tPtr->delegate, desc);
|
||||||
} else printf("you clicked on %s\n", desc);
|
}
|
||||||
} else {
|
} else {
|
||||||
autoSelectText(tPtr, 2);
|
autoSelectText(tPtr, 2);
|
||||||
}
|
}
|
||||||
@@ -2450,11 +2470,7 @@ handleEvents(XEvent *event, void *data)
|
|||||||
|
|
||||||
if(tPtr->hS) {
|
if(tPtr->hS) {
|
||||||
if (!(W_VIEW(tPtr->hS))->flags.realized)
|
if (!(W_VIEW(tPtr->hS))->flags.realized)
|
||||||
{
|
|
||||||
printf("expose\n");
|
|
||||||
WMRealizeWidget(tPtr->hS);
|
WMRealizeWidget(tPtr->hS);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tPtr->vS) {
|
if(tPtr->vS) {
|
||||||
@@ -2624,6 +2640,7 @@ prepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
|||||||
|
|
||||||
char *badbadbad;
|
char *badbadbad;
|
||||||
|
|
||||||
|
static void
|
||||||
receivedData(WMView *view, Atom selection, Atom target, Time timestamp,
|
receivedData(WMView *view, Atom selection, Atom target, Time timestamp,
|
||||||
void *cdata, WMData *data)
|
void *cdata, WMData *data)
|
||||||
{
|
{
|
||||||
@@ -2662,6 +2679,7 @@ wwarning("could not request data for dropped data");
|
|||||||
XSendEvent(scr->display, info->sourceWindow, False, 0, &ev);
|
XSendEvent(scr->display, info->sourceWindow, False, 0, &ev);
|
||||||
XFlush(scr->display);
|
XFlush(scr->display);
|
||||||
}
|
}
|
||||||
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
@@ -3056,6 +3074,7 @@ WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w,
|
|||||||
memset(tb->text, 0, len);
|
memset(tb->text, 0, len);
|
||||||
memcpy(tb->text, description, len);
|
memcpy(tb->text, description, len);
|
||||||
tb->used = len;
|
tb->used = len;
|
||||||
|
tb->text[tb->used] = 0;
|
||||||
tb->blank = False;
|
tb->blank = False;
|
||||||
tb->d.widget = w;
|
tb->d.widget = w;
|
||||||
tb->color = WMRetainColor(color);
|
tb->color = WMRetainColor(color);
|
||||||
@@ -3097,6 +3116,7 @@ WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p,
|
|||||||
memset(tb->text, 0, len);
|
memset(tb->text, 0, len);
|
||||||
memcpy(tb->text, description, len);
|
memcpy(tb->text, description, len);
|
||||||
tb->used = len;
|
tb->used = len;
|
||||||
|
tb->text[tb->used] = 0;
|
||||||
tb->blank = False;
|
tb->blank = False;
|
||||||
tb->d.pixmap = WMRetainPixmap(p);
|
tb->d.pixmap = WMRetainPixmap(p);
|
||||||
tb->color = WMRetainColor(color);
|
tb->color = WMRetainColor(color);
|
||||||
|
|||||||
Reference in New Issue
Block a user