Пример #1
0
/////////////////////////////////////////////////////////////////////
//
// Edit Control object
//
//////////////////////////////////////////////////////////////////////
// @pymethod int|PyCEdit|FmtLines|Sets the formatting options for the control.
static PyObject *PyCEdit_fmt_lines(PyObject *self, PyObject *args)
{
	// @ comm Sets the inclusion of soft line-break characters on or off within a multiple-line edit control.
	// A soft line break consists of two carriage returns and a linefeed inserted at the end of a line that is 
	// broken because of word wrapping.
	// A hard line break consists of one carriage return and a linefeed. 
	// Lines that end with a hard line break are not affected by FmtLines. ~
	// This function is inly effective on multi-line edit controls.
	CEdit *pEdit = GetEditCtrl(self);
	BOOL format; // @pyparm int|bAddEOL||Specifies whether soft line-break characters are to be inserted.
	             // A value of TRUE inserts the characters; a value of FALSE removes them.
	if (!pEdit || !PyArg_ParseTuple(args, "i:FmtLines", &format))
		return NULL;
	GUI_BGN_SAVE;
	BOOL rc = pEdit->FmtLines( format ); // @pyseemfc CEdit|FmtLines
	GUI_END_SAVE;
	return Py_BuildValue("i", rc );
	// @rdesc Nonzero if any formatting occurs; otherwise 0.
}
Пример #2
0
BOOL CViewCodeDlg::OnInitDialog()
{
    CEdit* pEdit = (CEdit*)GetDlgItem(IDC_VIEWCODEEDITBOX);

    pEdit->FmtLines(TRUE);
    pEdit->SetWindowText( _T("howdy\015\012doody") );

    TCHAR* strTemplate = _T("   pd3dDevice->SetTextureStageState( %d, D3DTSS_%s%s );\015\012" );

    TCHAR buffer[2048];
    TCHAR strOutText[2048] = _T("");

    strcat( strOutText, _T("HRESULT SetShader( LPDIRECT3DDEVICE9 pd3dDevice )\015\012") );
    strcat( strOutText, _T("{\015\012") );

    sprintf( buffer, strTemplate, 0, _T("COLOROP,   D3DTOP_"), TranslateTextureOp( g_wT0COp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("COLORARG1, "), TranslateTextureArg( g_wT0CArg1 ) );
    if( g_wT0COp != D3DTOP_DISABLE && g_wT0COp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("COLORARG2, "), TranslateTextureArg( g_wT0CArg2 ) );
    if( g_wT0COp != D3DTOP_DISABLE && g_wT0COp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("COLORARG0, "), TranslateTextureArg( g_wT0CArg0 ) );
    if( g_wT0COp == D3DTOP_MULTIPLYADD || g_wT0COp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("ALPHAOP,   D3DTOP_"), TranslateTextureOp( g_wT0AOp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("ALPHAARG1, "), TranslateTextureArg( g_wT0AArg1 ) );
    if( g_wT0AOp != D3DTOP_DISABLE && g_wT0AOp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("ALPHAARG2, "), TranslateTextureArg( g_wT0AArg2 ) );
    if( g_wT0AOp != D3DTOP_DISABLE && g_wT0AOp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("ALPHAARG0, "), TranslateTextureArg( g_wT0AArg0 ) );
    if( g_wT0AOp == D3DTOP_MULTIPLYADD || g_wT0AOp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 0, _T("RESULTARG, "), TranslateTextureArg( g_wT0RArg ) );
    if( g_wT0RArg == D3DTA_TEMP )
        strcat( strOutText, buffer );
    strcat( strOutText, _T("\015\012") );

    sprintf( buffer, strTemplate, 1, _T("COLOROP,   D3DTOP_"), TranslateTextureOp( g_wT1COp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 1, _T("COLORARG1, "), TranslateTextureArg( g_wT1CArg1 ) );
    if( g_wT1COp != D3DTOP_DISABLE && g_wT1COp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );   
    sprintf( buffer, strTemplate, 1, _T("COLORARG2, "), TranslateTextureArg( g_wT1CArg2 ) );
    if( g_wT1COp != D3DTOP_DISABLE && g_wT1COp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 1, _T("COLORARG0, "), TranslateTextureArg( g_wT1CArg0 ) );
    if( g_wT1COp == D3DTOP_MULTIPLYADD || g_wT1COp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 1, _T("ALPHAOP,   D3DTOP_"), TranslateTextureOp( g_wT1AOp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 1, _T("ALPHAARG1, "), TranslateTextureArg( g_wT1AArg1 ) );
    if( g_wT1AOp != D3DTOP_DISABLE && g_wT1AOp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 1, _T("ALPHAARG2, "), TranslateTextureArg( g_wT1AArg2 ) );
    if( g_wT1AOp != D3DTOP_DISABLE && g_wT1AOp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 1, _T("ALPHAARG0, "), TranslateTextureArg( g_wT1AArg0 ) );
    if( g_wT1AOp == D3DTOP_MULTIPLYADD || g_wT1AOp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 1, _T("RESULTARG, "), TranslateTextureArg( g_wT1RArg ) );
    if( g_wT1RArg == D3DTA_TEMP )
        strcat( strOutText, buffer );
    strcat( strOutText, _T("\015\012") );

    sprintf( buffer, strTemplate, 2, _T("COLOROP,   D3DTOP_"), TranslateTextureOp( g_wT2COp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("COLORARG1, "), TranslateTextureArg( g_wT2CArg1 ) );
    if( g_wT2COp != D3DTOP_DISABLE && g_wT2COp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("COLORARG2, "), TranslateTextureArg( g_wT2CArg2 ) );
    if( g_wT2COp != D3DTOP_DISABLE && g_wT2COp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("COLORARG0, "), TranslateTextureArg( g_wT2CArg0 ) );
    if( g_wT2COp == D3DTOP_MULTIPLYADD || g_wT2COp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("ALPHAOP,   D3DTOP_"), TranslateTextureOp( g_wT2AOp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("ALPHAARG1, "), TranslateTextureArg( g_wT2AArg1 ) );
    if( g_wT2AOp != D3DTOP_DISABLE && g_wT2AOp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("ALPHAARG2, "), TranslateTextureArg( g_wT2AArg2 ) );
    if( g_wT2AOp != D3DTOP_DISABLE && g_wT2AOp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("ALPHAARG0, "), TranslateTextureArg( g_wT2AArg0 ) );
    if( g_wT2AOp == D3DTOP_MULTIPLYADD || g_wT2AOp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 2, _T("RESULTARG, "), TranslateTextureArg( g_wT2RArg ) );
    if( g_wT2RArg == D3DTA_TEMP )
        strcat( strOutText, buffer );
    strcat( strOutText, _T("\015\012") );

	sprintf( buffer, strTemplate, 3, _T("COLOROP,   D3DTOP_"), TranslateTextureOp( g_wT3COp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("COLORARG1, "), TranslateTextureArg( g_wT3CArg1 ) );
    if( g_wT3COp != D3DTOP_DISABLE && g_wT3COp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("COLORARG2, "), TranslateTextureArg( g_wT3CArg2 ) );
    if( g_wT3COp != D3DTOP_DISABLE && g_wT3COp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("COLORARG0, "), TranslateTextureArg( g_wT3CArg0 ) );
    if( g_wT3COp == D3DTOP_MULTIPLYADD || g_wT3COp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("ALPHAOP,   D3DTOP_"), TranslateTextureOp( g_wT3AOp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("ALPHAARG1, "), TranslateTextureArg( g_wT3AArg1 ) );
    if( g_wT3AOp != D3DTOP_DISABLE && g_wT3AOp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("ALPHAARG2, "), TranslateTextureArg( g_wT3AArg2 ) );
    if( g_wT3AOp != D3DTOP_DISABLE && g_wT3AOp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("ALPHAARG0, "), TranslateTextureArg( g_wT3AArg0 ) );
    if( g_wT3AOp == D3DTOP_MULTIPLYADD || g_wT3AOp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 3, _T("RESULTARG, "), TranslateTextureArg( g_wT3RArg ) );
    if( g_wT3RArg == D3DTA_TEMP )
        strcat( strOutText, buffer );
    strcat( strOutText, _T("\015\012") );

	    sprintf( buffer, strTemplate, 4, _T("COLOROP,   D3DTOP_"), TranslateTextureOp( g_wT4COp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("COLORARG1, "), TranslateTextureArg( g_wT4CArg1 ) );
    if( g_wT4COp != D3DTOP_DISABLE && g_wT4COp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("COLORARG2, "), TranslateTextureArg( g_wT4CArg2 ) );
    if( g_wT4COp != D3DTOP_DISABLE && g_wT4COp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("COLORARG0, "), TranslateTextureArg( g_wT4CArg0 ) );
    if( g_wT4COp == D3DTOP_MULTIPLYADD || g_wT4COp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("ALPHAOP,   D3DTOP_"), TranslateTextureOp( g_wT4AOp ) );
    strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("ALPHAARG1, "), TranslateTextureArg( g_wT4AArg1 ) );
    if( g_wT4AOp != D3DTOP_DISABLE && g_wT4AOp != D3DTOP_SELECTARG2 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("ALPHAARG2, "), TranslateTextureArg( g_wT4AArg2 ) );
    if( g_wT4AOp != D3DTOP_DISABLE && g_wT4AOp != D3DTOP_SELECTARG1 )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("ALPHAARG0, "), TranslateTextureArg( g_wT4AArg0 ) );
    if( g_wT4AOp == D3DTOP_MULTIPLYADD || g_wT4AOp == D3DTOP_LERP )
        strcat( strOutText, buffer );
    sprintf( buffer, strTemplate, 4, _T("RESULTARG, "), TranslateTextureArg( g_wT4RArg ) );
    if( g_wT4RArg == D3DTA_TEMP )
        strcat( strOutText, buffer );
    strcat( strOutText, _T("\015\012") );


    strcat( strOutText, _T("   DWORD dwNumPasses;\015\012") );
    strcat( strOutText, _T("   return pd3dDevice->ValidateDevice( &dwNumPasses );\015\012") );
    strcat( strOutText, _T("}\015\012") );

    pEdit->SetWindowText( strOutText );

    return CDialog::OnInitDialog();
}