Re: [Lazarus] Feature Request: Override/Implement methods

2020-10-07 Thread Mattias Gaertner via lazarus
On Thu, 8 Oct 2020 01:36:23 +0200
Martin Frb via lazarus  wrote:

> On 08/10/2020 01:16, Graeme Geldenhuys via lazarus wrote:
> > Hi,
> >
> > I've pulled the latest Lazarus code and went through all the menu
> > items I could find but could see what I was looking for. Does
> > Lazarus have a feature eg: (Editor -> Source [popup menu] ->
> > Override/Implement Methods) so the IDE could stub out say missing
> > methods from a Interface I listed in the class definition, or allow
> > to override methods from parent classes? 
> 
> AFAIK Closest we have is; Refactor > Abstract Methods.
> 
> Lists abstracts methods that are not overriden in this or parent
> class (i.e that would still be abstract in this class)

As for overrides:
Insert a new line in the class declaration, Ctrl+Space, select the
parent method. This will create an override.

Mattias

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


Re: [Lazarus] Feature Request: Override/Implement methods

2020-10-07 Thread Martin Frb via lazarus

On 08/10/2020 01:16, Graeme Geldenhuys via lazarus wrote:

Hi,

I've pulled the latest Lazarus code and went through all the menu items
I could find but could see what I was looking for. Does Lazarus have
a feature eg: (Editor -> Source [popup menu] -> Override/Implement Methods)
so the IDE could stub out say missing methods from a Interface I listed
in the class definition, or allow to override methods from parent classes?



AFAIK Closest we have is; Refactor > Abstract Methods.

Lists abstracts methods that are not overriden in this or parent class 
(i.e that would still be abstract in this class)

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


[Lazarus] Feature Request: Override/Implement methods

2020-10-07 Thread Graeme Geldenhuys via lazarus
Hi,

I've pulled the latest Lazarus code and went through all the menu items
I could find but could see what I was looking for. Does Lazarus have
a feature eg: (Editor -> Source [popup menu] -> Override/Implement Methods)
so the IDE could stub out say missing methods from a Interface I listed
in the class definition, or allow to override methods from parent classes?

Attached is a screenshop of Eclipse (Java IDE) where it will generate
stub code for a new "QuackBehaviour" interface I specified in the
class I'm currently editing.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Win 7 issue / Re: -dWINDOWS_LIGATURE [[Re: Font ligatures support]]

2020-10-07 Thread Martin Frb via lazarus

On 07/10/2020 01:42, Maxim Ganetsky via lazarus wrote:

06.10.2020 16:23, Martin Frb via lazarus пишет:

On 06/10/2020 15:09, Maxim Ganetsky via lazarus wrote:



Can you try to catch it in the debugger, and see what params are given
to NewTextOut
in
#2  0x00ab95f6 in DRAWHILIGHTMARKUPTOKEN (ATOKENINFO=...,
parentfp=0x13abf6e8)
 at lazsyntextarea.pp:1741

  fTextDrawer.NewTextOut(TxtLeft, rcToken.Top, TxtFlags, tok,
ATokenInfo.Tk.TokenStart, ATokenInfo.Tk.TokenLength, FEtoBuf);
Can you add some debugln in a format convenient to you? This will
simplify things, I think.

This is in the paint handler, and it is called for each token. So 
potentially very slow with debugln.


But since it is in startup, hopefully you wont have to many.

Apply this patch please



With this patch applied Lazarus seems to crash on debugln in 
lazsyntextarea.pp. Just in case, I tried to remove this particular 
debugln, then it printed 'BEFORE' and nothing more.


Sorry my fault, I thought I had all the nil checks
Please replace that debugln with

debugln('Calling NewTextOut L: %s rcT: %s tok: %s tkt: %s // %s // eto: 
%s', [dbgs(TxtLeft), dbgs(rcToken), dbgs(tok), 
dbgMemRange(PByte(ATokenInfo.Tk.TokenStart), ATokenInfo.Tk.TokenLength), 
dbgs(ATokenInfo.Tk.TokenLength), dbgs(FEtoBuf<>nil) ]);



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


Re: [Lazarus] How to list available serial ports on Linux?

2020-10-07 Thread Bo Berglund via lazarus
On Wed, 7 Oct 2020 11:43:50 +1300, Wolf via lazarus
 wrote:

>By submitting your question to DuckDuckGo, I found 
>https://stackoverflow.com/questions/2530096/how-to-find-all-serial-devices-ttys-ttyusb-on-linux-without-opening-them
>
>To quote:
>
>|To see which tty's are currently in use, you can simply look into the 
>file /proc/tty/drivers: and get a rather short list of devices. |Does it help?

OK, I have read through your link and also tested a lot on an RPi4 and
a standard i386 Ubuntu server.

The suggested file is no help since it contains a lot of irrelevent
stuff.

This is what I have found that is closest to what I need:

Ubuntu 18 server, where I have one USB serial adapter installed:
---
$ ls -l /dev/tty* | grep 'dialout'
crw-rw 1 root dialout   4, 64 Sep 26 23:45 /dev/ttyS0
crw-rw 1 root dialout   4, 65 Sep 26 23:45 /dev/ttyS1
crw-rw 1 root dialout   4, 74 Sep 26 23:45 /dev/ttyS10
crw-rw 1 root dialout   4, 75 Sep 26 23:45 /dev/ttyS11
crw-rw 1 root dialout   4, 76 Sep 26 23:45 /dev/ttyS12
crw-rw 1 root dialout   4, 77 Sep 26 23:45 /dev/ttyS13
crw-rw 1 root dialout   4, 78 Sep 26 23:45 /dev/ttyS14
crw-rw 1 root dialout   4, 79 Sep 26 23:45 /dev/ttyS15
crw-rw 1 root dialout   4, 80 Sep 26 23:45 /dev/ttyS16
crw-rw 1 root dialout   4, 81 Sep 26 23:45 /dev/ttyS17
crw-rw 1 root dialout   4, 82 Sep 26 23:45 /dev/ttyS18
crw-rw 1 root dialout   4, 83 Sep 26 23:45 /dev/ttyS19
crw-rw 1 root dialout   4, 66 Sep 26 23:45 /dev/ttyS2
crw-rw 1 root dialout   4, 84 Sep 26 23:45 /dev/ttyS20
crw-rw 1 root dialout   4, 85 Sep 26 23:45 /dev/ttyS21
crw-rw 1 root dialout   4, 86 Sep 26 23:45 /dev/ttyS22
crw-rw 1 root dialout   4, 87 Sep 26 23:45 /dev/ttyS23
crw-rw 1 root dialout   4, 88 Sep 26 23:45 /dev/ttyS24
crw-rw 1 root dialout   4, 89 Sep 26 23:45 /dev/ttyS25
crw-rw 1 root dialout   4, 90 Sep 26 23:45 /dev/ttyS26
crw-rw 1 root dialout   4, 91 Sep 26 23:45 /dev/ttyS27
crw-rw 1 root dialout   4, 92 Sep 26 23:45 /dev/ttyS28
crw-rw 1 root dialout   4, 93 Sep 26 23:45 /dev/ttyS29
crw-rw 1 root dialout   4, 67 Sep 26 23:45 /dev/ttyS3
crw-rw 1 root dialout   4, 94 Sep 26 23:45 /dev/ttyS30
crw-rw 1 root dialout   4, 95 Sep 26 23:45 /dev/ttyS31
crw-rw 1 root dialout   4, 68 Sep 26 23:45 /dev/ttyS4
crw-rw 1 root dialout   4, 69 Sep 26 23:45 /dev/ttyS5
crw-rw 1 root dialout   4, 70 Sep 26 23:45 /dev/ttyS6
crw-rw 1 root dialout   4, 71 Sep 26 23:45 /dev/ttyS7
crw-rw 1 root dialout   4, 72 Sep 26 23:45 /dev/ttyS8
crw-rw 1 root dialout   4, 73 Sep 26 23:45 /dev/ttyS9
crw-rw 1 root dialout 188,  0 Oct  7 09:34 /dev/ttyUSB0

RPi4, where I have 2 USB connected serial devices:
--
$ ls -l /dev/tty* | grep 'dialout'
crw-rw 1 root dialout 204, 64 Sep 23 17:57 /dev/ttyAMA0
crw-rw 1 root dialout 188,  0 Oct  6 12:33 /dev/ttyUSB0
crw-rw 1 root dialout 188,  1 Oct  6 15:08 /dev/ttyUSB1

Obviously the Ubuntu situation is a non-starter since it lists way too
many ports than can possibly be accessible. In fact on that computer
ONLY the USB adapter is possible to use, I don't know where the others
might be...

But the RPi4 result is more promising since it lists the 3 ports I
know are there and none else.

But concerning the USB connections there is a different problem too,
the port name depends on in which order the adapter is plugged into
the USB socket, the first plugged adapåter gets ttyUSB0 and the next
ttyUSB1 etc.

So if you want to select the correct port wired to a specific device
you are in a random situation.

I have had to set up the RPi system such that it creates a symlink to
the plugged in usb-serial adapter based on the ID of the USB socket it
is connected to. This is done by editing the file:
/etc/udev/rules.d/99-usb-serial.rules

By entering rules for the USB sockets as follows I have locked down
the tty name for each socket such that it will be a constant.

SUBSYSTEM=="tty",ENV{ID_PATH}=="platform-fd50.pcie-pci-:01:00.0-usb-0:1.1:1.0",SYMLINK+="ttyUSB01"
SUBSYSTEM=="tty",ENV{ID_PATH}=="platform-fd50.pcie-pci-:01:00.0-usb-0:1.2:1.0",SYMLINK+="ttyUSB02"
SUBSYSTEM=="tty",ENV{ID_PATH}=="platform-fd50.pcie-pci-:01:00.0-usb-0:1.3:1.0",SYMLINK+="ttyUSB03"
SUBSYSTEM=="tty",ENV{ID_PATH}=="platform-fd50.pcie-pci-:01:00.0-usb-0:1.4:1.0",SYMLINK+="ttyUSB04"

The result when listing the USB ports on my RPi4 is:

$ ll /dev/ttyU*
crw-rw 1 root dialout 188, 0 Oct  6 12:33 /dev/ttyUSB0
lrwxrwxrwx 1 root root 7 Sep 24 10:09 /dev/ttyUSB01 -> ttyUSB0
lrwxrwxrwx 1 root root 7 Oct  6 12:29 /dev/ttyUSB03 -> ttyUSB1
crw-rw 1 root dialout 188, 1 Oct  6 15:08 /dev/ttyUSB1

As you can see here ttyUSB01 is the first plugged in adapter and
ttyUSB03 is the second. Had I reversed the order of plugging them the
base name would have changed but th