made kicad compilable with wxWidgets 2.9 (wxWidgets 3)

This commit is contained in:
charras 2009-04-13 05:58:11 +00:00
parent f3e4682f54
commit 89e7f96574
26 changed files with 148 additions and 167 deletions

View File

@ -126,7 +126,7 @@ bool IsOK( wxWindow* parent, const wxString& text )
/***********************************************************************/
int Get_Message( const wxString& title, // The question
const wxString& frame_caption, // The frame caption
wxString& buffer, // String input buffer
wxString& buffer, // String input/return buffer
wxWindow* frame )
/***********************************************************************/
@ -140,13 +140,10 @@ int Get_Message( const wxString& title, // The question
* != 0 if ESCAPE
*/
{
wxString message, default_text;
if( buffer )
default_text = buffer;
wxString message;
message = wxGetTextFromUser( title, frame_caption,
default_text, frame );
buffer, frame );
if( !message.IsEmpty() )
{
message.Trim( FALSE ); // Remove blanks at beginning

View File

@ -94,13 +94,6 @@ bool DrawPage( WinEDA_DrawPanel* panel )
wxMetafileDC dc /*(wxT(""), DrawArea.GetWidth(), DrawArea.GetHeight())*/;
if( !dc.Ok() )
{
DisplayError( NULL, wxT( "CopyToClipboard: DrawPage error: wxMetafileDC not OK" ) );
success = FALSE;
}
else
{
EDA_Rect tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc );
GRForceBlackPen( s_PlotBlackAndWhite );
@ -124,7 +117,6 @@ bool DrawPage( WinEDA_DrawPanel* panel )
success = mf->SetClipboard( ClipboardSizeX, ClipboardSizeY );
delete mf;
}
}
GRForceBlackPen( FALSE );

View File

@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
@ -19,6 +20,12 @@
#include "wx/wx.h"
#endif
#if wxCHECK_VERSION( 2, 9, 0 )
// Do nothing, because wxWidgets 3 supports the SVG format
// previously, was a contribution library, not included in wxWidgets base
#else
#include "dcsvg.h"
#include "wx/image.h"
@ -979,3 +986,5 @@ void wxSVGFileDC::write( const wxString& s )
#pragma warn .rch
#pragma warn .ccc
#endif
#endif // wxCHECK_VERSION

View File

@ -304,14 +304,17 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
continue; /* Skip ~ processing */
}
}
AsciiCode = aText.GetChar(ptr+overbars);
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
AsciiCode = aText.GetChar(ptr+overbars) & 0x7FF;
AsciiCode &= 0x7FF;
if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr
AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF;
else
AsciiCode = AsciiCode & 0xFF;
#else
AsciiCode = aText.GetChar(ptr+overbars) & 0xFF;
AsciiCode &= 0xFF;
#endif
ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description
* du caractere a dessiner */

View File

@ -698,6 +698,10 @@ void WinEDA_App::SaveSettings()
/* Sdt font settings */
m_EDA_Config->Write( wxT( "SdtFontSize" ), g_StdFontPointSize );
m_EDA_Config->Write( wxT( "SdtFontType" ), g_StdFont->GetFaceName() );
#if wxCHECK_VERSION( 2, 9, 0 )
#warning under wxWidgets 3.0, see how to replace the next lines
#else
m_EDA_Config->Write( wxT( "SdtFontStyle" ), g_StdFont->GetStyle() );
m_EDA_Config->Write( wxT( "SdtFontWeight" ), g_StdFont->GetWeight() );
@ -717,6 +721,7 @@ void WinEDA_App::SaveSettings()
m_EDA_Config->Write( wxT( "FixedFontSize" ), g_FixedFontPointSize );
m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits );
m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() );
#endif // wxCHECK_VERSION
/* Save the file history list */
m_fileHistory.Save( *m_EDA_Config );
@ -857,9 +862,11 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
menu = new wxMenu;
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
wxString label = s_Language_List[ii].m_DoNotTranslate ?
s_Language_List[ii].m_Lang_Label :
wxGetTranslation( s_Language_List[ii].m_Lang_Label );
wxString label;
if ( s_Language_List[ii].m_DoNotTranslate )
label = s_Language_List[ii].m_Lang_Label;
else
label = wxGetTranslation( s_Language_List[ii].m_Lang_Label );
item = new wxMenuItem( menu,
s_Language_List[ii].m_KI_Lang_Identifier,

View File

@ -1494,26 +1494,6 @@ void GRSetTextFgColor( wxDC* DC, wxFont*, int Color )
}
/*****************************************************************************/
void GRGetTextExtent( wxDC* DC, const wxChar* Text, long* width, long* height )
/*****************************************************************************/
/* Return the size of the text
*/
{
long w = 0, h = 0;
if( Text )
{
DC->GetTextExtent( Text, &w, &h );
}
if( width )
*width = w;
if( height )
*height = h;
}
/********************************/
void GRResetTextFgColor( wxDC* DC )
/********************************/

View File

@ -21,7 +21,7 @@ WinEDA_EnterText::WinEDA_EnterText( wxWindow* parent,
const wxSize& Size )
{
m_Modify = FALSE;
if( TextToEdit )
if( ! TextToEdit.IsEmpty() )
m_NewText = TextToEdit;
m_Title = new wxStaticText( parent, -1, Title );

View File

@ -505,7 +505,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
{
// It is an horizontal line
if( m_PinName && DrawPinName )
if( DrawPinName )
{
if( orient == PIN_RIGHT )
{
@ -545,7 +545,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
else /* Its a vertical line. */
{
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
if( m_PinName && DrawPinName )
if( DrawPinName )
{
if( orient == PIN_DOWN )
{
@ -588,7 +588,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
{
/* Its an horizontal line. */
if( m_PinName && DrawPinName )
if( DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x,
@ -612,7 +612,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
}
else /* Its a vertical line. */
{
if( m_PinName && DrawPinName )
if( DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE,
@ -701,7 +701,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
{
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
{
if( m_PinName && DrawPinName )
if( DrawPinName )
{
if( orient == PIN_RIGHT )
{
@ -740,7 +740,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
}
else /* Its a vertical line. */
{
if( m_PinName && DrawPinName )
if( DrawPinName )
{
if( orient == PIN_DOWN )
{
@ -784,7 +784,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
{
/* Its an horizontal line. */
if( m_PinName && DrawPinName )
if( DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x,
@ -807,7 +807,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
}
else /* Its a vertical line. */
{
if( m_PinName && DrawPinName )
if( DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE,
@ -937,7 +937,8 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer )
len = 4;
for( ii = 0; ii < len; ii++ )
{
ascii_buf[ii] = buffer.GetChar( ii ) & 0xFF;
ascii_buf[ii] = buffer.GetChar( ii );
ascii_buf[ii] &= 0xFF;
}
strncpy( (char*) &m_PinNum, ascii_buf, 4 );

View File

@ -157,12 +157,14 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/* For more than one part per package, we must add the part selection
* A, B, ... or 1, 2, .. to the reference. */
wxString fulltext = m_Text;
char part_id;
#if defined(KICAD_GOST)
fulltext.Append( '.');
fulltext.Append( '1' - 1 + DrawLibItem->m_Multi );
part_id = '1' - 1 + DrawLibItem->m_Multi;
#else
fulltext.Append( 'A' - 1 + DrawLibItem->m_Multi );
part_id = 'A' - 1 + DrawLibItem->m_Multi;
#endif
fulltext.Append( part_id );
DrawGraphicText( panel, DC, pos, color, fulltext,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,

View File

@ -235,13 +235,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
if( !dc.Ok() )
{
DisplayError( this, wxT( "SVGprint error: wxSVGFileDC not OK" ) );
success = FALSE;
}
else
{
EDA_Rect tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc );
g_PlotLine_Width = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
@ -258,7 +251,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
SetLocaleTo_Default( ); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
}
GRForceBlackPen( FALSE );

View File

@ -250,7 +250,7 @@ void WinEDA_PartPropertiesFrame::BuildPanelDoc()
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC];
else
{
if( CurrentLibEntry && CurrentLibEntry->m_Doc )
if( CurrentLibEntry )
msg_text = CurrentLibEntry->m_Doc;
}
m_Doc->SetValue( msg_text );

View File

@ -140,8 +140,7 @@ wxString Line;
void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
LibEDA_BaseStruct * DrawItem)
void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, LibEDA_BaseStruct * DrawItem)
{
int DrawMode = g_XorMode;
@ -150,7 +149,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
return;
/* Effacement ancien texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC)
if( DC)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, DrawMode);
@ -162,7 +161,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
GetScreen()->SetModify();
/* Affichage nouveau texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC)
if( DC )
{
if ( (DrawItem->m_Flags & IS_MOVED) == 0 )
DrawMode = GR_DEFAULT_DRAWMODE;

View File

@ -46,7 +46,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
wxFileDialog dlg( this, _( "Import Component" ), m_LastLibImportPath,
wxEmptyString, CompLibFileWildcard,
wxFD_OPEN | wxFILE_MUST_EXIST );
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;

View File

@ -502,7 +502,6 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
continue;
if( newsize >= 0 )
Pin->m_PinNumSize = newsize;
if( newnum )
Pin->m_PinNum = CurrentPin->m_PinNum;
}
}

View File

@ -483,12 +483,14 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
/* Adding A, B ... to the reference */
wxString Text;
Text = field->m_Text;
char unit_id;
#if defined(KICAD_GOST)
Text.Append( '.' );
Text.Append( '1' - 1 + DrawLibItem->m_Multi );
unit_id = '1' - 1 + DrawLibItem->m_Multi;
#else
Text.Append( 'A' - 1 + DrawLibItem->m_Multi );
unit_id = 'A' - 1 + DrawLibItem->m_Multi;
#endif
Text.Append( unit_id );
PlotGraphicText( g_PlotFormat, textpos, color, Text,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
field->m_Size, hjustify, vjustify,

View File

@ -312,12 +312,9 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
ActiveScreen = GetScreen();
if( *g_CurrentViewComponentName )
{
LibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName, FIND_ALIAS );
ViewCmpEntry = (LibCmpEntry*) LibEntry;
}
/* Forcage de la reinit de la brosse et plume courante */
GRResetPenAndBrush( DC );

View File

@ -1,3 +1,9 @@
#if wxCHECK_VERSION( 2, 9, 0 )
// Do nothing, because wxWidgets 3 supports the SVG format
// previously, was a contribution library, not included in wxWidgets base
#include "wx/dcsvg.h"
#else
#ifndef __DCSVG_H
#define __DCSVG_H
#include "wx/wfstream.h"
@ -413,3 +419,5 @@ public:
#pragma warn .ccc
#endif
#endif
#endif // wxCHECK_VERSION

View File

@ -196,7 +196,6 @@ int GRGetTextFgColor(wxDC * DC, wxFont * Font);
void GRSetTextBgColor(wxDC * DC, int Color);
void GRSetTextBgColor(wxDC * DC, wxFont * Font, int Color);
int GRGetTextBgColor(wxDC * DC, wxFont * Font);
void GRGetTextExtent(wxDC * DC, const wxChar * Text, long * width, long * height);
#endif /* define GR_BASIC */

View File

@ -135,9 +135,12 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event )
NULL
};
wxString cmd = wxT( "-O " ) + zip.GetPathSeparator() + zip.GetFullName();
wxString cmd = wxT( "-O " );
cmd += zip.GetPathSeparator() + zip.GetFullName();
wxDir dir( wxT( "." ) + zip.GetPathSeparator() );
wxString currdirname = wxT( "." );
currdirname += zip.GetPathSeparator();
wxDir dir( currdirname );
if( !dir.IsOpened() )
return;
@ -152,7 +155,8 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event )
{
wxFileName fn( f );
cmd += wxT( " ." ) + zip.GetPathSeparator() + fn.GetFullName();
cmd += wxT( " ." );
cmd += zip.GetPathSeparator() + fn.GetFullName();
PrintMsg( _( "Compress file " ) + fn.GetFullName() + wxT( "\n" ) );
cont = dir.GetNext( &f );
}

View File

@ -375,8 +375,7 @@ bool WinEDA_App::OnInit()
GetSettings(); // read current setup
/* Make nameless project translatable */
wxFileName namelessProject( wxGetCwd(), _( "noname" ),
+ ProjectFileExtension );
wxFileName namelessProject( wxGetCwd(), _( "noname" ), ProjectFileExtension );
frame = new WinEDA_MainFrame( NULL, wxT( "KiCad" ),
wxPoint( 30, 20 ), wxSize( 600, 400 ) );

View File

@ -333,7 +333,7 @@ void WinEDA_MainFrame::OnOpenFileInTextEditor( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( dlg.GetPath() && wxGetApp().GetEditorName() )
if( ! dlg.GetPath().IsEmpty() && ! wxGetApp().GetEditorName().IsEmpty() )
ExecuteFile( this, wxGetApp().GetEditorName(), dlg.GetPath() );
}

View File

@ -249,13 +249,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
if( !dc.Ok() )
{
DisplayError( this, wxT( "SVGprint error: wxSVGFileDC not OK" ) );
success = FALSE;
}
else
{
EDA_Rect tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc );
s_PrintPenMinWidth = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
@ -272,8 +265,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
}
GRForceBlackPen( FALSE );
SetPenMinWidth( 1 );

View File

@ -38,7 +38,7 @@
#define ID_TEXTCTRLROT_VALUE 10003
#define ID_TEXTCTRL_FOOTPRINTS_FILTER 10001
#define ID_CHECKBOX_APPLY_TO_LOCKED 10002
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxDIALOG_MODAL|wxTAB_TRAVERSAL
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_STYLE wxDEFAULT_DIALOG_STYLE
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_TITLE _("Footprints Orientation")
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_IDNAME ID_DIALOG_ORIENT_FOOTPRINTS
#define SYMBOL_DIALOG_ORIENT_FOOTPRINTS_SIZE wxSize(400, 300)

View File

@ -241,7 +241,7 @@
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Texture">""</string>
<string name="proxy-Texture style">"Tiled"</string>
<bool name="proxy-wxDEFAULT_DIALOG_STYLE">0</bool>
<bool name="proxy-wxDEFAULT_DIALOG_STYLE">1</bool>
<bool name="proxy-wxCAPTION">1</bool>
<bool name="proxy-wxRESIZE_BORDER">1</bool>
<bool name="proxy-wxSYSTEM_MENU">1</bool>
@ -250,7 +250,7 @@
<bool name="proxy-wxCLOSE_BOX">1</bool>
<bool name="proxy-wxMAXIMIZE_BOX">0</bool>
<bool name="proxy-wxMINIMIZE_BOX">0</bool>
<bool name="proxy-wxDIALOG_MODAL">1</bool>
<bool name="proxy-wxDIALOG_MODAL">0</bool>
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>

View File

@ -136,7 +136,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
fnFront = GetScreen()->m_FileName;
frontLayerName = GetBoard()->GetLayerName( CMP_N );
fnFront.SetName( fnFront.GetName() + frontLayerName.GetData() );
fnFront.SetName( fnFront.GetName() + frontLayerName );
fnFront.SetExt( wxT( "pos") );
fpFront = wxFopen( fnFront.GetFullPath(), wxT( "wt" ) );
@ -151,7 +151,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
{
fnBack = GetScreen()->m_FileName;
backLayerName = GetBoard()->GetLayerName( COPPER_LAYER_N );
fnBack.SetName( fnBack.GetName() + backLayerName.GetData() );
fnBack.SetName( fnBack.GetName() + backLayerName );
fnBack.SetExt( wxT( "pos" ) );
fpBack = wxFopen( fnBack.GetFullPath(), wxT( "wt" ) );

View File

@ -440,7 +440,7 @@ static void Extract_Parameters( wxArrayString& param_list, char* text )
* last parameter is ) or ]
*/
{
int key;
char key;
wxString tmp;
while( *text != 0 )