[Lazarus] Modal forms: block parent form or application

2011-01-29 Thread cobines
Hello,

I have two forms Form1 and Form2. Form1 is MainForm with
ShowInTaskbar=stDefault and Form2 has ShowInTaskbar=True, so they both
have taskbar buttons, I treat them as separate windows. I show a modal
form from Form2 which blocks the whole application. Is it possible to
have it block only Form2, so I can still activate and work in Form1?

--
cobines

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Modal forms: block parent form or application

2011-01-29 Thread zeljko
On Saturday 29 of January 2011 09:29:02 cobines wrote:
 Hello,
 
 I have two forms Form1 and Form2. Form1 is MainForm with
 ShowInTaskbar=stDefault and Form2 has ShowInTaskbar=True, so they both
 have taskbar buttons, I treat them as separate windows. I show a modal
 form from Form2 which blocks the whole application. Is it possible to
 have it block only Form2, so I can still activate and work in Form1?

There are 2 kinds of modality (at least under qt, but can be applied to any 
X11 app ... don't know for win32 or mac how to do that).
1.Window modal
2.App modal
So, with proper implementation it's possible to make
1.Form modal for 1 form eg. parent form
2.Form modal for application (usual behaviour).

zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Package: LCL 1.0.1 Unit not found: Menus

2011-01-29 Thread Mattias Gaertner
 


Marcos Douglas m...@delfire.net hat am 28. Januar 2011 um 22:42 geschrieben:

 2011/1/28 Mattias Gaertner nc-gaert...@netcologne.de:
 
 
  Marcos Douglas m...@delfire.net hat am 28. Januar 2011 um 20:53 
  geschrieben:
 
  On Fri, Jan 28, 2011 at 3:38 PM, Marcos Douglas m...@delfire.net wrote:
   On Fri, Jan 28, 2011 at 3:37 PM, Marcos Douglas m...@delfire.net wrote:
   Hi,
   I updated my Lazarus from /trunk and when I start it... error:
   Package: LCL 1.0.1 Unit not found: Menus  {Abort or Ignore}
 
 
 
  The old lazarus did not support registering units for other packages.
 
  You must use a recent IDE or compile via
 
 
 
  make.exe clean all
 
  lazbuild.exe --build-ide

 Recent IDE? 
For example the daily snapshot.
 

 But I was using /trunk to Lazarus and FPC 2.5.1. 

 I think the problem was because the new LCL 1.0 package, didn't? 

  Now, I'm using the Lazarus from fixes_0_9_30, ie, before the new LCL
 1.0 package, right? I found no erros. 
No problem. You can use that too.
Note: the 0.9.30 IDE can not compile trunk. You have to use make.
 
 
Mattias
 --
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Mattias Gaertner
 


Hans-Peter Diettrich drdiettri...@aol.com hat am 29. Januar 2011 um 07:05
geschrieben:

 Maxim Ganetsky schrieb:

  I really don´t know why these files was standardized with pb instead
  of pt.
 
  Please check if LazDE translation works when you rename its .pb.po file
  to .pt_BR.po.
 
  If it works, we can solve all these problems by renaming all .pb.po
  files to .pt_BR.po.

 Why a distinction between Brasilian and other Portuguese here?

 How are en_US, en_GB etc. handled? 
The algorithm first searches for the en_US, then en, finally the default
translation.
Because the main language id 'pt' differ from 'pb' a different po file is used.
Maybe pb could be used as fallback for pt and vice versus in translations.pas.
 
Mattias
 --
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Modal forms: block parent form or application

2011-01-29 Thread Paul Ishenin

29.01.2011 15:29, cobines wrote:

Hello,

I have two forms Form1 and Form2. Form1 is MainForm with
ShowInTaskbar=stDefault and Form2 has ShowInTaskbar=True, so they both
have taskbar buttons, I treat them as separate windows. I show a modal
form from Form2 which blocks the whole application. Is it possible to
have it block only Form2, so I can still activate and work in Form1?

Yes. You don't need a modal form then.

1. Change your modal form to be a regular form with PopupParent = Form2.
2. Disable Form2 when you show your popup form.

Of course the logic requires a small reimplementation because you can't 
use ModalResult and Show is not a blocking method as ShowModal.


Best regards,
Paul Ishenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Marcelo B de Paula
As far as i know, reading Lazarus wiki, these files were standardized as two 
letters for country (xx.po).
It seems that the idea was not to have language variations.
Today, we already have some variations implemented, like af_ZA and zn_CN

So, what to follow. What´s stated on wiki or implementing language variations ?

I see the following possibilities:

- Review the 2 letters standard,
- Release implementation of language variations (IDETranslations will be 
updated for every new language variation),
- Normalize locale returns in LCLProc to map the correct 2 letters. Currently 
the code for Linux returns only the first 2 letters of Locale (ex. pt_BR 
returns pt)
  - Any portuguese language variations here could be solved only mapping pt 
to pb. Or we can rename the files from pb.po to pt.po
  - Other languages have to follow the same rule. So, en_US and en_GB will 
be simple en, thus mapping to en.po files.

Regards,

Marcelo

  - Original Message - 
  From: Mattias Gaertner ; Mattias Gaertner 
  To: Lazarus mailing list ; Lazarus mailing list 
  Sent: Saturday, January 29, 2011 6:40 AM
  Subject: Re: [Lazarus] DefaultTranslator,LCLGetLanguageIDs and Portuguese 
language trouble...





  Hans-Peter Diettrich drdiettri...@aol.com hat am 29. Januar 2011 um 07:05 
geschrieben:

   Maxim Ganetsky schrieb:
  
I really don´t know why these files was standardized with pb instead
of pt.
   
Please check if LazDE translation works when you rename its .pb.po file
to .pt_BR.po.
   
If it works, we can solve all these problems by renaming all .pb.po
files to .pt_BR.po.
  
   Why a distinction between Brasilian and other Portuguese here?
  
   How are en_US, en_GB etc. handled? 


  The algorithm first searches for the en_US, then en, finally the default 
translation.

  Because the main language id 'pt' differ from 'pb' a different po file is 
used.

  Maybe pb could be used as fallback for pt and vice versus in translations.pas.



  Mattias


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Maxim Ganetsky

29.01.2011 5:27, Marcelo B de Paula пишет:


Yes, it works. But this not solve our problem. If i do the same with
lazaruside.pb.po it disrupts the IDE translations.
IDE itself maps the .pb.po files.


Changed. I have renamed .pb.po files to .pt_BR.po. Please test.


See attached image.
I still think it would be better to put a line of code in lclproc.pas.


No.

--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Alexsander Rosa
Brazilian portuguese is very different from portuguese portuguese. It's
not US-GB difference, mostly about slight spelling variations like colour
and color. In Brazil FILE and SCREEN are arquivo and tela; in Portugal
they are ficheiro and ecrã.

2011/1/29 Hans-Peter Diettrich drdiettri...@aol.com

 Maxim Ganetsky schrieb:


  I really don´t know why these files was standardized with pb instead
 of pt.


 Please check if LazDE translation works when you rename its .pb.po file to
 .pt_BR.po.

 If it works, we can solve all these problems by renaming all .pb.po files
 to .pt_BR.po.


 Why a distinction between Brasilian and other Portuguese here?

 How are en_US, en_GB etc. handled?

 DoDi



 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




-- 
Atenciosamente,
Alexsander da Rosa
Linux User #113925

Extremismo na defesa da liberdade não é defeito.
Moderação na busca por justiça não é virtude.
-- Barry Goldwater
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Felipe Monteiro de Carvalho
On Sat, Jan 29, 2011 at 1:34 PM, Maxim Ganetsky gan...@narod.ru wrote:
 Changed. I have renamed .pb.po files to .pt_BR.po. Please test.

Will this change cause that pt_PT users end up with the english
translations by default? If there is no pt_PT translation, then it
should default to pt_BR. Maybe you should have renamed to pt.po
instead?

 Brazilian portuguese is very different from portuguese portuguese. It's not 
 US-GB difference, mostly about slight spelling variations
 like colour and color. In Brazil FILE and SCREEN are arquivo and tela; in 
 Portugal they are ficheiro and ecrã.

That's from old times when people didn't care about keeping the
language united. Now we have the spelling reform and in wikipedia for
example there is no pt_PT and pt_BR. The spelling reform also says
that in the future we should have a common dictionary of preferred
technical terms.
-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Hans-Peter Diettrich

Mattias Gaertner schrieb:


   If it works, we can solve all these problems by renaming all .pb.po
   files to .pt_BR.po.
 
  Why a distinction between Brasilian and other Portuguese here?
 
  How are en_US, en_GB etc. handled?

 

The algorithm first searches for the en_US, then en, finally the 
default translation.


Because the main language id 'pt' differ from 'pb' a different po file 
is used.


That's why I asked for the reason for the special handling of pt_BR, 
with the *unsystematic* shortcut pb.


Maybe pb could be used as fallback for pt and vice versus in 
translations.pas.


IMO pb simply should be removed, and the Brasilian users can vote for 
their own pt_BR translation, if this ever makes sense.


DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Marcelo B de Paula

Please, revert this submit. This will not work.
By renaming the files you disrupted the IDE translations.

Before taking any actions, we must decide the best thing to do.

Renaming the files, as you did, will frustrate our collegues from Portugal, 
since their locale will not find the correct

files and they will end up with the english version.

Did you read my previous post ?

Option 01: Rename the files to *.pt.po instead of  pt_BR.po
 Change IDETranslations.pas ( Portuguese ) pb - pt

Option 02: Make a statement on Lazarus wiki to permit language variations.
 Brazilizan Portuguese files will be renamed to .pt_BR.po
 Portugal Portuguese should provide their own translations 
files (.pt_PT or whatever.)
 Change IDETranslations to identify Portuguese Brazilian, 
Portuguese Portugal, .
 Modify LCLProc (Linux) to return the entire Locale 
variable, instead of Copy(1,2)..


Option 03: Do not touch any files or any code, except LCLProc to return 
locale which starts with pt to pb.

 Do not change what is stated on wiki.
 Do not permit language variations. Mantain the already 
implemented rule. So Portugal Portuguese will have to use

 Brazilian Portuguese language files.

Please, think on this with care. This is not a matter to rename files only. 
This is about to change a rule.

Will be great if other Lazarus Team take a look on this, before any actions.

Regards,

MarceloB. Paula



29.01.2011 13:34, Maxim Ganetsky wrote:


Yes, it works. But this not solve our problem. If i do the same with
lazaruside.pb.po it disrupts the IDE translations.
IDE itself maps the .pb.po files.


Changed. I have renamed .pb.po files to .pt_BR.po. Please test.


See attached image.
I still think it would be better to put a line of code in lclproc.pas.


No.

--
Best regards,
 Maxim Ganetsky  mailto:ganmax at narod.ru




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Felipe Monteiro de Carvalho
I vote for Option 1

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Marcelo B de Paula

After thinking and writing the options,

I will vote to Option 01 too.


Marcelo B. Paula

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] cross-arm-wince buildbot is working or not?

2011-01-29 Thread bobby

Hi,

what happened to the wince/arm crosscompiler snapshots?
The last one is 3 days old.

Dunno if it is a must to have the same revision of both the 
crosscompiler and compiler, but I can't compile my WinCE apps now.
I got some message about ppu files being older than compiler (or 
something like that).


I want to test the latest Lazarus snapshot to see if a bug is solved:
http://bugs.freepascal.org/view.php?id=18537


regards
bobby

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Paulo Costa

On 29/01/2011 15:45, Felipe Monteiro de Carvalho wrote:

Brazilian portuguese is very different from portuguese portuguese. It's not 
US-GB difference, mostly about slight spelling variations
like colour and color. In Brazil FILE and SCREEN are arquivo and tela; in Portugal they are 
ficheiro and ecrã.


That's from old times when people didn't care about keeping the
language united. Now we have the spelling reform and in wikipedia for
example there is no pt_PT and pt_BR. The spelling reform also says
that in the future we should have a common dictionary of preferred
technical terms.


Not true! While the spelling is unified, the words that we use for each 
case are completely different.


Examples:

English  - Portuguese (European) - Portuguese (Brazilian)

Application - Aplicação - Aplicativo
Desktop publishing - Edição Electrónica - Editoração eletrônica
Save - Gravar - Salvar
Spreadsheet - Folha de cálculo - Planilha eletrônica
Database  Base de dados - Banco de dados
Mouse - Rato - Mouse
etc...

And wikipedia is very lame in having only one Portuguese version, many 
times it becomes very Brazilian centered...


Paulo Costa

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Felipe Monteiro de Carvalho
On Sat, Jan 29, 2011 at 7:11 PM, Paulo Costa p...@fe.up.pt wrote:
 Not true! While the spelling is unified, the words that we use for each case
 are completely different.

http://pt.wikipedia.org/wiki/Acordo_Ortográfico_de_1990#Vocabul.C3.A1rio_comum

-- 
Felipe Monteiro de Carvalho

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Maxim Ganetsky

29.01.2011 20:33, Marcelo B de Paula пишет:

Please, revert this submit. This will not work.
By renaming the files you disrupted the IDE translations.


Your translation is Brazilian Portuguese, so my commit will work OK.
When there will be proper Portuguese translation it would be added as 
appropriate.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread S. M. Falcao

Hello all,

The Language is the same but the each side has many prefered local words 
much specialy in computer related translations:


brazilians tend to adapt original expressions for their use, like:

Delete   - Deletar
Video Monitor- Monitor de video
Format - Formatar
Mouse  - Mouse
etc...

while portuguese prefer create their own portuguese words

IMO two different translations are the best option, unfortunately my 
knoledge do not permits me to go trough technical issues yet




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Marcelo B de Paula
Please, take a look at /Lazarus/ide/IDETranslations.pas, function 
GetLazarusLanguageLocalizedNames, line 110 and

tell me how it will work.
I see no pt_BR or pt_PT or other portuguese language reference there. Simple 
'pb'.
How this function and associate functions will guess that the files to 
loaded are the .pt_BR.po ones.


Regards,

Marcelo B Paula.

29.01.2011 23:21, Maxim Ganetsky wrote:

Please, revert this submit. This will not work.
By renaming the files you disrupted the IDE translations.


Your translation is Brazilian Portuguese, so my commit will work OK.
When there will be proper Portuguese translation it would be added as
appropriate.

--
Best regards,
 Maxim Ganetsky  mailto:ganmax at narod.ru




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Maxim Ganetsky

30.01.2011 2:41, Marcelo B de Paula пишет:

Please, take a look at /Lazarus/ide/IDETranslations.pas, function
GetLazarusLanguageLocalizedNames, line 110 and
tell me how it will work.


Please update your Lazarus SVN copy. Line 110 of this file hase exactly 
pt_BR value since r29245.



I see no pt_BR or pt_PT or other portuguese language reference there.
Simple 'pb'.
How this function and associate functions will guess that the files to
loaded are the .pt_BR.po ones.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Modal forms: block parent form or application

2011-01-29 Thread cobines
2011/1/29 zeljko zel...@holobit.net:
 On Saturday 29 of January 2011 09:29:02 cobines wrote:
 Hello,

 I have two forms Form1 and Form2. Form1 is MainForm with
 ShowInTaskbar=stDefault and Form2 has ShowInTaskbar=True, so they both
 have taskbar buttons, I treat them as separate windows. I show a modal
 form from Form2 which blocks the whole application. Is it possible to
 have it block only Form2, so I can still activate and work in Form1?

 There are 2 kinds of modality (at least under qt, but can be applied to any
 X11 app ... don't know for win32 or mac how to do that).
 1.Window modal
 2.App modal
 So, with proper implementation it's possible to make
 1.Form modal for 1 form eg. parent form
 2.Form modal for application (usual behaviour).

I also think it is like that on GTK2, at least that's how I saw it in
one application (medit).

In Windows only parent window (and all its children I think) is
blocked, since each window is independent. For example, you can create
two windows and in both show modal dialog boxes and switch between
them via Alt-Tab, yet still have a third window completely
operational.

--
cobines

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Marcelo B de Paula
So, our folks from Portugal and other portuguese language countries are on 
their own now !!


Sorry guys, i did what i could. You will have some work to do now

Thanks you all,

Marcelo B. Paula.

29.01.2011 23:47, Maxim Ganetsky wrote:

Please, take a look at /Lazarus/ide/IDETranslations.pas, function
GetLazarusLanguageLocalizedNames, line 110 and
tell me how it will work.


Please update your Lazarus SVN copy. Line 110 of this file hase exactly
pt_BR value since r29245.


I see no pt_BR or pt_PT or other portuguese language reference there.
Simple 'pb'.
How this function and associate functions will guess that the files to
loaded are the .pt_BR.po ones.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Maxim Ganetsky

30.01.2011 3:07, Marcelo B de Paula пишет:

So, our folks from Portugal and other portuguese language countries are
on their own now !!


Yes, but keep in mind that our Portuguese fellows can base their efforts 
on your work.




Sorry guys, i did what i could. You will have some work to do now

Thanks you all,

Marcelo B. Paula.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] [SOLVED] Re: [fpc-pascal] ord() of a string index returns wrong value.

2011-01-29 Thread Pew (piffle.the.cat)

Hi Jonas,

[ and cross-posted to lazarus-list ]

On 01/30/2011 04:59 AM, Jonas Maebe wrote:


On 29 Jan 2011, at 18:34, Pew (piffle.the.cat) wrote:


On 01/30/2011 03:13 AM, Jonas Maebe wrote:


On 29 Jan 2011, at 17:05, Pew (piffle.the.cat) wrote:


I have a problem where ord() of a character (single string index) returns the 
wrong value. the character is a 'o' which is a 111 value but the ord of it 
returns 121 into an integer. What am I doing wrong?


Is that Lazarus code? If so, the string will be utf-8 encoded and you cannot 
assume that str[i] corresponds to the i'th character of the string. Even if 
it's not Lazarus code, it could still be utf-8 encoded depending on what the 
source of the string is and/or the locale settings of the system.


Yes, it is Lazarus code. Okay so I think that we have found the problem. Now 
how do I fix it?


If you want to access individual characters, it's probably the easiest to 
convert it to a unicodestring first:

var
   utxt: unicodestring;
begin
   ..
   utxt:=utf8decode(txt);
   { now perform all operations on utxt instead of on txt }
   ..
end;


I will use this code (listed above) in preference to the latter code, as 
you state the latter code has a higher probability of data loss.




Note:
1) even in UTF-16 (which is the encoding of a unicodestring), a single character may take 
up more than one code point, so this is not 100% safe yet either. If you want a guarantee 
to string[i] corresponding 1 single character, you
a) have to normalize the unicode string to remove decomposed characters, and 
then
b) convert it to an UTF-32 string. You can use this routine for the 
unicodestring to UTF-32 conversion: 
http://www.freepascal.org/docs-html/rtl/system/unicodestringtoucs4string.html 
(note that UCS4String is a dynamic array, not a string type)

I don't know whether Lazarus contains platform-indepdendent wrappers for a). 
FPC itself at least doesn't at this time.

2) you will have to make sure that your Rects_low and LastCharacterDefined are 
defined in terms of UTF-16. Unless they are all plain ASCII characters (i.e., with an ordinal 
value=127), using a simple range is unlikely to work correctly.


This is how Rect_low (=0) and LastCharacterDefined (byte) are declared.

unit uFixedWidthFonts;

{$MODE Delphi}

interface

uses
  graphics, ExtCtrls, SysUtils, Dialogs, SDL;

const
  Rects_low = 0;
  Rects_high = 255;

type
  PFixedFont = ^TFixedFont;
  TFixedFont = object
  private
Image: TBitmap;
// [ALVAROGP] Rects redefined as array of class TSDL_Rect
{
Rects: array[Rects_low..Rects_high] of PSDL_Rect;
}
Rects: array[Rects_low..Rects_high] of TSDL_Rect;
  public
LastCharacterDefined: byte;
TransparentColor,
  TextColor,
  BackgroundColor: Tcolor;
// this is used only when UseTransparentBackground is false
Char_width,
  Char_height: byte; // default is 8x8
ReverseVideo: Boolean; // default =false
HorizontalGap: byte;
// Horizontal Gap between characters in Pixels -- default =1
UseTransparentBackground: Boolean;

constructor Initialize;
procedure LoadFont(const Fontfile: string);
procedure FreeUpAll;
destructor Finalize;
procedure WriteText2(x, y: integer; Txt: string;
  var PaintBox1: TPaintBox);
  end;

var
  Font1: PFixedFont;




A simpler alternative, with fairly high chances of data loss, is something like 
this:

var
   mytxt: ansistring;
begin
   mytxt:=utf8decode(txt);
   { now perform all operations on mytxt instead of on txt }
   ...
end;

This will first decode the UTF-8 encoded string to an UTF-16 encoded unicodestring, and 
then convert this unicodestring to a plain ansistring. Data loss can happen in case the 
string contains characters that cannot be represented using the ansi (~ 
default) code page of the system the program is running on. Such non-representable 
characters will be replaced by '?'.



I could have used your above code as unknown characters appearing as '?' 
characters is acceptable.




In summary, unless you are an expert at working with unicode, you should not 
work with such string at the character/code point level, and use higher level 
helpers instead to achieve what you want to do. You may want to ask for help 
about that on the Lazarus mailing list (subscription information at 
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus), by describing 
what exactly it is you want to do rather than showing how you are currently 
doing it.


I am not a unicode expert, but I am interested to learn new skills.

Yes, I am a member of the Lazarus list. For some reason I got Lazarus 
and Free Pascal confused and perhaps wrongly assumed that this question 
was better suited to the FP list.





Jonas___


Thank you.

Peter / pew


fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



--
___
Lazarus 

Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Felipe Monteiro de Carvalho
No coments on solution 1?

On Jan 29, 2011 11:21 PM, Maxim Ganetsky gan...@narod.ru wrote:

29.01.2011 20:33, Marcelo B de Paula пишет:



 Please, revert this submit. This will not work.
 By renaming the files you disrupted the IDE t...
Your translation is Brazilian Portuguese, so my commit will work OK.
When there will be proper Portuguese translation it would be added as
appropriate.

-- 
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru



--
___
Lazarus mailing list
laza...@lists.lazarus.free...
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DefaultTranslator, LCLGetLanguageIDs and Portuguese language trouble...

2011-01-29 Thread Felipe Monteiro de Carvalho
Your argument is that regional differences are so important that people in
Portugal, Angola, green cape and east timor are better of with English?
Thats completely against the spirit of the reform, which was approved in the
parlament of all involved countries.

On Jan 30, 2011 12:15 AM, Maxim Ganetsky gan...@narod.ru wrote:

30.01.2011 3:07, Marcelo B de Paula пишет:



 So, our folks from Portugal and other portuguese language countries are
 on their own now !!

...
Yes, but keep in mind that our Portuguese fellows can base their efforts on
your work.




 Sorry guys, i did what i could. You will have some work to do now

 Thanks you all,

 ...

-- 
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
__...
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus