pFTP and Edita.
===============

Version 0.2.8 of Edita includes a copy of pFTP, which is a standalone program
that can exchange messages with Edita.

You can invoke pFTP from Edita, which allows configuration of sites, opening 
  a connection, browsing and navigating remote (as well as local) directories, 
  and right clicking on a file and selecting "Edit with Edita".

  One thing which should be common sense but is worth stressing is that pFTP
  has two panes: on the Left are Local files, and on the Right Remote files.
  Right clicks on the right trigger FTP downloads and later when the file is
  saved, Edita sends a message back to pFTP causing an automatic re-upload.
  HOWEVER: right clicks on the left pane are just bog-standard local edits.
  When such a file is later saved, it is put back exactly where it should be,
  ie where it was found: locally. If you manually downloaded a remote file to
  a local directory, the only way that file is ever going to get uploaded is 
  if and when you choose to do so manually.

  Another way of saying this is that when pFTP is run stand-alone, its main
  job is to shunt files between the left and right panes. However that step
  is unnecessary and potentially confusing when editing files with Edita;
  if you want to edit remote files, use the right hand pane exclusively.

Or, you can select from a list of previous FTP edits directly within Edita.
  If a local copy exists, an option allows you to specify whether it is the
  master copy. If this option is unchecked (or disabled), it automatically
  re-downloads the file before commencing the edit. Note that pFTP has no
  idea this flag exists; all right clicks on a remote file try to download
  it (see point c. below). Another option allows you to specify whether the 
  file should be automatically re-uploaded each time the file is saved.
  [DEV Both those flags need proper testing. Not disabled when should be.]

    Should a failure occur during automatic re-upload after saving in Edita,
    for instance requiring a system reboot to reset your internet connection,
    you may need to complete the process manually:
      Already open in Edita will not re-download and should auto-upload after
      a null edit such as X<BackSpace><Ctrl S>, but no guarantees.
      Re-Selecting in "Previous FTP Edits" - check the flags carefully.
      Within pFTP there should be no confusion (beyond L/RHS as above), but
      may require a fair bit of directory navigation to locate the work copy.

Note that pFTP is the "slave" in the relationship. pFTP cannot start Edita, 
but if it is already running, then manually starting Edita and selecting 
FTP/Run pFTP will initialise the lines of communication between Edita and 
the running instance of pFTP (rather than fire up a new instance, that is).
The "Edit with Edita" option is disabled until such initialisation occurs.
If you FTP/Run pFTP, then either shut down Edita or Edita crashes, pFTP
will report "Edita not responding", "Try FTP/Run pFTP to re-init comms".
The "Previous FTP edits" option automatically performs the same action as
"Run pFTP" if, as, and when needed.

If for any reason you want to remove the FTP entry from the menus, edit the
  lang/elng_XXX.txt file and change "FTP" = "FTP" to "FTP" = "".

A possibly nasty problem is that Edita is a Windows application and stores
directories in UPPER CASE as a deliberate mechanism to avoid opening "both"
C:\TEMP\test.txt and c:\temp\TEST.TXT, (ie the same file!). Linux and co
have case sensitive paths and filenames, which can therefore be an issue.
Put simply, Edita will record /remote/Dir/Xxx.txt as (eg) the local file
"C:\PROGRAM FILES\EDITA\FTP\" (who cares) & "REMOTE\DIR\xxx.txt" (oh!).
It, with/via pFTP, tries its level best to sort this mess out and will
succeed in the simple case, BUT if you FTP to a Linux site with more than
one of Dir, dir, dIr, diR, etc, then expect problems. (IMO that is way
the daftest thing ever about Linux, *guaranteed* to cause confusion.)
It is of course POSSIBLE to change Edita to use upper/lower on-the-fly
internally, but frankly VERY unlikely to EVER happen.
[Aside: pFTP happily allows "Home", "home", and "hOME" ids to be defined
	in Site Manager, which will probably cause similar issues.]

Finally, note that pFTP itself has no single instance handling code whatsoever,
it is Edita which checks for an existing instance and uses that (whichever it
finds first if multiple instances of pFTP are running) rather than kicking off 
a new process. Just for completeness sake, I will also note that Debug versions 
of Edita (ie second and subsequent instances when Debug=1 in edita.ini) will 
not talk properly to pFTP (I slapped my head a few times over that one!).


Troubleshooting / to do list:
=============================
a) Check versions. You should make sure you are running Edita 0.2.9 and pFTP
   0.5. Future versions could test compatibility automatically..., maybe.
b) Run from the same directory. A future version could exchange directory strings
   but at the moment, stick to running both from the same place. Installation of
   0.2.8/9 plonks both in the same directory without offering any choice.
c) Right click on a remote file could check whether the local file exists and if 
   so offer a confirmation prompt. At the moment it just silently overwrites it.
d) Error : Edita <--> pFTP handshake failure. I know two easy ways to cause this:
   1) put a typo into the pFTP sources so they don't compile proper.
   2) get a heavy system load going (eg on my crappy box shutting down Opera 
      tends to hog the cpu for ~40 seconds, enough to stop even trivial stuff 
      such as Notepad from opening).
   Just manually try again. I have no plans to fix this; a longer wait loop would 
    hamper development anyway, unless someone has a wicked bright idea.
e) Automatic downloads end up in Edita\FTP\<connection name>\<remote dir>, and get
   left there permanently. If you manually delete these files, then Edita may 
   (especially after running Tools/Verify edita.edb) forget about/remove files from 
   the list of previous FTP edits, forcing you to navigate in pFTP and right click/
   Edit with Edita. (This is just a fact rather than a bug or to-do item.)

