Commit 1a4d2389 authored by stambaughw's avatar stambaughw
Browse files

Begin translating comments to English and minor code clean up.

* Translate comments in source files beginning with A-E in eeschema.
* Spell check comments and strings and uncrusified all modified files.
parent d3468dd5
Loading
Loading
Loading
Loading
+42 −40
Original line number Original line Diff line number Diff line
@@ -13,34 +13,35 @@


#include "general.h"
#include "general.h"


/* Variables Locales */


/*******************************************************************************************/
bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
    const wxString& aReference,
    const wxString& aReference,
    const wxString& aFootPrint,
    const wxString& aFootPrint,
    bool            aSetVisible )
    bool            aSetVisible )
/********************************************************************************************/
{

/** function FillFootprintFieldForAllInstancesofComponent
/** function FillFootprintFieldForAllInstancesofComponent
 * Search for component "aReference", and place a Footprint in Footprint field
 * Search for component "aReference", and place a Footprint in Footprint field
 * @param aReference = reference of the component to initialise
 * @param aReference = reference of the component to initialize
 * @param aFootPrint = new value for the filed Fottprint component
 * @param aFootPrint = new value for the filed Fottprint component
 * @param aSetVisible = true to have the field visible, false to set the invisible flag
 * @param aSetVisible = true to have the field visible, false to set the
 * invisible flag
 * @return true if the given component is found
 * @return true if the given component is found
 * Note:
 * Note:
 * the component is searched in the whole schematic, and because some components
 * the component is searched in the whole schematic, and because some
 * components
 * have more than one instance (multiple parts per package components)
 * have more than one instance (multiple parts per package components)
 * the search is not stopped when a reference is found (all instances must be found).
 * the search is not stopped when a reference is found (all instances must be
 * found).
 */
 */
{
    DrawSheetPath* sheet;
    DrawSheetPath* sheet;
    SCH_ITEM*      DrawList = NULL;
    SCH_ITEM*      DrawList = NULL;
    EDA_SheetList  SheetList;
    EDA_SheetList  SheetList;
    SCH_COMPONENT* Cmp;
    SCH_COMPONENT* Cmp;
    bool           found = false;
    bool           found = false;


    for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
    for( sheet = SheetList.GetFirst();
        sheet != NULL;
        sheet = SheetList.GetNext() )
    {
    {
        DrawList = (SCH_ITEM*) sheet->LastDrawList();
        DrawList = (SCH_ITEM*) sheet->LastDrawList();
        for( ; (DrawList != NULL); DrawList = DrawList->Next() )
        for( ; (DrawList != NULL); DrawList = DrawList->Next() )
@@ -52,19 +53,24 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
            if( aReference.CmpNoCase( Cmp->GetRef( sheet ) ) == 0 )
            if( aReference.CmpNoCase( Cmp->GetRef( sheet ) ) == 0 )
            {
            {
                // Found: Init Footprint Field
                // Found: Init Footprint Field
                 /* Give a reasonnable value to the fied position and orientation, if

                  * the text is empty at position 0, because it is probably not yet initialised
                /* Give a reasonable value to the field position and
                 * orientation, if the text is empty at position 0, because
                 * it is probably not yet initialized
                 */
                 */
                if( Cmp->GetField( FOOTPRINT )->m_Text.IsEmpty()
                if( Cmp->GetField( FOOTPRINT )->m_Text.IsEmpty()
                   && ( Cmp->GetField( FOOTPRINT )->m_Pos == wxPoint( 0, 0 ) ) )
                   && ( Cmp->GetField( FOOTPRINT )->m_Pos == wxPoint( 0, 0 ) ) )
                {
                {
                    Cmp->GetField(FOOTPRINT)->m_Orient = Cmp->GetField(VALUE)->m_Orient;
                    Cmp->GetField( FOOTPRINT )->m_Orient = Cmp->GetField(
                    Cmp->GetField(FOOTPRINT)->m_Pos    = Cmp->GetField(VALUE)->m_Pos;
                        VALUE )->m_Orient;
                    Cmp->GetField( FOOTPRINT )->m_Pos    = Cmp->GetField(
                        VALUE )->m_Pos;
                    Cmp->GetField( FOOTPRINT )->m_Pos.y -= 100;
                    Cmp->GetField( FOOTPRINT )->m_Pos.y -= 100;
                }
                }
                Cmp->GetField( FOOTPRINT )->m_Text = aFootPrint;
                Cmp->GetField( FOOTPRINT )->m_Text = aFootPrint;
                if( aSetVisible )
                if( aSetVisible )
                    Cmp->GetField(FOOTPRINT)->m_Attributs &= ~TEXT_NO_VISIBLE;
                    Cmp->GetField( FOOTPRINT )->m_Attributs &=
                        ~TEXT_NO_VISIBLE;
                else
                else
                    Cmp->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE;
                    Cmp->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE;
                found = true;
                found = true;
@@ -76,11 +82,9 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
}
}




/***************************************************************************/
bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
                                              aSetFielsAttributeToVisible  )
                                              aSetFielsAttributeToVisible  )
/***************************************************************************/
{

/** Function ProcessStuffFile
/** Function ProcessStuffFile
 * Read a "stuff" file created by cvpcb.
 * Read a "stuff" file created by cvpcb.
 * That file has lines like:
 * That file has lines like:
@@ -91,10 +95,10 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
 * "module =" gives the footprint name
 * "module =" gives the footprint name
 *
 *
 * @param aStuffFile = file (*.stf) to Read.
 * @param aStuffFile = file (*.stf) to Read.
 * @param aSetFielsAttributeToVisible = true to set the footprint field flag to visible
 * @param aSetFielsAttributeToVisible = true to set the footprint field flag to
 * @return true if ok.
 * visible
 * @return true if OK.
 */
 */
{
    int   LineNum = 0;
    int   LineNum = 0;
    char* cp, Ref[256], FootPrint[256], Line[1024];
    char* cp, Ref[256], FootPrint[256], Line[1024];


@@ -112,7 +116,8 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool


            wxString reference = CONV_FROM_UTF8( Ref );
            wxString reference = CONV_FROM_UTF8( Ref );
            wxString Footprint = CONV_FROM_UTF8( FootPrint );
            wxString Footprint = CONV_FROM_UTF8( FootPrint );
            FillFootprintFieldForAllInstancesofComponent( reference,
            FillFootprintFieldForAllInstancesofComponent(
                reference,
                Footprint,
                Footprint,
                aSetFielsAttributeToVisible );
                aSetFielsAttributeToVisible );
        }
        }
@@ -122,23 +127,20 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
}
}




/**************************************************************/
bool WinEDA_SchematicFrame::ReadInputStuffFile()
bool WinEDA_SchematicFrame::ReadInputStuffFile()
/**************************************************************/
{

/* Backann footprint info to schematic.
/* Backann footprint info to schematic.
 */
 */
{
    wxString Line, filename;
    wxString Line, filename;
    FILE*    StuffFile;
    FILE*    StuffFile;
    wxString msg;
    wxString msg;
    bool     SetFieldToVisible = true;
    bool     SetFieldToVisible = true;


    filename = EDA_FileSelector( _( "Load Stuff File" ),
    filename = EDA_FileSelector( _( "Load Stuff File" ),
                                 wxEmptyString,             /* Chemin par defaut */
                                 wxEmptyString,
                                 wxEmptyString,             /* nom fichier par defaut */
                                 wxEmptyString,
                                 wxT( ".stf" ),             /* extension par defaut */
                                 wxT( ".stf" ),
                                 wxT( "*.stf" ),            /* Masque d'affichage */
                                 wxT( "*.stf" ),
                                 this,
                                 this,
                                 wxFD_OPEN,
                                 wxFD_OPEN,
                                 FALSE
                                 FALSE
+141 −121
Original line number Original line Diff line number Diff line
/****************************************************/
/****************************************************/
/*	BLOCK.CPP										*/
/*	BLOCK.CPP										*/
/* Gestion des Operations sur Blocks et Effacements */
/****************************************************/
/****************************************************/


#include "fctsys.h"
#include "fctsys.h"
@@ -18,8 +17,6 @@
#include "protos.h"
#include "protos.h"




/* Variables Locales */

// Imported functions:
// Imported functions:
void            MoveItemsInList( PICKED_ITEMS_LIST& aItemsList,
void            MoveItemsInList( PICKED_ITEMS_LIST& aItemsList,
                                 const wxPoint      aMoveVector );
                                 const wxPoint      aMoveVector );
@@ -31,9 +28,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen,
                                      PICKED_ITEMS_LIST& aItemsList,
                                      PICKED_ITEMS_LIST& aItemsList,
                                      const wxPoint      aMoveVector  );
                                      const wxPoint      aMoveVector  );


/* Fonctions exportees */

/* Fonctions Locales */
static void     CollectStructsToDrag( SCH_SCREEN* screen );
static void     CollectStructsToDrag( SCH_SCREEN* screen );
static void     AddPickedItem( SCH_SCREEN* screen, wxPoint aPosition );
static void     AddPickedItem( SCH_SCREEN* screen, wxPoint aPosition );
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
@@ -47,12 +41,11 @@ static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList );


/*************************************************************************/
/*************************************************************************/
int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
{
/*************************************************************************/
/*************************************************************************/

/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
 *  the key (ALT, SHIFT ALT ..)
 *  the key (ALT, SHIFT ALT ..)
 */
 */
{
    int cmd;
    int cmd;


    switch( key )
    switch( key )
@@ -89,11 +82,10 @@ int WinEDA_SchematicFrame::ReturnBlockCommand( int key )


/*************************************************/
/*************************************************/
void WinEDA_SchematicFrame::InitBlockPasteInfos()
void WinEDA_SchematicFrame::InitBlockPasteInfos()
{
/*************************************************/
/*************************************************/

/* Init the parameters used by the block paste command
/* Init the parameters used by the block paste command
 */
 */
{
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;


    block->m_ItemsSelection.CopyList( g_BlockSaveDataList.m_ItemsSelection );
    block->m_ItemsSelection.CopyList( g_BlockSaveDataList.m_ItemsSelection );
@@ -103,14 +95,13 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos()


/******************************************************/
/******************************************************/
void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
{
/******************************************************/
/******************************************************/

/* Routine to handle the BLOCK PLACE command
/* Routine to handle the BLOCK PLACE commande
 *  Last routine for block operation for:
 *  Last routine for block operation for:
 *  - block move & drag
 *  - block move & drag
 *  - block copie & paste
 *  - block copy & paste
 */
 */
{
    bool            err   = FALSE;
    bool            err   = FALSE;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;


@@ -124,7 +115,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
    {
    {
        wxString msg;
        wxString msg;
        err = TRUE;
        err = TRUE;
        msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
        msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd \
%d, state %d)" ),
                    block->m_Command, block->m_State );
                    block->m_Command, block->m_State );
        DisplayError( this, msg );
        DisplayError( this, msg );
    }
    }
@@ -142,7 +134,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
        if( DrawPanel->ManageCurseur )
        if( DrawPanel->ManageCurseur )
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );


        SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector );
        SaveCopyInUndoList( block->m_ItemsSelection,
                            UR_MOVED,
                            block->m_MoveVector );


        MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector );
        MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector );
        block->ClearItemsList();
        block->ClearItemsList();
@@ -153,15 +147,18 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
        if( DrawPanel->ManageCurseur )
        if( DrawPanel->ManageCurseur )
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );


        DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector );
        DuplicateItemsInList(
            GetScreen(), block->m_ItemsSelection, block->m_MoveVector );


        SaveCopyInUndoList(  block->m_ItemsSelection,
        SaveCopyInUndoList(
                             (block->m_Command == BLOCK_PRESELECT_MOVE) ? UR_CHANGED : UR_NEW );
            block->m_ItemsSelection,
            (block->m_Command ==
             BLOCK_PRESELECT_MOVE) ? UR_CHANGED : UR_NEW );


        block->ClearItemsList();
        block->ClearItemsList();
        break;
        break;


    case BLOCK_PASTE:     /* Paste (recopie du dernier bloc sauve */
    case BLOCK_PASTE:
        if( DrawPanel->ManageCurseur )
        if( DrawPanel->ManageCurseur )
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
        PasteListOfItems( DC );
        PasteListOfItems( DC );
@@ -184,7 +181,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )


    /* clear struct.m_Flags  */
    /* clear struct.m_Flags  */
    SCH_ITEM* Struct;
    SCH_ITEM* Struct;
    for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
    for( Struct = GetScreen()->EEDrawList;
        Struct != NULL;
        Struct = Struct->Next() )
        Struct->m_Flags = 0;
        Struct->m_Flags = 0;


    DrawPanel->ManageCurseur = NULL;
    DrawPanel->ManageCurseur = NULL;
@@ -198,7 +197,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )


    if( block->GetCount() )
    if( block->GetCount() )
    {
    {
        DisplayError( this, wxT( "HandleBlockPLace() error: some items left in buffer" ) );
        DisplayError( this,
                      wxT( "HandleBlockPLace() error: some items left in buffer" ) );
        block->ClearItemsList();
        block->ClearItemsList();
    }
    }


@@ -210,15 +210,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )


/****************************************************/
/****************************************************/
int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
{
/****************************************************/
/****************************************************/

/* Manage end block command
/* Routine de gestion de la commande BLOCK END
 * Returns:
 *  retourne :
 * 0 if no features selected
 *  0 si aucun composant selectionne
 * 1 otherwise
 *  1 sinon
 * -1 If control ended and components selection (block delete, block save)
 *  -1 si commande terminee et composants trouves (block delete, block save)
 */
 */
{
    int             ii = 0;
    int             ii = 0;
    bool            zoom_command = FALSE;
    bool            zoom_command = FALSE;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
@@ -247,6 +246,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )


        case BLOCK_DRAG: /* Drag */
        case BLOCK_DRAG: /* Drag */
            BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
            BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );

        case BLOCK_MOVE:    /* Move */
        case BLOCK_MOVE:    /* Move */
        case BLOCK_COPY:    /* Copy */
        case BLOCK_COPY:    /* Copy */
            PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() );
            PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() );
@@ -288,9 +288,11 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
            DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
            DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
            if( block->GetCount() )
            if( block->GetCount() )
            {
            {
                wxPoint move_vector =  -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
                wxPoint move_vector =
                    -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
                SaveStructListForPaste( block->m_ItemsSelection );
                SaveStructListForPaste( block->m_ItemsSelection );
                MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection, move_vector);
                MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection,
                                 move_vector );
                ii = -1;
                ii = -1;
            }
            }
            block->ClearItemsList();
            block->ClearItemsList();
@@ -321,7 +323,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
    {
    {
        /* clear struct.m_Flags  */
        /* clear struct.m_Flags  */
        EDA_BaseStruct* Struct;
        EDA_BaseStruct* Struct;
        for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
        for( Struct = GetScreen()->EEDrawList;
            Struct != NULL;
            Struct = Struct->Next() )
            Struct->m_Flags = 0;
            Struct->m_Flags = 0;
    }
    }


@@ -333,7 +337,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
        DrawPanel->ManageCurseur = NULL;
        DrawPanel->ManageCurseur = NULL;
        DrawPanel->ForceCloseManageCurseur = NULL;
        DrawPanel->ForceCloseManageCurseur = NULL;
        GetScreen()->SetCurItem( NULL );
        GetScreen()->SetCurItem( NULL );
        SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
        SetToolID( m_ID_current_state,
                   DrawPanel->m_PanelDefaultCursor,
                   wxEmptyString );
    }
    }


    if( zoom_command )
    if( zoom_command )
@@ -345,13 +351,12 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )


/***********************************************************************/
/***********************************************************************/
void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
/***********************************************************************/
/***********************************************************************/

/* Manage end block command from context menu.
/* Routine de gestion de la commande BLOCK END by PopUp
 * Called after HandleBlockEnd.
 *  Appelee apres HandleBlockEnd.
 * From the command block move can execute a command other than block move.
 *  A partir de la commande bloc move, peut executer une commande autre que bloc move.
 */
 */
{
    int             ii    = 0;
    int             ii    = 0;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
    BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;


@@ -372,8 +377,10 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )


    case BLOCK_DRAG:     /* move to Drag */
    case BLOCK_DRAG:     /* move to Drag */


        /* Effacement de la liste des structures de pointage,
        /* *JP translate*
         *  qui est devenue erronnee */
         * Effacement de la liste des structures de pointage,
         * qui est devenue erronnee
         */
        if( DrawPanel->ManageCurseur )
        if( DrawPanel->ManageCurseur )
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
        block->ClearItemsList();
        block->ClearItemsList();
@@ -410,7 +417,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
        if( block->GetCount() )
        if( block->GetCount() )
        {
        {
            wxPoint move_vector =  -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
            wxPoint move_vector =
                -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
            SaveStructListForPaste( block->m_ItemsSelection );
            SaveStructListForPaste( block->m_ItemsSelection );
            MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection, move_vector );
            MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection, move_vector );
            ii = -1;
            ii = -1;
@@ -435,10 +443,12 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
        if( block->GetCount() )
        if( block->GetCount() )
        {
        {
            ii = -1;
            ii = -1;
            /* Compute the mirror centre and put it on grid */
            /* Compute the mirror center and put it on grid */
            wxPoint mirrorPoint = block->Centre();
            wxPoint mirrorPoint = block->Centre();
            PutOnGrid( &mirrorPoint );
            PutOnGrid( &mirrorPoint );
            SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_Y, mirrorPoint );
            SaveCopyInUndoList( block->m_ItemsSelection,
                                UR_MIRRORED_Y,
                                mirrorPoint );
            MirrorListOfItems( block->m_ItemsSelection, mirrorPoint );
            MirrorListOfItems( block->m_ItemsSelection, mirrorPoint );
            GetScreen()->SetModify();
            GetScreen()->SetModify();
        }
        }
@@ -459,7 +469,9 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
        DrawPanel->ManageCurseur = NULL;
        DrawPanel->ManageCurseur = NULL;
        DrawPanel->ForceCloseManageCurseur = NULL;
        DrawPanel->ForceCloseManageCurseur = NULL;
        GetScreen()->SetCurItem( NULL );
        GetScreen()->SetCurItem( NULL );
        SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
        SetToolID( m_ID_current_state,
                   DrawPanel->m_PanelDefaultCursor,
                   wxEmptyString );
    }
    }
}
}


@@ -467,18 +479,17 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
/************************************************************************/
/************************************************************************/
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
                                     bool erase )
                                     bool erase )
{
/************************************************************************/
/************************************************************************/

/* Traces the outline of the search block structures
/* Retrace le contour du block de recherche de structures
 * The entire block follows the cursor
 *  L'ensemble du block suit le curseur
 */
 */
{
    BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;;
    BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;;


    BASE_SCREEN*    screen = panel->GetScreen();
    BASE_SCREEN*    screen = panel->GetScreen();
    SCH_ITEM*       schitem;
    SCH_ITEM*       schitem;


    /* Effacement ancien cadre */
    /* Erase old block contents. */
    if( erase )
    if( erase )
    {
    {
        block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
        block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
@@ -489,8 +500,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
        }
        }
    }
    }


    /* Redessin nouvel affichage */
    /* Repaint new view. */

    block->m_MoveVector = screen->m_Curseur - block->m_BlockLastCursorPosition;
    block->m_MoveVector = screen->m_Curseur - block->m_BlockLastCursorPosition;


    block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
    block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
@@ -505,22 +515,24 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,


/*****************************************************************/
/*****************************************************************/
void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
{
/*****************************************************************/
/*****************************************************************/

/* Routine to Save an object from global drawing object list.
/* Routine to Save an object from global drawing object list.
 *  This routine is the same as delete but:
 *  This routine is the same as delete but:
 *  - the original list is NOT removed.
 *  - the original list is NOT removed.
 *  - List is saved in g_BlockSaveDataList
 *  - List is saved in g_BlockSaveDataList
 */
 */
{
    g_BlockSaveDataList.ClearListAndDeleteItems();      // delete previous
    g_BlockSaveDataList.ClearListAndDeleteItems();      // delete previous saved list, if exists
                                                        // saved list, if
                                                        // exists


    /* save the new list: */
    /* save the new list: */
    ITEM_PICKER item;
    ITEM_PICKER item;
    for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
    for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
    {
    {
        /* Make a copy of the original picked item. */
        /* Make a copy of the original picked item. */
        SCH_ITEM* DrawStructCopy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
        SCH_ITEM* DrawStructCopy = DuplicateStruct(
             (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
        DrawStructCopy->SetParent( NULL );
        DrawStructCopy->SetParent( NULL );
        item.m_PickedItem = DrawStructCopy;
        item.m_PickedItem = DrawStructCopy;
        g_BlockSaveDataList.PushItem( item );
        g_BlockSaveDataList.PushItem( item );
@@ -548,7 +560,9 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
    ITEM_PICKER       picker( NULL, UR_NEW );
    ITEM_PICKER       picker( NULL, UR_NEW );
    for( unsigned ii = 0; ii < g_BlockSaveDataList.GetCount(); ii++ )
    for( unsigned ii = 0; ii < g_BlockSaveDataList.GetCount(); ii++ )
    {
    {
        Struct = DuplicateStruct( (SCH_ITEM*) g_BlockSaveDataList.m_ItemsSelection.GetPickedItem( ii ) );
        Struct = DuplicateStruct(
             (SCH_ITEM*) g_BlockSaveDataList.m_ItemsSelection.GetPickedItem(
                ii ) );
        picker.m_PickedItem = Struct;
        picker.m_PickedItem = Struct;
        picklist.PushItem( picker );
        picklist.PushItem( picker );


@@ -569,7 +583,9 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
    MoveItemsInList( picklist, GetScreen()->m_BlockLocate.m_MoveVector );
    MoveItemsInList( picklist, GetScreen()->m_BlockLocate.m_MoveVector );


    /* clear .m_Flags member for all items */
    /* clear .m_Flags member for all items */
    for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
    for( Struct = GetScreen()->EEDrawList;
        Struct != NULL;
        Struct = Struct->Next() )
        Struct->m_Flags = 0;
        Struct->m_Flags = 0;


    GetScreen()->SetModify();
    GetScreen()->SetModify();
@@ -580,13 +596,12 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )


/****************************************************/
/****************************************************/
static void CollectStructsToDrag( SCH_SCREEN* screen )
static void CollectStructsToDrag( SCH_SCREEN* screen )
{
/****************************************************/
/****************************************************/

/* creates the list of items found when a drag block is initiated.
/* creates the list of items found when a drag block is initiated.
 * items are those selected in window block an some items outside this area but connected
 * items are those selected in window block an some items outside this area but
 * to a selected item (connected wires to a component or an entry )
 * connected to a selected item (connected wires to a component or an entry )
 */
 */
{
    SCH_ITEM*           Struct;
    SCH_ITEM*           Struct;
    EDA_DrawLineStruct* SegmStruct;
    EDA_DrawLineStruct* SegmStruct;


@@ -601,14 +616,16 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
    for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() )
    for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() )
        Struct->m_Flags = 0;
        Struct->m_Flags = 0;


    // Sel .m_Flags to selected for a wire or bus in selected area if there is only one item:
    // Sel .m_Flags to selected for a wire or bus in selected area if there is
    // only one item:
    if( pickedlist->GetCount() == 1 )
    if( pickedlist->GetCount() == 1 )
    {
    {
        Struct = (SCH_ITEM*) pickedlist->GetPickedItem( 0 );
        Struct = (SCH_ITEM*) pickedlist->GetPickedItem( 0 );
        if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
        if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
            Struct->m_Flags = SELECTED;
            Struct->m_Flags = SELECTED;
    }
    }
    // Sel .m_Flags to selected for a wire or bus in selected area for a list of items:
    // Sel .m_Flags to selected for a wire or bus in selected area for a list
    // of items:
    else
    else
    {
    {
        for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
        for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
@@ -622,8 +639,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
        return;
        return;




    /* Suppression du deplacement des extremites de segments hors cadre
    /* Remove the displacement of segment and undo the selection. */
     *  de selection */
    for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
    for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
    {
    {
        Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii );
        Struct = (SCH_ITEM*) (SCH_ITEM*) pickedlist->GetPickedItem( ii );
@@ -638,11 +654,11 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )


            // Save m_Flags for Undo/redo drag operations:
            // Save m_Flags for Undo/redo drag operations:
            pickedlist->SetPickerFlags( SegmStruct->m_Flags, ii );
            pickedlist->SetPickerFlags( SegmStruct->m_Flags, ii );

        }
        }
    }
    }


    /* Search for other items to drag. They are end wires connected to selected items
    /* Search for other items to drag. They are end wires connected to selected
     * items
     */
     */


    for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
    for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
@@ -693,17 +709,17 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )


/******************************************************************/
/******************************************************************/
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{
/******************************************************************/
/******************************************************************/

/** AddPickedItem
/** AddPickedItem
 * add to the picked list in screen->m_BlockLocate items found at location position
 * add to the picked list in screen->m_BlockLocate items found at location
 * position
 * @param screen = the screen to consider
 * @param screen = the screen to consider
 * @param position = the wxPoint where items must be located to be select
 * @param position = the wxPoint where items must be located to be select
 */
 */
{
    SCH_ITEM*          Struct;
    SCH_ITEM*          Struct;


    /* Examen de la liste des elements deja selectionnes */
    /* Review the list of already selected elements. */
    PICKED_ITEMS_LIST* pickedlist = &screen->m_BlockLocate.m_ItemsSelection;
    PICKED_ITEMS_LIST* pickedlist = &screen->m_BlockLocate.m_ItemsSelection;


    for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
    for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
@@ -730,7 +746,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
        }
        }
    }
    }


    /* Examen de la liste des elements non selectionnes */
    /* Review the list of elements not selected. */


    ITEM_PICKER picker;
    ITEM_PICKER picker;
    Struct = screen->EEDrawList;
    Struct = screen->EEDrawList;
@@ -745,14 +761,14 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )


        case DRAW_POLYLINE_STRUCT_TYPE:
        case DRAW_POLYLINE_STRUCT_TYPE:
            if( Struct->m_Flags & SELECTED )
            if( Struct->m_Flags & SELECTED )
                break; /* Deja en liste */
                break;
            break;
            break;


        case DRAW_JUNCTION_STRUCT_TYPE:
        case DRAW_JUNCTION_STRUCT_TYPE:
                #undef STRUCT
                #undef STRUCT
                #define STRUCT ( (DrawJunctionStruct*) Struct )
                #define STRUCT ( (DrawJunctionStruct*) Struct )
            if( Struct->m_Flags & SELECTED )
            if( Struct->m_Flags & SELECTED )
                break; /* Deja en liste */
                break;
            if( STRUCT->m_Pos != position )
            if( STRUCT->m_Pos != position )
                break;
                break;
            pickedlist->PushItem( picker );
            pickedlist->PushItem( picker );
@@ -762,11 +778,12 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
                #undef STRUCT
                #undef STRUCT
                #define STRUCT ( (EDA_DrawLineStruct*) Struct )
                #define STRUCT ( (EDA_DrawLineStruct*) Struct )
            if( Struct->m_Flags & SELECTED )
            if( Struct->m_Flags & SELECTED )
                break; /* Deja en liste */
                break;
            if( STRUCT->m_Start == position )
            if( STRUCT->m_Start == position )
            {
            {
                Struct->m_Flags  = SELECTED | ENDPOINT | STARTPOINT;
                Struct->m_Flags  = SELECTED | ENDPOINT | STARTPOINT;
                Struct->m_Flags &= ~STARTPOINT;
                Struct->m_Flags &= ~STARTPOINT;

                // Save m_Flags for Undo/redo drag operations:
                // Save m_Flags for Undo/redo drag operations:
                picker.m_PickerFlags = Struct->m_Flags;
                picker.m_PickerFlags = Struct->m_Flags;
                pickedlist->PushItem( picker );
                pickedlist->PushItem( picker );
@@ -775,6 +792,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
            {
            {
                Struct->m_Flags  = SELECTED | ENDPOINT | STARTPOINT;
                Struct->m_Flags  = SELECTED | ENDPOINT | STARTPOINT;
                Struct->m_Flags &= ~ENDPOINT;
                Struct->m_Flags &= ~ENDPOINT;

                // Save m_Flags for Undo/redo drag operations:
                // Save m_Flags for Undo/redo drag operations:
                picker.m_PickerFlags = Struct->m_Flags;
                picker.m_PickerFlags = Struct->m_Flags;
                pickedlist->PushItem( picker );
                pickedlist->PushItem( picker );
@@ -845,20 +863,20 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
}
}




/*********************************************************************************/
/****************************************************************************/
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
                                    wxPoint&       aPosition,
                                    wxPoint&       aPosition,
                                    bool           aSearchFirst )
                                    bool           aSearchFirst )
/*********************************************************************************/
{

/****************************************************************************/
/** GetNextPinPosition()
/** GetNextPinPosition()
 * calculate position of the "next" pin of the aDrawLibItem component
 * calculate position of the "next" pin of the aDrawLibItem component
 * @param aDrawLibItem = component to test.
 * @param aDrawLibItem = component to test.
 * @param aPosition = the calculated pin position, according to the component orientation and position
 * @param aPosition = the calculated pin position, according to the component
 * orientation and position
 * @param aSearchFirst = if true, search for the first pin
 * @param aSearchFirst = if true, search for the first pin
 * @return a pointer to the pin
 * @return a pointer to the pin
 */
 */
{
    static LIB_COMPONENT* Entry;
    static LIB_COMPONENT* Entry;
    static int Multi, convert, TransMat[2][2];
    static int Multi, convert, TransMat[2][2];
    static wxPoint CmpPosition;
    static wxPoint CmpPosition;
@@ -890,9 +908,11 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
        if( convert && Pin->m_Convert && ( Pin->m_Convert != convert ) )
        if( convert && Pin->m_Convert && ( Pin->m_Convert != convert ) )
            continue;
            continue;


        /* Calculate the pin position (according to the component orientation) */
        /* Calculate the pin position (according to the component orientation)
         **/
        aPosition = TransformCoordinate( TransMat, Pin->m_Pos ) + CmpPosition;
        aPosition = TransformCoordinate( TransMat, Pin->m_Pos ) + CmpPosition;
        return Pin;
        return Pin;
    }
    }

    return NULL;
    return NULL;
}
}
Loading