コード例 #1
0
/*
 * DebugScreen -- swap to debugger screen
 */
bool DebugScreen( void )
{
    if( FlipMech == FLIP_SWAP ) {
        ToCharacter();
        WndDirty( NULL );
        return( FALSE );
    } else {
        return( TRUE );
    }
}
コード例 #2
0
void SCA_KeyboardSensor::AddToTargetProp(int keyIndex)
{
	if (IsPrintable(keyIndex)) {
		CValue* tprop = GetParent()->GetProperty(m_targetprop);
		
		if (tprop) {
			/* overwrite the old property */
			if (IsDelete(keyIndex)) {
				/* strip one char, if possible */
				STR_String newprop = tprop->GetText();
				int oldlength = newprop.Length();
				if (oldlength >= 1 ) {
					int newlength=oldlength;

					BLI_str_cursor_step_prev_utf8(newprop, newprop.Length(), &newlength);
					newprop.SetLength(newlength);

					CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);
					GetParent()->SetProperty(m_targetprop, newstringprop);
					newstringprop->Release();
				}				
			} else {
				/* append */
				char pchar = ToCharacter(keyIndex, IsShifted());
				STR_String newprop = tprop->GetText() + pchar;
				CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);			
				GetParent()->SetProperty(m_targetprop, newstringprop);
				newstringprop->Release();
			}
		} else {
			if (!IsDelete(keyIndex)) {
				/* Make a new property. Deletes can be ignored. */
				char pchar = ToCharacter(keyIndex, IsShifted());
				STR_String newprop = pchar;
				CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);			
				GetParent()->SetProperty(m_targetprop, newstringprop);
				newstringprop->Release();
			}
		}
	}
	
}
コード例 #3
0
void InitScreen( void )
{
    if( FlipMech == FLIP_SWAP ) {
        InitSwapper( WantFast );
    }
    if( FlipMech == FLIP_SWAP ) {
        ToCharacter();
    }
    uistart();
    UIData->height = ScrnLines;
    if( _IsOn( SW_USE_MOUSE ) ) {
        GUIInitMouse( 1 );
    }
}
コード例 #4
0
int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance,
                    LPSTR lpCmdLine, int nShowCmd ) {

    EVENT               ev;
    SAREA               area;
    char                buff[80];
    an_event_string     *ptr;
    ORD                 evrow = TOP_ROW;
    BOOL                fixup = FALSE;
    int                 mrow, mcol;
    int                 diff;

    hInstance = hInstance;
    hPrevInstance = hPrevInstance;
    lpCmdLine = lpCmdLine;
    nShowCmd = nShowCmd;
    if( InitSwapper() ) return( 0 ); // Yes - well, I would make the swapper
                                     // return 1 on error, unlike everything
                                     // else, wouldn't I?
    if( !uistart() ) return( 0 );
    ToCharacter();

    initmouse( 2 );
    uimenus( barmenu, pulldownuimenus, EV_FUNC( 1 ) );
    UIData->mouse_clk_delay = uiclockdelay( 250 );
    UIData->tick_delay = uiclockdelay( 3000 );
    mainwin.area.height = UIData->height - 7;

    area.row = 0;
    area.col = 0;
    area.width = UIData->width;
    area.height = UIData->height;
    uidirty( area );
    uirefresh();

    if( uivopen( &mainwin ) ) {
        uirefresh();
        sprintf( buff, "screen height : %d\0", UIData->height );
        uivtextput( &mainwin, TOP_ROW - 1, 2,
                  UIData->attrs[ ATTR_NORMAL ],
                  buff, 30 );
        for( ; ; ) {
            uipushlist( evlist );
            ev = uivgetevent( NULL );
            uipoplist();
            if( ev == EV_QUIT ) break;
            if( ev == EV_ALT_R ) break;
            if( ev == EV_MOUSE_PRESS_R ) {
                uimousepos( NULL, &mrow, &mcol );
                mrow++;
                mcol++;
                uipushlist( evlist );
                ev = uicreatepopup( mrow, mcol, &filemenu, FALSE, TRUE, NULL );
                uipoplist();
            }
            switch ( ev ) {
                case EV_SAMPLE_DIALOG:
                    sample_dialog();
                    break;
                case EV_OPEN:
                    open();
                    break;
                case EV_FUNC(1):
                    area.width = 10;
                    area.height = 10;
                    area.row = 1;
                    area.col = 1;
                    uivattribute( &mainwin, area, (ATTR) 1 );
                    break;
                case EV_CURSOR_RIGHT:
                    mainwin.col++;
                    if( mainwin.col >= mainwin.area.width ) mainwin.col--;
                    fixup = TRUE;
                    break;
                case EV_CURSOR_DOWN:
                    mainwin.row++;
                    if( mainwin.row >= mainwin.area.height ) mainwin.row--;
                    fixup = TRUE;
                    break;
                case EV_CURSOR_LEFT:
                    if( mainwin.col > 0 ) {
                        mainwin.col--;
                        fixup = TRUE;
                    }
                    break;
                case EV_CURSOR_UP:
                    if( mainwin.row > 0 ) {
                        mainwin.row--;
                        fixup = TRUE;
                    }
                    break;
            }
            if( fixup ) {
                fixup = FALSE;
                uivsetcursor( &mainwin );
            }
            if( ev != EV_NO_EVENT ) {
                for( ptr=evstrs; ; ++ptr ){
                    if( ptr->ev == EV_NO_EVENT ) {
                        sprintf( buff, "event 0x%4.4x", ev );
                        break;
                    } else if( ptr->ev == ev ) {
                        strcpy( buff, ptr->str );
                        break;
                    }
                }
                uivtextput( &mainwin, evrow, 2,
                          UIData->attrs[ ATTR_NORMAL ],
                          buff, 30 );
                if( ++evrow >= mainwin.area.height ){
                    evrow = TOP_ROW;
                }
                uivtextput( &mainwin, evrow, 2,
                          UIData->attrs[ ATTR_NORMAL ],
                          "", 30 );
                switch( ev ) {
                case EV_MOUSE_PRESS:
                    BandOn = 1;
                    uimousepos( NULL, &mrow, &mcol );
                    BandArea.row = mrow;
                    BandArea.col = mcol;
                    BandArea.width = 0;
                    BandArea.height = 0;
                    uibandinit( BandArea, UIData->attrs[ ATTR_ACTIVE ] );
                    break;
                case EV_MOUSE_DRAG:
                    if( BandOn ) {
                        uimousepos( NULL, &mrow, &mcol );
                        diff = mcol - BandArea.col;
                        if( diff < 0 ) diff = 0;
                        BandArea.width = diff;
                        diff = mrow - BandArea.row;
                        if( diff < 0 ) diff = 0;
                        BandArea.height = diff;
                        uibandmove( BandArea );
                    }
                    break;
                case EV_MOUSE_RELEASE:
                    if( BandOn ) uibandfini();
                    BandOn = 0;
                    break;
                }
            }
        }
        uivclose( &mainwin );
    }
    uinomenus();
    uiswap();
    uirestorebackground();      /* must be after uiswap */
    finimouse();
    ToGraphical();
    uistop();
    FiniSwapper();
    return( 0 );
}