Commit bc5d9a75 authored by stambaughw's avatar stambaughw
Browse files

Complete comment translation of common source.

parent d21bf859
Loading
Loading
Loading
Loading
+22 −45
Original line number Diff line number Diff line
/***************************************************************/
/* base_screen.cpp - fonctions des classes du type BASE_SCREEN */
/***************************************************************/
/********************************************************/
/* base_screen.cpp - BASE_SCREEN object implementation. */
/********************************************************/

#ifdef __GNUG__
#pragma implementation
@@ -19,16 +19,14 @@ WX_DEFINE_OBJARRAY( GridArray );

BASE_SCREEN* ActiveScreen = NULL;

/* defines locaux */
#define CURSOR_SIZE 12  /* taille de la croix du curseur PCB */
#define CURSOR_SIZE 12  /* size of the cross cursor. */


/*******************************************************/
/* Class BASE_SCREEN: classe de gestion d'un affichage */
/*******************************************************/
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
{
    EEDrawList         = NULL;   /* Schematic items list */
    m_UndoRedoCountMax = 10;     /* undo/Redo command Max depth, 10 is a reasonnable value */
    m_UndoRedoCountMax = 10;     /* undo/Redo command Max depth, 10 is a
                                  * reasonable value */
    m_FirstRedraw      = TRUE;
    m_ScreenNumber     = 1;
    m_NumberOfScreen   = 1;  /* Hierarchy: Root: ScreenNumber = 1 */
@@ -45,16 +43,12 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
}


/******************************/
BASE_SCREEN::~BASE_SCREEN()
/******************************/
{
}


/*******************************/
void BASE_SCREEN::InitDatas()
/*******************************/
{
    if( m_Center )
    {
@@ -73,16 +67,15 @@ void BASE_SCREEN::InitDatas()

    SetCurItem( NULL );

    /* indicateurs divers */
    m_FlagRefreshReq = 0;   /* Redraw screen requste flag */
    m_FlagModified   = 0;   // Set when any change is made on borad
    m_FlagRefreshReq = 0;   /* Redraw screen request flag */
    m_FlagModified   = 0;   // Set when any change is made on broad
    m_FlagSave = 1;         // Used in auto save: set when an auto save is made
}

/**
 * Get screen units scalar.
 *
 * Default implimentation returns scalar used for schematic screen.  The
 * Default implementation returns scalar used for schematic screen.  The
 * internal units used by the schematic screen is 1 mil (0.001").  Override
 * this in derived classes that require internal units other than 1 mil.
 */
@@ -91,9 +84,8 @@ int BASE_SCREEN::GetInternalUnits( void )
    return EESCHEMA_INTERNAL_UNIT;
}

/************************************/

wxSize BASE_SCREEN::ReturnPageSize( void )
/************************************/
{
    int internal_units = GetInternalUnits();

@@ -107,9 +99,7 @@ wxSize BASE_SCREEN::ReturnPageSize( void )
 * @return the position in user units of location ScreenPos
 * @param ScreenPos = the screen (in pixel) position co convert
*/
/******************************************************************/
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
/******************************************************************/
{
    wxPoint curpos = ScreenPos;
    Unscale( curpos );
@@ -122,7 +112,7 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
}

/** Function SetScalingFactor
 * calculates the .m_Zoom member to have a given scaling facort
 * calculates the .m_Zoom member to have a given scaling factor
 * @param the the current scale used to draw items on screen
 * draw coordinates are user coordinates * GetScalingFactor( )
*/
@@ -163,6 +153,7 @@ int BASE_SCREEN::Scale( int coord )
#endif
}


double BASE_SCREEN::Scale( double coord )
{
#ifdef WX_ZOOM
@@ -178,12 +169,14 @@ double BASE_SCREEN::Scale( double coord )
#endif
}


void BASE_SCREEN::Scale( wxPoint& pt )
{
    pt.x = Scale( pt.x );
    pt.y = Scale( pt.y );
}


void BASE_SCREEN::Scale( wxRealPoint& pt )
{
#ifdef WX_ZOOM
@@ -336,12 +329,7 @@ bool BASE_SCREEN::SetLastZoom()
}


/********************************************/
void BASE_SCREEN::SetGridList( GridArray& gridlist )
/********************************************/

/* init liste des zoom (NULL terminated)
 */
{
    if( !m_GridList.IsEmpty() )
        m_GridList.Clear();
@@ -350,9 +338,7 @@ void BASE_SCREEN::SetGridList( GridArray& gridlist )
}


/**********************************************/
void BASE_SCREEN::SetGrid( const wxRealPoint& size )
/**********************************************/
{
    wxASSERT( !m_GridList.IsEmpty() );

@@ -380,6 +366,7 @@ void BASE_SCREEN::SetGrid( const wxRealPoint& size )
                  size.x, size.y, m_Grid.m_Size.x, m_Grid.m_Size.y );
}


/* Set grid size from command ID. */
void BASE_SCREEN::SetGrid( int id  )
{
@@ -403,6 +390,7 @@ void BASE_SCREEN::SetGrid( int id )
                  m_Grid.m_Size.y );
}


void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
{
    size_t i;
@@ -432,6 +420,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
    m_GridList.Add( grid );
}


void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
{
    GRID_TYPE grid;
@@ -441,6 +430,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
    AddGrid( grid );
}


void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )
{
    double x, y;
@@ -490,25 +480,19 @@ int BASE_SCREEN::GetGridId()
}


/*****************************************/
void BASE_SCREEN::ClearUndoRedoList()
/*****************************************/

/* free the undo and the redo lists
 */
void BASE_SCREEN::ClearUndoRedoList()
{
    ClearUndoORRedoList( m_UndoList );
    ClearUndoORRedoList( m_RedoList );
}


/***********************************************************/
void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
/************************************************************/

/* Put aNewitem in top of undo list
 *  Deletes olds items if > count max.
 *  Deletes old items if > count max.
 */
void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
{
    m_UndoList.PushCommand( aNewitem );

@@ -519,9 +503,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
}


/***********************************************************/
void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
/***********************************************************/
{
    m_RedoList.PushCommand( aNewitem );

@@ -532,17 +514,13 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
}


/*****************************************************/
PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromUndoList( )
/*****************************************************/
{
    return m_UndoList.PopCommand( );
}


/******************************************************/
PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromRedoList( )
/******************************************************/
{
    return m_RedoList.PopCommand( );
}
@@ -572,4 +550,3 @@ void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
    NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif
+1 −3
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@
/*		EDA_TextStruct                  */
/****************************************/

/* Fichier base_struct.cpp */

#include "fctsys.h"
#include "gr_basic.h"
#include "trigo.h"
@@ -28,7 +26,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType )
{
    InitVars();
    m_StructType = idType;
    m_Parent     = parent; /* Chainage hierarchique sur struct racine */
    m_Parent     = parent;
}


+10 −29
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@
/*
 * Class constructor for WinEDA_BasicFrame general options
 */
/**********************************************************/
WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father,
                                      int idtype,
                                      const wxString& title,
@@ -45,32 +44,27 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father,

    SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );

    /* Verification des parametres de creation */
    if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
        SetSize( 0, 0, minsize.x, minsize.y );

    // Create child subwindows.
    GetClientSize( &m_FrameSize.x, &m_FrameSize.y );  /* dimx, dimy = dimensions utiles de la
                                                      * zone utilisateur de la fenetre principale */
    GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); /* dimensions of the user
                                                      * area of the main
                                                      * window */
    m_FramePos.x   = m_FramePos.y = 0;
    m_FrameSize.y -= m_MsgFrameHeight;

}


/*
 *
 */
/******************************************/
WinEDA_BasicFrame::~WinEDA_BasicFrame()
/******************************************/
{
    if( wxGetApp().m_HtmlCtrl )
        delete wxGetApp().m_HtmlCtrl;
    wxGetApp().m_HtmlCtrl = NULL;

    /* This needed for OSX: avoids furter OnDraw processing after this destructor
     * and before the native window is destroyed
    /* This needed for OSX: avoids furter OnDraw processing after this
     * destructor and before the native window is destroyed
     */
    this->Freeze( );
}
@@ -79,9 +73,7 @@ WinEDA_BasicFrame::~WinEDA_BasicFrame()
/*
 * Virtual function
 */
/***********************************/
void WinEDA_BasicFrame::ReCreateMenuBar()
/***********************************/
{

}
@@ -158,9 +150,7 @@ void WinEDA_BasicFrame::SaveSettings()
}


/******************************************************/
void WinEDA_BasicFrame::PrintMsg( const wxString& text )
/******************************************************/
{
    SetStatusText( text );
}
@@ -169,9 +159,7 @@ void WinEDA_BasicFrame::PrintMsg( const wxString& text )
/*
 * Display a bargraph (0 to 50 point length) for a PerCent value from 0 to 100
 */
/*************************************************************************/
void WinEDA_BasicFrame::DisplayActivity( int PerCent, const wxString& Text )
/*************************************************************************/
{
    wxString Line;

@@ -188,11 +176,9 @@ void WinEDA_BasicFrame::DisplayActivity( int PerCent, const wxString& Text )


/*
 * Met a jour la liste des anciens projets
 * Update the list of past projects.
 */
/*******************************************************************/
void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
/*******************************************************************/
{
    wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
    ReCreateMenuBar();
@@ -202,10 +188,8 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
/*
 * Fetch the file name from the file history list.
 */
/*********************************************************************/
wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
                                                const wxString& type )
/*********************************************************************/
{
    wxString fn, msg;
    size_t   i;
@@ -236,9 +220,7 @@ wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
/*
 *
 */
/**************************************************************/
void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/**************************************************************/
{
    wxString msg;

@@ -257,7 +239,8 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
    }
    else
    {
        msg.Printf( _( "Help file %s not found" ), GetChars( wxGetApp().m_HelpFileName ) );
        msg.Printf( _( "Help file %s not found" ),
                    GetChars( wxGetApp().m_HelpFileName ) );
        DisplayError( this, msg );
    }

@@ -281,9 +264,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/*
 *
 */
/***********************************************************************/
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
/***********************************************************************/
{
    wxAboutDialogInfo info;
    InitKiCadAbout(info);
+25 −48
Original line number Diff line number Diff line
/****************************************************/
/* Routines de gestion des commandes sur blocks		*/
/* (section commune eeschema/pcbnew...              */
/****************************************************/

/* Fichier common.cpp */
/********************************************/
/* Routines for managing on block commands. */
/* (Common section Eeschema / pcbnew ...    */
/********************************************/

#include "fctsys.h"
#include "gr_basic.h"
@@ -17,36 +15,25 @@
#include "block_commande.h"


/*******************/
/* BLOCK_SELECTOR */
/*******************/

/****************************************************************************/
BLOCK_SELECTOR::BLOCK_SELECTOR() :
    EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ),
    EDA_Rect()
/****************************************************************************/
{
    m_State   = STATE_NO_BLOCK; /* Etat (enum BlockState) du block */
    m_Command = BLOCK_IDLE;     /* Type (enum CmdBlockType) d'operation */
    m_State   = STATE_NO_BLOCK; /* State (enum BlockState) of block. */
    m_Command = BLOCK_IDLE;     /* Type (enum CmdBlockType) of operation. */
    m_Color   = BROWN;
}


/****************************************/
BLOCK_SELECTOR::~BLOCK_SELECTOR()
/****************************************/
{
}


/***************************************************************/
void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
/***************************************************************/

/*
 *  Print block command message (Block move, Block copy ...) in status bar
 */
void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
{
    wxString msg;

@@ -109,12 +96,10 @@ void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
}


/**************************************************************/
void BLOCK_SELECTOR::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
                           const wxPoint& aOffset,
                           int aDrawMode,
                           int aColor )
/**************************************************************/
{
    int w = aPanel->GetScreen()->Scale( GetWidth() );
    int h = aPanel->GetScreen()->Scale( GetHeight() );
@@ -129,13 +114,11 @@ void BLOCK_SELECTOR::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
}


/*************************************************************************/
void BLOCK_SELECTOR::InitData( WinEDA_DrawPanel* aPanel, const wxPoint& startpos )
/*************************************************************************/

/** function InitData
 *  Init the initial values of a BLOCK_SELECTOR, before starting a block command
 */
void BLOCK_SELECTOR::InitData( WinEDA_DrawPanel* aPanel,
                               const wxPoint&    startpos )
{
    m_State = STATE_BLOCK_INIT;
    SetOrigin( startpos );
@@ -147,7 +130,8 @@ void BLOCK_SELECTOR::InitData( WinEDA_DrawPanel* aPanel, const wxPoint& startpos


/** Function ClearItemsList
 * delete only the list of EDA_BaseStruct * pointers, NOT the pointed data itself
 * delete only the list of EDA_BaseStruct * pointers, NOT the pointed data
 * itself
 */
void BLOCK_SELECTOR::ClearItemsList()
{
@@ -155,7 +139,8 @@ void BLOCK_SELECTOR::ClearItemsList()
}

/** Function ClearListAndDeleteItems
 * delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
 * delete only the list of EDA_BaseStruct * pointers, AND the data pinted
 * by m_Item
 */
void BLOCK_SELECTOR::ClearListAndDeleteItems()
{
@@ -173,14 +158,11 @@ void BLOCK_SELECTOR::PushItem( ITEM_PICKER& aItem )



/*************************************************************************/
bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
                                         const wxPoint& startpos )
/*************************************************************************/

/*  First command block function:
 *  Init the Block infos: command type, initial position, and other variables..
 */
bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
                                         const wxPoint& startpos )
{
    BLOCK_SELECTOR* Block = &GetBaseScreen()->m_BlockLocate;

@@ -249,15 +231,14 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
    return TRUE;
}

/********************************************************************************/
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/********************************************************************************/

/* Redraw the outlines of the block which shows the search area for block commands
/* Redraw the outlines of the block which shows the search area for block
 * commands
 *  The first point of the rectangle showing the area is initialised
 *  by Initm_BlockLocateDatas().
 *  The other point of the rectangle is the mouse cursor
 */
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
    BLOCK_SELECTOR* PtBlock;

@@ -265,7 +246,6 @@ void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )

    PtBlock->m_MoveVector = wxPoint( 0, 0 );

    /* Effacement ancien cadre */
    if( erase )
        PtBlock->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );

@@ -277,25 +257,23 @@ void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
    if( PtBlock->m_State == STATE_BLOCK_INIT )
    {
        if( PtBlock->GetWidth() || PtBlock->GetHeight() )
            /* 2ieme point existant: le rectangle n'est pas de surface nulle */
            /* 2nd point exists: the rectangle is not surface anywhere */
            PtBlock->m_State = STATE_BLOCK_END;
    }
}


/******************************************************************/
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
/******************************************************************/

/*
 *  Cancel Current block operation.
 */
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
{
    BASE_SCREEN* screen = Panel->GetScreen();

    if( Panel->ManageCurseur )                      /* Erase current drawing on screen */
    if( Panel->ManageCurseur )                     /* Erase current drawing
                                                    * on screen */
    {
        Panel->ManageCurseur( Panel, DC, FALSE );   /* Efface dessin fantome */
        Panel->ManageCurseur( Panel, DC, FALSE );  /* Clear block outline. */
        Panel->ManageCurseur = NULL;
        Panel->ForceCloseManageCurseur = NULL;
        screen->SetCurItem( NULL );
@@ -314,4 +292,3 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
    screen->m_BlockLocate.m_Command = BLOCK_IDLE;
    Panel->m_Parent->DisplayToolMsg( wxEmptyString );
}
+0 −1
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
}


/* Effacement memoire de la structure */
MARKER_BASE::~MARKER_BASE()
{
}
Loading