|
|
@ -55,7 +55,7 @@ wxClientDC dc(DrawPanel); |
|
|
|
|
|
|
|
pos.y += 20; |
|
|
|
|
|
|
|
switch ( id ) // Arret eventuel de la commande de déplacement en cours
|
|
|
|
switch ( id ) // Arret eventuel de la commande de d�placement en cours
|
|
|
|
{ |
|
|
|
case wxID_CUT: |
|
|
|
case wxID_COPY: |
|
|
@ -95,7 +95,7 @@ wxClientDC dc(DrawPanel); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
default: // Arret dea commande de déplacement en cours
|
|
|
|
default: // Arret dea commande de d�placement en cours
|
|
|
|
if( DrawPanel->ManageCurseur && |
|
|
|
DrawPanel->ForceCloseManageCurseur ) |
|
|
|
{ |
|
|
@ -149,20 +149,104 @@ wxClientDC dc(DrawPanel); |
|
|
|
if ( m_Draw3DFrame ) |
|
|
|
m_Draw3DFrame->NewDisplay(); |
|
|
|
break; |
|
|
|
|
|
|
|
case ID_MODEDIT_SAVE_MODULE_IN_BOARD: |
|
|
|
case ID_MODEDIT_SAVE_MODULE_IN_BOARD:{ |
|
|
|
// seems that this should update modules in the current board,
|
|
|
|
// not just add it to the board with total disregard for the
|
|
|
|
// netlist...?
|
|
|
|
WinEDA_PcbFrame * pcbframe = m_Parent->m_PcbFrame; |
|
|
|
BOARD * mainpcb = pcbframe->m_Pcb; |
|
|
|
MODULE * presmod = m_Pcb->m_Modules; //the module being edited.
|
|
|
|
//i guess we need to search through the modules here.. they are in a linked list.
|
|
|
|
//replace based on m_libref?
|
|
|
|
MODULE* mod = mainpcb->m_Modules; |
|
|
|
do{ |
|
|
|
//need to be careful in this doubly linked-list to maintain order & link
|
|
|
|
// also have to maintain netname on all the pads according to m_NumPadName.
|
|
|
|
if(mod->m_LibRef == presmod->m_LibRef){//have to be careful with this test of similarity?
|
|
|
|
wprintf(L"replace: mod->m_LibRef = %S @ %d %d orient: %d\n", mod->m_LibRef.c_str(), |
|
|
|
mod->m_Pos.x, mod->m_Pos.y, mod->m_Orient); |
|
|
|
MODULE* newmod = new MODULE(mainpcb); |
|
|
|
newmod->Copy(presmod); //this will copy the padstack layers etc
|
|
|
|
newmod->m_Parent = mainpcb; //modify after the copy above
|
|
|
|
newmod->m_Layer = mod->m_Layer; |
|
|
|
newmod->m_Pos = mod->m_Pos; |
|
|
|
newmod->m_Orient =0; //otherwise the pads will be rotated with respect to the module.
|
|
|
|
//copy data into the pads...
|
|
|
|
|
|
|
|
D_PAD* newpad = newmod->m_Pads; |
|
|
|
for(; newpad != NULL; newpad = (D_PAD*)newpad->Pnext){ |
|
|
|
D_PAD* pad = mod->m_Pads; |
|
|
|
for(; pad != NULL; pad = (D_PAD*)pad->Pnext){ |
|
|
|
if(pad->m_NumPadName == newpad->m_NumPadName){ |
|
|
|
wprintf(L" pad->NumPadName %d @ %d %d :new %d %d, orient: %d\n", pad->m_NumPadName, |
|
|
|
pad->m_Pos.x, pad->m_Pos.y, newpad->m_Pos.x, newpad->m_Pos.y, pad->m_Orient); |
|
|
|
wprintf(L" pad->m_Netname %S\n", pad->m_Netname.c_str()); |
|
|
|
newpad->m_Netname = pad->m_Netname; |
|
|
|
newpad->m_NetCode = pad->m_NetCode; |
|
|
|
newpad->m_logical_connexion = pad->m_logical_connexion; |
|
|
|
newpad->m_physical_connexion = pad->m_physical_connexion; |
|
|
|
newpad->m_Pos.x += newmod->m_Pos.x; //the pad positions are apparently in global coordinates.
|
|
|
|
newpad->m_Pos.y += newmod->m_Pos.y; |
|
|
|
newpad->m_Orient = pad->m_Orient; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//not sure what to do about m_Drawings..assume they are ok?
|
|
|
|
//copy only the text in m_Ref and m_Val;
|
|
|
|
//leave the size and position as in the module in edit.
|
|
|
|
newmod->m_Reference->m_Text = mod->m_Reference->m_Text; |
|
|
|
newmod->m_Value->m_Text = mod->m_Value->m_Text; |
|
|
|
wprintf(L"replace: mod->m_Reference = %S\n", newmod->m_Reference->m_Text.c_str()); |
|
|
|
wprintf(L"replace: mod->m_Value = %S\n", newmod->m_Value->m_Text.c_str()); |
|
|
|
newmod->m_Attributs = mod->m_Attributs; |
|
|
|
newmod->m_Orient = mod->m_Orient; |
|
|
|
newmod->flag = mod->flag; |
|
|
|
newmod->m_Flags = 0; //inherited from EDA_BaseStruct.
|
|
|
|
newmod->m_ModuleStatus = mod->m_ModuleStatus; |
|
|
|
//redo the boundary boxes
|
|
|
|
newmod->Set_Rectangle_Encadrement(); |
|
|
|
newmod->SetRectangleExinscrit(); |
|
|
|
newmod->m_CntRot90 = mod->m_CntRot90; |
|
|
|
newmod->m_CntRot180 = mod->m_CntRot180; |
|
|
|
newmod->m_Surface = mod->m_Surface; |
|
|
|
pcbframe->Rotate_Module(NULL, newmod, mod->m_Orient, false); |
|
|
|
//now, need to replace 'mod' in the linked list with 'newmod'.
|
|
|
|
//this does not seem to be working correctly..
|
|
|
|
MODULE* oldmod = mod; |
|
|
|
mod = (MODULE*)mod->Pnext; |
|
|
|
oldmod->UnLink(); |
|
|
|
delete oldmod; |
|
|
|
//insert the new one.
|
|
|
|
newmod->Pnext = mainpcb->m_Modules; |
|
|
|
mainpcb->m_Modules->Pback = newmod; // check this!
|
|
|
|
mainpcb->m_Modules = newmod; |
|
|
|
newmod->Pback = mainpcb; |
|
|
|
wprintf(L"-----\n"); |
|
|
|
}else{ |
|
|
|
mod = (MODULE*)mod->Pnext; |
|
|
|
} |
|
|
|
}while(mod != NULL); |
|
|
|
GetScreen()->ClrModify(); |
|
|
|
pcbframe->GetScreen()->m_CurrentItem = NULL; |
|
|
|
mainpcb->m_Status_Pcb = 0; |
|
|
|
} |
|
|
|
break; |
|
|
|
/*case ID_MODEDIT_SAVE_MODULE_IN_BOARD:
|
|
|
|
{ |
|
|
|
WinEDA_PcbFrame * pcbframe = m_Parent->m_PcbFrame; |
|
|
|
BOARD * mainpcb = pcbframe->m_Pcb; |
|
|
|
MODULE * oldmodule = NULL; |
|
|
|
MODULE * module_in_edit = m_Pcb->m_Modules; |
|
|
|
// creation du nouveau module sur le PCB en cours
|
|
|
|
// create a new unit on the PCB, of course.
|
|
|
|
MODULE * newmodule = new MODULE(mainpcb); |
|
|
|
newmodule->Copy(module_in_edit); |
|
|
|
newmodule->m_Parent = mainpcb; // modifie par la copie
|
|
|
|
newmodule->m_Parent = mainpcb; // modifie par la copie
|
|
|
|
newmodule->m_Link = 0; |
|
|
|
// Recherche de l'ancien module correspondant
|
|
|
|
//(qui a pu changer ou disparaitre a la suite d'éditions)
|
|
|
|
//(qui a pu changer ou disparaitre a la suite d'�ditions)
|
|
|
|
//locate the corresponding former unit, which may have a different revision.
|
|
|
|
if ( module_in_edit->m_Link ) |
|
|
|
{ |
|
|
|
oldmodule = mainpcb->m_Modules; |
|
|
@ -196,7 +280,7 @@ wxClientDC dc(DrawPanel); |
|
|
|
pcbframe->GetScreen()->m_CurrentItem = NULL; |
|
|
|
mainpcb->m_Status_Pcb = 0; |
|
|
|
} |
|
|
|
break; |
|
|
|
break;*/ |
|
|
|
|
|
|
|
case ID_LIBEDIT_IMPORT_PART: |
|
|
|
GetScreen()->ClearUndoRedoList(); |
|
|
@ -224,19 +308,29 @@ wxClientDC dc(DrawPanel); |
|
|
|
case ID_MODEDIT_SHEET_SET: |
|
|
|
break; |
|
|
|
|
|
|
|
case ID_MODEDIT_LOAD_MODULE: |
|
|
|
case ID_MODEDIT_LOAD_MODULE:{ |
|
|
|
GetScreen()->ClearUndoRedoList(); |
|
|
|
GetScreen()->m_CurrentItem = NULL; |
|
|
|
Clear_Pcb(&dc, TRUE); |
|
|
|
GetScreen()->m_Curseur = wxPoint(0,0); |
|
|
|
Load_Module_From_Library(m_CurrentLib, &dc); |
|
|
|
if ( m_Pcb->m_Modules ) m_Pcb->m_Modules->m_Flags = 0; |
|
|
|
//if either m_Reference or m_Value are gone, reinstate them -
|
|
|
|
//otherwise it becomes hard to see what you are working with in the layout!
|
|
|
|
TEXTE_MODULE* ref = m_Pcb->m_Modules->m_Reference; |
|
|
|
TEXTE_MODULE* val = m_Pcb->m_Modules->m_Value; |
|
|
|
ref->m_NoShow = 0; |
|
|
|
val->m_NoShow = 0; |
|
|
|
ref->m_Type = 0; |
|
|
|
val->m_Type = 1; |
|
|
|
if(ref->m_Text.Length() == 0) ref->m_Text = L"Ref**"; |
|
|
|
if(val->m_Text.Length() == 0) val->m_Text = L"Val**"; |
|
|
|
GetScreen()->ClrModify(); |
|
|
|
Zoom_Automatique(TRUE); |
|
|
|
if ( m_Draw3DFrame ) |
|
|
|
m_Draw3DFrame->NewDisplay(); |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case ID_MODEDIT_PAD_SETTINGS: |
|
|
|
InstallPadOptionsFrame(NULL, NULL, wxPoint(-1, -1) ); |
|
|
@ -509,10 +603,10 @@ wxClientDC dc(DrawPanel); |
|
|
|
/******************************************************************************/ |
|
|
|
void WinEDA_ModuleEditFrame::Transform(MODULE* module, wxDC * DC, int transform) |
|
|
|
/******************************************************************************/ |
|
|
|
/* Execute les transformations de la représentation des modules.
|
|
|
|
/* Execute les transformations de la repr�sentation des modules.
|
|
|
|
le module, apres transformation est toujours en position de reference: |
|
|
|
position 0,0 |
|
|
|
orientation 0, coté composant. |
|
|
|
orientation 0, cot� composant. |
|
|
|
*/ |
|
|
|
{ |
|
|
|
D_PAD * pad = module->m_Pads; |
|
|
|