bool DIALOG_EXCHANGE_MODULE::changeAllFootprints() { MODULE* Module, * PtBack; bool change = false; int ShowErr = 3; // Post 3 error max. if( m_parent->GetBoard()->m_Modules == NULL ) return false; if( !IsOK( this, _( "Are you sure you want to change all footprints?" ) ) ) return false; /* The change is done from the last module because the function * change_1_Module () modifies the last module in the list * * note: for the first module in chain (the last here), Module->Back() * points the board or is NULL */ Module = m_parent->GetBoard()->m_Modules.GetLast(); for( ; Module && ( Module->Type() == PCB_MODULE_T ); Module = PtBack ) { PtBack = Module->Back(); if( change_1_Module( Module, Module->GetFPID(), ShowErr ) ) change = true; else if( ShowErr ) ShowErr--; } return change; }
int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode ) { PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>(); BOARD* board = getModel<BOARD>(); // Deselect all items m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); Activate(); m_router->SetMode ( aMode ); m_ctls->SetSnapping( true ); m_ctls->ShowCursor( true ); std::auto_ptr<ROUTER_TOOL_MENU> ctxMenu ( new ROUTER_TOOL_MENU( board, aMode ) ); SetContextMenu ( ctxMenu.get() ); // Main loop: keep receiving events while( OPT_TOOL_EVENT evt = Wait() ) { if( m_needsSync ) { m_router->SyncWorld(); m_router->SetView( getView() ); m_needsSync = false; } if( evt->IsCancel() || evt->IsActivate() ) break; // Finish else if( evt->Action() == TA_UNDO_REDO ) m_needsSync = true; else if( evt->IsMotion() ) updateStartItem( *evt ); else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) ) { updateStartItem( *evt ); if( evt->Modifier( MD_CTRL ) ) performDragging(); else performRouting(); } else if( evt->IsAction( &ACT_Drag ) ) performDragging(); handleCommonEvents( *evt ); } // Restore the default settings m_ctls->SetAutoPan( false ); m_ctls->ShowCursor( false ); frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString ); // Store routing settings till the next invocation m_savedSettings = m_router->Settings(); m_savedSizes = m_router->Sizes(); return 0; }
void ROUTER_TOOL::performDragging() { PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>(); bool saveUndoBuffer = true; VIEW_CONTROLS* ctls = getViewControls(); bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem ); if( !dragStarted ) return; if( m_startItem && m_startItem->Net() >= 0 ) highlightNet( true, m_startItem->Net() ); ctls->ForceCursorPosition( false ); ctls->SetAutoPan( true ); while( OPT_TOOL_EVENT evt = Wait() ) { if( evt->IsCancel() || evt->IsActivate() ) break; else if( evt->Action() == TA_UNDO_REDO ) { saveUndoBuffer = false; break; } else if( evt->IsMotion() ) { updateEndItem( *evt ); m_router->Move( m_endSnapPoint, m_endItem ); } else if( evt->IsClick( BUT_LEFT ) ) { if( m_router->FixRoute( m_endSnapPoint, m_endItem ) ) break; } handleCommonEvents( *evt ); } if( m_router->RoutingInProgress() ) m_router->StopRouting(); if( saveUndoBuffer ) { // Save the recent changes in the undo buffer frame->SaveCopyInUndoList( m_router->GetUndoBuffer(), UR_UNSPECIFIED ); m_router->ClearUndoBuffer(); frame->OnModify(); } else { // It was interrupted by TA_UNDO_REDO event, so we have to sync the world now m_needsSync = true; } ctls->SetAutoPan( false ); ctls->ForceCursorPosition( false ); highlightNet( false ); }
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) { PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent(); wxString libname = m_libraryName + wxT( "." ) + LegacyFootprintLibPathExtension; MODULE* oldmodule = GetBoard()->m_Modules; MODULE* module = LoadModuleFromLibrary( libname, parent->FootprintLibs(), false ); if( module ) { module->SetPosition( wxPoint( 0, 0 ) ); // Only one footprint allowed: remove the previous footprint (if exists) if( oldmodule ) { GetBoard()->Remove( oldmodule ); delete oldmodule; } m_footprintName = FROM_UTF8( module->GetFPID().GetFootprintName().c_str() ); module->ClearFlags(); SetCurItem( NULL ); Zoom_Automatique( false ); m_canvas->Refresh(); Update3D_Frame(); m_footprintList->SetStringSelection( m_footprintName ); } }
void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event ) { m_selectionMode = m_Selection->GetSelection(); bool result = false; switch( m_Selection->GetSelection() ) { case 0: result = changeCurrentFootprint(); break; case 1: result = changeSameFootprints( false ); break; case 2: result = changeSameFootprints( true ); break; case 3: result = changeAllFootprints(); break; } if( result ) { if( m_parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) m_parent->Compile_Ratsnest( NULL, true ); m_parent->GetCanvas()->Refresh(); } m_commit.Push( wxT( "Changed footprint" ) ); }
void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent ) { PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false ); MODULE* module_in_edit = GetBoard()->m_Modules; bool canInsert = frame && module_in_edit && !module_in_edit->GetLink(); // If the source was deleted, the module can inserted but not updated in the board. if( frame && module_in_edit && module_in_edit->GetLink() ) // this is not a new module { BOARD* mainpcb = frame->GetBoard(); MODULE* source_module = mainpcb->m_Modules; // search if the source module was not deleted: for( ; source_module != NULL; source_module = source_module->Next() ) { if( module_in_edit->GetLink() == source_module->GetTimeStamp() ) break; } canInsert = ( source_module == NULL ); } aEvent.Enable( canInsert ); }
/// Redraws the zone outline when moving a corner according to the cursor position void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent(); ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem(); if( aErase ) // Undraw edge in old position { zone->Draw( aPanel, aDC, GR_XOR ); } wxPoint pos = pcbframe->GetScreen()->GetCrossHairPosition(); if( zone->IsMoving() ) { wxPoint offset; offset = pos - s_CursorLastPosition; zone->Move( offset ); s_CursorLastPosition = pos; } else if( zone->IsDragging() ) { wxPoint offset; offset = pos - s_CursorLastPosition; zone->MoveEdge( offset ); s_CursorLastPosition = pos; } else { zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y ); } zone->Draw( aPanel, aDC, GR_XOR ); }
bool DIALOG_TARGET_PROPERTIES::TransferDataFromWindow() { // Zero-size targets are hard to see/select. if( !m_Size.Validate( Mils2iu( 1 ), INT_MAX ) ) return false; BOARD_COMMIT commit( m_Parent ); commit.Modify( m_Target ); if( m_DC ) m_Target->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); // Save old item in undo list, if is is not currently edited (will be later if so) bool pushCommit = ( m_Target->GetFlags() == 0 ); if( m_Target->GetFlags() != 0 ) // other edit in progress (MOVE, NEW ..) m_Target->SetFlags( IN_EDIT ); // set flag in edit to force // undo/redo/abort proper operation m_Target->SetWidth( m_Thickness.GetValue() ); m_Target->SetSize( m_Size.GetValue() ); m_Target->SetShape( m_TargetShape->GetSelection() ? 1 : 0 ); if( m_DC ) m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR ); if( pushCommit ) commit.Push( _( "Modified alignment target" ) ); return true; }
/* Redraws the zone outlines when moving mouse */ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent(); wxPoint c_pos = pcbframe->GetScreen()->GetCrossHairPosition(); ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour; if( !zone ) return; int icorner = zone->GetNumCorners() - 1; if( icorner < 1 ) return; // We must have 2 (or more) corners if( aErase ) // Undraw edge in old position { zone->DrawWhileCreateOutline( aPanel, aDC ); } // Redraw the current edge in its new position if( pcbframe->GetZoneSettings().m_Zone_45_Only ) { // calculate the new position as allowed wxPoint StartPoint = zone->GetCornerPosition( icorner - 1 ); CalculateSegmentEndPoint( c_pos, StartPoint.x, StartPoint.y, &c_pos.x, &c_pos.y ); } zone->SetCornerPosition( icorner, c_pos ); zone->DrawWhileCreateOutline( aPanel, aDC ); }
int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) { const BOARD_CONNECTED_ITEM* item = aEvent.Parameter<const BOARD_CONNECTED_ITEM*>(); PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>(); VIEW_CONTROLS* ctls = getViewControls(); m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); Activate(); m_router->SyncWorld(); m_startItem = m_router->GetWorld()->FindItemByParent( item ); if( m_startItem && m_startItem->IsLocked() ) { if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) ) return false; } VECTOR2I p0 = ctls->GetCursorPosition(); bool dragStarted = m_router->StartDragging( p0, m_startItem ); if( !dragStarted ) return 0; ctls->ForceCursorPosition( false ); ctls->SetAutoPan( true ); frame->UndoRedoBlock( true ); while( OPT_TOOL_EVENT evt = Wait() ) { if( evt->IsCancel() ) { break; } else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) { updateEndItem( *evt ); m_router->Move( m_endSnapPoint, m_endItem ); } else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) { updateEndItem( *evt ); m_router->FixRoute( m_endSnapPoint, m_endItem ); break; } } if( m_router->RoutingInProgress() ) m_router->StopRouting(); ctls->SetAutoPan( false ); ctls->ShowCursor( false ); frame->UndoRedoBlock( false ); return 0; }
/* Updates the different parameters for the component being edited */ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event ) { if( m_DC ) m_Target->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); // Save old item in undo list, if is is not currently edited (will be later if so) if( m_Target->GetFlags() == 0 ) m_Parent->SaveCopyInUndoList( m_Target, UR_CHANGED ); if( m_Target->GetFlags() != 0 ) // other edition in progress (MOVE, NEW ..) m_Target->SetFlags( IN_EDIT ); // set flag in edit to force // undo/redo/abort proper operation int tmp = ValueFromString( g_UserUnit, m_TargetThicknessCtrl->GetValue() ); m_Target->SetWidth( tmp ); MireDefaultSize = ValueFromString( g_UserUnit, m_TargetSizeCtrl->GetValue() ); m_Target->SetSize( MireDefaultSize ); m_Target->SetShape( m_TargetShape->GetSelection() ? 1 : 0 ); if( m_DC ) m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR ); m_Parent->OnModify(); EndModal( 1 ); }
/** Abort function for drag or move track */ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) { PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) aPanel->GetParent(); BOARD * pcb = frame->GetBoard(); pcb->HighLightOFF(); pcb->PopHighLight(); frame->SetCurItem( NULL ); aPanel->SetMouseCapture( NULL, NULL ); // Undo move and redraw trace segments. for( unsigned jj=0 ; jj < g_DragSegmentList.size(); jj++ ) { TRACK* track = g_DragSegmentList[jj].m_Track; g_DragSegmentList[jj].RestoreInitialValues(); track->SetState( IN_EDIT, false ); track->ClearFlags(); } // Clear the undo picker list: s_ItemsListPicker.ClearListAndDeleteItems(); EraseDragList(); aPanel->Refresh(); }
void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) { if( m_DC ) // Delete old text. { CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); } m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED); if( m_Name->GetValue() != wxEmptyString ) { CurrentDimension->SetText( m_Name->GetValue() ); } wxString msg; // Get new size value: msg = m_TxtSizeXCtrl->GetValue(); CurrentDimension->Text().SetWidth( ReturnValueFromString( g_UserUnit, msg ) ); msg = m_TxtSizeYCtrl->GetValue(); CurrentDimension->Text().SetHeight( ReturnValueFromString( g_UserUnit, msg ) ); // Get new position value: // It will be copied later in dimension, because msg = m_textCtrlPosX->GetValue(); wxPoint pos; pos.x = ReturnValueFromString( g_UserUnit, msg ); msg = m_textCtrlPosY->GetValue(); pos.y = ReturnValueFromString( g_UserUnit, msg ); CurrentDimension->Text().SetTextPosition( pos ); // Get new line thickness value: msg = m_TxtWidthCtrl->GetValue(); int width = ReturnValueFromString( g_UserUnit, msg ); int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->Text().GetSize() ); if( width > maxthickness ) { DisplayError( NULL, _( "The text thickness is too large for the text size. It will be clamped") ); width = maxthickness; } CurrentDimension->SetWidth( width ); CurrentDimension->Text().SetThickness( width ); CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false ); CurrentDimension->SetLayer( m_SelLayerBox->GetLayerSelection() ); if( m_DC ) // Display new text { CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_OR ); } m_Parent->OnModify(); EndModal( 1 ); }
bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) { MODULE* newModule; PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false ); if( frame == NULL ) // happens if no board editor opened return false; if( aModule == NULL ) { if( ! frame->GetBoard() || ! frame->GetBoard()->m_Modules ) return false; aModule = SelectFootprint( frame->GetBoard() ); } if( aModule == NULL ) return false; SetCurItem( NULL ); Clear_Pcb( false ); GetBoard()->m_Status_Pcb = 0; newModule = new MODULE( *aModule ); newModule->SetParent( GetBoard() ); newModule->SetLink( aModule->GetTimeStamp() ); aModule = newModule; GetBoard()->Add( newModule ); newModule->ClearFlags(); // Clear references to net info, because the footprint editor // does know any thing about nets handled by the current edited board. // Morever the main board can change or the net info relative to this main board // can change while editing this footprint in the footprint editor for( D_PAD* pad = newModule->Pads(); pad; pad = pad->Next() ) pad->SetNetCode( NETINFO_LIST::UNCONNECTED ); SetCrossHairPosition( wxPoint( 0, 0 ) ); PlaceModule( newModule, NULL ); // Put it on FRONT layer, // because this is the default in ModEdit, and in libs if( newModule->GetLayer() != LAYER_N_FRONT ) newModule->Flip( newModule->GetPosition() ); // Put it in orientation 0, // because this is the default orientation in ModEdit, and in libs Rotate_Module( NULL, newModule, 0, false ); GetScreen()->ClrModify(); Zoom_Automatique( false ); return true; }
/* MacOSX: Needed for file association * http://wiki.wxwidgets.org/WxMac-specific_topics */ void EDA_APP::MacOpenFile( const wxString& fileName ) { wxFileName filename = fileName; PCB_EDIT_FRAME* frame = ( (PCB_EDIT_FRAME*) GetTopWindow() ); if( !filename.FileExists() ) return; frame->LoadOnePcbFile( fileName, false ); }
int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent ) { PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>(); LAYER_NUM layer = editFrame->GetActiveLayer(); layer = ( layer + 1 ) % ( LAST_COPPER_LAYER + 1 ); assert( IsCopperLayer( layer ) ); editFrame->SwitchLayer( NULL, layer ); editFrame->GetGalCanvas()->SetFocus(); setTransitions(); return 0; }
void DIALOG_PLOT::onRunDRC( wxCommandEvent& event ) { PCB_EDIT_FRAME* parent = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() ); if( parent ) { // First close an existing dialog if open // (low probability, but can happen) parent->GetDrcController()->DestroyDRCDialog( wxID_OK ); // Open a new drc dialod, with the right parent frame, and in Modal Mode parent->GetDrcController()->ShowDRCDialog( this ); } }
TOOL_SETTINGS::TOOL_SETTINGS( TOOL_BASE* aTool ) { m_tool = aTool; if( !aTool ) { m_config = NULL; return; } // fixme: make independent of pcbnew (post-stable) PCB_EDIT_FRAME* frame = aTool->getEditFrame<PCB_EDIT_FRAME>(); m_config = frame->GetSettings(); }
void DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { // Build the absolute path of current output plot directory // to preselect it when opening the dialog. wxFileName fn( m_outputDirectoryName->GetValue() ); wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() ); wxDirDialog dirDialog( this, _( "Select Output Directory" ), path ); if( dirDialog.ShowModal() == wxID_CANCEL ) return; wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() ); wxMessageDialog dialog( this, _( "Use a relative path? "), _( "Plot Output Directory" ), wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT ); if( dialog.ShowModal() == wxID_YES ) { wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName()).GetPath(); if( !dirName.MakeRelativeTo( boardFilePath ) ) wxMessageBox( _( "Cannot make path relative (target volume different from board file volume)!" ), _( "Plot Output Directory" ), wxOK | wxICON_ERROR ); } m_outputDirectoryName->SetValue( dirName.GetFullPath() ); }
bool DIALOG_SWAP_LAYERS::TransferDataToWindow() { LSET enabledCopperLayers = LSET::AllCuMask( m_parent->GetBoard()->GetCopperLayerCount() ); int row = 0; for( size_t layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer ) { if( enabledCopperLayers.test( layer ) ) { auto attr = new wxGridCellAttr; attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_parent ) ); attr->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) ); attr->SetReadOnly(); m_grid->SetAttr( row, 0, attr ); attr = new wxGridCellAttr; attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_parent ) ); attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_parent, LSET::AllNonCuMask() ) ); m_grid->SetAttr( row, 1, attr ); m_grid->GetTable()->SetValueAsLong( row, 0, (long) layer ); m_grid->GetTable()->SetValueAsLong( row, 1, (long) layer ); ++row; } } return true; }
MICROWAVE_TOOL_INFO getMicrowaveItemCreator( PCB_EDIT_FRAME& frame, int aParam ) { MICROWAVE_TOOL_INFO info; switch( aParam ) { case MWAVE_TOOL_SIMPLE_ID::GAP: info.name = _( "Add Gap" ); info.toolId = ID_PCB_MUWAVE_TOOL_GAP_CMD; info.creatorFunc = [&frame] () { return std::unique_ptr<MODULE>( frame.Create_MuWaveComponent( 0 ) ); }; break; case MWAVE_TOOL_SIMPLE_ID::STUB: info.name = _( "Add Stub" ); info.toolId = ID_PCB_MUWAVE_TOOL_STUB_CMD; info.creatorFunc = [&frame] () { return std::unique_ptr<MODULE>( frame.Create_MuWaveComponent( 1 ) ); }; break; case MWAVE_TOOL_SIMPLE_ID::STUB_ARC: info.name = _( "Add Stub (Arc)" ); info.toolId = ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD; info.creatorFunc = [&frame] () { return std::unique_ptr<MODULE>( frame.Create_MuWaveComponent( 2 ) ); }; break; case MWAVE_TOOL_SIMPLE_ID::FUNCTION_SHAPE: info.name = _( "Add Polynomial Shape" ); info.toolId = ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD; info.creatorFunc = [&frame] () { return std::unique_ptr<MODULE>( frame.Create_MuWavePolygonShape() ); }; break; default: // Avoid uninitilized value: info.toolId = 0; // info.name is already set to empty string break; }; return info; }
/** * Function Abort_Zone_Create_Outline * cancels the Begin_Zone command if at least one EDGE_ZONE was created. */ static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC ) { PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent(); ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour; if( zone ) { zone->DrawWhileCreateOutline( Panel, DC, GR_XOR ); zone->ClearFlags(); zone->RemoveAllContours(); } pcbframe->SetCurItem( NULL ); s_AddCutoutToCurrentZone = false; s_CurrentZone = NULL; Panel->SetMouseCapture( NULL, NULL ); }
/* Function called to abort a track creation */ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC ) { PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent(); BOARD* pcb = frame->GetBoard(); TRACK* track = (TRACK*) frame->GetCurItem(); if( track && ( track->Type()==PCB_VIA_T || track->Type()==PCB_TRACE_T ) ) { // Erase the current drawing ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false ); if( pcb->IsHighLightNetON() ) frame->HighLight( DC ); pcb->PopHighLight(); if( pcb->IsHighLightNetON() ) pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() ); frame->ClearMsgPanel(); // Undo pending changes (mainly a lock point creation) and clear the // undo picker list: frame->PutDataInPreviousState( &s_ItemsListPicker, false, false ); s_ItemsListPicker.ClearListAndDeleteItems(); // Delete current (new) track g_CurrentTrackList.DeleteAll(); } frame->SetCurItem( NULL ); }
void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( ) { PCB_PLOT_PARAMS plot_opts = m_parent->GetPlotSettings(); s_Parameters.m_PrintMirror = m_Print_Mirror->GetValue(); s_Parameters.m_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue(); s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection() != 0; s_Parameters.m_DrillShapeOpt = (PRINT_PARAMETERS::DrillShapeOptT) m_Drill_Shape_Opt->GetSelection(); if( m_PagesOption ) s_Parameters.m_OptionPrintPage = m_PagesOption->GetSelection() != 0; SetLayerSetFromListSelection(); int idx = m_ScaleOption->GetSelection(); s_Parameters.m_PrintScale = s_ScaleList[idx]; plot_opts.SetScale( s_Parameters.m_PrintScale ); if( m_FineAdjustXscaleOpt ) { if( s_Parameters.m_XScaleAdjust > MAX_SCALE || s_Parameters.m_YScaleAdjust > MAX_SCALE ) DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very large value" ) ); m_FineAdjustXscaleOpt->GetValue().ToDouble( &s_Parameters.m_XScaleAdjust ); } if( m_FineAdjustYscaleOpt ) { // Test for a reasonnable scale value if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust < MIN_SCALE ) DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very small value" ) ); m_FineAdjustYscaleOpt->GetValue().ToDouble( &s_Parameters.m_YScaleAdjust ); } plot_opts.SetFineScaleAdjustX( s_Parameters.m_XScaleAdjust ); plot_opts.SetFineScaleAdjustY( s_Parameters.m_YScaleAdjust ); m_parent->SetPlotSettings( plot_opts ); SetPenWidth(); }
// Displays the list of available footprints in library name and select a footprint. void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event ) { wxString newname; newname = m_parent->SelectFootprint( m_parent, wxEmptyString, wxEmptyString, wxEmptyString, Prj().PcbFootprintLibs() ); if( newname != wxEmptyString ) m_NewFootprintFPID->SetValue( newname ); }
void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event ) { if( IsModal() ) { // @todo(DICK) ExportSelectedFootprint( event ); // Prevent the double click from being as a single mouse button release // event in the parent window which would cause the part to be parked // rather than staying in move mode. // Remember the mouse button will be released in the parent window // thus creating a mouse button release event which should be ignored PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() ); // The parent may not be the board editor: if( pcbframe ) { pcbframe->SkipNextLeftButtonReleaseEvent(); } } }
/** * Function Abort_Zone_Move_Corner_Or_Outlines * cancels the Begin_Zone state if at least one EDGE_ZONE has been created. */ void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC ) { PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent(); ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem(); if( zone->IsMoving() ) { wxPoint offset; offset = s_CornerInitialPosition - s_CursorLastPosition; zone->Move( offset ); } else if( zone->IsDragging() ) { wxPoint offset; offset = s_CornerInitialPosition - s_CursorLastPosition; zone->MoveEdge( offset ); } else { if( s_CornerIsNew ) { zone->m_Poly->DeleteCorner( zone->m_CornerSelection ); } else { wxPoint pos = s_CornerInitialPosition; zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y ); } } Panel->SetMouseCapture( NULL, NULL ); s_AuxiliaryList.ClearListAndDeleteItems(); s_PickedList. ClearListAndDeleteItems(); Panel->Refresh(); pcbframe->SetCurItem( NULL ); zone->ClearFlags(); s_AddCutoutToCurrentZone = false; s_CurrentZone = NULL; }
void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event ) { wxFileName fn; wxString msg; // Build the .cmp file name from the board name fn = m_parent->GetBoard()->GetFileName(); fn.SetExt( ComponentFileExtension ); if( RecreateCmpFile( m_parent->GetBoard(), fn.GetFullPath() ) ) { msg.Printf( _( "File '%s' created\n" ), GetChars( fn.GetFullPath() ) ); } else { msg.Printf( _( "** Could not create file '%s' ***\n" ), GetChars( fn.GetFullPath() ) ); } m_WinMessages->AppendText( msg ); }
bool DIALOG_EXCHANGE_MODULE::change_1_Module( MODULE* aModule, const LIB_ID& aNewFootprintFPID, bool aShowError ) { MODULE* newModule; wxString line; if( aModule == NULL ) return false; wxBusyCursor dummy; // Copy parameters from the old module. LIB_ID oldFootprintFPID = aModule->GetFPID(); // Load module. line.Printf( _( "Change footprint '%s' (from '%s') to '%s'" ), GetChars( aModule->GetReference() ), oldFootprintFPID.Format().c_str(), aNewFootprintFPID.Format().c_str() ); m_WinMessages->AppendText( line ); newModule = m_parent->LoadFootprint( aNewFootprintFPID ); if( newModule == NULL ) // New module not found, redraw the old one. { m_WinMessages->AppendText( wxT( " No\n" ) ); return false; } m_parent->Exchange_Module( aModule, newModule, m_commit ); if( aModule == m_currentModule ) m_currentModule = newModule; m_WinMessages->AppendText( wxT( " OK\n" ) ); return true; }
void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event ) /*******************************************************************/ { int thickness; if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N ) thickness = m_brdSettings.m_EdgeSegmentWidth; else thickness = m_brdSettings.m_DrawSegmentWidth; PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, m_parent->GetInternalUnits() ); }