some enhancements.

This commit is contained in:
charras 2008-04-18 13:28:56 +00:00
parent 5cd2fad850
commit 1547987157
19 changed files with 503 additions and 508 deletions

BIN
GUI_Translation_HOWTO.odt Normal file

Binary file not shown.

BIN
GUI_Translation_HOWTO.pdf Normal file

Binary file not shown.

View File

@ -54,6 +54,112 @@
#define FONT_DEFAULT_SIZE 10 /* Default font size.
* The real font size will be computed at run time */
/* A small class to handle the list od existing translations.
* the locale translation is automatic.
* the selection of languages is mainly for mainteners's convenience (tests...)
* To add a support to a new tranlation:
* create a new icon (flag of the country) (see Lang_Fr.xpm as an exemple)
* add a new item to s_Language_List[LANGUAGE_DESCR_COUNT]
* and set LANGUAGE_DESCR_COUNT to the new value
*/
struct LANGUAGE_DESCR
{
int m_WX_Lang_Identifier; // wxWidget locale identifier (see wxWidget doc)
int m_KI_Lang_Identifier; // kicad identifier used in menu selection (see id.h)
const char** m_Lang_Icon; // the icon used in menus
const wxChar* m_Lang_Label; // Label used in menus
bool m_DoNotTranslate; // set to true if the m_Lang_Label must not be translated
};
#define LANGUAGE_DESCR_COUNT 14
static struct LANGUAGE_DESCR s_Language_List[LANGUAGE_DESCR_COUNT] =
{
{
wxLANGUAGE_DEFAULT,
ID_LANGUAGE_DEFAULT,
lang_def_xpm,
_( "Default" )
},
{
wxLANGUAGE_ENGLISH,
ID_LANGUAGE_ENGLISH,
lang_en_xpm,
wxT( "English" ),
true
},
{
wxLANGUAGE_FRENCH,
ID_LANGUAGE_FRENCH,
lang_fr_xpm,
_( "French" )
},
{
wxLANGUAGE_SPANISH,
ID_LANGUAGE_SPANISH,
lang_es_xpm,
_( "Spanish" )
},
{
wxLANGUAGE_PORTUGUESE,
ID_LANGUAGE_PORTUGUESE,
lang_pt_xpm,
_( "Portuguese" )
},
{
wxLANGUAGE_ITALIAN,
ID_LANGUAGE_ITALIAN,
lang_it_xpm,
_( "Italian" )
},
{
wxLANGUAGE_GERMAN,
ID_LANGUAGE_GERMAN,
lang_de_xpm,
_( "German" )
},
{
wxLANGUAGE_SLOVENIAN,
ID_LANGUAGE_SLOVENIAN,
lang_sl_xpm,
_( "Slovenian" )
},
{
wxLANGUAGE_HUNGARIAN,
ID_LANGUAGE_HUNGARIAN,
lang_hu_xpm,
_( "Hungarian" )
},
{
wxLANGUAGE_POLISH,
ID_LANGUAGE_POLISH,
lang_po_xpm,
_( "Polish" )
},
{
wxLANGUAGE_RUSSIAN,
ID_LANGUAGE_RUSSIAN,
lang_ru_xpm,
_( "Russian" )
},
{
wxLANGUAGE_KOREAN,
ID_LANGUAGE_KOREAN,
lang_ko_xpm,
_( "Korean" )
},
{
wxLANGUAGE_CHINESE_SIMPLIFIED,
ID_LANGUAGE_CHINESE_SIMPLIFIED,
lang_chinese_xpm,
_( "Chinese simplified" )
},
{
wxLANGUAGE_CATALAN,
ID_LANGUAGE_CATALAN,
lang_catalan_xpm,
_( "Catalan" )
}
};
/**************************/
/* WinEDA_App Constructor */
@ -202,17 +308,21 @@ void WinEDA_App::InitOnLineHelp()
/*******************************/
bool WinEDA_App::SetBinDir()
/*******************************/
// Find the path to the executable and store it in WinEDA_App::m_BinDir
{
#ifdef __APPLE__
// Derive path from location of the app bundle
CFBundleRef mainBundle = CFBundleGetMainBundle();
if (mainBundle == NULL) return false;
if( mainBundle == NULL )
return false;
CFURLRef urlref = CFBundleCopyBundleURL( mainBundle );
if (urlref == NULL) return false;
if( urlref == NULL )
return false;
CFStringRef str = CFURLCopyFileSystemPath( urlref, kCFURLPOSIXPathStyle );
if (str == NULL) return false;
if( str == NULL )
return false;
char* native_str = NULL;
int len = CFStringGetMaximumSizeForEncoding( CFStringGetLength( str ),
kCFStringEncodingUTF8 ) + 1;
@ -428,69 +538,21 @@ bool WinEDA_App::SetLanguage( bool first_time )
void WinEDA_App::SetLanguageIdentifier( int menu_id )
/**************************************************/
/* return in m_LanguageId the language id (wxWidgets language identifier)
* from menu id (internal menu identifier)
/* return in m_LanguageId the wxWidgets language identifier Id
* from the kicad menu id (internal menu identifier)
*/
{
switch( menu_id )
unsigned int ii;
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
case ID_LANGUAGE_ITALIAN:
m_LanguageId = wxLANGUAGE_ITALIAN;
break;
case ID_LANGUAGE_PORTUGUESE:
m_LanguageId = wxLANGUAGE_PORTUGUESE;
break;
case ID_LANGUAGE_RUSSIAN:
m_LanguageId = wxLANGUAGE_RUSSIAN;
break;
case ID_LANGUAGE_GERMAN:
m_LanguageId = wxLANGUAGE_GERMAN;
break;
case ID_LANGUAGE_SPANISH:
m_LanguageId = wxLANGUAGE_SPANISH;
break;
case ID_LANGUAGE_ENGLISH:
m_LanguageId = wxLANGUAGE_ENGLISH;
break;
case ID_LANGUAGE_FRENCH:
m_LanguageId = wxLANGUAGE_FRENCH;
break;
case ID_LANGUAGE_SLOVENIAN:
m_LanguageId = wxLANGUAGE_SLOVENIAN;
break;
case ID_LANGUAGE_HUNGARIAN:
m_LanguageId = wxLANGUAGE_HUNGARIAN;
break;
case ID_LANGUAGE_POLISH:
m_LanguageId = wxLANGUAGE_POLISH;
break;
case ID_LANGUAGE_KOREAN:
m_LanguageId = wxLANGUAGE_KOREAN;
break;
case ID_LANGUAGE_CATALAN:
m_LanguageId = wxLANGUAGE_CATALAN;
break;
case ID_LANGUAGE_CHINESE_SIMPLIFIED:
m_LanguageId = wxLANGUAGE_CHINESE_SIMPLIFIED;
break;
default:
m_LanguageId = wxLANGUAGE_DEFAULT;
if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier )
{
m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier;
break;
}
}
}
/*********************************************************/
@ -501,154 +563,29 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
*/
{
wxMenuItem* item;
unsigned int ii;
if( m_Language_Menu == NULL )
{
m_Language_Menu = new wxMenu;
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_DEFAULT,
_( "Default" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_def_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_ENGLISH,
wxT( "English" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_en_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_FRENCH,
_( "French" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_fr_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_SPANISH,
_( "Spanish" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_es_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_PORTUGUESE,
_( "Portuguese" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_pt_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_ITALIAN,
_( "Italian" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_it_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_GERMAN,
_( "German" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_de_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_SLOVENIAN,
_( "Slovenian" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_sl_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_HUNGARIAN,
_( "Hungarian" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_hu_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_POLISH,
_( "Polish" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_po_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_RUSSIAN,
_( "Russian" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_ru_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_KOREAN,
_( "Korean" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_ko_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_CATALAN,
_( "Catalan" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_catalan_xpm );
m_Language_Menu->Append( item );
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_CHINESE_SIMPLIFIED,
_( "Chinese simplified" ), wxEmptyString, wxITEM_CHECK );
SETBITMAPS( lang_chinese_xpm );
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
wxString MenuLabel = s_Language_List[ii].m_DoNotTranslate ?
s_Language_List[ii].m_Lang_Label :
wxGetTranslation( s_Language_List[ii].m_Lang_Label );
item = new wxMenuItem( m_Language_Menu, s_Language_List[ii].m_KI_Lang_Identifier,
MenuLabel, wxEmptyString, wxITEM_CHECK );
SETBITMAPS( s_Language_List[ii].m_Lang_Icon );
m_Language_Menu->Append( item );
}
}
m_Language_Menu->Check( ID_LANGUAGE_CATALAN, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_CHINESE_SIMPLIFIED, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_KOREAN, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_RUSSIAN, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_POLISH, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_HUNGARIAN, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_SLOVENIAN, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_ITALIAN, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_PORTUGUESE, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_GERMAN, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_SPANISH, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_FRENCH, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_ENGLISH, FALSE );
m_Language_Menu->Check( ID_LANGUAGE_DEFAULT, FALSE );
switch( m_LanguageId )
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
case wxLANGUAGE_CATALAN:
m_Language_Menu->Check( ID_LANGUAGE_CATALAN, TRUE );
break;
case wxLANGUAGE_CHINESE_SIMPLIFIED:
m_Language_Menu->Check( ID_LANGUAGE_CHINESE_SIMPLIFIED, TRUE );
break;
case wxLANGUAGE_KOREAN:
m_Language_Menu->Check( ID_LANGUAGE_KOREAN, TRUE );
break;
case wxLANGUAGE_RUSSIAN:
m_Language_Menu->Check( ID_LANGUAGE_RUSSIAN, TRUE );
break;
case wxLANGUAGE_GERMAN:
m_Language_Menu->Check( ID_LANGUAGE_GERMAN, TRUE );
break;
case wxLANGUAGE_FRENCH:
m_Language_Menu->Check( ID_LANGUAGE_FRENCH, TRUE );
break;
case wxLANGUAGE_ENGLISH:
m_Language_Menu->Check( ID_LANGUAGE_ENGLISH, TRUE );
break;
case wxLANGUAGE_SPANISH:
m_Language_Menu->Check( ID_LANGUAGE_SPANISH, TRUE );
break;
case wxLANGUAGE_PORTUGUESE:
m_Language_Menu->Check( ID_LANGUAGE_PORTUGUESE, TRUE );
break;
case wxLANGUAGE_ITALIAN:
m_Language_Menu->Check( ID_LANGUAGE_ITALIAN, TRUE );
break;
case wxLANGUAGE_SLOVENIAN:
m_Language_Menu->Check( ID_LANGUAGE_SLOVENIAN, TRUE );
break;
case wxLANGUAGE_HUNGARIAN:
m_Language_Menu->Check( ID_LANGUAGE_HUNGARIAN, TRUE );
break;
case wxLANGUAGE_POLISH:
m_Language_Menu->Check( ID_LANGUAGE_POLISH, TRUE );
break;
default:
m_Language_Menu->Check( ID_LANGUAGE_DEFAULT, TRUE );
break;
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, true );
else
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, false );
}
if( MasterMenu )
@ -665,6 +602,7 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
/**********************/
int WinEDA_App::OnRun()
/**********************/
/* Run init scripts
*/
{

View File

@ -214,14 +214,14 @@ public:
wxDC* DC, const wxPoint& pos );
// Pads sur modules
void AddPad( MODULE* Module, wxDC* DC );
void AddPad( MODULE* Module, bool draw );
void DeletePad( D_PAD* Pad, wxDC* DC );
void StartMovePad( D_PAD* Pad, wxDC* DC );
void RotatePad( D_PAD* Pad, wxDC* DC );
void PlacePad( D_PAD* Pad, wxDC* DC );
void Export_Pad_Settings( D_PAD* pt_pad );
void Import_Pad_Settings( D_PAD* pt_pad, wxDC* DC );
void Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC );
void Export_Pad_Settings( D_PAD* aPad );
void Import_Pad_Settings( D_PAD* aPad, bool aDraw );
void Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw );
// loading footprints

View File

@ -82,6 +82,23 @@ void D_PAD::ComputeRayon()
}
/**
* Function GetBoundingBox
* returns the bounding box of this pad
* Mainly used to redraw the screen area occuped by the pad
*/
EDA_Rect D_PAD::GetBoundingBox()
{
// Calculate area:
ComputeRayon(); // calculate the radius of the area, considered as a circle
EDA_Rect area;
area.SetOrigin(m_Pos);
area.Inflate(m_Rayon, m_Rayon);
return area;
}
/*********************************************/
const wxPoint D_PAD::ReturnShapePos()
/*********************************************/
@ -240,6 +257,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
int fillpad = 0;
wxPoint shape_pos;
if ( m_Flags & DO_NOT_DRAW )
return;
wxASSERT( panel );
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;

View File

@ -172,6 +172,13 @@ public:
}
/**
* Function GetBoundingBox
* returns the bounding box of this Footprint
* Mainly used to redraw the screen area occuped by the footprint
*/
EDA_Rect GetBoundingBox();
/**
* Function Compare
* compares two pads and return 0 if they are equal.

View File

@ -30,6 +30,7 @@ PCB_SCREEN::PCB_SCREEN( int idscreen ) : BASE_SCREEN( TYPESCREEN )
m_Type = idscreen;
SetGridList( g_GridList );
SetZoomList( zoom_list );
m_Grid = wxSize( 500, 500 ); /* pas de la grille en 1/10000 "*/
Init();
}
@ -50,7 +51,6 @@ void PCB_SCREEN::Init()
m_Route_Layer_TOP = CMP_N; /* ref couches par defaut pour vias (Cu.. Cmp) */
m_Route_Layer_BOTTOM = COPPER_LAYER_N;
m_Zoom = 128; /* valeur */
m_Grid = wxSize( 500, 500 ); /* pas de la grille en 1/10000 "*/
}

View File

@ -663,12 +663,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema();
Import_Pad_Settings( (D_PAD*) GetCurItem(), &dc );
Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
break;
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema();
Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), &dc );
Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
break;
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:

View File

@ -442,8 +442,12 @@ void WinEDA_PadPropertiesFrame::PadPropertiesAccept( wxCommandEvent& event )
Module = (MODULE*) CurrentPad->m_Parent;
Module->m_LastEdit_Time = time( NULL );
if( m_DC )
CurrentPad->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
if( m_DC )// redraw the area where the pas was, without pad
{
CurrentPad->m_Flags |= DO_NOT_DRAW;
m_Parent->DrawPanel->PostDirtyRect( CurrentPad->GetBoundingBox() );
CurrentPad->m_Flags &= ~DO_NOT_DRAW;
}
CurrentPad->m_PadShape = g_Pad_Master.m_PadShape;
CurrentPad->m_Attribut = g_Pad_Master.m_Attribut;
if (CurrentPad->m_Pos != g_Pad_Master.m_Pos )
@ -529,8 +533,8 @@ void WinEDA_PadPropertiesFrame::PadPropertiesAccept( wxCommandEvent& event )
Module->Set_Rectangle_Encadrement();
CurrentPad->Display_Infos( m_Parent );
if( m_DC )
CurrentPad->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
if( m_DC )// redraw the area where the pas was
m_Parent->DrawPanel->PostDirtyRect( CurrentPad->GetBoundingBox() );
m_Parent->GetScreen()->SetModify();
}

View File

@ -98,7 +98,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
Clear_Pcb(TRUE );
wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) );
LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
FALSE );
false );
ReCreateAuxiliaryToolbar();
break;
@ -211,7 +211,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
// Reload the corresponding configuration file:
wxSetWorkingDirectory( wxPathOnly( GetScreen()->m_FileName ) );
if( Append )
ReadPcbFile( source, TRUE );
ReadPcbFile( source, true );
else
{
Read_Config( GetScreen()->m_FileName );
@ -222,7 +222,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
ReadPcbFile( source, FALSE );
ReadPcbFile( source, false );
}
fclose( source );

View File

@ -38,7 +38,6 @@ class WinEDA_PadGlobalEditFrame : public wxDialog
private:
WinEDA_BasePcbFrame* m_Parent;
wxDC* m_DC;
D_PAD* CurrentPad;
wxCheckBox* m_Pad_Shape_Filter;
wxCheckBox* m_Pad_Layer_Filter;
@ -51,8 +50,7 @@ private:
public:
// Constructor and destructor
WinEDA_PadGlobalEditFrame( WinEDA_BasePcbFrame * parent,
D_PAD * Pad, wxDC * DC, const wxPoint &pos );
WinEDA_PadGlobalEditFrame( WinEDA_BasePcbFrame * parent, D_PAD * Pad );
~WinEDA_PadGlobalEditFrame() { }
private:
@ -72,10 +70,8 @@ END_EVENT_TABLE()
/********************************************************************************/
WinEDA_PadGlobalEditFrame::WinEDA_PadGlobalEditFrame( WinEDA_BasePcbFrame* parent,
D_PAD* Pad,
wxDC* DC,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Pads Global Edit" ), framepos, wxSize( 310, 235 ),
D_PAD* Pad ) :
wxDialog( parent, -1, _( "Pads Global Edit" ), wxDefaultPosition, wxSize( 310, 235 ),
DIALOG_STYLE )
/********************************************************************************/
{
@ -84,7 +80,6 @@ WinEDA_PadGlobalEditFrame::WinEDA_PadGlobalEditFrame( WinEDA_BasePcbFrame* paren
m_Parent = parent;
SetFont( *g_DialogFont );
m_DC = DC;
Centre();
CurrentPad = Pad;
@ -206,26 +201,24 @@ void WinEDA_PadGlobalEditFrame::PadPropertiesAccept( wxCommandEvent& event )
/***************************************************************************/
void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC )
void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
/***************************************************************************/
/*
* Routine de selection et de correction des dimensions des pastilles
* de tous les modules
* - semblables a l'module de reference selectionnee,
* c.a.d de meme nom de librairie
* - ou sur l'module localisee, selon le menu d'appel
/** Function Global_Import_Pad_Settings
* Function to change pad caracteristics for the given footprint
* or alls footprints which look like the given footprint
* @param aPad pad to use as pattern. The given footprint is the parent of this pad
* @param aDraw: if true: redraws the footprint
*/
{
D_PAD* pt_pad;
MODULE* Module_Ref, * Module;
int diag;
bool Edit_Same_Modules = FALSE;
if( Pad == NULL )
if( aPad == NULL )
return;
Module = (MODULE*) Pad->m_Parent;
Module = (MODULE*) aPad->m_Parent;
if( Module == NULL )
{
@ -237,8 +230,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC )
Module->Display_Infos( this );
WinEDA_PadGlobalEditFrame* frame = new WinEDA_PadGlobalEditFrame( this, Pad, DC,
wxPoint( -1, -1 ) );
WinEDA_PadGlobalEditFrame* frame = new WinEDA_PadGlobalEditFrame( this, aPad );
diag = frame->ShowModal();
frame->Destroy();
@ -266,9 +258,14 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC )
Module->Display_Infos( this );
/* Effacement du module */
Module->Draw( DrawPanel, DC, GR_XOR );
if ( aDraw )
{
Module->m_Flags |= DO_NOT_DRAW;
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
Module->m_Flags &= ~DO_NOT_DRAW;
}
pt_pad = (D_PAD*) Module->m_Pads;
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
{
/* Filtrage des modifications interdites */
@ -345,7 +342,8 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC )
}
Module->Set_Rectangle_Encadrement();
Module->Draw( DrawPanel, DC, GR_OR );
if ( aDraw )
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
}
GetScreen()->SetModify();

View File

@ -145,7 +145,9 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
SetCurItem( NULL );
/* Init parametres de gestion */
wxSize gridsize = GetScreen()->GetGrid();
((PCB_SCREEN*)GetScreen())->Init();
GetScreen()->SetGrid( gridsize );
g_HightLigt_Status = 0;

View File

@ -355,19 +355,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "GridSize" ) == 0 )
{
wxSize Grid;
Grid.x = atoi( data );
data = strtok( NULL, " =\n\r" );
if( data )
Grid.y = atoi( data );
else
Grid.y = Grid.x;
GetScreen()->SetGrid( Grid );
continue;
}
if( stricmp( Line, "ZoneGridSize" ) == 0 )
{
g_GridRoutingSize = atoi( data );
@ -518,23 +505,12 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
/******************************************************************************/
{
char text[1024];
int ii, jj;
int ii;
fprintf( aFile, "$SETUP\n" );
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( aFile, text );
if( aFrame->GetScreen()->m_UserGridIsON )
ii = jj = -1;
else
{
ii = aFrame->GetScreen()->GetGrid().x;
jj = aFrame->GetScreen()->GetGrid().y;
}
sprintf( text, "GridSize %d %d\n", ii, jj );
fprintf( aFile, text );
sprintf( text, "UserGridSize %lf %lf %s\n",
aFrame->GetScreen()->m_UserGrid.x, aFrame->GetScreen()->m_UserGrid.y,
( g_UserGrid_Unit == 0 ) ? "INCH" : "mm" );
@ -551,7 +527,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
}
fprintf( aFile, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
for( int ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 )
break;

View File

@ -462,12 +462,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
SaveCopyInUndoList( m_Pcb->m_Modules );
DrawPanel->MouseToCursorSchema();
Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), &dc );
Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
break;
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
SaveCopyInUndoList( m_Pcb->m_Modules );
Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), &dc );
Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
DrawPanel->MouseToCursorSchema();
break;

View File

@ -157,7 +157,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( m_Pcb->m_Modules )
{
SaveCopyInUndoList( m_Pcb->m_Modules );
AddPad( m_Pcb->m_Modules, DC );
AddPad( m_Pcb->m_Modules, true );
}
break;

View File

@ -132,7 +132,7 @@ void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
/***********************************************************************/
void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* pt_pad, wxDC* DC )
void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
/***********************************************************************/
/* Met a jour les nouvelles valeurs de dimensions du pad pointe par pt_pad
@ -141,29 +141,33 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* pt_pad, wxDC* DC )
* - la position et les noms ne sont pas touches
*/
{
if( DC )
pt_pad->Draw( DrawPanel, DC, GR_XOR );
if( aDraw )
{
aPad->m_Flags |= DO_NOT_DRAW;
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
aPad->m_Flags &= ~DO_NOT_DRAW;
}
pt_pad->m_PadShape = g_Pad_Master.m_PadShape;
pt_pad->m_Masque_Layer = g_Pad_Master.m_Masque_Layer;
pt_pad->m_Attribut = g_Pad_Master.m_Attribut;
pt_pad->m_Orient = g_Pad_Master.m_Orient +
( (MODULE*) pt_pad->m_Parent )->m_Orient;
pt_pad->m_Size = g_Pad_Master.m_Size;
pt_pad->m_DeltaSize = wxSize( 0, 0 );
pt_pad->m_Offset = g_Pad_Master.m_Offset;
pt_pad->m_Drill = g_Pad_Master.m_Drill;
pt_pad->m_DrillShape = g_Pad_Master.m_DrillShape;
aPad->m_PadShape = g_Pad_Master.m_PadShape;
aPad->m_Masque_Layer = g_Pad_Master.m_Masque_Layer;
aPad->m_Attribut = g_Pad_Master.m_Attribut;
aPad->m_Orient = g_Pad_Master.m_Orient +
( (MODULE*) aPad->m_Parent )->m_Orient;
aPad->m_Size = g_Pad_Master.m_Size;
aPad->m_DeltaSize = wxSize( 0, 0 );
aPad->m_Offset = g_Pad_Master.m_Offset;
aPad->m_Drill = g_Pad_Master.m_Drill;
aPad->m_DrillShape = g_Pad_Master.m_DrillShape;
/* Traitement des cas particuliers : */
switch( g_Pad_Master.m_PadShape )
{
case PAD_TRAPEZOID:
pt_pad->m_DeltaSize = g_Pad_Master.m_DeltaSize;
aPad->m_DeltaSize = g_Pad_Master.m_DeltaSize;
break;
case PAD_CIRCLE:
pt_pad->m_Size.y = pt_pad->m_Size.x;
aPad->m_Size.y = aPad->m_Size.x;
break;
}
@ -171,21 +175,21 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* pt_pad, wxDC* DC )
{
case PAD_SMD:
case PAD_CONN:
pt_pad->m_Drill = wxSize( 0, 0 );
pt_pad->m_Offset.x = 0;
pt_pad->m_Offset.y = 0;
aPad->m_Drill = wxSize( 0, 0 );
aPad->m_Offset.x = 0;
aPad->m_Offset.y = 0;
}
pt_pad->ComputeRayon();
aPad->ComputeRayon();
if( DC )
pt_pad->Draw( DrawPanel, DC, GR_XOR );
( (MODULE*) pt_pad->m_Parent )->m_LastEdit_Time = time( NULL );
if( aDraw )
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
( (MODULE*) aPad->m_Parent )->m_LastEdit_Time = time( NULL );
}
/***********************************************************/
void WinEDA_BasePcbFrame::AddPad( MODULE* Module, wxDC* DC )
void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
/***********************************************************/
/* Routine d'ajout d'un pad sur l'module selectionnee */
{
@ -218,7 +222,7 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, wxDC* DC )
}
/* Mise a jour des caract de la pastille : */
Import_Pad_Settings( Pad, NULL );
Import_Pad_Settings( Pad, false );
Pad->m_Netname.Empty();
Pad->m_Pos = GetScreen()->m_Curseur;
@ -248,7 +252,8 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, wxDC* DC )
/* Redessin du module */
Module->Set_Rectangle_Encadrement();
Pad->Display_Infos( this );
Module->Draw( DrawPanel, DC, GR_OR );
if ( draw )
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
}

View File

@ -1,6 +1,6 @@
/********************************************************************************/
/* onrightclick.cpp: fonctions de l'edition du PCB appel<65>es par le bouton droit */
/********************************************************************************/
/**************************************************/
/* onrightclick.cpp: Right mouse button functions */
/**************************************************/
#include "fctsys.h"
@ -661,7 +661,6 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
/* Create the wxMenuitem list for zone outlines editing and zone filling
*/
{
if( edge_zone->m_Flags == IS_DRAGGED )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
@ -679,6 +678,7 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
else
{
wxMenu* zones_menu = new wxMenu();
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, zones_menu,
-1, _( "Zones" ), add_zone_xpm );
int index;
@ -832,15 +832,22 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm );
sub_menu_Pad->AppendSeparator();
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
_( "New Pad Settings" ), options_new_pad_xpm );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
_( "Export Pad Settings" ), Export_Options_Pad_xpm );
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
_( "New Pad Settings" ),
_( "Copy current pad settings to this pad" ),
options_new_pad_xpm );
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
_( "Export Pad Settings" ),
_( "Copy this pad settings to current pad settings" ),
Export_Options_Pad_xpm );
if( !flags )
{
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
_( "Global Pad Settings" ), global_options_pad_xpm );
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
_( "Global Pad Settings" ),
_(
"Copy this pad settings to all pads in this footprint (or similar footprints)" ),
global_options_pad_xpm );
sub_menu_Pad->AppendSeparator();
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD,

View File

@ -332,7 +332,7 @@ WinEDA_PlotFrame::WinEDA_PlotFrame( WinEDA_BasePcbFrame* parent ) :
_( "Exclude contents of Edges_Pcb layer from all other layers" ) );
LeftBoxSizer->Add( m_Exclude_Edges_Pcb, 0, wxGROW | wxALL, 1 );
// Option d'impression du cartouche:
// Option to plot page references:
if( m_Parent->m_Print_Sheet_Ref )
{
m_Plot_Sheet_Ref = new wxCheckBox( this, ID_PRINT_REF, _( "Print sheet ref" ) );

View File

@ -39,7 +39,8 @@
#endif
#include "fctsys.h"
#include "gr_basic.h"
//#include "gr_basic.h"
#include "common.h"
@ -51,17 +52,17 @@
#ifdef PCBNEW
#include "pcbnew.h"
extern float Scale_X, Scale_Y;
static long s_SelectedLayers = CUIVRE_LAYER | CMP_LAYER |
SILKSCREEN_LAYER_CMP | SILKSCREEN_LAYER_CU;
static double s_ScaleList[] =
{ 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
#endif
#include "protos.h"
//#define DEFAULT_ORIENTATION_PAPER wxPORTRAIT
#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE
// For pcbnew:
#define OPTKEY_LAYERBASE wxT( "PrintLayer_%d" )
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" )
#define OPTKEY_PRINT_SCALE wxT( "PrintScale" )
#endif
#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE // other option is wxPORTRAIT
#ifdef EESCHEMA
#define WIDTH_MAX_VALUE 100
#else
@ -69,6 +70,14 @@ static double s_ScaleList[] =
#endif
#define WIDTH_MIN_VALUE 1
#ifdef PCBNEW
extern float Scale_X, Scale_Y;
static long s_SelectedLayers;
static double s_ScaleList[] =
{ 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
#endif
// static print data and page setup data, to remember settings during the session
static wxPrintData* g_PrintData;
@ -82,6 +91,8 @@ static int s_Scale_Select = 3; // default selected scale = ScaleList[3]
static bool s_PrintMirror;
static bool s_Print_Sheet_Ref = TRUE;
/****************************************************************/
/* frame de Preparation de l'impression (options, selections... */
/****************************************************************/
@ -105,13 +116,15 @@ public:
WinEDA_DrawFrame* parent,
const wxString& title,
bool print_ref ) :
wxPrintout( title ) {
wxPrintout( title )
{
m_PrintFrame = print_frame;
m_Parent = parent;
s_PrintMaskLayer = 0xFFFFFFFF;
m_Print_Sheet_Ref = print_ref;
}
bool OnPrintPage( int page );
bool HasPage( int page );
bool OnBeginDocument( int startPage, int endPage );
@ -173,6 +186,10 @@ void WinEDA_PrintFrame::SetOthersDatas()
m_Print_Mirror->Enable( false );
#endif
#if defined (PCBNEW)
wxConfig* config = m_Parent->m_Parent->m_EDA_Config; // Current config used by application
#endif
m_FineAdjustXscaleOpt->SetToolTip( _( "Set X scale adjust for exact scale plotting" ) );
m_FineAdjustYscaleOpt->SetToolTip( _( "Set Y scale adjust for exact scale plotting" ) );
if( s_Print_Black_and_White )
@ -203,11 +220,28 @@ void WinEDA_PrintFrame::SetOthersDatas()
}
// Read the scale adjust option
if( m_Parent->m_Parent->m_EDA_Config )
if( config )
{
m_Parent->m_Parent->m_EDA_Config->Read( wxT( "PrintXFineScaleAdj" ), &m_XScaleAdjust );
m_Parent->m_Parent->m_EDA_Config->Read( wxT( "PrintYFineScaleAdj" ), &m_YScaleAdjust );
m_Parent->m_Parent->m_EDA_Config->Read( wxT( "PrintScale" ), &s_Scale_Select );
config->Read( OPTKEY_PRINT_X_FINESCALE_ADJ, &m_XScaleAdjust );
config->Read( OPTKEY_PRINT_Y_FINESCALE_ADJ, &m_YScaleAdjust );
config->Read( OPTKEY_PRINT_SCALE, &s_Scale_Select );
s_SelectedLayers = 0;
for( int layer = 0; layer<NB_LAYERS; ++layer )
{
wxString layerKey;
bool option;
layerKey.Printf( OPTKEY_LAYERBASE, layer );
option = false;
if( config->Read( layerKey, &option ) )
{
m_BoxSelecLayer[layer]->SetValue( option );
if( option )
s_SelectedLayers |= 1 << layer;
}
}
}
m_ScaleOption->SetSelection( s_Scale_Select );
@ -287,9 +321,15 @@ void WinEDA_PrintFrame::OnClosePrintDialog()
#ifdef PCBNEW
if( Config )
{
Config->Write( wxT( "PrintXFineScaleAdj" ), m_XScaleAdjust );
Config->Write( wxT( "PrintYFineScaleAdj" ), m_YScaleAdjust );
Config->Write( wxT( "PrintScale" ), s_Scale_Select );
Config->Write( OPTKEY_PRINT_X_FINESCALE_ADJ, m_XScaleAdjust );
Config->Write( OPTKEY_PRINT_Y_FINESCALE_ADJ, m_YScaleAdjust );
Config->Write( OPTKEY_PRINT_SCALE, s_Scale_Select );
wxString layerKey;
for( int layer = 0; layer<NB_LAYERS; ++layer )
{
layerKey.Printf( OPTKEY_LAYERBASE, layer );
Config->Write( layerKey, m_BoxSelecLayer[layer]->IsChecked() );
}
}
#endif
EndModal( 0 );
@ -751,15 +791,13 @@ void EDA_Printout::DrawPage()
if( m_Print_Sheet_Ref )
m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 );
if( userscale == 1.0 ) // Draw the Sheet refs at optimum scale, and board at 1.0 scale
{
m_Print_Sheet_Ref = FALSE;
dc->SetUserScale( accurate_Yscale, accurate_Yscale );
}
if( s_PrintMirror )
{ // To plot mirror, we revere the y axis, and modify the plot y origin
{ // To plot mirror, we reverse the y axis, and modify the plot y origin
double sx, sy;
dc->GetUserScale( &sx, &sy );