Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

open pas file from command line

17 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Emerson

Hi there,

Suppose I have a lazarus source editor open. I would like to, from my command line shell, issue a command to open a new source in the already-open source editor. Is this possible?

Why? If I have a shell open in a directory, it's very quick to tab-complete a file within a directory. It's nice to be able to issue a quick command to open that file in my editor, rather than using the cumbersome gui file selection interface. I've written scripts to do this with a few other apps, but it requires support from the app in question.

Thanks,
David

Reply by email

Graeme Geldenhuys
to David Emerson

Op 2010-10-21 06:58, David Emerson het geskryf:

Suppose I have a lazarus source editor open. I would like to, from my command line shell, issue a command to open a new source in the already-open source editor. Is this possible?

Last time I checked, it was not possible. A feature I miss too.

Why? If I have a shell open in a directory, it's very quick to tab-complete a file within a directory. It's nice to be able to issue a quick command to open

My work-around was to write the File Browser ide add-on (components/filebrowser/ directory). It registers a new menu item as "View

File Browser window".

I also wrote a File Filter Mask ide add-on which allows you to customize and define your own file filters that appear in any "File Open" dialog of Lazarus IDE, but that patch is still not accepted for whatever reason (though I use it here locally for ages).

Regards,
- Graeme -

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

Reply by email

Michael Van Canneyt
to David Emerson: Suppose I have a lazarus source editor open. I would like to, from my command line shell,…
David Emerson wrote 11 lines
Hi there, Suppose I have a lazarus source editor open. I would like to, from my command line shell, issue a command to open a new source in the already-open source editor. Is this possible? Why? If I have a shell open in a directory, it's very quick to tab-complete a file within a directory. It's nice to be able to issue a quick command to open that file in my editor, rather than using the cumbersome gui file selection interface. I've written scripts to do this with a few other apps, but it requires support from the app in question.

It should in fact be easy to program this, using the simpleIPC protocol. IDE acts as a server, and when the IDE starts, it checks whether the server is available. If so, it sends a command to open the file.

Or, on Linux, D-BUS could be used for this. Windows might have some easy DDE schedule for this.

Michael.

Reply by email

Vincent Snijders
to Graeme Geldenhuys: Op 2010-10-21 06:58, David Emerson het geskryf: Last time I checked, it was not possible.…

2010/10/21 Graeme Geldenhuys :

I also wrote a File Filter Mask ide add-on which allows you to customize and define your own file filters that appear in any "File Open" dialog of Lazarus IDE, but that patch is still not accepted for whatever reason (though I use it here locally for ages).

IIRC, it was because you did not use the correct way to save the settings.

I am almost certain that is mentioned in the bug report with the patch.

Vincent

Reply by email

Graeme Geldenhuys
to Vincent Snijders

Op 2010-10-21 10:40, Vincent Snijders het geskryf:

IIRC, it was because you did not use the correct way to save the settings. I am almost certain that is mentioned in the bug report with the patch.

And as I remember, I justified my reasons for that design. The mentioned translation issues is a moot point, because the user can define their own filter types, modify existing types (including the name of the filter). Those will never get translated because they are end-user entered text - so I simply don't get the issue you went on about.

As for storing the filters in a separate xml file, I justified that design too.

I understand a valid argument if there was no thought put into the original design, but in this case I *did* think about the design before I coded, and explained my reasons for doing so. What more do you want?

Anyway, as I mentioned in that mantis report.... I am happily using that feature without problems, so it's your (end-users of Lazarus IDE) loss. I think it's a useful feature to have, and others agreed.

Regards,
- Graeme -

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

Reply by email

Mattias Gärtner
to Michael Van Canneyt: It should in fact be easy to program this, using the simpleIPC protocol. IDE acts as a…

Zitat von Michael Van Canneyt :

Show quoted text 22 lines
On Wed, 20 Oct 2010, David Emerson wrote: > Hi there, > > Suppose I have a lazarus source editor open. I would like to, from > my command > line shell, issue a command to open a new source in the already-open source > editor. Is this possible? > > Why? If I have a shell open in a directory, it's very quick to > tab-complete a > file within a directory. It's nice to be able to issue a quick > command to open > that file in my editor, rather than using the cumbersome gui file selection > interface. I've written scripts to do this with a few other apps, but it > requires support from the app in question. It should in fact be easy to program this, using the simpleIPC protocol. IDE acts as a server, and when the IDE starts, it checks whether the server is available. If so, it sends a command to open the file.

Yes, sounds good.

Or, on Linux, D-BUS could be used for this. Windows might have some easy DDE schedule for this.

Mattias

Reply by email

Vincent Snijders
to Graeme Geldenhuys: Op 2010-10-21 10:40, Vincent Snijders het geskryf: And as I remember, I justified my…

2010/10/21 Graeme Geldenhuys :

Anyway, as I mentioned in that mantis report.... I am happily using that feature without problems, so it's your (end-users of Lazarus IDE) loss. I think it's a useful feature to have, and others agreed.

Yes, I think the consensus is that is a useful feature (it is not resolved with won't fix). And it is nice that you can live with the limitations of the implementation. That is your gain.

You have explained why you chose to ignore the problems with your patch, and they were no reason to change my mind about the patch. Sometimes I can be almost as stubborn (is that a good translation of 'eigenwijs'?) as you,

Vincent

Reply by email

Graeme Geldenhuys
to Vincent Snijders

Op 2010-10-21 11:46, Vincent Snijders het geskryf:

resolved with won't fix). And it is nice that you can live with the limitations of the implementation.

On the contrary, your and Paul's ideas add limitations to the feature, not mine. Anyway, I started a new message thread regarding this.

Regards,
- Graeme -

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

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys: Op 2010-10-21 13:27, Hans-Peter Diettrich het geskryf: Drag-drop in LCL is just as…
Graeme Geldenhuys wrote 10 lines
Op 2010-10-21 13:27, Hans-Peter Diettrich het geskryf: > > It should be possible, by adding a tool that sends the equivalent > drag-drop message(s) to Lazarus. Drag-drop in LCL is just as limited as in VCL, so a LOT of extra work will be required including extending the LCL interface. I know this because I just implemented cross-application and internal-application drag-drop in fpGUI, abstracting the DND API interface to work across Windows and Linux with single source code implementation in applications.

The solution is not DND; this would require an additional program. Instead, the file association should be used, lazarus should be started, and should detect that an instance is running, and use some kind of messaging to tell the running instance to load an additional file.

Michael.

Reply by email

Graeme Geldenhuys
to Hans-Peter Diettrich: It should be possible, by adding a tool that sends the equivalent drag-drop message(s) to…

Op 2010-10-21 13:27, Hans-Peter Diettrich het geskryf:

It should be possible, by adding a tool that sends the equivalent drag-drop message(s) to Lazarus.

Drag-drop in LCL is just as limited as in VCL, so a LOT of extra work will be required including extending the LCL interface. I know this because I just implemented cross-application and internal-application drag-drop in fpGUI, abstracting the DND API interface to work across Windows and Linux with single source code implementation in applications.

Regards,
- Graeme -

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

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: The solution is not DND; this would require an additional program. Instead, the file…

Op 2010-10-27 12:41, Michael Van Canneyt het geskryf:

The solution is not DND; this would require an additional program. Instead, the file association should be used, lazarus should be started, and

Indeed you are correct, and a much better solution.

Regards,
- Graeme -

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

Reply by email

Hans-Peter Diettrich
to Graeme Geldenhuys: Op 2010-10-21 13:27, Hans-Peter Diettrich het geskryf: Drag-drop in LCL is just as…
Show quoted text 6 lines
Op 2010-10-21 13:27, Hans-Peter Diettrich het geskryf: > It should be possible, by adding a tool that sends the equivalent > drag-drop message(s) to Lazarus. Drag-drop in LCL is just as limited as in VCL, so a LOT of extra work will be required including extending the LCL interface.

Not so for file dropping (WM_DROPFILES).

DoDi

Reply by email

Vincent Snijders
to Graeme Geldenhuys: Op 2010-10-27 14:49, Hans-Peter Diettrich het geskryf: File dropping (URI lists) are just…

2010/10/27 Graeme Geldenhuys :

Show quoted text 10 lines
Op 2010-10-27 14:49, Hans-Peter Diettrich het geskryf: > > Not so for file dropping (WM_DROPFILES). File dropping (URI lists) are just a small part of drag-n-drop. ?Either way, does LCL actually have a platform independent API or component events you can hook into for that? ?In VCL you had to resort to using the Win32 API directly (completely bypassing the VCL).

See http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tcustomform.ondropfiles.html

Vincent

Reply by email

Graeme Geldenhuys
to Hans-Peter Diettrich: Not so for file dropping (WM_DROPFILES). DoDi

Op 2010-10-27 14:49, Hans-Peter Diettrich het geskryf:

Not so for file dropping (WM_DROPFILES).

File dropping (URI lists) are just a small part of drag-n-drop. Either way, does LCL actually have a platform independent API or component events you can hook into for that? In VCL you had to resort to using the Win32 API directly (completely bypassing the VCL).

Regards,
- Graeme -

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

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys

Op 2010-10-27 14:57, Graeme Geldenhuys het geskryf:

Show quoted text 7 lines
Op 2010-10-27 14:49, Hans-Peter Diettrich het geskryf: > > Not so for file dropping (WM_DROPFILES). way, does LCL actually have a platform independent API or component events you can hook into for that?

Example: The first component I looked at now, the TMemo. There is no event handlers for File Dropping or any other application-to-application DND. I only see the "delphi compatible" events OnDragDrop and OnDragOver.

They are pretty useless in this case, and only work inside your own application.

Regards,
- Graeme -

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

Reply by email

Graeme Geldenhuys
to Vincent Snijders: 2010/10/27 Graeme Geldenhuys : See http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tcust…

Op 2010-10-27 14:56, Vincent Snijders het geskryf:

Why on a Form? And what about all the other more obvious components. eg: TListBox, TMemo, TListView, etc? Even the most obvious one of them all, TFileNameEdit doesn't have such an event. Oops.

Regards,
- Graeme -

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

Reply by email