Commit bc5d9a75 authored by stambaughw's avatar stambaughw

Complete comment translation of common source.

parent d21bf859
/***************************************************************/ /********************************************************/
/* base_screen.cpp - fonctions des classes du type BASE_SCREEN */ /* base_screen.cpp - BASE_SCREEN object implementation. */
/***************************************************************/ /********************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -19,16 +19,14 @@ WX_DEFINE_OBJARRAY( GridArray ); ...@@ -19,16 +19,14 @@ WX_DEFINE_OBJARRAY( GridArray );
BASE_SCREEN* ActiveScreen = NULL; BASE_SCREEN* ActiveScreen = NULL;
/* defines locaux */ #define CURSOR_SIZE 12 /* size of the cross cursor. */
#define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */
/*******************************************************/
/* Class BASE_SCREEN: classe de gestion d'un affichage */
/*******************************************************/
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
{ {
EEDrawList = NULL; /* Schematic items list */ 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_FirstRedraw = TRUE;
m_ScreenNumber = 1; m_ScreenNumber = 1;
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
...@@ -45,16 +43,12 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) ...@@ -45,16 +43,12 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
} }
/******************************/
BASE_SCREEN::~BASE_SCREEN() BASE_SCREEN::~BASE_SCREEN()
/******************************/
{ {
} }
/*******************************/
void BASE_SCREEN::InitDatas() void BASE_SCREEN::InitDatas()
/*******************************/
{ {
if( m_Center ) if( m_Center )
{ {
...@@ -73,16 +67,15 @@ void BASE_SCREEN::InitDatas() ...@@ -73,16 +67,15 @@ void BASE_SCREEN::InitDatas()
SetCurItem( NULL ); SetCurItem( NULL );
/* indicateurs divers */ m_FlagRefreshReq = 0; /* Redraw screen request flag */
m_FlagRefreshReq = 0; /* Redraw screen requste flag */ m_FlagModified = 0; // Set when any change is made on broad
m_FlagModified = 0; // Set when any change is made on borad
m_FlagSave = 1; // Used in auto save: set when an auto save is made m_FlagSave = 1; // Used in auto save: set when an auto save is made
} }
/** /**
* Get screen units scalar. * 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 * 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. * this in derived classes that require internal units other than 1 mil.
*/ */
...@@ -91,9 +84,8 @@ int BASE_SCREEN::GetInternalUnits( void ) ...@@ -91,9 +84,8 @@ int BASE_SCREEN::GetInternalUnits( void )
return EESCHEMA_INTERNAL_UNIT; return EESCHEMA_INTERNAL_UNIT;
} }
/************************************/
wxSize BASE_SCREEN::ReturnPageSize( void ) wxSize BASE_SCREEN::ReturnPageSize( void )
/************************************/
{ {
int internal_units = GetInternalUnits(); int internal_units = GetInternalUnits();
...@@ -107,9 +99,7 @@ wxSize BASE_SCREEN::ReturnPageSize( void ) ...@@ -107,9 +99,7 @@ wxSize BASE_SCREEN::ReturnPageSize( void )
* @return the position in user units of location ScreenPos * @return the position in user units of location ScreenPos
* @param ScreenPos = the screen (in pixel) position co convert * @param ScreenPos = the screen (in pixel) position co convert
*/ */
/******************************************************************/
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
/******************************************************************/
{ {
wxPoint curpos = ScreenPos; wxPoint curpos = ScreenPos;
Unscale( curpos ); Unscale( curpos );
...@@ -122,7 +112,7 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) ...@@ -122,7 +112,7 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
} }
/** Function SetScalingFactor /** 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 * @param the the current scale used to draw items on screen
* draw coordinates are user coordinates * GetScalingFactor( ) * draw coordinates are user coordinates * GetScalingFactor( )
*/ */
...@@ -163,6 +153,7 @@ int BASE_SCREEN::Scale( int coord ) ...@@ -163,6 +153,7 @@ int BASE_SCREEN::Scale( int coord )
#endif #endif
} }
double BASE_SCREEN::Scale( double coord ) double BASE_SCREEN::Scale( double coord )
{ {
#ifdef WX_ZOOM #ifdef WX_ZOOM
...@@ -178,12 +169,14 @@ double BASE_SCREEN::Scale( double coord ) ...@@ -178,12 +169,14 @@ double BASE_SCREEN::Scale( double coord )
#endif #endif
} }
void BASE_SCREEN::Scale( wxPoint& pt ) void BASE_SCREEN::Scale( wxPoint& pt )
{ {
pt.x = Scale( pt.x ); pt.x = Scale( pt.x );
pt.y = Scale( pt.y ); pt.y = Scale( pt.y );
} }
void BASE_SCREEN::Scale( wxRealPoint& pt ) void BASE_SCREEN::Scale( wxRealPoint& pt )
{ {
#ifdef WX_ZOOM #ifdef WX_ZOOM
...@@ -336,12 +329,7 @@ bool BASE_SCREEN::SetLastZoom() ...@@ -336,12 +329,7 @@ bool BASE_SCREEN::SetLastZoom()
} }
/********************************************/
void BASE_SCREEN::SetGridList( GridArray& gridlist ) void BASE_SCREEN::SetGridList( GridArray& gridlist )
/********************************************/
/* init liste des zoom (NULL terminated)
*/
{ {
if( !m_GridList.IsEmpty() ) if( !m_GridList.IsEmpty() )
m_GridList.Clear(); m_GridList.Clear();
...@@ -350,9 +338,7 @@ void BASE_SCREEN::SetGridList( GridArray& gridlist ) ...@@ -350,9 +338,7 @@ void BASE_SCREEN::SetGridList( GridArray& gridlist )
} }
/**********************************************/
void BASE_SCREEN::SetGrid( const wxRealPoint& size ) void BASE_SCREEN::SetGrid( const wxRealPoint& size )
/**********************************************/
{ {
wxASSERT( !m_GridList.IsEmpty() ); wxASSERT( !m_GridList.IsEmpty() );
...@@ -380,6 +366,7 @@ void BASE_SCREEN::SetGrid( const wxRealPoint& size ) ...@@ -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 ); size.x, size.y, m_Grid.m_Size.x, m_Grid.m_Size.y );
} }
/* Set grid size from command ID. */ /* Set grid size from command ID. */
void BASE_SCREEN::SetGrid( int id ) void BASE_SCREEN::SetGrid( int id )
{ {
...@@ -403,6 +390,7 @@ void BASE_SCREEN::SetGrid( int id ) ...@@ -403,6 +390,7 @@ void BASE_SCREEN::SetGrid( int id )
m_Grid.m_Size.y ); m_Grid.m_Size.y );
} }
void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
{ {
size_t i; size_t i;
...@@ -432,6 +420,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) ...@@ -432,6 +420,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
m_GridList.Add( grid ); m_GridList.Add( grid );
} }
void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
{ {
GRID_TYPE grid; GRID_TYPE grid;
...@@ -441,6 +430,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id ) ...@@ -441,6 +430,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
AddGrid( grid ); AddGrid( grid );
} }
void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )
{ {
double x, y; double x, y;
...@@ -490,25 +480,19 @@ int BASE_SCREEN::GetGridId() ...@@ -490,25 +480,19 @@ int BASE_SCREEN::GetGridId()
} }
/*****************************************/
void BASE_SCREEN::ClearUndoRedoList()
/*****************************************/
/* free the undo and the redo lists /* free the undo and the redo lists
*/ */
void BASE_SCREEN::ClearUndoRedoList()
{ {
ClearUndoORRedoList( m_UndoList ); ClearUndoORRedoList( m_UndoList );
ClearUndoORRedoList( m_RedoList ); ClearUndoORRedoList( m_RedoList );
} }
/***********************************************************/
void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
/************************************************************/
/* Put aNewitem in top of undo list /* 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 ); m_UndoList.PushCommand( aNewitem );
...@@ -519,9 +503,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem ) ...@@ -519,9 +503,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
} }
/***********************************************************/
void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem ) void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
/***********************************************************/
{ {
m_RedoList.PushCommand( aNewitem ); m_RedoList.PushCommand( aNewitem );
...@@ -532,17 +514,13 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem ) ...@@ -532,17 +514,13 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
} }
/*****************************************************/
PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromUndoList( ) PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromUndoList( )
/*****************************************************/
{ {
return m_UndoList.PopCommand( ); return m_UndoList.PopCommand( );
} }
/******************************************************/
PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromRedoList( ) PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromRedoList( )
/******************************************************/
{ {
return m_RedoList.PopCommand( ); return m_RedoList.PopCommand( );
} }
...@@ -572,4 +550,3 @@ void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) ...@@ -572,4 +550,3 @@ void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }
#endif #endif
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
/* EDA_TextStruct */ /* EDA_TextStruct */
/****************************************/ /****************************************/
/* Fichier base_struct.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "trigo.h" #include "trigo.h"
...@@ -28,7 +26,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType ) ...@@ -28,7 +26,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType )
{ {
InitVars(); InitVars();
m_StructType = idType; m_StructType = idType;
m_Parent = parent; /* Chainage hierarchique sur struct racine */ m_Parent = parent;
} }
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
/* /*
* Class constructor for WinEDA_BasicFrame general options * Class constructor for WinEDA_BasicFrame general options
*/ */
/**********************************************************/
WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father,
int idtype, int idtype,
const wxString& title, const wxString& title,
...@@ -45,32 +44,27 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, ...@@ -45,32 +44,27 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father,
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 ); SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
/* Verification des parametres de creation */ if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
if( (size.x < minsize.x) || (size.y < minsize.y) )
SetSize( 0, 0, minsize.x, minsize.y ); SetSize( 0, 0, minsize.x, minsize.y );
// Create child subwindows. // Create child subwindows.
GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); /* dimx, dimy = dimensions utiles de la GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); /* dimensions of the user
* zone utilisateur de la fenetre principale */ * area of the main
* window */
m_FramePos.x = m_FramePos.y = 0; m_FramePos.x = m_FramePos.y = 0;
m_FrameSize.y -= m_MsgFrameHeight; m_FrameSize.y -= m_MsgFrameHeight;
} }
/*
*
*/
/******************************************/
WinEDA_BasicFrame::~WinEDA_BasicFrame() WinEDA_BasicFrame::~WinEDA_BasicFrame()
/******************************************/
{ {
if( wxGetApp().m_HtmlCtrl ) if( wxGetApp().m_HtmlCtrl )
delete wxGetApp().m_HtmlCtrl; delete wxGetApp().m_HtmlCtrl;
wxGetApp().m_HtmlCtrl = NULL; wxGetApp().m_HtmlCtrl = NULL;
/* This needed for OSX: avoids furter OnDraw processing after this destructor /* This needed for OSX: avoids furter OnDraw processing after this
* and before the native window is destroyed * destructor and before the native window is destroyed
*/ */
this->Freeze( ); this->Freeze( );
} }
...@@ -79,9 +73,7 @@ WinEDA_BasicFrame::~WinEDA_BasicFrame() ...@@ -79,9 +73,7 @@ WinEDA_BasicFrame::~WinEDA_BasicFrame()
/* /*
* Virtual function * Virtual function
*/ */
/***********************************/
void WinEDA_BasicFrame::ReCreateMenuBar() void WinEDA_BasicFrame::ReCreateMenuBar()
/***********************************/
{ {
} }
...@@ -158,9 +150,7 @@ void WinEDA_BasicFrame::SaveSettings() ...@@ -158,9 +150,7 @@ void WinEDA_BasicFrame::SaveSettings()
} }
/******************************************************/
void WinEDA_BasicFrame::PrintMsg( const wxString& text ) void WinEDA_BasicFrame::PrintMsg( const wxString& text )
/******************************************************/
{ {
SetStatusText( text ); SetStatusText( text );
} }
...@@ -169,9 +159,7 @@ void WinEDA_BasicFrame::PrintMsg( const wxString& 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 * 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 ) void WinEDA_BasicFrame::DisplayActivity( int PerCent, const wxString& Text )
/*************************************************************************/
{ {
wxString Line; wxString Line;
...@@ -188,11 +176,9 @@ void WinEDA_BasicFrame::DisplayActivity( int PerCent, const wxString& Text ) ...@@ -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 ) void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
/*******************************************************************/
{ {
wxGetApp().m_fileHistory.AddFileToHistory( FullFileName ); wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
ReCreateMenuBar(); ReCreateMenuBar();
...@@ -202,10 +188,8 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName ) ...@@ -202,10 +188,8 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
/* /*
* Fetch the file name from the file history list. * Fetch the file name from the file history list.
*/ */
/*********************************************************************/
wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId, wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
const wxString& type ) const wxString& type )
/*********************************************************************/
{ {
wxString fn, msg; wxString fn, msg;
size_t i; size_t i;
...@@ -236,9 +220,7 @@ wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId, ...@@ -236,9 +220,7 @@ wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
/* /*
* *
*/ */
/**************************************************************/
void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/**************************************************************/
{ {
wxString msg; wxString msg;
...@@ -257,7 +239,8 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) ...@@ -257,7 +239,8 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
} }
else 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 ); DisplayError( this, msg );
} }
...@@ -273,7 +256,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) ...@@ -273,7 +256,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
GetAssociatedDocument( this, helpFile ); GetAssociatedDocument( this, helpFile );
#else #else
# error Help files format not defined # error Help files format not defined
#endif #endif
} }
...@@ -281,9 +264,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) ...@@ -281,9 +264,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/* /*
* *
*/ */
/***********************************************************************/
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) ) void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
/***********************************************************************/
{ {
wxAboutDialogInfo info; wxAboutDialogInfo info;
InitKiCadAbout(info); InitKiCadAbout(info);
......
/****************************************************/ /********************************************/
/* Routines de gestion des commandes sur blocks */ /* Routines for managing on block commands. */
/* (section commune eeschema/pcbnew... */ /* (Common section Eeschema / pcbnew ... */
/****************************************************/ /********************************************/
/* Fichier common.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -17,36 +15,25 @@ ...@@ -17,36 +15,25 @@
#include "block_commande.h" #include "block_commande.h"
/*******************/
/* BLOCK_SELECTOR */
/*******************/
/****************************************************************************/
BLOCK_SELECTOR::BLOCK_SELECTOR() : BLOCK_SELECTOR::BLOCK_SELECTOR() :
EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ), EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ),
EDA_Rect() EDA_Rect()
/****************************************************************************/
{ {
m_State = STATE_NO_BLOCK; /* Etat (enum BlockState) du block */ m_State = STATE_NO_BLOCK; /* State (enum BlockState) of block. */
m_Command = BLOCK_IDLE; /* Type (enum CmdBlockType) d'operation */ m_Command = BLOCK_IDLE; /* Type (enum CmdBlockType) of operation. */
m_Color = BROWN; m_Color = BROWN;
} }
/****************************************/
BLOCK_SELECTOR::~BLOCK_SELECTOR() BLOCK_SELECTOR::~BLOCK_SELECTOR()
/****************************************/
{ {
} }
/***************************************************************/
void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
/***************************************************************/
/* /*
* Print block command message (Block move, Block copy ...) in status bar * Print block command message (Block move, Block copy ...) in status bar
*/ */
void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
...@@ -109,12 +96,10 @@ void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame ) ...@@ -109,12 +96,10 @@ void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
} }
/**************************************************************/
void BLOCK_SELECTOR::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void BLOCK_SELECTOR::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, const wxPoint& aOffset,
int aDrawMode, int aDrawMode,
int aColor ) int aColor )
/**************************************************************/
{ {
int w = aPanel->GetScreen()->Scale( GetWidth() ); int w = aPanel->GetScreen()->Scale( GetWidth() );
int h = aPanel->GetScreen()->Scale( GetHeight() ); int h = aPanel->GetScreen()->Scale( GetHeight() );
...@@ -129,13 +114,11 @@ void BLOCK_SELECTOR::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -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 /** function InitData
* Init the initial values of a BLOCK_SELECTOR, before starting a block command * 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; m_State = STATE_BLOCK_INIT;
SetOrigin( startpos ); SetOrigin( startpos );
...@@ -147,7 +130,8 @@ void BLOCK_SELECTOR::InitData( WinEDA_DrawPanel* aPanel, const wxPoint& startpos ...@@ -147,7 +130,8 @@ void BLOCK_SELECTOR::InitData( WinEDA_DrawPanel* aPanel, const wxPoint& startpos
/** Function ClearItemsList /** 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() void BLOCK_SELECTOR::ClearItemsList()
{ {
...@@ -155,7 +139,8 @@ void BLOCK_SELECTOR::ClearItemsList() ...@@ -155,7 +139,8 @@ void BLOCK_SELECTOR::ClearItemsList()
} }
/** Function ClearListAndDeleteItems /** 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() void BLOCK_SELECTOR::ClearListAndDeleteItems()
{ {
...@@ -173,14 +158,11 @@ void BLOCK_SELECTOR::PushItem( ITEM_PICKER& aItem ) ...@@ -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: /* First command block function:
* Init the Block infos: command type, initial position, and other variables.. * 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; BLOCK_SELECTOR* Block = &GetBaseScreen()->m_BlockLocate;
...@@ -204,7 +186,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key, ...@@ -204,7 +186,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save */
case BLOCK_ROTATE: /* Rotate 90 deg */ case BLOCK_ROTATE: /* Rotate 90 deg */
case BLOCK_FLIP: /* Flip */ case BLOCK_FLIP: /* Flip */
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */ case BLOCK_MIRROR_Y: /* mirror */
...@@ -228,7 +210,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key, ...@@ -228,7 +210,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
{ {
Block->m_ItemsSelection.ClearItemsList(); Block->m_ItemsSelection.ClearItemsList();
DisplayError( this, DisplayError( this,
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) ); wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
return TRUE; return TRUE;
} }
Block->m_State = STATE_BLOCK_MOVE; Block->m_State = STATE_BLOCK_MOVE;
...@@ -249,15 +231,14 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key, ...@@ -249,15 +231,14 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
return TRUE; 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 * The first point of the rectangle showing the area is initialised
* by Initm_BlockLocateDatas(). * by Initm_BlockLocateDatas().
* The other point of the rectangle is the mouse cursor * The other point of the rectangle is the mouse cursor
*/ */
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
BLOCK_SELECTOR* PtBlock; BLOCK_SELECTOR* PtBlock;
...@@ -265,7 +246,6 @@ void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -265,7 +246,6 @@ void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
PtBlock->m_MoveVector = wxPoint( 0, 0 ); PtBlock->m_MoveVector = wxPoint( 0, 0 );
/* Effacement ancien cadre */
if( erase ) if( erase )
PtBlock->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color ); 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 ) ...@@ -277,25 +257,23 @@ void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( PtBlock->m_State == STATE_BLOCK_INIT ) if( PtBlock->m_State == STATE_BLOCK_INIT )
{ {
if( PtBlock->GetWidth() || PtBlock->GetHeight() ) 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; PtBlock->m_State = STATE_BLOCK_END;
} }
} }
/******************************************************************/
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
/******************************************************************/
/* /*
* Cancel Current block operation. * Cancel Current block operation.
*/ */
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
BASE_SCREEN* screen = Panel->GetScreen(); 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->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
...@@ -314,4 +292,3 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -314,4 +292,3 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
screen->m_BlockLocate.m_Command = BLOCK_IDLE; screen->m_BlockLocate.m_Command = BLOCK_IDLE;
Panel->m_Parent->DisplayToolMsg( wxEmptyString ); Panel->m_Parent->DisplayToolMsg( wxEmptyString );
} }
...@@ -88,7 +88,6 @@ MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos, ...@@ -88,7 +88,6 @@ MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
} }
/* Effacement memoire de la structure */
MARKER_BASE::~MARKER_BASE() MARKER_BASE::~MARKER_BASE()
{ {
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*************************/ /************************/
/* Menu " CONFIRMATION " */ /* Menu "CONFIRMATION" */
/* fonction Get_Message */ /* Function get_Message */
/* test demande ESC */ /* Test requires ESC */
/*************************/ /************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -11,8 +11,17 @@ enum id_dialog { ...@@ -11,8 +11,17 @@ enum id_dialog {
ID_TIMOUT = 1500 ID_TIMOUT = 1500
}; };
/* Classe d'affichage de messages, identique a wxMessageDialog,
* mais pouvant etre effacee au bout d'un time out donne /* Class for displaying messages, similar to wxMessageDialog,
* but can be erased after a time out expires.
*
* @note - Do not use the time feature. It is broken by design because
* the dialog is shown as modal and wxWidgets will assert when
* compiled in the debug mode. This is because the dialog steals
* the event queue when dialog is modal so the timer event never
* gets to the dialog event handle. Using dialogs to display
* transient is brain dead anyway. Use the message panel or some
* other method.
*/ */
class WinEDA_MessageDialog : public wxMessageDialog class WinEDA_MessageDialog : public wxMessageDialog
{ {
...@@ -34,35 +43,35 @@ BEGIN_EVENT_TABLE( WinEDA_MessageDialog, wxMessageDialog ) ...@@ -34,35 +43,35 @@ BEGIN_EVENT_TABLE( WinEDA_MessageDialog, wxMessageDialog )
EVT_TIMER( ID_TIMOUT, WinEDA_MessageDialog::OnTimeOut ) EVT_TIMER( ID_TIMOUT, WinEDA_MessageDialog::OnTimeOut )
END_EVENT_TABLE() END_EVENT_TABLE()
/**********************************************************************************/
WinEDA_MessageDialog::WinEDA_MessageDialog( wxWindow* parent, const wxString& msg, WinEDA_MessageDialog::WinEDA_MessageDialog( wxWindow* parent,
const wxString& title, int style, int lifetime ) : const wxString& msg,
const wxString& title,
int style,
int lifetime ) :
wxMessageDialog( parent, msg, title, style ) wxMessageDialog( parent, msg, title, style )
/**********************************************************************************/
{ {
m_LifeTime = lifetime; m_LifeTime = lifetime;
m_Timer.SetOwner( this, ID_TIMOUT ); m_Timer.SetOwner( this, ID_TIMOUT );
if( m_LifeTime > 0 ) if( m_LifeTime > 0 )
m_Timer.Start( 100 * m_LifeTime, wxTIMER_ONE_SHOT ); // m_LifeTime = duree en 0.1 secondes m_Timer.Start( 100 * m_LifeTime, wxTIMER_ONE_SHOT );
} }
/********************************************************/
void WinEDA_MessageDialog::OnTimeOut( wxTimerEvent& event ) void WinEDA_MessageDialog::OnTimeOut( wxTimerEvent& event )
/********************************************************/
{ {
m_Timer.Stop(); m_Timer.Stop();
EndModal( wxID_YES ); // Does not work, I do not know why (this function is correctly called after time out) EndModal( wxID_YES ); /* Does not work, I do not know why (this
* function is correctly called after time out).
* See not above as to why this doesn't work. */
} }
/*****************************************************************************/ /* Display an error or warning message.
void DisplayError( wxWindow* parent, const wxString& text, int displaytime ) * If display time > 0 the dialog disappears after displayTime 0.1 seconds
/*****************************************************************************/ *
/* Affiche un Message d'Erreur ou d'avertissement.
* si warn > 0 le dialogue disparait apres displaytime * 0.1 secondes
*/ */
void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
{ {
wxMessageDialog* dialog; wxMessageDialog* dialog;
...@@ -79,13 +88,10 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime ) ...@@ -79,13 +88,10 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
} }
/**************************************************************************/ /* Display an informational message.
void DisplayInfoMessage( wxWindow* parent, const wxString& text, int displaytime )
/**************************************************************************/
/* Affiche un Message d'information.
*/ */
void DisplayInfoMessage( wxWindow* parent, const wxString& text,
int displaytime )
{ {
wxMessageDialog* dialog; wxMessageDialog* dialog;
...@@ -97,9 +103,7 @@ void DisplayInfoMessage( wxWindow* parent, const wxString& text, int displaytime ...@@ -97,9 +103,7 @@ void DisplayInfoMessage( wxWindow* parent, const wxString& text, int displaytime
} }
/**************************************************/
bool IsOK( wxWindow* parent, const wxString& text ) bool IsOK( wxWindow* parent, const wxString& text )
/**************************************************/
{ {
int ii; int ii;
...@@ -111,22 +115,19 @@ bool IsOK( wxWindow* parent, const wxString& text ) ...@@ -111,22 +115,19 @@ bool IsOK( wxWindow* parent, const wxString& text )
} }
/***********************************************************************/ /* Get a text from user
* Title = title to display
* Buffer: enter text by user
* Leading and trailing spaces are removed
* If buffer != "Buffer is displayed
* Return:
* 0 if OK
* 0 if ESCAPE
*/
int Get_Message( const wxString& title, // The question int Get_Message( const wxString& title, // The question
const wxString& frame_caption, // The frame caption const wxString& frame_caption, // The frame caption
wxString& buffer, // String input/return buffer wxString& buffer, // String input/return buffer
wxWindow* frame ) wxWindow* frame )
/***********************************************************************/
/* Get a text from user
* titre = titre a afficher
* buffer : text enter by user
* leading and trailing spaces are removed
* if buffer != "" buffer is displayed
* return:
* 0 if OK
* != 0 if ESCAPE
*/
{ {
wxString message; wxString message;
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: copy_to_clipboard.cpp // Name: copy_to_clipboard.cpp
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Created: 18 aug 2006 // Created: 18 aug 2006
// Licence: License GNU // Licence: License GNU
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "wx/metafile.h" #include "wx/metafile.h"
...@@ -24,12 +23,11 @@ static const bool Print_Sheet_Ref = TRUE; ...@@ -24,12 +23,11 @@ static const bool Print_Sheet_Ref = TRUE;
static bool DrawPage( WinEDA_DrawPanel* panel ); static bool DrawPage( WinEDA_DrawPanel* panel );
/************************************************************/
void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
/************************************************************/
/* calls the function to copy the current page or the current bock to the clipboard /* calls the function to copy the current page or the current bock to
* the clipboard
*/ */
void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
{ {
DrawPage( DrawPanel ); DrawPage( DrawPanel );
...@@ -50,14 +48,11 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event ) ...@@ -50,14 +48,11 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
} }
/*****************************************************************/
bool DrawPage( WinEDA_DrawPanel* panel )
/*****************************************************************/
/* copy the current page or block to the clipboard , /* copy the current page or block to the clipboard ,
* to export drawings to other applications (word processing ...) * to export drawings to other applications (word processing ...)
* Thi is not suitable for copy command within eeschema or pcbnew * This is not suitable for copy command within eeschema or pcbnew
*/ */
bool DrawPage( WinEDA_DrawPanel* panel )
{ {
bool success = TRUE; bool success = TRUE;
...@@ -65,7 +60,7 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -65,7 +60,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
int tmpzoom; int tmpzoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxPoint old_org; wxPoint old_org;
wxPoint DrawOffset; // Offset de trace wxPoint DrawOffset;
int ClipboardSizeX, ClipboardSizeY; int ClipboardSizeX, ClipboardSizeY;
bool DrawBlock = FALSE; bool DrawBlock = FALSE;
wxRect DrawArea; wxRect DrawArea;
...@@ -83,7 +78,7 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -83,7 +78,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
DrawArea.SetHeight( ActiveScreen->m_BlockLocate.GetHeight() ); DrawArea.SetHeight( ActiveScreen->m_BlockLocate.GetHeight() );
} }
/* modification des cadrages et reglages locaux */ /* Change frames and local settings. */
tmp_startvisu = ActiveScreen->m_StartVisu; tmp_startvisu = ActiveScreen->m_StartVisu;
tmpzoom = ActiveScreen->GetZoom(); tmpzoom = ActiveScreen->GetZoom();
old_org = ActiveScreen->m_DrawOrg; old_org = ActiveScreen->m_DrawOrg;
...@@ -102,16 +97,19 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -102,16 +97,19 @@ bool DrawPage( WinEDA_DrawPanel* panel )
ClipboardSizeX = dc.MaxX() + 10; ClipboardSizeX = dc.MaxX() + 10;
ClipboardSizeY = dc.MaxY() + 10; ClipboardSizeY = dc.MaxY() + 10;
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 ); panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); panel->m_ClipBox.SetWidth( 0x7FFFFF0 );
panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
if( DrawBlock ) if( DrawBlock )
{ {
dc.SetClippingRegion( DrawArea ); dc.SetClippingRegion( DrawArea );
} }
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false ); panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close(); wxMetafile* mf = dc.Close();
if( mf ) if( mf )
{ {
success = mf->SetClipboard( ClipboardSizeX, ClipboardSizeY ); success = mf->SetClipboard( ClipboardSizeX, ClipboardSizeY );
......
/********************************/ /****************/
/* MODULE displlst.cpp */ /* displlst.cpp */
/********************************/ /****************/
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h" #include "wxstruct.h"
...@@ -10,14 +10,11 @@ ...@@ -10,14 +10,11 @@
#include "kicad_string.h" #include "kicad_string.h"
/***********************/
/* class WinEDAListBox */
/***********************/
enum listbox { enum listbox {
ID_LISTBOX_LIST = 8000 ID_LISTBOX_LIST = 8000
}; };
BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog ) BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog )
EVT_BUTTON( wxID_OK, WinEDAListBox::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDAListBox::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDAListBox::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDAListBox::OnCancelClick )
...@@ -29,16 +26,11 @@ BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog ) ...@@ -29,16 +26,11 @@ BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog )
END_EVENT_TABLE() END_EVENT_TABLE()
/*******************************/ /* Used to display a list of elements for selection.
/* Constructeur et destructeur */ * ITEMLIST* = pointer to the list of names
/*******************************/ * = Reftext preselection
* = Movefct callback function to display comments
/* Permet l'affichage d'une liste d'elements pour selection.
* itemlist = pointeur sur la liste des pinteurs de noms
* reftext = preselection
* movefct = fonction de cration de commentaires a afficher
*/ */
WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title, WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
const wxChar** itemlist, const wxString& reftext, const wxChar** itemlist, const wxString& reftext,
void(* movefct)(wxString& Text) , void(* movefct)(wxString& Text) ,
...@@ -126,9 +118,7 @@ WinEDAListBox::~WinEDAListBox() ...@@ -126,9 +118,7 @@ WinEDAListBox::~WinEDAListBox()
} }
/******************************************/
void WinEDAListBox::MoveMouseToOrigin() void WinEDAListBox::MoveMouseToOrigin()
/******************************************/
{ {
int x, y, w, h; int x, y, w, h;
wxSize list_size = m_List->GetSize(); wxSize list_size = m_List->GetSize();
...@@ -141,9 +131,7 @@ void WinEDAListBox::MoveMouseToOrigin() ...@@ -141,9 +131,7 @@ void WinEDAListBox::MoveMouseToOrigin()
} }
/*********************************************/
wxString WinEDAListBox::GetTextSelection() wxString WinEDAListBox::GetTextSelection()
/*********************************************/
{ {
wxString text = m_List->GetStringSelection(); wxString text = m_List->GetStringSelection();
...@@ -151,33 +139,25 @@ wxString WinEDAListBox::GetTextSelection() ...@@ -151,33 +139,25 @@ wxString WinEDAListBox::GetTextSelection()
} }
/***************************************************************/
void WinEDAListBox::Append( const wxString& item ) void WinEDAListBox::Append( const wxString& item )
/***************************************************************/
{ {
m_List->Append( item ); m_List->Append( item );
} }
/******************************************************************************/
void WinEDAListBox::InsertItems( const wxArrayString& itemlist, int position ) void WinEDAListBox::InsertItems( const wxArrayString& itemlist, int position )
/******************************************************************************/
{ {
m_List->InsertItems( itemlist, position ); m_List->InsertItems( itemlist, position );
} }
/************************************************/
void WinEDAListBox::OnCancelClick( wxCommandEvent& event ) void WinEDAListBox::OnCancelClick( wxCommandEvent& event )
/************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }
/*****************************************************/
void WinEDAListBox::ClickOnList( wxCommandEvent& event ) void WinEDAListBox::ClickOnList( wxCommandEvent& event )
/*****************************************************/
{ {
wxString text; wxString text;
...@@ -191,9 +171,7 @@ void WinEDAListBox::ClickOnList( wxCommandEvent& event ) ...@@ -191,9 +171,7 @@ void WinEDAListBox::ClickOnList( wxCommandEvent& event )
} }
/*******************************************************/
void WinEDAListBox::D_ClickOnList( wxCommandEvent& event ) void WinEDAListBox::D_ClickOnList( wxCommandEvent& event )
/*******************************************************/
{ {
int ii = m_List->GetSelection(); int ii = m_List->GetSelection();
...@@ -201,9 +179,7 @@ void WinEDAListBox::D_ClickOnList( wxCommandEvent& event ) ...@@ -201,9 +179,7 @@ void WinEDAListBox::D_ClickOnList( wxCommandEvent& event )
} }
/***********************************************/
void WinEDAListBox::OnOkClick( wxCommandEvent& event ) void WinEDAListBox::OnOkClick( wxCommandEvent& event )
/***********************************************/
{ {
int ii = m_List->GetSelection(); int ii = m_List->GetSelection();
...@@ -211,29 +187,21 @@ void WinEDAListBox::OnOkClick( wxCommandEvent& event ) ...@@ -211,29 +187,21 @@ void WinEDAListBox::OnOkClick( wxCommandEvent& event )
} }
/***********************************************/
void WinEDAListBox::OnClose( wxCloseEvent& event ) void WinEDAListBox::OnClose( wxCloseEvent& event )
/***********************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }
/********************************************************************/ /* Sort alphabetically, case insensitive.
static int SortItems( const wxString** ptr1, const wxString** ptr2 )
/********************************************************************/
/* Routines de comparaison pour le tri tri alphabetique,
* avec traitement des nombres en tant que valeur numerique
*/ */
static int SortItems( const wxString** ptr1, const wxString** ptr2 )
{ {
return StrNumICmp( (*ptr1)->GetData(), (*ptr2)->GetData() ); return StrNumICmp( (*ptr1)->GetData(), (*ptr2)->GetData() );
} }
/************************************/
void WinEDAListBox:: SortList() void WinEDAListBox:: SortList()
/************************************/
{ {
int ii, NbItems = m_List->GetCount(); int ii, NbItems = m_List->GetCount();
const wxString** BufList; const wxString** BufList;
...@@ -261,9 +229,7 @@ void WinEDAListBox:: SortList() ...@@ -261,9 +229,7 @@ void WinEDAListBox:: SortList()
} }
/****************************************************/
void WinEDAListBox::OnKeyEvent( wxKeyEvent& event ) void WinEDAListBox::OnKeyEvent( wxKeyEvent& event )
/****************************************************/
{ {
event.Skip(); event.Skip();
} }
This diff is collapsed.
This diff is collapsed.
/////////////////////// ///////////////////////
// Name: eda_dde.cpp // // Name: eda_dde.cpp //
/////////////////////// ///////////////////////
...@@ -13,27 +12,28 @@ ...@@ -13,27 +12,28 @@
wxString HOSTNAME( wxT( "localhost" ) ); wxString HOSTNAME( wxT( "localhost" ) );
/* variables locales */
// buffer for read and write data in socket connections // buffer for read and write data in socket connections
#define IPC_BUF_SIZE 4096 #define IPC_BUF_SIZE 4096
static char client_ipc_buffer[IPC_BUF_SIZE]; static char client_ipc_buffer[IPC_BUF_SIZE];
static wxServer* server; static wxServer* server;
void (*RemoteFct)(const char* cmd); void (*RemoteFct)(const char* cmd);
void SetupServerFunction( void (*remotefct)(const char* remotecmd) ) void SetupServerFunction( void (*remotefct)(const char* remotecmd) )
{ {
RemoteFct = remotefct; RemoteFct = remotefct;
} }
/*****************************/ /**********************************/
/* Routines liees au SERVEUR */ /* Routines related to the server */
/*****************************/ /**********************************/
/* Fonction d'initialisation d'un serveur socket /* Function to initialize a server socket
*/ */
WinEDA_Server* CreateServer( wxWindow* window, int service ) WinEDA_Server* CreateServer( wxWindow* window, int service )
{ {
...@@ -54,12 +54,9 @@ WinEDA_Server* CreateServer( wxWindow* window, int service ) ...@@ -54,12 +54,9 @@ WinEDA_Server* CreateServer( wxWindow* window, int service )
} }
/********************************************************/ /* Function called on every client request.
void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
/********************************************************/
/* Fonction appelee a chaque demande d'un client
*/ */
void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
{ {
size_t len; size_t len;
wxSocketBase* sock = evt.GetSocket(); wxSocketBase* sock = evt.GetSocket();
...@@ -69,8 +66,8 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt ) ...@@ -69,8 +66,8 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
case wxSOCKET_INPUT: case wxSOCKET_INPUT:
sock->Read( client_ipc_buffer, 1 ); sock->Read( client_ipc_buffer, 1 );
if( sock->LastCount() == 0 ) if( sock->LastCount() == 0 )
break; // No data: Occurs on opening connection break; // No data, occurs on opening connection
sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 ); sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
len = 1 + sock->LastCount(); len = 1 + sock->LastCount();
client_ipc_buffer[len] = 0; client_ipc_buffer[len] = 0;
...@@ -89,12 +86,9 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt ) ...@@ -89,12 +86,9 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
} }
/**************************************************************/ /* Function called when a connection is requested by a client.
void WinEDA_DrawFrame::OnSockRequestServer( wxSocketEvent& evt )
/**************************************************************/
/* fonction appele lors d'une demande de connexion d'un client
*/ */
void WinEDA_DrawFrame::OnSockRequestServer( wxSocketEvent& evt )
{ {
wxSocketBase* sock2; wxSocketBase* sock2;
wxSocketServer* server = (wxSocketServer*) evt.GetSocket(); wxSocketServer* server = (wxSocketServer*) evt.GetSocket();
...@@ -109,21 +103,18 @@ void WinEDA_DrawFrame::OnSockRequestServer( wxSocketEvent& evt ) ...@@ -109,21 +103,18 @@ void WinEDA_DrawFrame::OnSockRequestServer( wxSocketEvent& evt )
} }
/****************************/ /**********************************/
/* Routines liees au CLIENT */ /* Routines related to the CLIENT */
/*****************************/ /**********************************/
/**************************************************/
bool SendCommand( int service, const char* cmdline )
/**************************************************/
/* Used by a client to sent (by a socket connection) a data to a server. /* Used by a client to sent (by a socket connection) a data to a server.
* - Open a Socket Client connection * - Open a Socket Client connection
* - Send the buffer cmdline * - Send the buffer cmdline
* - Close the socket connection * - Close the socket connection
* *
* service is the service number for the TC/IP connection * service is the service number for the TC/IP connection
*/ */
bool SendCommand( int service, const char* cmdline )
{ {
wxSocketClient* sock_client; wxSocketClient* sock_client;
bool success = FALSE; bool success = FALSE;
...@@ -133,7 +124,8 @@ bool SendCommand( int service, const char* cmdline ) ...@@ -133,7 +124,8 @@ bool SendCommand( int service, const char* cmdline )
addr.Hostname( HOSTNAME ); addr.Hostname( HOSTNAME );
addr.Service( service ); addr.Service( service );
// Mini-tutorial for Connect() :-) (JP CHARRAS Note: see wxWidgets: sockets/client.cpp sample) // Mini-tutorial for Connect() :-)
// (JP CHARRAS Note: see wxWidgets: sockets/client.cpp sample)
// --------------------------- // ---------------------------
// //
// There are two ways to use Connect(): blocking and non-blocking, // There are two ways to use Connect(): blocking and non-blocking,
...@@ -141,7 +133,7 @@ bool SendCommand( int service, const char* cmdline ) ...@@ -141,7 +133,7 @@ bool SendCommand( int service, const char* cmdline )
// //
// Connect(addr, true) will wait until the connection completes, // Connect(addr, true) will wait until the connection completes,
// returning true on success and false on failure. This call blocks // returning true on success and false on failure. This call blocks
// the GUI (this might be changed in future releases to honour the // the GUI (this might be changed in future releases to honor the
// wxSOCKET_BLOCK flag). // wxSOCKET_BLOCK flag).
// //
// Connect(addr, false) will issue a nonblocking connection request // Connect(addr, false) will issue a nonblocking connection request
...@@ -152,7 +144,7 @@ bool SendCommand( int service, const char* cmdline ) ...@@ -152,7 +144,7 @@ bool SendCommand( int service, const char* cmdline )
// events (please read the documentation). // events (please read the documentation).
// //
// WaitOnConnect() itself never blocks the GUI (this might change // WaitOnConnect() itself never blocks the GUI (this might change
// in the future to honour the wxSOCKET_BLOCK flag). This call will // in the future to honor the wxSOCKET_BLOCK flag). This call will
// return false on timeout, or true if the connection request // return false on timeout, or true if the connection request
// completes, which in turn might mean: // completes, which in turn might mean:
// //
...@@ -181,7 +173,7 @@ bool SendCommand( int service, const char* cmdline ) ...@@ -181,7 +173,7 @@ bool SendCommand( int service, const char* cmdline )
// bool success = client->IsConnected(); // bool success = client->IsConnected();
// //
// And that's all :-) // And that's all :-)
sock_client = new wxSocketClient(); sock_client = new wxSocketClient();
sock_client->SetTimeout( 2 ); // Time out in Seconds sock_client->SetTimeout( 2 ); // Time out in Seconds
sock_client->Connect( addr, FALSE ); sock_client->Connect( addr, FALSE );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/******************************************************************/ /****************/
/* msgpanel.cpp - fonctions des classes du type WinEDA_MsgPanel */ /* msgpanel.cpp */
/******************************************************************/ /****************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -12,16 +12,11 @@ ...@@ -12,16 +12,11 @@
#include "colors.h" #include "colors.h"
/* table des evenements captes par un WinEDA_MsgPanel */
BEGIN_EVENT_TABLE( WinEDA_MsgPanel, wxPanel ) BEGIN_EVENT_TABLE( WinEDA_MsgPanel, wxPanel )
EVT_PAINT( WinEDA_MsgPanel::OnPaint ) EVT_PAINT( WinEDA_MsgPanel::OnPaint )
END_EVENT_TABLE() END_EVENT_TABLE()
/***********************************************************/
/* Fonctions de base de WinEDA_MsgPanel: l'ecran de messages */
/***********************************************************/
WinEDA_MsgPanel::WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id, WinEDA_MsgPanel::WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id,
const wxPoint& pos, const wxSize& size ) : const wxPoint& pos, const wxSize& size ) :
wxPanel( parent, id, pos, size ) wxPanel( parent, id, pos, size )
...@@ -75,9 +70,7 @@ wxSize WinEDA_MsgPanel::computeTextSize( const wxString& text ) ...@@ -75,9 +70,7 @@ wxSize WinEDA_MsgPanel::computeTextSize( const wxString& text )
} }
/*************************************************/
void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event ) void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event )
/*************************************************/
{ {
wxPaintDC dc( this ); wxPaintDC dc( this );
...@@ -128,22 +121,18 @@ void WinEDA_MsgPanel::AppendMessage( const wxString& textUpper, ...@@ -128,22 +121,18 @@ void WinEDA_MsgPanel::AppendMessage( const wxString& textUpper,
Refresh(); Refresh();
} }
/*****************************************************************************/
void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
const wxString& texte_L, int color )
/*****************************************************************************/
/* /*
* Routine d'affichage d'un parametre. * Display a parameter in message panel.
* pos_X = cadrage horizontal * pos_X = horizontal position
* si pos_X < 0 : la position horizontale est la derniere * If pos_X < 0: horizontal position is the last
* valeur demandee >= 0 * Required value >= 0
* texte_H = texte a afficher en ligne superieure. * Texte_H = text to be displayed in top line.
* si "", par d'affichage sur cette ligne * Texte_L = text to be displayed in bottom line.
* texte_L = texte a afficher en ligne inferieure. * Color = color display
* si "", par d'affichage sur cette ligne
* color = couleur d'affichage
*/ */
void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
const wxString& texte_L, int color )
{ {
wxPoint pos; wxPoint pos;
wxSize drawSize = GetClientSize(); wxSize drawSize = GetClientSize();
...@@ -181,12 +170,12 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H, ...@@ -181,12 +170,12 @@ void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
if( m_Items[ndx].m_X > item.m_X ) if( m_Items[ndx].m_X > item.m_X )
{ {
m_Items.insert( m_Items.begin()+ndx, item ); m_Items.insert( m_Items.begin() + ndx, item );
break; break;
} }
} }
if( ndx==limit ) // mutually exclusive with two above if tests if( ndx == limit ) // mutually exclusive with two above if tests
{ {
m_Items.push_back( item ); m_Items.push_back( item );
} }
...@@ -219,18 +208,14 @@ void WinEDA_MsgPanel::showItem( wxDC& dc, const MsgItem& aItem ) ...@@ -219,18 +208,14 @@ void WinEDA_MsgPanel::showItem( wxDC& dc, const MsgItem& aItem )
} }
/****************************************/
void WinEDA_MsgPanel::EraseMsgBox() void WinEDA_MsgPanel::EraseMsgBox()
/****************************************/
{ {
m_Items.clear(); m_Items.clear();
m_last_x = 0; m_last_x = 0;
Refresh(); Refresh();
} }
/*******************************************/
void WinEDA_MsgPanel::erase( wxDC* DC ) void WinEDA_MsgPanel::erase( wxDC* DC )
/*******************************************/
{ {
wxPen pen; wxPen pen;
wxBrush brush; wxBrush brush;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/******************************************************************/ /****************/
/* toolbars.cpp - fonctions des classes du type WinEDA_ttolbar */ /* toolbars.cpp */
/******************************************************************/ /****************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -9,15 +9,14 @@ ...@@ -9,15 +9,14 @@
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h" #include "wxstruct.h"
/*************************/
/* class WinEDA_HToolbar */
/*************************/
WinEDA_Toolbar::WinEDA_Toolbar( id_toolbar type, wxWindow * parent, WinEDA_Toolbar::WinEDA_Toolbar( id_toolbar type, wxWindow * parent,
wxWindowID id, bool horizontal ): wxWindowID id, bool horizontal ):
#if defined(KICAD_AUITOOLBAR) #if defined(KICAD_AUITOOLBAR)
wxAuiToolBar( parent, id, wxDefaultPosition, wxDefaultSize, wxAuiToolBar( parent, id, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | (horizontal ? wxAUI_TB_HORZ_LAYOUT : wxAUI_TB_VERTICAL)) wxAUI_TB_DEFAULT_STYLE | ( ( horizontal ) ?
wxAUI_TB_HORZ_LAYOUT :
wxAUI_TB_VERTICAL ) )
#else #else
wxToolBar( parent, id, wxPoint( -1,-1 ), wxSize( -1,-1 ), wxToolBar( parent, id, wxPoint( -1,-1 ), wxSize( -1,-1 ),
horizontal ? wxTB_HORIZONTAL : wxTB_VERTICAL ) horizontal ? wxTB_HORIZONTAL : wxTB_VERTICAL )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment