这篇教程C++ GetBoard函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetBoard函数的典型用法代码示例。如果您正苦于以下问题:C++ GetBoard函数的具体用法?C++ GetBoard怎么用?C++ GetBoard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetBoard函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetBoardvoid DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& aOffset ){ int ux0, uy0, dx, dy; int l_trace; int mode; int radius; LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; EDA_COLOR_T color; BOARD * brd = GetBoard( ); if( brd->IsLayerVisible( GetLayer() ) == false ) return; color = brd->GetLayerColor( GetLayer() ); if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay ) { if( !IsOnLayer( curr_layer ) && !IsOnLayer( EDGE_N ) ) ColorTurnToDarkDarkGray( &color ); } GRSetDrawMode( DC, draw_mode ); l_trace = m_Width >> 1; /* half trace width */ // Line start point or Circle and Arc center ux0 = m_Start.x + aOffset.x; uy0 = m_Start.y + aOffset.y; // Line end point or circle and arc start point dx = m_End.x + aOffset.x; dy = m_End.y + aOffset.y; mode = DisplayOpt.DisplayDrawItems; if( m_Flags & FORCE_SKETCH ) mode = SKETCH; if( DC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH ) mode = LINE; switch( m_Shape ) { case S_CIRCLE: radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); if( mode == LINE ) { GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, color ); } else if( mode == SKETCH ) { GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - l_trace, color ); GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + l_trace, color ); } else { GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } break; case S_ARC: double StAngle, EndAngle; radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); StAngle = ArcTangente( dy - uy0, dx - ux0 ); EndAngle = StAngle + m_Angle; if( !panel->GetPrintMirrored() ) { if( StAngle > EndAngle ) EXCHG( StAngle, EndAngle ); } else // Mirrored mode: arc orientation is reversed { if( StAngle < EndAngle ) EXCHG( StAngle, EndAngle ); } if( mode == LINE ) GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); else if( mode == SKETCH ) { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius - l_trace, color ); GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius + l_trace, color ); } else { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color ); } break; case S_CURVE://.........这里部分代码省略.........
开发者ID:p12tic,项目名称:kicad-source-mirror,代码行数:101,
示例2: _void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName, const wxString& aCmpFileName, REPORTER* aReporter, bool aChangeFootprints, bool aDeleteUnconnectedTracks, bool aDeleteExtraFootprints, bool aSelectByTimeStamp, bool aDeleteSinglePadNets, bool aIsDryRun ){ wxString msg; NETLIST netlist; NETLIST_READER* netlistReader; netlist.SetIsDryRun( aIsDryRun ); netlist.SetFindByTimeStamp( aSelectByTimeStamp ); netlist.SetDeleteExtraFootprints( aDeleteExtraFootprints ); netlist.SetReplaceFootprints( aChangeFootprints ); try { netlistReader = NETLIST_READER::GetNetlistReader( &netlist, aNetlistFileName, aCmpFileName ); if( netlistReader == NULL ) { msg.Printf( _( "Cannot open netlist file /"%s/"." ), GetChars( aNetlistFileName ) ); wxMessageBox( msg, _( "Netlist Load Error." ), wxOK | wxICON_ERROR, this ); return; } std::auto_ptr< NETLIST_READER > nlr( netlistReader ); SetLastNetListRead( aNetlistFileName ); netlistReader->LoadNetlist(); loadFootprints( netlist, aReporter ); } catch( const IO_ERROR& ioe ) { msg.Printf( _( "Error loading netlist./n%s" ), ioe.errorText.GetData() ); wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR ); return; } // Clear undo and redo lists to avoid inconsistencies between lists if( !netlist.IsDryRun() ) GetScreen()->ClearUndoRedoList(); netlist.SortByReference(); GetBoard()->ReplaceNetlist( netlist, aDeleteSinglePadNets, aReporter ); // If it was a dry run, nothing has changed so we're done. if( netlist.IsDryRun() ) return; OnModify(); SetCurItem( NULL ); if( aDeleteUnconnectedTracks && GetBoard()->m_Track ) { // Remove erroneous tracks. This should probably pushed down to the #BOARD object. RemoveMisConnectedTracks(); } // Rebuild the board connectivity: Compile_Ratsnest( NULL, true ); SetMsgPanel( GetBoard() ); m_canvas->Refresh();}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:69,
示例3: GetCurItemvoid FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ){ BOARD_ITEM* item = GetCurItem(); m_canvas->CrossHairOff( DC ); if( GetToolId() == ID_NO_TOOL_SELECTED ) { if( item && item->GetFlags() ) // Move item command in progress { switch( item->Type() ) { case PCB_MODULE_TEXT_T: PlaceTexteModule( (TEXTE_MODULE*) item, DC ); break; case PCB_MODULE_EDGE_T: SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); Place_EdgeMod( (EDGE_MODULE*) item ); break; case PCB_PAD_T: PlacePad( (D_PAD*) item, DC ); break; default: { wxString msg; msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ), item->Type(), item->GetFlags() ); DisplayError( this, msg ); item->ClearFlags(); break; } } } else { if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT ) && !wxGetKeyState( WXK_CONTROL ) ) item = ModeditLocateAndDisplay(); SetCurItem( item ); } } item = GetCurItem(); bool no_item_edited = item == NULL || item->GetFlags() == 0; switch( GetToolId() ) { case ID_NO_TOOL_SELECTED: break; case ID_MODEDIT_CIRCLE_TOOL: case ID_MODEDIT_ARC_TOOL: case ID_MODEDIT_LINE_TOOL: if( no_item_edited ) { STROKE_T shape = S_SEGMENT; if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) shape = S_CIRCLE; if( GetToolId() == ID_MODEDIT_ARC_TOOL ) shape = S_ARC; SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) ); } else if( item->IsNew() ) { if( ( (EDGE_MODULE*) item )->GetShape() == S_CIRCLE ) { End_Edge_Module( (EDGE_MODULE*) item ); SetCurItem( NULL ); m_canvas->Refresh(); } else if( ( (EDGE_MODULE*) item )->GetShape() == S_ARC ) { End_Edge_Module( (EDGE_MODULE*) item ); SetCurItem( NULL ); m_canvas->Refresh(); } else if( ( (EDGE_MODULE*) item )->GetShape() == S_SEGMENT ) { SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, S_SEGMENT ) ); } else { DisplayError( this, wxT( "ProcessCommand error: item flags error" ) ); } } break; case ID_MODEDIT_DELETE_TOOL: if( ! no_item_edited ) // Item in edit, cannot delete it break; item = ModeditLocateAndDisplay();//.........这里部分代码省略.........
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:101,
示例4: GetBoardvoid EDA_3D_CANVAS::CreateDrawGL_List( REPORTER* aErrorMessages, REPORTER* aActivity ){ BOARD* pcb = GetBoard(); wxBusyCursor dummy; // Build 3D board parameters: GetPrm3DVisu().InitSettings( pcb ); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); // Create axis gl list (if it is not shown, the list will be not called draw3DAxis(); // Create Board full gl lists: if( ! m_glLists[GL_ID_BOARD] ) { DBG( unsigned strtime = GetRunningMicroSecs() ); m_glLists[GL_ID_BOARD] = glGenLists( 1 ); m_glLists[GL_ID_BODY] = glGenLists( 1 ); buildBoard3DView(m_glLists[GL_ID_BOARD], m_glLists[GL_ID_BODY], aErrorMessages, aActivity ); CheckGLError( __FILE__, __LINE__ ); DBG( printf( " buildBoard3DView total time %f ms/n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) ); } if( ! m_glLists[GL_ID_TECH_LAYERS] ) { DBG( unsigned strtime = GetRunningMicroSecs() ); m_glLists[GL_ID_TECH_LAYERS] = glGenLists( 1 ); glNewList( m_glLists[GL_ID_TECH_LAYERS], GL_COMPILE ); // when calling BuildTechLayers3DView, // do not show warnings, which are the same as buildBoard3DView buildTechLayers3DView( aErrorMessages, aActivity ); glEndList(); CheckGLError( __FILE__, __LINE__ ); DBG( printf( " buildTechLayers3DView total time %f ms/n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) ); } if( ! m_glLists[GL_ID_AUX_LAYERS] ) { DBG( unsigned strtime = GetRunningMicroSecs() ); m_glLists[GL_ID_AUX_LAYERS] = glGenLists( 1 ); glNewList( m_glLists[GL_ID_AUX_LAYERS], GL_COMPILE ); buildBoard3DAuxLayers( aErrorMessages, aActivity ); glEndList(); CheckGLError( __FILE__, __LINE__ ); DBG( printf( " buildBoard3DAuxLayers total time %f ms/n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) ); } // draw modules 3D shapes if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] && isEnabled( FL_MODULE ) ) { m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] = glGenLists( 1 ); // GL_ID_3DSHAPES_TRANSP_FRONT is an auxiliary list for 3D shapes; // Ensure it is cleared before rebuilding it if( m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] ) glDeleteLists( m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT], 1 ); bool useMaterial = g_Parm_3D_Visu.GetFlag( FL_RENDER_MATERIAL ); if( useMaterial ) m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] = glGenLists( 1 ); else m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] = 0; buildFootprintShape3DList( m_glLists[GL_ID_3DSHAPES_SOLID_FRONT], m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT], aErrorMessages, aActivity ); CheckGLError( __FILE__, __LINE__ ); } calcBBox(); // Create grid gl list if( ! m_glLists[GL_ID_GRID] ) { m_glLists[GL_ID_GRID] = glGenLists( 1 ); glNewList( m_glLists[GL_ID_GRID], GL_COMPILE ); draw3DGrid( GetPrm3DVisu().m_3D_Grid ); glEndList(); } if( !m_glLists[GL_ID_SHADOW_FRONT] ) m_glLists[GL_ID_SHADOW_FRONT] = glGenLists( 1 ); if( !m_glLists[GL_ID_SHADOW_BACK] ) m_glLists[GL_ID_SHADOW_BACK] = glGenLists( 1 ); if( !m_glLists[GL_ID_SHADOW_BOARD] )//.........这里部分代码省略.........
开发者ID:CastMi,项目名称:kicad-source-mirror,代码行数:101,
示例5: DBGvoid EDA_3D_CANVAS::buildFootprintShape3DList( GLuint aOpaqueList, GLuint aTransparentList, REPORTER* aErrorMessages, REPORTER* aActivity ){ DBG( unsigned strtime = GetRunningMicroSecs() ); if( aActivity ) aActivity->Report( _( "Load 3D Shapes" ) ); // clean the parser list if it have any already loaded files m_model_parsers_list.clear(); m_model_filename_list.clear(); BOARD* pcb = GetBoard(); for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) read3DComponentShape( module ); DBG( printf( " read3DComponentShape total time %f ms/n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) ); DBG( strtime = GetRunningMicroSecs() ); bool useMaterial = g_Parm_3D_Visu.GetFlag( FL_RENDER_MATERIAL ); if( useMaterial ) { // aOpaqueList is the gl list for non transparent items // aTransparentList is the gl list for non transparent items, // which need to be drawn after all other items glNewList( aOpaqueList, GL_COMPILE ); bool loadOpaqueObjects = true; for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) render3DComponentShape( module, loadOpaqueObjects, !loadOpaqueObjects ); glEndList(); glNewList( aTransparentList, GL_COMPILE ); bool loadTransparentObjects = true; for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) render3DComponentShape( module, !loadTransparentObjects, loadTransparentObjects ); glEndList(); } else { // Just create one list glNewList( aOpaqueList, GL_COMPILE ); for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) render3DComponentShape( module, false, false ); glEndList(); } DBG( printf( " render3DComponentShape total time %f ms/n", (double) (GetRunningMicroSecs() - strtime) / 1000.0 ) );}
开发者ID:CastMi,项目名称:kicad-source-mirror,代码行数:62,
示例6: GetBoardvoid EDA_3D_VIEWER::ReloadRequest(){ // This will schedule a request to load later if( m_canvas ) m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );}
开发者ID:cpavlina,项目名称:kicad,代码行数:6,
示例7: GetLayerMask/* * This function starts a new track segment. * If a new track segment is in progress, ends this current new segment, * and created a new one. */TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ){ TRACK* TrackOnStartPoint = NULL; LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); BOARD_CONNECTED_ITEM* LockPoint; wxPoint pos = GetCrossHairPosition(); if( aTrack == NULL ) // Starting a new track segment { m_canvas->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track ); // Prepare the undo command info s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but... GetBoard()->PushHighLight(); // erase old highlight if( GetBoard()->IsHighLightNetON() ) HighLight( aDC ); g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) ); g_CurrentTrackSegment->SetFlags( IS_NEW ); GetBoard()->SetHighLightNet( 0 ); // Search for a starting point of the new track, a track or pad LockPoint = GetBoard()->GetLockPoint( pos, layerMask ); D_PAD* pad = NULL; if( LockPoint ) // An item (pad or track) is found { if( LockPoint->Type() == PCB_PAD_T ) { pad = (D_PAD*) LockPoint; // A pad is found: put the starting point on pad center pos = pad->GetPosition(); GetBoard()->SetHighLightNet( pad->GetNetCode() ); } else // A track segment is found { TrackOnStartPoint = (TRACK*) LockPoint; GetBoard()->SetHighLightNet( TrackOnStartPoint->GetNetCode() ); GetBoard()->CreateLockPoint( pos, TrackOnStartPoint, &s_ItemsListPicker ); } } else { // Not a starting point, but a filled zone area can exist. This is also a // good starting point. ZONE_CONTAINER* zone; zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer, GetScreen()-> m_Active_Layer, -1 ); if( zone ) GetBoard()->SetHighLightNet( zone->GetNetCode() ); } DBG( g_CurrentTrackList.VerifyListIntegrity() ); BuildAirWiresTargetsList( LockPoint, wxPoint( 0, 0 ), true ); DBG( g_CurrentTrackList.VerifyListIntegrity() ); GetBoard()->HighLightON(); GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() ); // Display info about track Net class, and init track and vias sizes: g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() ); GetDesignSettings().SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() ); if( GetDesignSettings().m_UseConnectedTrackWidth ) { if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T ) g_CurrentTrackSegment->SetWidth( TrackOnStartPoint->GetWidth()); } g_CurrentTrackSegment->SetStart( pos ); g_CurrentTrackSegment->SetEnd( pos ); if( pad ) { g_CurrentTrackSegment->m_PadsConnected.push_back( pad ); // Useful to display track length, if the pad has a die length: g_CurrentTrackSegment->SetState( BEGIN_ONPAD, true ); g_CurrentTrackSegment->start = pad; } if( g_TwoSegmentTrackBuild ) {//.........这里部分代码省略.........
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:101,
示例8: GetBoardBOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const{ return GetBoard()->GetDesignSettings();}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:4,
示例9: PCB_BASE_EDIT_FRAMEFOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) : PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString, wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ){ m_showBorderAndTitleBlock = false; // true to show the frame references m_showAxis = true; // true to show X and Y axis on screen m_showGridAxis = true; // show the grid origin axis m_hotkeysDescrList = g_Module_Editor_Hotkeys_Descr; m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs m_canvasType = aBackend; m_AboutTitle = "ModEdit"; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) ); SetIcon( icon ); // Create GAL canvas if( aBackend == EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN ) m_canvasType = LoadCanvasTypeSetting(); else m_canvasType = aBackend; PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, GetGalDisplayOptions(), m_canvasType ); SetGalCanvas( drawPanel ); SetBoard( new BOARD() ); // In modedit, the default net clearance is not known. // (it depends on the actual board) // So we do not show the default clearance, by setting it to 0 // The footprint or pad specific clearance will be shown GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 ); // Don't show the default board solder mask clearance in the footprint editor. Only the // footprint or pad clearance setting should be shown if it is not 0. GetBoard()->GetDesignSettings().m_SolderMaskMargin = 0; // restore the last footprint from the project, if any restoreLastFootprint(); // Ensure all layers and items are visible: // In footprint editor, some layers have no meaning or // cannot be used, but we show all of them, at least to be able // to edit a bad layer GetBoard()->SetVisibleAlls(); // However the "no net" mark on pads is useless, because there is // no net in footprint editor: make it non visible GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false ); m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true ); // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager LoadSettings( config() ); GetGalDisplayOptions().m_axesEnabled = true; SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); // In modedit, set the default paper size to A4: // this should be OK for all footprint to plot/print SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); initLibraryTree(); m_treePane = new FOOTPRINT_TREE_PANE( this ); // Create the manager and dispatcher & route draw panel events to the dispatcher setupTools(); // ReCreateMenuBar(); // UseGalCanvas() will do this for us. ReCreateHToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); m_Layers->ReFill(); m_Layers->ReFillRender(); GetScreen()->m_Active_Layer = F_SilkS; m_Layers->SelectLayer( F_SilkS ); m_Layers->OnLayerSelected(); m_auimgr.SetManagedWindow( this ); m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); // Horizontal items; layers 4 - 6 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); // Vertical items; layers 1 - 3 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1)//.........这里部分代码省略.........
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:101,
示例10: GetScreenvoid PCB_EDIT_FRAME::Block_Rotate(){ wxPoint centre; // rotation cent-re for the rotation transform int rotAngle = m_rotationAngle; // rotation angle in 0.1 deg. centre = GetScreen()->m_BlockLocate.Centre(); OnModify(); PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems(); itemsList->m_Status = UR_CHANGED; for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ ) { BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii ); wxASSERT( item ); itemsList->SetPickedItemStatus( UR_CHANGED, ii ); switch( item->Type() ) { case PCB_MODULE_T: ( (MODULE*) item )->ClearFlags(); m_Pcb->m_Status_Pcb = 0; break; // Move and rotate the track segments case PCB_TRACE_T: // a track segment (segment on a copper layer) case PCB_VIA_T: // a via (like track segment on a copper layer) m_Pcb->m_Status_Pcb = 0; break; case PCB_ZONE_AREA_T: case PCB_LINE_T: case PCB_TEXT_T: case PCB_TARGET_T: case PCB_DIMENSION_T: break; // This item is not put in undo list case PCB_ZONE_T: // SEG_ZONE items are now deprecated itemsList->RemovePicker( ii ); ii--; break; default: wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Rotate( ) error: unexpected type" ) ); break; } } // Save all the block items in there current state before applying the rotation. SaveCopyInUndoList( *itemsList, UR_CHANGED, centre ); // Now perform the rotation. for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ ) { BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii ); wxASSERT( item ); item->Rotate( centre, rotAngle ); GetBoard()->GetConnectivity()->Update( item ); } Compile_Ratsnest( NULL, true ); m_canvas->Refresh( true );}
开发者ID:cpavlina,项目名称:kicad,代码行数:65,
示例11: GetToolId//.........这里部分代码省略......... GetScreen()->ClearBlockCommand(); return false; } // Show dialog if there are no selected items and we're not zooming if( !GetScreen()->m_BlockLocate.GetCount() && GetScreen()->m_BlockLocate.GetCommand() != BLOCK_ZOOM ) { if( InstallBlockCmdFrame( this, _( "Block Operation" ) ) == false ) { cancelCmd = true; // undraw block outline if( DC ) m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } else { DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false ); Block_SelectItems(); // Exit if no items found if( !GetScreen()->m_BlockLocate.GetCount() ) cancelCmd = true; } } if( !cancelCmd && m_canvas->IsMouseCaptured() ) { switch( GetScreen()->m_BlockLocate.GetCommand() ) { case BLOCK_IDLE: DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); break; case BLOCK_DRAG: // Drag (not used, for future enhancements) case BLOCK_MOVE: // Move case BLOCK_DUPLICATE: // Duplicate case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references case BLOCK_PRESELECT_MOVE: // Move with preselection list GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE ); nextcmd = true; m_canvas->SetMouseCaptureCallback( drawMovingBlock ); if( DC ) m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); break; case BLOCK_DELETE: // Delete m_canvas->SetMouseCaptureCallback( NULL ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); Block_Delete(); break; case BLOCK_ROTATE: // Rotation m_canvas->SetMouseCaptureCallback( NULL ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); Block_Rotate(); break; case BLOCK_FLIP: // Flip m_canvas->SetMouseCaptureCallback( NULL ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); Block_Flip(); break; case BLOCK_COPY: // Copy GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); if( GetScreen()->m_BlockLocate.GetCount() ) { // @todo (if useful) Save_Block( ); } break; case BLOCK_PASTE: break; case BLOCK_ZOOM: // Window Zoom // Turn off the redraw block routine now so it is not displayed // with one corner at the new center of the screen m_canvas->SetMouseCaptureCallback( NULL ); Window_Zoom( GetScreen()->m_BlockLocate ); break; default: break; } } if( ! nextcmd ) { GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; GetScreen()->ClearBlockCommand(); m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); } return nextcmd;}
开发者ID:cpavlina,项目名称:kicad,代码行数:101,
示例12: setActiveLayerbool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ){ unsigned itmp; if( aTrack == NULL ) { if( getActiveLayer() != ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP ) setActiveLayer( ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP ); else setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM ); UpdateStatusBar(); return true; } // Avoid more than one via on the current location: if( GetBoard()->GetViaByPosition( g_CurrentTrackSegment->GetEnd(), g_CurrentTrackSegment->GetLayer() ) ) return false; for( TRACK* segm = g_FirstTrackSegment; segm; segm = segm->Next() ) { if( segm->Type() == PCB_VIA_T && g_CurrentTrackSegment->GetEnd() == segm->GetStart() ) return false; } // Is the current segment Ok (no DRC error) ? if( g_Drc_On ) { if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) // DRC error, the change layer is not made return false; // Handle 2 segments. if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) { if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) ) return false; } } /* Save current state before placing a via. * If the via cannot be placed this current state will be reused */ itmp = g_CurrentTrackList.GetCount(); Begin_Route( g_CurrentTrackSegment, DC ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); // create the via SEGVIA* via = new SEGVIA( GetBoard() ); via->SetFlags( IS_NEW ); via->SetShape( GetDesignSettings().m_CurrentViaType ); via->SetWidth( GetBoard()->GetCurrentViaSize()); via->SetNet( GetBoard()->GetHighLightNetCode() ); via->SetEnd( g_CurrentTrackSegment->GetEnd() ); via->SetStart( g_CurrentTrackSegment->GetEnd() ); // Usual via is from copper to component. // layer pair is LAYER_N_BACK and LAYER_N_FRONT. via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT ); via->SetDrill( GetBoard()->GetCurrentViaDrill() ); LAYER_NUM first_layer = getActiveLayer(); LAYER_NUM last_layer; // prepare switch to new active layer: if( first_layer != GetScreen()->m_Route_Layer_TOP ) last_layer = GetScreen()->m_Route_Layer_TOP; else last_layer = GetScreen()->m_Route_Layer_BOTTOM; // Adjust the actual via layer pair switch ( via->GetShape() ) { case VIA_BLIND_BURIED: via->SetLayerPair( first_layer, last_layer ); break; case VIA_MICROVIA: // from external to the near neighbor inner layer { LAYER_NUM last_inner_layer = FIRST_LAYER + (GetBoard()->GetCopperLayerCount() - 2); if ( first_layer == LAYER_N_BACK ) last_layer = LAYER_N_2; else if ( first_layer == LAYER_N_FRONT ) last_layer = last_inner_layer; else if ( first_layer == LAYER_N_2 ) last_layer = LAYER_N_BACK; else if ( first_layer == last_inner_layer ) last_layer = LAYER_N_FRONT; // else error: will be removed later via->SetLayerPair( first_layer, last_layer ); { NETINFO_ITEM* net = GetBoard()->FindNet( via->GetNet() ); via->SetWidth( net->GetMicroViaSize() ); } } break;//.........这里部分代码省略.........
开发者ID:p12tic,项目名称:kicad-source-mirror,代码行数:101,
示例13: DisplayInfoMessage/* Save modules in a library: * param aNewModulesOnly: * true : save modules not already existing in this lib * false: save all modules */void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewModulesOnly ){ wxString fileName = aLibName; wxString path; if( GetBoard()->m_Modules == NULL ) { DisplayInfoMessage( this, FMT_NO_MODULES ); return; } path = wxGetApp().ReturnLastVisitedLibraryPath(); if( !aLibName ) { wxFileDialog dlg( this, FMT_LIBRARY, path, wxEmptyString, wxGetTranslation( LegacyFootprintLibPathWildcard ), wxFD_SAVE ); if( dlg.ShowModal() == wxID_CANCEL ) return; fileName = dlg.GetPath(); } wxFileName fn( fileName ); wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); bool lib_exists = wxFileExists( fileName ); if( !aNewModulesOnly && lib_exists ) { wxString msg = wxString::Format( FMT_OK_OVERWRITE, GetChars( fileName ) ); if( !IsOK( this, msg ) ) return; } m_canvas->SetAbortRequest( false ); try { PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) ); // Delete old library if we're replacing it entirely. if( lib_exists && !aNewModulesOnly ) { pi->FootprintLibDelete( fileName ); lib_exists = false; } if( !lib_exists ) { pi->FootprintLibCreate( fileName ); } if( !aNewModulesOnly ) { for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() ) { pi->FootprintSave( fileName, m ); } } else { for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() ) { if( !Save_Module_In_Library( fileName, m, false, false ) ) break; // Check for request to stop backup (ESCAPE key actuated) if( m_canvas->GetAbortRequest() ) break; } } } catch( IO_ERROR ioe ) { DisplayError( this, ioe.errorText ); return; }}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:87,
示例14: GetBoardvoid EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ){ int ux0, uy0, dx, dy, radius, StAngle, EndAngle; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; MODULE* module = (MODULE*) m_Parent; if( !module ) return; BOARD* brd = GetBoard( ); if( brd->IsLayerVisible( m_Layer ) == false ) return; EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); if(( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay ) { if( !IsOnLayer( curr_layer ) ) ColorTurnToDarkDarkGray( &color ); } ux0 = m_Start.x - offset.x; uy0 = m_Start.y - offset.y; dx = m_End.x - offset.x; dy = m_End.y - offset.y; GRSetDrawMode( DC, draw_mode ); bool filled = displ_opts ? displ_opts->m_DisplayModEdgeFill : FILLED; if( IsCopperLayer( m_Layer ) ) filled = displ_opts ? displ_opts->m_DisplayPcbTrackFill : FILLED; switch( m_Shape ) { case S_SEGMENT: if( filled ) GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); else // SKETCH Mode GRCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); break; case S_CIRCLE: radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); if( filled ) { GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } else // SKETCH Mode { GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + (m_Width / 2), color ); GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - (m_Width / 2), color ); } break; case S_ARC: radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); StAngle = ArcTangente( dy - uy0, dx - ux0 ); EndAngle = StAngle + m_Angle; if( !panel->GetPrintMirrored() ) { if( StAngle > EndAngle ) std::swap( StAngle, EndAngle ); } else // Mirrored mode: arc orientation is reversed { if( StAngle < EndAngle ) std::swap( StAngle, EndAngle ); } if( filled ) { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color ); } else // SKETCH Mode { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius + (m_Width / 2), color ); GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius - (m_Width / 2), color ); } break; case S_POLYGON: { // We must compute true coordinates from m_PolyPoints // which are relative to module position, orientation 0 std::vector<wxPoint> points = m_PolyPoints; for( unsigned ii = 0; ii < points.size(); ii++ ) {//.........这里部分代码省略.........
开发者ID:nunb,项目名称:kicad-source-mirror,代码行数:101,
示例15: GetGalCanvasvoid FOOTPRINT_EDIT_FRAME::SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState ){ GetGalCanvas()->GetView()->SetLayerVisible( aElement , aNewState ); GetBoard()->SetElementVisibility( aElement, aNewState ); m_Layers->SetRenderState( aElement, aNewState );}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:6,
示例16: cos/** * Function buildBoard3DAuxLayers * Called by CreateDrawGL_List() * Fills the OpenGL GL_ID_BOARD draw list with items * on aux layers only */void EDA_3D_CANVAS::buildBoard3DAuxLayers( REPORTER* aErrorMessages, REPORTER* aActivity ){ const int segcountforcircle = 18; double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) ); BOARD* pcb = GetBoard(); SHAPE_POLY_SET bufferPolys; static const LAYER_ID sequence[] = { Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts, Margin }; for( LSEQ aux( sequence, sequence+DIM(sequence) ); aux; ++aux ) { LAYER_ID layer = *aux; if( !is3DLayerEnabled( layer ) ) continue; if( aActivity ) aActivity->Report( wxString::Format( _( "Build layer %s" ), LSET::Name( layer ) ) ); bufferPolys.RemoveAllContours(); for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() ) { if( !item->IsOnLayer( layer ) ) continue; switch( item->Type() ) { case PCB_LINE_T: ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( bufferPolys, 0, segcountforcircle, correctionFactor ); break; case PCB_TEXT_T: ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( bufferPolys, 0, segcountforcircle, correctionFactor ); break; default: break; } } for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) { module->TransformPadsShapesWithClearanceToPolygon( layer, bufferPolys, 0, segcountforcircle, correctionFactor ); module->TransformGraphicShapesWithClearanceToPolygonSet( layer, bufferPolys, 0, segcountforcircle, correctionFactor ); } // bufferPolys contains polygons to merge. Many overlaps . // Calculate merged polygons and remove pads and vias holes if( bufferPolys.IsEmpty() ) continue; bufferPolys.Simplify( polygonsCalcMode ); int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer ); int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer ); // for Draw3D_SolidHorizontalPolyPolygons, // zpos it the middle between bottom and top sides. // However for top layers, zpos should be the bottom layer pos, // and for bottom layers, zpos should be the top layer pos. if( Get3DLayer_Z_Orientation( layer ) > 0 ) zpos += thickness/2; else zpos -= thickness/2 ; float zNormal = 1.0f; // When using thickness it will draw first the top and then botton (with z inverted) // If we are not using thickness, then the znormal must face the layer direction // because it will draw just one plane if( !thickness ) zNormal = Get3DLayer_Z_Orientation( layer ); setGLTechLayersColor( layer ); Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos, thickness, GetPrm3DVisu().m_BiuTo3Dunits, false,//.........这里部分代码省略.........
开发者ID:CastMi,项目名称:kicad-source-mirror,代码行数:101,
示例17: GetCurItem//.........这里部分代码省略......... case PCB_TRACE_T: case PCB_VIA_T: case PCB_PAD_T: GetDesignSettings().SetCurrentNetClass( ((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() ); updateTraceWidthSelectBox(); updateViaSizeSelectBox(); break; default: break; } } switch( GetToolId() ) { case ID_MAIN_MENUBAR: case ID_NO_TOOL_SELECTED: break; case ID_PCB_MUWAVE_TOOL_SELF_CMD: case ID_PCB_MUWAVE_TOOL_GAP_CMD: case ID_PCB_MUWAVE_TOOL_STUB_CMD: case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD: case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD: MuWaveCommand( aDC, aPosition ); break; case ID_PCB_HIGHLIGHT_BUTT: { int netcode = SelectHighLight( aDC ); if( netcode < 0 ) SetMsgPanel( GetBoard() ); else { NETINFO_ITEM* net = GetBoard()->FindNet( netcode ); if( net ) { MSG_PANEL_ITEMS items; net->GetMsgPanelInfo( items ); SetMsgPanel( items ); } } } break; case ID_PCB_SHOW_1_RATSNEST_BUTT: DrawStruct = PcbGeneralLocateAndDisplay(); Show_1_Ratsnest( DrawStruct, aDC ); if( DrawStruct ) SendMessageToEESCHEMA( DrawStruct ); break; case ID_PCB_MIRE_BUTT: if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) ) { SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) ); m_canvas->MoveCursorToCrossHair(); } else if( DrawStruct->Type() == PCB_TARGET_T ) { PlaceTarget( (PCB_TARGET*) DrawStruct, aDC );
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:67,
示例18: GetBoardint PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose ){ int errorLevel = 0; int areaCount = GetBoard()->GetAreaCount(); wxBusyCursor dummyCursor; wxString msg; wxProgressDialog * progressDialog = NULL; // Create a message with a long net name, and build a wxProgressDialog // with a correct size to show this long net name msg.Printf( FORMAT_STRING, 000, areaCount, wxT("XXXXXXXXXXXXXXXXX" ) ); if( aActiveWindow ) progressDialog = new wxProgressDialog( _( "Fill All Zones" ), msg, areaCount+2, aActiveWindow, wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_APP_MODAL | wxPD_ELAPSED_TIME ); // Display the actual message if( progressDialog ) progressDialog->Update( 0, _( "Starting zone fill..." ) ); // Remove segment zones GetBoard()->m_Zone.DeleteAll(); int ii; for( ii = 0; ii < areaCount; ii++ ) { ZONE_CONTAINER* zoneContainer = GetBoard()->GetArea( ii ); if( zoneContainer->GetIsKeepout() ) continue; msg.Printf( FORMAT_STRING, ii + 1, areaCount, GetChars( zoneContainer->GetNetname() ) ); if( progressDialog ) { if( !progressDialog->Update( ii+1, msg ) ) break; // Aborted by user } errorLevel = Fill_Zone( zoneContainer ); if( errorLevel && !aVerbose ) break; } if( progressDialog ) { progressDialog->Update( ii+2, _( "Updating ratsnest..." ) );#ifdef __WXMAC__ // Work around a dialog z-order issue on OS X aActiveWindow->Raise();#endif } TestConnections(); // Recalculate the active ratsnest, i.e. the unconnected links TestForActiveLinksInRatsnest( 0 ); if( progressDialog ) progressDialog->Destroy(); return errorLevel;}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:62,
示例19: switchvoid PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ){ int id = event.GetId(); wxFileName fn; switch( id ) { case ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG: m_show_layer_manager_tools = ! m_show_layer_manager_tools; m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.Update(); GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, m_show_layer_manager_tools ? _("Hide &Layers Manager" ) : _("Show &Layers Manager" )); break; case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR: m_show_microwave_tools = ! m_show_microwave_tools; m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); m_auimgr.Update(); GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, m_show_microwave_tools ? _( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" )); break; case ID_PCB_LAYERS_SETUP: if( InvokeLayerSetup( this, GetBoard() ) ) { LAYER_ID cur_layer = GetActiveLayer(); // If after showing the dialog the user has removed the active layer, // then select a new active layer (front copper layer). if( !GetBoard()->GetEnabledLayers()[ cur_layer ] ) cur_layer = F_Cu; SetActiveLayer( cur_layer ); OnModify(); ReCreateLayerBox(); ReFillLayerWidget(); if( IsGalCanvasActive() ) static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( GetBoard() ); } break; case ID_PCB_LIB_WIZARD: case ID_PCB_LIB_TABLE_EDIT: { bool tableChanged = false; int r = 0; if( id == ID_PCB_LIB_TABLE_EDIT ) r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() ); else r = InvokeFootprintWizard( this, &GFootprintTable, Prj().PcbFootprintLibs() ); if( r & 1 ) { try { FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() ); GFootprintTable.Format( &sf, 0 ); tableChanged = true; } catch( const IO_ERROR& ioe ) { wxString msg = wxString::Format( _( "Error occurred saving the global footprint library " "table:/n/n%s" ), GetChars( ioe.errorText.GetData() ) ); wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); } } // If no board file is defined, do not save the project specific library table. It // is kept in memory and created in the path when the new board is saved. if( (r & 2) && !GetBoard()->GetFileName().IsEmpty() ) { wxString tblName = Prj().FootprintLibTblName(); try { Prj().PcbFootprintLibs()->Save( tblName ); tableChanged = true; } catch( const IO_ERROR& ioe ) { wxString msg = wxString::Format( _( "Error occurred saving project specific footprint library " "table:/n/n%s" ), GetChars( ioe.errorText ) ); wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); }//.........这里部分代码省略.........
开发者ID:pipatron,项目名称:kicad-source-mirror,代码行数:101,
示例20: GetBoardbool PCB_EDIT_FRAME::RemoveMisConnectedTracks(){ /* finds all track segments which are mis-connected (to more than one net). * When such a bad segment is found, it is flagged to be removed. * All tracks having at least one flagged segment are removed. */ TRACK* segment; TRACK* other; TRACK* next; int net_code_s, net_code_e; bool isModified = false; for( segment = GetBoard()->m_Track; segment; segment = (TRACK*) segment->Next() ) { segment->SetState( FLAG0, false ); // find the netcode for segment using anything connected to the "start" of "segment" net_code_s = -1; if( segment->start && segment->start->Type()==PCB_PAD_T ) { // get the netcode of the pad to propagate. net_code_s = ((D_PAD*)(segment->start))->GetNetCode(); } else { other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_START ); if( other ) net_code_s = other->GetNetCode(); } if( net_code_s < 0 ) continue; // the "start" of segment is not connected // find the netcode for segment using anything connected to the "end" of "segment" net_code_e = -1; if( segment->end && segment->end->Type()==PCB_PAD_T ) { net_code_e = ((D_PAD*)(segment->end))->GetNetCode(); } else { other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_END ); if( other ) net_code_e = other->GetNetCode(); } if( net_code_e < 0 ) continue; // the "end" of segment is not connected // Netcodes do not agree, so mark the segment as "to be removed" if( net_code_s != net_code_e ) { segment->SetState( FLAG0, true ); } } // Remove tracks having a flagged segment for( segment = GetBoard()->m_Track; segment; segment = next ) { next = (TRACK*) segment->Next(); if( segment->GetState( FLAG0 ) ) // Segment is flagged to be removed { segment->SetState( FLAG0, false ); isModified = true; GetBoard()->m_Status_Pcb = 0; Remove_One_Track( NULL, segment ); // the current segment is deleted, // we do not know the next "not yet tested" segment, // so restart to the beginning next = GetBoard()->m_Track; } } return isModified;}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:81,
示例21: wxTvoid PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event ){ NETINFO_ITEM* net; wxString netFilter; wxArrayString list; netFilter = wxT( "*" ); wxTextEntryDialog dlg( this, _( "Filter Net Names" ), _( "Net Filter" ), netFilter ); if( dlg.ShowModal() != wxID_OK ) return; // cancelled by user netFilter = dlg.GetValue( ); if( netFilter.IsEmpty() ) return; wxString Line; for( unsigned ii = 0; ii < GetBoard()->GetNetCount(); ii++ ) { net = GetBoard()->m_NetInfo.GetNetItem( ii ); if( !WildCompareString( netFilter, net->GetNetname(), false ) ) continue; Line.Printf( wxT( "net %3.3d: %s" ), net->GetNet(), GetChars( net->GetNetname() ) ); list.Add( Line ); } wxSingleChoiceDialog choiceDlg( this, wxEmptyString, _( "Select Net" ), list ); if( (choiceDlg.ShowModal() == wxID_CANCEL) || (choiceDlg.GetSelection() == wxNOT_FOUND) ) return; bool found = false; unsigned netcode = (unsigned) choiceDlg.GetSelection(); // Search for the net selected. for( unsigned ii = 0; ii < GetBoard()->GetNetCount(); ii++ ) { net = GetBoard()->FindNet( ii ); if( !WildCompareString( netFilter, net->GetNetname(), false ) ) continue; if( ii == netcode ) { netcode = net->GetNet(); found = true; break; } } if( found ) { INSTALL_UNBUFFERED_DC( dc, m_canvas ); if( GetBoard()->IsHighLightNetON() ) HighLight( &dc ); GetBoard()->SetHighLightNet( netcode ); HighLight( &dc ); }}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:65,
示例22: Compile_Ratsnestvoid PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ){ D_PAD* pt_pad = NULL; MODULE* Module = NULL; if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) return; if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 ) Compile_Ratsnest( DC, true ); if( item ) { if( item->Type() == PCB_PAD_T ) { pt_pad = (D_PAD*) item; Module = (MODULE*) pt_pad->GetParent(); } if( pt_pad ) // Displaying the ratsnest of the corresponding net. { SetMsgPanel( pt_pad ); for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ ) { RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii]; if( net->GetNet() == pt_pad->GetNet() ) { if( ( net->m_Status & CH_VISIBLE ) != 0 ) continue; net->m_Status |= CH_VISIBLE; if( ( net->m_Status & CH_ACTIF ) == 0 ) continue; net->Draw( m_canvas, DC, GR_XOR, wxPoint( 0, 0 ) ); } } } else { if( item->Type() == PCB_MODULE_TEXT_T ) { if( item->GetParent() && ( item->GetParent()->Type() == PCB_MODULE_T ) ) Module = (MODULE*) item->GetParent(); } else if( item->Type() == PCB_MODULE_T ) { Module = (MODULE*) item; } if( Module ) { SetMsgPanel( Module ); pt_pad = Module->Pads(); for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() ) { for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ ) { RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii]; if( ( net->m_PadStart == pt_pad ) || ( net->m_PadEnd == pt_pad ) ) { if( net->m_Status & CH_VISIBLE ) continue; net->m_Status |= CH_VISIBLE; if( (net->m_Status & CH_ACTIF) == 0 ) continue; net->Draw( m_canvas, DC, GR_XOR, wxPoint( 0, 0 ) ); } } } pt_pad = NULL; } } } // Erase if no pad or module has been selected. if( ( pt_pad == NULL ) && ( Module == NULL ) ) { DrawGeneralRatsnest( DC ); for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ ) GetBoard()->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE; }}
开发者ID:p12tic,项目名称:kicad-source-mirror,代码行数:93,
示例23: Kiface//.........这里部分代码省略......... try { wxFileName fn = dlg.GetPath(); PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::GEDA_PCB ) ); moduleName = fn.GetName(); module = pi->FootprintLoad( fn.GetPath(), moduleName ); if( !module ) { wxString msg = wxString::Format( FMT_MOD_NOT_FOUND, GetChars( moduleName ), GetChars( fn.GetPath() ) ); DisplayError( this, msg ); return NULL; } } catch( const IO_ERROR& ioe ) { DisplayError( this, ioe.errorText ); return NULL; } } else if( isLegacy ) { try { PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) ); module = pi->FootprintLoad( dlg.GetPath(), moduleName ); if( !module ) { wxString msg = wxString::Format( FMT_MOD_NOT_FOUND, GetChars( moduleName ), GetChars( dlg.GetPath() ) ); DisplayError( this, msg ); return NULL; } } catch( const IO_ERROR& ioe ) { DisplayError( this, ioe.errorText ); return NULL; } } else // if( isKicad ) { try { // This technique was chosen to create an example of how reading // the s-expression format from clipboard could be done. wxString fcontents; PCB_IO pcb_io; wxFFile f( dlg.GetPath() ); if( !f.IsOpened() ) { wxString msg = wxString::Format( FMT_BAD_PATH, GetChars( dlg.GetPath() ) ); DisplayError( this, msg ); return NULL; } f.ReadAll( &fcontents ); module = dyn_cast<MODULE*>( pcb_io.Parse( fcontents ) ); if( !module ) { wxString msg = wxString::Format( FMT_BAD_PATH, GetChars( dlg.GetPath() ) ); DisplayError( this, msg ); return NULL; } } catch( const IO_ERROR& ioe ) { DisplayError( this, ioe.errorText ); return NULL; } } // Insert footprint in list GetBoard()->Add( module ); // Display info : SetMsgPanel( module ); PlaceModule( module, NULL ); if( IsGalCanvasActive() ) module->SetPosition( wxPoint( 0, 0 ) ); GetBoard()->m_Status_Pcb = 0; GetBoard()->BuildListOfNets(); updateView(); return module;}
开发者ID:deech,项目名称:kicad-source-mirror,代码行数:101,
示例24: plugin_typebool PCB_EDIT_FRAME::AppendBoardFile( const wxString& aFullFileName, int aCtl ){ IO_MGR::PCB_FILE_T pluginType = plugin_type( aFullFileName, aCtl ); PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); // keep trace of existing items, in order to know what are the new items // (for undo command for instance) // Tracks are inserted, not append, so mark existing tracks to know what are // the new tracks for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() ) track->SetFlags( FLAG0 ); // Other items are append to the item list, so keep trace to the // last existing item is enough MODULE* module = GetBoard()->m_Modules.GetLast(); BOARD_ITEM* drawing = GetBoard()->DrawingsList().GetLast(); int zonescount = GetBoard()->GetAreaCount(); // Keep also the count of copper layers, because we can happen boards // with different copper layers counts, // and the enabled layers int initialCopperLayerCount = GetBoard()->GetCopperLayerCount(); LSET initialEnabledLayers = GetBoard()->GetEnabledLayers(); try { PROPERTIES props; char xbuf[30]; char ybuf[30]; // EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet. sprintf( xbuf, "%d", GetPageSizeIU().x ); sprintf( ybuf, "%d", GetPageSizeIU().y ); props["page_width"] = xbuf; props["page_height"] = ybuf; GetDesignSettings().m_NetClasses.Clear(); pi->Load( aFullFileName, GetBoard(), &props ); } catch( const IO_ERROR& ioe ) { for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() ) { track->ClearFlags( FLAG0 ); } DisplayErrorMessage( this, _( "Error loading board in AppendBoardFile" ), ioe.What() ); return false; } // Now prepare a block move command to place the new items, and // prepare the undo command. BLOCK_SELECTOR& blockmove = GetScreen()->m_BlockLocate; HandleBlockBegin( NULL, BLOCK_PRESELECT_MOVE, wxPoint( 0, 0) ); PICKED_ITEMS_LIST& blockitemsList = blockmove.GetItems(); PICKED_ITEMS_LIST undoListPicker; ITEM_PICKER picker( NULL, UR_NEW ); EDA_RECT bbox; // the new items bounding box, for block move bool bboxInit = true; // true until the bounding box is initialized for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() ) { if( track->GetFlags() & FLAG0 ) { track->ClearFlags( FLAG0 ); continue; } track->SetFlags( IS_MOVED ); picker.SetItem( track ); undoListPicker.PushItem( picker ); blockitemsList.PushItem( picker ); if( bboxInit ) bbox = track->GetBoundingBox(); else bbox.Merge( track->GetBoundingBox() ); bboxInit = false; } if( module ) module = module->Next(); else module = GetBoard()->m_Modules; for( ; module; module = module->Next() ) { module->SetFlags( IS_MOVED ); picker.SetItem( module ); undoListPicker.PushItem( picker ); blockitemsList.PushItem( picker ); if( bboxInit ) bbox = module->GetBoundingBox(); else//.........这里部分代码省略.........
开发者ID:cpavlina,项目名称:kicad,代码行数:101,
注:本文中的GetBoard函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetBonusHonorFromKill函数代码示例 C++ GetBlueprint函数代码示例 |