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__
#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
......@@ -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;
}
......
......@@ -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) )
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 );
}
......@@ -273,7 +256,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
GetAssociatedDocument( this, helpFile );
#else
# error Help files format not defined
# error Help files format not defined
#endif
}
......@@ -281,9 +264,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/*
*
*/
/***********************************************************************/
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
/***********************************************************************/
{
wxAboutDialogInfo info;
InitKiCadAbout(info);
......
/****************************************************/
/* 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;
......@@ -204,7 +186,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
case BLOCK_DELETE: /* Delete */
case BLOCK_SAVE: /* Save */
case BLOCK_ROTATE: /* Rotate 90 deg */
case BLOCK_FLIP: /* Flip */
case BLOCK_FLIP: /* Flip */
case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */
......@@ -228,7 +210,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
{
Block->m_ItemsSelection.ClearItemsList();
DisplayError( this,
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
return TRUE;
}
Block->m_State = STATE_BLOCK_MOVE;
......@@ -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 );
}
......@@ -88,7 +88,6 @@ MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
}
/* Effacement memoire de la structure */
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 " */
/* fonction Get_Message */
/* test demande ESC */
/*************************/
/************************/
/* Menu "CONFIRMATION" */
/* Function get_Message */
/* Test requires ESC */
/************************/
#include "fctsys.h"
#include "common.h"
......@@ -11,8 +11,17 @@ enum id_dialog {
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
{
......@@ -34,35 +43,35 @@ BEGIN_EVENT_TABLE( WinEDA_MessageDialog, wxMessageDialog )
EVT_TIMER( ID_TIMOUT, WinEDA_MessageDialog::OnTimeOut )
END_EVENT_TABLE()
/**********************************************************************************/
WinEDA_MessageDialog::WinEDA_MessageDialog( wxWindow* parent, const wxString& msg,
const wxString& title, int style, int lifetime ) :
WinEDA_MessageDialog::WinEDA_MessageDialog( wxWindow* parent,
const wxString& msg,
const wxString& title,
int style,
int lifetime ) :
wxMessageDialog( parent, msg, title, style )
/**********************************************************************************/
{
m_LifeTime = lifetime;
m_Timer.SetOwner( this, ID_TIMOUT );
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 )
/********************************************************/
{
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. */
}
/*****************************************************************************/
void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
/*****************************************************************************/
/* Affiche un Message d'Erreur ou d'avertissement.
* si warn > 0 le dialogue disparait apres displaytime * 0.1 secondes
/* Display an error or warning message.
* If display time > 0 the dialog disappears after displayTime 0.1 seconds
*
*/
void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
{
wxMessageDialog* dialog;
......@@ -79,13 +88,10 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
}
/**************************************************************************/
void DisplayInfoMessage( wxWindow* parent, const wxString& text, int displaytime )
/**************************************************************************/
/* Affiche un Message d'information.
/* Display an informational message.
*/
void DisplayInfoMessage( wxWindow* parent, const wxString& text,
int displaytime )
{
wxMessageDialog* dialog;
......@@ -97,9 +103,7 @@ void DisplayInfoMessage( wxWindow* parent, const wxString& text, int displaytime
}
/**************************************************/
bool IsOK( wxWindow* parent, const wxString& text )
/**************************************************/
{
int ii;
......@@ -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
const wxString& frame_caption, // The frame caption
wxString& buffer, // String input/return buffer
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;
......
/////////////////////////////////////////////////////////////////////////////
// Name: copy_to_clipboard.cpp
// Author: jean-pierre Charras
// Created: 18 aug 2006
// Licence: License GNU
// Licence: License GNU
/////////////////////////////////////////////////////////////////////////////
#include "wx/metafile.h"
......@@ -24,12 +23,11 @@ static const bool Print_Sheet_Ref = TRUE;
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 );
......@@ -50,14 +48,11 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
}
/*****************************************************************/
bool DrawPage( WinEDA_DrawPanel* panel )
/*****************************************************************/
/* copy the current page or block to the clipboard ,
* 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;
......@@ -65,7 +60,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
int tmpzoom;
wxPoint tmp_startvisu;
wxPoint old_org;
wxPoint DrawOffset; // Offset de trace
wxPoint DrawOffset;
int ClipboardSizeX, ClipboardSizeY;
bool DrawBlock = FALSE;
wxRect DrawArea;
......@@ -83,7 +78,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
DrawArea.SetHeight( ActiveScreen->m_BlockLocate.GetHeight() );
}
/* modification des cadrages et reglages locaux */
/* Change frames and local settings. */
tmp_startvisu = ActiveScreen->m_StartVisu;
tmpzoom = ActiveScreen->GetZoom();
old_org = ActiveScreen->m_DrawOrg;
......@@ -102,16 +97,19 @@ bool DrawPage( WinEDA_DrawPanel* panel )
ClipboardSizeX = dc.MaxX() + 10;
ClipboardSizeY = dc.MaxY() + 10;
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 )
{
dc.SetClippingRegion( DrawArea );
}
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close();
if( mf )
{
success = mf->SetClipboard( ClipboardSizeX, ClipboardSizeY );
......
/********************************/
/* MODULE displlst.cpp */
/********************************/
/****************/
/* displlst.cpp */
/****************/
#include "fctsys.h"
#include "wxstruct.h"
......@@ -10,14 +10,11 @@
#include "kicad_string.h"
/***********************/
/* class WinEDAListBox */
/***********************/
enum listbox {
ID_LISTBOX_LIST = 8000
};
BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog )
EVT_BUTTON( wxID_OK, WinEDAListBox::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDAListBox::OnCancelClick )
......@@ -29,16 +26,11 @@ BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog )
END_EVENT_TABLE()
/*******************************/
/* Constructeur et destructeur */
/*******************************/
/* 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
/* Used to display a list of elements for selection.
* ITEMLIST* = pointer to the list of names
* = Reftext preselection
* = Movefct callback function to display comments
*/
WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
const wxChar** itemlist, const wxString& reftext,
void(* movefct)(wxString& Text) ,
......@@ -126,9 +118,7 @@ WinEDAListBox::~WinEDAListBox()
}
/******************************************/
void WinEDAListBox::MoveMouseToOrigin()
/******************************************/
{
int x, y, w, h;
wxSize list_size = m_List->GetSize();
......@@ -141,9 +131,7 @@ void WinEDAListBox::MoveMouseToOrigin()
}
/*********************************************/
wxString WinEDAListBox::GetTextSelection()
/*********************************************/
{
wxString text = m_List->GetStringSelection();
......@@ -151,33 +139,25 @@ wxString WinEDAListBox::GetTextSelection()
}
/***************************************************************/
void WinEDAListBox::Append( const wxString& item )
/***************************************************************/
{
m_List->Append( item );
}
/******************************************************************************/
void WinEDAListBox::InsertItems( const wxArrayString& itemlist, int position )
/******************************************************************************/
{
m_List->InsertItems( itemlist, position );
}
/************************************************/
void WinEDAListBox::OnCancelClick( wxCommandEvent& event )
/************************************************/
{
EndModal( -1 );
}
/*****************************************************/
void WinEDAListBox::ClickOnList( wxCommandEvent& event )
/*****************************************************/
{
wxString text;
......@@ -191,9 +171,7 @@ void WinEDAListBox::ClickOnList( wxCommandEvent& event )
}
/*******************************************************/
void WinEDAListBox::D_ClickOnList( wxCommandEvent& event )
/*******************************************************/
{
int ii = m_List->GetSelection();
......@@ -201,9 +179,7 @@ void WinEDAListBox::D_ClickOnList( wxCommandEvent& event )
}
/***********************************************/
void WinEDAListBox::OnOkClick( wxCommandEvent& event )
/***********************************************/
{
int ii = m_List->GetSelection();
......@@ -211,29 +187,21 @@ void WinEDAListBox::OnOkClick( wxCommandEvent& event )
}
/***********************************************/
void WinEDAListBox::OnClose( wxCloseEvent& event )
/***********************************************/
{
EndModal( -1 );
}
/********************************************************************/
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
/* Sort alphabetically, case insensitive.
*/
static int SortItems( const wxString** ptr1, const wxString** ptr2 )
{
return StrNumICmp( (*ptr1)->GetData(), (*ptr2)->GetData() );
}
/************************************/
void WinEDAListBox:: SortList()
/************************************/
{
int ii, NbItems = m_List->GetCount();
const wxString** BufList;
......@@ -261,9 +229,7 @@ void WinEDAListBox:: SortList()
}
/****************************************************/
void WinEDAListBox::OnKeyEvent( wxKeyEvent& event )
/****************************************************/
{
event.Skip();
}
This diff is collapsed.
This diff is collapsed.
///////////////////////
// Name: eda_dde.cpp //
///////////////////////
......@@ -13,27 +12,28 @@
wxString HOSTNAME( wxT( "localhost" ) );
/* variables locales */
// buffer for read and write data in socket connections
#define IPC_BUF_SIZE 4096
static char client_ipc_buffer[IPC_BUF_SIZE];
static wxServer* server;
void (*RemoteFct)(const char* cmd);
void SetupServerFunction( void (*remotefct)(const char* remotecmd) )
{
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 )
{
......@@ -54,12 +54,9 @@ WinEDA_Server* CreateServer( wxWindow* window, int service )
}
/********************************************************/
void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
/********************************************************/
/* Fonction appelee a chaque demande d'un client
/* Function called on every client request.
*/
void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
{
size_t len;
wxSocketBase* sock = evt.GetSocket();
......@@ -69,8 +66,8 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
case wxSOCKET_INPUT:
sock->Read( client_ipc_buffer, 1 );
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 );
len = 1 + sock->LastCount();
client_ipc_buffer[len] = 0;
......@@ -89,12 +86,9 @@ void WinEDA_DrawFrame::OnSockRequest( wxSocketEvent& evt )
}
/**************************************************************/
void WinEDA_DrawFrame::OnSockRequestServer( wxSocketEvent& evt )
/**************************************************************/
/* fonction appele lors d'une demande de connexion d'un client
/* Function called when a connection is requested by a client.
*/
void WinEDA_DrawFrame::OnSockRequestServer( wxSocketEvent& evt )
{
wxSocketBase* sock2;
wxSocketServer* server = (wxSocketServer*) evt.GetSocket();
......@@ -109,21 +103,18 @@ void WinEDA_DrawFrame::OnSockRequestServer( wxSocketEvent& evt )
}
/****************************/
/* Routines liees au CLIENT */
/*****************************/
/**************************************************/
bool SendCommand( int service, const char* cmdline )
/**************************************************/
/**********************************/
/* Routines related to the CLIENT */
/**********************************/
/* Used by a client to sent (by a socket connection) a data to a server.
* - Open a Socket Client connection
* - Send the buffer cmdline
* - Close the socket connection
*
*
* service is the service number for the TC/IP connection
*/
bool SendCommand( int service, const char* cmdline )
{
wxSocketClient* sock_client;
bool success = FALSE;
......@@ -133,7 +124,8 @@ bool SendCommand( int service, const char* cmdline )
addr.Hostname( HOSTNAME );
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,
......@@ -141,7 +133,7 @@ bool SendCommand( int service, const char* cmdline )
//
// Connect(addr, true) will wait until the connection completes,
// 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).
//
// Connect(addr, false) will issue a nonblocking connection request
......@@ -152,7 +144,7 @@ bool SendCommand( int service, const char* cmdline )
// events (please read the documentation).
//
// 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
// completes, which in turn might mean:
//
......@@ -181,7 +173,7 @@ bool SendCommand( int service, const char* cmdline )
// bool success = client->IsConnected();
//
// And that's all :-)
sock_client = new wxSocketClient();
sock_client->SetTimeout( 2 ); // Time out in Seconds
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__
#pragma implementation
......@@ -12,16 +12,11 @@
#include "colors.h"
/* table des evenements captes par un WinEDA_MsgPanel */
BEGIN_EVENT_TABLE( WinEDA_MsgPanel, wxPanel )
EVT_PAINT( WinEDA_MsgPanel::OnPaint )
END_EVENT_TABLE()
/***********************************************************/
/* Fonctions de base de WinEDA_MsgPanel: l'ecran de messages */
/***********************************************************/
WinEDA_MsgPanel::WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id,
const wxPoint& pos, const wxSize& size ) :
wxPanel( parent, id, pos, size )
......@@ -75,9 +70,7 @@ wxSize WinEDA_MsgPanel::computeTextSize( const wxString& text )
}
/*************************************************/
void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event )
/*************************************************/
{
wxPaintDC dc( this );
......@@ -128,22 +121,18 @@ void WinEDA_MsgPanel::AppendMessage( const wxString& textUpper,
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.
* pos_X = cadrage horizontal
* si pos_X < 0 : la position horizontale est la derniere
* valeur demandee >= 0
* texte_H = texte a afficher en ligne superieure.
* si "", par d'affichage sur cette ligne
* texte_L = texte a afficher en ligne inferieure.
* si "", par d'affichage sur cette ligne
* color = couleur d'affichage
* Display a parameter in message panel.
* pos_X = horizontal position
* If pos_X < 0: horizontal position is the last
* Required value >= 0
* Texte_H = text to be displayed in top line.
* Texte_L = text to be displayed in bottom line.
* Color = color display
*/
void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
const wxString& texte_L, int color )
{
wxPoint pos;
wxSize drawSize = GetClientSize();
......@@ -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 )
{
m_Items.insert( m_Items.begin()+ndx, item );
m_Items.insert( m_Items.begin() + ndx, item );
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 );
}
......@@ -219,18 +208,14 @@ void WinEDA_MsgPanel::showItem( wxDC& dc, const MsgItem& aItem )
}
/****************************************/
void WinEDA_MsgPanel::EraseMsgBox()
/****************************************/
{
m_Items.clear();
m_last_x = 0;
Refresh();
}
/*******************************************/
void WinEDA_MsgPanel::erase( wxDC* DC )
/*******************************************/
{
wxPen pen;
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__
#pragma implementation
......@@ -9,15 +9,14 @@
#include "fctsys.h"
#include "wxstruct.h"
/*************************/
/* class WinEDA_HToolbar */
/*************************/
WinEDA_Toolbar::WinEDA_Toolbar( id_toolbar type, wxWindow * parent,
wxWindowID id, bool horizontal ):
#if defined(KICAD_AUITOOLBAR)
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
wxToolBar( parent, id, wxPoint( -1,-1 ), wxSize( -1,-1 ),
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