patch: fixes encoding problems with the title document

From: Jordi Mas (jmas@softcatala.org)
Date: Tue Sep 02 2003 - 12:33:57 EDT

  • Next message: Dom Lachowicz: "Re: patch: fixes encoding problems with the title document"

    Fixes encoding problems with the title document in some dialog boxes that use
    the title name (now in UTF8).

    Jordi,

    -- 
    

    Jordi Mas i Hernāndez - Abiword developer - http://www.abisource.com jmas@softcatala.org - Softcatalā member - http://www.softcatala.org - Personal Homepage http://www.softcatala.org/~jmas

    Index: src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp,v
    retrieving revision 1.22
    diff -u -r1.22 xap_Win32Dlg_Insert_Symbol.cpp
    --- src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp 15 Aug 2003 03:54:10 -0000 1.22
    +++ src/af/xap/win/xap_Win32Dlg_Insert_Symbol.cpp 2 Sep 2003 15:58:32 -0000
    @@ -36,6 +36,7 @@
     #include "gr_Win32Graphics.h"
     #include "xap_Win32DialogHelper.h"
     #include "xap_Win32Resources.rc2"
    +#include "ap_Win32App.h"
     
     /*****************************************************************/
     
    @@ -98,7 +99,7 @@
     
             // Update the caption
             ConstructWindowName();
    - SetWindowText(m_hDlg, m_WindowName);
    + SetWindowText(m_hDlg, (AP_Win32App::s_fromUTF8ToAnsi(m_WindowName)).c_str());
     
             iResult = ShowWindow( m_hDlg, SW_SHOW );
     
    @@ -117,7 +118,7 @@
             {
                     // Update the caption
                     ConstructWindowName();
    - SetWindowText(m_hDlg, m_WindowName);
    + SetWindowText(m_hDlg, (AP_Win32App::s_fromUTF8ToAnsi(m_WindowName)).c_str());
     
                     SetWindowLong(m_hDlg, GWL_HWNDPARENT, (long)frameHWND);
                     SetWindowPos(m_hDlg, NULL, 0, 0, 0, 0,
    @@ -214,7 +215,7 @@
     
             // Update the caption
             ConstructWindowName();
    - setDialogTitle((LPCSTR)m_WindowName);
    + setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToAnsi(m_WindowName)).c_str());
             centerDialog();
     
             return 1; // 1 == we did not call SetFocus()
    Index: src/af/xap/xp/xap_Dlg_Insert_Symbol.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/xap/xp/xap_Dlg_Insert_Symbol.cpp,v
    retrieving revision 1.14
    diff -u -r1.14 xap_Dlg_Insert_Symbol.cpp
    --- src/af/xap/xp/xap_Dlg_Insert_Symbol.cpp 28 Jun 2003 16:38:03 -0000 1.14
    +++ src/af/xap/xp/xap_Dlg_Insert_Symbol.cpp 2 Sep 2003 15:58:32 -0000
    @@ -155,9 +155,10 @@
     void XAP_Dialog_Insert_Symbol::ConstructWindowName()
     {
             const XAP_StringSet * pSS = m_pApp->getStringSet();
    - XML_Char * tmp = NULL;
    + XML_Char * tmp = NULL;
    + UT_String sTitle(pSS->getValueUTF8(XAP_STRING_ID_DLG_Insert_SymbolTitle));
     
    - UT_XML_cloneNoAmpersands(tmp, pSS->getValue(XAP_STRING_ID_DLG_Insert_SymbolTitle, m_pApp->getDefaultEncoding()).c_str());
    + UT_XML_cloneNoAmpersands(tmp, sTitle.c_str());
             BuildWindowName((char *) m_WindowName,(char*)tmp,80);
             FREEP(tmp);
     }
    Index: src/wp/ap/win/ap_Win32Dialog_Goto.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Goto.cpp,v
    retrieving revision 1.14
    diff -u -r1.14 ap_Win32Dialog_Goto.cpp
    --- src/wp/ap/win/ap_Win32Dialog_Goto.cpp 9 Apr 2003 20:46:20 -0000 1.14
    +++ src/wp/ap/win/ap_Win32Dialog_Goto.cpp 2 Sep 2003 15:58:57 -0000
    @@ -34,6 +34,7 @@
     #include "ap_Win32Resources.rc2"
     #include "xap_Win32DialogHelper.h"
     #include "fv_View.h"
    +#include "ap_Win32App.h"
     
     /*****************************************************************/
     
    @@ -197,7 +198,7 @@
     
             // Update the caption
             ConstructWindowName();
    - SetWindowText(hWnd, m_WindowName);
    + SetWindowText(hWnd, (AP_Win32App::s_fromUTF8ToAnsi(m_WindowName)).c_str());
     
             // Disable the Go To button until something has been entered into the Number box
             EnableWindow( GetDlgItem(hWnd,AP_RID_DIALOG_GOTO_BTN_GOTO), FALSE );
    Index: src/wp/ap/win/ap_Win32Dialog_Lists.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Lists.cpp,v
    retrieving revision 1.36
    diff -u -r1.36 ap_Win32Dialog_Lists.cpp
    --- src/wp/ap/win/ap_Win32Dialog_Lists.cpp 1 Apr 2003 18:58:58 -0000 1.36
    +++ src/wp/ap/win/ap_Win32Dialog_Lists.cpp 2 Sep 2003 15:58:57 -0000
    @@ -41,6 +41,7 @@
     #include "xap_Win32Toolbar_Icons.h"
     #include "xap_Win32Dlg_FontChooser.h"
     #include "xap_Win32DialogHelper.h"
    +#include "ap_Win32App.h"
     
     #ifdef _MSC_VER
     // MSVC++ warns about using 'this' in initializer list.
    @@ -775,7 +776,7 @@
     void AP_Win32Dialog_Lists::_updateCaption()
     {
             ConstructWindowName();
    - _win32Dialog.setDialogTitle(getWindowName());
    + _win32Dialog.setDialogTitle((LPCSTR)(AP_Win32App::s_fromUTF8ToAnsi( getWindowName())).c_str());
     }
     
     void AP_Win32Dialog_Lists::_previewExposed()
    Index: src/wp/ap/win/ap_Win32Dialog_Replace.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Replace.cpp,v
    retrieving revision 1.26
    diff -u -r1.26 ap_Win32Dialog_Replace.cpp
    --- src/wp/ap/win/ap_Win32Dialog_Replace.cpp 11 Jul 2003 06:19:22 -0000 1.26
    +++ src/wp/ap/win/ap_Win32Dialog_Replace.cpp 2 Sep 2003 15:58:57 -0000
    @@ -36,6 +36,7 @@
     #include "ap_Win32Dialog_Replace.h"
     #include "xap_Win32DialogHelper.h"
     #include "ap_Win32Resources.rc2"
    +#include "ap_Win32App.h"
     
     /*****************************************************************/
     XAP_Dialog * AP_Win32Dialog_Replace::static_constructor(XAP_DialogFactory * pFactory,
    @@ -62,7 +63,7 @@
     
             // Update the caption
             ConstructWindowName();
    - SetWindowText(m_hWnd, m_WindowName);
    + SetWindowText(m_hWnd, (AP_Win32App::s_fromUTF8ToAnsi(m_WindowName)).c_str());
     
             SetFocus( GetDlgItem( m_hWnd,AP_RID_DIALOG_REPLACE_COMBO_FIND) );
     
    @@ -117,7 +118,7 @@
             {
                     // Update the caption
                     ConstructWindowName();
    - SetWindowText(m_hWnd, m_WindowName);
    + SetWindowText(m_hWnd, (AP_Win32App::s_fromUTF8ToAnsi(m_WindowName)).c_str());
     
                     SetWindowLong(m_hWnd, GWL_HWNDPARENT, (long)static_cast<XAP_Win32FrameImpl*>(pFrame->getFrameImpl())->getTopLevelWindow());
                     SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0,
    @@ -167,7 +168,7 @@
     
             // Update the caption
             ConstructWindowName();
    - SetWindowText(m_hWnd, m_WindowName);
    + SetWindowText(m_hWnd, (AP_Win32App::s_fromUTF8ToAnsi(m_WindowName)).c_str());
     
             iResult = ShowWindow( m_hWnd, SW_SHOW );
     
    Index: src/wp/ap/xp/ap_Dialog_Goto.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Dialog_Goto.cpp,v
    retrieving revision 1.18
    diff -u -r1.18 ap_Dialog_Goto.cpp
    --- src/wp/ap/xp/ap_Dialog_Goto.cpp 26 Feb 2003 21:13:40 -0000 1.18
    +++ src/wp/ap/xp/ap_Dialog_Goto.cpp 2 Sep 2003 15:58:59 -0000
    @@ -85,10 +85,11 @@
             const XAP_StringSet * pSS = m_pApp->getStringSet();
             XML_Char * tmp = NULL;
             UT_uint32 title_width = 33;
    - UT_XML_cloneNoAmpersands(tmp, pSS->getValue(AP_STRING_ID_DLG_Goto_Title));
    + UT_String sTitle(pSS->getValueUTF8(AP_STRING_ID_DLG_Goto_Title));
    + UT_XML_cloneNoAmpersands(tmp, sTitle.c_str() );
             BuildWindowName((char *) m_WindowName,(char*)tmp,title_width);
             FREEP(tmp);
    -}
    +}
     
     
     void AP_Dialog_Goto::setActiveFrame(XAP_Frame *pFrame)
    Index: src/wp/ap/xp/ap_Dialog_Lists.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Dialog_Lists.cpp,v
    retrieving revision 1.77
    diff -u -r1.77 ap_Dialog_Lists.cpp
    --- src/wp/ap/xp/ap_Dialog_Lists.cpp 16 Jul 2003 21:58:12 -0000 1.77
    +++ src/wp/ap/xp/ap_Dialog_Lists.cpp 2 Sep 2003 15:59:01 -0000
    @@ -975,7 +975,8 @@
             const XAP_StringSet * pSS = m_pApp->getStringSet();
             XML_Char * tmp = NULL;
             UT_uint32 title_width = 33;
    - UT_XML_cloneNoAmpersands(tmp, pSS->getValue(AP_STRING_ID_DLG_Lists_Title));
    + UT_String sTitle(pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Title));
    + UT_XML_cloneNoAmpersands(tmp, sTitle.c_str());
             BuildWindowName((char *) m_WindowName,(char*)tmp,title_width);
             FREEP(tmp);
     }
    Index: src/wp/ap/xp/ap_Dialog_Replace.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Dialog_Replace.cpp,v
    retrieving revision 1.43
    diff -u -r1.43 ap_Dialog_Replace.cpp
    --- src/wp/ap/xp/ap_Dialog_Replace.cpp 28 May 2003 15:05:35 -0000 1.43
    +++ src/wp/ap/xp/ap_Dialog_Replace.cpp 2 Sep 2003 15:59:01 -0000
    @@ -134,12 +134,14 @@
             // conditionally set title
             if (m_id == AP_DIALOG_ID_FIND)
             {
    - UT_XML_cloneNoAmpersands(tmp, pSS->getValue(AP_STRING_ID_DLG_FR_FindTitle));
    + UT_String sTitle(pSS->getValueUTF8(AP_STRING_ID_DLG_FR_FindTitle));
    + UT_XML_cloneNoAmpersands(tmp, sTitle.c_str());
                     title_width = 30;
             }
             else
             {
    - UT_XML_cloneNoAmpersands(tmp, pSS->getValue(AP_STRING_ID_DLG_FR_ReplaceTitle));
    + UT_String sTitle(pSS->getValueUTF8(AP_STRING_ID_DLG_FR_ReplaceTitle));
    + UT_XML_cloneNoAmpersands(tmp, sTitle.c_str());
                     title_width = 60;
             }
             BuildWindowName((char *) m_WindowName,(char*)tmp,title_width);



    This archive was generated by hypermail 2.1.4 : Tue Sep 02 2003 - 12:46:37 EDT