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-27 16:22:11 -04:00 committed by Wayne Stambaugh
parent 226d56433c
commit 7940f0773c
5 changed files with 82 additions and 39 deletions

View File

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

View File

@ -144,7 +144,6 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
wxBoxSizer* MainBoxSizer = NULL; wxBoxSizer* MainBoxSizer = NULL;
wxFlexGridSizer* FlexColumnBoxSizer = NULL; wxFlexGridSizer* FlexColumnBoxSizer = NULL;
wxBitmapButton* BitmapButton = NULL; wxBitmapButton* BitmapButton = NULL;
wxStaticText* Label = NULL;
wxStaticLine* Line = NULL; wxStaticLine* Line = NULL;
wxStdDialogButtonSizer* StdDialogButtonSizer = NULL; wxStdDialogButtonSizer* StdDialogButtonSizer = NULL;
wxButton* Button = NULL; wxButton* Button = NULL;
@ -215,9 +214,10 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
BitmapButton->SetFocus(); BitmapButton->SetFocus();
} }
Label = new wxStaticText( this, -1, ColorGetName( buttcolor ), wxStaticText* label = new wxStaticText( this, -1,
wxDefaultPosition, wxDefaultSize, 0 ); wxGetTranslation( ColorGetName( buttcolor ) ),
FlexColumnBoxSizer->Add( Label, 1, wxDefaultPosition, wxDefaultSize, 0 );
FlexColumnBoxSizer->Add( label, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxLEFT | wxRIGHT | wxBOTTOM, 5 );
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -137,7 +137,7 @@ struct StructColors
unsigned char m_Red; unsigned char m_Red;
EDA_COLOR_T m_Numcolor; EDA_COLOR_T m_Numcolor;
const wxChar* m_Name; const wxChar* m_ColorName;
EDA_COLOR_T m_LightColor; EDA_COLOR_T m_LightColor;
}; };
@ -177,7 +177,7 @@ inline const wxChar *ColorGetName( EDA_COLOR_T aColor )
{ {
EDA_COLOR_T base = ColorGetBase( aColor ); EDA_COLOR_T base = ColorGetBase( aColor );
wxASSERT( base > UNSPECIFIED_COLOR && base < NBCOLORS ); 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 ) inline void ColorSetBrush( wxBrush *aBrush, EDA_COLOR_T aColor )

View File

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