void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation ) { SCH_SCREEN* screen = GetScreen(); SCH_ITEM* item = screen->GetCurItem(); SCH_COMPONENT* component = (SCH_COMPONENT*) item; GetCanvas()->MoveCursorToCrossHair(); if( item->GetFlags() == 0 ) SetUndoItem( item ); component->SetOrientation( aOrientation ); m_canvas->CrossHairOn( ); if( item->GetFlags() == 0 ) { addCurrentItemToScreen(); SchematicCleanUp(); } TestDanglingEnds(); RefreshItem( item ); if( item->GetFlags() == 0 ) OnModify(); }
void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation ) { SCH_SCREEN* screen = GetScreen(); SCH_ITEM* item = screen->GetCurItem(); wxCHECK_RET( item != NULL && item->Type() == SCH_COMPONENT_T, wxT( "Cannot change orientation of invalid schematic item." ) ); SCH_COMPONENT* component = (SCH_COMPONENT*) item; m_canvas->MoveCursorToCrossHair(); if( item->GetFlags() == 0 ) SetUndoItem( item ); INSTALL_UNBUFFERED_DC( dc, m_canvas ); component->SetOrientation( aOrientation ); m_canvas->CrossHairOn( &dc ); if( item->GetFlags() == 0 ) { addCurrentItemToList(); SchematicCleanUp( true ); } if( GetScreen()->TestDanglingEnds() ) m_canvas->Refresh(); OnModify(); }
void WinEDA_PlotPSFrame::CreatePSFile(int AllPages, int pagesize) /*************************************************************/ { wxString PlotFileName, ShortFileName; BASE_SCREEN *screen; Ki_PageDescr * PlotSheet, * RealSheet; int BBox[4]; wxPoint plot_offset; SchematicCleanUp(NULL); g_PlotFormat = PLOT_FORMAT_POST; screen = ActiveScreen; if ( AllPages == TRUE ) { screen = ScreenSch; } while( screen ) { PlotSheet = screen->m_CurrentSheet; RealSheet = &g_Sheet_A4; if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet; else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A; /* Calcul des limites de trace en 1/1000 pouce */ BBox[0] = BBox[1] = g_PlotMargin; // Plot margin in 1/1000 inch BBox[2] = RealSheet->m_Size.x - g_PlotMargin; BBox[3] = RealSheet->m_Size.y - g_PlotMargin; /* Calcul des echelles de conversion */ g_PlotScaleX = SCALE_PS * (float) (BBox[2] - BBox[0]) / PlotSheet->m_Size.x; g_PlotScaleY = SCALE_PS * (float) (BBox[3] - BBox[1]) / PlotSheet->m_Size.y; plot_offset.x = 0; plot_offset.y = PlotSheet->m_Size.y; wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL); wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; if( ! ShortFileName.IsEmpty() ) PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".ps")); else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".ps")); PlotOneSheetPS(PlotFileName,screen, RealSheet, BBox, plot_offset); screen = (BASE_SCREEN*)screen->Pnext; if (AllPages == FALSE ) screen = NULL; } }
void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL(int Select_PlotAll, int HPGL_SheetSize) /***********************************************************************************/ { wxString PlotFileName, ShortFileName; BASE_SCREEN *screen; Ki_PageDescr * PlotSheet; wxSize SheetSize; wxPoint SheetOffset, PlotOffset; int margin; SchematicCleanUp(NULL); g_PlotFormat = PLOT_FORMAT_HPGL; screen = ActiveScreen; if ( Select_PlotAll == TRUE ) { screen = ScreenSch; } while( screen ) { ReturnSheetDims(screen, SheetSize, SheetOffset); /* Calcul des echelles de conversion */ g_PlotScaleX = Scale_X * SCALE_HPGL ; g_PlotScaleY = Scale_Y * SCALE_HPGL ; margin = 400; // Margin in mils PlotSheet = screen->m_CurrentSheet; g_PlotScaleX = g_PlotScaleX * (SheetSize.x - 2 * margin)/ PlotSheet->m_Size.x; g_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y; /* calcul des offsets */ PlotOffset.x = - (int)(SheetOffset.x * SCALE_HPGL); PlotOffset.y = (int)( (SheetOffset.y + SheetSize.y) * SCALE_HPGL); PlotOffset.x -= (int)(margin * SCALE_HPGL); PlotOffset.y += (int)(margin * SCALE_HPGL); wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL); wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; if( ! ShortFileName.IsEmpty() ) PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".plt")); else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".plt")); InitPlotParametresHPGL(PlotOffset, g_PlotScaleX, g_PlotScaleY); Plot_1_Page_HPGL(PlotFileName,screen); screen = (BASE_SCREEN*)screen->Pnext; if ( Select_PlotAll == FALSE ) screen = NULL; } m_MsgBox->AppendText(_("** Plot End **\n")); }
void SCH_EDIT_FRAME::DisplayCurrentSheet() { SetRepeatItem( NULL ); ClearMsgPanel(); SCH_SCREEN* screen = m_CurrentSheet->LastScreen(); // Switch to current sheet, // and update the grid size, because it can be modified in latest screen SetScreen( screen ); GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ); // update the References m_CurrentSheet->UpdateAllScreenReferences(); SetSheetNumberAndCount(); m_canvas->SetCanStartBlock( -1 ); if( screen->m_FirstRedraw ) { Zoom_Automatique( false ); screen->m_FirstRedraw = false; SetCrossHairPosition( GetScrollCenterPosition() ); m_canvas->MoveCursorToCrossHair(); // Ensure the schematic is fully segmented on first display BreakSegmentsOnJunctions(); SchematicCleanUp( true ); screen->ClearUndoORRedoList( screen->m_UndoList, 1 ); screen->TestDanglingEnds(); } else { RedrawScreen( GetScrollCenterPosition(), true ); } // Some items (wires, labels) can be highlighted. So prepare the highlight flag: SetCurrentSheetHighlightFlags(); // Now refresh m_canvas. Should be not necessary, but because screen has changed // the previous refresh has set all new draw parameters (scroll position ..) // but most of time there were some inconsitencies about cursor parameters // ( previous position of cursor ...) and artefacts can happen // mainly when sheet size has changed // This second refresh clears artefacts because at this point, // all parameters are now updated m_canvas->Refresh(); }
void WinEDA_ErcFrame::TestErc(wxCommandEvent& event) /**************************************************/ { ObjetNetListStruct * NetItemRef, * OldItem, * StartNet, * Lim; int NetNbItems, MinConn; if ( ! DiagErcTableInit ) { memcpy(DiagErc, DefaultDiagErc, sizeof (DefaultDiagErc)); DiagErcTableInit = TRUE; } WriteFichierERC = m_WriteResultOpt->GetValue(); if( CheckAnnotate(m_Parent, 0) ) { DisplayError(this, _("Annotation Required!") ); return; } /* Effacement des anciens marqueurs DRC */ DelERCMarkers(event); wxClientDC dc(m_Parent->DrawPanel); m_Parent->DrawPanel->PrepareGraphicContext(&dc); g_EESchemaVar.NbErrorErc = 0; g_EESchemaVar.NbWarningErc = 0; SchematicCleanUp(&dc); BuildNetList(m_Parent, ScreenSch); /* Analyse de la table des connexions : */ Lim = g_TabObjNet + g_NbrObjNet; /* Reset du flag m_FlagOfConnection, utilise par la suite */ for (NetItemRef = g_TabObjNet; NetItemRef < Lim; NetItemRef ++ ) NetItemRef->m_FlagOfConnection = (IsConnectType) 0; NetNbItems = 0; MinConn = NOC; StartNet = OldItem = NetItemRef = g_TabObjNet; for ( ; NetItemRef < Lim; NetItemRef ++ ) { /* Tst changement de net */ if( OldItem->m_NetCode != NetItemRef->m_NetCode) { MinConn = NOC; NetNbItems = 0; StartNet = NetItemRef; } switch ( NetItemRef->m_Type ) { case NET_SEGMENT: case NET_BUS: case NET_JONCTION: case NET_LABEL: case NET_BUSLABELMEMBER: case NET_PINLABEL: break; case NET_GLOBLABEL: case NET_GLOBBUSLABELMEMBER: case NET_SHEETLABEL: case NET_SHEETBUSLABELMEMBER: TestLabel(m_Parent->DrawPanel, &dc, NetItemRef, StartNet); break; case NET_NOCONNECT: MinConn = NET_NC; if( NetNbItems != 0 ) Diagnose(m_Parent->DrawPanel, &dc, NetItemRef, NULL, MinConn, UNC); break; case NET_PIN: TestOthersItems(m_Parent->DrawPanel, &dc, NetItemRef, StartNet, &NetNbItems , &MinConn); break; } OldItem = NetItemRef; } FreeTabNetList(g_TabObjNet, g_NbrObjNet ); wxString num; num.Printf(wxT("%d"), g_EESchemaVar.NbErrorErc); m_TotalErrCount->SetLabel(num); num.Printf(wxT("%d"), g_EESchemaVar.NbErrorErc-g_EESchemaVar.NbWarningErc); m_LastErrCount->SetLabel(num); num.Printf(wxT("%d"), g_EESchemaVar.NbWarningErc); m_LastWarningCount->SetLabel(num); /* Generation ouverture fichier diag */ if( WriteFichierERC == TRUE ) { wxString ErcFullFileName; ErcFullFileName = ScreenSch->m_FileName; ChangeFileNameExt(ErcFullFileName, wxT(".erc")); ErcFullFileName = EDA_FileSelector(_("ERC file:"), wxEmptyString, /* Chemin par defaut */ ErcFullFileName, /* nom fichier par defaut */ wxT(".erc"), /* extension par defaut */ wxT("*.erc"), /* Masque d'affichage */ this, wxSAVE, TRUE ); if ( ErcFullFileName.IsEmpty()) return; if ( WriteDiagnosticERC(ErcFullFileName) ) { Close(TRUE); wxString editorname = GetEditorName(); AddDelimiterString(ErcFullFileName); ExecuteFile(this, editorname, ErcFullFileName); } } }