示例#1
0
文件: main.cpp 项目: mixxit/solinia
// Génération d'un item spécial
void GenerateSpecialItem( int numMP, const CSString& nomMP, const MPCraftStats& craftStats, 
						  const CSString& loc,CSString& itemData, int variation )
{
	CSString info, code, name;
	info = itemData.splitTo( "/", true ).toLower();

	if ( loc.left(1) == "I" )
		code = "ixx";
	else if ( loc.left(1) == "D" )
		code = "dxa";
	else
		code = "cxx";

	CreateSheet( numMP, nomMP, code, info.c_str()[0], info.c_str()[1]-'a', craftStats, true, variation );

	name = toString( "m%04d%s%s%02d\t", numMP, code.c_str(), info.c_str(), variation ); 
	name += itemData.splitTo( "/", true ); // singulier
	name += "\t";
	name += itemData.splitTo( "/", true ); // article indéfini
	name += "\t";
	name += itemData.splitTo( "/", true ); // article défini
	name += "\t";
	name += itemData.splitTo( "/", true ); // pluriel
	name += "\t\t";
	name += itemData.splitTo( "/", true ); // article pluriel

	itemNames.insert( name );
}
示例#2
0
文件: CueSheet.cpp 项目: elha/CDex
BOOL CCueSheet::OnInitDialog()
{
	CLangDialog::OnInitDialog();
	
    m_addISRC.SetCheck( TRUE );
    m_checkPreGaps.SetCheck( TRUE );

	CreateSheet();
	return TRUE;  
}
示例#3
0
文件: CueSheet.cpp 项目: elha/CDex
void CCueSheet::OnBnClickedCopytoclipboard()
{
	CreateSheet();

	if ( OpenClipboard()==0 )  
	{
		CDexMessageBox( g_language.GetString( IDS_ERROR_CANNOTOPENCLIPBOARD ) );    
		return;  
	}
	// Remove the current Clipboard contents  
	if( EmptyClipboard()==0 )  
	{
		CDexMessageBox( g_language.GetString( IDS_ERROR_CANNOTEMPTYCLIPBOARD ) );
	}  

    DWORD dwNumBytes = ( m_strCueSheet.GetLength() + 1 ) * sizeof( TCHAR );

    HANDLE hData = GlobalAlloc( GMEM_MOVEABLE | GMEM_DDESHARE, dwNumBytes );

	if ( NULL != hData )
	{
        CUStringConvert strCnv;
    
		LPSTR lpszClip= (LPSTR)GlobalLock( hData );

        // clear while buffer, just to be sure
        memset( lpszClip, 0, dwNumBytes );

        // copy the string data
        memcpy( lpszClip, strCnv.ToT( m_strCueSheet ), dwNumBytes - sizeof( TCHAR ) );  

#ifndef _UNICODE
		if ( ::SetClipboardData( CF_TEXT, hData ) == NULL )  
		{
#else
		if ( ::SetClipboardData( CF_UNICODETEXT, hData ) == NULL )  
		{
#endif
    		CDexMessageBox( g_language.GetString( IDS_UNABLE_COPYTO_CLIPBOARD ) );
        }
	}

	// Close Clipboard
	CloseClipboard();
}

void CCueSheet::OnBnClickedClose()
{
    OnCancel();
}
示例#4
0
文件: main.cpp 项目: mixxit/solinia
// Pour une MP se trouvant dans des déposits, génération de ses items
void GenerateDepositItems( int numMP, const CSString& nomMP, const MPCraftStats& craftStats, const CSString& loc )
{
	CSString code;

	if ( loc.left(1) == "I" )
		code = "ixx";
	else if ( loc.left(1) == "D" )
		code = "dxa";
	else
		code = "cxx";

	// pas de craft = items de mission
	if ( craftStats.Craft == "" )
	{
		if ( loc != "G" )
			CreateSheet( numMP, nomMP, code, 'c', 0, craftStats );
		
		for ( int i=1; i<6; i++ )
		{
			CreateSheet( numMP, nomMP, code, 'c', i, craftStats );
		}
	}
	else
	{
		// 2 items dans common
		CreateSheet( numMP, nomMP, code, 'c', 1, craftStats );
		CreateSheet( numMP, nomMP, code, 'c', 2, craftStats );

		// 3 items par zone
		for ( int i=0; i<3; i++ )
		{
			CreateSheet( numMP, nomMP, code, 'd', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'f', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'j', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'l', 3+i, craftStats );
			CreateSheet( numMP, nomMP, code, 'p', 3+i, craftStats );
		}
	}
}
示例#5
0
文件: CueSheet.cpp 项目: elha/CDex
void CCueSheet::OnBnClickedButton1()
{
	CreateSheet();

    CUStringConvert strCnv;
    CUStringConvert strCnv1;

    CDInfo& cdInfo = m_pDoc->GetCDInfo();
    CUString cueSheetName;
    DWORD cdID = cdInfo.GetDiscID();

    cueSheetName.Format( _W( "%s%08X.cue" ), 
        (LPCWSTR)g_config.GetMP3OutputDir(),
        cdID );

    CUString strFilter = g_language.GetString( IDS_CUESHEETFILESELECTION );

    CFileDialog cueFileDlg(
        FALSE,
        _T( ".cue" ),
        strCnv.ToT( cueSheetName ),
        OFN_OVERWRITEPROMPT,
        strCnv1.ToT( strFilter ) );

    if ( IDOK == cueFileDlg.DoModal() )
    {
        CUString strFileName = CUString( cueFileDlg.GetPathName() );
        FILE* pFile = CDexOpenFile( strFileName, _W( "w" ) );

        if ( pFile )
        {
#ifdef UNICODE
            BYTE btBOM[] = { 0xEF, 0xBB, 0xBF };
            fwrite( &btBOM, sizeof( btBOM ), 1, pFile );
#endif
            LPCSTR lpszUtf = strCnv.ToUTF8( m_strCueSheet );
            fwrite( lpszUtf, 
                    strlen( lpszUtf ), 
                    1, 
                    pFile );
            fclose( pFile );
        }

    }
}
void WinEDA_SchematicFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)
/**********************************************************************************/
/* Traite les commandes declenchée par le bouton gauche de la souris,
	quand un outil est deja selectionné
*/
{
EDA_BaseStruct * DrawStruct = m_CurrentScreen->m_CurrentItem;

	if ( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
		{
		DrawPanel->m_AutoPAN_Request = FALSE;
		g_ItemToRepeat = NULL;

		if ( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
		{
			switch (DrawStruct->m_StructType )
			{
				case DRAW_SHEETLABEL_STRUCT_TYPE:
				case DRAW_SHEET_STRUCT_TYPE:
				case DRAW_BUSENTRY_STRUCT_TYPE:
				case DRAW_LABEL_STRUCT_TYPE:
				case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
				case DRAW_TEXT_STRUCT_TYPE:
				case DRAW_JUNCTION_STRUCT_TYPE:
				case DRAW_LIB_ITEM_STRUCT_TYPE:
				case DRAW_PART_TEXT_STRUCT_TYPE:
					DrawStruct->Place( this, DC);
					m_CurrentScreen->m_CurrentItem = NULL;
					TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
					return;

				case SCREEN_STRUCT_TYPE:
				case DRAW_PICK_ITEM_STRUCT_TYPE:
					DisplayError(this,
					"OnLeftClick err: unexpected type for Place");
					DrawStruct->m_Flags = 0;
					break;

				case DRAW_SEGMENT_STRUCT_TYPE:	// Segment peut-etre en cours de trace
					break;

				default:
					DisplayError(this,
					"WinEDA_SchematicFrame::OnLeftClick err: m_Flags != 0");
					DrawStruct->m_Flags = 0;
					break;
			}
		}
		else
		{
			DrawStruct = SchematicGeneralLocateAndDisplay();
		}
	}

	switch ( m_ID_current_state )
	{
		case 0:
			break;

		case ID_NO_SELECT_BUTT:
			break;

		case ID_HIERARCHY_PUSH_POP_BUTT:
			if ( DrawStruct && DrawStruct->m_Flags ) break;
			DrawStruct = SchematicGeneralLocateAndDisplay();
			if ( DrawStruct && (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) )
				{
				InstallNextScreen((DrawSheetStruct *) DrawStruct);
				}
			else InstallPreviousScreen();
			break;

		case ID_NOCONN_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem =
						g_ItemToRepeat = CreateNewNoConnectStruct(DC);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place(this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
			}
			TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			break;

		case ID_JUNCTION_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem = g_ItemToRepeat 
					= CreateNewJunctionStruct(DC, m_CurrentScreen->m_Curseur);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place(this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
			}
			TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			break;

		case ID_WIRETOBUS_ENTRY_BUTT:
		case ID_BUSTOBUS_ENTRY_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem =
					DrawStruct =
					CreateBusEntry(DC,
						(m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ?
						WIRE_TO_BUS : BUS_TO_BUS);
					DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place(this, DC);
				m_CurrentScreen->m_CurrentItem = NULL;
				TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
			}
			break;

		case ID_SCHEMATIC_DELETE_ITEM_BUTT:
			LocateAndDeleteItem(this, DC);
			m_CurrentScreen->SetModify();
			m_CurrentScreen->m_CurrentItem = NULL;
			TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			break;

		case ID_WIRE_BUTT:
			BeginSegment(DC, LAYER_WIRE);
			DrawPanel->m_AutoPAN_Request = TRUE;
			break;

		case ID_BUS_BUTT:
			BeginSegment(DC, LAYER_BUS);
			DrawPanel->m_AutoPAN_Request = TRUE;
			break;

		case ID_LINE_COMMENT_BUTT:
			BeginSegment(DC, LAYER_NOTES);
			DrawPanel->m_AutoPAN_Request = TRUE;
			break;

		case ID_TEXT_COMMENT_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem =
						CreateNewText(DC, LAYER_NOTES);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place(this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
			}
			break;

		case ID_LABEL_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem =
					CreateNewText(DC, LAYER_LOCLABEL);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place( this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
				TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			}
			break;

		case ID_GLABEL_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem =
					CreateNewText(DC, LAYER_GLOBLABEL);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place(this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
				TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			}
			break;

		case ID_SHEET_SYMBOL_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem = CreateSheet(DC);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place( this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
				TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			}
			break;

		case ID_IMPORT_GLABEL_BUTT:
		case ID_SHEET_LABEL_BUTT:
			if( (DrawStruct == NULL) ||	(DrawStruct->m_Flags == 0) )
				DrawStruct = SchematicGeneralLocateAndDisplay();

			if ( DrawStruct == NULL) break;

			if( (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) &&
				(DrawStruct->m_Flags == 0) )
				{
				if ( m_ID_current_state == ID_IMPORT_GLABEL_BUTT )
					m_CurrentScreen->m_CurrentItem =
					Import_PinSheet( (DrawSheetStruct *) DrawStruct, DC);
				else
					m_CurrentScreen->m_CurrentItem =
					Create_PinSheet( (DrawSheetStruct *) DrawStruct, DC);
				}
			else if( (DrawStruct->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE) &&
				(DrawStruct->m_Flags != 0) )
				{
				DrawStruct->Place(this, DC);
				TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
				}
			break;

		case ID_COMPONENT_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem = Load_Component(DC, "",
					s_CmpNameList, TRUE);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place( this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
				TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			}
			break;

		case ID_PLACE_POWER_BUTT:
			if ( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
			{
				m_CurrentScreen->m_CurrentItem =
					Load_Component(DC, "power",s_PowerNameList, FALSE);
				DrawPanel->m_AutoPAN_Request = TRUE;
			}
			else
			{
				DrawStruct->Place( this, DC);
				DrawPanel->m_AutoPAN_Request = FALSE;
				TestDanglingEnds(m_CurrentScreen->EEDrawList, DC);
			}
			break;

		default :
		{
			SetToolID( 0, wxCURSOR_ARROW, "");
			wxString msg("WinEDA_SchematicFrame::OnLeftClick error state ");
			msg << m_ID_current_state;
			DisplayError(this, msg);
			break;
		}
	}
}
void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
    SCH_ITEM*   item = GetScreen()->GetCurItem();
    wxPoint     gridPosition = GetGridPosition( aPosition );

    if( ( GetToolId() == ID_NO_TOOL_SELECTED ) || ( item && item->GetFlags() ) )
    {
        m_canvas->SetAutoPanRequest( false );
        SetRepeatItem( NULL );

        if( item && item->GetFlags() )
        {
            switch( item->Type() )
            {
            case SCH_LABEL_T:
            case SCH_GLOBAL_LABEL_T:
            case SCH_HIERARCHICAL_LABEL_T:
            case SCH_TEXT_T:
            case SCH_SHEET_PIN_T:
            case SCH_SHEET_T:
            case SCH_BUS_WIRE_ENTRY_T:
            case SCH_BUS_BUS_ENTRY_T:
            case SCH_JUNCTION_T:
            case SCH_COMPONENT_T:
            case SCH_FIELD_T:
            case SCH_BITMAP_T:
            case SCH_NO_CONNECT_T:
                addCurrentItemToList();
                return;

            case SCH_LINE_T:    // May already be drawing segment.
                break;

            default:
                wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick error.  Item type <" ) +
                            item->GetClass() + wxT( "> is already being edited." ) );
                item->ClearFlags();
                break;
            }
        }
        else
        {
            item = LocateAndShowItem( aPosition );
        }
    }

    switch( GetToolId() )
    {
    case ID_NO_TOOL_SELECTED:
        break;

    case ID_HIGHLIGHT:
        HighlightConnectionAtPosition( aPosition );
        break;

    case ID_HIERARCHY_PUSH_POP_BUTT:
        if( ( item && item->GetFlags() ) || ( g_RootSheet->CountSheets() == 0 ) )
            break;

        item = LocateAndShowItem( aPosition, SCH_COLLECTOR::SheetsOnly );

        if( item )  // The user has clicked on a sheet: this is an enter sheet command
        {
            m_CurrentSheet->push_back( (SCH_SHEET*) item );
            DisplayCurrentSheet();
        }
        else if( m_CurrentSheet->Last() != g_RootSheet )
        {   // The user has clicked ouside a sheet:this is an leave sheet command
            m_CurrentSheet->pop_back();
            DisplayCurrentSheet();
        }
        break;

    case ID_NOCONN_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            if( GetScreen()->GetItem( gridPosition, 0, SCH_NO_CONNECT_T ) == NULL )
            {
                SCH_NO_CONNECT*  no_connect = AddNoConnect( aDC, gridPosition );
                SetRepeatItem( no_connect );
                GetScreen()->SetCurItem( no_connect );
                m_canvas->SetAutoPanRequest( true );
            }
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_JUNCTION_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            if( GetScreen()->GetItem( gridPosition, 0, SCH_JUNCTION_T ) == NULL )
            {
                SCH_JUNCTION* junction = AddJunction( aDC, gridPosition, true );
                SetRepeatItem( junction );
                GetScreen()->SetCurItem( junction );
                m_canvas->SetAutoPanRequest( true );
            }
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_WIRETOBUS_ENTRY_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            CreateBusWireEntry();
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_BUSTOBUS_ENTRY_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            CreateBusBusEntry();
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_SCHEMATIC_DELETE_ITEM_BUTT:
        DeleteItemAtCrossHair( aDC );
        break;

    case ID_WIRE_BUTT:
        BeginSegment( aDC, LAYER_WIRE );
        m_canvas->SetAutoPanRequest( true );
        break;

    case ID_BUS_BUTT:
        BeginSegment( aDC, LAYER_BUS );
        m_canvas->SetAutoPanRequest( true );
        break;

    case ID_LINE_COMMENT_BUTT:
        BeginSegment( aDC, LAYER_NOTES );
        m_canvas->SetAutoPanRequest( true );
        break;

    case ID_TEXT_COMMENT_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_ADD_IMAGE_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            GetScreen()->SetCurItem( CreateNewImage( aDC ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_LABEL_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_GLABEL_BUTT:
    case ID_HIERLABEL_BUTT:
        if( (item == NULL) || (item->GetFlags() == 0) )
        {
            if( GetToolId() == ID_GLABEL_BUTT )
                GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_GLOBLABEL ) );

            if( GetToolId() == ID_HIERLABEL_BUTT )
                GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );

            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_SHEET_SYMBOL_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            item = CreateSheet( aDC );

            if( item != NULL )
            {
                GetScreen()->SetCurItem( item );
                m_canvas->SetAutoPanRequest( true );
            }
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_IMPORT_HLABEL_BUTT:
    case ID_SHEET_PIN_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
            item = LocateAndShowItem( aPosition, SCH_COLLECTOR::SheetsAndSheetLabels );

        if( item == NULL )
            break;

        if( (item->Type() == SCH_SHEET_T) && (item->GetFlags() == 0) )
        {
            if( GetToolId() == ID_IMPORT_HLABEL_BUTT )
                GetScreen()->SetCurItem( ImportSheetPin( (SCH_SHEET*) item, aDC ) );
            else
                GetScreen()->SetCurItem( CreateSheetPin( (SCH_SHEET*) item, aDC ) );
        }
        else if( (item->Type() == SCH_SHEET_PIN_T) && (item->GetFlags() != 0) )
        {
            addCurrentItemToList();
        }
        break;

    case ID_SCH_PLACE_COMPONENT:
        if( (item == NULL) || (item->GetFlags() == 0) )
        {
            GetScreen()->SetCurItem( Load_Component( aDC, NULL,
                                                     s_CmpNameList, s_CmpLastUnit, true ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

    case ID_PLACE_POWER_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            SCHLIB_FILTER filter;
            filter.FilterPowerParts( true );
            GetScreen()->SetCurItem( Load_Component( aDC, &filter,
                                                     s_PowerNameList, s_LastPowerUnit, false ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList();
        }
        break;

#ifdef KICAD_SPICE
    case ID_SIM_PROBE:
        {
            const KICAD_T wiresAndComponents[] = { SCH_LINE_T, SCH_COMPONENT_T, SCH_SHEET_PIN_T };
            item = LocateAndShowItem( aPosition, wiresAndComponents );

            if( !item )
                break;

            NETLIST_OBJECT_LIST* netlist = BuildNetListBase();

            for( NETLIST_OBJECT* obj : *netlist )
            {
                if( obj->m_Comp == item )
                {
                    SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );

                    if( simFrame )
                        simFrame->AddVoltagePlot( obj->GetNetName() );

                    break;
                }
            }
        }
        break;

    case ID_SIM_TUNE:
        {
            const KICAD_T fieldsAndComponents[] = { SCH_COMPONENT_T, SCH_FIELD_T };
            item = LocateAndShowItem( aPosition, fieldsAndComponents );

            if( !item )
                return;

            if( item->Type() != SCH_COMPONENT_T )
            {
                item = static_cast<SCH_ITEM*>( item->GetParent() );

                if( item->Type() != SCH_COMPONENT_T )
                    return;
            }

            SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );

            if( simFrame )
                simFrame->AddTuner( static_cast<SCH_COMPONENT*>( item ) );
        }
        break;
#endif /* KICAD_SPICE */

    default:
        SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
        wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick invalid tool ID <" ) +
                    wxString::Format( wxT( "%d> selected." ), GetToolId() ) );
    }
}
示例#8
0
文件: main.cpp 项目: mixxit/solinia
// Pour une MP se trouvant sur un créature, génération de ses items
void GenerateCreatureItems( int numMP, CSString& nomMP, const MPCraftStats& craftStats )
{
	map<CSString, ListeCreatureMP>::const_iterator itLCMP;
	int quality;
	static int statQuality[] = { 0, 1, 0, 1, 3, 6, 4, 2 };

	// On obtient la liste des niveau d'item à generer pour la créature
	itLCMP = itemsAGenerer.find( nomMP.firstWord() );

	if ( itLCMP != itemsAGenerer.end() )
	{
		ListeCreatureMP::const_iterator itMP = (*itLCMP).second.begin();

		// pour chaque niveau d'item à générer
		while ( itMP != (*itLCMP).second.end() )
		{
			// on enregistre ses caractéristiques
			char eco = (*itMP)->eco;
			int creatureLevel = (*itMP)->creatureLevel;
			int itemLevel = (*itMP)->itemLevel;
			CSString creatureFileName = "c";
			creatureFileName += (*itMP)->codeCreature.toLower();
			
			if ( craftStats.Craft != "" )
			{
				quality = statQuality[creatureLevel-1];
				if ( quality != 6 )
				{						
					if ( quality < 2 )
					{
						CreateSheet( numMP, nomMP, creatureFileName, 'c', quality, craftStats );

						AssignerMP( (*itMP)->creatureFileName, 
							toString( "m%04d%s%c%c01.sitem", numMP, creatureFileName.c_str(), 'c', 'a' + quality ) );
					}
					else
					{
						CreateSheet( numMP, nomMP, creatureFileName, eco, quality, craftStats );

						AssignerMP( (*itMP)->creatureFileName, 
							toString( "m%04d%s%c%c01.sitem", numMP, creatureFileName.c_str(), eco, 'a' + quality ) );
					}

					currentDocItem.push( DtCreature, (*itMP)->creatureFileName );
				}
			}
			else
			{
				// pas de MP de mission pour les boss
				if ( creatureLevel < 5 )
				{
					CreateSheet( numMP, nomMP, creatureFileName, eco, itemLevel, craftStats ); 

					AssignerMP( (*itMP)->creatureFileName, 
							toString( "m%04d%s%c%c01.sitem", numMP, creatureFileName.c_str(), eco, 'a' + itemLevel ) );

					currentDocItem.push( DtCreature, (*itMP)->creatureFileName );
				}
			}

			itMP++;
		}
	}
}
void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
    SCH_ITEM*   item = GetScreen()->GetCurItem();
    wxPoint     gridPosition = GetGridPosition( aPosition );

    if( ( GetToolId() == ID_NO_TOOL_SELECTED ) || ( item && item->GetFlags() ) )
    {
        m_canvas->SetAutoPanRequest( false );
        SetRepeatItem( NULL );

        if( item && item->GetFlags() )
        {
            switch( item->Type() )
            {
            case SCH_LABEL_T:
            case SCH_GLOBAL_LABEL_T:
            case SCH_HIERARCHICAL_LABEL_T:
            case SCH_TEXT_T:
            case SCH_SHEET_PIN_T:
            case SCH_SHEET_T:
            case SCH_BUS_WIRE_ENTRY_T:
            case SCH_BUS_BUS_ENTRY_T:
            case SCH_JUNCTION_T:
            case SCH_COMPONENT_T:
            case SCH_FIELD_T:
            case SCH_BITMAP_T:
            case SCH_NO_CONNECT_T:
                addCurrentItemToList( aDC );
                return;

            case SCH_LINE_T:    // May already be drawing segment.
                break;

            default:
                wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick error.  Item type <" ) +
                            item->GetClass() + wxT( "> is already being edited." ) );
                item->ClearFlags();
                break;
            }
        }
        else
        {
            item = LocateAndShowItem( aPosition );
        }
    }

    switch( GetToolId() )
    {
    case ID_NO_TOOL_SELECTED:
        break;

    case ID_HIERARCHY_PUSH_POP_BUTT:
        if( ( item && item->GetFlags() ) || ( g_RootSheet->CountSheets() == 0 ) )
            break;

        item = LocateAndShowItem( aPosition, SCH_COLLECTOR::SheetsOnly );

        if( item )  // The user has clicked on a sheet: this is an enter sheet command
        {
            m_CurrentSheet->Push( (SCH_SHEET*) item );
            DisplayCurrentSheet();
        }
        else if( m_CurrentSheet->Last() != g_RootSheet )
        {   // The user has clicked ouside a sheet:this is an leave sheet command
            m_CurrentSheet->Pop();
            DisplayCurrentSheet();
        }
        break;

    case ID_NOCONN_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            if( false == GetScreen()->GetItem( gridPosition, 0, SCH_NO_CONNECT_T ) )
            {
                SCH_NO_CONNECT*  no_connect = AddNoConnect( aDC, gridPosition );
                SetRepeatItem( no_connect );
                GetScreen()->SetCurItem( no_connect );
                m_canvas->SetAutoPanRequest( true );
            }
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_JUNCTION_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            if( false == GetScreen()->GetItem( gridPosition, 0, SCH_JUNCTION_T ) )
            {
                SCH_JUNCTION* junction = AddJunction( aDC, gridPosition, true );
                SetRepeatItem( junction );
                GetScreen()->SetCurItem( junction );
                m_canvas->SetAutoPanRequest( true );
            }
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_WIRETOBUS_ENTRY_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            CreateBusWireEntry( aDC );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_BUSTOBUS_ENTRY_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            CreateBusBusEntry( aDC );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_SCHEMATIC_DELETE_ITEM_BUTT:
        DeleteItemAtCrossHair( aDC );
        break;

    case ID_WIRE_BUTT:
        BeginSegment( aDC, LAYER_WIRE );
        m_canvas->SetAutoPanRequest( true );
        break;

    case ID_BUS_BUTT:
        BeginSegment( aDC, LAYER_BUS );
        m_canvas->SetAutoPanRequest( true );
        break;

    case ID_LINE_COMMENT_BUTT:
        BeginSegment( aDC, LAYER_NOTES );
        m_canvas->SetAutoPanRequest( true );
        break;

    case ID_TEXT_COMMENT_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_ADD_IMAGE_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            GetScreen()->SetCurItem( CreateNewImage( aDC ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_LABEL_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_GLABEL_BUTT:
    case ID_HIERLABEL_BUTT:
        if( (item == NULL) || (item->GetFlags() == 0) )
        {
            if( GetToolId() == ID_GLABEL_BUTT )
                GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_GLOBLABEL ) );

            if( GetToolId() == ID_HIERLABEL_BUTT )
                GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );

            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_SHEET_SYMBOL_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            item = CreateSheet( aDC );

            if( item != NULL )
            {
                GetScreen()->SetCurItem( item );
                m_canvas->SetAutoPanRequest( true );
            }
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_IMPORT_HLABEL_BUTT:
    case ID_SHEET_PIN_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
            item = LocateAndShowItem( aPosition, SCH_COLLECTOR::SheetsAndSheetLabels );

        if( item == NULL )
            break;

        if( (item->Type() == SCH_SHEET_T) && (item->GetFlags() == 0) )
        {
            if( GetToolId() == ID_IMPORT_HLABEL_BUTT )
                GetScreen()->SetCurItem( ImportSheetPin( (SCH_SHEET*) item, aDC ) );
            else
                GetScreen()->SetCurItem( CreateSheetPin( (SCH_SHEET*) item, aDC ) );
        }
        else if( (item->Type() == SCH_SHEET_PIN_T) && (item->GetFlags() != 0) )
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_SCH_PLACE_COMPONENT:
        if( (item == NULL) || (item->GetFlags() == 0) )
        {
            GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString,
                                                     s_CmpNameList, s_CmpLastUnit, true ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    case ID_PLACE_POWER_BUTT:
        if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
        {
            GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ),
                                                     s_PowerNameList, s_LastPowerUnit, false ) );
            m_canvas->SetAutoPanRequest( true );
        }
        else
        {
            addCurrentItemToList( aDC );
        }
        break;

    default:
        SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
        wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick invalid tool ID <" ) +
                    wxString::Format( wxT( "%d> selected." ), GetToolId() ) );
    }
}
示例#10
0
文件: CueSheet.cpp 项目: elha/CDex
void CCueSheet::OnBnClickedCheck2()
{
	CreateSheet();
}