Esempio n. 1
0
DRIVER_ERROR HeaderLJColor::StartSend ()
{
    DRIVER_ERROR err;
    char    res[72];
    int     iRes;

    iRes = thePrintContext->EffectiveResolutionY ();

    err = thePrinter->Send ((const BYTE*)UEL,sizeof(UEL));
    ERRCHECK;

    sprintf (res, "@PJL SET PAGEPROTECT=AUTO@PJL SET RESOLUTION=%d\015\012", iRes);
    err = thePrinter->Send ((const BYTE *) res, strlen (res));
    ERRCHECK;

    if (thePrinter->IOMode.bStatus)
    {
        sprintf (res, "@PJL JOB NAME = \"%ld\"\015\012", (long) (thePrinter));
        err = thePrinter->Send ((const BYTE *) res, strlen (res));
        ERRCHECK;
    }

    QUALITY_MODE    eQ = QUALITY_NORMAL;
    COLORMODE       eC;
    MEDIATYPE       eM;
    BOOL            bD;

    thePrintContext->GetPrintModeSettings (eQ, eM, eC, bD);

    if (eQ == QUALITY_DRAFT)
    {
        strcpy (res, "@PJL SET RET=OFF\015\012@PJL SET ECONOMODE=ON\015\012");
        err = thePrinter->Send ((const BYTE *) res, strlen (res));
        ERRCHECK;
    }

    if (thePrinter->IOMode.bStatus)
    {
        strcpy (res, "@PJL USTATUSOFF\015\012@PJL USTATUS DEVICE = ON\015\012@PJL USTATUS JOB = ON\015\012");
        err = thePrinter->Send ((const BYTE *) res, strlen (res));
        ERRCHECK;
    }

//  Duplexing directive

    strcpy (res, "@PJL SET DUPLEX=OFF\015\012");

#ifdef APDK_AUTODUPLEX
    DUPLEXMODE  dupmode = thePrintContext->QueryDuplexMode ();
    if (dupmode != DUPLEXMODE_NONE)
    {
        strcpy (res, "@PJL SET DUPLEX=ON\015\012@PJL SET BINDING=");
        if (dupmode == DUPLEXMODE_BOOK)
            strcat (res, "LONGEDGE\015\012");
        else
            strcat (res, "SHORTEDGE\015\012");
    }
#endif

    err = thePrinter->Send ((const BYTE *) res, strlen (res));


    err = thePrinter->Send ((const BYTE*) EnterLanguage, sizeof (EnterLanguage));
    ERRCHECK;

    err = thePrinter->Send ((const BYTE*) "PCL\015\012", 5);
    ERRCHECK;

    err = thePrinter->Send ((const BYTE*) Reset,sizeof (Reset));
    ERRCHECK;

    sprintf (res, "\033&l%dH", thePrintContext->GetMediaSource ());
    err = thePrinter->Send ((const BYTE *) res, strlen (res));		// Source
    ERRCHECK;

//  Media size, vertical spacing between lines and top margin

    memcpy (res, mediasize, mscount - 1);
    strcpy (res+mscount-1, "a8c0E");
    err = thePrinter->Send ((const BYTE *) res, strlen (res));
    ERRCHECK;

    sprintf (res, "\033*t%dR\033&u%dD", iRes, iRes);
    err=thePrinter->Send ((const BYTE*) res, strlen (res));
    ERRCHECK;

    err = Margins ();
    ERRCHECK;
    CAPy = 0;

//  Default is single sided printing

    strcpy (res, "\033&l0S");

#ifdef APDK_AUTODUPLEX
    DUPLEXMODE  eDupMode = thePrintContext->QueryDuplexMode ();
    if (eDupMode != DUPLEXMODE_NONE)
    {
        sprintf (res, "\033&l%dS", (eDupMode == DUPLEXMODE_BOOK) ? 1 : 2);
    }
#endif
    err = thePrinter->Send ((const BYTE *) res, strlen (res));
    ERRCHECK;

    /*
     *  Set orientation to Portrait. APDK supports printing in Portrait mode only.
     *  If users desire Landscape printing, application/gluecode will have to
     *  rearrange the rasters appropriately.
     */

    err = thePrinter->Send ((const BYTE *) "\033&l0O", 5);

    // Number of copies
    sprintf (res, "\033&l%dX", thePrintContext->GetCopyCount ());
    err = thePrinter->Send ((const BYTE *) res, strlen (res));
    ERRCHECK;

    return err;
}
Esempio n. 2
0
ExerciseView::ExerciseView(const ExerciseModel *model)
{
	mListener = nullptr;
	
	mModel = model;
	mModel->Ref();

	FlatWidget *bg = new FlatWidget(MakeVec2(0,0),MakeVec4(1,1,1,.3f));
	AddChild(bg, LayoutChildParams(
		Margins(16),
		Alignment::FillAlignment,
		Alignment::FillAlignment));
	bg->Unref();

	mHeaderLabel = new Label(u8"Вопрос","Helvetica",32);
	mHeaderLabel->SetColor(MakeVec4(0,0,0,1));
	AddChild(mHeaderLabel,LayoutChildParams(
		Margins(32),
		Alignment::CenterAlignment,
		Alignment::MinAlignment));

	mContentLayout = new LinearLayout(LinearLayout::DirectionVertical);
	AddChild(mContentLayout,LayoutChildParams(
		Margins(32),
		Alignment::CenterAlignment,
		Alignment::CenterAlignment));

	mQuestionLabel = new Label(model->mQuestion.c_str(),"Helvetica",48);
	mQuestionLabel->SetColor(MakeVec4(0,.2f,.4f,1));
	mContentLayout->AddChild(mQuestionLabel,LayoutChildParams(
		Margins(0),
		Alignment::CenterAlignment,
		Alignment::CenterAlignment));

	mAnswerLabel = new Label(model->mAnswer.c_str(),"Helvetica",48);
	mAnswerLabel->SetColor(MakeVec4(.1f,.3f,.1f,1));
	mContentLayout->AddChild(mAnswerLabel,LayoutChildParams(
		Margins(0),
		Alignment::CenterAlignment,
		Alignment::CenterAlignment));

	mButtonsLayout = new LinearLayout(LinearLayout::DirectionHorizontal);
	AddChild(mButtonsLayout,LayoutChildParams(
		Margins(32),
		Alignment::FillAlignment,
		Alignment::MaxAlignment));

	mCorrectBtn = new RateButton("Correct",MakeVec4(.2f,.6f,.3f,1),MakeVec4(0,1,0,.5f));
	mCorrectBtn->SetListener(this);
	mButtonsLayout->AddChild(mCorrectBtn,LinearLayout::LinearLayoutChildParams(
		Margins(0),
		Alignment::FillAlignment,
		Alignment::FillAlignment,
		1));

	mWrongBtn = new RateButton("Wrong",MakeVec4(.6f,.3f,.2f,1),MakeVec4(1,0,0,.5f));
	mWrongBtn->SetListener(this);
	mButtonsLayout->AddChild(mWrongBtn,LinearLayout::LinearLayoutChildParams(
		Margins(0),
		Alignment::FillAlignment,
		Alignment::FillAlignment,
		1));
}