[Lazarus] BidiMode improvments patch

Paul Ishenin webpirat at mail.ru
Mon May 25 23:55:33 CEST 2009


Zaher Dirkey wrote:
> First, I know i touch a sensitive code but we can discuss about it.
>
> 1 - Added TVisualCompont it is between TLCLComponent and and TControl,
> it has a properties and methods that have visual effect but still it
> unvisible at form. i will use it for BidiMode and ParentBidimode
> TMenu, TPopupMenu, TScreen, TTrayIcon and TPopupNotifier and any
> component need bidimode , TTheme and TToolbar...
>
> Now it can detect if the Component was inherited from TVisualComponent
> to make loop when BidiMode changed in the form/control.
>
> Remove duplicating of implement the same code in both TControl and
> TMenu and every TComponent need the BidiMode.
>
> I kept UseRightToLeftScrollBar in TControl
>
> TApplicationProperties must *not* inherit it from TVisualComponent it
> is like TApplication have no ParentBidiMode
>
> Fix: TLabel alignment when BidiMode = bdRightToLeft (compatible with Delphi)
>   
I would leave class hierarchi as is. It is not a big problem to copy 
property BidiMode to the TMenu, TTrayIcon or anything else.
> 2 - Add: in FlipChildren now flip the Anchors also.
>
> 3- Added: AutoFlipChildren to TApplication, now when change the
> BidiMode of Applcication it change the BidiMode of Forms and
> FlipChildren for it.
>   
This can Mattias review mostly.
> 4 - I removed this code from application.inc (see below) in
> TApplication.Create, because :
> * BidiMode of Application depend on developer choice not depend on
> system locale.
> * What if i built an English tools/application then run it in right to
> left system locale, it will be launch as RightToLeft while it is not
> designed for that.
> * If we use a multinlanguage, BidiMode changed depend on the language
> chosen by user, while every developer has own translation
> model/library not only GetText.
> it make confused with BidiMode of TForm when the form has ParentBidiMode
> Also it force to compile GetText while i am not use GetText.
> ---------------  this code i commented temporary
>  {$ifndef wince}// remove ifdef when gettext is fixed
>   GetLanguageIDs(LangDefault, LangFallback);
>   if LangDefault <> '' then
>     FBidiMode := BidiModeMap[IsRTLLang(LangDefault)]
>   else
>     FBidiMode := BidiModeMap[IsRTLLang(LangFallback)];
>   {$else}
>     FBidiMode := bdLeftToRight;
>   {$endif}
> --------------
>
> If you not like TVisualCompont i can merge the code of BidiMode of it
> to TLCLComponent, but not all components have ParentBidiMode Like as
> TScreen, TApplicationProperties for example.
>   
This is ok. That code was there temporary. It waited for better solution.

Best regards,
Paul Ishenin.




More information about the Lazarus mailing list