[CMake] Re: [WXDialog] Using wxWidgets in UNICODE

Jorgen Bodde solidstl at xs4all.nl
Wed Aug 10 04:51:43 EDT 2005


Hi there,

I have to admit, unicode is not how I build my wx-distrib usually. But 
you are right, I should change the necessary strings from " ... " to 
_("...") .. I will apply your patch when I get home, thanks for looking 
into it.

- Jorgen

Mathieu Malaterre wrote:

> Jorgen,
>
>     Could you have a look at the attached patch. It fixes the build 
> problem I reported previously. I did it following advices on:
>
> http://wiki.wxwidgets.org/wiki.pl?action=browse&diff=2&id=WxString
>
>     This is not the nicest patch ever, we could maybe define a macro 
> to simplify the code but I believe this is needed. Also looking at 
> your code I could not figure out which convention you used:
>
> _()
>
> or
>
> wxT()
>
> Regards,
> Mathieu
>
>------------------------------------------------------------------------
>
>Index: Source/WXDialog/CMakeSetup.cpp
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/CMakeSetup.cpp,v
>retrieving revision 1.2
>diff -u -3 -p -r1.2 CMakeSetup.cpp
>--- Source/WXDialog/CMakeSetup.cpp	8 Aug 2005 21:14:08 -0000	1.2
>+++ Source/WXDialog/CMakeSetup.cpp	10 Aug 2005 03:26:21 -0000
>@@ -92,11 +92,11 @@ bool CMakeSetupApp::OnInit()
>     // parse command line params
>     cmCommandLineInfo cm;
>     cm.SetValidArguments("ABGHQG");
>-    cm.ParseCommandLine(wxApp::argc, wxApp::argv);
>+    cm.ParseCommandLine(wxApp::argc, (char**)wxApp::argv);
> 
>     // set vendor name and app for config
>-    SetVendorName("Kitware");
>-    SetAppName("CMakeSetup");
>+    SetVendorName(_("Kitware"));
>+    SetAppName(_("CMakeSetup"));
>         
>     CMakeSetupFrm *MyFrame = new CMakeSetupFrm(NULL);
>     
>Index: Source/WXDialog/CMakeSetupFrame.cpp
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/CMakeSetupFrame.cpp,v
>retrieving revision 1.2
>diff -u -3 -p -r1.2 CMakeSetupFrame.cpp
>--- Source/WXDialog/CMakeSetupFrame.cpp	8 Aug 2005 21:14:08 -0000	1.2
>+++ Source/WXDialog/CMakeSetupFrame.cpp	10 Aug 2005 03:26:21 -0000
>@@ -152,8 +152,8 @@ void MFCMessageCallback(const char* m, c
> 
>     if(fm)
>     {
>-        wxString what = m, msg;
>-        if(what.StartsWith("CMake Error: "))
>+        wxString what(m, wxConvUTF8);
>+        if(what.StartsWith(_("CMake Error: ")))
>             fm->LogMessage(-1, m);
>         else
>             fm->LogMessage(1, m);
>@@ -273,7 +273,7 @@ bool CMakeSetupFrm::Create( wxWindow* pa
>     m_noRefresh = false;
>     m_quitAfterGenerating = false;
> 
>-    m_config = new wxConfig("CMakeSetup");
>+    m_config = new wxConfig(_("CMakeSetup"));
> 
>     wxIcon icon(CMakeIcon_xpm);
>     SetIcon(icon);
>@@ -301,13 +301,13 @@ CMakeSetupFrm::~CMakeSetupFrm()
>     wxString str;
> 
>     // write configs back to disk
>-    m_config->Write(CM_LASTPROJECT_PATH, m_cmProjectPath->GetValue());
>-    m_config->Write(CM_LASTBUILD_PATH, m_cmBuildPath->GetValue());
>+    m_config->Write(_(CM_LASTPROJECT_PATH), m_cmProjectPath->GetValue());
>+    m_config->Write(_(CM_LASTBUILD_PATH), m_cmBuildPath->GetValue());
> 
>     // clear the config first
>     for(size_t i = 0 ; i < CM_MAX_RECENT_PATHS; i++)
>     {
>-        str.Printf("%s%i", _(CM_RECENT_BUILD_PATH), i);
>+        str.Printf(_("%s%i"), _(CM_RECENT_BUILD_PATH), i);
>         m_config->Write(str, _(""));
>     }
> 
>@@ -315,7 +315,7 @@ CMakeSetupFrm::~CMakeSetupFrm()
>     int i = (m_recentPaths.Count() >= CM_MAX_RECENT_PATHS ? CM_MAX_RECENT_PATHS : m_recentPaths.Count());
>     while(i > 0)
>     {
>-        str.Printf("%s%i", _(CM_RECENT_BUILD_PATH), i);
>+        str.Printf(_("%s%i"), _(CM_RECENT_BUILD_PATH), i);
>         m_config->Write(str, m_recentPaths[i - 1]);
>         i--;
>     }
>@@ -326,7 +326,7 @@ CMakeSetupFrm::~CMakeSetupFrm()
>         // allow max to be written
>         if(j < CM_MAX_SEARCH_QUERIES)
>         {
>-            str.Printf("%s%i", _(CM_SEARCH_QUERY), j);
>+            str.Printf(_("%s%i"), _(CM_SEARCH_QUERY), j);
>             m_config->Write(str, m_cmSearchQuery->GetString(j));
>         }
>         else
>@@ -340,18 +340,18 @@ CMakeSetupFrm::~CMakeSetupFrm()
>         GetSize(&xsize, &ysize);
>         if(xsize > 0 && ysize > 0) 
>         {
>-            m_config->Write(CM_XSIZE, (long)xsize);
>-            m_config->Write(CM_YSIZE, (long)ysize);
>+            m_config->Write(_(CM_XSIZE), (long)xsize);
>+            m_config->Write(_(CM_YSIZE), (long)ysize);
>         }
> 
>         if(m_splitter->GetSashPosition() > 0)
>-            m_config->Write(CM_SPLITTERPOS, (long)m_splitter->GetSashPosition());
>+            m_config->Write(_(CM_SPLITTERPOS), (long)m_splitter->GetSashPosition());
> 
>         GetPosition(&xsize, &ysize);
>         if(xsize != 0 && ysize != 0) 
>         {
>-            m_config->Write(CM_XPOS, (long)xsize);
>-            m_config->Write(CM_YPOS, (long)ysize);
>+            m_config->Write(_(CM_XPOS), (long)xsize);
>+            m_config->Write(_(CM_YPOS), (long)ysize);
>         }
>     }
> 
>@@ -428,14 +428,14 @@ void CMakeSetupFrm::LogMessage(int logki
>         {
>             wxTextAttr colattr(*wxBLUE);
>             m_cmLog->SetDefaultStyle(colattr);
>-            (*m_cmLog) << msg;
>+            (*m_cmLog) << wxString(msg, wxConvUTF8);
>             m_cmLog->SetDefaultStyle(defattr);
>         }
>         break;
> 
>     // progress
>     case 0:
>-        (*m_cmLog) << msg;
>+        (*m_cmLog) << wxString(msg, wxConvUTF8);
>         break;
> 
>     // error
>@@ -443,7 +443,7 @@ void CMakeSetupFrm::LogMessage(int logki
>         {
>             wxTextAttr colattr(*wxRED);
>             m_cmLog->SetDefaultStyle(colattr);
>-            (*m_cmLog) << msg;
>+            (*m_cmLog) << wxString(msg, wxConvUTF8);
>             m_cmLog->SetDefaultStyle(defattr);
>         }
>         break;
>@@ -653,7 +653,7 @@ void CMakeSetupFrm::DoInitFrame(cmComman
>     m_cmake->GetRegisteredGenerators(names);
>     for(std::vector<std::string>::iterator i = names.begin(); i != names.end(); ++i)
>     {
>-        name = i->c_str();
>+        name = wxString(i->c_str(), wxConvUTF8);
>         m_cmGeneratorChoice->Append(name);
>     }
>     
>@@ -700,7 +700,7 @@ void CMakeSetupFrm::DoInitFrame(cmComman
>     
>     wxString str;
>     //str.Printf("CMake %d.%d - %s", cmake::GetMajorVersion(), cmake::GetMinorVersion(), cmake::GetReleaseVersion());
>-    str.Printf("CMakeSetup v%i.%i%s", CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER);
>+    str.Printf(_("CMakeSetup v%i.%i%s"), CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER);
> 
>     SetTitle(str);
>     wxString path;
>@@ -708,7 +708,7 @@ void CMakeSetupFrm::DoInitFrame(cmComman
>     // get last 5 used projects
>     for(size_t i = 0; i < CM_MAX_RECENT_PATHS; i++)
>     {
>-        path.Printf("%s%i", _(CM_RECENT_BUILD_PATH), i);
>+        path.Printf(_("%s%i"), _(CM_RECENT_BUILD_PATH), i);
>         if(m_config->Read(path, &str))
>             AppendPathToRecentList(str);
>     }
>@@ -716,7 +716,7 @@ void CMakeSetupFrm::DoInitFrame(cmComman
>     // get query items
>     for(size_t i = 0; i < CM_MAX_SEARCH_QUERIES; i++)
>     {
>-        path.Printf("%s%i", _(CM_SEARCH_QUERY), i);
>+        path.Printf(_("%s%i"), _(CM_SEARCH_QUERY), i);
>         if(m_config->Read(path, &str))
>             m_cmSearchQuery->Append(str);
>     }
>@@ -737,13 +737,13 @@ void CMakeSetupFrm::DoInitFrame(cmComman
>     {
>         if(cm.m_WhereSource.size() > 0 )
>         {
>-            m_cmProjectPath->SetValue(cm.m_WhereSource.c_str());
>+            m_cmProjectPath->SetValue(wxString(cm.m_WhereSource.c_str(), wxConvUTF8));
>             sourceDirLoaded = true;
>         }   
>     
>         if (cm.m_WhereBuild.size() > 0 )
>         {
>-            m_cmBuildPath->SetValue(cm.m_WhereBuild.c_str());
>+            m_cmBuildPath->SetValue(wxString(cm.m_WhereBuild.c_str(), wxConvUTF8));
>             buildDirLoaded = true;
>         }
>             
>@@ -769,27 +769,30 @@ void CMakeSetupFrm::DoInitFrame(cmComman
> 
>     // retrieve settings, this needs to be done here
>     // because writing to the m_cmBuildPath triggers a cache reload
>-    if(!sourceDirLoaded && m_config->Read(CM_LASTPROJECT_PATH, &str))
>+    if(!sourceDirLoaded && m_config->Read(_(CM_LASTPROJECT_PATH), &str))
>         m_cmProjectPath->SetValue(str);
> 
>     if(!buildDirLoaded)
>     {
>         m_cmOptions->RemoveAll();
>-        if(m_config->Read(CM_LASTBUILD_PATH, &str))
>+        if(m_config->Read(_(CM_LASTBUILD_PATH), &str))
>             m_cmBuildPath->SetValue(str);
>     }
> 
>     // set window size from settings
>     long xsize, ysize, splitpos;
>-    if(m_config->Read(CM_XSIZE, &xsize) && m_config->Read(CM_YSIZE, &ysize) &&
>-       m_config->Read(CM_SPLITTERPOS, &splitpos))
>+    if(m_config->Read(_(CM_XSIZE), &xsize)
>+    && m_config->Read(_(CM_YSIZE), &ysize)
>+    && m_config->Read(_(CM_SPLITTERPOS), &splitpos))
>     {
>         SetSize(xsize, ysize);
>         m_splitter->SetSashPosition(splitpos);
>     }
> 
>-    if(m_config->Read(CM_XPOS, &xsize) && m_config->Read(CM_YPOS, &ysize))
>-        SetSize(xsize, ysize, -1, -1, wxSIZE_USE_EXISTING);
>+    if(m_config->Read(_(CM_XPOS), &xsize) && m_config->Read(_(CM_YPOS), &ysize))
>+      {
>+      SetSize(xsize, ysize, -1, -1, wxSIZE_USE_EXISTING);
>+      }
> 
>     UpdateWindowState();
> }
>@@ -801,7 +804,7 @@ void CMakeSetupFrm::LoadCacheFromDiskToG
>     cmCacheManager *cachem = m_cmake->GetCacheManager();
>     if(cachem && !builddir.Trim().IsEmpty())
>     {
>-        if(cachem->LoadCache(builddir.c_str()))
>+        if(cachem->LoadCache(builddir.mb_str(wxConvUTF8)))
>             AppendPathToRecentList(builddir);
> 
>         // represent this cache in the grid, but not before we
>@@ -812,7 +815,7 @@ void CMakeSetupFrm::LoadCacheFromDiskToG
>         cmCacheManager::CacheIterator it = cachem->GetCacheIterator("CMAKE_GENERATOR");
>         if(!it.IsAtEnd())
>         {
>-            wxString curGen = it.GetValue();
>+            wxString curGen(it.GetValue(), wxConvUTF8);
>             m_cmGeneratorChoice->SetStringSelection(curGen);
>         }
>     }
>@@ -1017,7 +1020,7 @@ void CMakeSetupFrm::FillCacheGUIFromCach
>                     OnOff = wxT("OFF");
> 
>                 m_cmOptions->AddProperty(key,
>-                                         OnOff.c_str(),
>+                                         OnOff.mb_str(wxConvUTF8),
>                                          i.GetProperty("HELPSTRING"),
>                                          wxPropertyList::CHECKBOX, "ON|OFF",
>                                          reverseOrder,
>@@ -1051,7 +1054,7 @@ void CMakeSetupFrm::FillCacheGUIFromCach
>       
>         case cmCacheManager::INTERNAL:
>             {
>-                wxPropertyItem *pItem = m_cmOptions->FindPropertyByName(key);
>+                wxPropertyItem *pItem = m_cmOptions->FindPropertyByName(wxString(key, wxConvUTF8));
>                 if(pItem)
>                     m_cmOptions->RemoveProperty(pItem);
>             }
>@@ -1071,7 +1074,7 @@ void CMakeSetupFrm::OnExitTimer(wxTimerE
> 
> void CMakeSetupFrm::OnButtonBrowseProject( wxCommandEvent& event )
> {
>-    const wxString& dir = wxDirSelector("Select project directory", m_cmProjectPath->GetValue());
>+    const wxString& dir = wxDirSelector(_("Select project directory"), m_cmProjectPath->GetValue());
>     if(!dir.IsEmpty())
>         m_cmProjectPath->SetValue(dir);
> }
>@@ -1082,7 +1085,7 @@ void CMakeSetupFrm::OnButtonBrowseProjec
> 
> void CMakeSetupFrm::OnButtonBrowseBuild( wxCommandEvent& event )
> {
>-    const wxString& dir = wxDirSelector("Select build directory", m_cmBuildPath->GetValue());
>+    const wxString& dir = wxDirSelector(_("Select build directory"), m_cmBuildPath->GetValue());
>     if(!dir.IsEmpty())
>         m_cmBuildPath->SetValue(dir);
> }
>@@ -1143,7 +1146,7 @@ int CMakeSetupFrm::RunCMake(bool generat
>     }
> 
>     // check if the directory exists, if not, create it
>-    if(!cmSystemTools::FileExists(builddir.c_str()))
>+    if(!cmSystemTools::FileExists(builddir.mb_str(wxConvUTF8)))
>     {
>         wxString str;
>         str << wxT("Build directory does not exist, should I create it?\n\nDirectory: ") << builddir;
>@@ -1151,7 +1154,7 @@ int CMakeSetupFrm::RunCMake(bool generat
>         int answer = wxMessageBox(str, wxT("Create directory"), wxYES_NO, this);
>         if (answer == wxYES)
>         {
>-            if(!cmSystemTools::MakeDirectory(builddir.c_str()))
>+            if(!cmSystemTools::MakeDirectory(builddir.mb_str(wxConvUTF8)))
>             {
>                 // could not create, tell and abort
>                 wxMessageBox(wxT("Could not create directory"), wxT("Error"), wxOK | wxICON_ERROR, this);
>@@ -1190,7 +1193,7 @@ int CMakeSetupFrm::RunCMake(bool generat
>         if(m_cmake->Generate() != 0)
>         {
>             wxMessageBox(err, wxT("Error"), wxOK | wxICON_ERROR, this);
>-            cmSystemTools::Error(err.c_str());
>+            cmSystemTools::Error(err.mb_str(wxConvUTF8));
>             value = -1;
>         }
>         else
>@@ -1202,18 +1205,18 @@ int CMakeSetupFrm::RunCMake(bool generat
>     else
>     {
>         // set paths 
>-        m_cmake->SetHomeDirectory(m_cmProjectPath->GetValue().c_str());
>-        m_cmake->SetStartDirectory(m_cmProjectPath->GetValue().c_str());
>-        m_cmake->SetHomeOutputDirectory(m_cmBuildPath->GetValue().c_str());
>-        m_cmake->SetStartOutputDirectory(m_cmBuildPath->GetValue().c_str());
>+        m_cmake->SetHomeDirectory(m_cmProjectPath->GetValue().mb_str(wxConvUTF8));
>+        m_cmake->SetStartDirectory(m_cmProjectPath->GetValue().mb_str(wxConvUTF8));
>+        m_cmake->SetHomeOutputDirectory(m_cmBuildPath->GetValue().mb_str(wxConvUTF8));
>+        m_cmake->SetStartOutputDirectory(m_cmBuildPath->GetValue().mb_str(wxConvUTF8));
>         
>-        m_cmake->SetGlobalGenerator(m_cmake->CreateGlobalGenerator(m_cmGeneratorChoice->GetValue().c_str()));
>-        m_cmake->SetCMakeCommand(m_PathToExecutable.c_str());
>+        m_cmake->SetGlobalGenerator(m_cmake->CreateGlobalGenerator(m_cmGeneratorChoice->GetValue().mb_str(wxConvUTF8)));
>+        m_cmake->SetCMakeCommand(m_PathToExecutable.mb_str(wxConvUTF8));
>         m_cmake->LoadCache();
>         if(m_cmake->Configure() != 0)
>         {
>             wxMessageBox(err, wxT("Error"), wxOK | wxICON_ERROR, this);
>-            cmSystemTools::Error(err.c_str());
>+            cmSystemTools::Error(err.mb_str(wxConvUTF8));
>         }
>         
>         // update the GUI with any new values in the caused by the
>@@ -1246,7 +1249,7 @@ void CMakeSetupFrm::SaveCacheFromGUI()
>   
>     // write the cache to disk
>     if(!m_cmBuildPath->GetValue().Trim().IsEmpty())
>-        cachem->SaveCache(m_cmBuildPath->GetValue().c_str());
>+        cachem->SaveCache(m_cmBuildPath->GetValue().mb_str(wxConvUTF8));
> }
> 
> void CMakeSetupFrm::FillCacheManagerFromCacheGUI()
>@@ -1266,10 +1269,11 @@ void CMakeSetupFrm::FillCacheManagerFrom
>                 item->GetCurValue().GetChar(0) == '\'' && 
>                 item->GetCurValue().GetChar(item->GetCurValue().Len() - 1) == '\'') 
>             {
>-                it.SetValue(item->GetCurValue().Mid(1, item->GetCurValue().Len() - 2).c_str());
>+            it.SetValue(item->GetCurValue().Mid(1, 
>+                item->GetCurValue().Len() - 2).mb_str(wxConvUTF8));
>             }
>             else
>-                it.SetValue(item->GetCurValue().c_str());
>+                it.SetValue(item->GetCurValue().mb_str(wxConvUTF8));
>         }
>     }
> }
>@@ -1301,7 +1305,7 @@ void CMakeSetupFrm::DoGenerate()
>         else if(!wxGetKeyState(WXK_SHIFT))
>         {
>             bool close;
>-            m_config->Read(CM_CLOSEAFTERGEN, &close, CM_CLOSEAFTERGEN_DEF);
>+            m_config->Read(_(CM_CLOSEAFTERGEN), &close, CM_CLOSEAFTERGEN_DEF);
>             
>             if(!close)
>                 wxMessageBox(wxT("Building of project files succesful!"), wxT("Success!"), wxOK|wxICON_INFORMATION);
>@@ -1364,7 +1368,7 @@ void CMakeSetupFrm::DoDeleteCache()
>         m_cmOptions->SetProjectGenerated(false);
>         
>         if(!m_cmBuildPath->GetValue().Trim().IsEmpty() && m_cmake != 0)
>-            m_cmake->GetCacheManager()->DeleteCache(m_cmBuildPath->GetValue().Trim());
>+            m_cmake->GetCacheManager()->DeleteCache(m_cmBuildPath->GetValue().Trim().mb_str(wxConvUTF8));
>       
>         LoadCacheFromDiskToGUI();   
>         UpdateWindowState();
>@@ -1467,12 +1471,12 @@ void CMakeSetupFrm::DoReloadCache()
>     m_cmSearchQuery->SetValue(_(""));
>     m_noRefresh = false;
> 
>-    std::string path = buildpath.c_str();
>+    std::string path = (const char*)buildpath.mb_str(wxConvUTF8);
>     cmSystemTools::ConvertToUnixSlashes(path);
> 
>     // adjust the cmake instance
>-    m_cmake->SetHomeOutputDirectory(buildpath.c_str());
>-    m_cmake->SetStartOutputDirectory(buildpath.c_str());
>+    m_cmake->SetHomeOutputDirectory(buildpath.mb_str(wxConvUTF8));
>+    m_cmake->SetStartOutputDirectory(buildpath.mb_str(wxConvUTF8));
> 
>     std::string cache_file = path;
>     cache_file += "/CMakeCache.txt";
>@@ -1485,7 +1489,7 @@ void CMakeSetupFrm::DoReloadCache()
>         it.Find("CMAKE_HOME_DIRECTORY"))
>     {
>         path = ConvertToWindowsPath(it.GetValue());
>-        m_cmProjectPath->SetValue(path.c_str());
>+        m_cmProjectPath->SetValue(wxString(path.c_str(), wxConvUTF8));
>     }
> 
>     m_cmOptions->RemoveAll();
>@@ -1690,11 +1694,11 @@ void CMakeSetupFrm::OnAboutClick( wxComm
>     std::vector<std::string> names; 
>     m_cmake->GetRegisteredGenerators(names);
>     for(std::vector<std::string>::iterator i = names.begin(); i != names.end(); ++i)
>-        generators.Add(i->c_str());
>+        generators.Add(wxString(i->c_str(), wxConvUTF8));
> 
>     wxString cmversion, cmsversion;
>-    cmversion.Printf("v%i.%i %s", cmake::GetMajorVersion(), cmake::GetMinorVersion(), cmake::GetReleaseVersion());
>-    cmsversion.Printf("v%i.%i%s", CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER);
>+    cmversion.Printf(_T("v%i.%i %s"), cmake::GetMajorVersion(), cmake::GetMinorVersion(), cmake::GetReleaseVersion());
>+    cmsversion.Printf(_T("v%i.%i%s"), CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER);
> 
>     dlg->SetAboutText(cmversion, cmsversion, generators);
> 
>Index: Source/WXDialog/CMakeSetupFrame.h
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/CMakeSetupFrame.h,v
>retrieving revision 1.1
>diff -u -3 -p -r1.1 CMakeSetupFrame.h
>--- Source/WXDialog/CMakeSetupFrame.h	30 Jun 2005 19:54:14 -0000	1.1
>+++ Source/WXDialog/CMakeSetupFrame.h	10 Aug 2005 03:26:22 -0000
>@@ -166,7 +166,7 @@ public:
>         if(bar)
>         {
>             wxString str;
>-            str.Printf("%2.1f %%", (progress * 100));
>+            str.Printf(_("%2.1f %%"), (progress * 100));
>             bar->SetStatusText(str, 1);
>         }
>     };
>Index: Source/WXDialog/CommandLineInfo.cpp
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/CommandLineInfo.cpp,v
>retrieving revision 1.2
>diff -u -3 -p -r1.2 CommandLineInfo.cpp
>--- Source/WXDialog/CommandLineInfo.cpp	8 Aug 2005 21:14:08 -0000	1.2
>+++ Source/WXDialog/CommandLineInfo.cpp	10 Aug 2005 03:26:22 -0000
>@@ -154,7 +154,7 @@ wxString cmCommandLineInfo::GetStringPar
> {
>     wxCHECK(pString, wxEmptyString);
> 
>-    wxString str(pString);
>+    wxString str(pString, wxConvUTF8);
>     str = str.Strip(wxString::both);
> 
>     // if we have only one (or no chars return the current string)
>Index: Source/WXDialog/PropertyList.cpp
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/PropertyList.cpp,v
>retrieving revision 1.1
>diff -u -3 -p -r1.1 PropertyList.cpp
>--- Source/WXDialog/PropertyList.cpp	30 Jun 2005 19:54:14 -0000	1.1
>+++ Source/WXDialog/PropertyList.cpp	10 Aug 2005 03:26:22 -0000
>@@ -356,10 +356,10 @@ void wxPropertyList::AddProperty(const c
>     // add or update the property item
>     for(size_t i = 0; i < m_PropertyItems.Count(); i++)
>     {
>-        if(m_PropertyItems[i]->GetPropName().IsSameAs(name))
>+        if(m_PropertyItems[i]->GetPropName().IsSameAs(wxString(name, wxConvUTF8)))
>         {
>             pItem = m_PropertyItems[i];
>-            if(!pItem->GetCurValue().IsSameAs(value))
>+            if(!pItem->GetCurValue().IsSameAs(wxString(value, wxConvUTF8)))
>             {
>                 pItem->SetCurValue(value);
>                 pItem->SetHelpString(helpString);
>@@ -377,7 +377,10 @@ void wxPropertyList::AddProperty(const c
>     // if it is not found, then create a new one
>     if(!pItem)
>     {
>-        pItem = new wxPropertyItem(name, value, helpString, type, comboItems);
>+        pItem = new wxPropertyItem(wxString(name, wxConvUTF8), 
>+                                   wxString(value, wxConvUTF8), 
>+                                   wxString(helpString, wxConvUTF8), type, 
>+                                   wxString(comboItems, wxConvUTF8));
>         pItem->SetAdvanced(advanced);
>   
>         AddPropItem(pItem, 1);
>@@ -607,7 +610,7 @@ bool wxPropertyList::UpdatePropertyItem(
>         SetCellValue(row,1, pItem->GetCurValue());
>     }
> 
>-    if(pItem->GetCurValue().IsSameAs("IGNORE"))
>+    if(pItem->GetCurValue().IsSameAs(_("IGNORE")))
>     {
>         // ignored cell is completely dimmed
>         wxColour col(192,192,192);
>@@ -662,13 +665,13 @@ void wxPropertyList::OnCellChange( wxGri
>         // write back bool
>         if(pItem->GetItemType() == CHECKBOX)
>         {
>-            if(GetCellValue(row, 1).IsSameAs("1"))
>+            if(GetCellValue(row, 1).IsSameAs(_("1")))
>                 pItem->SetCurValue("ON");
>             else
>                 pItem->SetCurValue("OFF");
>         }
>         else
>-            pItem->SetCurValue(GetCellValue(row, 1));
>+            pItem->SetCurValue(GetCellValue(row, 1).mb_str(wxConvUTF8));
>     
>         UpdatePropertyItem(pItem, row);
>         event.Skip();
>@@ -828,7 +831,7 @@ void wxPropertyList::BrowseSelectedItem(
>                 
>                 if(!str.IsEmpty())
>                 {
>-                    pItem->SetCurValue(str.c_str());
>+                    pItem->SetCurValue(str.mb_str(wxConvUTF8));
>                     UpdatePropertyItem(pItem, i);
>                 }
>             }
>Index: Source/WXDialog/PropertyList.h
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/PropertyList.h,v
>retrieving revision 1.1
>diff -u -3 -p -r1.1 PropertyList.h
>--- Source/WXDialog/PropertyList.h	30 Jun 2005 19:54:14 -0000	1.1
>+++ Source/WXDialog/PropertyList.h	10 Aug 2005 03:26:22 -0000
>@@ -119,11 +119,11 @@ public:
>     };
>     
>     void SetCurValue(const char *str) {
>-        m_curValue = str;
>+        m_curValue = wxString(str, wxConvUTF8);
>     };
>     
>     void SetPropName(const char *str) {
>-        m_propName = str;
>+        m_propName = wxString(str, wxConvUTF8);
>     };
> 
>     void SetAdvanced(bool value) {
>@@ -131,7 +131,7 @@ public:
>     };
> 
>     void SetHelpString(const char *str) {
>-        m_HelpString = str;
>+        m_HelpString = wxString(str, wxConvUTF8);
>     };
> 
>     bool GetAdvanced() const {
>Index: Source/WXDialog/aboutdlg.cpp
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/aboutdlg.cpp,v
>retrieving revision 1.1
>diff -u -3 -p -r1.1 aboutdlg.cpp
>--- Source/WXDialog/aboutdlg.cpp	30 Jun 2005 19:54:14 -0000	1.1
>+++ Source/WXDialog/aboutdlg.cpp	10 Aug 2005 03:26:22 -0000
>@@ -160,7 +160,7 @@ void CMAboutDlg::SetAboutText(const wxSt
>     // compile list of generators in a bulleted list
>     wxString gens = _("<ul>");
>     for(size_t i = 0; i < generators.Count(); i++)
>-        gens << "<li><u>" << generators[i] << "</u></li>";
>+        gens << _("<li><u>") << generators[i] << _("</u></li>");
>     gens << _("</ul>");
> 
>     // replace stuff
>Index: Source/WXDialog/optionsdlg.cpp
>===================================================================
>RCS file: /cvsroot/CMake/CMake/Source/WXDialog/optionsdlg.cpp,v
>retrieving revision 1.1
>diff -u -3 -p -r1.1 optionsdlg.cpp
>--- Source/WXDialog/optionsdlg.cpp	30 Jun 2005 19:54:14 -0000	1.1
>+++ Source/WXDialog/optionsdlg.cpp	10 Aug 2005 03:26:22 -0000
>@@ -170,14 +170,14 @@ void CMOptionsDlg::SetConfig(wxConfig *c
>     bool boolval;
>     
>     // close after generation
>-    cfg->Read(CM_CLOSEAFTERGEN, &boolval, CM_CLOSEAFTERGEN_DEF);
>+    cfg->Read(_(CM_CLOSEAFTERGEN), &boolval, CM_CLOSEAFTERGEN_DEF);
>     m_closeAfterGenerate->SetValue(boolval);
> }
> 
> void CMOptionsDlg::GetConfig(wxConfig *cfg)
> {
>     // close after generation
>-    cfg->Write(CM_CLOSEAFTERGEN, m_closeAfterGenerate->GetValue());
>+    cfg->Write(_(CM_CLOSEAFTERGEN), m_closeAfterGenerate->GetValue());
> }
> 
> /*!
>  
>


More information about the CMake mailing list