# Linux.txt for Simfit Version 7

     linux.txt: Using Simfit and Simdem in Linux under Wine
     ------------------------------------------------------

     Revised details for Simfit Version 7.3.4 onwards.

     https://simfit.org.uk

     In order to maintain the functioning of Simfit and Simdem in
     Wine/Linux, several changes to the configuration items described
     in configure.txt or configure.pdf have been made at Version 7.3.4
     as now listed.

     Item 1 : Show logo on start up.
              ----------------------
              This has been disabled as it is inconsistent with window
              hierarchies in some versions of Wine, despite using
              winecfg to allow Wine to perform window management.

     Item 20: Ghostscript.
              ------------
              Simfit and Simdem now are installed with Ghostscript as
              a DLL, so an independent version is no longer required.
              To force use of an independent Ghostscript installation
              delete or rename gsdll32.dll (or gsdll64.dll).

     Item 30: Paint a background.
              -------------------
              This has been disabled for the same reason as Item 1.
              If there are still background display problems check
              if simfitbar.exe (or x64_simfitbar.exe) are present and,
              if so, delete.

     Item 48: Gdiplus and anti-aliasing.
              --------------------------
              Wine does not now call gdiplus.dll for antialiasing with
              Simfit and Simdem as this has been disabled. In addition,
              dashed, dotted, and dashed-dotted line types do not work
              properly, so a Simfit routine is now used for this purpose.

     Using native Linux binaries.
     ----------------------------
     Note that, with some Linux versions, a certain amount of reconfiguring
     and editing of permissions will be required in order to allow Simfit
     and Simdem to uses native Linux binaries and shared libraries. To avoid
     this it is suggested that, if problems persist when using the native
     binaries, you should use the built-in Wine defaults such as:
     For a text editor   ... Use C:\Windows\System32\Notepad.exe
     For a disk explorer ... Use C:\Windows\System32\Explorer.exe
     For a calculator    ... Use C:\Windows\System32\Calc.exe
     For a pdf reader    ... Use C:\Program Files\sumatraPDF\sumatraPDF.exe
     Of course you may need to install Calc.exe and sumatraPDF.exe, but with
     this combination every Simfit procedure will work correctly.

     Summary
     -------

     The Simfit package will run very well in Linux under Wine, but
     the configuration is somewhat more complicated than in Windows.
     Note that the two configuration files

          l_simfit.cfg and w_simfit.cfg

     will be in the ...\ProgramData\Simfit\user\cfg folder. These can be viewed
     or edited using the configuration option from the main Simfit menu.

     When installing Simfit for the first time, Simfit will try to
     create sensible Linux defaults. If you already have a satisfactory
     configuration, then re-installing Simfit will not overwrite any
     such configuration files.

     ...

     1) Installing Wine
     2) Installing Simfit
     3) Running Simfit
     4) Configuring Simfit
     5) About l_simfit.cfg
     6) Linux auxiliaries
     7) Trouble shooting

     ...

    1) Installing Wine
       ---------------

     You must have a recent version of Wine installed and
     fully functional noting these two very important points.

      a) You must have a set of Windows True Type Fonts or equivalents
         installed in the Wine Windows Fonts folder, and Simfit will warn
         you about any missing fonts.
         Recent versions of Wine should have the fonts but, if not, then
         these fonts can easily be copied over from your Windows
         installation, then added to the Wine supplied fonts. Use
         an external drive or disk, and the DOS command line if you
         cannot do it from the Windows File System Explorer.

      b) You must use the winecfg option to let the Wine windows be
         managed by the operating system windows manager. If you do
         not do this, then the the Linux task bars will be permanently
         obscured, and when you call the Linux auxiliaries they will
         not be visible, as the Simfit controls will remain topmost
         in the Windows hierarchy.

    2) Installing Simfit
       -----------------

     It will be presumed that you have Wine installed as in, e.g.

     /home/wine_installation_name/.wine/drive_c

     Get the simfit setup.exe file from

     https://simfit.org.uk

     then copy it into the drive_c and use wine to execute it, as
     in the command, e.g.

       wine simfit_setup7_3_4.exe (or wine x64_simfit_setup7_3_4.exe)

     This will then install the Simfit package in

     /home/wine_installation_name/.wine/drive_c/Program Files/Simfit/bin

     with no default configuration. On running the Simfit driver
     w_simfit.exe (or x64_simfit.exe) for the first time you will get the
     option to install a default Linux configuration. If you install a
     Windows configuration by mistake, or your configuration becomes
     unusable, delete the  configuration files l_simfit.cfg and
     w_simfit.cfg, so that Simfit can replace the default Windows
     configuration by the default Linux configuration.

     Note that, in recent versions of Wine the single drive called drive_c
     also has a copy in the \dosdevices\c:\ folder and this is where the
     command winepath will specify paths if you try to use Linux executables.

     There are no registry entries needed to run Simfit. However,
     note that the installation program registry entries that are
     created are not required to run Simfit, only to de-install
     the package.

    3) Running Simfit
       --------------

     The Simfit package is run by the single program w_simfit.exe
     (or x64_simfit.exe with 64-bit Simfit) in one of several ways

      (a) You can make a link to this program, or else define a
          shell command to provide the equivalent of

          wine w_simfit.exe

          from within the Simfit directory.

      (b) You can run Simfit from the Wine sub-menu, if Simfit has
          been added to the list of Wine programs.

      (c) You can add desk-top icon to run Simfit from the applications
          bar or elsewhere.

     The first time you run Simfit you will have created the files

           l_simfit.cfg and w_simfit.cfg

     in the ... \ProgramData\Simfit\user\cfg folder in order to allow
     Simfit to create defaults. At this stage you should be aware of
     the information in the next two sections.

    4) Configuring Simfit
       ------------------

     Be careful as this is much more complicated in Linux than in
     Windows.

     You must appreciate several things before attempting to
     configure Simfit.

      a) Within the Wine environment, drive_c behaves just like C: in
         a Windows installation. So the reference manual in the Wine
         environment would be

         C:\Program Files\Simfit\doc\w_manual.pdf

         which is case-insensitive

      b) To Linux outside the Wine environment however, it would be

         "/home/your_name/.wine/dosdrives/c:/Program Files/Simfit/doc/w_manual.pdf"

         where the fully qualified path-filename is case-sensitive and
         the quotes are required because of the space in Program Files.
         You are strongly recommended to set up folders within the
         Wine environment without spaces in the names, and to avoid all
         use of spaces in file names for files you create from Simfit.

      c) When asked to create l_simfit.cfg you must respond by attempting
         to create a Linux default, otherwise a Windows default will be
         created and this will disable the Linux specific aspects of
         Simfit.

        The Windows default is set up to expect Windows auxiliaries
        such as Notepad, Adobe acrobat reader, GSview, etc., but these
        are not required for the Linux installation, as Linux comes
        ready supplied with many excellent auxiliaries. That is, if you
        can get them to work. You may need to use ldconfig to make the
        shared library programs available to Simfit.

        The Linux default attempts to configure Simfit to use the Linux
        built-in programs instead of the Windows programs, but you can
        re-configure to use Windows programs using [Configure] then [Advanced]
        from the main Simfit menu.

        If the Simfit configuration menu shows all Windows auxiliaries then
        either edit l_simfit.cfg using the [Configure] then [Advanced]
        buttons, or delete l_simfit.cfg and w_simfit.cfg from your
        installation and start again.

      d) In Linux, Simfit may create and read local files anywhere
         except within the ...\Simit\bin folder.
         This has several important consequences.

         i) The files such as w_simfit.cfg and l_simfit.cfg that are
            used to configure Simfit will be in the
            ... \ProgramData\Simfit\user\cfg folder not in the Simfit folder.

        ii) Temporary files such as f$123456.tmp that are created by
            Simfit will be in the temporary folder.
            If you choose to delete temporary files (which is the usual
            choice) you will never be aware of such files.

       iii) You will have to configure w_simfit.cfg using the [Configure]
            button on the main page, but then also the l_simfit.cfg file
            using the [Advanced] button.

       e) After using the [Configure] button to edit the configuration
          you must use [Check] to check the changes, then [Apply] to
          overwrite the configuration files. To force an attempt to find
          a default you delete the existing file name then use [Check]
          then apply. Otherwise the full path can be copied and pasted
          into the blank field followed by [Check} then [Apply].

    5) About l_simfit.cfg
       ------------------

     You must edit the file l_simfit.cfg that has been created by Simfit
     to contain the exact Linux path to your home directory, and to the
     Simfit directory, so that Simfit can pass files to the Linux
     auxiliaries. Typical entries would be as follows.

    3 %linux%
    Z:\
    H:\
    /home/YOUR_home_user_name/
    /home/WINE_home_user_name/.wine/dosdrives/c:/
    /home/WINE_home_user_name/.wine/dosdrives/c:/Program Files/Simfit/bin/
    Z:\usr\bin\
    Z:\usr\local\bin\
    Z:\opt\kde3\bin\
    Z:\opt\gnome\bin\
    kwrite
    konqueror
    kprinter
    klipper
    kghostview
    kpdf
    kcalc

    Details for the above configuration parameters
    ==============================================
    The first lines of l_simfit.cfg must be as follows:
     1: version (use 0 %windows% to disable for Windows users)
     2: case-insensitive Wine drive for the root, e.g. Z:\
     3: case-insensitive Wine drive for your Home, e.g. H:\
     4: CASE-SENSITIVE full Linux path to your Home directory
     5: CASE-SENSITIVE full Linux path to Wine C drive, i.e C:
     6: CASE-SENSITIVE full Linux path to the Simfit binary directory
     7: case-insensitive Wine system binary search path 1 (obsolete)
     8: case-insensitive Wine system binary search path 2 (obsolete)
     9: case-insensitive Wine system binary search path 3 (obsolete)
    10: case-insensitive Wine system binary search path 4 (obsolete)
    11: favourite editor, e.g. kwrite, kedit, gedit
    12: favourite explorer, e.g. konqueror, nautilus
    13: favourite PS-driver, e,g, kprinter
    14: favourite clipboard viewer, e.g. klipper
    15: favourite PS-viewer, e.g. kghostview, ggv,evince
    16: favourite PDF-reader, e.g. kpdf, evince
    17: favourite calculator, e.g. kcalc, gnome-calculator

     Lines 1 to 17 must be exactly as above, and lines 4 to 6 are
     case-sensitive. Note that using a tilde (~) or $HOME for your
     home directory may not work.

     If Simfit fails to drive the Linux auxiliaries, it may be
     because w_simfit.cfg and l_simfit.cfg are not formatted
     correctly. In that case delete these configuration files and
     let Simfit create default versions. Alternatively, upgrade
     Wine and Linux and attempt a re-configuration which should
     then allow the binaries or shared library items to be linked
     in at run-time.

    6) Linux auxiliaries
       -----------------

     Linux has many excellent programs to edit text files, read,
     ps and pdf files, and to transform ps files into pdf or png
     files.
     For instance, in Fedora, you can use
       a) Z:\usr\bin\evince for reading ps and pdf files,
       b) Z:\usr\bin\gedit to edit text files, and
       c) Z:\usr\bin\gnome-calculator as a calculator.

     You should experiment and find the best binaries on your
     Linux installation to act as an editor, PS-viewer and
     PDF-reader, etc. Note that you must use [Configure], then
     [Check] and [Apply] to alter the auxiliaries, but note that
     the [Check] option will not work if l_simfit.cfg is formatted
     incorrectly.

    7) Trouble shooting
       ----------------

      a) Problem 1:

         Simfit programs appear as full screen programs blotting out
         the Task bar and obscuring the Windows created by Linux
         auxiliaries.

         Use winecfg to install the mode where Wine employs the window
         manager to manage windows. This should be the Wine default
         anyway.

      b) Problem 2:

         A Linux auxiliary will not display, transform, or print
         a Simfit graphics file or document.

         Some paths defined in w_simfit.cfg and l_simfit.cfg may be
         incorrect. Windows users new to Linux should note that
         paths and filenames are case sensitive, and spaces in file
         names should be avoided. Within Wine always use \ as you
         would in Windows, Simfit will transform the file names
         into Linux format. Note that, you should normally switch
         on the options to add quotes to filenames passed by Simfit
         as arguments, especially if the filenames have spaces.

      c) Problem 3:

         Linux users have a great deal of control on how windows attain or
         relinquish focus (the procedure that determines which program will
         receive keyboard keystrokes and other information) with models such as
         click-to-focus and focus-follows-mouse etc. as well as settings to
         prevent focus loss. The latter is useful, for instance, if you find a
         window launched from another process grabs text that you were typing
         into another window - potentially hazardous if you're typing your
         password at the time.  If you find that Simfit dialogs do not attain
         focus and appear hidden behind the current window, you will need to
         experiment with these setting.  In particular, it has been reported
         that on some KDE systems, setting the "Focus Stealing Prevention
         Level" in System Settings->Look and Feel->Windows Behaviour->Advanced
         to anything other than "None" will prevent Simfit dialogs from
         appearing properly.

      d) Problem 4:

         At one time Simfit could easily use the native Linux programs but, due
         to the growth of new distributions together with security issues, this
         has become increasingly problematical. Because of this a version of
         Simfit is being developed that will not need any auxiliary programs.
         For instance, Simfit no longer needs a Ghostscript installation.

         Note that Simfit versions 7 onwards have been compiled in Windows 10 and
         you should configure Wine to use the Windows 10 mode, although Simfit
         will work perfectly in Windows 7 mode.