Re: [Lazarus] LHelp and LazMouseAndKeyInput package

2021-02-21 Thread Andrey Sobol via lazarus

On 22.02.2021 1:45, Juha Manninen via lazarus wrote:

Now I studied how LazMouseAndKeyInput is used in LHelp.


Juha,

read this 
https://www.codeproject.com/Tips/76427/How-to-bring-window-to-top-with-SetForegroundWindo


That problem was before, but now I don`t see it.

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


Re: [Lazarus] LHelp and LazMouseAndKeyInput package

2021-02-21 Thread Andrey Sobol via lazarus

On 22.02.2021 1:45, Juha Manninen via lazarus wrote:

Help has improved lately thanks to Andrey Sobol's patches mostly.
However a new dependency was added: LazMouseAndKeyInput.
On Linux and UNIX systems it pulls in libXtst dependency.
LHelp is part of Lazarus BigIde target which is used for releases.
Extra dependencies for BigIde should be avoided if possible.

Now I studied how LazMouseAndKeyInput is used in LHelp.
Well, it is not used!
LHelpCore has MouseAndkeyInput in its uses section but removing it and 
the whole package dependency makes no difference.

My analysis: LazMouseAndKeyInput dependency can be removed from LHelp.
Am I right?

Regards,
Juha




Helo Juha,

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}

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).


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?
3. To fix the Application.BringToFront() function at windows to rightly 
bring a foreground window to a front of a display.



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 :)

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


Re: [Lazarus] LHelp memory leak

2021-02-15 Thread Andrey Sobol via lazarus

Hello,

I have tested with FPC 3.2.1, FPC trunc and Lazarus trunc
I don`t see any leaks.

P.S. The leaks checking I have an enabled always. I spent many time for 
 a fixing leaks :)

Andrey.

On 15.02.2021 14:36, Juha Manninen via lazarus wrote:

I finally configured LHelp as a CHM help viewer in my development Lazarus.
I downloaded Marco's CHM snapshots linked here:
https://forum.lazarus.freepascal.org/index.php/topic,52437.0.html 


There are 2 updates from Andrey Sobol. I downloaded them, too.
LHelp opens correctly, although slowly for the first time.
There is a strange flicker. First an empty window shows up, then it 
disappears. A little later the actual help window with contents shows.
Anyway, then it works well and the documentation itself has improved, 
too. Nice!


When I close LHelp, it asks if I really want to do it. Yes, I want it.
Then LHelp leaks memory. See below.
IIRC it does not leak when I start it standalone. It is caused by the 
IDE integration.
Andrey Sobol and everybody who develops LHelp, please use the Debug 
buildmode I added there some time ago. All debug flags should be on when 
developing code.


I tested with Linux 64-bit. IDE is built with LCL-QT5, I guess the same 
is used for LHelp.


Juha




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


Re: [Lazarus] How to hide pop-up menu before taking a screen snapshot?

2021-02-07 Thread Andrey Sobol via lazarus

Try to call

Application.ProcessMessages();
after disable a popup menu.

Andrey.

On 07.02.2021 17:09, Bo Berglund via lazarus wrote:

On Sun, 7 Feb 2021 14:01:46 +, Denis Kozlov via lazarus
 wrote:



I had a similar experience with taking a screenshot programmatically.
Simply waiting or processing application messages after hiding the form
often doesn't help, and results in a form being a part of the screenshot
anyway.

I managed to work around it by forcing Windows to repaint everything on
the desktop by broadcasting WM_PAINT message, like so:

SendMessageTimeout(HWND_BROADCAST, WM_PAINT, 0, 0, SMTO_ABORTIFHUNG,
1000, MsgResult);

You might also need to disable transition effects (fade-in and fade-out)
by setting the DWMWA_TRANSITIONS_FORCEDISABLED flag on the form before
hiding it, and then unsetting it when showing the form again.

DwmSetWindowAttribute(AForm.Handle, DWMWA_TRANSITIONS_FORCEDISABLED,
@dwAttribute, SizeOf(dwAttribute));

Good luck,
Denis


Thanks for the suggestion!

It turned out that (from a suggestion on the Lazarus forum) I could use a
sleep(300) right before the call to the CopyScreenRect() instead of the other
failed tests.

Apparently the menu item is subject to Windows "animation" when it is closed...

So this is now the code and it does work:

procedure TfrmMain.miCopyImageClick(Sender : TObject);
begin
   Sleep(300);
   CopyScreenRect;
end;

procedure TfrmMain.CopyScreenRect;
var
   MyCapture : TBgraBitmap;
   Clip: TRect;
begin
   try
 Clip := Bounds(Self.Left, Self.Top, Self.Width, Self.Height);
 Self.Visible := false; //To remove the capture frame from image
 MyCapture := TBgraBitmap.Create();
 try
   MyCapture.TakeScreenShot(Clip);
   Self.Visible := true;
   Clipboard.Assign(MyCapture.Bitmap);
 finally
   MyCapture.Free;
 end;
   except
 on E: exception do
   Clipboard.AsText := E.Message;
   end;
end;

I tried various values for the sleep time and settled for 300, 200 does not
quite fix it - a faded shadow image still remains.





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


Re: [Lazarus] Some IDE/LHelp issues

2021-02-07 Thread Andrey Sobol via lazarus

On 04.02.2021 16:39, Rolf Wetjen via lazarus wrote:

Hi Andy

I've patched LHelp.exe with lhelp_index_combine_04.patch.

The "unknown" tab issue is partly solved. Now all tabs have a caption. 
There's one strange behaviour:
[FPDoc Documentation], [Programmer' Guide], [Reference Guide] and 
[User's Guide] doesn't show the default page if LHelp is called from the 
IDE via Help/CHM help or via context F1. They show an empty page. But it 
shows the default page if I open prog.chm for example in LHelp via 
File/Open.


An other difference: Calling LHelp via context F1 doesn't show the toc. 
Tested with F1 on "TForm".


Rolf


Hi Rolf,
I have placed the next version of patch and created a branch on a forum 
for discussion 
https://forum.lazarus.freepascal.org/index.php/topic,53218.0.html


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


Re: [Lazarus] Some IDE/LHelp issues

2021-02-04 Thread Andrey Sobol via lazarus

On 04.02.2021 16:39, Rolf Wetjen via lazarus wrote:

Hi Andy

I've patched LHelp.exe with lhelp_index_combine_04.patch.

The "unknown" tab issue is partly solved. Now all tabs have a caption. 
There's one strange behaviour:
[FPDoc Documentation], [Programmer' Guide], [Reference Guide] and 
[User's Guide] doesn't show the default page if LHelp is called from the 
IDE via Help/CHM help or via context F1. They show an empty page. But it 
shows the default page if I open prog.chm for example in LHelp via 
File/Open.


An other difference: Calling LHelp via context F1 doesn't show the toc. 
Tested with F1 on "TForm".


Rolf


There is not a final version, I work at that yet. The main change is a 
full merged indexes (Binary index and FTSI) for an one page mode.


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


Re: [Lazarus] Some IDE/LHelp issues

2021-02-04 Thread Andrey Sobol via lazarus

On 04.02.2021 16:39, Rolf Wetjen via lazarus wrote:

Hi Andy

I've patched LHelp.exe with lhelp_index_combine_04.patch.

The "unknown" tab issue is partly solved. Now all tabs have a caption. 
There's one strange behaviour:
[FPDoc Documentation], [Programmer' Guide], [Reference Guide] and 
[User's Guide] doesn't show the default page if LHelp is called from the 
IDE via Help/CHM help or via context F1. They show an empty page. But it 
shows the default page if I open prog.chm for example in LHelp via 
File/Open.


An other difference: Calling LHelp via context F1 doesn't show the toc. 
Tested with F1 on "TForm".


Rolf


There is not a final version, I work at that yet. The main change is a 
full merged indexes (Binary index and FTSI) for an one page mode.


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


Re: [Lazarus] Some IDE/LHelp issues

2021-02-02 Thread Andrey Sobol via lazarus

Hello Rolf,
1) When LHelp opens (regardless if opens with Tools->CHM-Help or F1 
context help) it opens with 11 tabs.
Some of them have a caption, some of them are [unknown]. The [unknown] 
ones come up with an error message "ms-its:xyz.chm::/index.html not found!"


That is my TODO for lHelp, You can get some of last patches here
https://bugs.freepascal.org/view.php?id=38250
, but it not in a repo now.

2) One of [unknown] tabs is completely empty: 
"ms-its:toc.chm::/index.html not found!"


I don`t what about it. I can get a new chm`s here for try. 
https://forum.lazarus.freepascal.org/index.php/topic,53114.0.html

It is without a structural errors.

3) There are two lcl tabs. One show a message "Loaded: 
ms-its:lcl.chm::/index.html in ... ms", the other one doesn't show a 
load message.


I think I am going fix that later.

3) There's no possibility to search in all files simultanously. May be 
this is the missing toc.chm::/index.html?


Patch sub 1 is not applied yet.


4) The first context search is a racing car. All following context 
searches are a bicycle. Time for a coffee.


Fixed: https://bugs.freepascal.org/view.php?id=38276


I'd like to check for this.

Is there any documentation about the structure of the chm files 
reagarding the missing index.html?
What's the meaning of the database definition fields in 
Tools-Settins-Help? There are entries for 8 databases. What about the 
missing ones.

How does the IDE calls LHelp?

Any ideas?


A full list of changes and mistakes :)
https://bugs.freepascal.org/view_all_bug_page.php?filter=60193d8bebd3d

Andrey.

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


[Lazarus] Change of lfm files

2021-01-26 Thread Andrey Sobol via lazarus

Hello,
Let us suppose, I have changed a form inside tool/debugserver
I see what inside .lfm file a version of LCL changed  from 1.3 to 2.10 
for example.


What is policy about LCL compatibility for patches?
Where can I read about this?

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


[Lazarus] FPDoc chms and code examples - second thread

2021-01-16 Thread Andrey Sobol via lazarus

Oh sorry, I send my message into another thread :(

I opened the topic about short code examples that should be embedded in 
the documentation. About the full examples I know.


Also I and Trevor have wrote a readme.txt file for those directories:
The file you can read here: 
https://drive.google.com/file/d/1wHiM-UMClcjvmBLj1PQDwwQ4sNKdXl79/view?usp=sharing


> Me personally prefer to place short code snippets into help pages, with
> some syntax highlight. Also, big code samples can be made as separate 
help

> (html) files, with detailed description. Same as in Wiki.
>
> Pure code examples can be found in lazarus/examples directory, they even
> have browser, embedded in IDE (create project, browse samples).
>
> On Fri, Jan 15, 2021, 10:53 Andrey Sobol via lazarus <
> lazarus@lists.lazarus-ide.org> wrote:
>
>> Hello,
>> I see that nobody used to a tag  for creating 
documentation lcl,

>> lazutil. That tag is used only the fpc team.
>> I have read a documentation and saw rtl .xml`s and so.
>> I want to create a directory for used examples of code as :
>>
>> - lazarus/doc/exlcl
>> - lazarus/doc/exlazutil
>>
>> and put inside files in notation with dots. For example:
>> fileutil.findallfiles.pas (I think it will be convenient)
>>
>> + readme.txt (into those directories)
>> + wiki descriptions about it.
>>
>> I have checked it, a html`s works and a chm`s too.
>>
>> What is yours opinion about it?
>> And how to create directory, also by patch?
>>
>> Andrey Sobol.--

Andrey

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


Re: [Lazarus] FPDoc chms and code examples

2021-01-16 Thread Andrey Sobol via lazarus
I opened the topic about short code examples that should be embedded in 
the documentation. About the full examples I know.


Also I and Trevor have wrote a readme.txt file for those directories:
The file you can read here: 
https://drive.google.com/file/d/1wHiM-UMClcjvmBLj1PQDwwQ4sNKdXl79/view?usp=sharing



Me personally prefer to place short code snippets into help pages, with
some syntax highlight. Also, big code samples can be made as separate help
(html) files, with detailed description. Same as in Wiki.

Pure code examples can be found in lazarus/examples directory, they even
have browser, embedded in IDE (create project, browse samples).

On Fri, Jan 15, 2021, 10:53 Andrey Sobol via lazarus <
lazarus@lists.lazarus-ide.org> wrote:


Hello,
I see that nobody used to a tag  for creating documentation lcl,
lazutil. That tag is used only the fpc team.
I have read a documentation and saw rtl .xml`s and so.
I want to create a directory for used examples of code as :

- lazarus/doc/exlcl
- lazarus/doc/exlazutil

and put inside files in notation with dots. For example:
fileutil.findallfiles.pas (I think it will be convenient)

+ readme.txt (into those directories)
+ wiki descriptions about it.

I have checked it, a html`s works and a chm`s too.

What is yours opinion about it?
And how to create directory, also by patch?

Andrey Sobol.-- 

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


Re: [Lazarus] lHelp improvements

2020-12-30 Thread Andrey Sobol via lazarus



Querying all registered help databases is easy:

lcl unit lazhelpintf
for i:=0 to HelpDatabases.Count-1 do
   HelpDatabases[i]...

For example the IDE registers fpdoc help for RTL, FCL and LCL to
open the lazarus-ccr web pages.

The chmhelppkg replaces them with its own and opens chm files instead.
So, if you are only interested in chm files, see the chmhelppkg package.

I know about it. But the main problem is that the Lhelp is another 
application. Need to transfer preference data (search pathes and 
registered database files info) to lHelp. Without this I can`t do 
nothing better. Now the lHelp recieves strict commands to open files.


I want to get a opinion from maintainers how is better to do that?


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


Re: [Lazarus] lHelp improvements

2020-12-28 Thread Andrey Sobol via lazarus




Afaik most of the binary indexes (index, FTS) can be mergesorted 
together rather cheaply and then stored on disk. Using these rather than 
converting everything to text and then parse that again would make it 
very fast. This is what HH does.


Even faster is caching the result of the merge on disk (which HH also 
does, but only in case of "merged" chm files, which doesn't work with 
FPC generated CHM files yet), these are then stored as CHW.


But to invalidate the cache, it should be stored which CHMs were used to 
generate it. So that the cache can be invalided.


I'll look into the various fpdoc and chm stuff from tomorrow, when I get 
home again


I agree with you that need to do a storing on disk or to produce CHW. 
And I will do this later.

Creating a new chm package additions also requires a lot of time.
But now I  have not any documentation on chm format,  I have found only 
dribs and drabs.
The situation is such that the documentation seems an existing, but it 
is very difficult to use for many reasons.
Actual version of lHelp has to work rightly and then I can do next 
version. First start 1.5-2 sec I think it is well for loading entire 
packet of chms and indexes.

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


Re: [Lazarus] lHelp improvements

2020-12-27 Thread Andrey Sobol via lazarus

On Sun, 27 Dec 2020 17:15:23 +0300
Соболь Андрей Евгеньевич via lazarus 
wrote:


Hi, guys.

I am trying to do the lHelp more convenient.


Great!


And after I have
combined a chm indexes on start, I think about next step. What I
see...



1. Exist a contradiction of behavior for contex searching
through hh.exe (windows) an lHelp (this is for first start of help
subsystem):
- When I press F1 for hh.exe enabled for context searching, then
Lazarus send only one command - open chm file and seek TOC index
position.


What package opens hh.exe in Lazarus?


You can read here about this
https://wiki.lazarus.freepascal.org/Installing_Help_in_the_IDE



- When I press F1 for the lHelp enabled for context searching, then
Lazarus send group of command as

 got BeginUpdate
 got BeginUpdate
 got rturl, filename M:\lazarus\docs\chm\fcl.chm, url /index.html
 got rturl, filename M:\lazarus\docs\chm\fclres.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\fpdoc.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\ideintf.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\lazutils.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\lcl.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\prog.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\ref.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\rtl.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\toc.chm,
url /index.html got rturl, filename M:\lazarus\docs\chm\user.chm,
url /index.html got EndUpdate
 got rturl, filename M:\lazarus\docs\chm\ref.chm,
url /ref/refse92.html#keyword_function got EndUpdate
 got rtmisc/mrShow
 
 Lazarus sends commands for opening all chm files and the last

command is for performing contex search. As result hh.exe always does
it more faster then lHelp. I think behavior have to be same, only a
perform of context seaching. On second request lHelp can open next
file and index and so on.


Do you mean when user press F1 on an identifier, then lhelp can open
only the target file directly and open the other files on idle?

Yes, but now I have strict commands to open files before. For to do such 
as you said I have to get one command to do search and to know where to 
get another files.



2. I think that the lHelp (or user) should
make a decision myself,


Do you mean "myself" or "by itself"?

Yes, it is my mistake.



open all indexes on first start or none (for
contex search primarily). It should have own preferences for that.
But the lHelp don`t have any information about searchpath where is
chm files. I can add a new command for sending searchpath or add new
option to Lazarus (open all indexes on first start - see paragraph
1).


A searchpath command sounds good.


I think should be a preference in the lHelp to open all files on start 
or not. Then we can change which files to open on start.


  

3. lHelp got a start command with the option "--hide" at start. Then
lHelp gets many commands on openning of indexes. I think that I have
the right to show lHelp or splash screen on getting first command.
Without this, the user gets a hanging program (1-3 sec) and does not
understand what happens. This is for the case when I open all the
indexes.

What is your opinion about it?


Yes, this needs improvement and any help is welcome.

Mattias


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