Commit 506a73c3 authored by stambaughw's avatar stambaughw

More comment translation work.

* Translate source files D through L in pcbnew.
* Add translate tag for comments that did not translate correctly.
parent ab66f9ec
...@@ -902,7 +902,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) ...@@ -902,7 +902,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
/* Draw keep out area of a module. */ /* Draw keep out area of a module. */
/***********************************/ /***********************************/
/* ??? /* TRANSLATE
* les cellules ( du plan des Distances ) du rectangle x0,y0 a x1,y1 sont * les cellules ( du plan des Distances ) du rectangle x0,y0 a x1,y1 sont
* incrementees de la valeur Penalite * incrementees de la valeur Penalite
* celles qui sont externes au rectangle, mais internes au rectangle * celles qui sont externes au rectangle, mais internes au rectangle
......
...@@ -344,7 +344,7 @@ int Build_Work( BOARD* Pcb ) ...@@ -344,7 +344,7 @@ int Build_Work( BOARD* Pcb )
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ ) for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
{ {
pt_rats = &Pcb->m_FullRatsnest[ii]; pt_rats = &Pcb->m_FullRatsnest[ii];
/* ??? On ne route que les chevelus actifs et routables */ /* TRANSLATE On ne route que les chevelus actifs et routables */
if( (pt_rats->m_Status & CH_ACTIF) == 0 ) if( (pt_rats->m_Status & CH_ACTIF) == 0 )
continue; continue;
if( pt_rats->m_Status & CH_UNROUTABLE ) if( pt_rats->m_Status & CH_UNROUTABLE )
......
/*********************************************/ /******************************************/
/* Edition des pistes: Routines d'effacement */ /* Edit Track: Erase Routines */
/* Effacement de segment, piste, net et zone */ /* Delete segments, tracks, and net areas */
/*********************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -14,16 +13,12 @@ ...@@ -14,16 +13,12 @@
#include "protos.h" #include "protos.h"
/***************************************************************/ /* Removes 1 segment of track.
TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) * 2 cases:
/***************************************************************/ * If There is evidence of new track: delete new segment.
* Otherwise, delete segment under the cursor.
/* Supprime 1 segment de piste.
* 2 Cas possibles:
* Si On est en trace de nouvelle piste: Effacement du segment en
* cours de trace
* Sinon : Effacment du segment sous le curseur.
*/ */
TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
{ {
int current_net_code; int current_net_code;
...@@ -36,7 +31,8 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -36,7 +31,8 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
return NULL; return NULL;
} }
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last
// segment
{ {
if( g_CurrentTrackList.GetCount() > 0 ) if( g_CurrentTrackList.GetCount() > 0 )
{ {
...@@ -44,7 +40,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -44,7 +40,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
D( g_CurrentTrackList.VerifyListIntegrity(); ) D( g_CurrentTrackList.VerifyListIntegrity(); )
// effacement de la piste en cours // Delete the current trace
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
// delete the most recently entered // delete the most recently entered
...@@ -52,32 +48,37 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -52,32 +48,37 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
// if in 2 track mode, and the next most recent is a segment not a via, // if in 2 track mode, and the next most recent is a segment
// and the one previous to that is a via, then delete up to the via. // not a via, and the one previous to that is a via, then
// delete up to the via.
if( g_CurrentTrackList.GetCount() >= 2 if( g_CurrentTrackList.GetCount() >= 2
&& g_CurrentTrackSegment->Type() != TYPE_VIA && g_CurrentTrackSegment->Type() != TYPE_VIA
&& g_CurrentTrackSegment->Back()->Type() == TYPE_VIA ) && g_CurrentTrackSegment->Back()->Type() == TYPE_VIA )
{ {
delete g_CurrentTrackList.PopBack(); delete g_CurrentTrackList.PopBack();
} }
} }
while( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() == TYPE_VIA ) while( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() ==
TYPE_VIA )
{ {
delete g_CurrentTrackList.PopBack(); delete g_CurrentTrackList.PopBack();
if( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() != TYPE_VIA ) if( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() !=
TYPE_VIA )
previous_layer = g_CurrentTrackSegment->GetLayer(); previous_layer = g_CurrentTrackSegment->GetLayer();
} }
// Rectification couche active qui a pu changer si une via // Correct active layer which could change if a via
// a ete effacee // has been erased
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = previous_layer; ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = previous_layer;
UpdateStatusBar(); UpdateStatusBar();
if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more, or 0 if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more,
// or 0
{ {
if( g_CurrentTrackList.GetCount()==1 && g_CurrentTrackSegment->Type() != TYPE_VIA ) if( g_CurrentTrackList.GetCount() == 1
&& g_CurrentTrackSegment->Type() != TYPE_VIA )
{ {
delete g_CurrentTrackList.PopBack(); delete g_CurrentTrackList.PopBack();
} }
...@@ -107,9 +108,10 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -107,9 +108,10 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
current_net_code = aTrack->GetNet(); current_net_code = aTrack->GetNet();
DLIST<TRACK>* container = (DLIST<TRACK>*) aTrack->GetList(); DLIST<TRACK>* container = (DLIST<TRACK>*)aTrack->GetList();
wxASSERT( container ); wxASSERT( container );
container->Remove( aTrack ); container->Remove( aTrack );
// redraw the area where the track was // redraw the area where the track was
DrawPanel->PostDirtyRect( aTrack->GetBoundingBox() ); DrawPanel->PostDirtyRect( aTrack->GetBoundingBox() );
...@@ -122,9 +124,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -122,9 +124,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
} }
/**********************************************************/
void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* aTrack ) void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* aTrack )
/**********************************************************/
{ {
if( aTrack != NULL ) if( aTrack != NULL )
{ {
...@@ -136,18 +136,16 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* aTrack ) ...@@ -136,18 +136,16 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* aTrack )
} }
/********************************************************/
void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack ) void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack )
/********************************************************/
{ {
if( aTrack == NULL ) if( aTrack == NULL )
return; return;
if( !IsOK( this, _( "Delete NET ?" ) ) ) if( !IsOK( this, _( "Delete NET?" ) ) )
return; return;
PICKED_ITEMS_LIST itemsList; PICKED_ITEMS_LIST itemsList;
ITEM_PICKER picker(NULL,UR_DELETED); ITEM_PICKER picker( NULL, UR_DELETED );
int net_code_delete = aTrack->GetNet(); int net_code_delete = aTrack->GetNet();
/* Search the first item for the given net code */ /* Search the first item for the given net code */
...@@ -155,7 +153,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack ) ...@@ -155,7 +153,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack )
/* Remove all segments having the given net code */ /* Remove all segments having the given net code */
int ii = 0; int ii = 0;
TRACK * next_track; TRACK* next_track;
for( TRACK* segm = trackList; segm; segm = next_track, ++ii ) for( TRACK* segm = trackList; segm; segm = next_track, ++ii )
{ {
next_track = segm->Next(); next_track = segm->Next();
...@@ -163,64 +161,63 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack ) ...@@ -163,64 +161,63 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack )
break; break;
GetBoard()->m_Track.Remove( segm ); GetBoard()->m_Track.Remove( segm );
// redraw the area where the track was // redraw the area where the track was
DrawPanel->PostDirtyRect( segm->GetBoundingBox() ); DrawPanel->PostDirtyRect( segm->GetBoundingBox() );
picker.m_PickedItem = segm; picker.m_PickedItem = segm;
picker.m_PickedItemType = segm->Type(); picker.m_PickedItemType = segm->Type();
itemsList.PushItem(picker); itemsList.PushItem( picker );
} }
SaveCopyInUndoList( itemsList, UR_DELETED ); SaveCopyInUndoList( itemsList, UR_DELETED );
GetScreen()->SetModify(); GetScreen()->SetModify();
test_1_net_connexion( DC, net_code_delete ); test_1_net_connexion( DC, net_code_delete );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
} }
/********************************************************************/ /* Remove 1 track:
void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) * The leading segment is removed and all adjacent segments
/********************************************************************/ * until a pad or a junction point of more than 2 segments is found
/* Routine de suppression de 1 piste:
* le segment pointe est supprime puis les segments adjacents
* jusqu'a un pad ou un point de jonction de plus de 2 segments
*/ */
void WinEDA_PcbFrame::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
{ {
int segments_to_delete_count; int segments_to_delete_count;
if( pt_segm == NULL ) if( pt_segm == NULL )
return; return;
TRACK* trackList = Marque_Une_Piste( GetBoard(), pt_segm, &segments_to_delete_count, NULL, true ); TRACK* trackList = Marque_Une_Piste( GetBoard(), pt_segm,
&segments_to_delete_count, NULL, true );
if( segments_to_delete_count == 0 ) if( segments_to_delete_count == 0 )
return; return;
int net_code = pt_segm->GetNet(); int net_code = pt_segm->GetNet();
PICKED_ITEMS_LIST itemsList; PICKED_ITEMS_LIST itemsList;
ITEM_PICKER picker(NULL,UR_DELETED); ITEM_PICKER picker( NULL, UR_DELETED );
int ii = 0; int ii = 0;
TRACK* tracksegment = trackList; TRACK* tracksegment = trackList;
TRACK * next_track; TRACK* next_track;
for( ; ii < segments_to_delete_count; ii++, tracksegment = next_track ) for( ; ii < segments_to_delete_count; ii++, tracksegment = next_track )
{ {
next_track = tracksegment->Next(); next_track = tracksegment->Next();
tracksegment->SetState( BUSY, OFF ); tracksegment->SetState( BUSY, OFF );
D(printf("%s: track %p status=\"%s\"\n", __func__, tracksegment, D( printf( "%s: track %p status=\"%s\"\n", __func__, tracksegment,
CONV_TO_UTF8( TRACK::ShowState( tracksegment->GetState(-1)) ) CONV_TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) )
);) ); )
GetBoard()->m_Track.Remove( tracksegment ); GetBoard()->m_Track.Remove( tracksegment );
// redraw the area where the track was // redraw the area where the track was
DrawPanel->PostDirtyRect( tracksegment->GetBoundingBox() ); DrawPanel->PostDirtyRect( tracksegment->GetBoundingBox() );
picker.m_PickedItem = tracksegment; picker.m_PickedItem = tracksegment;
picker.m_PickedItemType = tracksegment->Type(); picker.m_PickedItemType = tracksegment->Type();
itemsList.PushItem(picker); itemsList.PushItem( picker );
} }
SaveCopyInUndoList( itemsList, UR_DELETED ); SaveCopyInUndoList( itemsList, UR_DELETED );
if ( net_code > 0 ) if( net_code > 0 )
test_1_net_connexion( DC, net_code ); test_1_net_connexion( DC, net_code );
} }
This diff is collapsed.
...@@ -257,10 +257,10 @@ void DIALOG_MODULE_MODULE_EDITOR::Browse3DLib( wxCommandEvent& event ) ...@@ -257,10 +257,10 @@ void DIALOG_MODULE_MODULE_EDITOR::Browse3DLib( wxCommandEvent& event )
fullpath.Replace( wxT( "/" ), wxT( "\\" ) ); fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
#endif #endif
fullfilename = EDA_FileSelector( _( "3D Shape:" ), fullfilename = EDA_FileSelector( _( "3D Shape:" ),
fullpath, /* Chemin par defaut */ fullpath,
wxEmptyString, /* nom fichier par defaut */ wxEmptyString,
g_Shapes3DExtBuffer, /* extension par defaut */ g_Shapes3DExtBuffer,
mask, /* Masque d'affichage */ mask,
this, this,
wxFD_OPEN, wxFD_OPEN,
TRUE TRUE
......
This diff is collapsed.
This diff is collapsed.
...@@ -15,7 +15,7 @@ static wxString Current_PadNetName; ...@@ -15,7 +15,7 @@ static wxString Current_PadNetName;
#define NBSHAPES 4 #define NBSHAPES 4
int CodeShape[NBSHAPES] = /* forme des pads */ int CodeShape[NBSHAPES] = /* Pad shapes. */
{ {
PAD_CIRCLE, PAD_OVAL, PAD_RECT, PAD_TRAPEZOID PAD_CIRCLE, PAD_OVAL, PAD_RECT, PAD_TRAPEZOID
}; };
...@@ -409,7 +409,7 @@ void DIALOG_PAD_PROPERTIES::SetPadLayersList( long layer_mask ) ...@@ -409,7 +409,7 @@ void DIALOG_PAD_PROPERTIES::SetPadLayersList( long layer_mask )
void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
/*************************************************************************/ /*************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'dition /* Updates the different parameters for the component being edited.
*/ */
{ {
long PadLayerMask; long PadLayerMask;
......
This diff is collapsed.
/******************************************************/ /**************************************/
/* edit.cpp: fonctions generales de l'edition du PCB */ /* edit.cpp: edit PCB implementation. */
/******************************************************/ /**************************************/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
...@@ -25,12 +25,8 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame, ...@@ -25,12 +25,8 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct* DrawStruct, wxDC* DC ); EDA_BaseStruct* DrawStruct, wxDC* DC );
/*********************************************************************/ /* Handles the selection of command events. */
void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
/*********************************************************************/
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
...@@ -136,7 +132,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -136,7 +132,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
break; break;
default: // Finish (abort ) the command default: // Finish (abort) the command
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
...@@ -298,7 +294,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -298,7 +294,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_END_LINE: case ID_POPUP_PCB_END_LINE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
// EndSegment(&dc); // EndSegment(&dc);
break; break;
case ID_POPUP_PCB_EDIT_TRACK: case ID_POPUP_PCB_EDIT_TRACK:
...@@ -555,7 +551,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -555,7 +551,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones. GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones.
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ ) for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
{ {
// Remove filled aresa in zone // Remove filled areas in zone
ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii ); ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
zone_container->m_FilledPolysList.clear();; zone_container->m_FilledPolysList.clear();;
} }
...@@ -969,10 +965,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -969,10 +965,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
} }
/****************************************************************/
static void Process_Move_Item( WinEDA_PcbFrame* frame, static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct* DrawStruct, wxDC* DC ) EDA_BaseStruct* DrawStruct, wxDC* DC )
/****************************************************************/
{ {
if( DrawStruct == NULL ) if( DrawStruct == NULL )
return; return;
...@@ -996,9 +990,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame, ...@@ -996,9 +990,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
} }
/***************************************************************/
void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
/***************************************************************/
{ {
if( Item == NULL ) if( Item == NULL )
return; return;
...@@ -1071,7 +1063,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) ...@@ -1071,7 +1063,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
default: default:
{ {
wxString Line; wxString Line;
Line.Printf( wxT( "Remove: StructType %d Inattendu" ), Line.Printf( wxT( "Remove: item type %d unknown." ),
Item->Type() ); Item->Type() );
DisplayError( this, Line ); DisplayError( this, Line );
} }
...@@ -1080,9 +1072,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) ...@@ -1080,9 +1072,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
} }
/****************************************************************/
void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
/*****************************************************************/
{ {
int preslayer = GetScreen()->m_Active_Layer; int preslayer = GetScreen()->m_Active_Layer;
...@@ -1115,8 +1105,8 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -1115,8 +1105,8 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// layers are also capable of being selected. // layers are also capable of being selected.
else else
{ {
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N) if( ( layer != COPPER_LAYER_N ) && ( layer != LAYER_CMP_N )
&& (layer >= GetBoard()->m_BoardSettings->GetCopperLayerCount() - 1) ) && ( layer >= GetBoard()->m_BoardSettings->GetCopperLayerCount() - 1 ) )
{ {
// Uncomment following command (and line 17) to beep // Uncomment following command (and line 17) to beep
// the speaker. (Doing that would provide feedback to // the speaker. (Doing that would provide feedback to
...@@ -1132,7 +1122,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -1132,7 +1122,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// See if we are drawing a segment; if so, add a via? // See if we are drawing a segment; if so, add a via?
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL ) if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
{ {
if( current->Type() == TYPE_TRACK && (current->m_Flags & IS_NEW) ) if( current->Type() == TYPE_TRACK && ( current->m_Flags & IS_NEW ) )
{ {
// Want to set the routing layers so that it switches properly - // Want to set the routing layers so that it switches properly -
// see the implementation of Other_Layer_Route - the working // see the implementation of Other_Layer_Route - the working
......
...@@ -13,23 +13,23 @@ ...@@ -13,23 +13,23 @@
#include "protos.h" #include "protos.h"
/* Local functions */
static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC );
/* variables : */
static TEXTE_PCB s_TextCopy( (BOARD_ITEM*) NULL ); /* copy of the edited text
* (used to undo/redo/abort a complex edition command
*/
/*************************************************************/ static TEXTE_PCB s_TextCopy( (BOARD_ITEM*) NULL ); /* copy of the edited text
void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC ) * (used to undo/redo/abort
/*************************************************************/ * a complex edition command
*/
/* /*
* Routine de sortie du menu edit texte Pcb * Abort current text edit progress.
* Si un texte est selectionne, ses coord initiales sont regenerees *
* If a text is selected, its initial coord are regenerated
*/ */
void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
...@@ -55,13 +55,10 @@ void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -55,13 +55,10 @@ void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/*********************************************************************/
void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
/*********************************************************************/
/* /*
* Place the current text being moving * Place the current text being moving
*/ */
void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{ {
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
...@@ -81,7 +78,8 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -81,7 +78,8 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
} }
if( TextePcb->m_Flags == IS_MOVED ) // If moved only if( TextePcb->m_Flags == IS_MOVED ) // If moved only
SaveCopyInUndoList( TextePcb, UR_MOVED, TextePcb->m_Pos - s_TextCopy.m_Pos ); SaveCopyInUndoList( TextePcb, UR_MOVED,
TextePcb->m_Pos - s_TextCopy.m_Pos );
else else
{ {
// Restore initial params // Restore initial params
...@@ -96,12 +94,9 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -96,12 +94,9 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
} }
/***********************************************************************/ /* Initialize parameters to move a pcb text
void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
/***********************************************************************/
/* Initialise parameters to move a pcb text
*/ */
void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
{ {
if( TextePcb == NULL ) if( TextePcb == NULL )
return; return;
...@@ -120,31 +115,24 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -120,31 +115,24 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
} }
/*************************************************************************/ /* Move PCB text following the cursor. */
static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************************/
/* Routine deplacant le texte PCB suivant le curseur de la souris */
{ {
TEXTE_PCB* TextePcb = (TEXTE_PCB*) panel->GetScreen()->GetCurItem(); TEXTE_PCB* TextePcb = (TEXTE_PCB*) panel->GetScreen()->GetCurItem();
if( TextePcb == NULL ) if( TextePcb == NULL )
return; return;
/* effacement du texte : */
if( erase ) if( erase )
TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->Draw( panel, DC, GR_XOR );
TextePcb->m_Pos = panel->GetScreen()->m_Curseur; TextePcb->m_Pos = panel->GetScreen()->m_Curseur;
/* Redessin du Texte */
TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->Draw( panel, DC, GR_XOR );
} }
/**********************************************************************/
void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
/**********************************************************************/
{ {
if( TextePcb == NULL ) if( TextePcb == NULL )
return; return;
...@@ -159,18 +147,16 @@ void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -159,18 +147,16 @@ void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
} }
/*******************************************************/
TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC ) TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
/*******************************************************/
{ {
TEXTE_PCB* TextePcb; TEXTE_PCB* TextePcb;
TextePcb = new TEXTE_PCB( GetBoard() ); TextePcb = new TEXTE_PCB( GetBoard() );
/* Chainage de la nouvelle structure en debut de liste */ /* Add text to the board item list. */
GetBoard()->Add( TextePcb ); GetBoard()->Add( TextePcb );
/* Mise a jour des caracteristiques */ /* Update text properties. */
TextePcb->m_Flags = IS_NEW; TextePcb->m_Flags = IS_NEW;
TextePcb->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ); TextePcb->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
TextePcb->m_Mirror = false; TextePcb->m_Mirror = false;
...@@ -194,9 +180,7 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC ) ...@@ -194,9 +180,7 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
} }
/***********************************************************************/
void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
/***********************************************************************/
{ {
int angle = 900; int angle = 900;
int drawmode = GR_XOR; int drawmode = GR_XOR;
...@@ -204,18 +188,18 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -204,18 +188,18 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
if( TextePcb == NULL ) if( TextePcb == NULL )
return; return;
/* effacement du texte : */ /* Erase previous text. */
TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->Draw( DrawPanel, DC, GR_XOR );
TextePcb->m_Orient += angle; TextePcb->m_Orient += angle;
NORMALIZE_ANGLE( TextePcb->m_Orient ); NORMALIZE_ANGLE( TextePcb->m_Orient );
/* Redessin du Texte */ /* Redraw text in new position. */
TextePcb->Draw( DrawPanel, DC, drawmode ); TextePcb->Draw( DrawPanel, DC, drawmode );
TextePcb->DisplayInfo( this ); TextePcb->DisplayInfo( this );
if( TextePcb->m_Flags == 0 ) // i.e. not edited, or moved if( TextePcb->m_Flags == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->m_Pos ); SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->m_Pos );
else // set flag edit, to show it was a complex command else // set flag edit, to show it was a complex command
TextePcb->m_Flags |= IN_EDIT; TextePcb->m_Flags |= IN_EDIT;
GetScreen()->SetModify(); GetScreen()->SetModify();
......
/******************************************************/ /***********************************/
/* Edition des contours du pcb: Routines */ /* Edit segments and edges of PCB. */
/* d'effacement et d'edition de segments et contours */ /***********************************/
/* du type PCB, draw, edgePCB */
/******************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -15,21 +13,18 @@ ...@@ -15,21 +13,18 @@
#include "protos.h" #include "protos.h"
/* Routines Locales */
static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables locales : */
static wxPoint s_InitialPosition; // position originelle du curseur souris (fct deplacement)
static wxPoint s_LastPosition; // position courante du curseur souris
/****************************************************************************/ static wxPoint s_InitialPosition; // Initial cursor position.
void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) static wxPoint s_LastPosition; // Current cursor position.
/****************************************************************************/
/* Routine de preparation du deplacement d'un element graphique type DRAWSEGMENT
*/ /* Start move of a graphic element type DRAWSEGMENT */
void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
{ {
if( drawitem == NULL ) if( drawitem == NULL )
return; return;
...@@ -44,13 +39,10 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -44,13 +39,10 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
} }
/*********************************************************************/
void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
/*********************************************************************/
/* /*
* Routine de placement de l'element graphique type DRAWSEGMENT en cours de deplacement * Place graphic element of type DRAWSEGMENT.
*/ */
void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
{ {
if( drawitem == NULL ) if( drawitem == NULL )
return; return;
...@@ -64,14 +56,12 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -64,14 +56,12 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
drawitem->m_Flags = 0; drawitem->m_Flags = 0;
} }
/*
/************************************************************************/ * Redraw segment during cursor movement.
*/
static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/************************************************************************/
/* redessin du contour du Segment Edge lors des deplacements de la souris */
{ {
DRAWSEGMENT* Segment = (DRAWSEGMENT*) DRAWSEGMENT* Segment = (DRAWSEGMENT*) panel->GetScreen()->GetCurItem();
panel->GetScreen()->GetCurItem();
int t_fill = DisplayOpt.DisplayDrawItems; int t_fill = DisplayOpt.DisplayDrawItems;
if( Segment == NULL ) if( Segment == NULL )
...@@ -79,7 +69,6 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -79,7 +69,6 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
/* efface ancienne position */
if( erase ) if( erase )
Segment->Draw( panel, DC, GR_XOR ); Segment->Draw( panel, DC, GR_XOR );
...@@ -94,9 +83,7 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -94,9 +83,7 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/**************************************************************************/
void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
/**************************************************************************/
{ {
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
int track_fill_copy = DisplayOpt.DisplayDrawItems; int track_fill_copy = DisplayOpt.DisplayDrawItems;
...@@ -104,9 +91,9 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -104,9 +91,9 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( Segment == NULL ) if( Segment == NULL )
return; return;
if( Segment->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment if( Segment->m_Flags & IS_NEW ) // Trace in progress.
{ {
/* effacement du segment en cours de trace */ /* Delete current segment. */
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
Segment->Draw( DrawPanel, DC, GR_XOR ); Segment->Draw( DrawPanel, DC, GR_XOR );
PtStruct = Segment->Back(); PtStruct = Segment->Back();
...@@ -116,7 +103,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -116,7 +103,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
DisplayOpt.DisplayDrawItems = track_fill_copy; DisplayOpt.DisplayDrawItems = track_fill_copy;
SetCurItem( NULL ); SetCurItem( NULL );
} }
else if( Segment->m_Flags == 0) else if( Segment->m_Flags == 0 )
{ {
Segment->Draw( DrawPanel, DC, GR_XOR ); Segment->Draw( DrawPanel, DC, GR_XOR );
Segment->m_Flags = 0; Segment->m_Flags = 0;
...@@ -128,13 +115,11 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -128,13 +115,11 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
} }
/******************************************************************************/
void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer ) void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer )
/******************************************************************************/
{ {
if( aLayer <= LAST_COPPER_LAYER ) if( aLayer <= LAST_COPPER_LAYER )
{ {
DisplayError( this, _( "Copper layer global delete not allowed!" ), 20 ); DisplayError( this, _( "Copper layer global delete not allowed!" ) );
return; return;
} }
...@@ -160,14 +145,15 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer ) ...@@ -160,14 +145,15 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer )
{ {
item->UnLink(); item->UnLink();
picker.m_PickedItem = item; picker.m_PickedItem = item;
pickList.PushItem(picker); pickList.PushItem( picker );
} }
break; break;
default: default:
{ {
wxString msg; wxString msg;
msg.Printf( wxT("Delete_Drawings_All_Layer() error: unknown type %d"), item->Type()); msg.Printf( wxT("Delete_Drawings_All_Layer() error: unknown type %d"),
item->Type() );
wxMessageBox( msg ); wxMessageBox( msg );
break; break;
} }
...@@ -182,9 +168,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer ) ...@@ -182,9 +168,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer )
} }
/*************************************************************/
static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC ) static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/
{ {
DRAWSEGMENT* Segment = (DRAWSEGMENT*) Panel->GetScreen()->GetCurItem(); DRAWSEGMENT* Segment = (DRAWSEGMENT*) Panel->GetScreen()->GetCurItem();
...@@ -208,17 +192,14 @@ static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -208,17 +192,14 @@ static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
((WinEDA_PcbFrame*)Panel->m_Parent)->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL );
} }
/**********************************************************************/ /* Initialize the drawing of a segment of type other than trace.
*/
DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
int shape, wxDC* DC ) int shape, wxDC* DC )
/**********************************************************************/
/* Routine d'initialisation du trace d'un segment de type autre que piste
*/
{ {
int s_large; int s_large;
int angle = 0; int angle = 0;
...@@ -233,7 +214,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, ...@@ -233,7 +214,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
if( shape == S_ARC ) if( shape == S_ARC )
angle = 900; angle = 900;
if( Segment == NULL ) /* debut reel du trace */ if( Segment == NULL ) /* Create new trace. */
{ {
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) ); SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->m_Flags = IS_NEW; Segment->m_Flags = IS_NEW;
...@@ -245,8 +226,8 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, ...@@ -245,8 +226,8 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
DrawPanel->ManageCurseur = Montre_Position_NewSegment; DrawPanel->ManageCurseur = Montre_Position_NewSegment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge; DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
} }
else /* trace en cours : les coord du point d'arrivee ont ete mises else /* TRANSLATE trace en cours : les coord du point d'arrivee ont
* a jour par la routine Montre_Position_NewSegment*/ * ete mises a jour par la routine Montre_Position_NewSegment*/
{ {
if( Segment->m_Start != Segment->m_End ) if( Segment->m_Start != Segment->m_End )
{ {
...@@ -284,16 +265,14 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, ...@@ -284,16 +265,14 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
} }
/***************************************************************/
void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
/***************************************************************/
{ {
if( Segment == NULL ) if( Segment == NULL )
return; return;
Segment->Draw( DrawPanel, DC, GR_OR ); Segment->Draw( DrawPanel, DC, GR_OR );
/* Effacement si Longueur nulle */ /* Delete if segment length is zero. */
if( Segment->m_Start == Segment->m_End) if( Segment->m_Start == Segment->m_End )
Segment ->DeleteStructure(); Segment ->DeleteStructure();
else else
...@@ -301,7 +280,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -301,7 +280,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
Segment->m_Flags = 0; Segment->m_Flags = 0;
GetBoard()->Add( Segment ); GetBoard()->Add( Segment );
GetScreen()->SetModify(); GetScreen()->SetModify();
SaveCopyInUndoList(Segment, UR_NEW ); SaveCopyInUndoList( Segment, UR_NEW );
} }
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
...@@ -310,11 +289,10 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -310,11 +289,10 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
} }
/************************************************************/ /* Redraw segment during cursor movement
*/
static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel, static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase ) wxDC* DC, bool erase )
/************************************************************/
/* redessin du contour du Segment Edge lors des deplacements de la souris */
{ {
DRAWSEGMENT* Segment = (DRAWSEGMENT*) DRAWSEGMENT* Segment = (DRAWSEGMENT*)
panel->GetScreen()->GetCurItem(); panel->GetScreen()->GetCurItem();
...@@ -325,16 +303,15 @@ static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel, ...@@ -325,16 +303,15 @@ static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel,
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
/* efface ancienne position */
if( erase ) if( erase )
Segment->Draw( panel, DC, GR_XOR ); Segment->Draw( panel, DC, GR_XOR );
if( Segments_45_Only && (Segment->m_Shape == S_SEGMENT ) ) if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) )
{ {
Calcule_Coord_Extremite_45( Segment->m_Start.x, Segment->m_Start.y, Calcule_Coord_Extremite_45( Segment->m_Start.x, Segment->m_Start.y,
&Segment->m_End.x, &Segment->m_End.y ); &Segment->m_End.x, &Segment->m_End.y );
} }
else /* ici l'angle d'inclinaison est quelconque */ else /* here the angle is arbitrary */
{ {
Segment->m_End = panel->GetScreen()->m_Curseur; Segment->m_End = panel->GetScreen()->m_Curseur;
} }
......
/************************************************/ /************************************************/
/* Module editor: Dialog box for editing module */ /* Module editor: Dialog box for editing module */
/* properties and carateristics */ /* properties and characteristics */
/************************************************/ /************************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -14,12 +14,11 @@ ...@@ -14,12 +14,11 @@
#include "dialog_edit_module_for_BoardEditor.h" #include "dialog_edit_module_for_BoardEditor.h"
/*******************************************************************/
void WinEDA_PcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
/*******************************************************************/
/* Fonction relai d'installation de la frame d'dition des proprietes /*
* du module*/ * Show module property dialog.
*/
void WinEDA_PcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
{ {
if( Module == NULL ) if( Module == NULL )
return; return;
...@@ -54,13 +53,10 @@ void WinEDA_PcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) ...@@ -54,13 +53,10 @@ void WinEDA_PcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
} }
/*******************************************************************/
void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
/*******************************************************************/
/* /*
* Repositionne l'ancre sous le curseur souris * Position anchor under the cursor.
*/ */
void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
{ {
wxPoint moveVector; wxPoint moveVector;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
...@@ -73,19 +69,19 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) ...@@ -73,19 +69,19 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
pt_mod->m_Pos = GetScreen()->m_Curseur; pt_mod->m_Pos = GetScreen()->m_Curseur;
/* Mise a jour des coord relatives des elements: /* Update the relative coordinates:
* les coordonnees relatives sont relatives a l'ancre, pour orient 0. * The coordinates are relative to the anchor point.
* il faut donc recalculer deltaX et deltaY en orientation 0 */ * Calculate deltaX and deltaY from the anchor. */
RotatePoint( &moveVector, -pt_mod->m_Orient ); RotatePoint( &moveVector, -pt_mod->m_Orient );
/* Mise a jour des coord relatives des pads */ /* Update the pad coordinates. */
pt_pad = (D_PAD*) pt_mod->m_Pads; pt_pad = (D_PAD*) pt_mod->m_Pads;
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{ {
pt_pad->m_Pos0 += moveVector; pt_pad->m_Pos0 += moveVector;
} }
/* Mise a jour des coord relatives contours .. */ /* Update the draw element coordinates. */
PtStruct = pt_mod->m_Drawings; PtStruct = pt_mod->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
...@@ -113,9 +109,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) ...@@ -113,9 +109,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
} }
/**********************************************************************/
void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item ) void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item )
/**********************************************************************/
{ {
if( Item == NULL ) if( Item == NULL )
return; return;
...@@ -154,8 +148,8 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item ) ...@@ -154,8 +148,8 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item )
default: default:
{ {
wxString Line; wxString Line;
Line.Printf( wxT( " Remove: StructType %d Inattendu" ), Line.Printf( wxT( " Remove: draw item type %d unknown." ),
Item->Type() ); Item->Type() );
DisplayError( this, Line ); DisplayError( this, Line );
} }
break; break;
......
This diff is collapsed.
This diff is collapsed.
/*************************************************************/ /********************/
/* Edition des Modules: Routines de modification des textes */ /* Edi module text. */
/* sur les MODULES */ /********************/
/*************************************************************/
/* Fichier EDTXTMOD.CPP */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -16,30 +13,31 @@ ...@@ -16,30 +13,31 @@
#include "protos.h" #include "protos.h"
/* Routines Locales */ static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel,
static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); wxDC* DC,
bool erase );
static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC ); static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC );
/* local variables */
wxPoint MoveVector; // Move vector for move edge, exported to dialog_edit mod_text.cpp
static wxPoint TextInitialPosition; // Mouse cursor inital position for undo/abort move command
static int TextInitialOrientation; // module text inital orientation for undo/abort move+rot command+rot
wxPoint MoveVector; // Move vector for move edge, exported
// to dialog_edit mod_text.cpp
static wxPoint TextInitialPosition; // Mouse cursor initial position for
// undo/abort move command
static int TextInitialOrientation; // module text initial orientation for
// undo/abort move+rot command+rot
/******************************************************************************/
TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
/******************************************************************************/
/* Add a new graphical text to the active module (footprint) /* Add a new graphical text to the active module (footprint)
* Note there always are 2 texts: reference and value. * Note there always are 2 texts: reference and value.
* New texts have the member TEXTE_MODULE.m_Type set to TEXT_is_DIVERS * New texts have the member TEXTE_MODULE.m_Type set to TEXT_is_DIVERS
*/ */
TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
{ {
TEXTE_MODULE* Text; TEXTE_MODULE* Text;
Text = new TEXTE_MODULE( Module ); Text = new TEXTE_MODULE( Module );
/* Chainage de la nouvelle structure en tete de liste drawings */ /* Add the new text object to the beginning of the draw item list. */
if( Module ) if( Module )
Module->m_Drawings.PushFront( Text ); Module->m_Drawings.PushFront( Text );
...@@ -48,7 +46,8 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC ) ...@@ -48,7 +46,8 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
Text->m_Text = wxT( "text" ); Text->m_Text = wxT( "text" );
ModuleTextWidth = Clamp_Text_PenSize( ModuleTextWidth, ModuleTextWidth = Clamp_Text_PenSize( ModuleTextWidth,
MIN(ModuleTextSize.x, ModuleTextSize.y), true ); MIN( ModuleTextSize.x,
ModuleTextSize.y ), true );
Text->m_Size = ModuleTextSize; Text->m_Size = ModuleTextSize;
Text->m_Width = ModuleTextWidth; Text->m_Width = ModuleTextWidth;
Text->m_Pos = GetScreen()->m_Curseur; Text->m_Pos = GetScreen()->m_Curseur;
...@@ -67,20 +66,20 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC ) ...@@ -67,20 +66,20 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
} }
/**************************************************************************/ /* Rotate text 90 degrees.
*/
void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
/**************************************************************************/
/* Rotation de 90 du texte d'un module */
{ {
if( Text == NULL ) if( Text == NULL )
return; return;
MODULE* module = (MODULE*) Text->GetParent(); MODULE* module = (MODULE*) Text->GetParent();
if( module && module->m_Flags == 0 && Text->m_Flags == 0 ) // simple rot command if( module && module->m_Flags == 0 && Text->m_Flags == 0 ) // prepare undo
{ // prepare undo command // command
{
if( this->m_Ident == PCB_FRAME ) if( this->m_Ident == PCB_FRAME )
SaveCopyInUndoList( module,UR_CHANGED ); SaveCopyInUndoList( module, UR_CHANGED );
} }
// we expect MoveVector to be (0,0) if there is no move in progress // we expect MoveVector to be (0,0) if there is no move in progress
...@@ -90,9 +89,7 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -90,9 +89,7 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
while( Text->m_Orient >= 1800 ) while( Text->m_Orient >= 1800 )
Text->m_Orient -= 1800; Text->m_Orient -= 1800;
/* Redessin du Texte */
Text->Draw( DrawPanel, DC, GR_XOR, MoveVector ); Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
Text->DisplayInfo( this ); Text->DisplayInfo( this );
if( module ) if( module )
...@@ -101,13 +98,10 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -101,13 +98,10 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
} }
/**************************************************************************/
void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
/**************************************************************************/
/* /*
* Supprime 1 texte sur module (si ce n'est pas la rfrence ou la valeur) * Deletes text in module (if not the reference or value)
*/ */
void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
{ {
MODULE* Module; MODULE* Module;
...@@ -119,8 +113,6 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text ) ...@@ -119,8 +113,6 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
if( Text->m_Type == TEXT_is_DIVERS ) if( Text->m_Type == TEXT_is_DIVERS )
{ {
DrawPanel->PostDirtyRect( Text->GetBoundingBox() ); DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
/* liberation de la memoire : */
Text->DeleteStructure(); Text->DeleteStructure();
GetScreen()->SetModify(); GetScreen()->SetModify();
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
...@@ -128,13 +120,12 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text ) ...@@ -128,13 +120,12 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
} }
/*************************************************************/
static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/
/* /*
* Routine de sortie du menu edit texte module * Abort text move in progress.
* Si un texte est selectionne, ses coord initiales sont regenerees *
* If a text is selected, its initial coordinates are regenerated.
*/ */
static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
BASE_SCREEN* screen = Panel->GetScreen(); BASE_SCREEN* screen = Panel->GetScreen();
TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem(); TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem();
...@@ -152,7 +143,7 @@ static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -152,7 +143,7 @@ static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
// If the text was moved (the move does not change internal data) // If the text was moved (the move does not change internal data)
// it could be rotated while moving. So set old value for orientation // it could be rotated while moving. So set old value for orientation
if ( (Text->m_Flags & IS_MOVED) ) if( (Text->m_Flags & IS_MOVED) )
Text->m_Orient = TextInitialOrientation; Text->m_Orient = TextInitialOrientation;
/* Redraw the text */ /* Redraw the text */
...@@ -168,12 +159,9 @@ static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -168,12 +159,9 @@ static void AbortMoveTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/****************************************************************************/ /* Start a text move.
void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
/****************************************************************************/
/* Routine d'initialisation du deplacement d'un texte sur module
*/ */
void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{ {
MODULE* Module; MODULE* Module;
...@@ -187,7 +175,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -187,7 +175,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
TextInitialPosition = Text->m_Pos; TextInitialPosition = Text->m_Pos;
TextInitialOrientation = Text->m_Orient; TextInitialOrientation = Text->m_Orient;
Text->DisplayInfo( this ); Text->DisplayInfo( this );
...@@ -200,40 +188,37 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -200,40 +188,37 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
} }
/*************************************************************************/ /* Place the text a the cursor position when the left mouse button is clicked.
void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
/*************************************************************************/
/* Routine complementaire a StartMoveTexteModule().
* Place le texte en cours de deplacement
*/ */
void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{ {
if( Text != NULL ) if( Text != NULL )
{ {
DrawPanel->PostDirtyRect( Text->GetBoundingBox() ); DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
/* mise a jour des coordonnes relatives a l'ancre */ /* Update the coordinates for anchor. */
MODULE* Module = (MODULE*) Text->GetParent(); MODULE* Module = (MODULE*) Text->GetParent();
if( Module ) if( Module )
{ {
// Prepare undo command (a rotation can be made while moving) // Prepare undo command (a rotation can be made while moving)
EXCHG(Text->m_Orient, TextInitialOrientation); EXCHG( Text->m_Orient, TextInitialOrientation );
if( m_Ident == PCB_FRAME ) if( m_Ident == PCB_FRAME )
SaveCopyInUndoList(Module, UR_CHANGED); SaveCopyInUndoList( Module, UR_CHANGED );
else else
SaveCopyInUndoList(Module, UR_MODEDIT); SaveCopyInUndoList( Module, UR_MODEDIT );
EXCHG(Text->m_Orient, TextInitialOrientation); EXCHG( Text->m_Orient, TextInitialOrientation );
Text->m_Pos = GetScreen()->m_Curseur; // Set the new position for text // Set the new position for text.
Text->m_Pos = GetScreen()->m_Curseur;
wxPoint textRelPos = Text->m_Pos - Module->m_Pos; wxPoint textRelPos = Text->m_Pos - Module->m_Pos;
RotatePoint( &textRelPos, -Module->m_Orient ); RotatePoint( &textRelPos, -Module->m_Orient );
Text->m_Pos0 = textRelPos; Text->m_Pos0 = textRelPos;
Text->m_Flags = 0; Text->m_Flags = 0;
Module->m_Flags = 0; Module->m_Flags = 0;
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Redessin du Texte */ /* Redraw text. */
DrawPanel->PostDirtyRect( Text->GetBoundingBox() ); DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
} }
else else
...@@ -248,9 +233,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -248,9 +233,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
} }
/********************************************************************************/ static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC,
static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) bool erase )
/********************************************************************************/
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem(); TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem();
...@@ -258,7 +242,7 @@ static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ...@@ -258,7 +242,7 @@ static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( Text == NULL ) if( Text == NULL )
return; return;
/* Undraw the text : */ /* Undraw the text */
if( erase ) if( erase )
Text->Draw( panel, DC, GR_XOR, MoveVector ); Text->Draw( panel, DC, GR_XOR, MoveVector );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment