Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Juha Manninen via lazarus
On Tue, Feb 23, 2021 at 7:38 PM Bart via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> I have copied in the past some of the TMaskEdit logic and methods to
> the MaskUtils unit.
>

Ok, the TEditMask thing was in MaskUtils. I didn't pay attention.
How about TMask? Does it have the same syntax as TMaskEdit or are they
different?

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Bart via lazarus
On Tue, Feb 23, 2021 at 3:27 PM Juha Manninen via lazarus
 wrote:

> Does it mean the mask syntax is different? I found this:
>  http://docwiki.embarcadero.com/Libraries/Sydney/en/System.MaskUtils.TEditMask
> Is TEditMask the same as TMaskEdit? Or is TEditMask used for TMask? Can you 
> please explain it so that I understand?
> Is it all documented somewhere?

I have copied in the past some of the TMaskEdit logic and methods to
the MaskUtils unit.
Things like SplitEditMask etc.
So, basically the behave the same (on 1-byte ANSI strings).

The code in MaskEdit unit is the father of the code in MaskUtils.
From a Lazarus point of view, the code in MaskEdit is leading.
Fpc to some extent follows what we do here.

I do NOT want to use the code from MaskUtils in the MaskEdit unit, for
reasons I explained in my previous code.

-- 
Bart
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread José Mejuto via lazarus

El 23/02/2021 a las 10:41, Juha Manninen via lazarus escribió:
>
> Masks in LazUtils has a slow implementation.
> I planned to optimize it but now I realize we may have overlapping code.
> Q: Are Masks (LazUtils) and FPMasks (fpindexer) compatible?
> If they are, we should dump the LazUtils Masks and use code from 
FPC's libs.

Hello,

fpMasks and Masks are quite the same from my point of view, in fact 
fpMasks (if my memory serves me) have various problems with UTF8 handling.


I'll send you (direct mail) my TMaskAnsi, TMaskUTF8 and TMaskUnicode so 
you can do whatever you want with them :-)


Based in RTL's encoding you can alias TMask to any of them.


--

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Juha Manninen via lazarus
On Tue, Feb 23, 2021 at 2:54 PM Bart via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> MaskEdit is a LCL control and hence has nothing to do in fpc.
>

I am not suggesting to move MaskEdit to FPC libs obviously.


I have in the past copied bits of TMaskEdit to a related fpc unit
> (cannot remeber exactly which), so that they work the same (setting
> and removing masks IIRC), with the exception that TMaskEdit does this
> on UTF-8, while the fpc unit assumes 1-byte ANSI encoding (so it won't
> work on UTF-8).
> Given the release cycle of fpc, I would strongly advise to have this
> code on "our side" (Lazarus), so bugs can be eliminated much faster.
>
> The Masks unit is not related to TMaskEdit.
>

Does it mean the mask syntax is different? I found this:

http://docwiki.embarcadero.com/Libraries/Sydney/en/System.MaskUtils.TEditMask
Is TEditMask the same as TMaskEdit? Or is TEditMask used for TMask? Can you
please explain it so that I understand?
Is it all documented somewhere?


For the Masks unit: the same UTF-8 problems exist with it's fpc
> counterpart IIRC (did not study the code recently).
> So, I would like to keep it "here" as well.
>

Yes, I realized it must stay in LazUtils. Iterating codepoints is needed.
FPMasks is good for ASCII only despite having UTF8String type.
Does Michael have a plan for that unit?

Fortunately I found a unit test for Masks unit under LCL tests directory. I
moved it under LazUtils in r64653.
I will add tests for multibyte codepoint text. Then optimizing TMask will
be safe. Nothing can go wrong... :)

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Bart via lazarus
On Tue, Feb 23, 2021 at 10:41 AM Juha Manninen via lazarus
 wrote:

> LazUtils has unit Masks with classes TMask and TMaskList.
> FPC's packages/fpindexer has unit FPMasks also with classes TMask and 
> TMaskList.

MaskEdit is a LCL control and hence has nothing to do in fpc.
I have in the past copied bits of TMaskEdit to a related fpc unit
(cannot remeber exactly which), so that they work the same (setting
and removing masks IIRC), with the exception that TMaskEdit does this
on UTF-8, while the fpc unit assumes 1-byte ANSI encoding (so it won't
work on UTF-8).
Given the release cycle of fpc, I would strongly advise to have this
code on "our side" (Lazarus), so bugs can be eliminated much faster.

The Masks unit is not related to TMaskEdit.
For the Masks unit: the same UTF-8 problems exist with it's fpc
counterpart IIRC (did not study the code recently).
So, I would like to keep it "here" as well.

-- 
Bart
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Juha Manninen via lazarus
On Tue, Feb 23, 2021 at 12:56 PM Juha Manninen 
wrote:

> Oops, now I understand that FPMasks does not really support Unicode.
> Type UTF8String only converts encoding automatically when assigning values.
> There is no code to identify codepoints.
> The LazUtils Masks iterates codepoints, although in a very slow way.
> Has anybody tested FPMasks with multibyte-codepoints? I guess it may not
> work correctly.
>

I am not sure if iterating multibyte codepoints is even necessary. I must
create a unit test.
Does anybody have a list of use cases or some example code?
The Embarcadero documentation is very plain.
It is difficult to find comprehensive examples. I must confess I have not
used TMask or TMaskList myself.

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Juha Manninen via lazarus
A related thing. I am confused with different mask classes.
Embarcadero docs for TMask
 http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Masks.TMask
says:
"*Note:* Do not confuse TMask with the EditMask of a field or masked edit
object. While both are used for comparing strings to a symbolic description
of valid values, the special mask symbols and matching rules are completely
different."

Is the "*masked edit object*" the same as MaskEdit?
Is the syntax really different?

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Michael Van Canneyt via lazarus



On Tue, 23 Feb 2021, Juha Manninen via lazarus wrote:


Hello

LazUtils has unit Masks with classes TMask and TMaskList.
FPC's packages/fpindexer has unit FPMasks also with classes TMask
and TMaskList.
A comment in FPMasks says "Moved here from LCL".
Revision control shows it was added 9 years ago in 2012. Since 2.5 years
ago it supports Unicode by using UTF8string for all strings.

LCL has a related MaskEdit. It was first added in 2002 by Mattias with
comment
"added TMaskEdit from Tony"
I don't know who Tony is.
Unit Masks was first added to LCL in 2007 by tombo with comment
"LCL: implemented TMask, MatchesMask, added Masks docs"
I don't know who Tombo is either.
In 2011 Masks was moved to LazUtils by Felipe.
Masks and MaskEdit have some identical code. IMO MaskEdit should reuse
some code from Masks.
MaskEdit is maintained by Bart but he didn't know details of the history.

Masks in LazUtils has a slow implementation.
I planned to optimize it but now I realize we may have overlapping code.
Q: Are Masks (LazUtils) and FPMasks (fpindexer) compatible?
If they are, we should dump the LazUtils Masks and use code from FPC's libs.


Since it comes from Lazarus in the first place, they are supposed to be
compatible, yes. If not, then the unit in FPC can be updated to add missing
things.

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] LHelp and LazMouseAndKeyInput package

2021-02-23 Thread Sergey Bodrov via lazarus
There is another useless dependency for AvgLvlTree inside IpHtml.pas unit.

It used only for private VisitedList: TStringMap field in
TIpHtmlCustomPanel and has no benefits against TStringList.Find()

пн, 22 февр. 2021 г. в 11:52, Juha Manninen via lazarus <
lazarus@lists.lazarus-ide.org>:

> On Mon, Feb 22, 2021 at 3:29 AM Andrey Sobol via lazarus <
> lazarus@lists.lazarus-ide.org> wrote:
>
>> You excluded this code from lcore.pas
>>
>> procedure THelpForm.ShowApp();
>> ..
>> {$IFDEF WINDOWS}
>>  // Go to TOC TreeView and to get focus on foreground window
>>  KeyInput.Apply([ssCtrl]);
>>  KeyInput.Press(VK_T);
>>  KeyInput.UnApply([ssCtrl]);
>> {$ENDIF}
>>
>
> Oh, LazMouseAndKeyInput was just for that code.
> It created a serious bug. After pressing F1 in source editor the end of
> current word was cut off.
> The reason was that VK_T went to Lazarus IDE, although LHelp sent it to
> itself, and the default command for VK_T is "Delete to end of word".
> Didn't you notice the bug?
> It was discussed in Lazarus devel mailing list. It should have happened
> here instead.
> Something funny happens in the interprocess communication. How could key
> VK_T bring LHelp to front if it went to Lazarus' source editor?
>
>
>
>> Without the code on windows system we can`t get rightly a focus  lHelp
>> by an event of restore the window after hide (the window is blinking on
>> an aplication panel sometimes). We should send an user input sentence to
>> the foregroud window from a mouse or from keyboard to get focus (that is
>> windows specific problem).
>>
>
> Yes, in Windows terminology bringing to front means blinking an icon in
> Taskbar.
> A Lazarus user however wants to see the help window right after pressing
> F1.
>
>
> I see some solutions of that:
>> 1. To rewrite that code by WinApi (that is simple).
>> 2. To exclude the package dependency on Mac system, but I don`t know how?
>>
>
> LazMouseAndKeyInput must be fixed for MacOS Cocoa but that is a whole
> different issue.
> Now that problem involves only Windows. A cross-platform package is not
> needed for that.
> The libXtst library dependency pulled in for Linux (and UNIX) was a
> 100% increase of system dependencies for a Lazarus release, and for
> absolutely no benefit.
> Now Lazarus BigIde depends on just libgtk2.0-dev.
>
>
> 3. To fix the Application.BringToFront() function at windows to rightly
>> bring a foreground window to a front of a display.
>>
>
> That was my idea, too.
> The method name BringToFront() is quite unambiguous. It should bring the
> application to front. :)
> The name is not BlinkAnIconInTaskbar().
> If you know how to fix it, please do. I don't use Windows much myself.
> Does this idea go against some Windows convention?
>
>
> But I don`t see that problem now :). May be the blinkg was also a part
>> of that issue https://bugs.freepascal.org/view.php?id=38276
>>
>> I redone many pieces after that, that a second round :)
>>
>
> I removed the LazMouseAndKeyInput dependency in r64647.
> Please fix the remaining issues as you see fit (without libXtst dependency
> for Linux).
>
>
> Regards,
> Juha
>
> --
> ___
> lazarus mailing list
> lazarus@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>


-- 
*Bodrov Sergey*
software development, IT consulting
http://www.serbod.com
*Phone (Belarus):* +375(25)794-21-58
*Skype:* sergey.bodrov1
*e-mail:* ser...@gmail.com, oxot...@yandex.ru
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] unit Masks vs. unit FPMasks

2021-02-23 Thread Juha Manninen via lazarus
Hello

LazUtils has unit Masks with classes TMask and TMaskList.
FPC's packages/fpindexer has unit FPMasks also with classes TMask
and TMaskList.
A comment in FPMasks says "Moved here from LCL".
Revision control shows it was added 9 years ago in 2012. Since 2.5 years
ago it supports Unicode by using UTF8string for all strings.

LCL has a related MaskEdit. It was first added in 2002 by Mattias with
comment
 "added TMaskEdit from Tony"
I don't know who Tony is.
Unit Masks was first added to LCL in 2007 by tombo with comment
 "LCL: implemented TMask, MatchesMask, added Masks docs"
I don't know who Tombo is either.
In 2011 Masks was moved to LazUtils by Felipe.
Masks and MaskEdit have some identical code. IMO MaskEdit should reuse
some code from Masks.
MaskEdit is maintained by Bart but he didn't know details of the history.

Masks in LazUtils has a slow implementation.
I planned to optimize it but now I realize we may have overlapping code.
Q: Are Masks (LazUtils) and FPMasks (fpindexer) compatible?
If they are, we should dump the LazUtils Masks and use code from FPC's libs.

Regards,
Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus