Ejemplo n.º 1
0
Archivo: ui.c Proyecto: notadecent/uTox
static void panel_draw_sub(PANEL *p, int x, int y, int width, int height)
{
    FUNC();

    if(p->content_scroll) {
        pushclip(x, y, width, height);

        y -= scroll_gety(p->content_scroll, height);
    }


    if(p->type) {
        drawfunc[p->type - 1](p, x, y, width, height);
    } else {
        if(p->drawfunc) {
            p->drawfunc(x, y, width, height);
        }
    }

    PANEL **pp = p->child, *subp;
    if(pp) {
        while((subp = *pp++)) {
            if(!subp->disabled) {
                panel_draw_sub(subp, x, y, width, height);
            }
        }
    }

    if(p->content_scroll) {
        popclip();
    }
}
Ejemplo n.º 2
0
Archivo: ui.c Proyecto: notadecent/uTox
void panel_draw(PANEL *p, int x, int y, int width, int height)
{
    FUNC();

    pushclip(x, y, width, height);

    if(p->type) {
        drawfunc[p->type - 1](p, x, y, width, height);
    } else {
        if(p->drawfunc) {
            p->drawfunc(x, y, width, height);
        }
    }

    PANEL **pp = p->child, *subp;
    if(pp) {
        while((subp = *pp++)) {
            if(!subp->disabled) {
                panel_draw_sub(subp, x, y, width, height);
            }
        }
    }

    popclip();

    enddraw(x, y, width, height);
}
Ejemplo n.º 3
0
Archivo: ui.c Proyecto: Matsu616/uTox
static void panel_draw_core(PANEL *p, int x, int y, int width, int height) {
    FIX_XY_CORDS_FOR_SUBPANELS();

    if (p->content_scroll) {
        pushclip(x, y, width, height);
        y -= scroll_gety(p->content_scroll, height);
    }

    if (p->type) {
        drawfunc[p->type - 1](p, x, y, width, height);
    } else {
        if (p->drawfunc) {
            p->drawfunc(x, y, width, height);
        }
    }

    PANEL **pp = p->child;
    if (pp) {
        PANEL *subp;
        while ((subp = *pp++)) {
            if (!subp->disabled) {
                panel_draw_core(subp, x, y, width, height);
            }
        }
    }

    if (p->content_scroll) {
        popclip();
    }
}
Ejemplo n.º 4
0
static boolean ccdrawmsg (void) {
	
	/*
	2.1b5 dmb: don't need flbitmapactive logic; openbitmap will return 
	false if one's already open.
	*/
	
	register hdlcancoonrecord hc = cancoonglobals;
	//register hdlwindowinfo hw = aboutwindowinfo;
	register hdlstring hstring;
	register boolean flbitmap = false;
	bigstring bs;
	Rect r;
	
	if (hc == nil || aboutdata == nil)
		return (false);
	
	pushaboutstyle ();
	
	ccgetmsgrect (&r);
	
	flbitmap = openbitmap (r, aboutwindow);
	
	if (!flbitmap)
		pushclip (r);

	eraserect (r);
	
	/*
	grayframerect (r);
	*/
	
	hstring = (**hc).hprimarymsg;
	
	/*
	if (hstring == nil) /%no primary message, display file name%/
		hstring = (**hw).hfilename;
	*/
	
	copyheapstring (hstring, bs);
	
//	centerstring (r, bs);
	
	movepento (r.left, r.top + globalfontinfo.ascent);
	
	pendrawstring (bs);
	
	popstyle ();
	
	if (flbitmap)
		closebitmap (aboutwindow);
	else
		popclip ();
	
	return (true);
	} /*ccdrawmsg*/
Ejemplo n.º 5
0
boolean aboutsetmiscstring (bigstring bsmisc) {
	
	#ifdef WIN95VERSION
	extern 	DWORD ixthreadglobalsgrabcount;			// Tls index of counter for nest globals grabbing

	long grabcount = (long) TlsGetValue (ixthreadglobalsgrabcount);
	#endif

//	register hdlcancoonrecord hc = cancoonglobals;
//	hdlwindowinfo hinfo;

	copystring (bsmisc, bsmiscinfo);

//	if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow))
//		return (false);
	
	#ifdef WIN95VERSION
	if (grabcount > 0)
	#endif
	if (aboutport != nil && flhavemiscrect) {
		//Code change by Timothy Paustian Monday, August 21, 2000 4:17:36 PM
		//We cannot just pass a window or dialog ptr to pushport. It's doing
		//an implicit cast. This will not work on OS X
		CGrafPtr	thePort;
		#if TARGET_API_MAC_CARBON == 1
		thePort = GetWindowPort((WindowRef) aboutport);
		#else
		thePort = (CGrafPtr)aboutport;		
		#endif
		pushport(thePort);
			
			pushclip (miscinforect);
			
			eraserect (miscinforect);
			
			movepento (miscinforect.left, miscinforect.top + globalfontinfo.ascent);
			
			pendrawstring (bsmisc);
			
			popclip ();

		popport ();
		}
	
//	shellpopglobals ();

	return (true);
	} /*aboutsetmiscstring*/
Ejemplo n.º 6
0
static boolean scrollbarpushclip (hdlscrollbar hscrollbar) {
	
	/*
	11/19/90 DW: patch things up for the table displayer, and perhaps others in
	the future.  if the scrollbar is of trivial height, we disable the drawing
	that's about to happen.  we were getting one-pixel high scrollbars being
	drawn.
	*/
	
	Rect r = (**hscrollbar).contrlRect;
	
	if ((r.bottom - r.top) == 1)
		r.bottom = r.top;
		
	return (pushclip (r));
	} /*scrollbarpushclip*/
Ejemplo n.º 7
0
void edit_draw(EDIT *edit, int x, int y, int width, int height)
{
    if((width - 4 * SCALE - SCROLL_WIDTH) < 0) {
        return;
    }

    if(utox_window_baseline && y > utox_window_baseline - font_small_lineheight - 4 * SCALE) {
        y = utox_window_baseline - font_small_lineheight - 4 * SCALE;
    }

    edit->width = width -4 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0);
    edit->height = height - 4 * SCALE;

    if(!edit->noborder) {
        framerect(x, y, x + width, y + height, (edit == active_edit) ? BLUE : (edit->mouseover ? C_GRAY2 : C_GRAY));
    }
    drawrect(x + 1, y + 1, x + width - 1, y + height - 1, WHITE);

    setfont(FONT_TEXT);
    setcolor(COLOR_TEXT);

    int yy = y;

    if(edit->multiline) {
        pushclip(x + 1, y + 1, width - 2, height - 2);

        SCROLLABLE *scroll = edit->scroll;
        scroll->content_height = text_height(width - 4 * SCALE - SCROLL_WIDTH, font_small_lineheight, edit->data, edit->length) + 4 * SCALE;
        scroll_draw(scroll, x, y, width, height);
        yy -= scroll_gety(scroll, height);
    }


    if(!edit->length && maybe_i18nal_string_is_valid(&edit->empty_str)) {
        STRING* empty_str_text = maybe_i18nal_string_get(&edit->empty_str);
        setcolor(C_GRAY2);
        drawtext(x + 2 * SCALE, yy + 2 * SCALE, empty_str_text->str, empty_str_text->length);
    }

    _Bool a = (edit == active_edit);
    drawtextmultiline(x + 2 * SCALE, x + width - 2 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0), yy + 2 * SCALE, y, y + height, font_small_lineheight, edit->data, edit->length,
                      a ? edit_sel.start : STRING_IDX_MAX, a ? edit_sel.length : STRING_IDX_MAX, edit->multiline);

    if(edit->multiline) {
        popclip();
    }
}
Ejemplo n.º 8
0
void appdrawmessage (hdlappwindow appwindow) {
	
	if (app.hasmessagearea) {
		
		hdlappwindow ha = appwindow;
		WindowPtr w = (**ha).macwindow;
		Rect r = (**ha).messagerect;
		Rect rerase, rtext;
		bigstring bs;
		boolean flbitmap = false;
		
		pushmacport (w);
		
		/*flbitmap = openbitmap (r, w);*/
		
		pushclip (r);
		
		rerase = r; rerase.top++; rerase.right--; eraserect (rerase);
		
		pushforecolor (&blackcolor);
		
		MoveTo (r.left, r.top); LineTo (r.right, r.top);
		
		popforecolor ();
		
		texthandletostring ((**ha).hmessage, bs);
	
		pushstyle (messagefont, messagesize, messagestyle);
		
		rtext = r;
		
		InsetRect (&rtext, 1, 1);
	
		centerstring (rtext, bs);
	
		popstyle ();
		
		popclip ();
		
		if (flbitmap)
			closebitmap (w);
		
		popmacport ();
		}
	} /*appdrawmessage*/
Ejemplo n.º 9
0
boolean aboutsetmiscstring (bigstring bsmisc) {
	
	#ifdef WIN95VERSION
	extern 	DWORD ixthreadglobalsgrabcount;			// Tls index of counter for nest globals grabbing

	long grabcount = (long) TlsGetValue (ixthreadglobalsgrabcount);
	#endif

//	register hdlcancoonrecord hc = cancoonglobals;
//	hdlwindowinfo hinfo;

	copystring (bsmisc, bsmiscinfo);

//	if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow))
//		return (false);
	
	#ifdef WIN95VERSION
	if (grabcount > 0)
	#endif
	if (aboutport != nil && flhavemiscrect) {
		
		pushport (aboutport);
		
			pushclip (miscinforect);
			
			eraserect (miscinforect);
			
			movepento (miscinforect.left, miscinforect.top + globalfontinfo.ascent);
			
			pendrawstring (bsmisc);
			
			popclip ();

		popport ();
		}
	
//	shellpopglobals ();

	return (true);
	} /*aboutsetmiscstring*/