Exemplo n.º 1
0
int main (int argc, char** argv)
{
	long lresult;
	char* sresult;
	if (argc != 1)
	{
		fprintf(stderr, "usage: %s\n", argv[0]);
		exit(1);
	}
	
	lresult = bin_date();
	printf("time is %ld\n", lresult);
	sresult = str_date(lresult);
	printf("data is %s", sresult);
	return 0;
}
void panel_draw(HDC hdc,panel_t *panel)
{
    WCHAR buf[BUFLEN];
    POINT p;
    HRGN rgn=0;
    int cur_i;
    int i;
    int idofs=PAN_ENT*panel->index+PAN_ENT;
    int x=Xp(panel),y=Yp(panel);
    int ofsx=D(PNLITEM_OFSX),ofsy=D(PNLITEM_OFSY);
    int wy=D(PANEL_WY+idofs);

    if(XP(panel)<0)return;
    //if(panel_lasti/256!=panel->index)return;

    GetCursorPos(&p);
    ScreenToClient(hMain,&p);
    cur_i=panel_hitscan(panel,p.x,p.y);

    if(!D(PANEL_WY+idofs))return;
    for(i=0;i<panel->items[0].action_id+1;i++)
    {
        if(i==1&&panel->index==0)
        {
            wsprintf(buf,L"%s",STR(STR_SYSINF_MOTHERBOARD));
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+SYSINFO_COL1,y+ofsy,buf,wcslen(buf));

            wsprintf(buf,L"%s",STR(STR_SYSINF_ENVIRONMENT));
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+SYSINFO_COL2,y+ofsy,buf,wcslen(buf));
        }
        if(i==2&&panel->index==0)
        {
            wsprintf(buf,L"%s (%d-bit)",get_winverstr(manager_g),manager_g->matcher->state->architecture?64:32);
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL0,y+ofsy,buf,wcslen(buf));

            wsprintf(buf,L"%s",state_getproduct(manager_g->matcher->state));
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL1,y+ofsy,buf,wcslen(buf));

            wsprintf(buf,L"%s",STR(STR_SYSINF_WINDIR));
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL2,y+ofsy,buf,wcslen(buf));

            wsprintf(buf,L"%s",manager_g->matcher->state->text+manager_g->matcher->state->windir);
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL3,y+ofsy,buf,wcslen(buf));
        }
        if(i==3&&panel->index==0)
        {
            if(XP(panel)<10+SYSINFO_COL1)
                wsprintf(buf,L"%s",state_getproduct(manager_g->matcher->state));
            else
                wsprintf(buf,L"%s",manager_g->matcher->state->platform.szCSDVersion);

            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL0,y+ofsy,buf,wcslen(buf));

            wsprintf(buf,L"%s: %s",STR(STR_SYSINF_TYPE),STR(isLaptop?STR_SYSINF_LAPTOP:STR_SYSINF_DESKTOP));
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL1,y+ofsy,buf,wcslen(buf));

            wsprintf(buf,L"%s",STR(STR_SYSINF_TEMP));
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL2,y+ofsy,buf,wcslen(buf));

            wsprintf(buf,L"%s",manager_g->matcher->state->text+manager_g->matcher->state->temp);
            SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
            TextOut(hdc,x+ofsx+10+SYSINFO_COL3,y+ofsy,buf,wcslen(buf));
        }
        if(panel->items[i].type==TYPE_GROUP_BREAK&&!expertmode)break;
        switch(panel->items[i].type)
        {
            case TYPE_CHECKBOX:
                drawcheckbox(hdc,x+ofsx,y+ofsy,D(CHKBOX_SIZE)-2,D(CHKBOX_SIZE)-2,panel->items[i].checked,i==cur_i);
                SetTextColor(hdc,D(i==cur_i?CHKBOX_TEXT_COLOR_H:CHKBOX_TEXT_COLOR));
                TextOut(hdc,x+D(CHKBOX_TEXT_OFSX)+ofsx,y+ofsy,STR(panel->items[i].str_id),wcslen(STR(panel->items[i].str_id)));
                if(i==cur_i&&kbpanel)drawrectsel(hdc,x+ofsx,y+ofsy,x+XP(panel)-ofsx,y+ofsy+wy,0xff00,1);
                y+=D(PNLITEM_WY);
                break;

            case TYPE_BUTTON:
                if(panel->index>=8&&panel->index<=10&&D(PANEL_OUTLINE_WIDTH+idofs)<0)
                    box_draw(hdc,x+ofsx,y+ofsy,x+XP(panel)-ofsx,y+ofsy+wy,i==cur_i?BOX_PANEL_H+panel->index*2+2:BOX_PANEL+panel->index*2+2);
                else
                    box_draw(hdc,x+ofsx,y+ofsy,x+XP(panel)-ofsx,y+ofsy+wy-1,i==cur_i?BOX_BUTTON_H:BOX_BUTTON);

                SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
                if(i==1&&panel->index==8)
                {
                    int j,cnt=0;
                    itembar_t *itembar;

                    itembar=&manager_g->items_list[RES_SLOTS];
                    for(j=RES_SLOTS;j<manager_g->items_handle.items;j++,itembar++)
                    if(itembar->checked)cnt++;

                    wsprintf(buf,L"%s (%d)",STR(panel->items[i].str_id),cnt);
                    TextOut(hdc,x+ofsx+wy/2,y+ofsy+(wy-D(FONT_SIZE)-2)/2,buf,wcslen(buf));
                }
                else
                    TextOut(hdc,x+ofsx+wy/2,y+ofsy+(wy-D(FONT_SIZE)-2)/2,STR(panel->items[i].str_id),wcslen(STR(panel->items[i].str_id)));

                y+=D(PNLITEM_WY);
                break;

            case TYPE_TEXT:
                if(i==1&&panel->index==7)
                {
                    version_t v;

                    v.d=atoi(SVN_REV_D);
                    v.m=atoi(SVN_REV_M);
                    v.y=SVN_REV_Y;

                    wsprintf(buf,L"%s (",TEXT(SVN_REV2));
                    str_date(&v,buf+wcslen(buf));
                    wcscat(buf,L")");
                    SetTextColor(hdc,D(CHKBOX_TEXT_COLOR));
                    TextOut(hdc,x+ofsx,y+ofsy,buf,wcslen(buf));
                }
                SetTextColor(hdc,D(i==cur_i&&i>11?CHKBOX_TEXT_COLOR_H:CHKBOX_TEXT_COLOR));
                TextOut(hdc,x+ofsx,y+ofsy,STR(panel->items[i].str_id),wcslen(STR(panel->items[i].str_id)));
                y+=D(PNLITEM_WY);
                break;

            case TYPE_GROUP_BREAK:
            case TYPE_GROUP:
                if(panel->index>=8&&panel->index<=10)break;
                if(i)y+=D(PNLITEM_WY);
                box_draw(hdc,x,y,x+XP(panel),y+(wy)*panel->items[i].action_id+ofsy*2,
                         BOX_PANEL+panel->index*2+2);
                rgn=CreateRectRgn(x,y,x+XP(panel),y+(wy)*panel->items[i].action_id+ofsy*2);
                SelectClipRgn(hdc,rgn);
                break;

            default:
                break;
        }

    }
    if(rgn)
    {
        SelectClipRgn(hdc,0);
        DeleteObject(rgn);
    }
}