Try to fix a compil issue on OSX (no viable conversion from 'const wxString' to 'const wxChar *', in colors.cpp)

This commit is contained in:
jean-pierre charras 2016-05-17 09:10:15 +02:00
parent 0715504a9e
commit 620ccc5483
5 changed files with 79 additions and 36 deletions

View File

@ -23,6 +23,7 @@
*/
#include <colors.h>
#include <i18n_utility.h>
/**
@ -32,38 +33,39 @@
* when displaying superimposed objects
* This list must have exactly NBCOLORS items
*/
const StructColors g_ColorRefs[NBCOLORS] =
{
{ 0, 0, 0, BLACK, _( "Black" ), DARKDARKGRAY },
{ 72, 72, 72, DARKDARKGRAY, _( "Gray 1" ), DARKGRAY },
{ 132, 132, 132, DARKGRAY, _( "Gray 2" ), LIGHTGRAY },
{ 194, 194, 194, LIGHTGRAY, _( "Gray 3" ), WHITE },
{ 255, 255, 255, WHITE, _( "White" ), WHITE },
{ 194, 255, 255, LIGHTYELLOW, _( "L.Yellow" ), WHITE },
{ 72, 0, 0, DARKBLUE, _( "Blue 1" ), BLUE },
{ 0, 72, 0, DARKGREEN, _( "Green 1" ), GREEN },
{ 72, 72, 0, DARKCYAN, _( "Cyan 1" ), CYAN },
{ 0, 0, 72, DARKRED, _( "Red 1" ), RED },
{ 72, 0, 72, DARKMAGENTA, _( "Magenta 1" ), MAGENTA },
{ 0, 72, 72, DARKBROWN, _( "Brown 1" ), BROWN },
{ 132, 0, 0, BLUE, _( "Blue 2" ), LIGHTBLUE },
{ 0, 132, 0, GREEN, _( "Green 2" ), LIGHTGREEN },
{ 132, 132, 0, CYAN, _( "Cyan 2" ), LIGHTCYAN },
{ 0, 0, 132, RED, _( "Red 2" ), LIGHTRED },
{ 132, 0, 132, MAGENTA, _( "Magenta 2" ), LIGHTMAGENTA },
{ 0, 132, 132, BROWN, _( "Brown 2" ), YELLOW },
{ 194, 0, 0, LIGHTBLUE, _( "Blue 3" ), PUREBLUE, },
{ 0, 194, 0, LIGHTGREEN, _( "Green 3" ), PUREGREEN },
{ 194, 194, 0, LIGHTCYAN, _( "Cyan 3" ), PURECYAN },
{ 0, 0, 194, LIGHTRED, _( "Red 3" ), PURERED },
{ 194, 0, 194, LIGHTMAGENTA, _( "Magenta 3" ), PUREMAGENTA },
{ 0, 194, 194, YELLOW, _( "Yellow 3" ), PUREYELLOW },
{ 255, 0, 0, PUREBLUE, _( "Blue 4" ), WHITE },
{ 0, 255, 0, PUREGREEN, _( "Green 4" ), WHITE },
{ 255, 255, 0, PURECYAN, _( "Cyan 4" ), WHITE },
{ 0, 0, 255, PURERED, _( "Red 4" ), WHITE },
{ 255, 0, 255, PUREMAGENTA, _( "Magenta 4" ), WHITE },
{ 0, 255, 255, PUREYELLOW, _( "Yellow 4" ), WHITE },
{ 0, 0, 0, BLACK, _HKI( "Black" ), DARKDARKGRAY },
{ 72, 72, 72, DARKDARKGRAY, _HKI( "Gray 1" ), DARKGRAY },
{ 132, 132, 132, DARKGRAY, _HKI( "Gray 2" ), LIGHTGRAY },
{ 194, 194, 194, LIGHTGRAY, _HKI( "Gray 3" ), WHITE },
{ 255, 255, 255, WHITE, _HKI( "White" ), WHITE },
{ 194, 255, 255, LIGHTYELLOW, _HKI( "L.Yellow" ), WHITE },
{ 72, 0, 0, DARKBLUE, _HKI( "Blue 1" ), BLUE },
{ 0, 72, 0, DARKGREEN, _HKI( "Green 1" ), GREEN },
{ 72, 72, 0, DARKCYAN, _HKI( "Cyan 1" ), CYAN },
{ 0, 0, 72, DARKRED, _HKI( "Red 1" ), RED },
{ 72, 0, 72, DARKMAGENTA, _HKI( "Magenta 1" ), MAGENTA },
{ 0, 72, 72, DARKBROWN, _HKI( "Brown 1" ), BROWN },
{ 132, 0, 0, BLUE, _HKI( "Blue 2" ), LIGHTBLUE },
{ 0, 132, 0, GREEN, _HKI( "Green 2" ), LIGHTGREEN },
{ 132, 132, 0, CYAN, _HKI( "Cyan 2" ), LIGHTCYAN },
{ 0, 0, 132, RED, _HKI( "Red 2" ), LIGHTRED },
{ 132, 0, 132, MAGENTA, _HKI( "Magenta 2" ), LIGHTMAGENTA },
{ 0, 132, 132, BROWN, _HKI( "Brown 2" ), YELLOW },
{ 194, 0, 0, LIGHTBLUE, _HKI( "Blue 3" ), PUREBLUE, },
{ 0, 194, 0, LIGHTGREEN, _HKI( "Green 3" ), PUREGREEN },
{ 194, 194, 0, LIGHTCYAN, _HKI( "Cyan 3" ), PURECYAN },
{ 0, 0, 194, LIGHTRED, _HKI( "Red 3" ), PURERED },
{ 194, 0, 194, LIGHTMAGENTA, _HKI( "Magenta 3" ), PUREMAGENTA },
{ 0, 194, 194, YELLOW, _HKI( "Yellow 3" ), PUREYELLOW },
{ 255, 0, 0, PUREBLUE, _HKI( "Blue 4" ), WHITE },
{ 0, 255, 0, PUREGREEN, _HKI( "Green 4" ), WHITE },
{ 255, 255, 0, PURECYAN, _HKI( "Cyan 4" ), WHITE },
{ 0, 0, 255, PURERED, _HKI( "Red 4" ), WHITE },
{ 255, 0, 255, PUREMAGENTA, _HKI( "Magenta 4" ), WHITE },
{ 0, 255, 255, PUREYELLOW, _HKI( "Yellow 4" ), WHITE },
};
@ -72,7 +74,7 @@ EDA_COLOR_T ColorByName( const wxString& aName )
// look for a match in the palette itself
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
{
if( 0 == aName.CmpNoCase( g_ColorRefs[trying].m_Name ) )
if( 0 == aName.CmpNoCase( ColorGetName( trying ) ) )
return trying;
}

View File

@ -152,7 +152,7 @@ void CHOOSE_COLOR_DLG::init_Dialog()
if( m_color == buttcolor )
focusedButton = bitmapButton;
wxStaticText* label = new wxStaticText( this, -1, ColorGetName( buttcolor ),
wxStaticText* label = new wxStaticText( this, -1, wxGetTranslation( ColorGetName( buttcolor ) ),
wxDefaultPosition, wxDefaultSize, 0 );
FlexColumnBoxSizer->Add( label, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -137,7 +137,7 @@ struct StructColors
unsigned char m_Red;
EDA_COLOR_T m_Numcolor;
const wxChar* m_Name;
const wxChar* m_ColorName;
EDA_COLOR_T m_LightColor;
};
@ -177,7 +177,7 @@ inline const wxChar *ColorGetName( EDA_COLOR_T aColor )
{
EDA_COLOR_T base = ColorGetBase( aColor );
wxASSERT( base > UNSPECIFIED_COLOR && base < NBCOLORS );
return g_ColorRefs[base].m_Name;
return g_ColorRefs[base].m_ColorName;
}
inline void ColorSetBrush( wxBrush *aBrush, EDA_COLOR_T aColor )

View File

@ -39,7 +39,7 @@
// The translated string is used only when displaying the help window.
// Therefore translation tools have to use the "_" and the "_HKI" prefix to extract
// strings to translate
#define _HKI( x ) wxT( x )
#include <i18n_utility.h> // _HKI definition
class EDA_BASE_FRAME;

41
include/i18n_utility.h Normal file
View File

@ -0,0 +1,41 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file i18n_utility.h
* @brief Some functions to handle hotkeys in KiCad
*/
#ifndef I18N_UTILITY_H
#define I18N_UTILITY_H
// A define to allow translation of strings which must be stored in English (for instance
// because they are used both as keywords and as messages in dialogs
// We do not want to use the _( x ) usual macro from wxWidgets, which calls wxGetTranslation(),
// because the English string is used in key file configuration
// The translated string is used only when displaying the help window.
// Therefore translation tools have to use the "_" and the "_HKI" prefix to extract
// strings to translate
#define _HKI( x ) wxT( x )
#endif // I18N_UTILITY_H