Пример #1
0
    /// handle specialized clipboard text, with leading "(fp_lib_table", OR
    /// spreadsheet formatted text.
    void paste_text( const wxString& cb_text ) override
    {
        FP_LIB_TABLE_GRID* tbl = (FP_LIB_TABLE_GRID*) m_grid->GetTable();
        size_t             ndx = cb_text.find( "(fp_lib_table" );

        if( ndx != std::string::npos )
        {
            // paste the FP_LIB_TABLE_ROWs of s-expression (fp_lib_table), starting
            // at column 0 regardless of current cursor column.

            STRING_LINE_READER  slr( TO_UTF8( cb_text ), "Clipboard" );
            LIB_TABLE_LEXER     lexer( &slr );
            FP_LIB_TABLE        tmp_tbl;
            bool                parsed = true;

            try
            {
                tmp_tbl.Parse( &lexer );
            }
            catch( PARSE_ERROR& pe )
            {
                DisplayError( m_dialog, pe.What() );
                parsed = false;
            }

            if( parsed )
            {
                // make sure the table is big enough...
                if( tmp_tbl.GetCount() > (unsigned) tbl->GetNumberRows() )
                    tbl->AppendRows( tmp_tbl.GetCount() - tbl->GetNumberRows() );

                for( unsigned i = 0;  i < tmp_tbl.GetCount();  ++i )
                    tbl->rows.replace( i, tmp_tbl.At( i ).clone() );
            }

            m_grid->AutoSizeColumns( false );
        }
        else
        {
            // paste spreadsheet formatted text.
            GRID_TRICKS::paste_text( cb_text );

            m_grid->AutoSizeColumns( false );
        }
    }
Пример #2
0
bool DataAccess::Exec(ParameterMapper *params, ResultMapper *results, Context &trxContext)
{
	StartTrace(DataAccess.Exec);
	DAAccessTimer(DataAccess.Exec, fName, trxContext);

	// if we don't have a complete triple, return immediately
	DataAccessImpl *trx = GetImpl(fName, trxContext);
	Assert(trx && params && results);
	if ( !(trx && params && results) ) {
		return false;
	}

	//SOP: check if we can speed up responsiveness by unlocking the session during IO
	SessionReleaser slr(trxContext);
	slr.Use();

	// execute the TRX (both mappers should be defined now)
	bool ret = trx->Exec(trxContext, params, results);

	// return result
	return ret;
}
Пример #3
0
void Pince::in_state_func()
{
    switch (state)
    {
        case RANGE_DEPART :
            a1();
            scv();
            slr();
            break;
        case TAPE_VERTICAL :
            a1();
            scv();
            slt();
            break;
        case INTERMEDIAIRE_SORTIE :
            set_time_out(400, trigger_to_be);
            a1();
            slo();
            scv();
            break;
        case HORIZ_VERT :
            a1();
            slo();
            scn();
            break;
        case NOMINAL_VIDE : 
            set_time_out(500, trigger_to_be);
            a0();
            slo();
            scn();
            break;
        case ACTIF_TORCHE :
            a0();
            slo();
            scn();
            break;
        case PRISE_TORCHE : 
            Serial.println('# PRISE');
            a0();
            slf();
            scn();
            break;
        case ACTIF_FEU :
            a0();
            slo();
            scn();
            break;
        case PRISE_FEU :
            Serial.println('# PRISE');
            set_time_out(500, TIME_OUT);
            a0();
            slf();
            scn();
            break;
        case WAIT_COOL_OK :
            break;
        case MONTE_COOL :
            set_time_out(800, TIME_OUT);
            a1();
            slf();
            scn();
            break;
        case MONTE_COOL2 :
            a1();
            slf();
            scn();
            break;
        case RETOURNE_COOL_N :
            set_time_out(500, TIME_OUT);
            a1();
            slf();
            scr();
            break;
        case DESCEND_COOL_N :
            a0();
            slf();
            scr();
            break;
        case POSE_COOL_N :
            set_time_out(500, TIME_OUT);
            a0();
            slo();
            scr();
            break;
        case INT1_COOL_N : 
            set_time_out(500, TIME_OUT);
            a1();
            slo();
            scr();
            break;
        case INT2_COOL_N : 
            set_time_out(500, TIME_OUT);
            a1();
            slf();
            scr();
            break;
        case INT3_COOL_N :
            set_time_out(500, TIME_OUT);
            a1();
            slf();
            scn();
            break;
        case INT_RANGE :
            a1();
            slo();
            break;
        case INT2_RANGE :
            set_time_out(10, trigger_to_be);
            a1();
            slo();
            break;
    }
}
Пример #4
0
void MainWindow::on_showLastRecordButton_clicked()
{
    showLastRecord slr(myDB,this);
    slr.exec();
}
Пример #5
0
int CBuilding::OnCreate( _W64 long pParameter )
{
    //if ( sizeof( CreateParameter ) != size )
    //    return false;

	param = *( CreateParameter * )pParameter;

    if ( param.loadData == NULL )
    {
        const SBuildingConfigData *buidlingData = GetBuildingData( param.index );
        if ( buidlingData == NULL )
            return false;

        memset( &property, 0, sizeof( property ) );

        property.index = param.index;
        property.inverse = param.inverse;
        //property.ownerType = param.ownerType;
        //memcpy( property.owner, param.ownerName, sizeof( property.owner ) );

//         property.curX = m_wCurX = param.x;
//         property.curY = m_wCurY = param.y;

        // 暂时将建筑物设置为停用状态
        property.usingState = 0;
        property.ownerType = param.ownerType;
        property.owner = param.ownerName;

	    if ( !GenerateNewUniqueId( reinterpret_cast< SItemBase& >( property ) ) )
	    {
		    rfalse( 2, 1, "创建建筑唯一ID错误!" );
		    return false;
	    }
    }
    else
    {
        lite::Serialreader slr( ( LPVOID )param.loadData );
        lite::Variant lvt = slr();
        if ( ( lvt.dataType != lite::Variant::VT_POINTER ) || ( lvt.dataSize != sizeof( SaveBlock_fixed ) ) )
            return false;

        const SaveBlock_fixed &block = *( const SaveBlock_fixed* )lvt._pointer;

        const SBuildingConfigData *buidlingData = GetBuildingData( block.index );
        if ( buidlingData == NULL )
            return false;

        memset( &property, 0, sizeof( property ) );

        property.index = block.index;
        reinterpret_cast< QWORD& >( property ) = reinterpret_cast< const QWORD& >( block );
        if ( block.ownerName[10] != 0 )
            return false;
        property.owner = block.ownerName;
        
		//property.inverse = ?
        //property.ownerType = block->ownerType;
        //memcpy( property.owner, block->ownerName, sizeof( property.owner ) );

        if ( slr.curSize() < slr.maxSize() )
        {
            lvt = slr();

            if ( ( lvt.dataType != lite::Variant::VT_RPC_OP ) || ( lvt._rpcop != 0x13579 ) )
                return false;

            // 是否有额外的扩展数据?
            while ( slr.curSize() < slr.maxSize() )
            {
                // 压入所有的扩展数据!
                LPCSTR key = slr();

                // 避免保留一个空的数据!
                if ( slr.curSize() >= slr.maxSize() )
                    return false;

                // 注意,使用深阶拷贝,避免在之后数据失效。。。
                svarMap[ key ].DeepCopy( slr() );
            }
        }
    }

    return true;
}