Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: cyberkoa on June 15, 2005, 12:28:59 am

Title: CodeBlock Unicode conversion
Post by: cyberkoa on June 15, 2005, 12:28:59 am
Hi all,

   I have come across some thread that requesting Unicode version of codeblock.

   Mandrav and Rick are busy with the development of CodeBlock , and Mandrav have said before that there are too many code need to be modified.

  I really would like to see the future codeblock running in unicode , and I believe some of you have the same idea.

I am not sure how to convert all the source code to unicode-compatible but I read from a thread , the basic thing we need to do is use wxT() to convert all the literal string.

I believe everybody can helps in this but we need a standard way of modification so that in the future Mandrav and Rick can easily get our code to use in the newer version.


First of all , we need
 1)The support of the developers of CodeBlock on this proposal.
 2)Write all future code as unicode compatible as possible.

Secondly, we need standard in some aspect.
 1)The standard of the wxWidget compilation , version and option (I use 2.6.1 , same option to compile , except UNICODE=1)
 2)The standard way of marking modified code, this is a must , if not how the developer can know which code we have modified.
    (I suggest to use //UNICODE S  for start block and //UNICODE E for end block)

 

And I hope that Madrav or Rick can help to create a shortcut in CodeBlock , so that we can change it easily .

 For example ,

     wxMessageBox("Testing");

   We highlight "Testing" , press a shortcut key , it will change to wxT("Testing") .

In fact I tried to hack in the code (in autocomplete.cpp) to do this shortcut myself but fail   :oops:

I shall try to start this when I have time in company, at home , I do wxSmith instead.
Title: CodeBlock Unicode conversion
Post by: rickg22 on June 15, 2005, 01:48:35 am
i believe there are shorter macros for this. Instead of wxT(), use _T(). Additionally, the wxT is only to be used for display purposes. On all other cases, we should use _().

I'm not sure if search-and-replace with regexp's would do it. But we'd have to be careful with escaped quotes. :-/
Title: CodeBlock Unicode conversion
Post by: David Perfors on June 15, 2005, 08:49:48 am
I think you can't trust search-and-replace, there are to many ways to make a string that have to be viewed.But if we only have to use _(), I can do some work for you. (after I have tried it first :))
Title: CodeBlock Unicode conversion
Post by: takeshimiya on June 15, 2005, 08:51:00 am
_() for translatable text, and _T() for text that must not be translated.
Title: CodeBlock Unicode conversion
Post by: rickg22 on June 15, 2005, 05:38:11 pm
Are you sure about that? I thought it was the opposite :( Do you have the specific url that says so? (so we can finally settle this question)
Title: CodeBlock Unicode conversion
Post by: cyberkoa on June 15, 2005, 05:49:49 pm
I have read the wxwidgets documentation on writing unicode program ..

This link give us a useful information
http://wiki.wxwidgets.org/wiki.pl?WxWidgets_Source_Oddities

I think takeshimiya is right.
Title: CodeBlock Unicode conversion
Post by: rickg22 on June 15, 2005, 06:56:26 pm
Oh,I see. Until we're translating into other languages, we should use _T() always. Thanks for the info :)
Title: CodeBlock Unicode conversion
Post by: mandrav on June 15, 2005, 09:14:49 pm
Quote from: rickg22
Oh,I see. Until we're translating into other languages, we should use _T() always.

No, this is the correct way:
Quote from: takeshimiya
_() for translatable text, and _T() for text that must not be translated.

Everything that will possibly need to be translated (i.e. every text presented to the user), will be wrapped with _().
_T() will be used only for hardcoded strings like paths, filenames, etc.

Yiannis.
Title: CodeBlock Unicode conversion
Post by: rickg22 on June 15, 2005, 10:51:29 pm
Thanks for the info! :)

Oh, any advises on which char types should be changed to wxChar ?
Title: CodeBlock Unicode conversion
Post by: takeshimiya on June 16, 2005, 11:00:53 am
I think I should have to be more explicit. :)

Example for text:
wxChar im_a_character = _T('f');

Example for not text (not character):
char im_a_byte = 254;
but perhaps better would be to use:
byte im_a_byte = 254;
so it's clear that it's a byte and not a character.

but yes rickg22, the _() and _T() name convention is confusing, as one would think that the T in the _T() means Translatable or Translate.
So to memorize I put a 'logic not' of what would be logical :D and if I see _T() I think in 'Not Translatable'.
Title: CodeBlock Unicode conversion
Post by: RShadow on July 09, 2005, 08:51:11 am
I have noticed the CVS version of C::B has most of the string literals wrapped in _();  However C::B still fails to compile against a unicode version of wxWidgets.   I'm starting to fix a lot of the unicode compile errors that still exist, however I'm wondering if anybody is activily working on this?  I don't want to start doing work that is already being done :)
Title: CodeBlock Unicode conversion
Post by: David Perfors on July 09, 2005, 09:14:12 am
Unless I had plans to work on it, I never did :oops: I hope you all could forgive me, I had other things to do.
Title: CodeBlock Unicode conversion
Post by: mandrav on July 09, 2005, 09:46:32 am
Quote from: RShadow
I have noticed the CVS version of C::B has most of the string literals wrapped in _();  However C::B still fails to compile against a unicode version of wxWidgets.   I'm starting to fix a lot of the unicode compile errors that still exist, however I'm wondering if anybody is activily working on this?  I don't want to start doing work that is already being done :)

Mispunt was supposed to do it, but as you see he's been busy lately.
So, feel free to work on it :)

Yiannis.
Title: CodeBlock Unicode conversion
Post by: David Perfors on July 09, 2005, 11:45:50 am
One of the reasons I put it aside was that I was unable to compile the sdk (which doesn't need the unicode support as far as I know). I get errors at the xrc part:
Code
C:\Development\wxbuild\2.4.2\lib/libwxxrc.a(xmlres.o):xmlres.cpp:(.text$_ZN12wxObjectList10CreateNodeEP10wxNodeBaseS1_PvRK9wxListKey[wxObjectList::CreateNode(wxNodeBase*, wxNodeBase*, void*, wxListKey const&)]+0x42): variable 'vtable for wxObjectListNode' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
C:\Development\wxbuild\2.4.2\lib/libwxxrc.a(xmlres.o):xmlres.cpp:(.text+0x7d1): variable 'vtable for wxObject' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.

(just the first two lines)

I don't know if you get the same message RShadow? I only get it on windows (I thought...)
Title: CodeBlock Unicode conversion
Post by: RShadow on July 09, 2005, 11:49:49 am
Quote from: mispunt
One of the reasons I put it aside was that I was unable to compile the sdk (which doesn't need the unicode support as far as I know). I get errors at the xrc part:
Code
C:\Development\wxbuild\2.4.2\lib/libwxxrc.a(xmlres.o):xmlres.cpp:(.text$_ZN12wxObjectList10CreateNodeEP10wxNodeBaseS1_PvRK9wxListKey[wxObjectList::CreateNode(wxNodeBase*, wxNodeBase*, void*, wxListKey const&)]+0x42): variable 'vtable for wxObjectListNode' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
C:\Development\wxbuild\2.4.2\lib/libwxxrc.a(xmlres.o):xmlres.cpp:(.text+0x7d1): variable 'vtable for wxObject' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.

(just the first two lines)

I don't know if you get the same message RShadow? I only get it on windows (I thought...)


I have not got those errors (at least yet).. right now all my errors are in cbeditor (mainly the reading and setting of config variables.  They are not displayed but *anything* in double or single quotes needs to be _()'ed.

Note: But the main reason I'm so interested in unicode support is beacuse of xrc... all the XRC editors I know of for linux (XRCed and wxGlade) require a unicode version of wxGTK.. so xrc has to be unicode compatible.. but I will investigate further.
Title: CodeBlock Unicode conversion
Post by: David Perfors on July 09, 2005, 11:53:58 am
I think you don't have the same errors because you are using 2.6.1 right? I am still using 2.4.2 :D
Title: CodeBlock Unicode conversion
Post by: RShadow on July 09, 2005, 01:54:35 pm
Quote from: mispunt
I think you don't have the same errors because you are using 2.6.1 right? I am still using 2.4.2 :D


lol.. both really.  I'm using 2.6.1 primarly for the SCon's build scripts because my main goal was to due away with makefiles and be able to choose the wxversion... but the unicode issue I'm using 2.4.x .. but I might not have experinced  your error because I have yet to get to the linking stage ;p .. still working on getting the source files to compile..