コード例 #1
0
ファイル: show-types.c プロジェクト: pbroadbery/fricas-svn
static void
show_input(TextNode *node)
{
    /*XFontStruct *old_font;*/
    XWindowChanges wc;
    /*int twidth, boxwidth, old_color;*/
    /*Window root, child;*/
    /*int root_x, root_y, win_x, win_y, buttons;*/
    InputItem *item;
    char *inpbuffer;

    item = node->link->reference.string;
    inpbuffer = item->curr_line->buffer;

    wc.border_width = 0;
    wc.x = node->x;
    wc.y = node->y + gRegionOffset + y_off - node->height + 2;
    wc.height = node->height - 2;
    wc.width = node->width;
    if (pix_visible(node->y, node->height)) {
        XConfigureWindow(gXDisplay, node->link->win,
                         CWX | CWY | CWHeight | CWWidth | CWBorderWidth,
                         &wc);
        XMapWindow(gXDisplay, node->link->win);
    }
    XFlush(gXDisplay);
    draw_inputsymbol(item);
}
コード例 #2
0
void BaseTreeItem::setVisible(bool _visible)
{
	if (showIcon_)
	{
		if (_visible != visible_)
		{
			visible_ = _visible;
			if (visible_)
			{
				QPixmap pix_visible((const char**) image0_data);
				setIcon(0, QIcon(pix_visible));
			} else
			{
				QPixmap pix_not_visible((const char**) image1_data);
				setIcon(0, QIcon(pix_not_visible));
			}
		}
	}
}
コード例 #3
0
ファイル: show-types.c プロジェクト: pbroadbery/fricas-svn
void
show_text(TextNode *node, int Ender)
{
    /*int twidth, len;*/
    /*int otext_x, otext_y, t;*/
    /*XFontStruct *old_font;*/
    /*int old_color;*/

    for (; node != NULL; node = node->next) {
        switch (node->type) {
        case 0:
        case Beginitems:
        case Begintitems:
        case Bound:
        case Center:
        case Free:
        case HSpace:
        case Indent:
        case Indentrel:
        case Item:
        case Macro:
        case Mbox:
        case Newline:
        case Noop:
        case Par:
        case Pound:
        case Rbrace:
        case Space:
        case Tab:
        case Table:
        case Titem:
        case VSpace:
            break;

        case Dash:
        case Fi:
        case Ifcond:
            if (visible(node->y, node->height)) {
                if (strlen(node->data.text) > 1) {
                    XDrawLine(gXDisplay, gWindow->fDisplayedWindow, gWindow->fStandardGC, node->x,
                              node->y + gRegionOffset + y_off
                              - gTopOfGroupStack->cur_font->descent -
                              word_off_height,
                              node->x + node->width,
                              node->y + gRegionOffset + y_off - word_off_height -
                              gTopOfGroupStack->cur_font->descent);
                }
                else {
                    XDrawString(gXDisplay, gWindow->fDisplayedWindow, gWindow->fStandardGC, node->x, node->y +
                                gRegionOffset - gTopOfGroupStack->cur_font->descent + y_off,
                                node->data.text, 1);
                }
            }
            else {
                if (above(node->y))
                    need_scroll_up_button = 1;
                else if (below(node->y))
                    need_scroll_down_button = 1;
            }
            break;

        case Lsquarebrace:
        case Math:
        case Punctuation:
        case Rsquarebrace:
        case Spadsrctxt:
        case WindowId:
        case Word:
            if (visible(node->y, node->height))
                XDrawString(gXDisplay, gWindow->fDisplayedWindow, gWindow->fStandardGC, node->x, node->y +
                            gRegionOffset - gTopOfGroupStack->cur_font->descent + y_off,
                            node->data.text, node->width);
            else {
                if (above(node->y))
                    need_scroll_up_button = 1;
                else if (below(node->y))
                    need_scroll_down_button = 1;
            }
            break;

        case Verbatim:
            push_group_stack();
            tt_top_group();
            if (visible(node->y, node->height))
                XDrawString(gXDisplay, gWindow->fDisplayedWindow, gWindow->fStandardGC, node->x, node->y +
                            gRegionOffset - gTopOfGroupStack->cur_font->descent + y_off,
                            node->data.text, node->width);
            else {
                if (above(node->y))
                    need_scroll_up_button = 1;
                else if (below(node->y))
                    need_scroll_down_button = 1;
            }
            pop_group_stack();
            break;

        case Horizontalline:
            if (visible(node->y, node->height)) {
                line_top_group();
                XDrawLine(gXDisplay, gWindow->fDisplayedWindow, gWindow->fStandardGC, 0,
                          node->y + gRegionOffset + y_off,
                          gWindow->width,
                          node->y + gRegionOffset + y_off);
                pop_group_stack();
            }
            else {
                if (above(node->y))
                    need_scroll_up_button = 1;
                else if (below(node->y))
                    need_scroll_down_button = 1;
            }
            break;

        case Box:
            if (visible(node->y, node->height))
                XDrawRectangle(gXDisplay, gWindow->fDisplayedWindow, gWindow->fStandardGC,
                               node->x,
                               node->y + gRegionOffset + y_off - node->height,
                               node->width,
                               node->height);
            else {
                if (above(node->y))
                    need_scroll_up_button = 1;
                else if (below(node->y))
                    need_scroll_down_button = 1;
            }
            break;


        case Downlink:
        case Link:
        case LispDownLink:
        case LispMemoLink:
        case Lispcommand:
        case Lispcommandquit:
        case Lisplink:
        case Lispwindowlink:
        case Memolink:
        case Qspadcall:
        case Qspadcallquit:
        case Returnbutton:
        case Spadcall:
        case Spadcallquit:
        case Spaddownlink:
        case Spadlink:
        case Spadmemolink:
        case Unixcommand:
        case Unixlink:
        case Upbutton:
        case Windowlink:
            if (pix_visible(node->y, node->height))
                show_link(node);
            break;

        case Spadcommand:
        case Spadgraph:
        case Spadsrc:
            show_spadcommand(node);
            break;

        case Pastebutton:
            if (visible(node->y, node->height))
                show_pastebutton(node);
            break;

        case Paste:
            show_paste(node);
            break;

        case Group:
        case Tableitem:
            push_group_stack();
            break;

        case Controlbitmap:
            show_image(node, gWindow->fControlGC);
            break;

        case Inputbitmap:
            show_image(node, gWindow->fStandardGC);
            break;

        case Inputpixmap:
            show_image(node, gWindow->fStandardGC);
            break;

        case BoldFace:
            bf_top_group();
            break;

        case Emphasize:
            if (gTopOfGroupStack->cur_font == gRmFont)
                em_top_group();
            else
                rm_top_group();
            break;

        case It:
            em_top_group();
            break;

        case Sl:
        case Rm:
            rm_top_group();
            break;

        case Tt:
            tt_top_group();
            break;

        case Inputstring:
            show_input(node);
            break;

        case Radiobox:
        case SimpleBox:
            show_simple_box(node);
            break;

        case Beep:
            LoudBeepAtTheUser();
            break;

        case Description:
            bf_top_group();
            break;

        case Endspadsrc:
        case Endspadcommand:
            gInAxiomCommand = 1;
        case Endtableitem:
        case Enddescription:
        case Endpastebutton:
        case Endlink:
        case Endbutton:
        case Endgroup:
            pop_group_stack();
        case Endverbatim:
        case Endmath:
        case Endbox:
        case Endtable:
        case Endmbox:
        case Endparameter:
        case Endpaste:
        case Endinputbox:
        case Endcenter:
        case Endmacro:
        case Endif:
        case Endtitems:
        case Enditems:

            /*
             * Now since I can show specific regions of the text, then at
             * this point I should check to see if I am the end
             */
            if (node->type == Ender)
                return;
            break;
        case Endfooter:
        case Endscrolling:
        case Endheader:
        case Endtitle:

            /*
             * regardless of what ender I have, I always terminate showing
             * with one of these
             */
            return;
        default:
            fprintf(stderr, "Show_text: Unknown Node Type %d\n", node->type);
            break;
        }
    }
}
コード例 #4
0
ファイル: show-types.c プロジェクト: pbroadbery/fricas-svn
static void
show_image(TextNode *node, GC gc)
{
    int src_x, src_y, src_width, src_height, dest_x, dest_y, ret_val;

    if (!pix_visible(node->y, node->height))
        return;
    if (node->image.xi == NULL)
        return;

    dest_x = node->x;
    src_x = 0;
    src_y = 0;
    dest_y = node->y + gRegionOffset - node->height + y_off;
    need_scroll_up_button = 1;
    if (node->width > (right_margin - node->x))
        src_width = right_margin - node->x;
    else
        src_width = node->width;

    if (gDisplayRegion != Scrolling) {
        src_y = 0;
        src_height = node->image.xi->height;
    }
    else {
        /* I may have only a partial image */
        if (dest_y < 0) {       /* the top is cut off */
            src_y = -dest_y;
            dest_y = 0;
            src_height = node->image.xi->height - src_y;
        }
        else if (dest_y + node->image.xi->height > gWindow->scrollheight) {
            /* the bottom is cut off */
            src_y = 0;
            src_height = gWindow->scrollheight - dest_y;
        }
        else {                  /* the whole thing is visible */
            src_y = 0;
            src_height = node->image.xi->height;
        }
    }

    ret_val = XPutImage(gXDisplay, gWindow->fDisplayedWindow, gc,
                        node->image.xi, src_x, src_y, dest_x, dest_y,
                        src_width, src_height);

    switch (ret_val) {
    case BadDrawable:
        fprintf(stderr, "(HyperDoc: show_image) bad drawable\n");
        break;
    case BadGC:
        fprintf(stderr, "(HyperDoc: show_image) bad GC");
        break;
    case BadMatch:
        fprintf(stderr, "(HyperDoc: show_image) bad match");
        break;
    case BadValue:
#ifndef HP9platform
        fprintf(stderr, "(HyperDoc: show_image) bad value");
#endif /* HP complains about this*/
        break;
    }
}