Loading gerbview/block.cpp +92 −97 Original line number Diff line number Diff line /*****************************************************************/ /* Operations sur Blocks : deplacement, rotation, effacement ... */ /*****************************************************************/ /**********************************************************/ /* Block operations: displacement, rotation, deletion ... */ /**********************************************************/ #include "fctsys.h" Loading @@ -16,21 +16,18 @@ #define BLOCK_COLOR BROWN /* Routines Locales */ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm ); /* Variables locales :*/ /*************************************************/ int WinEDA_GerberFrame::ReturnBlockCommand( int key ) /*************************************************/ /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to * the key (ALT, SHIFT ALT ..) */ int WinEDA_GerberFrame::ReturnBlockCommand( int key ) { int cmd = 0; Loading Loading @@ -67,17 +64,16 @@ int WinEDA_GerberFrame::ReturnBlockCommand( int key ) } /*****************************************************/ /* Routine to handle the BLOCK PLACE command */ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) /*****************************************************/ /* Routine to handle the BLOCK PLACE commande */ { bool err = FALSE; if( DrawPanel->ManageCurseur == NULL ) { err = TRUE; DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) ); } GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; Loading Loading @@ -135,16 +131,13 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) } /**********************************************/ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) /**********************************************/ /* Routine de gestion de la commande BLOCK END * returne : * 0 si aucun compos ant selectionne * 1 sinon * -1 si commande termine et composants trouvs (block delete, block save) /* Routine management command END BLOCK * Returns: * 0 if no and selects compounds * 1 otherwise * -1 If order is completed and components found (block delete, block save) */ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) { int endcommande = TRUE; bool zoom_command = FALSE; Loading @@ -157,7 +150,8 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); break; case BLOCK_DRAG: /* Drag (not used, for future enhancements)*/ case BLOCK_DRAG: /* Drag (not used, for future * enhancements) */ case BLOCK_MOVE: /* Move */ case BLOCK_COPY: /* Copy */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list */ Loading Loading @@ -220,49 +214,57 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) } /**************************************************************************/ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /**************************************************************************/ /* Retrace le contour du block de repositionnement des structures a dplacer /* Traces the outline of the block structures of a repositioning move */ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { int Color; BASE_SCREEN* screen = panel->GetScreen(); Color = YELLOW; /* Effacement ancien cadre */ if( erase ) { screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0),g_XorMode, Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color ); screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color ); } } if( panel->GetScreen()->m_BlockLocate.m_State != STATE_BLOCK_STOP ) { screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight(); screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom(); screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight(); screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom(); } screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color ); screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color ); } } /************************************************/ void WinEDA_GerberFrame::Block_Delete( wxDC* DC ) /************************************************/ /* * routine d'effacement du block deja selectionne * Erase the selected block. */ void WinEDA_GerberFrame::Block_Delete( wxDC* DC ) { if( !IsOK( this, _( "Ok to delete block ?" ) ) ) return; Loading @@ -271,43 +273,38 @@ void WinEDA_GerberFrame::Block_Delete( wxDC* DC ) GetScreen()->m_BlockLocate.Normalize(); GetScreen()->SetCurItem( NULL ); /* Effacement des Pistes */ TRACK* pt_segm, * NextS; for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = NextS ) { NextS = pt_segm->Next(); if( IsSegmentInBox( GetScreen()->m_BlockLocate, pt_segm ) ) { /* la piste est ici bonne a etre efface */ /* the track here is good to be cleared */ pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->DeleteStructure(); } } /* Effacement des Zones */ /* Erasing areas. */ for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = NextS ) { NextS = pt_segm->Next(); if( IsSegmentInBox( GetScreen()->m_BlockLocate, pt_segm ) ) { /* la piste est ici bonne a etre efface */ /* The track here is good to be cleared. */ pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->DeleteStructure(); } } /* Rafraichissement de l'ecran : */ RedrawActiveWindow( DC, TRUE ); } /************************************************/ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) /************************************************/ /* * Function to move items in the current selected block */ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) { wxPoint delta; wxPoint oldpos; Loading @@ -320,7 +317,7 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) GetScreen()->SetModify(); GetScreen()->m_BlockLocate.Normalize(); /* calcul du vecteur de deplacement pour les deplacements suivants */ /* Calculate displacement vectors. */ delta = GetScreen()->m_BlockLocate.m_MoveVector; /* Move the Track segments in block */ Loading @@ -333,8 +330,9 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) track->Draw( DrawPanel, DC, GR_XOR ); // erase the display track->m_Start += delta; track->m_End += delta; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center. track->m_Param += delta.x; track->SetSubNet( track->GetSubNet() + delta.y ); Loading @@ -352,11 +350,13 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display zsegment->m_Start += delta; zsegment->m_End += delta; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center zsegment->m_Param += delta.x; zsegment->SetSubNet( zsegment->GetSubNet() + delta.y ); zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone // segment } zsegment = zsegment->Next(); } Loading @@ -365,13 +365,10 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) } /************************************************/ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) /************************************************/ /* * Function to mirror items in the current selected block */ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) { int xoffset = 0; wxPoint oldpos; Loading @@ -385,7 +382,8 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) GetScreen()->m_BlockLocate.Normalize(); /* Calculate offset to mirror track points from block edges */ xoffset = GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Pos.x xoffset = GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Size.x; /* Move the Track segments in block */ Loading @@ -398,15 +396,17 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) track->m_Start.x = xoffset - track->m_Start.x; track->m_End.x = xoffset - track->m_End.x; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center track->m_Param = xoffset - track->m_Param; track->Draw( DrawPanel, DC, GR_OR ); // redraw the moved track } } /* Move the Zone segments in block */ for( SEGZONE* zsegment = m_Pcb->m_Zone; zsegment; zsegment = zsegment->Next() ) for( SEGZONE* zsegment = m_Pcb->m_Zone; zsegment; zsegment = zsegment->Next() ) { if( IsSegmentInBox( GetScreen()->m_BlockLocate, zsegment ) ) { Loading @@ -414,10 +414,11 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) zsegment->m_Start.x = xoffset - zsegment->m_Start.x; zsegment->m_End.x = xoffset - zsegment->m_End.x; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center zsegment->m_Param = xoffset - zsegment->m_Param; zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone // segment } } Loading @@ -425,13 +426,10 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) } /**************************************************/ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) /**************************************************/ /* * Function to duplicate items in the current selected block */ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) { wxPoint delta; wxPoint oldpos; Loading @@ -444,8 +442,6 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) GetScreen()->SetModify(); GetScreen()->m_BlockLocate.Normalize(); /* calcul du vecteur de deplacement pour les deplacements suivants */ delta = GetScreen()->m_BlockLocate.m_MoveVector; /* Copy selected track segments and move the new track its new location */ Loading @@ -464,7 +460,8 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) new_track->m_Start += delta; new_track->m_End += delta; new_track->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment new_track->Draw( DrawPanel, DC, GR_OR ); // draw the new created // segment } track = next_track; } Loading @@ -484,21 +481,19 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) new_zsegment->m_Start += delta; new_zsegment->m_End += delta; new_zsegment->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment new_zsegment->Draw( DrawPanel, DC, GR_OR ); // draw the new created // segment } zsegment = next_zsegment; } } /**************************************************************************/ static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm ) /**************************************************************************/ /* Teste si la structure PtStruct est inscrite dans le block selectionne * Retourne PtSegm si oui * NULL si non /* Test if the structure PtStruct is listed in the block selects * Returns whether PtSegm * NULL if not */ static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm ) { if( blocklocate.Inside( PtSegm->m_Start.x, PtSegm->m_Start.y ) ) return PtSegm; Loading gerbview/controle.cpp +8 −28 Original line number Diff line number Diff line /********************************************************/ /* Routines generales de gestion des commandes usuelles */ /********************************************************/ /* fichier controle.cpp */ /* * Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... */ /****************/ /* controle.cpp */ /****************/ #include "fctsys.h" #include "common.h" Loading @@ -17,25 +11,13 @@ #include "protos.h" /**********************************************************************/ BOARD_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() /**********************************************************************/ { return Locate( CURSEUR_OFF_GRILLE ); } /****************************************************************/ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) /****************************************************************/ /* traitement des touches de fonctions utilisees ds tous les menus * Zoom * Redessin d'ecran * Cht Unites * Cht couches * Remise a 0 de l'origine des coordonnees relatives */ { wxRealPoint delta; wxPoint curpos, oldpos; Loading Loading @@ -68,25 +50,25 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) switch( g_KeyPressed ) { case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: case WXK_UP: Mouse.y -= wxRound(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2: case WXK_DOWN: Mouse.y += wxRound(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4: case WXK_LEFT: Mouse.x -= wxRound(delta.x); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6: case WXK_RIGHT: Mouse.x += wxRound(delta.x); DrawPanel->MouseTo( Mouse ); Loading @@ -97,10 +79,8 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) break; } /* Recalcul de la position du curseur schema */ GetScreen()->m_Curseur = curpos; /* Placement sur la grille generale */ PutOnGrid( &GetScreen()->m_Curseur ); if( oldpos != GetScreen()->m_Curseur ) Loading Loading @@ -129,5 +109,5 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) } SetToolbars(); UpdateStatusBar(); /* Affichage des coord curseur */ UpdateStatusBar(); } gerbview/dcode.cpp +159 −153 File changed.Preview size limit exceeded, changes collapsed. Show changes gerbview/deltrack.cpp +18 −27 Original line number Diff line number Diff line /*********************************************/ /* Edition des pistes: Routines d'effacement */ /* Effacement de segment, piste, net et zone */ /* Edit Track: Erase Routines */ /* Drop the segment, track, and net area */ /*********************************************/ #include "fctsys.h" Loading @@ -10,16 +10,10 @@ #include "gerbview.h" #include "protos.h" /* Routines externes : */ /* Routines Locales */ /* Variables locales */ /****************************************************************************************/ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number ) /****************************************************************************************/ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number ) { if( dcode_value < FIRST_DCODE ) // No tool selected return; Loading @@ -42,28 +36,26 @@ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int laye } /*****************************************************************/ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) /*****************************************************************/ /* 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. /* Removes 1 segment of track. * * If There is evidence of new track: erase segment * Otherwise: Delete segment under the cursor. */ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) { if( Track == NULL ) return NULL; if( Track->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment if( Track->m_Flags & IS_NEW ) // Trace in progress, delete the last // segment { if( g_CurrentTrackList.GetCount() > 0 ) { // modification du trace // Change track. delete g_CurrentTrackList.PopBack(); if( g_CurrentTrackList.GetCount() && g_CurrentTrackSegment->Type() == TYPE_VIA ) if( g_CurrentTrackList.GetCount() && g_CurrentTrackSegment->Type() == TYPE_VIA ) { delete g_CurrentTrackList.PopBack(); } Loading @@ -85,8 +77,7 @@ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) } return NULL; } // Fin traitement si trace en cours } Trace_Segment( DrawPanel, DC, Track, GR_XOR ); Loading gerbview/edit.cpp +27 −34 Original line number Diff line number Diff line /******************************************************/ /* edit.cpp: fonctions generales de l'edition du PCB */ /******************************************************/ /***********************************/ /* edit.cpp: PCB editing functions */ /***********************************/ #include "fctsys.h" #include "class_drawpanel.h" Loading @@ -13,21 +13,17 @@ #include "protos.h" /************************************************************************/ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) /************************************************************************/ /* Traite les commandes declench�e par le bouton gauche de la souris, * quand un outil est deja selectionn� /* Process the command triggered by the left button of the mouse when a tool * is already selected. */ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); wxString msg; if( m_ID_current_state == 0 ) { if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours if( DrawStruct && DrawStruct->m_Flags ) { msg.Printf( wxT( "WinEDA_GerberFrame::ProcessCommand err: Struct %d, m_Flags = %X" ), (unsigned) DrawStruct->Type(), Loading Loading @@ -70,12 +66,9 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) } /********************************************************************************/ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) /********************************************************************************/ /* Traite les selections d'outils et les commandes appelees du menu POPUP /* Handles the selection of tools, menu, and popup menu commands. */ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) { int id = event.GetId(); int layer = GetScreen()->m_Active_Layer; Loading @@ -89,7 +82,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) pos.y += 20; switch( id ) // Arret eventuel de la commande de d�placement en cours switch( id ) { case wxID_CUT: case wxID_COPY: Loading @@ -108,7 +101,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) { DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); } /* ne devrait pas etre execute, sauf bug */ /* Should not be executed, except bug */ if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE ) { GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; Loading @@ -121,7 +114,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); break; default: // Arret dea commande de d�placement en cours default: if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) { Loading @@ -131,7 +124,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) break; } switch( id ) // Traitement des commandes switch( id ) { case ID_EXIT: Close( TRUE ); Loading @@ -147,10 +140,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_GET_TOOLS: // InstallToolsFrame(this, wxPoint(-1,-1) ); break; case ID_FIND_ITEMS: // InstallFindFrame(this, pos); break; Loading Loading @@ -249,7 +244,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS: if( gerber_layer ) Delete_DCode_Items( &dc, gerber_layer->m_Selected_Tool, ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); Delete_DCode_Items( &dc, gerber_layer->m_Selected_Tool, ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ); break; default: Loading @@ -261,12 +257,9 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) } /**************************************************************************/ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) /**************************************************************************/ /* Called on a double click: /* Called on a double click of left mouse button. */ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) { EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); wxClientDC dc( DrawPanel ); Loading @@ -281,7 +274,7 @@ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) DrawStruct = GerberGeneralLocateAndDisplay(); } break; // end case 0 break; default: break; Loading Loading
gerbview/block.cpp +92 −97 Original line number Diff line number Diff line /*****************************************************************/ /* Operations sur Blocks : deplacement, rotation, effacement ... */ /*****************************************************************/ /**********************************************************/ /* Block operations: displacement, rotation, deletion ... */ /**********************************************************/ #include "fctsys.h" Loading @@ -16,21 +16,18 @@ #define BLOCK_COLOR BROWN /* Routines Locales */ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm ); /* Variables locales :*/ /*************************************************/ int WinEDA_GerberFrame::ReturnBlockCommand( int key ) /*************************************************/ /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to * the key (ALT, SHIFT ALT ..) */ int WinEDA_GerberFrame::ReturnBlockCommand( int key ) { int cmd = 0; Loading Loading @@ -67,17 +64,16 @@ int WinEDA_GerberFrame::ReturnBlockCommand( int key ) } /*****************************************************/ /* Routine to handle the BLOCK PLACE command */ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) /*****************************************************/ /* Routine to handle the BLOCK PLACE commande */ { bool err = FALSE; if( DrawPanel->ManageCurseur == NULL ) { err = TRUE; DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) ); } GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; Loading Loading @@ -135,16 +131,13 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) } /**********************************************/ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) /**********************************************/ /* Routine de gestion de la commande BLOCK END * returne : * 0 si aucun compos ant selectionne * 1 sinon * -1 si commande termine et composants trouvs (block delete, block save) /* Routine management command END BLOCK * Returns: * 0 if no and selects compounds * 1 otherwise * -1 If order is completed and components found (block delete, block save) */ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) { int endcommande = TRUE; bool zoom_command = FALSE; Loading @@ -157,7 +150,8 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); break; case BLOCK_DRAG: /* Drag (not used, for future enhancements)*/ case BLOCK_DRAG: /* Drag (not used, for future * enhancements) */ case BLOCK_MOVE: /* Move */ case BLOCK_COPY: /* Copy */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list */ Loading Loading @@ -220,49 +214,57 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) } /**************************************************************************/ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /**************************************************************************/ /* Retrace le contour du block de repositionnement des structures a dplacer /* Traces the outline of the block structures of a repositioning move */ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { int Color; BASE_SCREEN* screen = panel->GetScreen(); Color = YELLOW; /* Effacement ancien cadre */ if( erase ) { screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0),g_XorMode, Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color ); screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color ); } } if( panel->GetScreen()->m_BlockLocate.m_State != STATE_BLOCK_STOP ) { screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight(); screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom(); screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight(); screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom(); } screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color ); screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color ); } } /************************************************/ void WinEDA_GerberFrame::Block_Delete( wxDC* DC ) /************************************************/ /* * routine d'effacement du block deja selectionne * Erase the selected block. */ void WinEDA_GerberFrame::Block_Delete( wxDC* DC ) { if( !IsOK( this, _( "Ok to delete block ?" ) ) ) return; Loading @@ -271,43 +273,38 @@ void WinEDA_GerberFrame::Block_Delete( wxDC* DC ) GetScreen()->m_BlockLocate.Normalize(); GetScreen()->SetCurItem( NULL ); /* Effacement des Pistes */ TRACK* pt_segm, * NextS; for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = NextS ) { NextS = pt_segm->Next(); if( IsSegmentInBox( GetScreen()->m_BlockLocate, pt_segm ) ) { /* la piste est ici bonne a etre efface */ /* the track here is good to be cleared */ pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->DeleteStructure(); } } /* Effacement des Zones */ /* Erasing areas. */ for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = NextS ) { NextS = pt_segm->Next(); if( IsSegmentInBox( GetScreen()->m_BlockLocate, pt_segm ) ) { /* la piste est ici bonne a etre efface */ /* The track here is good to be cleared. */ pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->DeleteStructure(); } } /* Rafraichissement de l'ecran : */ RedrawActiveWindow( DC, TRUE ); } /************************************************/ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) /************************************************/ /* * Function to move items in the current selected block */ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) { wxPoint delta; wxPoint oldpos; Loading @@ -320,7 +317,7 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) GetScreen()->SetModify(); GetScreen()->m_BlockLocate.Normalize(); /* calcul du vecteur de deplacement pour les deplacements suivants */ /* Calculate displacement vectors. */ delta = GetScreen()->m_BlockLocate.m_MoveVector; /* Move the Track segments in block */ Loading @@ -333,8 +330,9 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) track->Draw( DrawPanel, DC, GR_XOR ); // erase the display track->m_Start += delta; track->m_End += delta; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center. track->m_Param += delta.x; track->SetSubNet( track->GetSubNet() + delta.y ); Loading @@ -352,11 +350,13 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display zsegment->m_Start += delta; zsegment->m_End += delta; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center zsegment->m_Param += delta.x; zsegment->SetSubNet( zsegment->GetSubNet() + delta.y ); zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone // segment } zsegment = zsegment->Next(); } Loading @@ -365,13 +365,10 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) } /************************************************/ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) /************************************************/ /* * Function to mirror items in the current selected block */ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) { int xoffset = 0; wxPoint oldpos; Loading @@ -385,7 +382,8 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) GetScreen()->m_BlockLocate.Normalize(); /* Calculate offset to mirror track points from block edges */ xoffset = GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Pos.x xoffset = GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Size.x; /* Move the Track segments in block */ Loading @@ -398,15 +396,17 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) track->m_Start.x = xoffset - track->m_Start.x; track->m_End.x = xoffset - track->m_End.x; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center track->m_Param = xoffset - track->m_Param; track->Draw( DrawPanel, DC, GR_OR ); // redraw the moved track } } /* Move the Zone segments in block */ for( SEGZONE* zsegment = m_Pcb->m_Zone; zsegment; zsegment = zsegment->Next() ) for( SEGZONE* zsegment = m_Pcb->m_Zone; zsegment; zsegment = zsegment->Next() ) { if( IsSegmentInBox( GetScreen()->m_BlockLocate, zsegment ) ) { Loading @@ -414,10 +414,11 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) zsegment->m_Start.x = xoffset - zsegment->m_Start.x; zsegment->m_End.x = xoffset - zsegment->m_End.x; // the two parameters are used in gerbview to store centre coordinates for arcs. // move this centre // the two parameters are used in gerbview to store center // coordinates for arcs. Move this center zsegment->m_Param = xoffset - zsegment->m_Param; zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone // segment } } Loading @@ -425,13 +426,10 @@ void WinEDA_GerberFrame::Block_Mirror_X( wxDC* DC ) } /**************************************************/ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) /**************************************************/ /* * Function to duplicate items in the current selected block */ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) { wxPoint delta; wxPoint oldpos; Loading @@ -444,8 +442,6 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) GetScreen()->SetModify(); GetScreen()->m_BlockLocate.Normalize(); /* calcul du vecteur de deplacement pour les deplacements suivants */ delta = GetScreen()->m_BlockLocate.m_MoveVector; /* Copy selected track segments and move the new track its new location */ Loading @@ -464,7 +460,8 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) new_track->m_Start += delta; new_track->m_End += delta; new_track->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment new_track->Draw( DrawPanel, DC, GR_OR ); // draw the new created // segment } track = next_track; } Loading @@ -484,21 +481,19 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC ) new_zsegment->m_Start += delta; new_zsegment->m_End += delta; new_zsegment->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment new_zsegment->Draw( DrawPanel, DC, GR_OR ); // draw the new created // segment } zsegment = next_zsegment; } } /**************************************************************************/ static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm ) /**************************************************************************/ /* Teste si la structure PtStruct est inscrite dans le block selectionne * Retourne PtSegm si oui * NULL si non /* Test if the structure PtStruct is listed in the block selects * Returns whether PtSegm * NULL if not */ static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm ) { if( blocklocate.Inside( PtSegm->m_Start.x, PtSegm->m_Start.y ) ) return PtSegm; Loading
gerbview/controle.cpp +8 −28 Original line number Diff line number Diff line /********************************************************/ /* Routines generales de gestion des commandes usuelles */ /********************************************************/ /* fichier controle.cpp */ /* * Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... */ /****************/ /* controle.cpp */ /****************/ #include "fctsys.h" #include "common.h" Loading @@ -17,25 +11,13 @@ #include "protos.h" /**********************************************************************/ BOARD_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() /**********************************************************************/ { return Locate( CURSEUR_OFF_GRILLE ); } /****************************************************************/ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) /****************************************************************/ /* traitement des touches de fonctions utilisees ds tous les menus * Zoom * Redessin d'ecran * Cht Unites * Cht couches * Remise a 0 de l'origine des coordonnees relatives */ { wxRealPoint delta; wxPoint curpos, oldpos; Loading Loading @@ -68,25 +50,25 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) switch( g_KeyPressed ) { case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: case WXK_UP: Mouse.y -= wxRound(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2: case WXK_DOWN: Mouse.y += wxRound(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4: case WXK_LEFT: Mouse.x -= wxRound(delta.x); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6: case WXK_RIGHT: Mouse.x += wxRound(delta.x); DrawPanel->MouseTo( Mouse ); Loading @@ -97,10 +79,8 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) break; } /* Recalcul de la position du curseur schema */ GetScreen()->m_Curseur = curpos; /* Placement sur la grille generale */ PutOnGrid( &GetScreen()->m_Curseur ); if( oldpos != GetScreen()->m_Curseur ) Loading Loading @@ -129,5 +109,5 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) } SetToolbars(); UpdateStatusBar(); /* Affichage des coord curseur */ UpdateStatusBar(); }
gerbview/dcode.cpp +159 −153 File changed.Preview size limit exceeded, changes collapsed. Show changes
gerbview/deltrack.cpp +18 −27 Original line number Diff line number Diff line /*********************************************/ /* Edition des pistes: Routines d'effacement */ /* Effacement de segment, piste, net et zone */ /* Edit Track: Erase Routines */ /* Drop the segment, track, and net area */ /*********************************************/ #include "fctsys.h" Loading @@ -10,16 +10,10 @@ #include "gerbview.h" #include "protos.h" /* Routines externes : */ /* Routines Locales */ /* Variables locales */ /****************************************************************************************/ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number ) /****************************************************************************************/ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number ) { if( dcode_value < FIRST_DCODE ) // No tool selected return; Loading @@ -42,28 +36,26 @@ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int laye } /*****************************************************************/ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) /*****************************************************************/ /* 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. /* Removes 1 segment of track. * * If There is evidence of new track: erase segment * Otherwise: Delete segment under the cursor. */ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) { if( Track == NULL ) return NULL; if( Track->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment if( Track->m_Flags & IS_NEW ) // Trace in progress, delete the last // segment { if( g_CurrentTrackList.GetCount() > 0 ) { // modification du trace // Change track. delete g_CurrentTrackList.PopBack(); if( g_CurrentTrackList.GetCount() && g_CurrentTrackSegment->Type() == TYPE_VIA ) if( g_CurrentTrackList.GetCount() && g_CurrentTrackSegment->Type() == TYPE_VIA ) { delete g_CurrentTrackList.PopBack(); } Loading @@ -85,8 +77,7 @@ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) } return NULL; } // Fin traitement si trace en cours } Trace_Segment( DrawPanel, DC, Track, GR_XOR ); Loading
gerbview/edit.cpp +27 −34 Original line number Diff line number Diff line /******************************************************/ /* edit.cpp: fonctions generales de l'edition du PCB */ /******************************************************/ /***********************************/ /* edit.cpp: PCB editing functions */ /***********************************/ #include "fctsys.h" #include "class_drawpanel.h" Loading @@ -13,21 +13,17 @@ #include "protos.h" /************************************************************************/ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) /************************************************************************/ /* Traite les commandes declench�e par le bouton gauche de la souris, * quand un outil est deja selectionn� /* Process the command triggered by the left button of the mouse when a tool * is already selected. */ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); wxString msg; if( m_ID_current_state == 0 ) { if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours if( DrawStruct && DrawStruct->m_Flags ) { msg.Printf( wxT( "WinEDA_GerberFrame::ProcessCommand err: Struct %d, m_Flags = %X" ), (unsigned) DrawStruct->Type(), Loading Loading @@ -70,12 +66,9 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) } /********************************************************************************/ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) /********************************************************************************/ /* Traite les selections d'outils et les commandes appelees du menu POPUP /* Handles the selection of tools, menu, and popup menu commands. */ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) { int id = event.GetId(); int layer = GetScreen()->m_Active_Layer; Loading @@ -89,7 +82,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) pos.y += 20; switch( id ) // Arret eventuel de la commande de d�placement en cours switch( id ) { case wxID_CUT: case wxID_COPY: Loading @@ -108,7 +101,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) { DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); } /* ne devrait pas etre execute, sauf bug */ /* Should not be executed, except bug */ if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE ) { GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; Loading @@ -121,7 +114,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); break; default: // Arret dea commande de d�placement en cours default: if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) { Loading @@ -131,7 +124,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) break; } switch( id ) // Traitement des commandes switch( id ) { case ID_EXIT: Close( TRUE ); Loading @@ -147,10 +140,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_GET_TOOLS: // InstallToolsFrame(this, wxPoint(-1,-1) ); break; case ID_FIND_ITEMS: // InstallFindFrame(this, pos); break; Loading Loading @@ -249,7 +244,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS: if( gerber_layer ) Delete_DCode_Items( &dc, gerber_layer->m_Selected_Tool, ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); Delete_DCode_Items( &dc, gerber_layer->m_Selected_Tool, ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ); break; default: Loading @@ -261,12 +257,9 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) } /**************************************************************************/ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) /**************************************************************************/ /* Called on a double click: /* Called on a double click of left mouse button. */ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) { EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); wxClientDC dc( DrawPanel ); Loading @@ -281,7 +274,7 @@ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) DrawStruct = GerberGeneralLocateAndDisplay(); } break; // end case 0 break; default: break; Loading