Author Topic: CodeBlock Unicode conversion  (Read 17161 times)

Offline cyberkoa

  • Plugin developer
  • Almost regular
  • ****
  • Posts: 145
    • http://
CodeBlock Unicode conversion
« 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.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
CodeBlock Unicode conversion
« Reply #1 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. :-/

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
CodeBlock Unicode conversion
« Reply #2 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 :))
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

takeshimiya

  • Guest
CodeBlock Unicode conversion
« Reply #3 on: June 15, 2005, 08:51:00 am »
_() for translatable text, and _T() for text that must not be translated.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
CodeBlock Unicode conversion
« Reply #4 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)

Offline cyberkoa

  • Plugin developer
  • Almost regular
  • ****
  • Posts: 145
    • http://
CodeBlock Unicode conversion
« Reply #5 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.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
CodeBlock Unicode conversion
« Reply #6 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 :)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
CodeBlock Unicode conversion
« Reply #7 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.
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
CodeBlock Unicode conversion
« Reply #8 on: June 15, 2005, 10:51:29 pm »
Thanks for the info! :)

Oh, any advises on which char types should be changed to wxChar ?

takeshimiya

  • Guest
CodeBlock Unicode conversion
« Reply #9 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'.

RShadow

  • Guest
CodeBlock Unicode conversion
« Reply #10 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 :)

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
CodeBlock Unicode conversion
« Reply #11 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.
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
CodeBlock Unicode conversion
« Reply #12 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.
Be patient!
This bug will be fixed soon...

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
CodeBlock Unicode conversion
« Reply #13 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...)
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

RShadow

  • Guest
CodeBlock Unicode conversion
« Reply #14 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.