unit peach; //Main form of PeaZip, organized in file browser, archiving, extraction, and options screens
{
 DESCRIPTION     :  Application providing GUI for calling PEA and third parts
                    open source executables, giving graphic tools for composing
                    appropriate command lines, such as files/folder selection,
                    import/export lists, choose parameters from graphic menus
                    etc.
                    Provides archive theming, cross-platform desktop, and script
                    integration features.
 REQUIREMENTS    :  FPC, Lazarus
                    Compiled pea and pealauncher in (peazip)/res/bin path
                    third parts executables in (peazip)/res/bin/executablename/
                    path

 EXTERNAL DATA   :  ---

 MEMORY USAGE    :  ---

 DISPLAY MODE    :  ---

 REFERENCES      :  ---

 REMARK          :  "Modification" notes are reported only for the last version.
                    To read all version's notes please refer to Change log page
                    https://peazip.github.io/changelog.html

 Version  Date      Author      Modification
 -------  --------  -------     ------------------------------------------
 PEA-PEACH
 0.10     20060908  G.Tani      Initial version named Pea-Peach 0.10
 0.11     20060920  G.Tani
 0.12     20060927  G.Tani
 0.13     20061103  G.Tani      Changed name of the release to PeaZip 1.0
 0.14     20061201  G.Tani      1.1
 0.15     20070118  G.Tani      1.2
 0.15b    20070122  G.Tani      1.2b
 0.16     20070201  G.Tani      1.3
 0.17     20070305  G.Tani      1.4
 0.18     20070319  G.Tani      1.5
 0.19     20070407  G.Tani      1.6
 0.20     20070512  G.Tani      1.7
 0.21     20070605  G.Tani      1.8
 0.22     20070708  G.Tani      1.8.1
 0.23     20070717  G.Tani      1.8.2
 0.24     20070807  G.Tani      1.9
 0.25     20070904  G.Tani      1.9.1
 0.26     20071003  G.Tani      1.9.2
 0.27     20071101  G.Tani      1.9.3
 0.28     20071206  G.Tani      1.10
 0.29     20080125  G.Tani      1.11
 0.30     20080319  G.Tani      2.0
 0.31     20080517  G.Tani      2.1
 0.32     20080807  G.Tani      2.2
 0.33     20080922  G.Tani      2.3a
 0.34     20081103  G.Tani      2.4
 0.35     20081124  G.Tani      2.4.1
 0.36     20090127  G.Tani      2.5
 0.37     20090224  G.Tani      2.5.1
 0.38     20090403  G.Tani      2.6.beta
 0.39     20090430  G.Tani      2.6
 0.40     20090604  G.Tani      2.6.1
 0.41     20090611  G.Tani      2.6.2
 0.42     20090713  G.Tani      2.6.3
 0.43     20090826  G.Tani      2.7.beta
 0.44     20090914  G.Tani      2.7
 0.45     20091017  G.Tani      2.7.1
 0.46     20091105  G.Tani      2.8.beta
 0.47     20091118  G.Tani      2.8
 0.48     20091202  G.Tani      2.8.1
 0.49     20100104  G.Tani      2.9.beta
 0.50     20100114  G.Tani      2.9
 0.51     20100124  G.Tani      2.9.1
 0.52     20100209  G.Tani      3.0.beta
 0.53     20100216  G.Tani      3.0
 0.54     20100408  G.Tani      3.1.beta
 0.55     20100424  G.Tani      3.1
 0.56     20100613  G.Tani      3.2
 0.57     20100626  G.Tani      3.2.1
 0.58     20100914  G.Tani      3.3
 0.59     20101023  G.Tani      3.4
 0.60     20101123  G.Tani      3.5
 0.61     20101212  G.Tani      3.5.1
 0.62     20101224  G.Tani      3.6
 0.63     20110209  G.Tani      3.6.1
 0.64     20110221  G.Tani      3.6.2
 0.65     20110406  G.Tani      3.7
 0.66     20110611  G.Tani      3.8
 0.67     20110731  G.Tani      3.9
 0.68     20110825  G.Tani      3.9.1
 0.69     20110918  G.Tani      4.0
 0.70     20111016  G.Tani      4.1
 0.71     20111120  G.Tani      4.2
 0.72     20111224  G.Tani      4.3
 0.73     20120128  G.Tani      4.4
 0.74     20120407  G.Tani      4.5
 0.75     20120501  G.Tani      4.5.1
 0.76     20120612  G.Tani      4.6
 0.77     20120702  G.Tani      4.6.1
 0.78     20120807  G.Tani      4.7
 0.79     20120818  G.Tani      4.7.1
 0.80     20120914  G.Tani      4.7.2
 0.81     20121014  G.Tani      4.7.3
 0.82     20121118  G.Tani      4.8
 0.83     20130117  G.Tani      4.8.1
 0.84     20130304  G.Tani      4.9
 0.85     20130323  G.Tani      4.9.1
 0.86     20130421  G.Tani      4.9.2
 0.87     20130617  G.Tani      5.0.0
 0.88     20130718  G.Tani      5.0.1
 0.89     20130830  G.Tani      5.1.0
 0.90     20131002  G.Tani      5.1.1
 0.91     20131122  G.Tani      5.2.0
 0.92     20131225  G.Tani      5.2.1
 0.93     20140221  G.Tani      5.2.2
 0.94     20140410  G.Tani      5.3.0
 0.95     20140502  G.Tani      5.3.1
 0.96     20140707  G.Tani      5.4.0
 0.97     20140810  G.Tani      5.4.1
 0.98     20141015  G.Tani      5.5.0
 0.99     20141201  G.Tani      5.5.1
 1.00     20141220  G.Tani      5.5.2
 1.01     20150117  G.Tani      5.5.3
 1.02     20150425  G.Tani      5.6.0
 1.03     20150613  G.Tani      5.6.1
 1.04     20150718  G.Tani      5.7.0
 1.05     20150811  G.Tani      5.7.1
 1.06     20150824  G.Tani      5.7.2
 1.07     20151003  G.Tani      5.8.0
 1.08     20151018  G.Tani      5.8.1
 1.09     20151125  G.Tani      5.9.0
 1.10     20151227  G.Tani      5.9.1
 1.11     20160221  G.Tani      6.0.0
 1.12     20160424  G.Tani      6.0.1
 1.13     20160512  G.Tani      6.0.2
 1.14     20160618  G.Tani      6.0.3
 1.15     20160721  G.Tani      6.1.0
 1.16     20160909  G.Tani      6.1.1
 1.17     20161101  G.Tani      6.2.0
 1.18     20161226  G.Tani      6.3.0
 1.19     20170205  G.Tani      6.3.1
 1.20     20170323  G.Tani      6.4.0
 1.21     20170429  G.Tani      6.4.1
 1.22     20171014  G.Tani      6.5.0
 1.23     20180208  G.Tani      6.5.1
 1.24     20180503  G.Tani      6.6.0
 1.25     20181024  G.Tani      6.6.1
 1.26     20190205  G.Tani      6.7.0
 1.27     20190309  G.Tani      6.7.1
 1.28     20190413  G.Tani      6.7.2
 1.29     20190501  G.Tani      6.8.0
 1.30     20190613  G.Tani      6.8.1
 1.31     20190815  G.Tani      6.9.0
 1.32     20190825  G.Tani      6.9.1
 1.33     20190831  G.Tani      6.9.2
 1.34     20191125  G.Tani      7.0.0
 1.35     20191228  G.Tani      7.0.1
 1.36     20200201  G.Tani      7.1.0
 1.37     20200307  G.Tani      7.1.1
 1.38     20200406  G.Tani      7.2.0
 1.39     20200424  G.Tani      7.2.1
 1.40     20200505  G.Tani      7.2.2
 1.41     20200514  G.Tani      7.3.0
 1.42     20200531  G.Tani      7.3.1
 1.43     20200618  G.Tani      7.3.2
 1.44     20200820  G.Tani      7.4.0
 1.45     20200905  G.Tani      7.4.1
 1.46     20200929  G.Tani      7.4.2
 1.47     20201110  G.Tani      7.5.0
 1.48     20201212  G.Tani      7.6.0
 1.49     20210105  G.Tani      7.7.0
 1.50     20210210  G.Tani      7.7.1
 1.51     20210315  G.Tani      7.8.0
 1.52     20210417  G.Tani      7.9.0
 1.53     20210609  G.Tani      8.0.0
 1.54     20210720  G.Tani      8.1.0
 1.55     20210909  G.Tani      8.2.0
 1.56     20211111  G.Tani      8.3.0
 1.57     20211212  G.Tani      8.4.0
 1.58     20220219  G.Tani      8.5.0
 1.59     20220406  G.Tani      8.6.0
 1.60     20220622  G.Tani      8.7.0
 1.61     20220814  G.Tani      8.8.0
 1.62     20221008  G.Tani      8.9.0
 1.63     20221215  G.Tani      9.0.0
 1.64     20230221  G.Tani      9.1.0
 1.65     20230415  G.Tani      9.2.0
 1.66     20230623  G.Tani      9.3.0
 1.67     20230808  G.Tani      9.4.0
 1.68     20231020  G.Tani      9.5.0
 1.69     20231210  G.Tani      9.6.0
 1.70     20240209  G.Tani      9.7.0
 1.71     20240213  G.Tani      9.7.1
 1.72     20240424  G.Tani      9.8.0
 1.73     20240728  G.Tani      9.9.0
 1.74     20240814  G.Tani      9.9.1
 1.75     20241019  G.Tani     10.0.0
 1.76     20241109  G.Tani     10.1.0
 1.77     20241226  G.Tani     10.2.0
 1.78     20250218  G.Tani     10.3.0
 1.79     20250405  G.Tani     10.4.0
 1.80     20250609  G.Tani     10.5.0
 1.81     20250806  G.Tani     10.6.0
 1.82     20250814  G.Tani     10.6.1
 1.83     20251015  G.Tani     10.7.0
 1.84     20251201  G.Tani     10.8.0
 1.85     20260203  G.Tani     10.9.0
 1.86     20260405  G.Tani     11.0.0
 1.87     20260508  G.Tani     11.1.0
 1.88     20260708  G.Tani     11.2.0

BACKEND
7z/p7zip 26.02
Pea 1.32 hardened against timing attack on verification of integrity tags

CODE
Code review with various fixes and quality improvements

FILE MANAGER
Added read support for Zeno IMproved .ZIM archives, used for Wikipedia and Project Gutenberg data dumps
Fixed some inconsistencies in icons representation for special folders and search filters
Keyboard shortcuts updated and made fully working when the main menu is set to hidden
 F12 shortcut remapped to Functions, which allows to type, or select from dropdown menu, any of the supported app's function (and run it on the selected files, if applicable for the selected function)
 Ctrl+F12 new shortcut for Run
Improved auto-refresh of the file manager
Improved Drag and drop
 (cross-platform) Drag and drop from system/app to PeaZip with Shift or Ctrl key pressed - to make it compatible with more Operating Systems - shows menu to choose special actions on dragged files (copy/move here, extract, add to archive, open as archive)
 (cross-platform) Improved internal drag and drop menu, now featuring Add to archive and Extract entries - dropped items are sent to archiving or extraction screens, with output set to drop target directory
 (Windows) Improved drag and drop between two instances of the app
  Drag and drop extract is now possible
  Drag and drop files/folders now displays the menu to choose action to perform, consistently with internal drag and drop
Refreshing a non correctly displayed archive (i.e. wrong TOC password) now triggers a new password request prompt, if applicable

EXTRACTION and ARCHIVING
".part1" string (multi volumes .rar archives) removed from the output name after extraction in new folder or smart new folder
Added hint to Output button to document preservation of original filename and extension when pure compression format (Brotli, BZip2, GZip, XZ, Zstd...) is used
Context menu of the extraction screen now shows archive's name, for information, when extracting content from single archive
Improved handling of errors in archive creation procedure

INSTALLERS


243 file extensions supported

Translations updated and replaced in the package

--------------------------------------------------------------------------------
Status of Unicode support (since Lazarus 1.6.0)

1 - (cross-platform) Get Unicode paramstrings > natively supported
2 - (cross-platform) Handle Unicode strings and filenames > natively supported
3 - (Windows) Launch processes supporting Unicode > using tprocessutf8 instead
of tprocess works without requiring workarounds used in 5.8/5.9 releases.
(Unix-like) No issues about full Unicode support are known on *x systems.

--------------------------------------------------------------------------------
Zpaq support limitations

1 - Browsing of .zpaq archives is currently possible only in flat mode (f6) due
to PeaZip browser frontend implementation
2 - Partial extraction is not implemented in PeaZip extraction frontend as it is
supported only for absolute paths by design of the format/backend

--------------------------------------------------------------------------------
Export Convert tasks as scripts limitations

Exporting GUI task as script, if Convert archive flag is set, calls PeaZip
binary itself rather than backend binaries.
This is needed because archive conversion, as performed by PeaZip, needs extra
steps which backend binaries are not always able to perform, mainly:
- dynamically create a temporary fresh new work folder in which extraction step
will take place (some binaries will not force creation of non existing dirs)
- remove the intermediate dir, if the archive contains a single directory in the
root, to avoid to add an unwanted extra level of directory nesting in the
resulting archive (this would be complicated and not always possible to automate
relying on backend binaries only)
This solution limits the conversion to either run with current PeaZip's default
options (not requiring interaction, better for batch use), or to prompt the full
GUI to let the user customize the task on the fly (requires interaction).

--------------------------------------------------------------------------------
Pass parameters to TProcess instead of CommandLine

It is possible to reliably split the TProcess CommandLine in a list of
parameters with ParseCmdLine.

ADVANTAGES: on Unix-like systems it is not possible to use backslash to escape
characters in TProcess CommandLine, while it is possible to use it in parameters
list generated by ParseCmdLine procedure with ReadBackslash option, improving
the program's ability to handle special characters and complex syntax.

LIMITATIONS: currently (Lazarus 4.x) composite commands in some instances (e.g.
add mgotypeRAR comment, PowerShell queries for NTFS ADS and SMART data, ...) work
correctly only passing the entire command line, not passing the list of
parameters, making ParseCmdLine not an universally viable solution to replace
CommandLine keeping the same syntax.

--------------------------------------------------------------------------------
Performances

FILE/ARCHIVE BROWSER
TListView component in the file browser is dynamically switched to virtual mode
in update_listview to improve performances when displaying thousands of items at
once, in the same directory or search filter.
This threshold, ranging to 4 K to 16 K items, is different for each widgetset
(as performances of TListView varies decisively due to implementation in each
widgetset) and the default value can be changed or turned off (disabling virtual
mode) from Options > Settings, Performances group.
Virtual mode allows to display millions of items at once, but anyway
performances will slow down in the range of tens to hundreds -thousands of
items, depending on system performances and widgetset efficiency, due to factors
like:
 - bottleneck of the slow frontend TListView communicating back to the fast
 backend TStringGrid when needed
 - updating and sorting the increasingly large TStringGrid, even if it is a fast
 component
 - sheer increase of needed RAM even if the TStringGrid is memory efficient
 - listing content in the filesystem is mostly bound to the speed of
 FindFirst/FindNext which vary on different operating systems, and can likely be
 influenced by external factors like background filesystem activity/caching,
 slow disk, slow network units etc.
Please note:
A1) when browsing archives, using f6 flat mode raises warning confirmation
message starting from 64K items (fixed value, number of items is found during
pre-parsing, B1 stage explained below) as the operation may require a large
amount of RAM.
A2a) when browsing the file system, using f6 flat mode always raises warning as
many external factors may impact performances, as slow response, unexpexcted
expansion of links, etc.
A2b) when browsing the filesystem, auto-refresh delay time is incremented
starting from 4K items, and disabled at 16K items (fixed value) as the listing
refresh operation request becomes proportionally slower.
The delay time is also incremented for remote units, if detected.

ARCHIVE PRE-PARSER
PeaZip can pre-parse 7z / p7zip supported formats at opening in order to warn
users in advance of possible issues.
To preserve app performances this step can be tuned from level 0 to 5 (lower,
slower) "prebrowse" variable, set in Options > Settings, Browser optimization.
The pre-parse process sums up to:
B1) Check if full actual content of the archive can be listed (list -l option,
code is in list_l procedure), regardless of what is declared in TOC table (which
may be corrupted or have been maliciously modified), which scales reasonably
well up to 1.5M files.
B2) Scan for non explicitly listed dirs, which scales slowly and is maxed at
1.0M files and 32K directories (see table below) unless "Always pre-parse"
option is set (level 0).
If this check is skipped, a fast scan is performed instead, which can detect
most common TOC issues, but it is not able to catch as many possible kinds of
inconsistencies the thorough scan would be able to reconcile.
This step is performed in scan_omitted_dirs procedure.
B3) Scan content of each folder in archive (number of files, folders, compressed
and uncompressed file size).
This step scales slowly and is capped by the expected workload by number of
iterations (number of items multiplied by the number of dirs): 4M for levels 0
and 1, 2M for level 2, 1M for levels 3, 4 and 5.
This step is performed in scan_omitted_dirs procedure.
B4) Create the treeview representation of the structure of archive directories,
performed in populate_archive procedure.
Due to the poor scalability of this specific code, it is limited by the
"maxndirtree" variable: 4K for levels 0 and 1, 3K for level 2, 2K for levels 3,
4 and 5.

ARCHIVER CONTENT NAVIGATION
PeaZip browse 7z / p7zip supported formats using the more informative -slt
option, which is slower and uses more memory, and it is itself limited in
following steps:
C1) browse / search archives is allowed to scale up to 0.5M files to be
displayed at once on screen unless "Always pre-parse" option is set.
C2) same setting is used to scan archives for encrypted content (if applicable
for current format/operation), and scales as C1.
TOC encryption is detected in pre-parse step, items encryption is detected in
list_slt for current path/filter.

Following table represent limitations of "prebrowse" modes from 0 to 5.
"Always pre-parse" will not stop pre-parsing B1, B2 nor listing C1 regadless the
number of found items, even if performances can be poor for very large archives
"Fast mode" will skip pre-parsing, unless errors are detected while listing the
archive #1 or opening an encrypted archive #2
"Do not pre-parse" will skip pre-parsing, unless errors are detected while
opening an encrypted archive #2
APPROX means the limitation is an approximate value, bond to the allowed maximum
memory size, EXACT means the limitation is bound to an exact count of the items.

                         list at once     pre-parse   scan for dirs
             memory      C1, C2 -slt      B1 -l       B2
             APPROX      APPROX           APPROX      EXACT
0 Always     unlimited   unlimited        unlimited   unlimited
1 Very large    192 MB      0.5M              1.5M+   1.0M items / 32K dirs
2 Large         192 MB      0.5M              1.5M+   512K items / 16K dirs
3 Medium         64 MB      160K              0.5M+   256K items / 8K dirs
4 Fast           64 MB      160K        #1,#2 0.5M+   256K items / 8K dirs
5 Never          64 MB      160K           #2 0.5M+   256K items / 8K dirs

In any case archives that cannot be browsed can still be directly listed, tested
and extracted.

Details
1a - execute_cl reading backend output will start using 32 KB of memory to speed
up tasks not requiring to parse a large amount of output, and will increase in
8 MB steps until hitting memory limitation set by the pre-parse mode.
1b - pre-parsing the full content of the archive at opening will stop as set by
"prebrowse" variable, and can be omitted with Do not pre-parse (5) setting
1c - searching for encrypted content in archive will stop accordingly to
pre-parse setting (will not be skipped even with "prebrowse" set to 5)
2a - list_slt table used for browsing is allocated up to 0.5 M files and will
then increase (fast) as needed, while list_l table used for pre-parsing is
allocated to the needed size, unless pre-parsing was stopped at 1b
2b - scanning for omitted directories, which scales slowly, will stop
accordingly to pre-parse setting, maxed to 1.0M items or 32K dirs unless always
pre-parse mode is set.

ARCHIVE CREATION, EXTRACTION, TEST, LIST
Performances are mainly bound to the backend binary; interprocess communication
(through pipe) can be optimized in execute_cl, and launch_cl.
Faster operations like list need tighter loops to quickly process the output,
while slower ones need wider loops with sleep times to keep CPU usage low while
expecting output from the backend.

--------------------------------------------------------------------------------

(C) Copyright 2006 Giorgio Tani giorgio.tani.software@gmail.com
Official PeaZip site: see const FIRSTDOM and SECONDDOM in pea_utils unit
The program is released under GNU LGPL https://www.gnu.org/licenses/lgpl.txt

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 3 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
}

{$mode objfpc}{$H+}
{$IFDEF DARWIN}
{$modeswitch ObjectiveC1}
{$linkframework CoreFoundation}
{$ENDIF}
interface

uses
{$IFDEF MSWINDOWS}
Windows, activex, ShlObj, ComObj, shellapi, windirs,
{$ELSE}
{$IFDEF DARWIN}MacOSAll, CocoaAll, {$ENDIF}baseunix, {$ENDIF}
LResources, Forms, Controls, Graphics, Dialogs, EditBtn, StdCtrls, Buttons,
ExtCtrls, ComCtrls, Grids, Menus, Spin, ShellCtrls, Masks, hash, adler32, CRC16,
CRC24, CRC32, CRC64, ED2K, MD4, MD5, RMD160, SHA1, SHA3_256, SHA256, SHA3_512,
SHA512, Whirl512, Blake2s, Blake2b, mem_util, AES_EAX, FCAES256, list_utils,
pea_utils, img_utils, UnitGwrap, unitAdvf, UnitWeb, UnitPW,
UnitKF, UnitInput, UnitDlg, UnitPM, UnitImgRes, UnitImgCrop, UnitImgViewer,
UnitDrop, UnitPaths, UnitSelect, UnitComment, Classes, SysUtils, Process,
UTF8Process, dateutils, fileutil, LazFileUtils, Types, LCLType, ActnList,
strutils, externalprograms;

type

   { TMyThread }

   TMyThreaddrop = class(TThread)
   private
      vpath:ansistring;
      procedure ReadStatus;
      procedure ShowStatus;
   protected
      procedure Execute; override;
   public
      constructor Create(CreateSuspended: boolean);
   end;

   TMyThreadimg = class(TThread)
   private
      procedure ReadStatus;
      procedure ShowStatus;
   protected
      procedure Execute; override;
   public
      constructor Create(CreateSuspended: boolean);
   end;

   TMyThreadexe = class(TThread)
   private
      procedure ReadStatus;
      procedure ShowStatus;
   protected
      procedure Execute; override;
   public
      constructor Create(CreateSuspended: boolean);
   end;

   TMyThread1 = class(TThread)
   private
      fi:integer;
      fs,fread:ansistring;
      fbitmap:Tbitmap;
      procedure ReadStatus;
      procedure ShowStatus;
   protected
      procedure Execute; override;
   public
      constructor Create(CreateSuspended: boolean);
   end;

   TMyThread2 = class(TThread)
   private
      fi:integer;
      fs,fread:ansistring;
      fbitmap:Tbitmap;
      procedure ReadStatus;
      procedure ShowStatus;
   protected
      procedure Execute; override;
   public
      constructor Create(CreateSuspended: boolean);
   end;

   TMyThread3 = class(TThread)
   private
      fi:integer;
      fs,fread:ansistring;
      fbitmap:Tbitmap;
      procedure ReadStatus;
      procedure ShowStatus;
   protected
      procedure Execute; override;
   public
      constructor Create(CreateSuspended: boolean);
   end;

   TMyThread4 = class(TThread)
   private
      fi:integer;
      fs,fread:ansistring;
      fbitmap:Tbitmap;
      procedure ReadStatus;
      procedure ShowStatus;
   protected
      procedure Execute; override;
   public
      constructor Create(CreateSuspended: boolean);
   end;

   TClipContent = array of array [0..6] of ansistring;
   Thistarray = array[1..8]of ansistring;

   TShellTreeViewOpener = class(TShellTreeView);

   { TFormPeach }

   TFormPeach = class(TForm)
     F12: TAction;
     ctrlF12: TAction;
     pmintddextract: TMenuItem;
     Separator57: TMenuItem;
     pmintddadd: TMenuItem;
     pmintddcancel: TMenuItem;
     Separator56: TMenuItem;
     shiftctrlR: TAction;
     F1: TAction;
     altF1: TAction;
     ctrlF1: TAction;
     mgotypeRAR: TMenuItem;
     shiftF1: TAction;
     altF10: TAction;
     ctrlF10: TAction;
     ctrlF9: TAction;
     shiftctrlF9: TAction;
     shiftF9: TAction;
     shiftctrlZ: TAction;
     shiftctrlX: TAction;
     shiftctrlT: TAction;
     shiftctrlS: TAction;
     shiftctrlG: TAction;
     shiftctrlB: TAction;
     mgotypexz: TMenuItem;
     shiftctrl7: TAction;
     esc: TAction;
     ctrlaltenter: TAction;
     ctrlalt0: TAction;
     ctrlalt9: TAction;
     ctrlalt1: TAction;
     ctrlalt2: TAction;
     ctrlalt3: TAction;
     ctrlalt4: TAction;
     ctrlalt5: TAction;
     ctrlalt6: TAction;
     ctrlalt7: TAction;
     ctrlalt8: TAction;
     ctrlaltN7: TAction;
     ctrlaltN8: TAction;
     ctrlaltN9: TAction;
     ctrlaltN6: TAction;
     ctrlaltN3: TAction;
     ctrlaltN2: TAction;
     ctrlaltN1: TAction;
     ctrlaltN4: TAction;
     ctrlaltN5: TAction;
     ctrldot: TAction;
     alt1: TAction;
     ctrlaltA: TAction;
     shiftctrlF11: TAction;
     shiftcrtlF4: TAction;
     shiftF4: TAction;
     ctrlF4: TAction;
     shiftaltF4: TAction;
     shiftctrlaltF4: TAction;
     ctrlA: TAction;
     marchname: TMenuItem;
     shiftF5: TAction;
     altF5: TAction;
     ctrlF5: TAction;
     altF3: TAction;
     ctrlW: TAction;
     shiftctrlF3: TAction;
     ctrlF8: TAction;
     shiftF8: TAction;
     shiftF3: TAction;
     ctrlF3: TAction;
     altUP: TAction;
     alt4: TAction;
     alt5: TAction;
     alt6: TAction;
     alt7: TAction;
     alt8: TAction;
     BKSP: TAction;
     altRIGHT: TAction;
     altLEFT: TAction;
     ctrlD: TAction;
     ctrlH: TAction;
     ctrlaltH: TAction;
     alt0: TAction;
     alt2: TAction;
     ctrlF: TAction;
     ctrlB: TAction;
     ctrlN: TAction;
     CheckBoxLog: TCheckBox;
     ctrl0: TMenuItem;
     ctrl1: TMenuItem;
     ctrl2: TMenuItem;
     ctrl3: TMenuItem;
     ctrl4: TMenuItem;
     ctrl5: TMenuItem;
     ctrl6: TMenuItem;
     ctrl7: TMenuItem;
     ctrl8: TMenuItem;
     ctrl9: TMenuItem;
     ctrlaltD: TMenuItem;
     ctrlaltE: TMenuItem;
     shiftctrlaltD: TMenuItem;
     shiftctrlaltE: TMenuItem;
     shiftctrlaltN: TMenuItem;
     shiftctrlaltS: TMenuItem;
     mexttob9: TMenuItem;
     mexttob10: TMenuItem;
     mexttob11: TMenuItem;
     mexttob12: TMenuItem;
     mexttob13: TMenuItem;
     mexttob14: TMenuItem;
     mexttob15: TMenuItem;
     mexttob16: TMenuItem;
     mexttob17: TMenuItem;
     mexttob18: TMenuItem;
     mexttob19: TMenuItem;
     mexttob20: TMenuItem;
     mexttob21: TMenuItem;
     mexttob22: TMenuItem;
     mexttob23: TMenuItem;
     Separator55: TMenuItem;
     Separator54: TMenuItem;
     Separator53: TMenuItem;
     Separator31: TMenuItem;
     mextto_home: TMenuItem;
     mextto_desktop: TMenuItem;
     mextto_downloads: TMenuItem;
     mextto_documents: TMenuItem;
     mextto_music: TMenuItem;
     mextto_pictures: TMenuItem;
     mextto_videos: TMenuItem;
     mextto_dropbox: TMenuItem;
     mextto_googledrive: TMenuItem;
     mextto_onedrive: TMenuItem;
     mextto_shp: TMenuItem;
     mextto_y: TMenuItem;
     mextto_pubhome: TMenuItem;
     mextto_pubdoc: TMenuItem;
     mextto23: TMenuItem;
     mextto24: TMenuItem;
     mextto25: TMenuItem;
     mextto26: TMenuItem;
     mextto2: TMenuItem;
     mextto3: TMenuItem;
     mextto4: TMenuItem;
     mextto5: TMenuItem;
     mextto6: TMenuItem;
     mextto7: TMenuItem;
     mextto8: TMenuItem;
     mextto9: TMenuItem;
     mextto10: TMenuItem;
     mextto11: TMenuItem;
     mextto12: TMenuItem;
     mextto13: TMenuItem;
     mextto14: TMenuItem;
     mextto15: TMenuItem;
     mextto16: TMenuItem;
     mextto17: TMenuItem;
     mextto18: TMenuItem;
     mextto19: TMenuItem;
     mextto20: TMenuItem;
     mextto21: TMenuItem;
     mextto22: TMenuItem;
     mextto1: TMenuItem;
     Separator30: TMenuItem;
     mexttobook: TMenuItem;
     mexttofs: TMenuItem;
     mextto_Last: TMenuItem;
     mextto_here: TMenuItem;
     pmtabrefresh: TMenuItem;
     pmbatchtest: TMenuItem;
     pmrender: TMenuItem;
     pmrendernative: TMenuItem;
     pmrendersoft: TMenuItem;
     pmrendersharp: TMenuItem;
     Separator52: TMenuItem;
     shiftEtogglearchivetree: TAction;
     cbautobrowsetar: TComboBox;
     cbmiddlebutton: TComboBox;
     cbRARrv: TCheckBox;
     cbshowhidden: TCheckBox;
     CheckBoxParams: TCheckBox;
     CheckBoxBackground: TCheckBox;
     CheckBoxShowVolatile: TCheckBox;
     CheckBoxLimitKFSize: TCheckBox;
     CheckBoxZstdErrPolicy: TCheckBox;
     ComboBoxPAQThreads: TComboBox;
     ComboBoxVirtual: TComboBox;
     editExtEvForSec: TEdit;
     EditOptSearch: TComboBox;
     f11fullscreen: TAction;
     f9pwprompt: TAction;
     f8openbook1: TAction;
     f4menu: TAction;
     f3search: TAction;
     f5refresh: TAction;
     f6flat: TAction;
     ActionList1: TActionList;
     babouttos: TSpeedButton;
     baboutfaq: TSpeedButton;
     baboutlocalhelp: TSpeedButton;
     baboutbin: TSpeedButton;
     baboutthemes: TSpeedButton;
     baboutremoveunace: TSpeedButton;
     baboutremoveunrar: TSpeedButton;
     baboutsupport: TSpeedButton;
     baboutchangelog: TSpeedButton;
     babouttranslations: TSpeedButton;
     babouttracker: TSpeedButton;
     baboutup: TSpeedButton;
     baboutplugindir: TSpeedButton;
     baboutplugins: TSpeedButton;
     baboutweb: TSpeedButton;
     Bevel11: TShape;
     Bevel12: TShape;
     Bevel13: TShape;
     Bevel14: TShape;
     Bevel15: TShape;
     Bevel16: TShape;
     Bevel18: TShape;
     Labeladvextzstd: TLabel;
     Labelmiddlebutton: TLabel;
     pmextto: TMenuItem;
     pmextdesk: TMenuItem;
     pmextdoc: TMenuItem;
     Separator51: TMenuItem;
     Separator50: TMenuItem;
     pmintdddest: TMenuItem;
     Separator49: TMenuItem;
     pmintddmove: TMenuItem;
     pmintddcopy: TMenuItem;
     pmdeletefromarchive: TMenuItem;
     Separator47: TMenuItem;
     mlog: TMenuItem;
     pmjumpapple: TMenuItem;
     MenuItemViewImage: TMenuItem;
     MenuItemForceThumbnails: TMenuItem;
     po_open_browser: TMenuItem;
     MenuItemERBrowser: TMenuItem;
     MenuItemPreBrowser: TMenuItem;
     MenuItemCopypathsMenu: TMenuItem;
     pmfun35: TMenuItem;
     pmfun27: TMenuItem;
     pmfun28: TMenuItem;
     pmfun29: TMenuItem;
     pmfun30: TMenuItem;
     pmfun31: TMenuItem;
     pmfun32: TMenuItem;
     pmfun33: TMenuItem;
     pmfun34: TMenuItem;
     pmfun26: TMenuItem;
     pmfun25: TMenuItem;
     seRARrv: TSpinEdit;
     ShapeListBar: TShape;
     Bevel21: TShape;
     BevelTitleOpt1: TPanel;
     BevelTitleOpt2: TPanel;
     BevelTitleOpt3: TPanel;
     BevelTitleOpt4: TPanel;
     BevelTitleOpt5: TPanel;
     BevelTitleOpt6: TPanel;
     BevelTitleOpt7: TPanel;
     BevelTitleOpt8: TPanel;
     BevelTitleOptions2: TPanel;
     BevelTitleOptions6: TPanel;
     BevelTitleOptions7: TPanel;
     BevelTitleOptions8: TPanel;
     BSchedule: TBitBtn;
     BScheduleExt: TBitBtn;
     ButtonOptCancel: TBitBtn;
     ButtonOptOK: TBitBtn;
     ButtonEditDesk: TButton;
     ButtonOutAdd: TSpeedButton;
     ButtonOutUpdate: TSpeedButton;
     ButtonEditNameAdd: TButton;
     ButtonCustomExt: TSpeedButton;
     ButtonEditNameOutExtract: TButton;
     ButtonEditNameUpdate: TButton;
     ButtonOpenCustom: TSpeedButton;
     ButtonEditNameCustom: TButton;
     ButtonEditNameCustomExt: TButton;
     Buttonfmactions1: TSpeedButton;
     ButtonRefSize: TButton;
     ButtonOutExtract: TSpeedButton;
     ButtonAddActions: TSpeedButton;
     cbAdvfAdd: TCheckBox;
     cbAdvfExt: TCheckBox;
     cbforcetype: TComboBox;
     cbDeleteInputModeExt: TComboBox;
     cbDeleteInputModeAdd: TComboBox;
     cbEncExtension: TCheckBox;
     cbSmallIconSize: TComboBox;
     cbExtEvForHow: TComboBox;
     cbRAR: TCheckBox;
     cbRARmanual: TCheckBox;
     cbRARBLAKE2: TCheckBox;
     cbRARlastmodtime: TComboBox;
     cbRARlock: TCheckBox;
     cbRARsaveopen: TCheckBox;
     cbRARsavesecurity: TCheckBox;
     cbRARsavestreams: TCheckBox;
     cbRARsfx: TCheckBox;
     cbRARrr: TCheckBox;
     cbRARsolid: TCheckBox;
     cbdefaultaction: TComboBox;
     cbtarpipe: TCheckBox;
     cbuntarpipe: TCheckBox;
     cbBoxAltBarStyle: TComboBox;
     CheckBoxUTC: TCheckBox;
     ComboBoxPEAKDF: TComboBox;
     ComboBoxPEAKDFw: TComboBox;
     csbmusic: TSpeedButton;
     csbpic: TSpeedButton;
     csbvid: TSpeedButton;
     csbdownloads: TSpeedButton;
     csbdoc: TSpeedButton;
     csbhome: TSpeedButton;
     LabelSysBin: TLabel;
     cbtimecreated: TCheckBox;
     cbType: TComboBox;
     cbUn7zaRecursive: TCheckBox;
     cbUn7zaRecursiveExclude: TCheckBox;
     cbzooming: TComboBox;
     CheckBoxExtNotArchives: TCheckBox;
     CheckBoxExtUnsupported: TCheckBox;
     CheckBoxExtUnsupportedPeaZip: TCheckBox;
     cbautoclosesingleextract: TCheckBox;
     cbEncoding: TComboBox;
     cbCustomExtension: TCheckBox;
     cbspacing: TComboBox;
     CheckBox7zunrar5: TCheckBox;
     cbAccentToolBar: TComboBox;
     cbAltBar: TComboBox;
     CheckBoxAltgridcol: TCheckBox;
     cbAltTabStyle: TComboBox;
     cbAltTabs: TComboBox;
     CheckBox7zOF: TCheckBox;
     CheckBoxAutoExtTar: TCheckBox;
     CheckBoxAutoExtTarConvert: TCheckBox;
     cbqdup: TCheckBox;
     CheckBoxAutoTest: TCheckBox;
     CheckBoxAutoOpen: TCheckBox;
     CheckBoxClosePeaZip: TCheckBox;
     CheckBoxEditArchives: TCheckBox;
     CheckBoxEnumd: TCheckBox;
     CheckBoxAC: TCheckBox;
     CheckBoxSmartFolder: TCheckBox;
     CheckBoxForceConvert: TCheckBox;
     CheckBoxExcludeEF: TCheckBox;
     CheckBoxForceLayout: TCheckBox;
     CheckBoxrelative: TCheckBox;
     CheckBoxSkipenc: TCheckBox;
     CheckBoxsnoi: TCheckBox;
     CheckBoxsnh: TCheckBox;
     CheckBoxsnl: TCheckBox;
     CheckBoxsnon: TCheckBox;
     CheckBoxsnzExt: TCheckBox;
     CheckBoxCenteredToolbar: TCheckBox;
     cbSolidAddress: TComboBox;
     CheckBoxssp: TCheckBox;
     CheckBoxstl: TCheckBox;
     CheckBoxzpaqabsolute: TCheckBox;
     CheckBoxzpaqall: TCheckBox;
     CheckBoxzpaqforce: TCheckBox;
     CheckBoxzpaqfull: TCheckBox;
     ComboBoxMaxArg: TComboBox;
     ComboBoxSyntaxLevel: TComboBox;
     ComboBox7zMemuse: TComboBox;
     ComboBoxSysbin: TComboBox;
     ComboBoxTAR: TComboBox;
     ComboBoxTARTS: TComboBox;
     ComboBoxTheme: TComboBox;
     ConsoleAdd: TPanel;
     ConsoleExtract: TPanel;
     csbdesk: TSpeedButton;
     CheckBoxSkipDel: TCheckBox;
     ComboBoxLanguage: TComboBox;
     csbroot: TSpeedButton;
     EditAddSame: TEdit;
     Editalias: TEdit;
     EditOutExtractSame: TEdit;
     EditUn7zaFilterExclude: TEdit;
     gbConsoleCreate: TPanel;
     gbConsoleCreateExt: TPanel;
     iConsoleCreateImport: TImage;
     iConsoleCreateImportExt: TImage;
     il_dtheme_16_dark: TImageList;
     il_dtheme_96_dark: TImageList;
     il_dtheme_tool32_dark: TImageList;
     il_nonthemed_dark: TImageList;
     BtnPjSaveAdd: TBitBtn;
     BtnPjLaunchAdd: TBitBtn;
     BtnPjLaunchExt: TBitBtn;
     ImageFlatcrop: TSpeedButton;
     ImageFlattransform: TSpeedButton;
     ImageFlatren: TSpeedButton;
     ImageFlatconvert: TSpeedButton;
     ImageFlatfolder: TSpeedButton;
     ImageFlatdup: TSpeedButton;
     ImageInfoConsole: TImage;
     ImageInfoConsoleExt: TImage;
     ImageBCtext: TImage;
     BtnPjSaveExt: TBitBtn;
     ImOpt1: TImage;
     ImageFlat: TSpeedButton;
     ImageFlatadd: TSpeedButton;
     ImageFlatext: TSpeedButton;
     ImageFlattestmore: TSpeedButton;
     BtnPassword: TSpeedButton;
     ImOpt2: TImage;
     ImOpt3: TImage;
     ImOpt4: TImage;
     ImOpt5: TImage;
     ImOpt6: TImage;
     ImOpt7: TImage;
     ImOpt8: TImage;
     LabelPAQThreads: TLabel;
     LabelComment: TLabel;
     LabelExtHere: TLabel;
     LabelFunctionExtract: TLabel;
     LabelNamingExtract: TLabel;
     LabelContrast: TLabel;
     Labeloamtar: TLabel;
     Labeloambrowser: TLabel;
     Labelogmisc: TLabel;
     Labeloptsubsec: TLabel;
     LabelPEAKDFw: TLabel;
     LabelPEAKDF: TLabel;
     LabelTitleOptions6: TLabel;
     LabelUpdates: TLabel;
     LabelDoc: TLabel;
     LabelAddFolder: TLabel;
     Labeladvextzpaq: TLabel;
     LabelAdvExtZpaqBrZst: TLabel;
     LabelColorTemperature: TLabel;
     LabelTabsStyle: TLabel;
     labelmaxarg: TLabel;
     Labelo1: TLabel;
     Labelo2: TLabel;
     Labelo3: TLabel;
     Labelo4: TLabel;
     Labelo5: TLabel;
     Labelo6: TLabel;
     Labelo7: TLabel;
     Labelo8: TLabel;
     Labeloptsub8: TLabel;
     LabelPMpw: TLabel;
     Labelsmsize: TLabel;
     Labelspac6: TLabel;
     LabelPathUpdate: TLabel;
     LabelUpdateAddress: TLabel;
     Labelsyntaxlevel: TLabel;
     Label7zMemuse: TLabel;
     LabelAddressBar: TLabel;
     LabelActAdd: TLabel;
     LabelSpanAdd: TLabel;
     LabelLevelAdd: TLabel;
     LabelActUpdate: TLabel;
     LabelTypeAdd: TLabel;
     LabelColorToolbar: TLabel;
     LabelColorAddressbar: TLabel;
     LabelColorTabs: TLabel;
     LabelmoreoptExt: TLabel;
     LabelForceLayout: TLabel;
     CheckBoxExtrac32: TCheckBox;
     CheckBoxForceBrowse: TCheckBox;
     CheckBoxExtAnd: TCheckBox;
     ComboBoxKiB: TComboBox;
     ComboBoxPriority: TComboBox;
     Editcommonalgo: TEdit;
     EditCustomExtension: TEdit;
     editExtEvForWhat: TEdit;
     LabelTree: TLabel;
     LabelDefaultAction: TLabel;
     LabelColor2d: TLabel;
     LabelColPresets: TLabel;
     LabelmoreoptAdd: TLabel;
     Labeloafter: TLabel;
     LabelHash: TLabel;
     LabelCommonAlgo: TLabel;
     LabelFileSize: TLabel;
     Labelspac5: TLabel;
     LabelAddFiles: TLabel;
     LabelStatusClip: TLabel;
     LabelStatusAddUpdate: TLabel;
     LabelGoExtract: TLabel;
     Labelalias: TLabel;
     Labeltaropt: TLabel;
     LabeltaroptTS: TLabel;
     LabelTitleOptions1: TLabel;
     LabelTitleOptions2: TLabel;
     LabelTitleOptions3: TLabel;
     LabelTitleOptions4: TLabel;
     LabelTitleOptions5: TLabel;
     LabelTitleOptions7: TLabel;
     LabelTitleOptions8: TLabel;
     Labelspacing: TLabel;
     Labelsetwork: TLabel;
     Labelzooming: TLabel;
     lConsoleCreate_jobcode: TLabel;
     lConsoleCreate_jobcodeExt: TLabel;
     lConsoleCreate_outname: TLabel;
     lConsoleCreate_outnameExt: TLabel;
     LabelPriority: TLabel;
     CheckBoxNoConf: TCheckBox;
     CheckBoxzipxswitch: TCheckBox;
     CheckBoxZstd: TCheckBox;
     CheckBoxConvertPW: TCheckBox;
     CheckBoxDragDrop: TCheckBox;
     CheckBoxEncoding: TCheckBox;
     CheckBoxForceEdit: TCheckBox;
     CheckBoxAutoOpenTar: TCheckBox;
     CheckBoxForceOpen: TCheckBox;
     LabelPrebrowse: TLabel;
     CheckBoxBrotli: TCheckBox;
     CheckBoxsni: TCheckBox;
     CheckBoxIgnorePaths: TCheckBox;
     CheckBoxsniExt: TCheckBox;
     CheckBoxsns: TCheckBox;
     CheckBoxARCrr: TCheckBox;
     CheckBoxARCsfx: TCheckBox;
     CheckBoxARCabs: TCheckBox;
     CheckBoxMailAdd: TCheckBox;
     CheckBox7zSFX: TCheckBox;
     CheckBoxArchiveHistory: TCheckBox;
     CheckBoxAutoHaltA: TCheckBox;
     CheckBoxAutoHaltE: TCheckBox;
     CheckBoxBrowseNotVerbose: TCheckBox;
     CheckBoxConvert: TCheckBox;
     CheckBoxConvertVerbose: TCheckBox;
     CheckBoxDate: TCheckBox;
     CheckBoxDeleteInputExt: TCheckBox;
     CheckBoxDeleteInputAdd: TCheckBox;
     CheckBoxFolder: TCheckBox;
     CheckBoxIgnoreDisp: TCheckBox;
     CheckBoxIgnoreSel: TCheckBox;
     CheckBoxIntDir: TCheckBox;
     CheckBoxMailKeep: TCheckBox;
     CheckBoxSolidExtension: TCheckBox;
     CheckBoxNameAsParentFolder: TCheckBox;
     CheckBoxnetworkinfo: TCheckBox;
     CheckBoxParallelArchiving: TCheckBox;
     CheckBoxQuadMax: TCheckBox;
     CheckBoxSameArc: TCheckBox;
     CheckBoxSameExt: TCheckBox;
     CheckBoxSeparate: TCheckBox;
     CheckBoxShowHints: TCheckBox;
     CheckBoxsnsExt: TCheckBox;
     CheckBoxTarBefore: TCheckBox;
     CheckBoxUnPeaAttributes: TCheckBox;
     CheckBoxUPXStrip: TCheckBox;
     CheckBoxUPXBackup: TCheckBox;
     CheckBoxWindowStatus: TCheckBox;
     CheckBoxzcopy: TCheckBox;
     cbRAR5: TCheckBox;
     CheckGroupM1: TCheckGroup;
     CheckGroupMExt: TCheckGroup;
     CheckGroupW: TCheckGroup;
     CheckGroupWExt: TCheckGroup;
     ColorButton1: TColorButton;
     ColorButton2: TColorButton;
     ColorButton3: TColorButton;
     ComboBoxConsoleEncoding: TComboBox;
     ComboBoxDrag: TComboBox;
     comboRARdict: TComboBox;
     ComboBoxWD: TComboBox;
     ComboBoxLibre: TComboBox;
     ComboBoxprivacy: TComboBox;
     ComboBox7zalgo: TComboBox;
     ComboBoxARCLevel: TComboBox;
     ComboBoxARCFun: TComboBox;
     ComboBoxARCalgo: TComboBox;
     cbSplit: TComboBox;
     cbAct: TComboBox;
     ComboBoxSplit: TComboBox;
     ComboBox7zMethod: TComboBox;
     ComboBox7zLevel: TComboBox;
     ComboBox7zDictionary: TComboBox;
     ComboBox7zWord: TComboBox;
     ComboBox7zFun: TComboBox;
     ComboBox7zThreads: TComboBox;
     cbLevel: TComboBox;
     ComboBoxArchiveActUpdate: TComboBox;
     ComboBoxArchiveCustom: TComboBox;
     ComboBoxCustomSyntaxExt: TComboBox;
     ComboBox7zPasses: TComboBox;
     ComboBox7zPaths: TComboBox;
     ComboBoxArchivePathsExt: TComboBox;
     ComboBox7zSolid: TComboBox;
     ComboBoxBCMSolid: TComboBox;
     ComboBoxArcSfx: TComboBox;
     ComboBoxArcSolid: TComboBox;
     ComboBoxM2: TComboBox;
     ComboBoxMExt: TComboBox;
     ComboBoxOverwrite: TComboBox;
     ComboBoxOverwriteARC: TComboBox;
     ComboBoxPAQLevel: TComboBox;
     ComboBoxPasses: TComboBox;
     ComboBoxPEAStream: TComboBox;
     ComboBoxPEAObj: TComboBox;
     ComboBoxPEAVol: TComboBox;
     ComboBoxPEALevel: TComboBox;
     ComboBoxSD: TComboBox;
     ComboBoxSplitAlgo: TComboBox;
     ComboBoxUPX: TComboBox;
     ComboBoxBrowser: TComboBox;
     CompressionARC: TPanel;
     CompressionCustom: TPanel;
     CompressionCustomExt: TPanel;
     ctrlext: TSpeedButton;
     ctrlarc: TSpeedButton;
     DateEdit1: TDateEdit;
     DateEdit2: TDateEdit;
     DateEditExt1: TDateEdit;
     DateEditExt2: TDateEdit;
     Edit1: TEdit;
     Edit2: TEdit;
     Edit3: TEdit;
     EditAddFilename: TEdit;
     EditAddName: TEdit;
     EditEncoding: TEdit;
     EditNameUpdate: TEdit;
     EditDesk: TEdit;
     EditExtensionCustom: TEdit;
     EditAddFilepath: TEdit;
     EditNameCustom: TEdit;
     EditNameCustomExt: TEdit;
     Edit7zOpt: TEdit;
     EditOParc: TEdit;
     EditOPcustom: TEdit;
     EditCustomParamExt: TEdit;
     EditOutExtract: TEdit;
     EditSchedulePassword: TEdit;
     EditSchedulePasswordExt: TEdit;
     EditScheduleUser: TEdit;
     EditScheduleUserExt: TEdit;
     EditUn7zaFilter: TEdit;
     EditUn7zaFilterInteractive: TEdit;
     Group7z2: TPanel;
     Group7z1: TPanel;
     PanelExtAdv: TPanel;
     GroupExtract: TPanel;
     PanelAddArchiveOut: TPanel;
     PanelAddUpdateOut: TPanel;
     GroupBoxPEAAdv: TPanel;
     ImageInfoCustomExt: TImage;
     il_dtheme_96: TImageList;
     ImageListDlg: TImageList;
     Imagesp1: TImage;
     ImageInfoBinaries: TImage;
     ImageInfoEncoding: TImage;
     ButtonPasswordUpdate: TSpeedButton;
     Imagesp: TImage;
     Labelcb18: TLabel;
     LabelCustomDesktop: TLabel;
     LabelColor2b: TLabel;
     Labellightpresets: TLabel;
     LabelEncoding: TLabel;
     LabelAdvThemes: TLabel;
     LabelVirtual: TLabel;
     lsetdefaultout_arc: TLabel;
     Labelextevfor: TLabel;
     LabelConfigurearc: TLabel;
     LabelConfigureext: TLabel;
     Labeloamext1: TLabel;
     Labelrr: TLabel;
     labelRARdict: TLabel;
     Labelconsoleencoding: TLabel;
     Labeladvextace: TLabel;
     LabelFormColor: TLabel;
     LabelTextAccentColor: TLabel;
     LabelConfigurePw: TLabel;
     LabelCustomWorkPath: TLabel;
     LabelAppPath: TLabel;
     LabelOpenDesktop: TLabel;
     LabelcbSD: TLabel;
     LabelcbSDcustom: TLabel;
     LabelConf: TLabel;
     LabelOpenConf: TLabel;
     LabelConfigureSendTo: TLabel;
     LabelDefaultColor2: TLabel;
     LabelDefaultColor3: TLabel;
     LabelDefaultOpacity: TLabel;
     LabelInfoGeneral: TLabel;
     Labeloaenc: TLabel;
     Labeloaui: TLabel;
     Labelogpaths: TLabel;
     LabelOpacity: TLabel;
     Labelspac4: TLabel;
     LabelErrors: TLabel;
     LabelOutUpdate: TLabel;
     lsetdefaultout_ext: TLabel;
     eowrun: TMenuItem;
     lightdim: TMenuItem;
     lightlow: TMenuItem;
     lightmocha: TMenuItem;
     lightsenape: TMenuItem;
     lightgraphite: TMenuItem;
     lightplum: TMenuItem;
     mConsoleCreate: TMemo;
     mConsoleCreateExt: TMemo;
     mdefarcset: TMenuItem;
     MemoList: TMemo;
     aabc1: TMenuItem;
     aabc2: TMenuItem;
     aabc3: TMenuItem;
     aabc4: TMenuItem;
     aabc5: TMenuItem;
     aabc6: TMenuItem;
     aabc7: TMenuItem;
     aabc8: TMenuItem;
     apmbcexpand: TMenuItem;
     mdownloadthemes: TMenuItem;
     mdirbeforefiles: TMenuItem;
     mdefaultextract: TMenuItem;
     mdefaultarchive: TMenuItem;
     mbtext: TMenuItem;
     mbkde: TMenuItem;
     mbgnome: TMenuItem;
     mbgnome4: TMenuItem;
     mbmac: TMenuItem;
     mccomment: TMenuItem;
     mbrowserccomment: TMenuItem;
     mcomment: TMenuItem;
     po_functionsdummy: TMenuItem;
     layoutmotw: TMenuItem;
     layoutmotwfull: TMenuItem;
     MenuItem23: TMenuItem;
     MenuItem28: TMenuItem;
     MenuItem58: TMenuItem;
     MenuItem87: TMenuItem;
     MenuItemArchive_documents1: TMenuItem;
     MenuItemArchive_downloads: TMenuItem;
     MenuItemArchive_dropbox: TMenuItem;
     MenuItemArchive_googledrive: TMenuItem;
     MenuItemArchive_home1: TMenuItem;
     MenuItemArchive_music: TMenuItem;
     MenuItemArchive_onedrive: TMenuItem;
     MenuItemArchive_pictures: TMenuItem;
     MenuItemArchive_pubdoc: TMenuItem;
     MenuItemArchive_pubhome: TMenuItem;
     MenuItemArchive_shp: TMenuItem;
     MenuItemArchive_y: TMenuItem;
     MenuItemArchive_videos: TMenuItem;
     mpathdesk1: TMenuItem;
     mpathexplore1: TMenuItem;
     mpathreset1: TMenuItem;
     mpathself1: TMenuItem;
     mshowhidden: TMenuItem;
     MenuItemToolsj: TMenuItem;
     pajdn1: TMenuItem;
     pajdn10: TMenuItem;
     pajdn11: TMenuItem;
     pajdn12: TMenuItem;
     pajdn13: TMenuItem;
     pajdn14: TMenuItem;
     pajdn15: TMenuItem;
     pajdn16: TMenuItem;
     pajdn17: TMenuItem;
     pajdn18: TMenuItem;
     pajdn19: TMenuItem;
     pajdn2: TMenuItem;
     pajdn20: TMenuItem;
     pajdn21: TMenuItem;
     pajdn22: TMenuItem;
     pajdn23: TMenuItem;
     pajdn24: TMenuItem;
     pajdn25: TMenuItem;
     pajdn26: TMenuItem;
     pajdn3: TMenuItem;
     pajdn4: TMenuItem;
     pajdn5: TMenuItem;
     pajdn6: TMenuItem;
     pajdn7: TMenuItem;
     pajdn8: TMenuItem;
     pajdn9: TMenuItem;
     pnabc0: TMenuItem;
     pnabc1: TMenuItem;
     pnabc2: TMenuItem;
     pnabc3: TMenuItem;
     pnabc4: TMenuItem;
     pnabc5: TMenuItem;
     pnabc6: TMenuItem;
     pnabc7: TMenuItem;
     pnabc8: TMenuItem;
     pnba1: TMenuItem;
     pnba10: TMenuItem;
     pnba11: TMenuItem;
     pnba12: TMenuItem;
     pnba13: TMenuItem;
     pnba14: TMenuItem;
     pnba15: TMenuItem;
     pnba16: TMenuItem;
     pnba17: TMenuItem;
     pnba18: TMenuItem;
     pnba19: TMenuItem;
     pnba2: TMenuItem;
     pnba20: TMenuItem;
     pnba21: TMenuItem;
     pnba22: TMenuItem;
     pnba23: TMenuItem;
     pnba3: TMenuItem;
     pnba4: TMenuItem;
     pnba5: TMenuItem;
     pnba6: TMenuItem;
     pnba7: TMenuItem;
     pnba8: TMenuItem;
     pnba9: TMenuItem;
     pnha0s: TMenuItem;
     pnha1: TMenuItem;
     pnha2: TMenuItem;
     pnha3: TMenuItem;
     pnha4: TMenuItem;
     pnha5: TMenuItem;
     pnha6: TMenuItem;
     pnha7: TMenuItem;
     pnha8: TMenuItem;
     pnra0: TMenuItem;
     pnra1: TMenuItem;
     pnra2: TMenuItem;
     pnra3: TMenuItem;
     pnra4: TMenuItem;
     pnra5: TMenuItem;
     pnra6: TMenuItem;
     pnra7: TMenuItem;
     pnra8: TMenuItem;
     PopupPathArchive: TPopupMenu;
     po_s256j: TMenuItem;
     pmmoreshaj: TMenuItem;
     po_lingdisks: TMenuItem;
     po_linglogs: TMenuItem;
     po_linlshw: TMenuItem;
     po_motwfull: TMenuItem;
     OpenDialogCustom: TOpenDialog;
     pmmoremotw: TMenuItem;
     po_checkmotw: TMenuItem;
     po_ntfszi: TMenuItem;
     po_ntfsads: TMenuItem;
     pmnavbooks: TPopupMenu;
     po_functionsaz: TMenuItem;
     pmfun24: TMenuItem;
     pmfun19: TMenuItem;
     pmfun20: TMenuItem;
     pmfun21: TMenuItem;
     pmfun22: TMenuItem;
     pmfun23: TMenuItem;
     pmspold: TMenuItem;
     mz175: TMenuItem;
     pmspminimal: TMenuItem;
     pmsppostmodern: TMenuItem;
     pmspmodern: TMenuItem;
     pmstylepresets: TMenuItem;
     pmspclassic: TMenuItem;
     MenuItemOpen_saveascsvl: TMenuItem;
     MenuItemOpen_saveastsv: TMenuItem;
     MenuItemOpen_saveas: TMenuItem;
     pmsaveascsvl: TMenuItem;
     pmsaveas: TMenuItem;
     pmsaveastsv: TMenuItem;
     po_savecopy: TMenuItem;
     munsavecopy: TMenuItem;
     pmscompact: TMenuItem;
     MenuItemToolCrc32: TMenuItem;
     MenuItemToolMD5: TMenuItem;
     MenuItemToolSHA1: TMenuItem;
     MenuItemToolSHA256: TMenuItem;
     MenuItemToolBlake2s: TMenuItem;
     MenuItemToolsg: TMenuItem;
     MenuItemToolsv: TMenuItem;
     ComboBoxsec: TComboBox;
     Separator45: TMenuItem;
     MenuItemTooltextp: TMenuItem;
     MenuItemToolAnalyze: TMenuItem;
     Separator44: TMenuItem;
     Separator43: TMenuItem;
     Separator42: TMenuItem;
     Separator41: TMenuItem;
     Separator40: TMenuItem;
     Separator39: TMenuItem;
     po_cksum: TMenuItem;
     po_md5sum: TMenuItem;
     po_sha1sum: TMenuItem;
     po_sha256sum: TMenuItem;
     po_b2sum: TMenuItem;
     po_s256g: TMenuItem;
     po_s256v: TMenuItem;
     po_textp: TMenuItem;
     pmmoretext: TMenuItem;
     pmsizelargepppp: TMenuItem;
     pmmoresha1save: TMenuItem;
     pmmoremd5save: TMenuItem;
     pmmorecksave: TMenuItem;
     pmmoreblake2bsave: TMenuItem;
     pmmoreshag: TMenuItem;
     pmmoreshav: TMenuItem;
     pmmoreshasave: TMenuItem;
     pmsizelargeppp: TMenuItem;
     mexploretrash: TMenuItem;
     Separator37: TMenuItem;
     pow10defender: TMenuItem;
     pow10storage: TMenuItem;
     pow10dapps: TMenuItem;
     pow10apps: TMenuItem;
     pow10settings: TMenuItem;
     pow10: TMenuItem;
     mfilebrowser: TMenuItem;
     pmsizelargep: TMenuItem;
     pmsizelargepp: TMenuItem;
     pmsizesmall: TMenuItem;
     pmsizemedium: TMenuItem;
     pmsizelarge: TMenuItem;
     Separator36: TMenuItem;
     mz50: TMenuItem;
     mz67: TMenuItem;
     mz80: TMenuItem;
     mz87: TMenuItem;
     mz100: TMenuItem;
     mz115: TMenuItem;
     mz125: TMenuItem;
     mz150: TMenuItem;
     mz200: TMenuItem;
     mzoom: TMenuItem;
     Separator35: TMenuItem;
     po_gnometm: TMenuItem;
     po_kdetm: TMenuItem;
     Separator34: TMenuItem;
     pmextheresmart: TMenuItem;
     pmextherenew: TMenuItem;
     pmextherehere: TMenuItem;
     pmintddhere: TMenuItem;
     pmintddsmart: TMenuItem;
     pmintddnew: TMenuItem;
     mroot: TMenuItem;
     pmscomment: TMenuItem;
     pmsinfo: TMenuItem;
     pmintdd: TPopupMenu;
     pmexthere: TPopupMenu;
     Separator33: TMenuItem;
     pmflatarchives: TMenuItem;
     Separator32: TMenuItem;
     mFlatArchives: TMenuItem;
     mexttohistory: TMenuItem;
     mexttoc8: TMenuItem;
     mexttoc7: TMenuItem;
     mexttoc6: TMenuItem;
     mexttoc5: TMenuItem;
     mexttoc4: TMenuItem;
     mexttoc3: TMenuItem;
     mexttoc2: TMenuItem;
     mexttoc1: TMenuItem;
     mexttoc0: TMenuItem;
     Separator29: TMenuItem;
     mexttos8: TMenuItem;
     mexttos7: TMenuItem;
     mexttos6: TMenuItem;
     mexttos5: TMenuItem;
     mexttos4: TMenuItem;
     mexttos3: TMenuItem;
     mexttos2: TMenuItem;
     mexttos1: TMenuItem;
     mexttos0: TMenuItem;
     Separator28: TMenuItem;
     mexttoh2: TMenuItem;
     mexttoh3: TMenuItem;
     mexttoh4: TMenuItem;
     mexttoh5: TMenuItem;
     mexttoh6: TMenuItem;
     mexttoh7: TMenuItem;
     mexttoh8: TMenuItem;
     mexttoh1: TMenuItem;
     mexttob2: TMenuItem;
     mexttob3: TMenuItem;
     mexttob4: TMenuItem;
     mexttob5: TMenuItem;
     mexttob6: TMenuItem;
     mexttob7: TMenuItem;
     mexttob8: TMenuItem;
     mextto: TMenuItem;
     mexttob1: TMenuItem;
     Separator38: TMenuItem;
     Separator46: TMenuItem;
     SeparatorDE: TMenuItem;
     msmartsort: TMenuItem;
     pmsoparch: TMenuItem;
     pmsoppath: TMenuItem;
     mshowsidebar: TMenuItem;
     msidebar: TMenuItem;
     Separator27: TMenuItem;
     mloadprofile: TMenuItem;
     msaveprofile: TMenuItem;
     OpenDialogProfile: TOpenDialog;
     Panelside: TPanel;
     Separator26: TMenuItem;
     pmtabsreopen: TMenuItem;
     ShapeOptions1: TShape;
     Shapecsb: TShape;
     Shapelinkadd2: TShape;
     Shapelinkadd3: TShape;
     Shapelinkadd4: TShape;
     Shapelinkapps1: TShape;
     Shapelinkapps2: TShape;
     Shapelinkextract1: TShape;
     Shapelinkextract2: TShape;
     Shapelinkextract3: TShape;
     Shapelinkextract4: TShape;
     Shapelinkadd1: TShape;
     ShapeOptions2: TShape;
     ShapeOptions3: TShape;
     ShapeOptions4: TShape;
     ShapeOptions5: TShape;
     ShapeOptions6: TShape;
     ShapeOptions7: TShape;
     ShapeOptions8: TShape;
     smBookmarksa1: TMenuItem;
     smfsa1: TMenuItem;
     smHistorya1: TMenuItem;
     StringGridTabsLast: TStringGrid;
     Timerrename1: TTimer;
     zencmore: TMenuItem;
     zenc1254: TMenuItem;
     zenc1255: TMenuItem;
     zenc1256: TMenuItem;
     zenc1257: TMenuItem;
     zenc1258: TMenuItem;
     zenc20866: TMenuItem;
     zenc21866: TMenuItem;
     zenclocalutf8: TMenuItem;
     zencutf8: TMenuItem;
     zenclocal: TMenuItem;
     zenc1252: TMenuItem;
     zenc65001: TMenuItem;
     zenc437: TMenuItem;
     zenc850: TMenuItem;
     zenc852: TMenuItem;
     zenc858: TMenuItem;
     zenc866: TMenuItem;
     zenc874: TMenuItem;
     zenc932: TMenuItem;
     zenc936: TMenuItem;
     zenc949: TMenuItem;
     zenc950: TMenuItem;
     zenc1250: TMenuItem;
     zenc1251: TMenuItem;
     zenc1253: TMenuItem;
     mzencmore: TMenuItem;
     mzenc1254: TMenuItem;
     mzenc1255: TMenuItem;
     mzenc1256: TMenuItem;
     mzenc1257: TMenuItem;
     mzenc1258: TMenuItem;
     mzenc20866: TMenuItem;
     mzenc21866: TMenuItem;
     mzenclocalutf8: TMenuItem;
     mzencutf8: TMenuItem;
     mzenclocal: TMenuItem;
     mzenc1252: TMenuItem;
     mzenc65001: TMenuItem;
     mzenc437: TMenuItem;
     mzenc850: TMenuItem;
     mzenc852: TMenuItem;
     mzenc858: TMenuItem;
     mzenc866: TMenuItem;
     mzenc874: TMenuItem;
     mzenc932: TMenuItem;
     mzenc936: TMenuItem;
     mzenc949: TMenuItem;
     mzenc950: TMenuItem;
     mzenc1250: TMenuItem;
     mzenc1251: TMenuItem;
     mzenc1253: TMenuItem;
     azencmore: TMenuItem;
     azenc1254: TMenuItem;
     azenc1255: TMenuItem;
     azenc1256: TMenuItem;
     azenc1257: TMenuItem;
     azenc1258: TMenuItem;
     azenc20866: TMenuItem;
     azenc21866: TMenuItem;
     azenclocalutf8: TMenuItem;
     azencutf8: TMenuItem;
     azenclocal: TMenuItem;
     azenc1252: TMenuItem;
     azenc65001: TMenuItem;
     azenc437: TMenuItem;
     azenc850: TMenuItem;
     azenc852: TMenuItem;
     azenc858: TMenuItem;
     azenc866: TMenuItem;
     azenc874: TMenuItem;
     azenc932: TMenuItem;
     azenc936: TMenuItem;
     azenc949: TMenuItem;
     azenc950: TMenuItem;
     azenc1250: TMenuItem;
     azenc1251: TMenuItem;
     azenc1253: TMenuItem;
     pmtabsave: TMenuItem;
     pmadvf: TMenuItem;
     po_commentzip: TMenuItem;
     pmmorecommentzip: TMenuItem;
     po_browserccomment: TMenuItem;
     pmccomment: TMenuItem;
     mpeachangelog: TMenuItem;
     mpeatos: TMenuItem;
     pmmoreextract: TMenuItem;
     pmmoreconvert: TMenuItem;
     pmmoreadd: TMenuItem;
     pmtoolcompact: TMenuItem;
     mtranslationsfaq: TMenuItem;
     mswaptab: TMenuItem;
     PanelAdArchive4: TPanel;
     pmbcnw: TMenuItem;
     pmtabscloseall: TMenuItem;
     pmtabsnewwindow: TMenuItem;
     pmclip: TMenuItem;
     po_clip: TMenuItem;
     po_dedup: TMenuItem;
     po_windowopen: TMenuItem;
     MenuItemShowColMenu: TMenuItem;
     Panela: TPanel;
     Panele: TPanel;
     PanelExtZPAQ: TPanel;
     pmshowstylemenu: TMenuItem;
     PanelSPaddress: TPanel;
     pmmoretest: TMenuItem;
     MenuItemToggleNav: TMenuItem;
     pmfilebrowser: TMenuItem;
     Separator24: TMenuItem;
     Separator17: TMenuItem;
     pnbce1: TMenuItem;
     pnbce2: TMenuItem;
     pnbce3: TMenuItem;
     pnbce4: TMenuItem;
     pnbce5: TMenuItem;
     pnbce6: TMenuItem;
     pnbce7: TMenuItem;
     pnbce8: TMenuItem;
     pnhe1: TMenuItem;
     pnhe2: TMenuItem;
     pnhe3: TMenuItem;
     pnhe4: TMenuItem;
     pnhe5: TMenuItem;
     pnhe6: TMenuItem;
     pnhe7: TMenuItem;
     pnhe8: TMenuItem;
     pnbce0: TMenuItem;
     Separator23: TMenuItem;
     pnbcf1: TMenuItem;
     pnbcf2: TMenuItem;
     pnbcf3: TMenuItem;
     pnbcf4: TMenuItem;
     pnbcf5: TMenuItem;
     pnbcf6: TMenuItem;
     pnbcf7: TMenuItem;
     pnbcf8: TMenuItem;
     pnbcf0: TMenuItem;
     Separator22: TMenuItem;
     Separator21: TMenuItem;
     pnhe0: TMenuItem;
     pnhf1: TMenuItem;
     pnhf2: TMenuItem;
     pnhf3: TMenuItem;
     pnhf4: TMenuItem;
     pnhf5: TMenuItem;
     pnhf6: TMenuItem;
     pnhf7: TMenuItem;
     pnhf8: TMenuItem;
     pnhf0: TMenuItem;
     Separator20: TMenuItem;
     pmmain: TPopupMenu;
     Separator19: TMenuItem;
     Separator18: TMenuItem;
     po_addsep: TMenuItem;
     Separator25: TMenuItem;
     ShapeAddress1: TShape;
     ShapeAddress10: TShape;
     ShapeAddress11: TShape;
     ShapeAddress0: TShape;
     ShapeAddress2: TShape;
     ShapeAddress3: TShape;
     ShapeAddress4: TShape;
     ShapeAddress5: TShape;
     ShapeAddress6: TShape;
     ShapeAddress7: TShape;
     ShapeAddress8: TShape;
     ShapeAddress9: TShape;
     ShapeThemes: TShape;
     PanelProgress: TPanel;
     ShapeThemes1: TShape;
     ShapeThemes2: TShape;
     StringGridTB: TStringGrid;
     tabaddress: TMenuItem;
     pmquickdownloads: TMenuItem;
     Separator16: TMenuItem;
     Separator12: TMenuItem;
     mhrenamef2: TMenuItem;
     mhiddennav: TMenuItem;
     Separator15: TMenuItem;
     pmsstatus: TMenuItem;
     pmsno: TMenuItem;
     menupw: TMenuItem;
     MenuItemInfomenu: TMenuItem;
     MenuItemInfo: TMenuItem;
     MenuItemToggleStatus: TMenuItem;
     Separator14: TMenuItem;
     Separator13: TMenuItem;
     pmtoollarge: TMenuItem;
     pmtoolmedium: TMenuItem;
     MenuItemTB: TMenuItem;
     PanelTitleAppsTabAlign: TPanel;
     Separator10: TMenuItem;
     mshowstatusbar: TMenuItem;
     mshownavbar: TMenuItem;
     mshowtoolbar: TMenuItem;
     pmstatusnone: TMenuItem;
     pmtoolnone: TMenuItem;
     msettings: TMenuItem;
     pmsbookmarks: TMenuItem;
     pmshistory: TMenuItem;
     pmssession: TMenuItem;
     pmsclipboard: TMenuItem;
     pmshowmenu: TMenuItem;
     pmstatus: TPopupMenu;
     Separator11: TMenuItem;
     pmtoolsmall: TMenuItem;
     PanelTitleExtractTabAlign: TPanel;
     PanelTitleAddTabAlign: TPanel;
     Separator9: TMenuItem;
     po_showquicknavmenu: TMenuItem;
     Separator8: TMenuItem;
     pmshowmainmenu: TMenuItem;
     Separator7: TMenuItem;
     mverifyself: TMenuItem;
     pmshowsearch: TMenuItem;
     PopupLightPresets: TPopupMenu;
     Separator6: TMenuItem;
     pmhnewtab: TMenuItem;
     MenuItemOpen_saveascsv: TMenuItem;
     pmsaveascsv: TMenuItem;
     MenuItemContextRefresh: TMenuItem;
     Separator5: TMenuItem;
     BtnStyle: TSpeedButton;
     Separator4: TMenuItem;
     mprofileimmediate: TMenuItem;
     pmnavbc0: TMenuItem;
     pmnavbc1: TMenuItem;
     pmnavbc2: TMenuItem;
     pmnavbc3: TMenuItem;
     pmnavbc4: TMenuItem;
     pmnavbc5: TMenuItem;
     pmnavbc6: TMenuItem;
     pmnavbc7: TMenuItem;
     pmnavbc8: TMenuItem;
     pmr_files: TMenuItem;
     pmnavhistory: TPopupMenu;
     pmnavbreadcrumb: TPopupMenu;
     Separator2: TMenuItem;
     pmr_ren: TMenuItem;
     Separator3: TMenuItem;
     powRun: TMenuItem;
     pmapp8: TMenuItem;
     MenuItem102: TMenuItem;
     pmapp9: TMenuItem;
     MenuItem111: TMenuItem;
     MenuItem114: TMenuItem;
     MenuItem115: TMenuItem;
     MenuItem116: TMenuItem;
     MenuItem117: TMenuItem;
     MenuItem119: TMenuItem;
     MenuItem120: TMenuItem;
     MenuItem121: TMenuItem;
     marcopt: TMenuItem;
     mdefextset: TMenuItem;
     MenuItem124: TMenuItem;
     MenuItem128: TMenuItem;
     MenuItem129: TMenuItem;
     mcmethod: TMenuItem;
     mcaccessed: TMenuItem;
     mccreated: TMenuItem;
     MenuItem130: TMenuItem;
     mbrowsercaccessed: TMenuItem;
     mbrowsercmethod: TMenuItem;
     mbrowserccreated: TMenuItem;
     mautoadjust: TMenuItem;
     mBenchpea: TMenuItem;
     pmapp10: TMenuItem;
     pmapp11: TMenuItem;
     pmapp12: TMenuItem;
     pmapp13: TMenuItem;
     pmapp14: TMenuItem;
     pmapp15: TMenuItem;
     pmapp16: TMenuItem;
     pmappadv1: TMenuItem;
     pmappadv2: TMenuItem;
     pmappadv3: TMenuItem;
     pmappadv4: TMenuItem;
     pmappadv5: TMenuItem;
     pmappadv6: TMenuItem;
     pmappadv7: TMenuItem;
     pmappadv8: TMenuItem;
     pmapp1: TMenuItem;
     pmapp2: TMenuItem;
     pmapp3: TMenuItem;
     pmapp4: TMenuItem;
     pmapp5: TMenuItem;
     pmapp6: TMenuItem;
     pmapp7: TMenuItem;
     pmapp: TMenuItem;
     pmapprun: TMenuItem;
     owrun: TMenuItem;
     msamplescripts: TMenuItem;
     mloadlayout: TMenuItem;
     mfilterbrowser: TMenuItem;
     msavelayout: TMenuItem;
     Separator1: TMenuItem;
     menuitemopendocuments: TMenuItem;
     menuitemopendownloads: TMenuItem;
     po_maclaunch: TMenuItem;
     po_macdisk: TMenuItem;
     po_macact: TMenuItem;
     po_macsys: TMenuItem;
     po_browsercaccessed: TMenuItem;
     po_browsercmethod: TMenuItem;
     po_browserccreated: TMenuItem;
     MenuItemColMint: TMenuItem;
     MenuItemColUbuntu: TMenuItem;
     MenuItemColBeos: TMenuItem;
     MenuItemColWindows: TMenuItem;
     PopupColPresets: TPopupMenu;
     po_gnomesw: TMenuItem;
     po_cinnamonsett: TMenuItem;
     po_synaptic: TMenuItem;
     po_xfcesm: TMenuItem;
     po_kdesyssett: TMenuItem;
     MenuItem131: TMenuItem;
     po_gnomecc: TMenuItem;
     po_lintop: TMenuItem;
     po_linpsef: TMenuItem;
     po_linnetstat: TMenuItem;
     po_linipaddress: TMenuItem;
     po_linid: TMenuItem;
     po_linhistory: TMenuItem;
     po_lindush: TMenuItem;
     po_lindfh: TMenuItem;
     MenuItem8: TMenuItem;
     po_openunitasarchivelin: TMenuItem;
     po_dispenvstrlin: TMenuItem;
     po_linsystemtools: TMenuItem;
     MenuItemOpen_run: TMenuItem;
     po_openfiles: TMenuItem;
     pmcmethod: TMenuItem;
     pmcaccessed: TMenuItem;
     pmccreated: TMenuItem;
     po_whoami: TMenuItem;
     po_ver: TMenuItem;
     po_systeminfo: TMenuItem;
     po_ftp: TMenuItem;
     po_qwinsta: TMenuItem;
     po_quser: TMenuItem;
     po_hostname: TMenuItem;
     po_ipconfig: TMenuItem;
     po_getmac: TMenuItem;
     po_sysinfo: TMenuItem;
     pmqeselected: TMenuItem;
     pmqedisplayed: TMenuItem;
     pmqeall: TMenuItem;
     mtab: TMenuItem;
     pmtestcontext: TPopupMenu;
     pmtestcontextall: TMenuItem;
     pmtestcontextdisplayed: TMenuItem;
     pmtestcontextselected: TMenuItem;
     pmthemes: TMenuItem;
     MenuItem83: TMenuItem;
     pmrow: TMenuItem;
     MenuItem127: TMenuItem;
     pmtab: TMenuItem;
     MenuItem126: TMenuItem;
     pmsnav: TMenuItem;
     pmstree: TMenuItem;
     pmsnone: TMenuItem;
     pmtool1: TMenuItem;
     pmtool2: TMenuItem;
     pmtool3: TMenuItem;
     pcustmakecab: TMenuItem;
     pcustmakecabsep: TMenuItem;
     mtenc: TMenuItem;
     MenuItem123: TMenuItem;
     pmtextenc: TMenuItem;
     MenuItemTextEncoding: TMenuItem;
     pmr_cut: TMenuItem;
     pmr_appendts: TMenuItem;
     pmr_appenddirname: TMenuItem;
     pmr_prependdirname: TMenuItem;
     pmr_123: TMenuItem;
     pmr_ascii: TMenuItem;
     po_rename_ascii: TMenuItem;
     po_rename_cutlen: TMenuItem;
     mextopt: TMenuItem;
     PanelLCA1: TShape;
     PanelLCA2: TShape;
     PanelLCA3: TShape;
     PanelLCA4: TShape;
     PanelLCA5: TShape;
     PanelLCA6: TShape;
     PanelLCA7: TShape;
     PanelLCA8: TShape;
     PanelLCAa1: TShape;
     PanelLCAa2: TShape;
     PanelLCAa3: TShape;
     PanelLCAa4: TShape;
     PanelTabBar: TPanel;
     po_rr: TMenuItem;
     po_recover: TMenuItem;
     pmmorerecover: TMenuItem;
     pmmorerr: TMenuItem;
     mprofilerar: TMenuItem;
     PanelRar: TPanel;
     pob_blake2b: TMenuItem;
     pob_blake2s: TMenuItem;
     mprofile7zfast: TMenuItem;
     mprofile7zfastest: TMenuItem;
     PanelBrotli: TPanel;
     PanelZstd: TPanel;
     po_smart: TMenuItem;
     mprofiletarxz: TMenuItem;
     mprofilesave: TMenuItem;
     mprofileload: TMenuItem;
     mprofilezstd: TMenuItem;
     mprofiletargz: TMenuItem;
     mprofileextremezpaq: TMenuItem;
     mloadcompsettings: TMenuItem;
     msavecompsettings: TMenuItem;
     mForceSynceditsClear: TMenuItem;
     mForceClear: TMenuItem;
     MenuItemExtAllHereSmart: TMenuItem;
     MenuItemExtAllHereNew: TMenuItem;
     pmqeheresmart: TMenuItem;
     pmqeherenew: TMenuItem;
     po_rename_filesonly: TMenuItem;
     mprofiletarzst: TMenuItem;
     po_rename_123: TMenuItem;
     pmpanalyzefolders: TMenuItem;
     po_analyzefolders: TMenuItem;
     mForceSyncedits: TMenuItem;
     Panel10: TPanel;
     pms2a_ext: TMenuItem;
     MenuItem118: TMenuItem;
     po_rename_separator: TMenuItem;
     po_more: TMenuItem;
     po_pdup: TMenuItem;
     PageOpt2: TScrollBox;
     PanelLine1: TPanel;
     PanelLine2: TPanel;
     PanelLine4: TPanel;
     PanelLine3: TPanel;
     PanelLine5: TPanel;
     PanelLine6: TPanel;
     PanelLine7: TPanel;
     PanelLine8: TPanel;
     pmhcopypath: TMenuItem;
     pmsaveastxt: TMenuItem;
     MenuItem71: TMenuItem;
     pmcname: TMenuItem;
     pmctype: TMenuItem;
     pmcsize: TMenuItem;
     pmcpacked: TMenuItem;
     pmcdate: TMenuItem;
     pmcatt: TMenuItem;
     pmccrc: TMenuItem;
     pmcfree: TMenuItem;
     pmcfs: TMenuItem;
     MenuItem145: TMenuItem;
     pmstyle1: TMenuItem;
     pmstyle3: TMenuItem;
     pmstyle5: TMenuItem;
     pmtabsm: TMenuItem;
     pmhtabs: TMenuItem;
     pmtabsbook: TMenuItem;
     pmstyle: TPopupMenu;
     PopupHeader: TPopupMenu;
     po_tabsopen: TMenuItem;
     pmtabsbookmarkorg: TMenuItem;
     pmtabsbookmarkadd: TMenuItem;
     mtabs: TMenuItem;
     pmtabscloseright: TMenuItem;
     pmtabscollapse: TMenuItem;
     pmtabsexpand: TMenuItem;
     MenuItem64: TMenuItem;
     MenuItem72: TMenuItem;
     pmtabscloseother: TMenuItem;
     ProgressBar2: TShape;
     cbExtEvForWhen: TComboBox;
     cbtree: TComboBox;
     cbHash: TComboBox;
     cbBinaries: TComboBox;
     cbBinariesStop: TComboBox;
     CheckBoxExtActionAdv: TComboBox;
     ShapeTitleAddb1: TShape;
     ShapeTitleAddb2: TShape;
     ShapeTitleAddb3: TShape;
     ShapeTitleAddb4: TShape;
     ShapeTitleAppsb1: TShape;
     ShapeTitleAppsb2: TShape;
     ShapeTitleExtractb1: TShape;
     ShapeTitleExtractb2: TShape;
     ShapeTitleExtractb3: TShape;
     ShapeTitleExtractb4: TShape;
     SpinEditOpacity: TSpinEdit;
     seRARrr: TSpinEdit;
     splitsearch: TSplitter;
     StringGridAddressAllFoldersContent: TStringGrid;
     StringGridArchive: TStringGrid;
     StringGridTabs: TStringGrid;
     Subtitleschopt: TLabel;
     SubtitleschoptExt: TLabel;
     ImageAdArchive3: TImage;
     ImageAddress0: TImage;
     ImageAddress1: TImage;
     ImageAddress2: TImage;
     ImageAddress3: TImage;
     ImageAddress4: TImage;
     ImageAddress5: TImage;
     ImageAddress6: TImage;
     ImageAddress7: TImage;
     ImageAdArchive0: TImage;
     ImageAdArchive1: TImage;
     ImageAdArchive2: TImage;
     ButtonOptReset: TBitBtn;
     ImageInfoSchedAdd: TImage;
     ImageInfoSchedExt: TImage;
     ImageListResetSearch: TImage;
     Imageopenadvf: TImage;
     ImageExtractAdvf: TImage;
     ImageAddAdvf: TImage;
     BtnPasswordArchive: TSpeedButton;
     BtnPasswordExtract: TSpeedButton;
     ImageSplit: TImage;
     LabelOutExtract: TLabel;
     LabelARCEnc: TLabel;
     Label7zEnc: TLabel;
     Label7zPath: TLabel;
     Labeladvext7z: TLabel;
     Labeladvextfreearc: TLabel;
     LabelArcSub3: TLabel;
     Labelogperf: TLabel;
     LabelWD: TLabel;
     Label7zFun: TLabel;
     LabelPEALevel: TLabel;
     LabelARCLevel: TLabel;
     LabelARCFun: TLabel;
     Label7zThreads: TLabel;
     Label7zLevel: TLabel;
     Label7zMethod: TLabel;
     Label7zDictionary: TLabel;
     Label7zWord: TLabel;
     LabelUPXLevel: TLabel;
     LabelPAQLevel: TLabel;
     Label7zPasses: TLabel;
     Label7zsolidblock: TLabel;
     LabelAbout: TLabel;
     Subtitle7zCompOpt: TLabel;
     Label7zOtherParams: TLabel;
     LabelARCParams: TLabel;
     LabelCustParams: TLabel;
     LabelCustSyntax: TLabel;
     LabelCustExtension: TLabel;
     LabelCustomParamExt: TLabel;
     LabelCustomSyntaxExt: TLabel;
     LabelCustomBinExt: TLabel;
     LabelCustExe: TLabel;
     LabelARCsolidblock: TLabel;
     LabelArcSub1: TLabel;
     LabelArcSub2: TLabel;
     Labelbcmblock: TLabel;
     LabelDefaultFormat: TLabel;
     Labeloamext: TLabel;
     Labelogreset: TLabel;
     LabelResetOpenWith: TLabel;
     Labelcbadvanced: TLabel;
     Labelcbbasic: TLabel;
     Labelcbsample: TLabel;
     Labelcbsampleadvanced: TLabel;
     LabelClipInfo: TLabel;
     LabelClickAdArchive1: TLabel;
     LabelClickAdArchive2: TLabel;
     LabelClickAdArchive3: TLabel;
     LabelClickAdArchive4: TLabel;
     LabelAppColor: TLabel;
     LabelConfigurePeaZip: TLabel;
     LabelCustom: TLabel;
     LabelDefaultColor1: TLabel;
     LabelEvery: TLabel;
     LabelEveryExt: TLabel;
     LabelEveryUnit: TLabel;
     LabelEveryUnitExt: TLabel;
     LabelLang: TLabel;
     Labeloptsub1: TLabel;
     LabelSecureDelete: TLabel;
     LabelHashFormat: TLabel;
     LabelBrowserHash: TLabel;
     LabelPanelHintAdd: TLabel;
     LabelPanelHintExtract: TLabel;
     LabelPEAStream: TLabel;
     LabelPEAObj: TLabel;
     LabelPEAVol: TLabel;
     LabelResetApp1: TLabel;
     LabelResetBookmarks: TLabel;
     LabelResetHistory: TLabel;
     LabelResetPM: TLabel;
     LabelResetPtmp: TLabel;
     LabelSplit: TLabel;
     LabelStatusExtract: TLabel;
     LabelOutAdd: TLabel;
     LabelTheme: TLabel;
     LabelTheme1: TLabel;
     LabelTheme2: TLabel;
     LabelTheme3: TLabel;
     LabelThemeLoaded: TLabel;
     LabelTitleApps1: TLabel;
     LabelTitleApps2: TLabel;
     LabelTitleExtract2: TLabel;
     LabelTitleExtract3: TLabel;
     LabelTitleExtract4: TLabel;
     LabelTitleExtract1: TLabel;
     ListAddress: TListView;
     Lmanageschedule1: TLabel;
     Lmanageschedule2: TLabel;
     LmanagescheduleExt1: TLabel;
     LmanagescheduleExt2: TLabel;
     lsa1: TLabel;
     lsa2: TLabel;
     lsa3: TLabel;
     lse1: TLabel;
     lse2: TLabel;
     lse3: TLabel;
     lsaday: TLabel;
     lsadayExt: TLabel;
     lsp: TLabel;
     lspext: TLabel;
     lsspcext: TLabel;
     lsspc1: TLabel;
     MemoAbout: TMemo;
     MenuItem104: TMenuItem;
     mCharCase: TMenuItem;
     mChar: TMenuItem;
     MenuItem105: TMenuItem;
     mDateYear: TMenuItem;
     mDateMonth: TMenuItem;
     mDateDay: TMenuItem;
     mDateHour: TMenuItem;
     mDateWeek: TMenuItem;
     MenuItem109: TMenuItem;
     maddexisting: TMenuItem;
     maddconvert: TMenuItem;
     MenuItem110: TMenuItem;
     abc4: TMenuItem;
     abc3: TMenuItem;
     abc2: TMenuItem;
     abc1: TMenuItem;
     abc8: TMenuItem;
     abc7: TMenuItem;
     abc6: TMenuItem;
     abc5: TMenuItem;
     abc0: TMenuItem;
     pmtabsnew: TMenuItem;
     pmtabsclose: TMenuItem;
     pmtabs: TPopupMenu;
     po_rename_appenddir: TMenuItem;
     po_rename_prependdir: TMenuItem;
     org_autoadjust: TMenuItem;
     MenuItemOpen_saveastxt: TMenuItem;
     PanelActOptions: TPanel;
     PanelSpacerAdd: TPanel;
     ComboBoxActionArc: TComboBox;
     panelspacerextract: TPanel;
     pob_crc24: TMenuItem;
     pob_crc64: TMenuItem;
     pob_edonkey: TMenuItem;
     pob_md4: TMenuItem;
     pob_md5: TMenuItem;
     pob_ripemd: TMenuItem;
     pob_sha1: TMenuItem;
     pob_sha256: TMenuItem;
     pob_sha3256: TMenuItem;
     pob_sha512: TMenuItem;
     pob_sha3512: TMenuItem;
     pob_whirlpool: TMenuItem;
     pob_crc32: TMenuItem;
     pob_adler: TMenuItem;
     pob_crc16: TMenuItem;
     OptionsAdd: TScrollBox;
     OptionsAddAdv: TScrollBox;
     OptionsARC: TPanel;
     OptionsExtract: TScrollBox;
     OptionsExtractAdv: TScrollBox;
     PageOpt1: TScrollBox;
     PageOpt3: TScrollBox;
     PageOpt4: TScrollBox;
     PageOpt5: TScrollBox;
     PageOpt6: TScrollBox;
     PageOpt7: TScrollBox;
     PageOpt8: TScrollBox;
     Panel7z: TPanel;
     PanelApps1: TPanel;
     PanelApps2: TPanel;
     PanelARC: TPanel;
     PanelArchiveTypeOpt: TPanel;
     PanelCustom: TPanel;
     PanelHDW: TPanel;
     PanelHDWExt: TPanel;
     PanelHintAdd: TPanel;
     PanelHintExtract: TPanel;
     PanelMonthly: TPanel;
     PanelMonthlyExt: TPanel;
     PanelPAQ: TPanel;
     PanelPEA: TPanel;
     PanelQuad: TPanel;
     PanelScheduleAdd: TPanel;
     PanelScheduleExt: TPanel;
     PanelSplitFile: TPanel;
     PanelTitleApps: TPanel;
     PanelUPX: TPanel;
     PanelWeekly: TPanel;
     PanelWeeklyExt: TPanel;
     PEA: TGroupBox;
     pmbce: TMenuItem;
     pmbcexpand: TMenuItem;
     pmamr2: TMenuItem;
     pmamr3: TMenuItem;
     pmamr4: TMenuItem;
     pmamr5: TMenuItem;
     pmamr6: TMenuItem;
     pmamr7: TMenuItem;
     pmamr8: TMenuItem;
     pmamr1: TMenuItem;
     pmquickdesk: TMenuItem;
     pmquickhome: TMenuItem;
     pmquickop: TMenuItem;
     pmquickoa: TMenuItem;
     pmquicksd: TMenuItem;
     MenuItem48: TMenuItem;
     MenuItem50: TMenuItem;
     MenuItem61: TMenuItem;
     pmbcspacer: TMenuItem;
     pmtypeswap: TMenuItem;
     pmttitle: TMenuItem;
     PanelListResetSearch: TPanel;
     pmflat: TMenuItem;
     po_analyze: TMenuItem;
     pmmorehex: TMenuItem;
     pmqnointdir: TMenuItem;
     pmmoreanalysis: TMenuItem;
     po_rename_timestamp: TMenuItem;
     PanelSearch: TPanel;
     mextract: TMenuItem;
     MenuItem47: TMenuItem;
     OpenDialogApps1: TOpenDialog;
     PanelAdArchive0: TPanel;
     PanelAdArchive3: TPanel;
     PanelAdArchive1: TPanel;
     PanelAdArchive2: TPanel;
     pmCustEditAdd: TMenuItem;
     pmCustEditAdd1: TMenuItem;
     pmCustEditApps: TPopupMenu;
     pmCustEditApps1: TPopupMenu;
     pmCustEditDesc: TMenuItem;
     pmCustEditDesc1: TMenuItem;
     pmCustEditEdit: TMenuItem;
     pmCustEditEdit1: TMenuItem;
     pmCustEditEdit1after: TMenuItem;
     pmCustEditRemove: TMenuItem;
     pmCustEditRemove1: TMenuItem;
     cbDefaultFormat: TComboBox;
     cbHashFormat: TComboBox;
     cbBrowserHash: TComboBox;
     ComboBoxActionExtract: TComboBox;
     RadioGroup7zSFX: TRadioGroup;
     RadioGroupBrowser: TComboBox;
     RadioGroupPaq: TRadioGroup;
     RadioGroupQuad: TRadioGroup;
     cbTimeStamp: TComboBox;
     schedaddname: TEdit;
     SchedAddnameExt: TEdit;
     schedaddschedule: TComboBox;
     SchedAddscheduleExt: TComboBox;
     ScheduleAdd: TScrollBox;
     scheduleend: TCheckBox;
     scheduleendext: TCheckBox;
     ScheduleExtract: TScrollBox;
     schedulehh: TSpinEdit;
     schedulehhext: TSpinEdit;
     schedulemm: TSpinEdit;
     schedulemmext: TSpinEdit;
     scheduleNN: TSpinEdit;
     scheduleNNext: TSpinEdit;
     schedulepassword: TLabel;
     schedulepasswordext: TLabel;
     schedulestart: TCheckBox;
     schedulestartext: TCheckBox;
     scheduleuser: TCheckBox;
     scheduleuserext: TCheckBox;
     PanelAddress: TPanel;
     SpinEditSplit: TSpinEdit;
     SplitterOptions: TSplitter;
     StringGridAdd: TStringGrid;
     StringGridExtract: TStringGrid;
     StringGridAddressAllFolders: TStringGrid;
     StringGridAddressOmittedFolders: TStringGrid;
     StringGridCustEdit: TStringGrid;
     StringGridCustEditAdv: TStringGrid;
     StringGridList: TStringGrid;
     StringGridAddress: TStringGrid;
     Subtitle7zOpt: TLabel;
     Subtitle7zEncOpt: TLabel;
     TabBar: THeaderControl;
     tbcontrast: TTrackBar;
     themesave_label: TLabel;
     ThemeReset: TImage;
     TimerBusy: TTimer;
     Timerrename: TTimer;
     tmupdate: TMenuItem;
     tmconvert: TMenuItem;
     tmextract: TMenuItem;
     munpeaextract: TMenuItem;
     mlayouts: TMenuItem;
     OpenDialogLayout: TOpenDialog;
     pmbcd17: TMenuItem;
     pmbcd18: TMenuItem;
     pmbcd19: TMenuItem;
     PanelAddress2: TPanel;
     PanelAddress3: TPanel;
     PanelAddress4: TPanel;
     PanelAddress5: TPanel;
     PanelAddress6: TPanel;
     PanelAddress7: TPanel;
     PanelAddress1: TPanel;
     PanelAddress0: TPanel;
     pmbcd0: TMenuItem;
     pmbcd16: TMenuItem;
     pmbcd5: TMenuItem;
     pmbcd6: TMenuItem;
     pmbcd7: TMenuItem;
     pmbcd8: TMenuItem;
     pmbcd9: TMenuItem;
     pmbcd10: TMenuItem;
     pmbcd11: TMenuItem;
     pmbcd12: TMenuItem;
     pmbcd13: TMenuItem;
     pmbcd14: TMenuItem;
     pmbcd15: TMenuItem;
     pmbcd1: TMenuItem;
     pmbcd2: TMenuItem;
     pmbcd3: TMenuItem;
     pmbcd4: TMenuItem;
     pmbcdir: TPopupMenu;
     po_renmenu: TMenuItem;
     pmbreadfs: TMenuItem;
     pmbreadfun: TMenuItem;
     mselectadv: TMenuItem;
     pmselectadv: TMenuItem;
     po_selectadv: TMenuItem;
     pmrselect: TMenuItem;
     pmcpypath: TMenuItem;
     pmCopyPath: TMenuItem;
     po_copypath: TMenuItem;
     msamemonth: TMenuItem;
     msameweek: TMenuItem;
     msameday: TMenuItem;
     msamehour: TMenuItem;
     MenuItem113: TMenuItem;
     msameyear: TMenuItem;
     mpackedsimilar50: TMenuItem;
     MenuItem107: TMenuItem;
     msizesimilar50: TMenuItem;
     MenuItem86: TMenuItem;
     mpackedsimilar: TMenuItem;
     msizesimilar: TMenuItem;
     mpacked100m: TMenuItem;
     mpacked10m: TMenuItem;
     mpacked100k: TMenuItem;
     mpackedempty: TMenuItem;
     MenuItem69: TMenuItem;
     mpackedover: TMenuItem;
     msize10m: TMenuItem;
     MenuItem106: TMenuItem;
     msize100m: TMenuItem;
     msizeover: TMenuItem;
     msize100k: TMenuItem;
     msize0: TMenuItem;
     pmcut: TMenuItem;
     pmr_add: TMenuItem;
     pmr_delete: TMenuItem;
     pmr_replace: TMenuItem;
     pmr_replacecase: TMenuItem;
     pmr_ext: TMenuItem;
     pmr_lowercase: TMenuItem;
     pmr_uppercase: TMenuItem;
     PopupMenuRename: TPopupMenu;
     po_im_TIFF: TMenuItem;
     pmisJPEG75: TMenuItem;
     pmisJPEG50: TMenuItem;
     po_im_JPEG75: TMenuItem;
     po_im_JPEG50: TMenuItem;
     po_im_4ktv: TMenuItem;
     po_im_4kcinema: TMenuItem;
     pmif8: TMenuItem;
     pmif6: TMenuItem;
     pmif7: TMenuItem;
     po_im_BMP: TMenuItem;
     po_im_75: TMenuItem;
     po_im_1024: TMenuItem;
     po_im_hd: TMenuItem;
     po_im_wuxga: TMenuItem;
     MenuItem108: TMenuItem;
     po_im_JPEG: TMenuItem;
     po_im_PNG: TMenuItem;
     MenuItem54: TMenuItem;
     po_im_50: TMenuItem;
     po_im_200: TMenuItem;
     mplugins: TMenuItem;
     po_rename_replace_case: TMenuItem;
     po_rename_uppercase: TMenuItem;
     po_rename_replace: TMenuItem;
     MenuItem26: TMenuItem;
     po_rename_ext: TMenuItem;
     po_rename_delete: TMenuItem;
     po_rename_add: TMenuItem;
     po_rename_lowercase: TMenuItem;
     pmmorecheck: TMenuItem;
     MenuItem36: TMenuItem;
     pmmore3: TMenuItem;
     pmmore4: TMenuItem;
     pmmore5: TMenuItem;
     pmmore6: TMenuItem;
     pmmore7: TMenuItem;
     pmmore8: TMenuItem;
     pmmoreseparator: TMenuItem;
     pmmore1: TMenuItem;
     pmmore2: TMenuItem;
     pmAdvanced: TMenuItem;
     pmemr5: TMenuItem;
     pmemr6: TMenuItem;
     pmemr7: TMenuItem;
     pmemr8: TMenuItem;
     pmemr2: TMenuItem;
     pmemr3: TMenuItem;
     pmemr4: TMenuItem;
     pmemr0: TMenuItem;
     MenuItem6: TMenuItem;
     pmemr1: TMenuItem;
     pmemb6: TMenuItem;
     pmemb7: TMenuItem;
     pmemb8: TMenuItem;
     pmemb3: TMenuItem;
     pmemb2: TMenuItem;
     pmemb4: TMenuItem;
     pmemb5: TMenuItem;
     pmemb1: TMenuItem;
     pmFoldersmenu: TMenuItem;
     pmemrf5: TMenuItem;
     pmemrf6: TMenuItem;
     pmemrf7: TMenuItem;
     pmemrf8: TMenuItem;
     pmemrf2: TMenuItem;
     pmemrf3: TMenuItem;
     pmemrf4: TMenuItem;
     pmemrf0: TMenuItem;
     MenuItemsepfold: TMenuItem;
     pmemrf1: TMenuItem;
     pmembf6: TMenuItem;
     pmembf7: TMenuItem;
     pmembf8: TMenuItem;
     pmembf3: TMenuItem;
     pmembf2: TMenuItem;
     pmembf4: TMenuItem;
     pmembf5: TMenuItem;
     pmembf1: TMenuItem;
     pmExploremenu: TMenuItem;
     PanelTitleExtract: TPanel;
     BevelTitleOptions1: TPanel;
     BevelTitleOptions3: TPanel;
     BevelTitleOptions4: TPanel;
     BevelTitleOptions5: TPanel;
     ButtonArchiveOK: TBitBtn;
     ButtonArchiveCancel: TBitBtn;
     ButtonDelete: TSpeedButton;
     ButtonDup: TSpeedButton;
     ButtonDup1: TSpeedButton;
     ButtonNF: TSpeedButton;
     Buttonfmactions: TSpeedButton;
     SpeedButtonAdd: TSpeedButton;
     ButtonExtCancel: TBitBtn;
     ButtonExtOk: TBitBtn;
     ButtonImgRes: TSpeedButton;
     ButtonImgR: TSpeedButton;
     ButtonImgCrop: TSpeedButton;
     Buttonopenactions: TSpeedButton;
     ButtonOpenWith: TSpeedButton;
     ButtonProperties: TSpeedButton;
     ButtonRename1: TSpeedButton;
     ButtonUn7zaTest: TSpeedButton;
     ButtonCopy: TSpeedButton;
     Buttoncmto: TSpeedButton;
     ButtonRename: TSpeedButton;
     ButtonImgResize: TSpeedButton;
     ButtonUn7zaAdd: TSpeedButton;
     ButtonUn7zaConvert: TSpeedButton;
     ButtonPropertiesActions: TSpeedButton;
     ButtonExtractActions: TSpeedButton;
     ButtonCut: TSpeedButton;
     ButtonImg6: TSpeedButton;
     ButtonConvertActions: TSpeedButton;
     ButtonTestActions: TSpeedButton;
     ButtonUn7zaTo: TSpeedButton;
     ButtonPaste: TSpeedButton;
     ButtonImgRL: TSpeedButton;
     ButtonImgRR: TSpeedButton;
     LabelTitleAdd1: TLabel;
     LabelTitleAdd2: TLabel;
     LabelTitleAdd3: TLabel;
     LabelTitleAdd4: TLabel;
     pmrsh: TMenuItem;
     PanelTitleAdd: TPanel;
     pmmorefun_properties: TMenuItem;
     pmfun17: TMenuItem;
     pmfun18: TMenuItem;
     pmbcorganizebookmarks: TMenuItem;
     pmbcaddbookmark: TMenuItem;
     pmfunaz: TMenuItem;
     pmsearchdrag: TMenuItem;
     pmsearchweb: TMenuItem;
     PanelProgressAdd: TPanel;
     PanelProgressExtract: TPanel;
     ShellTreeViewTmp: TShellTreeView;
     MenuItem100: TMenuItem;
     mprofileultra7z: TMenuItem;
     mprofilenormal7z: TMenuItem;
     mprofilenormalzip: TMenuItem;
     mprofilefastzip: TMenuItem;
     mprofileencrypt7z: TMenuItem;
     mprofilesplitzip: TMenuItem;
     mprofileauto: TMenuItem;
     NotebookAdd: TPanel;
     PanelTitleOptions: TPanel;
     po_details: TMenuItem;
     pmmorefun_details: TMenuItem;
     pmmstatus_r: TMenuItem;
     pmfun6: TMenuItem;
     pmfun7: TMenuItem;
     pmfun8: TMenuItem;
     pmfun9: TMenuItem;
     pmfun10: TMenuItem;
     pmfun11: TMenuItem;
     pmfun12: TMenuItem;
     pmfun13: TMenuItem;
     pmfun14: TMenuItem;
     pmfun15: TMenuItem;
     pmfun16: TMenuItem;
     MenuItem20: TMenuItem;
     MenuItem93: TMenuItem;
     MenuItem94: TMenuItem;
     pmfun1: TMenuItem;
     pmfun2: TMenuItem;
     pmfun3: TMenuItem;
     pmfun4: TMenuItem;
     pmfun5: TMenuItem;
     tbtemperature: TTrackBar;
     w7contextlang: TMenuItem;
     mpeautils: TMenuItem;
     MenuItem5: TMenuItem;
     MenuItem92: TMenuItem;
     mPeaFAQ: TMenuItem;
     mPeaSupport: TMenuItem;
     mPeaSiteMirror: TMenuItem;
     pmsecuredeletefree: TMenuItem;
     pmzerofree: TMenuItem;
     MenuItem91: TMenuItem;
     pmzerofile: TMenuItem;
     po_securedeletefree: TMenuItem;
     po_zerofree: TMenuItem;
     MenuItem56: TMenuItem;
     po_zerofile: TMenuItem;
     mtaskscheduler: TMenuItem;
     mscheduledscripts: TMenuItem;
     CheckBoxClip: TCheckBox;
     ctrlback: TSpeedButton;
     ImageListRoot: TImage;
     Labelbsize: TLabel;
     LabelStatusAr: TLabel;
     LabelStatusEx: TLabel;
     pmrename: TMenuItem;
     MenuItemEnumerate: TMenuItem;
     pmjumppictures: TMenuItem;
     pmjumpvideos: TMenuItem;
     MenuItem12: TMenuItem;
     MenuItemOpen_music: TMenuItem;
     MenuItemOpen_pictures: TMenuItem;
     MenuItemOpen_videos: TMenuItem;
     pmjumpmusic: TMenuItem;
     MenuItem4: TMenuItem;
     mbc0: TMenuItem;
     mbc1: TMenuItem;
     mbc2: TMenuItem;
     mbc3: TMenuItem;
     mbc4: TMenuItem;
     mbc5: TMenuItem;
     mbc6: TMenuItem;
     mbc7: TMenuItem;
     mbc8: TMenuItem;
     MenuItem85: TMenuItem;
     MenuItem90: TMenuItem;
     pmhbc0: TMenuItem;
     pnbc2: TMenuItem;
     pnbc3: TMenuItem;
     pnbc4: TMenuItem;
     pnbc5: TMenuItem;
     pnbc6: TMenuItem;
     pnbc7: TMenuItem;
     pnbc8: TMenuItem;
     pnbc0: TMenuItem;
     pnbc1: TMenuItem;
     pmbc: TMenuItem;
     po_task: TMenuItem;
     pnr0: TMenuItem;
     pnh0s: TMenuItem;
     pmhr0: TMenuItem;
     pmh0s: TMenuItem;
     mrecent0: TMenuItem;
     Separator48: TMenuItem;
     mback: TMenuItem;
     MenuItem37: TMenuItem;
     mhistory0s: TMenuItem;
     MenuItem75: TMenuItem;
     MenuItem76: TMenuItem;
     mb0: TMenuItem;
     MenuItem84: TMenuItem;
     po_sysmore: TMenuItem;
     po_msinfo32: TMenuItem;
     po_msconfig: TMenuItem;
     po_regedit: TMenuItem;
     po_mrt: TMenuItem;
     pmpowershell: TMenuItem;
     MenuItemPowerShell: TMenuItem;
     MenuItemOpen_powershell: TMenuItem;
     pmhr1f: TMenuItem;
     pmhr2f: TMenuItem;
     pmhr3f: TMenuItem;
     pmhr4f: TMenuItem;
     pmhr5f: TMenuItem;
     pmhr6f: TMenuItem;
     pmhr7f: TMenuItem;
     pmhr8f: TMenuItem;
     mRecent1f: TMenuItem;
     mRecent2f: TMenuItem;
     mRecent3f: TMenuItem;
     mRecent4f: TMenuItem;
     mRecent5f: TMenuItem;
     mRecent6f: TMenuItem;
     mRecent7f: TMenuItem;
     mRecent8f: TMenuItem;
     po_im_rl: TMenuItem;
     po_im_rr: TMenuItem;
     MenuItem82: TMenuItem;
     po_im_crop: TMenuItem;
     po_im_modify: TMenuItem;
     po_im: TMenuItem;
     menuitemopenhome: TMenuItem;
     PanelListRoot: TPanel;
     pmhrefresh: TMenuItem;
     MenuItemOpen_dropbox: TMenuItem;
     MenuItemOpen_googledrive: TMenuItem;
     MenuItemOpen_onedrive: TMenuItem;
     MenuItemOpen_shp: TMenuItem;
     MenuItemOpen_y: TMenuItem;
     MenuItem73: TMenuItem;
     pmorganizebookmarks: TMenuItem;
     pmrsearch: TMenuItem;
     MenuItemOpen_organizebookmarks: TMenuItem;
     PanelInfoGeneral: TPanel;
     pmqjgoogledrive: TMenuItem;
     pmqjonedrive: TMenuItem;
     pmqjshp: TMenuItem;
     pmqjy: TMenuItem;
     pmisTIFF: TMenuItem;
     pmif1: TMenuItem;
     pmif2: TMenuItem;
     pmif3: TMenuItem;
     pmif4: TMenuItem;
     pmif5: TMenuItem;
     MenuItem88: TMenuItem;
     MenuItem89: TMenuItem;
     pmisBMP: TMenuItem;
     pmisJPEG: TMenuItem;
     pmisPNG: TMenuItem;
     pmiresize25: TMenuItem;
     pmiresize33: TMenuItem;
     pmiresize50: TMenuItem;
     pmiresize75: TMenuItem;
     pmiresize125: TMenuItem;
     pmiresize150: TMenuItem;
     pmiresize200: TMenuItem;
     pmiresize300: TMenuItem;
     pmiresize400: TMenuItem;
     pmir180: TMenuItem;
     pmirflip: TMenuItem;
     pmirmirror: TMenuItem;
     pmImageRotate: TPopupMenu;
     pmImageResize: TPopupMenu;
     po_alltasks: TMenuItem;
     pmpdup: TMenuItem;
     PanelBarOpen3: TPanel;
     po_recycle: TMenuItem;
     pmrecycle: TMenuItem;
     po_open_asarchivet: TMenuItem;
     MenuItem77: TMenuItem;
     pmmstatus_clipboard: TMenuItem;
     pmmstatus_ra: TMenuItem;
     pmmstatus_bookmarks: TMenuItem;
     pmmstatus_status: TMenuItem;
     pmws: TMenuItem;
     MenuItem47t: TMenuItem;
     MenuItem9t: TMenuItem;
     pmcheck: TMenuItem;
     pmnewfolder: TMenuItem;
     MenuItem79: TMenuItem;
     pmproperties: TMenuItem;
     mupdate: TMenuItem;
     MenuItem78: TMenuItem;
     mscripts: TMenuItem;
     modock: TMenuItem;
     mot: TMenuItem;
     mor: TMenuItem;
     mob: TMenuItem;
     mol: TMenuItem;
     modefault: TMenuItem;
     motr: TMenuItem;
     mobr: TMenuItem;
     mobl: TMenuItem;
     motl: TMenuItem;
     PanelBarOpen2: TPanel;
     pmtopen: TPopupMenu;
     pmtestinfolist: TPopupMenu;
     po_flat: TMenuItem;
     MenuItemOrganizeStatusbar: TMenuItem;
     MenuItemOrganizeNavbar: TMenuItem;
     MenuItemOrganizeToolbar: TMenuItem;
     mmore: TMenuItem;
     mJob: TMenuItem;
     mProperties: TMenuItem;
     ctrlfwd: TSpeedButton;
     ctrlwarning: TSpeedButton;
     ctrlup: TSpeedButton;
     EditOpenIn: TEdit;
     EditOpenInInteractive: TEdit;
     il_dtheme_16: TImageList;
     il_dtheme_tool32: TImageList;
     ImageAddress: TImage;
     ImageListSearch: TImage;
     il_nonthemed: TImageList;
     ImageTheme: TImage;
     LabelClickAddress1: TLabel;
     LabelClickAddress2: TLabel;
     LabelClickAddress3: TLabel;
     LabelClickAddress4: TLabel;
     LabelClickAddress5: TLabel;
     LabelClickAddress6: TLabel;
     LabelClickAddress7: TLabel;
     LabelClickAddress8: TLabel;
     LabelStatus: TLabel;
     LabelStatusExDetails: TLabel;
     LabelStatusdisplayed: TLabel;
     mwebs: TMenuItem;
     po_fm: TMenuItem;
     MenuItem34: TMenuItem;
     mbrowsersort: TMenuItem;
     MenuItem65: TMenuItem;
     MenuItem67: TMenuItem;
     MenuItem68: TMenuItem;
     MenuItem70: TMenuItem;
     mAdmin: TMenuItem;
     aowcustom_9: TMenuItem;
     aowcustom_10: TMenuItem;
     aowcustom_11: TMenuItem;
     aowcustom_12: TMenuItem;
     aowcustom_13: TMenuItem;
     aowcustom_14: TMenuItem;
     aowcustom_15: TMenuItem;
     aowcustom_16: TMenuItem;
     eowcustom_9: TMenuItem;
     eowcustom_10: TMenuItem;
     eowcustom_11: TMenuItem;
     eowcustom_12: TMenuItem;
     eowcustom_13: TMenuItem;
     eowcustom_14: TMenuItem;
     eowcustom_15: TMenuItem;
     eowcustom_16: TMenuItem;
     pmqjdropbox: TMenuItem;
     MenuItemProperties: TMenuItem;
     PanelBarOpen1: TPanel;
     mpm: TMenuItem;
     PanelBottom: TPanel;
     pmjumpbreadcrumb: TMenuItem;
     mrecsearch: TMenuItem;
     pmsrec: TMenuItem;
     powcustom_9: TMenuItem;
     powcustom_10: TMenuItem;
     powcustom_11: TMenuItem;
     powcustom_12: TMenuItem;
     powcustom_13: TMenuItem;
     powcustom_14: TMenuItem;
     powcustom_15: TMenuItem;
     powcustom_16: TMenuItem;
     owcustom_9: TMenuItem;
     owcustom_10: TMenuItem;
     owcustom_11: TMenuItem;
     owcustom_12: TMenuItem;
     owcustom_13: TMenuItem;
     owcustom_14: TMenuItem;
     owcustom_15: TMenuItem;
     owcustom_16: TMenuItem;
     mimmersive: TMenuItem;
     msimplesearch: TMenuItem;
     MenuItemopendesktop: TMenuItem;
     mfullscreen: TMenuItem;
     po_checksum: TMenuItem;
     mthumbimages: TMenuItem;
     pmshist3: TMenuItem;
     pmshist4: TMenuItem;
     pmshist5: TMenuItem;
     pmshist6: TMenuItem;
     pmshist7: TMenuItem;
     pmshist8: TMenuItem;
     pmshist1: TMenuItem;
     pmshist2: TMenuItem;
     mtoggleop: TMenuItem;
     MenuItem51: TMenuItem;
     MenuItem62: TMenuItem;
     pma2s_extnew1: TMenuItem;
     pma2s_extallnew1: TMenuItem;
     pma2s_extnew: TMenuItem;
     pma2s_cancel1: TMenuItem;
     pma2s_extract1: TMenuItem;
     pmapptosysextract: TPopupMenu;
     mPeaTracker: TMenuItem;
     pmireset: TMenuItem;
     pmextcontext: TPopupMenu;
     pmextcontextall: TMenuItem;
     pmextcontextdisplayed: TMenuItem;
     pmextcontextselected: TMenuItem;
     pmresetsearch: TPopupMenu;
     po_sortby: TMenuItem;
     pmbc1: TMenuItem;
     pmbc2: TMenuItem;
     pmbc3: TMenuItem;
     pmbc4: TMenuItem;
     pmbc5: TMenuItem;
     pmbc6: TMenuItem;
     pmbc7: TMenuItem;
     pmbc8: TMenuItem;
     mswapbars: TMenuItem;
     PanelClickAddress: TPanel;
     PanelListSearch: TPanel;
     PanelListBar: TPanel;
     pmqelast: TMenuItem;
     pmqe2fav: TMenuItem;
     pmqe3fav: TMenuItem;
     pmqedocuments: TMenuItem;
     pmqesetpw: TMenuItem;
     mcolumns: TMenuItem;
     mcname: TMenuItem;
     mctype: TMenuItem;
     mcsize: TMenuItem;
     mcpacked: TMenuItem;
     mcdate: TMenuItem;
     mcatt: TMenuItem;
     mccrc: TMenuItem;
     mcfree: TMenuItem;
     mcfs: TMenuItem;
     mbrowsercname: TMenuItem;
     mbrowserctype: TMenuItem;
     mbrowsercsize: TMenuItem;
     mbrowsercpacked: TMenuItem;
     mbrowsercdate: TMenuItem;
     mbrowsercatt: TMenuItem;
     mbrowserccrc: TMenuItem;
     po_browsercname: TMenuItem;
     po_browserctype: TMenuItem;
     po_browsercsize: TMenuItem;
     po_browsercpacked: TMenuItem;
     po_browsercdate: TMenuItem;
     po_browsercatt: TMenuItem;
     po_browserccrc: TMenuItem;
     MenuItem44: TMenuItem;
     MenuItem52: TMenuItem;
     mbreset: TMenuItem;
     MenuItem63: TMenuItem;
     pmopenout: TMenuItem;
     pmqenopath: TMenuItem;
     pmqen1: TMenuItem;
     pmqen2: TMenuItem;
     pmqen3: TMenuItem;
     pmqen4: TMenuItem;
     pmqen5: TMenuItem;
     MenuItemExtAllHere: TMenuItem;
     MenuItemExtAllTo: TMenuItem;
     pmusedefault: TMenuItem;
     pmqedefault: TMenuItem;
     pmqe1fav: TMenuItem;
     MenuItem66: TMenuItem;
     pmqenewfolder: TMenuItem;
     pmqedesk: TMenuItem;
     pmqeto: TMenuItem;
     pmqehere: TMenuItem;
     mSystemIntegration: TMenuItem;
     pma2s_extractall1: TMenuItem;
     mwebsearch: TMenuItem;
     PanelIntro: TPanel;
     MenuItemDonations: TMenuItem;
     MenuItemOpen_downloads1: TMenuItem;
     pmjumpdownloads: TMenuItem;
     pmquickextract: TPopupMenu;
     pmbreadcrumb: TPopupMenu;
     po_open_asarchive: TMenuItem;
     MenuItemOrganizeMbar: TMenuItem;
     MenuItemOpen_pubhome: TMenuItem;
     MenuItem53: TMenuItem;
     MenuItem55: TMenuItem;
     MenuItem57: TMenuItem;
     MenuItem59: TMenuItem;
     mOrganize: TMenuItem;
     pmhr1: TMenuItem;
     pmhr2: TMenuItem;
     pmhr3: TMenuItem;
     pmhr4: TMenuItem;
     pmhr5: TMenuItem;
     pmhr6: TMenuItem;
     pmhr7: TMenuItem;
     pmhr8: TMenuItem;
     pmhr9: TMenuItem;
     pmjumppubhome: TMenuItem;
     pma2s_extract: TMenuItem;
     pms2a_open: TMenuItem;
     MenuItem9: TMenuItem;
     mshowmenu: TMenuItem;
     mthl: TMenuItem;
     MenuItem46: TMenuItem;
     pms2a_add: TMenuItem;
     pma2s_cancel: TMenuItem;
     pms2a_copy: TMenuItem;
     pma2s_copy: TMenuItem;
     pms2a_move: TMenuItem;
     MenuItem45: TMenuItem;
     pms2a_cancel: TMenuItem;
     MenuItemOpen_search: TMenuItem;
     munsearch: TMenuItem;
     pma2s_move: TMenuItem;
     pmsystoapp: TPopupMenu;
     pmapptosys: TPopupMenu;
     Panelnav: TPanel;
     LabelStatusArDetails: TLabel;
     ListViewBrowser: TListView;
     mcancel: TMenuItem;
     mbcl: TMenuItem;
     MenuItem10: TMenuItem;
     MenuItem13: TMenuItem;
     MenuItem14: TMenuItem;
     mbpea: TMenuItem;
     mbexplore: TMenuItem;
     mr9: TMenuItem;
     mhpea: TMenuItem;
     mhexplore: TMenuItem;
     mhcl: TMenuItem;
     MenuItem39: TMenuItem;
     MenuItemOpen_pubdoc: TMenuItem;
     pmjumppubdoc: TMenuItem;
     pnh1: TMenuItem;
     pnh2: TMenuItem;
     pnh3: TMenuItem;
     pnh4: TMenuItem;
     pnh5: TMenuItem;
     pnh6: TMenuItem;
     pnh7: TMenuItem;
     pnh8: TMenuItem;
     ShellTreeViewNav: TShellTreeView;
     smHistory1: TMenuItem;
     mNav: TMenuItem;
     mhistory2: TMenuItem;
     mhistory3: TMenuItem;
     mhistory4: TMenuItem;
     mhistory5: TMenuItem;
     mhistory6: TMenuItem;
     mhistory7: TMenuItem;
     mhistory8: TMenuItem;
     mHistory: TMenuItem;
     mhistory1: TMenuItem;
     pmh9: TMenuItem;
     MenuItem41: TMenuItem;
     mopenasarchive: TMenuItem;
     pmbookmarks: TMenuItem;
     po_convertarchive: TMenuItem;
     mrowselect: TMenuItem;
     po_selectall: TMenuItem;
     mgotypegz: TMenuItem;
     mgotype7zsfx: TMenuItem;
     mgotypetar: TMenuItem;
     mgotypezip: TMenuItem;
     mgotypebz2: TMenuItem;
     mgotype7z: TMenuItem;
     mgotype: TMenuItem;
     mgobrowser: TMenuItem;
     mextractarchive: TMenuItem;
     mtogglenew: TMenuItem;
     mLayout: TMenuItem;
     pmsecuredelete: TMenuItem;
     pmquickdelete: TMenuItem;
     pmcpyto: TMenuItem;
     pmmvto: TMenuItem;
     pmexplore: TMenuItem;
     pmcommand: TMenuItem;
     pmh2: TMenuItem;
     pmh3: TMenuItem;
     pmh4: TMenuItem;
     pmh5: TMenuItem;
     pmh7: TMenuItem;
     pmh6: TMenuItem;
     pmh8: TMenuItem;
     pmh1: TMenuItem;
     mLang: TMenuItem;
     MenuItemOpen_Last: TMenuItem;
     MenuItem2: TMenuItem;
     madvfilters: TMenuItem;
     MenuItem33: TMenuItem;
     mkeyfile: TMenuItem;
     msetpw: TMenuItem;
     mOptions: TMenuItem;
     mgoextlayout: TMenuItem;
     MenuItem31: TMenuItem;
     MenuItemextexplore: TMenuItem;
     NotebookExtract: TPanel;
     PanelActAdd: TPanel;
     PanelActExt: TPanel;
     PanelExtract: TPanel;
     PanelClipboard: TPanel;
     PopupMenuType: TPopupMenu;
     pmBrowser: TMenuItem;
     mf4up: TMenuItem;
     PanelBack: TPanel;
     smfs1: TMenuItem;
     mf3: TMenuItem;
     MenuItemHistoryBook: TMenuItem;
     PopupMenuHistory: TPopupMenu;
     pnr1: TMenuItem;
     pnr2: TMenuItem;
     pnr3: TMenuItem;
     pnr4: TMenuItem;
     pnr5: TMenuItem;
     pnr6: TMenuItem;
     pnr7: TMenuItem;
     pnr8: TMenuItem;
     MenuItemOpen_here: TMenuItem;
     mRecent9: TMenuItem;
     pmjb2: TMenuItem;
     pmjb3: TMenuItem;
     pmjb4: TMenuItem;
     pmjb5: TMenuItem;
     pmjb6: TMenuItem;
     pmjb7: TMenuItem;
     pmjb8: TMenuItem;
     pmjb9: TMenuItem;
     pmjb10: TMenuItem;
     pmjb11: TMenuItem;
     pmjb12: TMenuItem;
     pmjb13: TMenuItem;
     pmjb14: TMenuItem;
     pmjb15: TMenuItem;
     pmjb16: TMenuItem;
     pmjb17: TMenuItem;
     pmjb18: TMenuItem;
     pmjb19: TMenuItem;
     pmjb20: TMenuItem;
     pmjb21: TMenuItem;
     pmjb22: TMenuItem;
     pmjb23: TMenuItem;
     pmjb24: TMenuItem;
     pmjumpsbook: TMenuItem;
     MenuItem29: TMenuItem;
     pmjb1: TMenuItem;
     MenuItemOpen_desktop1: TMenuItem;
     MenuItemOpen_documents1: TMenuItem;
     MenuItemOpen_home1: TMenuItem;
     pcustompathexplore: TMenuItem;
     pojdn1: TMenuItem;
     pojdn2: TMenuItem;
     pojdn3: TMenuItem;
     pojdn4: TMenuItem;
     pojdn5: TMenuItem;
     pojdn6: TMenuItem;
     pojdn7: TMenuItem;
     pojdn8: TMenuItem;
     pojdn9: TMenuItem;
     pojdn10: TMenuItem;
     pojdn11: TMenuItem;
     pojdn12: TMenuItem;
     pojdn13: TMenuItem;
     pojdn14: TMenuItem;
     pojdn15: TMenuItem;
     pojdn16: TMenuItem;
     pojdn17: TMenuItem;
     pojdn18: TMenuItem;
     pojdn19: TMenuItem;
     pojdn20: TMenuItem;
     pojdn21: TMenuItem;
     pojdn22: TMenuItem;
     pojdn23: TMenuItem;
     pojdn24: TMenuItem;
     pojdn25: TMenuItem;
     pojdn26: TMenuItem;
     pnb1: TMenuItem;
     pnb2: TMenuItem;
     pnb3: TMenuItem;
     pnb4: TMenuItem;
     pnb5: TMenuItem;
     pnb6: TMenuItem;
     pnb7: TMenuItem;
     pnb8: TMenuItem;
     pnb9: TMenuItem;
     pnb10: TMenuItem;
     pnb11: TMenuItem;
     pnb12: TMenuItem;
     pnb13: TMenuItem;
     pnb14: TMenuItem;
     pnb15: TMenuItem;
     pnb16: TMenuItem;
     pnb17: TMenuItem;
     pnb18: TMenuItem;
     pnb19: TMenuItem;
     pnb20: TMenuItem;
     pnb21: TMenuItem;
     pnb22: TMenuItem;
     pnb23: TMenuItem;
     PopupPathExtract: TPopupMenu;
     pmmorefun_info: TMenuItem;
     pmmorefun_list: TMenuItem;
     aowseparator2: TMenuItem;
     PanelFilters: TPanel;
     MenuItemPW: TMenuItem;
     MenuItem27: TMenuItem;
     MenuItemNavigate: TMenuItem;
     OpenDialogTheme: TOpenDialog;
     pmjd1: TMenuItem;
     pmjd2: TMenuItem;
     pmjd3: TMenuItem;
     pmjd4: TMenuItem;
     pmjd5: TMenuItem;
     pmjd6: TMenuItem;
     pmjd7: TMenuItem;
     pmjd8: TMenuItem;
     pmjd9: TMenuItem;
     pmjd10: TMenuItem;
     pmjd11: TMenuItem;
     pmjd12: TMenuItem;
     pmjd13: TMenuItem;
     pmjd14: TMenuItem;
     pmjd15: TMenuItem;
     pmjd16: TMenuItem;
     pmjd17: TMenuItem;
     pmjd18: TMenuItem;
     pmjd19: TMenuItem;
     pmjd20: TMenuItem;
     pmjd21: TMenuItem;
     pmjd22: TMenuItem;
     pmjd23: TMenuItem;
     pmjd24: TMenuItem;
     pmjd25: TMenuItem;
     pmjd26: TMenuItem;
     pmmorefun: TPopupMenu;
     munpeabrowse: TMenuItem;
     munpea: TMenuItem;
     smBookmarks1: TMenuItem;
     MenuItemOpen_addtobookmarks: TMenuItem;
     po_delete: TMenuItem;
     po_securedelete: TMenuItem;
     MenuItemOpen_root: TMenuItem;
     MenuItemOpen_jump: TMenuItem;
     po_spacer: TMenuItem;
     po_setpw: TMenuItem;
     mpeahelpoffline: TMenuItem;
     mTutorial: TMenuItem;
     eowseparator1: TMenuItem;
     eowcustom1: TMenuItem;
     eowcustom2: TMenuItem;
     eowcustom3: TMenuItem;
     eowcustom4: TMenuItem;
     eowcustom5: TMenuItem;
     eowcustom6: TMenuItem;
     eowcustom7: TMenuItem;
     eowcustom8: TMenuItem;
     powseparator1: TMenuItem;
     aowseparator1: TMenuItem;
     aowcustom1: TMenuItem;
     aowcustom2: TMenuItem;
     aowcustom3: TMenuItem;
     aowcustom4: TMenuItem;
     aowcustom6: TMenuItem;
     aowcustom5: TMenuItem;
     aowcustom7: TMenuItem;
     aowcustom8: TMenuItem;
     eowcustom9: TMenuItem;
     eowcustom10: TMenuItem;
     eowcustom11: TMenuItem;
     eowcustom12: TMenuItem;
     eowcustom13: TMenuItem;
     eowcustom14: TMenuItem;
     eowcustom15: TMenuItem;
     eowcustom16: TMenuItem;
     aowcustom9: TMenuItem;
     aowcustom10: TMenuItem;
     aowcustom11: TMenuItem;
     aowcustom12: TMenuItem;
     aowcustom13: TMenuItem;
     aowcustom14: TMenuItem;
     aowcustom15: TMenuItem;
     aowcustom16: TMenuItem;
     powcustom9: TMenuItem;
     powcustom10: TMenuItem;
     powcustom11: TMenuItem;
     powcustom12: TMenuItem;
     powcustom13: TMenuItem;
     powcustom14: TMenuItem;
     powcustom15: TMenuItem;
     powcustom16: TMenuItem;
     owcustom10: TMenuItem;
     owcustom11: TMenuItem;
     owcustom12: TMenuItem;
     owcustom13: TMenuItem;
     owcustom14: TMenuItem;
     owcustom15: TMenuItem;
     owcustom16: TMenuItem;
     owcustom9: TMenuItem;
     powcustom1: TMenuItem;
     powcustom2: TMenuItem;
     powcustom3: TMenuItem;
     powcustom4: TMenuItem;
     powcustom5: TMenuItem;
     powcustom6: TMenuItem;
     powcustom7: TMenuItem;
     powcustom8: TMenuItem;
     owcustom1: TMenuItem;
     owcustom2: TMenuItem;
     owcustom3: TMenuItem;
     owcustom4: TMenuItem;
     owcustom5: TMenuItem;
     owcustom6: TMenuItem;
     owcustom7: TMenuItem;
     owcustom8: TMenuItem;
     po_open_peazipt: TMenuItem;
     po_open_associatedt: TMenuItem;
     po_open_customt: TMenuItem;
     po_setappst: TMenuItem;
     owcustom1t: TMenuItem;
     owcustom2t: TMenuItem;
     owcustom3t: TMenuItem;
     owcustom4t: TMenuItem;
     owcustom5t: TMenuItem;
     owcustom6t: TMenuItem;
     owcustom7t: TMenuItem;
     owcustom8t: TMenuItem;
     owcustom9t: TMenuItem;
     owcustom10t: TMenuItem;
     owcustom11t: TMenuItem;
     owcustom12t: TMenuItem;
     owcustom13t: TMenuItem;
     owcustom14t: TMenuItem;
     owcustom15t: TMenuItem;
     owcustom16t: TMenuItem;
     owcustom_9t: TMenuItem;
     owcustom_10t: TMenuItem;
     owcustom_11t: TMenuItem;
     owcustom_12t: TMenuItem;
     owcustom_13t: TMenuItem;
     owcustom_14t: TMenuItem;
     owcustom_15t: TMenuItem;
     owcustom_16t: TMenuItem;
     SplitterBottom: TSplitter;
     SplitterSide: TSplitter;
     StringGridBookmarks: TStringGrid;
     StringGridClipboard: TStringGrid;
     StringGridSessionHistory: TStringGrid;
     StringGridRecent: TStringGrid;
     TimerBrowser: TTimer;
     TimerWinContext: TTimer;
     Timerdrag: TTimer;
     TimerHintStart: TTimer;
     tmpeazip: TMenuItem;
     MenuItem22: TMenuItem;
     tmcreate: TMenuItem;
     MenuItem21: TMenuItem;
     tmopenpath: TMenuItem;
     tmopenarchive: TMenuItem;
     MenuItem24: TMenuItem;
     tmquit: TMenuItem;
     mTray: TMenuItem;
     PopupMenuTray: TPopupMenu;
     TrayIconPZ: TTrayIcon;
     TreeViewNav: TTreeView;
     po_hexp: TMenuItem;
     MenuItemToolhexp: TMenuItem;
     pmJumpDocuments: TMenuItem;
     pclip_removeitem: TMenuItem;
     pclip_clearclip: TMenuItem;
     pmJump3: TMenuItem;
     PopupMenuClipboard: TPopupMenu;
      mAttributes: TMenuItem;
      mDate: TMenuItem;
      mDateRecent: TMenuItem;
      mDateEqual: TMenuItem;
      mDateOlder: TMenuItem;
      mDateERecent: TMenuItem;
      mDateEOlder: TMenuItem;
      MenuItem11: TMenuItem;
      mbAddArchive: TMenuItem;
      mbAddPath: TMenuItem;
      mbDelete: TMenuItem;
      mBookmarks: TMenuItem;
      mb12: TMenuItem;
      mb1: TMenuItem;
      mb11: TMenuItem;
      mb10: TMenuItem;
      mb9: TMenuItem;
      mb8: TMenuItem;
      mb7: TMenuItem;
      mb6: TMenuItem;
      mb5: TMenuItem;
      mb4: TMenuItem;
      mb3: TMenuItem;
      mb2: TMenuItem;
      mb13: TMenuItem;
      mb14: TMenuItem;
      mb15: TMenuItem;
      mb24: TMenuItem;
      mb16: TMenuItem;
      mb17: TMenuItem;
      mb18: TMenuItem;
      mb19: TMenuItem;
      mb20: TMenuItem;
      mb21: TMenuItem;
      mb22: TMenuItem;
      mb23: TMenuItem;
      MenuItem15: TMenuItem;
      mbNotes: TMenuItem;
      MenuItem16: TMenuItem;
      mAbout: TMenuItem;
      po_envstr: TMenuItem;
      po_convert: TMenuItem;
      MenuItemBookmarks: TMenuItem;
      pmExplorepath: TMenuItem;
      mcp: TMenuItem;
      mMisc: TMenuItem;
      po_copyto: TMenuItem;
      po_moveto: TMenuItem;
      MenuItemOpen_explore: TMenuItem;
      MenuItemOpen_commandprompt: TMenuItem;
      PopupMenuBookmarks: TPopupMenu;
      MenuItemRefresh: TMenuItem;
      mUser: TMenuItem;
      po_computer: TMenuItem;
      po_manage: TMenuItem;
      po_removeunits: TMenuItem;
      po_cpl: TMenuItem;
      po_taskman: TMenuItem;
      po_diskclean: TMenuItem;
      po_defrag: TMenuItem;
      po_systemtools: TMenuItem;
      mgolayout: TMenuItem;
      MenuItemOpen_path: TMenuItem;
      MenuItemOpen_archive: TMenuItem;
      po_join: TMenuItem;
      po_compare: TMenuItem;
      po_check: TMenuItem;
      po_paste: TMenuItem;
      po_split: TMenuItem;
      po_newfolder: TMenuItem;
      po_rename: TMenuItem;
      MenuItem7: TMenuItem;
      po_copy: TMenuItem;
      po_cut: TMenuItem;
      po_filetools: TMenuItem;
      po_open_peazip: TMenuItem;
      po_open_associated: TMenuItem;
      po_open_custom: TMenuItem;
      po_open: TMenuItem;
      MenuItemOpen_list_all: TMenuItem;
      MenuItemOpen_list_selected: TMenuItem;
      MenuItemOpen_list_displayed: TMenuItem;
      MenuItemOpen_list: TMenuItem;
      po_list: TMenuItem;
      po_test: TMenuItem;
      po_info: TMenuItem;
      po_exthere: TMenuItem;
      po_addtoarchive: TMenuItem;
      mRefresh: TMenuItem;
      pmJump2: TMenuItem;
      pcustom3: TMenuItem;
      pcustom2: TMenuItem;
      pcustom1: TMenuItem;
      pcustom8: TMenuItem;
      pcustom7: TMenuItem;
      pcustom6: TMenuItem;
      pcustom5: TMenuItem;
      pcustom4: TMenuItem;
      mSpacer2_1: TMenuItem;
      mSortBySelection: TMenuItem;
      pmSearchAdd: TMenuItem;
      mSpacer0: TMenuItem;
      MenuItemToolCheck: TMenuItem;
      MenuItemToolCompare: TMenuItem;
      MenuItemOpen_ext_all: TMenuItem;
      MenuItemOpen_ext_selected: TMenuItem;
      MenuItemOpen_ext_displayed: TMenuItem;
      MenuItemOpen_ExtractHere: TMenuItem;
      mQuit: TMenuItem;
      mSpacer0_1: TMenuItem;
      mSizeESmaller: TMenuItem;
      mSizeELarger: TMenuItem;
      mPSLarger: TMenuItem;
      mPSELarger: TMenuItem;
      mPSEqual: TMenuItem;
      mPSESmaller: TMenuItem;
      mPackedSize: TMenuItem;
      mPSSmaller: TMenuItem;
      mSizeEqual: TMenuItem;
      mSizeLarger: TMenuItem;
      mSizeSmaller: TMenuItem;
      mSize: TMenuItem;
      mSpacer2_0: TMenuItem;
      mType: TMenuItem;
      pCustom: TPopupMenu;
      MainMenu1: TMainMenu;
      mDefaults: TMenuItem;
      MenuItem1: TMenuItem;
      mBench: TMenuItem;
      mEdit: TMenuItem;
      mBrowse: TMenuItem;
      MenuItemTools: TMenuItem;
      MenuItemOpen_info_selected: TMenuItem;
      MenuItemOpen_info_all: TMenuItem;
      MenuItemOpen_info_displayed: TMenuItem;
      mFlat: TMenuItem;
      mSpacer3: TMenuItem;
      openwithpeazip: TMenuItem;
      openwithassociated: TMenuItem;
      openwithcustom: TMenuItem;
      MenuItemERCustom: TMenuItem;
      MenuItemPrePeaZip: TMenuItem;
      MenuItemPreAssociated: TMenuItem;
      MenuItemPreCustom: TMenuItem;
      MenuItemERPeaZip: TMenuItem;
      MenuItemERAssociated: TMenuItem;
      mRecent4: TMenuItem;
      mRecent3: TMenuItem;
      mRecent2: TMenuItem;
      mRecent1: TMenuItem;
      mRecent8: TMenuItem;
      mRecent7: TMenuItem;
      mRecent6: TMenuItem;
      mRecent5: TMenuItem;
      mInvertSelection: TMenuItem;
      mSelectAll: TMenuItem;
      MenuItemOpen_preview: TMenuItem;
      MenuItemOpenWeb: TMenuItem;
      MenuItemOpen_test_all: TMenuItem;
      MenuItemOpen_test_selected: TMenuItem;
      MenuItemOpen_test_displayed: TMenuItem;
      MenuItemOpen_test: TMenuItem;
      MenuItemOpen_info: TMenuItem;
      MenuItemOpen_spacer5: TMenuItem;
      pmOpenPJdisplayed: TMenuItem;
      pmOpenPJselected: TMenuItem;
      pmOpenPJall: TMenuItem;
      pmOpenPJ: TPopupMenu;
      MenuItem5b: TMenuItem;
      MenuItemOpen_extandopenwith: TMenuItem;
      NotebookOpt: TPanel;
      PanelArchive: TPanel;
      PanelBarOpen: TPanel;
      PanelOptions: TPanel;
      PanelOpen: TPanel;
      pmSaveList: TMenuItem;
      pmLoadList: TMenuItem;
      pmAddFolder: TMenuItem;
      pmAddFile: TMenuItem;
      MenuItem3: TMenuItem;
      mPEA: TMenuItem;
      mFeatures: TMenuItem;
      mHelp: TMenuItem;
      mOptionsMenu: TMenuItem;
      OpenDialogLang: TOpenDialog;
      OpenDialogList: TOpenDialog;
      OpenDialogArchive: TOpenDialog;
      PopupLayout: TPopupMenu;
      PopupOpen: TPopupMenu;
      SaveDialogAS: TSaveDialog;
      SaveDialogPJ: TSaveDialog;
      SelectDirectoryDialog1: TSelectDirectoryDialog;
      TimerSync: TTimer;
      TreeViewTmp: TTreeView;
      procedure abc0Click(Sender: TObject);
      procedure abc1Click(Sender: TObject);
      procedure abc2Click(Sender: TObject);
      procedure abc3Click(Sender: TObject);
      procedure abc4Click(Sender: TObject);
      procedure abc5Click(Sender: TObject);
      procedure abc6Click(Sender: TObject);
      procedure abc7Click(Sender: TObject);
      procedure abc8Click(Sender: TObject);
      procedure altF10Execute(Sender: TObject);
      procedure altF1Execute(Sender: TObject);
      procedure ctrlalt0Execute(Sender: TObject);
      procedure ctrlalt1Execute(Sender: TObject);
      procedure ctrlalt2Execute(Sender: TObject);
      procedure ctrlalt3Execute(Sender: TObject);
      procedure ctrlalt4Execute(Sender: TObject);
      procedure ctrlalt5Execute(Sender: TObject);
      procedure ctrlalt6Execute(Sender: TObject);
      procedure ctrlalt7Execute(Sender: TObject);
      procedure ctrlalt8Execute(Sender: TObject);
      procedure ctrlalt9Execute(Sender: TObject);
      procedure ctrlaltenterExecute(Sender: TObject);
      procedure ctrlaltN1Execute(Sender: TObject);
      procedure ctrlaltN2Execute(Sender: TObject);
      procedure ctrlaltN3Execute(Sender: TObject);
      procedure ctrlaltN4Execute(Sender: TObject);
      procedure ctrlaltN5Execute(Sender: TObject);
      procedure ctrlaltN6Execute(Sender: TObject);
      procedure ctrlaltN7Execute(Sender: TObject);
      procedure alt0Execute(Sender: TObject);
      procedure alt1Execute(Sender: TObject);
      procedure alt2Execute(Sender: TObject);
      procedure alt4Execute(Sender: TObject);
      procedure alt5Execute(Sender: TObject);
      procedure alt6Execute(Sender: TObject);
      procedure alt7Execute(Sender: TObject);
      procedure alt8Execute(Sender: TObject);
      procedure altF3Execute(Sender: TObject);
      procedure altF5Execute(Sender: TObject);
      procedure altLEFTExecute(Sender: TObject);
      procedure altRIGHTExecute(Sender: TObject);
      procedure altUPExecute(Sender: TObject);
      procedure BKSPExecute(Sender: TObject);
      procedure cbautobrowsetarChange(Sender: TObject);
      procedure cbmiddlebuttonChange(Sender: TObject);
      procedure cbRARrvClick(Sender: TObject);
      procedure cbshowhiddenClick(Sender: TObject);
      procedure CheckBoxBackgroundClick(Sender: TObject);
      procedure CheckBoxLimitKFSizeClick(Sender: TObject);
      procedure CheckBoxLogClick(Sender: TObject);
      procedure CheckBoxParamsClick(Sender: TObject);
      procedure CheckBoxZstdErrPolicyClick(Sender: TObject);
      procedure ComboBoxBrowserCloseUp(Sender: TObject);
      procedure ComboBoxPAQThreadsChange(Sender: TObject);
      procedure ComboBoxVirtualChange(Sender: TObject);
      procedure ctrl0Click(Sender: TObject);
      procedure ctrl1Click(Sender: TObject);
      procedure ctrl2Click(Sender: TObject);
      procedure ctrl3Click(Sender: TObject);
      procedure ctrl4Click(Sender: TObject);
      procedure ctrl5Click(Sender: TObject);
      procedure ctrl6Click(Sender: TObject);
      procedure ctrl7Click(Sender: TObject);
      procedure ctrl8Click(Sender: TObject);
      procedure ctrl9Click(Sender: TObject);
      procedure ctrlAExecute(Sender: TObject);
      procedure ctrlaltN8Execute(Sender: TObject);
      procedure ctrlaltN9Execute(Sender: TObject);
      procedure ctrlaltAExecute(Sender: TObject);
      procedure ctrlaltDClick(Sender: TObject);
      procedure ctrlaltEClick(Sender: TObject);
      procedure ctrlaltHExecute(Sender: TObject);
      procedure ctrlarcMouseEnter(Sender: TObject);
      procedure ctrlBExecute(Sender: TObject);
      procedure ctrlDExecute(Sender: TObject);
      procedure ctrldotExecute(Sender: TObject);
      procedure ctrlextMouseEnter(Sender: TObject);
      procedure ctrlF10Execute(Sender: TObject);
      procedure ctrlF12Execute(Sender: TObject);
      procedure ctrlF1Execute(Sender: TObject);
      procedure ctrlF3Execute(Sender: TObject);
      procedure ctrlF4Execute(Sender: TObject);
      procedure ctrlF5Execute(Sender: TObject);
      procedure ctrlF8Execute(Sender: TObject);
      procedure ctrlF9Execute(Sender: TObject);
      procedure ctrlFExecute(Sender: TObject);
      procedure ctrlHExecute(Sender: TObject);
      procedure ctrlNExecute(Sender: TObject);
      procedure ctrlWExecute(Sender: TObject);
      procedure EditOptSearchEditingDone(Sender: TObject);
      procedure escExecute(Sender: TObject);
      procedure f11fullscreenExecute(Sender: TObject);
      procedure F12Execute(Sender: TObject);
      procedure F1Execute(Sender: TObject);
      procedure f9pwpromptExecute(Sender: TObject);
      procedure aowcustom10Click(Sender: TObject);
      procedure aowcustom11Click(Sender: TObject);
      procedure aowcustom12Click(Sender: TObject);
      procedure aowcustom13Click(Sender: TObject);
      procedure aowcustom14Click(Sender: TObject);
      procedure aowcustom15Click(Sender: TObject);
      procedure aowcustom16Click(Sender: TObject);
      procedure aowcustom1Click(Sender: TObject);
      procedure aowcustom2Click(Sender: TObject);
      procedure aowcustom3Click(Sender: TObject);
      procedure aowcustom4Click(Sender: TObject);
      procedure aowcustom5Click(Sender: TObject);
      procedure aowcustom6Click(Sender: TObject);
      procedure aowcustom7Click(Sender: TObject);
      procedure aowcustom8Click(Sender: TObject);
      procedure aowcustom9Click(Sender: TObject);
      procedure aowcustom_10Click(Sender: TObject);
      procedure aowcustom_11Click(Sender: TObject);
      procedure aowcustom_12Click(Sender: TObject);
      procedure aowcustom_13Click(Sender: TObject);
      procedure aowcustom_14Click(Sender: TObject);
      procedure aowcustom_15Click(Sender: TObject);
      procedure aowcustom_16Click(Sender: TObject);
      procedure aowcustom_9Click(Sender: TObject);
      procedure baboutbinClick(Sender: TObject);
      procedure baboutchangelogClick(Sender: TObject);
      procedure baboutfaqClick(Sender: TObject);
      procedure baboutlocalhelpClick(Sender: TObject);
      procedure baboutplugindirClick(Sender: TObject);
      procedure baboutthemesClick(Sender: TObject);
      procedure baboutpluginsClick(Sender: TObject);
      procedure baboutremoveunaceClick(Sender: TObject);
      procedure baboutremoveunrarClick(Sender: TObject);
      procedure baboutsupportClick(Sender: TObject);
      procedure babouttosClick(Sender: TObject);
      procedure babouttrackerClick(Sender: TObject);
      procedure babouttranslationsClick(Sender: TObject);
      procedure baboutupClick(Sender: TObject);
      procedure baboutwebClick(Sender: TObject);
      procedure BScheduleExtClick(Sender: TObject);
      procedure BScheduleClick(Sender: TObject);
      procedure ButtonOptOKClick(Sender: TObject);
      procedure ButtonArchiveCancelClick(Sender: TObject);
      procedure ButtoncmtoClick(Sender: TObject);
      procedure ButtonCopyClick(Sender: TObject);
      procedure ButtonCutClick(Sender: TObject);
      procedure ButtonEditDeskClick(Sender: TObject);
      procedure ButtonDupClick(Sender: TObject);
      procedure ButtonOutAddClick(Sender: TObject);
      procedure LabelClickAddress1DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure LabelClickAddress2DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure LabelClickAddress3DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure LabelClickAddress4DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure LabelClickAddress5DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure LabelClickAddress6DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure LabelClickAddress7DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure LabelClickAddress8DragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure MenuItemERBrowserClick(Sender: TObject);
      procedure MenuItemForceThumbnailsClick(Sender: TObject);
      procedure MenuItemPreBrowserClick(Sender: TObject);
      procedure MenuItemCopypathsMenuClick(Sender: TObject);
      procedure MenuItemViewImageClick(Sender: TObject);
      procedure mextto10Click(Sender: TObject);
      procedure mextto11Click(Sender: TObject);
      procedure mextto12Click(Sender: TObject);
      procedure mextto13Click(Sender: TObject);
      procedure mextto14Click(Sender: TObject);
      procedure mextto15Click(Sender: TObject);
      procedure mextto16Click(Sender: TObject);
      procedure mextto17Click(Sender: TObject);
      procedure mextto18Click(Sender: TObject);
      procedure mextto19Click(Sender: TObject);
      procedure mextto1Click(Sender: TObject);
      procedure mextto20Click(Sender: TObject);
      procedure mextto21Click(Sender: TObject);
      procedure mextto22Click(Sender: TObject);
      procedure mextto23Click(Sender: TObject);
      procedure mextto24Click(Sender: TObject);
      procedure mextto25Click(Sender: TObject);
      procedure mextto26Click(Sender: TObject);
      procedure mextto2Click(Sender: TObject);
      procedure mextto3Click(Sender: TObject);
      procedure mextto4Click(Sender: TObject);
      procedure mextto5Click(Sender: TObject);
      procedure mextto6Click(Sender: TObject);
      procedure mextto7Click(Sender: TObject);
      procedure mextto8Click(Sender: TObject);
      procedure mextto9Click(Sender: TObject);
      procedure mexttob10Click(Sender: TObject);
      procedure mexttob11Click(Sender: TObject);
      procedure mexttob12Click(Sender: TObject);
      procedure mexttob13Click(Sender: TObject);
      procedure mexttob14Click(Sender: TObject);
      procedure mexttob15Click(Sender: TObject);
      procedure mexttob16Click(Sender: TObject);
      procedure mexttob17Click(Sender: TObject);
      procedure mexttob18Click(Sender: TObject);
      procedure mexttob19Click(Sender: TObject);
      procedure mexttob20Click(Sender: TObject);
      procedure mexttob21Click(Sender: TObject);
      procedure mexttob22Click(Sender: TObject);
      procedure mexttob23Click(Sender: TObject);
      procedure mexttob9Click(Sender: TObject);
      procedure mextto_desktopClick(Sender: TObject);
      procedure mextto_documentsClick(Sender: TObject);
      procedure mextto_downloadsClick(Sender: TObject);
      procedure mextto_dropboxClick(Sender: TObject);
      procedure mextto_googledriveClick(Sender: TObject);
      procedure mextto_hereClick(Sender: TObject);
      procedure mextto_homeClick(Sender: TObject);
      procedure mextto_LastClick(Sender: TObject);
      procedure mextto_musicClick(Sender: TObject);
      procedure mextto_onedriveClick(Sender: TObject);
      procedure mextto_picturesClick(Sender: TObject);
      procedure mextto_pubdocClick(Sender: TObject);
      procedure mextto_pubhomeClick(Sender: TObject);
      procedure mextto_shpClick(Sender: TObject);
      procedure mextto_yClick(Sender: TObject);
      procedure mextto_videosClick(Sender: TObject);
      procedure mhrenamef2Click(Sender: TObject);
      procedure mlogClick(Sender: TObject);
      procedure pmbatchtestClick(Sender: TObject);
      procedure pmextdeskClick(Sender: TObject);
      procedure pmextdocClick(Sender: TObject);
      procedure pmexttoClick(Sender: TObject);
      procedure pmfun25Click(Sender: TObject);
      procedure pmfun26Click(Sender: TObject);
      procedure pmfun27Click(Sender: TObject);
      procedure pmfun28Click(Sender: TObject);
      procedure pmfun29Click(Sender: TObject);
      procedure pmfun30Click(Sender: TObject);
      procedure pmfun31Click(Sender: TObject);
      procedure pmfun32Click(Sender: TObject);
      procedure pmfun33Click(Sender: TObject);
      procedure pmfun34Click(Sender: TObject);
      procedure pmfun35Click(Sender: TObject);
      procedure pmh1Click(Sender: TObject);
      procedure pmh2Click(Sender: TObject);
      procedure pmh3Click(Sender: TObject);
      procedure pmh4Click(Sender: TObject);
      procedure pmh5Click(Sender: TObject);
      procedure pmh6Click(Sender: TObject);
      procedure pmh7Click(Sender: TObject);
      procedure pmh8Click(Sender: TObject);
      procedure pmintddaddClick(Sender: TObject);
      procedure pmintddcopyClick(Sender: TObject);
      procedure pmintddextractClick(Sender: TObject);
      procedure pmintddmoveClick(Sender: TObject);
      procedure pmjumpappleClick(Sender: TObject);
      procedure pmrendernativeClick(Sender: TObject);
      procedure pmrendersharpClick(Sender: TObject);
      procedure pmrendersoftClick(Sender: TObject);
      procedure pmtabrefreshClick(Sender: TObject);
      procedure po_open_browserClick(Sender: TObject);
      procedure seRARrvChange(Sender: TObject);
      procedure shiftaltF4Execute(Sender: TObject);
      procedure shiftcrtlF4Execute(Sender: TObject);
      procedure shiftctrl7Execute(Sender: TObject);
      procedure shiftctrlaltDClick(Sender: TObject);
      procedure shiftctrlaltEClick(Sender: TObject);
      procedure shiftctrlaltF4Execute(Sender: TObject);
      procedure shiftctrlaltNClick(Sender: TObject);
      procedure shiftctrlaltSClick(Sender: TObject);
      procedure shiftctrlBExecute(Sender: TObject);
      procedure shiftctrlF11Execute(Sender: TObject);
      procedure shiftctrlF3Execute(Sender: TObject);
      procedure shiftctrlF9Execute(Sender: TObject);
      procedure shiftctrlGExecute(Sender: TObject);
      procedure shiftctrlRExecute(Sender: TObject);
      procedure shiftctrlSExecute(Sender: TObject);
      procedure shiftctrlTExecute(Sender: TObject);
      procedure shiftctrlXExecute(Sender: TObject);
      procedure shiftctrlZExecute(Sender: TObject);
      procedure shiftF1Execute(Sender: TObject);
      procedure shiftF3Execute(Sender: TObject);
      procedure shiftF4Execute(Sender: TObject);
      procedure shiftF5Execute(Sender: TObject);
      procedure shiftF8Execute(Sender: TObject);
      procedure shiftF9Execute(Sender: TObject);
      procedure SpeedButtonAddClick(Sender: TObject);
      procedure ButtonEditNameAddClick(Sender: TObject);
      procedure ButtonCustomExtClick(Sender: TObject);
      procedure ButtonEditNameOutExtractClick(Sender: TObject);
      procedure ButtonOpenCustomClick(Sender: TObject);
      procedure ButtonEditNameCustomExtClick(Sender: TObject);
      procedure ButtonExtCancelClick(Sender: TObject);
      procedure ButtonExtOkClick(Sender: TObject);
      procedure Buttonfmactions1Click(Sender: TObject);
      procedure ButtonfmactionsClick(Sender: TObject);
      procedure ButtonImgRClick(Sender: TObject);
      procedure ButtonImgResClick(Sender: TObject);
      procedure ButtonImgResizeClick(Sender: TObject);
      procedure ButtonImgCropClick(Sender: TObject);
      procedure ButtonImgRLClick(Sender: TObject);
      procedure ButtonImgRRClick(Sender: TObject);
      procedure ButtonImg6Click(Sender: TObject);
      procedure ButtonNFClick(Sender: TObject);
      procedure ButtonopenactionsClick(Sender: TObject);
      procedure ButtonOpenWithClick(Sender: TObject);
      procedure ButtonPasteClick(Sender: TObject);
      procedure ButtonPropertiesClick(Sender: TObject);
      procedure ButtonDeleteClick(Sender: TObject);
      procedure ButtonRenameClick(Sender: TObject);
      procedure ButtonOutExtractClick(Sender: TObject);
      procedure ButtonAddActionsClick(Sender: TObject);
      procedure ButtonAddActionsMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonUn7zaAddMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonUn7zaConvertClick(Sender: TObject);
      procedure ButtonUn7zaConvertMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonPropertiesActionsClick(Sender: TObject);
      procedure ButtonExtractActionsClick(Sender: TObject);
      procedure ButtonConvertActionsClick(Sender: TObject);
      procedure ButtonConvertActionsMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonTestActionsClick(Sender: TObject);
      procedure cbAdvfAddClick(Sender: TObject);
      procedure cbAdvfExtClick(Sender: TObject);
      procedure cbautoclosesingleextractClick(Sender: TObject);
      procedure cbCustomExtensionClick(Sender: TObject);
      procedure cbdefaultactionChange(Sender: TObject);
      procedure cbDeleteInputModeAddChange(Sender: TObject);
      procedure cbDeleteInputModeExtChange(Sender: TObject);
      procedure cbEncExtensionClick(Sender: TObject);
      procedure cbEncodingChange(Sender: TObject);
      procedure cbSmallIconSizeChange(Sender: TObject);
      procedure cbExtEvForHowChange(Sender: TObject);
      procedure cbExtEvForWhenChange(Sender: TObject);
      procedure cbforcetypeChange(Sender: TObject);
      procedure cbRAR5Click(Sender: TObject);
      procedure cbRARmanualClick(Sender: TObject);
      procedure cbRARBLAKE2Click(Sender: TObject);
      procedure cbRARClick(Sender: TObject);
      procedure cbRARlastmodtimeChange(Sender: TObject);
      procedure cbRARlockClick(Sender: TObject);
      procedure cbRARrrClick(Sender: TObject);
      procedure cbRARsaveopenClick(Sender: TObject);
      procedure cbRARsavesecurityClick(Sender: TObject);
      procedure cbRARsavestreamsClick(Sender: TObject);
      procedure cbRARsfxClick(Sender: TObject);
      procedure cbRARsolidClick(Sender: TObject);
      procedure cbtarpipeClick(Sender: TObject);
      procedure cbuntarpipeClick(Sender: TObject);
      procedure cbBoxAltBarStyleChange(Sender: TObject);
      procedure CheckBoxUTCClick(Sender: TObject);
      procedure ComboBoxPEAKDFwChange(Sender: TObject);
      procedure ComboBoxPEAKDFChange(Sender: TObject);
      procedure csbdeskClick(Sender: TObject);
      procedure csbdocClick(Sender: TObject);
      procedure csbdownloadsClick(Sender: TObject);
      procedure csbhomeClick(Sender: TObject);
      procedure csbmusicClick(Sender: TObject);
      procedure csbpicClick(Sender: TObject);
      procedure csbrootClick(Sender: TObject);
      procedure cbtimecreatedClick(Sender: TObject);
      procedure cbtreeChange(Sender: TObject);
      procedure cbspacingChange(Sender: TObject);
      procedure cbzoomingChange(Sender: TObject);
      procedure CheckBoxExtNotArchivesClick(Sender: TObject);
      procedure CheckBoxExtUnsupportedClick(Sender: TObject);
      procedure CheckBoxExtUnsupportedPeaZipClick(Sender: TObject);
      procedure CheckBox7zunrar5Click(Sender: TObject);
      procedure cbAccentToolBarChange(Sender: TObject);
      procedure CheckBoxACClick(Sender: TObject);
      procedure cbAltBarChange(Sender: TObject);
      procedure cbAltTabStyleChange(Sender: TObject);
      procedure cbAltTabsChange(Sender: TObject);
      procedure CheckBoxARCabsClick(Sender: TObject);
      procedure CheckBoxMailAddClick(Sender: TObject);
      procedure CheckBoxAutoExtTarConvertClick(Sender: TObject);
      procedure CheckBoxAutoExtTarClick(Sender: TObject);
      procedure CheckBoxAutoOpenTarClick(Sender: TObject);
      procedure CheckBoxAutoTestClick(Sender: TObject);
      procedure CheckBoxBrotliClick(Sender: TObject);
      procedure CheckBoxBrowseNotVerboseClick(Sender: TObject);
      procedure CheckBoxCenteredToolbarClick(Sender: TObject);
      procedure CheckBoxClosePeaZipClick(Sender: TObject);
      procedure CheckBoxConvertPWChange(Sender: TObject);
      procedure CheckBoxConvertVerboseChange(Sender: TObject);
      procedure CheckBoxConvertChange(Sender: TObject);
      procedure CheckBoxDateClick(Sender: TObject);
      procedure CheckBoxDeleteInputAddClick(Sender: TObject);
      procedure CheckBoxDeleteInputExtClick(Sender: TObject);
      procedure CheckBoxDragDropClick(Sender: TObject);
      procedure CheckBoxEditArchivesChange(Sender: TObject);
      procedure CheckBoxEnumdClick(Sender: TObject);
      procedure CheckBoxExcludeEFClick(Sender: TObject);
      procedure CheckBoxExtAndClick(Sender: TObject);
      procedure CheckBoxExtrac32Click(Sender: TObject);
      procedure CheckBoxSmartFolderClick(Sender: TObject);
      procedure CheckBoxForceBrowseClick(Sender: TObject);
      procedure CheckBoxForceConvertClick(Sender: TObject);
      procedure CheckBoxForceEditClick(Sender: TObject);
      procedure CheckBoxForceLayoutClick(Sender: TObject);
      procedure CheckBoxForceOpenClick(Sender: TObject);
      procedure CheckBoxIntDirClick(Sender: TObject);
      procedure CheckBoxMailKeepClick(Sender: TObject);
      procedure CheckBoxSolidExtensionClick(Sender: TObject);
      procedure CheckBoxNameAsParentFolderClick(Sender: TObject);
      procedure CheckBoxnetworkinfoClick(Sender: TObject);
      procedure CheckBoxNoConfClick(Sender: TObject);
      procedure CheckBoxrelativeClick(Sender: TObject);
      procedure CheckBoxSameArcClick(Sender: TObject);
      procedure CheckBoxSameExtClick(Sender: TObject);
      procedure CheckBoxShowVolatileClick(Sender: TObject);
      procedure CheckBoxSkipDelClick(Sender: TObject);
      procedure CheckBoxSkipencClick(Sender: TObject);
      procedure CheckBoxsnhClick(Sender: TObject);
      procedure CheckBoxsniExtClick(Sender: TObject);
      procedure CheckBoxsniClick(Sender: TObject);
      procedure CheckBoxsnlClick(Sender: TObject);
      procedure CheckBoxsnoiClick(Sender: TObject);
      procedure CheckBoxsnonClick(Sender: TObject);
      procedure CheckBoxsnsExtClick(Sender: TObject);
      procedure CheckBoxsnsClick(Sender: TObject);
      procedure CheckBoxsnzExtClick(Sender: TObject);
      procedure cbSolidAddressChange(Sender: TObject);
      procedure CheckBoxsspClick(Sender: TObject);
      procedure CheckBoxstlClick(Sender: TObject);
      procedure CheckBoxARCsfxClick(Sender: TObject);
      procedure CheckBoxAutoOpenClick(Sender: TObject);
      procedure CheckBoxClipClick(Sender: TObject);
      procedure CheckBoxEncodingClick(Sender: TObject);
      procedure CheckBoxFolderClick(Sender: TObject);
      procedure CheckBoxParallelArchivingClick(Sender: TObject);
      procedure CheckBoxSeparateClick(Sender: TObject);
      procedure CheckBoxAltgridcolClick(Sender: TObject);
      procedure CheckBoxzcopyClick(Sender: TObject);
      procedure CheckBoxzipxswitchClick(Sender: TObject);
      procedure CheckBoxzpaqabsoluteClick(Sender: TObject);
      procedure CheckBoxzpaqallClick(Sender: TObject);
      procedure CheckBoxzpaqforceClick(Sender: TObject);
      procedure CheckBoxzpaqfullClick(Sender: TObject);
      procedure CheckBoxZstdClick(Sender: TObject);
      procedure CheckGroupM1ItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupMExtItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupWExtItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupWItemClick(Sender: TObject; Index: integer);
      procedure ColorButton2ColorChanged(Sender: TObject);
      procedure ColorButton3ColorChanged(Sender: TObject);
      procedure ComboBoxConsoleEncodingChange(Sender: TObject);
      procedure ComboBoxSplitChange(Sender: TObject);
      procedure ComboBox7zMethodCloseUp(Sender: TObject);
      procedure ComboBox7zLevelCloseUp(Sender: TObject);
      procedure cbLevelCloseUp(Sender: TObject);
      procedure ComboBoxDragChange(Sender: TObject);
      procedure ComboBoxKiBChange(Sender: TObject);
      procedure ComboBoxLanguageCloseUp(Sender: TObject);
      procedure ComboBoxMaxArgChange(Sender: TObject);
      procedure ComboBox7zMemuseChange(Sender: TObject);
      procedure ComboBoxPriorityChange(Sender: TObject);
      procedure ComboBoxSysbinChange(Sender: TObject);
      procedure ComboBoxSyntaxLevelChange(Sender: TObject);
      procedure ComboBoxTARTSChange(Sender: TObject);
      procedure ComboBoxTARChange(Sender: TObject);
      procedure ComboBoxWDChange(Sender: TObject);
      procedure ComboBoxARCFunChange(Sender: TObject);
      procedure ComboBox7zFunChange(Sender: TObject);
      procedure ComboBox7zThreadsChange(Sender: TObject);
      procedure ComboBoxArchiveActUpdateChange(Sender: TObject);
      procedure cbActChange(Sender: TObject);
      procedure ComboBoxLibreChange(Sender: TObject);
      procedure ComboBoxprivacyChange(Sender: TObject);
      procedure ComboBoxSDChange(Sender: TObject);
      procedure comboRARdictChange(Sender: TObject);
      procedure csbvidClick(Sender: TObject);
      procedure ctrlarcClick(Sender: TObject);
      procedure ctrlextClick(Sender: TObject);
      procedure ctrlwarningClick(Sender: TObject);
      procedure DateEdit1Change(Sender: TObject);
      procedure DateEdit2Change(Sender: TObject);
      procedure DateEditExt1Change(Sender: TObject);
      procedure DateEditExt2Change(Sender: TObject);
      procedure EditAddNameChange(Sender: TObject);
      procedure EditOpenInInteractiveExit(Sender: TObject);
      procedure EditOpenInInteractiveKeyPress(Sender: TObject; var Key: char);
      procedure EditOpenInInteractiveKeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure EditOpenInChange(Sender: TObject);
      procedure EditOutExtractChange(Sender: TObject);
      procedure EditUn7zaFilterInteractiveKeyPress(Sender: TObject; var Key: char);
      procedure EditUn7zaFilterChange(Sender: TObject);
      procedure eowcustom10Click(Sender: TObject);
      procedure eowcustom11Click(Sender: TObject);
      procedure eowcustom12Click(Sender: TObject);
      procedure eowcustom13Click(Sender: TObject);
      procedure eowcustom14Click(Sender: TObject);
      procedure eowcustom15Click(Sender: TObject);
      procedure eowcustom16Click(Sender: TObject);
      procedure eowcustom1Click(Sender: TObject);
      procedure eowcustom2Click(Sender: TObject);
      procedure eowcustom3Click(Sender: TObject);
      procedure eowcustom4Click(Sender: TObject);
      procedure eowcustom5Click(Sender: TObject);
      procedure eowcustom6Click(Sender: TObject);
      procedure eowcustom7Click(Sender: TObject);
      procedure eowcustom8Click(Sender: TObject);
      procedure eowcustom9Click(Sender: TObject);
      procedure eowcustom_10Click(Sender: TObject);
      procedure eowcustom_11Click(Sender: TObject);
      procedure eowcustom_12Click(Sender: TObject);
      procedure eowcustom_13Click(Sender: TObject);
      procedure eowcustom_14Click(Sender: TObject);
      procedure eowcustom_15Click(Sender: TObject);
      procedure eowcustom_16Click(Sender: TObject);
      procedure eowcustom_9Click(Sender: TObject);
      procedure eowrunClick(Sender: TObject);
      procedure f3searchExecute(Sender: TObject);
      procedure f4menuExecute(Sender: TObject);
      procedure f5refreshExecute(Sender: TObject);
      procedure f8openbook1Execute(Sender: TObject);
      procedure f6flatExecute(Sender: TObject);
      procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
      procedure FormResize(Sender: TObject);
      procedure FormShow(Sender: TObject);
      procedure ImageBCtextClick(Sender: TObject);
      procedure ImageBCtextMouseEnter(Sender: TObject);
      procedure ImageBCtextMouseLeave(Sender: TObject);
      procedure ImageFlatcropClick(Sender: TObject);
      procedure ImageFlatdupClick(Sender: TObject);
      procedure ImageFlatfolderClick(Sender: TObject);
      procedure ImageFlatrenClick(Sender: TObject);
      procedure ImageFlattestmoreClick(Sender: TObject);
      procedure ImageFlattransformClick(Sender: TObject);
      procedure Imagesp1Click(Sender: TObject);
      procedure ImagespClick(Sender: TObject);
      procedure LabelCommentClick(Sender: TObject);
      procedure LabelExtHereClick(Sender: TObject);
      procedure LabelWDClick(Sender: TObject);
      procedure LabelAddFilesClick(Sender: TObject);
      procedure LabelAddFolderClick(Sender: TObject);
      procedure LabelCustomDesktopClick(Sender: TObject);
      procedure LabelColPresetsClick(Sender: TObject);
      procedure LabelConfigurePwClick(Sender: TObject);
      procedure LabelDefaultColor3Click(Sender: TObject);
      procedure LabellightpresetsClick(Sender: TObject);
      procedure LabelErrorsClick(Sender: TObject);
      procedure LabelmoreoptExtClick(Sender: TObject);
      procedure cbqdupClick(Sender: TObject);
      procedure LabelPMpwClick(Sender: TObject);
      procedure LabelsetworkClick(Sender: TObject);
      procedure LabelStatusArClick(Sender: TObject);
      procedure LabelStatusArMouseEnter(Sender: TObject);
      procedure LabelStatusClick(Sender: TObject);
      procedure LabelStatusdisplayedClick(Sender: TObject);
      procedure LabelStatusdisplayedMouseEnter(Sender: TObject);
      procedure LabelStatusExClick(Sender: TObject);
      procedure LabelStatusExMouseEnter(Sender: TObject);
      procedure LabelStatusMouseEnter(Sender: TObject);
      procedure LabelThemeClick(Sender: TObject);
      procedure LabelTitleOptions2Click(Sender: TObject);
      procedure LabelTitleOptions2MouseEnter(Sender: TObject);
      procedure LabelTitleOptions2MouseLeave(Sender: TObject);
      procedure layoutmotwfullClick(Sender: TObject);
      procedure lightdimClick(Sender: TObject);
      procedure lightgraphiteClick(Sender: TObject);
      procedure lightmochaClick(Sender: TObject);
      procedure lightplumClick(Sender: TObject);
      procedure lightsenapeClick(Sender: TObject);
      procedure ListViewBrowserContextPopup(Sender: TObject; MousePos: TPoint;
        var Handled: Boolean);
      procedure ListViewBrowserData(Sender: TObject; Item: TListItem);
      procedure ListViewBrowserEdited(Sender: TObject; Item: TListItem;
        var AValue: string);
      procedure ListViewBrowserMouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure lsetdefaultout_arcClick(Sender: TObject);
      procedure lsetdefaultout_extClick(Sender: TObject);
      procedure mBenchpeaClick(Sender: TObject);
      procedure mbgnome4Click(Sender: TObject);
      procedure mbgnomeClick(Sender: TObject);
      procedure mbkdeClick(Sender: TObject);
      procedure mbmacClick(Sender: TObject);
      procedure mbrowserccommentClick(Sender: TObject);
      procedure mbtextClick(Sender: TObject);
      procedure mcaccessedClick(Sender: TObject);
      procedure marcoptClick(Sender: TObject);
      procedure mccommentClick(Sender: TObject);
      procedure mccreatedClick(Sender: TObject);
      procedure mcommentClick(Sender: TObject);
      procedure mcommentrarClick(Sender: TObject);
      procedure mdefarcsetClick(Sender: TObject);
      procedure mdefextsetClick(Sender: TObject);
      procedure mcmethodClick(Sender: TObject);
      procedure lightlowClick(Sender: TObject);
      procedure mdirbeforefilesClick(Sender: TObject);
      procedure mdownloadthemesClick(Sender: TObject);
      procedure layoutmotwClick(Sender: TObject);
      procedure MenuItemToolsjClick(Sender: TObject);
      procedure pmmoreshajClick(Sender: TObject);
      procedure po_lingdisksClick(Sender: TObject);
      procedure po_linglogsClick(Sender: TObject);
      procedure po_linlshwClick(Sender: TObject);
      procedure po_motwfullClick(Sender: TObject);
      procedure pmmoremotwClick(Sender: TObject);
      procedure po_checkmotwClick(Sender: TObject);
      procedure MenuItemToolAnalyzeClick(Sender: TObject);
      procedure MenuItemToolBlake2sClick(Sender: TObject);
      procedure MenuItemToolCrc32Click(Sender: TObject);
      procedure MenuItemToolMD5Click(Sender: TObject);
      procedure MenuItemToolsgClick(Sender: TObject);
      procedure MenuItemToolSHA1Click(Sender: TObject);
      procedure MenuItemToolSHA256Click(Sender: TObject);
      procedure MenuItemToolsvClick(Sender: TObject);
      procedure MenuItemTooltextpClick(Sender: TObject);
      procedure mexploretrashClick(Sender: TObject);
      procedure munsavecopyClick(Sender: TObject);
      procedure mz100Click(Sender: TObject);
      procedure mz115Click(Sender: TObject);
      procedure mz125Click(Sender: TObject);
      procedure mz150Click(Sender: TObject);
      procedure mz175Click(Sender: TObject);
      procedure mz200Click(Sender: TObject);
      procedure mz50Click(Sender: TObject);
      procedure mz67Click(Sender: TObject);
      procedure mz80Click(Sender: TObject);
      procedure mz87Click(Sender: TObject);
      procedure pmextherehereClick(Sender: TObject);
      procedure pmextherenewClick(Sender: TObject);
      procedure pmextheresmartClick(Sender: TObject);
      procedure pmfun19Click(Sender: TObject);
      procedure pmfun20Click(Sender: TObject);
      procedure pmfun21Click(Sender: TObject);
      procedure pmfun22Click(Sender: TObject);
      procedure pmfun23Click(Sender: TObject);
      procedure pmfun24Click(Sender: TObject);
      procedure pmintddnewClick(Sender: TObject);
      procedure pmintddhereClick(Sender: TObject);
      procedure mexttob1Click(Sender: TObject);
      procedure mexttob2Click(Sender: TObject);
      procedure mexttob3Click(Sender: TObject);
      procedure mexttob4Click(Sender: TObject);
      procedure mexttob5Click(Sender: TObject);
      procedure mexttob6Click(Sender: TObject);
      procedure mexttob7Click(Sender: TObject);
      procedure mexttob8Click(Sender: TObject);
      procedure mexttoc1Click(Sender: TObject);
      procedure mexttoc2Click(Sender: TObject);
      procedure mexttoc3Click(Sender: TObject);
      procedure mexttoc4Click(Sender: TObject);
      procedure mexttoc5Click(Sender: TObject);
      procedure mexttoc6Click(Sender: TObject);
      procedure mexttoc7Click(Sender: TObject);
      procedure mexttoc8Click(Sender: TObject);
      procedure mexttoh1Click(Sender: TObject);
      procedure mexttoh2Click(Sender: TObject);
      procedure mexttoh3Click(Sender: TObject);
      procedure mexttoh4Click(Sender: TObject);
      procedure mexttoh5Click(Sender: TObject);
      procedure mexttoh6Click(Sender: TObject);
      procedure mexttoh7Click(Sender: TObject);
      procedure mexttoh8Click(Sender: TObject);
      procedure mexttos1Click(Sender: TObject);
      procedure mexttos2Click(Sender: TObject);
      procedure mexttos3Click(Sender: TObject);
      procedure mexttos4Click(Sender: TObject);
      procedure mexttos5Click(Sender: TObject);
      procedure mexttos6Click(Sender: TObject);
      procedure mexttos7Click(Sender: TObject);
      procedure mexttos8Click(Sender: TObject);
      procedure mFlatArchivesClick(Sender: TObject);
      procedure mloadprofileClick(Sender: TObject);
      procedure msaveprofileClick(Sender: TObject);
      procedure mshowsidebarClick(Sender: TObject);
      procedure msidebarClick(Sender: TObject);
      procedure msmartsortClick(Sender: TObject);
      procedure pmflatarchivesClick(Sender: TObject);
      procedure pmintddsmartClick(Sender: TObject);
      procedure pmmoreblake2bsaveClick(Sender: TObject);
      procedure pmmorecksaveClick(Sender: TObject);
      procedure pmmoremd5saveClick(Sender: TObject);
      procedure pmmoresha1saveClick(Sender: TObject);
      procedure pmmoreshagClick(Sender: TObject);
      procedure pmmoreshasaveClick(Sender: TObject);
      procedure pmmoreshavClick(Sender: TObject);
      procedure pmmoretextClick(Sender: TObject);
      procedure pmspclassicClick(Sender: TObject);
      procedure pmspminimalClick(Sender: TObject);
      procedure pmspmodernClick(Sender: TObject);
      procedure pmspoldClick(Sender: TObject);
      procedure pmsppostmodernClick(Sender: TObject);
      procedure pmsaveascsvlClick(Sender: TObject);
      procedure pmsaveastsvClick(Sender: TObject);
      procedure pmsaveastxtClick(Sender: TObject);
      procedure pmscommentClick(Sender: TObject);
      procedure pmscompactClick(Sender: TObject);
      procedure pmsinfoClick(Sender: TObject);
      procedure pmsizelargeClick(Sender: TObject);
      procedure pmsizelargepClick(Sender: TObject);
      procedure pmsizelargeppClick(Sender: TObject);
      procedure pmsizelargepppClick(Sender: TObject);
      procedure pmsizelargeppppClick(Sender: TObject);
      procedure pmsizemediumClick(Sender: TObject);
      procedure pmsizesmallClick(Sender: TObject);
      procedure pmsoparchClick(Sender: TObject);
      procedure pmsoppathClick(Sender: TObject);
      procedure pmtabsreopenClick(Sender: TObject);
      procedure po_ntfsadsClick(Sender: TObject);
      procedure po_ntfsziClick(Sender: TObject);
      procedure po_s256jClick(Sender: TObject);
      procedure po_savecopyClick(Sender: TObject);
      procedure po_sha1sumClick(Sender: TObject);
      procedure pow10appsClick(Sender: TObject);
      procedure pow10dappsClick(Sender: TObject);
      procedure pow10defenderClick(Sender: TObject);
      procedure pow10settingsClick(Sender: TObject);
      procedure pow10storageClick(Sender: TObject);
      procedure po_b2sumClick(Sender: TObject);
      procedure po_cksumClick(Sender: TObject);
      procedure po_gnometmClick(Sender: TObject);
      procedure po_kdetmClick(Sender: TObject);
      procedure po_md5sumClick(Sender: TObject);
      procedure po_s256gClick(Sender: TObject);
      procedure po_s256vClick(Sender: TObject);
      procedure po_sha256sumClick(Sender: TObject);
      procedure po_textpClick(Sender: TObject);
      procedure ComboBoxsecChange(Sender: TObject);
      procedure StringGridBookmarksDragOver(Sender, Source: TObject; X,
        Y: Integer; State: TDragState; var Accept: Boolean);
      procedure TabBarDragOver(Sender, Source: TObject; X, Y: Integer;
        State: TDragState; var Accept: Boolean);
      procedure Timerrename1Timer(Sender: TObject);
      procedure shiftEtogglearchivetreeExecute(Sender: TObject);
      procedure TreeViewNavDragOver(Sender, Source: TObject; X, Y: Integer;
        State: TDragState; var Accept: Boolean);
      procedure zenc1250Click(Sender: TObject);
      procedure zenc1251Click(Sender: TObject);
      procedure zenc1252Click(Sender: TObject);
      procedure zenc1253Click(Sender: TObject);
      procedure zenc1254Click(Sender: TObject);
      procedure zenc1255Click(Sender: TObject);
      procedure zenc1256Click(Sender: TObject);
      procedure zenc1257Click(Sender: TObject);
      procedure zenc1258Click(Sender: TObject);
      procedure zenc20866Click(Sender: TObject);
      procedure zenc21866Click(Sender: TObject);
      procedure zenc65001Click(Sender: TObject);
      procedure zenc850Click(Sender: TObject);
      procedure zenc852Click(Sender: TObject);
      procedure zenc858Click(Sender: TObject);
      procedure zenc866Click(Sender: TObject);
      procedure zenc874Click(Sender: TObject);
      procedure zenc932Click(Sender: TObject);
      procedure zenc936Click(Sender: TObject);
      procedure zenc949Click(Sender: TObject);
      procedure zenc950Click(Sender: TObject);
      procedure zenclocalClick(Sender: TObject);
      procedure zenclocalutf8Click(Sender: TObject);
      procedure zencmoreClick(Sender: TObject);
      procedure pmtabsaveClick(Sender: TObject);
      procedure MenuItemShowColMenuClick(Sender: TObject);
      procedure MenuItemToggleNavClick(Sender: TObject);
      procedure mpeachangelogClick(Sender: TObject);
      procedure mpeatosClick(Sender: TObject);
      procedure mswaptabClick(Sender: TObject);
      procedure mtranslationsfaqClick(Sender: TObject);
      procedure BtnStyleClick(Sender: TObject);
      procedure BtnStyleMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure pmadvfClick(Sender: TObject);
      procedure pmbcnwClick(Sender: TObject);
      procedure pmccommentClick(Sender: TObject);
      procedure pmclipClick(Sender: TObject);
      procedure pmembf1Click(Sender: TObject);
      procedure pmembf2Click(Sender: TObject);
      procedure pmembf3Click(Sender: TObject);
      procedure pmembf4Click(Sender: TObject);
      procedure pmembf5Click(Sender: TObject);
      procedure pmembf6Click(Sender: TObject);
      procedure pmembf7Click(Sender: TObject);
      procedure pmembf8Click(Sender: TObject);
      procedure pmemrf1Click(Sender: TObject);
      procedure pmemrf2Click(Sender: TObject);
      procedure pmemrf3Click(Sender: TObject);
      procedure pmemrf4Click(Sender: TObject);
      procedure pmemrf5Click(Sender: TObject);
      procedure pmemrf6Click(Sender: TObject);
      procedure pmemrf7Click(Sender: TObject);
      procedure pmemrf8Click(Sender: TObject);
      procedure pmmoreaddClick(Sender: TObject);
      procedure pmmorecommentzipClick(Sender: TObject);
      procedure pmmoreconvertClick(Sender: TObject);
      procedure pmmoreextractClick(Sender: TObject);
      procedure pmmoretestClick(Sender: TObject);
      procedure mdefaultextractClick(Sender: TObject);
      procedure pmshowstylemenuClick(Sender: TObject);
      procedure pmtabscloseallClick(Sender: TObject);
      procedure pmtabsnewwindowClick(Sender: TObject);
      procedure pmtoolcompactClick(Sender: TObject);
      procedure pnbce1Click(Sender: TObject);
      procedure pnbce2Click(Sender: TObject);
      procedure pnbce3Click(Sender: TObject);
      procedure pnbce4Click(Sender: TObject);
      procedure pnbce5Click(Sender: TObject);
      procedure pnbce6Click(Sender: TObject);
      procedure pnbce7Click(Sender: TObject);
      procedure pnbce8Click(Sender: TObject);
      procedure pnbcf1Click(Sender: TObject);
      procedure pnbcf2Click(Sender: TObject);
      procedure pnbcf3Click(Sender: TObject);
      procedure pnbcf4Click(Sender: TObject);
      procedure pnbcf5Click(Sender: TObject);
      procedure pnbcf6Click(Sender: TObject);
      procedure pnbcf7Click(Sender: TObject);
      procedure pnbcf8Click(Sender: TObject);
      procedure pnhe1Click(Sender: TObject);
      procedure pnhe2Click(Sender: TObject);
      procedure pnhe3Click(Sender: TObject);
      procedure pnhe4Click(Sender: TObject);
      procedure pnhe5Click(Sender: TObject);
      procedure pnhe6Click(Sender: TObject);
      procedure pnhe7Click(Sender: TObject);
      procedure pnhe8Click(Sender: TObject);
      procedure pnhf1Click(Sender: TObject);
      procedure pnhf2Click(Sender: TObject);
      procedure pnhf3Click(Sender: TObject);
      procedure pnhf4Click(Sender: TObject);
      procedure pnhf5Click(Sender: TObject);
      procedure pnhf6Click(Sender: TObject);
      procedure pnhf7Click(Sender: TObject);
      procedure pnhf8Click(Sender: TObject);
      procedure po_addsepClick(Sender: TObject);
      procedure MenuItemInfoClick(Sender: TObject);
      procedure MenuItemInfomenuClick(Sender: TObject);
      procedure MenuItemToggleStatusClick(Sender: TObject);
      procedure msettingsClick(Sender: TObject);
      procedure mshownavbarClick(Sender: TObject);
      procedure mshowstatusbarClick(Sender: TObject);
      procedure mshowtoolbarClick(Sender: TObject);
      procedure pmquickdownloadsClick(Sender: TObject);
      procedure pmsnoClick(Sender: TObject);
      procedure pmsstatusClick(Sender: TObject);
      procedure pmstatusnoneClick(Sender: TObject);
      procedure pmtoollargeClick(Sender: TObject);
      procedure pmtoolmediumClick(Sender: TObject);
      procedure pmtoolnoneClick(Sender: TObject);
      procedure pmtoolsmallClick(Sender: TObject);
      procedure pmshowmainmenuClick(Sender: TObject);
      procedure mverifyselfClick(Sender: TObject);
      procedure pmhnewtabClick(Sender: TObject);
      procedure mfilterbrowserClick(Sender: TObject);
      procedure MenuItemColBeosClick(Sender: TObject);
      procedure MenuItemColMintClick(Sender: TObject);
      procedure MenuItemColUbuntuClick(Sender: TObject);
      procedure MenuItemColWindowsClick(Sender: TObject);
      procedure mloadlayoutClick(Sender: TObject);
      procedure mprofileimmediateClick(Sender: TObject);
      procedure msamplescriptsClick(Sender: TObject);
      procedure msavelayoutClick(Sender: TObject);
      procedure mTypeClick(Sender: TObject);
      procedure pmr_filesClick(Sender: TObject);
      procedure pmr_renClick(Sender: TObject);
      procedure pmsaveascsvClick(Sender: TObject);
      procedure pmshowsearchClick(Sender: TObject);
      procedure po_browserccommentClick(Sender: TObject);
      procedure po_cinnamonsettClick(Sender: TObject);
      procedure po_clipClick(Sender: TObject);
      procedure po_commentzipClick(Sender: TObject);
      procedure po_dedupClick(Sender: TObject);
      procedure po_gnomeccClick(Sender: TObject);
      procedure po_gnomeswClick(Sender: TObject);
      procedure po_kdesyssettClick(Sender: TObject);
      procedure po_lindfhClick(Sender: TObject);
      procedure po_lindushClick(Sender: TObject);
      procedure po_linhistoryClick(Sender: TObject);
      procedure po_linidClick(Sender: TObject);
      procedure po_linipaddressClick(Sender: TObject);
      procedure po_linnetstatClick(Sender: TObject);
      procedure po_linpsefClick(Sender: TObject);
      procedure po_lintopClick(Sender: TObject);
      procedure po_macactClick(Sender: TObject);
      procedure po_macdiskClick(Sender: TObject);
      procedure po_maclaunchClick(Sender: TObject);
      procedure po_macsysClick(Sender: TObject);
      procedure po_openunitasarchivelinClick(Sender: TObject);
      procedure po_dispenvstrlinClick(Sender: TObject);
      procedure pmcaccessedClick(Sender: TObject);
      procedure pmccreatedClick(Sender: TObject);
      procedure pmcmethodClick(Sender: TObject);
      procedure po_ftpClick(Sender: TObject);
      procedure po_getmacClick(Sender: TObject);
      procedure mtabClick(Sender: TObject);
      procedure pmqeallClick(Sender: TObject);
      procedure pmqedisplayedClick(Sender: TObject);
      procedure pmqeselectedClick(Sender: TObject);
      procedure pmrowClick(Sender: TObject);
      procedure pmsnavClick(Sender: TObject);
      procedure pmstreeClick(Sender: TObject);
      procedure pmsnoneClick(Sender: TObject);
      procedure MenuItemExtAllHereNewClick(Sender: TObject);
      procedure MenuItemExtAllHereSmartClick(Sender: TObject);
      procedure mextoptClick(Sender: TObject);
      procedure mForceClearClick(Sender: TObject);
      procedure mForceSynceditsClearClick(Sender: TObject);
      procedure mForceSynceditsClick(Sender: TObject);
      procedure mloadcompsettingsClick(Sender: TObject);
      procedure mprofile7zfastClick(Sender: TObject);
      procedure mprofiletargzClick(Sender: TObject);
      procedure mprofiletarxzClick(Sender: TObject);
      procedure mprofileextremezpaqClick(Sender: TObject);
      procedure mprofile7zfastestClick(Sender: TObject);
      procedure mprofileloadClick(Sender: TObject);
      procedure mprofilerarClick(Sender: TObject);
      procedure mprofilesaveClick(Sender: TObject);
      procedure mprofiletarzstClick(Sender: TObject);
      procedure mprofilezstdClick(Sender: TObject);
      procedure msavecompsettingsClick(Sender: TObject);
      procedure mtabsClick(Sender: TObject);
      procedure PanelClickAddressMouseEnter(Sender: TObject);
      procedure pcustmakecabClick(Sender: TObject);
      procedure pmhtabsClick(Sender: TObject);
      procedure pmmorerecoverClick(Sender: TObject);
      procedure pmmorerrClick(Sender: TObject);
      procedure pmpanalyzefoldersClick(Sender: TObject);
      procedure pmqeherenewClick(Sender: TObject);
      procedure pmqeheresmartClick(Sender: TObject);
      procedure pmrshClick(Sender: TObject);
      procedure pmr_123Click(Sender: TObject);
      procedure pmr_appenddirnameClick(Sender: TObject);
      procedure pmr_appendtsClick(Sender: TObject);
      procedure pmr_asciiClick(Sender: TObject);
      procedure pmr_cutClick(Sender: TObject);
      procedure pmr_prependdirnameClick(Sender: TObject);
      procedure pms2a_extClick(Sender: TObject);
      procedure pmstyle1Click(Sender: TObject);
      procedure pmstyle3Click(Sender: TObject);
      procedure pmstyle5Click(Sender: TObject);
      procedure pmtabClick(Sender: TObject);
      procedure pmtabsbookmarkaddClick(Sender: TObject);
      procedure pmtabsbookmarkorgClick(Sender: TObject);
      procedure pmtabscloseotherClick(Sender: TObject);
      procedure pmtabscloserightClick(Sender: TObject);
      procedure pmtabscollapseClick(Sender: TObject);
      procedure pmtabsexpandClick(Sender: TObject);
      procedure pmtabsmClick(Sender: TObject);
      procedure pmtestcontextallClick(Sender: TObject);
      procedure pmtestcontextdisplayedClick(Sender: TObject);
      procedure pmtestcontextselectedClick(Sender: TObject);
      procedure pmthemesClick(Sender: TObject);
      procedure pmtool1Click(Sender: TObject);
      procedure pmtool2Click(Sender: TObject);
      procedure pmtool3Click(Sender: TObject);
      procedure pob_blake2bClick(Sender: TObject);
      procedure pob_blake2sClick(Sender: TObject);
      procedure po_analyzefoldersClick(Sender: TObject);
      procedure po_hostnameClick(Sender: TObject);
      procedure po_ipconfigClick(Sender: TObject);
      procedure po_openfilesClick(Sender: TObject);
      procedure po_pdupClick(Sender: TObject);
      procedure po_quserClick(Sender: TObject);
      procedure po_qwinstaClick(Sender: TObject);
      procedure po_recoverClick(Sender: TObject);
      procedure po_rename_123Click(Sender: TObject);
      procedure po_rename_asciiClick(Sender: TObject);
      procedure po_rename_cutlenClick(Sender: TObject);
      procedure po_rename_filesonlyClick(Sender: TObject);
      procedure po_rrClick(Sender: TObject);
      procedure po_setappstClick(Sender: TObject);
      procedure po_showquicknavmenuClick(Sender: TObject);
      procedure po_smartClick(Sender: TObject);
      procedure po_synapticClick(Sender: TObject);
      procedure po_systeminfoClick(Sender: TObject);
      procedure po_tabsopenClick(Sender: TObject);
      procedure po_verClick(Sender: TObject);
      procedure po_whoamiClick(Sender: TObject);
      procedure po_windowopenClick(Sender: TObject);
      procedure po_xfcesmClick(Sender: TObject);
      procedure cbHashChange(Sender: TObject);
      procedure seRARrrChange(Sender: TObject);
      procedure ShellTreeViewNavMouseEnter(Sender: TObject);
      procedure SpinEditSplitChange(Sender: TObject);
      procedure splitsearchMoved(Sender: TObject);
      procedure StringGridSessionHistoryDblClick(Sender: TObject);
      procedure TabBarContextPopup(Sender: TObject; MousePos: TPoint;
        var Handled: Boolean);
      procedure TabBarMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure TabBarMouseEnter(Sender: TObject);
      procedure TabBarSectionClick(HeaderControl: TCustomHeaderControl;
        Section: THeaderSection);
      procedure TabBarSectionEndDrag(Sender: TObject);
      procedure ImageInfoCustomExtClick(Sender: TObject);
      procedure ImageAdArchive0Click(Sender: TObject);
      procedure ImageAdArchive0MouseEnter(Sender: TObject);
      procedure ImageAdArchive0MouseLeave(Sender: TObject);
      procedure ImageAdArchive1Click(Sender: TObject);
      procedure ImageAdArchive1MouseEnter(Sender: TObject);
      procedure ImageAdArchive1MouseLeave(Sender: TObject);
      procedure ImageAdArchive2Click(Sender: TObject);
      procedure ImageAdArchive2MouseEnter(Sender: TObject);
      procedure ImageAdArchive2MouseLeave(Sender: TObject);
      procedure ImageAdArchive3Click(Sender: TObject);
      procedure ImageAdArchive3MouseEnter(Sender: TObject);
      procedure ImageAdArchive3MouseLeave(Sender: TObject);
      procedure ImageAddress0Click(Sender: TObject);
      procedure ImageAddress0MouseEnter(Sender: TObject);
      procedure ImageAddress0MouseLeave(Sender: TObject);
      procedure ImageAddress1Click(Sender: TObject);
      procedure ImageAddress1MouseEnter(Sender: TObject);
      procedure ImageAddress1MouseLeave(Sender: TObject);
      procedure ImageAddress2Click(Sender: TObject);
      procedure ImageAddress2MouseEnter(Sender: TObject);
      procedure ImageAddress2MouseLeave(Sender: TObject);
      procedure ImageAddress3Click(Sender: TObject);
      procedure ImageAddress3MouseEnter(Sender: TObject);
      procedure ImageAddress3MouseLeave(Sender: TObject);
      procedure ImageAddress4Click(Sender: TObject);
      procedure ImageAddress4MouseEnter(Sender: TObject);
      procedure ImageAddress4MouseLeave(Sender: TObject);
      procedure ImageAddress5Click(Sender: TObject);
      procedure ImageAddress5MouseEnter(Sender: TObject);
      procedure ImageAddress5MouseLeave(Sender: TObject);
      procedure ImageAddress6Click(Sender: TObject);
      procedure ImageAddress6MouseEnter(Sender: TObject);
      procedure ImageAddress6MouseLeave(Sender: TObject);
      procedure ImageAddress7Click(Sender: TObject);
      procedure ImageAddress7MouseEnter(Sender: TObject);
      procedure ImageAddress7MouseLeave(Sender: TObject);
      procedure ImageAddressClick(Sender: TObject);
      procedure ImageInfoConsoleClick(Sender: TObject);
      procedure ImageInfoConsoleExtClick(Sender: TObject);
      procedure ImageInfoSchedAddClick(Sender: TObject);
      procedure ImageInfoSchedExtClick(Sender: TObject);
      procedure ImageInfoBinariesClick(Sender: TObject);
      procedure ImageInfoEncodingClick(Sender: TObject);
      procedure ImageListRootMouseEnter(Sender: TObject);
      procedure ImageListRootMouseLeave(Sender: TObject);
      procedure ImageListResetSearchClick(Sender: TObject);
      procedure ImageListResetSearchMouseEnter(Sender: TObject);
      procedure ImageListResetSearchMouseLeave(Sender: TObject);
      procedure ImageListSearchDblClick(Sender: TObject);
      procedure ImageListSearchMouseEnter(Sender: TObject);
      procedure ImageListSearchMouseLeave(Sender: TObject);
      procedure ImageExtractAdvfClick(Sender: TObject);
      procedure ImageAddAdvfClick(Sender: TObject);
      procedure ImageopenadvfClick(Sender: TObject);
      procedure BtnPasswordArchiveClick(Sender: TObject);
      procedure ButtonOptCancelClick(Sender: TObject);
      procedure ButtonArchiveOKClick(Sender: TObject);
      procedure ButtonEditNameCustomClick(Sender: TObject);
      procedure ButtonUn7zaTestClick(Sender: TObject);
      procedure ButtonUn7zaAddClick(Sender: TObject);
      procedure ButtonUn7zaToClick(Sender: TObject);
      procedure cbTypeChange(Sender: TObject);
      procedure ComboBox7zalgoChange(Sender: TObject);
      procedure ComboBoxArchiveCustom1Change(Sender: TObject);
      procedure ComboBoxArchiveCustomChange(Sender: TObject);
      procedure ComboBoxOverwriteARCChange(Sender: TObject);
      procedure ComboBoxOverwriteChange(Sender: TObject);
      procedure ComboBoxPassesChange(Sender: TObject);
      procedure BtnPasswordExtractClick(Sender: TObject);
      procedure LabelAppPathClick(Sender: TObject);
      procedure LabelOpenDesktopClick(Sender: TObject);
      procedure LabelResetOpenWithClick(Sender: TObject);
      procedure LabelClickAdArchive1Click(Sender: TObject);
      procedure LabelClickAdArchive1MouseEnter(Sender: TObject);
      procedure LabelClickAdArchive1MouseLeave(Sender: TObject);
      procedure LabelClickAdArchive2Click(Sender: TObject);
      procedure LabelClickAdArchive2MouseEnter(Sender: TObject);
      procedure LabelClickAdArchive2MouseLeave(Sender: TObject);
      procedure LabelClickAdArchive3Click(Sender: TObject);
      procedure LabelClickAdArchive3MouseEnter(Sender: TObject);
      procedure LabelClickAdArchive3MouseLeave(Sender: TObject);
      procedure LabelClickAdArchive4Click(Sender: TObject);
      procedure LabelClickAdArchive4MouseEnter(Sender: TObject);
      procedure LabelClickAdArchive4MouseLeave(Sender: TObject);
      procedure LabelClickAddress1Click(Sender: TObject);
      procedure LabelClickAddress1MouseEnter(Sender: TObject);
      procedure LabelClickAddress1MouseLeave(Sender: TObject);
      procedure LabelClickAddress2Click(Sender: TObject);
      procedure LabelClickAddress2MouseEnter(Sender: TObject);
      procedure LabelClickAddress2MouseLeave(Sender: TObject);
      procedure LabelClickAddress3Click(Sender: TObject);
      procedure LabelClickAddress3MouseEnter(Sender: TObject);
      procedure LabelClickAddress3MouseLeave(Sender: TObject);
      procedure LabelClickAddress4Click(Sender: TObject);
      procedure LabelClickAddress4MouseEnter(Sender: TObject);
      procedure LabelClickAddress4MouseLeave(Sender: TObject);
      procedure LabelClickAddress5Click(Sender: TObject);
      procedure LabelClickAddress5MouseEnter(Sender: TObject);
      procedure LabelClickAddress5MouseLeave(Sender: TObject);
      procedure LabelClickAddress6Click(Sender: TObject);
      procedure LabelClickAddress6MouseEnter(Sender: TObject);
      procedure LabelClickAddress6MouseLeave(Sender: TObject);
      procedure LabelClickAddress7Click(Sender: TObject);
      procedure LabelClickAddress7MouseEnter(Sender: TObject);
      procedure LabelClickAddress7MouseLeave(Sender: TObject);
      procedure LabelClickAddress8Click(Sender: TObject);
      procedure LabelClickAddress8MouseEnter(Sender: TObject);
      procedure LabelClickAddress8MouseLeave(Sender: TObject);
      procedure LabelOpenConfClick(Sender: TObject);
      procedure LabelConfigurePeaZipClick(Sender: TObject);
      procedure LabelConfigureSendToClick(Sender: TObject);
      procedure LabelLangClick(Sender: TObject);
      procedure LabelLang4Click(Sender: TObject);
      procedure LabelPanelHintAddMouseDown(Sender: TObject;
        Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      procedure LabelPanelHintExtractMouseDown(Sender: TObject;
        Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      procedure LabelResetAppClick(Sender: TObject);
      procedure LabelResetBookmarksClick(Sender: TObject);
      procedure LabelResetHistoryClick(Sender: TObject);
      procedure LabelResetPMClick(Sender: TObject);
      procedure LabelResetPtmpClick(Sender: TObject);
      procedure LabelGoExtractClick(Sender: TObject);
      procedure LabelTitleAdd1Click(Sender: TObject);
      procedure LabelTitleAdd1MouseEnter(Sender: TObject);
      procedure LabelTitleAdd1MouseLeave(Sender: TObject);
      procedure LabelTitleAdd2Click(Sender: TObject);
      procedure LabelTitleAdd2MouseEnter(Sender: TObject);
      procedure LabelTitleAdd2MouseLeave(Sender: TObject);
      procedure LabelTitleAdd3Click(Sender: TObject);
      procedure LabelTitleAdd3MouseEnter(Sender: TObject);
      procedure LabelTitleAdd3MouseLeave(Sender: TObject);
      procedure LabelTitleAdd4Click(Sender: TObject);
      procedure LabelTitleAdd4MouseEnter(Sender: TObject);
      procedure LabelTitleAdd4MouseLeave(Sender: TObject);
      procedure LabelTitleApps1Click(Sender: TObject);
      procedure LabelTitleApps1MouseEnter(Sender: TObject);
      procedure LabelTitleApps1MouseLeave(Sender: TObject);
      procedure LabelTitleApps2Click(Sender: TObject);
      procedure LabelTitleApps2MouseEnter(Sender: TObject);
      procedure LabelTitleApps2MouseLeave(Sender: TObject);
      procedure LabelTitleExtract1Click(Sender: TObject);
      procedure LabelTitleExtract1MouseEnter(Sender: TObject);
      procedure LabelTitleExtract1MouseLeave(Sender: TObject);
      procedure LabelTitleExtract2Click(Sender: TObject);
      procedure LabelTitleExtract2MouseEnter(Sender: TObject);
      procedure LabelTitleExtract2MouseLeave(Sender: TObject);
      procedure LabelTitleExtract3Click(Sender: TObject);
      procedure LabelTitleExtract3MouseEnter(Sender: TObject);
      procedure LabelTitleExtract3MouseLeave(Sender: TObject);
      procedure LabelTitleExtract4Click(Sender: TObject);
      procedure LabelTitleExtract4MouseEnter(Sender: TObject);
      procedure LabelTitleExtract4MouseLeave(Sender: TObject);
      procedure LabelTitleOptions1Click(Sender: TObject);
      procedure LabelTitleOptions1MouseEnter(Sender: TObject);
      procedure LabelTitleOptions1MouseLeave(Sender: TObject);
      procedure LabelTitleOptions3Click(Sender: TObject);
      procedure LabelTitleOptions3MouseEnter(Sender: TObject);
      procedure LabelTitleOptions3MouseLeave(Sender: TObject);
      procedure LabelTitleOptions4Click(Sender: TObject);
      procedure LabelTitleOptions4MouseEnter(Sender: TObject);
      procedure LabelTitleOptions4MouseLeave(Sender: TObject);
      procedure LabelTitleOptions5Click(Sender: TObject);
      procedure LabelTitleOptions5MouseEnter(Sender: TObject);
      procedure LabelTitleOptions5MouseLeave(Sender: TObject);
      procedure LabelTitleOptions6Click(Sender: TObject);
      procedure LabelTitleOptions6MouseEnter(Sender: TObject);
      procedure LabelTitleOptions6MouseLeave(Sender: TObject);
      procedure LabelTitleOptions7Click(Sender: TObject);
      procedure LabelTitleOptions7MouseEnter(Sender: TObject);
      procedure LabelTitleOptions7MouseLeave(Sender: TObject);
      procedure LabelTitleOptions8Click(Sender: TObject);
      procedure LabelTitleOptions8MouseEnter(Sender: TObject);
      procedure LabelTitleOptions8MouseLeave(Sender: TObject);
      procedure ListViewBrowserClick(Sender: TObject);
      procedure ListViewBrowserColumnClick(Sender: TObject; Column: TListColumn);
      procedure ListViewBrowserDblClick(Sender: TObject);
      procedure ListViewBrowserDragOver(Sender, Source: TObject; X, Y: Integer;
        State: TDragState; var Accept: Boolean);
      procedure ListViewBrowserKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure ListViewBrowserKeyPress(Sender: TObject; var Key: char);
      procedure ListViewBrowserKeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure ListViewBrowserMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ListViewBrowserMouseEnter(Sender: TObject);
      procedure ListViewBrowserMouseLeave(Sender: TObject);
      procedure ListViewBrowserMouseMove(Sender: TObject; Shift: TShiftState; X,
        Y: Integer);
      procedure ListViewBrowserSelectItem(Sender: TObject; Item: TListItem;
        Selected: Boolean);
      procedure ListViewBrowserStartDrag(Sender: TObject; var DragObject: TDragObject
        );
      procedure Lmanageschedule1Click(Sender: TObject);
      procedure Lmanageschedule2Click(Sender: TObject);
      procedure mAboutClick(Sender: TObject);
      procedure pmtabsnewClick(Sender: TObject);
      procedure pmtabscloseClick(Sender: TObject);
      procedure maddconvertClick(Sender: TObject);
      procedure maddexistingClick(Sender: TObject);
      procedure mlayoutsClick(Sender: TObject);
      procedure msamehourClick(Sender: TObject);
      procedure mCharCaseClick(Sender: TObject);
      procedure mCharClick(Sender: TObject);
      procedure mDateDayClick(Sender: TObject);
      procedure mDateHourClick(Sender: TObject);
      procedure mDateWeekClick(Sender: TObject);
      procedure mDateYearClick(Sender: TObject);
      procedure mpacked100kClick(Sender: TObject);
      procedure mpacked100mClick(Sender: TObject);
      procedure mpacked10mClick(Sender: TObject);
      procedure mpackedemptyClick(Sender: TObject);
      procedure mpackedoverClick(Sender: TObject);
      procedure mpackedsimilar50Click(Sender: TObject);
      procedure mpackedsimilarClick(Sender: TObject);
      procedure mpluginsClick(Sender: TObject);
      procedure mb0Click(Sender: TObject);
      procedure mb10Click(Sender: TObject);
      procedure mb11Click(Sender: TObject);
      procedure mb12Click(Sender: TObject);
      procedure mb13Click(Sender: TObject);
      procedure mb14Click(Sender: TObject);
      procedure mb15Click(Sender: TObject);
      procedure mb16Click(Sender: TObject);
      procedure mb17Click(Sender: TObject);
      procedure mb18Click(Sender: TObject);
      procedure mb19Click(Sender: TObject);
      procedure mb1Click(Sender: TObject);
      procedure mb20Click(Sender: TObject);
      procedure mb21Click(Sender: TObject);
      procedure mb22Click(Sender: TObject);
      procedure mb23Click(Sender: TObject);
      procedure mb24Click(Sender: TObject);
      procedure mb2Click(Sender: TObject);
      procedure mb3Click(Sender: TObject);
      procedure mb4Click(Sender: TObject);
      procedure mb5Click(Sender: TObject);
      procedure mb6Click(Sender: TObject);
      procedure mb7Click(Sender: TObject);
      procedure mb8Click(Sender: TObject);
      procedure mb9Click(Sender: TObject);
      procedure mbAddArchiveClick(Sender: TObject);
      procedure mbAddPathClick(Sender: TObject);
      procedure mbc1Click(Sender: TObject);
      procedure mbc2Click(Sender: TObject);
      procedure mbc3Click(Sender: TObject);
      procedure mbc4Click(Sender: TObject);
      procedure mbc5Click(Sender: TObject);
      procedure mbc6Click(Sender: TObject);
      procedure mbc7Click(Sender: TObject);
      procedure mbc8Click(Sender: TObject);
      procedure mbclClick(Sender: TObject);
      procedure mbDeleteClick(Sender: TObject);
      procedure mbexploreClick(Sender: TObject);
      procedure mbNotesClick(Sender: TObject);
      procedure mbpeaClick(Sender: TObject);
      procedure mbresetClick(Sender: TObject);
      procedure mcattClick(Sender: TObject);
      procedure mccrcClick(Sender: TObject);
      procedure mcdateClick(Sender: TObject);
      procedure mcfreeClick(Sender: TObject);
      procedure mcfsClick(Sender: TObject);
      procedure mcpackedClick(Sender: TObject);
      procedure mcpClick(Sender: TObject);
      procedure mcsizeClick(Sender: TObject);
      procedure mdefaultarchiveClick(Sender: TObject);
      procedure mctypeClick(Sender: TObject);
      procedure mPeaSiteMirrorClick(Sender: TObject);
      procedure MenuItemArchive_dropboxClick(Sender: TObject);
      procedure MenuItemArchive_googledriveClick(Sender: TObject);
      procedure MenuItemArchive_musicClick(Sender: TObject);
      procedure MenuItemArchive_picturesClick(Sender: TObject);
      procedure MenuItemArchive_onedriveClick(Sender: TObject);
      procedure MenuItemArchive_shpClick(Sender: TObject);
      procedure MenuItemArchive_yClick(Sender: TObject);
      procedure MenuItemArchive_videosClick(Sender: TObject);
      procedure MenuItemEnumerateClick(Sender: TObject);
      procedure MenuItemOpen_dropboxClick(Sender: TObject);
      procedure MenuItemOpen_googledriveClick(Sender: TObject);
      procedure MenuItemOpen_musicClick(Sender: TObject);
      procedure MenuItemOpen_organizebookmarksClick(Sender: TObject);
      procedure MenuItemOpen_picturesClick(Sender: TObject);
      procedure MenuItemOpen_powershellClick(Sender: TObject);
      procedure MenuItemOpen_onedriveClick(Sender: TObject);
      procedure MenuItemOpen_shpClick(Sender: TObject);
      procedure MenuItemOpen_yClick(Sender: TObject);
      procedure MenuItemOpen_videosClick(Sender: TObject);
      procedure MenuItemPowerShellClick(Sender: TObject);
      procedure mpeautilsClick(Sender: TObject);
      procedure mprofileautoClick(Sender: TObject);
      procedure mprofileencrypt7zClick(Sender: TObject);
      procedure mprofilefastzipClick(Sender: TObject);
      procedure mprofilenormal7zClick(Sender: TObject);
      procedure mprofilenormalzipClick(Sender: TObject);
      procedure mprofilesplitzipClick(Sender: TObject);
      procedure mprofileultra7zClick(Sender: TObject);
      procedure mRecent1fClick(Sender: TObject);
      procedure mRecent2fClick(Sender: TObject);
      procedure mRecent3fClick(Sender: TObject);
      procedure mRecent4fClick(Sender: TObject);
      procedure mRecent5fClick(Sender: TObject);
      procedure mRecent6fClick(Sender: TObject);
      procedure mRecent7fClick(Sender: TObject);
      procedure mRecent8fClick(Sender: TObject);
      procedure msamedayClick(Sender: TObject);
      procedure msamemonthClick(Sender: TObject);
      procedure msameweekClick(Sender: TObject);
      procedure msameyearClick(Sender: TObject);
      procedure mscheduledscriptsClick(Sender: TObject);
      procedure mselectadvClick(Sender: TObject);
      procedure msize0Click(Sender: TObject);
      procedure msize100kClick(Sender: TObject);
      procedure msize100mClick(Sender: TObject);
      procedure msize10mClick(Sender: TObject);
      procedure msizeoverClick(Sender: TObject);
      procedure msizesimilar50Click(Sender: TObject);
      procedure msizesimilarClick(Sender: TObject);
      procedure mtaskschedulerClick(Sender: TObject);
      procedure mwebsClick(Sender: TObject);
      procedure mDateMonthClick(Sender: TObject);
      procedure PanelHintAddMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure PanelHintExtractMouseDown(Sender: TObject;
        Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      procedure PanelInfoGeneralClick(Sender: TObject);
      procedure pmamr1Click(Sender: TObject);
      procedure pmamr2Click(Sender: TObject);
      procedure pmamr3Click(Sender: TObject);
      procedure pmamr4Click(Sender: TObject);
      procedure pmamr5Click(Sender: TObject);
      procedure pmamr6Click(Sender: TObject);
      procedure pmamr7Click(Sender: TObject);
      procedure pmamr8Click(Sender: TObject);
      procedure pmabc0Click(Sender: TObject);
      procedure pmbcaddbookmarkClick(Sender: TObject);
      procedure pmbcd0Click(Sender: TObject);
      procedure pmbcd10Click(Sender: TObject);
      procedure pmbcd11Click(Sender: TObject);
      procedure pmbcd12Click(Sender: TObject);
      procedure pmbcd13Click(Sender: TObject);
      procedure pmbcd14Click(Sender: TObject);
      procedure pmbcd15Click(Sender: TObject);
      procedure pmbcd16Click(Sender: TObject);
      procedure pmbcd17Click(Sender: TObject);
      procedure pmbcd18Click(Sender: TObject);
      procedure pmbcd19Click(Sender: TObject);
      procedure pmbcd1Click(Sender: TObject);
      procedure pmbcd2Click(Sender: TObject);
      procedure pmbcd3Click(Sender: TObject);
      procedure pmbcd4Click(Sender: TObject);
      procedure pmbcd5Click(Sender: TObject);
      procedure pmbcd6Click(Sender: TObject);
      procedure pmbcd7Click(Sender: TObject);
      procedure pmbcd8Click(Sender: TObject);
      procedure pmbcd9Click(Sender: TObject);
      procedure pmbcexpandClick(Sender: TObject);
      procedure pmbcorganizebookmarksClick(Sender: TObject);
      procedure pmCopyPathClick(Sender: TObject);
      procedure pmcpypathClick(Sender: TObject);
      procedure pmCustEditAdd1Click(Sender: TObject);
      procedure pmCustEditAddClick(Sender: TObject);
      procedure pmCustEditDesc1Click(Sender: TObject);
      procedure pmCustEditDescClick(Sender: TObject);
      procedure pmCustEditEdit1afterClick(Sender: TObject);
      procedure pmCustEditEdit1Click(Sender: TObject);
      procedure pmCustEditEditClick(Sender: TObject);
      procedure pmCustEditRemove1Click(Sender: TObject);
      procedure pmCustEditRemoveClick(Sender: TObject);
      procedure pmcutClick(Sender: TObject);
      procedure pmemb1Click(Sender: TObject);
      procedure pmemb2Click(Sender: TObject);
      procedure pmemb3Click(Sender: TObject);
      procedure pmemb4Click(Sender: TObject);
      procedure pmemb5Click(Sender: TObject);
      procedure pmemb6Click(Sender: TObject);
      procedure pmemb7Click(Sender: TObject);
      procedure pmemb8Click(Sender: TObject);
      procedure pmemr1Click(Sender: TObject);
      procedure pmemr2Click(Sender: TObject);
      procedure pmemr3Click(Sender: TObject);
      procedure pmemr4Click(Sender: TObject);
      procedure pmemr5Click(Sender: TObject);
      procedure pmemr6Click(Sender: TObject);
      procedure pmemr7Click(Sender: TObject);
      procedure pmemr8Click(Sender: TObject);
      procedure pmflatClick(Sender: TObject);
      procedure pmfun10Click(Sender: TObject);
      procedure pmfun11Click(Sender: TObject);
      procedure pmfun12Click(Sender: TObject);
      procedure pmfun13Click(Sender: TObject);
      procedure pmfun14Click(Sender: TObject);
      procedure pmfun15Click(Sender: TObject);
      procedure pmfun16Click(Sender: TObject);
      procedure pmfun17Click(Sender: TObject);
      procedure pmfun18Click(Sender: TObject);
      procedure pmfun1Click(Sender: TObject);
      procedure pmfun2Click(Sender: TObject);
      procedure pmfun3Click(Sender: TObject);
      procedure pmfun4Click(Sender: TObject);
      procedure pmfun5Click(Sender: TObject);
      procedure pmfun6Click(Sender: TObject);
      procedure pmfun7Click(Sender: TObject);
      procedure pmfun8Click(Sender: TObject);
      procedure pmfun9Click(Sender: TObject);
      procedure pmhr1fClick(Sender: TObject);
      procedure pmhr2fClick(Sender: TObject);
      procedure pmhr3fClick(Sender: TObject);
      procedure pmhr4fClick(Sender: TObject);
      procedure pmhr5fClick(Sender: TObject);
      procedure pmhr6fClick(Sender: TObject);
      procedure pmhr7fClick(Sender: TObject);
      procedure pmhr8fClick(Sender: TObject);
      procedure pmif1Click(Sender: TObject);
      procedure pmif2Click(Sender: TObject);
      procedure pmif3Click(Sender: TObject);
      procedure pmif4Click(Sender: TObject);
      procedure pmif5Click(Sender: TObject);
      procedure pmif6Click(Sender: TObject);
      procedure pmif7Click(Sender: TObject);
      procedure pmif8Click(Sender: TObject);
      procedure pmir180Click(Sender: TObject);
      procedure pmiresize125Click(Sender: TObject);
      procedure pmiresize150Click(Sender: TObject);
      procedure pmiresize200Click(Sender: TObject);
      procedure pmiresize25Click(Sender: TObject);
      procedure pmiresize300Click(Sender: TObject);
      procedure pmiresize33Click(Sender: TObject);
      procedure pmiresize400Click(Sender: TObject);
      procedure pmiresize50Click(Sender: TObject);
      procedure pmiresize75Click(Sender: TObject);
      procedure pmirflipClick(Sender: TObject);
      procedure pmpdupClick(Sender: TObject);
      procedure pmirmirrorClick(Sender: TObject);
      procedure pmisBMPClick(Sender: TObject);
      procedure pmisJPEG50Click(Sender: TObject);
      procedure pmisJPEG75Click(Sender: TObject);
      procedure pmisJPEGClick(Sender: TObject);
      procedure pmisPNGClick(Sender: TObject);
      procedure pmisTIFFClick(Sender: TObject);
      procedure pmjd10Click(Sender: TObject);
      procedure pmjd11Click(Sender: TObject);
      procedure pmjd12Click(Sender: TObject);
      procedure pmjd13Click(Sender: TObject);
      procedure pmjd14Click(Sender: TObject);
      procedure pmjd15Click(Sender: TObject);
      procedure pmjd16Click(Sender: TObject);
      procedure pmjd17Click(Sender: TObject);
      procedure pmjd18Click(Sender: TObject);
      procedure pmjd19Click(Sender: TObject);
      procedure pmjd1Click(Sender: TObject);
      procedure pmjd20Click(Sender: TObject);
      procedure pmjd21Click(Sender: TObject);
      procedure pmjd22Click(Sender: TObject);
      procedure pmjd23Click(Sender: TObject);
      procedure pmjd24Click(Sender: TObject);
      procedure pmjd25Click(Sender: TObject);
      procedure pmjd26Click(Sender: TObject);
      procedure pmjd2Click(Sender: TObject);
      procedure pmjd3Click(Sender: TObject);
      procedure pmjd4Click(Sender: TObject);
      procedure pmjd5Click(Sender: TObject);
      procedure pmjd6Click(Sender: TObject);
      procedure pmjd7Click(Sender: TObject);
      procedure pmjd8Click(Sender: TObject);
      procedure pmjd9Click(Sender: TObject);
      procedure pmjumpmusicClick(Sender: TObject);
      procedure pmjumppicturesClick(Sender: TObject);
      procedure pmjumpusersClick(Sender: TObject);
      procedure pmjumpvideosClick(Sender: TObject);
      procedure pmmore1Click(Sender: TObject);
      procedure pmmore2Click(Sender: TObject);
      procedure pmmore3Click(Sender: TObject);
      procedure pmmore4Click(Sender: TObject);
      procedure pmmore5Click(Sender: TObject);
      procedure pmmore6Click(Sender: TObject);
      procedure pmmore7Click(Sender: TObject);
      procedure pmmore8Click(Sender: TObject);
      procedure pmmoreanalysisClick(Sender: TObject);
      procedure pmmorefun_detailsClick(Sender: TObject);
      procedure pmmorefun_propertiesClick(Sender: TObject);
      procedure pmmorecheckClick(Sender: TObject);
      procedure pmmorehexClick(Sender: TObject);
      procedure pmmstatus_bookmarksClick(Sender: TObject);
      procedure pmmstatus_clipboardClick(Sender: TObject);
      procedure pmmstatus_raClick(Sender: TObject);
      procedure pmmstatus_rClick(Sender: TObject);
      procedure pmmstatus_statusClick(Sender: TObject);
      procedure pmorganizebookmarksClick(Sender: TObject);
      procedure pmpowershellClick(Sender: TObject);
      procedure pmqjdropboxClick(Sender: TObject);
      procedure pmqjgoogledriveClick(Sender: TObject);
      procedure pmqjonedriveClick(Sender: TObject);
      procedure pmqjshpClick(Sender: TObject);
      procedure pmqjyClick(Sender: TObject);
      procedure pmqnointdirClick(Sender: TObject);
      procedure pmquickdeskClick(Sender: TObject);
      procedure pmquickhomeClick(Sender: TObject);
      procedure pmquickoaClick(Sender: TObject);
      procedure pmquickopClick(Sender: TObject);
      procedure pmquicksdClick(Sender: TObject);
      procedure pmrecycleClick(Sender: TObject);
      procedure pmrenameClick(Sender: TObject);
      procedure pmrsearchClick(Sender: TObject);
      procedure pmrselectClick(Sender: TObject);
      procedure pmr_addClick(Sender: TObject);
      procedure pmr_deleteClick(Sender: TObject);
      procedure pmr_extClick(Sender: TObject);
      procedure pmr_lowercaseClick(Sender: TObject);
      procedure pmr_replacecaseClick(Sender: TObject);
      procedure pmr_replaceClick(Sender: TObject);
      procedure pmr_uppercaseClick(Sender: TObject);
      procedure pmsearchdragClick(Sender: TObject);
      procedure pmsearchwebClick(Sender: TObject);
      procedure pmsecuredeletefreeClick(Sender: TObject);
      procedure pmselectadvClick(Sender: TObject);
      procedure pmtypeswapClick(Sender: TObject);
      procedure pmwsClick(Sender: TObject);
      procedure MenuItemOrganizeNavbarClick(Sender: TObject);
      procedure MenuItemOrganizeStatusbarClick(Sender: TObject);
      procedure MenuItemOrganizeToolbarClick(Sender: TObject);
      procedure MenuItemPropertiesClick(Sender: TObject);
      procedure mJobClick(Sender: TObject);
      procedure mPropertiesClick(Sender: TObject);
      procedure mrecsearchClick(Sender: TObject);
      procedure mscriptsClick(Sender: TObject);
      procedure msimplesearchClick(Sender: TObject);
      procedure mupdateClick(Sender: TObject);
      procedure owcustom10tClick(Sender: TObject);
      procedure owcustom11tClick(Sender: TObject);
      procedure owcustom12tClick(Sender: TObject);
      procedure owcustom13tClick(Sender: TObject);
      procedure owcustom14tClick(Sender: TObject);
      procedure owcustom15tClick(Sender: TObject);
      procedure owcustom16tClick(Sender: TObject);
      procedure owcustom1tClick(Sender: TObject);
      procedure owcustom2tClick(Sender: TObject);
      procedure owcustom3tClick(Sender: TObject);
      procedure owcustom4tClick(Sender: TObject);
      procedure owcustom5tClick(Sender: TObject);
      procedure owcustom6tClick(Sender: TObject);
      procedure owcustom7tClick(Sender: TObject);
      procedure owcustom8tClick(Sender: TObject);
      procedure owcustom9tClick(Sender: TObject);
      procedure owcustom_10Click(Sender: TObject);
      procedure owcustom_10tClick(Sender: TObject);
      procedure owcustom_11Click(Sender: TObject);
      procedure owcustom_11tClick(Sender: TObject);
      procedure owcustom_12Click(Sender: TObject);
      procedure owcustom_12tClick(Sender: TObject);
      procedure owcustom_13Click(Sender: TObject);
      procedure owcustom_13tClick(Sender: TObject);
      procedure owcustom_14Click(Sender: TObject);
      procedure owcustom_14tClick(Sender: TObject);
      procedure owcustom_15Click(Sender: TObject);
      procedure owcustom_15tClick(Sender: TObject);
      procedure owcustom_16Click(Sender: TObject);
      procedure owcustom_16tClick(Sender: TObject);
      procedure owcustom_9Click(Sender: TObject);
      procedure owcustom_9tClick(Sender: TObject);

      procedure pmcheckClick(Sender: TObject);
      procedure pmnewfolderClick(Sender: TObject);
      procedure pmpropertiesClick(Sender: TObject);
      procedure pmsrecClick(Sender: TObject);
      procedure pmzerofileClick(Sender: TObject);
      procedure pmzerofreeClick(Sender: TObject);
      procedure pnabc1Click(Sender: TObject);
      procedure pnabc2Click(Sender: TObject);
      procedure pnabc3Click(Sender: TObject);
      procedure pnabc4Click(Sender: TObject);
      procedure pnabc5Click(Sender: TObject);
      procedure pnabc6Click(Sender: TObject);
      procedure pnabc7Click(Sender: TObject);
      procedure pnabc8Click(Sender: TObject);
      procedure pnbc1Click(Sender: TObject);
      procedure pnbc2Click(Sender: TObject);
      procedure pnbc3Click(Sender: TObject);
      procedure pnbc4Click(Sender: TObject);
      procedure pnbc5Click(Sender: TObject);
      procedure pnbc6Click(Sender: TObject);
      procedure pnbc7Click(Sender: TObject);
      procedure pnbc8Click(Sender: TObject);
      procedure pob_adlerClick(Sender: TObject);
      procedure pob_crc16Click(Sender: TObject);
      procedure pob_crc24Click(Sender: TObject);
      procedure pob_crc32Click(Sender: TObject);
      procedure pob_crc64Click(Sender: TObject);
      procedure pob_edonkeyClick(Sender: TObject);
      procedure pob_md4Click(Sender: TObject);
      procedure pob_md5Click(Sender: TObject);
      procedure pob_ripemdClick(Sender: TObject);
      procedure pob_sha1Click(Sender: TObject);
      procedure pob_sha256Click(Sender: TObject);
      procedure pob_sha3256Click(Sender: TObject);
      procedure pob_sha3512Click(Sender: TObject);
      procedure pob_sha512Click(Sender: TObject);
      procedure pob_whirlpoolClick(Sender: TObject);
      procedure powcustom_10Click(Sender: TObject);
      procedure powcustom_11Click(Sender: TObject);
      procedure powcustom_12Click(Sender: TObject);
      procedure powcustom_13Click(Sender: TObject);
      procedure powcustom_14Click(Sender: TObject);
      procedure powcustom_15Click(Sender: TObject);
      procedure powcustom_16Click(Sender: TObject);
      procedure powcustom_9Click(Sender: TObject);
      procedure po_alltasksClick(Sender: TObject);
      procedure po_analyzeClick(Sender: TObject);
      procedure po_checksumClick(Sender: TObject);
      procedure po_copypathClick(Sender: TObject);
      procedure mthumbimagesClick(Sender: TObject);
      procedure mtoggleopClick(Sender: TObject);
      procedure MenuItemDonationsClick(Sender: TObject);
      procedure MenuItemArchive_downloadsClick(Sender: TObject);
      procedure MenuItemExtAllHereClick(Sender: TObject);
      procedure MenuItemExtAllToClick(Sender: TObject);
      procedure MenuItemOpenWebClick(Sender: TObject);
      procedure MenuItemOpen_downloads1Click(Sender: TObject);
      procedure MenuItemArchive_pubdocClick(Sender: TObject);
      procedure MenuItemArchive_pubhomeClick(Sender: TObject);
      procedure MenuItemOpen_pubdocClick(Sender: TObject);
      procedure MenuItemOpen_pubhomeClick(Sender: TObject);
      procedure mhclClick(Sender: TObject);
      procedure mhexploreClick(Sender: TObject);
      procedure mhistory1Click(Sender: TObject);
      procedure mhistory2Click(Sender: TObject);
      procedure mhistory3Click(Sender: TObject);
      procedure mhistory4Click(Sender: TObject);
      procedure mhistory5Click(Sender: TObject);
      procedure mhistory6Click(Sender: TObject);
      procedure mhistory7Click(Sender: TObject);
      procedure mhistory8Click(Sender: TObject);
      procedure mhpeaClick(Sender: TObject);
      procedure mopenasarchiveClick(Sender: TObject);
      procedure mgobrowserClick(Sender: TObject);
      procedure MenuItemArchive_documents1Click(Sender: TObject);
      procedure MenuItemArchive_home1Click(Sender: TObject);
      procedure MenuItemextexploreClick(Sender: TObject);
      procedure MenuItemOpen_LastClick(Sender: TObject);
      procedure mgoextlayoutClick(Sender: TObject);
      procedure mLangClick(Sender: TObject);
      procedure mpathdesk1Click(Sender: TObject);
      procedure mpathexplore1Click(Sender: TObject);
      procedure mpathreset1Click(Sender: TObject);
      procedure mpathself1Click(Sender: TObject);
      procedure mPeaTrackerClick(Sender: TObject);
      procedure mr9Click(Sender: TObject);
      procedure mrowselectClick(Sender: TObject);
      procedure MenuItemHistoryBookClick(Sender: TObject);
      procedure MenuItemNavigateClick(Sender: TObject);
      procedure MenuItemOpen_desktop1Click(Sender: TObject);
      procedure MenuItemOpen_documents1Click(Sender: TObject);
      procedure MenuItemOpen_hereClick(Sender: TObject);
      procedure MenuItemOpen_home1Click(Sender: TObject);
      procedure MenuItemPWClick(Sender: TObject);
      procedure MenuItemToolhexpClick(Sender: TObject);
      procedure mEnvstrClick(Sender: TObject);
      procedure MenuItemBookmarksClick(Sender: TObject);
      procedure MenuItemOpen_addtobookmarksClick(Sender: TObject);
      procedure MenuItemOpen_commandpromptClick(Sender: TObject);
      procedure mRecent9Click(Sender: TObject);
      procedure mswapbarsClick(Sender: TObject);
      procedure mSystemIntegrationClick(Sender: TObject);
      procedure mthlClick(Sender: TObject);
      procedure mTrayClick(Sender: TObject);
      procedure owcustom10Click(Sender: TObject);
      procedure owcustom11Click(Sender: TObject);
      procedure owcustom12Click(Sender: TObject);
      procedure owcustom13Click(Sender: TObject);
      procedure owcustom14Click(Sender: TObject);
      procedure owcustom15Click(Sender: TObject);
      procedure owcustom16Click(Sender: TObject);
      procedure owcustom1Click(Sender: TObject);
      procedure owcustom2Click(Sender: TObject);
      procedure owcustom3Click(Sender: TObject);
      procedure owcustom4Click(Sender: TObject);
      procedure owcustom5Click(Sender: TObject);
      procedure owcustom6Click(Sender: TObject);
      procedure owcustom7Click(Sender: TObject);
      procedure owcustom8Click(Sender: TObject);
      procedure owcustom9Click(Sender: TObject);
      procedure pajdn10Click(Sender: TObject);
      procedure pajdn11Click(Sender: TObject);
      procedure pajdn12Click(Sender: TObject);
      procedure pajdn13Click(Sender: TObject);
      procedure pajdn14Click(Sender: TObject);
      procedure pajdn15Click(Sender: TObject);
      procedure pajdn16Click(Sender: TObject);
      procedure pajdn17Click(Sender: TObject);
      procedure pajdn18Click(Sender: TObject);
      procedure pajdn19Click(Sender: TObject);
      procedure pajdn1Click(Sender: TObject);
      procedure pajdn20Click(Sender: TObject);
      procedure pajdn21Click(Sender: TObject);
      procedure pajdn22Click(Sender: TObject);
      procedure pajdn23Click(Sender: TObject);
      procedure pajdn24Click(Sender: TObject);
      procedure pajdn25Click(Sender: TObject);
      procedure pajdn26Click(Sender: TObject);
      procedure pajdn2Click(Sender: TObject);
      procedure pajdn3Click(Sender: TObject);
      procedure pajdn4Click(Sender: TObject);
      procedure pajdn5Click(Sender: TObject);
      procedure pajdn6Click(Sender: TObject);
      procedure pajdn7Click(Sender: TObject);
      procedure pajdn8Click(Sender: TObject);
      procedure pajdn9Click(Sender: TObject);
      procedure PanelClickAddressClick(Sender: TObject);
      procedure pclip_clearclipClick(Sender: TObject);
      procedure pclip_removeitemClick(Sender: TObject);
      procedure pcustompathexploreClick(Sender: TObject);
      procedure pma2s_copyClick(Sender: TObject);
      procedure pma2s_extallnew1Click(Sender: TObject);
      procedure pma2s_extnew1Click(Sender: TObject);
      procedure pma2s_extnewClick(Sender: TObject);
      procedure pma2s_extract1Click(Sender: TObject);
      procedure pma2s_extractall1Click(Sender: TObject);
      procedure pma2s_extractClick(Sender: TObject);
      procedure pma2s_moveClick(Sender: TObject);
      procedure pmbc1Click(Sender: TObject);
      procedure pmbc2Click(Sender: TObject);
      procedure pmbc3Click(Sender: TObject);
      procedure pmbc4Click(Sender: TObject);
      procedure pmbc5Click(Sender: TObject);
      procedure pmbc6Click(Sender: TObject);
      procedure pmbc7Click(Sender: TObject);
      procedure pmbc8Click(Sender: TObject);
      procedure pmbookmarksClick(Sender: TObject);
      procedure pmBrowserClick(Sender: TObject);
      procedure pmcommandClick(Sender: TObject);
      procedure pmcpytoClick(Sender: TObject);
      procedure pmexploreClick(Sender: TObject);
      procedure pmextcontextallClick(Sender: TObject);
      procedure pmextcontextdisplayedClick(Sender: TObject);
      procedure pmextcontextselectedClick(Sender: TObject);
      procedure pmh9Click(Sender: TObject);
      procedure pmhr1Click(Sender: TObject);
      procedure pmhr2Click(Sender: TObject);
      procedure pmhr3Click(Sender: TObject);
      procedure pmhr4Click(Sender: TObject);
      procedure pmhr5Click(Sender: TObject);
      procedure pmhr6Click(Sender: TObject);
      procedure pmhr7Click(Sender: TObject);
      procedure pmhr8Click(Sender: TObject);
      procedure pmhr9Click(Sender: TObject);
      procedure pmiresetClick(Sender: TObject);
      procedure pmjb10Click(Sender: TObject);
      procedure pmjb11Click(Sender: TObject);
      procedure pmjb12Click(Sender: TObject);
      procedure pmjb13Click(Sender: TObject);
      procedure pmjb14Click(Sender: TObject);
      procedure pmjb15Click(Sender: TObject);
      procedure pmjb16Click(Sender: TObject);
      procedure pmjb17Click(Sender: TObject);
      procedure pmjb18Click(Sender: TObject);
      procedure pmjb19Click(Sender: TObject);
      procedure pmjb1Click(Sender: TObject);
      procedure pmjb20Click(Sender: TObject);
      procedure pmjb21Click(Sender: TObject);
      procedure pmjb22Click(Sender: TObject);
      procedure pmjb23Click(Sender: TObject);
      procedure pmjb24Click(Sender: TObject);
      procedure pmjb2Click(Sender: TObject);
      procedure pmjb3Click(Sender: TObject);
      procedure pmjb4Click(Sender: TObject);
      procedure pmjb5Click(Sender: TObject);
      procedure pmjb6Click(Sender: TObject);
      procedure pmjb7Click(Sender: TObject);
      procedure pmjb8Click(Sender: TObject);
      procedure pmjb9Click(Sender: TObject);
      procedure pmJump3Click(Sender: TObject);
      procedure pmJumpDocumentsClick(Sender: TObject);
      procedure pmjumpdownloadsClick(Sender: TObject);
      procedure pmjumppubdocClick(Sender: TObject);
      procedure pmjumppubhomeClick(Sender: TObject);
      procedure pmmorefun_infoClick(Sender: TObject);
      procedure pmmorefun_listClick(Sender: TObject);
      procedure pmmvtoClick(Sender: TObject);
      procedure pmopenoutClick(Sender: TObject);
      procedure pmqe1favClick(Sender: TObject);
      procedure pmqe2favClick(Sender: TObject);
      procedure pmqe3favClick(Sender: TObject);
      procedure pmqedefaultClick(Sender: TObject);
      procedure pmqedeskClick(Sender: TObject);
      procedure pmqedocumentsClick(Sender: TObject);
      procedure pmqehereClick(Sender: TObject);
      procedure pmqelastClick(Sender: TObject);
      procedure pmqen1Click(Sender: TObject);
      procedure pmqen2Click(Sender: TObject);
      procedure pmqen3Click(Sender: TObject);
      procedure pmqen4Click(Sender: TObject);
      procedure pmqen5Click(Sender: TObject);
      procedure pmqenewfolderClick(Sender: TObject);
      procedure pmqenopathClick(Sender: TObject);
      procedure pmqesetpwClick(Sender: TObject);
      procedure pmqetoClick(Sender: TObject);
      procedure pmquickdeleteClick(Sender: TObject);
      procedure pms2a_addClick(Sender: TObject);
      procedure pms2a_copyClick(Sender: TObject);
      procedure pms2a_moveClick(Sender: TObject);
      procedure pms2a_openClick(Sender: TObject);
      procedure pmsecuredeleteClick(Sender: TObject);
      procedure pmshist1Click(Sender: TObject);
      procedure pmshist2Click(Sender: TObject);
      procedure pmshist3Click(Sender: TObject);
      procedure pmshist4Click(Sender: TObject);
      procedure pmshist5Click(Sender: TObject);
      procedure pmshist6Click(Sender: TObject);
      procedure pmshist7Click(Sender: TObject);
      procedure pmshist8Click(Sender: TObject);
      procedure pmusedefaultClick(Sender: TObject);
      procedure pnb10Click(Sender: TObject);
      procedure pnb11Click(Sender: TObject);
      procedure pnb12Click(Sender: TObject);
      procedure pnb13Click(Sender: TObject);
      procedure pnb14Click(Sender: TObject);
      procedure pnb15Click(Sender: TObject);
      procedure pnb16Click(Sender: TObject);
      procedure pnb17Click(Sender: TObject);
      procedure pnb18Click(Sender: TObject);
      procedure pnb19Click(Sender: TObject);
      procedure pnb1Click(Sender: TObject);
      procedure pnb20Click(Sender: TObject);
      procedure pnb21Click(Sender: TObject);
      procedure pnb22Click(Sender: TObject);
      procedure pnb23Click(Sender: TObject);
      procedure pnb2Click(Sender: TObject);
      procedure pnb3Click(Sender: TObject);
      procedure pnb4Click(Sender: TObject);
      procedure pnb5Click(Sender: TObject);
      procedure pnb6Click(Sender: TObject);
      procedure pnb7Click(Sender: TObject);
      procedure pnb8Click(Sender: TObject);
      procedure pnb9Click(Sender: TObject);
      procedure pnba10Click(Sender: TObject);
      procedure pnba11Click(Sender: TObject);
      procedure pnba12Click(Sender: TObject);
      procedure pnba13Click(Sender: TObject);
      procedure pnba14Click(Sender: TObject);
      procedure pnba15Click(Sender: TObject);
      procedure pnba16Click(Sender: TObject);
      procedure pnba17Click(Sender: TObject);
      procedure pnba18Click(Sender: TObject);
      procedure pnba19Click(Sender: TObject);
      procedure pnba1Click(Sender: TObject);
      procedure pnba20Click(Sender: TObject);
      procedure pnba21Click(Sender: TObject);
      procedure pnba22Click(Sender: TObject);
      procedure pnba23Click(Sender: TObject);
      procedure pnba2Click(Sender: TObject);
      procedure pnba3Click(Sender: TObject);
      procedure pnba4Click(Sender: TObject);
      procedure pnba5Click(Sender: TObject);
      procedure pnba6Click(Sender: TObject);
      procedure pnba7Click(Sender: TObject);
      procedure pnba8Click(Sender: TObject);
      procedure pnba9Click(Sender: TObject);
      procedure pnh1Click(Sender: TObject);
      procedure pnh2Click(Sender: TObject);
      procedure pnh3Click(Sender: TObject);
      procedure pnh4Click(Sender: TObject);
      procedure pnh5Click(Sender: TObject);
      procedure pnh6Click(Sender: TObject);
      procedure pnh7Click(Sender: TObject);
      procedure pnh8Click(Sender: TObject);
      procedure pnha1Click(Sender: TObject);
      procedure pnha2Click(Sender: TObject);
      procedure pnha3Click(Sender: TObject);
      procedure pnha4Click(Sender: TObject);
      procedure pnha5Click(Sender: TObject);
      procedure pnha6Click(Sender: TObject);
      procedure pnha7Click(Sender: TObject);
      procedure pnha8Click(Sender: TObject);
      procedure pnr1Click(Sender: TObject);
      procedure pnr2Click(Sender: TObject);
      procedure pnr3Click(Sender: TObject);
      procedure pnr4Click(Sender: TObject);
      procedure pnr5Click(Sender: TObject);
      procedure pnr6Click(Sender: TObject);
      procedure pnr7Click(Sender: TObject);
      procedure pnr8Click(Sender: TObject);
      procedure pnra1Click(Sender: TObject);
      procedure pnra2Click(Sender: TObject);
      procedure pnra3Click(Sender: TObject);
      procedure pnra4Click(Sender: TObject);
      procedure pnra5Click(Sender: TObject);
      procedure pnra6Click(Sender: TObject);
      procedure pnra7Click(Sender: TObject);
      procedure pnra8Click(Sender: TObject);
      procedure pojdn10Click(Sender: TObject);
      procedure pojdn11Click(Sender: TObject);
      procedure pojdn12Click(Sender: TObject);
      procedure pojdn13Click(Sender: TObject);
      procedure pojdn14Click(Sender: TObject);
      procedure pojdn15Click(Sender: TObject);
      procedure pojdn16Click(Sender: TObject);
      procedure pojdn17Click(Sender: TObject);
      procedure pojdn18Click(Sender: TObject);
      procedure pojdn19Click(Sender: TObject);
      procedure pojdn1Click(Sender: TObject);
      procedure pojdn20Click(Sender: TObject);
      procedure pojdn21Click(Sender: TObject);
      procedure pojdn22Click(Sender: TObject);
      procedure pojdn23Click(Sender: TObject);
      procedure pojdn24Click(Sender: TObject);
      procedure pojdn25Click(Sender: TObject);
      procedure pojdn26Click(Sender: TObject);
      procedure pojdn2Click(Sender: TObject);
      procedure pojdn3Click(Sender: TObject);
      procedure pojdn4Click(Sender: TObject);
      procedure pojdn5Click(Sender: TObject);
      procedure pojdn6Click(Sender: TObject);
      procedure pojdn7Click(Sender: TObject);
      procedure pojdn8Click(Sender: TObject);
      procedure pojdn9Click(Sender: TObject);
      procedure PopupOpenPopup(Sender: TObject);
      procedure powcustom10Click(Sender: TObject);
      procedure powcustom11Click(Sender: TObject);
      procedure powcustom12Click(Sender: TObject);
      procedure powcustom13Click(Sender: TObject);
      procedure powcustom14Click(Sender: TObject);
      procedure powcustom15Click(Sender: TObject);
      procedure powcustom16Click(Sender: TObject);
      procedure powcustom1Click(Sender: TObject);
      procedure powcustom2Click(Sender: TObject);
      procedure powcustom3Click(Sender: TObject);
      procedure powcustom4Click(Sender: TObject);
      procedure powcustom5Click(Sender: TObject);
      procedure powcustom6Click(Sender: TObject);
      procedure powcustom7Click(Sender: TObject);
      procedure powcustom8Click(Sender: TObject);
      procedure powcustom9Click(Sender: TObject);
      procedure po_computerClick(Sender: TObject);
      procedure po_convertarchiveClick(Sender: TObject);
      procedure po_convertClick(Sender: TObject);
      procedure po_copytoClick(Sender: TObject);
      procedure po_cplClick(Sender: TObject);
      procedure po_detailsClick(Sender: TObject);
      procedure po_envstrClick(Sender: TObject);
      procedure po_hexpClick(Sender: TObject);
      procedure po_im_1024Click(Sender: TObject);
      procedure po_im_200Click(Sender: TObject);
      procedure po_im_4kcinemaClick(Sender: TObject);
      procedure po_im_4ktvClick(Sender: TObject);
      procedure po_im_50Click(Sender: TObject);
      procedure po_im_75Click(Sender: TObject);
      procedure po_im_BMPClick(Sender: TObject);
      procedure po_im_cropClick(Sender: TObject);
      procedure po_im_hdClick(Sender: TObject);
      procedure po_im_JPEG50Click(Sender: TObject);
      procedure po_im_JPEG75Click(Sender: TObject);
      procedure po_im_JPEGClick(Sender: TObject);
      procedure po_im_modifyClick(Sender: TObject);
      procedure po_im_PNGClick(Sender: TObject);
      procedure po_im_rlClick(Sender: TObject);
      procedure po_im_rrClick(Sender: TObject);
      procedure po_im_TIFFClick(Sender: TObject);
      procedure po_im_wuxgaClick(Sender: TObject);
      procedure po_manageClick(Sender: TObject);
      procedure po_movetoClick(Sender: TObject);
      procedure po_mrtClick(Sender: TObject);
      procedure po_msconfigClick(Sender: TObject);
      procedure po_msinfo32Click(Sender: TObject);
      procedure po_open_asarchiveClick(Sender: TObject);
      procedure po_open_asarchivetClick(Sender: TObject);
      procedure po_open_associatedtClick(Sender: TObject);
      procedure po_open_peaziptClick(Sender: TObject);
      procedure po_recycleClick(Sender: TObject);
      procedure po_regeditClick(Sender: TObject);
      procedure po_removeunitsClick(Sender: TObject);
      procedure po_rename_addClick(Sender: TObject);
      procedure po_rename_appenddirClick(Sender: TObject);
      procedure po_rename_extClick(Sender: TObject);
      procedure po_rename_lowercaseClick(Sender: TObject);
      procedure po_rename_deleteClick(Sender: TObject);
      procedure po_rename_prependdirClick(Sender: TObject);
      procedure po_rename_replaceClick(Sender: TObject);
      procedure po_rename_replace_caseClick(Sender: TObject);
      procedure po_rename_timestampClick(Sender: TObject);
      procedure po_rename_uppercaseClick(Sender: TObject);
      procedure po_securedeletefreeClick(Sender: TObject);
      procedure po_selectadvClick(Sender: TObject);
      procedure po_setpwClick(Sender: TObject);
      procedure po_taskClick(Sender: TObject);
      procedure po_taskmanClick(Sender: TObject);
      procedure MenuItemOpen_archiveClick(Sender: TObject);
      procedure MenuItemOpen_exploreClick(Sender: TObject);
      procedure MenuItemOpen_pathClick(Sender: TObject);
      procedure MenuItemOpen_refreshClick(Sender: TObject);
      procedure mgolayoutClick(Sender: TObject);
      procedure CheckBoxIgnorePathsClick(Sender: TObject);
      procedure CheckBoxARCrrClick(Sender: TObject);
      procedure CheckBoxArchiveHistoryClick(Sender: TObject);
      procedure CheckBox7zOFClick(Sender: TObject);
      procedure CheckBoxIgnoreDispClick(Sender: TObject);
      procedure CheckBoxIgnoreSelClick(Sender: TObject);
      procedure CheckBoxQuadMaxClick(Sender: TObject);
      procedure CheckBoxShowHintsClick(Sender: TObject);
      procedure CheckBoxTarBeforeClick(Sender: TObject);
      procedure CheckBoxWindowStatusClick(Sender: TObject);
      procedure ColorButton1ColorChanged(Sender: TObject);
      procedure ComboBoxARCalgoChange(Sender: TObject);
      procedure ComboBoxARCLevelChange(Sender: TObject);
      procedure cbSplitChange(Sender: TObject);
      procedure ComboBoxArcSolidChange(Sender: TObject);
      procedure ComboBoxPAQLevelChange(Sender: TObject);
      procedure ComboBoxPEAStreamChange(Sender: TObject);
      procedure ComboBoxPEAObjChange(Sender: TObject);
      procedure ComboBoxPEAVolChange(Sender: TObject);
      procedure ComboBoxPEALevelChange(Sender: TObject);
      procedure ComboBoxSplitAlgoChange(Sender: TObject);
      procedure ComboBoxThemeChange(Sender: TObject);
      procedure ComboBoxUPXChange(Sender: TObject);
      procedure ctrlbackClick(Sender: TObject);
      procedure ctrlfwdClick(Sender: TObject);
      procedure ctrlupClick(Sender: TObject);
      procedure FormCreate(Sender: TObject);
      procedure FormDropFiles(Sender: TObject; const FileNames: array of String
        );
      procedure iConsoleCreateImportExtClick(Sender: TObject);
      procedure iConsoleCreateImportClick(Sender: TObject);
      procedure BtnPjLaunchAddClick(Sender: TObject);
      procedure BtnPjLaunchExtClick(Sender: TObject);
      procedure BtnPjSaveAddClick(Sender: TObject);
      procedure ButtonOptResetClick(Sender: TObject);
      procedure ImageListRootClick(Sender: TObject);
      procedure ImageListSearchClick(Sender: TObject);
      procedure BtnPasswordClick(Sender: TObject);
      procedure BtnPjSaveExtClick(Sender: TObject);
      procedure LabelDefaultColor1Click(Sender: TObject);
      procedure LabelDefaultColor2Click(Sender: TObject);
      procedure LabelDefaultOpacityClick(Sender: TObject);
      procedure mAttributesClick(Sender: TObject);
      procedure mBenchClick(Sender: TObject);
      procedure mDateEOlderClick(Sender: TObject);
      procedure mDateEqualClick(Sender: TObject);
      procedure mDateERecentClick(Sender: TObject);
      procedure mDateOlderClick(Sender: TObject);
      procedure mDateRecentClick(Sender: TObject);
      procedure mDefaultsClick(Sender: TObject);
      procedure MenuItem1Click(Sender: TObject);
      procedure MenuItem3Click(Sender: TObject);
      procedure pmExplorepathClick(Sender: TObject);
      procedure MenuItemERAssociatedClick(Sender: TObject);
      procedure MenuItemERCustomClick(Sender: TObject);
      procedure MenuItemERPeaZipClick(Sender: TObject);
      procedure MenuItemOpen_ext_allClick(Sender: TObject);
      procedure MenuItemOpen_ext_displayedClick(Sender: TObject);
      procedure MenuItemOpen_ext_selectedClick(Sender: TObject);
      procedure MenuItemOpen_FlatClick(Sender: TObject);
      procedure MenuItemOpen_info_allClick(Sender: TObject);
      procedure MenuItemOpen_info_displayedClick(Sender: TObject);
      procedure MenuItemOpen_info_selectedClick(Sender: TObject);
      procedure MenuItemOpen_jumpClick(Sender: TObject);
      procedure MenuItemOpen_list_allClick(Sender: TObject);
      procedure MenuItemOpen_list_displayedClick(Sender: TObject);
      procedure MenuItemOpen_list_selectedClick(Sender: TObject);
      procedure MenuItemOpen_test_allClick(Sender: TObject);
      procedure MenuItemOpen_test_displayedClick(Sender: TObject);
      procedure MenuItemOpen_test_selectedClick(Sender: TObject);
      procedure MenuItemOpen_upClick(Sender: TObject);
      procedure MenuItemPreAssociatedClick(Sender: TObject);
      procedure MenuItemPreCustomClick(Sender: TObject);
      procedure MenuItemPrePeaZipClick(Sender: TObject);
      procedure MenuItemToolCheckClick(Sender: TObject);
      procedure MenuItemToolCompareClick(Sender: TObject);
      procedure mInvertSelectionClick(Sender: TObject);
      procedure mOptionsClick(Sender: TObject);
      procedure mPSELargerClick(Sender: TObject);
      procedure mPSEqualClick(Sender: TObject);
      procedure mPSESmallerClick(Sender: TObject);
      procedure mPSLargerClick(Sender: TObject);
      procedure mPSSmallerClick(Sender: TObject);
      procedure mRecent1Click(Sender: TObject);
      procedure mRecent2Click(Sender: TObject);
      procedure mRecent3Click(Sender: TObject);
      procedure mRecent4Click(Sender: TObject);
      procedure mRecent5Click(Sender: TObject);
      procedure mRecent6Click(Sender: TObject);
      procedure mRecent7Click(Sender: TObject);
      procedure mRecent8Click(Sender: TObject);
      procedure mSizeELargerClick(Sender: TObject);
      procedure mSizeEqualClick(Sender: TObject);
      procedure mSizeESmallerClick(Sender: TObject);
      procedure mSizeLargerClick(Sender: TObject);
      procedure mSizeSmallerClick(Sender: TObject);
      procedure mSortBySelectionClick(Sender: TObject);
      procedure mUnPEAbrowseClick(Sender: TObject);
      procedure mUnPEAClick(Sender: TObject);
      procedure openwithassociatedClick(Sender: TObject);
      procedure openwithcustomClick(Sender: TObject);
      procedure openwithpeazipClick(Sender: TObject);
      procedure pcustom1Click(Sender: TObject);
      procedure pcustom2Click(Sender: TObject);
      procedure pcustom3Click(Sender: TObject);
      procedure pcustom4Click(Sender: TObject);
      procedure pcustom5Click(Sender: TObject);
      procedure pcustom6Click(Sender: TObject);
      procedure pcustom7Click(Sender: TObject);
      procedure pcustom8Click(Sender: TObject);
      procedure pmAddFileClick(Sender: TObject);
      procedure pmAddFolderClick(Sender: TObject);
      procedure pmJump2Click(Sender: TObject);
      procedure pmLoadListClick(Sender: TObject);
      procedure pmOpenPJallClick(Sender: TObject);
      procedure pmOpenPJdisplayedClick(Sender: TObject);
      procedure pmOpenPJselectedClick(Sender: TObject);
      procedure pmSaveListClick(Sender: TObject);
      procedure pmSearchAddClick(Sender: TObject);
      procedure po_addtoarchiveClick(Sender: TObject);
      procedure po_checkClick(Sender: TObject);
      procedure po_compareClick(Sender: TObject);
      procedure po_copyClick(Sender: TObject);
      procedure po_cutClick(Sender: TObject);
      procedure po_defragClick(Sender: TObject);
      procedure po_deleteClick(Sender: TObject);
      procedure po_diskcleanClick(Sender: TObject);
      procedure po_exthereClick(Sender: TObject);
      procedure po_infoClick(Sender: TObject);
      procedure po_joinClick(Sender: TObject);
      procedure po_listClick(Sender: TObject);
      procedure po_newfolderClick(Sender: TObject);
      procedure po_open_associatedClick(Sender: TObject);
      procedure po_open_customClick(Sender: TObject);
      procedure po_open_peazipClick(Sender: TObject);
      procedure po_pasteClick(Sender: TObject);
      procedure po_renameClick(Sender: TObject);
      procedure po_securedeleteClick(Sender: TObject);
      procedure po_splitClick(Sender: TObject);
      procedure po_testClick(Sender: TObject);
      procedure po_zerofileClick(Sender: TObject);
      procedure po_zerofreeClick(Sender: TObject);
      procedure cbDefaultFormatChange(Sender: TObject);
      procedure cbHashFormatChange(Sender: TObject);
      procedure cbBrowserHashChange(Sender: TObject);
      procedure cbBinariesChange(Sender: TObject);
      procedure cbBinariesStopChange(Sender: TObject);
      procedure CheckBoxExtActionAdvChange(Sender: TObject);
      procedure ComboBoxActionArcChange(Sender: TObject);
      procedure ComboBoxActionExtractChange(Sender: TObject);
      procedure RadioGroupPaqClick(Sender: TObject);
      procedure RadioGroupQuadClick(Sender: TObject);
      procedure cbTimeStampChange(Sender: TObject);
      procedure SchedAddscheduleExtChange(Sender: TObject);
      procedure schedaddscheduleChange(Sender: TObject);
      procedure scheduleendextChange(Sender: TObject);
      procedure scheduleendChange(Sender: TObject);
      procedure schedulestartextChange(Sender: TObject);
      procedure schedulestartChange(Sender: TObject);
      procedure scheduleuserextChange(Sender: TObject);
      procedure scheduleuserChange(Sender: TObject);
      procedure ShellTreeViewNavCustomDraw(Sender: TCustomTreeView;
        const ARect: TRect; var DefaultDraw: Boolean);
      procedure ShellTreeViewNavKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure ShellTreeViewNavMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ShellTreeViewNavMouseMove(Sender: TObject; Shift: TShiftState; X,
        Y: Integer);
      procedure ShellTreeViewNavMouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure SpinEditOpacityChange(Sender: TObject);
      procedure SplitterBottomMoved(Sender: TObject);
      procedure SplitterSideMoved(Sender: TObject);
      procedure SplitterOptionsMoved(Sender: TObject);
      procedure StringGridAddDblClick(Sender: TObject);
      procedure StringGridAddDrawCell(Sender: TObject; aCol, aRow: Integer;
        aRect: TRect; aState: TGridDrawState);
      procedure StringGridAddHeaderClick(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGridAddHeaderSized(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGridAddKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGridAddKeyPress(Sender: TObject; var Key: char);
      procedure StringGridAddKeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGridAddMouseDown(Sender: TOBject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure StringGridAddMouseUp(Sender: TOBject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure StringGridExtractDblClick(Sender: TObject);
      procedure StringGridExtractDrawCell(Sender: TObject; aCol, aRow: Integer;
        aRect: TRect; aState: TGridDrawState);
      procedure StringGridExtractHeaderClick(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGridExtractHeaderSized(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGridExtractKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGridExtractKeyPress(Sender: TObject; var Key: char);
      procedure StringGridExtractKeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGridExtractMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure StringGridExtractMouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure StringGridBookmarksColRowMoved(Sender: TObject;
        IsColumn: Boolean; sIndex, tIndex: Integer);
      procedure StringGridBookmarksDblClick(Sender: TObject);
      procedure StringGridBookmarksDrawCell(Sender: TObject; aCol,
        aRow: Integer; aRect: TRect; aState: TGridDrawState);
      procedure StringGridBookmarksHeaderClick(Sender: TObject;
        IsColumn: Boolean; Index: Integer);
      procedure StringGridBookmarksHeaderSized(Sender: TObject;
        IsColumn: Boolean; Index: Integer);
      procedure StringGridBookmarksKeyPress(Sender: TObject; var Key: char);
      procedure StringGridBookmarksMouseDown(Sender: TObject;
        Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      procedure StringGridClipboardDblClick(Sender: TObject);
      procedure StringGridClipboardKeyPress(Sender: TObject; var Key: char);
      procedure StringGridCustEditAdvColRowMoved(Sender: TObject;
        IsColumn: Boolean; sIndex, tIndex: Integer);
      procedure StringGridCustEditAdvDblClick(Sender: TObject);
      procedure StringGridCustEditAdvMouseDown(Sender: TObject;
        Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      procedure StringGridCustEditAdvSelectCell(Sender: TObject; aCol,
        aRow: Integer; var CanSelect: Boolean);
      procedure StringGridCustEditColRowMoved(Sender: TObject;
        IsColumn: Boolean; sIndex, tIndex: Integer);
      procedure StringGridCustEditDblClick(Sender: TObject);
      procedure StringGridCustEditMouseDown(Sender: TObject;
        Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      procedure StringGridSessionHistoryDrawCell(Sender: TObject; aCol, aRow: Integer;
        aRect: TRect; aState: TGridDrawState);
      procedure StringGridSessionHistoryHeaderSized(Sender: TObject;
        IsColumn: Boolean; Index: Integer);
      procedure StringGridRecentDblClick(Sender: TObject);
      procedure StringGridRecentDrawCell(Sender: TObject; aCol, aRow: Integer;
        aRect: TRect; aState: TGridDrawState);
      procedure StringGridRecentHeaderSized(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure tbcontrastChange(Sender: TObject);
      procedure ThemeResetClick(Sender: TObject);
      procedure themesave_labelClick(Sender: TObject);
      procedure TimerSyncTimer(Sender: TObject);
      procedure TimerBrowserTimer(Sender: TObject);
      procedure TimerWinContextStartTimer(Sender: TObject);
      procedure TimerWinContextTimer(Sender: TObject);
      procedure TimerBusyTimer(Sender: TObject);
      procedure TimerdragTimer(Sender: TObject);
      procedure TimerHintStartTimer(Sender: TObject);
      procedure TimerrenameTimer(Sender: TObject);
      procedure tmconvertClick(Sender: TObject);
      procedure tmcreateClick(Sender: TObject);
      procedure tmextractClick(Sender: TObject);
      procedure tmopenarchiveClick(Sender: TObject);
      procedure tmopenpathClick(Sender: TObject);
      procedure tmpeazipClick(Sender: TObject);
      procedure tmquitClick(Sender: TObject);
      procedure tmupdateClick(Sender: TObject);
      procedure tbtemperatureChange(Sender: TObject);
      procedure TrayIconPZClick(Sender: TObject);
      procedure TrayIconPZDblClick(Sender: TObject);
      procedure TreeViewNavMouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure TreeViewNavMouseEnter(Sender: TObject);
      procedure TreeViewNavMouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure w7contextlangClick(Sender: TObject);
      procedure zenc437Click(Sender: TObject);
      procedure zencutf8Click(Sender: TObject);
   private
      { private declarations }
      procedure DragOverHandler(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
   public
      { public declarations }
   end;

{$IFDEF MSWINDOWS}
type //used for custom drag and drop
  TControlDragObject = class(TDragObject)
  private
    FDragImages: TDragImageList;
    FX, FY: Integer;
  protected
    procedure EndDrag(Target: TObject; X, Y: Integer); override;
    function GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor; override;
    //function GetDragImages: TDragImageList; override;
  public
    constructor CreateWithHotSpot(AControl: TWinControl; X, Y: Integer);
    destructor Destroy; override;
  end;

procedure FixControlStyles(Parent: TControl);

//used for system drag and drop
procedure dodropfiles(winc:TWinControl; sarr:array of ansistring; dropmode:integer); external 'dragdropfilesdll.dll';
procedure dodropvfiles(winc:TWinControl; vpath:ansistring; dropmode:integer); external 'dragdropfilesdll.dll';
procedure changevpath(vpath2: ansistring);  external 'dragdropfilesdll.dll';
procedure readvstatus(var vstat: ansistring);  external 'dragdropfilesdll.dll';
procedure setvstatus(vstat: ansistring);  external 'dragdropfilesdll.dll';
{$ENDIF}
//(Windows) custom drag and drop
function dragtowin(var dragdest:ansistring):integer;
//(Windows) native drag and drop
procedure cleandragtmp;
//delete directory and verify result
function cleardir(var s:ansistring; cleardirname,force_skip_ptmpcode:boolean):integer;
function cleardirsimple(s:ansistring):integer;
//password and keyfile request
function ask_pwkeyfile:integer;
procedure hideconfirmation;
procedure showconfirmation;
//request input
function pInputQuery ( const FCaption, FPrompt, Fwarning : ansistring; var UserValue : ansistring; chkb:boolean ) : Boolean;
//launch command with progress window
function launch_cl(cl,jobcode,outname:ansistring):integer;
//get temp work path
procedure getworkpath(var work_path:ansistring; out_param:ansistring);
//compose command line
function compose_un7z_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
function compose_unace_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
function compose_unarc_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
function compose_unzpaq_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
function compose_unlpaq_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode:ansistring):integer;
function compose_unpaq_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode:ansistring):integer;
function compose_unquad_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode:ansistring):integer;
function compose_unbrotli_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
function compose_unzstd_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
function compose_unpea_cl(var cl,jobcode,outname:ansistring):integer;
function compose_uncustom_cl(var cl,jobcode,outname:ansistring; real_extract:boolean):integer;
function compose_rarspecfun_cl(var cl,jobcode,outname:ansistring; specfun:ansistring):integer;
procedure check_files(var in_param,cl,oper:ansistring);
//execute command line
function execute_cl(cl,mode:ansistring):integer;
function execute_cl_simple(cl:ansistring):integer;
procedure execute_cl_process(cl:ansistring);
//output name
function setoutname(var s:ansistring; i:integer):integer;
procedure suggest_outname(var s:ansistring; t:ansistring; i:integer);
function addext(s:ansistring):ansistring;
procedure checkoutpath_extract;
procedure tempcheckoutpath_extract;
//from file broswer to extraction screen
procedure list_toextractor(act,modeofuse:ansistring);
//update content in archiving and extraction screens
procedure updatelayout(enumdir:ansistring);
procedure updatecontent_ext;
//set archiving and extraction screens
procedure setpanel_add(ipanel:integer);
procedure setpanel_extract(ipanel:integer);
procedure setextpopupmenu(menutype:ansistring);
procedure setscripttarpipe;
procedure setscriptuntarpipe;
//gest status bar information
procedure get_statuss(s:ansistring);
//scripting engine, import task defined in the gui as cl
function importjobcl(var cl,jobcode,outname:ansistring):integer;
function importjobcl_extract(var cl,jobcode,outname:ansistring):integer;
//get name for saving schedulted task
procedure getscheduledtaskname(stype:integer);
//set archive format
procedure on_ComboBoxArchiveCompressionLevelChange;
procedure getarccaption(s:ansistring);
procedure change_imagesplit;
procedure set_values(archive_type,compression_method,compression_level:ansistring);
procedure setquickcompset(s:ansistring);
procedure archive_type_select(s:ansistring);
procedure setsyntaxstring7z;
//set tar before compression operation
procedure check_tarbefore(tdirs:integer);
//apply switch archive / extract to original path
procedure on_checkboxsamearcclick;
procedure on_checkboxsameextclick;
//start archiving and extraction tasks
procedure on_buttonarchiveclick;
procedure on_buttonextokclick;
function extract_finalize_bytype(fn,s:ansistring; var cl,jobcode,outname,mode:ansistring; realext:boolean): integer;
//exit after task
procedure exit_withsave;
procedure exit_nosave;
//quick extraction from file browser
procedure quickextract(dest,fol,sel:ansistring);
procedure directextractfromname(var in_param,out_param:ansistring; optype:ansistring; intitems:ansistring);
//extract then move to destination
procedure moveafterextract(var outname:ansistring);
//optionally remove dir nesting from extracted content
procedure extraction_checkintermediatedir(var outname:ansistring; optype:ansistring);
//move zpaq content after extraction
procedure movezpaq(cl:ansistring);
//update archive
procedure setupdatecontrols(encnt:boolean);
procedure checkcontextadd;
procedure syncedit_archive;
procedure renamefileinarchive(nameold,namenew:ansistring;cleardestname:boolean);
function addtoarchive_inarchive(forceadd:boolean):boolean;
//test for encryption
function testencrypted:integer;
function testencrypted_open:integer;
//check selected items
function checklistsel:integer;
function checklistanysel:integer;
function checklisttotsel(var nsel:integer; var strsel:ansistring):integer;
function checkextinput_noduplicatecheck:boolean;
//open archive
function open_inputselect:integer;
procedure browse_special_cases;
procedure open_archive_fromname(s:ansistring);
procedure browse_arc(mode:ansistring);
function testeditable:boolean;
function testencrypted_fromname(fname,modearchive:ansistring):integer;
procedure generate_archive_breadcrumb;
procedure refresharchiveroot(mode:AnsiString);
//get name of multipart archive
procedure getmultiname(var s,in_param:ansistring);
//list archive
procedure filter_archivecontent;
procedure kp_EditUn7zaFilterInteractive_nonrecursive;
procedure on_mFlatArchivesClick(i:integer);
//archive level comment
procedure readcomment;
//list directory
procedure listdir(s:ansistring; recmode,treemode:boolean);
//set last selected item on navigation operations
procedure set_lastobj;
procedure set_lastobjarch;
procedure view_lastobj;
//(Windows) list pc
procedure listpc;
//set file browser style
procedure setbrowsertype(btype:integer);
//set file browser columns
procedure set_listview_col;
procedure setbrowser_crchash(i:integer);
procedure savecol;
//display folders before files
procedure set_dirbeforefiles(dmode:integer);
//sort file browser
procedure sort_az_stringgridlist(c:integer);
//update file browser content
procedure update_listview;
procedure update_listview_sel;
//refresh file browser
procedure navrefresh;
procedure do_forcerefresh;
//lock and unlock file browser waiting for updating the status
procedure enter_busy_status;
procedure exit_busy_status;
//open item from file browser
procedure grid_obj_open;
function cp_open(s:ansistring; desk_env:byte):integer;
function count_clipboard:ansistring;
procedure openwith_base(act,target:ansistring);
procedure openwith_cust(act,custmode:ansistring; j:integer);
procedure prev_hexpselected_list(previewfun,fname:ansistring);
//define extensions of items not to be opened without user's consent
procedure on_ComboBoxsecChange;
//treeview
procedure populatetree;
procedure populatetreefunctions;
function gettreeicon(sg:TStringGrid; arow:integer):integer;
//tab bar
function gettabname(nrow:integer):ansistring;
procedure save_tabs;
//status bar
procedure update_info;
function isarchiveeditable:integer;
procedure set_statuss_nav;
//bookmarks
function extractbookmarkname(s:ansistring):ansistring;
//address bar
procedure update_addressbar(apath:ansistring);
//search
procedure setsearchbar(sb:byte);
procedure rsearch;
procedure do_resetsearch;
procedure list_un7z_search;
//search on the web
procedure run_websearch(s:ansistring);
//move file
procedure clickmoveto(var sdest:ansistring);
//execute function
procedure do_pmfun(capt:ansistring);
//apply compression preset
procedure settpreset(i,sz:integer; stylemode:boolean);
//password manager
procedure loadpm;
procedure setpm(pmfun:integer);
//bookmarks
procedure load_bookmarks;
//set theme
procedure ComboBoxTheme_onchange;
procedure setwindowsopacity;
procedure getthemepath(var thpath:ansistring);
procedure settabsstyled;
//localization
procedure peaziplanguage(s: ansistring);
//configuration
procedure save_conf;
procedure updateconf_modified;
//reset
procedure reset_temp(mode:integer);
procedure dohistoryreset;
//restart peazip
procedure restartpeaapp;
procedure restartclosepeaapp;
procedure saverestartclosepeaapp;
//startup
procedure condopenaction(s:ansistring);
procedure finishlistview;

const
  HLIBRE_DIR    = 0; //hardcoded "libre directive" 0 not hardcoded, read from configuration; 1 hardcoded to allow only using Free Software components; 2 hardcoded to allow only using Free Software components and open archive formats (not encumbered by patents for read nor write)
  HPRIVACY_MODE = 0; //hardcoded privacy_mode directive 0 not hardcoded, read from configuration; 1,2 hardcoded skippable or non skippable password request at startup, overriding configuration
HSYSBIN = 2; //hardcoded use of binaries in system paths, eg as in $PATH 0 no, read from configuration; 1 only 7z / p7zip; 2 all backend binaries
  HBINPATH      = '';//hardcoded path for binaries
  HCONFPATH     = '';//hardcoded path for configuration
HSHAREPATH = '/usr/share/peazip/';//hardcoded path for other data (non binary, non configuration)
  WS_EX_LAYERED = $80000;
  LWA_ALPHA     = $2;
  PEAZIPVERSION = '11.2';
  PEAZIPREVISION= '.0';
  SPECEXTCONST  = '001 bat exe htm html msi r01 z01';
  {$IFDEF MSWINDOWS}
  SECEXTCONST   = 'exe cmd msi bat ps1 vbs reg';
  {$ELSE}
  {$IFDEF DARWIN}
  SECEXTCONST   = 'sh scpt scptd applescript';
  {$ELSE}
  SECEXTCONST   = 'sh';
  {$ENDIF}
  {$ENDIF}
  PREFALGOCONST = 'CRC32 CRC64 MD5 RIPEMD160 SHA1 BLAKE2S SHA256 SHA3_256';
  DEFAULT_THEME = 'main-embedded';
  DLEFT         = 64;
  DTOP          = 64;
  DWIDTH        = 1024;
  DHEIGTH       = 600;
  DGWLEFT       = 92;
  DGWTOP        = 92;
  DGWWIDTH      = 640;
  DGWHEIGTH     = 320;
  MAXTABN       = 256;
  NAMEVARSTR    = ' - ';
  ZCHAR         = '+';
  ZSTRING       = '----------';
  ZSTRINGS      = '--';
  ZSTRINGL      = '------------------- ----- ------------ ------------  ------------------------';
  {$IFDEF MSWINDOWS}
  NDLINES       = 3;//15.x+
  {$ELSE}
  NDLINES       = 3;//15.x+
  {$ENDIF}
  RAR5STRING    = 'Details: RAR 5'; //check first 14 characters
  READE_LIST    = '7Z, ACE, ARC/WRC, ARJ, BR, BZ/TBZ, CAB, CHM/CHW/HXS, COMPOUND (MSI, DOC, XLS, PPT), CPIO, GZ/TGZ, ISO, Java (JAR, EAR, WAR), LZH/LHA, Linux (DEB, PET/PUP, RPM, SLP), NSIS, OOo, PAK/PK3/PK4, PAQ/LPAQ/ZPAQ, PEA, QUAD/BALZ/BCM, RAR, TAR, WIM/SWM, XPI, Z/TZ, ZIP, ZST...';
  WRITEE_LIST   = '7Z, 7Z-sfx, ARC, ARC-sfx, BR, BZ2, GZ, *PAQ, PEA, QUAD/BALZ/BCM, split, TAR, UPX, WIM, XZ, ZIP, ZST';
  APPMAIN       = 'PeaZip';
  STR_7Z        = '7Z';
  STR_ARC       = 'ARC';
  STR_BROTLI    = 'Brotli';
  STR_BZIP2     = 'BZip2';
  STR_GZIP      = 'GZip';
  STR_LPAQ      = 'LPAQ';
  STR_PAQ       = 'PAQ';
  STR_PEA       = 'PEA';
  STR_QUAD      = 'QUAD/BALZ/BCM';
  STR_TAR       = 'TAR';
  STR_UPX       = 'UPX';
  STR_ZIP       = 'ZIP';
  STR_ZPAQ      = '*PAQ';
  STR_WIM       = 'WIM';
  STR_XZ        = 'XZ';
  STR_ZSTD      = 'Zstd';

var
   FormPeach: TFormPeach;
   patheditor:TEdit;
   TargetNode,TargetNode2:TTreeNode;
   TS:TTimeStamp;
   clipcontent,clipcontent1:TClipcontent;
   aconf,conf,book,tabsf,cedit,t:text;
   pmfileb:file of byte;
   imod,inbcnode,rowsize,selnode:integer;
   abcrs: array [1..4] of ansistring;
   specextensions,secextensions: array of ansistring;

   //scaling
   il16,ilsmall,il96: TImageList;
   qscale,qscaleimages,pspacing,pzoom,pspacingd,pzoomd,ensmall,ensmalld,
   icon_sizeplus,baseiconsize,scalediconsize,spacedscalediconsize,relativeiconsize,
   COL1D,COL2D,COL3D,COL4D,COL5D,COL6D,COL7D:integer;

   //address bar colors
   abactivecol,abarchivecol,tabpencol,tabbrushcol,tablowcol,tabbrushhighcol:tcolor;

   //Listview hints
   h:THintWindow;
   r:TRect;
   shint,prevshint:ansistring;

   //status extractor
   epfolder,epfolder1,epdefault,epextract,epskip,epdelete,epfilters,eparcextract,eparcskip,epaceextract,epsupp,epunsupp,vexcustom3,epunsupp1:integer;
   epdefaultextractpath,vexcustom1,vexcustom2,vexc1,vexc2,vexc3,vexc4,vexc5,vexc6,vexc7,vexc8:ansistring;
   epdopt,vexpaths,epsni,epsns,epsnz,epzall,epzfull,epzabs,epzfor,ezstderr:integer;

   //status archiver
   apdefault,apformat,apfilters,apenum,apencext,apappend,apcustext,apsplit,apspin,apsize,apdelete,apverbose,appw,apdopt,aprar,aprar5,aprardict,aprarmanual,aprarblake2,
   aprarsfx,aprarsolid,apprarrr,aprarrr,apprarrv,aprarrv,aprarsaveopen,aprarsavesecurity,aprarsavestreams,aprarlastmodtime,aprarlock:integer;
   apdefaultarchivepath,apextcapt:ansistring;
   v7z1,v7z2,v7z3,v7z4,v7z5,v7z6,v7z7,v7snoi,v7snon,v7z7b,v7z8,v7z9,v7z10,v7z11,v7z11b,v7z13,v7z13b,v7z14,v7z15,v7z16,v7z16a,v7z16b,v7z17,v7z18,v7z17c,vtartype,vtartime,v7zpaths,vlevel_7z,vlevel_bzip2,vlevel_gz,vlevel_zip,vlevel_xz,v9b,v9z,v9r,vbr1,vzst1:integer;
   v7z12,vmethod_7z,vmethod_zip,varc7,vcustom1,vcustom2,vcustom3:ansistring;
   vquad1,vquad2,vpaq1,vpaq1b,vpaq2,vupx1,vupx2,vupx3,varc1,varc2,varc3,varc3b,varc4,varc5,varc6,varc8,vsplit1,vpea1,vpea2,vpea3,vpea4,vpea5,vpea6,vcustom4:integer;

   //status options
   vopt1,vopt1b,vopt1c,vopt7c,vopt12t,vopt19e,vopt19esec,vopt19f,vopt5d3t:ansistring;
   vopt2,vopt3,vopt4,vopt4b,vopt4c,vopt4d,vopt4e,vopt4f,vopt4g,vopt4h,vopt5b,vopt5c,vopt5d,vopt5dt,vopt5d4,vopt5utc,vopt5d1,vopt5d2,vopt5d3,vopt5e,
   vopt5f,vopt5f1,vopt5g,vopt5dup,vopt5dsh,vopt5gtar,vopt5gtar1,vopt5h,vopt5sw,vopt5ca,vopt6,vopt7,vopt7b,vopt8,vopt9,vopt10,vopt11,vopt12,voptlibre,
   voptprivacy,vopt13,voptts,vopt15c,vopt15d,vopt15e,vopt15e2,vopt15e3,vopt15e4,vopt15e5,vopt15f,vopt15g,vopt15gg,vopt15h,vopt15i,vopt15i2,vopt17,vopt18,vopt18b,
   vopt19,vopt19b,vopt19c,vopt19csec,vopt19d,vopt20,vopt20b,vopt21,vopt22,vopt22b,vopt22c,vopt23,vopt23b,vopt24,vopt24b,vopt24c,vopt25,valg1,valg2,valg3,valg4,valg5,
   valg6,valg7,valg8,valg9,valg10,valg11,valg12,valg13,valg14,valg15:integer;

   //image editing options
   simgfun, simgw, simgh, simgper, simgasp, simgconv, simgj, simgt, simgb, simgl, simgr, simgpercent, deco_style:integer;
   fthumbs,gofthumbs,gwcompact:boolean;

   devicon:array [1..26] of TBitmap;
   Bplaceshistory,Barchive_bigger2,Barchive_big,Barchive,BArchiveSupported,
   BFileSupported,BExesupported,Bunsupported,Bback,Bbookmark,Bbookmarkadd,Bclearlayout,
   Bdefaults,Bdelete,Bdvd_supported,Bexpand,Bextractall,Bextractall_big,Bfd_supported,
   BFolder,Bgo,Bgopath,Bgoup,Bhd_supported,Binfo,Bkeyfile,Bloadlayout,Blocker,Blocker2,
   Bmail,Bnav,Bp0,Bpreview,Bram_supported,Brefresh,Bremote_supported,Bremovable_supported,
   Bresetpath,Broot,Brun,Bsavelayout,Bsearch,Bdesk,Bsystemtools,Btestall,Btestall_big,
   Bstop,Bweb,Bwipe,Blink,Bconvert,Bconvert_big,Btxt,Bspreadsheet,Bvideo,Baudio,Bimage,
   Bpresentation,Bpdf,Bsupported,Bbat,Bdll,Bdb,Bgif,Bico,Bvector,
   Bdetailsfs,Bjpeg,Bapps,Bextractalln_big,Bextractalln,
   Barc7z,Barcrar,Barczip,Barcblock,Barcdisk,Barcinstaller,
   Btool_cut,Btool_copy,Btool_paste,Btool_openw,Btool_properties,Btool_rename,
   Btool_delete,Btool_dup,BTool_cut_small,BTool_copy_small,BTool_dup_small,
   Btool_properties_small,Btool_rename_small,BTool_resize,BTool_crop,
   BTool_rl,BTool_rr,BTool_resize_small,BTool_crop_small,
   BTool_rl_small,BTool_rr_small,Bdownloadfolder,Bcloudfolder,Bhomefolder,
   Bdvd_supported96,Bfd_supported96,BFolder96,Bhd_supported96,Bram_supported96,
   Bremote_supported96,Bremovable_supported96,Btxt96,Bspreadsheet96,Bvideo96,Baudio96,Bimage96,
   Bpresentation96,Bpdf96,Bsupported96,Bbat96,Bdll96,Bdb96,Bgif96,Bico96,Bvector96,Bjpeg96,BArchiveSupported96,
   BFileSupported96,BExesupported96,Bunsupported96,Blink96,Bweb96,Bmail96,
   Barc7z96,Barcrar96,Barczip96,Barcblock96,Barcdisk96,Barcinstaller96,
   Bfm,Bdetailsf,Blistf,Biconsf,Bnonthemed,
   Bav,Bfilter,Bflat,Bcollapse,
   Bp1,barc,bext,bextf,btest,blist,bmenu,bseparator,bsettings,
   binfodlg,bwarningdlg,bwarningsmall,berrordlg,Bdesk96,Bhomefolder96,
   Bdownloadfolder96,Bcloudfolder96: TBitmap;

   dfilenames:array of string;

   devname:array [1..26] of ansistring;
   patchclip:array of array [0..15] of ansistring;
   israr5,browse_option,caption_release,caption_build,tempstring,alt_tempstring,archive_type,archive_t,
   compression_method,compression_level,parameters,kdir,in_name,in_file,in_folder,
   output_name,out_qualified_name,size_u,cks,data_compression,save_cks,bcomp,
   keyfname,themedir,theme_name,theme_author,theme_license,theme_path,wrk_path,executable_path,resource_path,binpath,sharepath,
   persistent_source,fun,subfun,btfun,tools_path,color1,color2,color3,color4,color5,color1d,
   color2d,color3d,color4d,color5d,prev_type,
   prev_method,prev_level,method_7z,dmethod_7z,method_zip,dmethod_zip,ptmpcode,ptmpdir,pstmpdir,graphicsfolder,graphicsfolderd,
   archive_content,wincomspec,delimiter,desktop_path,prevpanel,winver,majmin,indir,destdir,
   prev_destdir,local_desktop,home_path,confpath,currentcomp,currentfs,usr_documents,usr_music,usr_videos,usr_pictures,users_root,
   public_documents,public_home,usr_recent,usr_searches,applebk,usr_libraries,usr_downloads,usr_sendto,
   shared_dropbox,shared_googledrive,shared_onedrive,shared_sharepointwork,shared_yandex,
   usr_name,lastobj,lastobjarch,custedit1,custedit2,custedit3,custedit4,custedit5,
   custedit6,custedit7,custedit8,custedit9,custedit10,custedit11,custedit12,custedit13,
   custedit14,custedit15,custedit16,prevcaption,advedit1before,advedit2before,advedit3before,
   advedit4before,advedit5before,advedit6before,advedit7before,advedit8before,advedit1after,
   advedit2after,advedit3after,advedit4after,advedit5after,advedit6after,advedit7after,
   advedit8after,advedit1alt,advedit2alt,advedit3alt,advedit4alt,advedit5alt,advedit6alt,
   advedit7alt,advedit8alt,
   winpfolder,winpfolder32,winsysfolder,winappdatafolder,fun_status,lastoutpath,lastextractionpath,
   status0,status1,status_curfilesystem,status_curarchive,statuss,statusw,statust,statusr,
   checkver,extsel,defaultextractpath,defaultarchivepath,dn,dn1,
   prevrun,titlestring,sortstatusstring,updateid,prevupdateid,prevarchive,inputfile,
   peaziptmpdir,peaziptmpdirroot,peaziptmpdir_tmp,basedragtitle,unacepluginstatus,unrar5pluginstatus,addformatspluginstatus,
   prevlistfilter,browsersdir,custom_work_path,tempaddinarchive,beingpreviewed,moverelpath,
   move_out_param,lcmethod,langstrhint,plistfile,statushint,infocpu,inforam,infomem,
   statushintar,statushintex,typehint,origout,origoutnf,origouttf,origoutmf,
   prefixd,prefixf,prefixdaz,prefixdza,prefixfaz,alias7z,rarcommentfilename,mddtarget,pipepw,
   specbrowse,pspecbrowse,syntaxstring7z,renorig,browserwarningmsg,browserwarningmsg1,browserwarningmsg2:ansistring;

   tvolumes,tdirs,tfiles,psize,tvol,tsize:qword;
   sizefreeout,sizefreewrk,sizefreeint: int64;

   devtype:array [1..26] of integer;
   appdb:array [1..16] of integer;
   appdb2:array [1..8] of integer;
   imlistindex,imtodo,exelistindex,exetodo:array of integer;
   listrow,listsortcol,listsortcol1,listsortcol2,listsortbook,title_lines_7z,
   currow1,browsingmode7z,splittersize,splitter2size,lastbar,lasttoolbar,prevbar,splitter3size,splitsearchsize,
   barheight,mbarheight,mmbarheight,intcellhw,expandfs,expandroot,expandbook,expandhistory,expandmore,expandrun,expandapps,expandfun,
   secgroupheight,listcol,ares,esna,euns,col1size,col2size,col3size,col4size,col5size,col6size,col7size,colmethodsize,colcommentsize,
   toolsize,ptoolsize,navbar,addressbar,ptabbar,psidebar,work_dir,rootdirrecord,mappeddrivesinfo,session_mappeddrivesinfo,
   appentries1,pcount,refreshstatus,usealtcolor,altaddressstyle,altbread,macbread,solidaddressstyle,toolcentered,alttabstyle,accenttoolbar,highlighttabs,altaddressstyled,toolcenteredd,solidaddressstyled,alttabstyled,accenttoolbard,usealtcolord,highlighttabsd,ws_top,ws_left,ws_height,ws_width,ws_gw_top,ws_gw_left,ws_gw_height,ws_gw_width,
   archive_type_selected,smalliconsize,largeiconsize,browsersize,browsertype,
   sync,imindex,exeindex,showthumbnails,simplesearch,recsearch,issearching,browserch,arcabspath,keeppw,usebreadcrumb,
   pmnotdecrypted,pimmersive,hnum,tpcomp,tpreset,prevdrbutton,bctemp,listmode,favdelete,convertverbose,convertpw,
   libre_directive,tsstyle,updatingcontent,wasselected,wasselectedp,ptabid,atabid,
   doptadd,doptext,privacy_mode,showvolatile,tryopenwerrors,forcecanbechanged,forcetype,excludeef,tsutc,euns1,
   autosync,sys7zlin,i16res,i32res,i48res,i96res,tabheight,tablabelheight,tabheightl,pbarh,autoopentar,alreadytar,spansize,advopdictionary,
   advopword,advoppasses,advopblocksize,noconfdel,specialmoderar,pforceconsole,closeonsingleextract,movetorelativepath,
   forcebrowse,forceconvert,forcelayout,nitems,storecreated,max_cl,temperature,temperatured,contrast,
   contrastd,lsize,ntoolstyle,pperc,dirbeforefiles,decostyle,decostyled,abt,altmenu,seccond,allowvirtual,sizevirtual,virtualopt,
   curselcount,prevselcount,setsequenceerror,pmode,kflimit,mbaction,maxndirtree,renderinterpolation,poslastobj:integer;

   ltime,stime:longint;

   ent_buffer: array [0..63] of byte;
   opacity,opacityd,df,pf,pobj,pcompr,pvol,nrkdf,trkdf,pstream,salgo,zaout,zaout1,ws,ws_status,
   ignorepathextand,level_7z,dlevel_7z,level_xz,level_brotli,level_zstd,level_rar,
   level_bzip2,level_arc,solid_arc,rr_arc,algo_arc,algo_zipenc,level_gz,level_paq,threads_zpaq,paqver,
   level_quad,level_upx,level_zip,dlevel_zip,snoi7z,snon7z,openw_all7z,showpwfield,setencfn,intpw,hidepwconf,
   autoclosegwrap,mailkeep,autoopen,autotest,autoclosepeazip,skipenctest,tartype,tartime,
   browserstyle,desk_env,prebrowse,maxargsize,ignorepathdisp,enc7zscc,sni7z,sns7z,snh7z,snl7z,ssp7z,stl7z,snz7z,maxbrotli,maxzstd,
   ignorepathsel,removeintdir,ignorepathdd,savehistory,fav7z,favARC,favbz,favcustom,favgz,favpea,favquad,favsfx,
   favsfxarc,favsplit,favtar,favupx,favzip,favzpaq,favwim,favxz,favbrotli,favzstandard,enableextand,
   algodisp,algoall,algoadler,algocrc16,
   algocrc24,algocrc32,algocrc64,algoed2k,algomd4,algomd5,algoripemd160,algosha1,
   algosha3_256,algosha256,algosha3_512,algosha512,algowhirl,showguihints,customsyntax,
   customsyntax1,erasepasses,filesizebase,extopt7z,extoptarc,extaction7z,extactionarc,extactionace,
   clipmode,
   archivenameenc,tonewfolder,parallelarchive,zcopy,mcuzip,nameaspartent,spchar,enumd,addencext,repcustext,addtstext,swzipx,
   defaulttabsmenu,multi_option,memuse_option,nonverboselog,skipdel,disableintscript,use7zunrar5,useextrac32,sort7zbytype,browsersd,userar,userar5,setrarmanual,userarblake2,
   userardict,userarsfx,userarsolid,userarrr,puserarrr,userarrv,puserarrv,userarsaveopen,userarsavesecurity,userarsavestreams,userarlastmodtime,
   userarlock,tmpremoveintdir,renselonly,renfilesonly,defaultspanning,spanunit,zpaqall,zpaqfull,zpaqabsolute,zpaqforce,
   dragtargetprotect,whenspecialopen,howspecialopen,ptsync,taskpriority,defaultactionst,displayfoldercontent,filterbrowser,
   immediate_execution,defaultarchiveaction,showsearchbar,tar_atomic,tar_atomic_convert,syntaxlevel7z,convint,
   qdup,restoretabbar,scripttarpipe,scriptuntarpipe,zstderr,executesmallbk,logcommands:byte;

   call_validated,keyf_opened,no_more_files,az,
   using_tarbefore,tarbeforenameexception,seemencrypted,imgloaded,imgloading,
   settingvalues,archiveopened,browsinghistory,filecopying,openstarted,dragcancelled,
   listingdir,control_listingdir,done_listingexe,waitdrawok,needwaitupdating,updatingarchive_inarchive,goarchiving,updatingarchive_sync,
   stayopen,completeshowpea,savetype,listviewcompleted,updatinglistview,updatingsel,rowselect,smartsortenabled,showmenu,
   thighlight,ccreated,caccessed,cmethod,ctype,csize,cpacked,cdate,catt,ccomment,ccrc,cfree,cfs,multiaddupdating,dontsavecustom7z,
   dontsavecustomzip,forceopenasarchive,skipapstatus,browserbusy,fromtree,spinchanged,
   swapbars,swaptab,treeonbutton,rightdropbutton,popupclosed,done_quickfunctions,contextconvert_switch,
   funflag,endflag,setbs,launchwithsemaphore,disable_twofactor,extselall,tmpenumd,uacneeded,
   cancellingarchive,nffromdrag,unrar5shown,unaceshown,restartingapp,needsave,is_searching,
   h_folders,nomatch,set_archivetree,aisexpanded,tmpextnf,settmpextnf,
   keeppreview,loadadvdefaults,havewinrar,singleextract,specialopen,pclicked,
   willbemoved,forcewillbemoved,forcenotwillbemoved,pdrop,prebrowsing,imported_tarbeforejob,
   darwinsimulatedrop,starttaberror,updatingconf,intdd,consolecl,piperar,settingadv,
   navbarhidden,pshowh,oafromgrid,frompc,dolistupdate,countingunits:boolean;

   activelabel_options,activelabel_add,activelabel_extract,activelabel_apps:TLabel;

   //system drag and drop
   disdrag,threadextracting,imdel:boolean;
   nativedrag:integer;
   {$IFDEF MSWINDOWS}
   vpatha,vpathb,vpath2,vpathname:ansistring;
   //drag and drop
   FDragObject:TDragObject;
   //semaphore
   psem,psemwait: THandle;
   {$ENDIF}

   lang_file:ansistring;
   //text strings
   txt_11_2_comp,txt_11_2_funexp,
   txt_11_1_pp,
   txt_11_0_native,txt_11_0_rendering,txt_11_0_sharp,txt_11_0_soft,txt_11_0_pr,txt_11_0_good,txt_11_0_strong,txt_11_0_vw,txt_11_0_w,txt_11_0_adv,txt_11_0_sch,txt_11_0_items,txt_11_0_bt,
   txt_10_9_deletearchive,txt_10_9_kfl,txt_10_9_mb,
   txt_10_8_untarerr,txt_10_8_params,txt_10_8_rv,txt_10_8_bk,txt_10_8_log,
   txt_10_7_errload,txt_10_7_errfile,txt_10_7_first,txt_10_7_fit,txt_10_7_fith,txt_10_7_fitw,txt_10_7_keep,txt_10_7_next,txt_10_7_prev,txt_10_7_pwh,txt_10_7_thumbnails,txt_10_7_images,
   txt_10_6_virtual,
   txt_10_5_ntfsalt,txt_10_5_type_description_rar,txt_10_5_sectype,txt_10_5_sectypewarning,txt_10_5_checkmotw,txt_10_5_sh,txt_10_5_fr,txt_10_5_pathlock,
   txt_10_4_moving,
   txt_10_3_classic,txt_10_3_m,txt_10_3_pm,txt_10_3_minimal,txt_10_3_ascii,txt_10_3_aw,
   txt_10_2_savecopy,
   txt_10_1_full,txt_10_1_under,txt_10_1_kdfw,
   txt_10_0_exptrash,txt_10_0_comp,txt_10_0_ptarzst,txt_10_0_ptargz,txt_10_0_ptarxz,txt_10_0_save,txt_10_0_tp,
   txt_9_9_uac,txt_9_9_utc,TXT_9_9_kdf,
   txt_9_8_fnew,txt_9_8_fsmart,txt_9_8_alwaysflat,
   txt_9_7_tarpipe,txt_9_7_smartsorting,
   txt_9_6_centered,txt_9_6_loadpconfirm,txt_9_6_loadp,txt_9_6_saveppw,txt_9_6_savepoverwrite,txt_9_6_savep,txt_9_6_cside,txt_9_6_scside,
   txt_9_5_all,txt_9_5_precond,txt_9_5_largea,txt_9_5_mediuma,txt_9_5_smalla,txt_9_5_reopentab,txt_9_5_savetabs,txt_9_5_sb,
   txt_9_4_savecomment,txt_9_4_hintcomment,txt_9_4_r,txt_9_4_rw,
   txt_9_3_contrast,txt_9_3_continue,txt_9_3_fsd,txt_9_3_fsw,txt_9_3_canedit,txt_9_3_canforce,txt_9_3_cannotedit,txt_9_3_mrar,
   txt_9_2_7za,txt_9_2_swt,txt_9_2_tfaq,txt_9_2_doc,txt_9_2_updates,txt_9_2_compact,txt_9_2_changelog,txt_9_2_tos,
   txt_9_1_7zs,txt_9_1_ac,txt_9_1_ef,txt_9_1_enlargeicons,txt_9_1_nw,txt_9_1_qdup,txt_9_1_closeall,
   txt_9_0_tnav,txt_9_0_showmainmenu,txt_9_0_navmenu,txt_9_0_accesstime,txt_9_0_hl,txt_9_0_sl,txt_9_0_mem,txt_9_0_autoexttar,txt_9_0_plugind,txt_9_0_df,
   txt_8_9_empty,txt_8_9_ttb,txt_8_9_stoptest,txt_8_9_disp,txt_8_9_parsing,
   txt_8_8_snz,txt_8_8_snoi,txt_8_8_snon,txt_8_8_altt,txt_8_8_light,txt_8_8_autotest,txt_8_8_ca,txt_8_8_cb,txt_8_8_centered,txt_8_8_cw,txt_8_8_btn,txt_8_8_lnk,txt_8_8_tab,txt_8_8_sm,txt_8_8_solcol,txt_8_8_intnote,
   txt_8_7_csvhelp,txt_8_7_csv,txt_8_7_showsearchbar,txt_8_7_verifybin,txt_8_7_hok,txt_8_7_hnotok,txt_8_7_after,txt_8_7_mo,txt_8_7_bintest,txt_8_7_showhm,txt_8_7_showsm,
   txt_8_6_clear,txt_8_6_noclear,txt_8_6_nosimple,txt_8_6_immediate,txt_8_6_yessimple,
   txt_8_5_detailslarge,txt_8_5_listlarge,txt_8_5_intext,txt_8_5_advbrowser,txt_8_5_loadlayout,txt_8_5_samplescripts,
   txt_8_4_keepopenerrorslist,
   txt_8_3_prefalgo,txt_8_3_mbubin,txt_8_3_mbudec,txt_8_3_mbu,txt_8_3_maxarg,txt_8_3_skipdel,txt_8_3_cw,txt_8_3_lw,txt_8_3_temperature,txt_8_3_htab,txt_8_3_noupx,
   txt_8_2_slower,txt_8_2_df,txt_8_2_vreport,txt_8_2_alltimes,txt_8_2_supportedby,txt_8_2_keep,txt_8_2_skipet,txt_8_2_ta,txt_8_2_tc,txt_8_2_tm,
   txt_8_1_volumes,txt_8_1_ed,txt_8_1_slow,txt_8_1_preparse,txt_8_1_nopreparse,txt_8_1_preparsehint,txt_8_1_bo,txt_8_1_bop,txt_8_1_togglearc,txt_8_1_vslow,
   txt_8_0_altcol,txt_8_0_commonalgo,txt_8_0_forcebrowse,txt_8_0_forceconvert,txt_8_0_forcetyping,txt_8_0_forcetypinghelp,txt_8_0_setpwopt,txt_8_0_defaultaction,txt_8_0_defaultactionhint,txt_8_0_enableextand,
   txt_7_9_spacing,txt_7_9_zooming,
   txt_7_8_dd,txt_7_8_custext,txt_7_8_rel,txt_7_8_priorityhigh,txt_7_8_priorityidle,txt_7_8_prioritynormal,txt_7_8_priorityrealtime,txt_7_8_tpriority,txt_7_8_requirerestart,txt_7_8_changelocalization,
   txt_7_7_sys7zreq,txt_7_7_sys7z,txt_7_7_nonetemp,txt_7_7_outtemp,txt_7_7_tw,txt_7_7_noneall,
   txt_7_6_zipenc,txt_7_6_custenc,txt_7_6_forcelocalenc,txt_7_6_forceutf8enc,txt_7_6_defaultenc,txt_7_6_setcurdef,txt_7_6_setdef,txt_7_6_cpnote,txt_7_6_tacolor,txt_7_6_color,txt_7_6_dim,txt_7_6_dark,txt_7_6_tno,txt_7_6_tadvanced,txt_7_6_tsimple,txt_7_8_destexistfile,txt_7_8_update,
   txt_7_5_autoclosesingle,txt_7_5_dragnone,txt_7_5_draglock,txt_7_5_draghide,txt_7_5_draglh,txt_7_5_specialbrowse,txt_7_5_ee,txt_7_5_always,txt_7_5_ask,txt_7_5_never,txt_7_5_cutlen,txt_7_5_cutlenw,txt_7_5_repnascii,
   txt_7_4_tcurr,txt_7_4_tkeep,txt_7_4_7zfbrotlicomp,txt_7_4_7zfzstandardcomp,txt_7_4_lock,txt_7_4_locked,txt_7_4_presetrar,txt_7_4_comment,txt_7_4_recover,txt_7_4_lockconfirm,txt_7_4_setarc,txt_7_4_setext,txt_7_4_swzipx,
   txt_7_3_profile7zfastest,txt_7_3_profile7zfast,txt_7_3_maxbr,txt_7_3_maxzstd,txt_7_3_stl,txt_7_3_archiveerrors,txt_7_3_archiveerrorshint,txt_7_3_noconfdel,txt_7_3_clickextall,
   txt_7_2_altcomp,txt_7_2_clearnoupdate,txt_7_2_autoclosepeazip,txt_7_2_zpaqall,txt_7_2_extcomp,txt_7_2_extcompultra,txt_7_2_fbrotlicomp,txt_7_2_fzstandardcomp,txt_7_2_loadcompsettings,txt_7_2_savecompsettings,txt_7_2_source,txt_7_2_updateclear,
   txt_7_1_type_description_brotli,txt_7_1_typetosearch,txt_7_1_type_description_zstd,txt_7_1_profileintermediate,txt_7_1_renfilesonly,txt_7_1_smart,txt_7_1_new,
   txt_7_0_autoopentar,txt_7_0_exttmppath,txt_7_0_af,
   txt_6_9_autou,txt_6_9_uconf,txt_6_9_opuns,txt_6_9_forceu,txt_6_9_overarch,
   txt_6_8_ndrop,txt_6_7_nop,txt_6_6_pdupfound,txt_6_6_rsh,txt_6_6_pdupfind,txt_6_6_forcemodify,
   txt_6_5_sni,txt_6_5_sns,txt_6_5_mandatory,txt_6_5_askp,txt_6_5_privacy,txt_6_5_nop,
   txt_6_5_chp,txt_6_5_np,txt_6_5_def,txt_6_5_abort,txt_6_5_error,txt_6_5_yesall,
   txt_6_5_yes,txt_6_5_warning,txt_6_5_seqerr,txt_6_5_showvolatile,txt_6_5_force,
   txt_6_4_tabbar,txt_6_4_new,txt_6_4_closeallother,txt_6_4_closeright,
   txt_6_4_collapse,txt_6_4_expand,txt_6_4_openintab,
   txt_6_4_paths,txt_6_4_relative,txt_6_4_full,txt_6_4_absolute,txt_6_4_appdirn,txt_6_4_prepdirn,
   txt_6_3_uar,txt_6_3_syn,txt_6_3_autoadjust,txt_6_3_cinfo,
   txt_6_2_encext,txt_6_2_archive,txt_6_2_container,txt_6_1_ec,txt_6_0_msq,
   txt_5_9_lff,txt_5_9_pff,txt_5_9_start,
   txt_5_8_ascii,txt_5_8_cp,txt_5_8_utf,txt_5_8_l0,txt_5_8_l1,txt_5_8_l2,txt_5_8_fs,txt_5_8_fsr,
   txt_5_7_pinstalled,txt_5_7_pmissing,txt_5_7_plugin,
   txt_5_6_exarc,txt_5_6_upexisting,txt_5_6_layouts,txt_5_6_rc,txt_5_6_basic,txt_5_6_verbose,
   txt_5_6_tab,
   txt_5_5_case,txt_5_5_add,txt_5_5_ext,txt_5_5_halt,txt_5_5_replaceneww,txt_5_5_plugin,
   txt_5_5_lower,txt_5_5_newext,txt_5_5_new,txt_5_5_old,txt_5_5_delete,txt_5_5_replacestr,
   txt_5_5_replaceoldw,txt_5_5_upper,txt_5_5_extw,txt_5_5_intdir,txt_5_5_string,
   txt_5_5_n,txt_5_5_position,txt_5_5_positionw,txt_5_5_positionwd,txt_5_5_starting,
   txt_5_5_similar,txt_5_5_select,txt_5_5_addsel,txt_5_5_subtractsel,txt_5_5_copypath,
   txt_5_5_datesameday,txt_5_5_datesamehour,txt_5_5_datesamemonth,txt_5_5_datesameweek,txt_5_5_datesameyear,
   txt_5_5_datehour,txt_5_5_datemonth,txt_5_5_dateweek,txt_5_5_dateyear,txt_5_5_dateday,
   txt_5_5_scan,
   txt_5_4_da,txt_5_4_lv,txt_5_4_used,txt_5_4_deletearchives,txt_5_4_deleteoriginal,
   txt_5_4_deletearchivesconfirm,txt_5_4_deletefiles,txt_5_4_deletefilesconfirm,
   txt_5_3_cml,txt_5_3_cmlmessage,txt_5_3_resetsi,txt_5_3_ia,txt_5_3_io,txt_5_3_rec,txt_5_3_exc,
   txt_5_2_oadd,txt_5_2_oext,txt_5_2_zerofiles,txt_5_2_zerofree,txt_5_2_securedeletefree,txt_5_2_zerodelete,
   txt_5_2_zfree,txt_5_2_sdfree,txt_5_2_free,txt_5_3_profilebest, txt_5_3_profileadvanced,
   txt_5_3_profilenormal, txt_5_3_profileveryfast, txt_5_3_profilepassword, txt_5_3_profile10mb,
   txt_5_3_profilesfx,
   txt_5_1_schedexplain,txt_5_1_schedname,txt_5_1_schedule,txt_5_1_hourly,txt_5_1_daily,txt_5_1_weekly,
   txt_5_1_monthly,txt_5_1_once,txt_5_1_onstart,txt_5_1_onlogin,txt_5_1_every,txt_5_1_hours,txt_5_1_day,txt_5_1_days,
   txt_5_1_weeks,txt_5_1_months,txt_5_1_w1,txt_5_1_w2,txt_5_1_w3,txt_5_1_w4,txt_5_1_w5,txt_5_1_w6,txt_5_1_w7,
   txt_5_1_last,txt_5_1_starttime,txt_5_1_startdate,txt_5_1_enddate,txt_5_1_schedmanage,txt_5_1_schedadd,
   txt_5_1_schederr,txt_5_1_schedok,txt_5_1_scriptmanage,txt_5_1_schedscripts,txt_5_1_ts,
   txt_5_0_bc,txt_5_0_resetpm,txt_5_0_enum,txt_5_0_ps,txt_5_0_sh,txt_5_0_skip,txt_5_0_perf,txt_5_0_music,txt_5_0_pictures,txt_5_0_removeall,txt_5_0_resetbookmarks,txt_5_0_videos,
   txt_4_9_frame,txt_4_9_listth,txt_4_9_shadow,txt_4_9_style,
   txt_4_8_presets,txt_4_8_listno,txt_4_8_detailsno,txt_4_8_details,txt_4_8_iconm,txt_4_8_iconl,
   txt_4_8_crop,txt_4_8_fullscreen,txt_4_8_fun,txt_4_8_immersive,txt_4_8_resize,txt_4_8_rr,txt_4_8_rl,
   txt_4_8_imagemanager,txt_4_8_flip,txt_4_8_mirror,txt_4_8_replace,txt_4_8_fit,txt_4_8_fitl,
   txt_4_8_h,txt_4_8_noresize,txt_4_8_aspect,txt_4_8_w,txt_4_8_stop,txt_4_8_t,txt_4_8_attach25,
   txt_4_8_keeparchive,
   txt_4_7_pcomp,txt_4_7_pk,txt_4_7_spchar,txt_4_7_recycle,txt_4_7_recycleask,
   txt_4_6_am,txt_4_6_fm,txt_4_6_users,
   txt_4_5_dock,txt_4_5_l,txt_4_5_t,txt_4_5_r,txt_4_5_b,txt_4_5_pj,txt_4_5_update,txt_4_5_noupdate,txt_4_5_goupdate,txt_4_5_koupdate,
   txt_4_5_upxpj, txt_4_5_properties, txt_4_5_shaddress, txt_4_5_shnav, txt_4_5_shstatus, txt_4_5_shtool,
   txt_4_4_confremove, txt_4_4_confremoveall,
   txt_4_3_keeppw, txt_4_3_recsrc, txt_4_3_breadcrumb, txt_4_3_pwman,
   txt_4_3_pwmanhint,txt_4_3_pwmanpwhint,txt_4_3_pwmanmaster, txt_4_3_pwmanlist,
   txt_4_3_exppl, txt_4_3_expple, txt_4_3_expplp, txt_4_3_pwmancorr, txt_4_3_resetpm,
   txt_4_2_arcabspath,
   txt_4_1_duplicateshint, txt_4_1_selected, txt_4_1_duplicatesfound, txt_4_1_duplicatesfind,
   txt_4_1_simplesearch,txt_4_1_runasadmin,txt_4_1_adminhint,
   txt_4_0_thim,
   txt_3_8_type_description_wim,txt_3_8_type_description_xz,
   txt_3_7_donations,txt_3_7_sort,txt_3_7_swapbars,txt_3_7_themedbars,txt_3_7_nameasparent,
   txt_3_7_tracker,
   txt_3_6_close,txt_3_6_resetapps,txt_3_6_ignoredd,txt_3_6_ethemes,
   txt_3_5_td,txt_3_5_managecustomthemes,
   txt_3_4_smallicons,txt_3_4_nopaths,
   txt_3_3_run,txt_3_3_runexp,txt_3_3_skipunits,txt_3_3_apppath,txt_3_3_apps,txt_3_3_stralt,
   txt_3_3_multi,
   txt_3_2_conf,txt_3_2_7zutf8nonascii,txt_3_2_donations,txt_3_2_alltasks,
   txt_3_1_sccenc,txt_3_1_languagetools,txt_3_1_lib,txt_3_1_recent,txt_3_1_src,txt_3_1_more,
   txt_3_1_sendto,txt_3_1_openasarchive,txt_3_1_downloads,txt_3_1_pathexc,txt_3_1_plsmartmin,
   txt_3_1_workingdir,txt_3_1_systmp,
   txt_3_0_nonreadableorpw,txt_3_0_readablepw,txt_3_0_resettmp,txt_3_0_configure,
   txt_2_9_address,txt_2_9_selected,txt_2_9_public,txt_2_9_organize,txt_2_9_lt,txt_2_9_mt,txt_2_9_st,
   txt_2_9_copyhere,txt_2_9_movehere,txt_2_9_columns,
   txt_2_9_noscan,txt_2_9_vst,txt_2_9_thl,txt_2_9_toolbar,txt_2_9_test_pw2G,txt_2_9_adv,
   txt_2_9_extconsole,txt_2_9_rec,txt_2_9_views,txt_2_9_none,txt_2_9_showmenu,txt_2_9_setapps,
   txt_2_9_nav,txt_2_9_navbar,txt_2_9_showtool,txt_2_9_tree,txt_2_9_home,
   txt_2_8_experimental,txt_2_8_zcopy,txt_2_8_addvol,txt_2_8_uniterror,txt_2_8_cannotconvert,
   txt_2_8_convertbegin,txt_2_8_convert,txt_2_8_convertexisting,txt_2_8_details,
   txt_2_8_convertdelete,txt_2_8_parallel,txt_2_8_convertnote,txt_2_8_unitrecommend,
   txt_2_8_viewasarchive,txt_2_8_nounit,txt_2_8_rowselect,
   txt_2_8_typeunit,txt_2_8_usedefaultoutpath,txt_2_8_statusbar,txt_2_8_custom,
   txt_2_7_encfn,txt_2_7_validatecl,txt_2_7_validatefn,txt_2_7_cancel,txt_2_7_ok,
   txt_2_7_separate,txt_2_7_output,txt_2_7_archivehint,txt_2_7_optional,txt_2_7_pwnotset,
   txt_2_7_pwarcset,txt_2_7_pwextset,txt_2_7_setpw,txt_2_7_pwsupported,
   txt_2_7_extfrom,txt_2_7_ext,txt_2_7_updating,txt_2_7_goarclayout,txt_2_7_goextlayout,
   txt_2_7_setadvf,txt_2_7_selpath,txt_2_7_dirsize,txt_2_7_exthint,
   txt_2_7_clipboard,txt_2_7_noinput,txt_2_7_es,txt_2_7_eu,txt_2_7_separateerror,
   txt_2_7_drag_archive,txt_2_7_list_tryflatorpw,txt_2_7_un7z_browse_flat,txt_2_7_oop,
   txt_2_7_experimental,
   txt_2_6_folders,txt_2_6_plalways,
   txt_2_6_plsmart,txt_2_6_advanced,
   txt_2_5_sessionio,txt_2_5_advanced,txt_2_5_basic,txt_2_5_cannotrun,txt_2_5_custeditors,
   txt_2_5_delete,txt_2_5_delete_fromarchive,txt_2_5_langflag,txt_2_5_encpj,
   txt_2_5_execommand,txt_2_5_help,txt_2_5_langhint,
   txt_2_5_mini_help,txt_2_5_offline_help,txt_2_5_tray,txt_2_5_remove,txt_2_5_hintpaths,
   txt_2_5_selectapp,txt_2_5_strafter,txt_2_5_strbefore,txt_2_5_encoding,
   txt_2_5_nopw,
   txt_2_4_itemsheight,txt_2_4_tb,txt_2_4_deletebookmarks,txt_2_4_totalmem,txt_2_4_operation,
   txt_2_4_advclip,txt_2_4_stdclip,txt_2_4_copyfrom,txt_2_4_extractfrom,
   txt_2_4_draghint,txt_2_4_clearclipboard,txt_2_4_removefromclipboard,txt_2_4_path,
   txt_2_4_adding,txt_2_4_documents,txt_2_4_hexp,txt_2_4_gvideo,txt_2_4_wenc,txt_2_4_yanswers,
   txt_2_4_wdict,txt_2_4_wbook,txt_2_4_wsrc,txt_2_4_wcommons,txt_2_4_wnews,
   txt_2_3_pw_errorchar,txt_2_3_envstr,txt_2_3_never_pw,txt_2_3_home,txt_2_3_on_pw,txt_2_3_test_pw100,txt_2_3_test_pw,
   txt_list_isfolder,txt_action_extopen,txt_error_passwordnotmatch,txt_action_preview,
   txt_preview_hint,txt_removeselected,txt_savelayout,txt_better,txt_default2,txt_faster,
   txt_fastermem,txt_tempdir,txt_stream,txt_slowermem,txt_store,txt_newfolder,
   txt_7z_exitcodeunknown,
   txt_none,txt_fd,txt_7z_exitcode1,txt_attach10,txt_7z_exitcode2,
   txt_7z_exitcode255,txt_fat32,txt_dvd,txt_attach5,txt_cd650,txt_7z_exitcode7,txt_cd700,
   txt_type_description_7z,txt_dvddl,txt_7z_exitcode8,txt_abort,txt_about,txt_action,
   txt_action_hint,txt_add,txt_add_existing_archive,txt_add_archive,
   txt_add_files,txt_add_folder,txt_add_path,txt_add_tolayout,txt_add_toarchive,txt_add_tobookmarks,
   txt_address_hint,txt_adv_filters,txt_algo,txt_all,txt_all_default,txt_all_type,
   txt_all_date,txt_all_psize,txt_all_attributes,txt_all_size,txt_error_input_upx,
   txt_always_pw,txt_ignore_ext,txt_ignore_disp,txt_ignore_sel,txt_key_hint,
   txt_timestamp,txt_appoptions,txt_type_description_arc,txt_archive,txt_un7z_browse_ok,
   txt_interface,txt_archivecreation,txt_tarbefore_hint,
   txt_archive_hint,txt_compressionratio_hint,txt_archiving,txt_cl_long,txt_overwrite_askbefore,
   txt_associated,txt_attributes,txt_author,txt_ren_existing,txt_ren_extracted,txt_autofolder,
   txt_back,txt_backend,txt_backupexe,txt_bettercompression,txt_blogs,txt_blowfish,
   txt_bookmarks,txt_browse,txt_browser,txt_aborted_error,txt_list_browsing,
   txt_archive_root,txt_type_description_bzip2,txt_pw_empty,txt_add_error,txt_un7z_browse_failure,
   txt_list_error,txt_conf_cannotsave,txt_check_hint,txt_check,txt_check_select,txt_clear,
   txt_clearlayout,txt_pj_hint,txt_autoclose,txt_cl,txt_compare,txt_compress,
   txt_compress_executable,txt_compress_openforwriting,txt_compression,txt_compmanagement,
   txt_pw_confirm,txt_console,txt_console_interface,txt_content,
   txt_controlpanel,txt_copy,txt_copyto,txt_create,txt_create_archive,txt_title_create,
   txt_create_keyfile,txt_create_folder,txt_create_theme,txt_rr,txt_create_sfx,txt_cr_current,
   txt_custom,txt_type_description_custom,txt_customapp,txt_custom_parameters,txt_customsize,
   txt_cut,txt_datetime,txt_default,txt_default_compression,
   txt_default_format,txt_theme_default,
   txt_hard_reset_hint,txt_desktop,txt_dictionary,txt_dirs,txt_dis,txt_disk_cleanup,
   txt_disk_defrag,txt_disk_management,txt_dispaly,txt_displayedmnu_obj,txt_displayedobjects,
   txt_nocompress,txt_delete,txt_wipe,txt_done,txt_edit,txt_elapsed,
   txt_error_emptycl,txt_encrypt,txt_encrypted,txt_encryption,txt_note,
   txt_random_keys,txt_random_keys_hint,txt_ent,txt_ent_tools,txt_eqorlarger,
   txt_eqorrecent,txt_eqorolder,txt_eqorsmaller,txt_equal,txt_erase_hint,txt_extraction_error,
   txt_exclude_hint,txt_exclude_recourse,txt_exclusion_recourse,txt_exclusion,txt_exe,
   txt_overwrite_qry,txt_confirm_overwrite,txt_explore_outpath,txt_explore_path,txt_ext,
   txt_caption_extract,txt_ext_nopath,txt_ext_all,txt_ext_allhere,txt_ext_allto,txt_extopen_custom,
   txt_extopen_with,txt_ext_disp_here,txt_ext_disp,txt_ext_disp_to,txt_ext_here,txt_ext_sel_here,
   txt_ext_sel,txt_ext_sel_to,txt_extobj,txt_newfoldermenu,txt_extto,txt_level_fast,
   txt_fastcompr,txt_fastopen,txt_level_fastest,txt_favformats,txt_file,txt_filebrowser,
   txt_filelist_savedas,txt_filetools,txt_files,txt_nfiles,txt_fs,
   txt_filters_recourse,txt_filters,txt_flat,txt_list_flat,txt_unit_floppy,txt_foldername,
   txt_nfolders,txt_error_input_multi,txt_fwd,txt_list_found,txt_free,
   txt_free2,txt_name_full,txt_function,txt_general,txt_multithreading,
   txt_go_browser,txt_go_path,txt_guicl,txt_guipealauncher,txt_graphic,
   txt_gridaltcolor,txt_gridrowheight,txt_gui,txt_type_description_gzip,txt_hardreset,
   txt_here,txt_list_history,txt_homeroot,txt_quickbrowse_hint,
   txt_backupexe_hint,txt_attach,txt_images,txt_include_hint,txt_filters_hint,txt_inclusion_recourse,
   txt_inclusion,txt_error_function,txt_info,txt_infoall,txt_infodisp,txt_infosel,
   txt_inputinfo,txt_input_list,txt_iop,txt_ipo,txt_input,txt_integrity,txt_chunk_size,
   txt_invertsel,txt_type_exe,txt_return_to_archive,txt_not_accessible,txt_type_unsupported,
   txt_checkname_failed,txt_not_accessible_list,txt_theme_create_error,txt_theme_exists,
   txt_job_code,txt_job_definition_saved,txt_job_success,txt_join,txt_joinfiles,
   txt_keyfile,txt_keyfile_not_found,txt_keyfile_notcreated,txt_larger,
   txt_lastused,txt_launch,txt_layout,txt_level,txt_license,txt_caption_list,txt_list_details,
   txt_list_all,txt_list_disp,txt_list_sel,txt_toggle_warning,txt_loadfile,txt_loadlayout,
   txt_unit_hd,txt_localization,txt_lpaqver,txt_type_description_lpaq,txt_maininterface,
   txt_maxcomp,txt_level_maximum,txt_restartrequired,txt_required_memory,
   txt_method,txt_misc,txt_modify,txt_morecontrols,txt_morerecent,
   txt_ent_hint,txt_moveto,txt_mypc,txt_list_na,txt_name,txt_naming,txt_unit_remote,
   txt_newarchive,txt_news,txt_no,txt_noinput,txt_nocompress_hint,
   txt_split_noinput,txt_open_noinput,txt_list_nomatch,txt_singlethread,txt_none2,
   txt_nonsolid,txt_level_normal,txt_copy_error,txt_description,txt_compare_second,
   txt_peaobj,txt_displayed_obj,txt_olderthan,txt_ondblclick,
   txt_opacity,txt_open,txt_openarchive,txt_title_open,txt_open_bookmark,txt_cphere,
   txt_open_file,txt_open_files,txt_open_path,txt_opensource,txt_openwith,
   txt_aborted,txt_unit_cd,txt_options,txt_other,txt_otherparams,
   txt_oip,txt_opi,txt_output,txt_overwrite,txt_compressed_size,txt_paqver,
   txt_type_description_paq,txt_pio,txt_poi,txt_parameters,txt_error_partial,
   txt_passes,txt_pw,txt_pwlength,txt_un7z_browse_pw,txt_un7z_browse_pw_other,txt_paste,
   txt_path,txt_pea_appcolor,txt_pea_textcolor,txt_type_description_pea,txt_peazip_new,
   txt_peazip_help,txt_peazip_web,txt_performall,txt_upxorstrip,
   txt_not_removable_file,txt_not_removable,txt_custom_executable_missing,
   txt_type_unsupported_select,txt_no_theme_name,txt_please_wait,txt_copy_wait,txt_previewwith,
   txt_projectadmin,txt_type_description_quad,txt_quickdelete,txt_quit,txt_unit_ram,
   txt_read,txt_recentarchives,txt_rr_hint,txt_search_refine,txt_fefreshf5,
   txt_release,txt_unit_removable,txt_remove_bookmark,txt_remove_external_unit,
   txt_rename,txt_caption_repair,txt_restartrequired2,txt_reset,txt_reset_archivename,
   txt_reset_theme,
   txt_restore_att,txt_run_as,txt_run_as2,txt_sample,
   txt_saveas,txt_savehistory,txt_save_infolder,txt_savejob,txt_savejobdefinition,
   txt_savejobdefinition_hint,txt_save_winstate,
   txt_search,txt_searchanddrag,txt_nrsearch,txt_search_hint,txt_search_web,txt_list_searching,
   txt_securedelete,txt_default_description,txt_selectall,txt_selectdir,
   txt_selected_obj,txt_selected_objects,txt_sfx,txt_sendbymail,txt_set_defaults,
   txt_settings,txt_sfx_interface,txt_showhints,
   txt_show_messages,txt_showpw,txt_singlevol,txt_size,txt_sizeb,txt_skip_existing,
   txt_slowercomp,txt_smaller,txt_solid,txt_solid_block,txt_solid_auto,txt_solid_extension,
   txt_listtest,txt_sortbysel,txt_list_sorting,
   txt_speed,txt_split,txt_type_description_split,txt_split_file,txt_list_nostats,
   txt_status,txt_level_store,txt_stream_control,txt_strip,txt_keyfile_created,txt_suggestpw,
   txt_noupx,txt_syntax,txt_sysbenchmark,txt_benchmark,txt_systools,txt_tarbefore,
   txt_type_description_tar,txt_taskman,txt_caption_test,txt_testall,txt_testdisp,
   txt_testpw,txt_testsel,txt_col_hint,txt_bookmarks_hint,txt_archive_noinput_tolist,
   txt_theme,txt_icons_found,txt_themename,txt_icons_not_found,txt_theme_create_success,
   txt_theming,txt_extand_error,txt_threads,txt_titlescolor,
   txt_to,txt_toggle_browseflat,txt_toggle_historybookmarks,txt_toolbarscolor,txt_tools,
   txt_best,txt_type,txt_level_ultra,txt_error_openfile,txt_cl_hint,
   txt_ace_missing,txt_units,txt_unit_unknown,txt_un7z_pw_untested,txt_up,txt_update,
   txt_type_description_upx,txt_advfilters,txt_openfiles_hint,txt_usenet,txt_user_name,
   txt_using,txt_volumepea,txt_volume_size,txt_type_ext_uns,txt_websites,
   txt_word,txt_write,txt_ramdompw_hint,txt_exe_hint,
   txt_pj_hint2,txt_type_description_zip,txt_zipcrypto_hint,txt_name_provide,txt_cnewfolder,
   txt_searchfor,txt_websearch,txt_on,txt_convert:ansistring;

implementation

{ TFormPeach }

{///////////////////////////////////////////////////////////////////////////////

subsection GUI CLONE MENUS

///////////////////////////////////////////////////////////////////////////////}

function CloneMenuItem(Src: TMenuItem; mode:integer): TMenuItem;//generic cloning method modified for PeaZip menus; mode 0 for generic menu, mode 1 for main menu
var
  i: Integer;
begin
  if Src=nil then Exit;
  Result:=TMenuItem.Create(Src.Owner);
  Result.Caption:=Src.Caption;
  if Result.Caption='' then Result.Visible:=False;
  Result.ShortCut:=Src.ShortCut;
  Result.OnClick:=Src.OnClick;
  Result.Tag:=Src.Tag;
  Result.Checked:=Src.Checked;
  Result.RadioItem:=Src.RadioItem;
  if mode =0 then Result.Visible:=Src.Visible;
  if mode =0 then Result.Enabled:=Src.Enabled;
  Result.Bitmap:=Src.Bitmap;

  if prevpanel='open' then
     if Src.Name='mLayout' then
        begin
        Result.Enabled:=false;
        end;
  if (prevpanel='archive') or (prevpanel='extract') then
      case Src.Name of
         'mEdit', 'mBrowse', 'mOrganize':
         begin
         Result.Enabled:=false;
         end;
      end;
  case Src.Name of
     'mfun0', 'mfun', 'mtoggletool', 'mbrowser':
     begin
     Result.Visible:=false;
     Result.Enabled:=false;
     end;
  end;
  if Src.Name='pmshowstylemenu' then
     begin
     Result.Visible:=true;
     Result.Enabled:=true;
     end;

  {$IFNDEF MSWINDOWS}
  case Src.Name of
     'mthumbimages', 'mscheduledscripts', 'mtaskscheduler', 'MenuItem11', 'mAdmin', 'w7contextlang', 'mSystemIntegration':
     begin
     Result.Visible:=false;
     Result.Enabled:=false;
     end;
  end;
  {$ENDIF}
  for i:=0 to Src.Count-1 do
     Result.Add(CloneMenuItem(Src[i],mode));
end;

procedure CopyMenu(Src, Dst: TMenu); //copy main menu to popup menu
var
  i: Integer;
begin
  Dst.Items.Clear;
  Dst.Items.Add(CloneMenuItem(FormPeach.pmshowstylemenu,1));
  Dst.Items.Add(CloneMenuItem(FormPeach.Separator7,1));
  for i:=0 to Src.Items.Count-1 do
    Dst.Items.Add(CloneMenuItem(Src.Items[i],1));
end;

procedure CopyMenuItems(Src, Dst: TMenuItem; n:integer); //copy items between generic popup menus
var
  i: Integer;
begin
  Dst.Clear;
  for i:=0 to Src.Count-1 do
    begin
    if n<>0 then
       if i>n then exit;
    Dst.Add(CloneMenuItem(Src[i],0));
    end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GUI CUSTOM TABS

///////////////////////////////////////////////////////////////////////////////}

//general tabs
procedure exitlabel(var a: TLabel; var b:TShape);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then
   begin
   b.Brush.Color:=tabbrushcol;
   b.Pen.Color:=tabpencol;
   b.Pen.Style:=psSolid;
   end
else
   begin
   b.Brush.Color:=tabpencol;
   b.Pen.Color:=tabpencol;
   b.Pen.Style:=psSolid;
   end;
if (highlighttabs=1) or (highlighttabs=4) or (highlighttabs=5) then a.Font.Color:=clDefault else a.Font.Color:=pGray;
end;

procedure clicklabel(var a: TLabel; var b:TShape);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then
   begin
   b.Brush.Color:=StringToColor(color2);
   b.Pen.Color:=tabpencol;
   b.Pen.Style:=psSolid;
   end
else
   begin
   b.Brush.Color:=tablowcol;
   b.Pen.Color:=tabpencol;
   b.Pen.Style:=psSolid;
   end;
if ((alttabstyle=1) or (alttabstyle=4)) and ((highlighttabs=1) or (highlighttabs=4) or (highlighttabs=5)) then a.Font.Color:=ptextaccent else a.Font.Color:=clDefault;
end;

procedure enterlabel(var a: TLabel; var b:TShape);
begin
b.Brush.Color:=tabbrushhighcol;
b.Pen.Color:=tabpencol;
b.Pen.Style:=psSolid;
a.Font.Color:=clDefault;
end;

///add
procedure exitlabel_add(var a: TLabel; var b:TShape);
begin
if activelabel_add=a then exit;
exitlabel(a,b);
end;

procedure deselectlabels_add;
begin
with FormPeach do
begin
if (alttabstyle<>1) and (alttabstyle<>4) then
   begin
   exitlabel_add(LabelTitleAdd1,ShapeTitleAddb1);
   exitlabel_add(LabelTitleAdd2,ShapeTitleAddb2);
   exitlabel_add(LabelTitleAdd3,ShapeTitleAddb3);
   exitlabel_add(LabelTitleAdd4,ShapeTitleAddb4);
   end
else
   begin
   exitlabel_add(LabelTitleAdd1,Shapelinkadd1);
   exitlabel_add(LabelTitleAdd2,Shapelinkadd2);
   exitlabel_add(LabelTitleAdd3,Shapelinkadd3);
   exitlabel_add(LabelTitleAdd4,Shapelinkadd4);
   end;
end;
end;

procedure setlabelpanel_add(var a: Tlabel);
begin
with FormPeach do
begin
if a = LabelTitleAdd1 then setpanel_add(1);
if a = LabelTitleAdd2 then setpanel_add(2);
if a = LabelTitleAdd3 then setpanel_add(3);
if a = LabelTitleAdd4 then setpanel_add(4);
end;
end;

procedure clicklabel_add(var a: TLabel; var b:TShape);
begin
activelabel_add:=a;
deselectlabels_add;
clicklabel(a,b);
setlabelpanel_add(a);
end;

procedure enterlabel_add(var a: TLabel; var b:TShape);
begin
if activelabel_add=a then exit;
enterlabel(a,b);
end;

///extract
procedure exitlabel_extract(var a: TLabel; var b:TShape);
begin
if activelabel_extract=a then exit;
exitlabel(a,b);
end;

procedure deselectlabels_extract;
begin
with FormPeach do
begin
if (alttabstyle<>1) and (alttabstyle<>4) then
   begin
   exitlabel_extract(LabelTitleextract1,ShapeTitleextractb1);
   exitlabel_extract(LabelTitleextract2,ShapeTitleextractb2);
   exitlabel_extract(LabelTitleextract3,ShapeTitleextractb3);
   exitlabel_extract(LabelTitleextract4,ShapeTitleextractb4);
   end
else
   begin
   exitlabel_extract(LabelTitleextract1,Shapelinkextract1);
   exitlabel_extract(LabelTitleextract2,Shapelinkextract2);
   exitlabel_extract(LabelTitleextract3,Shapelinkextract3);
   exitlabel_extract(LabelTitleextract4,Shapelinkextract4);
   end;
end;
end;

procedure setlabelpanel_extract(var a: Tlabel);
begin
with FormPeach do
begin
if a = LabelTitleextract1 then setpanel_extract(1);
if a = LabelTitleextract2 then setpanel_extract(2);
if a = LabelTitleextract3 then setpanel_extract(3);
if a = LabelTitleextract4 then setpanel_extract(4);
end;
end;

procedure clicklabel_extract(var a: TLabel; var b:TShape);
begin
activelabel_extract:=a;
deselectlabels_extract;
clicklabel(a,b);
setlabelpanel_extract(a);
end;

procedure enterlabel_extract(var a: TLabel; var b:TShape);
begin
if activelabel_extract=a then exit;
enterlabel(a,b);
end;

///apps subpage
procedure exitlabel_apps(var a: TLabel; var b:TShape);
begin
if activelabel_apps=a then exit;
exitlabel(a,b);
end;

procedure deselectlabels_apps;
begin
with FormPeach do
begin
if (alttabstyle<>1) and (alttabstyle<>4) then
   begin
   exitlabel_apps(LabelTitleapps1,ShapeTitleAppsb1);
   exitlabel_apps(LabelTitleapps2,ShapeTitleAppsb2);
   end
else
   begin
   exitlabel_apps(LabelTitleapps1,Shapelinkapps1);
   exitlabel_apps(LabelTitleapps2,Shapelinkapps2);
   end;
end;
end;

procedure setpanel_apps(i:integer);
begin
case i of
   1: begin
   FormPeach.PanelApps1.Visible:=true;
   FormPeach.PanelApps2.Visible:=false;
   end;
   2: begin
   FormPeach.PanelApps1.Visible:=false;
   FormPeach.PanelApps2.Visible:=true;
   end;
end;
end;

procedure setlabelpanel_apps(var a: Tlabel);
begin
with FormPeach do
begin
if a = LabelTitleapps1 then setpanel_apps(1);
if a = LabelTitleapps2 then setpanel_apps(2);
end;
end;

procedure clicklabel_apps(var a: TLabel; var b:TShape);
begin
activelabel_apps:=a;
deselectlabels_apps;
clicklabel(a,b);
setlabelpanel_apps(a);
end;

procedure enterlabel_apps(var a: TLabel; var b:TShape);
begin
if activelabel_apps=a then exit;
enterlabel(a,b);
end;

///options
procedure exitlabel_options(var a: TLabel; var b: TShape);
begin
if activelabel_options=a then exit;
if ((highlighttabs=4) or (highlighttabs=5)) then a.Font.Color:=clDefault else a.Font.Color:=pGray;
b.Brush.Color:=FormPeach.PanelTitleOptions.Color;
end;

procedure deselectlabels_options;
begin
with FormPeach do
begin
exitlabel_options(LabelTitleoptions1,ShapeOptions1);
exitlabel_options(LabelTitleoptions2,ShapeOptions2);
exitlabel_options(LabelTitleoptions3,ShapeOptions3);
exitlabel_options(LabelTitleoptions4,ShapeOptions4);
exitlabel_options(LabelTitleoptions5,ShapeOptions5);
exitlabel_options(LabelTitleoptions6,ShapeOptions6);
exitlabel_options(LabelTitleoptions7,ShapeOptions7);
exitlabel_options(LabelTitleoptions8,ShapeOptions8);
end;
end;

procedure updatepluginstatus;
begin
if fileexists(binpath+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT) then
   begin
   unrar5pluginstatus:=txt_5_7_pinstalled;
   FormPeach.baboutremoveunrar.Visible:=true;
   end
else
   begin
   unrar5pluginstatus:=txt_5_7_pmissing;
   FormPeach.baboutremoveunrar.Visible:=false;
   end;
if fileexists(binpath+'unace'+DirectorySeparator+'unace'+EXEEXT) then
   begin
   unacepluginstatus:=txt_5_7_pinstalled;
   FormPeach.baboutremoveunace.Visible:=true;
   end
else
   begin
   unacepluginstatus:=txt_5_7_pmissing;
   FormPeach.baboutremoveunace.Visible:=false;
   end;
if fileexists(binpath+'lpaq'+DirectorySeparator+'lpaq1'+EXEEXT) then
addformatspluginstatus:=txt_5_7_pinstalled
else
addformatspluginstatus:=txt_5_7_pmissing;
FormPeach.LabelAbout.caption:=APPMAIN+' '+txt_release+' '+PEAZIPVERSION+PEAZIPREVISION+' - '+caption_build+char($0d)+char($0a)
        +txt_license+' LGPLv3, '+txt_projectadmin+' Giorgio Tani'+char($0d)+char($0a)
        +char($0d)+char($0a)
        +langstrhint+char($0d)+char($0a)
        +char($0d)+char($0a)
        +txt_using+char($0d)+char($0a)
        +APPLICATION_PEA+char($0d)+char($0a)
        +APPLICATION_7Z+char($0d)+char($0a)
        +APPLICATION_ZPAQ+char($0d)+char($0a)
        +APPLICATION_STRIP+char($0d)+char($0a)
        +APPLICATION_QUAD+char($0d)+char($0a)
        +APPLICATION_FREEARC+char($0d)+char($0a)
        +APPLICATION_BROTLI+char($0d)+char($0a)
        +APPLICATION_ZSTD+char($0d)+char($0a)
        +char($0d)+char($0a)
        +'Plugin:'+char($0d)+char($0a)
        +'PeaZip Additional Formats Plugin (LGPLv3) - '+addformatspluginstatus+char($0d)+char($0a)
        +APPLICATION_UNACE+' - '+unacepluginstatus+char($0d)+char($0a)
        +APPLICATION_UNRAR+' - '+unrar5pluginstatus+char($0d)+char($0a);
end;

procedure setlabelpanel_options(var a: Tlabel);
begin
with FormPeach do
begin
if a = LabelTitleoptions1 then PageOpt1.Visible:=true else PageOpt1.Visible:=false;
if a = LabelTitleoptions2 then PageOpt2.Visible:=true else PageOpt2.Visible:=false;
if a = LabelTitleoptions3 then PageOpt3.Visible:=true else PageOpt3.Visible:=false;
if a = LabelTitleoptions4 then PageOpt4.Visible:=true else PageOpt4.Visible:=false;
if a = LabelTitleoptions5 then PageOpt5.Visible:=true else PageOpt5.Visible:=false;
if a = LabelTitleoptions6 then PageOpt6.Visible:=true else PageOpt6.Visible:=false;
if a = LabelTitleoptions7 then PageOpt7.Visible:=true else PageOpt7.Visible:=false;
if a = LabelTitleoptions8 then begin PageOpt8.Visible:=true; updatepluginstatus; end else PageOpt8.Visible:=false;
end;
end;

procedure clicklabel_options(var a: TLabel; var b: TShape);
begin
activelabel_options:=a;
deselectlabels_options;
a.Font.Color:=clDefault;
if (alttabstyle<>1) and (alttabstyle<>4) then
   b.Brush.Color:=tabbrushcol
else
   b.Brush.Color:=tablowcol;
setlabelpanel_options(a);
end;

procedure enterlabel_options(var a: TLabel; var b: TShape);
begin
if activelabel_options=a then exit;
a.Font.Color:=clDefault;
b.Brush.Color:=tabbrushhighcol;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GUI SCALING set items size and spacing

///////////////////////////////////////////////////////////////////////////////}

procedure psetbuttonwidth(var btt:TSpeedButton; rsize:integer; ontheleft:boolean);
var w,h:integer;
begin
FormPeach.labelbsize.Caption:=btt.Caption;
FormPeach.labelbsize.GetPreferredSize(w,h,false,true);
FormPeach.labelbsize.Caption:='';
if ontheleft=true then w:=w+rsize*2+6
else w:=w+rsize+6;
if w<rsize*3 then w:=rsize*3;
btt.Width:=w;
end;

procedure settoolglyphtop;
begin
with FormPeach do
begin
ButtonUn7zaTest.Layout:=blGlyphTop;
ButtonUn7zaAdd.Layout:=blGlyphTop;
ButtonUn7zaTo.Layout:=blGlyphTop;
ButtonUn7zaConvert.Layout:=blGlyphTop;
ButtonCut.Layout:=blGlyphTop;
ButtonCopy.Layout:=blGlyphTop;
ButtonPaste.Layout:=blGlyphTop;
ButtonOpenWith.Layout:=blGlyphTop;
ButtonProperties.Layout:=blGlyphTop;
ButtonRename.Layout:=blGlyphTop;
ButtonRename1.Layout:=blGlyphTop;
ButtonDelete.Layout:=blGlyphTop;
ButtonDup.Layout:=blGlyphTop;
ButtonNF.Layout:=blGlyphTop;
ButtonDup1.Layout:=blGlyphTop;
ButtonImgResize.Layout:=blGlyphTop;
ButtonImgCrop.Layout:=blGlyphTop;
ButtonImgRL.Layout:=blGlyphTop;
ButtonImgRR.Layout:=blGlyphTop;
end;
end;

procedure settoolglyphleft;
begin
with FormPeach do
begin
ButtonUn7zaTest.Layout:=blGlyphLeft;
ButtonUn7zaAdd.Layout:=blGlyphLeft;
ButtonUn7zaTo.Layout:=blGlyphLeft;
ButtonUn7zaConvert.Layout:=blGlyphLeft;
ButtonCut.Layout:=blGlyphLeft;
ButtonCopy.Layout:=blGlyphLeft;
ButtonPaste.Layout:=blGlyphLeft;
ButtonOpenWith.Layout:=blGlyphLeft;
ButtonProperties.Layout:=blGlyphLeft;
ButtonRename.Layout:=blGlyphLeft;
ButtonRename1.Layout:=blGlyphLeft;
ButtonDelete.Layout:=blGlyphLeft;
ButtonDup.Layout:=blGlyphLeft;
ButtonNF.Layout:=blGlyphLeft;
ButtonDup1.Layout:=blGlyphLeft;
ButtonImgResize.Layout:=blGlyphLeft;
ButtonImgCrop.Layout:=blGlyphLeft;
ButtonImgRL.Layout:=blGlyphLeft;
ButtonImgRR.Layout:=blGlyphLeft;
end;
end;

procedure settoolmargin;
begin
with FormPeach do
begin
ButtonUn7zaTest.Margin:=-1;
ButtonUn7zaAdd.Margin:=-1;
ButtonUn7zaTo.Margin:=-1;
ButtonUn7zaConvert.Margin:=-1;
ButtonCut.Margin:=-1;
ButtonCopy.Margin:=-1;
ButtonPaste.Margin:=-1;
ButtonOpenWith.Margin:=-1;
ButtonProperties.Margin:=-1;
ButtonRename.Margin:=-1;
ButtonRename1.Margin:=-1;
ButtonDelete.Margin:=-1;
ButtonDup.Margin:=-1;
ButtonNF.Margin:=-1;
ButtonDup1.Margin:=-1;
ButtonImgResize.Margin:=-1;
ButtonImgCrop.Margin:=-1;
ButtonImgRL.Margin:=-1;
ButtonImgRR.Margin:=-1;
end;
end;

procedure settoolspacing(n:integer);
begin
with FormPeach do
begin
ButtonUn7zaTest.Spacing:=n;
ButtonUn7zaAdd.Spacing:=n;
ButtonUn7zaTo.Spacing:=n;
ButtonUn7zaConvert.Spacing:=n;
ButtonCut.Spacing:=n;
ButtonCopy.Spacing:=n;
ButtonPaste.Spacing:=n;
ButtonOpenWith.Spacing:=n;
ButtonProperties.Spacing:=n;
ButtonRename.Spacing:=n;
ButtonRename1.Spacing:=n;
ButtonDelete.Spacing:=n;
ButtonDup.Spacing:=n;
ButtonNF.Spacing:=n;
ButtonDup1.Spacing:=n;
ButtonImgResize.Spacing:=n;
ButtonImgCrop.Spacing:=n;
ButtonImgRL.Spacing:=n;
ButtonImgRR.Spacing:=n;
end;
end;

procedure settoolbigicon;
begin
with FormPeach do
begin
ButtonUn7zaTest.Glyph:=Btestall_big;
ButtonUn7zaAdd.Glyph:=Barchive_big;
ButtonUn7zaTo.Glyph:=Bextractall_big;
ButtonUn7zaConvert.Glyph:=Bconvert_big;
ButtonCut.Glyph:=BTool_cut;
ButtonCopy.Glyph:=BTool_copy;
ButtonPaste.Glyph:=BTool_paste;
ButtonOpenWith.Glyph:=BTool_openw;
ButtonProperties.Glyph:=BTool_properties;
ButtonRename.Glyph:=BTool_rename;
ButtonRename1.Glyph:=BTool_rename;
ButtonDelete.Glyph:=BTool_delete;
ButtonDup.Glyph:=BTool_dup;
ButtonNF.Glyph:=Bdetailsfs;
ButtonDup1.Glyph:=BTool_dup;
ButtonImgResize.Glyph:=BTool_resize;
ButtonImgCrop.Glyph:=BTool_crop;
ButtonImgRL.Glyph:=BTool_rl;
ButtonImgRR.Glyph:=BTool_rr;
end;
end;

procedure settoolsmallicon;
begin
with FormPeach do
begin
ButtonUn7zaTest.Glyph:=Btestall;
ButtonUn7zaAdd.Glyph:=Barchive;
ButtonUn7zaTo.Glyph:=Bextractall;
ButtonUn7zaConvert.Glyph:=Bconvert;
ButtonCut.Glyph:=BTool_cut_small;
ButtonCopy.Glyph:=BTool_copy_small;
ButtonPaste.Glyph:=Bloadlayout;
ButtonOpenWith.Glyph:=Bapps;
ButtonProperties.Glyph:=BTool_properties_small;
ButtonRename.Glyph:=BTool_rename_small;
ButtonRename1.Glyph:=BTool_rename_small;
ButtonDelete.Glyph:=Bstop;
ButtonDup.Glyph:=BTool_dup_small;
ButtonNF.Glyph:=BFolder;
ButtonDup1.Glyph:=BTool_dup_small;
ButtonImgResize.Glyph:=BTool_resize_small;
ButtonImgCrop.Glyph:=BTool_crop_small;
ButtonImgRL.Glyph:=BTool_rl_small;
ButtonImgRR.Glyph:=BTool_rr_small;
end;
end;

procedure settooltext;
begin
with FormPeach do
begin
ButtonUn7zaTo.Caption:=txt_caption_extract;
ButtonUn7zaTest.Caption:=txt_caption_test;
ButtonUn7zaAdd.Caption:=txt_add;
pmttitle.Caption:=txt_add;
pmtypeswap.Caption:=txt_add+' <> '+txt_2_8_convert;
ButtonUn7zaConvert.Caption:=txt_2_8_convert;
ButtonCut.Caption:=txt_cut;
ButtonCopy.Caption:=txt_copy;
ButtonPaste.Caption:=txt_paste;
ButtonProperties.Caption:=txt_4_5_properties;
ButtonRename.Caption:=txt_rename;
ButtonRename1.Caption:=txt_rename;
ButtonDup.Caption:=txt_4_1_duplicatesfind;
ButtonNF.Caption:=txt_cnewfolder;
ButtonDup1.Caption:=txt_4_1_duplicatesfind;
ButtonImgResize.Caption:=txt_4_8_t;
ButtonImgCrop.Caption:=txt_4_8_crop;
ButtonImgRL.Caption:=txt_4_8_rl;
ButtonImgRR.Caption:=txt_4_8_rr;
ButtonCut.Hint:='';
ButtonCopy.Hint:='';
ButtonPaste.Hint:='';
ButtonOpenWith.Hint:='';
ButtonProperties.Hint:='';
ButtonRename.Hint:='';
ButtonRename1.Hint:='';
ButtonDelete.Hint:='';
ButtonDup.Hint:='';
ButtonNF.Hint:='';
ButtonDup1.Hint:='';
ButtonImgResize.Hint:='';
ButtonImgCrop.Hint:='';
ButtonImgRL.Hint:='';
ButtonImgRR.Hint:='';
end;
end;

procedure settoolbtnw(refw:integer; glyph_on_side:boolean);
begin
with FormPeach do
begin
psetbuttonwidth(ButtonUn7zato,refw,glyph_on_side);
psetbuttonwidth(ButtonUn7zaTest,refw,glyph_on_side);
psetbuttonwidth(ButtonUn7zaAdd,refw,glyph_on_side);
psetbuttonwidth(ButtonUn7zaConvert,refw,glyph_on_side);
ButtonPropertiesActions.Width:=imagelistroot.width;
ButtonExtractActions.Width:=imagelistroot.width;
ButtonConvertActions.Width:=imagelistroot.width;
ButtonAddActions.Width:=imagelistroot.width;
ButtonTestActions.Width:=imagelistroot.width;
//filemanager
psetbuttonwidth(ButtonCut,refw,glyph_on_side);
psetbuttonwidth(ButtonCopy,refw,glyph_on_side);
psetbuttonwidth(ButtonPaste,refw,glyph_on_side);
psetbuttonwidth(ButtonOpenWith,refw,glyph_on_side);
psetbuttonwidth(ButtonProperties,refw,glyph_on_side);
psetbuttonwidth(ButtonRename,refw,glyph_on_side);
psetbuttonwidth(ButtonDelete,refw,glyph_on_side);
psetbuttonwidth(ButtonDup,refw,glyph_on_side);
psetbuttonwidth(ButtonNF,refw,glyph_on_side);
Buttoncmto.Width:=imagelistroot.width;
Buttonopenactions.Width:=imagelistroot.width;
Buttonfmactions.Width:=imagelistroot.width;
Buttonfmactions1.Width:=imagelistroot.width;
//imageviewer
psetbuttonwidth(ButtonDup1,refw,glyph_on_side);
psetbuttonwidth(ButtonRename1,refw,glyph_on_side);
psetbuttonwidth(ButtonImgResize,refw,glyph_on_side);
psetbuttonwidth(ButtonImgCrop,refw,glyph_on_side);
psetbuttonwidth(ButtonImgRL,refw,glyph_on_side);
psetbuttonwidth(ButtonImgRR,refw,glyph_on_side);
ButtonImg6.Width:=imagelistroot.width;
ButtonImgR.Width:=imagelistroot.width;
ButtonImgRes.Width:=imagelistroot.width;
end;
end;

procedure settoolbtnwfixed;
begin
with FormPeach do
begin
ButtonUn7zaTo.Width:=ctrlback.width;
ButtonUn7zaTest.Width:=ctrlback.width;
ButtonUn7zaAdd.Width:=ctrlback.width;
ButtonUn7zaConvert.Width:=ctrlback.width;
ButtonPropertiesActions.Width:=imagelistroot.width;
ButtonExtractActions.Width:=imagelistroot.width;
ButtonConvertActions.Width:=imagelistroot.width;
ButtonAddActions.Width:=imagelistroot.width;
ButtonTestActions.Width:=imagelistroot.width;
//filemanager
ButtonCut.Width:=ctrlback.width;
ButtonCopy.Width:=ctrlback.width;
ButtonPaste.Width:=ctrlback.width;
ButtonOpenWith.Width:=ctrlback.width;
ButtonProperties.Width:=ctrlback.width;
ButtonRename.Width:=ctrlback.width;
ButtonDelete.Width:=ctrlback.width;
ButtonDup.Width:=ctrlback.width;
ButtonNF.Width:=ctrlback.width;
Buttoncmto.Width:=imagelistroot.width;
Buttonopenactions.Width:=imagelistroot.width;
Buttonfmactions.Width:=imagelistroot.width;
Buttonfmactions1.Width:=imagelistroot.width;
//imageviewer
ButtonDup1.Width:=ctrlback.width;
ButtonRename1.Width:=ctrlback.width;
ButtonImgResize.Width:=ctrlback.width;
ButtonImgCrop.Width:=ctrlback.width;
ButtonImgRL.Width:=ctrlback.width;
ButtonImgRR.Width:=ctrlback.width;
ButtonImg6.Width:=imagelistroot.width;
ButtonImgR.Width:=imagelistroot.width;
ButtonImgRes.Width:=imagelistroot.width;
end;
end;

procedure setlargetoolbar2;
var bheight:longint;
begin
with FormPeach do
begin
if lsize=1 then bheight:=mbarheight
else bheight:=mmbarheight;
bheight:=(bheight*pzoom) div 100;
PanelBarOpen.Height:=bheight;
PanelBarOpen1.Height:=bheight;
PanelBarOpen2.Height:=bheight;
PanelBarOpen3.Height:=bheight;
settoolglyphleft;
settoolmargin;
settoolspacing((6*qscaleimages) div 100);
settoolbigicon;
settooltext;
settoolbtnw((24*qscaleimages) div 100,true);
end;
toolsize:=0;
ptoolsize:=toolsize;
end;

procedure setsmalltoolbar2;
var
   smallheight:integer;
begin
with FormPeach do
begin
//smallheight:=PanelListBar.Height;
//if smallheight=0 then smallheight:=barheight;
smallheight:=barheight;
PanelBarOpen.Height:=smallheight;
PanelBarOpen2.Height:=smallheight;
PanelBarOpen3.Height:=smallheight;
settoolglyphleft;
settoolmargin;
settoolspacing((6*qscaleimages) div 100);
settoolsmallicon;
settooltext;
settoolbtnw((24*qscaleimages) div 100,true);
end;
toolsize:=4;
ptoolsize:=toolsize;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GUI ICONS

///////////////////////////////////////////////////////////////////////////////}

procedure setpwicons;
begin
try
if (FormPW.EditPWpass.Text='') and (FormPW.EditPWkeyfile.Text='') then
   begin
   FormPeach.msetpw.Bitmap:=Blocker2;
   FormPeach.msetpw.Caption:=txt_2_7_setpw;
   FormPeach.BtnPasswordExtract.Glyph:=blocker2;
   FormPeach.BtnPasswordArchive.Glyph:=blocker2;
   FormPeach.BtnPassword.Glyph:=blocker2;
   FormPeach.BtnPassword.Hint:=txt_2_7_pwnotset;
   FormPeach.po_setpw.Bitmap:=Blocker2;
   FormPeach.po_setpw.Caption:=txt_2_7_setpw;
   FormPeach.menupw.Bitmap:=Blocker2;
   FormPeach.menupw.Caption:=txt_2_7_setpw;
   FormPeach.pmqesetpw.Bitmap:=Blocker2;
   FormPeach.pmqesetpw.Caption:=txt_2_7_setpw;
   FormPeach.menuitempw.Bitmap:=Blocker2;
   FormPeach.menuitempw.Caption:=txt_2_7_setpw;
   if (archive_type<>'7z') and (archive_type<>'zip') and (archive_type<>'arc') and (archive_type<>'zpaq') and (fun<>'PEA') and (fun<>'CUSTOM') then
      begin
      FormPeach.BtnPasswordArchive.Caption:=txt_2_7_setpw;
      FormPeach.BtnPasswordArchive.Hint:=txt_2_5_nopw;
      FormPeach.BtnPasswordArchive.Visible:=false;
      end
   else
      begin
      FormPeach.BtnPasswordArchive.Caption:=txt_2_7_setpw;
      FormPeach.BtnPasswordArchive.Hint:=txt_encryption;
      FormPeach.BtnPasswordArchive.Visible:=true;
      end;
   FormPeach.BtnPasswordExtract.Caption:=txt_2_7_setpw;
   FormPeach.BtnPasswordExtract.Hint:=txt_encryption;
   end
else
   begin
   FormPeach.msetpw.Bitmap:=Blocker;
   FormPeach.msetpw.Caption:=txt_2_7_setpw+' *';
   FormPeach.BtnPasswordExtract.Glyph:=blocker;
   FormPeach.BtnPasswordArchive.Glyph:=blocker;
   FormPeach.BtnPassword.Glyph:=blocker;
   FormPeach.BtnPassword.Hint:=txt_2_7_pwextset;
   FormPeach.po_setpw.Bitmap:=Blocker;
   FormPeach.po_setpw.Caption:=txt_2_7_setpw+' *';
   FormPeach.menupw.Bitmap:=Blocker;
   FormPeach.menupw.Caption:=txt_2_7_setpw+' *';
   FormPeach.pmqesetpw.Bitmap:=Blocker;
   FormPeach.pmqesetpw.Caption:=txt_2_7_setpw+' *';
   FormPeach.menuitempw.Bitmap:=Blocker;
   FormPeach.menuitempw.Caption:=txt_2_7_setpw+' *';
   if (archive_type<>'7z') and (archive_type<>'zip') and (archive_type<>'arc') and (archive_type<>'zpaq') and (fun<>'PEA') and (fun<>'CUSTOM') then
      begin
      FormPeach.BtnPasswordArchive.Caption:=txt_2_7_setpw;
      FormPeach.BtnPasswordArchive.Hint:=txt_2_5_nopw;
      FormPeach.BtnPasswordArchive.Visible:=false;
      end
   else
      begin
      FormPeach.BtnPasswordArchive.Caption:=txt_2_7_setpw;
      FormPeach.BtnPasswordArchive.Hint:=txt_encryption;
      FormPeach.BtnPasswordArchive.Visible:=true;
      end;
   FormPeach.BtnPasswordExtract.Caption:=txt_2_7_setpw;
   FormPeach.BtnPasswordExtract.Hint:=txt_encryption;
   end;
except
end;
end;

function geticon(fullname,fulltype:ansistring; pc:boolean):integer;
var
   s,ext:ansistring;
begin
result:=-1;
ext:=lowercase(fulltype);
if pc=true then
   begin
   if ext = lowercase(txt_unit_removable) then result:=11; //Bremovable_supported
   if ext = lowercase(txt_unit_hd) then result:=8; //Bhd_supported
   if ext = lowercase(txt_unit_remote) then result:=10; //Bremote_supported
   if ext = lowercase(txt_unit_cd) then result:=6; //Bdvd_supported
   if ext = lowercase(txt_unit_ram) then result:=9; //Bram_supported
   if ext = lowercase(txt_unit_floppy) then result:=7; //Bfd_supported
   exit;
   end;
s:=fullname;
if (ext=lowercase(txt_list_isfolder)) or (ext=' [folder]') then begin result:=3; exit; end;
case ext of
'.lnk': result:=4;
'.txt','asc','.rtf','.wri','.ini','.log': result:=14;
'.doc','.dot','.docx','.dotx','.odt','.sxw','.wpd','.wps','.wpt','.gdoc','.tmdx','.pages': result:=2;
'.xls','.xlt','.xlsx','.xltm','.xltx','.ods','.gnm','.gnumeric','.csv','.123',
'.sxc','.gsheet','.numbers','.numbers-tef','.dif','.pmdx','.pmvx': result:=13;
'.pps','.ppt','.pot','.pptx','.ppsx','.potx','.odp','.gslides','.prdx','.key': result:=18;
'.db','.dbf','.mdb','.adp','.mdf','.nsf','.dat','.fp','.fp3','.fp5','.fp7',
'.frm','.odb','.ora','.sql','.sqlite','.wdb','.rpt','.iwa': result:=24;
'.eml': result:=23;
'.bat','.pif','.scr','.vbs','.cmd','.reg','.sh','.command','.csh': result:=20;
'.dll','.sys','.so','.dylib': result:=22;
'.htm','.html','.xml','.mht','.mhtml','.url': result:=16;
'.pdf': result:=19;
'.ani','.cur','.ico','.icl','.icns','.xbm','.xpm': result:=26;
'.svg','.ps','.eps','.cdr','.ai','.cpt','.psd','.psp','.xcf','.pdn','.blend',
'.dwf','.dwg','.3ds','.pict','.pic','.pct','.dxf','.wmf','.djvu','.djv','.xps',
'.oxps','.tex','.gdraw','.pub','.pmd': result:=27;
'.png','.bmp','.tga','.tif','.tiff','.pbm','.pgm','.ppm','.pns': result:=17;
'.gif': result:=25;
'.jpg','.jpe','.jpeg','.jif','.jfif','.jfi','.jpx','.jp2','.j2k','.webp','.jps',
'.mpo','.heif','.heic','.avif': result:=35;
'.avi','.mpg','.mpeg','.mpe','.mpv','.mp2','.m2v','.xvid','.divx','.mp4','.m4v',
'.m4p','.mov','.qt','.3gp','.3g2','.wmv','.swf','.flv','.f4p','.f4v','.fla',
'.mkv','.mk3d','.webm','.vob','.ogv','.rm','.rmvb','.asf','.amv','.svi','.nsv',
'.mng','.apng','.mts','.ts': result:=15;
'.wav','.mp3','.mid','.midi','.wma','.aiff','.au','.ogg','.oga','.aac','.amr','.ape',
'.flac','.wv','.m4a','.mpc','.ra','.pcm','.gsm','.aa','.aax','.m4b','.mmf',
'.opus','.tta','.vox': result:=12;
'.7z':result:=45;
'.rar':result:=46;
'.zip','.zipx':result:=47;
'.001':result:=48; //,'.r00','.z01','.zx01' operations should not be initated from those volumes
'.iso':result:=49;
'.deb','.rpm','.appx','.msix','.snap','.appimage','.app':result:=50;
else
case testext(s) of //most used special formats are intercepted before
   -1: result:=5; //BUnsupported
   503: result:=21;//any other primarily non archive format not intercepted before (like swf fla flv)
   502: result:=21;//other office files, non executable compound
   501: result:=21;//other ooo files
   500: result:=1;//exe and msi
   else
      result:=0;//generic archives
   end;
end;
end;

function pgetbitmap(i:integer):TBitmap;
begin
case i of
   0: result:=Barchivesupported;
   1: result:=Bexesupported;
   2: result:=Bfilesupported;
   3: result:=Bfolder;
   4: result:=Blink;
   5: result:=Bunsupported;
   6: result:=Bdvd_supported;
   7: result:=Bfd_supported;
   8: result:=Bhd_supported;
   9: result:=Bram_supported;
  10: result:=Bremote_supported;
  11: result:=Bremovable_supported;
  12: result:=Baudio;
  13: result:=Bspreadsheet;
  14: result:=Btxt;
  15: result:=Bvideo;
  16: result:=Bweb;
  17: result:=Bimage;
  18: result:=Bpresentation;
  19: result:=Bpdf;
  20: result:=Bbat;
  21: result:=Bsupported;
  22: result:=Bdll;
  23: result:=Bmail;
  24: result:=Bdb;
  25: result:=Bgif;
  26: result:=Bico;
  27: result:=Bvector;
  28: result:=Binfo;
  29: result:=Bsearch;
  30: result:=Bbookmark;
  31: result:=Broot;
  32: result:=Bsystemtools;
  33: result:=Bexpand;
  34: result:=Bgopath;
  35: result:=Bjpeg;
  45: result:=Barc7z;
  46: result:=Barcrar;
  47: result:=Barczip;
  48: result:=Barcblock;
  49: result:=Barcdisk;
  50: result:=Barcinstaller;
   else result:=Bunsupported;
   end;
end;

function mntmediaunits(s1:ansistring): boolean; //special folders for mounting units on Linux and macOS
begin
result:=false;
{$IFNDEF MSWINDOWS}
case s1 of
  {$IFNDEF DARWIN}
  '/media/','/mnt/','/run/media/','/var/run/media/','/run/user/','/var/run/user/': result:=true;
  {$ELSE}
  '/Volumes/': result:=true;
  {$ENDIF}
  end;
{$ENDIF}
end;

function drawmenuicon(s1:ansistring; sbrowse:integer=0):TBitmap;
var
   fulltype:ansistring;
   i:integer;
begin
with FormPeach do
begin
if s1='' then
   begin
   result:=nil;
   exit;
   end;
case sbrowse of
   1: begin
      result:=Bsearch;//recursive search
      exit;
      end;
   2: begin
      result:=Bexpand;//flat
      exit;
      end;
   3: begin
      result:=Bgopath;//non recursive search
      exit;
      end;
  end;
if mntmediaunits(s1)=true then
   begin
   result:=Bremovable_supported;
   exit;
   end;
if (s1 = desktop_path) or (s1 = txt_desktop) then
   begin
   result:=Bdesk;
   exit;
   end;
if (s1 = home_path) or (s1 = txt_2_9_home) then
   begin
   result:=Bhomefolder;
   exit;
   end;
if (s1 = usr_documents) or (s1 = txt_2_4_documents) then
   begin
   result:=Bfilesupported;
   exit;
   end;
if (s1 = usr_downloads) or (s1 = txt_3_1_downloads) then
   begin
   result:=Bdownloadfolder;
   exit;
   end;
if (s1 = usr_music) or (s1 = txt_5_0_music) then
   begin
   result:=Baudio;
   exit;
   end;
if (s1 = usr_pictures) or (s1 = txt_5_0_pictures) then
   begin
   result:=Bimage;
   exit;
   end;
if (s1 = usr_videos) or (s1 = txt_5_0_videos) then
   begin
   result:=Bvideo;
   exit;
   end;
if (s1 = shared_dropbox) or (s1 = shared_googledrive)
   or (s1 = shared_onedrive) or (s1 = shared_sharepointwork) or (s1 = shared_yandex)then
   begin
   result:=Bcloudfolder;
   exit;
   end;
{$IFDEF MSWINDOWS}
if (s1 = txt_mypc) or (s1 = 'Computer''s root') then
   begin
   result:=Bsystemtools;
   exit;
   end;
if length(s1) = 3 then
   begin
   i:=ord(s1[1])-64;
   result:=devicon[i];
   exit;
   end;
{$ENDIF}
if s1<>'' then
   if s1[length(s1)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=extractfileext(s1);
result:=pgetbitmap(geticon(s1,fulltype,false));
end;
end;

function drawhistoryicon(n:integer):TBitmap;  //recent history menu icons
var
   s1,s2:ansistring;
begin
with FormPeach do
begin
s1:=StringGridSessionHistory.Cells[2,n];
if s1='' then
   begin
   result:=nil;
   exit;
   end;
if StringGridSessionHistory.Cells[1,n] = txt_list_found then
   begin
   result:=Bsearch;
   exit;
   end;
if StringGridSessionHistory.Cells[1,n] = txt_list_flat then
   begin
   result:=Bexpand;
   exit;
   end;
s2:=StringGridSessionHistory.Cells[3,n];
if s2<>''
   then s2:=s2[length(s2)];
if s2<>'*' then
   begin
   result:=Bgopath;
   exit;
   end;
if extractfilename(StringGridSessionHistory.Cells[2,n])<>'' then //non recursive search in archives
begin
if length(StringGridSessionHistory.Cells[3,n])>length(StringGridSessionHistory.Cells[4,n]) then
if pos(StringGridSessionHistory.Cells[3,n],StringGridSessionHistory.Cells[4,n])<>1 then
   begin
   result:=Bgopath;
   exit;
   end;
end;
result:=drawmenuicon(s1);
end;
end;

function drawrecenticon(s:ansistring):TBitmap;
var
   fulltype:ansistring;
   i:integer;
begin
with FormPeach do
begin
if s='' then
   begin
   result:=nil;
   exit;
   end;
{$IFDEF MSWINDOWS}
if (s = txt_mypc)  or (s = 'Computer''s root') then
   begin
   result:=Bsystemtools;
   exit;
   end;
if length(s) = 3 then
   begin
   i:=ord(s[1])-64;
   result:=devicon[i];
   exit;
   end;
{$ENDIF}
if s<>'' then
   if s[length(s)]=directoryseparator then fulltype:=txt_list_isfolder
   else fulltype:=extractfileext(s);
result:=pgetbitmap(geticon(s,fulltype,false));
end;
end;

function getpcmenuicon(b:TBitmap):integer;
begin
Result:=5; //unsupported, in ImageList1
if b=Bfd_supported then Result:=7;
if b=Bremovable_supported then Result:=11;
if b=Bhd_supported then Result:=8;
if b=Bremote_supported then Result:=10;
if b=Bdvd_supported then Result:=6;
if b=Bram_supported then Result:=9;
end;

function drawlisticon(arow:integer):integer;
var
   fullname,fulltype,s:ansistring;
   pc:boolean;
begin
result:=5;
if (FormPeach.EditOpenIn.Text<>txt_mypc) then pc:=false
else pc:=true;
fullname:=FormPeach.StringGridList.Cells[12,arow];
fulltype:=lowercase(FormPeach.StringGridList.Cells[2,arow]);
if FormPeach.StringGridList.Cells[1,arow]<>'' then
   if (fulltype=lowercase(txt_list_isfolder)) or (fulltype=' [folder]') then
      begin
      result:=3;
      s:=fullname+directoryseparator;
      if mntmediaunits(s)=true then result:=11;
      if s = desktop_path then result:=36;
      if s = home_path then result:=42;
      if s = usr_documents then result:=2;
      if s = usr_downloads then result:=43;
      if s = usr_music then result:=12;
      if s = usr_pictures then result:=17;
      if s = usr_videos then result:=15;
      if (s = shared_dropbox) or (s = shared_googledrive)
      or (s = shared_onedrive) or (s = shared_sharepointwork) or (s = shared_yandex)then result:=44;
      end
   else
      result:=geticon(fullname,fulltype,pc);
end;

function drawtabicon(arow:integer):integer;
var
   s,s1,fulltype:ansistring;
   i:integer;
begin
result:=-1;
if arow>=FormPeach.StringGridSessionHistory.rowcount then exit;
s:=FormPeach.StringGridSessionHistory.Cells[2,arow];
if (s = txt_mypc) or (s = 'Computer''s root') then
   begin
   result:=32;
   exit;
   end;
if FormPeach.StringGridSessionHistory.Cells[1,arow] = txt_list_found then
      begin
      result:=29;
      exit;
      end;
if FormPeach.StringGridSessionHistory.Cells[1,arow] = txt_list_flat then
      begin
      result:=33;
      exit;
      end;
s1:=FormPeach.StringGridSessionHistory.Cells[3,arow];
if s1<>'' then
   s1:=s1[length(s1)];
if s1<>'*' then
      begin
      result:=34;
      exit;
      end;
if extractfilename(FormPeach.StringGridSessionHistory.Cells[2,arow])<>'' then //non recursive search in archives
begin
if length(FormPeach.StringGridSessionHistory.Cells[3,arow])>length(FormPeach.StringGridSessionHistory.Cells[4,arow]) then
if pos(FormPeach.StringGridSessionHistory.Cells[3,arow],FormPeach.StringGridSessionHistory.Cells[4,arow])<>1 then
   begin
   result:=34;
   exit;
   end;
end;

if mntmediaunits(s)=true then
   begin
   result:=11;
   exit;
   end;
if s = desktop_path then
   begin
   result:=36;
   exit;
   end;
if s = home_path then
   begin
   result:=42;
   exit;
   end;
if s = usr_documents then
   begin
   result:=2;
   exit;
   end;
if s = usr_downloads then
   begin
   result:=43;
   exit;
   end;
if s = usr_music then
   begin
   result:=12;
   exit;
   end;
if s = usr_pictures then
   begin
   result:=17;
   exit;
   end;
if s = usr_videos then
   begin
   result:=15;
   exit;
   end;
if (s = shared_dropbox) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_sharepointwork) or (s = shared_yandex)then
   begin
   result:=44;
   exit;
   end;
{$IFDEF MSWINDOWS}
if length(s) = 3 then
   begin
   i:=getdrivetype(Pchar(s));
   if (s[1]='A') or (s[1]='B') then result:=7
   else
      case i of
         2: result:=11;
         3: result:=8;
         4: result:=10;
         5: result:=6;
         6: result:=9;
         else result:=5;
      end;
   exit;
   end;
{$ENDIF}
if s<>'' then
   if s[length(s)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=extractfileext(s);
result:=geticon(s,fulltype,false);
end;

procedure clearimagelist(var aimagelist:TImageList);
begin
repeat
aimagelist.Delete(aimagelist.Count-1);
until aimagelist.Count<=0;
end;

procedure intloadicon(var srcbitmap,destbitmap:TBitmap; icon_size,relativeiconsize:integer);
var
   abitmap:TBitmap;
begin
if icon_size>96 then
   begin //this method is better for expanding icons
   abitmap:=Tbitmap.Create;
   abitmap.Assign(srcbitmap);
   setpbitmap(abitmap,scalediconsize);
   loadlargeicon(abitmap,destbitmap,spacedscalediconsize);
   abitmap.free;
   end
else
   begin //this method is better for reducing icons
   loadlargeicon(srcbitmap,destbitmap,relativeiconsize);
   end;
il96.Add(destbitmap,nil);
end;

procedure loadlargeicons(icon_size:integer);
var
   abitmap:TBitmap;
begin
baseiconsize:=icon_size;
scalediconsize:=(icon_size*qscaleimages) div 100;
spacedscalediconsize:=((icon_size+pspacing*2)*qscaleimages) div 100;
with FormPeach do
   begin
   clearimagelist(il96);
   il96.Height:=spacedscalediconsize;
   il96.Width:=spacedscalediconsize;
   case icon_size of
   48: relativeiconsize:=spacedscalediconsize * 2;
   64: relativeiconsize:=(spacedscalediconsize*3) div 2;
   72: relativeiconsize:=(spacedscalediconsize*4) div 3;
   96: relativeiconsize:=spacedscalediconsize;
   128: relativeiconsize:=(spacedscalediconsize*3) div 4;
   144: relativeiconsize:=(spacedscalediconsize*2) div 3;
   192: relativeiconsize:=spacedscalediconsize div 2;
   end;
   abitmap:=Tbitmap.Create;
   intloadicon(Barchivesupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bexesupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bfilesupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(BFolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Blink96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bunsupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdvd_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bfd_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bhd_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bram_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bremote_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bremovable_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Baudio96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bspreadsheet96,abitmap,icon_size,relativeiconsize);
   intloadicon(Btxt96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bvideo96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bweb96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bimage96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bpresentation96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bpdf96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bbat96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bsupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdll96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bmail96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdb96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bgif96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bico96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bvector96,abitmap,icon_size,relativeiconsize);
   intloadicon(Binfo,abitmap,icon_size,relativeiconsize);
   intloadicon(Bsearch,abitmap,icon_size,relativeiconsize);
   intloadicon(Bbookmark,abitmap,icon_size,relativeiconsize);
   intloadicon(Broot,abitmap,icon_size,relativeiconsize);
   intloadicon(Bsystemtools,abitmap,icon_size,relativeiconsize);
   intloadicon(Bexpand,abitmap,icon_size,relativeiconsize);
   intloadicon(Bgopath,abitmap,icon_size,relativeiconsize);
   intloadicon(Bjpeg96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdesk96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bplaceshistory,abitmap,icon_size,relativeiconsize);
   intloadicon(Bbookmarkadd,abitmap,icon_size,relativeiconsize);
   intloadicon(Brun,abitmap,icon_size,relativeiconsize);
   intloadicon(Bpreview,abitmap,icon_size,relativeiconsize);
   intloadicon(Bapps,abitmap,icon_size,relativeiconsize);
   intloadicon(Bhomefolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdownloadfolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bcloudfolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barc7z96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcrar96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barczip96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcblock96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcdisk96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcinstaller96,abitmap,icon_size,relativeiconsize);
   ListViewBrowser.LargeImages:=il96;
   abitmap.free;
   end;
end;

procedure loadsmallicons(icon_size:integer);
var
   abitmap:TBitmap;
begin
baseiconsize:=icon_size;
scalediconsize:=(icon_size*qscaleimages) div 100;
with FormPeach do
   begin
   case icon_size of
   16: begin
   spacedscalediconsize:=icon_sizeplus;
   relativeiconsize:=icon_sizeplus;
   clearimagelist(il16);
   il16.Height:=icon_sizeplus;
   il16.Width:=icon_sizeplus;
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bexesupported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bfilesupported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(BFolder,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Blink,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bunsupported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bfd_supported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bhd_supported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bram_supported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bremote_supported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Baudio,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Btxt,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bvideo,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bweb,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bimage,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bpresentation,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bpdf,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bbat,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bsupported,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bdll,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bmail,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bdb,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bgif,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bico,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bvector,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bjpeg,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bhomefolder,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bdownloadfolder,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Bcloudfolder,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Barc7z,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Barcrar,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Barczip,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Barcblock,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Barcdisk,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   loadlargeicon(Barcinstaller,abitmap,icon_sizeplus);
   il16.Add(abitmap,nil);
   ListViewBrowser.SmallImages:=il16;
   abitmap.free;
   end;
   else
   begin
   spacedscalediconsize:=((icon_size+pspacing*2)*qscaleimages) div 100;
   clearimagelist(il96);
   il96.Height:=spacedscalediconsize;
   il96.Width:=spacedscalediconsize;
   case icon_size of
   24: relativeiconsize:=spacedscalediconsize * 4;
   32: relativeiconsize:=spacedscalediconsize * 3;
   48: relativeiconsize:=spacedscalediconsize * 2;
   64: relativeiconsize:=(spacedscalediconsize * 3) div 2;
   72: relativeiconsize:=(spacedscalediconsize * 4) div 3;
   96: relativeiconsize:=spacedscalediconsize;
   end;
   abitmap:=Tbitmap.Create;
   intloadicon(Barchivesupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bexesupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bfilesupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(BFolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Blink96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bunsupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdvd_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bfd_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bhd_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bram_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bremote_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bremovable_supported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Baudio96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bspreadsheet96,abitmap,icon_size,relativeiconsize);
   intloadicon(Btxt96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bvideo96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bweb96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bimage96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bpresentation96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bpdf96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bbat96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bsupported96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdll96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bmail96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdb96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bgif96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bico96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bvector96,abitmap,icon_size,relativeiconsize);
   intloadicon(Binfo,abitmap,icon_size,relativeiconsize);
   intloadicon(Bsearch,abitmap,icon_size,relativeiconsize);
   intloadicon(Bbookmark,abitmap,icon_size,relativeiconsize);
   intloadicon(Broot,abitmap,icon_size,relativeiconsize);
   intloadicon(Bsystemtools,abitmap,icon_size,relativeiconsize);
   intloadicon(Bexpand,abitmap,icon_size,relativeiconsize);
   intloadicon(Bgopath,abitmap,icon_size,relativeiconsize);
   intloadicon(Bjpeg96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdesk96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bplaceshistory,abitmap,icon_size,relativeiconsize);
   intloadicon(Bbookmarkadd,abitmap,icon_size,relativeiconsize);
   intloadicon(Brun,abitmap,icon_size,relativeiconsize);
   intloadicon(Bpreview,abitmap,icon_size,relativeiconsize);
   intloadicon(Bapps,abitmap,icon_size,relativeiconsize);
   intloadicon(Bhomefolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bdownloadfolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Bcloudfolder96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barc7z96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcrar96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barczip96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcblock96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcdisk96,abitmap,icon_size,relativeiconsize);
   intloadicon(Barcinstaller96,abitmap,icon_size,relativeiconsize);
   ListViewBrowser.SmallImages:=il96;
   abitmap.free;
   end;
   end;
   end;
end;

procedure loadimglisticons;
var
   abitmap:TBitmap;
begin
with FormPeach do
begin
abitmap:=Tbitmap.Create;
ilsmall.Clear;
loadlargeicon(Barchivesupported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bexesupported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bfilesupported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(BFolder,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Blink,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bunsupported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bdvd_supported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bfd_supported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bhd_supported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bram_supported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bremote_supported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bremovable_supported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Baudio,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bspreadsheet,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Btxt,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bvideo,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bweb,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bimage,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bpresentation,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bpdf,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bbat,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bsupported,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bdll,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bmail,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bdb,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bgif,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bico,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bvector,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Binfo,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bsearch,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bbookmark,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Broot,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bsystemtools,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bexpand,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bgopath,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bjpeg,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bdesk,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bplaceshistory,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bbookmarkadd,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Brun,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bpreview,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bapps,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bhomefolder,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bdownloadfolder,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bcloudfolder,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Barc7z,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Barcrar,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Barczip,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Barcblock,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Barcdisk,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Barcinstaller,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Barchive,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bextractall,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bextractalln,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
loadlargeicon(Bconvert,abitmap,icon_sizeplus);
ilsmall.Add(abitmap,nil);
abitmap.free;
end;
end;

procedure load_icons; //load icons from bitmaps
var
   i:integer;
   thpath:ansistring;

procedure loadlighticons;
begin
with FormPeach do
   begin
   il_nonthemed.getbitmap(0,Bav);
   il_nonthemed.getbitmap(1,Bfilter);
   il_nonthemed.getbitmap(2,Bflat);
   il_nonthemed.getbitmap(3,Bcollapse);
   il_dtheme_16.getbitmap(0,Bbookmarkadd);
   il_dtheme_16.getbitmap(1,Bapps);
   il_dtheme_16.getbitmap(2,BArchive);
   il_dtheme_16.getbitmap(3,Bclearlayout);
   il_dtheme_16.getbitmap(4,Bconvert);
   il_dtheme_16.getbitmap(5,Bdelete);
   il_dtheme_16.getbitmap(6,Bextractall);
   il_dtheme_16.getbitmap(7,Bextractalln);
   il_dtheme_16.getbitmap(8,Bloadlayout);
   il_dtheme_16.getbitmap(9,Bpreview);
   il_dtheme_16.getbitmap(10,Brun);
   il_dtheme_16.getbitmap(11,Bsavelayout);
   il_dtheme_16.getbitmap(12,Bwipe);
   il_dtheme_16.getbitmap(13,Btestall);
   il_dtheme_16.getbitmap(14,Bdvd_supported);
   il_dtheme_16.getbitmap(15,Bfd_supported);
   il_dtheme_16.getbitmap(16,Bhd_supported);
   il_dtheme_16.getbitmap(17,Bram_supported);
   il_dtheme_16.getbitmap(18,Bremote_supported);
   il_dtheme_16.getbitmap(19,Bremovable_supported);
   il_dtheme_16.getbitmap(20,BArchiveSupported);
   il_dtheme_16.getbitmap(21,Baudio);
   il_dtheme_16.getbitmap(22,Bdll);
   il_dtheme_16.getbitmap(23,Bdb);
   il_dtheme_16.getbitmap(24,BFileSupported);
   il_dtheme_16.getbitmap(25,BExeSupported);
   il_dtheme_16.getbitmap(26,Bimage);
   il_dtheme_16.getbitmap(27,Bico);
   il_dtheme_16.getbitmap(28,Bjpeg);
   il_dtheme_16.getbitmap(29,Bgif);
   il_dtheme_16.getbitmap(30,Bvector);
   il_dtheme_16.getbitmap(31,Blink);
   il_dtheme_16.getbitmap(32,Bmail);
   il_dtheme_16.getbitmap(33,Bpdf);
   il_dtheme_16.getbitmap(34,Bpresentation);
   il_dtheme_16.getbitmap(35,Bbat);
   il_dtheme_16.getbitmap(36,Bspreadsheet);
   il_dtheme_16.getbitmap(37,Bsupported);
   il_dtheme_16.getbitmap(38,Btxt);
   il_dtheme_16.getbitmap(39,BUnsupported);
   il_dtheme_16.getbitmap(40,Bvideo);
   il_dtheme_16.getbitmap(41,Bweb);
   il_dtheme_16.getbitmap(42,BFolder);
   il_dtheme_16.getbitmap(43,Binfo);
   il_dtheme_16.getbitmap(44,Bnav);
   il_dtheme_16.getbitmap(45,Bkeyfile);
   il_dtheme_16.getbitmap(46,Blocker);
   il_dtheme_16.getbitmap(47,Blocker2);
   il_dtheme_16.getbitmap(48,Bback);
   il_dtheme_16.getbitmap(49,Bexpand);
   il_dtheme_16.getbitmap(50,Bgo);
   il_dtheme_16.getbitmap(51,Brefresh);
   il_dtheme_16.getbitmap(52,Bsearch);
   il_dtheme_16.getbitmap(53,Bgopath);
   il_dtheme_16.getbitmap(54,Bresetpath);
   il_dtheme_16.getbitmap(55,Bgoup);
   il_dtheme_16.getbitmap(56,Bp0);
   il_dtheme_16.getbitmap(57,Bbookmark);
   il_dtheme_16.getbitmap(58,Bdesk);
   il_dtheme_16.getbitmap(59,Bplaceshistory);
   il_dtheme_16.getbitmap(60,Broot);
   il_dtheme_16.getbitmap(61,Bsystemtools);
   il_dtheme_16.getbitmap(62,BDefaults);
   il_dtheme_16.getbitmap(63,Bstop);
   il_dtheme_16.getbitmap(64,BTool_cut_small);
   il_dtheme_16.getbitmap(65,BTool_copy_small);
   il_dtheme_16.getbitmap(66,BTool_dup_small);
   il_dtheme_16.getbitmap(67,Btool_properties_small);
   il_dtheme_16.getbitmap(68,Btool_rename_small);
   il_dtheme_16.getbitmap(69,Btool_resize_small);
   il_dtheme_16.getbitmap(70,Btool_crop_small);
   il_dtheme_16.getbitmap(71,BTool_rl_small);
   il_dtheme_16.getbitmap(72,BTool_rr_small);
   il_dtheme_16.getbitmap(73,Bmenu);
   il_dtheme_16.getbitmap(74,Bseparator);
   il_dtheme_16.getbitmap(75,Bsettings);
   il_dtheme_16.getbitmap(76,Bdetailsf);
   il_dtheme_16.getbitmap(77,Blistf);
   il_dtheme_16.getbitmap(78,Biconsf);
   il_dtheme_16.getbitmap(79,Bhomefolder);
   il_dtheme_16.getbitmap(80,Bdownloadfolder);
   il_dtheme_16.getbitmap(81,Bcloudfolder);
   il_dtheme_16.getbitmap(82,Barc7z);
   il_dtheme_16.getbitmap(83,Barcrar);
   il_dtheme_16.getbitmap(84,Barczip);
   il_dtheme_16.getbitmap(85,Barcblock);
   il_dtheme_16.getbitmap(86,Barcdisk);
   il_dtheme_16.getbitmap(87,Barcinstaller);
   il_dtheme_96.getbitmap(0,Bdvd_supported96);
   il_dtheme_96.getbitmap(1,Bfd_supported96);
   il_dtheme_96.getbitmap(2,Bhd_supported96);
   il_dtheme_96.getbitmap(3,Bram_supported96);
   il_dtheme_96.getbitmap(4,Bremote_supported96);
   il_dtheme_96.getbitmap(5,Bremovable_supported96);
   il_dtheme_96.getbitmap(6,BArchiveSupported96);
   il_dtheme_96.getbitmap(7,Baudio96);
   il_dtheme_96.getbitmap(8,Bdll96);
   il_dtheme_96.getbitmap(9,Bdb96);
   il_dtheme_96.getbitmap(10,BFileSupported96);
   il_dtheme_96.getbitmap(11,BExeSupported96);
   il_dtheme_96.getbitmap(12,Bimage96);
   il_dtheme_96.getbitmap(13,Bico96);
   il_dtheme_96.getbitmap(14,Bjpeg96);
   il_dtheme_96.getbitmap(15,Bgif96);
   il_dtheme_96.getbitmap(16,Bvector96);
   il_dtheme_96.getbitmap(17,Blink96);
   il_dtheme_96.getbitmap(18,Bmail96);
   il_dtheme_96.getbitmap(19,Bpdf96);
   il_dtheme_96.getbitmap(20,Bpresentation96);
   il_dtheme_96.getbitmap(21,Bbat96);
   il_dtheme_96.getbitmap(22,Bspreadsheet96);
   il_dtheme_96.getbitmap(23,Bsupported96);
   il_dtheme_96.getbitmap(24,Btxt96);
   il_dtheme_96.getbitmap(25,BUnsupported96);
   il_dtheme_96.getbitmap(26,Bvideo96);
   il_dtheme_96.getbitmap(27,Bweb96);
   il_dtheme_96.getbitmap(28,BFolder96);
   il_dtheme_96.getbitmap(29,Barc7z96);
   il_dtheme_96.getbitmap(30,Barcrar96);
   il_dtheme_96.getbitmap(31,Barczip96);
   il_dtheme_96.getbitmap(32,Barcblock96);
   il_dtheme_96.getbitmap(33,Barcdisk96);
   il_dtheme_96.getbitmap(34,Barcinstaller96);
   il_dtheme_96.getbitmap(35,Bcloudfolder96);
   il_dtheme_96.getbitmap(36,Bdesk96);
   il_dtheme_96.getbitmap(37,Bdownloadfolder96);
   il_dtheme_96.getbitmap(38,bhomefolder96);
   il_dtheme_tool32.getbitmap(0,Bdetailsfs);
   il_dtheme_tool32.getbitmap(1,BArchive_big);
   il_dtheme_tool32.getbitmap(2,Bconvert_big);
   il_dtheme_tool32.getbitmap(3,Bextractall_big);
   il_dtheme_tool32.getbitmap(4,Bextractalln_big);
   il_dtheme_tool32.getbitmap(5,Btestall_big);
   il_dtheme_tool32.getbitmap(6,Btool_cut);
   il_dtheme_tool32.getbitmap(7,Btool_copy);
   il_dtheme_tool32.getbitmap(8,Btool_paste);
   il_dtheme_tool32.getbitmap(9,Btool_openw);
   il_dtheme_tool32.getbitmap(10,Btool_properties);
   il_dtheme_tool32.getbitmap(11,Btool_rename);
   il_dtheme_tool32.getbitmap(12,Btool_delete);
   il_dtheme_tool32.getbitmap(13,Btool_dup);
   il_dtheme_tool32.getbitmap(14,Btool_resize);
   il_dtheme_tool32.getbitmap(15,Btool_crop);
   il_dtheme_tool32.getbitmap(16,BTool_rl);
   il_dtheme_tool32.getbitmap(17,BTool_rr);
   end;
end;

procedure loaddarkicons;
begin
with FormPeach do
   begin
   il_nonthemed_dark.getbitmap(0,Bav);
   il_nonthemed_dark.getbitmap(1,Bfilter);
   il_nonthemed_dark.getbitmap(4,Bflat);
   il_nonthemed_dark.getbitmap(3,Bcollapse);
   il_dtheme_16_dark.getbitmap(0,Bbookmarkadd);
   il_dtheme_16_dark.getbitmap(1,Bapps);
   il_dtheme_16_dark.getbitmap(2,BArchive);
   il_dtheme_16_dark.getbitmap(3,Bclearlayout);
   il_dtheme_16_dark.getbitmap(4,Bconvert);
   il_dtheme_16_dark.getbitmap(5,Bdelete);
   il_dtheme_16_dark.getbitmap(6,Bextractall);
   il_dtheme_16_dark.getbitmap(7,Bextractalln);
   il_dtheme_16_dark.getbitmap(8,Bloadlayout);
   il_dtheme_16_dark.getbitmap(9,Bpreview);
   il_dtheme_16_dark.getbitmap(10,Brun);
   il_dtheme_16_dark.getbitmap(11,Bsavelayout);
   il_dtheme_16_dark.getbitmap(12,Bwipe);
   il_dtheme_16_dark.getbitmap(13,Btestall);
   il_dtheme_16_dark.getbitmap(14,Bdvd_supported);
   il_dtheme_16_dark.getbitmap(15,Bfd_supported);
   il_dtheme_16_dark.getbitmap(16,Bhd_supported);
   il_dtheme_16_dark.getbitmap(17,Bram_supported);
   il_dtheme_16_dark.getbitmap(18,Bremote_supported);
   il_dtheme_16_dark.getbitmap(19,Bremovable_supported);
   il_dtheme_16_dark.getbitmap(20,BArchiveSupported);
   il_dtheme_16_dark.getbitmap(21,Baudio);
   il_dtheme_16_dark.getbitmap(22,Bdll);
   il_dtheme_16_dark.getbitmap(23,Bdb);
   il_dtheme_16_dark.getbitmap(24,BFileSupported);
   il_dtheme_16_dark.getbitmap(25,BExeSupported);
   il_dtheme_16_dark.getbitmap(26,Bimage);
   il_dtheme_16_dark.getbitmap(27,Bico);
   il_dtheme_16_dark.getbitmap(28,Bjpeg);
   il_dtheme_16_dark.getbitmap(29,Bgif);
   il_dtheme_16_dark.getbitmap(30,Bvector);
   il_dtheme_16_dark.getbitmap(31,Blink);
   il_dtheme_16_dark.getbitmap(32,Bmail);
   il_dtheme_16_dark.getbitmap(33,Bpdf);
   il_dtheme_16_dark.getbitmap(34,Bpresentation);
   il_dtheme_16_dark.getbitmap(35,Bbat);
   il_dtheme_16_dark.getbitmap(36,Bspreadsheet);
   il_dtheme_16_dark.getbitmap(37,Bsupported);
   il_dtheme_16_dark.getbitmap(38,Btxt);
   il_dtheme_16_dark.getbitmap(39,BUnsupported);
   il_dtheme_16_dark.getbitmap(40,Bvideo);
   il_dtheme_16_dark.getbitmap(41,Bweb);
   il_dtheme_16_dark.getbitmap(42,BFolder);
   il_dtheme_16_dark.getbitmap(43,Binfo);
   il_dtheme_16_dark.getbitmap(44,Bnav);
   il_dtheme_16_dark.getbitmap(45,Bkeyfile);
   il_dtheme_16_dark.getbitmap(46,Blocker);
   il_dtheme_16_dark.getbitmap(47,Blocker2);
   il_dtheme_16_dark.getbitmap(48,Bback);
   il_dtheme_16_dark.getbitmap(49,Bexpand);
   il_dtheme_16_dark.getbitmap(50,Bgo);
   il_dtheme_16_dark.getbitmap(51,Brefresh);
   il_dtheme_16_dark.getbitmap(52,Bsearch);
   il_dtheme_16_dark.getbitmap(53,Bgopath);
   il_dtheme_16_dark.getbitmap(54,Bresetpath);
   il_dtheme_16_dark.getbitmap(55,Bgoup);
   il_dtheme_16_dark.getbitmap(56,Bp0);
   il_dtheme_16_dark.getbitmap(57,Bbookmark);
   il_dtheme_16_dark.getbitmap(58,Bdesk);
   il_dtheme_16_dark.getbitmap(59,Bplaceshistory);
   il_dtheme_16_dark.getbitmap(60,Broot);
   il_dtheme_16_dark.getbitmap(61,Bsystemtools);
   il_dtheme_16_dark.getbitmap(62,BDefaults);
   il_dtheme_16_dark.getbitmap(63,Bstop);
   il_dtheme_16_dark.getbitmap(64,BTool_cut_small);
   il_dtheme_16_dark.getbitmap(65,BTool_copy_small);
   il_dtheme_16_dark.getbitmap(66,BTool_dup_small);
   il_dtheme_16_dark.getbitmap(67,Btool_properties_small);
   il_dtheme_16_dark.getbitmap(68,Btool_rename_small);
   il_dtheme_16_dark.getbitmap(69,Btool_resize_small);
   il_dtheme_16_dark.getbitmap(70,Btool_crop_small);
   il_dtheme_16_dark.getbitmap(71,BTool_rl_small);
   il_dtheme_16_dark.getbitmap(72,BTool_rr_small);
   il_dtheme_16_dark.getbitmap(73,Bmenu);
   il_dtheme_16_dark.getbitmap(74,Bseparator);
   il_dtheme_16_dark.getbitmap(75,Bsettings);
   il_dtheme_16_dark.getbitmap(76,Bdetailsf);
   il_dtheme_16_dark.getbitmap(77,Blistf);
   il_dtheme_16_dark.getbitmap(78,Biconsf);
   il_dtheme_16_dark.getbitmap(79,Bhomefolder);
   il_dtheme_16_dark.getbitmap(80,Bdownloadfolder);
   il_dtheme_16_dark.getbitmap(81,Bcloudfolder);
   il_dtheme_16_dark.getbitmap(82,Barc7z);
   il_dtheme_16_dark.getbitmap(83,Barcrar);
   il_dtheme_16_dark.getbitmap(84,Barczip);
   il_dtheme_16_dark.getbitmap(85,Barcblock);
   il_dtheme_16_dark.getbitmap(86,Barcdisk);
   il_dtheme_16_dark.getbitmap(87,Barcinstaller);
   il_dtheme_96_dark.getbitmap(0,Bdvd_supported96);
   il_dtheme_96_dark.getbitmap(1,Bfd_supported96);
   il_dtheme_96_dark.getbitmap(2,Bhd_supported96);
   il_dtheme_96_dark.getbitmap(3,Bram_supported96);
   il_dtheme_96_dark.getbitmap(4,Bremote_supported96);
   il_dtheme_96_dark.getbitmap(5,Bremovable_supported96);
   il_dtheme_96_dark.getbitmap(6,BArchiveSupported96);
   il_dtheme_96_dark.getbitmap(7,Baudio96);
   il_dtheme_96_dark.getbitmap(8,Bdll96);
   il_dtheme_96_dark.getbitmap(9,Bdb96);
   il_dtheme_96_dark.getbitmap(10,BFileSupported96);
   il_dtheme_96_dark.getbitmap(11,BExeSupported96);
   il_dtheme_96_dark.getbitmap(12,Bimage96);
   il_dtheme_96_dark.getbitmap(13,Bico96);
   il_dtheme_96_dark.getbitmap(14,Bjpeg96);
   il_dtheme_96_dark.getbitmap(15,Bgif96);
   il_dtheme_96_dark.getbitmap(16,Bvector96);
   il_dtheme_96_dark.getbitmap(17,Blink96);
   il_dtheme_96_dark.getbitmap(18,Bmail96);
   il_dtheme_96_dark.getbitmap(19,Bpdf96);
   il_dtheme_96_dark.getbitmap(20,Bpresentation96);
   il_dtheme_96_dark.getbitmap(21,Bbat96);
   il_dtheme_96_dark.getbitmap(22,Bspreadsheet96);
   il_dtheme_96_dark.getbitmap(23,Bsupported96);
   il_dtheme_96_dark.getbitmap(24,Btxt96);
   il_dtheme_96_dark.getbitmap(25,BUnsupported96);
   il_dtheme_96_dark.getbitmap(26,Bvideo96);
   il_dtheme_96_dark.getbitmap(27,Bweb96);
   il_dtheme_96_dark.getbitmap(28,BFolder96);
   il_dtheme_96_dark.getbitmap(29,Barc7z96);
   il_dtheme_96_dark.getbitmap(30,Barcrar96);
   il_dtheme_96_dark.getbitmap(31,Barczip96);
   il_dtheme_96_dark.getbitmap(32,Barcblock96);
   il_dtheme_96_dark.getbitmap(33,Barcdisk96);
   il_dtheme_96_dark.getbitmap(34,Barcinstaller96);
   il_dtheme_96_dark.getbitmap(35,Bcloudfolder96);
   il_dtheme_96_dark.getbitmap(36,Bdesk96);
   il_dtheme_96_dark.getbitmap(37,Bdownloadfolder96);
   il_dtheme_96_dark.getbitmap(38,bhomefolder96);
   il_dtheme_tool32_dark.getbitmap(0,Bdetailsfs);
   il_dtheme_tool32_dark.getbitmap(1,BArchive_big);
   il_dtheme_tool32_dark.getbitmap(2,Bconvert_big);
   il_dtheme_tool32_dark.getbitmap(3,Bextractall_big);
   il_dtheme_tool32_dark.getbitmap(4,Bextractalln_big);
   il_dtheme_tool32_dark.getbitmap(5,Btestall_big);
   il_dtheme_tool32_dark.getbitmap(6,Btool_cut);
   il_dtheme_tool32_dark.getbitmap(7,Btool_copy);
   il_dtheme_tool32_dark.getbitmap(8,Btool_paste);
   il_dtheme_tool32_dark.getbitmap(9,Btool_openw);
   il_dtheme_tool32_dark.getbitmap(10,Btool_properties);
   il_dtheme_tool32_dark.getbitmap(11,Btool_rename);
   il_dtheme_tool32_dark.getbitmap(12,Btool_delete);
   il_dtheme_tool32_dark.getbitmap(13,Btool_dup);
   il_dtheme_tool32_dark.getbitmap(14,Btool_resize);
   il_dtheme_tool32_dark.getbitmap(15,Btool_crop);
   il_dtheme_tool32_dark.getbitmap(16,BTool_rl);
   il_dtheme_tool32_dark.getbitmap(17,BTool_rr);
   end;
end;

begin
if imgloaded=true then exit;
if imgloading=true then exit;
imgloading:=true;
case ensmall of
   0: i16res:=(16*qscaleimages) div 100;
   1: i16res:=(18*qscaleimages) div 100;
   2: i16res:=(20*qscaleimages) div 100;
   3: i16res:=(24*qscaleimages) div 100;
   4: i16res:=(28*qscaleimages) div 100;
   5: i16res:=(32*qscaleimages) div 100;
   end;
if lsize=0 then
   i32res:=(24*qscaleimages) div 100
else
   i32res:=(32*qscaleimages) div 100;
i48res:=(48*qscaleimages) div 100;
i96res:=(96*qscaleimages) div 100;
with FormPeach do
   begin
   try
   //set non-themed graphic
   Bnonthemed:=TBitmap.Create;
   Bp1:=TBitmap.Create;
   binfodlg:=TBitmap.Create;
   bwarningdlg:=TBitmap.Create;
   bwarningsmall:=TBitmap.Create;
   berrordlg:=TBitmap.Create;
   il_nonthemed.getbitmap(0,Bnonthemed);
   il_nonthemed.getbitmap(5,Bp1);
   ImageListDlg.getbitmap(0,binfodlg);
   ImageListDlg.getbitmap(1,bwarningdlg);
   ImageListDlg.getbitmap(1,bwarningsmall);
   ImageListDlg.getbitmap(2,berrordlg);
   setpbitmap(Bnonthemed,i16res);
   setpbitmap(Bp1,i16res);
   setpbitmap(binfodlg,i32res);
   setpbitmap(bwarningdlg,i32res);
   setpbitmap(bwarningsmall,i16res);
   setpbitmap(berrordlg,i32res);
   //set themed graphic
   Bav:=TBitmap.Create;
   Bfilter:=TBitmap.Create;
   Bflat:=TBitmap.Create;
   Bcollapse:=TBitmap.Create;
   Bdetailsf:=TBitmap.Create;
   Blistf:=TBitmap.Create;
   Biconsf:=TBitmap.Create;
   bmenu:=TBitmap.Create;
   bseparator:=TBitmap.Create;
   bsettings:=TBitmap.Create;
   Bapps:=TBitmap.Create;
   Barchive_bigger2:=TBitmap.Create;
   Bplaceshistory:=TBitmap.Create;
   Bdb:=TBitmap.Create;
   Bgif:=TBitmap.Create;
   Bico:=TBitmap.Create;
   Bvector:=TBitmap.Create;
   Bsupported:=TBitmap.Create;
   Bbat:=TBitmap.Create;
   Bdll:=TBitmap.Create;
   Bimage:=TBitmap.Create;
   Bjpeg:=TBitmap.Create;
   Bpresentation:=TBitmap.Create;
   Bpdf:=TBitmap.Create;
   Btxt:=TBitmap.Create;
   Bspreadsheet:=TBitmap.Create;
   Bvideo:=TBitmap.Create;
   Baudio:=TBitmap.Create;
   Bconvert:=TBitmap.Create;
   Bconvert_big:=TBitmap.Create;
   BArchive_big:=TBitmap.Create;
   BArchive:=TBitmap.Create;
   BArchiveSupported:=TBitmap.Create;
   BFileSupported:=TBitmap.Create;
   BExesupported:=TBitmap.Create;
   BUnsupported:=TBitmap.Create;
   Bback:=TBitmap.Create;
   Bbookmark:=TBitmap.Create;
   Bbookmarkadd:=TBitmap.Create;
   Bclearlayout:=TBitmap.Create;
   BDefaults:=TBitmap.Create;
   Bdelete:=TBitmap.Create;
   Bdvd_supported:=TBitmap.Create;
   Bexpand:=TBitmap.Create;
   Bextractall:=TBitmap.Create;
   Bextractalln:=TBitmap.Create;
   Bextractall_big:=TBitmap.Create;
   Bextractalln_big:=TBitmap.Create;
   Bfd_supported:=TBitmap.Create;
   BFolder:=TBitmap.Create;
   Bgo:=TBitmap.Create;
   Bgopath:=TBitmap.Create;
   Bgoup:=TBitmap.Create;
   Bhd_supported:=TBitmap.Create;
   Binfo:=TBitmap.Create;
   Bkeyfile:=TBitmap.Create;
   Bloadlayout:=TBitmap.Create;
   Blocker:=TBitmap.Create;
   Blocker2:=TBitmap.Create;
   Bmail:=TBitmap.Create;
   Bnav:=TBitmap.Create;
   Bp0:=TBitmap.Create;
   Bpreview:=TBitmap.Create;
   Bram_supported:=TBitmap.Create;
   Brefresh:=TBitmap.Create;
   Bremote_supported:=TBitmap.Create;
   Bremovable_supported:=TBitmap.Create;
   Bresetpath:=TBitmap.Create;
   Broot:=TBitmap.Create;
   Brun:=TBitmap.Create;
   Bsavelayout:=TBitmap.Create;
   Bsearch:=TBitmap.Create;
   Bdesk:=TBitmap.Create;
   Bdesk96:=TBitmap.Create;
   bhomefolder96:=TBitmap.Create;
   Bdownloadfolder96:=TBitmap.Create;
   Bcloudfolder96:=TBitmap.Create;
   Bsystemtools:=TBitmap.Create;
   Btestall:=TBitmap.Create;
   Bstop:=TBitmap.Create;
   Bweb:=TBitmap.Create;
   Bwipe:=TBitmap.Create;
   Btestall_big:=TBitmap.Create;
   Blink:=TBitmap.Create;
   Bdetailsfs:=TBitmap.Create;
   BTool_cut_small:=TBitmap.Create;
   BTool_copy_small:=TBitmap.Create;
   BTool_dup_small:=TBitmap.Create;
   Btool_properties_small:=TBitmap.Create;
   Btool_rename_small:=TBitmap.Create;
   Btool_cut:=TBitmap.Create;
   Btool_copy:=TBitmap.Create;
   Btool_paste:=TBitmap.Create;
   Btool_openw:=TBitmap.Create;
   Btool_properties:=TBitmap.Create;
   Btool_rename:=TBitmap.Create;
   Btool_delete:=TBitmap.Create;
   Btool_dup:=TBitmap.Create;
   BTool_resize:=TBitmap.Create;
   BTool_crop:=TBitmap.Create;
   BTool_rl:=TBitmap.Create;
   BTool_rr:=TBitmap.Create;
   BTool_resize_small:=TBitmap.Create;
   BTool_crop_small:=TBitmap.Create;
   BTool_rl_small:=TBitmap.Create;
   BTool_rr_small:=TBitmap.Create;
   Bdvd_supported96:=TBitmap.Create;
   Bfd_supported96:=TBitmap.Create;
   BFolder96:=TBitmap.Create;
   Bhd_supported96:=TBitmap.Create;
   Bram_supported96:=TBitmap.Create;
   Bremote_supported96:=TBitmap.Create;
   Bremovable_supported96:=TBitmap.Create;
   Btxt96:=TBitmap.Create;
   Bspreadsheet96:=TBitmap.Create;
   Bvideo96:=TBitmap.Create;
   Baudio96:=TBitmap.Create;
   Bimage96:=TBitmap.Create;
   Bpresentation96:=TBitmap.Create;
   Bpdf96:=TBitmap.Create;
   Bsupported96:=TBitmap.Create;
   Bbat96:=TBitmap.Create;
   Bdll96:=TBitmap.Create;
   Bdb96:=TBitmap.Create;
   Bgif96:=TBitmap.Create;
   Bico96:=TBitmap.Create;
   Bvector96:=TBitmap.Create;
   Bjpeg96:=TBitmap.Create;
   BArchiveSupported96:=TBitmap.Create;
   BFileSupported96:=TBitmap.Create;
   BExesupported96:=TBitmap.Create;
   Bunsupported96:=TBitmap.Create;
   Blink96:=TBitmap.Create;
   Bweb96:=TBitmap.Create;
   Bmail96:=TBitmap.Create;
   Bhomefolder:=TBitmap.Create;
   Bdownloadfolder:=TBitmap.Create;
   Bcloudfolder:=TBitmap.Create;
   Barc7z:=TBitmap.Create;
   Barcrar:=TBitmap.Create;
   Barczip:=TBitmap.Create;
   Barcblock:=TBitmap.Create;
   Barcdisk:=TBitmap.Create;
   Barcinstaller:=TBitmap.Create;
   Barc7z96:=TBitmap.Create;
   Barcrar96:=TBitmap.Create;
   Barczip96:=TBitmap.Create;
   Barcblock96:=TBitmap.Create;
   Barcdisk96:=TBitmap.Create;
   Barcinstaller96:=TBitmap.Create;
   getthemepath(thpath);
   Bfm:=TBitmap.Create;
   try Bfm.LoadFromFile(thpath+graphicsfolder+'fm-theme.bmp'); except end;
   Bfm.Transparent:=True;
   ImageTheme.Picture.Bitmap:=Bfm;

   if evalcolor(clWindow)>128 then loadlighticons
   else loaddarkicons;

   if ((theme_name)<>(DEFAULT_THEME)) then
   begin
   try
   getthemedbitmap(Bdetailsf,thpath+graphicsfolder+'16'+directoryseparator+'16-detailsf.png');
   getthemedbitmap(Blistf,thpath+graphicsfolder+'16'+directoryseparator+'16-listf.png');
   getthemedbitmap(Biconsf,thpath+graphicsfolder+'16'+directoryseparator+'16-iconsf.png');
   getthemedbitmap(Bav,thpath+graphicsfolder+'16'+directoryseparator+'16-av.png');
   getthemedbitmap(Bfilter,thpath+graphicsfolder+'16'+directoryseparator+'16-filter.png');
   getthemedbitmap(Bflat,thpath+graphicsfolder+'16'+directoryseparator+'16-flat.png');
   getthemedbitmap(Bcollapse,thpath+graphicsfolder+'16'+directoryseparator+'16-collapse.png');
   getthemedbitmap(bmenu,thpath+graphicsfolder+'16'+directoryseparator+'16-menu.png');
   getthemedbitmap(bseparator,thpath+graphicsfolder+'16'+directoryseparator+'16-separator.png');
   getthemedbitmap(bsettings,thpath+graphicsfolder+'16'+directoryseparator+'16-settings.png');
   getthemedbitmap(Bcloudfolder96,thpath+graphicsfolder+'96'+directoryseparator+'96-cloud.png');
   getthemedbitmap(Bdesk96,thpath+graphicsfolder+'96'+directoryseparator+'96-desktop.png');
   getthemedbitmap(Bdownloadfolder96,thpath+graphicsfolder+'96'+directoryseparator+'96-downloads.png');
   getthemedbitmap(Bhomefolder96,thpath+graphicsfolder+'96'+directoryseparator+'96-home.png');
   getthemedbitmap(BArchiveSupported,thpath+graphicsfolder+'16'+directoryseparator+'16-archive.png');
   getthemedbitmap(Barc7z,thpath+graphicsfolder+'16'+directoryseparator+'16-7z.png');
   getthemedbitmap(Barcrar,thpath+graphicsfolder+'16'+directoryseparator+'16-rar.png');
   getthemedbitmap(Barczip,thpath+graphicsfolder+'16'+directoryseparator+'16-zip.png');
   getthemedbitmap(Barcblock,thpath+graphicsfolder+'16'+directoryseparator+'16-spanned.png');
   getthemedbitmap(Barcdisk,thpath+graphicsfolder+'16'+directoryseparator+'16-diskimage.png');
   getthemedbitmap(Barcinstaller,thpath+graphicsfolder+'16'+directoryseparator+'16-package.png');
   getthemedbitmap(BArchiveSupported96,thpath+graphicsfolder+'96'+directoryseparator+'96-archive.png');
   getthemedbitmap(Barc7z96,thpath+graphicsfolder+'96'+directoryseparator+'96-7z.png');
   getthemedbitmap(Barcrar96,thpath+graphicsfolder+'96'+directoryseparator+'96-rar.png');
   getthemedbitmap(Barczip96,thpath+graphicsfolder+'96'+directoryseparator+'96-zip.png');
   getthemedbitmap(Barcblock96,thpath+graphicsfolder+'96'+directoryseparator+'96-spanned.png');
   getthemedbitmap(Barcdisk96,thpath+graphicsfolder+'96'+directoryseparator+'96-diskimage.png');
   getthemedbitmap(Barcinstaller96,thpath+graphicsfolder+'96'+directoryseparator+'96-package.png');
   except end;//10.4 to 9.3 theme update
   getthemedbitmap(Bhomefolder,thpath+graphicsfolder+'16'+directoryseparator+'16-home.png');
   getthemedbitmap(Bdownloadfolder,thpath+graphicsfolder+'16'+directoryseparator+'16-downloads.png');
   getthemedbitmap(Bcloudfolder,thpath+graphicsfolder+'16'+directoryseparator+'16-cloud.png');
   getthemedbitmap(Bbookmarkadd,thpath+graphicsfolder+'16'+directoryseparator+'16-bookmarks-add.png');
   getthemedbitmap(Bapps,thpath+graphicsfolder+'16'+directoryseparator+'16-run-with.png');
   getthemedbitmap(BArchive,thpath+graphicsfolder+'16'+directoryseparator+'16-archive-add.png');
   getthemedbitmap(Bclearlayout,thpath+graphicsfolder+'16'+directoryseparator+'16-delete-clear.png');
   getthemedbitmap(Bconvert,thpath+graphicsfolder+'16'+directoryseparator+'16-archive-convert.png');
   getthemedbitmap(Bdelete,thpath+graphicsfolder+'16'+directoryseparator+'16-delete.png');
   getthemedbitmap(Bextractall,thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extract.png');
   getthemedbitmap(Bextractalln,thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extract-tonew.png');
   getthemedbitmap(Bloadlayout,thpath+graphicsfolder+'16'+directoryseparator+'16-paste.png');
   getthemedbitmap(Bpreview,thpath+graphicsfolder+'16'+directoryseparator+'16-run-preview.png');
   getthemedbitmap(Brun,thpath+graphicsfolder+'16'+directoryseparator+'16-run.png');
   getthemedbitmap(Bsavelayout,thpath+graphicsfolder+'16'+directoryseparator+'16-save.png');
   getthemedbitmap(Bwipe,thpath+graphicsfolder+'16'+directoryseparator+'16-delete-secure.png');
   getthemedbitmap(Btestall,thpath+graphicsfolder+'16'+directoryseparator+'16-test.png');
   getthemedbitmap(BFolder,thpath+graphicsfolder+'16'+directoryseparator+'16-folder.png');
   getthemedbitmap(Binfo,thpath+graphicsfolder+'16'+directoryseparator+'16-info.png');
   getthemedbitmap(Bnav,thpath+graphicsfolder+'16'+directoryseparator+'16-navigation.png');
   getthemedbitmap(Bkeyfile,thpath+graphicsfolder+'16'+directoryseparator+'16-keyfile.png');
   getthemedbitmap(Blocker,thpath+graphicsfolder+'16'+directoryseparator+'16-password-set.png');
   getthemedbitmap(Blocker2,thpath+graphicsfolder+'16'+directoryseparator+'16-password-notset.png');
   getthemedbitmap(Bback,thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-back.png');
   getthemedbitmap(Bexpand,thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-flat.png');
   getthemedbitmap(Bgo,thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-forward.png');
   getthemedbitmap(Brefresh,thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-refresh.png');
   getthemedbitmap(Bsearch,thpath+graphicsfolder+'16'+directoryseparator+'16-search.png');
   getthemedbitmap(Bgopath,thpath+graphicsfolder+'16'+directoryseparator+'16-search-here.png');
   getthemedbitmap(Bresetpath,thpath+graphicsfolder+'16'+directoryseparator+'16-undo.png');
   getthemedbitmap(Bgoup,thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-up.png');
   getthemedbitmap(Bp0,thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-refreshing.png');
   getthemedbitmap(Bbookmark,thpath+graphicsfolder+'16'+directoryseparator+'16-bookmarks.png');
   getthemedbitmap(Bdesk,thpath+graphicsfolder+'16'+directoryseparator+'16-desktop.png');
   getthemedbitmap(Bplaceshistory,thpath+graphicsfolder+'16'+directoryseparator+'16-history.png');
   getthemedbitmap(Broot,thpath+graphicsfolder+'16'+directoryseparator+'16-folder-special.png');
   getthemedbitmap(Bsystemtools,thpath+graphicsfolder+'16'+directoryseparator+'16-computer.png');
   getthemedbitmap(BDefaults,thpath+graphicsfolder+'16'+directoryseparator+'16-options.png');
   getthemedbitmap(Bstop,thpath+graphicsfolder+'16'+directoryseparator+'16-stop.png');
   getthemedbitmap(BTool_cut_small,thpath+graphicsfolder+'16'+directoryseparator+'16-cut.png');
   getthemedbitmap(BTool_copy_small,thpath+graphicsfolder+'16'+directoryseparator+'16-copy.png');
   getthemedbitmap(BTool_dup_small,thpath+graphicsfolder+'16'+directoryseparator+'16-find-duplicates.png');
   getthemedbitmap(Btool_properties_small,thpath+graphicsfolder+'16'+directoryseparator+'16-properties.png');
   getthemedbitmap(Btool_rename_small,thpath+graphicsfolder+'16'+directoryseparator+'16-rename.png');
   getthemedbitmap(Btool_resize_small,thpath+graphicsfolder+'16'+directoryseparator+'16-picture-modify.png');
   getthemedbitmap(Btool_crop_small,thpath+graphicsfolder+'16'+directoryseparator+'16-picture-crop.png');
   getthemedbitmap(BTool_rl_small,thpath+graphicsfolder+'16'+directoryseparator+'16-picture-rl.png');
   getthemedbitmap(BTool_rr_small,thpath+graphicsfolder+'16'+directoryseparator+'16-picture-rr.png');
   getthemedbitmap(Bdll,thpath+graphicsfolder+'16'+directoryseparator+'16-file-library.png');
   getthemedbitmap(BExeSupported,thpath+graphicsfolder+'16'+directoryseparator+'16-file-executable.png');
   getthemedbitmap(Bbat,thpath+graphicsfolder+'16'+directoryseparator+'16-file-script.png');
   getthemedbitmap(Bdetailsfs,thpath+graphicsfolder+'32'+directoryseparator+'32-folder.png');
   getthemedbitmap(BArchive_big,thpath+graphicsfolder+'32'+directoryseparator+'32-archive-add.png');
   getthemedbitmap(Bconvert_big,thpath+graphicsfolder+'32'+directoryseparator+'32-archive-convert.png');
   getthemedbitmap(Bextractall_big,thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extract.png');
   getthemedbitmap(Bextractalln_big,thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extract-tonew.png');
   getthemedbitmap(Btestall_big,thpath+graphicsfolder+'32'+directoryseparator+'32-test.png');
   getthemedbitmap(Btool_cut,thpath+graphicsfolder+'32'+directoryseparator+'32-cut.png');
   getthemedbitmap(Btool_copy,thpath+graphicsfolder+'32'+directoryseparator+'32-copy.png');
   getthemedbitmap(Btool_paste,thpath+graphicsfolder+'32'+directoryseparator+'32-paste.png');
   getthemedbitmap(Btool_openw,thpath+graphicsfolder+'32'+directoryseparator+'32-run-with.png');
   getthemedbitmap(Btool_properties,thpath+graphicsfolder+'32'+directoryseparator+'32-properties.png');
   getthemedbitmap(Btool_rename,thpath+graphicsfolder+'32'+directoryseparator+'32-rename.png');
   getthemedbitmap(Btool_delete,thpath+graphicsfolder+'32'+directoryseparator+'32-delete-secure.png');
   getthemedbitmap(Btool_dup,thpath+graphicsfolder+'32'+directoryseparator+'32-find-duplicates.png');
   getthemedbitmap(Btool_resize,thpath+graphicsfolder+'32'+directoryseparator+'32-picture-modify.png');
   getthemedbitmap(Btool_crop,thpath+graphicsfolder+'32'+directoryseparator+'32-picture-crop.png');
   getthemedbitmap(BTool_rl,thpath+graphicsfolder+'32'+directoryseparator+'32-picture-rl.png');
   getthemedbitmap(BTool_rr,thpath+graphicsfolder+'32'+directoryseparator+'32-picture-rr.png');
   getthemedbitmap(BFolder96,thpath+graphicsfolder+'96'+directoryseparator+'96-folder.png');
   getthemedbitmap(Bdll96,thpath+graphicsfolder+'96'+directoryseparator+'96-file-library.png');
   getthemedbitmap(BExeSupported96,thpath+graphicsfolder+'96'+directoryseparator+'96-file-executable.png');
   getthemedbitmap(Bbat96,thpath+graphicsfolder+'96'+directoryseparator+'96-file-script.png');
   end;
   setpbitmap(Bav,i16res);
   setpbitmap(Bfilter,i16res);
   setpbitmap(Bflat,i16res);
   setpbitmap(Bcollapse,i16res);
   mAdmin.Bitmap:=Bav;
   ctrlext.Glyph:=Bflat;
   ctrlarc.Glyph:=Bflat;
   Imageopenadvf.Width:=i16res;
   Imageopenadvf.Height:=i16res;
   Imageopenadvf.Picture.Bitmap:=Bfilter;
   ImageExtractAdvf.Width:=i16res;
   ImageExtractAdvf.Height:=i16res;
   ImageExtractAdvf.Picture.Bitmap:=Bfilter;
   ImageAddAdvf.Width:=i16res;
   ImageAddAdvf.Height:=i16res;
   ImageAddAdvf.Picture.Bitmap:=Bfilter;
   imagesp.Width:=i16res;
   imagesp.Height:=i16res;
   imagesp.Picture.Bitmap:=Bcollapse;
   imagesp1.Width:=i16res;
   imagesp1.Height:=i16res;
   imagesp1.Picture.Bitmap:=Bcollapse;
   setpbitmap(Bdetailsf,i16res);
   setpbitmap(Blistf,i16res);
   setpbitmap(Biconsf,i16res);
   setpbitmap(bmenu,i16res);
   setpbitmap(bseparator,i16res);
   setpbitmap(bsettings,i16res);
   setpbitmap(Bbookmarkadd,i16res);
   setpbitmap(Bapps,i16res);
   setpbitmap(BArchive,i16res);
   setpbitmap(Bclearlayout,i16res);
   setpbitmap(Bconvert,i16res);
   setpbitmap(Bdelete,i16res);
   setpbitmap(Bextractall,i16res);
   setpbitmap(Bextractalln,i16res);
   setpbitmap(Bloadlayout,i16res);
   setpbitmap(Bpreview,i16res);
   setpbitmap(Brun,i16res);
   setpbitmap(Bsavelayout,i16res);
   setpbitmap(Bwipe,i16res);
   setpbitmap(Btestall,i16res);
   setpbitmap(Bdvd_supported,i16res);
   setpbitmap(Bfd_supported,i16res);
   setpbitmap(Bhd_supported,i16res);
   setpbitmap(Bram_supported,i16res);
   setpbitmap(Bremote_supported,i16res);
   setpbitmap(Bremovable_supported,i16res);
   setpbitmap(BArchiveSupported,i16res);
   setpbitmap(Baudio,i16res);
   setpbitmap(Bdll,i16res);
   setpbitmap(Bdb,i16res);
   setpbitmap(BFileSupported,i16res);
   setpbitmap(BExeSupported,i16res);
   setpbitmap(Bimage,i16res);
   setpbitmap(Bico,i16res);
   setpbitmap(Bjpeg,i16res);
   setpbitmap(Bgif,i16res);
   setpbitmap(Bvector,i16res);
   setpbitmap(Blink,i16res);
   setpbitmap(Bmail,i16res);
   setpbitmap(Bpdf,i16res);
   setpbitmap(Bpresentation,i16res);
   setpbitmap(Bbat,i16res);
   setpbitmap(Bspreadsheet,i16res);
   setpbitmap(Bsupported,i16res);
   setpbitmap(Btxt,i16res);
   setpbitmap(BUnsupported,i16res);
   setpbitmap(Bvideo,i16res);
   setpbitmap(Bweb,i16res);
   setpbitmap(BFolder,i16res);
   setpbitmap(Binfo,i16res);
   setpbitmap(Bnav,i16res);
   setpbitmap(Bkeyfile,i16res);
   setpbitmap(Blocker,i16res);
   setpbitmap(Blocker2,i16res);
   setpbitmap(Bback,i16res);
   setpbitmap(Bexpand,i16res);
   setpbitmap(Bgo,i16res);
   setpbitmap(Brefresh,i16res);
   setpbitmap(Bsearch,i16res);
   setpbitmap(Bgopath,i16res);
   setpbitmap(Bresetpath,i16res);
   setpbitmap(Bgoup,i16res);
   setpbitmap(Bp0,i16res);
   setpbitmap(Bbookmark,i16res);
   setpbitmap(Bdesk,i16res);
   setpbitmap(Bplaceshistory,i16res);
   setpbitmap(Broot,i16res);
   setpbitmap(Bsystemtools,i16res);
   setpbitmap(BDefaults,i16res);
   setpbitmap(Bstop,i16res);
   setpbitmap(BTool_cut_small,i16res);
   setpbitmap(BTool_copy_small,i16res);
   setpbitmap(BTool_dup_small,i16res);
   setpbitmap(Btool_properties_small,i16res);
   setpbitmap(Btool_rename_small,i16res);
   setpbitmap(Btool_resize_small,i16res);
   setpbitmap(Btool_crop_small,i16res);
   setpbitmap(BTool_rl_small,i16res);
   setpbitmap(BTool_rr_small,i16res);
   setpbitmap(Bhomefolder,i16res);
   setpbitmap(Bdownloadfolder,i16res);
   setpbitmap(Bcloudfolder,i16res);
   setpbitmap(Barc7z,i16res);
   setpbitmap(Barcrar,i16res);
   setpbitmap(Barczip,i16res);
   setpbitmap(Barcblock,i16res);
   setpbitmap(Barcdisk,i16res);
   setpbitmap(Barcinstaller,i16res);
   setpbitmap(Bdvd_supported96,i96res);
   setpbitmap(Bfd_supported96,i96res);
   setpbitmap(Bhd_supported96,i96res);
   setpbitmap(Bram_supported96,i96res);
   setpbitmap(Bremote_supported96,i96res);
   setpbitmap(Bremovable_supported96,i96res);
   setpbitmap(BArchiveSupported96,i96res);
   setpbitmap(Baudio96,i96res);
   setpbitmap(Bdll96,i96res);
   setpbitmap(Bdb96,i96res);
   setpbitmap(BFileSupported96,i96res);
   setpbitmap(BExeSupported96,i96res);
   setpbitmap(Bimage96,i96res);
   setpbitmap(Bico96,i96res);
   setpbitmap(Bjpeg96,i96res);
   setpbitmap(Bgif96,i96res);
   setpbitmap(Bvector96,i96res);
   setpbitmap(Blink96,i96res);
   setpbitmap(Bmail96,i96res);
   setpbitmap(Bpdf96,i96res);
   setpbitmap(Bpresentation96,i96res);
   setpbitmap(Bbat96,i96res);
   setpbitmap(Bspreadsheet96,i96res);
   setpbitmap(Bsupported96,i96res);
   setpbitmap(Btxt96,i96res);
   setpbitmap(BUnsupported96,i96res);
   setpbitmap(Bvideo96,i96res);
   setpbitmap(Bweb96,i96res);
   setpbitmap(BFolder96,i96res);
   setpbitmap(Barc7z96,i96res);
   setpbitmap(Barcrar96,i96res);
   setpbitmap(Barczip96,i96res);
   setpbitmap(Barcblock96,i96res);
   setpbitmap(Barcdisk96,i96res);
   setpbitmap(Barcinstaller96,i96res);
   setpbitmap(Bcloudfolder96,i96res);
   setpbitmap(Bdesk96,i96res);
   setpbitmap(Bdownloadfolder96,i96res);
   setpbitmap(Bhomefolder96,i96res);
   Barc:=TBitmap.Create;
   Barc.Assign(Barchive_big);
   setpbitmap(Barc,i96res);
   bext:=TBitmap.Create;
   bext.Assign(Bextractall_big);
   setpbitmap(bext,i96res);
   bextf:=TBitmap.Create;
   bextf.Assign(Bextractalln_big);
   setpbitmap(bextf,i96res);
   btest:=TBitmap.Create;
   btest.Assign(Btool_properties);
   setpbitmap(btest,i96res);
   blist:=TBitmap.Create;
   blist.Assign(Btool_copy);
   setpbitmap(blist,i96res);

   setpbitmap(Bdetailsfs,i32res);
   setpbitmap(BArchive_big,i32res);
   setpbitmap(Bconvert_big,i32res);
   setpbitmap(Bextractall_big,i32res);
   setpbitmap(Bextractalln_big,i32res);
   setpbitmap(Btestall_big,i32res);
   setpbitmap(Btool_cut,i32res);
   setpbitmap(Btool_copy,i32res);
   setpbitmap(Btool_paste,i32res);
   setpbitmap(Btool_openw,i32res);
   setpbitmap(Btool_properties,i32res);
   setpbitmap(Btool_rename,i32res);
   setpbitmap(Btool_delete,i32res);
   setpbitmap(Btool_dup,i32res);
   setpbitmap(Btool_resize,i32res);
   setpbitmap(Btool_crop,i32res);
   setpbitmap(BTool_rl,i32res);
   setpbitmap(BTool_rr,i32res);

   {//possible implementation, monochrome folder icons
   BFolder.Canvas.Brush.Color:=clGreen;
   BFolder.Canvas.FloodFill(BFolder.Width div 2,BFolder.Height div 2,clWindow,fsborder);
   BFolder96.Canvas.Brush.Color:=clGreen;
   BFolder96.Canvas.FloodFill(BFolder96.Width div 2,BFolder96.Height div 2,clWindow,fsborder);}

   for i:=1 to 26 do devicon[i]:=Bunsupported;//show "unsupported" icon if the bookmarked unit is not mounted
   pmstyle1.Bitmap:=Bdetailsf;
   pmstyle3.Bitmap:=Blistf;
   pmstyle5.Bitmap:=Biconsf;
   mlang.Bitmap:=Binfo;
   mDefaults.Bitmap:=BDefaults;
   msettings.Bitmap:=BDefaults;
   pmthemes.Bitmap:=BDefaults;
   ImageAddress.Width:=i16res;
   ImageAddress.Height:=i16res;
   ImageAddress.Picture.Bitmap:=Bsystemtools;
   ImOpt1.Width:=i16res;
   ImOpt1.Height:=i16res;
   ImOpt1.Transparent:=true;
   ImOpt1.Picture.Bitmap:=BDefaults;
   ImOpt2.Width:=i16res;
   ImOpt2.Height:=i16res;
   ImOpt2.Transparent:=true;
   ImOpt2.Picture.Bitmap:=Bexpand;
   ImOpt3.Width:=i16res;
   ImOpt3.Height:=i16res;
   ImOpt3.Transparent:=true;
   ImOpt3.Picture.Bitmap:=BArchiveSupported;
   ImOpt4.Width:=i16res;
   ImOpt4.Height:=i16res;
   ImOpt4.Transparent:=true;
   ImOpt4.Picture.Bitmap:=BFolder;
   ImOpt5.Width:=i16res;
   ImOpt5.Height:=i16res;
   ImOpt5.Transparent:=true;
   ImOpt5.Picture.Bitmap:=Bapps;
   ImOpt6.Width:=i16res;
   ImOpt6.Height:=i16res;
   ImOpt6.Transparent:=true;
   ImOpt6.Picture.Bitmap:=Bimage;
   ImOpt7.Width:=i16res;
   ImOpt7.Height:=i16res;
   ImOpt7.Transparent:=true;
   ImOpt7.Picture.Bitmap:=Bsearch;
   ImOpt8.Width:=i16res;
   ImOpt8.Height:=i16res;
   ImOpt8.Transparent:=true;
   ImOpt8.Picture.Bitmap:=Binfo;
   MenuItemOpen_root.Bitmap:=Bsystemtools;
   po_systemtools.Bitmap:=Bsystemtools;
   po_linsystemtools.Bitmap:=Bsystemtools;
   MenuItemopendesktop.Bitmap:=Bdesk;
   MenuItemopendownloads.Bitmap:=Bdownloadfolder;
   MenuItemopendocuments.Bitmap:=BFileSupported;
   ButtonOptReset.Glyph:=Bresetpath;
   po_convertarchive.Bitmap:=Bconvert;
   csbroot.Glyph:=Bsystemtools;
   csbhome.Glyph:=bhomefolder;
   csbdesk.Glyph:=bdesk;
   csbdownloads.Glyph:=Bdownloadfolder;
   csbdoc.Glyph:=bfilesupported;
   csbmusic.Glyph:=baudio;
   csbpic.Glyph:=Bimage;
   csbvid.Glyph:=Bvideo;
   ctrlback.Glyph:=Bback;
   ctrlfwd.Glyph:=Bgo;
   ctrlup.Glyph:=Bgoup;
   ctrlwarning.Glyph:=Bwarningsmall;
   refreshstatus:=0;
   ImageListSearch.Picture.Bitmap:=Bsearch;
   ImageListResetSearch.Picture.Bitmap:=Bdelete;
   pmireset.Bitmap:=Bdelete;
   msetpw.Bitmap:=Blocker2;
   mpm.Bitmap:=Bsavelayout;
   mscripts.Bitmap:=bbat;
   BtnPassword.Glyph:=Blocker2;
   BtnPasswordArchive.Glyph:=Blocker2;
   BtnPasswordExtract.Glyph:=Blocker2;
   mkeyfile.Bitmap:=Bkeyfile;
   mverifyself.Bitmap:=BExesupported;
   iConsoleCreateImport.Width:=i16res;
   iConsoleCreateImport.Height:=i16res;
   iConsoleCreateImport.Picture.Bitmap:=Bresetpath;
   iConsoleCreateImportExt.Width:=i16res;
   iConsoleCreateImportExt.Height:=i16res;
   iConsoleCreateImportExt.Picture.Bitmap:=Bresetpath;
   ImageInfoCustomExt.Width:=i16res;
   ImageInfoCustomExt.Height:=i16res;
   ImageInfoCustomExt.Picture.Bitmap:=Binfo;
   ImageInfoCustomExt.Transparent:=true;
   ImageInfoConsole.Width:=i16res;
   ImageInfoConsole.Height:=i16res;
   ImageInfoConsole.Picture.Bitmap:=Binfo;
   ImageInfoConsole.Transparent:=true;
   ImageInfoConsoleExt.Width:=i16res;
   ImageInfoConsoleExt.Height:=i16res;
   ImageInfoConsoleExt.Picture.Bitmap:=Binfo;
   ImageInfoConsoleExt.Transparent:=true;
   ImageInfoSchedAdd.Width:=i16res;
   ImageInfoSchedAdd.Height:=i16res;
   ImageInfoSchedAdd.Picture.Bitmap:=Binfo;
   ImageInfoSchedAdd.Transparent:=true;
   ImageInfoSchedExt.Width:=i16res;
   ImageInfoSchedExt.Height:=i16res;
   ImageInfoSchedExt.Picture.Bitmap:=Binfo;
   ImageInfoSchedExt.Transparent:=true;
   ImageInfoBinaries.Width:=i16res;
   ImageInfoBinaries.Height:=i16res;
   ImageInfoBinaries.Picture.Bitmap:=Binfo;
   ImageInfoBinaries.Transparent:=true;
   ImageInfoEncoding.Width:=i16res;
   ImageInfoEncoding.Height:=i16res;
   ImageInfoEncoding.Picture.Bitmap:=Binfo;
   ImageInfoEncoding.Transparent:=true;
   ImageSplit.Width:=i16res;
   ImageSplit.Height:=i16res;
   ImageSplit.Transparent:=true;
   mBookmarks.Bitmap:=BBookmark;
   smBookmarks1.Bitmap:=BBookmark;
   smBookmarksa1.Bitmap:=BBookmark;
   mexttobook.Bitmap:=BBookmark;
   smfs1.Bitmap:=Broot;
   smfsa1.Bitmap:=Broot;
   mexttofs.Bitmap:=Broot;
   pmjumpapple.Bitmap:=bfolder;
   pmJumppubhome.Bitmap:=bfolder;
   MenuItemArchive_pubhome.Bitmap:=bfolder;
   MenuItemOpen_pubhome.Bitmap:=bfolder;
   mextto_pubhome.Bitmap:=bfolder;
   MenuItemArchive_home1.Bitmap:=bhomefolder;
   MenuItemArchive_documents1.Bitmap:=bfilesupported;
   MenuItemArchive_downloads.Bitmap:=Bdownloadfolder;
   MenuItemArchive_music.Bitmap:=baudio;
   MenuItemArchive_pictures.Bitmap:=bimage;
   MenuItemArchive_videos.Bitmap:=bvideo;
   MenuItemArchive_pubdoc.Bitmap:=bfolder;
   MenuItemOpenhome.Bitmap:=Bhomefolder;
   MenuItemOpen_home1.Bitmap:=bhomefolder;
   mextto_home.Bitmap:=bhomefolder;
   pmquickhome.Bitmap:=Bhomefolder;
   pmquickdesk.Bitmap:=Bdesk;
   pmquickdownloads.Bitmap:=Bdownloadfolder;
   MenuItemOpen_documents1.Bitmap:=bfilesupported;
   mextto_documents.Bitmap:=bfilesupported;
   MenuItemOpen_downloads1.Bitmap:=Bdownloadfolder;
   mextto_downloads.Bitmap:=Bdownloadfolder;
   MenuItemOpen_music.Bitmap:=baudio;
   mextto_music.Bitmap:=baudio;
   MenuItemOpen_pictures.Bitmap:=bimage;
   mextto_pictures.Bitmap:=bimage;
   MenuItemOpen_videos.Bitmap:=bvideo;
   mextto_videos.Bitmap:=bvideo;
   MenuItemOpen_pubdoc.Bitmap:=bfolder;
   mextto_pubdoc.Bitmap:=bfolder;
   pmjump3.Bitmap:=Bhomefolder;
   pmjumpdocuments.Bitmap:=BFileSupported;
   pmjumppubdoc.Bitmap:=bfolder;
   pmjumpdownloads.Bitmap:=Bdownloadfolder;
   pmjumpmusic.Bitmap:=baudio;
   pmjumppictures.Bitmap:=bimage;
   pmjumpvideos.Bitmap:=bvideo;
   pmrecycle.Bitmap:=Bclearlayout;
   po_recycle.Bitmap:=Bclearlayout;
   pmbookmarks.Bitmap:=BBookmarkadd;
   mb0.Bitmap:=BBookmarkadd;
   mb24.Bitmap:=BBookmark;
   pmbcaddbookmark.Bitmap:=BBookmarkadd;
   pmbcorganizebookmarks.Bitmap:=BBookmark;
   MenuItemOpen_organizebookmarks.Bitmap:=BBookmark;
   pmorganizebookmarks.Bitmap:=BBookmark;
   MenuItemBookmarks.Bitmap:=BBookmarkadd;
   MenuItemOpen_addtobookmarks.Bitmap:=BBookmarkadd;
   MenuItemHistoryBook.Bitmap:=Bbookmarkadd;
   MenuItemOpen_ExtractHere.Bitmap:=Bextractall;
   MenuItemPW.Bitmap:=Blocker2;
   mjob.Bitmap:=bbat;
   po_setpw.Bitmap:=Blocker2;
   menupw.Bitmap:=Blocker2;
   pmqesetpw.Bitmap:=Blocker2;
   imageflat.Glyph:=bsettings;
   BtnStyle.Glyph:=bsettings;
   imageflatadd.Glyph:=Barchive;
   imageflatconvert.Glyph:=Bconvert;
   imageflatext.Glyph:=Bextractall;
   imageflatdup.Glyph:=BTool_dup_small;
   imageflatfolder.Glyph:=BFolder;
   imageflatren.Glyph:=Btool_rename_small;
   ImageFlattransform.Glyph:=Btool_resize_small;
   ImageFlatcrop.Glyph:=Btool_crop_small;
   ImageFlattestmore.Glyph:=bmenu;
   ButtonPropertiesActions.Glyph:=bmenu;
   ButtonExtractActions.Glyph:=bmenu;
   ButtonConvertActions.Glyph:=bmenu;
   ButtonAddActions.Glyph:=bmenu;
   ButtonTestActions.Glyph:=bmenu;
   Buttoncmto.Glyph:=bmenu;
   Buttonopenactions.Glyph:=bmenu;
   Buttonfmactions.Glyph:=bmenu;
   Buttonfmactions1.Glyph:=bmenu;
   ButtonImg6.Glyph:=bmenu;
   ButtonImgR.Glyph:=bmenu;
   ButtonImgRes.Glyph:=bmenu;
   Imagelistroot.Picture.Bitmap:=bmenu;
   ButtonOutAdd.Glyph:=bmenu;
   ButtonOutUpdate.Glyph:=bmenu;
   ButtonOpenCustom.Glyph:=bmenu;
   SpeedButtonAdd.Glyph:=bmenu;
   ButtonOutExtract.Glyph:=bmenu;
   ButtonCustomExt.Glyph:=bmenu;
   ImageAddress0.Picture.Bitmap:=bseparator;
   ImageAddress1.Picture.Bitmap:=bseparator;
   ImageAddress2.Picture.Bitmap:=bseparator;
   ImageAddress3.Picture.Bitmap:=bseparator;
   ImageAddress4.Picture.Bitmap:=bseparator;
   ImageAddress5.Picture.Bitmap:=bseparator;
   ImageAddress6.Picture.Bitmap:=bseparator;
   ImageAddress7.Picture.Bitmap:=bseparator;
   ImageAdArchive0.Picture.Bitmap:=bseparator;
   ImageAdArchive1.Picture.Bitmap:=bseparator;
   ImageAdArchive2.Picture.Bitmap:=bseparator;
   ImageAdArchive3.Picture.Bitmap:=bseparator;
   MenuItemOpen_test.Bitmap:=Btestall;
   mf3.Bitmap:=Bsearch;
   mf4up.Bitmap:=Bgoup;
   mback.Bitmap:=Bback;
   mFlat.Bitmap:=Bexpand;
   pmFlat.Bitmap:=Bexpand;
   po_flat.Bitmap:=Bexpand;
   mpeahelpoffline.Bitmap:=BPdf;
   mRefresh.Bitmap:=Brefresh;
   pmtabrefresh.Bitmap:=Brefresh;
   MenuItemContextRefresh.Bitmap:=Brefresh;
   pmhrefresh.Bitmap:=Brefresh;
   pmAddFile.Bitmap:=Bunsupported;
   pmAddFolder.Bitmap:=Bfolder;
   pmSearchAdd.Bitmap:=Bsearch;
   po_addtoarchive.Bitmap:=BArchive;
   po_delete.Bitmap:=Bdelete;
   pmquickdelete.Bitmap:=Bdelete;
   po_zerofile.Bitmap:=Bwipe;
   pmzerofile.Bitmap:=Bwipe;
   po_exthere.Bitmap:=Bextractall;
   pmqeto.Bitmap:=Bextractall;
   MenuItemExtAllTo.Bitmap:=Bextractall;
   po_securedelete.Bitmap:=Bstop;
   pmsecuredelete.Bitmap:=Bstop;
   pmjump2.Bitmap:=Bdesk;
   pmqjdropbox.Bitmap:=Bcloudfolder;
   pmqjgoogledrive.Bitmap:=Bcloudfolder;
   pmqjonedrive.Bitmap:=Bcloudfolder;
   pmqjshp.Bitmap:=Bcloudfolder;
   pmqjy.Bitmap:=Bcloudfolder;
   MenuItemOpen_dropbox.Bitmap:=Bcloudfolder;
   mextto_dropbox.Bitmap:=Bcloudfolder;
   MenuItemOpen_googledrive.Bitmap:=Bcloudfolder;
   mextto_googledrive.Bitmap:=Bcloudfolder;
   MenuItemOpen_onedrive.Bitmap:=Bcloudfolder;
   mextto_onedrive.Bitmap:=Bcloudfolder;
   MenuItemOpen_shp.Bitmap:=Bcloudfolder;
   mextto_shp.Bitmap:=Bcloudfolder;
   MenuItemOpen_y.Bitmap:=Bcloudfolder;
   mextto_y.Bitmap:=Bcloudfolder;
   MenuItemArchive_dropbox.Bitmap:=Bcloudfolder;
   MenuItemArchive_googledrive.Bitmap:=Bcloudfolder;
   MenuItemArchive_onedrive.Bitmap:=Bcloudfolder;
   MenuItemArchive_shp.Bitmap:=Bcloudfolder;
   MenuItemArchive_y.Bitmap:=Bcloudfolder;
   MenuItemOpen_desktop1.Bitmap:=Bdesk;
   mextto_desktop.Bitmap:=Bdesk;
   mpathdesk1.Bitmap:=Bdesk;
   mhistory.Bitmap:=Bplaceshistory;
   smhistorya1.Bitmap:=Bplaceshistory;
   smhistory1.Bitmap:=Bplaceshistory;
   mexttohistory.Bitmap:=Bplaceshistory;
   po_test.Bitmap:=Btestall;
   pmtabsclose.Bitmap:=Bdelete;
   pmtabsbookmarkadd.Bitmap:=BBookmarkadd;
   pmtabsbookmarkorg.Bitmap:=BBookmark;
   ThemeReset.Width:=i16res;
   ThemeReset.Height:=i16res;
   ThemeReset.Picture.Bitmap:=Bresetpath;
   ThemeReset.Transparent:=true;
   Imagelistsearch.Transparent:=true;
   ImageListResetSearch.Transparent:=true;
   loadimglisticons;
   LabelThemeLoaded.Caption:=txt_icons_found;
   ComboBoxTheme.hint:=thpath+extractfilepath(theme_path);
   LabelTheme.hint:=txt_3_5_managecustomthemes;
   LabelTheme1.hint:=thpath+extractfilepath(theme_path);
   imgloaded:=true;
   imgloading:=false;
   except
   LabelThemeLoaded.Caption:=txt_icons_not_found;
   end;
   end;
end;

procedure clearicons;
begin
clearimagelist(il16);
clearimagelist(il96);
end;

procedure rebuildicons(doicons:boolean);
//if the parameter is true, clear and reload small or large icons accordingly to the view style of ListView
//in this way, new icons can be appended at runtime after base file type icons each time a new folder/view
//is loaded, i.e. to represent image's thumbnails
begin
if doicons=false then exit;
case browsertype of
   2:
   begin
   clearimagelist(il96);
   loadlargeicons(largeiconsize);
   end;
   1:
   begin
   if smalliconsize=16 then clearimagelist(il16)
   else clearimagelist(il96);
   loadsmallicons(smalliconsize);
   end;
   0:
   begin
   if smalliconsize=16 then clearimagelist(il16)
   else clearimagelist(il96);
   loadsmallicons(smalliconsize);
   end;
   end;
end;

procedure drawcellicon(sg:tstringgrid; arow:integer);
var
   fullname,fulltype:ansistring;
   l,t:integer;
begin
l:=sg.CellRect(0,arow).Left+intcellhw;
t:=sg.CellRect(0,arow).Top+intcellhw;
fullname:=sg.Cells[8,arow];
fulltype:=sg.Cells[2,arow];
if sg.Cells[1,arow]<>'' then
   sg.Canvas.Draw(l,t,pgetbitmap(geticon(fullname,fulltype,false)));
end;

function getsbrowse(i:integer):integer; //should be used in all related functions: drawmenuicon, gettreeicon, drawbarcellicon, drawhistoryicon
var
   snr:ansistring;
begin
result:=0; //0 browse, 1 search, 2 flat, 3 non recursive search
if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_found then begin result:=1; exit; end;
if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_flat then begin result:=2; exit; end;
snr:=FormPeach.StringGridBookmarks.Cells[4,i];
if snr<>'' then
   snr:=snr[length(snr)];
if (result=0) and (snr<>'*') then begin result:=3; exit; end;
if extractfilename(FormPeach.StringGridBookmarks.Cells[2,i])<>'' then
   if FormPeach.StringGridBookmarks.Cells[5,i]<>'' then
      if length(FormPeach.StringGridBookmarks.Cells[4,i])>length(FormPeach.StringGridBookmarks.Cells[5,i]) then
         if pos(FormPeach.StringGridBookmarks.Cells[4,i],FormPeach.StringGridBookmarks.Cells[5,i])<>1 then result:=3;
end;

function getsbrowsegrid(sg:tstringgrid; i:integer):integer;
var
   s1:ansistring;
begin
result:=0; //0 browse, 1 search, 2 flat, 3 non recursive search
if sg.Cells[1,i]=txt_list_found then begin result:=1; exit; end;
if sg.Cells[1,i]=txt_list_flat then begin result:=2; exit; end;
s1:=sg.Cells[3,i];
   if s1<>'' then
      s1:=s1[length(s1)];
   if s1<>'*' then
      begin
      result:=3;
      exit;
      end;
   if sg.ColCount>4 then
   if extractfilename(sg.Cells[2,i])<>'' then //non recursive search in archives
      begin
      if length(sg.Cells[3,i])>length(sg.Cells[4,i]) then
      if pos(sg.Cells[3,i],sg.Cells[4,i])<>1 then
         begin
         result:=3;
         end;
      end;
end;

procedure drawbarcellicon(sg:tstringgrid; arow:integer);
var
   s,fulltype:ansistring;
   l,t,i,sbrowse:integer;
begin
if sg.RowCount<2 then exit;
if arow>=sg.rowcount then exit;
l:=sg.CellRect(0,arow).Left+intcellhw;
t:=sg.CellRect(0,arow).Top+intcellhw;
if sg=FormPeach.stringgridrecent then
   s:=sg.Cells[1,arow]
else
   s:=sg.Cells[2,arow];
if (s = txt_mypc) or (s = 'Computer''s root') then
   begin
   sg.Canvas.Draw(l,t,Bsystemtools);
   exit;
   end;
if sg<>FormPeach.stringgridrecent then
   begin
   if sg=FormPeach.stringgridbookmarks then sbrowse:=getsbrowse(arow)
   else sbrowse:=getsbrowsegrid(sg,arow);
   case sbrowse of
   1: begin
      sg.Canvas.Draw(l,t,Bsearch);//recursive search
      exit;
      end;
   2: begin
      sg.Canvas.Draw(l,t,Bexpand);//flat
      exit;
      end;
   3: begin
      sg.Canvas.Draw(l,t,Bgopath);//non recursive search
      exit;
      end;
   end;
   end;
if mntmediaunits(s)=true then
   begin
   sg.Canvas.Draw(l,t,Bremovable_supported);
   exit;
   end;
if (s = desktop_path) or (s=txt_desktop) then
   begin
   sg.Canvas.Draw(l,t,Bdesk);
   exit;
   end;
if (s = home_path) or (s=txt_2_9_home) then
   begin
   sg.Canvas.Draw(l,t,Bhomefolder);
   exit;
   end;
if (s = usr_documents) or (s=txt_2_4_documents) then
   begin
   sg.Canvas.Draw(l,t,Bfilesupported);
   exit;
   end;
if (s = usr_downloads) or (s=txt_3_1_downloads) then
   begin
   sg.Canvas.Draw(l,t,Bdownloadfolder);
   exit;
   end;
if (s = usr_music) or (s=txt_5_0_music) then
   begin
   sg.Canvas.Draw(l,t,Baudio);
   exit;
   end;
if (s = usr_pictures) or (s=txt_5_0_pictures) then
   begin
   sg.Canvas.Draw(l,t,Bimage);
   exit;
   end;
if (s = usr_videos) or (s=txt_5_0_videos) then
   begin
   sg.Canvas.Draw(l,t,Bvideo);
   exit;
   end;
if (s = shared_dropbox) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_sharepointwork) or (s = shared_yandex)then
   begin
   sg.Canvas.Draw(l,t,Bcloudfolder);
   exit;
   end;
{$IFDEF MSWINDOWS}
if length(s) = 3 then
   begin
   i:=ord(s[1])-64;
   sg.Canvas.Draw(l,t,devicon[i]);
   exit;
   end;
{$ENDIF}
if s<>'' then
   if s[length(s)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=extractfileext(s);
if sg.Cells[1,arow]<>'' then
   sg.Canvas.Draw(l,t,pgetbitmap(geticon(s,fulltype,false)));
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GUI FORM SET items values

///////////////////////////////////////////////////////////////////////////////}

procedure positem(var scro:TScrollBox; toppos:integer);
begin
if toppos<0 then toppos:=0;
if toppos>scro.VertScrollBar.Range then toppos:=0;
scro.VertScrollBar.Position:=toppos;
end;

procedure set_adveditcl(i:integer);
begin
case i of
   1: FormPeach.Labelcbsampleadvanced.caption:=advedit1before+stringdelim('%f')+advedit1after;
   2: FormPeach.Labelcbsampleadvanced.caption:=advedit2before+stringdelim('%f')+advedit2after;
   3: FormPeach.Labelcbsampleadvanced.caption:=advedit3before+stringdelim('%f')+advedit3after;
   4: FormPeach.Labelcbsampleadvanced.caption:=advedit4before+stringdelim('%f')+advedit4after;
   5: FormPeach.Labelcbsampleadvanced.caption:=advedit5before+stringdelim('%f')+advedit5after;
   6: FormPeach.Labelcbsampleadvanced.caption:=advedit6before+stringdelim('%f')+advedit6after;
   7: FormPeach.Labelcbsampleadvanced.caption:=advedit7before+stringdelim('%f')+advedit7after;
   8: FormPeach.Labelcbsampleadvanced.caption:=advedit8before+stringdelim('%f')+advedit8after;
   end;
end;

procedure setdescription_advcustedit;
var
   s:ansistring;
   sg:TStringGrid;
begin
sg:=FormPeach.StringGridCustEditAdv;
s:=sg.Cells[1,sg.Row];
if InputQuery(txt_description, '', s) then
   begin
   sg.Cells[1,sg.Row]:=s;
   sg.AutoSizeColumns;
   end;
set_adveditcl(sg.Row);
end;

procedure setdescription_custedit;
var
   s:ansistring;
begin
s:=FormPeach.StringGridCustedit.Cells[1,FormPeach.StringGridCustedit.Row];
if InputQuery(txt_description, '', s) then
   begin
   FormPeach.StringGridCustedit.Cells[1,FormPeach.StringGridCustedit.Row]:=s;
   FormPeach.StringGridCustedit.AutoSizeColumns;
   end;
end;

procedure editstring1_advcustedit;
var
   s:ansistring;
begin
s:=FormPeach.StringGridCustEditAdv.Cells[2,FormPeach.StringGridCustEditAdv.Row];
if InputQuery(txt_2_5_strbefore, '', s) then
   begin
   FormPeach.StringGridCustEditAdv.Cells[2,FormPeach.StringGridCustEditAdv.Row]:=s;
   FormPeach.StringGridCustEditAdv.AutoSizeColumns;
   end;
set_adveditcl(FormPeach.StringGridCustEditAdv.Row);
end;

procedure editstring2_advcustedit;
var
   s:ansistring;
begin
s:=FormPeach.StringGridCustEditAdv.Cells[3,FormPeach.StringGridCustEditAdv.Row];
if InputQuery(txt_2_5_strafter, '', s) then
   begin
   FormPeach.StringGridCustEditAdv.Cells[3,FormPeach.StringGridCustEditAdv.Row]:=s;
   FormPeach.StringGridCustEditAdv.AutoSizeColumns;
   end;
set_adveditcl(FormPeach.StringGridCustEditAdv.Row);
end;

procedure editstring3_advcustedit;
var
   s:ansistring;
begin
s:=FormPeach.StringGridCustEditAdv.Cells[4,FormPeach.StringGridCustEditAdv.Row];
if InputQuery(txt_3_3_stralt, '', s) then
   begin
   FormPeach.StringGridCustEditAdv.Cells[4,FormPeach.StringGridCustEditAdv.Row]:=s;
   FormPeach.StringGridCustEditAdv.AutoSizeColumns;
   end;
set_adveditcl(FormPeach.StringGridCustEditAdv.Row);
end;

procedure editapp_custedit;
var
   s:ansistring;
begin
s:=FormPeach.StringGridCustedit.Cells[2,FormPeach.StringGridCustedit.Row];
if InputQuery(txt_edit, '', s) then
   begin
   FormPeach.StringGridCustedit.Cells[2,FormPeach.StringGridCustedit.Row]:=s;
   FormPeach.StringGridCustedit.AutoSizeColumns;
   end;
end;

function translatespecialfolders(var s: ansistring):boolean;
begin
result:=false;
if s = 'Computer''s root' then begin s:=txt_mypc; result:=true; end;
if s = desktop_path then begin s:=txt_desktop; result:=true; end;
if s = home_path then begin s:=txt_2_9_home; result:=true; end;
if s = usr_documents then begin s:=txt_2_4_documents; result:=true; end;
if s = usr_downloads then begin s:=txt_3_1_downloads; result:=true; end;
if s = usr_music then begin s:=txt_5_0_music; result:=true; end;
if s = usr_pictures then begin s:=txt_5_0_pictures; result:=true; end;
if s = usr_videos then begin s:=txt_5_0_videos; result:=true; end;
end;

procedure set_ow_custedit_menu;
begin
with FormPeach do
begin
if StringGridCustedit.Cells[1,1]<>'' then owcustom1.Caption:=StringGridCustedit.Cells[1,1]
else
   if extractfilename(custedit1)<>'' then owcustom1.Caption:=extractfilename(custedit1)
   else owcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then owcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if extractfilename(custedit2)<>'' then owcustom2.Caption:=extractfilename(custedit2)
   else owcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then owcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if extractfilename(custedit3)<>'' then owcustom3.Caption:=extractfilename(custedit3)
   else owcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then owcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if extractfilename(custedit4)<>'' then owcustom4.Caption:=extractfilename(custedit4)
   else owcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then owcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if extractfilename(custedit5)<>'' then owcustom5.Caption:=extractfilename(custedit5)
   else owcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then owcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if extractfilename(custedit6)<>'' then owcustom6.Caption:=extractfilename(custedit6)
   else owcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then owcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if extractfilename(custedit7)<>'' then owcustom7.Caption:=extractfilename(custedit7)
   else owcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then owcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if extractfilename(custedit8)<>'' then owcustom8.Caption:=extractfilename(custedit8)
   else owcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then owcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if extractfilename(custedit9)<>'' then owcustom_9.Caption:=extractfilename(custedit9)
   else owcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then owcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if extractfilename(custedit10)<>'' then owcustom_10.Caption:=extractfilename(custedit10)
   else owcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then owcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if extractfilename(custedit11)<>'' then owcustom_11.Caption:=extractfilename(custedit11)
   else owcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then owcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if extractfilename(custedit12)<>'' then owcustom_12.Caption:=extractfilename(custedit12)
   else owcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then owcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if extractfilename(custedit13)<>'' then owcustom_13.Caption:=extractfilename(custedit13)
   else owcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then owcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if extractfilename(custedit14)<>'' then owcustom_14.Caption:=extractfilename(custedit14)
   else owcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then owcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if extractfilename(custedit15)<>'' then owcustom_15.Caption:=extractfilename(custedit15)
   else owcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then owcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if extractfilename(custedit16)<>'' then owcustom_16.Caption:=extractfilename(custedit16)
   else owcustom_16.Caption:=custedit16;
if StringGridCustEditAdv.Cells[1,1]<>'' then owcustom9.Caption:=StringGridCustEditAdv.Cells[1,1]
else owcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustEditAdv.Cells[1,2]<>'' then owcustom10.Caption:=StringGridCustEditAdv.Cells[1,2]
else owcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustEditAdv.Cells[1,3]<>'' then owcustom11.Caption:=StringGridCustEditAdv.Cells[1,3]
else owcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustEditAdv.Cells[1,4]<>'' then owcustom12.Caption:=StringGridCustEditAdv.Cells[1,4]
else owcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustEditAdv.Cells[1,5]<>'' then owcustom13.Caption:=StringGridCustEditAdv.Cells[1,5]
else owcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustEditAdv.Cells[1,6]<>'' then owcustom14.Caption:=StringGridCustEditAdv.Cells[1,6]
else owcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustEditAdv.Cells[1,7]<>'' then owcustom15.Caption:=StringGridCustEditAdv.Cells[1,7]
else owcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustEditAdv.Cells[1,8]<>'' then owcustom16.Caption:=StringGridCustEditAdv.Cells[1,8]
else owcustom16.Caption:=advedit8before+stringdelim('%f')+advedit8after;
if custedit1<>'' then owcustom1.visible:=true else owcustom1.visible:=false;
if custedit2<>'' then owcustom2.visible:=true else owcustom2.visible:=false;
if custedit3<>'' then owcustom3.visible:=true else owcustom3.visible:=false;
if custedit4<>'' then owcustom4.visible:=true else owcustom4.visible:=false;
if custedit5<>'' then owcustom5.visible:=true else owcustom5.visible:=false;
if custedit6<>'' then owcustom6.visible:=true else owcustom6.visible:=false;
if custedit7<>'' then owcustom7.visible:=true else owcustom7.visible:=false;
if custedit8<>'' then owcustom8.visible:=true else owcustom8.visible:=false;
if custedit9<>'' then owcustom_9.visible:=true else owcustom_9.visible:=false;
if custedit10<>'' then owcustom_10.visible:=true else owcustom_10.visible:=false;
if custedit11<>'' then owcustom_11.visible:=true else owcustom_11.visible:=false;
if custedit12<>'' then owcustom_12.visible:=true else owcustom_12.visible:=false;
if custedit13<>'' then owcustom_13.visible:=true else owcustom_13.visible:=false;
if custedit14<>'' then owcustom_14.visible:=true else owcustom_14.visible:=false;
if custedit15<>'' then owcustom_15.visible:=true else owcustom_15.visible:=false;
if custedit16<>'' then owcustom_16.visible:=true else owcustom_16.visible:=false;
if advedit1before+advedit1after<>'' then owcustom9.visible:=true else owcustom9.visible:=false;
if advedit2before+advedit2after<>'' then owcustom10.visible:=true else owcustom10.visible:=false;
if advedit3before+advedit3after<>'' then owcustom11.visible:=true else owcustom11.visible:=false;
if advedit4before+advedit4after<>'' then owcustom12.visible:=true else owcustom12.visible:=false;
if advedit5before+advedit5after<>'' then owcustom13.visible:=true else owcustom13.visible:=false;
if advedit6before+advedit6after<>'' then owcustom14.visible:=true else owcustom14.visible:=false;
if advedit7before+advedit7after<>'' then owcustom15.visible:=true else owcustom15.visible:=false;
if advedit8before+advedit8after<>'' then owcustom16.visible:=true else owcustom16.visible:=false;
pmmore1.caption:=owcustom9.caption;
pmmore2.caption:=owcustom10.caption;
pmmore3.caption:=owcustom11.caption;
pmmore4.caption:=owcustom12.caption;
pmmore5.caption:=owcustom13.caption;
pmmore6.caption:=owcustom14.caption;
pmmore7.caption:=owcustom15.caption;
pmmore8.caption:=owcustom16.caption;
pmmore1.visible:=owcustom9.visible;
pmmore2.visible:=owcustom10.visible;
pmmore3.visible:=owcustom11.visible;
pmmore4.visible:=owcustom12.visible;
pmmore5.visible:=owcustom13.visible;
pmmore6.visible:=owcustom14.visible;
pmmore7.visible:=owcustom15.visible;
pmmore8.visible:=owcustom16.visible;
pmapp1.Caption:=owcustom1.Caption;
pmapp1.Visible:=owcustom1.Visible;
pmapp2.Caption:=owcustom2.Caption;
pmapp2.Visible:=owcustom2.Visible;
pmapp3.Caption:=owcustom3.Caption;
pmapp3.Visible:=owcustom3.Visible;
pmapp4.Caption:=owcustom4.Caption;
pmapp4.Visible:=owcustom4.Visible;
pmapp5.Caption:=owcustom5.Caption;
pmapp5.Visible:=owcustom5.Visible;
pmapp6.Caption:=owcustom6.Caption;
pmapp6.Visible:=owcustom6.Visible;
pmapp7.Caption:=owcustom7.Caption;
pmapp7.Visible:=owcustom7.Visible;
pmapp8.Caption:=owcustom8.Caption;
pmapp8.Visible:=owcustom8.Visible;
pmapp9.Caption:=owcustom_9.Caption;
pmapp9.Visible:=owcustom_9.Visible;
pmapp10.Caption:=owcustom_10.Caption;
pmapp10.Visible:=owcustom_10.Visible;
pmapp11.Caption:=owcustom_11.Caption;
pmapp11.Visible:=owcustom_11.Visible;
pmapp12.Caption:=owcustom_12.Caption;
pmapp12.Visible:=owcustom_12.Visible;
pmapp13.Caption:=owcustom_13.Caption;
pmapp13.Visible:=owcustom_13.Visible;
pmapp14.Caption:=owcustom_14.Caption;
pmapp14.Visible:=owcustom_14.Visible;
pmapp15.Caption:=owcustom_15.Caption;
pmapp15.Visible:=owcustom_15.Visible;
pmapp16.Caption:=owcustom_16.Caption;
pmapp16.Visible:=owcustom_16.Visible;
pmappadv1.Caption:=owcustom9.Caption;
pmappadv1.Visible:=owcustom9.Visible;
pmappadv2.Caption:=owcustom10.Caption;
pmappadv2.Visible:=owcustom10.Visible;
pmappadv3.Caption:=owcustom11.Caption;
pmappadv3.Visible:=owcustom11.Visible;
pmappadv4.Caption:=owcustom12.Caption;
pmappadv4.Visible:=owcustom12.Visible;
pmappadv5.Caption:=owcustom13.Caption;
pmappadv5.Visible:=owcustom13.Visible;
pmappadv6.Caption:=owcustom14.Caption;
pmappadv6.Visible:=owcustom14.Visible;
pmappadv7.Caption:=owcustom15.Caption;
pmappadv7.Visible:=owcustom15.Visible;
pmappadv8.Caption:=owcustom16.Caption;
pmappadv8.Visible:=owcustom16.Visible;
end;
end;

procedure set_eow_custedit_menu;
begin
with FormPeach do
begin
if StringGridCustedit.Cells[1,1]<>'' then eowcustom1.Caption:=StringGridCustedit.Cells[1,1]
else
   if extractfilename(custedit1)<>'' then eowcustom1.Caption:=extractfilename(custedit1)
   else eowcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then eowcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if extractfilename(custedit2)<>'' then eowcustom2.Caption:=extractfilename(custedit2)
   else eowcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then eowcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if extractfilename(custedit3)<>'' then eowcustom3.Caption:=extractfilename(custedit3)
   else eowcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then eowcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if extractfilename(custedit4)<>'' then eowcustom4.Caption:=extractfilename(custedit4)
   else eowcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then eowcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if extractfilename(custedit5)<>'' then eowcustom5.Caption:=extractfilename(custedit5)
   else eowcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then eowcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if extractfilename(custedit6)<>'' then eowcustom6.Caption:=extractfilename(custedit6)
   else eowcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then eowcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if extractfilename(custedit7)<>'' then eowcustom7.Caption:=extractfilename(custedit7)
   else eowcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then eowcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if extractfilename(custedit8)<>'' then eowcustom8.Caption:=extractfilename(custedit8)
   else eowcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then eowcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if extractfilename(custedit9)<>'' then eowcustom_9.Caption:=extractfilename(custedit9)
   else eowcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then eowcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if extractfilename(custedit10)<>'' then eowcustom_10.Caption:=extractfilename(custedit10)
   else eowcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then eowcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if extractfilename(custedit11)<>'' then eowcustom_11.Caption:=extractfilename(custedit11)
   else eowcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then eowcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if extractfilename(custedit12)<>'' then eowcustom_12.Caption:=extractfilename(custedit12)
   else eowcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then eowcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if extractfilename(custedit13)<>'' then eowcustom_13.Caption:=extractfilename(custedit13)
   else eowcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then eowcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if extractfilename(custedit14)<>'' then eowcustom_14.Caption:=extractfilename(custedit14)
   else eowcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then eowcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if extractfilename(custedit15)<>'' then eowcustom_15.Caption:=extractfilename(custedit15)
   else eowcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then eowcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if extractfilename(custedit16)<>'' then eowcustom_16.Caption:=extractfilename(custedit16)
   else eowcustom_16.Caption:=custedit16;
if StringGridCustEditAdv.Cells[1,1]<>'' then eowcustom9.Caption:=StringGridCustEditAdv.Cells[1,1]
else eowcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustEditAdv.Cells[1,2]<>'' then eowcustom10.Caption:=StringGridCustEditAdv.Cells[1,2]
else eowcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustEditAdv.Cells[1,3]<>'' then eowcustom11.Caption:=StringGridCustEditAdv.Cells[1,3]
else eowcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustEditAdv.Cells[1,4]<>'' then eowcustom12.Caption:=StringGridCustEditAdv.Cells[1,4]
else eowcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustEditAdv.Cells[1,5]<>'' then eowcustom13.Caption:=StringGridCustEditAdv.Cells[1,5]
else eowcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustEditAdv.Cells[1,6]<>'' then eowcustom14.Caption:=StringGridCustEditAdv.Cells[1,6]
else eowcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustEditAdv.Cells[1,7]<>'' then eowcustom15.Caption:=StringGridCustEditAdv.Cells[1,7]
else eowcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustEditAdv.Cells[1,8]<>'' then eowcustom16.Caption:=StringGridCustEditAdv.Cells[1,8]
else eowcustom16.Caption:=advedit8before+stringdelim('%f')+advedit8after;
if custedit1<>'' then eowcustom1.visible:=true else eowcustom1.visible:=false;
if custedit2<>'' then eowcustom2.visible:=true else eowcustom2.visible:=false;
if custedit3<>'' then eowcustom3.visible:=true else eowcustom3.visible:=false;
if custedit4<>'' then eowcustom4.visible:=true else eowcustom4.visible:=false;
if custedit5<>'' then eowcustom5.visible:=true else eowcustom5.visible:=false;
if custedit6<>'' then eowcustom6.visible:=true else eowcustom6.visible:=false;
if custedit7<>'' then eowcustom7.visible:=true else eowcustom7.visible:=false;
if custedit8<>'' then eowcustom8.visible:=true else eowcustom8.visible:=false;
if custedit9<>'' then eowcustom_9.visible:=true else eowcustom_9.visible:=false;
if custedit10<>'' then eowcustom_10.visible:=true else eowcustom_10.visible:=false;
if custedit11<>'' then eowcustom_11.visible:=true else eowcustom_11.visible:=false;
if custedit12<>'' then eowcustom_12.visible:=true else eowcustom_12.visible:=false;
if custedit13<>'' then eowcustom_13.visible:=true else eowcustom_13.visible:=false;
if custedit14<>'' then eowcustom_14.visible:=true else eowcustom_14.visible:=false;
if custedit15<>'' then eowcustom_15.visible:=true else eowcustom_15.visible:=false;
if custedit16<>'' then eowcustom_16.visible:=true else eowcustom_16.visible:=false;
if advedit1before+advedit1after<>'' then eowcustom9.visible:=true else eowcustom9.visible:=false;
if advedit2before+advedit2after<>'' then eowcustom10.visible:=true else eowcustom10.visible:=false;
if advedit3before+advedit3after<>'' then eowcustom11.visible:=true else eowcustom11.visible:=false;
if advedit4before+advedit4after<>'' then eowcustom12.visible:=true else eowcustom12.visible:=false;
if advedit5before+advedit5after<>'' then eowcustom13.visible:=true else eowcustom13.visible:=false;
if advedit6before+advedit6after<>'' then eowcustom14.visible:=true else eowcustom14.visible:=false;
if advedit7before+advedit7after<>'' then eowcustom15.visible:=true else eowcustom15.visible:=false;
if advedit8before+advedit8after<>'' then eowcustom16.visible:=true else eowcustom16.visible:=false;
end;
end;

procedure set_pow_custedit_menu;
begin
with FormPeach do
begin
if StringGridCustedit.Cells[1,1]<>'' then powcustom1.Caption:=StringGridCustedit.Cells[1,1]
else
   if extractfilename(custedit1)<>'' then powcustom1.Caption:=extractfilename(custedit1)
   else powcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then powcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if extractfilename(custedit2)<>'' then powcustom2.Caption:=extractfilename(custedit2)
   else powcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then powcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if extractfilename(custedit3)<>'' then powcustom3.Caption:=extractfilename(custedit3)
   else powcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then powcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if extractfilename(custedit4)<>'' then powcustom4.Caption:=extractfilename(custedit4)
   else powcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then powcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if extractfilename(custedit5)<>'' then powcustom5.Caption:=extractfilename(custedit5)
   else powcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then powcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if extractfilename(custedit6)<>'' then powcustom6.Caption:=extractfilename(custedit6)
   else powcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then powcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if extractfilename(custedit7)<>'' then powcustom7.Caption:=extractfilename(custedit7)
   else powcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then powcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if extractfilename(custedit8)<>'' then powcustom8.Caption:=extractfilename(custedit8)
   else powcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then powcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if extractfilename(custedit9)<>'' then powcustom_9.Caption:=extractfilename(custedit9)
   else powcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then powcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if extractfilename(custedit10)<>'' then powcustom_10.Caption:=extractfilename(custedit10)
   else powcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then powcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if extractfilename(custedit11)<>'' then powcustom_11.Caption:=extractfilename(custedit11)
   else powcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then powcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if extractfilename(custedit12)<>'' then powcustom_12.Caption:=extractfilename(custedit12)
   else powcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then powcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if extractfilename(custedit13)<>'' then powcustom_13.Caption:=extractfilename(custedit13)
   else powcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then powcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if extractfilename(custedit14)<>'' then powcustom_14.Caption:=extractfilename(custedit14)
   else powcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then powcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if extractfilename(custedit15)<>'' then powcustom_15.Caption:=extractfilename(custedit15)
   else powcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then powcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if extractfilename(custedit16)<>'' then powcustom_16.Caption:=extractfilename(custedit16)
   else powcustom_16.Caption:=custedit16;
if StringGridCustEditAdv.Cells[1,1]<>'' then powcustom9.Caption:=StringGridCustEditAdv.Cells[1,1]
else powcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustEditAdv.Cells[1,2]<>'' then powcustom10.Caption:=StringGridCustEditAdv.Cells[1,2]
else powcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustEditAdv.Cells[1,3]<>'' then powcustom11.Caption:=StringGridCustEditAdv.Cells[1,3]
else powcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustEditAdv.Cells[1,4]<>'' then powcustom12.Caption:=StringGridCustEditAdv.Cells[1,4]
else powcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustEditAdv.Cells[1,5]<>'' then powcustom13.Caption:=StringGridCustEditAdv.Cells[1,5]
else powcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustEditAdv.Cells[1,6]<>'' then powcustom14.Caption:=StringGridCustEditAdv.Cells[1,6]
else powcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustEditAdv.Cells[1,7]<>'' then powcustom15.Caption:=StringGridCustEditAdv.Cells[1,7]
else powcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustEditAdv.Cells[1,8]<>'' then powcustom16.Caption:=StringGridCustEditAdv.Cells[1,8]
else powcustom16.Caption:=advedit8before+stringdelim('%f')+advedit8after;
if custedit1<>'' then powcustom1.visible:=true else powcustom1.visible:=false;
if custedit2<>'' then powcustom2.visible:=true else powcustom2.visible:=false;
if custedit3<>'' then powcustom3.visible:=true else powcustom3.visible:=false;
if custedit4<>'' then powcustom4.visible:=true else powcustom4.visible:=false;
if custedit5<>'' then powcustom5.visible:=true else powcustom5.visible:=false;
if custedit6<>'' then powcustom6.visible:=true else powcustom6.visible:=false;
if custedit7<>'' then powcustom7.visible:=true else powcustom7.visible:=false;
if custedit8<>'' then powcustom8.visible:=true else powcustom8.visible:=false;
if custedit9<>'' then powcustom_9.visible:=true else powcustom_9.visible:=false;
if custedit10<>'' then powcustom_10.visible:=true else powcustom_10.visible:=false;
if custedit11<>'' then powcustom_11.visible:=true else powcustom_11.visible:=false;
if custedit12<>'' then powcustom_12.visible:=true else powcustom_12.visible:=false;
if custedit13<>'' then powcustom_13.visible:=true else powcustom_13.visible:=false;
if custedit14<>'' then powcustom_14.visible:=true else powcustom_14.visible:=false;
if custedit15<>'' then powcustom_15.visible:=true else powcustom_15.visible:=false;
if custedit16<>'' then powcustom_16.visible:=true else powcustom_16.visible:=false;
if advedit1before+advedit1after<>'' then powcustom9.visible:=true else powcustom9.visible:=false;
if advedit2before+advedit2after<>'' then powcustom10.visible:=true else powcustom10.visible:=false;
if advedit3before+advedit3after<>'' then powcustom11.visible:=true else powcustom11.visible:=false;
if advedit4before+advedit4after<>'' then powcustom12.visible:=true else powcustom12.visible:=false;
if advedit5before+advedit5after<>'' then powcustom13.visible:=true else powcustom13.visible:=false;
if advedit6before+advedit6after<>'' then powcustom14.visible:=true else powcustom14.visible:=false;
if advedit7before+advedit7after<>'' then powcustom15.visible:=true else powcustom15.visible:=false;
if advedit8before+advedit8after<>'' then powcustom16.visible:=true else powcustom16.visible:=false;
end;
end;

procedure set_aow_custedit_menu;
begin
with FormPeach do
begin
if StringGridCustedit.Cells[1,1]<>'' then aowcustom1.Caption:=StringGridCustedit.Cells[1,1]
else
   if extractfilename(custedit1)<>'' then aowcustom1.Caption:=extractfilename(custedit1)
   else aowcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then aowcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if extractfilename(custedit2)<>'' then aowcustom2.Caption:=extractfilename(custedit2)
   else aowcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then aowcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if extractfilename(custedit3)<>'' then aowcustom3.Caption:=extractfilename(custedit3)
   else aowcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then aowcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if extractfilename(custedit4)<>'' then aowcustom4.Caption:=extractfilename(custedit4)
   else aowcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then aowcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if extractfilename(custedit5)<>'' then aowcustom5.Caption:=extractfilename(custedit5)
   else aowcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then aowcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if extractfilename(custedit6)<>'' then aowcustom6.Caption:=extractfilename(custedit6)
   else aowcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then aowcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if extractfilename(custedit7)<>'' then aowcustom7.Caption:=extractfilename(custedit7)
   else aowcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then aowcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if extractfilename(custedit8)<>'' then aowcustom8.Caption:=extractfilename(custedit8)
   else aowcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then aowcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if extractfilename(custedit9)<>'' then aowcustom_9.Caption:=extractfilename(custedit9)
   else aowcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then aowcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if extractfilename(custedit10)<>'' then aowcustom_10.Caption:=extractfilename(custedit10)
   else aowcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then aowcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if extractfilename(custedit11)<>'' then aowcustom_11.Caption:=extractfilename(custedit11)
   else aowcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then aowcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if extractfilename(custedit12)<>'' then aowcustom_12.Caption:=extractfilename(custedit12)
   else aowcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then aowcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if extractfilename(custedit13)<>'' then aowcustom_13.Caption:=extractfilename(custedit13)
   else aowcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then aowcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if extractfilename(custedit14)<>'' then aowcustom_14.Caption:=extractfilename(custedit14)
   else aowcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then aowcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if extractfilename(custedit15)<>'' then aowcustom_15.Caption:=extractfilename(custedit15)
   else aowcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then aowcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if extractfilename(custedit16)<>'' then aowcustom_16.Caption:=extractfilename(custedit16)
   else aowcustom_16.Caption:=custedit16;
if StringGridCustEditAdv.Cells[1,1]<>'' then aowcustom9.Caption:=StringGridCustEditAdv.Cells[1,1]
else aowcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustEditAdv.Cells[1,2]<>'' then aowcustom10.Caption:=StringGridCustEditAdv.Cells[1,2]
else aowcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustEditAdv.Cells[1,3]<>'' then aowcustom11.Caption:=StringGridCustEditAdv.Cells[1,3]
else aowcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustEditAdv.Cells[1,4]<>'' then aowcustom12.Caption:=StringGridCustEditAdv.Cells[1,4]
else aowcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustEditAdv.Cells[1,5]<>'' then aowcustom13.Caption:=StringGridCustEditAdv.Cells[1,5]
else aowcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustEditAdv.Cells[1,6]<>'' then aowcustom14.Caption:=StringGridCustEditAdv.Cells[1,6]
else aowcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustEditAdv.Cells[1,7]<>'' then aowcustom15.Caption:=StringGridCustEditAdv.Cells[1,7]
else aowcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustEditAdv.Cells[1,8]<>'' then aowcustom16.Caption:=StringGridCustEditAdv.Cells[1,8]
else aowcustom16.Caption:=advedit8before+stringdelim('%f')+advedit8after;
if custedit1<>'' then aowcustom1.visible:=true else aowcustom1.visible:=false;
if custedit2<>'' then aowcustom2.visible:=true else aowcustom2.visible:=false;
if custedit3<>'' then aowcustom3.visible:=true else aowcustom3.visible:=false;
if custedit4<>'' then aowcustom4.visible:=true else aowcustom4.visible:=false;
if custedit5<>'' then aowcustom5.visible:=true else aowcustom5.visible:=false;
if custedit6<>'' then aowcustom6.visible:=true else aowcustom6.visible:=false;
if custedit7<>'' then aowcustom7.visible:=true else aowcustom7.visible:=false;
if custedit8<>'' then aowcustom8.visible:=true else aowcustom8.visible:=false;
if custedit9<>'' then aowcustom_9.visible:=true else aowcustom_9.visible:=false;
if custedit10<>'' then aowcustom_10.visible:=true else aowcustom_10.visible:=false;
if custedit11<>'' then aowcustom_11.visible:=true else aowcustom_11.visible:=false;
if custedit12<>'' then aowcustom_12.visible:=true else aowcustom_12.visible:=false;
if custedit13<>'' then aowcustom_13.visible:=true else aowcustom_13.visible:=false;
if custedit14<>'' then aowcustom_14.visible:=true else aowcustom_14.visible:=false;
if custedit15<>'' then aowcustom_15.visible:=true else aowcustom_15.visible:=false;
if custedit16<>'' then aowcustom_16.visible:=true else aowcustom_16.visible:=false;
if advedit1before+advedit1after<>'' then aowcustom9.visible:=true else aowcustom9.visible:=false;
if advedit2before+advedit2after<>'' then aowcustom10.visible:=true else aowcustom10.visible:=false;
if advedit3before+advedit3after<>'' then aowcustom11.visible:=true else aowcustom11.visible:=false;
if advedit4before+advedit4after<>'' then aowcustom12.visible:=true else aowcustom12.visible:=false;
if advedit5before+advedit5after<>'' then aowcustom13.visible:=true else aowcustom13.visible:=false;
if advedit6before+advedit6after<>'' then aowcustom14.visible:=true else aowcustom14.visible:=false;
if advedit7before+advedit7after<>'' then aowcustom15.visible:=true else aowcustom15.visible:=false;
if advedit8before+advedit8after<>'' then aowcustom16.visible:=true else aowcustom16.visible:=false;
if advedit1before+advedit2before+advedit3before+advedit4before+advedit5before+advedit6before+advedit7before+advedit8before+
   advedit1after+advedit2after+advedit3after+advedit4after+advedit5after+advedit6after+advedit7after+advedit8after<>'' then aowseparator2.visible:=true else aowseparator2.visible:=false;
end;
end;

procedure set_custedit_menus;
begin
set_ow_custedit_menu;
set_eow_custedit_menu;
set_pow_custedit_menu;
set_aow_custedit_menu;
populatetree;
end;

procedure set_custedit_fromtable;
begin
with FormPeach do
begin
custedit1:=StringGridCustedit.Cells[2,1];
custedit2:=StringGridCustedit.Cells[2,2];
custedit3:=StringGridCustedit.Cells[2,3];
custedit4:=StringGridCustedit.Cells[2,4];
custedit5:=StringGridCustedit.Cells[2,5];
custedit6:=StringGridCustedit.Cells[2,6];
custedit7:=StringGridCustedit.Cells[2,7];
custedit8:=StringGridCustedit.Cells[2,8];
custedit9:=StringGridCustedit.Cells[2,9];
custedit10:=StringGridCustedit.Cells[2,10];
custedit11:=StringGridCustedit.Cells[2,11];
custedit12:=StringGridCustedit.Cells[2,12];
custedit13:=StringGridCustedit.Cells[2,13];
custedit14:=StringGridCustedit.Cells[2,14];
custedit15:=StringGridCustedit.Cells[2,15];
custedit16:=StringGridCustedit.Cells[2,16];
advedit1before:=StringGridCustEditAdv.Cells[2,1];
advedit2before:=StringGridCustEditAdv.Cells[2,2];
advedit3before:=StringGridCustEditAdv.Cells[2,3];
advedit4before:=StringGridCustEditAdv.Cells[2,4];
advedit5before:=StringGridCustEditAdv.Cells[2,5];
advedit6before:=StringGridCustEditAdv.Cells[2,6];
advedit7before:=StringGridCustEditAdv.Cells[2,7];
advedit8before:=StringGridCustEditAdv.Cells[2,8];
advedit1after:=StringGridCustEditAdv.Cells[3,1];
advedit2after:=StringGridCustEditAdv.Cells[3,2];
advedit3after:=StringGridCustEditAdv.Cells[3,3];
advedit4after:=StringGridCustEditAdv.Cells[3,4];
advedit5after:=StringGridCustEditAdv.Cells[3,5];
advedit6after:=StringGridCustEditAdv.Cells[3,6];
advedit7after:=StringGridCustEditAdv.Cells[3,7];
advedit8after:=StringGridCustEditAdv.Cells[3,8];
advedit1alt:=StringGridCustEditAdv.Cells[4,1];
advedit2alt:=StringGridCustEditAdv.Cells[4,2];
advedit3alt:=StringGridCustEditAdv.Cells[4,3];
advedit4alt:=StringGridCustEditAdv.Cells[4,4];
advedit5alt:=StringGridCustEditAdv.Cells[4,5];
advedit6alt:=StringGridCustEditAdv.Cells[4,6];
advedit7alt:=StringGridCustEditAdv.Cells[4,7];
advedit8alt:=StringGridCustEditAdv.Cells[4,8];
end;
end;

procedure set_custedit_totable;
begin
with FormPeach do
begin
StringGridCustedit.Cells[2,1]:=custedit1;
StringGridCustedit.Cells[2,2]:=custedit2;
StringGridCustedit.Cells[2,3]:=custedit3;
StringGridCustedit.Cells[2,4]:=custedit4;
StringGridCustedit.Cells[2,5]:=custedit5;
StringGridCustedit.Cells[2,6]:=custedit6;
StringGridCustedit.Cells[2,7]:=custedit7;
StringGridCustedit.Cells[2,8]:=custedit8;
StringGridCustedit.Cells[2,9]:=custedit9;
StringGridCustedit.Cells[2,10]:=custedit10;
StringGridCustedit.Cells[2,11]:=custedit11;
StringGridCustedit.Cells[2,12]:=custedit12;
StringGridCustedit.Cells[2,13]:=custedit13;
StringGridCustedit.Cells[2,14]:=custedit14;
StringGridCustedit.Cells[2,15]:=custedit15;
StringGridCustedit.Cells[2,16]:=custedit16;
StringGridCustedit.AutoSizeColumns;
StringGridCustEditAdv.Cells[2,1]:=advedit1before;
StringGridCustEditAdv.Cells[2,2]:=advedit2before;
StringGridCustEditAdv.Cells[2,3]:=advedit3before;
StringGridCustEditAdv.Cells[2,4]:=advedit4before;
StringGridCustEditAdv.Cells[2,5]:=advedit5before;
StringGridCustEditAdv.Cells[2,6]:=advedit6before;
StringGridCustEditAdv.Cells[2,7]:=advedit7before;
StringGridCustEditAdv.Cells[2,8]:=advedit8before;
StringGridCustEditAdv.Cells[3,1]:=advedit1after;
StringGridCustEditAdv.Cells[3,2]:=advedit2after;
StringGridCustEditAdv.Cells[3,3]:=advedit3after;
StringGridCustEditAdv.Cells[3,4]:=advedit4after;
StringGridCustEditAdv.Cells[3,5]:=advedit5after;
StringGridCustEditAdv.Cells[3,6]:=advedit6after;
StringGridCustEditAdv.Cells[3,7]:=advedit7after;
StringGridCustEditAdv.Cells[3,8]:=advedit8after;
StringGridCustEditAdv.Cells[4,1]:=advedit1alt;
StringGridCustEditAdv.Cells[4,2]:=advedit2alt;
StringGridCustEditAdv.Cells[4,3]:=advedit3alt;
StringGridCustEditAdv.Cells[4,4]:=advedit4alt;
StringGridCustEditAdv.Cells[4,5]:=advedit5alt;
StringGridCustEditAdv.Cells[4,6]:=advedit6alt;
StringGridCustEditAdv.Cells[4,7]:=advedit7alt;
StringGridCustEditAdv.Cells[4,8]:=advedit8alt;
StringGridCustEditAdv.AutoSizeColumns;
end;
end;

procedure populaterecentpanel;
var
   i:integer;
begin
try
FormPeach.StringGridRecent.Rowcount:=17;
i:=1;
if FormPeach.mRecent1f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent1f.Caption; i:=i+1; end;
if FormPeach.mRecent2f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent2f.Caption; i:=i+1; end;
if FormPeach.mRecent3f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent3f.Caption; i:=i+1; end;
if FormPeach.mRecent4f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent4f.Caption; i:=i+1; end;
if FormPeach.mRecent5f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent5f.Caption; i:=i+1; end;
if FormPeach.mRecent6f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent6f.Caption; i:=i+1; end;
if FormPeach.mRecent7f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent7f.Caption; i:=i+1; end;
if FormPeach.mRecent8f.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=''; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent8f.Caption; i:=i+1; end;

if FormPeach.mRecent1.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent1.Caption; i:=i+1; end;
if FormPeach.mRecent2.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent2.Caption; i:=i+1; end;
if FormPeach.mRecent3.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent3.Caption; i:=i+1; end;
if FormPeach.mRecent4.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent4.Caption; i:=i+1; end;
if FormPeach.mRecent5.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent5.Caption; i:=i+1; end;
if FormPeach.mRecent6.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent6.Caption; i:=i+1; end;
if FormPeach.mRecent7.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent7.Caption; i:=i+1; end;
if FormPeach.mRecent8.Caption<>'' then begin FormPeach.StringGridRecent.Cells[0,i]:=' '; FormPeach.StringGridRecent.Cells[1,i]:=FormPeach.mRecent8.Caption; i:=i+1; end;
FormPeach.StringGridRecent.Rowcount:=i;
FormPeach.StringGridRecent.AutosizeColumns;
FormPeach.StringGridRecent.ColWidths[0]:=rowsize;
FormPeach.StringGridRecent.ColWidths[2]:=0;
FormPeach.StringGridRecent.ColWidths[3]:=0;
FormPeach.StringGridRecent.ColWidths[4]:=0;
except
end;
if (FormPeach.mRecent1f.Caption='') and (FormPeach.mRecent1.Caption='') then
   begin
   FormPeach.MenuItem55.visible:=false;
   FormPeach.MenuItem57.visible:=false;
   FormPeach.MenuItem58.visible:=false;
   FormPeach.MenuItem59.visible:=false;
   end
else
   begin
   FormPeach.MenuItem55.visible:=true;
   FormPeach.MenuItem57.visible:=true;
   FormPeach.MenuItem58.visible:=true;
   FormPeach.MenuItem59.visible:=true;
   end ;
end;

procedure setsearchhistorymenu;
begin
with FormPeach do
begin
if pmshist1.Caption<>'' then pmshist1.Visible:=true else pmshist1.Visible:=false;
if pmshist2.Caption<>'' then pmshist2.Visible:=true else pmshist2.Visible:=false;
if pmshist3.Caption<>'' then pmshist3.Visible:=true else pmshist3.Visible:=false;
if pmshist4.Caption<>'' then pmshist4.Visible:=true else pmshist4.Visible:=false;
if pmshist5.Caption<>'' then pmshist5.Visible:=true else pmshist5.Visible:=false;
if pmshist6.Caption<>'' then pmshist6.Visible:=true else pmshist6.Visible:=false;
if pmshist7.Caption<>'' then pmshist7.Visible:=true else pmshist7.Visible:=false;
if pmshist8.Caption<>'' then pmshist8.Visible:=true else pmshist8.Visible:=false;
end;
end;

procedure checkrecent(var srec:Thistarray);
var
  i,j:integer;
  csrec:Thistarray;
begin
for i:=1 to 8 do csrec[i]:='';
j:=1;
for i:=1 to 8 do
   if fileexists(srec[i]) then
      begin
      csrec[j]:=srec[i];
      j:=j+1;
      end;
FormPeach.mRecent1.Caption:=csrec[1];
FormPeach.mRecent2.Caption:=csrec[2];
FormPeach.mRecent3.Caption:=csrec[3];
FormPeach.mRecent4.Caption:=csrec[4];
FormPeach.mRecent5.Caption:=csrec[5];
FormPeach.mRecent6.Caption:=csrec[6];
FormPeach.mRecent7.Caption:=csrec[7];
FormPeach.mRecent8.Caption:=csrec[8];
end;

procedure checkrecentf(var srecf:Thistarray);
var
  i,j:integer;
  csrecf:Thistarray;
begin
for i:=1 to 8 do csrecf[i]:='';
j:=1;
for i:=1 to 8 do
   if checkdirexists(srecf[i]) then
      begin
      csrecf[j]:=srecf[i];
      j:=j+1;
      end;
FormPeach.mRecent1f.Caption:=csrecf[1];
FormPeach.mRecent2f.Caption:=csrecf[2];
FormPeach.mRecent3f.Caption:=csrecf[3];
FormPeach.mRecent4f.Caption:=csrecf[4];
FormPeach.mRecent5f.Caption:=csrecf[5];
FormPeach.mRecent6f.Caption:=csrecf[6];
FormPeach.mRecent7f.Caption:=csrecf[7];
FormPeach.mRecent8f.Caption:=csrecf[8];
end;

procedure setshowvolatile;
begin
if showvolatile=1 then
begin
FormPeach.checkboxseparate.Font.Style:=[fsItalic];
FormPeach.checkboxsamearc.Font.Style:=[fsItalic];
FormPeach.checkboxconvert.Font.Style:=[fsItalic];
FormPeach.CheckBoxConvertPW.Font.Style:=[fsItalic];
FormPeach.CheckBoxConvertVerbose.Font.Style:=[fsItalic];
FormPeach.CheckBoxTarBefore.Font.Style:=[fsItalic];
FormPeach.checkboxsameext.Font.Style:=[fsItalic];
FormPeach.ComboBox7zFun.Font.Style:=[fsItalic];
FormPeach.ComboBox7zPaths.Font.Style:=[fsItalic];
FormPeach.Label7zDictionary.Font.Style:=[fsItalic];
FormPeach.Label7zWord.Font.Style:=[fsItalic];
FormPeach.Label7zPasses.Font.Style:=[fsItalic];
FormPeach.Label7zsolidblock.Font.Style:=[fsItalic];
FormPeach.Label7zFun.Font.Style:=[fsItalic];
FormPeach.Label7zPath.Font.Style:=[fsItalic];
end
else
begin
FormPeach.checkboxseparate.Font.Style:=[];
FormPeach.checkboxsamearc.Font.Style:=[];
FormPeach.checkboxconvert.Font.Style:=[];
FormPeach.CheckBoxConvertPW.Font.Style:=[];
FormPeach.CheckBoxConvertVerbose.Font.Style:=[];
FormPeach.CheckBoxTarBefore.Font.Style:=[];
FormPeach.checkboxsameext.Font.Style:=[];
FormPeach.ComboBox7zFun.Font.Style:=[];
FormPeach.ComboBox7zPaths.Font.Style:=[];
FormPeach.Label7zDictionary.Font.Style:=[];
FormPeach.Label7zWord.Font.Style:=[];
FormPeach.Label7zPasses.Font.Style:=[];
FormPeach.Label7zsolidblock.Font.Style:=[];
FormPeach.Label7zFun.Font.Style:=[];
FormPeach.Label7zPath.Font.Style:=[];
end;
end;

procedure setspecialextensions;
var
  astr: ansistring;
  aastr: array of ansistring;
  i,j:integer;
begin
astr:=FormPeach.editExtEvForWhat.Caption;
aastr:=astr.Split(' ');
j:=0;
SetLength(specextensions,0);
SetLength(specextensions,128);
for i:=0 to length(aastr)-1 do
   if aastr[i]<>'' then
      begin
      specextensions[j]:=aastr[i];
      if specextensions[j,1] <> '.' then specextensions[j]:='.'+specextensions[j];
      j:=j+1;
      if j>=128 then break;
      end;
SetLength(specextensions,j);
end;

procedure setsecurityextensions;
var
  astr: ansistring;
  aastr: array of ansistring;
  i,j:integer;
begin
astr:=FormPeach.editExtEvForSec.Caption;
aastr:=astr.Split(' ');
j:=0;
SetLength(secextensions,0);
SetLength(secextensions,128);
for i:=0 to length(aastr)-1 do
   if aastr[i]<>'' then
      begin
      secextensions[j]:=aastr[i];
      if secextensions[j,1] <> '.' then secextensions[j]:='.'+secextensions[j];
      j:=j+1;
      if j>=128 then break;
      end;
SetLength(secextensions,j);
end;

procedure defaultvirtualopt;
begin
{$IFDEF MSWINDOWS}
allowvirtual:=1; sizevirtual:=8; //8K
FormPeach.ComboBoxvirtual.Items[0]:=txt_default+' (> 8 K '+txt_11_0_items+')';
{$ELSE}
allowvirtual:=1; sizevirtual:=16; //16K for GTK2, GTK3 and other possible widgetsets
FormPeach.ComboBoxvirtual.Items[0]:=txt_default+' (> 16 K '+txt_11_0_items+')';
{$IFDEF LCLQT6}
allowvirtual:=1; sizevirtual:=16; //16K for Qt6
FormPeach.ComboBoxvirtual.Items[0]:=txt_default+' (> 16 K '+txt_11_0_items+')';
{$ENDIF}
{$IFDEF LCLQT5}
allowvirtual:=1; sizevirtual:=16; //16K for Qt5 (legacy)
FormPeach.ComboBoxvirtual.Items[0]:=txt_default+' (> 16 K '+txt_11_0_items+')';
{$ENDIF}
{$IFDEF DARWIN}
allowvirtual:=1; sizevirtual:=4; //4K for macOS
FormPeach.ComboBoxvirtual.Items[0]:=txt_default+' (> 4 K '+txt_11_0_items+')';
{$ELSE}
{$ENDIF}
{$ENDIF}
end;

procedure populaterecenticons;
begin
with FormPeach do
begin
if mRecent1.visible=true then mRecent1.Bitmap:=drawrecenticon(mRecent1.Caption);
if mRecent2.visible=true then mRecent2.Bitmap:=drawrecenticon(mRecent2.Caption);
if mRecent3.visible=true then mRecent3.Bitmap:=drawrecenticon(mRecent3.Caption);
if mRecent4.visible=true then mRecent4.Bitmap:=drawrecenticon(mRecent4.Caption);
if mRecent5.visible=true then mRecent5.Bitmap:=drawrecenticon(mRecent5.Caption);
if mRecent6.visible=true then mRecent6.Bitmap:=drawrecenticon(mRecent6.Caption);
if mRecent7.visible=true then mRecent7.Bitmap:=drawrecenticon(mRecent7.Caption);
if mRecent8.visible=true then mRecent8.Bitmap:=drawrecenticon(mRecent8.Caption);
if pmhr1.visible=true then pmhr1.Bitmap:=mRecent1.Bitmap;
if pmhr2.visible=true then pmhr2.Bitmap:=mRecent2.Bitmap;
if pmhr3.visible=true then pmhr3.Bitmap:=mRecent3.Bitmap;
if pmhr4.visible=true then pmhr4.Bitmap:=mRecent4.Bitmap;
if pmhr5.visible=true then pmhr5.Bitmap:=mRecent5.Bitmap;
if pmhr6.visible=true then pmhr6.Bitmap:=mRecent6.Bitmap;
if pmhr7.visible=true then pmhr7.Bitmap:=mRecent7.Bitmap;
if pmhr8.visible=true then pmhr8.Bitmap:=mRecent8.Bitmap;
if pmhr1.visible=true then pmamr1.Bitmap:=mRecent1.Bitmap;
if pmhr2.visible=true then pmamr2.Bitmap:=mRecent2.Bitmap;
if pmhr3.visible=true then pmamr3.Bitmap:=mRecent3.Bitmap;
if pmhr4.visible=true then pmamr4.Bitmap:=mRecent4.Bitmap;
if pmhr5.visible=true then pmamr5.Bitmap:=mRecent5.Bitmap;
if pmhr6.visible=true then pmamr6.Bitmap:=mRecent6.Bitmap;
if pmhr7.visible=true then pmamr7.Bitmap:=mRecent7.Bitmap;
if pmhr8.visible=true then pmamr8.Bitmap:=mRecent8.Bitmap;
end;
end;

procedure populaterecenticonsf;
begin
with FormPeach do
begin
if mRecent1f.visible=true then mRecent1f.Bitmap:=drawmenuicon(mRecent1f.Caption);
if mRecent2f.visible=true then mRecent2f.Bitmap:=drawmenuicon(mRecent2f.Caption);
if mRecent3f.visible=true then mRecent3f.Bitmap:=drawmenuicon(mRecent3f.Caption);
if mRecent4f.visible=true then mRecent4f.Bitmap:=drawmenuicon(mRecent4f.Caption);
if mRecent5f.visible=true then mRecent5f.Bitmap:=drawmenuicon(mRecent5f.Caption);
if mRecent6f.visible=true then mRecent6f.Bitmap:=drawmenuicon(mRecent6f.Caption);
if mRecent7f.visible=true then mRecent7f.Bitmap:=drawmenuicon(mRecent7f.Caption);
if mRecent8f.visible=true then mRecent8f.Bitmap:=drawmenuicon(mRecent8f.Caption);
if pmhr1f.visible=true then pmhr1f.Bitmap:=mRecent1f.Bitmap;
if pmhr2f.visible=true then pmhr2f.Bitmap:=mRecent2f.Bitmap;
if pmhr3f.visible=true then pmhr3f.Bitmap:=mRecent3f.Bitmap;
if pmhr4f.visible=true then pmhr4f.Bitmap:=mRecent4f.Bitmap;
if pmhr5f.visible=true then pmhr5f.Bitmap:=mRecent5f.Bitmap;
if pmhr6f.visible=true then pmhr6f.Bitmap:=mRecent6f.Bitmap;
if pmhr7f.visible=true then pmhr7f.Bitmap:=mRecent7f.Bitmap;
if pmhr8f.visible=true then pmhr8f.Bitmap:=mRecent8f.Bitmap;
if mexttoh1.visible=true then mexttoh1.Bitmap:=mRecent1f.Bitmap;
if mexttoh2.visible=true then mexttoh2.Bitmap:=mRecent2f.Bitmap;
if mexttoh3.visible=true then mexttoh3.Bitmap:=mRecent3f.Bitmap;
if mexttoh4.visible=true then mexttoh4.Bitmap:=mRecent4f.Bitmap;
if mexttoh5.visible=true then mexttoh5.Bitmap:=mRecent5f.Bitmap;
if mexttoh6.visible=true then mexttoh6.Bitmap:=mRecent6f.Bitmap;
if mexttoh7.visible=true then mexttoh7.Bitmap:=mRecent7f.Bitmap;
if mexttoh8.visible=true then mexttoh8.Bitmap:=mRecent8f.Bitmap;
end;
end;

procedure setrecenticons_extract_archive;
begin
FormPeach.pnr1.Caption:=FormPeach.mRecent1f.Caption;
FormPeach.pnr2.Caption:=FormPeach.mRecent2f.Caption;
FormPeach.pnr3.Caption:=FormPeach.mRecent3f.Caption;
FormPeach.pnr4.Caption:=FormPeach.mRecent4f.Caption;
FormPeach.pnr5.Caption:=FormPeach.mRecent5f.Caption;
FormPeach.pnr6.Caption:=FormPeach.mRecent6f.Caption;
FormPeach.pnr7.Caption:=FormPeach.mRecent7f.Caption;
FormPeach.pnr8.Caption:=FormPeach.mRecent8f.Caption;
FormPeach.pmemr1.Caption:=FormPeach.mRecent1f.Caption;
FormPeach.pmemr2.Caption:=FormPeach.mRecent2f.Caption;
FormPeach.pmemr3.Caption:=FormPeach.mRecent3f.Caption;
FormPeach.pmemr4.Caption:=FormPeach.mRecent4f.Caption;
FormPeach.pmemr5.Caption:=FormPeach.mRecent5f.Caption;
FormPeach.pmemr6.Caption:=FormPeach.mRecent6f.Caption;
FormPeach.pmemr7.Caption:=FormPeach.mRecent7f.Caption;
FormPeach.pmemr8.Caption:=FormPeach.mRecent8f.Caption;
FormPeach.mexttoh1.Caption:=FormPeach.mRecent1f.Caption;
FormPeach.mexttoh2.Caption:=FormPeach.mRecent2f.Caption;
FormPeach.mexttoh3.Caption:=FormPeach.mRecent3f.Caption;
FormPeach.mexttoh4.Caption:=FormPeach.mRecent4f.Caption;
FormPeach.mexttoh5.Caption:=FormPeach.mRecent5f.Caption;
FormPeach.mexttoh6.Caption:=FormPeach.mRecent6f.Caption;
FormPeach.mexttoh7.Caption:=FormPeach.mRecent7f.Caption;
FormPeach.mexttoh8.Caption:=FormPeach.mRecent8f.Caption;
FormPeach.pnra1.Caption:=FormPeach.mRecent1f.Caption;
FormPeach.pnra2.Caption:=FormPeach.mRecent2f.Caption;
FormPeach.pnra3.Caption:=FormPeach.mRecent3f.Caption;
FormPeach.pnra4.Caption:=FormPeach.mRecent4f.Caption;
FormPeach.pnra5.Caption:=FormPeach.mRecent5f.Caption;
FormPeach.pnra6.Caption:=FormPeach.mRecent6f.Caption;
FormPeach.pnra7.Caption:=FormPeach.mRecent7f.Caption;
FormPeach.pnra8.Caption:=FormPeach.mRecent8f.Caption;
FormPeach.pnr1.Visible:=FormPeach.mRecent1f.Visible;
FormPeach.pnr2.Visible:=FormPeach.mRecent2f.Visible;
FormPeach.pnr3.Visible:=FormPeach.mRecent3f.Visible;
FormPeach.pnr4.Visible:=FormPeach.mRecent4f.Visible;
FormPeach.pnr5.Visible:=FormPeach.mRecent5f.Visible;
FormPeach.pnr6.Visible:=FormPeach.mRecent6f.Visible;
FormPeach.pnr7.Visible:=FormPeach.mRecent7f.Visible;
FormPeach.pnr8.Visible:=FormPeach.mRecent8f.Visible;
FormPeach.pmemr1.Visible:=FormPeach.mRecent1f.Visible;
FormPeach.pmemr2.Visible:=FormPeach.mRecent2f.Visible;
FormPeach.pmemr3.Visible:=FormPeach.mRecent3f.Visible;
FormPeach.pmemr4.Visible:=FormPeach.mRecent4f.Visible;
FormPeach.pmemr5.Visible:=FormPeach.mRecent5f.Visible;
FormPeach.pmemr6.Visible:=FormPeach.mRecent6f.Visible;
FormPeach.pmemr7.Visible:=FormPeach.mRecent7f.Visible;
FormPeach.pmemr8.Visible:=FormPeach.mRecent8f.Visible;
FormPeach.mexttoh1.Visible:=FormPeach.mRecent1f.Visible;
FormPeach.mexttoh2.Visible:=FormPeach.mRecent2f.Visible;
FormPeach.mexttoh3.Visible:=FormPeach.mRecent3f.Visible;
FormPeach.mexttoh4.Visible:=FormPeach.mRecent4f.Visible;
FormPeach.mexttoh5.Visible:=FormPeach.mRecent5f.Visible;
FormPeach.mexttoh6.Visible:=FormPeach.mRecent6f.Visible;
FormPeach.mexttoh7.Visible:=FormPeach.mRecent7f.Visible;
FormPeach.mexttoh8.Visible:=FormPeach.mRecent8f.Visible;
FormPeach.pnra1.Visible:=FormPeach.mRecent1f.Visible;
FormPeach.pnra2.Visible:=FormPeach.mRecent2f.Visible;
FormPeach.pnra3.Visible:=FormPeach.mRecent3f.Visible;
FormPeach.pnra4.Visible:=FormPeach.mRecent4f.Visible;
FormPeach.pnra5.Visible:=FormPeach.mRecent5f.Visible;
FormPeach.pnra6.Visible:=FormPeach.mRecent6f.Visible;
FormPeach.pnra7.Visible:=FormPeach.mRecent7f.Visible;
FormPeach.pnra8.Visible:=FormPeach.mRecent8f.Visible;
if FormPeach.pnr1.visible=true then FormPeach.pnr1.Bitmap:=FormPeach.mRecent1f.Bitmap;
if FormPeach.pnr2.visible=true then FormPeach.pnr2.Bitmap:=FormPeach.mRecent2f.Bitmap;
if FormPeach.pnr3.visible=true then FormPeach.pnr3.Bitmap:=FormPeach.mRecent3f.Bitmap;
if FormPeach.pnr4.visible=true then FormPeach.pnr4.Bitmap:=FormPeach.mRecent4f.Bitmap;
if FormPeach.pnr5.visible=true then FormPeach.pnr5.Bitmap:=FormPeach.mRecent5f.Bitmap;
if FormPeach.pnr6.visible=true then FormPeach.pnr6.Bitmap:=FormPeach.mRecent6f.Bitmap;
if FormPeach.pnr7.visible=true then FormPeach.pnr7.Bitmap:=FormPeach.mRecent7f.Bitmap;
if FormPeach.pnr8.visible=true then FormPeach.pnr8.Bitmap:=FormPeach.mRecent8f.Bitmap;
if FormPeach.pmemr1.visible=true then FormPeach.pmemr1.Bitmap:=FormPeach.mRecent1f.Bitmap;
if FormPeach.pmemr2.visible=true then FormPeach.pmemr2.Bitmap:=FormPeach.mRecent2f.Bitmap;
if FormPeach.pmemr3.visible=true then FormPeach.pmemr3.Bitmap:=FormPeach.mRecent3f.Bitmap;
if FormPeach.pmemr4.visible=true then FormPeach.pmemr4.Bitmap:=FormPeach.mRecent4f.Bitmap;
if FormPeach.pmemr5.visible=true then FormPeach.pmemr5.Bitmap:=FormPeach.mRecent5f.Bitmap;
if FormPeach.pmemr6.visible=true then FormPeach.pmemr6.Bitmap:=FormPeach.mRecent6f.Bitmap;
if FormPeach.pmemr7.visible=true then FormPeach.pmemr7.Bitmap:=FormPeach.mRecent7f.Bitmap;
if FormPeach.pmemr8.visible=true then FormPeach.pmemr8.Bitmap:=FormPeach.mRecent8f.Bitmap;
if FormPeach.mexttoh1.visible=true then FormPeach.mexttoh1.Bitmap:=FormPeach.mRecent1f.Bitmap;
if FormPeach.mexttoh2.visible=true then FormPeach.mexttoh2.Bitmap:=FormPeach.mRecent2f.Bitmap;
if FormPeach.mexttoh3.visible=true then FormPeach.mexttoh3.Bitmap:=FormPeach.mRecent3f.Bitmap;
if FormPeach.mexttoh4.visible=true then FormPeach.mexttoh4.Bitmap:=FormPeach.mRecent4f.Bitmap;
if FormPeach.mexttoh5.visible=true then FormPeach.mexttoh5.Bitmap:=FormPeach.mRecent5f.Bitmap;
if FormPeach.mexttoh6.visible=true then FormPeach.mexttoh6.Bitmap:=FormPeach.mRecent6f.Bitmap;
if FormPeach.mexttoh7.visible=true then FormPeach.mexttoh7.Bitmap:=FormPeach.mRecent7f.Bitmap;
if FormPeach.mexttoh8.visible=true then FormPeach.mexttoh8.Bitmap:=FormPeach.mRecent8f.Bitmap;
if FormPeach.pnra1.visible=true then FormPeach.pnra1.Bitmap:=FormPeach.mRecent1f.Bitmap;
if FormPeach.pnra2.visible=true then FormPeach.pnra2.Bitmap:=FormPeach.mRecent2f.Bitmap;
if FormPeach.pnra3.visible=true then FormPeach.pnra3.Bitmap:=FormPeach.mRecent3f.Bitmap;
if FormPeach.pnra4.visible=true then FormPeach.pnra4.Bitmap:=FormPeach.mRecent4f.Bitmap;
if FormPeach.pnra5.visible=true then FormPeach.pnra5.Bitmap:=FormPeach.mRecent5f.Bitmap;
if FormPeach.pnra6.visible=true then FormPeach.pnra6.Bitmap:=FormPeach.mRecent6f.Bitmap;
if FormPeach.pnra7.visible=true then FormPeach.pnra7.Bitmap:=FormPeach.mRecent7f.Bitmap;
if FormPeach.pnra8.visible=true then FormPeach.pnra8.Bitmap:=FormPeach.mRecent8f.Bitmap;
FormPeach.pmemrf1.Caption:=FormPeach.mRecent1f.Caption;
FormPeach.pmemrf2.Caption:=FormPeach.mRecent2f.Caption;
FormPeach.pmemrf3.Caption:=FormPeach.mRecent3f.Caption;
FormPeach.pmemrf4.Caption:=FormPeach.mRecent4f.Caption;
FormPeach.pmemrf5.Caption:=FormPeach.mRecent5f.Caption;
FormPeach.pmemrf6.Caption:=FormPeach.mRecent6f.Caption;
FormPeach.pmemrf7.Caption:=FormPeach.mRecent7f.Caption;
FormPeach.pmemrf8.Caption:=FormPeach.mRecent8f.Caption;
FormPeach.pmemrf1.Visible:=FormPeach.mRecent1f.Visible;
FormPeach.pmemrf2.Visible:=FormPeach.mRecent2f.Visible;
FormPeach.pmemrf3.Visible:=FormPeach.mRecent3f.Visible;
FormPeach.pmemrf4.Visible:=FormPeach.mRecent4f.Visible;
FormPeach.pmemrf5.Visible:=FormPeach.mRecent5f.Visible;
FormPeach.pmemrf6.Visible:=FormPeach.mRecent6f.Visible;
FormPeach.pmemrf7.Visible:=FormPeach.mRecent7f.Visible;
FormPeach.pmemrf8.Visible:=FormPeach.mRecent8f.Visible;
if FormPeach.pmemrf1.visible=true then FormPeach.pmemrf1.Bitmap:=FormPeach.mRecent1f.Bitmap;
if FormPeach.pmemrf2.visible=true then FormPeach.pmemrf2.Bitmap:=FormPeach.mRecent2f.Bitmap;
if FormPeach.pmemrf3.visible=true then FormPeach.pmemrf3.Bitmap:=FormPeach.mRecent3f.Bitmap;
if FormPeach.pmemrf4.visible=true then FormPeach.pmemrf4.Bitmap:=FormPeach.mRecent4f.Bitmap;
if FormPeach.pmemrf5.visible=true then FormPeach.pmemrf5.Bitmap:=FormPeach.mRecent5f.Bitmap;
if FormPeach.pmemrf6.visible=true then FormPeach.pmemrf6.Bitmap:=FormPeach.mRecent6f.Bitmap;
if FormPeach.pmemrf7.visible=true then FormPeach.pmemrf7.Bitmap:=FormPeach.mRecent7f.Bitmap;
if FormPeach.pmemrf8.visible=true then FormPeach.pmemrf8.Bitmap:=FormPeach.mRecent8f.Bitmap;
end;

procedure addtofolderhistory(s:ansistring);
begin
if savehistory=0 then exit;
if s<>FormPeach.mRecent1f.Caption then
   if s<>FormPeach.mRecent2f.Caption then
      if s<>FormPeach.mRecent3f.Caption then
         if s<>FormPeach.mRecent4f.Caption then
            if s<>FormPeach.mRecent5f.Caption then
               if s<>FormPeach.mRecent6f.Caption then
                  if s<>FormPeach.mRecent7f.Caption then
                     begin
                     FormPeach.mRecent8f.Caption:=FormPeach.mRecent7f.Caption;
                     FormPeach.mRecent7f.Caption:=FormPeach.mRecent6f.Caption;
                     FormPeach.mRecent6f.Caption:=FormPeach.mRecent5f.Caption;
                     FormPeach.mRecent5f.Caption:=FormPeach.mRecent4f.Caption;
                     FormPeach.mRecent4f.Caption:=FormPeach.mRecent3f.Caption;
                     FormPeach.mRecent3f.Caption:=FormPeach.mRecent2f.Caption;
                     FormPeach.mRecent2f.Caption:=FormPeach.mRecent1f.Caption;
                     FormPeach.mRecent1f.Caption:=s;
                     end
                  else
                     begin
                     FormPeach.mRecent7f.Caption:=FormPeach.mRecent6f.Caption;
                     FormPeach.mRecent6f.Caption:=FormPeach.mRecent5f.Caption;
                     FormPeach.mRecent5f.Caption:=FormPeach.mRecent4f.Caption;
                     FormPeach.mRecent4f.Caption:=FormPeach.mRecent3f.Caption;
                     FormPeach.mRecent3f.Caption:=FormPeach.mRecent2f.Caption;
                     FormPeach.mRecent2f.Caption:=FormPeach.mRecent1f.Caption;
                     FormPeach.mRecent1f.Caption:=s;
                     end
               else
                  begin
                  FormPeach.mRecent6f.Caption:=FormPeach.mRecent5f.Caption;
                  FormPeach.mRecent5f.Caption:=FormPeach.mRecent4f.Caption;
                  FormPeach.mRecent4f.Caption:=FormPeach.mRecent3f.Caption;
                  FormPeach.mRecent3f.Caption:=FormPeach.mRecent2f.Caption;
                  FormPeach.mRecent2f.Caption:=FormPeach.mRecent1f.Caption;
                  FormPeach.mRecent1f.Caption:=s;
                  end
            else
               begin
               FormPeach.mRecent5f.Caption:=FormPeach.mRecent4f.Caption;
               FormPeach.mRecent4f.Caption:=FormPeach.mRecent3f.Caption;
               FormPeach.mRecent3f.Caption:=FormPeach.mRecent2f.Caption;
               FormPeach.mRecent2f.Caption:=FormPeach.mRecent1f.Caption;
               FormPeach.mRecent1f.Caption:=s;
               end
         else
            begin
            FormPeach.mRecent4f.Caption:=FormPeach.mRecent3f.Caption;
            FormPeach.mRecent3f.Caption:=FormPeach.mRecent2f.Caption;
            FormPeach.mRecent2f.Caption:=FormPeach.mRecent1f.Caption;
            FormPeach.mRecent1f.Caption:=s;
            end
      else
         begin
         FormPeach.mRecent3f.Caption:=FormPeach.mRecent2f.Caption;
         FormPeach.mRecent2f.Caption:=FormPeach.mRecent1f.Caption;
         FormPeach.mRecent1f.Caption:=s;
         end
   else
      begin
      FormPeach.mRecent2f.Caption:=FormPeach.mRecent1f.Caption;
      FormPeach.mRecent1f.Caption:=s;
      end;
if FormPeach.mRecent1f.Caption<>'' then FormPeach.mRecent1f.Visible:=true else FormPeach.mRecent1f.Visible:=false;
if FormPeach.mRecent2f.Caption<>'' then FormPeach.mRecent2f.Visible:=true else FormPeach.mRecent2f.Visible:=false;
if FormPeach.mRecent3f.Caption<>'' then FormPeach.mRecent3f.Visible:=true else FormPeach.mRecent3f.Visible:=false;
if FormPeach.mRecent4f.Caption<>'' then FormPeach.mRecent4f.Visible:=true else FormPeach.mRecent4f.Visible:=false;
if FormPeach.mRecent5f.Caption<>'' then FormPeach.mRecent5f.Visible:=true else FormPeach.mRecent5f.Visible:=false;
if FormPeach.mRecent6f.Caption<>'' then FormPeach.mRecent6f.Visible:=true else FormPeach.mRecent6f.Visible:=false;
if FormPeach.mRecent7f.Caption<>'' then FormPeach.mRecent7f.Visible:=true else FormPeach.mRecent7f.Visible:=false;
if FormPeach.mRecent8f.Caption<>'' then FormPeach.mRecent8f.Visible:=true else FormPeach.mRecent8f.Visible:=false;
FormPeach.pmhr1f.Caption:=FormPeach.mRecent1f.Caption;
FormPeach.pmhr2f.Caption:=FormPeach.mRecent2f.Caption;
FormPeach.pmhr3f.Caption:=FormPeach.mRecent3f.Caption;
FormPeach.pmhr4f.Caption:=FormPeach.mRecent4f.Caption;
FormPeach.pmhr5f.Caption:=FormPeach.mRecent5f.Caption;
FormPeach.pmhr6f.Caption:=FormPeach.mRecent6f.Caption;
FormPeach.pmhr7f.Caption:=FormPeach.mRecent7f.Caption;
FormPeach.pmhr8f.Caption:=FormPeach.mRecent8f.Caption;
FormPeach.pmhr1f.Visible:=FormPeach.mRecent1f.Visible;
FormPeach.pmhr2f.Visible:=FormPeach.mRecent2f.Visible;
FormPeach.pmhr3f.Visible:=FormPeach.mRecent3f.Visible;
FormPeach.pmhr4f.Visible:=FormPeach.mRecent4f.Visible;
FormPeach.pmhr5f.Visible:=FormPeach.mRecent5f.Visible;
FormPeach.pmhr6f.Visible:=FormPeach.mRecent6f.Visible;
FormPeach.pmhr7f.Visible:=FormPeach.mRecent7f.Visible;
FormPeach.pmhr8f.Visible:=FormPeach.mRecent8f.Visible;
setrecenticons_extract_archive;
populaterecenticonsf;
populaterecentpanel;
populatetree;
end;

procedure addtoarchivehistory(s:ansistring);
begin
if savehistory=0 then exit;
if s<>FormPeach.mRecent1.Caption then
   if s<>FormPeach.mRecent2.Caption then
      if s<>FormPeach.mRecent3.Caption then
         if s<>FormPeach.mRecent4.Caption then
            if s<>FormPeach.mRecent5.Caption then
               if s<>FormPeach.mRecent6.Caption then
                  if s<>FormPeach.mRecent7.Caption then
                     begin
                     FormPeach.mRecent8.Caption:=FormPeach.mRecent7.Caption;
                     FormPeach.mRecent7.Caption:=FormPeach.mRecent6.Caption;
                     FormPeach.mRecent6.Caption:=FormPeach.mRecent5.Caption;
                     FormPeach.mRecent5.Caption:=FormPeach.mRecent4.Caption;
                     FormPeach.mRecent4.Caption:=FormPeach.mRecent3.Caption;
                     FormPeach.mRecent3.Caption:=FormPeach.mRecent2.Caption;
                     FormPeach.mRecent2.Caption:=FormPeach.mRecent1.Caption;
                     FormPeach.mRecent1.Caption:=s;
                     end
                  else
                     begin
                     FormPeach.mRecent7.Caption:=FormPeach.mRecent6.Caption;
                     FormPeach.mRecent6.Caption:=FormPeach.mRecent5.Caption;
                     FormPeach.mRecent5.Caption:=FormPeach.mRecent4.Caption;
                     FormPeach.mRecent4.Caption:=FormPeach.mRecent3.Caption;
                     FormPeach.mRecent3.Caption:=FormPeach.mRecent2.Caption;
                     FormPeach.mRecent2.Caption:=FormPeach.mRecent1.Caption;
                     FormPeach.mRecent1.Caption:=s;
                     end
               else
                  begin
                  FormPeach.mRecent6.Caption:=FormPeach.mRecent5.Caption;
                  FormPeach.mRecent5.Caption:=FormPeach.mRecent4.Caption;
                  FormPeach.mRecent4.Caption:=FormPeach.mRecent3.Caption;
                  FormPeach.mRecent3.Caption:=FormPeach.mRecent2.Caption;
                  FormPeach.mRecent2.Caption:=FormPeach.mRecent1.Caption;
                  FormPeach.mRecent1.Caption:=s;
                  end
            else
               begin
               FormPeach.mRecent5.Caption:=FormPeach.mRecent4.Caption;
               FormPeach.mRecent4.Caption:=FormPeach.mRecent3.Caption;
               FormPeach.mRecent3.Caption:=FormPeach.mRecent2.Caption;
               FormPeach.mRecent2.Caption:=FormPeach.mRecent1.Caption;
               FormPeach.mRecent1.Caption:=s;
               end
         else
            begin
            FormPeach.mRecent4.Caption:=FormPeach.mRecent3.Caption;
            FormPeach.mRecent3.Caption:=FormPeach.mRecent2.Caption;
            FormPeach.mRecent2.Caption:=FormPeach.mRecent1.Caption;
            FormPeach.mRecent1.Caption:=s;
            end
      else
         begin
         FormPeach.mRecent3.Caption:=FormPeach.mRecent2.Caption;
         FormPeach.mRecent2.Caption:=FormPeach.mRecent1.Caption;
         FormPeach.mRecent1.Caption:=s;
         end
   else
      begin
      FormPeach.mRecent2.Caption:=FormPeach.mRecent1.Caption;
      FormPeach.mRecent1.Caption:=s;
      end;
if FormPeach.mRecent1.Caption<>'' then FormPeach.mRecent1.Visible:=true else FormPeach.mRecent1.Visible:=false;
if FormPeach.mRecent2.Caption<>'' then FormPeach.mRecent2.Visible:=true else FormPeach.mRecent2.Visible:=false;
if FormPeach.mRecent3.Caption<>'' then FormPeach.mRecent3.Visible:=true else FormPeach.mRecent3.Visible:=false;
if FormPeach.mRecent4.Caption<>'' then FormPeach.mRecent4.Visible:=true else FormPeach.mRecent4.Visible:=false;
if FormPeach.mRecent5.Caption<>'' then FormPeach.mRecent5.Visible:=true else FormPeach.mRecent5.Visible:=false;
if FormPeach.mRecent6.Caption<>'' then FormPeach.mRecent6.Visible:=true else FormPeach.mRecent6.Visible:=false;
if FormPeach.mRecent7.Caption<>'' then FormPeach.mRecent7.Visible:=true else FormPeach.mRecent7.Visible:=false;
if FormPeach.mRecent8.Caption<>'' then FormPeach.mRecent8.Visible:=true else FormPeach.mRecent8.Visible:=false;
FormPeach.pmhr1.Caption:=FormPeach.mRecent1.Caption;
FormPeach.pmhr2.Caption:=FormPeach.mRecent2.Caption;
FormPeach.pmhr3.Caption:=FormPeach.mRecent3.Caption;
FormPeach.pmhr4.Caption:=FormPeach.mRecent4.Caption;
FormPeach.pmhr5.Caption:=FormPeach.mRecent5.Caption;
FormPeach.pmhr6.Caption:=FormPeach.mRecent6.Caption;
FormPeach.pmhr7.Caption:=FormPeach.mRecent7.Caption;
FormPeach.pmhr8.Caption:=FormPeach.mRecent8.Caption;
FormPeach.pmhr1.Visible:=FormPeach.mRecent1.Visible;
FormPeach.pmhr2.Visible:=FormPeach.mRecent2.Visible;
FormPeach.pmhr3.Visible:=FormPeach.mRecent3.Visible;
FormPeach.pmhr4.Visible:=FormPeach.mRecent4.Visible;
FormPeach.pmhr5.Visible:=FormPeach.mRecent5.Visible;
FormPeach.pmhr6.Visible:=FormPeach.mRecent6.Visible;
FormPeach.pmhr7.Visible:=FormPeach.mRecent7.Visible;
FormPeach.pmhr8.Visible:=FormPeach.mRecent8.Visible;
FormPeach.pmamr1.Caption:=(FormPeach.mRecent1.Caption);
FormPeach.pmamr2.Caption:=(FormPeach.mRecent2.Caption);
FormPeach.pmamr3.Caption:=(FormPeach.mRecent3.Caption);
FormPeach.pmamr4.Caption:=(FormPeach.mRecent4.Caption);
FormPeach.pmamr5.Caption:=(FormPeach.mRecent5.Caption);
FormPeach.pmamr6.Caption:=(FormPeach.mRecent6.Caption);
FormPeach.pmamr7.Caption:=(FormPeach.mRecent7.Caption);
FormPeach.pmamr8.Caption:=(FormPeach.mRecent8.Caption);
FormPeach.pmamr1.Visible:=FormPeach.mRecent1.Visible;
FormPeach.pmamr2.Visible:=FormPeach.mRecent2.Visible;
FormPeach.pmamr3.Visible:=FormPeach.mRecent3.Visible;
FormPeach.pmamr4.Visible:=FormPeach.mRecent4.Visible;
FormPeach.pmamr5.Visible:=FormPeach.mRecent5.Visible;
FormPeach.pmamr6.Visible:=FormPeach.mRecent6.Visible;
FormPeach.pmamr7.Visible:=FormPeach.mRecent7.Visible;
FormPeach.pmamr8.Visible:=FormPeach.mRecent8.Visible;
addtofolderhistory(extractfilepath(s));
populaterecenticons;
populaterecentpanel;
populatetree;
end;

procedure addtocustomhistory(s:ansistring);
begin
if s<>FormPeach.pcustom1.Caption then
   if s<>FormPeach.pcustom2.Caption then
      if s<>FormPeach.pcustom3.Caption then
         if s<>FormPeach.pcustom4.Caption then
            if s<>FormPeach.pcustom5.Caption then
               if s<>FormPeach.pcustom6.Caption then
                  if s<>FormPeach.pcustom7.Caption then
                     begin
                     FormPeach.pcustom8.Caption:=FormPeach.pcustom7.Caption;
                     FormPeach.pcustom7.Caption:=FormPeach.pcustom6.Caption;
                     FormPeach.pcustom6.Caption:=FormPeach.pcustom5.Caption;
                     FormPeach.pcustom5.Caption:=FormPeach.pcustom4.Caption;
                     FormPeach.pcustom4.Caption:=FormPeach.pcustom3.Caption;
                     FormPeach.pcustom3.Caption:=FormPeach.pcustom2.Caption;
                     FormPeach.pcustom2.Caption:=FormPeach.pcustom1.Caption;
                     FormPeach.pcustom1.Caption:=s;
                     end
                  else
                     begin
                     FormPeach.pcustom7.Caption:=FormPeach.pcustom6.Caption;
                     FormPeach.pcustom6.Caption:=FormPeach.pcustom5.Caption;
                     FormPeach.pcustom5.Caption:=FormPeach.pcustom4.Caption;
                     FormPeach.pcustom4.Caption:=FormPeach.pcustom3.Caption;
                     FormPeach.pcustom3.Caption:=FormPeach.pcustom2.Caption;
                     FormPeach.pcustom2.Caption:=FormPeach.pcustom1.Caption;
                     FormPeach.pcustom1.Caption:=s;
                     end
               else
                  begin
                  FormPeach.pcustom6.Caption:=FormPeach.pcustom5.Caption;
                  FormPeach.pcustom5.Caption:=FormPeach.pcustom4.Caption;
                  FormPeach.pcustom4.Caption:=FormPeach.pcustom3.Caption;
                  FormPeach.pcustom3.Caption:=FormPeach.pcustom2.Caption;
                  FormPeach.pcustom2.Caption:=FormPeach.pcustom1.Caption;
                  FormPeach.pcustom1.Caption:=s;
                  end
            else
               begin
               FormPeach.pcustom5.Caption:=FormPeach.pcustom4.Caption;
               FormPeach.pcustom4.Caption:=FormPeach.pcustom3.Caption;
               FormPeach.pcustom3.Caption:=FormPeach.pcustom2.Caption;
               FormPeach.pcustom2.Caption:=FormPeach.pcustom1.Caption;
               FormPeach.pcustom1.Caption:=s;
               end
         else
            begin
            FormPeach.pcustom4.Caption:=FormPeach.pcustom3.Caption;
            FormPeach.pcustom3.Caption:=FormPeach.pcustom2.Caption;
            FormPeach.pcustom2.Caption:=FormPeach.pcustom1.Caption;
            FormPeach.pcustom1.Caption:=s;
            end
      else
         begin
         FormPeach.pcustom3.Caption:=FormPeach.pcustom2.Caption;
         FormPeach.pcustom2.Caption:=FormPeach.pcustom1.Caption;
         FormPeach.pcustom1.Caption:=s;
         end
   else
      begin
      FormPeach.pcustom2.Caption:=FormPeach.pcustom1.Caption;
      FormPeach.pcustom1.Caption:=s;
      end;
if FormPeach.pcustom1.Caption<>'' then FormPeach.pcustom1.Visible:=true else FormPeach.pcustom1.Visible:=false;
if FormPeach.pcustom2.Caption<>'' then FormPeach.pcustom2.Visible:=true else FormPeach.pcustom2.Visible:=false;
if FormPeach.pcustom3.Caption<>'' then FormPeach.pcustom3.Visible:=true else FormPeach.pcustom3.Visible:=false;
if FormPeach.pcustom4.Caption<>'' then FormPeach.pcustom4.Visible:=true else FormPeach.pcustom4.Visible:=false;
if FormPeach.pcustom5.Caption<>'' then FormPeach.pcustom5.Visible:=true else FormPeach.pcustom5.Visible:=false;
if FormPeach.pcustom6.Caption<>'' then FormPeach.pcustom6.Visible:=true else FormPeach.pcustom6.Visible:=false;
if FormPeach.pcustom7.Caption<>'' then FormPeach.pcustom7.Visible:=true else FormPeach.pcustom7.Visible:=false;
if FormPeach.pcustom8.Caption<>'' then FormPeach.pcustom8.Visible:=true else FormPeach.pcustom8.Visible:=false;
end;

procedure sethistory;
begin
   if FormPeach.mRecent1.Caption<>'' then FormPeach.mRecent1.Visible:=true else FormPeach.mRecent1.Visible:=false;
   if FormPeach.mRecent2.Caption<>'' then FormPeach.mRecent2.Visible:=true else FormPeach.mRecent2.Visible:=false;
   if FormPeach.mRecent3.Caption<>'' then FormPeach.mRecent3.Visible:=true else FormPeach.mRecent3.Visible:=false;
   if FormPeach.mRecent4.Caption<>'' then FormPeach.mRecent4.Visible:=true else FormPeach.mRecent4.Visible:=false;
   if FormPeach.mRecent5.Caption<>'' then FormPeach.mRecent5.Visible:=true else FormPeach.mRecent5.Visible:=false;
   if FormPeach.mRecent6.Caption<>'' then FormPeach.mRecent6.Visible:=true else FormPeach.mRecent6.Visible:=false;
   if FormPeach.mRecent7.Caption<>'' then FormPeach.mRecent7.Visible:=true else FormPeach.mRecent7.Visible:=false;
   if FormPeach.mRecent8.Caption<>'' then FormPeach.mRecent8.Visible:=true else FormPeach.mRecent8.Visible:=false;
   FormPeach.pmhr1.Visible:=FormPeach.mRecent1.Visible;
   FormPeach.pmhr2.Visible:=FormPeach.mRecent2.Visible;
   FormPeach.pmhr3.Visible:=FormPeach.mRecent3.Visible;
   FormPeach.pmhr4.Visible:=FormPeach.mRecent4.Visible;
   FormPeach.pmhr5.Visible:=FormPeach.mRecent5.Visible;
   FormPeach.pmhr6.Visible:=FormPeach.mRecent6.Visible;
   FormPeach.pmhr7.Visible:=FormPeach.mRecent7.Visible;
   FormPeach.pmhr8.Visible:=FormPeach.mRecent8.Visible;
   FormPeach.pmamr1.Caption:=(FormPeach.mRecent1.Caption);
   FormPeach.pmamr2.Caption:=(FormPeach.mRecent2.Caption);
   FormPeach.pmamr3.Caption:=(FormPeach.mRecent3.Caption);
   FormPeach.pmamr4.Caption:=(FormPeach.mRecent4.Caption);
   FormPeach.pmamr5.Caption:=(FormPeach.mRecent5.Caption);
   FormPeach.pmamr6.Caption:=(FormPeach.mRecent6.Caption);
   FormPeach.pmamr7.Caption:=(FormPeach.mRecent7.Caption);
   FormPeach.pmamr8.Caption:=(FormPeach.mRecent8.Caption);
   FormPeach.pmamr1.Visible:=FormPeach.mRecent1.Visible;
   FormPeach.pmamr2.Visible:=FormPeach.mRecent2.Visible;
   FormPeach.pmamr3.Visible:=FormPeach.mRecent3.Visible;
   FormPeach.pmamr4.Visible:=FormPeach.mRecent4.Visible;
   FormPeach.pmamr5.Visible:=FormPeach.mRecent5.Visible;
   FormPeach.pmamr6.Visible:=FormPeach.mRecent6.Visible;
   FormPeach.pmamr7.Visible:=FormPeach.mRecent7.Visible;
   FormPeach.pmamr8.Visible:=FormPeach.mRecent8.Visible;
   if FormPeach.mRecent1f.Caption<>'' then FormPeach.mRecent1f.Visible:=true else FormPeach.mRecent1f.Visible:=false;
   if FormPeach.mRecent2f.Caption<>'' then FormPeach.mRecent2f.Visible:=true else FormPeach.mRecent2f.Visible:=false;
   if FormPeach.mRecent3f.Caption<>'' then FormPeach.mRecent3f.Visible:=true else FormPeach.mRecent3f.Visible:=false;
   if FormPeach.mRecent4f.Caption<>'' then FormPeach.mRecent4f.Visible:=true else FormPeach.mRecent4f.Visible:=false;
   if FormPeach.mRecent5f.Caption<>'' then FormPeach.mRecent5f.Visible:=true else FormPeach.mRecent5f.Visible:=false;
   if FormPeach.mRecent6f.Caption<>'' then FormPeach.mRecent6f.Visible:=true else FormPeach.mRecent6f.Visible:=false;
   if FormPeach.mRecent7f.Caption<>'' then FormPeach.mRecent7f.Visible:=true else FormPeach.mRecent7f.Visible:=false;
   if FormPeach.mRecent8f.Caption<>'' then FormPeach.mRecent8f.Visible:=true else FormPeach.mRecent8f.Visible:=false;
   FormPeach.pmhr1f.Visible:=FormPeach.mRecent1f.Visible;
   FormPeach.pmhr2f.Visible:=FormPeach.mRecent2f.Visible;
   FormPeach.pmhr3f.Visible:=FormPeach.mRecent3f.Visible;
   FormPeach.pmhr4f.Visible:=FormPeach.mRecent4f.Visible;
   FormPeach.pmhr5f.Visible:=FormPeach.mRecent5f.Visible;
   FormPeach.pmhr6f.Visible:=FormPeach.mRecent6f.Visible;
   FormPeach.pmhr7f.Visible:=FormPeach.mRecent7f.Visible;
   FormPeach.pmhr8f.Visible:=FormPeach.mRecent8f.Visible;
   FormPeach.pnr1.Visible:=FormPeach.mRecent1f.Visible;
   FormPeach.pnr2.Visible:=FormPeach.mRecent2f.Visible;
   FormPeach.pnr3.Visible:=FormPeach.mRecent3f.Visible;
   FormPeach.pnr4.Visible:=FormPeach.mRecent4f.Visible;
   FormPeach.pnr5.Visible:=FormPeach.mRecent5f.Visible;
   FormPeach.pnr6.Visible:=FormPeach.mRecent6f.Visible;
   FormPeach.pnr7.Visible:=FormPeach.mRecent7f.Visible;
   FormPeach.pnr8.Visible:=FormPeach.mRecent8f.Visible;
   FormPeach.pmemr1.Visible:=FormPeach.mRecent1f.Visible;
   FormPeach.pmemr2.Visible:=FormPeach.mRecent2f.Visible;
   FormPeach.pmemr3.Visible:=FormPeach.mRecent3f.Visible;
   FormPeach.pmemr4.Visible:=FormPeach.mRecent4f.Visible;
   FormPeach.pmemr5.Visible:=FormPeach.mRecent5f.Visible;
   FormPeach.pmemr6.Visible:=FormPeach.mRecent6f.Visible;
   FormPeach.pmemr7.Visible:=FormPeach.mRecent7f.Visible;
   FormPeach.pmemr8.Visible:=FormPeach.mRecent8f.Visible;
   FormPeach.mexttoh1.Visible:=FormPeach.mRecent1f.Visible;
   FormPeach.mexttoh2.Visible:=FormPeach.mRecent2f.Visible;
   FormPeach.mexttoh3.Visible:=FormPeach.mRecent3f.Visible;
   FormPeach.mexttoh4.Visible:=FormPeach.mRecent4f.Visible;
   FormPeach.mexttoh5.Visible:=FormPeach.mRecent5f.Visible;
   FormPeach.mexttoh6.Visible:=FormPeach.mRecent6f.Visible;
   FormPeach.mexttoh7.Visible:=FormPeach.mRecent7f.Visible;
   FormPeach.mexttoh8.Visible:=FormPeach.mRecent8f.Visible;
   FormPeach.pmemrf1.Visible:=FormPeach.mRecent1f.Visible;
   FormPeach.pmemrf2.Visible:=FormPeach.mRecent2f.Visible;
   FormPeach.pmemrf3.Visible:=FormPeach.mRecent3f.Visible;
   FormPeach.pmemrf4.Visible:=FormPeach.mRecent4f.Visible;
   FormPeach.pmemrf5.Visible:=FormPeach.mRecent5f.Visible;
   FormPeach.pmemrf6.Visible:=FormPeach.mRecent6f.Visible;
   FormPeach.pmemrf7.Visible:=FormPeach.mRecent7f.Visible;
   FormPeach.pmemrf8.Visible:=FormPeach.mRecent8f.Visible;
   FormPeach.pnra1.Visible:=FormPeach.mRecent1f.Visible;
   FormPeach.pnra2.Visible:=FormPeach.mRecent2f.Visible;
   FormPeach.pnra3.Visible:=FormPeach.mRecent3f.Visible;
   FormPeach.pnra4.Visible:=FormPeach.mRecent4f.Visible;
   FormPeach.pnra5.Visible:=FormPeach.mRecent5f.Visible;
   FormPeach.pnra6.Visible:=FormPeach.mRecent6f.Visible;
   FormPeach.pnra7.Visible:=FormPeach.mRecent7f.Visible;
   FormPeach.pnra8.Visible:=FormPeach.mRecent8f.Visible;
end;

procedure settonewfolder(i:integer);
begin
with FormPeach do
begin
case i of
  0: begin
     MenuItemOpen_ExtractHere.Bitmap:=Bextractall;
     po_exthere.Bitmap:=Bextractall;
     pmqeto.Bitmap:=Bextractall;
     MenuItemExtAllTo.Bitmap:=Bextractall;
     ButtonUn7zaTo.Hint:=txt_ext_sel;
     if toolsize<3 then
        begin
        ButtonUn7zaTo.Glyph:=Bextractall_big;
        end
     else
        if toolsize<6 then
           begin
           ButtonUn7zaTo.Glyph:=Bextractall;
           end;
     ImageFlatext.Glyph:=Bextractall;
     ImageFlatext.Hint:=txt_ext_sel;
     LabelExtHere.Caption:=txt_ext_here;
     end;
  1: begin
     MenuItemOpen_ExtractHere.Bitmap:=Bextractalln;
     po_exthere.Bitmap:=Bextractalln;
     pmqeto.Bitmap:=Bextractalln;
     MenuItemExtAllTo.Bitmap:=Bextractalln;
     ButtonUn7zaTo.Hint:=txt_caption_extract+' '+txt_newfolder;
     if toolsize<3 then
        begin
        ButtonUn7zaTo.Glyph:=Bextractalln_big;
        end
     else
        if toolsize<6 then
           begin
           ButtonUn7zaTo.Glyph:=Bextractalln;
           end;
     ImageFlatext.Glyph:=Bextractalln;
     ImageFlatext.Hint:=txt_caption_extract+' '+txt_newfolder;
     if removeintdir=1 then LabelExtHere.Caption:=txt_9_8_fsmart else LabelExtHere.Caption:=txt_9_8_fnew;
     end;
  end;
end;
populatetree;
end;

procedure setnamingpolicymenu(enmenu:boolean);
begin
with FormPeach do
begin
pmqen1.enabled:=enmenu;
pmqen2.enabled:=enmenu;
pmqen3.enabled:=enmenu;
pmqen4.enabled:=enmenu;
pmqen5.enabled:=enmenu;
end;
end;

procedure setquickextractmenu;
var
   curpath:ansistring;
begin
with FormPeach do
begin
if EditOpenIn.Text<>txt_mypc then
   if (fun='FILEBROWSER') then curpath:=EditOpenIn.Text
   else curpath:=extractfilepath(EditOpenIn.Text)
else curpath:='';
if curpath<>'' then
   if curpath[length(curpath)] <> directoryseparator then curpath:=curpath+directoryseparator;

//set quick extraction menu
if (defaultextractpath<>'') then
      begin
      pmqedefault.visible:=true;
      pmqedefault.caption:=txt_ext_allto+' '+defaultextractpath+' (Ctrl+9)';
      end
   else pmqedefault.visible:=false;
if (lastextractionpath<>'') then
      begin
      pmqelast.visible:=true;
      pmqelast.caption:=txt_ext_allto+' '+lastextractionpath+' (Ctrl+0)';
      end
   else pmqelast.visible:=false;
if (extractfilepath(pnb1.Caption)<>'') and
   (extractfilepath(pnb1.Caption)<>lastextractionpath) then
      begin
      pmqe1fav.visible:=true;
      pmqe1fav.caption:=txt_ext_allto+' '+extractfilepath(pnb1.Caption)+' (Ctrl+1)';
      end
   else pmqe1fav.visible:=false;
if (extractfilepath(pnb2.Caption)<>'') and
   (extractfilepath(pnb2.Caption)<>extractfilepath(pnb1.Caption)) and
   (extractfilepath(pnb2.Caption)<>lastextractionpath) then
      begin
      pmqe2fav.visible:=true;
      pmqe2fav.caption:=txt_ext_allto+' '+extractfilepath(pnb2.Caption)+' (Ctrl+2)';
      end
   else pmqe2fav.visible:=false;
if (extractfilepath(pnb3.Caption)<>'')  and
   (extractfilepath(pnb3.Caption)<>extractfilepath(pnb1.Caption)) and
   (extractfilepath(pnb3.Caption)<>extractfilepath(pnb2.Caption)) and
   (extractfilepath(pnb3.Caption)<>lastextractionpath) then
      begin
      pmqe3fav.visible:=true;
      pmqe3fav.caption:=txt_ext_allto+' '+extractfilepath(pnb3.Caption)+' (Ctrl+3)';
      end
   else pmqe3fav.visible:=false;
if (fun='FILEBROWSER') or (fun='UN7Z') then setnamingpolicymenu(true)
else setnamingpolicymenu(false);
end;
end;

function testname(name:ansistring; sg:TStringGrid):integer; //test if an object is already listed in the stringgrid
var
   i:integer;
begin
testname:=1;
if checkfiledirname(name)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+name); exit; end;
for i:=1 to sg.RowCount-1 do
   if sg.Cells[8,i]=name then
      begin
      testname:=1;
      exit;
      end;
testname:=0;
end;

procedure deselectingrid(sg:tstringgrid);
var
   i:integer;
begin
if sg.Rowcount<2 then exit;
if sg.ColCount<12 then exit;
for i:=1 to sg.Rowcount-1 do
   sg.Cells[11,i]:='0';
end;

procedure addfilestr(sg:TStringGrid; filename:ansistring);
var
   fsize:qword;
   s:ansistring;
   rc,iext:integer;
begin
if sg=FormPeach.StringGridAdd then
   begin
   try
   srcfilesize(filename,fsize);
   rc:=sg.Rowcount+1;
   sg.RowCount:=rc;
   sg.Cells[0,rc-1]:='';
   sg.Cells[1,rc-1]:=extractfilename(filename);
   sg.Cells[2,rc-1]:=extractfileext(filename);
   try sg.Cells[3,rc-1]:=nicenumber(inttostr(fsize),filesizebase); except end;
   sg.Cells[4,rc-1]:='0';
   sg.Cells[5,rc-1]:='1';
   try sg.Cells[6,rc-1]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(fileage(filename)));
   dword2decodedFileAttributes(filegetattr(filename),s);
   sg.Cells[7,rc-1]:=s; except end;
   sg.Cells[8,rc-1]:=filename;
   sg.Cells[9,rc-1]:=prefixf+filename;
   sg.Cells[12,rc-1]:=inttostr(fsize);
   sg.Cells[10,rc-1]:=inttostr(length(inttostr(length(sg.Cells[12,rc-1]))))+inttostr(length(sg.Cells[12,rc-1]))+sg.Cells[12,rc-1];
   sg.Cells[11,rc-1]:='0';
   tpcomp:=testpcomp(filename);
   sg.Cells[15,rc-1]:=inttostr(fsize*tpcomp);
   except
   exit;
   end;
   end
else
   begin
   try
   if (sg=FormPeach.StringGridExtract) then srcfilesize_multipart(filename,fsize)
   else srcfilesize(filename,fsize);
   rc:=sg.Rowcount+1;
   sg.RowCount:=rc;
   sg.Cells[0,rc-1]:='';
   sg.Cells[1,rc-1]:=extractfilename(filename);
   sg.Cells[2,rc-1]:=extractfileext(filename);
   sg.Cells[3,rc-1]:=nicenumber(inttostr(fsize),filesizebase);
   sg.Cells[4,rc-1]:='';
   iext:=testext(filename);
   if sg=FormPeach.StringGridExtract then
      if iext>=0 then
         if (iext>=500) and (iext<=503) then
                           sg.Cells[4,rc-1]:='.'
                        else
                           sg.Cells[4,rc-1]:='+';
   sg.Cells[5,rc-1]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(fileage(filename)));
   dword2decodedFileAttributes(filegetattr(filename),s);
   sg.Cells[6,rc-1]:=s;
   sg.Cells[7,rc-1]:='';
   sg.Cells[8,rc-1]:=filename;
   sg.Cells[9,rc-1]:=prefixf+filename;
   sg.Cells[12,rc-1]:=inttostr(fsize);
   sg.Cells[10,rc-1]:=inttostr(length(inttostr(length(sg.Cells[12,rc-1]))))+inttostr(length(sg.Cells[12,rc-1]))+sg.Cells[12,rc-1];
   sg.Cells[11,rc-1]:='0';
   except
   exit;
   end;
   end;
end;

function rListint(mode: string;
  dir, mask: ansistring;
  fattrib: qword;
  recur: boolean;
  var nfiles, ndirs: qword;
  var flist: TFoundList;
  var fsizes: TFoundListSizes;
  var ftimes: TFoundListAges;
  var fattr: TFoundListAttrib;
  var fattr_dec: TFoundList
  ): integer;
var
  r: TSearchRec;
begin
  result := 1;
  Inc(ndirs, 1);
  if FindFirst(dir + mask, fattrib, r) = 0 then
  begin
    try
      if upcase(mode) = 'DETAILS' then
        repeat
          if ((r.Name <> '.') and (r.Name <> '..')) then
          begin
            SetLength(flist, nfiles + 1);
            SetLength(fsizes, nfiles + 1);
            SetLength(ftimes, nfiles + 1);
            SetLength(fattr, nfiles + 1);
            SetLength(fattr_dec, nfiles + 1);
            flist[nfiles] := dir + (r.Name);
            if (r.Attr and faDirectory <> 0) then
            begin
              if flist[nfiles][length(flist[nfiles])] <> DirectorySeparator then
                flist[nfiles] := flist[nfiles] + DirectorySeparator;
              Inc(ndirs, 1);
            end;
            fsizes[nfiles] := r.Size;
            ftimes[nfiles] := r.Time;
            fattr[nfiles] := r.Attr;
            dword2decodedFileAttributes(r.Attr, fattr_dec[nfiles]);
            Inc(nfiles, 1);
            if nfiles and ((1024)-1) = 0 then Application.ProcessMessages;
          end;
        until findnext(r) <> 0;
    except
      FindClose(r);
      result := 2;
      exit;
    end;
    FindClose(r);
  end;
  if recur = True then
    if FindFirst(dir + '*', fattrib or faDirectory, r) = 0 then
    begin
      try
        repeat
          if ((r.Attr and faDirectory) <> 0) and (r.Name <> '.') and
            (r.Name <> '..') then
          begin
            rListint(mode, dir + (r.Name) +
              DirectorySeparator, mask, fattrib, recur, nfiles, ndirs, flist, fsizes, ftimes, fattr, fattr_dec);
            Dec(ndirs, 1);
            application.ProcessMessages;
          end;
        until findnext(r) <> 0;
      except
        FindClose(r);
        result := 4;
        exit;
      end;
      FindClose(r);
    end;
  if result = 1 then
    result := 0;
end;

function dirsizetcint(path, mask: ansistring;
  fattrib: qword;
  recur: boolean;
  addtofirstobj: boolean;
  var nfiles, ndirs: qword;
  var size, tcsize: qword
  ): integer;
var
  i,tpcomp: integer;
  dir: ansistring;
  flist: TFoundList;
  fsizes: TFoundListSizes;
  ftimes: TFoundListAges;
  fattr: TFoundListAttrib;
  fattr_dec: TFoundList;
begin
  result := 1;
  if addtofirstobj = True then
    nfiles := 1
  else
    nfiles := 0;
  ndirs := 0;
  size := 0;
  tcsize := 0;
  try
    //check for valid path, else set executable path as path
    if length(path) = 0 then
       begin
       result := 4;
       exit;
       end
    else
       dir := path;
    //check for directoryseparator at the end of the path (needed)
    if dir<>'' then
      if dir[length(dir)] <> DirectorySeparator then
      dir := dir + DirectorySeparator;
    result := rListint('DETAILS', dir, mask, fattrib, recur, nfiles, ndirs, flist,
      fsizes, ftimes, fattr, fattr_dec);
    if addtofirstobj = False then
      ndirs := ndirs - 1;
    for i := 0 to length(fsizes) - 1 do
      begin
      size := size + fsizes[i];
      tpcomp:=testpcomp(flist[i]);
      tcsize := tcsize+ (fsizes[i] * tpcomp);
      end;
  except
    result := 4;
    exit;
  end;
  if result = 1 then
    result := 0;
end;

procedure addfolderstr(sg:TStringGrid; foldername:ansistring);
var
   r:TSearchRec;
   s:ansistring;
   nfiles,ndirs,size,tpcompsize:qword;
   rc:integer;
begin
rc:=sg.Rowcount+1;
sg.RowCount:=rc;
sg.Cells[0,rc-1]:='';
sg.Cells[1,rc-1]:=extractfilename(foldername);
if (extractfilename(foldername)='') and (foldername<>'') then sg.Cells[1,rc-1]:=copy(foldername,1,1);
sg.Cells[2,rc-1]:=txt_list_isfolder;
sg.Cells[3,rc-1]:='0 B';
sg.Cells[4,rc-1]:='1';
sg.Cells[5,rc-1]:='0';
if FindFirst(foldername+'.',faDirectory,r) = 0 then
   begin
   sg.Cells[6,rc-1]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(r.Time));
   dword2decodedFileAttributes(r.Attr,s);
   sg.Cells[7,rc-1]:=s;
   end;
FindClose(r);
sg.Cells[8,rc-1]:=foldername;
sg.Cells[9,rc-1]:=prefixd+foldername;
sg.Cells[10,rc-1]:='0';
sg.Cells[11,rc-1]:='0';
sg.Cells[12,rc-1]:='0';
sg.Cells[15,rc-1]:='0';
if (tmpenumd=true) then
   begin
   //enumerate content
   if sg=FormPeach.StringGridAdd then DirSizetcint(foldername,'*',FaAnyFile,true,true,nfiles,ndirs,size,tpcompsize)
      else DirSize(foldername,'*',FaAnyFile,true,true,nfiles,ndirs,size);
   if sg.Rowcount=1 then exit;
   sg.Cells[3,rc-1]:=nicenumber(inttostr(size),filesizebase);
   sg.Cells[4,rc-1]:=inttostr(ndirs);
   sg.Cells[5,rc-1]:=inttostr(nfiles-ndirs);
   sg.Cells[12,rc-1]:=inttostr(size);
   sg.Cells[10,rc-1]:=inttostr(length(inttostr(length(sg.Cells[12,rc-1]))))+inttostr(length(sg.Cells[12,rc-1]))+sg.Cells[12,rc-1];
   sg.Cells[15,rc-1]:=inttostr(tpcompsize);
   end;
end;

procedure autosize_stringgrid1;
begin
FormPeach.StringGridAdd.AutoSizeColumns;
FormPeach.StringGridAdd.ColWidths[0]:=rowsize;
FormPeach.StringGridAdd.ColWidths[1]:=COL1D;
FormPeach.StringGridAdd.ColWidths[9]:=0;
FormPeach.StringGridAdd.ColWidths[10]:=0;
FormPeach.StringGridAdd.ColWidths[11]:=0;
FormPeach.StringGridAdd.ColWidths[12]:=0;
FormPeach.StringGridAdd.colwidths[13]:=0;
FormPeach.StringGridAdd.colwidths[14]:=0;
FormPeach.StringGridAdd.colwidths[15]:=0;
end;

procedure autosize_stringgrid2;
begin
with FormPeach do
begin
StringGridExtract.AutoSizeColumns;
StringGridExtract.ColWidths[0]:=rowsize;
StringGridExtract.ColWidths[1]:=COL1D;
StringGridExtract.ColWidths[9]:=0;
StringGridExtract.ColWidths[10]:=0;
StringGridExtract.ColWidths[11]:=0;
StringGridExtract.ColWidths[12]:=0;
StringGridExtract.colwidths[13]:=0;
StringGridExtract.colwidths[14]:=0;
StringGridExtract.colwidths[15]:=0;
end;
end;

procedure hide_panelhintadd;
begin
FormPeach.PanelHintAdd.Visible:=false;
FormPeach.StringGridAdd.Hint:=txt_2_7_archivehint;
end;

procedure hide_panelhintextract;
begin
FormPeach.PanelHintExtract.Visible:=false;
FormPeach.StringGridExtract.Hint:=txt_2_7_exthint;
end;

procedure updatecontent(sg:TStringGrid; var tvolumes,tdirs,tfiles,tsize:qword; upsort:boolean); //update label showing bytes/files/dirs listed in the stringgrid1; update list of archive types
var
   i:integer;
   s:ansistring;
   tpcompsize:qword;
begin
if updatingcontent=1 then exit;
updatingcontent:=1;
tfiles:=0;
tdirs:=0;
tvolumes:=0;
tsize:=0;
tpcompsize:=0;
sizefreeint:=0;
//hint overlay for add
if sg=FormPeach.StringGridAdd then
   if sg.RowCount>1 then hide_panelhintadd
   else FormPeach.PanelHintAdd.Visible:=true;
for i:=1 to sg.RowCount-1 do
   begin
   tdirs:=tdirs+strtoint(sg.Cells[4,i]);
   tfiles:=tfiles+strtoint(sg.Cells[5,i]);
   try
      tsize:=tsize+strtoqword(sg.Cells[12,i]);
      tpcompsize:=tpcompsize+strtoqword(sg.Cells[15,i]);
   except
   end;
   if upsort=true then sg.Cells[11,i]:='0';
   end;
autosize_stringgrid1;
if using_tarbefore=false then
   begin
   if (FormPeach.cbType.Text=STR_GZIP) or
      (FormPeach.cbType.Text=STR_BZIP2) or
      (FormPeach.cbType.Text=STR_XZ) or
      (FormPeach.cbType.Text=STR_QUAD) or
      (FormPeach.cbType.Text=STR_BROTLI) or
      (FormPeach.cbType.Text=STR_ZSTD) or
      (FormPeach.cbType.Text=txt_split) or
      ((FormPeach.cbType.Text=STR_ZPAQ) and (FormPeach.RadioGroupPaq.ItemIndex=0)) then
      check_tarbefore(tdirs);
   end;
if FormPeach.StringGridAdd.RowCount=1 then
   begin
   status1:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
   if updatingarchive_inarchive=false then
      begin
      FormPeach.LabelStatusArDetails.Caption:=status1;
      FormPeach.LabelStatusAddUpdate.Caption:='';
      end
   else
      begin
      FormPeach.LabelStatusArDetails.Caption:=status1;
      FormPeach.LabelStatusAddUpdate.Caption:=txt_2_7_updating;
      FormPeach.EditAddName.Caption:=FormPeach.editopenin.caption;
      end;
   if (FormPeach.EditAddFilepath.Text='') or (FormPeach.EditAddFilename.Text='') then setoutname(s,0);
   updatingcontent:=0;
   exit;
   end;
if upsort=true then
   begin
   FormPeach.StringGridAdd.SortColRow(true,9);
   FormPeach.StringGridAdd.Cells[11,1]:='1';
   FormPeach.StringGridAdd.Row:=1;
   end;
sizefreeint:=tsize;
status1:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
if updatingarchive_inarchive=false then
   begin
   FormPeach.LabelStatusArDetails.Caption:=status1;
   if tsize<>0 then FormPeach.LabelStatusArDetails.Caption:=FormPeach.LabelStatusArDetails.Caption+' | '+txt_4_7_pcomp+' '+inttostr((tsize*100 - tpcompsize) div tsize)+'%';
   FormPeach.LabelStatusAddUpdate.Caption:='';
   end
else
   begin
   FormPeach.LabelStatusArDetails.Caption:=status1;
   if tsize<>0 then FormPeach.LabelStatusArDetails.Caption:=FormPeach.LabelStatusArDetails.Caption+' | '+txt_4_7_pcomp+' '+inttostr((tsize*100 - tpcompsize) div tsize)+'%';
   FormPeach.LabelStatusAddUpdate.Caption:=txt_2_7_updating;
   FormPeach.EditAddName.Caption:=FormPeach.editopenin.caption;
   end;
if (FormPeach.EditAddFilepath.Text='') or (FormPeach.EditAddFilename.Text='') then setoutname(s,0);
updatingcontent:=0;
end;

procedure addfile;
var
   i:integer;
begin
if FormPeach.OpenDialogList.Execute then
   if FormPeach.OpenDialogList.FileName<>'' then
      begin
      FormPeach.StringGridAdd.Cursor:=crHourGlass;
      deselectingrid(FormPeach.StringGridAdd);
      FormPeach.OpenDialogList.Files.Count;
      for i:=0 to FormPeach.OpenDialogList.Files.Count-1 do
         if testname(FormPeach.OpenDialogList.Files[i], FormPeach.StringGridAdd)=0 then
            begin
            //show names of items being added is not implemented here since adding files is very fast
            addfilestr(FormPeach.StringGridAdd,FormPeach.OpenDialogList.Files[i]);
            end;
      FormPeach.StringGridAdd.AutoSizeColumns;
      updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
      FormPeach.StringGridAdd.Cursor:=crDefault;
      end;
end;

procedure test_extfile(s:ansistring; var okfile:boolean);
begin
okfile:=false;
if testname(s, FormPeach.StringGridExtract)=0 then //no duplicate entries
   if (testinput(s,false)=0) then //unsupported
      if FormPeach.CheckBoxExtUnsupported.State=cbChecked then okfile:=true
      else
   else
      case testext(s) of
         503: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true;
         502: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true;
         501: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true; //non-archives
         500: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true; //Windows executables, installers
         else okfile:=true;
         end;
end;

procedure test_extfile_noduplicatecheck(s:ansistring; var okfile:boolean);
begin
okfile:=false;
   if (testinput(s,false)=0) then //unsupported
      if FormPeach.CheckBoxExtUnsupported.State=cbChecked then okfile:=true
      else
   else
      case testext(s) of
         503: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true;
         502: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true;
         501: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true; //non-archives
         500: if FormPeach.CheckBoxExtNotArchives.State=cbChecked then okfile:=true; //Windows executables, installers
         else okfile:=true;
         end;
end;

procedure addfile_ext;
var
   i:integer;
   okfile:boolean;
begin
if FormPeach.OpenDialogList.Execute then
   if FormPeach.OpenDialogList.FileName<>'' then
      begin
      FormPeach.StringGridExtract.Cursor:=crHourGlass;
      deselectingrid(FormPeach.StringGridExtract);
      FormPeach.OpenDialogList.Files.Count;
      for i:=0 to FormPeach.OpenDialogList.Files.Count-1 do
         begin
         test_extfile(FormPeach.OpenDialogList.Files[i],okfile);
         if okfile=true then
            begin
            if checkfiledirname(FormPeach.OpenDialogList.Files[i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.OpenDialogList.Files[i]); exit; end;
            addfilestr(FormPeach.StringGridExtract,FormPeach.OpenDialogList.Files[i]);
            end;
         end;
      updatecontent_ext;
      FormPeach.StringGridExtract.Cursor:=crDefault;
      end;
end;

procedure addfile_fromname(s:ansistring);
begin
deselectingrid(FormPeach.StringGridAdd);
if testname(s, FormPeach.StringGridAdd)=0 then
   begin
   addfilestr(FormPeach.StringGridAdd,s);
   FormPeach.StringGridAdd.AutoSizeColumns;
   updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
   end;
end;

procedure addfile_ext_fromname(s:ansistring);
var
   okfile:boolean;
begin
deselectingrid(FormPeach.StringGridExtract);
test_extfile(s,okfile);
if okfile=true then
   begin
   if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
   addfilestr(FormPeach.StringGridExtract,s);
   end;
updatecontent_ext;
end;

procedure addfilefolder_ext_fromname(s:ansistring);
var
   j:integer;
   okfile:boolean;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound:qword;
begin
FormPeach.StringGridExtract.Cursor:=crHourGlass;
deselectingrid(FormPeach.StringGridExtract);
if length(s)>2 then
   if s[length(s)]=directoryseparator then
      begin
      SetLength(s,length(s)-1);
      expand(s,exp_files,exp_fsizes,exp_ftimes,exp_fattr,exp_fattr_dec,nfound);
      for j:=0 to nfound-1 do
         if pos('D',exp_fattr_dec[j])=0 then
            begin
            test_extfile(exp_files[j],okfile);
            if okfile=true then
               begin
               if checkfiledirname(exp_files[j])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+exp_files[j]); exit; end;
               addfilestr(FormPeach.StringGridExtract,exp_files[j]);
               end;
            end;
      updatecontent_ext;
      end
   else addfile_ext_fromname(s);
FormPeach.StringGridExtract.Cursor:=crDefault;
end;

procedure addfolder_ext;
begin
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      begin
      addfilefolder_ext_fromname(FormPeach.SelectDirectoryDialog1.FileName+DirectorySeparator);
      end;
end;

procedure addfilefolder_fromname(s:ansistring);
var
   s1:ansistring;
begin
s1:=FormPeach.Caption;
deselectingrid(FormPeach.StringGridAdd);
if length(s)>2 then
   if s[length(s)]=directoryseparator then
      begin
      SetLength(s,length(s)-1);
      if testname(s, FormPeach.StringGridAdd)=0 then
         begin
         FormPeach.StringGridAdd.Cursor:=crHourGlass;
         FormPeach.Caption:=txt_2_4_adding+' '+s;
         Application.ProcessMessages;
         deselectingrid(FormPeach.StringGridAdd);
         addfolderstr(FormPeach.StringGridAdd,s);
         FormPeach.StringGridAdd.AutoSizeColumns;
         updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
         FormPeach.StringGridAdd.Cursor:=crDefault;
         end;
      end
   else addfile_fromname(s);
FormPeach.Caption:=s1;
updatelayout('');
end;

procedure addfolder;
begin
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      addfilefolder_fromname(FormPeach.SelectDirectoryDialog1.FileName);
end;

procedure setsearch_disabled;
begin
FormPeach.EditUn7zaFilter.Text:='*';
FormPeach.EditUn7zaFilter.Enabled:=false;
FormPeach.EditUn7zaFilter.Visible:=false;
FormPeach.EditUn7zaFilterInteractive.ReadOnly:=true;
FormPeach.EditUn7zaFilterInteractive.Visible:=false;
end;

procedure setsearch_enabled;
begin
FormPeach.EditUn7zaFilter.ReadOnly:=false;
FormPeach.EditUn7zaFilter.Enabled:=true;
FormPeach.EditUn7zaFilter.Visible:=true;
FormPeach.EditUn7zaFilterInteractive.ReadOnly:=false;
FormPeach.EditUn7zaFilterInteractive.Visible:=true;
end;

procedure advfiltersupdate;
begin
with FormPeach do
begin
if FormAdvf.CheckBoxAdvFilters.State=cbChecked then
   begin
   if filterbrowser=1 then
      begin
      if fun='UN7Z' then setsearch_disabled;
      status0:=txt_list_found;
      end;
   madvfilters.checked:=true;
   end
else
   begin
   setsearch_enabled;
   status0:=txt_list_browsing;
   madvfilters.checked:=false;
   browsingmode7z:=0;
   end;
end;
end;

procedure setfiltericon(vis:boolean);
begin
FormPeach.Imageopenadvf.visible:=vis;
FormPeach.ImageExtractAdvf.visible:=vis;
FormPeach.ImageAddAdvf.visible:=vis;
end;

procedure msg_not_accessible_list(s:ansistring);
begin
//interactive error message suppressed
end;

procedure loadlist(sg:TStringGrid; listfilename:AnsiString);
var
   in_param:TFoundlist;
   listfile:ansistring;
   i:integer;
begin
FormPeach.OpenDialogLayout.InitialDir:=confpath+'Layouts'+DirectorySeparator;
listfile:='';
if listfilename<>'' then
   if FileExists(listfilename) then
      listfile:=listfilename;
if listfilename='' then //interactive, better not use at startup, ignore non existing layouts to improve portable use
   if FormPeach.OpenDialogLayout.Execute then
      if FormPeach.OpenDialogLayout.FileName<>'' then listfile:=FormPeach.OpenDialogLayout.FileName;
if listfile<>'' then
   begin
      read_filelist(listfile,in_param);
      plistfile:=listfile;
      for i:=0 to length(in_param)-1 do
         begin
         if pos('*filter* ',in_param[i])=1 then
            begin
            FormAdvf.MemoAdvExclude.Append(copy(in_param[i],10,length(in_param[i])-9));
            if FormAdvf.CheckBoxAdvFilters.State=cbUnchecked then
               begin
               FormAdvf.CheckBoxAdvFilters.State:=cbChecked;
               set_advfilters_enabled(True);
               setfiltericon(true);
               advfiltersupdate;
               end;
            end
         else
            if pos('*filter_include* ',in_param[i])=1 then
               begin
               FormAdvf.MemoAdvInclude.Append(copy(in_param[i],18,length(in_param[i])-17));
               if FormAdvf.CheckBoxAdvFilters.State=cbUnchecked then
                  begin
                  FormAdvf.CheckBoxAdvFilters.State:=cbChecked;
                  set_advfilters_enabled(True);
                  setfiltericon(true);
                  advfiltersupdate;
                  end;
               end
            else
               if sg<>nil then
               begin
               if sg=FormPeach.StringGridAdd then
                  if testname(in_param[i], sg)=0 then
                     if filegetattr(in_param[i]) > 0 then
                        if filegetattr(in_param[i]) and faDirectory =0 then addfilestr(sg,in_param[i])
                        else addfolderstr(sg,in_param[i])
                     else msg_not_accessible_list(in_param[i])
                  else
               else
                  if testname(in_param[i], sg)=0 then
                     if filegetattr(in_param[i]) > 0 then
                        if filegetattr(in_param[i]) and faDirectory =0 then addfilestr(sg,in_param[i])
                        else
                     else msg_not_accessible_list(in_param[i]);
               end;
         end;
      if sg<>nil then
         if sg=FormPeach.StringGridAdd then updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true)
         else updatecontent_ext;
      end;
end;

function check_input:integer;
begin
check_input:=-1;
//check if input is suitable for chosen archive_type
if FormPeach.StringGridAdd.RowCount=1 then
   if FormAdvf.CheckBoxAdvFilters.State=cbUnChecked then
      begin
      exit;
      end;
check_input:=0;
end;

function check_extraction_input:integer;
begin
check_extraction_input:=-1;
if FormPeach.StringGridExtract.RowCount=1 then
   if FormAdvf.CheckBoxAdvFilters.State=cbUnChecked then
      begin
      pMessageWarningOK(txt_2_7_noinput);
      exit;
      end;
check_extraction_input:=0;
end;

procedure savelist(sg:TStringGrid);
var
   x:dword;
   tname:ansistring;
begin
if sg=FormPeach.StringGridAdd then
   if check_input<>0 then exit;
if sg=FormPeach.StringGridExtract then
   if check_extraction_input<>0 then exit;
FormPeach.SaveDialogPJ.DefaultExt:='.txt';
FormPeach.SaveDialogPJ.InitialDir:=confpath+'Layouts'+DirectorySeparator;
if FormPeach.SaveDialogPJ.Execute then
   if FormPeach.SaveDialogPJ.FileName<>'' then tname:=FormPeach.SaveDialogPJ.FileName;
if tname='' then exit;
assignfile(t,tname);
rewrite(t);
write_header(t);
if sg<>nil then for x:=1 to sg.RowCount-1 do writeln(t,sg.Cells[8,x]);
if FormAdvf.MemoAdvExclude.Lines.Count>0 then
   for x:=0 to FormAdvf.MemoAdvExclude.Lines.Count-1 do writeln(t,'*filter* '+FormAdvf.MemoAdvExclude.Lines[x]);
if FormAdvf.MemoAdvInclude.Lines.Count>0 then
   for x:=0 to FormAdvf.MemoAdvInclude.Lines.Count-1 do writeln(t,'*filter_include* '+FormAdvf.MemoAdvInclude.Lines[x]);
closefile(t);
end;

procedure clearlist;
begin
FormPeach.StringGridAdd.Row:=0;
FormPeach.StringGridAdd.RowCount:=1;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
end;

procedure restorelistTB;
var i:integer;
begin
FormPeach.StringGridAdd.RowCount:=FormPeach.StringGridTB.RowCount;
for i:=1 to FormPeach.StringGridTB.RowCount-1 do
   FormPeach.StringGridAdd.Rows[i].Assign(FormPeach.StringGridTB.Rows[i]);
FormPeach.StringGridAdd.Row:=0;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
end;

procedure clearlist_ext;
begin
FormPeach.StringGridExtract.Row:=0;
FormPeach.StringGridExtract.RowCount:=1;
FormPeach.LabelStatusExtract.Caption:='';
end;

procedure addtohistorypopup;
var
   s:ansistring;
   rc:integer;
begin
with FormPeach do
   begin
   rc:=StringGridSessionHistory.RowCount;
   if rc>1 then pmh1.caption:=StringGridSessionHistory.Cells[2,rc-1]+' '+StringGridSessionHistory.Cells[3,rc-1] else pmh1.caption:='';
   if rc>2 then pmh2.caption:=StringGridSessionHistory.Cells[2,rc-2]+' '+StringGridSessionHistory.Cells[3,rc-2] else pmh2.caption:='';
   if rc>3 then pmh3.caption:=StringGridSessionHistory.Cells[2,rc-3]+' '+StringGridSessionHistory.Cells[3,rc-3] else pmh3.caption:='';
   if rc>4 then pmh4.caption:=StringGridSessionHistory.Cells[2,rc-4]+' '+StringGridSessionHistory.Cells[3,rc-4] else pmh4.caption:='';
   if rc>5 then pmh5.caption:=StringGridSessionHistory.Cells[2,rc-5]+' '+StringGridSessionHistory.Cells[3,rc-5] else pmh5.caption:='';
   if rc>6 then pmh6.caption:=StringGridSessionHistory.Cells[2,rc-6]+' '+StringGridSessionHistory.Cells[3,rc-6] else pmh6.caption:='';
   if rc>7 then pmh7.caption:=StringGridSessionHistory.Cells[2,rc-7]+' '+StringGridSessionHistory.Cells[3,rc-7] else pmh7.caption:='';
   if rc>8 then pmh8.caption:=StringGridSessionHistory.Cells[2,rc-8]+' '+StringGridSessionHistory.Cells[3,rc-8] else pmh8.caption:='';
   if pmh8.caption='' then pmh8.visible:=false else pmh8.visible:=true;
   if pmh7.caption='' then pmh7.visible:=false else pmh7.visible:=true;
   if pmh6.caption='' then pmh6.visible:=false else pmh6.visible:=true;
   if pmh5.caption='' then pmh5.visible:=false else pmh5.visible:=true;
   if pmh4.caption='' then pmh4.visible:=false else pmh4.visible:=true;
   if pmh3.caption='' then pmh3.visible:=false else pmh3.visible:=true;
   if pmh2.caption='' then pmh2.visible:=false else pmh2.visible:=true;
   if pmh1.visible=true then pmh1.Bitmap:=drawhistoryicon(rc-1);
   if pmh2.visible=true then pmh2.Bitmap:=drawhistoryicon(rc-2);
   if pmh3.visible=true then pmh3.Bitmap:=drawhistoryicon(rc-3);
   if pmh4.visible=true then pmh4.Bitmap:=drawhistoryicon(rc-4);
   if pmh5.visible=true then pmh5.Bitmap:=drawhistoryicon(rc-5);
   if pmh6.visible=true then pmh6.Bitmap:=drawhistoryicon(rc-6);
   if pmh7.visible=true then pmh7.Bitmap:=drawhistoryicon(rc-7);
   if pmh8.visible=true then pmh8.Bitmap:=drawhistoryicon(rc-8);
   if rc>1 then mhistory1.caption:=StringGridSessionHistory.Cells[2,rc-1]+' '+StringGridSessionHistory.Cells[3,rc-1] else mhistory1.caption:='';
   if rc>2 then mhistory2.caption:=StringGridSessionHistory.Cells[2,rc-2]+' '+StringGridSessionHistory.Cells[3,rc-2] else mhistory2.caption:='';
   if rc>3 then mhistory3.caption:=StringGridSessionHistory.Cells[2,rc-3]+' '+StringGridSessionHistory.Cells[3,rc-3] else mhistory3.caption:='';
   if rc>4 then mhistory4.caption:=StringGridSessionHistory.Cells[2,rc-4]+' '+StringGridSessionHistory.Cells[3,rc-4] else mhistory4.caption:='';
   if rc>5 then mhistory5.caption:=StringGridSessionHistory.Cells[2,rc-5]+' '+StringGridSessionHistory.Cells[3,rc-5] else mhistory5.caption:='';
   if rc>6 then mhistory6.caption:=StringGridSessionHistory.Cells[2,rc-6]+' '+StringGridSessionHistory.Cells[3,rc-6] else mhistory6.caption:='';
   if rc>7 then mhistory7.caption:=StringGridSessionHistory.Cells[2,rc-7]+' '+StringGridSessionHistory.Cells[3,rc-7] else mhistory7.caption:='';
   if rc>8 then mhistory8.caption:=StringGridSessionHistory.Cells[2,rc-8]+' '+StringGridSessionHistory.Cells[3,rc-8] else mhistory8.caption:='';
   if mhistory8.caption='' then mhistory8.visible:=false else mhistory8.visible:=true;
   if mhistory7.caption='' then mhistory7.visible:=false else mhistory7.visible:=true;
   if mhistory6.caption='' then mhistory6.visible:=false else mhistory6.visible:=true;
   if mhistory5.caption='' then mhistory5.visible:=false else mhistory5.visible:=true;
   if mhistory4.caption='' then mhistory4.visible:=false else mhistory4.visible:=true;
   if mhistory3.caption='' then mhistory3.visible:=false else mhistory3.visible:=true;
   if mhistory2.caption='' then mhistory2.visible:=false else mhistory2.visible:=true;
   if mhistory1.visible=true then mhistory1.Bitmap:=pmh1.Bitmap;
   if mhistory2.visible=true then mhistory2.Bitmap:=pmh2.Bitmap;
   if mhistory3.visible=true then mhistory3.Bitmap:=pmh3.Bitmap;
   if mhistory4.visible=true then mhistory4.Bitmap:=pmh4.Bitmap;
   if mhistory5.visible=true then mhistory5.Bitmap:=pmh5.Bitmap;
   if mhistory6.visible=true then mhistory6.Bitmap:=pmh6.Bitmap;
   if mhistory7.visible=true then mhistory7.Bitmap:=pmh7.Bitmap;
   if mhistory8.visible=true then mhistory8.Bitmap:=pmh8.Bitmap;
   if rc>1 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-1];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha1.caption:=s else pnha1.caption:='';
      end;
   if rc>2 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-2];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha2.caption:=s else pnha2.caption:='';
      end;
   if rc>3 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-3];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha3.caption:=s else pnha3.caption:='';
      end;
   if rc>4 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-4];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha4.caption:=s else pnha4.caption:='';
      end;
   if rc>5 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-5];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha5.caption:=s else pnha5.caption:='';
      end;
   if rc>6 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-6];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha6.caption:=s else pnha6.caption:='';
      end;
   if rc>7 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-7];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha7.caption:=s else pnha7.caption:='';
      end;
   if rc>8 then
      begin
      s:=StringGridSessionHistory.Cells[2,rc-8];
      if s=txt_mypc then s:='';
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=extractfilepath(s);
      if s<>'' then pnha8.caption:=s else pnha8.caption:='';
      end;
   if pnha8.caption='' then pnha8.visible:=false else pnha8.visible:=true;
   if pnha7.caption='' then pnha7.visible:=false else pnha7.visible:=true;
   if pnha6.caption='' then pnha6.visible:=false else pnha6.visible:=true;
   if pnha5.caption='' then pnha5.visible:=false else pnha5.visible:=true;
   if pnha4.caption='' then pnha4.visible:=false else pnha4.visible:=true;
   if pnha3.caption='' then pnha3.visible:=false else pnha3.visible:=true;
   if pnha2.caption='' then pnha2.visible:=false else pnha2.visible:=true;
   if pnha1.caption='' then pnha1.visible:=false else pnha1.visible:=true;
   if pnha1.visible=true then pnha1.Bitmap:=pmh1.Bitmap;
   if pnha2.visible=true then pnha2.Bitmap:=pmh2.Bitmap;
   if pnha3.visible=true then pnha3.Bitmap:=pmh3.Bitmap;
   if pnha4.visible=true then pnha4.Bitmap:=pmh4.Bitmap;
   if pnha5.visible=true then pnha5.Bitmap:=pmh5.Bitmap;
   if pnha6.visible=true then pnha6.Bitmap:=pmh6.Bitmap;
   if pnha7.visible=true then pnha7.Bitmap:=pmh7.Bitmap;
   if pnha8.visible=true then pnha8.Bitmap:=pmh8.Bitmap;
   pnh1.caption:=pnha1.caption;
   pnh2.caption:=pnha2.caption;
   pnh3.caption:=pnha3.caption;
   pnh4.caption:=pnha4.caption;
   pnh5.caption:=pnha5.caption;
   pnh6.caption:=pnha6.caption;
   pnh7.caption:=pnha7.caption;
   pnh8.caption:=pnha8.caption;
   if pnh8.caption='' then pnh8.visible:=false else pnh8.visible:=true;
   if pnh7.caption='' then pnh7.visible:=false else pnh7.visible:=true;
   if pnh6.caption='' then pnh6.visible:=false else pnh6.visible:=true;
   if pnh5.caption='' then pnh5.visible:=false else pnh5.visible:=true;
   if pnh4.caption='' then pnh4.visible:=false else pnh4.visible:=true;
   if pnh3.caption='' then pnh3.visible:=false else pnh3.visible:=true;
   if pnh2.caption='' then pnh2.visible:=false else pnh2.visible:=true;
   if pnh1.caption='' then pnh1.visible:=false else pnh1.visible:=true;
   if pnh1.visible=true then pnh1.Bitmap:=pmh1.Bitmap;
   if pnh2.visible=true then pnh2.Bitmap:=pmh2.Bitmap;
   if pnh3.visible=true then pnh3.Bitmap:=pmh3.Bitmap;
   if pnh4.visible=true then pnh4.Bitmap:=pmh4.Bitmap;
   if pnh5.visible=true then pnh5.Bitmap:=pmh5.Bitmap;
   if pnh6.visible=true then pnh6.Bitmap:=pmh6.Bitmap;
   if pnh7.visible=true then pnh7.Bitmap:=pmh7.Bitmap;
   if pnh8.visible=true then pnh8.Bitmap:=pmh8.Bitmap;
   if rc>1 then pnhf1.caption:=StringGridSessionHistory.Cells[2,rc-1] else pnhf1.caption:='';
   if rc>2 then pnhf2.caption:=StringGridSessionHistory.Cells[2,rc-2] else pnhf2.caption:='';
   if rc>3 then pnhf3.caption:=StringGridSessionHistory.Cells[2,rc-3] else pnhf3.caption:='';
   if rc>4 then pnhf4.caption:=StringGridSessionHistory.Cells[2,rc-4] else pnhf4.caption:='';
   if rc>5 then pnhf5.caption:=StringGridSessionHistory.Cells[2,rc-5] else pnhf5.caption:='';
   if rc>6 then pnhf6.caption:=StringGridSessionHistory.Cells[2,rc-6] else pnhf6.caption:='';
   if rc>7 then pnhf7.caption:=StringGridSessionHistory.Cells[2,rc-7] else pnhf7.caption:='';
   if rc>8 then pnhf8.caption:=StringGridSessionHistory.Cells[2,rc-8] else pnhf8.caption:='';
   if pnhf8.caption='' then pnhf8.visible:=false else pnhf8.visible:=true;
   if pnhf7.caption='' then pnhf7.visible:=false else pnhf7.visible:=true;
   if pnhf6.caption='' then pnhf6.visible:=false else pnhf6.visible:=true;
   if pnhf5.caption='' then pnhf5.visible:=false else pnhf5.visible:=true;
   if pnhf4.caption='' then pnhf4.visible:=false else pnhf4.visible:=true;
   if pnhf3.caption='' then pnhf3.visible:=false else pnhf3.visible:=true;
   if pnhf2.caption='' then pnhf2.visible:=false else pnhf2.visible:=true;
   if pnhf1.caption='' then pnhf1.visible:=false else pnhf1.visible:=true;
   if pnhf1.visible=true then pnhf1.Bitmap:=pmh1.Bitmap;
   if pnhf2.visible=true then pnhf2.Bitmap:=pmh2.Bitmap;
   if pnhf3.visible=true then pnhf3.Bitmap:=pmh3.Bitmap;
   if pnhf4.visible=true then pnhf4.Bitmap:=pmh4.Bitmap;
   if pnhf5.visible=true then pnhf5.Bitmap:=pmh5.Bitmap;
   if pnhf6.visible=true then pnhf6.Bitmap:=pmh6.Bitmap;
   if pnhf7.visible=true then pnhf7.Bitmap:=pmh7.Bitmap;
   if pnhf8.visible=true then pnhf8.Bitmap:=pmh8.Bitmap;
   pnhe1.caption:=pnha1.caption;
   pnhe2.caption:=pnha2.caption;
   pnhe3.caption:=pnha3.caption;
   pnhe4.caption:=pnha4.caption;
   pnhe5.caption:=pnha5.caption;
   pnhe6.caption:=pnha6.caption;
   pnhe7.caption:=pnha7.caption;
   pnhe8.caption:=pnha8.caption;
   if pnhe8.caption='' then pnhe8.visible:=false else pnhe8.visible:=true;
   if pnhe7.caption='' then pnhe7.visible:=false else pnhe7.visible:=true;
   if pnhe6.caption='' then pnhe6.visible:=false else pnhe6.visible:=true;
   if pnhe5.caption='' then pnhe5.visible:=false else pnhe5.visible:=true;
   if pnhe4.caption='' then pnhe4.visible:=false else pnhe4.visible:=true;
   if pnhe3.caption='' then pnhe3.visible:=false else pnhe3.visible:=true;
   if pnhe2.caption='' then pnhe2.visible:=false else pnhe2.visible:=true;
   if pnhe1.caption='' then pnhe1.visible:=false else pnhe1.visible:=true;
   if pnhe1.visible=true then pnhe1.Bitmap:=pmh1.Bitmap;
   if pnhe2.visible=true then pnhe2.Bitmap:=pmh2.Bitmap;
   if pnhe3.visible=true then pnhe3.Bitmap:=pmh3.Bitmap;
   if pnhe4.visible=true then pnhe4.Bitmap:=pmh4.Bitmap;
   if pnhe5.visible=true then pnhe5.Bitmap:=pmh5.Bitmap;
   if pnhe6.visible=true then pnhe6.Bitmap:=pmh6.Bitmap;
   if pnhe7.visible=true then pnhe7.Bitmap:=pmh7.Bitmap;
   if pnhe8.visible=true then pnhe8.Bitmap:=pmh8.Bitmap;
   mexttos1.caption:=pnha1.caption;
   mexttos2.caption:=pnha2.caption;
   mexttos3.caption:=pnha3.caption;
   mexttos4.caption:=pnha4.caption;
   mexttos5.caption:=pnha5.caption;
   mexttos6.caption:=pnha6.caption;
   mexttos7.caption:=pnha7.caption;
   mexttos8.caption:=pnha8.caption;
   if mexttos8.caption='' then mexttos8.visible:=false else mexttos8.visible:=true;
   if mexttos7.caption='' then mexttos7.visible:=false else mexttos7.visible:=true;
   if mexttos6.caption='' then mexttos6.visible:=false else mexttos6.visible:=true;
   if mexttos5.caption='' then mexttos5.visible:=false else mexttos5.visible:=true;
   if mexttos4.caption='' then mexttos4.visible:=false else mexttos4.visible:=true;
   if mexttos3.caption='' then mexttos3.visible:=false else mexttos3.visible:=true;
   if mexttos2.caption='' then mexttos2.visible:=false else mexttos2.visible:=true;
   if mexttos1.caption='' then mexttos1.visible:=false else mexttos1.visible:=true;
   if mexttos1.visible=true then mexttos1.Bitmap:=pmh1.Bitmap;
   if mexttos2.visible=true then mexttos2.Bitmap:=pmh2.Bitmap;
   if mexttos3.visible=true then mexttos3.Bitmap:=pmh3.Bitmap;
   if mexttos4.visible=true then mexttos4.Bitmap:=pmh4.Bitmap;
   if mexttos5.visible=true then mexttos5.Bitmap:=pmh5.Bitmap;
   if mexttos6.visible=true then mexttos6.Bitmap:=pmh6.Bitmap;
   if mexttos7.visible=true then mexttos7.Bitmap:=pmh7.Bitmap;
   if mexttos8.visible=true then mexttos8.Bitmap:=pmh8.Bitmap;

   CopyMenuItems(mHistory,pmnavhistory.Items,28);
   end;
end;

procedure sethistorybuttons;
begin
if FormPeach.StringGridSessionHistory.Row=FormPeach.StringGridSessionHistory.RowCount-1 then FormPeach.ctrlfwd.enabled:=false
else FormPeach.ctrlfwd.enabled:=true;
if FormPeach.StringGridSessionHistory.Row=1 then FormPeach.ctrlback.enabled:=false
else FormPeach.ctrlback.enabled:=true;
end;

procedure addtohistory;
var
   rc,selptab:integer;
begin
FormPeach.StringGridSessionHistory.RowCount:=FormPeach.StringGridSessionHistory.Row+1;
if fun='UN7Z' then
   begin
   if (FormPeach.EditUn7zaFilter.Text=FormPeach.StringGridSessionHistory.Cells[1,FormPeach.StringGridSessionHistory.RowCount-1]) and (FormPeach.EditUn7zaFilterExclude.Text=FormPeach.StringGridSessionHistory.Cells[1,FormPeach.StringGridSessionHistory.RowCount-1]) then exit;
   rc:=FormPeach.StringGridSessionHistory.Rowcount;
   if (FormPeach.StringGridSessionHistory.Cells[1,rc-1]=status0) and
      (FormPeach.StringGridSessionHistory.Cells[2,rc-1]=FormPeach.EditOpenIn.Text) and
      (FormPeach.StringGridSessionHistory.Cells[3,rc-1]=FormPeach.EditUn7zaFilter.Text) and
      (FormPeach.StringGridSessionHistory.Cells[4,rc-1]=FormPeach.EditUn7zaFilterExclude.Text) then exit;
   rc:=rc+1;
   FormPeach.StringGridSessionHistory.RowCount:=rc;
   FormPeach.StringGridSessionHistory.Cells[1,rc-1]:=status0;
   FormPeach.StringGridSessionHistory.Cells[2,rc-1]:=FormPeach.EditOpenIn.Text;
   FormPeach.StringGridSessionHistory.Cells[3,rc-1]:=FormPeach.EditUn7zaFilter.Text;
   FormPeach.StringGridSessionHistory.Cells[4,rc-1]:=FormPeach.EditUn7zaFilterExclude.Text;
   end
else
   begin
   rc:=FormPeach.StringGridSessionHistory.Rowcount;
   if (FormPeach.StringGridSessionHistory.Cells[1,rc-1]=status0) and
      (FormPeach.StringGridSessionHistory.Cells[2,rc-1]=FormPeach.EditOpenIn.Text) and
      (FormPeach.StringGridSessionHistory.Cells[3,rc-1]=FormPeach.EditUn7zaFilter.Text) then exit;
   rc:=rc+1;
   FormPeach.StringGridSessionHistory.RowCount:=rc;
   FormPeach.StringGridSessionHistory.Cells[1,rc-1]:=status0;
   FormPeach.StringGridSessionHistory.Cells[2,rc-1]:=FormPeach.EditOpenIn.Text;
   FormPeach.StringGridSessionHistory.Cells[3,rc-1]:=FormPeach.EditUn7zaFilter.Text;
   FormPeach.StringGridSessionHistory.Cells[4,rc-1]:='';
   end;
FormPeach.StringGridSessionHistory.AutosizeColumns;
FormPeach.StringGridSessionHistory.ColWidths[0]:=rowsize;
if FormPeach.StringGridSessionHistory.Width<250 then FormPeach.StringGridSessionHistory.Width:=250;
FormPeach.StringGridSessionHistory.Row:=FormPeach.StringGridSessionHistory.RowCount-1;
addtohistorypopup;
sethistorybuttons;
populatetree;
for selptab:=0 to FormPeach.TabBar.Sections.Count-1 do if FormPeach.TabBar.Sections.Items[selptab].ID=atabid then break;
if FormPeach.TabBar.Sections.Items[selptab].ID<>0 then
    begin
    FormPeach.TabBar.Sections[selptab].Text:=gettabname(FormPeach.StringGridSessionHistory.Row);
    FormPeach.TabBar.Sections[selptab].ImageIndex:=drawtabicon(FormPeach.StringGridSessionHistory.Row);
    FormPeach.StringGridTabs.Rows[atabid]:=FormPeach.StringGridSessionHistory.Rows[FormPeach.StringGridSessionHistory.Row];
    end;
end;

procedure populatebookmarks;
var
   i,j,k,sbrowse:integer;
   s,s1,s2:ansistring;
begin
with FormPeach do
begin
mb1.visible:=false;
mb2.visible:=false;
mb3.visible:=false;
mb4.visible:=false;
mb5.visible:=false;
mb6.visible:=false;
mb7.visible:=false;
mb8.visible:=false;
mb9.visible:=false;
mb10.visible:=false;
mb11.visible:=false;
mb12.visible:=false;
mb13.visible:=false;
mb14.visible:=false;
mb15.visible:=false;
mb16.visible:=false;
mb17.visible:=false;
mb18.visible:=false;
mb19.visible:=false;
mb20.visible:=false;
mb21.visible:=false;
mb22.visible:=false;
mb23.visible:=false;
pnb1.visible:=false;
pnb2.visible:=false;
pnb3.visible:=false;
pnb4.visible:=false;
pnb5.visible:=false;
pnb6.visible:=false;
pnb7.visible:=false;
pnb8.visible:=false;
pnb9.visible:=false;
pnb10.visible:=false;
pnb11.visible:=false;
pnb12.visible:=false;
pnb13.visible:=false;
pnb14.visible:=false;
pnb15.visible:=false;
pnb16.visible:=false;
pnb17.visible:=false;
pnb18.visible:=false;
pnb19.visible:=false;
pnb20.visible:=false;
pnb21.visible:=false;
pnb22.visible:=false;
pnb23.visible:=false;
pnba1.visible:=false;
pnba2.visible:=false;
pnba3.visible:=false;
pnba4.visible:=false;
pnba5.visible:=false;
pnba6.visible:=false;
pnba7.visible:=false;
pnba8.visible:=false;
pnba9.visible:=false;
pnba10.visible:=false;
pnba11.visible:=false;
pnba12.visible:=false;
pnba13.visible:=false;
pnba14.visible:=false;
pnba15.visible:=false;
pnba16.visible:=false;
pnba17.visible:=false;
pnba18.visible:=false;
pnba19.visible:=false;
pnba20.visible:=false;
pnba21.visible:=false;
pnba22.visible:=false;
pnba23.visible:=false;
pmjb1.visible:=false;
pmjb2.visible:=false;
pmjb3.visible:=false;
pmjb4.visible:=false;
pmjb5.visible:=false;
pmjb6.visible:=false;
pmjb7.visible:=false;
pmjb8.visible:=false;
pmjb9.visible:=false;
pmjb10.visible:=false;
pmjb11.visible:=false;
pmjb12.visible:=false;
pmjb13.visible:=false;
pmjb14.visible:=false;
pmjb15.visible:=false;
pmjb16.visible:=false;
pmjb17.visible:=false;
pmjb18.visible:=false;
pmjb19.visible:=false;
pmjb20.visible:=false;
pmjb21.visible:=false;
pmjb22.visible:=false;
pmjb23.visible:=false;
j:=StringGridBookmarks.RowCount;
if j>24 then j:=24;
k:=0;
if StringGridBookmarks.RowCount>1 then
   for i:=1 to j-1 do
      begin
      s:=FormPeach.StringGridBookmarks.Cells[2,i]; //full name
      s1:=s;
      if length(s1)>0 then
         if s1[length(s1)]=directoryseparator then
         else s1:=extractfilepath(s1); //path, if item is a file
      s2:=FormPeach.StringGridBookmarks.Cells[3,i]; //readable name taking in account special folders names
      sbrowse:=getsbrowse(i);
      case i of
         1: begin
            pmembf1.caption:=s2;
            mb1.caption:=s2;
            mb1.visible:=true;
            mb1.Bitmap:=drawmenuicon(s,sbrowse);
            pmjb1.caption:=s2;
            pmjb1.visible:=true;
            pmjb1.Bitmap:=mb1.Bitmap;
            pnb1.caption:=s1;
            pnba1.caption:=s1;
            if s1<>'' then
               begin
               pnb1.visible:=true;
               pnb1.Bitmap:=drawmenuicon(s1);
               pnba1.visible:=true;
               pnba1.Bitmap:=pnb1.Bitmap;
               end;
            end;
         2: begin
            pmembf2.caption:=s2;
            mb2.caption:=s2;
            mb2.visible:=true;
            mb2.Bitmap:=drawmenuicon(s,sbrowse);
            pmjb2.caption:=s2;
            pmjb2.visible:=true;
            pmjb2.Bitmap:=mb2.Bitmap;
            pnb2.caption:=s1;
            pnba2.caption:=s1;
            if s1<>'' then
               begin
               pnb2.visible:=true;
               pnb2.Bitmap:=drawmenuicon(s1);
               pnba2.visible:=true;
               pnba2.Bitmap:=pnb2.Bitmap;
               end;
            end;
         3: begin
         pmembf3.caption:=s2;
         mb3.caption:=s2;
         mb3.visible:=true;
         mb3.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb3.caption:=s2;
         pmjb3.visible:=true;
         pmjb3.Bitmap:=mb3.Bitmap;
         pnb3.caption:=s1;
         pnba3.caption:=s1;
         if s1<>'' then
            begin
            pnb3.visible:=true;
            pnb3.Bitmap:=drawmenuicon(s1);
            pnba3.visible:=true;
            pnba3.Bitmap:=pnb3.Bitmap;
            end;
         end;
         4: begin
         pmembf4.caption:=s2;
         mb4.caption:=s2;
         mb4.visible:=true;
         mb4.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb4.caption:=s2;
         pmjb4.visible:=true;
         pmjb4.Bitmap:=mb4.Bitmap;
         pnb4.caption:=s1;
         pnba4.caption:=s1;
         if s1<>'' then
            begin
            pnb4.visible:=true;
            pnb4.Bitmap:=drawmenuicon(s1);
            pnba4.visible:=true;
            pnba4.Bitmap:=pnb4.Bitmap;
            end;
         end;
         5: begin
         pmembf5.caption:=s2;
         mb5.caption:=s2;
         mb5.visible:=true;
         mb5.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb5.caption:=s2;
         pmjb5.visible:=true;
         pmjb5.Bitmap:=mb5.Bitmap;
         pnb5.caption:=s1;
         pnba5.caption:=s1;
         if s1<>'' then
            begin
            pnb5.visible:=true;
            pnb5.Bitmap:=drawmenuicon(s1);
            pnba5.visible:=true;
            pnba5.Bitmap:=pnb5.Bitmap;
            end;
         end;
         6: begin
         pmembf6.caption:=s2;
         mb6.caption:=s2;
         mb6.visible:=true;
         mb6.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb6.caption:=s2;
         pmjb6.visible:=true;
         pmjb6.Bitmap:=mb6.Bitmap;
         pnb6.caption:=s1;
         pnba6.caption:=s1;
         if s1<>'' then
            begin
            pnb6.visible:=true;
            pnb6.Bitmap:=drawmenuicon(s1);
            pnba6.visible:=true;
            pnba6.Bitmap:=pnb6.Bitmap;
            end;
         end;
         7: begin
         pmembf7.caption:=s2;
         mb7.caption:=s2;
         mb7.visible:=true;
         mb7.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb7.caption:=s2;
         pmjb7.visible:=true;
         pmjb7.Bitmap:=mb7.Bitmap;
         pnb7.caption:=s1;
         pnba7.caption:=s1;
         if s1<>'' then
            begin
            pnb7.visible:=true;
            pnb7.Bitmap:=drawmenuicon(s1);
            pnba7.visible:=true;
            pnba7.Bitmap:=pnb7.Bitmap;
            end;
         end;
         8: begin
         pmembf8.caption:=s2;
         mb8.caption:=s2;
         mb8.visible:=true;
         mb8.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb8.caption:=s2;
         pmjb8.visible:=true;
         pmjb8.Bitmap:=mb8.Bitmap;
         pnb8.caption:=s1;
         pnba8.caption:=s1;
         if s1<>'' then
            begin
            pnb8.visible:=true;
            pnb8.Bitmap:=drawmenuicon(s1);
            pnba8.visible:=true;
            pnba8.Bitmap:=pnb8.Bitmap;
            end;
         end;
         9: begin
         mb9.caption:=s2;
         mb9.visible:=true;
         mb9.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb9.caption:=s2;
         pmjb9.visible:=true;
         pmjb9.Bitmap:=mb9.Bitmap;
         pnb9.caption:=s1;
         pnba9.caption:=s1;
         if s1<>'' then
            begin
            pnb9.visible:=true;
            pnb9.Bitmap:=drawmenuicon(s1);
            pnba9.visible:=true;
            pnba9.Bitmap:=pnb9.Bitmap;
            end;
         end;
         10: begin
         mb10.caption:=s2;
         mb10.visible:=true;
         mb10.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb10.caption:=s2;
         pmjb10.visible:=true;
         pmjb10.Bitmap:=mb10.Bitmap;
         pnb10.caption:=s1;
         pnba10.caption:=s1;
         if s1<>'' then
            begin
            pnb10.visible:=true;
            pnb10.Bitmap:=drawmenuicon(s1);
            pnba10.visible:=true;
            pnba10.Bitmap:=pnb10.Bitmap;
            end;
         end;
         11: begin
            mb11.caption:=s2;
            mb11.visible:=true;
            mb11.Bitmap:=drawmenuicon(s,sbrowse);
            pmjb11.caption:=s2;
            pmjb11.visible:=true;
            pmjb11.Bitmap:=mb11.Bitmap;
            pnb11.caption:=s1;
            pnba11.caption:=s1;
            if s1<>'' then
               begin
               pnb11.visible:=true;
               pnb11.Bitmap:=drawmenuicon(s1);
               pnba11.visible:=true;
               pnba11.Bitmap:=pnb11.Bitmap;
               end;
            end;
         12: begin
            mb12.caption:=s2;
            mb12.visible:=true;
            mb12.Bitmap:=drawmenuicon(s,sbrowse);
            pmjb12.caption:=s2;
            pmjb12.visible:=true;
            pmjb12.Bitmap:=mb12.Bitmap;
            pnb12.caption:=s1;
            pnba12.caption:=s1;
            if s1<>'' then
               begin
               pnb12.visible:=true;
               pnb12.Bitmap:=drawmenuicon(s1);
               pnba12.visible:=true;
               pnba12.Bitmap:=pnb12.Bitmap;
               end;
            end;
         13: begin
         mb13.caption:=s2;
         mb13.visible:=true;
         mb13.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb13.caption:=s2;
         pmjb13.visible:=true;
         pmjb13.Bitmap:=mb13.Bitmap;
         pnb13.caption:=s1;
         pnba13.caption:=s1;
         if s1<>'' then
            begin
            pnb13.visible:=true;
            pnb13.Bitmap:=drawmenuicon(s1);
            pnba13.visible:=true;
            pnba13.Bitmap:=pnb13.Bitmap;
            end;
         end;
         14: begin
         mb14.caption:=s2;
         mb14.visible:=true;
         mb14.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb14.caption:=s2;
         pmjb14.visible:=true;
         pmjb14.Bitmap:=mb14.Bitmap;
         pnb14.caption:=s1;
         pnba14.caption:=s1;
         if s1<>'' then
            begin
            pnb14.visible:=true;
            pnb14.Bitmap:=drawmenuicon(s1);
            pnba14.visible:=true;
            pnba14.Bitmap:=pnb14.Bitmap;
            end;
         end;
         15: begin
         mb15.caption:=s2;
         mb15.visible:=true;
         mb15.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb15.caption:=s2;
         pmjb15.visible:=true;
         pmjb15.Bitmap:=mb15.Bitmap;
         pnb15.caption:=s1;
         pnba15.caption:=s1;
         if s1<>'' then
            begin
            pnb15.visible:=true;
            pnb15.Bitmap:=drawmenuicon(s1);
            pnba15.visible:=true;
            pnba15.Bitmap:=pnb15.Bitmap;
            end;
         end;
         16: begin
         mb16.caption:=s2;
         mb16.visible:=true;
         mb16.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb16.caption:=s2;
         pmjb16.visible:=true;
         pmjb16.Bitmap:=mb16.Bitmap;
         pnb16.caption:=s1;
         pnba16.caption:=s1;
         if s1<>'' then
            begin
            pnb16.visible:=true;
            pnb16.Bitmap:=drawmenuicon(s1);
            pnba16.visible:=true;
            pnba16.Bitmap:=pnb16.Bitmap;
            end;
         end;
         17: begin
         mb17.caption:=s2;
         mb17.visible:=true;
         mb17.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb17.caption:=s2;
         pmjb17.visible:=true;
         pmjb17.Bitmap:=mb17.Bitmap;
         pnb17.caption:=s1;
         pnba17.caption:=s1;
         if s1<>'' then
            begin
            pnb17.visible:=true;
            pnb17.Bitmap:=drawmenuicon(s1);
            pnba17.visible:=true;
            pnba17.Bitmap:=pnb17.Bitmap;
            end;
         end;
         18: begin
         mb18.caption:=s2;
         mb18.visible:=true;
         mb18.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb18.caption:=s2;
         pmjb18.visible:=true;
         pmjb18.Bitmap:=mb18.Bitmap;
         pnb18.caption:=s1;
         pnba18.caption:=s1;
         if s1<>'' then
            begin
            pnb18.visible:=true;
            pnb18.Bitmap:=drawmenuicon(s1);
            pnba18.visible:=true;
            pnba18.Bitmap:=pnb18.Bitmap;
            end;
         end;
         19: begin
         mb19.caption:=s2;
         mb19.visible:=true;
         mb19.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb19.caption:=s2;
         pmjb19.visible:=true;
         pmjb19.Bitmap:=mb19.Bitmap;
         pnb19.caption:=s1;
         pnba19.caption:=s1;
         if s1<>'' then
            begin
            pnb19.visible:=true;
            pnb19.Bitmap:=drawmenuicon(s1);
            pnba19.visible:=true;
            pnba19.Bitmap:=pnb19.Bitmap;
            end;
         end;
         20: begin
         mb20.caption:=s2;
         mb20.visible:=true;
         mb20.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb20.caption:=s2;
         pmjb20.visible:=true;
         pmjb20.Bitmap:=mb20.Bitmap;
         pnb20.caption:=s1;
         pnba20.caption:=s1;
         if s1<>'' then
            begin
            pnb20.visible:=true;
            pnb20.Bitmap:=drawmenuicon(s1);
            pnba20.visible:=true;
            pnba20.Bitmap:=pnb20.Bitmap;
            end;
         end;
         21: begin
            mb21.caption:=s2;
            mb21.visible:=true;
            mb21.Bitmap:=drawmenuicon(s,sbrowse);
            pmjb21.caption:=s2;
            pmjb21.visible:=true;
            pmjb21.Bitmap:=mb21.Bitmap;
            pnb21.caption:=s1;
            pnba21.caption:=s1;
            if s1<>'' then
               begin
               pnb21.visible:=true;
               pnb21.Bitmap:=drawmenuicon(s1);
               pnba21.visible:=true;
               pnba21.Bitmap:=pnb21.Bitmap;
               end;
            end;
         22: begin
            mb22.caption:=s2;
            mb22.visible:=true;
            mb22.Bitmap:=drawmenuicon(s,sbrowse);
            pmjb22.caption:=s2;
            pmjb22.visible:=true;
            pmjb22.Bitmap:=mb22.Bitmap;
            pnb22.caption:=s1;
            pnba22.caption:=s1;
            if s1<>'' then
               begin
               pnb22.visible:=true;
               pnb22.Bitmap:=drawmenuicon(s1);
               pnba22.visible:=true;
               pnba22.Bitmap:=pnb22.Bitmap;
               end;
            end;
         23: begin
         mb23.caption:=s2;
         mb23.visible:=true;
         mb23.Bitmap:=drawmenuicon(s,sbrowse);
         pmjb23.caption:=s2;
         pmjb23.visible:=true;
         pmjb23.Bitmap:=mb23.Bitmap;
         pnb23.caption:=s1;
         pnba23.caption:=s1;
         if s1<>'' then
            begin
            pnb23.visible:=true;
            pnb23.Bitmap:=drawmenuicon(s1);
            pnba23.visible:=true;
            pnba23.Bitmap:=pnb23.Bitmap;
            end;
         end;
         end;
      end;
pmemb1.caption:=pnb1.caption;
pmemb2.caption:=pnb2.caption;
pmemb3.caption:=pnb3.caption;
pmemb4.caption:=pnb4.caption;
pmemb5.caption:=pnb5.caption;
pmemb6.caption:=pnb6.caption;
pmemb7.caption:=pnb7.caption;
pmemb8.caption:=pnb8.caption;
pmemb1.visible:=pnb1.visible;
pmemb2.visible:=pnb2.visible;
pmemb3.visible:=pnb3.visible;
pmemb4.visible:=pnb4.visible;
pmemb5.visible:=pnb5.visible;
pmemb6.visible:=pnb6.visible;
pmemb7.visible:=pnb7.visible;
pmemb8.visible:=pnb8.visible;
pmemb1.Bitmap:=pnb1.Bitmap;
pmemb2.Bitmap:=pnb2.Bitmap;
pmemb3.Bitmap:=pnb3.Bitmap;
pmemb4.Bitmap:=pnb4.Bitmap;
pmemb5.Bitmap:=pnb5.Bitmap;
pmemb6.Bitmap:=pnb6.Bitmap;
pmemb7.Bitmap:=pnb7.Bitmap;
pmemb8.Bitmap:=pnb8.Bitmap;
pmembf1.visible:=pmjb1.visible;
pmembf2.visible:=pmjb2.visible;
pmembf3.visible:=pmjb3.visible;
pmembf4.visible:=pmjb4.visible;
pmembf5.visible:=pmjb5.visible;
pmembf6.visible:=pmjb6.visible;
pmembf7.visible:=pmjb7.visible;
pmembf8.visible:=pmjb8.visible;
if pmembf1.caption=txt_mypc then pmembf1.visible:=false;
if pmembf2.caption=txt_mypc then pmembf2.visible:=false;
if pmembf3.caption=txt_mypc then pmembf3.visible:=false;
if pmembf4.caption=txt_mypc then pmembf4.visible:=false;
if pmembf5.caption=txt_mypc then pmembf5.visible:=false;
if pmembf6.caption=txt_mypc then pmembf6.visible:=false;
if pmembf7.caption=txt_mypc then pmembf7.visible:=false;
if pmembf8.caption=txt_mypc then pmembf8.visible:=false;
pmembf1.Bitmap:=pmjb1.Bitmap;
pmembf2.Bitmap:=pmjb2.Bitmap;
pmembf3.Bitmap:=pmjb3.Bitmap;
pmembf4.Bitmap:=pmjb4.Bitmap;
pmembf5.Bitmap:=pmjb5.Bitmap;
pmembf6.Bitmap:=pmjb6.Bitmap;
pmembf7.Bitmap:=pmjb7.Bitmap;
pmembf8.Bitmap:=pmjb8.Bitmap;
mexttob1.caption:=pnb1.caption;
mexttob2.caption:=pnb2.caption;
mexttob3.caption:=pnb3.caption;
mexttob4.caption:=pnb4.caption;
mexttob5.caption:=pnb5.caption;
mexttob6.caption:=pnb6.caption;
mexttob7.caption:=pnb7.caption;
mexttob8.caption:=pnb8.caption;
mexttob9.caption:=pnb9.caption;
mexttob10.caption:=pnb10.caption;
mexttob11.caption:=pnb11.caption;
mexttob12.caption:=pnb12.caption;
mexttob13.caption:=pnb13.caption;
mexttob14.caption:=pnb14.caption;
mexttob15.caption:=pnb15.caption;
mexttob16.caption:=pnb16.caption;
mexttob17.caption:=pnb17.caption;
mexttob18.caption:=pnb18.caption;
mexttob19.caption:=pnb19.caption;
mexttob20.caption:=pnb20.caption;
mexttob21.caption:=pnb21.caption;
mexttob22.caption:=pnb22.caption;
mexttob23.caption:=pnb23.caption;
mexttob1.visible:=pnb1.visible;
mexttob2.visible:=pnb2.visible;
mexttob3.visible:=pnb3.visible;
mexttob4.visible:=pnb4.visible;
mexttob5.visible:=pnb5.visible;
mexttob6.visible:=pnb6.visible;
mexttob7.visible:=pnb7.visible;
mexttob8.visible:=pnb8.visible;
mexttob9.visible:=pnb9.visible;
mexttob10.visible:=pnb10.visible;
mexttob11.visible:=pnb11.visible;
mexttob12.visible:=pnb12.visible;
mexttob13.visible:=pnb13.visible;
mexttob14.visible:=pnb14.visible;
mexttob15.visible:=pnb15.visible;
mexttob16.visible:=pnb16.visible;
mexttob17.visible:=pnb17.visible;
mexttob18.visible:=pnb18.visible;
mexttob19.visible:=pnb19.visible;
mexttob20.visible:=pnb20.visible;
mexttob21.visible:=pnb21.visible;
mexttob22.visible:=pnb22.visible;
mexttob23.visible:=pnb23.visible;
mexttob1.Bitmap:=pnb1.Bitmap;
mexttob2.Bitmap:=pnb2.Bitmap;
mexttob3.Bitmap:=pnb3.Bitmap;
mexttob4.Bitmap:=pnb4.Bitmap;
mexttob5.Bitmap:=pnb5.Bitmap;
mexttob6.Bitmap:=pnb6.Bitmap;
mexttob7.Bitmap:=pnb7.Bitmap;
mexttob8.Bitmap:=pnb8.Bitmap;
mexttob9.Bitmap:=pnb9.Bitmap;
mexttob10.Bitmap:=pnb10.Bitmap;
mexttob11.Bitmap:=pnb11.Bitmap;
mexttob12.Bitmap:=pnb12.Bitmap;
mexttob13.Bitmap:=pnb13.Bitmap;
mexttob14.Bitmap:=pnb14.Bitmap;
mexttob15.Bitmap:=pnb15.Bitmap;
mexttob16.Bitmap:=pnb16.Bitmap;
mexttob17.Bitmap:=pnb17.Bitmap;
mexttob18.Bitmap:=pnb18.Bitmap;
mexttob19.Bitmap:=pnb19.Bitmap;
mexttob20.Bitmap:=pnb20.Bitmap;
mexttob21.Bitmap:=pnb21.Bitmap;
mexttob22.Bitmap:=pnb22.Bitmap;
mexttob23.Bitmap:=pnb23.Bitmap;

CopyMenuItems(mBookmarks,pmnavbooks.Items,0);
end;
populatetree;
end;

function check_duplicated_bookmark(s,s1,s2,s3:ansistring):integer;
var
   i:integer;
begin
check_duplicated_bookmark:=-1;
for i:=1 to FormPeach.StringGridBookmarks.RowCount-1 do
   if (FormPeach.StringGridBookmarks.Cells[2,i]=s)
   and (FormPeach.StringGridBookmarks.Cells[1,i]=s1)
   and (FormPeach.StringGridBookmarks.Cells[4,i]=s2)
   and (FormPeach.StringGridBookmarks.Cells[5,i]=s3) then
      begin
      check_duplicated_bookmark:=-1;
      exit;
      end;
check_duplicated_bookmark:=0;
end;

procedure addtobookmarks(s:ansistring);
var
   i,rc:integer;
   s1,s2,s3:ansistring;
begin
s1:=txt_list_browsing;
s2:='*';
s3:='';
case s of
   '*browser':
   begin
   if fun='FILEBROWSER' then
      s:='*current' //s:=FormPeach.EditOpenIn.Text //ignore selection
   else
      s:='*current';
   end;
   '*browsercontext':
   begin
   if fun='FILEBROWSER' then
      if checklistsel<>0 then s:='*current' //s:=FormPeach.EditOpenIn.Text
      else s:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]
   else
      s:='*current';
   end;
   '*layout':
   begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.Top=0{$ENDIF} then s:=FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row]
   else s:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row];
   end;
   '*history':
   begin
   s:=FormPeach.StringGridSessionHistory.Cells[2,FormPeach.StringGridSessionHistory.Row];
   s1:=FormPeach.StringGridSessionHistory.Cells[1,FormPeach.StringGridSessionHistory.Row];
   s2:=FormPeach.StringGridSessionHistory.Cells[3,FormPeach.StringGridSessionHistory.Row];
   s3:=FormPeach.StringGridSessionHistory.Cells[4,FormPeach.StringGridSessionHistory.Row];
   end;
   '*recent':
   begin
   s:=FormPeach.StringGridrecent.Cells[1,FormPeach.StringGridrecent.Row];
   s1:=txt_list_browsing;
   s2:='*';
   s3:='';
   end;
   end;

if s='*current' then
   begin
   rc:=FormPeach.StringGridSessionHistory.Rowcount-1;
   s:=FormPeach.StringGridSessionHistory.Cells[2,rc];
   s1:=FormPeach.StringGridSessionHistory.Cells[1,rc];
   s2:=FormPeach.StringGridSessionHistory.Cells[3,rc];
   s3:=FormPeach.StringGridSessionHistory.Cells[4,rc];
   end;

if s<>txt_mypc then
   if filegetattr(s) and faDirectory <>0 then
      if s<>'' then
         if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
if check_duplicated_bookmark(s,s1,s2,s3)=0 then
   begin
   rc:=FormPeach.StringGridBookmarks.Rowcount+1;
   FormPeach.StringGridBookmarks.RowCount:=rc;
   FormPeach.StringGridBookmarks.Cells[2,rc-1]:=s;
   FormPeach.StringGridBookmarks.Cells[1,rc-1]:=s1;
   FormPeach.StringGridBookmarks.Cells[3,rc-1]:=extractbookmarkname(s);
   FormPeach.StringGridBookmarks.Cells[4,rc-1]:=s2;
   FormPeach.StringGridBookmarks.Cells[5,rc-1]:=s3;
   if savehistory=1 then
      FormPeach.StringGridBookmarks.Cells[9,rc-1]:=FormatDateTime('yyyy-mm-dd hh:mm:ss',now)
   else
      FormPeach.StringGridBookmarks.Cells[9,rc-1]:='';
   FormPeach.StringGridBookmarks.AutosizeColumns;
   FormPeach.StringGridBookmarks.ColWidths[10]:=0;
   FormPeach.StringGridBookmarks.ColWidths[11]:=0;
   FormPeach.StringGridBookmarks.ColWidths[0]:=rowsize;
   for i:=1 to FormPeach.StringGridBookmarks.RowCount-2 do FormPeach.StringGridBookmarks.Cells[11,i]:='0';
   FormPeach.StringGridBookmarks.Cells[11,FormPeach.StringGridBookmarks.RowCount-1]:='1';
   end;
populatebookmarks;
end;

procedure set_group_fm(cond:boolean);
begin
with FormPeach do
begin
po_newfolder.visible:=cond;
MenuItem26.visible:=cond;
po_renmenu.visible:=cond;
po_rename.visible:=cond;
pmr_ren.visible:=cond;
po_rename_lowercase.visible:=cond;
po_rename_uppercase.visible:=cond;
po_rename_timestamp.visible:=cond;
po_rename_appenddir.visible:=cond;
po_rename_prependdir.visible:=cond;
Po_rename_123.visible:=cond;
po_rename_add.visible:=cond;
po_rename_delete.visible:=cond;
po_rename_replace.visible:=cond;
po_rename_replace_case.visible:=cond;
po_rename_ext.visible:=cond;
po_rename_cutlen.visible:=cond;
po_rename_ascii.visible:=cond;
po_rename_separator.visible:=cond;
MenuItem119.visible:=cond;
separator2.visible:=cond;
Separator3.visible:=cond;
po_rename_filesonly.visible:=cond;
pmr_files.visible:=cond;
MenuItem7.visible:=cond;
MenuItem56.visible:=cond;
if fun='UN7Z' then
   begin
   po_newfolder.visible:=true;
   MenuItem26.visible:=true;
   po_renmenu.visible:=true;
   MenuItem7.visible:=true;
   po_rename.visible:=true;
   pmr_ren.visible:=true;
   po_rename_lowercase.visible:=true;
   po_rename_uppercase.visible:=true;
   po_rename_timestamp.visible:=true;
   po_rename_appenddir.visible:=true;
   po_rename_prependdir.visible:=true;
   Po_rename_123.visible:=true;
   po_rename_add.visible:=true;
   po_rename_delete.visible:=true;
   po_rename_replace.visible:=true;
   po_rename_replace_case.visible:=true;
   po_rename_ext.visible:=true;
   po_rename_cutlen.visible:=true;
   po_rename_ascii.visible:=true;
   po_rename_separator.visible:=true;
   MenuItem119.visible:=true;
   po_rename_filesonly.visible:=true;
   separator2.visible:=true;
   Separator3.visible:=true;
   pmr_files.visible:=true;
   MenuItem56.visible:=true;
   end;
{$IFDEF MSWINDOWS}FormPeach.po_recycle.Visible:=cond;{$ENDIF}
{$IFDEF DARWIN}FormPeach.po_recycle.Visible:=cond;{$ENDIF}
separator37.visible:=cond;
po_delete.Visible:=cond;
po_securedelete.Visible:=cond;
po_zerofile.Visible:=cond;
po_zerofree.Visible:=cond;
po_securedeletefree.Visible:=cond;
MenuItem16.visible:=cond;
po_copyto.visible:=cond;
po_moveto.visible:=cond;
if fun='UN7Z' then po_moveto.visible:=true;
po_copy.visible:=cond;
po_cut.visible:=cond;
po_paste.visible:=cond;
//MenuItem67.visible:=cond;
end;
end;

procedure filebrowsermenus;
begin
with FormPeach do
begin
po_open.visible:=true;
po_windowopen.visible:=true;
po_exthere.visible:=true;
po_addsep.visible:=true;
po_split.visible:=true;
po_join.visible:=true;
if EditOpenIn.Text=txt_mypc then
   begin
   po_filetools.visible:=false;
   po_split.Visible:=false;
   po_join.Visible:=false;
   po_list.visible:=true;
   set_group_fm(false);
   end
else
   begin
   //po_open_asarchive.visible:=true;
   //po_open_asarchivet.visible:=true;
   //Menuitem77.visible:=true;
   po_test.visible:=true;
   po_info.visible:=true;
   po_list.visible:=true;
   po_filetools.visible:=true;
   po_split.Visible:=true;
   po_join.Visible:=true;
   MenuItem145.Visible:=true;
   po_more.Visible:=true;
   po_pdup.Visible:=true;
   po_checksum.Visible:=true;
   po_dedup.Visible:=true;
   po_analyzefolders.Visible:=true;
   pmfilebrowser.Visible:=true;
   pmpanalyzefolders.Visible:=true;
   pmpdup.Visible:=true;
   pmcheck.Visible:=true;
   pmbatchtest.Visible:=true;
   Separator17.visible:=true;
   po_im.visible:=true;
   MenuItemForceThumbnails.visible:=true;
   set_group_fm(true);
   end;
MenuItemOpen_ExtractHere.Visible:=false;
pmmorefun_details.Enabled:=true;
pmmorefun_list.Enabled:=true;
pmmorefun_info.Enabled:=true;
pmmorerr.Visible:=false;
if (havewinrar=true) and (userar=1) then pmmorerecover.Visible:=true;
po_rr.Visible:=false;
if (havewinrar=true) and (userar=1) then po_recover.Visible:=true;
end;
end;

procedure advancedarchivebrowsermenus;
begin
with FormPeach do
begin
MenuItemOpen_ExtractHere.Visible:=true;
MenuItemOpen_test.Visible:=true;
MenuItemOpen_list.Visible:=true;
MenuItemOpen_preview.visible:=true;
po_filetools.visible:=true;
po_split.Visible:=false;
po_join.Visible:=false;
MenuItemViewImage.visible:=true;
po_windowopen.visible:=true;
if enableextand=1 then MenuItemOpen_extandopenwith.visible:=true
else MenuItemOpen_extandopenwith.visible:=false;
MenuItem120.Visible:=true;
mForceSyncedits.Visible:=true;
mForceSynceditsClear.Visible:=true;
mForceClear.Visible:=true;
pmmorefun_details.Enabled:=true;
pmmorefun_list.Enabled:=true;
pmmorefun_info.Enabled:=true;
pmmorerr.Visible:=false;
pmmorerecover.Visible:=false;
po_rr.Visible:=false;
po_recover.Visible:=false;
end;
end;

procedure set_extcontext_off;
begin
FormPeach.pmextcontextdisplayed.enabled:=false;
FormPeach.pmextcontextselected.enabled:=false;
FormPeach.pmqedisplayed.enabled:=false;
FormPeach.pmqeselected.enabled:=false;
FormPeach.pmtestcontextdisplayed.enabled:=false;
FormPeach.pmtestcontextselected.enabled:=false;
end;

procedure set_extcontext_on;
begin
FormPeach.pmextcontextdisplayed.enabled:=true;
FormPeach.pmextcontextselected.enabled:=true;
FormPeach.pmqedisplayed.enabled:=true;
FormPeach.pmqeselected.enabled:=true;
FormPeach.pmtestcontextdisplayed.enabled:=true;
FormPeach.pmtestcontextselected.enabled:=true;
end;

procedure setbuttonmenus;
begin
with FormPeach do
begin
ButtonUn7zaTo.Enabled:=true;
set_extcontext_off;
ButtonUn7zaTest.Enabled:=false;
ButtonDelete.Enabled:=false;
ButtonUn7zaAdd.Enabled:=false;
ButtonUn7zaAdd.Hint:='';
po_addtoarchive.Enabled:=false;
po_exthere.visible:=false;
po_addsep.visible:=false;
po_test.visible:=false;
po_info.visible:=false;
po_list.visible:=false;
po_open.visible:=false;
po_windowopen.visible:=false;
//po_open_asarchive.visible:=false;
//po_open_asarchivet.visible:=false;
//Menuitem77.visible:=false;
set_group_fm(false);
MenuItem145.Visible:=false;
po_more.Visible:=false;
po_pdup.Visible:=false;
po_checksum.Visible:=false;
po_dedup.Visible:=false;
po_analyzefolders.Visible:=false;
pmfilebrowser.Visible:=false;
pmpanalyzefolders.Visible:=false;
pmpdup.Visible:=false;
pmcheck.Visible:=false;
pmbatchtest.Visible:=false;
Separator17.visible:=false;
po_im.visible:=false;
MenuItemForceThumbnails.visible:=false;
MenuItemOpen_preview.visible:=false;
po_filetools.visible:=false;
po_split.Visible:=false;
po_join.Visible:=false;
MenuItemViewImage.visible:=false;
MenuItemOpen_test.Visible:=false;
MenuItemOpen_info.Visible:=false;
MenuItemOpen_list.Visible:=false;
MenuItem120.Visible:=false;
mForceSyncedits.Visible:=false;
mForceSynceditsClear.Visible:=false;
mForceClear.Visible:=false;
MenuItemOpen_extandopenwith.visible:=false;
pmmorefun_details.Enabled:=false;
pmmorefun_list.Enabled:=false;
pmmorefun_info.Enabled:=false;
case fun of
   'FILEBROWSER':
   begin
   ButtonUn7zaTest.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonDelete.Enabled:=true;
   ButtonUn7zaAdd.Enabled:=true;
   ButtonUn7zaAdd.Hint:=txt_add_tolayout;
   filebrowsermenus;
   MenuItemViewImage.visible:=true;
   end;
   'UN7Z':
   begin
   ButtonUn7zaTest.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonDelete.Enabled:=true;
   ButtonUn7zaAdd.Enabled:=true;
   ButtonUn7zaAdd.Hint:=txt_add_toarchive;
   advancedarchivebrowsermenus;
   MenuItemOpen_info.Visible:=true;
   end;
   'UNARC':
   begin
   ButtonUn7zaTest.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonDelete.Enabled:=true;
   ButtonUn7zaAdd.Enabled:=true;
   ButtonUn7zaAdd.Hint:=txt_add_toarchive;
   advancedarchivebrowsermenus;
   mForceSyncedits.Visible:=false;
   mForceSynceditsClear.Visible:=false;
   mForceClear.Visible:=false;
   MenuItem120.Visible:=false;
   end;
   'UNZPAQ':
   begin
   ButtonUn7zaTest.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonUn7zaAdd.Enabled:=true;
   ButtonUn7zaAdd.Hint:=txt_add_toarchive;
   MenuItemOpen_preview.visible:=true;
   po_filetools.visible:=true;
   po_split.Visible:=false;
   po_join.Visible:=false;
   MenuItemViewImage.visible:=true;
   end;
   'UNBROTLI':
   begin
   ButtonUn7zaTest.Enabled:=true;
   MenuItemOpen_preview.visible:=true;
   po_filetools.visible:=true;
   po_split.Visible:=false;
   po_join.Visible:=false;
   MenuItemViewImage.visible:=true;
   end;
   'UNZSTD':
   begin
   ButtonUn7zaTest.Enabled:=true;
   MenuItemOpen_preview.visible:=true;
   po_filetools.visible:=true;
   po_split.Visible:=false;
   po_join.Visible:=false;
   MenuItemViewImage.visible:=true;
   end;
   'UNQUAD':
   begin
   MenuItemOpen_preview.visible:=true;
   po_filetools.visible:=true;
   po_split.Visible:=false;
   po_join.Visible:=false;
   MenuItemViewImage.visible:=true;
   end;
   end;
ImageFlatadd.Enabled:=ButtonUn7zaAdd.Enabled;
ImageFlatconvert.Enabled:=ButtonUn7zaConvert.Enabled;
ImageFlatext.Enabled:=ButtonUn7zaTo.Enabled;
end;
end;

procedure prepare_filebrowser;
begin
setpanel_extract(1);
set_extcontext_off;
{$IFDEF MSWINDOWS}FormPeach.po_delete.Caption:=txt_quickdelete+' (Shift+Del)';{$ELSE}FormPeach.po_delete.Caption:=txt_quickdelete;{$ENDIF}
end;

procedure set_organizebrowsermenu_sort(c:integer);
begin
FormPeach.mbrowsercname.Checked:=false;
FormPeach.mbrowserctype.Checked:=false;
FormPeach.mbrowsercsize.Checked:=false;
FormPeach.mbrowsercpacked.Checked:=false;
FormPeach.mbrowsercdate.Checked:=false;
FormPeach.mbrowserccreated.Checked:=false;
FormPeach.mbrowsercaccessed.Checked:=false;
FormPeach.mbrowsercmethod.Checked:=false;
FormPeach.mbrowserccomment.Checked:=false;
FormPeach.mbrowsercatt.Checked:=false;
FormPeach.mbrowserccrc.Checked:=false;
FormPeach.mbrowsercname.Caption:=FormPeach.ListViewBrowser.Column[0].Caption;
FormPeach.mbrowserctype.Caption:=FormPeach.ListViewBrowser.Column[1].Caption;
FormPeach.mbrowsercsize.Caption:=FormPeach.ListViewBrowser.Column[2].Caption;
FormPeach.mbrowsercpacked.Caption:=txt_info+' / '+txt_compressed_size;//FormPeach.ListViewBrowser.Column[3].Caption;
FormPeach.mbrowsercdate.Caption:=FormPeach.ListViewBrowser.Column[4].Caption;
FormPeach.mbrowserccreated.Caption:=FormPeach.ListViewBrowser.Column[5].Caption;
FormPeach.mbrowsercaccessed.Caption:=FormPeach.ListViewBrowser.Column[6].Caption;
FormPeach.mbrowsercmethod.Caption:=FormPeach.ListViewBrowser.Column[7].Caption;
FormPeach.mbrowserccomment.Caption:=FormPeach.ListViewBrowser.Column[8].Caption;
FormPeach.mbrowsercatt.Caption:=FormPeach.ListViewBrowser.Column[9].Caption;
FormPeach.mbrowserccrc.Caption:=FormPeach.ListViewBrowser.Column[10].Caption;
case c of
   0: begin FormPeach.mbrowsercname.Checked:=true; end;
   1: begin FormPeach.mbrowserctype.Checked:=true; end;
   2: begin FormPeach.mbrowsercsize.Checked:=true; end;
   3: begin FormPeach.mbrowsercpacked.Checked:=true; end;
   4: begin FormPeach.mbrowsercdate.Checked:=true; end;
   5: begin FormPeach.mbrowserccreated.Checked:=true; end;
   6: begin FormPeach.mbrowsercaccessed.Checked:=true; end;
   7: begin FormPeach.mbrowsercmethod.Checked:=true; end;
   8: begin FormPeach.mbrowserccomment.Checked:=true; end;
   9: begin FormPeach.mbrowsercatt.Checked:=true; end;
   10: begin FormPeach.mbrowserccrc.Checked:=true; end;
   end;
FormPeach.po_browsercname.Checked:=FormPeach.mbrowsercname.Checked;
FormPeach.po_browserctype.Checked:=FormPeach.mbrowserctype.Checked;
FormPeach.po_browsercsize.Checked:=FormPeach.mbrowsercsize.Checked;
FormPeach.po_browsercpacked.Checked:=FormPeach.mbrowsercpacked.Checked;
FormPeach.po_browsercdate.Checked:=FormPeach.mbrowsercdate.Checked;
FormPeach.po_browserccreated.Checked:=FormPeach.mbrowserccreated.Checked;
FormPeach.po_browsercaccessed.Checked:=FormPeach.mbrowsercaccessed.Checked;
FormPeach.po_browsercmethod.Checked:=FormPeach.mbrowsercmethod.Checked;
FormPeach.po_browserccomment.Checked:=FormPeach.mbrowserccomment.Checked;
FormPeach.po_browsercatt.Checked:=FormPeach.mbrowsercatt.Checked;
FormPeach.po_browserccrc.Checked:=FormPeach.mbrowserccrc.Checked;
FormPeach.po_browsercname.Caption:=FormPeach.mbrowsercname.Caption;
FormPeach.po_browserctype.Caption:=FormPeach.mbrowserctype.Caption;
FormPeach.po_browsercsize.Caption:=FormPeach.mbrowsercsize.Caption;
FormPeach.po_browsercpacked.Caption:=FormPeach.mbrowsercpacked.Caption;
FormPeach.pmcpacked.Caption:=FormPeach.mbrowsercpacked.Caption;
FormPeach.mcpacked.Caption:=FormPeach.mbrowsercpacked.Caption;
FormPeach.po_browsercdate.Caption:=FormPeach.mbrowsercdate.Caption;
FormPeach.po_browserccreated.Caption:=FormPeach.mbrowserccreated.Caption;
FormPeach.po_browsercaccessed.Caption:=FormPeach.mbrowsercaccessed.Caption;
FormPeach.po_browsercmethod.Caption:=FormPeach.mbrowsercmethod.Caption;
FormPeach.po_browserccomment.Caption:=FormPeach.mbrowserccomment.Caption;
FormPeach.po_browsercatt.Caption:=FormPeach.mbrowsercatt.Caption;
FormPeach.po_browserccrc.Caption:=FormPeach.mbrowserccrc.Caption;
end;

procedure settoolbarw;
begin
with FormPeach do
begin
case lasttoolbar of
1: PanelBarOpen1.Width:=ButtonUn7zaAdd.Width+ButtonUn7zaTo.Width+
ButtonUn7zaTest.Width+ButtonPropertiesActions.Width+ButtonUn7zaConvert.Width+ButtonExtractActions.Width+
ButtonConvertActions.Width+ButtonAddActions.Width+ButtonTestActions.Width+ButtonDelete.Width+8;
2: PanelBarOpen2.Width:=ButtonCopy.Width+ButtonCut.Width+ButtonPaste.Width+
Buttoncmto.Width+ButtonOpenWith.Width+Buttonopenactions.Width+ButtonRename.Width+
Buttonfmactions.Width+Buttonfmactions1.Width+ButtonDup.Width+ButtonNF.Width+8;
3: PanelBarOpen3.Width:=ButtonDup1.Width+ButtonImgResize.Width+ButtonImgCrop.Width+
ButtonImgRL.Width+ButtonImgRR.Width+(ButtonImg6.Width*3)+ButtonRename1.Width+8;
end;
if toolcentered=1 then
   begin
   PanelBarOpen1.AnchorSideLeft.Side:=asrCenter;
   PanelBarOpen2.AnchorSideLeft.Side:=asrCenter;
   PanelBarOpen3.AnchorSideLeft.Side:=asrCenter;
   end
else
   begin
   PanelBarOpen1.AnchorSideLeft.Side:=asrLeft;
   PanelBarOpen2.AnchorSideLeft.Side:=asrLeft;
   PanelBarOpen3.AnchorSideLeft.Side:=asrLeft;
   end;
end;
end;

procedure settoolbardisp;
begin
with FormPeach do
begin
{$IFNDEF MSWINDOWS}
ButtonProperties.Visible:=false;
MenuItemProperties.Visible:=false;
mProperties.Visible:=false;
pmProperties.Visible:=false;
{$ENDIF}
if lasttoolbar=1 then
   begin
   if fun='FILEBROWSER' then ButtonDelete.Caption:=txt_securedelete
   else ButtonDelete.Caption:=txt_2_5_delete_fromarchive;
   end;
//if lasttoolbar=2 then //always evaluated in order to set also availability of alternative context menus (open with, and rename)
   if fun<>'FILEBROWSER' then
      begin
      ButtonCut.Enabled:=false;
      ButtonCopy.Enabled:=false;
      ButtonPaste.Enabled:=false;
      Buttoncmto.Enabled:=false;
      ButtonNF.Enabled:=false;
      ButtonDup.Enabled:=false;
      ButtonRename.Enabled:=false;
      Buttonfmactions1.Enabled:=false;
      ButtonOpenWith.Caption:=txt_previewwith;
      ButtonOpenWith.Enabled:=false;
      Buttonopenactions.Enabled:=false;
      if fun='UN7Z' then
         begin
         ButtonRename.Enabled:=true;
         Buttonfmactions1.Enabled:=true;
         ButtonNF.Enabled:=true;
         end;
      if (fun='UN7Z') or (fun='UNARC') then
         begin
         ButtonOpenWith.Enabled:=true;
         Buttonopenactions.Enabled:=true;
         end;
      end
   else
      begin
      ButtonCut.Enabled:=true;
      ButtonCopy.Enabled:=true;
      ButtonPaste.Enabled:=true;
      Buttoncmto.Enabled:=true;
      ButtonNF.Enabled:=true;
      ButtonDup.Enabled:=true;
      ButtonRename.Enabled:=true;
      Buttonfmactions1.Enabled:=true;
      ButtonOpenWith.Caption:=txt_openwith;
      ButtonOpenWith.Enabled:=true;
      Buttonopenactions.Enabled:=true;
      end;
if lasttoolbar=3 then
   if fun<>'FILEBROWSER' then
      begin
      ButtonDup1.enabled:=false;
      ButtonRename1.Enabled:=false;
      ButtonImgResize.enabled:=false;
      ButtonImgCrop.enabled:=false;
      ButtonImgR.enabled:=false;
      ButtonImgRes.enabled:=false;
      ButtonImgRL.enabled:=false;
      ButtonImgRR.enabled:=false;
      if fun='UN7Z' then
         begin
         ButtonRename1.Enabled:=true;
         end;
      end
   else
      begin
      ButtonDup1.enabled:=true;
      ButtonRename1.Enabled:=true;
      ButtonImgResize.enabled:=true;
      ButtonImgCrop.enabled:=true;
      ButtonImgR.enabled:=true;
      ButtonImgRes.enabled:=true;
      ButtonImgRL.enabled:=true;
      ButtonImgRR.enabled:=true;
      end;
if lasttoolbar=2 then ImageFlatdup.Enabled:=ButtonDup.Enabled else ImageFlatdup.Enabled:=ButtonDup1.Enabled;
ImageFlatfolder.Enabled:=ButtonNF.Enabled;
ImageFlatren.Enabled:=ButtonRename.Enabled;
ImageFlattransform.Enabled:=ButtonImgRes.Enabled;
ImageFlatcrop.Enabled:=ButtonImgCrop.Enabled;
end;
end;

procedure addmenuenable(enmode:integer);
begin
case enmode of
0: begin FormPeach.ButtonConvertActions.enabled:=false; FormPeach.ButtonAddActions.enabled:=false; end;
1: begin FormPeach.ButtonConvertActions.enabled:=true; FormPeach.ButtonAddActions.enabled:=true; end;
end;
end;

procedure showbar(s:ansistring);
begin
prevbar:=lastbar;
with FormPeach do
   begin
   MenuItemOrganizeStatusbar.Checked:=true;
   mshowstatusbar.Checked:=true;
   pmmstatus_status.Checked:=false;
   pmmstatus_bookmarks.Checked:=false;
   pmmstatus_ra.Checked:=false;
   pmmstatus_r.Checked:=false;
   pmmstatus_clipboard.Checked:=false;
   pmstatusnone.Checked:=false;
   SplitterBottom.Enabled:=true;
   SplitterBottom.Color:=stringtocolor(colbtnhigh);
   pmclip.Checked:=false;
   po_clip.Checked:=false;
   case s of
      'none' :
      begin
      MenuItemOrganizeStatusbar.Checked:=false;
      mshowstatusbar.Checked:=false;
      SplitterBottom.top:=PanelFilters.Height;
      lastbar:=1;
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      PanelClipboard.visible:=false;
      pmstatusnone.Checked:=true;
      end;
      'statusbar' :
      begin
      SplitterBottom.top:=PanelFilters.Height-PanelBottom.Height;
      SplitterBottom.Color:=FormPeach.color;
      SplitterBottom.Enabled:=false;
      lastbar:=0;
      PanelBottom.visible:=true;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      PanelClipboard.visible:=false;
      pmmstatus_status.Checked:=true;
      end;
      'bookmarks' :
      begin
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=true;
      PanelClipboard.visible:=false;
      lastbar:=2;
      SplitterBottom.top:=PanelFilters.Height-splittersize;
      pmmstatus_bookmarks.Checked:=true;
      LabelInfoGeneral.Caption:=txt_bookmarks;
      end;
      'recent' :
      begin
      PanelBottom.visible:=false;
      stringgridrecent.visible:=true;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      PanelClipboard.visible:=false;
      lastbar:=3;
      SplitterBottom.top:=PanelFilters.Height-splittersize;
      pmmstatus_ra.Checked:=true;
      LabelInfoGeneral.Caption:=txt_list_history;
      end;
      'sessionrecent' :
      begin
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=true;
      stringgridbookmarks.visible:=false;
      PanelClipboard.visible:=false;
      lastbar:=4;
      SplitterBottom.top:=PanelFilters.Height-splittersize;
      pmmstatus_r.Checked:=true;
      LabelInfoGeneral.Caption:=txt_5_0_sh;
      end;
      'clip' :
      begin
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      PanelClipboard.visible:=true;
      FormPeach.StringGridClipboard.Autosizecolumns;
      lastbar:=5;
      SplitterBottom.top:=PanelFilters.Height-splittersize;
      pmmstatus_clipboard.Checked:=true;
      LabelInfoGeneral.Caption:=txt_2_7_clipboard;
      pmclip.Checked:=true;
      po_clip.Checked:=true;
      end;
   end;
   end;
end;

procedure showpanel_prepare; //make invisible all panels
begin
with FormPeach do
   begin
   try
   shint:='';
   prevshint:='';
   h.hide;
   except
   end;
   {$IFDEF MSWINDOWS}
   PanelArchive.Visible:=false;
   PanelOpen.Visible:=false;
   PanelExtract.Visible:=false;
   PanelOptions.Visible:=false;
   {$ELSE}//sometimes panels remains visible, so hide them otherwise
   PanelArchive.Top:=10000;
   PanelOpen.Top:=10000;
   PanelExtract.Top:=10000;
   PanelOptions.Top:=10000;
   {$ENDIF}
   {mEdit.Visible:=false;
   mBrowse.Visible:=false;
   mOrganize.Visible:=false;
   mLayout.Visible:=false;}
   mEdit.Enabled:=false;
   mBrowse.Enabled:=false;
   mOrganize.Enabled:=false;
   mLayout.Enabled:=false;
   imported_tarbeforejob:=false;
   intdd:=false;
   marcopt.enabled:=true;
   mextopt.enabled:=true;
   end;
end;

procedure prepare_apps_panel;
begin
with FormPeach do
begin
LabelTitleApps1.Caption:='      '+txt_5_6_basic+'      ';
LabelTitleApps2.Caption:='      '+txt_2_6_advanced+'      ';
activelabel_apps:=LabelTitleApps1;
Caption:=txt_3_3_apps;
Labelcbadvanced.Caption:=txt_2_5_advanced;
Labelcbadvanced.Hint:=txt_2_5_custeditors;
Labelcbbasic.Caption:=txt_2_5_basic;
Labelcbbasic.Hint:=txt_2_5_custeditors;
Labelcbsample.Caption:=txt_sample;
pmCusteditDesc.Caption:=txt_note;
pmCusteditAdd.Caption:=txt_2_5_selectapp;
pmCusteditEdit.Caption:=txt_edit;
pmCusteditRemove.Caption:=txt_2_5_remove;
pmCusteditDesc1.Caption:=txt_note;
pmCusteditAdd1.Caption:=txt_2_5_selectapp;
pmCusteditEdit1.Caption:=txt_2_5_strbefore;
pmCusteditEdit1after.Caption:=txt_2_5_strafter;
pmCusteditRemove1.Caption:=txt_2_5_remove;
LabelResetApp1.Caption:=txt_reset+' '+txt_3_3_apps;
end;
end;

procedure savecustlist;
begin
with FormPeach do
begin
vexc1:=pcustom1.Caption;
vexc2:=pcustom2.Caption;
vexc3:=pcustom3.Caption;
vexc4:=pcustom4.Caption;
vexc5:=pcustom5.Caption;
vexc6:=pcustom6.Caption;
vexc7:=pcustom7.Caption;
vexc8:=pcustom8.Caption;
end;
end;

procedure restorecustlist;
begin
with FormPeach do
begin
pcustom1.Caption:=vexc1;
pcustom2.Caption:=vexc2;
pcustom3.Caption:=vexc3;
pcustom4.Caption:=vexc4;
pcustom5.Caption:=vexc5;
pcustom6.Caption:=vexc6;
pcustom7.Caption:=vexc7;
pcustom8.Caption:=vexc8;
end;
end;

procedure showfmmenu(menusrc:integer);
var
   p:tpoint;
begin
with FormPeach do
begin
MenuItem14.visible:=true;
pmbookmarks.visible:=true;
pmorganizebookmarks.visible:=true;
pmcommand.visible:=true;
pmpowershell.visible:=true;
pmexplore.visible:=true;
MenuItem79.visible:=false;//disabled
pmzerofree.visible:=false;//disabled
pmsecuredeletefree.visible:=false;//disabled
MenuItem91.visible:=true;
MenuItem75.visible:=true;
pmcut.visible:=false;
pmpdup.visible:=true;
pmcheck.visible:=true;
pmbatchtest.Visible:=true;
pmws.visible:=true;
pmdeletefromarchive.Visible:=false;
pmrecycle.Visible:=false;
{$IFDEF MSWINDOWS}pmrecycle.Visible:=true;{$ENDIF}
{$IFDEF DARWIN}pmrecycle.Visible:=true;{$ENDIF}
pmquickdelete.Visible:=True;
pmzerofile.Visible:=True;
pmsecuredelete.Visible:=True;
if fun='FILEBROWSER' then
   begin
   pmcpyto.Visible:=true;
   pmmvto.Visible:=true;
   pmnewfolder.Visible:=True;
   pmrename.Visible:=True;
   menuitem14.Visible:=True;
   end
else
   begin
   pmpdup.visible:=false;
   pmcheck.visible:=false;
   pmbatchtest.Visible:=false;
   pmcpyto.Visible:=false;
   pmmvto.Visible:=false;
   pmnewfolder.Visible:=False;
   pmrename.Visible:=false;
   menuitem14.Visible:=false;
   pmdeletefromarchive.Visible:=true;
   if fun='UN7Z' then
      begin
      pmmvto.Visible:=true;
      pmnewfolder.Visible:=true;
      pmrename.Visible:=true;
      end;
   end;
p.x:=0;
p.y:=0;
case menusrc of
1: begin
p.x:=ButtonPropertiesActions.left;
p.y:=ButtonPropertiesActions.top+ButtonPropertiesActions.height;
end;
2: begin
p.x:=buttoncmto.left;
p.y:=buttoncmto.top+ButtonPropertiesActions.height;
pmdeletefromarchive.Visible:=false;
pmrecycle.Visible:=false;
pmquickdelete.visible:=false;
pmzerofile.Visible:=false;
pmsecuredelete.Visible:=false;
pmnewfolder.Visible:=False;
pmbookmarks.visible:=false;
pmorganizebookmarks.visible:=false;
pmcommand.visible:=false;
pmpowershell.visible:=false;
pmexplore.visible:=false;
MenuItem14.visible:=false;
pmpdup.visible:=false;
pmcheck.visible:=false;
pmbatchtest.visible:=false;
pmws.visible:=false;
//MenuItem79.visible:=false;
//pmzerofree.visible:=false;
//pmsecuredeletefree.visible:=false;
MenuItem91.visible:=false;
MenuItem75.visible:=false;
pmrename.Visible:=false;
//pmcut.visible:=true;
pmproperties.visible:=false;
pmfilebrowser.visible:=false;
pmpanalyzefolders.Visible:=false;
pmpdup.Visible:=false;
pmcheck.Visible:=false;
pmbatchtest.visible:=false;
Separator17.visible:=false;
end;
3: begin
p.x:=buttonfmactions.left;
p.y:=buttonfmactions.top+ButtonPropertiesActions.height;
end;
4: begin
p.x:=buttonimg6.left;
p.y:=buttonimg6.top+buttonimg6.height;
end;
end;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
pmmorefun.popup(p.x,p.y);
end;
end;

procedure togglemenubar;
begin
with FormPeach do
begin
if showmenu=false then
   begin
   {$IFDEF MSWINDOWS}if FormPeach.WindowState=wsNormal then FormPeach.Height:=FormPeach.Height-MainMenu1.Height;{$ENDIF}
   mshowmenu.checked:=false;
   pmshowmenu.checked:=false;
   MenuItemOrganizeMbar.checked:=false;
   mfeatures.visible:=false;
   medit.visible:=false;
   mBrowse.visible:=false;
   mOrganize.Visible:=false;
   mlayout.visible:=false;
   moptionsmenu.visible:=false;
   moptions.visible:=false;
   mhelp.visible:=false;
   mfeatures.enabled:=false;
   medit.enabled:=false;
   mBrowse.enabled:=false;
   mOrganize.enabled:=false;
   mlayout.enabled:=false;
   moptionsmenu.enabled:=false;
   moptions.enabled:=false;
   mhelp.enabled:=false;
   end
else
   begin
   mshowmenu.checked:=true;
   pmshowmenu.checked:=true;
   MenuItemOrganizeMbar.checked:=true;
   mfeatures.visible:=true;
   moptionsmenu.visible:=true;
   moptions.visible:=true;
   mhelp.visible:=true;
   mfeatures.Enabled:=true;
   moptionsmenu.Enabled:=true;
   moptions.Enabled:=true;
   mhelp.Enabled:=true;
   mLayout.Visible:=true;
   mEdit.Visible:=true;
   mBrowse.Visible:=true;
   mOrganize.Visible:=true;
   if (prevpanel='archive') or (prevpanel='extract') then
      begin
      mLayout.Enabled:=true;
      end;
   if prevpanel='open' then
      begin
      mEdit.Enabled:=true;
      mBrowse.Enabled:=true;
      mOrganize.Enabled:=true;
      end;
   end;
end;
if FormPeach.WindowState=wsNormal then FormPeach.Height:=ws_height;
FormPeach.Repaint;
end;

procedure set_swapbars;
begin
with FormPeach do
if swapbars=false then
   begin
   PanelBarOpen.AnchorSideTop.Control:=PanelOpen;
   PanelBarOpen.AnchorSideTop.Side:=asrTop;
   if swaptab=false then
      begin
      PanelTabBar.AnchorSideTop.Control:=PanelBarOpen;
      PanelTabBar.AnchorSideTop.Side:=asrBottom;
      PanelFilters.AnchorSideTop.Control:=PanelListBar;
      PanelFilters.AnchorSideTop.Side:=asrBottom;
      mswaptab.checked:=false;
      end
   else
      begin
      PanelListBar.AnchorSideTop.Control:=PanelBarOpen;
      PanelListBar.AnchorSideTop.Side:=asrBottom;
      PanelTabBar.AnchorSideTop.Control:=PanelListBar;
      PanelTabBar.AnchorSideTop.Side:=asrBottom;
      PanelFilters.AnchorSideTop.Control:=PanelTabBar;
      PanelFilters.AnchorSideTop.Side:=asrBottom;
      mswaptab.checked:=true;
      end;
   mswapbars.checked:=false;
   end
else
   begin
   if swaptab=false then
      begin
      PanelTabBar.AnchorSideTop.Control:=PanelOpen;
      PanelTabBar.AnchorSideTop.Side:=asrTop;
      PanelBarOpen.AnchorSideTop.Control:=PanelListBar;
      PanelBarOpen.AnchorSideTop.Side:=asrBottom;
      mswaptab.checked:=false;
      end
   else
      begin
      PanelListBar.AnchorSideTop.Control:=PanelOpen;
      PanelListBar.AnchorSideTop.Side:=asrTop;
      PanelTabBar.AnchorSideTop.Control:=PanelListBar;
      PanelTabBar.AnchorSideTop.Side:=asrBottom;
      PanelBarOpen.AnchorSideTop.Control:=PanelTabBar;
      PanelBarOpen.AnchorSideTop.Side:=asrBottom;
      mswaptab.checked:=true;
      end;
   PanelFilters.AnchorSideTop.Control:=PanelBarOpen;
   PanelFilters.AnchorSideTop.Side:=asrBottom;
   mswapbars.checked:=true;
   end;
end;

procedure setthl;
begin
FormPeach.ButtonUn7zaTest.Flat:=not(thighlight);
FormPeach.ButtonUn7zaAdd.Flat:=not(thighlight);
FormPeach.ButtonUn7zaTo.Flat:=not(thighlight);
FormPeach.ButtonUn7zaConvert.Flat:=not(thighlight);
FormPeach.ButtonPropertiesActions.Flat:=not(thighlight);
FormPeach.ButtonExtractActions.Flat:=not(thighlight);
FormPeach.ButtonConvertActions.Flat:=not(thighlight);
FormPeach.ButtonAddActions.Flat:=not(thighlight);
FormPeach.ButtonDelete.Flat:=not(thighlight);
FormPeach.ButtonTestActions.Flat:=not(thighlight);
FormPeach.ButtonCut.Flat:=not(thighlight);
FormPeach.ButtonPaste.Flat:=not(thighlight);
FormPeach.ButtonRename.Flat:=not(thighlight);
FormPeach.ButtonCopy.Flat:=not(thighlight);
FormPeach.Buttoncmto.Flat:=not(thighlight);
FormPeach.Buttonfmactions.Flat:=not(thighlight);
FormPeach.ButtonOpenWith.Flat:=not(thighlight);
FormPeach.ButtonOpenactions.Flat:=not(thighlight);
FormPeach.ButtonDup.Flat:=not(thighlight);
FormPeach.ButtonNF.Flat:=not(thighlight);
FormPeach.Buttonfmactions1.Flat:=not(thighlight);
FormPeach.ButtonImgRl.Flat:=not(thighlight);
FormPeach.ButtonImgResize.Flat:=not(thighlight);
FormPeach.ButtonImgRR.Flat:=not(thighlight);
FormPeach.ButtonImgCrop.Flat:=not(thighlight);
FormPeach.ButtonImg6.Flat:=not(thighlight);
FormPeach.ButtonImgR.Flat:=not(thighlight);
FormPeach.ButtonImgRes.Flat:=not(thighlight);
FormPeach.ButtonDup1.Flat:=not(thighlight);
FormPeach.ButtonRename1.Flat:=not(thighlight);
FormPeach.mthl.checked:=thighlight;
end;

procedure settoolbar;
begin
FormPeach.MenuItemOrganizeToolbar.checked:=true;
FormPeach.mshowtoolbar.checked:=true;
FormPeach.PanelBarOpen.visible:=true;
settoolbardisp;
FormPeach.ImageFlat.visible:=false;
FormPeach.pmtoollarge.Checked:=false;
FormPeach.pmtoolmedium.Checked:=false;
FormPeach.pmtoolsmall.Checked:=false;
FormPeach.pmtoolcompact.Checked:=false;
FormPeach.pmtoolnone.Checked:=false;
case toolsize of //note: currently needs to be called when the browser is rendered, or vsList style would not display right column size
   0: begin
      setlargetoolbar2;
      if lsize=1 then FormPeach.pmtoollarge.Checked:=true
      else FormPeach.pmtoolmedium.Checked:=true;
      end;
   {1: begin //1 becomes large icons + text below mode to change previous standard mode for existing installations
      setlargetoolbar1;
      end;
   2: begin
      setlargetoolbar3;
      end;
   3: begin
      setsmalltoolbar1;
      end;}
   4: begin
      setsmalltoolbar2;
      FormPeach.pmtoolsmall.Checked:=true;
      end;
   {5: begin
      setsmalltoolbar3;
      end;
   6: begin
      settexttoolbar;
      end;}
   7: begin
      FormPeach.MenuItemOrganizeToolbar.checked:=false;
      FormPeach.mshowtoolbar.checked:=false;
      FormPeach.PanelBarOpen.height:=0;
      FormPeach.PanelBarOpen.visible:=false;
      FormPeach.ImageFlat.visible:=true;
      if ntoolstyle=4 then FormPeach.pmtoolcompact.Checked:=true;
      if ntoolstyle=5 then FormPeach.pmtoolnone.Checked:=true;
      end;
   end;
FormPeach.pmmoretest.Visible:=FormPeach.ImageFlat.visible;
FormPeach.pmmoreadd.Visible:=false;
FormPeach.pmmoreconvert.Visible:=false;
FormPeach.pmmoreextract.Visible:=false;
if FormPeach.ImageFlat.visible=true then FormPeach.PanelSPaddress.Width:=1 else FormPeach.PanelSPaddress.Width:=8;
if ntoolstyle=4 then
   begin
   case lasttoolbar of
   1: begin
      FormPeach.ImageFlatadd.Visible:=true;
      FormPeach.ImageFlatconvert.Visible:=true;
      FormPeach.ImageFlatext.Visible:=true;
      FormPeach.ImageFlatdup.Visible:=false;
      FormPeach.ImageFlatfolder.Visible:=false;
      FormPeach.ImageFlatren.Visible:=false;
      FormPeach.ImageFlattransform.Visible:=false;
      FormPeach.ImageFlatcrop.Visible:=false;
      FormPeach.PanelSPaddress.AnchorSideRight.Control:=FormPeach.ImageFlatadd;
      end;
   2: begin
      FormPeach.ImageFlatadd.Visible:=false;
      FormPeach.ImageFlatconvert.Visible:=false;
      FormPeach.ImageFlatext.Visible:=false;
      FormPeach.ImageFlatdup.Visible:=true;
      FormPeach.ImageFlatfolder.Visible:=true;
      FormPeach.ImageFlatren.Visible:=true;
      FormPeach.ImageFlattransform.Visible:=false;
      FormPeach.ImageFlatcrop.Visible:=false;
      FormPeach.PanelSPaddress.AnchorSideRight.Control:=FormPeach.ImageFlatren;
      FormPeach.pmmoreadd.Visible:=true;
      FormPeach.pmmoreconvert.Visible:=true;
      FormPeach.pmmoreextract.Visible:=true;
      end;
   3: begin
      FormPeach.ImageFlatadd.Visible:=false;
      FormPeach.ImageFlatconvert.Visible:=false;
      FormPeach.ImageFlatext.Visible:=false;
      FormPeach.ImageFlatdup.Visible:=true;
      FormPeach.ImageFlatfolder.Visible:=false;
      FormPeach.ImageFlatren.Visible:=false;
      FormPeach.ImageFlattransform.Visible:=true;
      FormPeach.ImageFlatcrop.Visible:=true;
      FormPeach.PanelSPaddress.AnchorSideRight.Control:=FormPeach.ImageFlatcrop;
      FormPeach.pmmoreadd.Visible:=true;
      FormPeach.pmmoreconvert.Visible:=true;
      FormPeach.pmmoreextract.Visible:=true;
      end;
   end;
   FormPeach.ImageFlattestmore.Visible:=true;
   end
else
   begin
   FormPeach.ImageFlatadd.Visible:=false;
   FormPeach.ImageFlatconvert.Visible:=false;
   FormPeach.ImageFlatext.Visible:=false;
   FormPeach.ImageFlatdup.Visible:=false;
   FormPeach.ImageFlatfolder.Visible:=false;
   FormPeach.ImageFlatren.Visible:=false;
   FormPeach.ImageFlattransform.Visible:=false;
   FormPeach.ImageFlatcrop.Visible:=false;
   FormPeach.ImageFlattestmore.Visible:=false;
   end;
settoolbarw;
setthl;
settonewfolder(tonewfolder);
end;

procedure prepare_GUI;
var
   i:integer;
begin
if showguihints=1 then FormPeach.ShowHint:=true else FormPeach.ShowHint:=false;
with FormPeach.PanelArchive do begin Top:=0; Left:=0; Width:=FormPeach.Width; end;
with FormPeach.PanelOpen do begin Top:=0; Left:=0; Width:=FormPeach.Width; end;
with FormPeach.PanelOptions do begin Top:=0; Left:=0; Width:=FormPeach.Width; end;
with FormPeach do
begin
{$IFDEF MSWINDOWS}
FormDrop.ShapeDragDrop.Brush.Color:=clInactiveCaption;
{$ENDIF}
for i:=1 to 16 do StringGridCustedit.Cells[0,i]:=inttostr(i);
StringGridCustedit.Cells[1,0]:=txt_description;
StringGridCustedit.Cells[2,0]:=txt_2_5_execommand;
StringGridCustedit.AutoSizeColumns;
for i:=1 to 8 do StringGridCustEditAdv.Cells[0,i]:=inttostr(i);
StringGridCustEditAdv.Cells[1,0]:=txt_description;
StringGridCustEditAdv.Cells[2,0]:=txt_2_5_strbefore;
StringGridCustEditAdv.Cells[3,0]:=txt_2_5_strafter;
StringGridCustEditAdv.Cells[4,0]:=txt_3_3_stralt;
StringGridCustEditAdv.AutoSizeColumns;
StringGridAdd.Cells[1,0]:=txt_name;
StringGridAdd.Cells[2,0]:=txt_type;
StringGridAdd.Cells[3,0]:=txt_size;
StringGridAdd.Cells[4,0]:=txt_nfolders;
StringGridAdd.Cells[5,0]:=txt_nfiles;
StringGridAdd.Cells[6,0]:=txt_8_2_tm;
StringGridAdd.Cells[7,0]:=txt_attributes;
StringGridAdd.Cells[8,0]:=txt_name_full;
StringGridAdd.AutoSizeColumns;
StringGridAdd.ColWidths[0]:=rowsize;
StringGridAdd.ColWidths[1]:=COL1D;
StringGridAdd.ColWidths[9]:=0;
StringGridAdd.ColWidths[10]:=0;
StringGridAdd.ColWidths[11]:=0;
StringGridAdd.ColWidths[12]:=0;
StringGridAdd.colwidths[13]:=0;
StringGridAdd.colwidths[14]:=8;
StringGridExtract.Cells[1,0]:=txt_name;
StringGridExtract.Cells[2,0]:=txt_type;
StringGridExtract.Cells[3,0]:=txt_size;
StringGridExtract.Cells[4,0]:=txt_compressed_size;
StringGridExtract.Cells[5,0]:=txt_8_2_tm;
StringGridExtract.Cells[6,0]:=txt_attributes;
StringGridExtract.Cells[7,0]:=txt_check_select;
StringGridExtract.Cells[8,0]:=txt_name_full;
autosize_stringgrid2;
set_listview_col;
StringGridBookmarks.Cells[1,0]:=txt_bookmarks;
StringGridBookmarks.Cells[2,0]:=txt_name_full;
StringGridBookmarks.Cells[3,0]:=txt_name;
StringGridBookmarks.Cells[4,0]:=txt_inclusion;
StringGridBookmarks.Cells[5,0]:=txt_exclusion;
StringGridBookmarks.Cells[6,0]:=txt_description;
StringGridBookmarks.Cells[7,0]:=txt_5_4_used;
StringGridBookmarks.Cells[8,0]:=txt_5_4_lv;
StringGridBookmarks.Cells[9,0]:=txt_5_4_da;
StringGridBookmarks.AutoSizeColumns;
StringGridBookmarks.ColWidths[10]:=0;
StringGridBookmarks.ColWidths[11]:=0;
StringGridBookmarks.ColWidths[0]:=rowsize;
StringGridClipboard.Cells[0,0]:=txt_2_4_operation;
StringGridClipboard.Cells[1,0]:=txt_name;
StringGridClipboard.Cells[2,0]:=txt_type;
StringGridClipboard.Cells[3,0]:=txt_name_full;
StringGridClipboard.Cells[4,0]:=txt_path;
StringGridClipboard.Cells[5,0]:=txt_size;
StringGridClipboard.Cells[6,0]:=txt_8_2_tm;
StringGridClipboard.AutoSizeColumns;
StringGridClipboard.ColWidths[0]:=rowsize;
activelabel_options:=LabelTitleOptions1;
clicklabel_options(LabelTitleoptions1,ShapeOptions1);
setpanel_extract(1);
StringGridRecent.ColWidths[0]:=rowsize;
StringGridRecent.Cells[1,0]:=txt_list_history;
FormPeach.StringGridRecent.AutosizeColumns;
FormPeach.StringGridRecent.ColWidths[0]:=rowsize;
FormPeach.StringGridRecent.ColWidths[2]:=0;
FormPeach.StringGridRecent.ColWidths[3]:=0;
FormPeach.StringGridRecent.ColWidths[4]:=0;
StringGridSessionHistory.ColWidths[0]:=rowsize;
StringGridSessionHistory.Cells[1,0]:=txt_5_0_sh;
StringGridSessionHistory.Cells[2,0]:=txt_name;
StringGridSessionHistory.Cells[3,0]:=txt_inclusion;
StringGridSessionHistory.Cells[4,0]:=txt_exclusion;
openwithcustom.Visible:=false;
MenuItemPreCustom.Visible:=false;
po_open_custom.Visible:=false;
MenuItemERCustom.Visible:=false; //uses Windows specific open with method
EditUn7zaFilterExclude.Enabled:=false;
//fix position of some elements that tend to change without an apparent reason in the IDE
if ws=1 then //load last window status
   begin
   if ws_status=0 then
      begin
      FormPeach.WindowState:=wsNormal;
      FormPeach.Left:=ws_left;
      FormPeach.Top:=ws_top;
      FormPeach.Width:=ws_width;
      FormPeach.Height:=ws_height;
      end
   else FormPeach.WindowState:=wsMaximized;
   end;
//status0:=caption_release;
pojdn1.Visible:=false;
pojdn2.Visible:=false;
pojdn3.Visible:=false;
pojdn4.Visible:=false;
pojdn5.Visible:=false;
pojdn6.Visible:=false;
pojdn7.Visible:=false;
pojdn8.Visible:=false;
pojdn9.Visible:=false;
pojdn10.Visible:=false;
pojdn11.Visible:=false;
pojdn12.Visible:=false;
pojdn13.Visible:=false;
pojdn14.Visible:=false;
pojdn15.Visible:=false;
pojdn16.Visible:=false;
pojdn17.Visible:=false;
pojdn18.Visible:=false;
pojdn19.Visible:=false;
pojdn20.Visible:=false;
pojdn21.Visible:=false;
pojdn22.Visible:=false;
pojdn23.Visible:=false;
pojdn24.Visible:=false;
pojdn25.Visible:=false;
pojdn26.Visible:=false;
mextto1.Visible:=false;
mextto2.Visible:=false;
mextto3.Visible:=false;
mextto4.Visible:=false;
mextto5.Visible:=false;
mextto6.Visible:=false;
mextto7.Visible:=false;
mextto8.Visible:=false;
mextto9.Visible:=false;
mextto10.Visible:=false;
mextto11.Visible:=false;
mextto12.Visible:=false;
mextto13.Visible:=false;
mextto14.Visible:=false;
mextto15.Visible:=false;
mextto16.Visible:=false;
mextto17.Visible:=false;
mextto18.Visible:=false;
mextto19.Visible:=false;
mextto20.Visible:=false;
mextto21.Visible:=false;
mextto22.Visible:=false;
mextto23.Visible:=false;
mextto24.Visible:=false;
mextto25.Visible:=false;
mextto26.Visible:=false;
pajdn1.Visible:=false;
pajdn2.Visible:=false;
pajdn3.Visible:=false;
pajdn4.Visible:=false;
pajdn5.Visible:=false;
pajdn6.Visible:=false;
pajdn7.Visible:=false;
pajdn8.Visible:=false;
pajdn9.Visible:=false;
pajdn10.Visible:=false;
pajdn11.Visible:=false;
pajdn12.Visible:=false;
pajdn13.Visible:=false;
pajdn14.Visible:=false;
pajdn15.Visible:=false;
pajdn16.Visible:=false;
pajdn17.Visible:=false;
pajdn18.Visible:=false;
pajdn19.Visible:=false;
pajdn20.Visible:=false;
pajdn21.Visible:=false;
pajdn22.Visible:=false;
pajdn23.Visible:=false;
pajdn24.Visible:=false;
pajdn25.Visible:=false;
pajdn26.Visible:=false;
pmjd1.Visible:=false;
pmjd2.Visible:=false;
pmjd3.Visible:=false;
pmjd4.Visible:=false;
pmjd5.Visible:=false;
pmjd6.Visible:=false;
pmjd7.Visible:=false;
pmjd8.Visible:=false;
pmjd9.Visible:=false;
pmjd10.Visible:=false;
pmjd11.Visible:=false;
pmjd12.Visible:=false;
pmjd13.Visible:=false;
pmjd14.Visible:=false;
pmjd15.Visible:=false;
pmjd16.Visible:=false;
pmjd17.Visible:=false;
pmjd18.Visible:=false;
pmjd19.Visible:=false;
pmjd20.Visible:=false;
pmjd21.Visible:=false;
pmjd22.Visible:=false;
pmjd23.Visible:=false;
pmjd24.Visible:=false;
pmjd25.Visible:=false;
pmjd26.Visible:=false;
pea.Visible:=false;
Comboboxarcsfx.Itemindex:=2;
setsearchbar(showsearchbar);
end;
end;

procedure setschedulevisible(isvis:boolean);
begin
FormPeach.ScheduleAdd.Visible:=isvis;
FormPeach.ScheduleExtract.Visible:=isvis;
end;

procedure movepform;
begin
pimmersive:=0;
FormPeach.WindowState:=wsNormal;
FormPeach.BorderStyle:=bsSizeable;
FormPeach.Width:=DWIDTH;
FormPeach.Height:=DHEIGTH;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GUI OPTIONS set and restore options in gui items

///////////////////////////////////////////////////////////////////////////////}

procedure savestatus_archiver;
begin
if updatingarchive_inarchive=true then exit;
with FormPeach do
begin
if mdefaultarchive.checked=true then apdefault:=1 else apdefault:=0;
apdefaultarchivepath:=defaultarchivepath;
apformat:=cbType.ItemIndex;
if cbAdvfAdd.State=cbchecked then apfilters:=1 else apfilters:=0;
if checkboxenumd.State=cbchecked then apenum:=1 else apenum:=0;
if cbRAR.State=cbchecked then aprar:=1 else aprar:=0;
if cbRAR5.State=cbchecked then aprar5:=1 else aprar5:=0;
aprardict:=comboRARdict.ItemIndex;
if cbRARBLAKE2.State=cbchecked then aprarblake2:=1 else aprarblake2:=0;
//if cbRARmanual.State=cbchecked then aprarmanual:=1 else aprarmanual:=0;
if cbRARsfx.State=cbchecked then aprarsfx:=1 else aprarsfx:=0;
if cbRARsolid.State=cbchecked then aprarsolid:=1 else aprarsolid:=0;
if cbRARrr.State=cbchecked then aprarrr:=1 else aprarrr:=0;
apprarrr:=seRARrr.Value;
if cbRARrv.State=cbchecked then aprarrv:=1 else aprarrv:=0;
apprarrv:=seRARrv.Value;
if cbRARsaveopen.State=cbchecked then aprarsaveopen:=1 else aprarsaveopen:=0;
if cbRARsavesecurity.State=cbchecked then aprarsavesecurity:=1 else aprarsavesecurity:=0;
if cbRARsavestreams.State=cbchecked then aprarsavestreams:=1 else aprarsavestreams:=0;
aprarlastmodtime:=cbRARlastmodtime.ItemIndex;
if cbRARlock.State=cbchecked then aprarlock:=1 else aprarlock:=0;
if cbEncExtension.State=cbchecked then apencext:=1 else apencext:=0;
if CheckBoxdate.State=cbchecked then apappend:=1 else apappend:=0;
if cbCustomExtension.State=cbchecked then apcustext:=1 else apcustext:=0;
apextcapt:=EditCustomExtension.Caption;
if CheckBoxConvertPW.State=cbchecked then appw:=1 else appw:=0;
if CheckBoxConvertVerbose.State=cbchecked then apverbose:=1 else apverbose:=0;
apsplit:=cbSplit.ItemIndex;
apspin:=SpinEditSplit.Value;
apsize:=ComboBoxSplit.ItemIndex;
apdelete:=cbDeleteInputModeAdd.ItemIndex;
if CheckBoxDeleteInputAdd.State=cbchecked then apdopt:=1 else apdopt:=0;
//7z
vlevel_7z:=level_7z;
vlevel_xz:=level_xz;
vlevel_bzip2:=level_bzip2;
vlevel_gz:=level_gz;
vlevel_zip:=level_zip;
vmethod_7z:=method_7z;
vmethod_zip:=method_zip;
if fun='BROTLI' then v9b:=cbLevel.Itemindex else v9b:=level_brotli;
if (fun='CUSTOM') and (userar=1) and (havewinrar=true) then v9r:=cbLevel.Itemindex else v9r:=level_rar;
if fun='ZSTD' then v9z:=cbLevel.Itemindex else v9z:=level_zstd;
v7z1:=ComboBox7zLevel.Itemindex;
v7z2:=ComboBox7zMethod.Itemindex;
v7z3:=ComboBox7zDictionary.Itemindex;
v7z4:=ComboBox7zWord.Itemindex;
v7z5:=ComboBox7zPasses.Itemindex;
v7z6:=ComboBox7zSolid.Itemindex;
if CheckBoxSolidExtension.State=cbchecked then v7z7b:=1 else v7z7b:=0;
if CheckBox7zOF.State=cbchecked then v7z7:=1 else v7z7:=0;
if Checkboxsnoi.State=cbchecked then v7snoi:=1 else v7snoi:=0;
if Checkboxsnon.State=cbchecked then v7snon:=1 else v7snon:=0;
if CheckBox7zSFX.State=cbchecked then v7z8:=1 else v7z8:=0;
if Checkboxsni.State=cbchecked then v7z15:=1 else v7z15:=0;
if Checkboxsns.State=cbchecked then v7z16:=1 else v7z16:=0;
if Checkboxsnh.State=cbchecked then v7z16a:=1 else v7z16a:=0;
if Checkboxsnl.State=cbchecked then v7z16b:=1 else v7z16b:=0;
if Checkboxstl.State=cbchecked then v7z17:=1 else v7z17:=0;
if Checkboxssp.State=cbchecked then v7z18:=1 else v7z18:=0;
if CheckBoxBrotli.State=cbchecked then vbr1:=1 else vbr1:=0;
if CheckBoxZstd.State=cbchecked then vzst1:=1 else vzst1:=0;
v7z9:=RadioGroup7zSFX.Itemindex;
v7z10:=ComboBox7zFun.Itemindex;
v7z11:=ComboBox7zThreads.Itemindex;
v7z11b:=ComboBox7zMemuse.Itemindex;
v7z12:=Edit7zOpt.Text;
if CheckBoxMailAdd.State=cbchecked then v7z13:=1 else v7z13:=0;
if CheckboxMailKeep.State=cbchecked then v7z13b:=1 else v7z13b:=0;
v7z14:=Combobox7zalgo.Itemindex;
v7zpaths:=ComboBox7zPaths.Itemindex;
vtartype:=ComboBoxTAR.Itemindex;
vtartime:=ComboBoxTARTS.Itemindex;
//quad/balz/bcm
vquad1:=radiogroupquad.Itemindex;
if CheckboxQuadMax.State=cbchecked then vquad2:=1 else vquad2:=0;
//paq
vpaq1:=ComboBoxPAQLevel.ItemIndex;
vpaq1b:=ComboBoxPAQThreads.ItemIndex;
vpaq2:=RadioGroupPaq.ItemIndex;
//upx
vupx1:=ComboBoxUPX.ItemIndex;
if CheckBoxUPXStrip.State=cbchecked then vupx2:=1 else vupx2:=0;
if CheckBoxUPXBackup.State=cbchecked then vupx3:=1 else vupx3:=0;
//arc
varc1:=ComboBoxARCLevel.ItemIndex;
varc2:=ComboBoxARCSolid.ItemIndex;
if CheckBoxARCrr.State=cbchecked then varc3:=1 else varc3:=0;
if CheckBoxARCabs.State=cbchecked then varc3b:=1 else varc3b:=0;
if CheckBoxARCsfx.State=cbchecked then varc4:=1 else varc4:=0;
varc5:=ComboBoxARCSfx.ItemIndex;
varc6:=ComboBoxARCFun.ItemIndex;
varc7:=EditOPARC.Text;
varc8:=ComboBoxARCalgo.ItemIndex;
//split
vsplit1:=ComboBoxSplitAlgo.ItemIndex;
//pea
vpea1:=ComboBoxPEALevel.ItemIndex;
vpea2:=ComboBoxPEAObj.ItemIndex;
vpea3:=ComboBoxPEAVol.ItemIndex;
vpea4:=ComboBoxPEAStream.ItemIndex;
vpea5:=ComboBoxPEAKDFw.ItemIndex;
vpea6:=ComboBoxPEAKDF.ItemIndex;
//custom
vcustom1:=EditNameCustom.Text;
vcustom2:=EditExtensionCustom.Text;
vcustom3:=EditOPCustom.Text;
vcustom4:=ComboBoxArchiveCustom.ItemIndex;
savecustlist;
end;
end;

procedure on_ComboBox7zalgochange;
begin
getarccaption(FormPeach.cbType.Text);
if archive_type='zip' then algo_zipenc:=FormPeach.ComboBox7zalgo.ItemIndex;
end;

procedure cbSplit_onchange;
begin
with FormPeach do
begin
if cbSplit.ItemIndex > 0 then CheckBoxMailAdd.Enabled:=false
else CheckBoxMailAdd.Enabled:=true;
if FormPeach.CheckBoxMailAdd.Enabled=false then
   begin
   FormPeach.CheckBoxMailAdd.Checked:=false;
   FormPeach.CheckBoxMailKeep.Visible:=false;
   end;
change_imagesplit;
if cbSplit.ItemIndex = 1 then
   begin
   SpinEditSplit.Visible:=true;
   ComboBoxSplit.Visible:=true;
   end
else
   begin
   SpinEditSplit.Visible:=false;
   ComboBoxSplit.Visible:=false;
   end;
defaultspanning:=cbSplit.ItemIndex;
spansize:=FormPeach.SpinEditSplit.Value;
spanunit:=FormPeach.ComboBoxSplit.ItemIndex;
end;
end;

procedure ComboBoxArchive3_onchange;
begin
if settingvalues=false then
   with FormPeach do
      begin
      compression_method:=ComboBox7zMethod.Text;
      if (cbType.Text=STR_7Z) or (cbType.Text=txt_sfx+' '+STR_7Z) then method_7z:=compression_method;
      if cbType.Text=STR_ZIP then method_zip:=compression_method;
      set_values(archive_type,compression_method,compression_level);
      getarccaption(FormPeach.cbType.Text);
      end;
end;

procedure CheckBoxArchiveOF_onclick;
begin
with FormPeach do
begin
if CheckBox7zOF.State=cbChecked then openw_all7z:=1 else openw_all7z:=0;
end;
end;

procedure CheckBoxsni_onclick;
begin
with FormPeach do
begin
if CheckBoxsni.State=cbChecked then sni7z:=1 else sni7z:=0;
CheckBoxsniExt.State:=CheckBoxsni.State;
end;
end;

procedure CheckBoxsniExt_onclick;
begin
with FormPeach do
begin
if CheckBoxsniExt.State=cbChecked then sni7z:=1 else sni7z:=0;
CheckBoxsni.State:=CheckBoxsniExt.State;
end;
end;

procedure CheckBoxsns_onclick;
begin
with FormPeach do
begin
if CheckBoxsns.State=cbChecked then sns7z:=1 else sns7z:=0;
CheckBoxsnsExt.State:=CheckBoxsns.State;
end;
end;

procedure CheckBoxsnh_onclick;
begin
if FormPeach.CheckBoxsnh.State=cbChecked then snh7z:=1 else snh7z:=0;
end;

procedure CheckBoxsnl_onclick;
begin
if FormPeach.CheckBoxsnl.State=cbChecked then snl7z:=1 else snl7z:=0;
end;

procedure CheckBoxsnzExt_onclick;
begin
with FormPeach do
begin
if CheckBoxsnzExt.State=cbChecked then snz7z:=1 else snz7z:=0;
end;
end;

procedure CheckBoxstl_onClick;
begin
if FormPeach.CheckBoxstl.State=cbChecked then stl7z:=1 else stl7z:=0;
end;

procedure CheckBoxssp_onClick;
begin
if FormPeach.CheckBoxssp.State=cbChecked then ssp7z:=1 else ssp7z:=0;
end;

procedure CheckBoxBrotli_onClick;
begin
if FormPeach.CheckBoxBrotli.State=cbChecked then maxbrotli:=1 else maxbrotli:=0;
end;

procedure CheckBoxZstd_onClick;
begin
if FormPeach.CheckBoxZstd.State=cbChecked then maxzstd:=1 else maxzstd:=0;
end;

procedure CheckBoxsnsExt_onclick;
begin
with FormPeach do
begin
if CheckBoxsnsExt.State=cbChecked then sns7z:=1 else sns7z:=0;
CheckBoxsns.State:=CheckBoxsnsExt.State;
end;
end;

procedure CheckBoxZstdErrPolicy_onclick;
begin
with FormPeach do
begin
if CheckBoxZstdErrPolicy.State=cbChecked then zstderr:=1 else zstderr:=0;
end;
end;

procedure CheckBoxMQS_onclick;
begin
with FormPeach do
begin
if CheckBoxSolidExtension.State=cbChecked then sort7zbytype:=1 else sort7zbytype:=0;
end;
end;

procedure on_RadioGroupQuadClick;
begin
case FormPeach.RadioGroupQuad.ItemIndex of
   0: archive_type:='quad';
   1: archive_type:='balz';
   2: archive_type:='bcm';
   end;
if FormPeach.RadioGroupQuad.ItemIndex=2 then
   begin
   FormPeach.CheckBoxQuadMax.enabled:=false;
   FormPeach.Labelbcmblock.visible:=true;
   FormPeach.ComboBoxBCMSolid.visible:=true;
   end
else
   begin
   FormPeach.CheckBoxQuadMax.enabled:=true;
   FormPeach.Labelbcmblock.visible:=false;
   FormPeach.ComboBoxBCMSolid.visible:=false;
   end;
getarccaption(STR_QUAD);
end;

procedure on_CheckBoxQuadMax_click;
begin
if FormPeach.CheckBoxQuadMax.State=cbChecked then level_quad:=1 else level_quad:=0;
updateconf_modified;
end;

procedure on_ComboBoxPAQ1Change;
begin
level_paq:=FormPeach.ComboBoxPAQLevel.ItemIndex;
end;

procedure on_ComboBoxPAQ2Change;
begin
threads_zpaq:=FormPeach.ComboBoxPAQThreads.ItemIndex;
end;

procedure on_RadioGroupPaqClick;
var
   fnm:ansistring;
begin
case FormPeach.RadioGroupPaq.ItemIndex of
   0: begin
      archive_type:='lpaq8';
      check_tarbefore(tdirs);
      end;
   1: archive_type:='paq8o';
   2: archive_type:='zpaq';
   end;
if FormPeach.RadioGroupPaq.ItemIndex=2 then
   begin
   FormPeach.ComboBoxPAQThreads.Enabled:=true;
   FormPeach.LabelPAQThreads.Enabled:=true;
   end
else
   begin
   FormPeach.ComboBoxPAQThreads.Enabled:=false;
   FormPeach.LabelPAQThreads.Enabled:=false;
   end;
paqver:=FormPeach.RadioGroupPaq.ItemIndex;
suggest_outname(fnm,FormPeach.cbType.Text,0);
fnm:=extractfilename(fnm);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(fnm);
getarccaption(STR_ZPAQ);
end;

procedure on_ComboBoxUPXChange;
begin
level_upx:=FormPeach.ComboBoxUPX.ItemIndex;
end;

procedure on_ComboBoxARCChange;
begin
level_arc:=FormPeach.ComboBoxARCLevel.ItemIndex;
setquickcompset('ARC');
end;

procedure on_ComboBoxArcSolidChange;
begin
solid_arc:=FormPeach.ComboBoxARCsolid.ItemIndex;
end;

procedure on_CheckBoxARC1Click;
begin
if FormPeach.CheckBoxARCrr.state=cbChecked then rr_arc:=1
else rr_arc:=0;
end;

procedure on_CheckBoxARC2Click;
begin
if FormPeach.CheckBoxARCsfx.state=cbChecked then FormPeach.ComboboxArcSfx.Visible:=true
else FormPeach.ComboboxArcSfx.Visible:=false;
end;

procedure on_ComboBoxARC2Change;
begin
if (FormPeach.CheckBoxARCsfx.State=cbChecked) then
   getarccaption(txt_sfx+' '+STR_ARC)
else
   getarccaption(STR_ARC);
end;

procedure on_ComboBoxARCalgoChange;
begin
algo_arc:=FormPeach.ComboBoxARCalgo.ItemIndex;
end;

procedure ComboBoxSplit3_onchange;
begin
salgo:=FormPeach.ComboBoxSplitAlgo.ItemIndex;
end;

procedure ComboBoxPEACompression1_onchange;
begin
pcompr:=FormPeach.ComboBoxPEALevel.ItemIndex;
end;

procedure ComboBoxPEA3_onchange;
begin
pobj:=FormPeach.ComboBoxPEAObj.ItemIndex;
end;

procedure ComboBoxPEA4_onchange;
begin
pvol:=FormPeach.ComboBoxPEAVol.ItemIndex;
end;

procedure ComboBoxPEA2_onchange;
begin
pstream:=FormPeach.ComboBoxPEAStream.ItemIndex;
end;

procedure ComboBoxKDF_onchange;
begin
trkdf:=FormPeach.ComboBoxPEAKDF.ItemIndex;
case FormPeach.ComboBoxPEAKDF.ItemIndex of
   2:
   begin
   FormPeach.ComboBoxPEAKDFw.Items.Strings[0]:=txt_default;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[1]:='+200K '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[2]:='+500K '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[3]:='+1M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[4]:='+2M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[5]:='+5M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[6]:='+10M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[7]:='+25M '+txt_9_9_kdf;
   end;
   1:
   begin
   FormPeach.ComboBoxPEAKDFw.Items.Strings[0]:='64 MB RAM + '+txt_default;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[1]:='128 MB RAM +200K '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[2]:='256 MB RAM +500K '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[3]:='512 MB RAM +1M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[4]:='1 GB RAM (p=1) +2M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[5]:='1 GB RAM (p=2) +5M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[6]:='1 GB RAM (p=4) +10M '+txt_9_9_kdf;
   FormPeach.ComboBoxPEAKDFw.Items.Strings[7]:='1 GB RAM (p=8) +25M '+txt_9_9_kdf;
   end;
   0:
   begin
   FormPeach.ComboBoxPEAKDFw.Items.Strings[0]:='64 MB RAM (r=8, p=1)';
   FormPeach.ComboBoxPEAKDFw.Items.Strings[1]:='128 MB RAM (r=8, p=1)';
   FormPeach.ComboBoxPEAKDFw.Items.Strings[2]:='256 MB RAM (r=8, p=1)';
   FormPeach.ComboBoxPEAKDFw.Items.Strings[3]:='512 MB RAM (r=8, p=1)';
   FormPeach.ComboBoxPEAKDFw.Items.Strings[4]:='1 GB RAM (r=8, p=1)';
   FormPeach.ComboBoxPEAKDFw.Items.Strings[5]:='1 GB RAM (r=8, p=2)';
   FormPeach.ComboBoxPEAKDFw.Items.Strings[6]:='1 GB RAM (r=8, p=4)';
   FormPeach.ComboBoxPEAKDFw.Items.Strings[7]:='1 GB RAM (r=8, p=8)';
   end;
end;
end;

procedure ComboBoxKDF1_onchange;
begin
nrkdf:=FormPeach.ComboBoxPEAKDFw.ItemIndex;
end;

procedure on_ComboBoxArchiveCustomChange;
begin
customsyntax:=FormPeach.ComboBoxArchiveCustom.ItemIndex;
updateconf_modified;
end;

procedure on_cbtypechange;
begin
archive_type_select(FormPeach.cbType.Text);
if stayopen=true then
   pf:=FormPeach.cbType.ItemIndex
else
   if savetype=true then
      pf:=FormPeach.cbType.ItemIndex;
end;

procedure on_CheckBoxAutoOpenClick;
begin
   if FormPeach.CheckBoxAutoOpen.State=cbChecked then autoopen:=1 else autoopen:=0;
end;

procedure on_CheckBoxAutoTestClick;
begin
   if FormPeach.CheckBoxAutoTest.State=cbChecked then autotest:=1 else autotest:=0;
end;

procedure on_CheckBoxARC3Click;
begin
if FormPeach.CheckBoxARCabs.state=cbChecked then arcabspath:=1
else arcabspath:=0;
end;

procedure on_CheckBoxArchive4;
begin
if FormPeach.CheckBoxMailAdd.State=cbChecked then FormPeach.CheckBoxMailKeep.Visible:=true
else FormPeach.CheckBoxMailKeep.Visible:=false;
end;

procedure on_CheckBoxAutoExtTar1Click;
begin
if FormPeach.CheckBoxAutoExtTarConvert.State=cbChecked then tar_atomic_convert:=1 else tar_atomic_convert:=0;
end;

procedure on_CheckBoxAutoExtTarClick;
begin
if FormPeach.CheckBoxAutoExtTar.State=cbChecked then tar_atomic:=1 else tar_atomic:=0;
end;

procedure TFormPeach.CheckBoxAutoExtTarClick(Sender: TObject);
begin
on_CheckBoxAutoExtTarClick;
end;

procedure on_CheckBoxAutoOpenTarClick;
begin
if FormPeach.CheckBoxAutoOpenTar.State=cbChecked then autoopentar:=1 else autoopentar:=0;
end;

procedure on_checkboxconvertVerbose;
begin
if FormPeach.CheckBoxConvertVerbose.Checked=true then convertverbose:=1 else convertverbose:=0;
end;

procedure on_checkboxconvertPW;
begin
if FormPeach.CheckBoxConvertPW.Checked=true then convertpw:=1 else convertpw:=0;
end;

procedure on_CheckBoxDeleteInputAddClick;
begin
if FormPeach.CheckBoxDeleteInputAdd.State=cbChecked then
   begin
   FormPeach.cbDeleteInputModeAdd.Visible:=true;
   doptadd:=1;
   end
else
   begin
   FormPeach.cbDeleteInputModeAdd.Visible:=false;
   doptadd:=0;
   end;
end;

procedure on_CheckBoxDeleteInputClick;
begin
if FormPeach.CheckBoxDeleteInputExt.State=cbChecked then
   begin
   FormPeach.cbDeleteInputModeExt.Visible:=true;
   doptext:=1;
   end
else
   begin
   FormPeach.cbDeleteInputModeExt.Visible:=false;
   doptext:=0;
   end;
end;

procedure on_CheckBoxDragDrop_click;
begin
if FormPeach.CheckBoxDragDrop.State=cbChecked then nativedrag:=1 else nativedrag:=0;
FormDrop.Visible:=false;
if nativedrag=0 then FormPeach.ComboBoxDrag.enabled:=false else FormPeach.ComboBoxDrag.enabled:=true;
end;

procedure on_CheckBoxEditArchives_click;
begin
if FormPeach.CheckBoxEditArchives.State=cbChecked then autosync:=1 else autosync:=0;
end;

procedure on_CheckBoxMailKeepClick;
begin
if FormPeach.CheckBoxMailKeep.State=cbChecked then mailkeep:=1 else mailkeep:=0;
end;

procedure on_ComboBoxArchive8Change;
begin
if FormPeach.ComboBox7zThreads.Enabled=true then
   multi_option:=FormPeach.ComboBox7zThreads.ItemIndex;
end;

procedure on_ComboBoxmemuseChange;
begin
memuse_option:=FormPeach.ComboBox7zMemuse.ItemIndex;
end;

procedure on_cbdeleteinputmode1Change;
begin
favdelete:=FormPeach.cbDeleteInputModeAdd.ItemIndex;
FormPeach.cbDeleteInputModeExt.ItemIndex:=FormPeach.cbDeleteInputModeAdd.ItemIndex;
end;

procedure cbtimecreated_onClick;
begin
if FormPeach.cbtimecreated.State=cbChecked then storecreated:=1 else storecreated:=0;
end;

procedure CheckBoxsnoi_onclick;
begin
if FormPeach.CheckBoxsnoi.State=cbChecked then snoi7z:=1 else snoi7z:=0;
end;

procedure CheckBoxsnon_onclick;
begin
if FormPeach.CheckBoxsnon.State=cbChecked then snon7z:=1 else snon7z:=0;
end;

procedure restorestatus_archiver;
begin
with FormPeach do
begin
CheckBoxAutoHaltA.State:=cbUnchecked;
if apdefault=1 then mdefaultarchive.checked:=true else mdefaultarchive.checked:=false;
defaultarchivepath:=apdefaultarchivepath;
if mdefaultarchive.checked=true then
   mdefaultarchive.caption:=txt_archive+' > '+txt_2_8_usedefaultoutpath+' '+defaultarchivepath
else
   mdefaultarchive.caption:=txt_archive+' > '+txt_7_6_setdef;
lsetdefaultout_arc.caption:=mdefaultarchive.caption;
//archive_type_select(cbType.Items[apformat]);
cbType.ItemIndex:=apformat; on_cbtypechange;
if apfilters=1 then cbAdvfAdd.State:=cbchecked else cbAdvfAdd.State:=cbunchecked;
if apenum=1 then checkboxenumd.State:=cbchecked else checkboxenumd.State:=cbunchecked; CheckBoxEnumdClick(nil);
if apencext=1 then cbEncExtension.State:=cbchecked else cbEncExtension.State:=cbunchecked; cbencextensionclick(nil);
if apappend=1 then CheckBoxdate.State:=cbchecked else CheckBoxdate.State:=cbunchecked; CheckBoxDateClick(nil);
if apcustext=1 then cbCustomExtension.State:=cbchecked else cbCustomExtension.State:=cbunchecked; cbCustomExtensionClick(nil);
EditCustomExtension.Caption:=apextcapt;
if apverbose=1 then CheckBoxConvertVerbose.State:=cbchecked else CheckBoxConvertVerbose.State:=cbunchecked; on_checkboxconvertVerbose;
CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
if appw=1 then CheckBoxConvertPW.State:=cbchecked else CheckBoxConvertPW.State:=cbunchecked; on_checkboxconvertPW;
CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
cbSplit.ItemIndex:=apsplit;
SpinEditSplit.Value:=apspin;
ComboBoxSplit.ItemIndex:=apsize;
cbSplit_onchange;
level_brotli:=v9b;
level_rar:=v9r;
level_zstd:=v9z;
//7z
level_7z:=vlevel_7z;
level_xz:=vlevel_xz;
level_bzip2:=vlevel_bzip2;
level_gz:=vlevel_gz;
level_zip:=vlevel_zip;
method_7z:=vmethod_7z;
method_zip:=vmethod_zip;
ComboBox7zLevel.Itemindex:=v7z1; on_ComboBoxArchiveCompressionLevelChange;
ComboBox7zMethod.Itemindex:=v7z2; ComboBoxArchive3_onchange;
ComboBox7zDictionary.Itemindex:=v7z3;
ComboBox7zWord.Itemindex:=v7z4;
ComboBox7zPasses.Itemindex:=v7z5;
ComboBox7zSolid.Itemindex:=v7z6;
if v7z7b=1 then CheckBoxSolidExtension.State:=cbchecked else CheckBoxSolidExtension.State:=cbunchecked; CheckboxMQS_onclick;
if v7z7=1 then CheckBox7zOF.State:=cbchecked else CheckBox7zOF.State:=cbunchecked; CheckBoxArchiveOF_onclick;
if v7snoi=1 then Checkboxsnoi.State:=cbchecked else Checkboxsnoi.State:=cbunchecked; CheckBoxsnoi_onclick;
if v7snon=1 then Checkboxsnon.State:=cbchecked else Checkboxsnon.State:=cbunchecked; CheckBoxsnon_onclick;
if v7z8=1 then CheckBox7zSFX.State:=cbchecked else CheckBox7zSFX.State:=cbunchecked;
if v7z15=1 then Checkboxsni.State:=cbchecked else Checkboxsni.State:=cbunchecked; CheckBoxsni_onclick;
if v7z16=1 then Checkboxsns.State:=cbchecked else Checkboxsns.State:=cbunchecked; CheckBoxsns_onclick;
if v7z16a=1 then Checkboxsnh.State:=cbchecked else Checkboxsnh.State:=cbunchecked; CheckBoxsnh_onclick;
if v7z16b=1 then Checkboxsnl.State:=cbchecked else Checkboxsnl.State:=cbunchecked; CheckBoxsnl_onclick;
if v7z17=1 then Checkboxstl.State:=cbchecked else Checkboxstl.State:=cbunchecked; CheckBoxstl_onclick;
if v7z18=1 then Checkboxssp.State:=cbchecked else Checkboxssp.State:=cbunchecked; Checkboxssp_onclick;
if vbr1=1 then CheckBoxBrotli.State:=cbchecked else CheckBoxBrotli.State:=cbunchecked; CheckBoxBrotli_onclick;
if vzst1=1 then CheckBoxZstd.State:=cbchecked else CheckBoxZstd.State:=cbunchecked; CheckBoxZstd_onclick;
RadioGroup7zSFX.Itemindex:=v7z9;
ComboBox7zFun.Itemindex:=v7z10;
cbAct.Itemindex:=ComboBox7zFun.Itemindex;
ComboBox7zThreads.Itemindex:=v7z11; on_ComboBoxArchive8Change;
ComboBox7zMemuse.Itemindex:=v7z11b; on_ComboBoxmemuseChange;
Edit7zOpt.Text:=v7z12;
if v7z13=1 then CheckBoxMailAdd.State:=cbchecked else CheckBoxMailAdd.State:=cbunchecked;
if v7z13b=1 then CheckboxMailKeep.State:=cbchecked else CheckboxMailKeep.State:=cbunchecked;
on_CheckBoxMailKeepClick;
on_CheckBoxArchive4;
Combobox7zalgo.Itemindex:=v7z14; on_ComboBox7zalgochange;
ComboBox7zPaths.Itemindex:=v7zpaths;
ComboBoxtar.Itemindex:=vtartype;
ComboBoxTARTS.Itemindex:=vtartime;
//quad/balz/bcm
radiogroupquad.Itemindex:=vquad1; on_RadioGroupQuadClick;
if vquad2=1 then CheckboxQuadMax.State:=cbchecked else CheckboxQuadMax.State:=cbunchecked; on_CheckBoxQuadMax_click;
//paq
ComboBoxPAQLevel.ItemIndex:=vpaq1; on_ComboBoxPAQ1Change;
ComboBoxPAQThreads.ItemIndex:=vpaq1b; on_ComboBoxPAQ2Change;
RadioGroupPaq.ItemIndex:=vpaq2; on_RadioGroupPaqClick;
//upx
ComboBoxUPX.ItemIndex:=vupx1;
if vupx2=1 then CheckBoxUPXStrip.State:=cbchecked else CheckBoxUPXStrip.State:=cbunchecked;
if vupx3=1 then CheckBoxUPXBackup.State:=cbchecked else CheckBoxUPXBackup.State:=cbunchecked;
//arc
ComboBoxARCLevel.ItemIndex:=varc1; on_ComboBoxARCChange;
ComboBoxARCSolid.ItemIndex:=varc2; on_ComboBoxArcSolidChange;
if varc3=1 then CheckBoxARCrr.State:=cbchecked else CheckBoxARCrr.State:=cbunchecked; on_CheckBoxARC1Click;
if varc3b=1 then CheckBoxARCabs.State:=cbchecked else CheckBoxARCabs.State:=cbunchecked; on_CheckBoxARC3Click;
if varc4=1 then CheckBoxARCsfx.State:=cbchecked else CheckBoxARCsfx.State:=cbunchecked; on_CheckBoxARC2Click;
ComboBoxARCSfx.ItemIndex:=varc5;
ComboBoxARCFun.ItemIndex:=varc6; on_ComboBoxARC2Change;
EditOPARC.Text:=varc7;
ComboBoxARCalgo.ItemIndex:=varc8; on_ComboBoxARCalgoChange;
//split
ComboBoxSplitAlgo.ItemIndex:=vsplit1; ComboBoxSplit3_onchange;
//pea
ComboBoxPEALevel.ItemIndex:=vpea1; ComboBoxPEACompression1_onchange;
ComboBoxPEAObj.ItemIndex:=vpea2; ComboBoxPEA3_onchange;
ComboBoxPEAVol.ItemIndex:=vpea3; ComboBoxPEA4_onchange;
ComboBoxPEAStream.ItemIndex:=vpea4; ComboBoxPEA2_onchange;
ComboBoxPEAKDFw.ItemIndex:=vpea5; ComboBoxKDF1_onchange;
ComboBoxPEAKDF.ItemIndex:=vpea6; ComboBoxKDF_onchange;
//custom
if aprar=1 then cbRAR.State:=cbchecked else cbRAR.State:=cbunchecked; cbRARClick(nil);
if aprar5=1 then cbRAR5.State:=cbchecked else cbRAR5.State:=cbunchecked; cbRAR5Click(nil);
comboRARdict.ItemIndex:=aprardict; comboRARdictChange(nil);
if aprarblake2=1 then cbRARBLAKE2.State:=cbchecked else cbRARBLAKE2.State:=cbunchecked; cbRARBLAKE2Click(nil);
//if aprarmanual=1 then cbRARmanual.State:=cbchecked else cbRARmanual.State:=cbunchecked;
if aprarsfx=1 then cbRARsfx.State:=cbchecked else cbRARsfx.State:=cbunchecked; cbRARsfxClick(nil);
if aprarsolid=1 then cbRARsolid.State:=cbchecked else cbRARsolid.State:=cbunchecked; cbRARsolidClick(nil);
if aprarrr=1 then cbRARrr.State:=cbchecked else cbRARrr.State:=cbunchecked; cbRARrrClick(nil);
seRARrr.Value:=apprarrr; seRARrrChange(nil);
if aprarrv=1 then cbRARrv.State:=cbchecked else cbRARrv.State:=cbunchecked; cbRARrvClick(nil);
seRARrv.Value:=apprarrv; seRARrvChange(nil);
if aprarsaveopen=1 then cbRARsaveopen.State:=cbchecked else cbRARsaveopen.State:=cbunchecked; cbRARsaveopenClick(nil);
if aprarsavesecurity=1 then cbRARsavesecurity.State:=cbchecked else cbRARsavesecurity.State:=cbunchecked; cbRARsavesecurityClick(nil);
if aprarsavestreams=1 then cbRARsavestreams.State:=cbchecked else cbRARsavestreams.State:=cbunchecked; cbRARsavestreamsClick(nil);
cbRARlastmodtime.ItemIndex:=aprarlastmodtime; cbRARlastmodtimeChange(nil);
if aprarlock=1 then cbRARlock.State:=cbchecked else cbRARlock.State:=cbunchecked; cbRARlockClick(nil);
EditNameCustom.Text:=vcustom1;
EditExtensionCustom.Text:=vcustom2;
EditOPCustom.Text:=vcustom3;
ComboBoxArchiveCustom.ItemIndex:=vcustom4; on_ComboBoxArchiveCustomChange;
cbDeleteInputModeAdd.ItemIndex:=apdelete; on_cbdeleteinputmode1Change;
if apdopt=1 then CheckBoxDeleteInputAdd.State:=cbchecked else CheckBoxDeleteInputAdd.State:=cbunchecked; on_CheckBoxDeleteInputAddClick;
restorecustlist;
end;
end;

procedure savestatus_extractor;
begin
with FormPeach do
begin
if CheckBoxrelative.State=cbchecked then vopt4f:=1 else vopt4f:=0;
if CheckBoxFolder.State=cbchecked then epfolder:=1
else epfolder:=0;
if mdefaultextract.checked=true then epdefault:=1
else epdefault:=0;
epdefaultextractpath:=defaultextractpath;
epextract:=ComboBoxActionExtract.ItemIndex;
epskip:=Comboboxoverwrite.ItemIndex;
epdelete:=cbDeleteInputModeExt.ItemIndex;
if CheckBoxDeleteInputExt.checked=true then epdopt:=1
else epdopt:=0;
if cbAdvfExt.State=cbchecked then epfilters:=1
else epfilters:=0;
eparcextract:=ComboBoxActionArc.ItemIndex;
eparcskip:=ComboboxoverwriteArc.ItemIndex;
epaceextract:=CheckBoxExtActionAdv.ItemIndex;
if CheckBoxExtNotArchives.State=cbchecked then epsupp:=1
else epsupp:=0;
if CheckBoxsniExt.State=cbchecked then epsni:=1
else epsni:=0;
if CheckBoxsnsExt.State=cbchecked then epsns:=1
else epsns:=0;
if CheckBoxsnzExt.State=cbchecked then epsnz:=1
else epsnz:=0;
if CheckBoxZstdErrPolicy.State=cbchecked then ezstderr:=1
else ezstderr:=0;
if CheckBoxzpaqall.State=cbchecked then epzall:=1
else epzall:=0;
if CheckBoxzpaqfull.State=cbchecked then epzfull:=1
else epzfull:=0;
if CheckBoxzpaqabsolute.State=cbchecked then epzabs:=1
else epzabs:=0;
if CheckBoxzpaqforce.State=cbchecked then epzfor:=1
else epzfor:=0;
if CheckBoxExtUnsupported.State=cbchecked then epunsupp:=1
else epunsupp:=0;
if CheckBoxExtUnsupportedPeaZip.State=cbchecked then epunsupp1:=1
else epunsupp1:=0;
vexpaths:=ComboBoxArchivePathsExt.ItemIndex;
vexcustom1:=EditNameCustomExt.Text;
vexcustom2:=EditCustomParamExt.Text;
vexcustom3:=ComboBoxCustomSyntaxExt.ItemIndex;
savecustlist;
end;
end;

function getextcaption:ansistring;
begin
with FormPeach do
begin
if tonewfolder=0 then
   if movetorelativepath=1 then result:=txt_caption_extract
   else result:=ComboBoxOverwrite.Caption
else
   if removeintdir=1 then result:=txt_5_5_intdir
   else result:=txt_newfoldermenu;
end;
end;

procedure on_CheckBoxFolderClick;
begin
if FormPeach.CheckBoxFolder.state=cbChecked then tonewfolder:=1
else tonewfolder:=0;
FormPeach.Caption:=getextcaption;
updateconf_modified;
settonewfolder(tonewfolder);
end;

procedure on_radiogroupactionchange;
begin
extaction7z:=FormPeach.ComboBoxActionExtract.ItemIndex;
updateconf_modified;
end;

procedure on_ComboBoxOverwriteChange;
begin
extopt7z:=FormPeach.ComboBoxOverwrite.ItemIndex;
FormPeach.Caption:=getextcaption;
updateconf_modified;
end;

procedure on_RadioGroupActionArcChange;
begin
extactionarc:=FormPeach.ComboBoxActionArc.ItemIndex;
updateconf_modified;
end;

procedure on_ComboBoxOverwriteARCChange;
begin
extoptarc:=FormPeach.ComboBoxOverwriteARC.ItemIndex;
updateconf_modified;
end;

procedure on_RadioGroupAction1Change;
begin
extactionace:=FormPeach.CheckBoxExtActionAdv.ItemIndex;
updateconf_modified;
end;

procedure on_CheckBox1Click;
begin
if FormPeach.CheckBoxExtNotArchives.state=cbChecked then esna:=1
else esna:=0;
updateconf_modified;
end;

procedure on_CheckBox2Click;
begin
if FormPeach.CheckBoxExtUnsupported.state=cbChecked then euns:=1
else euns:=0;
updateconf_modified;
end;

procedure on_CheckBox3Click;
begin
if FormPeach.CheckBoxExtUnsupportedPeaZip.state=cbChecked then euns1:=1
else euns1:=0;
updateconf_modified;
end;

procedure on_cbdeleteinputmodeChange;
begin
favdelete:=FormPeach.cbDeleteInputModeExt.ItemIndex;
FormPeach.cbDeleteInputModeAdd.ItemIndex:=FormPeach.cbDeleteInputModeExt.ItemIndex;
end;

procedure on_CheckBoxFolder1_click;
begin
if FormPeach.CheckBoxSmartFolder.State=cbChecked then removeintdir:=1 else removeintdir:=0;
FormPeach.CheckBoxIntDir.State:=FormPeach.CheckBoxSmartFolder.State;
if removeintdir=1 then FormPeach.pmqnointdir.Checked:=true else FormPeach.pmqnointdir.Checked:=false;
updateconf_modified;
end;

procedure on_checkboxrelativeclick;
begin
if FormPeach.CheckBoxrelative.State=cbChecked then movetorelativepath:=1 else movetorelativepath:=0;
if (FormPeach.CheckBoxrelative.State=cbChecked) and (FormPeach.CheckBoxrelative.enabled=true) then
   begin
   FormPeach.Labelsetwork.enabled:=true;
   end
else
   begin
   willbemoved:=false;
   forcewillbemoved:=false;
   moverelpath:='';
   move_out_param:='';
   FormPeach.Labelsetwork.enabled:=false;
   end;
FormPeach.Caption:=getextcaption;
end;

procedure restorestatus_extractor;
begin
with FormPeach do
begin
CheckBoxAutoHaltE.State:=cbUnchecked;
if epfolder=1 then CheckBoxFolder.State:=cbchecked
else CheckBoxFolder.State:=cbunchecked; on_CheckBoxFolderClick;
if vopt4f=1 then CheckBoxrelative.State:=cbchecked
else CheckBoxrelative.State:=cbunchecked; on_CheckBoxrelativeclick;
if epdefault=1 then mdefaultextract.checked:=true
else mdefaultextract.checked:=false;
if epdefault=1 then pmusedefault.checked:=true
else pmusedefault.checked:=false;
defaultextractpath:=epdefaultextractpath;
if mdefaultextract.checked=true then
   begin
   mdefaultextract.caption:=txt_caption_extract+' > '+txt_2_8_usedefaultoutpath+' '+defaultextractpath;
   end
else
   begin
   mdefaultextract.caption:=txt_caption_extract+' > '+txt_7_6_setdef;
   end;
pmusedefault.caption:=mdefaultextract.caption;
lsetdefaultout_ext.caption:=mdefaultextract.caption;
ComboBoxActionExtract.ItemIndex:=epextract; on_radiogroupactionchange;
Comboboxoverwrite.ItemIndex:=epskip; on_ComboBoxOverwriteChange;
cbDeleteInputModeExt.ItemIndex:=epdelete; on_cbdeleteinputmodeChange;
if epdopt=1 then CheckBoxDeleteInputExt.checked:=true
else CheckBoxDeleteInputExt.checked:=false; on_CheckBoxDeleteInputClick;
if epfilters=1 then cbAdvfExt.State:=cbchecked
else cbAdvfExt.State:=cbunchecked;
ComboBoxActionArc.ItemIndex:=eparcextract; on_RadioGroupActionArcChange;
ComboboxoverwriteArc.ItemIndex:=eparcskip; on_ComboboxoverwriteArcChange;
CheckBoxExtActionAdv.ItemIndex:=epaceextract; on_RadioGroupAction1Change;
if epsupp=1 then CheckBoxExtNotArchives.State:=cbchecked
else CheckBoxExtNotArchives.State:=cbunchecked; on_CheckBox1Click;
if epsni=1 then CheckBoxsniExt.State:=cbchecked
else CheckBoxsniExt.State:=cbunchecked; CheckBoxsniExt_onclick;
if epsns=1 then CheckBoxsnsExt.State:=cbchecked
else CheckBoxsnsExt.State:=cbunchecked; CheckBoxsnsExt_onclick;
if epsnz=1 then CheckBoxsnzExt.State:=cbchecked
else CheckBoxsnzExt.State:=cbunchecked; CheckBoxsnzExt_onclick;
if ezstderr=1 then CheckBoxZstdErrPolicy.State:=cbchecked
else CheckBoxZstdErrPolicy.State:=cbunchecked; CheckBoxZstdErrPolicy_onclick;
if epzall=1 then CheckBoxzpaqall.State:=cbchecked
else CheckBoxzpaqall.State:=cbunchecked; CheckBoxzpaqallClick(nil);
if epzfull=1 then CheckBoxzpaqfull.State:=cbchecked
else CheckBoxzpaqfull.State:=cbunchecked; CheckBoxzpaqfullClick(nil);
if epzabs=1 then CheckBoxzpaqabsolute.State:=cbchecked
else CheckBoxzpaqabsolute.State:=cbunchecked; CheckBoxzpaqabsoluteClick(nil);
if epzfor=1 then CheckBoxzpaqforce.State:=cbchecked
else CheckBoxzpaqforce.State:=cbunchecked; CheckBoxzpaqforceClick(nil);
if epunsupp=1 then CheckBoxExtUnsupported.State:=cbchecked
else CheckBoxExtUnsupported.State:=cbunchecked; on_CheckBox2Click;
if epunsupp1=1 then CheckBoxExtUnsupportedPeaZip.State:=cbchecked
else CheckBoxExtUnsupportedPeaZip.State:=cbunchecked; on_CheckBox3Click;
ComboBoxArchivePathsExt.ItemIndex:=vexpaths;
EditNameCustomExt.Text:=vexcustom1;
EditCustomParamExt.Text:=vexcustom2;
ComboBoxCustomSyntaxExt.ItemIndex:=vexcustom3;
restorecustlist;
end;
end;

procedure savestatus_defaults;
begin
with FormPeach do
begin
vopt1:=EditDesk.Caption;
vopt1b:=EditEncoding.Caption;
vopt1c:=FormPeach.Editalias.Caption;
vopt2:=cbBinaries.ItemIndex;
vopt3:=cbBinariesStop.ItemIndex;
voptlibre:=ComboBoxLibre.ItemIndex;
voptprivacy:=ComboBoxPrivacy.ItemIndex;
if CheckBoxSkipenc.State=cbchecked then vopt4g:=1 else vopt4g:=0;
if CheckBoxSmartFolder.State=cbchecked then epfolder1:=1 else epfolder1:=0;
if cbtimecreated.State=cbchecked then v7z17c:=1 else v7z17c:=0;
if CheckBoxnameasparentfolder.State=cbchecked then vopt4c:=1 else vopt4c:=0;
if CheckBoxAutoOpen.State=cbchecked then vopt4:=1 else vopt4:=0;
if CheckBoxAutoTest.State=cbchecked then vopt4h:=1 else vopt4h:=0;
if CheckBoxClosePeaZip.State=cbchecked then vopt4d:=1 else vopt4d:=0;
if CheckBoxDragDrop.State=cbchecked then vopt5e:=1 else vopt5e:=0;
if CheckBoxEditArchives.State=cbchecked then vopt5f:=1 else vopt5f:=0;
vopt5f1:=ComboBoxSysbin.ItemIndex;
if CheckBoxShowVolatile.State=cbchecked then vopt5b:=1 else vopt5b:=0;
if CheckBoxAutoOpenTar.State=cbchecked then vopt5g:=1 else vopt5g:=0;
if cbqdup.State=cbchecked then vopt5dup:=1 else vopt5dup:=0;
if cbshowhidden.State=cbchecked then vopt5dsh:=1 else vopt5dsh:=0;
if CheckBoxAutoExtTar.State=cbchecked then vopt5gtar:=1 else vopt5gtar:=0;
if CheckBoxAutoExtTarConvert.State=cbchecked then vopt5gtar1:=1 else vopt5gtar1:=0;
if CheckBoxNoConf.State=cbchecked then vopt5h:=1 else vopt5h:=0;
if CheckBoxzipxswitch.State=cbchecked then vopt5sw:=1 else vopt5sw:=0;
if CheckBoxAC.State=cbchecked then vopt5ca:=1 else vopt5ca:=0;
if CheckBoxForceOpen.State=cbchecked then vopt5c:=1 else vopt5c:=0;
if CheckBoxForceEdit.State=cbchecked then vopt5d:=1 else vopt5d:=0;
vopt5dt:=cbforcetype.ItemIndex;
if CheckBoxExcludeEF.State=cbchecked then vopt5d4:=1 else vopt5d4:=0;
if CheckBoxUTC.State=cbchecked then vopt5utc:=1 else vopt5utc:=0;
if CheckBoxForceLayout.State=cbchecked then vopt5d3:=1 else vopt5d3:=0;
vopt5d3t:=LabelForceLayout.Caption;
if CheckBoxForceBrowse.State=cbchecked then vopt5d1:=1 else vopt5d1:=0;
if CheckBoxForceConvert.State=cbchecked then vopt5d2:=1 else vopt5d2:=0;
if CheckBoxEncoding.State=cbchecked then vopt6:=1 else vopt6:=0;
vopt23:=cbEncoding.ItemIndex;
vopt23b:=ComboBoxSyntaxLevel.ItemIndex;
vopt24:=cbtree.ItemIndex;
vopt24c:=cbautobrowsetar.ItemIndex;
vopt24b:=cbdefaultaction.ItemIndex;
vopt7:=ComboBoxConsoleEncoding.ItemIndex;
vopt7b:=ComboboxSD.ItemIndex;
vopt7c:=LabelcbSDcustom.Caption;
if CheckBoxParallelArchiving.State=cbchecked then vopt8:=1 else vopt8:=0;
if CheckBoxArchiveHistory.State=cbchecked then vopt9:=1 else vopt9:=0;
if CheckBoxShowHints.State=cbchecked then vopt10:=1 else vopt10:=0;
if CheckBoxzcopy.State=cbchecked then vopt11:=1 else vopt11:=0;
vopt12:=ComboBoxWD.ItemIndex;
vopt12t:=custom_work_path;
vopt13:=cbDefaultFormat.ItemIndex;
voptts:=cbTimeStamp.ItemIndex;
vopt15c:=ComboBoxBrowser.ItemIndex;
vopt15h:=ComboBoxMaxArg.ItemIndex;
vopt15gg:=ComboBoxVirtual.ItemIndex;
vopt15g:=ComboBoxPriority.ItemIndex;
vopt15f:=ComboBoxDrag.ItemIndex;
if CheckBoxBrowseNotVerbose.State=cbchecked then vopt15d:=1 else vopt15d:=0;
if CheckBoxSkipDel.State=cbchecked then vopt15i:=1 else vopt15i:=0;
if CheckBoxLimitKFSize.State=cbchecked then vopt15i2:=1 else vopt15i2:=0;
if CheckBox7zunrar5.State=cbchecked then vopt15e:=1 else vopt15e:=0;
if CheckBoxParams.State=cbchecked then vopt15e3:=1 else vopt15e3:=0;
if CheckBoxBackground.State=cbchecked then vopt15e4:=1 else vopt15e4:=0;
if CheckBoxLog.State=cbchecked then vopt15e5:=1 else vopt15e5:=0;
if CheckBoxExtrac32.State=cbchecked then vopt15e2:=1 else vopt15e2:=0;
if CheckBoxIgnoreDisp.State=cbchecked then vopt17:=1 else vopt17:=0;
if CheckBoxIntDir.State=cbchecked then vopt25:=1 else vopt25:=0;
if CheckBoxIgnoreSel.State=cbchecked then vopt18:=1 else vopt18:=0;
if CheckBoxExtAnd.State=cbchecked then vopt18b:=1 else vopt18b:=0;
if CheckBoxIgnorePaths.State=cbchecked then vopt19:=1 else vopt19:=0;
if cbautoclosesingleextract.State=cbchecked then vopt19b:=1 else vopt19b:=0;
vopt19c:=cbExtEvForWhen.ItemIndex;
vopt19csec:=ComboBoxsec.ItemIndex;
vopt19d:=cbExtEvForHow.ItemIndex;
vopt19e:=editExtEvForWhat.Caption;
vopt19esec:=editExtEvForSec.Caption;
vopt19f:=Editcommonalgo.Caption;
vopt20:=cbHashFormat.ItemIndex;
vopt20b:=cbBrowserHash.ItemIndex;
vopt21:=cbHash.ItemIndex;
vopt22:=ComboBoxPasses.ItemIndex;
vopt22b:=ComboBoxKiB.ItemIndex;
vopt22c:=cbmiddlebutton.ItemIndex;
end;
end;

procedure on_RadioGroup4Change;
begin
zaout:=FormPeach.cbBinaries.ItemIndex;
zaout1:=zaout;
end;

procedure on_RadioGroup6Change;
begin
autoclosegwrap:=FormPeach.cbBinariesStop.ItemIndex;
end;

procedure on_CheckBoxEncodingClick;
begin
if FormPeach.CheckBoxEncoding.State=cbChecked then archivenameenc:=1 else archivenameenc:=0;
end;

procedure on_ComboBox1Change;
begin
enc7zscc:=FormPeach.ComboBoxConsoleEncoding.ItemIndex;
end;

procedure on_ComboBoxSyntaxLevelChange;
begin
syntaxlevel7z:=FormPeach.ComboBoxSyntaxLevel.ItemIndex;
setsyntaxstring7z;
end;

procedure on_ComboBoxSDChange;
begin
browsersd:=FormPeach.ComboBoxSD.ItemIndex;
browsersdir:='';
if browsersd=4 then
   if FormPeach.SelectDirectoryDialog1.Execute then
      if FormPeach.SelectDirectoryDialog1.FileName<>'' then
         browsersdir:=FormPeach.SelectDirectoryDialog1.FileName
      else
         begin
         FormPeach.ComboBoxSD.ItemIndex:=0;
         on_ComboBoxSDChange;
         end
   else
      begin
      FormPeach.ComboBoxSD.ItemIndex:=0;
      on_ComboBoxSDChange;
      end;
FormPeach.LabelcbSDcustom.Caption:=browsersdir;
end;

procedure on_CheckBoxArchiveHistory_click;
begin
if FormPeach.CheckBoxArchiveHistory.State=cbChecked then savehistory:=1 else savehistory:=0;
if savehistory=1 then FormPeach.LabelResetHistory.enabled:=true else FormPeach.LabelResetHistory.enabled:=false;
end;

procedure on_CheckBoxShowHintsClick;
begin
if FormPeach.CheckBoxShowHints.State=cbChecked then showguihints:=1 else showguihints:=0;
end;

procedure on_ComboBoxWDChange;
begin
work_dir:=FormPeach.ComboBoxWD.ItemIndex;
end;

procedure on_CheckBoxzcopyClick;
begin
if FormPeach.CheckBoxzcopy.State=cbChecked then zcopy:=1 else zcopy:=0;
end;

procedure on_CheckBoxParallelArchivingClick;
begin
if FormPeach.CheckBoxParallelarchiving.State=cbChecked then parallelarchive:=1 else parallelarchive:=0;
end;

procedure on_RadioGroup0Change;
begin
df:=FormPeach.cbDefaultFormat.ItemIndex;
archive_type_selected:=-1;
end;

procedure on_cbforcetypeChange;
begin
forcetype:=FormPeach.cbforcetype.ItemIndex;
end;

procedure on_cbExtEvForWhenChange;
begin
whenspecialopen:=FormPeach.cbExtEvForWhen.ItemIndex;
if whenspecialopen=0 then
   begin
   FormPeach.cbExtEvForHow.enabled:=false;
   FormPeach.editExtEvForWhat.enabled:=false;
   end
else
   begin
   FormPeach.cbExtEvForHow.enabled:=true;
   FormPeach.editExtEvForWhat.enabled:=true;
   end;
end;

procedure on_cbExtEvForHowChange;
begin
howspecialopen:=FormPeach.cbExtEvForHow.ItemIndex;
end;

procedure on_RadioGroupTSClick;
begin
tsstyle:=FormPeach.cbTimeStamp.ItemIndex;
end;

procedure on_CheckBoxSkipDel_click;
begin
if FormPeach.CheckBoxSkipDel.State=cbChecked then skipdel:=1 else skipdel:=0;
end;

procedure on_CheckBoxLimitKFSize_click;
begin
if FormPeach.CheckBoxLimitKFSize.State=cbChecked then kflimit:=1 else kflimit:=0;
UnitKF.dkflimit:=kflimit;
end;

procedure on_CheckBoxBrowseNotVerbose_click;
begin
if FormPeach.CheckBoxBrowseNotVerbose.State=cbChecked then nonverboselog:=1 else nonverboselog:=0;
end;

procedure setmaxndirtree;
begin
//limit treeview representation to a reasonable workload even in always pre-parse mode
case prebrowse of
   0,1: maxndirtree:=4096;
   2: maxndirtree:=3072;
   3,4,5: maxndirtree:=2048;
end;
end;

procedure on_CheckBoxPrebrowse_click;
begin
prebrowse:=FormPeach.ComboBoxBrowser.ItemIndex;
setmaxndirtree;
end;

procedure on_CheckBoxmaxarg_click;
begin
maxargsize:=FormPeach.ComboBoxMaxArg.ItemIndex;
{$IFDEF MSWINDOWS}
//Windows handle up to 32KB maximum command line length
max_cl:=32768;
{$ELSE}
//32KB to 2MB custom maximum command line length is now supported for Linux Systems
max_cl:=131072;
case maxargsize of
   0: max_cl:=32*1024;
   1: max_cl:=64*1024;
   2: max_cl:=128*1024;
   3: max_cl:=256*1024;
   4: max_cl:=512*1024;
   5: max_cl:=1024*1024;
   6: max_cl:=1536*1024;
   7: max_cl:=2048*1024;
end;
{$ENDIF}
end;

procedure on_comboboxvirtualchange;
begin
virtualopt:=FormPeach.ComboBoxVirtual.ItemIndex;
case virtualopt of
   0: begin
      defaultvirtualopt;
      end;
   1: begin allowvirtual:=1; sizevirtual:=0; end;
   2: begin allowvirtual:=1; sizevirtual:=4; end;
   3: begin allowvirtual:=1; sizevirtual:=8; end;
   4: begin allowvirtual:=1; sizevirtual:=16; end;
   5: begin allowvirtual:=0; sizevirtual:=0; end;
   end;
end;

procedure on_comboboxprioritychange;
begin
taskpriority:=FormPeach.ComboBoxPriority.ItemIndex;
end;

procedure on_CheckBoxDrag_click;
begin
dragtargetprotect:=FormPeach.ComboBoxDrag.ItemIndex;
end;

procedure on_CheckBoxIgnoreDisp_click;
begin
if FormPeach.CheckBoxIgnoreDisp.State=cbChecked then ignorepathdisp:=1 else ignorepathdisp:=0;
end;

procedure on_CheckBoxIgnoreSel_click;
begin
if FormPeach.CheckBoxIgnoreSel.State=cbChecked then ignorepathsel:=1 else ignorepathsel:=0;
end;

procedure on_CheckBoxExtAnd_click;
begin
if FormPeach.CheckBoxExtAnd.State=cbChecked then enableextand:=1 else enableextand:=0;
if enableextand=1 then FormPeach.MenuItemOpen_extandopenwith.Visible:=true
else FormPeach.MenuItemOpen_extandopenwith.Visible:=false;
end;

procedure on_CheckBoxIntDir_click;
begin
if FormPeach.CheckBoxIntDir.State=cbChecked then removeintdir:=1 else removeintdir:=0;
FormPeach.CheckBoxSmartFolder.State:=FormPeach.CheckBoxIntDir.State;
if removeintdir=1 then FormPeach.pmqnointdir.Checked:=true else FormPeach.pmqnointdir.Checked:=false;
end;

procedure on_CheckBox4_click;
begin
if FormPeach.CheckBoxIgnorePaths.State=cbChecked then ignorepathextand:=1 else ignorepathextand:=0;
end;

procedure on_RadioGroup1Click;
begin
algodisp:=FormPeach.cbHashFormat.ItemIndex;
end;

procedure on_RadioGroup2Click;
begin
setbrowser_crchash(FormPeach.cbBrowserHash.ItemIndex+1);
end;

procedure on_cbmiddlebuttonClick;
begin
mbaction:=FormPeach.cbmiddlebutton.ItemIndex;
end;

procedure on_cbcheckallClick;
begin
algoall:=FormPeach.cbHash.ItemIndex;
if algoall=0 then
   begin
   FormPeach.LabelCommonAlgo.Enabled:=true;
   FormPeach.Editcommonalgo.Enabled:=true;
   end
else
   begin
   FormPeach.LabelCommonAlgo.Enabled:=false;
   FormPeach.Editcommonalgo.Enabled:=false;
   end;
end;

procedure on_ComboBoxKiBChange;
begin
filesizebase:=FormPeach.ComboBoxKiB.ItemIndex;
end;

procedure on_ComboBoxPassesChange;
begin
erasepasses:=FormPeach.ComboBoxPasses.ItemIndex;
end;

procedure setzencoding;
begin
FormPeach.zenclocalutf8.checked:=false;
FormPeach.zencutf8.checked:=false;
FormPeach.zenclocal.checked:=false;
FormPeach.zenc437.checked:=false;
FormPeach.zenc850.checked:=false;
FormPeach.zenc852.checked:=false;
FormPeach.zenc858.checked:=false;
FormPeach.zenc866.checked:=false;
FormPeach.zenc874.checked:=false;
FormPeach.zenc932.checked:=false;
FormPeach.zenc936.checked:=false;
FormPeach.zenc949.checked:=false;
FormPeach.zenc950.checked:=false;
FormPeach.zenc1250.checked:=false;
FormPeach.zenc1251.checked:=false;
FormPeach.zenc1252.checked:=false;
FormPeach.zenc1253.checked:=false;
FormPeach.zenc1254.checked:=false;
FormPeach.zenc1255.checked:=false;
FormPeach.zenc1256.checked:=false;
FormPeach.zenc1257.checked:=false;
FormPeach.zenc1258.checked:=false;
FormPeach.zenc20866.checked:=false;
FormPeach.zenc21866.checked:=false;
FormPeach.zenc65001.checked:=false;
case mcuzip of
   0: FormPeach.zenclocalutf8.checked:=true;
   1: FormPeach.zencutf8.checked:=true;
   2: FormPeach.zenclocal.checked:=true;
   3: case FormPeach.editencoding.Caption of
      '437': FormPeach.zenc437.checked:=true;
      '850': FormPeach.zenc850.checked:=true;
      '852': FormPeach.zenc852.checked:=true;
      '858': FormPeach.zenc858.checked:=true;
      '866': FormPeach.zenc866.checked:=true;
      '874': FormPeach.zenc874.checked:=true;
      '932': FormPeach.zenc932.checked:=true;
      '936': FormPeach.zenc936.checked:=true;
      '949': FormPeach.zenc949.checked:=true;
      '950': FormPeach.zenc950.checked:=true;
      '1250': FormPeach.zenc1250.checked:=true;
      '1251': FormPeach.zenc1251.checked:=true;
      '1252': FormPeach.zenc1252.checked:=true;
      '1253': FormPeach.zenc1253.checked:=true;
      '1254': FormPeach.zenc1254.checked:=true;
      '1255': FormPeach.zenc1255.checked:=true;
      '1256': FormPeach.zenc1256.checked:=true;
      '1257': FormPeach.zenc1257.checked:=true;
      '1258': FormPeach.zenc1258.checked:=true;
      '20866': FormPeach.zenc20866.checked:=true;
      '21866': FormPeach.zenc21866.checked:=true;
      '65001': FormPeach.zenc65001.checked:=true;
      end;
   end;
FormPeach.mzenclocalutf8.checked:=false;
FormPeach.mzencutf8.checked:=false;
FormPeach.mzenclocal.checked:=false;
FormPeach.mzenc437.checked:=false;
FormPeach.mzenc850.checked:=false;
FormPeach.mzenc852.checked:=false;
FormPeach.mzenc858.checked:=false;
FormPeach.mzenc866.checked:=false;
FormPeach.mzenc874.checked:=false;
FormPeach.mzenc932.checked:=false;
FormPeach.mzenc936.checked:=false;
FormPeach.mzenc949.checked:=false;
FormPeach.mzenc950.checked:=false;
FormPeach.mzenc1250.checked:=false;
FormPeach.mzenc1251.checked:=false;
FormPeach.mzenc1252.checked:=false;
FormPeach.mzenc1253.checked:=false;
FormPeach.mzenc1254.checked:=false;
FormPeach.mzenc1255.checked:=false;
FormPeach.mzenc1256.checked:=false;
FormPeach.mzenc1257.checked:=false;
FormPeach.mzenc1258.checked:=false;
FormPeach.mzenc20866.checked:=false;
FormPeach.mzenc21866.checked:=false;
FormPeach.mzenc65001.checked:=false;
case mcuzip of
   0: FormPeach.mzenclocalutf8.checked:=true;
   1: FormPeach.mzencutf8.checked:=true;
   2: FormPeach.mzenclocal.checked:=true;
   3: case FormPeach.editencoding.Caption of
      '437': FormPeach.mzenc437.checked:=true;
      '850': FormPeach.mzenc850.checked:=true;
      '852': FormPeach.mzenc852.checked:=true;
      '858': FormPeach.mzenc858.checked:=true;
      '866': FormPeach.mzenc866.checked:=true;
      '874': FormPeach.mzenc874.checked:=true;
      '932': FormPeach.mzenc932.checked:=true;
      '936': FormPeach.mzenc936.checked:=true;
      '949': FormPeach.mzenc949.checked:=true;
      '950': FormPeach.mzenc950.checked:=true;
      '1250': FormPeach.mzenc1250.checked:=true;
      '1251': FormPeach.mzenc1251.checked:=true;
      '1252': FormPeach.mzenc1252.checked:=true;
      '1253': FormPeach.mzenc1253.checked:=true;
      '1254': FormPeach.mzenc1254.checked:=true;
      '1255': FormPeach.mzenc1255.checked:=true;
      '1256': FormPeach.mzenc1256.checked:=true;
      '1257': FormPeach.mzenc1257.checked:=true;
      '1258': FormPeach.mzenc1258.checked:=true;
      '20866': FormPeach.mzenc20866.checked:=true;
      '21866': FormPeach.mzenc21866.checked:=true;
      '65001': FormPeach.mzenc65001.checked:=true;
      end;
   end;
FormPeach.azenclocalutf8.checked:=false;
FormPeach.azencutf8.checked:=false;
FormPeach.azenclocal.checked:=false;
FormPeach.azenc437.checked:=false;
FormPeach.azenc850.checked:=false;
FormPeach.azenc852.checked:=false;
FormPeach.azenc858.checked:=false;
FormPeach.azenc866.checked:=false;
FormPeach.azenc874.checked:=false;
FormPeach.azenc932.checked:=false;
FormPeach.azenc936.checked:=false;
FormPeach.azenc949.checked:=false;
FormPeach.azenc950.checked:=false;
FormPeach.azenc1250.checked:=false;
FormPeach.azenc1251.checked:=false;
FormPeach.azenc1252.checked:=false;
FormPeach.azenc1253.checked:=false;
FormPeach.azenc1254.checked:=false;
FormPeach.azenc1255.checked:=false;
FormPeach.azenc1256.checked:=false;
FormPeach.azenc1257.checked:=false;
FormPeach.azenc1258.checked:=false;
FormPeach.azenc20866.checked:=false;
FormPeach.azenc21866.checked:=false;
FormPeach.azenc65001.checked:=false;
case mcuzip of
   0: FormPeach.azenclocalutf8.checked:=true;
   1: FormPeach.azencutf8.checked:=true;
   2: FormPeach.azenclocal.checked:=true;
   3: case FormPeach.editencoding.Caption of
      '437': FormPeach.azenc437.checked:=true;
      '850': FormPeach.azenc850.checked:=true;
      '852': FormPeach.azenc852.checked:=true;
      '858': FormPeach.azenc858.checked:=true;
      '866': FormPeach.azenc866.checked:=true;
      '874': FormPeach.azenc874.checked:=true;
      '932': FormPeach.azenc932.checked:=true;
      '936': FormPeach.azenc936.checked:=true;
      '949': FormPeach.azenc949.checked:=true;
      '950': FormPeach.azenc950.checked:=true;
      '1250': FormPeach.azenc1250.checked:=true;
      '1251': FormPeach.azenc1251.checked:=true;
      '1252': FormPeach.azenc1252.checked:=true;
      '1253': FormPeach.azenc1253.checked:=true;
      '1254': FormPeach.azenc1254.checked:=true;
      '1255': FormPeach.azenc1255.checked:=true;
      '1256': FormPeach.azenc1256.checked:=true;
      '1257': FormPeach.azenc1257.checked:=true;
      '1258': FormPeach.azenc1258.checked:=true;
      '20866': FormPeach.azenc20866.checked:=true;
      '21866': FormPeach.azenc21866.checked:=true;
      '65001': FormPeach.azenc65001.checked:=true;
      end;
   end;
end;

procedure on_CBEncoding1Change;
begin
mcuzip:=FormPeach.cbEncoding.ItemIndex;
if FormPeach.cbEncoding.ItemIndex=3 then FormPeach.EditEncoding.Visible:=true else FormPeach.EditEncoding.Visible:=false;
setzencoding;
end;

procedure on_CheckBoxnameasparentfolderclick;
begin
if FormPeach.CheckBoxNameAsParentFolder.State=cbChecked then nameaspartent:=1 else nameaspartent:=0;
end;

procedure on_ComboBoxLibreChange;
begin
libre_directive:=FormPeach.ComboBoxLibre.ItemIndex;
end;

procedure on_ComboBoxPrivacyChange;
begin
privacy_mode:=FormPeach.ComboBoxPrivacy.ItemIndex;
end;

procedure on_CheckBoxExtrac32_click;
begin
if FormPeach.CheckBoxExtrac32.State=cbChecked then useextrac32:=1 else useextrac32:=0;
end;

procedure on_CheckBox7zunrar5_click;
begin
if FormPeach.CheckBox7zunrar5.State=cbChecked then use7zunrar5:=1 else use7zunrar5:=0;
end;

procedure on_CheckBoxParams_click;
begin
if FormPeach.CheckBoxParams.State=cbChecked then pmode:=1 else pmode:=0;
list_utils.pmode:=pmode;
end;

procedure on_CheckBoxBackground_click;
begin
if FormPeach.CheckBoxBackground.State=cbChecked then executesmallbk:=1 else executesmallbk:=0;
end;

procedure setlogcommands;
begin
list_utils.logcommands:=logcommands;
if logcommands=1 then Formpeach.mlog.Visible:=true
else Formpeach.mlog.Visible:=false;
Formpeach.Separator48.Visible:=Formpeach.mlog.Visible;
end;

procedure on_CheckBoxLog_click;
begin
if FormPeach.CheckBoxLog.State=cbChecked then logcommands:=1 else logcommands:=0;
setlogcommands;
end;

procedure settabs;
begin
if (alttabstyle=2) or (alttabstyle=5) then tablabelheight:=30
else tablabelheight:=24;
tablabelheight:=(tablabelheight*qscale) div 100;
settabsstyled;
end;

procedure on_CheckBoxShowVolatileClick;
begin
if FormPeach.CheckBoxShowVolatile.State=cbChecked then showvolatile:=1 else showvolatile:=0;
setshowvolatile;
end;

procedure on_CheckBoxForceOpenClick;
begin
if FormPeach.CheckBoxForceOpen.State=cbChecked then tryopenwerrors:=1 else tryopenwerrors:=0;
end;

procedure on_CheckBoxForceBrowseClick;
begin
if FormPeach.CheckBoxForceBrowse.State=cbChecked then forcebrowse:=1 else forcebrowse:=0;
end;

procedure on_CheckBoxForceConvertClick;
begin
if FormPeach.CheckBoxForceConvert.State=cbChecked then forceconvert:=1 else forceconvert:=0;
end;

procedure on_CheckBoxForceLayoutClick;
begin
if FormPeach.CheckBoxForceLayout.State=cbChecked then forcelayout:=1 else forcelayout:=0;
if forcelayout=0 then
   begin
   FormPeach.LabelForceLayout.Caption:='';
   end;
end;

procedure on_CheckBoxForceEditClick;
begin
if FormPeach.CheckBoxForceEdit.State=cbChecked then forcecanbechanged:=1 else forcecanbechanged:=0;
if forcecanbechanged=1 then FormPeach.cbforcetype.enabled:=true else FormPeach.cbforcetype.enabled:=false;
end;

procedure on_CheckBoxExcludeEFClick;
begin
if FormPeach.CheckBoxExcludeEF.State=cbChecked then excludeef:=1 else excludeef:=0;
end;

procedure on_checkboxutcclick;
begin
if FormPeach.CheckBoxUTC.State=cbChecked then tsutc:=1 else tsutc:=0;
end;

procedure on_CheckBoxNoConfClick;
begin
if FormPeach.CheckBoxNoConf.State=cbChecked then noconfdel:=1 else noconfdel:=0;
end;

procedure on_cbautoclosesingleextract_click;
begin
if FormPeach.cbautoclosesingleextract.State=cbChecked then closeonsingleextract:=1 else closeonsingleextract:=0;
end;

procedure on_cbtreechange;
begin
ptsync:=FormPeach.cbtree.ItemIndex;
end;

procedure on_cbdefaultactionchange;
begin
defaultactionst:=FormPeach.cbdefaultaction.ItemIndex;
end;

procedure on_cbsys7zlinchange;
begin
sys7zlin:=FormPeach.ComboBoxSysbin.ItemIndex;
end;

procedure on_cbqdupclick;
begin
if FormPeach.cbqdup.State=cbChecked then qdup:=1 else qdup:=0;
end;

procedure on_cbautobrowsetarChange;
begin
abt:=FormPeach.cbautobrowsetar.ItemIndex;
end;

procedure on_cbshowhiddenclick;
begin
if FormPeach.cbshowhidden.State=cbChecked then pshowh:=true else pshowh:=false;
FormPeach.mshowhidden.Checked:=pshowh;
list_utils.showhidden:=pshowh;
end;

procedure restorestatus_defaults;
begin
with FormPeach do
begin
EditDesk.Caption:=vopt1; local_desktop:=vopt1;
EditEncoding.Caption:=vopt1b;
Editalias.Caption:=vopt1c;
cbBinaries.ItemIndex:=vopt2; on_RadioGroup4Change;
cbBinariesStop.ItemIndex:=vopt3; on_RadioGroup6Change;
ComboBoxLibre.ItemIndex:=voptlibre; on_ComboBoxLibreChange;
ComboBoxPrivacy.ItemIndex:=voptprivacy; on_ComboBoxPrivacyChange;
if epfolder1=1 then CheckBoxSmartFolder.State:=cbchecked else CheckBoxSmartFolder.State:=cbunchecked; on_CheckBoxFolder1_click;
if vopt4g=1 then CheckBoxSkipenc.State:=cbchecked else CheckBoxSkipenc.State:=cbunchecked; FormPeach.CheckBoxSkipencClick(nil);
if v7z17c=1 then cbtimecreated.State:=cbchecked else cbtimecreated.State:=cbunchecked; cbtimecreated_onclick;
if vopt4c=1 then CheckBoxnameasparentfolder.State:=cbchecked
else CheckBoxnameasparentfolder.State:=cbunchecked;
on_CheckBoxnameasparentfolderclick;
if vopt4=1 then CheckBoxAutoOpen.State:=cbchecked
else CheckBoxAutoOpen.State:=cbunchecked;
on_CheckBoxAutoOpenClick;
if vopt4h=1 then CheckBoxAutoTest.State:=cbchecked
else CheckBoxAutoTest.State:=cbunchecked;
on_CheckBoxAutoTestClick;
if vopt4d=1 then CheckBoxClosePeaZip.State:=cbchecked
else CheckBoxClosePeaZip.State:=cbunchecked;
FormPeach.CheckBoxClosePeaZipClick(nil);
if vopt5b=1 then CheckBoxShowVolatile.State:=cbchecked else CheckBoxShowVolatile.State:=cbunchecked; on_CheckBoxShowVolatileClick;
if vopt5g=1 then CheckBoxAutoOpenTar.State:=cbchecked else CheckBoxAutoOpenTar.State:=cbunchecked; on_CheckBoxAutoOpenTarClick;
if vopt5dup=1 then cbqdup.State:=cbchecked else cbqdup.State:=cbunchecked; on_cbqdupClick;
if vopt5dsh=1 then cbshowhidden.State:=cbchecked else cbshowhidden.State:=cbunchecked; on_cbshowhiddenClick;
if vopt5gtar=1 then CheckBoxAutoExtTar.State:=cbchecked else CheckBoxAutoExtTar.State:=cbunchecked; on_CheckBoxAutoExtTarClick;
if vopt5gtar1=1 then CheckBoxAutoExtTarConvert.State:=cbchecked else CheckBoxAutoExtTarConvert.State:=cbunchecked; on_CheckBoxAutoExtTar1Click;
if vopt5h=1 then CheckBoxNoConf.State:=cbchecked else CheckBoxNoConf.State:=cbunchecked; on_CheckBoxNoConfClick;
if vopt5sw=1 then CheckBoxzipxswitch.State:=cbchecked else CheckBoxzipxswitch.State:=cbunchecked; CheckBoxzipxswitchClick(nil);
if vopt5ca=1 then CheckBoxAC.State:=cbchecked else CheckBoxAC.State:=cbunchecked; CheckBoxACClick(nil);
if vopt5c=1 then CheckBoxForceOpen.State:=cbchecked else CheckBoxForceOpen.State:=cbunchecked; on_CheckBoxForceOpenClick;
if vopt5d=1 then CheckBoxForceEdit.State:=cbchecked else CheckBoxForceEdit.State:=cbunchecked; on_CheckBoxForceEditClick;
cbforcetype.ItemIndex:=vopt5dt; on_cbforcetypeChange;
if vopt5d4=1 then CheckBoxExcludeEF.State:=cbchecked else CheckBoxExcludeEF.State:=cbunchecked; on_CheckBoxExcludeEFClick;
if vopt5utc=1 then CheckBoxUTC.State:=cbchecked else CheckBoxUTC.State:=cbunchecked; on_CheckBoxUTCClick;
if vopt5d3=1 then CheckBoxForceLayout.State:=cbchecked else CheckBoxForceLayout.State:=cbunchecked; on_CheckBoxForceLayoutClick;
LabelForceLayout.Caption:=vopt5d3t;
if vopt5d1=1 then CheckBoxForceBrowse.State:=cbchecked else CheckBoxForceBrowse.State:=cbunchecked; on_CheckBoxForceBrowseClick;
if vopt5d2=1 then CheckBoxForceConvert.State:=cbchecked else CheckBoxForceConvert.State:=cbunchecked; on_CheckBoxForceConvertClick;
if vopt5e=1 then CheckBoxDragDrop.State:=cbchecked else CheckBoxDragDrop.State:=cbunchecked; on_CheckBoxDragDrop_Click;
if vopt5f=1 then CheckBoxEditArchives.State:=cbchecked else CheckBoxEditArchives.State:=cbunchecked; on_CheckBoxEditArchives_Click;
ComboBoxSysbin.ItemIndex:=vopt5f1; on_cbsys7zlinchange;
if vopt6=1 then CheckBoxEncoding.State:=cbchecked else CheckBoxEncoding.State:=cbunchecked; on_CheckBoxEncodingClick;
cbEncoding.ItemIndex:=vopt23; on_CBEncoding1Change;
ComboBoxSyntaxLevel.ItemIndex:=vopt23b; on_ComboBoxSyntaxLevelChange;
cbtree.ItemIndex:=vopt24; on_cbtreeChange;
cbautobrowsetar.ItemIndex:=vopt24c; on_cbautobrowsetarChange;
cbdefaultaction.ItemIndex:=vopt24b; on_cbdefaultactionchange;
ComboBoxConsoleEncoding.ItemIndex:=vopt7; on_ComboBox1Change;
ComboboxSD.ItemIndex:=vopt7b;
LabelcbSDcustom.Caption:=vopt7c;
if vopt7b<4 then on_ComboBoxSDChange else begin browsersd:=4; browsersdir:=vopt7c; end;
if vopt8=1 then CheckBoxParallelArchiving.State:=cbchecked else CheckBoxParallelArchiving.State:=cbunchecked; on_CheckBoxParallelArchivingClick;
if vopt9=1 then CheckBoxArchiveHistory.State:=cbchecked else CheckBoxArchiveHistory.State:=cbunchecked; on_CheckBoxArchiveHistory_click;
if vopt10=1 then CheckBoxShowHints.State:=cbchecked else CheckBoxShowHints.State:=cbunchecked; on_CheckBoxShowHintsClick;
if vopt11=1 then CheckBoxzcopy.State:=cbchecked else CheckBoxzcopy.State:=cbunchecked; on_CheckBoxzcopyClick;
ComboBoxWD.ItemIndex:=vopt12; on_ComboBoxWDChange;
LabelCustomWorkPath.Caption:=vopt12t;
custom_work_path:=vopt12t;
cbDefaultFormat.ItemIndex:=vopt13; on_RadioGroup0Change;
cbTimeStamp.ItemIndex:=voptts; on_RadioGroupTSClick;
if vopt15d=1 then CheckBoxBrowseNotVerbose.State:=cbchecked else CheckBoxBrowseNotVerbose.State:=cbunchecked; on_CheckBoxBrowseNotVerbose_click;
if vopt15i=1 then CheckBoxSkipDel.State:=cbchecked else CheckBoxSkipDel.State:=cbunchecked; on_CheckBoxSkipDel_click;
if vopt15i2=1 then CheckBoxLimitKFSize.State:=cbchecked else CheckBoxLimitKFSize.State:=cbunchecked; on_CheckBoxLimitKFSize_click;
if vopt15e=1 then CheckBox7zunrar5.State:=cbchecked else CheckBox7zunrar5.State:=cbunchecked; on_CheckBox7zunrar5_click;
if vopt15e3=1 then CheckBoxParams.State:=cbchecked else CheckBoxParams.State:=cbunchecked; on_CheckBoxParams_click;
if vopt15e4=1 then CheckBoxBackground.State:=cbchecked else CheckBoxBackground.State:=cbunchecked; on_CheckBoxBackground_click;
if vopt15e5=1 then CheckBoxLog.State:=cbchecked else CheckBoxLog.State:=cbunchecked; on_CheckBoxLog_click;
if vopt15e2=1 then CheckBoxExtrac32.State:=cbchecked else CheckBoxExtrac32.State:=cbunchecked; on_CheckBoxExtrac32_click;
ComboBoxBrowser.ItemIndex:=vopt15c; on_CheckBoxPrebrowse_click;
ComboBoxMaxArg.ItemIndex:=vopt15h; on_CheckBoxmaxarg_click;
ComboBoxVirtual.ItemIndex:=vopt15gg; on_comboboxvirtualchange;
ComboBoxPriority.ItemIndex:=vopt15g; on_comboboxprioritychange;
ComboBoxDrag.ItemIndex:=vopt15f; on_CheckBoxDrag_click;
if vopt17=1 then CheckBoxIgnoreDisp.State:=cbchecked else CheckBoxIgnoreDisp.State:=cbunchecked; on_CheckBoxIgnoreDisp_click;
if vopt25=1 then CheckBoxIntDir.State:=cbchecked else CheckBoxIntDir.State:=cbunchecked; on_CheckBoxIntDir_click;
if vopt18=1 then CheckBoxIgnoreSel.State:=cbchecked else CheckBoxIgnoreSel.State:=cbunchecked; on_CheckBoxIgnoreSel_click;
if vopt18b=1 then CheckBoxExtAnd.State:=cbchecked else CheckBoxExtAnd.State:=cbunchecked; on_CheckBoxExtAnd_click;
if vopt19=1 then CheckBoxIgnorePaths.State:=cbchecked else CheckBoxIgnorePaths.State:=cbunchecked; on_CheckBox4_click;
if vopt19b=1 then cbautoclosesingleextract.State:=cbchecked else cbautoclosesingleextract.State:=cbunchecked; on_cbautoclosesingleextract_click;
cbExtEvForWhen.ItemIndex:=vopt19c; on_cbExtEvForWhenChange;
ComboBoxsec.ItemIndex:=vopt19csec; on_ComboBoxsecChange;
cbExtEvForHow.ItemIndex:=vopt19d; on_cbExtEvForHowChange;
editExtEvForWhat.Caption:=vopt19e;
editExtEvForSec.Caption:=vopt19esec;
Editcommonalgo.Caption:=vopt19f;
cbHashFormat.ItemIndex:=vopt20; on_RadioGroup1Click;
cbBrowserHash.ItemIndex:=vopt20b; on_RadioGroup2Click;
cbHash.ItemIndex:=vopt21; on_cbcheckallClick;
Comboboxpasses.ItemIndex:=vopt22; on_ComboBoxPassesChange;
ComboboxKiB.ItemIndex:=vopt22b; on_ComboBoxKiBChange;
cbmiddlebutton.ItemIndex:=vopt22c; on_cbmiddlebuttonClick;
updateconf_modified;
activelabel_options:=LabelTitleOptions1;
clicklabel_options(LabelTitleoptions1,ShapeOptions1);
end;
end;

procedure on_checkboxseparateclick;
var
   s:ansistring;
begin
if FormPeach.CheckBoxSeparate.State=cbChecked then
   begin
   FormPeach.EditAddFilename.Enabled:=false;
   FormPeach.EditAddName.ReadOnly:=true;
   end
else
   begin
   FormPeach.EditAddFilename.Enabled:=true;
   FormPeach.EditAddName.ReadOnly:=false;
   suggest_outname(s,FormPeach.cbType.Text,FormPeach.StringGridAdd.Row);
   FormPeach.EditAddFilename.Text:=extractfilename(s);
   FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
   end;
end;

procedure checkmsched;
begin
with FormPeach do
begin
if (CheckGroupM1.Checked[0]=false) and
   (CheckGroupM1.Checked[1]=false) and
   (CheckGroupM1.Checked[2]=false) and
   (CheckGroupM1.Checked[3]=false) and
   (CheckGroupM1.Checked[4]=false) and
   (CheckGroupM1.Checked[5]=false) and
   (CheckGroupM1.Checked[6]=false) and
   (CheckGroupM1.Checked[7]=false) and
   (CheckGroupM1.Checked[8]=false) and
   (CheckGroupM1.Checked[9]=false) and
   (CheckGroupM1.Checked[10]=false) and
   (CheckGroupM1.Checked[11]=false)
   then Bschedule.Enabled:=false
else Bschedule.Enabled:=true;
end;
end;

procedure checkmschedext;
begin
with FormPeach do
begin
if (CheckGroupMExt.Checked[0]=false) and
   (CheckGroupMExt.Checked[1]=false) and
   (CheckGroupMExt.Checked[2]=false) and
   (CheckGroupMExt.Checked[3]=false) and
   (CheckGroupMExt.Checked[4]=false) and
   (CheckGroupMExt.Checked[5]=false) and
   (CheckGroupMExt.Checked[6]=false) and
   (CheckGroupMExt.Checked[7]=false) and
   (CheckGroupMExt.Checked[8]=false) and
   (CheckGroupMExt.Checked[9]=false) and
   (CheckGroupMExt.Checked[10]=false) and
   (CheckGroupMExt.Checked[11]=false)
   then Bschedule.Enabled:=false
else Bschedule.Enabled:=true;
end;
end;

procedure checkwsched;
begin
with FormPeach do
begin
if (CheckGroupW.Checked[0]=false) and
   (CheckGroupW.Checked[1]=false) and
   (CheckGroupW.Checked[2]=false) and
   (CheckGroupW.Checked[3]=false) and
   (CheckGroupW.Checked[4]=false) and
   (CheckGroupW.Checked[5]=false) and
   (CheckGroupW.Checked[6]=false)
   then Bschedule.Enabled:=false
else Bschedule.Enabled:=true;
end;
end;

procedure checkwschedext;
begin
with FormPeach do
begin
if (CheckGroupWExt.Checked[0]=false) and
   (CheckGroupWExt.Checked[1]=false) and
   (CheckGroupWExt.Checked[2]=false) and
   (CheckGroupWExt.Checked[3]=false) and
   (CheckGroupWExt.Checked[4]=false) and
   (CheckGroupWExt.Checked[5]=false) and
   (CheckGroupWExt.Checked[6]=false)
   then BScheduleExt.Enabled:=false
else BScheduleExt.Enabled:=true;
end;
end;

procedure on_cbActChange;
begin
if fun='7Z' then
   if (FormPeach.CheckBox7zSFX.State=cbChecked) then
      getarccaption(txt_sfx+' '+STR_7Z)
   else
      getarccaption(STR_7Z);
if (fun='CUSTOM') and (userar=1) and (havewinrar=true) then getarccaption(txt_custom+'/RAR');
end;

procedure on_cbLevelChange;
begin
case fun of
   'ARC':
   begin
   FormPeach.ComboBoxARCLevel.ItemIndex:=FormPeach.cbLevel.ItemIndex;
   on_ComboBoxARCChange;
   end;
   '7Z':
   begin
   FormPeach.ComboBox7zLevel.ItemIndex:=FormPeach.cbLevel.ItemIndex;
   on_ComboBoxArchiveCompressionLevelChange;
   end;
   'BROTLI':
   begin
   level_brotli:=FormPeach.cbLevel.ItemIndex;
   getarccaption(FormPeach.cbType.Text);
   end;
   'ZSTD':
   begin
   level_zstd:=FormPeach.cbLevel.ItemIndex;
   getarccaption(FormPeach.cbType.Text);
   end;
end;
if (fun='CUSTOM') and (userar=1) and (havewinrar=true) then
   begin
   level_rar:=FormPeach.cbLevel.ItemIndex;
   getarccaption(txt_custom+'/RAR');
   end;
end;

procedure draw_breadmenuicon(i:integer; var menudir:TMenuItem);
var
   Node: TTreeNode;
   s:ansistring;
begin
menudir.Caption:=FormPeach.ShellTreeViewTmp.Items[i].Text;
menudir.visible:=true;
Node := FormPeach.ShellTreeViewTmp.Items[i];
s:=FormPeach.ShellTreeViewTmp.GetPathFromNode(Node);
menudir.Bitmap:=drawmenuicon(s);
end;

procedure prepare_breadcrumbdir(inroot:ansistring);
begin
inbcnode:=-1;
if inroot='' then FormPeach.EditOpenInInteractive.Text;
imod:=0;
try
FormPeach.ShellTreeViewTmp.Root:=inroot;
except
FormPeach.ShellTreeViewTmp.Root:='';
{$IFDEF MSWINDOWS}if (FormPeach.EditOpenInInteractive.Text=txt_mypc) or (inroot=txt_mypc) then imod:=-1;{$ENDIF}
end;
if imod=0 then
begin
if FormPeach.ShellTreeViewTmp.Items.Count>1 then draw_breadmenuicon(1+imod,FormPeach.pmbcd1)
else FormPeach.pmbcd1.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>2 then draw_breadmenuicon(2+imod,FormPeach.pmbcd2)
else FormPeach.pmbcd2.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>3 then draw_breadmenuicon(3+imod,FormPeach.pmbcd3)
else FormPeach.pmbcd3.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>4 then draw_breadmenuicon(4+imod,FormPeach.pmbcd4)
else FormPeach.pmbcd4.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>5 then draw_breadmenuicon(5+imod,FormPeach.pmbcd5)
else FormPeach.pmbcd5.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>6 then draw_breadmenuicon(6+imod,FormPeach.pmbcd6)
else FormPeach.pmbcd6.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>7 then draw_breadmenuicon(7+imod,FormPeach.pmbcd7)
else FormPeach.pmbcd7.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>8 then draw_breadmenuicon(8+imod,FormPeach.pmbcd8)
else FormPeach.pmbcd8.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>9 then draw_breadmenuicon(9+imod,FormPeach.pmbcd9)
else FormPeach.pmbcd9.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>10 then draw_breadmenuicon(10+imod,FormPeach.pmbcd10)
else FormPeach.pmbcd10.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>11 then draw_breadmenuicon(11+imod,FormPeach.pmbcd11)
else FormPeach.pmbcd11.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>12 then draw_breadmenuicon(12+imod,FormPeach.pmbcd12)
else FormPeach.pmbcd12.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>13 then draw_breadmenuicon(13+imod,FormPeach.pmbcd13)
else FormPeach.pmbcd13.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>14 then draw_breadmenuicon(14+imod,FormPeach.pmbcd14)
else FormPeach.pmbcd14.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>15 then draw_breadmenuicon(15+imod,FormPeach.pmbcd15)
else FormPeach.pmbcd15.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>16 then draw_breadmenuicon(16+imod,FormPeach.pmbcd16)
else FormPeach.pmbcd16.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>17 then draw_breadmenuicon(17+imod,FormPeach.pmbcd17)
else FormPeach.pmbcd17.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>18 then draw_breadmenuicon(18+imod,FormPeach.pmbcd18)
else FormPeach.pmbcd18.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>19 then draw_breadmenuicon(19+imod,FormPeach.pmbcd19)
else FormPeach.pmbcd19.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>20 then FormPeach.pmbcd0.visible:=true
else FormPeach.pmbcd0.visible:=false;
if inroot<>DirectorySeparator then
   begin
   FormPeach.pmbcspacer.visible:=false;
   FormPeach.pmquickdesk.visible:=false;
   FormPeach.pmquickdownloads.visible:=false;
   FormPeach.pmquickhome.visible:=false;
   FormPeach.pmquickop.visible:=false;
   FormPeach.pmquickoa.visible:=false;
   FormPeach.pmquicksd.visible:=false;
   end
else
   begin
   FormPeach.pmbcspacer.visible:=true;
   FormPeach.pmquickdesk.visible:=true;
   FormPeach.pmquickdownloads.visible:=true;
   FormPeach.pmquickhome.visible:=true;
   FormPeach.pmquickop.visible:=true;
   FormPeach.pmquickoa.visible:=true;
   FormPeach.pmquicksd.visible:=true;
   end;
end
else //txt_mypc
begin
if FormPeach.pmjd1.visible=true then
   begin
   FormPeach.pmbcd1.bitmap:=FormPeach.pmjd1.bitmap;
   FormPeach.pmbcd1.caption:=FormPeach.pmjd1.caption
   end
else FormPeach.pmbcd1.visible:=false;
if FormPeach.pmjd2.visible=true then
   begin
   FormPeach.pmbcd2.bitmap:=FormPeach.pmjd2.bitmap;
   FormPeach.pmbcd2.caption:=FormPeach.pmjd2.caption
   end
else FormPeach.pmbcd2.visible:=false;
if FormPeach.pmjd3.visible=true then
   begin
   FormPeach.pmbcd3.bitmap:=FormPeach.pmjd3.bitmap;
   FormPeach.pmbcd3.caption:=FormPeach.pmjd3.caption
   end
else FormPeach.pmbcd3.visible:=false;
if FormPeach.pmjd4.visible=true then
   begin
   FormPeach.pmbcd4.bitmap:=FormPeach.pmjd4.bitmap;
   FormPeach.pmbcd4.caption:=FormPeach.pmjd4.caption
   end
else FormPeach.pmbcd4.visible:=false;
if FormPeach.pmjd5.visible=true then
   begin
   FormPeach.pmbcd5.bitmap:=FormPeach.pmjd5.bitmap;
   FormPeach.pmbcd5.caption:=FormPeach.pmjd5.caption
   end
else FormPeach.pmbcd5.visible:=false;
if FormPeach.pmjd6.visible=true then
   begin
   FormPeach.pmbcd6.bitmap:=FormPeach.pmjd6.bitmap;
   FormPeach.pmbcd6.caption:=FormPeach.pmjd6.caption
   end
else FormPeach.pmbcd6.visible:=false;
if FormPeach.pmjd7.visible=true then
   begin
   FormPeach.pmbcd7.bitmap:=FormPeach.pmjd7.bitmap;
   FormPeach.pmbcd7.caption:=FormPeach.pmjd7.caption
   end
else FormPeach.pmbcd7.visible:=false;
if FormPeach.pmjd8.visible=true then
   begin
   FormPeach.pmbcd8.bitmap:=FormPeach.pmjd8.bitmap;
   FormPeach.pmbcd8.caption:=FormPeach.pmjd8.caption
   end
else FormPeach.pmbcd8.visible:=false;
if FormPeach.pmjd9.visible=true then
   begin
   FormPeach.pmbcd9.bitmap:=FormPeach.pmjd9.bitmap;
   FormPeach.pmbcd9.caption:=FormPeach.pmjd9.caption
   end
else FormPeach.pmbcd9.visible:=false;
if FormPeach.pmjd10.visible=true then
   begin
   FormPeach.pmbcd10.bitmap:=FormPeach.pmjd10.bitmap;
   FormPeach.pmbcd10.caption:=FormPeach.pmjd10.caption
   end
else FormPeach.pmbcd10.visible:=false;
if FormPeach.pmjd11.visible=true then
   begin
   FormPeach.pmbcd11.bitmap:=FormPeach.pmjd11.bitmap;
   FormPeach.pmbcd11.caption:=FormPeach.pmjd11.caption
   end
else FormPeach.pmbcd11.visible:=false;
if FormPeach.pmjd12.visible=true then
   begin
   FormPeach.pmbcd12.bitmap:=FormPeach.pmjd12.bitmap;
   FormPeach.pmbcd12.caption:=FormPeach.pmjd12.caption
   end
else FormPeach.pmbcd12.visible:=false;
if FormPeach.pmjd13.visible=true then
   begin
   FormPeach.pmbcd13.bitmap:=FormPeach.pmjd13.bitmap;
   FormPeach.pmbcd13.caption:=FormPeach.pmjd13.caption
   end
else FormPeach.pmbcd13.visible:=false;
if FormPeach.pmjd14.visible=true then
   begin
   FormPeach.pmbcd14.bitmap:=FormPeach.pmjd14.bitmap;
   FormPeach.pmbcd14.caption:=FormPeach.pmjd14.caption
   end
else FormPeach.pmbcd14.visible:=false;
if FormPeach.pmjd15.visible=true then
   begin
   FormPeach.pmbcd15.bitmap:=FormPeach.pmjd15.bitmap;
   FormPeach.pmbcd15.caption:=FormPeach.pmjd15.caption
   end
else FormPeach.pmbcd15.visible:=false;
if FormPeach.pmjd16.visible=true then
   begin
   FormPeach.pmbcd16.bitmap:=FormPeach.pmjd16.bitmap;
   FormPeach.pmbcd16.caption:=FormPeach.pmjd16.caption
   end
else FormPeach.pmbcd16.visible:=false;
if FormPeach.pmjd17.visible=true then
   begin
   FormPeach.pmbcd17.bitmap:=FormPeach.pmjd17.bitmap;
   FormPeach.pmbcd17.caption:=FormPeach.pmjd17.caption
   end
else FormPeach.pmbcd17.visible:=false;
if FormPeach.pmjd18.visible=true then
   begin
   FormPeach.pmbcd18.bitmap:=FormPeach.pmjd18.bitmap;
   FormPeach.pmbcd18.caption:=FormPeach.pmjd18.caption
   end
else FormPeach.pmbcd18.visible:=false;
if FormPeach.pmjd19.visible=true then
   begin
   FormPeach.pmbcd19.bitmap:=FormPeach.pmjd19.bitmap;
   FormPeach.pmbcd19.caption:=FormPeach.pmjd19.caption
   end
else FormPeach.pmbcd19.visible:=false;
if FormPeach.ShellTreeViewTmp.Items.Count>20 then FormPeach.pmbcd0.visible:=true
else FormPeach.pmbcd0.visible:=false;
FormPeach.pmbcspacer.visible:=true;
FormPeach.pmquickdesk.visible:=true;
FormPeach.pmquickdownloads.visible:=true;
FormPeach.pmquickhome.visible:=true;
FormPeach.pmquickop.visible:=true;
FormPeach.pmquickoa.visible:=true;
FormPeach.pmquicksd.visible:=true;
end;
end;

procedure prepare_breadcrumbarchive(branode:integer);
var
   saddr,saddr2:ansistring;
   i:integer;
begin
inbcnode:=branode;
FormPeach.pmbcd1.visible:=false;
FormPeach.pmbcd2.visible:=false;
FormPeach.pmbcd3.visible:=false;
FormPeach.pmbcd4.visible:=false;
FormPeach.pmbcd5.visible:=false;
FormPeach.pmbcd6.visible:=false;
FormPeach.pmbcd7.visible:=false;
FormPeach.pmbcd8.visible:=false;
FormPeach.pmbcd9.visible:=false;
FormPeach.pmbcd10.visible:=false;
FormPeach.pmbcd11.visible:=false;
FormPeach.pmbcd12.visible:=false;
FormPeach.pmbcd13.visible:=false;
FormPeach.pmbcd14.visible:=false;
FormPeach.pmbcd15.visible:=false;
FormPeach.pmbcd16.visible:=false;
FormPeach.pmbcd17.visible:=false;
FormPeach.pmbcd18.visible:=false;
FormPeach.pmbcd19.visible:=false;
FormPeach.pmbcd0.visible:=false;

case branode of
0: saddr:='';
1: saddr:=abcrs[1];
2: saddr:=abcrs[2];
3: saddr:=abcrs[3];
end;

saddr2:=saddr+'*'+directoryseparator+'*';

for i:=1 to FormPeach.StringGridAddressAllFolders.RowCount-1 do
  begin
  if (pos(saddr,FormPeach.StringGridAddressAllFolders.Cells[12,i])=1) or (saddr='') then
     if not(MatchesMask(FormPeach.StringGridAddressAllFolders.Cells[12,i],saddr2,false)) then
        begin
        if FormPeach.pmbcd1.visible=false then
           begin
           FormPeach.pmbcd1.visible:=true;
           FormPeach.pmbcd1.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd1.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd2.visible=false then
           begin
           FormPeach.pmbcd2.visible:=true;
           FormPeach.pmbcd2.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd2.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd3.visible=false then
           begin
           FormPeach.pmbcd3.visible:=true;
           FormPeach.pmbcd3.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd3.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd4.visible=false then
           begin
           FormPeach.pmbcd4.visible:=true;
           FormPeach.pmbcd4.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd4.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd5.visible=false then
           begin
           FormPeach.pmbcd5.visible:=true;
           FormPeach.pmbcd5.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd5.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd6.visible=false then
           begin
           FormPeach.pmbcd6.visible:=true;
           FormPeach.pmbcd6.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd6.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd7.visible=false then
           begin
           FormPeach.pmbcd7.visible:=true;
           FormPeach.pmbcd7.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd7.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd8.visible=false then
           begin
           FormPeach.pmbcd8.visible:=true;
           FormPeach.pmbcd8.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd8.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd9.visible=false then
           begin
           FormPeach.pmbcd9.visible:=true;
           FormPeach.pmbcd9.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd9.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd10.visible=false then
           begin
           FormPeach.pmbcd10.visible:=true;
           FormPeach.pmbcd10.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd10.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd11.visible=false then
           begin
           FormPeach.pmbcd11.visible:=true;
           FormPeach.pmbcd11.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd11.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd12.visible=false then
           begin
           FormPeach.pmbcd12.visible:=true;
           FormPeach.pmbcd12.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd12.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd13.visible=false then
           begin
           FormPeach.pmbcd13.visible:=true;
           FormPeach.pmbcd13.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd13.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd14.visible=false then
           begin
           FormPeach.pmbcd14.visible:=true;
           FormPeach.pmbcd14.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd14.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd15.visible=false then
           begin
           FormPeach.pmbcd15.visible:=true;
           FormPeach.pmbcd15.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd15.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd16.visible=false then
           begin
           FormPeach.pmbcd16.visible:=true;
           FormPeach.pmbcd16.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd16.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd17.visible=false then
           begin
           FormPeach.pmbcd17.visible:=true;
           FormPeach.pmbcd17.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd17.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd18.visible=false then
           begin
           FormPeach.pmbcd18.visible:=true;
           FormPeach.pmbcd18.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd18.bitmap:=BFolder;
           end
        else
        if FormPeach.pmbcd19.visible=false then
           begin
           FormPeach.pmbcd19.visible:=true;
           FormPeach.pmbcd19.caption:=dirextractfilename(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
           FormPeach.pmbcd19.bitmap:=BFolder;
           end
        else FormPeach.pmbcd0.visible:=true;
        end;
  end;
FormPeach.pmbcspacer.visible:=false;
FormPeach.pmquickdesk.visible:=false;
FormPeach.pmquickdownloads.visible:=false;
FormPeach.pmquickhome.visible:=false;
FormPeach.pmquickop.visible:=false;
FormPeach.pmquickoa.visible:=false;
FormPeach.pmquicksd.visible:=false;
end;

procedure exit_fromaddress(exitmode:integer);
begin
if usebreadcrumb=0 then exit;
FormPeach.PanelClickAddress.Visible:=true;
if FormPeach.ShapeListBar.Visible=false then FormPeach.ShapeListBar.Visible:=true;
FormPeach.EditOpenInInteractive.Enabled:=false;
if exitmode=1 then do_resetsearch;
end;

procedure reset_theme_btn;
begin
FormPeach.ComboBoxTheme.ItemIndex:=0;
ComboBoxTheme_onchange;
setwindowsopacity;
settabs;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GUI OTHER FORMS prepare secondary forms

///////////////////////////////////////////////////////////////////////////////}

procedure prepare_FormPW;
begin
FormPW.Caption:=txt_pw;
FormPW.LabelPWpass.Caption:=txt_pw;
FormPW.LabelPWconfirm.Caption:=txt_pw_confirm;
FormPW.LabelPWkeyfile.Caption:=txt_keyfile;
FormPW.LabelPWkeyfile.Hint:=txt_2_7_optional;
FormPW.EditPWkeyfile.Hint:=txt_keyfile+' '+txt_2_7_optional;
FormPW.ButtonPWkeyfile.Hint:=txt_keyfile+' '+txt_2_7_optional;
FormPW.OpenDialogKF.Title:=txt_keyfile;
FormPW.mpwmreset.Caption:=txt_reset+' ('+txt_pw+', '+txt_keyfile+')';
FormPW.mpwmreset.Bitmap:=Bdelete;
FormPW.mpwreset.Caption:=txt_reset+' ('+txt_keyfile+')';
FormPW.mpwexplore.Caption:=txt_explore_path;
FormPW.CheckBoxEncFn.Caption:=txt_2_7_encfn;
FormPW.CheckBoxIntPw.Caption:=txt_8_0_forcetyping;
FormPW.CheckBoxIntPw.Hint:=txt_8_0_forcetypinghelp;
FormPW.CheckBoxShowPWField.Caption:=txt_showpw;
FormPW.CheckBoxKeepPW.Caption:=txt_4_3_keeppw;
FormPW.mpwman.Caption:=txt_4_3_pwman;
FormPW.ButtonEditNamePw.Glyph:=bmenu;
FormPW.ButtonPanelPW.OKButton.Caption:=txt_2_7_ok;
FormPW.ButtonPanelPW.CancelButton.Caption:=txt_2_7_cancel;
FormPW.mpwpr.Caption:=txt_11_0_pr;
if keeppw=1 then FormPW.CheckBoxKeepPW.State:=cbChecked else FormPW.CheckBoxKeepPW.State:=cbUnchecked;
UnitPW.validate_txt:=txt_2_7_validatecl;
UnitPW.txt_pw:=txt_pw;
UnitPW.txt_pr1:=txt_11_0_vw;
UnitPW.txt_pr2:=txt_11_0_w;
UnitPW.txt_pr3:=txt_11_0_good;
UnitPW.txt_pr4:=txt_11_0_strong;
setpwicons;
end;

procedure prepare_FormAbout;
begin
FormPeach.baboutup.Caption:=txt_4_5_update;
FormPeach.baboutup.Glyph:=Bweb;
psetbuttonwidth(FormPeach.baboutup,16,true);
FormPeach.baboutup.Height:=barheight;
FormPeach.baboutplugins.Caption:=txt_5_5_plugin;
FormPeach.baboutplugins.Glyph:=Bweb;
psetbuttonwidth(FormPeach.baboutplugins,16,true);
FormPeach.baboutplugins.Height:=barheight;
FormPeach.baboutthemes.Caption:=txt_3_5_td;
FormPeach.baboutthemes.Glyph:=Bweb;
psetbuttonwidth(FormPeach.baboutthemes,16,true);
FormPeach.baboutthemes.Height:=barheight;
FormPeach.babouttranslations.Caption:=txt_9_2_tfaq;
FormPeach.babouttranslations.Glyph:=Bweb;
psetbuttonwidth(FormPeach.babouttranslations,16,true);
FormPeach.babouttranslations.Height:=barheight;
FormPeach.baboutweb.Caption:=txt_peazip_web;
FormPeach.baboutweb.Glyph:=Bweb;
psetbuttonwidth(FormPeach.baboutweb,16,true);
FormPeach.baboutweb.Height:=barheight;
FormPeach.baboutchangelog.Caption:=txt_9_2_changelog;
FormPeach.baboutchangelog.Glyph:=Bweb;
psetbuttonwidth(FormPeach.baboutchangelog,16,true);
FormPeach.baboutchangelog.Height:=barheight;
FormPeach.babouttos.Caption:=txt_9_2_tos;
FormPeach.babouttos.Glyph:=Bweb;
psetbuttonwidth(FormPeach.babouttos,16,true);
FormPeach.babouttos.Height:=barheight;
FormPeach.baboutsupport.Caption:=txt_peazip_help;
FormPeach.baboutfaq.Caption:='FAQ';
FormPeach.babouttracker.Caption:=txt_3_7_tracker;
FormPeach.baboutlocalhelp.Caption:=txt_2_5_offline_help+' (EN, .pdf)';
FormPeach.baboutsupport.Glyph:=Bweb;
psetbuttonwidth(FormPeach.baboutsupport,16,true);
FormPeach.baboutsupport.Height:=barheight;
FormPeach.baboutfaq.Glyph:=Bweb;
psetbuttonwidth(FormPeach.baboutfaq,16,true);
FormPeach.baboutfaq.Height:=barheight;
FormPeach.babouttracker.Glyph:=Bweb;
psetbuttonwidth(FormPeach.babouttracker,16,true);
FormPeach.babouttracker.Height:=barheight;
FormPeach.baboutlocalhelp.Glyph:=Bpdf;
psetbuttonwidth(FormPeach.baboutlocalhelp,16,true);
FormPeach.baboutlocalhelp.Height:=barheight;
FormPeach.baboutplugindir.Glyph:=BFolder;
FormPeach.baboutplugindir.Caption:=txt_9_0_plugind;
psetbuttonwidth(FormPeach.baboutplugindir,16,true);
FormPeach.baboutplugindir.Height:=barheight;
FormPeach.baboutbin.Glyph:=BExesupported;
FormPeach.baboutbin.Caption:=txt_8_7_verifybin;
psetbuttonwidth(FormPeach.baboutbin,16,true);
FormPeach.baboutbin.Height:=barheight;
FormPeach.baboutremoveunace.Glyph:=Bdelete;
FormPeach.baboutremoveunace.Caption:=txt_2_5_remove+' UNACE Plugin';
psetbuttonwidth(FormPeach.baboutremoveunace,16,true);
FormPeach.baboutremoveunace.Height:=barheight;
FormPeach.baboutremoveunrar.Glyph:=Bdelete;
FormPeach.baboutremoveunrar.Caption:=txt_2_5_remove+' UNRAR Plugin';
psetbuttonwidth(FormPeach.baboutremoveunrar,16,true);
FormPeach.baboutremoveunrar.Height:=barheight;
end;

procedure prepare_FormSelect;
begin
FormSelect.Caption:=txt_5_5_select+'...';
FormSelect.Labelselectall.Caption:=txt_selectall;
FormSelect.Labelselectinvert.Caption:=txt_invertsel;
FormSelect.Labelselectsort.Caption:=txt_sortbysel;
FormSelect.ButtonPanelSelect.OKButton.Caption:=txt_2_7_ok;
FormSelect.ButtonPanelSelect.CancelButton.Caption:=txt_2_7_cancel;
FormSelect.ComboBoxSelect1.Clear;
FormSelect.ComboBoxSelect1.Items.Add(txt_all_type);
FormSelect.ComboBoxSelect1.Items.Add(txt_5_5_starting);
FormSelect.ComboBoxSelect1.Items.Add(txt_5_5_starting+' '+txt_5_5_case);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_attributes);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_dateyear);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_datemonth);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_dateweek);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_dateday);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_datehour);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_datesameyear);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_datesamemonth);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_datesameweek);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_datesameday);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_5_5_datesamehour);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_morerecent);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_eqorrecent);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_equal);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_eqorolder);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_date+' | '+txt_olderthan);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | 0 B');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | < 100 KB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | 100 KB .. 10 MB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | 10 MB .. 100 MB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | > 100 MB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | '+txt_5_5_similar+' (10%)');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | '+txt_5_5_similar+' (50%)');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | '+txt_smaller);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | '+txt_eqorsmaller);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | '+txt_equal);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | '+txt_eqorlarger);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_size+' | '+txt_larger);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | 0 B');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | < 100 KB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | 100 KB .. 10 MB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | 10 MB .. 100 MB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | > 100 MB');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | '+txt_5_5_similar+' (10%)');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | '+txt_5_5_similar+' (50%)');
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | '+txt_smaller);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | '+txt_eqorsmaller);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | '+txt_equal);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | '+txt_eqorlarger);
FormSelect.ComboBoxSelect1.Items.Add(txt_all_psize+' | '+txt_larger);
FormSelect.ComboBoxSelect1.ItemIndex:=0;
FormSelect.ComboBoxSelect2.Clear;
FormSelect.ComboBoxSelect2.Items.Add(txt_5_5_select);
FormSelect.ComboBoxSelect2.Items.Add(txt_5_5_addsel);
FormSelect.ComboBoxSelect2.Items.Add(txt_5_5_subtractsel);
FormSelect.ComboBoxSelect2.ItemIndex:=0;
end;

procedure prepare_Formgwrap;
begin
UnitGwrap.executable_path:=executable_path;
UnitGwrap.confpath:=confpath;
UnitGwrap.binpath:=binpath;
UnitGwrap.sharepath:=sharepath;
UnitGwrap.lang_file:=lang_file;
UnitGwrap.autoopen:=autoopen;
UnitGwrap.graphicsfolder:=graphicsfolder;
UnitGwrap.color1:=color1;
UnitGwrap.color2:=color2;
UnitGwrap.color3:=color3;
UnitGwrap.color4:=color4;
UnitGwrap.color5:=color5;
UnitGwrap.temperature:=temperature;
UnitGwrap.contrast:=contrast;
UnitGwrap.filesizebase:=filesizebase;
UnitGwrap.pbackground:=txt_2_5_tray;
UnitGwrap.pfromnativedrag:=false;
UnitGwrap.Bp1:=TBitmap.Create;
UnitGwrap.Bp1.Assign(Bp1);
UnitGwrap.Bsuccess:=TBitmap.Create;
UnitGwrap.Bsuccess.Assign(Btestall);
UnitGwrap.Binfo:=TBitmap.Create;
UnitGwrap.Binfo.Assign(Binfo);
UnitGwrap.Berror:=TBitmap.Create;
UnitGwrap.Berror.Assign(Bstop);
FormGwrap.ButtonOptions.Glyph:=Bmenu;
FormGwrap.MenuItemRecycle.Bitmap:=Bclearlayout;
FormGwrap.MenuItemQuickdelete.Bitmap:=Bdelete;
FormGwrap.MenuItemZerodelete.Bitmap:=Bwipe;
FormGwrap.MenuItemSecuredelete.Bitmap:=Bstop;
FormGwrap.left:=ws_gw_left;
FormGwrap.top:=ws_gw_top;
FormGwrap.height:=ws_gw_height;
FormGwrap.width:=ws_gw_width;
UnitGwrap.ws_gw_left:=ws_gw_left;
UnitGwrap.ws_gw_top:=ws_gw_top;
UnitGwrap.ws_gw_height:=ws_gw_height;
UnitGwrap.ws_gw_width:=ws_gw_width;
FormGwrap.PanelTitle.Height:=tabheight;
FormGwrap.ShapeTitleb1.Height:=tablabelheight;
FormGwrap.ShapeTitleb2.Height:=tablabelheight;
FormGwrap.ShapeTitleb3.Height:=tablabelheight;
FormGwrap.ShapeTitleb4.Height:=tablabelheight;
FormGwrap.PanelAlignBottom.Height:=tabheightl;
FormGwrap.StringGridReport.DefaultRowHeight:=rowsize;
UnitGwrap.pbarh:=pbarh;
UnitGwrap.pbarhsmall:=pbarhsmall;
UnitGwrap.txt_7_4_recover:=txt_7_4_recover;
UnitGwrap.txt_rr:=txt_rr;
UnitGwrap.txt_7_8_dd:=txt_7_8_dd;
UnitGwrap.txt_8_2_keep:=txt_8_2_keep;
UnitGwrap.txt_10_7_keep:=txt_10_7_keep;
UnitGwrap.txt_delete:=txt_delete;
UnitGwrap.txt_2_5_delete:=txt_2_5_delete;
UnitGwrap.txt_10_4_moving:=txt_10_4_moving;
FormGwrap.pmCompact.Caption:=txt_9_2_compact;
FormGwrap.pmCompact.Checked:=gwcompact;
FormGwrap.imagetask.Visible:=not(gwcompact); //form size is saved autonomously
{$IFDEF MSWINDOWS}FormGwrap.MenuItemRecycle.Visible:=true;{$ENDIF}
{$IFDEF DARWIN}FormGwrap.MenuItemRecycle.Visible:=true;{$ENDIF}
FormGwrap.MenuItemRecycle.Caption:=txt_4_7_recycle;
FormGwrap.MenuItemQuickdelete.Caption:=txt_quickdelete;
FormGwrap.MenuItemZerodelete.Caption:=txt_5_2_zerofiles;
FormGwrap.MenuItemSecuredelete.Caption:=txt_securedelete;
FormGwrap.pmwintm.Caption:=txt_taskman;
FormGwrap.pmwintm.Visible:=false;
FormGwrap.pmmactm.Visible:=false;
FormGwrap.pmgnometm.Visible:=false;
FormGwrap.pmkdetm.Visible:=false;
FormGwrap.pmtop.Visible:=false;
{$IFDEF MSWINDOWS}
FormGwrap.pmwintm.Visible:=true;
{$ELSE}
{$IFDEF DARWIN}
FormGwrap.pmmactm.Visible:=true;
{$ELSE}
FormGwrap.pmgnometm.Visible:=true;
FormGwrap.pmkdetm.Visible:=true;
{$ENDIF}
FormGwrap.pmtop.Visible:=true;
{$ENDIF}
end;

procedure prepare_FormDlg;
begin
UnitDlg.txt_info:=txt_info;
UnitDlg.txt_6_5_warning:=txt_6_5_warning;
UnitDlg.txt_6_5_error:=txt_6_5_error;
UnitDlg.txt_2_7_ok:=txt_2_7_ok;
UnitDlg.txt_6_5_yesall:=txt_6_5_yesall;
UnitDlg.txt_6_5_yes:=txt_6_5_yes;
UnitDlg.txt_no:=txt_no;
UnitDlg.txt_2_7_cancel:=txt_2_7_cancel;
UnitDlg.txt_6_5_abort:=txt_6_5_abort;
UnitDlg.txt_clear:=txt_clear;
UnitDlg.txt_7_2_updateclear:=txt_7_2_updateclear;
UnitDlg.txt_8_6_noclear:=txt_8_6_noclear;
UnitDlg.txt_8_6_nosimple:=txt_8_6_nosimple;
UnitDlg.txt_8_6_yessimple:=txt_8_6_yessimple;
UnitDlg.txt_7_8_update:=txt_7_8_update;
FormDlg.Imagedlg.Height:=i32res;
FormDlg.Imagedlg.Width:=i32res;
UnitDlg.binfodlg:=TBitmap.Create;
UnitDlg.binfodlg.Assign(binfodlg);
UnitDlg.bwarningdlg:=TBitmap.Create;
UnitDlg.bwarningdlg.Assign(bwarningdlg);
UnitDlg.berrordlg:=TBitmap.Create;
UnitDlg.berrordlg.Assign(berrordlg);
end;

procedure prepare_FormPM;
begin
FormPM.Caption:=txt_4_3_pwman;
UnitPM.validate_txt:=txt_2_7_validatecl;
UnitPM.local_desktop:=local_desktop;
UnitPM.confpath:=confpath;
UnitPM.txt_clear:=txt_4_3_pwman+' / '+txt_clear+'?';
FormPM.mnew.Caption:=txt_add;
FormPM.mpw.Caption:=txt_pw;
FormPM.mnote.Caption:=txt_description;
FormPM.mremove.Caption:=txt_2_5_remove;
FormPM.mreset.Caption:=txt_clear;
FormPM.StringGridPM.Cells[1,0]:=txt_pw;
FormPM.StringGridPM.Cells[2,0]:=txt_description;
FormPM.StringGridPM.AutoSizeColumns;
FormPM.StringGridPM.ColWidths[3]:=0;
FormPM.lablelistPath1.Caption:=txt_pw;
FormPM.lablelistPath3.Caption:=txt_pw_confirm;
FormPM.lablelistPath2.Caption:=txt_keyfile;
FormPM.mpwreset.Caption:=txt_reset+' ('+txt_keyfile+')';
FormPM.mpwexplore.Caption:=txt_explore_path;
FormPM.buttonpanelPM.OKButton.Caption:=txt_2_7_ok;
FormPM.buttonpanelPM.CancelButton.Caption:=txt_2_7_cancel;
FormPM.LabelPMadd.Caption:=txt_add;
FormPM.LabelPMremove.Caption:=txt_2_5_remove;
FormPM.ImageInfoPM1.Picture.Bitmap:=Binfo;
FormPM.LablePMHint.Caption:=txt_4_3_pwmanpwhint;
FormPM.LabelTitlePM1.Caption:='      '+txt_4_3_pwmanlist+'      ';
FormPM.LabelTitlePM2.Caption:='      '+txt_4_3_pwmanmaster+'      ';
FormPM.ImageInfoPM1.Hint:=txt_4_3_pwmanhint;
FormPM.pmexp.Caption:=txt_4_3_exppl;
FormPM.pmexpenc.Caption:=txt_4_3_expple;
FormPM.pmexpplain.Caption:=txt_4_3_expplp;
FormPM.ctrlpm.Glyph:=bsettings;
FormPM.ButtonEditNamePw.Glyph:=bmenu;
FormPM.MenuItemPWreset.Caption:=txt_reset+' ('+txt_pw+', '+txt_keyfile+')';
FormPM.MenuItemPWreset.Bitmap:=Bdelete;
FormPM.MenuItemPRsingle.Caption:=txt_11_0_pr;
FormPM.MenuItemPR.Caption:=txt_11_0_pr;
UnitPM.txt_pr1:=txt_11_0_vw;
UnitPM.txt_pr2:=txt_11_0_w;
UnitPM.txt_pr3:=txt_11_0_good;
UnitPM.txt_pr4:=txt_11_0_strong;
loadpm;
end;

procedure prepare_FormComment;
begin
FormComment.Caption:=txt_7_4_comment;
FormComment.MemoComment.Hint:=txt_9_4_hintcomment;
FormComment.LabelResetComment.Caption:=txt_reset;
FormComment.LabelLoadfromfile.Caption:=txt_loadfile;
FormComment.ButtonSaveComment.Caption:=txt_9_4_savecomment;
FormComment.ButtonCancelComment.Caption:=txt_2_7_cancel;
FormComment.OpenDialogFC.Title:=txt_open_file;
FormComment.SaveDialogFC.Title:=txt_saveas;
UnitComment.pdesk:=local_desktop;
end;

procedure prepare_FormKF;
begin
with FormKF do
begin
FormKF.Caption:=txt_4_7_pk;
ImageInfoKF.Hint:=txt_ent_hint;
GroupBoxKF.Caption:=txt_ent_tools;
EditEnt.Text:=txt_random_keys;
EditEnt.Hint:=txt_random_keys_hint;
ProgressBarKF.Hint:=txt_ent;
EditSuggestPW.Hint:=txt_ramdompw_hint;
SpinEditSuggestPW.Hint:=txt_pwlength;
ButtonKFLoadFile.Caption:=txt_loadfile;
ButtonKF.Caption:=txt_create_keyfile;
ButtonPWfromhash.Caption:=txt_10_7_pwh;
ButtonSuggestPW.Caption:=txt_suggestpw;
ImageInfoKF.Picture.Bitmap:=Binfo;
ImageInfoKF.Transparent:=true;
ButtonPanelKF.Okbutton.Caption:=txt_2_7_ok;
SaveDialogKF.Title:=txt_saveas;
OpenDialogKF.Title:=txt_open_file;
CheckBoxSuggestPW.Caption:=txt_4_7_spchar;
end;
UnitKF.persistent_source:=persistent_source;
UnitKF.txt_keyfile_notcreated:=txt_keyfile_notcreated;
UnitKF.txt_error_openfile:=txt_error_openfile;
end;

procedure prepare_FormAdvf;
begin
FormAdvf.Caption:=txt_adv_filters;
FormAdvf.CheckboxAdvFilters.Caption:=txt_advfilters;
FormAdvf.CheckBoxAdvRecurse.Caption:=txt_5_3_rec;
FormAdvf.CheckBoxAdvRecurseAlso.Caption:=txt_5_3_rec;
FormAdvf.CheckBoxAdvRecurse1.Caption:=txt_5_3_rec;
FormAdvf.LabelAdvInclude.Caption:=txt_5_3_io;
FormAdvf.LabelAdvInclude.Hint:=txt_include_hint;
FormAdvf.LabelAdvIncludeAlso.Caption:=txt_5_3_ia+' - '+txt_4_2_arcabspath;
FormAdvf.LabelAdvIncludeAlso.Hint:=txt_include_hint+' - '+txt_4_2_arcabspath;
FormAdvf.LabelAdvExclude.Caption:=txt_exclusion;
FormAdvf.LabelAdvExclude.Hint:=txt_exclude_hint;
FormAdvf.ButtonClearFilters.Caption:=txt_clear;
FormAdvf.ImageInfoAdvf.Hint:=txt_2_9_adv
+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_3_exc
+char($0D)+char($0A)+char($0D)+char($0A)+txt_include_hint
+char($0D)+char($0A)+char($0D)+char($0A)+txt_exclude_hint;
FormAdvf.ImageInfoAdvf.Picture.Bitmap:=Binfo;
FormAdvf.ImageInfoAdvf.Transparent:=true;
FormAdvf.ButtonPanelAdvf.OKButton.Caption:=txt_2_7_ok;
FormAdvf.ButtonPanelAdvf.CancelButton.Caption:=txt_2_7_cancel;
end;

procedure prepare_FormWeb;
begin
FormWeb.Caption:=txt_search_web;
FormWeb.CheckBoxMultiWeb.Caption:=txt_3_3_multi;
FormWeb.CheckGroupWeb.Caption:=txt_searchfor;
FormWeb.ButtonPanelWeb.OKButton.Caption:=txt_2_7_ok;
FormWeb.ButtonPanelWeb.CancelButton.Caption:=txt_2_7_cancel;
FormWeb.CheckGroupWeb.Checked[6]:=true;
end;

procedure prepare_FormImgViewer;
begin
UnitImgViewer.filesizebase:=filesizebase;
UnitImgViewer.desk_env:=desk_env;
{$IFDEF MSWINDOWS}FormImgViewer.mproperties.Visible:=true;{$ENDIF}
FormImgViewer.mfwd.Caption:=txt_10_7_next+' ->';
FormImgViewer.mback.Caption:=txt_10_7_prev+' <-';
FormImgViewer.mfirst.Caption:=txt_10_7_first;
FormImgViewer.mlast.Caption:=txt_5_1_last;
FormImgViewer.mexplorepath.Caption:=txt_explore_path;
FormImgViewer.mproperties.Caption:=txt_4_5_properties;
FormImgViewer.mrefresh.Caption:=txt_fefreshf5;
FormImgViewer.mupdate.Caption:=txt_7_8_update;
FormImgViewer.mzoom.Caption:=txt_7_9_zooming;
FormImgViewer.mzoomin.Caption:=txt_7_9_zooming+' +';
FormImgViewer.mzoomout.Caption:=txt_7_9_zooming+' -';
FormImgViewer.mzoomfit.Caption:=txt_10_7_fit;
FormImgViewer.mzoomfith.Caption:=txt_10_7_fith;
FormImgViewer.mzoomfitw.Caption:=txt_10_7_fitw;
UnitImgViewer.txt_10_7_errload:=txt_10_7_errload;
UnitImgViewer.txt_10_7_errfile:=txt_10_7_errfile;
UnitImgViewer.executable_path:=executable_path;
UnitImgViewer.erasepasses:=erasepasses;
UnitImgViewer.txt_2_7_validatecl:=txt_2_7_validatecl;
UnitImgViewer.txt_delete:=txt_delete;
UnitImgViewer.txt_wipe:=txt_wipe;
UnitImgViewer.txt_5_2_zerodelete:=txt_5_2_zerodelete;
UnitImgViewer.txt_4_7_recycle:=txt_4_7_recycle;
FormImgViewer.mdelete.Caption:=txt_2_5_delete;
FormImgViewer.mtrash.Caption:=txt_4_7_recycle;
FormImgViewer.mquickdelete.Caption:=txt_quickdelete;
FormImgViewer.mzerodelete.Caption:=txt_5_2_zerofiles;
FormImgViewer.msecuredelete.Caption:=txt_securedelete;
FormImgViewer.mrename.Caption:=txt_rename+' (Ctrl+R)';
UnitImgViewer.txt_rename:=txt_rename;
UnitImgViewer.txt_reset:=txt_reset;
UnitImgViewer.txt_5_5_lower:=txt_5_5_lower;
UnitImgViewer.txt_5_5_upper:=txt_5_5_upper;
UnitImgViewer.txt_timestamp:=txt_timestamp;
UnitImgViewer.txt_6_4_appdirn:=txt_6_4_appdirn;
UnitImgViewer.txt_6_4_prepdirn:=txt_6_4_prepdirn;
UnitImgViewer.txt_name_provide:=txt_name_provide;
UnitImgViewer.txt_checkname_failed:=txt_checkname_failed;
{$IFNDEF MSWINDOWS}
{$IFNDEF DARWIN}
FormImgViewer.mtrash.Visible:=false;
{$ENDIF}
{$ENDIF}
end;

procedure prepare_FormPaths;
var
   nsel:integer;
   strsel:ansistring;
begin
with FormPaths do
begin
//set text
ButtonPanelPaths.OKButton.Caption:=txt_2_7_ok;
end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GUI PANELS set main form screens

///////////////////////////////////////////////////////////////////////////////}

procedure setpanel_add(ipanel:integer);
var
   cl,jobcode,outname:ansistring;
begin
with FormPeach do
begin
consolecl:=false;
OptionsAdd.Visible:=false;
OptionsAddAdv.Visible:=false;
ConsoleAdd.Visible:=false;
scheduleadd.Visible:=false;
cbtarpipe.enabled:=false;
case ipanel of
   1: OptionsAdd.Visible:=true;
   2: OptionsAddAdv.Visible:=true;
   3: ConsoleAdd.Visible:=true;
   4: scheduleadd.Visible:=true;
   end;
if ipanel<>3 then
   if imported_tarbeforejob=true then restorelistTB;
imported_tarbeforejob:=false;
if (ipanel = 3) or (ipanel = 4) then
   begin
   consolecl:=true;
   SpeedButtonAdd.Enabled:=false;
   ButtonArchiveOK.Enabled:=false;
   if ipanel = 3 then cbtarpipe.enabled:=true;
   if ipanel = 3 then importjobcl(cl,jobcode,outname);
   if ipanel = 4 then getscheduledtaskname(0);
   end
else
   begin
   {if CheckBoxConvert.checked=true then
      SpeedButtonAdd.Enabled:=false
   else}
      SpeedButtonAdd.Enabled:=true;
   ButtonArchiveOK.Enabled:=true;
   {$IFDEF MSWINDOWS}
   if FormPeach.Visible=true then
      if prevpanel='archive' then
         try ButtonArchiveOK.Setfocus; except end;
   {$ENDIF}
   end;
end;
end;

procedure setpanel_extract(ipanel:integer);
var
cl,jobcode,outname:ansistring;
begin
with FormPeach do
begin
consolecl:=false;
OptionsExtract.Visible:=false;
OptionsExtractAdv.Visible:=false;
ConsoleExtract.Visible:=false;
scheduleextract.Visible:=false;
cbuntarpipe.enabled:=false;
case ipanel of
   1: OptionsExtract.Visible:=true;
   2: OptionsExtractAdv.Visible:=true;
   3: ConsoleExtract.Visible:=true;
   4: scheduleextract.Visible:=true;
   end;
if (ipanel = 3) or (ipanel = 4) then
   begin
   consolecl:=true;
   ButtonExtOk.Enabled:=false;
   if ipanel = 3 then cbuntarpipe.enabled:=true;
   if ipanel = 3 then importjobcl_extract(cl,jobcode,outname);
   if ipanel = 4 then getscheduledtaskname(1);
   end
else
   begin
   ButtonExtOk.Enabled:=true;
   {$IFDEF MSWINDOWS}
   if FormPeach.Visible=true then
      if prevpanel='extract' then
         try ButtonExtOk.Setfocus; except end;
   {$ENDIF}
   end;
end;
end;

procedure showpanel(panelname:ansistring); //make all panels invisible (showpanel_prepare) then make visible the called panel
var
   s:ansistring;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOptions.visible=true then{$ELSE}if FormPeach.PanelOptions.top=0 then{$ENDIF}
   begin
   save_conf;
   prepare_FormPW;
   prepare_FormKF;
   prepare_FormAdvf;
   end;//save configuration exiting from paneldefaults
showpanel_prepare;
with FormPeach do
begin
case panelname of
   'archive' :
   begin
   prevpanel:='archive';
   updateid:='';
   prevupdateid:='';
   titlestring:='';
   mConsoleCreate.Text:='';
   marcopt.enabled:=false;
   setrecenticons_extract_archive;
   if CheckBoxConvert.checked=true then LabelTitleAdd1.Caption:='      '+txt_2_8_convert+'      ' else LabelTitleAdd1.Caption:='      '+txt_archive+'      ';
   CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
   CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
   PanelArchive.Top:=0;
   PanelArchive.Visible:=true;
   if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_add(LabelTitleAdd1,ShapeTitleAddb1) else clicklabel_add(LabelTitleAdd1,Shapelinkadd1);
   if showmenu=true then
      begin
      //mLayout.Visible:=true;
      mLayout.Enabled:=true;
      end;
   mtogglenew.visible:=false;
   mgotype.visible:=true;
   MenuItem110.visible:=true;
   mgotypegz.visible:=true;
   mgotype7zsfx.visible:=true;
   mgotypetar.visible:=true;
   mgotypezip.visible:=true;
   mgotypexz.visible:=true;
   mgotypebz2.visible:=true;
   mgotype7z.visible:=true;
   if userar=1 then mgotyperar.visible:=true else mgotyperar.visible:=false;
   MenuItem121.visible:=true;
   msavecompsettings.visible:=true;
   mloadcompsettings.visible:=true;
   mextractarchive.Caption:=txt_archive;
   if archive_type_selected=-1 then
      if df<18 then archive_type_select(FormPeach.cbType.Items[df])
      else archive_type_select(FormPeach.cbType.Items[pf])
   else archive_type_select(FormPeach.cbType.Items[archive_type_selected]);
   status1:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
   LabelStatusArDetails.Caption:=status1;
   FormPeach.LabelStatusAddUpdate.Caption:='';
   setpanel_add(1);
   ButtonOutAdd.Enabled:=true;
   EditAddName.enabled:=true;
   EditAddSame.Visible:=false;
   ButtonEditNameAdd.Enabled:=true;
   setupdatecontrols(true);
   {if CheckBoxConvert.checked=true then
      SpeedButtonAdd.Enabled:=false
   else}
      SpeedButtonAdd.Enabled:=true;
   pmbrowser.Enabled:=true;
   mgobrowser.Enabled:=true;
   needwaitupdating:=false;
   updatingarchive_inarchive:=false;
   ares:=-1;
   if skipapstatus=false then savestatus_archiver;
   if FormPeach.Visible=true then
      if FormPeach.ButtonArchiveOK.enabled=true then
         begin
         {$IFDEF MSWINDOWS}
         if FormPeach.Visible=true then
            try FormPeach.ButtonArchiveOK.Setfocus; except end;
         {$ENDIF}
         end;
   FormPeach.PanelProgressAdd.Color:=stringtocolor(color2);
   FormPeach.PanelProgressAdd.Height:=0;
   FormPeach.PanelProgressAdd.Width:=0;
   MenuItemEnumerate.visible:=true;
   setextpopupmenu('1');
   mdefaultarchive.visible:=true;
   mdefaultextract.visible:=false;
   FormPeach.PanelTitleAddTabAlign.Width:=FormPeach.LabelTitleAdd1.Width+
   FormPeach.LabelTitleAdd2.Width+
   FormPeach.LabelTitleAdd3.Width+
   FormPeach.LabelTitleAdd4.Width+
   FormPeach.LabelTitleAdd1.BorderSpacing.Left*5;
   end;
   'open' :
   begin
   prevpanel:='open';
   goarchiving:=false;
   if titlestring<>'' then Caption:=titlestring else Caption:='PeaZip';
   titlestring:='';
   status0:=txt_list_browsing;
   if EditOpenInInteractive.Caption<>txt_mypc then
      if currentfs='' then
         if currentcomp='' then status_curarchive:=''
         else
            if seemencrypted=true then status_curarchive:=currentcomp+', '+txt_encrypted
            else status_curarchive:=currentcomp;
   PanelOpen.Top:=0;
   PanelOpen.Visible:=true;
   if showmenu=true then
      begin
      {mEdit.Visible:=true;
      mBrowse.Visible:=true;
      mOrganize.Visible:=true;}
      mEdit.Enabled:=true;
      mBrowse.Enabled:=true;
      mOrganize.Enabled:=true;
      end;
   wasselected:=-1;
   end;
   'extract' :
   begin
   prevpanel:='extract';
   updateid:='';
   prevupdateid:='';
   mextopt.enabled:=false;
   pmbrowser.Enabled:=true;
   setrecenticons_extract_archive;
   titlestring:=Caption;
   savestatus_extractor;
   Caption:=getextcaption;
   mConsoleCreateExt.Text:='';
   PanelExtract.Top:=0;
   if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_extract(LabelTitleExtract1,ShapeTitleExtractb1) else clicklabel_extract(LabelTitleExtract1,Shapelinkextract1);
   PanelExtract.Visible:=true;
   if showmenu=true then
      begin
      //mLayout.Visible:=true;
      mLayout.Enabled:=true;
      end;
   mtogglenew.visible:=true;
   mgotype.visible:=false;
   MenuItem110.visible:=false;
   mgotypegz.visible:=false;
   mgotype7zsfx.visible:=false;
   mgotyperar.visible:=false;
   mgotypetar.visible:=false;
   mgotypezip.visible:=false;
   mgotypexz.visible:=false;
   mgotypebz2.visible:=false;
   mgotype7z.visible:=false;
   MenuItem121.visible:=false;
   msavecompsettings.visible:=false;
   mloadcompsettings.visible:=false;
   mextractarchive.Caption:=txt_caption_extract;
   if mdefaultextract.Checked=false then s:=EditOutExtract.Text
   else s:=defaultextractpath;
   if check7zvolume(s)=true then s:=local_desktop;
   if s='' then s:=local_desktop;
   //control_outpath(s); //deactivated control on showing extraction interface, keeping only control on actions consistently with archive creation routines
   EditOutExtract.Text:=s;
   if FormPeach.Visible=true then
      if FormPeach.ButtonExtOk.Enabled=true then
         begin
         {$IFDEF MSWINDOWS}
         if FormPeach.Visible=true then
            try ButtonExtOk.Setfocus; except end;
         {$ENDIF}
         end;
   FormPeach.PanelProgressExtract.Color:=stringtocolor(color2);
   FormPeach.PanelProgressExtract.Height:=0;
   FormPeach.PanelProgressExtract.Width:=0;
   MenuItemEnumerate.visible:=false;
   mdefaultarchive.visible:=false;
   mdefaultextract.visible:=true;
   FormPeach.PanelTitleExtractTabAlign.Width:=FormPeach.LabelTitleExtract1.Width+
   FormPeach.LabelTitleExtract2.Width+
   FormPeach.LabelTitleExtract3.Width+
   FormPeach.LabelTitleExtract4.Width+
   FormPeach.LabelTitleExtract1.BorderSpacing.Left*5;
   tempcheckoutpath_extract;
   checkoutpath_extract;
   end;
   'defaults' :
   begin
   //prevpanel left unchanged, to be able to return to previous panel when editing is done
   if Caption<>'PeaZip' then prevcaption:=Caption;
   titlestring:='';
   Caption:='PeaZip';
   PanelOptions.Top:=0;
   PanelOptions.Visible:=true;
   FormPeach.SplitterOptions.Left:=(splitter3size*qscale) div 100;
   FormPeach.PanelTitleAppsTabAlign.Width:=FormPeach.LabelTitleApps1.Width+
   FormPeach.LabelTitleApps2.Width+
   FormPeach.LabelTitleApps1.BorderSpacing.Left*3;
   ComboBoxLanguage.Caption:=lang_file;
   EditOptSearch.Caption:=txt_searchfor+'...';
   if work_dir=5 then
      FormPeach.CheckBoxrelative.enabled:=false
   else
      FormPeach.CheckBoxrelative.enabled:=true;
   updatepluginstatus;
   if savehistory=1 then FormPeach.LabelResetHistory.enabled:=true else FormPeach.LabelResetHistory.enabled:=false;
   savestatus_defaults;
   end;
   end;
end;
end;

procedure reloadandbrowse;
var
   carcpath:AnsiString;
begin
carcpath:='';
if abcrs[4]<>'' then carcpath:=abcrs[4]
else
   if abcrs[3]<>'' then carcpath:=abcrs[3]
   else
      if abcrs[2]<>'' then carcpath:=abcrs[2]
      else
         if abcrs[1]<>'' then carcpath:=abcrs[1];
FormPeach.OpenDialogArchive.Filename:=FormPeach.EditOpenIn.Text;
FormPeach.ListViewBrowser.beginupdate;
open_inputselect;
FormPeach.ListViewBrowser.endupdate;
if browsingmode7z=1 then exit;
carcpath:=carcpath+'*';
if (pspecbrowse<>'') and (carcpath='*') then carcpath:=pspecbrowse+'*';
FormPeach.EditUn7zaFilterInteractive.Caption:=carcpath;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure tobrowser_fromarchiver;
begin
clearlist;
using_tarbefore:=false;
FormPeach.EditAddFilepath.Text:='';
FormPeach.EditAddFilename.Text:='';
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
FormPeach.OpenDialogArchive.Filename:=FormPeach.EditOpenIn.Text;
showpanel('open');
case upcase(ExtractFileExt(FormPeach.EditOpenIn.Text)) of
   '.7Z','.RAR','.TAR','.WIM','.ZIP','.ZIPX': reloadandbrowse;
   else
      if forceopenasarchive=true then reloadandbrowse
      else open_inputselect;
   end;
if fun='FILEBROWSER' then
   begin
   if keeppw=0 then
      begin
      FormPW.EditPWpass.Text:='';
      FormPW.EditPWconfirm.Text:='';
      FormPW.EditPWkeyfile.Text:='';
      setpwicons;
      end;
   end;
end;

procedure tobrowser_fromextractor;
begin
clearlist_ext;
FormPeach.CheckBoxSameExt.State:=cbUnchecked; //consistently as similar switch is treated for archiving
on_checkboxsameextclick;
FormPeach.OpenDialogArchive.Filename:=FormPeach.EditOpenIn.Text;
showpanel('open');
case upcase(ExtractFileExt(FormPeach.EditOpenIn.Text)) of
   '.7Z','.RAR','.TAR','.WIM','.ZIP','.ZIPX': reloadandbrowse;
   else
      if forceopenasarchive=true then reloadandbrowse
      else open_inputselect;
   end;
if fun='FILEBROWSER' then
   begin
   //open_inputselect; //on extraction refresh only if browsing filesystem
   if keeppw=0 then
      begin
      FormPW.EditPWpass.Text:='';
      FormPW.EditPWconfirm.Text:='';
      FormPW.EditPWkeyfile.Text:='';
      setpwicons;
      end;
   end;
end;

procedure gocancelarchive;
begin
cancellingarchive:=true;
restorestatus_archiver;
if stayopen=false then exit_withsave
else tobrowser_fromarchiver;
cancellingarchive:=false;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection UPDATES and check for online resources

///////////////////////////////////////////////////////////////////////////////}

procedure checkupdates;
var
   dom,s:ansistring;
   sint,pver:integer;
begin
showpanel('defaults');
clicklabel_options(FormPeach.LabelTitleOptions8, FormPeach.ShapeOptions8);
checkdom(dom,s);
//if s='' then
cp_open(dom,desk_env);
{else
   begin
{$IFDEF MSWINDOWS}
try
sint:=strtoint(s[1]+s[3]+s[5]);
pver:=strtoint(PEAZIPVERSION[1]+PEAZIPVERSION[3]+PEAZIPREVISION[2]);
if sint<=pver then
   pMessageInfoOK(s+' - '+txt_4_5_noupdate)
else
   if pMessageInfoYesNo(s+' - '+txt_4_5_goupdate)=6 then
      cp_open(dom,desk_env);
except
pMessageWarningOK(txt_4_5_koupdate)
end;
{$ENDIF}
   end; }
end;

procedure checkplugins;
var dom,s:ansistring;
begin
showpanel('defaults');
clicklabel_options(FormPeach.LabelTitleOptions8, FormPeach.ShapeOptions8);
checkdom(dom,s);
cp_open(dom+'peazip-add-ons.html',desk_env);
end;

procedure checkthemes;
var dom,s:ansistring;
begin
showpanel('defaults');
clicklabel_options(FormPeach.LabelTitleOptions6, FormPeach.ShapeOptions6);
checkdom(dom,s);
cp_open(dom+'peazip-themes.html',desk_env);
end;

procedure checktranslations;
var dom,s:ansistring;
begin
showpanel('defaults');
clicklabel_options(FormPeach.LabelTitleOptions1, FormPeach.ShapeOptions1);
checkdom(dom,s);
cp_open(dom+'peazip-translations.html',desk_env);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection SELF-CHECK binaries with known hash values

///////////////////////////////////////////////////////////////////////////////}

function checkchash(fname:ansistring; var s:ansistring; var fexe:integer):boolean;
var
   fs,hs:ansistring;
begin
result:=true;
hs:='';
if fname='' then exit;
fs:=stringundelim(fname);//remove quoting if needed
if fs='' then exit;
if not(FileExists(fs)) then exit;
fexe:=fexe+1;
result:=false; //only existing files raise errors
hs:=getchash(fs);
case hs of
H7ZSFX1,
H7ZSFX2,
H7ZSFX3,
HARCSFX1,
HARCSFX2,
HARCSFX3,
HARCSFX4,
HARCSFX5,
{$IFDEF MSWINDOWS}
HPEA_WIN64_X,
HWINCONFIGURE,
HDDDLL_WIN64_X,
H7Z_WIN64_X,
H7ZDLL_WIN64_X,
H7ZBROTLI_WIN64_X,
H7ZFLZMA2_WIN64_X,
H7ZLIZARD_WIN64_X,
H7ZLZ4_WIN64_X,
H7ZLZ5_WIN64_X,
H7ZZSTD_WIN64_X,
HBROTLI_WIN64_X,
HZPAQ_WIN64_X,
HZSTD_WIN64_X,
HARC_WIN64_X,
HARCDLL1_WIN64_X,
HARCDLL2_WIN64_X,
HBCM_WIN64_X,
HBALZ,
HLPAQ1,
HLPAQ5,
HLPAQ8,
HPAQ8F,
HPAQ8JD,
HPAQ8L,
HPAQ8O,
HQUAD,
HSTRIP,
HUPX_WIN64_X,
HUNACE,
HUNACEDLL,
HUNRAR
{$IFDEF WIN32}
,HPEA_WIN32_X,
HDDDLL_WIN32_X,
H7Z_WIN32_X,
H7ZDLL_WIN32_X,
HBROTLI_WIN32_X,
HZPAQ_WIN32_X,
HUPX_WIN32_X
{$ENDIF}
{$ELSE}
{$IFDEF DARWIN}
H7Z_MACOS,
H7ZALT_MACOS,
HPEA_MACOS_A,
HBROTLI_MACOS_A,
HZPAQ_MACOS_A,
HZSTD_MACOS_A,
HPEA_MACOS_X,
HBROTLI_MACOS_X,
HZPAQ_MACOS_X,
HZSTD_MACOS_X,
HZSTDLIB_MACOS_X,
{$ENDIF}
{$IFDEF FREEBSD}
HPEA_BSD_X_GTK2,
H7Z_BSD_X,
HBROTLI_BSD_X,
HZSTD_BSD_X,
{$ENDIF}
//x86_64
HPEA_LIN_X_GTK2,
HPEA_LIN_X_GTK3,
HPEA_LIN_X_QT6,
H7Z_LIN_X,
H7ZALT_LIN_X,
HBCM_LIN_X,
HBROTLI_LIN_X,
HUPX_LIN_X,
HZPAQ_LIN_X,
HZSTD_LIN_X,
H7ZRARSO_LIN_X,
HARC_LIN_X,
HLPAQ8_LIN_X,
HPAQ8O_LIN_X,
//aarch64
HPEA_LIN_A_GTK2,
H7Z_LIN_A,
H7ZALT_LIN_A,
HBROTLI_LIN_A,
HZSTD_LIN_A
{$ENDIF}
   : result:=true;
   end;
if result=false then s:=s+fname+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
end;

procedure internalbincheck;//check binaries invoked by peazip againsts list of known SHA256 hash values
var
   s,st,hs:ansistring;
   fexe:integer;
begin
s:='';
fexe:=0;
//executables
checkchash(executable_path+'pea'+EXEEXT,s,fexe);
checkchash(binpath+'Configure PeaZip'+EXEEXT,s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+alias7z+EXEEXT,s,fexe);//in case of alias, test the custom 7z binary against known hash values
checkchash(binpath+'arc'+DirectorySeparator+'arc'+EXEEXT,s,fexe);
checkchash(binpath+'brotli'+DirectorySeparator+'brotli'+EXEEXT,s,fexe);
checkchash(binpath+'unace'+DirectorySeparator+'unace'+EXEEXT,s,fexe);
checkchash(binpath+'upx'+DirectorySeparator+'upx'+EXEEXT,s,fexe);
checkchash(binpath+'quad'+DirectorySeparator+'bcm'+EXEEXT,s,fexe);
checkchash(binpath+'lpaq'+DirectorySeparator+'lpaq8'+EXEEXT,s,fexe);
checkchash(binpath+'paq'+DirectorySeparator+'paq8o'+EXEEXT,s,fexe);
checkchash(binpath+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT,s,fexe);
checkchash(binpath+'zstd'+DirectorySeparator+'zstd'+EXEEXT,s,fexe);
{$IFDEF MSWINDOWS}
checkchash(binpath+'upx'+DirectorySeparator+'strip'+EXEEXT,s,fexe);
checkchash(binpath+'quad'+DirectorySeparator+'balz'+EXEEXT,s,fexe);
checkchash(binpath+'quad'+DirectorySeparator+'quad'+EXEEXT,s,fexe);
checkchash(binpath+'lpaq'+DirectorySeparator+'lpaq1'+EXEEXT,s,fexe);
checkchash(binpath+'lpaq'+DirectorySeparator+'lpaq5'+EXEEXT,s,fexe);
checkchash(binpath+'paq'+DirectorySeparator+'paq8f'+EXEEXT,s,fexe);
checkchash(binpath+'paq'+DirectorySeparator+'paq8jd'+EXEEXT,s,fexe);
checkchash(binpath+'paq'+DirectorySeparator+'paq8l'+EXEEXT,s,fexe);
{$ENDIF}
//libraries
checkchash(binpath+'7z'+DirectorySeparator+'7z.sfx',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'7zCon.sfx',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'7zCon.linux.sfx',s,fexe);
checkchash(binpath+'arc'+DirectorySeparator+'arc-tiny.linux.sfx',s,fexe);
checkchash(binpath+'arc'+DirectorySeparator+'arc-tiny.sfx',s,fexe);
checkchash(binpath+'arc'+DirectorySeparator+'freearc.sfx',s,fexe);
checkchash(binpath+'arc'+DirectorySeparator+'freearc-installer.sfx',s,fexe);
checkchash(binpath+'arc'+DirectorySeparator+'freearc-tiny.sfx',s,fexe);
{$IFDEF MSWINDOWS}
checkchash(executable_path+'dragdropfilesdll.dll',s,fexe);
checkchash(binpath+'arc'+DirectorySeparator+'facompress.dll',s,fexe);
checkchash(binpath+'arc'+DirectorySeparator+'facompress_mt.dll',s,fexe);
checkchash(binpath+'unace'+DirectorySeparator+'UNACEV2.DLL',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'7z.dll',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'brotli.dll',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'flzma2.dll',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lizard.dll',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz4.dll',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz5.dll',s,fexe);
checkchash(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'zstd.dll',s,fexe);
{$ELSE}
{$IFDEF DARWIN}
checkchash(binpath+'lib'+DirectorySeparator+'libzstd.1.dylib',s,fexe);
{$ENDIF}
checkchash(binpath+'7z'+DirectorySeparator+'codecs'+DirectorySeparator+'Rar.so',s,fexe);
{$ENDIF}
//results
if s<>'' then pMessageWarningOK(inttostr(fexe)+' '+txt_8_7_bintest+char($0d)+char($0a)+char($0d)+char($0a)+txt_8_7_hnotok+char($0d)+char($0a)+char($0d)+char($0a)+s)
else pMessageInfoOK(inttostr(fexe)+' '+txt_8_7_bintest+char($0d)+char($0a)+char($0d)+char($0a)+txt_8_7_hok);
end;

procedure internaldllcheck;//check dragdropfilesdll.dll (sole dll belonging to the project loaded at application startup, even if unused until drag and drop events) againsts list of known SHA256 hash values
var
   st,hs:ansistring;
begin
{$IFDEF MSWINDOWS}
st:=executable_path+'dragdropfilesdll.dll';
hs:=getchash(st);
{$IFDEF WIN32}if hs<>HDDDLL_WIN32_X then begin pMessageErrorOK(txt_6_5_error+' / dragdropfilesdll.dll SHA256 hash'); halt; end;{$ENDIF}
{$IFDEF WIN64}if hs<>HDDDLL_WIN64_X then begin pMessageErrorOK(txt_6_5_error+' / dragdropfilesdll.dll SHA256 hash'); halt; end;{$ENDIF}
{$ENDIF}
end;

{///////////////////////////////////////////////////////////////////////////////

subsection LOCAL RESOURCES paths and filesystem information

///////////////////////////////////////////////////////////////////////////////}

procedure testwinrar;
begin
if libre_directive=2 then
   begin
   havewinrar:=false;
   exit;
   end;
if setrarmanual=1 then
   begin
   havewinrar:=true;
   FormPeach.EditNameCustom.Caption:=FormPeach.pcustom1.caption;
   end
else
   begin
   {$IFDEF MSWINDOWS}
   havewinrar:=true;
   if fileexists(GetEnvironmentVariable('ProgramFiles')+'\WinRAR\Rar.exe') then FormPeach.EditNameCustom.Caption:=GetEnvironmentVariable('ProgramFiles')+'\WinRAR\Rar.exe'
   else
      if fileexists(GetEnvironmentVariable('ProgramW6432')+'\WinRAR\Rar.exe') then FormPeach.EditNameCustom.Caption:=GetEnvironmentVariable('ProgramW6432')+'\WinRAR\Rar.exe'
      else
         if fileexists(executable_path+'Rar.exe') then FormPeach.EditNameCustom.Caption:=executable_path+'Rar.exe'
         else
            if fileexists(binpath+'Rar.exe') then FormPeach.EditNameCustom.Caption:=binpath+'Rar.exe'
            else
               if fileexists(binpath+'rar\Rar.exe') then FormPeach.EditNameCustom.Caption:=binpath+'rar\Rar.exe'
               else
                  if fileexists(binpath+'unrar\Rar.exe') then FormPeach.EditNameCustom.Caption:=binpath+'unrar\Rar.exe'
                  else
                     havewinrar:=false;
   {$ELSE}
   havewinrar:=true; // sbin variants excluded
   if fileexists('/usr/local/bin/rar') then FormPeach.EditNameCustom.Caption:='/usr/local/bin/rar'
   else
      if fileexists('/usr/bin/rar') then FormPeach.EditNameCustom.Caption:='/usr/bin/rar'
      else
         if fileexists('/bin/rar') then FormPeach.EditNameCustom.Caption:='/bin/rar'
         else
            if fileexists('/opt/homebrew/bin/rar') then FormPeach.EditNameCustom.Caption:='/opt/homebrew/bin/rar'
            else
               if fileexists(home_path+'bin/rar') then FormPeach.EditNameCustom.Caption:=home_path+'bin/rar'
               else
                  if fileexists(home_path+'.local/bin/rar') then FormPeach.EditNameCustom.Caption:=home_path+'.local/bin/rar'
                  else
                     havewinrar:=false;
   {$ENDIF}
   end;
if (havewinrar=false) or (userar<>1) then
   begin
   FormPeach.cbType.Items[4]:=txt_custom;
   FormPeach.mprofilerar.visible:=false;
   FormPeach.pmmorerecover.Caption:=txt_7_4_recover+' (ARC)';
   FormPeach.po_recover.Caption:=txt_7_4_recover+' (ARC)';
   FormPeach.mcomment.Caption:=txt_7_4_comment+' (RAR '+txt_9_4_r+', ZIP, ZIPX)';
   FormPeach.po_commentzip.Caption:=txt_7_4_comment+' (RAR '+txt_9_4_r+', ZIP, ZIPX)';
   FormPeach.pmmorecommentzip.Caption:=txt_7_4_comment+' (RAR '+txt_9_4_r+', ZIP, ZIPX)';
   FormPeach.pmscomment.Caption:=txt_7_4_comment+' (RAR '+txt_9_4_r+', ZIP, ZIPX)';
   end
else
   begin
   FormPeach.cbType.Items[4]:=txt_custom+'/RAR';
   FormPeach.mprofilerar.visible:=true;
   FormPeach.pmmorerecover.Caption:=txt_7_4_recover+' (ARC, RAR)';
   FormPeach.po_recover.Caption:=txt_7_4_recover+' (ARC, RAR)';
   FormPeach.mcomment.Caption:=txt_7_4_comment+' (RAR, ZIP, ZIPX)';
   FormPeach.po_commentzip.Caption:=txt_7_4_comment+' (RAR, ZIP, ZIPX)';
   FormPeach.pmmorecommentzip.Caption:=txt_7_4_comment+' (RAR, ZIP, ZIPX)';
   FormPeach.pmscomment.Caption:=txt_7_4_comment+' (RAR, ZIP, ZIPX)';
   FormPeach.EditExtensionCustom.Caption:='rar';
   FormPeach.cbRARmanual.Hint:=FormPeach.EditNameCustom.Caption;
   end;
end;

function wingetprogramsfolder:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
winpfolder:='';
winpfolder32:='';
winpfolder:=(GetEnvironmentVariable('ProgramW6432'));
if winpfolder='' then //XP and older
   begin
   winpfolder:=(GetEnvironmentVariable('ProgramFiles'));
   winpfolder32:=winpfolder;
   end
else //Vista and newer
   begin
   winpfolder:=(GetEnvironmentVariable('ProgramFiles'));
   winpfolder32:=(GetEnvironmentVariable('ProgramFiles(x86)'));
   if winpfolder=winpfolder32 then winpfolder:=(GetEnvironmentVariable('ProgramW6432'));
   end;
Result:=0;
setendingdirseparator(winpfolder);
setendingdirseparator(winpfolder32);
if not(checkdirexists(winpfolder)) then
   begin
   winpfolder:='';
   Result:=1;
   end;
if not(checkdirexists(winpfolder32)) then
   begin
   winpfolder32:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetsystemfolder:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
winsysfolder:='';
winsysfolder:=(GetEnvironmentVariable('SystemRoot'));
Result:=0;
setendingdirseparator(winsysfolder);
if not(checkdirexists(winsysfolder)) then
   begin
   winsysfolder:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetdesk:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
desktop_path:=GetWindowsSpecialDir(CSIDL_DESKTOPDIRECTORY);
if not(checkdirexists(desktop_path)) then desktop_path:=(GetEnvironmentVariable('USERPROFILE'))+'\Desktop\'; //try from environment variable
if not(checkdirexists(desktop_path)) then desktop_path:=GetWindowsSpecialDir(CSIDL_COMMON_DESKTOPDIRECTORY);//fallback on common desktop
if not(checkdirexists(desktop_path)) then desktop_path:=GetWindowsSpecialDir(CSIDL_PROFILE);//fallback on profile
if not(checkdirexists(desktop_path)) then
   begin
   desktop_path:='C:\';//fallback on C:\ rather than casting error on desktop (default initial dir)
   Result:=0;
   end
else Result:=0;
setendingdirseparator(desktop_path);
{$ENDIF}
end;

function wingetuserprofile:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
home_path:=GetWindowsSpecialDir(CSIDL_PROFILE);
if not(checkdirexists(home_path)) then home_path:=(GetEnvironmentVariable('USERPROFILE'))+directoryseparator;
setendingdirseparator(home_path);
if not(checkdirexists(home_path)) then
   begin
   home_path:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetappdatafolder:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
winappdatafolder:=GetWindowsSpecialDir(CSIDL_APPDATA);
if not(checkdirexists(winappdatafolder)) then winappdatafolder:=(GetEnvironmentVariable('APPDATA'))+directoryseparator;
setendingdirseparator(winappdatafolder);
if not(checkdirexists(winappdatafolder)) then
   begin
   winappdatafolder:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetappdata(var s:ansistring):integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
wingetappdatafolder;
s:=winappdatafolder+'PeaZip\';
wingetappdata:=0;
{$ENDIF}
end;

function wingetdocuments:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_documents:=GetWindowsSpecialDir(CSIDL_PERSONAL);
setendingdirseparator(usr_documents);
if not(checkdirexists(usr_documents)) then
   begin
   usr_documents:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetmusic:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_music:=GetWindowsSpecialDir(CSIDL_MYMUSIC);
setendingdirseparator(usr_music);
if not(checkdirexists(usr_music)) then
   begin
   usr_music:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetpictures:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_pictures:=GetWindowsSpecialDir(CSIDL_MYPICTURES);
setendingdirseparator(usr_pictures);
if not(checkdirexists(usr_pictures)) then
   begin
   usr_pictures:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetvideos:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_videos:=GetWindowsSpecialDir(CSIDL_MYVIDEO);
setendingdirseparator(usr_videos);
if not(checkdirexists(usr_videos)) then
   begin
   usr_videos:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetsendto:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_sendto:=GetWindowsSpecialDir(CSIDL_SENDTO);
setendingdirseparator(usr_sendto);
if not(checkdirexists(usr_sendto)) then
   begin
   usr_sendto:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetpublicdocuments:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
public_documents:=GetWindowsSpecialDir(CSIDL_COMMON_DOCUMENTS);
setendingdirseparator(public_documents);
if not(checkdirexists(public_documents)) then
   begin
   public_documents:='';
   FormPeach.pmJumppubdoc.Visible:=false;
   FormPeach.MenuItemArchive_pubdoc.Visible:=false;
   FormPeach.MenuItemOpen_pubdoc.Visible:=false;
   FormPeach.mextto_pubdoc.Visible:=false;
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetpublichome:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
try
public_home:=(GetEnvironmentVariable('PUBLIC'));
if public_home='' then
else
   if public_home[length(public_home)]<>directoryseparator then public_home:=public_home+directoryseparator;
except
end;
if not(checkdirexists(public_home)) then
   begin
   public_home:='';
   FormPeach.pmJumppubhome.Visible:=false;
   FormPeach.MenuItemArchive_pubhome.Visible:=false;
   FormPeach.MenuItemOpen_pubhome.Visible:=false;
   FormPeach.mextto_pubhome.Visible:=false;
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetrecent:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_recent:=GetWindowsSpecialDir(CSIDL_RECENT);
setendingdirseparator(usr_recent);
if not(checkdirexists(usr_recent)) then
   begin
   usr_recent:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetdownloads:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_downloads:='';
if winver<>'nt6+' then
   begin
   FormPeach.pmJumpdownloads.Visible:=false;
   exit;
   end;
usr_downloads:=home_path+'Downloads\';
if not(checkdirexists(usr_downloads)) then
   begin
   usr_downloads:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetsearches:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_searches:='';
usr_searches:=home_path+'Searches\';
if not(checkdirexists(usr_searches)) then
   begin
   usr_searches:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function wingetlibraries:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
usr_libraries:='';
usr_libraries:=home_path+'AppData\Roaming\Microsoft\Windows\Libraries\';
if not(checkdirexists(usr_libraries)) then
   begin
   usr_libraries:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

function getapplebk:integer;
begin
Result:=-1;
FormPeach.pmjumpapple.Visible:=false;
{$IFDEF MSWINDOWS}
applebk:='';
if winver<>'nt6+' then exit;
applebk:=home_path+'AppData\Roaming\Apple Computer\';
if not(checkdirexists(applebk)) then applebk:=home_path+'Apple\';
if not(checkdirexists(applebk)) then
   begin
   applebk:='';
   Result:=1;
   exit;
   end;
FormPeach.pmjumpapple.Visible:=true;
Result:=0;
{$ENDIF}
end;

function sysgetshared:integer;
begin
sysgetshared:=-1;
shared_dropbox:='';
shared_googledrive:='';
shared_onedrive:='';
shared_sharepointwork:='';
shared_yandex:='';
FormPeach.pmqjdropbox.visible:=false;
FormPeach.pmqjgoogledrive.visible:=false;
FormPeach.pmqjonedrive.visible:=false;
FormPeach.pmqjshp.visible:=false;
FormPeach.pmqjy.visible:=false;
{$IFDEF MSWINDOWS}
if checkdirexists(home_path+'Dropbox') then
   begin
   shared_dropbox:=home_path+'Dropbox\';
   FormPeach.pmqjdropbox.visible:=true;
   end;
if checkdirexists(home_path+'Google Drive') then
   begin
   shared_googledrive:=home_path+'Google Drive\';
   FormPeach.pmqjgoogledrive.visible:=true;
   end;
if checkdirexists(home_path+'OneDrive') then
   begin
   shared_onedrive:=home_path+'OneDrive\';
   FormPeach.pmqjonedrive.visible:=true;
   end;
if checkdirexists(home_path+'Workspaces') then
   begin
   shared_sharepointwork:=home_path+'Workspaces\';
   FormPeach.pmqjshp.visible:=true;
   end;
if checkdirexists(home_path+'YandexDisk') then
   begin
   shared_yandex:=home_path+'YandexDisk\';
   FormPeach.pmqjy.visible:=true;
   end;
{$ENDIF}
{$IFDEF LINUX}
{$ENDIF}
FormPeach.MenuItemArchive_dropbox.visible:=FormPeach.pmqjdropbox.visible;
FormPeach.MenuItemArchive_googledrive.visible:=FormPeach.pmqjgoogledrive.visible;
FormPeach.MenuItemArchive_onedrive.visible:=FormPeach.pmqjonedrive.visible;
FormPeach.MenuItemArchive_shp.visible:=FormPeach.pmqjshp.visible;
FormPeach.MenuItemArchive_y.visible:=FormPeach.pmqjy.visible;
FormPeach.MenuItemOpen_dropbox.visible:=FormPeach.pmqjdropbox.visible;
FormPeach.MenuItemOpen_googledrive.visible:=FormPeach.pmqjgoogledrive.visible;
FormPeach.MenuItemOpen_onedrive.visible:=FormPeach.pmqjonedrive.visible;
FormPeach.MenuItemOpen_shp.visible:=FormPeach.pmqjshp.visible;
FormPeach.MenuItemOpen_y.visible:=FormPeach.pmqjy.visible;
FormPeach.mextto_dropbox.visible:=FormPeach.pmqjdropbox.visible;
FormPeach.mextto_googledrive.visible:=FormPeach.pmqjgoogledrive.visible;
FormPeach.mextto_onedrive.visible:=FormPeach.pmqjonedrive.visible;
FormPeach.mextto_shp.visible:=FormPeach.pmqjshp.visible;
FormPeach.mextto_y.visible:=FormPeach.pmqjy.visible;
sysgetshared:=0;
end;

procedure set_win_antivirus;
var
  avgver,istr:integer;
  mbampath,esetdir:ansistring;
  astr,bstr,cstr,dstr:array [1..8] of ansistring;
begin
{$IFDEF MSWINDOWS}
istr:=0;
//Windows defender with or without GUI
if fileexists(winpfolder32+'Windows Defender\MSASCui.exe') or fileexists(winpfolder32+'Windows Defender\MpCmdRun.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Microsoft Windows Defender';
   bstr[istr]:=wincomspec+' /k ""'+winpfolder32+'Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File ';
   cstr[istr]:='"';
   if fileexists(winpfolder32+'Windows Defender\MSASCui.exe') then dstr[istr]:=winpfolder32+'Windows Defender\MSASCui.exe'
   else dstr[istr]:=winpfolder32+'Windows Defender\MpCmdRun.exe';
   end;
if fileexists(winpfolder+'Windows Defender\MSASCui.exe') or fileexists(winpfolder+'Windows Defender\MpCmdRun.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Microsoft Windows Defender';
   bstr[istr]:=wincomspec+' /k ""'+winpfolder+'Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File ';
   cstr[istr]:='"';
   if fileexists(winpfolder+'Windows Defender\MSASCui.exe') then dstr[istr]:=winpfolder+'Windows Defender\MSASCui.exe'
   else dstr[istr]:=winpfolder+'Windows Defender\MpCmdRun.exe';
   end;
//Avira
if fileexists(winpfolder32+'Avira\AntiVir Desktop\avscan.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Avira AntiVir Personal';
   bstr[istr]:='"'+winpfolder32+'Avira\AntiVir Desktop\avscan.exe" /GUIMODE=1 /PATH=';
   cstr[istr]:='';
   dstr[istr]:=winpfolder32+'Avira\AntiVir Desktop\avcenter.exe';
   end;
if fileexists(winpfolder+'Avira\AntiVir Desktop\avscan.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Avira AntiVir Personal';
   bstr[istr]:='"'+winpfolder+'Avira\AntiVir Desktop\avscan.exe" /GUIMODE=1 /PATH=';
   cstr[istr]:='';
   dstr[istr]:=winpfolder+'Avira\AntiVir Desktop\avcenter.exe';
   end;
//ClamWin
if fileexists(winpfolder32+'ClamWin\Bin\ClamWin.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='ClamWin';
   bstr[istr]:='"'+winpfolder32+'ClamWin\Bin\ClamWin.exe" --mode="scanner" --path=';
   cstr[istr]:='';
   dstr[istr]:=winpfolder32+'ClamWin\Bin\ClamWin.exe';
   end;
if fileexists(winpfolder+'ClamWin\Bin\ClamWin.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='ClamWin';
   bstr[istr]:='"'+winpfolder+'ClamWin\Bin\ClamWin.exe" --mode="scanner" --path=';
   cstr[istr]:='';
   dstr[istr]:=winpfolder+'ClamWin\Bin\ClamWin.exe';
   end;
//ESET
esetdir:='';
if fileexists(winpfolder32+'ESET\ESET Smart Security\ecls.exe') then esetdir:=winpfolder32+'ESET\ESET Smart Security\';
if fileexists(winpfolder32+'ESET\ESET NOD32 Antivirus\ecls.exe') then esetdir:=winpfolder32+'ESET\ESET NOD32 Antivirus\';
if fileexists(winpfolder+'ESET\ESET Smart Security\ecls.exe') then esetdir:=winpfolder+'ESET\ESET Smart Security\';
if fileexists(winpfolder+'ESET\ESET NOD32 Antivirus\ecls.exe') then esetdir:=winpfolder+'ESET\ESET NOD32 Antivirus\';
if esetdir<>'' then
   begin
   istr:=istr+1;
   astr[istr]:='ESET/NOD32';
   bstr[istr]:='"'+esetdir+'ecls.exe" ';
   cstr[istr]:='';
   dstr[istr]:='"'+esetdir+'egui.exe"';
   end;
//MBAM
mbampath:='';
if fileexists(winpfolder32+'Malwarebytes'' Anti-Malware\mbam.exe') then mbampath:=winpfolder32+'Malwarebytes'' Anti-Malware\mbam.exe';
if fileexists(winpfolder+'Malwarebytes'' Anti-Malware\mbam.exe') then mbampath:=winpfolder+'Malwarebytes'' Anti-Malware\mbam.exe';
if fileexists(winpfolder32+'MALWAREBYTES ANTI-MALWARE\mbam.exe') then mbampath:=winpfolder32+'MALWAREBYTES ANTI-MALWARE\mbam.exe';
if fileexists(winpfolder+'MALWAREBYTES ANTI-MALWARE\mbam.exe') then mbampath:=winpfolder+'MALWAREBYTES ANTI-MALWARE\mbam.exe';
if fileexists(winpfolder32+'Malwarebytes\Anti-Malware\mbam.exe') then mbampath:=winpfolder32+'Malwarebytes\Anti-Malware\mbam.exe';
if fileexists(winpfolder+'Malwarebytes\Anti-Malware\mbam.exe') then mbampath:=winpfolder+'Malwarebytes\Anti-Malware\mbam.exe';
if mbampath<>'' then
   begin
   istr:=istr+1;
   astr[istr]:='Malwarebyte''s Anti-Malware';
   bstr[istr]:='"'+mbampath+'" ';  //MBAM free version does not support scripting the scan
   cstr[istr]:='';
   dstr[istr]:='"'+mbampath+'"';
   end;
//SpybotSD
if fileexists(winpfolder32+'Spybot - Search & Destroy\SDFiles.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Spybot - Search and Destroy';
   bstr[istr]:='"'+winpfolder32+'Spybot - Search & Destroy\SDFiles.exe" ';
   cstr[istr]:='';
   dstr[istr]:=winpfolder32+'Spybot - Search & Destroy\SpybotSD.exe';
   end;
if fileexists(winpfolder+'Spybot - Search & Destroy\SDFiles.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Spybot - Search and Destroy';
   bstr[istr]:='"'+winpfolder+'Spybot - Search & Destroy\SDFiles.exe" ';
   cstr[istr]:='';
   dstr[istr]:=winpfolder+'Spybot - Search & Destroy\SpybotSD.exe';
   end;
//VirusTotal Uploader
if fileexists(winpfolder32+'VirusTotalUploader2\VirusTotalUpload2.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='VirusTotal';
   bstr[istr]:='"'+winpfolder32+'VirusTotalUploader2\VirusTotalUpload2.exe" ';
   cstr[istr]:='';
   dstr[istr]:=winpfolder32+'VirusTotalUploader2\VirusTotalUpload2.exe';
   end;
if fileexists(winpfolder+'VirusTotalUploader2\VirusTotalUpload2.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='VirusTotal';
   bstr[istr]:='"'+winpfolder+'VirusTotalUploader2\VirusTotalUpload2.exe" ';
   cstr[istr]:='';
   dstr[istr]:=winpfolder+'VirusTotalUploader2\VirusTotalUpload2.exe';
   end;

with FormPeach do
begin
StringGridCustEditAdv.Cells[1,1]:=astr[1];
advedit1before:=bstr[1];
advedit1after:=cstr[1];
advedit1alt:=dstr[1];
StringGridCustEditAdv.Cells[1,2]:=astr[2];
advedit2before:=bstr[2];
advedit2after:=cstr[2];
advedit2alt:=dstr[2];
StringGridCustEditAdv.Cells[1,3]:=astr[3];
advedit3before:=bstr[3];
advedit3after:=cstr[3];
advedit3alt:=dstr[3];
StringGridCustEditAdv.Cells[1,4]:=astr[4];
advedit4before:=bstr[4];
advedit4after:=cstr[4];
advedit4alt:=dstr[4];
StringGridCustEditAdv.Cells[1,5]:=astr[5];
advedit5before:=bstr[5];
advedit5after:=cstr[5];
advedit5alt:=dstr[5];
StringGridCustEditAdv.Cells[1,6]:=astr[6];
advedit6before:=bstr[6];
advedit6after:=cstr[6];
advedit6alt:=dstr[6];
StringGridCustEditAdv.Cells[1,7]:=astr[7];
advedit7before:=bstr[7];
advedit7after:=cstr[7];
advedit7alt:=dstr[7];
StringGridCustEditAdv.Cells[1,8]:=astr[8];
advedit8before:=bstr[8];
advedit8after:=cstr[8];
advedit8alt:=dstr[8];
end;
{$ENDIF}
end;

procedure getcurrentfs(var s,sfs:ansistring);
var
   sdrive:ansistring;
   bufVolumeName, bufFSName: array[0..255] of Char;
   sn,mc,flags:dword;
begin
{$IFDEF MSWINDOWS}
sdrive:=extractfiledrive(s)+'\';
GetVolumeInformation(Pchar(sdrive),
@bufVolumeName, sizeof(bufVolumeName),
@sn, mc, flags,
@bufFSName, sizeof(bufFSName));
sfs:=bufFSName;
{$ELSE}
sfs:=txt_fs;
{$ENDIF}
end;

{///////////////////////////////////////////////////////////////////////////////

subsection PATH CHECKING routines

///////////////////////////////////////////////////////////////////////////////}

procedure checkoutpath_archive;
begin
if FormPeach.visible=true then
   if pathistmp(FormPeach.EditAddName.Text)=true then
      FormPeach.EditAddName.Color:=PLYELLOW
   else
      FormPeach.EditAddName.Color:=stringtocolor(color2);
end;

procedure tempcheckoutpath_extract;
begin
if FormPeach.visible=true then
   if pos(STR_TMP,FormPeach.EditOutExtract.Text)<>0 then
      if (checkdirexists(FormPeach.pnha1.Caption)=true) and (pos(STR_TMP,FormPeach.pnha1.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha1.Caption
      else
         if (checkdirexists(FormPeach.pnha2.Caption)=true) and (pos(STR_TMP,FormPeach.pnha2.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha2.Caption
         else
            if (checkdirexists(FormPeach.pnha3.Caption)=true) and (pos(STR_TMP,FormPeach.pnha3.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha3.Caption
            else
               if (checkdirexists(FormPeach.pnha4.Caption)=true) and (pos(STR_TMP,FormPeach.pnha4.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha4.Caption
               else
                  if (checkdirexists(FormPeach.pnha5.Caption)=true) and (pos(STR_TMP,FormPeach.pnha5.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha5.Caption
                  else
                     if (checkdirexists(FormPeach.pnha6.Caption)=true) and (pos(STR_TMP,FormPeach.pnha6.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha6.Caption
                     else
                        if (checkdirexists(FormPeach.pnha7.Caption)=true) and (pos(STR_TMP,FormPeach.pnha7.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha7.Caption
                        else
                           if (checkdirexists(FormPeach.pnha8.Caption)=true) and (pos(STR_TMP,FormPeach.pnha8.Caption)=0) then FormPeach.EditOutExtract.Text:=FormPeach.pnha8.Caption;
end;

procedure checkoutpath_extract;
begin
if FormPeach.visible=true then
   if pathistmp(FormPeach.EditOutExtract.Text)=true then
      begin
      FormPeach.EditOutExtract.Color:=PLYELLOW;
      if pos(STR_TMP,FormPeach.EditOutExtract.Text)<>0 then FormPeach.EditOutExtract.Hint:=txt_7_0_exttmppath+char($0D)+char($0A)+copy(FormPeach.EditOutExtract.Caption,0,pos(STR_TMP,FormPeach.EditOutExtract.Caption)-1);
      end
   else
      begin
      FormPeach.EditOutExtract.Color:=stringtocolor(color2);
      FormPeach.EditOutExtract.Hint:='';
      end;
updatecontent_ext;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection LOCALIZATION text and translations related routines

///////////////////////////////////////////////////////////////////////////////}

function valorize_text:integer;
var
   s:ansistring;
begin
valorize_text:=-1;
try
readln(t,s);
readln(t,s); txt_11_2_comp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_2_funexp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_1_pp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_adv:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_bt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_good:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_items:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_native:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_pr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_rendering:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_sch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_sharp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_soft:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_strong:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_vw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_11_0_w:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_9_deletearchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_9_kfl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_9_mb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_8_log:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_8_rv:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_8_bk:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_8_params:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_8_untarerr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_errload:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_errfile:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_first:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_fit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_fith:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_fitw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_keep:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_next:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_prev:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_pwh:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_images:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_7_thumbnails:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_6_virtual:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_fr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_sectype:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_checkmotw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_sectypewarning:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_pathlock:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_type_description_rar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_sh:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_5_ntfsalt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_4_moving:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_3_classic:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_3_ascii:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_3_minimal:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_3_m:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_3_pm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_3_aw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_2_savecopy:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_1_full:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_1_kdfw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_1_under:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_0_exptrash:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_0_ptarzst:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_0_ptarxz:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_0_ptargz:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_0_comp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_0_save:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_10_0_tp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_9_uac:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); TXT_9_9_kdf:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_9_utc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_8_alwaysflat:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_8_fnew:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_8_fsmart:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_7_tarpipe:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_7_smartsorting:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_centered:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_cside:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_loadpconfirm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_loadp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_saveppw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_savepoverwrite:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_savep:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_6_scside:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_all:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_precond:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_largea:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_mediuma:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_smalla:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_reopentab:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_savetabs:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_5_sb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_4_r:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_4_rw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_4_savecomment:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_4_hintcomment:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_continue:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_contrast:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_fsd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_fsw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_mrar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_canedit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_canforce:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_3_cannotedit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_7za:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_changelog:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_tfaq:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_compact:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_swt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_tos:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_doc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_2_updates:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_1_7zs:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_1_ac:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_1_closeall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_1_enlargeicons:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_1_ef:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_1_nw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_1_qdup:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_autoexttar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_accesstime:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_mem:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_showmainmenu:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_navmenu:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_plugind:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_df:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_hl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_sl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_9_0_tnav:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_9_empty:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_9_disp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_9_parsing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_9_stoptest:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_9_ttb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_ca:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_btn:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_cb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_centered:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_light:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_lnk:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_intnote:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_snz:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_sm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_solcol:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_snoi:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_snon:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_tab:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_altt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_autotest:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_8_cw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_csvhelp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_after:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_bintest:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_csv:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_hok:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_mo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_showhm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_showsearchbar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_showsm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_hnotok:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_7_verifybin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_6_clear:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_6_noclear:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_6_nosimple:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_6_immediate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_6_yessimple:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_5_advbrowser:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_5_detailslarge:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_5_intext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_5_listlarge:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_5_loadlayout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_5_samplescripts:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_4_keepopenerrorslist:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_mbubin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_cw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_temperature:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_mbudec:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_htab:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_maxarg:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_mbu:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_prefalgo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_skipdel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_lw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_3_noupx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_slower:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_df:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_vreport:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_ta:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_tc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_keep:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_tm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_skipet:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_alltimes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_2_supportedby:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_preparse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_bo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_bop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_nopreparse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_ed:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_togglearc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_preparsehint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_slow:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_vslow:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_1_volumes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_altcol:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_forcebrowse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_commonalgo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_forceconvert:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_defaultactionhint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_defaultaction:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_enableextand:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_forcetyping:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_setpwopt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_8_0_forcetypinghelp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_9_spacing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_9_zooming:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_changelocalization:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_custext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_destexistfile:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_dd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_priorityhigh:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_priorityidle:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_rel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_prioritynormal:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_priorityrealtime:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_requirerestart:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_tpriority:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_8_update:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_7_noneall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_7_nonetemp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_7_outtemp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_7_sys7zreq:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_7_tw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_7_sys7z:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_zipenc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_color:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_custenc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_dark:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_tno:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_forcelocalenc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_forceutf8enc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_cpnote:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_defaultenc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_dim:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_setcurdef:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_setdef:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_tadvanced:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_tsimple:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_6_tacolor:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_always:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_ask:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_autoclosesingle:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_cutlen:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_cutlenw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_dragnone:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_specialbrowse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_ee:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_draghide:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_draglh:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_draglock:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_never:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_5_repnascii:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_comment:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_7zfbrotlicomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_7zfzstandardcomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_presetrar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_tkeep:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_lock:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_locked:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_lockconfirm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_recover:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_tcurr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_setarc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_setext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_4_swzipx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_archiveerrors:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_archiveerrorshint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_clickextall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_noconfdel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_profile7zfastest:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_maxbr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_maxzstd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_profile7zfast:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_3_stl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_altcomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_clearnoupdate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_autoclosepeazip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_zpaqall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_extcomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_extcompultra:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_fbrotlicomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_fzstandardcomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_loadcompsettings:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_savecompsettings:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_source:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_2_updateclear:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_1_type_description_brotli:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_1_new:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_1_smart:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_1_profileintermediate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_1_renfilesonly:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_1_typetosearch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_1_type_description_zstd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_0_af:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_0_autoopentar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7_0_exttmppath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_9_autou:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_9_forceu:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_9_opuns:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_9_overarch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_9_uconf:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_8_ndrop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_7_nop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_6_pdupfound:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_6_rsh:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_6_pdupfind:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_6_forcemodify:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_mandatory:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_abort:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_askp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_chp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_def:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_nop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_seqerr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_sni:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_sns:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_privacy:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_showvolatile:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_force:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_warning:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_yes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_yesall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_5_np:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_absolute:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_appdirn:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_closeallother:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_closeright:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_collapse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_expand:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_full:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_new:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_openintab:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_paths:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_prepdirn:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_relative:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_4_tabbar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_3_autoadjust:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_3_cinfo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_3_syn:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_3_uar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_2_encext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_2_archive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_2_container:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_1_ec:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_6_0_msq:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_9_lff:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_9_pff:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_9_start:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_l0:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_l1:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_l2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_ascii:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_cp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_fs:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_utf:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_8_fsr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_7_pinstalled:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_7_pmissing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_7_plugin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_6_basic:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_6_exarc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_6_tab:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_6_rc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_6_layouts:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_6_upexisting:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_6_verbose:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_case:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_add:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_addsel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_ext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_plugin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_copypath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_delete:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_halt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_positionw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_positionwd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_replaceneww:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_lower:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_replaceoldw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_newext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_new:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_n:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_old:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_position:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_intdir:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_replacestr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_datesameday:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_datesamehour:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_datesamemonth:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_datesameweek:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_datesameyear:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_scan:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_select:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_similar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_starting:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_string:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_subtractsel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_datehour:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_datemonth:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_dateweek:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_dateyear:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_dateday:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_upper:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_5_extw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_da:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_deletearchives:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_deletefiles:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_deleteoriginal:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_lv:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_deletearchivesconfirm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_deletefilesconfirm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_4_used:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_profilebest:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_profileadvanced:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_profilenormal:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_profileveryfast:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_profilepassword:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_profile10mb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_profilesfx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_cml:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_cmlmessage:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_exc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_ia:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_io:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_rec:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_3_resetsi:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_oadd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_zerodelete:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_zfree:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_sdfree:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_oext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_securedeletefree:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_free:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_zerofiles:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_2_zerofree:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schedadd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schederr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_daily:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_day:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_days:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_enddate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_every:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_w6:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_hourly:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_hours:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_last:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schedmanage:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_scriptmanage:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_w2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_monthly:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_months:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_onlogin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_onstart:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_once:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_w7:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schedule:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schedexplain:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schedok:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schedscripts:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_startdate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_starttime:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_w1:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_schedname:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_ts:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_w5:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_w3:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_w4:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_weekly:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_1_weeks:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_bc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_resetpm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_enum:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_music:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_ps:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_perf:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_pictures:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_removeall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_resetbookmarks:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_sh:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_skip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_5_0_videos:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_9_frame:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_9_listth:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_9_shadow:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_9_style:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_attach25:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_crop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_detailsno:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_details:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_fit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_fitl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_flip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_fullscreen:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_fun:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_h:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_keeparchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_noresize:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_iconl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_iconm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_imagemanager:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_immersive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_listno:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_aspect:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_mirror:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_presets:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_replace:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_resize:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_rl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_rr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_stop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_t:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_8_w:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_7_pk:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_7_spchar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_7_recycleask:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_7_recycle:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_7_pcomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_6_am:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_6_fm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_6_users:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_goupdate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_b:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_koupdate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_update:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_dock:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_l:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_noupdate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_properties:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_r:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_pj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_shaddress:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_shnav:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_shstatus:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_shtool:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_upxpj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_5_t:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_4_confremoveall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_4_confremove:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_pwmanhint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_exppl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_expple:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_keeppw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_pwmanpwhint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_pwmanmaster:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_pwmanlist:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_pwman:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_pwmancorr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_expplp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_recsrc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_resetpm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_3_breadcrumb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_2_arcabspath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_1_duplicateshint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_1_adminhint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_1_selected:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_1_duplicatesfound:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_1_duplicatesfind:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_1_runasadmin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_1_simplesearch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_4_0_thim:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_8_type_description_wim:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_8_type_description_xz:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_7_donations:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_7_nameasparent:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_7_tracker:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_7_sort:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_7_swapbars:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_7_themedbars:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_6_ignoredd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_6_close:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_6_resetapps:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_6_ethemes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_5_td:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_5_managecustomthemes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_4_nopaths:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_4_smallicons:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_3_skipunits:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_3_stralt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_3_apps:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_3_multi:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_3_runexp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_3_apppath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_3_run:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_2_7zutf8nonascii:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_2_alltasks:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_2_conf:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_2_donations:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_sccenc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_downloads:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_lib:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_more:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_openasarchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_sendto:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_pathexc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_recent:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_plsmartmin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_src:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_systmp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_languagetools:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_1_workingdir:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_0_nonreadableorpw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_0_readablepw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_0_configure:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_3_0_resettmp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_address:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_adv:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_columns:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_copyhere:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_noscan:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_extconsole:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_thl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_home:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_lt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_mt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_movehere:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_nav:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_navbar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_none:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_organize:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_public:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_rec:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_selected:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_setapps:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_showmenu:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_st:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_test_pw2G:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_vst:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_toolbar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_tree:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_9_views:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_experimental:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_zcopy:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_addvol:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_uniterror:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_cannotconvert:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_convertbegin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_convert:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_convertexisting:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_convertdelete:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_details:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_parallel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_convertnote:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_custom:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_unitrecommend:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_viewasarchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_nounit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_rowselect:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_statusbar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_typeunit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_8_usedefaultoutpath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_experimental:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_optional:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_list_tryflatorpw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_separate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_pwsupported:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_cancel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_encfn:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_setpw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_ext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_extfrom:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_es:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_eu:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_clipboard:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_goarclayout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_goextlayout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_ok:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_drag_archive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_oop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_validatefn:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_validatecl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_output:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_pwnotset:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_pwarcset:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_pwextset:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_archivehint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_exthint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_setadvf:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_selpath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_separateerror:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_noinput:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_dirsize:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_un7z_browse_flat:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_7_updating:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_6_folders:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_6_advanced:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_6_plalways:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_6_plsmart:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_sessionio:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_advanced:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_basic:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_cannotrun:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_custeditors:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_delete:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_delete_fromarchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_langflag:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_encpj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_execommand:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_help:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_langhint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_mini_help:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_offline_help:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_tray:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_remove:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_hintpaths:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_selectapp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_strafter:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_strbefore:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_encoding:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_5_nopw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_draghint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_tb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_adding:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_advclip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_yanswers:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_itemsheight:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_clearclipboard:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_wcommons:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_copyfrom:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_deletebookmarks:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_documents:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_wenc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_extractfrom:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_hexp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_operation:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_path:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_removefromclipboard:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_stdclip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_totalmem:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_gvideo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_wbook:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_wnews:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_wsrc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_4_wdict:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_3_pw_errorchar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_3_envstr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_3_never_pw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_3_home:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_3_on_pw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_3_test_pw100:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_2_3_test_pw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_exclude_recourse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_action_extopen:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_error_passwordnotmatch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_action_preview:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_preview_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_better:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_default2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_faster:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fastermem:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_tempdir:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_stream:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_slowermem:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_store:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_newfolder:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7z_exitcodeunknown:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_isfolder:=copy(s,pos(':',s)+2,length(s)-pos(':',s)); if txt_list_isfolder[1]<>' ' then txt_list_isfolder:=' '+txt_list_isfolder;
readln(t,s); txt_none:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7z_exitcode1:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_attach10:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7z_exitcode2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7z_exitcode255:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fat32:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_dvd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_attach5:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cd650:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7z_exitcode7:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cd700:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_7z:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_dvddl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_7z_exitcode8:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_abort:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_about:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_action:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_action_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_existing_archive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_archive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_files:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_folder:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_path:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_tolayout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_toarchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_tobookmarks:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_address_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_adv_filters:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_algo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_all:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_all_default:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_all_type:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_all_date:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_all_psize:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_all_attributes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_all_size:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_error_input_upx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_always_pw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ignore_ext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ignore_disp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ignore_sel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_key_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_timestamp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_appoptions:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_arc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_archive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_un7z_browse_ok:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_interface:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_archivecreation:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_tarbefore_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_archive_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compressionratio_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_archiving:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cl_long:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_overwrite_askbefore:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_associated:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_attributes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_author:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ren_existing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ren_extracted:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_autofolder:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_back:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_backend:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_backupexe:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_bettercompression:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_blogs:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_blowfish:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_bookmarks:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_browse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_browser:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_aborted_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_browsing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_archive_root:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_bzip2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pw_empty:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_add_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_un7z_browse_failure:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_conf_cannotsave:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_check_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_check:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_check_select:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_clear:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_clearlayout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pj_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_autoclose:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compare:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compress:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compress_executable:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compress_openforwriting:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compression:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compmanagement:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pw_confirm:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_console:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_console_interface:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_content:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_controlpanel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_convert:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_copy:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_copyto:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_create:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_create_archive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_title_create:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_create_keyfile:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_create_folder:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_create_theme:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_rr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_create_sfx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cr_current:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_custom:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_custom:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_customapp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_custom_parameters:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_customsize:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cut:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_datetime:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_default:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_default_compression:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_default_format:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_theme_default:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_hard_reset_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_desktop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_dictionary:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_dirs:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_dis:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_disk_cleanup:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_disk_defrag:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_disk_management:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_dispaly:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_displayedmnu_obj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_displayedobjects:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_nocompress:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_delete:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_wipe:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_done:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_edit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_elapsed:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_error_emptycl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_encrypt:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_encrypted:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_encryption:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_note:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_random_keys:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_random_keys_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ent:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ent_tools:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_eqorlarger:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_eqorrecent:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_eqorolder:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_eqorsmaller:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_equal:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_erase_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_extraction_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_exclude_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_exclusion_recourse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_exclusion:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_exe:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_overwrite_qry:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_confirm_overwrite:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_explore_outpath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_explore_path:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_caption_extract:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_nopath:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_all:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_allhere:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_allto:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_extopen_custom:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_extopen_with:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_disp_here:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_disp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_disp_to:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_here:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_sel_here:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_sel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ext_sel_to:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_extobj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_newfoldermenu:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_extto:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_level_fast:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fastcompr:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fastopen:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_level_fastest:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_favformats:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_file:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_filebrowser:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_filetools:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_files:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_nfiles:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fs:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_filters_recourse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_filters:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_flat:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_flat:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_unit_floppy:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_foldername:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_nfolders:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_error_input_multi:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fwd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_found:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_free:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_free2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_name_full:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_function:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_general:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_multithreading:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_go_browser:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_go_path:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_guicl:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_guipealauncher:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_graphic:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_gridaltcolor:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_gridrowheight:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_gui:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_gzip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_here:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_history:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_homeroot:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_quickbrowse_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_backupexe_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_attach:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_images:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_include_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_filters_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_inclusion_recourse:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_inclusion:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_error_function:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_info:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_infoall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_infodisp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_infosel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_inputinfo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_input_list:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_iop:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ipo:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_input:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_integrity:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_chunk_size:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_invertsel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_exe:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_return_to_archive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_not_accessible:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_unsupported:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_checkname_failed:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_not_accessible_list:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_theme_create_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_theme_exists:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_job_code:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_job_definition_saved:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_job_success:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_join:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_joinfiles:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_keyfile:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_keyfile_not_found:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_keyfile_notcreated:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_larger:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_lastused:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_launch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_layout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_filelist_savedas:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_level:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_license:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_caption_list:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_details:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_all:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_disp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_sel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_toggle_warning:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_loadfile:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_loadlayout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_unit_hd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_localization:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_lpaqver:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_lpaq:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_maininterface:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_maxcomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_level_maximum:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_restartrequired:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_required_memory:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_method:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_misc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_modify:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_morecontrols:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_morerecent:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ent_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_moveto:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_mypc:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_na:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_name:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_naming:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_unit_remote:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_newarchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cnewfolder:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_news:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_no:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_noinput:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_nocompress_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_split_noinput:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_open_noinput:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_nomatch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_singlethread:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_none2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_nonsolid:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_level_normal:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_copy_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_description:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compare_second:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_peaobj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_displayed_obj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_olderthan:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_on:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ondblclick:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_opacity:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_open:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_openarchive:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_title_open:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_open_bookmark:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cphere:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_open_file:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_open_files:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_open_path:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_opensource:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_openwith:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_aborted:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_unit_cd:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_options:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_other:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_otherparams:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_oip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_opi:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_output:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_overwrite:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_compressed_size:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_paqver:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_paq:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pio:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_poi:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_parameters:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_error_partial:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_passes:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pwlength:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_un7z_browse_pw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_un7z_browse_pw_other:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_paste:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_path:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pea_appcolor:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pea_textcolor:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_pea:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_peazip_new:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_peazip_help:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_peazip_web:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_performall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_name_provide:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_upxorstrip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_not_removable_file:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_not_removable:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_custom_executable_missing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_unsupported_select:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_no_theme_name:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_please_wait:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_copy_wait:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_previewwith:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_projectadmin:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_quad:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_quickdelete:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_quit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_unit_ram:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_read:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_recentarchives:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_rr_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_search_refine:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_fefreshf5:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_release:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_unit_removable:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_remove_bookmark:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_remove_external_unit:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_removeselected:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_rename:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_caption_repair:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_restartrequired2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_reset:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_reset_archivename:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_hardreset:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_reset_theme:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_restore_att:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_run_as:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_run_as2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_sample:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_saveas:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_savehistory:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_save_infolder:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_savejob:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_savejobdefinition:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_savejobdefinition_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_savelayout:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_save_winstate:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_search:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_searchanddrag:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_searchfor:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_nrsearch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_search_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_search_web:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_searching:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_securedelete:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_default_description:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_selectall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_selectdir:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_selected_obj:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_selected_objects:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_sfx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_sendbymail:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_set_defaults:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_settings:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_sfx_interface:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_showhints:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_show_messages:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_showpw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_singlevol:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_size:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_sizeb:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_skip_existing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_slowercomp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_smaller:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_solid:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_solid_block:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_solid_auto:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_solid_extension:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_listtest:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_sortbysel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_sorting:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_speed:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_split:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_split:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_split_file:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_list_nostats:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_status:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_level_store:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_stream_control:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_strip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_keyfile_created:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_suggestpw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_noupx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_syntax:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_sysbenchmark:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_benchmark:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_systools:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_tarbefore:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_tar:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_taskman:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_caption_test:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_testall:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_testdisp:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_testpw:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_testsel:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_col_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_bookmarks_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_archive_noinput_tolist:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_theme:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_icons_found:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_themename:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_icons_not_found:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_theme_create_success:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_theming:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_extand_error:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_threads:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_titlescolor:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_to:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_toggle_browseflat:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_toggle_historybookmarks:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_toolbarscolor:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_tools:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_best:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_level_ultra:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_error_openfile:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_cl_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ace_missing:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_units:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_unit_unknown:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_un7z_pw_untested:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_up:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_update:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_upx:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_advfilters:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_openfiles_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_usenet:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_user_name:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_using:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_volumepea:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_volume_size:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_ext_uns:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_websearch:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_websites:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_word:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_write:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_ramdompw_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_exe_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_pj_hint2:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_type_description_zip:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s); txt_zipcrypto_hint:=copy(s,pos(':',s)+2,length(s)-pos(':',s));
readln(t,s);
readln(t,s); if s<>'=== end PeaZip text group ===' then exit;
valorize_text:=0;
except
valorize_text:=-1;
end;
end;

procedure dosearchtext;
begin
FormPeach.EditOptSearch.Items.Clear;
FormPeach.EditOptSearch.Items.Add(txt_general);
FormPeach.EditOptSearch.Items.Add(txt_localization);
FormPeach.EditOptSearch.Items.Add(txt_9_2_tfaq);
FormPeach.EditOptSearch.Items.Add(txt_3_1_languagetools);
{$IFDEF MSWINDOWS}
FormPeach.EditOptSearch.Items.Add(txt_3_0_configure);
FormPeach.EditOptSearch.Items.Add(txt_6_8_ndrop);
FormPeach.EditOptSearch.Items.Add(txt_7_8_dd);
{$ENDIF}
FormPeach.EditOptSearch.Items.Add(txt_5_0_perf);
FormPeach.EditOptSearch.Items.Add(txt_8_1_bo);
FormPeach.EditOptSearch.Items.Add(txt_10_6_virtual);
FormPeach.EditOptSearch.Items.Add(txt_6_5_privacy);
FormPeach.EditOptSearch.Items.Add(txt_3_1_workingdir);
FormPeach.EditOptSearch.Items.Add(txt_reset);
FormPeach.EditOptSearch.Items.Add(txt_2_6_advanced);
FormPeach.EditOptSearch.Items.Add(txt_2_5_encoding);
FormPeach.EditOptSearch.Items.Add(txt_7_6_zipenc);
FormPeach.EditOptSearch.Items.Add(txt_3_1_sccenc);
FormPeach.EditOptSearch.Items.Add(txt_path);
FormPeach.EditOptSearch.Items.Add(txt_3_2_conf);
FormPeach.EditOptSearch.Items.Add(txt_3_3_apppath);
FormPeach.EditOptSearch.Items.Add(txt_5_9_start);
FormPeach.EditOptSearch.Items.Add(txt_backend);
FormPeach.EditOptSearch.Items.Add(txt_9_5_sb);
FormPeach.EditOptSearch.Items.Add(txt_9_1_7zs);
FormPeach.EditOptSearch.Items.Add(txt_9_2_7za);
{$IFNDEF MSWINDOWS}
FormPeach.EditOptSearch.Items.Add(txt_8_3_maxarg);
{$ENDIF}
FormPeach.EditOptSearch.Items.Add(txt_4_6_am);
FormPeach.EditOptSearch.Items.Add(txt_6_9_autou);
FormPeach.EditOptSearch.Items.Add(txt_8_0_forcebrowse);
FormPeach.EditOptSearch.Items.Add(txt_6_6_forcemodify);
FormPeach.EditOptSearch.Items.Add(txt_6_5_force);
FormPeach.EditOptSearch.Items.Add(txt_8_0_defaultaction);
FormPeach.EditOptSearch.Items.Add(txt_2_9_tree);
FormPeach.EditOptSearch.Items.Add(txt_8_0_setpwopt);
FormPeach.EditOptSearch.Items.Add(txt_pw);
FormPeach.EditOptSearch.Items.Add('TAR');
FormPeach.EditOptSearch.Items.Add(txt_7_0_autoopentar);
FormPeach.EditOptSearch.Items.Add(txt_9_0_autoexttar);
FormPeach.EditOptSearch.Items.Add(txt_8_7_after);
FormPeach.EditOptSearch.Items.Add(txt_7_3_noconfdel);
FormPeach.EditOptSearch.Items.Add(txt_2_7_oop);
FormPeach.EditOptSearch.Items.Add(txt_8_8_autotest);
FormPeach.EditOptSearch.Items.Add(txt_archive);
FormPeach.EditOptSearch.Items.Add(txt_default_format);
FormPeach.EditOptSearch.Items.Add(txt_7_4_setarc);
FormPeach.EditOptSearch.Items.Add(txt_caption_extract);
FormPeach.EditOptSearch.Items.Add(txt_5_5_intdir);
FormPeach.EditOptSearch.Items.Add(txt_7_5_ee);
FormPeach.EditOptSearch.Items.Add(txt_7_4_setext);
FormPeach.EditOptSearch.Items.Add(txt_4_6_fm);
FormPeach.EditOptSearch.Items.Add(txt_browser);
FormPeach.EditOptSearch.Items.Add(txt_filebrowser);
FormPeach.EditOptSearch.Items.Add(txt_10_5_sectype);
FormPeach.EditOptSearch.Items.Add(txt_filetools);
FormPeach.EditOptSearch.Items.Add(txt_check_select);
FormPeach.EditOptSearch.Items.Add(txt_securedelete);
FormPeach.EditOptSearch.Items.Add(txt_3_3_apps);
FormPeach.EditOptSearch.Items.Add(txt_theme);
FormPeach.EditOptSearch.Items.Add(txt_3_5_td);
FormPeach.EditOptSearch.Items.Add(txt_create_theme);
FormPeach.EditOptSearch.Items.Add(txt_7_9_zooming);
FormPeach.EditOptSearch.Items.Add(txt_2_5_help);
FormPeach.EditOptSearch.Items.Add(txt_2_5_help);
FormPeach.EditOptSearch.Items.Add(txt_peazip_help);
FormPeach.EditOptSearch.Items.Add('FAQ');
FormPeach.EditOptSearch.Items.Add(txt_3_7_tracker);
FormPeach.EditOptSearch.Items.Add(txt_9_2_changelog);
FormPeach.EditOptSearch.Items.Add(txt_2_5_offline_help);
FormPeach.EditOptSearch.Items.Add(txt_about);
FormPeach.EditOptSearch.Items.Add(txt_4_5_update);
FormPeach.EditOptSearch.Items.Add(txt_7_8_update);
FormPeach.EditOptSearch.Items.Add(txt_5_5_plugin);
FormPeach.EditOptSearch.Items.Add(txt_8_7_verifybin);
FormPeach.EditOptSearch.Items.Add(txt_4_3_pwman);
FormPeach.EditOptSearch.Items.Add(txt_keyfile);
FormPeach.EditOptSearch.Items.Add(txt_4_7_pk);
FormPeach.EditOptSearch.Items.Add(txt_8_5_samplescripts);
FormPeach.EditOptSearch.Items.Add(txt_4_5_pj);
end;

procedure assign_guitext; //set text
var
   i:integer;
begin
FormPeach.Caption:=APPMAIN;
with FormPeach do
begin
try
dosearchtext;
csbroot.Hint:=txt_mypc;
csbhome.Hint:=txt_2_9_home;
csbdesk.Hint:=txt_desktop;
csbdownloads.Hint:=txt_3_1_downloads;
csbdoc.Hint:=txt_2_4_documents;
csbmusic.Hint:=txt_5_0_music;
csbpic.Hint:=txt_5_0_pictures;
csbvid.Hint:=txt_5_0_videos;
cbRARmanual.Caption:=txt_9_3_mrar;
Labelsetwork.Caption:=txt_settings+' > '+txt_3_1_workingdir;
pmtoolsmall.Caption:=txt_2_9_st;
LabelAddressBar.Caption:=txt_2_9_address;
cbSolidAddress.Items.Clear;
cbSolidAddress.Items.Add(txt_8_8_cw);
cbSolidAddress.Items.Add(txt_8_8_cb+' / '+txt_8_8_light);
cbSolidAddress.Items.Add(txt_8_8_cb);
cbSolidAddress.Items.Add(txt_8_8_cb+' / '+txt_7_6_dim);
cbSolidAddress.Items.Add(txt_8_8_cb+' / '+txt_7_6_dark);
cbSolidAddress.Items.Add(txt_8_8_ca+' / '+txt_8_8_light);
cbSolidAddress.Items.Add(txt_8_8_ca);
cbSolidAddress.Items.Add(txt_8_8_ca+' / '+txt_7_6_dim);
cbSolidAddress.Items.Add(txt_8_8_ca+' / '+txt_7_6_dark);
CheckBoxCenteredToolbar.Caption:=txt_8_8_centered;
CheckBoxsnzExt.Caption:=txt_8_8_snz;
CheckBoxsnoi.Caption:=txt_8_8_snoi;
CheckBoxsnon.Caption:=txt_8_8_snon;
CheckBoxZstdErrPolicy.Caption:=txt_10_7_keep;
LabelColorAddressbar.Caption:=txt_8_8_solcol;
LabelTabsStyle.Caption:=txt_8_8_altt;
cbAltTabStyle.Items.Clear;
cbAltTabStyle.Items.Add(txt_8_8_btn);
cbAltTabStyle.Items.Add(txt_8_8_lnk);
cbAltTabStyle.Items.Add(txt_8_8_tab);
cbAltTabStyle.Items.Add(txt_8_8_btn+' / '+txt_9_6_centered);
cbAltTabStyle.Items.Add(txt_8_8_lnk+' / '+txt_9_6_centered);
cbAltTabStyle.Items.Add(txt_8_8_tab+' / '+txt_9_6_centered);
LabelColorToolBar.Caption:=txt_2_9_toolbar;
cbAltTabs.Items.Clear;
cbAltTabs.Items.Add(txt_8_8_cw+' + '+txt_8_8_cb);
cbAltTabs.Items.Add(txt_8_8_cw+' + '+txt_8_8_ca);
cbAltTabs.Items.Add(txt_8_8_cb);
cbAltTabs.Items.Add(txt_8_8_cb+' / '+txt_7_6_dim);
cbAltTabs.Items.Add(txt_8_8_ca);
cbAltTabs.Items.Add(txt_8_8_ca+' / '+txt_7_6_dim);
cbAccentToolBar.Items.Clear;
cbAccentToolBar.Items.Add(txt_8_8_cw);
cbAccentToolBar.Items.Add(txt_8_8_cb+' / '+txt_8_8_light);
cbAccentToolBar.Items.Add(txt_8_8_cb);
cbAccentToolBar.Items.Add(txt_8_8_cb+' / '+txt_7_6_dim);
cbAccentToolBar.Items.Add(txt_8_8_cb+' / '+txt_7_6_dark);
cbAccentToolBar.Items.Add(txt_8_8_ca+' / '+txt_8_8_light);
cbAccentToolBar.Items.Add(txt_8_8_ca);
cbAccentToolBar.Items.Add(txt_8_8_ca+' / '+txt_7_6_dim);
cbAccentToolBar.Items.Add(txt_8_8_ca+' / '+txt_7_6_dark);
cbAltBar.Items.Clear;
cbAltBar.Items.Add(txt_8_8_cw+' + '+txt_8_8_cb);
cbAltBar.Items.Add(txt_8_8_cw+' + '+txt_8_8_ca);
cbAltBar.Items.Add(txt_8_8_cb);
cbAltBar.Items.Add(txt_8_8_ca);
cbBoxAltBarStyle.Items.Clear;
cbBoxAltBarStyle.Items.Add(txt_2_9_none);
cbBoxAltBarStyle.Items.Add(txt_10_1_under);
cbBoxAltBarStyle.Items.Add(txt_10_1_full);
LabelmoreoptExt.Caption:=txt_8_7_mo;
LabelmoreoptAdd.Caption:=txt_8_7_mo;
LabelFileSize.Caption:=txt_all_size;
Labeloptsub8.Caption:=txt_filebrowser;
MenuItemOpen_run.Caption:=txt_3_3_run;
owrun.Caption:=txt_3_3_run;
eowrun.Caption:=txt_3_3_run;
powrun.Caption:=txt_3_3_run;
pmmorerr.Caption:=txt_rr;
po_rr.Caption:=txt_rr;
cbRARlock.Caption:=txt_7_4_lock;
CheckBoxNoConf.Caption:=txt_7_3_noconfdel;
CheckBoxzipxswitch.Caption:=txt_7_4_swzipx;
CheckBoxAC.Caption:=txt_9_1_ac;
CheckBoxBrotli.Caption:=txt_7_3_maxbr;
CheckBoxZstd.Caption:=txt_7_3_maxzstd;
CheckBoxstl.Caption:=txt_7_3_stl;
mdirbeforefiles.Caption:=txt_9_0_df;
CheckBoxssp.Caption:=txt_9_0_accesstime;
Label7zMemuse.Caption:=txt_9_0_mem;
CheckBoxsnh.Caption:=txt_9_0_hl;
CheckBoxsnl.Caption:=txt_9_0_sl;
cbtimecreated.Caption:=txt_8_2_alltimes;
cbtimecreated.Hint:=txt_8_2_supportedby+' 7Z, RAR, TAR/pax, ZIP';
CheckBoxsni.Caption:=txt_6_5_sni+' (WIM)';
CheckBoxsniExt.Caption:=txt_6_5_sni+' (WIM)';
CheckBoxsns.Caption:=txt_6_5_sns+' (WIM)';
CheckBoxsnsExt.Caption:=txt_6_5_sns+' (WIM)';
ComboBoxprivacy.Items.Clear;
ComboBoxprivacy.Items.Add(txt_6_5_nop);
ComboBoxprivacy.Items.Add(txt_6_5_askp);
ComboBoxprivacy.Items.Add(txt_6_5_askp+' '+txt_6_5_mandatory);
mtabs.Caption:=txt_6_4_tabbar;
pmhtabs.Caption:=txt_6_4_tabbar;
pmhnewtab.Caption:=txt_6_4_openintab;
pmbcnw.Caption:=txt_9_1_nw;
MenuItemInfo.Caption:=txt_path+' / '+txt_info;
MenuItemInfomenu.Caption:=txt_path+' / '+txt_info;
MenuItemToggleNav.Caption:=txt_9_0_tnav+' (Alt+4)';
MenuItemToggleStatus.Caption:=txt_toggle_historybookmarks+' (Alt+8)';
pmtabsm.Caption:=txt_6_4_tabbar;
pmtabrefresh.Caption:=txt_fefreshf5;
pmtabsnew.Caption:=txt_6_4_openintab;
pmtabsclose.Caption:=txt_3_6_close;
pmtabscloseother.Caption:=txt_6_4_closeallother;
pmtabscloseright.Caption:=txt_6_4_closeright;
pmtabscloseall.Caption:=txt_9_1_closeall;
pmtabscollapse.Caption:=txt_6_4_collapse;
pmtabsexpand.Caption:=txt_6_4_expand;
po_tabsopen.Caption:=txt_6_4_openintab;
po_windowopen.Caption:=txt_9_1_nw;
pmtabsnewwindow.Caption:=txt_9_1_nw;
pmtabsreopen.Caption:=txt_9_5_reopentab;
pmtabsbook.Caption:=txt_bookmarks;
pmtabsbookmarkadd.Caption:=txt_add_tobookmarks;
pmtabsbookmarkorg.Caption:=txt_2_9_organize+' '+txt_bookmarks;
pmsaveas.Caption:=txt_path+' / '+txt_saveas;
MenuItemOpen_saveas.Caption:=txt_path+' / '+txt_saveas;
po_analyze.Caption:=txt_5_9_lff;
MenuItemToolAnalyze.Caption:=txt_5_9_lff;
pmmoreanalysis.Caption:=txt_5_9_lff;
pmfilebrowser.caption:=txt_filebrowser;
ComboBoxLibre.Items.Clear;
ComboBoxLibre.Items.Add(txt_5_8_l0);
ComboBoxLibre.Items.Add(txt_5_8_l1);
ComboBoxLibre.Items.Add(txt_5_8_l2);
po_selectadv.Caption:=txt_5_5_select+'...';
pmrselect.Caption:=txt_5_5_select+'...';
pmselectadv.Caption:=txt_5_5_select+'...';
mselectadv.Caption:=txt_5_5_select+'...';
po_copypath.Caption:=txt_5_5_copypath;
pmhcopypath.Caption:=txt_5_5_copypath;
MenuItemCopypathsMenu.Caption:=txt_5_5_copypath;
org_autoadjust.Caption:=txt_6_3_autoadjust;
mautoadjust.Caption:=txt_6_3_autoadjust;
msmartsort.Caption:=txt_9_7_smartsorting;
pmcname.Caption:=txt_name;
pmctype.Caption:=txt_type;
pmcsize.Caption:=txt_size;
pmcpacked.Caption:=txt_info+' / '+txt_compressed_size;
pmcdate.Caption:=txt_8_2_tm;
pmcatt.Caption:=txt_attributes;
pmccrc.Caption:='CRC32';
pmcfree.Caption:=txt_free;
pmcpypath.caption:=txt_5_5_copypath;
pmcopypath.caption:=txt_5_5_copypath;
mDateYear.Caption:=txt_5_5_dateyear;
mDateMonth.Caption:=txt_5_5_datemonth;
mDateWeek.Caption:=txt_5_5_dateweek;
mDateDay.Caption:=txt_5_5_dateday;
mDateHour.Caption:=txt_5_5_datehour;
msameyear.Caption:=txt_5_5_datesameyear;
msamemonth.Caption:=txt_5_5_datesamemonth;
msameweek.Caption:=txt_5_5_datesameweek;
msameday.Caption:=txt_5_5_datesameday;
msamehour.Caption:=txt_5_5_datesamehour;
po_rename_delete.Caption:=txt_5_5_delete;
po_rename_add.Caption:=txt_5_5_add;
po_rename_cutlen.Caption:=txt_7_5_cutlen;
po_rename_ascii.Caption:=txt_7_5_repnascii;
po_rename_lowercase.Caption:=txt_5_5_lower;
po_rename_filesonly.Caption:=txt_7_1_renfilesonly;
pmr_files.Caption:=txt_7_1_renfilesonly;
po_rename_uppercase.Caption:=txt_5_5_upper;
po_rename_timestamp.Caption:=txt_timestamp;
po_rename_appenddir.Caption:=txt_6_4_appdirn;
po_rename_prependdir.Caption:=txt_6_4_prepdirn;
po_rename_replace.Caption:=txt_5_5_replacestr;
po_rename_replace_case.Caption:=txt_5_5_replacestr+' '+txt_5_5_case;
po_rename_ext.Caption:=txt_5_5_ext;
pmr_delete.Caption:=txt_5_5_delete;
pmr_add.Caption:=txt_5_5_add;
pmr_lowercase.Caption:=txt_5_5_lower;
pmr_uppercase.Caption:=txt_5_5_upper;
pmr_replace.Caption:=txt_5_5_replacestr;
pmr_replacecase.Caption:=txt_5_5_replacestr+' '+txt_5_5_case;
pmr_ext.Caption:=txt_5_5_ext;
pmr_appendts.Caption:=txt_timestamp;
pmr_appenddirname.Caption:=txt_6_4_appdirn;
pmr_prependdirname.Caption:=txt_6_4_prepdirn;
pmr_cut.Caption:=txt_7_5_cutlen;
pmr_ascii.Caption:=txt_7_5_repnascii;
CheckBoxAutoHaltA.Caption:=txt_5_5_halt;
CheckBoxAutoHaltE.Caption:=txt_5_5_halt;
po_zerofile.Caption:=txt_5_2_zerofiles+' (Alt+Del)';
pmzerofile.Caption:=txt_5_2_zerofiles+' (Alt+Del)';
po_zerofree.Caption:=txt_5_2_zerofree;
pmzerofree.Caption:=txt_5_2_zerofree;
po_securedeletefree.Caption:=txt_5_2_securedeletefree;
pmsecuredeletefree.Caption:=txt_5_2_securedeletefree;
mscheduledscripts.Caption:=txt_5_1_schedscripts;
mtaskscheduler.Caption:=txt_5_1_ts;
po_task.Caption:=txt_5_1_ts;
schedulepasswordext.Caption:=txt_pw;
scheduleuserext.Caption:=txt_run_as2;
BScheduleExt.Caption:=txt_5_1_schedadd;
scheduleendext.Caption:=txt_5_1_enddate;
LabelEveryExt.Caption:=txt_5_1_every;
LmanagescheduleExt2.Caption:=txt_5_1_schedmanage;
LmanagescheduleExt1.Caption:=txt_5_1_scriptmanage;
CheckGroupMExt.Caption:=txt_5_1_months;
lse2.Caption:=txt_5_1_schedule;
lse3.Caption:=txt_5_1_starttime;
PanelClickAddress.Hint:=txt_7_1_typetosearch;
ImageInfoSchedExt.Hint:=txt_5_1_schedexplain;
schedulestartext.Caption:=txt_5_1_startdate;
lse1.Caption:=txt_5_1_schedname;
CheckGroupMExt.Checked[0]:=true;
CheckGroupMExt.Checked[1]:=true;
CheckGroupMExt.Checked[2]:=true;
CheckGroupMExt.Checked[3]:=true;
CheckGroupMExt.Checked[4]:=true;
CheckGroupMExt.Checked[5]:=true;
CheckGroupMExt.Checked[6]:=true;
CheckGroupMExt.Checked[7]:=true;
CheckGroupMExt.Checked[8]:=true;
CheckGroupMExt.Checked[9]:=true;
CheckGroupMExt.Checked[10]:=true;
CheckGroupMExt.Checked[11]:=true;
lsadayExt.Caption:=txt_5_1_day;
ComboBoxMExt.Items.Clear;
for i:=1 to 31 do ComboBoxMExt.Items.Add(inttostr(i));
ComboBoxMExt.Items.Add(txt_5_1_last);
CheckGroupWExt.Caption:=txt_5_1_days;
CheckGroupWExt.Items.Clear;
CheckGroupWExt.Items.Add(txt_5_1_w1);
CheckGroupWExt.Items.Add(txt_5_1_w2);
CheckGroupWExt.Items.Add(txt_5_1_w3);
CheckGroupWExt.Items.Add(txt_5_1_w4);
CheckGroupWExt.Items.Add(txt_5_1_w5);
CheckGroupWExt.Items.Add(txt_5_1_w6);
CheckGroupWExt.Items.Add(txt_5_1_w7);
CheckGroupWExt.Checked[1]:=true;
CheckGroupWExt.Checked[2]:=true;
CheckGroupWExt.Checked[3]:=true;
CheckGroupWExt.Checked[4]:=true;
CheckGroupWExt.Checked[5]:=true;
SchedAddscheduleExt.Items.Clear;
SchedAddscheduleExt.Items.Add(txt_5_1_hourly);
SchedAddscheduleExt.Items.Add(txt_5_1_daily);
SchedAddscheduleExt.Items.Add(txt_5_1_weekly);
SchedAddscheduleExt.Items.Add(txt_5_1_monthly);
SchedAddscheduleExt.Items.Add(txt_5_1_once);
{schedaddschedule.Items.Add(txt_5_1_onstart);
schedaddschedule.Items.Add(txt_5_1_onlogin);}//works only as admin
schedulepassword.Caption:=txt_pw;
scheduleuser.Caption:=txt_run_as2;
Bschedule.Caption:=txt_5_1_schedadd;
scheduleend.Caption:=txt_5_1_enddate;
LabelTitleAdd2.Hint:=txt_11_0_adv;
LabelTitleExtract2.Hint:=txt_11_0_adv;
LabelTitleAdd3.Hint:=txt_savejobdefinition_hint;
LabelTitleExtract3.Hint:=txt_savejobdefinition_hint;
LabelTitleAdd4.Hint:=txt_11_0_sch;
LabelTitleExtract4.Hint:=txt_11_0_sch;
BSchedule.Hint:=txt_11_0_sch;
BScheduleExt.Hint:=txt_11_0_sch;
labelevery.Caption:=txt_5_1_every;
Lmanageschedule2.Caption:=txt_5_1_schedmanage;
Lmanageschedule1.Caption:=txt_5_1_scriptmanage;
CheckGroupM1.Caption:=txt_5_1_months;
lsa2.Caption:=txt_5_1_schedule;
lsa3.Caption:=txt_5_1_starttime;
ImageInfoSchedAdd.Hint:=txt_5_1_schedexplain;
schedulestart.Caption:=txt_5_1_startdate;
lsa1.Caption:=txt_5_1_schedname;
CheckGroupM1.Checked[0]:=true;
CheckGroupM1.Checked[1]:=true;
CheckGroupM1.Checked[2]:=true;
CheckGroupM1.Checked[3]:=true;
CheckGroupM1.Checked[4]:=true;
CheckGroupM1.Checked[5]:=true;
CheckGroupM1.Checked[6]:=true;
CheckGroupM1.Checked[7]:=true;
CheckGroupM1.Checked[8]:=true;
CheckGroupM1.Checked[9]:=true;
CheckGroupM1.Checked[10]:=true;
CheckGroupM1.Checked[11]:=true;
lsaday.Caption:=txt_5_1_day;
ComboBoxM2.Items.Clear;
for i:=1 to 31 do ComboBoxM2.Items.Add(inttostr(i));
ComboBoxM2.Items.Add(txt_5_1_last);
CheckGroupW.Caption:=txt_5_1_days;
CheckGroupW.Items.Clear;
CheckGroupW.Items.Add(txt_5_1_w1);
CheckGroupW.Items.Add(txt_5_1_w2);
CheckGroupW.Items.Add(txt_5_1_w3);
CheckGroupW.Items.Add(txt_5_1_w4);
CheckGroupW.Items.Add(txt_5_1_w5);
CheckGroupW.Items.Add(txt_5_1_w6);
CheckGroupW.Items.Add(txt_5_1_w7);
CheckGroupW.Checked[1]:=true;
CheckGroupW.Checked[2]:=true;
CheckGroupW.Checked[3]:=true;
CheckGroupW.Checked[4]:=true;
CheckGroupW.Checked[5]:=true;
schedaddschedule.Items.Clear;
schedaddschedule.Items.Add(txt_5_1_hourly);
schedaddschedule.Items.Add(txt_5_1_daily);
schedaddschedule.Items.Add(txt_5_1_weekly);
schedaddschedule.Items.Add(txt_5_1_monthly);
schedaddschedule.Items.Add(txt_5_1_once);
{schedaddschedule.Items.Add(txt_5_1_onstart);
schedaddschedule.Items.Add(txt_5_1_onlogin);}//works only as admin
ButtonUn7zaTo.Hint:=txt_ext_sel;
ButtonUn7zaTest.Hint:=txt_caption_test;
ButtonUn7zaConvert.Hint:=txt_2_8_convert;
pmjumpmusic.caption:=txt_5_0_music;
pmjumppictures.caption:=txt_5_0_pictures;
pmjumpvideos.caption:=txt_5_0_videos;
MenuItemArchive_music.caption:=txt_5_0_music;
MenuItemArchive_pictures.caption:=txt_5_0_pictures;
MenuItemArchive_videos.caption:=txt_5_0_videos;
MenuItemOpen_music.caption:=txt_5_0_music;
mextto_music.caption:=txt_5_0_music;
MenuItemOpen_pictures.caption:=txt_5_0_pictures;
mextto_pictures.caption:=txt_5_0_pictures;
MenuItemOpen_videos.caption:=txt_5_0_videos;
mextto_videos.caption:=txt_5_0_videos;
pmbc.caption:=txt_list_history;
pmhbc0.caption:=txt_5_0_bc;
pmnavbc0.caption:=txt_5_0_bc;
mbc0.caption:=txt_5_0_bc;
pnbc0.caption:=txt_5_0_bc;
pnabc0.caption:=txt_5_0_bc;
mhistory0s.Caption:=txt_5_0_sh;
pmh0s.Caption:=txt_5_0_sh;
pnh0s.Caption:=txt_5_0_sh;
pnha0s.Caption:=txt_5_0_sh;
mrecent0.Caption:=txt_list_history;
pmhr0.Caption:=txt_list_history;
pnr0.Caption:=txt_list_history;
pnra0.Caption:=txt_list_history;
mrecent0.visible:=false;
pmhr0.visible:=false;
pnr0.visible:=false;
pnra0.visible:=false;
po_more.Caption:=txt_algo;
po_sysmore.Caption:=txt_3_1_more;
menuitemopen_powershell.Caption:=txt_5_0_ps;
MenuItemPowerShell.Caption:=txt_5_0_ps;
pmpowershell.Caption:=txt_5_0_ps;
mb0.Caption:=txt_add_tobookmarks;
mb24.Caption:=txt_2_9_organize+' '+txt_bookmarks;
mwebs.Caption:=txt_search_web;
po_im.Caption:=txt_4_8_imagemanager;
MenuItemForceThumbnails.Caption:=txt_10_7_thumbnails;
MenuItemViewImage.Caption:=txt_10_7_images;
po_im_rl.Caption:=txt_4_8_rl;
po_im_rr.Caption:=txt_4_8_rr;
po_im_crop.Caption:=txt_4_8_crop;
po_im_modify.Caption:=txt_4_8_t;
pmstylepresets.Caption:=txt_4_9_style;
pmspminimal.Caption:=txt_10_3_minimal;
pmspclassic.Caption:=txt_10_3_classic;
pmspmodern.Caption:=txt_10_3_m;
pmsppostmodern.Caption:=txt_10_3_pm;
msamplescripts.Caption:=txt_8_5_samplescripts;
imagesp.Hint:=txt_2_9_navbar;
pmsizesmall.Caption:='(16 / 48) '+txt_2_9_st;
pmsizemedium.Caption:='(24 / 64) '+txt_2_9_mt;
mfilebrowser.Caption:=txt_filebrowser;
pmsizelarge.Caption:='(32 / 72) '+txt_2_9_lt;
pmsizelargep.Caption:='(48 / 96) '+txt_2_9_lt+' +';
pmsizelargepp.Caption:='(64 / 128) '+txt_2_9_lt+' ++';
pmsizelargeppp.Caption:='(72 / 144) '+txt_2_9_lt+' +++';
pmsizelargepppp.Caption:='(96 / 192) '+txt_2_9_lt+' ++++';
pmrender.Caption:=txt_11_0_rendering;
pmrendernative.Caption:=txt_11_0_native;
pmrendersharp.Caption:=txt_11_0_sharp;
pmrendersoft.Caption:=txt_11_0_soft;
pmif1.Caption:=txt_4_8_fit+' 1024 x 768 (4:3) XGA, iPad';
po_im_1024.Caption:=txt_4_8_fit+' 1024 x 768 (4:3) XGA, iPad';
pmif2.Caption:=txt_4_8_fit+' 1280 x 800 (16:10) WXGA, Nexus';
pmif3.Caption:=txt_4_8_fit+' 1920 x 1080 (16:9) FullHD';
po_im_hd.Caption:=txt_4_8_fit+' 1920 x 1080 (16:9) FullHD';
pmif4.Caption:=txt_4_8_fit+' 1920 x 1200 (16:10) WUXGA';
po_im_wuxga.Caption:=txt_4_8_fit+' 1920 x 1200 (16:10) WUXGA';
pmif5.Caption:=txt_4_8_fit+' 2048 x 1536 (4:3) iPad Retina';
pmif6.Caption:=txt_4_8_fit+' 4K UHD 3840 x 2160 (16:9) 8.3MP';
po_im_4ktv.Caption:=txt_4_8_fit+' 4K UHD 3840 x 2160 (16:9) 8.3MP';
pmif7.Caption:=txt_4_8_fit+' 4K DCI 4096 x 2160 (19:10) 8.8MP';
po_im_4kcinema.Caption:=txt_4_8_fit+' 4K DCI 4096 x 2160 (19:10) 8.8MP';
pmif8.Caption:=txt_4_8_fit+' 8K FUHD 7680 x 4320 (16:9) 33.2MP';
pmirflip.Caption:=txt_4_8_flip;
pmirmirror.Caption:=txt_4_8_mirror;
modock.Caption:=txt_4_5_dock;
pmstyle1.Caption:=txt_4_8_detailsno;
pmstyle3.Caption:=txt_4_8_listno;
pmstyle5.Caption:=txt_3_4_smallicons;
pmshowmainmenu.Caption:=txt_9_0_showmainmenu;
pmshowstylemenu.Caption:=txt_8_7_showsm;
po_showquicknavmenu.Caption:=txt_9_0_navmenu;
MenuItemShowColMenu.Caption:=txt_8_7_showhm;
pmtool1.Caption:=txt_4_6_am;
pmtool2.Caption:=txt_4_6_fm;
pmtool3.Caption:=txt_4_8_imagemanager;
pmsnav.Caption:=txt_2_9_nav;
pmstree.Caption:=txt_2_9_tree;
pmscompact.Caption:=txt_9_2_compact;
MenuItemTB.Caption:=txt_2_9_toolbar;
pmtoollarge.Caption:=txt_2_9_lt;
pmtoolmedium.Caption:=txt_2_9_mt;
pmtoolnone.Caption:=txt_2_9_none;
pmsnone.Caption:=txt_2_9_none;
pmstatusnone.Caption:=txt_2_9_none;
pmsno.Caption:=txt_2_9_none;
pmtab.Caption:=txt_6_4_tabbar;
mtab.Caption:=txt_6_4_tabbar;
pmrow.Caption:=txt_2_8_rowselect;
pmthemes.Caption:=txt_settings;
mzoom.Caption:=txt_7_9_zooming;
motl.Caption:=txt_4_5_t+'-'+txt_4_5_l;
mot.Caption:=txt_4_5_t;
motr.Caption:=txt_4_5_t+'-'+txt_4_5_r;
mor.Caption:=txt_4_5_r;
mobr.Caption:=txt_4_5_b+'-'+txt_4_5_r;
mob.Caption:=txt_4_5_b;
mobl.Caption:=txt_4_5_b+'-'+txt_4_5_l;
mol.Caption:=txt_4_5_l;
modefault.Caption:=txt_level_normal;
mfullscreen.Caption:=txt_4_8_fullscreen;
mimmersive.Caption:=txt_4_8_immersive;
po_flat.caption:=txt_toggle_browseflat;
mdownloadthemes.caption:=txt_3_5_td;
pmopenout.caption:=txt_2_7_oop;
mtoggleop.caption:=txt_2_7_oop;
pmqenopath.caption:=txt_3_4_nopaths;
pmqen1.caption:=txt_skip_existing;
pmqen2.caption:=txt_ren_extracted;
pmqen3.caption:=txt_ren_existing;
pmqen4.caption:=txt_overwrite;
pmqen5.caption:=txt_overwrite_askbefore;
pmqenewfolder.caption:=txt_newfoldermenu+' (Ctrl+N)';
pmqnointdir.caption:=txt_5_5_intdir;
CheckBoxSmartFolder.caption:=txt_5_5_intdir;
MenuItemExtAllTo.caption:=txt_extto;
mextto.caption:=txt_extto;
mexttohistory.caption:=txt_list_history;
mexttos0.caption:=txt_5_0_sh;
mexttoc0.caption:=txt_5_0_bc;
pmextherehere.caption:=txt_ext_here;
pmextheresmart.caption:=txt_9_8_fsmart;
pmextherenew.caption:=txt_9_8_fnew;
MenuItemExtAllHere.caption:=txt_ext_here;
LabelExtHere.Caption:=txt_ext_here;
MenuItemExtAllHereSmart.caption:=txt_9_8_fsmart;
MenuItemExtAllHereNew.caption:=txt_9_8_fnew;
pmintddhere.Caption:=txt_ext_here;
pmintddsmart.Caption:=txt_9_8_fsmart;
pmintddnew.Caption:=txt_9_8_fnew;
pmintddcopy.Caption:=txt_2_9_copyhere;
pmintddmove.Caption:=txt_2_9_movehere;
po_addsep.caption:=txt_2_7_separate;
mmore.Caption:=txt_3_1_more;
pmqeto.caption:=txt_ext_allto+'... (Ctrl+Alt+E / F12)';
pmqehere.caption:=txt_ext_allhere+' (Ctrl+Shift+Alt+E)';
pmqeheresmart.caption:=txt_7_1_smart+' (Ctrl+Shift+Alt+S)';
pmqeherenew.caption:=txt_7_1_new+' (Ctrl+Shift+Alt+N)';
pmqedesk.caption:=txt_ext_allto+' '+txt_desktop+' (Ctrl+Alt+D)';
pmqedocuments.caption:=txt_ext_allto+' '+txt_2_4_documents+' (Ctrl+Shift+Alt+D)';
pmextto.caption:=txt_ext_allto+'...';
pmextdesk.caption:=txt_ext_allto+' '+txt_desktop;
pmextdoc.caption:=txt_ext_allto+' '+txt_2_4_documents;
mSystemIntegration.caption:=txt_3_0_configure;
mbreset.caption:=txt_5_0_removeall;
LabelTitleOptions5.Caption:=txt_3_3_apps;
LabelTitleOptions5.Hint:=txt_openwith+' / '+txt_previewwith;
LabelTitleOptions6.Caption:=txt_theme;
BtnStyle.hint:=txt_4_9_style;
imageflat.hint:=txt_4_9_style;
mOrganize.Caption:=txt_2_9_organize;
mlayout.Caption:=txt_layout;
pmmstatus_status.Caption:=txt_2_8_statusbar;
pmsstatus.Caption:=txt_2_8_statusbar;
pmmstatus_bookmarks.Caption:=txt_bookmarks;
pmmstatus_ra.Caption:=txt_list_history;
pmmstatus_r.Caption:=txt_5_0_sh;
pmmstatus_clipboard.Caption:=txt_2_7_clipboard;
pmclip.Caption:=txt_2_7_clipboard;
po_clip.Caption:=txt_2_7_clipboard;
pmsbookmarks.Caption:=txt_bookmarks;
pmshistory.Caption:=txt_list_history;
pmssession.Caption:=txt_5_0_sh;
pmsclipboard.Caption:=txt_2_7_clipboard;
pms2a_add.Caption:=txt_add_toarchive;
pms2a_ext.Caption:=txt_caption_extract;
pmintddadd.Caption:=txt_add_toarchive;
pmintddextract.Caption:=txt_caption_extract;
pms2a_copy.Caption:=txt_2_9_copyhere;
pms2a_move.Caption:=txt_2_9_movehere;
pms2a_open.Caption:=txt_openarchive;
pms2a_cancel.Caption:=txt_2_7_cancel;
pma2s_copy.Caption:=txt_2_9_copyhere;
pma2s_move.Caption:=txt_2_9_movehere;
pma2s_extract.Caption:=txt_ext_here;
pma2s_extnew.Caption:=txt_ext_here+' '+txt_newfolder;
pma2s_cancel.Caption:=txt_2_7_cancel;
pma2s_extract1.Caption:=txt_ext_sel_here;
pma2s_extractall1.Caption:=txt_ext_allhere;
pma2s_extnew1.Caption:=txt_ext_sel_here+' '+txt_newfolder;
pma2s_extallnew1.Caption:=txt_ext_allhere+' '+txt_newfolder;
pma2s_cancel1.Caption:=txt_2_7_cancel;
pmintddcancel.Caption:=txt_2_7_cancel;
mopenasarchive.Caption:=txt_2_8_viewasarchive+' '+txt_2_8_experimental;
po_openunitasarchivelin.Caption:=txt_2_8_viewasarchive+' '+txt_2_8_experimental;
mswapbars.Caption:=txt_3_7_swapbars+' '+txt_7_8_requirerestart;
mswaptab.Caption:=txt_9_2_swt+' '+txt_7_8_requirerestart;
pmjumpbreadcrumb.Caption:=txt_5_0_bc;
mrowselect.Caption:=txt_2_8_rowselect;
mthl.Caption:=txt_2_9_thl;
MenuItemPW.Caption:=txt_2_7_setpw;
mjob.Caption:=txt_savejob;
CheckBoxExtNotArchives.Caption:=txt_2_7_es;
CheckBoxExtUnsupported.Caption:=txt_2_7_eu;
pmjb24.Caption:=txt_bookmarks+'...';
mr9.Caption:=txt_list_history+'...';
pmhr9.Caption:=txt_list_history+'...';
smbookmarks1.Caption:=txt_bookmarks;
mexttobook.Caption:=txt_bookmarks;
smbookmarksa1.Caption:=txt_bookmarks;
smHistory1.Caption:=txt_list_history;
pmExploremenu.Caption:=txt_open_path;
pmFoldersmenu.Caption:=txt_nfiles+' / '+txt_nfolders;
pmAdvanced.Caption:=txt_2_6_advanced;
pmemr0.Caption:=txt_list_history;
pmemrf0.Caption:=txt_list_history;
pnhf0.Caption:=txt_5_0_sh;
pnbcf0.Caption:=txt_5_0_bc;
pnhe0.Caption:=txt_5_0_sh;
pnbce0.Caption:=txt_5_0_bc;
smHistorya1.Caption:=txt_list_history;
smfs1.Caption:=txt_fs;
smfsa1.Caption:=txt_fs;
mexttofs.Caption:=txt_fs;
MenuItemOpen_Last.Caption:=txt_lastused;
mextto_Last.Caption:=txt_lastused;
mpathreset1.Caption:=txt_lastused;
MenuItemArchive_home1.Caption:=txt_2_9_home;
mpathdesk1.Caption:=txt_desktop;
MenuItemArchive_documents1.Caption:=txt_2_4_documents;
mpathexplore1.Caption:=txt_explore_path;
menuitemextexplore.Caption:=txt_explore_path;
mdefarcset.Caption:=txt_7_6_setcurdef;
mdefextset.Caption:=txt_7_6_setcurdef;
MenuItemOpen_here.Caption:=txt_2_7_selpath;
mextto_here.Caption:=txt_2_7_selpath;
mpathself1.Caption:=txt_2_7_selpath;
pmjumpsbook.Caption:=txt_bookmarks;
pmbreadfs.Caption:=txt_fs;
pmbreadfun.Caption:=txt_open;
mrecent9.Caption:=txt_list_history+'...';
pmh9.Caption:=txt_list_history+'...';
mhistory.Caption:=txt_list_history;
mtray.Caption:=txt_2_5_tray;
tmquit.Caption:=txt_quit;
tmcreate.Caption:=txt_create_archive;
tmopenpath.Caption:=txt_open_path;
tmopenarchive.Caption:=txt_openarchive;
pmmorehex.Caption:=txt_2_4_hexp;
po_hexp.Caption:=txt_2_4_hexp;
pmmoretext.Caption:=txt_10_0_tp;
po_textp.Caption:=txt_10_0_tp;
pmmorecheck.Caption:=txt_check;
pmmorecksave.Caption:=txt_10_0_save+' CKSUM';
pmmoremd5save.Caption:=txt_10_0_save+' MD5SUM';
pmmoresha1save.Caption:=txt_10_0_save+' SHA1SUM';
pmmoreshasave.Caption:=txt_10_0_save+' SHA256SUM';
pmmoreblake2bsave.Caption:=txt_10_0_save+' B2SUM';
pmmoreshag.Caption:=txt_searchfor+' SHA256 / Google';
pmmoreshaj.Caption:=txt_searchfor+' SHA256 / Jotti VirusScan';
pmmoreshav.Caption:=txt_searchfor+' SHA256 / VirusTotal';
po_cksum.Caption:=txt_10_0_save+' CKSUM';
po_md5sum.Caption:=txt_10_0_save+' MD5SUM';
po_sha1sum.Caption:=txt_10_0_save+' SHA1SUM';
po_sha256sum.Caption:=txt_10_0_save+' SHA256SUM';
po_b2sum.Caption:=txt_10_0_save+' B2SUM';
po_s256g.Caption:=txt_searchfor+' SHA256 / Google';
po_s256j.Caption:=txt_searchfor+' SHA256 / Jotti VirusScan';
po_s256v.Caption:=txt_searchfor+' SHA256 / VirusTotal';
MenuItemToolCrc32.Caption:=txt_10_0_save+' CKSUM';
MenuItemToolMD5.Caption:=txt_10_0_save+' MD5SUM';
MenuItemToolSHA1.Caption:=txt_10_0_save+' SHA1SUM';
MenuItemToolSHA256.Caption:=txt_10_0_save+' SHA256SUM';
MenuItemToolBlake2s.Caption:=txt_10_0_save+' B2SUM';
MenuItemToolsg.Caption:=txt_searchfor+' SHA256 / Google';
MenuItemToolsj.Caption:=txt_searchfor+' SHA256 / Jotti VirusScan';
MenuItemToolsv.Caption:=txt_searchfor+' SHA256 / VirusTotal';
MenuItemToolhexp.Caption:=txt_2_4_hexp;
MenuItemOpen_documents1.Caption:=txt_2_4_documents;
mextto_documents.Caption:=txt_2_4_documents;
pmJumpDocuments.Caption:=txt_2_4_documents;
pmquickhome.Caption:=txt_2_9_home;
pmquickdesk.Caption:=txt_desktop;
pmquickdownloads.Caption:=txt_3_1_downloads;
pmquickop.Caption:=txt_open_path;
pmquickoa.Caption:=txt_openarchive;
pmquicksd.Caption:=txt_searchanddrag;
pmJumppubhome.Caption:=txt_2_9_home+' - '+txt_2_9_public;
MenuItemArchive_pubhome.Caption:=txt_2_9_home+' - '+txt_2_9_public;
MenuItemOpen_pubhome.Caption:=txt_2_9_home+' - '+txt_2_9_public;
mextto_pubhome.Caption:=txt_2_9_home+' - '+txt_2_9_public;
pmJumppubdoc.Caption:=txt_2_4_documents+' - '+txt_2_9_public;
pmjumpdownloads.Caption:=txt_3_1_downloads;
MenuItemOpen_downloads1.Caption:=txt_3_1_downloads;
mextto_downloads.Caption:=txt_3_1_downloads;
MenuItemArchive_downloads.Caption:=txt_3_1_downloads;
MenuItemArchive_pubdoc.Caption:=txt_2_4_documents+' - '+txt_2_9_public;
MenuItemOpen_pubdoc.Caption:=txt_2_4_documents+' - '+txt_2_9_public;
mextto_pubdoc.Caption:=txt_2_4_documents+' - '+txt_2_9_public;
pclip_removeitem.Caption:=txt_2_4_removefromclipboard;
pclip_clearclip.Caption:=txt_2_4_clearclipboard;
CheckBoxAltgridcol.Caption:=txt_8_0_altcol;
LabelColorTabs.Caption:=txt_8_3_htab;
po_sysinfo.Caption:=txt_info;
po_Envstr.Caption:=txt_2_3_envstr;
po_dispenvstrlin.Caption:=txt_2_3_envstr;
cbType.Items[0]:=STR_7Z;
cbType.Items[1]:=STR_ARC;
cbType.Items[2]:=STR_BROTLI;
cbType.Items[3]:=STR_BZIP2;
cbType.Items[5]:=STR_GZIP;
cbType.Items[6]:=STR_PEA;
cbType.Items[7]:=STR_QUAD;
cbType.Items[8]:=txt_sfx+' '+STR_7Z;
cbType.Items[9]:=txt_sfx+' '+STR_ARC;
cbType.Items[10]:=txt_split;
cbType.Items[11]:=STR_TAR;
cbType.Items[12]:=STR_UPX;
cbType.Items[13]:=STR_WIM;
cbType.Items[14]:=STR_XZ;
cbType.Items[15]:=STR_ZIP;
cbType.Items[16]:=STR_ZSTD;
cbType.Items[17]:=STR_ZPAQ;
cbDefaultFormat.Items[0]:=STR_7Z;
cbDefaultFormat.Items[1]:=STR_ARC;
cbDefaultFormat.Items[2]:=STR_BROTLI;
cbDefaultFormat.Items[3]:=STR_BZIP2;
cbDefaultFormat.Items[4]:=txt_custom;
cbDefaultFormat.Items[5]:=STR_GZIP;
cbDefaultFormat.Items[6]:=STR_PEA;
cbDefaultFormat.Items[7]:=STR_QUAD;
cbDefaultFormat.Items[8]:=txt_sfx+' '+STR_7Z;
cbDefaultFormat.Items[9]:=txt_sfx+' '+STR_ARC;
cbDefaultFormat.Items[10]:=txt_split;
cbDefaultFormat.Items[11]:=STR_TAR;
cbDefaultFormat.Items[12]:=STR_UPX;
cbDefaultFormat.Items[13]:=STR_WIM;
cbDefaultFormat.Items[14]:=STR_XZ;
cbDefaultFormat.Items[15]:=STR_ZIP;
cbDefaultFormat.Items[16]:=STR_ZSTD;
cbDefaultFormat.Items[17]:=STR_ZPAQ;
cbDefaultFormat.Items[18]:=txt_lastused;
status0:=APPMAIN+' '+PEAZIPVERSION+PEAZIPREVISION;
cbSplit.Items.Strings[0]:=txt_singlevol;
cbSplit.Items.Strings[1]:=txt_customsize;
cbSplit.Items.Strings[2]:=txt_fd;
cbSplit.Items.Strings[3]:=txt_attach10;
cbSplit.Items.Strings[4]:=txt_4_8_attach25;
cbSplit.Items.Strings[5]:=txt_cd650;
cbSplit.Items.Strings[6]:=txt_cd700;
cbSplit.Items.Strings[7]:=txt_fat32;
cbSplit.Items.Strings[8]:=txt_dvd;
cbSplit.Items.Strings[9]:=txt_dvddl;
cbSplit.Items.Strings[10]:='25 GB Blu-Ray';
cbSplit.Items.Strings[11]:='50 GB Blu-Ray DL';
cbSplit.Items.Strings[12]:='100 GB Blu-Ray XL3';
cbSplit.Items.Strings[13]:='128 GB Blu-Ray XL4';
CheckBoxTarBefore.Caption:=txt_tarbefore;
CheckBoxTarBefore.Hint:=txt_tarbefore_hint;
cbAdvfAdd.Caption:=txt_advfilters;
LabelPanelHintAdd.caption:=txt_2_7_archivehint;
LabelPanelHintExtract.caption:=txt_2_7_exthint;
CheckBoxSeparate.Caption:=txt_2_7_separate;
CheckBoxConvert.Caption:=txt_2_8_convertexisting;
CheckBoxConvertPW.Caption:=txt_6_5_chp;
CheckBoxConvertVerbose.Caption:=txt_5_6_verbose;
po_convertarchive.Caption:=txt_2_8_convert;
EditOParc.Hint:=txt_otherparams;
Edit7zOpt.Hint:=txt_otherparams;
EditOPcustom.Hint:=txt_otherparams;
LabelPAQLevel.Caption:=txt_level;
LabelPAQThreads.Caption:=txt_threads;
RadioGroupPaq.Caption:=txt_paqver;
LabelUPXLevel.Caption:=txt_level;
CheckBoxUPXStrip.Caption:=txt_strip;
CheckBoxUPXBackup.Caption:=txt_backupexe;
CheckBoxUPXBackup.Hint:=txt_backupexe_hint;
RadioGroupQuad.Caption:=txt_exe;
CheckBoxQuadMax.Caption:=txt_maxcomp;
CheckBoxQuadMax.Hint:=txt_slowercomp;
LabelPEALevel.Caption:=txt_level;
LabelPEAStream.Caption:=txt_encryption;
LabelPEAObj.Caption:=txt_peaobj;
LabelPEAVol.Caption:=txt_volumepea;
LabelPEAKDFw.Caption:=txt_10_1_kdfw;
LabelSplit.Caption:=txt_integrity;
LabelSplit.Hint:=txt_check_hint;
Subtitle7zOpt.Caption:=txt_options;
Label7zFun.Caption:=txt_function;
Label7zPath.Caption:=txt_6_4_paths;
ComboBox7zPaths.Items.Strings[0]:=txt_6_4_relative;
ComboBox7zPaths.Items.Strings[1]:=txt_6_4_full;
ComboBox7zPaths.Items.Strings[2]:=txt_6_4_absolute;
ComboBoxArchivePathsExt.Items.Strings[0]:=txt_6_4_relative;
ComboBoxArchivePathsExt.Items.Strings[1]:=txt_6_4_full;
ComboBoxArchivePathsExt.Items.Strings[2]:=txt_6_4_absolute;
Label7zThreads.Caption:=txt_threads;
Label7zOtherParams.Caption:=txt_other;
CheckBoxMailAdd.Caption:=txt_sendbymail;
CheckBoxMailAdd.Hint:=txt_attach;
CheckBoxMailKeep.Caption:=txt_4_8_keeparchive;
Subtitle7zEncOpt.Caption:=txt_encryption;
Label7zEnc.Caption:=txt_algo;
Subtitle7zCompOpt.Caption:=txt_compression;
Label7zMethod.Caption:=txt_method;
Label7zLevel.Caption:=txt_level;
Label7zDictionary.Caption:=txt_dictionary;
Label7zWord.Caption:=txt_word;
Label7zPasses.Caption:=txt_passes;
Label7zsolidblock.Caption:=txt_solid_block;
Labelbcmblock.Caption:=txt_solid_block;
CheckBox7zSFX.Caption:=txt_create_sfx;
RadioGroup7zSFX.Caption:=txt_sfx_interface;
CheckBox7zOF.Caption:=txt_compress_openforwriting;
CheckBoxSolidExtension.Caption:=txt_6_0_msq;
pmbcexpand.Caption:=txt_6_1_ec+' (Shift+E)';
apmbcexpand.Caption:=txt_6_1_ec+' (Shift+E)';
cbEncExtension.Caption:=txt_6_2_encext;
CheckBox7zOF.Hint:=txt_openfiles_hint;
LabelCustParams.Caption:=txt_parameters;
LabelCustom.Caption:=txt_exe_hint;
LabelCustSyntax.Caption:=txt_syntax;
LabelCustExe.Caption:=txt_exe;
LabelCustExtension.Caption:=txt_ext;
LabelArcSub1.Caption:=txt_compression;
LabelARCLevel.Caption:=txt_level;
LabelARCsolidblock.Caption:=txt_solid;
CheckBoxARCrr.Caption:=txt_rr;
CheckBoxARCrr.Hint:=txt_rr_hint;
CheckBoxARCabs.Caption:=txt_4_2_arcabspath;
CheckBoxARCsfx.Caption:=txt_create_sfx;
LabelArcSub2.Caption:=txt_options;
Subtitleschopt.Caption:=txt_6_5_def;
SubtitleschoptExt.Caption:=txt_6_5_def;
LabelARCFun.Caption:=txt_function;
LabelARCParams.Caption:=txt_other;
LabelArcSub3.Caption:=txt_encryption;
LabelARCEnc.Caption:=txt_algo;
CheckBoxDate.Caption:=txt_timestamp;
cbCustomExtension.Caption:=txt_7_8_custext;
iConsoleCreateImport.Hint:=txt_pj_hint;
ImageInfoConsole.hint:=txt_pj_hint2;
lConsoleCreate_jobcode.Caption:=txt_job_code;
lConsoleCreate_outname.Caption:='outname'; //overwritten, don't need to be translated
BtnPjSaveAdd.Caption:=txt_savejob;
BtnPjSaveAdd.Hint:=txt_savejobdefinition_hint;
BtnPjLaunchAdd.Caption:=txt_launch;
ButtonArchiveOK.Caption:=txt_2_7_ok;
ButtonArchiveOK.Hint:='Ctrl+Alt+Enter';
ButtonExtOk.Caption:=txt_2_7_ok;
ButtonExtOk.Hint:='Ctrl+Alt+Enter';
ButtonArchiveCancel.Caption:=txt_2_7_cancel;
ButtonExtCancel.Caption:=txt_2_7_cancel;
mkeyfile.Caption:=txt_4_7_pk;
mpm.caption:=txt_4_3_pwman;
mscripts.caption:=txt_4_5_pj;
TrayIconPZ.hint:='PeaZip | '+txt_5_6_rc;
mlayouts.caption:=txt_5_6_layouts;
ButtonUn7zaTo.Caption:=txt_caption_extract;
ButtonUn7zaTest.Caption:=txt_caption_test;
ButtonUn7zaAdd.Caption:=txt_add;
ButtonUn7zaConvert.Caption:=txt_2_8_convert;
cbUn7zaRecursive.Caption:=txt_filters_recourse;
cbUn7zaRecursiveExclude.Caption:=txt_exclude_recourse;
MenuItemHistoryBook.Caption:=txt_add_tobookmarks;
ButtonUn7zaAdd.Hint:=txt_add_tolayout;
EditUn7zaFilterInteractive.Hint:=txt_address_hint;
Imagelistsearch.Hint:=txt_searchfor;
ImageListResetSearch.Hint:=txt_reset;
pmireset.Caption:=txt_reset;
pmrsearch.Caption:=txt_searchfor+'...';
pmsrec.Caption:=txt_2_9_rec;
ctrlwarning.Hint:=txt_7_3_archiveerrors;
ctrlup.Hint:=txt_up;
ButtonOutAdd.Hint:=txt_browse;
ButtonOutUpdate.Hint:=txt_browse;
ButtonOutExtract.Hint:=txt_browse;
ComboBoxActionExtract.Caption:=txt_action;
CheckBoxUnPeaAttributes.Caption:=txt_restore_att;
LabelCustomParamExt.Caption:=txt_parameters;
ImageInfoCustomExt.hint:=txt_exe_hint;
LabelCustomSyntaxExt.Caption:=txt_syntax;
LabelCustomBinExt.Caption:=txt_exe;
pcustompathexplore.Caption:=txt_explore_path;
LabelOutExtract.Caption:=txt_2_7_output;
LabelFunctionExtract.Caption:=txt_function;
LabelNamingExtract.Caption:=txt_naming;
LabelStatusAddUpdate.Caption:='';
LabelOutAdd.Caption:=txt_2_7_output;
ButtonEditNameAdd.Hint:=txt_11_2_comp;
LabelTypeAdd.Caption:=txt_type;
LabelLevelAdd.Caption:=txt_level;
LabelActAdd.Caption:=txt_function;
LabelSpanAdd.Caption:=txt_split;
LabelOutUpdate.Caption:=txt_2_7_output;
LabelPathUpdate.Caption:=txt_path;
LabelActUpdate.Caption:=txt_function;
cbAdvfExt.Caption:=txt_advfilters;
LabelGoExtract.Caption:=txt_ext_all;
CheckBoxFolder.Caption:=txt_newfoldermenu;
CheckBoxDeleteInputExt.Caption:=txt_5_4_deletearchives;
CheckBoxDeleteInputAdd.Caption:=txt_5_4_deletefiles;
cbDeleteInputModeExt.Clear;
{$IFDEF MSWINDOWS}
cbDeleteInputModeExt.DropDownCount:=4;
cbDeleteInputModeExt.Items.Append(txt_4_7_recycle);
cbDeleteInputModeExt.Items.Append(txt_quickdelete);
cbDeleteInputModeExt.Items.Append(txt_5_2_zerofiles);
cbDeleteInputModeExt.Items.Append(txt_securedelete);
{$ELSE}
{$IFDEF DARWIN}
cbDeleteInputModeExt.DropDownCount:=4;
cbDeleteInputModeExt.Items.Append(txt_4_7_recycle);
cbDeleteInputModeExt.Items.Append(txt_quickdelete);
cbDeleteInputModeExt.Items.Append(txt_5_2_zerofiles);
cbDeleteInputModeExt.Items.Append(txt_securedelete);
{$ELSE}
cbDeleteInputModeExt.DropDownCount:=3;
cbDeleteInputModeExt.Items.Append(txt_quickdelete);
cbDeleteInputModeExt.Items.Append(txt_5_2_zerofiles);
cbDeleteInputModeExt.Items.Append(txt_securedelete);
{$ENDIF}
{$ENDIF}
cbDeleteInputModeExt.ItemIndex:=0;
cbDeleteInputModeAdd.Clear;
{$IFDEF MSWINDOWS}
cbDeleteInputModeAdd.DropDownCount:=4;
cbDeleteInputModeAdd.Items.Append(txt_4_7_recycle);
cbDeleteInputModeAdd.Items.Append(txt_quickdelete);
cbDeleteInputModeAdd.Items.Append(txt_5_2_zerofiles);
cbDeleteInputModeAdd.Items.Append(txt_securedelete);
{$ELSE}
{$IFDEF DARWIN}
cbDeleteInputModeAdd.DropDownCount:=4;
cbDeleteInputModeAdd.Items.Append(txt_4_7_recycle);
cbDeleteInputModeAdd.Items.Append(txt_quickdelete);
cbDeleteInputModeAdd.Items.Append(txt_5_2_zerofiles);
cbDeleteInputModeAdd.Items.Append(txt_securedelete);
{$ELSE}
cbDeleteInputModeAdd.DropDownCount:=3;
cbDeleteInputModeAdd.Items.Append(txt_quickdelete);
cbDeleteInputModeAdd.Items.Append(txt_5_2_zerofiles);
cbDeleteInputModeAdd.Items.Append(txt_securedelete);
{$ENDIF}
{$ENDIF}
cbDeleteInputModeAdd.ItemIndex:=0;
LabelTitleAdd1.Caption:='      '+txt_archive+'      ';
LabelTitleAdd2.Caption:='      '+txt_2_6_advanced+'      ';
LabelTitleAdd3.Caption:='      '+txt_console+'      ';
LabelTitleAdd4.Caption:='      '+txt_5_1_schedule+'      ';
labeltitleextract1.Caption:='      '+txt_caption_extract+'      ';
labeltitleextract2.Caption:='      '+txt_2_6_advanced+'      ';
labeltitleextract3.Caption:='      '+txt_console+'      ';
labeltitleextract4.Caption:='      '+txt_5_1_schedule+'      ';
CheckBoxClip.Caption:=txt_2_4_advclip;
BtnPjSaveExt.Caption:=txt_savejob;
BtnPjSaveExt.Hint:=txt_savejobdefinition_hint;
iConsoleCreateImportExt.Hint:=txt_pj_hint;
ImageInfoConsoleExt.Hint:=txt_pj_hint2+char($0D)+char($0A)+char($0D)+char($0A)+txt_8_8_intnote;
lConsoleCreate_jobcodeExt.Caption:=txt_job_code;
lConsoleCreate_outnameExt.Caption:='outname'; //overwritten, doesn't need translation
BtnPjLaunchExt.Caption:=txt_launch;
ImageInfoBinaries.Hint:=txt_cl_hint;
ImageInfoEncoding.Hint:=txt_2_5_langhint;
Labeloaui.Caption:=txt_backend;
LabelOpenDesktop.Caption:=txt_desktop;
LabelCustomDesktop.Caption:=txt_custom;
LabelcbSD.Caption:=txt_5_9_start;
ComboBoxSD.Items[0]:=txt_5_4_lv;
ComboBoxSD.Items[1]:=txt_mypc;
ComboBoxSD.Items[2]:=txt_desktop;
ComboBoxSD.Items[3]:=txt_2_9_home;
ComboBoxSD.Items[4]:=txt_custom;
Labeltitleoptions7.Caption:=txt_2_5_help;
Labeltitleoptions8.Caption:=txt_about;
Labelo8.Caption:=txt_about;
CheckBoxrelative.Caption:=txt_7_8_rel;
CheckBoxrelative.Hint:='(7z / p7zip) '+txt_8_5_intext;
CheckBoxAutoOpen.Caption:=txt_2_7_oop;
CheckBoxAutoTest.Caption:=txt_8_8_autotest;
CheckBoxSameArc.Caption:=txt_5_2_oadd;
CheckBoxSameExt.Caption:=txt_5_2_oext;
CheckBoxnameasparentfolder.Caption:=txt_3_7_nameasparent;
CheckBoxzpaqall.Caption:=txt_7_2_zpaqall;
CheckBoxzpaqfull.Caption:=txt_6_4_full;
CheckBoxzpaqabsolute.Caption:=txt_6_4_absolute;
CheckBoxzpaqforce.Caption:=txt_overwrite;
cbtarpipe.Caption:=txt_9_7_tarpipe+' TAR';
cbuntarpipe.Caption:=txt_9_7_tarpipe+' UNTAR';
pmapp.Caption:=txt_3_3_apps;
pmapprun.Caption:=txt_3_3_run;
Labelo1.Caption:=txt_general;
Labelo2.Caption:=txt_2_6_advanced;
Labelo3.Caption:=txt_4_6_am;
Labelo4.Caption:=txt_4_6_fm;
Labelo5.Caption:=txt_3_3_apps;
Labelo6.Caption:=txt_theme;
Labelo7.Caption:=txt_2_5_help;
Labelogperf.Caption:=txt_5_0_perf;
LabelResetOpenWith.Caption:=txt_reset+' '+txt_3_3_apps;
LabelTitleOptions1.Caption:=txt_general;
LabelTitleOptions1.Hint:=txt_misc+', '+txt_localization+{$IFDEF MSWINDOWS}', '+txt_7_8_dd+{$ENDIF}char($0D)+char($0A)+txt_5_0_perf+', '+txt_8_1_bo+char($0D)+char($0A)+txt_6_5_privacy+', '+txt_3_1_workingdir;
labelmaxarg.Caption:=txt_8_3_maxarg;
CheckBoxSkipDel.Caption:=txt_8_3_skipdel;
CheckBoxLimitKFSize.Caption:=txt_10_9_kfl;
LabelTitleOptions2.Caption:=txt_2_6_advanced;
LabelTitleOptions2.Hint:=txt_2_5_encoding+char($0D)+char($0A)+txt_path+char($0D)+char($0A)+txt_backend;
Labeloaenc.Caption:=txt_2_5_encoding;
Labelconsoleencoding.Caption:=txt_3_1_sccenc;
cbEncoding.Caption:=txt_3_2_7zutf8nonascii;
CheckBoxDragDrop.Caption:=txt_6_8_ndrop;
CheckBoxEditArchives.Caption:=txt_6_9_autou;
pmtabsave.Caption:=txt_9_5_savetabs;
LabelSysBin.Caption:=txt_9_5_sb;
CheckBoxParams.Caption:=txt_10_8_params;
CheckBoxBackground.Caption:=txt_10_8_bk+' (16 MB)';
CheckBoxLog.Caption:=txt_10_8_log;
ComboBoxSysbin.Items[0]:=txt_no;
ComboBoxSysbin.Items[1]:='7z / p7zip';
ComboBoxSysbin.Items[2]:=txt_9_5_all;
mForceSyncedits.Caption:=txt_6_9_forceu;
mForceSynceditsClear.Caption:=txt_7_2_updateclear;
mForceClear.Caption:=txt_7_2_clearnoupdate;
CheckBoxClosePeaZip.Caption:=txt_7_2_autoclosepeazip;
CheckBoxSkipenc.Caption:=txt_8_2_skipet;
{$IFDEF MSWINDOWS}
labelmaxarg.visible:=false;
ComboBoxMaxArg.visible:=false;
{$ELSE}
CheckBoxDragDrop.visible:=false;
ComboBoxDrag.visible:=false;
CheckBoxzcopy.visible:=false;
CheckBoxnetworkinfo.visible:=false;
{$ENDIF}
mverifyself.Caption:=txt_8_7_verifybin;
mlog.Caption:=txt_10_8_log;
pmshowsearch.Caption:=txt_8_7_showsearchbar;
mprofileimmediate.caption:=txt_8_6_immediate;
CheckBoxShowVolatile.Caption:=txt_6_5_showvolatile;
CheckBoxAutoOpenTar.Caption:=txt_7_0_autoopentar;
CheckBoxAutoExtTar.Caption:=txt_9_0_autoexttar+' / '+upcase(txt_caption_extract);
CheckBoxAutoExtTarConvert.Caption:=txt_9_0_autoexttar+' / '+upcase(txt_2_8_convert);
CheckBoxForceOpen.Caption:=txt_6_5_force;
CheckBoxForceLayout.Caption:=txt_8_5_loadlayout;
CheckBoxForceEdit.Caption:=txt_6_6_forcemodify;
CheckBoxExcludeEF.Caption:=txt_9_1_ef;
CheckBoxUTC.Caption:=txt_9_9_utc+' (7z / p7zip)';
Labelsyntaxlevel.Caption:=txt_9_1_7zs;
Labelalias.Caption:=txt_9_2_7za;
CheckBoxForceBrowse.Caption:=txt_8_0_forcebrowse;
CheckBoxForceConvert.Caption:=txt_8_0_forceconvert;
pmrsh.Caption:=txt_6_6_rsh;
CheckBoxEncoding.Caption:=txt_2_5_langflag;
CheckBoxWindowStatus.Caption:=txt_save_winstate;
CheckBoxArchiveHistory.Caption:=txt_savehistory;
CheckBoxArchiveHistory.Hint:=txt_7_8_requirerestart;
CheckBoxShowHints.Caption:=txt_showhints;
LabelTitleOptions3.Caption:=txt_4_6_am;
LabelTitleOptions3.Hint:=txt_browser+char($0D)+char($0A)+'TAR'+char($0D)+char($0A)+txt_8_7_after+char($0D)+char($0A)+txt_archive+char($0D)+char($0A)+txt_caption_extract;
MenuItemEnumerate.Caption:=txt_5_0_enum;
CheckboxEnumd.Caption:=txt_5_0_enum;
labelRARdict.Caption:=txt_dictionary+' (MB)';
cbRARsfx.Caption:=txt_sfx;
cbRARsolid.Caption:=txt_solid;
cbRARrr.Caption:=txt_rr;
cbRARrv.Caption:=txt_10_8_rv;
cbRARsaveopen.Caption:=txt_compress_openforwriting;
cbRARsavesecurity.Caption:=txt_6_5_sni;
cbRARsavestreams.Caption:=txt_6_5_sns;
cbRARlastmodtime.Items[0]:=txt_7_4_tcurr;
cbRARlastmodtime.Items[1]:=txt_7_4_tkeep;
cbRARlastmodtime.Items[2]:=txt_7_3_stl;
Labelogreset.Caption:=txt_6_5_privacy;
Labelogpaths.Caption:=txt_path;
LabelDefaultFormat.Caption:=txt_default_format;
RadioGroupBrowser.Items.Strings[0]:=txt_browser;
RadioGroupBrowser.Items.Strings[1]:=txt_flat;
RadioGroupBrowser.Items.Strings[2]:=txt_lastused;
CheckBoxIgnorePaths.Caption:=txt_ignore_ext;
cbautoclosesingleextract.Caption:=txt_7_5_autoclosesingle;
Labelextevfor.Caption:=txt_7_5_ee;
cbExtEvForWhen.Items.Strings[0]:=txt_7_5_never;
cbExtEvForWhen.Items.Strings[1]:=txt_7_5_ask;
cbExtEvForWhen.Items.Strings[2]:=txt_7_5_always;
cbExtEvForHow.Items.Strings[0]:=txt_all_default;
cbExtEvForHow.Items.Strings[1]:=txt_displayedobjects;
ComboBoxsec.Items.Strings[0]:=txt_4_6_am;
ComboBoxsec.Items.Strings[1]:=txt_4_6_fm;
ComboBoxsec.Items.Strings[2]:=txt_7_5_always;
ComboBoxsec.Items.Strings[3]:=txt_7_5_never;
CheckBoxIgnoreSel.Caption:=txt_ignore_sel;
CheckBoxExtAnd.Caption:=txt_8_0_enableextand;
CheckBoxIgnoreDisp.Caption:=txt_ignore_disp;
CheckBoxIntDir.Caption:=txt_5_5_intdir;
LabelPrebrowse.Caption:=txt_browser;
LabelVirtual.Caption:=txt_10_6_virtual;
ComboBoxvirtual.Items[0]:=txt_default;
ComboBoxvirtual.Items[1]:=txt_7_5_always;
ComboBoxvirtual.Items[2]:='> 4 K '+txt_11_0_items;
ComboBoxvirtual.Items[3]:='> 8 K '+txt_11_0_items;
ComboBoxvirtual.Items[4]:='> 16 K '+txt_11_0_items;
ComboBoxvirtual.Items[5]:=txt_no;
LabelPriority.Caption:=txt_7_8_tpriority;
ComboBoxPriority.Items[0]:=txt_7_8_priorityrealtime;
ComboBoxPriority.Items[1]:=txt_7_8_priorityhigh;
ComboBoxPriority.Items[2]:=txt_7_8_prioritynormal;
ComboBoxPriority.Items[3]:=txt_7_8_priorityidle;
CheckBoxBrowseNotVerbose.Caption:=txt_8_2_vreport+' '+txt_faster;
LabelPrebrowse.Hint:=txt_quickbrowse_hint;
Labelogmisc.Hint:=txt_misc;
Labeloambrowser.Caption:=txt_browser;
Labeloamext.Caption:=txt_caption_extract;
Labeloamext1.Caption:=txt_archive;
Labeloafter.Caption:=txt_8_7_after;
LabelTitleOptions4.Caption:=txt_4_6_fm;
LabelTitleOptions4.Hint:=txt_filebrowser+char($0D)+char($0A)+txt_filetools;
Labeloptsubsec.Caption:=txt_10_5_sectype;
cbqdup.caption:=txt_9_1_qdup;
cbshowhidden.caption:=txt_10_5_sh;
mshowhidden.caption:=txt_10_5_sh;
LabelOptsub1.Caption:=txt_filetools;
LabelHashFormat.Caption:=txt_dispaly;
LabelBrowserHash.Caption:=txt_check_select;
Labelmiddlebutton.Caption:=txt_10_9_mb;
cbmiddlebutton.Items[0]:=txt_up;
cbmiddlebutton.Items[1]:=txt_back;
cbmiddlebutton.Items[2]:=txt_rename;
cbmiddlebutton.Items[3]:=txt_6_4_openintab;
cbmiddlebutton.Items[4]:=txt_9_1_nw;
LabelHash.Caption:=txt_check_select;
LabelCommonAlgo.Caption:=txt_8_3_prefalgo;
cbHash.Items.Strings[0]:=txt_8_3_prefalgo;
cbHash.Items.Strings[1]:=txt_performall;
ComboBoxKiB.Items[0]:=txt_8_3_mbubin;
ComboBoxKiB.Items[1]:=txt_8_3_mbudec;
ComboBoxKiB.Items[2]:=txt_2_9_none;
LabelSecureDelete.Caption:=txt_securedelete;
ComboBoxPasses.Items[0]:=txt_level_fastest;
ComboBoxPasses.Items[1]:=txt_level_fast;
ComboBoxPasses.Items[2]:=txt_level_normal;
ComboBoxPasses.Items[3]:=txt_8_1_slow;
ComboBoxPasses.Items[4]:=txt_8_1_vslow;
ThemeReset.Hint:=txt_reset_theme;
LabelAdvThemes.Caption:=txt_2_6_advanced;
LabelConfigurePeaZip.Caption:=txt_3_0_configure;
LabelConfigurePeaZip.Hint:=txt_3_0_configure+' '+txt_7_8_requirerestart;
LabelConfigurePw.Caption:=txt_8_0_setpwopt;
LabelOpenConf.Caption:=txt_3_2_conf;
LabelConfigureSendTo.Caption:=txt_3_1_sendto;
LabelAppPath.Caption:=txt_3_3_apppath;
LabelLang.Caption:=txt_localization;
LabelLang.Hint:=txt_7_8_changelocalization+' '+txt_7_8_requirerestart;
ComboBoxLanguage.Hint:=txt_7_8_changelocalization+' '+txt_7_8_requirerestart;
LabelOpacity.Hint:=txt_restartrequired;
LabelDefaultOpacity.Hint:=txt_restartrequired2;
CheckBoxParallelarchiving.Caption:=txt_2_8_parallel;
CheckBoxzcopy.Caption:=txt_2_8_zcopy;
CheckBoxnetworkinfo.Caption:=txt_3_3_skipunits;
LabelWD.Caption:=txt_3_1_workingdir;
ComboBoxBrowser.Items.Strings[0]:=txt_8_1_preparse;
ComboBoxBrowser.Items.Strings[1]:=txt_8_1_vslow+' / '+txt_9_5_largea+' < 1 M '+txt_11_0_items;
ComboBoxBrowser.Items.Strings[2]:=txt_8_1_slow+' / '+txt_9_5_mediuma+' < 512 K '+txt_11_0_items;
ComboBoxBrowser.Items.Strings[3]:=txt_level_normal+' / '+txt_9_5_smalla+' < 256 K '+txt_11_0_items;
ComboBoxBrowser.Items.Strings[4]:=txt_level_fast+' / '+txt_9_5_precond;
ComboBoxBrowser.Items.Strings[5]:=txt_8_1_nopreparse;
ComboBoxBrowser.Hint:=txt_8_1_preparsehint;
LabelPrebrowse.Caption:=txt_8_1_bo;
LabelPrebrowse.Hint:=txt_8_1_preparsehint;
ComboBoxDrag.Items.Strings[0]:=txt_7_5_dragnone;
ComboBoxDrag.Items.Strings[1]:=txt_7_5_draglock;
ComboBoxDrag.Items.Strings[2]:=txt_7_5_draghide;
ComboBoxDrag.Items.Strings[3]:=txt_7_5_draglh;
ComboBoxWD.Items.Strings[0]:=txt_2_7_output;
ComboBoxWD.Items.Strings[1]:=txt_7_7_outtemp;
ComboBoxWD.Items.Strings[2]:=txt_3_1_systmp;
ComboBoxWD.Items.Strings[3]:=txt_custom;
ComboBoxWD.Items.Strings[4]:=txt_7_7_nonetemp;
ComboBoxWD.Items.Strings[5]:=txt_7_7_noneall;
ComboBoxWD.Hint:=txt_7_7_tw+' '+txt_7_8_requirerestart;
cbBinaries.Items.Strings[0]:=txt_console_interface;
cbBinaries.Items.Strings[1]:=txt_guicl;
cbBinaries.Items.Strings[2]:=txt_guipealauncher;
cbBinariesStop.Items.Strings[0]:=txt_2_6_plalways;
cbBinariesStop.Items.Strings[1]:=txt_8_9_stoptest;
cbBinariesStop.Items.Strings[2]:=txt_2_6_plsmart;
cbBinariesStop.Items.Strings[3]:=txt_8_4_keepopenerrorslist;
cbBinariesStop.Items.Strings[4]:=txt_autoclose;
cbEncoding.Items.Strings[0]:=txt_7_6_defaultenc;
cbEncoding.Items.Strings[1]:=txt_7_6_forceutf8enc;
cbEncoding.Items.Strings[2]:=txt_7_6_forcelocalenc;
cbEncoding.Items.Strings[3]:=txt_7_6_custenc;
ComboBoxSyntaxLevel.Items.Strings[0]:=txt_5_1_last;
cbtree.Items.Strings[0]:=txt_7_6_tno;
cbtree.Items.Strings[1]:=txt_7_6_tsimple;
cbtree.Items.Strings[2]:=txt_7_6_tadvanced;
cbautobrowsetar.Items.Strings[3]:=txt_7_5_always;
LabelTree.Caption:=txt_2_9_tree;
LabelDefaultAction.Caption:=txt_8_0_defaultaction;
LabelDefaultAction.Hint:=txt_8_0_defaultactionhint;
cbdefaultaction.Items.Strings[0]:=txt_open;
cbdefaultaction.Items.Strings[1]:=txt_3_1_openasarchive;
cbdefaultaction.Items.Strings[2]:=txt_caption_extract+'...';
cbdefaultaction.Items.Strings[3]:=txt_ext_allhere;
cbdefaultaction.Items.Strings[4]:=txt_7_1_smart;
cbdefaultaction.Items.Strings[5]:=txt_7_1_new;
cbEncoding.Hint:=txt_7_6_cpnote;
LabelEncoding.Caption:=txt_7_6_zipenc;
LabelResetBookmarks.Hint:=txt_7_8_requirerestart;
LabelResetPM.Hint:=txt_7_8_requirerestart;
LabelTheme1.Caption:=txt_themename;
LabelTheme2.Caption:=txt_author;
LabelTheme3.Caption:=txt_license;
themesave_label.Caption:=txt_create_theme;
LabelColorTemperature.Caption:=txt_8_3_temperature;
LabelContrast.Caption:=txt_9_3_contrast;
LabelAppColor.Caption:=txt_pea_appcolor;
LabelFormColor.Caption:=txt_7_6_color;
tbtemperature.hint:=txt_8_3_temperature;
LabelTextAccentColor.Caption:=txt_7_6_tacolor;
Labelspacing.Caption:=txt_7_9_spacing;
Labelsmsize.Caption:=txt_8_8_sm;
Labelzooming.Caption:=txt_7_9_zooming;
cbspacing.Items.Strings[0]:=txt_2_9_st;
cbspacing.Items.Strings[1]:=txt_2_9_mt;
cbspacing.Items.Strings[2]:=txt_2_9_lt;
cbspacing.Items.Strings[3]:=txt_level_maximum;
cbspacing.Hint:=txt_7_9_spacing+' '+txt_7_8_requirerestart;
cbzooming.Hint:=txt_7_9_zooming+' '+txt_7_8_requirerestart;
cbSmallIconSize.Hint:=txt_8_8_sm+' '+txt_7_8_requirerestart;
Labellightpresets.Caption:=txt_4_8_presets;
Labellightpresets.Hint:=txt_7_6_dim+', '+txt_7_6_dark+',... '+txt_7_8_requirerestart;
lightdim.Caption:=txt_7_6_dim;
lightlow.Caption:=txt_7_6_dark;
LabelDefaultColor1.Caption:=txt_reset;
LabelDefaultColor2.Caption:=txt_reset;
LabelDefaultColor2.Hint:=txt_reset+' '+txt_7_8_requirerestart;
LabelDefaultColor3.Caption:=txt_reset;
LabelDefaultColor1.Caption:=txt_reset;
LabelColPresets.Caption:=txt_4_8_presets;
LabelTheme.Caption:=txt_theme;
LabelOpacity.Caption:=txt_opacity;
LabelDefaultOpacity.Caption:=txt_reset;
ButtonOptCancel.Caption:=txt_2_7_cancel;
ButtonOptOK.Caption:=txt_2_7_ok;
ButtonOptReset.Caption:=txt_reset;
LabelResetBookmarks.Caption:=txt_reset+' '+txt_bookmarks;
LabelResetPtmp.Caption:=txt_3_0_resettmp;
LabelResetPM.Caption:=txt_reset+' '+txt_4_3_pwman;
LabelPMpw.Caption:=txt_4_3_pwmanmaster;
LabelResetHistory.Caption:=txt_reset+' '+txt_list_history;
pmBrowser.Caption:=txt_go_browser;
mgobrowser.Caption:=txt_go_browser;
pmAddFile.Caption:=txt_add_files;
pmAddFolder.Caption:=txt_add_folder;
pmSearchAdd.Caption:=txt_searchanddrag;
munsearch.Caption:=txt_searchanddrag;
po_savecopy.Caption:=txt_10_2_savecopy;
munsavecopy.Caption:=txt_10_2_savecopy;
MenuItemOpen_search.Caption:=txt_searchanddrag;
pmLoadList.Caption:=txt_loadlayout;
pmSaveList.Caption:=txt_savelayout;
mLoadLayout.Caption:=txt_loadlayout;
mSaveLayout.Caption:=txt_savelayout;
MenuItem3.Caption:=txt_clearlayout;
MenuItem1.Caption:=txt_removeselected;
MenuItemNavigate.Caption:=txt_go_path;
MenuItem5b.Caption:=txt_openwith;
openwithpeazip.Caption:=txt_peazip_new;
openwithassociated.Caption:=txt_associated;
openwithcustom.Caption:=txt_customapp;
mMisc.Caption:=txt_misc;
MenuItemBookmarks.Caption:=txt_add_tobookmarks;
pmExplorepath.Caption:=txt_explore_path;
mcp.Caption:=txt_cphere;
MenuItemTools.Caption:=txt_filetools;
MenuItemToolCompare.Caption:=txt_compare;
MenuItemToolCheck.Caption:=txt_check;
MenuItemRefresh.Caption:=txt_fefreshf5;
MenuItemContextRefresh.Caption:=txt_fefreshf5;
pmhrefresh.Caption:=txt_fefreshf5;
mf3.caption:=txt_searchfor;
mf4up.caption:=txt_up;
mback.caption:=txt_back;
mFeatures.Caption:=txt_file;
mextract.Caption:=txt_caption_extract;
mPEA.Caption:=txt_create_archive;
maddexisting.Caption:=txt_5_6_upexisting;
maddconvert.Caption:=txt_2_8_convert;
mUnPEAextract.Caption:=txt_5_6_exarc;
tmupdate.Caption:=txt_5_6_upexisting;
tmconvert.Caption:=txt_2_8_convert;
tmextract.Caption:=txt_5_6_exarc;
mUnPEAbrowse.Caption:=txt_open_path;
mUnPEA.Caption:=txt_openarchive;
mBookmarks.Caption:=txt_bookmarks;
mQuit.Caption:=txt_quit;
mEdit.Caption:=txt_edit;
mSelectAll.Caption:=txt_selectall;
po_SelectAll.Caption:=txt_selectall;
mInvertSelection.Caption:=txt_invertsel;
mType.Caption:=txt_all_type;
mChar.Caption:=txt_5_5_starting;
mCharCase.Caption:=txt_5_5_starting+' '+txt_5_5_case;
msizesimilar.Caption:=txt_5_5_similar+' (10%)';
msizesimilar50.Caption:=txt_5_5_similar+' (50%)';
mpackedsimilar.Caption:=txt_5_5_similar+' (10%)';
mpackedsimilar50.Caption:=txt_5_5_similar+' (50%)';
mAttributes.Caption:=txt_all_attributes;
mDate.Caption:=txt_all_date;
mDateRecent.Caption:=txt_morerecent;
mDateERecent.Caption:=txt_eqorrecent;
mDateEqual.Caption:=txt_equal;
mDateEOlder.Caption:=txt_eqorolder;
mDateOlder.Caption:=txt_olderthan;
mPackedSize.Caption:=txt_all_psize;
mPSSmaller.Caption:=txt_smaller;
mPSESmaller.Caption:=txt_eqorsmaller;
mPSEqual.Caption:=txt_equal;
mPSELarger.Caption:=txt_eqorlarger;
mPSLarger.Caption:=txt_larger;
mSize.Caption:=txt_all_size;
mSizeSmaller.Caption:=txt_smaller;
mSizeESmaller.Caption:=txt_eqorsmaller;
mSizeEqual.Caption:=txt_equal;
mSizeELarger.Caption:=txt_eqorlarger;
mSizeLarger.Caption:=txt_larger;
mSortBySelection.Caption:=txt_sortbysel;
mBrowse.Caption:=txt_browser;
mcolumns.Caption:=txt_2_9_columns;
mcname.Caption:=txt_name;
mctype.Caption:=txt_type;
mcsize.Caption:=txt_size;
mcpacked.Caption:=txt_info+' / '+txt_compressed_size;
mcdate.Caption:=txt_8_2_tm;
mcatt.Caption:=txt_attributes;
mccrc.Caption:=txt_check_select;
mcfree.Caption:=txt_free;
mcfs.Caption:=txt_fs;
mccreated.Caption:=txt_8_2_tc;
mcaccessed.Caption:=txt_8_2_ta;
mcmethod.Caption:=txt_method;
pmccreated.Caption:=txt_8_2_tc;
pmcaccessed.Caption:=txt_8_2_ta;
pmcmethod.Caption:=txt_method;
mbrowsersort.Caption:=txt_3_7_sort+' (Alt+5)';
mthumbimages.Caption:=txt_4_0_thim;
msimplesearch.Caption:=txt_4_1_simplesearch;
mrecsearch.Caption:=txt_4_3_recsrc;
mbtext.Caption:=txt_2_9_vst;
po_sortby.Caption:=txt_3_7_sort;
mbrowserccreated.Caption:=txt_8_2_tc;
mbrowsercaccessed.Caption:=txt_8_2_ta;
mbrowsercmethod.Caption:=txt_method;
mbrowserccomment.Caption:=txt_7_4_comment;
po_browserccomment.Caption:=txt_7_4_comment;
mccomment.Caption:=txt_7_4_comment;
pmccomment.Caption:=txt_7_4_comment;
po_browserccreated.Caption:=txt_8_2_tc;
po_browsercaccessed.Caption:=txt_8_2_ta;
po_browsercmethod.Caption:=txt_method;
mbrowsercname.Caption:=txt_name;
mbrowserctype.Caption:=txt_type;
mbrowsercsize.Caption:=txt_size;
mbrowsercpacked.Caption:=txt_info+' / '+txt_compressed_size;
mbrowsercdate.Caption:=txt_datetime;
mbrowsercatt.Caption:=txt_attributes;
mbrowserccrc.Caption:=txt_check_select;
po_browsercname.Caption:=txt_name;
po_browserctype.Caption:=txt_type;
po_browsercsize.Caption:=txt_size;
po_browsercpacked.Caption:=txt_info+' / '+txt_compressed_size;
po_browsercdate.Caption:=txt_datetime;
po_browsercatt.Caption:=txt_attributes;
po_browserccrc.Caption:=txt_check_select;
mshowmenu.Caption:=txt_2_9_showmenu;
pmshowmenu.Caption:=txt_2_9_showmenu;
MenuItemOrganizeMbar.Caption:=txt_2_9_showmenu;
MenuItemOrganizeToolbar.Caption:=txt_4_5_shtool;
mshowtoolbar.Caption:=txt_4_5_shtool;
MenuItemOrganizeNavbar.Caption:=txt_4_5_shnav;
mshownavbar.Caption:=txt_4_5_shnav;
mshowsidebar.Caption:=txt_9_6_scside;
msidebar.Caption:=txt_9_6_cside;
MenuItemOrganizeStatusbar.Caption:=txt_4_5_shstatus;
mshowstatusbar.Caption:=txt_4_5_shstatus;
MenuItemProperties.Caption:=txt_4_5_properties;
pmproperties.Caption:=txt_4_5_properties;
mproperties.Caption:=txt_4_5_properties;
pmmorefun_properties.Caption:=txt_4_5_properties;
mgolayout.Caption:=txt_2_7_goarclayout;
mgoextlayout.Caption:=txt_2_7_goextlayout;
mFlat.Caption:=txt_toggle_browseflat;
mFlatArchives.Caption:=txt_9_8_alwaysflat;
pmFlatArchives.Caption:=txt_9_8_alwaysflat;
pmFlat.Caption:=txt_toggle_browseflat;
mRefresh.Caption:=txt_fefreshf5;
mOptionsMenu.Caption:=txt_tools;
mAdmin.Caption:=txt_4_1_runasadmin;
mUser.Caption:=txt_run_as2;
po_alltasks.Caption:=txt_3_2_alltasks;
mBenchpea.Caption:=txt_sysbenchmark+' (pea)';
mBench.Caption:=txt_sysbenchmark+' (7z / p7zip)';
mloadprofile.Caption:=txt_9_6_loadp;
msaveprofile.Caption:=txt_9_6_savep;
mLang.Caption:=txt_localization;
w7contextlang.Caption:=txt_5_3_cml;
mprofileultra7z.Caption:=txt_5_3_profilebest;
mprofilenormal7z.Caption:=txt_5_3_profileadvanced;
mprofiletarzst.Caption:=txt_7_1_profileintermediate;
mprofilenormalzip.Caption:=txt_5_3_profilenormal;
mprofilefastzip.Caption:=txt_5_3_profileveryfast;
mprofile7zfast.Caption:=txt_7_3_profile7zfast;
mprofile7zfastest.Caption:=txt_7_3_profile7zfastest;
mprofileencrypt7z.Caption:=txt_5_3_profilepassword;
mprofilesplitzip.Caption:=txt_5_3_profile10mb;
mprofileauto.Caption:=txt_5_3_profilesfx;
mprofileextremezpaq.Caption:=txt_7_2_extcompultra;
mprofiletarxz.Caption:=txt_7_2_extcomp;
mprofiletargz.Caption:=txt_7_2_altcomp;
mprofilerar.Caption:=txt_7_4_presetrar;
mprofilezstd.Caption:=txt_7_4_7zfzstandardcomp;
mprofilesave.Caption:=txt_7_2_savecompsettings;
mprofileload.Caption:=txt_7_2_loadcompsettings;
msavecompsettings.Caption:=txt_7_2_savecompsettings;
mloadcompsettings.Caption:=txt_7_2_loadcompsettings;
mDefaults.Caption:=txt_settings;
msettings.Caption:=txt_settings;
marcopt.Caption:=txt_7_4_setarc;
mextopt.Caption:=txt_7_4_setext;
LabelConfigurearc.Caption:=txt_7_4_setarc;
LabelConfigureext.Caption:=txt_7_4_setext;
mHelp.Caption:=txt_2_5_help;
mAbout.Caption:=txt_about+'...';
mupdate.caption:=txt_4_5_update;
pmtoolcompact.Caption:=txt_9_2_compact;
mtranslationsfaq.Caption:=txt_9_2_tfaq;
LabelUpdates.Caption:=txt_9_2_updates;
LabelDoc.Caption:=txt_9_2_doc;
mplugins.caption:=txt_5_5_plugin;
mPeaSiteMirror.Caption:=txt_peazip_web;
mPeaSupport.Caption:=txt_peazip_help;
mPeaFAQ.Caption:='FAQ';
mPeaTracker.Caption:=txt_3_7_tracker;
mpeachangelog.Caption:=txt_9_2_changelog;
mPeatos.Caption:=txt_9_2_tos;
MenuItemDonations.Caption:=txt_3_7_donations;
mpeahelpoffline.Caption:=txt_2_5_offline_help+' (EN, .pdf)';
mtutorial.Caption:=txt_2_5_offline_help;
po_addtoarchive.Caption:=txt_add;
MenuItemTextEncoding.Caption:=txt_7_6_zipenc;
pmtextenc.Caption:=txt_7_6_zipenc;
mtenc.Caption:=txt_7_6_zipenc;
zencmore.Caption:=txt_2_5_encoding+'...';
zenclocalutf8.Caption:=txt_7_6_defaultenc;
zencutf8.Caption:=txt_7_6_forceutf8enc;
zenclocal.Caption:=txt_7_6_forcelocalenc;
mzencmore.Caption:=txt_2_5_encoding+'...';
mzenclocalutf8.Caption:=txt_7_6_defaultenc;
mzencutf8.Caption:=txt_7_6_forceutf8enc;
mzenclocal.Caption:=txt_7_6_forcelocalenc;
azencmore.Caption:=txt_2_5_encoding+'...';
azenclocalutf8.Caption:=txt_7_6_defaultenc;
azencutf8.Caption:=txt_7_6_forceutf8enc;
azenclocal.Caption:=txt_7_6_forcelocalenc;
MenuItemOpen_ExtractHere.Caption:=txt_caption_extract;
MenuItemOpen_ext_all.Caption:=txt_ext_all;
MenuItemOpen_ext_displayed.Caption:=txt_ext_disp;
MenuItemOpen_ext_selected.Caption:=txt_ext_sel;
po_exthere.Caption:=txt_caption_extract;
po_checkmotw.Caption:=txt_10_5_checkmotw;
po_motwfull.Caption:=txt_10_5_checkmotw+' '+txt_10_5_fr;
pmmoremotw.Caption:=txt_10_5_checkmotw;
layoutmotw.Caption:=txt_10_5_checkmotw;
layoutmotwfull.Caption:=txt_10_5_checkmotw+' '+txt_10_5_fr;
MenuItemOpen_test.Caption:=txt_caption_test;
MenuItemOpen_test_all.Caption:=txt_testall;
MenuItemOpen_test_displayed.Caption:=txt_testdisp;
MenuItemOpen_test_selected.Caption:=txt_testsel;
po_test.Caption:=txt_caption_test;
MenuItemOpen_info.Caption:=txt_list_details;
MenuItemOpen_info_all.Caption:=txt_list_all;
MenuItemOpen_info_displayed.Caption:=txt_list_disp;
MenuItemOpen_info_selected.Caption:=txt_list_sel;
po_info.Caption:=txt_list_details;
pmmorefun_info.Caption:=txt_list_details;
pmmorefun_details.Caption:=txt_info;
pmmoretest.Caption:=txt_caption_test;
po_details.Caption:=txt_info;
pmsinfo.Caption:=txt_info;
pmcpyto.Caption:=txt_copyto;
pmmvto.Caption:=txt_moveto;
pmexplore.Caption:=txt_explore_path;
pmbookmarks.Caption:=txt_add_tobookmarks;
pmbcaddbookmark.Caption:=txt_add_tobookmarks+' (F7)';
pmbcorganizebookmarks.Caption:=txt_2_9_organize+' '+txt_bookmarks;
MenuItemOpen_organizebookmarks.Caption:=txt_2_9_organize+' '+txt_bookmarks;
pmorganizebookmarks.Caption:=txt_2_9_organize+' '+txt_bookmarks;
pmws.Caption:=txt_search_web;
pmcommand.Caption:=txt_cphere;
pmdeletefromarchive.Caption:=txt_10_9_deletearchive;
pmrecycle.Caption:=txt_4_7_recycle;
pmfunaz.Caption:=txt_4_8_fun;
pmcut.Caption:=txt_cut;
{$IFDEF MSWINDOWS}pmquickdelete.Caption:=txt_quickdelete+' (Shift+Del)';{$ELSE}pmquickdelete.Caption:=txt_quickdelete;{$ENDIF}
pmsecuredelete.Caption:=txt_securedelete+' (Ctrl+Del)';
MenuItemOpen_list.Caption:=txt_caption_list;
MenuItemOpen_list_all.Caption:=txt_list_all;
MenuItemOpen_list_displayed.Caption:=txt_list_disp;
MenuItemOpen_list_selected.Caption:=txt_list_sel;
po_list.Caption:=txt_caption_list;
pmmorefun_list.Caption:=txt_caption_list;
pmmoreadd.Caption:=txt_add;
pmmoreconvert.Caption:=txt_2_8_convert;
pmmoreextract.Caption:=txt_caption_extract;
ImageFlatadd.Hint:=txt_add;
ImageFlatconvert.Hint:=txt_2_8_convert;
ImageFlatext.Hint:=txt_caption_extract;
ImageFlatdup.Hint:=txt_4_1_duplicatesfind;
ImageFlatfolder.Hint:=txt_create_folder;
ImageFlatren.Hint:=txt_rename;
ImageFlattransform.Hint:=txt_4_8_t;
ImageFlatcrop.Hint:=txt_4_8_crop;
ImageFlattestmore.Hint:=txt_caption_test+', '+txt_caption_list+'...';
MenuItemOpen_preview.Caption:=txt_previewwith;
MenuItemPrePeaZip.Caption:=txt_peazip_new;
MenuItemPreAssociated.Caption:=txt_associated;
MenuItemPreCustom.Caption:=txt_customapp;
MenuItemOpen_extandopenwith.Caption:=txt_extopen_with;
MenuItemERPeaZip.Caption:=txt_peazip_new;
MenuItemERAssociated.Caption:=txt_associated;
MenuItemERCustom.Caption:=txt_customapp;
MenuItemPreBrowser.Caption:=txt_filebrowser;
MenuItemERBrowser.Caption:=txt_filebrowser;
po_open_browser.Caption:=txt_filebrowser;
po_open.Caption:=txt_openwith;
po_open_asarchive.Caption:=txt_3_1_openasarchive;
po_open_asarchivet.Caption:=txt_3_1_openasarchive;
po_open_peazip.Caption:=txt_peazip_new;
po_open_associated.Caption:=txt_associated;
po_open_custom.Caption:=txt_customapp;
MenuItemOpen_addtobookmarks.Caption:=txt_add_tobookmarks;
MenuItemOpen_explore.Caption:=txt_explore_path;
MenuItemOpen_commandprompt.Caption:=txt_cphere;
mbpea.Caption:=txt_go_path;
mbexplore.Caption:=txt_explore_path;
mbcl.Caption:=txt_cphere;
po_filetools.Caption:=txt_filetools;
po_functionsaz.Caption:=txt_4_8_fun;
po_split.Caption:=txt_split_file;
po_join.Caption:=txt_joinfiles;
po_compare.Caption:=txt_compare;
po_check.Caption:=txt_check;
po_checksum.Caption:=txt_check_select+' (CRC32)';
pmcheck.Caption:=txt_check_select+' (CRC32)';
pmbatchtest.Caption:=txt_11_0_bt;
po_pdup.Caption:=txt_4_1_duplicatesfind;
pmpdup.Caption:=txt_4_1_duplicatesfind;
po_dedup.Caption:=txt_4_1_duplicatesfind;
po_analyzefolders.Caption:=txt_7_0_af;
pmpanalyzefolders.Caption:=txt_7_0_af;
po_systemtools.Caption:=txt_systools;
po_linsystemtools.Caption:=txt_systools;
po_fm.Caption:=txt_4_6_fm;
po_diskclean.Caption:=txt_disk_cleanup;
po_defrag.Caption:=txt_disk_defrag;
po_manage.Caption:=txt_disk_management;
po_removeunits.Caption:=txt_remove_external_unit;
po_cpl.Caption:=txt_controlpanel;
po_computer.Caption:=txt_compmanagement;
po_taskman.Caption:=txt_taskman;
po_recycle.Caption:=txt_4_7_recycle;
mexploretrash.Caption:=txt_10_0_exptrash;
{$IFDEF MSWINDOWS}po_delete.Caption:=txt_quickdelete+' (Shift+Del)';{$ELSE}po_delete.Caption:=txt_quickdelete;{$ENDIF}
po_securedelete.Caption:=txt_securedelete+' (Ctrl+Del)';
po_newfolder.Caption:=txt_cnewfolder;
pmnewfolder.Caption:=txt_cnewfolder;
po_rename.Caption:=txt_rename+' (F2)';
pmr_ren.Caption:=txt_rename+' (F2)';
po_renmenu.Caption:=txt_rename;
pmrename.Caption:=txt_rename+' (F2)';
po_copyto.Caption:=txt_copyto;
po_moveto.Caption:=txt_moveto;
po_copy.Caption:=txt_copy+' (Ctrl+C)';
po_cut.Caption:=txt_cut+' (Ctrl+X)';;
po_paste.Caption:=txt_paste+' (Ctrl+V)';
po_setpw.Caption:=txt_2_7_setpw;
menupw.Caption:=txt_2_7_setpw;
msetpw.Caption:=txt_2_7_setpw;
pmqesetpw.Caption:=txt_2_7_setpw;
madvfilters.caption:=txt_advfilters;
pmadvf.caption:=txt_advfilters;
mfilterbrowser.caption:=txt_8_5_advbrowser;
mOptions.Caption:=txt_options;
MenuItemOpen_root.Caption:=txt_mypc;
MenuItemopendesktop.Caption:=txt_desktop;
MenuItemopendownloads.Caption:=txt_3_1_downloads;
MenuItemopendocuments.Caption:=txt_2_4_documents;
MenuItemOpen_jump.Caption:=txt_go_path;
mnav.Caption:=txt_2_9_nav;
pmsearchdrag.Caption:=txt_searchanddrag;
pmsearchweb.Caption:=txt_search_web;
MenuItemOpenhome.Caption:=txt_2_9_home;
MenuItemOpen_home1.Caption:=txt_2_9_home;
mextto_home.Caption:=txt_2_9_home;
MenuItemOpen_desktop1.Caption:=txt_desktop;
mextto_desktop.Caption:=txt_desktop;
MenuItemOpen_path.Caption:=txt_open_path;
MenuItemOpen_archive.Caption:=txt_openarchive;
MenuItemOpenWeb.Caption:=txt_search_web;
mwebsearch.Caption:=txt_search_web;
pmOpenPJall.Caption:=txt_all;
pmOpenPJdisplayed.Caption:=txt_displayedobjects;
pmOpenPJselected.Caption:=txt_selected_objects;
pmextcontextall.Caption:=txt_ext_all;
pmextcontextdisplayed.Caption:=txt_ext_disp;
pmextcontextselected.Caption:=txt_ext_sel;
pmtestcontextall.Caption:=txt_testall;
pmtestcontextdisplayed.Caption:=txt_testdisp;
pmtestcontextselected.Caption:=txt_testsel;
pmqeall.Caption:=txt_ext_all+' (Ctrl+L)';
pmqedisplayed.Caption:=txt_ext_disp+' (Ctrl+S)';
pmqeselected.Caption:=txt_ext_sel+' (Ctrl+E)';
pmJump3.Caption:=txt_2_9_home;
pmJump2.Caption:=txt_desktop;
pmsoppath.Caption:=txt_open_path;
pmsoparch.Caption:=txt_openarchive;
mbNotes.Caption:=txt_note;
mbDelete.Caption:=txt_remove_bookmark;
mbAddPath.Caption:=txt_add_path;
mbAddArchive.Caption:=txt_add_archive;
cbUn7zaRecursive.Hint:=txt_search_hint;
cbUn7zaRecursiveExclude.Hint:=txt_search_hint;
ComboBoxOverwrite.Hint:=txt_naming;
ComboBoxOverwriteARC.Hint:=txt_naming;
EditCustomParamExt.Hint:=txt_otherparams;
OpenDialogLang.Title:=txt_open_file;
OpenDialogList.Title:=txt_open_files;
OpenDialogArchive.Title:=txt_open_file;
OpenDialogTheme.Title:=txt_open_file;
OpenDialogProfile.Title:=txt_open_file;
OpenDialogApps1.Title:=txt_open_file;
SelectDirectoryDialog1.Title:=txt_selectdir;
SaveDialogPJ.Title:=txt_savejobdefinition;
SaveDialogAS.Title:=txt_saveas;
OpenDialogCustom.Title:=txt_open_file;
po_convert.Caption:=txt_convert;
mextractarchive.caption:=txt_archive;
mtogglenew.caption:=txt_newfoldermenu;
mcancel.caption:=txt_2_7_cancel;
mgotype.caption:=txt_type;
ComboBoxTheme.Items.Strings[5]:=txt_custom;
ComboBoxPAQThreads.Items.Strings[0]:=txt_multithreading;
ComboBoxPAQLevel.Items.Strings[0]:=txt_level_fast;
ComboBoxPAQLevel.Items.Strings[1]:=txt_level_normal;
ComboBoxPAQLevel.Items.Strings[2]:=txt_level_maximum;
ComboBoxPAQLevel.Items.Strings[3]:=txt_level_ultra;
RadioGroupPaq.Items.Strings[2]:='ZPAQ';
ComboBoxUPX.Items.Strings[0]:=txt_nocompress;
ComboBoxUPX.Items.Strings[1]:='1 '+txt_faster;
ComboBoxUPX.Items.Strings[9]:='9 '+txt_better;
ComboBoxUPX.Items.Strings[10]:=txt_best;
ComboBoxPEALevel.Items.Strings[0]:=txt_bettercompression;
ComboBoxPEALevel.Items.Strings[1]:=txt_default_compression;
ComboBoxPEALevel.Items.Strings[2]:=txt_fastcompr;
ComboBoxPEALevel.Items.Strings[3]:=txt_nocompress_hint;
ComboBoxPEAObj.Items.Strings[13]:=txt_none2;
ComboBoxPEAVol.Items.Strings[13]:=txt_none2;
ComboBoxSplitAlgo.Items.Strings[13]:=txt_none2;
ComboBox7zFun.Items.Strings[0]:=txt_newarchive;
ComboBox7zFun.Items.Strings[1]:=txt_add_existing_archive;
ComboBox7zFun.Items.Strings[2]:=txt_update;
ComboBox7zFun.Items.Strings[3]:=txt_6_3_uar;
ComboBox7zFun.Items.Strings[4]:=txt_6_3_syn;
cbAct.Items.Strings[0]:=txt_newarchive;
cbAct.Items.Strings[1]:=txt_add_existing_archive;
cbAct.Items.Strings[2]:=txt_update;
cbAct.Items.Strings[3]:=txt_6_3_uar;
cbAct.Items.Strings[4]:=txt_6_3_syn;
ComboBoxArchiveActUpdate.Items.Strings[0]:=txt_newarchive;
ComboBoxArchiveActUpdate.Items.Strings[1]:=txt_add_existing_archive;
ComboBoxArchiveActUpdate.Items.Strings[2]:=txt_update;
ComboBoxArchiveActUpdate.Items.Strings[3]:=txt_6_3_uar;
ComboBoxArchiveActUpdate.Items.Strings[4]:=txt_6_3_syn;
ComboBox7zThreads.Items.Strings[0]:=txt_singlethread;
ComboBox7zThreads.Items.Strings[1]:=txt_multithreading;
ComboBox7zMemuse.Items.Strings[0]:=txt_default;
ComboBox7zLevel.Items.Strings[0]:=txt_level_store;
ComboBox7zLevel.Items.Strings[1]:=txt_level_fastest;
ComboBox7zLevel.Items.Strings[2]:=txt_level_fast;
ComboBox7zLevel.Items.Strings[3]:=txt_level_normal;
ComboBox7zLevel.Items.Strings[4]:=txt_level_maximum;
ComboBox7zLevel.Items.Strings[5]:=txt_level_ultra;
ComboBox7zSolid.Items.Strings[0]:=txt_nonsolid;
ComboBox7zSolid.Items.Strings[18]:=txt_solid;
ComboBox7zSolid.Items.Strings[19]:=txt_solid_extension;
RadioGroup7zSFX.Items.Strings[0]:=txt_console;
RadioGroup7zSFX.Items.Strings[1]:=txt_console+' (Linux)';
RadioGroup7zSFX.Items.Strings[2]:=txt_gui;
ComboBoxArchiveCustom.Items.Strings[0]:=txt_pio;
ComboBoxArchiveCustom.Items.Strings[1]:=txt_poi;
ComboBoxArchiveCustom.Items.Strings[2]:=txt_ipo;
ComboBoxArchiveCustom.Items.Strings[3]:=txt_iop;
ComboBoxArchiveCustom.Items.Strings[4]:=txt_opi;
ComboBoxArchiveCustom.Items.Strings[5]:=txt_oip;
ComboBoxARCLevel.Items.Strings[0]:='0 '+txt_store;
ComboBoxARCLevel.Items.Strings[1]:='1 '+txt_fastermem;
ComboBoxARCLevel.Items.Strings[4]:='4 '+txt_default2;
ComboBoxARCLevel.Items.Strings[9]:='9 '+txt_slowermem;
ComboBoxArcSolid.Items.Strings[0]:=txt_nonsolid;
ComboBoxArcSolid.Items.Strings[1]:=txt_solid_auto;
ComboBoxArcSolid.Items.Strings[2]:=txt_solid_extension;
ComboBoxARCFun.Items.Strings[0]:=txt_newarchive;
ComboBoxARCFun.Items.Strings[1]:=txt_add_existing_archive;
ComboBoxARCFun.Items.Strings[2]:=txt_update;
ComboBoxARCalgo.Items.Strings[3]:=txt_blowfish;
cbType.Items.Strings[8]:=txt_sfx+' '+STR_7Z;
cbType.Items.Strings[9]:=txt_sfx+' '+STR_ARC;
cbType.Items.Strings[10]:=txt_split;
ComboBoxOverwrite.Items.Strings[0]:=txt_skip_existing;
ComboBoxOverwrite.Items.Strings[1]:=txt_ren_extracted;
ComboBoxOverwrite.Items.Strings[2]:=txt_ren_existing;
ComboBoxOverwrite.Items.Strings[3]:=txt_overwrite;
ComboBoxOverwrite.Items.Strings[4]:=txt_overwrite_askbefore;
ComboBoxActionExtract.Items.Strings[0]:=txt_caption_extract;
ComboBoxActionExtract.Items.Strings[1]:=txt_ext_nopath;
ComboBoxActionExtract.Items.Strings[2]:=txt_caption_list;
ComboBoxActionExtract.Items.Strings[3]:=txt_list_details;
ComboBoxActionExtract.Items.Strings[4]:=txt_caption_test;
ComboBoxActionExtract.ItemIndex:=0;
CheckBoxExtActionAdv.Items.Strings[0]:=txt_caption_extract;
CheckBoxExtActionAdv.Items.Strings[1]:=txt_ext_nopath;
CheckBoxExtActionAdv.Items.Strings[2]:=txt_caption_list;
CheckBoxExtActionAdv.Items.Strings[3]:=txt_caption_test;
CheckBoxExtActionAdv.ItemIndex:=0;
ComboBoxOverwriteARC.Items.Strings[0]:=txt_overwrite_askbefore;
ComboBoxOverwriteARC.Items.Strings[1]:=txt_overwrite;
ComboBoxOverwriteARC.Items.Strings[2]:=txt_skip_existing;
ComboBoxActionArc.Items.Strings[0]:=txt_caption_extract;
ComboBoxActionArc.Items.Strings[1]:=txt_ext_nopath;
ComboBoxActionArc.Items.Strings[2]:=txt_caption_list;
ComboBoxActionArc.Items.Strings[3]:=txt_list_details;
ComboBoxActionArc.Items.Strings[4]:=txt_caption_test;
ComboBoxActionArc.Items.Strings[5]:=txt_caption_repair;
ComboBoxActionArc.ItemIndex:=0;
ComboBoxCustomSyntaxExt.Items.Strings[0]:=txt_pio;
ComboBoxCustomSyntaxExt.Items.Strings[1]:=txt_poi;
ComboBoxCustomSyntaxExt.Items.Strings[2]:=txt_ipo;
ComboBoxCustomSyntaxExt.Items.Strings[3]:=txt_iop;
ComboBoxCustomSyntaxExt.Items.Strings[4]:=txt_opi;
ComboBoxCustomSyntaxExt.Items.Strings[5]:=txt_oip;
cbDefaultFormat.Items.Strings[4]:=txt_custom;
cbDefaultFormat.Items[8]:=txt_sfx+' '+STR_7Z;
cbDefaultFormat.Items[9]:=txt_sfx+' '+STR_ARC;
cbDefaultFormat.Items.Strings[10]:=txt_split;
cbDefaultFormat.Items.Strings[18]:=txt_lastused;
ComboBoxPEALevel.Text:=txt_default_compression;
ComboBoxUPX.Text:=txt_best;
ComboBox7zThreads.Text:=txt_multithreading;
ComboBoxArchiveCustom.Text:=txt_pio;
ComboBoxArcSolid.Text:=txt_solid_auto;
ComboBoxARCFun.Text:=txt_newarchive;
EditOpenIn.Text:=txt_none;
ComboBoxOverwrite.Text:=txt_ren_extracted;
ComboBoxCustomSyntaxExt.Text:=txt_pio;
ComboBox7zFun.Text:=txt_newarchive;
except end;
end;
end;

function valorize_headers:integer;
var
   s:ansistring;
begin
valorize_headers:=-1;
readln(t,s);//translator(s)
langstrhint:=langstrhint+char($0d)+char($0a)+s;
readln(t,s);//last revision's translator(s)
langstrhint:=langstrhint+char($0d)+char($0a)+s;
readln(t,s);//last revision date
langstrhint:=langstrhint+char($0d)+char($0a)+s;
readln(t,s);
readln(t,s);//peazip text group
if s<>'=== PeaZip text group ===' then exit
else valorize_headers:=0;
end;

function load_texts(lang:ansistring):integer; //valorize localized text strings
var
   s:ansistring;
   i:integer;
begin
load_texts:=-1;
try
   assignfile(t,(sharepath+'lang'+directoryseparator+lang));
   filemode:=0;
   reset(t);
   read_header(t,filemode);
   readln(t,s); //declaration
   if (s<>'=== PeaZip language file ===') and (s<>'== PeaZip language file ===') then
      begin
      closefile(t);
      exit;
      end;
   readln(t,s);//language
   langstrhint:=s;
   readln(t,s); //version; PEAZIPREVISION is ignored since revisions are meant to share the same text
   langstrhint:=langstrhint+char($0d)+char($0a)+s;
   i:=-1;
      if valorize_headers=0 then i:=valorize_text;
   if i=0 then assign_guitext
   else
      begin
      closefile(t);
      exit;
      end;
   repeat //skip until about text group
      readln(t,s);
   until (eof(t)) or (s='=== about text group ===');
   if not eof(t) then
      begin
      readln(t,s);
      FormPeach.MemoAbout.Lines.Clear;
      FormPeach.MemoAbout.Lines.Append(APPMAIN+' '+PEAZIPVERSION+PEAZIPREVISION+' - '+caption_build);
      FormPeach.MemoAbout.Lines.Append('');
      FormPeach.MemoAbout.Lines.Append(txt_read+' '+READE_LIST);
      FormPeach.MemoAbout.Lines.Append('');
      FormPeach.MemoAbout.Lines.Append(txt_write+' '+WRITEE_LIST);
      FormPeach.MemoAbout.Lines.Append('');
      repeat
         readln(t,s);
         FormPeach.MemoAbout.Lines.Append(s);
      until eof(t);
      end;
   closefile(t);
   load_texts:=0;
except
   try
      closefile(t);
   except
   end;
   load_texts:=-1;
end;
end;

procedure load_default_texts;
begin
txt_11_2_comp:='Original file name and extension are always preserved when using pure compression formats (Brotli, BZip2, GZip, XZ, Zstd...), unless TAR before option is used, overriding Output file name.';
txt_11_2_funexp:='Type or select any of supported app''s function (run on selected files, if applicable)';
txt_11_1_pp:='Skipping pre-parse step the app may not detect possible archive issues in advance, and may not display correctly some archives. Anyway, extraction is unaffected by this setting.';
txt_11_0_adv:='Advanced and format-specific options';
txt_11_0_bt:='Batch test archives';
txt_11_0_good:='Good';
txt_11_0_items:='items';
txt_11_0_native:='Native';
txt_11_0_pr:='Rate password entropy';
txt_11_0_rendering:='Rendering';
txt_11_0_sch:='Schedule execution of the task defined in the GUI as CLI script';
txt_11_0_sharp:='Sharp';
txt_11_0_soft:='Soft';
txt_11_0_strong:='Strong';
txt_11_0_vw:='Very weak';
txt_11_0_w:='Weak';
txt_10_9_deletearchive:='Delete archive';
txt_10_9_kfl:='Keyfile size limited to first 100MB';
txt_10_9_mb:='Middle mouse button click';
txt_10_8_log:='Commands log';
txt_10_8_rv:='Create recovery volumes';
txt_10_8_bk:='Execute small workloads in background';
txt_10_8_params:='Pass command line as separate parameters';
txt_10_8_untarerr:='TAR name does not match archive name. It is possible to try to open the archive to manually extract the TAR content.';
txt_10_7_errload:='Cannot display image';
txt_10_7_errfile:='File not found';
txt_10_7_first:='First';
txt_10_7_fit:='Fit to screen';
txt_10_7_fith:='Fit to screen height';
txt_10_7_fitw:='Fit to screen width';
txt_10_7_keep:='Keep output files if extraction ends in error or is cancelled';
txt_10_7_next:='Next';
txt_10_7_prev:='Previous';
txt_10_7_pwh:='Password from hash';
txt_10_7_images:='Image viewer';
txt_10_7_thumbnails:='View thumbnails';
txt_10_6_virtual:='Dynamic virtual mode';
txt_10_5_fr:='(full report)';
txt_10_5_sectype:='Ask confirmation for running following file types';
txt_10_5_checkmotw:='Check Zone.Identifier (MoTW)';
txt_10_5_sectypewarning:='Do you want to run this file?';
txt_10_5_pathlock:='Items in this path of the archive cannot be edited';
txt_10_5_type_description_rar:='RAR: proprietary archive format, high compression ratio, supported through external compressor';
txt_10_5_sh:='Show hidden files (in the filesystem)';
txt_10_5_ntfsalt:='This format is able to store NTFS Alternate Data Stream, including Mark of The Web';
txt_10_4_moving:='(Moving)';
txt_10_3_classic:='Classic';
txt_10_3_ascii:='It is recommended to use only ASCII characters in passwords for the current archive format (mixed case letters, numbers, and special characters).';
txt_10_3_minimal:='Minimal';
txt_10_3_m:='Modern';
txt_10_3_pm:='Postmodern';
txt_10_3_aw:='Workaround: check "Force typing password interactively" in the password prompt, or set Console mode for backend binaries.';
txt_10_2_savecopy:='Save a copy';
txt_10_1_full:='Full';
txt_10_1_kdfw:='KDF work load';
txt_10_1_under:='Underlined';
txt_10_0_exptrash:='Explore Trash';
txt_10_0_ptarzst:='Fastest compression, TAR.ZST';
txt_10_0_ptarxz:='High compression, TAR.XZ';
txt_10_0_ptargz:='Medium compression, TAR.GZ';
txt_10_0_comp:='Pure compression formats only accept a single file as input. Archive conversion towards those formats will fail if the source contains multiple files or folders, which cannot be determined in advance.';
txt_10_0_save:='Save';
txt_10_0_tp:='Text viewer';
txt_9_9_uac:='Current user cannot write to this output path. Do you want to run PeaZip with UAC elevation?';
TXT_9_9_kdf:='KDF rounds';
txt_9_9_utc:='Show timestamps as UTC';
txt_9_8_alwaysflat:='Always open archives in flat view';
txt_9_8_fnew:='Extract here (in new folder)';
txt_9_8_fsmart:='Extract here (smart new folder)';
txt_9_7_tarpipe:='7z / p7zip use pipe';
txt_9_7_smartsorting:='Smart file name sorting';
txt_9_6_centered:='Centered';
txt_9_6_cside:='Compact side bar';
txt_9_6_loadpconfirm:='Do you want to load this profile? All the data of current profile will be overwritten, including saved scripts and Password Manager.';
txt_9_6_loadp:='Load profile';
txt_9_6_saveppw:='OPTIONAL: protect this profile with password / keyfile?';
txt_9_6_savepoverwrite:='Overwrite existing profile? All the data of the existing profile will be overwritten, including saved scripts and Password Manager.';
txt_9_6_savep:='Save profile';
txt_9_6_scside:='Show Compact side bar';
txt_9_5_all:='All';
txt_9_5_precond:='Pre-parse if errors are detected';
txt_9_5_largea:='Pre-parse large archives';
txt_9_5_mediuma:='Pre-parse medium archives';
txt_9_5_smalla:='Pre-parse small archives';
txt_9_5_reopentab:='Reopen last tab';
txt_9_5_savetabs:='Save tabs';
txt_9_5_sb:='Use binaries in system paths';
txt_9_4_r:='read';
txt_9_4_rw:='read/write';
txt_9_4_savecomment:='Save comment';
txt_9_4_hintcomment:='Type or paste comment, load or drag here comment file.';
txt_9_3_continue:='Continue anyway?';
txt_9_3_contrast:='Contrast';
txt_9_3_fsd:='Free space on destination may not be enough';
txt_9_3_fsw:='Free space on temporary work path may not be enough';
txt_9_3_mrar:='Manually set RAR binary';
txt_9_3_canedit:='This archive type can be edited';
txt_9_3_canforce:='This archive type can be edited (forced)';
txt_9_3_cannotedit:='This archive type cannot be edited';
txt_9_2_7za:='7z / p7zip alias';
txt_9_2_changelog:='Change log';
txt_9_2_tfaq:='Check for Translations';
txt_9_2_compact:='Compact';
txt_9_2_swt:='Swap Tool / Address bar';
txt_9_2_tos:='TOS, Privacy';
txt_9_2_doc:='Verify documentation, Issue Tracker...';
txt_9_2_updates:='Verify updates, binaries, Plugins...';
txt_9_1_7zs:='7z / p7zip syntax level';
txt_9_1_ac:='Archive conversion scripts allow user''s interaction';
txt_9_1_closeall:='Close all';
txt_9_1_enlargeicons:='Enlarge file browser icons';
txt_9_1_ef:='Exclude empty folders form archiving and extraction operations (7z / p7zip)';
txt_9_1_nw:='Open in a new window';
txt_9_1_qdup:='Use quick deduplication routine';
txt_9_0_autoexttar:='Auto extract TAR archive from compressed TAR.* files';
txt_9_0_accesstime:='Do not change last access time';
txt_9_0_mem:='Maximum memory usage';
txt_9_0_showmainmenu:='Open Main menu';
txt_9_0_navmenu:='Open Navigation menu';
txt_9_0_plugind:='Open plugin directory';
txt_9_0_df:='Sort dirs before files';
txt_9_0_hl:='Store hard links as links';
txt_9_0_sl:='Store symbolic links as links';
txt_9_0_tnav:='Toggle side bar';
txt_8_9_empty:='Archive seems empty';
txt_8_9_disp:='Displaying archive content';
txt_8_9_parsing:='Parsing archive content';
txt_8_9_stoptest:='Stop to inspect report for error, list, test, auto-test';
txt_8_9_ttb:='Toggle tool bar';
txt_8_8_ca:='Accent color';
txt_8_8_btn:='Button';
txt_8_8_cb:='Button color';
txt_8_8_centered:='Centered buttons';
txt_8_8_light:='Light';
txt_8_8_lnk:='Link';
txt_8_8_intnote:='Please note that "Extract then move" option (in Options > Settings > Archive manager) is ignored for composing the command line in Console tab.';
txt_8_8_snz:='Propagate Zone.Identifier stream (Windows)';
txt_8_8_sm:='Small icons size';
txt_8_8_solcol:='Breadcrumb bar';
txt_8_8_snoi:='Store owner/group ids (TAR, Linux)';
txt_8_8_snon:='Store owner/group names (TAR, Linux)';
txt_8_8_tab:='Tab';
txt_8_8_altt:='Tabs style';
txt_8_8_autotest:='Test archives after creation, if supported by the format';
txt_8_8_cw:='Window color';
txt_8_7_csvhelp:='"," international standard, ";" common in Latin locales';
txt_8_7_after:='After archiving / extraction';
txt_8_7_bintest:='binaries tested.';
txt_8_7_csv:='CSV separator';
txt_8_7_hok:='Hash of binaries used by PeaZip match with expected ones';
txt_8_7_mo:='Set archive manager options';
txt_8_7_showhm:='Open Browser header menu';
txt_8_7_showsearchbar:='Show search bar';
txt_8_7_showsm:='Open Style menu';
txt_8_7_hnotok:='Some hash of binaries used by PeaZip do not match with expected ones:';
txt_8_7_verifybin:='Verify hash of binaries';
txt_8_6_clear:='"Clear" option removes temp edited files, otherwise available for further editing.';
txt_8_6_noclear:='Discard all changes without updating the archive';
txt_8_6_nosimple:='Do not update archive, keep temp edited files for further editing';
txt_8_6_immediate:='Immediate execution';
txt_8_6_yessimple:='Update archive, keep temp edited files for further editing';
txt_8_5_advbrowser:='Apply filters to archive browser';
txt_8_5_detailslarge:='Details, large';
txt_8_5_intext:='Extract to temporary working directory then move to output destination, interactively ask before overwriting';
txt_8_5_listlarge:='List, large';
txt_8_5_loadlayout:='Load layout at startup';
txt_8_5_samplescripts:='Sample scripts';
txt_8_4_keepopenerrorslist:='Stop to inspect report for error, list';
txt_8_3_mbubin:='Binary';
txt_8_3_cw:='Change working directory? This will reset temporary work files and restart the application.';
txt_8_3_temperature:='Color temperature';
txt_8_3_mbudec:='Decimal';
txt_8_3_htab:='Highlight tabs';
txt_8_3_maxarg:='Maximum length of arguments';
txt_8_3_mbu:='Multiple-byte unit';
txt_8_3_prefalgo:='Preferred algorithms';
txt_8_3_skipdel:='Skip deletion of locked temp files (use reset to delete on demand)';
txt_8_3_lw:='Some files in working directory are locked and cannot be removed automatically';
txt_8_3_noupx:='This binary cannot be compressed (may be already compressed)';
txt_8_2_slower:='(slower)';
txt_8_2_df:='7z / p7zip display content of folders';
txt_8_2_vreport:='7z / p7zip non-verbose report';
txt_8_2_ta:='Accessed';
txt_8_2_tc:='Created';
txt_8_2_keep:='Keep files';
txt_8_2_tm:='Modified';
txt_8_2_skipet:='Skip testing for encryption';
txt_8_2_alltimes:='Store all timestamps';
txt_8_2_supportedby:='Supported by';
txt_8_1_preparse:='Always pre-parse archives';
txt_8_1_bo:='Browser optimization';
txt_8_1_bop:='Browser optimization options can be set from Options > Settings, General tab';
txt_8_1_nopreparse:='Do not pre-parse archives';
txt_8_1_ed:='Error(s) detected.';
txt_8_1_togglearc:='Listing flat view of archive content may take long time, continue anyway?';
txt_8_1_preparsehint:='Optimize performances limiting pre-parsing of large archives. Pre-parsing is meant to detect in advance possible issues in archive content.';
txt_8_1_slow:='Slow';
txt_8_1_vslow:='Very slow';
txt_8_1_volumes:='volumes';
txt_8_0_altcol:='Alternate grid color';
txt_8_0_forcebrowse:='Browse non-canonical archive types (containers, disk images, installers,...)';
txt_8_0_commonalgo:='Common algorithms';
txt_8_0_forceconvert:='Convert non-canonical archive types';
txt_8_0_defaultactionhint:='Default action double-clicking a file associated with PeaZip from the system';
txt_8_0_defaultaction:='Default action on input (open, auto-extract...';
txt_8_0_enableextand:='Enable "Extract and open with" submenu';
txt_8_0_forcetyping:='Force typing passwords interactively';
txt_8_0_setpwopt:='Set password / keyfile options';
txt_8_0_forcetypinghelp:='If supported by the backend, the task will prompt interactively for password. LIMITATIONS: task will run in console, will not run unattended, and cannot browse archives with encrypted filenames.';
txt_7_9_spacing:='Spacing';
txt_7_9_zooming:='Zoom';
txt_7_8_changelocalization:='Change PeaZip language';
txt_7_8_custext:='Custom extension';
txt_7_8_destexistfile:='Destination already contains processed files. Replace files with same name?';
txt_7_8_dd:='Drag and Drop';
txt_7_8_priorityhigh:='High';
txt_7_8_priorityidle:='Idle';
txt_7_8_rel:='Extract then move to destination';
txt_7_8_prioritynormal:='Normal';
txt_7_8_priorityrealtime:='Real time';
txt_7_8_requirerestart:='[REQUIRES RESTARTING PEAZIP]';
txt_7_8_tpriority:='Tasks priority';
txt_7_8_update:='Update';
txt_7_7_noneall:='None (no preview, no Drag And Drop extraction)';
txt_7_7_nonetemp:='None, preview in User''s temp';
txt_7_7_outtemp:='Output, preview in User''s temp';
txt_7_7_sys7zreq:='Requires 7z, 7-Zip, or p7zip, or equivalent package to be installed';
txt_7_7_tw:='Temporary work folder for archive creation, editing, preview and drag and drop extraction.';
txt_7_7_sys7z:='Use system 7z if available';
txt_7_6_zipenc:='ZIP filenames encoding';
txt_7_6_color:='Color';
txt_7_6_custenc:='Custom code page';
txt_7_6_dark:='Darker';
txt_7_6_tno:='Do not sync archive tree';
txt_7_6_forcelocalenc:='Force local';
txt_7_6_forceutf8enc:='Force UTF-8';
txt_7_6_cpnote:='If the chosen custom code page is unsupported, tasks will always end in error (most likely memory allocation error). In case that happens, change code page or reset the application.';
txt_7_6_defaultenc:='Local, UTF-8 for extra symbols';
txt_7_6_dim:='Dark';
txt_7_6_setcurdef:='Set current path as default output path';
txt_7_6_setdef:='Set default output path';
txt_7_6_tadvanced:='Sync archive tree, keep visited nodes';
txt_7_6_tsimple:='Sync archive tree, simple';
txt_7_6_tacolor:='Text accent color';
txt_7_5_always:='Always';
txt_7_5_ask:='Ask';
txt_7_5_autoclosesingle:='Auto close after extraction if no browsing actions took place';
txt_7_5_cutlen:='Cut name at specified length';
txt_7_5_cutlenw:='Cut name at specified length (4..255) naming conflicts can be fixed manually later';
txt_7_5_dragnone:='Do not lock target';
txt_7_5_specialbrowse:='Do you want to extract everything in order to provide the file with the extra data it may need?';
txt_7_5_ee:='Extract everything for special file types';
txt_7_5_draghide:='Hide drop target';
txt_7_5_repnascii:='Replace/remove non-ASCII characters';
txt_7_5_draglh:='Lock and hide target';
txt_7_5_draglock:='Lock drop target';
txt_7_5_never:='Never';
txt_7_4_comment:='Comment';
txt_7_4_7zfbrotlicomp:='Fastest compression, 7Z Brotli';
txt_7_4_7zfzstandardcomp:='Fastest compression, 7Z Zstandard';
txt_7_4_presetrar:='High compression, RAR';
txt_7_4_tkeep:='Keep original archive timestamp';
txt_7_4_lock:='Lock archive';
txt_7_4_locked:='locked';
txt_7_4_lockconfirm:='Locked archives cannot be further modified, proceed locking this archive?';
txt_7_4_recover:='Recover archive';
txt_7_4_tcurr:='Set archive timestamp from current system time';
txt_7_4_setarc:='Set advanced archiving options';
txt_7_4_setext:='Set advanced extraction options';
txt_7_4_swzipx:='Switch to zipx extension for non-Deflate zip archives';
txt_7_3_archiveerrors:='[archive may contain errors]';
txt_7_3_archiveerrorshint:='Archive may not be valid (due missing, corrupted, or out of standard data), it is possible to run Test for detailed information. If archive''s table of content is encrypted, password is needed before browsing it.';
txt_7_3_clickextall:='Click "Extract all" to enable';
txt_7_3_noconfdel:='Do not ask confirmation for delete after archiving / extraction';
txt_7_3_profile7zfastest:='Fast compression, 7Z fastest';
txt_7_3_maxbr:='Maximize Brotli compression using more memory (may be incompatible with some other Brotli extractors)';
txt_7_3_maxzstd:='Maximize Zstandard compression using more memory';
txt_7_3_profile7zfast:='Medium compression, 7Z fast';
txt_7_3_stl:='Set archive timestamp from most recent file';
txt_7_2_altcomp:='High compression, ARC';
txt_7_2_clearnoupdate:='Clear edited files';
txt_7_2_autoclosepeazip:='Close PeaZip when task completes';
txt_7_2_zpaqall:='Extract all revisions';
txt_7_2_extcomp:='Extreme compression, ZPAQ';
txt_7_2_extcompultra:='Extreme compression, ZPAQ ultra';
txt_7_2_fbrotlicomp:='Fastest compression, Brotli';
txt_7_2_fzstandardcomp:='Fastest compression, Zstandard';
txt_7_2_loadcompsettings:='Load compression settings';
txt_7_2_savecompsettings:='Save compression settings';
txt_7_2_source:='Source';
txt_7_2_updateclear:='Update archive, clear edited files';
txt_7_1_type_description_brotli:='Brotli: fast compressor from Google, very fast decompression';
txt_7_1_new:='Extract all here (in new folder)';
txt_7_1_smart:='Extract all here (smart new folder)';
txt_7_1_profileintermediate:='Medium compression, ZIP/BZip2 fast';
txt_7_1_renfilesonly:='Rename only files';
txt_7_1_typetosearch:='Type to search in current path';
txt_7_1_type_description_zstd:='Zstandard: fast compressor from Facebook, very fast decompression';
txt_7_0_af:='Analyze content of folders';
txt_7_0_autoopentar:='Auto open single tar archive inside tar.* files';
txt_7_0_exttmppath:='Content will be extracted outside the temporary work path, in ';
txt_6_9_autou:='Auto update modified files in archives';
txt_6_9_forceu:='Update edited files in archive';
txt_6_9_opuns:='Operation not supported for current archive type';
txt_6_9_overarch:='Overwrite file(s) with same name already existing inside the archive?';
txt_6_9_uconf:='Previewed file has been modified. Update the current archive?';
txt_6_8_ndrop:='Use native Drag and Drop on Windows';
txt_6_7_nop:='(no preview)';
txt_6_6_pdupfound:='possible duplicates found (quick approximate test)';
txt_6_6_rsh:='Reset search history';
txt_6_6_pdupfind:='Suggest duplicates';
txt_6_6_forcemodify:='Edit non-canonical archive types as';
txt_6_5_mandatory:='(mandatory)';
txt_6_5_abort:='Abort';
txt_6_5_askp:='Ask to set password at startup';
txt_6_5_chp:='Change password';
txt_6_5_def:='Definition';
txt_6_5_nop:='Don''t ask to set password at startup';
txt_6_5_error:='Error';
txt_6_5_seqerr:='Error(s) detected, original files will not be deleted';
txt_6_5_sni:='Include NT security information';
txt_6_5_sns:='Include NTFS Alternate Data Stream';
txt_6_5_privacy:='Privacy and Security';
txt_6_5_showvolatile:='Show which options are volative / context depentent';
txt_6_5_force:='Try to open archives containing errors';
txt_6_5_warning:='Warning';
txt_6_5_yes:='Yes';
txt_6_5_yesall:='Yes to all';
txt_6_5_np:='You can now change password of converted archive(s) to a new one, or blank the password to skip encryption';
txt_6_4_absolute:='Absolute paths';
txt_6_4_appdirn:='Append directory name';
txt_6_4_closeallother:='Close all other tabs';
txt_6_4_closeright:='Close tabs on the right';
txt_6_4_collapse:='Collapse tabs';
txt_6_4_expand:='Expand tabs';
txt_6_4_full:='Full paths';
txt_6_4_new:='New';
txt_6_4_openintab:='Open in a new tab';
txt_6_4_paths:='Paths';
txt_6_4_prepdirn:='Prepend directory name';
txt_6_4_relative:='Relative paths';
txt_6_4_tabbar:='Tab bar';
txt_6_3_autoadjust:='Auto adjust columns';
txt_6_3_cinfo:='Info and comments';
txt_6_3_syn:='Synchronize archive with disk';
txt_6_3_uar:='Update only files already in archive';
txt_6_2_encext:='Add ".enc" suffix to encrypted archives';
txt_6_2_archive:='Archive file type';
txt_6_2_container:='Container file type';
txt_6_1_ec:='Expand / collapse archive tree';
txt_6_0_msq:='Sort by file type for solid compression';
txt_5_9_lff:='Analyze files and folders';
txt_5_9_pff:='Analyze, show files header/EOF';
txt_5_9_start:='Start from';
txt_5_8_l0:='Allow any supported component/format';
txt_5_8_l1:='Allow only Free Software components';
txt_5_8_l2:='Allow only open archive formats';
txt_5_8_ascii:='ASCII safe, scripts are safe on legacy environments';
txt_5_8_cp:='Code Page safe, scripts may trigger problems on legacy environments with different Code Pages';
txt_5_8_fs:='Free Software compliance';
txt_5_8_utf:='Scripts need full UTF-8 / Unicode environment';
txt_5_8_fsr:='This format is not supported due Free Software compliance restrictions (Options > Advanced)';
txt_5_7_pinstalled:='INSTALLED';
txt_5_7_pmissing:='MISSING';
txt_5_7_plugin:='Plugin missing, can be installed from Help > Check for Plugins';
txt_5_6_basic:='Basic';
txt_5_6_exarc:='Extract archive';
txt_5_6_tab:='Open in new tab';
txt_5_6_rc:='Right click for options';
txt_5_6_layouts:='Saved layouts';
txt_5_6_upexisting:='Update existing archive';
txt_5_6_verbose:='Verbose';
txt_5_5_case:='(case sensitive)';
txt_5_5_add:='Add string at specified position';
txt_5_5_addsel:='Add to current selection';
txt_5_5_ext:='Change files extension';
txt_5_5_plugin:='Check for Plugins';
txt_5_5_copypath:='Copy path';
txt_5_5_delete:='Delete characters at specified position';
txt_5_5_halt:='Halt system when task completes';
txt_5_5_positionw:='Hint: 1 add before first char, 2 second, etc... "z" for end of file name';
txt_5_5_positionwd:='Hint: 1 delete from first char included, 2 second, ... "z" for end of file name';
txt_5_5_replaceneww:='Hint: provide an empty new string to simply remove the old string';
txt_5_5_lower:='Lowercase';
txt_5_5_replaceoldw:='Modify all occurrences of this string or character in the file name';
txt_5_5_newext:='New extension';
txt_5_5_new:='New string';
txt_5_5_n:='Number of characters to delete';
txt_5_5_old:='Old string';
txt_5_5_position:='Position (number or "z" for end)';
txt_5_5_intdir:='Smart new folder';
txt_5_5_replacestr:='Replace/remove string';
txt_5_5_datesameday:='Same day of selected object';
txt_5_5_datesamehour:='Same hour of selected object';
txt_5_5_datesamemonth:='Same month of selected object';
txt_5_5_datesameweek:='Same week of selected object';
txt_5_5_datesameyear:='Same year of selected object';
txt_5_5_scan:='Scan';
txt_5_5_select:='Select';
txt_5_5_similar:='Similar to selected object';
txt_5_5_starting:='Starting with same character';
txt_5_5_string:='String to add';
txt_5_5_subtractsel:='Subtract from current selection';
txt_5_5_datehour:='This hour';
txt_5_5_datemonth:='This month';
txt_5_5_dateweek:='This week';
txt_5_5_dateyear:='This year';
txt_5_5_dateday:='Today';
txt_5_5_upper:='Uppercase';
txt_5_5_extw:='Warning: changing file extension the file may become unusable';
txt_5_4_da:='Date added';
txt_5_4_deletearchives:='Delete archives after extraction';
txt_5_4_deletefiles:='Delete files after archiving';
txt_5_4_deleteoriginal:='Deletion procedure, as set in main screen, will be appended to the script.';
txt_5_4_lv:='Last visited';
txt_5_4_deletearchivesconfirm:='Confirm deletion of original archives?';
txt_5_4_deletefilesconfirm:='Confirm deletion of original files?';
txt_5_4_used:='Used';
txt_5_3_profilebest:='Extreme compression, 7Z ultra';
txt_5_3_profileadvanced:='High compression, 7Z';
txt_5_3_profilenormal:='Medium compression, ZIP (compatible with most extractors)';
txt_5_3_profileveryfast:='Fast compression, ZIP fast (compatible with most extractors)';
txt_5_3_profilepassword:='Protect with password, 7Z format';
txt_5_3_profile10mb:='Keep output under 10 MB, for mail attachment limitations';
txt_5_3_profilesfx:='Auto extracting, recipient will not need an extraction software';
txt_5_3_cml:='System context menu language';
txt_5_3_cmlmessage:='Double click on desired context menu language and confirm registry merging. This setting needs to be re-applied when the application is installed/updated or after System integration wizard is used.';
txt_5_3_exc:='Exclusion filters prevail on inclusion filters';
txt_5_3_ia:='Include also';
txt_5_3_io:='Include only';
txt_5_3_rec:='Recurse subdirs';
txt_5_3_resetsi:='Re-configure system integration (context menu, SendTo, file associations)?';
txt_5_2_oadd:='Archive to original path';
txt_5_2_zerodelete:='Do you want to delete and overwrite with all 0 selected file(s)? The operation can''t be undone and files will be not recoverable';
txt_5_2_zfree:='Do you want to overwrite with all 0 free space on this drive?';
txt_5_2_sdfree:='Do you want to securely delete free space on this drive?';
txt_5_2_oext:='Extract to original path';
txt_5_2_securedeletefree:='Secure delete free space';
txt_5_2_free:='This operation can take some minutes and, if performed often, it can quickly wear flash-based disks';
txt_5_2_zerofiles:='Zero delete';
txt_5_2_zerofree:='Zero delete free space';
txt_5_1_schedadd:='Add schedule';
txt_5_1_schederr:='Cannot create schedule';
txt_5_1_daily:='Daily';
txt_5_1_day:='Day';
txt_5_1_days:='Days';
txt_5_1_enddate:='End date';
txt_5_1_every:='Every';
txt_5_1_w6:='Friday';
txt_5_1_hourly:='Hourly';
txt_5_1_hours:='Hours';
txt_5_1_last:='Last';
txt_5_1_schedmanage:='Task Scheduler, manage tasks saved in PeaZip branch';
txt_5_1_scriptmanage:='Manage saved scheduled scripts';
txt_5_1_w2:='Monday';
txt_5_1_monthly:='Monthly';
txt_5_1_months:='Months';
txt_5_1_onlogin:='On login';
txt_5_1_onstart:='On start';
txt_5_1_once:='Once';
txt_5_1_w7:='Saturday';
txt_5_1_schedule:='Schedule';
txt_5_1_schedexplain:='Creates a plain text script from GUI task definition and schedule it. Scheduled tasks'' scripts are saved in "Scheduled scripts" folder. To edit or delete scheduled tasks you can use system''s Task Scheduler, all scheduled tasks created by PeaZip are collected in "PeaZip" branch of the tasks library.';
txt_5_1_schedok:='Schedule created successfully';
txt_5_1_schedscripts:='Saved scheduled scripts';
txt_5_1_startdate:='Start date';
txt_5_1_starttime:='Start time';
txt_5_1_w1:='Sunday';
txt_5_1_schedname:='Task name, identify both the saved scheduled script and the system''s scheduled task';
txt_5_1_ts:='Task Scheduler';
txt_5_1_w5:='Thursday';
txt_5_1_w3:='Tuesday';
txt_5_1_w4:='Wednesday';
txt_5_1_weekly:='Weekly';
txt_5_1_weeks:='Weeks';
txt_5_0_bc:='Breadcrumb';
txt_5_0_resetpm:='Do you confirm resetting Password Manager? All passwords stored in PeaZip''s Password Manager will be lost if confirmed.';
txt_5_0_enum:='Enumerate folder content';
txt_5_0_music:='Music';
txt_5_0_ps:='Open PowerShell here';
txt_5_0_perf:='Performances';
txt_5_0_pictures:='Pictures';
txt_5_0_removeall:='Remove all';
txt_5_0_resetbookmarks:='Reset Bookmarks to default? (Bookmarks can then be customized with Bookmarks > Organize)';
txt_5_0_sh:='Session history';
txt_5_0_skip:='Skip enumerating directories'' content in layout';
txt_5_0_videos:='Videos';
txt_4_9_frame:='Frame';
txt_4_9_listth:='List and thumbnails';
txt_4_9_shadow:='Shadow';
txt_4_9_style:='Style';
txt_4_8_attach25:='25 MB attachment';
txt_4_8_crop:='Crop';
txt_4_8_detailsno:='Details';
txt_4_8_details:='Details and thumbnails';
txt_4_8_fit:='Fit to';
txt_4_8_fitl:='Fit to largest';
txt_4_8_flip:='Flip';
txt_4_8_fullscreen:='Full screen';
txt_4_8_fun:='Functions';
txt_4_8_h:='Height';
txt_4_8_keeparchive:='Keep archive';
txt_4_8_noresize:='Keep original size';
txt_4_8_iconl:='Large images';
txt_4_8_iconm:='Icons and images';
txt_4_8_imagemanager:='Image manager';
txt_4_8_immersive:='Immersive';
txt_4_8_listno:='List';
txt_4_8_aspect:='Maintain aspect ratio';
txt_4_8_mirror:='Mirror';
txt_4_8_presets:='Presets';
txt_4_8_replace:='Replace original image(s)? "No" apply the transformation in new file(s).';
txt_4_8_resize:='Resize';
txt_4_8_rl:='Rotate left';
txt_4_8_rr:='Rotate right';
txt_4_8_stop:='Stop';
txt_4_8_t:='Transform';
txt_4_8_w:='Width';
txt_4_7_pk:='Create random password / keyfile';
txt_4_7_spchar:='Limit characters to letters and numbers';
txt_4_7_recycleask:='Move selected file(s) to Trash?';
txt_4_7_recycle:='Move to Trash';
txt_4_7_pcomp:='Potential compression';
txt_4_6_am:='Archive manager';
txt_4_6_fm:='File manager';
txt_4_6_users:='Users';
txt_4_5_goupdate:='A new version is available. Open PeaZip''s official website to download the update?';
txt_4_5_b:='Bottom';
txt_4_5_koupdate:='Cannot check for updates, no connection with update server';
txt_4_5_update:='Check for updates';
txt_4_5_dock:='Dock';
txt_4_5_l:='Left';
txt_4_5_noupdate:='PeaZip is up to date';
txt_4_5_properties:='Properties';
txt_4_5_r:='Right';
txt_4_5_pj:='Saved scripts';
txt_4_5_shaddress:='Show Address bar';
txt_4_5_shnav:='Show Side bar';
txt_4_5_shstatus:='Show Status bar';
txt_4_5_shtool:='Show Tool bar';
txt_4_5_upxpj:='Sorry, cannot export task definition since this action or option requires performing multiple distinct commands';
txt_4_5_t:='Top';
txt_4_4_confremoveall:='Remove all PeaZip customization files (Applications, Bookmarks)?';
txt_4_4_confremove:='Remove PeaZip configuration?';
txt_4_3_pwmanhint:='Double click to edit items in password list, rightclick for options, Ctrl+C to copy passwords';
txt_4_3_exppl:='Export password list';
txt_4_3_expple:='Encrypted (backup Password Manager)';
txt_4_3_keeppw:='Keep password/keyfile for current session';
txt_4_3_pwmanpwhint:='Setting a password/keyfile (optional) to encrypt password list is recommended, in this way authentication will be required to access to the Password Manager. Password/keyfile can be changed at any time from this form.';
txt_4_3_pwmanmaster:='Set/change PM master password';
txt_4_3_pwmanlist:='Password list';
txt_4_3_pwman:='Password Manager';
txt_4_3_pwmancorr:='Password Manager seems tampered or corrupted. Keep Password Manager anyway and try to recover current password list, if you trust it? (No will reset Password Manager, recommended)';
txt_4_3_expplp:='Plain text (all uses)';
txt_4_3_recsrc:='Recursive search by default';
txt_4_3_resetpm:='Reset Password Manager? All saved passwords will be deleted';
txt_4_3_breadcrumb:='Show Address as breadcrumb';
txt_4_2_arcabspath:='Use absolute paths';
txt_4_1_duplicateshint:='"size"/"checksum" string is reported in CRC column for all duplicate candidates found in current directory or search filter';
txt_4_1_adminhint:='(HINT: alternatively, you can request UAC elevation to work in protected paths, Alt+F10 or Options > Run as administrator)';
txt_4_1_selected:='(selected)';
txt_4_1_duplicatesfound:='duplicates found';
txt_4_1_duplicatesfind:='Find duplicates';
txt_4_1_runasadmin:='Run as administrator';
txt_4_1_simplesearch:='Simple search';
txt_4_0_thim:='Show picture thumbnails';
txt_3_8_type_description_wim:='WIM: Microsoft''s disk image format';
txt_3_8_type_description_xz:='XZ: powerful file compression based on LZMA2';
txt_3_7_donations:='Donations';
txt_3_7_nameasparent:='Name archive as selected item''s parent folder, if multiple items are added';
txt_3_7_tracker:='Issue Tracker';
txt_3_7_sort:='Sort by';
txt_3_7_swapbars:='Swap Tool bar / Address bar';
txt_3_7_themedbars:='Themed bars';
txt_3_6_ignoredd:='Always ignore paths for drag and drop extraction';
txt_3_6_close:='Close';
txt_3_6_resetapps:='Do you want to reset Applications (customizable group of programs and scripts to open files with, overriding file associations)?';
txt_3_6_ethemes:='Existing Themes';
txt_3_5_td:='Check for Themes';
txt_3_5_managecustomthemes:='Manage Themes';
txt_3_4_nopaths:='No paths';
txt_3_4_smallicons:='Icons';
txt_3_3_skipunits:='(Windows) Get volume information for network units, slower startup';
txt_3_3_stralt:='Alternative command, when no parameter is passed';
txt_3_3_apps:='Applications';
txt_3_3_multi:='Multiple selection';
txt_3_3_runexp:='Open a program, file, folder or website';
txt_3_3_apppath:='PeaZip''s folder';
txt_3_3_run:='Run';
txt_3_2_7zutf8nonascii:='7z / p7zip -mcu use UTF8 for file names containing non-ASCII symbols inside .zip files';
txt_3_2_alltasks:='All tasks';
txt_3_2_conf:='Configuration';
txt_3_2_donations:='Donate to charitable organizations';
txt_3_1_sccenc:='7z / p7zip -scc console character encoding';
txt_3_1_downloads:='Downloads';
txt_3_1_lib:='Libraries';
txt_3_1_more:='More';
txt_3_1_openasarchive:='Open as archive';
txt_3_1_sendto:='User''s SendTo menu folder';
txt_3_1_pathexc:='Path exceeding maximum allowed size';
txt_3_1_recent:='Recent';
txt_3_1_plsmartmin:='Run minimized, show/keep open only if needed';
txt_3_1_src:='Searches';
txt_3_1_systmp:='User''s temp';
txt_3_1_languagetools:='Translate';
txt_3_1_workingdir:='Working directory';
txt_3_0_nonreadableorpw:='Archive is not readable. The archive may not be valid, or its table of content could be encrypted. Would you like to try a password?';
txt_3_0_readablepw:='Archive is unreadable, may be password protected';
txt_3_0_configure:='File associations and system menu integration';
txt_3_0_resettmp:='Reset temporary work files';
txt_2_9_address:='Address bar';
txt_2_9_adv:='Advanced filters are applied when managing any file supported through 7z or FreeArc backends, see documentation, and overrides basic filters (that are used for search functions and are displayed in Bookmarks and History panels)';
txt_2_9_columns:='Columns';
txt_2_9_copyhere:='Copy here';
txt_2_9_noscan:='Don''t scan files being added to layout';
txt_2_9_extconsole:='Extraction console is available only while browsing archives';
txt_2_9_thl:='Highlight buttons';
txt_2_9_home:='Home';
txt_2_9_lt:='Large';
txt_2_9_mt:='Medium';
txt_2_9_movehere:='Move here';
txt_2_9_nav:='Navigation';
txt_2_9_navbar:='Side bar';
txt_2_9_none:='None';
txt_2_9_organize:='Organize';
txt_2_9_public:='Public';
txt_2_9_rec:='Recursive: search in subdirectories, may take some time';
txt_2_9_selected:='Selected';
txt_2_9_setapps:='Organize Applications';
txt_2_9_showmenu:='Show Menu bar';
txt_2_9_st:='Small';
txt_2_9_test_pw2G:='Test for encryption <2GB archives';
txt_2_9_vst:='Text only';
txt_2_9_toolbar:='Tool bar';
txt_2_9_tree:='Tree';
txt_2_9_views:='Views';
txt_2_8_experimental:='(experimental)';
txt_2_8_zcopy:='(Windows) Copy files in restartable mode, slower copy';
txt_2_8_addvol:='Adding entire volume(s) to archive may take long time, continue anyway?';
txt_2_8_uniterror:='Cannot access the unit';
txt_2_8_cannotconvert:='Cannot convert selected archives';
txt_2_8_convertbegin:='Continue with compression stage to finalize the conversion?';
txt_2_8_convert:='Convert';
txt_2_8_convertexisting:='Convert existing archives';
txt_2_8_convertdelete:='Delete files and folders created temporarily for conversion?';
txt_2_8_details:='Details';
txt_2_8_parallel:='Execute tasks in parallel when possible';
txt_2_8_convertnote:='In any case original archives were not modified, to let the user in control about keeping or removing them';
txt_2_8_custom:='is not directly supported by PeaZip, but in extraction stage you can set PeaZip to handle custom file types in "Advanced" tab. Proceed opening this file?';
txt_2_8_unitrecommend:='It is recommended either to extract (rightclick > extract selected) or to open filesystems from computer''s root (system tools > Open unit as archive)';
txt_2_8_viewasarchive:='Open unit as archive';
txt_2_8_nounit:='No unit selected';
txt_2_8_rowselect:='Row select';
txt_2_8_statusbar:='Status bar';
txt_2_8_typeunit:='Type logical or physical unit name';
txt_2_8_usedefaultoutpath:='Always use default output path';
txt_2_7_experimental:='(experimental, see documentation)';
txt_2_7_optional:='(optional)';
txt_2_7_list_tryflatorpw:=', possible solutions: try flat view (F6), provide password (F9), get a fresh copy of the archive';
txt_2_7_separate:='Add to separate archives';
txt_2_7_pwsupported:='archiving with password';
txt_2_7_cancel:='Cancel';
txt_2_7_encfn:='Encrypt also file names (if supported by the format)';
txt_2_7_setpw:='Set password / keyfile';
txt_2_7_ext:='Extracting:';
txt_2_7_extfrom:='Extracting from archive:';
txt_2_7_es:='Extract supported non-archive file types, i.e. executables, MS Office and OOo files';
txt_2_7_eu:='Extract unsupported file types, specifying custom extraction utility';
txt_2_7_clipboard:='Clipboard';
txt_2_7_goarclayout:='Go to archiving layout';
txt_2_7_goextlayout:='Go to extraction layout';
txt_2_7_ok:='OK';
txt_2_7_drag_archive:='open file as new archive? ("No" to add file to current archiving layout)';
txt_2_7_oop:='Open output path when task completes';
txt_2_7_validatefn:='Operation stopped, invalid file name detected:';
txt_2_7_validatecl:='Operation stopped, potentially dangerous command detected (i.e. command concatenation not allowed within the program):';
txt_2_7_output:='Output';
txt_2_7_pwnotset:='Password is not set ';
txt_2_7_pwarcset:='Password is set';
txt_2_7_pwextset:='Password is set, it is possible to extract/list/test encrypted archives';
txt_2_7_archivehint:='Drag here files and folders to archive, or right-click for more options';
txt_2_7_exthint:='Drag here archives to extract, or right-click for more options';
txt_2_7_setadvf:='Set advanced filters';
txt_2_7_selpath:='Selected item''s path';
txt_2_7_separateerror:='Sorry, cannot import task definition''s command line while using "Add each object to a separate archive" switch, since the task is performed as multiple distinct commands';
txt_2_7_noinput:='The layout is empty: please use Add file(s) or Load Layout to populate the list of archives to be extracted';
txt_2_7_dirsize:='The size of the content of folders is not checked for calculating the total size';
txt_2_7_un7z_browse_flat:='try flat view (F6)';
txt_2_7_updating:='[Updating existing archive]';
txt_2_6_folders:='(folders)';
txt_2_6_advanced:='Advanced';
txt_2_6_plalways:='Always stop to inspect task report';
txt_2_6_plsmart:='Stop to inspect report for error, list, test';
txt_2_5_sessionio:='(this session)';
txt_2_5_advanced:='Advanced edit: place spaces between parameter strings and filename if needed';
txt_2_5_basic:='Basic edit: application and parameters before input name';
txt_2_5_cannotrun:='Cannot run';
txt_2_5_custeditors:='Custom editors, players, antivirus scanners etc... (override system''s file associations)';
txt_2_5_delete:='Delete';
txt_2_5_delete_fromarchive:='Delete from archive';
txt_2_5_langflag:='Display archived object''s name as UTF-8 text; uncheck to replace extended characters with "?"';
txt_2_5_encpj:='Encode task definition as UTF-8 text';
txt_2_5_execommand:='Executable or command';
txt_2_5_help:='Help';
txt_2_5_langhint:='Hint: replacing extended characters with "?" jolly character can improve syntax if archive''s character set cannot be successfully converted on the current machine';
txt_2_5_mini_help:='Localized Tutorial';
txt_2_5_offline_help:='PeaZip help';
txt_2_5_tray:='Reduce to tray';
txt_2_5_remove:='Remove';
txt_2_5_hintpaths:='Rightclick to open system''s and user''s paths';
txt_2_5_selectapp:='Select application';
txt_2_5_strafter:='String after input name';
txt_2_5_strbefore:='String before input name';
txt_2_5_encoding:='Text encoding';
txt_2_5_nopw:='this type of archives does not support encryption';
txt_2_4_draghint:='[drag to Explorer with enabled Address bar]';
txt_2_4_tb:='Adapt toolbar buttons (restarts PeaZip)';
txt_2_4_adding:='Adding';
txt_2_4_advclip:='Clipboard keeps multiple selections';
txt_2_4_yanswers:='Answers';
txt_2_4_itemsheight:='Auto-size items height';
txt_2_4_clearclipboard:='Clear clipboard (Esc)';
txt_2_4_wcommons:='Commons';
txt_2_4_copyfrom:='Copy from';
txt_2_4_deletebookmarks:='Do you want to delete the list of bookmarked files and folders?';
txt_2_4_documents:='Documents';
txt_2_4_wenc:='Encyclopedia';
txt_2_4_extractfrom:='Extract from';
txt_2_4_hexp:='Hex viewer';
txt_2_4_operation:='Operation';
txt_2_4_path:='path is not writeable (i.e. full, or read-only). Do you want to select a writeable output path?';
txt_2_4_removefromclipboard:='Remove from clipboard';
txt_2_4_stdclip:='Standard: keep a single selection in clipboard, clear cut operations on paste';
txt_2_4_totalmem:='total memory';
txt_2_4_gvideo:='Video';
txt_2_4_wbook:='Wikibook';
txt_2_4_wnews:='Wikinews';
txt_2_4_wsrc:='Wikisource';
txt_2_4_wdict:='Wiktionary';
txt_2_3_pw_errorchar:='quote character is not recommended to be used in passwords (for PeaZip and scripts). If you need to create or extract an archive with this password you can dismiss the message and you will be asked to enter the password interactively in console.';
txt_2_3_envstr:='Display environment variables';
txt_2_3_never_pw:='Don''t ask for password';
txt_2_3_home:='User''s home';
txt_2_3_on_pw:='On extract/list/test operations from system''s menus:';
txt_2_3_test_pw100:='Test for encryption <100MB archives';
txt_2_3_test_pw:='Test for encryption (may be slow)';
txt_exclude_recourse:='"exclude" recurse subdirs';
txt_action_extopen:='"Extract and open with associated application" action';
txt_error_passwordnotmatch:='"Password" and "Confirm" fields doesn''t match, please correct them';
txt_action_preview:='"Preview with associated application" action';
txt_preview_hint:='"Preview" action perform the same task as "Extract and open" but to a temporary path in output directory, automathically removed when the archive is closed.';
txt_better:='(better)';
txt_default2:='(default)';
txt_faster:='(faster)';
txt_fastermem:='(faster, less memory)';
txt_tempdir:='(PeaZip''s temporary work folder)';
txt_stream:='(set by "Stream control")';
txt_slowermem:='(slower, more memory)';
txt_store:='(store, fastest)';
txt_newfolder:='(in new folder)';
txt_7z_exitcodeunknown:=': Unknown error in task';
txt_list_isfolder:=' [folder]';
txt_none:='<none>';
txt_fd:='1.44 MB Floppy Disk';
txt_7z_exitcode1:='1: Warning: non fatal error(s); i.e. some files missing or locked';
txt_attach10:='10 MB attachment';
txt_7z_exitcode2:='2: Fatal error occurred';
txt_7z_exitcode255:='255: Task halted by the user';
txt_fat32:='4 GB FAT32 file';
txt_dvd:='4.7 GB DVD';
txt_attach5:='5 MB attachment';
txt_cd650:='650 MB CD';
txt_7z_exitcode7:='7: Error: got incorrect command line';
txt_cd700:='700 MB CD';
txt_type_description_7z:='7Z: feature rich archive format with high compression ratio';
txt_dvddl:='8.5 GB DVD DL';
txt_7z_exitcode8:='8: Error: not enough memory for requested operation';
txt_abort:='Abort scheduled file copy/move operations?';
txt_about:='About';
txt_action:='Action';
txt_action_hint:='Action on open or preview with associated application';
txt_add:='Add';
txt_add_existing_archive:='add (if archive exists)';
txt_add_archive:='Add archive';
txt_add_files:='Add files';
txt_add_folder:='Add folder';
txt_add_path:='Add path';
txt_add_tolayout:='Add selected files and folders to archive''s layout';
txt_add_toarchive:='Add to archive';
txt_add_tobookmarks:='Add to Bookmarks';
txt_address_hint:='Filter: accepts * and ? wildcards';
txt_adv_filters:='Advanced filters';
txt_algo:='Algorithm';
txt_all:='all';
txt_all_default:='All (default)';
txt_all_type:='Same type';
txt_all_date:='Date';
txt_all_psize:='Packed file size';
txt_all_attributes:='Same attributes';
txt_all_size:='File size';
txt_error_input_upx:='allows a single executable file as input';
txt_always_pw:='Always ask for password';
txt_ignore_ext:='Always ignore paths for "Extract and..."';
txt_ignore_disp:='Always ignore paths for "Extract displayed..."';
txt_ignore_sel:='Always ignore paths for "Extract selected..."';
txt_key_hint:='Append keyfile''s hash to password; the archive can be decrypted by PeaZip and other applications following the same standard, or entering the hash as part of the password';
txt_timestamp:='Append timestamp to name';
txt_appoptions:='Application options';
txt_type_description_arc:='ARC: experimental archiver, powerful, efficient and feature-rich';
txt_archive:='Archive';
txt_un7z_browse_ok:='archive browsed successfully';
txt_interface:='Archive browser interface';
txt_archivecreation:='Archive creation';
txt_tarbefore_hint:='Archive data in TAR format before than in specified type.';
txt_archive_hint:='Archive, compress, split and keep private files, folders and volumes';
txt_compressionratio_hint:='Archive''s compression ratio';
txt_archiving:='Archiving:';
txt_cl_long:='Arguments seem exceeding the maximum size that can be passed by PeaZip frontend, please select less input files (i.e. select dirs instead of single files)';
txt_overwrite_askbefore:='Ask before overwriting (in console)';
txt_associated:='Associated application';
txt_attributes:='Attributes';
txt_author:='Author';
txt_ren_existing:='Auto rename existing files';
txt_ren_extracted:='Auto rename extracted files';
txt_autofolder:='Automatically create new folder to extract the archive in?';
txt_back:='Back';
txt_backend:='Backend binaries';
txt_backupexe:='Backup executable (recommended)';
txt_bettercompression:='better compression';
txt_blogs:='Blogs';
txt_blowfish:='Blowfish448 (64 bit blocks)';
txt_bookmarks:='Bookmarks';
txt_browse:='Browse';
txt_browser:='Browser';
txt_aborted_error:='Browsing archive stopped, it would take too much time. You can narrow the selection using search (F3) or exiting Flat view mode (F6); extract/list/test operations are not affected by this issue.';
txt_list_browsing:='Browsing';
txt_archive_root:='Browsing: archive''s root';
txt_type_description_bzip2:='BZip2: quite powerful compression, average speed';
txt_pw_empty:='Please provide a password (or a keyfile)';
txt_add_error:='Cannot add/update or delete object(s); probably the archive type has browse/extract only support, or cannot support that particular operation (i.e. it''s multi-volume or solid), or PeaZip cannot fully handle the archive name';
txt_un7z_browse_failure:='cannot browse archive';
txt_list_error:='Cannot list archive''s content, please check if the archive is password protected or corrupted.';
txt_conf_cannotsave:='Cannot save configuration file, check if the path is writeable and with some free space';
txt_check_hint:='Check for casual data corruption; hash algorithms are suitable to detect even malicious data tampering (see the documentation)';
txt_check:='Checksum/hash file(s)';
txt_check_select:='Checksum/hash';
txt_clear:='Clear';
txt_clearlayout:='Clear layout';
txt_pj_hint:='Click to import task, reset changes and load up to date task definition from GUI';
txt_autoclose:='Never stop to inspect task report';
txt_cl:='Command line';
txt_compare:='Compare files';
txt_compress:='Compress';
txt_compress_executable:='Compress executable';
txt_compress_openforwriting:='Compress files open for writing';
txt_compression:='Compression';
txt_compmanagement:='Computer management';
txt_pw_confirm:='Confirm';
txt_console:='Console';
txt_console_interface:='Console';
txt_content:='Content';
txt_controlpanel:='Control panel';
txt_convert:='Convert disk to NTFS';
txt_copy:='Copy';
txt_copyto:='Copy to...';
txt_create:='Create';
txt_create_archive:='Create new archive';
txt_title_create:='Create archive, compress, encrypt, split...';
txt_create_keyfile:='Create keyfile';
txt_create_folder:='Create new folder';
txt_create_theme:='Create Theme from current settings';
txt_rr:='Create recovery records';
txt_create_sfx:='Create self-extracting archive';
txt_cr_current:='Current path or filter compression ratio';
txt_custom:='Custom';
txt_type_description_custom:='Custom (advanced users): enter executable name and parameters';
txt_customapp:='Custom application';
txt_custom_parameters:='Custom parameters';
txt_customsize:='Custom size';
txt_cut:='Cut';
txt_datetime:='Date/time';
txt_default:='Default';
txt_default_compression:='default compression';
txt_default_format:='Default format';
txt_theme_default:='Default theme';
txt_hard_reset_hint:='Delete bookmarks file';
txt_desktop:='Desktop';
txt_dictionary:='Dictionary';
txt_dirs:='dir(s),';
txt_dis:='Disambiguation:';
txt_disk_cleanup:='Disk cleanup';
txt_disk_defrag:='Disk defrag';
txt_disk_management:='Disk management';
txt_dispaly:='Display results as';
txt_displayedmnu_obj:='displayed';
txt_displayedobjects:='Displayed items';
txt_nocompress:='do not compress';
txt_delete:='Do you want to delete selected file(s)? The operation can''t be undone and files will be not recoverable from Trash';
txt_wipe:='Do you want to securely delete selected file(s)? The operation can''t be undone and files will be not recoverable';
txt_done:='Done';
txt_edit:='Edit';
txt_elapsed:='elapsed:';
txt_error_emptycl:='Empty command line!';
txt_encrypt:='Encrypt';
txt_encrypted:='encrypted';
txt_encryption:='Encryption';
txt_note:='Enter note / description';
txt_random_keys:='Enter random keys';
txt_random_keys_hint:='Enter random keys (you not have to remember)';
txt_ent:='Entropy evaluation';
txt_ent_tools:='Move the mouse or use additional entropy sampling tools';
txt_eqorlarger:='Same or larger than selected object';
txt_eqorrecent:='Same or more recent than selected object';
txt_eqorolder:='Same or older than selected object';
txt_eqorsmaller:='Same or smaller than selected object';
txt_equal:='Same of selected object';
txt_erase_hint:='Secure delete: overwrite with random data, mask size, rename, finally delete';
txt_extraction_error:='Error extracting the selected object. If the archive is password protected please provide it';
txt_exclude_hint:='Exclude file(s), one per line; use * and ? wildcards; " and '' delimiters are not needed';
txt_exclusion_recourse:='Exclusion filters recurse subdirs';
txt_exclusion:='Exclude';
txt_exe:='Executable';
txt_overwrite_qry:='exists in destination path; overwrite with file(s) with same name from source path? (Cancel: skip copying this objecy)';
txt_confirm_overwrite:='exists; overwrite it? (no to skip)';
txt_explore_outpath:='Explore output path';
txt_explore_path:='Explore path';
txt_ext:='Ext:';
txt_caption_extract:='Extract';
txt_ext_nopath:='Extract (without path)';
txt_ext_all:='Extract all';
txt_ext_allhere:='Extract all here';
txt_ext_allto:='Extract all to';
txt_extopen_custom:='Extract and open with custom application';
txt_extopen_with:='Extract and open with...';
txt_ext_disp_here:='Extract displayed here';
txt_ext_disp:='Extract displayed object(s)';
txt_ext_disp_to:='Extract displayed object(s) to...';
txt_ext_here:='Extract here';
txt_ext_sel_here:='Extract selected here';
txt_ext_sel:='Extract selected object(s)';
txt_ext_sel_to:='Extract selected object(s) to...';
txt_extobj:='Extract the object';
txt_newfoldermenu:='Extract in new folder';
txt_extto:='Extract to...';
txt_level_fast:='Fast';
txt_fastcompr:='fast compression';
txt_fastopen:='Fast open routine, stop browsing extremely large archives, use filters instead';
txt_level_fastest:='Fastest';
txt_favformats:='Favorite formats';
txt_file:='File';
txt_filebrowser:='File browser';
txt_filetools:='File tools';
txt_files:='file(s),';
txt_nfiles:='Files';
txt_fs:='Filesystem';
txt_filters_recourse:='filter(s) recurse subdirs';
txt_filters:='Filters';
txt_flat:='Flat (show all)';
txt_list_flat:='Flat view';
txt_unit_floppy:='Floppy disk';
txt_foldername:='Folder name';
txt_nfolders:='Folders';
txt_error_input_multi:='format allows a single file as input; you can use "TAR before" switch to save input in a .TAR archive before, otherwise you can chose another format. HINT: chose archive format after had selected input data: "TAR before" switch will be automatically set';
txt_fwd:='Forward';
txt_list_found:='Found';
txt_free:='Free';
txt_free2:='free';
txt_name_full:='Full name';
txt_function:='Function';
txt_general:='General';
txt_multithreading:='Generic multithreading';
txt_go_browser:='Go to file browser';
txt_go_path:='Explore path (PeaZip)';
txt_guicl:='GUI + Console';
txt_guipealauncher:='GUI';
txt_graphic:='Graphic''s folder';
txt_gridaltcolor:='Grids alternate color';
txt_gridrowheight:='Grids row height';
txt_gui:='GUI';
txt_type_description_gzip:='GZip: fast compression';
txt_here:='here';
txt_list_history:='History';
txt_homeroot:='Computer/archive''s root level';
txt_quickbrowse_hint:='If browsing is stopped the user can narrow the selection using search or filter functions; extract/list/test functions are not affected in any way.';
txt_backupexe_hint:='If something goes wrong and lead to a non functional result, you may recover the original executable from the authomatic backup copy';
txt_attach:='If the mail client supports that command, the archive will be attached to a new mail';
txt_images:='Images';
txt_include_hint:='Include file(s), one per line; use * and ? wildcards; " and '' delimiters are not needed';
txt_filters_hint:='Inclusion and exclusion filters for 7z binary, please carefully read 7-Zip documentation to understand how those filters works';
txt_inclusion_recourse:='Inclusion filters recurse subdirs';
txt_inclusion:='Include';
txt_error_function:='Incorrect function requested';
txt_info:='Info';
txt_infoall:='Info on all';
txt_infodisp:='Info on displayed object(s)';
txt_infosel:='Info on selected object(s)';
txt_inputinfo:='Input information';
txt_input_list:='Input list:';
txt_iop:='input, output, parameters';
txt_ipo:='input, parameters, output';
txt_input:='Input';
txt_integrity:='Integrity check';
txt_chunk_size:='Invalid custom size, please correct it in a numerical value';
txt_invertsel:='Invert selection';
txt_type_exe:='is a Windows executable, do you want to run it? ("No" to try open it as archive) HINT: some executables may not properly run unless the whole archive is extracted before';
txt_return_to_archive:='is currently open; do you want to browse it?';
txt_not_accessible:='is no longer accessible';
txt_type_unsupported:='is not a supported archive type';
txt_checkname_failed:='is not a valid name.';
txt_not_accessible_list:='is not accessible, please check if the file list provided is correct and up to date';
txt_theme_create_error:='It was not possible to create the theme, try to use a name valid for a folder as theme name and to chose a writeable path';
txt_theme_exists:='yet exists, please provide a different path';
txt_job_code:='task code:';
txt_job_definition_saved:='Task definition successfully saved in';
txt_job_success:='Task successfully completed!';
txt_join:='Join';
txt_joinfiles:='Join files';
txt_keyfile:='Keyfile';
txt_keyfile_not_found:='Keyfile cannot be found or read. Please chose a different Keyfile.';
txt_keyfile_notcreated:='KeyFile not created';
txt_larger:='Larger than selected object';
txt_lastused:='Last used';
txt_launch:='Launch task';
txt_layout:='Layout';
txt_filelist_savedas:='Layout saved as';
txt_level:='Level';
txt_license:='License';
txt_caption_list:='List';
txt_list_details:='List (with details)';
txt_list_all:='List all';
txt_list_disp:='List displayed object(s)';
txt_list_sel:='List selected object(s)';
txt_toggle_warning:='Listing flat view of path''s content may take long time, continue anyway?';
txt_loadfile:='Load file';
txt_loadlayout:='Load layout';
txt_unit_hd:='Local disk';
txt_localization:='Localization';
txt_lpaqver:='LPAQ version';
txt_type_description_lpaq:='LPAQ: faster version of PAQ, very good compression';
txt_maininterface:='Main interface';
txt_maxcomp:='Max compression mode';
txt_level_maximum:='Maximum';
txt_restartrequired:='May require restarting the application to be applied';
txt_required_memory:='MB of memory required';
txt_method:='Method';
txt_misc:='Misc';
txt_modify:='Modify';
txt_morecontrols:='More controls (history, bookmarks, ...)';
txt_morerecent:='More recent than selected object';
txt_ent_hint:='Move the mouse, enter keys in the edit field, load files to collect entropy from the system...';
txt_moveto:='Move to...';
txt_mypc:='Computer''s root';
txt_list_na:='n/a';
txt_name:='Name';
txt_naming:='Naming';
txt_unit_remote:='Network drive';
txt_newarchive:='new archive';
txt_cnewfolder:='New folder';
txt_news:='News';
txt_no:='No';
txt_noinput:='No accessible input received';
txt_nocompress_hint:='no compression (faster)';
txt_split_noinput:='No input selected; please select a file to split';
txt_open_noinput:='No input selected; please select an archive (first archive''s volume for multi-volume archives)';
txt_list_nomatch:='no match';
txt_singlethread:='No multithreading';
txt_none2:='none';
txt_nonsolid:='Non-solid';
txt_level_normal:='Normal';
txt_copy_error:='not successfully copied or moved, error code:';
txt_description:='Notes';
txt_compare_second:='Now select file to be compared with';
txt_peaobj:='Object control';
txt_displayed_obj:='object(s)';
txt_olderthan:='Older than selected object';
txt_on:='on';
txt_ondblclick:='On doubleclick';
txt_opacity:='Opacity';
txt_open:='Open';
txt_openarchive:='Open archive';
txt_title_open:='Open archive, decrypt, join...';
txt_open_bookmark:='Open bookmark';
txt_cphere:='Open command prompt here';
txt_open_file:='Open file';
txt_open_files:='Open file(s)';
txt_open_path:='Open path';
txt_opensource:='Open source portable archiver';
txt_openwith:='Open with...';
txt_aborted:='Operation aborted';
txt_unit_cd:='Optical drive';
txt_options:='Options';
txt_other:='Other';
txt_otherparams:='Other parameters (free editing)';
txt_oip:='output, input, parameters';
txt_opi:='output, parameters, input';
txt_output:='output:';
txt_overwrite:='Overwrite existing files';
txt_compressed_size:='Packed';
txt_paqver:='PAQ version';
txt_type_description_paq:='PAQ: slow but extremely powerful compressor';
txt_pio:='parameters, input, output';
txt_poi:='parameters, output, input';
txt_parameters:='Parameters:';
txt_error_partial:='Partial extraction not implemented for current archive type';
txt_passes:='Passes';
txt_pw:='Password';
txt_pwlength:='Password length in characters (4..64)';
txt_un7z_browse_pw:='password may be required';
txt_un7z_browse_pw_other:='password may be wrong';
txt_paste:='Paste';
txt_path:='Path';
txt_pea_appcolor:='Application accent color';
txt_pea_textcolor:='Pea text color';
txt_type_description_pea:='PEA: security oriented archive format with fast compression';
txt_peazip_new:='PeaZip (new instance)';
txt_peazip_help:='Online support';
txt_peazip_web:='PeaZip Website';
txt_performall:='Perform all supported algorithms';
txt_name_provide:='\ / : * ? '' " < > | characters are not allowed in file names';
txt_upxorstrip:='Please chose Strip and/or UPX on the binary';
txt_not_removable_file:='Please close file in use, in order to allow PeaZip to remove it:';
txt_not_removable:='Please close files in use, in order to allow PeaZip to remove the folder:';
txt_custom_executable_missing:='Please provide the custom executable''s name';
txt_type_unsupported_select:='Please select a supported archive type:';
txt_no_theme_name:='Please specify a theme name';
txt_please_wait:='Please wait';
txt_copy_wait:='Please wait currently scheduled file copy/move operations to complete before scheduling other operations of the same type';
txt_previewwith:='Preview with...';
txt_projectadmin:='Project administrator:';
txt_type_description_quad:='BALZ/QUAD: high-performance ROLZ-based file compressors';
txt_quickdelete:='Quick delete';
txt_quit:='Quit';
txt_unit_ram:='RAM disk';
txt_read:='Read:';
txt_recentarchives:='Recent archives';
txt_rr_hint:='Recovery records allows to try to correct archives in case of data corruption';
txt_search_refine:='Refine search filter, accepts ? and * wildcards';
txt_fefreshf5:='Refresh';
txt_release:='release:';
txt_unit_removable:='Removable unit';
txt_remove_bookmark:='Remove bookmark';
txt_remove_external_unit:='Remove external device(s)';
txt_removeselected:='Remove selected object(s)';
txt_rename:='Rename';
txt_caption_repair:='Repair';
txt_restartrequired2:='requires restarting the application to apply';
txt_reset:='Reset';
txt_reset_archivename:='Reset archive name';
txt_hardreset:='Reset bookmarks';
txt_reset_theme:='Reset to embedded theme';
txt_restore_att:='restore original attributes';
txt_run_as:='Run as (cannot switch to users with blank password)';
txt_run_as2:='Run as different user';
txt_sample:='Sample: ';
txt_saveas:='Save as';
txt_savehistory:='Save history data';
txt_save_infolder:='Save in folder (auto)';
txt_savejob:='Save task definition as script';
txt_savejobdefinition:='Save task definition as script';
txt_savejobdefinition_hint:='Export the task defined in the GUI as CLI script';
txt_savelayout:='Save layout';
txt_save_winstate:='Save main window state';
txt_search:='Search (recursive, may take some time)';
txt_searchanddrag:='Search and drag here';
txt_searchfor:='Search';
txt_nrsearch:='Search here (non recursive)';
txt_search_hint:='Search in archive''s subdirectories for matches with filter(s)';
txt_search_web:='Web search';
txt_list_searching:='Searching...';
txt_securedelete:='Secure delete';
txt_default_description:='Select a function or drag files here';
txt_selectall:='Select all';
txt_selectdir:='Select directory';
txt_selected_obj:='selected';
txt_selected_objects:='Selected items';
txt_sfx:='Self-extracting';
txt_sendbymail:='Send by mail';
txt_set_defaults:='Set application''s default parameters';
txt_settings:='Settings';
txt_sfx_interface:='sfx interface';
txt_showhints:='Show hints and tooltips';
txt_show_messages:='Show information messages';
txt_showpw:='Show password field content';
txt_singlevol:='Single volume, do not split';
txt_size:='Size';
txt_sizeb:='Size (B)';
txt_skip_existing:='Skip existing files';
txt_slowercomp:='slower compression but equally fast decompression';
txt_smaller:='Smaller than selected object';
txt_solid:='Solid';
txt_solid_block:='Block size';
txt_solid_auto:='Solid, auto-adjust';
txt_solid_extension:='Solid, group by extension';
txt_listtest:='sorry, list/test operation is not yet implemented for this format';
txt_sortbysel:='Sort by selection status';
txt_list_sorting:='Sorting...';
txt_speed:='speed';
txt_split:='Split';
txt_type_description_split:='Split a file with optional integrity check';
txt_split_file:='Split file';
txt_list_nostats:='stats not available';
txt_status:='Status';
txt_level_store:='Store';
txt_stream_control:='Stream control';
txt_strip:='Strip before UPX (recommended)';
txt_keyfile_created:='Successfully created KeyFile as:';
txt_suggestpw:='Create random password';
txt_noupx:='Symbols stripped, UPX compression omitted';
txt_syntax:='Syntax:';
txt_sysbenchmark:='System benchmark';
txt_benchmark:='System benchmark will take some minutes and will use all available CPU and memory resource. The system may not respond during the benchmark; run it anyway?';
txt_systools:='System tools';
txt_tarbefore:='TAR before';
txt_type_description_tar:='TAR: archiving format mainstream on UNIX systems';
txt_taskman:='Task Manager';
txt_caption_test:='Test';
txt_testall:='Test all';
txt_testdisp:='Test displayed object(s)';
txt_testpw:='Test password / keyfile';
txt_testsel:='Test selected object(s)';
txt_col_hint:='The color should be chosen in order to integrate well with icon colors and to other GUI''s elements';
txt_bookmarks_hint:='The complete and editable list of bookmarks is available in the file browser interface, clicking on the "More controls" icon and on "Toggle history/bookmarks"';
txt_archive_noinput_tolist:='The layout is empty: please use Add file(s), Add folder(s) or Load Layout to populate the archive''s layout';
txt_theme:='Theme';
txt_icons_found:='Theme loaded successfully.';
txt_themename:='Theme name';
txt_icons_not_found:='Theme not loaded correctly. Try to switch to the default theme, or to a known working one.';
txt_theme_create_success:='theme successfully created in';
txt_theming:='Theming';
txt_extand_error:='This function can be performed on a single object at time';
txt_threads:='Threads';
txt_titlescolor:='Titles color';
txt_to:='to';
txt_toggle_browseflat:='Toggle browse / flat view (show all)';
txt_toggle_historybookmarks:='Toggle status bar';
txt_toolbarscolor:='Bars color';
txt_tools:='Tools';
txt_best:='try best settings (slow)';
txt_type:='Type';
txt_level_ultra:='Ultra';
txt_error_openfile:='Unable to open the specified file';
txt_cl_hint:='UNACE and UPX always run using console mode; list, test and benchmark tasks always run using GUI mode';
txt_ace_missing:='UNACE plugin is missing; for handling ACE archives you can download the plugin form PeaZip''s website (being UNACE closed source, the plugin is not featured in base package)';
txt_units:='units';
txt_unit_unknown:='Unknown drive type';
txt_un7z_pw_untested:='Untested';
txt_up:='Up';
txt_update:='update (if archive exists)';
txt_type_description_upx:='UPX: compress executable files only';
txt_advfilters:='Use advanced filters';
txt_openfiles_hint:='Use this option to include in the archive files open for writing by other applications (useful in backup tasks)';
txt_usenet:='Usenet';
txt_user_name:='User name; use user@DOMAIN or DOMAIN\user form if needed.';
txt_using:='Using:';
txt_volumepea:='Volume control';
txt_volume_size:='Volume size';
txt_type_ext_uns:='was successfully extracted';
txt_websearch:='Web search';
txt_websites:='Websites';
txt_word:='Word';
txt_write:='Write:';
txt_ramdompw_hint:='You can copy the random generated password from here';
txt_exe_hint:='You can freely enter executable name and parameters for custom compression, and chose syntax''s construction. Please note that you can also manually change command''s syntax in "Console" tab.';
txt_pj_hint2:='You can import the task''s definition from the GUI frontend in the memo field above. Then, you can edit, launch or save it without changing or losing the task defined for the GUI frontend.';
txt_type_description_zip:='ZIP: fast archiving/compression format, mainstream on Windows systems';
txt_zipcrypto_hint:='ZipCrypto (legacy)';
end;

function texts(lang:ansistring):integer;
begin
load_default_texts;
if lang='volatile' then begin assign_guitext; texts:=0; exit; end;
if load_texts(lang)<>0 then //try to load language file sequentially; fallback to a slower recoursive procedure to valorize each known variable from lang file strings if the language file version doesn't match with PeaZip's version
   begin
   load_default_texts;
   assign_guitext;
   texts:=0;
   end
else texts:=0;
end;

procedure changelanguage;
begin
FormPeach.OpenDialogLang.InitialDir:=sharepath+'lang'+directoryseparator;
if FormPeach.OpenDialogLang.execute then
   if FormPeach.OpenDialogLang.FileName<>'' then
      begin
      {$IFDEF MSWINDOWS}
      peaziplanguage(extractfilename(FormPeach.OpenDialogLang.FileName));
      restartclosepeaapp;
      {$ELSE}
      lang_file:=extractfilename(FormPeach.OpenDialogLang.FileName);
      saverestartclosepeaapp;
      {$ENDIF}
      end
   else exit
else exit;
end;

procedure peaziplanguagenc(s: ansistring);
{$IFDEF MSWINDOWS} var exepath,langreg,forcereg:widestring;{$ENDIF}
begin
if s='*nochange' then s:=lang_file;
if s='' then s:='default.txt';
if ExtractFileExt(s)<>'.txt' then s:='default.txt';
lang_file:=s;
{$IFDEF MSWINDOWS}
if (winver='nt6+') and (majmin<>'6.0') then
   if not(FileExists(resource_path+'portable')) then //if Windows instalable version
   begin
   exepath:=utf8decode(sharepath);
   cutextension(s);
   langreg:=utf8decode(s)+'.reg';
   forcereg:='';
   if FileExists(sharepath+'lang-wincontext\'+s+'.reg') then
      begin
      {$IFDEF WIN32} try if IsWindows64=true then forcereg:=' /reg:64'; except end; {$ENDIF}
      ShellExecuteW(FormPeach.Handle, PWideChar ('runas'), PWideChar('reg'), PWideChar ('import "'+exepath+'lang-wincontext\'+langreg+'"'+forcereg), PWideChar (''), SW_SHOWNORMAL);
      end;
   end;
{$ENDIF}
end;

procedure peaziplanguage(s: ansistring);
begin
peaziplanguagenc(s);
FormPeach.Close;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection CONFIGURATION load and save conf and theming

///////////////////////////////////////////////////////////////////////////////}

procedure setbasevars;
begin
{$IFDEF MSWINDOWS}
max_cl:=32768;
{$ELSE}
max_cl:=131072;
{$ENDIF} //customized later in configuration
pmode:=0;//0 pass command line to process 1 pass parameters list to process
poslastobj:=-1;
fthumbs:=false;
gofthumbs:=false;
navbarhidden:=false;
dolistupdate:=true;
countingunits:=false;
piperar:=false;
intdd:=false;
frompc:=false;
prefixd:='1';
prefixf:='2';
prefixdaz:='a ';
prefixfaz:='b ';
prefixdza:='c ';
pdrop:=false;
tmpenumd:=false;
COL1D:=240;
COL2D:=80;
COL3D:=80;
COL4D:=80;
COL5D:=160;
COL6D:=60;
COL7D:=100;
imported_tarbeforejob:=false;
specialmoderar:=0;
bctemp:=0;
specialopen:=false;
singleextract:=true;
updatingarchive_sync:=false;
goarchiving:=false;
disdrag:=false;
threadextracting:=false;
launchwithsemaphore:=false;
keeppreview:=false;
beingpreviewed:='';
setbs:=false;
endflag:=false;
browserbusy:=false;
executable_path:=Programdirectory;//valorize application's paths
if executable_path='' then executable_path:=Application.location;
if executable_path='' then extractfilepath(paramstr(0));
if executable_path<>'' then
   if executable_path[length(executable_path)]<>directoryseparator then executable_path:=executable_path+directoryseparator;
setcurrentdir(executable_path);
{$IFDEF DARWIN}
resource_path:=executable_path+'../Resources/';
binpath:=executable_path+'bin'+directoryseparator;//binaries, architecture dependant
{$ELSE}
resource_path:=executable_path+'res'+directoryseparator;
binpath:=resource_path+'bin'+directoryseparator;//binaries, architecture dependant
{$ENDIF}
sharepath:=resource_path+'share'+directoryseparator;//non binaries resources, non-architecture dependant
confpath:=resource_path+'conf'+directoryseparator;//configuration files, non-architecture dependant
if HBINPATH<>'' then binpath:=HBINPATH;
if HCONFPATH<>'' then confpath:=HCONFPATH;
if HSHAREPATH<>'' then sharepath:=HSHAREPATH;
archiveopened:=false;
browsinghistory:=false;
imgloaded:=false;
openstarted:=false;
done_quickfunctions:=false;
dragcancelled:=true;
popupclosed:=false;
listingdir:=false;
control_listingdir:=false;
done_listingexe:=false;
waitdrawok:=false;
listcol:=1;
prev_type:='';
prev_method:='';
prev_level:='';
archive_type_selected:=-1;
using_tarbefore:=false;
tarbeforenameexception:=false;
seemencrypted:=false;
settingvalues:=false;
subfun:='';
listsortcol1:=9;
listsortcol2:=9;
listsortbook:=0;
setlength(clipcontent,0);
setlength(clipcontent1,0);
filecopying:=false;
destdir:='';
prev_destdir:='';
getdesk_env(desk_env,caption_build,delimiter); //desktop environment: 0 unknown; 1 Gnome-like; 2 KDE-like; 10 Windows; 20; Darwin/OSX
desktop_path:='';

{$IFDEF MSWINDOWS}
wingetdesk;
wingetdocuments;
wingetpictures;
wingetmusic;
wingetvideos;
wingetpublichome;
wingetpublicdocuments;
wingetuserprofile;
wingetsendto;
wingetrecent;
wingetdownloads;
wingetsearches;
wingetlibraries;
sysgetshared;
{$ELSE}
sysgetshared;
get_desktop_path(desktop_path);
get_home_path(home_path);
get_home_subpaths(usr_documents,usr_downloads,usr_music,usr_pictures,usr_videos);
FormPeach.MenuItemArchive_pubdoc.Visible:=false;
FormPeach.MenuItemOpen_pubdoc.Visible:=false;
FormPeach.mextto_pubdoc.Visible:=false;
FormPeach.pmjumppubhome.Visible:=false;
FormPeach.MenuItemArchive_pubhome.Visible:=false;
FormPeach.MenuItemOpen_pubhome.Visible:=false;
FormPeach.mextto_pubhome.Visible:=false;
FormPeach.pmjumppubdoc.Visible:=false;
{$ENDIF}
getapplebk;
if checkdirexists(home_path) then
else home_path:=executable_path;
if checkdirexists(desktop_path) then
else desktop_path:=home_path;
caption_release:=APPMAIN+' '+PEAZIPVERSION+PEAZIPREVISION;
needwaitupdating:=false;
updatingarchive_inarchive:=false;
listviewcompleted:=false;
updatinglistview:=false;
updatingsel:=false;
ares:=-1;
dontsavecustom7z:=false;
dontsavecustomzip:=false;
forceopenasarchive:=false;
skipapstatus:=false;
hidepwconf:=0;
prevrun:='';
fromtree:=false;
spinchanged:=false;
smalliconsize:=16;
largeiconsize:=96;
titlestring:='';
sync:=0;
contextconvert_switch:=false;
funflag:=false;
updateid:='';
prevupdateid:='';
prevarchive:='';
issearching:=0;
pmnotdecrypted:=0;
hnum:=0;
lasttoolbar:=1;
prevdrbutton:=-1;
cancellingarchive:=false;
uacneeded:=false;
nffromdrag:=false;
convertverbose:=0;
convertpw:=0;
libre_directive:=0;
privacy_mode:=0;
unrar5shown:=false;
unaceshown:=false;
restartingapp:=false;
needsave:=true;
updatingcontent:=0;
wasselected:=-1;
wasselectedp:=-1;
prevlistfilter:='';
ptabid:=1;
atabid:=1;
setsequenceerror:=0;
forcecanbechanged:=0;
forcetype:=0;
forcelayout:=0;
forcebrowse:=1;
forceconvert:=0;
settmpextnf:=false;
tmpextnf:=false;
psize:=0;
starttaberror:=false;
loadadvdefaults:=true;
end;

procedure getthemepath(var thpath:ansistring);
var
   s:ansistring;
begin
if theme_name='' then
   begin
   s:=extractfilepath(theme_path);
   if s<>'' then setlength(s,length(s)-1);
   theme_name:=extractfilename(s);
   end;
//default and no graphic themes are in application's path, custom themes are in configuration path (application's path for portable versions, user's home/application data for installable versions)
if ((theme_name)<>(DEFAULT_THEME)) then thpath:=confpath
else thpath:=sharepath;
end;

procedure setsyntaxstring7z;
begin
case syntaxlevel7z of
   0: syntaxstring7z:='last';
   1: syntaxstring7z:='23';
   2: syntaxstring7z:='21';
   3: syntaxstring7z:='17';
   4: syntaxstring7z:='16';
end;
end;

procedure setrenderstyle;
begin
img_utils.renderinterpolation:=renderinterpolation;
FormPeach.pmrendernative.Checked:=false;
FormPeach.pmrendersharp.Checked:=false;
FormPeach.pmrendersoft.Checked:=false;
case renderinterpolation of
   0: FormPeach.pmrendernative.Checked:=true;
   1: FormPeach.pmrendersharp.Checked:=true;
   2: FormPeach.pmrendersoft.Checked:=true;
end;
end;

procedure default_defaults;
begin
lang_file:='default.txt';//lang file
gwcompact:=false;
FormGwrap.pmCompact.Checked:=false;
autoclosegwrap:=2; //close pealauncher when job completes if no error happens
enc7zscc:=0; //0 UTF-8 encoding 1 WIN 2 DOS
browsersd:=0; //0 start browsing from last visited directory (default) 1 computer's root 2 desktop 3 home 4 custom
browsersdir:='';
movetorelativepath:=1;//interactive two steps extraction: extract and then move to relative path after extraction completed
autoopen:=0; //don't open output dir by default when job completes
autotest:=0; //don't test archives after creation
convertverbose:=0; //no verbose confirmation for conversion steps
convertpw:=0; //change password during conversion - asks a new password in re-compression stage
libre_directive:=0; //0 off (default) 1 flexible 2 strict enable only calls to binaries released under OSI licenses
mailkeep:=0; //don't keep archives sent by mail
nameaspartent:=1;//by default name multiple items as selected item's folder
df:=18; //default format: last used
tsstyle:=0;//default timestamp style
pf:=15; //previous format, by default zip
pcompr:=1; //pea default Compression: average
pobj:=11; //pea default object control algorithm CRC32
pvol:=4; //pea default volume control algorithm SHA-3 256
pstream:=0; //pea default stream control algorithm AES+Twofish+Serpent 256 bit in EAX mode
nrkdf:=0;//KDF work load for PEA cascaded encryption
trkdf:=0;//0 scrypt, 1 Hybrid, 2 PBKDF2
salgo:=13; //file split default integrity check algorithm: none
zaout:=2; //Console binaries interface option: GUI, GUI+console, console (except for list/test/benchmark)
zaout1:=zaout;
clipmode:=0; //clipboard mode for cut/copy/paste: 0 standard mode, 1 advanced mode allowing multiple mixed cut and copy selection from various sources
showguihints:=1; //peazip shows hint popups: 1 yes (default) 0 no
showsearchbar:=0; //hide search bar by default
{$IFDEF MSWINDOWS}
wingetdesk;
local_desktop:=desktop_path;
indir:=txt_mypc;//local_desktop;
{$ELSE}
indir:='/';
//showguihints:=0; //show hint popups, now default on Linux as performance of the binary is improved
{$ENDIF} //initial directory (file/archive browser interface) (in case of conf failure at startup txt_my pc is empty, but this condition is checked in check_defaults_failure)
showpwfield:=0; //shows password fields: off (requires pw confirmation)
setencfn:=0; //default don't encrypt filenames (apply only to formats supporting this feature)
intpw:=0; //default don't force typing password interactively in backend console
browserstyle:=0; //0:browser 1:f6flat 2*:last used ( *=0 browser, *=1 f6flat);
extopt7z:=0; //overwrite policy for extraction with 7z (skip existing files)
extaction7z:=0; //action for extraction, 7z frontend
extactionarc:=0; //action for extraction, arc frontend
extactionace:=0; //action for extraction, ace frontend
{$IFDEF MSWINDOWS}work_dir:=1;{$ELSE}work_dir:=0;{$ENDIF}
custom_work_path:='';
extoptarc:=2; //overwrite policy for extraction with arc (skip existing files)
closeonsingleextract:=0;//close after extraction if no browsing actions took place
whenspecialopen:=2;//always extract everything for special file types in archives
howspecialopen:=0;//extract entire archive for special file types in archives
seccond:=0;//do not run active content from 0 archives 1 filesystem 2 both 3 disable check
mbaction:=3;//open in a new tab
renderinterpolation:=0; setrenderstyle;//icon rendering interpolation style 0 native, 1 sharp, 2 soft
FormPeach.editExtEvForWhat.Caption:=SPECEXTCONST;
FormPeach.editExtEvForSec.Caption:=SECEXTCONST;
FormPeach.Editcommonalgo.Caption:=PREFALGOCONST;
FormPeach.pcustom1.Caption:='';
FormPeach.pcustom2.Caption:='';
FormPeach.pcustom3.Caption:='';
FormPeach.pcustom4.Caption:='';
FormPeach.pcustom5.Caption:='';
FormPeach.pcustom6.Caption:='';
FormPeach.pcustom7.Caption:='';
FormPeach.pcustom8.Caption:='';
FormPeach.EditOPcustom.Caption:='';
FormPeach.EditCustomParamExt.Caption:='';
FormPeach.EditCustomExtension.Caption:='';
FormPeach.LabelForceLayout.Caption:='';
pmode:=0;
executesmallbk:=0;
logcommands:=0;
FormPeach.Editalias.Caption:='7z';
ignorepathextand:=0; //extract and... extracts to current path ignoring internal archive's path: off (all ignore paths directives are ignored if the content is a directory, as it would lose information about content's tree)
ignorepathdisp:=0; //ignore path extracting displayed objects: off
ignorepathsel:=0; //ignore path extracting selected objects: off
enableextand:=0; //do not enable extract and open with menu, only preview
removeintdir:=1;//remove intermediate dir on extract to new folder: on
//Performance parameter for 7z / p7zip -slt listing, stop time consuming operations (dramatically faster on archives containing many files):
prebrowse:=3; setmaxndirtree;
maxargsize:=2;
//listview virtual over number of items items
virtualopt:=0;
taskpriority:=2; //launch tasks with normal priority
dragtargetprotect:=1; //lock drag and drop target window during operation
skipdel:=1;//skip deletion if temp work files are locked
kflimit:=1;//limit keyfile size to first 100MB
UnitKF.dkflimit:=kflimit;
disableintscript:=1;
nonverboselog:=1;//non-verbose output for 7z / p7zip (v15.x onward), faster when many small files are involved
use7zunrar5:=1;//use 7z / p7zip UNRAR5 implementation (v15.06+)
useextrac32:=0;//(Windows) use system's Extrac32 to unpack CAB files
enumd:=1; //enumerate content of directories added for archiving operations
userar:=1;//use winrar's rar.exe for rar compression if installed
userar5:=1;//create rar5 instead of rar4
userardict:=5;//(rar5 only) user dictionary size of 1..1024 MB, not implemented for legacy RAR4 format
userarblake2:=0;//(rar5 only) use BLAKE2 hash instead of CRC
setrarmanual:=0;
restoretabbar:=0;
userarsfx:=0;
userarsolid:=0;
userarrr:=0;
puserarrr:=3;
userarrv:=0;
puserarrv:=1;
userarsaveopen:=0;
userarsavesecurity:=0;
userarsavestreams:=1;
userarlastmodtime:=0;
userarlock:=0;
scripttarpipe:=0;
scriptuntarpipe:=0;
addencext:=0; //1 add ".enc" suffix (before extension) when creating encrypted archives
privacy_mode:=0; //ask for password when application starts 1 skippable 2 ask until a non empty password (or keyfile) is provided (so no operation can be done forgetting to provide the password)
addtstext:=0; //add timestamp suffix when creating archives
repcustext:=0; //replace archive extension with custom one
defaulttabsmenu:=2;//address bar menu 1 bookmarks 2 filesystem (default) 3 history 4 functions
multi_option:=1; //generic multithreading
memuse_option:=0;//default, implicit
{$IFDEF MSWINDOWS}
favdelete:=0; //default delete mode for delete option concatenated with archive/extract operations 0 Recycle (Windows) 1 Quick 2 Zero 3 Secure
{$ELSE}
{$IFDEF DARWIN}
favdelete:=0;
{$ELSE}
favdelete:=1;
{$ENDIF}
{$ENDIF}
doptadd:=0;// do not delete originals after archiving by default
doptext:=0;// do not delete originals after extraction by default
savehistory:=1; //save usage history - last archives, last directories, last searches, access data about bookmarks to ease bookmarks management
customsyntax:=1; //syntax type for custom executable, creation
customsyntax1:=1; //syntax type for custom executable, extraction
ws:=1; //save window status: on
ws_status:=0; //ws maximized: off
ws_left:=DLEFT;
ws_top:=DTOP;
ws_width:=DWIDTH;
ws_height:=DHEIGTH;
ws_gw_left:=DGWLEFT;
ws_gw_top:=DGWTOP;
ws_gw_width:=DGWWIDTH;
ws_gw_height:=DGWHEIGTH;
fav7z:=1;//archive types to be added to favourite popup
favARC:=0;
favbz:=1;
favcustom:=0;
favgz:=1;
favpea:=0;
favquad:=0;
favsfx:=1;
favsfxarc:=0;
favsplit:=0;
favtar:=0;
favupx:=0;
favzip:=1;
favzpaq:=0;
favwim:=0;
favxz:=0;
favbrotli:=1;
favzstandard:=1;
maxbrotli:=0;
maxzstd:=0;
level_7z:=2;  //default Compression level for .7z: average
level_xz:=2;
method_7z:='LZMA2'; //default method for .7z: LZMA2
level_arc:=4; //default Compression level for ARC
solid_arc:=1; //default solid mode for ARC 0 non-solid 1 solid, auto-adjust
rr_arc:=1; //default recovery records for ARC: ON
algo_arc:=0; //default encryption algorithm for ARC: 0 AES 1 Serpent 2 Twofish 3 Blowfish (always max keysize)
algo_zipenc:=0; //default encryption algorithm for ZIP: 0 AES 1 ZipCrypto
level_bzip2:=2; //default Compression level for bzip2: average
level_gz:=2; //default Compression level for gzip: average
level_paq:=1; //default Compression level for zpaq: normal
threads_zpaq:=0;//default generic multithreading
paqver:=2;//default ZPAQ
level_quad:=0; //default Compression level for quad: normal (high off)
level_upx:=10; //default Compression level for upx: best
level_zip:=2; //default Compression level for zip: fast
method_zip:='Deflate'; //default method for .zip: deflate
sort7zbytype:=0; //default sort files by type for 7z solid compression: off
openw_all7z:=0; //default archive files open for writing for 7z binary: off
snoi7z:=0;
snon7z:=0;
tartype:=0;//0 gnu (default), 1 pax
tartime:=0;//0 windows 100 ns (default), 1 unix 1 sec, 2 linux 1 ns mapped to 3 due to 7z syntax
sni7z:=0; //manage NT security information default off
sns7z:=1; //manage NTFS alternate streams default on
snh7z:=0; //do not follow hard links
snl7z:=1; //do not follow sym links
snz7z:=1; //propagate zone.identifier default on
zstderr:=0;//by default do not extract zstd files if errors are detected
stl7z:=0;//set 7z / p7zip archive time from most recent file time
ssp7z:=0;
storecreated:=1;//store complete timestamps in archives
algodisp:=0; //default way to display checksum/hash
algoall:=13; //default SAH256; 0 common algorithms (defined below); 1 all algorithms
algoadler:=0;
algocrc16:=0;
algocrc24:=0;
algocrc32:=1;
algocrc64:=1;
algoed2k:=0;
algomd4:=0;
algomd5:=1;
algoripemd160:=1;
algosha1:=1;
algosha3_256:=1;
algosha256:=1;
algosha3_512:=0;
algosha512:=0;
algowhirl:=0;
erasepasses:=0;
filesizebase:=0;
archivenameenc:=1; //encoding for filenames in archives 0 replace extended chars with ?; 1 utf8
mcuzip:=1; //encode non ascii chars as utf8 in 7z77zip for ZIP filenames
syntaxlevel7z:=2; //for generic OS use the syntax level 7z 21.07
{$IFDEF MSWINDOWS}syntaxlevel7z:=0;{$ENDIF}
{$IFDEF LINUX}syntaxlevel7z:=0;{$ENDIF}
{$IFDEF DARWIN}syntaxlevel7z:=0;{$ENDIF}
setsyntaxstring7z;
ptsync:=2; //sync archive tree in navigation panel
abt:=1; //auto browse tar up to size
defaultactionst:=0;//by default open input file
mappeddrivesinfo:=0; //(Windows) 0 skip, 1 get volume information for mapped network units
lastoutpath:=''; //last output path, saved only if save history feature is on (default)
splittersize:=220; FormPeach.SplitterBottom.Cursor:=crSizeNS;
splitter2size:=180; FormPeach.SplitterSide.Cursor:=crSizeWE;
splitter3size:=180; FormPeach.SplitterOptions.Cursor:=crSizeWE;
splitsearchsize:=800; FormPeach.splitsearch.Cursor:=crSizeWE;
lastbar:=0;//status bar
esna:=0;
euns:=0;
euns1:=1;
checkver:='unchecked';//it make configuration fall back to defaults if conf is not read correctly, i.e. because of I/O errors or because it is found incompatible version's configuration (different number of lines)
browsertype:=0;
browsersize:=0;
listsortcol:=13;
az:=true;
col1size:=COL1D;
col2size:=COL2D;
col3size:=COL3D;
col4size:=COL4D;
col5size:=COL5D;
col6size:=COL6D;
col7size:=COL7D;
colmethodsize:=COL7D;
colcommentsize:=COL7D;
tonewfolder:=0;
immediate_execution:=0;
parallelarchive:=0;
defaultextractpath:='';
defaultarchivepath:='';
rowselect:=false;
smartsortenabled:=true;
dirbeforefiles:=1;
thighlight:=false;
ccreated:=false;
caccessed:=false;
cmethod:=true;
ccomment:=false;
ctype:=true;
csize:=true;
cpacked:=true;
cdate:=true;
catt:=true;
ccrc:=true;
cfree:=true;
cfs:=true;
toolsize:=0;
lsize:=0;
ptoolsize:=0;
ntoolstyle:=2;
swapbars:=false;
swaptab:=false;
showmenu:=true;
navbar:=0;
addressbar:=1;
ptabbar:=0;
psidebar:=0;
filterbrowser:=0;
showthumbnails:=0;
pimmersive:=0;
simplesearch:=1;
recsearch:=1;
usebreadcrumb:=1;
keeppw:=0;
browserch:=4;
zcopy:=0;
expandfs:=0;
expandroot:=0;
expandbook:=1;
expandhistory:=0;
expandmore:=0;
expandrun:=0;
expandapps:=0;
expandfun:=0;
lastextractionpath:='';
arcabspath:=0;
lasttoolbar:=1;
spchar:=1;
tpreset:=1;
simgfun:=1;
simgw:=1024;
simgh:=768;
simgper:=0;
simgasp:=1;
simgconv:=0;
simgj:=90;
simgt:=10;
simgb:=10;
simgl:=10;
simgr:=10;
simgpercent:=1;
deco_style:=0;
set_archivetree:=false;
showvolatile:=0;
autoopentar:=1;
tar_atomic:=1;
tar_atomic_convert:=0;
qdup:=1;
pshowh:=true;
noconfdel:=0;
swzipx:=0;
convint:=1;
tryopenwerrors:=1;
forcecanbechanged:=0;
forcetype:=0;
excludeef:=0;
tsutc:=0;
forcelayout:=0;
forcebrowse:=1;
forceconvert:=0;
nativedrag:=1;
autosync:=1;
sys7zlin:=0;
ignorepathdd:=0;
level_brotli:=3;
level_rar:=3;
level_zstd:=2;
renselonly:=1;//fixed to 1, 0 would to allow rename all displayed items regardless selection
renfilesonly:=0;
defaultspanning:=0;//single volume, do not split output
spansize:=100;
spanunit:=2;
autoclosepeazip:=0;
skipenctest:=0;
zpaqall:=0;
zpaqfull:=0;
{$IFDEF MSWINDOWS}zpaqabsolute:=0;{$ELSE}zpaqabsolute:=1;{$ENDIF}
zpaqforce:=0;
advopdictionary:=0;
advopword:=4;
advoppasses:=0;
advopblocksize:=0;
FormPeach.EditEncoding.Caption:='1252';
selnode:=0;
end;

procedure check_theme_failure;
begin
if graphicsfolderd<>'' then
   if graphicsfolderd[length(graphicsfolderd)]<>directoryseparator then graphicsfolderd:=graphicsfolderd+directoryseparator;
//if opacityd<0 then opacityd:=0;
if opacityd>100 then opacityd:=100;
if opacityd=0 then opacityd:=100;
if color1d='' then color1d:=ColorToString(PAPPCOL);
if (usealtcolord<0) or (usealtcolord>1) then usealtcolord:=0;
if (highlighttabsd<0) or (highlighttabsd>5) then highlighttabsd:=0;
if (accenttoolbard<0) or (accenttoolbard>8) then accenttoolbard:=0;
if (altaddressstyle<0) or (altaddressstyle>3) then altaddressstyle:=1;
if (decostyle<0) or (decostyle>2) then decostyle:=0;
if (solidaddressstyle<0) or (solidaddressstyle>8) then solidaddressstyle:=0;
if (toolcentered<0) or (toolcentered>1) then toolcentered:=0;
if (alttabstyle<0) or (alttabstyle>5) then alttabstyle:=2;
end;

procedure check_defaults_failure;
begin
//no control on lang_file name
if (autoclosegwrap>4) then autoclosegwrap:=2;
if (enc7zscc>2) then enc7zscc:=0;
if (browsersd>4) then browsersd:=0;
if (movetorelativepath>1) then movetorelativepath:=1;
if (autoopen>1) then autoopen:=0;
if (autotest>1) then autotest:=0;
if (convertpw<0) or (convertpw>1) then convertpw:=0;
if (convertverbose<0) or (convertverbose>1) then convertverbose:=0;
if (libre_directive<0) or (libre_directive>2) then libre_directive:=0;
if (mailkeep>1) then mailkeep:=0;
if (nameaspartent>1) then nameaspartent:=1;
if (df>18) then df:=18;
if (tsstyle<0) or (tsstyle>3) then tsstyle:=0;
if (pf>17) then pf:=15;
if (pcompr>3) then pcompr:=1;
if (pobj>13) then pobj:=11;
if (pvol>13) then pvol:=4;
if (pstream>9) then pstream:=0;
if (nrkdf>7) then nrkdf:=0;
if (trkdf>2) then trkdf:=0;
if (salgo>13) then salgo:=13;
if (zaout>2) then zaout:=2;
zaout1:=zaout;
if (clipmode>1) then clipmode:=0;
case browsersd of
   1: begin
      {$IFDEF MSWINDOWS}
      indir:=txt_mypc;//local_desktop;
      {$ELSE}
      indir:='/';
      {$ENDIF}
      end;
   2: begin
      {$IFDEF MSWINDOWS}
      indir:=local_desktop;
      {$ELSE}
      indir:=local_desktop;
      if indir<>'' then
         if indir[length(indir)]<>directoryseparator then indir:=indir+directoryseparator;
      {$ENDIF}
      end;
   3: begin
      {$IFDEF MSWINDOWS}
      indir:=home_path;
      {$ELSE}
      indir:=home_path;
      if indir<>'' then
         if indir[length(indir)]<>directoryseparator then indir:=indir+directoryseparator;
      {$ENDIF}
      end;
   4: if checkdirexists(browsersdir) then indir:=browsersdir;
   end;
if indir='' then
   begin
   {$IFDEF MSWINDOWS}
   indir:=txt_mypc;//local_desktop;
   {$ELSE}
   indir:='/';
   {$ENDIF}
   end;
if indir<>txt_mypc then
   if not(checkdirexists(indir)) then
      begin
      {$IFDEF MSWINDOWS}
      indir:=txt_mypc;
      {$ELSE}
      indir:='/';
      {$ENDIF}
      end;
if (showguihints>1) then showguihints:=1;
if (showsearchbar>1) then showsearchbar:=0;
if (showpwfield>1) then showpwfield:=0;
if (setencfn>1) then setencfn:=0;
if (intpw>1) then intpw:=0;
if (extopt7z>4) then extopt7z:=0;
if (extaction7z>4) then extaction7z:=0;
if (extactionarc>5) then extactionarc:=0;
if (extactionace>3) then extactionace:=0;
if (work_dir<0) or (work_dir>5) then {$IFDEF MSWINDOWS}work_dir:=1;{$ELSE}work_dir:=0;{$ENDIF}
if (extoptarc>2) then extoptarc:=0;
if (closeonsingleextract>1) then closeonsingleextract:=0;
if (whenspecialopen<0) or (whenspecialopen>2) then whenspecialopen:=2;
if (seccond<0) or (seccond>3) then seccond:=0;
if (howspecialopen<0) or (howspecialopen>1) then howspecialopen:=0;
if (length(FormPeach.editExtEvForWhat.Caption)<1) or (length(FormPeach.editExtEvForWhat.Caption)>1000) then FormPeach.editExtEvForWhat.Caption:=SPECEXTCONST;
if (length(FormPeach.editExtEvForSec.Caption)<1) or (length(FormPeach.editExtEvForSec.Caption)>1000) then FormPeach.editExtEvForSec.Caption:=SECEXTCONST;
if (length(FormPeach.Editcommonalgo.Caption)<1) or (length(FormPeach.Editcommonalgo.Caption)>1000) then FormPeach.Editcommonalgo.Caption:=PREFALGOCONST;
if (ignorepathextand>1) then ignorepathextand:=0;
if (ignorepathdisp>1) then ignorepathdisp:=0;
if (ignorepathsel>1) then ignorepathsel:=0;
if (enableextand>1) then enableextand:=0;
if (nativedrag<0) or (nativedrag>1) then nativedrag:=1;
if (autosync<0) or (autosync>1) then autosync:=1;
if nativedrag=1 then ignorepathdd:=0 else ignorepathdd:=1;
if (removeintdir>1) then removeintdir:=1;
if (prebrowse>5) then prebrowse:=3;  setmaxndirtree;
if (maxargsize<0) or (maxargsize>7) then maxargsize:=2;
if (virtualopt>5) then virtualopt:=0;
if (taskpriority>3) then taskpriority:=2;
if (dragtargetprotect>3) then dragtargetprotect:=1;
if (skipdel>1) then skipdel:=1;
if (kflimit<0) or (kflimit>1) then kflimit:=1;
UnitKF.dkflimit:=kflimit;
if (disableintscript>1) then disableintscript:=1;
if (nonverboselog>1) then nonverboselog:=1;
if (use7zunrar5>1) then use7zunrar5:=1;
if (pmode<0) or (pmode>1) then pmode:=0;
if (executesmallbk>1) then executesmallbk:=0;
if (logcommands>1) then logcommands:=0;
if (useextrac32>1) then useextrac32:=0;
if (enumd>1) then enumd:=1;
if (userar>1) then userar:=1;
if (userar5>1) then userar5:=1;
if (userardict<0) or (userardict>10) then userardict:=5;
if (userarblake2>1) then userarblake2:=0;
if (setrarmanual>1) then setrarmanual:=0;
if (userarsfx>1) then userarsfx:=0;
if (userarsolid>1) then userarsolid:=0;
if (userarrr>1) then userarrr:=0;
if (puserarrr<1) or (puserarrr>100) then puserarrr:=3;
if (userarrv>1) then userarrv:=0;
if (puserarrv<1) or (puserarrv>255) then puserarrv:=1;//byte for rar4, word for rar5, currently limited to byte
if (userarsaveopen>1) then userarsaveopen:=0;
if (userarsavesecurity>1) then userarsavesecurity:=0;
if (userarsavestreams>1) then userarsavestreams:=1;
if (userarlastmodtime>2) then userarlastmodtime:=0;
if (userarlock>1) then userarlock:=0;
if (addencext>1) then addencext:=0;
if (privacy_mode<0) or (privacy_mode>2) then privacy_mode:=0;
if (addtstext>1) then addtstext:=0;
if (scripttarpipe>1) then scripttarpipe:=0;
if (scriptuntarpipe>1) then scriptuntarpipe:=0;
if (repcustext>1) then repcustext:=0;
if (length(FormPeach.EditCustomExtension.Caption)>100) then FormPeach.EditCustomExtension.Caption:='';
if (defaulttabsmenu<1) or (defaulttabsmenu>4) then defaulttabsmenu:=2;
if (multi_option>9) then multi_option:=1;
if (memuse_option>9) then memuse_option:=0;
{$IFDEF MSWINDOWS}
if (favdelete<0) or (favdelete>3) then favdelete:=0;
{$ELSE}
{$IFDEF DARWIN}
if (favdelete<0) or (favdelete>3) then favdelete:=0;
{$ELSE}
if (favdelete<1) or (favdelete>3) then favdelete:=1;
{$ENDIF}
{$ENDIF}
if (savehistory>1) then savehistory:=1;
if (customsyntax>5) then customsyntax:=1;
if (customsyntax1>5) then customsyntax:=1;
if (ws>1) then ws:=1;
if (ws_status>1) then ws_status:=0; //default wsNormal
if (ws_left<0) or (ws_left>Screen.Width) then ws_left:=DLEFT; //don't allow to save the window position more than 1024*768 from lef-top corner of the screen
if (ws_top<0) or (ws_top>Screen.Height) then ws_top:=DTOP; //allow to use any window size, so don't check ws size
if (ws_gw_left<0) or (ws_gw_left>Screen.Width) then ws_gw_left:=DGWLEFT;
if (ws_gw_top<0) or (ws_gw_top>Screen.Height) then ws_gw_top:=DGWTOP;
if (fav7z>1) then fav7z:=1;
if (favARC>1) then favARC:=0;
if (favbz>1) then favbz:=1;
if (favcustom>1) then favcustom:=0;
if (favgz>1) then favgz:=1;
if (favpea>1) then favpea:=0;
if (favquad>1) then favquad:=0;
if (favsplit>1) then favsplit:=0;
if (favtar>1) then favtar:=0;
if (favsfx>1) then favsfx:=1;
if (favsfxarc>1) then favsfxarc:=0;
if (favupx>1) then favupx:=0;
if (favzip>1) then favzip:=1;
if (favwim>1) then favwim:=0;
if (favxz>1) then favxz:=0;
if (favbrotli>1) then favbrotli:=1;
if (favzstandard>1) then favzstandard:=1;
if (favzpaq>1) then favzpaq:=0;
if (level_7z>5) then level_7z:=3;
if (level_xz>4) then level_xz:=2;
if (method_7z<>'LZMA') and (method_7z<>'LZMA2') and (method_7z<>'PPMd') and (method_7z<>'BZip2') and
   (method_7z<>'Brotli') and (method_7z<>'FLZMA2') and (method_7z<>'Lizard_fastLZ4') and (method_7z<>'Lizard_LIZv1') and
   (method_7z<>'Lizard_fastLZ4+Huffman') and (method_7z<>'Lizard_LIZv1+Huffman') and (method_7z<>'LZ4') and (method_7z<>'LZ5') and
   (method_7z<>'Zstd') and (method_7z<>'Deflate') and (method_7z<>'Deflate64') then method_7z:='LZMA2';
if (level_arc>9) then level_arc:=4;
if (solid_arc>2) then solid_arc:=1;
if (rr_arc>1) then rr_arc:=1;
if (algo_arc>3) then algo_arc:=0;
if (algo_zipenc>1) then algo_arc:=1;
if (level_bzip2>4) then level_bzip2:=2;
if (level_gz>4) then level_gz:=2;
if (level_paq>3) then level_paq:=1;
if (threads_zpaq>9) then threads_zpaq:=0;
if (paqver>2) then paqver:=2;
if (level_quad>1) then level_quad:=0;
if (level_upx>10) then level_upx:=10;
if (level_zip>5) then level_zip:=3;
if (method_zip<>'Deflate') and (method_zip<>'Deflate64') and (method_zip<>'BZip2') and (method_zip<>'LZMA') and (method_zip<>'PPMd') and (method_zip<>'XZ')
   {$IFNDEF MSWINDOWS}
   and (method_zip<>'Zstd')
   {$ENDIF}
   then method_zip:='Deflate';
if (openw_all7z>1) then openw_all7z:=0;
if (snoi7z>1) then snoi7z:=0;
if (snon7z>1) then snon7z:=0;
if (tartype>1) then tartype:=0;
if (tartime>2) then tartime:=0;
if (sni7z>1) then sni7z:=0;
if (sns7z>1) then sns7z:=1;
if (snh7z>1) then snh7z:=0;
if (snl7z>1) then snl7z:=1;
if (snz7z>1) then snz7z:=1;
if (zstderr>1) then zstderr:=0;
if (stl7z>1) then stl7z:=0;
if (ssp7z>1) then ssp7z:=0;
if (storecreated>1) then storecreated:=1;
if (maxbrotli>1) then maxbrotli:=0;
if (maxzstd>1) then maxzstd:=0;
if (sort7zbytype>1) then sort7zbytype:=0;
if (algodisp>2) then algodisp:=0;
if (algoall>18) then algoall:=13;
if (algoadler>1) then algoadler:=0;
if (algocrc16>1) then algocrc16:=0;
if (algocrc24>1) then algocrc24:=0;
if (algocrc32>1) then algocrc32:=1;
if (algocrc64>1) then algocrc64:=0;
if (algoed2k>1) then algoed2k:=0;
if (algomd4>1) then algomd4:=0;
if (algomd5>1) then algomd5:=1;
if (algoripemd160>1) then algoripemd160:=1;
if (algosha1>1) then algosha1:=1;
if (algosha3_256>1) then algosha3_256:=1;
if (algosha256>1) then algosha256:=1;
if (algosha3_512>1) then algosha3_512:=0;
if (algosha512>1) then algosha512:=0;
if (algowhirl>1) then algowhirl:=0;
if (erasepasses>4) then erasepasses:=0;
if (filesizebase>2) then filesizebase:=0;
if (mbaction>4) then mbaction:=3;
if (renderinterpolation<0) or (renderinterpolation>2) then renderinterpolation:=0; setrenderstyle;
if (showvolatile<0) or (showvolatile>1) then showvolatile:=0;
if (archivenameenc>1) then archivenameenc:=1;
if (mcuzip>3) then mcuzip:=1;
if (syntaxlevel7z>4) then
   begin
   syntaxlevel7z:=2;
   {$IFDEF MSWINDOWS}syntaxlevel7z:=0;{$ENDIF}
   {$IFDEF LINUX}syntaxlevel7z:=0;{$ENDIF}
   {$IFDEF DARWIN}syntaxlevel7z:=0;{$ENDIF}
   end;
setsyntaxstring7z;
if (ptsync>2) then ptsync:=2;
if abt>3 then abt:=1;
if (defaultactionst>5) then defaultactionst:=0;
if (mappeddrivesinfo<0) or (mappeddrivesinfo>1) then mappeddrivesinfo:=0;
if (local_desktop='') or (not(checkdirexists(local_desktop))) then local_desktop:=desktop_path;
if local_desktop<>'' then
   if local_desktop[length(local_desktop)]<>directoryseparator then local_desktop:=local_desktop+directoryseparator;
if (splittersize<0) then splittersize:=220;
if (splitter2size<0) then splitter2size:=180;
if (splitter3size<1) then splitter3size:=180;
if (splitsearchsize<0) then splitsearchsize:=800;
if (lastbar<0) or (lastbar>5) then lastbar:=0;
if (esna<0) or (esna>1) then esna:=0;
if (euns<0) or (euns>1) then euns:=0;
if (euns1<0) or (euns1>1) then euns1:=1;
if (browsertype<0) or (browsertype>2) then browsertype:=0;
if (browsersize<0) or (browsersize>6) then browsersize:=0;
if (listsortcol<1) or (listsortcol>17) then listsortcol:=13;
if (col1size<26) or (col1size>2048) then col1size:=COL1D; //allows wider column for file names, as in some file managers
if (col2size<26) or (col2size>1024) then col2size:=COL2D;
if (col3size<26) or (col3size>1024) then col3size:=COL3D;
if (col4size<26) or (col4size>1024) then col4size:=COL4D;
if (col5size<26) or (col5size>1024) then col5size:=COL5D;
if (col6size<26) or (col6size>1024) then col6size:=COL6D;
if (col7size<26) or (col7size>1024) then col7size:=COL7D;
if (colmethodsize<26) or (colmethodsize>1024) then colmethodsize:=COL7D;
if (colcommentsize<26) or (colcommentsize>1024) then colcommentsize:=COL7D;
if (tonewfolder>1) then tonewfolder:=0;
if (immediate_execution>1) then immediate_execution:=0;
if (parallelarchive>1) then parallelarchive:=1;
if not(checkdirexists(defaultextractpath)) then defaultextractpath:='';
if not(checkdirexists(defaultarchivepath)) then defaultarchivepath:='';
if (zcopy>1) then zcopy:=0;
if (expandfs<0) or (expandfs>1) then expandfs:=0;
if (expandroot<0) or (expandroot>1) then expandroot:=0;
if (expandbook<0) or (expandbook>1) then expandbook:=1;
if (expandhistory<0) or (expandhistory>1) then expandhistory:=0;
if (expandmore<0) or (expandmore>1) then expandmore:=0;
if (expandrun<0) or (expandrun>1) then expandrun:=1;
if (expandapps<0) or (expandapps>1) then expandapps:=0;
if (expandfun<0) or (expandfun>1) then expandfun:=0;
if (toolsize<0) or (toolsize>7) then toolsize:=0; ptoolsize:=toolsize;
if (ntoolstyle<1) or (ntoolstyle>5) then ntoolstyle:=2;
if (lsize<0) or (lsize>1) then lsize:=0;
if (navbar<0) or (navbar>3) then navbar:=0;
if (addressbar<0) or (addressbar>1) then addressbar:=1;
if (ptabbar<0) or (ptabbar>1) then ptabbar:=0;
if (psidebar<0) or (psidebar>1) then psidebar:=0;
if (filterbrowser>1) then filterbrowser:=0;
if (showthumbnails<0) or (showthumbnails>1) then showthumbnails:=0;
if (pimmersive<0) or (pimmersive>1) then pimmersive:=0;
if (simplesearch<0) or (simplesearch>1) then simplesearch:=1;
if (recsearch<0) or (recsearch>1) then recsearch:=1;
if (renfilesonly<0) or (renfilesonly>1) then renfilesonly:=0;
if (browserch<1) or (browserch>17) then browserch:=4;
if (arcabspath<0) or (arcabspath>1) then arcabspath:=0;
if (keeppw<0) or (keeppw>1) then keeppw:=0;
if (usebreadcrumb<0) or (usebreadcrumb>4) then usebreadcrumb:=1;
if (lasttoolbar<1) or (lasttoolbar>3) then lasttoolbar:=1;
if (spchar>1) then spchar:=1;
if (tpreset<1) or (tpreset>3) then tpreset:=1;
if (simgfun<0) or (simgfun>3) then simgfun:=1;
if (simgw<1) or (simgw>40000) then simgw:=1024;
if (simgh<1) or (simgh>30000) then simgh:=768;
if (simgper<0) or (simgper>1) then simgper:=0;
if (simgasp<0) or (simgasp>1) then simgasp:=1;
if (simgconv<0) or (simgconv>7) then simgconv:=0;
if (simgj<0) or (simgj>100) then simgj:=90;
if (simgt<0) or (simgt>40000) then simgt:=10;
if (simgb<0) or (simgb>40000) then simgb:=10;
if (simgl<0) or (simgl>40000) then simgl:=10;
if (simgr<0) or (simgr>40000) then simgr:=10;
if (simgpercent<0) or (simgpercent>1) then simgpercent:=1;
if (deco_style<0) or (deco_style>2) then deco_style:=0;
if (doptadd<0) or (doptadd>1) then doptadd:=0;
if (doptext<0) or (doptext>1) then doptext:=0;
if (autoopentar<0) or (autoopentar>1) then autoopentar:=1;
if (tar_atomic<0) or (tar_atomic>1) then tar_atomic:=1;
if (tar_atomic_convert<0) or (tar_atomic_convert>1) then tar_atomic_convert:=0;
if (qdup<0) or (qdup>1) then qdup:=1;
if (noconfdel<0) or (noconfdel>1) then noconfdel:=0;
if swzipx>1 then swzipx:=0;
if convint>1 then convint:=1;
if (tryopenwerrors<0) or (tryopenwerrors>1) then tryopenwerrors:=1;
if (forcecanbechanged<0) or (forcecanbechanged>1) then forcecanbechanged:=0;
if (forcetype<0) or (forcetype>3) then forcetype:=0;
if (excludeef<0) or (excludeef>1) then excludeef:=0;
if (tsutc<0) or (tsutc>1) then tsutc:=0;
if (forcelayout<0) or (forcelayout>1) then forcelayout:=0;
if (forcebrowse<0) or (forcebrowse>1) then forcebrowse:=1;
if (forceconvert<0) or (forceconvert>1) then forceconvert:=0;
if (level_brotli>=7) then level_brotli:=3;
if (level_rar>5) then level_rar:=3;
if (level_zstd>=9) then level_zstd:=2;
if (defaultspanning<0) or (defaultspanning>10) then defaultspanning:=0;
if (spansize<1) or (spansize>1000000000) then spansize:=100;
if (spanunit<0) or (spanunit>10) then spanunit:=2;
if (autoclosepeazip>1) then autoclosepeazip:=0;
if (skipenctest>1) then skipenctest:=0;
if (zpaqall>1) then zpaqall:=0;
if (zpaqfull>1) then zpaqfull:=0;
if (zpaqabsolute>1) then zpaqabsolute:=1;
if (zpaqforce>1) then zpaqforce:=0;
if (sys7zlin<0) or (sys7zlin>2) then sys7zlin:=0;
end;

procedure settabsstyled;
begin
FormPeach.ShapeTitleAddb1.Height:=tablabelheight;
FormPeach.ShapeTitleAddb2.Height:=tablabelheight;
FormPeach.ShapeTitleAddb3.Height:=tablabelheight;
FormPeach.ShapeTitleAddb4.Height:=tablabelheight;
FormPeach.ShapeTitleExtractb1.Height:=tablabelheight;
FormPeach.ShapeTitleExtractb2.Height:=tablabelheight;
FormPeach.ShapeTitleExtractb3.Height:=tablabelheight;
FormPeach.ShapeTitleExtractb4.Height:=tablabelheight;
FormPeach.ShapeTitleAppsb1.Height:=tablabelheight;
FormPeach.ShapeTitleAppsb2.Height:=tablabelheight;
FormPM.ShapeTitlePMb1.Height:=tablabelheight;
FormPM.ShapeTitlePMb2.Height:=tablabelheight;
FormGwrap.ShapeTitleb1.Height:=tablabelheight;
FormGwrap.ShapeTitleb2.Height:=tablabelheight;
FormGwrap.ShapeTitleb3.Height:=tablabelheight;
FormGwrap.ShapeTitleb4.Height:=tablabelheight;
if (alttabstyle=1) or (alttabstyle=4) then
begin
FormPeach.Shapelinkextract1.visible:=true;
FormPeach.Shapelinkextract2.visible:=true;
FormPeach.Shapelinkextract3.visible:=true;
FormPeach.Shapelinkextract4.visible:=true;
FormPeach.Shapelinkadd1.visible:=true;
FormPeach.Shapelinkadd2.visible:=true;
FormPeach.Shapelinkadd3.visible:=true;
FormPeach.Shapelinkadd4.visible:=true;
FormPeach.Shapelinkapps1.visible:=true;
FormPeach.Shapelinkapps2.visible:=true;
FormPeach.LabelTitleExtract1.AnchorSideTop.Control:=FormPeach.PanelTitleExtract;
FormPeach.LabelTitleExtract2.AnchorSideTop.Control:=FormPeach.PanelTitleExtract;
FormPeach.LabelTitleExtract3.AnchorSideTop.Control:=FormPeach.PanelTitleExtract;
FormPeach.LabelTitleExtract4.AnchorSideTop.Control:=FormPeach.PanelTitleExtract;
FormPeach.ShapeTitleExtractb1.visible:=false;
FormPeach.ShapeTitleExtractb2.visible:=false;
FormPeach.ShapeTitleExtractb3.visible:=false;
FormPeach.ShapeTitleExtractb4.visible:=false;
FormPeach.LabelTitleAdd1.AnchorSideTop.Control:=FormPeach.PanelTitleAdd;
FormPeach.LabelTitleAdd2.AnchorSideTop.Control:=FormPeach.PanelTitleAdd;
FormPeach.LabelTitleAdd3.AnchorSideTop.Control:=FormPeach.PanelTitleAdd;
FormPeach.LabelTitleAdd4.AnchorSideTop.Control:=FormPeach.PanelTitleAdd;
FormPeach.ShapeTitleAddb1.visible:=false;
FormPeach.ShapeTitleAddb2.visible:=false;
FormPeach.ShapeTitleAddb3.visible:=false;
FormPeach.ShapeTitleAddb4.visible:=false;
FormPeach.LabelTitleApps1.AnchorSideTop.Control:=FormPeach.PanelTitleApps;
FormPeach.LabelTitleApps2.AnchorSideTop.Control:=FormPeach.PanelTitleApps;
FormPeach.ShapeTitleAppsb1.visible:=false;
FormPeach.ShapeTitleAppsb2.visible:=false;
FormPM.LabelTitlepm1.AnchorSideTop.Control:=FormPM.PanelTitlePM;
FormPM.LabelTitlepm2.AnchorSideTop.Control:=FormPM.PanelTitlePM;
FormPM.ShapeTitlePMb1.visible:=false;
FormPM.ShapeTitlePMb2.visible:=false;
FormPM.ShapelinkPM1.visible:=true;
FormPM.ShapelinkPM2.visible:=true;
FormGwrap.Shapelink1.visible:=true;
FormGwrap.Shapelink2.visible:=true;
FormGwrap.Shapelink3.visible:=true;
FormGwrap.Shapelink4.visible:=true;
FormGwrap.LabelTitle1.AnchorSideTop.Control:=FormGwrap.PanelTitle;
FormGwrap.LabelTitle2.AnchorSideTop.Control:=FormGwrap.PanelTitle;
FormGwrap.LabelTitle3.AnchorSideTop.Control:=FormGwrap.PanelTitle;
FormGwrap.LabelTitle4.AnchorSideTop.Control:=FormGwrap.PanelTitle;
FormGwrap.ShapeTitleb1.visible:=false;
FormGwrap.ShapeTitleb2.visible:=false;
FormGwrap.ShapeTitleb3.visible:=false;
FormGwrap.ShapeTitleb4.visible:=false;
end
else
begin
FormPeach.Shapelinkextract1.visible:=false;
FormPeach.Shapelinkextract2.visible:=false;
FormPeach.Shapelinkextract3.visible:=false;
FormPeach.Shapelinkextract4.visible:=false;
FormPeach.Shapelinkadd1.visible:=false;
FormPeach.Shapelinkadd2.visible:=false;
FormPeach.Shapelinkadd3.visible:=false;
FormPeach.Shapelinkadd4.visible:=false;
FormPeach.Shapelinkapps1.visible:=false;
FormPeach.Shapelinkapps2.visible:=false;
FormPeach.LabelTitleExtract1.AnchorSideTop.Control:=FormPeach.ShapeTitleExtractb1;
FormPeach.LabelTitleExtract2.AnchorSideTop.Control:=FormPeach.ShapeTitleExtractb1;
FormPeach.LabelTitleExtract3.AnchorSideTop.Control:=FormPeach.ShapeTitleExtractb1;
FormPeach.LabelTitleExtract4.AnchorSideTop.Control:=FormPeach.ShapeTitleExtractb1;
FormPeach.ShapeTitleExtractb1.visible:=true;
FormPeach.ShapeTitleExtractb2.visible:=true;
FormPeach.ShapeTitleExtractb3.visible:=true;
FormPeach.ShapeTitleExtractb4.visible:=true;
FormPeach.LabelTitleAdd1.AnchorSideTop.Control:=FormPeach.ShapeTitleAddb1;
FormPeach.LabelTitleAdd2.AnchorSideTop.Control:=FormPeach.ShapeTitleAddb1;
FormPeach.LabelTitleAdd3.AnchorSideTop.Control:=FormPeach.ShapeTitleAddb1;
FormPeach.LabelTitleAdd4.AnchorSideTop.Control:=FormPeach.ShapeTitleAddb1;
FormPeach.ShapeTitleAddb1.visible:=true;
FormPeach.ShapeTitleAddb2.visible:=true;
FormPeach.ShapeTitleAddb3.visible:=true;
FormPeach.ShapeTitleAddb4.visible:=true;
FormPeach.LabelTitleApps1.AnchorSideTop.Control:=FormPeach.ShapeTitleAppsb1;
FormPeach.LabelTitleApps2.AnchorSideTop.Control:=FormPeach.ShapeTitleAppsb1;
FormPeach.ShapeTitleAppsb1.visible:=true;
FormPeach.ShapeTitleAppsb2.visible:=true;
FormPM.LabelTitlepm1.AnchorSideTop.Control:=FormPM.ShapeTitlePMb1;
FormPM.LabelTitlepm2.AnchorSideTop.Control:=FormPM.ShapeTitlePMb1;
FormPM.ShapeTitlePMb1.visible:=true;
FormPM.ShapeTitlePMb2.visible:=true;
FormPM.ShapelinkPM1.visible:=false;
FormPM.ShapelinkPM2.visible:=false;
FormGwrap.Shapelink1.visible:=false;
FormGwrap.Shapelink2.visible:=false;
FormGwrap.Shapelink3.visible:=false;
FormGwrap.Shapelink4.visible:=false;
FormGwrap.LabelTitle1.AnchorSideTop.Control:=FormGwrap.ShapeTitleb1;
FormGwrap.LabelTitle2.AnchorSideTop.Control:=FormGwrap.ShapeTitleb1;
FormGwrap.LabelTitle3.AnchorSideTop.Control:=FormGwrap.ShapeTitleb1;
FormGwrap.LabelTitle4.AnchorSideTop.Control:=FormGwrap.ShapeTitleb1;
FormGwrap.ShapeTitleb1.visible:=true;
FormGwrap.ShapeTitleb2.visible:=true;
FormGwrap.ShapeTitleb3.visible:=true;
FormGwrap.ShapeTitleb4.visible:=true;
end;
UnitPM.alttabstyle:=alttabstyle;
UnitGwrap.alttabstyle:=alttabstyle;
UnitPM.highlighttabs:=highlighttabs;
UnitGwrap.highlighttabs:=highlighttabs;
end;

procedure set_items_height;
var
   refsize,addressbuttonsize,laddressbuttonsize,saddressbuttonsize:integer;
begin
with FormPeach do
begin
//get ratio between autosized button height at runtime and design time, to resize graphics and items with custom heights set at runtime
refsize:=ButtonRefSize.Height;
get_pformscaling(refsize,qscale,qscaleimages);
//qscale:=(qscale*pzoom) div 100;
qscaleimages:=(qscaleimages*pzoom) div 100;
//colums sizes (width)
COL1D:=(240*qscale) div 100;
COL2D:=(72*qscale) div 100;
COL3D:=(72*qscale) div 100;
COL4D:=(72*qscale) div 100;
COL5D:=(144*qscale) div 100;
COL6D:=(48*qscale) div 100;
COL7D:=(100*qscale) div 100;
//bars
pbarh:=(8*qscale) div 100;
pbarhsmall:=(4*qscale) div 100;
PanelProgress.Height:=pbarh;
barheight:=(40*qscale) div 100;
mbarheight:=(48*qscale) div 100;
mmbarheight:=(44*qscale) div 100;
PanelListBar.Height:=barheight;
ShapeListBar.Height:=((32+ensmall)*qscale) div 100;
BevelTitleOptions1.Height:=mbarheight;
BevelTitleOptions2.Height:=mbarheight;
BevelTitleOptions3.Height:=mbarheight;
BevelTitleOptions4.Height:=mbarheight;
BevelTitleOptions5.Height:=mbarheight;
BevelTitleOptions6.Height:=mbarheight;
BevelTitleOptions7.Height:=mbarheight;
BevelTitleOptions8.Height:=mbarheight;
PanelInfoGeneral.Height:=barheight;
Shapelinkextract1.Height:=pbarhsmall+2;
Shapelinkextract2.Height:=pbarhsmall+2;
Shapelinkextract3.Height:=pbarhsmall+2;
Shapelinkextract4.Height:=pbarhsmall+2;
Shapelinkadd1.Height:=pbarhsmall+2;
Shapelinkadd2.Height:=pbarhsmall+2;
Shapelinkadd3.Height:=pbarhsmall+2;
Shapelinkadd4.Height:=pbarhsmall+2;
Shapelinkapps1.Height:=pbarhsmall+2;
Shapelinkapps2.Height:=pbarhsmall+2;
FormPM.ShapelinkPM1.Height:=pbarhsmall+2;
FormPM.ShapelinkPM2.Height:=pbarhsmall+2;
FormGwrap.Shapelink1.Height:=pbarhsmall+2;
FormGwrap.Shapelink2.Height:=pbarhsmall+2;
FormGwrap.Shapelink3.Height:=pbarhsmall+2;
FormGwrap.Shapelink4.Height:=pbarhsmall+2;
//file manager bars items (width)
saddressbuttonsize:=((16+ensmall)*qscale) div 100;
addressbuttonsize:=((32+ensmall)*qscale) div 100;
laddressbuttonsize:=((48+ensmall)*qscale) div 100;
ctrlback.Width:=addressbuttonsize;
ctrlfwd.Width:=addressbuttonsize;
ctrlup.Width:=addressbuttonsize;
ctrlwarning.Width:=addressbuttonsize;
PanelListRoot.Width:=addressbuttonsize-2;
PanelAddress0.Width:=addressbuttonsize-2;
PanelAddress1.Width:=addressbuttonsize-2;
PanelAddress2.Width:=addressbuttonsize-2;
PanelAddress3.Width:=addressbuttonsize-2;
PanelAddress4.Width:=addressbuttonsize-2;
PanelAddress5.Width:=addressbuttonsize-2;
PanelAddress6.Width:=addressbuttonsize-2;
PanelAddress7.Width:=addressbuttonsize-2;
PanelAdArchive0.Width:=addressbuttonsize-2;
PanelAdArchive1.Width:=addressbuttonsize-2;
PanelAdArchive2.Width:=addressbuttonsize-2;
PanelAdArchive3.Width:=addressbuttonsize-2;
PanelAdArchive4.Width:=PanelListRoot.Width;
PanelListResetSearch.Width:=addressbuttonsize-2;
PanelListSearch.Width:=addressbuttonsize-2;
ImageFlat.Width:=addressbuttonsize;
ImageFlatadd.Width:=addressbuttonsize;
ImageFlatconvert.Width:=addressbuttonsize;
ImageFlatext.Width:=addressbuttonsize;
ImageFlatdup.Width:=addressbuttonsize;
ImageFlatfolder.Width:=addressbuttonsize;
ImageFlatren.Width:=addressbuttonsize;
ImageFlattransform.Width:=addressbuttonsize;
ImageFlatcrop.Width:=addressbuttonsize;
ImageFlattestmore.Width:=addressbuttonsize;
BtnPassword.Width:=laddressbuttonsize;
csbroot.Height:=addressbuttonsize;
csbhome.Height:=addressbuttonsize;
csbdesk.Height:=addressbuttonsize;
csbdownloads.Height:=addressbuttonsize;
csbdoc.Height:=addressbuttonsize;
csbmusic.Height:=addressbuttonsize;
csbpic.Height:=addressbuttonsize;
csbvid.Height:=addressbuttonsize;
//tabs
tabheight:=(36*qscale) div 100;
if (alttabstyle=2) or (alttabstyle=5) then tablabelheight:=30
else tablabelheight:=24;
tablabelheight:=(tablabelheight*qscale) div 100;
tabheightl:=(48*qscale) div 100;
PanelBottom.Height:=tabheight;
PanelTitleAdd.Height:=tabheight;
PanelTitleExtract.Height:=tabheight;
PanelTitleApps.Height:=tabheight;
PanelActAdd.Height:=tabheightl;
PanelActExt.Height:=tabheightl;
PanelActOptions.Height:=tabheightl;
FormPM.PanelTitlePM.Height:=tabheight;
settabsstyled;
//grid
case ensmall of
   0: rowsize:=((16+2+pspacing) * qscale) div 100;
   1: rowsize:=((18+2+pspacing) * qscale) div 100;
   2: rowsize:=((20+2+pspacing) * qscale) div 100;
   3: rowsize:=((24+2+pspacing) * qscale) div 100;
   4: rowsize:=((28+2+pspacing) * qscale) div 100;
   5: rowsize:=((32+2+pspacing) * qscale) div 100;
   end;
intcellhw:=((1+(pspacing div 2)) * qscale) div 100;
StringGridAdd.DefaultRowHeight:=rowsize;
StringGridExtract.DefaultRowHeight:=rowsize;
StringGridSessionHistory.DefaultRowHeight:=rowsize;
StringGridBookmarks.DefaultRowHeight:=rowsize;
StringGridClipboard.DefaultRowHeight:=rowsize;
StringGridCustEdit.DefaultRowHeight:=rowsize;
StringGridCustEditAdv.DefaultRowHeight:=rowsize;
StringGridRecent.DefaultRowHeight:=rowsize;
FormPM.StringGridPM.DefaultRowHeight:=rowsize;
FormPM.StringGridPM1.DefaultRowHeight:=rowsize;
//panels
BtnStyle.Width:=(48*qscale) div 100;//48
//graphics
case ensmall of
   0: icon_sizeplus:=((16+pspacing) * qscaleimages) div 100;
   1: icon_sizeplus:=((18+pspacing) * qscaleimages) div 100;
   2: icon_sizeplus:=((20+pspacing) * qscaleimages) div 100;
   3: icon_sizeplus:=((24+pspacing) * qscaleimages) div 100;
   4: icon_sizeplus:=((28+pspacing) * qscaleimages) div 100;
   5: icon_sizeplus:=((32+pspacing) * qscaleimages) div 100;
   end;
il16 := TimageList.Create(owner);
il16.Height:=icon_sizeplus;
il16.Width:=icon_sizeplus;
ListViewBrowser.SmallImages:=il16;
ilsmall := TimageList.Create(owner);
ilsmall.Height:=icon_sizeplus;
ilsmall.Width:=icon_sizeplus;
ShellTreeViewTmp.Images:=ilsmall;
ShellTreeViewNav.Images:=ilsmall;
TreeViewNav.Images:=ilsmall;
TabBar.Images:=ilsmall;
il96 := TimageList.Create(owner);
il96.Height:=((96+pspacing*2)*qscaleimages) div 100;
il96.Width:=((96+pspacing*2)*qscaleimages) div 100;
end;
end;

procedure setgridaltcolor;
begin
if usealtcolor=1 then
   begin
   FormPeach.StringGridAdd.AlternateColor:=StringToColor(collow);
   FormPeach.StringGridExtract.AlternateColor:=StringToColor(collow);
   FormPeach.StringGridCustEdit.AlternateColor:=StringToColor(collow);
   FormPeach.StringGridCustEditAdv.AlternateColor:=StringToColor(collow);
   FormPeach.StringGridRecent.AlternateColor:=StringToColor(collow);
   FormPeach.StringGridSessionHistory.AlternateColor:=StringToColor(collow);
   FormPeach.StringGridBookmarks.AlternateColor:=StringToColor(collow);
   FormPeach.StringGridClipboard.AlternateColor:=StringToColor(collow);
   end
else
   begin
   FormPeach.StringGridAdd.AlternateColor:=StringToColor(color2);
   FormPeach.StringGridExtract.AlternateColor:=StringToColor(color2);
   FormPeach.StringGridCustEdit.AlternateColor:=StringToColor(color2);
   FormPeach.StringGridCustEditAdv.AlternateColor:=StringToColor(color2);
   FormPeach.StringGridRecent.AlternateColor:=StringToColor(color2);
   FormPeach.StringGridSessionHistory.AlternateColor:=StringToColor(color2);
   FormPeach.StringGridBookmarks.AlternateColor:=StringToColor(color2);
   FormPeach.StringGridClipboard.AlternateColor:=StringToColor(color2);
   end;
end;

procedure settabaltcolor;
var tabcol,tabcol2:tcolor;
begin
case highlighttabs of
   0: begin
      tabcol:=StringToColor(color2);
      tabcol2:=StringToColor(color2);
      tabpencol:=StringToColor(color2);
      tabbrushcol:=StringToColor(colmid);
      tablowcol:=psilver;
      tabbrushhighcol:=StringToColor(colvlow);
      end;
   1: begin
      tabcol:=StringToColor(color2);
      tabcol2:=StringToColor(color2);
      tabpencol:=StringToColor(color2);
      tabbrushcol:=pvvlblue;
      tablowcol:=plblue;
      tabbrushhighcol:=pvvvlblue;
      end;
   2: begin
      tabcol:=StringToColor(collow);
      tabcol2:=StringToColor(colvlow);
      tabpencol:=StringToColor(collow);
      tabbrushcol:=StringToColor(colmid);
      tablowcol:=psilver;
      tabbrushhighcol:=StringToColor(colvlow);
      end;
   3: begin
      tabcol:=StringToColor(colmid);
      tabcol2:=StringToColor(collow);
      tabpencol:=StringToColor(colmid);
      tabbrushcol:=StringToColor(colhigh);
      tablowcol:=psilver;
      tabbrushhighcol:=StringToColor(collow);
      end;
   4: begin
      tabcol:=pvvvlblue;
      tabcol2:=pvvvvlblue;
      tabpencol:=pvvvlblue;
      tabbrushcol:=pvvlblue;
      tablowcol:=plblue;
      tabbrushhighcol:=pvvvvlblue;
      end;
   5: begin
      tabcol:=pvvlblue;
      tabcol2:=pvvvlblue;
      tabpencol:=pvvlblue;
      tabbrushcol:=pvlblue;
      tablowcol:=plblue;
      tabbrushhighcol:=pvvvlblue;
      end;
   end;
FormPeach.PanelTitleOptions.Color:=tabcol;
FormPeach.PanelTitleAdd.Color:=tabcol;
FormPeach.PanelTitleExtract.Color:=tabcol;
FormPeach.PanelTitleApps.Color:=tabcol;
FormGwrap.PanelTitle.Color:=tabcol;
UnitGwrap.tabpencol:=tabpencol;
UnitGwrap.tablowcol:=tablowcol;
UnitGwrap.tabbrushcol:=tabbrushcol;
UnitGwrap.tabbrushhighcol:=tabbrushhighcol;
FormPM.PanelTitlePM.Color:=tabcol;
UnitPM.tabpencol:=tabpencol;
UnitPM.tablowcol:=tablowcol;
UnitPM.tabbrushcol:=tabbrushcol;
UnitPM.tabbrushhighcol:=tabbrushhighcol;
end;

procedure setfontsbreadcrumb;
begin
if FormPeach.LabelClickAddress1.Caption<>' '+txt_mypc+' ' then FormPeach.LabelClickAddress1.Font.Style:=[];
FormPeach.LabelClickAddress2.Font.Style:=[];
FormPeach.LabelClickAddress3.Font.Style:=[];
FormPeach.LabelClickAddress4.Font.Style:=[];
FormPeach.LabelClickAddress5.Font.Style:=[];
FormPeach.LabelClickAddress6.Font.Style:=[];
FormPeach.LabelClickAddress7.Font.Style:=[];
FormPeach.LabelClickAddress8.Font.Style:=[];
FormPeach.LabelClickAdArchive1.Font.Style:=[];
FormPeach.LabelClickAdArchive2.Font.Style:=[];
FormPeach.LabelClickAdArchive3.Font.Style:=[];
FormPeach.LabelClickAdArchive4.Font.Style:=[];
if FormPeach.LabelClickAdArchive4.caption<>'' then
   begin
   FormPeach.LabelClickAdArchive4.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAdArchive4;
   end
else
if FormPeach.LabelClickAdArchive3.caption<>'' then
   begin
   FormPeach.LabelClickAdArchive3.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAdArchive3;
   end
else
if FormPeach.LabelClickAdArchive2.caption<>'' then
   begin
   FormPeach.LabelClickAdArchive2.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAdArchive2;
   end
else
if FormPeach.LabelClickAdArchive1.caption<>'' then
   begin
   FormPeach.LabelClickAdArchive1.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAdArchive1;
   end
else
if FormPeach.LabelClickAddress8.visible=true then
   begin
   FormPeach.LabelClickAddress8.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress8;
   end
else
if FormPeach.LabelClickAddress7.visible=true then
   begin
   FormPeach.LabelClickAddress7.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress7;
   end
else
if FormPeach.LabelClickAddress6.visible=true then
   begin
   FormPeach.LabelClickAddress6.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress6;
   end
else
if FormPeach.LabelClickAddress5.visible=true then
   begin
   FormPeach.LabelClickAddress5.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress5;
   end
else
if FormPeach.LabelClickAddress4.visible=true then
   begin
   FormPeach.LabelClickAddress4.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress4;
   end
else
if FormPeach.LabelClickAddress3.visible=true then
   begin
   FormPeach.LabelClickAddress3.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress3;
   end
else
if FormPeach.LabelClickAddress2.visible=true then
   begin
   FormPeach.LabelClickAddress2.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress2;
   end
else
if FormPeach.LabelClickAddress1.visible=true then
   begin
   FormPeach.LabelClickAddress1.Font.Style:=[fsBold];
   FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress1;
   end;
FormPeach.PanelClickAddress.Width:=FormPeach.PanelAdArchive4.left+FormPeach.PanelAdArchive4.Width;
FormPeach.ShapeListBar.Width:=FormPeach.PanelClickAddress.Width+FormPeach.PanelListRoot.Width+8;
end;

procedure apply_theme; //apply colors but not opacity
var sepcol:TColor;
begin
if color3='clForm' then color3:=ColorToString(PTACOL);
getpcolors(stringtocolor(color1),stringtocolor(color2),stringtocolor(color3),temperature,contrast);
img_utils.relwindowcolor:=stringtocolor(color2);
FormPeach.Color:=stringtocolor(color2);
//FormPeach.Font.Color:=stringtocolor(color5);
FormPeach.StringGridClipboard.Color:=FormPeach.Color;
FormAdvf.Color:=FormPeach.Color;
FormImgCrop.Color:=FormPeach.Color;
FormImgViewer.Color:=FormPeach.Color;
FormDlg.Color:=FormPeach.Color;
FormImgRes.Color:=FormPeach.Color;
FormInput.Color:=FormPeach.Color;
FormKF.Color:=FormPeach.Color;
FormPaths.Color:=FormPeach.Color;
FormPM.Color:=FormPeach.Color;
FormPW.Color:=FormPeach.Color;
FormSelect.Color:=FormPeach.Color;
FormWeb.Color:=FormPeach.Color;
FormComment.Color:=FormPeach.Color;
FormGwrap.Color:=FormPeach.Color;
FormPeach.PanelInfoGeneral.Color:=StringToColor(colbtnhigh);
FormPeach.SplitterSide.Color:=StringToColor(colmid);
FormPeach.shapecsb.Pen.Color:=StringToColor(colmid);
FormPeach.PanelClipboard.Color:=StringToColor(collow);
FormPeach.ShapeThemes.Brush.Color:=StringToColor(collow);
FormPeach.ShapeThemes1.Brush.Color:=StringToColor(collow);
FormPeach.ShapeThemes2.Brush.Color:=StringToColor(collow);
case accenttoolbar of
0: begin
   FormPeach.PanelBarOpen.Color:=FormPeach.Color;
   FormPeach.BtnStyle.Color:=FormPeach.PanelBarOpen.Color;
   FormPeach.Bevel13.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel16.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel12.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel14.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel18.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel11.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel15.Pen.Color:=StringToColor(colmid);
   end;
1: begin
   FormPeach.PanelBarOpen.Color:=StringToColor(colvlow);
   FormPeach.BtnStyle.Color:=FormPeach.PanelBarOpen.Color;
   FormPeach.Bevel13.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel16.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel12.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel14.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel18.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel11.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel15.Pen.Color:=StringToColor(colmid);
   end;
2: begin
   FormPeach.PanelBarOpen.Color:=StringToColor(collow);
   FormPeach.BtnStyle.Color:=FormPeach.PanelBarOpen.Color;
   FormPeach.Bevel13.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel16.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel12.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel14.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel18.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel11.Pen.Color:=StringToColor(colmid);
   FormPeach.Bevel15.Pen.Color:=StringToColor(colmid);
   end;
3: begin
   FormPeach.PanelBarOpen.Color:=StringToColor(colmid);
   FormPeach.BtnStyle.Color:=FormPeach.PanelBarOpen.Color;
   FormPeach.Bevel13.Pen.Color:=StringToColor(colhigh);
   FormPeach.Bevel16.Pen.Color:=StringToColor(colhigh);
   FormPeach.Bevel12.Pen.Color:=StringToColor(colhigh);
   FormPeach.Bevel14.Pen.Color:=StringToColor(colhigh);
   FormPeach.Bevel18.Pen.Color:=StringToColor(colhigh);
   FormPeach.Bevel11.Pen.Color:=StringToColor(colhigh);
   FormPeach.Bevel15.Pen.Color:=StringToColor(colhigh);
   end;
4: begin
   FormPeach.PanelBarOpen.Color:=StringToColor(colhigh);
   FormPeach.BtnStyle.Color:=FormPeach.PanelBarOpen.Color;
   FormPeach.Bevel13.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.Bevel16.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.Bevel12.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.Bevel14.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.Bevel18.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.Bevel11.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.Bevel15.Pen.Color:=StringToColor(colbtnhigh);
   end;
5: begin
   FormPeach.PanelBarOpen.Color:=pvvvvlblue;
   FormPeach.BtnStyle.Color:=pvvvvlblue;
   FormPeach.Bevel13.Pen.Color:=pvvlblue;
   FormPeach.Bevel16.Pen.Color:=pvvlblue;
   FormPeach.Bevel12.Pen.Color:=pvvlblue;
   FormPeach.Bevel14.Pen.Color:=pvvlblue;
   FormPeach.Bevel18.Pen.Color:=pvvlblue;
   FormPeach.Bevel11.Pen.Color:=pvvlblue;
   FormPeach.Bevel15.Pen.Color:=pvvlblue;
   end;
6: begin
   FormPeach.PanelBarOpen.Color:=pvvvlblue;
   FormPeach.BtnStyle.Color:=pvvvlblue;
   FormPeach.Bevel13.Pen.Color:=pvvlblue;
   FormPeach.Bevel16.Pen.Color:=pvvlblue;
   FormPeach.Bevel12.Pen.Color:=pvvlblue;
   FormPeach.Bevel14.Pen.Color:=pvvlblue;
   FormPeach.Bevel18.Pen.Color:=pvvlblue;
   FormPeach.Bevel11.Pen.Color:=pvvlblue;
   FormPeach.Bevel15.Pen.Color:=pvvlblue;
   end;
7: begin
   FormPeach.PanelBarOpen.Color:=pvvlblue;
   FormPeach.BtnStyle.Color:=pvvlblue;
   FormPeach.Bevel13.Pen.Color:=pvlblue;
   FormPeach.Bevel16.Pen.Color:=pvlblue;
   FormPeach.Bevel12.Pen.Color:=pvlblue;
   FormPeach.Bevel14.Pen.Color:=pvlblue;
   FormPeach.Bevel18.Pen.Color:=pvlblue;
   FormPeach.Bevel11.Pen.Color:=pvlblue;
   FormPeach.Bevel15.Pen.Color:=pvlblue;
   end;
8: begin
   FormPeach.PanelBarOpen.Color:=pvlblue;
   FormPeach.BtnStyle.Color:=pvlblue;
   FormPeach.Bevel13.Pen.Color:=plblue;
   FormPeach.Bevel16.Pen.Color:=plblue;
   FormPeach.Bevel12.Pen.Color:=plblue;
   FormPeach.Bevel14.Pen.Color:=plblue;
   FormPeach.Bevel18.Pen.Color:=plblue;
   FormPeach.Bevel11.Pen.Color:=plblue;
   FormPeach.Bevel15.Pen.Color:=plblue;
   end;
end;

case solidaddressstyle of
   0: FormPeach.PanelListbar.Color:=FormPeach.Color;
   1: FormPeach.PanelListbar.Color:=StringToColor(colvlow);
   2: FormPeach.PanelListbar.Color:=StringToColor(collow);
   3: FormPeach.PanelListbar.Color:=StringToColor(colmid);
   4: FormPeach.PanelListbar.Color:=StringToColor(colhigh);
   5: FormPeach.PanelListbar.Color:=pvvvvlblue;
   6: FormPeach.PanelListbar.Color:=pvvvlblue;
   7: FormPeach.PanelListbar.Color:=pvvlblue;
   8: FormPeach.PanelListbar.Color:=pvlblue;
   end;

FormPeach.PanelBottom.Color:=FormPeach.Color;
FormPeach.SplitterBottom.Color:=FormPeach.Color;

if decostyle>0 then FormPeach.Bevel21.Visible:=true else FormPeach.Bevel21.Visible:=false;

case altaddressstyle of
3: begin
   FormPeach.ShapeListBar.Brush.Color:=FormPeach.Color;
   FormPeach.PanelAddress.Brush.Color:=FormPeach.Color;
   if decostyle<2 then FormPeach.ShapeListBar.Pen.Color:=FormPeach.Color else FormPeach.ShapeListBar.Pen.Color:=pvvvlblue;
   if decostyle>0 then FormPeach.Bevel21.Pen.Color:=pvlblue;
   FormPeach.splitsearch.Color:=pvlblue;
   if (altbread>0) and (macbread=0) then abactivecol:=pvvlblue else abactivecol:=pvvvmlblue;
   abarchivecol:=pvvvvlblue;
   sepcol:=pvvlblue;
   colalertp:=colalertb;
   end;
0: begin
   FormPeach.ShapeListBar.Brush.Color:=FormPeach.Color;
   FormPeach.PanelAddress.Brush.Color:=FormPeach.Color;
   if decostyle<2 then FormPeach.ShapeListBar.Pen.Color:=FormPeach.Color else FormPeach.ShapeListBar.Pen.Color:=StringToColor(colmid);
   if decostyle>0 then FormPeach.Bevel21.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.splitsearch.Color:=StringToColor(colmid);
   if (altbread>0) and (macbread=0) then abactivecol:=StringToColor(colmid) else abactivecol:=StringToColor(collow);
   abarchivecol:=StringToColor(colvlow);
   sepcol:=StringToColor(colmid);
   colalertp:=colalert;
   end;
1: begin
   FormPeach.ShapeListBar.Brush.Color:=StringToColor(collow);
   FormPeach.PanelAddress.Brush.Color:=StringToColor(collow);
   if decostyle<2 then FormPeach.ShapeListBar.Pen.Color:=StringToColor(collow) else FormPeach.ShapeListBar.Pen.Color:=StringToColor(colmid);
   if decostyle>0 then FormPeach.Bevel21.Pen.Color:=StringToColor(colbtnhigh);
   FormPeach.splitsearch.Color:=StringToColor(colbtnhigh);
   if (altbread>0) and (macbread=0) then abactivecol:=StringToColor(colbtnhigh) else abactivecol:=StringToColor(colhigh);
   abarchivecol:=StringToColor(colmid);
   sepcol:=StringToColor(colbtnhigh);
   colalertp:=colalert;
   end;
2: begin
   FormPeach.ShapeListBar.Brush.Color:=pvvvlblue;
   FormPeach.PanelAddress.Brush.Color:=pvvvlblue;
   if decostyle<2 then FormPeach.ShapeListBar.Pen.Color:=pvvvlblue else FormPeach.ShapeListBar.Pen.Color:=pvvlblue;
   if decostyle>0 then FormPeach.Bevel21.Pen.Color:=pvlblue;
   FormPeach.splitsearch.Color:=pvlblue;
   if (altbread>0) and (macbread=0) then abactivecol:=pvmlblue else abactivecol:=pvvlblue;
   abarchivecol:=pvvmlblue;
   sepcol:=pvlblue;
   colalertp:=colalertb;
   end;
end;

if macbread=1 then
   begin
   FormPeach.ImageAddress.Visible:=false;
   FormPeach.PanelAddress0.Visible:=false;
   end;

case altbread of
   0:
   begin
   FormPeach.shapeaddress0.visible:=false;
   FormPeach.shapeaddress1.visible:=false;
   FormPeach.shapeaddress2.visible:=false;
   FormPeach.shapeaddress3.visible:=false;
   FormPeach.shapeaddress4.visible:=false;
   FormPeach.shapeaddress5.visible:=false;
   FormPeach.shapeaddress6.visible:=false;
   FormPeach.shapeaddress7.visible:=false;
   FormPeach.shapeaddress8.visible:=false;
   FormPeach.shapeaddress9.visible:=false;
   FormPeach.shapeaddress10.visible:=false;
   FormPeach.shapeaddress11.visible:=false;
   FormPeach.PanelAdArchive4.visible:=false;
   FormPeach.PanelLCA1.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCA2.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCA3.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCA4.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCA5.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCA6.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCA7.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCA8.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCAa1.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCAa2.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCAa3.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelLCAa4.Height:=FormPeach.PanelListRoot.Height;
   FormPeach.PanelClickAddress.AnchorSideRight.Control:=FormPeach.PanelListSearch;
   FormPeach.ShapeListBar.AnchorSideRight.Control:=FormPeach.PanelSPaddress;
   end;
   1:
   begin
   FormPeach.imageaddress0.visible:=false;
   FormPeach.imageaddress1.visible:=false;
   FormPeach.imageaddress2.visible:=false;
   FormPeach.imageaddress3.visible:=false;
   FormPeach.imageaddress4.visible:=false;
   FormPeach.imageaddress5.visible:=false;
   FormPeach.imageaddress6.visible:=false;
   FormPeach.imageaddress7.visible:=false;
   FormPeach.shapeaddress0.visible:=true;
   FormPeach.shapeaddress1.visible:=true;
   FormPeach.shapeaddress2.visible:=true;
   FormPeach.shapeaddress3.visible:=true;
   FormPeach.shapeaddress4.visible:=true;
   FormPeach.shapeaddress5.visible:=true;
   FormPeach.shapeaddress6.visible:=true;
   FormPeach.shapeaddress7.visible:=true;
   FormPeach.shapeaddress8.visible:=true;
   FormPeach.shapeaddress9.visible:=true;
   FormPeach.shapeaddress10.visible:=true;
   FormPeach.shapeaddress11.visible:=true;
   FormPeach.PanelAdArchive4.visible:=true;
   FormPeach.shapeaddress0.pen.color:=sepcol;
   FormPeach.shapeaddress1.pen.color:=sepcol;
   FormPeach.shapeaddress2.pen.color:=sepcol;
   FormPeach.shapeaddress3.pen.color:=sepcol;
   FormPeach.shapeaddress4.pen.color:=sepcol;
   FormPeach.shapeaddress5.pen.color:=sepcol;
   FormPeach.shapeaddress6.pen.color:=sepcol;
   FormPeach.shapeaddress7.pen.color:=sepcol;
   FormPeach.shapeaddress8.pen.color:=sepcol;
   FormPeach.shapeaddress9.pen.color:=sepcol;
   FormPeach.shapeaddress10.pen.color:=sepcol;
   FormPeach.shapeaddress11.pen.color:=sepcol;
   if macbread=0 then
      begin
      FormPeach.PanelLCA1.Height:=pbarhsmall;
      FormPeach.PanelLCA2.Height:=pbarhsmall;
      FormPeach.PanelLCA3.Height:=pbarhsmall;
      FormPeach.PanelLCA4.Height:=pbarhsmall;
      FormPeach.PanelLCA5.Height:=pbarhsmall;
      FormPeach.PanelLCA6.Height:=pbarhsmall;
      FormPeach.PanelLCA7.Height:=pbarhsmall;
      FormPeach.PanelLCA8.Height:=pbarhsmall;
      FormPeach.PanelLCAa1.Height:=pbarhsmall;
      FormPeach.PanelLCAa2.Height:=pbarhsmall;
      FormPeach.PanelLCAa3.Height:=pbarhsmall;
      FormPeach.PanelLCAa4.Height:=pbarhsmall;
      end;
   FormPeach.PanelClickAddress.AnchorSideRight.Control:=nil;
   FormPeach.ShapeListBar.AnchorSideRight.Control:=nil;
   setfontsbreadcrumb;
   update_addressbar(FormPeach.EditOpenInInteractive.Text);
   end;
   2:
   begin
   FormPeach.imageaddress0.visible:=false;
   FormPeach.imageaddress1.visible:=false;
   FormPeach.imageaddress2.visible:=false;
   FormPeach.imageaddress3.visible:=false;
   FormPeach.imageaddress4.visible:=false;
   FormPeach.imageaddress5.visible:=false;
   FormPeach.imageaddress6.visible:=false;
   FormPeach.imageaddress7.visible:=false;
   FormPeach.shapeaddress0.visible:=false;
   FormPeach.shapeaddress1.visible:=false;
   FormPeach.shapeaddress2.visible:=false;
   FormPeach.shapeaddress3.visible:=false;
   FormPeach.shapeaddress4.visible:=false;
   FormPeach.shapeaddress5.visible:=false;
   FormPeach.shapeaddress6.visible:=false;
   FormPeach.shapeaddress7.visible:=false;
   FormPeach.shapeaddress8.visible:=false;
   FormPeach.shapeaddress9.visible:=false;
   FormPeach.shapeaddress10.visible:=false;
   FormPeach.shapeaddress11.visible:=false;
   FormPeach.PanelAdArchive4.visible:=false;
   FormPeach.PanelLCA1.Height:=pbarhsmall;
   FormPeach.PanelLCA2.Height:=pbarhsmall;
   FormPeach.PanelLCA3.Height:=pbarhsmall;
   FormPeach.PanelLCA4.Height:=pbarhsmall;
   FormPeach.PanelLCA5.Height:=pbarhsmall;
   FormPeach.PanelLCA6.Height:=pbarhsmall;
   FormPeach.PanelLCA7.Height:=pbarhsmall;
   FormPeach.PanelLCA8.Height:=pbarhsmall;
   FormPeach.PanelLCAa1.Height:=pbarhsmall;
   FormPeach.PanelLCAa2.Height:=pbarhsmall;
   FormPeach.PanelLCAa3.Height:=pbarhsmall;
   FormPeach.PanelLCAa4.Height:=pbarhsmall;
   FormPeach.PanelAddress0.Caption:=DirectorySeparator;
   FormPeach.PanelAddress1.Caption:=DirectorySeparator;
   FormPeach.PanelAddress2.Caption:=DirectorySeparator;
   FormPeach.PanelAddress3.Caption:=DirectorySeparator;
   FormPeach.PanelAddress4.Caption:=DirectorySeparator;
   FormPeach.PanelAddress5.Caption:=DirectorySeparator;
   FormPeach.PanelAddress6.Caption:=DirectorySeparator;
   FormPeach.PanelAddress7.Caption:=DirectorySeparator;
   FormPeach.PanelAdArchive0.Caption:=DirectorySeparator;
   FormPeach.PanelAdArchive1.Caption:=DirectorySeparator;
   FormPeach.PanelAdArchive2.Caption:=DirectorySeparator;
   FormPeach.PanelAdArchive3.Caption:=DirectorySeparator;
   FormPeach.PanelClickAddress.AnchorSideRight.Control:=FormPeach.PanelListSearch;
   FormPeach.ShapeListBar.AnchorSideRight.Control:=FormPeach.PanelSPaddress;
   setfontsbreadcrumb;
   end;
end;
{FormPeach.ShapeListBar.Shape:=stRectangle; //the old squared look of the address bar
FormPeach.ShapeListBar.BorderSpacing.Right:=0;
FormPeach.PanelAddress.BorderSpacing.Left:=2;
FormPeach.PanelAddress.BorderSpacing.Right:=2;}
case alttabstyle of
   0,1,2:
   begin
   FormPeach.PanelTitleExtractTabAlign.AnchorSideLeft.Side:=asrleft;
   FormPeach.PanelTitleAddTabAlign.AnchorSideLeft.Side:=asrleft;
   FormPeach.PanelTitleAppsTabAlign.AnchorSideLeft.Side:=asrleft;
   FormPM.PanelTitlePMTabAlign.AnchorSideLeft.Side:=asrleft;
   FormGwrap.PanelTitlePLTabAlign.AnchorSideLeft.Side:=asrleft;
   end
   else
   begin
   FormPeach.PanelTitleExtractTabAlign.AnchorSideLeft.Side:=asrCenter;
   FormPeach.PanelTitleAddTabAlign.AnchorSideLeft.Side:=asrCenter;
   FormPeach.PanelTitleAppsTabAlign.AnchorSideLeft.Side:=asrCenter;
   FormPM.PanelTitlePMTabAlign.AnchorSideLeft.Side:=asrCenter;
   FormGwrap.PanelTitlePLTabAlign.AnchorSideLeft.Side:=asrCenter;
   end;
end;
case alttabstyle of
   0,3:
   begin
   FormPeach.ShapeOptions1.Shape:=stRoundRect;
   FormPeach.ShapeOptions2.Shape:=stRoundRect;
   FormPeach.ShapeOptions3.Shape:=stRoundRect;
   FormPeach.ShapeOptions4.Shape:=stRoundRect;
   FormPeach.ShapeOptions5.Shape:=stRoundRect;
   FormPeach.ShapeOptions6.Shape:=stRoundRect;
   FormPeach.ShapeOptions7.Shape:=stRoundRect;
   FormPeach.ShapeOptions8.Shape:=stRoundRect;
   FormPeach.ShapeOptions1.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions2.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions3.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions4.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions5.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions6.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions7.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions8.BorderSpacing.Around:=6;
   FormPeach.ShapeOptions1.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeOptions2.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeOptions3.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeOptions4.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeOptions5.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeOptions6.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeOptions7.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeOptions8.Anchors := [akLeft, akRight, akTop, akBottom];
   FormPeach.ShapeTitleAddb1.Shape:=stRoundRect;
   FormPeach.ShapeTitleAddb2.Shape:=stRoundRect;
   FormPeach.ShapeTitleAddb3.Shape:=stRoundRect;
   FormPeach.ShapeTitleAddb4.Shape:=stRoundRect;
   FormPeach.ShapeTitleExtractb1.Shape:=stRoundRect;
   FormPeach.ShapeTitleExtractb2.Shape:=stRoundRect;
   FormPeach.ShapeTitleExtractb3.Shape:=stRoundRect;
   FormPeach.ShapeTitleExtractb4.Shape:=stRoundRect;
   FormPeach.ShapeTitleAppsb1.Shape:=stRoundRect;
   FormPeach.ShapeTitleAppsb2.Shape:=stRoundRect;
   FormPM.ShapeTitlePMb1.Shape:=stRoundRect;
   FormPM.ShapeTitlePMb2.Shape:=stRoundRect;
   FormGwrap.ShapeTitleb1.Shape:=stRoundRect;
   FormGwrap.ShapeTitleb2.Shape:=stRoundRect;
   FormGwrap.ShapeTitleb3.Shape:=stRoundRect;
   FormGwrap.ShapeTitleb4.Shape:=stRoundRect;
   FormPeach.LabelTitleAdd1.BorderSpacing.Left:=6;
   FormPeach.LabelTitleAdd2.BorderSpacing.Left:=6;
   FormPeach.LabelTitleAdd3.BorderSpacing.Left:=6;
   FormPeach.LabelTitleAdd4.BorderSpacing.Left:=6;
   FormPeach.LabelTitleExtract1.BorderSpacing.Left:=6;
   FormPeach.LabelTitleExtract2.BorderSpacing.Left:=6;
   FormPeach.LabelTitleExtract3.BorderSpacing.Left:=6;
   FormPeach.LabelTitleExtract4.BorderSpacing.Left:=6;
   FormPeach.LabelTitleApps1.BorderSpacing.Left:=6;
   FormPeach.LabelTitleApps2.BorderSpacing.Left:=6;
   FormPM.LabelTitlePM1.BorderSpacing.Left:=6;
   FormPM.LabelTitlePM2.BorderSpacing.Left:=6;
   FormGwrap.LabelTitle1.BorderSpacing.Left:=6;
   FormGwrap.LabelTitle2.BorderSpacing.Left:=6;
   FormGwrap.LabelTitle3.BorderSpacing.Left:=6;
   FormGwrap.LabelTitle4.BorderSpacing.Left:=6;
   end
   else
   begin
   FormPeach.ShapeOptions1.Shape:=stRectangle;
   FormPeach.ShapeOptions2.Shape:=stRectangle;
   FormPeach.ShapeOptions3.Shape:=stRectangle;
   FormPeach.ShapeOptions4.Shape:=stRectangle;
   FormPeach.ShapeOptions5.Shape:=stRectangle;
   FormPeach.ShapeOptions6.Shape:=stRectangle;
   FormPeach.ShapeOptions7.Shape:=stRectangle;
   FormPeach.ShapeOptions8.Shape:=stRectangle;
   FormPeach.ShapeOptions1.BorderSpacing.Around:=0;
   FormPeach.ShapeOptions2.BorderSpacing.Around:=0;
   FormPeach.ShapeOptions3.BorderSpacing.Around:=0;
   FormPeach.ShapeOptions4.BorderSpacing.Around:=0;
   FormPeach.ShapeOptions5.BorderSpacing.Around:=0;
   FormPeach.ShapeOptions6.BorderSpacing.Around:=0;
   FormPeach.ShapeOptions7.BorderSpacing.Around:=0;
   FormPeach.ShapeOptions8.BorderSpacing.Around:=0;
   case alttabstyle of
      1,4:
      begin
      FormPeach.ShapeOptions1.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions2.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions3.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions4.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions5.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions6.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions7.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions8.Anchors := [akLeft, akTop, akBottom];
      FormPeach.ShapeOptions1.Width:=pbarhsmall+2;
      FormPeach.ShapeOptions2.Width:=pbarhsmall+2;
      FormPeach.ShapeOptions3.Width:=pbarhsmall+2;
      FormPeach.ShapeOptions4.Width:=pbarhsmall+2;
      FormPeach.ShapeOptions5.Width:=pbarhsmall+2;
      FormPeach.ShapeOptions6.Width:=pbarhsmall+2;
      FormPeach.ShapeOptions7.Width:=pbarhsmall+2;
      FormPeach.ShapeOptions8.Width:=pbarhsmall+2;
      end
      else
      begin
      FormPeach.ShapeOptions1.Anchors := [akLeft, akRight, akTop, akBottom];
      FormPeach.ShapeOptions2.Anchors := [akLeft, akRight, akTop, akBottom];
      FormPeach.ShapeOptions3.Anchors := [akLeft, akRight, akTop, akBottom];
      FormPeach.ShapeOptions4.Anchors := [akLeft, akRight, akTop, akBottom];
      FormPeach.ShapeOptions5.Anchors := [akLeft, akRight, akTop, akBottom];
      FormPeach.ShapeOptions6.Anchors := [akLeft, akRight, akTop, akBottom];
      FormPeach.ShapeOptions7.Anchors := [akLeft, akRight, akTop, akBottom];
      FormPeach.ShapeOptions8.Anchors := [akLeft, akRight, akTop, akBottom];
      end;
   end;

   FormPeach.ShapeTitleAddb1.Shape:=stRectangle;
   FormPeach.ShapeTitleAddb2.Shape:=stRectangle;
   FormPeach.ShapeTitleAddb3.Shape:=stRectangle;
   FormPeach.ShapeTitleAddb4.Shape:=stRectangle;
   FormPeach.ShapeTitleExtractb1.Shape:=stRectangle;
   FormPeach.ShapeTitleExtractb2.Shape:=stRectangle;
   FormPeach.ShapeTitleExtractb3.Shape:=stRectangle;
   FormPeach.ShapeTitleExtractb4.Shape:=stRectangle;
   FormPeach.ShapeTitleAppsb1.Shape:=stRectangle;
   FormPeach.ShapeTitleAppsb2.Shape:=stRectangle;
   FormPM.ShapeTitlePMb1.Shape:=stRectangle;
   FormPM.ShapeTitlePMb2.Shape:=stRectangle;
   FormGwrap.ShapeTitleb1.Shape:=stRectangle;
   FormGwrap.ShapeTitleb2.Shape:=stRectangle;
   FormGwrap.ShapeTitleb3.Shape:=stRectangle;
   FormGwrap.ShapeTitleb4.Shape:=stRectangle;
   FormPeach.LabelTitleAdd1.BorderSpacing.Left:=0;
   FormPeach.LabelTitleAdd2.BorderSpacing.Left:=0;
   FormPeach.LabelTitleAdd3.BorderSpacing.Left:=0;
   FormPeach.LabelTitleAdd4.BorderSpacing.Left:=0;
   FormPeach.LabelTitleExtract1.BorderSpacing.Left:=0;
   FormPeach.LabelTitleExtract2.BorderSpacing.Left:=0;
   FormPeach.LabelTitleExtract3.BorderSpacing.Left:=0;
   FormPeach.LabelTitleExtract4.BorderSpacing.Left:=0;
   FormPeach.LabelTitleApps1.BorderSpacing.Left:=0;
   FormPeach.LabelTitleApps2.BorderSpacing.Left:=0;
   FormPM.LabelTitlePM1.BorderSpacing.Left:=0;
   FormPM.LabelTitlePM2.BorderSpacing.Left:=0;
   FormGwrap.LabelTitle1.BorderSpacing.Left:=0;
   FormGwrap.LabelTitle2.BorderSpacing.Left:=0;
   FormGwrap.LabelTitle3.BorderSpacing.Left:=0;
   FormGwrap.LabelTitle4.BorderSpacing.Left:=0;
   end;
   end;
FormPeach.ShapeTitleAddb1.Brush.Color:=StringToColor(collow);
FormPeach.ShapeTitleAddb2.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleAddb3.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleAddb4.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleExtractb1.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleExtractb2.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleExtractb3.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleExtractb4.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleAppsb1.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPeach.ShapeTitleAppsb2.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPM.ShapeTitlePMb1.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;
FormPM.ShapeTitlePMb2.Brush.Color:=FormPeach.ShapeTitleAddb1.Brush.Color;

FormPeach.Shapelinkadd1.Brush.Color:=StringToColor(collow);
FormPeach.Shapelinkadd2.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkadd3.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkadd4.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkextract1.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkextract2.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkextract3.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkextract4.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkapps1.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPeach.Shapelinkapps2.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPM.ShapelinkPM1.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormPM.ShapelinkPM2.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormGwrap.Shapelink1.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormGwrap.Shapelink2.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormGwrap.Shapelink3.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
FormGwrap.Shapelink4.Brush.Color:=FormPeach.Shapelinkadd1.Brush.Color;
UnitPM.highlighttabs:=highlighttabs;
UnitGwrap.highlighttabs:=highlighttabs;
UnitPM.color2:=color2;
UnitGwrap.color2:=color2;

FormPeach.SplitterOptions.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt1.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt2.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt3.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt4.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt5.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt6.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt7.Color:=StringToColor(colmid);
FormPeach.BevelTitleOpt8.Color:=StringToColor(colmid);
if lastbar=0 then
   FormPeach.SplitterBottom.Color:=stringtocolor(color2)
else
   FormPeach.SplitterBottom.Color:=stringtocolor(colbtnhigh);
update_info;
//grayed fonts
FormPeach.labelStatus.Font.Color:=pGray;
FormPeach.LabelStatusdisplayed.Font.Color:=pGray;
FormPeach.LabelErrors.Font.Color:=pGray;
FormPeach.LabelStatusClip.Font.Color:=pGray;
FormPeach.LabelComment.Font.Color:=pGray;
FormPeach.LabelPanelHintAdd.Font.Color:=pGray;
FormPeach.LabelPanelHintExtract.Font.Color:=pGray;
//apply bold text to special links
FormPeach.LabelExtHere.Font.Style:=[fsBold];
FormPeach.LabelGoExtract.Font.Style:=[fsBold];
//accent app color fonts
FormPeach.Labelexthere.Font.Color:=ptextaccent;
FormPeach.LabelmoreoptExt.Font.Color:=ptextaccent;
FormPeach.LabelmoreoptAdd.Font.Color:=ptextaccent;
FormPeach.Lmanageschedule1.Font.Color:=ptextaccent;
FormPeach.Lmanageschedule2.Font.Color:=ptextaccent;
FormPeach.LmanagescheduleExt1.Font.Color:=ptextaccent;
FormPeach.LmanagescheduleExt2.Font.Color:=ptextaccent;
FormPeach.LabelGoExtract.Font.Color:=ptextaccent;
FormPeach.LabelResetApp1.Font.Color:=ptextaccent;
FormPeach.Labelsetwork.Font.Color:=ptextaccent;
FormPeach.LabelConfigurePw.Font.Color:=ptextaccent;
FormPeach.LabelConfigurearc.Font.Color:=ptextaccent;
FormPeach.LabelConfigureext.Font.Color:=ptextaccent;
FormPeach.lsetdefaultout_arc.Font.Color:=ptextaccent;
FormPeach.lsetdefaultout_ext.Font.Color:=ptextaccent;
FormPeach.LabelLang.Font.Color:=ptextaccent;
FormPeach.LabelResetOpenWith.Font.Color:=ptextaccent;
FormPeach.LabelResetHistory.Font.Color:=ptextaccent;
FormPeach.LabelResetBookmarks.Font.Color:=ptextaccent;
FormPeach.LabelWD.Font.Color:=ptextaccent;
FormPeach.LabelUpdates.Font.Color:=ptextaccent;
FormPeach.LabelDoc.Font.Color:=ptextaccent;
FormPeach.LabelResetPM.Font.Color:=ptextaccent;
FormPeach.LabelResetPtmp.Font.Color:=ptextaccent;
FormPeach.LabelConfigurePeaZip.Font.Color:=ptextaccent;
FormPeach.LabelOpenDesktop.Font.Color:=ptextaccent;
FormPeach.LabelCustomDesktop.Font.Color:=ptextaccent;
FormPeach.LabelOpenConf.Font.Color:=ptextaccent;
FormPeach.LabelAppPath.Font.Color:=ptextaccent;
FormPeach.LabelConfigureSendTo.Font.Color:=ptextaccent;
FormPeach.themesave_label.Font.Color:=ptextaccent;
FormPeach.LabelDefaultColor1.Font.Color:=ptextaccent;
FormPeach.LabelColPresets.Font.Color:=ptextaccent;
FormPeach.LabelDefaultOpacity.Font.Color:=ptextaccent;
FormPeach.LabelDefaultColor2.Font.Color:=ptextaccent;
FormPeach.Labellightpresets.Font.Color:=ptextaccent;
FormPeach.LabelDefaultColor3.Font.Color:=ptextaccent;
FormPeach.labeltheme.Font.Color:=ptextaccent;
FormPeach.LabelAddFiles.Font.Color:=ptextaccent;
FormPeach.LabelAddFolder.Font.Color:=ptextaccent;
FormPW.LabelPWkeyfile.Font.Color:=ptextaccent;
FormPM.LabelPMadd.Font.Color:=ptextaccent;
FormPM.LabelPMremove.Font.Color:=ptextaccent;
FormPM.LableListPath2.Font.Color:=ptextaccent;
FormComment.LabelResetComment.Font.Color:=ptextaccent;
FormComment.LabelLoadfromfile.Font.Color:=ptextaccent;
FormComment.LabelSavetofile.Font.Color:=ptextaccent;
FormInput.LabelLow.Font.Color:=ptextaccent;
FormInput.LabelUp.Font.Color:=ptextaccent;
FormInput.LabelTimestamp.Font.Color:=ptextaccent;
FormInput.LabelMoveTo.Font.Color:=ptextaccent;
FormInput.Labelappdirn.Font.Color:=ptextaccent;
FormInput.Labelprepdirn.Font.Color:=ptextaccent;
FormInput.Labelrenamereset.Font.Color:=ptextaccent;
FormSelect.Labelselectall.Font.Color:=ptextaccent;
FormSelect.Labelselectinvert.Font.Color:=ptextaccent;
FormSelect.Labelselectsort.Font.Color:=ptextaccent;
FormGwrap.LabelWarning.Font.Color:=ptextaccent;
FormGwrap.LabelSaveReport.Font.Color:=ptextaccent;
FormGwrap.LabelSavePJ.Font.Color:=ptextaccent;
FormGwrap.LabelDeleteInput.Font.Color:=ptextaccent;
FormGwrap.l2.Font.Color:=ptextaccent;
FormGwrap.l4.Font.Color:=ptextaccent;
//PanelDefaults Themes
FormPeach.ColorButton1.Color:=stringtocolor(color1);
FormPeach.ColorButton1.ButtonColor:=stringtocolor(color1);
FormPeach.ColorButton2.Color:=stringtocolor(color2);
FormPeach.ColorButton2.ButtonColor:=stringtocolor(color2);
FormPeach.tbtemperature.Position:=temperature;
FormPeach.tbcontrast.Position:=contrast-4;
FormPeach.ColorButton3.Color:=stringtocolor(color3);
FormPeach.ColorButton3.ButtonColor:=stringtocolor(color3);
case pspacing of
   12: FormPeach.cbspacing.ItemIndex :=1;
   18: FormPeach.cbspacing.ItemIndex :=2;
   24: FormPeach.cbspacing.ItemIndex :=3;
   else FormPeach.cbspacing.ItemIndex :=0;
   end;
case pzoom of
   50: FormPeach.cbzooming.ItemIndex :=0;
   67: FormPeach.cbzooming.ItemIndex :=1;
   80: FormPeach.cbzooming.ItemIndex :=2;
   87: FormPeach.cbzooming.ItemIndex :=3; //declared 90% effective 87% approx x0,875 16px=14px
   113: FormPeach.cbzooming.ItemIndex :=5; //declared 110% effective 113% approx x1,125 16px=18px
   125: FormPeach.cbzooming.ItemIndex :=6;
   150: FormPeach.cbzooming.ItemIndex :=7;
   175: FormPeach.cbzooming.ItemIndex :=8;
   200: FormPeach.cbzooming.ItemIndex :=9;
   else FormPeach.cbzooming.ItemIndex :=4;
   end;
FormPeach.mz50.Checked:=false;
FormPeach.mz67.Checked:=false;
FormPeach.mz80.Checked:=false;
FormPeach.mz87.Checked:=false;
FormPeach.mz100.Checked:=false;
FormPeach.mz115.Checked:=false;
FormPeach.mz125.Checked:=false;
FormPeach.mz150.Checked:=false;
FormPeach.mz200.Checked:=false;
case pzoom of
   50: FormPeach.mz50.Checked:=true;
   67: FormPeach.mz67.Checked:=true;
   80: FormPeach.mz80.Checked:=true;
   87: FormPeach.mz87.Checked:=true;
   113: FormPeach.mz115.Checked:=true;
   125: FormPeach.mz125.Checked:=true;
   150: FormPeach.mz150.Checked:=true;
   175: FormPeach.mz175.Checked:=true;
   200: FormPeach.mz200.Checked:=true;
   else FormPeach.mz100.Checked:=true;
   end;
FormPeach.cbSmallIconSize.ItemIndex:=ensmall;
if usealtcolor=1 then
   FormPeach.CheckBoxAltgridcol.State:=cbChecked
else
   FormPeach.CheckBoxAltgridcol.State:=cbUnchecked;
FormPeach.cbAltTabs.ItemIndex:=highlighttabs;
FormPeach.cbAccentToolBar.ItemIndex:=accenttoolbar;
case altaddressstyle of
   3: FormPeach.cbAltBar.ItemIndex:=1;
   0: FormPeach.cbAltBar.ItemIndex:=0;
   1: FormPeach.cbAltBar.ItemIndex:=2;
   2: FormPeach.cbAltBar.ItemIndex:=3;
end;
FormPeach.cbBoxAltBarStyle.ItemIndex:=decostyle;
FormPeach.cbSolidAddress.ItemIndex:=solidaddressstyle;
if toolcentered=1 then
   FormPeach.CheckBoxCenteredToolbar.State:=cbChecked
else
   FormPeach.CheckBoxCenteredToolbar.State:=cbUnchecked;
FormPeach.cbAltTabStyle.ItemIndex:=alttabstyle;
setgridaltcolor;
settabaltcolor;
load_icons;
if prevpanel='open' then
   begin
   clicklabel_options(FormPeach.LabelTitleOptions6,FormPeach.ShapeOptions6);
   end;
end;

procedure readconf_colors;
var
   s:ansistring;
begin
readln(conf,graphicsfolder);
if graphicsfolder[1]='r' then graphicsfolder:='themes'+directoryseparator+DEFAULT_THEME+directoryseparator;
readln(conf,opacity);//opactity
readln(conf,color1);//accent color
readln(conf,color2);//background color, used to derivate grayed colors
readln(conf,color3);//accent text color
if ((theme_name)=(DEFAULT_THEME)) then
   if evalcolor(clWindow)>128 then
      begin
      if color3=ColorToString(PAPPCOL) then color3:=ColorToString(PTACOL);
      end
   else
      begin
      if color3=ColorToString(PTACOL) then color3:=ColorToString(PAPPCOL);
      end;
readln(conf,color4);//unused
readln(conf,color5);//text, currently unsupported
readln(conf,s); decodebintheming(s,usealtcolor,highlighttabs,accenttoolbar,toolcentered,altaddressstyle,solidaddressstyle,alttabstyle,ensmall,contrast,decostyle);
readln(conf,s); pzoom:=strtoint(s); //icons zooming
readln(conf,s); pspacing:=strtoint(s); //icons spacing
readln(conf,s); temperature:=strtoint(s); //color temperature
set_items_height;
//apply_theme;
end;

procedure readconf_default_colors;
var
   s:ansistring;
begin
readln(conf,graphicsfolderd);
dodirseparators(graphicsfolderd);
readln(conf,opacityd);
readln(conf,color1d);
readln(conf,color2d);
readln(conf,color3d);
readln(conf,color4d);
readln(conf,color5d);
readln(conf,s); decodebintheming(s,usealtcolord,highlighttabsd,accenttoolbard,toolcenteredd,altaddressstyled,solidaddressstyled,alttabstyled,ensmalld,contrastd,decostyled);
readln(conf,s); pzoomd:=strtoint(s);
readln(conf,s); pspacingd:=strtoint(s);
readln(conf,s); temperatured:=strtoint(s);
end;

procedure tool24apply;
begin
if (toolsize=0) then
begin
//imgloaded:=false;
//load_icons;
toolsize:=0;
ptoolsize:=toolsize;
settoolbar;
end;
end;

procedure readconf_defaults;
var
   s:ansistring;
   srec,srecf:Thistarray;
begin
readln(conf,s);
readln(conf,s);
readln(conf,s); autoclosegwrap:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); autoopen:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); zaout:=strtoint(s); zaout1:=zaout;
readln(conf,s);
readln(conf,s);
readln(conf,s); clipmode:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); indir:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); df:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pf:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pcompr:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pobj:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pvol:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pstream:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); salgo:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); showguihints:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); showpwfield:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); try pmode:=strtoint(s); except pmode:=0; end; list_utils.pmode:=pmode;
readln(conf,s);
readln(conf,s);
readln(conf,s); browserstyle:=strtoint(s);
if (browserstyle=0) or (browserstyle=20) then browsingmode7z:=0 else browsingmode7z:=1;
on_mFlatArchivesClick(browserstyle);
readln(conf,s);
readln(conf,s);
readln(conf,s); ignorepathextand:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ignorepathdisp:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ignorepathsel:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); prebrowse:=strtoint(s); setmaxndirtree;
readln(conf,s);
readln(conf,s);
readln(conf,s); try renderinterpolation:=strtoint(s); except renderinterpolation:=0; end; setrenderstyle;
readln(conf,s);
readln(conf,s);
readln(conf,s); extopt7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); extoptarc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); savehistory:=strtoint(s);
readln(conf,srec[1]); //FormPeach.mRecent1.Caption:=s;
readln(conf,srec[2]); //FormPeach.mRecent2.Caption:=s;
readln(conf,srec[3]); //FormPeach.mRecent3.Caption:=s;
readln(conf,srec[4]); //FormPeach.mRecent4.Caption:=s;
readln(conf,srec[5]); //FormPeach.mRecent5.Caption:=s;
readln(conf,srec[6]); //FormPeach.mRecent6.Caption:=s;
readln(conf,srec[7]); //FormPeach.mRecent7.Caption:=s;
readln(conf,srec[8]); //FormPeach.mRecent8.Caption:=s;
checkrecent(srec);
FormPeach.pmhr1.Caption:=FormPeach.mRecent1.Caption;
FormPeach.pmhr2.Caption:=FormPeach.mRecent2.Caption;
FormPeach.pmhr3.Caption:=FormPeach.mRecent3.Caption;
FormPeach.pmhr4.Caption:=FormPeach.mRecent4.Caption;
FormPeach.pmhr5.Caption:=FormPeach.mRecent5.Caption;
FormPeach.pmhr6.Caption:=FormPeach.mRecent6.Caption;
FormPeach.pmhr7.Caption:=FormPeach.mRecent7.Caption;
FormPeach.pmhr8.Caption:=FormPeach.mRecent8.Caption;
readln(conf,s);
readln(conf,s);
readln(conf,s); FormPeach.pcustom1.Caption:=s;
readln(conf,s); FormPeach.pcustom2.Caption:=s;
readln(conf,s); FormPeach.pcustom3.Caption:=s;
readln(conf,s); FormPeach.pcustom4.Caption:=s;
readln(conf,s); FormPeach.pcustom5.Caption:=s;
readln(conf,s); FormPeach.pcustom6.Caption:=s;
readln(conf,s); FormPeach.pcustom7.Caption:=s;
readln(conf,s); FormPeach.pcustom8.Caption:=s;
readln(conf,s); FormPeach.EditOPCustom.Caption:=s;
readln(conf,s); customsyntax:=strtoint(s);
readln(conf,s); FormPeach.EditCustomParamExt.Caption:=s;
readln(conf,s); customsyntax1:=strtoint(s);
//load last window's status, if ws=0 those values are ignored
readln(conf,s);
readln(conf,s);
readln(conf,s); ws:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_status:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_left:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_top:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_width:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_height:=strtoint(s);
//load favourite archive types
readln(conf,s);
readln(conf,s);
readln(conf,s); fav7z:=strtoint(s);
readln(conf,s); favARC:=strtoint(s);
readln(conf,s); favbz:=strtoint(s);
readln(conf,s); favcustom:=strtoint(s);
readln(conf,s); favgz:=strtoint(s);
readln(conf,s); favpea:=strtoint(s);
readln(conf,s); favquad:=strtoint(s);
readln(conf,s); favsfx:=strtoint(s);
readln(conf,s); favsfxarc:=strtoint(s);
readln(conf,s); favsplit:=strtoint(s);
readln(conf,s); favtar:=strtoint(s);
readln(conf,s); favupx:=strtoint(s);
readln(conf,s); favzip:=strtoint(s);
readln(conf,s); favzpaq:=strtoint(s);
//load default Compression levels
readln(conf,s);
readln(conf,s);
readln(conf,s); level_7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); method_7z:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); level_arc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); solid_arc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); rr_arc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); algo_arc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_bzip2:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_gz:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_paq:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_quad:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_upx:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_zip:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); method_zip:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); openw_all7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); algodisp:=strtoint(s);
readln(conf,s); algoall:=strtoint(s); FormPeach.cbHash.ItemIndex:=algoall; on_cbcheckallClick;
readln(conf,s); algoadler:=strtoint(s);
readln(conf,s); algocrc16:=strtoint(s);
readln(conf,s); algocrc24:=strtoint(s);
readln(conf,s); algocrc32:=strtoint(s);
readln(conf,s); algocrc64:=strtoint(s);
readln(conf,s); algoed2k:=strtoint(s);
readln(conf,s); algomd4:=strtoint(s);
readln(conf,s); algomd5:=strtoint(s);
readln(conf,s); algoripemd160:=strtoint(s);
readln(conf,s); algosha1:=strtoint(s);
readln(conf,s); algosha3_256:=strtoint(s);
readln(conf,s); algosha256:=strtoint(s);
readln(conf,s); algosha3_512:=strtoint(s);
readln(conf,s); algosha512:=strtoint(s);
readln(conf,s); algowhirl:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); erasepasses:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s);
if (s<>'') then
   if checkdirexists(s) then
      local_desktop:=s;
if check7zvolume(indir)=true then indir:={$IFDEF MSWINDOWS}txt_mypc;{$ELSE}'/';{$ENDIF}
readln(conf,s);
readln(conf,s);
readln(conf,s); //suppressed
readln(conf,s);
readln(conf,s);
readln(conf,s); archivenameenc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); lastoutpath:=s;
if lastoutpath='' then lastoutpath:=local_desktop;
readln(conf,s);
readln(conf,s);
readln(conf,s); splittersize:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); lastbar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); esna:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); euns:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); checkver:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); browsertype:=strtoint(s);
readln(conf,s); listsortcol:=strtoint(s);
readln(conf,s); if strtoint(s)=1 then az:=true else az:=false;
if az=true then FormPeach.StringGridlist.SortOrder:=soAscending else FormPeach.StringGridlist.SortOrder:=soDescending;
readln(conf,s); col1size:=strtoint(s);
readln(conf,s); col2size:=strtoint(s);
readln(conf,s); col3size:=strtoint(s);
readln(conf,s); col4size:=strtoint(s);
readln(conf,s); col5size:=strtoint(s);
readln(conf,s); col6size:=strtoint(s);
readln(conf,s); col7size:=strtoint(s);
readln(conf,s); if strtoint(s)=1 then rowselect:=true else rowselect:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); tonewfolder:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); parallelarchive:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); defaultextractpath:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); defaultarchivepath:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); zcopy:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); if strtoint(s)=1 then showmenu:=true else showmenu:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); addressbar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); navbar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); if strtoint(s)=1 then ctype:=true else ctype:=false;
readln(conf,s); if strtoint(s)=1 then csize:=true else csize:=false;
readln(conf,s); if strtoint(s)=1 then cpacked:=true else cpacked:=false;
readln(conf,s); if strtoint(s)=1 then cdate:=true else cdate:=false;
readln(conf,s); if strtoint(s)=1 then catt:=true else catt:=false;
readln(conf,s); if strtoint(s)=1 then ccrc:=true else ccrc:=false;
readln(conf,s); if strtoint(s)=1 then cfree:=true else cfree:=false;
readln(conf,s); if strtoint(s)=1 then cfs:=true else cfs:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); toolsize:=strtoint(s); ptoolsize:=toolsize;
readln(conf,s); if strtoint(s)=1 then thighlight:=true else thighlight:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); splitter2size:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); expandfs:=strtoint(s);
readln(conf,s); expandroot:=strtoint(s);
readln(conf,s); expandbook:=strtoint(s);
readln(conf,s); expandhistory:=strtoint(s);
readln(conf,s); expandmore:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); enc7zscc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); extaction7z:=strtoint(s);
readln(conf,s); extactionarc:=strtoint(s);
readln(conf,s); extactionace:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); work_dir:=strtoint(s); if work_dir=5 then FormPeach.CheckBoxrelative.enabled:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); mcuzip:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); mappeddrivesinfo:=strtoint(s);  session_mappeddrivesinfo:=mappeddrivesinfo;
readln(conf,s);
readln(conf,s);
readln(conf,s); expandrun:=strtoint(s);
readln(conf,s); expandapps:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); lastextractionpath:=s;
if lastextractionpath<>'' then
   if not(checkdirexists(lastextractionpath)) then lastextractionpath:='';
readln(conf,s);
readln(conf,s);
readln(conf,s); setencfn:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); //suppressed
readln(conf,s);
readln(conf,s);
readln(conf,s); if(strtoint(s))=1 then swapbars:=true else swapbars:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); nameaspartent:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); favwim:=strtoint(s);
readln(conf,s); favxz:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_xz:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); browsersize:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); FormPeach.pmshist1.Caption:=s;
readln(conf,s); FormPeach.pmshist2.Caption:=s;
readln(conf,s); FormPeach.pmshist3.Caption:=s;
readln(conf,s); FormPeach.pmshist4.Caption:=s;
readln(conf,s); FormPeach.pmshist5.Caption:=s;
readln(conf,s); FormPeach.pmshist6.Caption:=s;
readln(conf,s); FormPeach.pmshist7.Caption:=s;
readln(conf,s); FormPeach.pmshist8.Caption:=s;
setsearchhistorymenu;
readln(conf,s);
readln(conf,s);
readln(conf,s); showthumbnails:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); browserch:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); simplesearch:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); arcabspath:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); recsearch:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); keeppw:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); usebreadcrumb:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pimmersive:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); lasttoolbar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); spchar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); paqver:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); tpreset:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); simgfun:=strtoint(s);
readln(conf,s); simgw:=strtoint(s);
readln(conf,s); simgh:=strtoint(s);
readln(conf,s); simgper:=strtoint(s);
readln(conf,s); simgasp:=strtoint(s);
readln(conf,s); simgconv:=strtoint(s);
readln(conf,s); simgj:=strtoint(s);
readln(conf,s); simgt:=strtoint(s);
readln(conf,s); simgb:=strtoint(s);
readln(conf,s); simgl:=strtoint(s);
readln(conf,s); simgr:=strtoint(s);
readln(conf,s); simgpercent:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); mailkeep:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); splitter3size:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); deco_style:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,srecf[1]);
readln(conf,srecf[2]);
readln(conf,srecf[3]);
readln(conf,srecf[4]);
readln(conf,srecf[5]);
readln(conf,srecf[6]);
readln(conf,srecf[7]);
readln(conf,srecf[8]);
checkrecentf(srecf);
FormPeach.pmhr1f.Caption:=FormPeach.mRecent1f.Caption;
FormPeach.pmhr2f.Caption:=FormPeach.mRecent2f.Caption;
FormPeach.pmhr3f.Caption:=FormPeach.mRecent3f.Caption;
FormPeach.pmhr4f.Caption:=FormPeach.mRecent4f.Caption;
FormPeach.pmhr5f.Caption:=FormPeach.mRecent5f.Caption;
FormPeach.pmhr6f.Caption:=FormPeach.mRecent6f.Caption;
FormPeach.pmhr7f.Caption:=FormPeach.mRecent7f.Caption;
FormPeach.pmhr8f.Caption:=FormPeach.mRecent8f.Caption;
setrecenticons_extract_archive;
populaterecentpanel;
readln(conf,s);
readln(conf,s);
readln(conf,s); enumd:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); defaulttabsmenu:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); multi_option:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); favdelete:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); expandfun:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); removeintdir:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); convertverbose:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); libre_directive:=strtoint(s);
if HLIBRE_DIR>0 then //set at compile time to hardcode use of libre software
   begin
   libre_directive:=HLIBRE_DIR;
   FormPeach.ComboBoxLibre.ItemIndex:=libre_directive;
   FormPeach.ComboBoxLibre.enabled:=false;
   end;
readln(conf,s);
readln(conf,s);
readln(conf,s); nonverboselog:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); tsstyle:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); use7zunrar5:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); sort7zbytype:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); browsersd:=strtoint(s);
readln(conf,s); browsersdir:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); doptadd:=strtoint(s);
readln(conf,s); doptext:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); addtstext:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); addencext:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ptabbar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); privacy_mode:=strtoint(s);
if HPRIVACY_MODE>0 then
   begin
   privacy_mode:=HPRIVACY_MODE;
   FormPeach.ComboBoxPrivacy.ItemIndex:=privacy_mode;
   FormPeach.ComboBoxPrivacy.enabled:=false;
   end;
readln(conf,s);
readln(conf,s);
readln(conf,s); sni7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); sns7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); convertpw:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); showvolatile:=strtoint(s); setshowvolatile;
readln(conf,s);
readln(conf,s);
readln(conf,s); tryopenwerrors:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); forcecanbechanged:=strtoint(s);
if forcecanbechanged=1 then FormPeach.cbforcetype.enabled:=true else FormPeach.cbforcetype.enabled:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); euns1:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); custom_work_path:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); algo_zipenc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); nativedrag:=strtoint(s);
if (nativedrag<0) or (nativedrag>1) then nativedrag:=1;
if nativedrag=1 then ignorepathdd:=0 else ignorepathdd:=1;
if nativedrag=1 then FormPeach.Timerdrag.Enabled:=true else FormPeach.Timerdrag.Enabled:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_gw_left:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_gw_top:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_gw_width:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ws_gw_height:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); autosync:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); autoopentar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_brotli:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_zstd:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); favbrotli:=strtoint(s);
readln(conf,s); favzstandard:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); renfilesonly:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); defaultspanning:=strtoint(s);
readln(conf,s); spansize:=strtoint(s);
readln(conf,s); spanunit:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); advopdictionary:=strtoint(s);
readln(conf,s); advopword:=strtoint(s);
readln(conf,s); advoppasses:=strtoint(s);
readln(conf,s); advopblocksize:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); autoclosepeazip:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); zpaqall:=strtoint(s);
readln(conf,s); zpaqabsolute:=strtoint(s);
readln(conf,s); zpaqforce:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); FormPeach.Edit7zOpt.Caption:=s;
readln(conf,s); FormPeach.EditOParc.Caption:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); stl7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); maxbrotli:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); maxzstd:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); noconfdel:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); level_rar:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userar5:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userardict:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarblake2:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarsfx:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarsolid:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarrr:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); puserarrr:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarsaveopen:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarsavesecurity:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarsavestreams:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarlastmodtime:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); userarlock:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); swzipx:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); closeonsingleextract:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); dragtargetprotect:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); whenspecialopen:=strtoint(s);
readln(conf,s); howspecialopen:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); FormPeach.EditEncoding.Caption:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); ptsync:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); sys7zlin:=strtoint(s);
if HSYSBIN>0 then
   begin
   sys7zlin:=HSYSBIN;
   FormPeach.LabelSysBin.enabled:=false;
   FormPeach.ComboBoxSysbin.enabled:=false;
   FormPeach.ComboBoxSysbin.ItemIndex:=HSYSBIN;
   end;
readln(conf,s);
readln(conf,s);
readln(conf,s); movetorelativepath:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); taskpriority:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); FormPeach.editExtEvForWhat.Caption:=s; setspecialextensions;
readln(conf,s);
readln(conf,s);
readln(conf,s); repcustext:=strtoint(s);
readln(conf,s); FormPeach.EditCustomExtension.Caption:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); forcebrowse:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); forceconvert:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); intpw:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); defaultactionst:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); enableextand:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); useextrac32:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); storecreated:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); skipenctest:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); if strtoint(s)=1 then ccreated:=true else ccreated:=false;
readln(conf,s); if strtoint(s)=1 then caccessed:=true else caccessed:=false;
readln(conf,s); if strtoint(s)=1 then cmethod:=true else cmethod:=false;
readln(conf,s); colmethodsize:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); FormPeach.Editcommonalgo.Caption:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); filesizebase:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); maxargsize:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); skipdel:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); disableintscript:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); filterbrowser:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); forcelayout:=strtoint(s);
readln(conf,s); FormPeach.LabelForceLayout.Caption:=s;
if (forcelayout=1) and (FormPeach.LabelForceLayout.Caption<>'') then
   if fileexists(FormPeach.LabelForceLayout.Caption) then
      loadlist(nil,FormPeach.LabelForceLayout.Caption);
readln(conf,s);
readln(conf,s);
readln(conf,s); immediate_execution:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s);
try
FormPeach.ComboBox7zFun.ItemIndex:=strtoint(s);
except
FormPeach.ComboBox7zFun.ItemIndex:=0;
end;
defaultarchiveaction:=FormPeach.ComboBox7zFun.ItemIndex;
readln(conf,s);
readln(conf,s);
readln(conf,s); showsearchbar:=strtoint(s);
readln(conf,s); splitsearchsize:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); snz7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); tartype:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); tartime:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); snoi7z:=strtoint(s);
readln(conf,s); snon7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); autotest:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); lsize:=strtoint(s); tool24apply;
readln(conf,s);
readln(conf,s);
readln(conf,s); ssp7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); snh7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); snl7z:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); memuse_option:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); tar_atomic:=strtoint(s);
readln(conf,s); tar_atomic_convert:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); zpaqfull:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); dirbeforefiles:=strtoint(s); set_dirbeforefiles(dirbeforefiles);
readln(conf,s);
readln(conf,s);
readln(conf,s); syntaxlevel7z:=strtoint(s); setsyntaxstring7z;
readln(conf,s);
readln(conf,s);
readln(conf,s); convint:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); excludeef:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); //suppressed
readln(conf,s);
readln(conf,s);
readln(conf,s); qdup:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); FormPeach.Editalias.Caption:=s; if FormPeach.Editalias.Caption='' then FormPeach.Editalias.Caption:='7z';
readln(conf,s);
readln(conf,s);
readln(conf,s); if(strtoint(s))=1 then swaptab:=true else swaptab:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); forcetype:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); ntoolstyle:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); if strtoint(s)=1 then ccomment:=true else ccomment:=false;
readln(conf,s); colcommentsize:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); setrarmanual:=strtoint(s); testwinrar;
readln(conf,s);
readln(conf,s);
readln(conf,s); restoretabbar:=strtoint(s); if restoretabbar=1 then FormPeach.pmtabsave.Checked:=true else FormPeach.pmtabsave.Checked:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); psidebar:=strtoint(s); setzencoding;
readln(conf,s);
readln(conf,s);
readln(conf,s); scripttarpipe:=strtoint(s);  setscripttarpipe;
readln(conf,s); scriptuntarpipe:=strtoint(s); setscriptuntarpipe;
readln(conf,s);
readln(conf,s);
readln(conf,s); if strtoint(s)=1 then smartsortenabled:=true else smartsortenabled:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); tsutc:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); nrkdf:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); trkdf:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); abt:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); seccond:=strtoint(s);
readln(conf,s); FormPeach.editExtEvForSec.Caption:=s; setsecurityextensions;
readln(conf,s);
readln(conf,s);
readln(conf,s); if(strtoint(s))=1 then pshowh:=true else pshowh:=false; list_utils.showhidden:=pshowh;
readln(conf,s);
readln(conf,s);
readln(conf,s); virtualopt:=strtoint(s);
case virtualopt of
   0: begin
      defaultvirtualopt;
      end;
   1: begin allowvirtual:=1; sizevirtual:=0; end;
   2: begin allowvirtual:=1; sizevirtual:=4; end;
   3: begin allowvirtual:=1; sizevirtual:=8; end;
   4: begin allowvirtual:=1; sizevirtual:=16; end;
   5: begin allowvirtual:=0; sizevirtual:=0; end;
   else defaultvirtualopt; //should be checked before
   end;
readln(conf,s);
readln(conf,s);
readln(conf,s); threads_zpaq:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); zstderr:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); if strtoint(s)=1 then gwcompact:=true else gwcompact:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); userarrv:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); puserarrv:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); executesmallbk:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); logcommands:=strtoint(s); setlogcommands;
readln(conf,s);
readln(conf,s);
readln(conf,s); kflimit:=strtoint(s); UnitKF.dkflimit:=kflimit;
readln(conf,s);
readln(conf,s);
readln(conf,s); mbaction:=strtoint(s);
end;

procedure writeconf_colors;
begin
writeln(conf,graphicsfolder);
writeln(conf,opacity);
writeln(conf,color1);
writeln(conf,color2);
writeln(conf,color3);
writeln(conf,color4);
writeln(conf,color5);
writeln(conf,inttostr(usealtcolor)+inttostr(highlighttabs)+inttostr(accenttoolbar)+inttostr(toolcentered)+inttostr(altaddressstyle)+inttostr(solidaddressstyle)+inttostr(alttabstyle)+inttostr(ensmall)+inttostr(contrast)+inttostr(decostyle));
writeln(conf,inttostr(pzoom));
writeln(conf,inttostr(pspacing));
writeln(conf,inttostr(temperature));
end;

procedure writeconf_default_colors;
begin
writeln(conf,graphicsfolderd);
writeln(conf,opacityd);
writeln(conf,color1d);
writeln(conf,color2d);
writeln(conf,color3d);
writeln(conf,color4d);
writeln(conf,color5d);
writeln(conf,inttostr(usealtcolord)+inttostr(highlighttabsd)+inttostr(accenttoolbard)+inttostr(toolcenteredd)+inttostr(altaddressstyled)+inttostr(solidaddressstyled)+inttostr(alttabstyled)+inttostr(ensmalld)+inttostr(contrastd)+inttostr(decostyled));
writeln(conf,inttostr(pzoomd));
writeln(conf,inttostr(pspacingd));
writeln(conf,inttostr(temperatured));
end;

procedure writeconf_defaults;
begin
writeln(conf,'[language]');
writeln(conf,lang_file);
writeln(conf,'');
writeln(conf,'[reporting: 0 always keep open task window for inspection of logs, 1 keep open only for errors, list, test operations (default), 2 keep open only for errors, list, 3 never keep open for inspection]');
writeln(conf,inttostr(autoclosegwrap));
writeln(conf,'');
writeln(conf,'[open output directory when task ends]');
writeln(conf,inttostr(autoopen));
writeln(conf,'');
writeln(conf,'[console binaries interface]');
writeln(conf,inttostr(zaout));
writeln(conf,'');
writeln(conf,'[Clipboard mode]');
writeln(conf,inttostr(clipmode));
writeln(conf,'');
writeln(conf,'[Initial dir for file/archive browser]');
writeln(conf,indir);
writeln(conf,'');
writeln(conf,'[default archiving format]');
writeln(conf,inttostr(df));
writeln(conf,'');
writeln(conf,'[last used archiving format]');
writeln(conf,inttostr(pf));
writeln(conf,'');
writeln(conf,'[default PEA compression level]');
writeln(conf,inttostr(pcompr));
writeln(conf,'');
writeln(conf,'[default PEA object level control algorithm]');
writeln(conf,inttostr(pobj));
writeln(conf,'');
writeln(conf,'[default PEA volume level control algorithm]');
writeln(conf,inttostr(pvol));
writeln(conf,'');
writeln(conf,'[default PEA stream level control algorithm]');
writeln(conf,inttostr(pstream));
writeln(conf,'');
writeln(conf,'[default integrity check algorithm for file split]');
writeln(conf,inttostr(salgo));
writeln(conf,'');
writeln(conf,'[show hints popup]');
writeln(conf,inttostr(showguihints));
writeln(conf,'');
writeln(conf,'[show password field in clear]');
writeln(conf,inttostr(showpwfield));
writeln(conf,'');
writeln(conf,'[process mode: 0 pass command line (default) 1 pass separate parameters]');
writeln(conf,inttostr(pmode));
writeln(conf,'');
writeln(conf,'[archive browser style]');
writeln(conf,inttostr(browserstyle));
writeln(conf,'');
writeln(conf,'[ignore archived path structure when performing extract and run or preview jobs: all ignore path directivesd are overridden in the content is a directory, as it would lose information about tree structure below]');
writeln(conf,inttostr(ignorepathextand));
writeln(conf,'');
writeln(conf,'[ignore archived path structure when performing extraction of displayed objects]');
writeln(conf,inttostr(ignorepathdisp));
writeln(conf,'');
writeln(conf,'[ignore archived path structure when performing extraction of selected objects]');
writeln(conf,inttostr(ignorepathsel));
writeln(conf,'');
writeln(conf,'[archive browser speed optimization: 0 no optimization 1,2,3 better optimizations (3 default) 4 fast mode, 5 do not pre-parse archives. 4, 5 may non correctly list some archives with TOC issues]');
writeln(conf,inttostr(prebrowse));
writeln(conf,'');
writeln(conf,'[icons rendering interpolation style: 0 native (default) 1 sharp 2 soft');
writeln(conf,inttostr(renderinterpolation));
writeln(conf,'');
writeln(conf,'[overwrite / skip policy using 7z binary]');
writeln(conf,inttostr(extopt7z));
writeln(conf,'');
writeln(conf,'[overwrite / skip policy using arc binary]');
writeln(conf,inttostr(extoptarc));
writeln(conf,'');
writeln(conf,'[save history of recent archives]');
writeln(conf,inttostr(savehistory));
writeln(conf,FormPeach.mRecent1.Caption);
writeln(conf,FormPeach.mRecent2.Caption);
writeln(conf,FormPeach.mRecent3.Caption);
writeln(conf,FormPeach.mRecent4.Caption);
writeln(conf,FormPeach.mRecent5.Caption);
writeln(conf,FormPeach.mRecent6.Caption);
writeln(conf,FormPeach.mRecent7.Caption);
writeln(conf,FormPeach.mRecent8.Caption);
writeln(conf,'');
writeln(conf,'[recently used custom executables]');
writeln(conf,FormPeach.pcustom1.Caption);
writeln(conf,FormPeach.pcustom2.Caption);
writeln(conf,FormPeach.pcustom3.Caption);
writeln(conf,FormPeach.pcustom4.Caption);
writeln(conf,FormPeach.pcustom5.Caption);
writeln(conf,FormPeach.pcustom6.Caption);
writeln(conf,FormPeach.pcustom7.Caption);
writeln(conf,FormPeach.pcustom8.Caption);
writeln(conf,FormPeach.EditOPcustom.Caption);
writeln(conf,inttostr(customsyntax));
writeln(conf,FormPeach.EditCustomParamExt.Caption);
writeln(conf,inttostr(customsyntax1));
writeln(conf,'');
writeln(conf,'[save program''s windows status]');
writeln(conf,inttostr(ws));
if FormPeach.Visible=true then
   if FormPeach.WindowState=wsNormal then
      begin
      ws_status:=0;
      ws_left:=FormPeach.Left;
      ws_top:=FormPeach.Top;
      ws_width:=FormPeach.Width;
      ws_height:=FormPeach.Height;
      end
   else ws_status:=1;
writeln(conf,'');
writeln(conf,'[maximized status]');
writeln(conf,inttostr(ws_status));
writeln(conf,'');
writeln(conf,'[left]');
writeln(conf,inttostr(ws_left));
writeln(conf,'');
writeln(conf,'[top]');
writeln(conf,inttostr(ws_top));
writeln(conf,'');
writeln(conf,'[width]');
writeln(conf,inttostr(ws_width));
writeln(conf,'');
writeln(conf,'[height]');
writeln(conf,inttostr(ws_height));
//favourite archive types
writeln(conf,'');
writeln(conf,'[archive formats to show in favourite popup menu]');
writeln(conf,inttostr(fav7z));
writeln(conf,inttostr(favARC));
writeln(conf,inttostr(favbz));
writeln(conf,inttostr(favcustom));
writeln(conf,inttostr(favgz));
writeln(conf,inttostr(favpea));
writeln(conf,inttostr(favquad));
writeln(conf,inttostr(favsfx));
writeln(conf,inttostr(favsfxarc));
writeln(conf,inttostr(favsplit));
writeln(conf,inttostr(favtar));
writeln(conf,inttostr(favupx));
writeln(conf,inttostr(favzip));
writeln(conf,inttostr(favzpaq));
//Compression default levels
writeln(conf,'');
writeln(conf,'[default 7z compression level]');
if dontsavecustom7z=true then writeln(conf,inttostr(dlevel_7z)) else writeln(conf,inttostr(level_7z));
writeln(conf,'');
writeln(conf,'[default 7z compression method]');
if dontsavecustom7z=true then writeln(conf,dmethod_7z) else writeln(conf,method_7z);
writeln(conf,'');
writeln(conf,'[default ARC compression level]');
writeln(conf,inttostr(level_arc));
writeln(conf,'');
writeln(conf,'[default ARC solid mode]');
writeln(conf,inttostr(solid_arc));
writeln(conf,'');
writeln(conf,'[use recovery records in ARC]');
writeln(conf,inttostr(rr_arc));
writeln(conf,'');
writeln(conf,'[encryption algorithm for ARC 0 AES 1 Serpent 2 Twofish 3 Blowfish]');
writeln(conf,inttostr(algo_arc));
writeln(conf,'');
writeln(conf,'[default bzip2 compression level]');
writeln(conf,inttostr(level_bzip2));
writeln(conf,'');
writeln(conf,'[default gz compression level]');
writeln(conf,inttostr(level_gz));
writeln(conf,'');
writeln(conf,'[default zpaq compression level]');
writeln(conf,inttostr(level_paq));
writeln(conf,'');
writeln(conf,'[default quad/balz/bcm compression level]');
writeln(conf,inttostr(level_quad));
writeln(conf,'');
writeln(conf,'[default upx compression level]');
writeln(conf,inttostr(level_upx));
writeln(conf,'');
writeln(conf,'[default zip compression level]');
if dontsavecustomzip=true then writeln(conf,inttostr(dlevel_zip)) else writeln(conf,inttostr(level_zip));
writeln(conf,'');
writeln(conf,'[default zip compression method]');
if dontsavecustomzip=true then writeln(conf,dmethod_zip) else writeln(conf,method_zip);
writeln(conf,'');
writeln(conf,'[archive files open for writing (from 7z binary)]');
writeln(conf,inttostr(openw_all7z));
writeln(conf,'');
writeln(conf,'[checksum/hash file options: display format, default algorithm, common algorithms]');
writeln(conf,inttostr(algodisp));
writeln(conf,inttostr(algoall));
writeln(conf,inttostr(algoadler));
writeln(conf,inttostr(algocrc16));
writeln(conf,inttostr(algocrc24));
writeln(conf,inttostr(algocrc32));
writeln(conf,inttostr(algocrc64));
writeln(conf,inttostr(algoed2k));
writeln(conf,inttostr(algomd4));
writeln(conf,inttostr(algomd5));
writeln(conf,inttostr(algoripemd160));
writeln(conf,inttostr(algosha1));
writeln(conf,inttostr(algosha3_256));
writeln(conf,inttostr(algosha256));
writeln(conf,inttostr(algosha3_512));
writeln(conf,inttostr(algosha512));
writeln(conf,inttostr(algowhirl));
writeln(conf,'');
writeln(conf,'[erase file options: security level]');
writeln(conf,inttostr(erasepasses));
writeln(conf,'');
writeln(conf,'[desktop path]');
writeln(conf,local_desktop);
writeln(conf,'');
writeln(conf,'[UNUSED]');
writeln(conf,'');
writeln(conf,'');
writeln(conf,'[archived object''s name encoding]');
writeln(conf,inttostr(archivenameenc));
writeln(conf,'');
writeln(conf,'[last output path]');
if savehistory=0 then lastoutpath:='';
writeln(conf,lastoutpath);
writeln(conf,'');
writeln(conf,'[height of the navigation''s splitter]');
writeln(conf,inttostr(splittersize));
writeln(conf,'');
writeln(conf,'[status bar view]');
writeln(conf,inttostr(lastbar));
writeln(conf,'');
writeln(conf,'[extract supported non-archive types]');
writeln(conf,inttostr(esna));
writeln(conf,'');
writeln(conf,'[extract unsupported archive types, specifying custom executable]');
writeln(conf,inttostr(euns));
writeln(conf,'');
writeln(conf,'[configuration check]');
writeln(conf,'PeaZip');
writeln(conf,'');
writeln(conf,'[browser''s style and settings]');
writeln(conf,inttostr(browsertype));
writeln(conf,inttostr(listsortcol));
if FormPeach.StringGridlist.SortOrder=soAscending then az:=true else az:=false;
if az=true then writeln(conf,'1') else writeln(conf,'0');
if (browsertype=0) and (FormPeach.EditOpenIn.Caption<>txt_mypc) then
   begin
   writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[0].Width));
   if ctype=false then writeln(conf,inttostr(col2size)) else writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[1].Width));
   if csize=false then writeln(conf,inttostr(col3size)) else writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[2].Width));
   if cpacked=false then writeln(conf,inttostr(col4size)) else writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[3].Width));
   if cdate=false then writeln(conf,inttostr(col5size)) else writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[4].Width));
   if catt=false then writeln(conf,inttostr(col6size)) else writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[9].Width));
   if ccrc=false then writeln(conf,inttostr(col7size)) else writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[10].Width));
   end
else
   begin
   writeln(conf,inttostr(col1size));
   writeln(conf,inttostr(col2size));
   writeln(conf,inttostr(col3size));
   writeln(conf,inttostr(col4size));
   writeln(conf,inttostr(col5size));
   writeln(conf,inttostr(col6size));
   writeln(conf,inttostr(col7size));
   end;
if rowselect=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[extract to new folder]');
if FormPeach.CheckBoxFolder.State=cbChecked then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[execute archiving/extraction jobs in parallel when possible]');
if FormPeach.CheckBoxParallelarchiving.State=cbChecked then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[default output path for extraction operations]');
writeln(conf,defaultextractpath);
writeln(conf,'');
writeln(conf,'[default output path for archiving operations]');
writeln(conf,defaultarchivepath);
writeln(conf,'');
writeln(conf,'[(Windows) copy files in restartable mode, slower]');
if FormPeach.CheckBoxzcopy.State=cbChecked then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[show menu bar]');
if showmenu=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[address bar]');
writeln(conf,inttostr(addressbar));
writeln(conf,'');
writeln(conf,'[navigation bar]');
writeln(conf,inttostr(navbar));
writeln(conf,'');
writeln(conf,'[columns to show]');
if ctype=true then writeln(conf,'1') else writeln(conf,'0');
if csize=true then writeln(conf,'1') else writeln(conf,'0');
if cpacked=true then writeln(conf,'1') else writeln(conf,'0');
if cdate=true then writeln(conf,'1') else writeln(conf,'0');
if catt=true then writeln(conf,'1') else writeln(conf,'0');
if ccrc=true then writeln(conf,'1') else writeln(conf,'0');
if cfree=true then writeln(conf,'1') else writeln(conf,'0');
if cfs=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[toolbar]');
writeln(conf,inttostr(toolsize));
if thighlight=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[size of the navigation sidebar]');
writeln(conf,inttostr(splitter2size));
writeln(conf,'');
writeln(conf,'[status of navigation groups]');
writeln(conf,inttostr(expandfs));
writeln(conf,inttostr(expandroot));
writeln(conf,inttostr(expandbook));
writeln(conf,inttostr(expandhistory));
writeln(conf,inttostr(expandmore));
writeln(conf,'');
writeln(conf,'[7z / p7zip backend encoding (-scc)]');
writeln(conf,inttostr(enc7zscc));
writeln(conf,'');
writeln(conf,'[extraction or alternative action for 7z, arc, and ace backend binaries]');
writeln(conf,inttostr(extaction7z));
writeln(conf,inttostr(extactionarc));
writeln(conf,inttostr(extactionace));
writeln(conf,'');
writeln(conf,'[working directory]');
writeln(conf,inttostr(work_dir));
writeln(conf,'');
writeln(conf,'[7z / p7zip text encoding for file names inside .ZIP files]');
writeln(conf,inttostr(mcuzip));
writeln(conf,'');
writeln(conf,'[(Windows) get volume information of mapped remote units]');
writeln(conf,inttostr(mappeddrivesinfo));
writeln(conf,'');
writeln(conf,'[status of run group]');
writeln(conf,inttostr(expandrun));
writeln(conf,inttostr(expandapps));
writeln(conf,'');
writeln(conf,'[last successful extraction path]');
if savehistory=0 then lastextractionpath:='';
writeln(conf,lastextractionpath);
writeln(conf,'');
writeln(conf,'[encrypt also filenames, if the feature is supported by the format]');
writeln(conf,inttostr(setencfn));
writeln(conf,'');
writeln(conf,'[UNUSED]');
writeln(conf,'');
writeln(conf,'');
writeln(conf,'[swap position of Toolbar and Address bar]');
if swapbars=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[if multiple items are added to a new archive, name the archive as selected item''s folder]');
writeln(conf,inttostr(nameaspartent));
writeln(conf,'');
writeln(conf,'[new favorite types (3.8)]');
writeln(conf,inttostr(favwim));
writeln(conf,inttostr(favxz));
writeln(conf,'');
writeln(conf,'[default xz compression level]');
writeln(conf,inttostr(level_xz));
writeln(conf,'');
writeln(conf,'[browser icons size]');
writeln(conf,inttostr(browsersize));
writeln(conf,'');
writeln(conf,'[search history]');
if savehistory=0 then
   begin
   writeln(conf,'');
   writeln(conf,'');
   writeln(conf,'');
   writeln(conf,'');
   writeln(conf,'');
   writeln(conf,'');
   writeln(conf,'');
   writeln(conf,'');
   end
else
   begin
   writeln(conf,FormPeach.pmshist1.Caption);
   writeln(conf,FormPeach.pmshist2.Caption);
   writeln(conf,FormPeach.pmshist3.Caption);
   writeln(conf,FormPeach.pmshist4.Caption);
   writeln(conf,FormPeach.pmshist5.Caption);
   writeln(conf,FormPeach.pmshist6.Caption);
   writeln(conf,FormPeach.pmshist7.Caption);
   writeln(conf,FormPeach.pmshist8.Caption);
   end;
writeln(conf,'');
writeln(conf,'[show thumbnails]');
writeln(conf,inttostr(showthumbnails));
writeln(conf,'');
writeln(conf,'[default checksum/hash algorithm for the file browser (calculated on request)]');
writeln(conf,inttostr(browserch));
writeln(conf,'');
writeln(conf,'[simple search mode]');
writeln(conf,inttostr(simplesearch));
writeln(conf,'');
writeln(conf,'[use absolute paths for ARC format]');
writeln(conf,inttostr(arcabspath));
writeln(conf,'');
writeln(conf,'[search is recursive by default]');
writeln(conf,inttostr(recsearch));
writeln(conf,'');
writeln(conf,'[keep password for current session]');
writeln(conf,inttostr(keeppw));
writeln(conf,'');
writeln(conf,'[show address field as breadcrumb]');
writeln(conf,inttostr(usebreadcrumb));
writeln(conf,'');
writeln(conf,'[immersive mode]');
writeln(conf,inttostr(pimmersive));
writeln(conf,'');
writeln(conf,'[toolbar]');
writeln(conf,inttostr(lasttoolbar));
writeln(conf,'');
writeln(conf,'[limit random password generator characters to letters and numbers (as required by some services)]');
if openstarted=true then
   try if FormKF.CheckBoxSuggestPW.State=cbChecked then spchar:=1 else spchar:=0; except spchar:=1; end
else spchar:=1;
writeln(conf,inttostr(spchar));
writeln(conf,'');
writeln(conf,'[default *paq family]');
writeln(conf,inttostr(paqver));
writeln(conf,'');
writeln(conf,'[last browser preset (overridden by style/size settings)]');
writeln(conf,inttostr(tpreset));
writeln(conf,'');
writeln(conf,'[image editing parameters]');
writeln(conf,inttostr(simgfun));
writeln(conf,inttostr(simgw));
writeln(conf,inttostr(simgh));
writeln(conf,inttostr(simgper));
writeln(conf,inttostr(simgasp));
writeln(conf,inttostr(simgconv));
writeln(conf,inttostr(simgj));
writeln(conf,inttostr(simgt));
writeln(conf,inttostr(simgb));
writeln(conf,inttostr(simgl));
writeln(conf,inttostr(simgr));
writeln(conf,inttostr(simgpercent));
writeln(conf,'');
writeln(conf,'[keep archives sent by mail]');
writeln(conf,inttostr(mailkeep));
writeln(conf,'');
writeln(conf,'[help/config section splitter position]');
writeln(conf,inttostr(splitter3size));
writeln(conf,'');
writeln(conf,'[thumbnails decoration style]');
writeln(conf,inttostr(deco_style));
writeln(conf,'');
writeln(conf,'[save history of recent directories]');
writeln(conf,FormPeach.mRecent1f.Caption);
writeln(conf,FormPeach.mRecent2f.Caption);
writeln(conf,FormPeach.mRecent3f.Caption);
writeln(conf,FormPeach.mRecent4f.Caption);
writeln(conf,FormPeach.mRecent5f.Caption);
writeln(conf,FormPeach.mRecent6f.Caption);
writeln(conf,FormPeach.mRecent7f.Caption);
writeln(conf,FormPeach.mRecent8f.Caption);
writeln(conf,'');
writeln(conf,'[enumerate content of directories sent to archiving operations: 0 no (faster) 1 yes (default, slower)]');
writeln(conf,inttostr(enumd));
writeln(conf,'');
writeln(conf,'[default address bar left menu: 1 bookmarks 2 filesystem (default) 3 history]');
writeln(conf,inttostr(defaulttabsmenu));
writeln(conf,'');
writeln(conf,'[default max threads option for 7z]');
writeln(conf,inttostr(multi_option));
writeln(conf,'');
writeln(conf,'[default deletion mode for delete after extraction / archiving option: 0 recycle (if supported) 1 quick 2 zero 3 secure]');
writeln(conf,inttostr(favdelete));
writeln(conf,'');
writeln(conf,'[status of function branch in run group]');
writeln(conf,inttostr(expandfun));
writeln(conf,'');
writeln(conf,'[remove redundant intermediate directory (a single directory in output root) on "Extract to new folder" operations]');
writeln(conf,inttostr(removeintdir));
writeln(conf,'');
writeln(conf,'[verbose confirmation at each archive conversion step 1 yes, 0 no (default)]');
writeln(conf,inttostr(convertverbose));
writeln(conf,'');
writeln(conf,'[Free Software compliance 0 permissive (default), 1  allow only Free Software components, 2 allow only Free Software components and open archive formats; 1 and 2 modes can be hardcoded at compile time]');
writeln(conf,inttostr(libre_directive));
writeln(conf,'');
writeln(conf,'[non-verbose output log from 7z / p7zip, faster (especially when many small files are involved), but less informative 1=yes (default) 0=no]');
writeln(conf,inttostr(nonverboselog));
writeln(conf,'');
writeln(conf,'[timestamp style: 0 name.date.time (default), 1 name.date, 2 date.time.name, 3 date.name]');
writeln(conf,inttostr(tsstyle));
writeln(conf,'');
writeln(conf,'[use 7z / p7zip implementation of UNRAR5 (even if RarLab''s UNRAR5 plugin is installed) 1 yes (default), 0 no; NOTE: overridden by Free Software compliance setting if > 0]');
writeln(conf,inttostr(use7zunrar5));
writeln(conf,'');
writeln(conf,'[sort files by type for 7z solid compression 1 on, usually better compression, 0 off (default) faster on most filesystems]');
writeln(conf,inttostr(sort7zbytype));
writeln(conf,'');
writeln(conf,'[always start file browser from 0 last browserd directory(default), 1 computer''s root, 2 home, 3 desktop, 4 custom, defined below]');
writeln(conf,inttostr(browsersd));
writeln(conf,browsersdir);
writeln(conf,'');
writeln(conf,'[delete originals after archival, extraction: 0 no (default) 1 yes - anyway user will be asked for confirmation]');
writeln(conf,inttostr(doptadd));
writeln(conf,inttostr(doptext));
writeln(conf,'');
writeln(conf,'[add timestamp suffix when creating archives: 0 no (default), 1 yes]');
writeln(conf,inttostr(addtstext));
writeln(conf,'');
writeln(conf,'[add ".enc" suffix before extension when creating encrypted archives: 0 no (default), 1 yes]');
writeln(conf,inttostr(addencext));
writeln(conf,'');
writeln(conf,'[tab bar]');
writeln(conf,inttostr(ptabbar));
writeln(conf,'');
writeln(conf,'[privacy_mode directive 0 none (default), 1 ask for password or keyfile when application starts, skippable, 2 non skippable]');
writeln(conf,inttostr(privacy_mode));
writeln(conf,'');
writeln(conf,'[manage NT security information]');
writeln(conf,inttostr(sni7z));
writeln(conf,'');
writeln(conf,'[manage NTFS alternate data streams]');
writeln(conf,inttostr(sns7z));
writeln(conf,'');
writeln(conf,'[change password during conversion 1 yes, 0 no (default)]');
writeln(conf,inttostr(convertpw));
writeln(conf,'');
writeln(conf,'[show volatile options]');
writeln(conf,inttostr(showvolatile));
writeln(conf,'');
writeln(conf,'[try to open archives containing errors]');
writeln(conf,inttostr(tryopenwerrors));
writeln(conf,'');
writeln(conf,'[try to edit non-canonical archive formats]');
writeln(conf,inttostr(forcecanbechanged));
writeln(conf,'');
writeln(conf,'[force extracting unsupported archive types using PeaZip]');
writeln(conf,inttostr(euns1));
writeln(conf,'');
writeln(conf,'[custom working directory]');
writeln(conf,custom_work_path);
writeln(conf,'');
writeln(conf,'[encryption algorithm for ZIP 0 AES (default), 1 ZipCrypto (legacy)]');
writeln(conf,inttostr(algo_zipenc));
writeln(conf,'');
writeln(conf,'[use native drag and drop on Windows]');
writeln(conf,inttostr(nativedrag));
writeln(conf,'');
writeln(conf,'[launcher left]');
writeln(conf,inttostr(ws_gw_left));
writeln(conf,'');
writeln(conf,'[launcher top]');
writeln(conf,inttostr(ws_gw_top));
writeln(conf,'');
writeln(conf,'[launcher width]');
writeln(conf,inttostr(ws_gw_width));
writeln(conf,'');
writeln(conf,'[launcher height]');
writeln(conf,inttostr(ws_gw_height));
writeln(conf,'');
writeln(conf,'[automatically sync archives if previewed files are updated]');
writeln(conf,inttostr(autosync));
writeln(conf,'');
writeln(conf,'[automatically open TAR archive in TAR.* files]');
writeln(conf,inttostr(autoopentar));
writeln(conf,'');
writeln(conf,'[default Brotli compression level]');
writeln(conf,inttostr(level_brotli));
writeln(conf,'');
writeln(conf,'[default Zstd compression level]');
writeln(conf,inttostr(level_zstd));
writeln(conf,'');
writeln(conf,'[new favorite types (7.1)]');
writeln(conf,inttostr(favbrotli));
writeln(conf,inttostr(favzstandard));
writeln(conf,'');
writeln(conf,'[rename only files]');
writeln(conf,inttostr(renfilesonly));
writeln(conf,'');
writeln(conf,'[file spanning]');
writeln(conf,inttostr(defaultspanning));
writeln(conf,inttostr(spansize));
writeln(conf,inttostr(spanunit));
writeln(conf,'');
writeln(conf,'[advanced 7z / p7zip compression settings]');
if (dontsavecustom7z=true) or (dontsavecustomzip=true) then writeln(conf,inttostr(advopdictionary)) else writeln(conf,inttostr(FormPeach.ComboBox7zDictionary.ItemIndex));
if (dontsavecustom7z=true) or (dontsavecustomzip=true) then writeln(conf,inttostr(advopword)) else writeln(conf,inttostr(FormPeach.ComboBox7zWord.ItemIndex));
if (dontsavecustom7z=true) or (dontsavecustomzip=true) then writeln(conf,inttostr(advoppasses)) else writeln(conf,inttostr(FormPeach.ComboBox7zPasses.ItemIndex));
if (dontsavecustom7z=true) or (dontsavecustomzip=true) then writeln(conf,inttostr(advopblocksize)) else writeln(conf,inttostr(FormPeach.ComboBox7zSolid.ItemIndex));
writeln(conf,'');
writeln(conf,'[auto close PeaZip when task completes]');
writeln(conf,inttostr(autoclosepeazip));
writeln(conf,'');
writeln(conf,'[ZPAQ advanced extraction options]');
writeln(conf,inttostr(zpaqall));
writeln(conf,inttostr(zpaqabsolute));
writeln(conf,inttostr(zpaqforce));
writeln(conf,'');
writeln(conf,'[custom other parameters for 7z / p7zip and Arc]');
writeln(conf,FormPeach.Edit7zOpt.Caption);
writeln(conf,FormPeach.EditOParc.Caption);
writeln(conf,'');
writeln(conf,'[set 7z / p7zip archive time from most recent file time]');
writeln(conf,inttostr(stl7z));
writeln(conf,'');
writeln(conf,'[maximize Brotli compression using larger memory --large_window=27 (may be incompatible with some Brotli extractors)]');
writeln(conf,inttostr(maxbrotli));
writeln(conf,'');
writeln(conf,'[maximize Zstandard compression using larger memory window]');
writeln(conf,inttostr(maxzstd));
writeln(conf,'');
writeln(conf,'[do not ask confirmation to delete after extraction / archiving]');
writeln(conf,inttostr(noconfdel));
writeln(conf,'');
writeln(conf,'[automatically configure Custom compression to use Rar.exe as compressor, if WinRar is installed');
writeln(conf,inttostr(userar));
writeln(conf,'');
writeln(conf,'[default Rar.exe compression level]');
writeln(conf,inttostr(level_rar));
writeln(conf,'');
writeln(conf,'[1 create RAR5 (default), 0 create legacy RAR4]');
writeln(conf,inttostr(userar5));
writeln(conf,'');
writeln(conf,'[RAR5 dictionary size');
writeln(conf,inttostr(userardict));
writeln(conf,'');
writeln(conf,'[RAR5 use BLAKE2 hash instead of CRC]');
writeln(conf,inttostr(userarblake2));
writeln(conf,'');
writeln(conf,'[RAR create sfx]');
writeln(conf,inttostr(userarsfx));
writeln(conf,'');
writeln(conf,'[RAR create solid archive]');
writeln(conf,inttostr(userarsolid));
writeln(conf,'');
writeln(conf,'[RAR create recovery records]');
writeln(conf,inttostr(userarrr));
writeln(conf,'');
writeln(conf,'[RAR recovery records %]');
writeln(conf,inttostr(puserarrr));
writeln(conf,'');
writeln(conf,'[RAR save files open for writing]');
writeln(conf,inttostr(userarsaveopen));
writeln(conf,'');
writeln(conf,'[RAR save NT security]');
writeln(conf,inttostr(userarsavesecurity));
writeln(conf,'');
writeln(conf,'[RAR save NTFS alternate streams]');
writeln(conf,inttostr(userarsavestreams));
writeln(conf,'');
writeln(conf,'[RAR set archive time from most recent file time]');
writeln(conf,inttostr(userarlastmodtime));
writeln(conf,'');
writeln(conf,'[RAR lock archive]');
writeln(conf,inttostr(userarlock));
writeln(conf,'');
writeln(conf,'[switch to zipx extension form non-Deflate zip archives]');
writeln(conf,inttostr(swzipx));
writeln(conf,'');
writeln(conf,'[close PeaZip after extraction if no browsing actions took place]');
writeln(conf,inttostr(closeonsingleextract));
writeln(conf,'');
writeln(conf,'[protect drag and drop target window during operation: 0 no protection, 1 lock, 2 hide, 3 lock and hide]');
writeln(conf,inttostr(dragtargetprotect));
writeln(conf,'');
writeln(conf,'[extract everything for special file types in archive: 0 never, 1 ask, 2 always; 0 entire archive, 1 displayed items only]');
writeln(conf,inttostr(whenspecialopen));
writeln(conf,inttostr(howspecialopen));
writeln(conf,'');
writeln(conf,'[custom code page for ZIP files, when -mcp option is used]');
writeln(conf,FormPeach.EditEncoding.Caption);
writeln(conf,'');
writeln(conf,'[update archive tree when browsing: 0 no, 1 simple, 2 full, keep visited nodes]');
writeln(conf,inttostr(ptsync));
writeln(conf,'');
writeln(conf,'[use system 7z]');
writeln(conf,inttostr(sys7zlin));
writeln(conf,'');
writeln(conf,'[interactive extraction, two steps: first extract to a fresh folder, then move to relative path in destination directory]');
writeln(conf,inttostr(movetorelativepath));
writeln(conf,'');
writeln(conf,'[tasks priority]');
writeln(conf,inttostr(taskpriority));
writeln(conf,'');
writeln(conf,'[special file types triggering extract everything for]');
writeln(conf,FormPeach.editExtEvForWhat.Caption);
writeln(conf,'');
writeln(conf,'[custom archive extension]');
writeln(conf,inttostr(repcustext));
writeln(conf,FormPeach.EditCustomExtension.Caption);
writeln(conf,'');
writeln(conf,'[try to browse non-canonical archive formats]');
writeln(conf,inttostr(forcebrowse));
writeln(conf,'');
writeln(conf,'[try to convert non-canonical archive formats]');
writeln(conf,inttostr(forceconvert));
writeln(conf,'');
writeln(conf,'[force typing password in backend console, apply also to generated scripts]');
writeln(conf,inttostr(intpw));
writeln(conf,'');
writeln(conf,'[default action on start-up for single input, e.g. double-click on associated file type from the system]');
writeln(conf,inttostr(defaultactionst));
writeln(conf,'');
writeln(conf,'[enable "Extract and open with" submenu]');
writeln(conf,inttostr(enableextand));
writeln(conf,'');
writeln(conf,'[(Windows) use integrated Extrac32 to unpack CAB 1 yes (default), 0 no NOTE: overridden by Free Software compliance setting if > 0]');
writeln(conf,inttostr(useextrac32));
writeln(conf,'');
writeln(conf,'[store Created and Last access timestamps in archive types supporting it]');
writeln(conf,inttostr(storecreated));
writeln(conf,'');
writeln(conf,'[skip testing archives for encryption before extraction]');
writeln(conf,inttostr(skipenctest));
writeln(conf,'');
writeln(conf,'[extended columns]');
if ccreated=true then writeln(conf,'1') else writeln(conf,'0');
if caccessed=true then writeln(conf,'1') else writeln(conf,'0');
if cmethod=true then writeln(conf,'1') else writeln(conf,'0');
if (browsertype=0) and (FormPeach.EditOpenIn.Caption<>txt_mypc) and (fun='UN7Z') then
   if cmethod=false then
      writeln(conf,inttostr(col5size))
   else
      writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[7].Width))
else writeln(conf,inttostr(col5size));
writeln(conf,'');
writeln(conf,'[preferred checksum and hash algorithms]');
writeln(conf,FormPeach.Editcommonalgo.Caption);
writeln(conf,'');
writeln(conf,'[multiple-byte unit: 0 binary, multiple of 1024 (IEC kibibyte); 1 decimal, multiple of 1000 (IEC kilobyte); 2 no conversion, exact byte size]');
writeln(conf,inttostr(filesizebase));
writeln(conf,'');
writeln(conf,'[maximum length for arguments]');
writeln(conf,inttostr(maxargsize));
writeln(conf,'');
writeln(conf,'[skip deletion of locked files without interactive confirmation]');
writeln(conf,inttostr(skipdel));
writeln(conf,'');
writeln(conf,'[ignore interactive extraction option when creating scripts from Console tab]');
writeln(conf,inttostr(disableintscript));
writeln(conf,'');
writeln(conf,'[apply advanced inclusion and exclusion filters to archive browser]');
writeln(conf,inttostr(filterbrowser));
writeln(conf,'');
writeln(conf,'[load layout at startup]');
writeln(conf,inttostr(forcelayout));
writeln(conf,FormPeach.LabelForceLayout.Caption);
writeln(conf,'');
writeln(conf,'[immediate execution of custom compression profile or preset]');
writeln(conf,inttostr(immediate_execution));
writeln(conf,'');
writeln(conf,'[default archive creation action (new archive, add, update...)]');
if FormPeach.LabelStatusAddUpdate.caption='' then writeln(conf,inttostr(FormPeach.ComboBox7zFun.ItemIndex))
else writeln(conf,inttostr(defaultarchiveaction));
writeln(conf,'');
writeln(conf,'[show search bar, and position]');
writeln(conf,inttostr(showsearchbar));
writeln(conf,inttostr(splitsearchsize));
writeln(conf,'');
writeln(conf,'[7z backend, propagate Zone.Identifier stream to extracted files (Windows)]');
writeln(conf,inttostr(snz7z));
writeln(conf,'');
writeln(conf,'[TAR standard]');
writeln(conf,inttostr(tartype));
writeln(conf,'');
writeln(conf,'[timestamp precision]');
writeln(conf,inttostr(tartime));
writeln(conf,'');
writeln(conf,'[7z backend, store owner/group ids and names in TAR archives (Linux)');
writeln(conf,inttostr(snoi7z));
writeln(conf,inttostr(snon7z));
writeln(conf,'');
writeln(conf,'[test archives after creation, for supported formats]');
writeln(conf,inttostr(autotest));
writeln(conf,'');
writeln(conf,'[tool bar large icon size]');
writeln(conf,inttostr(lsize));
writeln(conf,'');
writeln(conf,'[7z / p7zip do not change last access time]');
writeln(conf,inttostr(ssp7z));
writeln(conf,'');
writeln(conf,'[WIM, TAR store hard links as links]');
writeln(conf,inttostr(snh7z));
writeln(conf,'');
writeln(conf,'[WIM, TAR store symbolic links as links]');
writeln(conf,inttostr(snl7z));
writeln(conf,'');
writeln(conf,'[7z max memory usage %, 0 default]');
writeln(conf,inttostr(memuse_option));
writeln(conf,'');
writeln(conf,'[automatically extract TAR archive from TAR.* files, for extract and convert]');
writeln(conf,inttostr(tar_atomic));
writeln(conf,inttostr(tar_atomic_convert));
writeln(conf,'');
writeln(conf,'[ZPAQ rebuild full paths]');
writeln(conf,inttostr(zpaqfull));
writeln(conf,'');
writeln(conf,'[sort dirs before files]');
writeln(conf,inttostr(dirbeforefiles));
writeln(conf,'');
writeln(conf,'[7z / p7zip syntax level 0 latest tested for the app, 1 23.01 2 21.07]');
writeln(conf,inttostr(syntaxlevel7z));
writeln(conf,'');
writeln(conf,'[archive converion scripts allow user''s interaction]');
writeln(conf,inttostr(convint));
writeln(conf,'');
writeln(conf,'[7z / p7zip exclude empty folders]');
writeln(conf,inttostr(excludeef));
writeln(conf,'');
writeln(conf,'[UNUSED]');
writeln(conf,'');
writeln(conf,'');
writeln(conf,'[use quick deduplication routine]');
writeln(conf,inttostr(qdup));
writeln(conf,'');
writeln(conf,'[alias for 7z / p7zip binary name]');
writeln(conf,FormPeach.Editalias.Caption);
writeln(conf,'');
writeln(conf,'[swap position of Tab and Address bar]');
if swaptab=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[try to edit non-canonical archive formats as derivate of 0 ZIP, 1 7Z, 2 TAR, 3 WIM]');
writeln(conf,inttostr(forcetype));
writeln(conf,'');
writeln(conf,'[toolbar style]');
writeln(conf,inttostr(ntoolstyle));
writeln(conf,'');
writeln(conf,'[extended columns, comments]');
if ccomment=true then writeln(conf,'1') else writeln(conf,'0');
if (browsertype=0) and (FormPeach.EditOpenIn.Caption<>txt_mypc) and (fun='UN7Z') then
   if ccomment=false then
      writeln(conf,inttostr(col7size))
   else
      writeln(conf,inttostr(FormPeach.ListViewBrowser.Column[8].Width))
else writeln(conf,inttostr(col7size));
writeln(conf,'');
writeln(conf,'[manually set RAR binary]');
writeln(conf,inttostr(setrarmanual));
writeln(conf,'');
writeln(conf,'[save open tabs on exit]');
writeln(conf,inttostr(restoretabbar));
writeln(conf,'');
writeln(conf,'[side bar]');
writeln(conf,inttostr(psidebar));
writeln(conf,'');
writeln(conf,'[7z / p7zip use stdin / stdout pipe for tar and untar on compressed TAR archives: 0 no (default), 1 yes]');
writeln(conf,inttostr(scripttarpipe));
writeln(conf,inttostr(scriptuntarpipe));
writeln(conf,'');
writeln(conf,'[smart file name sorting]');
if smartsortenabled=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[7z / p7zip display timestamps as UTC]');
writeln(conf,inttostr(tsutc));
writeln(conf,'');
writeln(conf,'[KDF work load for PEA cascaded encryption]');
writeln(conf,inttostr(nrkdf));
writeln(conf,'');
writeln(conf,'[KDF type for PEA cascaded encryption]');
writeln(conf,inttostr(trkdf));
writeln(conf,'');
writeln(conf,'[max size of TAR file to be automatically opened for browsing in compressed TAR archives]');
writeln(conf,inttostr(abt));
writeln(conf,'');
writeln(conf,'[do not run following file types without confirmation 1 from archives, 2 from filesystem, 3 both, 4 do not check]');
writeln(conf,inttostr(seccond));
writeln(conf,FormPeach.editExtEvForSec.Caption);
writeln(conf,'');
writeln(conf,'[show hidden files and folders in the filesystem]');
if pshowh=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[dynamically set file browser in virtual mode over 0 4 K items, 1 8 K items, 2 16 K items, 3 never]');
writeln(conf,inttostr(virtualopt));
writeln(conf,'');
writeln(conf,'[default zpaq threads, 0 auto, generic multithreading]');
writeln(conf,inttostr(threads_zpaq));
writeln(conf,'');
writeln(conf,'[Zstd backend keep extracted files if errors are detected 0 no (default), 1 yes]');
writeln(conf,inttostr(zstderr));
writeln(conf,'');
writeln(conf,'[compact mode for task window 0 no (default), 1 yes]');
if FormGwrap.pmCompact.Checked=true then writeln(conf,'1') else writeln(conf,'0'); //updated value for gwcompact
writeln(conf,'');
writeln(conf,'[multivolume RAR create recovery volumes]');
writeln(conf,inttostr(userarrv));
writeln(conf,'');
writeln(conf,'[multivolume RAR recovery volumes]');
writeln(conf,inttostr(puserarrv));
writeln(conf,'');
writeln(conf,'[execute in background tasks with a small workload]');
writeln(conf,inttostr(executesmallbk));
writeln(conf,'');
writeln(conf,'[keep log of tasks]');
writeln(conf,inttostr(logcommands));
writeln(conf,'');
writeln(conf,'[limit keyfile size to first 100MB]');
writeln(conf,inttostr(kflimit));
writeln(conf,'');
writeln(conf,'[middle mouse button click action: 0 Up, 1 Back, 2 Rename, 3 Open in a new tab, 4 Open in a new window');
writeln(conf,inttostr(mbaction));
end;

procedure updateconf;
begin
updatingconf:=true;
alias7z:=FormPeach.Editalias.Caption;
FormPeach.cbDefaultFormat.ItemIndex:=df;
FormPeach.cbTimeStamp.ItemIndex:=tsstyle;
FormPeach.cbBinaries.ItemIndex:=zaout;
FormPeach.EditDesk.Text:=local_desktop;
FormPeach.cbBinariesStop.ItemIndex:=autoclosegwrap;
FormPeach.ComboBoxLibre.ItemIndex:=libre_directive;
FormPeach.ComboBoxPrivacy.ItemIndex:=privacy_mode;
FormPeach.ComboBoxConsoleEncoding.ItemIndex:=enc7zscc;
FormPeach.ComboBoxsd.ItemIndex:=browsersd;
FormPeach.LabelcbSDcustom.Caption:=browsersdir;
if clipmode=0 then FormPeach.CheckBoxClip.State:=cbUnchecked
else FormPeach.CheckBoxClip.State:=cbChecked;
if movetorelativepath=0 then FormPeach.CheckBoxrelative.State:=cbUnchecked
else FormPeach.CheckBoxrelative.State:=cbChecked;
if FormPeach.CheckBoxrelative.State=cbChecked then FormPeach.Labelsetwork.enabled:=true
else FormPeach.Labelsetwork.enabled:=false;
if FormPeach.CheckBoxrelative.enabled=false then FormPeach.Labelsetwork.enabled:=false;
case browserstyle of
   0: FormPeach.RadioGroupBrowser.ItemIndex:=0;
   1: FormPeach.RadioGroupBrowser.ItemIndex:=1;
   else FormPeach.RadioGroupBrowser.ItemIndex:=2;
   end;
if mailkeep=1 then FormPeach.CheckBoxMailKeep.State:=cbChecked
else FormPeach.CheckBoxMailKeep.State:=cbUnChecked;
if convertpw=1 then FormPeach.CheckBoxConvertPW.State:=cbChecked
else FormPeach.CheckBoxConvertPW.State:=cbUnChecked;
if convertverbose=1 then FormPeach.CheckBoxConvertVerbose.State:=cbChecked
else FormPeach.CheckBoxConvertVerbose.State:=cbUnChecked;
if autoopen=1 then
   begin
   FormPeach.CheckBoxAutoOpen.State:=cbChecked;
   FormPeach.pmopenout.Checked:=true;
   FormPeach.mtoggleop.Checked:=true;
   end
else
   begin
   FormPeach.CheckBoxAutoOpen.State:=cbUnChecked;
   FormPeach.pmopenout.Checked:=false;
   FormPeach.mtoggleop.Checked:=false;
   end;
if autotest=1 then
   FormPeach.CheckBoxAutoTest.State:=cbChecked
else
   FormPeach.CheckBoxAutoTest.State:=cbUnChecked;
if autoclosepeazip=1 then
   FormPeach.CheckBoxClosePeaZip.State:=cbChecked
else
   FormPeach.CheckBoxClosePeaZip.State:=cbUnChecked;
if skipenctest=1 then FormPeach.CheckBoxSkipenc.State:=cbChecked else FormPeach.CheckBoxSkipenc.State:=cbUnChecked;
if nameaspartent=1 then FormPeach.CheckBoxnameasparentfolder.State:=cbChecked else FormPeach.CheckBoxnameasparentfolder.State:=cbUnChecked;
if showguihints=1 then FormPeach.CheckBoxShowHints.State:=cbChecked else FormPeach.CheckBoxShowHints.State:=cbUnChecked;
if showguihints=1 then FormPeach.ShowHint:=true else FormPeach.ShowHint:=false;
FormPeach.ComboBoxOverwrite.Itemindex:=extopt7z;
FormPeach.cbDeleteInputModeExt.ItemIndex:={$IFDEF MSWINDOWS}favdelete;{$ELSE}{$IFDEF DARWIN}favdelete;{$ELSE}favdelete-1;{$ENDIF}{$ENDIF}
FormPeach.cbDeleteInputModeAdd.ItemIndex:={$IFDEF MSWINDOWS}favdelete;{$ELSE}{$IFDEF DARWIN}favdelete;{$ELSE}favdelete-1;{$ENDIF}{$ENDIF}
if doptext=1 then
   begin
   FormPeach.CheckBoxDeleteInputExt.State:=cbChecked;
   FormPeach.cbDeleteInputModeExt.visible:=true;
   end
else
   begin
   FormPeach.CheckBoxDeleteInputExt.State:=cbUnChecked;
   FormPeach.cbDeleteInputModeExt.visible:=false;
   end;
if doptadd=1 then
   begin
   FormPeach.CheckBoxDeleteInputAdd.State:=cbChecked;
   FormPeach.cbDeleteInputModeAdd.visible:=true;
   end
else
   begin
   FormPeach.CheckBoxDeleteInputAdd.State:=cbUnChecked;
   FormPeach.cbDeleteInputModeAdd.visible:=false;
   end;
FormPeach.pmqen1.checked:=false;
FormPeach.pmqen2.checked:=false;
FormPeach.pmqen3.checked:=false;
FormPeach.pmqen4.checked:=false;
FormPeach.pmqen5.checked:=false;
case extopt7z of
   0: FormPeach.pmqen1.checked:=true;
   1: FormPeach.pmqen2.checked:=true;
   2: FormPeach.pmqen3.checked:=true;
   3: FormPeach.pmqen4.checked:=true;
   4: FormPeach.pmqen5.checked:=true;
   end;
FormPeach.ComboBoxActionExtract.Itemindex:=extaction7z;
if extaction7z=1 then FormPeach.pmqenopath.Checked:=true else FormPeach.pmqenopath.Checked:=false;
FormPeach.ComboBoxActionArc.Itemindex:=extactionarc;
FormPeach.CheckBoxExtActionAdv.Itemindex:=extactionace;
FormPeach.ComboBoxWD.Itemindex:=work_dir;
FormPeach.LabelCustomWorkPath.Caption:=custom_work_path;
FormPeach.ComboBoxOverwriteARC.Itemindex:=extoptarc;
if nativedrag=1 then FormPeach.CheckBoxDragDrop.State:=cbChecked else FormPeach.CheckBoxDragDrop.State:=cbUnChecked;
FormPeach.ComboBoxDrag.ItemIndex:=dragtargetprotect;
if nativedrag=0 then FormPeach.ComboBoxDrag.enabled:=false else FormPeach.ComboBoxDrag.enabled:=true;
if autosync=1 then FormPeach.CheckBoxEditArchives.State:=cbChecked else FormPeach.CheckBoxEditArchives.State:=cbUnChecked;
FormPeach.ComboBoxSysbin.ItemIndex:=sys7zlin;
if ignorepathextand=1 then FormPeach.CheckBoxIgnorePaths.State:=cbChecked else FormPeach.CheckBoxIgnorePaths.State:=cbUnChecked;
if closeonsingleextract=1 then FormPeach.cbautoclosesingleextract.State:=cbChecked else FormPeach.cbautoclosesingleextract.State:=cbUnChecked;
FormPeach.cbExtEvForWhen.Itemindex:=whenspecialopen;
FormPeach.ComboBoxsec.Itemindex:=seccond;
FormPeach.cbmiddlebutton.Itemindex:=mbaction;
FormPeach.cbExtEvForHow.Itemindex:=howspecialopen;
if whenspecialopen=0 then FormPeach.cbExtEvForHow.enabled:=false else FormPeach.cbExtEvForHow.enabled:=true;
FormPeach.editExtEvForWhat.enabled:=FormPeach.cbExtEvForHow.enabled;
if seccond=3 then FormPeach.editExtEvForSec.enabled:=false else FormPeach.editExtEvForSec.enabled:=true;
if ignorepathdisp=1 then FormPeach.CheckBoxIgnoreDisp.State:=cbChecked else FormPeach.CheckBoxIgnoreDisp.State:=cbUnChecked;
if ignorepathsel=1 then FormPeach.CheckBoxIgnoreSel.State:=cbChecked else FormPeach.CheckBoxIgnoreSel.State:=cbUnChecked;
if enableextand=1 then FormPeach.CheckBoxExtAnd.State:=cbChecked else FormPeach.CheckBoxExtAnd.State:=cbUnChecked;
if removeintdir=1 then
   begin
   FormPeach.CheckBoxSmartFolder.State:=cbChecked;
   FormPeach.CheckBoxIntDir.State:=cbChecked;
   FormPeach.pmqnointdir.Checked:=true;
   end
else
   begin
   FormPeach.CheckBoxSmartFolder.State:=cbUnChecked;
   FormPeach.CheckBoxIntDir.State:=cbUnChecked;
   FormPeach.pmqnointdir.Checked:=false;
   end;
if sni7z=1 then FormPeach.CheckBoxsni.State:=cbChecked else FormPeach.CheckBoxsni.State:=cbUnChecked;
if sns7z=1 then FormPeach.CheckBoxsns.State:=cbChecked else FormPeach.CheckBoxsns.State:=cbUnChecked;
if snh7z=1 then FormPeach.CheckBoxsnh.State:=cbChecked else FormPeach.CheckBoxsnh.State:=cbUnChecked;
if snl7z=1 then FormPeach.CheckBoxsnl.State:=cbChecked else FormPeach.CheckBoxsnl.State:=cbUnChecked;
if sni7z=1 then FormPeach.CheckBoxsniExt.State:=cbChecked else FormPeach.CheckBoxsniExt.State:=cbUnChecked;
if sns7z=1 then FormPeach.CheckBoxsnsExt.State:=cbChecked else FormPeach.CheckBoxsnsExt.State:=cbUnChecked;
if stl7z=1 then FormPeach.CheckBoxstl.State:=cbChecked else FormPeach.CheckBoxstl.State:=cbUnChecked;
if ssp7z=1 then FormPeach.CheckBoxssp.State:=cbChecked else FormPeach.CheckBoxssp.State:=cbUnChecked;
if snz7z=1 then FormPeach.CheckBoxsnzExt.State:=cbChecked else FormPeach.CheckBoxsnzExt.State:=cbUnChecked;
if zstderr=1 then FormPeach.CheckBoxZstdErrPolicy.State:=cbChecked else FormPeach.CheckBoxZstdErrPolicy.State:=cbUnChecked;
if storecreated=1 then FormPeach.cbtimecreated.State:=cbChecked else FormPeach.cbtimecreated.State:=cbUnChecked;
if maxbrotli=1 then FormPeach.CheckBoxBrotli.State:=cbChecked else FormPeach.CheckBoxBrotli.State:=cbUnChecked;
if maxzstd=1 then FormPeach.CheckBoxZstd.State:=cbChecked else FormPeach.CheckBoxZstd.State:=cbUnChecked;
if zpaqall=1 then FormPeach.CheckBoxzpaqall.State:=cbChecked else FormPeach.CheckBoxzpaqall.State:=cbUnChecked; FormPeach.CheckBoxzpaqallClick(nil);
if zpaqfull=1 then FormPeach.CheckBoxzpaqfull.State:=cbChecked else FormPeach.CheckBoxzpaqfull.State:=cbUnChecked; FormPeach.CheckBoxzpaqfullClick(nil);
if zpaqabsolute=1 then FormPeach.CheckBoxzpaqabsolute.State:=cbChecked else FormPeach.CheckBoxzpaqabsolute.State:=cbUnChecked; FormPeach.CheckBoxzpaqabsoluteClick(nil);
if zpaqforce=1 then FormPeach.CheckBoxzpaqforce.State:=cbChecked else FormPeach.CheckBoxzpaqforce.State:=cbUnChecked;
FormPeach.ComboBoxBrowser.ItemIndex:=prebrowse;
FormPeach.ComboBoxMaxArg.ItemIndex:=maxargsize;
FormPeach.ComboBoxPriority.ItemIndex:=taskpriority;
FormPeach.ComboBoxVirtual.ItemIndex:=virtualopt;
if nonverboselog=1 then FormPeach.CheckBoxBrowseNotVerbose.State:=cbChecked else FormPeach.CheckBoxBrowseNotVerbose.State:=cbUnChecked;
if skipdel=1 then FormPeach.CheckBoxSkipDel.State:=cbChecked else FormPeach.CheckBoxSkipDel.State:=cbUnChecked;
if kflimit=1 then FormPeach.CheckBoxLimitKFSize.State:=cbChecked else FormPeach.CheckBoxLimitKFSize.State:=cbUnChecked;
if use7zunrar5=1 then FormPeach.CheckBox7zunrar5.State:=cbChecked else FormPeach.CheckBox7zunrar5.State:=cbUnChecked;
if pmode=1 then FormPeach.CheckBoxParams.State:=cbChecked else FormPeach.CheckBoxParams.State:=cbUnChecked;
if executesmallbk=1 then FormPeach.CheckBoxBackground.State:=cbChecked else FormPeach.CheckBoxBackground.State:=cbUnChecked;
if logcommands=1 then FormPeach.CheckBoxLog.State:=cbChecked else FormPeach.CheckBoxLog.State:=cbUnChecked;
if useextrac32=1 then FormPeach.CheckBoxExtrac32.State:=cbChecked else FormPeach.CheckBoxExtrac32.State:=cbUnChecked;
if enumd=1 then FormPeach.CheckBoxEnumd.State:=cbChecked else FormPeach.CheckBoxEnumd.State:=cbUnChecked;
if userar=1 then FormPeach.cbRAR.State:=cbChecked else FormPeach.cbRAR.State:=cbUnChecked;
if userar5=1 then FormPeach.cbRAR5.State:=cbChecked else FormPeach.cbRAR5.State:=cbUnChecked;
FormPeach.comboRARdict.Itemindex:=userardict;
if userarblake2=1 then FormPeach.cbRARBLAKE2.State:=cbChecked else FormPeach.cbRARBLAKE2.State:=cbUnChecked;
if setrarmanual=1 then FormPeach.cbRARmanual.State:=cbChecked else FormPeach.cbRARmanual.State:=cbUnChecked;
if userarsfx=1 then FormPeach.cbRARsfx.State:=cbChecked else FormPeach.cbRARsfx.State:=cbUnChecked;
if userarsolid=1 then FormPeach.cbRARsolid.State:=cbChecked else FormPeach.cbRARsolid.State:=cbUnChecked;
if userarrr=1 then FormPeach.cbRARrr.State:=cbChecked else FormPeach.cbRARrr.State:=cbUnChecked;
FormPeach.seRARrr.Value:=puserarrr;
if userarrv=1 then FormPeach.cbRARrv.State:=cbChecked else FormPeach.cbRARrv.State:=cbUnChecked;
FormPeach.seRARrv.Value:=puserarrv;
if userarsaveopen=1 then FormPeach.cbRARsaveopen.State:=cbChecked else FormPeach.cbRARsaveopen.State:=cbUnChecked;
if userarsavesecurity=1 then FormPeach.cbRARsavesecurity.State:=cbChecked else FormPeach.cbRARsavesecurity.State:=cbUnChecked;
if userarsavestreams=1 then FormPeach.cbRARsavestreams.State:=cbChecked else FormPeach.cbRARsavestreams.State:=cbUnChecked;
FormPeach.cbRARlastmodtime.ItemIndex:=userarlastmodtime;
if userarlock=1 then FormPeach.cbRARlock.State:=cbChecked else FormPeach.cbRARlock.State:=cbUnChecked;
if addencext=1 then FormPeach.cbEncExtension.State:=cbChecked else FormPeach.cbEncExtension.State:=cbUnChecked;
setscripttarpipe;
setscriptuntarpipe;
if addtstext=1 then FormPeach.CheckBoxDate.State:=cbChecked else FormPeach.CheckBoxDate.State:=cbUnChecked;
if repcustext=1 then FormPeach.cbCustomExtension.State:=cbChecked else FormPeach.cbCustomExtension.State:=cbUnChecked;
if savehistory=1 then FormPeach.CheckBoxArchiveHistory.State:=cbChecked else FormPeach.CheckBoxArchiveHistory.State:=cbUnChecked;
if showvolatile=1 then FormPeach.CheckBoxShowvolatile.State:=cbChecked else FormPeach.CheckBoxShowvolatile.State:=cbUnChecked;
if autoopentar=1 then FormPeach.CheckBoxAutoOpenTar.State:=cbChecked else FormPeach.CheckBoxAutoOpenTar.State:=cbUnChecked;
if qdup=1 then FormPeach.cbqdup.State:=cbChecked else FormPeach.cbqdup.State:=cbUnChecked;
if pshowh=true then FormPeach.cbshowhidden.State:=cbChecked else FormPeach.cbshowhidden.State:=cbUnChecked;
FormPeach.mshowhidden.checked:=pshowh;
if tar_atomic=1 then FormPeach.CheckBoxAutoExtTar.State:=cbChecked else FormPeach.CheckBoxAutoExtTar.State:=cbUnChecked;
if tar_atomic_convert=1 then FormPeach.CheckBoxAutoExtTarConvert.State:=cbChecked else FormPeach.CheckBoxAutoExtTarConvert.State:=cbUnChecked;
if noconfdel=1 then FormPeach.CheckBoxNoConf.State:=cbChecked else FormPeach.CheckBoxNoConf.State:=cbUnChecked;
if swzipx=1 then FormPeach.CheckBoxzipxswitch.State:=cbChecked else FormPeach.CheckBoxzipxswitch.State:=cbUnChecked;
if convint=1 then FormPeach.CheckBoxAC.State:=cbChecked else FormPeach.CheckBoxAC.State:=cbUnChecked;
if tryopenwerrors=1 then FormPeach.CheckBoxForceOpen.State:=cbChecked else FormPeach.CheckBoxForceOpen.State:=cbUnChecked;
if forcecanbechanged=1 then FormPeach.CheckBoxForceEdit.State:=cbChecked else FormPeach.CheckBoxForceEdit.State:=cbUnChecked;
FormPeach.cbforcetype.ItemIndex:=forcetype;
if excludeef=1 then FormPeach.CheckBoxExcludeEF.State:=cbChecked else FormPeach.CheckBoxExcludeEF.State:=cbUnChecked;
if tsutc=1 then FormPeach.CheckBoxUTC.State:=cbChecked else FormPeach.CheckBoxUTC.State:=cbUnChecked;
if immediate_execution=1 then FormPeach.mprofileimmediate.Checked:=true else FormPeach.mprofileimmediate.Checked:=false;
if forcelayout=1 then FormPeach.CheckBoxForceLayout.State:=cbChecked else FormPeach.CheckBoxForceLayout.State:=cbUnChecked;
if forcebrowse=1 then FormPeach.CheckBoxForceBrowse.State:=cbChecked else FormPeach.CheckBoxForceBrowse.State:=cbUnChecked;
if forceconvert=1 then FormPeach.CheckBoxForceConvert.State:=cbChecked else FormPeach.CheckBoxForceConvert.State:=cbUnChecked;
if archivenameenc=1 then FormPeach.CheckBoxEncoding.State:=cbChecked else FormPeach.CheckBoxEncoding.State:=cbUnChecked;
FormPeach.cbEncoding.ItemIndex:=mcuzip;
if FormPeach.cbEncoding.ItemIndex=3 then FormPeach.EditEncoding.Visible:=true else FormPeach.EditEncoding.Visible:=false;
FormPeach.ComboBoxSyntaxLevel.ItemIndex:=syntaxlevel7z;
FormPeach.cbtree.ItemIndex:=ptsync;
FormPeach.cbautobrowsetar.ItemIndex:=abt;
FormPeach.cbdefaultaction.ItemIndex:=defaultactionst;
if mappeddrivesinfo=1 then FormPeach.CheckBoxnetworkinfo.State:=cbChecked else FormPeach.CheckBoxnetworkinfo.State:=cbUnChecked;
if ws=1 then FormPeach.CheckBoxWindowStatus.State:=cbChecked else FormPeach.CheckBoxWindowStatus.State:=cbUnChecked;
if savehistory=1 then
   begin
   sethistory;
   end
else
   begin
   FormPeach.mRecent1.Caption:='';
   FormPeach.mRecent2.Caption:='';
   FormPeach.mRecent3.Caption:='';
   FormPeach.mRecent4.Caption:='';
   FormPeach.mRecent5.Caption:='';
   FormPeach.mRecent6.Caption:='';
   FormPeach.mRecent7.Caption:='';
   FormPeach.mRecent8.Caption:='';
   FormPeach.mRecent1f.Caption:='';
   FormPeach.mRecent2f.Caption:='';
   FormPeach.mRecent3f.Caption:='';
   FormPeach.mRecent4f.Caption:='';
   FormPeach.mRecent5f.Caption:='';
   FormPeach.mRecent6f.Caption:='';
   FormPeach.mRecent7f.Caption:='';
   FormPeach.mRecent8f.Caption:='';
   sethistory;
   end;
if FormPeach.pcustom1.Caption<>'' then FormPeach.pcustom1.Visible:=true else FormPeach.pcustom1.Visible:=false;
if FormPeach.pcustom2.Caption<>'' then FormPeach.pcustom2.Visible:=true else FormPeach.pcustom2.Visible:=false;
if FormPeach.pcustom3.Caption<>'' then FormPeach.pcustom3.Visible:=true else FormPeach.pcustom3.Visible:=false;
if FormPeach.pcustom4.Caption<>'' then FormPeach.pcustom4.Visible:=true else FormPeach.pcustom4.Visible:=false;
if FormPeach.pcustom5.Caption<>'' then FormPeach.pcustom5.Visible:=true else FormPeach.pcustom5.Visible:=false;
if FormPeach.pcustom6.Caption<>'' then FormPeach.pcustom6.Visible:=true else FormPeach.pcustom6.Visible:=false;
if FormPeach.pcustom7.Caption<>'' then FormPeach.pcustom7.Visible:=true else FormPeach.pcustom7.Visible:=false;
if FormPeach.pcustom8.Caption<>'' then FormPeach.pcustom8.Visible:=true else FormPeach.pcustom8.Visible:=false;
FormPeach.ComboBoxArchiveCustom.Itemindex:=customsyntax;
FormPeach.ComboBoxCustomSyntaxExt.Itemindex:=customsyntax1;
FormPeach.cbHashFormat.ItemIndex:=algodisp;
FormPeach.cbBrowserHash.ItemIndex:=browserch-1;
FormPeach.cbHash.ItemIndex:=algoall;
if esna=1 then FormPeach.CheckBoxExtNotArchives.State:=cbChecked else FormPeach.CheckBoxExtNotArchives.State:=cbUnChecked;
if euns=1 then
   begin
   FormPeach.CheckBoxExtUnsupported.State:=cbChecked;
   FormPeach.CheckBoxExtUnsupportedPeaZip.Enabled:=true;
   if euns1=1 then
      begin
      FormPeach.CheckBoxExtUnsupportedPeaZip.State:=cbChecked;
      FormPeach.CompressionCustomExt.Enabled:=false;
      end
   else
       begin
       FormPeach.CheckBoxExtUnsupportedPeaZip.State:=cbUnChecked;
       FormPeach.CompressionCustomExt.Enabled:=true;
       end;
   end
else
   begin
   FormPeach.CheckBoxExtUnsupported.State:=cbUnChecked;
   FormPeach.CheckBoxExtUnsupportedPeaZip.Enabled:=false;
   FormPeach.CompressionCustomExt.Enabled:=false;
   if euns1=1 then
      begin
      FormPeach.CheckBoxExtUnsupportedPeaZip.State:=cbChecked;
      end
   else
       begin
       FormPeach.CheckBoxExtUnsupportedPeaZip.State:=cbUnChecked;
       end;
   end;
FormPeach.ComboBoxPasses.Itemindex:=erasepasses;
FormPeach.ComboBoxKiB.Itemindex:=filesizebase;
if tonewfolder=1 then
   begin
   FormPeach.CheckBoxFolder.State:=cbChecked;
   FormPeach.pmqenewfolder.checked:=true;
   FormPeach.mtogglenew.checked:=true;
   end
else
   begin
   FormPeach.CheckBoxFolder.State:=cbUnChecked;
   FormPeach.pmqenewfolder.checked:=false;
   FormPeach.mtogglenew.checked:=false;
   end;
if zcopy=1 then FormPeach.CheckBoxzcopy.State:=cbChecked else FormPeach.CheckBoxzcopy.State:=cbUnChecked;
if parallelarchive=1 then FormPeach.CheckBoxParallelarchiving.State:=cbChecked else FormPeach.CheckBoxParallelarchiving.State:=cbUnChecked;
if defaultextractpath<>'' then
   begin
   FormPeach.mdefaultextract.caption:=txt_caption_extract+' > '+txt_2_8_usedefaultoutpath+' '+defaultextractpath;
   FormPeach.mdefaultextract.checked:=true;
   end
else
   begin
   FormPeach.mdefaultextract.caption:=txt_caption_extract+' > '+txt_7_6_setdef;
   FormPeach.mdefaultextract.checked:=false;
   end;
FormPeach.pmusedefault.caption:=FormPeach.mdefaultextract.caption;
FormPeach.pmusedefault.checked:=FormPeach.mdefaultextract.checked;
FormPeach.lsetdefaultout_ext.caption:=FormPeach.mdefaultextract.caption;
if defaultarchivepath<>'' then
   begin
   FormPeach.mdefaultarchive.caption:=txt_archive+' > '+txt_2_8_usedefaultoutpath+' '+defaultarchivepath;
   FormPeach.mdefaultarchive.checked:=true;
   end
else
   begin
   FormPeach.mdefaultarchive.caption:=txt_archive+' > '+txt_7_6_setdef;
   FormPeach.mdefaultarchive.checked:=false;
   end;
FormPeach.lsetdefaultout_arc.caption:=FormPeach.mdefaultarchive.caption;
updatingconf:=false;
end;

procedure updateconf_modified;
begin
updateconf;
end;

procedure load_theme;
var
   thpath:ansistring;
begin
if theme_path='' then exit;
if theme_path[1]='r' then theme_path:='themes'+directoryseparator+DEFAULT_THEME+directoryseparator+'theme.txt';
getthemepath(thpath);
if ((theme_name)<>(DEFAULT_THEME)) then
   begin
   assignfile(conf,(thpath+theme_path));
   filemode:=0;
   reset(conf);
   read_header(conf, filemode);
   readln(conf,theme_name);
   readln(conf,theme_author);
   readln(conf,theme_license);
   readconf_default_colors;
   CloseFile(conf);
   end;
if ((theme_name)=(DEFAULT_THEME)) then
   begin
   theme_name:=DEFAULT_THEME;
   theme_author:='Giorgio Tani';
   theme_license:='LGPLv3';
   graphicsfolderd:='themes'+DirectorySeparator+DEFAULT_THEME+DirectorySeparator;
   dodirseparators(graphicsfolderd);
   opacityd:=100;
   color1d:=ColorToString(PAPPCOL);
   color2d:=ColorToString(clWindow);
   if evalcolor(clWindow)>128 then color3d:=ColorToString(PTACOL)
   else color3d:=ColorToString(PAPPCOL);
   color4d:=ColorToString(clAppWorkspace);
   color5d:=ColorToString(clWindowText);
   usealtcolord:=0;
   highlighttabsd:=0;
   accenttoolbard:=0;
   toolcenteredd:=0;
   altaddressstyled:=1;
   solidaddressstyled:=0;
   alttabstyled:=2;
   decostyled:=0;
   pzoomd:=100;
   ensmalld:=0;
   pspacingd:=6;
   temperatured:=0;
   contrastd:=4;
   end;

case theme_name of
   DEFAULT_THEME: FormPeach.ComboBoxTheme.ItemIndex:=0;
   'mac': FormPeach.ComboBoxTheme.ItemIndex:=1;
   'main': FormPeach.ComboBoxTheme.ItemIndex:=2;
   'ten': FormPeach.ComboBoxTheme.ItemIndex:=3;
   'tux': FormPeach.ComboBoxTheme.ItemIndex:=4;
   else FormPeach.ComboBoxTheme.ItemIndex:=5;
end;
if theme_name=DEFAULT_THEME then FormPeach.themesave_label.enabled:=false else FormPeach.themesave_label.enabled:=true;
end;

procedure load_default_theme;
begin
theme_name:=DEFAULT_THEME;
theme_path:='themes'+directoryseparator+DEFAULT_THEME+directoryseparator+'theme.txt';
load_theme;
end;

procedure save_bookmarks;
var
   i,rc:integer;
begin
try
assignfile(book,(confpath+'bookmarks.txt'));
rewrite(book);
write_header(book);
rc:=FormPeach.StringGridBookmarks.RowCount;
if rc>1 then
   for i:=1 to rc-1 do
      begin
      if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_browsing then writeln(book,'0')
      else
         if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_flat then writeln(book,'1')
         else
            if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_found then writeln(book,'2')
            else writeln(book,'0');
      writeln(book,FormPeach.StringGridBookmarks.Cells[2,i]);
      writeln(book,FormPeach.StringGridBookmarks.Cells[4,i]);
      writeln(book,FormPeach.StringGridBookmarks.Cells[5,i]);
      writeln(book,FormPeach.StringGridBookmarks.Cells[6,i]);
      if savehistory=1 then
         begin
         writeln(book,FormPeach.StringGridBookmarks.Cells[7,i]);
         writeln(book,FormPeach.StringGridBookmarks.Cells[8,i]);
         writeln(book,FormPeach.StringGridBookmarks.Cells[9,i]);
         end
      else
         begin
         writeln(book,'');
         writeln(book,'');
         writeln(book,'');
         end;
      end
else writeln(book,' ');
CloseFile(book);
except
   try
   CloseFile(book);
   except
   end;
end;
end;

procedure save_custedit;
begin
try
assignfile(cedit,(confpath+'custedit.txt'));
rewrite(cedit);
write_header(cedit);
writeln(cedit,'[custom editors/players, override system''s file associations, 4.2+]');
with FormPeach do
begin
writeln(cedit,StringGridCustedit.Cells[1,1]);
writeln(cedit,StringGridCustedit.Cells[1,2]);
writeln(cedit,StringGridCustedit.Cells[1,3]);
writeln(cedit,StringGridCustedit.Cells[1,4]);
writeln(cedit,StringGridCustedit.Cells[1,5]);
writeln(cedit,StringGridCustedit.Cells[1,6]);
writeln(cedit,StringGridCustedit.Cells[1,7]);
writeln(cedit,StringGridCustedit.Cells[1,8]);
writeln(cedit,StringGridCustedit.Cells[1,9]);
writeln(cedit,StringGridCustedit.Cells[1,10]);
writeln(cedit,StringGridCustedit.Cells[1,11]);
writeln(cedit,StringGridCustedit.Cells[1,12]);
writeln(cedit,StringGridCustedit.Cells[1,13]);
writeln(cedit,StringGridCustedit.Cells[1,14]);
writeln(cedit,StringGridCustedit.Cells[1,15]);
writeln(cedit,StringGridCustedit.Cells[1,16]);
writeln(cedit,StringGridCustedit.Cells[2,1]);
writeln(cedit,StringGridCustedit.Cells[2,2]);
writeln(cedit,StringGridCustedit.Cells[2,3]);
writeln(cedit,StringGridCustedit.Cells[2,4]);
writeln(cedit,StringGridCustedit.Cells[2,5]);
writeln(cedit,StringGridCustedit.Cells[2,6]);
writeln(cedit,StringGridCustedit.Cells[2,7]);
writeln(cedit,StringGridCustedit.Cells[2,8]);
writeln(cedit,StringGridCustedit.Cells[2,9]);
writeln(cedit,StringGridCustedit.Cells[2,10]);
writeln(cedit,StringGridCustedit.Cells[2,11]);
writeln(cedit,StringGridCustedit.Cells[2,12]);
writeln(cedit,StringGridCustedit.Cells[2,13]);
writeln(cedit,StringGridCustedit.Cells[2,14]);
writeln(cedit,StringGridCustedit.Cells[2,15]);
writeln(cedit,StringGridCustedit.Cells[2,16]);
writeln(cedit,StringGridCustEditAdv.Cells[1,1]);
writeln(cedit,StringGridCustEditAdv.Cells[1,2]);
writeln(cedit,StringGridCustEditAdv.Cells[1,3]);
writeln(cedit,StringGridCustEditAdv.Cells[1,4]);
writeln(cedit,StringGridCustEditAdv.Cells[1,5]);
writeln(cedit,StringGridCustEditAdv.Cells[1,6]);
writeln(cedit,StringGridCustEditAdv.Cells[1,7]);
writeln(cedit,StringGridCustEditAdv.Cells[1,8]);
writeln(cedit,StringGridCustEditAdv.Cells[2,1]);
writeln(cedit,StringGridCustEditAdv.Cells[2,2]);
writeln(cedit,StringGridCustEditAdv.Cells[2,3]);
writeln(cedit,StringGridCustEditAdv.Cells[2,4]);
writeln(cedit,StringGridCustEditAdv.Cells[2,5]);
writeln(cedit,StringGridCustEditAdv.Cells[2,6]);
writeln(cedit,StringGridCustEditAdv.Cells[2,7]);
writeln(cedit,StringGridCustEditAdv.Cells[2,8]);
writeln(cedit,StringGridCustEditAdv.Cells[3,1]);
writeln(cedit,StringGridCustEditAdv.Cells[3,2]);
writeln(cedit,StringGridCustEditAdv.Cells[3,3]);
writeln(cedit,StringGridCustEditAdv.Cells[3,4]);
writeln(cedit,StringGridCustEditAdv.Cells[3,5]);
writeln(cedit,StringGridCustEditAdv.Cells[3,6]);
writeln(cedit,StringGridCustEditAdv.Cells[3,7]);
writeln(cedit,StringGridCustEditAdv.Cells[3,8]);
writeln(cedit,StringGridCustEditAdv.Cells[4,1]);
writeln(cedit,StringGridCustEditAdv.Cells[4,2]);
writeln(cedit,StringGridCustEditAdv.Cells[4,3]);
writeln(cedit,StringGridCustEditAdv.Cells[4,4]);
writeln(cedit,StringGridCustEditAdv.Cells[4,5]);
writeln(cedit,StringGridCustEditAdv.Cells[4,6]);
writeln(cedit,StringGridCustEditAdv.Cells[4,7]);
writeln(cedit,StringGridCustEditAdv.Cells[4,8]);
end;
CloseFile(cedit);
except
   try
   CloseFile(cedit);
   except
   end;
end;
end;

procedure reset_custedit;
var
   i,ioff,iacro,iooo:integer;
begin
with FormPeach do
begin
for i:=1 to 16 do
   begin
   StringGridCustedit.Cells[1,i]:='';
   StringGridCustedit.Cells[2,i]:='';
   end;
for i:=1 to 8 do
   begin
   StringGridCustEditAdv.Cells[1,i]:='';
   StringGridCustEditAdv.Cells[2,i]:='';
   StringGridCustEditAdv.Cells[3,i]:='';
   StringGridCustEditAdv.Cells[4,i]:='';
   end;
custedit1:='';
advedit1before:='';
advedit1after:='';
advedit1alt:='';
custedit2:='';
advedit2before:='';
advedit2after:='';
advedit2alt:='';
custedit3:='';
advedit3before:='';
advedit3after:='';
advedit3alt:='';
custedit4:='';
advedit4before:='';
advedit4after:='';
advedit4alt:='';
custedit5:='';
advedit5before:='';
advedit5after:='';
advedit5alt:='';
custedit6:='';
advedit6before:='';
advedit6after:='';
advedit6alt:='';
custedit7:='';
advedit7before:='';
advedit7after:='';
advedit7alt:='';
custedit8:='';
advedit8before:='';
advedit8after:='';
advedit8alt:='';
custedit9:='';
custedit10:='';
custedit11:='';
custedit12:='';
custedit13:='';
custedit14:='';
custedit15:='';
custedit16:='';
{$IFDEF MSWINDOWS}
wingetprogramsfolder;
wingetsystemfolder;
wingetappdatafolder;
//try to find if some common applications are installed, preference for free software and for programs using same location for different versions
//1 Google search, open with default system browser
StringGridCustedit.Cells[1,1]:='Google';
custedit1:='https://www.google.com/search?q=';
//2 Notepad
StringGridCustedit.Cells[1,2]:='Notepad';
custedit2:='notepad.exe';
//3 media players: VLC then Windows Media Player
if fileexists(winpfolder+'VideoLAN\VLC\vlc.exe') then
   begin
   StringGridCustedit.Cells[1,3]:='VLC Media Player';
   custedit3:=winpfolder+'VideoLAN\VLC\vlc.exe';
   end
else
   begin
   StringGridCustedit.Cells[1,3]:='Windows Media Player';
   custedit3:='wmplayer.exe';
   end;
//4 image viewers FastStone then Irfan then XnView
if fileexists(winpfolder32+'IrfanView\i_view32.exe') then
   begin
   StringGridCustedit.Cells[1,4]:='IrfanView';
   custedit4:=winpfolder32+'IrfanView\i_view32.exe';
   end;
if fileexists(winpfolder32+'xnview\xnview.exe') then
   begin
   StringGridCustedit.Cells[1,4]:='XnView';
   custedit4:=winpfolder32+'xnview\xnview.exe';
   end;
if fileexists(winpfolder32+'FastStone Image Viewer\FSViewer.exe') then
   begin
   StringGridCustedit.Cells[1,4]:='FastStone Image Viewer';
   custedit4:=winpfolder32+'FastStone Image Viewer\FSViewer.exe';
   end;
if fileexists(winpfolder+'xnview\xnview.exe') then
   begin
   StringGridCustedit.Cells[1,4]:='XnView';
   custedit4:=winpfolder+'xnview\xnview.exe';
   end;
if fileexists(winpfolder+'IrfanView\i_view64.exe') then
   begin
   StringGridCustedit.Cells[1,4]:='IrfanView';
   custedit4:=winpfolder+'IrfanView\i_view64.exe';
   end;
if fileexists(winpfolder+'FastStone Image Viewer\FSViewer.exe') then
   begin
   StringGridCustedit.Cells[1,4]:='FastStone Image Viewer';
   custedit4:=winpfolder+'FastStone Image Viewer\FSViewer.exe';
   end;
//5 raster painting
if fileexists(winpfolder+'Paint.NET\PaintDotNet.exe') then
   begin
   StringGridCustedit.Cells[1,5]:='Paint.NET';
   custedit5:=winpfolder+'Paint.NET\PaintDotNet.exe';
   end
else
   begin
   StringGridCustedit.Cells[1,5]:='MS Paint';
   custedit5:='mspaint.exe';
   end;
//6 PDF Acrobat Reader DC, then PDF24 Reader, then older Acrobat Reader versions
for iacro:=4 to 11 do
begin
if fileexists(winpfolder32+'Adobe\Reader '+inttostr(iacro)+'.0\Reader\AcroRd32.exe') then
   begin
   StringGridCustedit.Cells[1,6]:='Acrobat Reader';
   custedit6:=winpfolder32+'Adobe\Reader '+inttostr(iacro)+'.0\Reader\AcroRd32.exe';
   end;
end;
if fileexists(winpfolder32+'PDF24\pdf24-Reader.exe') then
   begin
   StringGridCustedit.Cells[1,6]:='PDF24 Reader';
   custedit6:=winpfolder32+'PDF24\pdf24-Reader.exe';
   end;
if fileexists(winpfolder32+'Adobe\Acrobat Reader DC\Reader\AcroRd32.exe') then
   begin
   StringGridCustedit.Cells[1,6]:='Acrobat Reader DC';
   custedit6:=winpfolder32+'Adobe\Acrobat Reader DC\Reader\AcroRd32.exe';
   end;
//7 documents Office, then Libre/Open Office then Wordpad
//8 spreadsheet Office, then Libre/Open Office
//9 presentations Office, then Libre/Open Office
//10 database Office, then Libre/Open Office
//11 mail Office
//12 vector drawing Office, then Libre/Open Office
if fileexists(winpfolder+'Windows NT\Accessories\wordpad.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='WordPad';
   custedit7:=winpfolder+'Windows NT\Accessories\wordpad.exe';
   end;
if fileexists(winpfolder+'LibreOffice\program\writer.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='Writer';
   custedit7:=winpfolder+'LibreOffice\program\writer.exe';
   end;
if fileexists(winpfolder+'LibreOffice\program\calc.exe') then
   begin
   StringGridCustedit.Cells[1,8]:='Calc';
   custedit8:=winpfolder+'LibreOffice\program\calc.exe';
   end;
if fileexists(winpfolder+'LibreOffice\program\impress.exe') then
   begin
   StringGridCustedit.Cells[1,9]:='Impress';
   custedit9:=winpfolder+'LibreOffice\program\impress.exe';
   end;
if fileexists(winpfolder+'LibreOffice\program\base.exe') then
   begin
   StringGridCustedit.Cells[1,10]:='Base';
   custedit10:=winpfolder+'LibreOffice\program\base.exe';
   end;
if fileexists(winpfolder+'LibreOffice\program\draw.exe') then
   begin
   StringGridCustedit.Cells[1,12]:='Draw';
   custedit12:=winpfolder+'LibreOffice\program\draw.exe';
   end;
if fileexists(winpfolder+'OpenOffice\program\writer.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='Writer';
   custedit7:=winpfolder+'OpenOffice\program\writer.exe';
   end;
if fileexists(winpfolder+'OpenOffice\program\calc.exe') then
   begin
   StringGridCustedit.Cells[1,8]:='Calc';
   custedit8:=winpfolder+'OpenOffice\program\calc.exe';
   end;
if fileexists(winpfolder+'OpenOffice\program\impress.exe') then
   begin
   StringGridCustedit.Cells[1,9]:='Impress';
   custedit9:=winpfolder+'OpenOffice\program\impress.exe';
   end;
if fileexists(winpfolder+'OpenOffice\program\base.exe') then
   begin
   StringGridCustedit.Cells[1,10]:='Base';
   custedit10:=winpfolder+'OpenOffice\program\base.exe';
   end;
if fileexists(winpfolder+'OpenOffice\program\draw.exe') then
   begin
   StringGridCustedit.Cells[1,12]:='Draw';
   custedit12:=winpfolder+'OpenOffice\program\draw.exe';
   end;
for iooo:=4 to 9 do
begin
if fileexists(winpfolder+'LibreOffice '+inttostr(iooo)+'\program\writer.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='Writer';
   custedit7:=winpfolder+'LibreOffice '+inttostr(iooo)+'\program\writer.exe';
   end;
if fileexists(winpfolder+'LibreOffice '+inttostr(iooo)+'\program\calc.exe') then
   begin
   StringGridCustedit.Cells[1,8]:='Calc';
   custedit8:=winpfolder+'LibreOffice '+inttostr(iooo)+'\program\calc.exe';
   end;
if fileexists(winpfolder+'LibreOffice '+inttostr(iooo)+'\program\impress.exe') then
   begin
   StringGridCustedit.Cells[1,9]:='Impress';
   custedit9:=winpfolder+'LibreOffice '+inttostr(iooo)+'\program\impress.exe';
   end;
if fileexists(winpfolder+'LibreOffice '+inttostr(iooo)+'\program\base.exe') then
   begin
   StringGridCustedit.Cells[1,10]:='Base';
   custedit10:=winpfolder+'LibreOffice '+inttostr(iooo)+'\program\base.exe';
   end;
if fileexists(winpfolder+'LibreOffice '+inttostr(iooo)+'\program\draw.exe') then
   begin
   StringGridCustedit.Cells[1,12]:='Draw';
   custedit12:=winpfolder+'LibreOffice '+inttostr(iooo)+'\program\draw.exe';
   end;
if fileexists(winpfolder+'OpenOffice '+inttostr(iooo)+'\program\writer.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='Writer';
   custedit7:=winpfolder+'OpenOffice '+inttostr(iooo)+'\program\writer.exe';
   end;
if fileexists(winpfolder+'OpenOffice '+inttostr(iooo)+'\program\calc.exe') then
   begin
   StringGridCustedit.Cells[1,8]:='Calc';
   custedit8:=winpfolder+'OpenOffice '+inttostr(iooo)+'\program\calc.exe';
   end;
if fileexists(winpfolder+'OpenOffice '+inttostr(iooo)+'\program\impress.exe') then
   begin
   StringGridCustedit.Cells[1,9]:='Impress';
   custedit9:=winpfolder+'OpenOffice '+inttostr(iooo)+'\program\impress.exe';
   end;
if fileexists(winpfolder+'OpenOffice '+inttostr(iooo)+'\program\base.exe') then
   begin
   StringGridCustedit.Cells[1,10]:='Base';
   custedit10:=winpfolder+'OpenOffice '+inttostr(iooo)+'\program\base.exe';
   end;
if fileexists(winpfolder+'OpenOffice '+inttostr(iooo)+'\program\draw.exe') then
   begin
   StringGridCustedit.Cells[1,12]:='Draw';
   custedit12:=winpfolder+'OpenOffice '+inttostr(iooo)+'\program\draw.exe';
   end;
end;
for ioff:=8 to 29 do
begin
if fileexists(winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\winword.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='Word';
   custedit7:=winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\winword.exe';
   end;
if fileexists(winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\winword.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='Word';
   custedit7:=winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\winword.exe';
   end;
if fileexists(winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\excel.exe') then
   begin
   StringGridCustedit.Cells[1,8]:='Excel';
   custedit8:=winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\excel.exe';
   end;
if fileexists(winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\excel.exe') then
   begin
   StringGridCustedit.Cells[1,8]:='Excel';
   custedit8:=winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\excel.exe';
   end;
if fileexists(winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\powerpnt.exe') then
   begin
   StringGridCustedit.Cells[1,9]:='PowerPoint';
   custedit9:=winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\powerpnt.exe';
   end;
if fileexists(winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\powerpnt.exe') then
   begin
   StringGridCustedit.Cells[1,9]:='PowerPoint';
   custedit9:=winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\powerpnt.exe';
   end;
if fileexists(winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\msaccess.exe') then
   begin
   StringGridCustedit.Cells[1,10]:='Access';
   custedit10:=winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\msaccess.exe';
   end;
if fileexists(winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\msaccess.exe') then
   begin
   StringGridCustedit.Cells[1,10]:='Access';
   custedit10:=winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\msaccess.exe';
   end;
if fileexists(winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\outlook.exe') then
   begin
   StringGridCustedit.Cells[1,11]:='Outlook';
   custedit11:=winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\outlook.exe';
   end;
if fileexists(winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\outlook.exe') then
   begin
   StringGridCustedit.Cells[1,11]:='Outlook';
   custedit11:=winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\outlook.exe';
   end;
if fileexists(winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\visio.exe') then
   begin
   StringGridCustedit.Cells[1,12]:='Visio';
   custedit12:=winpfolder32+'Microsoft Office\Office'+inttostr(ioff)+'\visio.exe';
   end;
if fileexists(winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\visio.exe') then
   begin
   StringGridCustedit.Cells[1,12]:='Visio';
   custedit12:=winpfolder+'Microsoft Office\Office'+inttostr(ioff)+'\visio.exe';
   end;
end;
//13 Internet Explorer or Edge
StringGridCustedit.Cells[1,13]:='Internet Explorer / Edge';
custedit13:='iexplore.exe';//system redirects to Edge on newer Windows systems
//14 Chrome
if fileexists(extractfilepath((GetEnvironmentVariable('APPDATA')))+'Local\Google\Chrome\Application\chrome.exe') then
   begin
   StringGridCustedit.Cells[1,14]:='Chrome';
   custedit14:=extractfilepath((GetEnvironmentVariable('APPDATA')))+'Local\Google\Chrome\Application\chrome.exe';
   end;
if fileexists(winpfolder+'Google\Chrome\Application\chrome.exe') then
   begin
   StringGridCustedit.Cells[1,14]:='Chrome';
   custedit14:=winpfolder+'Google\Chrome\Application\chrome.exe';
   end;
//15 other browsers: FF then Opera
if fileexists(winpfolder+'Opera\opera.exe') then
   begin
   StringGridCustedit.Cells[1,15]:='Opera';
   custedit15:=winpfolder+'Opera\opera.exe';
   end;
if fileexists(winpfolder+'Mozilla Firefox\firefox.exe') then
   begin
   StringGridCustedit.Cells[1,15]:='Mozilla Firefox';
   custedit15:=winpfolder+'Mozilla Firefox\firefox.exe';
   end;
set_win_antivirus;
{$ELSE}
{$IFDEF DARWIN}
StringGridCustedit.Cells[1,1]:='Text editor';
custedit1:='open -t';
StringGridCustedit.Cells[1,2]:='Pages';
custedit2:='open -a Pages';
StringGridCustedit.Cells[1,3]:='Numbers';
custedit3:='open -a Numbers';
StringGridCustedit.Cells[1,4]:='Preview';
custedit4:='open -a Preview';
StringGridCustedit.Cells[1,5]:='Quick Look';
custedit5:='qlmanage -p';
StringGridCustedit.Cells[1,6]:='Script Editor';
custedit6:='open -a "Script Editor"';
StringGridCustedit.Cells[1,7]:='Photos';
custedit7:='open -a Photo';
if checkmacapp('Gimp.app')=true then
   begin
   StringGridCustedit.Cells[1,8]:='Gimp';
   custedit8:='open -a Gimp';
   end
else
   if checkmacapp('Inkscape.app')=true then
      begin
      StringGridCustedit.Cells[1,8]:='Inkscape';
      custedit8:='open -a Inkscape';
      end
   else
      if checkmacapp('LibreOffice.app')=true then
         begin
         StringGridCustedit.Cells[1,8]:='Draw';
         custedit8:='open -a lodraw';
         end
      else
         if checkmacapp('OpenOffice.app')=true then
            begin
            StringGridCustedit.Cells[1,8]:='Draw';
            custedit8:='open -a oodraw';
            end;
StringGridCustedit.Cells[1,9]:='Quick Time Player';
custedit9:='open -a "QuickTime Player"';
if checkmacapp('VLC.app')=true then
   begin
   StringGridCustedit.Cells[1,10]:='VLC';
   custedit10:='open -a VLC';
   end;
StringGridCustedit.Cells[1,11]:='Safari';
custedit11:='open -a Safari';
if checkmacapp('Google Chrome.app')=true then
   begin
   StringGridCustedit.Cells[1,12]:='Google Chrome';
   custedit12:='open -a "Google Chrome"';
   end;
if checkmacapp('Firefox')=true then
   begin
   StringGridCustedit.Cells[1,13]:='Mozilla Firefox';
   custedit13:='open -a Firefox';
   end;
if checkmacapp('LibreOffice.app')=true then
   begin
   StringGridCustedit.Cells[1,14]:='Writer';
   custedit14:='open -a lowriter';
   end
else
   if checkmacapp('OpenOffice.app')=true then
      begin
      StringGridCustedit.Cells[1,14]:='Writer';
      custedit14:='open -a oowriter';
      end;
if checkmacapp('LibreOffice.app')=true then
   begin
   StringGridCustedit.Cells[1,15]:='Calc';
   custedit15:='open -a localc';
   end
else
   if checkmacapp('OpenOffice.app')=true then
      begin
      StringGridCustedit.Cells[1,15]:='Calc';
      custedit15:='open -a oocalc';
      end;
{if checkmacapp('LibreOffice.app')=true then
   begin
   StringGridCustedit.Cells[1,16]:='Base';
   custedit16:='open -a lobase';
   end
else
   if checkmacapp('OpenOffice.app')=true then
      begin
      StringGridCustedit.Cells[1,16]:='Base';
      custedit16:='open -a oobase';
      end;}
if checkmacapp('LibreOffice.app')=true then
   begin
   StringGridCustedit.Cells[1,16]:='Impress';
   custedit16:='open -a loimpress';
   end
else
   if checkmacapp('OpenOffice.app')=true then
      begin
      StringGridCustedit.Cells[1,16]:='Impress';
      custedit16:='open -a ooimpress';
      end;
if checkmacappbin('clamscan')=true then
   begin
   StringGridCusteditAdv.Cells[1,1]:='ClamAV';
   advedit1before:='clamscan --bell -i -r ';
   advedit1after:='';
   advedit1alt:='';
   end;
{$ELSE}
StringGridCustedit.Cells[1,1]:='Text editor';
if desk_env=1 then custedit1:='gedit'
else
   if desk_env=2 then custedit1:='kwrite'
   else
      if checklinapp('mousepad')=true then
         begin
         StringGridCustedit.Cells[1,1]:='Mousepad';
         custedit1:='mousepad';
         end
      else
         if checklinapp('emacs')=true then custedit1:='emacs'
         else
            if checklinapp('vim')=true then custedit1:='vim'
            else custedit1:='vi';
//OpenOffice and LibreOffice
if checklinapp('lowriter')=true then
   begin
   StringGridCustedit.Cells[1,2]:='Writer';
   custedit2:='lowriter';
   end
else
   if checklinapp('oowriter')=true then
      begin
      StringGridCustedit.Cells[1,2]:='Writer';
      custedit2:='oowriter';
      end
   else
      if checklinapp('abiword')=true then
         begin
         StringGridCustedit.Cells[1,2]:='AbiWord';
         custedit2:='abiword';
         end
      else
         if checklinapp('latex')=true then
            begin
            StringGridCustedit.Cells[1,2]:='LaTeX';
            custedit2:='latex';
            end;
if checklinapp('localc')=true then
   begin
   StringGridCustedit.Cells[1,3]:='Calc';
   custedit3:='localc';
   end
else
   if checklinapp('oocalc')=true then
      begin
      StringGridCustedit.Cells[1,3]:='Calc';
      custedit3:='oocalc';
      end
   else
      if checklinapp('gnumeric')=true then
         begin
         StringGridCustedit.Cells[1,3]:='Gnumeric';
         custedit3:='gnumeric';
         end;
if checklinapp('lobase')=true then
   begin
   StringGridCustedit.Cells[1,4]:='Base';
   custedit4:='lobase';
   end
else
   if checklinapp('oobase')=true then
      begin
      StringGridCustedit.Cells[1,4]:='Base';
      custedit4:='oobase';
      end;
if checklinapp('loimpress')=true then
   begin
   StringGridCustedit.Cells[1,5]:='Impress';
   custedit5:='loimpress';
   end
else
   if checklinapp('ooimpress')=true then
      begin
      StringGridCustedit.Cells[1,5]:='Impress';
      custedit5:='ooimpress';
      end;
if checklinapp('lodraw')=true then
   begin
   StringGridCustedit.Cells[1,6]:='Draw';
   custedit6:='lodraw';
   end
else
   if checklinapp('oodraw')=true then
      begin
      StringGridCustedit.Cells[1,6]:='Draw';
      custedit6:='oodraw';
      end;
//video
if checklinapp('vlc')=true then
   begin
   StringGridCustedit.Cells[1,7]:='VLC';
   custedit7:='vlc';
   end;
if checklinapp('totem')=true then
   begin
   StringGridCustedit.Cells[1,8]:='Totem';
   custedit8:='totem';
   end
else
   if checklinapp('celluloid')=true then
      begin
      StringGridCustedit.Cells[1,8]:='Celluloid';
      custedit8:='celluloid';
      end
   else
      if checklinapp('parole')=true then
         begin
         StringGridCustedit.Cells[1,8]:='Parole';
         custedit8:='parole';
         end
      else
         if checklinapp('mplayer')=true then
            begin
            StringGridCustedit.Cells[1,8]:='mplayer';
            custedit8:='mplayer';
            end
         else
            if checklinapp('smplayer')=true then
               begin
               StringGridCustedit.Cells[1,8]:='smplayer';
               custedit8:='smplayer';
               end
            else
               if checklinapp('mpv')=true then
                  begin
                  StringGridCustedit.Cells[1,8]:='Mpv';
                  custedit8:='mpv';
                  end;
//audio
if checklinapp('rhythmbox')=true then
   begin
   StringGridCustedit.Cells[1,9]:='Rhythmbox';
   custedit9:='rhythmbox';
   end
else
   if checklinapp('juk')=true then
      begin
      StringGridCustedit.Cells[1,9]:='Juk';
      custedit9:='juk';
      end
   else
      if checklinapp('amarock')=true then
         begin
         StringGridCustedit.Cells[1,9]:='Amarok';
         custedit9:='amarock';
         end;
//graphics
if checklinapp('gimp')=true then
   begin
   StringGridCustedit.Cells[1,10]:='Gimp';
   custedit10:='gimp';
   end
else
   if checklinapp('inkscape')=true then
      begin
      StringGridCustedit.Cells[1,10]:='Inkscape';
      custedit10:='inkscape';
      end
   else
      if checklinapp('krita')=true then
      begin
      StringGridCustedit.Cells[1,10]:='Krita';
      custedit10:='krita';
      end;
if checklinapp('shotwell')=true then
   begin
   StringGridCustedit.Cells[1,11]:='Shotwell';
   custedit11:='shotwell';
   end
else
   if checklinapp('digikam')=true then
      begin
      StringGridCustedit.Cells[1,11]:='digiKam';
      custedit11:='digikam';
      end
   else
      if checklinapp('f-spot')=true then
         begin
         StringGridCustedit.Cells[1,11]:='F-Spot';
         custedit11:='f-spot';
         end;
if checklinapp('pix')=true then
   begin
   StringGridCustedit.Cells[1,12]:='Pix';
   custedit12:='pix';
   end
else
   if checklinapp('xviewer')=true then
      begin
      StringGridCustedit.Cells[1,12]:='XViewer';
      custedit12:='xviewer';
      end
   else
      if checklinapp('gnome-photos')=true then
         begin
         StringGridCustedit.Cells[1,12]:='Photos';
         custedit12:='gnome-photos';
         end
      else
         if checklinapp('ristretto')=true then
            begin
            StringGridCustedit.Cells[1,12]:='Ristretto';
            custedit12:='ristretto';
            end;
//browsers
if checklinapp('firefox')=true then
   begin
   StringGridCustedit.Cells[1,13]:='Mozilla Firefox';
   custedit13:='firefox';
   end;
if checklinapp('google-chrome')=true then
   begin
   StringGridCustedit.Cells[1,14]:='Google Chrome';
   custedit14:='google-chrome';
   end;
if checklinapp('opera')=true then
   begin
   StringGridCustedit.Cells[1,15]:='Opera';
   custedit15:='opera';
   end;
if checklinapp('web')=true then
   begin
   StringGridCustedit.Cells[1,16]:='Web';
   custedit16:='web';
   end
else
   if checklinapp('epiphany')=true then
      begin
      StringGridCustedit.Cells[1,16]:='Epiphany';
      custedit16:='epiphany';
      end
   else
      if checklinapp('konqueror')=true then
         begin
         StringGridCustedit.Cells[1,16]:='Konqueror';
         custedit16:='konqueror';
         end
      else
         if checklinapp('brave-browser')=true then
            begin
            StringGridCustedit.Cells[1,16]:='Brave';
            custedit16:='brave-browser';
            end
         else
            if checklinapp('midori')=true then
               begin
               StringGridCustedit.Cells[1,16]:='Midori';
               custedit16:='midori';
               end;
//AV
if checklinapp('clamscan')=true then
   begin
   StringGridCusteditAdv.Cells[1,1]:='ClamAV';
   advedit1before:='clamscan --bell -i -r ';
   advedit1after:='';
   advedit1alt:='';
   end;
if checklinapp('maldet')=true then
   begin
   StringGridCusteditAdv.Cells[1,2]:='LMD';
   advedit2before:='maldet -a ';
   advedit2after:='';
   advedit2alt:='';
   end;
{$ENDIF}
{$ENDIF}
end;
set_custedit_totable;
set_custedit_menus;
end;

procedure autobookmarks;
{$IFNDEF MSWINDOWS}
var
   s:ansistring;
{$ENDIF}
begin
try
assignfile(book,(confpath+'bookmarks.txt'));
rewrite(book);
write_header(book);
{$IFDEF MSWINDOWS}
writeln(book,'0');
writeln(book,'Computer''s root');
writeln(book,'*');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
wingetuserprofile;
writeln(book,'0');
writeln(book,home_path);
writeln(book,'*');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
wingetdesk;
writeln(book,'0');
writeln(book,desktop_path);
writeln(book,'*');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
//wingetdocuments;
writeln(book,'0');
writeln(book,usr_documents);
writeln(book,'*');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
wingetdownloads;
if usr_downloads<>'' then
   begin
   writeln(book,'0');
   writeln(book,usr_downloads);
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
if checkdirexists(home_path+'Dropbox') then
   begin
   writeln(book,'0');
   writeln(book,home_path+'Dropbox\');
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
if checkdirexists(home_path+'Google Drive') then
   begin
   writeln(book,'0');
   writeln(book,home_path+'Google Drive\');
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
if checkdirexists(home_path+'OneDrive') then
   begin
   writeln(book,'0');
   writeln(book,home_path+'OneDrive\');
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
if checkdirexists(home_path+'Workspaces') then
   begin
   writeln(book,'0');
   writeln(book,home_path+'Workspaces\');
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
if checkdirexists(home_path+'YandexDisk') then
   begin
   writeln(book,'0');
   writeln(book,home_path+'YandexDisk\');
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
{$ELSE}
get_home_path(s);
writeln(book,'0');
writeln(book,s);
writeln(book,'*');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
get_desktop_path(s);
writeln(book,'0');
writeln(book,s);
writeln(book,'*');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
writeln(book,'');
if usr_documents<>'' then
   begin
   writeln(book,'0');
   writeln(book,usr_documents);
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
if usr_downloads<>'' then
   begin
   writeln(book,'0');
   writeln(book,usr_downloads);
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
{$ENDIF}
CloseFile(book);
load_bookmarks;
except
end;
end;

function extractbookmarkname(s:ansistring):ansistring;
var s1:ansistring;
begin
s1:=s;
if translatespecialfolders(s1)=false then
   begin
   if length(s1)>1 then
      if s1[length(s1)]=directoryseparator then setlength(s1,length(s1)-1);
   if extractfilename(s1)<>'' then s1:=extractfilename(s1);
   end;
result:=s1;
end;

procedure load_bookmarks;
var
   s:ansistring;
   rc,i:integer;
begin
try
assignfile(book,(confpath+'bookmarks.txt'));
filemode:=0;
reset(book);
read_header(book, filemode);
if eof(book)=false then
   repeat
   readln(book,s);
   if s=' ' then break;
   rc:=FormPeach.StringGridBookmarks.Rowcount+1;
   FormPeach.StringGridBookmarks.RowCount:=rc;
   try
   i:=strtoint(s);
   case i of
      0: s:=txt_list_browsing;
      1: s:=txt_list_flat;
      2: s:=txt_list_found;
      else s:=txt_list_browsing;
      end;
   except
   //consider s saved as text like in older version of bookmarks
   end;
   FormPeach.StringGridBookmarks.Cells[1,rc-1]:=s;
   readln(book,s);
   FormPeach.StringGridBookmarks.Cells[2,rc-1]:=s;
   FormPeach.StringGridBookmarks.Cells[3,rc-1]:=extractbookmarkname(s);
   readln(book,s);
   FormPeach.StringGridBookmarks.Cells[4,rc-1]:=s;
   readln(book,s);
   FormPeach.StringGridBookmarks.Cells[5,rc-1]:=s;
   readln(book,s);
   FormPeach.StringGridBookmarks.Cells[6,rc-1]:=s;
   if savehistory=1 then
      begin
      readln(book,s);
      if s='' then s:='0';
      FormPeach.StringGridBookmarks.Cells[7,rc-1]:=s;
      readln(book,s);
      FormPeach.StringGridBookmarks.Cells[8,rc-1]:=s;
      readln(book,s);
      if s='' then s:=FormatDateTime('yyyy-mm-dd hh:mm:ss',now);
      FormPeach.StringGridBookmarks.Cells[9,rc-1]:=s;
      FormPeach.StringGridBookmarks.Cells[10,rc-1]:=inttostr(length(FormPeach.StringGridBookmarks.Cells[7,rc-1]))+FormPeach.StringGridBookmarks.Cells[7,rc-1];
      end
   else
      begin
      readln(book,s);
      FormPeach.StringGridBookmarks.Cells[7,rc-1]:='';
      readln(book,s);
      FormPeach.StringGridBookmarks.Cells[8,rc-1]:='';
      readln(book,s);
      FormPeach.StringGridBookmarks.Cells[9,rc-1]:='';
      FormPeach.StringGridBookmarks.Cells[10,rc-1]:='';
      end;
   FormPeach.StringGridBookmarks.Cells[11,rc-1]:='0';
   until eof(book);
FormPeach.StringGridBookmarks.AutosizeColumns;
FormPeach.StringGridBookmarks.ColWidths[10]:=0;
FormPeach.StringGridBookmarks.ColWidths[11]:=0;
FormPeach.StringGridBookmarks.ColWidths[0]:=rowsize;
if FormPeach.StringGridBookmarks.Rowcount>1 then
   FormPeach.StringGridBookmarks.Cells[11,1]:='1';
CloseFile(book);
if FormPeach.StringGridBookmarks.Rowcount<=1 then
   if s=' ' then
   else
      autobookmarks;
except
   try
   CloseFile(book);
   except
   end;
   autobookmarks;
end;
end;

procedure load_custedit;
var
   s:ansistring;
begin
if fileexists(confpath+'custedit.txt')=false then
   begin
   reset_custedit;
   exit;
   end;
try
assignfile(cedit,(confpath+'custedit.txt'));
filemode:=0;
reset(cedit);
read_header(cedit, filemode);
readln(cedit,s); if s<>'[custom editors/players, override system''s file associations, 4.2+]' then
   begin
   reset_custedit; //reset to defaults if custedit is not found (don't reset if it is empty)
   try
   CloseFile(cedit);
   except
   end;
   exit;
   end;
with FormPeach do
begin
readln(cedit,s); StringGridCustedit.Cells[1,1]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,2]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,3]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,4]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,5]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,6]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,7]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,8]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,9]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,10]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,11]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,12]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,13]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,14]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,15]:=s;
readln(cedit,s); StringGridCustedit.Cells[1,16]:=s;
readln(cedit,s); custedit1:=s;
readln(cedit,s); custedit2:=s;
readln(cedit,s); custedit3:=s;
readln(cedit,s); custedit4:=s;
readln(cedit,s); custedit5:=s;
readln(cedit,s); custedit6:=s;
readln(cedit,s); custedit7:=s;
readln(cedit,s); custedit8:=s;
readln(cedit,s); custedit9:=s;
readln(cedit,s); custedit10:=s;
readln(cedit,s); custedit11:=s;
readln(cedit,s); custedit12:=s;
readln(cedit,s); custedit13:=s;
readln(cedit,s); custedit14:=s;
readln(cedit,s); custedit15:=s;
readln(cedit,s); custedit16:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,1]:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,2]:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,3]:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,4]:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,5]:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,6]:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,7]:=s;
readln(cedit,s); StringGridCustEditAdv.Cells[1,8]:=s;
readln(cedit,s); advedit1before:=s;
readln(cedit,s); advedit2before:=s;
readln(cedit,s); advedit3before:=s;
readln(cedit,s); advedit4before:=s;
readln(cedit,s); advedit5before:=s;
readln(cedit,s); advedit6before:=s;
readln(cedit,s); advedit7before:=s;
readln(cedit,s); advedit8before:=s;
readln(cedit,s); advedit1after:=s;
readln(cedit,s); advedit2after:=s;
readln(cedit,s); advedit3after:=s;
readln(cedit,s); advedit4after:=s;
readln(cedit,s); advedit5after:=s;
readln(cedit,s); advedit6after:=s;
readln(cedit,s); advedit7after:=s;
readln(cedit,s); advedit8after:=s;
readln(cedit,s); advedit1alt:=s;
readln(cedit,s); advedit2alt:=s;
readln(cedit,s); advedit3alt:=s;
readln(cedit,s); advedit4alt:=s;
readln(cedit,s); advedit5alt:=s;
readln(cedit,s); advedit6alt:=s;
readln(cedit,s); advedit7alt:=s;
readln(cedit,s); advedit8alt:=s;
end;
set_custedit_totable;
set_custedit_menus;
CloseFile(cedit);
except
   reset_custedit; //reset to defaults if custedit is not found (don't reset if it is empty)
   try
   CloseFile(cedit);
   except
   end;
end;
end;

procedure save_conf;
{
configuration is saved each time the application closed, or launches a new instance, or leaving settings interface
it is not saved launching pealauncher because relevant options are modified in setting interfaces
}
begin
if stayopen=false then try closefile(conf); except end;
   try
      assignfile(conf,confpath+'conf.txt');
      rewrite(conf);
      write_header(conf);
      if theme_path<>'' then writeln(conf,theme_path)
      else writeln(conf,'');
      writeconf_colors;
      writeconf_defaults;
      CloseFile(conf);
   except
      try
         CloseFile(conf);
      except
      end;
   end;
end;

procedure theme_failure;
begin
   load_default_theme;
   graphicsfolder:=graphicsfolderd;
   opacity:=opacityd;
   color1:=color1d;
   color2:=color2d;
   color3:=color3d;
   color4:=color4d;
   color5:=color5d;
   pspacing:=pspacingd;
   pzoom:=pzoomd;
   ensmall:=ensmalld;
   usealtcolor:=usealtcolord;
   highlighttabs:=highlighttabsd;
   accenttoolbar:=accenttoolbard;
   toolcentered:=toolcenteredd;
   altaddressstyle:=altaddressstyled;
   solidaddressstyle:=solidaddressstyled;
   alttabstyle:=alttabstyled;
   temperature:=temperatured;
   contrast:=contrastd;
   decostyle:=decostyled;
   imgloaded:=false;
   apply_theme;
   try
      CloseFile(conf);
   except
   end;
end;

function checkstopsequencefile:boolean;
begin
result:=fileexists(fget_usrtmp_path+STR_STOPALL);
end;

procedure clearstopsequencefile;
begin
if fileexists(fget_usrtmp_path+STR_STOPALL) then
try
udeletefile (fget_usrtmp_path+STR_STOPALL);
except
sleep(500);
udeletefile (fget_usrtmp_path+STR_STOPALL);
end;
end;

procedure load_conf;
var
  seqstep,s:ansistring;

procedure conf_volatile; //working configuration with embedded values
begin
default_defaults;
load_default_theme;
graphicsfolder:=graphicsfolderd;
opacity:=opacityd;
color1:=color1d;
color2:=color2d;
color3:=color3d;
color4:=color4d;
color5:=color5d;
pspacing:=pspacingd;
pzoom:=pzoomd;
ensmall:=ensmalld;
usealtcolor:=usealtcolord;
highlighttabs:=highlighttabsd;
accenttoolbar:=accenttoolbard;
toolcentered:=toolcenteredd;
altaddressstyle:=altaddressstyled;
solidaddressstyle:=solidaddressstyled;
alttabstyle:=alttabstyled;
temperature:=temperatured;
contrast:=contrastd;
decostyle:=decostyled;
//imgloaded:=false;
//apply_theme;
texts('volatile');
updateconf;
set_listview_col;
FormPeach.LabelConf.Caption:='';
indir:={$IFDEF MSWINDOWS}txt_mypc;{$ELSE}'/';{$ENDIF}
end;

procedure writeerror_file;
begin
try
assignfile(conf,confpath+'peazip-error.txt');
rewrite(conf);
writeln(conf,seqstep);
//1 error in altconf 2 conf unusable 2a conf unreadable 2b conf cannot be re-pmccreated from scratch
CloseFile(conf);
except
end;
end;

function writedconf_file:integer;
begin
result:=-1;
assignfile(conf,confpath+'conf.txt');
rewrite(conf);
write_header(conf);
writeln(conf,theme_path);
writeconf_default_colors;
lang_file:='default.txt'; //set default language
writeconf_defaults;
CloseFile(conf);
result:=0;
end;

function readconf_file:integer;
var
   s:ansistring;
begin
result:=-1;
try
assignfile(conf,confpath+'conf.txt');
filemode:=0;
reset(conf);
read_header(conf, filemode);
readln(conf,theme_path);
readconf_colors;
readln(conf,s);
readln(conf,lang_file);
texts(lang_file);
readconf_defaults;
CloseFile(conf);
except
df:=18;
pf:=15;//reset default format / previous format in case of configuration error, to be enabled when new formats are introduced
CloseFile(conf);
end;
result:=0;
end;

function conf_failure:integer;
begin
result:=-1;
seqstep:='2b';
sleep(500);
try
   try CloseFile(conf); except end;
   conf_volatile;
   if writedconf_file<>0 then exit;
   result:=readconf_file;
except
   result:=-1;
   try CloseFile(conf); except end;
end;
end;

function conf_checktype: integer;
var
   s:ansistring;
begin
result:=-1;
//Installable packages can create binpath and sharepath as links in (peazip)/res
//so actual locations can be delegated to distro-specific installers
//This mechanism can also be used for confpath on unsupprted systems, non compliant
//neither with Windows nor with Open Desktop standard
{$IFDEF DARWIN}
binpath:=executable_path+'bin'+directoryseparator;//binaries, architecture dependant
{$ELSE}
binpath:=resource_path+'bin'+directoryseparator;//binaries, architecture dependant
{$ENDIF}
sharepath:=resource_path+'share'+directoryseparator;//non binaries resources, non-architecture dependant
if FileExists(resource_path+'portable') then //if file exists, assume portable version
   begin
   confpath:=resource_path+'conf'+directoryseparator; //configuration (portable)
   end
else
   begin
   {$IFDEF MSWINDOWS}
   if wingetappdata(confpath)<>0 then confpath:=(GetEnvironmentVariable('APPDATA'))+'\PeaZip\'; //if wingetappdata fails use env variables
   {$ELSE}
   s:=GetEnvironmentVariable('XDG_CONFIG_HOME');
   if s<>'' then confpath:=s+'/peazip/'
   else
      begin
      get_home_path(s);
      confpath:=s+'/.config/peazip/';
      end;
   {$ENDIF}
   if not(checkdirexists(confpath)) then forcedirectories(confpath);
   confpath:=ExpandFileName(confpath);
   if confpath<>'' then
      if confpath[length(confpath)]<>directoryseparator then confpath:=confpath+directoryseparator;
   if not(checkdirexists(confpath)) then confpath:=resource_path+'conf'+directoryseparator; //if alternative configuration directory does not exist or is not accessible, use res path
   end;
if HBINPATH<>'' then binpath:=HBINPATH;
if HCONFPATH<>'' then confpath:=HCONFPATH;
if HSHAREPATH<>'' then sharepath:=HSHAREPATH;
result:=0;
end;

begin
//0) initialize with default embedded values
conf_volatile;
//1) check if configuration is portable or installable
seqstep:='1';
if conf_checktype<>0 then
   begin
   sleep(500);
   try CloseFile(aconf); except end;
   if conf_checktype<>0 then
      begin
      conf_volatile;
      writeerror_file;
      exit;
      end;
   end;
//parts needing conf type/path being initialized
if (paramstr(1)='-peazipreset') or (paramstr(1)='-peaziptotalreset') then //eliminate issues that may not allow even to read configuration file
   begin
   assignfile(conf,confpath+'peazip-reset.txt');
   rewrite(conf);
   writeln(conf,' ');
   CloseFile(conf);
   clearstopsequencefile;
   end;
persistent_source:=confpath+'rnd';
//2 read actual configuration
seqstep:='2';
try readconf_file; except seqstep:='2a'; checkver:=''; end;
if checkver<>'PeaZip' then //conf error or not loaded
   begin
   if fileexists(confpath+'peazip-reset.txt') then udeletefile(confpath+'peazip-reset.txt')
   else
      begin
      try CopyFile(confpath+'conf-lastgood.txt',confpath+'conf.txt',[cffOverwriteFile]); except end; //try last good known conf
      try readconf_file; except checkver:=''; end;
      end;
   if checkver<>'PeaZip' then //try to write a default configuration and load it
      if conf_failure<>0 then
         begin
         conf_volatile;
         writeerror_file;
         exit;
         end;
   end
else
   begin
   try CopyFile(confpath+'conf.txt',confpath+'conf-lastgood.txt',[cffOverwriteFile]); except end;
   if fileexists(confpath+'peazip-reset.txt') then udeletefile(confpath+'peazip-reset.txt');
   end;
//load theme (configuration is fully loaded before loading and applying theme)
s:=extractfilepath(theme_path);
if s<>'' then setlength(s,length(s)-1);
theme_name:=extractfilename(s);
if theme_name<>DEFAULT_THEME then
   try
   imgloaded:=false;
   load_theme;
   check_theme_failure;
   apply_theme;
   except
   theme_failure;
   apply_theme;
   end
else apply_theme;
//check theming and configuration values, apply if correct
check_defaults_failure;
updateconf;
FormPeach.LabelConf.Caption:=confpath;
end;

procedure configure_systemintegration(pwait:boolean);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=stringdelim(escapefilename(binpath,desk_env)+'Configure PeaZip'+EXEEXT)+' /DIR='+stringdelim(escapefilename(executable_path,desk_env));
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
if pwait=true then P.Options := [poNoConsole, poWaitOnExit]
else P.Options := [poNoConsole];
if FormPeach.Visible=true then Application.ProcessMessages;
peapexecute(P,cl);
P.Free;
{$ENDIF}
end;

procedure extracttheme(var s:ansistring);
var
   cl,in_param,out_param,bin_name:ansistring;
   P:tprocessutf8;
begin
if s<>'' then
   begin
   in_param:=stringdelim(escapefilename(s,desk_env));
   out_param:=stringdelim('-o'+escapefilename(confpath+'themes'+directoryseparator,desk_env));
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
   if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
   cl:=bin_name+' x -aoa '+out_param+' '+in_param;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   if FormPeach.Visible=true then Application.ProcessMessages;
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
   peapexecute(P,cl);
   P.Free;
   cutextension(s);
   s:=s+directoryseparator+'theme.txt';
   end;
end;

function loadthemefile(s:ansistring):integer;
var
   s1:ansistring;
begin
result:=-1;
if pos('.THEME',upcase(s))=0 then
   begin
   result:=1;
   exit;
   end;
s1:=s;
cutextension(s1);//archive extension
cutextension(s1);//.theme extension
theme_path:='themes'+directoryseparator+extractfilename(s1)+directoryseparator+'theme.txt';
theme_name:=extractfilename(s1);
if (upcase(extractfileext(s))='.ZIP') or (upcase(extractfileext(s))='.7Z') or (upcase(extractfileext(s))='.RAR') then
   extracttheme(s)
else
   begin
   result:=2;
   exit;
   end;
load_theme;
check_theme_failure;
result:=0;
end;

procedure ComboBoxTheme_onchange;
var
   s,s1:ansistring;
begin
with FormPeach do
begin
case ComboBoxTheme.ItemIndex of
   0: begin
      try
         s:=sharepath+'themes'+directoryseparator+DEFAULT_THEME+directoryseparator+'theme.txt';
         theme_name:=DEFAULT_THEME;
         theme_path:=extractrelativepath(sharepath,s);
         load_theme;
         check_theme_failure;
      except
         theme_failure;
         exit;
      end;
      end;
   1: begin
      try
      s:=sharepath+'themes'+directoryseparator+'mac.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   2: begin
      try
      s:=sharepath+'themes'+directoryseparator+'main.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   3: begin
      try
      s:=sharepath+'themes'+directoryseparator+'ten.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   4: begin
      try
      s:=sharepath+'themes'+directoryseparator+'tux.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   5: begin
      OpenDialogTheme.initialdir:=sharepath+'themes'+directoryseparator;
      OpenDialogTheme.execute;
      if OpenDialogTheme.FileName<>'' then
         try
            s:=OpenDialogTheme.FileName;
            if loadthemefile(s)<>0 then
               begin
               theme_failure;
               exit;
               end;
         except
            theme_failure;
            exit;
         end
      else exit;
      end;
   end;
if ((s<>'') and (theme_path<>'')) then
   try
      assignfile(conf,confpath+'conf.txt');
      rewrite(conf);
      write_header(conf);
      writeln(conf,s);
      writeln(conf,graphicsfolderd);
      writeln(conf,opacityd);
      writeln(conf,color1d);
      writeln(conf,color2d);
      writeln(conf,color3d);
      writeln(conf,color4d);
      writeln(conf,color5d);
      writeln(conf,inttostr(usealtcolord)+inttostr(highlighttabsd)+inttostr(accenttoolbard)+inttostr(toolcenteredd)+inttostr(altaddressstyled)+inttostr(solidaddressstyled)+inttostr(alttabstyled)+inttostr(ensmalld)+inttostr(contrastd)+inttostr(decostyled));
      writeln(conf,pzoomd);
      writeln(conf,pspacingd);
      writeln(conf,temperatured);
      CloseFile(conf);
   except
      pMessageWarningOK(txt_conf_cannotsave);
      try
         CloseFile(conf);
      except
      end;
   end;
graphicsfolder:=graphicsfolderd;
opacity:=opacityd;
color1:=color1d;
color2:=color2d;
color3:=color3d;
color4:=color4d;
color5:=color5d;
pspacing:=pspacingd;
pzoom:=pzoomd;
ensmall:=ensmalld;
usealtcolor:=usealtcolord;
highlighttabs:=highlighttabsd;
accenttoolbar:=accenttoolbard;
toolcentered:=toolcenteredd;
altaddressstyle:=altaddressstyled;
solidaddressstyle:=solidaddressstyled;
alttabstyle:=alttabstyled;
temperature:=temperatured;
contrast:=contrastd;
decostyle:=decostyled;
imgloaded:=false;
apply_theme;
setbrowsertype(browsertype);
end;
settoolbar;
UnitGwrap.graphicsfolder:=graphicsfolder;
UnitGwrap.color1:=color1;
UnitGwrap.color2:=color2;
UnitGwrap.color3:=color3;
UnitGwrap.color4:=color4;
UnitGwrap.color5:=color5;
UnitGwrap.settheme;
end;

procedure setwindowsopacity;
begin
if (opacity<100) or (spinchanged=true) then
   begin
   if opacity<100 then FormPeach.AlphaBlend:=true else FormPeach.AlphaBlend:=false;
   FormPeach.AlphaBlendValue:=255+opacity-100;
   end;
spinchanged:=false;
FormPeach.SpinEditOpacity.Value:=opacity;
if opacity<100 then
   begin
   FormGwrap.AlphaBlend:=true;
   FormGwrap.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormAdvf.AlphaBlend:=true;
   FormAdvf.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormComment.AlphaBlend:=true;
   FormComment.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormDlg.AlphaBlend:=true;
   FormDlg.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   //FormDrop has custom opacity
   FormImgCrop.AlphaBlend:=true;
   FormImgCrop.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormImgRes.AlphaBlend:=true;
   FormImgRes.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormImgViewer.AlphaBlend:=true;
   FormImgViewer.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormInput.AlphaBlend:=true;
   FormInput.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormKF.AlphaBlend:=true;
   FormKF.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormPaths.AlphaBlend:=true;
   FormPaths.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormPM.AlphaBlend:=true;
   FormPM.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormPW.AlphaBlend:=true;
   FormPW.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   FormSelect.AlphaBlend:=true;
   FormSelect.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   Formweb.AlphaBlend:=true;
   Formweb.AlphaBlendValue:=FormPeach.AlphaBlendValue;
   end;
end;

procedure apply_conf;
begin

if work_dir=3 then
   if (custom_work_path<>'') and checkdirexists(custom_work_path) then
      begin
      peaziptmpdir:=custom_work_path;
      if peaziptmpdir[length(peaziptmpdir)]<>DirectorySeparator then peaziptmpdir:=peaziptmpdir+DirectorySeparator;
      peaziptmpdirroot:=peaziptmpdir;
      peaziptmpdir:=peaziptmpdir+STR_PZWORKTMP+DirectorySeparator+STR_PEAZIPTMP+DirectorySeparator;
      ForceDirectories(peaziptmpdir);
      end;

{$IFDEF MSWINDOWS}
//Windows handle up to 32KB maximum command line length
max_cl:=32768;
{$ELSE}
//32KB to 2MB custom maximum command line length is now supported for Linux Systems
max_cl:=131072;
case maxargsize of
   0: max_cl:=32*1024;
   1: max_cl:=64*1024;
   2: max_cl:=128*1024;
   3: max_cl:=256*1024;
   4: max_cl:=512*1024;
   5: max_cl:=1024*1024;
   6: max_cl:=1536*1024;
   7: max_cl:=2048*1024;
end;
{$ENDIF}
end;

{///////////////////////////////////////////////////////////////////////////////

subsection PROFILES load and save different configuration profiles

///////////////////////////////////////////////////////////////////////////////}

procedure msg_pw_errorchar(s:ansistring);
begin
pMessageWarningOK(correctdelimiter(s)+' '+txt_2_3_pw_errorchar);
end;

procedure load_profile;
var
   sprofile,cl,in_param,out_param,bin_name,pw,dummystr,s:AnsiString;
   i:integer;
   {$IFDEF MSWINDOWS}exepath,langreg,forcereg:widestring;{$ENDIF}
begin
//select new profile
ForceDirectories(confpath+'Profiles');
FormPeach.OpenDialogProfile.initialdir:=confpath+'Profiles'+directoryseparator;
FormPeach.OpenDialogProfile.execute;
if FormPeach.OpenDialogProfile.FileName<>'' then
   try
      sprofile:=FormPeach.OpenDialogProfile.FileName;
      if not(FileExists(sprofile)) then exit;
   except
      exit;
   end
else exit;
if pMessageWarningYesNo(ExtractFileName(sprofile)+char($0D)+char($0A)+txt_9_6_loadpconfirm)<>6 then exit;
//test for encryption
dummystr:=FormPeach.EditOpenIn.Caption;
FormPeach.EditOpenIn.Caption:=sprofile;
if testencrypted_fromname(sprofile,'closed')=2 then exit;
FormPeach.EditOpenIn.Caption:=dummystr;
pw:=FormPW.EditPWpass.Text;
if FormPW.EditPWkeyfile.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
pforceconsole:=0;
pipepw:='';
piperar:=false;
if pw<>'' then
   begin
   if zaout=2 then pipepw:=pw;
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      pforceconsole:=1;
      pw:='';
      end;
   end
else if zaout>0 then
   begin
   pw:='-pdefault';
   pipepw:='default';
   end;
//clear existing profile
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
reset_temp(1);
clearstopsequencefile;
dohistoryreset;
udeletefile(confpath+'conf.txt');
udeletefile(confpath+'conf-lastgood.txt');
udeletefile(confpath+'textpreview.txt');
udeletefile(confpath+'tabs.txt');
udeletefile(confpath+'bookmarks.txt');
udeletefile(confpath+'custedit.txt');
udeletefile(confpath+'pm');
cleardirsimple(confpath+'Compression settings');
cleardirsimple(confpath+'Layouts');
cleardirsimple(confpath+'Scheduled scripts');
cleardirsimple(confpath+'Scripts');
cleardirsimple(confpath+'themes');
//extract new profile
in_param:=stringdelim(escapefilename(sprofile,desk_env));
out_param:=stringdelim('-o'+escapefilename(confpath,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
cl:=bin_name+' x -aoa ';
if intpw=1 then
   begin
   pw:='';
   pforceconsole:=1;
   end;
if pw<>'' then
   if (pipepw<>'') and (consolecl=false) then else cl:=cl+' '+pw;
cl:=cl+' '+out_param+' '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
if execute_cl_simple(cl)<>0 then pMessageerrorOK(txt_6_5_error+' '+confpath+'Profiles'+DirectorySeparator+s+'.profile.7z');
{$IFDEF MSWINDOWS}
if (winver='nt6+') and (majmin<>'6.0') then
   if not(FileExists(resource_path+'portable')) then //if Windows instalable version
   begin
   try
      assignfile(conf,confpath+'conf.txt');
      filemode:=0;
      reset(conf);
      for i:=1 to 13 do readln(conf,dummystr);
      readln(conf,s);
      CloseFile(conf);
   except
      CloseFile(conf);
   end;
   if s<>lang_file then
      begin
      exepath:=utf8decode(sharepath);
      cutextension(s);
      langreg:=utf8decode(s)+'.reg';
      forcereg:='';
      if FileExists(sharepath+'lang-wincontext\'+s+'.reg') then
         begin
         {$IFDEF WIN32} try if IsWindows64=true then forcereg:=' /reg:64'; except end; {$ENDIF}
         ShellExecuteW(FormPeach.Handle, PWideChar ('runas'), PWideChar('reg'), PWideChar ('import "'+exepath+'lang-wincontext\'+langreg+'"'+forcereg), PWideChar (''), SW_SHOWNORMAL);
         end;
      end;
   end;
{$ENDIF}
restartpeaapp;
exit_nosave;
end;

procedure save_profile;
var
   cl,work_path,bin_name,in_param,out_param,s,pw_option,pw2_option,pw:ansistring;
begin
save_conf;
ForceDirectories(confpath+'Profiles');
FormPeach.SaveDialogAS.FileName:='profile';
FormPeach.SaveDialogAS.InitialDir:=confpath+'Profiles';
if FormPeach.SaveDialogAS.Execute then
   if FormPeach.SaveDialogAS.FileName<>'' then
      begin
      s:=extractfilename(FormPeach.SaveDialogAS.FileName);
      if pos('.profile.7z',s)<>0 then
         begin
         setlength(s, length(s) - 11);
         end;
      end
      else exit
   else exit;
if s='' then exit;
//delete if exists
if FileExists(confpath+'Profiles'+DirectorySeparator+s+'.profile.7z') then
   if pMessageWarningYesNo(txt_9_6_savepoverwrite)=6 then
      udeletefile(confpath+'Profiles'+DirectorySeparator+s+'.profile.7z')
   else
      exit;
//password, optional
pw:='';
pw_option:='';
pw2_option:='';
if pMessageInfoYesNo(txt_9_6_saveppw)=6 then
begin
ask_pwkeyfile;
if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
   if (FormPW.CheckBoxEncFn.State= cbChecked) then
      begin
      pw_option:='-p';
      pw2_option:='-mhe=on';
      end
   else
      begin
      pw_option:='-p';
      pw2_option:='';
      end
else
   begin
   pw_option:='';
   pw2_option:='';
   end;
pipepw:='';
piperar:=false;
if pw_option<>'' then
   begin
   pw:=FormPW.EditPWpass.Text;
   if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
   if zaout=2 then pipepw:=pw;
      if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      pforceconsole:=1;
      pw:='-p';
      end;
   end;
end;
in_param:=stringdelim(escapefilename(confpath+'*',desk_env));
out_param:=confpath+'Profiles'+DirectorySeparator+s+'.profile.7z';
getworkpath(work_path,out_param);
out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT)+' a -t7z -m0=LZMA -mmt=on -mx5 -md=16m -mfb=32 -ms=2g';
if sys7zlin>0 then bin_name:=alias7z+EXEEXT+' a -t7z -m0=LZMA -mmt=on -mx5 -md=16m -mfb=32 -ms=2g';
if work_path<>'' then bin_name:=bin_name+' '+work_path;
cl:=bin_name;
if (pw='-p') or (pw=stringdelim('-p')) then pw:='';//never pass empty password to pipe mode
if intpw=1 then
   begin
   pw:='-p';
   pforceconsole:=1;
   if (setencfn=1) and (archive_type='7z') then
      pw2_option:='-mhe=on'
   else
      pw2_option:='';
   end;
if pw<>'' then
   begin
   if (pipepw<>'') and (consolecl=false) then cl:=cl+' -p' else cl:=cl+' '+pw;
   if pw2_option<>'' then cl:=cl+' '+pw2_option;
   end;
cl:=cl+' '+out_param+' '+in_param+' '+delimiter+'-xr0!profiles'+delimiter;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
if execute_cl_simple(cl)=0 then pMessageInfoOK(txt_done+' '+confpath+'Profiles'+DirectorySeparator+s+'.profile.7z');
end;

{///////////////////////////////////////////////////////////////////////////////

subsection PRESETS load and save pre-defined compression settings

///////////////////////////////////////////////////////////////////////////////}

procedure save_presets(presetfilename: ansistring);
begin
   try
      assignfile(t,presetfilename);
      rewrite(t);
      writeln(t,'PEAZIP CUSTOM COMPRESSION SETTINGS');
      writeln(t,'To replace an existing preset with a custom compression settings file, copy the desired custom compression settings file in PeaZip\res\share\presets folder, in place of one of the existing preset files (named 1..15).');
      writeln(t,'Displayed name, below, can be edited and will be shown in presets menu in place of the name of the replaced preset (displayed names in embedded presets are 1..15, and are translated to language-dependant strings).');
      writeln(t,FormPeach.cbType.Text+' '+datetimetostr(now));
      writeln(t,'');
      writeln(t,'GENERAL OPTIONS');
      writeln(t,'Type');
      writeln(t,FormPeach.cbType.Text);
      writeln(t,FormPeach.cbType.ItemIndex);
      writeln(t,'Compression level');
      writeln(t,inttostr(FormPeach.cbLevel.ItemIndex));
      writeln(t,'Action');
      writeln(t,inttostr(FormPeach.cbAct.ItemIndex));
      writeln(t,'Spanning');
      writeln(t,inttostr(FormPeach.cbSplit.ItemIndex));
      writeln(t,inttostr(FormPeach.SpinEditSplit.Value));
      writeln(t,inttostr(FormPeach.ComboBoxSplit.ItemIndex));
      writeln(t,'Add to separate archives');
      if FormPeach.checkboxseparate.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Archive to original path');
      if FormPeach.CheckBoxSameArc.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Convert');
      if FormPeach.CheckBoxConvert.Checked=true then writeln(t,'1') else writeln(t,'0');
      if FormPeach.CheckBoxConvertPW.Checked=true then writeln(t,'1') else writeln(t,'0');
      if FormPeach.CheckBoxConvertVerbose.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Delete files after archiving (be careful)');
      if FormPeach.CheckBoxDeleteInputAdd.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,inttostr(FormPeach.cbDeleteInputModeAdd.ItemIndex));
      writeln(t,'Open output path when task completes');
      if FormPeach.CheckBoxAutoOpen.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Send by mail');
      if FormPeach.CheckBoxMailAdd.Checked=true then writeln(t,'1') else writeln(t,'0');
      if FormPeach.CheckBoxMailKeep.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'TAR before compressing/archiving');
      if FormPeach.CheckBoxTarBefore.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Close PeaZip when task completes');
      if FormPeach.CheckBoxClosePeaZip.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Halt system when task is completed');
      if FormPeach.CheckBoxAutoHaltA.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Add .enc suffix to encrypted archives');
      if FormPeach.cbEncExtension.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Add timestamp to archive name');
      if FormPeach.CheckBoxDate.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,inttostr(FormPeach.cbTimeStamp.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: 7z / p7zip');//7Z
      writeln(t,'Method');
      writeln(t,inttostr(FormPeach.ComboBox7zMethod.ItemIndex));
      writeln(t,'Dictionary');
      writeln(t,inttostr(FormPeach.ComboBox7zDictionary.ItemIndex));
      writeln(t,'Word');
      writeln(t,inttostr(FormPeach.ComboBox7zWord.ItemIndex));
      writeln(t,'Passes');
      writeln(t,inttostr(FormPeach.ComboBox7zPasses.ItemIndex));
      writeln(t,'Solid block size');
      writeln(t,inttostr(FormPeach.ComboBox7zSolid.ItemIndex));
      writeln(t,'Sort by name for solid compression');
      if FormPeach.CheckBoxSolidExtension.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Compress files open for writing');
      if FormPeach.CheckBox7zOF.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'SFX module');
      writeln(t,inttostr(FormPeach.RadioGroup7zSFX.ItemIndex));
      writeln(t,'Paths: relative, full, absolute');
      writeln(t,inttostr(FormPeach.ComboBox7zPaths.ItemIndex));
      writeln(t,'Threads');
      writeln(t,inttostr(FormPeach.ComboBox7zThreads.ItemIndex));
      writeln(t,'Other options');
      writeln(t,FormPeach.Edit7zOpt.Text);
      writeln(t,'Include NT secutity info (WIM)');
      if FormPeach.CheckBoxsni.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Include NTFS Alternate Data Stream (WIM)');
      if FormPeach.CheckBoxsns.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Encryption algorithm (if password and/or keyfile is provided)');
      writeln(t,inttostr(FormPeach.ComboBox7zalgo.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: FreeArc');//ARC
      writeln(t,'Solid mode');
      writeln(t,inttostr(FormPeach.ComboBoxArcSolid.ItemIndex));
      writeln(t,'Recovery records');
      if FormPeach.CheckBoxARCrr.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'SFX module');
      if FormPeach.CheckBoxARCsfx.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,inttostr(FormPeach.ComboBoxArcSfx.ItemIndex));
      writeln(t,'Other options');
      writeln(t,FormPeach.EditOParc.Text);
      writeln(t,'Absolute paths');
      if FormPeach.CheckBoxARCabs.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Encryption algorithm (if password and/or keyfile is provided)');
      writeln(t,inttostr(FormPeach.ComboBoxARCalgo.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: Custom');//CUSTOM
      writeln(t,'Executable');
      writeln(t,FormPeach.EditNameCustom.Text);
      writeln(t,'Extension');
      writeln(t,FormPeach.EditExtensionCustom.Text);
      writeln(t,'Other options');
      writeln(t,FormPeach.EditOPcustom.Text);
      writeln(t,'Syntax');
      writeln(t,inttostr(FormPeach.ComboBoxArchiveCustom.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: PAQ/LPAQ/ZPAQ');//PAQ
      writeln(t,'Executable');
      writeln(t,inttostr(FormPeach.RadioGroupPaq.ItemIndex));
      writeln(t,'Compression');
      writeln(t,inttostr(FormPeach.ComboBoxPAQLevel.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: PEA');//PEA
      writeln(t,'Compression');
      writeln(t,inttostr(FormPeach.ComboBoxPEALevel.ItemIndex));
      writeln(t,'Object control algorithm');
      writeln(t,inttostr(FormPeach.ComboBoxPEAObj.ItemIndex));
      writeln(t,'Volume control algorithm');
      writeln(t,inttostr(FormPeach.ComboBoxPEAVol.ItemIndex));
      writeln(t,'Stream control algorithm');
      writeln(t,inttostr(FormPeach.ComboBoxPEAStream.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: QUAD/BALZ/BCM');//QUAD
      writeln(t,'Executable');
      writeln(t,inttostr(FormPeach.RadioGroupQuad.ItemIndex));
      writeln(t,'Maximum compression mode');
      if FormPeach.CheckBoxQuadMax.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Solid block size');
      writeln(t,inttostr(FormPeach.ComboBoxBCMSolid.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: Split');//RFS
      writeln(t,'Integrity check');
      writeln(t,inttostr(FormPeach.ComboBoxSplitAlgo.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: UPX');//UPX
      writeln(t,'Compression');
      writeln(t,inttostr(FormPeach.ComboBoxUPX.ItemIndex));
      writeln(t,'Run strip before UPX (recommended)');
      if FormPeach.CheckBoxUPXStrip.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Backup executable (recommended)');
      if FormPeach.CheckBoxUPXBackup.Checked=true then writeln(t,'1') else writeln(t,'0');

      writeln(t,'');
      writeln(t,'SPECIAL OPTIONS');//extra actions
      writeln(t,'Interactively ask for password');
      writeln(t,'0');

      writeln(t,'');
      writeln(t,'7.3.0 EXTENSION');
      writeln(t,'Set 7z / p7zip archive time from most recent file time');
      if FormPeach.CheckBoxstl.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Maximize Brotli compression using larger window size (may be incompatible with some Brotli extractors)');
      if FormPeach.CheckBoxBrotli.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Maximize Zstandard compression using larger window size');
      if FormPeach.CheckBoxZstd.Checked=true then writeln(t,'1') else writeln(t,'0');

      writeln(t,'');
      writeln(t,'7.4.0 EXTENSION');
      writeln(t,'Use Rar.exe if available');
      if FormPeach.cbRAR.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Create RAR5');
      if FormPeach.cbRAR5.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR5 dictionary size');
      writeln(t,inttostr(FormPeach.comboRARdict.ItemIndex));
      writeln(t,'RAR5 use BLAKE2 instead of CRC');
      if FormPeach.cbRARBLAKE2.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR create sfx archive');
      if FormPeach.cbRARsfx.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR create solid archive');
      if FormPeach.cbRARsolid.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR create recovery records');
      if FormPeach.cbRARrr.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR recovery records %');
      writeln(t,inttostr(FormPeach.seRARrr.Value));
      writeln(t,'RAR save files open for writing');
      if FormPeach.cbRARsaveopen.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR save NT security info');
      if FormPeach.cbRARsavesecurity.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR save NTFS streams');
      if FormPeach.cbRARsavestreams.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR set archive time from: system time, original archive time, most recent file time');
      writeln(t,inttostr(FormPeach.cbRARlastmodtime.ItemIndex));
      writeln(t,'RAR lock archive');
      if FormPeach.cbRARlock.Checked=true then writeln(t,'1') else writeln(t,'0');

      writeln(t,'');
      writeln(t,'7.8.0 EXTENSION');
      writeln(t,'Custom archive extension');
      if FormPeach.cbCustomExtension.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,FormPeach.EditCustomExtension.Caption);

      writeln(t,'');
      writeln(t,'8.2.0 EXTENSION');
      writeln(t,'Store Created and Last access timestamps in archive types supporting it');
      if FormPeach.cbtimecreated.Checked=true then writeln(t,'1') else writeln(t,'0');

      writeln(t,'');
      writeln(t,'8.8.0 EXTENSION');
      writeln(t,'TAR standard');
      writeln(t,inttostr(FormPeach.ComboBoxTAR.ItemIndex));
      writeln(t,'Timestamp precision');
      writeln(t,inttostr(FormPeach.ComboBoxTARTS.ItemIndex));
      writeln(t,'TAR, Linux save owner/group ids');
      if FormPeach.CheckBoxsnoi.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'TAR, Linux save owner/group names');
      if FormPeach.CheckBoxsnon.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Test archives after creation');
      if FormPeach.CheckBoxAutoTest.Checked=true then writeln(t,'1') else writeln(t,'0');

      writeln(t,'');
      writeln(t,'9.0.0 EXTENSION');
      writeln(t,'7z / p7zip do not change last access time');
      if FormPeach.CheckBoxssp.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Store hard links as links (WIM, TAR)');
      if FormPeach.CheckBoxsnh.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Store symbolic links as links (WIM, TAR)');
      if FormPeach.CheckBoxsnl.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'7z / p7zip max memory usage');
      writeln(t,inttostr(FormPeach.ComboBox7zMemuse.ItemIndex));

      writeln(t,'');
      writeln(t,'9.9.0 EXTENSION');
      writeln(t,'KDF work load for PEA cascaded encryption');
      writeln(t,inttostr(FormPeach.ComboBoxPEAKDFw.ItemIndex));

      writeln(t,'');
      writeln(t,'10.1.0 EXTENSION');
      writeln(t,'KDF type for PEA cascaded encryption');
      writeln(t,inttostr(FormPeach.ComboBoxPEAKDF.ItemIndex));

      writeln(t,'');
      writeln(t,'10.6.0 EXTENSION');
      writeln(t,'Zpaq threads');
      writeln(t,inttostr(FormPeach.ComboBoxPAQThreads.ItemIndex));

      writeln(t,'');
      writeln(t,'10.8.0 EXTENSION');
      writeln(t,'Multivolume RAR create recovery volumes');
      if FormPeach.cbRARrv.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Multivolume RAR recovery volumes');
      writeln(t,inttostr(FormPeach.seRARrv.Value));

      //9.1 not added to presets syntax level and exclude empty folders, as not strictly related to archive creation-only

      closefile(t);
   except
   try closefile(t); except end;
   end;
end;

procedure save_presets_interactive;
begin
FormPeach.SaveDialogPJ.DefaultExt:='.txt';
if not(checkdirexists(confpath+'Compression settings'+DirectorySeparator)) then mkdir(confpath+'Compression settings'+DirectorySeparator);
FormPeach.SaveDialogPJ.InitialDir:=confpath+'Compression settings'+DirectorySeparator;
FormPeach.SaveDialogPJ.FileName:=FormPeach.cbType.Caption;
if FormPeach.SaveDialogPJ.Execute then
   if FormPeach.SaveDialogPJ.FileName<>'' then
      begin
      save_presets(FormPeach.SaveDialogPJ.FileName);
      end;
end;

procedure check_presets_name(presetfilename:ansistring; var presetdisplayedname:ansistring);
var
   s:ansistring;
   i:integer;
begin
   presetdisplayedname:='';
   try
      assignfile(t,presetfilename);
      reset(t);
      readln(t,s); if s<>'PEAZIP CUSTOM COMPRESSION SETTINGS' then begin closefile(t); exit; end;//check if it is a preset file
      readln(t,s);
      readln(t,s);
      readln(t,presetdisplayedname); //name of preset, checked when populating presets menu at startup
      readln(t,s);
      readln(t,s); if s<>'GENERAL OPTIONS' then begin closefile(t); presetdisplayedname:=''; exit; end;//GENERAL OPTIONS string check
      closefile(t);
   except
   try closefile(t); presetdisplayedname:=''; except end;
   end;
end;

procedure load_presetsnames;
var
   s:ansistring;
begin
check_presets_name(sharepath+'presets'+DirectorySeparator+'1.txt',s);
if s='1' then s:=txt_7_2_extcompultra;
FormPeach.mprofileextremezpaq.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'2.txt',s);
if s='2' then s:=txt_5_3_profilebest;
FormPeach.mprofileultra7z.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'3.txt',s);
if s='3' then s:=txt_5_3_profileadvanced;
FormPeach.mprofilenormal7z.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'4.txt',s);
if s='4' then s:=txt_7_4_presetrar;
FormPeach.mprofilerar.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'5.txt',s);
if s='5' then s:=txt_10_0_ptarxz;
FormPeach.mprofiletarxz.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'6.txt',s);
if s='6' then s:=txt_7_3_profile7zfast;
FormPeach.mprofile7zfast.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'7.txt',s);
if s='7' then s:=txt_10_0_ptargz;
FormPeach.mprofiletargz.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'8.txt',s);
if s='8' then s:=txt_5_3_profilenormal;
FormPeach.mprofilenormalzip.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'9.txt',s);
if s='9' then s:=txt_7_3_profile7zfastest;
FormPeach.mprofile7zfastest.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'10.txt',s);
if s='10' then s:=txt_5_3_profileveryfast;
FormPeach.mprofilefastzip.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'11.txt',s);
if s='11' then s:=txt_7_4_7zfzstandardcomp;
FormPeach.mprofilezstd.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'12.txt',s);
if s='12' then s:=txt_10_0_ptarzst;
FormPeach.mprofiletarzst.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'13.txt',s);
if s='13' then s:=txt_5_3_profilepassword;
FormPeach.mprofileencrypt7z.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'14.txt',s);
if s='14' then s:=txt_5_3_profile10mb;
FormPeach.mprofilesplitzip.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'15.txt',s);
if s='15' then s:=txt_5_3_profilesfx;
FormPeach.mprofileauto.Caption:=s;
end;

procedure load_presets(presetfilename: ansistring; tconv: boolean);
var
   s,s1,s2,s3,s4:ansistring;
   specialpw:integer;
begin
   try
      assignfile(t,presetfilename);
      reset(t);
      readln(t,s); if s<>'PEAZIP CUSTOM COMPRESSION SETTINGS' then begin closefile(t); exit; end;//check if it is a preset file
      readln(t,s);
      readln(t,s);
      readln(t,s); //name of preset, checked when populating presets menu at startup
      readln(t,s);
      readln(t,s); if s<>'GENERAL OPTIONS' then begin closefile(t); exit; end;//GENERAL OPTIONS string check
      readln(t,s); //type
      readln(t,s); FormPeach.cbType.Text:=s;
      readln(t,s); FormPeach.cbType.ItemIndex:=strtoint(s); FormPeach.cbTypeChange(nil);
      readln(t,s); //compression level
      readln(t,s); FormPeach.cbLevel.itemindex:=strtoint(s); FormPeach.cbLevelCloseup(nil);
      readln(t,s); //action
      readln(t,s); FormPeach.cbAct.itemindex:=strtoint(s); FormPeach.cbActChange(nil);
      readln(t,s); //split
      readln(t,s); FormPeach.cbSplit.itemindex:=strtoint(s); cbSplit_onchange;
      readln(t,s); FormPeach.SpinEditSplit.Value:=strtoint(s); FormPeach.SpinEditSplitChange(nil);
      readln(t,s); FormPeach.ComboBoxSplit.itemindex:=strtoint(s); FormPeach.ComboBoxSplitChange(nil);
      readln(t,s); //separate
      readln(t,s1); if s1='1' then FormPeach.checkboxseparate.Checked:=true else FormPeach.checkboxseparate.Checked:=false; on_checkboxseparateclick;
      readln(t,s); //original path
      readln(t,s2); if s2='1' then FormPeach.CheckBoxSameArc.Checked:=true else FormPeach.CheckBoxSameArc.Checked:=false; on_checkboxsamearcclick;
      readln(t,s); //convert
      readln(t,s4); if s4='1' then FormPeach.CheckBoxConvert.Checked:=true else FormPeach.CheckBoxConvert.Checked:=false; FormPeach.CheckBoxConvertChange(nil);
      readln(t,s); if s='1' then FormPeach.CheckBoxConvertPW.Checked:=true else FormPeach.CheckBoxConvertPW.Checked:=false; FormPeach.CheckBoxConvertPWChange(nil);
      readln(t,s); if s='1' then FormPeach.CheckBoxConvertVerbose.Checked:=true else FormPeach.CheckBoxConvertVerbose.Checked:=false; FormPeach.CheckBoxConvertVerboseChange(nil);
      readln(t,s); //delete
      readln(t,s); if s='1' then FormPeach.CheckBoxDeleteInputAdd.Checked:=true else FormPeach.CheckBoxDeleteInputAdd.Checked:=false; FormPeach.CheckBoxDeleteInputAddClick(nil);
      readln(t,s); FormPeach.cbDeleteInputModeAdd.itemindex:=strtoint(s); FormPeach.cbdeleteinputmodeAddChange(nil);
      readln(t,s); //auto open
      readln(t,s); if s='1' then FormPeach.CheckBoxAutoOpen.Checked:=true else FormPeach.CheckBoxAutoOpen.Checked:=false; FormPeach.CheckBoxAutoOpenClick(nil);
      readln(t,s); //send by mail
      readln(t,s); if s='1' then FormPeach.CheckBoxMailAdd.Checked:=true else FormPeach.CheckBoxMailAdd.Checked:=false; FormPeach.CheckBoxMailAddClick(nil);
      readln(t,s); if s='1' then FormPeach.CheckBoxMailKeep.Checked:=true else FormPeach.CheckBoxMailKeep.Checked:=false; FormPeach.CheckBoxMailKeepClick(nil);
      readln(t,s); //tar before
      readln(t,s3); if s3='1' then FormPeach.CheckBoxTarBefore.Checked:=true else FormPeach.CheckBoxTarBefore.Checked:=false; FormPeach.CheckBoxTarBeforeClick(nil);
      readln(t,s); //auto close PeaZip
      readln(t,s); if s='1' then FormPeach.CheckBoxClosePeaZip.Checked:=true else FormPeach.CheckBoxClosePeaZip.Checked:=false; FormPeach.CheckBoxClosePeaZipClick(nil);
      readln(t,s); //auto halt
      readln(t,s); if s='1' then FormPeach.CheckBoxAutoHaltA.Checked:=true else FormPeach.CheckBoxAutoHaltA.Checked:=false;
      readln(t,s); //add .enc suffix
      readln(t,s); if s='1' then FormPeach.cbEncExtension.Checked:=true else FormPeach.cbEncExtension.Checked:=false; FormPeach.cbencextensionClick(nil);
      readln(t,s); //timestamp
      readln(t,s); if s='1' then FormPeach.CheckBoxDate.Checked:=true else FormPeach.CheckBoxDate.Checked:=false; FormPeach.CheckBoxDateClick(nil);
      readln(t,s); FormPeach.cbTimeStamp.itemindex:=strtoint(s); FormPeach.cbTimeStampChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND 7z / p7zip
      readln(t,s); //method
      readln(t,s); FormPeach.ComboBox7zMethod.itemindex:=strtoint(s); FormPeach.ComboBox7zMethodCloseUp(nil);
      readln(t,s); //dictionary
      readln(t,s); FormPeach.ComboBox7zDictionary.itemindex:=strtoint(s);
      readln(t,s); //word
      readln(t,s); FormPeach.ComboBox7zWord.itemindex:=strtoint(s);
      readln(t,s); //passes
      readln(t,s); FormPeach.ComboBox7zPasses.itemindex:=strtoint(s);
      readln(t,s); //solidsize
      readln(t,s); FormPeach.ComboBox7zSolid.itemindex:=strtoint(s);
      readln(t,s); //sort by name
      readln(t,s); if s='1' then FormPeach.CheckBoxSolidExtension.Checked:=true else FormPeach.CheckBoxSolidExtension.Checked:=false; FormPeach.CheckBoxSolidExtensionClick(nil);
      readln(t,s); //compress open for writing
      readln(t,s); if s='1' then FormPeach.CheckBox7zOF.Checked:=true else FormPeach.CheckBox7zOF.Checked:=false; FormPeach.CheckBox7zOFClick(nil);
      readln(t,s); //sfx module
      readln(t,s); FormPeach.RadioGroup7zSFX.itemindex:=strtoint(s);
      readln(t,s); //paths
      readln(t,s); FormPeach.ComboBox7zPaths.itemindex:=strtoint(s);
      readln(t,s); //threads
      readln(t,s); FormPeach.ComboBox7zThreads.itemindex:=strtoint(s); FormPeach.ComboBox7zThreadsChange(nil);
      readln(t,s); //other
      readln(t,s); FormPeach.Edit7zOpt.Text:=s;
      readln(t,s); //nt security
      readln(t,s); if s='1' then FormPeach.CheckBoxsni.Checked:=true else FormPeach.CheckBoxsni.Checked:=false; FormPeach.CheckBoxsniClick(nil);
      readln(t,s); //ntfs stream
      readln(t,s); if s='1' then FormPeach.CheckBoxsns.Checked:=true else FormPeach.CheckBoxsns.Checked:=false; FormPeach.CheckBoxsnsClick(nil);
      readln(t,s); //encryption algorithm
      readln(t,s); FormPeach.ComboBox7zalgo.itemindex:=strtoint(s); FormPeach.ComboBox7zalgoChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND arc
      readln(t,s); //solid mode
      readln(t,s); FormPeach.ComboBoxArcSolid.itemindex:=strtoint(s); FormPeach.ComboBoxArcSolidChange(nil);
      readln(t,s); //recovery records
      readln(t,s); if s='1' then FormPeach.CheckBoxARCrr.Checked:=true else FormPeach.CheckBoxARCrr.Checked:=false; FormPeach.CheckBoxARCrrClick(nil);
      readln(t,s); //sfx
      readln(t,s); if s='1' then FormPeach.CheckBoxARCsfx.Checked:=true else FormPeach.CheckBoxARCsfx.Checked:=false; FormPeach.CheckBoxARCsfxClick(nil);
      readln(t,s); FormPeach.ComboBoxArcSfx.itemindex:=strtoint(s);
      readln(t,s); //other
      readln(t,s); FormPeach.EditOParc.Text:=s;
      readln(t,s); //absolute paths
      readln(t,s); if s='1' then FormPeach.CheckBoxARCabs.Checked:=true else FormPeach.CheckBoxARCabs.Checked:=false; FormPeach.CheckBoxARCabsClick(nil);
      readln(t,s); //encryption algorithm
      readln(t,s); FormPeach.ComboBoxARCalgo.itemindex:=strtoint(s); FormPeach.ComboBoxARCalgoChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND custom
      readln(t,s); //compressor
      readln(t,s); FormPeach.EditNameCustom.text:=s; FormPeach.pcustom1.caption:=s;
      readln(t,s); //extension
      readln(t,s); FormPeach.EditExtensionCustom.text:=s;
      readln(t,s); //parameters
      readln(t,s); FormPeach.EditOPcustom.text:=s;
      readln(t,s); //syntax
      readln(t,s); FormPeach.ComboBoxArchiveCustom.itemindex:=strtoint(s); FormPeach.ComboBoxArchiveCustomChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND paq lpaq zpaq
      readln(t,s); //exe
      readln(t,s); FormPeach.RadioGroupPaq.itemindex:=strtoint(s); FormPeach.RadioGroupPaqClick(nil);
      readln(t,s); //compression
      readln(t,s); FormPeach.ComboBoxPAQLevel.itemindex:=strtoint(s); FormPeach.ComboBoxPAQLevelChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND pea
      readln(t,s); //compression
      readln(t,s); FormPeach.ComboBoxPEALevel.itemindex:=strtoint(s); FormPeach.ComboBoxPEALevelChange(nil);
      readln(t,s); //object control
      readln(t,s); FormPeach.ComboBoxPEAObj.itemindex:=strtoint(s); FormPeach.ComboBoxPEAObjChange(nil);
      readln(t,s); //volume control
      readln(t,s); FormPeach.ComboBoxPEAVol.itemindex:=strtoint(s); FormPeach.ComboBoxPEAVolChange(nil);
      readln(t,s); //stream control
      readln(t,s); FormPeach.ComboBoxPEAStream.itemindex:=strtoint(s); FormPeach.ComboBoxPEAStreamChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND quad balz bcm
      readln(t,s); //exe
      readln(t,s); FormPeach.RadioGroupQuad.itemindex:=strtoint(s); FormPeach.RadioGroupQuadClick(nil);
      readln(t,s); //max compression
      readln(t,s); if s='1' then FormPeach.CheckBoxQuadMax.Checked:=true else FormPeach.CheckBoxQuadMax.Checked:=false; FormPeach.CheckBoxQuadMaxClick(nil);
      readln(t,s); //solid
      readln(t,s); FormPeach.ComboBoxBCMSolid.itemindex:=strtoint(s);

      readln(t,s);
      readln(t,s); //BACKEND split
      readln(t,s); //integrity check
      readln(t,s); FormPeach.ComboBoxSplitAlgo.itemindex:=strtoint(s); FormPeach.ComboBoxSplitAlgoChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND upx
      readln(t,s); //level
      readln(t,s); FormPeach.ComboBoxUPX.itemindex:=strtoint(s); FormPeach.ComboBoxUPXChange(nil);
      readln(t,s); //strip exe
      readln(t,s); if s='1' then FormPeach.CheckBoxUPXStrip.Checked:=true else FormPeach.CheckBoxUPXStrip.Checked:=false;
      readln(t,s); //backup exe
      readln(t,s); if s='1' then FormPeach.CheckBoxUPXBackup.Checked:=true else FormPeach.CheckBoxUPXBackup.Checked:=false;
      readln(t,s);
      readln(t,s); //SPECIAL
      readln(t,s); //interactive password request
      readln(t,s); specialpw:=strtoint(s);

      //7.3 extension
      readln(t,s);
      readln(t,s); //7.3.0 EXTENSION
      readln(t,s); //set archive time from most recent file in archive
      readln(t,s); if s='1' then FormPeach.CheckBoxstl.Checked:=true else FormPeach.CheckBoxstl.Checked:=false; FormPeach.CheckBoxstlClick(nil);
      readln(t,s); //maximize Brotli compression
      readln(t,s); if s='1' then FormPeach.CheckBoxBrotli.Checked:=true else FormPeach.CheckBoxBrotli.Checked:=false; FormPeach.CheckBoxBrotliClick(nil);
      readln(t,s); //maximize Zstandard compression
      readln(t,s); if s='1' then FormPeach.CheckBoxZstd.Checked:=true else FormPeach.CheckBoxZstd.Checked:=false; FormPeach.CheckBoxZstdClick(nil);

      //7.4 extension
      readln(t,s);
      readln(t,s); //7.4.0 EXTENSION
      readln(t,s); //Use mgotypeRAR.exe is available
      readln(t,s); if s='1' then FormPeach.cbRAR.Checked:=true else FormPeach.cbRAR.Checked:=false; if s='1' then FormPeach.cbRARClick(nil);
      readln(t,s); //Create RAR5
      readln(t,s); if s='1' then FormPeach.cbRAR5.Checked:=true else FormPeach.cbRAR5.Checked:=false; FormPeach.cbRAR5Click(nil);
      readln(t,s); //RAR5 dictionary size
      readln(t,s); FormPeach.comboRARdict.itemindex:=strtoint(s); FormPeach.comboRARdictChange(nil);
      readln(t,s); //RAR5 use BLAKE2 instead of CRC
      readln(t,s); if s='1' then FormPeach.cbRARBLAKE2.Checked:=true else FormPeach.cbRARBLAKE2.Checked:=false; FormPeach.cbRARBLAKE2Click(nil);
      readln(t,s); //mgotypeRAR create sfx archive
      readln(t,s); if s='1' then FormPeach.cbRARsfx.Checked:=true else FormPeach.cbRARsfx.Checked:=false; FormPeach.cbRARsfxClick(nil);
      readln(t,s); //mgotypeRAR create solid archive
      readln(t,s); if s='1' then FormPeach.cbRARsolid.Checked:=true else FormPeach.cbRARsolid.Checked:=false; FormPeach.cbRARsolidClick(nil);
      readln(t,s); //mgotypeRAR create recovery records
      readln(t,s); if s='1' then FormPeach.cbRARrr.Checked:=true else FormPeach.cbRARrr.Checked:=false; FormPeach.cbRARrrClick(nil);
      readln(t,s); //mgotypeRAR recovery records %
      readln(t,s); FormPeach.seRARrr.Value:=strtoint(s); FormPeach.seRARrrChange(nil);
      readln(t,s); //mgotypeRAR save files open for writing
      readln(t,s); if s='1' then FormPeach.cbRARsaveopen.Checked:=true else FormPeach.cbRARsaveopen.Checked:=false; FormPeach.cbRARsaveopenClick(nil);
      readln(t,s); //mgotypeRAR save NT security info
      readln(t,s); if s='1' then FormPeach.cbRARsavesecurity.Checked:=true else FormPeach.cbRARsavesecurity.Checked:=false; FormPeach.cbRARsavesecurityClick(nil);
      readln(t,s); //mgotypeRAR save NTFS streams
      readln(t,s); if s='1' then FormPeach.cbRARsavestreams.Checked:=true else FormPeach.cbRARsavestreams.Checked:=false; FormPeach.cbRARsavestreamsClick(nil);
      readln(t,s); //mgotypeRAR set archive time from most recent file time
      readln(t,s); FormPeach.cbRARlastmodtime.itemindex:=strtoint(s); FormPeach.cbRARlastmodtimeChange(nil);
      readln(t,s); //mgotypeRAR lock archive
      readln(t,s); if s='1' then FormPeach.cbRARlock.Checked:=true else FormPeach.cbRARlock.Checked:=false; FormPeach.cbRARlockClick(nil);

      //7.8 extension
      readln(t,s);
      readln(t,s); //7.8.0 EXTENSION
      readln(t,s); //custom archive extension
      readln(t,s); if s='1' then FormPeach.cbCustomExtension.Checked:=true else FormPeach.cbCustomExtension.Checked:=false; FormPeach.cbCustomExtensionClick(nil);
      readln(t,s); FormPeach.EditCustomExtension.Caption:=s;

      //8.2 extension
      readln(t,s);
      readln(t,s); //8.2.0 EXTENSION
      readln(t,s); //store create and last access timestamp
      readln(t,s); if s='1' then FormPeach.cbtimecreated.Checked:=true else FormPeach.cbtimecreated.Checked:=false; FormPeach.cbtimecreatedClick(nil);

      //8.8 extension
      readln(t,s);
      readln(t,s); //8.8.0 EXTENSION
      readln(t,s); //TAR standard
      readln(t,s); FormPeach.ComboBoxTAR.itemindex:=strtoint(s); FormPeach.ComboBoxTARChange(nil);
      readln(t,s); //TAR/pax timestamp precision
      readln(t,s); FormPeach.ComboBoxTARTS.itemindex:=strtoint(s); FormPeach.ComboBoxTARTSChange(nil);
      readln(t,s); //snoi
      readln(t,s); if s='1' then FormPeach.CheckBoxsnoi.Checked:=true else FormPeach.CheckBoxsnoi.Checked:=false; FormPeach.CheckBoxsnoiClick(nil);
      readln(t,s); //snon
      readln(t,s); if s='1' then FormPeach.CheckBoxsnon.Checked:=true else FormPeach.CheckBoxsnon.Checked:=false; FormPeach.CheckBoxsnonClick(nil);
      readln(t,s); //auto test
      readln(t,s); if s='1' then FormPeach.CheckBoxAutoTest.Checked:=true else FormPeach.CheckBoxAutoTest.Checked:=false; FormPeach.CheckBoxAutoTestClick(nil);

      //9.0 extension
      readln(t,s);
      readln(t,s); //9.0.0 EXTENSION
      readln(t,s); //7z / p7zip do not change last access time
      readln(t,s); if s='1' then FormPeach.CheckBoxssp.Checked:=true else FormPeach.CheckBoxssp.Checked:=false; FormPeach.CheckBoxsspClick(nil);
      readln(t,s); //hard links
      readln(t,s); if s='1' then FormPeach.CheckBoxsnh.Checked:=true else FormPeach.CheckBoxsnh.Checked:=false; FormPeach.CheckBoxsnhClick(nil);
      readln(t,s); //sym links
      readln(t,s); if s='1' then FormPeach.CheckBoxsnl.Checked:=true else FormPeach.CheckBoxsnl.Checked:=false; FormPeach.CheckBoxsnlClick(nil);
      readln(t,s); //max memory use
      readln(t,s); FormPeach.ComboBox7zMemuse.itemindex:=strtoint(s); FormPeach.ComboBox7ZMemuseChange(nil);

      //9.9 extension
      readln(t,s);
      readln(t,s); //9.9.0 EXTENSION
      readln(t,s); //KDF work load for PEA cascaded encryption
      readln(t,s); FormPeach.ComboBoxPEAKDFw.itemindex:=strtoint(s); FormPeach.ComboBoxPEAKDFwChange(nil);

      //10.1 extension
      readln(t,s);
      readln(t,s); //10.1.0 EXTENSION
      readln(t,s); //KDF type for PEA cascaded encryption
      readln(t,s); FormPeach.ComboBoxPEAKDF.itemindex:=strtoint(s); FormPeach.ComboBoxPEAKDFChange(nil);

      //10.6 extension
      readln(t,s);
      readln(t,s); //10.6.0 EXTENSION
      readln(t,s); //ZPAQ threads
      readln(t,s); FormPeach.ComboBoxPAQThreads.itemindex:=strtoint(s); FormPeach.ComboBoxPAQThreadsChange(nil);

      //10.8 extension
      readln(t,s);
      readln(t,s); //10.8.0 EXTENSION
      readln(t,s); //multivolume mgotypeRAR create recovery volumes
      readln(t,s); if s='1' then FormPeach.cbRARrv.Checked:=true else FormPeach.cbRARrv.Checked:=false; FormPeach.cbRARrvClick(nil);
      readln(t,s); //multivolume mgotypeRAR recovery volumes
      readln(t,s); FormPeach.seRARrv.Value:=strtoint(s); FormPeach.seRARrvChange(nil);

      FormPeach.cbTypeChange(nil);

      //re-apply special settings which conditionally enables/disables other settings
      if tconv=false then
         begin
         if s3='1' then FormPeach.CheckBoxTarBefore.Checked:=true else FormPeach.CheckBoxTarBefore.Checked:=false; FormPeach.CheckBoxTarBeforeClick(nil);
         if s2='1' then FormPeach.CheckBoxSameArc.Checked:=true else FormPeach.CheckBoxSameArc.Checked:=false; on_checkboxsamearcclick;
         if s1='1' then FormPeach.checkboxseparate.Checked:=true else FormPeach.checkboxseparate.Checked:=false; on_checkboxseparateclick;
         if s3='1' then FormPeach.checkboxseparate.Enabled:=false;
         end
      else
         begin
         FormPeach.CheckBoxSameArc.State:=cbUnchecked;
         FormPeach.CheckBoxSeparate.State:=cbChecked;
         FormPeach.CheckBoxConvert.State:=cbChecked;
         FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
         FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
         end;
      //convert status is not re-set (unless incompatible with other options) as it is applied conditionally by calling the compression setting from archive or convert menus

      closefile(t);
      if specialpw=1 then FormPeach.BtnPasswordArchiveClick(nil);
   except
      try closefile(t); except end;
   end;
end;

procedure applycompsettings(settingsname: ansistring);
var
   tconv:boolean;
begin
tconv:=contextconvert_switch;
checkcontextadd;
load_presets(settingsname,tconv);
if tconv=true then
   begin
   if FormPeach.CheckBoxConvert.Enabled=true then
      begin
      FormPeach.CheckBoxConvert.State:=cbChecked;
      FormPeach.CheckBoxConvertChange(nil);
      end;
   end;
if immediate_execution=1 then on_buttonarchiveclick;
end;

procedure load_presets_interactive;
begin
if not(checkdirexists(confpath+'Compression settings'+DirectorySeparator)) then mkdir(confpath+'Compression settings'+DirectorySeparator);
FormPeach.OpenDialogLayout.InitialDir:=confpath+'Compression settings'+DirectorySeparator;
if FormPeach.OpenDialogLayout.Execute then
   if FormPeach.OpenDialogLayout.FileName<>'' then
      begin
      applycompsettings(FormPeach.OpenDialogLayout.FileName);
      end;
end;

procedure applypreset(presetname: ansistring);
begin
applycompsettings(sharepath+'presets'+DirectorySeparator+presetname);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection HASH calculate hash values, compare and deduplicate files

///////////////////////////////////////////////////////////////////////////////}

function countsize(s:ansistring):integer;
var
   i:integer;
begin
result:=0;
for i:=1 to FormPeach.StringGridList.Rowcount-1 do
   if s=FormPeach.StringGridList.Cells[3,i] then result:=result+1;
end;

function countsizefirstmatch(s:ansistring):integer;
var
   i:integer;
begin
result:=0;
for i:=1 to FormPeach.StringGridList.Rowcount-1 do
   begin
   if s=FormPeach.StringGridList.Cells[3,i] then result:=result+1;
   if result>1 then break;
   end;
end;

//procedure to checksum files mode: selected=only selected files; displayed=all files displayed in current directory or filter
procedure getcheck(mode:ansistring);
var
   sbuf:array [1..32767] of byte;
   i,t,n,nsel,rc:integer;
   k:qword;
   inidir,s,strsel:ansistring;
   pgpsig:TPGPDigest;
   Adler:longint;
   CRC16:word;
   CRC24:longint;
   CRC32:longint;
   CRC64:TCRC64;
   ED2KContext:TED2KContext;
   ED2KRes:TED2KResult;
   MD4Context:THashContext;
   MD4Digest:TMD4Digest;
   MD5Context:THashContext;
   MD5Digest:TMD5Digest;
   RMD160Context:THashContext;
   RMD160Digest:TRMD160Digest;
   SHA1Context:THashContext;
   SHA1Digest:TSHA1Digest;
   SHA3_256Context:THashContext;
   SHA3_256Digest:TSHA3_256Digest;
   SHA256Context:THashContext;
   SHA256Digest:TSHA256Digest;
   SHA3_512Context:THashContext;
   SHA3_512Digest:TSHA3_512Digest;
   SHA512Context:THashContext;
   SHA512Digest:TSHA512Digest;
   WhirlContext:THashContext;
   WhirlDigest:TWhirlDigest;
   Blake2sContext:blake2s_ctx;
   Blake2bContext:THashContext;
   Blake2sDigest:TBlake2sDigest;
   Blake2bDigest:TBlake2bDigest;
   f:file of byte;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if mode='neutral' then if checklistanysel<>0 then mode:='displayed' else mode:='selected';
if mode='selected' then if checklisttotsel(nsel,strsel)<>0 then exit;
if browsertype<>0 then
   begin
   settpreset(1,browsersize,false);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=FormPeach.StringGridList.Rowcount;
s:=FormPeach.Caption;
inidir:=FormPeach.EditOpenIn.Caption;
if FormPeach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      begin
      if (FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder) then
         begin
         if mode='selected' then
            if FormPeach.StringGridList.Cells[16,i]='0' then
               begin
               FormPeach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         filemode:=0;
         try
         assignfile(f,FormPeach.StringGridList.Cells[12,i]);
         filemode:=0;
         reset(f);
         except
         FormPeach.StringGridList.Cells[11,i]:='';
         continue;
         end;
         if mode='selected' then FormPeach.Caption:=FormPeach.ListViewBrowser.Column[10].Caption+' ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+FormPeach.StringGridList.Cells[1,i]+'...'
         else FormPeach.Caption:=FormPeach.ListViewBrowser.Column[10].Caption+' ('+inttostr(i)+'/'+inttostr(rc)+') '+FormPeach.StringGridList.Cells[1,i]+'...';
         k:=0;
         t:=t+1;
         case browserch of
            1: Adler32Init(adler);
            2: CRC16Init(CRC16);
            3: CRC24Init(CRC24);
            4: CRC32Init(CRC32);
            5: CRC64Init(CRC64);
            6: ED2K_Init(ED2KContext);
            7: MD4Init(MD4Context);
            8: MD5Init(MD5Context);
            9: RMD160Init(RMD160Context);
           10: SHA1Init(SHA1Context);
           11: Blake2s_Init(Blake2sContext,nil,0,BLAKE2S_MaxDigLen);
           12: SHA256Init(SHA256Context);
           13: SHA3_256Init(SHA3_256Context);
           14: Blake2b_Init(Blake2bContext,nil,0,BLAKE2B_MaxDigLen);
           15: SHA512Init(SHA512Context);
           16: SHA3_512Init(SHA3_512Context);
           17: Whirl_Init(WhirlContext);
            end;
         repeat
            blockread(f,sbuf,sizeof(sbuf),n);
            if n<>0 then
               begin
               inc(k,n);
               case browserch of
                  1: Adler32Update(adler,@sbuf,n);
                  2: CRC16Update(CRC16,@sbuf,n);
                  3: CRC24Update(CRC24,@sbuf,n);
                  4: CRC32Update(CRC32,@sbuf,n);
                  5: CRC64Update(CRC64,@sbuf,n);
                  6: ED2K_Update(ED2KContext,@sbuf,n);
                  7: MD4Update(MD4Context,@sbuf,n);
                  8: MD5Update(MD5Context,@sbuf,n);
                  9: RMD160Update(RMD160Context,@sbuf,n);
                 10: SHA1Update(SHA1Context,@sbuf,n);
                 11: Blake2s_update(Blake2sContext,@sbuf,n);
                 12: SHA256Update(SHA256Context,@sbuf,n);
                 13: SHA3_256Update(SHA3_256Context,@sbuf,n);
                 14: Blake2b_update(Blake2bContext,@sbuf,n);
                 15: SHA512Update(SHA512Context,@sbuf,n);
                 16: SHA3_512Update(SHA3_512Context,@sbuf,n);
                 17: Whirl_Update(WhirlContext,@sbuf,n);
                  end;
               Application.ProcessMessages;
               if (inidir<>FormPeach.EditOpenIn.Caption) or (endflag=true) then
                  begin
                  exit_busy_status;
                  FormPeach.Caption:=s;
                  exit;
                  end;
               end;
         until n<>sizeof(sbuf);
         close(f);
         case browserch of
            1: Adler32Final(adler);
            2: CRC16Final(CRC16);
            3: begin CRC24Final(CRC24); Long2PGP(CRC24, pgpsig); end;
            4: CRC32Final(CRC32);
            5: CRC64Final(CRC64);
            6: ED2K_Final(ED2KContext,ED2KRes);
            7: MD4Final(MD4Context,MD4Digest);
            8: MD5Final(MD5Context,MD5Digest);
            9: RMD160Final(RMD160Context,RMD160Digest);
           10: SHA1Final(SHA1Context,SHA1Digest);
           11: blake2s_Final(Blake2sContext,Blake2sDigest);
           12: SHA256Final(SHA256Context,SHA256Digest);
           13: SHA3_256Final(SHA3_256Context,SHA3_256Digest);
           14: blake2b_Final(Blake2bContext,Blake2bDigest);
           15: SHA512Final(SHA512Context,SHA512Digest);
           16: SHA3_512Final(SHA3_512Context,SHA3_512Digest);
           17: Whirl_Final(WhirlContext,WhirlDigest);
            end;
         case browserch of
            1: Adler := (Adler shr 24) or ((Adler shr 8) and $FF00) or ((Adler shl 8) and $FF0000) or (Adler shl 24);
            2: CRC16 := swap(CRC16);
            3: FormPeach.StringGridList.Cells[11,i]:=hexstr(@pgpsig,sizeof(pgpsig));
            4: CRC32 := (CRC32 shr 24) or ((CRC32 shr 8) and $FF00) or ((CRC32 shl 8) and $FF0000) or (CRC32 shl 24);
            end;
         case browserch of
            1: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@adler,sizeof(Adler)));
            2: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC16,sizeof(CRC16)));
            4: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
            5: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC64,sizeof(CRC64)));
            6: begin
               FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@ED2KRes.eDonkey, sizeof(ED2KRes.eDonkey)));
               if ED2KRes.differ then FormPeach.StringGridList.Cells[7,i]:=FormPeach.StringGridList.Cells[7,i]+' / eMule: '+upcase(hexstr(@ED2KRes.eMule, sizeof(ED2KRes.eMule)));
               end;
            7: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD4Digest,sizeof(MD4Digest)));
            8: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD5Digest,sizeof(MD5Digest)));
            9: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@RMD160Digest,sizeof(RMD160Digest)));
           10: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA1Digest,sizeof(SHA1Digest)));
           11: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2sDigest,sizeof(Blake2sDigest)));
           12: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           13: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_256Digest,sizeof(SHA3_256Digest)));
           14: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2bDigest,sizeof(Blake2bDigest)));
           15: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           16: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_512Digest,sizeof(SHA3_512Digest)));
           17: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@WhirlDigest,sizeof(WhirlDigest)));
            end;
         FormPeach.ListViewBrowser.Items[i-1].SubItems[9]:=FormPeach.StringGridList.Cells[11,i];
         end;
      end;
   exit_busy_status;
   FormPeach.Caption:=s;
   {$IFDEF DARWIN}update_listview;{$ENDIF}
   end;
end;

function checkduplicates:integer;
var
   i,j:integer;
   duplicate:boolean;
   s:ansistring;
begin
result:=0;
//test for identical checksums
for i:=1 to FormPeach.StringGridList.Rowcount-1 do
   begin
   s:=FormPeach.StringGridList.Cells[11,i];
   duplicate:=false;
   for j:=1 to FormPeach.StringGridList.Rowcount-1 do
      if (FormPeach.StringGridList.Cells[11,j]<>'')
      and (s=FormPeach.StringGridList.Cells[11,j])
      and (i<>j) then
         begin
         duplicate:=true;
         break;
         end;
   if duplicate=false then FormPeach.StringGridList.Cells[11,i]:=''
   else
      result:=result+1;
   FormPeach.ListViewBrowser.Items[i-1].SubItems[9]:=FormPeach.StringGridList.Cells[11,i];
   end;
//mark duplicate all copies but one (last found)
for i:=1 to FormPeach.StringGridList.Rowcount-2 do
   begin
   s:=FormPeach.StringGridList.Cells[11,i];
   for j:=i+1 to FormPeach.StringGridList.Rowcount-1 do
      if (FormPeach.StringGridList.Cells[11,j]<>'')
      and (s=FormPeach.StringGridList.Cells[11,j]) then
         begin
         FormPeach.StringGridList.Cells[4,i]:='D';
         FormPeach.StringGridList.Cells[15,i]:='D';
         FormPeach.ListViewBrowser.Items[i-1].SubItems[2]:=FormPeach.StringGridList.Cells[4,i];
         end;
   end;
end;

//procedure to deduplicate files, mode displayed: all in current folder / search filter; selected: all selected
procedure fulldeduplicate(mode:ansistring);
var
   sbuf:array [1..32767] of byte;
   dup,i,n,t,rc,nsel:integer;
   k:qword;
   inidir,s,strsel:ansistring;
   pgpsig:TPGPDigest;
   Adler:longint;
   CRC16:word;
   CRC24:longint;
   CRC32:longint;
   CRC64:TCRC64;
   ED2KContext:TED2KContext;
   ED2KRes:TED2KResult;
   MD4Context:THashContext;
   MD4Digest:TMD4Digest;
   MD5Context:THashContext;
   MD5Digest:TMD5Digest;
   RMD160Context:THashContext;
   RMD160Digest:TRMD160Digest;
   Blake2sContext:blake2s_ctx;
   Blake2bContext:THashContext;
   Blake2sDigest:TBlake2sDigest;
   Blake2bDigest:TBlake2bDigest;
   SHA1Context:THashContext;
   SHA1Digest:TSHA1Digest;
   SHA3_256Context:THashContext;
   SHA3_256Digest:TSHA3_256Digest;
   SHA256Context:THashContext;
   SHA256Digest:TSHA256Digest;
   SHA3_512Context:THashContext;
   SHA3_512Digest:TSHA3_512Digest;
   SHA512Context:THashContext;
   SHA512Digest:TSHA512Digest;
   WhirlContext:THashContext;
   WhirlDigest:TWhirlDigest;
   f:file of byte;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if mode='neutral' then if checklistanysel<>0 then mode:='displayed' else mode:='selected';
if mode='selected' then if checklisttotsel(nsel,strsel)<>0 then exit;
if browsertype<>0 then
   begin
   settpreset(1,browsersize,false);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=FormPeach.StringGridList.Rowcount;
s:=FormPeach.Caption;
inidir:=FormPeach.EditOpenIn.Caption;
if FormPeach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      if (FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder) and (FormPeach.StringGridList.Cells[3,i]<>'0') then
         begin
         if mode='selected' then
            if FormPeach.StringGridList.Cells[16,i]='0' then
               begin
               FormPeach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         if countsize(FormPeach.StringGridList.Cells[3,i])<2 then continue;
         filemode:=0;
         try
         assignfile(f,FormPeach.StringGridList.Cells[12,i]);
         filemode:=0;
         reset(f);
         except
         continue;
         end;
         if mode='selected' then FormPeach.Caption:=txt_4_1_duplicatesfind+', '+FormPeach.ListViewBrowser.Column[10].Caption+' ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+FormPeach.StringGridList.Cells[1,i]+'...'
         else FormPeach.Caption:=txt_4_1_duplicatesfind+', '+FormPeach.ListViewBrowser.Column[10].Caption+' ('+inttostr(i)+'/'+inttostr(rc)+') '+FormPeach.StringGridList.Cells[1,i]+'...';
         k:=0;
         t:=t+1;
         case browserch of
            1: Adler32Init(adler);
            2: CRC16Init(CRC16);
            3: CRC24Init(CRC24);
            4: CRC32Init(CRC32);
            5: CRC64Init(CRC64);
            6: ED2K_Init(ED2KContext);
            7: MD4Init(MD4Context);
            8: MD5Init(MD5Context);
            9: RMD160Init(RMD160Context);
           10: SHA1Init(SHA1Context);
           11: Blake2s_Init(Blake2sContext,nil,0,BLAKE2S_MaxDigLen);
           12: SHA3_256Init(SHA3_256Context);
           13: SHA256Init(SHA256Context);
           14: Blake2b_Init(Blake2bContext,nil,0,BLAKE2B_MaxDigLen);
           15: SHA3_512Init(SHA3_512Context);
           16: SHA512Init(SHA512Context);
           17: Whirl_Init(WhirlContext);
            end;
         repeat
            blockread(f,sbuf,sizeof(sbuf),n);
            if n<>0 then
               begin
               inc(k,n);
               case browserch of
                  1: Adler32Update(adler,@sbuf,n);
                  2: CRC16Update(CRC16,@sbuf,n);
                  3: CRC24Update(CRC24,@sbuf,n);
                  4: CRC32Update(CRC32,@sbuf,n);
                  5: CRC64Update(CRC64,@sbuf,n);
                  6: ED2K_Update(ED2KContext,@sbuf,n);
                  7: MD4Update(MD4Context,@sbuf,n);
                  8: MD5Update(MD5Context,@sbuf,n);
                  9: RMD160Update(RMD160Context,@sbuf,n);
                 10: SHA1Update(SHA1Context,@sbuf,n);
                 11: Blake2s_update(Blake2sContext,@sbuf,n);
                 12: SHA3_256Update(SHA3_256Context,@sbuf,n);
                 13: SHA256Update(SHA256Context,@sbuf,n);
                 14: Blake2b_update(Blake2bContext,@sbuf,n);
                 15: SHA3_512Update(SHA3_512Context,@sbuf,n);
                 16: SHA512Update(SHA512Context,@sbuf,n);
                 17: Whirl_Update(WhirlContext,@sbuf,n);
                  end;
               Application.ProcessMessages;
               if (inidir<>FormPeach.EditOpenIn.Caption) or (endflag=true) then
                  begin
                  exit_busy_status;
                  FormPeach.Caption:=s;
                  exit;
                  end;
               end;
         until n<>sizeof(sbuf);
         close(f);
         case browserch of
            1: Adler32Final(adler);
            2: CRC16Final(CRC16);
            3: begin CRC24Final(CRC24); Long2PGP(CRC24, pgpsig); end;
            4: CRC32Final(CRC32);
            5: CRC64Final(CRC64);
            6: ED2K_Final(ED2KContext,ED2KRes);
            7: MD4Final(MD4Context,MD4Digest);
            8: MD5Final(MD5Context,MD5Digest);
            9: RMD160Final(RMD160Context,RMD160Digest);
           10: SHA1Final(SHA1Context,SHA1Digest);
           11: blake2s_Final(Blake2sContext,Blake2sDigest);
           12: SHA3_256Final(SHA3_256Context,SHA3_256Digest);
           13: SHA256Final(SHA256Context,SHA256Digest);
           14: blake2b_Final(Blake2bContext,Blake2bDigest);
           15: SHA3_512Final(SHA3_512Context,SHA3_512Digest);
           16: SHA512Final(SHA512Context,SHA512Digest);
           17: Whirl_Final(WhirlContext,WhirlDigest);
            end;
         case browserch of
            1: Adler := (Adler shr 24) or ((Adler shr 8) and $FF00) or ((Adler shl 8) and $FF0000) or (Adler shl 24);
            2: CRC16 := swap(CRC16);
            3: FormPeach.StringGridList.Cells[11,i]:=hexstr(@pgpsig,sizeof(pgpsig));
            4: CRC32 := (CRC32 shr 24) or ((CRC32 shr 8) and $FF00) or ((CRC32 shl 8) and $FF0000) or (CRC32 shl 24);
            end;
         case browserch of
            1: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@adler,sizeof(Adler)));
            2: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC16,sizeof(CRC16)));
            4: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
            5: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC64,sizeof(CRC64)));
            6: begin
               FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@ED2KRes.eDonkey, sizeof(ED2KRes.eDonkey)));
               if ED2KRes.differ then FormPeach.StringGridList.Cells[7,i]:=FormPeach.StringGridList.Cells[7,i]+' / eMule: '+upcase(hexstr(@ED2KRes.eMule, sizeof(ED2KRes.eMule)));
               end;
            7: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD4Digest,sizeof(MD4Digest)));
            8: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD5Digest,sizeof(MD5Digest)));
            9: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@RMD160Digest,sizeof(RMD160Digest)));
           10: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA1Digest,sizeof(SHA1Digest)));
           11: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2sDigest,sizeof(Blake2sDigest)));
           12: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_256Digest,sizeof(SHA3_256Digest)));
           13: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           14: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2bDigest,sizeof(Blake2bDigest)));
           15: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_512Digest,sizeof(SHA3_512Digest)));
           16: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           17: FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@WhirlDigest,sizeof(WhirlDigest)));
            end;
         FormPeach.StringGridList.Cells[11,i]:=FormPeach.StringGridList.Cells[3,i]+'/'+FormPeach.StringGridList.Cells[11,i];
         FormPeach.ListViewBrowser.Items[i-1].SubItems[9]:=FormPeach.StringGridList.Cells[11,i];
         end;
   FormPeach.Caption:=txt_4_1_duplicatesfind+', '+FormPeach.ListViewBrowser.Column[10].Caption+' '+s+'...';
   dup:=checkduplicates;
   exit_busy_status;
   FormPeach.Caption:=s;
   {$IFDEF DARWIN}update_listview;{$ENDIF}
   if dup=0 then pMessageInfoOK(inttostr(dup)+' '+txt_4_1_duplicatesfound)
   else pMessageInfoOK(inttostr(dup)+' '+txt_4_1_duplicatesfound+'; '+txt_4_1_duplicateshint);
   end;
end;

//quick procedure to find approximate duplicate files
procedure quickdeduplicate(mode:ansistring);
var
   sbuf:array [1..32767] of byte;
   dup,i,n,t,rc,nsel:integer;
   k,fsize:qword;
   inidir,s,strsel:ansistring;
   CRC32:longint;
   f:file of byte;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if mode='neutral' then if checklistanysel<>0 then mode:='displayed' else mode:='selected';
if mode='selected' then if checklisttotsel(nsel,strsel)<>0 then exit;
if browsertype<>0 then
   begin
   settpreset(1,browsersize,false);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=FormPeach.StringGridList.Rowcount;
s:=FormPeach.Caption;
inidir:=FormPeach.EditOpenIn.Caption;
if FormPeach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      if (FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder) and (FormPeach.StringGridList.Cells[3,i]<>'0') then
         begin
         if mode='selected' then
            if FormPeach.StringGridList.Cells[16,i]='0' then
               begin
               FormPeach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         if countsizefirstmatch(FormPeach.StringGridList.Cells[3,i])<2 then continue;
         filemode:=0;
         try
         assignfile(f,FormPeach.StringGridList.Cells[12,i]);
         filemode:=0;
         reset(f);
         except
         continue;
         end;
         if mode='selected' then FormPeach.Caption:=txt_6_6_pdupfind+', ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+FormPeach.StringGridList.Cells[1,i]+'...'
         else FormPeach.Caption:=txt_6_6_pdupfind+', ('+inttostr(i)+'/'+inttostr(rc)+') '+FormPeach.StringGridList.Cells[1,i]+'...';
         k:=0;
         t:=t+1;
         CRC32Init(CRC32);
         blockread(f,sbuf,sizeof(sbuf),n);
         if n<>0 then
               begin
               inc(k,n);
               CRC32Update(CRC32,@sbuf,n);
               Application.ProcessMessages;
               if (inidir<>FormPeach.EditOpenIn.Caption) or (endflag=true) then
                  begin
                  close(f);
                  exit_busy_status;
                  FormPeach.Caption:=s;
                  exit;
                  end;
               end;
         try
         fsize:=StrToQWord(FormPeach.StringGridList.Cells[3,i]);
         except //should not happen as file sizes are checked pupulating the table to calculate total size
         close(f);
         continue;
         end;
         if fsize>(64*1024) then
            begin
            seek(f,fsize div 2);
            blockread(f,sbuf,sizeof(sbuf),n);
            if n<>0 then
               begin
               inc(k,n);
               CRC32Update(CRC32,@sbuf,n);
               end;
            end;
         close(f);
         CRC32Final(CRC32);
         CRC32 := (CRC32 shr 24) or ((CRC32 shr 8) and $FF00) or ((CRC32 shl 8) and $FF0000) or (CRC32 shl 24);
         FormPeach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
         FormPeach.StringGridList.Cells[11,i]:=FormPeach.StringGridList.Cells[3,i]+'/'+FormPeach.StringGridList.Cells[11,i];
         FormPeach.ListViewBrowser.Items[i-1].SubItems[9]:=FormPeach.StringGridList.Cells[11,i];
         end;
   FormPeach.Caption:=txt_6_6_pdupfind+' '+s+'...';
   dup:=checkduplicates;
   exit_busy_status;
   FormPeach.Caption:=s;
   {$IFDEF DARWIN}update_listview;{$ENDIF}
   if dup=0 then pMessageInfoOK(inttostr(dup)+' '+txt_6_6_pdupfound)
   else pMessageInfoOK(inttostr(dup)+' '+txt_6_6_pdupfound+'; '+txt_4_1_duplicateshint);
   end;
end;

//find duplicate files with full or quick approximate function
procedure findduplicate(mode:ansistring);
begin
if qdup=1 then quickdeduplicate(mode)
else fulldeduplicate(mode);
end;

//procedure to analyze content of directories
procedure analyzefolders(mode:ansistring);
var
   i,t,rc,nsel:integer;
   nfiles,ndirs,ctsize:qword;
   inidir,s,strsel:ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if mode='selected' then if checklisttotsel(nsel,strsel)<>0 then exit;
if browsertype<>0 then
   begin
   settpreset(1,browsersize,false);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=FormPeach.StringGridList.Rowcount;
s:=FormPeach.Caption;
inidir:=FormPeach.EditOpenIn.Caption;
t:=1;
if FormPeach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      if (FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder) then
         begin
         if mode='selected' then
            if FormPeach.StringGridList.Cells[16,i]='0' then
               begin
               FormPeach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         if mode='selected' then FormPeach.Caption:=txt_7_0_af+', ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+FormPeach.StringGridList.Cells[1,i]+'...'
         else FormPeach.Caption:=txt_7_0_af+', ('+inttostr(i)+'/'+inttostr(rc)+') '+FormPeach.StringGridList.Cells[1,i]+'...';
         nfiles:=0;
         ndirs:=0;
         ctsize:=0;
         rcountsize(FormPeach.StringGridList.Cells[12,i]+directoryseparator,'*',faAnyFile,true,nfiles,ndirs,ctsize);
         FormPeach.StringGridList.Cells[3,i]:=nicenumber(inttostr(ctsize),filesizebase);
         FormPeach.StringGridList.Cells[14,i]:=inttostr(length(inttostr(length(inttostr(ctsize)))))+inttostr(length(inttostr(ctsize)))+inttostr(ctsize);
         FormPeach.ListViewBrowser.Items[i-1].SubItems[1]:=FormPeach.StringGridList.Cells[3,i];
         FormPeach.StringGridList.Cells[11,i]:=inttostr(ndirs-1)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(ctsize),filesizebase);
         FormPeach.ListViewBrowser.Items[i-1].SubItems[9]:=FormPeach.StringGridList.Cells[11,i];
         if ndirs-1+nfiles=0 then //mark empty folders
            begin
            FormPeach.StringGridList.Cells[4,i]:='E';
            FormPeach.StringGridList.Cells[15,i]:='E';
            FormPeach.ListViewBrowser.Items[i-1].SubItems[2]:=FormPeach.StringGridList.Cells[4,i];
            end;
         t:=t+1;
         end;
   exit_busy_status;
   FormPeach.Caption:=s;
   if listsortcol=14 then
      begin
      sort_az_stringgridlist(14);
      update_listview;
      end;
   {$IFDEF DARWIN}update_listview;{$ENDIF}
   FormPeach.TimerBrowser.Enabled:=false;//analyzefolders changes size data used in TimerBrowser event to check for needing refresh, which would delete results from browser
   end;
end;

procedure checkselected(oper:ansistring);
var
   cl,in_param:ansistring;
   P:tprocessutf8;
   i:integer;
   sg:TStringGrid;
begin
in_param:='';
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then sg:=FormPeach.StringGridAdd
else sg:=FormPeach.StringGridExtract;
if sg.Row=0 then exit;
for i:=1 to sg.Rowcount-1 do
   if sg.Cells[11,i]='1' then in_param:=in_param+stringdelim(escapefilename(sg.Cells[8,i],desk_env))+' ';
check_files(in_param,cl,oper);
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
peapexecute(P,cl);
P.Free;
end;

procedure prev_checkselected_list(oper,fname:ansistring);
var
   cl,in_param:ansistring;
   P:tprocessutf8;
begin
if checkfiledirname(FormPeach.EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.EditOpenIn.Text); exit; end;
if fname='*' then fname:=FormPeach.EditOpenIn.Text;
in_param:=stringdelim(escapefilename(fname,desk_env));
check_files(in_param,cl,oper);
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
peapexecute(P,cl);
P.Free;
end;

procedure checkselected_list(oper:ansistring);
//check, list, checksum and file/folders analysis functions
//SHA256G, SHA256J, SHA256V, search sha256 on Jotti, Google, and Virustotal
//CRC32SAVE, MD5SAVE, SHA1SAVE, SHA256SAVE, BLAKE2BSAVE, save crc/hash values
var
   cl,in_param:ansistring;
   P:tprocessutf8;
   i:integer;
begin
in_param:='';
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if fun<>'FILEBROWSER' then
   begin
   if (fun='UNPEA') or (fun='UNPAQ') or (fun='UNLPAQ') or (fun='UNACE') then //file manager preview not supported, apply to archive
      begin
      prev_checkselected_list(oper,'*');
      end
   else
      begin
      if checklistanysel<>0 then //nothing selected, apply to archive
         prev_checkselected_list(oper,'*')
      else
         case oper of
            'check': openwith_cust('preview','checkselected',0);
            'list': openwith_cust('preview','checkselected',1);
            'SHA256G': openwith_cust('preview','checkselected',2);
            'SHA256J': openwith_cust('preview','checkselected',3);
            'SHA256V': openwith_cust('preview','checkselected',4);
            'CRC32SAVE': openwith_cust('preview','checkselected',5);
            'MD5SAVE': openwith_cust('preview','checkselected',6);
            'SHA1SAVE': openwith_cust('preview','checkselected',7);
            'SHA256SAVE': openwith_cust('preview','checkselected',8);
            'BLAKE2BSAVE': openwith_cust('preview','checkselected',9);
            end;
      end;
   exit;
   end;
if checklistanysel<>0 then exit;
for i:=1 to FormPeach.StringGridList.Rowcount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      begin
      if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
      in_param:=in_param+stringdelim(escapefilename(FormPeach.StringGridList.Cells[12,i],desk_env))+' ';
      end;
check_files(in_param,cl,oper);
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
peapexecute(P,cl);
P.Free;
end;

procedure lcheck(oper:ansistring);
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
checkselected_list(oper);
end;

procedure compareselected;
var
   cl,bin_name,filea,fileb:ansistring;
   P:tprocessutf8;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then sg:=FormPeach.StringGridAdd
else sg:=FormPeach.StringGridExtract;
if sg.Row=0 then exit;
if sg.Cells[8,sg.Row]='' then exit;
if FormPeach.OpenDialogArchive.Execute then
   if FormPeach.OpenDialogArchive.FileName<>'' then
      begin
      filea:=stringdelim(escapefilename(sg.Cells[8,sg.Row],desk_env));
      fileb:=stringdelim(escapefilename(FormPeach.OpenDialogArchive.Filename,desk_env));
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
      cl:=bin_name+' COMPARE '+filea+' '+fileb;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      peapexecute(P,cl);
      P.Free;
      end;
end;

procedure prev_compareselected_list(fname:ansistring);
var
   cl,bin_name, filea,fileb:ansistring;
   P:tprocessutf8;
begin
if checkfiledirname(FormPeach.EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.EditOpenIn.Text); exit; end;
if fname='*' then fname:=FormPeach.EditOpenIn.Text;
if FormPeach.OpenDialogArchive.Execute then
   if FormPeach.OpenDialogArchive.FileName<>'' then
      begin
      filea:=stringdelim(escapefilename(fname,desk_env));
      fileb:=stringdelim(escapefilename(FormPeach.OpenDialogArchive.Filename,desk_env));
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
      cl:=bin_name+' COMPARE '+filea+' '+fileb;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      peapexecute(P,cl);
      P.Free;
      end;
end;

procedure compareselected_list;
var
   cl,bin_name,filea,fileb:ansistring;
   P:tprocessutf8;
begin
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]='' then exit;
if fun<>'FILEBROWSER' then
   begin
   if (fun='UNPEA') or (fun='UNPAQ') or (fun='UNLPAQ') or (fun='UNACE') then //file manager preview not supported, apply to archive
      begin
      prev_compareselected_list('*');
      end
   else
      begin
      if checklistanysel<>0 then //nothing selected, apply to archive
         prev_compareselected_list('*')
      else
         openwith_cust('preview','compareselected',0);
      end;
   exit;
   end;
if checklistsel<>0 then exit;
if checkfiledirname(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]); exit; end;
if FormPeach.OpenDialogArchive.Execute then
   if FormPeach.OpenDialogArchive.FileName<>'' then
      begin
      filea:=stringdelim(escapefilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row],desk_env));
      fileb:=stringdelim(escapefilename(FormPeach.OpenDialogArchive.Filename,desk_env));
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
      cl:=bin_name+' COMPARE '+filea+' '+fileb;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      peapexecute(P,cl);
      P.Free;
      end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection SET COMPRESSION OPTIONS

///////////////////////////////////////////////////////////////////////////////}

procedure set_multi(s:ansistring); //sets multithreading option for 7za
begin
if s='on' then //allow multithread selection for Compression (LZMA/2 and BZip2), may be replaced by code more oriented toward processors number
   begin
   FormPeach.ComboBox7zThreads.Enabled:=true;
   FormPeach.ComboBox7zThreads.ItemIndex:=multi_option;
   end;
if s='off' then //disallow multithread selection since Compression algorithms used are not supported
   begin
   FormPeach.ComboBox7zThreads.Enabled:=false;
   //FormPeach.ComboBox7zThreads.ItemIndex:=0;
   end;
end;

procedure set_values(archive_type,compression_method,compression_level:ansistring);
begin
if archive_type=prev_type then
   if compression_method=prev_method then
     if compression_level=prev_level then exit;
settingvalues:=true;
prev_type:=archive_type;
prev_method:=compression_method;
prev_level:=compression_level;
FormPeach.ComboBox7zSolid.Enabled:=false;
FormPeach.ComboBox7zSolid.ItemIndex:=0;
FormPeach.Subtitle7zEncOpt.Visible:=false;
FormPeach.CheckBoxSolidExtension.Enabled:=false;
if archive_type='7z' then
   begin
   FormPeach.CheckBoxSolidExtension.Enabled:=true;
   FormPeach.ComboBox7zSolid.Enabled:=true;
   FormPeach.ComboBox7zMethod.Clear;
   FormPeach.ComboBox7zMethod.DropDownCount:=15;
   FormPeach.ComboBox7zMethod.Items.Append('LZMA');
   FormPeach.ComboBox7zMethod.Items.Append('LZMA2');
   FormPeach.ComboBox7zMethod.Items.Append('PPMd');
   FormPeach.ComboBox7zMethod.Items.Append('BZip2');
   FormPeach.ComboBox7zMethod.Items.Append('Brotli');
   FormPeach.ComboBox7zMethod.Items.Append('FLZMA2');
   FormPeach.ComboBox7zMethod.Items.Append('Lizard_fastLZ4');
   FormPeach.ComboBox7zMethod.Items.Append('Lizard_LIZv1');
   FormPeach.ComboBox7zMethod.Items.Append('Lizard_fastLZ4+Huffman');
   FormPeach.ComboBox7zMethod.Items.Append('Lizard_LIZv1+Huffman');
   FormPeach.ComboBox7zMethod.Items.Append('LZ4');
   FormPeach.ComboBox7zMethod.Items.Append('LZ5');
   FormPeach.ComboBox7zMethod.Items.Append('Zstd');
   FormPeach.ComboBox7zMethod.Items.Append('Deflate');
   FormPeach.ComboBox7zMethod.Items.Append('Deflate64');
   FormPeach.ComboBox7zLevel.Clear;
   FormPeach.ComboBox7zLevel.DropDownCount:=6;
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_store);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fastest);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fast);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_normal);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_maximum);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_ultra);
   FormPeach.Label7zEnc.Visible:=true;
   FormPeach.Subtitle7zEncOpt.Visible:=true;
   FormPeach.Combobox7zalgo.Visible:=true;
   FormPeach.Combobox7zalgo.Clear;
   FormPeach.Combobox7zalgo.DropDownCount:=1;
   FormPeach.Combobox7zalgo.Items.Append('AES256');
   FormPeach.Combobox7zalgo.ItemIndex:=0;
   if compression_level=txt_level_store then
      begin
      set_multi('off');
      FormPeach.ComboBox7zLevel.ItemIndex:=0;
      compression_method:='';
      FormPeach.ComboBox7zMethod.Clear;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=false;
      FormPeach.ComboBox7zDictionary.Enabled:=false;
      FormPeach.ComboBox7zWord.Enabled:=false;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      FormPeach.ComboBox7zSolid.Enabled:=false;
      end;
   if compression_method='LZMA' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=0;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=25;
      FormPeach.ComboBox7zDictionary.Items.Append('256 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('6 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('12 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('24 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('48 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('96 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('192 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('384 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('512 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('768 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1024 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1536 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2048 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3072 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4096 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('273');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=6;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=10;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=10;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=14;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=16;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      end;
   if compression_method='LZMA2' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=1;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=25;
      FormPeach.ComboBox7zDictionary.Items.Append('256 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('6 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('12 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('24 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('48 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('96 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('192 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('384 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('512 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('768 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1024 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1536 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2048 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3072 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4096 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('273');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=11;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=10;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=14;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=14;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=15;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=16;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=15;
         end;
      end;
   if compression_method='PPMd' then
      begin
      set_multi('off');
      FormPeach.ComboBox7zMethod.ItemIndex:=2;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=21;
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('6 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('12 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('24 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('48 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('96 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('192 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('384 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('512 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('768 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1024 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1536 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=15;
      FormPeach.ComboBox7zWord.Items.Append('2');
      FormPeach.ComboBox7zWord.Items.Append('3');
      FormPeach.ComboBox7zWord.Items.Append('4');
      FormPeach.ComboBox7zWord.Items.Append('5');
      FormPeach.ComboBox7zWord.Items.Append('6');
      FormPeach.ComboBox7zWord.Items.Append('7');
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('10');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('14');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('20');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('28');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=2;
         FormPeach.ComboBox7zSolid.ItemIndex:=8;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=3;
         FormPeach.ComboBox7zWord.ItemIndex:=2;
         FormPeach.ComboBox7zSolid.ItemIndex:=10;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=7;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=11;
         FormPeach.ComboBox7zWord.ItemIndex:=10;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=15;
         FormPeach.ComboBox7zWord.ItemIndex:=14;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      end;
   if compression_method='BZip2' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=3;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=9;
      FormPeach.ComboBox7zDictionary.Items.Append('100 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('200 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('300 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('400 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('500 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('600 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('700 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('800 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('900 KB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zPasses.DropDownCount:=10;
      FormPeach.ComboBox7zPasses.Items.Append('1');
      FormPeach.ComboBox7zPasses.Items.Append('2');
      FormPeach.ComboBox7zPasses.Items.Append('3');
      FormPeach.ComboBox7zPasses.Items.Append('4');
      FormPeach.ComboBox7zPasses.Items.Append('5');
      FormPeach.ComboBox7zPasses.Items.Append('6');
      FormPeach.ComboBox7zPasses.Items.Append('7');
      FormPeach.ComboBox7zPasses.Items.Append('8');
      FormPeach.ComboBox7zPasses.Items.Append('9');
      FormPeach.ComboBox7zPasses.Items.Append('10');
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=false;
      FormPeach.ComboBox7zPasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         FormPeach.ComboBox7zSolid.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         FormPeach.ComboBox7zSolid.ItemIndex:=6;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         FormPeach.ComboBox7zSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=1;
         FormPeach.ComboBox7zSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=7;
         end;
      end;
   end;
   if (compression_method='Brotli') or
      (compression_method='Lizard_fastLZ4') or
      (compression_method='Lizard_LIZv1') or
      (compression_method='Lizard_fastLZ4+Huffman') or
      (compression_method='Lizard_LIZv1+Huffman') or
      (compression_method='LZ4')  or
      (compression_method='LZ5') or
      (compression_method='Zstd')then
      begin
      set_multi('on');
      case compression_method of
         'Brotli': FormPeach.ComboBox7zMethod.ItemIndex:=4;
         'Lizard_fastLZ4': FormPeach.ComboBox7zMethod.ItemIndex:=6;
         'Lizard_LIZv1': FormPeach.ComboBox7zMethod.ItemIndex:=7;
         'Lizard_fastLZ4+Huffman': FormPeach.ComboBox7zMethod.ItemIndex:=8;
         'Lizard_LIZv1+Huffman': FormPeach.ComboBox7zMethod.ItemIndex:=9;
         'LZ4': FormPeach.ComboBox7zMethod.ItemIndex:=10;
         'LZ5': FormPeach.ComboBox7zMethod.ItemIndex:=11;
         'Zstd': FormPeach.ComboBox7zMethod.ItemIndex:=12;
         end;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=0;
      FormPeach.ComboBox7zDictionary.Enabled:=False;
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=0;
      FormPeach.ComboBox7zWord.Enabled:=False;
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=0;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zSolid.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zSolid.ItemIndex:=8;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      end;
   if compression_method='FLZMA2' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=5;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=22;
      FormPeach.ComboBox7zDictionary.Items.Append('64 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('6 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('12 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('24 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('48 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('96 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('192 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('384 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('512 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('768 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1024 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1536 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('273');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=1;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=8;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=10;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=12;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      end;
if compression_method='Deflate' then
   begin
   set_multi('on');
   FormPeach.ComboBox7zMethod.ItemIndex:=13;
   FormPeach.ComboBox7zDictionary.Clear;
   FormPeach.ComboBox7zDictionary.DropDownCount:=1;
   FormPeach.ComboBox7zDictionary.Items.Append('32 KB');
   FormPeach.ComboBox7zWord.Clear;
   FormPeach.ComboBox7zWord.DropDownCount:=12;
   FormPeach.ComboBox7zWord.Items.Append('8');
   FormPeach.ComboBox7zWord.Items.Append('12');
   FormPeach.ComboBox7zWord.Items.Append('16');
   FormPeach.ComboBox7zWord.Items.Append('24');
   FormPeach.ComboBox7zWord.Items.Append('32');
   FormPeach.ComboBox7zWord.Items.Append('48');
   FormPeach.ComboBox7zWord.Items.Append('64');
   FormPeach.ComboBox7zWord.Items.Append('96');
   FormPeach.ComboBox7zWord.Items.Append('128');
   FormPeach.ComboBox7zWord.Items.Append('192');
   FormPeach.ComboBox7zWord.Items.Append('256');
   FormPeach.ComboBox7zWord.Items.Append('258');
   FormPeach.ComboBox7zPasses.Clear;
   FormPeach.ComboBox7zPasses.DropDownCount:=15;
   FormPeach.ComboBox7zPasses.Items.Append('1');
   FormPeach.ComboBox7zPasses.Items.Append('2');
   FormPeach.ComboBox7zPasses.Items.Append('3');
   FormPeach.ComboBox7zPasses.Items.Append('4');
   FormPeach.ComboBox7zPasses.Items.Append('5');
   FormPeach.ComboBox7zPasses.Items.Append('6');
   FormPeach.ComboBox7zPasses.Items.Append('7');
   FormPeach.ComboBox7zPasses.Items.Append('8');
   FormPeach.ComboBox7zPasses.Items.Append('9');
   FormPeach.ComboBox7zPasses.Items.Append('10');
   FormPeach.ComboBox7zPasses.Items.Append('11');
   FormPeach.ComboBox7zPasses.Items.Append('12');
   FormPeach.ComboBox7zPasses.Items.Append('13');
   FormPeach.ComboBox7zPasses.Items.Append('14');
   FormPeach.ComboBox7zPasses.Items.Append('15');
   FormPeach.ComboBox7zMethod.Enabled:=true;
   FormPeach.ComboBox7zDictionary.Enabled:=true;
   FormPeach.ComboBox7zWord.Enabled:=true;
   FormPeach.ComboBox7zPasses.Enabled:=true;
   if compression_level=txt_level_fastest then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=1;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      FormPeach.ComboBox7zSolid.ItemIndex:=4;
      end;
   if compression_level=txt_level_fast then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=2;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      FormPeach.ComboBox7zSolid.ItemIndex:=8;
      end;
   if compression_level=txt_level_normal then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=3;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      FormPeach.ComboBox7zSolid.ItemIndex:=12;
      end;
   if compression_level=txt_level_maximum then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=4;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=6;
      FormPeach.ComboBox7zPasses.ItemIndex:=2;
      FormPeach.ComboBox7zSolid.ItemIndex:=13;
      end;
   if compression_level=txt_level_ultra then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=5;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=8;
      FormPeach.ComboBox7zPasses.ItemIndex:=9;
      FormPeach.ComboBox7zSolid.ItemIndex:=13;
      end;
   end;
if compression_method='Deflate64' then
   begin
   set_multi('on');
   FormPeach.ComboBox7zMethod.ItemIndex:=14;
   FormPeach.ComboBox7zDictionary.Clear;
   FormPeach.ComboBox7zDictionary.DropDownCount:=1;
   FormPeach.ComboBox7zDictionary.Items.Append('64 KB');
   FormPeach.ComboBox7zWord.Clear;
   FormPeach.ComboBox7zWord.DropDownCount:=12;
   FormPeach.ComboBox7zWord.Items.Append('8');
   FormPeach.ComboBox7zWord.Items.Append('12');
   FormPeach.ComboBox7zWord.Items.Append('16');
   FormPeach.ComboBox7zWord.Items.Append('24');
   FormPeach.ComboBox7zWord.Items.Append('32');
   FormPeach.ComboBox7zWord.Items.Append('48');
   FormPeach.ComboBox7zWord.Items.Append('64');
   FormPeach.ComboBox7zWord.Items.Append('96');
   FormPeach.ComboBox7zWord.Items.Append('128');
   FormPeach.ComboBox7zWord.Items.Append('192');
   FormPeach.ComboBox7zWord.Items.Append('256');
   FormPeach.ComboBox7zWord.Items.Append('257');
   FormPeach.ComboBox7zPasses.Clear;
   FormPeach.ComboBox7zPasses.DropDownCount:=15;
   FormPeach.ComboBox7zPasses.Items.Append('1');
   FormPeach.ComboBox7zPasses.Items.Append('2');
   FormPeach.ComboBox7zPasses.Items.Append('3');
   FormPeach.ComboBox7zPasses.Items.Append('4');
   FormPeach.ComboBox7zPasses.Items.Append('5');
   FormPeach.ComboBox7zPasses.Items.Append('6');
   FormPeach.ComboBox7zPasses.Items.Append('7');
   FormPeach.ComboBox7zPasses.Items.Append('8');
   FormPeach.ComboBox7zPasses.Items.Append('9');
   FormPeach.ComboBox7zPasses.Items.Append('10');
   FormPeach.ComboBox7zPasses.Items.Append('11');
   FormPeach.ComboBox7zPasses.Items.Append('12');
   FormPeach.ComboBox7zPasses.Items.Append('13');
   FormPeach.ComboBox7zPasses.Items.Append('14');
   FormPeach.ComboBox7zPasses.Items.Append('15');
   FormPeach.ComboBox7zMethod.Enabled:=true;
   FormPeach.ComboBox7zDictionary.Enabled:=true;
   FormPeach.ComboBox7zWord.Enabled:=true;
   FormPeach.ComboBox7zPasses.Enabled:=true;
   if compression_level=txt_level_fastest then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=1;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      FormPeach.ComboBox7zSolid.ItemIndex:=4;
      end;
   if compression_level=txt_level_fast then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=2;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      FormPeach.ComboBox7zSolid.ItemIndex:=8;
      end;
   if compression_level=txt_level_normal then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=3;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      FormPeach.ComboBox7zSolid.ItemIndex:=12;
      end;
   if compression_level=txt_level_maximum then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=4;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=6;
      FormPeach.ComboBox7zPasses.ItemIndex:=2;
      FormPeach.ComboBox7zSolid.ItemIndex:=13;
      end;
   if compression_level=txt_level_ultra then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=5;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=8;
      FormPeach.ComboBox7zPasses.ItemIndex:=9;
      FormPeach.ComboBox7zSolid.ItemIndex:=13;
      end;
   end;
if archive_type='xz' then
   begin
   FormPeach.ComboBox7zSolid.Enabled:=true;
   FormPeach.ComboBox7zMethod.Clear;
   FormPeach.ComboBox7zMethod.DropDownCount:=1;
   FormPeach.ComboBox7zMethod.Items.Append('LZMA2');
   FormPeach.ComboBox7zMethod.ItemIndex:=0;
   FormPeach.ComboBox7zLevel.Clear;
   FormPeach.ComboBox7zLevel.DropDownCount:=5;
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fastest);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fast);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_normal);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_maximum);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_ultra);
   FormPeach.Label7zEnc.Visible:=false;
   FormPeach.Combobox7zalgo.Visible:=false;
   if compression_method='LZMA2' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=1;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=25;
      FormPeach.ComboBox7zDictionary.Items.Append('256 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('6 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('12 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('24 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('48 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('96 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('192 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('384 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('512 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('768 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1024 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1536 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2048 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3072 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4096 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('273');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=0;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=11;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=10;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=14;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=12;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zSolid.ItemIndex:=15;
         end;
      end;
   end;
if archive_type='wim' then
   begin
   set_multi('off');
   FormPeach.ComboBox7zMethod.Clear;
   FormPeach.ComboBox7zMethod.DropDownCount:=1;
   FormPeach.ComboBox7zMethod.Items.Append('');
   FormPeach.ComboBox7zLevel.Clear;
   FormPeach.ComboBox7zLevel.DropDownCount:=1;
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_store);
   FormPeach.ComboBox7zDictionary.Clear;
   FormPeach.ComboBox7zDictionary.DropDownCount:=1;
   FormPeach.ComboBox7zDictionary.Items.Append('');
   FormPeach.ComboBox7zWord.Clear;
   FormPeach.ComboBox7zWord.DropDownCount:=1;
   FormPeach.ComboBox7zWord.Items.Append('');
   FormPeach.ComboBox7zPasses.Clear;
   FormPeach.ComboBox7zMethod.ItemIndex:=0;
   FormPeach.ComboBox7zLevel.ItemIndex:=0;
   FormPeach.ComboBox7zDictionary.ItemIndex:=0;
   FormPeach.ComboBox7zWord.ItemIndex:=0;
   FormPeach.ComboBox7zPasses.ItemIndex:=0;
   FormPeach.ComboBox7zMethod.Enabled:=false;
   FormPeach.ComboBox7zDictionary.Enabled:=false;
   FormPeach.ComboBox7zWord.Enabled:=false;
   FormPeach.Label7zEnc.Visible:=false;
   FormPeach.Combobox7zalgo.Visible:=false;
   FormPeach.ComboBox7zPasses.Enabled:=false;
   end;
if archive_type='tar' then
   begin
   set_multi('off');
   FormPeach.ComboBox7zMethod.Clear;
   FormPeach.ComboBox7zMethod.DropDownCount:=1;
   FormPeach.ComboBox7zMethod.Items.Append('');
   FormPeach.ComboBox7zLevel.Clear;
   FormPeach.ComboBox7zLevel.DropDownCount:=1;
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_store);
   FormPeach.ComboBox7zDictionary.Clear;
   FormPeach.ComboBox7zDictionary.DropDownCount:=1;
   FormPeach.ComboBox7zDictionary.Items.Append('');
   FormPeach.ComboBox7zWord.Clear;
   FormPeach.ComboBox7zWord.DropDownCount:=1;
   FormPeach.ComboBox7zWord.Items.Append('');
   FormPeach.ComboBox7zPasses.Clear;
   FormPeach.ComboBox7zMethod.ItemIndex:=0;
   FormPeach.ComboBox7zLevel.ItemIndex:=0;
   FormPeach.ComboBox7zDictionary.ItemIndex:=0;
   FormPeach.ComboBox7zWord.ItemIndex:=0;
   FormPeach.ComboBox7zPasses.ItemIndex:=0;
   FormPeach.ComboBox7zMethod.Enabled:=false;
   FormPeach.ComboBox7zDictionary.Enabled:=false;
   FormPeach.ComboBox7zWord.Enabled:=false;
   FormPeach.Label7zEnc.Visible:=false;
   FormPeach.Combobox7zalgo.Visible:=false;
   FormPeach.ComboBox7zPasses.Enabled:=false;
   end;
if archive_type='zip' then
   begin
   FormPeach.ComboBox7zMethod.Clear;
   {$IFDEF MSWINDOWS}
   FormPeach.ComboBox7zMethod.DropDownCount:=6;
   {$ELSE}
   FormPeach.ComboBox7zMethod.DropDownCount:=7;
   {$ENDIF}
   FormPeach.ComboBox7zMethod.Items.Append('Deflate');
   FormPeach.ComboBox7zMethod.Items.Append('Deflate64');
   FormPeach.ComboBox7zMethod.Items.Append('BZip2');
   FormPeach.ComboBox7zMethod.Items.Append('LZMA');
   FormPeach.ComboBox7zMethod.Items.Append('PPMd');
   FormPeach.ComboBox7zMethod.Items.Append('XZ');
   {$IFNDEF MSWINDOWS}
   FormPeach.ComboBox7zMethod.Items.Append('Zstd');
   {$ENDIF}
   FormPeach.ComboBox7zLevel.Clear;
   FormPeach.ComboBox7zLevel.DropDownCount:=6;
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_store);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fastest);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fast);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_normal);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_maximum);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_ultra);
   FormPeach.Label7zEnc.Visible:=true;
   FormPeach.Subtitle7zEncOpt.Visible:=true;
   FormPeach.Combobox7zalgo.Visible:=true;
   FormPeach.Combobox7zalgo.Clear;
   FormPeach.Combobox7zalgo.DropDownCount:=2;
   FormPeach.Combobox7zalgo.Items.Append('AES256');
   FormPeach.Combobox7zalgo.Items.Append(txt_zipcrypto_hint);
   FormPeach.Combobox7zalgo.ItemIndex:=algo_zipenc;
   if compression_level=txt_level_store then
      begin
      set_multi('off');
      FormPeach.ComboBox7zLevel.ItemIndex:=0;
      compression_method:='';
      FormPeach.ComboBox7zMethod.Clear;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=false;
      FormPeach.ComboBox7zDictionary.Enabled:=false;
      FormPeach.ComboBox7zWord.Enabled:=false;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      end;
   if compression_method='Deflate' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=0;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=1;
      FormPeach.ComboBox7zDictionary.Items.Append('32 KB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('258');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zPasses.DropDownCount:=15;
      FormPeach.ComboBox7zPasses.Items.Append('1');
      FormPeach.ComboBox7zPasses.Items.Append('2');
      FormPeach.ComboBox7zPasses.Items.Append('3');
      FormPeach.ComboBox7zPasses.Items.Append('4');
      FormPeach.ComboBox7zPasses.Items.Append('5');
      FormPeach.ComboBox7zPasses.Items.Append('6');
      FormPeach.ComboBox7zPasses.Items.Append('7');
      FormPeach.ComboBox7zPasses.Items.Append('8');
      FormPeach.ComboBox7zPasses.Items.Append('9');
      FormPeach.ComboBox7zPasses.Items.Append('10');
      FormPeach.ComboBox7zPasses.Items.Append('11');
      FormPeach.ComboBox7zPasses.Items.Append('12');
      FormPeach.ComboBox7zPasses.Items.Append('13');
      FormPeach.ComboBox7zPasses.Items.Append('14');
      FormPeach.ComboBox7zPasses.Items.Append('15');
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zPasses.ItemIndex:=2;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=8;
         FormPeach.ComboBox7zPasses.ItemIndex:=9;
         end;
      end;
   if compression_method='Deflate64' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=1;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=1;
      FormPeach.ComboBox7zDictionary.Items.Append('64 KB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('257');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zPasses.DropDownCount:=15;
      FormPeach.ComboBox7zPasses.Items.Append('1');
      FormPeach.ComboBox7zPasses.Items.Append('2');
      FormPeach.ComboBox7zPasses.Items.Append('3');
      FormPeach.ComboBox7zPasses.Items.Append('4');
      FormPeach.ComboBox7zPasses.Items.Append('5');
      FormPeach.ComboBox7zPasses.Items.Append('6');
      FormPeach.ComboBox7zPasses.Items.Append('7');
      FormPeach.ComboBox7zPasses.Items.Append('8');
      FormPeach.ComboBox7zPasses.Items.Append('9');
      FormPeach.ComboBox7zPasses.Items.Append('10');
      FormPeach.ComboBox7zPasses.Items.Append('11');
      FormPeach.ComboBox7zPasses.Items.Append('12');
      FormPeach.ComboBox7zPasses.Items.Append('13');
      FormPeach.ComboBox7zPasses.Items.Append('14');
      FormPeach.ComboBox7zPasses.Items.Append('15');
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;//4;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         FormPeach.ComboBox7zPasses.ItemIndex:=2;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=8;
         FormPeach.ComboBox7zPasses.ItemIndex:=9;
         end;
      end;
   if compression_method='BZip2' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=2;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=9;
      FormPeach.ComboBox7zDictionary.Items.Append('100 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('200 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('300 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('400 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('500 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('600 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('700 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('800 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('900 KB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zPasses.DropDownCount:=10;
      FormPeach.ComboBox7zPasses.Items.Append('1');
      FormPeach.ComboBox7zPasses.Items.Append('2');
      FormPeach.ComboBox7zPasses.Items.Append('3');
      FormPeach.ComboBox7zPasses.Items.Append('4');
      FormPeach.ComboBox7zPasses.Items.Append('5');
      FormPeach.ComboBox7zPasses.Items.Append('6');
      FormPeach.ComboBox7zPasses.Items.Append('7');
      FormPeach.ComboBox7zPasses.Items.Append('8');
      FormPeach.ComboBox7zPasses.Items.Append('9');
      FormPeach.ComboBox7zPasses.Items.Append('10');
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=false;
      FormPeach.ComboBox7zPasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=1;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=0;
         FormPeach.ComboBox7zPasses.ItemIndex:=6;
         end;
      end;
   if compression_method='LZMA' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=3;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=25;
      FormPeach.ComboBox7zDictionary.Items.Append('256 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('6 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('12 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('24 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('48 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('96 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('192 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('384 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('512 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('768 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1024 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1536 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2048 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3072 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4096 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('273');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=10;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=12;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         end;
      end;
   if compression_method='PPMd' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=4;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=9;
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=15;
      FormPeach.ComboBox7zWord.Items.Append('2');
      FormPeach.ComboBox7zWord.Items.Append('3');
      FormPeach.ComboBox7zWord.Items.Append('4');
      FormPeach.ComboBox7zWord.Items.Append('5');
      FormPeach.ComboBox7zWord.Items.Append('6');
      FormPeach.ComboBox7zWord.Items.Append('7');
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('9');
      FormPeach.ComboBox7zWord.Items.Append('10');
      FormPeach.ComboBox7zWord.Items.Append('11');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('13');
      FormPeach.ComboBox7zWord.Items.Append('14');
      FormPeach.ComboBox7zWord.Items.Append('15');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=2;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=2;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=6;
         FormPeach.ComboBox7zWord.ItemIndex:=8;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=7;
         FormPeach.ComboBox7zWord.ItemIndex:=10;
         end;
      end;

   if compression_method='XZ' then
      begin
      set_multi('on');
      FormPeach.ComboBox7zMethod.ItemIndex:=5;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=25;
      FormPeach.ComboBox7zDictionary.Items.Append('256 KB');
      FormPeach.ComboBox7zDictionary.Items.Append('1 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('6 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('8 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('12 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('16 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('24 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('32 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('48 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('64 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('96 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('128 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('192 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('256 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('384 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('512 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('768 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1024 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('1536 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('2048 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('3072 MB');
      FormPeach.ComboBox7zDictionary.Items.Append('4096 MB');
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=12;
      FormPeach.ComboBox7zWord.Items.Append('8');
      FormPeach.ComboBox7zWord.Items.Append('12');
      FormPeach.ComboBox7zWord.Items.Append('16');
      FormPeach.ComboBox7zWord.Items.Append('24');
      FormPeach.ComboBox7zWord.Items.Append('32');
      FormPeach.ComboBox7zWord.Items.Append('48');
      FormPeach.ComboBox7zWord.Items.Append('64');
      FormPeach.ComboBox7zWord.Items.Append('96');
      FormPeach.ComboBox7zWord.Items.Append('128');
      FormPeach.ComboBox7zWord.Items.Append('192');
      FormPeach.ComboBox7zWord.Items.Append('256');
      FormPeach.ComboBox7zWord.Items.Append('273');
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zDictionary.Enabled:=true;
      FormPeach.ComboBox7zWord.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zDictionary.ItemIndex:=0;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zDictionary.ItemIndex:=4;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zDictionary.ItemIndex:=8;
         FormPeach.ComboBox7zWord.ItemIndex:=4;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zDictionary.ItemIndex:=10;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zDictionary.ItemIndex:=12;
         FormPeach.ComboBox7zWord.ItemIndex:=6;
         end;
      end;
   {$IFNDEF MSWINDOWS}
   if (compression_method='Zstd') then
      begin
      set_multi('on');
      case compression_method of
         'Zstd': FormPeach.ComboBox7zMethod.ItemIndex:=6;
         end;
      FormPeach.ComboBox7zDictionary.Clear;
      FormPeach.ComboBox7zDictionary.DropDownCount:=0;
      FormPeach.ComboBox7zDictionary.Enabled:=False;
      FormPeach.ComboBox7zWord.Clear;
      FormPeach.ComboBox7zWord.DropDownCount:=0;
      FormPeach.ComboBox7zWord.Enabled:=False;
      FormPeach.ComboBox7zPasses.Clear;
      FormPeach.ComboBox7zMethod.Enabled:=true;
      FormPeach.ComboBox7zPasses.Enabled:=false;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=0;
      if compression_level=txt_level_fastest then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=1;
         FormPeach.ComboBox7zSolid.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=2;
         FormPeach.ComboBox7zSolid.ItemIndex:=8;
         end;
      if compression_level=txt_level_normal then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=3;
         FormPeach.ComboBox7zSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=4;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         FormPeach.ComboBox7zLevel.ItemIndex:=5;
         FormPeach.ComboBox7zSolid.ItemIndex:=13;
         end;
      end;
   {$ENDIF}
   end;
if archive_type='bz2' then
   begin
   set_multi('on');
   FormPeach.ComboBox7zMethod.Clear;
   FormPeach.ComboBox7zMethod.DropDownCount:=1;
   FormPeach.ComboBox7zMethod.Items.Append('BZip2');
   FormPeach.ComboBox7zMethod.ItemIndex:=0;
   FormPeach.ComboBox7zLevel.Clear;
   FormPeach.ComboBox7zLevel.DropDownCount:=5;
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fastest);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fast);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_normal);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_maximum);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_ultra);
   FormPeach.ComboBox7zDictionary.Clear;
   FormPeach.ComboBox7zDictionary.DropDownCount:=9;
   FormPeach.ComboBox7zDictionary.Items.Append('100 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('200 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('300 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('400 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('500 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('600 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('700 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('800 KB');
   FormPeach.ComboBox7zDictionary.Items.Append('900 KB');
   FormPeach.ComboBox7zWord.Clear;
   FormPeach.ComboBox7zPasses.Clear;
   FormPeach.ComboBox7zPasses.DropDownCount:=10;
   FormPeach.ComboBox7zPasses.Items.Append('1');
   FormPeach.ComboBox7zPasses.Items.Append('2');
   FormPeach.ComboBox7zPasses.Items.Append('3');
   FormPeach.ComboBox7zPasses.Items.Append('4');
   FormPeach.ComboBox7zPasses.Items.Append('5');
   FormPeach.ComboBox7zPasses.Items.Append('6');
   FormPeach.ComboBox7zPasses.Items.Append('7');
   FormPeach.ComboBox7zPasses.Items.Append('8');
   FormPeach.ComboBox7zPasses.Items.Append('9');
   FormPeach.ComboBox7zPasses.Items.Append('10');
   FormPeach.ComboBox7zMethod.Enabled:=true;
   FormPeach.ComboBox7zDictionary.Enabled:=true;
   FormPeach.ComboBox7zWord.Enabled:=false;
   FormPeach.Label7zEnc.Visible:=false;
   FormPeach.Combobox7zalgo.Visible:=false;
   FormPeach.ComboBox7zPasses.Enabled:=true;
   if compression_level=txt_level_fastest then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=0;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=0;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      end;
   if compression_level=txt_level_fast then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=1;
      FormPeach.ComboBox7zDictionary.ItemIndex:=4;
      FormPeach.ComboBox7zWord.ItemIndex:=0;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      end;
   if compression_level=txt_level_normal then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=2;
      FormPeach.ComboBox7zDictionary.ItemIndex:=8;
      FormPeach.ComboBox7zWord.ItemIndex:=0;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      end;
   if compression_level=txt_level_maximum then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=3;
      FormPeach.ComboBox7zDictionary.ItemIndex:=8;
      FormPeach.ComboBox7zWord.ItemIndex:=0;
      FormPeach.ComboBox7zPasses.ItemIndex:=1;
      end;
   if compression_level=txt_level_ultra then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=4;
      FormPeach.ComboBox7zDictionary.ItemIndex:=8;
      FormPeach.ComboBox7zWord.ItemIndex:=0;
      FormPeach.ComboBox7zPasses.ItemIndex:=6;
      end;
   end;
if archive_type='gz' then
   begin
   set_multi('on');
   FormPeach.ComboBox7zMethod.Clear;
   FormPeach.ComboBox7zMethod.DropDownCount:=1;
   FormPeach.ComboBox7zMethod.Items.Append('Deflate');
   FormPeach.ComboBox7zMethod.ItemIndex:=0;
   FormPeach.ComboBox7zLevel.Clear;
   FormPeach.ComboBox7zLevel.DropDownCount:=5;
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fastest);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_fast);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_normal);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_maximum);
   FormPeach.ComboBox7zLevel.Items.Append(txt_level_ultra);
   FormPeach.ComboBox7zDictionary.Clear;
   FormPeach.ComboBox7zDictionary.DropDownCount:=1;
   FormPeach.ComboBox7zDictionary.Items.Append('32 KB');
   FormPeach.ComboBox7zWord.Clear;
   FormPeach.ComboBox7zWord.DropDownCount:=12;
   FormPeach.ComboBox7zWord.Items.Append('8');
   FormPeach.ComboBox7zWord.Items.Append('12');
   FormPeach.ComboBox7zWord.Items.Append('16');
   FormPeach.ComboBox7zWord.Items.Append('24');
   FormPeach.ComboBox7zWord.Items.Append('32');
   FormPeach.ComboBox7zWord.Items.Append('48');
   FormPeach.ComboBox7zWord.Items.Append('64');
   FormPeach.ComboBox7zWord.Items.Append('96');
   FormPeach.ComboBox7zWord.Items.Append('128');
   FormPeach.ComboBox7zWord.Items.Append('192');
   FormPeach.ComboBox7zWord.Items.Append('256');
   FormPeach.ComboBox7zWord.Items.Append('258');
   FormPeach.ComboBox7zPasses.Clear;
   FormPeach.ComboBox7zPasses.DropDownCount:=15;
   FormPeach.ComboBox7zPasses.Items.Append('1');
   FormPeach.ComboBox7zPasses.Items.Append('2');
   FormPeach.ComboBox7zPasses.Items.Append('3');
   FormPeach.ComboBox7zPasses.Items.Append('4');
   FormPeach.ComboBox7zPasses.Items.Append('5');
   FormPeach.ComboBox7zPasses.Items.Append('6');
   FormPeach.ComboBox7zPasses.Items.Append('7');
   FormPeach.ComboBox7zPasses.Items.Append('8');
   FormPeach.ComboBox7zPasses.Items.Append('9');
   FormPeach.ComboBox7zPasses.Items.Append('10');
   FormPeach.ComboBox7zPasses.Items.Append('11');
   FormPeach.ComboBox7zPasses.Items.Append('12');
   FormPeach.ComboBox7zPasses.Items.Append('13');
   FormPeach.ComboBox7zPasses.Items.Append('14');
   FormPeach.ComboBox7zPasses.Items.Append('15');
   FormPeach.ComboBox7zMethod.Enabled:=true;
   FormPeach.ComboBox7zDictionary.Enabled:=true;
   FormPeach.ComboBox7zWord.Enabled:=true;
   FormPeach.Label7zEnc.Visible:=false;
   FormPeach.Combobox7zalgo.Visible:=false;
   FormPeach.ComboBox7zPasses.Enabled:=true;
   if compression_level=txt_level_fastest then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=0;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=0;//4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      end;
   if compression_level=txt_level_fast then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=1;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=2;//4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      end;
   if compression_level=txt_level_normal then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=2;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=4;
      FormPeach.ComboBox7zPasses.ItemIndex:=0;
      end;
   if compression_level=txt_level_maximum then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=3;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=6;
      FormPeach.ComboBox7zPasses.ItemIndex:=2;
      end;
   if compression_level=txt_level_ultra then
      begin
      FormPeach.ComboBox7zLevel.ItemIndex:=4;
      FormPeach.ComboBox7zDictionary.ItemIndex:=0;
      FormPeach.ComboBox7zWord.ItemIndex:=8;
      FormPeach.ComboBox7zPasses.ItemIndex:=9;
      end;
   end;
if openw_all7z=1 then FormPeach.CheckBox7zOF.State:=cbChecked
else FormPeach.CheckBox7zOF.State:=cbUnChecked;
if snoi7z=1 then FormPeach.CheckBoxsnoi.State:=cbChecked
else FormPeach.CheckBoxsnoi.State:=cbUnChecked;
if snon7z=1 then FormPeach.CheckBoxsnon.State:=cbChecked
else FormPeach.CheckBoxsnon.State:=cbUnChecked;
FormPeach.ComboBox7zMemuse.ItemIndex:=memuse_option;
FormPeach.ComboBoxtar.ItemIndex:=tartype;
FormPeach.ComboBoxTARTS.ItemIndex:=tartime;
if sort7zbytype=1 then FormPeach.CheckBoxSolidExtension.State:=cbChecked
else FormPeach.CheckBoxSolidExtension.State:=cbUnChecked;
if loadadvdefaults=true then
   begin
   if (advopdictionary>=0) and (advopdictionary<FormPeach.ComboBox7zDictionary.Items.Count) then
      FormPeach.ComboBox7zDictionary.ItemIndex:=advopdictionary;
   if (advopword>=0) and (advopword<FormPeach.ComboBox7zWord.Items.Count) then
      FormPeach.ComboBox7zWord.ItemIndex:=advopword;
   if (advoppasses>=0) and (advoppasses<FormPeach.ComboBox7zPasses.Items.Count) then
      FormPeach.ComboBox7zPasses.ItemIndex:=advoppasses;
   if (advopblocksize>=0) and (advopblocksize<FormPeach.ComboBox7zSolid.Items.Count) then
      FormPeach.ComboBox7zSolid.ItemIndex:=advopblocksize;
   end;
settingvalues:=false;
end;

procedure change_imagesplit;
begin
   case FormPeach.cbSplit.ItemIndex of
      0: FormPeach.ImageSplit.Picture.Bitmap:=nil;
      1: FormPeach.ImageSplit.Picture.Bitmap:=nil;
      2: FormPeach.ImageSplit.Picture.Bitmap:=Bfd_supported;
      3: FormPeach.ImageSplit.Picture.Bitmap:=Bmail;
      4: FormPeach.ImageSplit.Picture.Bitmap:=Bmail;
      5: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      6: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      7: FormPeach.ImageSplit.Picture.Bitmap:=Bhd_supported;
      8: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      9: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      10: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      11: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      12: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      13: FormPeach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      end;
end;

procedure suggest_outname(var s:ansistring; t:ansistring; i:integer); //suggest output name, without extension (if applicable)
var
   str,pname,aname:ansistring;
   usefoldername:boolean;
begin
if (FormPeach.EditAddName.Enabled=false) then //existing archive is being updated
   begin
   s:=FormPeach.editopenin.text;
   cutextension(s);
   exit;//does not change archive name if adding to existing archive
   end;
usefoldername:=false;
if (i=0) or (i>FormPeach.StringGridAdd.RowCount-1) then i:=FormPeach.StringGridAdd.Row;
if FormPeach.StringGridAdd.RowCount>1 then
   begin
   //use specified name (if entered) or compose name from selected object's name
   if (FormPeach.CheckBoxNameAsParentFolder.Checked=true) and (FormPeach.CheckBoxSeparate.Checked=false) then
      if FormPeach.StringGridAdd.RowCount>2 then
         begin
         usefoldername:=true;
         str:=extractfilepath(FormPeach.StringGridAdd.Cells[8,i]);
         if str<>'' then
            if str[length(str)]=directoryseparator then setlength(str,length(str)-1);
         pname:=extractfilename(str);
         str:=str+directoryseparator;
         str:=str+pname;
         end
      else str:=FormPeach.StringGridAdd.Cells[8,i]
   else str:=FormPeach.StringGridAdd.Cells[8,i];
   aname:=str;
   cutextension(aname); //aname has the extension cut
   if checkdirexists(str) then s:=str //never cut after last dot for directories
   else s:=aname; //else cut extension by default
   //exceptions:
   if (t=txt_split) or (t=STR_BZIP2) or (t=STR_GZIP) or (t=STR_XZ) or (t=STR_QUAD) or (t=STR_BROTLI) or (t=STR_ZSTD) then s:=str;
   //full name if using split, to have filename.ext.001
   //full name if using Bzip2, Gz, Xz, QUAD/BALZ/BCM, Brotli, and Zstd in order to keep original file extension
   if (t=STR_ZPAQ) and (FormPeach.RadioGroupPaq.ItemIndex=0) then s:=str; //full name if using LPAQ, to keep original file extension
   if (FormPeach.StringGridAdd.Rowcount=2) and (FormPeach.StringGridAdd.Cells[2,1]=txt_list_isfolder) then s:=str; //don't strip "extension" if compressing a single dir (it is indeed part of the name)
   if (FormPeach.StringGridAdd.Rowcount=2) and (upcase(copy(str,length(str)-3,4))='.TAR') then s:=str; //don't strip .tar extension if compressing a single tar, to have filename.tar.compression
   if usefoldername=true then s:=str;//if naming after the parent directory, never cut extension (it is a directory name)
   //if a directory name is returned
   if extractfilename(s)='' then s:=s+copy(FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row],1,1);
   if s=directoryseparator then s:='1';
   end;
end;

procedure check_tarbefore(tdirs:integer);
var i:integer;
begin
if (FormPeach.CheckBoxSeparate.Enabled=true) then
   if (FormPeach.CheckBoxSeparate.State=cbChecked) then exit;//disable if creating separate archives
FormPeach.CheckBoxSameArc.State:=cbUnChecked;
on_checkboxsamearcclick;
FormPeach.CheckBoxSameArc.Enabled:=False;
FormPeach.CheckBoxSeparate.State:=cbUnChecked;
on_checkboxseparateclick;
FormPeach.CheckBoxSeparate.Enabled:=False;
FormPeach.CheckBoxConvert.State:=cbUnChecked;
FormPeach.CheckBoxConvert.Enabled:=False;
FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) then
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked
else
   begin
   FormPeach.CheckBoxTarBefore.State:=cbChecked;
   FormPeach.StringGridTB.RowCount:=FormPeach.StringGridAdd.RowCount;
   for i:=0 to FormPeach.StringGridAdd.RowCount-1 do
      FormPeach.StringGridTB.Rows[i].Assign(FormPeach.StringGridAdd.Rows[i]);
   end;
end;

function addext(s:ansistring):ansistring;
begin
if FormPeach.CheckBoxTarBefore.State=cbChecked then
   if extractfileext(s)<>'.tar' then s:=s+'.tar';
if (FormPeach.cbType.Text=txt_custom) or (FormPeach.cbType.Text=txt_custom+'/RAR') then
   begin
   if FormPeach.EditExtensionCustom.Caption<>'' then result:=s+'.'+FormPeach.EditExtensionCustom.Caption
   else result:=s;
   exit;
   end;
if FormPeach.cbType.Text=STR_PEA then begin result:=s+'.pea'; exit; end;
if FormPeach.cbType.Text=txt_split then begin result:=s+'.001'; exit; end;
if FormPeach.cbType.Text=STR_UPX then begin result:=s+'.exe'; exit; end;
if ((archive_type='7z') and (FormPeach.CheckBox7zSFX.State=cbChecked)) or
   ((archive_type='arc') and (FormPeach.CheckBoxARCsfx.State=cbChecked))
   then result:=s+'.exe'
   else result:=s+'.'+archive_type;
end;

procedure setcompressionlevel7z;
begin
case archive_type of
   '7z':
   begin
   case level_7z of
      0: compression_level:=txt_level_store;
      1: compression_level:=txt_level_fastest;
      2: compression_level:=txt_level_fast;
      3: compression_level:=txt_level_normal;
      4: compression_level:=txt_level_maximum;
      5: compression_level:=txt_level_ultra;
      end;
   end;
   'xz':
   begin
   case level_xz of
      0: compression_level:=txt_level_fastest;
      1: compression_level:=txt_level_fast;
      2: compression_level:=txt_level_normal;
      3: compression_level:=txt_level_maximum;
      4: compression_level:=txt_level_ultra;
      end;
   end;
   'zip':
   begin
   case level_zip of
      0: compression_level:=txt_level_store;
      1: compression_level:=txt_level_fastest;
      2: compression_level:=txt_level_fast;
      3: compression_level:=txt_level_normal;
      4: compression_level:=txt_level_maximum;
      5: compression_level:=txt_level_ultra;
      end;
   end;
   'bz2':
   begin
   case level_bzip2 of
      0: compression_level:=txt_level_fastest;
      1: compression_level:=txt_level_fast;
      2: compression_level:=txt_level_normal;
      3: compression_level:=txt_level_maximum;
      4: compression_level:=txt_level_ultra;
      end;
   end;
   'gz':
   begin
   case level_gz of
      0: compression_level:=txt_level_fastest;
      1: compression_level:=txt_level_fast;
      2: compression_level:=txt_level_normal;
      3: compression_level:=txt_level_maximum;
      4: compression_level:=txt_level_ultra;
      end;
   end;
end;
end;

procedure setcompressionlevel7zindex;
begin
case archive_type of
'7z': FormPeach.ComboBox7zLevel.ItemIndex:=level_7z;
'xz': FormPeach.ComboBox7zLevel.ItemIndex:=level_xz;
'zip': FormPeach.ComboBox7zLevel.ItemIndex:=level_zip;
'bz2': FormPeach.ComboBox7zLevel.ItemIndex:=level_bzip2;
'gz': FormPeach.ComboBox7zLevel.ItemIndex:=level_gz;
end;
end;

procedure setquickcompset(s:ansistring);
var
   i:integer;
begin
FormPeach.cbLevel.Clear;
if (s<>'7Z') and (s<>'ARC') and (s<>'BROTLI') and (s<>'CUSTOM') and (s<>'ZSTD') then FormPeach.cbLevel.Enabled:=false
else FormPeach.cbLevel.Enabled:=true;
if s='7Z' then
   begin
   FormPeach.cbLevel.DropDownCount:=FormPeach.ComboBox7zLevel.DropDownCount;
   for i:=0 to FormPeach.ComboBox7zLevel.Items.Count-1 do
      FormPeach.cbLevel.Items.Append(FormPeach.ComboBox7zLevel.Items[i]);
   FormPeach.cbLevel.ItemIndex:=FormPeach.ComboBox7zLevel.ItemIndex;
   end;
if s='CUSTOM' then
   if (havewinrar=true) and (userar=1) then
   begin
   FormPeach.cbLevel.DropDownCount:=FormPeach.ComboBox7zLevel.DropDownCount;
   for i:=0 to FormPeach.ComboBox7zLevel.Items.Count-1 do
      FormPeach.cbLevel.Items.Append(FormPeach.ComboBox7zLevel.Items[i]);
   FormPeach.cbLevel.ItemIndex:=level_rar;
   end;
if s='ARC' then
   begin
   FormPeach.cbLevel.DropDownCount:=FormPeach.ComboBoxARCLevel.DropDownCount;
   for i:=0 to FormPeach.ComboBoxARCLevel.Items.Count-1 do
      FormPeach.cbLevel.Items.Append(FormPeach.ComboBoxARCLevel.Items[i]);
   FormPeach.cbLevel.ItemIndex:=FormPeach.ComboBoxARCLevel.ItemIndex;
   end;
if s='BROTLI' then
   begin
   FormPeach.cbLevel.DropDownCount:=7;
   FormPeach.cbLevel.Items.Append('0');
   FormPeach.cbLevel.Items.Append('1');
   FormPeach.cbLevel.Items.Append('2');
   FormPeach.cbLevel.Items.Append('3');
   FormPeach.cbLevel.Items.Append('6');
   FormPeach.cbLevel.Items.Append('9');
   FormPeach.cbLevel.Items.Append('11');
   FormPeach.cbLevel.ItemIndex:=level_brotli;
   end;
if s='ZSTD' then
   begin
   FormPeach.cbLevel.DropDownCount:=9;
   FormPeach.cbLevel.Items.Append('1');
   FormPeach.cbLevel.Items.Append('2');
   FormPeach.cbLevel.Items.Append('3');
   FormPeach.cbLevel.Items.Append('5');
   FormPeach.cbLevel.Items.Append('7');
   FormPeach.cbLevel.Items.Append('11');
   FormPeach.cbLevel.Items.Append('15');
   FormPeach.cbLevel.Items.Append('19');
   FormPeach.cbLevel.Items.Append('22');
   FormPeach.cbLevel.ItemIndex:=level_zstd;
   end;
end;

procedure getarccaption(s:ansistring);
begin
UnitGwrap.parcstr:='';
case s of
STR_7Z,STR_ZIP:
   begin
   FormPeach.Caption:=FormPeach.ComboBox7zFun.Text+' .'+archive_type+', '+compression_level+', '+compression_method;
   if (FormPW.EditPWpass.Caption<>'') or (FormPW.EditPWkeyfile.Caption<>'') then FormPeach.Caption:=FormPeach.Caption+' | '+FormPeach.ComboBox7zalgo.Text;
   UnitGwrap.parcstr:=', '+compression_level+', '+compression_method;
   if (FormPW.EditPWpass.Caption<>'') or (FormPW.EditPWkeyfile.Caption<>'') then UnitGwrap.parcstr:=UnitGwrap.parcstr+' | '+FormPeach.ComboBox7zalgo.Text;
   end;
STR_BZIP2, STR_GZIP, STR_WIM, STR_XZ, STR_TAR:
   begin
   FormPeach.Caption:=FormPeach.ComboBox7zFun.Text+' .'+archive_type+', '+compression_level;
   UnitGwrap.parcstr:=', '+compression_level;
   end;
STR_ARC:
   begin
   FormPeach.Caption:=txt_create+' .'+archive_type+', '+FormPeach.ComboBoxARCFun.Text;
   if (FormPW.EditPWpass.Caption<>'') or (FormPW.EditPWkeyfile.Caption<>'') then FormPeach.Caption:=FormPeach.Caption+' | '+FormPeach.ComboBoxARCalgo.Text;
   end;
STR_PEA:
   begin
   FormPeach.Caption:=txt_create+' .pea';
   if (FormPW.EditPWpass.Caption<>'') or (FormPW.EditPWkeyfile.Caption<>'') then FormPeach.Caption:=FormPeach.Caption+' | '+FormPeach.ComboBoxPEAStream.Text;
   end;
STR_ZPAQ, STR_QUAD:
   begin
   FormPeach.Caption:=txt_create+' .'+archive_type;
   end;
STR_BROTLI, STR_ZSTD:
   begin
   FormPeach.Caption:=txt_create+' .'+archive_type+', '+txt_level+' '+FormPeach.cbLevel.Caption;
   UnitGwrap.parcstr:=', '+txt_level+' '+FormPeach.cbLevel.Caption;
   end;
STR_UPX: FormPeach.Caption:=txt_compress_executable;
else
begin
if (s=txt_custom) or (s=txt_custom+'/RAR') then
   if (userar=1) and (havewinrar=true) then
      begin
      FormPeach.Caption:=FormPeach.ComboBox7zFun.Text+' .rar, '+FormPeach.cbLevel.Caption;
      if (FormPW.EditPWpass.Caption<>'') or (FormPW.EditPWkeyfile.Caption<>'') then FormPeach.Caption:=FormPeach.Caption+' | '+txt_encrypt;
      UnitGwrap.parcstr:=', '+FormPeach.cbLevel.Caption;
      if (FormPW.EditPWpass.Caption<>'') or (FormPW.EditPWkeyfile.Caption<>'') then UnitGwrap.parcstr:=UnitGwrap.parcstr+' | '+txt_encrypt;
      end
   else
      begin
      FormPeach.Caption:=txt_custom;
      end;
if s=txt_split then FormPeach.Caption:=txt_split;
if s=txt_sfx+' '+STR_7Z then
   begin
   FormPeach.Caption:=FormPeach.ComboBox7zFun.Text+' '+txt_sfx+' ('+STR_7Z+'), '+compression_level+', '+compression_method;
   if (FormPW.EditPWpass.Caption<>'') then FormPeach.Caption:=FormPeach.Caption+' | '+FormPeach.ComboBox7zalgo.Text;
   UnitGwrap.parcstr:=', '+compression_level+', '+compression_method;
   if (FormPW.EditPWpass.Caption<>'') then UnitGwrap.parcstr:=UnitGwrap.parcstr+' | '+FormPeach.ComboBox7zalgo.Text;
   end;
if s=txt_sfx+' '+STR_ARC then
   begin
   FormPeach.Caption:=txt_create+' '+txt_sfx+' ('+STR_ARC+'), '+FormPeach.ComboBoxARCFun.Text;
   if (FormPW.EditPWpass.Caption<>'') then FormPeach.Caption:=FormPeach.Caption+' | '+FormPeach.ComboBoxARCalgo.Text;
   end;
end;
end;
end;

procedure TFormPeach.pcustmakecabClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
   begin
   FormPeach.EditNameCustom.Text:='makecab.exe';
   FormPeach.EditExtensionCustom.Text:='cab';
   FormPeach.ComboBoxArchiveCustom.ItemIndex:=0;
   customsyntax:=0;
   addtocustomhistory('makecab.exe');
   end;
end;

procedure setnonrarcust;
var
   s1:AnsiString;
begin
FormPeach.EditNameCustom.Caption:=FormPeach.pcustom1.caption;
s1:=LowerCase(extractfilename(FormPeach.pcustom1.caption));
cutextension(s1);
FormPeach.EditExtensionCustom.Caption:=s1;
FormPeach.ComboBoxArchiveCustom.ItemIndex:=customsyntax;
if LowerCase(FormPeach.pcustom1.caption)='makecab.exe' then FormPeach.pcustmakecabClick(nil);
end;

procedure archive_type_select(s:ansistring);
var
   i:integer;
   s1,fnm:ansistring;
begin
FormPeach.cbSplit.Enabled:=true;
FormPeach.Panel7z.Visible:=false;
FormPeach.PanelARC.Visible:=false;
FormPeach.PanelCustom.Visible:=false;
FormPeach.PanelPaq.Visible:=false;
FormPeach.PanelPea.Visible:=false;
FormPeach.PanelQuad.Visible:=false;
FormPeach.PanelBrotli.Visible:=false;
FormPeach.PanelZstd.Visible:=false;
FormPeach.PanelUPX.Visible:=false;
FormPeach.cbAdvfAdd.Enabled:=false;
FormPeach.CheckBox7zSFX.State:=cbUnchecked;
subfun:='';
disable_twofactor:=false;
FormPeach.cbSplit.ItemIndex:=defaultspanning;
FormPeach.SpinEditSplit.Value:=spansize;
FormPeach.ComboBoxSplit.ItemIndex:=spanunit;
cbSplit_onchange;
FormPeach.CheckBoxSeparate.Enabled:=true;
FormPeach.CheckBoxSameArc.Enabled:=true;
FormPeach.CheckBoxDeleteInputAdd.Enabled:=true;
FormPeach.cbDeleteInputModeAdd.Enabled:=true;
FormPeach.cbAct.Enabled:=true;
if s=STR_7Z then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='7z';
   fun:='7Z';
   typehint:=txt_type_description_7z;
   if (compression_method='') or (prev_type<>'7z') then compression_method:=method_7z;//'LZMA';
   setcompressionlevel7z;//set compression_level
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.ComboBox7zLevel.Text:=txt_level_normal;
   FormPeach.ComboBox7zLevel.Enabled:=true;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if s=STR_ARC then
   begin
   FormPeach.PanelARC.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   FormPeach.cbSplit.ItemIndex:=0;
   change_imagesplit;
   FormPeach.cbSplit.Enabled:=false;
   FormPeach.SpinEditSplit.Visible:=false;
   FormPeach.ComboBoxSplit.Visible:=false;
   archive_type:='arc';
   fun:='ARC';
   FormPeach.ComboBoxARCLevel.ItemIndex:=level_arc;
   FormPeach.ComboBoxARCsolid.ItemIndex:=solid_arc;
   if rr_arc=1 then FormPeach.CheckBoxARCrr.State:=cbChecked
   else FormPeach.CheckBoxARCrr.State:=cbUnchecked;
   if arcabspath=1 then FormPeach.CheckBoxARCabs.State:=cbChecked
   else FormPeach.CheckBoxARCabs.State:=cbUnchecked;
   FormPeach.ComboBoxARCalgo.ItemIndex:=algo_arc;
   typehint:=txt_type_description_arc;
   //getarccaption(s);
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   FormPeach.CheckBoxARCsfx.State:=cbunChecked;
   FormPeach.ComboBoxARCsfx.visible:=false;
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=STR_BZIP2 then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='bz2';
   fun:='7Z';
   typehint:=txt_type_description_bzip2;
   compression_method:='Bzip2';
   setcompressionlevel7z;//set compression_level
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.ComboBox7zLevel.Text:=txt_level_normal;
   FormPeach.ComboBox7zLevel.Enabled:=true;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if (s=txt_custom) or (s=txt_custom+'/RAR') then
   begin
   FormPeach.PanelCustom.Visible:=true;
   archive_type:=txt_custom;
   fun:='CUSTOM';
   typehint:=txt_type_description_custom;
   //getarccaption(s);
   FormPeach.CheckBoxConvert.Enabled:=true;
   if userar=1 then
      begin
      FormPeach.CompressionCustom.Visible:=false;
      FormPeach.PanelRar.Visible:=true;
      FormPeach.EditExtensionCustom.Caption:='rar';
      FormPeach.EditOPcustom.Caption:='';
      FormPeach.cbSplit.Enabled:=true;
      FormPeach.cbLevel.Enabled:=true;
      FormPeach.cbLevel.ItemIndex:=level_rar;
      FormPeach.CheckBoxMailAdd.Enabled:=true;
      FormPeach.cbAct.Enabled:=true;
      FormPeach.CheckBoxSameArc.Enabled:=true;
      FormPeach.CheckBoxSeparate.Enabled:=true;
      FormPeach.cbRAR5Click(nil);
      typehint:=txt_10_5_type_description_rar+char($0D)+char($0A)+txt_10_5_ntfsalt;
      end
   else
      begin
      FormPeach.CompressionCustom.Visible:=true;
      FormPeach.PanelRar.Visible:=false;
      setnonrarcust;
      change_imagesplit;
      FormPeach.cbSplit.Enabled:=false;
      FormPeach.SpinEditSplit.Visible:=false;
      FormPeach.ComboBoxSplit.Visible:=false;
      FormPeach.cbLevel.Enabled:=false;
      FormPeach.CheckBoxMailAdd.Enabled:=false;
      FormPeach.cbAct.Enabled:=false;
      FormPeach.CheckBoxSameArc.Enabled:=false;
      FormPeach.CheckBoxSameArc.State:=cbUnchecked;
      FormPeach.CheckBoxSeparate.Enabled:=false;
      FormPeach.CheckBoxSeparate.State:=cbUnchecked;
      end;
   end;
if s=STR_GZIP then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='gz';
   fun:='7Z';
   typehint:=txt_type_description_gzip;
   compression_method:='Deflate';
   setcompressionlevel7z;//set compression_level
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.ComboBox7zLevel.Text:=txt_level_normal;
   FormPeach.ComboBox7zLevel.Enabled:=true;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if s=STR_WIM then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='wim';
   fun:='7Z';
   typehint:=txt_3_8_type_description_wim+char($0D)+char($0A)+txt_10_5_ntfsalt;
   compression_method:='';
   compression_level:=txt_level_store;
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.ComboBox7zLevel.Text:=txt_level_store;
   FormPeach.ComboBox7zLevel.Enabled:=false;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if s=STR_XZ then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='xz';
   fun:='7Z';
   typehint:=txt_3_8_type_description_xz;
   compression_method:='LZMA2';
   setcompressionlevel7z;//set compression_level
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.ComboBox7zLevel.Text:=txt_level_normal;
   FormPeach.ComboBox7zLevel.Enabled:=true;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if s=STR_ZPAQ then
   begin
   FormPeach.PanelPaq.Visible:=true;
   FormPeach.cbSplit.ItemIndex:=0;
   change_imagesplit;
   FormPeach.cbSplit.Enabled:=false;
   FormPeach.SpinEditSplit.Visible:=false;
   FormPeach.ComboBoxSplit.Visible:=false;
   fun:='PAQ';
   FormPeach.RadioGroupPaq.ItemIndex:=paqver;
   case FormPeach.RadioGroupPaq.ItemIndex of
      0: begin
         archive_type:='lpaq8';
         check_tarbefore(tdirs);
         end;
      1: archive_type:='paq8o';
      2: archive_type:='zpaq';
   end;
   typehint:=txt_type_description_paq;
   //getarccaption(s);
   FormPeach.ComboBoxPAQLevel.ItemIndex:=level_paq;
   FormPeach.ComboBoxPAQThreads.ItemIndex:=threads_zpaq;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=STR_PEA then
   begin
   FormPeach.PanelPea.Visible:=true;
   FormPeach.ComboBoxPEALevel.ItemIndex:=pcompr;
   FormPeach.ComboBoxPEAStream.ItemIndex:=pstream;
   FormPeach.ComboBoxPEAObj.ItemIndex:=pobj;
   FormPeach.ComboBoxPEAVol.ItemIndex:=pvol;
   FormPeach.ComboBoxPEAKDFw.ItemIndex:=nrkdf;
   FormPeach.ComboBoxPEAKDF.ItemIndex:=trkdf; FormPeach.ComboBoxPEAKDFChange(nil);
   FormPeach.PanelSplitFile.Visible:=false;
   archive_type:='';
   fun:='PEA';
   typehint:=txt_type_description_pea;
   //getarccaption(s);
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=STR_QUAD then
   begin
   FormPeach.PanelQuad.Visible:=true;
   FormPeach.cbSplit.ItemIndex:=0;
   change_imagesplit;
   FormPeach.cbSplit.Enabled:=false;
   FormPeach.SpinEditSplit.Visible:=false;
   FormPeach.ComboBoxSplit.Visible:=false;
   fun:='QUAD';
   case FormPeach.RadioGroupQuad.ItemIndex of
      0: archive_type:='quad';
      1: archive_type:='balz';
      2: archive_type:='bcm';
   end;
   if FormPeach.RadioGroupQuad.ItemIndex=2 then
   begin
   FormPeach.CheckBoxQuadMax.enabled:=false;
   FormPeach.Labelbcmblock.visible:=true;
   FormPeach.ComboBoxBCMSolid.visible:=true;
   end
   else
   begin
   FormPeach.CheckBoxQuadMax.enabled:=true;
   FormPeach.Labelbcmblock.visible:=false;
   FormPeach.ComboBoxBCMSolid.visible:=false;
   end;
   //getarccaption(s);
   typehint:=txt_type_description_quad;
   if level_quad=0 then FormPeach.CheckBoxQuadMax.State:=cbUnchecked else FormPeach.CheckBoxQuadMax.State:=cbChecked;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=STR_BROTLI then
   begin
   FormPeach.PanelBrotli.Visible:=true;
   FormPeach.cbSplit.ItemIndex:=0;
   change_imagesplit;
   FormPeach.cbSplit.Enabled:=false;
   FormPeach.SpinEditSplit.Visible:=false;
   FormPeach.ComboBoxSplit.Visible:=false;
   fun:='BROTLI';
   archive_type:='br';
   FormPeach.cbLevel.ItemIndex:=level_brotli;
   //getarccaption(s);
   typehint:=txt_7_1_type_description_brotli;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=STR_ZSTD then
   begin
   FormPeach.PanelZstd.Visible:=true;
   FormPeach.cbSplit.ItemIndex:=0;
   change_imagesplit;
   FormPeach.cbSplit.Enabled:=false;
   FormPeach.SpinEditSplit.Visible:=false;
   FormPeach.ComboBoxSplit.Visible:=false;
   fun:='ZSTD';
   archive_type:='zst';
   FormPeach.cbLevel.ItemIndex:=level_zstd;
   //getarccaption(s);
   typehint:=txt_7_1_type_description_zstd;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=txt_sfx+' '+STR_7Z then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='7z';
   fun:='7Z';
   disable_twofactor:=true;
   typehint:=txt_type_description_7z;
   if (compression_method='') or (prev_type<>'7z') then compression_method:=method_7z;//'LZMA';
   setcompressionlevel7z;//set compression_level
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.CheckBox7zSFX.State:=cbChecked;
   FormPeach.ComboBox7zLevel.Text:=txt_level_normal;
   FormPeach.ComboBox7zLevel.Enabled:=true;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if s=txt_sfx+' '+STR_ARC then
   begin
   FormPeach.PanelARC.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   FormPeach.cbSplit.ItemIndex:=0;
   change_imagesplit;
   FormPeach.cbSplit.Enabled:=false;
   FormPeach.SpinEditSplit.Visible:=false;
   FormPeach.ComboBoxSplit.Visible:=false;
   archive_type:='arc';
   fun:='ARC';
   disable_twofactor:=true;
   FormPeach.ComboBoxARCLevel.ItemIndex:=level_arc;
   FormPeach.ComboBoxARCsolid.ItemIndex:=solid_arc;
   if rr_arc=1 then FormPeach.CheckBoxARCrr.State:=cbChecked
   else FormPeach.CheckBoxARCrr.State:=cbUnchecked;
   if arcabspath=1 then FormPeach.CheckBoxARCabs.State:=cbChecked
   else FormPeach.CheckBoxARCabs.State:=cbUnchecked;
   FormPeach.ComboBoxARCalgo.ItemIndex:=algo_arc;
   typehint:=txt_type_description_arc;
   //getarccaption(s);
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   FormPeach.CheckBoxARCsfx.State:=cbChecked;
   FormPeach.ComboBoxARCsfx.visible:=true;
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=txt_split then
   begin
   FormPeach.PanelPea.Visible:=true;
   FormPeach.PanelSplitFile.Visible:=true;
   FormPeach.ComboBoxSplitAlgo.ItemIndex:=salgo;
   archive_type:='';
   fun:='RFS';
   typehint:=txt_type_description_split;
   //getarccaption(s);
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   //check_tarbefore(tdirs);
   FormPeach.CheckBoxSeparate.Checked:=true; on_checkboxseparateclick;
   FormPeach.cbSplit.ItemIndex:=1;
   cbSplit_onchange;
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=STR_TAR then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='tar';
   fun:='7Z';
   typehint:=txt_type_description_tar;
   compression_method:='';
   compression_level:=txt_level_store;
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.ComboBox7zLevel.Text:=txt_level_store;
   FormPeach.ComboBox7zLevel.Enabled:=false;
   FormPeach.CheckBoxTarBefore.Enabled:=false;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if s=STR_UPX then
   begin
   FormPeach.PanelUPX.Visible:=true;
   FormPeach.CheckBoxDeleteInputAdd.Enabled:=false;
   FormPeach.cbDeleteInputModeAdd.Enabled:=false;
   FormPeach.cbSplit.ItemIndex:=0;
   change_imagesplit;
   FormPeach.cbSplit.Enabled:=false;
   FormPeach.SpinEditSplit.Visible:=false;
   FormPeach.ComboBoxSplit.Visible:=false;
   archive_type:='upx';
   fun:='UPX';
   typehint:=txt_type_description_upx;
   //getarccaption(s);
   FormPeach.ComboBoxUPX.ItemIndex:=level_upx;
   FormPeach.CheckBoxTarBefore.Enabled:=false;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxSameArc.Enabled:=false;
   FormPeach.CheckBoxSameArc.State:=cbUnchecked;
   FormPeach.CheckBoxSeparate.Enabled:=false;
   FormPeach.CheckBoxSeparate.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=false;
   FormPeach.CheckBoxConvert.State:=cbUnchecked;
   FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
   FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
   FormPeach.CheckBoxMailAdd.Enabled:=false;
   FormPeach.cbAct.Enabled:=false;
   end;
if s=STR_ZIP then
   begin
   FormPeach.Panel7z.Visible:=true;
   FormPeach.cbAdvfAdd.Enabled:=true;
   archive_type:='zip';
   fun:='7Z';
   typehint:=txt_type_description_zip;
   if (compression_method='') or (prev_type<>'zip') then compression_method:=method_zip;
   setcompressionlevel7z;//set compression_level
   set_values(archive_type,compression_method,compression_level);
   //getarccaption(s);
   FormPeach.ComboBox7zLevel.Text:=txt_level_normal;
   FormPeach.ComboBox7zLevel.Enabled:=true;
   FormPeach.CheckBoxTarBefore.Enabled:=true;
   FormPeach.CheckBoxTarBefore.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.Enabled:=true;
   if FormPeach.cbSplit.ItemIndex > 0 then FormPeach.CheckBoxMailAdd.Enabled:=false
   else FormPeach.CheckBoxMailAdd.Enabled:=true;
   end;
if (FormPeach.CheckBox7zSFX.State=cbChecked) then FormPeach.RadioGroup7zSFX.Visible:=true
else FormPeach.RadioGroup7zSFX.Visible:=false;
if FormPeach.CheckBoxMailAdd.Enabled=false then
   begin
   FormPeach.CheckBoxMailAdd.Checked:=false;
   FormPeach.CheckBoxMailKeep.Visible:=false;
   end;
fun_status:=fun;
//disallow loading a second time the saved advanced compression values,
//if the archive type or algorithm changes values are reset to defaults, otherwise they stay set for the session and are then saved to conf again
loadadvdefaults:=false;
//set combo box index
for i:=0 to FormPeach.cbType.Items.Count-1 do
   if FormPeach.cbType.Items[i]=s then FormPeach.cbType.ItemIndex:=i;
archive_type_selected:=FormPeach.cbType.ItemIndex;
setcompressionlevel7zindex; //otherwise combobox itemindex don't gets updated
suggest_outname(fnm,FormPeach.cbType.Text,0);
fnm:=extractfilename(fnm);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(fnm);
setpwicons;
setquickcompset(fun);
getarccaption(s);
end;

procedure do_calcstatusar;
begin

case archive_type of
   'bz2','gz','xz','lpaq8','br','zst','quad','balz','bcm':
   statushintar:=FormPeach.Caption+char($0D)+char($0A)+typehint+char($0D)+char($0A)+txt_10_0_comp+char($0D)+char($0A)+char($0D)+char($0A);
   else
   statushintar:=FormPeach.Caption+char($0D)+char($0A)+typehint+char($0D)+char($0A)+char($0D)+char($0A);
end;
statushintar:=statushintar+txt_input+' '+FormPeach.LabelStatusArDetails.Caption+char($0D)+char($0A)+char($0D)+char($0A);
statushintar:=statushintar+txt_2_7_output+' '+FormPeach.EditAddName.Caption+char($0D)+char($0A)+statuss+char($0D)+char($0A)+char($0D)+char($0A);
statushintar:=statushintar+FormPeach.LabelStatusAr.Caption+char($0D)+char($0A)+statusw;
if FormPeach.LabelStatusAr.Caption<>'' then statushintar:=statushintar;
do_fixpipechar(statushintar);
end;

procedure do_calcstatus;
var i,ir:integer;
begin
statushint:='';
with FormPeach do
begin
if status_curfilesystem<>'' then statushint:=status_curfilesystem+char($0D)+char($0A)+char($0D)+char($0A);
if FormPeach.EditOpenIn.Text<>txt_mypc then statushint:=statushint+EditOpenIn.Caption+char($0D)+char($0A)+char($0D)+char($0A);
if fun<>'FILEBROWSER' then
   if archive_content<>'' then statushint:=statushint+txt_archive+' '+archive_content+char($0D)+char($0A)+char($0D)+char($0A);
if LabelStatusdisplayed.Caption<>'' then
   if (pos(txt_list_found,LabelStatusdisplayed.Caption)=0) and (pos(txt_list_flat,LabelStatusdisplayed.Caption)=0) then statushint:=statushint+txt_displayedobjects+' '+LabelStatusdisplayed.Caption+char($0D)+char($0A)
      else statushint:=statushint+LabelStatusdisplayed.Caption+char($0D)+char($0A);
if FormPeach.EditOpenIn.Text=txt_mypc then statushint:=statushint+infocpu+char($0D)+char($0A)+inforam+char($0D)+char($0A)+infomem+char($0D)+char($0A);
if LabelStatus.Caption<>'' then statushint:=statushint+LabelStatus.Caption+char($0D)+char($0A);
if count_clipboard<>'' then
   begin
   statushint:=statushint+char($0D)+char($0A)+count_clipboard+char($0D)+char($0A);
   ir:=StringGridClipboard.RowCount-1;
   if ir>=1 then
      for i:=1 to ir do
         begin
         if i>5 then
            begin
            statushint:=statushint+'...'+char($0D)+char($0A);
            break;
            end;
         statushint:=statushint+StringGridClipboard.Cells[0,i]+' '+StringGridClipboard.Cells[1,i];
         if StringGridClipboard.Cells[2,i]=txt_list_isfolder then statushint:=statushint+' '+StringGridClipboard.Cells[2,i]+char($0D)+char($0A)
         else statushint:=statushint+char($0D)+char($0A);
         end;
   end;
end;
case isarchiveeditable of
   0: statushint:=statushint+char($0D)+char($0A)+txt_9_3_canedit+char($0D)+char($0A);
   1: statushint:=statushint+char($0D)+char($0A)+txt_9_3_canforce+char($0D)+char($0A);
   2: statushint:=statushint+char($0D)+char($0A)+txt_9_3_cannotedit+char($0D)+char($0A);
   3: statushint:=statushint+char($0D)+char($0A)+txt_10_5_pathlock+char($0D)+char($0A);
   end;
if length(statushint)>2 then SetLength(statushint,length(statushint)-2);
do_fixpipechar(statushint);
end;

procedure do_showstatus;
begin
do_calcstatus;
pMessageInfoOK(statushint);
end;

procedure updatelayout(enumdir:ansistring);
var
   i:integer;
   objectname:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then sg:=FormPeach.StringGridAdd
else sg:=FormPeach.StringGridExtract;
if sg.RowCount=1 then exit;
sg.Cursor:=crHourGlass;
tmpenumd:=false;
if enumd=1 then tmpenumd:=true;
if enumdir='enum' then tmpenumd:=true;
if cancellingarchive=true then tmpenumd:=false;
for i:=1 to sg.rowcount-1 do
   begin
   try
   if sg.Rowcount=1 then exit;
   objectname:=sg.Cells[8,1];
   sg.DeleteColRow(false,1);
   if filegetattr(objectname) > 0 then
      if filegetattr(objectname) and faDirectory =0 then addfilestr(sg,objectname)
      else addfolderstr(sg,objectname)
   else if cancellingarchive=false then msg_not_accessible_list(objectname);
   except end;
   end;
tmpenumd:=false;
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true)
else updatecontent_ext;
sg.Cursor:=crDefault;
end;

procedure clickcustom(s:ansistring);
var
   s1:ansistring;
begin
s1:=s;
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
   begin
   FormPeach.EditNameCustom.Text:=s1;
   s1:=extractfilename(s1);
   cutextension(s1);//default: extension = name of the executable
   FormPeach.EditExtensionCustom.Text:=s1;
   end;
{$IFDEF MSWINDOWS}if FormPeach.panelextract.visible=true{$ELSE}if FormPeach.panelextract.top=0{$ENDIF} then
   begin
   FormPeach.EditNameCustomExt.Text:=s1;
   end;
addtocustomhistory(s);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection SET EXTRACTION OPTIONS

///////////////////////////////////////////////////////////////////////////////}

procedure setextzpaqext(iszpaq:integer);
begin
case iszpaq of
   0: //no extended option
   begin
   FormPeach.PanelExtZPAQ.visible:=false;
   FormPeach.Labeladvextzpaq.visible:=false;
   FormPeach.ComboBoxActionExtract.enabled:=true;
   FormPeach.ComboBoxOverwrite.enabled:=true;
   FormPeach.LabelAdvExtZpaqBrZst.visible:=false;
   FormPeach.CheckBoxzpaqforce.visible:=false;
   end;
   1: //zpaq extended options (all etended options)
   begin
   FormPeach.PanelExtZPAQ.visible:=true;
   FormPeach.Labeladvextzpaq.visible:=true;
   FormPeach.ComboBoxActionExtract.enabled:=false;
   FormPeach.ComboBoxOverwrite.enabled:=false;
   FormPeach.LabelAdvExtZpaqBrZst.visible:=true;
   FormPeach.CheckBoxzpaqforce.visible:=true;
   end;
   2: //all options
   begin
   FormPeach.PanelExtZPAQ.visible:=true;
   FormPeach.Labeladvextzpaq.visible:=true;
   FormPeach.ComboBoxActionExtract.enabled:=true;
   FormPeach.ComboBoxOverwrite.enabled:=true;
   FormPeach.LabelAdvExtZpaqBrZst.visible:=true;
   FormPeach.CheckBoxzpaqforce.visible:=true;
   end;
   3: //br zst extended options
   begin
   FormPeach.PanelExtZPAQ.visible:=false;
   FormPeach.Labeladvextzpaq.visible:=false;
   FormPeach.ComboBoxActionExtract.enabled:=false;
   FormPeach.ComboBoxOverwrite.enabled:=false;
   FormPeach.LabelAdvExtZpaqBrZst.visible:=true;
   FormPeach.CheckBoxzpaqforce.visible:=true;
   end;
end;
end;

procedure updatecontent_ext;
var
   i,rc:integer;
begin
tfiles:=0;
tdirs:=0;
tsize:=0;
sizefreeint:=0;
//set hint overlay for extraction
   if FormPeach.StringGridExtract.RowCount>1 then hide_panelhintextract
   else FormPeach.PanelHintExtract.Visible:=true;
if FormPeach.StringGridExtract.RowCount=1 then
else
   begin
   rc:=FormPeach.StringGridExtract.RowCount-1;
   tfiles:=0;
   tdirs:=0;
   tsize:=0;
   for i:=1 to rc do
      begin
      if FormPeach.StringGridExtract.Cells[2,i] <> txt_list_isfolder then tfiles:=tfiles+1
      else tdirs:=tdirs+1;
      try
         tsize:=tsize+strtoqword(FormPeach.StringGridExtract.Cells[12,i]);
      except
      end;
      FormPeach.StringGridExtract.Cells[11,i]:='0';
      end;
   end;
get_statuss(FormPeach.EditOutExtract.Text);
if extselall=true then
   begin
   try srcfilesize_multipart(FormPeach.EditOpenIn.Text,tsize); except tsize:=0; end;
   FormPeach.LabelStatusExDetails.Caption:='0 '+txt_dirs+' '+'1 '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
   end
else
   FormPeach.LabelStatusExDetails.Caption:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
FormPeach.labelstatusEx.Visible:=false;
FormPeach.labelstatusEx.Caption:=txt_3_1_workingdir+' '+FormPeach.ComboBoxWD.Caption+' '+FormPeach.LabelCustomWorkPath.Caption;
autosize_stringgrid2;
if FormPeach.StringGridExtract.RowCount>1 then FormPeach.StringGridExtract.Cells[11,1]:='1';
sizefreeint:=tsize;
case fun of
   'UNZPAQ': setextzpaqext(1);//zpaq extended options
   'UNBROTLI': setextzpaqext(3);//br zst extended options only
   'UNZSTD': setextzpaqext(3);//br zst extended options only
   else
   begin
   setextzpaqext(0);//no extended options
   if fun='FILEBROWSER' then
      begin
      for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
         if (lowercase(FormPeach.StringGridExtract.Cells[2,i]) = '.zpaq') then
            begin
            if FormPeach.StringGridExtract.RowCount>2 then setextzpaqext(2) //all options
            else setextzpaqext(1);//zpaq extended options
            break;
            end;
      for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
         if ((lowercase(FormPeach.StringGridExtract.Cells[2,i]) = '.br') or
            (lowercase(FormPeach.StringGridExtract.Cells[2,i]) = '.zst')) then
            begin
            if FormPeach.StringGridExtract.RowCount>2 then setextzpaqext(2) //all options
            else setextzpaqext(3);//br zst extended options only
            break;
            end;
      if FormPeach.StringGridExtract.RowCount=1 then setextzpaqext(2); //all options
      end;
   end;
   end;
end;

procedure smartextclick;
begin
FormPeach.pmqnointdir.checked:=not(FormPeach.pmqnointdir.checked);
if FormPeach.pmqnointdir.Checked=true then removeintdir:=1 else removeintdir:=0;
if removeintdir=1 then FormPeach.CheckBoxIntDir.State:=cbChecked else FormPeach.CheckBoxIntDir.State:=cbUnChecked;
FormPeach.CheckBoxSmartFolder.State:=FormPeach.CheckBoxIntDir.State;
end;

procedure newextclick;
begin
FormPeach.pmqenewfolder.checked:=not(FormPeach.pmqenewfolder.checked);
if FormPeach.pmqenewfolder.checked=true then tonewfolder:=1
else tonewfolder:=0;
updateconf_modified;
settonewfolder(tonewfolder);
end;

procedure do_calcstatusex;
begin
statushintex:=FormPeach.Caption+char($0D)+char($0A);
if (FormPeach.CheckBoxrelative.Checked=true) and
   (FormPeach.CheckBoxrelative.Enabled=true) and
   (FormPeach.CheckBoxFolder.Checked=false) then
   statushintex:=statushintex+FormPeach.CheckBoxrelative.Caption+char($0D)+char($0A)+char($0D)+char($0A)
else
   statushintex:=statushintex+char($0D)+char($0A);
statushintex:=statushintex+txt_input+' '+FormPeach.LabelStatusExDetails.Caption+char($0D)+char($0A)+char($0D)+char($0A);
statushintex:=statushintex+txt_2_7_output+' '+FormPeach.EditOutExtract.Caption+char($0D)+char($0A)+statuss+char($0D)+char($0A)+char($0D)+char($0A);
if (FormPeach.CheckBoxrelative.Checked=true) and
   (FormPeach.CheckBoxrelative.Enabled=true) and
   (FormPeach.CheckBoxFolder.Checked=false) then
   statushintex:=statushintex+FormPeach.LabelStatusEx.Caption+char($0D)+char($0A)+statusw;
do_fixpipechar(statushintex);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection SET FILTERS for archiving and extraction, optionally archive broWsing

///////////////////////////////////////////////////////////////////////////////}

function extract_excludes:ansistring;
var
   i:integer;
   s:ansistring;
begin
extract_excludes:='';
for i:=0 to FormAdvf.MemoAdvExclude.Lines.Count-1 do
   if FormAdvf.MemoAdvExclude.Lines[i]<>'' then
      begin
      s:=FormAdvf.MemoAdvExclude.Lines[i];
      //if copy(s,1,1)='.' then s:='*'+copy(s,2,length(s)-1);
      if FormAdvf.CheckBoxAdvRecurse1.State=cbChecked then extract_excludes:=extract_excludes+' '+stringdelim('-xr!'+escapefilename(s,desk_env))
      else extract_excludes:=extract_excludes+' '+stringdelim('-x!'+escapefilename(s,desk_env));
      end;
end;

function extract_excludes_rar5:ansistring;
var
   i:integer;
   s:ansistring;
begin
extract_excludes_rar5:='';
for i:=0 to FormAdvf.MemoAdvExclude.Lines.Count-1 do
   if FormAdvf.MemoAdvExclude.Lines[i]<>'' then
      begin
      s:=FormAdvf.MemoAdvExclude.Lines[i];
      //if copy(s,1,1)='.' then s:='*'+copy(s,2,length(s)-1);
      extract_excludes_rar5:=extract_excludes_rar5+' '+stringdelim('-x'+escapefilename(s,desk_env));
      end;
end;

function extract_includes:ansistring;
var
   i:integer;
   s:ansistring;
begin
extract_includes:='';
for i:=0 to FormAdvf.MemoAdvInclude.Lines.Count-1 do
   if FormAdvf.MemoAdvInclude.Lines[i]<>'' then
      begin
      s:=FormAdvf.MemoAdvInclude.Lines[i];
      //if copy(s,1,1)='.' then s:='*'+copy(s,2,length(s)-1);
      extract_includes:=extract_includes+' '+stringdelim(escapefilename(s,desk_env));
      end;
end;

function extract_includes_rar5:ansistring;
var
   i:integer;
   s:ansistring;
begin
extract_includes_rar5:='';
for i:=0 to FormAdvf.MemoAdvInclude.Lines.Count-1 do
   if FormAdvf.MemoAdvInclude.Lines[i]<>'' then
      begin
      s:=FormAdvf.MemoAdvInclude.Lines[i];
      //if copy(s,1,1)='.' then s:='*'+copy(s,2,length(s)-1);
      extract_includes_rar5:=extract_includes_rar5+' '+stringdelim(escapefilename(s,desk_env));
      end;
end;

procedure adv_filters(var cl:ansistring);
begin
if FormAdvf.CheckBoxAdvFilters.State=cbChecked then
   begin
   if extract_excludes<>'' then cl:=cl+extract_excludes;
   if FormAdvf.CheckBoxAdvRecurse.State=cbChecked then cl:=cl+' -r'
   else cl:=cl+' -r-';
   if extract_includes<>'' then cl:=cl+' -- '+extract_includes
   else cl:=cl+' -- *';
   end;
end;

procedure adv_filters_rar5(var cl:ansistring);
begin
if FormAdvf.CheckBoxAdvFilters.State=cbChecked then
   begin
   if extract_excludes_rar5<>'' then cl:=cl+extract_excludes_rar5;
   if extract_includes_rar5<>'' then cl:=cl+' -- '+extract_includes_rar5
   else cl:=cl+' -- *';
   end;
end;

procedure basic_filters(var cl:ansistring);
var
   s1,s2:ansistring;
begin
s1:=FormPeach.EditUn7zaFilterExclude.Text;
//if copy(s1,1,1)='.' then s1:='*'+copy(s1,2,length(s1)-1); //to allowing using paths beginning with "." that would otherwise result in 7z error "cannot use absolute path"
s2:=FormPeach.EditUn7zaFilter.Text;
//if copy(s2,1,1)='.' then s2:='*'+copy(s2,2,length(s2)-1);
if FormPeach.EditUn7zaFilterExclude.Text<>'' then cl:=cl+' '+stringdelim('-x!'+escapefilename(s1,desk_env));
if FormPeach.EditUn7zaFilter.Text<>'' then cl:=cl+' '+stringdelim('-ir!'+escapefilename(s2,desk_env));
end;

procedure basic_filters_rar5(var cl:ansistring);
var
   s1,s2:ansistring;
begin
s1:=FormPeach.EditUn7zaFilterExclude.Text;
if pos('*'+directoryseparator+'*',s1)<>0 then s1:=copy(s1,1,pos('*'+directoryseparator+'*',s1)-2);
s2:=FormPeach.EditUn7zaFilter.Text;
if FormPeach.EditUn7zaFilterExclude.Text<>'' then cl:=cl+' '+stringdelim('-x'+escapefilename(s1,desk_env)+directoryseparator+'**'+directoryseparator+'**'+directoryseparator)+' '+stringdelim('-x'+escapefilename(s1,desk_env)+directoryseparator+'**'+directoryseparator+'*');
if FormPeach.EditUn7zaFilter.Text<>'' then cl:=cl+' -- '+stringdelim(escapefilename(s2,desk_env));
end;

procedure setincludealso(statalso:boolean);
begin
with FormAdvf do
begin
AutoSize:=false;
LabelAdvIncludeAlso.visible:=statalso;
CheckBoxAdvRecurseAlso.visible:=statalso;
MemoAdvIncludeAlso.visible:=statalso;
AutoSize:=true;
end;
end;

procedure set_advfilters;
var
   a1,a1also,a2:array of ansistring;
   recinc,recincalso,recexc,useadv:boolean;
   i:integer;
begin
if settingadv=true then exit;
settingadv:=true;
if FormAdvf.CheckBoxAdvFilters.State=cbChecked then useadv:=true else useadv:=false;
if FormAdvf.CheckBoxAdvRecurse.State=cbChecked then recinc:=true else recinc:=false;
if FormAdvf.CheckBoxAdvRecurseAlso.State=cbChecked then recincalso:=true else recincalso:=false;
if FormAdvf.CheckBoxAdvRecurse1.State=cbChecked then recexc:=true else recexc:=false;
setlength(a1,FormAdvf.MemoAdvInclude.Lines.Count);
setlength(a1also,FormAdvf.MemoAdvIncludeAlso.Lines.Count);
setlength(a2,FormAdvf.MemoAdvExclude.Lines.Count);
for i:=0 to FormAdvf.MemoAdvInclude.Lines.Count-1 do a1[i]:=FormAdvf.MemoAdvInclude.Lines[i];
for i:=0 to FormAdvf.MemoAdvIncludeAlso.Lines.Count-1 do a1also[i]:=FormAdvf.MemoAdvIncludeAlso.Lines[i];
for i:=0 to FormAdvf.MemoAdvExclude.Lines.Count-1 do a2[i]:=FormAdvf.MemoAdvExclude.Lines[i];
FormAdvf.Checkboxadvfilters.state:=cbchecked;
set_advfilters_enabled(true);
setfiltericon(true);
if (fun='7Z') or (fun='ARC') then setincludealso(true)
else setincludealso(false);

FormAdvf.Showmodal;
if FormAdvf.ModalResult=1 then
   begin
   advfiltersupdate;
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.Top=0{$ENDIF} then navrefresh;
   end
else
   begin
   if useadv=true then
      begin
      FormAdvf.CheckBoxAdvFilters.State:=cbChecked;
      set_advfilters_enabled(true);
      setfiltericon(true);
      end
   else
      begin
      FormAdvf.CheckBoxAdvFilters.State:=cbUnChecked;
      set_advfilters_enabled(false);
      setfiltericon(false);
      end;
   if recinc=true then FormAdvf.CheckBoxAdvRecurse.State:=cbChecked else FormAdvf.CheckBoxAdvRecurse.State:=cbUnChecked;
   if recincalso=true then FormAdvf.CheckBoxAdvRecurseAlso.State:=cbChecked else FormAdvf.CheckBoxAdvRecurseAlso.State:=cbUnChecked;
   if recexc=true then FormAdvf.CheckBoxAdvRecurse1.State:=cbChecked else FormAdvf.CheckBoxAdvRecurse1.State:=cbUnChecked;
   FormAdvf.MemoAdvInclude.Clear;
   FormAdvf.MemoAdvIncludeAlso.Clear;
   FormAdvf.MemoAdvExclude.Clear;
   for i:=0 to length(a1)-1 do FormAdvf.MemoAdvInclude.Append(a1[i]);
   for i:=0 to length(a1also)-1 do FormAdvf.MemoAdvIncludeAlso.Append(a1also[i]);
   for i:=0 to length(a2)-1 do FormAdvf.MemoAdvExclude.Append(a2[i]);
   end;
FormPeach.cbAdvfAdd.state:=FormAdvf.CheckBoxAdvFilters.State;
FormPeach.cbAdvfExt.state:=FormAdvf.CheckBoxAdvFilters.State;
settingadv:=false;
end;

procedure setfilterbrowser(i:integer);
begin
filterbrowser:=i;
case i of
   0: begin
      FormPeach.mfilterbrowser.Checked:=false;
      end;
   1: begin
      FormPeach.mfilterbrowser.Checked:=true;
      end;
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection SORT items in file browser

///////////////////////////////////////////////////////////////////////////////}

function padstrsort(c,i:integer):ansistring;
begin case c of
   2,15,10: result:=PadRight(FormPeach.StringGridList.Cells[c,i],16)+FormPeach.StringGridList.Cells[13,i]; //ext, info, attr
   9,11: result:=PadRight(FormPeach.StringGridList.Cells[c,i],32)+FormPeach.StringGridList.Cells[13,i]; //comment, crc
   else
      result:=FormPeach.StringGridList.Cells[c,i];
   end;
end;

procedure sort_az_stringgridlist(c:integer);
var
  i,rc:integer;
begin
if refreshstatus<>0 then exit;
rc:=FormPeach.StringGridList.Rowcount;
if rc>1 then
   for i:=1 to rc-1 do
      begin
      if FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder then
         FormPeach.StringGridList.Cells[17,i]:=prefixfaz+padstrsort(c,i)
      else
         FormPeach.StringGridList.Cells[17,i]:=prefixdaz+padstrsort(c,i);
      end;
FormPeach.StringGridList.SortColRow(true,17);
end;

procedure sort_az_stringgridlist_special(c:integer);
var
  s:ansistring;
  i,rc:integer;
begin
rc:=FormPeach.StringGridList.Rowcount;
if rc>1 then
   for i:=1 to rc-1 do
      begin
      if FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder then
         FormPeach.StringGridList.Cells[17,i]:=prefixfaz+padstrsort(c,i)
      else
         FormPeach.StringGridList.Cells[17,i]:=prefixdaz+padstrsort(c,i);
      end;
FormPeach.StringGridList.SortColRow(true,17);
end;

function smartsortable(s:ansistring):ansistring;
var
   fname,fext:string;
begin
result:=s;
if smartsortenabled=false then exit;
if result='' then exit;
if pos('.',result)<>0 then
   begin
   fname:=extractfilename(result);
   cutextension(fname);
   fext:=extractfileext(result);
   end
else
   begin
   fname:=result;
   fext:='';
   end;
fname:=smartsortstring(fname);
if fext<>'' then fext:=smartsortstring(fext);
if fext<>'' then result:=fname+''''+fext else result:=fname+''''; //some characters seems being sorted before space
end;

{///////////////////////////////////////////////////////////////////////////////

subsection SELECT items in file browser

///////////////////////////////////////////////////////////////////////////////}

procedure select_invert;
var
   i:integer;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
   begin
   for i:=1 to FormPeach.StringGridAdd.Rowcount-1 do
      if FormPeach.StringGridAdd.Cells[11,i]='0' then FormPeach.StringGridAdd.Cells[11,i]:='1'
      else FormPeach.StringGridAdd.Cells[11,i]:='0';
   FormPeach.StringGridAdd.Repaint;
   end;
{$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
   begin
   for i:=1 to FormPeach.StringGridExtract.Rowcount-1 do
      if FormPeach.StringGridExtract.Cells[11,i]='0' then FormPeach.StringGridExtract.Cells[11,i]:='1'
      else FormPeach.StringGridExtract.Cells[11,i]:='0';
   FormPeach.StringGridExtract.Repaint;
   end;
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   if FormPeach.ListViewBrowser.Visible=true then
      begin
      if FormPeach.StringGridList.Rowcount<2 then exit;
      if FormPeach.StringGridList.Cells[1,1]='' then exit;
      for i:=1 to FormPeach.StringGridList.Rowcount-1 do
         if FormPeach.StringGridList.Cells[16,i]='0' then FormPeach.StringGridList.Cells[16,i]:='1'
         else FormPeach.StringGridList.Cells[16,i]:='0';
      update_listview_sel;
      end;
end;

procedure apply_select(var istr:ansistring; val,op:ansistring);
begin
case op of
'neutralsel':
   istr:=val;
'addsel':
   if istr='0' then istr:=val;
'subtractsel':
   if istr='1' then
      if val='1' then istr:='0';
end;
end;

procedure select_by(sel:ansistring; op:ansistring);
var
   i,rc,sr,wsel,wa,wd,wsz,wpsz:integer;
   ci,cs,sdt,sdtr,istr:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
   begin
   sg:=FormPeach.StringGridAdd;
   sr:=FormPeach.StringGridAdd.Row;
   rc:=FormPeach.StringGridAdd.RowCount;
   wsel:=11;
   wa:=7;
   wd:=6;
   wsz:=3;
   wpsz:=1;//not supported
   end;
{$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
   begin
   sg:=FormPeach.StringGridExtract;
   sr:=FormPeach.StringGridExtract.Row;
   rc:=FormPeach.StringGridExtract.RowCount;
   wsel:=11;
   wa:=7;
   wd:=6;
   wsz:=3;
   wpsz:=1;//not supported
   end;
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.Top=0{$ENDIF} then
   begin
   if FormPeach.LabelClickAddress1.Caption=' '+txt_mypc+' ' then exit;
   if FormPeach.ListViewBrowser.Visible=false then exit;
   sg:=FormPeach.StringGridList;
   sr:=FormPeach.StringGridList.Row;
   rc:=FormPeach.StringGridList.Rowcount;
   wsel:=16;
   wa:=10;
   wd:=5;
   wsz:=3;
   wpsz:=4;
   savecol;
   end;

if rc<2 then exit;
if sg.Cells[1,1]='' then exit;

case sel of
   'ext'://extension
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[2,i]=sg.Cells[2,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'attributes'://attributes
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[wa,i]=sg.Cells[wa,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'dateyear': //date, absolute
   begin
   sdt:=FormatDateTime('yyyy',now);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,4);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'datemonth':
   begin
   sdt:=FormatDateTime('yyyy-mm',now);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,7);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'dateweek':
   begin
   sdt:=FormatDateTime('yyyy',now)+inttostr(weekoftheyear(now));
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=inttostr(weekoftheyear(strtodate(copy(sg.Cells[wd,i],9,2)+DefaultFormatSettings.DateSeparator+copy(sg.Cells[wd,i],6,2)+DefaultFormatSettings.DateSeparator+copy(sg.Cells[wd,i],1,4))));
      sdtr:=copy(sg.Cells[wd,i],1,4)+sdtr;
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'dateday':
   begin
   sdt:=FormatDateTime('yyyy-mm-dd',now);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,10);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'datehour':
   begin
   sdt:=FormatDateTime('yyyy-mm-dd hh',now);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,13);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'datesameyear': //date, similarity
   begin
   sdt:=copy(sg.Cells[wd,sr],1,4);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,4);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'datesamemonth':
   begin
   sdt:=copy(sg.Cells[wd,sr],1,7);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,7);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'datesameweek':
   begin
   sdt:=inttostr(weekoftheyear(strtodate(copy(sg.Cells[wd,sr],9,2)+DefaultFormatSettings.DateSeparator+copy(sg.Cells[wd,sr],6,2)+DefaultFormatSettings.DateSeparator+copy(sg.Cells[wd,sr],1,4))));
   sdt:=copy(sg.Cells[wd,sr],1,4)+sdt;
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=inttostr(weekoftheyear(strtodate(copy(sg.Cells[wd,i],9,2)+DefaultFormatSettings.DateSeparator+copy(sg.Cells[wd,i],6,2)+DefaultFormatSettings.DateSeparator+copy(sg.Cells[wd,i],1,4))));
      sdtr:=copy(sg.Cells[wd,i],1,4)+sdtr;
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'datesameday':
   begin
   sdt:=copy(sg.Cells[wd,sr],1,10);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,10);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'datesamehour':
   begin
   sdt:=copy(sg.Cells[wd,sr],1,13);
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      sdtr:=copy(sg.Cells[wd,i],1,13);
      if sdtr=sdt then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'daterecent': //date, comparison (strtodatetime no longer needed)
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[wd,i]>sg.Cells[wd,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'daterecentequal':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[wd,i]>=sg.Cells[wd,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'dateequal':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[wd,i]=sg.Cells[wd,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'dateolderequal':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[wd,i]<=sg.Cells[wd,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'dateolder':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[wd,i]<sg.Cells[wd,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'sizeempty'://size, absolute
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wsz,i])=0) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'size100k':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wsz,i])<=102400) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'size10m':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if ((strtoqword(sg.Cells[wsz,i])>102400) and (strtoqword(sg.Cells[wsz,i])<=10485760)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'size100m':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if ((strtoqword(sg.Cells[wsz,i])>10485760) and (strtoqword(sg.Cells[wsz,i])<=104857600)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizeover':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (strtoqword(sg.Cells[wsz,i])>104857600) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizesimilar10'://size, similarity
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and ((strtoqword(sg.Cells[wsz,i])*10)>=(strtoqword(sg.Cells[wsz,sr])*9)) and ((strtoqword(sg.Cells[wsz,i])*10)<=(strtoqword(sg.Cells[wsz,sr])*11)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizesimilar50':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and ((strtoqword(sg.Cells[wsz,i])*10)>=(strtoqword(sg.Cells[wsz,sr])*5)) and ((strtoqword(sg.Cells[wsz,i])*10)<=(strtoqword(sg.Cells[wsz,sr])*15)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizesmaller'://size, comparison
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wsz,i])<strtoqword(sg.Cells[wsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizesmallerequal':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wsz,i])<=strtoqword(sg.Cells[wsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizeequal':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wsz,i])=strtoqword(sg.Cells[wsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizelargerequal':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wsz,i])>=strtoqword(sg.Cells[wsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'sizelarger':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (strtoqword(sg.Cells[wsz,i])>strtoqword(sg.Cells[wsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packedempty'://packed size (only in archives displaying packed size), absolute
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wpsz,i])=0) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packed100k':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wpsz,i])<=102400) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packed10m':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if ((strtoqword(sg.Cells[wpsz,i])>102400) and (strtoqword(sg.Cells[wpsz,i])<=10485760)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packed100m':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if ((strtoqword(sg.Cells[wpsz,i])>10485760) and (strtoqword(sg.Cells[wpsz,i])<=104857600)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packedover':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (strtoqword(sg.Cells[wpsz,i])>104857600) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packedsimilar10'://packed size (only in archives displaying packed size), similarity
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and ((strtoqword(sg.Cells[wpsz,i])*10)>=(strtoqword(sg.Cells[wpsz,sr])*9)) and ((strtoqword(sg.Cells[wpsz,i])*10)<=(strtoqword(sg.Cells[wpsz,sr])*11)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packedsimilar50':
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and ((strtoqword(sg.Cells[wpsz,i])*10)>=(strtoqword(sg.Cells[wpsz,sr])*5)) and ((strtoqword(sg.Cells[wpsz,i])*10)<=(strtoqword(sg.Cells[wpsz,sr])*15)) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   'packedsmaller'://packed size (only in archives displaying packed size), comparison
   begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wpsz,i])<strtoqword(sg.Cells[wpsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   end;
   'packedsmallerequal':
   begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wpsz,i])<=strtoqword(sg.Cells[wpsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   end;
   'packedequal':
   begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wpsz,i])=strtoqword(sg.Cells[wpsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   end;
   'packedlargerequal':
   begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (strtoqword(sg.Cells[wpsz,i])>=strtoqword(sg.Cells[wpsz,sr])) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   end;
   'packedlarger':
   begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
   try
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if strtoqword(sg.Cells[wpsz,i])>strtoqword(sg.Cells[wpsz,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   except
   end;
   end;
   'char'://start with same character
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      ci:=lowercase(copy(sg.Cells[1,i],1,1));
      cs:=lowercase(copy(sg.Cells[1,sr],1,1));
      if ci=cs then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'charcase'://start with same character, case sensitive
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      ci:=copy(sg.Cells[1,i],1,1);
      cs:=copy(sg.Cells[1,sr],1,1);
      if ci=cs then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;

{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.Top=0{$ENDIF} then update_listview_sel
else sg.Repaint;
end;

procedure select_all(allnone:ansistring);//1 all, 0 none
var
   i:integer;
   arect:TGridRect;
begin
if (allnone<>'1') and (allnone<>'0') then exit;
{//global selection in add/extract string grids is not properly updated if changed with mouse wheel
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
   if FormPeach.StringGridAdd.Visible=true then
      begin
      if FormPeach.StringGridAdd.Rowcount<2 then exit;
      for i:=1 to FormPeach.StringGridAdd.Rowcount-1 do
          FormPeach.StringGridAdd.Cells[11,i]:=allnone;
      arect.Left:=0;
      arect.Right:=FormPeach.StringGridAdd.ColCount-1;
      arect.Top:=FormPeach.StringGridAdd.FixedRows;
      if allnone='1' then arect.Bottom:=FormPeach.StringGridAdd.RowCount-1
      else arect.Bottom:=arect.Top+1;
      FormPeach.StringGridAdd.Selection:=arect;
      FormPeach.StringGridAdd.Repaint;
      end;
{$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
   if FormPeach.StringGridExtract.Visible=true then
      begin
      if FormPeach.StringGridExtract.Rowcount<2 then exit;
      for i:=1 to FormPeach.StringGridExtract.Rowcount-1 do
         FormPeach.StringGridExtract.Cells[11,i]:=allnone;
      arect.Left:=0;
      arect.Right:=FormPeach.StringGridExtract.ColCount-1;
      arect.Top:=FormPeach.StringGridExtract.FixedRows;
      if allnone='1' then arect.Bottom:=FormPeach.StringGridExtract.RowCount-1
      else arect.Bottom:=arect.Top+1;
      FormPeach.StringGridExtract.Selection:=arect;
      FormPeach.StringGridExtract.Repaint;
      end;
      }
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   if FormPeach.ListViewBrowser.Visible=true then
      begin
      if listingdir=true then exit;
      if FormPeach.StringGridList.Rowcount<2 then exit;
      if FormPeach.StringGridList.Cells[1,1]='' then exit;
      for i:=1 to FormPeach.StringGridList.Rowcount-1 do
         FormPeach.StringGridList.Cells[16,i]:=allnone;
      update_listview_sel;
      end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection SEARCH items in file browser

///////////////////////////////////////////////////////////////////////////////}

procedure addtosearchhistory;
var
   sa: array[0..8] of ansistring;
   i,j:integer;
begin
with FormPeach do
begin
sa[0]:=EditUn7zaFilterInteractive.Caption;

if (fun<>'FILEBROWSER') and (simplesearch=1) and (length(sa[0])>2) then
   if (sa[0,1]='*') and (sa[0,length(sa[0])]='*') then sa[0]:=copy(sa[0],2,length(sa[0])-2);

if not((sa[0]<>'*') and (sa[0]<>pmshist1.Caption)) then exit;
sa[1]:=pmshist1.caption;
sa[2]:=pmshist2.caption;
sa[3]:=pmshist3.caption;
sa[4]:=pmshist4.caption;
sa[5]:=pmshist5.caption;
sa[6]:=pmshist6.caption;
sa[7]:=pmshist7.caption;
sa[8]:=pmshist8.caption;
j:=0;
for i:=2 to 8 do
   if sa[i]=sa[0] then
      begin
      j:=i;
      break;
      end;
if j<>0 then
   for i:=j downto 1 do sa[i]:=sa[i-1]
else
   for i:=8 downto 1 do sa[i]:=sa[i-1];
pmshist1.caption:=sa[1];
pmshist2.caption:=sa[2];
pmshist3.caption:=sa[3];
pmshist4.caption:=sa[4];
pmshist5.caption:=sa[5];
pmshist6.caption:=sa[6];
pmshist7.caption:=sa[7];
pmshist8.caption:=sa[8];
setsearchhistorymenu;
end;
end;

procedure nrsearch;
begin
issearching:=1;
if fun='UN7Z' then
   begin
   FormPeach.EditUn7zaFilterExclude.Text:=extractfilepath(FormPeach.EditUn7zaFilter.Text)+'*'+directoryseparator+'*';
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   is_searching:=true;
   filter_archivecontent;
   addtohistory;
   addtosearchhistory;
   end;
if fun='FILEBROWSER' then
   begin
   listdir(FormPeach.EditOpenIn.Text,false,false);
   addtohistory;
   addtosearchhistory;
   end;
end;

procedure resetsearch;
begin
if fun='FILEBROWSER' then nrsearch
else open_archive_fromname(FormPeach.EditOpenIn.Text);
end;

procedure kp_EditUn7zaFilterInteractive;
begin
FormPeach.EditUn7zaFilter.Text:=FormPeach.EditUn7zaFilterInteractive.Text;
if FormInput.CheckBoxInputRecoursive.State=cbChecked then rsearch
else nrsearch;
FormPeach.ImageListResetSearch.visible:=true;
end;

procedure kp_EditUn7zaFilterInteractive_nonrecursive;
begin
FormPeach.EditUn7zaFilter.Text:=FormPeach.EditUn7zaFilterInteractive.Text;
nrsearch;
end;

procedure do_resetsearch;
begin
FormPeach.EditUn7zaFilter.Text:='*';
FormPeach.EditUn7zaFilterInteractive.Text:='*';
FormPeach.EditOpenInInteractive.Caption:=FormPeach.EditOpenIn.Caption;
FormPeach.ImageListResetSearch.visible:=false;
FormInput.CheckBoxInputRecoursive.state:=cbchecked;
resetsearch;
end;

procedure setsearchbar(sb:byte);
begin
if sb=1 then
   begin
   FormPeach.PanelSearch.Visible:=true;
   FormPeach.pmshowsearch.Checked:=true;
   FormPeach.splitsearch.Visible:=true;
   end
else
   begin
   FormPeach.PanelSearch.Visible:=false;
   FormPeach.pmshowsearch.Checked:=false;
   FormPeach.splitsearch.Visible:=false;
   end;
showsearchbar:=sb;
if FormPeach.PanelSearch.Visible=true then try FormPeach.EditUn7zaFilterInteractive.SetFocus; except end;
end;

procedure rsearch;
begin
issearching:=2;
if fun='UN7Z' then
   begin
   statusr:=txt_list_found;
   list_un7z_search;
   statusr:='';
   addtosearchhistory;
   end;
if fun='FILEBROWSER' then
   begin
   statusr:=txt_list_found;
   listdir(FormPeach.EditOpenIn.Text,true,false);
   statusr:='';
   addtohistory;
   addtosearchhistory;
   end;
end;

procedure launch_rsearch;
var
   s:ansistring;
begin
if browserbusy=true then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if FormPeach.EditOpenInInteractive.Text<>FormPeach.EditOpenIn.Text then s:=FormPeach.EditOpenInInteractive.Text
else
   begin
   FormPeach.EditOpenInInteractive.Caption:=FormPeach.EditOpenIn.Caption;
   s:=FormPeach.EditUn7zaFilterInteractive.Text;
   end;
if not pInputQuery(txt_searchfor+'...', txt_search_refine, '', s, true) then exit;
if ((fun<>'FILEBROWSER') and (simplesearch=1)) then s:='*'+s+'*';
FormPeach.EditUn7zaFilter.Text:=s;
FormPeach.EditUn7zaFilterInteractive.Text:=s;
if FormInput.CheckBoxInputRecoursive.State=cbChecked then rsearch
else nrsearch;
FormPeach.ImageListResetSearch.visible:=true;
FormPeach.ImageListResetSearch.Hint:=txt_reset+' ('+s+')';
end;

procedure launch_nrsearch;
var
   s:ansistring;
begin
if browserbusy=true then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
s:=FormPeach.EditUn7zaFilterInteractive.Text;
FormInput.CheckBoxInputRecoursive.State:=cbUnChecked;
if not pInputQuery(txt_searchfor, txt_search_refine, '', s, true) then exit;
FormPeach.EditUn7zaFilter.Text:=s;
FormPeach.EditUn7zaFilterInteractive.Text:=s;
if FormInput.CheckBoxInputRecoursive.State=cbChecked then rsearch
else nrsearch;
end;

procedure launch_rrsearch;
var
   s:ansistring;
begin
if browserbusy=true then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
s:=FormPeach.EditUn7zaFilterInteractive.Text;
FormInput.CheckBoxInputRecoursive.State:=cbChecked;
if not pInputQuery(txt_searchfor, txt_search_refine, '', s, true) then exit;
FormPeach.EditUn7zaFilter.Text:=s;
FormPeach.EditUn7zaFilterInteractive.Text:=s;
if FormInput.CheckBoxInputRecoursive.State=cbChecked then rsearch
else nrsearch;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection DELETE and reset routines

///////////////////////////////////////////////////////////////////////////////}

function cleardirsimple(s:ansistring):integer;
var
   P: tprocessutf8;
   cl:ansistring;
begin
result:=-1;
if s='' then
   begin
   result:=0;
   exit;
   end;
if not(checkdirexists((s))) then
   begin
   result:=0;
   exit;
   end;
if validatecl(s)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+s);
   result:=0;
   exit;
   end; //should not happen, because string must be valid for the filesystem
{$IFDEF MSWINDOWS}
cl:='cmd /c rmdir "'+s+'" /s /q';
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole, poWaitOnExit];
peapexecute(P,cl);
result:=P.ExitStatus;
P.Free;
{$ELSE} //system needs to support rm command
cl:='rm -r '+stringdelim(escapefilename(s,desk_env));
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
peapexecute(P,cl);
result:=P.ExitStatus;
P.Free;
{$ENDIF}
if checkdirexists(s) then result:=-1;
end;

function cleardirasync(s:ansistring):integer;
var
   P: tprocessutf8;
   cl:ansistring;
begin
result:=-1;
if s='' then
   begin
   result:=0;
   exit;
   end;
if not(checkdirexists((s))) then
   begin
   result:=0;
   exit;
   end;
if validatecl(s)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+s);
   result:=0;
   exit;
   end; //should not happen, because string must be valid for the filesystem
{$IFDEF MSWINDOWS}
cl:='cmd /c rmdir "'+s+'" /s /q';
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
peapexecute(P,cl);
P.Free;
{$ELSE} //system needs to support rm command
cl:='rm -r '+stringdelim(escapefilename(s,desk_env));
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
{$ENDIF}
result:=0;//means the async deletion request was correctly launched
end;

function cleardir(var s:ansistring; cleardirname,force_skip_ptmpcode:boolean):integer;
//if directory is not cleared at first attempt (i.e. some objects temporary locked by system or security process), sleep and retry; on failure notify user if applicable
//cleardirname clear variable containing directory name
//force_skip_ptmpcode force avoiding to clear ptmpcode variable, otherwise decide parsing directory name
var
  P: tprocessutf8;
  cl:ansistring;
  ntry:integer;
begin
cleardir:=-1;
if s='' then
   begin
   cleardir:=0;
   exit;
   end;
if not(checkdirexists((s))) then
   begin
   cleardir:=0;
   exit;
   end;
if validatecl(s)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+s);
   cleardir:=0;
   exit;
   end; //should not happen, because string must be valid for the filesystem
ntry:=0;
repeat
ntry:=ntry+1;
if FormPeach.Visible=true then Application.ProcessMessages;
{if DeleteDirectory(s,false)=false then
   begin
   sleep(200+random(50));
   DeleteDirectory(s,false);
   end; } //dont'work with paths containing read only files, and keeps the files locked
{$IFDEF MSWINDOWS}
cl:='cmd /c rmdir "'+s+'" /s /q';
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole, poWaitOnExit];
peapexecute(P,cl);
cleardir:=P.ExitStatus;
P.Free;
{$ELSE} //system needs to support rm command
cl:='rm -r '+stringdelim(escapefilename(s,desk_env));
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
peapexecute(P,cl);
cleardir:=P.ExitStatus;
P.Free;
{$ENDIF}
if checkdirexists(s) then
   begin
   if FormPeach.Visible=true then Application.ProcessMessages;
   sleep(250+random(250));
   {$IFDEF MSWINDOWS}
   cl:='cmd /c rmdir "'+s+'" /s /q';
   P:=tprocessutf8.Create(nil);
   P.Options := [poNoConsole, poWaitOnExit];
   peapexecute(P,cl);
   cleardir:=P.ExitStatus;
   P.Free;
   {$ELSE} //system needs to support rm command
   cl:='rm -r '+stringdelim(escapefilename(s,desk_env));
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit];
   peapexecute(P,cl);
   cleardir:=P.ExitStatus;
   P.Free;
   {$ENDIF}
   end;
if checkdirexists(s) then cleardir:=-1
else cleardir:=0;
if ntry>1 then
   begin
   if s=peaziptmpdir then
      if cleardir<>0 then break;
   if s=peaziptmpdir_tmp then
      if cleardir<>0 then break;
   if s=peaziptmpdirroot+STR_PZWORKTMP+directoryseparator then
      if cleardir<>0 then break;
   if (s=ptmpdir) or (s=pstmpdir) or (s=ptmpdir+'f'+DirectorySeparator) then
      begin
      if cleardir<>0 then
         if skipdel=1 then break
         else
            if pMessageWarningOKAbort(txt_not_removable+char($0D)+char($0A)+s+char($0D)+char($0A)+txt_tempdir)=3 then break;
      end
   else
      begin
      if cleardir<>0 then
         if skipdel=1 then break
         else
            if pMessageWarningOKAbort(txt_not_removable+char($0D)+char($0A)+s)=3 then break;
      end;
   end
else
   if cleardir<>0 then sleep(250+random(250));
until cleardir=0;
if force_skip_ptmpcode=false then
   if (s<>pstmpdir) and (s<>ptmpdir+'f'+DirectorySeparator) then ptmpcode:='';
if cleardirname=true then s:='';
end;

function clearfile(s:ansistring):integer;
begin
clearfile:=-1;
if s='' then
   begin
   clearfile:=0;
   exit;
   end;
if not(fileexists((s))) then
   begin
   clearfile:=0;
   exit;
   end;
if FormPeach.Visible=true then Application.ProcessMessages;
repeat
   if udeletefile(s)=false then
      begin
      {$IFDEF MSWINDOWS}
      fileop_fromnamelist(s,'',0,3);
      if fileexists(s) then
      {$ENDIF}
      if pMessageWarningOKAbort(txt_not_removable_file+char($0D)+char($0A)+s)=3 then break
      {$IFDEF MSWINDOWS}
      else
      else clearfile:=0;
      {$ENDIF}
      end
   else clearfile:=0;
until clearfile=0;
end;

procedure reset_temp(mode:integer);//mode 0 quick, do not open work temp path for manual removal of leftover files 1 complete
var
   s:ansistring;
begin
//all those dirs are always inside STR_PZWORKTMP subdir in the temporary root (which is untouched by this procedure)
s:=peaziptmpdir;
cleardir(s,true,false);
s:=peaziptmpdir_tmp;
cleardir(s,true,false);
if (mode =1) or (checkempty_dir(peaziptmpdirroot+STR_PZWORKTMP+directoryseparator) = true) then
   begin
   s:=peaziptmpdirroot+STR_PZWORKTMP+directoryseparator;
   cleardir(s,true,false);
   end;
if mode=1 then
   begin
   if (checkdirexists(peaziptmpdir)) or (checkdirexists(peaziptmpdirroot+STR_PZWORKTMP+directoryseparator)) then
      begin
      pMessageWarningOK(txt_8_3_lw);
      cp_open(peaziptmpdirroot,desk_env);
      end;
   end;
end;

procedure endmultimode;
begin
FormPeach.TimerWinContext.enabled:=false;
if dn<>'' then
   begin
   cleardir(dn,false, true);
   dn:='';
   end;
end;

procedure on_exit;
begin
try
if FormPeach.Visible=true then
   begin
   if pimmersive=0 then
      if FormPeach.WindowState=wsNormal then
         begin
         ws_status:=0;
         ws_left:=FormPeach.Left;
         ws_top:=FormPeach.Top;
         ws_width:=FormPeach.Width;
         ws_height:=FormPeach.Height;
         end
      else
         if FormPeach.WindowState=wsMaximized then ws_status:=1;
   end;
except
end;
FormPeach.Visible:=false;
try
addtofolderhistory(FormPeach.EditOpenIn.Text);
if (browserstyle=20) or (browserstyle=21) then //if browser style to be saved is last used, always save defaults;
   begin
   if browsingmode7z=0 then browserstyle:=20 else browserstyle:=21;
   end;
save_conf;
save_bookmarks;
save_tabs;
//save_custedit; not needed, apps are saved exiting from the modal dialog
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
reset_temp(0);
endmultimode;
clearstopsequencefile;
endflag:=true;
except
end;
end;

procedure restartpeaapp;
var
   P:tprocessutf8;
   cl:ansistring;
begin
cl:=stringdelim(executable_path+'peazip'+EXEEXT);
execute_cl_process(cl);
end;

procedure exit_nosave;
begin
needsave:=false;
FormPeach.Close;
end;

procedure resetexttonewfolder;
begin
if settmpextnf=true then
   begin
   if tmpextnf= true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
   removeintdir:=tmpremoveintdir;
   end;
end;

procedure exit_withsave;
begin
resetexttonewfolder;
on_exit;
exit_nosave;
end;

procedure restartclosepeaapp;
begin
restartpeaapp;
exit_nosave;
end;

procedure saverestartclosepeaapp;
begin
on_exit;
restartclosepeaapp;
end;

procedure phalstsystem_fromapp;
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:='shutdown /s /t 10';
{$ELSE}
cl:='halt';
{$ENDIF}
execute_cl_process(cl);
exit_withsave;
end;

procedure checkhaltsystem_fromA;
begin
if FormPeach.CheckBoxAutoHaltA.State=cbChecked then phalstsystem_fromapp;
end;

procedure checkhaltsystem_fromE;
begin
if FormPeach.CheckBoxAutoHaltE.State=cbChecked then phalstsystem_fromapp;
end;

procedure resetminimizedlauncher;//reset minimized status for PeaLauncher
begin
if checkdirexists(confpath+'.minimized') then removedir(confpath+'.minimized');
end;

procedure erase_fromname(ptype:ansistring; var in_param:ansistring);
//ptype "archive" get erase mode from archiving parameters, "extract" from extraction parameters
//erase modes: 0 quick, 1 secure (get erase passes from global variable set in settings), 2 overwrite with zero, 3 send to Trash
var
   P:tprocessutf8;
   bin_name,eraselevel,pstr,cl:ansistring;
   erasemode:integer;
begin
if in_param='' then exit; //input parameter must be already set from the calling procedure
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
if ptype='archive' then
   begin
   if doptadd=0 then exit;
   pstr:=FormPeach.cbDeleteInputModeAdd.Caption;
   {$IFDEF MSWINDOWS}
   case FormPeach.cbDeleteInputModeAdd.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   {$IFDEF DARWIN}
   case FormPeach.cbDeleteInputModeAdd.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   case FormPeach.cbDeleteInputModeAdd.ItemIndex of
      0: erasemode:=0;
      1: erasemode:=2;
      2: erasemode:=1;
   end;
   {$ENDIF}
   {$ENDIF}
   end;
if ptype='extract' then
   begin
   if doptext=0 then exit;
   pstr:=FormPeach.cbDeleteInputModeExt.Caption;
   {$IFDEF MSWINDOWS}
   case FormPeach.cbDeleteInputModeExt.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   {$IFDEF DARWIN}
   case FormPeach.cbDeleteInputModeExt.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   case FormPeach.cbDeleteInputModeExt.ItemIndex of
      0: erasemode:=0;
      1: erasemode:=2;
      2: erasemode:=1;
   end;
   {$ENDIF}
   {$ENDIF}
   end;
case erasepasses of
   0: eraselevel:='VERY_FAST';
   1: eraselevel:='FAST';
   2: eraselevel:='MEDIUM';
   3: eraselevel:='SLOW';
   4: eraselevel:='VERY_SLOW';
   end;
if erasemode=0 then eraselevel:='QUICK';
if erasemode=2 then eraselevel:='ZERO';
if erasemode=3 then eraselevel:='RECYCLE';
if pMessageWarningYesNo(txt_5_4_deletefilesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+pstr+char($0D)+char($0A)+char($0D)+char($0A)+in_param)=6 then
   begin
   cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   peapexecute(P,cl);
   P.Free;
   do_forcerefresh;
   end;
end;

procedure erase_fromarchiving(erasemode:integer; executemode:integer; var cl:ansistring);//0: quick delete 1: secure delete 2: zero delete 3: recycle (Windows, macOS)
var
   P:tprocessutf8;
   bin_name,in_param,eraselevel,s:ansistring;
   i:integer;
begin
in_param:='';
if FormPeach.StringGridAdd.Row=0 then exit;
if FormPeach.StringGridAdd.Cells[1,1]='' then exit;
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
for i:=1 to FormPeach.StringGridAdd.Rowcount-1 do
   begin
   s:=FormPeach.StringGridAdd.Cells[8,i];
   if FormPeach.CheckBoxConvert.State=cbChecked then
      begin
      if s<>'' then
         if s[length(s)]='*' then setlength(s,length(s)-1);
      if s<>'' then
         if s[length(s)]=DirectorySeparator then setlength(s,length(s)-1);
      s:=ExtractFilePath(s)+FormPeach.StringGridAdd.Cells[1,i];
      end;
   if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
   in_param:=in_param+stringdelim(escapefilename(s,desk_env))+' ';
   end;
if s<>'' then
   if s[length(s)]='*' then exit;//additional security against unexpected errors: input must be a file
if s<>'' then
   if s[length(s)]=DirectorySeparator then exit;//additional security against unexpected errors: input must be a file
case erasepasses of
   0: eraselevel:='VERY_FAST';
   1: eraselevel:='FAST';
   2: eraselevel:='MEDIUM';
   3: eraselevel:='SLOW';
   4: eraselevel:='VERY_SLOW';
   end;
if erasemode=0 then eraselevel:='QUICK';
if erasemode=2 then eraselevel:='ZERO';
if erasemode=3 then eraselevel:='RECYCLE';
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
if executemode=1 then
   begin
   peapexecute(P,cl);
   end;
P.Free;
end;

procedure erase_fromuntarafter(star: ansistring; erasemode:integer; executemode:integer; var cl:ansistring);//0: quick delete 1: secure delete 2: zero delete 3: recycle (Windows)
var
   P:tprocessutf8;
   bin_name,in_param,eraselevel,s:ansistring;
begin
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
if checkfiledirname(star)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
in_param:=stringdelim(escapefilename(star,desk_env));
case erasepasses of
   0: eraselevel:='VERY_FAST';
   1: eraselevel:='FAST';
   2: eraselevel:='MEDIUM';
   3: eraselevel:='SLOW';
   4: eraselevel:='VERY_SLOW';
   end;
if erasemode=0 then eraselevel:='QUICK';
if erasemode=2 then eraselevel:='ZERO';
if erasemode=3 then eraselevel:='RECYCLE';
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
if executemode=1 then
   peapexecute(P,cl);
P.Free;
end;

procedure resetbookmarks(rmode:ansistring);
var
   s:ansistring;
begin
case rmode of
   'reset': s:=txt_5_0_resetbookmarks;
   'delete': s:=txt_2_4_deletebookmarks;
   end;
if pMessageInfoYesNo(s)=6 then
   begin
   udeletefile(confpath+'bookmarks.txt');
   FormPeach.StringGridBookmarks.RowCount:=1;
   restartpeaapp;
   case rmode of
      'reset': begin autobookmarks; exit_nosave; end;
      'delete': exit_withsave;
      end;
   end;
end;

procedure dohistoryreset;
begin
FormPeach.mRecent1.Caption:='';
FormPeach.mRecent2.Caption:='';
FormPeach.mRecent3.Caption:='';
FormPeach.mRecent4.Caption:='';
FormPeach.mRecent5.Caption:='';
FormPeach.mRecent6.Caption:='';
FormPeach.mRecent7.Caption:='';
FormPeach.mRecent8.Caption:='';
FormPeach.mRecent1f.Caption:='';
FormPeach.mRecent2f.Caption:='';
FormPeach.mRecent3f.Caption:='';
FormPeach.mRecent4f.Caption:='';
FormPeach.mRecent5f.Caption:='';
FormPeach.mRecent6f.Caption:='';
FormPeach.mRecent7f.Caption:='';
FormPeach.mRecent8f.Caption:='';
sethistory;
FormPeach.pmshist1.Caption:='';
FormPeach.pmshist2.Caption:='';
FormPeach.pmshist3.Caption:='';
FormPeach.pmshist4.Caption:='';
FormPeach.pmshist5.Caption:='';
FormPeach.pmshist6.Caption:='';
FormPeach.pmshist7.Caption:='';
FormPeach.pmshist8.Caption:='';
setsearchhistorymenu;
end;

procedure resetpmmain;
begin
if pMessageWarningYesNo(txt_5_0_resetpm)=6 then
   begin
   udeletefile(confpath+'pm');
   restartclosepeaapp;
   end;
end;

procedure sanitizedisk(smode:integer); //1:secure delete free space 2: zero free space
var
   s,s0,sdrive,fstype,s1,eraselevel,cl,bin_name:ansistring;
   bufVolumeName, bufFSName: array[0..255] of Char;
   sn,mc,flags:dword;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if FormPeach.EditOpenIn.Text=txt_mypc then s:=copy(FormPeach.StringGridList.Cells[12, FormPeach.StringGridList.Row], 1, 2)
   else s:=copy(FormPeach.EditOpenIn.Text, 1, 2)
else s:=copy(FormPeach.EditOpenIn.Text, 1, 2);
case smode of
   1: s1:=txt_5_2_sdfree;
   2: s1:=txt_5_2_zfree;
   end;

getwinenvadv(wincomspec,winver,majmin);

   sdrive:=s+'\';
   GetVolumeInformation(Pchar(sdrive),
   @bufVolumeName, sizeof(bufVolumeName),
   @sn, mc, flags,
   @bufFSName, sizeof(bufFSName));
   fstype:=bufFSName;

if fstype<>'' then s0:=s+' ('+fstype+')' else s0:=s;

if FormPeach.visible=true then
   if pMessageInfoYesNo(s0+char($0D)+char($0A)+char($0D)+char($0A)+s1+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_2_free)=6 then
      begin
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
      case erasepasses of
         0: eraselevel:='VERY_FAST';
         1: eraselevel:='FAST';
         2: eraselevel:='MEDIUM';
         3: eraselevel:='SLOW';
         4: eraselevel:='VERY_SLOW';
      end;
      if smode=2 then eraselevel:='ZERO';
      cl:=bin_name+' SANITIZE '+eraselevel+' '+s;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      P.Options := [poNoConsole];
      peapexecute(P,cl);
      P.Free;
      end;
{$ENDIF}
end;

procedure erase_fromextraction(erasemode:integer; executemode:integer; var cl:ansistring);//0: quick delete 1: secure delete 2: zero delete 3: recycle (Windows)
var
   P:tprocessutf8;
   bin_name,in_param,eraselevel,s:ansistring;
   i:integer;
begin
in_param:='';
if FormPeach.StringGridExtract.Row=0 then exit;
if FormPeach.StringGridExtract.Cells[1,1]='' then exit;
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
for i:=1 to FormPeach.StringGridExtract.Rowcount-1 do
   begin
   s:=FormPeach.StringGridExtract.Cells[8,i];
   if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
   getmultiname(s,in_param);
   end;
case erasepasses of
   0: eraselevel:='VERY_FAST';
   1: eraselevel:='FAST';
   2: eraselevel:='MEDIUM';
   3: eraselevel:='SLOW';
   4: eraselevel:='VERY_SLOW';
   end;
if erasemode=0 then eraselevel:='QUICK';
if erasemode=2 then eraselevel:='ZERO';
if erasemode=3 then eraselevel:='RECYCLE';
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
if executemode=1 then
   peapexecute(P,cl);
P.Free;
end;

procedure erase_fromextractarc(erasemode:integer; executemode:integer; var cl:ansistring);//0: quick delete 1: secure delete 2: zero delete 3: recycle (Windows)
var
   P:tprocessutf8;
   bin_name,in_param,eraselevel,s:ansistring;
begin
in_param:='';
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
s:=FormPeach.EditOpenIn.Text;
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
getmultiname(s,in_param);
case erasepasses of
   0: eraselevel:='VERY_FAST';
   1: eraselevel:='FAST';
   2: eraselevel:='MEDIUM';
   3: eraselevel:='SLOW';
   4: eraselevel:='VERY_SLOW';
   end;
if erasemode=0 then eraselevel:='QUICK';
if erasemode=2 then eraselevel:='ZERO';
if erasemode=3 then eraselevel:='RECYCLE';
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
if executemode=1 then
   peapexecute(P,cl);
P.Free;
end;

procedure peazipdoreset;
begin
defaultarchiveaction:=0;
FormPeach.ComboBox7zFun.ItemIndex:=0;
archive_type_select(STR_7Z);
archive_type_select(STR_ZIP);
FormPeach.Caption:='PeaZip';
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
reset_temp(1);
clearstopsequencefile;
if pMessageInfoYesNo(txt_4_4_confremove)=6 then
   begin
   dohistoryreset;
   udeletefile(confpath+'conf.txt');
   udeletefile(confpath+'conf-lastgood.txt');
   udeletefile(confpath+'textpreview.txt');
   udeletefile(confpath+'tabs.txt');
   assignfile(conf,confpath+'peazip-reset.txt');
   rewrite(conf);
   writeln(conf,' ');
   CloseFile(conf);
   FormPeach.scaleby(100,pzoom);
   FormPeach.WindowState:=wsNormal;
   FormPeach.Left:=DLEFT;
   FormPeach.Top:=DTOP;
   FormPeach.Width:=DWIDTH;
   FormPeach.Height:=DHEIGTH;
   load_conf;
   end;
FormPeach.Caption:='PeaZip';
if pMessageInfoYesNo(txt_4_4_confremoveall)=6 then
   begin
   udeletefile(confpath+'bookmarks.txt');
   autobookmarks;
   udeletefile(confpath+'custedit.txt');
   //if pMessageWarningYesNo(txt_5_0_resetpm)=6 then udeletefile(confpath+'pm');
   end;
end;

procedure peazipreset;
begin
peazipdoreset;
{$IFDEF MSWINDOWS}
if not(FileExists(resource_path+'portable')) then //if windows instalable version
   begin
   peaziplanguagenc('default.txt');
   if pMessageInfoYesNo(txt_5_3_resetsi)=6 then configure_systemintegration(true);
   end;
{$ENDIF}
restartpeaapp;
exit_nosave; //don't use Close to skip on form close event
end;

procedure peaziptotalreset;//as peazipreset, no restart
begin
peazipdoreset;
{$IFDEF MSWINDOWS}
if not(FileExists(resource_path+'portable')) then //if windows instalable version
   begin
   peaziplanguagenc('default.txt');
   if pMessageInfoYesNo(txt_5_3_resetsi)=6 then configure_systemintegration(true);
   end;
{$ENDIF}
exit_nosave;
end;

{$IFDEF DARWIN}
procedure mac_movetotrash(itemtodelete:AnsiString);
var
  aNSArray : NSMutableArray;
  aNSURL   : NSURL;
begin
  aNSArray := NSMutableArray(NSMutableArray.array_).init;
  aNSURL   := NSURL.fileURLWithPath(NSSTR(pchar(itemtodelete)));
  aNSArray.addObject(aNSURL);
  NSWorkspace.sharedWorkspace.recycleURLs_completionHandler(aNSArray,nil);
end;
{$ENDIF}

procedure eraseselected_list(erasemode:integer);//0: quick delete 1: secure delete 2: zero delete
var
   P:tprocessutf8;
   cl,bin_name,in_param,eraselevel,strsel,s:ansistring;
   i,nsel:integer;
begin
in_param:='';
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
case erasemode of
   0: s:=txt_delete;
   1: s:=txt_wipe;
   2: s:=txt_5_2_zerodelete;
   end;
if FormPeach.visible=true then
   if pMessageWarningYesNo(s+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6 then
   begin
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
   for i:=1 to FormPeach.StringGridList.Rowcount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         in_param:=in_param+stringdelim(escapefilename((FormPeach.StringGridList.Cells[12,i]),desk_env))+' ';
         end;
   case erasepasses of
      0: eraselevel:='VERY_FAST';
      1: eraselevel:='FAST';
      2: eraselevel:='MEDIUM';
      3: eraselevel:='SLOW';
      4: eraselevel:='VERY_SLOW';
      end;
   if erasemode=0 then eraselevel:='NONE';
   if erasemode=2 then eraselevel:='ZERO';
   cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   peapexecute(P,cl);
   P.Free;
   do_forcerefresh;
   end;
end;

procedure erase_fromname_list(erasemode:integer; s_in:ansistring);//0: quick delete 1: secure delete 2: zero delete
var
   P:tprocessutf8;
   cl,bin_name,in_param,eraselevel,s:ansistring;
begin
in_param:='';
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
case erasemode of
   0: s:=txt_delete;
   1: s:=txt_wipe;
   2: s:=txt_5_2_zerodelete;
   end;
if FormPeach.visible=true then
   if pMessageWarningYesNo(s+char($0D)+char($0A)+char($0D)+char($0A)+s_in)=6 then
   begin
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
   if checkfiledirname(s_in)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s_in); exit; end;
   in_param:=stringdelim(escapefilename((s_in),desk_env));
   case erasepasses of
      0: eraselevel:='VERY_FAST';
      1: eraselevel:='FAST';
      2: eraselevel:='MEDIUM';
      3: eraselevel:='SLOW';
      4: eraselevel:='VERY_SLOW';
      end;
   if erasemode=0 then eraselevel:='NONE';
   if erasemode=2 then eraselevel:='ZERO';
   cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   peapexecute(P,cl);
   P.Free;
   do_forcerefresh;
   end;
end;

procedure recycleselected_list;
var
   in_param,strsel:ansistring;
   s:array of ansistring;
   i,j,nsel:integer;
begin
{$IFDEF MSWINDOWS}
in_param:='';
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
if FormPeach.EditOpenIn.Text=txt_mypc then exit;
if FormPeach.visible=true then
   //if pMessageWarningYesNo(txt_4_7_recycleask+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6 then
   begin
   j:=0;
   setlength(s,0);
   for i:=1 to FormPeach.StringGridList.Rowcount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         in_param:=FormPeach.StringGridList.Cells[12,i];
         setlength(s,length(s)+1);
         s[j] := in_param;
         j:=j+1;
         end;
   fileop_fromnamelist(s,'',0,0);
   end;
{$ENDIF}
{$IFDEF DARWIN}
in_param:='';
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
if FormPeach.visible=true then
   begin
   for i:=1 to FormPeach.StringGridList.Rowcount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         in_param:=FormPeach.StringGridList.Cells[12,i];
         mac_movetotrash(in_param);
         end;
   end;
{$ENDIF}
end;

procedure deleteselected_frombrowser;
var
   i,j,k,nsel:integer;
   s,s1,cl,jobcode,outname,strsel:ansistring;
   scheduleclip:array of array [0..18] of ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then
   begin
   if pMessageWarningYesNo(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6 then
      begin
      s1:=FormPeach.EditOpenIn.Text;
      k:=0;
      setlength(scheduleclip,1);
      for i:=1 to FormPeach.StringGridList.RowCount-1 do
         begin
         if FormPeach.EditOpenIn.Text<>s1 then break;
         if FormPeach.StringGridList.Cells[16,i]='1' then
            begin
            if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
            for j:=0 to FormPeach.StringGridList.ColCount-1 do
               scheduleclip[k,j]:=FormPeach.StringGridList.Cells[j,i];
            setlength(scheduleclip,length(scheduleclip)+1);
            k:=k+1;
            end;
         end;
      for i:=0 to k-1 do
         begin
         if endflag=true then exit;
         s:=scheduleclip[i,12];
         if scheduleclip[i,2]=txt_list_isfolder then cleardirsimple(s)
         else clearfile(s);
         end;
      setlength(scheduleclip,0);
      end;
   exit;
   end;
if testeditable=false then exit;
{if (test_canbechanged(FormPeach.EditOpenIn.Text)=1) or (test_forcechanged(FormPeach.EditOpenIn.Text)=1) then
else
   begin
   pMessageWarningOK(txt_add_error);
   exit;
   end;}
if fun='UN7Z' then
   begin
   if testencrypted<0 then exit;
      if pMessageWarningYesNo(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6 then
         case upcase(extractfileext(FormPeach.EditOpenIn.Text)) of
         '.RAR':
            begin
            if compose_rarspecfun_cl(cl,jobcode,outname,'d')=0 then
               if execute_cl(cl,'delete')=0 then reloadandbrowse
               else
                  if forcecanbechanged=0 then pMessageWarningOK(txt_add_error);
            end
         else
            begin
            if compose_un7z_cl(cl,jobcode,outname,false,'delete','selected')=0 then //applies workaround for absolute paths
               if execute_cl(cl,'delete')=0 then reloadandbrowse
               else
                  if forcecanbechanged=0 then pMessageWarningOK(txt_add_error);
            end;
         end;
   wasselected:=-1;
   end;
if fun='UNARC' then
   begin
      if pMessageWarningYesNo(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6 then
         if compose_unarc_cl(cl,jobcode,outname,false,'delete','selected')=0 then
            if execute_cl(cl,'delete')=0 then browse_arc('flat')
            else pMessageWarningOK(txt_add_error);
   update_listview;
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection OPEN ARCHIVE in file browser

///////////////////////////////////////////////////////////////////////////////}

procedure setbrowserwarning_on;
begin
FormPeach.LabelErrors.visible:=true;
FormPeach.LabelErrors.Caption:=txt_7_3_archiveerrors;
FormPeach.ctrlwarning.visible:=true;
browserwarningmsg:=txt_7_3_archiveerrorshint;
if browserwarningmsg1<>'' then browserwarningmsg:=browserwarningmsg+char($0D)+char($0A)+char($0D)+char($0A)+browserwarningmsg1;
if browserwarningmsg2<>'' then browserwarningmsg:=browserwarningmsg+char($0D)+char($0A)+char($0D)+char($0A)+browserwarningmsg2;
end;

procedure setbrowserwarning_off;
begin
FormPeach.LabelErrors.visible:=false;
FormPeach.LabelErrors.Caption:='';
FormPeach.ctrlwarning.visible:=false;
browserwarningmsg:='';
browserwarningmsg1:='';
browserwarningmsg2:='';
end;

function find_7z_titles:integer;
var
   i:integer;
   s1:ansistring;
begin
result:=0;
i:=0;
repeat
   s1:=FormPeach.MemoList.Lines[i];
   i:=i+1;
until (s1=ZSTRING) or (i>=FormPeach.MemoList.Lines.Count);
title_lines_7z:=i+1; //dynamically find title and comment lines
if i>=FormPeach.MemoList.Lines.Count then result:=-1 else result:=1;
end;

function find_rar5_titles:integer;
var
   i:integer;
   s1:ansistring;
begin
result:=0;
i:=0;
repeat
   if length(FormPeach.MemoList.Lines[i])>13 then s1:=copy(FormPeach.MemoList.Lines[i],1,14);
   i:=i+1;
until (s1=RAR5STRING) or (i>=FormPeach.MemoList.Lines.Count);
title_lines_7z:=i+1; //dynamically find title and comment lines
if i>=FormPeach.MemoList.Lines.Count then result:=-1 else result:=1;
end;

function identify_field(s:ansistring):ansistring;
begin
if pos(' = ', s)<>0 then identify_field:=copy(s,1,pos(' = ', s)-1)
else identify_field:='new_record';
end;

function identify_field_rar5(s:ansistring; var ipos:integer):ansistring;
begin
ipos:=pos(': ', s);
if ipos<>0 then identify_field_rar5:=copy(s,1,ipos-1)
else identify_field_rar5:='new_record';
identify_field_rar5:=trim(identify_field_rar5);
end;

procedure set_pw;
begin
if seemencrypted=true then
   begin
   status_curarchive:=currentcomp+', '+txt_encrypted;
   end;
end;

function find_7zl_titles:integer;
var
   i,zsline:integer;
   s1,s2,archtype:ansistring;
begin
result:=0;
i:=0;
repeat
   s1:=FormPeach.MemoList.Lines[i];
   i:=i+1;
until (s1=ZSTRINGS) or (i>=FormPeach.MemoList.Lines.Count);
zsline:=i;
i:=0;
repeat
   s1:=FormPeach.MemoList.Lines[i];
   i:=i+1;
until (s1=ZSTRINGL) or (i>=FormPeach.MemoList.Lines.Count);
title_lines_7z:=i; //dynamically find title and comment lines
if i>=FormPeach.MemoList.Lines.Count then result:=-1 else result:=1;
lcmethod:='';
archtype:='';
if (zsline<title_lines_7z) and (result=1) then
   for i:=zsline to title_lines_7z-1 do
     begin
     s1:=FormPeach.MemoList.Lines[i];
     if s1='WARNINGS:' then
        begin
        if i+1<=title_lines_7z-1 then
           browserwarningmsg1:=FormPeach.MemoList.Lines[i]+char($0D)+char($0A)+FormPeach.MemoList.Lines[i+1];
        setbrowserwarning_on;
        end;
     if s1='ERRORS:' then
        begin
        if i+1<=title_lines_7z-1 then
           browserwarningmsg2:=FormPeach.MemoList.Lines[i]+char($0D)+char($0A)+FormPeach.MemoList.Lines[i+1];
        setbrowserwarning_on;
        end;
     s2:=identify_field(s1);
     case s2 of
        'Type':
         begin
         archtype:=copy(s1,8,length(s1)-7);
         end;
         'Method':
         begin
         if lcmethod='' then
            lcmethod:=copy(s1,10,length(s1)-9);
         if pos('AES',s1)<>0 then
            begin
            seemencrypted:=true;
            set_pw;
            end;
        end;
     end;
     end;
if (archtype<>'') and (lcmethod<>'') then lcmethod:=archtype+', '+lcmethod;
if (archtype<>'') and (lcmethod='') then lcmethod:=archtype;
end;

procedure tempcharcodefix(var s:ansistring);
//optionally replace characters over ASCII 126 (~) with ? wildcard to avoid issues in translation of extended characters;
//otherwise, displays characters as utf-8; on Windows characters comes encoded in console's codepage (to memory stream reading backend stdout)
var
   i:integer;
begin
//{$IFDEF MSWINDOWS} if enc7zscc=2 then convertwincp(s); {$ENDIF}
if archivenameenc=0 then
   for i:=1 to length(s) do
      begin
      if comparestr(s[i],'~')>0 then s[i]:='?';
      end;
end;

procedure tempcharcodefixarc(var s:ansistring);
//optionally replace characters over ASCII 126 (~) with ? wildcard to avoid issues in translation of extended characters;
//otherwise, displays characters as utf-8; on Windows characters comes encoded in console's codepage (to memory stream reading backend stdout)
var
   i:integer;
begin
//{$IFDEF MSWINDOWS} convertwincp(s); {$ENDIF}
if archivenameenc=0 then
   for i:=1 to length(s) do
      begin
      if comparestr(s[i],'~')>0 then s[i]:='?';
      end;
end;

procedure scan_omitted_dirs(var nfolders:integer);//search for directories not explicitly listed in archive TOC
var
   i,j,rc,rc2,dc,dc2,sle,fwrk,offs,offs1,offsize:integer;
   searchsize,searchsizefolders,tsize,tcsize:qword;
   s,st,dirstr,slowc,altspecbrowse,rspecbrowse,spath,sprev:ansistring;
   prebrowsed:boolean;

procedure findaltroot;
begin
//find alternative root level
if FormPeach.StringGridList.RowCount>1 then
   begin
   if FormPeach.StringGridList.Cells[2,1]=txt_list_isfolder then altspecbrowse:=FormPeach.StringGridList.Cells[12,1]
   else altspecbrowse:=extractfilepath(FormPeach.StringGridList.Cells[12,1]);
   if length(altspecbrowse)>1 then
      if (altspecbrowse[length(altspecbrowse)]='/') or (altspecbrowse[length(altspecbrowse)]='\') or (altspecbrowse[length(altspecbrowse)]=DirectorySeparator) then setlength(altspecbrowse, length(altspecbrowse)-1);
   if length(altspecbrowse)>2 then
      begin
      s:=copy(altspecbrowse,3,length(altspecbrowse)-2);
      if pos(DirectorySeparator,s)<>0 then s:=copy(s,1,pos(DirectorySeparator,s)-1);
      altspecbrowse:=altspecbrowse[1]+altspecbrowse[2]+s;
      end;
   end;
//keep shorter root path
if length(altspecbrowse)<length(specbrowse) then
   rspecbrowse:=altspecbrowse
else
   rspecbrowse:=specbrowse;
//if alternative root level starts with directoryseparator, and classic root not, keep alternative one
if (altspecbrowse<>'') and ((altspecbrowse[1]='/') or (altspecbrowse[1]='\') or (altspecbrowse[1]=DirectorySeparator)) then
   if (specbrowse<>'') and ((specbrowse[1]='/') or (specbrowse[1]='\') or (specbrowse[1]=DirectorySeparator)) then
   else rspecbrowse:=altspecbrowse;
specbrowse:=rspecbrowse;
//try to remove one level of nesting for the root
if specbrowse<>'' then
   begin
   specbrowse:=ExtractFilePath(specbrowse);
   if (specbrowse[length(specbrowse)]<>DirectorySeparator) and (specbrowse[length(specbrowse)]<>'/') and (specbrowse[length(specbrowse)]<>'\') then specbrowse:=specbrowse+DirectorySeparator;
   end;
end;

begin
FormPeach.StringGridAddressAllFolders.RowCount:=1;
FormPeach.StringGridAddressOmittedFolders.RowCount:=1;
FormPeach.StringGridAddressAllFolders.BeginUpdate;
FormPeach.StringGridAddressAllFolders.Clear;
FormPeach.StringGridAddressOmittedFolders.BeginUpdate;
FormPeach.StringGridAddressOmittedFolders.Clear;
FormPeach.StringGridAddressAllFolders.RowCount:=nfolders+1+1024;
FormPeach.StringGridAddressOmittedFolders.RowCount:=1+1024;
rc2:=1;
specbrowse:='';
pspecbrowse:='';
FormPeach.StringGridAddressOmittedFolders.ColCount:=FormPeach.StringGridAddressAllFolders.ColCount;
set_archivetree:=true;
i:=1;
for j:=0 to FormPeach.StringGridList.RowCount-1 do
  if FormPeach.StringGridList.Cells[2,j]<>txt_list_isfolder then
  else
     begin
     FormPeach.StringGridAddressAllFolders.Rows[i].Assign(FormPeach.StringGridList.Rows[j]);
     i:=i+1;
     end;
rc:=i;
FormPeach.StringGridAddressAllFolders.RowCount:=rc;
//if pre-parsing optimization is enabled, limit omitted folders test for reasonable performances
case prebrowse of
   1: begin searchsize := 1024*1024; searchsizefolders := 32*1024; end;
   2: begin searchsize := 512*1024; searchsizefolders := 16*1024; end;
   3,4,5: begin searchsize := 256*1024; searchsizefolders := 8*1024; end;
   end;
prebrowsed:=false;

if (prebrowse=0) or (nfolders<searchsizefolders) then
if (prebrowse=0) or (FormPeach.StringGridList.RowCount<searchsize) then //full pre-parsing routine to reconcile possible inconsistencies in TOC of archive
begin
prebrowsed:=true;
dirstr:='*';
for j:=1 to FormPeach.StringGridAddressAllFolders.RowCount-1 do
   dirstr:=dirstr+(FormPeach.StringGridAddressAllFolders.Cells[12,j])+'*';
dirstr:=lowercase(dirstr);
FormPeach.StringGridAddressAllFolders.RowCount:=rc+1024;
sprev:='';
offs:=1;
if nfolders<2048 then offsize:=1024
else
   if nfolders<8192 then offsize:=2048
   else offsize:=3072;//for larger archives in terms of number of dirs, restart search from larger distance from the previous match, the cost for a wider window can become more beneficial for performances
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   begin
   s:=FormPeach.StringGridList.Cells[12,i];
   spath:=dirExtractFilePath(s);
   if spath<>sprev then //filter is less efficient (slower search) if files are not ordered by name; files are ordered in zip, not ordered in 7z and mgotypeRAR if sort by extension option is used in creating the archive
      repeat
      s:=dirExtractFilePath(s);
      if (s<>'') and (s<>'/') and (s<>'\') and (s<>DirectorySeparator)
      //and (s<>DirectorySeparator+DirectorySeparator disabling this condition allows browsing absolute paths items in archives starting with \\ e.g. Windows network drives
      then
         begin
         if (s[length(s)]='/') or (s[length(s)]='\') or (s[length(s)]=DirectorySeparator) then
            setlength(s, length(s)-1);
         slowc:=lowercase(s);
         offs1:=offs-offsize;//search shortly before previous match speeds up recursive search of parent paths, especially in ordered archives
         if offs1<0 then offs1:=1;
         offs:=posex('*'+slowc+'*',dirstr,offs1);//search from previous match speeds up search especially in not ordered archives
         if offs<>0 then break
         else
            begin
            if offs1<>1 then offs:=posex('*'+slowc+'*',dirstr,1);//tested possible optimizations with inlining, and custom posex function stopping at required offset, but improvements are minimal
            if offs<>0 then break
            else
               begin
               offs:=1;
               h_folders:=true;
               if (nfolders>searchsizefolders) and (prebrowse>0) then break;
               if rc2>1024 then
                  if rc2>=FormPeach.StringGridAddressOmittedFolders.RowCount then
                     begin
                     FormPeach.StringGridAddressAllFolders.RowCount:=rc+1024;
                     FormPeach.StringGridAddressOmittedFolders.RowCount:=rc2+1024;
                     end;
               FormPeach.StringGridAddressAllFolders.Cells[1,rc]:=dirextractfilename(s);
               FormPeach.StringGridAddressAllFolders.Cells[2,rc]:=txt_list_isfolder;
               FormPeach.StringGridAddressAllFolders.Cells[12,rc]:=s;
               dirstr:=dirstr+slowc+'*';
               FormPeach.StringGridAddressAllFolders.Cells[13,rc]:=prefixd+smartsortable(dirextractfilename(s));
               FormPeach.StringGridAddressAllFolders.Cells[3,rc]:='0';
               FormPeach.StringGridAddressAllFolders.Cells[14,rc]:='110';
               FormPeach.StringGridAddressAllFolders.Cells[4,rc]:='0';
               FormPeach.StringGridAddressAllFolders.Cells[15,rc]:='110';
               FormPeach.StringGridAddressAllFolders.Cells[10,rc]:='D';
               FormPeach.StringGridAddressAllFolders.Cells[16,rc]:='0';
               FormPeach.StringGridAddressOmittedFolders.Rows[rc2].Assign(FormPeach.StringGridAddressAllFolders.Rows[rc]);
               nfolders:=nfolders+1;
               rc:=rc+1;
               rc2:=rc2+1;
               end;
            end;
         end
      else
         begin
         if (s<>'') then specbrowse:=FormPeach.StringGridAddressAllFolders.Cells[12,rc-1];
         end;
      until (s='') or (s='\') or (s='/') or (s=DirectorySeparator);// or (s=DirectorySeparator+DirectorySeparator);
   sprev:=spath;
   if i and ((16*1024)-1) = 0 then Application.ProcessMessages;
   end;
dirstr:='';
findaltroot;
end;

if (prebrowsed=false) and (FormPeach.StringGridList.RowCount>1) then //alternative quick pre-parsing routine, resolving common issues in TOC of archives
begin
s:=FormPeach.StringGridList.Cells[12,1];
repeat
s:=dirExtractFilePath(s);
if (s<>'') and (s<>'/') and (s<>'\') and (s<>DirectorySeparator)
//and (s<>DirectorySeparator+DirectorySeparator disabling this condition allows browsing absolute paths items in archives starting with \\ e.g. Windows network drives
then
   begin
   if (s[length(s)]='/') or (s[length(s)]='\') or (s[length(s)]=DirectorySeparator) then setlength(s, length(s)-1);
   h_folders:=true;
   FormPeach.StringGridAddressAllFolders.RowCount:=rc+1;
   FormPeach.StringGridAddressOmittedFolders.RowCount:=rc2+1;
   FormPeach.StringGridAddressAllFolders.Cells[1,rc]:=dirextractfilename(s);
   FormPeach.StringGridAddressAllFolders.Cells[2,rc]:=txt_list_isfolder;
   FormPeach.StringGridAddressAllFolders.Cells[12,rc]:=s;
   dirstr:=dirstr+slowc+'*';
   FormPeach.StringGridAddressAllFolders.Cells[13,rc]:=prefixd+smartsortable(dirextractfilename(s));
   FormPeach.StringGridAddressAllFolders.Cells[3,rc]:='0';
   FormPeach.StringGridAddressAllFolders.Cells[14,rc]:='110';
   FormPeach.StringGridAddressAllFolders.Cells[4,rc]:='0';
   FormPeach.StringGridAddressAllFolders.Cells[15,rc]:='110';
   FormPeach.StringGridAddressAllFolders.Cells[10,rc]:='D';
   FormPeach.StringGridAddressAllFolders.Cells[16,rc]:='0';
   FormPeach.StringGridAddressOmittedFolders.Rows[rc2].Assign(FormPeach.StringGridAddressAllFolders.Rows[rc]);
   nfolders:=nfolders+1;
   rc:=rc+1;
   rc2:=rc2+1;
   end;
until (s='') or (s='\') or (s='/') or (s=DirectorySeparator);// or (s=DirectorySeparator+DirectorySeparator);
findaltroot;
end;

FormPeach.StringGridAddressAllFolders.RowCount:=rc;
FormPeach.StringGridAddressOmittedFolders.RowCount:=rc2;
//limit folder content calculation to reasonable workload depending on the browser optimization level (even in always preparse mode)
case prebrowse of
   0,1: fwrk := 4*1024*1024;
   2: fwrk := 2*1024*1024;
   3,4,5: fwrk := 1*1024*1024;
   end;

if (FormPeach.StringGridList.RowCount * nfolders)<fwrk then //workload by number of items multiplied by number of dirs
   displayfoldercontent:=1
else
   displayfoldercontent:=0;

if displayfoldercontent=1 then
begin
FormPeach.StringGridAddressAllFoldersContent.BeginUpdate;
FormPeach.StringGridAddressAllFoldersContent.Clear;
FormPeach.StringGridAddressAllFoldersContent.RowCount:=FormPeach.StringGridAddressAllFolders.RowCount;

//for i:=0 to FormPeach.StringGridAddressAllFolders.RowCount-1 do FormPeach.StringGridAddressAllFoldersContent.Rows[i].Assign(FormPeach.StringGridAddressAllFolders.Rows[i]);
FormPeach.StringGridAddressAllFoldersContent.Assign(FormPeach.StringGridAddressAllFolders);

for i:=1 to FormPeach.StringGridAddressAllFoldersContent.RowCount-1 do
   begin
   dc:=0;
   dc2:=0;
   tsize:=0;
   tcsize:=0;
   rc:=FormPeach.StringGridList.RowCount-1;
   st:=FormPeach.StringGridAddressAllFoldersContent.Cells[12,i]+directoryseparator;
   for j:=1 to rc do
      if posex(st,FormPeach.StringGridList.Cells[12,j],1)=1 then
         begin
         if FormPeach.StringGridList.Cells[2,j] =txt_list_isfolder then
            dc:=dc+1
         else
            dc2:=dc2+1;
         try tsize:=tsize+strtoqword(FormPeach.StringGridList.Cells[3,j]); except end;
         try tcsize:=tcsize+strtoqword(FormPeach.StringGridList.Cells[4,j]); except end;
         end;
   rc:=FormPeach.StringGridAddressOmittedFolders.RowCount-1;
   for j:=1 to rc do
      if posex(st,FormPeach.StringGridAddressOmittedFolders.Cells[12,j],1)=1 then
         dc:=dc+1;
   FormPeach.StringGridAddressAllFoldersContent.Cells[3,i]:=inttostr(tsize);
   FormPeach.StringGridAddressAllFoldersContent.Cells[4,i]:=inttostr(tcsize);
   FormPeach.StringGridAddressAllFoldersContent.Cells[11,i]:=inttostr(dc)+' '+txt_dirs+' '+inttostr(dc2)+' '+txt_files;
   if length(FormPeach.StringGridAddressAllFoldersContent.Cells[11,i])>1 then
      if FormPeach.StringGridAddressAllFoldersContent.Cells[11,i][length(FormPeach.StringGridAddressAllFoldersContent.Cells[11,i])]=',' then
         FormPeach.StringGridAddressAllFoldersContent.Cells[11,i]:=copy(FormPeach.StringGridAddressAllFoldersContent.Cells[11,i],1,length(FormPeach.StringGridAddressAllFoldersContent.Cells[11,i])-1);
   end;
FormPeach.StringGridAddressAllFoldersContent.EndUpdate;
end;

FormPeach.StringGridAddressAllFolders.EndUpdate;
FormPeach.StringGridAddressOmittedFolders.EndUpdate;
end;

procedure list_l(mode:ansistring); //pre-parse and special formats through 7z
var
   i,k,nfiles,nfolders:integer;
   size,csize,rsize:qword;
   s,s1,cmethod,sl,dirstr:ansistring;
begin
FormPeach.StringGridList.BeginUpdate;
if mode='silent' then
   begin
   FormPeach.PanelProgress.Width:=FormPeach.Width*25 div 100;
   pperc:=25;
   FormPeach.LabelStatusdisplayed.Caption:=txt_8_9_parsing+' 1/3';
   application.ProcessMessages;
   end;
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
nitems:=0;
if (mode='browse') or (mode='flat') then
   begin
   FormPeach.StringGridList.RowCount:=FormPeach.MemoList.Lines.Count-title_lines_7z-1+(3-NDLINES);
   for i:=title_lines_7z to FormPeach.MemoList.Lines.Count-NDLINES do
      begin
      if FormPeach.MemoList.Lines[i]=ZSTRINGL then break;
      k:=i-title_lines_7z+1;
      s1:=copy(FormPeach.MemoList.Lines[i],21,5);
      FormPeach.StringGridList.Cells[10,k]:=s1;
      if (s1<>'     ') and (s1<>'') then
      begin
      s:=copy(FormPeach.MemoList.Lines[i],54,length(FormPeach.MemoList.Lines[i])-53);
      tempcharcodefix(s);
      FormPeach.StringGridList.Cells[1,k]:=extractfilename(s);
      FormPeach.StringGridList.Cells[12,k]:=s;
      if s1[1]='D' then
         begin
         FormPeach.StringGridList.Cells[2,k]:=txt_list_isfolder;
         FormPeach.StringGridList.Cells[13,k]:=prefixd+smartsortable(FormPeach.StringGridList.Cells[1,k]);
         nfolders:=nfolders+1;
         end
      else
         begin
         FormPeach.StringGridList.Cells[2,k]:=extractfileext(s);
         FormPeach.StringGridList.Cells[13,k]:=prefixf+smartsortable(FormPeach.StringGridList.Cells[1,k]);
         nfiles:=nfiles+1;
         end;
      FormPeach.StringGridList.Cells[3,k]:=trimleft(copy(FormPeach.MemoList.Lines[i],27,12));
      try size:=size+strtoqword(FormPeach.StringGridList.Cells[3,k]); except end;
      FormPeach.StringGridList.Cells[14,k]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,k]))))+inttostr(length(FormPeach.StringGridList.Cells[3,k]))+FormPeach.StringGridList.Cells[3,k];
      FormPeach.StringGridList.Cells[4,k]:=trimleft(copy(FormPeach.MemoList.Lines[i],40,12));
      try csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,k]); except end;
      FormPeach.StringGridList.Cells[15,k]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,k]))))+inttostr(length(FormPeach.StringGridList.Cells[4,k]))+FormPeach.StringGridList.Cells[4,k];
      FormPeach.StringGridList.Cells[5,k]:=copy(FormPeach.MemoList.Lines[i],1,19);
      FormPeach.StringGridList.Cells[16,k]:='0';
      end;
      if i and ((16*1024)-1) = 0 then Application.ProcessMessages;
      end;
   end;

if (mode='silent') then //optimized for pre-parsing
   begin
   dirstr:='';
   FormPeach.StringGridList.RowCount:=FormPeach.MemoList.Lines.Count-title_lines_7z-1+(3-NDLINES);
   for i:=title_lines_7z to FormPeach.MemoList.Lines.Count-NDLINES do
      begin
      if FormPeach.MemoList.Lines[i]=ZSTRINGL then break;
      k:=i-title_lines_7z+1;
      s1:=copy(FormPeach.MemoList.Lines[i],21,5);
      FormPeach.StringGridList.Cells[10,k]:=s1;
      if (s1<>'     ') and (s1<>'') then
      begin
      s:=copy(FormPeach.MemoList.Lines[i],54,length(FormPeach.MemoList.Lines[i])-53);
      tempcharcodefix(s);
      //FormPeach.StringGridList.Cells[1,k]:=extractfilename(s);//unused in silent mode
      FormPeach.StringGridList.Cells[12,k]:=s;
      if s1[1]='D' then
         begin
         FormPeach.StringGridList.Cells[2,k]:=txt_list_isfolder;
         nfolders:=nfolders+1;
         end
      else
         begin
         //FormPeach.StringGridList.Cells[2,k]:=extractfileext(s);//unused in silent mode
         nfiles:=nfiles+1;
         end;
      FormPeach.StringGridList.Cells[3,k]:=trimleft(copy(FormPeach.MemoList.Lines[i],27,12));
      try size:=size+strtoqword(FormPeach.StringGridList.Cells[3,k]); except end;
      FormPeach.StringGridList.Cells[4,k]:=trimleft(copy(FormPeach.MemoList.Lines[i],40,12));
      try csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,k]); except end;
      end;
      if i and ((16*1024)-1) = 0 then Application.ProcessMessages;
      end;
   dirstr:='';
   end;

if (mode='browse') or (mode='flat') then
   if FormPeach.StringGridList.RowCount>1 then
      begin
      //FormPeach.StringGridList.SortColRow(true,listsortcol);
      sort_az_stringgridlist_special(listsortcol);
      end;

if mode='silent' then
   begin
   FormPeach.PanelProgress.Width:=FormPeach.Width*50 div 100;
   pperc:=50;
   FormPeach.LabelStatusdisplayed.Caption:=txt_8_9_parsing+' 2/3';
   application.ProcessMessages;
   end;

if mode='silent' then scan_omitted_dirs(nfolders);

if mode='silent' then
   begin
   FormPeach.PanelProgress.Width:=FormPeach.Width*65 div 100;
   pperc:=65;
   FormPeach.LabelStatusdisplayed.Caption:=txt_8_9_parsing+' 3/3';
   application.ProcessMessages;
   end;

cmethod:=lcmethod;
if cmethod<>'' then status1:=cmethod+' | '
else status1:='';
nitems:=nfiles+nfolders;

status1:=status1+inttostr(nfolders)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase)+' > '+nicenumber(inttostr(csize),filesizebase);

rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
except
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';

if FormPeach.StringGridList.RowCount<2 then FormPeach.StringGridList.RowCount:=2;

if (mode='silent') then
   begin
   FormPeach.StringGridArchive.BeginUpdate;
   //performance critical, in pre-parse stage, for very large number of items in archive (in the range of 100Ks)
   //FormPeach.StringGridArchive.Assign(FormPeach.StringGridList); //slower, only column 12 (full qualified name) is used, plus column 0 (selection status) which is later alimented on demand
   FormPeach.StringGridArchive.RowCount:=FormPeach.StringGridList.RowCount+FormPeach.StringGridAddressOmittedFolders.RowCount-1;
   for i:=1 to FormPeach.StringGridList.RowCount-1 do FormPeach.StringGridArchive.Cells[12,i]:=FormPeach.StringGridList.Cells[12,i];
   for i:=1 to FormPeach.StringGridAddressOmittedFolders.Rowcount-1 do FormPeach.StringGridArchive.Cells[12,FormPeach.StringGridList.Rowcount+i-1]:=FormPeach.StringGridAddressOmittedFolders.Cells[12,i];
   FormPeach.StringGridArchive.EndUpdate;
   end;

FormPeach.StringGridList.EndUpdate;
end;

procedure list_slt(mode:ansistring);
var
   i,j,k,nfiles,nfolders,ll,w:integer;
   size,csize,rsize:qword;
   s1,s2,s3,s,sl,dirstr:ansistring;
   stopped_prebrowse:boolean;
begin
i:=title_lines_7z-2;
k:=FormPeach.MemoList.Lines.Count;
nomatch:=false;
if k<=i then begin FormPeach.StringGridList.RowCount:=2; nomatch:=true; exit; end;
j:=1;
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
dirstr:='*';
rootdirrecord:=0;
stopped_prebrowse:=false;
FormPeach.StringGridList.RowCount:=1;
status0:=txt_list_searching;
status1:=txt_please_wait;
FormPeach.StringGridList.BeginUpdate;
if k<4*1024*1024 then ll:=(k div 8) else ll:=512*1024; //0.5 M files
FormPeach.StringGridList.RowCount:=ll;
repeat
   if j<ll then
   else
      if j>=FormPeach.StringGridList.RowCount then FormPeach.StringGridList.RowCount:=j+32*1024;
   repeat
      s1:=FormPeach.MemoList.Lines[i];
      {$IFNDEF MSWINDOWS}
      if lowercase(s1)='open error: can not open the file as [7z] archive' then
         begin
         FormPeach.StringGridList.RowCount:=2;
         FormPeach.StringGridList.Cells[1,1]:='';
         status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
         nomatch:=true;
         exit;
         end;
      {$ENDIF}
      s2:=identify_field(s1);
      case s2 of
         'Path':
         begin
         s3:=copy(s1,8,length(s1)-7);
         tempcharcodefix(s3);
         FormPeach.StringGridList.Cells[1,j]:=dirExtractFileName(s3);
         FormPeach.StringGridList.Cells[12,j]:=s3;
         FormPeach.StringGridList.Cells[2,j]:=extractfileext(s3);//overridden later if identified as folder
         FormPeach.StringGridList.Cells[13,j]:=prefixf+smartsortable(dirExtractFileName(s3));//overridden if identified as folder
         end;
         'Folder':
         if copy(s1,length(s1),1)=ZCHAR then
            begin
            FormPeach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            FormPeach.StringGridList.Cells[13,j]:=prefixd+smartsortable(dirExtractFileName(s3));
            end;
         'Type':
         if copy(s1,8,length(s1)-7)='directory' then
            begin
            FormPeach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            FormPeach.StringGridList.Cells[13,j]:=prefixd+smartsortable(dirExtractFileName(s3));
            end;
         'Attributes':
         begin
         FormPeach.StringGridList.Cells[10,j]:=copy(s1,14,length(s1)-13);
         if pos('D',FormPeach.StringGridList.Cells[10,j])<>0 then
            begin
            FormPeach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            FormPeach.StringGridList.Cells[13,j]:=prefixd+smartsortable(dirExtractFileName(s3));
            end;
         end;
         'Size':
         begin
         FormPeach.StringGridList.Cells[3,j]:=copy(s1,8,length(s1)-7);
         FormPeach.StringGridList.Cells[14,j]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,j]))))+inttostr(length(FormPeach.StringGridList.Cells[3,j]))+FormPeach.StringGridList.Cells[3,j];
         try
            size:=size+strtoqword(FormPeach.StringGridList.Cells[3,j]);
         except
         end;
         end;
         'Packed Size':
         begin
         FormPeach.StringGridList.Cells[4,j]:=copy(s1,15,length(s1)-14);
         FormPeach.StringGridList.Cells[15,j]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,j]))))+inttostr(length(FormPeach.StringGridList.Cells[4,j]))+FormPeach.StringGridList.Cells[4,j];
         try
            csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,j]);
         except
         end;
         end;
         'Modified': FormPeach.StringGridList.Cells[5,j]:=copy(s1,12,length(s1)-11);
         'Created': FormPeach.StringGridList.Cells[6,j]:=copy(s1,11,length(s1)-10);
         'Accessed': FormPeach.StringGridList.Cells[7,j]:=copy(s1,12,length(s1)-11);
         'CRC': FormPeach.StringGridList.Cells[11,j]:=copy(s1,7,length(s1)-6);
         'SHA-1': if FormPeach.StringGridList.Cells[11,j]='' then FormPeach.StringGridList.Cells[11,j]:=copy(s1,12,length(s1)-11);
         'Checksum': if FormPeach.StringGridList.Cells[11,j]='' then FormPeach.StringGridList.Cells[11,j]:=copy(s1,12,length(s1)-11);
         'Encrypted':
         if copy(s1,length(s1),1)=ZCHAR then
            begin
            FormPeach.StringGridList.Cells[1,j]:=dirExtractFileName(s3)+' *';
            seemencrypted:=true;
            set_pw;
            end;
         'Method':
         begin
         FormPeach.StringGridList.Cells[8,j]:=copy(s1,10,length(s1)-9);
         if pos('AES',s1)<>0 then
            begin
            FormPeach.StringGridList.Cells[1,j]:=dirExtractFileName(s3)+' *';
            seemencrypted:=true;
            set_pw;
            end;
         end;
         'Comment': FormPeach.StringGridList.Cells[9,j]:=copy(s1,11,length(s1)-10);
      end;
      i:=i+1;
      if i>=k-1 then s2:='new_record';
   until (s2='new_record');
   if FormPeach.StringGridList.Cells[1,j]<>'' then
      begin
      if FormPeach.StringGridList.Cells[2,j]<>txt_list_isfolder then nfiles:=nfiles+1
      else
         begin
         nfolders:=nfolders+1;
         if pos(directoryseparator,FormPeach.StringGridList.Cells[12,j])=0 then rootdirrecord:=1;
         end;
      FormPeach.StringGridList.Cells[16,j]:='0';
      //find duplicate dirs (some archives lists multiple entries for the same item)
      if FormPeach.StringGridList.Cells[2,j]=txt_list_isfolder then
         begin
         sl:=lowercase(FormPeach.StringGridList.Cells[12,j]);
         if posex('*'+sl+'*',dirstr,1)<>0 then //duplicate dir, overwrite record
         else //not duplicated, add to list of dirs and process next record
            begin
            j:=j+1;
            dirstr:=dirstr+sl+'*';
            end;
         end
      else j:=j+1; //file, process next record
      end
   else
      if FormPeach.StringGridList.RowCount>1 then
         begin
         FormPeach.StringGridList.RowCount:=FormPeach.StringGridList.RowCount-1;
         ll:=ll-1;
         end;
   if i and ((16*1024)-1) = 0 then Application.ProcessMessages;
until i>=k-1;
if j<1 then j:=1;
FormPeach.StringGridList.RowCount:=j;
dirstr:='';
if mode='silent' then scan_omitted_dirs(nfolders);

if displayfoldercontent=1 then
begin
if h_folders=false then
for i:=1 to FormPeach.StringGridList.RowCount-1 do
  if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then
     begin
     for j:=1 to FormPeach.StringGridAddressAllFoldersContent.RowCount-1 do
       if FormPeach.StringGridAddressAllFoldersContent.Cells[12,j]<>FormPeach.StringGridList.Cells[12,i] then
       else
          begin
          FormPeach.StringGridList.Cells[3,i]:=FormPeach.StringGridAddressAllFoldersContent.Cells[3,j];
          FormPeach.StringGridList.Cells[4,i]:=FormPeach.StringGridAddressAllFoldersContent.Cells[4,j];
          FormPeach.StringGridList.Cells[11,i]:=FormPeach.StringGridAddressAllFoldersContent.Cells[11,j];
          size:=size+strtoqword(FormPeach.StringGridList.Cells[3,i]);
          csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,i]);
          FormPeach.StringGridList.Cells[14,i]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,i]))))+inttostr(length(FormPeach.StringGridList.Cells[3,i]))+FormPeach.StringGridList.Cells[3,i];
          FormPeach.StringGridList.Cells[15,i]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,i]))))+inttostr(length(FormPeach.StringGridList.Cells[4,i]))+FormPeach.StringGridList.Cells[4,i];
          end;
     end;
end;

if stopped_prebrowse=true then
   begin
   j:=0;
   size:=0;
   csize:=0;
   if FormPeach.StringGridList.RowCount>1 then
      FormPeach.StringGridList.RowCount:=FormPeach.StringGridList.RowCount-1;
   end
else
   begin
   status1:=inttostr(nfolders)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase)+' > '+nicenumber(inttostr(csize),filesizebase);
   end;
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
except
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';

status0:=txt_list_sorting;
if FormPeach.StringGridList.RowCount<2 then FormPeach.StringGridList.RowCount:=2;
if FormPeach.visible=true then Application.Processmessages;
if (mode='browse') or (mode='flat') then
   begin
   //if FormPeach.StringGridList.RowCount>1 then FormPeach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   end;

if (mode='silent') then //unused, silent mode is only used in list_l
   begin
   end;

if tvol>1 then status1:=inttostr(tvol)+' '+txt_8_1_volumes+' | '+status1;
FormPeach.StringGridList.EndUpdate(true);
end;

procedure list_rar5(mode:ansistring);
var
   i,j,k,nfiles,nfolders,ipos:integer;
   size,csize,rsize:qword;
   s1,s2,s3,rar5str:ansistring;
   stopped_prebrowse:boolean;
begin
i:=title_lines_7z-2;
k:=FormPeach.MemoList.Lines.Count;
if k<=i then begin FormPeach.StringGridList.RowCount:=2; exit; end;
j:=1;
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
rootdirrecord:=0;
stopped_prebrowse:=false;
FormPeach.StringGridList.RowCount:=1;
status0:=txt_list_searching;
status1:=txt_please_wait;
FormPeach.StringGridList.BeginUpdate;
FormPeach.StringGridList.RowCount:=512*1024; //optimized for up to 0.5 M files;
repeat
   if j<524288 then
   else
      FormPeach.StringGridList.RowCount:=FormPeach.StringGridList.RowCount+1;
   repeat
      s1:=FormPeach.MemoList.Lines[i];
      s2:=identify_field_rar5(s1,ipos);
      if (s1<>'') and (s2<>'new_record') then rar5str:=copy(s1,ipos+2,length(s1)-ipos-1);
      case s2 of
         'Name':
         begin
         s3:=rar5str;
         tempcharcodefix(s3);
         FormPeach.StringGridList.Cells[1,j]:=extractfilename(s3);
         FormPeach.StringGridList.Cells[2,j]:=extractfileext(s3);//overridden if "Folder" parameter is provided
         FormPeach.StringGridList.Cells[12,j]:=s3;
         end;
         'Type':
         if rar5str='Directory' then
            begin
            FormPeach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            FormPeach.StringGridList.Cells[13,j]:=prefixd+smartsortable(extractfilename(s3));
            end
         else
            begin
            FormPeach.StringGridList.Cells[2,j]:=extractfileext(s3);
            FormPeach.StringGridList.Cells[13,j]:=prefixf+smartsortable(extractfilename(s3));
            end;
         'Size':
         begin
         FormPeach.StringGridList.Cells[3,j]:=rar5str;
         FormPeach.StringGridList.Cells[14,j]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,j]))))+inttostr(length(FormPeach.StringGridList.Cells[3,j]))+FormPeach.StringGridList.Cells[3,j];
         try
            size:=size+strtoqword(FormPeach.StringGridList.Cells[3,j]);
         except
         end;
         end;
         'Packed size':
         begin
         FormPeach.StringGridList.Cells[4,j]:=rar5str;
         FormPeach.StringGridList.Cells[15,j]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,j]))))+inttostr(length(FormPeach.StringGridList.Cells[4,j]))+FormPeach.StringGridList.Cells[4,j];
         try
            csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,j]);
         except
         end;
         end;
         'mtime': FormPeach.StringGridList.Cells[5,j]:=rar5str;
         'CRC32 MAC': FormPeach.StringGridList.Cells[11,j]:=rar5str;
         'Attributes':
         begin
         FormPeach.StringGridList.Cells[10,j]:=rar5str;
         if pos('D',FormPeach.StringGridList.Cells[10,j])<>0 then
            begin
            FormPeach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            FormPeach.StringGridList.Cells[13,j]:=prefixd+smartsortable(extractfilename(s3));
            end
         else
            begin
            FormPeach.StringGridList.Cells[2,j]:=extractfileext(s3);
            FormPeach.StringGridList.Cells[13,j]:=prefixf+smartsortable(extractfilename(s3));
            end;
         end;
         'Flags':
         if pos('encrypted',rar5str)<>0 then
            begin
            FormPeach.StringGridList.Cells[1,j]:=extractfilename(s3)+' *';
            seemencrypted:=true;
            set_pw;
            end;
      end;
      i:=i+1;
      if i>=k-1 then s2:='new_record';
   until (s2='new_record');
   if FormPeach.StringGridList.Cells[1,j]<>'' then
      begin
      if FormPeach.StringGridList.Cells[2,j]<>txt_list_isfolder then nfiles:=nfiles+1
      else
         begin
         nfolders:=nfolders+1;
         if pos(directoryseparator,FormPeach.StringGridList.Cells[12,j])=0 then rootdirrecord:=1;
         end;
      FormPeach.StringGridList.Cells[16,j]:='0';
      j:=j+1;
      end
   else
      if FormPeach.StringGridList.RowCount>1 then
         FormPeach.StringGridList.RowCount:=FormPeach.StringGridList.RowCount-1;
   if FormPeach.Visible=true then Application.ProcessMessages;
until i>=k-1;
if j<1 then j:=1;
FormPeach.StringGridList.RowCount:=j;
j:=j-1;
if stopped_prebrowse=true then
   begin
   j:=0;
   size:=0;
   csize:=0;
   if FormPeach.StringGridList.RowCount>1 then
      FormPeach.StringGridList.RowCount:=FormPeach.StringGridList.RowCount-1;
   end
else status1:=inttostr(nfolders)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase)+' > '+nicenumber(inttostr(csize),filesizebase);
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
except
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';
status0:=txt_list_sorting;
if FormPeach.StringGridList.RowCount<2 then FormPeach.StringGridList.RowCount:=2;
if FormPeach.visible=true then Application.Processmessages;
if (mode='browse') or (mode='flat') then
   begin
   //if FormPeach.StringGridList.RowCount>1 then FormPeach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   end;
FormPeach.StringGridList.EndUpdate(true);
end;

function listun7z_do(mode:ansistring):integer;
var
   cl,in_param,bin_name,exe_name,pw,mcu_option:ansistring;
begin
result:=-1;
in_param:=stringdelim(escapefilename((FormPeach.EditOpenIn.Text),desk_env));
if fun='UN7Z' then exe_name:=alias7z;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+exe_name+EXEEXT);
if sys7zlin>0 then bin_name:=exe_name+EXEEXT;
pw:=FormPW.EditPWpass.Text;
if FormPW.EditPWkeyfile.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
      begin
      pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
      exit;
      end;
pipepw:='';
piperar:=false;
if pw<>'' then
   begin
   pipepw:=pw;
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      exit;
      end;
   end
else
   begin
   pw:='-pdefault';
   pipepw:='default';
   end;
cl:=bin_name+' l';
{$IFDEF MSWINDOWS}
case enc7zscc of
   0: cl:=cl+' -sccUTF-8';
   1: cl:=cl+' -sccWIN';
   2: cl:=cl+' -sccDOS';
   end;
{$ENDIF}
if (upcase(extractfileext(FormPeach.EditOpenIn.Text))='.ZIP') or (upcase(extractfileext(FormPeach.EditOpenIn.Text))='.ZIPX') then
   case mcuzip of
      0: mcu_option:='';
      1: mcu_option:='-mcu=on';
      2: mcu_option:='-mcl=on';
      3: if FormPeach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+FormPeach.EditEncoding.Caption;
   end;
if mcu_option<>'' then cl:=cl+' '+mcu_option;
if fun='UN7Z' then
   begin
   browse_special_cases;
   if browse_option='slt' then cl:=cl+' -slt';
   end;
cl:=cl+' -bb0 -bse0 -bsp0';
case syntaxstring7z of
'23','21','17','16': begin end;
else if tsutc=1 then cl:=cl+' -slmu';
end;
//if (pipepw<>'') then else cl:=cl+' '+pw; //pw is never blank in this mode, and pipepw too
cl:=cl+' '+in_param;
//filter(s)
if (FormAdvf.CheckBoxAdvFilters.State=cbChecked) and (filterbrowser=1) then //use advanced filters, ignore basic filters
   adv_filters(cl)
else //use basic filters (from browser)
   basic_filters(cl);
if FormPeach.EditUn7zaFilter.Text<>'*' then funflag:=false else funflag:=true;
result:=execute_cl(cl,mode);
end;

function list_unrar5_do(mode:ansistring):integer;
var
   cl,in_param,bin_name,exe_name,pw:ansistring;
begin
result:=-1;
in_param:=stringdelim(escapefilename(FormPeach.EditOpenIn.Text,desk_env));
if fun='UN7Z' then exe_name:=UNRARNAME;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unrar'+DirectorySeparator+exe_name+EXEEXT);
if sys7zlin>1 then bin_name:=exe_name+EXEEXT;
pw:=FormPW.EditPWpass.Text;
if FormPW.EditPWkeyfile.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
      begin
      pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
      exit;
      end;
if pw<>'' then
   begin
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      exit;
      end;
   end
else pw:='-p-';
cl:=bin_name+' lt';
browse_option:='rar5';
cl:=cl+' '+pw+' '+in_param;
//filter(s)
if FormAdvf.CheckBoxAdvFilters.State=cbChecked then //use advanced filters, ignore basic filters
   adv_filters_rar5(cl)
else //use basic filters (from browser)
   basic_filters_rar5(cl);
if FormPeach.EditUn7zaFilter.Text<>'*' then funflag:=false else funflag:=true;
result:=execute_cl(cl,mode);
end;

procedure reportnotsupported_info(sfo:ansistring);
var
   s:ansistring;
begin
case libre_directive of
   1: s:=sfo+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_fsr+' = 1'+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_l1;
   2: s:=sfo+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_fsr+' = 2'+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_l1+char($0D)+char($0A)+txt_5_8_l2;
   end;
pMessageInfoOK(s);
end;

procedure reportnotsupported(sfo:ansistring);
var
   s:ansistring;
begin
if restartingapp=true then exit;
restartingapp:=true;
case libre_directive of
   1: s:=sfo+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_fsr+' = 1'+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_l1;
   2: s:=sfo+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_fsr+' = 2'+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_8_l1+char($0D)+char($0A)+txt_5_8_l2;
   end;
pMessageInfoOK(s);
FormPeach.Visible:=false;
saverestartclosepeaapp;
end;

function testifrar5(s:ansistring):integer; //test RAR5 special case
var
   ext:ansistring;
   f_in:file of byte;
   sbuf:array [1..8] of byte;
   numread:integer;
begin
result:=0;
if use7zunrar5<>0 then exit;//requires 7z / p7zip 15.06
//libre_directive level 1 and 2: disallow calls for non-free software (if unrar5 format is detected, the directive will not allow to use unrar binary)
if libre_directive>0 then begin reportnotsupported_info('RAR'); exit; end;
ext:=extractfileext(s);
if upcase(ext)='.RAR' then
   try
   assignfile(f_in,s);
   filemode:=0;
   reset(f_in);
   try
   blockread (f_in,sbuf,8,numread);
   except
   close(f_in);
   exit;
   end;
   if sbuf[7]=$01 then result:=1;
   close(f_in);
   except
      try close(f_in); except end;
   end;
if result=1 then
   if fileexists(binpath+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT) then
   else
   begin
   result:=0;
   if unrar5shown=false then
      begin
      pMessageInfoOK('PeaZip UNRAR5 '+txt_5_7_plugin);
      unrar5shown:=true;
      end;
   end;
end;

function testifrar(s:ansistring):integer; //test mgotypeRAR
var
   ext:ansistring;
begin
result:=0;
ext:=extractfileext(s);
if upcase(ext)='.RAR' then result:=1;
end;

function list_un7z(mode:ansistring):integer;
begin
result:=-1;
if libre_directive=2 then if testifrar(FormPeach.EditOpenIn.Text)=1 then reportnotsupported('RAR');
if libre_directive=1 then listun7z_do(mode)
else
   if testifrar5(FormPeach.EditOpenIn.Text)=1 then list_unrar5_do(mode)
   else result:=listun7z_do(mode);
generate_archive_breadcrumb;
end;

procedure filter_archivecontent;
var
   i,j,nfolders,nfiles,rc:integer;
   size,csize,rsize:qword;
   sfilter,sfilterf,stemp,stempf,tstr:ansistring;
begin
savecol;
if FormPeach.PanelProgress.Visible=true then
   begin
   FormPeach.PanelProgress.Width:=FormPeach.Width*85 div 100;
   pperc:=85;
   FormPeach.LabelStatusdisplayed.Caption:=txt_8_9_disp+' 1/2';
   application.ProcessMessages;
   end;

if h_folders=true then dolistupdate:=false;
if status0=txt_list_browsing then list_un7z('browse')
else list_un7z('flat');
dolistupdate:=true;

if (length(FormPeach.EditUn7zaFilter.Text)>2) and (FormPeach.cbtree.ItemIndex>0) then
   begin
   tstr:=copy(FormPeach.EditUn7zaFilter.Text,1,length(FormPeach.EditUn7zaFilter.Text)-2);
   if tstr<>DirectorySeparator then
   if FormPeach.StringGridAddressAllFolders.RowCount>maxndirtree then
   else
      begin
      FormPeach.TreeViewNav.Items.BeginUpdate;
      for i:=1 to FormPeach.StringGridAddressAllFolders.RowCount-1 do
      if FormPeach.StringGridAddressAllFolders.Cells[12,i]=tstr then
         begin
         if FormPeach.cbtree.ItemIndex=1 then
            begin
            FormPeach.TreeViewNav.Selected:=FormPeach.TreeViewNav.Items[0];
            FormPeach.TreeViewNav.Selected.Collapse(true);
            end;
         if i<FormPeach.TreeViewNav.Items.Count then
            begin
            FormPeach.TreeViewNav.Selected:=FormPeach.TreeViewNav.Items[i];
            selnode:=i;
            end
         else
            begin
            FormPeach.TreeViewNav.Selected:=FormPeach.TreeViewNav.Items[0];
            selnode:=0;
            end;
         break;
         end;
      FormPeach.TreeViewNav.Items.EndUpdate;
      end;
   end;

if h_folders=true then
begin

FormPeach.ListViewBrowser.Items.BeginUpdate;
FormPeach.StringGridList.BeginUpdate;
FormPeach.StringGridAddressOmittedFolders.BeginUpdate;
FormPeach.ListViewBrowser.Cursor:=crHourglass;
rc:=FormPeach.StringGridList.RowCount;
if nomatch=true then
   begin
   FormPeach.StringGridList.RowCount:=FormPeach.StringGridAddressOmittedFolders.RowCount;
   rc:=1;
   //for i:=1 to FormPeach.StringGridAddressOmittedFolders.RowCount-1 do FormPeach.StringGridList.Rows[i].Assign(FormPeach.StringGridAddressOmittedFolders.Rows[i]);
   FormPeach.StringGridList.Assign(FormPeach.StringGridAddressOmittedFolders);
   end
else
   begin
   FormPeach.StringGridList.RowCount:=rc+FormPeach.StringGridAddressOmittedFolders.RowCount;
   for i:=1 to FormPeach.StringGridAddressOmittedFolders.RowCount-1 do FormPeach.StringGridList.Rows[rc+i].Assign(FormPeach.StringGridAddressOmittedFolders.Rows[i]);
   end;
FormPeach.StringGridAddressOmittedFolders.EndUpdate;

if is_searching=false then
begin
if FormPeach.EditUn7zaFilter.Text<>'' then sfilter:=lowercase(copy(FormPeach.EditUn7zaFilter.Text,1,length(FormPeach.EditUn7zaFilter.Text)-1));
if sfilter<>'' then
begin
i:=rc-1;
while i<(FormPeach.StringGridList.RowCount-1) do
   begin
   sfilterf:=lowercase(FormPeach.StringGridList.Cells[12,i+1]);
   {$IFDEF MSWINDOWS}
   if pos('/', sfilter)<>0 then
      begin
      sfilter:=StringReplace(sfilter,'\','/',[rfReplaceAll]);
      sfilterf:=StringReplace(sfilterf,'\','/',[rfReplaceAll]);
      end;
   {$ENDIF}
   if pos(sfilter,sfilterf)=1 then i:=i+1
   else
      begin
      FormPeach.StringGridList.DeleteRow(i+1);
      end;
   end;
end;
end
else //search
begin
if FormPeach.EditUn7zaFilter.Text<>'' then
begin
i:=rc-1;
while i<(FormPeach.StringGridList.RowCount-1) do
   begin
   stemp:=FormPeach.StringGridList.Cells[12,i+1];
   stempf:=FormPeach.EditUn7zaFilter.Text;
   if not(MatchesMask(stemp,stempf,false)) then FormPeach.StringGridList.DeleteRow(i+1)
   else i:=i+1;
   end;
end;
end;
is_searching:=false;

if FormPeach.EditUn7zaFilterExclude.Text<>'' then
begin
i:=rc-1;
while i<(FormPeach.StringGridList.RowCount-1) do
   begin
   stemp:=FormPeach.StringGridList.Cells[12,i+1];
   if pos('\\', stemp)=1 then stemp:=copy(stemp,3,length(stemp)-2);
   stempf:=FormPeach.EditUn7zaFilterExclude.Text;
   if pos('\\', stempf)=1 then stempf:=copy(stempf,3,length(stempf)-2);
   {$IFDEF MSWINDOWS}
   if pos('/', stemp)<>0 then
      begin
      if pos('/', stemp)=1 then stemp:=copy(stemp,2,length(stemp)-1);
      if pos('/', stempf)=1 then stempf:=copy(stempf,2,length(stemp)-1);
      stemp:=StringReplace(stemp,'\','/',[rfReplaceAll]);
      stempf:=StringReplace(stempf,'\','/',[rfReplaceAll]);
      end;
   {$ENDIF}
   if not(MatchesMask(stemp,stempf,false)) then i:=i+1
   else
      begin
      FormPeach.StringGridList.DeleteRow(i+1);
      end;
   end;
end;

set_lastobjarch;
lastobjarch:=extractfilepath(FormPeach.EditUn7zaFilter.Text);

size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;

i:=1;
repeat
  if FormPeach.StringGridList.RowCount>1 then
     if FormPeach.StringGridList.Cells[1,i]='' then FormPeach.StringGridList.DeleteRow(i)
     else
        begin
        try
        if FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder then nfiles:=nfiles+1
        else nfolders:=nfolders+1;
        try size:=size+strtoqword(FormPeach.StringGridList.Cells[3,i]); except end;
        try csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,i]); except end;
        finally
        i:=i+1;
        end;
        end;
until i>=FormPeach.StringGridList.RowCount;

status1:=inttostr(nfolders)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase)+' > '+nicenumber(inttostr(csize),filesizebase);
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
except
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';

if displayfoldercontent=1 then
begin
for i:=1 to FormPeach.StringGridList.RowCount-1 do
  if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then
     begin
     for j:=1 to FormPeach.StringGridAddressAllFoldersContent.RowCount-1 do
       if FormPeach.StringGridAddressAllFoldersContent.Cells[12,j]<>FormPeach.StringGridList.Cells[12,i] then
       else
          FormPeach.StringGridList.Cells[11,i]:=FormPeach.StringGridAddressAllFoldersContent.Cells[11,j];
     end;
end;

//if FormPeach.StringGridList.RowCount>1 then FormPeach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
update_listview;
view_lastobj;
generate_archive_breadcrumb;
FormPeach.ListViewBrowser.Cursor:=crDefault;
FormPeach.ListViewBrowser.Items.EndUpdate;
FormPeach.StringGridList.EndUpdate;
end;
end;

procedure listun7z_expandall;
begin
FormPeach.EditUn7zaFilter.Text:='*';
FormPeach.EditUn7zaFilterExclude.Text:='';
status0:=txt_list_flat;
browsingmode7z:=1;
filter_archivecontent;
addtohistory;
end;

procedure autobrowsetar;
var
   abtok:boolean;
   tsize:qword;
begin
if autoopentar=0 then exit;
if alreadytar=1 then exit;
alreadytar:=1;
if (FormPeach.StringGridList.RowCount=2) and (lowercase(FormPeach.StringGridList.Cells[2,1])='.tar') then
   begin
   abtok:=false;
   try
   tsize:=StrToQWord(FormPeach.StringGridList.Cells[4,1]);//compressed size, equal to input file size, is reported correctly by most backend
   except
   srcfilesize_multipart(FormPeach.EditOpenIn.Text,tsize);//slower, get input file size from the filesytem
   end;
   case abt of
      0: if tsize<100*1024*1024 then abtok:=true;//<100MB
      1: if tsize<1024*1024*1024 then abtok:=true;//<1GB
      2: if tsize<10*1024*1024*1024 then abtok:=true;//<10GB
      else abtok:=true;
   end;
   if abtok=true then
      begin
      FormPeach.StringGridList.Cells[16,1]:='1';
      grid_obj_open;
      end;
   end;
end;

procedure list_root;
{$IFNDEF MSWINDOWS}
var
   s:ansistring;
{$ENDIF}
begin
case fun of
'UN7Z':
   begin
   //archive already listed f6flat in pre-parse, until it is requested re-browsing it
   FormPeach.EditUn7zaFilter.Text:='*';
   FormPeach.EditUn7zaFilterExclude.Text:='*'+directoryseparator+'*';
   pspecbrowse:=specbrowse;
   if specbrowse<>'' then //special case starting with directoryseparator, browse first nested path identified in pre-browsing
      begin
      FormPeach.EditUn7zaFilter.Text:=specbrowse+'*';
      FormPeach.EditUn7zaFilterExclude.Text:=specbrowse+'*'+directoryseparator+'*';
      specbrowse:='';
      end;
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   filter_archivecontent;
   autobrowsetar;
   addtohistory;
   end;
'FILEBROWSER':
   begin
   {$IFDEF MSWINDOWS}
   listpc;
   {$ELSE}
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   addtohistory;
   end;
end;
end;

procedure list_un7z_search;
begin
FormPeach.EditUn7zaFilterExclude.Text:='';
status0:=txt_list_found;
is_searching:=true;
filter_archivecontent;
if FormAdvf.CheckBoxAdvFilters.State=cbUnChecked then addtohistory;
end;

procedure listun7z_go;
begin
status0:=txt_list_browsing;
browsingmode7z:=0;
filter_archivecontent;
addtohistory;
end;

procedure ratio_info_reduced(i,j:integer; size,csize:qword);
var cratio:qword;
begin
status0:=txt_list_flat;
if csize>0 then
try
   status1:=inttostr(i)+' '+txt_dirs+' '+inttostr(j)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase)+' > '+nicenumber(inttostr(csize),filesizebase);
   try if size<>0 then cratio:=((csize) *100) div (size); except end;
except
   status1:=txt_list_na;
   cratio:=0;
end
else
begin
try
   status1:=inttostr(i)+' '+txt_dirs+' '+inttostr(j)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase);
   cratio:=0;
except
   status1:=txt_list_na;
   cratio:=0;
end
end;
if (cratio>1) and (cratio<200) then status1:=status1+' ('+inttostr(cratio)+'%)';
end;

procedure browse_single;
var
   s:ansistring;
   f:file of byte;
   b:byte;
   size,csize:qword;
begin
FormPeach.StringGridList.RowCount:=2;
s:=extractfilename(FormPeach.OpenDialogArchive.Filename);
if (fun<>'UNCUSTOM') and (fun<>'UNPEA') then cutextension(s);
FormPeach.StringGridList.Cells[1,1]:=s;
FormPeach.StringGridList.Cells[2,1]:=extractfileext(FormPeach.StringGridList.Cells[1,1]);
size:=0;
csize:=0;
FormPeach.StringGridList.Cells[3,1]:='';
FormPeach.StringGridList.Cells[4,1]:='';
try
assignfile(f,FormPeach.EditOpenIn.Text);
filemode:=0;
reset(f);
if fun='UNQUAD' then
   begin
   size:=0;
   case LowerCase(extractfileext(FormPeach.EditOpenIn.Text)) of
   '.quad': blockread(f,size,4);
   '.bcm': size:=0;
   else
      begin
      blockread(f,b,1);
      blockread(f,size,4);
      end;
   end;
   end;
if fun='UNLPAQ' then
   begin
   blockread(f,size,4);//discarded
   size:=0;
   blockread(f,b,1);
   size:=size xor (b shl 24);
   blockread(f,b,1);
   size:=size xor (b shl 16);
   blockread(f,b,1);
   size:=size xor (b shl 8);
   blockread(f,b,1);
   size:=size xor b;
   end;
srcfilesize(FormPeach.EditOpenIn.Text,csize);
closefile(f);
except
end;
FormPeach.StringGridList.Cells[3,1]:=inttostr(size); //expressed in B
FormPeach.StringGridList.Cells[4,1]:=inttostr(csize); //expressed in B
FormPeach.StringGridList.Cells[5,1]:='';
FormPeach.StringGridList.Cells[10,1]:='';
FormPeach.StringGridList.Cells[12,1]:=s;
FormPeach.StringGridList.Cells[13,1]:='';
FormPeach.StringGridList.Cells[14,1]:='';
FormPeach.StringGridList.Cells[15,1]:='';
FormPeach.StringGridList.Cells[16,1]:='1';
if FormPeach.StringGridList.RowCount>1 then FormPeach.StringGridList.Cells[16,1]:='1';
FormPeach.StringGridList.Row:=1;
ratio_info_reduced(0,1,size,csize);
if fun='UNPEA' then
   begin
   status0:=txt_list_browsing;
   status1:=txt_list_na;
   end;
autobrowsetar;
end;

procedure open_prepare_unpea;
begin
browse_single;
addtohistory;
end;

procedure browse_paq;
var
   f:file of byte;
   b:byte;
   s:ansistring;
   i:integer;
   size,csize:qword;
   end_browse:boolean;
begin
try
assignfile(f,FormPeach.OpenDialogArchive.Filename);
filemode:=0;
reset(f);
srcfilesize(FormPeach.EditOpenIn.Text,csize);
repeat //discard PAQ file header (generic procedure to be quite adaptable to possible different models)
   blockread(f,b,1);
until b=$0a;
except
   FormPeach.StringGridList.RowCount:=1;
   pMessageWarningOK(txt_list_error);
   exit;
end;
FormPeach.StringGridList.RowCount:=1;
i:=0;
size:=0;
end_browse:=false;
repeat
   s:='';
   repeat
      blockread(f,b,1);
      if b=$1a then
         begin
         end_browse:=true;
         break;
         end;
      if (b<>$0d) then s:=s+char(b);
   until b=$0d;
   if end_browse=true then break;
   i:=i+1;
   FormPeach.StringGridList.RowCount:=FormPeach.StringGridList.RowCount+1;
   FormPeach.StringGridList.Cells[3,i]:=copy(s,1,pos(char($09),s)-1);
   FormPeach.StringGridList.Cells[14,i]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,i]))))+inttostr(length(FormPeach.StringGridList.Cells[3,i]))+FormPeach.StringGridList.Cells[3,i];
   size:=size+strtoqword(FormPeach.StringGridList.Cells[3,i]);
   FormPeach.StringGridList.Cells[12,i]:=ansitoutf8(copy(s,pos(char($09),s)+1,length(s)));
   FormPeach.StringGridList.Cells[1,i]:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
   FormPeach.StringGridList.Cells[2,i]:=extractfileext(FormPeach.StringGridList.Cells[1,i]);
   FormPeach.StringGridList.Cells[16,i]:='0';
   blockread(f,b,1);
until end_browse=true;
closefile(f);
if FormPeach.StringGridList.RowCount>1 then
   begin
   FormPeach.StringGridList.Cells[16,1]:='1';
   FormPeach.StringGridList.Row:=1;
   end;
ratio_info_reduced(0,i,size,csize);
end;

procedure browse_zpaq;
var
   s,s1,s2,s4,s5,cl,jobcode,outname,fork,sf:ansistring;
   size,csize:qword;
   i,w,j,k,psf:integer;
   zstarted,zended:boolean;
begin
//compose cl to list zpaq
compose_unzpaq_cl(cl,jobcode,outname,false,'list','all');
//execute cl
execute_cl(cl,'list');
//list content in stringgrid
size:=0;
csize:=0;
k:=0;
w:=0;
try FormPeach.StringGridList.RowCount:=FormPeach.MemoList.Lines.Count; except end;
fork:=copy(FormPeach.MemoList.Lines[0],1,9); //identify forks, supported: zpaqfranz
zstarted:=false;
zended:=false;
psf:=0;
for i:=1 to FormPeach.MemoList.Lines.Count-1 do
   begin
   s:=FormPeach.MemoList.Lines[i];
   case fork of
   'zpaqfranz':
   begin
   if s='' then
      if zstarted=true then zended:=true;
   if (zstarted=true) and (zended=false) then //valid line
      begin
      k:=k+1;
      s:=copy(FormPeach.MemoList.Lines[i],psf,length(FormPeach.MemoList.Lines[i])-(psf-1));//name
      s1:=extractfileext(s);
      FormPeach.StringGridList.Cells[12,k]:=s;
      FormPeach.StringGridList.Cells[1,k]:=extractfilename(s);
      FormPeach.StringGridList.Cells[2,k]:=s1;
      FormPeach.StringGridList.Cells[13,k]:=prefixf+smartsortable(FormPeach.StringGridList.Cells[1,k]);
      s2:=copy(FormPeach.MemoList.Lines[i],23,psf-31);//size
      s2:=StringReplace(s2,'.','',[rfReplaceAll]);
      s2:=StringReplace(s2,' ','',[rfReplaceAll]);
      FormPeach.StringGridList.Cells[3,k]:=s2;
      FormPeach.StringGridList.Cells[14,k]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,k]))))+inttostr(length(FormPeach.StringGridList.Cells[3,k]))+FormPeach.StringGridList.Cells[3,k];
      FormPeach.StringGridList.Cells[4,k]:='';
      s5:=copy(FormPeach.MemoList.Lines[i],psf-8,5);
      s4:=copy(FormPeach.MemoList.Lines[i],1,19);//datetime
      FormPeach.StringGridList.Cells[5,k]:=s4;
      FormPeach.StringGridList.Cells[16,k]:='0';
      if s5='  dir' then
            begin
            if s<>'' then
               if s[length(s)]='/' then setlength(s,length(s)-1);
            s1:=txt_list_isfolder;
            w:=w+1;
            FormPeach.StringGridList.Cells[12,k]:=s;
            FormPeach.StringGridList.Cells[1,k]:=extractfilename(s);
            FormPeach.StringGridList.Cells[2,k]:=s1;
            FormPeach.StringGridList.Cells[3,k]:='';
            FormPeach.StringGridList.Cells[14,k]:='';
            FormPeach.StringGridList.Cells[13,k]:=prefixd+smartsortable(FormPeach.StringGridList.Cells[1,k]);
            end;
      try
      size:=size+strtoqword(FormPeach.StringGridList.Cells[3,k]);
      except
      end;
      end;
   if (zstarted=false) and (zended=false) then
      begin
      sf:=Copy(s,1,10);
      if sf='----------' then zstarted:=true;
      if zstarted=true then
         begin
         psf:=pos('- ----- -----',s)+10;
         if psf=0 then exit;//failure
         end;
      end;
   end;
   else //standard zpaq
   begin
   if s<>'' then
      if s[1]='-' then
         begin
         k:=k+1;
         s:=copy(FormPeach.MemoList.Lines[i],42,length(FormPeach.MemoList.Lines[i])-41);//name
         s1:=extractfileext(s);
         s2:=copy(FormPeach.MemoList.Lines[i],23,12);//size
         s4:=copy(FormPeach.MemoList.Lines[i],3,19);//datetime
         s5:=copy(FormPeach.MemoList.Lines[i],36,6);//attributes
         FormPeach.StringGridList.Cells[12,k]:=s;
         FormPeach.StringGridList.Cells[1,k]:=extractfilename(s);
         FormPeach.StringGridList.Cells[2,k]:=s1;
         FormPeach.StringGridList.Cells[13,k]:=prefixf+smartsortable(FormPeach.StringGridList.Cells[1,k]);
         FormPeach.StringGridList.Cells[3,k]:=s2;
         FormPeach.StringGridList.Cells[14,k]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,k]))))+inttostr(length(FormPeach.StringGridList.Cells[3,k]))+FormPeach.StringGridList.Cells[3,k];
         FormPeach.StringGridList.Cells[4,k]:='';//s3;
         FormPeach.StringGridList.Cells[5,k]:=s4;
         FormPeach.StringGridList.Cells[10,k]:=s5;
         FormPeach.StringGridList.Cells[16,k]:='0';
         if s5='D     ' then
            begin
            w:=w+1;
            s:=copy(FormPeach.MemoList.Lines[i],42,length(FormPeach.MemoList.Lines[i])-41);
            if s<>'' then
               if s[length(s)]='/' then setlength(s,length(s)-1);
            s1:=txt_list_isfolder;
            FormPeach.StringGridList.Cells[12,k]:=s;
            FormPeach.StringGridList.Cells[1,k]:=extractfilename(s);
            FormPeach.StringGridList.Cells[2,k]:=s1;
            FormPeach.StringGridList.Cells[3,k]:='';
            FormPeach.StringGridList.Cells[14,k]:='';
            FormPeach.StringGridList.Cells[13,k]:=prefixd+smartsortable(FormPeach.StringGridList.Cells[1,k]);
            end;
         try
         size:=size+strtoqword(FormPeach.StringGridList.Cells[3,k]);
         except
         end;
         end;
   end;
   end;
   end;
FormPeach.StringGridList.RowCount:=k+1;
if FormPeach.StringGridList.RowCount=1 then FormPeach.StringGridList.RowCount:=2;
try
//FormPeach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if FormPeach.StringGridList.RowCount>1 then
   begin
   FormPeach.StringGridList.Cells[16,1]:='1';
   FormPeach.StringGridList.Row:=1;
   end;
j:=FormPeach.StringGridList.Rowcount-1;
ratio_info_reduced(w,j-w,size,csize);
except
   pMessageWarningOK(txt_list_error);
   ratio_info_reduced(0,0,0,0);
end;
end;

procedure browse_ace;
var
   {$IFDEF LINUX}lincontrol,{$ENDIF}s,cl,jobcode,outname:ansistring;
   size,csize:qword;
   i,k,k2,title_lines_ace,nfiles,nfolders:integer;
begin
if libre_directive>0 then begin reportnotsupported('ACE'); exit; end;
{$IFDEF MSWINDOWS}title_lines_ace:=3;{$ENDIF}
{$IFDEF LINUX}title_lines_ace:=10;{$ENDIF}
//compose cl to list ace
compose_unace_cl(cl,jobcode,outname,false,'list','all');
//execute cl
execute_cl(cl,'list');
//list content in stringgrid
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
{$IFDEF LINUX}
lincontrol:=copy(FormPeach.MemoList.Lines[8],1,4);
if lincontrol<>'Date' then title_lines_ace:=8;
{$ENDIF}
FormPeach.StringGridList.RowCount:=FormPeach.MemoList.Lines.Count-title_lines_ace-1;
for i:=title_lines_ace to FormPeach.MemoList.Lines.Count-3 do
   begin
   {$IFDEF MSWINDOWS}
   s:=copy(FormPeach.MemoList.Lines[i],9,length(FormPeach.MemoList.Lines[i])-8);
   k:=pos('  (',s);//theorically it's not an univocous marker!
   s:=copy(s,1,k-1);
   FormPeach.StringGridList.Cells[12,i-title_lines_ace+1]:=s;
   FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]:=extractfilename(s);
   FormPeach.StringGridList.Cells[2,i-title_lines_ace+1]:=extractfileext(FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]);
   nfiles:=nfiles+1;
   FormPeach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixf+smartsortable(FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]);
   s:=copy(FormPeach.MemoList.Lines[i],9,length(FormPeach.MemoList.Lines[i])-8);
   k:=pos('  (',s);
   k2:=pos(' byte uncompressed, ',s);
   s:=copy(s,k+3,k2-k-3);
   FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]:=s;
   try
    size:=size+strtoqword(FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]);
   except
   end;
   FormPeach.StringGridList.Cells[14,i-title_lines_ace+1]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]))))+inttostr(length(FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]))+FormPeach.StringGridList.Cells[3,i-title_lines_ace+1];
   s:=copy(FormPeach.MemoList.Lines[i],9,length(FormPeach.MemoList.Lines[i])-8);
   k:=pos(' byte uncompressed, ',s);
   k2:=pos(' byte compressed)',s);
   s:=copy(s,k+20,k2-k-20);
   FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]:=s;
   try
    csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]);
   except
   end;
   FormPeach.StringGridList.Cells[15,i-title_lines_ace+1]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]))))+inttostr(length(FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]))+FormPeach.StringGridList.Cells[4,i-title_lines_ace+1];
   //try to guess if it's a folder (there is no univocous marker): no extension and size 0 (may be an empty file without extension!)
   if (FormPeach.StringGridList.Cells[2,i-title_lines_ace+1]='') and
      (FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]='0') then
      begin
      FormPeach.StringGridList.Cells[2,i-title_lines_ace+1]:=txt_list_isfolder;
      nfiles:=nfiles-1;
      nfolders:=nfolders+1;
      FormPeach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixd+smartsortable(FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]);
      end;
   FormPeach.StringGridList.Cells[5,i-title_lines_ace+1]:='';//date/time (not featured by the executable)
   FormPeach.StringGridList.Cells[10,i-title_lines_ace+1]:='';//attributes (not featured by the executable)
   {$ENDIF}
   {$IFDEF LINUX}
   s:=copy(FormPeach.MemoList.Lines[i],45,length(FormPeach.MemoList.Lines[i])-44);
   FormPeach.StringGridList.Cells[12,i-title_lines_ace+1]:=s;
   FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]:=extractfilename(s);
   FormPeach.StringGridList.Cells[2,i-title_lines_ace+1]:=extractfileext(FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]);
   FormPeach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixf+smartsortable(FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]);
   //date/time
   FormPeach.StringGridList.Cells[5,i-title_lines_ace+1]:=copy(FormPeach.MemoList.Lines[i],1,8)+' '+copy(FormPeach.MemoList.Lines[i],10,5);
   //size
   FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]:=copy(FormPeach.MemoList.Lines[i],28,9);
   try
    size:=size+strtoqword(FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]);
   except
   end;
   FormPeach.StringGridList.Cells[14,i-title_lines_ace+1]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]))))+inttostr(length(FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]))+FormPeach.StringGridList.Cells[3,i-title_lines_ace+1];
   //packed
   FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]:=copy(FormPeach.MemoList.Lines[i],16,11);
   try
    csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]);
   except
   end;
   FormPeach.StringGridList.Cells[15,i-title_lines_ace+1]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]))))+inttostr(length(FormPeach.StringGridList.Cells[4,i-title_lines_ace+1]))+FormPeach.StringGridList.Cells[4,i-title_lines_ace+1];
   //try to guess if it's a folder (there is no univocous marker): no extension and size 0 (may be an empty file without extension!)
   if (FormPeach.StringGridList.Cells[2,i-title_lines_ace+1]='') and
      (FormPeach.StringGridList.Cells[3,i-title_lines_ace+1]='0') then
      begin
      FormPeach.StringGridList.Cells[2,i-title_lines_ace+1]:=txt_list_isfolder;
      FormPeach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixd+smartsortable(FormPeach.StringGridList.Cells[1,i-title_lines_ace+1]);
      end;
   FormPeach.StringGridList.Cells[10,i-title_lines_ace+1]:='';//attributes (not featured by the executable)
   {$ENDIF}
   FormPeach.StringGridList.Cells[16,i-title_lines_ace+1]:='0';
   end;
try
//FormPeach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if FormPeach.StringGridList.RowCount>1 then
   begin
   FormPeach.StringGridList.Cells[16,1]:='1';
   FormPeach.StringGridList.Row:=1;
   end;
ratio_info_reduced(nfolders,nfiles,size,csize);
except
   pMessageWarningOK(txt_list_error);
   ratio_info_reduced(0,0,0,0);
end;
end;

procedure browse_arc060(mode:ansistring);
var
   cl,jobcode,outname,dummy,s:ansistring;
   size,csize,rsize:qword;
   i,h,title_lines_arc,bottom_lines_arc,rr_lines_arc,nfiles,nfolders:integer;
begin
compose_unarc_cl(cl,jobcode,outname,false,'info','all');
if FormPeach.EditUn7zaFilter.Text<>'*' then funflag:=false else funflag:=true;
execute_cl(cl,'list');
title_lines_arc:=3; //number of title lines ver 0.60
bottom_lines_arc:=5;
rr_lines_arc:=3;
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
if FormPeach.MemoList.Lines.Count<7 then
   begin
   seemencrypted:=true;
   set_pw;
   end
else
   begin
   //add rr_lines_arc to title lines if the archive contains recovery records
   dummy:=FormPeach.MemoList.Lines.Strings[title_lines_arc-2]; //beginning of rr lines
   if dummy[1]<>'D' then title_lines_arc:=title_lines_arc+rr_lines_arc;
   if (mode='browse') or (mode='flat') then
      begin
      FormPeach.StringGridList.RowCount:=FormPeach.MemoList.Lines.Count-title_lines_arc-bottom_lines_arc+2;
      for i:=title_lines_arc to FormPeach.MemoList.Lines.Count-bottom_lines_arc do
         begin
         h:=i-title_lines_arc+1;
         s:=ansitoutf8(copy(FormPeach.MemoList.Lines[i],70,length(FormPeach.MemoList.Lines[i])-69));
         tempcharcodefixarc(s);
         FormPeach.StringGridList.Cells[1,h]:=extractfilename(s);
         if seemencrypted=true then FormPeach.StringGridList.Cells[1,h]:=FormPeach.StringGridList.Cells[1,h]+' *';
         if copy(FormPeach.MemoList.Lines[i],22,1)='D' then
            begin
            FormPeach.StringGridList.Cells[12,h]:=s;
            FormPeach.StringGridList.Cells[2,h]:=txt_list_isfolder;
            nfolders:=nfolders+1;
            FormPeach.StringGridList.Cells[13,h]:=prefixd+smartsortable(FormPeach.StringGridList.Cells[1,h]);
            end
         else
            begin
            FormPeach.StringGridList.Cells[12,h]:=s;
            FormPeach.StringGridList.Cells[2,h]:=extractfileext(FormPeach.StringGridList.Cells[12,h]);
            nfiles:=nfiles+1;
            FormPeach.StringGridList.Cells[13,h]:=prefixf+smartsortable(FormPeach.StringGridList.Cells[1,h]);
            end;
         FormPeach.StringGridList.Cells[3,h]:=trimleft(copy(FormPeach.MemoList.Lines[i],29,15));
         FormPeach.StringGridList.Cells[14,h]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,h]))))+inttostr(length(FormPeach.StringGridList.Cells[3,h]))+FormPeach.StringGridList.Cells[3,h];
         FormPeach.StringGridList.Cells[4,h]:=trimleft(copy(FormPeach.MemoList.Lines[i],45,15));
         FormPeach.StringGridList.Cells[15,h]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,h]))))+inttostr(length(FormPeach.StringGridList.Cells[4,h]))+FormPeach.StringGridList.Cells[4,h];
         try
            size:=size+strtoqword(FormPeach.StringGridList.Cells[3,h]);
            csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,h]);
         except
         end;
         FormPeach.StringGridList.Cells[5,h]:=copy(FormPeach.MemoList.Lines[i],1,19);
         FormPeach.StringGridList.Cells[10,h]:=copy(FormPeach.MemoList.Lines[i],21,7);
         FormPeach.StringGridList.Cells[11,h]:=copy(FormPeach.MemoList.Lines[i],61,8);
         FormPeach.StringGridList.Cells[16,h]:='0';
         end;
      end;
   end;
if FormPeach.StringGridList.RowCount>1 then
   begin
   //FormPeach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   FormPeach.StringGridList.Cells[16,1]:='1';
   FormPeach.StringGridList.Row:=1;
   end;
if csize=0 then
   begin
   try
      srcfilesize(FormPeach.OpenDialogArchive.Filename,csize); //expressed in B
   except
   end;
   end;//if csize is not specified, file size is used
status0:=txt_list_flat;
status1:=inttostr(nfolders)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase)+' > '+nicenumber(inttostr(csize),filesizebase);
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
except
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';
if FormPeach.StringGridList.RowCount>1 then
   begin
   end
else
   begin
   status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
   if mode='silent' then seemencrypted:=true;
   end;
end;

procedure browse_arc067(mode:ansistring);
var
   cl,jobcode,outname,dummy,s:ansistring;
   size,csize,rsize:qword;
   i,h,title_lines_arc,bottom_lines_arc,rr_lines_arc,nfiles,nfolders:integer;
begin
compose_unarc_cl(cl,jobcode,outname,false,'info','all');
if FormPeach.EditUn7zaFilter.Text<>'*' then funflag:=false else funflag:=true;
execute_cl(cl,'list');
title_lines_arc:=2; //number of title lines ver 0.67
bottom_lines_arc:=4;
rr_lines_arc:=2;
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
if FormPeach.MemoList.Lines.Count<5 then
   begin
   seemencrypted:=true;
   set_pw;
   end
else
   begin
   //add rr_lines_arc to title lines if the archive contains recovery records
   dummy:=FormPeach.MemoList.Lines.Strings[title_lines_arc+rr_lines_arc-1]; //end of rr lines
   if dummy[1]='A' then title_lines_arc:=title_lines_arc+rr_lines_arc;
   if (mode='browse') or (mode='flat') then
      begin
      FormPeach.StringGridList.RowCount:=FormPeach.MemoList.Lines.Count-title_lines_arc-bottom_lines_arc;
      for i:=title_lines_arc+1 to FormPeach.MemoList.Lines.Count-bottom_lines_arc-1 do
         begin
         h:=i-title_lines_arc;
         if copy(FormPeach.MemoList.Lines[i],69,1)='*' then
            begin
            seemencrypted:=true;
            set_pw;
            end;
         s:=ansitoutf8(copy(FormPeach.MemoList.Lines[i],70,length(FormPeach.MemoList.Lines[i])-69));
         tempcharcodefixarc(s);
         FormPeach.StringGridList.Cells[1,h]:=extractfilename(s);
         if seemencrypted=true then FormPeach.StringGridList.Cells[1,h]:=FormPeach.StringGridList.Cells[1,h]+' *';
         if copy(FormPeach.MemoList.Lines[i],22,1)='D' then
            begin
            FormPeach.StringGridList.Cells[12,h]:=s;
            FormPeach.StringGridList.Cells[2,h]:=txt_list_isfolder;
            nfolders:=nfolders+1;
            FormPeach.StringGridList.Cells[13,h]:=prefixd+smartsortable(FormPeach.StringGridList.Cells[1,h]);
            end
         else
            begin
            FormPeach.StringGridList.Cells[12,h]:=s;
            FormPeach.StringGridList.Cells[2,h]:=extractfileext(FormPeach.StringGridList.Cells[12,h]);
            nfiles:=nfiles+1;
            FormPeach.StringGridList.Cells[13,h]:=prefixf+smartsortable(FormPeach.StringGridList.Cells[1,h]);
            end;
         FormPeach.StringGridList.Cells[3,h]:=trimleft(copy(FormPeach.MemoList.Lines[i],29,15));
         FormPeach.StringGridList.Cells[14,h]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,h]))))+inttostr(length(FormPeach.StringGridList.Cells[3,h]))+FormPeach.StringGridList.Cells[3,h];
         FormPeach.StringGridList.Cells[4,h]:=trimleft(copy(FormPeach.MemoList.Lines[i],45,15));
         FormPeach.StringGridList.Cells[15,h]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,h]))))+inttostr(length(FormPeach.StringGridList.Cells[4,h]))+FormPeach.StringGridList.Cells[4,h];
         try
            size:=size+strtoqword(FormPeach.StringGridList.Cells[3,h]);
            csize:=csize+strtoqword(FormPeach.StringGridList.Cells[4,h]);
         except
         end;
         FormPeach.StringGridList.Cells[5,h]:=copy(FormPeach.MemoList.Lines[i],1,19);
         FormPeach.StringGridList.Cells[10,h]:=copy(FormPeach.MemoList.Lines[i],21,7);
         FormPeach.StringGridList.Cells[11,h]:=copy(FormPeach.MemoList.Lines[i],61,8);
         FormPeach.StringGridList.Cells[16,h]:='0';
         end;
      end;
   end;
if FormPeach.StringGridList.RowCount>1 then
   begin
   //FormPeach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   FormPeach.StringGridList.Cells[16,1]:='1';
   FormPeach.StringGridList.Row:=1;
   end;
if csize=0 then
   begin
   try
      srcfilesize(FormPeach.OpenDialogArchive.Filename,csize); //expressed in B
   except
   end;
   end;//if csize is not specified, file size is used
status0:=txt_list_flat;
status1:=inttostr(nfolders)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase)+' > '+nicenumber(inttostr(csize),filesizebase);
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
except
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';
if FormPeach.StringGridList.RowCount>1 then
   begin
   end
else
   begin
   status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
   if mode='silent' then seemencrypted:=true;
   end;
end;

procedure browse_arc(mode:ansistring);
begin
{$IFDEF MSWINDOWS}
browse_arc067(mode);
{$ELSE}
browse_arc060(mode);
{$ENDIF}
end;

procedure open_prepare_reduced;
begin
FormPeach.EditUn7zaFilter.Text:='*';
FormPeach.EditNameCustomExt.Text:=FormPeach.pcustom1.caption;
status0:=txt_list_browsing;
status1:=txt_list_na;
if fun='FILEBROWSER' then listdir(FormPeach.OpenDialogArchive.Filename, false,false)
else
   begin
   indir:=extractfilepath(FormPeach.OpenDialogArchive.Filename);
   end;
case fun of
   'UNCUSTOM', 'UNLPAQ', 'UNQUAD', 'UNBROTLI', 'UNZSTD': browse_single;
   'UNPAQ':
      begin
      browse_paq;
      autobrowsetar;
      end;
   'UNZPAQ':
      begin
      browse_zpaq;
      testencrypted_open;
      if (zpaqfull=1) or (zpaqabsolute=1) then
      else autobrowsetar;
      end;
   'UNACE': browse_ace;
   'UNARC':
      begin
      browse_arc('browse');  //presently supported only f6flat browsing
      testencrypted_open;
      autobrowsetar;
      end;
end;
addtohistory;
end;

procedure open_prepare_un7z;
begin
FormPeach.po_delete.visible:=true;
FormPeach.po_delete.Caption:=txt_2_5_delete_fromarchive;
end;

procedure open_prepare_unarc;
begin
FormPeach.po_delete.visible:=true;
FormPeach.po_delete.Caption:=txt_2_5_delete_fromarchive;
FormPeach.pmmorerr.Visible:=true;
FormPeach.pmmorerecover.Visible:=true;
FormPeach.po_rr.Visible:=true;
FormPeach.po_recover.Visible:=true;
end;

procedure open_7z_prepare;
begin
case browserstyle of
   0: begin
      status0:=txt_list_browsing;
      browsingmode7z:=0;
      end;
   1: begin
      status0:=txt_list_flat;
      browsingmode7z:=1;
      end;
   else //last used
      if browsingmode7z=0 then status0:=txt_list_browsing
      else status0:=txt_list_flat;
   end;
if FormAdvf.CheckBoxAdvFilters.State=cbUnchecked then setsearch_enabled;
end;

procedure teststatus(var i:integer; var s:ansistring);
begin
i:=0;
try
if FormPeach.StringGridList.Cells[1,1]='' then i:=1;
except
i:=1;
end;
if i=0 then s:=txt_un7z_browse_ok//ok
else //error or no match
   begin
   s:=txt_un7z_browse_failure;
   end;
end;

procedure testarctype(s:ansistring; var i:integer; var fun:ansistring);
begin
{$IFDEF MSWINDOWS}
if s=txt_mypc then
   begin
   i:=1000;
   fun:='FILEBROWSER';
   fun_status:=fun;
   exit;
   end;
{$ENDIF}
if length(s)>=4 then
   if copy(s,1,4)='\\.\' then
      begin
      i:=3;
      fun:='UN7Z';
      fun_status:=fun;
      exit;
      end;
i:=testinput(s,true);
case i of
   0: begin
      if forceopenasarchive=true then
         begin
         i:=3;
         fun:='UN7Z';
         fun_status:=fun;
         exit;
         end
      else
         fun:='UNCUSTOM';
      end;
   1: fun:='UNPEA';
   2: fun:='RFJ';
   3: fun:='UN7Z';
   4: fun:='UN7Z';
   5: fun:='UNPAQ';
   6: fun:='UNQUAD';
   7: fun:='UNACE';
   8: fun:='UNLPAQ';
   9: fun:='UNARC';
   10: fun:='UNZPAQ';
   11: fun:='UNBROTLI';
   12: fun:='UNZSTD';
   1000: fun:='FILEBROWSER';
   end;
forceopenasarchive:=false;
fun_status:=fun;
end;

procedure do_prebrowse;
var
   i:integer;
begin
FormPeach.EditUn7zaFilter.Text:='*';
FormPeach.EditUn7zaFilterExclude.Text:='';
prebrowsing:=true;
FormPeach.PanelProgress.Color:=PGREEN;
FormPeach.PanelProgress.Visible:=true;
FormPeach.PanelProgress.Width:=FormPeach.Width*10 div 100;
pperc:=10;
FormPeach.Caption:=txt_open+' '+FormPeach.editopenin.Caption+'...';
application.ProcessMessages;
i:=list_un7z('silent');//don't add to history
prebrowsing:=false;
teststatus(i,statust);
archive_content:=status1;
FormPeach.PanelProgress.Width:=FormPeach.Width*75 div 100;
pperc:=75;
application.ProcessMessages;
end;

procedure browse_special_cases_checkextension(s:ansistring);
var sl:ansistring;
begin
sl:=extractfileext(s);
if (sl='.z') or
(sl='.xz') or
(sl='.lz') or
(sl='.txz') or
(sl='.lzma') or
(sl='.rpm') or
(sl='.deb') or
(sl='.man') or
(sl='.slp') or
(sl='.bz2') or
(sl='.bzip2') or
(sl='.tbz2') or
(sl='.tbzip2') or
(sl='.bz') or
(sl='.bzip') or
(sl='.tbz') or
(sl='.tbzip') then browse_option:='l';
end;

procedure browse_special_cases; //set browse_option evaluating for special cases of formats needing non -slt listing
var
   s:ansistring;
begin
browse_option:='slt'; //default
s:=lowercase(FormPeach.OpenDialogArchive.Filename);
browse_special_cases_checkextension(s);
if (extractfileext(s)='.001') then //check for same extensions before .001
   begin
   cutextension(s);
   browse_special_cases_checkextension(s);
   end;
cutextension(s);
if extractfileext(s)='.cpio' then browse_option:='l'; //cpio.gz in rpm archives
if (prebrowsing=true) then
   browse_option:='l';
end;

procedure open_7z;
begin
browse_special_cases;
case prebrowse of
0,1,2,3:// 0 always pre-parse, 1,2,3 pre-parse larger to smaller archives
   begin
   do_prebrowse;
   open_7z_prepare;
   if browsingmode7z=0 then list_root
   else listun7z_expandall;
   populatetree;
   end;
4:// 4 Fast mode, pre-parse only if errors are detected
   begin
   open_7z_prepare;
   if browsingmode7z=0 then list_root
   else listun7z_expandall;
   if browsingmode7z=0 then
      if status1=txt_list_nomatch+txt_2_7_list_tryflatorpw then
      begin
      do_prebrowse;
      open_7z_prepare;
      if browsingmode7z=0 then list_root
      else listun7z_expandall;
      populatetree;
      end;
   end;
5:// do not pre-parse
   begin
   open_7z_prepare;
   if browsingmode7z=0 then list_root
   else listun7z_expandall;
   end;
end;
testencrypted_open;
FormPeach.PanelProgress.Visible:=false;
readcomment;
end;

procedure open_supported;
begin
stime:=(DateTimeToFileDate(now));
setbrowserwarning_off;
FormPeach.TimerBrowser.Interval:=500;
FormPeach.TimerBrowser.Enabled:=true;
FormPeach.ImageListSearch.Enabled:=true;
h_folders:=false;
nomatch:=false;
specialopen:=false;
set_extcontext_off;
setsearch_disabled;
currentcomp:=upcase(extractfileext(FormPeach.OpenDialogArchive.Filename));
currentcomp:=copy(currentcomp,2,length(currentcomp)-1);
currentfs:='';
statust:='';
statuss:='';
selnode:=0;
archive_content:='';
status_curarchive:=currentcomp;
FormPeach.LabelComment.Caption:='';
FormPeach.LabelComment.Hint:='';
addmenuenable(0);
if (fun='UN7Z') or (fun='FILEBROWSER') then
   begin
   FormPeach.mFlat.Visible:=true;
   FormPeach.pmFlat.Visible:=true;
   end
else
   begin
   FormPeach.mFlat.Visible:=false;
   FormPeach.pmFlat.Visible:=true;
   end;
if fun<>'FILEBROWSER' then clearlist_ext;//clear extraction list when opening an archive
browse_option:='';
israr5:='';
funflag:=false;
FormPeach.EditOpenIn.Text:=FormPeach.OpenDialogArchive.Filename;
if (extractfilename(FormPeach.EditOpenIn.Caption)<>'') and //now browsing archive
   (extractfilename(prevarchive)<>'') and //previously browsing archive
   (FormPeach.EditOpenIn.Caption<>prevarchive) then //archive is different than previous one
   if keeppw=0 then
      begin
      FormPW.EditPWpass.Text:='';
      FormPW.EditPWconfirm.Text:='';
      FormPW.EditPWkeyfile.Text:='';
      setpwicons;
      end;
prevarchive:=FormPeach.EditOpenIn.Caption;
settoolbar;
end;

procedure create_ptmpcode(var s:ansistring);
begin
s:=STR_TMP+inttohex(random(16000000),6);
ptmpdir:='';
end;

function open_inputselect:integer;
begin
if listingdir=true then exit;
listingdir:=true;
if lastobj<>FormPeach.OpenDialogArchive.Filename then alreadytar:=0;
if check7zvolume(FormPeach.OpenDialogArchive.Filename)=true then
else
   begin
if FormPeach.OpenDialogArchive.Filename='' then FormPeach.OpenDialogArchive.Filename:=FormPeach.EditOpenIn.Text;
FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.OpenDialogArchive.Filename);
if {$IFDEF MSWINDOWS}not(FormPeach.OpenDialogArchive.Filename=txt_mypc) and{$ENDIF}
   not(fileexists((FormPeach.OpenDialogArchive.Filename))) and
   not(checkdirexists((FormPeach.OpenDialogArchive.Filename))) then
   begin
   if (FormPeach.OpenDialogArchive.Filename=txt_none) or (FormPeach.OpenDialogArchive.Filename='<none>') then
      begin
      if checkdirexists((extractfilepath(FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row]))) then
         FormPeach.OpenDialogArchive.Filename:=extractfilepath(FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row])
      else
         FormPeach.OpenDialogArchive.Filename:=indir;
      end
   else
      begin
         listingdir:=false;
         exit;
      end;
   end;
   end;
if FormPeach.OpenDialogArchive.Filename<>'\' then
   if fileexists((FormPeach.OpenDialogArchive.Filename)) then
      {$IFNDEF MSWINDOWS}if extractfileext(FormPeach.OpenDialogArchive.Filename)<>'' then{$ENDIF}
      addtoarchivehistory(FormPeach.OpenDialogArchive.Filename); //add only archive files
archiveopened:=true;
lastobj:=FormPeach.OpenDialogArchive.Filename;
if lastobj<>beingpreviewed then
   begin
   keeppreview:=false;
   beingpreviewed:='';
   end;
if keeppreview=false then
   if ptmpcode<>'' then
      begin
      cleardirasync(ptmpdir);
      ptmpdir:='';
      end;
if pstmpdir<>'' then cleardirasync(pstmpdir);
pstmpdir:='';
seemencrypted:=false;
fun:='';
fun_status:='';
subfun:='';
if keeppreview=false then create_ptmpcode(ptmpcode);
setpanel_extract(1);
try
   srcfilesize_multipart_v(FormPeach.OpenDialogArchive.Filename,tvol,tsize); //expressed in B
except
end;
testarctype(FormPeach.OpenDialogArchive.Filename,open_inputselect,fun);
setbuttonmenus;
case fun of
'UNCUSTOM', 'UNPAQ', 'UNZPAQ', 'UNLPAQ', 'UNQUAD', 'UNBROTLI', 'UNZSTD' :
   begin
   open_supported;
   open_prepare_reduced;
   end;
'UNPEA' :
   begin
   open_supported;
   open_prepare_unpea;
   end;
'RFJ' :
   begin
   open_supported;
   open_prepare_unpea;
   end;
'UN7Z' :
   begin
   open_supported;
   open_prepare_un7z;
   open_7z;
   end;
'UNACE' :
   begin
   if libre_directive>0 then begin reportnotsupported('ACE'); exit; end
   else
      if not(fileexists((binpath+'unace'+directoryseparator+'unace'+EXEEXT))) then
         begin
         if unaceshown=false then
            begin
            pMessageInfoOK('PeaZip UNACE '+txt_5_7_plugin);
            unaceshown:=true;
            end;
         FormPeach.Visible:=false;
         saverestartclosepeaapp;
         exit;
         end;
   open_supported;
   open_prepare_reduced;
   end;
'UNARC' :
   begin
   open_supported;
   open_prepare_unarc;
   open_prepare_reduced;
   end;
'FILEBROWSER' :
   begin
   listingdir:=false;//allows listing directory
   open_supported;
   open_prepare_reduced;
   end;
end;
if (fun='UN7Z') or (fun='UNARC') then
   begin
   FormPeach.iConsoleCreateImportExt.PopupMenu:=FormPeach.pmOpenPJ;
   set_extcontext_on;
   end
   else
      FormPeach.iConsoleCreateImportExt.PopupMenu:=nil;
if (fun<>'FILEBROWSER') and (fun<>'UN7Z') then update_listview;
get_statuss(FormPeach.EditOpenIn.Text);
set_statuss_nav;
fromtree:=false;
if fun<>'FILEBROWSER' then FormPeach.LabelExtHere.Visible:=true else FormPeach.LabelExtHere.Visible:=false;
if ShellTreeViewSetTextPath(FormPeach.ShellTreeViewNav,extractfilepath(FormPeach.EditOpenIn.Text))=1 then ShellTreeViewSetTextPath(FormPeach.ShellTreeViewNav,extractfilepath(FormPeach.EditOpenIn.Text));
listingdir:=false;
zaout:=zaout1;
end;

procedure open_archive_do;
begin
   if FormPeach.OpenDialogArchive.Filename<>'' then
      begin
      if check7zvolume(FormPeach.OpenDialogArchive.Filename)=true then
      else
         if forceopenasarchive=false then
            if testinput(FormPeach.OpenDialogArchive.Filename,true)=0 then
               if pMessageInfoYesNo(FormPeach.OpenDialogArchive.Filename+' '+txt_2_8_custom)=7 then exit;
      showpanel('open');
      open_inputselect;
      end;
end;

function open_archive:integer;
begin
result:=0;
FormPeach.OpenDialogArchive.Filename:=''; //clear filename
if FormPeach.OpenDialogArchive.Execute then
   begin
   result:=1;
   open_archive_do;
   end
else result:=-1;
end;

procedure open_archive_fromname(s:ansistring);
begin
if check7zvolume(s)=true then
else
if not(fileexists(s)) then
   begin
      exit;
   end;
FormPeach.OpenDialogArchive.Filename:=s;
open_archive_do;
end;

procedure do_openasarchive;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if FormPeach.StringGridList.Cells[2,FormPeach.StringGridList.Row]=txt_list_isfolder then exit;
if checklistanysel<>0 then exit;
forceopenasarchive:=true;
if fun='FILEBROWSER' then open_archive_fromname(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])
else
   begin
   oafromgrid:=true;
   grid_obj_open;
   oafromgrid:=false;
   end;
//forceopenasarchive:=false;
end;

function testifrarlocked(s:ansistring):integer; //test if rar4 or rar5 is locked
var
   ext:ansistring;
   f_in:file of byte;
   sbuf:array [1..17] of byte;
   numread:integer;
begin
result:=-1;//not mgotypeRAR
ext:=extractfileext(s);
if upcase(ext)='.RAR' then
   try
   assignfile(f_in,s);
   filemode:=0;
   reset(f_in);
   try
   blockread (f_in,sbuf,17,numread);
   except
   close(f_in);
   exit;
   end;
   if sbuf[7]=$01 then //rar5
      if sbuf[17]=$10 then
         result:=3 //rar5 locked
      else
         result:=2 //rar5 unlocked
   else //rar4
      if sbuf[11]=$04 then
         result:=1 //rar4 locked
      else
         result:=0; //rar4 unlocked
   close(f_in);
   except
      try close(f_in); except end;
   end;
end;

procedure testrarlocked;
var
   ext:ansistring;
   i:integer;
begin
i:=testifrarlocked(FormPeach.EditOpenIn.Text);
case i of //mgotypeRAR revision already reported in status1 as method
   //0: FormPeach.Caption:=FormPeach.Caption;
   1: FormPeach.Caption:=FormPeach.Caption+' | '+txt_7_4_locked;
   //2: FormPeach.Caption:=FormPeach.Caption;
   3: FormPeach.Caption:=FormPeach.Caption+' | '+txt_7_4_locked;
   end;
case i of
   -1: //not mgotypeRAR
      begin
      end;
   else //mgotypeRAR
      if (havewinrar=true) and (userar=1) then
      begin
      FormPeach.pmmorerr.Visible:=true;
      FormPeach.pmmorerecover.Visible:=true;
      FormPeach.po_rr.Visible:=true;
      FormPeach.po_recover.Visible:=true;
      end;
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection EXECUTE commands

///////////////////////////////////////////////////////////////////////////////}

function execute_cl(cl,mode:ansistring):integer;
var
  P: tprocessutf8;
  i,BytesRead,j,BytesRead2,meminc,membuf,membuf2:integer;
  skipped_prebrowse:boolean;
  M,M2:TmemoryStream;
  nfiles,ndirs,tsize,browselimitsize:QWord;
begin
execute_cl:=-1;
zaout:=zaout1;
if cl='' then
   begin
   pMessageErrorOK(txt_error_emptycl);
   exit_nosave;
   end;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
enter_busy_status;
if FormPeach.Visible=true then Application.ProcessMessages;
skipped_prebrowse:=false;
i:=0;
j:=0;
P:=tprocessutf8.Create(nil);
M := TMemoryStream.Create;
BytesRead := 0;
M2 := TMemoryStream.Create;
BytesRead2 := 0;
{$IFDEF MSWINDOWS}
if (mode='extandrun') or (mode='delete') or (mode='add') or (mode='preview') then
   if intpw=1 then P.Options := [poWaitOnExit] else P.Options := [poUsePipes, poNoConsole]
else P.Options := [poUsePipes, poNoConsole];
if fun='UNARC' then if intpw=1 then else P.Options := [poUsePipes, poNoConsole, poDetached];
{$ELSE}
if (mode='extandrun') or (mode='delete') or (mode='add') or (mode='preview') then
   if intpw=1 then P.Options := [poNewConsole] else P.Options := [poUsePipes]
else P.Options := [poUsePipes];
if fun='UNARC' then if intpw=1 then else P.Options := [poUsePipes];
{$ENDIF}
if mode='silent' then nitems:=0;
M.SetSize(32*1024);
M2.SetSize(32*1024);
case prebrowse of
   1,2: browselimitsize:=192*1024*1024; //pre-parse 1.5M+ / list 0.5M files approx
   3,4,5: browselimitsize:=64*1024*1024; //0.5M+ / 160K (5 excludes pre-parsing)
   end;

//small tuning is possible optimizing memory increment sizes
meminc:=8*1024*1024;
membuf:=16*1024;
membuf2:=4*1024;

peapexecute(P,cl);

if (pipepw<>'') and (poUsePipes in P.Options) then
   begin
   if FormPeach.Visible=true then Application.ProcessMessages;
   pipepw:=pipepw+lineending;
   P.Input.Write(pipepw[1], Length(pipepw));
   if FormPeach.Visible=true then Application.ProcessMessages;
   if piperar=false then P.Input.Write(pipepw[1], Length(pipepw));
   pipepw:='';
   piperar:=false;
   end;

if (poUsePipes in P.Options) then
while P.Running do
   begin
   i:=0;
   if P.output.NumBytesAvailable>0 then //optimized for speed, larger buffer
   begin
   if BytesRead+membuf>=M.Size then M.SetSize(BytesRead + meminc);
   if prebrowse>0 then
      begin
      if BytesRead>browselimitsize then
         begin
         if mode<>'silent' then pMessageInfoOK(txt_aborted_error+char($0D)+char($0A)+txt_8_1_bop);
         status0:=txt_aborted;
         status1:='';
         skipped_prebrowse:=true;
         P.Terminate(255);
         break;
         end;
      end;
   i := P.Output.Read((M.Memory + BytesRead)^, membuf);
   end
   else i:=0;

   if P.Stderr.NumBytesAvailable>0 then
   begin
   if BytesRead2+membuf2>=M2.Size then M2.SetSize(BytesRead2 + meminc);
   j := P.Stderr.Read((M2.Memory + BytesRead2)^, membuf2);
   end
   else j:=0;

   if i > 0 then Inc(BytesRead, i);
   if j > 0 then Inc(BytesRead2, j);
   //if (i=0) and (j=0) then sleep(100); //deactivated as slower, loop needs to run as fast as possible
   if FormPeach.Visible=true then Application.ProcessMessages;
   end;

{$IFNDEF MSWINDOWS}
if (mode='extandrun') or (mode='delete') or (mode='add') or (mode='preview') then
   if intpw=1 then
repeat
   if FormPeach.Visible=true then Application.ProcessMessages;
   sleep(100);
until P.ExitStatus <> -1;
{$ENDIF}

if (mode<>'extandrun') and (mode<>'delete') and (mode<>'add')  and (mode<>'preview') then
   repeat
      M.SetSize(BytesRead + 4*1024);
      i := P.Output.Read((M.Memory + BytesRead)^, 4*1024);
      if i > 0 then Inc(BytesRead, i);
      //else Sleep(100);
      if FormPeach.Visible=true then Application.ProcessMessages;
   until i <= 0;
M.SetSize(BytesRead);
if fun<>'UNARC' then
   begin
   if tryopenwerrors=0 then
      execute_cl:=P.ExitStatus
   else
      begin
      case fun of
         'silent','list','flat': execute_cl:=0;
         else execute_cl:=P.ExitStatus;
      end;
      end;
   end
else
   execute_cl:=P.ExitStatus;
if (mode='silent') or (mode='browse') or (mode='flat') then
   if P.ExitStatus<>0 then setbrowserwarning_on;
P.Free;

if (intpw=1) and (mode='preview') then
   begin
   DirSize(ptmpdir+directoryseparator,'*',FaAnyFile,true,true,nfiles,ndirs,tsize);
   if tsize<=0 then execute_cl:=-1;
   end;

if getcurrentdir<>executable_path then setcurrentdir((executable_path));
if mode='preview' then filesetattr(ptmpdir, faHidden);
if (mode='extandrun') or (mode='delete') or (mode='add')  or (mode='preview') then
   begin
   M.Free;
   M2.Free;
   exit_busy_status;
   exit;
   end;
M2.Free;
FormPeach.StringGridList.RowCount:=1;
FormPeach.MemoList.Clear;

if (execute_cl=0) or (forcebrowse=1) then
   begin
   FormPeach.MemoList.Lines.LoadFromStream(M);
   if browse_option='' then
      begin
      M.Free;
      exit_busy_status;
      exit; //if the program is browsing a format not supported through 7z, using its browse_$format method
      end;
   case browse_option of
      'slt': find_7z_titles;
      'l':  find_7zl_titles;
      'rar5':  find_rar5_titles;
      end;
   i:=title_lines_7z+1;
   nomatch:=false;
   if FormPeach.MemoList.Lines.Count<i then //no matches
      begin
      status1:=txt_list_nomatch;
      nomatch:=true;
      if mode='silent' then
         begin
         //seemencrypted:=true;
         //set_pw;
         status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
         end
      else
         begin
         if FormPeach.EditUn7zaFilter.Text='*' then
            status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
         if mode='browse' then lastobjarch:=extractfilepath(FormPeach.EditUn7zaFilter.Text);
         end;
      update_listview;
      FormPeach.StringGridList.RowCount:=2;
      M.Free;
      exit_busy_status;
      exit;
      end;
   if (skipped_prebrowse=true) then
      begin
      M.Free;
      exit_busy_status;
      if (mode<>'silent') then restartclosepeaapp;
      exit;
      end;
   case browse_option of
      'slt': list_slt(mode);
      'l': list_l(mode);
      'rar5': list_rar5(mode);
      end;
   M.Free;
   if mode='browse' then
      begin
      set_lastobjarch;
      lastobjarch:=extractfilepath(FormPeach.EditUn7zaFilter.Text);
      status0:=txt_list_browsing;
      update_listview;
      view_lastobj;
      end;
   if mode='flat' then
      begin
      FormPeach.StringGridList.Cells[16,1]:='1';
      FormPeach.StringGridList.Row:=1;
      status0:=txt_list_flat;
      update_listview;
      end;
   end
else //error
   begin
   FormPeach.PanelProgress.Color:=PRED;
   application.ProcessMessages;
   FormPeach.StringGridList.RowCount:=2;
   status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
   update_listview;
   if mode='silent' then
      begin
      status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
      if skipped_prebrowse=false then
         begin
         seemencrypted:=true;
         set_pw;
         end;
      end;
   end;

if (mode='silent') and (browse_option='l') then else exit_busy_status;//keep browser locked during composite prebrowsing + browsing operation
end;

function execute_cl_simple(cl:ansistring):integer;
var
  P: tprocessutf8;
  i,BytesRead,j,BytesRead2:integer;
  M,M2:TmemoryStream;
begin
result:=-1;
zaout:=zaout1;
if cl='' then
   begin
   pMessageErrorOK(txt_error_emptycl);
   exit_nosave;
   end;
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
i:=0;
j:=0;
P:=tprocessutf8.Create(nil);
M := TMemoryStream.Create;
BytesRead := 0;
M2 := TMemoryStream.Create;
BytesRead2 := 0;
{$IFDEF MSWINDOWS}
if intpw=1 then P.Options := [poWaitOnExit] else P.Options := [poUsePipes, poNoConsole];
{$ELSE}
if intpw=1 then P.Options := [poWaitOnExit] else P.Options := [poUsePipes];
{$ENDIF}
M.SetSize(32*1024);
M2.SetSize(32*1024);
peapexecute(P,cl);

if (pipepw<>'') and (poUsePipes in P.Options) then
   begin
   if FormPeach.Visible=true then Application.ProcessMessages;
   pipepw:=pipepw+lineending;
   P.Input.Write(pipepw[1], Length(pipepw));
   if FormPeach.Visible=true then Application.ProcessMessages;
   if piperar=false then P.Input.Write(pipepw[1], Length(pipepw));
   pipepw:='';
   piperar:=false;
   end;

if (poUsePipes in P.Options) then
while P.Running do
   begin
   i:=0;
   if P.output.NumBytesAvailable>0 then
   begin
   if BytesRead+16*1024>=M.Size then M.SetSize(BytesRead + 8*1024*1024);
   i := P.Output.Read((M.Memory + BytesRead)^, 16*1024);
   end
   else i:=0;

   if P.Stderr.NumBytesAvailable>0 then
   begin
   if BytesRead2+4*1024>=M2.Size then M2.SetSize(BytesRead2 + 8*1024*1024);
   j := P.Stderr.Read((M2.Memory + BytesRead2)^, 4*1024);
   end
   else j:=0;

   if i > 0 then Inc(BytesRead, i);
   if j > 0 then Inc(BytesRead2, j);
   //if (i=0) and (j=0) then sleep(100); //deactivated as slower
   if FormPeach.Visible=true then Application.ProcessMessages;
   end;

{$IFNDEF MSWINDOWS}
if intpw=1 then
repeat
   if FormPeach.Visible=true then Application.ProcessMessages;
   sleep(100);
until P.ExitStatus <> -1;
{$ENDIF}

result:=P.ExitStatus;
P.Free;
M.Free;
M2.Free;
end;

procedure open_cp(s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k cd /d "'+s+'"';
{$ELSE}//system needs to support konsole, gnome-tem or xterm
case desk_env of
   0: begin cl:='xterm'; end;//unknown, not win or osx
   1: begin cl:='gnome-terminal '+stringdelim('--working-directory='+escapefilename(s,desk_env)); end;//Gnome
   2: begin cl:='konsole --workdir '+stringdelim(escapefilename(s,desk_env)); end;//KDE
   20: begin cl:='open -a Terminal '+stringdelim(escapefilename(s,desk_env)); end;//macOS
   end;
{$ENDIF}
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
end;

procedure linlaunchconsole(s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFNDEF MSWINDOWS}
case desk_env of
   0: begin cl:='xterm -e'; end;
   1: begin cl:='gnome-terminal -e'; end;
   2: begin cl:='konsole -e'; end;
   end;
cl:=cl+' ''bash -c "'+s+'; read line"''';
{$IFDEF DARWIN}
cl:='open '+s;
{$ENDIF}
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
{$ENDIF}
end;

procedure linlaunch(s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFNDEF MSWINDOWS}
cl:=s;
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
try
peapexecute(P,cl);
finally
P.Free;
end;
{$ENDIF}
end;

procedure execute_cl_process(cl:ansistring);
var
   P:tprocessutf8;
begin
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
end;

procedure removeunits;
begin
{$IFDEF MSWINDOWS}
execute_cl_process('RUNDLL32 SHELL32.DLL,Control_RunDLL hotplug.dll');
{$ENDIF}
end;

procedure open_ps(s:ansistring);
var
   P:TProcessUTF8;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
P.Executable:='powershell.exe';
P.Parameters.Add('-NoExit');
P.Parameters.Add('-Command');
P.Parameters.Add('Set-Location '+QuotedStr(s));
peapparamexecute(P);
P.Free;
{$ENDIF}
end;

procedure open_diskclean;
var
   P:tprocessutf8;
   s,cl:ansistring;
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if FormPeach.EditOpenIn.Text=txt_mypc then s:=copy(FormPeach.StringGridList.Cells[12, FormPeach.StringGridList.Row], 1, 2)
   else s:=copy(FormPeach.EditOpenIn.Text, 1, 2)
else s:=copy(FormPeach.EditOpenIn.Text, 1, 2);
if s<>'' then cl:='cleanmgr /d '+s
else cl:='cleanmgr';
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
{$ENDIF}
end;

procedure disk_convert;
var
   P:tprocessutf8;
   s,cl:ansistring;
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if FormPeach.EditOpenIn.Text=txt_mypc then s:=copy(FormPeach.StringGridList.Cells[12, FormPeach.StringGridList.Row], 1, 2)
   else s:=copy(FormPeach.EditOpenIn.Text, 1, 2)
else s:=copy(FormPeach.EditOpenIn.Text, 1, 2);
cl:='convert '+s+' /FS:NTFS';
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
{$ENDIF}
end;

procedure open_cpl;
begin
{$IFDEF MSWINDOWS}
execute_cl_process('control');
{$ENDIF}
end;

procedure open_diskmanagement;
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('diskmgmt.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure open_defrag;
var
   s:ansistring;
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if FormPeach.EditOpenIn.Text=txt_mypc then s:=copy(FormPeach.StringGridList.Cells[12, FormPeach.StringGridList.Row], 1, 2)
   else s:=copy(FormPeach.EditOpenIn.Text, 1, 2)
else s:=copy(FormPeach.EditOpenIn.Text, 1, 2);
if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
if winver='nt5' then ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('dfrg.msc'), PWideChar (s), PWideChar (''), SW_SHOWNORMAL)
else ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('dfrgui.exe'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure hexpselected(poper:ansistring);
var
   cl,in_param:ansistring;
   P:tprocessutf8;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then sg:=FormPeach.StringGridAdd
else sg:=FormPeach.StringGridExtract;
if sg.Row=0 then exit;
in_param:=stringdelim(escapefilename(sg.Cells[8,sg.Row],desk_env));
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' '+poper+' '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
peapexecute(P,cl);
P.Free;
end;

procedure dispenv;
var
   cl:ansistring;
begin
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' envstr';
execute_cl_process(cl);
end;

procedure explorewinroot;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then
   ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('Explorer'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
else
   ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('Explorer'), PWideChar ('/E,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}'), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

function checkfdwin:integer;//under Windows systems prevents adding a floppy volume to the archive (open and add files instead), because if the floppy is not found there are raised exceptions difficult and slow to handle
begin
checkfdwin:=-1;
{$IFDEF MSWINDOWS}
if (FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]='A:\') or (FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]='B:\') then exit;
{$ENDIF}
checkfdwin:=0;
end;

function checkfdwin_row(i:integer):integer;//under Windows systems prevents adding a floppy volume to the archive (open and add files instead), because if the floppy is not found there are raised exceptions difficult and slow to handle
begin
checkfdwin_row:=-1;
{$IFDEF MSWINDOWS}
if i>0 then
   if (FormPeach.StringGridList.Cells[12,i]='A:\') or (FormPeach.StringGridList.Cells[12,i]='B:\') then exit;
{$ENDIF}
checkfdwin_row:=0;
end;

procedure browser_commandprompt(iscontext,isps:integer; s_in:ansistring);
var
   s:ansistring;
begin
if checkfdwin<>0 then exit;
if s_in<>'' then
   begin
   s:=s_in;
   if s=txt_mypc then
      if checklistsel=0 then s:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]
      else {$IFDEF MSWINDOWS}s:='C:\';{$ELSE}s:=directoryseparator;{$ENDIF}
   end
else
begin
if fun='FILEBROWSER' then
   if FormPeach.EditOpenIn.Text=txt_mypc then
      if checklistsel=0 then s:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]
      else {$IFDEF MSWINDOWS}s:='C:\'{$ELSE}s:=directoryseparator{$ENDIF}
   else
      begin
      if iscontext=0 then s:=FormPeach.EditOpenInInteractive.Text
      else
         if checklistsel<>0 then s:=extractfilepath(FormPeach.EditOpenIn.Text)
         else
            if FormPeach.StringGridList.Cells[2,FormPeach.StringGridList.Row]=txt_list_isfolder then s:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]
            else
               begin
               s:=extractfilepath(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
               if s='' then s:=FormPeach.EditOpenIn.Text;
               end
      end
else s:=extractfilepath(FormPeach.EditOpenIn.Text);
end;
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
if s<>'' then
   if isps=0 then open_cp(s)
   else open_ps(s);
end;

procedure do_alltasks;
begin
{$IFDEF MSWINDOWS}
shellexecutew(FormPeach.handle, PWideChar('open'), PWideChar('EXPLORER.EXE'), PWideChar('shell:::{ED7BA470-8E54-465E-825C-99712043E01C}'), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure open_compmanagement;
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('compmgmt.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure winsysproperties;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then
   ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('sysdm.cpl'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
else
   ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('systempropertiescomputername'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

function webopen(s:ansistring):integer;
var
   w:widestring;
begin
webopen:=-1;
if s='' then exit;
{$IFDEF MSWINDOWS}
w:=utf8decode(s);
webopen:=ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar(w), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
{$IFDEF LINUX}webopen:=cp_open_linuxlike(s,desk_env);{$ENDIF}//try to open via Gnome or KDE
{$IFDEF FREEBSD}webopen:=cp_open_linuxlike(s,desk_env);{$ENDIF}
{$IFDEF NETBSD}webopen:=cp_open_linuxlike(s,desk_env);{$ENDIF}
{$IFDEF OPENBSD}webopen:=cp_open_linuxlike(s,desk_env);{$ENDIF}
{$IFDEF DARWIN}webopen:=cp_open_linuxlike(s,desk_env);{$ENDIF}
end;

procedure run_custom(tmpprevrun:ansistring);
var
   s:ansistring;
   {$IFDEF MSWINDOWS}
   w:widestring;
   {$ELSE}
   P:tprocessutf8;
   cl:ansistring;
   {$ENDIF}
begin
if tmpprevrun='' then
   if checklistsel=0 then tmpprevrun:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]
   else tmpprevrun:=prevrun;
if not pInputQuery(txt_3_3_run, txt_3_3_runexp, '', tmpprevrun, false) then exit;
s:=tmpprevrun;
if s='' then exit;
{$IFDEF MSWINDOWS}
if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
w:=utf8decode(s);
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+w+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ELSE}
try
cl:=stringdelim(escapefilename(s,desk_env));
{$IFDEF DARWIN}
if s[1] = '/' then cl:='open '+cl
else cl:='open -a '+cl;
{$ENDIF}
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
except
end;
{$ENDIF}
if s<>FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row] then prevrun:=s;
end;

procedure prev_listcheckmotw(checktype,fname:ansistring);
var
   cl,in_param:ansistring;
   P:tprocessutf8;
begin
if checkfiledirname(FormPeach.EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.EditOpenIn.Text); exit; end;
if fname='*' then fname:=FormPeach.EditOpenIn.Text;
in_param:=stringdelim(escapefilename(fname,desk_env));
if checktype='full' then
   cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' MOTWFULL '+in_param
else
   cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' MOTW '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
peapexecute(P,cl);
P.Free;
end;

procedure listcheckmotw(checktype:ansistring);//test selected input for MoTW from file / archive browser
var
  i,rc:integer;
  s,bin_name,cl:ansistring;
  P:TProcessUTF8;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then exit;
enter_busy_status;
if fun<>'FILEBROWSER' then
   begin
   if (fun='UNPEA') or (fun='UNPAQ') or (fun='UNLPAQ') or (fun='UNACE') then //file manager preview not supported, apply to archive
      begin
      prev_listcheckmotw(checktype,'*');
      end
   else
      begin
      if checklistanysel<>0 then //nothing selected, apply to archive
         prev_listcheckmotw(checktype,'*')
      else
         if checktype='' then
            openwith_cust('preview','listcheckmotw',0)
         else
            openwith_cust('preview','listcheckmotw',1);
      end;
   exit_busy_status;
   exit;
   end;
s:='';
if checklistanysel<>0 then
   begin
   exit_busy_status;
   exit;
   end;
rc:=FormPeach.StringGridList.RowCount;
for i:=1 to rc-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      s:=s+' '+stringdelim(escapefilename(FormPeach.StringGridList.Cells[12,i],desk_env));
exit_busy_status;
if s='' then exit;
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
if checktype='full' then
   cl:=bin_name+' MOTWFULL'+s
else
   cl:=bin_name+' MOTW'+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
peapexecute(P,cl);
P.Free;
{$ENDIF}
end;

procedure layoutcheckmotw(sg:TStringGrid; checktype:ansistring); //test archive extract layout for MoTW, dirs are expanded recursively, stop at first match
var
   i,rc:integer;
   s,bin_name,cl:ansistring;
   P:TProcessUTF8;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then exit;
rc:=sg.RowCount;
if sg.Rowcount=1 then exit;
s:='';
for i:=1 to rc-1 do
   s:=s+' '+stringdelim(escapefilename(sg.Cells[8,i],desk_env));
if s='' then exit;
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
if checktype='full' then
   cl:=bin_name+' MOTWFULL'+s
else
   cl:=bin_name+' MOTW'+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
peapexecute(P,cl);
P.Free;
{$ENDIF}
end;

procedure getntfsads(streamtype:ansistring); //only for files
var
   s:ansistring;
   P:TProcessUTF8;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then exit;
if fun='FILEBROWSER' then
   if FormPeach.EditOpenIn.Text=txt_mypc then exit
   else
      if checklistsel<>0 then exit
      else
         begin
         if FormPeach.StringGridList.Cells[2,FormPeach.StringGridList.Row]=txt_list_isfolder then exit;
         s:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
         end
else s:=FormPeach.EditOpenIn.Text;
if s='' then exit;
P:=tprocessutf8.Create(nil);
P.Executable:='powershell.exe';
P.Parameters.Add('-NoExit');
if streamtype='*' then P.Parameters.Add('Get-Item '+QuotedStr(s)) else P.Parameters.Add('Get-Content '+QuotedStr(s+'*'));
P.Parameters.Add('-Stream '+streamtype);
peapparamexecute(P);
P.Free;
{$ENDIF}
end;

procedure newwin(initem:ansistring);
var
   instr,bin_name,cl:ansistring;
   i:integer;
   P:tprocessutf8;
begin
instr:=initem;
dodirseparators(instr);
i:=testinput(instr,true);
if i>=0 then
   begin
   save_conf;
   save_bookmarks;
   instr:=stringdelim(escapefilename(instr,desk_env));
   bin_name:=stringdelim(escapefilename(executable_path+'peazip'+EXEEXT,desk_env))+' -ext2openasarchive';
   cl:=bin_name+' '+instr;
   if FormPeach.Visible=true then Application.ProcessMessages;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   peapexecute(P,cl);
   P.Free;
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection FILE BROWSER

///////////////////////////////////////////////////////////////////////////////}

procedure enter_busy_status;//block navigation, browser and address bar context menus, and sorting while file manager is being updated
begin
if browserbusy=true then exit;
FormPeach.TimerBusy.enabled:=true;
FormPeach.ListViewBrowser.PopupMenu:=nil;
FormPeach.ImageListSearch.Picture.Bitmap:=Bgopath;
FormPeach.ImageListSearch.Hint:=txt_4_8_stop;
refreshstatus:=1;
pcount:=1;
FormPeach.Panelnav.Enabled:=False;
FormPeach.PanelListBar.Enabled:=False;
FormPeach.Panelside.Enabled:=False;
browserbusy:=true;
end;

{procedure enter_busy_status_special;//do not trigger refresh progress bar
begin
if browserbusy=true then exit;
//FormPeach.TimerBusy.enabled:=true;
FormPeach.ListViewBrowser.PopupMenu:=nil;
//FormPeach.ImageListSearch.Picture.Bitmap:=Bgopath;
//FormPeach.ImageListSearch.Hint:=txt_4_8_stop;
refreshstatus:=1;
pcount:=1;
FormPeach.Panelnav.Enabled:=False;
FormPeach.PanelListBar.Enabled:=False;
FormPeach.Panelside.Enabled:=False;
//browserbusy:=true;
end;}

procedure exit_busy_status;
begin
browserbusy:=false;
FormPeach.ProgressBar2.Visible:=False;
FormPeach.Panel10.Visible:=False;
FormPeach.ListViewBrowser.PopupMenu:=FormPeach.PopupOpen;
FormPeach.ListViewBrowser.Cursor:=crDefault;
FormPeach.ImageListSearch.Picture.Bitmap:=Bsearch;
FormPeach.ImageListSearch.Hint:=txt_searchfor;
FormPeach.Panelnav.Enabled:=True;
FormPeach.PanelListBar.Enabled:=True;
FormPeach.Panelside.Enabled:=True;
refreshstatus:=0;
end;

function openw_obj(outname:ansistring):integer;
var
   s:ansistring;
   woutname,wtempstring:widestring;
begin
openw_obj:=-1;
{$IFDEF MSWINDOWS}
if outname<>'' then
   if outname[length(outname)] <> directoryseparator then outname:=outname+directoryseparator;
s:=outname+tempstring;
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
woutname:=utf8decode(outname);
wtempstring:=utf8decode(tempstring);
if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
shellexecutew(FormPeach.handle, PWideChar('open'), PWideChar('RUNDLL32.EXE'), PWideChar('shell32.dll,OpenAs_RunDLL '+woutname+wtempstring), PWideChar (''), SW_SHOWNORMAL);
openw_obj:=0;
{$ENDIF}
end;

//open, cross platform, with sanitization of string passed to the function
function cp_open(s:ansistring; desk_env:byte):integer;
var
   w:widestring;
begin
cp_open:=-1;
if s='' then exit;
if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
{$IFDEF MSWINDOWS}
w:=utf8decode(s);
cp_open:=ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar(w), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
if cp_open<33 then
   cp_open:=shellexecuteW(FormPeach.handle,PWideChar('open'),PWideChar('RUNDLL32.EXE'),PWideChar('shell32.dll,OpenAs_RunDLL '+w),PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
{$IFDEF LINUX}cp_open:=cp_open_linuxlike(s,desk_env);{$ENDIF}//try to open via Gnome or KDE
{$IFDEF FREEBSD}cp_open:=cp_open_linuxlike(s,desk_env);{$ENDIF}
{$IFDEF NETBSD}cp_open:=cp_open_linuxlike(s,desk_env);{$ENDIF}
{$IFDEF OPENBSD}cp_open:=cp_open_linuxlike(s,desk_env);{$ENDIF}
{$IFDEF DARWIN}cp_open:=cp_open_linuxlike(s,desk_env);{$ENDIF}
end;

procedure cp_search(desk_env:byte);
begin
{$IFDEF MSWINDOWS}
shellexecutew(FormPeach.handle, PWideChar('find'), PWideChar(''), PWideChar(''), PWideChar (''), SW_SHOWNORMAL)
{$ENDIF}
{$IFDEF LINUX}cp_search_linuxlike(desk_env);{$ENDIF}//try to search via Gnome or KDE
{$IFDEF FREEBSD}cp_search_linuxlike(desk_env);{$ENDIF}
{$IFDEF NETBSD}cp_search_linuxlike(desk_env);{$ENDIF}
{$IFDEF OPENBSD}cp_search_linuxlike(desk_env);{$ENDIF}
{$IFDEF DARWIN}cp_search_linuxlike(desk_env);{$ENDIF}
end;

procedure cp_explorepath(s:AnsiString; desk_env: byte);
begin
{$IFDEF MSWINDOWS}
winexplorepath(s);
{$ELSE}
{$IFDEF DARWIN}
macexplorepath(s);
{$ENDIF}
cp_open(extractfilepath(s),desk_env);
{$ENDIF}
end;

function execute_obj(efun:byte; outname:ansistring):integer;
var
  mri,i:integer;
  P: tprocessutf8;
  cl,bin_name,s:ansistring;
  woutname,wtempstring:widestring;
begin
execute_obj:=-1;
if checkfiledirname(outname)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+outname); exit; end;
if (fun='UNARC') or (fun='UN7Z') then
   if outname<>'' then
      if specialopen=false then
         if outname[length(outname)]<>directoryseparator then outname:=outname+directoryseparator;
case efun of
   {0: //(extract the object)
      begin
      execute_obj:=0;
      tempstring:='';
      end;
   1: //(extract the object and) try to open output path
      begin
      if cp_open(outname,desk_env)<>0 then exit;
      execute_obj:=0;
      tempstring:='';
      end;}
   2: //(extract the object and) open it with PeaZip
      begin
      dodirseparators(tempstring);
      i:=testinput(outname+tempstring,true);
      //if ((i>=0) and (i<>1000)) then
      if i>=0 then
         begin
         save_conf;
         save_bookmarks;
         dodirseparators(tempstring);
         outname:=stringdelim(escapefilename(outname+tempstring,desk_env));
         bin_name:=stringdelim(escapefilename(executable_path+'peazip'+EXEEXT,desk_env))+' -ext2openasarchive';
         cl:=bin_name+' '+outname;
         if FormPeach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P:=tprocessutf8.Create(nil);
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ENDIF}//not needed {$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
         peapexecute(P,cl);
         execute_obj:=P.ExitStatus;
         P.Free;
         end;
      execute_obj:=0;
      tempstring:='';
      end;
   3: //(extract the object and) open with PeaZip if it's a supported filetype (excluding custom formats, packed executables, MS Office and Open Office formats), otherwise open it with the associated application
      begin
      dodirseparators(tempstring);
      i:=testext(outname+tempstring);
      if oafromgrid=true then i:=0; //if using "open as archive" from within archive, treat the type as generic archive
      if (i<0) //not a PeaZip supported filetype
         or (i=503)
         or (i=502)
         or (i=501) //file types usually not handled as archives
      then
         begin
         dodirseparators(tempstring);
         i:=cp_open(outname+tempstring,desk_env);
         end
      else //open in PeaZip
         begin
         {$IFDEF MSWINDOWS}//if it's a Windows executable, offer the possibility to run it instead of open it in PeaZip (Windows only)
         if i=500 then
            begin
            dodirseparators(tempstring);
            mri:=pMessageWarningYesNoCancel(txt_dis+' '+tempstring+' '+txt_type_exe);
            if mri=6 then
               begin
               dodirseparators(tempstring);
               woutname:=utf8decode(outname);
               wtempstring:=utf8decode(tempstring);
               s:=outname+tempstring;
               if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
               ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar(woutname+wtempstring), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
               execute_obj:=0;
               tempstring:='';
               exit;
               end
            else
               if mri<>7 then
                  begin
                  execute_obj:=0;
                  tempstring:='';
                  exit;
                  end;
            end;
         {$ENDIF}
         save_conf;
         save_bookmarks;
         dodirseparators(tempstring);
         outname:=stringdelim(escapefilename(outname+tempstring,desk_env));
         bin_name:=stringdelim(escapefilename(executable_path+'peazip'+EXEEXT,desk_env));
         cl:=bin_name+' -ext2open '+outname;
         if FormPeach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P:=tprocessutf8.Create(nil);
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ENDIF}//not needed {$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
         peapexecute(P,cl);
         execute_obj:=P.ExitStatus;
         P.Free;
         end;
      execute_obj:=0;
      tempstring:='';
      end;
   4: //(extract the object and) open it with the associated application
      begin
      dodirseparators(tempstring);
      i:=cp_open(outname+tempstring,desk_env);
      execute_obj:=0;
      tempstring:='';
      end;
   end;
end;

procedure clean_archive_breadcrumb;
begin
FormPeach.aabc1.Caption:='';
FormPeach.aabc2.Caption:='';
FormPeach.aabc3.Caption:='';
FormPeach.aabc4.Caption:='';
FormPeach.aabc5.Caption:='';
FormPeach.aabc6.Caption:='';
FormPeach.aabc7.Caption:='';
FormPeach.aabc8.Caption:='';
FormPeach.abc1.Caption:='';
FormPeach.abc2.Caption:='';
FormPeach.abc3.Caption:='';
FormPeach.abc4.Caption:='';
FormPeach.abc5.Caption:='';
FormPeach.abc6.Caption:='';
FormPeach.abc7.Caption:='';
FormPeach.abc8.Caption:='';
FormPeach.abc0.Caption:='';
FormPeach.aabc1.Visible:=false;
FormPeach.aabc2.Visible:=false;
FormPeach.aabc3.Visible:=false;
FormPeach.aabc4.Visible:=false;
FormPeach.aabc5.Visible:=false;
FormPeach.aabc6.Visible:=false;
FormPeach.aabc7.Visible:=false;
FormPeach.aabc8.Visible:=false;
FormPeach.abc1.Visible:=false;
FormPeach.abc2.Visible:=false;
FormPeach.abc3.Visible:=false;
FormPeach.abc4.Visible:=false;
FormPeach.abc5.Visible:=false;
FormPeach.abc6.Visible:=false;
FormPeach.abc7.Visible:=false;
FormPeach.abc8.Visible:=false;
FormPeach.abc0.Visible:=false;
FormPeach.ImageAdArchive0.Visible:=false;
FormPeach.PanelAdArchive0.Visible:=false;
FormPeach.LabelClickAdArchive1.Caption:='';
FormPeach.ImageAdArchive1.Visible:=false;
FormPeach.PanelAdArchive1.Visible:=false;
FormPeach.LabelClickAdArchive2.Caption:='';
FormPeach.ImageAdArchive2.Visible:=false;
FormPeach.PanelAdArchive2.Visible:=false;
FormPeach.LabelClickAdArchive3.Caption:='';
FormPeach.ImageAdArchive3.Visible:=false;
FormPeach.PanelAdArchive3.Visible:=false;
FormPeach.LabelClickAdArchive4.Caption:='';
FormPeach.pmbcexpand.Visible:=false;
FormPeach.apmbcexpand.Visible:=false;
FormPeach.pmbce.Visible:=false;
FormPeach.Separator25.Visible:=false;
end;

procedure generate_archive_breadcrumb;
var
  Str: TStringList;
  i, j, sc: integer;
  s: array [1..8] of ansistring;
  ars: array [1..4] of ansistring;
  abcs: array [1..4] of ansistring;
begin
clean_archive_breadcrumb;
if macbread=1 then
   begin
   FormPeach.ImageAdArchive0.Visible:=true;
   FormPeach.PanelAdArchive0.Visible:=true;
   FormPeach.LabelClickAddress8.Visible:=true;
   FormPeach.ImageAdArchive1.Visible:=true;
   FormPeach.PanelAdArchive1.Visible:=true;
   FormPeach.LabelClickAdArchive1.Visible:=true;
   FormPeach.ImageAdArchive2.Visible:=true;
   FormPeach.PanelAdArchive2.Visible:=true;
   FormPeach.LabelClickAdArchive2.Visible:=true;
   FormPeach.ImageAdArchive3.Visible:=true;
   FormPeach.PanelAdArchive3.Visible:=true;
   FormPeach.LabelClickAdArchive3.Visible:=true;
   end;
Str := TStringList.Create;
str.StrictDelimiter := True;
Str.Delimiter := PathDelim;
Str.DelimitedText := PathDelim+FormPeach.EditUn7zaFilterInteractive.Caption;
for i := Str.Count - 1 downto 0 do
   if Str[i] = '' then
      Str.Delete(i);
sc := Str.Count;
for j := 1 to 8 do s[j] :='';
for j := 1 to 4 do ars[j] :='';
for j := 1 to 4 do abcs[j] :='';
for j := 1 to 4 do abcrs[j] :='';
for j := 1 to 4 do
   if (sc - 2 - (4 - j)) >= 0 then
      begin
      s[j] := ' '+str[sc - 2 - (4 - j)]+' ';
      end;
for j := 1 to 4 do abcs[j] :='';
for j := 1 to 4 do
   if (sc - 2 - (4 - j)) >= 0 then
      for i := 0 to sc - 2 - (4 - j) do
         begin
         abcs[j] := abcs[j] + str[i];
         if abcs[j]<>FormPeach.EditUn7zaFilterInteractive.Caption then abcs[j]:=abcs[j]+ PathDelim;
         end;
i:=1;
for j:=1 to 4 do
   if s[j]<>'' then
      begin
      ars[i]:=s[j];
      abcrs[i]:=abcs[j];
      if length(FormPeach.EditUn7zaFilterInteractive.Caption)>2 then //special cases starting with double directoryseparator
         if pos(directoryseparator+directoryseparator, FormPeach.EditUn7zaFilterInteractive.Caption)=1 then
            abcrs[i]:=directoryseparator+directoryseparator+abcrs[i];
      if length(FormPeach.EditUn7zaFilterInteractive.Caption)>1 then //special cases starting with directoryseparator
         if pos(directoryseparator+directoryseparator, FormPeach.EditUn7zaFilterInteractive.Caption)=0 then
            if FormPeach.EditUn7zaFilterInteractive.Caption[1]=directoryseparator then abcrs[i]:=directoryseparator+abcrs[i];
      i:=i+1;
      end;
FormPeach.PanelLCAa1.Brush.Color:=abarchivecol;
FormPeach.PanelLCAa2.Brush.Color:=abarchivecol;
FormPeach.PanelLCAa3.Brush.Color:=abarchivecol;
FormPeach.PanelLCAa4.Brush.Color:=abarchivecol;
FormPeach.PanelLCA8.Brush.Color:=abarchivecol;
FormPeach.PanelLCAa1.pen.Color:=abarchivecol;
FormPeach.PanelLCAa2.pen.Color:=abarchivecol;
FormPeach.PanelLCAa3.pen.Color:=abarchivecol;
FormPeach.PanelLCAa4.pen.Color:=abarchivecol;
FormPeach.PanelLCA8.pen.Color:=abarchivecol;
FormPeach.LabelClickAdArchive1.Caption:=ars[1];
if ars[1]='' then
   begin
   FormPeach.ImageAdArchive0.Visible:=false;
   FormPeach.PanelAdArchive0.Visible:=false;
   FormPeach.LabelClickAdArchive1.AnchorSideLeft.Control:=FormPeach.PanelAddress7;
   FormPeach.LabelClickAdArchive1.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAdArchive0.Visible:=true;
   FormPeach.PanelAdArchive0.Visible:=true;
   FormPeach.PanelAdArchive0.AnchorSideLeft.Control:=FormPeach.LabelClickaddress8;
   FormPeach.PanelAdArchive0.AnchorSideLeft.Side:=asrRight;
   FormPeach.LabelClickAdArchive1.AnchorSideLeft.Control:=FormPeach.PanelAdArchive0;
   FormPeach.LabelClickAdArchive1.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAdArchive2.Caption:=ars[2];
if ars[2]='' then
   begin
   FormPeach.ImageAdArchive1.Visible:=false;
   FormPeach.PanelAdArchive1.Visible:=false;
   FormPeach.LabelClickAdArchive2.AnchorSideLeft.Control:=FormPeach.PanelAddress7;
   FormPeach.LabelClickAdArchive2.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAdArchive1.Visible:=true;
   FormPeach.PanelAdArchive1.Visible:=true;
   FormPeach.LabelClickAdArchive2.AnchorSideLeft.Control:=FormPeach.PanelAdArchive1;
   FormPeach.LabelClickAdArchive2.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAdArchive3.Caption:=ars[3];
if ars[3]='' then
   begin
   FormPeach.ImageAdArchive2.Visible:=false;
   FormPeach.PanelAdArchive2.Visible:=false;
   FormPeach.LabelClickAdArchive3.AnchorSideLeft.Control:=FormPeach.PanelAddress7;
   FormPeach.LabelClickAdArchive3.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAdArchive2.Visible:=true;
   FormPeach.PanelAdArchive2.Visible:=true;
   FormPeach.LabelClickAdArchive3.AnchorSideLeft.Control:=FormPeach.PanelAdArchive2;
   FormPeach.LabelClickAdArchive3.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAdArchive4.Caption:=ars[4];
if ars[4]='' then
   begin
   FormPeach.ImageAdArchive3.Visible:=false;
   FormPeach.PanelAdArchive3.Visible:=false;
   FormPeach.LabelClickAdArchive4.AnchorSideLeft.Control:=FormPeach.PanelAddress7;
   FormPeach.LabelClickAdArchive4.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAdArchive3.Visible:=true;
   FormPeach.PanelAdArchive3.Visible:=true;
   FormPeach.LabelClickAdArchive4.AnchorSideLeft.Control:=FormPeach.PanelAdArchive3;
   FormPeach.LabelClickAdArchive4.AnchorSideLeft.Side:=asrRight;
   end;

if macbread=1 then
begin
if ars[4]<>'' then
   begin
   FormPeach.ImageAdArchive0.Visible:=false;
   FormPeach.PanelAdArchive0.Visible:=false;
   FormPeach.LabelClickAddress8.Visible:=false;
   FormPeach.ImageAdArchive1.Visible:=false;
   FormPeach.PanelAdArchive1.Visible:=false;
   FormPeach.LabelClickAdArchive1.Visible:=false;
   FormPeach.ImageAdArchive2.Visible:=false;
   FormPeach.PanelAdArchive2.Visible:=false;
   FormPeach.LabelClickAdArchive2.Visible:=false;
   FormPeach.ImageAdArchive3.Visible:=false;
   FormPeach.PanelAdArchive3.Visible:=false;
   FormPeach.LabelClickAdArchive3.Visible:=false;
   end;
if ars[3]<>'' then
   begin
   FormPeach.ImageAdArchive0.Visible:=false;
   FormPeach.PanelAdArchive0.Visible:=false;
   FormPeach.LabelClickAddress8.Visible:=false;
   FormPeach.ImageAdArchive1.Visible:=false;
   FormPeach.PanelAdArchive1.Visible:=false;
   FormPeach.LabelClickAdArchive1.Visible:=false;
   FormPeach.ImageAdArchive2.Visible:=false;
   FormPeach.PanelAdArchive2.Visible:=false;
   FormPeach.LabelClickAdArchive2.Visible:=false;
   end;
if ars[2]<>'' then
   begin
   FormPeach.ImageAdArchive0.Visible:=false;
   FormPeach.PanelAdArchive0.Visible:=false;
   FormPeach.LabelClickAddress8.Visible:=false;
   FormPeach.ImageAdArchive1.Visible:=false;
   FormPeach.PanelAdArchive1.Visible:=false;
   FormPeach.LabelClickAdArchive1.Visible:=false;
   end;
if ars[1]<>'' then
   begin
   FormPeach.ImageAdArchive0.Visible:=false;
   FormPeach.PanelAdArchive0.Visible:=false;
   FormPeach.LabelClickAddress8.Visible:=false;
   end;
end;

for j := 1 to 8 do s[j] :='';
for j := 1 to 8 do
   if (sc - 2 - (8 - j)) >= 0 then
      for i := 0 to sc - 2 - (8 - j) do
         begin
         s[j] := s[j] + str[i];
         if s[j]<>FormPeach.EditUn7zaFilterInteractive.Caption then s[j]:=s[j]+ PathDelim;
         end;

if length(FormPeach.EditUn7zaFilterInteractive.Caption)>2 then
   if pos(directoryseparator+directoryseparator, FormPeach.EditUn7zaFilterInteractive.Caption)=1 then
      for j := 1 to 8 do s[j]:=directoryseparator+directoryseparator+s[j];

Str.Free;
FormPeach.aabc1.Bitmap:=BFolder;
FormPeach.aabc2.Bitmap:=FormPeach.aabc1.Bitmap;
FormPeach.aabc3.Bitmap:=FormPeach.aabc1.Bitmap;
FormPeach.aabc4.Bitmap:=FormPeach.aabc1.Bitmap;
FormPeach.aabc5.Bitmap:=FormPeach.aabc1.Bitmap;
FormPeach.aabc6.Bitmap:=FormPeach.aabc1.Bitmap;
FormPeach.aabc7.Bitmap:=FormPeach.aabc1.Bitmap;
FormPeach.aabc8.Bitmap:=FormPeach.aabc1.Bitmap;
FormPeach.abc1.Bitmap:=BFolder;
FormPeach.abc2.Bitmap:=FormPeach.abc1.Bitmap;
FormPeach.abc3.Bitmap:=FormPeach.abc1.Bitmap;
FormPeach.abc4.Bitmap:=FormPeach.abc1.Bitmap;
FormPeach.abc5.Bitmap:=FormPeach.abc1.Bitmap;
FormPeach.abc6.Bitmap:=FormPeach.abc1.Bitmap;
FormPeach.abc7.Bitmap:=FormPeach.abc1.Bitmap;
FormPeach.abc8.Bitmap:=FormPeach.abc1.Bitmap;
FormPeach.abc0.Bitmap:=BArchiveSupported;
if (s[8]<>'') and (s[8]<>directoryseparator+directoryseparator) then FormPeach.abc1.Caption:=s[8]+'*';
if (s[7]<>'') and (s[7]<>directoryseparator+directoryseparator) then FormPeach.abc2.Caption:=s[7]+'*';
if (s[6]<>'') and (s[6]<>directoryseparator+directoryseparator) then FormPeach.abc3.Caption:=s[6]+'*';
if (s[5]<>'') and (s[5]<>directoryseparator+directoryseparator) then FormPeach.abc4.Caption:=s[5]+'*';
if (s[4]<>'') and (s[4]<>directoryseparator+directoryseparator) then FormPeach.abc5.Caption:=s[4]+'*';
if (s[3]<>'') and (s[3]<>directoryseparator+directoryseparator) then FormPeach.abc6.Caption:=s[3]+'*';
if (s[2]<>'') and (s[2]<>directoryseparator+directoryseparator) then FormPeach.abc7.Caption:=s[2]+'*';
if (s[1]<>'') and (s[1]<>directoryseparator+directoryseparator) then FormPeach.abc8.Caption:=s[1]+'*';
FormPeach.abc0.Caption:=extractfilename(FormPeach.EditOpenIn.Text);
if FormPeach.abc1.Caption='' then FormPeach.abc1.Visible:=false else FormPeach.abc1.Visible:=true;
if FormPeach.abc2.Caption='' then FormPeach.abc2.Visible:=false else FormPeach.abc2.Visible:=true;
if FormPeach.abc3.Caption='' then FormPeach.abc3.Visible:=false else FormPeach.abc3.Visible:=true;
if FormPeach.abc4.Caption='' then FormPeach.abc4.Visible:=false else FormPeach.abc4.Visible:=true;
if FormPeach.abc5.Caption='' then FormPeach.abc5.Visible:=false else FormPeach.abc5.Visible:=true;
if FormPeach.abc6.Caption='' then FormPeach.abc6.Visible:=false else FormPeach.abc6.Visible:=true;
if FormPeach.abc7.Caption='' then FormPeach.abc7.Visible:=false else FormPeach.abc7.Visible:=true;
if FormPeach.abc8.Caption='' then FormPeach.abc8.Visible:=false else FormPeach.abc8.Visible:=true;
if FormPeach.abc0.Caption='' then FormPeach.abc0.Visible:=false else FormPeach.abc0.Visible:=true;
FormPeach.pmbcexpand.Visible:=FormPeach.abc0.Visible;
FormPeach.apmbcexpand.Visible:=FormPeach.abc0.Visible;
FormPeach.pmbce.Visible:=FormPeach.abc0.Visible;
FormPeach.Separator25.Visible:=FormPeach.abc0.Visible;
FormPeach.aabc1.Caption:=FormPeach.abc1.Caption;
FormPeach.aabc2.Caption:=FormPeach.abc2.Caption;
FormPeach.aabc3.Caption:=FormPeach.abc3.Caption;
FormPeach.aabc4.Caption:=FormPeach.abc4.Caption;
FormPeach.aabc5.Caption:=FormPeach.abc5.Caption;
FormPeach.aabc6.Caption:=FormPeach.abc6.Caption;
FormPeach.aabc7.Caption:=FormPeach.abc7.Caption;
FormPeach.aabc8.Caption:=FormPeach.abc8.Caption;
FormPeach.aabc1.Visible:=FormPeach.abc1.Visible;
FormPeach.aabc2.Visible:=FormPeach.abc2.Visible;
FormPeach.aabc3.Visible:=FormPeach.abc3.Visible;
FormPeach.aabc4.Visible:=FormPeach.abc4.Visible;
FormPeach.aabc5.Visible:=FormPeach.abc5.Visible;
FormPeach.aabc6.Visible:=FormPeach.abc6.Visible;
FormPeach.aabc7.Visible:=FormPeach.abc7.Visible;
FormPeach.aabc8.Visible:=FormPeach.abc8.Visible;

if pos('\\.\',FormPeach.EditOpenIn.Text)=1 then
   begin
   FormPeach.LabelClickAddress1.Caption:='';
   FormPeach.LabelClickAddress2.Caption:='';
   FormPeach.LabelClickAddress3.Caption:='';
   FormPeach.LabelClickAddress4.Caption:='';
   FormPeach.LabelClickAddress5.Caption:='';
   FormPeach.LabelClickAddress6.Caption:='';
   FormPeach.LabelClickAddress7.Caption:='';
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.ImageAddress4.Visible:=false;
   FormPeach.ImageAddress5.Visible:=false;
   FormPeach.ImageAddress6.Visible:=false;
   FormPeach.ImageAddress7.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.PanelAddress3.Visible:=false;
   FormPeach.PanelAddress4.Visible:=false;
   FormPeach.PanelAddress5.Visible:=false;
   FormPeach.PanelAddress6.Visible:=false;
   FormPeach.PanelAddress7.Visible:=false;
   FormPeach.PanelLCA1.Visible:=false;
   FormPeach.PanelLCA2.Visible:=false;
   FormPeach.PanelLCA3.Visible:=false;
   FormPeach.PanelLCA4.Visible:=false;
   FormPeach.PanelLCA5.Visible:=false;
   FormPeach.PanelLCA6.Visible:=false;
   FormPeach.PanelLCA7.Visible:=false;
   FormPeach.LabelClickAddress8.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress8.AnchorSideLeft.Side:=asrRight;
   FormPeach.LabelClickAddress8.Caption:=' '+FormPeach.EditOpenIn.Text+' ';
   FormPeach.PanelLCA8.Brush.Color:=FormPeach.Panelclickaddress.Color;
   FormPeach.PanelLCA8.Pen.Color:=FormPeach.PanelLCA8.Brush.Color;
   end;
if altbread>0 then
   begin
   FormPeach.ImageAdArchive0.Visible:=false;
   FormPeach.ImageAdArchive1.Visible:=false;
   FormPeach.ImageAdArchive2.Visible:=false;
   FormPeach.ImageAdArchive3.Visible:=false;
   setfontsbreadcrumb;
   end;
end;

procedure get_statuss(s:ansistring);
var
   d:char;
   j:integer;
   sizefree,sizetotal,perfree: int64;
   wp:ansistring;
begin
sizefree:=0;
perfree:=0;
sizefreeout:=-1;
sizefreewrk:=-1;
statuss:='';
statusw:='';

{$IFNDEF MSWINDOWS}
sizefree:=diskfree(AddDisk(extractfilepath(s)));
sizetotal:=disksize(AddDisk(extractfilepath(s)));
if sizetotal<>0 then perfree:=(sizefree*100) div sizetotal;
sizefreeout:=sizefree;
statuss:=nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
if work_dir = 5 then exit;
if work_dir > 1 then wp:=peaziptmpdirroot else wp:=s;
if wp='' then exit;
if extractfilepath(wp)='' then exit;
sizefree:=diskfree(AddDisk(extractfilepath(wp)));
sizetotal:=disksize(AddDisk(extractfilepath(wp)));
if sizetotal<>0 then perfree:=(sizefree*100) div sizetotal;
sizefreewrk:=sizefree;
statusw:=nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
{$ENDIF}

with FormPeach do
begin
{$IFDEF MSWINDOWS}
if s='' then exit;
if extractfilepath(s)='' then exit;
if (s=txt_mypc) or (s='Compter''s root') then exit;
d:=s[1];
if d<>directoryseparator then
   begin
   j:=ord(upcase(d))-64;
   if j>2 then
      begin
      sizefree:=diskfree(j);
      sizetotal:=disksize(j);
      if sizetotal<>0 then perfree:=(sizefree*100) div sizetotal;
      end;
   sizefreeout:=sizefree;
   statuss:=nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
   end;

//sizefreewrk extimation should be more accurate if calculated separately in case of multiple inputs
if work_dir = 5 then exit;

if FormPeach.PanelArchive.visible=true then
   case fun of
   '7Z', 'ARC': //used only for 7z and arc backends
      begin
      end;
   else //also needed when TAR before is in use
      if FormPeach.CheckBoxTarBefore.State=cbChecked then else exit;
   end;

if FormPeach.PanelExtract.visible=true then
case fun of
   'UN7Z', 'FILEBROWSER'://used only for 7z backend, assume it is needed also in case of mixed formats
      begin
      if (FormPeach.CheckBoxrelative.Checked=true) and
         (FormPeach.CheckBoxrelative.Enabled=true) and
         (FormPeach.CheckBoxFolder.Checked=false) then
      else exit;
      end;
   else exit;
   end;

//if FormPeach.PanelOpen.visible=true then begin end; //always used for drag and drop extraction

if work_dir > 1 then wp:=peaziptmpdirroot else wp:=s;
if wp='' then exit;
if extractfilepath(wp)='' then exit;
if (wp=txt_mypc) or (wp='Compter''s root') then exit;
d:=wp[1];
if d<>directoryseparator then
   begin
   j:=ord(upcase(d))-64;
   if j>2 then
      begin
      sizefree:=diskfree(j);
      sizetotal:=disksize(j);
      if sizetotal<>0 then perfree:=(sizefree*100) div sizetotal;
      end;
   sizefreewrk:=sizefree;
   statusw:=nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
   end;
{$ENDIF}
end;
end;

procedure get_statussdrag(dragdest:ansistring);
var
   d:char;
   j:integer;
   sizefree: int64;
begin
sizefree:=0;
with FormPeach do
begin
{$IFDEF MSWINDOWS}
if dragdest='' then exit;
if extractfilepath(dragdest)='' then exit;
if (dragdest=txt_mypc) or (dragdest='Compter''s root') then exit;
d:=dragdest[1];
if d<>directoryseparator then
   begin
   j:=ord(upcase(d))-64;
   if j>2 then
      begin
      sizefree:=diskfree(j);
      end;
   sizefreeout:=sizefree;
   end;
{$ENDIF}
end;
end;

function count_clipboard:ansistring;
var
   i,ir,ncopyfiles,ncopyfolders,ncutfiles,ncutfolders:integer;
begin
result:='';
ncutfolders:=0;
ncutfiles:=0;
ncopyfolders:=0;
ncopyfiles:=0;
with FormPeach do
begin
ir:=StringGridClipboard.RowCount-1;
if ir<1 then exit;
for i:=1 to ir do
   if StringGridClipboard.Cells[0,i]=txt_cut then
      if StringGridClipboard.Cells[2,i]=txt_list_isfolder then ncutfolders:=ncutfolders+1
      else ncutfiles:=ncutfiles+1
   else
      if StringGridClipboard.Cells[2,i]=txt_list_isfolder then ncopyfolders:=ncopyfolders+1
      else ncopyfiles:=ncopyfiles+1;
if ncutfiles+ncutfolders>0 then
   begin
   result:=txt_cut;
   if ncutfolders>0 then result:=result+' '+inttostr(ncutfolders)+' '+txt_dirs;
   if ncutfiles>0 then result:=result+' '+inttostr(ncutfiles)+' '+txt_files;
   end;
if ncopyfiles+ncopyfolders>0 then
   begin
   if result<>'' then result:=result+' '+txt_copy else result:=txt_copy;
   if ncopyfolders>0 then result:=result+' '+inttostr(ncopyfolders)+' '+txt_dirs;
   if ncopyfiles>0 then result:=result+' '+inttostr(ncopyfiles)+' '+txt_files;
   end;
if result<>'' then result:=txt_2_7_clipboard+': '+result;
if result<>'' then
   if result[length(result)]=',' then setlength(result,length(result)-1);
end;
end;

procedure set_statuss_nav;
var s:ansistring;
begin
do_calcstatus;
FormPeach.LabelStatusdisplayed.Hint:=statushint;
FormPeach.LabelStatus.Hint:=statushint;
FormPeach.LabelClipinfo.Caption:=count_clipboard;
FormPeach.LabelStatusClip.Caption:=FormPeach.LabelClipinfo.Caption;
if FormPeach.LabelStatusClip.Caption<>'' then FormPeach.LabelStatusClip.Visible:=true else FormPeach.LabelStatusClip.Visible:=false;
end;

procedure set_listview_cnames;
var
   c:integer;
   chstr:ansistring;
begin
case browserch of
   1: chstr:='Adler32';
   2: chstr:='CRC16';
   3: chstr:='CRC24';
   4: chstr:='CRC32';
   5: chstr:='CRC64';
   6: chstr:='eDonkey';
   7: chstr:='MD4';
   8: chstr:='MD5';
   9: chstr:='Ripemd160';
  10: chstr:='SHA1';
  11: chstr:='BLAKE2S';
  12: chstr:='SHA256';
  13: chstr:='SHA-3 256';
  14: chstr:='BLAKE2B';
  15: chstr:='SHA512';
  16: chstr:='SHA-3 512';
  17: chstr:='Whirlpool512';
   end;
FormPeach.po_checksum.Caption:=txt_check_select+' ('+chstr+')';
FormPeach.pmccrc.Caption:=chstr;
FormPeach.pmcheck.Caption:=txt_check_select+' ('+chstr+')';
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   FormPeach.ListViewBrowser.Column[0].Caption:=txt_name;
   FormPeach.ListViewBrowser.Column[1].Caption:=txt_type;
   FormPeach.ListViewBrowser.Column[2].Caption:=txt_size;
   FormPeach.ListViewBrowser.Column[3].Caption:=txt_free;
   FormPeach.ListViewBrowser.Column[4].Caption:=txt_fs;
   FormPeach.ListViewBrowser.Column[9].Caption:=txt_attributes;
   FormPeach.ListViewBrowser.Column[10].Caption:=txt_check_select;
   FormPeach.ListViewBrowser.Column[11].Caption:=txt_name_full;
   end
else
   begin
   FormPeach.ListViewBrowser.Column[0].Caption:=txt_name;
   FormPeach.ListViewBrowser.Column[1].Caption:=txt_type;
   FormPeach.ListViewBrowser.Column[2].Caption:=txt_size;
   if fun<>'FILEBROWSER' then FormPeach.ListViewBrowser.Column[3].Caption:=txt_compressed_size else FormPeach.ListViewBrowser.Column[3].Caption:=txt_info;
   FormPeach.ListViewBrowser.Column[4].Caption:=txt_8_2_tm;
   FormPeach.ListViewBrowser.Column[5].Caption:=txt_8_2_tc;
   FormPeach.ListViewBrowser.Column[6].Caption:=txt_8_2_ta;
   FormPeach.ListViewBrowser.Column[7].Caption:=txt_method;
   FormPeach.ListViewBrowser.Column[8].Caption:=txt_7_4_comment;
   FormPeach.ListViewBrowser.Column[9].Caption:=txt_attributes;
   if fun<>'FILEBROWSER' then FormPeach.ListViewBrowser.Column[10].Caption:=txt_check_select else FormPeach.ListViewBrowser.Column[10].Caption:=chstr;
   FormPeach.ListViewBrowser.Column[11].Caption:=txt_name_full;
   end;
c:=listsortcol;
if c=13 then c:=1;
if c=14 then c:=3;
if c=15 then c:=4;
if c>12 then c:=1;
c:=c-1;
if c>=0 then
   if FormPeach.StringGridlist.SortOrder=soAscending then FormPeach.ListViewBrowser.Column[c].Caption:=FormPeach.ListViewBrowser.Column[c].Caption+' <'
   else FormPeach.ListViewBrowser.Column[c].Caption:=FormPeach.ListViewBrowser.Column[c].Caption+' >';
sortstatusstring:=FormPeach.ListViewBrowser.Column[c].Caption;
if status0<>txt_list_browsing then
   FormPeach.LabelStatusdisplayed.Caption:=status0+' '+status1
else
   FormPeach.LabelStatusdisplayed.Caption:=status1;
set_statuss_nav;
set_organizebrowsermenu_sort(c);
end;

procedure set_listview_visiblecol;
begin
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   if ctype=false then begin FormPeach.ListViewBrowser.Column[1].Width:=0; end;
   if csize=false then begin FormPeach.ListViewBrowser.Column[2].Width:=0; end;
   if cfree=false then begin FormPeach.ListViewBrowser.Column[3].Width:=0; end;
   if cfs=false then begin FormPeach.ListViewBrowser.Column[4].Width:=0; end;
   FormPeach.ListViewBrowser.Column[5].Width:=0;
   FormPeach.ListViewBrowser.Column[6].Width:=0;
   FormPeach.ListViewBrowser.Column[7].Width:=0;
   FormPeach.ListViewBrowser.Column[8].Width:=0;
   FormPeach.ListViewBrowser.Column[9].Width:=0;
   end
else
   begin
   if ctype=false then begin FormPeach.ListViewBrowser.Column[1].Width:=0; end;
   if csize=false then begin FormPeach.ListViewBrowser.Column[2].Width:=0; end;
   if cpacked=false then begin FormPeach.ListViewBrowser.Column[3].Width:=0; end;
   if cdate=false then begin FormPeach.ListViewBrowser.Column[4].Width:=0; end;
   if catt=false then begin FormPeach.ListViewBrowser.Column[9].Width:=0; end;
   if ccrc=false then begin FormPeach.ListViewBrowser.Column[10].Width:=0; end;
   if fun<>'UN7Z' then
      begin
      FormPeach.ListViewBrowser.Column[5].Width:=0;
      FormPeach.ListViewBrowser.Column[6].Width:=0;
      FormPeach.ListViewBrowser.Column[7].Width:=0;
      FormPeach.mccreated.Enabled:=False;
      FormPeach.mcaccessed.Enabled:=False;
      FormPeach.mcmethod.Enabled:=False;
      FormPeach.mccomment.Enabled:=False;
      FormPeach.pmccreated.Enabled:=False;
      FormPeach.pmcaccessed.Enabled:=False;
      FormPeach.pmcmethod.Enabled:=False;
      FormPeach.pmccomment.Enabled:=False;
      end
   else
      begin
      if ccreated=false then begin FormPeach.ListViewBrowser.Column[5].Width:=0; end;
      if caccessed=false then begin FormPeach.ListViewBrowser.Column[6].Width:=0; end;
      if cmethod=false then begin FormPeach.ListViewBrowser.Column[7].Width:=0; end;
      if ccomment=false then begin FormPeach.ListViewBrowser.Column[8].Width:=0; end;
      FormPeach.mccreated.Enabled:=True;
      FormPeach.mcaccessed.Enabled:=True;
      FormPeach.mcmethod.Enabled:=True;
      FormPeach.mccomment.Enabled:=True;
      FormPeach.pmccreated.Enabled:=True;
      FormPeach.pmcaccessed.Enabled:=True;
      FormPeach.pmcmethod.Enabled:=True;
      FormPeach.pmccomment.Enabled:=True;
      end;
   end;
end;

procedure set_listview_col;
begin
set_listview_cnames;
frompc:=false;
if browsertype=0 then
begin
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   frompc:=true;
   FormPeach.ListViewBrowser.Column[0].Width:=COL1D;
   FormPeach.ListViewBrowser.Column[1].Width:=COL7D;
   FormPeach.ListViewBrowser.Column[2].Width:=COL2D;
   FormPeach.ListViewBrowser.Column[3].Width:=COL2D;
   FormPeach.ListViewBrowser.Column[4].Width:=COL5D;
   FormPeach.ListViewBrowser.Column[5].Width:=0;
   FormPeach.ListViewBrowser.Column[6].Width:=0;
   FormPeach.ListViewBrowser.Column[7].Width:=0;
   FormPeach.ListViewBrowser.Column[8].Width:=0;
   FormPeach.ListViewBrowser.Column[9].Width:=0;
   FormPeach.ListViewBrowser.Column[10].Width:=0;
   FormPeach.ListViewBrowser.Column[11].Width:=0;
   end
else
   begin
   if fun<>'UN7Z' then
      begin
      FormPeach.ListViewBrowser.Column[0].Width:=col1size;
      FormPeach.ListViewBrowser.Column[1].Width:=col2size;
      FormPeach.ListViewBrowser.Column[2].Width:=col3size;
      FormPeach.ListViewBrowser.Column[3].Width:=col4size;
      FormPeach.ListViewBrowser.Column[4].Width:=col5size;
      FormPeach.ListViewBrowser.Column[5].Width:=0;
      FormPeach.ListViewBrowser.Column[6].Width:=0;
      FormPeach.ListViewBrowser.Column[7].Width:=0;
      FormPeach.ListViewBrowser.Column[8].Width:=0;
      FormPeach.ListViewBrowser.Column[9].Width:=col6size;
      FormPeach.ListViewBrowser.Column[10].Width:=col7size;
      end
   else
      begin
      FormPeach.ListViewBrowser.Column[0].Width:=col1size;
      FormPeach.ListViewBrowser.Column[1].Width:=col2size;
      FormPeach.ListViewBrowser.Column[2].Width:=col3size;
      FormPeach.ListViewBrowser.Column[3].Width:=col4size;
      FormPeach.ListViewBrowser.Column[4].Width:=col5size;
      FormPeach.ListViewBrowser.Column[5].Width:=col5size;
      FormPeach.ListViewBrowser.Column[6].Width:=col5size;
      FormPeach.ListViewBrowser.Column[7].Width:=colmethodsize;
      FormPeach.ListViewBrowser.Column[8].Width:=colcommentsize;
      FormPeach.ListViewBrowser.Column[9].Width:=col6size;
      FormPeach.ListViewBrowser.Column[10].Width:=col7size;
      end;
   {$IFDEF MSWINDOWS}
   if status0=txt_list_browsing then FormPeach.ListViewBrowser.Column[11].Width:=0
   else FormPeach.ListViewBrowser.Column[11].Width:=384;
   {$ELSE}
   if status0=txt_list_browsing then FormPeach.ListViewBrowser.Column[11].Visible:=false
   else begin FormPeach.ListViewBrowser.Column[11].Visible:=true; FormPeach.ListViewBrowser.Column[11].Width:=384; end;
   {$ENDIF}
   end;
set_listview_visiblecol;
end;
{$IFNDEF MSWINDOWS}
if browsertype=1 then //Lazarus 1.0.6 set GTK vslist style with only column 0 visible (due to minimum size constrain)
begin
FormPeach.ListViewBrowser.Column[1].Width:=0;
FormPeach.ListViewBrowser.Column[2].Width:=0;
FormPeach.ListViewBrowser.Column[3].Width:=0;
FormPeach.ListViewBrowser.Column[4].Width:=0;
FormPeach.ListViewBrowser.Column[5].Width:=0;
FormPeach.ListViewBrowser.Column[6].Width:=0;
FormPeach.ListViewBrowser.Column[7].Width:=0;
FormPeach.ListViewBrowser.Column[8].Width:=0;
FormPeach.ListViewBrowser.Column[9].Width:=0;
FormPeach.ListViewBrowser.Column[10].Width:=0;
FormPeach.ListViewBrowser.Column[11].Width:=0;
end;
{$ENDIF}
end;

procedure update_info;
var
   stitle1,stitle2:ansistring;
   a,b,a1,a2,b1,b2:qword;
   {$IFDEF MSWINDOWS}
   memory: TMemoryStatus; //note: supports up to 2 GB of RAM (4 if largememaware): GlobalMemoryStatus should be replaced with GlobalMemoryStatusEx call (currently unavailable in Lazarus)
   {$ENDIF}
begin
stitle1:=FormPeach.EditOpenIn.Text;
if length(stitle1)>1 then //exclude '' and '/'
   if stitle1[length(stitle1)]=directoryseparator then setlength(stitle1, length(stitle1)-1);
if extractfilename(stitle1)<>'' then stitle1:=extractfilename(stitle1);
{$IFDEF MSWINDOWS}
if stitle1<>'' then
   if stitle1[length(stitle1)]=':' then stitle1:=stitle1+directoryseparator;
{$ENDIF}
if status0=txt_list_flat then stitle1:=stitle1+' | '+txt_flat;
if archive_content='' then
else
   begin
   if seemencrypted=true then stitle2:='('+txt_encrypted+') | '+archive_content
   else stitle2:='| '+archive_content;
   if archive_content=txt_list_nomatch+txt_2_7_list_tryflatorpw then stitle2:='| '+archive_content;
   end;
if fun<>'FILEBROWSER' then stitle2:='| '+getmagicbytes_arc(FormPeach.EditOpenIn.Text)+' '+stitle2;
FormPeach.Caption:=stitle1+' '+stitle2;
if statusr=txt_list_found then status0:=statusr;
with FormPeach do
begin
if pathistmp(EditOpenIn.Text)=true then
   begin
   FormPeach.PanelAddress.Brush.Color:=StringToColor(colalertp);
   FormPeach.ShapeListBar.Brush.Color:=StringToColor(colalertp);
   end
else
   case altaddressstyle of
      3: begin
         FormPeach.PanelAddress.Brush.Color:=FormPeach.Color;
         FormPeach.ShapeListBar.Brush.Color:=FormPeach.Color;
         end;
      0: begin
         FormPeach.PanelAddress.Brush.Color:=FormPeach.Color;
         FormPeach.ShapeListBar.Brush.Color:=FormPeach.Color;
         end;
      1: begin
         FormPeach.PanelAddress.Brush.Color:=StringToColor(collow);
         FormPeach.ShapeListBar.Brush.Color:=StringToColor(collow);
         end;
      2:
         begin
         FormPeach.PanelAddress.Brush.Color:=pvvvlblue;
         FormPeach.ShapeListBar.Brush.Color:=pvvvlblue;
         end;
      end;

Panelclickaddress.Color:=PanelAddress.Brush.Color;
PanelAddress.Color:=Panelclickaddress.Color;
EditOpenIn.Color:=PanelAddress.Brush.Color;
EditOpenInInteractive.Color:=PanelAddress.Brush.Color;
PanelListRoot.Color:=PanelAddress.Brush.Color;
if altbread=1 then
   begin
   PanelListSearch.Color:=PanelListBar.Brush.Color;
   PanelSearch.Color:=PanelListBar.Brush.Color;
   EditUn7zafilter.Color:=PanelListBar.Brush.Color;
   EditUn7zaFilterInteractive.Color:=PanelListBar.Brush.Color;
   PanelListResetSearch.Color:=PanelListBar.Brush.Color;
   end
else
   begin
   PanelListSearch.Color:=PanelAddress.Brush.Color;
   PanelSearch.Color:=PanelAddress.Brush.Color;
   EditUn7zafilter.Color:=PanelAddress.Brush.Color;
   EditUn7zaFilterInteractive.Color:=PanelAddress.Brush.Color;
   PanelListResetSearch.Color:=PanelAddress.Brush.Color;
   end;
PanelAddress0.Color:=PanelAddress.Brush.Color;
PanelAddress1.Color:=PanelAddress.Brush.Color;
PanelAddress2.Color:=PanelAddress.Brush.Color;
PanelAddress3.Color:=PanelAddress.Brush.Color;
PanelAddress4.Color:=PanelAddress.Brush.Color;
PanelAddress5.Color:=PanelAddress.Brush.Color;
PanelAddress6.Color:=PanelAddress.Brush.Color;
PanelAddress7.Color:=PanelAddress.Brush.Color;
PanelAdArchive4.Color:=PanelAddress.Brush.Color;
if altbread>0 then
   begin
   PanelAdArchive0.Color:=PanelAddress.Brush.Color;
   PanelAdArchive1.Color:=PanelAddress.Brush.Color;
   PanelAdArchive2.Color:=PanelAddress.Brush.Color;
   PanelAdArchive3.Color:=PanelAddress.Brush.Color;
   end
else
   begin
   PanelAdArchive0.Color:=abarchivecol;
   PanelAdArchive1.Color:=abarchivecol;
   PanelAdArchive2.Color:=abarchivecol;
   PanelAdArchive3.Color:=abarchivecol;
   end;
PanelLCA1.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA2.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA3.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA4.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA5.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA6.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA7.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA8.Brush.Color:=PanelAddress.Brush.Color;
PanelLCA1.Pen.Color:=PanelAddress.Brush.Color;
PanelLCA2.Pen.Color:=PanelAddress.Brush.Color;
PanelLCA3.Pen.Color:=PanelAddress.Brush.Color;
PanelLCA4.Pen.Color:=PanelAddress.Brush.Color;
PanelLCA5.Pen.Color:=PanelAddress.Brush.Color;
PanelLCA6.Pen.Color:=PanelAddress.Brush.Color;
PanelLCA7.Pen.Color:=PanelAddress.Brush.Color;
PanelLCA8.Pen.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa1.Brush.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa2.Brush.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa3.Brush.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa4.Brush.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa1.pen.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa2.pen.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa3.pen.Color:=PanelAddress.Brush.Color;
FormPeach.PanelLCAa4.pen.Color:=PanelAddress.Brush.Color;
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   try
   infocpu:=GetEnvironmentVariable('NUMBER_OF_PROCESSORS')+' CPU';
   memory.dwLength := SizeOf(memory);
   GlobalMemoryStatus(memory); //note: currently declared as procedure, cannot be checked for overflow
   a1:=memory.dwAvailPhys;
   a2:=memory.dwTotalPhys;
   if (a2)<>0 then a:=(a1) * 100 div (a2);
   b1:=memory.dwAvailPageFile;
   b2:=memory.dwTotalPagefile;
   if (b2)<>0 then b:=(b1) * 100 div (b2);
   inforam:=nicenumber(inttostr(memory.dwTotalPhys),filesizebase)+' RAM, '+nicenumber(inttostr(memory.dwAvailPhys),filesizebase)+' '+txt_free2+' ('+inttostr(a)+'%)';
   infomem:=nicenumber(inttostr(memory.dwTotalPageFile),filesizebase)+' '+txt_2_4_totalmem+' '+nicenumber(inttostr(memory.dwAvailPageFile),filesizebase)+' '+txt_free2+' ('+inttostr(b)+'%)';
   except
   end;
   end;
{$ENDIF}
end;
testrarlocked;
end;

procedure update_selstatus;
var
   i,rc:integer;
   selfolders,selfiles:integer;
   selsize,selcsize,selper:qword;
begin
rc:=FormPeach.Stringgridlist.Rowcount;
selfolders:=0;
selfiles:=0;
selsize:=0;
selcsize:=0;
selper:=0;
if FormPeach.EditOpenIn.Text<>txt_mypc then
   if rc>1 then
      for i:=1 to rc-1 do
         if FormPeach.StringGridList.Cells[16,i]='1' then
            begin
            if FormPeach.StringGridList.Cells[1,i]='' then Break;
            if FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder then selfiles:=selfiles+1
            else selfolders:=selfolders+1;
            try
            if FormPeach.StringGridList.Cells[3,i]<>'' then selsize:=selsize+strtoqword(FormPeach.StringGridList.Cells[3,i]);
            if FormPeach.StringGridList.Cells[4,i]<>'' then selcsize:=selcsize+strtoqword(FormPeach.StringGridList.Cells[4,i]);
            except
            end;
            end;
FormPeach.LabelStatus.Caption:=txt_2_9_selected+' '+inttostr(selfolders)+' '+txt_dirs+' '+inttostr(selfiles)+' '+txt_files+' '+nicenumber(inttostr(selsize),filesizebase);
if selcsize<>0 then FormPeach.LabelStatus.Caption:=FormPeach.LabelStatus.Caption+' > '+nicenumber(inttostr(selcsize),filesizebase);
if selsize<>0 then selper:=(selcsize*100) div selsize;
if (selper>0) and (selper<101) then if selcsize<>0 then FormPeach.LabelStatus.Caption:=FormPeach.LabelStatus.Caption+' ('+inttostr(selper)+'%)';
if (selfolders=0) and (selfiles=0) then FormPeach.LabelStatus.Caption:='';
if FormPeach.LabelStatus.Caption<>'' then FormPeach.LabelStatus.Visible:=true else FormPeach.LabelStatus.Visible:=false;
end;

procedure update_addressbar(apath:ansistring);
var
  Str: TStringList;
  i, j, sc, brcsz: integer;
  s: array [1..8] of ansistring;
begin
FormPeach.PanelLCA1.Visible:=true;
FormPeach.PanelLCA2.Visible:=true;
FormPeach.PanelLCA3.Visible:=true;
FormPeach.PanelLCA4.Visible:=true;
FormPeach.PanelLCA5.Visible:=true;
FormPeach.PanelLCA6.Visible:=true;
FormPeach.PanelLCA7.Visible:=true;
{$IFDEF MSWINDOWS}
if apath=txt_mypc then
   begin
   FormPeach.LabelClickAddress1.Caption:=' '+txt_mypc+' ';
   FormPeach.LabelClickAddress2.Caption:='';
   FormPeach.LabelClickAddress3.Caption:='';
   FormPeach.LabelClickAddress4.Caption:='';
   FormPeach.LabelClickAddress5.Caption:='';
   FormPeach.LabelClickAddress6.Caption:='';
   FormPeach.LabelClickAddress7.Caption:='';
   FormPeach.LabelClickAddress8.Caption:='';
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.ImageAddress4.Visible:=false;
   FormPeach.ImageAddress5.Visible:=false;
   FormPeach.ImageAddress6.Visible:=false;
   FormPeach.ImageAddress7.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.PanelAddress3.Visible:=false;
   FormPeach.PanelAddress4.Visible:=false;
   FormPeach.PanelAddress5.Visible:=false;
   FormPeach.PanelAddress6.Visible:=false;
   FormPeach.PanelAddress7.Visible:=false;
   FormPeach.pmbc1.visible:=false;
   FormPeach.pmbc2.visible:=false;
   FormPeach.pmbc3.visible:=false;
   FormPeach.pmbc4.visible:=false;
   FormPeach.pmbc5.visible:=false;
   FormPeach.pmbc6.visible:=false;
   FormPeach.pmbc7.visible:=false;
   FormPeach.pmbc8.visible:=false;
   FormPeach.pmnavbc1.visible:=false;
   FormPeach.pmnavbc2.visible:=false;
   FormPeach.pmnavbc3.visible:=false;
   FormPeach.pmnavbc4.visible:=false;
   FormPeach.pmnavbc5.visible:=false;
   FormPeach.pmnavbc6.visible:=false;
   FormPeach.pmnavbc7.visible:=false;
   FormPeach.pmnavbc8.visible:=false;
   FormPeach.mbc1.visible:=false;
   FormPeach.mbc2.visible:=false;
   FormPeach.mbc3.visible:=false;
   FormPeach.mbc4.visible:=false;
   FormPeach.mbc5.visible:=false;
   FormPeach.mbc6.visible:=false;
   FormPeach.mbc7.visible:=false;
   FormPeach.mbc8.visible:=false;
   FormPeach.pnabc1.visible:=false;
   FormPeach.pnabc2.visible:=false;
   FormPeach.pnabc3.visible:=false;
   FormPeach.pnabc4.visible:=false;
   FormPeach.pnabc5.visible:=false;
   FormPeach.pnabc6.visible:=false;
   FormPeach.pnabc7.visible:=false;
   FormPeach.pnabc8.visible:=false;
   FormPeach.pnbc1.visible:=false;
   FormPeach.pnbc2.visible:=false;
   FormPeach.pnbc3.visible:=false;
   FormPeach.pnbc4.visible:=false;
   FormPeach.pnbc5.visible:=false;
   FormPeach.pnbc6.visible:=false;
   FormPeach.pnbc7.visible:=false;
   FormPeach.pnbc8.visible:=false;
   FormPeach.pnbcf1.visible:=false;
   FormPeach.pnbcf2.visible:=false;
   FormPeach.pnbcf3.visible:=false;
   FormPeach.pnbcf4.visible:=false;
   FormPeach.pnbcf5.visible:=false;
   FormPeach.pnbcf6.visible:=false;
   FormPeach.pnbcf7.visible:=false;
   FormPeach.pnbcf8.visible:=false;
   FormPeach.pnbce1.visible:=false;
   FormPeach.pnbce2.visible:=false;
   FormPeach.pnbce3.visible:=false;
   FormPeach.pnbce4.visible:=false;
   FormPeach.pnbce5.visible:=false;
   FormPeach.pnbce6.visible:=false;
   FormPeach.pnbce7.visible:=false;
   FormPeach.pnbce8.visible:=false;
   FormPeach.mexttoc1.visible:=false;
   FormPeach.mexttoc2.visible:=false;
   FormPeach.mexttoc3.visible:=false;
   FormPeach.mexttoc4.visible:=false;
   FormPeach.mexttoc5.visible:=false;
   FormPeach.mexttoc6.visible:=false;
   FormPeach.mexttoc7.visible:=false;
   FormPeach.mexttoc8.visible:=false;
   if altbread>0 then
      begin
      FormPeach.ImageAddress0.Visible:=false;
      FormPeach.ImageAddress1.Visible:=false;
      FormPeach.ImageAddress2.Visible:=false;
      FormPeach.ImageAddress3.Visible:=false;
      FormPeach.ImageAddress4.Visible:=false;
      FormPeach.ImageAddress5.Visible:=false;
      FormPeach.ImageAddress6.Visible:=false;
      FormPeach.ImageAddress7.Visible:=false;
      FormPeach.LabelClickAddress1.Font.Style:=[fsBold]; application.ProcessMessages;
      FormPeach.PanelAdArchive4.AnchorSideLeft.Control:=FormPeach.LabelClickAddress1;
      FormPeach.PanelClickAddress.Width:=FormPeach.PanelAdArchive4.left+FormPeach.PanelAdArchive4.Width;
      FormPeach.ShapeListBar.Width:=FormPeach.PanelClickAddress.Width+FormPeach.PanelListRoot.Width+8;
      end;
   exit;
   end;
{$ENDIF}
if not(checkfiledirexists(apath)) then exit;
clean_archive_breadcrumb;
if macbread=1 then FormPeach.LabelClickAddress8.Visible:=true;
Str := TStringList.Create;
str.StrictDelimiter := True;
Str.Delimiter := PathDelim;
Str.DelimitedText := apath;
for i := Str.Count - 1 downto 0 do
   if Str[i] = '' then
      Str.Delete(i);
sc := Str.Count;
for j := 1 to 8 do s[j] :='';
for j := 1 to 8 do
   if (sc - 1 - (8 - j)) >= 0 then
      s[j] := ' '+str[sc - 1 - (8 - j)]+' ';
FormPeach.LabelClickAddress1.Caption:=s[1];
FormPeach.LabelClickAddress2.Caption:=s[2];
if s[1]='' then
   begin
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.LabelClickAddress2.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress2.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAddress1.Visible:=true;
   FormPeach.PanelAddress1.Visible:=true;
   FormPeach.LabelClickAddress2.AnchorSideLeft.Control:=FormPeach.PanelAddress1;
   FormPeach.LabelClickAddress2.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAddress3.Caption:=s[3];
if s[2]='' then
   begin
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.LabelClickAddress3.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress3.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAddress2.Visible:=true;
   FormPeach.PanelAddress2.Visible:=true;
   FormPeach.LabelClickAddress3.AnchorSideLeft.Control:=FormPeach.PanelAddress2;
   FormPeach.LabelClickAddress3.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAddress4.Caption:=s[4];
if s[3]='' then
   begin
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.PanelAddress3.Visible:=false;
   FormPeach.LabelClickAddress4.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress4.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAddress3.Visible:=true;
   FormPeach.PanelAddress3.Visible:=true;
   FormPeach.LabelClickAddress4.AnchorSideLeft.Control:=FormPeach.PanelAddress3;
   FormPeach.LabelClickAddress4.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAddress5.Caption:=s[5];
if s[4]='' then
   begin
   FormPeach.ImageAddress4.Visible:=false;
   FormPeach.PanelAddress4.Visible:=false;
   FormPeach.LabelClickAddress5.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress5.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAddress4.Visible:=true;
   FormPeach.PanelAddress4.Visible:=true;
   FormPeach.LabelClickAddress5.AnchorSideLeft.Control:=FormPeach.PanelAddress4;
   FormPeach.LabelClickAddress5.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAddress6.Caption:=s[6];
if s[5]='' then
   begin
   FormPeach.ImageAddress5.Visible:=false;
   FormPeach.PanelAddress5.Visible:=false;
   FormPeach.LabelClickAddress6.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress6.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAddress5.Visible:=true;
   FormPeach.PanelAddress5.Visible:=true;
   FormPeach.LabelClickAddress6.AnchorSideLeft.Control:=FormPeach.PanelAddress5;
   FormPeach.LabelClickAddress6.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAddress7.Caption:=s[7];
if s[6]='' then
   begin
   FormPeach.ImageAddress6.Visible:=false;
   FormPeach.PanelAddress6.Visible:=false;
   FormPeach.LabelClickAddress7.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress7.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAddress6.Visible:=true;
   FormPeach.PanelAddress6.Visible:=true;
   FormPeach.LabelClickAddress7.AnchorSideLeft.Control:=FormPeach.PanelAddress6;
   FormPeach.LabelClickAddress7.AnchorSideLeft.Side:=asrRight;
   end;
FormPeach.LabelClickAddress8.Caption:=s[8];
if s[7]='' then
   begin
   FormPeach.ImageAddress7.Visible:=false;
   FormPeach.PanelAddress7.Visible:=false;
   FormPeach.LabelClickAddress8.AnchorSideLeft.Control:=FormPeach.PanelAddress0;
   FormPeach.LabelClickAddress8.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   FormPeach.ImageAddress7.Visible:=true;
   FormPeach.PanelAddress7.Visible:=true;
   FormPeach.LabelClickAddress8.AnchorSideLeft.Control:=FormPeach.PanelAddress7;
   FormPeach.LabelClickAddress8.AnchorSideLeft.Side:=asrRight;
   end;

FormPeach.LabelClickAddress1.Visible:=true;
FormPeach.LabelClickAddress2.Visible:=true;
FormPeach.LabelClickAddress3.Visible:=true;
FormPeach.LabelClickAddress4.Visible:=true;
FormPeach.LabelClickAddress5.Visible:=true;
brcsz:=6;
if (FormPeach.width<(1300*qscale) div 100) then brcsz:=5;
if (FormPeach.width<(1200*qscale) div 100) then brcsz:=4;
if (FormPeach.width<(1100*qscale) div 100) then brcsz:=3;
if (FormPeach.width<(1000*qscale) div 100) then brcsz:=2;
if (FormPeach.width<(900*qscale) div 100) then brcsz:=1;
if FormPeach.WindowState=wsMaximized then brcsz:=6;
if macbread=1 then brcsz:=0;
case brcsz of
   0:
   begin
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.LabelClickAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.LabelClickAddress2.Visible:=false;
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.PanelAddress3.Visible:=false;
   FormPeach.LabelClickAddress3.Visible:=false;
   FormPeach.ImageAddress4.Visible:=false;
   FormPeach.PanelAddress4.Visible:=false;
   FormPeach.LabelClickAddress4.Visible:=false;
   FormPeach.ImageAddress5.Visible:=false;
   FormPeach.PanelAddress5.Visible:=false;
   FormPeach.LabelClickAddress5.Visible:=false;
   FormPeach.ImageAddress6.Visible:=false;
   FormPeach.PanelAddress6.Visible:=false;
   FormPeach.LabelClickAddress6.Visible:=false;
   FormPeach.ImageAddress7.Visible:=false;
   FormPeach.PanelAddress7.Visible:=false;
   FormPeach.LabelClickAddress7.Visible:=false;
   end;
   1:
   begin
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.LabelClickAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.LabelClickAddress2.Visible:=false;
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.PanelAddress3.Visible:=false;
   FormPeach.LabelClickAddress3.Visible:=false;
   FormPeach.ImageAddress4.Visible:=false;
   FormPeach.PanelAddress4.Visible:=false;
   FormPeach.LabelClickAddress4.Visible:=false;
   FormPeach.ImageAddress5.Visible:=false;
   FormPeach.PanelAddress5.Visible:=false;
   FormPeach.LabelClickAddress5.Visible:=false;
   end;
   2:
   begin
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.LabelClickAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.LabelClickAddress2.Visible:=false;
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.PanelAddress3.Visible:=false;
   FormPeach.LabelClickAddress3.Visible:=false;
   FormPeach.ImageAddress4.Visible:=false;
   FormPeach.PanelAddress4.Visible:=false;
   FormPeach.LabelClickAddress4.Visible:=false;
   end;
   3:
   begin
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.LabelClickAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.LabelClickAddress2.Visible:=false;
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.PanelAddress3.Visible:=false;
   FormPeach.LabelClickAddress3.Visible:=false;
   end;
   4:
   begin
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.LabelClickAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.PanelAddress2.Visible:=false;
   FormPeach.LabelClickAddress2.Visible:=false;
   end;
   5:
   begin
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.PanelAddress1.Visible:=false;
   FormPeach.LabelClickAddress1.Visible:=false;
   end;
end;

for j := 1 to 8 do s[j] :='';
for j := 1 to 8 do
   if (sc - 1 - (8 - j)) >= 0 then
      for i := 0 to sc - 1 - (8 - j) do
         begin
         s[j] := s[j] + str[i];
         if s[j]<>apath then s[j]:=s[j]+ PathDelim;
         {$IFDEF MSWINDOWS}if s[j,1]<>'\' then if s[j,2]<>':' then s[j]:='\\'+s[j];{$ENDIF}
         end;
if s[1] <> '' then begin FormPeach.pmbc8.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc8.caption:=s[1];{$ELSE}FormPeach.pmbc8.caption:=DirectorySeparator+s[1];{$ENDIF} FormPeach.pmbc8.Bitmap:=drawmenuicon(FormPeach.pmbc8.Caption); end else FormPeach.pmbc8.visible:=false;
if s[2] <> '' then begin FormPeach.pmbc7.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc7.caption:=s[2];{$ELSE}FormPeach.pmbc7.caption:=DirectorySeparator+s[2];{$ENDIF} FormPeach.pmbc7.Bitmap:=drawmenuicon(FormPeach.pmbc7.Caption); end else FormPeach.pmbc7.visible:=false;
if s[3] <> '' then begin FormPeach.pmbc6.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc6.caption:=s[3];{$ELSE}FormPeach.pmbc6.caption:=DirectorySeparator+s[3];{$ENDIF} FormPeach.pmbc6.Bitmap:=drawmenuicon(FormPeach.pmbc6.Caption); end else FormPeach.pmbc6.visible:=false;
if s[4] <> '' then begin FormPeach.pmbc5.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc5.caption:=s[4];{$ELSE}FormPeach.pmbc5.caption:=DirectorySeparator+s[4];{$ENDIF} FormPeach.pmbc5.Bitmap:=drawmenuicon(FormPeach.pmbc5.Caption); end else FormPeach.pmbc5.visible:=false;
if s[5] <> '' then begin FormPeach.pmbc4.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc4.caption:=s[5];{$ELSE}FormPeach.pmbc4.caption:=DirectorySeparator+s[5];{$ENDIF} FormPeach.pmbc4.Bitmap:=drawmenuicon(FormPeach.pmbc4.Caption); end else FormPeach.pmbc4.visible:=false;
if s[6] <> '' then begin FormPeach.pmbc3.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc3.caption:=s[6];{$ELSE}FormPeach.pmbc3.caption:=DirectorySeparator+s[6];{$ENDIF} FormPeach.pmbc3.Bitmap:=drawmenuicon(FormPeach.pmbc3.Caption); end else FormPeach.pmbc3.visible:=false;
if s[7] <> '' then begin FormPeach.pmbc2.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc2.caption:=s[7];{$ELSE}FormPeach.pmbc2.caption:=DirectorySeparator+s[7];{$ENDIF} FormPeach.pmbc2.Bitmap:=drawmenuicon(FormPeach.pmbc2.Caption); end else FormPeach.pmbc2.visible:=false;
if s[8] <> '' then begin FormPeach.pmbc1.visible:=true; {$IFDEF MSWINDOWS}FormPeach.pmbc1.caption:=s[8];{$ELSE}FormPeach.pmbc1.caption:=DirectorySeparator+s[8];{$ENDIF} FormPeach.pmbc1.Bitmap:=drawmenuicon(FormPeach.pmbc1.Caption); end else FormPeach.pmbc1.visible:=false;
str.Free;
FormPeach.pmnavbc1.visible:=FormPeach.pmbc1.visible;
FormPeach.pmnavbc2.visible:=FormPeach.pmbc2.visible;
FormPeach.pmnavbc3.visible:=FormPeach.pmbc3.visible;
FormPeach.pmnavbc4.visible:=FormPeach.pmbc4.visible;
FormPeach.pmnavbc5.visible:=FormPeach.pmbc5.visible;
FormPeach.pmnavbc6.visible:=FormPeach.pmbc6.visible;
FormPeach.pmnavbc7.visible:=FormPeach.pmbc7.visible;
FormPeach.pmnavbc8.visible:=FormPeach.pmbc8.visible;
FormPeach.pmnavbc1.caption:=FormPeach.pmbc1.caption;
FormPeach.pmnavbc2.caption:=FormPeach.pmbc2.caption;
FormPeach.pmnavbc3.caption:=FormPeach.pmbc3.caption;
FormPeach.pmnavbc4.caption:=FormPeach.pmbc4.caption;
FormPeach.pmnavbc5.caption:=FormPeach.pmbc5.caption;
FormPeach.pmnavbc6.caption:=FormPeach.pmbc6.caption;
FormPeach.pmnavbc7.caption:=FormPeach.pmbc7.caption;
FormPeach.pmnavbc8.caption:=FormPeach.pmbc8.caption;
FormPeach.pmnavbc1.bitmap:=FormPeach.pmbc1.bitmap;
FormPeach.pmnavbc2.bitmap:=FormPeach.pmbc2.bitmap;
FormPeach.pmnavbc3.bitmap:=FormPeach.pmbc3.bitmap;
FormPeach.pmnavbc4.bitmap:=FormPeach.pmbc4.bitmap;
FormPeach.pmnavbc5.bitmap:=FormPeach.pmbc5.bitmap;
FormPeach.pmnavbc6.bitmap:=FormPeach.pmbc6.bitmap;
FormPeach.pmnavbc7.bitmap:=FormPeach.pmbc7.bitmap;
FormPeach.pmnavbc8.bitmap:=FormPeach.pmbc8.bitmap;
FormPeach.mbc1.visible:=FormPeach.pmbc1.visible;
FormPeach.mbc2.visible:=FormPeach.pmbc2.visible;
FormPeach.mbc3.visible:=FormPeach.pmbc3.visible;
FormPeach.mbc4.visible:=FormPeach.pmbc4.visible;
FormPeach.mbc5.visible:=FormPeach.pmbc5.visible;
FormPeach.mbc6.visible:=FormPeach.pmbc6.visible;
FormPeach.mbc7.visible:=FormPeach.pmbc7.visible;
FormPeach.mbc8.visible:=FormPeach.pmbc8.visible;
FormPeach.mbc1.caption:=FormPeach.pmbc1.caption;
FormPeach.mbc2.caption:=FormPeach.pmbc2.caption;
FormPeach.mbc3.caption:=FormPeach.pmbc3.caption;
FormPeach.mbc4.caption:=FormPeach.pmbc4.caption;
FormPeach.mbc5.caption:=FormPeach.pmbc5.caption;
FormPeach.mbc6.caption:=FormPeach.pmbc6.caption;
FormPeach.mbc7.caption:=FormPeach.pmbc7.caption;
FormPeach.mbc8.caption:=FormPeach.pmbc8.caption;
FormPeach.mbc1.bitmap:=FormPeach.pmbc1.bitmap;
FormPeach.mbc2.bitmap:=FormPeach.pmbc2.bitmap;
FormPeach.mbc3.bitmap:=FormPeach.pmbc3.bitmap;
FormPeach.mbc4.bitmap:=FormPeach.pmbc4.bitmap;
FormPeach.mbc5.bitmap:=FormPeach.pmbc5.bitmap;
FormPeach.mbc6.bitmap:=FormPeach.pmbc6.bitmap;
FormPeach.mbc7.bitmap:=FormPeach.pmbc7.bitmap;
FormPeach.mbc8.bitmap:=FormPeach.pmbc8.bitmap;
FormPeach.pnabc1.visible:=FormPeach.pmbc1.visible;
FormPeach.pnabc2.visible:=FormPeach.pmbc2.visible;
FormPeach.pnabc3.visible:=FormPeach.pmbc3.visible;
FormPeach.pnabc4.visible:=FormPeach.pmbc4.visible;
FormPeach.pnabc5.visible:=FormPeach.pmbc5.visible;
FormPeach.pnabc6.visible:=FormPeach.pmbc6.visible;
FormPeach.pnabc7.visible:=FormPeach.pmbc7.visible;
FormPeach.pnabc8.visible:=FormPeach.pmbc8.visible;
FormPeach.pnabc1.caption:=FormPeach.pmbc1.caption;
FormPeach.pnabc2.caption:=FormPeach.pmbc2.caption;
FormPeach.pnabc3.caption:=FormPeach.pmbc3.caption;
FormPeach.pnabc4.caption:=FormPeach.pmbc4.caption;
FormPeach.pnabc5.caption:=FormPeach.pmbc5.caption;
FormPeach.pnabc6.caption:=FormPeach.pmbc6.caption;
FormPeach.pnabc7.caption:=FormPeach.pmbc7.caption;
FormPeach.pnabc8.caption:=FormPeach.pmbc8.caption;
FormPeach.pnabc1.bitmap:=FormPeach.pmbc1.bitmap;
FormPeach.pnabc2.bitmap:=FormPeach.pmbc2.bitmap;
FormPeach.pnabc3.bitmap:=FormPeach.pmbc3.bitmap;
FormPeach.pnabc4.bitmap:=FormPeach.pmbc4.bitmap;
FormPeach.pnabc5.bitmap:=FormPeach.pmbc5.bitmap;
FormPeach.pnabc6.bitmap:=FormPeach.pmbc6.bitmap;
FormPeach.pnabc7.bitmap:=FormPeach.pmbc7.bitmap;
FormPeach.pnabc8.bitmap:=FormPeach.pmbc8.bitmap;
FormPeach.pnbc1.visible:=FormPeach.pmbc1.visible;
FormPeach.pnbc2.visible:=FormPeach.pmbc2.visible;
FormPeach.pnbc3.visible:=FormPeach.pmbc3.visible;
FormPeach.pnbc4.visible:=FormPeach.pmbc4.visible;
FormPeach.pnbc5.visible:=FormPeach.pmbc5.visible;
FormPeach.pnbc6.visible:=FormPeach.pmbc6.visible;
FormPeach.pnbc7.visible:=FormPeach.pmbc7.visible;
FormPeach.pnbc8.visible:=FormPeach.pmbc8.visible;
FormPeach.pnbc1.caption:=FormPeach.pmbc1.caption;
FormPeach.pnbc2.caption:=FormPeach.pmbc2.caption;
FormPeach.pnbc3.caption:=FormPeach.pmbc3.caption;
FormPeach.pnbc4.caption:=FormPeach.pmbc4.caption;
FormPeach.pnbc5.caption:=FormPeach.pmbc5.caption;
FormPeach.pnbc6.caption:=FormPeach.pmbc6.caption;
FormPeach.pnbc7.caption:=FormPeach.pmbc7.caption;
FormPeach.pnbc8.caption:=FormPeach.pmbc8.caption;
FormPeach.pnbc1.bitmap:=FormPeach.pmbc1.bitmap;
FormPeach.pnbc2.bitmap:=FormPeach.pmbc2.bitmap;
FormPeach.pnbc3.bitmap:=FormPeach.pmbc3.bitmap;
FormPeach.pnbc4.bitmap:=FormPeach.pmbc4.bitmap;
FormPeach.pnbc5.bitmap:=FormPeach.pmbc5.bitmap;
FormPeach.pnbc6.bitmap:=FormPeach.pmbc6.bitmap;
FormPeach.pnbc7.bitmap:=FormPeach.pmbc7.bitmap;
FormPeach.pnbc8.bitmap:=FormPeach.pmbc8.bitmap;
FormPeach.pnbcf1.visible:=FormPeach.pmbc1.visible;
FormPeach.pnbcf2.visible:=FormPeach.pmbc2.visible;
FormPeach.pnbcf3.visible:=FormPeach.pmbc3.visible;
FormPeach.pnbcf4.visible:=FormPeach.pmbc4.visible;
FormPeach.pnbcf5.visible:=FormPeach.pmbc5.visible;
FormPeach.pnbcf6.visible:=FormPeach.pmbc6.visible;
FormPeach.pnbcf7.visible:=FormPeach.pmbc7.visible;
FormPeach.pnbcf8.visible:=FormPeach.pmbc8.visible;
FormPeach.pnbcf1.caption:=FormPeach.pmbc1.caption;
FormPeach.pnbcf2.caption:=FormPeach.pmbc2.caption;
FormPeach.pnbcf3.caption:=FormPeach.pmbc3.caption;
FormPeach.pnbcf4.caption:=FormPeach.pmbc4.caption;
FormPeach.pnbcf5.caption:=FormPeach.pmbc5.caption;
FormPeach.pnbcf6.caption:=FormPeach.pmbc6.caption;
FormPeach.pnbcf7.caption:=FormPeach.pmbc7.caption;
FormPeach.pnbcf8.caption:=FormPeach.pmbc8.caption;
FormPeach.pnbcf1.bitmap:=FormPeach.pmbc1.bitmap;
FormPeach.pnbcf2.bitmap:=FormPeach.pmbc2.bitmap;
FormPeach.pnbcf3.bitmap:=FormPeach.pmbc3.bitmap;
FormPeach.pnbcf4.bitmap:=FormPeach.pmbc4.bitmap;
FormPeach.pnbcf5.bitmap:=FormPeach.pmbc5.bitmap;
FormPeach.pnbcf6.bitmap:=FormPeach.pmbc6.bitmap;
FormPeach.pnbcf7.bitmap:=FormPeach.pmbc7.bitmap;
FormPeach.pnbcf8.bitmap:=FormPeach.pmbc8.bitmap;
FormPeach.pnbce1.visible:=FormPeach.pmbc1.visible;
FormPeach.pnbce2.visible:=FormPeach.pmbc2.visible;
FormPeach.pnbce3.visible:=FormPeach.pmbc3.visible;
FormPeach.pnbce4.visible:=FormPeach.pmbc4.visible;
FormPeach.pnbce5.visible:=FormPeach.pmbc5.visible;
FormPeach.pnbce6.visible:=FormPeach.pmbc6.visible;
FormPeach.pnbce7.visible:=FormPeach.pmbc7.visible;
FormPeach.pnbce8.visible:=FormPeach.pmbc8.visible;
FormPeach.pnbce1.caption:=FormPeach.pmbc1.caption;
FormPeach.pnbce2.caption:=FormPeach.pmbc2.caption;
FormPeach.pnbce3.caption:=FormPeach.pmbc3.caption;
FormPeach.pnbce4.caption:=FormPeach.pmbc4.caption;
FormPeach.pnbce5.caption:=FormPeach.pmbc5.caption;
FormPeach.pnbce6.caption:=FormPeach.pmbc6.caption;
FormPeach.pnbce7.caption:=FormPeach.pmbc7.caption;
FormPeach.pnbce8.caption:=FormPeach.pmbc8.caption;
FormPeach.pnbce1.bitmap:=FormPeach.pmbc1.bitmap;
FormPeach.pnbce2.bitmap:=FormPeach.pmbc2.bitmap;
FormPeach.pnbce3.bitmap:=FormPeach.pmbc3.bitmap;
FormPeach.pnbce4.bitmap:=FormPeach.pmbc4.bitmap;
FormPeach.pnbce5.bitmap:=FormPeach.pmbc5.bitmap;
FormPeach.pnbce6.bitmap:=FormPeach.pmbc6.bitmap;
FormPeach.pnbce7.bitmap:=FormPeach.pmbc7.bitmap;
FormPeach.pnbce8.bitmap:=FormPeach.pmbc8.bitmap;
FormPeach.mexttoc1.visible:=FormPeach.pmbc1.visible;
FormPeach.mexttoc2.visible:=FormPeach.pmbc2.visible;
FormPeach.mexttoc3.visible:=FormPeach.pmbc3.visible;
FormPeach.mexttoc4.visible:=FormPeach.pmbc4.visible;
FormPeach.mexttoc5.visible:=FormPeach.pmbc5.visible;
FormPeach.mexttoc6.visible:=FormPeach.pmbc6.visible;
FormPeach.mexttoc7.visible:=FormPeach.pmbc7.visible;
FormPeach.mexttoc8.visible:=FormPeach.pmbc8.visible;
FormPeach.mexttoc1.caption:=ExtractFilePath(FormPeach.pmbc1.caption);
FormPeach.mexttoc2.caption:=ExtractFilePath(FormPeach.pmbc2.caption);
FormPeach.mexttoc3.caption:=ExtractFilePath(FormPeach.pmbc3.caption);
FormPeach.mexttoc4.caption:=ExtractFilePath(FormPeach.pmbc4.caption);
FormPeach.mexttoc5.caption:=ExtractFilePath(FormPeach.pmbc5.caption);
FormPeach.mexttoc6.caption:=ExtractFilePath(FormPeach.pmbc6.caption);
FormPeach.mexttoc7.caption:=ExtractFilePath(FormPeach.pmbc7.caption);
FormPeach.mexttoc8.caption:=ExtractFilePath(FormPeach.pmbc8.caption);
FormPeach.mexttoc1.bitmap:=FormPeach.pmbc1.bitmap;
FormPeach.mexttoc2.bitmap:=FormPeach.pmbc2.bitmap;
FormPeach.mexttoc3.bitmap:=FormPeach.pmbc3.bitmap;
FormPeach.mexttoc4.bitmap:=FormPeach.pmbc4.bitmap;
FormPeach.mexttoc5.bitmap:=FormPeach.pmbc5.bitmap;
FormPeach.mexttoc6.bitmap:=FormPeach.pmbc6.bitmap;
FormPeach.mexttoc7.bitmap:=FormPeach.pmbc7.bitmap;
FormPeach.mexttoc8.bitmap:=FormPeach.pmbc8.bitmap;
if altbread>0 then
   begin
   FormPeach.ImageAddress0.Visible:=false;
   FormPeach.ImageAddress1.Visible:=false;
   FormPeach.ImageAddress2.Visible:=false;
   FormPeach.ImageAddress3.Visible:=false;
   FormPeach.ImageAddress4.Visible:=false;
   FormPeach.ImageAddress5.Visible:=false;
   FormPeach.ImageAddress6.Visible:=false;
   FormPeach.ImageAddress7.Visible:=false;
   setfontsbreadcrumb;
   end;
end;

function checkfreespace:integer;
var
   s:ansistring;
begin
result:=0;
if sizefreeint<=0 then exit;
s:='';
if sizefreeout>0 then //0 may be erroneously report in some case for poorly supported unit types
   if sizefreeint>sizefreeout then s:=txt_9_3_fsd+' ('+nicenumber(inttostr(sizefreeout),filesizebase)+')'+char($0D)+char($0A);
if sizefreewrk>0 then
   if sizefreeint>sizefreewrk then s:=txt_9_3_fsw+' ('+nicenumber(inttostr(sizefreewrk),filesizebase)+')'+char($0D)+char($0A);
if s<>'' then
   if pMessageWarningYesNo(s+txt_9_3_continue)<>6 then result:=1; //do not continue
end;

procedure browser_selectnone;
var
   i:integer;
begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   if FormPeach.ListViewBrowser.Visible=true then
      begin
      if FormPeach.StringGridList.Rowcount<2 then exit;
      if FormPeach.StringGridList.Cells[1,1]='' then exit;
      for i:=1 to FormPeach.StringGridList.Rowcount-1 do
         FormPeach.StringGridList.Cells[16,i]:='0';
      end;
end;

procedure update_listview;
var
   i,j,rc:integer;
   MyThreadimg: TMyThreadimg;
   abitmap:TBitmap;
   redoi:boolean;
   tstr:ansistring;
   tvs:TViewStyle;
begin
if updatinglistview=true then exit;
updatinglistview:=true;
if dolistupdate=false then
   begin
   updatinglistview:=false;
   exit;
   end;
savecol;
if (fun<>'FILEBROWSER') and (funflag=true) then browser_selectnone; //start with no selection opening archive, so "extract" selects all by default
if (fun='FILEBROWSER') and (FormPeach.StringGridSessionHistory.RowCount<=2) then browser_selectnone; //start with no selection opening the application, so "add" and "extract" goes to new empty layout by default
if fun='FILEBROWSER' then
   begin
   prevupdateid:=updateid;
   updateid:=FormPeach.editopenin.Caption+FormPeach.editun7zafilter.Caption+status0+status1+inttostr(browsertype)+inttostr(largeiconsize)+inttostr(smalliconsize);
   end
else updateid:='';
sync:=sync+1;
imindex:=0;
exeindex:=0;
issearching:=0;
rc:=FormPeach.StringGridList.Rowcount;
FormPeach.ImageListResetSearch.visible:=false;
FormPeach.ListViewBrowser.Items.Beginupdate;
update_info;
//application.processmessages; Win32 Lazarus 0.9.30, browsing computer's root may crash (at application.processmessages in update_listview) at application startup if sorting column is not unit name
FormPeach.ListViewBrowser.Clear;
{$IFDEF MSWINDOWS}
if prevupdateid<>updateid then redoi:=true else redoi:=false;
if showthumbnails=0 then redoi:=false;
if openstarted=false then redoi:=true;
rebuildicons(redoi);
{$ELSE}
rebuildicons(false);
{$ENDIF}

if rc>1 then
   begin

   {$IFDEF DARWIN}//never return to non-virtual mode at runtime in macOS due to listview selectitem event non being triggered in this case (limitation tested in laz 4.2)
   if FormPeach.ListViewBrowser.OwnerData=true then
      begin
      sizevirtual:=0;
      allowvirtual:=1;
      end;
   {$ENDIF}

   if (rc<sizevirtual*1024) or (allowvirtual=0) then //non-virtual mode; possible variation, add condition to force for win thumbnails ((fun='FILEBROWSER') and (showthumbnails=1))
   begin
   if FormPeach.ListViewBrowser.OwnerData=true then
      begin
      FormPeach.ListViewBrowser.OwnerData:=false;
      {$IFDEF LCLGTK2}//forces GTK2 to redraw the GUI, otherwise listview items will remain invisible
      FormPeach.BorderStyle:=bsNone;
      FormPeach.BorderStyle:=bsSizeable;
      {$ENDIF}
      end;

   abitmap:=Tbitmap.Create;
   if browsertype=2 then
      begin
      abitmap.Width:=largeiconsize;
      abitmap.Height:=largeiconsize;
      end
   else
      begin
      abitmap.Width:=smalliconsize;
      abitmap.Height:=smalliconsize;
      end;
   {$IFDEF MSWINDOWS}
   FormPeach.ListViewBrowser.Visible:=false;
   tvs:=FormPeach.ListViewBrowser.ViewStyle;
   if tvs=vsReport then FormPeach.ListViewBrowser.ViewStyle:=vsSmallIcon;
   //changing viewstyle on the fly produces issues with some non-Windows widgetsets, moreover the advantage is mainly noticeable only on Windows
   {$ENDIF}
   for i:=1 to rc-1 do
      begin
      FormPeach.ListViewBrowser.Items.Add.Caption:=FormPeach.StringGridList.Cells[1,i];
      {$IFNDEF MSWINDOWS}FormPeach.ListViewBrowser.Items[i-1].ImageIndex:=drawlisticon(i);{$ENDIF}
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[2,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(nicenumber(FormPeach.StringGridList.Cells[3,i],filesizebase));
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(nicenumber(FormPeach.StringGridList.Cells[4,i],filesizebase));
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[5,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[6,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[7,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[8,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[9,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[10,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[11,i]);
      FormPeach.ListViewBrowser.Items[i-1].SubItems.Add(FormPeach.StringGridList.Cells[12,i]);
      if FormPeach.StringGridList.Cells[16,i]='0' then
      else
         try
         FormPeach.ListViewBrowser.Items[i-1].Selected:=true;
         except
         end;
      end;
   {$IFDEF MSWINDOWS}
   if tvs=vsReport then FormPeach.ListViewBrowser.ViewStyle:=tvs;
   for i:=1 to rc-1 do
      begin
      FormPeach.ListViewBrowser.Items[i-1].ImageIndex:=drawlisticon(i);
      if fun='FILEBROWSER' then
         begin
         if showthumbnails=1 then
            begin
            if supportedimgtype(FormPeach.StringGridList.Cells[2,i])=true then
            begin
            imindex:=imindex+1;
            SetLength(imlistindex, imindex+1);
            SetLength(imtodo, imindex+1);
            imlistindex[imindex]:=i;
            imtodo[imindex]:=imindex;
            if browsertype= 2 then il96.Add(abitmap,nil)
            else
               if smalliconsize=16 then il16.Add(abitmap,nil)
               else il96.Add(abitmap,nil);
            end;
         if FormPeach.StringGridList.Cells[2,i]='.exe' then
            begin
            exeindex:=exeindex+1;
            SetLength(exelistindex, exeindex+1);
            SetLength(exetodo, exeindex+1);
            exelistindex[exeindex]:=i;
            exetodo[exeindex]:=exeindex;
            if browsertype= 2 then il96.Add(abitmap,nil)
            else
               if smalliconsize=16 then il16.Add(abitmap,nil)
               else il96.Add(abitmap,nil);
            end;
         end;
         end;
      end;
   FormPeach.ListViewBrowser.Visible:=true;
   if showthumbnails=1 then
      if fun='FILEBROWSER' then
         begin
         MyThreadimg := TMyThreadimg.Create(True);
         if Assigned(MyThreadimg.FatalException) then
            raise MyThreadimg.FatalException;
         MyThreadimg.Resume;
         end;
   {$ENDIF}
   abitmap.free;
   end
   else //virtual
      begin
      if FormPeach.ListViewBrowser.OwnerData=false then FormPeach.ListViewBrowser.OwnerData:=true;
      FormPeach.ListViewBrowser.Items.Count:=rc-1;
      end;
   end
else
   begin
   set_listview_col;
   FormPeach.ListViewBrowser.Items.Endupdate;
   update_addressbar(FormPeach.EditOpenInInteractive.Text);
   update_selstatus;
   updatinglistview:=false;
   exit;
   end;

set_listview_col;

if FormPeach.PanelProgress.Visible=true then
   begin
   FormPeach.PanelProgress.Width:=FormPeach.Width*95 div 100;
   pperc:=95;
   tstr:=FormPeach.LabelStatusdisplayed.Caption;
   FormPeach.LabelStatusdisplayed.Caption:=txt_8_9_disp+' 2/2';
   application.ProcessMessages;
   FormPeach.LabelStatusdisplayed.Caption:=tstr;
   end;

//sync real time search
FormPeach.ListAddress.Items.BeginUpdate;
FormPeach.ListAddress.Clear;
if FormPeach.ListViewBrowser.OwnerData=false then //current filter implementation not compatible with virtual treeview
   for j:=0 to FormPeach.ListViewBrowser.Items.Count-1 do FormPeach.ListAddress.Items.Add.Assign(FormPeach.ListViewBrowser.Items[j]);
FormPeach.ListAddress.Items.EndUpdate;
FormPeach.StringGridAddress.BeginUpdate;
FormPeach.StringGridAddress.Clear;
FormPeach.StringGridAddress.RowCount:=FormPeach.StringGridList.RowCount;
//for j:=0 to FormPeach.StringGridList.RowCount-1 do FormPeach.StringGridAddress.Rows[j].Assign(FormPeach.StringGridList.Rows[j]);
FormPeach.StringGridAddress.Assign(FormPeach.StringGridList);
FormPeach.StringGridAddress.EndUpdate;

FormPeach.ListViewBrowser.Items.Endupdate;

if FormPeach.Visible=true then try FormPeach.ListViewBrowser.SetFocus; except end;
if (FormPeach.ListViewBrowser.Items[0].Caption='') and (FormPeach.ListViewBrowser.Items.Count<2) then FormPeach.ListViewBrowser.Clear
else
   begin
   {$IFDEF MSWINDOWS}
   if FormPeach.Visible=true then
      try
      FormPeach.ListViewBrowser.ItemFocused:=FormPeach.ListViewBrowser.Items[FormPeach.StringGridList.Row-1];
      except
      end;
   {$ENDIF}
   end;
update_addressbar(FormPeach.EditOpenInInteractive.Text);
update_selstatus;

if FormPeach.PanelProgress.Visible=true then
   begin
   FormPeach.PanelProgress.Width:=FormPeach.Width*100 div 100;
   pperc:=100;
   application.ProcessMessages;
   end;

{$IFDEF MSWINDOWS}done_listingexe:=false;{$ENDIF}
updatinglistview:=false;
FormPeach.PanelProgress.Visible:=false;
end;

procedure update_listview_sel; //use to update listview when selection status, not browsed content, changes
var
   i,rc:integer;
begin
if updatinglistview=true then exit;
updatinglistview:=true;
savecol;
rc:=FormPeach.StringGridList.Rowcount;
{$IFDEF MSWINDOWS}FormPeach.ListViewBrowser.Items.Beginupdate;{$ENDIF}
if (rc>1) and (FormPeach.StringGridList.Cells[1,1]<>'') then
   begin
   for i:=1 to rc-1 do
      begin
      if FormPeach.StringGridList.Cells[0,i]='' then FormPeach.ListViewBrowser.Items[i-1].Cut:=false
      else FormPeach.ListViewBrowser.Items[i-1].Cut:=true; //cut raises update_listview_sel instead of update_listview
      if FormPeach.StringGridList.Cells[16,i]='0' then
         begin
         try
         FormPeach.ListViewBrowser.Items[i-1].Selected:=false;
         except
         end;
         end
      else
         try
         FormPeach.ListViewBrowser.Items[i-1].Selected:=true;
         except
         end;
      end;
   end
else
   begin
   set_listview_col;
   {$IFDEF MSWINDOWS}FormPeach.ListViewBrowser.Items.Endupdate;{$ENDIF}
   update_selstatus;
   updatinglistview:=false;
   exit;
   end;
set_listview_col;
{$IFDEF MSWINDOWS}FormPeach.ListViewBrowser.Items.Endupdate;{$ENDIF}
if FormPeach.Visible=true then try FormPeach.ListViewBrowser.SetFocus; except end;
if (FormPeach.ListViewBrowser.Items[0].Caption='') and (FormPeach.ListViewBrowser.Items.Count<2) then //FormPeach.ListViewBrowser.Clear
else
   begin
   {$IFDEF MSWINDOWS}
   if FormPeach.Visible=true then
      try
      FormPeach.ListViewBrowser.ItemFocused:=FormPeach.ListViewBrowser.Items[FormPeach.StringGridList.Row-1];
      except
      end;
   {$ENDIF}
   end;
update_selstatus;
updatinglistview:=false;
end;

function checkextinput_noduplicatecheck:boolean;
var
   i,k,rc:integer;
   okfile:boolean;
begin
result:=false;
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
rc:=FormPeach.StringGridList.RowCount;
if rc=1 then exit;
if fun<>'FILEBROWSER' then
   begin
   result:=true;
   exit;//true if input is a valid archive
   end;
k:=0;
for i:=1 to rc-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      if FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //no folders
         begin
         test_extfile_noduplicatecheck(FormPeach.StringGridList.Cells[12,i],okfile);
         if okfile=true then k:=k+1;
         end;
if k>0 then result:=true;
end;

procedure view_lastobj;
begin
if poslastobj<0 then exit;
try
FormPeach.ListViewBrowser.Items[poslastobj].MakeVisible(false);
except
end;
poslastobj:=-1;
end;

procedure set_lastobjarch;
var
   i:integer;
   lastobjfound:boolean;
begin
lastobjfound:=false;
if FormPeach.StringGridList.RowCount<2 then exit;
if length(lastobjarch)>1 then
   if lastobjarch[length(lastobjarch)]=directoryseparator then setlength(lastobjarch,length(lastobjarch)-1);
if lastobjarch<>'' then
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if pos(FormPeach.StringGridList.Cells[12,i],lastobjarch)=1 then
         begin
         try
         if (pos(DirectorySeparator,copy(lastobjarch,length(FormPeach.StringGridList.Cells[12,i])+1,1))=1)
         or (FormPeach.StringGridList.Cells[12,i]=lastobjarch) then
            begin
            lastobjfound:=true;
            break;
            end;
         except
         end;
         end;
if lastobjfound=false then //i:=1;
else
   begin
   FormPeach.StringGridList.Cells[16,i]:='1';
   FormPeach.StringGridList.Row:=i;
   try
   poslastobj:=i-1;
   FormPeach.ListViewBrowser.Items[poslastobj].MakeVisible(false);
   //FormPeach.ListViewBrowser.Selected:=FormPeach.ListViewBrowser.Items[poslastobj]; //forcing item selection can lead to unintebnded behaviour
   except
   end;
   end;
end;

procedure set_lastobj;
var
   i:integer;
   lastobjfound:boolean;
begin
for i:=1 to FormPeach.StringGridList.Rowcount-1 do
   if FormPeach.StringGridList.Cells[16,i]='0' then
   else FormPeach.StringGridList.Cells[16,i]:='0';
lastobjfound:=false;
if length(lastobj)>1 then
   if lastobj[length(lastobj)]=directoryseparator then setlength(lastobj,length(lastobj)-1);
if lastobj<>'' then
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if pos(FormPeach.StringGridList.Cells[12,i],lastobj)=1 then
         begin
         try
         if (pos(DirectorySeparator,copy(lastobj,length(FormPeach.StringGridList.Cells[12,i])+1,1))=1) //landed on parent path
         or (FormPeach.StringGridList.Cells[12,i]=lastobj) then //exact match
            begin
            lastobjfound:=true;
            break;
            end;
         except
         end;
         end;
if lastobjfound=false then
else
   begin
   FormPeach.StringGridList.Cells[16,i]:='1';
   FormPeach.StringGridList.Row:=i;
   FormPeach.LabelExtHere.visible:=checkextinput_noduplicatecheck;
   try
   poslastobj:=i-1;
   FormPeach.ListViewBrowser.Items[poslastobj].MakeVisible(false);
   //FormPeach.ListViewBrowser.Selected:=FormPeach.ListViewBrowser.Items[poslastobj];
   except
   end;
   end;
end;

procedure set_lastobjpc;
var
   i:integer;
   lastobjfound:boolean;
begin
{$IFDEF MSWINDOWS}
for i:=1 to FormPeach.StringGridList.Rowcount-1 do
   if FormPeach.StringGridList.Cells[16,i]='0' then
   else FormPeach.StringGridList.Cells[16,i]:='0';
lastobjfound:=false;
lastobj:=ExtractFileDrive(lastobj)+directoryseparator;
if lastobj<>'' then
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[12,i]=lastobj then
         begin
         lastobjfound:=true;
         break;
         end;
if lastobjfound=false then i:=1;
FormPeach.StringGridList.Cells[16,i]:='1';
FormPeach.StringGridList.Row:=i;
{$ENDIF}
end;

function testdriveaccessible(s,dtype:ansistring; tdiff:qword):boolean;
begin
result:=false;
if dtype=txt_unit_remote then
   begin
   if (mappeddrivesinfo=0) or (session_mappeddrivesinfo=0) then exit;
   if tdiff>2500 then
      begin
      session_mappeddrivesinfo:=0;
      exit;
      end;
   end;
result:=true;
end;

procedure recpmem; //recover memory freeing file browser related items
begin
FormPeach.ListAddress.Clear;
FormPeach.MemoList.Clear;
FormPeach.StringGridList.Clear;
FormPeach.StringGridList.RowCount:=1;
FormPeach.StringGridArchive.Clear;
FormPeach.StringGridArchive.RowCount:=1;
FormPeach.StringGridAddress.Clear;
FormPeach.StringGridAddress.RowCount:=1;
FormPeach.StringGridAddressAllFolders.Clear;
FormPeach.StringGridAddressAllFolders.RowCount:=1;
FormPeach.StringGridAddressOmittedFolders.Clear;
FormPeach.StringGridAddressOmittedFolders.RowCount:=1;
FormPeach.StringGridAddressAllFoldersContent.Clear;
FormPeach.StringGridAddressAllFoldersContent.RowCount:=1;
end;

procedure listpc;
{$IFDEF MSWINDOWS}
var
   s:string;
   s1,dtype,dname,fsname,uncname:ansistring;
   w:widestring;
   c:char;
   sz,sz1:int64;
   j,t,sizetotal,sizefree:qword;
   i:integer;
   k:integer;
   sn,mc,flags:dword;
   bufVolumeName,bufFSName: array[0..255] of WChar;
   ws: widestring;
   drivestr:array[1..255] of word;
   tsin,tsout:TTimeStamp;
   tdiff:qword;
   ErrorMode: Word;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
sz:=0;
sz1:=0;
if listingdir=true then exit;
listingdir:=true;
keeppreview:=false;
selnode:=0;
beingpreviewed:='';
FormPeach.LabelComment.Caption:='';
FormPeach.LabelComment.Hint:='';
if FormPeach.StringGridSessionHistory.rowcount>1 then singleextract:=false;
specialopen:=false;
for k := 1 to 4 do abcrs[k] :='';
FormPeach.LabelExtHere.Visible:=false;
recpmem;
setbrowserwarning_off;
FormPeach.ImageListSearch.Enabled:=false;
settoolbar;
clean_archive_breadcrumb;
FormPeach.LabelClickAddress1.Visible:=true;
FormPeach.LabelClickAddress2.Visible:=true;
FormPeach.LabelClickAddress3.Visible:=true;
FormPeach.LabelClickAddress4.Visible:=true;
FormPeach.LabelClickAddress5.Visible:=true;
seemencrypted:=false;
if ptmpcode<>'' then cleardirasync(ptmpdir);
if pstmpdir<>'' then cleardirasync(pstmpdir);
ptmpdir:='';
pstmpdir:='';
FormPeach.StringGridArchive.RowCount:=1;
addmenuenable(1);
if FormPeach.EditOpenIn.Text<>txt_mypc then
   begin
   col1size:=FormPeach.ListViewBrowser.Column[0].Width;
   if ctype=true then col2size:=FormPeach.ListViewBrowser.Column[1].Width;
   if csize=true then col3size:=FormPeach.ListViewBrowser.Column[2].Width;
   if cpacked=true then col4size:=FormPeach.ListViewBrowser.Column[3].Width;
   if cdate=true then col5size:=FormPeach.ListViewBrowser.Column[4].Width;
   if catt=true then col6size:=FormPeach.ListViewBrowser.Column[9].Width;
   if ccrc=true then col7size:=FormPeach.ListViewBrowser.Column[10].Width;
   end;
prepare_filebrowser;
status0:=txt_list_browsing;
currentcomp:='';
currentfs:='';
statust:='';
archive_content:='';
status1:=(GetEnvironmentVariable('COMPUTERNAME'));
status_curfilesystem:=usr_name;
fun:='FILEBROWSER';
FormPeach.EditOutExtract.Text:=local_desktop;
fun_status:=fun;
FormPeach.EditOpenIn.Text:=txt_mypc;
statuss:='';
set_statuss_nav;
setbuttonmenus;
GetLogicalDriveStringsW(255,@drivestr);
i:=1;
j:=1;
sizetotal:=0;
sizefree:=0;
FormPeach.StringGridList.RowCount:=32;
k:=0;
setsearch_disabled;
tsin:=datetimetotimestamp(now);
repeat
   s:='';
   s1:='';
   dtype:='';
   dname:='';
   fsname:='';
   uncname:='';
   bufVolumeName:='';
   bufFSName:='';
   while (i<=255) and (drivestr[i]<>0) do
      begin
      s:=s+char(drivestr[i]);
      inc(i);
      end;
   inc(i);
   s1:=s;
   if length(s)>0 then
      begin
      k:=k+1;
      s1:=copy(s1,1,length(s1)-1);
      c:=upcase(s[1]);
      j:=ord(c)-64;
      if j<3 then
         begin
         //check if A: and B: are floppy disks
         ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
         try
         sz:=disksize(j);
         if sz<3000000 then
            begin
            s1:=copy(s,1,length(s)-1);
            FormPeach.StringGridList.RowCount:=FormPeach.StringGridList.RowCount+1;
            FormPeach.StringGridList.Cells[1,k]:='('+s1+') '+txt_unit_floppy;
            FormPeach.StringGridList.Cells[2,k]:=txt_unit_floppy;
            FormPeach.StringGridList.Cells[3,k]:='0';
            FormPeach.StringGridList.Cells[4,k]:='0';
            FormPeach.StringGridList.Cells[14,k]:='';
            FormPeach.StringGridList.Cells[15,k]:='';
            FormPeach.StringGridList.Cells[5,k]:='';
            FormPeach.StringGridList.Cells[12,k]:=s1+directoryseparator;
            FormPeach.StringGridList.Cells[13,k]:=FormPeach.StringGridList.Cells[1,k];
            FormPeach.StringGridList.Cells[16,k]:='0';
            continue;
            end;
         finally
            SetErrorMode(ErrorMode);
         end;
         end;
      t:=getdrivetype(Pchar(s));
      case t of
         2: dtype:=txt_unit_removable;
         3: dtype:=txt_unit_hd;
         4: dtype:=txt_unit_remote;
         5: dtype:=txt_unit_cd;
         6: dtype:=txt_unit_ram;
         else dtype:=txt_unit_unknown;
         end;
      //drive name
      w:=utf8decode(s);
      tsout:=datetimetotimestamp(now);
      tdiff:=tsout.time-tsin.time;
      if testdriveaccessible(s,dtype,tdiff)=true then
         GetVolumeInformationW(Pwidechar(w),
         @bufVolumeName, sizeof(bufVolumeName),
         @sn, mc, flags,
         @bufFSName, sizeof(bufFSName));
      if bufVolumeName<>'' then begin ws:=bufVolumeName; dname:=AnsiString(ws); end
      else dname:=dtype;
      ws:=bufFSName;
      fsname:=AnsiString(ws);
      //unc name
      if dtype=txt_unit_remote then uncname:=getUNCname(Pchar(s))
      else uncname:='';
      if uncname<>'' then
         if uncname[length(uncname)]=directoryseparator then setlength(uncname,length(uncname)-1);
      if uncname='' then FormPeach.StringGridList.Cells[1,k]:='('+s1+') '+dname
      else FormPeach.StringGridList.Cells[1,k]:='('+s1+') '+uncname+' '+txt_on+' '+dname;
      FormPeach.StringGridList.Cells[2,k]:=dtype;
      FormPeach.StringGridList.Cells[3,k]:='';
      FormPeach.StringGridList.Cells[4,k]:='';
      FormPeach.StringGridList.Cells[5,k]:='';
      if fsname<>'' then
         begin
         sz:=disksize(j);
         if sz=-1 then sz:=0;
         FormPeach.StringGridList.Cells[3,k]:=inttostr(sz);
         sizetotal:=sizetotal+sz;
         end;
      if fsname<>'' then
         begin
         sz1:=diskfree(j);
         if sz1=-1 then sz1:=0;
         FormPeach.StringGridList.Cells[4,k]:=inttostr(sz1);
         sizefree:=sizefree+sz1;
         end;
      FormPeach.StringGridList.Cells[14,k]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,k]))))+inttostr(length(FormPeach.StringGridList.Cells[3,k]))+FormPeach.StringGridList.Cells[3,k];
      FormPeach.StringGridList.Cells[15,k]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[4,k]))))+inttostr(length(FormPeach.StringGridList.Cells[4,k]))+FormPeach.StringGridList.Cells[4,k];
      if fsname<>'' then
         if sz<>0 then
            FormPeach.StringGridList.Cells[5,k]:=fsname+', '+inttostr((sz1*100) div sz)+'% '+txt_free2;
      FormPeach.StringGridList.Cells[12,k]:=s1+directoryseparator;
      FormPeach.StringGridList.Cells[13,k]:=FormPeach.StringGridList.Cells[1,k];
      FormPeach.StringGridList.Cells[16,k]:='0';
      end;
until length(s)=0;
FormPeach.StringGridList.RowCount:=k+1;
//FormPeach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if (lastobj='') or (lastobj=txt_mypc) then lastobj:='C:\'; //(will skip to first drive if specified drive is not found) possible customization: select by default system drive, or user selected drive, etc...
set_lastobjpc;
if sizetotal<>0 then i:=(sizefree*100) div sizetotal;
statust:=inttostr(FormPeach.StringGridList.Rowcount-1)+' '+txt_units+'; '+nicenumber(inttostr(sizetotal),filesizebase)+', '+nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(i)+'%)';
update_listview;
FormPeach.Caption:=txt_mypc;
indir:=txt_mypc;
prevarchive:='';
listingdir:=false;
{$ENDIF}
end;

procedure savecol;
begin
if (FormPeach.mroot.Caption='<ROOT>') and (FormPeach.mroot.Visible=false) then exit; //avoid until form is fully ready
if (browsertype=0) and (FormPeach.EditOpenIn.Caption<>txt_mypc) and (frompc=false) then
   begin
   if FormPeach.ListViewBrowser.Column[0].Width>0 then col1size:=FormPeach.ListViewBrowser.Column[0].Width;
   if ctype=false then else col2size:=FormPeach.ListViewBrowser.Column[1].Width;
   if csize=false then else col3size:=FormPeach.ListViewBrowser.Column[2].Width;
   if cpacked=false then else col4size:=FormPeach.ListViewBrowser.Column[3].Width;
   if cdate=false then else col5size:=FormPeach.ListViewBrowser.Column[4].Width;
   if catt=false then else col6size:=FormPeach.ListViewBrowser.Column[9].Width;
   if ccrc=false then else col7size:=FormPeach.ListViewBrowser.Column[10].Width;
   end;
end;

function setpcmenuicon(i:integer):TBitmap;
begin
case i of
   1: setpcmenuicon:=Bfd_supported;
   2: setpcmenuicon:=Bremovable_supported;
   3: setpcmenuicon:=Bhd_supported;
   4: setpcmenuicon:=Bremote_supported;
   5: setpcmenuicon:=Bdvd_supported;
   6: setpcmenuicon:=Bram_supported;
   else setpcmenuicon:=nil;
   end;
end;

procedure countunits(var nunits:qword);
var
   s:ansistring;
   i:qword;
   drivestr:array[1..255] of word;
begin
{$IFDEF MSWINDOWS}
if countingunits=true then
   begin
   FormPeach.TimerBrowser.enabled:=false; //stop auto-checking units count if it's taking an unusual amount of time (reset on refresh or browse dir)
   exit;
   end;
countingunits:=true;
GetLogicalDriveStringsW(255,@drivestr);
i:=1;
nunits:=0;
repeat
   s:='';
   nunits:=nunits+1;
   while (i<=255) and (drivestr[i]<>0) do
      begin
      s:=s+char(drivestr[i]);
      inc(i);
      end;
   inc(i);
until length(s)=0;
nunits:=nunits-1;
countingunits:=false;
{$ENDIF}
end;

procedure copyunitmenu(a:TMenuItem; var b:TMenuItem);
begin
b.Visible:=a.Visible;
b.Caption:=a.Caption;
b.Bitmap:=a.Bitmap;
end;

procedure populatepcmenu;
{$IFDEF MSWINDOWS}
var
   s,s1,dtype,dname,uncname:ansistring;
   w:widestring;
   n:byte;
   c:char;
   sz:int64;
   i,j,k,t:qword;
   sn,mc,flags:dword;
   bufVolumeName,bufFSName: array[0..255] of WChar;
   ws:widestring;
   drivestr:array[1..255] of word;
   tsin,tsout:TTimeStamp;
   tdiff:qword;
   ErrorMode: Word;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
GetLogicalDriveStringsW(255,@drivestr);
for n:=1 to 26 do devname[n]:='';
try
i:=1;
j:=1;
k:=0;
tsin:=datetimetotimestamp(now);
repeat
   s:='';
   dtype:='';
   dname:='';
   uncname:='';
   bufVolumeName:='';
   k:=k+1;
   while (i<=255) and (drivestr[i]<>0) do
      begin
      s:=s+char(drivestr[i]);
      inc(i);
      end;
   inc(i);
   if length(s)>0 then
      begin
      c:=upcase(s[1]);
      j:=ord(c)-64;
      if j<3 then
         begin
         //check if A: and B: are floppy disks
         ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
         try
         sz:=disksize(j);
         if sz<3000000 then
            begin
            s1:=s;
            setlength(s1,length(s1)-1);
            devname[k]:='('+s1+') '+txt_unit_floppy;
            devtype[k]:=1;
            devicon[j]:=setpcmenuicon(devtype[k]);
            continue;
            end;
         finally
            SetErrorMode(ErrorMode);
         end;
         end;
      //drive type
      t:=getdrivetype(Pchar(s));
      case t of
         2: dtype:=txt_unit_removable;
         3: dtype:=txt_unit_hd;
         4: dtype:=txt_unit_remote;
         5: dtype:=txt_unit_cd;
         6: dtype:=txt_unit_ram;
         else dtype:=txt_unit_unknown;
         end;
      devtype[k]:=t;
      devicon[j]:=setpcmenuicon(devtype[k]);
      //drive name
      w:=utf8decode(s);
      tsout:=datetimetotimestamp(now);
      tdiff:=tsout.time-tsin.time;
      if testdriveaccessible(s,dtype,tdiff)=true then
         GetVolumeInformationW(Pwidechar(w),
         @bufVolumeName, sizeof(bufVolumeName),
         @sn, mc, flags,
         @bufFSName, sizeof(bufFSName));
      if bufVolumeName<>'' then begin ws:=bufVolumeName; dname:=AnsiString(ws); end
      else dname:=dtype;
      //unc name
      if dtype=txt_unit_remote then uncname:=getUNCname(Pchar(s))
      else uncname:='';
      if uncname<>'' then
         if uncname[length(uncname)]=directoryseparator then setlength(uncname,length(uncname)-1);
      s1:=s;
      setlength(s1,length(s1)-1);
      if uncname='' then devname[k]:='('+s1+') '+dname
      else devname[k]:='('+s1+') '+uncname+' '+txt_on+' '+dname;
      end;
until length(s)=0;
if devname[1]<>'' then
   begin
   FormPeach.pmjd1.Visible:=true;
   FormPeach.pmjd1.Caption:=devname[1];
   FormPeach.pmjd1.bitmap:=setpcmenuicon(devtype[1]);
   copyunitmenu(FormPeach.pmjd1,FormPeach.pojdn1);
   copyunitmenu(FormPeach.pmjd1,FormPeach.pajdn1);
   copyunitmenu(FormPeach.pmjd1,FormPeach.mextto1);
   end
else
   begin
   FormPeach.pmjd1.Visible:=false;
   FormPeach.pojdn1.Visible:=false;
   FormPeach.pajdn1.Visible:=false;
   FormPeach.mextto1.Visible:=false;
   end;
if devname[2]<>'' then
   begin
   FormPeach.pmjd2.Visible:=true;
   FormPeach.pmjd2.Caption:=devname[2];
   FormPeach.pmjd2.bitmap:=setpcmenuicon(devtype[2]);
   copyunitmenu(FormPeach.pmjd2,FormPeach.pojdn2);
   copyunitmenu(FormPeach.pmjd2,FormPeach.pajdn2);
   copyunitmenu(FormPeach.pmjd2,FormPeach.mextto2);
   end
else
   begin
   FormPeach.pmjd2.Visible:=false;
   FormPeach.pojdn2.Visible:=false;
   FormPeach.pajdn2.Visible:=false;
   FormPeach.mextto2.Visible:=false;
   end;
if devname[3]<>'' then
   begin
   FormPeach.pmjd3.Visible:=true;
   FormPeach.pmjd3.Caption:=devname[3];
   FormPeach.pmjd3.bitmap:=setpcmenuicon(devtype[3]);
   copyunitmenu(FormPeach.pmjd3,FormPeach.pojdn3);
   copyunitmenu(FormPeach.pmjd3,FormPeach.pajdn3);
   copyunitmenu(FormPeach.pmjd3,FormPeach.mextto3);
   end
else
   begin
   FormPeach.pmjd3.Visible:=false;
   FormPeach.pojdn3.Visible:=false;
   FormPeach.pajdn3.Visible:=false;
   FormPeach.mextto3.Visible:=false;
   end;
if devname[4]<>'' then
   begin
   FormPeach.pmjd4.Visible:=true;
   FormPeach.pmjd4.Caption:=devname[4];
   FormPeach.pmjd4.bitmap:=setpcmenuicon(devtype[4]);
   copyunitmenu(FormPeach.pmjd4,FormPeach.pojdn4);
   copyunitmenu(FormPeach.pmjd4,FormPeach.pajdn4);
   copyunitmenu(FormPeach.pmjd4,FormPeach.mextto4);
   end
else
   begin
   FormPeach.pmjd4.Visible:=false;
   FormPeach.pojdn4.Visible:=false;
   FormPeach.pajdn4.Visible:=false;
   FormPeach.mextto4.Visible:=false;
   end;
if devname[5]<>'' then
   begin
   FormPeach.pmjd5.Visible:=true;
   FormPeach.pmjd5.Caption:=devname[5];
   FormPeach.pmjd5.bitmap:=setpcmenuicon(devtype[5]);
   copyunitmenu(FormPeach.pmjd5,FormPeach.pojdn5);
   copyunitmenu(FormPeach.pmjd5,FormPeach.pajdn5);
   copyunitmenu(FormPeach.pmjd5,FormPeach.mextto5);
   end
else
   begin
   FormPeach.pmjd5.Visible:=false;
   FormPeach.pojdn5.Visible:=false;
   FormPeach.pajdn5.Visible:=false;
   FormPeach.mextto5.Visible:=false;
   end;
if devname[6]<>'' then
   begin
   FormPeach.pmjd6.Visible:=true;
   FormPeach.pmjd6.Caption:=devname[6];
   FormPeach.pmjd6.bitmap:=setpcmenuicon(devtype[6]);
   copyunitmenu(FormPeach.pmjd6,FormPeach.pojdn6);
   copyunitmenu(FormPeach.pmjd6,FormPeach.pajdn6);
   copyunitmenu(FormPeach.pmjd6,FormPeach.mextto6);
   end
else
   begin
   FormPeach.pmjd6.Visible:=false;
   FormPeach.pojdn6.Visible:=false;
   FormPeach.pajdn6.Visible:=false;
   FormPeach.mextto6.Visible:=false;
   end;
if devname[7]<>'' then
   begin
   FormPeach.pmjd7.Visible:=true;
   FormPeach.pmjd7.Caption:=devname[7];
   FormPeach.pmjd7.bitmap:=setpcmenuicon(devtype[7]);
   copyunitmenu(FormPeach.pmjd7,FormPeach.pojdn7);
   copyunitmenu(FormPeach.pmjd7,FormPeach.pajdn7);
   copyunitmenu(FormPeach.pmjd7,FormPeach.mextto7);
   end
else
   begin
   FormPeach.pmjd7.Visible:=false;
   FormPeach.pojdn7.Visible:=false;
   FormPeach.pajdn7.Visible:=false;
   FormPeach.mextto7.Visible:=false;
   end;
if devname[8]<>'' then
   begin
   FormPeach.pmjd8.Visible:=true;
   FormPeach.pmjd8.Caption:=devname[8];
   FormPeach.pmjd8.bitmap:=setpcmenuicon(devtype[8]);
   copyunitmenu(FormPeach.pmjd8,FormPeach.pojdn8);
   copyunitmenu(FormPeach.pmjd8,FormPeach.pajdn8);
   copyunitmenu(FormPeach.pmjd8,FormPeach.mextto8);
   end
else
   begin
   FormPeach.pmjd8.Visible:=false;
   FormPeach.pojdn8.Visible:=false;
   FormPeach.pajdn8.Visible:=false;
   FormPeach.mextto8.Visible:=false;
   end;
if devname[9]<>'' then
   begin
   FormPeach.pmjd9.Visible:=true;
   FormPeach.pmjd9.Caption:=devname[9];
   FormPeach.pmjd9.bitmap:=setpcmenuicon(devtype[9]);
   copyunitmenu(FormPeach.pmjd9,FormPeach.pojdn9);
   copyunitmenu(FormPeach.pmjd9,FormPeach.pajdn9);
   copyunitmenu(FormPeach.pmjd9,FormPeach.mextto9);
   end
else
   begin
   FormPeach.pmjd9.Visible:=false;
   FormPeach.pojdn9.Visible:=false;
   FormPeach.pajdn9.Visible:=false;
   FormPeach.mextto9.Visible:=false;
   end;
if devname[10]<>'' then
   begin
   FormPeach.pmjd10.Visible:=true;
   FormPeach.pmjd10.Caption:=devname[10];
   FormPeach.pmjd10.bitmap:=setpcmenuicon(devtype[10]);
   copyunitmenu(FormPeach.pmjd10,FormPeach.pojdn10);
   copyunitmenu(FormPeach.pmjd10,FormPeach.pajdn10);
   copyunitmenu(FormPeach.pmjd10,FormPeach.mextto10);
   end
else
   begin
   FormPeach.pmjd10.Visible:=false;
   FormPeach.pojdn10.Visible:=false;
   FormPeach.pajdn10.Visible:=false;
   FormPeach.mextto10.Visible:=false;
   end;
if devname[11]<>'' then
   begin
   FormPeach.pmjd11.Visible:=true;
   FormPeach.pmjd11.Caption:=devname[11];
   FormPeach.pmjd11.bitmap:=setpcmenuicon(devtype[11]);
   copyunitmenu(FormPeach.pmjd11,FormPeach.pojdn11);
   copyunitmenu(FormPeach.pmjd11,FormPeach.pajdn11);
   copyunitmenu(FormPeach.pmjd11,FormPeach.mextto11);
   end
else
   begin
   FormPeach.pmjd11.Visible:=false;
   FormPeach.pojdn11.Visible:=false;
   FormPeach.pajdn11.Visible:=false;
   FormPeach.mextto11.Visible:=false;
   end;
if devname[12]<>'' then
   begin
   FormPeach.pmjd12.Visible:=true;
   FormPeach.pmjd12.Caption:=devname[12];
   FormPeach.pmjd12.bitmap:=setpcmenuicon(devtype[12]);
   copyunitmenu(FormPeach.pmjd12,FormPeach.pojdn12);
   copyunitmenu(FormPeach.pmjd12,FormPeach.pajdn12);
   copyunitmenu(FormPeach.pmjd12,FormPeach.mextto12);
   end
else
   begin
   FormPeach.pmjd12.Visible:=false;
   FormPeach.pojdn12.Visible:=false;
   FormPeach.pajdn12.Visible:=false;
   FormPeach.mextto12.Visible:=false;
   end;
if devname[13]<>'' then
   begin
   FormPeach.pmjd13.Visible:=true;
   FormPeach.pmjd13.Caption:=devname[13];
   FormPeach.pmjd13.bitmap:=setpcmenuicon(devtype[13]);
   copyunitmenu(FormPeach.pmjd13,FormPeach.pojdn13);
   copyunitmenu(FormPeach.pmjd13,FormPeach.pajdn13);
   copyunitmenu(FormPeach.pmjd13,FormPeach.mextto13);
   end
else
   begin
   FormPeach.pmjd13.Visible:=false;
   FormPeach.pojdn13.Visible:=false;
   FormPeach.pajdn13.Visible:=false;
   FormPeach.mextto13.Visible:=false;
   end;
if devname[14]<>'' then
   begin
   FormPeach.pmjd14.Visible:=true;
   FormPeach.pmjd14.Caption:=devname[14];
   FormPeach.pmjd14.bitmap:=setpcmenuicon(devtype[14]);
   copyunitmenu(FormPeach.pmjd14,FormPeach.pojdn14);
   copyunitmenu(FormPeach.pmjd14,FormPeach.pajdn14);
   copyunitmenu(FormPeach.pmjd14,FormPeach.mextto14);
   end
else
   begin
   FormPeach.pmjd14.Visible:=false;
   FormPeach.pojdn14.Visible:=false;
   FormPeach.pajdn14.Visible:=false;
   FormPeach.mextto14.Visible:=false;
   end;
if devname[15]<>'' then
   begin
   FormPeach.pmjd15.Visible:=true;
   FormPeach.pmjd15.Caption:=devname[15];
   FormPeach.pmjd15.bitmap:=setpcmenuicon(devtype[15]);
   copyunitmenu(FormPeach.pmjd15,FormPeach.pojdn15);
   copyunitmenu(FormPeach.pmjd15,FormPeach.pajdn15);
   copyunitmenu(FormPeach.pmjd15,FormPeach.mextto15);
   end
else
   begin
   FormPeach.pmjd15.Visible:=false;
   FormPeach.pojdn15.Visible:=false;
   FormPeach.pajdn15.Visible:=false;
   FormPeach.mextto15.Visible:=false;
   end;
if devname[16]<>'' then
   begin
   FormPeach.pmjd16.Visible:=true;
   FormPeach.pmjd16.Caption:=devname[16];
   FormPeach.pmjd16.bitmap:=setpcmenuicon(devtype[16]);
   copyunitmenu(FormPeach.pmjd16,FormPeach.pojdn16);
   copyunitmenu(FormPeach.pmjd16,FormPeach.pajdn16);
   copyunitmenu(FormPeach.pmjd16,FormPeach.mextto16);
   end
else
   begin
   FormPeach.pmjd16.Visible:=false;
   FormPeach.pojdn16.Visible:=false;
   FormPeach.pajdn16.Visible:=false;
   FormPeach.mextto16.Visible:=false;
   end;
if devname[17]<>'' then
   begin
   FormPeach.pmjd17.Visible:=true;
   FormPeach.pmjd17.Caption:=devname[17];
   FormPeach.pmjd17.bitmap:=setpcmenuicon(devtype[17]);
   copyunitmenu(FormPeach.pmjd17,FormPeach.pojdn17);
   copyunitmenu(FormPeach.pmjd17,FormPeach.pajdn17);
   copyunitmenu(FormPeach.pmjd17,FormPeach.mextto17);
   end
else
   begin
   FormPeach.pmjd17.Visible:=false;
   FormPeach.pojdn17.Visible:=false;
   FormPeach.pajdn17.Visible:=false;
   FormPeach.mextto17.Visible:=false;
   end;
if devname[18]<>'' then
   begin
   FormPeach.pmjd18.Visible:=true;
   FormPeach.pmjd18.Caption:=devname[18];
   FormPeach.pmjd18.bitmap:=setpcmenuicon(devtype[18]);
   copyunitmenu(FormPeach.pmjd18,FormPeach.pojdn18);
   copyunitmenu(FormPeach.pmjd18,FormPeach.pajdn18);
   copyunitmenu(FormPeach.pmjd18,FormPeach.mextto18);
   end
else
   begin
   FormPeach.pmjd18.Visible:=false;
   FormPeach.pojdn18.Visible:=false;
   FormPeach.pajdn18.Visible:=false;
   FormPeach.mextto18.Visible:=false;
   end;
if devname[19]<>'' then
   begin
   FormPeach.pmjd19.Visible:=true;
   FormPeach.pmjd19.Caption:=devname[19];
   FormPeach.pmjd19.bitmap:=setpcmenuicon(devtype[19]);
   copyunitmenu(FormPeach.pmjd19,FormPeach.pojdn19);
   copyunitmenu(FormPeach.pmjd19,FormPeach.pajdn19);
   copyunitmenu(FormPeach.pmjd19,FormPeach.mextto19);
   end
else
   begin
   FormPeach.pmjd19.Visible:=false;
   FormPeach.pojdn19.Visible:=false;
   FormPeach.pajdn19.Visible:=false;
   FormPeach.mextto19.Visible:=false;
   end;
if devname[20]<>'' then
   begin
   FormPeach.pmjd20.Visible:=true;
   FormPeach.pmjd20.Caption:=devname[20];
   FormPeach.pmjd20.bitmap:=setpcmenuicon(devtype[20]);
   copyunitmenu(FormPeach.pmjd20,FormPeach.pojdn20);
   copyunitmenu(FormPeach.pmjd20,FormPeach.pajdn20);
   copyunitmenu(FormPeach.pmjd20,FormPeach.mextto20);
   end
else
   begin
   FormPeach.pmjd20.Visible:=false;
   FormPeach.pojdn20.Visible:=false;
   FormPeach.pajdn20.Visible:=false;
   FormPeach.mextto20.Visible:=false;
   end;
if devname[21]<>'' then
   begin
   FormPeach.pmjd21.Visible:=true;
   FormPeach.pmjd21.Caption:=devname[21];
   FormPeach.pmjd21.bitmap:=setpcmenuicon(devtype[21]);
   copyunitmenu(FormPeach.pmjd21,FormPeach.pojdn21);
   copyunitmenu(FormPeach.pmjd21,FormPeach.pajdn21);
   copyunitmenu(FormPeach.pmjd21,FormPeach.mextto21);
   end
else
   begin
   FormPeach.pmjd21.Visible:=false;
   FormPeach.pojdn21.Visible:=false;
   FormPeach.pajdn21.Visible:=false;
   FormPeach.mextto21.Visible:=false;
   end;
if devname[22]<>'' then
   begin
   FormPeach.pmjd22.Visible:=true;
   FormPeach.pmjd22.Caption:=devname[22];
   FormPeach.pmjd22.bitmap:=setpcmenuicon(devtype[22]);
   copyunitmenu(FormPeach.pmjd22,FormPeach.pojdn22);
   copyunitmenu(FormPeach.pmjd22,FormPeach.pajdn22);
   copyunitmenu(FormPeach.pmjd22,FormPeach.mextto22);
   end
else
   begin
   FormPeach.pmjd22.Visible:=false;
   FormPeach.pojdn22.Visible:=false;
   FormPeach.pajdn22.Visible:=false;
   FormPeach.mextto22.Visible:=false;
   end;
if devname[23]<>'' then
   begin
   FormPeach.pmjd23.Visible:=true;
   FormPeach.pmjd23.Caption:=devname[23];
   FormPeach.pmjd23.bitmap:=setpcmenuicon(devtype[23]);
   copyunitmenu(FormPeach.pmjd23,FormPeach.pojdn23);
   copyunitmenu(FormPeach.pmjd23,FormPeach.pajdn23);
   copyunitmenu(FormPeach.pmjd23,FormPeach.mextto23);
   end
else
   begin
   FormPeach.pmjd23.Visible:=false;
   FormPeach.pojdn23.Visible:=false;
   FormPeach.pajdn23.Visible:=false;
   FormPeach.mextto23.Visible:=false;
   end;
if devname[24]<>'' then
   begin
   FormPeach.pmjd24.Visible:=true;
   FormPeach.pmjd24.Caption:=devname[24];
   FormPeach.pmjd24.bitmap:=setpcmenuicon(devtype[24]);
   copyunitmenu(FormPeach.pmjd24,FormPeach.pojdn24);
   copyunitmenu(FormPeach.pmjd24,FormPeach.pajdn24);
   copyunitmenu(FormPeach.pmjd24,FormPeach.mextto24);
   end
else
   begin
   FormPeach.pmjd24.Visible:=false;
   FormPeach.pojdn24.Visible:=false;
   FormPeach.pajdn24.Visible:=false;
   FormPeach.mextto24.Visible:=false;
   end;
if devname[25]<>'' then
   begin
   FormPeach.pmjd25.Visible:=true;
   FormPeach.pmjd25.Caption:=devname[25];
   FormPeach.pmjd25.bitmap:=setpcmenuicon(devtype[25]);
   copyunitmenu(FormPeach.pmjd25,FormPeach.pojdn25);
   copyunitmenu(FormPeach.pmjd25,FormPeach.pajdn25);
   copyunitmenu(FormPeach.pmjd25,FormPeach.mextto25);
   end
else
   begin
   FormPeach.pmjd25.Visible:=false;
   FormPeach.pojdn25.Visible:=false;
   FormPeach.pajdn25.Visible:=false;
   FormPeach.mextto25.Visible:=false;
   end;
if devname[26]<>'' then
   begin
   FormPeach.pmjd26.Visible:=true;
   FormPeach.pmjd26.Caption:=devname[26];
   FormPeach.pmjd26.bitmap:=setpcmenuicon(devtype[26]);
   copyunitmenu(FormPeach.pmjd26,FormPeach.pojdn26);
   copyunitmenu(FormPeach.pmjd26,FormPeach.pajdn26);
   copyunitmenu(FormPeach.pmjd26,FormPeach.mextto26);
   end
else
   begin
   FormPeach.pmjd26.Visible:=false;
   FormPeach.pojdn26.Visible:=false;
   FormPeach.pajdn26.Visible:=false;
   FormPeach.mextto26.Visible:=false;
   end;
//set up to date icons to bookmarked units
populatebookmarks;
populaterecenticonsf;
addtohistorypopup;
if fun='FILEBROWSER' then update_addressbar(FormPeach.EditOpenInInteractive.Text);//may be not needed, does not work with archive internal breadcrumb
FormPeach.StringGridBookmarks.Repaint;
except
end;
{$ELSE}
{$ENDIF}
end;

procedure setbrowsertype(btype:integer);
begin
clearicons;
with FormPeach do
case btype of
   0: begin
   ListViewBrowser.ViewStyle:=vsReport;
   browsertype:=0;
   if openstarted=true then loadsmallicons(smalliconsize);
   end;
   1: begin
   ListViewBrowser.ViewStyle:=vsList;
   {$IFDEF MSWINDOWS}ListView_SetColumnWidth(ListViewBrowser.Handle, 0, 240);{$ENDIF}
   browsertype:=1;
   if openstarted=true then loadsmallicons(smalliconsize);
   end;
   2: begin
   ListViewBrowser.ViewStyle:=vsIcon;
   browsertype:=2;
   if openstarted=true then loadlargeicons(largeiconsize);
   end;
   end;
{$IFDEF MSWINDOWS}
if FormPeach.PanelIntro.Visible=false then begin navrefresh; end;
{$ELSE}
do_forcerefresh;
{$ENDIF} //refresh content and rebuild icons after changing browser's properties
end;

procedure setbrowsersize(bsize:integer);
begin
with FormPeach do
begin
pmsizesmall.checked:=false;
pmsizemedium.checked:=false;
pmsizelarge.checked:=false;
pmsizelargep.checked:=false;
pmsizelargepp.checked:=false;
pmsizelargeppp.checked:=false;
pmsizelargepppp.checked:=false;
case bsize of
   0: begin
   pmsizesmall.checked:=true;
   smalliconsize:=16;
   largeiconsize:=48;
   end;
   1: begin
   pmsizemedium.checked:=true;
   smalliconsize:=24;
   largeiconsize:=64;
   end;
   2: begin
   pmsizelarge.checked:=true;
   smalliconsize:=32;
   largeiconsize:=72;
   end;
   3: begin
   pmsizelargep.checked:=true;
   smalliconsize:=48;
   largeiconsize:=96;
   end;
   4: begin
   pmsizelargepp.checked:=true;
   smalliconsize:=64;
   largeiconsize:=128;
   end;
   5: begin
   pmsizelargeppp.checked:=true;
   smalliconsize:=72;
   largeiconsize:=144;
   end;
   6: begin
   pmsizelargepppp.checked:=true;
   smalliconsize:=96;
   largeiconsize:=192;
   end;
   end;
end;
browsersize:=bsize;
setbrowsertype(browsertype);
end;

procedure on_ComboBoxsecChange;
begin
seccond:=FormPeach.ComboBoxsec.ItemIndex;
if seccond=3 then
   FormPeach.editExtEvForSec.enabled:=false
else
   FormPeach.editExtEvForSec.enabled:=true;
end;

procedure patch_stringgrid(sg:TStringGrid);
var
   i,j:integer;
begin
for i:=1 to sg.RowCount-1 do
   for j:=0 to sg.ColCount-1 do sg.Cells[j,i]:=patchclip[i-1,j];
end;

procedure checkpatherrors(var s:ansistring);
var
   s1:ansistring;
   patherr:boolean;
begin
patherr:=false;
repeat
if length(s)<=2 then patherr:=false
else
   begin
   s1:=copy(s,1,2);
   if s1='//' then
      begin
      s:=copy(s,2,length(s)-1);
      patherr:=true;
      end
   else patherr:=false;
   end;
until patherr=false;
FormPeach.EditOpenInInteractive.Text:=s;
FormPeach.EditOpenIn.Text:=FormPeach.EditOpenInInteractive.Text;
end;

procedure forcethumbnails; //show thubnails in file manager on request, cross platform
var
   i,eisize:integer;
   abitmap:tbitmap;
   fs,inidir:ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if fun<>'FILEBROWSER' then exit;
inidir:=FormPeach.EditOpenIn.Caption;
fthumbs:=true;
//enter_busy_status; //do not lock file manager for usability
//recount items as file manager view is not locked and content can change accordingly to filesystem changes
//if folder content changes refresh action is automatically issues by timer and the rendering sequence is interrupted
for i:=1 to FormPeach.StringGridList.Rowcount-1 do
   if supportedimgtype(FormPeach.StringGridList.Cells[2,i])=true then
      begin
      abitmap:=Tbitmap.Create;
      load_bitmap(abitmap, FormPeach.StringGridList.Cells[12,i], scalediconsize, deco_style, fs);
      setsize_bitmap(abitmap, spacedscalediconsize, DECO_NONE);
      case browsertype of
         2: eisize:=largeiconsize;
         1: eisize:=smalliconsize;
         0: eisize:=smalliconsize;
      end;
      if eisize=16 then
         begin
         il16.Add(abitmap,nil);
         FormPeach.ListViewBrowser.Items[i-1].ImageIndex:=il16.Count-1;
         end
      else
         begin
         il96.Add(abitmap,nil);
         FormPeach.ListViewBrowser.Items[i-1].ImageIndex:=il96.Count-1;
         end;
      //FormPeach.StringGridList.Cells[4,i]:=fs;
      //FormPeach.StringGridList.Cells[15,i]:=fs;
      abitmap.free;
      Application.ProcessMessages;
      if (inidir<>FormPeach.EditOpenIn.Caption) or (endflag=true)
         or (fun<>'FILEBROWSER') or (prevpanel<>'open') or (fthumbs=false) then
         begin
         //exit_busy_status;
         exit;
         end;
      end;
//exit_busy_status;
end;

procedure viewimage;
var
   i:integer;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
//block functions not supported from within archive
if fun<>'FILEBROWSER' then
   FormImgViewer.mdelete.Visible:=false
else
   FormImgViewer.mdelete.Visible:=true;
FormImgViewer.mrename.Visible:=FormImgViewer.mdelete.Visible;
FormImgViewer.mupdate.Visible:=FormImgViewer.mdelete.Visible;
FormImgViewer.mfwd.Visible:=FormImgViewer.mdelete.Visible;
FormImgViewer.mback.Visible:=FormImgViewer.mdelete.Visible;
FormImgViewer.mfirst.Visible:=FormImgViewer.mdelete.Visible;
FormImgViewer.mlast.Visible:=FormImgViewer.mdelete.Visible;
FormImgViewer.Separator2.Visible:=FormImgViewer.mdelete.Visible;
UnitImgViewer.fun:=fun;
//view image
if fun<>'FILEBROWSER' then
   begin
   openwith_base('preview','imgviewer');
   end
else
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         UnitImgViewer.viewerbusy:=false;
         if supportedimgtype(FormPeach.StringGridList.Cells[2,i])<>true then exit;
         UnitImgViewer.imgviewersrc:=i;
         //if filebrowser pass the list in file browser
         FormImgViewer.StringGridImgViewer.Assign(FormPeach.StringGridList);
         //open image
         UnitImgViewer.applyzoom('open');
         FormImgViewer.WindowState:=wsMaximized;
         FormImgViewer.Showmodal;
         exit;
         end;
end;

procedure viewimageloop;
var
   i:integer;
   ifound,iupdated:boolean;
begin
iupdated:=false;
repeat
viewimage;
if FormImgViewer.ModalResult=mrRetry then //reload image viewer passing updated list of items starting from first valid image, exit if no image is found
   begin
   FormImgViewer.StringGridImgViewer.RowCount:=1;
   ifound:=false;
   iupdated:=true;
   FormPeach.f5refreshExecute(nil);
   if FormPeach.StringGridList.RowCount<2 then exit;
   if FormPeach.StringGridList.Cells[1,1]='' then exit;
   if fun<>'FILEBROWSER' then exit; //safety double check: update is not needed/enabled inside archives
   for i:=1 to FormPeach.StringGridList.RowCount-1 do //search match with last item viewed
      if supportedimgtype(FormPeach.StringGridList.Cells[2,i])=true then
         begin
         if not FileExists(FormPeach.StringGridList.Cells[12,i]) then Continue;
         if FormPeach.StringGridList.Cells[12,i]=imageviewername then
            begin
            FormPeach.StringGridList.Cells[16,i]:='1';
            ifound:=true;
            break;
            end;
         end;
   if ifound=false then //if no match found with last viewed item, search match with first valid image
    for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if supportedimgtype(FormPeach.StringGridList.Cells[2,i])=true then
         begin
         if not FileExists(FormPeach.StringGridList.Cells[12,i]) then Continue;
         FormPeach.StringGridList.Cells[16,i]:='1';
         ifound:=true;
         break;
         end;
   if ifound=false then exit;
   end;
until FormImgViewer.ModalResult<>mrRetry;
if iupdated=true then FormPeach.f5refreshExecute(nil);
end;

procedure listdir(s:ansistring; recmode,treemode:boolean);
var
   nfiles,ndirs,size,sizefree,sizetotal:qword;
   perfree: integer;
   flist: TFoundList;
   fsizes: TFoundListSizes;
   ftimes: TFoundListAges;
   fattr: TFoundListAttrib;
   fattr_dec: TFoundList;
   fname:ansistring;
   s1,scap:ansistring;
   d:char;
   i,j,k,iext:integer;
begin
FormPeach.TimerBrowser.Interval:=1000;
FormPeach.TimerBrowser.Enabled:=true;
statuss:='';
piperar:=false;
set_archivetree:=false;
FormPeach.PanelLCA8.Color:=clNone;
FormPeach.ImageListSearch.Enabled:=true;
forceopenasarchive:=false;
specbrowse:='';
pspecbrowse:='';
FormPeach.LabelComment.Caption:='';
FormPeach.LabelComment.Hint:='';
zaout:=zaout1;
{$IFDEF MSWINDOWS}
if (s=txt_mypc) or (s='Computer''s root\') then
   begin
   listpc;
   exit;
   end;
{$ENDIF}
if listingdir=true then exit;
listingdir:=true;
savecol;
recpmem;
keeppreview:=false;
selnode:=0;
beingpreviewed:='';
wasselected:=-1;
wasselectedp:=-1;
if FormPeach.StringGridSessionHistory.rowcount>1 then singleextract:=false;
specialopen:=false;
for k := 1 to 4 do abcrs[k] :='';
{$IFNDEF MSWINDOWS}checkpatherrors(s);{$ENDIF}
settoolbar;
seemencrypted:=false;
funflag:=false;
fromtree:=false;
if treemode=false then
   if ShellTreeViewSetTextPath(FormPeach.ShellTreeViewNav,s)=1 then ShellTreeViewSetTextPath(FormPeach.ShellTreeViewNav,s);
if ptmpcode<>'' then cleardirasync(ptmpdir);
if pstmpdir<>'' then cleardirasync(pstmpdir);
ptmpdir:='';
pstmpdir:='';
FormPeach.StringGridArchive.RowCount:=1;
addmenuenable(1);
if (extractfilename(prevarchive)<>'') then //if previously browsing archive
   if keeppw=0 then
      begin
      FormPW.EditPWpass.Text:='';
      FormPW.EditPWconfirm.Text:='';
      FormPW.EditPWkeyfile.Text:='';
      setpwicons;
      end;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
prevarchive:=s;
prepare_filebrowser;
if not(checkdirexists(s)) then
   begin
   s1:=s;
   setlength(s1,length(s1)-1);
   s1:=extractfilepath(s1);
   if length(s1)=2 then
      begin
      listingdir:=false;
      listpc;
      exit;
      end
   else
      begin
      listingdir:=false;
      listdir(s1,recmode,treemode);
      exit;
      end;
   end;
currentcomp:='';
statust:='';
archive_content:='';
{if s<>'' then
   if s[length(s)]<>directoryseparator then FormPeach.EditOpenIn.Text:=s+directoryseparator
else} FormPeach.EditOpenIn.Text:=s;
setbuttonmenus;
FormPeach.LabelExtHere.Visible:=false;
FormPeach.EditOutExtract.Text:=FormPeach.EditOpenIn.Text;
enter_busy_status;
setbrowserwarning_off;
setsearch_enabled;
if FormPeach.LabelStatusExtract.Caption<>txt_2_7_ext then clearlist_ext; //clear extraction list when leaving an archive
FormPeach.StringGridList.RowCount:=1;
status0:=txt_list_searching;
status1:=txt_please_wait;
if FormPeach.visible=true then
   if issearching=2 then
      begin
      scap:=FormPeach.Caption;
      FormPeach.Caption:=txt_search;
      FormPeach.Refresh;
      Application.Processmessages;
      end;
if FormPeach.EditUn7zaFilter.Text='' then FormPeach.EditUn7zaFilter.Text:='*';
if (simplesearch=1) then listdetails(s,'*'+FormPeach.EditUn7zaFilter.Text+'*',faAnyFile,recmode,false,nfiles,ndirs,flist,fsizes,ftimes,fattr,fattr_dec)
else listdetails(s,FormPeach.EditUn7zaFilter.Text,faAnyFile,recmode,false,nfiles,ndirs,flist,fsizes,ftimes,fattr,fattr_dec);
if FormPeach.visible=true then
   if issearching=2 then
      begin
      FormPeach.Caption:=scap;
      end;
FormPeach.StringGridList.BeginUpdate;
FormPeach.StringGridList.RowCount:=nfiles+1;
size:=0;
for i:=1 to (nfiles) do
   begin
   fname:=flist[i-1];
   if fname<>'' then
      if fname[length(fname)]=directoryseparator then
         begin
         FormPeach.StringGridList.Cells[2,i]:=txt_list_isfolder;
         setlength(fname,length(fname)-1);
         FormPeach.StringGridList.Cells[13,i]:=prefixd+smartsortable(extractfilename(fname));
         end
      else
         begin
         FormPeach.StringGridList.Cells[2,i]:=extractfileext(fname);
         FormPeach.StringGridList.Cells[13,i]:=prefixf+smartsortable(extractfilename(fname));
         end;
   FormPeach.StringGridList.Cells[1,i]:=extractfilename(fname);
   FormPeach.StringGridList.Cells[12,i]:=(fname);
   FormPeach.StringGridList.Cells[3,i]:=inttostr(fsizes[i-1]);
   size:=size+fsizes[i-1];
   iext:=testext(fname);
   if iext>=0 then
      if (iext>=500) and (iext<=503) then
         FormPeach.StringGridList.Cells[4,i]:='.'
      else
         FormPeach.StringGridList.Cells[4,i]:='+';
   FormPeach.StringGridList.Cells[14,i]:=inttostr(length(inttostr(length(FormPeach.StringGridList.Cells[3,i]))))+inttostr(length(FormPeach.StringGridList.Cells[3,i]))+FormPeach.StringGridList.Cells[3,i];
   FormPeach.StringGridList.Cells[15,i]:=FormPeach.StringGridList.Cells[4,i];
   try FormPeach.StringGridList.Cells[5,i]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(ftimes[i-1])); except FormPeach.StringGridList.Cells[5,i]:=''; end;
   dword2decodedFileAttributes(fattr[i-1],fname);
   FormPeach.StringGridList.Cells[10,i]:=fname;
   FormPeach.StringGridList.Cells[16,i]:='0';
   end;
if FormPeach.StringGridList.Rowcount<2 then FormPeach.StringGridList.Rowcount:=2;
status0:=txt_list_sorting;
status1:=inttostr(ndirs)+' '+txt_dirs+' '+inttostr(nfiles-ndirs)+' '+txt_files+' '+nicenumber(inttostr(size),filesizebase);
getcurrentfs(s,currentfs);
sizefree:=1;
sizetotal:=1;
perfree:=1;
{$IFNDEF MSWINDOWS}
sizefree:=diskfree(AddDisk(FormPeach.EditOpenIn.Text));
sizetotal:=disksize(AddDisk(FormPeach.EditOpenIn.Text));
if sizetotal<>0 then perfree:=(sizefree*100) div sizetotal;
statuss:=nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
status_curfilesystem:=nicenumber(IntToStr(sizetotal),filesizebase)+', '+nicenumber(IntToStr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
{$ENDIF}
{$IFDEF MSWINDOWS}
d:=FormPeach.EditOpenIn.Text[1];
if d<>directoryseparator then
   begin
   j:=ord(upcase(d))-64;
   if j>2 then
      begin
      sizefree:=diskfree(j);
      sizetotal:=disksize(j);
      if sizetotal<>0 then perfree:=(sizefree*100) div sizetotal;
      end;
   currentfs:=currentfs;
   end;
status_curfilesystem:=upcase(d)+': '+currentfs+' '+nicenumber(IntToStr(sizetotal),filesizebase)+', '+nicenumber(IntToStr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
{$ENDIF}
//FormPeach.shapeFSfree.Height:=FormPeach.shapeFStotal.Height - ((FormPeach.shapeFStotal.Height*sizefree) div sizetotal);
if recmode=true then FormPeach.labelstatus.Caption:=status0+' '+status1+' ['+status_curfilesystem+']';
if FormPeach.visible=true then Application.Processmessages;
//FormPeach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
set_lastobj;
lastobj:=FormPeach.EditOpenIn.Text;
if recmode=false then status0:=txt_list_browsing
else status0:=txt_list_flat;
if recmode=true then FormPeach.labelstatus.Caption:=status0+' '+status1+' ['+status_curfilesystem+']';
{$IFDEF MSWINDOWS}
d:=FormPeach.EditOpenIn.Text[1];
if d<>directoryseparator then
   begin
   statust:=copy(FormPeach.EditOpenIn.Caption,1,3)+' '+nicenumber(inttostr(sizetotal),filesizebase)+', '+nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2;
   statuss:=nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
   end
else //unmapped network unit
   begin
   statust:=FormPeach.EditOpenIn.Caption;
   statuss:='';
   end;
{$ENDIF}
FormPeach.StringGridList.EndUpdate(true);
update_listview;
view_lastobj;
exit_busy_status;
indir:=s;
listingdir:=false;
{$IFNDEF MSWINDOWS}
if (showthumbnails=1) and (FormPeach.Visible=true) and (FormPeach.PanelIntro.Top<>0) and (openstarted=true) then
   if gofthumbs=true then
      begin
      addtohistory;
      forcethumbnails;
      end;
{$ENDIF}
end;

procedure opendir(s:ansistring);
begin
fun:='FILEBROWSER';
fun_status:=fun;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
FormPeach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure browsefiledir(s:ansistring);
var
   s1:ansistring;
begin
if browserbusy=true then exit;
FormPeach.EditOpenInInteractive.Text:=s;
FormPeach.EditOpenIn.Text:=FormPeach.EditOpenInInteractive.Text;
FormPeach.EditUn7zaFilter.Text:='*';
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   listpc;
   addtohistory;
   exit;
   end;
{$ENDIF}
s1:=s;
if s<>'' then
   if s[length(s)]=directoryseparator then s1:=copy(s,1,length(s)-1);
if checkUNCpath(s) then
   begin
   if (extractfilepath(s1)='\\') or (extractfilepath(s1)='\') or (extractfilepath(s1)='') then
      begin
      listpc;
      addtohistory;
      exit;
      end;
   end;
if checkdirexists(FormPeach.EditOpenIn.Text) then
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   listdir(FormPeach.EditOpenIn.Text,false,false);
   addtohistory;
   end
else open_archive_fromname(s1);
end;

procedure filter_listaddress;
var
   i,rc:integer;
   cancontinue:boolean;
begin
if FormPeach.ListViewBrowser.OwnerData=true then exit; //current filter implementation is not compatible with virtual mode
if FormPeach.EditOpenInInteractive.Text=FormPeach.EditOpenIn.Text then exit;
rc:=FormPeach.StringGridAddress.Rowcount;
if rc<=1 then exit;
updatinglistview:=true;
FormPeach.ImageListResetSearch.visible:=true;
FormPeach.ImageListResetSearch.Hint:=txt_reset;
FormPeach.ListViewBrowser.Items.BeginUpdate;
FormPeach.StringGridList.BeginUpdate;
FormPeach.ListViewBrowser.Cursor:=crHourglass;

cancontinue:=false;
if length(FormPeach.EditOpenInInteractive.Text)=1 then
   if prevlistfilter='' then cancontinue:=true;
if length(FormPeach.EditOpenInInteractive.Text)>1 then
   if (prevlistfilter=copy(FormPeach.EditOpenInInteractive.Text,1,length(FormPeach.EditOpenInInteractive.Text)-1))
      or (prevlistfilter=FormPeach.EditOpenInInteractive.Text) then
      cancontinue:=true;//filter current data

if cancontinue=false then //re-generate data
   begin
   FormPeach.ListViewBrowser.Clear;
   for i:=0 to FormPeach.ListAddress.Items.Count-1 do FormPeach.ListViewBrowser.Items.Add.Assign(FormPeach.ListAddress.Items[i]);
   FormPeach.StringGridList.Clear;
   FormPeach.StringGridList.RowCount:=rc;
   //for i:=0 to rc-1 do FormPeach.StringGridList.Rows[i].Assign(FormPeach.StringGridAddress.Rows[i]);
   FormPeach.StringGridList.Assign(FormPeach.StringGridAddress);
   if FormPeach.EditOpenInInteractive.Text='' then
      begin
      FormPeach.ListViewBrowser.Cursor:=crDefault;
      FormPeach.ListViewBrowser.Items.EndUpdate;
      FormPeach.StringGridList.EndUpdate;
      prevlistfilter:=FormPeach.EditOpenInInteractive.Text;
      updatinglistview:=false;
      exit;
      end;
   end;

i:=0;
while i<=(FormPeach.ListViewBrowser.Items.Count-1) do
   begin
   if MatchesMask(FormPeach.ListViewBrowser.Items[i].Caption,'*'+FormPeach.EditOpenInInteractive.Text+'*',false) then i:=i+1
   else
      begin
      FormPeach.ListViewBrowser.Items[i].Delete;
      FormPeach.StringGridList.DeleteRow(i+1);
      end;
   end;

if FormPeach.StringGridList.RowCount<2 then FormPeach.StringGridList.RowCount:=2;

FormPeach.ListViewBrowser.Cursor:=crDefault;
FormPeach.ListViewBrowser.Items.EndUpdate;
FormPeach.StringGridList.EndUpdate;
prevlistfilter:=FormPeach.EditOpenInInteractive.Text;
updatinglistview:=false;
end;

procedure browsehistory;
var
   i,selptab:integer;
   s1,s2:ansistring;
begin
browsinghistory:=true;
with FormPeach do
   begin
   {$IFDEF MSWINDOWS}
   if StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]=txt_mypc then
      begin
      listpc;
      //PanelHistory.Visible:=false;
      browsinghistory:=false;
      sethistorybuttons;
      for selptab:=0 to FormPeach.TabBar.Sections.Count-1 do if FormPeach.TabBar.Sections.Items[selptab].ID=atabid then break;
      if FormPeach.TabBar.Sections.Items[selptab].ID<>0 then
          begin
          FormPeach.TabBar.Sections[selptab].Text:=gettabname(FormPeach.StringGridSessionHistory.Row);
          FormPeach.TabBar.Sections[selptab].ImageIndex:=drawtabicon(FormPeach.StringGridSessionHistory.Row);
          FormPeach.StringGridTabs.Rows[atabid]:=FormPeach.StringGridSessionHistory.Rows[FormPeach.StringGridSessionHistory.Row];
          end;
      exit;
      end;
   {$ENDIF}
   if check7zvolume(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row])=true then
   else
      if not(fileexists((StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]))) and
      not(checkdirexists((StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]))) then
         begin
         browsinghistory:=false;
         exit;
         end;
   testarctype(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row],i,fun);
   setbuttonmenus;
   case fun of
      'UN7Z' :
      begin
      s1:=StringGridSessionHistory.Cells[3,StringGridSessionHistory.Row];
      s2:=StringGridSessionHistory.Cells[4,StringGridSessionHistory.Row];
      if StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]<>EditOpenIn.Text then
         begin
         open_archive_fromname(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]);
         StringGridSessionHistory.Row:=1;
         end;
      EditUn7zaFilter.Text:=s1;
      EditUn7zaFilterExclude.Text:=s2;
      status0:=StringGridSessionHistory.Cells[1,StringGridSessionHistory.Row];
      filter_archivecontent;
      //don't add to history
      sethistorybuttons;
      end;
      'FILEBROWSER' :
      begin
      EditUn7zaFilter.Text:=StringGridSessionHistory.Cells[3,StringGridSessionHistory.Row];
      if StringGridSessionHistory.Cells[1,StringGridSessionHistory.Row]=txt_list_browsing then listdir(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row],false,false)
      else listdir(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row],true,false);
      status0:=StringGridSessionHistory.Cells[1,StringGridSessionHistory.Row];
      //don't add to history
      sethistorybuttons;
      end;
      else///if (fun<>'UN7Z') and (fun<>'FILEBROWSER') then
      begin
      if StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]<>EditOpenIn.Text then open_archive_fromname(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]);
      end;
      end;
   populatetree;
   for selptab:=0 to FormPeach.TabBar.Sections.Count-1 do if FormPeach.TabBar.Sections.Items[selptab].ID=atabid then break;
   if FormPeach.TabBar.Sections.Items[selptab].ID<>0 then
       begin
       FormPeach.TabBar.Sections[selptab].Text:=gettabname(FormPeach.StringGridSessionHistory.Row);
       FormPeach.TabBar.Sections[selptab].ImageIndex:=drawtabicon(FormPeach.StringGridSessionHistory.Row);
       FormPeach.StringGridTabs.Rows[atabid]:=FormPeach.StringGridSessionHistory.Rows[FormPeach.StringGridSessionHistory.Row];
       end;
   browsinghistory:=false;
   end;
end;

procedure navrefresh;
var
   carcpath:ansistring;
begin
if browserbusy=true then exit;
fthumbs:=false;
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true then{$ELSE}if FormPeach.PanelOpen.Top=0 then{$ENDIF}
begin
if fun='FILEBROWSER' then
   if FormPeach.StringGridSessionHistory.RowCount>1 then
      begin
      browsehistory;
      FormPeach.ShellTreeViewNav.Refresh(FormPeach.ShellTreeViewNav.Selected);
      end
   else
else
   if (fun='UN7Z') then
      begin
      if status0=txt_list_flat then listun7z_expandall
      else
         begin
         carcpath:='';
         if abcrs[4]<>'' then carcpath:=abcrs[4]
         else
            if abcrs[3]<>'' then carcpath:=abcrs[3]
            else
               if abcrs[2]<>'' then carcpath:=abcrs[2]
               else
                  if abcrs[1]<>'' then carcpath:=abcrs[1];
         FormPeach.EditUn7zaFilterInteractive.Caption:=carcpath+'*';
         kp_EditUn7zaFilterInteractive_nonrecursive;
         end;
      end
   else
      begin
      if (FormPeach.EditOpenIn.Text<>txt_none) and (FormPeach.EditOpenIn.Text<>'<none>') then
      open_archive_fromname(FormPeach.EditOpenIn.Text);
      end;
end;
end;

procedure toggle_view;
begin
if browserbusy=true then exit;
FormPeach.EditOpenInInteractive.Caption:=FormPeach.EditOpenIn.Caption;
if fun='UN7Z' then
   if status0=txt_list_browsing then
      begin
      if nitems>64*1024 then //set warning for flat mode in archives (always set for filesystem)
         if pMessageWarningYesNo(txt_8_1_togglearc)=6 then listun7z_expandall
         else
      else
         listun7z_expandall;
      end
   else
      begin
      specbrowse:=pspecbrowse;
      list_root;
      end;
if fun='FILEBROWSER' then
   begin
   if FormPeach.EditOpenIn.Text=txt_mypc then exit;
   if status0=txt_list_browsing then
         if pMessageWarningYesNo(txt_toggle_warning)=6 then
            begin
            FormPeach.EditUn7zaFilter.Text:='*';
            listdir(FormPeach.EditOpenIn.Text,true,false);
            end
         else
   else
      begin
      FormPeach.EditUn7zaFilter.Text:='*';
      listdir(FormPeach.EditOpenIn.Text,false,false);
      end;
   addtohistory;
   end;
end;

procedure openpathp(p:AnsiString);
var
   s:ansistring;
begin
fun:='FILEBROWSER';
fun_status:=fun;
FormPeach.SelectDirectoryDialog1.InitialDir:=p;
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      FormPeach.EditOpenIn.Text:=FormPeach.SelectDirectoryDialog1.FileName
   else exit
else exit;
s:=FormPeach.EditOpenIn.Text;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
FormPeach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure openpath;
var
   p:ansistring;
begin
if fileexists((FormPeach.EditOpenIn.Text)) then p:=extractfilepath(FormPeach.EditOpenIn.Text)
else p:=FormPeach.EditOpenIn.Text;
openpathp(p);
end;

procedure opendevice(s:ansistring);
var
   s1:ansistring;
begin
fun:='FILEBROWSER';
fun_status:=fun;
FormPeach.EditUn7zaFilter.Text:='*';
s1:=copy(s,2,2)+directoryseparator;
showpanel('open');
listdir(s1,false,false);
addtohistory;
end;

procedure browsebookmark(i:integer);
var
   s:ansistring;
   j:integer;
begin
if i>=FormPeach.StringGridBookmarks.Rowcount then exit;
s:=FormPeach.StringGridBookmarks.Cells[2,i];
if s='' then exit;
fun:='FILEBROWSER';
fun_status:=fun;
FormPeach.EditUn7zaFilter.Text:=FormPeach.StringGridBookmarks.Cells[4,i];
if savehistory=1 then
   begin
   FormPeach.StringGridBookmarks.Cells[8,i]:=FormatDateTime('yyyy-mm-dd hh:mm:ss',now);
   try
   FormPeach.StringGridBookmarks.Cells[7,i]:=inttostr(strtoint(FormPeach.StringGridBookmarks.Cells[7,i])+1);
   except
   FormPeach.StringGridBookmarks.Cells[7,i]:='1';
   end;
   FormPeach.StringGridBookmarks.Cells[10,i]:=inttostr(length(FormPeach.StringGridBookmarks.Cells[7,i]))+FormPeach.StringGridBookmarks.Cells[7,i];
   end
else
   begin
   FormPeach.StringGridBookmarks.Cells[7,i]:='';
   FormPeach.StringGridBookmarks.Cells[8,i]:='';
   FormPeach.StringGridBookmarks.Cells[10,i]:='';
   end;
FormPeach.StringGridBookmarks.AutoSizeColumns;
FormPeach.StringGridBookmarks.ColWidths[10]:=0;
FormPeach.StringGridBookmarks.ColWidths[11]:=0;
FormPeach.StringGridBookmarks.ColWidths[0]:=rowsize;
showpanel('open');
{$IFDEF MSWINDOWS}
if (s=txt_mypc) or (s='Computer''s root') then
   begin
   listpc;
   addtohistory;
   end
else {$ENDIF}
   begin
   if (check7zvolume(s)=false) and (checkdirexists(s)=true) then
      begin
      if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_found then statusr:=txt_list_found;
      if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_browsing then listdir(s,false,false)
      else listdir(s,true,false);
      addtohistory;
      statusr:='';
      status0:=FormPeach.StringGridBookmarks.Cells[1,i];
      end
   else
      begin
      if check7zvolume(s)=true then
         if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
      if check7zvolume(s)=false then
         if fileexists(s)=false then exit;
      j:=testext(s);//browse or open by type
      if forcebrowse=0 then if ((j>=100) and (j<500)) then j:=-1;//non-canonical archive types are opened with associated application rather than browsed in PeaZip as archives if this option is not set
      if (j<0) //not a PeaZip supported filetype
         or (j=503)
         or (j=502)
         or (j=501) //file types usually not handled as archives
      then cp_open(s,desk_env)
      else open_archive_fromname(s);
      if fun='UN7Z' then
         begin
         FormPeach.EditUn7zaFilter.Text:=FormPeach.StringGridBookmarks.Cells[4,i];
         if FormPeach.StringGridBookmarks.Cells[1,i]=txt_list_browsing then
            begin
            FormPeach.EditUn7zaFilterExclude.Text:=extractfilepath(FormPeach.EditUn7zaFilter.Text)+'*'+directoryseparator+'*';
            status0:=txt_list_browsing;
            browsingmode7z:=0;
            filter_archivecontent;
            addtohistory;
            end
         else
            begin
            list_un7z_search;
            end;
         end;
      end;
   end;
end;

procedure jumpto(jumpdest:ansistring);
var
   s:ansistring;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
//preliminar tests
case jumpdest of
   'bookmark1': if FormPeach.StringGridBookmarks.Rowcount<2 then exit;
   'bookmark2': if FormPeach.StringGridBookmarks.Rowcount<3 then exit;
   'bookmark3': if FormPeach.StringGridBookmarks.Rowcount<4 then exit;
   'mostrecent': if FormPeach.mRecent1.Caption='' then exit;
   'mostrecent2': if FormPeach.mRecent2.Caption='' then exit;
   'mostrecent3': if FormPeach.mRecent3.Caption='' then exit;
   end;
fun:='FILEBROWSER';
fun_status:=fun;
case jumpdest of
   'root':
   begin
   {$IFDEF MSWINDOWS}
   listpc;
   {$ELSE}
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   {$IFNDEF MSWINDOWS}
   'media':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/media/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'mnt':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/mnt/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'run/media':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/run/media/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'var/run/media':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/var/run/media/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'MTP ($UID/gvfs)':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/run/user/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'var/ MTP ($UID/gvfs)':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/var/run/user/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'Volumes':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/Volumes/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'Applications':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/Applications/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'System Applications':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:='/System/Applications/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'Mobile Documents':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=home_path+'Library/Mobile Documents/';
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   {$ENDIF}
   'dropbox':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=shared_dropbox;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'googledrive':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=shared_googledrive;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'onedrive':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=shared_onedrive;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'sharepoint':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=shared_sharepointwork;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'yandexdisk':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=shared_yandex;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'home':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=extractfilepath(home_path);
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'desktop':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=local_desktop;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'users':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=users_root;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrdocuments':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_documents;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrmusic':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_music;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrpictures':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_pictures;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrvideos':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_videos;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
  'publicdocuments':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=public_documents;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'publichome':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=public_home;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'sysrecent':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_recent;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'sysdownloads':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_downloads;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'syssearches':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_searches;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'syslibraries':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=usr_libraries;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'Apple':
   begin
   FormPeach.EditUn7zaFilter.Text:='*';
   s:=applebk;
   FormPeach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'bookmark1': browsebookmark(1);
   'bookmark2': browsebookmark(2);
   'bookmark3': browsebookmark(3);
   'mostrecent': open_archive_fromname(FormPeach.mRecent1.Caption);
   'mostrecent2': open_archive_fromname(FormPeach.mRecent2.Caption);
   'mostrecent3': open_archive_fromname(FormPeach.mRecent3.Caption);
   end;
addtohistory;
end;

function testspecialname(var s:ansistring):integer;
begin
testspecialname:=-1;
{//licensing
if pos('COPYING',upcase(s))>0 then testspecialname:=1;
if pos('EULA',upcase(s))>0 then testspecialname:=1;
if pos('LICENSE',upcase(s))>0 then testspecialname:=1;
//support
if pos('HELP',upcase(s))>0 then testspecialname:=2;
if pos('README',upcase(s))>0 then testspecialname:=2;
//setup
if pos('SETUP',upcase(s))>0 then testspecialname:=3;
if pos('INSTALL',upcase(s))>0 then testspecialname:=3;
if pos('.MSI',upcase(s))>0 then testspecialname:=3;
//uninstall
if pos('UNINS',upcase(s))>0 then testspecialname:=4;
if pos('UNWISE',upcase(s))>0 then testspecialname:=4;}//unused, as TListView replacd TStringGrid as interactive foreground GUI item
end;

function pInputQuery ( const FCaption, FPrompt, Fwarning : ansistring; var UserValue : ansistring; chkb:boolean ) : Boolean;
var
   cbflag,i:integer;
   s:ansistring;
begin
pInputQuery:=false;
UnitInput.tsstyle:=tsstyle;
UnitInput.dirn:=FormPeach.EditOpenIn.Text;
UnitInput.instr:=UserValue;
UnitInput.moveclick:=0;
FormInput.CheckBoxInputRecoursive.Caption:=txt_2_9_rec;
FormInput.BitBtnReset.Caption:=txt_reset;
FormInput.Labelrenamereset.Caption:=txt_reset;
FormInput.BitBtnBrowse.Caption:=txt_browse;
FormInput.LabelLow.Caption:=txt_5_5_lower;
FormInput.LabelUp.Caption:=txt_5_5_upper;
FormInput.LabelTimestamp.Caption:=txt_timestamp;
FormInput.Labelappdirn.Caption:=txt_6_4_appdirn;
FormInput.Labelprepdirn.Caption:=txt_6_4_prepdirn;
FormInput.LabelMoveTo.Caption:=txt_moveto;
FormInput.OpenDialogInput.Title:=txt_open_file;
FormInput.ButtonPanelInput.OKButton.Caption:=txt_2_7_ok;
FormInput.ButtonPanelInput.CancelButton.Caption:=txt_2_7_cancel;
FormInput.CheckBoxInputRecoursive.Visible:=chkb;
FormInput.BitBtnReset.Visible:=chkb;
if FCaption=txt_3_3_run then FormInput.BitBtnBrowse.Visible:=true else FormInput.BitBtnBrowse.Visible:=false;
if FCaption=txt_rename then
   begin
   FormInput.LabelLow.Visible:=true;
   FormInput.Labelinputspacer1.Visible:=true;
   FormInput.LabelUp.Visible:=true;
   FormInput.Labelinputspacer2.Visible:=true;
   FormInput.LabelTimestamp.Visible:=true;
   FormInput.Labelappdirn.Visible:=true;
   FormInput.Labelinputspacer4.Visible:=true;
   FormInput.Labelprepdirn.Visible:=true;
   FormInput.Labelrenamereset.Visible:=true;
   end
else
   begin
   FormInput.LabelLow.Visible:=false;
   FormInput.Labelinputspacer1.Visible:=false;
   FormInput.LabelUp.Visible:=false;
   FormInput.Labelinputspacer2.Visible:=false;
   FormInput.LabelTimestamp.Visible:=false;
   FormInput.Labelappdirn.Visible:=false;
   FormInput.Labelinputspacer4.Visible:=false;
   FormInput.Labelprepdirn.Visible:=false;
   FormInput.Labelrenamereset.Visible:=false;
   end;
if FCaption=txt_moveto then FormInput.Labelrenamereset.Visible:=true;
FormInput.caption:=FCaption;
FormInput.Editinputquery.Clear;
//FormInput.Editinputquery.Style:=csDropDown;
if FCaption=txt_4_8_fun then
   begin
   //FormInput.Editinputquery.Style:=csDropDownList;
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun1.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun2.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun3.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun4.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun5.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun6.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun7.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun8.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun9.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun10.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun11.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun12.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun13.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun14.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun15.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun16.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun17.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun18.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun19.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun20.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun21.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun22.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun23.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun24.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun25.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun26.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun27.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun28.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun29.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun30.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun31.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun32.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun33.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun34.Caption);
   FormInput.Editinputquery.Items.Add(FormPeach.pmfun35.Caption);
   end;

if (FCaption=txt_searchfor) or (FCaption=txt_searchfor+'...') then
   begin
   if FormPeach.pmshist1.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist1.Caption);
   if FormPeach.pmshist2.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist2.Caption);
   if FormPeach.pmshist3.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist3.Caption);
   if FormPeach.pmshist4.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist4.Caption);
   if FormPeach.pmshist5.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist5.Caption);
   if FormPeach.pmshist6.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist6.Caption);
   if FormPeach.pmshist7.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist7.Caption);
   if FormPeach.pmshist8.visible=true then FormInput.Editinputquery.Items.Add(FormPeach.pmshist8.Caption);
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
       FormInput.Editinputquery.Items.Add(FormPeach.StringGridList.Cells[1,i]);
   end;
FormInput.Editinputquery.hint:=FPrompt;
FormInput.EditInputQuery.Text:=UserValue;
FormInput.Labelwarning.caption:=FWarning;
if FormInput.CheckBoxInputRecoursive.state=cbchecked then cbflag:=1 else cbflag:=0;
try FormInput.EditInputQuery.SetFocus; except end;
FormInput.Showmodal;
case FormInput.ModalResult of
   mrOk:
      begin
      UserValue:=FormInput.EditInputQuery.Text;
      pInputQuery:=true;
      end;
   mrCancel:
      begin
      UserValue:='';
      if cbflag=1 then FormInput.CheckBoxInputRecoursive.state:=cbchecked else FormInput.CheckBoxInputRecoursive.state:=cbunchecked;
      FormInput.LabelMoveTo.Visible:=false;
      FormInput.Labelinputspacer3.Visible:=false;
      s:='';
      if UnitInput.moveclick=1 then clickmoveto(s); //switch to move to, only available with rename, when it is called file selection in the browser is not modified
      end;
   mrAbort:
      begin
      FormPeach.EditUn7zaFilter.Text:='*';
      FormPeach.EditUn7zaFilterInteractive.Text:='*';
      UserValue:='';
      FormInput.CheckBoxInputRecoursive.state:=cbchecked;
      resetsearch;
      end;
   end;
FormInput.LabelMoveTo.Visible:=false;
FormInput.Labelinputspacer3.Visible:=false;
end;

function getnewdestname(var s:ansistring):integer;
var
   s1,s2:ansistring;
begin
getnewdestname:=-1;
s1:=extractfilename(s);
s2:=s1;
if not pInputQuery(txt_rename, txt_name_provide, '', s1, false) then exit;
if s1=s2 then exit;
if checkfilename(s1)<>0 then
   begin
   pMessageWarningOK('"'+s1+'" '+txt_checkname_failed+char($0D)+char($0A)+txt_name_provide);
   exit;
   end;
s2:=extractfilepath(s);
if s2<>'' then
   if s2[length(s2)]<>directoryseparator then s2:=s2+directoryseparator;
s:=s2+s1;
getnewdestname:=0;
end;

function cp_copy_filedir(clipcontent:TClipcontent; var destdir:ansistring):integer;
var
   {$IFNDEF MSWINDOWS}
   ecode:integer;
   overall:boolean;
   cl,src,dest,destf,opcommand:ansistring;
   P:tprocessutf8;
   {$ENDIF}
   i,j,k:integer;
   cparr,mvarr:array of ansistring;
   tsource,psource,dsource,tdest,ddest,tcontent:ansistring;
begin
result:=-1;
if filecopying=true then //cuncurrent operation
   begin
   if clipcontent[0,3]=txt_cut then exit; //if the src is being moved, avoid other paste operations
   end;
enter_busy_status;
filecopying:=true;
if FormPeach.Visible=true then Application.ProcessMessages;

tsource:='';
psource:='';
tcontent:='';
for i:=0 to length(clipcontent)-1 do
   begin
   if clipcontent[i,3]=txt_caption_extract then
      begin
      FormPeach.visible:=false;
      Break;
      end;
   end;
for i:=0 to length(clipcontent)-1 do
   begin
   if clipcontent[i,3]=txt_caption_extract then
      begin
      psource:=tsource;
      tsource:=clipcontent[i,4];
      tdest:=destdir;
      if (tsource<>psource) and (psource<>'') then
         begin
         dsource:=psource;
         ddest:=tdest;
         forcewillbemoved:=true;
         moverelpath:=extractfilepath(clipcontent[i-1,0]);
         if moverelpath='' then moverelpath:='*';
         directextractfromname(dsource,ddest,'extract',tcontent);
         moverelpath:='';
         move_out_param:='';
         forcewillbemoved:=false;
         tcontent:=stringdelim(clipcontent[i,0])+' ';
         fun:='FILEBROWSER';
         end
      else tcontent:=tcontent+stringdelim(clipcontent[i,0])+' ';
      end;
   end;
if (tsource<>'') and (tcontent<>'') then
   begin
   forcewillbemoved:=true;
   moverelpath:=extractfilepath(clipcontent[i,0]);
   if moverelpath='' then moverelpath:='*';
   directextractfromname(tsource,tdest,'extract',tcontent);
   moverelpath:='';
   move_out_param:='';
   forcewillbemoved:=false;
   fun:='FILEBROWSER';
   end;
FormPeach.visible:=true;

{$IFDEF MSWINDOWS}
j:=0;
k:=0;
setlength(cparr,0);
setlength(mvarr,0);
for i:=0 to length(clipcontent)-1 do
   begin
   if clipcontent[i,3]=txt_copy then
      begin
      setlength(cparr,length(cparr)+1);
      cparr[j]:=clipcontent[i,0];
      j:=j+1;
      end;
   if clipcontent[i,3]=txt_cut then
      begin
      setlength(mvarr,length(mvarr)+1);
      mvarr[k]:=clipcontent[i,0];
      k:=k+1;
      end;
   end;
if j>0 then
   if destdir<>ExtractFilePath(cparr[0]) then
      fileop_fromnamelist(cparr,destdir,2,0)
   else
      fileop_fromnamelist(cparr,destdir,2,1);
if k>0 then fileop_fromnamelist(mvarr,destdir,1,0);
result:=0;
{$ELSE}
overall:=false; //overwrite all, default false;
for i:=0 to length(clipcontent)-1 do
   if (clipcontent[i,3]=txt_cut) or (clipcontent[i,3]=txt_copy) then
      begin //it could perform mixed move/copy operation on a list of files
      prev_destdir:=destdir;
      pcount:=1;
      cl:='';
      src:='';
      dest:='';
      destf:='';
      Application.ProcessMessages;
      src:=clipcontent[i,0];
      if checkfiledirname(src)<>0 then
         begin
         exit_busy_status;
         pMessageWarningOK(txt_2_7_validatefn+' '+src);
         filecopying:=false;
         exit;
         end;
      //generic Unix-like mv or cp command
      if clipcontent[i,3]=txt_cut then opcommand:='mv ';
      if clipcontent[i,3]=txt_copy then opcommand:='cp -p -r ';
      if clipcontent[i,2]=txt_list_isfolder then
         begin
         dest:=destdir;
         destf:=dest+clipcontent[i,1];
         if src=destf then
            if getnewdestname(destf)<>0 then
               begin
               filecopying:=false;
               exit_busy_status;
               exit;
               end;
         if checkdirexists(destf) then
            if overall=true then
            else
                  case pMessageInfoAllYesNoCancel('"'+clipcontent[i,1]+'" '+txt_overwrite) of
                     2: break;
                     6: cl:=opcommand+'-f '+stringdelim(escapefilename(src,desk_env))+' '+stringdelim(escapefilename(dest,desk_env));
                     7: cl:=opcommand+stringdelim(escapefilename(src,desk_env))+' '+stringdelim(escapefilename(dest,desk_env));
                     10: begin overall:=true; cl:=opcommand+'-f '+stringdelim(escapefilename(src,desk_env))+' '+stringdelim(escapefilename(dest,desk_env)); end;
                     end;
         if cl='' then cl:=opcommand+'-f '+stringdelim(escapefilename(src,desk_env))+' '+stringdelim(escapefilename(destf,desk_env));
         end
      else
         begin
         dest:=destdir;
         if dest<>'' then
            if dest[length(dest)]<>directoryseparator then dest:=dest+directoryseparator;
         destf:=dest+clipcontent[i,1];
         if src=destf then
            if getnewdestname(destf)<>0 then
               begin
               filecopying:=false;
               exit_busy_status;
               exit;
               end;
         if fileexists(destf) then
            if overall=true then
            else
                  case pMessageInfoAllYesNoCancel('"'+extractfilename(destf)+'" '+txt_overwrite) of
                     2: break;
                     6: cl:=opcommand+'-f '+stringdelim(escapefilename(src,desk_env))+' '+stringdelim(escapefilename(destf,desk_env));
                     7: continue;
                     10: begin overall:=true; cl:=opcommand+'-f '+stringdelim(escapefilename(src,desk_env))+' '+stringdelim(escapefilename(destf,desk_env)); end;
                     end;
         if cl='' then cl:=opcommand+'-f '+stringdelim(escapefilename(src,desk_env))+' '+stringdelim(escapefilename(destf,desk_env));
         end;
      if cl='' then break;
      if validatecl(cl)<>0 then
         begin
         pMessageWarningOK(txt_2_7_validatecl+' '+cl);
         exit_busy_status;
         filecopying:=false;
         exit;
         end;
      P:=tprocessutf8.Create(nil);
      P.Options := [poWaitOnExit];
      peapexecute(P,cl);
      while P.Running do
         begin
         if FormPeach.Visible=true then Application.ProcessMessages;
         Sleep(100);
         end;
      ecode:=P.ExitStatus;
      if ecode<>0 then
         if pMessageErrorYesNo(cl+char($0D)+char($0A)+txt_copy_error+' '+inttostr(ecode)+'. '+txt_abort)=6 then
            begin
            break;
            end
         else continue
      else result:=0;
      try P.Free; except end;
      end;{$ENDIF}
filecopying:=false;
exit_busy_status;
end;

procedure mass_cp_copy_toapp(cpact:ansistring);
var
   i,j:integer;
   s:string;//dragged files are passed as strings, not ansistrings
begin
if filecopying=true then
   begin
   pMessageInfoOK(txt_copy_wait);
   exit;
   end;
prev_destdir:='';
setlength(clipcontent1,0);
j:=0;
for i:=0 to High(dfilenames) do
      begin
      s:=dfilenames[i];
      setlength(clipcontent1,length(clipcontent1)+1);
      clipcontent1[j,0]:=s;
      if s<>'' then
         if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
      clipcontent1[j,1]:=extractfilename(s);
      if checkdirexists(s) then clipcontent1[j,2]:=txt_list_isfolder
      else clipcontent1[j,2]:=extractfileext(s);
      clipcontent1[j,3]:=cpact;
      clipcontent1[j,4]:=txt_fs;
      j:=j+1;
      end;
destdir:=FormPeach.EditOutExtract.Text;
if j>0 then
   if clipcontent1[0,0]<>'' then cp_copy_filedir(clipcontent1,destdir);
end;

procedure mass_cp_copy_filedir(cpact,cpdestdir:ansistring);
var
   i,j:integer;
begin
if filecopying=true then
   begin
   pMessageInfoOK(txt_copy_wait);
   exit;
   end;
prev_destdir:='';
setlength(clipcontent1,0);
j:=0;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      begin
      setlength(clipcontent1,length(clipcontent1)+1);
      clipcontent1[j,0]:=FormPeach.StringGridList.Cells[12,i];
      clipcontent1[j,1]:=FormPeach.StringGridList.Cells[1,i];
      clipcontent1[j,2]:=FormPeach.StringGridList.Cells[2,i];
      clipcontent1[j,3]:=cpact;
      clipcontent1[j,4]:=txt_fs;
      j:=j+1;
      end;
if cpdestdir<>'' then destdir:=cpdestdir;//FormPeach.EditOutExtract.Text;
if j>0 then
   if clipcontent1[0,0]<>'' then cp_copy_filedir(clipcontent1,destdir);
end;

procedure savecolreport(reptype,repopt:ansistring);
var
x,y:dword;
field_delim:string;
p,s:ansistring;
begin
if (reptype='txt') or (reptype='tsv') then field_delim:=chr($09) //tab separated TXT or TSV
else field_delim:=repopt;
p:=local_desktop;
if p<>'' then
   if p[length(p)]<>directoryseparator then p:=p+directoryseparator;
if fun='FILEBROWSER' then s:=FormPeach.Caption
else s:=extractfilename(FormPeach.EditOpenIn.Text);
if s<>'' then
   if s[length(s)]=' ' then SetLength(s,length(s)-1);
s:=StringReplace(s,' | ',', ',[rfReplaceAll]);
s:=s+'.'+reptype;
FormPeach.SaveDialogPJ.InitialDir:=p;
FormPeach.SaveDialogPJ.FileName:=s;
if checkdirexists(p) then FormPeach.SaveDialogPJ.InitialDir:=p;
if FormPeach.SaveDialogPJ.Execute then
begin
s:=FormPeach.SaveDialogPJ.FileName;
assignfile(t,s);
rewrite(t);
write_header(t);
for x:=1 to FormPeach.StringGridList.RowCount-1 do
   begin
   for y:=1 to 8 do
      write(t,FormPeach.StringGridList.Cells[y,x]+field_delim);
   writeln(t);
   end;
closefile(t);
end;
end;

procedure setaddressbar(i:integer);
begin
addressbar:=i;
case i of
   0: begin
      FormPeach.PanelListBar.Height:=0;
      end;
   1: begin
      FormPeach.PanelListBar.Height:=barheight;
      end;
   end;
end;

procedure addarchive_tobookmarks;
var
   s:ansistring;
begin
if fileexists((FormPeach.EditOpenIn.Text)) then FormPeach.OpenDialogArchive.InitialDir:=extractfilepath(FormPeach.EditOpenIn.Text)
else FormPeach.OpenDialogArchive.InitialDir:=FormPeach.EditOpenIn.Text;
if FormPeach.OpenDialogArchive.Execute then
   if FormPeach.OpenDialogArchive.Filename<>'' then
      begin
      s:=FormPeach.OpenDialogArchive.Filename;
      addtobookmarks(s);
      end
   else exit
else exit;
end;

procedure addpath_tobookmarks;
var
   s:ansistring;
begin
if fileexists((FormPeach.EditOpenIn.Text)) then FormPeach.SelectDirectoryDialog1.InitialDir:=extractfilepath(FormPeach.EditOpenIn.Text)
else FormPeach.SelectDirectoryDialog1.InitialDir:=FormPeach.EditOpenIn.Text;
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      begin
      s:=FormPeach.SelectDirectoryDialog1.FileName;
      addtobookmarks(s);
      end
   else exit
else exit;
end;

procedure addnote_tobookmarks;
var
   s:ansistring;
begin
with FormPeach do
begin
s:=StringGridBookmarks.Cells[6,StringGridBookmarks.Row];
if pInputQuery(txt_note, StringGridBookmarks.Cells[2,StringGridBookmarks.Row], '', s, false) then
   begin
   StringGridBookmarks.Cells[6,StringGridBookmarks.Row]:=s;
   StringGridBookmarks.AutoSizeColumns;
   StringGridBookmarks.ColWidths[10]:=0;
   StringGridBookmarks.ColWidths[11]:=0;
   StringGridBookmarks.ColWidths[0]:=rowsize;
   end;
end;
end;

procedure sortbrowser(c:integer);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
if refreshstatus<>0 then exit;
listcol:=c;

if c=listsortcol then
   if FormPeach.StringGridlist.SortOrder=soAscending then FormPeach.StringGridlist.SortOrder:=soDescending
   else FormPeach.StringGridlist.SortOrder:=soAscending
else FormPeach.StringGridlist.SortOrder:=soAscending;
sort_az_stringgridlist(c);
listsortcol:=c;
update_listview;
if fun='UN7Z' then generate_archive_breadcrumb;
{$IFNDEF MSWINDOWS}
if (showthumbnails=1) and (FormPeach.Visible=true) and (FormPeach.PanelIntro.Top<>0) and (openstarted=true) then
   if gofthumbs=true then forcethumbnails;
{$ENDIF}
end;

procedure setbrowser_crchash(i:integer);
begin
with FormPeach do begin
browserch:=i;
set_listview_cnames;
pob_adler.Checked:=false;
pob_crc16.Checked:=false;
pob_crc24.Checked:=false;
pob_crc32.Checked:=false;
pob_crc64.Checked:=false;
pob_edonkey.Checked:=false;
pob_md4.Checked:=false;
pob_md5.Checked:=false;
pob_ripemd.Checked:=false;
pob_sha1.Checked:=false;
pob_blake2s.Checked:=false;
pob_sha256.Checked:=false;
pob_sha3256.Checked:=false;
pob_blake2b.Checked:=false;
pob_sha512.Checked:=false;
pob_sha3512.Checked:=false;
pob_whirlpool.Checked:=false;
case browserch of
   1: pob_adler.Checked:=true;
   2: pob_crc16.Checked:=true;
   3: pob_crc24.Checked:=true;
   4: pob_crc32.Checked:=true;
   5: pob_crc64.Checked:=true;
   6: pob_edonkey.Checked:=true;
   7: pob_md4.Checked:=true;
   8: pob_md5.Checked:=true;
   9: pob_ripemd.Checked:=true;
  10: pob_sha1.Checked:=true;
  11: pob_blake2s.Checked:=true;
  12: pob_sha256.Checked:=true;
  13: pob_sha3256.Checked:=true;
  14: pob_blake2b.Checked:=true;
  15: pob_sha512.Checked:=true;
  16: pob_sha3512.Checked:=true;
  17: pob_whirlpool.Checked:=true;
   end;
cbBrowserHash.ItemIndex:=browserch-1;
end;
end;

procedure do_click_breadmenu(i:integer; inbcnodestr:ansistring);
var
   Node: TTreeNode;
   s:ansistring;
begin
if inbcnode=-1 then
begin
if FormPeach.EditOpenInInteractive.Text=txt_mypc then i:=i-1
else i:=i+imod;
if i<FormPeach.ShellTreeViewTmp.Items.Count then
   begin
   Node := FormPeach.ShellTreeViewTmp.Items[i];
   s:=FormPeach.ShellTreeViewTmp.GetPathFromNode(Node);
   browsefiledir(s);
   end;
end
else
   if fun='UN7Z' then
      begin
      if i<>0 then
      case inbcnode of
      0: FormPeach.EditUn7zaFilterInteractive.Caption:=inbcnodestr+directoryseparator+'*';
      1: FormPeach.EditUn7zaFilterInteractive.Caption:=abcrs[1]+inbcnodestr+directoryseparator+'*';
      2: FormPeach.EditUn7zaFilterInteractive.Caption:=abcrs[2]+inbcnodestr+directoryseparator+'*';
      3: FormPeach.EditUn7zaFilterInteractive.Caption:=abcrs[3]+inbcnodestr+directoryseparator+'*';
      end
      else
      case inbcnode of
      0: FormPeach.EditUn7zaFilterInteractive.Caption:='*';
      1: FormPeach.EditUn7zaFilterInteractive.Caption:=abcrs[1]+'*';
      2: FormPeach.EditUn7zaFilterInteractive.Caption:=abcrs[2]+'*';
      3: FormPeach.EditUn7zaFilterInteractive.Caption:=abcrs[3]+'*';
      end;
      kp_EditUn7zaFilterInteractive_nonrecursive;
      end;
end;

procedure getmainfiledirname(var s:ansistring);
begin
with FormPeach do
begin
if EditOpenInInteractive.Caption=txt_mypc then s:=''
else
   begin
   s:=extractfilename(EditOpenInInteractive.Caption);
   if s='' then
      begin
      s:=copy(EditOpenInInteractive.Caption,0,length(EditOpenInInteractive.Caption)-1);
      s:=extractfilename(s);
      end;
   end;
end;
end;

function bcaddress:ansistring;
var
   s:ansistring;
begin
s:='';
case bctemp of
0: s:=FormPeach.EditOpenInInteractive.Caption;
1: if FormPeach.LabelClickAddress1.Caption=' '+txt_mypc+' ' then s:=txt_mypc
   else s:=FormPeach.pmbc8.caption;
2: s:=FormPeach.pmbc7.caption;
3: s:=FormPeach.pmbc6.caption;
4: s:=FormPeach.pmbc5.caption;
5: s:=FormPeach.pmbc4.caption;
6: s:=FormPeach.pmbc3.caption;
7: s:=FormPeach.pmbc2.caption;
8: s:=FormPeach.pmbc1.caption;
end;
result:=s;
end;

procedure browser_fileproperties(s_in:ansistring);
var
   spars: TStringList;
   sdest: ansistring;
   i:integer;
begin
with FormPeach do
begin
{$IFDEF MSWINDOWS}
if checkfdwin<>0 then exit;
spars:=TStringList.Create;
if s_in<>'' then
   begin
   if s_in<>txt_mypc then spars.Add((s_in))
   else
      if checklistsel=0 then
         spars.Add((StringGridList.Cells[12,StringGridList.Row]))
      else
         begin
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('systempropertiescomputername'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
         spars.Free;
         exit;
         end;
   ShowFileProperties(spars, 0);
   spars.Free;
   exit;
   end;
if fun='FILEBROWSER' then
   begin
   if StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]=txt_mypc then
      begin
      if checklistsel=0 then
         begin
         spars.Add((StringGridList.Cells[12,StringGridList.Row]));
         ShowFileProperties(spars, 0);
         end
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('systempropertiescomputername'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
      spars.Free;
      exit;
      end;
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         spars.Add((StringGridList.Cells[12,i]));
         end;
   if checklistsel=0 then ShowFileProperties(spars, 0)
   else
      begin
      spars.Add((EditOpenIn.Text));
      ShowFileProperties(spars, 0);
      end;
   end
else
   begin
   spars.Add((EditOpenIn.Text));
   ShowFileProperties(spars, 0);
   end;
spars.Free;
{$ELSE}//not properly working
{if s_in<>'' then
   sdest:=s_in
else
   if fun='FILEBROWSER' then
      if ListView1.Selected<>nil then
         sdest:=StringGridList.Cells[12,ListView1.Selected.Index+1]
      else
         sdest:=s_in
   else
      sdest:=s_in;
{$IFNDEF DARWIN}if pos(' ',sdest)<>0 then exit;{$ENDIF}//currently escaping doesn't work due the need to create a composite command line (linux)
linlaunchconsole({$IFDEF DARWIN}'/bin/mdls --args '{$ELSE}'stat '{$ENDIF}+stringdelim(escapefilename(sdest,desk_env)));//open mdls seems not working even using --args
}
{$ENDIF}
end;
end;

procedure set_pimmersive;
begin
FormPeach.BorderStyle:=bsNone;
FormPeach.WindowState:=wsMaximized;
end;

procedure setrecsearch(i:integer);
begin
recsearch:=i;
case i of
   0: begin
      FormPeach.mrecsearch.checked:=false;
      FormPeach.pmsrec.checked:=false;
      FormInput.CheckBoxInputRecoursive.State:=cbUnchecked;
      end;
   1: begin
      FormPeach.mrecsearch.checked:=true;
      FormPeach.pmsrec.checked:=true;
      FormInput.CheckBoxInputRecoursive.State:=cbChecked;
      end;
   end;
end;

procedure layout_fileproperties;
var
   spars: TStringList;
   i:integer;
begin
{$IFDEF MSWINDOWS}
spars:=TStringList.Create;
with FormPeach do
begin
if FormPeach.PanelArchive.Visible=true then
   if StringGridAdd.Rowcount=1 then exit
   else
      begin
      for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
         if FormPeach.StringGridAdd.Cells[11,i]='1' then
            begin
            spars.Add(StringGridAdd.Cells[8,i]);
            end;
      end
else
   if StringGridExtract.Rowcount=1 then exit
   else
      begin
      for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
         if FormPeach.StringGridExtract.Cells[11,i]='1' then
            begin
            spars.Add(StringGridExtract.Cells[8,i]);
            end;
      end;
ShowFileProperties(spars, 0);
spars.Free;
end;
{$ENDIF}
end;

procedure copypaths;
var
   strsel:ansistring;
   rc,nsel,i:integer;
begin
FormPaths.MemoPaths.Clear;
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
begin
rc:=FormPeach.StringGridAdd.RowCount;
for i:=1 to rc-1 do
   if FormPeach.StringGridAdd.Cells[11,i]='1' then
      if FormPeach.StringGridAdd.Cells[2,i]=txt_list_isfolder then
         FormPaths.MemoPaths.Lines.Add(FormPeach.StringGridAdd.Cells[8,i]+directoryseparator)
      else
         FormPaths.MemoPaths.Lines.Add(FormPeach.StringGridAdd.Cells[8,i]);
end;
{$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
begin
rc:=FormPeach.StringGridExtract.RowCount;
for i:=1 to rc-1 do
   if FormPeach.StringGridExtract.Cells[11,i]='1' then
      if FormPeach.StringGridExtract.Cells[2,i]=txt_list_isfolder then
         FormPaths.MemoPaths.Lines.Add(FormPeach.StringGridExtract.Cells[8,i]+directoryseparator)
      else
         FormPaths.MemoPaths.Lines.Add(FormPeach.StringGridExtract.Cells[8,i]);
end;
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.Top=0{$ENDIF} then
begin
rc:=FormPeach.StringGridList.RowCount;
if checklisttotsel(nsel,strsel)<>0 then FormPaths.MemoPaths.Lines.Add(FormPeach.EditOpenIn.Text)
else
   begin
   if fun<>'FILEBROWSER' then
      begin
      FormPaths.MemoPaths.Lines.Add(FormPeach.EditOpenIn.Text);
      FormPaths.MemoPaths.Lines.Add('');
      end;
   for i:=1 to rc-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then
            FormPaths.MemoPaths.Lines.Add(FormPeach.StringGridList.Cells[12,i]+directoryseparator)
         else
            FormPaths.MemoPaths.Lines.Add(FormPeach.StringGridList.Cells[12,i]);
   end;
end;
FormPaths.Caption:=txt_5_5_copypath;
//FormPaths.Visible:=true;
FormPaths.ShowModal;
end;

procedure setshowthumbnails(i:integer);
begin
showthumbnails:=i;
case i of
   0: begin
      FormPeach.mthumbimages.Checked:=false;
      end;
   1: begin
      FormPeach.mthumbimages.Checked:=true;
      end;
   end;
end;

procedure setsimplesearch(i:integer);
begin
simplesearch:=i;
case i of
   0: FormPeach.msimplesearch.Checked:=false;
   1: FormPeach.msimplesearch.Checked:=true;
   end;
end;

procedure showtoolbar(ntoolbar:integer);
begin
if ntoolbar<>-1 then lasttoolbar:=ntoolbar;
case lasttoolbar of
1: begin
   FormPeach.PanelBarOpen1.Visible:=true;
   FormPeach.PanelBarOpen2.Visible:=false;
   FormPeach.PanelBarOpen3.Visible:=false;
   FormPeach.pmtool1.Checked:=true;
   FormPeach.pmtool2.Checked:=false;
   FormPeach.pmtool3.Checked:=false;
   end;
2:
   begin
   FormPeach.PanelBarOpen1.Visible:=false;
   FormPeach.PanelBarOpen2.Visible:=true;
   FormPeach.PanelBarOpen3.Visible:=false;
   FormPeach.pmtool1.Checked:=false;
   FormPeach.pmtool2.Checked:=true;
   FormPeach.pmtool3.Checked:=false;
   end;
3:
   begin
   FormPeach.PanelBarOpen1.Visible:=false;
   FormPeach.PanelBarOpen2.Visible:=false;
   FormPeach.PanelBarOpen3.Visible:=true;
   FormPeach.pmtool1.Checked:=false;
   FormPeach.pmtool2.Checked:=false;
   FormPeach.pmtool3.Checked:=true;
   end;
end;
settoolbar;
end;

procedure toggletoolbar;
begin
FormPeach.PanelBarOpen1.Visible:=false;
FormPeach.PanelBarOpen2.Visible:=false;
FormPeach.PanelBarOpen3.Visible:=false;
FormPeach.pmtool1.Checked:=false;
FormPeach.pmtool2.Checked:=false;
FormPeach.pmtool3.Checked:=false;
case lasttoolbar of
1: begin
   FormPeach.PanelBarOpen2.Visible:=true;
   lasttoolbar:=2;
   FormPeach.pmtool1.Checked:=true;
   end;
2: begin
   FormPeach.PanelBarOpen3.Visible:=true;
   lasttoolbar:=3;
   FormPeach.pmtool2.Checked:=true;
   end;
3: begin
   FormPeach.PanelBarOpen1.Visible:=true;
   lasttoolbar:=1;
   FormPeach.pmtool3.Checked:=true;
   end;
end;
settoolbar;
end;

procedure setusebreadcrumb(i,mode:integer);
begin
usebreadcrumb:=i;
FormPeach.mbtext.Checked:=false;
FormPeach.mbkde.Checked:=false;
FormPeach.mbgnome.Checked:=false;
FormPeach.mbgnome4.Checked:=false;
FormPeach.mbmac.Checked:=false;
case i of
   0: begin
      FormPeach.mbtext.Checked:=true;
      FormPeach.PanelClickAddress.Visible:=false;
      FormPeach.EditOpenInInteractive.Enabled:=true;
      altbread:=0;
      macbread:=0;
      end;
   1: begin
      FormPeach.mbkde.Checked:=true;
      FormPeach.PanelClickAddress.Visible:=true;
      FormPeach.EditOpenInInteractive.Enabled:=false;
      altbread:=0;
      macbread:=0;
      end;
   2: begin
      FormPeach.mbgnome.Checked:=true;
      FormPeach.PanelClickAddress.Visible:=true;
      FormPeach.EditOpenInInteractive.Enabled:=false;
      altbread:=1;
      macbread:=0;
      apply_theme;
      end;
   3: begin
      FormPeach.mbgnome4.Checked:=true;
      FormPeach.PanelClickAddress.Visible:=true;
      FormPeach.EditOpenInInteractive.Enabled:=false;
      altbread:=2;
      macbread:=0;
      apply_theme;
      end;
   4: begin
      FormPeach.mbmac.Checked:=true;
      FormPeach.PanelClickAddress.Visible:=true;
      FormPeach.EditOpenInInteractive.Enabled:=false;
      altbread:=1;
      macbread:=1;
      apply_theme;
      end;
   end;
if mode=1 then saverestartclosepeaapp;
end;

procedure do_showthumbs;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
if showthumbnails=1 then setshowthumbnails(0) else setshowthumbnails(1);
do_forcerefresh;
end;

procedure browsehistoryn(n:integer);
begin
if FormPeach.StringGridSessionHistory.RowCount>n then
   begin
   FormPeach.StringGridSessionHistory.Row:=FormPeach.StringGridSessionHistory.RowCount-n;
   browsehistory;
   end;
end;

procedure openunitasarchive;
var
   s:ansistring;
begin
if fun='FILEBROWSER' then
   if FormPeach.EditOpenIn.Text=txt_mypc then
      begin
      if checklistsel<>0 then
         begin
         s:='PhysicalDrive0';
         if pInputQuery(txt_2_8_viewasarchive, txt_2_8_typeunit, '', s, false) then
         else
            begin
            listingdir:=false;
            exit;
            end;
         end
      else
         s:=copy(FormPeach.StringGridList.Cells[12, FormPeach.StringGridList.Row], 1, 2);
      end
   else
      begin
      s:=copy(FormPeach.EditOpenIn.Text, 1, 2);
      if s='\\' then exit;
      end
else
   begin
   s:=copy(FormPeach.EditOpenIn.Text, 1, 2);
   if s='\\' then exit;
   end;
s:='\\.\'+s;
FormPeach.OpenDialogArchive.Filename:=s;
open_inputselect;
end;

procedure set_rowselect;
begin
//workaround, deselecting first subitem in listview does not deselect the row in Qt5 and 6, which leads to behavior of the component which is not consistent with oter widget.sets
{$IFDEF LCLQT6}rowselect:=true;{$ENDIF}
{$IFDEF LCLQT5}rowselect:=true;{$ENDIF}
FormPeach.ListViewBrowser.Rowselect:=rowselect;
FormPeach.mrowselect.checked:=rowselect;
FormPeach.pmrow.checked:=rowselect;
end;

function convert2webname(var s:ansistring):integer;
var
   i:integer;
   r:boolean;
begin
convert2webname:=-1;
r:=pInputQuery(txt_websearch, txt_searchfor, '', s, false);
if r then
   begin
   if s='' then exit;
   i:=1;
   repeat
      i:= pos(' ',s);
      if i>0 then s[pos(' ',s)]:='+';
   until i=0;
   convert2webname:=0;
   end;
end;

function checklistsel:integer; //0 if current row is selected
begin
checklistsel:=-1;
if updatinglistview=true then exit;
if FormPeach.StringGridList.Rowcount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if FormPeach.StringGridList.Cells[16,FormPeach.StringGridList.Row]<>'1' then exit;
checklistsel:=0;
end;

function checklistanysel:integer; //0 if any item is selected
begin
checklistanysel:=-1;
if updatinglistview=true then exit;
if FormPeach.StringGridList.Rowcount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if FormPeach.ListViewBrowser.SelCount>0 then checklistanysel:=0;
end;

function checklisttotsel(var nsel:integer; var strsel:ansistring):integer; //number of selected objects, and formatted string with first 5 names
var
   rc,i:integer;
begin
checklisttotsel:=-1;
if updatinglistview=true then exit;
if FormPeach.StringGridList.Rowcount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=FormPeach.StringGridList.Rowcount;
for i:=1 to rc-1 do
   if FormPeach.ListViewBrowser.Items[i-1].Selected=true then
      begin
      nsel:=nsel+1;
      case nsel of
         1: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         2: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         3: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         4: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         5: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         6: strsel:=strsel+'...';
         end;
      end;
if length(strsel)>2 then
   if strsel[length(strsel)]=char($0A) then
      setlength(strsel,length(strsel)-2);
if nsel>0 then checklisttotsel:=0;
end;

procedure do_organizebookmarks;
begin
if FormPeach.stringgridbookmarks.visible=false then showbar('bookmarks')
else
   case prevbar of
   1: showbar('none');
   0: showbar('statusbar');
   2: showbar('details');
   3: showbar('statusbar');
   4: showbar('recent');
   5: showbar('clip');
   end;
end;

procedure settpreset(i,sz:integer; stylemode:boolean);
begin
{$IFDEF MSWINDOWS}
FormPeach.ListViewBrowser.BeginUpdate;
case i of
1: begin
browsertype:=0;
setbrowsersize(sz);
if sz>2 then setshowthumbnails(1) else setshowthumbnails(0);
FormPeach.ctrlaltAExecute(nil);//needed to restore columns changing to virtual mode
end;
2: begin
browsertype:=1;
setbrowsersize(sz);
if sz>2 then setshowthumbnails(1) else setshowthumbnails(0);
end;
3: begin
browsertype:=2;
setbrowsersize(sz);
setshowthumbnails(1);
end;
end;
FormPeach.ListViewBrowser.EndUpdate;
do_forcerefresh;
tpreset:=i;
{$ELSE}
case i of
1: begin
   browsertype:=0;
   if sz>2 then setshowthumbnails(1) else setshowthumbnails(0);
   FormPeach.ctrlaltAExecute(nil);//changing to details mode at runtime after the listview is fully rendered on some widgetsets does not correctly set columns width, in other it crashes (maybe related)
   end;
2: begin
   browsertype:=1;
   if sz>2 then setshowthumbnails(1) else setshowthumbnails(0);
   end;
3: begin
   browsertype:=2;
   setshowthumbnails(1);
   end;
end;
browsersize:=sz;
tpreset:=i;
if stylemode=false then saverestartclosepeaapp;
{$ENDIF}
end;

procedure addextwebsearch;
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.Top=0{$ENDIF} then sg:=FormPeach.StringGridAdd
else sg:=FormPeach.StringGridExtract;
if sg.Rowcount=1 then exit;
s:=sg.Cells[1,sg.Row];
if s<>'' then run_websearch(s);
end;

procedure showaddresstextfield;
begin
FormPeach.PanelClickAddress.Visible:=false;
if altbread=1 then FormPeach.ShapeListBar.Visible:=false;
FormPeach.EditOpenInInteractive.Enabled:=true;
if FormPeach.Visible=true then FormPeach.EditOpenInInteractive.SetFocus;
end;

procedure clear_clipboard;
var
   rc,i:integer;
begin
rc:=FormPeach.StringGridList.RowCount;
if rc>0 then
begin
   for i:=1 to rc-1 do
      begin
      FormPeach.StringGridList.Cells[16,i]:='0';
      FormPeach.StringGridList.Cells[0,i]:='';
      end;
   FormPeach.StringGridList.Cells[16,1]:='1';
   FormPeach.StringGridList.Row:=1;
   FormPeach.Refresh;
   end;
setlength(clipcontent,0);
FormPeach.StringGridClipboard.Rowcount:=1;
FormPeach.StringGridClipboard.Autosizecolumns;
update_listview_sel;
end;

procedure browser_explorepath(iscontext:integer);
//0 open current path 1 open selected item's path 2 open special folder Trash
var
   s:ansistring;
begin
if checkfdwin<>0 then exit;
with FormPeach do
begin
case iscontext of
0: begin
   if fun='FILEBROWSER' then
      begin
      s:=FormPeach.EditOpenInInteractive.Text;
      {$IFDEF MSWINDOWS}
      if s=txt_mypc then
         if checklistsel=0 then s:=StringGridList.Cells[12,StringGridList.Row]
         else
            begin
            explorewinroot;
            exit;
            end;
      {$ENDIF}
      end
   else
      s:=extractfilepath(EditOpenIn.Text);
   cp_open(s,desk_env);
   end;
1: begin
   if fun='FILEBROWSER' then
      begin
      {$IFDEF MSWINDOWS}
      if StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]=txt_mypc then
         begin
         if checklistsel=0 then cp_open(StringGridList.Cells[12,StringGridList.Row],desk_env)
         else explorewinroot;
         exit;
         end;
      {$ENDIF}
      if checklistsel=0 then
         if StringGridList.Cells[2,StringGridList.Row]=txt_list_isfolder then
            cp_open(StringGridList.Cells[12,StringGridList.Row],desk_env) //open folder
         else //go to object's path
            begin
            s:=(StringGridList.Cells[12,StringGridList.Row]);
            if s='' then s:=FormPeach.EditOpenIn.Text;
            if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
            cp_explorepath(s, desk_env);
            end
      else cp_open(EditOpenIn.Text,desk_env);
      end
   else
      begin
      if checkfiledirname(EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+EditOpenIn.Text); exit; end;
      cp_explorepath(EditOpenIn.Text, desk_env);
      end;
   end;
2: begin
   {$IFDEF MSWINDOWS}
   s:='shell:RecycleBinFolder';
   {$ELSE}
   {$IFDEF DARWIN}
   s:=home_path+'.Trash/';
   {$ELSE}
   s:=home_path+'.local/share/Trash/';
   {$ENDIF}
   {$ENDIF}
   cp_open(s,desk_env);
   end;
end;
end;
end;

procedure do_forcerefresh;
begin
updateid:='';
prevupdateid:='';
navrefresh;
end;

procedure run_websearch(s:ansistring);
var
   i:integer;
begin
FormWeb.EditInputQueryWeb.Text:=s;
FormWeb.Showmodal;
case FormWeb.ModalResult of
   mrOk:
      begin
      s:=FormWeb.EditInputQueryWeb.Text;
      if s<>'' then
         begin
         i:=1;
         repeat
            i:= pos(' ',s);
            if i>0 then s[pos(' ',s)]:='+';
         until i=0;
         end;
      if s<>'' then
         begin
         if FormWeb.CheckGroupWeb.Checked[0]=true then webopen('https://www.amazon.com/s?k='+s);
         if FormWeb.CheckGroupWeb.Checked[1]=true then webopen('https://www.apple.com/search/'+s+'?src=serp');
         if FormWeb.CheckGroupWeb.Checked[2]=true then webopen('https://www.bing.com/search?q='+s);
         if FormWeb.CheckGroupWeb.Checked[3]=true then webopen('https://www.britannica.com/search?query='+s);
         if FormWeb.CheckGroupWeb.Checked[4]=true then webopen('https://duckduckgo.com/?q='+s+'&ia=web');
         if FormWeb.CheckGroupWeb.Checked[5]=true then webopen('https://github.com/search?q='+s);
         if FormWeb.CheckGroupWeb.Checked[6]=true then webopen('https://www.google.com/search?q='+s);
         if FormWeb.CheckGroupWeb.Checked[7]=true then webopen('https://translate.google.com/?sl=auto&tl=en&text='+s);
         if FormWeb.CheckGroupWeb.Checked[8]=true then webopen('https://www.imdb.com/find?s=all&q='+s);
         if FormWeb.CheckGroupWeb.Checked[9]=true then webopen('https://www.linkedin.com/search/results/all/?keywords='+s);
         if FormWeb.CheckGroupWeb.Checked[10]=true then webopen('https://www.reddit.com/search?q='+s);
         if FormWeb.CheckGroupWeb.Checked[11]=true then webopen('https://repology.org/projects/?search='+s);
         if FormWeb.CheckGroupWeb.Checked[12]=true then webopen('https://sourceforge.net/directory/os:windows/?q='+s);
         if FormWeb.CheckGroupWeb.Checked[13]=true then webopen('https://stackoverflow.com/search?q='+s);
         if FormWeb.CheckGroupWeb.Checked[14]=true then webopen('https://wikibooks.org/w/index.php?go=Go&search='+s);
         if FormWeb.CheckGroupWeb.Checked[15]=true then webopen('https://www.wikipedia.org/wiki/Special:Search?search='+s+'&fulltext=Search');
         if FormWeb.CheckGroupWeb.Checked[16]=true then webopen('https://www.wiktionary.org/wiki/Special:Search?search='+s+'&fulltext=Search');
         if FormWeb.CheckGroupWeb.Checked[17]=true then webopen('https://www.youtube.com/results?search_query='+s);
         end
      else
         begin
         if FormWeb.CheckGroupWeb.Checked[0]=true then webopen('https://www.amazon.com');
         if FormWeb.CheckGroupWeb.Checked[1]=true then webopen('https://www.apple.com');
         if FormWeb.CheckGroupWeb.Checked[2]=true then webopen('https://www.bing.com');
         if FormWeb.CheckGroupWeb.Checked[3]=true then webopen('https://www.britannica.com');
         if FormWeb.CheckGroupWeb.Checked[4]=true then webopen('https://duckduckgo.com');
         if FormWeb.CheckGroupWeb.Checked[5]=true then webopen('https://github.com');
         if FormWeb.CheckGroupWeb.Checked[6]=true then webopen('https://www.google.com');
         if FormWeb.CheckGroupWeb.Checked[7]=true then webopen('https://translate.google.com');
         if FormWeb.CheckGroupWeb.Checked[8]=true then webopen('https://www.imdb.com');
         if FormWeb.CheckGroupWeb.Checked[9]=true then webopen('https://www.linkedin.com');
         if FormWeb.CheckGroupWeb.Checked[10]=true then webopen('https://www.reddit.com');
         if FormWeb.CheckGroupWeb.Checked[11]=true then webopen('https://repology.org');
         if FormWeb.CheckGroupWeb.Checked[12]=true then webopen('https://sourceforge.net');
         if FormWeb.CheckGroupWeb.Checked[13]=true then webopen('https://stackoverflow.com');
         if FormWeb.CheckGroupWeb.Checked[14]=true then webopen('https://wikibooks.org');
         if FormWeb.CheckGroupWeb.Checked[15]=true then webopen('https://www.wikipedia.org');
         if FormWeb.CheckGroupWeb.Checked[16]=true then webopen('https://www.wiktionary.org');
         if FormWeb.CheckGroupWeb.Checked[17]=true then webopen('https://www.youtube.com');
         end;
      end;
   mrCancel:
      begin
      end;
   end;
end;

procedure websearch_sel;
var
   s:ansistring;
begin
if checklistsel=0 then s:=FormPeach.StringGridList.Cells[1,FormPeach.StringGridList.Row]
else getmainfiledirname(s);
run_websearch(s);
end;

procedure navgoback;
begin
if browserbusy=true then exit;
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
if FormPeach.StringGridSessionHistory.RowCount>2 then
   begin
   FormPeach.StringGridSessionHistory.Row:=FormPeach.StringGridSessionHistory.Row-1;
   browsehistory;
   end;
end;

procedure navgofwd;
begin
if browserbusy=true then exit;
if FormPeach.StringGridSessionHistory.Row<FormPeach.StringGridSessionHistory.RowCount-1 then
   begin
   FormPeach.StringGridSessionHistory.Row:=FormPeach.StringGridSessionHistory.Row+1;
   browsehistory;
   end;
end;

procedure navgoup;
var
   s,s1:ansistring;
begin
if browserbusy=true then exit;
if (FormAdvf.CheckBoxAdvFilters.State=cbUnChecked) and (fun='UN7Z') and
   (FormPeach.StringGridSessionHistory.Cells[3,FormPeach.StringGridSessionHistory.Row]<>'*') and
   (FormPeach.StringGridSessionHistory.Cells[3,FormPeach.StringGridSessionHistory.Row]<>DirectorySeparator+DirectorySeparator+'*') then
   begin
   if (FormPeach.EditUn7zaFilter.Text='*') and (FormPeach.EditUn7zaFilterExclude.Text='*'+directoryseparator+'*') then exit;
   s:=extractfilepath(copy(extractfilepath(FormPeach.EditUn7zaFilter.Text),1,length(extractfilepath(FormPeach.EditUn7zaFilter.Text))-1));
   if s=DirectorySeparator+DirectorySeparator then s:='';
   if (length(s)=2) and (s[2]=':') then s:='';
   FormPeach.EditUn7zaFilter.Text:=s+'*';
   FormPeach.EditUn7zaFilterExclude.Text:=s+'*'+directoryseparator+'*';
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   filter_archivecontent;
   addtohistory;
   end
else
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   s:=FormPeach.EditOpenIn.Text;
   if s<>'' then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   s:=extractfilepath(s);
   if checkUNCpath(s) then
      begin
      s1:=copy(s,1,length(s)-1);
      if (extractfilepath(s1)='\\') or (extractfilepath(s1)='\') or (extractfilepath(s1)='') then
         begin
         {$IFDEF MSWINDOWS}
         s:='';
         listpc;
         addtohistory;
         {$ENDIF}
         exit;
         end;
      end;
   {$IFDEF MSWINDOWS}
   if FormPeach.EditOpenIn.Text=txt_mypc then
      begin
      openpathp(local_desktop);
      exit;
      end;
   if s<>'' then
      if s[length(s)]=':' then
      begin
      s:=s+directoryseparator;
      listpc;
      addtohistory;
      exit;
      end;
   {$ENDIF}
   FormPeach.EditUn7zaFilter.Text:='*';
   if s='' then exit;
   listdir(s,false,false);
   addtohistory;
   end;
end;

procedure open_indir;
begin
showpanel('open');
if (indir<>txt_mypc) then
   if not(checkdirexists(indir)) then indir:={$IFDEF MSWINDOWS}txt_mypc;{$ELSE}'/';{$ENDIF}
FormPeach.EditOpenIn.Text:=indir; //does not need character escaping at this stage
fun:='FILEBROWSER';
fun_status:=fun;
open_inputselect;
end;

procedure open_noinput;
begin
if (restoretabbar=1) and (starttaberror=false) then showpanel('open') else open_indir;
end;

procedure showpanel_trick;
//Workaround: on some Linux systems the GTK1 version of PeaZip may sometimes not
//show correctly 'archive' panel (shows 'open' toolbar instead); this code fixes
//the issue without harming if it's not the case
begin
{$IFNDEF MSWINDOWS}
FormPeach.Repaint;
showpanel('archive');
{$ENDIF}
end;

procedure msg_not_accessible_s(s:ansistring);
begin
//interactive error message suppressed
end;

procedure open_singleinput(s:ansistring);
begin
case testinput(s,true) of
0: begin //unknown, ask to force open as archive or add to layout
   case pMessageInfoYesNo(txt_dis+' '+txt_2_7_drag_archive) of
      6: begin
         showpanel('open');
         forceopenasarchive:=true;
         open_archive_fromname(ExpandFileName(s));
         //forceopenasarchive:=false;
         addtohistory;
         end;
      7: begin
         showpanel('archive');
         showpanel_trick;
         if filegetattr(ExpandFileName(s)) > 0 then
            if filegetattr(ExpandFileName(s)) and faDirectory =0 then addfilestr(FormPeach.StringGridAdd,s)
            else addfolderstr(FormPeach.StringGridAdd,ExpandFileName(s))
         else msg_not_accessible_s(s);
         FormPeach.StringGridAdd.AutoSizeColumns;
         updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
         stayopen:=false;
         savetype:=true;
         end;
   end;
   end;
1000: //directory, browse
   begin
   showpanel('open');
   fun:='FILEBROWSER';
   fun_status:=fun;
   listdir(s,false,false);
   addtohistory;
   end;
else //known type, open as archive
   begin
   showpanel('open');
   open_archive_fromname(ExpandFileName(s));
   addtohistory;
   end;
end;
end;

procedure fixbringtofront;
begin
{$IFDEF MSWINDOWS}
FormPeach.FormStyle:=fsStayOnTop;
FormPeach.FormStyle:=fsNormal;
{$ENDIF}
end;

procedure selnone;
var
   i:integer;
begin
for i:=0 to FormPeach.StringGridList.RowCount-1 do FormPeach.StringGridList.Cells[16,i]:='0';
end;

procedure set_dirbeforefiles(dmode:integer);
begin
case dmode of
   0:
   begin
   prefixd:='1';
   prefixf:='1';
   prefixdaz:='a ';
   prefixfaz:='a ';
   prefixdza:='a ';
   FormPeach.mdirbeforefiles.checked:=false;
   end;
   1:
   begin
   prefixd:='1';
   prefixf:='2';
   prefixdaz:='a ';
   prefixfaz:='b ';
   prefixdza:='c ';
   FormPeach.mdirbeforefiles.checked:=true;
   end;
   end;
end;

procedure savecopy;
var
   sin,sout:ansistring;
   P:TProcessUTF8;
begin
sin:='';
if fun='FILEBROWSER' then
   begin
   if FormPeach.ListViewBrowser.SelCount=1 then
      if FormPeach.StringGridList.Cells[16,FormPeach.StringGridList.Row]='1' then
         sin:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   end
else
   sin:=FormPeach.EditOpenIn.Caption;
sout:='';
if sin<>'' then
   begin
   FormPeach.SaveDialogAS.FileName:=ExtractFileName(sin);
   FormPeach.SaveDialogAS.InitialDir:=ExtractFilePath(sin);
   if FormPeach.SaveDialogAS.Execute then
      if FormPeach.SaveDialogAS.FileName<>'' then
         sout:=FormPeach.SaveDialogAS.FileName
      else exit
   else exit;
   end;
if sout<>'' then
   if sin<>sout then
      try
      //CopyFile(sin,sout);
      {$IFDEF MSWINDOWS}
      fileop_fromnamelist_single(sin,sout,2,1);
      {$ELSE}
      cl:='cp -p -r '+stringdelim(sin)+' '+stringdelim(sout);
      if validatecl(cl)<>0 then
         begin
         pMessageWarningOK(txt_2_7_validatecl+' '+cl);
         exit;
         end;
      P:=tprocessutf8.Create(nil);
      P.Options := [poWaitOnExit];
      peapexecute(P,cl);
      P.Free;
      {$ENDIF}
      except
      end;
end;

procedure on_mFlatArchivesClick(i:integer);
begin
browserstyle:=i;
if i=0 then FormPeach.mFlatArchives.checked:=false else FormPeach.mFlatArchives.checked:=true;
FormPeach.pmFlatArchives.checked:=FormPeach.mFlatArchives.checked;
end;

procedure TFormPeach.mFlatArchivesClick(Sender: TObject);
begin
if browserstyle=1 then on_mFlatArchivesClick(0) else on_mFlatArchivesClick(1);
f5refreshExecute(nil);
end;

procedure set_smartsortable;
begin
FormPeach.msmartsort.checked:=smartsortenabled;
end;

procedure sort_az_stringgrid1(c:integer);
begin
FormPeach.StringGridAdd.SortColRow(true,c);
FormPeach.StringGridAdd.Repaint;
end;

procedure sort_az_stringgrid2(c:integer);
begin
FormPeach.StringGridExtract.SortColRow(true,c);
FormPeach.StringGridExtract.Repaint;
end;

procedure sort_az_stringgridbookmarks(c:integer);
begin
if c=7 then c:=10;
FormPeach.StringGridBookmarks.SortColRow(true,c);
FormPeach.StringGridBookmarks.Repaint;
end;

procedure select_sortby;
var
   Column:integer;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
   begin
   Column:=11;

   if Column=listsortcol1 then
      if FormPeach.StringGridAdd.SortOrder=soAscending then FormPeach.StringGridAdd.SortOrder:=soDescending
      else FormPeach.StringGridAdd.SortOrder:=soAscending
   else FormPeach.StringGridAdd.SortOrder:=soAscending;
   sort_az_stringgrid1(Column);

   listsortcol1:=Column;
   FormPeach.StringGridAdd.Repaint;
   end;
{$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
   begin
   Column:=11;

   if Column=listsortcol2 then
      if FormPeach.StringGridExtract.SortOrder=soAscending then FormPeach.StringGridExtract.SortOrder:=soDescending
      else FormPeach.StringGridExtract.SortOrder:=soAscending
   else FormPeach.StringGridExtract.SortOrder:=soAscending;
   sort_az_stringgrid2(Column);

   listsortcol2:=Column;
   FormPeach.StringGridExtract.Repaint;
   end;
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   if FormPeach.ListViewBrowser.Visible=true then
      begin
      Column:=16;
      sort_az_stringgridlist(Column);
      listsortcol:=16;
      update_listview;
      if fun='UN7Z' then generate_archive_breadcrumb;
      end;
end;

procedure advancedselect;
var
   cba,cbb:integer;
   sa,sb:ansistring;
begin
FormSelect.Showmodal;
cba:=FormSelect.ComboBoxSelect1.ItemIndex;
cbb:=FormSelect.ComboBoxSelect2.ItemIndex;
case FormSelect.ModalResult of
   mrAll: select_all('1');
   mrNo: select_invert;
   mrNoToAll: select_sortby;
   mrOK:
   begin
   case cba of
      0: sa:='ext';
      1: sa:='char';
      2: sa:='charcase';
      3: sa:='attributes';
      4: sa:='dateyear';
      5: sa:='datemonth';
      6: sa:='dateweek';
      7: sa:='dateday';
      8: sa:='datehour';
      9: sa:='datesameyear';
      10: sa:='datesamemonth';
      11: sa:='datesameweek';
      12: sa:='datesameday';
      13: sa:='datesamehour';
      14: sa:='daterecent';
      15: sa:='daterecentequal';
      16: sa:='dateequal';
      17: sa:='dateolderequal';
      18: sa:='dateolder';
      19: sa:='sizeempty';
      20: sa:='size100k';
      21: sa:='size10m';
      22: sa:='size100m';
      23: sa:='sizeover';
      24: sa:='sizesimilar10';
      25: sa:='sizesimilar50';
      26: sa:='sizesmaller';
      27: sa:='sizesmallerequal';
      28: sa:='sizeequal';
      29: sa:='sizelargerequal';
      30: sa:='sizelarger';
      31: sa:='packedempty';
      32: sa:='packed100k';
      33: sa:='packed10m';
      34: sa:='packed100m';
      35: sa:='packedover';
      36: sa:='packedsimilar10';
      37: sa:='packedsimilar50';
      38: sa:='packedsmaller';
      39: sa:='packedsmallerequal';
      40: sa:='packedequal';
      41: sa:='packedlargerequal';
      42: sa:='packedlarger';
   end;
   case cbb of
      0: sb:='neutralsel';
      1: sb:='addsel';
      2: sb:='subtractsel';
   end;
   select_by(sa,sb);
   end
else
   begin
   FormSelect.ComboBoxSelect1.ItemIndex:=cba;
   FormSelect.ComboBoxSelect2.ItemIndex:=cbb;
   end;
end;
end;

procedure peazip_browse;
var
   s:ansistring;
begin
fun:='FILEBROWSER';
fun_status:=fun;
if fileexists((FormPeach.EditOpenIn.Text)) then FormPeach.SelectDirectoryDialog1.InitialDir:=extractfilepath(FormPeach.EditOpenIn.Text)
else FormPeach.SelectDirectoryDialog1.InitialDir:=FormPeach.EditOpenIn.Text;
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      FormPeach.EditOpenIn.Text:=FormPeach.SelectDirectoryDialog1.FileName
   else exit
else exit;
s:=FormPeach.EditOpenIn.Text;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
FormPeach.EditUn7zaFilter.Text:='*';
showpanel('open');
listdir(s,false,false);
addtohistory;
end;

procedure open_associated;
var
   i:integer;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then sg:=FormPeach.StringGridAdd
else sg:=FormPeach.StringGridExtract;
i:=sg.Row;
if i>0 then cp_open(sg.Cells[8,i],desk_env);
end;

function set_grid:boolean;
var
   rc,i:integer;
begin
try
set_grid:=false;
rc:=FormPeach.Stringgridlist.Rowcount;
if rc<2 then exit;
if FormPeach.StringgridList.Cells[1,1]='' then exit;
if FormPeach.ListViewBrowser.Items.Count<1 then exit;
{$IFDEF MSWINDOWS}//works properly on Lazarus 0.9.30
if FormPeach.ListViewBrowser.Selected<>nil then i:=FormPeach.ListViewBrowser.Selected.Index
else exit;
if FormPeach.ListViewBrowser.Items[i].selected=true then FormPeach.StringGridList.Row:=i+1;
set_grid:=true;
{$ELSE}
if rc>1 then
   for i:=1 to rc-1 do
      try
      if FormPeach.ListViewBrowser.Items[i-1].selected=true then
         begin
         FormPeach.Stringgridlist.Row:=i;
         set_grid:=true;
         break;
         end;
      except
      end;
{$ENDIF}
except
end;
end;

procedure doprogress2;
var
  i:integer;
begin
if FormPeach.ProgressBar2.Visible=false then
   if pcount<60 then //expire at first refresh after 3 seconds
      pcount:=pcount+1
   else
      begin
      FormPeach.ProgressBar2.width:=0;
      FormPeach.ProgressBar2.Visible:=true;
      FormPeach.ProgressBar2.Brush.Color:=PGREEN;
      FormPeach.ProgressBar2.Pen.Color:=PGREEN;
      if altbread<>1 then FormPeach.Panel10.Color:=FormPeach.PanelClickAddress.Color;
      FormPeach.Panel10.Visible:=true;
      refreshstatus:=2;
      FormPeach.ImageListSearch.Picture.Bitmap:=Bwipe;
      end
else
   begin
   FormPeach.Progressbar2.width:=FormPeach.Progressbar2.width+1;
   if FormPeach.Progressbar2.width>=64 then FormPeach.Progressbar2.width:=0;
   end;
end;

procedure doprogress;
begin
if (browserbusy=true) then doprogress2;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection OPEN WITH in file browser

///////////////////////////////////////////////////////////////////////////////}

procedure open_custedit_empty(i:integer);
{$IFNDEF MSWINDOWS}
   var
   P:tprocessutf8;
   cl:ansistring;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
case i of
   1: if validatecl(custedit1)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit1); exit; end;
   2: if validatecl(custedit2)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit2); exit; end;
   3: if validatecl(custedit3)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit3); exit; end;
   4: if validatecl(custedit4)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit4); exit; end;
   5: if validatecl(custedit5)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit5); exit; end;
   6: if validatecl(custedit6)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit6); exit; end;
   7: if validatecl(custedit7)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit7); exit; end;
   8: if validatecl(custedit8)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit8); exit; end;
   9: if validatecl(custedit9)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit9); exit; end;
   10: if validatecl(custedit10)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit10); exit; end;
   11: if validatecl(custedit11)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit11); exit; end;
   12: if validatecl(custedit12)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit12); exit; end;
   13: if validatecl(custedit13)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit13); exit; end;
   14: if validatecl(custedit14)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit14); exit; end;
   15: if validatecl(custedit15)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit15); exit; end;
   16: if validatecl(custedit16)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit16); exit; end;
   end;
case i of
   1: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit1)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   2: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit2)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   3: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit3)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   4: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit4)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   5: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit5)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   6: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit6)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   7: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit7)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   8: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit8)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   9: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit9)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   10: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit10)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   11: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit11)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   12: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit12)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   13: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit13)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   14: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit14)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   15: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit15)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   16: ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit16)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   end;
{$ELSE}
try
{$IFDEF DARWIN}
case i of
   1: cl:=(custedit1);
   2: cl:=(custedit2);
   3: cl:=(custedit3);
   4: cl:=(custedit4);
   5: cl:=(custedit5);
   6: cl:=(custedit6);
   7: cl:=(custedit7);
   8: cl:=(custedit8);
   9: cl:=(custedit9);
   10: cl:=(custedit10);
   11: cl:=(custedit11);
   12: cl:=(custedit12);
   13: cl:=(custedit13);
   14: cl:=(custedit14);
   15: cl:=(custedit15);
   16: cl:=(custedit16);
   end;
{$ELSE}
case i of
   1: cl:=stringdelim(custedit1);
   2: cl:=stringdelim(custedit2);
   3: cl:=stringdelim(custedit3);
   4: cl:=stringdelim(custedit4);
   5: cl:=stringdelim(custedit5);
   6: cl:=stringdelim(custedit6);
   7: cl:=stringdelim(custedit7);
   8: cl:=stringdelim(custedit8);
   9: cl:=stringdelim(custedit9);
   10: cl:=stringdelim(custedit10);
   11: cl:=stringdelim(custedit11);
   12: cl:=stringdelim(custedit12);
   13: cl:=stringdelim(custedit13);
   14: cl:=stringdelim(custedit14);
   15: cl:=stringdelim(custedit15);
   16: cl:=stringdelim(custedit16);
   end;
{$ENDIF}
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
except
end;
{$ENDIF}
end;

procedure open_custedit(i:integer; s:ansistring);
var
   {$IFDEF MSWINDOWS}
   w,w1:widestring;
   {$ELSE}
   P:tprocessutf8;
   cl:ansistring;
   {$ENDIF}
begin
if s='' then
   begin
   open_custedit_empty(i);
   exit;
   end;
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
{$IFDEF MSWINDOWS}
case i of
   1: if validatecl(custedit1)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit1); exit; end;
   2: if validatecl(custedit2)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit2); exit; end;
   3: if validatecl(custedit3)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit3); exit; end;
   4: if validatecl(custedit4)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit4); exit; end;
   5: if validatecl(custedit5)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit5); exit; end;
   6: if validatecl(custedit6)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit6); exit; end;
   7: if validatecl(custedit7)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit7); exit; end;
   8: if validatecl(custedit8)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit8); exit; end;
   9: if validatecl(custedit9)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit9); exit; end;
   10: if validatecl(custedit10)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit10); exit; end;
   11: if validatecl(custedit11)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit11); exit; end;
   12: if validatecl(custedit12)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit12); exit; end;
   13: if validatecl(custedit13)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit13); exit; end;
   14: if validatecl(custedit14)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit14); exit; end;
   15: if validatecl(custedit15)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit15); exit; end;
   16: if validatecl(custedit16)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+custedit16); exit; end;
   end;
w:=utf8decode(s);
w1:=utf8decode(extractfilename(s));
//web service, pass only file name; local or remote program/script, pass full qualified name
case i of
   1: if isawebservice(custedit1) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit1)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit1)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   2: if isawebservice(custedit2) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit2)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit2)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   3: if isawebservice(custedit3) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit3)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit3)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   4: if isawebservice(custedit4) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit4)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit4)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   5: if isawebservice(custedit5) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit5)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit5)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   6: if isawebservice(custedit6) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit6)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit6)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   7: if isawebservice(custedit7) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit7)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit7)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   8: if isawebservice(custedit8) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit8)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit8)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   9: if isawebservice(custedit9) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit9)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit9)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   10: if isawebservice(custedit10) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit10)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit10)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   11: if isawebservice(custedit11) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit11)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit11)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   12: if isawebservice(custedit12) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit12)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit12)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   13: if isawebservice(custedit13) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit13)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit13)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   14: if isawebservice(custedit14) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit14)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit14)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   15: if isawebservice(custedit15) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit15)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit15)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   16: if isawebservice(custedit16) then
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit16)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit16)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   end;
{$ELSE}
try
{$IFDEF DARWIN}
case i of
   1: if isawebservice(custedit1) then
         cl:=stringdelim(custedit1+extractfilename(s))
      else
         cl:=(custedit1)+' '+stringdelim(escapefilename(s,desk_env));
   2: if isawebservice(custedit2) then
         cl:=stringdelim(custedit2+extractfilename(s))
      else
         cl:=(custedit2)+' '+stringdelim(escapefilename(s,desk_env));
   3: if isawebservice(custedit3) then
         cl:=stringdelim(custedit3+extractfilename(s))
      else
         cl:=(custedit3)+' '+stringdelim(escapefilename(s,desk_env));
   4: if isawebservice(custedit4) then
         cl:=stringdelim(custedit4+extractfilename(s))
      else
         cl:=(custedit4)+' '+stringdelim(escapefilename(s,desk_env));
   5: if isawebservice(custedit5) then
         cl:=stringdelim(custedit5+extractfilename(s))
      else
         cl:=(custedit5)+' '+stringdelim(escapefilename(s,desk_env));
   6: if isawebservice(custedit6) then
         cl:=stringdelim(custedit6+extractfilename(s))
      else
         cl:=(custedit6)+' '+stringdelim(escapefilename(s,desk_env));
   7: if isawebservice(custedit7) then
         cl:=stringdelim(custedit7+extractfilename(s))
      else
         cl:=(custedit7)+' '+stringdelim(escapefilename(s,desk_env));
   8: if isawebservice(custedit8) then
         cl:=stringdelim(custedit8+extractfilename(s))
      else
         cl:=(custedit8)+' '+stringdelim(escapefilename(s,desk_env));
   9: if isawebservice(custedit9) then
         cl:=stringdelim(custedit9+extractfilename(s))
      else
         cl:=(custedit9)+' '+stringdelim(escapefilename(s,desk_env));
   10: if isawebservice(custedit10) then
         cl:=stringdelim(custedit10+extractfilename(s))
      else
         cl:=(custedit10)+' '+stringdelim(escapefilename(s,desk_env));
   11: if isawebservice(custedit11) then
         cl:=stringdelim(custedit11+extractfilename(s))
      else
         cl:=(custedit11)+' '+stringdelim(escapefilename(s,desk_env));
   12: if isawebservice(custedit12) then
         cl:=stringdelim(custedit12+extractfilename(s))
      else
         cl:=(custedit12)+' '+stringdelim(escapefilename(s,desk_env));
   13: if isawebservice(custedit13) then
         cl:=stringdelim(custedit13+extractfilename(s))
      else
         cl:=(custedit13)+' '+stringdelim(escapefilename(s,desk_env));
   14: if isawebservice(custedit14) then
         cl:=stringdelim(custedit14+extractfilename(s))
      else
         cl:=(custedit14)+' '+stringdelim(escapefilename(s,desk_env));
   15: if isawebservice(custedit15) then
         cl:=stringdelim(custedit15+extractfilename(s))
      else
         cl:=(custedit15)+' '+stringdelim(escapefilename(s,desk_env));
   16: if isawebservice(custedit16) then
         cl:=stringdelim(custedit16+extractfilename(s))
      else
         cl:=(custedit16)+' '+stringdelim(escapefilename(s,desk_env));
   end;
{$ELSE}
case i of
   1: if isawebservice(custedit1) then
         cl:=stringdelim(custedit1+extractfilename(s))
      else
         cl:=stringdelim(custedit1)+' '+stringdelim(escapefilename(s,desk_env));
   2: if isawebservice(custedit2) then
         cl:=stringdelim(custedit2+extractfilename(s))
      else
         cl:=stringdelim(custedit2)+' '+stringdelim(escapefilename(s,desk_env));
   3: if isawebservice(custedit3) then
         cl:=stringdelim(custedit3+extractfilename(s))
      else
         cl:=stringdelim(custedit3)+' '+stringdelim(escapefilename(s,desk_env));
   4: if isawebservice(custedit4) then
         cl:=stringdelim(custedit4+extractfilename(s))
      else
         cl:=stringdelim(custedit4)+' '+stringdelim(escapefilename(s,desk_env));
   5: if isawebservice(custedit5) then
         cl:=stringdelim(custedit5+extractfilename(s))
      else
         cl:=stringdelim(custedit5)+' '+stringdelim(escapefilename(s,desk_env));
   6: if isawebservice(custedit6) then
         cl:=stringdelim(custedit6+extractfilename(s))
      else
         cl:=stringdelim(custedit6)+' '+stringdelim(escapefilename(s,desk_env));
   7: if isawebservice(custedit7) then
         cl:=stringdelim(custedit7+extractfilename(s))
      else
         cl:=stringdelim(custedit7)+' '+stringdelim(escapefilename(s,desk_env));
   8: if isawebservice(custedit8) then
         cl:=stringdelim(custedit8+extractfilename(s))
      else
         cl:=stringdelim(custedit8)+' '+stringdelim(escapefilename(s,desk_env));
   9: if isawebservice(custedit9) then
         cl:=stringdelim(custedit9+extractfilename(s))
      else
         cl:=stringdelim(custedit9)+' '+stringdelim(escapefilename(s,desk_env));
   10: if isawebservice(custedit10) then
         cl:=stringdelim(custedit10+extractfilename(s))
      else
         cl:=stringdelim(custedit10)+' '+stringdelim(escapefilename(s,desk_env));
   11: if isawebservice(custedit11) then
         cl:=stringdelim(custedit11+extractfilename(s))
      else
         cl:=stringdelim(custedit11)+' '+stringdelim(escapefilename(s,desk_env));
   12: if isawebservice(custedit12) then
         cl:=stringdelim(custedit12+extractfilename(s))
      else
         cl:=stringdelim(custedit12)+' '+stringdelim(escapefilename(s,desk_env));
   13: if isawebservice(custedit13) then
         cl:=stringdelim(custedit13+extractfilename(s))
      else
         cl:=stringdelim(custedit13)+' '+stringdelim(escapefilename(s,desk_env));
   14: if isawebservice(custedit14) then
         cl:=stringdelim(custedit14+extractfilename(s))
      else
         cl:=stringdelim(custedit14)+' '+stringdelim(escapefilename(s,desk_env));
   15: if isawebservice(custedit15) then
         cl:=stringdelim(custedit15+extractfilename(s))
      else
         cl:=stringdelim(custedit15)+' '+stringdelim(escapefilename(s,desk_env));
   16: if isawebservice(custedit16) then
         cl:=stringdelim(custedit16+extractfilename(s))
      else
         cl:=stringdelim(custedit16)+' '+stringdelim(escapefilename(s,desk_env));
   end;
{$ENDIF}
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
except
end;
{$ENDIF}
end;

procedure open_advcustedit(i:integer; s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
if s='' then
else
   if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
try
if s='' then
   case i of
   1: cl:=advedit1alt;
   2: cl:=advedit2alt;
   3: cl:=advedit3alt;
   4: cl:=advedit4alt;
   5: cl:=advedit5alt;
   6: cl:=advedit6alt;
   7: cl:=advedit7alt;
   8: cl:=advedit8alt;
   end
else
   case i of
   1: cl:=advedit1before+stringdelim(escapefilename(s,desk_env))+advedit1after;
   2: cl:=advedit2before+stringdelim(escapefilename(s,desk_env))+advedit2after;
   3: cl:=advedit3before+stringdelim(escapefilename(s,desk_env))+advedit3after;
   4: cl:=advedit4before+stringdelim(escapefilename(s,desk_env))+advedit4after;
   5: cl:=advedit5before+stringdelim(escapefilename(s,desk_env))+advedit5after;
   6: cl:=advedit6before+stringdelim(escapefilename(s,desk_env))+advedit6after;
   7: cl:=advedit7before+stringdelim(escapefilename(s,desk_env))+advedit7after;
   8: cl:=advedit8before+stringdelim(escapefilename(s,desk_env))+advedit8after;
   end;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
peapexecute(P,cl);
P.Free;
except
   pMessageWarningOK(txt_2_5_cannotrun+' '+(cl));
end;
end;

procedure do_refreshpreview;
begin
keeppreview:=false;
beingpreviewed:='';
//if ptmpcode<>'' then cleardir(ptmpdir,true,false);
create_ptmpcode(ptmpcode);
end;

procedure openwith_cust(act,custmode:ansistring; j:integer);
//act preview, extandrun
//custmode cust, adv, run
//j identificative number of the custom application
var
   i:integer;
   cl,jobcode,outname,s,sel,tmpstr:ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if checklistanysel<>0 then
   begin
   sel:='displayed';
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,act,sel)=0 then
         if execute_cl(cl,act)=0 then
            begin
            s:=outname;
            if s<>'' then
               if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
            s:=s+extractfilepath(FormPeach.StringGridList.Cells[12,1]);
            case custmode of
               'cust': open_custedit(j, s);
               'run': run_custom(s);
            else open_advcustedit(j, s);
            end;
            end
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,act,sel)=0 then
         if execute_cl(cl,act)=0 then
            begin
            s:=outname;
            if s<>'' then
               if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
            s:=s+FormPeach.StringGridList.Cells[12,1];
            case custmode of
               'cust': open_custedit(j, s);
               'run': run_custom(s);
            else open_advcustedit(j, s);
            end;
            end
         else
            pMessageWarningOK(txt_extraction_error);
   end
else
   begin
   sel:='single';
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         FormPeach.StringGridList.Row:=i;
         if fun='UN7Z' then
            if compose_un7z_cl(cl,jobcode,outname,true,act,sel)<>0 then continue;
         if fun='UNARC' then
            if compose_unarc_cl(cl,jobcode,outname,true,act,sel)<>0 then continue;
         if fun='UNBROTLI' then
           if FormPeach.StringGridList.Rowcount<3 then
              if compose_unbrotli_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if fun='UNQUAD' then
           if FormPeach.StringGridList.Rowcount<3 then
              if compose_unquad_cl(cl,jobcode,outname,true,act)<>0 then Continue;
         if fun='UNZSTD' then
           if FormPeach.StringGridList.Rowcount<3 then
              if compose_unzstd_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if fun='UNZPAQ' then
           if (zpaqabsolute=0) and (zpaqall=0) then //partial extraction not implemented for zpaq with absolute paths and with extract all revisions
              if compose_unzpaq_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if cl='' then Continue;
         if execute_cl(cl,act)=0 then
            begin
            s:=outname;
            if s<>'' then
               begin
               if (fun='UN7Z') or (fun='UNARC') then
                  begin
                  if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
                  tmpstr:=FormPeach.StringGridList.Cells[12,i];
                  {$IFDEF MSWINDOWS}tmpstr:=StringReplace(tmpstr,':','_', [rfReplaceAll]);{$ENDIF}
                  s:=s+tmpstr;
                  end;
               if fun='UNZPAQ' then
                  begin
                  if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
                  s:=s+extractfilename(FormPeach.StringGridList.Cells[12,i]);
                  end;
               end;
            case custmode of
               'cust': open_custedit(j, s);
               'run': run_custom(s);
               'checkselected': //unlike when in filesystem, the action is invoked with a single item at time
               case j of
                  0: prev_checkselected_list('check',s);
                  1: prev_checkselected_list('list',s);
                  2: prev_checkselected_list('SHA256G',s);
                  3: prev_checkselected_list('SHA256J',s);
                  4: prev_checkselected_list('SHA256V',s);
                  5: prev_checkselected_list('CRC32SAVE',s);
                  6: prev_checkselected_list('MD5SAVE',s);
                  7: prev_checkselected_list('SHA1SAVE',s);
                  8: prev_checkselected_list('SHA256SAVE',s);
                  9: prev_checkselected_list('BLAKE2BSAVE',s);
                  end;
               'hexpselected':
                  begin
                  if j=0 then
                     prev_hexpselected_list('HEXPREVIEW',s)
                  else
                     prev_hexpselected_list('TEXTPREVIEW',s);
                  end;
               'listcheckmotw': //unlike when in filesystem, the action is invoked with a single item at time
                  begin
                  if j=0 then
                     prev_listcheckmotw('',s)
                  else
                     prev_listcheckmotw('full',s);
                  end;
               'compareselected':
                  begin
                  prev_compareselected_list(s);
                  exit; //allow compare to run on a single item, consistently with usage from filesystem
                  end
               else open_advcustedit(j, s); //advanced custom apps
               end;
            end
         else
            pMessageWarningOK(txt_extraction_error);
         end;
   end;
end;

procedure preview_imgviewer(imgfullname,sizestr,timestr: ansistring);
var imgext,imgname:ansistring;
begin
imgname:=ExtractFileName(imgfullname);
imgext:=ExtractFileExt(imgfullname);
UnitImgViewer.viewerbusy:=false;
if supportedimgtype(imgext)<>true then exit;
UnitImgViewer.imgviewersrc:=1;
//add previewed item in Image Viewer input stringgrid
FormImgViewer.StringGridImgViewer.Clear;
FormImgViewer.StringGridImgViewer.RowCount:=2;
FormImgViewer.StringGridImgViewer.Cells[12,1]:=imgfullname;
FormImgViewer.StringGridImgViewer.Cells[1,1]:=imgname;
FormImgViewer.StringGridImgViewer.Cells[2,1]:=imgext;
FormImgViewer.StringGridImgViewer.Cells[3,1]:=sizestr;
FormImgViewer.StringGridImgViewer.Cells[5,1]:=timestr;
//open image
UnitImgViewer.applyzoom('open');
FormImgViewer.WindowState:=wsMaximized;
FormImgViewer.Showmodal;

end;

procedure openwith_base(act,target:ansistring);
//act preview, extandrun
//target peazip, associated, custom, system browser, image viewer
var
   i:integer;
   cl,jobcode,outname,sel:ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if checklistanysel<>0 then
   begin
   sel:='displayed';
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,act,sel)=0 then
         if execute_cl(cl,act)=0 then
            case target of
               'peazip': execute_obj(2,outname);
               'browser': cp_open(extractfilepath(outname+tempstring),desk_env);
               'associated': execute_obj(4,outname);
               'custom': openw_obj(outname);
            end
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,act,sel)=0 then
         if execute_cl(cl,act)=0 then
            case target of
               'peazip': execute_obj(2,outname);
               'browser': cp_open(extractfilepath(outname+tempstring),desk_env);
               'associated': execute_obj(4,outname);
               'custom': openw_obj(outname);
            end
         else
            pMessageWarningOK(txt_extraction_error);
   end
else
   begin
   sel:='single';
   //enable preview for single item on most backends
   //excluded backends PEA do not supports partial extraction; ACE, PAQ, LPAQ legacy
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         FormPeach.StringGridList.Row:=i;
         cl:='';
         if fun='UN7Z' then
            if compose_un7z_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if fun='UNARC' then
            if compose_unarc_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if fun='UNBROTLI' then
            if FormPeach.StringGridList.Rowcount<3 then
               if compose_unbrotli_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if fun='UNQUAD' then
            if FormPeach.StringGridList.Rowcount<3 then
               if compose_unquad_cl(cl,jobcode,outname,true,act)<>0 then Continue;
         if fun='UNZSTD' then
            if FormPeach.StringGridList.Rowcount<3 then
               if compose_unzstd_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if fun='UNZPAQ' then
            if (zpaqabsolute=0) and (zpaqall=0) then //partial extraction not implemented for zpaq with absolute paths and with extract all revisions
               if compose_unzpaq_cl(cl,jobcode,outname,true,act,sel)<>0 then Continue;
         if cl='' then Continue;
         if execute_cl(cl,act)=0 then
            case target of
               'peazip': execute_obj(2,outname);
               'browser': cp_open(extractfilepath(outname+tempstring),desk_env);
               'associated': execute_obj(4,outname);
               'custom': openw_obj(outname);
               'imgviewer':
                  begin
                  if fun='UNARC' then if outname[Length(outname)]<>directoryseparator then outname:=outname+DirectorySeparator;
                  preview_imgviewer(outname+tempstring,FormPeach.StringGridList.Cells[3,i],FormPeach.StringGridList.Cells[5,i]);
                  tempstring:='';
                  exit;//preview single image
                  end;
               end
         else
            pMessageWarningOK(txt_extraction_error);
         end;
   end;
end;

procedure menu_openwith(optype:ansistring);
var
   i:integer;
begin
with FormPeach do
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then
   begin
   case optype of
      'custom': openw_obj(FormPeach.EditOpenInInteractive.Caption);
      'associated': execute_obj(4,FormPeach.EditOpenInInteractive.Caption);
      end;
   exit;
   end;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      case optype of
      'custom': openw_obj(StringGridList.Cells[12,i]);
      'associated': execute_obj(4,FormPeach.StringGridList.Cells[12,i]);
      end;
end;
end;

procedure openwith_peazipnew(iscontext:integer; s:ansistring);
var
   i:integer;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if iscontext = 0 then
   begin
   execute_obj(2,s);
   end
else
   begin
   if fun='FILEBROWSER' then
      begin
      if checklistanysel<>0 then execute_obj(2,FormPeach.EditOpenInInteractive.Caption)
      else
         for i:=1 to FormPeach.StringGridList.RowCount-1 do
            if FormPeach.StringGridList.Cells[16,i]='1' then
               begin
               execute_obj(2,FormPeach.StringGridList.Cells[12,i]);
               end;
      end
   else
      execute_obj(2,extractfilepath(FormPeach.EditOpenInInteractive.Caption));
   end;
end;

procedure openappn(n:integer);
var
   i:integer;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then
   begin
   open_custedit(n,'');
   exit;
   end;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      open_custedit(n,FormPeach.StringGridList.Cells[12,i])
end;

procedure openadvappn(n:integer);
var
   i:integer;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then
   begin
   open_advcustedit(n,'');
   exit;
   end;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      open_advcustedit(n,FormPeach.StringGridList.Cells[12,i])
end;

{///////////////////////////////////////////////////////////////////////////////

subsection OPEN items from file browser

///////////////////////////////////////////////////////////////////////////////}

procedure grid_dir_open;
begin
with FormPeach do
begin
listrow:=StringgridList.Row;
if ListRow=0 then exit;
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   listdir(StringGridList.Cells[12,StringGridList.Row],false,false);
   addtohistory;
   exit;
   end;
{$ENDIF}
if StringGridList.Cells[2,StringGridList.Row]=txt_list_isfolder then
   begin
   if fun='UN7Z' then
      begin
      if (FormAdvf.CheckBoxAdvFilters.State=cbChecked) and (filterbrowser=1) then exit;
      EditUn7zaFilter.Text:=StringGridList.Cells[12,StringGridList.Row]+directoryseparator+'*';
      EditUn7zaFilterExclude.Text:=StringGridList.Cells[12,StringGridList.Row]+directoryseparator+'*'+directoryseparator+'*';
      listun7z_go;
      end;
   if fun='FILEBROWSER' then
      begin
      EditUn7zaFilter.Text:='*';
      listdir(StringGridList.Cells[12,StringGridList.Row],false,false);
      addtohistory;
      end;
   end;
end;
end;

procedure grid_obj_open;
var
   mri,i,j:integer;
   cl,jobcode,outname,s,howspecialopenstr:ansistring;
   w:widestring;
   tfparam,testsec:boolean;
begin
with FormPeach do
begin
listrow:=StringgridList.Row;
if ListRow=0 then exit;
if StringGridList.Cells[1,StringGridList.Row]='' then exit;
if checklistsel<>0 then exit;
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   listdir(StringGridList.Cells[12,StringGridList.Row],false,false);
   addtohistory;
   exit;
   end;
{$ENDIF}

if oafromgrid=true then
else
   begin

//ask confirmation to run file types with active content
testsec:=false;
case seccond of
   0: if fun<>'FILEBROWSER' then testsec:=true;
   1: if fun='FILEBROWSER' then testsec:=true;
   2: testsec:=true;
   end;
if (length(secextensions)>0) and (testsec=true) then
   for i:=0 to length(secextensions)-1 do
      if LowerCase(secextensions[i])=LowerCase(StringGridList.Cells[2,StringGridList.Row]) then
         begin
         if pMessageWarningYesNo(StringGridList.Cells[1,StringGridList.Row]+char($0D)+char($0A)+char($0D)+char($0A)+txt_10_5_sectypewarning)<>6 then exit;
         break;
         end;

//speacial "Extract everything for" cases
specialopen:=false;
if fun='UN7Z' then
   begin
   if length(specextensions)>0 then
      for i:=0 to length(specextensions)-1 do
         if LowerCase(specextensions[i])=LowerCase(StringGridList.Cells[2,StringGridList.Row]) then
            begin
            specialopen:=true;
            break;
            end;
   case LowerCase(StringGridList.Cells[2,StringGridList.Row]) of //composite extension(s) are currently pre set
      '.rar': if pos('.part',lowercase(extractfileext(ExtractFileNameWithoutExt(StringGridList.Cells[1,StringGridList.Row]))))<>0 then specialopen:=true;
      end;
   end;
case whenspecialopen of
   0: specialopen:=false;
   1: if specialopen=true then
         if pMessageInfoYesNo('('+LowerCase(StringGridList.Cells[2,StringGridList.Row])+') '+txt_7_5_specialbrowse)=7 then specialopen:=false;
   //2 always use if applicable
   end;
case howspecialopen of
   0: howspecialopenstr:='all';
   1: howspecialopenstr:='displayed';
   end;
if specialopen=true then
   if pstmpdir<>'' then cleardir(pstmpdir,true,false);

   end;

if StringGridList.Cells[2,StringGridList.Row]=txt_list_isfolder then grid_dir_open
else
   begin
   i:=StringGridList.Row;
   if i>0 then
      begin
      if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
      case fun of
         'UNLPAQ' :
         begin
         if StringGridList.Rowcount<3 then
            if compose_unlpaq_cl(cl,jobcode,outname,true,'preview')=0 then
               if execute_cl(cl,'preview')=0 then execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error)
            else
         else
            pMessageWarningOK(txt_error_partial); //never happens since LPAQ supports single file Compression
         exit;
         end;
         'UNPAQ' :
         begin
         if StringGridList.Rowcount<3 then //partial extraction not implemented, so this method is allowed only if a single object is contained (useful for .tar.*)
            if compose_unpaq_cl(cl,jobcode,outname,true,'preview')=0 then
               begin
               if outname<>'' then
                  if outname[length(outname)]<>directoryseparator then outname:=outname+directoryseparator;
               outname:=outname+StringGridList.Cells[1,1];
               if execute_cl(cl,'preview')=0 then execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error);
               end
            else
         else
            pMessageWarningOK(txt_error_partial); fun:='UNPAQ';
         exit;
         end;
         'UNZPAQ' :
         begin
         if (zpaqabsolute=0) and (zpaqall=0) {and (StringGridList.Rowcount<3) and (zpaqfull=0)} then //partial extraction not implemented for zpaq with absolute paths and with extract all revisions
            begin
            tfparam:=FormPeach.CheckBoxFolder.Checked;
            FormPeach.CheckBoxFolder.State:=cbChecked;
            if compose_unzpaq_cl(cl,jobcode,outname,true,'preview','single')=0 then
               begin
               if outname<>'' then
                  if outname[length(outname)]<>directoryseparator then outname:=outname+directoryseparator;
               //outname:=outname+StringGridList.Cells[1,1];
               if execute_cl(cl,'preview')=0 then
                  begin
                  movezpaq(cl);
                  FormPeach.CheckBoxFolder.Checked:=tfparam;
                  execute_obj(3,outname);
                  end
               else
                  pMessageWarningOK(txt_extraction_error);
               end
            else
               begin
               end;
            FormPeach.CheckBoxFolder.Checked:=tfparam;
            end
               else
                  pMessageWarningOK(txt_error_partial);
         exit;
         end;
         'UNPEA' :
         begin
         if extract_finalize_bytype(FormPeach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,false)=0 then launch_cl(cl,jobcode,outname);
         exit;
         end;
         'UNQUAD' :
         begin
         if StringGridList.Rowcount<3 then
            begin
            if compose_unquad_cl(cl,jobcode,outname,true,'preview')=0 then
               if execute_cl(cl,'preview')=0 then execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error);
            end
         else
            pMessageWarningOK(txt_error_partial); //never happens since QUAD/BALZ/BCM supports single file compression
         exit;
         end;
         'UNBROTLI' :
         begin
         if StringGridList.Rowcount<3 then
            begin
            if compose_unbrotli_cl(cl,jobcode,outname,true,'preview','single')=0 then
               if execute_cl(cl,'preview')=0 then execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error);
            end
         else
            pMessageWarningOK(txt_error_partial); //never happens since Brotli supports single file compression
         exit;
         end;
         'UNZSTD' :
         begin
         if StringGridList.Rowcount<3 then
            begin
            if compose_unzstd_cl(cl,jobcode,outname,true,'preview','single')=0 then
               if execute_cl(cl,'preview')=0 then
                  begin
                  if FileExists(outname) then execute_obj(3,outname)
                  else pMessageWarningOK(txt_extraction_error);
                  end
               else
                  pMessageWarningOK(txt_extraction_error);
            end
         else
            pMessageWarningOK(txt_error_partial); //never happens since Zstd supports single file compression
         exit;
         end;
         'UNACE' :
         begin
         if StringGridList.Rowcount<3 then //partial extraction not implemented, so this method is allowed only if a single object is contained (useful for .tar.*)
            begin
            if compose_unace_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
               begin
               if execute_cl(cl,'extandrun')=0 then execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error);
               end;
            end
         else
            pMessageWarningOK(txt_error_partial);
         exit;
         end;
        'FILEBROWSER' :
         begin
         j:=testext(StringGridList.Cells[12,StringGridList.Row]);//browse or open by type
         if forcebrowse=0 then if ((j>=100) and (j<500)) then j:=-1;//non-canonical archive types are opened with associated application rather than browsed in PeaZip as archives if this option is not set
         if (j<0) //not a PeaZip supported filetype
            or (j=503)
            or (j=502)
            or (j=501)
            or (j=500)//file types usually not handled as archives
         then cp_open(StringGridList.Cells[12,StringGridList.Row],desk_env)
         else
            begin
            {//alternative approach asking wether to run or open windows binaries, superseded by "open as archive" function
            {$IFDEF MSWINDOWS}//if it's a Windows executable, offer the possibility to run it instead of open it in PeaZip (Windows only)
            if j=500 then
            begin
            s:=StringGridList.Cells[12,StringGridList.Row];
            dodirseparators(s);
            mri:=pMessageWarningYesNoCancel(txt_dis+' '+s+' '+txt_type_exe);
            if mri=6 then
               begin
               w:=utf8decode(s);
               if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
               ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar(w), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
               exit;
               end
            else if mri<>7 then exit;
            end;
            {$ENDIF}
            }
            open_archive_fromname(StringGridList.Cells[12,StringGridList.Row]);
            end;
         exit;
         end;
        end;
      if testencrypted<0 then exit; //handles programmed extraction through 7z or arc (both supports partial extraction) if previous exit conditions are not met
      if fun='UN7Z' then
         begin
            if length(FormPeach.EditOpenIn.Caption)>=17 then
               if copy(FormPeach.EditOpenIn.Caption,1,17)='\\.\PhysicalDrive' then
                  if (lowercase(extractfileext(StringGridList.Cells[12,StringGridList.Row]))='.fat')
                  or (lowercase(extractfileext(StringGridList.Cells[12,StringGridList.Row]))='.ntfs') then
                     begin
                     pMessageInfoOK(txt_2_8_unitrecommend);
                     exit;
                     end;
            if specialopen=true then
               begin
               if compose_un7z_cl(cl,jobcode,outname,true,'ext',howspecialopenstr)=0 then
                  if execute_cl(cl,'preview')=0 then
                     execute_obj(4,outname+alt_tempstring)
                  else
                     pMessageWarningOK(txt_extraction_error);
               specialopen:=false;
               end
            else
               begin
               if compose_un7z_cl(cl,jobcode,outname,true,'preview','single')=0 then
                  if execute_cl(cl,'preview')=0 then
                     execute_obj(3,outname)
                  else
                     pMessageWarningOK(txt_extraction_error);
               end;
         exit;
         end;
      if fun='UNARC' then
         begin
            if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
               if execute_cl(cl,'preview')=0 then
                  execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error);
         exit;
         end;
      end;
   end;
end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection GRAPHIC files utilities

///////////////////////////////////////////////////////////////////////////////}

function checkimgsupported(s:ansistring):boolean;
var
   ext:ansistring;
begin
result:=false;
ext:=lowercase(extractfileext(s));
case ext of
'.bmp', '.png', '.tif', '.tiff', '.jpg', '.jpeg', '.jpe', '.jif', '.jfif', '.jfi': result:=true;
end;
end;

procedure get_new_imagefile_name(var out_param:ansistring);
var
   i:integer;
   s:ansistring;
   name_ok:boolean;
begin
if (fileexists(out_param) or checkdirexists(out_param)) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if (fileexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)) or checkdirexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param))) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i)+extractfileext(out_param);
   end;
end;

procedure browser_imgrotate(fname:ansistring; reporig:boolean; rfun:ansistring);
var
   apicture:Tpicture;
begin
if load_imagefiletopicture(apicture,fname)=0 then
   begin
   rotate_picture(apicture,rfun);
   if reporig=false then get_new_imagefile_name(fname);
   save_picturetoimagefile(apicture,fname);
   end;
end;

function checkimglisttotsel(var nsel:integer; var strsel:ansistring):integer; //number of selected graphic images, and formatted string with first 5 names
var
   rc,i:integer;
begin
checkimglisttotsel:=-1;
if updatinglistview=true then exit;
if FormPeach.StringGridList.Rowcount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=FormPeach.StringGridList.Rowcount;
for i:=1 to rc-1 do
   if (FormPeach.ListViewBrowser.Items[i-1].Selected=true) and (checkimgsupported(FormPeach.StringGridList.Cells[12,i])) then
      begin
      nsel:=nsel+1;
      case nsel of
         1: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         2: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         3: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         4: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         5: strsel:=strsel+FormPeach.ListViewBrowser.Items[i-1].Caption+char($0D)+char($0A);
         6: strsel:=strsel+'...';
         end;
      end;
if length(strsel)>2 then
   if strsel[length(strsel)]=char($0A) then
      setlength(strsel,length(strsel)-2);
if nsel>0 then checkimglisttotsel:=0;
end;

procedure frombrowser_imgrotate(rfun:ansistring);
var
   i,j,k,nsel:integer;
   s,s1,strsel,stitle,sfun,rfunl:ansistring;
   reporig:boolean;
   scheduleclip:array of array [0..18] of ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checkimglisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then
   begin
   s1:=FormPeach.EditOpenIn.Text;
   k:=0;
   setlength(scheduleclip,1);
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      begin
      if FormPeach.EditOpenIn.Text<>s1 then break;
      if (FormPeach.StringGridList.Cells[16,i]='1') and (checkimgsupported(FormPeach.StringGridList.Cells[12,i])) then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         for j:=0 to FormPeach.StringGridList.ColCount-1 do
            scheduleclip[k,j]:=FormPeach.StringGridList.Cells[j,i];
         setlength(scheduleclip,length(scheduleclip)+1);
         k:=k+1;
         end;
      end;
   rfunl:=lowercase(rfun);
   case rfunl of
      'left' : sfun:=txt_4_8_rl;
      'right' : sfun:=txt_4_8_rr;
      '180' : sfun:='180°';
      'flip' : sfun:=txt_4_8_flip;
      'mirror' : sfun:=txt_4_8_mirror;
      end;
   reporig:=true;
   if k>0 then
      case pMessageInfoYesNoCancel(txt_4_8_replace+char($0D)+char($0A)+char($0D)+char($0A)+sfun+' '+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel) of
         6: reporig:=true;
         7: reporig:=false;
         else exit;
         end;
   stitle:=FormPeach.Caption;
   enter_busy_status;
   for i:=0 to k-1 do
      begin
      if endflag=true then exit;
      s:=scheduleclip[i,12];
      FormPeach.Caption:=sfun+' ('+inttostr(i+1)+'/'+inttostr(k)+') '+s;
      browser_imgrotate(s,reporig,rfun);
      Application.ProcessMessages;
      end;
   exit_busy_status;
   FormPeach.Caption:=stitle;
   do_forcerefresh;
   setlength(scheduleclip,0);
   end;
end;

procedure browser_imgtransform(fname:ansistring; reporig:boolean; percentw,percenth:integer; w,h:int64; resfun:integer; convext:ansistring; convopt:integer);
//percentw,percenth resize in percentage, set to 0 to specify target whidth and height in pixel
//w,h target whidth and height in pixel, if 0 do not resize or fit
//resfun 0 keep size (i.e. just convert file type) 1 resize to specified size (aspect raio check is demanded to data entry form); 2 fit to screen resolution, no action if image is smaller 3 fit, but takes in account screen rotation: fit largest image dimension to largest screen dimension
//convext BMP, po_im_JPEG, PNG, TIFF, no (keep original format) Note: any transformation is applied only to writeable formats BMP, po_im_JPEG, PNG, and TIFF so other image formats are not handled
//convopt: optional parameters for the format, i.e. JPEG compression
var
   apicture:Tpicture;
   ascale,ain,aout:int64;
   wscale,hscale:int64;
   aw,ah:int64;
   dim:byte;
   fnameconv:ansistring;
begin
if load_imagefiletopicture(apicture,fname)=0 then
   begin
   ascale:=0;
   ain:=0;
   aout:=0;
   wscale:=0;
   hscale:=0;
   dim:=0;
   aw:=apicture.Width;
   ah:=apicture.Height;
   if (percentw<>0) and (percenth<>0) then
      begin
      w:=(aw*percentw) div 100;
      h:=(ah*percenth) div 100;
      if w<1 then w:=1;
      if h<1 then h:=1;
      end;
   if (w<>0) and (h<>0) then
      case resfun of
         1: resize_picture(apicture,w,h);
         2: begin
            wscale:=(w*100000000) div aw;
            hscale:=(h*100000000) div ah;
            if (wscale<100000000) or (hscale<100000000) then
               if wscale<hscale then resize_picture(apicture,w,(ah*wscale) div 100000000)
               else resize_picture(apicture,(aw*hscale) div 100000000,h);
            end;
         3: begin
            if aw>ah then ain:=aw else ain:=ah;
            if w>h then aout:=w else aout:=h;
            ascale:=(aout*100000000) div ain;
            if ain=aw then
               if aout=w then dim:=1
               else dim:=2
            else
               if aout=w then dim:=3
               else dim:=4;
            if (ascale<100000000) then //largest image dimension is larger than largest dimension of target screen resolution
            case dim of
               1: resize_picture(apicture,w,(ah*ascale) div 100000000);
               2: resize_picture(apicture,h,(ah*ascale) div 100000000);
               3: resize_picture(apicture,(aw*ascale) div 100000000,w);
               4: resize_picture(apicture,(aw*ascale) div 100000000,h);
            end;
            end;
         end;
   fnameconv:=fname;
   cutextension(fnameconv);
   if lowercase(convext)='no' then
      begin
      if reporig=false then get_new_imagefile_name(fname);
      save_picturetoimagefile(apicture,fname);
      end
   else
      begin
      fnameconv:=fname;
      cutextension(fnameconv);
      fnameconv:=fnameconv+'.'+convext;
      if reporig=false then get_new_imagefile_name(fnameconv);
      cutextension(fnameconv);
      saveconvert_picturetoimagefile(apicture,fnameconv,convext,convopt);
      end;
   end;
end;

procedure frombrowser_imgtransform(percentw,percenth:integer; w,h:int64; resfun:integer; convext:ansistring; convopt:integer);
var
   i,j,k,nsel:integer;
   s,s1,strsel,stitle,sfun:ansistring;
   reporig:boolean;
   scheduleclip:array of array [0..18] of ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checkimglisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then
   begin
   s1:=FormPeach.EditOpenIn.Text;
   k:=0;
   setlength(scheduleclip,1);
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      begin
      if FormPeach.EditOpenIn.Text<>s1 then break;
      if (FormPeach.StringGridList.Cells[16,i]='1') and (checkimgsupported(FormPeach.StringGridList.Cells[12,i])) then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         for j:=0 to FormPeach.StringGridList.ColCount-1 do
            scheduleclip[k,j]:=FormPeach.StringGridList.Cells[j,i];
         setlength(scheduleclip,length(scheduleclip)+1);
         k:=k+1;
         end;
      end;
   if lowercase(convext)<>'no' then
      sfun:=txt_2_8_convert+' > '+convext
   else
      case resfun of
         0: sfun:=txt_2_8_convert;
         1: sfun:=txt_4_8_resize;
         2: sfun:=txt_4_8_fit;
         3: sfun:=txt_4_8_fitl;
         end;
   reporig:=false; //get new name for output if converting
   if k>0 then if lowercase(convext)='no' then
      case pMessageInfoYesNoCancel(txt_4_8_replace+char($0D)+char($0A)+char($0D)+char($0A)+sfun+' '+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel) of
         6: reporig:=true;
         7: reporig:=false;
         else exit;
         end;
   stitle:=FormPeach.Caption;
   enter_busy_status;
   for i:=0 to k-1 do
      begin
      if endflag=true then exit;
      s:=scheduleclip[i,12];
      FormPeach.Caption:=sfun+' ('+inttostr(i+1)+'/'+inttostr(k)+') '+s;
      browser_imgtransform(s,reporig,percentw,percenth,w,h,resfun,convext,convopt);
      Application.ProcessMessages;
      end;
   exit_busy_status;
   FormPeach.Caption:=stitle;
   do_forcerefresh;
   setlength(scheduleclip,0);
   end;
end;

procedure prepareFormImgRes;
var
   nsel:integer;
   strsel:ansistring;
begin
with FormImgRes do
begin
//set text
FormImgRes.Caption:=txt_4_8_t;
ComboBoxAction.Clear;
ComboBoxAction.Items.Add(txt_4_8_noresize);
ComboBoxAction.Items.Add(txt_4_8_resize);
ComboBoxAction.Items.Add(txt_4_8_fit);
ComboBoxAction.Items.Add(txt_4_8_fitl);
LabelW.Caption:=txt_4_8_w;
LabelH.Caption:=txt_4_8_h;
CheckBoxAspectRatio.Caption:=txt_4_8_aspect;
LabelConvert.Caption:=txt_2_8_convert;
ComboBoxConvert.Clear;
ComboBoxConvert.Items.Add(txt_no);
ComboBoxConvert.Items.Add('BMP');
ComboBoxConvert.Items.Add('ICO');
ComboBoxConvert.Items.Add('JPEG');
ComboBoxConvert.Items.Add('PNG');
ComboBoxConvert.Items.Add('TIFF');
ComboBoxConvert.Items.Add('PPM');
ComboBoxConvert.Items.Add('XPM');
ButtonPanelImgRes.OKButton.Caption:=txt_2_7_ok;
ButtonPanelImgRes.CancelButton.Caption:=txt_2_7_cancel;
ImageInfoImgRes.Picture.Bitmap:=Binfo;
ImageInfoImgRes.Hint:='';
if checkimglisttotsel(nsel,strsel)=0 then ImageInfoImgRes.Hint:=inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel;
if ImageInfoImgRes.Hint='' then ImageInfoImgRes.Visible:=false else ImageInfoImgRes.Visible:=true;
//set context dependent values
ComboBoxAction.ItemIndex:=simgfun;
UnitImgRes.setformaspect('action');
if simgper=1 then CheckBoxPercent.Checked:=true else CheckBoxPercent.Checked:=false;
UnitImgRes.setformaspect('percent');
if CheckBoxPercent.Checked=true then
   begin
   SpinEditW.Value:=simgw;
   SpinEditH.Value:=simgh;
   end
else
   begin
   SpinEditW.Value:=UnitImgRes.origw;
   SpinEditH.Value:=UnitImgRes.origh;
   end;
if simgasp=1 then CheckBoxAspectRatio.Checked:=true else CheckBoxAspectRatio.Checked:=false;
ComboBoxConvert.ItemIndex:=simgconv;
SpinEditJ.Value:=simgj;
UnitImgRes.setformaspect('convert');
end;
end;

procedure do_resize;
var
   percentw,percenth,w,h,convopt,resfun,i:integer;
   convext:ansistring;
   apicture:TPicture;
begin
percentw:=0;
percenth:=0;
w:=0;
h:=0;
convopt:=0;
resfun:=0;
convext:='no';
UnitImgRes.origw:=simgw;
UnitImgRes.origh:=simgh;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if (FormPeach.StringGridList.Cells[16,i]='1') and (checkimgsupported(FormPeach.StringGridList.Cells[12,i])) then
      if load_imagefiletopicture(apicture,FormPeach.StringGridList.Cells[12,i])=0 then
         begin
         UnitImgRes.origw:=apicture.Bitmap.Width;
         UnitImgRes.origh:=apicture.Bitmap.Height;
         try apicture.Free; except end;
         break;
         end;
with FormImgRes do
begin
prepareFormImgRes;
FormImgRes.Showmodal;
if FormImgRes.ModalResult=1 then
   begin
   resfun:=ComboBoxAction.ItemIndex;
   if CheckBoxPercent.Checked=true then
      begin
      percentw:=SpinEditW.Value;
      percenth:=SpinEditH.Value;
      w:=0;
      h:=0;
      end
   else
      begin
      percentw:=0;
      percenth:=0;
      w:=SpinEditW.Value;
      h:=SpinEditH.Value;
      end;
   convext:=ComboBoxConvert.Caption;
   convopt:=SpinEditJ.Value;
   frombrowser_imgtransform(percentw,percenth,w,h,resfun,convext,convopt);
   //save accepted changes
   simgfun:=ComboBoxAction.ItemIndex;
   simgw:=SpinEditW.Value;
   simgh:=SpinEditH.Value;
   if (CheckBoxPercent.Checked = true) then simgper:=1 else simgper:=0;
   if (CheckBoxAspectRatio.Checked = true) then simgasp:=1 else simgasp:=0;
   simgconv:=ComboBoxConvert.ItemIndex;
   simgj:=SpinEditJ.Value;
   end
else
   begin
   end;
end;
end;

procedure browser_imgcrop(fname:ansistring; reporig:boolean; ct,cb,cl,cr:integer; percent:boolean);
var
   apicture:Tpicture;
   aw,ah:int64;
begin
if load_imagefiletopicture(apicture,fname)=0 then
   begin
   aw:=apicture.Width;
   ah:=apicture.Height;
   if percent=true then
      begin
      ct:=(ah*ct) div 100;
      cb:=(ah*cb) div 100;
      cl:=(aw*cl) div 100;
      cr:=(aw*cr) div 100;
      end;
   if (ct+cb>ah) or (cl+cr>aw) then exit;
   crop_picture(apicture,ct,cb,cl,cr);
   if reporig=false then get_new_imagefile_name(fname);
   save_picturetoimagefile(apicture,fname);
   end;
end;

procedure frombrowser_imgcrop(ct,cb,cl,cr:integer; percent:boolean);
var
   i,j,k,nsel:integer;
   s,s1,strsel,stitle,sfun:ansistring;
   reporig:boolean;
   scheduleclip:array of array [0..18] of ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checkimglisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then
   begin
   s1:=FormPeach.EditOpenIn.Text;
   k:=0;
   setlength(scheduleclip,1);
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      begin
      if FormPeach.EditOpenIn.Text<>s1 then break;
      if (FormPeach.StringGridList.Cells[16,i]='1') and (checkimgsupported(FormPeach.StringGridList.Cells[12,i])) then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         for j:=0 to FormPeach.StringGridList.ColCount-1 do
            scheduleclip[k,j]:=FormPeach.StringGridList.Cells[j,i];
         setlength(scheduleclip,length(scheduleclip)+1);
         k:=k+1;
         end;
      end;
   sfun:=txt_4_8_crop;
   reporig:=false; //get new name for output if converting
   if k>0 then
      case pMessageInfoYesNoCancel(txt_4_8_replace+char($0D)+char($0A)+char($0D)+char($0A)+sfun+' '+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel) of
         6: reporig:=true;
         7: reporig:=false;
         else exit;
         end;
   stitle:=FormPeach.Caption;
   enter_busy_status;
   for i:=0 to k-1 do
      begin
      if endflag=true then exit;
      s:=scheduleclip[i,12];
      FormPeach.Caption:=sfun+' ('+inttostr(i+1)+'/'+inttostr(k)+') '+s;
      browser_imgcrop(s,reporig,ct,cb,cl,cr,percent);
      Application.ProcessMessages;
      end;
   exit_busy_status;
   FormPeach.Caption:=stitle;
   do_forcerefresh;
   setlength(scheduleclip,0);
   end;
end;

procedure prepareFormCrop;
var
   nsel:integer;
   strsel:ansistring;
begin
with FormImgCrop do
begin
//set text
FormImgCrop.Caption:=txt_4_8_crop;
LabelL.Caption:=txt_4_5_l;
LabelR.Caption:=txt_4_5_r;
LabelT.Caption:=txt_4_5_t;
LabelB.Caption:=txt_4_5_b;
ButtonPanelImgCrop.OKButton.Caption:=txt_2_7_ok;
ButtonPanelImgCrop.CancelButton.Caption:=txt_2_7_cancel;
ImageInfoImgCrop.Picture.Bitmap:=Binfo;
ImageInfoImgCrop.Hint:='';
if checkimglisttotsel(nsel,strsel)=0 then ImageInfoImgCrop.Hint:=inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel;
if ImageInfoImgCrop.Hint='' then ImageInfoImgCrop.Visible:=false else ImageInfoImgCrop.Visible:=true;
//set context dependent values
if simgpercent=1 then CheckBoxPercent.Checked:=true else CheckBoxPercent.Checked:=false;
SpinEditT.Value:=simgt;
SpinEditB.Value:=simgb;
SpinEditL.Value:=simgl;
SpinEditR.Value:=simgr;
end;
end;

procedure do_crop;
var
   ct,cb,cl,cr:integer;
   percent:boolean;
begin
cl:=0;
cr:=0;
ct:=0;
cb:=0;
percent:=false;
with FormImgCrop do
begin
prepareFormCrop;
FormImgCrop.Showmodal;
if FormImgCrop.ModalResult=1 then
   begin
   cl:=SpinEditL.Value;
   cr:=SpinEditR.Value;
   ct:=SpinEditT.Value;
   cb:=SpinEditB.Value;
   percent:=CheckBoxPercent.Checked;
   frombrowser_imgcrop(ct,cb,cl,cr,percent);
   //save accepted changes
   if (CheckBoxPercent.Checked = true) then simgpercent:=1 else simgpercent:=0;
   simgt:=SpinEditT.Value;
   simgb:=SpinEditB.Value;
   simgl:=SpinEditL.Value;
   simgr:=SpinEditR.Value;
   end
else
   begin
   end;
end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection TAB BAR of the file browser

///////////////////////////////////////////////////////////////////////////////}

function gettabname(nrow:integer):ansistring;
var
   s:ansistring;
begin
with FormPeach do
begin
if extractfilename(StringGridSessionHistory.Cells[2,nrow])='' then //dir
   begin
   s:=StringGridSessionHistory.Cells[2,nrow];
   {$IFDEF MSWINDOWS}
   if (length(s)=3) and (pos(':',s)=2) then //disk
      begin
      s:=copy(s,1,2);
      result:='<'+s+'>';
      exit;
      end;
   {$ENDIF}
   if StringGridSessionHistory.Cells[3,nrow]='*' then //dir
      begin
      if length(s)>1 then s:=copy(s,1,length(s)-1);
      result:=extractfilename(s);
      end
   else //filter
      begin
      s:=StringGridSessionHistory.Cells[3,nrow];
      result:=s;
      end;
   end
else //file
   begin
   if StringGridSessionHistory.Cells[3,nrow]='*' then //archive root
      begin
      s:=StringGridSessionHistory.Cells[2,nrow];
      result:=extractfilename(s);
      end
   else //archive
      begin
      s:=StringGridSessionHistory.Cells[3,nrow];
      if extractfilename(s)='*' then //dir
         begin
         if length(s)>2 then s:=copy(s,1,length(s)-2);
         if extractfilename(s)='' then result:=s else result:=extractfilename(s);
         end
      else //filter
         result:=(s);
      end;
   end;
end;
result:='<'+result+'>';
end;

function cleartabname(s:ansistring):ansistring;
begin
result:=s;
if length(s)>2 then
   if (s[1]='<') and (s[length(s)]='>') then result:=copy(s,2,length(s)-2);
end;

procedure save_tabs;
var
   i: integer;
begin
if restoretabbar=0 then exit;
with FormPeach do
begin
try
assignfile(tabsf,(confpath+'tabs.txt'));
rewrite(tabsf);
write_header(tabsf);

for i:=0 to TabBar.Sections.Count-1 do
   if TabBar.Sections.Items[i].ID=atabid then
      begin
      writeln(tabsf,inttostr(i));//active tab
      break;
      end;

for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
for i:=0 to TabBar.Sections.Count-2 do //exclude "add tab" tab
   begin
   if FormPeach.StringGridTabs.Cells[1,TabBar.Sections.Items[i].ID]=txt_list_browsing then writeln(tabsf,'0')
   else
      if FormPeach.StringGridTabs.Cells[1,TabBar.Sections.Items[i].ID]=txt_list_flat then writeln(tabsf,'1')
      else
         if FormPeach.StringGridTabs.Cells[1,TabBar.Sections.Items[i].ID]=txt_list_found then writeln(tabsf,'2')
         else writeln(tabsf,'0');
   writeln(tabsf,FormPeach.StringGridTabs.Cells[2,TabBar.Sections.Items[i].ID]);
   writeln(tabsf,FormPeach.StringGridTabs.Cells[3,TabBar.Sections.Items[i].ID]);
   writeln(tabsf,FormPeach.StringGridTabs.Cells[4,TabBar.Sections.Items[i].ID]);
   end;
CloseFile(tabsf);
except
   try
   CloseFile(tabsf);
   except
   end;
end;
end;
end;

procedure sortplustab;
var
   i:integer;
begin
with FormPeach do
begin
for i:=0 to TabBar.Sections.Count-1 do
   if TabBar.Sections.Items[i].ID=0 then
      begin
      TabBar.Sections.Items[i].Index:=TabBar.Sections.Count-1;
      break;
      end;
end;
end;

procedure addptab;
var
   selptab,i:integer;
begin
with FormPeach do
begin
if TabBar.Sections.Count>MAXTABN then exit;//artificial limit
TabBar.Sections.Add;
TabBar.Sections.Items[TabBar.Sections.Count-1].MinWidth:=barheight+barheight div 2;
TabBar.Sections.Items[TabBar.Sections.Count-1].MaxWidth:=barheight*10;
TabBar.Sections.Items[TabBar.Sections.Count-1].Width:=barheight*6;
if ptabid=atabid then //clone active tab
   begin
   for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
   selptab:=TabBar.Sections.Count-1;
   atabid:=TabBar.Sections.Items[selptab].ID;
   TabBar.Sections.Items[TabBar.Sections.Count-1].Text:=gettabname(StringGridSessionHistory.Row);
   TabBar.Sections.Items[TabBar.Sections.Count-1].ImageIndex:=drawtabicon(FormPeach.StringGridSessionHistory.Row);
   StringGridTabs.RowCount:=StringGridTabs.RowCount+1;
   StringGridTabs.Rows[StringGridTabs.RowCount-1]:=StringGridSessionHistory.Rows[StringGridSessionHistory.Row];
   end
else //set selected tab active and clone it
   begin
   atabid:=ptabid;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[atabid];
   StringGridSessionHistory.Row:=StringGridSessionHistory.RowCount-1;
   browsehistory;
   for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
   selptab:=TabBar.Sections.Count-1;
   atabid:=TabBar.Sections.Items[selptab].ID;
   TabBar.Sections.Items[TabBar.Sections.Count-1].Text:=gettabname(StringGridSessionHistory.Row);
   TabBar.Sections.Items[TabBar.Sections.Count-1].ImageIndex:=drawtabicon(FormPeach.StringGridSessionHistory.Row);
   StringGridTabs.RowCount:=StringGridTabs.RowCount+1;
   StringGridTabs.Rows[StringGridTabs.RowCount-1]:=StringGridSessionHistory.Rows[StringGridSessionHistory.Row];
   end
end;
end;

procedure load_tabs;
var
   s:ansistring;
   rc,i,acttab:integer;
begin
if restoretabbar=0 then exit;
with FormPeach do
begin
try
starttaberror:=false;
assignfile(tabsf,(confpath+'tabs.txt'));
filemode:=0;
reset(tabsf);
read_header(tabsf,filemode);
readln(tabsf,s);//active tab
acttab:=strtoint(s);
if eof(tabsf)=false then
   repeat
   readln(tabsf,s);
   if (s=' ') or (s='') then break;
   rc:=FormPeach.StringGridTabs.Rowcount+1;
   if rc>MAXTABN then break;
   FormPeach.StringGridTabs.RowCount:=rc;
   i:=strtoint(s);
   case i of
      0: s:=txt_list_browsing;
      1: s:=txt_list_flat;
      2: s:=txt_list_found;
      else s:=txt_list_browsing;
      end;
   FormPeach.StringGridTabs.Cells[1,rc-1]:=s;
   readln(tabsf,s);
   FormPeach.StringGridTabs.Cells[2,rc-1]:=s;
   readln(tabsf,s);
   FormPeach.StringGridTabs.Cells[3,rc-1]:=s;
   readln(tabsf,s);
   FormPeach.StringGridTabs.Cells[4,rc-1]:=s;
   TabBar.Sections.Add;
   TabBar.Sections.Items[TabBar.Sections.Count-1].MinWidth:=barheight+barheight div 2;
   TabBar.Sections.Items[TabBar.Sections.Count-1].MaxWidth:=barheight*10;
   TabBar.Sections.Items[TabBar.Sections.Count-1].Width:=barheight*6;
   StringGridSessionHistory.RowCount:=2;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[rc-1];
   StringGridSessionHistory.Row:=StringGridSessionHistory.RowCount-1;
   TabBar.Sections.Items[rc-1].Text:=gettabname(StringGridSessionHistory.Row);
   TabBar.Sections.Items[rc-1].ImageIndex:=drawtabicon(FormPeach.StringGridSessionHistory.Row);
   until eof(tabsf);
CloseFile(tabsf);
sortplustab;
//apply active tab
for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
atabid:=TabBar.Sections.Items[acttab].ID;
TabBar.Sections.Items[acttab].Text:='<'+TabBar.Sections.Items[acttab].Text+'>';
StringGridSessionHistory.RowCount:=2;
StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[atabid];
browsehistory;

if (status0='') or (status0=caption_release) then starttaberror:=true;
except
   try
   CloseFile(tabsf);
   except
   end;
   starttaberror:=true;
end;
end;
end;

procedure settabbar(i:integer);
begin
ptabbar:=i;
case i of
   0: begin
      FormPeach.PanelTabBar.height:=0;
      FormPeach.PanelTabBar.visible:=false;
      FormPeach.mtabs.Checked:=false;
      FormPeach.pmhtabs.Checked:=false;
      FormPeach.pmtabsm.Checked:=false;
      FormPeach.pmtab.Checked:=false;
      FormPeach.mtab.Checked:=false;
      end;
   1: begin
      FormPeach.PanelTabBar.height:=tabheight-4;
      FormPeach.PanelTabBar.visible:=true;
      FormPeach.mtabs.Checked:=true;
      FormPeach.pmhtabs.Checked:=true;
      FormPeach.pmtabsm.Checked:=true;
      FormPeach.pmtab.Checked:=true;
      FormPeach.mtab.Checked:=true;
      if FormPeach.TabBar.Sections.Count=1 then
         begin
         ptabid:=atabid;
         addptab;
         sortplustab;
         end;
      end;
   end;
end;

procedure do_closetab;
var
   i:integer;
begin
with FormPeach do
begin
if TabBar.Sections.Count<=2 then
   begin
   settabbar(0);
   exit;
   end;
for i:=0 to TabBar.Sections.Count-1 do
   begin
   if TabBar.Sections.Items[i].ID=ptabid then
      begin
      TabBar.Sections.Delete(i);
      break;
      end;
   end;
StringGridTabsLast.Rows[0]:=StringGridTabs.Rows[ptabid];
if ptabid=atabid then //deleted active tab, last tab at right becomes active
   begin
   for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
   atabid:=TabBar.Sections.Items[TabBar.Sections.Count-2].ID;
   TabBar.Sections.Items[TabBar.Sections.Count-2].Text:='<'+TabBar.Sections.Items[TabBar.Sections.Count-2].Text+'>';
   StringGridSessionHistory.RowCount:=2;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[atabid];
   browsehistory;
   end
else //deleted inactive tab, no further action required
   begin
   end;
end;
end;

procedure closeallothertabs;
var
   i:integer;
begin
with FormPeach do begin
if TabBar.Sections.Count<=2 then exit;
i:=0;
repeat
if (TabBar.Sections.Items[i].ID<>ptabid) and (TabBar.Sections.Items[i].ID<>0) then
   TabBar.Sections.Delete(i)
else
   i:=i+1;
until (i>=TabBar.Sections.Count);
if ptabid=atabid then //kept active tab, no further action needed
   begin
   end
else //kept inactive tab, make it active
   begin
   atabid:=TabBar.Sections.Items[0].ID;
   TabBar.Sections.Items[0].Text:='<'+TabBar.Sections.Items[0].Text+'>';
   StringGridSessionHistory.RowCount:=2;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[atabid];
   browsehistory;
   end;
end;
end;

procedure popuptabmenu;
var p:tpoint;
begin
if browserbusy=true then exit;
p.x:=FormPeach.PanelListRoot.left;
p.y:=FormPeach.PanelListBar.height+FormPeach.PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then p.y:=p.y-FormPeach.PanelBarOpen.height;
if swaptab=true then p.y:=p.y-FormPeach.PanelTabBar.height;
p:=FormPeach.clienttoscreen(p);
FormPeach.pmbreadcrumb.PopUp(p.x,p.y);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection STATUS BAR of the file browser

///////////////////////////////////////////////////////////////////////////////}

procedure togglestatusbar;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
case lastbar of
1: showbar('statusbar');
0: showbar('bookmarks');
2: showbar('recent');
3: showbar('sessionrecent');
4: showbar('clip');
5: showbar('none');
end;
end;

procedure shownavbar;
begin
with FormPeach do
begin
if navbarhidden=true then splitter2size:=180;
SplitterSide.Left:=(splitter2size*qscale) div 100;
SplitterSide.Width:=1;
SplitterSide.enabled:=true;
navbarhidden:=false;
end;
end;

procedure hidenavbar;
begin
with FormPeach do
begin
splitter2size:=(Panelside.Width*100) div qscale;
SplitterSide.Left:=(splitter2size*qscale) div 100;
SplitterSide.Width:=0;
SplitterSide.enabled:=true;
navbarhidden:=true;
end;
end;

procedure setnav(i:integer);
begin
navbar:=i;
psidebar:=0;
FormPeach.msidebar.Checked:=false;
FormPeach.mshowsidebar.Checked:=false;
FormPeach.Panelside.Width:=0;
FormPeach.Panelside.visible:=false;
FormPeach.MenuItemOrganizeNavbar.Checked:=true;
FormPeach.mshownavbar.Checked:=true;
FormPeach.pmsnav.Checked:=false;
FormPeach.pmstree.Checked:=false;
FormPeach.pmscompact.Checked:=false;
FormPeach.pmsnone.Checked:=false;
FormPeach.TreeViewNav.Visible:=false;
FormPeach.ShellTreeViewNav.Visible:=false;
FormPeach.TreeViewTmp.Visible:=false;
case i of
   0: begin
      shownavbar;
      FormPeach.TreeViewNav.Visible:=true;
      FormPeach.pmsnav.Checked:=true;
      end;
   1: begin
      shownavbar;
      FormPeach.ShellTreeViewNav.Visible:=true;
      FormPeach.pmstree.Checked:=true;
      end;
   2: begin
      FormPeach.pmscompact.Checked:=true;
      psidebar:=1;
      FormPeach.msidebar.Checked:=true;
      FormPeach.mshowsidebar.Checked:=true;
      FormPeach.Panelside.Width:=FormPeach.BtnPassword.Width+16;
      FormPeach.Panelside.visible:=true;
      hidenavbar;
      end;
   3: begin
      hidenavbar;
      FormPeach.MenuItemOrganizeNavbar.Checked:=false;
      FormPeach.mshownavbar.Checked:=false;
      FormPeach.pmsnone.Checked:=true;
      end;
   end;
end;

procedure togglenavbar;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
case navbar of
   0: setnav(1);
   1: setnav(2);
   2: setnav(3);
   3: setnav(0);
   end;
end;

procedure toggleclip;
begin
if lastbar=5 then showbar('statusbar') else showbar('clip');
end;

procedure settoolstyle(n:integer);
begin
FormPeach.pmtoollarge.Checked:=false;
FormPeach.pmtoolmedium.Checked:=false;
FormPeach.pmtoolsmall.Checked:=false;
FormPeach.pmtoolcompact.Checked:=false;
FormPeach.pmtoolnone.Checked:=false;
case n of
   1: FormPeach.pmtoollarge.Checked:=true;
   2: FormPeach.pmtoolmedium.Checked:=true;
   3: FormPeach.pmtoolsmall.Checked:=true;
   4: FormPeach.pmtoolcompact.Checked:=true;
   5: FormPeach.pmtoolnone.Checked:=true;
   end;
ntoolstyle:=n;
case n of
   1:
   begin
   lsize:=1;
   imgloaded:=false;
   load_icons;
   toolsize:=0;
   end;
   2:
   begin
   lsize:=0;
   imgloaded:=false;
   load_icons;
   toolsize:=0;
   end;
   3: toolsize:=4;
   4: toolsize:=7;
   5: toolsize:=7;
   end;
ptoolsize:=toolsize;
settoolbar;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection TREEVIEW controls

///////////////////////////////////////////////////////////////////////////////}

procedure getfullnodepath(TargetNode:ttreenode; var s:ansistring; const s1:ansistring);
var
   rfound:boolean;
begin
rfound:=false;
s:='';
repeat
if (TargetNode.parent<>nil) and (TargetNode.parent.text<>txt_mypc) then
   begin
   if TargetNode.parent.text[length(TargetNode.parent.text)]<>directoryseparator then
      s:=TargetNode.parent.text+directoryseparator+s
   else
      s:=TargetNode.parent.text+s;
   TargetNode:=TargetNode.parent;
   end
else rfound:=true;
until rfound=true;
if s<>'' then
   if s[length(s)]<>directoryseparator then
      s:=s+s1+directoryseparator
   else
      s:=s+s1
else
   s:=s+s1;
s:=s+directoryseparator;
{$IFNDEF MSWINDOWS}s:=directoryseparator+s;{$ENDIF}
end;

procedure populatetree;
var
   s:ansistring;

   {procedure populate_folders; //possible implementation: clone the shelltree in the treeview (some problems in displaying the standard expected behaviour for shelltree events, and in displaying the expected part of the tree)
   var
      n:integer;
      bottompath, selectedpath:ansistring;
      lnode,l1node :TTreeNode;
   begin
   with FormPeach do
   begin
   with treeview1.Items.Add(nil,txt_mypc) do
      begin
      Selected:=true;
      ImageIndex:=32;
      SelectedIndex:=32;
      end;
      for n:=0 to shelltreeview1.Items.TopLvlCount-1 do
        CopySubtree(shelltreeview1.Items.TopLvlItems[n], treeview1, treeview1.selected);
   if expandroot=1 then
      begin
      TreeView1.Selected.Expand(true);//(false);
      TreeViewSetTextPath(treeview1,treeview1.selected.GetFirstChild,editopenin1.caption);
      TreeView1.TopItem:=TreeView1.Selected.Parent;//set parent of selected item as top node to give room to siblings of selected item
      getfullnodepath(TreeView1.BottomItem,bottompath,TreeView1.BottomItem.Text);
      getfullnodepath(TreeView1.Selected,selectedpath,TreeView1.Selected.Text);
      if pos(selectedpath,bottompath)<>0 then TreeView1.TopItem:=TreeView1.Selected
      //if bottom node is a child of selected item, set selected item instead of its parent as top node in order to give more room to selected item's children
      else
         if ansicomparestr(selectedpath,bottompath)>0 then TreeView1.TopItem:=TreeView1.Selected;
         //if bottom node is sibling of the selected item and its name is before the name of the selected item, set selected item as top node in order to make it visible to the user
      end
   else
      treeview1.selected:=nil;
   end;}

procedure populate_fs_windows;
begin
with FormPeach do
begin
with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_mypc) do
   begin
   Selected:=true;
   ImageIndex:=32;
   SelectedIndex:=32;
   end;
if pmjd1.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[1]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[1]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd2.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[2]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[2]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd3.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[3]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[3]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd4.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[4]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[4]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd5.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[5]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[5]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd6.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[6]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[6]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd7.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[7]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[7]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd8.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[8]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[8]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd9.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[9]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[9]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd10.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[10]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[10]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd11.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[11]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[11]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd12.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[12]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[12]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd13.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[13]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[13]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd14.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[14]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[14]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd15.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[15]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[15]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd16.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[16]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[16]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd17.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[17]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[17]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd18.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[18]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[18]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd19.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[19]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[19]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd20.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[20]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[20]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd21.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[21]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[21]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd22.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[22]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[22]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd23.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[23]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[23]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd24.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[24]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[24]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd25.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[25]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[25]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd26.visible=true then
   begin
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,devname[26]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[26]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if expandroot=1 then TreeViewNav.Selected.Expand(false);
with TreeViewNav.Items.Add(TreeViewNav.selected,txt_2_9_home) do
   begin
   ImageIndex:=42;
   SelectedIndex:=42;
   end;
with TreeViewNav.Items.Add(TreeViewNav.selected,txt_desktop) do
   begin
   ImageIndex:=36;
   SelectedIndex:=36;
   end;
if usr_downloads<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,txt_3_1_downloads) do
      begin
      ImageIndex:=43;
      SelectedIndex:=43;
      end;
with TreeViewNav.Items.Add(TreeViewNav.selected,txt_2_4_documents) do
   begin
   ImageIndex:=2;
   SelectedIndex:=2;
   end;
if usr_music<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,txt_5_0_music) do
      begin
      ImageIndex:=12;
      SelectedIndex:=12;
      end;
if usr_pictures<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,txt_5_0_pictures) do
      begin
      ImageIndex:=17;
      SelectedIndex:=17;
      end;
if usr_videos<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,txt_5_0_videos) do
      begin
      ImageIndex:=15;
      SelectedIndex:=15;
      end;
if shared_dropbox<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,'Dropbox') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_googledrive<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,'Google Drive') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_onedrive<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,'OneDrive') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_sharepointwork<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,'Sharepoint Workspaces') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_yandex<>'' then
   with TreeViewNav.Items.Add(TreeViewNav.selected,'Yandex Disk') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
with TreeViewNav.Items.Add(TreeViewNav.selected,'...') do
   begin
   Selected:=true;
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
if applebk<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'Apple') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if users_root<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_4_6_users) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if public_home<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_2_9_home+' - '+txt_2_9_public) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if public_documents<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_2_4_documents+' - '+txt_2_9_public) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_list_history) do
   begin
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
if usr_searches<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_3_1_src) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if usr_libraries<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_3_1_lib) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if expandmore=1 then TreeViewNav.Selected.Expand(false);
TreeViewNav.Selected:=TreeViewNav.Selected.Parent;
if expandfs=1 then TreeViewNav.Selected.Expand(false) else TreeViewNav.Selected.Collapse(true);
end;
end;

procedure populate_fs_nonwindows;
begin
{$IFNDEF MSWINDOWS}
with FormPeach do
begin
with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_mypc) do
   begin
   ImageIndex:=32;
   SelectedIndex:=32;
   end;
with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_2_9_home) do
   begin
   ImageIndex:=42;
   SelectedIndex:=42;
   end;
with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_desktop) do
   begin
   ImageIndex:=36;
   SelectedIndex:=36;
   end;
if usr_downloads<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_3_1_downloads) do
      begin
      ImageIndex:=43;
      SelectedIndex:=43;
      end;
if usr_documents<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_2_4_documents) do
      begin
      ImageIndex:=2;
      SelectedIndex:=2;
      end;
if usr_music<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_5_0_music) do
      begin
      ImageIndex:=12;
      SelectedIndex:=12;
      end;
if usr_pictures<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_5_0_pictures) do
      begin
      ImageIndex:=17;
      SelectedIndex:=17;
      end;
if usr_videos<>'' then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_5_0_videos) do
      begin
      ImageIndex:=15;
      SelectedIndex:=15;
      end;
{$IFNDEF DARWIN}
if checkempty_dir('/media/') = false then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'media') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
if checkempty_dir('/mnt/') = false then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'mnt') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
if (checkempty_dir('/run/media/') = false) and (checkempty_dir('/media/') = true) then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'run/media') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
if (checkempty_dir('/var/run/media/') = false) and (checkempty_dir('/run/media/') = true) and (checkempty_dir('/media/') = true) then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'var/run/media') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
if checkempty_dir('/run/user/') = false then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'MTP ($UID/gvfs)') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
if (checkempty_dir('/var/run/user/') = false) and (checkempty_dir('/run/user/') = true) then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'var/ MTP ($UID/gvfs)') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
{$ELSE}
with TreeViewNav.Items.AddChild(TreeViewNav.selected,'Volumes') do
   begin
   ImageIndex:=11;
   SelectedIndex:=11;
   end;
with TreeViewNav.Items.AddChild(TreeViewNav.selected,'Applications') do
   begin
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
with TreeViewNav.Items.AddChild(TreeViewNav.selected,'System Applications') do
   begin
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
if checkempty_dir(home_path+'Library/Mobile Documents/') = false then
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,'Mobile Documents') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
{$ENDIF}
if expandfs=1 then TreeViewNav.Selected.Expand(false) else TreeViewNav.Selected.Collapse(true);
end;
{$ENDIF}
end;

procedure populate_bookmarks;
begin
with FormPeach do
begin
with TreeViewNav.Items.Add(nil,txt_bookmarks) do
   begin
   Selected:=true;
   ImageIndex:=30;
   SelectedIndex:=30;
   end;
if mb1.visible=true then
   begin
   s:=mb1.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,1);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb2.visible=true then
   begin
   s:=mb2.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,2);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb3.visible=true then
   begin
   s:=mb3.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,3);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb4.visible=true then
   begin
   s:=mb4.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,4);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb5.visible=true then
   begin
   s:=mb5.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,5);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb6.visible=true then
   begin
   s:=mb6.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,6);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb7.visible=true then
   begin
   s:=mb7.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,7);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb8.visible=true then
   begin
   s:=mb8.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,8);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb9.visible=true then
   begin
   s:=mb9.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,9);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb10.visible=true then
   begin
   s:=mb10.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,10);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb11.visible=true then
   begin
   s:=mb11.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,11);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb12.visible=true then
   begin
   s:=mb12.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,12);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb13.visible=true then
   begin
   s:=mb13.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,13);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb14.visible=true then
   begin
   s:=mb14.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,14);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb15.visible=true then
   begin
   s:=mb15.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,15);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb16.visible=true then
   begin
   s:=mb16.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,16);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb17.visible=true then
   begin
   s:=mb17.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,17);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb18.visible=true then
   begin
   s:=mb18.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,18);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb19.visible=true then
   begin
   s:=mb19.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,19);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb20.visible=true then
   begin
   s:=mb20.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,20);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb21.visible=true then
   begin
   s:=mb21.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,21);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb22.visible=true then
   begin
   s:=mb22.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,22);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mb23.visible=true then
   begin
   s:=mb23.caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,23);
      SelectedIndex:=ImageIndex;
      end;
   end;
if expandbook=1 then TreeViewNav.Selected.Expand(true);
end;
end;

procedure populate_history;
var
   j:integer;
begin
with FormPeach do
begin
j:=0;
with TreeViewNav.Items.Add(nil,txt_list_history) do
   begin
   Selected:=true;
   ImageIndex:=37;
   SelectedIndex:=37;
   end;

if mRecent1f.visible=true then
   begin
   s:=mRecent1f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent2f.visible=true then
   begin
   s:=mRecent2f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent3f.visible=true then
   begin
   s:=mRecent3f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent4f.visible=true then
   begin
   s:=mRecent4f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent5f.visible=true then
   begin
   s:=mRecent5f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent6f.visible=true then
   begin
   s:=mRecent6f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent7f.visible=true then
   begin
   s:=mRecent7f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent8f.visible=true then
   begin
   s:=mRecent8f.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;

if mRecent1.visible=true then
   begin
   s:=mRecent1.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent2.visible=true then
   begin
   s:=mRecent2.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent3.visible=true then
   begin
   s:=mRecent3.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent4.visible=true then
   begin
   s:=mRecent4.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent5.visible=true then
   begin
   s:=mRecent5.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent6.visible=true then
   begin
   s:=mRecent6.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent7.visible=true then
   begin
   s:=mRecent7.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if mRecent8.visible=true then
   begin
   s:=mRecent8.Caption;
   if length(s)>1 then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   if extractfilename(s)<>'' then s:=extractfilename(s);
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if expandhistory=1 then TreeViewNav.Selected.Expand(true);
end;
end;

procedure populate_open;
var
    i,n:integer;
begin
with FormPeach do
begin
with TreeViewNav.Items.Add(nil,txt_open) do
   begin
   Selected:=true;
   ImageIndex:=39;
   SelectedIndex:=39;
   end;

   populatetreefunctions;
   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_4_8_fun) do
      begin
      Selected:=true;
      ImageIndex:=40;
      SelectedIndex:=40;
      end;
   for i:=0 to TreeViewTmp.Items.Count-1 do
     with TreeViewNav.Items.AddChild(TreeViewNav.selected,TreeViewTmp.Items.Item[i].Text) do
        begin
        n:=39;
        if TreeViewTmp.Items.Item[i].Text=txt_add then n:=51;
        if TreeViewTmp.Items.Item[i].Text=txt_2_8_convert then n:=54;
        if TreeViewTmp.Items.Item[i].Text=txt_caption_extract then if tonewfolder=0 then n:=52 else n:=53;
        ImageIndex:=n;
        SelectedIndex:=n;
        end;

   if expandfun=1 then TreeViewNav.Selected.Expand(false);
   TreeViewNav.Selected:=TreeViewNav.Selected.Parent;

   with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_3_3_apps) do //apps
      begin
      Selected:=true;
      ImageIndex:=41;
      SelectedIndex:=41;
      end;

      with TreeViewNav.Items.AddChild(TreeViewNav.selected,txt_3_3_run) do begin ImageIndex:=39; SelectedIndex:=39; end;
      i:=1;
      if owcustom1.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom1.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=1; i:=i+1; end;
      if owcustom2.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom2.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=2; i:=i+1; end;
      if owcustom3.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom3.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=3; i:=i+1; end;
      if owcustom4.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom4.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=4; i:=i+1; end;
      if owcustom5.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom5.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=5; i:=i+1; end;
      if owcustom6.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom6.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=6; i:=i+1; end;
      if owcustom7.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom7.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=7; i:=i+1; end;
      if owcustom8.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom8.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=8; i:=i+1; end;
      if owcustom_9.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_9.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=9; i:=i+1; end;
      if owcustom_10.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_10.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=10; i:=i+1; end;
      if owcustom_11.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_11.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=11; i:=i+1; end;
      if owcustom_12.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_12.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=12; i:=i+1; end;
      if owcustom_13.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_13.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=13; i:=i+1; end;
      if owcustom_14.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_14.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=14; i:=i+1; end;
      if owcustom_15.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_15.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=15; i:=i+1; end;
      if owcustom_16.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom_16.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=16; i:=i+1; end;
      appentries1:=i-1;
      i:=1;
      if owcustom9.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom9.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=1; i:=i+1; end;
      if owcustom10.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom10.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=2; i:=i+1; end;
      if owcustom11.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom11.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=3; i:=i+1; end;
      if owcustom12.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom12.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=4; i:=i+1; end;
      if owcustom13.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom13.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=5; i:=i+1; end;
      if owcustom14.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom14.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=6; i:=i+1; end;
      if owcustom15.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom15.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=7; i:=i+1; end;
      if owcustom16.visible=true then begin with TreeViewNav.Items.AddChild(TreeViewNav.selected,owcustom16.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=8; i:=i+1; end;
   if expandapps=1 then TreeViewNav.Selected.Expand(false);
   TreeViewNav.Selected:=TreeViewNav.Selected.Parent;

if expandrun=1 then TreeViewNav.Selected.Expand(false) else TreeViewNav.Selected.Collapse(true);
end;
end;

procedure populate_archive;
var
   i,j,k,lstrt:integer;
   nodefound,nodenotfinalized:boolean;
   strt:AnsiString;
begin
//tree view archive representation, maxed to maxndirtree number of dirs for performances
FormPeach.TreeViewNav.Items.Beginupdate;

if (FormPeach.StringGridAddressAllFolders.RowCount=1) and (FormPeach.StringGridAddressOmittedFolders.RowCount=1) then
   begin
   FormPeach.TreeViewNav.Items.Clear;
   exit;
   end;

if fun='UN7Z' then
   if (status1=txt_list_nomatch+txt_2_7_list_tryflatorpw) or (browse_option='l') then
      begin
      FormPeach.TreeViewNav.Items.Clear;
      exit;
      end
   else
else
   begin
   FormPeach.TreeViewNav.Items.Clear;
   exit;
   end;

if set_archivetree=false then
   begin
   if extractfilename(FormPeach.EditOpenIn.Text)='' then
      begin
      FormPeach.TreeViewNav.Items.Clear;
      end
   else
      begin
      if FormPeach.StringGridAddressAllFolders.rowcount>maxndirtree then
         for i:=FormPeach.TreeViewNav.Items.Count-1 downto 2 do FormPeach.TreeViewNav.Items[i].Delete
      else
         for i:=FormPeach.TreeViewNav.Items.Count-1 downto FormPeach.StringGridAddressAllFolders.RowCount+1 do FormPeach.TreeViewNav.Items[i].Delete;
      end;
   exit;
   end
else set_archivetree:=false;

FormPeach.TreeViewNav.Items.Clear;
if extractfilename(FormPeach.EditOpenInInteractive.Text)='' then exit;

with FormPeach.TreeViewNav.Items.Add(nil,extractfilename(FormPeach.EditOpenInInteractive.Text)) do
   begin
   Selected:=true;
   ImageIndex:=geticon(FormPeach.EditOpenInInteractive.Text,ExtractFileExt(FormPeach.EditOpenInInteractive.Text),false);
   SelectedIndex:=ImageIndex;
   end;

if (FormPeach.StringGridAddressAllFolders.rowcount<2) or (FormPeach.StringGridAddressAllFolders.rowcount>maxndirtree) then
   begin
   FormPeach.TreeViewNav.Items.Add(nil,'');
   exit;
   end;

if FormPeach.StringGridAddressAllFolders.Cells[12,1]='' then
   begin
   FormPeach.TreeViewNav.Items.Add(nil,'');
   exit;
   end;

FormPeach.StringGridAddressAllFolders.Beginupdate;
FormPeach.StringGridAddressAllFolders.SortColRow(true,12);
with FormPeach.TreeViewNav.Items.AddChild(FormPeach.TreeViewNav.selected,FormPeach.StringGridAddressAllFolders.Cells[12,1]) do
   begin
   FormPeach.StringGridAddressAllFolders.Cells[13,1]:='1';
   Selected:=true;
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
FormPeach.TreeViewNav.BeginUpdate;
FormPeach.TreeViewNav.visible:=false;
for i:=2 to FormPeach.StringGridAddressAllFolders.RowCount-1 do
   begin
   nodefound:=false;
   if FormPeach.StringGridAddressAllFolders.Cells[12,i]<>FormPeach.StringGridAddressAllFolders.Cells[12,i-1] then
      begin
      strt:=FormPeach.StringGridAddressAllFolders.Cells[12,i]+directoryseparator;
      lstrt:=length(FormPeach.StringGridAddressAllFolders.Cells[12,i]);
      for j:=1 to FormPeach.TreeViewNav.Items.Count-1 do
         begin
         if (lstrt>length(FormPeach.TreeViewNav.Items[j].Text)) and
            (posex(FormPeach.TreeViewNav.Items[j].Text+directoryseparator,strt,1)=1) then
            begin
            nodenotfinalized:=false;
            for k:=j+1 to FormPeach.TreeViewNav.Items.Count-1 do
               begin
               if (lstrt>length(FormPeach.TreeViewNav.Items[k].Text)) and
                  (posex(FormPeach.TreeViewNav.Items[k].Text+directoryseparator,strt,1)=1) then
                  begin
                  nodenotfinalized:=true;
                  break;
                  end;
               end;
            if nodenotfinalized=false then
               with FormPeach.TreeViewNav.Items.AddChild(FormPeach.TreeViewNav.Items[j],FormPeach.StringGridAddressAllFolders.Cells[12,i]) do
                  begin
                  Selected:=true;
                  ImageIndex:=3;
                  SelectedIndex:=3;
                  nodefound:=true;
                  break;
                  end;
            end;
         end;
      end
   else nodefound:=true; //discard possible duplicates for same dir
   if nodefound=false then
      with FormPeach.TreeViewNav.Items.AddChild(FormPeach.TreeViewNav.Items[0],FormPeach.StringGridAddressAllFolders.Cells[12,i]) do
         begin
         Selected:=true;
         ImageIndex:=3;
         SelectedIndex:=3;
         end;
   end;
FormPeach.TreeViewNav.EndUpdate;
FormPeach.TreeViewNav.visible:=true;
FormPeach.StringGridAddressAllFolders.clear;
FormPeach.StringGridAddressAllFolders.rowcount:=FormPeach.TreeViewNav.Items.Count;
for i:=1 to FormPeach.TreeViewNav.Items.Count-1 do
   FormPeach.StringGridAddressAllFolders.Cells[12,i]:=FormPeach.TreeViewNav.Items[i].text;
for j:=1 to FormPeach.TreeViewNav.Items.Count-1 do
   FormPeach.TreeViewNav.Items[j].Text:=dirextractfilename(FormPeach.TreeViewNav.Items[j].Text);
FormPeach.StringGridAddressAllFolders.EndUpdate;

FormPeach.TreeViewNav.Selected:=FormPeach.TreeViewNav.Items[0];
FormPeach.TreeViewNav.Selected.collapse(true);
aisexpanded:=false;

FormPeach.TreeViewNav.Items.Add(nil,'');

end;

begin
with FormPeach do
begin

populate_archive;

populate_bookmarks;

TreeViewNav.Items.Add(nil,'');
with TreeViewNav.Items.Add(nil,txt_fs) do
   begin
   Selected:=true;
   ImageIndex:=31;
   SelectedIndex:=31;
   end;
{$IFDEF MSWINDOWS}
populate_fs_windows;
{$ELSE}
populate_fs_nonwindows;
{$ENDIF}

TreeViewNav.Items.Add(nil,'');
populate_history;

TreeViewNav.Items.Add(nil,'');
populate_open;

TreeViewNav.Items.Add(nil,'');

FormPeach.TreeViewNav.TopItem:=FormPeach.TreeViewNav.Items[0];
if (fun='UN7Z') and (selnode>0) and (selnode<FormPeach.TreeViewNav.Items.Count) then
   if FormPeach.TreeViewNav.Items[selnode].IsVisible=false then FormPeach.TreeViewNav.Items[selnode].MakeVisible;

TreeViewNav.selected:=nil;

TreeViewNav.Items.Endupdate;
end;
end;

function gettreeicon(sg:tstringgrid; arow:integer):integer;
var
   s,s1,fulltype:ansistring;
   sbrowse,i:integer;
begin
with FormPeach do
begin
result:=1;
if sg.RowCount<2 then exit;
if arow>=sg.rowcount then exit;
if sg=FormPeach.stringgridrecent then
   s:=sg.Cells[1,arow]
else
   s:=sg.Cells[2,arow];
if (s = txt_mypc) or (s = 'Computer''s root') then
   begin
   result:=32;
   exit;
   end;
if sg<>FormPeach.stringgridrecent then
   begin
   if sg=FormPeach.stringgridbookmarks then sbrowse:=getsbrowse(arow)
   else sbrowse:=getsbrowsegrid(sg,arow);
   case sbrowse of
   1: begin
      result:=29;//recursive search
      exit;
      end;
   2: begin
      result:=33;//flat
      exit;
      end;
   3: begin
      result:=34;//non recursive search
      exit;
      end;
   end;
   end;
if mntmediaunits(s)=true then
   begin
   result:=11;
   exit;
   end;
if s = desktop_path then
   begin
   result:=36;
   exit;
   end;
if s = home_path then
   begin
   result:=42;
   exit;
   end;
if s = usr_documents then
   begin
   result:=2;
   exit;
   end;
if s = usr_downloads then
   begin
   result:=43;
   exit;
   end;
if s = usr_music then
   begin
   result:=12;
   exit;
   end;
if s = usr_pictures then
   begin
   result:=17;
   exit;
   end;
if s = usr_videos then
   begin
   result:=15;
   exit;
   end;
if (s = shared_dropbox) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_sharepointwork) or (s = shared_yandex)then
   begin
   result:=44;
   exit;
   end;
{$IFDEF MSWINDOWS}
if length(s) = 3 then
   begin
   i:=ord(s[1])-64;
   result:=getpcmenuicon(devicon[i]);
   exit;
   end;
{$ENDIF}
if s<>'' then
   if s[length(s)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=extractfileext(s);
if sg.Cells[1,arow]<>'' then
   result:=geticon(s,fulltype,false);
end;
end;

function getshelltreeicon_frompath(s:ansistring):integer;
var
   i:integer;
begin
with FormPeach do
begin
result:=3;
if s='' then exit;
if (s = txt_mypc) or (s = 'Computer''s root') then
   begin
   result:=32;
   exit;
   end;
s:=s+directoryseparator;
if mntmediaunits(s)=true then
   begin
   result:=11;
   exit;
   end;
if s = desktop_path then
   begin
   result:=36;
   exit;
   end;
if s = home_path then
   begin
   result:=42;
   exit;
   end;
if s = usr_documents then
   begin
   result:=2;
   exit;
   end;
if s = usr_downloads then
   begin
   result:=43;
   exit;
   end;
if s = usr_music then
   begin
   result:=12;
   exit;
   end;
if s = usr_pictures then
   begin
   result:=17;
   exit;
   end;
if s = usr_videos then
   begin
   result:=15;
   exit;
   end;
if (s = shared_dropbox) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_sharepointwork) or (s = shared_yandex)then
   begin
   result:=44;
   exit;
   end;
{$IFDEF MSWINDOWS}
if length(s) = 3 then
   begin
   i:=ord(s[1])-64;
   result:=getpcmenuicon(devicon[i]);
   exit;
   end;
{$ENDIF}
end;
end;

procedure imgshelltree;
var
  Node: TTreeNode;
  i: Integer;
  s:ansistring;
begin
  if FormPeach.ShellTreeViewNav.Items.Count > 0 then
  begin
    for i := 0 to FormPeach.ShellTreeViewNav.Items.Count - 1 do
    begin
      Node := FormPeach.ShellTreeViewNav.Items[i];
      s:=ExcludeTrailingPathDelimiter(FormPeach.ShellTreeViewNav.GetPathFromNode(Node));
      Node.ImageIndex:=getshelltreeicon_frompath(s);
      Node.SelectedIndex:=Node.ImageIndex;
    end;
   end;
end;

procedure dotreeviewaction(TargetNode : TTreeNode);
var
   s:ansistring;
   i,appsnodes:integer;
begin
if TargetNode=nil then
   begin
   FormPeach.TreeViewNav.selected:=nil;
   exit;
   end;
if (targetnode.parent<>nil) then
   begin
   if TargetNode.Parent.Text=txt_mypc then
       begin
       opendevice(TargetNode.Text);
       exit;
       end;
   if TargetNode.Parent.Text=txt_fs then
      begin
      if TargetNode.Text=txt_2_9_home then begin jumpto('home'); exit; end;
      if TargetNode.Text=txt_desktop then begin jumpto('desktop'); exit; end;
      if TargetNode.Text=txt_2_4_documents then begin jumpto('usrdocuments'); exit; end;
      if TargetNode.Text=txt_3_1_downloads then begin jumpto('sysdownloads'); exit; end;
      if TargetNode.Text=txt_5_0_music then begin jumpto('usrmusic'); exit; end;
      if TargetNode.Text=txt_5_0_pictures then begin jumpto('usrpictures'); exit; end;
      if TargetNode.Text=txt_5_0_videos then begin jumpto('usrvideos'); exit; end;
      if TargetNode.Text='Dropbox' then begin jumpto('dropbox'); exit; end;
      if TargetNode.Text='Google Drive' then begin jumpto('googledrive'); exit; end;
      if TargetNode.Text='OneDrive' then begin jumpto('onedrive'); exit; end;
      if TargetNode.Text='Sharepoint Workspaces' then begin jumpto('sharepoint'); exit; end;
      if TargetNode.Text='Yandex Disk' then begin jumpto('yandexdisk'); exit; end;
      {$IFNDEF MSWINDOWS}
      if TargetNode.Text='media' then begin jumpto('media'); exit; end;
      if TargetNode.Text='mnt' then begin jumpto('mnt'); exit; end;
      if TargetNode.Text='run/media' then begin jumpto('run/media'); exit; end;
      if TargetNode.Text='var/run/media' then begin jumpto('var/run/media'); exit; end;
      if TargetNode.Text='MTP ($UID/gvfs)' then begin jumpto('MTP ($UID/gvfs)'); exit; end;
      if TargetNode.Text='var/ MTP ($UID/gvfs)' then begin jumpto('var/ MTP ($UID/gvfs)'); exit; end;
      if TargetNode.Text='Volumes' then begin jumpto('Volumes'); exit; end;
      if TargetNode.Text='Applications' then begin jumpto('Applications'); exit; end;
      if TargetNode.Text='System Applications' then begin jumpto('System Applications'); exit; end;
      if TargetNode.Text='Mobile Documents' then begin jumpto('Mobile Documents'); exit; end;
      {$ENDIF}
      if TargetNode.Text=txt_mypc then
         if treeonbutton=true then
            begin
            {$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
            jumpto('root');
            exit;
            end;
      end;
   if TargetNode.Parent.Text='...' then
       begin
       if TargetNode.Text=txt_4_6_users then begin jumpto('users'); exit; end;
       if TargetNode.Text=txt_2_9_home+' - '+txt_2_9_public then begin jumpto('publichome'); exit; end;
       if TargetNode.Text=txt_2_4_documents+' - '+txt_2_9_public then begin jumpto('publicdocuments'); exit; end;
       if TargetNode.Text=txt_list_history then begin jumpto('sysrecent'); exit; end;
       if TargetNode.Text=txt_3_1_src then begin jumpto('syssearches'); exit; end;
       if TargetNode.Text=txt_3_1_lib then begin jumpto('syslibraries'); exit; end;
       if TargetNode.Text='Apple' then begin jumpto('Apple'); exit; end;
       end;

   if TargetNode.Parent.Text=txt_open then
       begin
       //split in function and apps
       exit;
       end;

   if TargetNode.Parent.Text=txt_4_8_fun then
       begin
       do_pmfun(TargetNode.Text);
       exit;
       end;

   if TargetNode.Parent.Text=txt_3_3_apps then
       begin
       appsnodes:=0;
       case TargetNode.Index of
          0: run_custom('');
          else
             begin
             if FormPeach.StringGridList.RowCount<2 then exit;
             if FormPeach.StringGridList.Cells[1,1]='' then exit;
             if checklistanysel<>0 then
                begin
                if TargetNode.Index<=appentries1+appsnodes then
                   open_custedit(appdb[TargetNode.Index-appsnodes],'')
                else
                   open_advcustedit(appdb2[TargetNode.Index-appentries1-appsnodes],'');
                exit;
                end;
             for i:=1 to FormPeach.StringGridList.RowCount-1 do
                if FormPeach.StringGridList.Cells[16,i]='1' then
                   if TargetNode.Index<=appentries1+appsnodes then
                      open_custedit(appdb[TargetNode.Index-appsnodes],FormPeach.StringGridList.Cells[12,i])
                   else
                      open_advcustedit(appdb2[TargetNode.Index-appentries1-appsnodes],FormPeach.StringGridList.Cells[12,i]);
             end;
          end;
          exit;
          end;

   if TargetNode.Parent.Text=txt_bookmarks then
      begin
            browsebookmark(TargetNode.Index+1);
            exit;
      end;

   if TargetNode.Parent.Text=txt_list_history then
      begin
      if TargetNode.Index+1<=hnum then //unused, recent paths not shown in navigation bar
         begin
         if FormPeach.StringGridSessionHistory.Cells[2,FormPeach.StringGridSessionHistory.RowCount-TargetNode.Index-1]<>FormPeach.EditOpenIn.Text then
            browsehistoryn(TargetNode.Index+1);
         end
      else
         if FormPeach.StringGridRecent.Cells[0,TargetNode.Index+1-hnum]='' then opendir(FormPeach.StringGridRecent.Cells[1,TargetNode.Index+1-hnum])
         else open_archive_fromname(FormPeach.StringGridRecent.Cells[1,TargetNode.Index+1-hnum]);
      exit;
      end;

   try if FormPeach.TreeViewNav.Selected.text<>TargetNode.text then exit; except exit; end;
   if fun='UN7Z' then
      begin
      if (FormAdvf.CheckBoxAdvFilters.State=cbChecked) and (filterbrowser=1) then exit;
      FormPeach.EditUn7zaFilter.Text:=FormPeach.StringGridAddressAllFolders.Cells[12,TargetNode.AbsoluteIndex]+directoryseparator+'*';
      FormPeach.EditUn7zaFilterExclude.Text:=FormPeach.StringGridAddressAllFolders.Cells[12,TargetNode.AbsoluteIndex]+directoryseparator+'*'+directoryseparator+'*';
      listun7z_go;
      end;
   end
else
   begin
   try if FormPeach.TreeViewNav.Selected.text<>TargetNode.text then exit; except exit; end;
   if fun='UN7Z' then
      begin
      if (FormAdvf.CheckBoxAdvFilters.State=cbChecked) and (filterbrowser=1) then exit;
      if (TargetNode.AbsoluteIndex=0) and (TargetNode.Text<>txt_bookmarks) then
         begin
         specbrowse:=pspecbrowse;
         refresharchiveroot('noreload');
         //list_root;
         end;
      end;
   end;
end;

procedure dotreeviewstatus(TargetNode : TTreeNode);
var
   i:integer;
   n:TTreeNode;
begin
n:=FormPeach.TreeViewNav.Items.GetFirstNode;
for i:=1 to FormPeach.TreeViewNav.Items.Count-1 do
  begin
  if (n.parent=nil) then
     begin
     if (n.Text=txt_fs) then
        if n.Expanded=true then expandfs:=1
        else
           begin
           expandfs:=0;
           expandmore:=0;
           end;
     if (n.Text=txt_bookmarks) then
        if n.Expanded=true then expandbook:=1
        else expandbook:=0;
     if (n.Text=txt_list_history) then
        if n.Expanded=true then expandhistory:=1
        else expandhistory:=0;
     if (n.Text=txt_open) then
        if n.Expanded=true then expandrun:=1
        else expandrun:=0;
     end;
  if (n.parent<>nil) then
     begin
     if (n.parent.Text=txt_fs) and (n.Text='...') then
        if n.Expanded=true then expandmore:=1
        else expandmore:=0;
     if (n.parent.Text=txt_fs) and (n.Text=txt_mypc) then
        if n.Expanded=true then expandroot:=1
        else expandroot:=0;
     if (n.parent.Text=txt_open) and (n.Text=txt_3_3_apps) then
        if n.Expanded=true then expandapps:=1
        else expandapps:=0;
     if (n.parent.Text=txt_open) and (n.Text=txt_4_8_fun) then
        if n.Expanded=true then expandfun:=1
        else expandfun:=0;
     end;
  N := N.GetNext;
  end;
if TargetNode=nil then FormPeach.TreeViewNav.selected:=nil;
end;

function resolveaddressfs(addrfs:ansistring):ansistring;
begin
if addrfs=txt_2_9_home then result:=extractfilepath(home_path);
if addrfs=txt_desktop then result:=local_desktop;
if addrfs=txt_2_4_documents then result:=usr_documents;
if addrfs=txt_3_1_downloads then result:=usr_downloads;
if addrfs=txt_5_0_music then result:=usr_music;
if addrfs=txt_5_0_pictures then result:=usr_pictures;
if addrfs=txt_5_0_videos then result:= usr_videos;
if addrfs='Dropbox' then result:=shared_dropbox;
if addrfs='Google Drive' then result:=shared_googledrive;
if addrfs='OneDrive' then result:=shared_onedrive;
if addrfs='Sharepoint Workspaces' then result:=shared_sharepointwork;
if addrfs='Yandex Disk' then result:=shared_yandex;
{$IFNDEF MSWINDOWS}
if addrfs='media' then result:='/media/';
if addrfs='mnt' then result:='/mnt/';
if addrfs='run/media' then result:='/run/media/';
if addrfs='var/run/media' then result:='/var/run/media/';
if addrfs='MTP ($UID/gvfs)' then result:='/run/user/';
if addrfs='var/ MTP ($UID/gvfs)' then result:='/var/run/user/';
if addrfs='Volumes' then result:='/Volumes/';
if addrfs='Applications' then result:='/Applications/';
if addrfs='System Applications' then result:='/System/Applications/';
if addrfs='Mobile Documents' then result:='/Library/Mobile Documents/';
if addrfs=txt_mypc then if treeonbutton=true then result:='/';
{$ENDIF}
if addrfs=txt_4_6_users then result:=users_root;
if addrfs=txt_2_9_home+' - '+txt_2_9_public then result:=public_home;
if addrfs=txt_2_4_documents+' - '+txt_2_9_public then result:=public_documents;
if addrfs=txt_list_history then result:=usr_recent;
if addrfs=txt_3_1_src then result:=usr_searches;
if addrfs=txt_3_1_lib then result:=usr_libraries;
if addrfs='Apple' then result:=applebk;
end;

procedure intdd_do(Button: TMouseButton);
var
   tmpnode:ttreenode;
   tside,i,w:integer;
   tmppt,tmppto:tpoint;
   ddtarget,dstr:ansistring;
   tabfound,breadfound:boolean;
begin
if intdd=true then
   begin

   //try to drag to bookmarks (adds to bookmarks and exit)
   try
   tmppt:=mouse.CursorPos;
   if (lastbar=2) and (FormPeach.stringgridbookmarks.visible=true) then
      begin
      tmppt:=FormPeach.stringgridbookmarks.ScreenToClient(tmppt);
      if tmppt.Y+FormPeach.PanelInfoGeneral.Height>0 then
         begin
         addtobookmarks('*browsercontext');
         exit;
         end;
      end;
   except
   end;

   breadfound:=false;
   tabfound:=false;

   //try to drag to breadcrumb bar
   if FormPeach.mbtext.Checked=false then //breadcrumb is diplayed
   try
   ddtarget:='';
   if FormPeach.LabelClickAddress8.visible=true then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress8.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress8.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress8.Width)then
         begin
         if fun='FILEBROWSER' then ddtarget:=FormPeach.pmbc1.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress8.Caption;
            end;
         end;
      end;
   if (ddtarget='') and (FormPeach.LabelClickAddress7.visible=true) then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress7.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress7.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress7.Width)then
         begin
         ddtarget:=FormPeach.pmbc2.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress7.Caption;
            end;
         end;
      end;
   if (ddtarget='') and (FormPeach.LabelClickAddress6.visible=true) then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress6.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress6.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress6.Width)then
         begin
         ddtarget:=FormPeach.pmbc3.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress6.Caption;
            end;
         end;
      end;
   if (ddtarget='') and (FormPeach.LabelClickAddress5.visible=true) then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress5.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress5.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress5.Width)then
         begin
         ddtarget:=FormPeach.pmbc4.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress5.Caption;
            end;
         end;
      end;
   if (ddtarget='') and (FormPeach.LabelClickAddress4.visible=true) then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress4.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress4.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress4.Width)then
         begin
         ddtarget:=FormPeach.pmbc5.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress4.Caption;
            end;
         end;
      end;
   if (ddtarget='') and (FormPeach.LabelClickAddress3.visible=true) then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress3.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress3.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress3.Width)then
         begin
         ddtarget:=FormPeach.pmbc6.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress3.Caption;
            end;
         end;
      end;
   if (ddtarget='') and (FormPeach.LabelClickAddress2.visible=true) then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress2.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress2.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress2.Width)then
         begin
         ddtarget:=FormPeach.pmbc7.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress2.Caption;
            end;
         end;
      end;
   if (ddtarget='') and (FormPeach.LabelClickAddress1.visible=true) then
      begin
      tmppt:=mouse.CursorPos;
      tmppto:=tmppt;
      tmppt:=FormPeach.LabelClickAddress1.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.LabelClickAddress1.Height) and
         (tmppt.X>0) and (tmppt.X<FormPeach.LabelClickAddress1.Width)then
         begin
         if FormPeach.LabelClickAddress1.Caption<>' '+txt_mypc+' ' then ddtarget:=FormPeach.pmbc8.caption;
         if ddtarget<>'' then
            begin
            breadfound:=true;
            dstr:=FormPeach.LabelClickAddress1.Caption;
            end;
         end;
      end;
   if dstr<>'' then dstr:=Trim(dstr);
   except
   end;

   //try to drag to tab bar
   if breadfound=false then
   try
   ddtarget:='';
   tmppt:=mouse.CursorPos;
   tmppto:=tmppt;
   if FormPeach.PanelTabBar.visible=true then
      begin
      tmppt:=FormPeach.PanelTabBar.ScreenToClient(tmppt);
      if (tmppt.Y>0) and (tmppt.Y<FormPeach.PanelTabBar.Height) then
         begin
         i:=FormPeach.TabBar.GetSectionAt(tmppt);
         {w:=0;
         for i:=0 to FormPeach.TabBar.Sections.Count-1 do
            begin
            w:=w+FormPeach.TabBar.Sections.Items[i].Width;
            if tmppt.X<=w then break;
            end;}//alternative, get tab by horizontal position
         ddtarget:=FormPeach.StringGridTabs.Cells[2,FormPeach.TabBar.Sections.Items[i].ID];
         if ddtarget<>'' then
            begin
            tabfound:=true;
            dstr:=FormPeach.TabBar.Sections.Items[i].Text;
            end;
         end;
      end;
   except
   end;

   //try to drag to side navigation bar
   if (breadfound=false) and (tabfound=false) then
   try
   ddtarget:='';
   tmppt:=mouse.CursorPos;
   tmppto:=tmppt;
   case navbar of //0 nav bar 1 shell treeview 2 compact
      0:
      begin
      tmppt:=FormPeach.TreeViewNav.ScreenToClient(tmppt);
      if FormPeach.TreeViewNav.GetHitTestInfoAt(tmppt.X, tmppt.Y) <= [htOnItem, htOnIcon, htOnLabel, htOnStateIcon, htOnButton] then
         tmpnode:=FormPeach.TreeViewNav.GetNodeAt(tmppt.X,tmppt.Y)
      else
         tmpnode :=nil;
      if tmpnode<>nil then
         if tmpnode.parent<>nil then
            begin
            if tmpnode.Parent.Text=txt_bookmarks then
               ddtarget:=FormPeach.StringGridBookmarks.Cells[2,tmpnode.Index+1];
            if tmpnode.Parent.Text=txt_list_history then //assume session history is not added to nav tree
               if FormPeach.StringGridRecent.Cells[0,tmpnode.Index+1-hnum]='' then
                  ddtarget:=FormPeach.StringGridRecent.Cells[1,tmpnode.Index+1-hnum];
            if tmpnode.Parent.Text=txt_fs then
               ddtarget:=resolveaddressfs(tmpnode.Text);
            if tmpnode.Parent.Text='...' then
               ddtarget:=resolveaddressfs(tmpnode.Text);
            dstr:=tmpnode.Text;
            end;
      end;
      1:
      begin
      tmppt:=FormPeach.ShellTreeViewNav.ScreenToClient(tmppt);
      if FormPeach.ShellTreeViewNav.GetHitTestInfoAt(tmppt.X, tmppt.Y) <= [htOnItem, htOnIcon, htOnLabel, htOnStateIcon, htOnButton] then
         tmpnode:=FormPeach.ShellTreeViewNav.GetNodeAt(tmppt.X,tmppt.Y)
      else
         tmpnode :=nil;
      if tmpnode<>nil then
         begin
         ddtarget:=tmpnode.GetTextPath+DirectorySeparator;
         dstr:=tmpnode.Text;
         end;
      end;
      2:
      begin
      tmppt:=FormPeach.Panelside.ScreenToClient(tmppt);
      tside:=tmppt.Y div FormPeach.csbroot.height;
      if tmppt.Y > 0 then
         if tmppt.X < FormPeach.csbroot.Width+FormPeach.csbroot.Left then
            case tside of
            0: begin {$IFNDEF MSWINDOWS}ddtarget:='/'; dstr:='/';{$ENDIF} end;
            1: begin ddtarget:=extractfilepath(home_path); dstr:=txt_2_9_home; end;
            2: begin ddtarget:=local_desktop; dstr:=txt_desktop; end;
            3: begin ddtarget:=usr_downloads; dstr:=txt_3_1_downloads; end;
            4: begin ddtarget:=usr_documents; dstr:=txt_2_4_documents; end;
            5: begin ddtarget:=usr_music; dstr:=txt_5_0_music; end;
            6: begin ddtarget:=usr_pictures; dstr:=txt_5_0_pictures; end;
            7: begin ddtarget:=usr_videos; dstr:=txt_5_0_videos; end;
            end;
      end;
   end;
   except
   end;

   //if destination is found in tab or navigation bar, show the internal drag and drop menu
   try
   if ddtarget<>'' then
      if checkdirexists(ddtarget) then
         {if button=mbleft then //default action on left button drag and drop
            quickextract(ddtarget,'*neutral','selected')
         else}
            begin
            FormPeach.TreeViewNav.PopupMenu:=nil;
            FormPeach.ShellTreeViewNav.PopupMenu:=nil;
            FormPeach.TabBar.PopupMenu:=nil;
            mddtarget:=ddtarget;
            dstr:=StringReplace(dstr,'<','',[rfReplaceAll]);
            dstr:=StringReplace(dstr,'>','',[rfReplaceAll]);
            if ddtarget=FormPeach.EditOpenIn.Text then dstr:='[ '+dstr+' ]'; //drop to same path
            FormPeach.pmintdddest.Caption:='-> '+dstr;
            if fun='FILEBROWSER' then
               begin
               FormPeach.Separator49.Visible:=true;
               FormPeach.pmintddcopy.Visible:=true;
               FormPeach.pmintddmove.Visible:=true;
               FormPeach.Separator57.Visible:=true;
               FormPeach.pmintddadd.Visible:=true;
               end
            else
               begin
               FormPeach.Separator49.Visible:=false;
               FormPeach.pmintddcopy.Visible:=false;
               FormPeach.pmintddmove.Visible:=false;
               FormPeach.Separator57.Visible:=false;
               FormPeach.pmintddadd.Visible:=false;
               end;
            FormPeach.pmintdd.PopUp(tmppto.X, tmppto.Y);
            FormPeach.TreeViewNav.PopupMenu:=FormPeach.pmbreadcrumb;
            FormPeach.ShellTreeViewNav.PopupMenu:=FormPeach.pmbreadcrumb;
            FormPeach.TabBar.PopupMenu:=FormPeach.pmtabs;
            end;
   except
   end;

   end;
intdd:=false;
end;

procedure populatetreefunctions;
begin
with FormPeach do
begin
TreeViewTmp.Items.Clear;
TreeViewTmp.Items.Add(nil,txt_add);
TreeViewTmp.Items.Add(nil,txt_2_8_convert);
TreeViewTmp.Items.Add(nil,txt_caption_extract);
TreeViewTmp.Items.Add(nil,txt_ext_allto+'...');
TreeViewTmp.Items.Add(nil,txt_caption_test);
TreeViewTmp.Items.Add(nil,txt_4_1_duplicatesfind);
TreeViewTmp.Items.Add(nil,txt_copyto);
TreeViewTmp.Items.Add(nil,txt_moveto);
TreeViewTmp.Items.Add(nil,txt_joinfiles);
TreeViewTmp.Items.Add(nil,txt_split_file);
TreeViewTmp.Items.Add(nil,txt_4_3_pwman);
TreeViewTmp.Items.Add(nil,txt_2_7_setpw);
TreeViewTmp.Items.Add(nil,txt_searchfor);
TreeViewTmp.Items.Add(nil,txt_2_5_help);
TreeViewTmp.Items.Add(nil,txt_settings);
TreeViewTmp.Items.Add(nil,txt_peazip_new);
TreeViewTmp.Items.Add(nil,txt_cphere);
TreeViewTmp.Items.Add(nil,txt_explore_path);
TreeViewTmp.Items.Add(nil,txt_open_path);
TreeViewTmp.Items.Add(nil,txt_openarchive);
TreeViewTmp.Items.Add(nil,txt_searchanddrag);
TreeViewTmp.Items.Add(nil,txt_search_web);
{$IFDEF MSWINDOWS}TreeViewTmp.Items.Add(nil,txt_5_0_ps);{$ENDIF}
TreeViewTmp.Items.Add(nil,txt_4_5_properties);
TreeViewTmp.Items.Add(nil,txt_add_tobookmarks);
TreeViewTmp.Items.Add(nil,txt_2_9_organize+' '+txt_bookmarks);
TreeViewTmp.Items.Add(nil,txt_toggle_browseflat);
TreeViewTmp.Items.Add(nil,txt_4_7_pk);
TreeViewTmp.Items.Add(nil,txt_8_7_verifybin);
TreeViewTmp.Items.Add(nil,mcomment.Caption);//caption is conditional
TreeViewTmp.Items.Add(nil,txt_advfilters);
TreeViewTmp.Items.Add(nil,txt_caption_list);
TreeViewTmp.Items.Add(nil,txt_check);
TreeViewTmp.Items.Add(nil,txt_rename+' (F2)');
TreeViewTmp.Items.Add(nil,txt_cnewfolder);
TreeViewTmp.CustomSort(nil);
end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection COMMAND LINE scripting engine routines

///////////////////////////////////////////////////////////////////////////////}

procedure get_new_archive_name(var out_param:ansistring);
var
   i:integer;
   s,s1:ansistring;
   name_ok:boolean;
begin
s1:='';
if (fileexists(out_param) or checkdirexists(out_param)) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   if extractfileext(s)='.tar' then begin cutextension(s); s1:='.tar'; end;
   repeat
      if (fileexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)) or checkdirexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param))) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i)+s1+extractfileext(out_param);
   end;
end;

procedure apply_encexttoname(var s:ansistring; checktar:integer);
var
   s0,s1,s2:ansistring;
begin
if addencext=0 then exit;
if checktar=1 then
   if FormPeach.CheckBoxTarBefore.State=cbChecked then exit;
s0:=extractfilepath(s);
s1:=extractfilename(s);
cutextension(s1);
s2:=extractfileext(s);
if ((FormPeach.cbType.Text=txt_sfx+' '+STR_ARC) or (FormPeach.cbType.Text=txt_sfx+' '+STR_7Z)) and (FormPW.EditPWpass.Text='') then
else
   if (FormPeach.BtnPasswordArchive.Visible=true) and ((FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'')) then
      if pos('.enc',s1)=0 then
         s1:=s1+'.enc';
s:=s0+s1+s2;
end;

procedure apply_timestamptoname(var s:ansistring; checktar,forceapply:integer; fmode:ansistring);
var
   dt_stamp,s0,s1,s2:ansistring;
begin
if checktar=1 then
   if FormPeach.CheckBoxTarBefore.State=cbChecked then exit;
case tsstyle of
   0: dt_stamp:=formatdatetime('.yyyymmdd.hhnnss',now);
   1: dt_stamp:=formatdatetime('.yyyymmdd',now);
   2: dt_stamp:=formatdatetime('yyyymmdd.hhnnss.',now);
   3: dt_stamp:=formatdatetime('yyyymmdd.',now);
   end;
s0:=extractfilepath(s);
s1:=extractfilename(s);
if fmode='file' then
   begin
   cutextension(s1);
   s2:=extractfileext(s);
   end
else s2:='';
if updatingarchive_inarchive=false then
   if (FormPeach.CheckBoxDate.State=cbChecked) or (forceapply=1) then
   case tsstyle of
      2: s1:=dt_stamp+s1;
      3: s1:=dt_stamp+s1;
      else s1:=s1+dt_stamp;
   end;
s:=s0+s1+s2;
if fun<>'FILEBROWSER' then apply_encexttoname(s,checktar);
end;

procedure apply_dirnametoname(var s:ansistring; dmode,fmode:ansistring);
var
   s0,s1,s2,sdir:ansistring;
begin
s0:=extractfilepath(s);
s1:=extractfilename(s);
if fmode='file' then
   begin
   cutextension(s1);
   s2:=extractfileext(s);
   end
else s2:='';
sdir:=s0;
if length(sdir)<=3 then exit;
if sdir<>'' then
   if sdir[length(sdir)]=directoryseparator then setlength(sdir,length(sdir)-1);
sdir:=extractfilename(sdir);
if length(sdir)>128 then sdir:=copy(sdir,1,128);
case dmode of
   'prepend': s1:=sdir+' - '+s1;
   'append': s1:=s1+' - '+sdir;
   end;
s:=s1+s2;
end;

function getoutname(var s,archive_type:ansistring; i:integer):integer;
var
   s1:AnsiString;
begin
getoutname:=-1;
suggest_outname(s,FormPeach.cbType.Text,i);
   s:=extractfilename(s); //keep only filename, set path to last accepted by SaveDialog2 control
   FormPeach.SaveDialogAS.FileName:=addext(s);
   if lastoutpath='' then lastoutpath:=local_desktop; //if no path was previously used, or after configuration reset, show desktop as default
   FormPeach.SaveDialogAS.InitialDir:=extractfilepath(FormPeach.EditAddName.Caption);//Initialdir:=lastoutpath;
   if FormPeach.SaveDialogAS.Execute then
      if FormPeach.SaveDialogAS.FileName<>'' then
         begin
         s:=FormPeach.SaveDialogAS.FileName;
         cutextension(s);
         s1:=extractfilepath(FormPeach.SaveDialogAS.FileName);
         if s=addext(s1) then s:=extractfilepath(FormPeach.SaveDialogAS.FileName);
         end
      else exit
   else exit;
   lastoutpath:=extractfilepath(FormPeach.SaveDialogAS.FileName);
getoutname:=0;
end;

function setoutname(var s:ansistring; i:integer):integer;
begin
setoutname:=-1;
suggest_outname(s,FormPeach.cbType.Text,i);
s:=extractfilename(s); //keep only filename, set path to last used
if FormPeach.StringGridAdd.RowCount>1 then s:=extractfilepath(FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row])+s
else s:=local_desktop+s;
if FormPeach.mdefaultarchive.Checked=true then FormPeach.EditAddFilepath.Text:=defaultarchivepath
else FormPeach.EditAddFilepath.Text:=extractfilepath(s);
FormPeach.EditAddFilename.Text:=extractfilename(s);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
setoutname:=0;
end;

procedure checkadvf(var in_param,sel:ansistring);
var
   i,j:integer;
   srec:ansistring;
begin
if fun='ARC' then srec:='-n'
else
   if FormAdvf.CheckBoxAdvRecurse.State=cbChecked then srec:='-ir0!'
   else srec:='-i!';
for j:=0 to FormAdvf.MemoAdvInclude.Lines.Count-1 do
   begin
   if sel='all' then
      begin
      for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
         if FormPeach.StringGridAdd.Cells[2,i]=txt_list_isfolder then in_param:=in_param+' '+stringdelim(srec+escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env)+DirectorySeparator+FormAdvf.MemoAdvInclude.Lines[j])+' ';
      end
   else
      begin
      i:=strtoint(sel);
      if FormPeach.StringGridAdd.Cells[2,i]=txt_list_isfolder then in_param:=stringdelim(srec+escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env)+DirectorySeparator+FormAdvf.MemoAdvInclude.Lines[j])+' ';
      end;
   end;
if sel='all' then
   begin
   for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
      if (FormPeach.StringGridAdd.Cells[2,i]<>txt_list_isfolder) then
         in_param:=in_param+stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' '
      else
         if (FormAdvf.MemoAdvInclude.Lines.Count=0) then
            in_param:=in_param+stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' ';
   end
else
   begin
   i:=strtoint(sel);
   if FormPeach.StringGridAdd.Cells[2,i]<>txt_list_isfolder then
      in_param:=stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' '
   else
      if (FormAdvf.MemoAdvInclude.Lines.Count=0) then
         in_param:=stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' ';
   end;
end;

procedure get_in_param(var in_param,sel:ansistring);
var
   i:integer;
begin
//inclusion filters seem not reliably working in ARC; when fixed it needs to be implemented also in get_in_param_arc for ARC not full path mode
if (FormAdvf.CheckBoxAdvFilters.State=cbChecked) and (fun='7Z') then checkadvf(in_param,sel)
else
if sel='all' then
   for i:=1 to FormPeach.StringGridAdd.RowCount-1 do in_param:=in_param+stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' '
else
   begin
   i:=strtoint(sel);
   in_param:=stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' ';
   end;
end;

procedure get_in_param_zpaq(var in_param,sel:ansistring);
var
   i:integer;
begin
if sel='all' then
   for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
     begin
     if FormPeach.StringGridAdd.Cells[2,i]=txt_list_isfolder then
        {$IFDEF MSWINDOWS}in_param:=in_param+stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env)+DirectorySeparator+'*')+' '
        {$ELSE}in_param:=in_param+stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env)+DirectorySeparator)+' '{$ENDIF}
     else
        in_param:=in_param+stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' ';
     end
else
   begin
   i:=strtoint(sel);
   if FormPeach.StringGridAdd.Cells[2,i]=txt_list_isfolder then
      {$IFDEF MSWINDOWS}in_param:=stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env)+DirectorySeparator+'*')+' '
      {$ELSE}in_param:=stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env)+DirectorySeparator)+' '{$ENDIF}
   else
      in_param:=stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' ';
   end;
end;

procedure setspecialtsize;
begin
if FormPeach.CheckBoxSeparate.State=cbChecked then
   try
   tsize:=strtoqword(FormPeach.StringGridAdd.Cells[3,FormPeach.StringGridAdd.Row]);
   except
   end;
end;

procedure get_in_param_arc(var in_param,sel:ansistring);
var
   i:integer;
   ipath,iname:ansistring;
begin
ipath:=FormPeach.EditAddFilepath.Caption;
if ipath<>'' then
   if ipath[length(ipath)]=directoryseparator then setlength(ipath,length(ipath)-1);//ARC error if relative path ends with directory separator
in_param:=stringdelim('-dp'+ipath)+' ';
ipath:=ipath+directoryseparator;
if sel='all' then
   for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
      begin
      iname:=extractrelativepath(ipath,extractfilepath(FormPeach.StringGridAdd.Cells[8,i]))+extractfilename(FormPeach.StringGridAdd.Cells[8,i]);
      in_param:=in_param+stringdelim(escapefilename(iname,desk_env))+' ';
      end
else
   begin
   i:=strtoint(sel);
   iname:=extractrelativepath(ipath,extractfilepath(FormPeach.StringGridAdd.Cells[8,i]))+extractfilename(FormPeach.StringGridAdd.Cells[8,i]);
   in_param:=in_param+stringdelim(escapefilename(iname,desk_env))+' ';
   end;
end;

procedure getarch_baseoutname(var s:ansistring);
begin
if FormPeach.CheckBoxSameArc.State=cbChecked then
   begin
   s:=FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row];
   if FormPeach.StringGridAdd.Cells[2,FormPeach.StringGridAdd.Row]<>txt_list_isfolder then cutextension(s);
   if length(s)>2 then
      if s[length(s)]='*' then s:=copy(s,0,length(s)-2); //convert to same path
   end
else
   begin
   if tarbeforenameexception=true then
      begin
      s:=FormPeach.EditAddFilepath.Text+FormPeach.EditAddFilename.Text;
      exit;
      end;
   if FormPeach.CheckBoxTarBefore.State=cbChecked then s:=FormPeach.StringGridAdd.Cells[8,1]
   else s:=FormPeach.EditAddFilepath.Text+FormPeach.EditAddFilename.Text;
   end;
end;

procedure getworkpath(var work_path:ansistring; out_param:ansistring);
begin
work_path:='';
case work_dir of
   0: work_path:='-w'+extractfilepath(out_param); //output
   1: work_path:='-w'+extractfilepath(out_param); //output (preview in temp)
   2: work_path:='-w'; //let 7z determinating appropriated temp folder for all actions
   3: work_path:='-w'+custom_work_path; //custom for all actions
   //4: none, preview in temp
   //5: none for all actions (can't perform preview)
   end;
if (work_path<>'') and (work_path<>'-w') then work_path:=stringdelim(checkescapedoutname(escapefilename(work_path,desk_env)))
end;

function compose_arc_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   i:integer;
   s,out_param,in_param,exclude_param,include_param,archive_function,solid_option,sfx_option,pw_option,pw,
   bin_name,compression_level,encalgo,recovery_option,work_path,wpt:ansistring;
begin
compose_arc_cl:=-1;
fun:='ARC';
subfun:='archive';
btfun:='arc';
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;
//check if input is suitable for chosen archive_type
if check_input<>0 then exit;
//output name
getarch_baseoutname(s);
out_param:=s+'.'+archive_type;
apply_timestamptoname(out_param,1,0,'file');
//archive function
if FormPeach.ComboBoxARCFun.ItemIndex=-1 then FormPeach.ComboBoxARCFun.ItemIndex:=0;
case FormPeach.ComboBoxARCFun.ItemIndex of
   0: begin
      archive_function:='a';
      get_new_archive_name(out_param);
      end;
   1: archive_function:='a';
   2: archive_function:='u';
   end;
//solid
case FormPeach.ComboBoxARCsolid.ItemIndex of
   0: solid_option:='';
   1: solid_option:='-s';
   2: solid_option:='-se';
   end;
//recovery records
if FormPeach.CheckBoxARCrr.state=cbChecked then recovery_option:='-rr';
//sfx
if FormPeach.CheckBoxARCsfx.state=cbChecked then sfx_option:='-sfx'+FormPeach.Comboboxarcsfx.text;
//Compression level
compression_level:='-m'+inttostr(FormPeach.ComboBoxARCLevel.ItemIndex);
//encryption
if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
   if FormPW.CheckBoxEncFn.State=cbChecked then pw_option:='-hp'
   else pw_option:='-p'
else pw_option:='';
pforceconsole:=0;
if pw_option<>'' then
   begin
   pw:=FormPW.EditPWpass.Text;
   if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
      if pw4cl(pw_option,pw)<>0 then
         begin
         msg_pw_errorchar(pw);
         pforceconsole:=1;
         pw:=pw_option;
         //exit;
         end;
         end;
//encryption algorithm
if FormPeach.ComboBoxARCalgo.Visible=true then
   case FormPeach.ComboBoxARCalgo.Itemindex of
      0: encalgo:='-ae=aes';
      1: encalgo:='-ae=serpent';
      2: encalgo:='-ae=twofish';
      3: encalgo:='-ae=blowfish';
      end;
//arc uses -- as tag to distinguish a filename starting with - from a switch, however since PeaZip uses absolute filenames it should never occur and filenames are not checked for that condition
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
{$IFDEF MSWINDOWS}
if arcabspath=1 then get_in_param(in_param,sel)
else get_in_param_arc(in_param,sel);
{$ELSE}
if arcabspath=1 then get_in_param(in_param,sel)
else get_in_param_arc(in_param,sel);
//with older versions of the compiler absolute path option in arc 0.666 was not working consistently in Linux due to parsing errors when the parameters are passed in a process
{$ENDIF}
exclude_param:='';
include_param:='';
if FormAdvf.CheckBoxAdvFilters.State=cbChecked then
begin
   for i:=0 to FormAdvf.MemoAdvExclude.Lines.Count-1 do
      begin
      exclude_param:=exclude_param+' '+stringdelim('-x'+FormAdvf.MemoAdvExclude.Lines[i])+' ';
      end;
   for i:=0 to FormAdvf.MemoAdvIncludeAlso.Lines.Count-1 do
      if extractfilepath(FormAdvf.MemoAdvIncludeAlso.Lines[i])<>'' then
         begin
         include_param:=include_param+' '+stringdelim('-n'+FormAdvf.MemoAdvIncludeAlso.Lines[i])+' ';
         end;
end;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'arc'+DirectorySeparator+'arc'+EXEEXT);
if sys7zlin>1 then bin_name:='arc'+EXEEXT;
cl:=bin_name+' '+archive_function+' '+compression_level;
if solid_option<>'' then cl:=cl+' '+solid_option;
if recovery_option<>'' then cl:=cl+' '+recovery_option;
if sfx_option<>'' then cl:=cl+' '+sfx_option;
if pforceconsole=0 then if zaout=2 then if (pw='-p') or (pw=stringdelim('-p')) or (pw='-hp') or (pw=stringdelim('-hp')) then pw:='';//never pass empty password to pipe mode
if intpw=1 then
   begin
   pforceconsole:=1;
   if (setencfn=1) then pw:='-hp'
   else pw:='-p';
   end;
if pw<>'' then cl:=cl+' '+pw;
if encalgo<>'' then cl:=cl+' '+encalgo;
if FormPeach.EditOParc.Text<>'' then cl:=cl+' '+FormPeach.EditOParc.Text;
//work path, without ending directory separator
wpt:=outname;
work_path:='';
case work_dir of
   0: work_path:='-w'+extractfilepath(wpt); //output
   1: work_path:='-w'+extractfilepath(wpt); //output (preview in temp)
   2: work_path:='-w'; //let 7z determinating appropriated temp folder for all actions
   3: work_path:='-w'+custom_work_path; //custom for all actions
   //4: none, preview in temp
   //5: none for all actions (can't perform preview)
   end;
if (work_path<>'') and (work_path<>'-w') then
   begin
   if work_path[length(work_path)]=DirectorySeparator then setlength(work_path,length(work_path)-1);
   work_path:=stringdelim(checkescapedoutname(escapefilename(work_path,desk_env)));
   end;
if work_path<>'' then cl:=cl+' '+work_path;
cl:=cl+' '+out_param+' '+in_param+' '+exclude_param;//+' '+include_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_arc_cl:=0;
end;

procedure set_outpath_preview(var out_param:ansistring);
var
   ptestf:file of byte;
   ptest:ansistring;
begin
case work_dir of
   //0: already set to output path
   1: out_param:=peaziptmpdirroot+STR_PZWORKTMP+DirectorySeparator;//in temp
   2: out_param:=peaziptmpdirroot+STR_PZWORKTMP+DirectorySeparator;//in temp
   3: out_param:=peaziptmpdirroot+STR_PZWORKTMP+DirectorySeparator;//already set to custom work path
   4: out_param:=peaziptmpdirroot+STR_PZWORKTMP+DirectorySeparator;//in temp
   //5: "none (no preview)" disallow preview (checked in main function)
   end;
forcedirectories(out_param);
ptest:=out_param;
if check7zvolume(ptest)=true then //when browsing units as archive, use a default temp output location
   begin
   {$IFDEF MSWINDOWS}
   out_param:=local_desktop;
   {$ELSE}
   get_usrtmp_path(out_param);
   {$ENDIF}
   exit;
   end;
if ptest<>'' then
   if ptest[length(ptest)]<>directoryseparator then ptest:=ptest+directoryseparator;
ptest:=ptest+STR_TESTOUT+inttohex(random(16000000),6);
try
   assignfile(ptestf,ptest);
   {$I-} Reset(ptestf); {$I+}
   if IOResult<>0 then Rewrite(ptestf);
   closefile(ptestf);
   udeletefile(ptest);
except
   {$IFDEF MSWINDOWS}
   out_param:=local_desktop;
   {$ELSE}
   get_usrtmp_path(out_param);
   {$ENDIF}
   try
      closefile(ptestf);
   except
   end;
   try
      udeletefile(ptest);
   except
   end;
end;
end;

function test_outpath(out_param:ansistring):integer;
var
   ptestf:file of byte;
   ptest:ansistring;
   d:char;
   j:integer;
begin
test_outpath:=-1;
ptest:=out_param;
if ptest<>'' then
   if ptest[length(ptest)]<>directoryseparator then ptest:=ptest+directoryseparator;
ptest:=ptest+STR_TESTOUT+inttohex(random(16000000),6);
{$IFDEF MSWINDOWS}
if (ptest=txt_mypc) or (ptest='Compter''s root') then exit;
d:=ptest[1];
if d<>directoryseparator then
   begin
   j:=ord(upcase(d))-64;
   if j>2 then
      if diskfree(j)<1024 then
         begin
         test_outpath:=1;
         exit;
         end;
   end;
{$ENDIF}
try
   assignfile(ptestf,ptest);
   {$I-} Reset(ptestf); {$I+}
   if IOResult<>0 then Rewrite(ptestf);
   closefile(ptestf);
   udeletefile(ptest);
   test_outpath:=0;
except
   try
      closefile(ptestf);
   except
   end;
   try
      udeletefile(ptest);
   except
   end;
end;
end;

function select_outpath:integer;
begin
select_outpath:=-1;
if not(checkdirexists(FormPeach.SelectDirectoryDialog1.FileName)) then FormPeach.SelectDirectoryDialog1.FileName:=local_desktop;
if FormPeach.SelectDirectoryDialog1.FileName='' then FormPeach.SelectDirectoryDialog1.FileName:=local_desktop;
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      begin
      FormPeach.EditOutExtract.Text:=FormPeach.SelectDirectoryDialog1.FileName;
      if FormPeach.EditOutExtract.Text<>'' then
         if FormPeach.EditOutExtract.Text[length(FormPeach.EditOutExtract.Text)]<>directoryseparator then
            FormPeach.EditOutExtract.Text:=FormPeach.EditOutExtract.Text+directoryseparator;
      end
   else exit
else exit;
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
create_ptmpcode(ptmpcode);
select_outpath:=0;
end;

function control_outpath(var out_param:ansistring):integer;
var
   s:ansistring;
   i:integer;
begin
control_outpath:=-1;
uacneeded:=false;
if pos(STR_TMP,out_param)<>0 then out_param:=copy(out_param,0,pos(STR_TMP,out_param)-1);
i:=test_outpath(out_param);
if i<>0 then
   begin
   {$IFDEF MSWINDOWS}
   if (winver='nt6+') and (i<0) then
      begin
      uacneeded:=true;
      control_outpath:=0;
      exit;
      end;
   {$ENDIF}
   s:=out_param+' '+txt_2_4_path;
   if pMessageWarningYesNo(s)=6 then
      begin
      if select_outpath=0 then out_param:=FormPeach.EditOutExtract.Text
      else exit;
      end
   else exit;
   end;
control_outpath:=0;
end;

function select_outpath_archive:integer;
begin
select_outpath_archive:=-1;
if not(checkdirexists(FormPeach.SelectDirectoryDialog1.FileName)) then FormPeach.SelectDirectoryDialog1.FileName:=local_desktop;
if FormPeach.SelectDirectoryDialog1.FileName='' then FormPeach.SelectDirectoryDialog1.FileName:=local_desktop;
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      begin
      FormPeach.EditAddFilepath.Text:=FormPeach.SelectDirectoryDialog1.FileName;
      if FormPeach.EditAddFilepath.Text<>'' then
         if FormPeach.EditAddFilepath.Text[length(FormPeach.EditAddFilepath.Text)]<>directoryseparator then
            FormPeach.EditAddFilepath.Text:=FormPeach.EditAddFilepath.Text+directoryseparator;
      end
   else exit
else exit;
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
create_ptmpcode(ptmpcode);
select_outpath_archive:=0;
end;

function testuac(s:ansistring):boolean;
var
   i:integer;
begin
Result:=false;
{$IFDEF MSWINDOWS}
i:=test_outpath(s);
if i<>0 then
   if (winver='nt6+') and (i<0) then Result:=true;
{$ENDIF}
end;

function control_outpath_archive(var out_param:ansistring):integer;
var
   s:ansistring;
   i:integer;
begin
control_outpath_archive:=-1;
uacneeded:=false;
if pos(STR_TMP,out_param)<>0 then out_param:=copy(out_param,0,pos(STR_TMP,out_param)-1);
i:=test_outpath(out_param);
if i<>0 then
   begin
   {$IFDEF MSWINDOWS}
   if (winver='nt6+') and (i<0) then
      begin
      uacneeded:=true;
      control_outpath_archive:=0;
      exit;
      end;
   {$ENDIF}
   s:=out_param+' '+txt_2_4_path;
   if pMessageWarningYesNo(s)=6 then
      begin
      if select_outpath_archive=0 then out_param:=FormPeach.EditAddName.Text
      else exit;
      end
   else exit;
   end;
control_outpath_archive:=0;
end;

procedure set_output_option(var out_param:ansistring);
begin
if FormPeach.CheckBoxSameExt.State=cbChecked then
   begin
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
      out_param:=extractfilepath(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
   else
     out_param:=extractfilepath(FormPeach.EditOpenIn.Text);
   end
else out_param:=FormPeach.EditOutExtract.Text;
if out_param='' then out_param:=local_desktop;
if out_param<>'' then
   if out_param[length(out_param)] <> directoryseparator then out_param:=out_param+directoryseparator;
end;

procedure set_output_folder(var out_param:ansistring; in_param:ansistring; real_extract:boolean; action:integer; mode:ansistring);
var
   s,s0,s1:ansistring;
   i:integer;
   out_created:boolean;
begin
if (mode='info') or (mode='list') or (mode='test') or (mode='delete') or (mode='preview') then exit;
out_created:=false;
origout:=out_param;
if FormPeach.CheckBoxFolder.State=cbChecked then
      begin
      if action<2 then
         begin
         forcedirectories(out_param);
         s1:=extractfilename(in_param);
         cutenddelim(s1,in_param);
         if (extractfileext(s1)='.001') or (extractfileext(s1)='.001'+delimiter) then cutextension(s1);
         if extractfileext(s1)<>'' then cutextension(s1) else cutendforbid(s1);
         if upcase(extractfileext(s1))='.TAR' then cutextension(s1) else cutendforbid(s1);
         cutendspaces(s1);
         cutenddot(s1);
         if (extractfileext(s1)='.part1') or (extractfileext(s1)='.part1'+delimiter) then cutextension(s1);
         s0:=out_param;
         if s0[length(s0)]<>directoryseparator then s0:=s0+directoryseparator;
         s:=s0+s1;
         i:=0;
         repeat
            if not(checkdirexists(s) or fileexists(s)) then
            try
               forcedirectories(s); //will fail if path requires elevation, that is granted later, so it is checked only for exceptions
               out_created:=true;
            except
               s:=s0+'output';
               out_created:=true;
            end
            else
               begin
               i:=i+1;
               s:=s0+s1+NAMEVARSTR+inttostr(i);
               if i=1000 then //to break recursivity if filename is not valid (ie unsupported character encoding)
                  begin
                  s:=s0+'output';
                  out_created:=true;
                  end;
               end;
         until out_created=true;
         if copy(s,length(s),1)<>directoryseparator then s:=s+directoryseparator;
         out_param:=s;
         removedir(s); //output folder is created on the fly
         end;
      end;
origoutnf:=out_param;
if fun='UN7Z' then //7Z backend only
begin
if (FormPeach.CheckBoxrelative.checked=true) and //extra path to extract and then move to relative path
   (FormPeach.CheckBoxrelative.enabled=true) and
   (FormPeach.CheckBoxFolder.Checked=false) and
   (FormPeach.ComboBoxActionExtract.ItemIndex<2) and//extraction operations
   (FormPeach.LabelStatusExtract.Caption<>'') then//not for operations outside extraction screen e.g. conversion
   willbemoved:=true;
if (forcewillbemoved=true) //require move
   and (FormPeach.ComboBoxActionExtract.ItemIndex<2) //extraction operations
   then willbemoved:=true;
if forcenotwillbemoved=true then willbemoved:=false;
if willbemoved=true then //must be set to false at the end of extraction operation
   begin
      move_out_param:=out_param;
      case work_dir of
         //0: already set to output path
         //1: already set to output path
         2: out_param:=peaziptmpdirroot+STR_PZWORKTMP+directoryseparator;//in temp
         3: out_param:=peaziptmpdirroot+STR_PZWORKTMP+directoryseparator;//already set to custom work path
         4: out_param:=peaziptmpdirroot+STR_PZWORKTMP+directoryseparator;//in temp
         5: begin move_out_param:=''; forcenotwillbemoved:=true; exit; end; //temporary files disallowed, fall back to standard extraction
         end;
      forcedirectories(out_param);
      s:=out_param+STR_TMPEXT+inttohex(random(16000000),6);
      if copy(s,length(s),1)<>directoryseparator then s:=s+directoryseparator;
      out_param:=s;
      removedir(s); //output folder is created on the fly
   end;
end;
origouttf:=out_param;
end;

function compose_unarc_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
//mode: neutral (read in options), ext, extandrun, list, info, test, (add is in compose_archive_cl only), delete, draganddrop
//selection: all, displayed (apply filters), selected (evaluate selected), single (single selected object)
var
   filter1,out_param,in_param,bin_name,archive_function,overwrite_policy,pw:ansistring;
   i:integer;
   contains_folder,checksel:boolean;
begin
compose_unarc_cl:=-1;
subfun:='extract';
btfun:='unarc';
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   begin
   if (mode='ext') or (mode='extandrun') or (mode='draganddrop') or ((mode='neutral') and (FormPeach.ComboBoxActionArc.ItemIndex<2)) then
      if control_outpath(out_param)<>0 then exit;
   end;
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator; //needed for set_output_folder, removed later as arc doesn't want directoryseparator as last character
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
if mode<>'delete' then
   if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,FormPeach.ComboBoxActionArc.ItemIndex,mode);
if out_param<>'' then
   if out_param[length(out_param)]=directoryseparator then setlength(out_param,length(out_param)-1); //arc doesn't want directoryseparator as last character
//overwrite policy
case FormPeach.ComboBoxOverwriteARC.ItemIndex of
   0: begin overwrite_policy:='-op'; if zaout=2 then zaout:=1; end;//ask auto switch to GUI+console mode if needed
   1: overwrite_policy:='-o+';//overwrite
   2: overwrite_policy:='-o-';//skip
   end;
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
   pw:=FormPW.EditPWpass.Text;
   if FormPW.EditPWkeyfile.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
pforceconsole:=0;
if pw<>'' then
   begin
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      pforceconsole:=1;
      pw:='';
      //exit;
      end;
   end
else if zaout>0 then pw:='-pdefault';
//NOTE: fake password parameter DOES NOT WORK FOR ARC: extraction waits for console interactive input if no or wrong password is provided
//ARC needs correct pw / keyfile provided in advance, or to be run in console mode
//archive function
case mode of
   'neutral' :
   case FormPeach.ComboBoxActionArc.ItemIndex of
      0: archive_function:='x';
      1: archive_function:='e';
      2: begin
         archive_function:='l';
         subfun:='list';
         end;
      3: begin
         archive_function:='v';
         subfun:='list';
         end;
      4: begin
         archive_function:='t';
         subfun:='test';
         end;
      5: begin
         archive_function:='r';
         subfun:='test';//can be treated like test mode
         end;
      end;
   'delete' : //delete special feature, replaces archive function and overwrite policy
   begin
   archive_function:='d';
   overwrite_policy:='';
   end;
   'list' :
   begin
   archive_function:='l';
   subfun:='list';
   end;
   'info' :
   begin
   archive_function:='v';
   subfun:='list';
   end;
   'test' :
   begin
   archive_function:='t';
   subfun:='test';
   end;
   'ext' : archive_function:='x';
   'draganddrop' : archive_function:='x';
   end;
if (archive_function='x') and (status0<>txt_list_flat) then //set optional ignore paths for displayed or selected objects, if a directory is in the group the rule is overrieddn and x function is used to preserve paths structure
   begin
   if (selection='displayed') and (ignorepathdisp=1) then
      begin
      contains_folder:=false;
      i:=1;
      while (i<FormPeach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then contains_folder:=true;
         i:=i+1;
         end;
      if contains_folder=false then archive_function:='e';
      end;
   if ((selection='selected') and (mode<>'draganddrop') and (ignorepathsel=1)) or ((selection='selected') and (mode='draganddrop') and (ignorepathdd=1)) then
      begin
      contains_folder:=false;
      i:=1;
      while (i<FormPeach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if FormPeach.StringGridList.Cells[16,i]='1' then
            if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then contains_folder:=true;
         i:=i+1;
         end;
      if contains_folder=false then archive_function:='e';
      end;
   end;
if mode='extandrun' then //extandrun special feature, replaces archive function and overwrite policy: always extract the object, to be opened immediately after; if the object exist, ask about overwriting or skipping it
   begin
   if archive_function='e' then //extract without paths
      begin
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   if ignorepathextand=1 then //option ignore archived paths for Extract and... override standard path policy; checking it it's possible ignoring paths only for Extract and... functions
      begin
      archive_function:='e';
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end;
   if FormPeach.StringGridList.Cells[2,FormPeach.StringGridList.Row]=txt_list_isfolder then //if the object is a directory, paths are always preserved (this rule override all other rules)
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   //if selection='displayed' then tempstring:=ExtractFilePath(tempstring);
   if fileexists((out_param+tempstring)) then
         if pMessageWarningYesNo(out_param+tempstring+' '+txt_confirm_overwrite)<>6 then exit;
   overwrite_policy:='-o+';
   end;
if mode='preview' then //preview special feature, replaces archive function and overwrite policy as 'extract and...' but never ignores paths
   begin
   archive_function:='x';
   tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   //if selection='displayed' then tempstring:=ExtractFilePath(tempstring);
   {$IFDEF MSWINDOWS}tempstring:=StringReplace(tempstring,':','_', [rfReplaceAll]);{$ENDIF}
   overwrite_policy:='-o+';
   end;
if (archive_function<>'x') and (archive_function<>'e') then //clear overwrite policies for non extraction modes
   begin
   overwrite_policy:='';
   out_param:='';
   end;
//end archive function attribution
if out_param<>'' then out_param:=stringdelim('-dp'+escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'arc'+DirectorySeparator+'arc'+EXEEXT);
if sys7zlin>1 then bin_name:='arc'+EXEEXT;
cl:=bin_name+' '+archive_function;
if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
in_param:=stringdelim(escapefilename(in_param,desk_env));
cl:=cl+' '+in_param;
if intpw=1 then
   begin
   pw:='';
   pforceconsole:=1;
   end;
if pw<>'' then cl:=cl+' '+pw;
if out_param<>'' then cl:=cl+' '+out_param;
//filter(s)
if selection='all' then //apply only advanced filter(s), if used
   if FormAdvf.CheckBoxAdvFilters.State=cbChecked then adv_filters(cl);
if selection='displayed' then //apply advanced filters, if used, or basic filters (but without excludes, in order to extract also all nested objects)
   if FormAdvf.CheckBoxAdvFilters.State=cbChecked then adv_filters(cl)
   else
      if FormPeach.EditUn7zaFilter.Text<>'' then
         begin
         if FormPeach.cbUn7zaRecursive.State=cbChecked then cl:=cl+' -r';
         filter1:=FormPeach.EditUn7zaFilter.Text;
         //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' -- '+stringdelim(escapefilename(filter1,desk_env));
         end;
if selection='selected' then //extract object in the range of selection
   begin
   cl:=cl+' --';
   checksel:=false;
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   begin
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         filter1:=FormPeach.StringGridList.Cells[12,i];
         //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+stringdelim(escapefilename(filter1,desk_env));
         checksel:=true;
         end;
   end
   else
   for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
      begin
      if checkfiledirname(FormPeach.StringGridExtract.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridExtract.Cells[8,i]); exit; end;
      filter1:=FormPeach.StringGridExtract.Cells[8,i];
      //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
      cl:=cl+' '+stringdelim(escapefilename(filter1,desk_env));
      checksel:=true;
      end;
   if checksel=false then exit;
   end;
if ((mode='extandrun') or (mode='preview')) and (selection='single') then //extract a single object
   begin
   if checkfiledirname(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]); exit; end;
   filter1:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
   cl:=cl+' -- '+stringdelim(escapefilename(filter1,desk_env));
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unarc_cl:=0;
end;

function compose_custom_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   s,out_param,in_param,param_param,bin_name,ext_param,pw_option,pw,archive_function,work_path:ansistring;
   i:integer;
   vol_size:qword;
   name_ok:boolean;
begin
compose_custom_cl:=-1;
fun:='CUSTOM';
subfun:='archive';
btfun:='custom';
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;
//check for custom executable's name
if (FormPeach.EditnameCustom.Text='') or (FormPeach.EditnameCustom.Text=' ') then
   begin
   pMessageWarningOK(txt_custom_executable_missing);
   exit;
   end;
//check if input is suitable for chosen archive_type
if check_input<>0 then exit;
ext_param:=FormPeach.EditExtensionCustom.Text;
//output name
getarch_baseoutname(s);
if specialmoderar<>1 then
   begin
   if ExtractFileExt(s)<>'.'+ext_param then
      out_param:=s+'.'+ext_param
   else
      out_param:=s;
   end
else
   out_param:=s;
specialmoderar:=0;
apply_timestamptoname(out_param,1,0,'file');
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
getworkpath(work_path,out_param);
bin_name:=stringdelim(escapefilename(FormPeach.EditnameCustom.Text,desk_env));
//mgotypeRAR parameters begin
if (havewinrar=true) and (userar=1) then
   begin
   case FormPeach.cbAct.ItemIndex of
   0: begin
      archive_function:='a';
      if FormPeach.cbSplit.ItemIndex=0 then get_new_archive_name(out_param)//single archive
      else //multi volume archive
         begin
         if (fileexists(out_param+'.001') or fileexists(out_param) or checkdirexists(out_param+'.001') or checkdirexists(out_param)) then
            begin
            i:=1;
            name_ok:=false;
            s:=out_param;
            cutextension(s);
            repeat
               if (fileexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)+'.001') or fileexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)) or checkdirexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)+'.001') or checkdirexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param))) then inc(i,1)
               else name_ok:=true;
            until name_ok = true;
            out_param:=s+NAMEVARSTR+inttostr(i)+extractfileext(out_param);
            end;
         end;
      if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
      end;
   1: archive_function:='a';
   2: archive_function:='u';
   3: archive_function:='f'; //freshen update only intems already in the archive
   4: archive_function:='a -as'; //sync with disk, add to archive existing files and delete non existing files
   end;
   FormPeach.EditOPcustom.Caption:=archive_function+' -ep1';
   //mgotypeRAR compression level
   case FormPeach.cbLevel.ItemIndex of
      0: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -m0';
      1: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -m1';
      2: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -m2';
      3: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -m3';
      4: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -m4';
      5: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -m5';
   end;
   //mgotypeRAR encryption
   if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
      if FormPW.CheckBoxEncFn.State=cbChecked then pw_option:='-hp'
      else pw_option:='-p'
   else
      pw_option:='';
   pforceconsole:=0;
   pipepw:='';
   piperar:=true;
   if pw_option<>'' then
         begin
         pw:=FormPW.EditPWpass.Text;
         if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
            if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
               begin
               pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
               exit;
               end;
         if zaout=2 then pipepw:=pw;
         if pw4cl(pw_option,pw)<>0 then
            begin
            msg_pw_errorchar(pw);
            pforceconsole:=1;
            pw:=pw_option;
            end;
         end;
   if intpw=1 then
      begin
      pforceconsole:=1;
      if (setencfn=1) then
         pw:='-hp'
      else
         pw:='-p';
      end;
   if pw<>'' then
      if (pipepw<>'') and (consolecl=false) then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' '+pw_option
      else FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' '+pw;
   //mgotypeRAR split
   case FormPeach.cbSplit.ItemIndex of
   0: vol_size:=0; //will trigger to not use -v(size) switch
   1: begin
      try
         vol_size:=FormPeach.SpinEditSplit.Value;
         case FormPeach.ComboBoxSplit.ItemIndex of
            1: vol_size:=vol_size*1024;
            2: vol_size:=vol_size*1024*1024;
            3: vol_size:=vol_size*1024*1024*1024;
            end;
      except
         pMessageWarningOK(txt_chunk_size);
         exit;
      end;
      end;
   2: vol_size:=1457664;//FD
   3: vol_size:=10*1024*1024;//limit for attachment size of some mail services
   4: vol_size:=25*1024*1024;//limit for attachment size of most mail services
   5: vol_size:=650*1024*1024;//CD 650 MB
   6: vol_size:=700*1024*1024;//CD 700 MB
   7: vol_size:=4092*1024*1024;//max file size for FAT32 filesystem
   8: vol_size:=4480*1024*1024;//size DVD+R
   9: vol_size:=8128*1024*1024;//size for DVD-R DL
   10: vol_size:=23040*1024*1024;//size for Blu-Ray
   11: vol_size:=23040*1024*1024*2;//size for Blu-Ray DL
   12: vol_size:=23040*1024*1024*4;//size for Blu-Ray XL3
   13: vol_size:=23040*1024*1024*5;//size for Blu-Ray XL4
   end;
   if vol_size<>0 then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -v'+inttostr(vol_size)+'b';
   //peazip's work path
   if work_path<>'' then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' '+work_path;
   //advanced
   if FormPeach.cbRAR5.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -ma5'
   else FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -ma4';//RAR5 (default) or RAR4 if unchecked
   if FormPeach.cbRAR5.Checked=true then
      begin
      FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -md'+FormPeach.comboRARdict.Caption+'m';
      if FormPeach.cbRARBLAKE2.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -htb'
      else FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -htc'; //BLAKE2 hash if checked, CRC (default) if unchecked
      end;
   if FormPeach.cbRARsfx.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -sfx';
   if FormPeach.cbRARsolid.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -s';
   if FormPeach.cbRARrr.Checked=true then
      FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -rr'+inttostr(puserarrr)+'p';
   if FormPeach.cbRARrv.Checked=true then
      FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -rv'+inttostr(puserarrv);
   if FormPeach.cbRARsaveopen.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -dh';
   if FormPeach.cbRARsavesecurity.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -ow';
   {$IFDEF MSWINDOWS}if FormPeach.cbRARsavestreams.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -os';{$ENDIF}//not supported on non-Windows systems
   case FormPeach.cbRARlastmodtime.ItemIndex of
      1: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -tk';
      2: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -tl';
      end;
   if FormPeach.cbRARlock.Checked=true then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -k';
   if (storecreated=1) then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -ts';
   end;
//mgotypeRAR mgotypeRAR parameters end
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
get_in_param(in_param,sel);
if length(in_param)>2 then
   if (in_param[length(in_param)-1]='*') or (in_param[length(in_param)-2]='*') then
      FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -r';
param_param:=FormPeach.EditOPCustom.Caption;
if (havewinrar=true) and (userar=1) then
   cl:=bin_name+' '+param_param+' -- '+out_param+' '+in_param //fixed syntax style for mgotypeRAR.exe
else
   case FormPeach.ComboBoxArchiveCustom.ItemIndex of
   0: cl:=bin_name+' '+param_param+' '+in_param+' '+out_param;
   1: cl:=bin_name+' '+param_param+' '+out_param+' '+in_param;
   2: cl:=bin_name+' '+in_param+' '+param_param+' '+out_param;
   3: cl:=bin_name+' '+in_param+' '+out_param+' '+param_param;
   4: cl:=bin_name+' '+out_param+' '+param_param+' '+in_param;
   5: cl:=bin_name+' '+out_param+' '+in_param+' '+param_param;
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_custom_cl:=0;
end;

function compose_rarspecfun_cl(var cl,jobcode,outname:ansistring; specfun:ansistring):integer;
var
   filter1,out_param,in_param,param_param,bin_name,ext_param,pw_option,pw,archive_function,work_path:ansistring;
   i:integer;
begin
result:=-1;
if (havewinrar<>true) or (userar<>1) then exit;
ext_param:='rar';
//output name
out_param:=FormPeach.EditOpenIn.Text;
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
getworkpath(work_path,out_param);
bin_name:=stringdelim(escapefilename(FormPeach.EditnameCustom.Text,desk_env));
archive_function:=specfun;
FormPeach.EditOPcustom.Caption:=archive_function;
if archive_function='r' then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -y';
case FormPeach.cbRARlastmodtime.ItemIndex of
   1: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -tk';
   2: FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' -tl';
   end;
//encryption
if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
   if FormPW.CheckBoxEncFn.State=cbChecked then pw_option:='-hp'
   else pw_option:='-p'
else
   pw_option:='';
pipepw:='';
piperar:=true;
if pw_option<>'' then
   begin
   pw:=FormPW.EditPWpass.Text;
   if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
   if zaout=2 then pipepw:=pw;
   if pw4cl(pw_option,pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      exit;
      end;
   end;
if (intpw=1) and (specfun<>'k') then //lock disabled, as a suitable fast unlock command is missing
   begin
   pforceconsole:=1;
   if (setencfn=1) then
      pw:='-hp'
   else
      pw:='-p';
   end;
{if pw<>'' then
   if (pipepw<>'') and (consolecl=false) then
      //FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' '+pw_option
   else FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' '+pw;}//does not create console script
//peazip's work path
if work_path<>'' then FormPeach.EditOPcustom.Caption:=FormPeach.EditOPcustom.Caption+' '+work_path;
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
param_param:=FormPeach.EditOPCustom.Caption;
cl:=bin_name+' '+param_param+' -- '+out_param;
if archive_function='r' then cl:=cl+' '+stringdelim(escapefilename(extractfilepath(FormPeach.EditOpenIn.Text),desk_env));
if archive_function='d' then
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         filter1:=FormPeach.StringGridList.Cells[12,i];
         //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+stringdelim(escapefilename(filter1,desk_env));
         end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
result:=0;
end;

function compose_arcspecfun_cl(var cl,jobcode,outname:ansistring; specfun:ansistring):integer;
var
   out_param,in_param,bin_name,pw_option,pw,archive_function:ansistring;
   i:integer;
begin
compose_arcspecfun_cl:=-1;
//output name
out_param:=FormPeach.EditOpenIn.Text;
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'arc'+DirectorySeparator+'arc'+EXEEXT);
if sys7zlin>1 then bin_name:='arc'+EXEEXT;
archive_function:=specfun;
if archive_function='r' then archive_function:=archive_function+' -y';
cl:=bin_name+' '+archive_function;
//encryption
if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
   if FormPW.CheckBoxEncFn.State=cbChecked then pw_option:='-hp'
   else pw_option:='-p'
else
   pw_option:='';
if pw_option<>'' then
   begin
   pw:=FormPW.EditPWpass.Text;
   if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
      if pw4cl(pw_option,pw)<>0 then
         begin
         msg_pw_errorchar(pw);
         exit;
         end;
      end;
if intpw=1 then
   begin
   pforceconsole:=1;
   if (setencfn=1) then
      pw:='-hp'
   else
      pw:='-p';
   end;
if pw<>'' then cl:=cl+' '+pw;
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
cl:=cl+' -- '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_arcspecfun_cl:=0;
end;

function compose_uncustom_cl(var cl,jobcode,outname:ansistring; real_extract:boolean):integer;
var
   out_param,in_param,param_param,bin_name:ansistring;
begin
compose_uncustom_cl:=-1;
//check for custom executable's name
if (FormPeach.EditNameCustomExt.Text='') or (FormPeach.EditNameCustomExt.Text=' ') then
   begin
   pMessageWarningOK(txt_custom_executable_missing);
   exit;
   end;
subfun:='extract';
btfun:='uncustom';
set_output_option(out_param);
if control_outpath(out_param)<>0 then exit;
if out_param<>'' then
   if out_param[length(out_param)] <> directoryseparator then out_param:=out_param+directoryseparator;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
set_output_folder(out_param,in_param,real_extract,0,'ext');
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
if fileexists(out_param) then
   if real_extract=true then
      if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
      else
         clearfile(out_param); //avoid the custom program have to handle overwriting existing files since some programs may not be capable or not return error exit code
in_param:=stringdelim(escapefilename(in_param,desk_env));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(FormPeach.EditNameCustomExt.Text,desk_env));
if FormPeach.EditCustomParamExt.Text<>'' then param_param:=FormPeach.EditCustomParamExt.Text else param_param:='';
case FormPeach.ComboBoxCustomSyntaxExt.ItemIndex of
   0: cl:=bin_name+' '+param_param+' '+in_param+' '+out_param;
   1: cl:=bin_name+' '+param_param+' '+out_param+' '+in_param;
   2: cl:=bin_name+' '+in_param+' '+param_param+' '+out_param;
   3: cl:=bin_name+' '+in_param+' '+out_param+' '+param_param;
   4: cl:=bin_name+' '+out_param+' '+param_param+' '+in_param;
   5: cl:=bin_name+' '+out_param+' '+in_param+' '+param_param;
   end;

if FormPeach.EditNameCustomExt.Text='Extrac32' then
   if (useextrac32=1) and (libre_directive=0) then
      cl:=bin_name+' '+param_param+' /E '+in_param+' /L '+out_param;

jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_uncustom_cl:=0;
end;

function test_canbechanged(s:ansistring):integer; //1 it's an explicitly supported file type 0 no, it should be protected from editing
var fext:ansistring;
begin
result:=0;
//if pspecbrowse<>'' then exit;
fext:=upcase(extractfileext(s));
case fext of
   '.7Z': result:=1;
   '.EXE': result:=1;
   '.WIM': result:=1;
   '.TAR': result:=1;
   '.ZIP': result:=1;
   '.ZIPX': result:=1;
   '.ARC': result:=1;
   '.ZPAQ': result:=1;
   '.RAR': if (havewinrar=true) and (userar=1) then result:=1;
   end;
end;

function test_forcechanged(s:ansistring):integer; //1 changes are forced (force changes option is on and file is not supported) 0 no
begin
result:=0;
if forcecanbechanged=1 then
   if test_canbechanged(s)=0 then result:=1;
end;

function test_forceeditunsupported(s:ansistring):integer;//1 changes are forced
begin
result:=0;
if forcecanbechanged=1 then result:=1;
   //if (testinput(s,false)=0) then result:=1;
end;

function setarchivecomplevel(s,s1:ansistring):ansistring;
begin
case s of
   'Brotli':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx0';
   if s1=txt_level_fast then result:='-mx1';
   if s1=txt_level_normal then result:='-mx3';
   if s1=txt_level_maximum then result:='-mx7';
   if s1=txt_level_ultra then result:='-mx11';
   end;
   'FLZMA':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx1';
   if s1=txt_level_fast then result:='-mx2';
   if s1=txt_level_normal then result:='-mx3';
   if s1=txt_level_maximum then result:='-mx7';
   if s1=txt_level_ultra then result:='-mx9';
   end;
   'Lizard_fastLZ4':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx10';
   if s1=txt_level_fast then result:='-mx12';
   if s1=txt_level_normal then result:='-mx14';
   if s1=txt_level_maximum then result:='-mx16';
   if s1=txt_level_ultra then result:='-mx19';
   end;
   'Lizard_LIZv1':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx20';
   if s1=txt_level_fast then result:='-mx22';
   if s1=txt_level_normal then result:='-mx24';
   if s1=txt_level_maximum then result:='-mx26';
   if s1=txt_level_ultra then result:='-mx29';
   end;
   'Lizard_fastLZ4+Huffman':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx30';
   if s1=txt_level_fast then result:='-mx32';
   if s1=txt_level_normal then result:='-mx34';
   if s1=txt_level_maximum then result:='-mx36';
   if s1=txt_level_ultra then result:='-mx39';
   end;
   'Lizard_LIZv1+Huffman':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx40';
   if s1=txt_level_fast then result:='-mx42';
   if s1=txt_level_normal then result:='-mx44';
   if s1=txt_level_maximum then result:='-mx46';
   if s1=txt_level_ultra then result:='-mx49';
   end;
   'LZ4':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx1';
   if s1=txt_level_fast then result:='-mx2';
   if s1=txt_level_normal then result:='-mx4';
   if s1=txt_level_maximum then result:='-mx8';
   if s1=txt_level_ultra then result:='-mx12';
   end;
   'LZ5':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx1';
   if s1=txt_level_fast then result:='-mx3';
   if s1=txt_level_normal then result:='-mx5';
   if s1=txt_level_maximum then result:='-mx9';
   if s1=txt_level_ultra then result:='-mx15';
   end;
   'Zstd':
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx1';
   if s1=txt_level_fast then result:='-mx2';
   if s1=txt_level_normal then result:='-mx3';
   if s1=txt_level_maximum then result:='-mx11';
   if s1=txt_level_ultra then result:='-mx22';
   end;
   else
   begin
   if s1=txt_level_store then result:='-mx0';
   if s1=txt_level_fastest then result:='-mx1';
   if s1=txt_level_fast then result:='-mx3';
   if s1=txt_level_normal then result:='-mx5';
   if s1=txt_level_maximum then result:='-mx7';
   if s1=txt_level_ultra then result:='-mx9';
   end;
   end;
end;

function setarchivecompleveln(s:ansistring;i:integer):ansistring;
begin
case i of
 0: result:=setarchivecomplevel(s,txt_level_store);
 1: result:=setarchivecomplevel(s,txt_level_fastest);
 2: result:=setarchivecomplevel(s,txt_level_fast);
 3: result:=setarchivecomplevel(s,txt_level_normal);
 4: result:=setarchivecomplevel(s,txt_level_maximum);
 5: result:=setarchivecomplevel(s,txt_level_ultra);
end;
end;

function compose_archive_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   i:integer;
   s,out_param,in_param,exclude_param,include_param,archive_function,solid_option,pw_option,pw,pw2_option,mail_option,
   sfx_option,bin_name,type_option,compressor_option,mmemuse,thread_option,dictionary_option,compmethodstr,
   word_option,passes_option,compression_level,encalgo,openfiles_option,snoi_option,
   snon_option,sccenc,work_path,mcu_option,path_option,psni,psns,psnh,psnl,paramtime:ansistring;
   vol_size:qword;
   name_ok:boolean;
   cla: array of ansistring;
begin
compose_archive_cl:=-1;
fun:='7Z';
subfun:='archive';
btfun:='7z';
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;
//check if input is suitable for chosen archive_type
if check_input<>0 then exit;
if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) then begin end //single input file
else //folder(s) and/or multiple files
   begin
   if (archive_type='bz2') or (archive_type='gz') or (archive_type='xz') then
   if (FormPeach.CheckBoxSeparate.State=cbUnchecked) or (FormPeach.CheckBoxSeparate.Enabled=false) then
      begin
      pMessageWarningOK(archive_type+' '+txt_error_input_multi);
      exit;
      end;
   end;
//output name
getarch_baseoutname(s);
if (FormPeach.CheckBox7zSFX.State=cbChecked) then
   if updatingarchive_inarchive=false then out_param:=s+'.exe'
   else out_param:=s
else out_param:=s+'.'+archive_type;
//zipx special case
if updatingarchive_inarchive=false then
   begin
   if archive_type='zip' then
      if (FormPeach.ComboBox7zMethod.Text<>'Deflate') and (FormPeach.ComboBox7zMethod.Text<>'Deflate64') then
         if swzipx=1 then
            begin
            cutextension(out_param);
            out_param:=out_param+'.zipx';
            end;
   end
else
   if (archive_type='zip') and (upcase(extractfileext(FormPeach.EditOpenIn.Caption))='.ZIPX') then
      begin
      cutextension(out_param);
      out_param:=out_param+'.zipx';
      end;
apply_timestamptoname(out_param,1,0,'file');
//archive function
archive_function:='a';
case FormPeach.ComboBox7zFun.ItemIndex of
   0: begin
      archive_function:='a';
      if FormPeach.cbSplit.ItemIndex=0 then get_new_archive_name(out_param)//single archive
      else //multi volume archive
         begin
         if (fileexists(out_param+'.001') or fileexists(out_param) or checkdirexists(out_param+'.001') or checkdirexists(out_param)) then
            begin
            i:=1;
            name_ok:=false;
            s:=out_param;
            cutextension(s);
            repeat
               if (fileexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)+'.001') or fileexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)) or checkdirexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)+'.001') or checkdirexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param))) then inc(i,1)
               else name_ok:=true;
            until name_ok = true;
            out_param:=s+NAMEVARSTR+inttostr(i)+extractfileext(out_param);
            end;
         end;
      end;
   1: archive_function:='a';
   2: archive_function:='u';
   3: archive_function:='u -up1q1r0x1y2z1w2'; //update only intems already in the archive
   4: archive_function:='u -up0q0r2x1y2z1w2'; //sync archive with disk (update existing items, remove non existing items)
   end;
if updatingarchive_inarchive=true then
   if test_forcechanged(cutext(out_param))=1 then cutextension(out_param);
//solid archive
solid_option:='';
if (archive_type='7z') or (archive_type='xz') then
   begin
   case FormPeach.ComboBox7zSolid.ItemIndex of
   0: solid_option:='-ms=off';
   1: solid_option:='-ms=1m';
   2: solid_option:='-ms=2m';
   3: solid_option:='-ms=4m';
   4: solid_option:='-ms=8m';
   5: solid_option:='-ms=16m';
   6: solid_option:='-ms=32m';
   7: solid_option:='-ms=64m';
   8: solid_option:='-ms=128m';
   9: solid_option:='-ms=256m';
   10: solid_option:='-ms=512m';
   11: solid_option:='-ms=1g';
   12: solid_option:='-ms=2g';
   13: solid_option:='-ms=4g';
   14: solid_option:='-ms=8g';
   15: solid_option:='-ms=16g';
   16: solid_option:='-ms=32g';
   17: solid_option:='-ms=64g';
   18: solid_option:='-ms=on';
   19: solid_option:='-ms=e';
   end;
   if (archive_type='7z') then
      if FormPeach.CheckBoxSolidExtension.State=cbChecked then
         if solid_option<>'-ms=off' then solid_option:=solid_option+' -mqs=on';
   end;
case syntaxstring7z of
'16': if (archive_type='xz') then solid_option:='';
end;
//archive open for writing files option
if FormPeach.CheckBox7zOF.State=cbChecked then openfiles_option:='-ssw' else openfiles_option:='';
if keeppreview=true then openfiles_option:='-ssw';
//Linux store owner/group ids and names
snoi_option:='';
snon_option:='';
if archive_type='tar' then
   begin
   if FormPeach.CheckBoxsnoi.State=cbChecked then snoi_option:='-snoi';
   if FormPeach.CheckBoxsnon.State=cbChecked then snon_option:='-snon';
   end;
case syntaxstring7z of
'21','17','16':
   begin
   snoi_option:='';
   snon_option:='';
   end;
end;
//character encoding
case enc7zscc of
   0: sccenc:='-sccUTF-8';
   1: sccenc:='-sccWIN';
   2: sccenc:='-sccDOS';
   end;
//if archive_type='wim' then sccenc:=''; //seems unsupported or ignored
//encryption
if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
   if (FormPW.CheckBoxEncFn.State= cbChecked) and (archive_type='7z') then
      begin
      pw_option:='-p';
      pw2_option:='-mhe=on';
      end
   else
      begin
      pw_option:='-p';
      pw2_option:='';
      end
else
   begin
   pw_option:='';
   pw2_option:='';
   end;
pforceconsole:=0;
pipepw:='';
piperar:=false;
if pw_option<>'' then
   begin
   pw:=FormPW.EditPWpass.Text;
   if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
   if zaout=2 then pipepw:=pw;
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      pforceconsole:=1;
      pw:='-p';
      //exit;
      end;
   end;
//encryption algorithm
if FormPeach.ComboBox7zalgo.Visible=true then
   if archive_type='zip' then
      case FormPeach.ComboBox7zalgo.Itemindex of
         0: encalgo:='-mem=AES256';
         1: encalgo:=''; //if em is omitted, ZipCrypto is used; omitting the parameter rather than explicitly declare it allows to use transparently also older 7z implementation not supporting that switch, providing the user unckeck the use AES option (or the binary to be recompiled hiding the AES option checkbox)
      end;
//send by mail
if (FormPeach.CheckBoxMailAdd.Enabled=true) and (FormPeach.CheckBoxMailAdd.State=cbChecked) then mail_option:='-seml' else mail_option:='';
if mail_option='-seml' then if FormPeach.CheckBoxMailKeep.State=cbUnChecked then mail_option:=mail_option+'.';
//multi volumes
case FormPeach.cbSplit.ItemIndex of
   0: vol_size:=0; //will trigger to not use -v(size) switch
   1: begin
      try
         vol_size:=FormPeach.SpinEditSplit.Value;
         case FormPeach.ComboBoxSplit.ItemIndex of
            1: vol_size:=vol_size*1024;
            2: vol_size:=vol_size*1024*1024;
            3: vol_size:=vol_size*1024*1024*1024;
            end;
      except
         pMessageWarningOK(txt_chunk_size);
         exit;
      end;
      end;
   2: vol_size:=1457664;//FD
   3: vol_size:=10*1024*1024;//limit for attachment size of some mail services
   4: vol_size:=25*1024*1024;//limit for attachment size of most mail services
   5: vol_size:=650*1024*1024;//CD 650 MB
   6: vol_size:=700*1024*1024;//CD 700 MB
   7: vol_size:=4092*1024*1024;//max file size for FAT32 filesystem
   8: vol_size:=4480*1024*1024;//size DVD+R
   9: vol_size:=8128*1024*1024;//size for DVD-R DL
   10: vol_size:=23040*1024*1024;//size for Blu-Ray
   11: vol_size:=23040*1024*1024*2;//size for Blu-Ray DL
   12: vol_size:=23040*1024*1024*4;//size for Blu-Ray XL3
   13: vol_size:=23040*1024*1024*5;//size for Blu-Ray XL4
   end;
//sfx (generate self extracting Windows executable)
if (FormPeach.CheckBox7zSFX.State=cbChecked) then
   begin
   sfx_option:='-sfx';
   case FormPeach.RadioGroup7zSFX.ItemIndex of
      0: sfx_option:=sfx_option+'7zCon.sfx';
      1: sfx_option:=sfx_option+'7zCon.linux.sfx';
      2: sfx_option:=sfx_option+'7z.sfx';
   end;
   end
else sfx_option:='';
//archive type
if archive_type='7z' then type_option:='-t7z';
if archive_type='bz2' then type_option:='-tbzip2';
if archive_type='gz' then type_option:='-tgzip';
if archive_type='xz' then type_option:='-txz';
if archive_type='wim' then type_option:='-twim';
if archive_type='tar' then type_option:='-ttar';
if archive_type='zip' then type_option:='-tzip';
//timestamp precision
paramtime:='';
if archive_type='tar' then
   if tartype=0 then
   else
      case tartime of
         0: paramtime:='-mm=pax -mtp=0';
         1: paramtime:='-mm=pax -mtp=1';
         2: paramtime:='-mm=pax -mtp=3';
         end;
if archive_type='zip' then
   case tartime of
      0: paramtime:='-mtp=0';
      1: paramtime:='-mtp=1';
      2: paramtime:='-mtp=0';
      end;
case syntaxstring7z of
'21','17','16': paramtime:='';
end;
//Compression level
compression_level:=setarchivecomplevel(FormPeach.ComboBox7zMethod.Text,FormPeach.ComboBox7zLevel.Text);
//compressor type
if compression_level<>'-mx0' then
   begin
   compmethodstr:=compression_method;
   if pos('Lizard',compmethodstr)<>0 then compmethodstr:='Lizard';
   if type_option='-t7z' then compressor_option:='-m0='+compmethodstr;
   if type_option='-tzip' then compressor_option:='-mm='+compmethodstr;
   //gzip and bzip2 doesn't need this param since use a single compressor
   end
else
   begin
   if type_option='-t7z' then compressor_option:='-m0=Copy';
   if type_option='-tzip' then compressor_option:='-mm=Copy';
   if type_option='-t7z' then
      if compression_method='Brotli' then
         if level_7z<>0 then compressor_option:='-m0=Brotli';
   end;
//-mmemuse max memory
mmemuse:='';
if (archive_type<>'tar') and (archive_type<>'wim') then
   case memuse_option of
      0: mmemuse:='';
      1: mmemuse:='-mmemuse=p10';
      2: mmemuse:='-mmemuse=p20';
      3: mmemuse:='-mmemuse=p30';
      4: mmemuse:='-mmemuse=p40';
      5: mmemuse:='-mmemuse=p50';
      6: mmemuse:='-mmemuse=p60';
      7: mmemuse:='-mmemuse=p70';
      8: mmemuse:='-mmemuse=p80';
      9: mmemuse:='-mmemuse=p90';
   end;
case syntaxstring7z of
'21','17','16': mmemuse:='';
end;
// multithreading
thread_option:='';
try
s:=FormPeach.ComboBox7zMethod.Text;
except
s:='';
end;
if (archive_type='7z') or (archive_type='zip') or (archive_type='bz2') or (archive_type='xz') then
   begin
   if FormPeach.ComboBox7zThreads.Enabled=false then thread_option:='-mmt=off'
   else
   if (s='Deflate') or (s='Deflate64') or (s='LZMA') or (s='LZMA2') or (s='BZip2') or (s='Brotli') or (s='FLZMA2') or (s='Lizard_fastLZ4') or (s='Lizard_LIZv1')
      or (s='Lizard_fastLZ4+Huffman') or (s='Lizard_LIZv1+Huffman') or (s='LZ4') or (s='LZ5') or (s='Zstd') then
      case FormPeach.ComboBox7zThreads.ItemIndex of
      0: thread_option:='-mmt=off';
      1: thread_option:='-mmt=on';
      2: thread_option:='-mmt=2';
      3: thread_option:='-mmt=4';
      4: thread_option:='-mmt=8';
      5: thread_option:='-mmt=16';
      6: thread_option:='-mmt=32';
      7: thread_option:='-mmt=64';
      8: thread_option:='-mmt=128';
      9: thread_option:='-mmt=256';
      end;
   end;
//passes, only for Deflate, Deflate64 and BZip2
if (s='Deflate') or (s='Deflate64') or (s='BZip2') then passes_option:='-mpass='+FormPeach.ComboBox7zPasses.Text;
//word size
word_option:='';
if type_option<>'-tbzip2' then //bzip2 doesn't need word size option
   if (compressor_option<>'-m0=BZip2') and (compressor_option<>'-mm=BZip2') and (compressor_option<>'-m0=PPMd') then
      if (compression_level<>'-mx0') and (FormPeach.ComboBox7zWord.Enabled=true) then word_option:='-mfb='+FormPeach.ComboBox7zWord.Text
      else word_option:='';
if (compressor_option='-m0=PPMd') or (compressor_option='-mm=PPMd') then word_option:='-mo='+FormPeach.ComboBox7zWord.Text; //if PPMd Compression is used, use model order instead of fast bytes
//dictionary size
if (compression_level<>'-mx0') and (FormPeach.ComboBox7zDictionary.Enabled=true) then
   begin
   s:=FormPeach.ComboBox7zDictionary.Items[FormPeach.ComboBox7zDictionary.ItemIndex];//.Text may be not correctly valorized if both conditions are met: combobox has a single item and it is not in active tab
   setlength(s,length(s)-3);//remove ' *B' suffix
   dictionary_option:='-md='+s+'k';//treat the value as KB by default (modified if following conditions are encountered
   if (compressor_option='-m0=PPMd') or (compressor_option='-mm=PPMd') then dictionary_option:='-mmem='+s+'m'; //all PPMd dictionary sizes are expressed in MB; PPMd uses mem param instead of dictionary param
   if ((compressor_option='-m0=LZMA') or (compressor_option='-mm=LZMA') or (compressor_option='-m0=LZMA2') or (compressor_option='-mm=LZMA2') or (compressor_option='-m0=FLZMA2')) and (FormPeach.ComboBox7zDictionary.ItemIndex>0) then dictionary_option:='-md='+s+'m'; //all LZMA dictionary sizes but the first are expressed in MB
   if (compressor_option='-mm=Deflate') or (compressor_option='-mm=Deflate64') then dictionary_option:=''; //zip with Deflate and Deflate64 doesn't support dictionary size param
   if (type_option='-txz') then if FormPeach.ComboBox7zDictionary.ItemIndex>0 then dictionary_option:='-md='+s+'m';
   if (type_option='-tzip') and (compressor_option='-mm=XZ') then if FormPeach.ComboBox7zDictionary.ItemIndex>0 then dictionary_option:='-md='+s+'m';
   if (type_option='-tgzip') then dictionary_option:=''; //gzip doesn't support dictionary size param
   if (type_option='-t7z') and ((compressor_option='-m0=Deflate') or (compressor_option='-m0=Deflate64')) then dictionary_option:=''; //7z with Deflate/Deflate64 does not support dictionary size option
   end
else dictionary_option:='';
//zip mcu uses UTF8 for file names that contain non-ASCII symbols
if (archive_type='zip') then
   case mcuzip of
      0: mcu_option:='';
      1: mcu_option:='-mcu=on';
      2: mcu_option:='-mcl=on';
      3: if FormPeach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+FormPeach.EditEncoding.Caption;
   end;
//path option
case FormPeach.ComboBox7zPaths.ItemIndex of
   0: path_option:='';
   1: path_option:='-spf2';
   2: path_option:='-spf';
   end;
//NT, NTFS options, link options
psni:='';
psns:='';
if archive_type='wim' then
   begin
   if sni7z=1 then psni:='-sni' else psni:='';
   if sns7z=1 then psns:='-sns' else psns:='-sns-';
   end;
psnh:='';
psnl:='';
case syntaxstring7z of
'21','17','16': begin end;
else
   //if (archive_type='wim') or (archive_type='tar') then
   begin
   if snh7z=1 then psnh:='-snh' else psnh:='';
   if snl7z=1 then psnl:='-snl' else psnl:='';
   end;
end;
//7za uses -- as tag to distinguish a filename starting with - from a switch, however since PeaZip uses absolute filenames it should never occur and filenames are not checked for that condition
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
if vol_size>0 then outname:=outname+'.001'; //give correct output name if archive is split
getworkpath(work_path,out_param);
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
get_in_param(in_param,sel);
exclude_param:='';
include_param:='';
if FormAdvf.CheckBoxAdvFilters.State=cbChecked then
begin
   for i:=0 to FormAdvf.MemoAdvExclude.Lines.Count-1 do
      begin
      if FormAdvf.CheckBoxAdvRecurse1.State=cbChecked then
         exclude_param:=exclude_param+' '+stringdelim('-xr0!'+FormAdvf.MemoAdvExclude.Lines[i])+' '
      else
         exclude_param:=exclude_param+' '+stringdelim('-x!'+FormAdvf.MemoAdvExclude.Lines[i])+' ';
      end;
   for i:=0 to FormAdvf.MemoAdvIncludeAlso.Lines.Count-1 do
      begin
      if extractfilepath(FormAdvf.MemoAdvIncludeAlso.Lines[i])<>'' then
         if FormAdvf.CheckBoxAdvRecurseAlso.State=cbChecked then
            include_param:=include_param+' '+stringdelim('-ir0!'+FormAdvf.MemoAdvIncludeAlso.Lines[i])+' '
          else
            include_param:=include_param+' '+stringdelim('-i!'+FormAdvf.MemoAdvIncludeAlso.Lines[i])+' ';
      end;
end;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
cl:=bin_name+' '+archive_function+' '+type_option;
if paramtime<>'' then cl:=cl+' '+paramtime;
if compressor_option<>'' then cl:=cl+' '+compressor_option;
if thread_option<>'' then cl:=cl+' '+thread_option;
if mmemuse<>'' then cl:=cl+' '+mmemuse;
if compression_level<>'' then cl:=cl+' '+compression_level;
if dictionary_option<>'' then cl:=cl+' '+dictionary_option;
if word_option<>'' then cl:=cl+' '+word_option;
if passes_option<>'' then cl:=cl+' '+passes_option;
if solid_option<>'' then cl:=cl+' '+solid_option;
if openfiles_option<>'' then cl:=cl+' '+openfiles_option;
if snoi_option<>'' then cl:=cl+' '+snoi_option;
if snon_option<>'' then cl:=cl+' '+snon_option;
if sccenc<>'' then cl:=cl+' '+sccenc;
if mcu_option<>'' then cl:=cl+' '+mcu_option;
if pforceconsole=0 then if zaout=2 then if (pw='-p') or (pw=stringdelim('-p')) then pw:='';//never pass empty password to pipe mode
if intpw=1 then
   begin
   pw:='-p';
   pforceconsole:=1;
   if (setencfn=1) and (archive_type='7z') then
      pw2_option:='-mhe=on'
   else
      pw2_option:='';
   end;
if pw<>'' then
   begin
   if (pipepw<>'') and (consolecl=false) then cl:=cl+' -p' else cl:=cl+' '+pw;
   if pw2_option<>'' then cl:=cl+' '+pw2_option;
   end;
if encalgo<>'' then cl:=cl+' '+encalgo;
if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
if mail_option<>'' then cl:=cl+' '+mail_option;
if sfx_option<>'' then cl:=cl+' '+sfx_option;
if vol_size<>0 then cl:=cl+' -v'+inttostr(vol_size);
if FormPeach.Edit7zOpt.Text<>'' then cl:=cl+' '+FormPeach.Edit7zOpt.Text;
if work_path<>'' then cl:=cl+' '+work_path;
if path_option<>'' then cl:=cl+' '+path_option;
if psni<>'' then cl:=cl+' '+psni;
if psns<>'' then cl:=cl+' '+psns;
if psnh<>'' then cl:=cl+' '+psnh;
if psnl<>'' then cl:=cl+' '+psnl;
if stl7z=1 then cl:=cl+' -stl';
case syntaxstring7z of
'21','17','16': begin end;
else if ssp7z=1 then cl:=cl+' -ssp';
end;
if (archive_type='7z') and (storecreated=1) then cl:=cl+' -mtc=on -mta=on';
if archive_type='tar' then
   if tartype=1 then
      if (storecreated=1) then cl:=cl+' -mtc=on -mta=on';
if (archive_type='zip') then
   if (storecreated=1) then
      case syntaxstring7z of
      '21','17','16': cl:=cl+' -mtc=on';
      else cl:=cl+' -mtc=on -mta=on';
      end;
case syntaxstring7z of
'17','16': begin end;
else if excludeef=1 then cl:=cl+' -xtd';
end;
{$IFDEF MSWINDOWS}if updatingarchive_inarchive=true then if forcecanbechanged=1 then if ExtractFileExt(FormPeach.EditOpenIn.Caption)='' then out_param:=out_param+'.';{$ENDIF}
if (scripttarpipe=1) and (FormPeach.cbtarpipe.enabled=true) and (FormPeach.CheckBoxTarBefore.State=cbChecked) then in_param:='-si';
cl:=cl+' '+out_param+' '+in_param;
if exclude_param<>'' then cl:=cl+' '+exclude_param;
if include_param<>'' then cl:=cl+' '+include_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_archive_cl:=0;
end;

function compose_unrar5_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
//mode: neutral (read in options), ext, extandrun, list, info, test, (add is in compose_archive_cl only), delete, draganddrop
//selection: all, displayed (apply filters), selected (evaluate selected), single (single selected object)
var
   filter1,out_param,in_param,bin_name,archive_function,overwrite_policy,pw:ansistring;
   i:integer;
   contains_folder,checksel:boolean;
begin
result:=-1;
subfun:='extract';
btfun:='unrar5';
//out_param
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   begin
   if (mode='ext') or (mode='extandrun') or (mode='draganddrop') or ((mode='neutral') and (FormPeach.ComboBoxActionExtract.ItemIndex<2)) then
      if control_outpath(out_param)<>0 then exit;
   end;
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,FormPeach.ComboBoxActionExtract.ItemIndex,mode)
else
   if nffromdrag=true then set_output_folder(out_param,in_param,real_extract,FormPeach.ComboBoxActionExtract.ItemIndex,mode);
//overwrite policy
case extopt7z of
   0: overwrite_policy:='-o-';//skip existing files
   1: overwrite_policy:='-or';//auto rename extracting files
   2: overwrite_policy:='-or';//auto rename existing files //unrar renames only file being extracted
   3: overwrite_policy:='-o+';//overwrite all existing files
   4: begin overwrite_policy:=''; zaout:=0; end;//auto switch to console mode if needed
   end;
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
   pw:=FormPW.EditPWpass.Text;
   if FormPW.EditPWkeyfile.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
if pw<>'' then
   begin
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      exit;
      end;
   end
else if zaout>0 then pw:='-p-';
//archive function
case mode of
   'neutral' :
   case FormPeach.ComboBoxActionExtract.ItemIndex of
      0: archive_function:='x';
      1: archive_function:='e';
      2: begin
         archive_function:='lb';
         subfun:='list';
         end;
      3: begin
         archive_function:='lt';
         subfun:='list';
         end;
      4: begin
         archive_function:='t';
         subfun:='test';
         end;
      end;
   'list' :
   begin
   archive_function:='lb';
   subfun:='list';
   end;
   'info' :
   begin
   archive_function:='lt';
   subfun:='list';
   end;
   'test' :
   begin
   archive_function:='t';
   subfun:='test';
   end;
   'ext' : archive_function:='x';
   'draganddrop' : archive_function:='x';
   end;
if (archive_function='x') and (status0<>txt_list_flat) then //set optional ignore paths for displayed or selected objects, if a directory is in the group the rule is overrieddn and x function is used to preserve paths structure
   begin
   if (selection='displayed') and (ignorepathdisp=1) then
      begin
      contains_folder:=false;
      i:=1;
      while (i<FormPeach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then contains_folder:=true;
         i:=i+1;
         end;
      if contains_folder=false then archive_function:='e';
      end;
   if ((selection='selected') and (mode<>'draganddrop') and (ignorepathsel=1)) or ((selection='selected') and (mode='draganddrop') and (ignorepathdd=1)) then
      begin
      contains_folder:=false;
      i:=1;
      while (i<FormPeach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if FormPeach.StringGridList.Cells[16,i]='1' then
            if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then contains_folder:=true;
         i:=i+1;
         end;
      if contains_folder=false then archive_function:='e';
      end;
   end;
if mode='extandrun' then //extandrun special feature, replaces archive function and overwrite policy: always extract the object, to be opened immediately after; if the object exist, ask about overwriting or skipping it
   begin
   if archive_function='e' then //extract without paths
      begin
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   if ignorepathextand=1 then //option ignore archived paths for Extract and... override standard path policy; checking it it's possible ignoring paths only for Extract and... functions
      begin
      archive_function:='e';
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end;
   if FormPeach.StringGridList.Cells[2,FormPeach.StringGridList.Row]=txt_list_isfolder then //if the object is a directory, paths are always preserved (this rule override all other rules)
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   if selection='displayed' then tempstring:=ExtractFilePath(tempstring);
   if fileexists((out_param+tempstring)) then
         if pMessageWarningYesNo(out_param+tempstring+' '+txt_confirm_overwrite)<>6 then exit;
   overwrite_policy:='-o+';
   end;
if mode='preview' then //preview special feature, replaces archive function and overwrite policy as 'extract and...' but never ignores paths
   begin
   archive_function:='x';
   tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   if selection='displayed' then tempstring:=ExtractFilePath(tempstring);
   {$IFDEF MSWINDOWS}tempstring:=StringReplace(tempstring,':','_', [rfReplaceAll]);{$ENDIF}
   overwrite_policy:='-o+';
   end;
if (archive_function<>'x') and (archive_function<>'e') and (archive_function<>'d') then
//clear overwrite policies for list and test mode (no need for writing)
   begin
   overwrite_policy:='';
   out_param:='';
   end;
//end archive function attribution
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT);
//if sys7zlin>1 then bin_name:=UNRARNAME+EXEEXT;
cl:=bin_name+' '+archive_function;
if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
if intpw=1 then
   begin
   pw:='';
   pforceconsole:=1;
   end;
if pw<>'' then cl:=cl+' '+pw;
in_param:=stringdelim(escapefilename(in_param,desk_env));
cl:=cl+' '+in_param;
//filter(s)
if selection='all' then //apply only advanced filter(s), if used
   if FormAdvf.CheckBoxAdvFilters.State=cbChecked then adv_filters_rar5(cl);
if selection='displayed' then //apply advanced filters, if used, or basic filters (but without excludes, in order to extract also all nested objects)
   if FormAdvf.CheckBoxAdvFilters.State=cbChecked then adv_filters_rar5(cl)
   else
      if FormPeach.EditUn7zaFilter.Text<>'' then
         begin
         if FormPeach.cbUn7zaRecursive.State=cbChecked then cl:=cl+' -r';
         filter1:=FormPeach.EditUn7zaFilter.Text;
         //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' -- '+stringdelim(escapefilename(filter1,desk_env));
         end;
if selection='selected' then //extract object in the range of selection
   begin
   cl:=cl+' --';
   checksel:=false;
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   begin
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         filter1:=FormPeach.StringGridList.Cells[12,i];
         //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+stringdelim(escapefilename(filter1,desk_env));
         checksel:=true;
         end;
   end
   else
   for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
      begin
      if checkfiledirname(FormPeach.StringGridExtract.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridExtract.Cells[8,i]); exit; end;
      filter1:=FormPeach.StringGridExtract.Cells[8,i];
      //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
      cl:=cl+' '+stringdelim(escapefilename(filter1,desk_env));
      checksel:=true;
      end;
   if checksel=false then exit;
   end;
if ((mode='extandrun') or (mode='preview')) and (selection='single') then //extract a single object
   begin
   if checkfiledirname(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]); exit; end;
   filter1:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
   cl:=cl+' -- '+stringdelim(escapefilename(filter1,desk_env));
   end;
if out_param<>'' then cl:=cl+' '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
result:=0;
end;

function isabspath(s:ansistring):boolean; //detect absolute paths to prevent running operations currently not correctly supported by some backend functions
begin
result:=true;
if length(s)>0 then if s[1]=directoryseparator then exit;
if length(s)>1 then
   if (s[1]+s[2]=directoryseparator+directoryseparator) or (s[2]=':') then exit;
result:=false;
end;

function compose_un7z_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
//mode: neutral (read in options), ext, extandrun, list, info, test, (add is in compose_archive_cl only), delete, draganddrop
//selection: all, displayed (apply filters), selected (evaluate selected), single (single selected object)
var
   filter1,out_param,in_param,bin_name,archive_function,overwrite_policy,pw,details,sccenc,esni,esns,esnz,work_path,path_option,delcase,deltime,mcu_option,dummyin:ansistring;
   i:integer;
   contains_folder,checksel:boolean;
begin
compose_un7z_cl:=-1;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
if libre_directive=2 then if testifrar(in_param)=1 then begin reportnotsupported_info('RAR'); exit; end;
if testifrar5(in_param)=1 then israr5:='rar5' else israr5:=''; //rar5 test, if rar5 switch to appropriate procedure to call unrar (if allowed by libre_directive=0)
if israr5='rar5' then
   begin result:=compose_unrar5_cl(cl,jobcode,outname,real_extract,mode,selection); exit; end;
if (upcase(extractfileext(in_param))='.ZIP') or (upcase(extractfileext(in_param))='.ZIPX') then
   case mcuzip of
      0: mcu_option:='';
      1: mcu_option:='-mcu=on';
      2: mcu_option:='-mcl=on';
      3: if FormPeach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+FormPeach.EditEncoding.Caption;
   end;
{$IFDEF MSWINDOWS}if mode='delete' then if forcecanbechanged=1 then if ExtractFileExt(in_param)='' then in_param:=in_param+'.';{$ENDIF}
//NT, NTFS options
esni:='';
esns:='';
esnz:='';
if (upcase(extractfileext(in_param))='.WIM') or (upcase(extractfileext(in_param))='.SWM') then
   begin
   if sni7z=1 then esni:='-sni' else esni:='';
   if sns7z=1 then esns:='-sns' else esns:='-sns-';
   end;
{$IFDEF MSWINDOWS}if snz7z=1 then esnz:='-snz' else {$ENDIF} esnz:='';
dummyin:=in_param;
cutextension(dummyin);
subfun:='extract';
btfun:='un7z';
//out_param
set_output_option(out_param);
if (mode='preview') or (specialopen=true) then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   if specialopen=true then
      begin
      out_param:=out_param+STR_STMP+inttohex(random(16000000),6);
      pstmpdir:=out_param;
      end
   else
      begin
      out_param:=out_param+ptmpcode;//directoryseparator is added in next step
      ptmpdir:=out_param;
      end
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   begin
   if (mode='ext') or (mode='extandrun') or (mode='draganddrop') or ((mode='neutral') and (FormPeach.ComboBoxActionExtract.ItemIndex<2)) then
      if control_outpath(out_param)<>0 then exit;
   end;
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
//folder policy
if (specialopen=false) and (mode<>'info') and (mode<>'list') and (mode<>'test') and (mode<>'delete') and (mode<>'preview') then
   if mode<>'draganddrop' then
      set_output_folder(out_param,in_param,real_extract,FormPeach.ComboBoxActionExtract.ItemIndex,mode)
   else
      if nffromdrag=true then
         set_output_folder(out_param,in_param,real_extract,FormPeach.ComboBoxActionExtract.ItemIndex,mode);
if (mode='ext') and (specialopen=true) then //specialopen switches to extract entire directory for some file types (exe, bat, html...)
   begin
   alt_tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   {$IFDEF MSWINDOWS}alt_tempstring:=StringReplace(alt_tempstring,':','_', [rfReplaceAll]);{$ENDIF}
   if pstmpdir<>'' then if checkdirexists(pstmpdir) then else CreateDir(pstmpdir);
   filesetattr(pstmpdir, faHidden);
   end;
if (willbemoved=true) and (real_extract=true) then
   if activelabel_extract<>FormPeach.LabelTitleExtract3 then
      begin
      if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
      filesetattr(out_param, faHidden);
      end;
//overwrite policy
case extopt7z of
   0: overwrite_policy:='-aos';//skip existing files
   1: overwrite_policy:='-aou';//auto rename extracting files
   2: overwrite_policy:='-aot';//auto rename existing files
   3: overwrite_policy:='-aoa';//overwrite all existing files
   4: begin overwrite_policy:=''; zaout:=0; end;//auto switch to console mode if needed
   end;
if FormPeach.ComboBoxActionExtract.ItemIndex=3 then details:='-slt'
else details:='';
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
pw:=FormPW.EditPWpass.Text;
if FormPW.EditPWkeyfile.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
pforceconsole:=0;
pipepw:='';
piperar:=false;
if pw<>'' then
   begin
   if zaout=2 then pipepw:=pw;
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      pforceconsole:=1;
      pw:='';
      //exit;
      end;
   end
else if zaout>0 then //workaround: pw is never left blank in pipe mode; if archive is not encrypted the pw will not be checked by 7za, otherwise the archive will not open but will not hang the application in pipe mode that is waiting for input
   begin
   pw:='-pdefault';
   pipepw:='default';
   end;
case enc7zscc of
   0: sccenc:='-sccUTF-8';
   1: sccenc:='-sccWIN';
   2: sccenc:='-sccDOS';
   end;
deltime:='';
//archive function
delcase:='';//force case sensitive for deletion in archive
case mode of
   'neutral' :
   case FormPeach.ComboBoxActionExtract.ItemIndex of
      0: archive_function:='x';
      1: archive_function:='e';
      2: begin
         archive_function:='l';
         subfun:='list';
         end;
      3: begin
         archive_function:='l';
         subfun:='list';
         if pw='' then //avoid hanging info based test process for password request
            begin
            pw:='-pdefault';
            pipepw:='default';
            end;
         end;
      4: begin
         archive_function:='t';
         subfun:='test';
         if pw='' then //avoid hanging test process for password request
            begin
            pw:='-pdefault';
            pipepw:='default';
            end;
         end;
      end;
   'delete' : //delete special feature, replaces archive function and overwrite policy
   begin
   archive_function:='d';
   overwrite_policy:='';
   delcase:='-ssc';
   if stl7z=1 then deltime:='-stl';
   end;
   'list' :
   begin
   archive_function:='l';
   details:='';
   subfun:='list';
   end;
   'info' :
   begin
   archive_function:='l';
   details:='-slt';
   subfun:='list';
   if pw='' then //avoid hanging info based test process for password request
      begin
      pw:='-pdefault';
      pipepw:='default';
      end;
   end;
   'test' :
   begin
   archive_function:='t';
   subfun:='test';
   if pw='' then //avoid hanging test process for password request
      begin
      pw:='-pdefault';
      pipepw:='default';
      end;
   end;
   'ext' : archive_function:='x';
   'draganddrop' : archive_function:='x';
   end;
if (archive_function='x') and (status0<>txt_list_flat) then //set optional ignore paths for displayed or selected objects, if a directory is in the group the rule is overrieddn and x function is used to preserve paths structure
   begin
   if (selection='displayed') and (ignorepathdisp=1) then
      begin
      contains_folder:=false;
      i:=1;
      while (i<FormPeach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then contains_folder:=true;
         i:=i+1;
         end;
      if contains_folder=false then archive_function:='e';
      end;
   if ((selection='selected') and (mode<>'draganddrop') and (ignorepathsel=1)) or ((selection='selected') and (mode='draganddrop') and (ignorepathdd=1)) then
      begin
      contains_folder:=false;
      i:=1;
      while (i<FormPeach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if FormPeach.StringGridList.Cells[16,i]='1' then
            if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then contains_folder:=true;
         i:=i+1;
         end;
      if contains_folder=false then archive_function:='e';
      end;
   end;
if mode='extandrun' then //extandrun special feature, replaces archive function and overwrite policy: always extract the object, to be opened immediately after; if the object exist, ask about overwriting or skipping it
   begin
   if archive_function='e' then //extract without paths
      begin
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   if ignorepathextand=1 then //option ignore archived paths for Extract and... override standard path policy; checking it it's possible ignoring paths only for Extract and... functions
      begin
      archive_function:='e';
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end;
   if FormPeach.StringGridList.Cells[2,FormPeach.StringGridList.Row]=txt_list_isfolder then //if the object is a directory, paths are always preserved (this rule override all other rules)
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   if selection='displayed' then tempstring:=ExtractFilePath(tempstring);
   if fileexists((out_param+tempstring)) or checkdirexists((out_param+tempstring)) then
         if pMessageWarningYesNo(out_param+tempstring+' '+txt_confirm_overwrite)<>6 then exit;
   overwrite_policy:='-aoa';
   end;
if mode='preview' then //preview special feature, replaces archive function and overwrite policy as 'extract and...' but never ignores paths
   begin
   archive_function:='x';
   tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   if selection='displayed' then tempstring:=ExtractFilePath(tempstring);
   {$IFDEF MSWINDOWS}tempstring:=StringReplace(tempstring,':','_', [rfReplaceAll]);{$ENDIF}
   overwrite_policy:='-aos';//do not overwrite previewed data
   keeppreview:=true;
   beingpreviewed:=FormPeach.EditOpenIn.Text;
   end;
if (archive_function<>'x') and (archive_function<>'e') and (archive_function<>'d') then //clear overwrite policies for list and test mode (no need for writing)
   begin
   overwrite_policy:='';
   out_param:='';
   end;
if mode='delete' then getworkpath(work_path,out_param);
//end archive function attribution
//path option
if (archive_function='x') or (archive_function='e') or (archive_function='d') then
   case FormPeach.ComboBoxArchivePathsExt.ItemIndex of
      0: path_option:='';
      1: path_option:='-spf2';
      2: path_option:='-spf';
      end;
if out_param<>'' then out_param:=stringdelim('-o'+escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
cl:=bin_name+' '+archive_function;
if archive_function='l' then
   case syntaxstring7z of
   '23','21','17','16': begin end;
   else if tsutc=1 then cl:=cl+' -slmu';
   end;
if delcase<>'' then cl:=cl+' '+delcase;
if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
if (scriptuntarpipe=1) and (FormPeach.cbuntarpipe.enabled=true) and
   (FormPeach.LabelStatusExtract.Caption=txt_2_7_ext) and (upcase(extractfileext(dummyin))='.TAR') and
   ((archive_function='x') or (archive_function='e'))then out_param:='-so';
if out_param<>'' then cl:=cl+' '+out_param;
if work_path<>'' then cl:=cl+' '+work_path;
if (nonverboselog=1) and (mode<>'test') then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';
if deltime<>'' then cl:=cl+' '+deltime;
if intpw=1 then
   begin
   pw:='';
   pforceconsole:=1;
   end;
if pw<>'' then
   if (pipepw<>'') and (consolecl=false) then else cl:=cl+' '+pw;
cl:=cl+' '+sccenc;
if mcu_option<>'' then cl:=cl+' '+mcu_option;
if path_option<>'' then cl:=cl+' '+path_option;
if esni<>'' then cl:=cl+' '+esni;
if esns<>'' then cl:=cl+' '+esns;
if esnz<>'' then cl:=cl+' '+esnz;
if (details<>'') and (archive_function='l') then cl:=cl+' '+details;
case syntaxstring7z of
'17','16': begin end;
else if excludeef=1 then cl:=cl+' -xtd';
end;
in_param:=stringdelim(escapefilename(in_param,desk_env));
cl:=cl+' '+in_param;
//filter(s)
if selection='all' then //apply only advanced filter(s), if used
   if FormAdvf.CheckBoxAdvFilters.State=cbChecked then adv_filters(cl);
if selection='displayed' then //apply advanced filters, if used, or basic filters (but without excludes, in order to extract also all nested objects)
   if FormAdvf.CheckBoxAdvFilters.State=cbChecked then adv_filters(cl)
   else
      if FormPeach.EditUn7zaFilter.Text<>'' then
         begin
         if FormPeach.cbUn7zaRecursive.State=cbChecked then cl:=cl+' -r';
         filter1:=FormPeach.EditUn7zaFilter.Text;
         //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+stringdelim('-i!'+escapefilename(filter1,desk_env));
         end;
if selection='selected' then //extract object in the range of selection
   begin
   checksel:=false;
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
   begin
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         filter1:=FormPeach.StringGridList.Cells[12,i];
         if archive_function='d' then
            if length(filter1)>0 then
               if copy(filter1,1,1)='.' then filter1:='?'+copy(filter1,2,length(filter1)-1);
         //if archive_function='d' then if copy(filter1,2,1)=':' then filter1:=copy(filter1,1,1)+'?'+copy(filter1,3,length(filter1)-2);
         if isabspath(filter1)=true then
            cl:=cl+' '+stringdelim('*'+escapefilename(filter1,desk_env))//workaround for delete command on absolute paths
         else
            cl:=cl+' '+stringdelim('-i!'+escapefilename(filter1,desk_env));
         checksel:=true;
         end;
   end
   else
   for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
      begin
      if checkfiledirname(FormPeach.StringGridExtract.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridExtract.Cells[8,i]); exit; end;
      filter1:=FormPeach.StringGridExtract.Cells[8,i];
      //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
      cl:=cl+' '+stringdelim('-i!'+escapefilename(filter1,desk_env));
      checksel:=true;
      end;
   if checksel=false then exit;
   end;
if ((mode='extandrun') or (mode='preview')) and (selection='single') then //extract a single object
   begin
   if checkfiledirname(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]); exit; end;
   filter1:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
   //if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
   cl:=cl+' '+stringdelim('-i!'+escapefilename(filter1,desk_env));
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_un7z_cl:=0;
end;

function compose_pea_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   i:integer;
   out_param,s,in_param,compr,vol_algo,obj_algo,strm_algo,bin_name,p_ext,pw,rkdf:ansistring;
   vol_size:qword;
   name_ok:boolean;
begin
compose_pea_cl:=-1;
subfun:='archive';
btfun:='pea';
fun:='PEA';
if check_input<>0 then exit;
   case FormPeach.cbSplit.ItemIndex of
      0: vol_size:=0; //trigger PEA to not split archive in volumes
      1: begin
         try
            vol_size:=FormPeach.SpinEditSplit.Value;
            case FormPeach.ComboBoxSplit.ItemIndex of
               1: vol_size:=vol_size*1024;
               2: vol_size:=vol_size*1024*1024;
               3: vol_size:=vol_size*1024*1024*1024;
               end;
         except
            pMessageWarningOK(txt_chunk_size);
            exit;
         end;
         end;
      2: vol_size:=1457664;//FD
      3: vol_size:=10*1024*1024;//limit for attachment size of some mail services
      4: vol_size:=25*1024*1024;//limit for attachment size of most mail services
      5: vol_size:=650*1024*1024;//CD 650 MB
      6: vol_size:=700*1024*1024;//CD 700 MB
      7: vol_size:=4092*1024*1024;//max file size for FAT32 filesystem
      8: vol_size:=4480*1024*1024;//size DVD+R
      9: vol_size:=8128*1024*1024;//size for DVD-R DL
      10: vol_size:=23040*1024*1024;//size for Blu-Ray
      11: vol_size:=23040*1024*1024*2;//size for Blu-Ray DL
      12: vol_size:=23040*1024*1024*4;//size for Blu-Ray XL3
      13: vol_size:=23040*1024*1024*5;//size for Blu-Ray XL4
   end;
   if vol_size=0 then p_ext:='.pea' else p_ext:='.000001.pea';
   //out_param
   if FormPeach.CheckBoxTarBefore.State=cbChecked then out_param:=FormPeach.StringGridAdd.Cells[8,1]
   else
   out_param:=FormPeach.EditAddFilepath.Text+FormPeach.EditAddFilename.Text;
   apply_timestamptoname(out_param,0,0,'file');
   if fileexists((out_param+p_ext)) then
      begin
      i:=1;
      name_ok:=false;
      s:=out_param;
      cutextension(s);
      repeat
         if fileexists(s+NAMEVARSTR+inttostr(i)+p_ext) or checkdirexists(s+NAMEVARSTR+inttostr(i)+p_ext) then inc(i,1)
         else name_ok:=true;
      until name_ok = true;
      out_param:=s+NAMEVARSTR+inttostr(i);
      end;
   outname:=out_param+p_ext;
   case FormPeach.ComboBoxPEALevel.ItemIndex of
      0: compr:='PCOMPRESS3';
      1: compr:='PCOMPRESS2';
      2: compr:='PCOMPRESS1';
      3: compr:='PCOMPRESS0';
      end;

   rkdf:='';
   if FormPeach.ComboBoxPEAKDF.ItemIndex = 2 then
      case FormPeach.ComboBoxPEAKDFw.ItemIndex of  //PBKDF2
         1: rkdf:='2';
         2: rkdf:='5';
         3: rkdf:='10';
         4: rkdf:='20';
         5: rkdf:='50';
         6: rkdf:='100';
         7: rkdf:='250';
         end
   else
      case FormPeach.ComboBoxPEAKDFw.ItemIndex of  //scrypt, Hybrid
         1: rkdf:='1';
         2: rkdf:='2';
         3: rkdf:='3';
         4: rkdf:='4';
         5: rkdf:='5';
         6: rkdf:='6';
         7: rkdf:='7';
         end;

pw:=FormPW.EditPWpass.Text;
if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
   begin
   case FormPeach.ComboBoxPEAStream.ItemIndex of
      //from 6.0.1 stream check is context sensitive:
      //if password is set uses encryption algo set in pstream drpdown
      //else uses ripemd160 hash
      0: case FormPeach.ComboBoxPEAKDF.ItemIndex of
         2: strm_algo:='TRIATS'+rkdf+' BATCH';
         1: strm_algo:='HRIATS'+rkdf+' BATCH';
         0: strm_algo:='SRIATS'+rkdf+' BATCH';
         end;
      1: case FormPeach.ComboBoxPEAKDF.ItemIndex of
         2: strm_algo:='TRITSA'+rkdf+' BATCH';
         1: strm_algo:='HRITSA'+rkdf+' BATCH';
         0: strm_algo:='SRITSA'+rkdf+' BATCH';
         end;
      2: case FormPeach.ComboBoxPEAKDF.ItemIndex of
         2: strm_algo:='TRISAT'+rkdf+' BATCH';
         1: strm_algo:='HRISAT'+rkdf+' BATCH';
         0: strm_algo:='SRISAT'+rkdf+' BATCH';
         end;
      3: strm_algo:='EAX256 BATCH';
      4: strm_algo:='TF256 BATCH';
      5: strm_algo:='SP256 BATCH';
      6: strm_algo:='EAX BATCH';
      7: strm_algo:='TF BATCH';
      8: strm_algo:='SP BATCH';
      9: strm_algo:='HMAC BATCH';
      end;
   if FormPW.EditPWpass.Text<>'' then
      strm_algo:=strm_algo+' '+stringdelim(FormPW.EditPWpass.Text)
   else
      strm_algo:=strm_algo+' default';
   if FormPW.EditPWkeyfile.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)=0 then
         strm_algo:=strm_algo+' '+stringdelim(FormPW.EditPWkeyfile.Text)
      else
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end
   else strm_algo:=strm_algo+' NOKEYFILE';
   end
else strm_algo:='RIPEMD160 BATCH';
if pw<>'' then
   if pw4cl('',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      exit;
      end;

if intpw=1 then
   begin
   case FormPeach.ComboBoxPEAStream.ItemIndex of
      0: strm_algo:='TRIATS'+rkdf+' INTERACTIVE';
      1: strm_algo:='TRITSA'+rkdf+' INTERACTIVE';
      2: strm_algo:='TRISAT'+rkdf+' INTERACTIVE';
      3: strm_algo:='EAX256 INTERACTIVE';
      4: strm_algo:='TF256 INTERACTIVE';
      5: strm_algo:='SP256 INTERACTIVE';
      6: strm_algo:='EAX INTERACTIVE';
      7: strm_algo:='TF INTERACTIVE';
      8: strm_algo:='SP INTERACTIVE';
      9: strm_algo:='HMAC INTERACTIVE';
      end;
   end;

   case FormPeach.ComboBoxPEAObj.ItemIndex of //object check
      0: obj_algo:='WHIRLPOOL';
      1: obj_algo:='SHA3_512';
      2: obj_algo:='SHA512';
      3: obj_algo:='BLAKE2B';
      4: obj_algo:='SHA3_256';
      5: obj_algo:='SHA256';
      6: obj_algo:='BLAKE2S';
      7: obj_algo:='RIPEMD160';
      8: obj_algo:='SHA1';
      9: obj_algo:='MD5';
      10: obj_algo:='CRC64';
      11: obj_algo:='CRC32';
      12: obj_algo:='ADLER32';
      13: obj_algo:='NOALGO';
      end;
   case FormPeach.ComboBoxPEAVol.ItemIndex of //volume check
      0: vol_algo:='WHIRLPOOL';
      1: vol_algo:='SHA3_512';
      2: vol_algo:='SHA512';
      3: vol_algo:='BLAKE2B';
      4: vol_algo:='SHA3_256';
      5: vol_algo:='SHA256';
      6: vol_algo:='BLAKE2S';
      7: vol_algo:='RIPEMD160';
      8: vol_algo:='SHA1';
      9: vol_algo:='MD5';
      10: vol_algo:='CRC64';
      11: vol_algo:='CRC32';
      12: vol_algo:='ADLER32';
      13: vol_algo:='NOALGO';
      end;
   out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
   get_in_param(in_param,sel);
   in_param:='FROMCL '+in_param;
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
   cl:=bin_name+' '+fun+' '+out_param+' '+inttostr(vol_size)+' '+compr+' '+vol_algo+' '+obj_algo+' '+strm_algo+' '+in_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
compose_pea_cl:=0;
end;

function compose_rfs_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   i:integer;
   out_param,s,in_param,vol_algo,bin_name:ansistring;
   vol_size:qword;
   name_ok:boolean;
begin
compose_rfs_cl:=-1;
subfun:='archive';
btfun:='rfs';
fun:='RFS';
   if FormPeach.StringGridAdd.RowCount=1 then
      begin
      pMessageWarningOK(txt_split_noinput);
      exit;
      end
   else
      if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) then
      else
         begin
         if (FormPeach.CheckBoxSeparate.State=cbUnchecked) or (FormPeach.CheckBoxSeparate.Enabled=false) then
            begin
            pMessageWarningOK(txt_split+' '+txt_error_input_multi);
            exit;
            end;
         if FormPeach.StringGridAdd.Cells[2,FormPeach.StringGridAdd.Row]=txt_list_isfolder then
            begin
            pMessageWarningOK(txt_split+' '+txt_error_input_multi);
            exit;
            end;
         end;
   //out_param
   out_param:=FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row];
   if (FormPeach.CheckBoxSeparate.State=cbUnchecked) or (FormPeach.CheckBoxSeparate.Enabled=false) then out_param:=FormPeach.EditAddFilepath.Text;
   if fileexists((out_param+'.001')) then
      begin
      i:=1;
      name_ok:=false;
      s:=out_param;
      cutextension(s);
      repeat
         if fileexists(s+NAMEVARSTR+inttostr(i)+'.001') or checkdirexists(s+NAMEVARSTR+inttostr(i)+'.001') then inc(i,1)
         else name_ok:=true;
      until name_ok = true;
      out_param:=s+NAMEVARSTR+inttostr(i);
      end;
   outname:=out_param+'.001';
   case FormPeach.cbSplit.ItemIndex of
      0: vol_size:=0; //trigger PEA to not split archive in volumes
      1: begin
         try
            vol_size:=FormPeach.SpinEditSplit.Value;
            case FormPeach.ComboBoxSplit.ItemIndex of
               1: vol_size:=vol_size*1024;
               2: vol_size:=vol_size*1024*1024;
               3: vol_size:=vol_size*1024*1024*1024;
               end;
         except
            pMessageWarningOK(txt_chunk_size);
            exit;
         end;
         end;
      2: vol_size:=1457664;//FD
      3: vol_size:=10*1024*1024;//limit for attachment size of some mail services
      4: vol_size:=25*1024*1024;//limit for attachment size of most mail services
      5: vol_size:=650*1024*1024;//CD 650 MB
      6: vol_size:=700*1024*1024;//CD 700 MB
      7: vol_size:=4092*1024*1024;//max file size for FAT32 filesystem
      8: vol_size:=4480*1024*1024;//size DVD+R
      9: vol_size:=8128*1024*1024;//size for DVD-R DL
      10: vol_size:=23040*1024*1024;//size for Blu-Ray
      11: vol_size:=23040*1024*1024*2;//size for Blu-Ray DL
      12: vol_size:=23040*1024*1024*4;//size for Blu-Ray XL3
      13: vol_size:=23040*1024*1024*5;//size for Blu-Ray XL4
      end;
   case FormPeach.ComboBoxSplitAlgo.ItemIndex of //stream checks
      0: vol_algo:='WHIRLPOOL';
      1: vol_algo:='SHA3_512';
      2: vol_algo:='SHA512';
      3: vol_algo:='BLAKE2B';
      4: vol_algo:='SHA3_256';
      5: vol_algo:='SHA256';
      6: vol_algo:='BLAKE2S';
      7: vol_algo:='RIPEMD160';
      8: vol_algo:='SHA1';
      9: vol_algo:='MD5';
      10: vol_algo:='CRC64';
      11: vol_algo:='CRC32';
      12: vol_algo:='ADLER32';
      13: vol_algo:='NOALGO';
      end;
   out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
   in_param:=stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,FormPeach.StringGridAdd.Row],desk_env));
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
   cl:=bin_name+' '+fun+' '+out_param+' '+inttostr(vol_size)+' '+vol_algo+' BATCH '+in_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
compose_rfs_cl:=0;
end;

function compose_unpea_cl(var cl,jobcode,outname:ansistring):integer;
var
   attr_param,out_param,in_param,bin_name,s,pw:ansistring;
begin
compose_unpea_cl:=-1;
subfun:='extract';
btfun:='unpea';
set_output_option(out_param);
if control_outpath(out_param)<>0 then exit;
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
s:=extractfilename(FormPeach.EditOpenIn.Text);
if (s='') or (s='<none>') or (s=txt_none) then s:=FormPeach.StringGridExtract.Cells[1,FormPeach.StringGridExtract.Row];
if upcase(copy(s,length(s)-10,11))='.000001.PEA' then setlength(s,length(s)-11)
else setlength(s,length(s)-4);
out_param:=out_param+s;
if upcase(ExtractFileExt(out_param))='.TAR' then cutextension(out_param); //.tar extension is preserved in archive name and needs to be deleted in output name (only TAR extension is preserved in archive name)
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
if FormPeach.CheckBoxUnPeaAttributes.State=cbChecked then attr_param:='SETATTR'
else attr_param:='RESETATTR';
out_param:=stringdelim(escapefilename(out_param,desk_env));
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(FormPeach.EditOpenIn.Text,desk_env));
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
if fun='UNPEA' then
   begin
   pw:=FormPW.EditPWpass.Text;
   if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
      begin
      cl:=bin_name+' '+fun+' '+in_param+' '+out_param+' RESETDATE '+attr_param+' EXTRACT2DIR BATCH';
      if FormPW.EditPWpass.Text<>'' then
         cl:=cl+' '+stringdelim(FormPW.EditPWpass.Text)
      else
         cl:=cl+' default';
      if FormPW.EditPWkeyfile.Text<>'' then
         if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)=0 then
            cl:=cl+' '+stringdelim(FormPW.EditPWkeyfile.Text)
         else
            begin
            pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
            exit;
            end
      else cl:=cl+' NOKEYFILE';
      end
   else cl:=bin_name+' '+fun+' '+in_param+' '+out_param+' RESETDATE '+attr_param+' EXTRACT2DIR INTERACTIVE';
   if pw<>'' then
      if pw4cl('',pw)<>0 then
         begin
         msg_pw_errorchar(pw);
         exit;
         end;
   end;
if fun='RFJ' then cl:=bin_name+' '+fun+' '+in_param+' BATCH '+out_param;
if (fun<>'UNPEA') and (fun<>'RFJ') then
   begin
   pMessageErrorOK(txt_error_function);
   exit;
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
compose_unpea_cl:=0;
end;

function compose_unlpaq_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode:ansistring):integer;
var
   s1,out_param,in_param,bin_name,lpaq_ver:ansistring;
begin
compose_unlpaq_cl:=-1;
subfun:='extract';
btfun:='unlpaq';
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
   filesetattr(ptmpdir, faHidden);
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   if (mode<>'info') and (mode<>'list') and (mode<>'test') then
      if control_outpath(out_param)<>0 then exit;

if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
set_output_folder(out_param,in_param,real_extract,0,mode);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   s1:=extractfilename(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
else
   s1:=extractfilename(FormPeach.EditOpenIn.Text);
cutextension(s1);
out_param:=out_param+s1;
if out_param<>'' then
   if out_param[length(out_param)] = directoryseparator then setlength(out_param,length(out_param)-1);
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   lpaq_ver:=copy(extractfileext(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]),2,length(extractfileext(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]))-1)
else
   lpaq_ver:=copy(extractfileext(FormPeach.EditOpenIn.Text),2,length(extractfileext(FormPeach.EditOpenIn.Text))-1);
if fileexists(out_param) then
   if real_extract=true  then
      if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
      else
         clearfile(out_param);
if not(checkdirexists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
in_param:=stringdelim(escapefilename(in_param,desk_env));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'lpaq'+DirectorySeparator+lpaq_ver+EXEEXT);
if sys7zlin>1 then bin_name:=lpaq_ver+EXEEXT;
cl:=bin_name+' d '+in_param+' '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unlpaq_cl:=0;
end;

function compose_unpaq_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode:ansistring):integer;
var
   out_param,in_param,bin_name,paq_ver:ansistring;
begin
compose_unpaq_cl:=-1;
fun:='PAQ';
subfun:='extract';
btfun:='unpaq';
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
   filesetattr(ptmpdir, faHidden);
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   if (mode<>'info') and (mode<>'list') and (mode<>'test') then
      if control_outpath(out_param)<>0 then exit;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
set_output_folder(out_param,in_param,real_extract,0,mode);
if out_param<>'' then
   if out_param[length(out_param)]=directoryseparator then out_param:=copy(out_param,1,length(out_param)-1);
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param; //PAQ will skip extraction over existing object
//PAQ version, by extension; supported versions, as PAQ8F, must use -d switch for extraction and must follow extension convention with extension=name of the executable: .PAQ?* where ? is release level and * is the variant
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   paq_ver:=copy(extractfileext(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]),2,length(extractfileext(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]))-1)
else
   paq_ver:=copy(extractfileext(FormPeach.EditOpenIn.Text),2,length(extractfileext(FormPeach.EditOpenIn.Text))-1);
in_param:=stringdelim(escapefilename(in_param,desk_env));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+paq_ver+EXEEXT);
if sys7zlin>1 then bin_name:=paq_ver+EXEEXT;
cl:=bin_name+' -d '+in_param+' '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unpaq_cl:=0;
end;

function compose_zpaq_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   s,out_param,in_param,bin_name,compression_level,zthreads,paq_ver,pw:ansistring;
begin
compose_zpaq_cl:=-1;
fun:='PAQ';
btfun:='zpaq';
case FormPeach.RadioGroupPaq.ItemIndex of
   0: begin
      subfun:='archive';
      updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
      setspecialtsize;
      //check if input is suitable for chosen archive_type
      if check_input<>0 then exit;
      if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) then begin end //single input file
      else //folder(s) and/or multiple files
         if (FormPeach.CheckBoxSeparate.State=cbUnchecked) or (FormPeach.CheckBoxSeparate.Enabled=false) then
         begin
         pMessageWarningOK(archive_type+' '+txt_error_input_multi);
         exit;
         end;
      paq_ver:='lpaq8';
      //output name
      getarch_baseoutname(s);
      s:=s+'.'+paq_ver;
      apply_timestamptoname(s,1,0,'file');
      get_new_archive_name(s);//check if name, with extension, exists
      out_param:=s;
      if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
      case FormPeach.ComboBoxPAQLevel.ItemIndex of
         0: compression_level:='1';
         1: compression_level:='3';
         2: compression_level:='6';
         3: compression_level:='9';
         end;
      out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
      get_in_param(in_param,sel);
      bin_name:=stringdelim(escapefilename(binpath,desk_env)+'lpaq'+DirectorySeparator+paq_ver+EXEEXT);
      if sys7zlin>1 then bin_name:=paq_ver+EXEEXT;
      cl:=bin_name+' '+compression_level+' '+in_param+' '+out_param;
      end;
   1: begin
      paq_ver:='paq8o';
      subfun:='archive';
      updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
      setspecialtsize;
      //check if input is suitable for chosen archive_type
      if check_input<>0 then exit;
      //output name
      getarch_baseoutname(s);
      s:=s+'.'+paq_ver;
      apply_timestamptoname(s,1,0,'file');
      get_new_archive_name(s);//check if name, with extension, exists
      cutextension(s); //cut extension since paq executable doesn't want extension
      out_param:=s;
      //Compression level; PAQ versions supported uses -0..8 as PAQ8F
      //compression_level:='-'+inttostr(FormPeach.ComboBoxPAQLevel.ItemIndex);
      case FormPeach.ComboBoxPAQLevel.ItemIndex of
         0: compression_level:='-1';
         1: compression_level:='-3';
         2: compression_level:='-5';
         3: compression_level:='-7';
         end;
      outname:=out_param+'.'+paq_ver;
      out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
      get_in_param(in_param,sel);
      bin_name:=stringdelim(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+paq_ver+EXEEXT);
      if sys7zlin>1 then bin_name:=paq_ver+EXEEXT;
      cl:=bin_name+' '+compression_level+' '+out_param;
      if out_param<>trimright(in_param) then cl:=cl+' '+in_param;
      end;
   2: begin
      paq_ver:='zpaq';
      subfun:='archive';
      updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
      setspecialtsize;
      //check if input is suitable for chosen archive_type
      if check_input<>0 then exit;
      //output name
      getarch_baseoutname(s);
      s:=s+'.zpaq';
      apply_timestamptoname(s,1,0,'file');
      if updatingarchive_inarchive=false then get_new_archive_name(s);//check if name, with extension, exists
      cutextension(s); //cut extension since paq executable doesn't want extension
      out_param:=s;
      //Compression level
      case FormPeach.ComboBoxPAQLevel.ItemIndex of
         0: compression_level:='-method 1 a';
         1: compression_level:='-method 3 a';
         2: compression_level:='-method 4 a';
         3: compression_level:='-method 5 a';
         end;
      //Threads
      if FormPeach.ComboBoxPAQThreads.ItemIndex>0 then zthreads:='-threads '+FormPeach.ComboBoxPAQThreads.Caption;
      pw:=FormPW.EditPWpass.Text;
      if FormPW.EditPWkeyfile.Text<>'' then
         if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
            begin
            pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
            exit;
            end;
      if pw<>'' then
         begin
         if pw4cl('',pw)<>0 then
            begin
            msg_pw_errorchar(pw);
            exit;
            end;
         pw:='-key '+pw;
         end;
      outname:=out_param+'.zpaq';
      out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env))+'.zpaq');
      get_in_param_zpaq(in_param,sel);
      bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT);
      if sys7zlin>1 then bin_name:='zpaq'+EXEEXT;
      cl:=bin_name;
      //if intpw=1 then //not supported for zpaq
      if pw<>'' then cl:=cl+' '+pw;
      if zthreads<>'' then cl:=cl+' '+zthreads;
      cl:=cl+' '+compression_level+' '+out_param+' '+in_param;
      end;
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_zpaq_cl:=0;
end;

function compose_unzpaq_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
var
   out_param,in_param,bin_name,modefun,pw,filter1:ansistring;
   fstate,checksel:boolean;
   i:integer;
begin
compose_unzpaq_cl:=-1;
subfun:='extract';
btfun:='unzpaq';
set_output_option(out_param);
if mode<>'list' then if FormPeach.ComboBoxActionExtract.ItemIndex=4 then mode:='test';
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
   filesetattr(ptmpdir, faHidden);
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   if (mode<>'info') and (mode<>'list') and (mode<>'test') then
      if control_outpath(out_param)<>0 then exit;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
if zpaqabsolute=0 then //remove nesting
   begin
   if FormPeach.CheckBoxFolder.State=cbChecked then fstate:=true
   else fstate:=false;
   FormPeach.CheckBoxFolder.State:=cbChecked;
   end;
if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,0,mode);
if out_param<>'' then
   if out_param[length(out_param)]=directoryseparator then out_param:=copy(out_param,1,length(out_param)-1);
if zpaqabsolute=0 then
   if fstate=true then FormPeach.CheckBoxFolder.State:=cbChecked
   else FormPeach.CheckBoxFolder.State:=cbUnchecked;
outname:=out_param+directoryseparator;
in_param:=stringdelim(escapefilename(in_param,desk_env));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env)+'/'); //was needed by 4.04
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT);
if sys7zlin>1 then bin_name:='zpaq'+EXEEXT;
if mode='list' then modefun:='l'
else modefun:='x';
pw:=FormPW.EditPWpass.Text;
if FormPW.EditPWkeyfile.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
      begin
      pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
      exit;
      end;
if pw<>'' then
   begin
   if pw4cl('',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      exit;
      end;
   pw:='-key '+pw;
   end;
cl:=bin_name;
if pw<>'' then cl:=cl+' '+pw;
//partial selection is currently unsupported for zpaq with absolute paths and all revision options applied, otherwise it is supported for a single selected item
case mode of
   'list':
      cl:=cl+' '+modefun+' '+in_param;
   'test':
      begin
      cl:=cl+' '+modefun+' '+in_param+' -test';
      subfun:='test';
      end;
   else //mode ext, preview
      cl:=cl+' '+modefun+' '+in_param;
      {//the -to parameter mechanism to redirect output seems working only on a single input file or dir
      if selection='selected' then //extract object in the range of selection
         begin
         checksel:=false;
         {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then
            begin
            for i:=1 to FormPeach.StringGridList.RowCount-1 do
               if FormPeach.StringGridList.Cells[16,i]='1' then
                  begin
                  if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
                  filter1:=FormPeach.StringGridList.Cells[12,i];
                  cl:=cl+' '+stringdelim(escapefilename(filter1,desk_env));
                  checksel:=true;
                  end;
            end;
         if checksel=false then exit;
         end;}
      if (selection='single') and (mode='preview') then //extract a single object (enabled for preview)
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]); exit; end;
         filter1:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
         cl:=cl+' '+stringdelim(escapefilename(filter1,desk_env));
         tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
         end;
      if zpaqall=1 then cl:=cl+' -all';
      if (zpaqforce=1) or (mode='preview') then cl:=cl+' -f';
      if zpaqabsolute=0 then cl:=cl+' -to '+out_param;
   end;
{$IFDEF WIN64}
//enable Windows long paths in Zpaqfranz, only used in WIN64 (WIN32 is freezed with classic Zpaq) only for extract list test
//disabled as it seems currently forcing full paths wich may not be appropriate in most cases
//cl:=cl+' -longpath';
{$ENDIF}
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unzpaq_cl:=0;
end;

function compose_upx_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   P:tprocessutf8;
   numread,numwritten:integer;
   fin,fout:file of byte;
   read_data:array[0..65535]of byte;
   in_param,bin_name,compression_level,s,sl,clstrip:ansistring;
begin
compose_upx_cl:=-1;
fun:='UPX';
subfun:='archive';
btfun:='upx';
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;//should not apply
//check if input is suitable for chosen archive_type
if check_input<>0 then exit;
sl:=upcase(FormPeach.StringGridAdd.Cells[2,1]);
if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) and
   ((sl='.EXE') or
   (sl='.COM') or
   (sl='.DLL') or
   (sl='.OCX') or
   (sl='.SCR') or
   (sl='.SFX') or
   (sl='.SYS') or
   (sl='.ELF') or
   (sl='.O') or
   (sl='.SO') or
   (sl='.DYLIB') or
   (sl='')) then //single input executable file
else //folder(s) and/or multiple files
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_upx);
   exit;
   end;
if (FormPeach.ComboBoxUPX.ItemIndex=0) and (FormPeach.CheckBoxUPXStrip.State=cbUnchecked) then
   begin
   pMessageWarningOK(txt_upxorstrip);
   exit;
   end;
if FormPeach.ComboBoxUPX.ItemIndex=10 then compression_level:='--best'
else compression_level:='-'+inttostr((FormPeach.ComboBoxUPX.ItemIndex));
get_in_param(in_param,sel);
outname:=FormPeach.StringGridAdd.Cells[8,1];
{$IFDEF MSWINDOWS}
if not(FileExists(binpath+'upx'+DirectorySeparator+'upx.exe')) then
   begin
   cl:='';
   exit;
   end;
{$ENDIF}
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'upx'+DirectorySeparator+'upx'+EXEEXT);
if sys7zlin>1 then bin_name:='upx'+EXEEXT;
cl:=bin_name+' '+compression_level;
cl:=cl+' '+in_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
//do backup (silent) before strip/upx
if FormPeach.CheckBoxUPXBackup.State=cbChecked then
   begin
   try
   numread:=0;
   numwritten:=1;
   assignfile(fin,FormPeach.StringGridAdd.Cells[8,1]);
   filemode:=0;
   reset(fin);
   assignfile(fout,FormPeach.StringGridAdd.Cells[8,1]+'.backup');
   rewrite(fout);
   repeat
      blockread (fin,read_data,65536,numread);
      blockwrite (fout,read_data,numread,numwritten);
   until ((numread=0) or (numread<>numwritten));
   closefile(fin);
   closefile(fout);
   except
      exit;
   end;
   if numread<>numwritten then exit;
   end;
//strip (silent) before upx
if FormPeach.CheckBoxUPXStrip.State=cbChecked then
   begin
   {$IFDEF MSWINDOWS}
   clstrip:=('"'+binpath+'upx'+DirectorySeparator+'strip.exe" '+in_param);
   {$ELSE}//assuming generic unix coming with strip command
   clstrip:=('strip '+in_param);
   {$ENDIF}
   if FormPeach.Visible=true then Application.ProcessMessages;
   if validatecl(clstrip)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+clstrip); exit; end;
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
   {$IFDEF MSWINDOWS}
   if FileExists(binpath+'upx'+DirectorySeparator+'strip.exe') then
   {$ENDIF}
   peapexecute(P,clstrip);
   P.Free;
   end;
if FormPeach.ComboBoxUPX.ItemIndex=0 then //exit with -1 exitcode, not launching the task
   begin
   cl:='';
   exit;
   end;
compose_upx_cl:=0;
end;

function compose_brotli_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   s,out_param,in_param,bin_name,compression_level,exetype:ansistring;
begin
result:=-1;
fun:='BROTLI';
subfun:='archive';
btfun:='brotli';
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;
//check if input is suitable for chosen archive_type
if check_input<>0 then exit;
if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) then begin end //single input file
else //folder(s) and/or multiple files
   if (FormPeach.CheckBoxSeparate.State=cbUnchecked) or (FormPeach.CheckBoxSeparate.Enabled=false) then
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_multi);
   exit;
   end;
//output name
getarch_baseoutname(s);
s:=s+'.br';
apply_timestamptoname(s,1,0,'file');
//max Compression mode on/off
exetype:=FormPeach.RadioGroupQuad.Items[FormPeach.RadioGroupQuad.ItemIndex];
out_param:=s;
get_new_archive_name(out_param);
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
get_in_param(in_param,sel);
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'brotli'+DirectorySeparator+'brotli'+EXEEXT);
if sys7zlin>1 then bin_name:='brotli'+EXEEXT;
cl:=bin_name;
compression_level:='-'+FormPeach.cbLevel.Text;
if FormPeach.cbLevel.Text='11' then compression_level:='-q 11';
cl:=cl+' '+compression_level;
if FormPeach.CheckBoxBrotli.Checked=true then cl:=cl+' --large_window=27';
cl:=cl+' '+in_param+' -o '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
result:=0;
end;

function compose_unbrotli_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
var
   s1,out_param,in_param,bin_name:ansistring;
begin
result:=-1;
if mode<>'list' then if FormPeach.ComboBoxActionExtract.ItemIndex=4 then mode:='test';
if mode<>'test' then subfun:='extract' else subfun:='test';
btfun:='unbrotli';
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
   filesetattr(ptmpdir, faHidden);
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   if (mode<>'info') and (mode<>'list') and (mode<>'test') then
      if control_outpath(out_param)<>0 then exit;
if out_param<>'' then
   if out_param[length(out_param)] <> directoryseparator then out_param:=out_param+directoryseparator;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
set_output_folder(out_param,in_param,real_extract,0,mode);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   s1:=extractfilename(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
else
   s1:=extractfilename(FormPeach.EditOpenIn.Text);
cutextension(s1);
out_param:=out_param+s1;
if out_param<>'' then
   if out_param[length(out_param)] = directoryseparator then setlength(out_param,length(out_param)-1);
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
if real_extract=true then
   if not(checkdirexists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
in_param:=stringdelim(escapefilename(in_param,desk_env));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'brotli'+DirectorySeparator+'brotli'+EXEEXT);
if sys7zlin>1 then bin_name:='brotli'+EXEEXT;
if mode<>'test' then
   begin
   cl:=bin_name+' -d '+in_param+' -o '+out_param;
   if (zpaqforce=1) or (mode='preview') then cl:=cl+' -f';
   end
else cl:=bin_name+' -t '+in_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
result:=0;
end;

function compose_zstd_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   s,out_param,in_param,bin_name,compression_level,exetype:ansistring;
begin
result:=-1;
fun:='ZSTD';
subfun:='archive';
btfun:='zstd';
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;
//check if input is suitable for chosen archive_type
if check_input<>0 then exit;
if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) then begin end //single input file
else //folder(s) and/or multiple files
   if (FormPeach.CheckBoxSeparate.State=cbUnchecked) or (FormPeach.CheckBoxSeparate.Enabled=false) then
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_multi);
   exit;
   end;
//output name
getarch_baseoutname(s);
s:=s+'.zst';
apply_timestamptoname(s,1,0,'file');
//max Compression mode on/off
exetype:=FormPeach.RadioGroupQuad.Items[FormPeach.RadioGroupQuad.ItemIndex];
out_param:=s;
get_new_archive_name(out_param);
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
get_in_param(in_param,sel);
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zstd'+DirectorySeparator+'zstd'+EXEEXT);
if sys7zlin>1 then bin_name:='zstd'+EXEEXT;
cl:=bin_name;
compression_level:='-'+FormPeach.cbLevel.Text;
if FormPeach.cbLevel.Text='22' then compression_level:='--ultra -22';
cl:=cl+' -T0 -q '+compression_level;
if FormPeach.CheckBoxZstd.Checked=true then cl:=cl+' --long=31';
cl:=cl+' '+in_param+' -o '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
result:=0;
end;

function compose_unzstd_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
var
   s1,out_param,in_param,bin_name:ansistring;
begin
result:=-1;
if mode<>'list' then if FormPeach.ComboBoxActionExtract.ItemIndex=4 then mode:='test';
if mode<>'test' then subfun:='extract' else subfun:='test';
btfun:='unzstd';
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
   filesetattr(ptmpdir, faHidden);
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   if (mode<>'info') and (mode<>'list') and (mode<>'test') then
      if control_outpath(out_param)<>0 then exit;

if out_param<>'' then
   if out_param[length(out_param)] <> directoryseparator then out_param:=out_param+directoryseparator;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
set_output_folder(out_param,in_param,real_extract,0,mode);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   s1:=extractfilename(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
else
   s1:=extractfilename(FormPeach.EditOpenIn.Text);
cutextension(s1);
out_param:=out_param+s1;
if out_param<>'' then
   if out_param[length(out_param)] = directoryseparator then setlength(out_param,length(out_param)-1);
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
if real_extract=true then
   if not(checkdirexists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
in_param:=stringdelim(escapefilename(in_param,desk_env));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zstd'+DirectorySeparator+'zstd'+EXEEXT);
if sys7zlin>1 then bin_name:='zstd'+EXEEXT;
if mode<>'test' then
   begin
   cl:=bin_name+' -d '+in_param+' -o '+out_param;
   if (zpaqforce=1) or (mode='preview') then cl:=cl+' -f';
   end
else cl:=bin_name+' -t '+in_param;
cl:=cl+' --long=31';
if zstderr=1 then cl:=cl+' --no-check';
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
result:=0;
end;

function compose_quad_cl(var cl,jobcode,outname,sel:ansistring):integer;
var
   s,out_param,in_param,bin_name,compression_level,exetype:ansistring;
begin
compose_quad_cl:=-1;
fun:='QUAD';
subfun:='archive';
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;
//check if input is suitable for chosen archive_type
if check_input<>0 then exit;
if (tdirs=0) and (FormPeach.StringGridAdd.RowCount<3) then begin end //single input file
else //folder(s) and/or multiple files
   if (FormPeach.CheckBoxSeparate.State=cbUnchecked) or (FormPeach.CheckBoxSeparate.Enabled=false) then
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_multi);
   exit;
   end;
exetype:=FormPeach.RadioGroupQuad.Items[FormPeach.RadioGroupQuad.ItemIndex];
btfun:=exetype;
//output name
getarch_baseoutname(s);
s:=s+'.'+exetype;
apply_timestamptoname(s,1,0,'file');
out_param:=s;
get_new_archive_name(out_param);//issue: it adds progressive number after extension (it's however quite intuitive to remove)
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
get_in_param(in_param,sel);
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+exetype+EXEEXT);
if sys7zlin>1 then bin_name:=exetype+EXEEXT;
cl:=bin_name;
case FormPeach.RadioGroupQuad.ItemIndex of
   0: begin
      if FormPeach.CheckBoxQuadMax.State=cbChecked then compression_level:='-x'
      else compression_level:='';
      if compression_level<>'' then cl:=cl+' '+compression_level;
      end;
   1: begin
      cl:=cl+' e';
      if FormPeach.CheckBoxQuadMax.State=cbChecked then compression_level:='x'
      else compression_level:='';
      cl:=cl+compression_level;
      end;
   2: begin
      cl:=cl+' -b';
      compression_level:=FormPeach.ComboBoxBCMSolid.Items[FormPeach.ComboBoxBCMSolid.ItemIndex];
      cl:=cl+compression_level;
      end;
   end;
cl:=cl+' '+in_param+' '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_quad_cl:=0;
end;

function compose_unquad_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode:ansistring):integer;
var
   s1,s_in,out_param,in_param,bin_name:ansistring;
begin
compose_unquad_cl:=-1;
subfun:='extract';
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode;//directoryseparator is added in next step
   ptmpdir:=out_param;
   if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
   filesetattr(ptmpdir, faHidden);
   end
else //check path to avoid extraction in peazip's temporary path, switch out of first temporary level (by default archive's path)
   if (mode<>'info') and (mode<>'list') and (mode<>'test') then
      if control_outpath(out_param)<>0 then exit;

if out_param<>'' then
   if out_param[length(out_param)] <> directoryseparator then out_param:=out_param+directoryseparator;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   s_in:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   s_in:=FormPeach.EditOpenIn.Text;
//folder policy
set_output_folder(out_param,in_param,real_extract,0,mode);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   s1:=extractfilename(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
else
   s1:=extractfilename(FormPeach.EditOpenIn.Text);
cutextension(s1);
out_param:=out_param+s1;
if out_param<>'' then
   if out_param[length(out_param)] = directoryseparator then setlength(out_param,length(out_param)-1);
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
if fileexists(out_param) then
   if real_extract=true then
      if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
      else
         clearfile(out_param); //otherwise QUAD will not overwrite existing files and returns error exit code
if not(checkdirexists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
in_param:=stringdelim(escapefilename(s_in,desk_env));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
if extractfileext(s_in)='.quad' then
   begin
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+'quad'+EXEEXT);
   if sys7zlin>1 then bin_name:='quad'+EXEEXT;
   cl:=bin_name+' -d '+in_param+' '+out_param;
   btfun:='unquad';
   end;
if extractfileext(s_in)='.bcm' then
   begin
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+'bcm'+EXEEXT);
   if sys7zlin>1 then bin_name:='bcm'+EXEEXT;
   cl:=bin_name+' -d '+in_param+' '+out_param;
   btfun:='unbcm';
   end;
if extractfileext(s_in)='.balz' then
   begin
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+'balz'+EXEEXT);
   if sys7zlin>1 then bin_name:='balz'+EXEEXT;
   cl:=bin_name+' d '+in_param+' '+out_param;
   btfun:='unbalz';
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unquad_cl:=0;
end;

function compose_unace_cl(var cl,jobcode,outname:ansistring; real_extract:boolean; mode,selection:ansistring):integer;
var
   out_param,in_param,bin_name,archive_function:ansistring;
begin
compose_unace_cl:=-1;
//libre_directive level 1 and 2: disallow calls for non-free software (unace calls are discarded)
if libre_directive>0 then begin reportnotsupported_info('ACE'); exit; end;
subfun:='extract';
btfun:='unace';
set_output_option(out_param);
if (mode='ext') or (mode='extandrun') or ((mode='neutral') and (FormPeach.CheckBoxExtActionAdv.ItemIndex<2)) then
   if control_outpath(out_param)<>0 then exit;
if out_param<>'' then
   if out_param[length(out_param)] <> directoryseparator then out_param:=out_param+directoryseparator;
//in_param
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   in_param:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row]
else
   in_param:=FormPeach.EditOpenIn.Text;
//folder policy
if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,FormPeach.CheckBoxExtActionAdv.ItemIndex,mode);
if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
//archive function
case mode of
   'neutral' :
   case FormPeach.CheckBoxExtActionAdv.ItemIndex of
      0: archive_function:='x';
      1: archive_function:='e';
      2: begin
         archive_function:='l';
         subfun:='list';
         end;
      3: begin
         archive_function:='t';
         subfun:='test';
         end;
      end;
   'list' : //override function, if using list mode
   begin
   archive_function:='l';
   subfun:='list';
   end;
   'ext' : archive_function:='x';
   'extandrun' : //extandrun special feature, replaces archive function and overwrite policy: always extract the object, to be opened immediately after; if the object exist, ask about overwriting or skipping it
   begin
   if archive_function='e' then //extract without paths
      begin
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   if FormPeach.CheckBoxIgnorePaths.State=cbChecked then //option ignore archived paths for Extract and... override standard path policy; checking it it's possible ignoring paths only for Extract and... functions
      begin
      archive_function:='e';
      tempstring:=extractfilename(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
      end;
   if FormPeach.StringGridList.Cells[2,FormPeach.StringGridList.Row]=txt_list_isfolder then //if the object is a directory, paths are always preserved (this rule override all other rules)
      begin
      archive_function:='x';
      tempstring:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
      end;
   if fileexists((out_param+tempstring)) then
         if pMessageWarningYesNo(out_param+tempstring+' '+txt_confirm_overwrite)<>6 then exit;
   end;
   end;
if (archive_function<>'x') and (archive_function<>'e') then
   begin
   out_param:='';
   end;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unace'+DirectorySeparator+'unace'+EXEEXT);
//if sys7zlin>1 then bin_name:='unace'+EXEEXT;
cl:=bin_name+' '+archive_function;
in_param:=stringdelim(escapefilename(in_param,desk_env));
cl:=cl+' '+in_param;
//if out_param<>'' then cl:=cl+' '+out_param; changed the way to communicate out param; it's implicitly communicated setting working path since Win demo executable fails extracting to paths containing space
if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
if out_param<>'' then setcurrentdir(out_param);
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unace_cl:=0;
end;

procedure check_files(var in_param,cl,oper:ansistring);
var bin_name,disp_type,algo_list,ts:ansistring;
begin
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
case FormPeach.cbHashFormat.ItemIndex of
   0: disp_type:='HEX';
   1: disp_type:='BASE64';
   2: disp_type:='LSBHEX';
   end;
if oper='list' then algo_list:='LIST'
else
   if oper='preview' then algo_list:='PREVIEW'
   else
      case FormPeach.cbHash.ItemIndex of
         0: begin
            algo_list:='';
            ts:=UpCase(FormPeach.Editcommonalgo.Text);
            if pos('ADLER32',ts)<>0 then algo_list:=algo_list+'Adler32 ';
            if pos('CRC16',ts)<>0 then algo_list:=algo_list+'CRC16 ';
            if pos('CRC24',ts)<>0 then algo_list:=algo_list+'CRC24 ';
            if pos('CRC32',ts)<>0 then algo_list:=algo_list+'CRC32 ';
            if pos('CRC64',ts)<>0 then algo_list:=algo_list+'CRC64 ';
            if pos('EDONKEY',ts)<>0 then algo_list:=algo_list+'eDonkey ';
            if pos('MD4',ts)<>0 then algo_list:=algo_list+'MD4 ';
            if pos('MD5',ts)<>0 then algo_list:=algo_list+'MD5 ';
            if pos('RIPEMD160',ts)<>0 then algo_list:=algo_list+'Ripemd160 ';
            if pos('SHA1',ts)<>0 then algo_list:=algo_list+'SHA1 ';
            if pos('BLAKE2S',ts)<>0 then algo_list:=algo_list+'BLAKE2S ';
            if pos('SHA256',ts)<>0 then algo_list:=algo_list+'SHA256 ';
            if pos('SHA-3 256',ts)<>0 then algo_list:=algo_list+'SHA-3 256 ';
            if pos('BLAKE2B',ts)<>0 then algo_list:=algo_list+'BLAKE2B ';
            if pos('SHA512',ts)<>0 then algo_list:=algo_list+'SHA512 ';
            if pos('SHA-3 512',ts)<>0 then algo_list:=algo_list+'SHA-3 512 ';
            if pos('WHIRLPOOL512',ts)<>0 then algo_list:=algo_list+'Whirlpool512 ';
            if algo_list<>'' then SetLength(algo_list, length(algo_list)-1);
            if pos('ALL',FormPeach.Editcommonalgo.Text)<>0 then algo_list:='ALL';
            if algo_list='' then algo_list:='ALL';
            end;
         1: algo_list:='ALL';
         2: algo_list:='Adler32';
         3: algo_list:='CRC16';
         4: algo_list:='CRC24';
         5: algo_list:='CRC32';
         6: algo_list:='CRC64';
         7: algo_list:='eDonkey';
         8: algo_list:='MD4';
         9: algo_list:='MD5';
         10: algo_list:='Ripemd160';
         11: algo_list:='SHA1';
         12: algo_list:='BLAKE2S';
         13: algo_list:='SHA256';
         14: algo_list:='SHA-3 256';
         15: algo_list:='BLAKE2B';
         16: algo_list:='SHA512';
         17: algo_list:='SHA-3 512';
         18: algo_list:='Whirlpool512';
         end;
case oper of
   'SHA256SAVE','SHA256G','SHA256J','SHA256V','CRC32SAVE','MD5SAVE','SHA1SAVE','BLAKE2BSAVE':
   begin
   disp_type:='HEX';
   algo_list:=oper;
   end;
end;
cl:=bin_name+' CHECK '+disp_type+' '+algo_list+' ON '+in_param;
end;

procedure decode_7za_exitcode(i:integer; cl,s:ansistring);
begin
if FormPeach.cbType.Text=STR_UPX then
   begin
   case i of
   0: exit; //no error
   1: begin
      s:='1: '+txt_6_5_error+s+char($0d)+char($0a)+' - '+txt_cl+': '+cl;
      pMessageErrorOK(s);
      end;
   2: begin
      s:='2: '+txt_8_3_noupx;
      pMessageWarningOK(s);
      end;
   end;
   end
else
case i of
   0: exit; //the report is shown only if an error condition's exit code is encountered
   1: begin
      s:=txt_7z_exitcode1+s;
      pMessageWarningOK(s);
      end;
   2: begin
      s:=txt_7z_exitcode2+s+char($0d)+char($0a)+' - '+txt_cl+': '+cl;
      pMessageErrorOK(s);
      end;
   7: begin
      s:=txt_7z_exitcode7+s+char($0d)+char($0a)+' - '+txt_cl+': '+cl;
      pMessageErrorOK(s);
      end;
   8: begin
      s:=txt_7z_exitcode8+s+char($0d)+char($0a)+' - '+txt_cl+': '+cl;
      pMessageErrorOK(s);
      end;
   255:
      begin
      s:=txt_7z_exitcode255+s;
      pMessageWarningOK(s);
      end;
   else
      begin
      if i<0 then exit //closed
      else
         s:=inttostr(i)+txt_7z_exitcodeunknown+' '+s+char($0d)+char($0a)+' - '+txt_cl+': '+cl;
      pMessageErrorOK(s);
      end;
   end;
end;

procedure removezpaqnesting(spath:ansistring);
//input is a directory: find the first subdirectory not containing a sigle directory (contains a single file, or multiple files/dirs)
//move the subdirectory and its content into the initial directory, and remove the branch now containing only empty nested subdirectories
var
   fpath,ipath,npath,opath:ansistring;
   dfound:boolean;
begin
   fpath:=extractfilepath(spath);
   spath:=spath+DirectorySeparator;
   opath:=spath;
   ipath:='';
   if checkdirexists(spath) then
      begin
      dfound:=false;
      repeat
         if checksingle_intdir(spath,npath)=true then spath:=spath+npath+directoryseparator
         else
            dfound:=true;
         if ipath='' then ipath:=spath;
      until dfound=true;
      if movecontent_todir(spath,opath,0)=0 then
         try
         if (ipath<>opath) then cleardirsimple(ipath);
         except
         end;
      {if FormPeach.CheckBoxFolder.State=cbUnChecked then
         if movecontent_todir(opath,fpath,0)=0 then
            try
            if (opath<>fpath) then cleardirsimple(opath);
            except
            end;} //do not try to evade root dir
      end;
end;

procedure movezpaq(cl:ansistring);
var
   spath:ansistring;
begin
if zpaqfull=1 then exit;
if (fun='UNZPAQ') and (subfun='extract') and (zpaqabsolute=0) then //or (subfun='convert') disabled, must not be moved outside conversion directory
   begin
   if pos('-to',cl)<>0 then spath:=copy(cl,pos('-to',cl)+4,length(cl)-pos('-to',cl)-4) else exit;
   if (spath[1]<>' ') and (spath[1]<>'''') and (spath[1]<>'"') then exit;
   if spath[1]=' ' then spath:=copy(spath,2,length(spath)-1);
   if spath[1]='''' then spath:=copy(spath,2,length(spath)-1);
   if spath[1]='"' then spath:=copy(spath,2,length(spath)-1);
   if spath[length(spath)]='''' then spath:=copy(spath,1,length(spath)-1);
   if spath[length(spath)]='"' then spath:=copy(spath,1,length(spath)-1);
   if spath[length(spath)]='/' then spath:=copy(spath,1,length(spath)-1);
   if origoutnf<>'' then if (origoutnf<>spath+directoryseparator) then exit;
   removezpaqnesting(spath);
   end;
end;

procedure winUACelevation;
var
   w:widestring;
begin
{$IFDEF MSWINDOWS}
w:=utf8decode('"'+executable_path+'peazip.exe"');
ShellExecuteW(FormPeach.Handle, PWideChar ('runas'), PWideChar(w), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
exit_withsave;
{$ENDIF}
end;

function archive_mainsequence(var sel,outname:ansistring; var clres:integer):integer;
var
   cl,jobcode,s,poutname:ansistring;
begin
archive_mainsequence:=-1;
s:=FormPeach.cbType.Text;
if s=txt_sfx+' '+STR_ARC then s:='arcsfx';
if (s=txt_custom) or (s=txt_custom+'/RAR') then s:='custom';
if s=txt_split then s:='split';
case s of
   STR_ZPAQ: archive_mainsequence:=compose_zpaq_cl(cl,jobcode,outname,sel);
   STR_QUAD: archive_mainsequence:=compose_quad_cl(cl,jobcode,outname,sel);
   STR_BROTLI: archive_mainsequence:=compose_brotli_cl(cl,jobcode,outname,sel);
   STR_ZSTD: archive_mainsequence:=compose_zstd_cl(cl,jobcode,outname,sel);
   STR_UPX: archive_mainsequence:=compose_upx_cl(cl,jobcode,outname,sel);
   STR_ARC: archive_mainsequence:=compose_arc_cl(cl,jobcode,outname,sel);
   'arcsfx': archive_mainsequence:=compose_arc_cl(cl,jobcode,outname,sel);
   'custom': archive_mainsequence:=compose_custom_cl(cl,jobcode,outname,sel);
   'split': archive_mainsequence:=compose_rfs_cl(cl,jobcode,outname,sel);
   STR_PEA: archive_mainsequence:=compose_pea_cl(cl,jobcode,outname,sel);
   else //7z types (including sfx 7z menu entry)
      archive_mainsequence:= compose_archive_cl(cl,jobcode,outname,sel);
end;
if archive_mainsequence=0 then
   begin
   clres:=launch_cl(cl,jobcode,outname);

   if updatingarchive_inarchive = false then
      if (FormPeach.cbCustomExtension.Checked=true) and (FormPeach.EditCustomExtension.Caption<>'') then
      begin
      poutname:=outname;
      if FormPeach.EditCustomExtension.Caption[1]<>'.' then outname:=cutext(outname)+'.'+FormPeach.EditCustomExtension.Caption
      else outname:=cutext(outname)+FormPeach.EditCustomExtension.Caption;
      if checkfiledirname(outname)=0 then renamefile(poutname, outname);
      end;

   addtoarchivehistory(outname);
   end;
//exception for executable's compression: if only strip is used (silently) then UPX's cl is not composed and job is not launched, but operation is considered completed anyway
if FormPeach.cbType.Text=STR_UPX then archive_mainsequence:=0;
end;

function checklistarchive(var nsel:integer; var strsel:ansistring):integer; //number of archived objects, and formatted string with first 5 names
var
   rc,i:integer;
   s:ansistring;
begin
checklistarchive:=-1;
if FormPeach.StringGridAdd.Rowcount<2 then exit;
if FormPeach.StringGridAdd.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=FormPeach.StringGridAdd.Rowcount;
for i:=1 to rc-1 do
      begin
      nsel:=nsel+1;
      s:=FormPeach.StringGridAdd.Cells[1,i];
      case nsel of
         1: strsel:=strsel+s+char($0D)+char($0A);
         2: strsel:=strsel+s+char($0D)+char($0A);
         3: strsel:=strsel+s+char($0D)+char($0A);
         4: strsel:=strsel+s+char($0D)+char($0A);
         5: strsel:=strsel+s+char($0D)+char($0A);
         6: strsel:=strsel+'...';
         end;
      end;
if length(strsel)>2 then
   if strsel[length(strsel)]=char($0A) then
      setlength(strsel,length(strsel)-2);
if nsel>0 then checklistarchive:=0;
end;

procedure tarbefore(var sel,outname,cl:ansistring; realtar:boolean); //used only in case of single task, disabled for multiple tasks batch
var
   P:tprocessutf8;
   s,work_path,out_param,in_param,archive_function,bin_name,type_option,strsel,dummycl:ansistring;
   i,nsel,tberr:integer;
   {$IFDEF MSWINDOWS}
   fe,wd:ansistring;
   w0,w1:WideString;
   sei: TShellExecuteInfoW;
   seiexit:dword;
   {$ENDIF}
begin
using_tarbefore:=true;
tarbeforenameexception:=true;
//check input
if check_input<>0 then exit;
//output name
getarch_baseoutname(s);
out_param:=s+'.tar';
apply_timestamptoname(out_param,0,0,'file');
//archive function
archive_function:='a';
get_new_archive_name(out_param);
//archive type
case syntaxstring7z of
'21','17','16': type_option:='-ttar';
else
   begin
   if tartype=0 then type_option:='-ttar'
   else
   case tartime of
      0: type_option:='-ttar -mm=pax -mtp=0';
      1: type_option:='-ttar -mm=pax -mtp=1';
      2: type_option:='-ttar -mm=pax -mtp=3';
      end;
   if FormPeach.CheckBox7zOF.State=cbChecked then type_option:=type_option+' -ssw';//store files open for writing
   if FormPeach.CheckBoxsnoi.State=cbChecked then type_option:=type_option+' -snoi';//Linux, ids
   if FormPeach.CheckBoxsnon.State=cbChecked then type_option:=type_option+' -snon';//Linux, names
   if snh7z=1 then type_option:=type_option+' -snh'; //store hardlinks as links
   if snl7z=1 then type_option:=type_option+' -snl'; //store symlinks as links
   if tartype=1 then
      if (storecreated=1) then type_option:=type_option+' -mtc=on -mta=on';
   case syntaxstring7z of
   '17','16': begin end;
   else if ssp7z=1 then type_option:=type_option+' -ssp';
   end;
   //path option
   case FormPeach.ComboBox7zPaths.ItemIndex of
      1: type_option:=type_option+' -spf2';
      2: type_option:=type_option+' -spf';
      end;
   if FormPeach.Edit7zOpt.Text<>'' then type_option:=type_option+' '+FormPeach.Edit7zOpt.Text;
   end;
end;
case syntaxstring7z of
'17','16': begin end;
else if excludeef=1 then type_option:=type_option+' -xtd';
end;
// 7za uses -- as tag to distinguish a filename starting with - from a switch, however since Peach uses absolute filenames it should never occur and filenames are not checked for that condition
if pmode=0 then outname:=checkescapedoutname(escapefilename(out_param,desk_env)) else outname:=out_param;
getworkpath(work_path,out_param);
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
if (scripttarpipe=1) and (FormPeach.cbtarpipe.enabled=true) and (fun='7Z') then out_param:='dummy -so';
get_in_param(in_param,sel);
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
cl:=bin_name+' '+archive_function+' '+type_option;
if work_path<>'' then cl:=cl+' '+work_path;
if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
cl:=cl+' '+out_param+' '+in_param;
FormPeach.StringGridAdd.Cursor:=crHourGlass;
if FormPeach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
if realtar=true then
begin
{$IFDEF MSWINDOWS}
if (winver='nt6+') and
   (uacneeded=true) then
      begin
      if pMessageWarningYesNo(txt_9_9_uac)=mrYes then //restart the app elevated
         begin
         FormPeach.visible:=true;
         winUACelevation;
         FormPeach.visible:=false;
         exit;
         end
      else
         exit;
      end;
{if (winver='nt6+') and (uacneeded=true) then //create TAR, no password involved
   begin
   fe:='0';
   seiexit:=127;
   wd:=copy(cl,1,pos('.exe',cl)+4);
   w0:=utf8decode(stringdelim(wd));
   wd:=copy(cl,pos('.exe',cl)+6,length(cl)-pos('.exe',cl)-4);
   cl:=wd;
   w1:=utf8decode(cl);
   FillChar(sei, SizeOf(sei), 0);
   sei.cbSize := SizeOf(sei);
   sei.Wnd := 0;
   sei.fMask := SEE_MASK_NOCLOSEPROCESS;
   sei.lpVerb := PWideChar ('runas');
   sei.lpFile := PWideChar (w0);
   sei.lpParameters := PWideChar (w1);
   sei.nShow := SW_HIDE;
   ShellExecuteExW(@sei);
   while WaitForSingleObject(sei.hProcess, 50) <> WAIT_OBJECT_0 do
      begin
      fe:=inttostr(GetLastError);
      if fe='6' then break;
      Application.ProcessMessages;
      if stopped=true then TerminateProcess(sei.hProcess,255);
      end;
   GetExitCodeProcess(sei.hProcess, seiexit);
   tberr:=seiexit;
   end
else
   begin }
{$ENDIF}
P:=tprocessutf8.Create(nil);
{$IfDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF} //wait for tar to be finished before starting compression
peapexecute(P,cl);
i:=0;
while P.Running do
   begin
   i:=i+1;
   if i>100 then i:=1;
   FormPeach.PanelProgressAdd.Width:=(FormPeach.Width*i) div 100;
   Application.ProcessMessages;
   Sleep(100);
   end;
end;
tberr:=P.ExitStatus;
P.Free;
//secure delete on tarbefore
if realtar=true then
 if FormPeach.CheckBoxDeleteInputAdd.Checked=true then
   begin
   checklistarchive(nsel, strsel);
   if tberr<>0 then
      pMessageErrorOk('[TAR] '+txt_6_5_seqerr)
   else
      if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletefilesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 FormPeach.cbDeleteInputModeAdd.Caption+' '+inttostr(nsel)+' '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,1,dummycl);
         1: erase_fromarchiving(0,1,dummycl);
         2: erase_fromarchiving(2,1,dummycl);
         3: erase_fromarchiving(1,1,dummycl);
         end;
      {$ELSE}
      {$IFDEF DARWIN}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,1,dummycl);
         1: erase_fromarchiving(0,1,dummycl);
         2: erase_fromarchiving(2,1,dummycl);
         3: erase_fromarchiving(1,1,dummycl);
         end;
      {$ELSE}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(0,1,dummycl);
         1: erase_fromarchiving(2,1,dummycl);
         2: erase_fromarchiving(1,1,dummycl);
         end;
      {$ENDIF}
      {$ENDIF}
      end;
   end;
FormPeach.StringGridAdd.Cursor:=crDefault;
FormPeach.StringGridAdd.RowCount:=1;
addfilestr(FormPeach.StringGridAdd,outname);
FormPeach.StringGridAdd.AutoSizeColumns;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
if FormPeach.Visible=true then Application.processmessages;
if tberr=0 then tarbeforenameexception:=false;
end;

procedure untarafter(outname, inname:ansistring; var cl:ansistring; realuntar:boolean; optype:ansistring);
var
   star,starpath,desnz,in_param,out_param,bin_name,overwrite_policy,archive_function,fun1,fun2,fun_status1,clext,clprog,dummytitle,dummystr:ansistring;
   uaerr,i,dummyprogress,dummyprogressg:integer;
   P:tprocessutf8;
   {$IFDEF MSWINDOWS}
   fe,wd:ansistring;
   w0,w1:WideString;
   sei: TShellExecuteInfoW;
   seiexit:dword;
   {$ENDIF}
begin

case optype of
   'convert':
      begin
      if tar_atomic_convert=0 then exit;
      end;
    else
      begin
      if tar_atomic=0 then exit;
      end;
    end;

if setsequenceerror<>0 then exit;
if checkstopsequencefile=true then exit;

testarctype(inname,i,fun1);
fun2:=fun1;

if fun1='UNPAQ' then
   if outname[length(outname)]<>directoryseparator then
      outname:=outname+directoryseparator+extractfilename(inname);
if (fun1<>'UN7Z') and (fun1<>'UNARC') and (fun1<>'UNPEA') then outname:=extractfilepath(outname);

if outname[length(outname)]<>directoryseparator then
   in_param:=outname+directoryseparator+extractfilename(inname)
else
   in_param:=outname+extractfilename(inname);

cutextension(in_param);
starpath:=extractfilepath(in_param);
if not(fileexists(in_param)) then
   if checksingle_obj(starpath,star)= true then
      in_param:=starpath+star; //try to find tar file in output path if it does not matches with archive name
star:=in_param;

if upcase(extractfileext(in_param))='.TAR' then
   begin

   if (FormPeach.visible=false) and (FormGwrap.Visible=false) then FormPeach.visible:=true; //single or last untar task launched i.e. as -ext2here, when gwrap is no longer visible and main form not visible too
   if (optype='') and (realuntar=true) then
   begin
   if FormPeach.visible=true then
      {$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
      begin
      dummyprogress:=FormPeach.PanelProgressExtract.Width;
      dummytitle:=FormPeach.Caption;
      FormPeach.Caption:=txt_please_wait+' UNTAR '+extractfilename(in_param)+' ...';
      end;
   if FormGwrap.visible=true then
      begin
      FormGwrap.ButtonPause.enabled:=false;
      FormGwrap.ButtonStop.enabled:=false;
      FormGwrap.ButtonStopAll.enabled:=false;
      dummyprogressg:=FormGwrap.ShapeProgress.Width;
      dummystr:=FormGwrap.Caption;
      FormGwrap.Caption:=txt_please_wait+' UNTAR '+extractfilename(in_param)+' ...';
      end;
   end;

   clext:=cl;
   fun1:=fun;
   fun_status1:=fun_status;
   fun:='UN7Z';
   fun_status:=fun;
   //NT, NTFS options
   desnz:='';
   {$IFDEF MSWINDOWS}if snz7z=1 then desnz:='-snz' else {$ENDIF} desnz:='';
   //output in same path of input
   out_param:=starpath;
   //overwrite policy
   case extopt7z of
   0: overwrite_policy:='-aos';//skip existing files
   1: overwrite_policy:='-aou';//auto rename extracting files
   2: overwrite_policy:='-aot';//auto rename existing files
   3: overwrite_policy:='-aoa';//overwrite all existing files
   4: begin overwrite_policy:=''; zaout:=0; end;//auto switch to console mode if needed
   end;
   out_param:=stringdelim('-o'+escapefilename(out_param,desk_env));
   in_param:=stringdelim(escapefilename(in_param,desk_env));
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
   if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
   archive_function:='x';
   cl:=bin_name+' '+archive_function;
   if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
   if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
   case syntaxstring7z of
   '17','16': begin end;
   else if excludeef=1 then cl:=cl+' -xtd';
   end;
   cl:=cl+' '+out_param;
   {$IFDEF MSWINDOWS}
   case enc7zscc of
      0: cl:=cl+' -sccUTF-8';
      1: cl:=cl+' -sccWIN';
      2: cl:=cl+' -sccDOS';
      end;
   {$ENDIF}
   if desnz<>'' then cl:=cl+' '+desnz;
   if (scriptuntarpipe=1) and (FormPeach.cbuntarpipe.enabled=true) and
      (FormPeach.LabelStatusExtract.Caption=txt_2_7_ext) and (fun2='UN7Z') then in_param:='-si -ttar';
   cl:=cl+' '+in_param;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   if realuntar=true then
      begin
      {$IFDEF MSWINDOWS}
      if (winver='nt6+') and
      (uacneeded=true) then
      begin
      if pMessageWarningYesNo(txt_9_9_uac)=mrYes then //restart the app elevated
         begin
         FormPeach.visible:=true;
         winUACelevation;
         FormPeach.visible:=false;
         exit;
         end
      else
         exit;
      end;
      {if (winver='nt6+') and (uacneeded=true) then //extract TAR, no password involved
         begin
         fe:='0';
         seiexit:=127;
         wd:=copy(cl,1,pos('.exe',cl)+4);
         w0:=utf8decode(stringdelim(wd));
         wd:=copy(cl,pos('.exe',cl)+6,length(cl)-pos('.exe',cl)-4);
         cl:=wd;
         w1:=utf8decode(cl);
         FillChar(sei, SizeOf(sei), 0);
         sei.cbSize := SizeOf(sei);
         sei.Wnd := 0;
         sei.fMask := SEE_MASK_NOCLOSEPROCESS;
         sei.lpVerb := PWideChar ('runas');
         sei.lpFile := PWideChar (w0);
         sei.lpParameters := PWideChar (w1);
         sei.nShow := SW_HIDE;
         ShellExecuteExW(@sei);
         while WaitForSingleObject(sei.hProcess, 50) <> WAIT_OBJECT_0 do
            begin
            fe:=inttostr(GetLastError);
            if fe='6' then break;
            Application.ProcessMessages;
            if stopped=true then TerminateProcess(sei.hProcess,255);
            end;
         GetExitCodeProcess(sei.hProcess, seiexit);
         uaerr:=seiexit;
         end
      else
         begin}
      {$ENDIF}
      P:=tprocessutf8.Create(nil);
      {$IfDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF} //wait for tar to be extracted before following steps
      peapexecute(P,cl);
      while P.Running do
         begin
         if (optype='') and (realuntar=true) then
            begin
            if FormPeach.visible=true then
            {$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
               begin
               if FormPeach.PanelProgressExtract.Width>=FormPeach.Width then FormPeach.PanelProgressExtract.Width:=0;
               FormPeach.PanelProgressExtract.Width:=FormPeach.PanelProgressExtract.Width+3;
               end;
            if FormGwrap.visible=true then
               begin
               if FormGwrap.ShapeProgress.Width>=FormGwrap.Width then FormGwrap.ShapeProgress.Width:=0;
               FormGwrap.ShapeProgress.Width:=FormGwrap.ShapeProgress.Width+2;
               end;
            end;
         Application.ProcessMessages;
         Sleep(100);
         end;
      uaerr:=P.ExitStatus;
      P.Free;
      end;
   fun:=fun1;
   fun_status:=fun_status1;
   if realuntar=true then
      begin
      if uaerr<>0 then
         begin
         if fileexists(star) then setsequenceerror:=2 //error in untar
         else setsequenceerror:=3; //tar name not matching archive name
         {if FormPeach.CheckBoxDeleteInputExt.Checked=false then
            if setsequenceerror=2 then
               pMessageErrorOk('[UNTAR] '+txt_8_1_ed)
            else
               pMessageErrorOk('[UNTAR] '+txt_8_1_ed+char($0D)+char($0A)+txt_10_8_untarerr);}//interactive error message suppressed
         end;
      //if uaerr=0 then //always delete temp tar file, set sequence error to disable optional deletion of input archive
      udeletefile(star);
      end
   else
      begin
      {$IFDEF MSWINDOWS}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromuntarafter(star,3,0,clprog);
         1: erase_fromuntarafter(star,0,0,clprog);
         2: erase_fromuntarafter(star,2,0,clprog);
         3: erase_fromuntarafter(star,1,0,clprog);
         end;
         {$ELSE}
      {$IFDEF DARWIN}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromuntarafter(star,3,0,clprog);
         1: erase_fromuntarafter(star,0,0,clprog);
         2: erase_fromuntarafter(star,2,0,clprog);
         3: erase_fromuntarafter(star,1,0,clprog);
         end;
      {$ELSE}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromuntarafter(star,0,0,clprog);
         1: erase_fromuntarafter(star,2,0,clprog);
         2: erase_fromuntarafter(star,1,0,clprog);
         end;
      {$ENDIF}
      {$ENDIF}
      if (scriptuntarpipe=1) and (FormPeach.cbuntarpipe.enabled=true) and
         (FormPeach.LabelStatusExtract.Caption=txt_2_7_ext) and (fun2='UN7Z') then
      else cl:=cl+char($0D)+char($0A)+clprog;
      end;
   if (scriptuntarpipe=1) and (FormPeach.cbuntarpipe.enabled=true) and
      (FormPeach.LabelStatusExtract.Caption=txt_2_7_ext) and (fun2='UN7Z') then
      cl:=clext+' | '+cl
   else
      cl:=clext+char($0D)+char($0A)+cl;
   {$IFDEF MSWINDOWS}SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(starpath),nil);{$ENDIF}

   if (optype='') and (realuntar=true) then
   begin
   if FormPeach.visible=true then
   {$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
      begin
      FormPeach.PanelProgressExtract.Width:=dummyprogress;
      FormPeach.Caption:=dummytitle;
      end;
   if FormGwrap.visible=true then
      begin
      FormGwrap.ButtonPause.enabled:=true;
      FormGwrap.ButtonStop.enabled:=true;
      FormGwrap.ButtonStopAll.enabled:=true;
      FormGwrap.ShapeProgress.Width:=dummyprogressg;
      FormGwrap.Caption:=dummystr;
      end;
   end;
   end;
end;

procedure schedule_create(stype:integer);
var
   s,cl,shh,smm,jobcode,outname,schscrname,iname:ansistring;
   isched:integer;
   ispinedit,ispinhh,ispinmm:TSpinEdit;
   icheckgroup:TCheckGroup;
   icombobox:Tcombobox;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
with FormPeach do
begin
s:='schtasks /create /f';
//task name
if stype=0 then iname:=schedaddname.Caption
else iname:=SchedAddnameExt.Caption;
s:=s+' /tn "PeaZip\'+iname+'"';
//scheduling
if stype=0 then isched:=schedaddschedule.ItemIndex
else isched:=SchedAddscheduleExt.ItemIndex;
if stype=0 then ispinedit:=scheduleNN
else ispinedit:=scheduleNNext;
case isched of
0: s:=s+' /sc hourly /mo '+inttostr(ispinedit.Value);
1: s:=s+' /sc daily /mo '+inttostr(ispinedit.Value);
2:
begin
if stype=0 then icheckgroup:=CheckGroupW
else icheckgroup:=CheckGroupWExt;
s:=s+' /sc weekly /mo '+inttostr(ispinedit.Value)+' /d ';
if icheckgroup.Checked[0]=true then s:=s+'SUN,';
if icheckgroup.Checked[1]=true then s:=s+'MON,';
if icheckgroup.Checked[2]=true then s:=s+'TUE,';
if icheckgroup.Checked[3]=true then s:=s+'WED,';
if icheckgroup.Checked[4]=true then s:=s+'THU,';
if icheckgroup.Checked[5]=true then s:=s+'FRI,';
if CheckGroupW.Checked[6]=true then s:=s+'SAT';
if s<>'' then
   if s[length(s)]=',' then setlength(s,length(s)-1);
end;
3:
begin
if stype=0 then icheckgroup:=CheckGroupM1
else icheckgroup:=CheckGroupMExt;
s:=s+' /sc monthly /m ';
if icheckgroup.Checked[0]=true then s:=s+'JAN,';
if icheckgroup.Checked[1]=true then s:=s+'FEB,';
if icheckgroup.Checked[2]=true then s:=s+'MAR,';
if icheckgroup.Checked[3]=true then s:=s+'APR,';
if icheckgroup.Checked[4]=true then s:=s+'MAY,';
if icheckgroup.Checked[5]=true then s:=s+'JUN,';
if icheckgroup.Checked[6]=true then s:=s+'JUL,';
if icheckgroup.Checked[7]=true then s:=s+'AUG,';
if icheckgroup.Checked[8]=true then s:=s+'SEP,';
if icheckgroup.Checked[9]=true then s:=s+'OCT,';
if icheckgroup.Checked[10]=true then s:=s+'NOV,';
if icheckgroup.Checked[11]=true then s:=s+'DEC';
if s<>'' then
   if s[length(s)]=',' then setlength(s,length(s)-1);
if stype=0 then icombobox:=ComboBoxM2
else icombobox:=ComboBoxMExt;
if icombobox.itemindex<31 then
   s:=s+' /d '+inttostr(icombobox.itemindex+1)
else
   s:=s+' /mo LASTDAY';
end;
4: s:=s+' /sc once';
5: s:=s+' /sc onstart'; //works only as admin
6: s:=s+' /sc onlogin'; //works only as admin
end;
if isched<5 then
begin
//start time
if stype=0 then begin ispinhh:=schedulehh; ispinmm:=schedulemm; end
else begin ispinhh:=schedulehhext; ispinmm:=schedulemmext; end;
if ispinhh.value>9 then shh:=inttostr(ispinhh.value) else shh:='0'+inttostr(ispinhh.value);
if ispinmm.value>9 then smm:=inttostr(ispinmm.value) else smm:='0'+inttostr(ispinmm.value);
s:=s+' /st '+shh+':'+smm;
end;
//run as
if stype=0 then
   begin
   if scheduleuser.checked=true then
      if editscheduleuser.Caption<>'' then
         begin
         s:=s+' /ru "'+editscheduleuser.Caption+'"';
      if editschedulepassword.Caption<>'' then s:=s+' /rp "'+editschedulepassword.Caption+'"';
      end;
   end
else
   begin
   if scheduleuserext.checked=true then
      if EditScheduleUserExt.Caption<>'' then
         begin
         s:=s+' /ru "'+EditScheduleUserExt.Caption+'"';
         if EditSchedulePasswordExt.Caption<>'' then s:=s+' /rp "'+EditSchedulePasswordExt.Caption+'"';
      end;
   end;
//define task
try
if stype=0 then
   begin
   mconsolecreate.Clear;
   if importjobcl(cl,jobcode,outname)<>1 then exit;
   end
else
   begin
   mConsoleCreateExt.Clear;
   if importjobcl_extract(cl,jobcode,outname)<>1 then exit;
   end;
if not(checkdirexists(confpath+'Scheduled scripts'+DirectorySeparator)) then mkdir(confpath+'Scheduled scripts'+DirectorySeparator);
schscrname:=confpath+'Scheduled scripts'+DirectorySeparator+iname+'.bat';
s:=s+' /tr "\"'+schscrname+'""';
assignfile(t,schscrname);
rewrite(t);
write(t,cl);
closefile(t);
if stype=0 then mconsolecreate.Clear
else mConsoleCreateExt.Clear;
except
pMessageErrorOK(txt_5_1_schederr+char($0D)+char($0A)+s);
exit;
end;
//submit ScheduleAdd
cl:=s;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
peapexecute(P,cl);
pMessageInfoOK(txt_5_1_schedok+char($0D)+char($0A)+s);
end;
{$ENDIF}
end;

procedure getscheduledtaskname(stype:integer);
var
   s,s1:ansistring;
begin
with FormPeach do
begin
if stype=0 then
   begin
   s:=txt_archive;
   s1:=extractfilename(EditAddName.Text);
   cutextension(s1);
   if s1<>'' then s:=s+'_'+s1
   else s:=s+'_1';
   schedaddname.Text:=s;
   end
else
   begin
   s:=txt_caption_extract+'_1';
   SchedAddnameExt.Text:=s;
   end;
end;
end;

procedure setscripttarpipe;
begin
if scripttarpipe=1 then FormPeach.BtnPjLaunchAdd.enabled:=false else FormPeach.BtnPjLaunchAdd.enabled:=true;
if scripttarpipe=1 then FormPeach.cbtarpipe.State:=cbChecked else FormPeach.cbtarpipe.State:=cbunChecked;
end;

procedure setscriptuntarpipe;
begin
if scriptuntarpipe=1 then FormPeach.BtnPjLaunchExt.enabled:=false else FormPeach.BtnPjLaunchExt.enabled:=true;
if scriptuntarpipe=1 then FormPeach.cbuntarpipe.State:=cbChecked else FormPeach.cbuntarpipe.State:=cbunChecked;
end;

procedure removeselected;
var
   i,rc:integer;
begin
i:=1;
rc:=FormPeach.StringGridAdd.RowCount;
while i<rc do
   begin
   if FormPeach.StringGridAdd.Cells[11,i]='1' then
      begin
      FormPeach.StringGridAdd.DeleteColRow(false,i);
      i:=i-1;
      rc:=FormPeach.StringGridAdd.RowCount;
      end;
   i:=i+1;
   end;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
end;

procedure removeselected_ext;
var
   i,rc:integer;
begin
i:=1;
rc:=FormPeach.StringGridExtract.RowCount;
while i<rc do
   begin
   if FormPeach.StringGridExtract.Cells[11,i]='1' then
      begin
      FormPeach.StringGridExtract.DeleteColRow(false,i);
      i:=i-1;
      rc:=FormPeach.StringGridExtract.RowCount;
      end;
   i:=i+1;
   end;
updatecontent_ext;
end;

procedure archivemenu_name(pathpart:ansistring);
var
   s:ansistring;
begin
suggest_outname(s,FormPeach.cbType.Text,0);
FormPeach.EditAddFilepath.Text:=pathpart;
FormPeach.EditAddFilename.Text:=extractfilename(s);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
end;

procedure on_ComboBoxArchiveCompressionLevelChange;
begin
if settingvalues=false then
   with FormPeach do
      begin
      compression_level:=ComboBox7zLevel.Text;
      case cbType.Text of
         STR_7Z : level_7z:=ComboBox7zLevel.ItemIndex;
         STR_XZ : level_xz:=ComboBox7zLevel.ItemIndex;
         STR_BZIP2 : level_bzip2:=ComboBox7zLevel.ItemIndex;
         STR_GZIP : level_gz:=ComboBox7zLevel.ItemIndex;
         STR_ZIP : level_zip:=ComboBox7zLevel.ItemIndex;
         end;
      set_values(archive_type,compression_method,compression_level);
      getarccaption(FormPeach.cbType.Text);
      end;
setquickcompset('7Z');
end;

procedure msg_not_accessible(i:integer);
begin
//interactive error message suppressed
end;

procedure add2custom(custype:ansistring);
var
  i:integer;
  cusparam:ansistring;
begin
showpanel('archive');
showpanel_trick;
for i:=3 to paramcount do
if testname(ExpandFileName(paramstr(i)), FormPeach.StringGridAdd)=0 then
         if filegetattr(ExpandFileName(paramstr(i))) > 0 then
            if filegetattr(ExpandFileName(paramstr(i))) and faDirectory =0 then addfilestr(FormPeach.StringGridAdd,ExpandFileName(paramstr(i)))
            else addfolderstr(FormPeach.StringGridAdd,ExpandFileName(paramstr(i)))
         else msg_not_accessible(i);
FormPeach.StringGridAdd.AutoSizeColumns;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
stayopen:=false;
savetype:=false;
needsave:=false;
cusparam:=paramstr(2);
if custype='preset' then cusparam:=sharepath+'presets'+DirectorySeparator+cusparam+'.txt';
if not(FileExists(cusparam)) then exit;
applycompsettings(cusparam);
end;

procedure dospecfun(sf:ansistring);
var
   s,cl,jobcode,outname,dummyfun,dummysubfun,dummyinf:ansistring;
begin
dummyfun:=fun;
dummysubfun:=subfun;
dummyinf:=FormPeach.EditOpenIn.Text;
if fun='FILEBROWSER' then
   s:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]
else
   s:=FormPeach.EditOpenIn.Text;
FormPeach.EditOpenIn.Text:=s;
case upcase(extractfileext(s)) of
   '.RAR':
   if compose_rarspecfun_cl(cl,jobcode,outname,sf)=0 then
      begin
      if sf='c' then fun:='UPX'; //forces use of console
      if sf='r' then subfun:='repair';
      if sf='rr' then subfun:='rrec';
      launch_cl(cl,jobcode,outname);
      end;
   {'.ZIP':
   if compose_rarspecfun_cl(cl,jobcode,outname,sf)=0 then
      begin
      if sf='c' then fun:='UPX'; //forces use of console
      launch_cl(cl,jobcode,outname);
      end;}
   '.ARC','.WRC':
   if compose_arcspecfun_cl(cl,jobcode,outname,sf)=0 then
      begin
      if sf='r' then subfun:='repair';
      if sf='rr' then subfun:='rrec';
      launch_cl(cl,jobcode,outname);
      end;
end;
fun:=dummyfun;
subfun:=dummysubfun;
FormPeach.EditOpenIn.Text:=dummyinf;
end;

function importjobcl_convert(var cl,jobcode,outname:ansistring):integer;
var
   clprog:ansistring;
   i:integer;
begin
result:=0;
jobcode:='';
outname:='';
clprog:='';
FormPeach.mConsoleCreate.Clear;
FormPeach.lConsoleCreate_jobcode.Caption:='';
FormPeach.lConsoleCreate_outname.Caption:='';
for i:=1 to FormPeach.StringGridAdd.Rowcount-1 do
   clprog:=clprog+stringdelim(escapefilename(FormPeach.StringGridAdd.Cells[8,i],desk_env))+' ';
if convint=1 then cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2convert '+clprog
else cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2convimm '+clprog;
FormPeach.mConsoleCreate.Append(cl);
result:=1;
end;

function importjobcl(var cl,jobcode,outname:ansistring):integer;
var
   sel,s,clprog:ansistring;
   i:integer;
begin
result:=0;
imported_tarbeforejob:=false;
with FormPeach do
begin
mConsoleCreate.Clear;
lConsoleCreate_jobcode.Caption:='';
lConsoleCreate_outname.Caption:='';
if CheckBoxConvert.State=cbChecked then
   begin
   result:=importjobcl_convert(cl,jobcode,outname);
   //pMessageWarningOK(txt_2_8_convertexisting+char($0D)+char($0A)+txt_4_5_upxpj);
   exit;
   end;
if CheckBoxTarBefore.State=cbChecked then
   begin
   sel:='all';
   //place script to delete original files, if set, after tar creation
   if FormPeach.CheckBoxDeleteInputAdd.Checked=true then
   begin
   if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletefilesconfirm)=6 then
      begin
      {$IFDEF MSWINDOWS}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,0,cl);
         1: erase_fromarchiving(0,0,cl);
         2: erase_fromarchiving(2,0,cl);
         3: erase_fromarchiving(1,0,cl);
         end;
      {$ELSE}
      {$IFDEF DARWIN}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,0,cl);
         1: erase_fromarchiving(0,0,cl);
         2: erase_fromarchiving(2,0,cl);
         3: erase_fromarchiving(1,0,cl);
         end;
      {$ELSE}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(0,0,cl);
         1: erase_fromarchiving(2,0,cl);
         2: erase_fromarchiving(1,0,cl);
         end;
      {$ENDIF}
      {$ENDIF}
      end;
   end;
   //tarbefore changes input list
   tarbefore(sel,outname,clprog,false);
   imported_tarbeforejob:=true;
   if (scripttarpipe=1) and (fun='7Z') then clprog:=clprog+'| '
   else clprog:=clprog+char($0D)+char($0A)+cl;
   end;
if (cbType.Text=STR_UPX) then
   begin
   pMessageWarningOK('UPX'+char($0D)+char($0A)+txt_4_5_upxpj);
   exit;
   end;
if CheckBoxSeparate.State=cbChecked then
   begin
   clprog:='';
   for i:=1 to FormPeach.StringGridAdd.Rowcount-1 do
         begin
         FormPeach.StringGridAdd.Row:=i;
         FormPeach.StringGridAdd.Cells[11,i]:='1';
         application.processmessages;
         sel:=inttostr(i);
         suggest_outname(s,FormPeach.cbType.Text,i);
         s:=extractfilename(s); //keep only filename, set path to last used
         FormPeach.EditAddFilename.Text:=s;
         FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
         if (cbType.Text=txt_custom) or (cbType.Text=txt_custom+'/RAR') then
            if compose_custom_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=STR_ZPAQ) then
            if compose_zpaq_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=STR_QUAD) then
            if compose_quad_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=STR_BROTLI) then
            if compose_brotli_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=STR_ZSTD) then
            if compose_zstd_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=STR_ARC) or (cbType.Text=txt_sfx+' '+STR_ARC) then
            if compose_arc_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=txt_split) then
            if compose_rfs_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=STR_PEA) then
            if compose_pea_cl(cl,jobcode,outname,sel)<>0 then exit;
         if (cbType.Text=STR_7Z) or (cbType.Text=STR_XZ) or (cbType.Text=STR_WIM) or (cbType.Text=STR_BZIP2) or (cbType.Text=STR_GZIP) or (cbType.Text=STR_TAR) or (cbType.Text=STR_ZIP) or (cbType.Text=txt_sfx+' '+STR_7Z) then
            if compose_archive_cl(cl,jobcode,outname,sel)<>0 then exit;
         FormPeach.StringGridAdd.Cells[11,i]:='0';
         clprog:=clprog+cl+char($0D)+char($0A);
         end;
   cl:=clprog;
   mConsoleCreate.Clear;
   mConsoleCreate.Append(cl);
   lConsoleCreate_jobcode.Caption:=jobcode;
   lConsoleCreate_outname.Caption:=outname;
   end
else
begin
sel:='all';
if (cbType.Text=txt_custom)  or (cbType.Text=txt_custom+'/RAR') then
   if compose_custom_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_ZPAQ) then
   if compose_zpaq_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_QUAD) then
   if compose_quad_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_BROTLI) then
   if compose_brotli_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_ZSTD) then
   if compose_zstd_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_UPX) then
   if compose_upx_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_ARC) or (cbType.Text=txt_sfx+' '+STR_ARC) then
   if compose_arc_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=txt_split) then
   if compose_rfs_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_PEA) then
   if compose_pea_cl(cl,jobcode,outname,sel)<>0 then exit;
if (cbType.Text=STR_7Z) or (cbType.Text=STR_XZ) or (cbType.Text=STR_WIM) or (cbType.Text=STR_BZIP2) or (cbType.Text=STR_GZIP) or (cbType.Text=STR_TAR) or (cbType.Text=STR_ZIP) or (cbType.Text=txt_sfx+' '+STR_7Z) then
   if compose_archive_cl(cl,jobcode,outname,sel)<>0 then exit;
mConsoleCreate.Clear;
if CheckBoxTarBefore.State=cbChecked then
   begin
   clprog:=clprog+char($0D)+char($0A)+cl+char($0D)+char($0A);
   if (scripttarpipe=1) and (fun='7Z') then
   else
      begin
      erase_fromarchiving(0,0,cl);
      clprog:=clprog+cl;
      end;
   cl:=clprog
   end;
{$IFDEF MSWINDOWS}
mConsoleCreate.Append(cl);
{$ELSE}
mConsoleCreate.Append(cl+char($0D)+char($0A));
{$ENDIF}
lConsoleCreate_jobcode.Caption:=jobcode;
lConsoleCreate_outname.Caption:=outname;
end;
if CheckBoxTarBefore.State=cbUnChecked then
 if FormPeach.CheckBoxDeleteInputAdd.Checked=true then
   begin
   if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletefilesconfirm)=6 then
      begin
      {$IFDEF MSWINDOWS}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,0,cl);
         1: erase_fromarchiving(0,0,cl);
         2: erase_fromarchiving(2,0,cl);
         3: erase_fromarchiving(1,0,cl);
         end;
      {$ELSE}
      {$IFDEF DARWIN}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,0,cl);
         1: erase_fromarchiving(0,0,cl);
         2: erase_fromarchiving(2,0,cl);
         3: erase_fromarchiving(1,0,cl);
         end;
      {$ELSE}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(0,0,cl);
         1: erase_fromarchiving(2,0,cl);
         2: erase_fromarchiving(1,0,cl);
         end;
      {$ENDIF}
      {$ENDIF}
      mConsoleCreate.Append(cl);
      end;
   end;
end;
result:=1;
end;

function extract_finalize_bytype(fn,s:ansistring; var cl,jobcode,outname,mode:ansistring; realext:boolean): integer;
var
   overridecabext:boolean;
begin
if fun='FILEBROWSER' then testarctype(fn,extract_finalize_bytype,fun);

overridecabext:=false;
if (useextrac32=1) and (libre_directive=0) then
   if lowercase(extractfileext(fn))='.cab' then
      begin
      fun:='UNCUSTOM';
      fun_status:=fun;
      FormPeach.EditNameCustomExt.Text:='Extrac32';
      FormPeach.ComboBoxCustomSyntaxExt.ItemIndex:=0;
      customsyntax1:=0;
      overridecabext:=true;
      end;

extract_finalize_bytype:=-1;
case fun of
'UNCUSTOM':
   begin
   if (euns1=1) and (overridecabext=false) then
      begin
      if compose_un7z_cl(cl,jobcode,outname,realext,s,mode)<>0 then begin zaout:=zaout1; exit; end;
      end
   else
      if compose_uncustom_cl(cl,jobcode,outname,realext)<>0 then exit;
   end;
'UNPAQ': if compose_unpaq_cl(cl,jobcode,outname,realext,mode)<>0 then exit;
'UNZPAQ': if compose_unzpaq_cl(cl,jobcode,outname,realext,s,mode)<>0 then exit;
'UNLPAQ': if compose_unlpaq_cl(cl,jobcode,outname,realext,mode)<>0 then exit;
'UNQUAD': begin if compose_unquad_cl(cl,jobcode,outname,realext,mode)<>0 then exit; end;
'UNBROTLI': if compose_unbrotli_cl(cl,jobcode,outname,realext,s,mode)<>0 then exit;
'UNZSTD': if compose_unzstd_cl(cl,jobcode,outname,realext,s,mode)<>0 then exit;
'UNACE': if compose_unace_cl(cl,jobcode,outname,realext,s,mode)<>0 then exit;
'UNARC': if compose_unarc_cl(cl,jobcode,outname,realext,s,mode)<>0 then begin zaout:=zaout1; exit; end;
'UNPEA','RFJ': if compose_unpea_cl(cl,jobcode,outname)<>0 then exit;
'UN7Z': if compose_un7z_cl(cl,jobcode,outname,realext,s,mode)<>0 then begin zaout:=zaout1; exit; end;
end;
extract_finalize_bytype:=0;
end;

function importjobcl_extract(var cl,jobcode,outname:ansistring):integer;
var
   i,k:integer;
   clprog:ansistring;
begin
importjobcl_extract:=0;
with FormPeach do
begin
mConsoleCreateExt.Clear;
lConsoleCreate_jobcodeExt.Caption:='';
lConsoleCreate_outnameExt.Caption:='';
if FormPeach.LabelStatusExtract.Caption=txt_2_7_ext then
   begin
   clprog:='';
   k:=FormPeach.StringGridExtract.RowCount;
   FormPeach.StringGridExtract.Row:=1;
   FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='1';
   for i:=1 to k-1 do
      begin
      FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='0';
      end;
   FormPeach.StringGridExtract.Repaint;
   for i:=1 to k-1 do
      begin
      if extract_finalize_bytype(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row],'neutral',cl,jobcode,outname,extsel,false)<>0 then exit;
      fun:='FILEBROWSER';
      untarafter(outname,FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row],cl,false,'');
      FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='0';
      if FormPeach.StringGridExtract.Row<k then FormPeach.StringGridExtract.Row:=FormPeach.StringGridExtract.Row+1;
      FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='1';
      FormPeach.StringGridExtract.Repaint;
      clprog:=clprog+cl+char($0D)+char($0A);
      end;
   cl:=clprog;
   if FormPeach.CheckBoxDeleteInputExt.Checked=true then
      if FormPeach.ComboBoxActionExtract.ItemIndex<2 then
            if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletearchivesconfirm)=6 then
               begin
               {$IFDEF MSWINDOWS}
               case FormPeach.cbDeleteInputModeExt.ItemIndex of
                  0: erase_fromextraction(3,0,clprog);
                  1: erase_fromextraction(0,0,clprog);
                  2: erase_fromextraction(2,0,clprog);
                  3: erase_fromextraction(1,0,clprog);
                  end;
               {$ELSE}
               {$IFDEF DARWIN}
               case FormPeach.cbDeleteInputModeExt.ItemIndex of
                  0: erase_fromextraction(3,0,clprog);
                  1: erase_fromextraction(0,0,clprog);
                  2: erase_fromextraction(2,0,clprog);
                  3: erase_fromextraction(1,0,clprog);
                  end;
               {$ELSE}
               case FormPeach.cbDeleteInputModeExt.ItemIndex of
                  0: erase_fromextraction(0,0,clprog);
                  1: erase_fromextraction(2,0,clprog);
                  2: erase_fromextraction(1,0,clprog);
                  end;
               {$ENDIF}
               {$ENDIF}
               cl:=cl+char($0D)+char($0A)+clprog;
               end;
   zaout:=zaout1;
   mConsoleCreateExt.Clear;
   mConsoleCreateExt.Append(cl);
   lConsoleCreate_jobcodeExt.Caption:=jobcode;
   lConsoleCreate_outnameExt.Caption:=outname;
   end
else
   begin
   if extract_finalize_bytype(FormPeach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,false)<>0 then exit;
   untarafter(outname,FormPeach.EditOpenIn.Text,cl,false,'');
   if FormPeach.CheckBoxDeleteInputExt.Checked=true then
      if FormPeach.ComboBoxActionExtract.ItemIndex<2 then
            if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletearchivesconfirm)=6 then
               begin
               {$IFDEF MSWINDOWS}
               case FormPeach.cbDeleteInputModeExt.ItemIndex of
                  0: erase_fromextractarc(3,0,clprog);
                  1: erase_fromextractarc(0,0,clprog);
                  2: erase_fromextractarc(2,0,clprog);
                  3: erase_fromextractarc(1,0,clprog);
                  end;
               {$ELSE}
               {$IFDEF DARWIN}
               case FormPeach.cbDeleteInputModeExt.ItemIndex of
                  0: erase_fromextractarc(3,0,clprog);
                  1: erase_fromextractarc(0,0,clprog);
                  2: erase_fromextractarc(2,0,clprog);
                  3: erase_fromextractarc(1,0,clprog);
                  end;
               {$ELSE}
               case FormPeach.cbDeleteInputModeExt.ItemIndex of
                  0: erase_fromextractarc(0,0,clprog);
                  1: erase_fromextractarc(2,0,clprog);
                  2: erase_fromextractarc(1,0,clprog);
                  end;
               {$ENDIF}
               {$ENDIF}
               cl:=cl+char($0D)+char($0A)+char($0D)+char($0A)+clprog;
               end;
   zaout:=zaout1;
   mConsoleCreateExt.Clear;
   mConsoleCreateExt.Append(cl);
   lConsoleCreate_jobcodeExt.Caption:=jobcode;
   lConsoleCreate_outnameExt.Caption:=outname;
end;
end;
if cl<>'' then
   begin
   importjobcl_extract:=1;
   end;
end;

procedure save_pj(cl:ansistring);
begin
{$IFDEF MSWINDOWS}FormPeach.SaveDialogPJ.DefaultExt:='.bat';{$ELSE}FormPeach.SaveDialogPJ.DefaultExt:='.sh';{$ENDIF}
if not(checkdirexists(confpath+'Scripts'+DirectorySeparator)) then mkdir(confpath+'Scripts'+DirectorySeparator);
FormPeach.SaveDialogPJ.InitialDir:=confpath+'Scripts'+DirectorySeparator;
if FormPeach.SaveDialogPJ.Execute then
   if FormPeach.SaveDialogPJ.FileName<>'' then
      begin
      assignfile(t,FormPeach.SaveDialogPJ.FileName);
      rewrite(t);
      write(t,cl);
      closefile(t);
      end;
end;

procedure layout_savejob;
var
   cl,jobcode,outname:ansistring;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.Top=0{$ENDIF} then
begin
cl:=FormPeach.mConsoleCreate.Text;
if (cl<>'') and (length(cl)>3) then save_pj(cl)
else
   if importjobcl(cl,jobcode,outname)=1 then save_pj(cl);
end
else
begin
cl:=FormPeach.mConsoleCreateExt.Text;
if (cl<>'') and (length(cl)>3) then save_pj(cl)
else
   if importjobcl_extract(cl,jobcode,outname)=1 then save_pj(cl);
end;
end;

procedure display_cl(var cl,jobcode,outname:ansistring);
begin
with FormPeach do
   begin
   mConsoleCreateExt.Clear;
   mConsoleCreateExt.Append(cl);
   lConsoleCreate_jobcodeExt.Caption:=jobcode;
   lConsoleCreate_outnameExt.Caption:=outname;
   end;
end;

procedure createnewfolder;
var
   {$IFNDEF MSWINDOWS}P:tprocessutf8;{$ENDIF}
   {$IFNDEF MSWINDOWS}cl,{$ENDIF} s,out_param,tptmpdir:ansistring;
   w:widestring;
   i:integer;
begin
if (fun<>'FILEBROWSER') and (fun<>'UN7Z') then exit;
with FormPeach do
begin
{$IFDEF MSWINDOWS}
if EditOpenIn.Text=txt_mypc then exit;
{$ENDIF}
s:=txt_cnewfolder;

if not pInputQuery(txt_foldername, txt_name_provide, '', s, false) then exit;
if checkfilename(s)<>0 then
   begin
   pMessageWarningOK('"'+s+'" '+txt_checkname_failed+char($0D)+char($0A)+txt_name_provide);
   exit;
   end;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if s=FormPeach.StringGridList.Cells[1,i] then exit;
if fun='UN7Z' then
   begin

   if testeditable=false then exit;

   set_output_option(out_param);
   if work_dir=5 then exit;//exit if preview is disabled
   set_outpath_preview(out_param); //on preview switch to user temp transparently if output path is read only
   out_param:=out_param+ptmpcode+'f';//directoryseparator is added in next step
   if out_param<>'' then
      if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
   ForceDirectories(out_param+extractfilepath(EditUn7zaFilter.Caption)+s);
   tptmpdir:=ptmpdir;
   ptmpdir:=out_param;
   filesetattr(ptmpdir, faHidden);
   syncedit_archive;
   ptmpdir:=tptmpdir;
   cleardir(out_param,false,false);
   end;
if fun='FILEBROWSER' then
   begin
   {$IFDEF MSWINDOWS}
   w:=utf8decode(FormPeach.EditOpenIn.Text+s);
   ShellExecuteW(0, nil , PWideChar ('cmd'), PWideChar ('/c mkdir "'+w+'"'), PWideChar (''), SW_HIDE);
   {$ELSE}//system needs to support mkdir command
   cl:='mkdir '+stringdelim(escapefilename(FormPeach.EditOpenIn.Text+s,desk_env));
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit];
   peapexecute(P,cl);
   P.Free;
   {$ENDIF}
   end;
//navrefresh; //deactivated, refresh is now automatic
end;
end;

procedure save_new_theme;
var
   cl,work_path,bin_name,in_param,out_param:ansistring;
   P:tprocessutf8;
begin
themedir:='themes'+directoryseparator+FormPeach.edit1.text+directoryseparator;
theme_path:=themedir+'theme.txt';
graphicsfolder:=themedir;
try
if not(checkdirexists(confpath+themedir)) then
   forcedirectories(confpath+themedir)
else
   begin
   pMessageErrorOK(confpath+themedir+' '+txt_theme_exists);
   exit;
   end;
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /c xcopy '+stringdelim(FormPeach.LabelTheme1.hint+'*.*')+' '+stringdelim(confpath+themedir)+' /S /Y';
{$ELSE}
cl:='cp -p -r -f '+stringdelim(FormPeach.LabelTheme1.hint+'.')+' '+stringdelim(confpath+themedir);
{$ENDIF}
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
peapexecute(P,cl);
P.Free;
assignfile(conf,(confpath+theme_path));
rewrite(conf);
write_header(conf);
writeln(conf,FormPeach.Edit1.text);
writeln(conf,FormPeach.Edit2.text);
if FormPeach.Edit3.text='' then FormPeach.Edit3.text:='LGPLv3';
writeln(conf,FormPeach.Edit3.text);
writeconf_colors;
closefile(conf);
FormPeach.labeltheme1.hint:=confpath+themedir;
in_param:=stringdelim(escapefilename(confpath+themedir,desk_env));
out_param:=local_desktop+FormPeach.Edit1.text+'.theme.7z';
getworkpath(work_path,out_param);
out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT)+' a -t7z -m0=LZMA -mmt=on -mx5 -md=16m -mfb=32 -ms=2g';
if sys7zlin>0 then bin_name:=alias7z+EXEEXT+' a -t7z -m0=LZMA -mmt=on -mx5 -md=16m -mfb=32 -ms=2g';
if work_path<>'' then bin_name:=bin_name+' '+work_path;
cl:=bin_name+' '+out_param+' '+in_param;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
peapexecute(P,cl);
P.Free;
pMessageInfoOK(txt_done+' '+local_desktop+FormPeach.Edit1.text+'.theme.7z');
except
   pMessageErrorOK(txt_theme_create_error);
   exit;
end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection COMMENTS archive level comments routines

///////////////////////////////////////////////////////////////////////////////}

function readzipcomment(sfile:AnsiString; var commpos,commsize:int64; var commcontent:ansistring):integer;
var
   fs:file of byte;
   len:qword;
   sbuf:array [1..65558] of byte;//65536 max comment size + 22 footer size
   i,j,n,commarraysize:integer;
   commarraystart:int64;
   footerfound:boolean;
begin
result:=-1; //incomplete function
footerfound:=false;
commsize:=0;
commcontent:='';
if (LowerCase(extractfileext(sfile))<>'.zip') and
   (LowerCase(extractfileext(sfile))<>'.zipx') then exit;
if not(fileexists(sfile)) then exit;
try
assignfile(fs,sfile);//consistently with 7-Zip and WinrRar tis function does not work on multi-volume archives
filemode:=0;
reset(fs);
srcfilesize(sfile,len);
commarraystart:=len-65558;
if commarraystart<0 then
   begin
   commarraystart:=0;
   commarraysize:=len;
   end
else commarraysize:=65558;
seek(fs,commarraystart);
blockread(fs,sbuf,commarraysize,n);
for i:=1 to n-3 do  //4 byte footer tag
   begin
   if (sbuf[i]=80) and (sbuf[i+1]=75) and (sbuf[i+2]=5) and (sbuf[i+3]=6) then
      begin
      footerfound:=true;
      break;
      end;
   end;
except
result:=-2; //file error
try CloseFile(fs); except end;
exit;
end;
CloseFile(fs);
result:=-3; //testing footer tag
if footerfound=false then exit; //no valid footer tag found
result:=-4; //testing footer size
if n<i+21 then exit; //incomplete footer
commsize:= word(sbuf[i+21]) shl 8 or sbuf[i+20];
result:=-5; //testing comment size
if n<>commsize+i+21 then exit; //invalid comment size
commpos:=commarraystart+i+19;
if commsize<>0 then SetString(commcontent, PChar(@sbuf[i+22]), commsize);
result:=0; //valid comment read
end;

function writezipcomment(sfile:AnsiString; var commpos,oldcommsize:int64; oldcommcontent,newcommcontent:ansistring): integer;
var
   fs:file of byte;
   testcommsize,newcommsize:int64;
   testcommcontent:ansistring;
   sbuf:array [1..65536] of byte;//65536 max comment size
   n,i:integer;
   bytes: TBytes;
begin
result:=-1; //incomplete function
if newcommcontent=oldcommcontent then
   begin
   result:=2; //does not need to update comment
   exit;
   end;
if (LowerCase(extractfileext(sfile))<>'.zip') and
   (LowerCase(extractfileext(sfile))<>'.zipx') then exit;
if not(fileexists(sfile)) then exit;
try
assignfile(fs,sfile);
filemode:=2;
reset(fs);
seek(fs,commpos);
blockread(fs,sbuf,2,n);
testcommsize:= word(sbuf[2]) shl 8 or sbuf[1];
blockread(fs,sbuf,65536,n);
except
result:=-2; //file error
try CloseFile(fs); except end;
exit;
end;
result:=-3; //testing comment size
if testcommsize<>oldcommsize then exit; //comment size not matching, file may have been changed
result:=-4; //testing comment content
if testcommsize<>0 then SetString(testcommcontent, PChar(@sbuf[1]), testcommsize);
if testcommcontent<>oldcommcontent then exit; //comment content not matching, file may have been changed
result:=1; //valid comment found
newcommsize:=length(newcommcontent);
if newcommsize>65535 then
   begin
   SetLength(newcommcontent,65535);
   newcommsize:=65535;
   end;
try
seek(fs,commpos);
sbuf[1] := Byte(newcommsize);
sbuf[2] := Byte(Word(newcommsize) shr 8);
blockwrite(fs,sbuf,2,n);
for i:=1 to newcommsize do sbuf[i]:=ord(newcommcontent[i]);
blockwrite(fs,sbuf,newcommsize,n);
seek(fs,commpos+2+newcommsize);
Truncate(fs);
except
result:=-5; //file write error
try CloseFile(fs); except end;
exit;
end;
result:=0; //comment updated successfully
CloseFile(fs);
end;

procedure readrarcomment(inname:ansistring);//cannot read comment in mgotypeRAR with encrypted TOC if password is not provided
var
   cl,jobcode,out_param,bin_name,prevfun,prevsubfun,pw,pw_option:ansistring;
   prevstate:boolean;
   tintpw:byte;
begin
UnitGwrap.pjobcommentrar:=1;
UnitGwrap.pjobuserar:=0;
prevfun:=fun;
prevsubfun:=subfun;
fun:='UN7Z';
fun_status:=fun;
subfun:='list';
out_param:='';
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
inname:=stringdelim(escapefilename(inname,desk_env));
{if (havewinrar=true) and (userar=1) then //unused, localized mgotypeRAR.exe does not allow to easily detect "Comment not present" case
   begin
   UnitGwrap.pjobuserar:=1;
   bin_name:=stringdelim(escapefilename(FormPeach.EditnameCustom.Text,desk_env));
   cl:=bin_name+' cw';
   end
else
   begin
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
   cl:=bin_name+' l';
   if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
   end;}
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
cl:=bin_name+' l';
prevstate:=UnitGwrap.exbackground;
UnitGwrap.exbackground:=true;
listmode:=0;
if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
//mgotypeRAR encryption
   if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
      pw_option:='-p'
   else
      pw_option:='';
   pforceconsole:=0;
   pipepw:='';
   piperar:=false;
   if pw_option<>'' then
         begin
         pw:=FormPW.EditPWpass.Text;
         if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
            if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
               begin
               pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
               exit;
               end;
         pipepw:=pw;
         if pw4cl(pw_option,pw)<>0 then
            begin
            exit;
            end;
         end;
if pipepw='' then pipepw:='default';//never pass wmpty password to list type operation
cl:=cl+' '+inname;
tintpw:=intpw;
intpw:=0;
launch_cl(cl,jobcode,out_param);
intpw:=tintpw;
UnitGwrap.exbackground:=prevstate;
fun:=prevfun;
fun_status:=prevfun;
subfun:=prevsubfun;
UnitGwrap.pjobuserar:=0;
UnitGwrap.pjobcommentrar:=0;
end;

procedure writerarcomment(in_param:ansistring);
var
   cl,jobcode,outname,dummyfun,dummysubfun,dummyinf:ansistring;
begin
dummyfun:=fun;
dummysubfun:=subfun;
dummyinf:=FormPeach.EditOpenIn.Text;
FormPeach.EditOpenIn.Text:=in_param;
fun:='UPX';
subfun:='rarcomment';
case upcase(extractfileext(in_param)) of
   '.RAR':
   if compose_rarspecfun_cl(cl,jobcode,outname,'c')=0 then
      begin
      try
      rarcommentfilename:=peaziptmpdirroot+STR_PZWORKTMP+directoryseparator+'rarcomment.txt';
      ForceDirectories(peaziptmpdirroot+STR_PZWORKTMP+directoryseparator);
      assignfile(t,rarcommentfilename);
      rewrite(t);
      write(t,FormComment.MemoComment.Caption);
      closefile(t);
      except
      try closefile(t); except end;
      end;
      cl:=cl+' < '+stringdelim(escapefilename(rarcommentfilename,desk_env));
      launch_cl(cl,jobcode,outname); //fails if mgotypeRAR TOC is encrypted and password is requested, because input pipe is used by comment file
      udeletefile(rarcommentfilename);
      end;
end;
fun:=dummyfun;
subfun:=dummysubfun;
FormPeach.EditOpenIn.Text:=dummyinf;
end;

procedure setcomment_list; //edit single multiple file-level comments for selected archives
var
   commpos,commsize:int64;
   s,in_param,strsel:ansistring;
   i,nsel:integer;
   firstfile:boolean;
begin
in_param:='';
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
if FormPeach.EditOpenIn.Text=txt_mypc then exit;
firstfile:=true;
if FormPeach.visible=true then
   begin
   for i:=1 to FormPeach.StringGridList.Rowcount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if firstfile=true then
            begin
            in_param:=FormPeach.StringGridList.Cells[12,i];
            if (upcase(ExtractFileExt(in_param))<>'.RAR') and (upcase(ExtractFileExt(in_param))<>'.ZIP') and (upcase(ExtractFileExt(in_param))<>'.ZIPX') then continue;
            firstfile:=false;
            if (upcase(ExtractFileExt(in_param))<>'.RAR') then readzipcomment(in_param,commpos,commsize,s)
            else
               begin
               readrarcomment(in_param);
               s:=UnitGwrap.rarcomment;
               end;
            FormComment.Caption:=txt_7_4_comment+' | '+inttostr(nsel)+' '+txt_selected_obj+' | '+ExtractFileName(in_param);
            FormComment.MemoComment.Text:=s;
            UnitComment.incomment:=s;
            FormComment.Showmodal;
            if FormComment.ModalResult=mrOK then
               begin
               if (upcase(ExtractFileExt(in_param))<>'.RAR') then writezipcomment(in_param,commpos,commsize,s,FormComment.MemoComment.Text)
               else writerarcomment(in_param);
               end
            else
               exit;
            end
         else
            begin
            in_param:=FormPeach.StringGridList.Cells[12,i];
            if (upcase(ExtractFileExt(in_param))<>'.RAR') and (upcase(ExtractFileExt(in_param))<>'.ZIP') and (upcase(ExtractFileExt(in_param))<>'.ZIPX') then continue;
            if (upcase(ExtractFileExt(in_param))<>'.RAR') then readzipcomment(in_param,commpos,commsize,s);//need to find starting position suitable for the comment
            if (upcase(ExtractFileExt(in_param))<>'.RAR') then writezipcomment(in_param,commpos,commsize,s,FormComment.MemoComment.Text)
            else writerarcomment(in_param);
            end;
         end;
   end;
end;

procedure readcomment;
var
   commentstring:AnsiString;
   commpos,commsize:int64;
begin
commentstring:='';
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
case fun of
   'UN7Z':
   begin
   if (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.RAR') and (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.ZIP') and (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.ZIPX') then exit;
   if (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.RAR') then readzipcomment(FormPeach.EditOpenIn.Caption,commpos,commsize,commentstring)
   else
      begin
      readrarcomment(FormPeach.EditOpenIn.Caption);
      commentstring:=UnitGwrap.rarcomment;
      end;
   end;
end;
if commentstring<>'' then
   begin
   FormPeach.LabelComment.Caption:=upcase(txt_7_4_comment);
   FormPeach.LabelComment.Hint:=commentstring;
   end
else
   begin
   FormPeach.LabelComment.Caption:='';
   FormPeach.LabelComment.Hint:='';
   end;
end;

procedure setcomment; //does not currently work with encrypted mgotypeRAR files, comment is not read by 7z/p7zip
var
   s:AnsiString;
   commpos,commsize:int64;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.Visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
case fun of
   'UN7Z':
   begin
   if (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.RAR') and (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.ZIP') and (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.ZIPX') then exit;
   if (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.RAR') then readzipcomment(FormPeach.EditOpenIn.Caption,commpos,commsize,s)
   else
      begin
      readrarcomment(FormPeach.EditOpenIn.Caption);
      s:=UnitGwrap.rarcomment;
      end;
   FormComment.Caption:=txt_7_4_comment+' | '+ExtractFileName(FormPeach.EditOpenIn.Caption);
   FormComment.MemoComment.Text:=s;
   UnitComment.incomment:=s;
   FormComment.Showmodal;
   if FormComment.ModalResult=mrOK then
      begin
      if (upcase(ExtractFileExt(FormPeach.EditOpenIn.Caption))<>'.RAR') then writezipcomment(FormPeach.EditOpenIn.Caption,commpos,commsize,s,FormComment.MemoComment.Text)
      else writerarcomment(FormPeach.EditOpenIn.Caption);
      if FormComment.MemoComment.Text<>'' then
         begin
         FormPeach.LabelComment.Caption:=upcase(txt_7_4_comment);
         FormPeach.LabelComment.Hint:=FormComment.MemoComment.Text;
         end
      else
         begin
         FormPeach.LabelComment.Caption:='';
         FormPeach.LabelComment.Hint:='';
         end;
      end;
   end;
   'FILEBROWSER': setcomment_list;
   end;
end;

procedure setcommentcl;
var
   i,firstfile:integer;
   in_param,newcomment,s,dummy,commentfile:AnsiString;
   commpos,commsize:int64;
   fcomment: text;
   fsize:qword;
begin
case paramstr(1) of
   '-setcomment':
   begin
   firstfile:=3;
   newcomment:=paramstr(2);
   end;
   '-setcommentf':
   begin
   firstfile:=3;
   newcomment:='';
   commentfile:=paramstr(2);
   if commentfile<>'' then
      begin
      try
      srcfilesize(commentfile,fsize);
      if fsize=0 then exit;
      assignfile(fcomment,commentfile);
      filemode:=0;
      reset(fcomment);
      repeat
         readln(fcomment,dummy);
         newcomment:=newcomment+dummy+char($0D)+char($0A);
      until eof(fcomment);
      closefile(fcomment);
      if length(newcomment)>2 then SetLength(newcomment,length(newcomment)-2);
      if length(newcomment)>64*1024-16 then SetLength(newcomment,64*1024-16);//full 64K does not work with mgotypeRAR.exe backend
      except
      try closefile(fcomment); except end;
      end;
      end;
   end;
   '-removecomment':
   begin
   firstfile:=2;
   newcomment:='';
   end;
end;
for i:=firstfile to ParamCount do
   begin
   in_param:=ExpandFileName((paramstr(i)));
   if (upcase(ExtractFileExt(in_param))<>'.RAR') and (upcase(ExtractFileExt(in_param))<>'.ZIP') and (upcase(ExtractFileExt(in_param))<>'.ZIPX') then continue;
   if (upcase(ExtractFileExt(in_param))<>'.RAR') then readzipcomment(in_param,commpos,commsize,s);
   FormComment.MemoComment.Text:=newcomment;
   if (upcase(ExtractFileExt(in_param))<>'.RAR') then writezipcomment(in_param,commpos,commsize,s,FormComment.MemoComment.Text)
   else writerarcomment(in_param);
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection LAUNCH command line with progress window

///////////////////////////////////////////////////////////////////////////////}

function launch_cl(cl,jobcode,outname:ansistring):integer; //control command line size then launch cl
var
   P: tprocessutf8;
   tsin,tsout:TTimeStamp;
   tdiff,speed:qword;
   q:qword;
   s,s1:ansistring;
   i,jobtype:integer;
   keepopen:boolean;
   t: TextFile;

   procedure clean_after_launch;
   begin
   inputfile:='';
   UnitGwrap.pfromnativedrag:=false;
   end;

  procedure withconsole; //cannot use pipe, as it is meant to display the console rather than redirect its in/output
   var
      i:integer;
      clconsole:ansistring;
   begin
   s:=char($0d)+char($0a)+' - '+txt_job_code+' '+jobcode+' '+char($0d)+char($0a);
   if (fun='7Z') or (fun='PAQ') or (fun='UPX') then s:=s+' - '+txt_input+' '+inttostr(tfiles)+' '+txt_files+' '+inttostr(tdirs)+' '+txt_dirs+' '+nicenumber(inttostr(tsize),filesizebase)
   else
      begin
      s:=s+' - '+txt_input+' '+FormPeach.EditOpenIn.Text;
      s:=s+', '+nicenumber(inttostr(tsize),filesizebase);
      end;
   s1:=char($0d)+char($0a)+txt_input_list+char($0d)+char($0a);
   if (fun='7Z') or (fun='PAQ') then for i:=1 to FormPeach.StringGridAdd.RowCount-1 do s1:=s1+FormPeach.StringGridAdd.Cells[8,i]+char($0d)+char($0a)
   else s1:=s1+FormPeach.EditOpenIn.Text;
   tsin:=datetimetotimestamp(now);
   {$IFDEF MSWINDOWS}
   P.Options:=[poNewConsole,powaitonexit];
   {$ELSE}
   {if ((subfun='extract') or (subfun='convert')) and
      (FormPeach.CheckBoxrelative.Checked=true) and
      (FormPeach.CheckBoxrelative.enabled=true) and
      (FormPeach.CheckBoxFolder.Checked=false) then
      //workaround for Linux: currently poNewConsole does not reliably respect with poWaitOnExit (on most terminals) relying on the specific behavior of the invoked terminal app
      //this will make the app continue with moving after extraction without waiting for extraction process to terminate
      //the workaround makes not possible to access to the console on password request (force interactive pasword) event on extraction, if needed, which makes the process fail
      P.Options:=[poWaitOnExit]
   else}
      P.Options:=[poNewConsole];
   {$ENDIF}
   clconsole:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   keepopen:=false;

   if (subfun='rarcomment') then
      begin
      {$IFDEF MSWINDOWS}
      clconsole:='cmd /c "'+cl+'"';
      {$ELSE}
      clconsole:='bash -c "'+cl+'"';
      {$IFDEF DARWIN}
      clconsole:='open '+cl;
      {$ENDIF}
      {$ENDIF}
      end;

   if (subfun='list') or (subfun='test') or (subfun='bench') then //unused
      begin
      {$IFDEF MSWINDOWS}
      clconsole:='cmd /k "'+cl+'"';
      {$ELSE}
      clconsole:='bash -c "'+cl+'; read line"';
      {$IFDEF DARWIN}
      clconsole:='open '+cl;
      {$ENDIF}
      {$ENDIF}
      keepopen:=true;
      end;
   peapexecute(P,clconsole);

   {$IFNDEF MSWINDOWS}
   repeat
      if FormPeach.Visible=true then Application.ProcessMessages;
      sleep(100);
   until P.ExitStatus <> -1;
   {$ENDIF}

   while P.Running do
      begin
      if FormPeach.Visible=true then Application.ProcessMessages;
      sleep(100);
      end;
   tsout:=datetimetotimestamp(now);
   tdiff:=tsout.time-tsin.time;
   if tdiff=0 then tdiff:=1;
   q:=tsize * 1000; //speed is in B/s
   if tdiff<>0 then speed:=q div tdiff;
   s:=s+char($0d)+char($0a)+' - '+txt_elapsed+' '+inttostr(tdiff)+' ms';
   if speed>0 then s:=s+', '+txt_speed+' '+inttostr(speed)+' B/s';
   if keepopen=false then decode_7za_exitcode(P.ExitStatus,cl,s);
   end;

begin
result:=-1;
setsequenceerror:=1;

{$IFDEF MSWINDOWS}
if (winver='nt6+') and
   (uacneeded=true) and
   ((subfun='archive') or (subfun='extract') or (subfun='convert')) then
      begin
      if pMessageWarningYesNo(txt_9_9_uac)=mrYes then //restart the app elevated
         begin
         FormPeach.visible:=true;
         winUACelevation;
         FormPeach.visible:=false;
         exit;
         end
      else
         exit;
      end;
{$ENDIF}

if length(cl)>max_cl then
   begin
   pMessageErrorOK(txt_cl_long);
   if pdrop=true then
      begin
      try
      assignfile(t,peaziptmpdir+STR_TMPDROPE);
      rewrite(t);
      closefile(t);
      except
      end;
      end;
   clean_after_launch;
   exit;
   end;
if intpw=1 then pforceconsole:=1;
i:=validatecl(cl);
if i<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   if pdrop=true then
      begin
      try
      assignfile(t,peaziptmpdir+STR_TMPDROPE);
      rewrite(t);
      closefile(t);
      except
      end;
      end;
   clean_after_launch;
   exit;
   end;
P:=tprocessutf8.Create(nil);
if FormPeach.CheckBoxTarBefore.State=cbChecked then P.Options := [poWaitOnExit];
if needwaitupdating=true then P.Options := [poWaitOnExit];
s:=FormPeach.EditOpenIn.Text;
if (fun='PEA') or (fun='UNPEA') or (fun='RFJ') or (fun='RFS') then
   begin //does not have a console
   P.Options := [poWaitOnExit];
   peapexecute(P,cl);
   result:=P.ExitStatus;
   if result=0 then setsequenceerror:=0
   else
      if pdrop=true then
         begin
         try
         assignfile(t,peaziptmpdir+STR_TMPDROPE);
         rewrite(t);
         closefile(t);
         except
         end;
         end;
   clean_after_launch;
   P.Free;
   end //launch Pea
else //launch either or pealauncher or ConsoleCreate application, depending on rules
   begin
   if (pforceconsole=1) or (fun='UPX') or ((fun='UNACE') and (subfun<>'list')) then //UPX and UNACE(extract and test) should run without pealauncher (the latter to allowing input in console), ACE listing is possible in pealauncher because doesn't require feedback even if archive is encrypted
      begin
      withconsole;
      result:=P.ExitStatus;
      inputfile:='';
      UnitGwrap.pfromnativedrag:=false;
      if result=0 then setsequenceerror:=0
      else
         if pdrop=true then
            begin
            try
            assignfile(t,peaziptmpdir+STR_TMPDROPE);
            rewrite(t);
            closefile(t);
            except
            end;
            end;
      P.Free;
      pforceconsole:=0;
      exit;
      end;
   if (zaout>0) or (subfun='list') or (subfun='test') or (subfun='bench') then
      begin
      if (executesmallbk<>0) and (tsize<16*1024*1024) then //execute small workload tasks in background (under 16 MB input)
         if (subfun='archive') or (subfun='convert') or (subfun='extract') then
            begin
            FormPeach.Visible:=true;
            UnitGwrap.exbackground:=true;
            end;
      if subfun='test' then jobtype:=1
      else
         if subfun='list'then
            begin
            if listmode=0 then jobtype:=4
            else jobtype:=5;
            end
         else
            if subfun='bench' then jobtype:=2
            else
            {if (zaout=2) and (fun<>'UNARC') and (fun<>'ARC') then jobtype:='10' //arc needs either console or pipes
            else}
               if (zaout=1) then jobtype:=20
               else jobtype:=0;
      //{$IFNDEF MSWINDOWS}if zaout=1 then P.Options:=[poWaitOnExit];{$ENDIF}
      if (inputfile='') then inputfile:='na';
      if (inputfile='na') then
         if (fun='UN7Z') or (fun='UNBROTLI') or (fun='UNZSTD') or (fun='UNLPAQ') or (fun='UNQUAD') or (fun<>'ARC') then
            begin
            if ((extractfilename(FormPeach.EditOpenIn.Text)<>'') and (extractfilename(FormPeach.EditOpenIn.Text)<>txt_none)) then
               inputfile:=FormPeach.EditOpenIn.Text
            else
               inputfile:=FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row];
            end;
      if jobtype=2 then outname:='na';//empty parameter strings would be cut when passed as command line on *x-like systems
      if launchwithsemaphore=true then jobtype:=jobtype+1000;
      UnitGwrap.ppipepw:=pipepw;
      pipepw:='';
      UnitGwrap.ppiperar:=piperar;
      UnitGwrap.perasepasses:=erasepasses;
      UnitGwrap.pprogn:='';
      UnitGwrap.pprogbar:=0;
      UnitGwrap.pproglast:=false;
      UnitGwrap.pprogfirst:=false;
      UnitGwrap.perrignore:=false;
      UnitGwrap.pcanignore:=false;
      UnitGwrap.ppsize:='0';
      FormGwrap.ImageTask.Width:=i96res;
      FormGwrap.ImageTask.Height:=i96res;
      FormGwrap.ImageTask.Transparent:=true;
      FormGwrap.ImageTask.Picture.Bitmap:=Btest;
      case subfun of
         'archive':
            case upcase(extractfileext(outname)) of
            '.001': FormGwrap.ImageTask.Picture.Bitmap:=Barcblock96;
            '.7Z': FormGwrap.ImageTask.Picture.Bitmap:=Barc7z96;
            '.EXE': FormGwrap.ImageTask.Picture.Bitmap:=BExesupported96;
            '.RAR': FormGwrap.ImageTask.Picture.Bitmap:=Barcrar96;
            '.ZIP','ZIPX': FormGwrap.ImageTask.Picture.Bitmap:=BArczip96;
            else FormGwrap.ImageTask.Picture.Bitmap:=BArchiveSupported96;
            end;
         'convert': FormGwrap.ImageTask.Picture.Bitmap:=Bext; //extraction step
         'extract':
            if (FormPeach.pmqenewfolder.Checked=true) and (UnitGwrap.pfromnativedrag=false) then FormGwrap.ImageTask.Picture.Bitmap:=Bextf
               else FormGwrap.ImageTask.Picture.Bitmap:=Bext;
         'list': FormGwrap.ImageTask.Picture.Bitmap:=Blist;
      end;
      UnitGwrap.paction:='';
      case subfun of
         'archive','convert':
         begin
         inputfile:='na';
         if (FormPeach.StringGridAdd.row=1) then UnitGwrap.pprogfirst:=true;
         if FormPeach.ComboBox7zFun.Text<>'' then
            UnitGwrap.paction:=FormPeach.ComboBox7zFun.Text;
         if (subfun='convert') then UnitGwrap.paction:=txt_caption_extract;
         if UnitGwrap.paction=txt_newarchive then paction:='';//implicit
         if (FormPeach.StringGridAdd.rowcount-1>1) and (FormPeach.CheckBoxSeparate.State=cbChecked) then
            begin
            if FormPeach.Width<>0 then UnitGwrap.pprogbar:=FormPeach.PanelProgressAdd.Width*FormGwrap.Width div FormPeach.Width;
            UnitGwrap.pprogn:=(inttostr(FormPeach.StringGridAdd.row)+'/'+inttostr(FormPeach.StringGridAdd.rowcount-1));
            if FormPeach.StringGridAdd.row=FormPeach.StringGridAdd.rowcount-1 then UnitGwrap.pproglast:=true;
            end;
         UnitGwrap.ppsize:=FormPeach.StringGridAdd.Cells[12,FormPeach.StringGridAdd.row];
         end;
         'list','test','extract':
         begin
         if (subfun='extract') and
            (FormPeach.CheckBoxrelative.Checked=true) and
            (FormPeach.CheckBoxrelative.Enabled=true) and
            (FormPeach.CheckBoxFolder.Checked=false) then
            UnitGwrap.pcanignore:=true;
         if (FormPeach.StringGridExtract.row=1) then
            UnitGwrap.pprogfirst:=true;
         if FormPeach.ComboBoxOverwrite.Caption<>'' then
            UnitGwrap.paction:=FormPeach.ComboBoxOverwrite.Caption;
         if (FormPeach.CheckBoxrelative.Checked=true) and
            (FormPeach.CheckBoxrelative.enabled=true) and
            (FormPeach.CheckBoxFolder.Checked=false) then
            UnitGwrap.paction:=txt_caption_extract;//txt_7_8_rel;
         if FormPeach.pmqenewfolder.checked=true then
            if FormPeach.CheckBoxSmartFolder.checked=true then UnitGwrap.paction:=txt_5_5_intdir
            else UnitGwrap.paction:=txt_newfoldermenu;
         if (subfun='list') then UnitGwrap.paction:=txt_caption_list;
         if (subfun='test') then UnitGwrap.paction:=txt_caption_test;
         if (FormPeach.StringGridExtract.rowcount-1>1) and (extsel='all') then
            begin
            if FormPeach.Width<>0 then UnitGwrap.pprogbar:=FormPeach.PanelProgressExtract.Width*FormGwrap.Width div FormPeach.Width;
            UnitGwrap.pprogn:=(inttostr(FormPeach.StringGridExtract.row)+'/'+inttostr(FormPeach.StringGridExtract.rowcount-1));
            if FormPeach.StringGridExtract.row=FormPeach.StringGridExtract.rowcount-1 then UnitGwrap.pproglast:=true;
            end;
         if psize=0 then UnitGwrap.ppsize:=FormPeach.StringGridExtract.Cells[12,FormPeach.StringGridExtract.row]
         else UnitGwrap.ppsize:=inttostr(psize);
         end;
      end;
      UnitGwrap.pjobtype:=inttostr(jobtype);
      UnitGwrap.pautoclose:=autoclosegwrap;
      UnitGwrap.ptsize:=inttostr(tsize);
      UnitGwrap.pinputfile:=inputfile;
      UnitGwrap.poutname:=outname;
      UnitGwrap.poutnamet:='';
      if subfun='extract' then
         begin
         if (FormPeach.CheckBoxrelative.Checked=true) and
            (FormPeach.CheckBoxrelative.Enabled=true) and
            (FormPeach.CheckBoxFolder.Checked=false) then
            UnitGwrap.poutnamet:=origouttf;
         if checkdirexists(origout) then
            UnitGwrap.poutname:=origout
         else
            UnitGwrap.poutname:=extractfiledir(copy(origout,1,length(origout)-1))+directoryseparator;
         end;
      UnitGwrap.psubfun:=subfun;
      UnitGwrap.pcl:=cl;
      UnitGwrap.pfun:=fun;
      UnitGwrap.ppriority:=taskpriority;
      if updatingarchive_inarchive=false then UnitGwrap.autoopen:=autoopen else UnitGwrap.autoopen:=0;
      //old UAC elevation check, moved at the beginning to apply to console modes and force interactive pw mode
      wasselected:=-1;
      wasselectedp:=-1;
      FormPeach.Enabled:=false;
      UnitGwrap.gwraplaunch;
      ws_gw_left:=UnitGwrap.ws_gw_left;
      ws_gw_top:=UnitGwrap.ws_gw_top;
      ws_gw_width:=UnitGwrap.ws_gw_width;
      ws_gw_height:=UnitGwrap.ws_gw_height;
      FormPeach.Enabled:=true;
      zaout:=zaout1;
      result:=UnitGwrap.exit_code;
      if result=0 then setsequenceerror:=0
      else
         if pdrop=true then
            begin
            try
            assignfile(t,peaziptmpdir+STR_TMPDROPE);
            rewrite(t);
            closefile(t);
            except
            end;
            end;
      if result<>0 then
         if UnitGwrap.perrignore=true then
            begin
            try
            ForceDirectories(peaziptmpdir);
            assignfile(t,peaziptmpdir+STR_TMPERRI);
            rewrite(t);
            closefile(t);
            except
            end;
            end;
      clean_after_launch;
      P.Free;
      end
   else
      begin
      withconsole;
      zaout:=zaout1;
      result:=P.ExitStatus;
      if result=0 then setsequenceerror:=0
      else
         if pdrop=true then
            begin
            try
            assignfile(t,peaziptmpdir+STR_TMPDROPE);
            rewrite(t);
            closefile(t);
            except
            end;
            end;
      clean_after_launch;
      P.Free;
      end;
   end;
movezpaq(cl);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection ENCRYPTION TEST and password request routines

///////////////////////////////////////////////////////////////////////////////}

function isenctype(s:ansistring):boolean; //define types supporting header encryption
var
   s1:ansistring;
begin
result:=false;
s1:=s;
if (extractfileext(s1)='.001') then cutextension(s1);
if (LowerCase(extractfileext(s1))='.7z') or
   (LowerCase(extractfileext(s1))='.rar') or
   (LowerCase(extractfileext(s1))='.arc') or
   (LowerCase(extractfileext(s1))='.zpaq') then result:=true;
end;

function isencsupported(s:ansistring):boolean; //define types supporting encryption
var
   s1:ansistring;
begin
result:=false;
s1:=s;
if (extractfileext(s1)='.001') then cutextension(s1);
if (LowerCase(extractfileext(s1))='.7z') or
   (LowerCase(extractfileext(s1))='.rar') or
   (LowerCase(extractfileext(s1))='.zip') or
   (LowerCase(extractfileext(s1))='.zipx') or
   (LowerCase(extractfileext(s1))='.pea') or
   (LowerCase(extractfileext(s1))='.zpaq') or
   (LowerCase(extractfileext(s1))='.arc') then result:=true;
end;

function archiveisempty(fname:ansistring):boolean;
var
   sz:QWord;
begin
result:=false;
case lowercase(extractfileext(fname)) of
   '.7z':
   begin
   srcfilesize_multipart(fname,sz);
   if sz<33 then result:=true;//empty 7z file
   end;
   '.rar':
   begin
   srcfilesize_multipart(fname,sz);
   if sz<25 then result:=true;//empty mgotypeRAR file
   end;
   '.zip','.zipx':
   begin
   srcfilesize_multipart(fname,sz);
   if sz<23 then result:=true;//empty zip file
   end;
end;
end;

function testencrypted_fromname(fname,modearchive:ansistring):integer;
//fname input file; modearchive 'open' file being browsed
//result -1 unchecked 0 not encrypted 1 encrypted 2 Cancel or Abort on password request, stop the operation
var
  P: tprocessutf8;
  i,k,ec,BytesRead,tindex:integer;
  browselimitsize,sz:QWord;
  Labelenc:boolean;
  s,s1,s2,fun,jobcode,outname,dummystr,dummysub:ansistring;
  M:TmemoryStream;
begin
result:=-1;
if intpw=1 then begin result:=0; exit; end;
if skipenctest=1 then begin result:=0; exit; end;
testarctype(fname,i,fun);
if (fun<>'UNARC') and
   (fun<>'UN7Z') and
   (fun<>'UNZPAQ') then exit;
if isencsupported(fname) = false then exit;
if archiveisempty(fname)=true then exit;

dummysub:=subfun;
dummystr:=FormPeach.EditOpenIn.Text;
FormPeach.EditOpenIn.Text:=fname;

tindex:=FormPeach.ComboBoxActionExtract.ItemIndex;

case fun of
'UNARC': if compose_unarc_cl(cl,jobcode,outname,false,'info','all')<>0 then exit;
'UN7Z': if compose_un7z_cl(cl,jobcode,outname,false,'info','all')<>0 then exit;
'UNZPAQ': if compose_unzpaq_cl(cl,jobcode,outname,false,'list','all')<>0 then exit;
end;

FormPeach.ComboBoxActionExtract.ItemIndex:=tindex;

FormPeach.EditOpenIn.Text:=dummystr;
subfun:=dummysub;;

if cl='' then exit;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
i:=0;
P:=tprocessutf8.Create(nil);
M := TMemoryStream.Create;
BytesRead := 0;
P.Options := [poUsePipes{$IFDEF DARWIN}, poPassInput{$ENDIF}{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
if fun='UNARC' then P.Options := [poUsePipes{$IFDEF MSWINDOWS}, poNoConsole, poDetached{$ENDIF}];
M.SetSize(32*1024);
case prebrowse of
   1,2: browselimitsize:=192*1024*1024; //0.5M files approx
   3,4,5: browselimitsize:=64*1024*1024; //160K
   end;
peapexecute(P,cl);

if pipepw<>'' then
   begin
   if FormPeach.Visible=true then Application.ProcessMessages;
   pipepw:=pipepw+lineending;
   P.Input.Write(pipepw[1], Length(pipepw));
   if FormPeach.Visible=true then Application.ProcessMessages;
   if piperar=false then P.Input.Write(pipepw[1], Length(pipepw));
   pipepw:='';
   piperar:=false;
   end;

while P.Running do
   begin
   if BytesRead+16*1024>=M.Size then M.SetSize(BytesRead + 8*1024*1024);
   if prebrowse>0 then
      begin
      if BytesRead>browselimitsize then
         begin
         P.Terminate(255);
         break;
         end;
      end;
   if P.Output.NumBytesAvailable>0 then
      i := P.Output.Read((M.Memory + BytesRead)^, 16*1024)
   else
      i:=0;
   if i > 0 then Inc(BytesRead, i);
   //else Sleep(10);
   if FormPeach.Visible=true then Application.ProcessMessages;
   end;
repeat
   M.SetSize(BytesRead + 4*1024);
   i := P.Output.Read((M.Memory + BytesRead)^, 4*1024);
   if i > 0 then Inc(BytesRead, i);
   //else Sleep(10);
   if FormPeach.Visible=true then Application.ProcessMessages;
until i <= 0;
M.SetSize(BytesRead);
ec:=P.ExitStatus;
P.Free;

FormPeach.MemoList.Clear;
Labelenc:=false;
FormPeach.MemoList.Lines.LoadFromStream(M);
k:=FormPeach.MemoList.Lines.Count;
if ec<>0 then Labelenc:=true;
if k=0 then Labelenc:=true;
if (Labelenc=true) and (isenctype(fname)=false) then Labelenc:=false //not readable and not supporting header encryption, treat as corrupted
else
   if Labelenc=false then
   case fun of
      'UN7Z':
      begin
      case btfun of
         'unrar5': if find_rar5_titles<>1 then Labelenc:=true;
         else if find_7z_titles<>1 then Labelenc:=true;
         end;
      if Labelenc=false then
         begin
         i:=title_lines_7z-2;
         if k>i then
            repeat
            s1:=FormPeach.MemoList.Lines[i];
            s2:=identify_field(s1);
            case s2 of
               'Encrypted': if copy(s1,length(s1),1)=ZCHAR then Labelenc:=true;
               'Method': if pos('AES',s1)<>0 then Labelenc:=true;
            end;
            i:=i+1;
            if Labelenc=true then break;
            until i>=k-1;
         end;
      end;
      'UNARC':
      begin
      for i:=1 to k-1 do
         if pos('*',FormPeach.MemoList.Lines[i])<>0 then Labelenc:=true;
      end;
   end;
M.Free;
if Labelenc=true then result:=1 else result:=0;
if modearchive='open' then exit;// open archive is untested -1, encrypted 1, or unencrypted 0; exit without asking for password
if result=1 then
   if (FormPW.EditPWpass.Text='') and (FormPW.EditPWkeyfile.Text='') then
      begin
      s:=FormPW.Caption;
      FormPW.Caption:=extractfilename(fname)+' | '+txt_3_0_readablepw;
      hideconfirmation;
      if ask_pwkeyfile<>0 then
         begin
         FormPW.Caption:=s;
         showconfirmation;
         result:=2;
         end
      else
         begin
         FormPW.Caption:=s;
         showconfirmation;
         end;
      end;
end;

procedure reopen_7z;
var
   s1,s2:ansistring;
begin
s1:=FormPeach.EditUn7zaFilter.Text;
s2:=FormPeach.EditUn7zaFilterExclude.Text;
browse_special_cases;
do_prebrowse;
FormPeach.EditUn7zaFilter.Text:=s1;
FormPeach.EditUn7zaFilterExclude.Text:=s2;
if browsingmode7z=0 then
   begin
   list_un7z('browse');
   status0:=txt_list_browsing;
   end
else listun7z_expandall;
FormPeach.PanelProgress.Visible:=false;
end;

function ask_pwkeyfile_core:integer;
var
   s1,s1b,s2:ansistring;
   encfn,eintpw,shp:boolean;
   keeppwt:integer;
begin
result:=-1;
//read previous values
s1:=FormPW.EditPWpass.Text;
s1b:=FormPW.EditPWconfirm.Text;
s2:=FormPW.EditPWkeyfile.Text;
if setencfn=1 then FormPW.CheckBoxEncFn.State:=cbChecked;
if intpw=1 then
   begin
   FormPW.CheckBoxintpw.State:=cbChecked;
   FormPW.EditPWpass.Text:='';
   FormPW.EditPWconfirm.Text:='';
   FormPW.PanelKF.Visible:=true;
   FormPW.EditPWpass.Enabled:=false;
   FormPW.EditPWconfirm.Enabled:=false;
   FormPW.LabelPWkeyfile.Enabled:=false;
   FormPW.CheckBoxKeepPW.Enabled:=false;
   FormPW.CheckBoxShowPWField.Enabled:=false;
   end
else
   begin
   FormPW.CheckBoxintpw.State:=cbUnChecked;
   FormPW.EditPWpass.Enabled:=true;
   FormPW.EditPWconfirm.Enabled:=true;
   FormPW.LabelPWkeyfile.Enabled:=true;
   FormPW.CheckBoxKeepPW.Enabled:=true;
   FormPW.CheckBoxShowPWField.Enabled:=true;
   end;
if FormPW.CheckBoxEncFn.State=cbChecked then encfn:=true else encfn:=false;
if FormPW.CheckBoxintpw.State=cbChecked then eintpw:=true else eintpw:=false;
if FormPW.CheckBoxKeepPW.State=cbChecked then keeppwt:=1 else keeppwt:=0;
if showpwfield=1 then shp:=true else shp:=false;
if showpwfield=1 then
   begin
   FormPW.CheckBoxShowPWField.State:=cbChecked;
   FormPW.EditPWpass.PasswordChar:=#0;
   FormPW.LabelPWconfirm.Visible:=false;
   FormPW.EditPWconfirm.visible:=false;
   end
else
   begin
   FormPW.CheckBoxShowPWField.State:=cbUnChecked;
   FormPW.EditPWpass.PasswordChar:='*';
   if hidepwconf=1 then
      begin
      FormPW.LabelPWconfirm.Visible:=false;
      FormPW.EditPWconfirm.visible:=false;
      end
   else
      begin
      FormPW.LabelPWconfirm.Visible:=true;
      FormPW.EditPWconfirm.visible:=true;
      end;
   end;
//show form
if (FormPW.EditPWpass.Text='') then
   begin
   FormPW.ShapePW.Color:=stringtocolor(color2);
   end;
FormPW.Showmodal;
{ modal: 1 ok
function:
1 cancel/close, revert to previous values
0 ok, keep new values
-1 error in validation of values (either new or old)}
if FormPW.ModalResult=mrAbort then setpm(1);
if FormPW.ModalResult=1 then
   begin
   if length(FormPW.EditPWkeyfile.Text)>16383 then
      begin
      result:=-1;
      FormPW.EditPWkeyfile.Text:=s2;
      pMessageWarningOK(txt_3_1_pathexc);
      exit;
      end;
   result:=0;
   end
else
   begin
   if FormPW.ModalResult=mrAbort then result:=-1 //if coming from password manager, reset previous changes on and return to password form
   else result:=1;
   FormPW.EditPWpass.Text:=s1;
   FormPW.EditPWconfirm.Text:=s1b;
   FormPW.EditPWkeyfile.Text:=s2;
   if encfn=true then FormPW.CheckBoxEncFn.State:=cbChecked else FormPW.CheckBoxEncFn.State:=cbUnChecked;
   if eintpw=true then FormPW.CheckBoxintpw.State:=cbChecked else FormPW.CheckBoxintpw.State:=cbUnChecked;
   if keeppwt=1 then FormPW.CheckBoxKeepPW.State:=cbChecked else FormPW.CheckBoxKeepPW.State:=cbUnChecked;
   if shp=true then FormPW.CheckBoxShowPWField.State:=cbChecked else FormPW.CheckBoxShowPWField.State:=cbUnChecked;
   if FormPW.CheckBoxShowPWField.State=cbChecked then
      begin
      FormPW.EditPWpass.PasswordChar:=#0;
      FormPW.LabelPWconfirm.Visible:=false;
      FormPW.EditPWconfirm.visible:=false;
      FormPW.EditPWconfirm.Text:='';
      end
   else
      begin
      FormPW.EditPWpass.PasswordChar:='*';
      FormPW.LabelPWconfirm.Visible:=true;
      FormPW.EditPWconfirm.visible:=true;
      end;
   end;
if FormPW.CheckBoxKeepPW.State=cbChecked then keeppw:=1 else keeppw:=0;
if FormPW.CheckBoxShowPWField.State=cbChecked then showpwfield:=1 else showpwfield:=0;
if FormPW.CheckBoxEncFn.State=cbChecked then setencfn:=1 else setencfn:=0;
if FormPW.CheckBoxIntPw.State=cbChecked then intpw:=1 else intpw:=0;
if result=0 then //test only if confirmed with ok
begin
if showpwfield=0 then
   if FormPW.EditPWconfirm.visible=true then
      if FormPW.EditPWpass.Text<>FormPW.EditPWconfirm.Text then
         begin
         FormPW.EditPWpass.Text:=s1;
         FormPW.EditPWconfirm.Text:=s1b;
         pMessageWarningOK(txt_error_passwordnotmatch);
         result:=-1;
         exit;
         end
      else
   else FormPW.EditPWconfirm.Text:=FormPW.EditPWpass.Text; //if password confirmation field is hidden, inherits password filed value opening the archive (the filed is shown when in compression / browser mode so needs to be valorized)
s1:=FormPW.EditPWpass.Text;
s2:=FormPW.EditPWkeyfile.Text;
if (s1='') and (s2='') and (seemencrypted=true) and (FormPW.CheckBoxEncFn.Visible=false) then
      begin
      pMessageWarningOK(txt_pw_empty);
      result:=-1;
      exit;
      end; //mandatory ask for password when the dialog is invoked for operating on encrypted or unreadable file
if s2<>'' then
   if prepend_keyfile(s1,s2,kflimit)<>0 then
      begin
      pMessageErrorOK(s2+' '+txt_keyfile_not_found);
      result:=-1;
      exit;
      end;
if pw4cl('-p',s1)<>0 then
   begin
   msg_pw_errorchar(s1);
   result:=-1;
   exit;
   end;
end
else
   begin
   if showpwfield=0 then
      if FormPW.EditPWconfirm.visible=true then
         if FormPW.EditPWpass.Text<>FormPW.EditPWconfirm.Text then
            begin
            FormPW.EditPWpass.Text:=s1;
            FormPW.EditPWconfirm.Text:=s1b;
            end;
   end;
setpwicons;
end;

function ask_pwkeyfile:integer;
begin
//if FormPeach.StringGridList.RowCount<2 then exit;
ask_pwkeyfile:=-1;
repeat
ask_pwkeyfile:=ask_pwkeyfile_core;
until ask_pwkeyfile>=0;
if ask_pwkeyfile=0 then
   try //pw could be optionally tested here for extraction, caveats: 1) should not block unsupervised batch tasks; 2) multiple passwords can be used in the archive
      if FormPeach.StringGridList.Cells[1,1]='' then
         begin
         setbrowserwarning_off;
         if fun='UN7Z' then reopen_7z;
         if fun='UNARC' then browse_arc('flat');
         if fun='UNZPAQ' then browse_zpaq;
         end;
   except //most common cause is empty StringGridList due to TOC level encryption in ARC format
      if fun='UNARC' then do_forcerefresh;
   end;
end;

procedure hideconfirmation;
begin
hidepwconf:=1;
FormPW.CheckBoxEncFn.Visible:=false;
end;

procedure showconfirmation;
begin
hidepwconf:=0;
FormPW.CheckBoxEncFn.Visible:=true;
end;

function testtypeenc(s:ansistring):boolean;
var
   s1:ansistring;
begin
result:=false;
if intpw=1 then begin result:=false; exit; end;
s1:=s;
if s1=txt_none then
   begin
   if pMessageInfoYesNo(txt_3_0_nonreadableorpw)=7 then result:=true;
   end
else
   begin
   if (extractfileext(s1)='.001') then cutextension(s1);
   if (LowerCase(extractfileext(s1))<>'.7z') and
   (LowerCase(extractfileext(s1))<>'.rar') and
   (LowerCase(extractfileext(s1))<>'.arc') and
   (LowerCase(extractfileext(s1))<>'.zpaq')then
      result:=true //types not supporting header encryption
   else
      result:=false; //types supporting header encryption
      ///if pMessageInfoYesNo(extractfilename(s)+char($0D)+char($0A)+char($0D)+char($0A)+txt_3_0_nonreadableorpw)=7 then result:=true;
   end;
end;

function ask_pwkeyfile_direct(ec:integer):integer;//assumes direct operation, and don't try to update the archive browser (main interface is not visible)
var s:ansistring;
begin
ask_pwkeyfile_direct:=-1;
s:=FormPW.Caption;
case ec of
   1: begin
      FormPW.Caption:=extractfilename(FormPeach.editopenin.caption)+' | '+txt_3_0_readablepw;
      hideconfirmation;
      end;
   2: begin
      if testtypeenc(FormPeach.editopenin.caption)=true then exit;
      FormPW.Caption:=extractfilename(FormPeach.editopenin.caption)+' | '+txt_3_0_nonreadableorpw;
      hideconfirmation;
      end;
end;
repeat
ask_pwkeyfile_direct:=ask_pwkeyfile_core;
until ask_pwkeyfile_direct>=0;
showconfirmation;
FormPW.Caption:=s;
end;

function testencrypted:integer;
var
   s:ansistring;
begin
testencrypted:=-1;
if intpw=1 then begin result:=0; exit; end;
if (fun<>'UNARC') and (fun<>'UN7Z') then //not needed for ZPAQ, encrypted ZPAQ archives always triggers appropriate pw request
   begin
   testencrypted:=0;
   exit;
   end;
if seemencrypted=true then
   if (FormPW.EditPWpass.Text='') and (FormPW.EditPWkeyfile.Text='') then
      begin
      s:=FormPW.Caption;
      FormPW.Caption:=extractfilename(FormPeach.editopenin.caption)+' | '+txt_3_0_readablepw;
      hideconfirmation;
      if ask_pwkeyfile<>0 then
         begin
         FormPW.Caption:=s;
         showconfirmation;
         exit;
         end;
      FormPW.Caption:=s;
      showconfirmation;
      end;
testencrypted:=0;
end;

function testencrypted_open:integer;
var
   s:ansistring;
   sz:qword;
begin
result:=-1;
if FormPeach.StringGridList.RowCount<2 then exit;
if (fun<>'UNARC') and
   (fun<>'UN7Z') and
   (fun<>'UNZPAQ') then exit;
if intpw=1 then exit; //force interactive password option disables password prompt, which should not be shown unless required by user
if isencsupported(FormPeach.EditOpenIn.Caption)=false then exit;
if archiveisempty(FormPeach.EditOpenIn.Caption)=true then exit;
if archive_content=txt_list_nomatch+txt_2_7_list_tryflatorpw then
   if isenctype(FormPeach.EditOpenIn.Caption)=true then seemencrypted:=true; //archive types supporting header encryption

//since toc encryption is detected in pre-parse with list_l and items encryption is detected in browsing with list_slt this step is probably redundant for un7z
if (fun<>'UN7Z') then
   if (seemencrypted=false) then
      if testencrypted_fromname(FormPeach.EditOpenIn.Caption,'open')=1 then seemencrypted:=true;

if seemencrypted=true then
   begin
   if check7zvolume(FormPeach.EditOpenIn.Caption)=true then
      begin
      pMessageErrorOK(txt_2_8_uniterror);
      listingdir:=false;
      jumpto('root');
      exit;
      end;
   if (FormPW.EditPWpass.Text='') and (FormPW.EditPWkeyfile.Text='') then
      begin
      if (FormPeach.StringGridList.Rowcount>1) and (FormPeach.StringGridList.Cells[1,1]='') then
            begin
            s:=FormPW.Caption;
            if testtypeenc(FormPeach.editopenin.caption)=true then exit;
            FormPW.Caption:=extractfilename(FormPeach.editopenin.caption)+' | '+txt_3_0_readablepw;
            hideconfirmation;
            if ask_pwkeyfile<>0 then
               begin
               FormPW.Caption:=s;
               showconfirmation;
               exit;
               end;
            FormPW.Caption:=s;
            showconfirmation;
            populatetree;
            end;
      end;
   end;
result:=0;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection PASSWORD MANAGER

///////////////////////////////////////////////////////////////////////////////}

function prepm:integer;
//-1 incomplete function or wrong password provided, ask again 0 correct password provided, exit cycle, show password manager 1 cancelled, exit cycle, don't show passwod manager
var
   i,j,rc:integer;
begin
result:=-1;
if showpwfield=1 then
   begin
   FormPM.EditUn7zaPW.PasswordChar:=#0;
   FormPM.lablelistPath3.Visible:=false;
   FormPM.EditUn7zaPW1.visible:=false;
   FormPM.EditUn7zaPW1.Text:='';
   end
else
   begin
   FormPM.EditUn7zaPW.PasswordChar:='*';
   FormPM.lablelistPath3.Visible:=true;
   FormPM.EditUn7zaPW1.visible:=true;
   end;
if pmnotdecrypted=1 then
   begin
   if (alttabstyle<>1) and (alttabstyle<>4) then UnitPM.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.ShapeTitlePMb1) else UnitPM.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.Shapelinkpm1);
   FormPM.LabelTitlePM1.Visible:=false;
   FormPM.ctrlpm.enabled:=false;
   FormPM.LabelPMadd.enabled:=false;
   FormPM.LabelPMremove.enabled:=false;
   FormPM.ShowModal;
   case FormPM.ModalResult of
   mrOk:
      begin
      loadpm;
      if pmnotdecrypted=0 then result:=0
      else result:=-1;
      end;
   mrCancel:
      begin
      result:=1;
      end;
   end;
   end
else
   begin
   FormPM.LabelTitlePM1.Visible:=true;
   if (alttabstyle<>1) and (alttabstyle<>4) then UnitPM.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.ShapeTitlePMb1) else UnitPM.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.Shapelinkpm1);
   result:=0;
   end;
rc:=FormPM.StringGridPM.RowCount;
FormPM.StringGridPM1.RowCount:=rc;
for i:=1 to rc-1 do
   for j:=0 to 3 do FormPM.StringGridPM1.Cells[j,i]:=FormPM.StringGridPM.Cells[j,i];
FormPM.EditUn7zaPW2.Caption:=FormPM.EditUn7zaPW.Caption;
FormPM.EditName4.Caption:=FormPM.EditName3.Caption;
end;

procedure cancelpm;
var
   i,j,rc:integer;
begin
rc:=FormPM.StringGridPM1.RowCount;
FormPM.StringGridPM.RowCount:=rc;
for i:=1 to rc-1 do
   for j:=0 to 3 do FormPM.StringGridPM.Cells[j,i]:=FormPM.StringGridPM1.Cells[j,i];
FormPM.EditUn7zaPW.Caption:=FormPM.EditUn7zaPW2.Caption;
FormPM.EditUn7zaPW1.Caption:=FormPM.EditUn7zaPW2.Caption;
FormPM.EditName3.Caption:=FormPM.EditName4.Caption;
end;

procedure setpwmanmenus(i:integer);
begin
if i<=1 then FormPW.mpwspacer2.Visible:=false else FormPW.mpwspacer2.Visible:=true;
if i>1 then
   if FormPM.StringGridPM.Cells[1,1]<>'' then
      begin
      FormPW.mpwman1.Caption:=FormPM.StringGridPM.Cells[1,1];
      FormPW.mpwman1.Visible:=true;
      end
   else FormPW.mpwman1.Visible:=false
else FormPW.mpwman1.Visible:=false;
if i>2 then
   if FormPM.StringGridPM.Cells[1,2]<>'' then
      begin
      FormPW.mpwman2.Caption:=FormPM.StringGridPM.Cells[1,2];
      FormPW.mpwman2.Visible:=true;
      end
   else FormPW.mpwman2.Visible:=false
else FormPW.mpwman2.Visible:=false;
if i>3 then
   if FormPM.StringGridPM.Cells[1,3]<>'' then
      begin
      FormPW.mpwman3.Caption:=FormPM.StringGridPM.Cells[1,3];
      FormPW.mpwman3.Visible:=true;
      end
   else FormPW.mpwman3.Visible:=false
else FormPW.mpwman3.Visible:=false;
if i>4 then
   if FormPM.StringGridPM.Cells[1,4]<>'' then
      begin
      FormPW.mpwman4.Caption:=FormPM.StringGridPM.Cells[1,4];
      FormPW.mpwman4.Visible:=true;
      end
   else FormPW.mpwman4.Visible:=false
else FormPW.mpwman4.Visible:=false;
if i>5 then
   if FormPM.StringGridPM.Cells[1,5]<>'' then
      begin
      FormPW.mpwman5.Caption:=FormPM.StringGridPM.Cells[1,5];
      FormPW.mpwman5.Visible:=true;
      end
   else FormPW.mpwman5.Visible:=false
else FormPW.mpwman5.Visible:=false;
if i>6 then
   if FormPM.StringGridPM.Cells[1,6]<>'' then
      begin
      FormPW.mpwman6.Caption:=FormPM.StringGridPM.Cells[1,6];
      FormPW.mpwman6.Visible:=true;
      end
   else FormPW.mpwman6.Visible:=false
else FormPW.mpwman6.Visible:=false;
if i>7 then
   if FormPM.StringGridPM.Cells[1,7]<>'' then
      begin
      FormPW.mpwman7.Caption:=FormPM.StringGridPM.Cells[1,7];
      FormPW.mpwman7.Visible:=true;
      end
   else FormPW.mpwman7.Visible:=false
else FormPW.mpwman7.Visible:=false;
if i>8 then
   if FormPM.StringGridPM.Cells[1,8]<>'' then
      begin
      FormPW.mpwman8.Caption:=FormPM.StringGridPM.Cells[1,8];
      FormPW.mpwman8.Visible:=true;
      end
   else FormPW.mpwman8.Visible:=false
else FormPW.mpwman8.Visible:=false;
end;

function pmtestpw(var pmpw:ansistring):integer; //set password per Passwrod Manager, never passed to backend
var
   s1,s2:ansistring;
begin
result:=-1;
s1:=FormPM.EditUn7zaPW.Caption;
s2:=FormPM.EditUn7zaPW1.Caption;
if FormPM.EditUn7zaPW.Caption='' then pmpw:='default'
else pmpw:=FormPM.EditUn7zaPW.Caption;
if (showpwfield=0) and (FormPM.EditUn7zaPW.Caption<>'') and (FormPM.EditUn7zaPW.Caption<>FormPM.EditUn7zaPW1.Caption) then
   begin
   pMessageWarningOK(txt_error_passwordnotmatch);
   FormPM.EditUn7zaPW.Caption:=s1;
   FormPM.EditUn7zaPW1.Caption:=s2;
   exit;
   end
else FormPW.EditPWconfirm.Text:=FormPW.EditPWpass.Text;
if FormPM.EditName3.Text<>'' then
   if prepend_keyfile(pmpw,FormPM.EditName3.Text,kflimit)<>0 then
      begin
      pMessageErrorOK(FormPM.EditName3.Text+' '+txt_keyfile_not_found);
      exit;
      end;
result:=0;
end;

procedure loadpm;
var
   i,j,rc,n:integer;
   len:qword;
   buf:array[0..65535]of byte;
   hdrf,hdrk:TFCA256Hdr;
   cxe:TAES_EAXContext;
   authf,authc:TFCA256_AuthBlock;
   s,sPW:ansistring;

procedure exitloadpm;
begin
pmnotdecrypted:=1;
CloseFile(pmfileb);
setpwmanmenus(0);
end;

begin
setpwmanmenus(0);
if fileexists(confpath+'pm')=false then exit;
try
assignfile(pmfileb,(confpath+'pm'));
filemode:=0;
reset(pmfileb);
srcfilesize(confpath+'pm',len);
len:=len-sizeof(hdrf)-sizeof(authf);
blockread(pmfileb, hdrf, sizeof(hdrf));
if (hdrf.FCASig<>C_FCA_Sig) or
   (hdrf.Flags and $F0 <> $A0) or
   (hdrf.Flags and $02 <> 0) or
   (hdrf.Flags and $04 = 0) then begin exitloadpm; exit; end;
hdrk := hdrf;
if pmtestpw(sPW)<>0 then begin exitloadpm; exit; end;
if FCA_EAX256_initS(cxe, sPW, hdrk)<>0 then begin exitloadpm; exit; end;
if hdrf.PW_ver<>hdrk.PW_ver then
   begin
   exitloadpm;
   exit;
   end
else
   pmnotdecrypted:=0;
s:='';
while len>0 do begin
  if len>sizeof(buf) then n:=sizeof(buf) else n:=len;
  blockread(pmfileb,buf,n);
  dec(len,n);
  if FCA_EAX256_decrypt(cxe, buf, n)<>0 then begin exitloadpm; exit; end;
  for i:=1 to n do
     begin
     s:=s+char(buf[i-1]);
     end;
end;
FCA_EAX256_final(cxe, authc);
blockread(pmfileb,authf, sizeof(authf));
if not compmem(@authf, @authc, sizeof(authf)) then
   begin
   if pMessageInfoYesNo(txt_4_3_pwmancorr)=mrNo then
      begin
      try
      CloseFile(pmfileb);
      udeletefile(confpath+'pm');
      except
      end;
      restartclosepeaapp;
      end;
   end;
FormPM.MemoPM.Clear;
FormPM.MemoPM.Append(s);
j:=0;
rc:=FormPM.MemoPM.Lines.Count;
repeat
s:=FormPM.MemoPM.Lines[j];
if s='' then break;
i:=FormPM.StringGridPM.RowCount;
FormPM.StringGridPM.RowCount:=i+1;
FormPM.StringGridPM.Cells[0,i]:=inttostr(i);
FormPM.StringGridPM.Cells[1,i]:=s;
s:=FormPM.MemoPM.Lines[j+1];
FormPM.StringGridPM.Cells[2,i]:=s;
j:=j+5
until(j>=rc);
FormPM.StringGridPM.AutoSizeColumns;
FormPM.StringGridPM.ColWidths[3]:=0;
CloseFile(pmfileb);
setpwmanmenus(FormPM.StringGridPM.RowCount);
except
   try
   CloseFile(pmfileb);
   except
   end;
end;
end;

function savepm:integer;
var
   i,j,rc,len,n:integer;
   pmstr,pmpw:ansistring;
   buf:array[0..65535] of byte;
   hdr: TFCA256Hdr;
   cxe: TAES_EAXContext;
   auth: TFCA256_AuthBlock;
   fingerprint:TSHA512Digest;
   SHA1Context:THashContext;
   shortsalt:TSHA1Digest;
begin
result:=-1;
if pmtestpw(pmpw)<>0 then
   begin
   FormPM.ShowModal;
   case FormPM.ModalResult of
   mrOk:
      begin
      exit;
      end;
   mrCancel:
      begin
      result:=1;
      cancelpm;
      exit;
      end;
   end;
   end;
try
assignfile(pmfileb,(confpath+'pm'));
rewrite(pmfileb);
rc:=FormPM.StringGridPM.RowCount;
pmstr:='';
for i:=1 to rc-1 do
   begin
   for j:=1 to 2 do pmstr:=pmstr+FormPM.StringGridPM.Cells[j,i]+char($0D)+char($0A);
   pmstr:=pmstr+char($0D)+char($0A)+char($0D)+char($0A)+char($0D)+char($0A); //3 free slots for each entry, for possible future use
   end;
get_fingerprint(fingerprint,false);
SHA1Init(SHA1Context);
SHA1Update(SHA1Context, @fingerprint, sizeof(fingerprint));
SHA1Final(SHA1Context, shortsalt);
move(shortsalt, hdr.salt, sizeof(hdr.salt));
FCA_EAX256_initS(cxe, pmpw, hdr);
blockwrite(pmfileb, hdr, sizeof(hdr));
len:=length(pmstr);
while len>0 do begin
  if len>sizeof(buf) then n:=sizeof(buf) else n:=len;
  for i:=1 to n do
   begin
   buf[i-1]:=ord(pmstr[i]);
   end;
  FCA_EAX256_encrypt(cxe,buf,n);
  blockwrite(pmfileb,buf,n);
  dec(len,n);
end;
FCA_EAX256_final(cxe, auth);
blockwrite(pmfileb,auth,sizeof(auth));
CloseFile(pmfileb);
except
   try
   CloseFile(pmfileb);
   except
   end;
end;
result:=0;
end;

procedure setpm(pmfun:integer);
var
   i:integer;
begin
repeat
i:=prepm;
until (i>=0);
if i>0 then exit;
FormPM.ctrlpm.enabled:=true;
FormPM.LabelPMadd.enabled:=true;
FormPM.LabelPMremove.enabled:=true;
FormPM.LabelTitlePM1.Visible:=true;
if pmfun=1 then
   if (alttabstyle<>1) and (alttabstyle<>4) then UnitPM.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.ShapeTitlePMb1) else UnitPM.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.Shapelinkpm1)
else
   if (alttabstyle<>1) and (alttabstyle<>4) then UnitPM.clicklabel_pm(FormPM.LabelTitlePM2,FormPM.ShapeTitlePMb2) else UnitPM.clicklabel_pm(FormPM.LabelTitlePM2,FormPM.Shapelinkpm2);
FormPM.PanelTitlePMTabAlign.Width:=FormPM.LabelTitlePM1.Width+
FormPM.LabelTitlePM2.Width+
FormPM.LabelTitlePM1.BorderSpacing.Left*3;
FormPM.ShowModal;
case FormPM.ModalResult of
   mrOk:
      begin
      repeat
      i:=savepm;
      until (i>=0);
      setpwmanmenus(FormPM.StringGridPM.RowCount);
      end;
   mrCancel:
      begin
      cancelpm;
      end;
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection UPDATE items in archive

///////////////////////////////////////////////////////////////////////////////}

procedure addmultiupdate;
var
   t:text;
   s1,s0:ansistring;
   i,j:integer;
   nfiles,ndirs,tsize: qword;
   okfile,dirpresent:boolean;
   flist: TFoundList;
   fsizes: TFoundListSizes;
   ftimes: TFoundListAges;
   fattr: TFoundListAttrib;
   fattr_dec: TFoundList;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound:qword;
begin
if multiaddupdating=true then exit;
multiaddupdating:=true;
if dn='' then exit;
nfiles:=0;
listdetails(dn,'*',faAnyFile,false,false,nfiles,ndirs,flist,fsizes,ftimes,fattr,fattr_dec);
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.top=0{$ENDIF} then
if nfiles>0 then
   begin
   for i:=0 to nfiles-1 do
      begin
      assignfile(t,flist[i]);
      reset(t);
      readln(t,s1);
      closefile(t);
      udeletefile(flist[i]);
      if testname(s1, FormPeach.StringGridAdd)=0 then
         if filegetattr(s1) > 0 then
            if filegetattr(s1) and faDirectory =0 then addfilestr(FormPeach.StringGridAdd,s1)
            else addfolderstr(FormPeach.StringGridAdd,s1)
         else msg_not_accessible_s(s1);
      end;
   FormPeach.StringGridAdd.AutoSizeColumns;
   updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
   end;
{$IFDEF MSWINDOWS}if FormPeach.PanelExtract.Visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
if nfiles>0 then
   begin
   dirpresent:=false;
   for i:=0 to nfiles-1 do
      begin
      assignfile(t,flist[i]);
      reset(t);
      readln(t,s1);
      closefile(t);
      udeletefile(flist[i]);
      if checkdirexists(s1) then
         begin
         dirpresent:=true;
         s0:=extractfilepath(s1);
         expand(s1,exp_files,exp_fsizes,exp_ftimes,exp_fattr,exp_fattr_dec,nfound);
         for j:=0 to nfound-1 do
            if pos('D',exp_fattr_dec[j])=0 then
               begin
               test_extfile(exp_files[j],okfile);
               if okfile=true then
                  begin
                  if checkfiledirname(exp_files[j])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+exp_files[j]); exit; end;
                  deselectingrid(FormPeach.StringGridExtract);
                  addfilestr(FormPeach.StringGridExtract,exp_files[j]);
                  end;
               end;
         end
      else
         begin
         test_extfile(s1,okfile);
         if okfile=true then
            begin
            if checkfiledirname(s1)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s1); exit; end;
            deselectingrid(FormPeach.StringGridExtract);
            addfilestr(FormPeach.StringGridExtract,s1);
            end;
         end;
      end;

   if FormPeach.EditOutExtract.Text<>defaultextractpath then
      if FormPeach.StringGridExtract.Rowcount>1 then
         if dirpresent=false then
            FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
         else
            FormPeach.EditOutExtract.Text:=s0//(last) directory's path
      else
         FormPeach.EditOutExtract.Text:=local_desktop;

   updatecontent_ext;
   end;
multiaddupdating:=false;
end;

procedure syncedit_archive;
begin
//if FormPeach.StringGridList.RowCount<2 then exit;
//if FormPeach.StringGridList.Cells[1,1]='' then exit;
if ptmpdir='' then exit;

//exception: block this method for absolute paths
if isabspath(FormPeach.EditUn7zaFilterInteractive.Text)=true then
   begin
   pMessageWarningOK(txt_6_9_opuns+char($0D)+char($0A)+txt_10_5_pathlock);
   exit;
   end;

updatingarchive_sync:=true;
if addtoarchive_inarchive(false)=true then
   begin
   FormPeach.Enabled:=false;
   FormPeach.StringGridAdd.RowCount:=1;
   deselectingrid(FormPeach.StringGridAdd);
   addfolderstr(FormPeach.StringGridAdd,ptmpdir+DirectorySeparator+'*');
   //preview cannot write to absolute paths in the filesystem, so the path the files are added back in archives with absolute paths are different from original path
   //same issue applies to create new folder function which calls this same method
   //possible workaround: moving items afterwards, or redirect input from standard input to internal path -si(internal path) <input
   FormPeach.StringGridAdd.AutoSizeColumns;
   updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
   FormPeach.Enabled:=true;
   on_buttonarchiveclick;
   end;
updatingarchive_sync:=false;
end;

procedure do_discardpreview;
begin
keeppreview:=false;
beingpreviewed:='';
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
create_ptmpcode(ptmpcode);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection INTEGRATION functions accessible as cl parameters and for sys menus

///////////////////////////////////////////////////////////////////////////////}

procedure msg_no_input;
begin
//interactive error message suppressed
end;

function test_in_params(var j:integer):integer;
var i:integer;
begin
test_in_params:=-1;
if paramcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
j:=0;
for i:=2 to paramcount do
   if filegetattr(ExpandFileName((paramstr(i)))) > 0 then j:=j+1
   else msg_not_accessible(i);
if j=0 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
test_in_params:=0;
end;

function test_in_params_7z(var j:integer):integer;
var i:integer;
begin
test_in_params_7z:=-1;
if paramcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
j:=0;
for i:=2 to paramcount do
   if testname(ExpandFileName((paramstr(i))), FormPeach.StringGridAdd)=0 then
      if filegetattr(ExpandFileName((paramstr(i)))) > 0 then
         begin
         j:=j+1;
         if filegetattr(ExpandFileName((paramstr(i)))) and faDirectory =0 then addfilestr(FormPeach.StringGridAdd,ExpandFileName((paramstr(i))))
         else addfolderstr(FormPeach.StringGridAdd,ExpandFileName((paramstr(i))));
         end
      else msg_not_accessible(i);
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
if j=0 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
test_in_params_7z:=0;
end;

function control_outparam(var out_param:ansistring):integer; //as control_outpath, but takes a filename instead of dirname as input
var
   out_path,out_name:ansistring;
begin
control_outparam:=-1;
out_path:=extractfilepath(out_param);
out_name:=extractfilename(out_param);
if control_outpath(out_path)<>0 then exit;
if out_param<>'' then
   if out_path[length(out_path)]<>directoryseparator then out_path:=out_path+directoryseparator;
out_param:=out_path+out_name;
control_outparam:=0;
end;

function GetPathDigest(const s: ansistring): ansistring;
var i:integer;
begin
result:='default';
i:=length(extractfilepath((paramstr(2))));
result:=inttostr(i);
end;

procedure get_unique_name(var out_param:ansistring);
var
   i:integer;
   s:ansistring;
   name_ok:boolean;
begin
if fileexists(out_param) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   repeat
      if fileexists(s+inttostr(i)) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+inttostr(i);
   end;
end;

procedure getmulti(optype:ansistring; var multis:ansistring); //used in Windows to pass multiple parameters per instance through a simple registry entry
var
   t:text;
   s,s1,s2,fn:ansistring;
   pkeep:boolean;
   nf,nok,ndone:integer;
   nfiles,ndirs: qword;
   flist: TFoundList;
   fsizes: TFoundListSizes;
   ftimes: TFoundListAges;
   fattr: TFoundListAttrib;
   fattr_dec: TFoundList;
begin
{$IFDEF MSWINDOWS}
multis:='';
pkeep:=false;
psem:=CreateSemaphore(nil, 0, 1, 'PeaZip getmulti semaphore'); //decide if this is the first instance of the sequence
if ((psem<>0) and (GetLastError<>ERROR_ALREADY_EXISTS)) then pkeep:=true;
s:=peaziptmpdir;
s1:=optype+FormatDateTime('yymmdd',now);//+GetPathDigest(paramstr(2)); merge tasks before launching, once launced dir is emptied
dn1:=s+s1;
if not(checkdirexists(dn1)) then
   begin
   randomize;
   if forcedirectories(dn1)=false then
      begin
      sleep(5+random(5));
      if forcedirectories(dn1)=false then
         begin
         sleep(10+random(10));
         forcedirectories(dn1);
         end;
      end;
   filesetattr(dn1, faHidden);
   end;
s2:=FormatDateTime('sszzz',now)+inttostr(GetProcessID);
fn:=s+s1+directoryseparator+s2;
get_unique_name(fn);
try //pass parameter
   assignfile(t,fn);
   rewrite(t);
   writeln(t,(paramstr(2)));
   closefile(t);
except
   randomize;
   sleep(5+random(5));
   try
      assignfile(t,fn);
      rewrite(t);
      writeln(t,(paramstr(2)));
      closefile(t);
   except
      sleep(10+random(10));
      try
         assignfile(t,fn);
         rewrite(t);
         writeln(t,(paramstr(2)));
         closefile(t);
      except
      end;
   end;
end;
if pkeep=false then exit
else //get multiple parameters in the first instance to launch the new process to perform the task
   begin
   multis:='"'+dn1+'"';
   nf:=1;
   nok:=0;
   ndone:=0;
   repeat
      sleep(50);
      listdetails(dn1,'*',faAnyFile,false,false,nfiles,ndirs,flist,fsizes,ftimes,fattr,fattr_dec);
      if nf=nfiles then nok:=nok+1 else nok:=0;
      nf:=nfiles;
      ndone:=ndone+1;
      if ndone>100 then exit;//guarantee termination of wait if taking too much time
   until nok>=3; //the new process will anyway lists any remaining files on the fly
   //CloseHandle(psem); //closed when the new process is terminated
   end;
{$ENDIF}
end;

procedure runmulti(var P:tprocessutf8; var cl:ansistring); //windows reg multiple operations, no password passed
var
   mclosed:boolean;
begin
{$IFDEF MSWINDOWS}
peapexecute(P,cl);
mclosed:=false;
while P.Running do
   begin
   Application.ProcessMessages;
   Sleep(100);
   if mclosed=false then
      if not(checkdirexists(dn1)) then
      begin
      CloseHandle(psem);
      mclosed:=true;
      end;
   end;
P.Free;
{$ENDIF}
end;

procedure go_semaphorearchive; //start archiving if semaphore is OK
var
   pgoti:integer;
begin
{$IFDEF MSWINDOWS}
FormPeach.visible:=false;
pgoti:=0;
sleep(50);
repeat
   psemwait:=CreateSemaphore(nil, 0, 1, 'PeaZip wait semaphore');
   if ((psemwait<>0) and (GetLastError<>ERROR_ALREADY_EXISTS)) then
      begin
      CloseHandle(psemwait);
      pgoti:=pgoti+1;
      end
   else sleep(50);
until pgoti>=3;
on_buttonarchiveclick;
{$ENDIF}
end;

procedure go_semaphoreextract; //start extraction if semaphore is OK
var
   pgoti:integer;
begin
{$IFDEF MSWINDOWS}
FormPeach.visible:=false;
pgoti:=0;
sleep(50);
repeat
   psemwait:=CreateSemaphore(nil, 0, 1, 'PeaZip wait semaphore');
   if ((psemwait<>0) and (GetLastError<>ERROR_ALREADY_EXISTS)) then
      begin
      CloseHandle(psemwait);
      pgoti:=pgoti+1;
      end
   else sleep(50);
until pgoti>=3;
on_buttonextokclick;
{$ENDIF}
end;

procedure go_semaphoreextract_waitonly; //wait until semaphore is OK
var
   pgoti:integer;
begin
{$IFDEF MSWINDOWS}
FormPeach.visible:=false;
pgoti:=0;
sleep(50);
repeat
   psemwait:=CreateSemaphore(nil, 0, 1, 'PeaZip wait semaphore');
   if ((psemwait<>0) and (GetLastError<>ERROR_ALREADY_EXISTS)) then
      begin
      CloseHandle(psemwait);
      pgoti:=pgoti+1;
      end
   else sleep(50);
until pgoti>=3;
{$ENDIF}
end;

procedure add2archivemulti;
begin
showpanel('archive');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
savetype:=true;
if completeshowpea=true then if enumd=1 then begin FormPeach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemulticonvert;
begin
showpanel('archive');
FormPeach.CheckBoxConvert.State:=cbChecked; FormPeach.CheckBoxConvertChange(nil);
FormPeach.CheckBoxSeparate.State:=cbChecked;
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
savetype:=true;
if completeshowpea=true then if enumd=1 then begin FormPeach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemultiseparate;
begin
showpanel('archive');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
FormPeach.CheckBoxSeparate.State:=cbChecked;
on_checkboxseparateclick;
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
savetype:=true;
if completeshowpea=true then if enumd=1 then begin FormPeach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemultisplit;
begin
showpanel('archive');
showpanel_trick;
FormPeach.cbType.ItemIndex:=10;
archive_type_select(txt_split);
multiaddupdating:=false;
dn:=((paramstr(2)));
getarccaption(txt_split);
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
if completeshowpea=true then if enumd=1 then begin FormPeach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemulti7z;
var
   level:ansistring;
begin
showpanel('archive');
showpanel_trick;
FormPeach.cbType.ItemIndex:=0;
archive_type_select('7Z');
FormPeach.cbSplit.ItemIndex:=0;//disable spanning when directly calling a specific format
change_imagesplit;
multiaddupdating:=false;
level:=paramstr(2);
dontsavecustom7z:=true;
dlevel_7z:=level_7z;
dmethod_7z:=method_7z;
case level of
   'fastest' :
   begin
   FormPeach.ComboBox7zLevel.ItemIndex:=1;
   on_ComboBoxArchiveCompressionLevelChange;
   end;
   'default' :
   begin
   //FormPeach.ComboBox7zLevel.ItemIndex:=3;
   //on_ComboBoxArchiveCompressionLevelChange;
   end;
   'ultra' :
   begin
   FormPeach.ComboBox7zLevel.ItemIndex:=5;
   on_ComboBoxArchiveCompressionLevelChange;
   end;
   'mail' :
   begin
   //FormPeach.ComboBox7zLevel.ItemIndex:=3;
   //on_ComboBoxArchiveCompressionLevelChange;
   FormPeach.CheckBoxMailAdd.Checked:=true;
   end;
   '7zencrypt' :
   begin
   //FormPeach.ComboBox7zLevel.ItemIndex:=3;
   //on_ComboBoxArchiveCompressionLevelChange;
   FormPeach.BtnPasswordArchiveClick(nil);
   if (FormPW.EditPWpass.Text='') and (FormPW.EditPWkeyfile.Text='') then halt;
   end;
   end;
dn:=((paramstr(3)));
getarccaption(STR_7Z);
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
if completeshowpea=true then if enumd=1 then begin updatelayout(''); end;
go_semaphorearchive;
end;

procedure add2archivemultigeneric;
var
   archtype:ansistring;
begin
showpanel('archive');
showpanel_trick;
FormPeach.cbSplit.ItemIndex:=0;//disable spanning when directly calling a specific format
change_imagesplit;
multiaddupdating:=false;
archtype:=paramstr(2);
if archtype='/RAR' then archtype:=txt_custom+'/RAR';
if archtype='sfx'+STR_ARC then archtype:=txt_sfx+' '+STR_ARC;
FormPeach.cbType.Text:=archtype;
archive_type_select(FormPeach.cbType.Text);
dn:=(paramstr(3));
getarccaption(archtype);
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
if completeshowpea=true then if enumd=1 then begin updatelayout(''); end;
go_semaphorearchive;
end;

procedure add2archivemultizip;
var
   level:ansistring;
begin
showpanel('archive');
showpanel_trick;
FormPeach.cbType.ItemIndex:=15;
archive_type_select(STR_ZIP);
FormPeach.cbSplit.ItemIndex:=0;//disable spanning when directly calling a specific format
change_imagesplit;
multiaddupdating:=false;
level:=paramstr(2);
dontsavecustomzip:=true;
dlevel_zip:=level_zip;
dmethod_zip:=method_zip;
case level of
   'fastest' :
   begin
   FormPeach.ComboBox7zLevel.ItemIndex:=1;
   on_ComboBoxArchiveCompressionLevelChange;
   end;
   'default' :
   begin
   //FormPeach.ComboBox7zLevel.ItemIndex:=3;
   //on_ComboBoxArchiveCompressionLevelChange;
   end;
   'ultra' :
   begin
   FormPeach.ComboBox7zLevel.ItemIndex:=5;
   on_ComboBoxArchiveCompressionLevelChange;
   end;
   'mail' :
   begin
   //FormPeach.ComboBox7zLevel.ItemIndex:=3;
   //on_ComboBoxArchiveCompressionLevelChange;
   FormPeach.CheckBoxMailAdd.Checked:=true;
   end;
   end;
dn:=((paramstr(3)));
getarccaption(STR_ZIP);
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
if completeshowpea=true then if enumd=1 then begin updatelayout(''); end;
go_semaphorearchive;
end;

procedure add2archivemultisfx;
begin
showpanel('archive');
showpanel_trick;
FormPeach.cbType.ItemIndex:=8;
archive_type_select(txt_sfx+' '+STR_7Z);
multiaddupdating:=false;
dn:=((paramstr(2)));
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
if completeshowpea=true then if enumd=1 then begin updatelayout(''); end;
go_semaphorearchive;
end;

procedure filtertestlist;
var
   i,j:integer;
begin
if FormPeach.StringGridExtract.Rowcount<2 then exit;
if FormPeach.StringGridExtract.Cells[1,1]='' then exit;
for i:=1 to FormPeach.StringGridExtract.Rowcount-1 do
   begin
   j:=testinput(FormPeach.StringGridExtract.Cells[8,i],true);
   case j of
      0,1,2,5,6,8://test not supported
         begin
         pMessageWarningOK(upcase(ExtractFileExt(FormPeach.StringGridExtract.Cells[8,i]))+' '+txt_listtest);
         FormPeach.StringGridExtract.Cells[11,i]:='1';
         end;
      else
         FormPeach.StringGridExtract.Cells[11,i]:='0';
   end;
   end;
removeselected_ext;
end;

procedure ext2archivemultitest;
var
   tmpcheck:boolean;
begin
tmpcheck:=FormPeach.CheckBoxExtNotArchives.Checked;
FormPeach.CheckBoxExtNotArchives.Checked:=true;
if FormPeach.mdefaultextract.Checked=false then FormPeach.EditOutExtract.Text:=local_desktop
else FormPeach.EditOutExtract.Text:=defaultextractpath;
list_toextractor('none','full');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
go_semaphoreextract_waitonly;
filtertestlist;
FormPeach.CheckBoxExtNotArchives.Checked:=tmpcheck;
FormPeach.ComboBoxActionExtract.ItemIndex:=4;//auto resets
on_buttonextokclick;
end;

procedure ext2archivemulti;
begin
if FormPeach.mdefaultextract.Checked=false then FormPeach.EditOutExtract.Text:=local_desktop
else FormPeach.EditOutExtract.Text:=defaultextractpath;
list_toextractor('none','full');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
end;

procedure ext2archivemultidir(dirdirective:ansistring);
var
   tmpcheck:boolean;
begin
tmpcheck:=FormPeach.CheckBoxExtNotArchives.Checked;
FormPeach.CheckBoxExtNotArchives.Checked:=true;
if FormPeach.mdefaultextract.Checked=false then FormPeach.EditOutExtract.Text:=local_desktop
else FormPeach.EditOutExtract.Text:=defaultextractpath;
list_toextractor('none','full');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
FormPeach.TimerWinContext.enabled:=true;
stayopen:=false;
settmpextnf:=true;
if FormPeach.CheckBoxFolder.State=cbChecked then tmpextnf:=true else tmpextnf:=false;
tmpremoveintdir:=removeintdir;
case dirdirective of
   //'neutral': does not need action
   'here': FormPeach.CheckBoxFolder.State:=cbUnchecked;
   'smart': begin FormPeach.CheckBoxFolder.State:=cbChecked; removeintdir:=1; end;
   'folder': begin FormPeach.CheckBoxFolder.State:=cbChecked; removeintdir:=0; end;
   'downloads': FormPeach.EditOutExtract.Text:=usr_downloads;
   'desktop': FormPeach.EditOutExtract.Text:=desktop_path;
   'documents': FormPeach.EditOutExtract.Text:=usr_documents;
   'bookmark1': FormPeach.EditOutExtract.Text:=FormPeach.mexttob1.caption;
   'bookmark2': FormPeach.EditOutExtract.Text:=FormPeach.mexttob2.caption;
   'bookmark3': FormPeach.EditOutExtract.Text:=FormPeach.mexttob3.caption;
   'bookmark4': FormPeach.EditOutExtract.Text:=FormPeach.mexttob4.caption;
   'bookmark5': FormPeach.EditOutExtract.Text:=FormPeach.mexttob5.caption;
   'bookmark6': FormPeach.EditOutExtract.Text:=FormPeach.mexttob6.caption;
   'bookmark7': FormPeach.EditOutExtract.Text:=FormPeach.mexttob7.caption;
   'bookmark8': FormPeach.EditOutExtract.Text:=FormPeach.mexttob8.caption;
end;
go_semaphoreextract_waitonly;
FormPeach.CheckBoxExtNotArchives.Checked:=tmpcheck;
on_buttonextokclick;
end;

procedure add2multi;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('add',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemulti '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2multiconvert;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('add',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemulticonvert '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2multiseparate;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addseparate',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultiseparate '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2multi7z(level:ansistring);
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('add7z',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemulti7z '+level+' '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2multigeneric(archtype:ansistring);
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addarchive',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultigeneric '+archtype+' '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2multizip(level:ansistring);
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addzip',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultizip '+level+' '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2multisplit;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addsplit',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultisplit '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2multisfx;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addsfx',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultisfx '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure ext2multitest;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('neutral',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -ext2archivemultitest '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure ext2multi;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('neutral',s);
if s='' then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -ext2archivemulti '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure ext2multidirect(dirdirective:ansistring);
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('neutral',s);
if s='' then exit;
//-ext2archivemultihere extract here
//-ext2archivemultismart extract to new folder, smart folder management
//-ext2archivemultifolder extract to new folder
//-ext2archive desktop, documents, downloads, bookmark1..8 set destination without changing new folder policy, as -ext2archiveneutral
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' '+dirdirective+' '+s;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
runmulti(P,cl);
{$ENDIF}
end;

procedure add2wipe;
var
   i,j:integer;
   P:tprocessutf8;
   cl,in_param,eraselevel,bin_name:ansistring;
begin
in_param:='';
if test_in_params(j)<>0 then begin exit_nosave; exit; end;
   if pMessageWarningYesNo(txt_wipe)=6 then
      begin
      for i:=2 to j+1 do in_param:=in_param+stringdelim(escapefilename(ExpandFileName((paramstr(i))),desk_env))+' ';
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
      case erasepasses of
         0: eraselevel:='VERY_FAST';
         1: eraselevel:='FAST';
         2: eraselevel:='MEDIUM';
         3: eraselevel:='SLOW';
         4: eraselevel:='VERY_SLOW';
      end;
      cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      peapexecute(P,cl);
      P.Free;
      end;
end;

procedure add2compare;
var
   i,j:integer;
   P:tprocessutf8;
   cl,in_param,bin_name:ansistring;
begin
in_param:='';
if test_in_params(j)<>0 then begin exit_nosave; exit; end;
for i:=2 to 3 do in_param:=in_param+stringdelim(escapefilename(ExpandFileName((paramstr(i))),desk_env))+' ';
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
cl:=bin_name+' COMPARE '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
peapexecute(P,cl);
P.Free;
end;

procedure direct_join(var fname: ansistring);
var
   cl,s,s1,jobcode,in_param,out_param,bin_name:ansistring;
begin
s1:=fun;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+'RFS';
fun:='RFJ';
fun_status:='FILEBROWSER';
subfun:='extract';
s:=ExpandFileName(fname);
in_param:=stringdelim(escapefilename(s,desk_env));
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
out_param:=extractfilepath(s);
if control_outpath(out_param)<>0 then exit;
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
s:=extractfilename(s);
cutextension(s);
out_param:=out_param+s;
cl:=bin_name+' '+fun+' '+in_param+' BATCH '+stringdelim(escapefilename(out_param,desk_env));
launch_cl(cl,jobcode,in_param);
fun:=s1;
fun_status:=fun;
end;

procedure setpwtotest(var pwtotest:ansistring);//set pw for direct extraction and list/test functions, which set pipepw
begin
if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
   begin
   pwtotest:=FormPW.EditPWpass.Text;
   if FormPW.EditPWkeyfile.Text<>'' then
      if prepend_keyfile(pwtotest,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
         begin
         pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
         exit;
         end;
   end
else pwtotest:='default';
end;

procedure directextractfromname(var in_param,out_param:ansistring; optype:ansistring; intitems:ansistring);
var
   j,ec,tmpvar:integer;
   P:tprocessutf8;
   s,cl,jobcode,inname,bin_name,overwrite_policy,archive_function,paq_ver,lpaq_ver,outname,pw,pwtotest,ext,desni,desns,desnz,mcu_option,dummycl:ansistring;
   fsize:qword;
   infopt:boolean;
begin
   setpwtotest(pwtotest);
   inputfile:=in_param;
   inname:=in_param;
   j:=testinput(in_param,true);
   if removeintdir=1 then
      if FormPeach.CheckBoxFolder.state=cbChecked then needwaitupdating:=true;
   case j of
      0: begin
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
         cl:=bin_name+' -ext2open '+in_param; //ext2open handles a single input in open interface
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P:=tprocessutf8.Create(nil);
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
         peapexecute(P,cl);
         P.Free;
         exit;
         end;
      1: begin
         out_param:=out_param+(extractfilename(in_param));
         cutextension(out_param);
         if upcase(ExtractFileExt(out_param))='.TAR' then cutextension(out_param);//.tar extension is preserved in archive name and needs to be deleted in output name (only TAR extension is preserved in archive name)
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         out_param:=stringdelim(escapefilename(out_param,desk_env));
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
         cl:=bin_name+' UNPEA '+in_param+' '+out_param+' RESETDATE SETATTR EXTRACT2DIR INTERACTIVE';
         fun:='UNPEA';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         launch_cl(cl,jobcode,out_param);
         end;
      2: begin
         if extractfilename(out_param)='' then out_param:='AUTONAME'
         else out_param:=stringdelim(escapefilename(out_param,desk_env));
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
         cl:=bin_name+' RFJ '+in_param+' BATCH '+out_param;
         fun:='RFJ';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         launch_cl(cl,jobcode,out_param);
         end;
      5: begin
         fun:='UNPAQ';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         paq_ver:=copy(extractfileext(in_param),2,length(extractfileext(in_param))-1);
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         if out_param<>'' then
            if out_param[length(out_param)]=directoryseparator then setlength(out_param,length(out_param)-1);
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         out_param:=stringdelim(escapefilename(out_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+paq_ver+EXEEXT);
         if sys7zlin>1 then bin_name:=paq_ver+EXEEXT;
         cl:=bin_name+' -d '+in_param+' '+out_param;
         launch_cl(cl,jobcode,outname);
         end;
      6: begin
         fun:='UNQUAD';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         ext:=copy(extractfileext(in_param),2,length(extractfileext(in_param))-1);
         s:=extractfilename(in_param);
         cutextension(s);
         if out_param<>'' then
            if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
         out_param:=out_param+s;
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         if fileexists(out_param) then
            if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
            else clearfile(out_param);
         out_param:=stringdelim(escapefilename(out_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+ext+EXEEXT);
         if sys7zlin>1 then bin_name:=ext+EXEEXT;
         if (ext='quad') or (ext='bcm') then cl:=bin_name+' -d '+in_param+' '+out_param
         else cl:=bin_name+' d '+in_param+' '+out_param;
         launch_cl(cl,jobcode,outname);
         end;
      7: begin
         if not(fileexists((binpath+'unace'+directoryseparator+'unace'+EXEEXT))) then
            begin
            if libre_directive>0 then begin reportnotsupported('ACE'); exit; end
            else
            if unaceshown=false then
               begin
               pMessageInfoOK('PeaZip UNACE '+txt_5_7_plugin);
               unaceshown:=true;
               end;
            FormPeach.Visible:=false;
            saverestartclosepeaapp;
            exit;
            end;
         fun:='UNACE';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unace'+DirectorySeparator+'unace'+EXEEXT);
         //if sys7zlin>1 then bin_name:='unace'+EXEEXT;
         cl:=bin_name+' x '+in_param;
         if out_param<>'' then setcurrentdir((out_param));
         launch_cl(cl,jobcode,outname);
         end;
      8: begin
         fun:='UNLPAQ';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         lpaq_ver:=copy(extractfileext(in_param),2,length(extractfileext(in_param))-1);
         s:=extractfilename(in_param);
         cutextension(s);
         if out_param<>'' then
            if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
         out_param:=out_param+s;
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         if fileexists(out_param) then
            if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
            else clearfile(out_param);
         out_param:=stringdelim(escapefilename(out_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'lpaq'+DirectorySeparator+lpaq_ver+EXEEXT);
         if sys7zlin>1 then bin_name:=lpaq_ver+EXEEXT;
         cl:=bin_name+' d '+in_param+' '+out_param;
         launch_cl(cl,jobcode,outname);
         end;
      9: begin
         fun:='UNARC';
         fun_status:=fun;
         testencrypted_fromname(in_param,'closed');
         setpwtotest(pwtotest);
         pw:='-p'+pwtotest;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         //folder policy
         set_output_folder(out_param,in_param,true,0,'ext');
         if out_param<>'' then
            if out_param[length(out_param)]=directoryseparator then setlength(out_param,length(out_param)-1); //arc doesn't want directoryseparator as last character
         //overwrite policy
         case extoptarc of
            0: begin overwrite_policy:='-op';  if zaout=2 then zaout:=1; end;//ask auto switch to GUI+console mode if needed
            1: overwrite_policy:='-o+';//overwrite
            2: overwrite_policy:='-o-';//skip
            //else overwrite_policy:='-o-';//for avoid blocking out of console mode, skip existing files replaces ask option
            end;
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         out_param:=stringdelim('-dp'+escapefilename(out_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'arc'+DirectorySeparator+'arc'+EXEEXT);
         if sys7zlin>1 then bin_name:='arc'+EXEEXT;
         cl:=bin_name+' x '+overwrite_policy+' '+in_param;
         if intpw=1 then pforceconsole:=1 else cl:=cl+' '+pw;
         cl:=cl+' '+out_param;
         launch_cl(cl,jobcode,outname);
         end;
      10: begin //zpaqabsolute forced off by default
         fun:='UNZPAQ';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         if out_param<>'' then
            if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
         infopt:=FormPeach.CheckBoxFolder.Checked;
         if optype='extract' then FormPeach.CheckBoxFolder.Checked:=true;
         set_output_folder(out_param,in_param,true,0,'ext');
         FormPeach.CheckBoxFolder.Checked:=infopt;
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         if out_param<>'' then
            if out_param[length(out_param)]=directoryseparator then setlength(out_param,length(out_param)-1);
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         out_param:=stringdelim(escapefilename(out_param,desk_env)+'/');
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT);
         if sys7zlin>1 then bin_name:='zpaq'+EXEEXT;
         pw:=FormPW.EditPWpass.Text;
         if FormPW.EditPWkeyfile.Text<>'' then
            if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
               begin
               pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
               exit;
               end;
         if pw<>'' then
            begin
            if pw4cl('',pw)<>0 then
               begin
               msg_pw_errorchar(pw);
               exit;
               end;
            pw:='-key '+pw;
            end;
         cl:=bin_name;
         if pw<>'' then cl:=cl+' '+pw;
         cl:=cl+' x '+in_param;
         if zpaqall=1 then cl:=cl+' -all';
         if zpaqforce=1 then cl:=cl+' -f';
         cl:=cl+' -to '+out_param;
         tmpvar:=zpaqabsolute;
         zpaqabsolute:=0;
         launch_cl(cl,jobcode,outname);
         zpaqabsolute:=tmpvar;
         end;
     11: begin
         fun:='UNBROTLI';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         s:=extractfilename(in_param);
         cutextension(s);
         if out_param<>'' then
            if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
         out_param:=out_param+s;
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         out_param:=stringdelim(escapefilename(out_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'brotli'+DirectorySeparator+'brotli'+EXEEXT);
         if sys7zlin>1 then bin_name:='brotli'+EXEEXT;
         cl:=bin_name+' -d '+in_param+' -o '+out_param;
         if zpaqforce=1 then cl:=cl+' -f';
         launch_cl(cl,jobcode,outname);
         end;
     12: begin
         fun:='UNZSTD';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         s:=extractfilename(in_param);
         cutextension(s);
         if out_param<>'' then
            if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
         out_param:=out_param+s;
         if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         out_param:=stringdelim(escapefilename(out_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zstd'+DirectorySeparator+'zstd'+EXEEXT);
         if sys7zlin>1 then bin_name:='zstd'+EXEEXT;
         cl:=bin_name+' -d '+in_param+' -o '+out_param;
         if zpaqforce=1 then cl:=cl+' -f';
         launch_cl(cl,jobcode,outname);
         end;
      else
         begin
         if libre_directive=2 then if testifrar(in_param)=1 then begin reportnotsupported_info('RAR'); exit; end;
         fun:='UN7Z';
         fun_status:=fun;
         if testifrar5(in_param)=1 then israr5:='rar5' else israr5:=''; //rar5 test, if rar5 switch to appropriate procedure to call unrar (if allowed by libre_directive=0)
         if israr5='rar5' then
            begin
            testencrypted_fromname(in_param,'closed');
            setpwtotest(pwtotest);
            pw:='-p'+pwtotest;
            jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
            try
               srcfilesize_multipart(in_param,tsize); //expressed in B
            except
            end;
            //folder policy
            set_output_folder(out_param,in_param,true,0,'ext');
            //overwrite policy
            case extopt7z of
            0: overwrite_policy:='-o-';//skip existing files
            1: overwrite_policy:='-or';//auto rename extracting files
            2: overwrite_policy:='-or';//auto rename existing files //not supported by unrar, fall back in renaming extracted files
            3: overwrite_policy:='-o+';//overwrite all existing files
            4: begin overwrite_policy:=''; zaout:=0; end;//auto switch to console mode if needed
            end;
            if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
            out_param:=stringdelim(escapefilename(out_param,desk_env));
            in_param:=stringdelim(escapefilename(in_param,desk_env));
            bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT);
            //if sys7zlin>1 then bin_name:=UNRARNAME+EXEEXT;
            archive_function:='x';
            cl:=bin_name+' '+archive_function;
            cl:=cl+' '+in_param;
            if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
            if intpw=1 then pforceconsole:=1 else cl:=cl+' '+pw;
            cl:=cl+' '+out_param;
            launch_cl(cl,jobcode,outname);
            end
         else
            begin
            testencrypted_fromname(in_param,'closed');
            setpwtotest(pwtotest);
            pw:='-p'+pwtotest;
            if zaout=2 then pipepw:=pwtotest;
            piperar:=false;
            jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
            try
               srcfilesize_multipart(in_param,tsize); //expressed in B
            except
            end;
            //NT, NTFS options
            desni:='';
            desns:='';
            desnz:='';
            if (upcase(extractfileext(in_param))='.WIM') or (upcase(extractfileext(in_param))='.SWM') then
               begin
               if sni7z=1 then desni:='-sni' else desni:='';
               if sns7z=1 then desns:='-sns' else desns:='-sns-';
               end;
            {$IFDEF MSWINDOWS}if snz7z=1 then desnz:='-snz' else {$ENDIF} desnz:='';
            //folder policy
            set_output_folder(out_param,in_param,true,0,'ext');
            //overwrite policy
            case extopt7z of
            0: overwrite_policy:='-aos';//skip existing files
            1: overwrite_policy:='-aou';//auto rename extracting files
            2: overwrite_policy:='-aot';//auto rename existing files
            3: overwrite_policy:='-aoa';//overwrite all existing files
            4: begin overwrite_policy:=''; zaout:=0; end;//auto switch to console mode if needed
            end;
            if pmode=0 then outname:=escapefilename(out_param,desk_env) else outname:=out_param;
            if willbemoved=true then
               begin
               if out_param<>'' then if checkdirexists(out_param) then else CreateDir(out_param);
               filesetattr(out_param, faHidden);
               end;
            out_param:=stringdelim('-o'+escapefilename(out_param,desk_env));
            in_param:=stringdelim(escapefilename(in_param,desk_env));
            bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
            if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
            archive_function:='x';
            cl:=bin_name+' '+archive_function;
            if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
            if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
            cl:=cl+' '+out_param;
            if intpw=1 then pforceconsole:=1
            else
               if pw<>'' then
                  if (pipepw<>'') and (consolecl=false) then else cl:=cl+' '+pw;
            {$IFDEF MSWINDOWS}
            case enc7zscc of
               0: cl:=cl+' -sccUTF-8';
               1: cl:=cl+' -sccWIN';
               2: cl:=cl+' -sccDOS';
            end;
            {$ENDIF}
            if (upcase(extractfileext(inputfile))='.ZIP') or (upcase(extractfileext(inputfile))='.ZIPX') then
               case mcuzip of
                  0: mcu_option:='';
                  1: mcu_option:='-mcu=on';
                  2: mcu_option:='-mcl=on';
                  3: if FormPeach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+FormPeach.EditEncoding.Caption;
               end;
            if mcu_option<>'' then cl:=cl+' '+mcu_option;
            if desni<>'' then cl:=cl+' '+desni;
            if desns<>'' then cl:=cl+' '+desns;
            if desnz<>'' then cl:=cl+' '+desnz;
            case syntaxstring7z of
            '17','16': begin end;
            else if excludeef=1 then cl:=cl+' -xtd';
            end;
            cl:=cl+' '+in_param;
            cl:=cl+' -- '+intitems;
            launch_cl(cl,jobcode,outname);
            end;
         end;
      end;
   untarafter(outname,inname,dummycl,true,optype);
   moveafterextract(outname);
   extraction_checkintermediatedir(outname,optype);
end;

procedure dosequerrmsg;
var
   s:ansistring;
begin
s:=txt_6_5_seqerr;
if UnitGwrap.perrors>0 then s:=inttostr(UnitGwrap.perrors)+' '+s;
if setsequenceerror=2 then s:='[UNTAR] '+s;
if setsequenceerror=3 then s:='[UNTAR] '+s+char($0D)+char($0A)+txt_10_8_untarerr;
pMessageErrorOk(s);
end;

procedure ext2here(tooption,folderoption,pbatch:ansistring); //directly extract archive's content in archive's folder
var
   i:integer;
   out_param,in_param:ansistring;
   nf:boolean;
begin
if paramcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
for i:=2 to paramcount do
   begin
   if filegetattr(paramstr(i)) > 0 then
   else
      begin
      msg_not_accessible(i);
      break;
      end;
   in_param:=ExpandFileName(paramstr(i));
   FormPeach.EditOpenIn.Caption:=in_param;
   if testencrypted_fromname(in_param,'closed') = 2 then continue;
   subfun:='extract';
   //determination of out_param
   case tooption of
   'askto':
      begin
      if testinput(in_param,true)<>0 then
         begin
         FormPeach.SelectDirectoryDialog1.InitialDir:=local_desktop;
         if FormPeach.SelectDirectoryDialog1.Execute then
            if FormPeach.SelectDirectoryDialog1.FileName<>'' then
               begin
               out_param:=FormPeach.SelectDirectoryDialog1.FileName;
               end
            else exit
         else exit;
         end
      else //jump to handling custom file types
         begin
         directextractfromname(in_param,out_param,'extract','');
         if (FormPeach.CheckBoxDeleteInputExt.Checked=true) and (pbatch='complete') then
            if (setsequenceerror<>0) or (UnitGwrap.perrors>0) then
               dosequerrmsg
            else
               erase_fromname('archive',in_param);
         exit;
         end;
      end;
   'simple':
      begin
      in_param:=ExpandFileName(paramstr(3));
      FormPeach.EditOpenIn.Caption:=in_param;
      if testencrypted_fromname(in_param,'closed') = 2 then continue;
      subfun:='extract'; //takes a single input
      out_param:=paramstr(2);
      if out_param='' then out_param:=extractfilepath(in_param);
      if i=3 then
         begin
         if control_outpath(out_param)<>0 then exit;
         continue;
         end;//output;
      end;
   else
      begin
      out_param:=extractfilepath(in_param);
      if control_outpath(out_param)<>0 then exit;
      end;
   end;
   if out_param<>'' then
      if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
   FormPeach.CheckBoxFolder.State:=cbUnChecked;
   {if folderoption='askfolder' then //unused mode, for now
      begin
         if pMessageInfoYesNo(txt_autofolder)=6 then
         begin
         FormPeach.CheckBoxFolder.State:=cbChecked;
         end;
      end;}
   tmpremoveintdir:=removeintdir;
   if folderoption='newfolder' then
      begin
      FormPeach.CheckBoxFolder.State:=cbChecked;
      removeintdir:=0;
      end;
   if folderoption='smart' then
      begin
      FormPeach.CheckBoxFolder.State:=cbChecked;
      removeintdir:=1;
      end;
   if out_param<>'' then
      if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
   //end determination of out_param
   if (FormPeach.CheckBoxrelative.Checked=true) and
      (FormPeach.CheckBoxrelative.enabled=true) and
      (FormPeach.CheckBoxFolder.Checked=false) then
      forcewillbemoved:=true;
   moverelpath:='*';
   directextractfromname(in_param,out_param,'extract','');
   moverelpath:='';
   move_out_param:='';
   forcewillbemoved:=false;
   if (FormPeach.CheckBoxDeleteInputExt.Checked=true) and (pbatch='complete') then
      if (setsequenceerror<>0) or (UnitGwrap.perrors>0) then
         dosequerrmsg
      else
         erase_fromname('archive',in_param);
   end;
if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure ext2lt(ltfun:ansistring); //directly list or test archive(s) from script/context menu
var
   i,j,ec:integer;
   cl,jobcode,out_param,in_param,bin_name,archive_function,pw,pwtotest:ansistring;
   fsize:qword;
begin
if paramcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
setpwtotest(pwtotest);
for i:=2 to paramcount do
   begin
   if filegetattr((paramstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      break;
      end;
   in_param:=ExpandFileName((paramstr(i)));
   inputfile:=in_param;
   j:=testinput(in_param,true);
   case j of
      0,1,2,5,6,8://test not supported custom, pea, raw split, paq, quad, lpaq
         begin
         pMessageWarningOK(upcase(ExtractFileExt(paramstr(i)))+' '+txt_listtest);
         break;
         end;
      7: begin
         if not(fileexists((binpath+'unace'+directoryseparator+'unace'+EXEEXT))) then
            begin
            if libre_directive>0 then begin reportnotsupported('ACE'); exit; end
            else
            if unaceshown=false then
               begin
               pMessageInfoOK('PeaZip UNACE '+txt_5_7_plugin);
               unaceshown:=true;
               end;
            FormPeach.Visible:=false;
            saverestartclosepeaapp;
            exit;
            end;
         fun:='UNACE';
         fun_status:=fun;
         if ltfun='l' then subfun:='list'
         else subfun:='test';
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         out_param:=extractfilepath(in_param);
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unace'+DirectorySeparator+'unace'+EXEEXT);
         //if sys7zlin>1 then bin_name:='unace'+EXEEXT;
         //archive function
         archive_function:=ltfun;
         cl:=bin_name+' '+archive_function;
         cl:=cl+' '+in_param;
         launch_cl(cl,jobcode,out_param);
         end;
      9: begin
         fun:='UNARC';
         fun_status:=fun;
         testencrypted_fromname(in_param,'closed');
         setpwtotest(pwtotest);
         pw:='-p'+pwtotest;
         if ltfun='l' then subfun:='list'
         else subfun:='test';
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         out_param:=extractfilepath(in_param);
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'arc'+DirectorySeparator+'arc'+EXEEXT);
         if sys7zlin>1 then bin_name:='arc'+EXEEXT;
         //archive function
         archive_function:=ltfun;
         cl:=bin_name+' '+archive_function;
         cl:=cl+' '+in_param;
         cl:=cl+' '+pw;
         launch_cl(cl,jobcode,out_param);
         end;
      10: begin
         fun:='UNZPAQ';
         fun_status:=fun;
         //pw:='-key '+pwtotest;
         if ltfun='l' then subfun:='list'
         else subfun:='test';
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         out_param:=extractfilepath(in_param);
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT);
         if sys7zlin>1 then bin_name:='zpaq'+EXEEXT;
         archive_function:=ltfun;
         if archive_function='t' then archive_function:='x';
         cl:=bin_name+' '+archive_function;
         cl:=cl+' '+in_param;
         //cl:=cl+' '+pw;
         if archive_function='x' then cl:=cl+' -test';
         launch_cl(cl,jobcode,out_param);
         end;
      11: begin //only test supported
          fun:='UNBROTLI';
          fun_status:=fun;
          subfun:='test';
          jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
          in_param:=stringdelim(escapefilename(in_param,desk_env));
          out_param:=extractfilepath(in_param);
          bin_name:=stringdelim(escapefilename(binpath,desk_env)+'brotli'+DirectorySeparator+'brotli'+EXEEXT);
          if sys7zlin>1 then bin_name:='brotli'+EXEEXT;
          cl:=bin_name+' -t '+in_param;
          launch_cl(cl,jobcode,out_param);
          end;
      12: begin //only test supported
          fun:='UNZSTD';
          fun_status:=fun;
          subfun:='test';
          jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
          in_param:=stringdelim(escapefilename(in_param,desk_env));
          out_param:=extractfilepath(in_param);
          bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zstd'+DirectorySeparator+'zstd'+EXEEXT);
          if sys7zlin>1 then bin_name:='zstd'+EXEEXT;
          cl:=bin_name+' -t '+in_param;
          launch_cl(cl,jobcode,out_param);
          end;
      else
         begin
         if libre_directive=2 then if testifrar(in_param)=1 then begin reportnotsupported_info('RAR'); exit; end;
         fun:='UN7Z';
         fun_status:=fun;
         if testifrar5(in_param)=1 then israr5:='rar5' else israr5:=''; //rar5 test, if rar5 switch to appropriate procedure to call unrar (if allowed by libre_directive=0)
         if israr5='rar5' then
            begin
            testencrypted_fromname(in_param,'closed');
            setpwtotest(pwtotest);
            pw:='-p'+pwtotest;
            if ltfun='l' then subfun:='list'
            else subfun:='test';
            jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
            try
               srcfilesize_multipart(in_param,tsize); //expressed in B
            except
            end;
            out_param:=extractfilepath(in_param);
            in_param:=stringdelim(escapefilename(in_param,desk_env));
            bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT);
            //if sys7zlin>1 then bin_name:=UNRARNAME+EXEEXT;
            //archive function
            if ltfun='l' then archive_function:='lb'
            else archive_function:='t';
            cl:=bin_name+' '+archive_function;
            cl:=cl+' '+pw;
            cl:=cl+' '+in_param;
            launch_cl(cl,jobcode,out_param);
            end
         else
            begin
            testencrypted_fromname(in_param,'closed');
            setpwtotest(pwtotest);
            pw:='-p'+pwtotest;
            if zaout=2 then pipepw:=pwtotest;
            piperar:=false;
            if ltfun='l' then subfun:='list'
            else subfun:='test';
            jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
            try
               srcfilesize_multipart(in_param,tsize); //expressed in B
            except
            end;
            out_param:=extractfilepath(in_param);
            in_param:=stringdelim(escapefilename(in_param,desk_env));
            bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
            if sys7zlin>0 then bin_name:=alias7z+EXEEXT;
            //archive function
            archive_function:=ltfun;
            cl:=bin_name+' '+archive_function;
            if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
            if intpw=1 then pforceconsole:=1
            else
               if pw<>'' then
                  if (pipepw<>'') and (consolecl=false) then else cl:=cl+' '+pw;
            case syntaxstring7z of
            '17','16': begin end;
            else if excludeef=1 then cl:=cl+' -xtd';
            end;
            cl:=cl+' '+in_param;
            launch_cl(cl,jobcode,out_param);
            end;
         end;
      end;
   end;
end;

procedure ext2browse; //take multiple objects as input; if they are supported archive types each one is opened in a new PeaZip instance
var
   i,j:integer;
   P: tprocessutf8;
   cl,bin_name,in_param:ansistring;
begin
if paramcount<2 then
   begin
   msg_no_input;
   exit;
   end;
for i:=2 to paramcount do
   begin
   if filegetattr((paramstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      break;
      end;
   in_param:=ExpandFileName((paramstr(i)));
   j:=testinput(in_param,true);
   case j of
      0: if pMessageInfoYesNo((paramstr(i))+' '+txt_2_8_custom)=7 then break;
      end;
   in_param:=stringdelim(escapefilename(in_param,desk_env));
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
   cl:=bin_name+' -ext2open '+in_param; //ext2open handles a single input in open interface
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   peapexecute(P,cl);
   P.Free;
   end;
end;

procedure ext2browseasarchive; //take multiple objects as input; if they are supported archive types each one is opened in a new PeaZip instance
var
   i:integer;
   P: tprocessutf8;
   cl,bin_name,in_param:ansistring;
begin
if paramcount<2 then
   begin
   msg_no_input;
   exit;
   end;
for i:=2 to paramcount do
   begin
   if filegetattr((paramstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      break;
      end;
   in_param:=ExpandFileName((paramstr(i)));
   in_param:=stringdelim(escapefilename(in_param,desk_env));
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
   cl:=bin_name+' -ext2openasarchive '+in_param; //ext2openasarchive handles a single input in open interface with forceopenasarchive set true
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   peapexecute(P,cl);
   P.Free;
   end;
end;

procedure ext2browsepath; //take multiple objects as input, each one is opened in a new PeaZip instance
var
   i:integer;
   P: tprocessutf8;
   cl,bin_name,in_param:ansistring;
begin
if paramcount<2 then
   begin
   msg_no_input;
   end
else
   for i:=2 to paramcount do
      begin
      if filegetattr((paramstr(i))) > 0 then
         else
         begin
         msg_not_accessible(i);
         break;
         end;
      in_param:=ExpandFileName((paramstr(i)));
      if checkdirexists(in_param) then
      else in_param:=extractfilepath(in_param);
      in_param:=stringdelim(escapefilename(in_param,desk_env));
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
      cl:=bin_name+' -ext2open '+in_param; //ext2open handles a single input in open interface
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      peapexecute(P,cl);
      P.Free;
      end;
end;

procedure ext2commandprompt; //take multiple objects as input, for each one a command prompt is opened in its path
var
   i:integer;
   in_param:ansistring;
begin
if paramcount<2 then
   begin
   msg_no_input;
   end
else
   for i:=2 to paramcount do
      begin
      if filegetattr((paramstr(i))) > 0 then
         else
         begin
         msg_not_accessible(i);
         break;
         end;
      in_param:=ExpandFileName((paramstr(i)));
      if checkdirexists(in_param) then
      else in_param:=extractfilepath(in_param);
      if in_param<>'' then open_cp(in_param);
      end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection ARCHIVING AND EXTRACTION FUNCTIONS functions in specific screens

///////////////////////////////////////////////////////////////////////////////}

function getoname(var aname,oname:ansistring):integer;
var
   s,s1:ansistring;
   k:integer;
   out_created:boolean;
begin
result:=-1;
oname:=extractfilepath(aname);
if control_outpath(oname)<>0 then exit;
s1:=extractfilename(aname);
cutextension(s1);

if (upcase(ExtractFileExt(aname))='.PEA') then cutextension(s1);

//remove tar extension if tar archive is going to be extracted in the conversion process
if tar_atomic_convert=1 then
   if upcase(ExtractFileExt(s1))='.TAR' then cutextension(s1);
s:=oname+s1;
if ExtractFileExt(aname)='.001' then cutextension(s);
k:=0;
out_created:=false;
repeat
   if not(checkdirexists(s)) then
   try
      forcedirectories(s);//will fail if path requires elevation, that is granted later, so it is checked only for exceptions
      out_created:=true;
   except
      s:=oname+s1+'output';
      out_created:=true;
   end
   else
      begin
      k:=k+1;
      s:=oname+s1+NAMEVARSTR+inttostr(k);
      if k=1000 then //to break recursivity if filename is not valid (ie unsupported character encoding)
         begin
         s:=oname+s1+'output';
         out_created:=true;
         end;
      end;
until out_created=true;
oname:=s;
if oname<>'' then
   if oname[length(oname)]=directoryseparator then setlength(oname,length(oname)-1);
result:=0;
end;

procedure end_convert;
var
   i,rc,nsel:integer;
   oname,strsel:ansistring;
begin
if FormPeach.CheckBoxConvert.State=cbChecked then //remove directories created for conversion
   begin
   nsel:=0;
   strsel:='   ';
   rc:=FormPeach.StringGridAdd.Rowcount;
   for i:=1 to rc-1 do
      begin
      case FormPeach.StringGridAdd.Cells[7,i] of
         '+', '+++':
         begin
         nsel:=nsel+1;
         case nsel of
            1: strsel:=strsel+FormPeach.StringGridAdd.Cells[8,i]+char($0D)+char($0A)+'   ';
            2: strsel:=strsel+FormPeach.StringGridAdd.Cells[8,i]+char($0D)+char($0A)+'   ';
            3: strsel:=strsel+FormPeach.StringGridAdd.Cells[8,i]+char($0D)+char($0A)+'   ';
            4: strsel:=strsel+FormPeach.StringGridAdd.Cells[8,i]+char($0D)+char($0A)+'   ';
            5: strsel:=strsel+FormPeach.StringGridAdd.Cells[8,i]+char($0D)+char($0A)+'   ';
            6: strsel:=strsel+'...';
            end;
         end;
         end;
      end;
   if nsel=0 then exit;
   FormPeach.Enabled:=true;
   if FormPeach.Visible=true then FormPeach.SetFocus;
   if convertverbose=1 then
      if pMessageInfoYesNo(txt_2_8_convertdelete+char($0D)+char($0A)+txt_2_8_convertnote+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel)=7 then exit;
   FormPeach.Enabled:=false;
   for i:=1 to rc-1 do
      begin
      oname:=FormPeach.StringGridAdd.Cells[8,i];
      case FormPeach.StringGridAdd.Cells[7,i] of
         '+' :
         begin
         oname:=extractfilepath(oname);
         cleardir(oname,false,false);
         end;
         '+++' :
         begin
         cleardir(oname,false,false);
         end;
         end;
      end;
   end;
end;

function precheckaddinarchive:boolean;
var
   inpath,s,fextl,dummystr:ansistring;
   i,j:integer;
   namecollisionfound:boolean;
begin
result:=true;
tempaddinarchive:='';
if updatingarchive_inarchive=false then exit;
if updatingarchive_sync=true then exit;
dummystr:=FormPeach.Caption;
FormPeach.Caption:=txt_2_7_updating+' 1/4 '+txt_please_wait;
application.ProcessMessages;
if status0=txt_list_browsing then
   begin
   try inpath:=extractfilepath(FormPeach.EditUn7zaFilter.Text); except inpath:=''; end;//allow adding to empty folders
   end
else
   inpath:='';

{if isabspath(inpath) then
   begin
   result:=false;
   FormPeach.Caption:=dummystr;
   application.ProcessMessages;
   exit;
   end;}

s:=FormPeach.EditOpenIn.Text;
fextl:=upcase(extractfileext(s));
namecollisionfound:=false;
if (fextl='.7Z') or (fextl='.TAR') or (fextl='.ZIP') or (fextl='.WIM') or (fextl='.RAR') or (test_forceeditunsupported(s)=1) then
   for i:=1 to FormPeach.StringGridArchive.Rowcount-1 do
      for j:=1 to FormPeach.StringGridAdd.RowCount-1 do
         if FormPeach.StringGridArchive.Cells[12,i]=inpath+FormPeach.StringGridAdd.Cells[1,j] then
            begin
            namecollisionfound:=true;
            break;
            end;
if namecollisionfound= true then
   if (FormPeach.StringGridList.RowCount=2) and (FormPeach.StringGridList.Cells[1,1]='') then namecollisionfound:=false;//empty archive
if namecollisionfound=true then
   if pMessageInfoYesNo(txt_6_9_overarch)=7 then
   begin
   result:=false;
   FormPeach.Caption:=dummystr;
   application.ProcessMessages;
   exit;
   end;
dummystr:=FormPeach.Caption;
FormPeach.Caption:=txt_2_7_updating+' 2/4 '+txt_please_wait;
application.ProcessMessages;
if inpath<>'' then
   begin
   tempaddinarchive:=STR_TMP+'dir'+inttohex(random(16000000),6);
   if (fextl='.7Z') or (fextl='.TAR') or (fextl='.ZIP') or (fextl='.WIM') or (fextl='.RAR') or (test_forceeditunsupported(s)=1) then
      for i:=1 to FormPeach.StringGridArchive.Rowcount-1 do
         for j:=1 to FormPeach.StringGridAdd.RowCount-1 do
            if FormPeach.StringGridArchive.Cells[12,i]=FormPeach.StringGridAdd.Cells[1,j] then
               begin
               FormPeach.StringGridArchive.Cells[0,i]:='1';
               renamefileinarchive(FormPeach.StringGridAdd.Cells[1,j],tempaddinarchive+DirectorySeparator+FormPeach.StringGridAdd.Cells[1,j],false);
               application.ProcessMessages;
               end;
   end;
FormPeach.Caption:=dummystr;
application.ProcessMessages;
end;

procedure checkaddinarchive(ares,clres:integer);
var
   inpath,s,fextl,dummystr:ansistring;
   i:integer;
begin
if updatingarchive_inarchive=false then exit;
if updatingarchive_sync=true then exit;
dummystr:=FormPeach.Caption;
FormPeach.visible:=True;
FormPeach.Caption:=txt_2_7_updating+' 3/4 '+txt_please_wait;
FormPeach.PanelProgressAdd.Width:=(FormPeach.Width*80) div 100;
application.ProcessMessages;
if status0=txt_list_browsing then
   begin
   try inpath:=extractfilepath(FormPeach.EditUn7zaFilter.Text); except inpath:=''; end;//allow adding to empty folders
   end
else
   inpath:='';

//if isabspath(inpath) then exit;

if inpath<>'' then
   begin
   s:=FormPeach.EditOpenIn.Text;
   fextl:=upcase(extractfileext(s));
   if (fextl='.7Z') or (fextl='.TAR') or (fextl='.ZIP') or (fextl='.WIM') or (fextl='.RAR') or (test_forceeditunsupported(s)=1) then
      begin
      if (ares=0) and (clres=0) then
         for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
            begin
            renamefileinarchive(FormPeach.StringGridAdd.Cells[1,i],inpath+FormPeach.StringGridAdd.Cells[1,i],true);
            FormPeach.PanelProgressAdd.Width:=((FormPeach.Width*80) + ((FormPeach.Width*i*10) div FormPeach.StringGridAdd.RowCount)) div 100;
            application.ProcessMessages;
            end;
      FormPeach.Caption:=txt_2_7_updating+' 4/4 '+txt_please_wait;
      FormPeach.PanelProgressAdd.Width:=(FormPeach.Width*92) div 100;
      application.ProcessMessages;
      for i:=1 to FormPeach.StringGridArchive.RowCount-1 do
         if FormPeach.StringGridArchive.Cells[0,i]='1' then
            begin
            FormPeach.StringGridArchive.Cells[0,i]:='';
            renamefileinarchive(tempaddinarchive+DirectorySeparator+FormPeach.StringGridArchive.Cells[12,i],FormPeach.StringGridArchive.Cells[12,i],false);
            application.ProcessMessages;
            end;
      end;
   end;
FormPeach.Caption:=dummystr;
application.ProcessMessages;
tempaddinarchive:='';
end;

procedure autotestarchive_fromname(fname:ansistring);
var
   s,sfun,sfuns,cl,jobcode,outname,strsel,funct1:ansistring;
   j:integer;
   tautoclosegwrap:byte;
begin
if fname='' then exit;
listmode:=1;
s:=FormPeach.EditOpenIn.Text;
sfun:=fun;
sfuns:=fun_status;
tautoclosegwrap:=autoclosegwrap;
if autoclosegwrap=2 then autoclosegwrap:=3;
//0 always stop; 1 stop for test; 2 stop for test but behaves as 3 for autotest; 3 stop for errors 4 never stop
FormPeach.EditOpenIn.Text:=fname;
testarctype(fname,j,fun);
srcfilesize_multipart(fname,tsize);
if archiveisempty(fname)=true then pMessageWarningOK(fname+char($0D)+char($0A)+char($0D)+char($0A)+txt_8_9_empty);
fun_status:='FILEBROWSER';
case fun of
   'UN7Z': if compose_un7z_cl(cl,jobcode,outname,false,'test','all')=0 then launch_cl(cl,jobcode,outname);
   'UNARC': if compose_unarc_cl(cl,jobcode,outname,false,'test','all')=0 then launch_cl(cl,jobcode,outname);
   'UNBROTLI': if compose_unbrotli_cl(cl,jobcode,outname,false,'test','all')=0 then launch_cl(cl,jobcode,outname);
   'UNZPAQ': if compose_unzpaq_cl(cl,jobcode,outname,false,'test','all')=0 then launch_cl(cl,jobcode,outname);
   'UNZSTD': if compose_unzstd_cl(cl,jobcode,outname,false,'test','all')=0 then launch_cl(cl,jobcode,outname);
end;
FormPeach.EditOpenIn.Text:=s;
fun:=sfun;
fun_status:=sfuns;
autoclosegwrap:=tautoclosegwrap;
end;

function testpwspecialcases:boolean;
begin
result:=true;
if FormPW.EditPWpass.Text='' then exit;
if ((FormPeach.cbType.Text=txt_custom+'/RAR') and (zaout=2) and (pforceconsole=0)) or
   //UTF-8 strings are not correctly passed to mgotypeRAR pipe in Windows, workarounds console mode passing through command line or interactive password typing forcing directly typing in console
   (FormPeach.cbType.Text=STR_ZIP) then
   //UTF-8 strings are not allowed by 7z/p7zip backend for the ZIP format, no workaround
   result:=strisascii(FormPW.EditPWpass.Text);
end;

procedure goarchive;
var
   sel,s,serr,aname,oname,otest,strsel,dummycl,dummycltar,dummytitle,toname,totype,outname,aoutname:ansistring;
   i,k,iext,nsel,j,clres:integer;
   isize,ksize:qword;
   nf:boolean;
begin

if testpwspecialcases=false then
   begin
   if FormPeach.cbType.Text=txt_custom+'/RAR' then
      pMessageWarningOK(txt_10_3_ascii+char($0D)+char($0A)+txt_10_3_aw)
   else
      pMessageWarningOK(txt_10_3_ascii);
   exit;
   end;

FormPeach.enabled:=false;
setsequenceerror:=0;
clearstopsequencefile;
UnitGwrap.perrors:=0;
psize:=0;
clres:=0;
if FormPeach.StringGridAdd.RowCount>1 then
   if (FormPeach.EditAddFilepath.Text='') or (FormPeach.EditAddFilename.Text='') then setoutname(s,0);

if FormPeach.CheckBoxParallelArchiving.State=cbUnChecked then needwaitupdating:=true; //execute jobs sequentially (wait job completion) if not requested elsewhere
if (FormPeach.StringGridAdd.RowCount<3) or (FormPeach.CheckBoxSeparate.State=cbUnChecked) then needwaitupdating:=false; //don't wait job completion if not needed (single input, or single output)
if FormPeach.LabelStatusAddUpdate.Caption=txt_2_7_updating then needwaitupdating:=true; //restore wait job completion, needed for archive update procedure, that may have been modified in the previous check
if FormPeach.CheckBoxDeleteInputAdd.Checked=true then needwaitupdating:=true; //execute jobs sequentially, needed by delete original files options, replaces previous rules
if FormPeach.CheckBoxAutoHaltA.Checked=true then needwaitupdating:=true;

if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;

FormPeach.PanelProgressAdd.Color:=PGREEN;
FormPeach.PanelProgressAdd.Height:=pbarh;
FormPeach.PanelProgressAdd.Width:=0;
application.ProcessMessages;

k:=FormPeach.StringGridAdd.RowCount;
isize:=0;
ksize:=0;
for i:=1 to k-1 do ksize:=ksize+StrToInt64(FormPeach.StringGridAdd.Cells[12,i]);

if FormPeach.CheckBoxConvert.State=cbChecked then
   begin
   subfun:='convert';
   dummytitle:=FormPeach.Caption;
   FormPeach.enabled:=false;
   FormPeach.visible:=false;
   needwaitupdating:=true; //execute jobs sequentially, needed by conversion, replaces previous rules
   FormPeach.CheckBoxFolder.State:=cbUnChecked; //override extract to new folder
   for i:=1 to k-1 do
      begin
      if checkstopsequencefile=true then
         begin
         subfun:='archive';
         FormPeach.enabled:=true;
         FormPeach.visible:=true;
         FormPeach.Caption:=dummytitle;
         clearstopsequencefile;
         break;
         end;
      if FormPeach.Width<>0 then UnitGwrap.pprogbarprev:=FormPeach.PanelProgressAdd.Width*FormGwrap.Width div FormPeach.Width;
      isize:=isize+strtoint64(FormPeach.StringGridAdd.Cells[12,i]);
      if ksize<>0 then FormPeach.PanelProgressAdd.Width:=(FormPeach.Width*(((isize*100)div ksize))) div 100;
      //FormPeach.PanelProgressAdd.Width:=(((FormPeach.Width*i)*100) div (FormPeach.StringGridAdd.Rowcount-1))div 100;
      FormPeach.Caption:=txt_2_8_convertexisting+'... ('+inttostr(i)+'/'+inttostr(k-1)+')';
      FormPeach.StringGridAdd.Row:=i;
      FormPeach.StringGridAdd.Cells[11,i]:='1';
      Application.ProcessMessages;
      otest:=extractfilepath(FormPeach.EditAddName.Text);
      if control_outpath_archive(otest)<>0 then
         begin
         subfun:='archive';
         FormPeach.enabled:=true;
         FormPeach.visible:=true;
         exit;
         end;
      aname:=FormPeach.StringGridAdd.Cells[8,i];
      iext:=testext(aname);
      if forceconvert=0 then if ((iext>=100) and (iext<500)) then iext:=-1;//non-canonical archive types are not converted (compressed as is) if this option is not enabled
      case iext of //convert by type
         -1: begin FormPeach.StringGridAdd.Cells[7,i]:=''; end;
         503: begin FormPeach.StringGridAdd.Cells[7,i]:=''; end;
         502: begin FormPeach.StringGridAdd.Cells[7,i]:=''; end;
         501: begin FormPeach.StringGridAdd.Cells[7,i]:=''; end; //non-archives
         500: begin FormPeach.StringGridAdd.Cells[7,i]:=''; end; //Windows executables, installers
         else
            begin
            if getoname(aname,oname)<0 then
               begin
               FormPeach.enabled:=true;
               FormPeach.visible:=true;
               subfun:='archive';
               pMessageWarningOK(txt_2_8_cannotconvert);
               end_convert;
               if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
               if stayopen=false then exit_withsave
               else tobrowser_fromarchiver;
               exit;
               end;
            //extraction stage, uses directextractfromname rather than compose_un* (doesn't need extraction form to be valorized)
            if iext=10001 then try cleardir(oname,false,false); except end; //if input format is pea, delete dir that will be re-created by pea (otherwise it will skip it and create a new fresh directory)
            if iext=10000 then try cleardir(oname,false,false); except end; //if input is a split file, delete the temp dir
            FormPeach.StringGridAdd.Cells[8,i]:=oname;

            if (FormPeach.cbType.Text=STR_ARC) or
               (FormPeach.cbType.Text=txt_sfx+' '+STR_ARC) or
               (FormPeach.cbType.Text=STR_ZPAQ) or
               (FormPeach.cbType.Text=STR_QUAD) or
               (FormPeach.cbType.Text=STR_BROTLI) or
               //(FormPeach.cbType.Text=STR_ZSTD) or //needs 7z style sintaxt for input
               (FormPeach.cbType.Text=STR_UPX) or
               (FormPeach.cbType.Text=txt_custom) or (FormPeach.cbType.Text=txt_custom+'/RAR') or
               (FormPeach.cbType.Text=txt_split) or
               (FormPeach.cbType.Text=STR_PEA) then
               totype:='no7z'
            else
               totype:='7z';

            if totype='7z' then
               if ((FormPeach.CheckBoxSeparate.Checked=true) or (k=2)) then
                  begin
                  toname:=oname+directoryseparator+'*';
                  FormPeach.StringGridAdd.Cells[7,i]:='+';
                  end
               else
                  begin
                  toname:=oname;
                  FormPeach.StringGridAdd.Cells[7,i]:='+++';
                  end
            else
               begin
               toname:=oname;
               FormPeach.StringGridAdd.Cells[7,i]:='+++';
               end;
            if iext=10001 then oname:=ExtractFilePath(oname);//PEA
            {if iext=10001 then //split file, check moved
                begin
                cutextension(oname);
                if (FormPeach.CheckBoxSeparate.Checked=true) then
                   begin
                   toname:=copy(toname,1,length(toname)-2);
                   cutextension(toname);
                   toname:=oname+directoryseparator+'*';
                   end
                else
                    cutextension(toname);
                end;}
            directextractfromname(aname,oname,'convert',''); //oname will be changed accordingly to the backend's conventions about output parameter
            FormPeach.StringGridAdd.Cells[8,i]:=toname;
            end;
         end;
      FormPeach.StringGridAdd.Cells[11,i]:='0';
      end;
   FormPeach.enabled:=true;
   FormPeach.visible:=true;
   if FormPeach.Visible=true then FormPeach.SetFocus;
   if (setsequenceerror<>0) or (UnitGwrap.perrors>0) then
      begin
      serr:=txt_8_1_ed+char($0D)+char($0A)+txt_2_8_convertbegin;
      if UnitGwrap.perrors>0 then serr:=inttostr(UnitGwrap.perrors)+' '+serr;
      if pMessageErrorYesNo(serr)=7 then
         begin
         subfun:='archive';
         end_convert;
         ares:=0;
         if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
         if stayopen=false then exit_withsave
         else tobrowser_fromarchiver;
         exit;
         end;
      end;
   if convertverbose=1 then
      if pMessageInfoYesNo(txt_2_8_convertbegin)=7 then
         begin
         subfun:='archive';
         end_convert;
         ares:=0;
         if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
         if stayopen=false then exit_withsave
         else tobrowser_fromarchiver;
         exit;
         end;
   if convertpw=1 then
      begin
      pMessageInfoOK(txt_6_5_np);
      repeat
      j:=ask_pwkeyfile_core;
      until j>=0;
      end;
   FormPeach.Caption:=dummytitle;
   FormPeach.PanelProgressAdd.Width:=0;
   subfun:='archive';
   end;
if precheckaddinarchive=false then
   begin
   if stayopen=false then exit_withsave
   else tobrowser_fromarchiver;
   exit;
   end;
try
if FormPeach.CheckBoxSeparate.State=cbChecked then
   begin
   FormPeach.visible:=False;
   dummytitle:=FormPeach.Caption;
   k:=FormPeach.StringGridAdd.RowCount;
   isize:=0;
   for i:=1 to k-1 do
      begin
      if FormPeach.Width<>0 then UnitGwrap.pprogbarprev:=FormPeach.PanelProgressAdd.Width*FormGwrap.Width div FormPeach.Width;
      isize:=isize+strtoint64(FormPeach.StringGridAdd.Cells[12,i]);
      if ksize<>0 then FormPeach.PanelProgressAdd.Width:=(FormPeach.Width*(((isize*100)div ksize))) div 100;
      //FormPeach.PanelProgressAdd.Width:=(((FormPeach.Width*i)*100) div (FormPeach.StringGridAdd.Rowcount-1))div 100;
      application.ProcessMessages;
      if checkstopsequencefile=true then
         begin
         clearstopsequencefile;
         break;
         end;
      FormPeach.Caption:=dummytitle+' ('+inttostr(i)+'/'+inttostr(k-1)+')';
      FormPeach.StringGridAdd.Row:=i;
      FormPeach.StringGridAdd.Cells[11,i]:='1';
      application.processmessages;
      sel:=inttostr(i);
      suggest_outname(s,FormPeach.cbType.Text,i);
      if FormPeach.CheckBoxConvert.State=cbChecked then
         if s[length(s)]='*' then s:=copy(s,1,length(s)-2); //convert, conversion root folder
      s:=extractfilename(s); //keep only filename, set path to last used
      FormPeach.EditAddFilename.Text:=s;
      FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
      otest:=extractfilepath(FormPeach.EditAddName.Text);
      if control_outpath_archive(otest)<>0 then begin FormPeach.enabled:=true; exit; end;
      ares:=archive_mainsequence(sel,aoutname,clres);
      FormPeach.StringGridAdd.Cells[11,i]:='0';
      if autotest=1 then autotestarchive_fromname(aoutname);
      end;
   FormPeach.Caption:=dummytitle;
   //pf:=FormPeach.cbType.ItemIndex;
   lastoutpath:=extractfilepath(FormPeach.EditAddFilepath.Text);
   if needwaitupdating=false then sleep(random(500)); //let some time between jobs if launched in parallel
   end
else
   begin
   FormPeach.PanelProgressAdd.Width:=(FormPeach.Width*50) div 100;
   application.ProcessMessages;
   sel:='all';
   otest:=extractfilepath(FormPeach.EditAddName.Text);
   if control_outpath_archive(otest)<>0 then begin FormPeach.enabled:=true; exit; end;
   if FormPeach.CheckBoxTarBefore.State=cbChecked then
      begin
      dummytitle:=FormPeach.Caption;
      FormPeach.Caption:=txt_tarbefore+'... (1/1)';
      tarbefore(sel,outname,dummycltar,true);
      FormPeach.visible:=False;
      ares:=archive_mainsequence(sel,aoutname,clres);
      if stayopen=true then FormPeach.visible:=True;
      if FormPeach.CheckBoxDeleteInputAdd.Checked=true then
         if (setsequenceerror<>0) or (UnitGwrap.perrors>0) then
            begin
            serr:=txt_6_5_seqerr+char($0D)+char($0A)+char($0D)+char($0A)+outname;
            if UnitGwrap.perrors>0 then serr:=inttostr(UnitGwrap.perrors)+' '+serr;
            pMessageErrorOk(s);
            end
         else
            clearfile(outname)
      else
         clearfile(outname);
      using_tarbefore:=false;
      //pf:=FormPeach.cbType.ItemIndex;
      lastoutpath:=extractfilepath(FormPeach.EditAddFilepath.Text);
      FormPeach.Caption:=dummytitle;
      end
   else
      begin
      FormPeach.visible:=False;
      ares:=archive_mainsequence(sel,aoutname,clres);
      //pf:=FormPeach.cbType.ItemIndex;
      lastoutpath:=extractfilepath(FormPeach.EditAddFilepath.Text);
      end;
   if autotest=1 then autotestarchive_fromname(aoutname);
   end;
checkaddinarchive(ares,clres);
finally
  if stayopen=true then FormPeach.visible:=True;
end;

FormPeach.PanelProgressAdd.Width:=FormPeach.Width;
application.ProcessMessages;

end_convert;

application.ProcessMessages;

if FormPeach.CheckBoxTarBefore.State=cbUnChecked then //deletion of original files, if scheduled, is needed to be performed in tarbefore procedure after TAR creation
 if FormPeach.CheckBoxDeleteInputAdd.Checked=true then
   begin
   checklistarchive(nsel, strsel);
   if FormPeach.cbType.Text<>STR_UPX then
   if (setsequenceerror<>0) or (UnitGwrap.perrors>0) then
      dosequerrmsg
   else
      if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletefilesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 FormPeach.cbDeleteInputModeAdd.Caption+' '+inttostr(nsel)+' '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,1,dummycl);
         1: erase_fromarchiving(0,1,dummycl);
         2: erase_fromarchiving(2,1,dummycl);
         3: erase_fromarchiving(1,1,dummycl);
         end;
      {$ELSE}
      {$IFDEF DARWIN}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(3,1,dummycl);
         1: erase_fromarchiving(0,1,dummycl);
         2: erase_fromarchiving(2,1,dummycl);
         3: erase_fromarchiving(1,1,dummycl);
         end;
      {$ELSE}
      case FormPeach.cbDeleteInputModeAdd.ItemIndex of
         0: erase_fromarchiving(0,1,dummycl);
         1: erase_fromarchiving(2,1,dummycl);
         2: erase_fromarchiving(1,1,dummycl);
         end;
      {$ENDIF}
      {$ENDIF}
      end;
   end;

application.ProcessMessages;

if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
FormPeach.enabled:=true;
if skipapstatus=true then
   begin
   restorestatus_archiver;
   skipapstatus:=false;
   end
else savestatus_archiver;
if ares=0 then
   if ((stayopen=false) or (autoclosepeazip=1)) then exit_withsave
   else tobrowser_fromarchiver
else FormPeach.visible:=True;//in case of error, assure the form is visible to let the user either handle it or properly close the app
end;

procedure on_buttonarchiveclick;
begin
if goarchiving=true then exit;
goarchiving:=true;
FormPeach.Enabled:=false;
endmultimode;
if checkfreespace<>0 then FormPeach.StringGridAdd.RowCount:=1;
if FormPeach.StringGridAdd.RowCount=1 then
   begin
   if skipapstatus=true then
      begin
      restorestatus_archiver;
      skipapstatus:=false;
      end
   else savestatus_archiver;
   if stayopen=false then exit_withsave
   else tobrowser_fromarchiver;
   end
else
   begin
   goarchive;
   checkhaltsystem_fromA;
   end;
FormPeach.Enabled:=true;
goarchiving:=false;
end;

procedure gocancelextract;
begin
restorestatus_extractor;
if stayopen=false then exit_withsave
else tobrowser_fromextractor;
end;

procedure cancelbuttonextract;
begin
endmultimode;
FormPeach.ComboBoxActionExtract.ItemIndex:=0; on_radiogroupactionchange;
gocancelextract;
end;

procedure calcseltsize;
var
   i:integer;
begin
tsize:=0;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      try
      tsize:=tsize+strtoqword(FormPeach.StringGridList.Cells[3,i]);
      except
      end;
end;

procedure calcdisptsize;
var
   i:integer;
begin
tsize:=0;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   try
   tsize:=tsize+strtoqword(FormPeach.StringGridList.Cells[3,i]);
   except
   end;
end;

procedure calcalltsize;
begin
tsize:=0;
try
srcfilesize_multipart(FormPeach.EditOpenIn.Text,tsize);
except
end;
end;

procedure archive_funsel(funct,select:ansistring);
var
   cl,jobcode,outname:ansistring;
begin
if testencrypted<0 then exit;
if select<>'all' then
   begin
   if FormPeach.StringGridList.RowCount<2 then exit;
   if FormPeach.StringGridList.Cells[1,1]='' then exit;
   end;
resetminimizedlauncher;
FormPeach.Visible:=false;
if funct='details' then
   begin
   funct:='list';
   listmode:=0;
   end
else listmode:=1;
case select of
   'all' : calcalltsize;
   'displayed' : calcdisptsize;
   'selected' : calcseltsize;
   end;
case fun of
   'UN7Z': if compose_un7z_cl(cl,jobcode,outname,false,funct,select)=0 then launch_cl(cl,jobcode,outname);
   'UNARC':
      begin
      if fun='info' then fun:='list';//detailed list not featured in ARC
      if compose_unarc_cl(cl,jobcode,outname,false,funct,select)=0 then launch_cl(cl,jobcode,outname);
      end;
   'UNBROTLI': if compose_unbrotli_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname);
   'UNZPAQ': if compose_unzpaq_cl(cl,jobcode,outname,false,funct,select)=0 then launch_cl(cl,jobcode,outname);
   'UNZSTD': if compose_unzstd_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname);
   end;
FormPeach.Visible:=true;
end;

procedure filebrowser_funall(funct:ansistring);//test, list, info, details (list and give info msg only), batchlist and batchtest run without stop even in case of errors and report results in the file browser crc column
var
   P:tprocessutf8;
   s,cl,jobcode,outname,strsel,funct1,sbatch:ansistring;
   i,j,k,nsel,ac:integer;
   scheduleclip:array of array [0..18] of ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checkfdwin<>0 then exit;
if funct<>'test' then if checklisttotsel(nsel,strsel)<>0 then exit;
clearlist_ext;
resetminimizedlauncher;
FormPeach.Visible:=false;

if (funct='batchtest') or (funct='batchlist') then
   begin
   ac:=autoclosegwrap;
   autoclosegwrap:=4;
   if funct='batchtest' then funct:='test'
   else funct:='list';
   funct1:='batch';
   end;

if funct='details' then
   begin
   funct:='list';
   funct1:='details';
   listmode:=0;
   end
else listmode:=1;
s:=FormPeach.EditOpenIn.Text;
k:=0;
setlength(scheduleclip,1);
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      begin
      if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
      for j:=0 to FormPeach.StringGridList.ColCount-1 do
         scheduleclip[k,j]:=FormPeach.StringGridList.Cells[j,i];
      setlength(scheduleclip,length(scheduleclip)+1);
      k:=k+1;
      end;
for i:=0 to k-1 do
   begin
   FormPeach.EditOpenIn.Text:=scheduleclip[i,12];
   if testencrypted_fromname(FormPeach.EditOpenIn.Text,'closed')=2 then Continue;
   //tsize:=strtoqword(scheduleclip[i,3]);//not correct for multivolumes
   srcfilesize_multipart(scheduleclip[i,12],tsize);//get correct size for multivolumes
   testarctype(FormPeach.EditOpenIn.Text,j,fun);
   if (funct='test') and (fun='FILEBROWSER') then fun:='UN7Z'; //test inside directories
   fun_status:='FILEBROWSER';
   scheduleclip[i,11]:='';
   case fun of
   'UN7Z': if compose_un7z_cl(cl,jobcode,outname,false,funct,'all')=0 then scheduleclip[i,11]:=inttostr(launch_cl(cl,jobcode,outname));
   'UNARC': if compose_unarc_cl(cl,jobcode,outname,false,funct,'all')=0 then scheduleclip[i,11]:=inttostr(launch_cl(cl,jobcode,outname));
   'UNBROTLI': if funct='test' then if compose_unbrotli_cl(cl,jobcode,outname,false,funct,'all')=0 then scheduleclip[i,11]:=inttostr(launch_cl(cl,jobcode,outname));
   'UNZPAQ': if funct='test' then if compose_unzpaq_cl(cl,jobcode,outname,false,funct,'all')=0 then scheduleclip[i,11]:=inttostr(launch_cl(cl,jobcode,outname));
   'UNZSTD': if funct='test' then if compose_unzstd_cl(cl,jobcode,outname,false,funct,'all')=0 then scheduleclip[i,11]:=inttostr(launch_cl(cl,jobcode,outname));
   else
      if (funct1='details') then
         begin
         cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' list info '+stringdelim(FormPeach.EditOpenIn.Text);
         if FormPeach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P:=tprocessutf8.Create(nil);
         peapexecute(P,cl);
         P.Free;
         end;
   end;
   if checkstopsequencefile=true then break;
   end;

if funct1='batch' then
   begin
   autoclosegwrap:=ac;
   k:=0;
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         sbatch:=txt_6_5_error;
         if scheduleclip[k,11]='' then sbatch:='';
         if scheduleclip[k,11]='0' then sbatch:=txt_2_7_ok;
         if scheduleclip[k,11]='255' then sbatch:=txt_jstopped;
         FormPeach.StringGridList.Cells[11,i]:=sbatch;
         FormPeach.ListViewBrowser.Items[i-1].SubItems[9]:=FormPeach.StringGridList.Cells[11,i];
         k:=k+1;
         end;
   end;

setlength(scheduleclip,0);
FormPeach.EditOpenIn.Text:=s;
fun:='FILEBROWSER';
fun_status:=fun;
FormPeach.Visible:=true;
end;

procedure do_test;
begin
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('test')
else archive_funsel('test','all');
end;

procedure addtoarchive_selected;
var
   i:integer;
begin
Application.ProcessMessages;
resetminimizedlauncher;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      if FormPeach.StringGridList.Cells[12,i]<>'' then
         if checkfdwin_row(i)=0 then
            if testname(FormPeach.StringGridList.Cells[12,i], FormPeach.StringGridAdd)=0 then
               begin
               FormPeach.Caption:=txt_2_4_adding+' '+FormPeach.StringGridList.Cells[12,i];
               Application.ProcessMessages;
               if filegetattr(FormPeach.StringGridList.Cells[12,i]) > 0 then
                  if filegetattr(FormPeach.StringGridList.Cells[12,i]) and faDirectory =0 then begin addfilestr(FormPeach.StringGridAdd,FormPeach.StringGridList.Cells[12,i]); end
                  else addfolderstr(FormPeach.StringGridAdd,FormPeach.StringGridList.Cells[12,i])
               else msg_not_accessible_list(FormPeach.StringGridList.Cells[12,i]);
               end;
FormPeach.StringGridAdd.AutoSizeColumns;
showpanel('archive');
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
//FormPeach.ComboBox7zFun.ItemIndex:=0;//since release 8.7.0 remember the archive creation mode
FormPeach.cbAct.Itemindex:=FormPeach.ComboBox7zFun.Itemindex;
FormPeach.ComboBoxARCFun.ItemIndex:=0;
application.ProcessMessages;
if enumd=1 then updatelayout('enum');
end;

procedure resetmiscarchiveopt;
begin
FormPeach.cbSplit.ItemIndex:=0;
cbSplit_onchange;
end;

procedure setupdatecontrols(encnt:boolean);
begin
with FormPeach  do
begin
PanelAddArchiveOut.Enabled:=encnt;
PanelAddUpdateOut.Enabled:=not(encnt);
PanelAddUpdateOut.Visible:=not(encnt);
if PanelAddUpdateOut.Visible = true then
   begin
   if status0=txt_list_browsing then
      LabelUpdateAddress.caption:=extractfilepath(FormPeach.EditUn7zaFilter.Text)//allow adding to empty folders
   else
      LabelUpdateAddress.caption:='';
   end;
if ComboBox7zPaths.ItemIndex<>0 then LabelUpdateAddress.caption:='<'+LabelUpdateAddress.caption+'> ('+ComboBox7zPaths.Text+')'
else LabelUpdateAddress.caption:='<'+LabelUpdateAddress.caption+'>';
LabelUpdateAddress.Enabled:=false;
LabelPathUpdate.Enabled:=false;
LabelOutUpdate.Enabled:=false;
LabelActUpdate.Enabled:=false;
ButtonOutUpdate.Enabled:=false;
EditNameUpdate.Caption:=EditAddName.Caption;
EditNameUpdate.Enabled:=false;
ButtonEditNameUpdate.Enabled:=false;
ButtonPasswordUpdate.Caption:=FormPeach.BtnPasswordArchive.Caption;
ButtonPasswordUpdate.Hint:=FormPeach.BtnPasswordArchive.Hint;
ButtonPasswordUpdate.Visible:=FormPeach.BtnPasswordArchive.Visible;
ButtonPasswordUpdate.Glyph:=BtnPasswordArchive.Glyph;
ComboBoxArchiveActUpdate.ItemIndex:=cbAct.ItemIndex;
//ComboBoxArchiveActUpdate.Enabled:=cbAct.Enabled;
end;
end;

function isarchiveeditable:integer;//-1 not an archive 0 can edit 1 will try to edit (forced) 2 cannot edit 3 blocked due to path issues (:, /, \)
var
   s,fextl:ansistring;
begin
result:=-1;
if fun='FILEBROWSER' then exit;
result:=0;
s:=FormPeach.EditOpenIn.Text;
fextl:=upcase(extractfileext(s));
//set type, set action to update
case fextl of
'.7Z','.TAR','.WIM','.ZIP','.ZIPX','.ARC','.ZPAQ','.EXE': begin end;
'.RAR' :
   begin
   if (havewinrar=true) and (userar=1) then
      begin end
   else
      result:=2;
   end;
else
   begin
   if test_forceeditunsupported(s)=1 then
      result:=1
   else
      result:=2;
   end;
end;
//if isabspath(FormPeach.EditUn7zaFilter.Caption) then result:=3; //disables editing items in absolute paths, which is problematic for some functions in 7z/p7zip frontend, especially delete
end;

function testeditable:boolean;
begin
result:=true;
case isarchiveeditable of
2: begin
   pMessageWarningOK(txt_add_error);
   result:=false;
   end;
3: begin
   pMessageWarningOK(txt_add_error+char($0D)+char($0A)+txt_10_5_pathlock);
   result:=false;
   end;
end;
end;

function addtoarchive_inarchive(forceadd:boolean):boolean;
var
   s,fextl:ansistring;
begin
result:=true;
FormPeach.CheckBoxSameArc.State:=cbUnchecked;
FormPeach.CheckBoxSeparate.State:=cbUnchecked;
FormPeach.CheckBoxConvert.State:=cbUnchecked;
FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
resetminimizedlauncher;
resetmiscarchiveopt;
FormPeach.StringGridAdd.AutoSizeColumns;
s:=FormPeach.EditOpenIn.Text;
FormPeach.EditAddFilepath.Text:=extractfilepath(s);
fextl:=upcase(extractfileext(s));

if testeditable=false then exit;

//set type, set action to update
if (fextl='.7Z') or (fextl='.RAR') or (fextl='.TAR') or (fextl='.WIM') or (fextl='.ZIP') or (fextl='.ZIPX') or (fextl='.EXE') then
   begin
   case fextl of
      '.7Z' : archive_type_select(STR_7Z);
      '.EXE' : archive_type_select(txt_sfx+' '+STR_7Z);//assumes it is 7Z sfx file
      '.RAR' :
         begin
         //if (havewinrar=true) and (userar=1) then
         archive_type_select(txt_custom+'/RAR');
         {else
            begin
            pMessageWarningOK(txt_add_error);
            tobrowser_fromarchiver;
            result:=false;
            exit;
            end;}
         specialmoderar:=1;
         end;
      '.TAR' : archive_type_select(STR_TAR);
      '.ZIP' : archive_type_select(STR_ZIP);
      '.ZIPX' : archive_type_select(STR_ZIP);
      '.WIM' : archive_type_select(STR_WIM);
      end;
   if forceadd=true then FormPeach.ComboBox7zFun.ItemIndex:=1 else FormPeach.ComboBox7zFun.ItemIndex:=2;
   FormPeach.cbAct.Itemindex:=FormPeach.ComboBox7zFun.Itemindex;
   end
else
   if fextl='.ARC' then
      begin
      archive_type_select(STR_ARC);
      if forceadd=true then FormPeach.ComboBoxARCFun.ItemIndex:=1 else FormPeach.ComboBoxARCFun.ItemIndex:=2;
      end
   else
   if fextl='.ZPAQ' then
      begin
      archive_type_select(STR_ZPAQ);
      archive_type:='zpaq';
      end
   else
      begin
      //if test_forceeditunsupported(s)=1 then
      //   begin
         case forcetype of
            1: archive_type_select(STR_7Z);
            2: archive_type_select(STR_TAR);
            3: archive_type_select(STR_WIM);
            else archive_type_select(STR_ZIP);
            end;
         if forceadd=true then FormPeach.ComboBox7zFun.ItemIndex:=1 else FormPeach.ComboBox7zFun.ItemIndex:=2;
         FormPeach.cbAct.Itemindex:=FormPeach.ComboBox7zFun.Itemindex;
      {   end
      else
         begin
         pMessageWarningOK(txt_add_error);
         tobrowser_fromarchiver;
         result:=false;
         exit;
         end;}
      end;
cutextension(s);
FormPeach.EditAddFilename.Text:=extractfilename(s);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
skipapstatus:=true;
showpanel('archive');
updatingarchive_inarchive:=true;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
autosize_stringgrid1;
FormPeach.SpeedButtonAdd.Enabled:=false;
FormPeach.pmbrowser.Enabled:=false;
FormPeach.mgobrowser.Enabled:=false;
FormPeach.ButtonOutAdd.Enabled:=false;
FormPeach.EditAddName.enabled:=false;
FormPeach.ButtonEditNameAdd.Enabled:=false;
setupdatecontrols(false);
FormPeach.LabelStatusArDetails.Caption:=status1;
FormPeach.LabelStatusAddUpdate.Caption:=txt_2_7_updating;
FormPeach.EditAddName.Caption:=FormPeach.editopenin.caption;
needwaitupdating:=true;
ares:=-1;
end;

procedure do_add;
var
   sz:qword;
begin
if check7zvolume(FormPeach.EditOpenIn.Caption)=true then exit;

if fun='FILEBROWSER' then
   begin
   FormPeach.CheckBoxSameArc.State:=cbUnchecked;
   FormPeach.CheckBoxSeparate.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.State:=cbUnchecked;
   FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
   FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   exit;
   end;

if (FormPeach.StringGridList.RowCount>1) then
   //if (FormPeach.StringGridList.Cells[1,1]<>'') then //check for adding to valid archives only
      begin
      if fun='UN7Z' then addtoarchive_inarchive(true);
      if fun='UNARC' then addtoarchive_inarchive(true);
      if fun='UNZPAQ' then addtoarchive_inarchive(true);
      exit;
      end;

{if fun='UN7Z' then //empty file
   begin
   if archiveisempty(FormPeach.EditOpenIn.Caption)=true then
      begin
      addtoarchive_inarchive(true);
      exit;
      end;
   end;}

end;

procedure archive_convert;//convert and load custom settings
var
   s:ansistring;
begin
if check7zvolume(FormPeach.EditOpenIn.Caption)=true then exit;
if fun='FILEBROWSER' then
   begin
   FormPeach.CheckBoxSameArc.State:=cbUnchecked;
   FormPeach.CheckBoxSeparate.State:=cbChecked;
   FormPeach.CheckBoxConvert.State:=cbChecked;
   FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
   FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   on_checkboxseparateclick;
   end
else
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   {s:=FormPeach.EditOpenIn.Text;
   if s<>'' then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   s:=extractfilepath(s);}
   FormPeach.EditUn7zaFilter.Text:='*';
   //listdir(s,false,false);
   //addtohistory;
   FormPeach.CheckBoxSameArc.State:=cbUnchecked;
   FormPeach.CheckBoxSeparate.State:=cbChecked;
   FormPeach.CheckBoxConvert.State:=cbChecked;
   FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
   FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
   //addtoarchive_selected;
   on_checkboxseparateclick;
   end;
end;

function build_path(s:ansistring):integer; //try to build the output path if it does not exists
begin
build_path:=-1;
if forcedirectories(s)=false then
   if control_outpath(s)<>0 then exit;
build_path:=0;
end;

procedure getmultiname(var s,in_param:ansistring);
var
   r:TSearchRec;
   s_ext,sh_ext,s_name,sh_name,s_path:ansistring;
   j,k,sh_len:integer;
begin
s_ext := lowercase(extractfileext(s));
s_name := extractfilename(s);
setlength(s_name, length(s_name) - length(s_ext));
s_path := extractfilepath(s);
in_param:=in_param+stringdelim(escapefilename(s,desk_env))+' ';//base filename
case s_ext of
'.001':  //multipart .xxx
   begin
   j:=1;
   repeat
      j := j + 1;
      if j < 10 then s_ext := '.00' + IntToStr(j)
      else
         if j < 100 then s_ext := '.0' + IntToStr(j)
         else s_ext := '.' + IntToStr(j);
      k := FindFirst(s_path + s_name + s_ext, faAnyFile, r);
      if k = 0 then
         in_param:=in_param+stringdelim(escapefilename(s_path + s_name + s_ext,desk_env))+' ';
      FindClose(r);
   until k <> 0;
   end;
'.zip':
   begin
   s_ext:='.z01';
   j:=0;
   if FindFirst(s_path + s_name + s_ext, faAnyFile, r)=0 then //multipart zip .zxx
      repeat
         j := j + 1;
         if j < 10 then s_ext := '.z0' + IntToStr(j)
         else s_ext := '.z' + IntToStr(j);
         k := FindFirst(s_path + s_name + s_ext, faAnyFile, r);
         if k = 0 then
            in_param:=in_param+stringdelim(escapefilename(s_path + s_name + s_ext,desk_env))+' ';
         FindClose(r);
      until k <> 0;
   end;
'.zipx':
   begin
   s_ext:='.zx01';
   j:=0;
   if FindFirst(s_path + s_name + s_ext, faAnyFile, r)=0 then //multipart zipx .zxyy
      repeat
         j := j + 1;
         if j < 10 then s_ext := '.zx0' + IntToStr(j)
         else s_ext := '.zx' + IntToStr(j);
         k := FindFirst(s_path + s_name + s_ext, faAnyFile, r);
         if k = 0 then
            in_param:=in_param+stringdelim(escapefilename(s_path + s_name + s_ext,desk_env))+' ';
         FindClose(r);
      until k <> 0;
   end;
'.rar':
   begin
   s_ext:='.r00';
   if FindFirst(s_path + s_name + s_ext, faAnyFile, r)=0 then //legacy multipart mgotypeRAR .rxx
      begin
      j:=-1;
      repeat
         j := j + 1;
         if j < 10 then s_ext := '.r0' + IntToStr(j)
         else s_ext := '.r' + IntToStr(j);
         k := FindFirst(s_path + s_name + s_ext, faAnyFile, r);
         if k = 0 then
            in_param:=in_param+stringdelim(escapefilename(s_path + s_name + s_ext,desk_env))+' ';
         FindClose(r);
      until k <> 0;
      s_ext:='.s00';
      j:=-1;
      repeat
         j := j + 1;
         if j < 10 then s_ext := '.s0' + IntToStr(j)
         else s_ext := '.s' + IntToStr(j);
         k := FindFirst(s_path + s_name + s_ext, faAnyFile, r);
         if k = 0 then
            in_param:=in_param+stringdelim(escapefilename(s_path + s_name + s_ext,desk_env))+' ';
         FindClose(r);
      until k <> 0;
      s_ext:='.t00';
      j:=-1;
      repeat
         j := j + 1;
         if j < 10 then s_ext := '.t0' + IntToStr(j)
         else s_ext := '.t' + IntToStr(j);
         k := FindFirst(s_path + s_name + s_ext, faAnyFile, r);
         if k = 0 then
            in_param:=in_param+stringdelim(escapefilename(s_path + s_name + s_ext,desk_env))+' ';
         FindClose(r);
      until k <> 0;
      //continue with u, v, w, etc; umpractical to pass as separate parameters on a single cl, as cl size quickly becomes larger than allowed for most systems
      end
   else
      begin
      s_ext:='.rar';
      j:=0;
      if pos('.part',lowercase(extractfileext(s_name)))<>0 then //multipart mgotypeRAR .partx.rar
         begin
         sh_ext:=lowercase(extractfileext(s_name));
         sh_len:=length(sh_ext)-5;
         sh_name:=s_name;
         setlength(sh_name, length(s_name) - length(sh_ext));
         repeat
            j := j + 1;
            sh_ext:='.part'+IntToStr(j).PadLeft(sh_len,'0');
            k := FindFirst(s_path + sh_name + sh_ext + s_ext, faAnyFile, r);
            if k = 0 then
               in_param:=in_param+stringdelim(escapefilename(s_path + sh_name + sh_ext + s_ext,desk_env))+' ';
            FindClose(r);
         until k <> 0;
         end;
      end;
   end;
'.pea':
   begin
   if pos('.000001',lowercase(extractfileext(s_name)))<>0 then //multipart pea .000001.pea
      begin
      j:=0;
      sh_name:=s_name;
      setlength(sh_name, length(s_name) - 7);
      repeat
         j := j + 1;
         sh_ext:='.'+IntToStr(j).PadLeft(6,'0');
         k := FindFirst(s_path + sh_name + sh_ext + s_ext, faAnyFile, r);
         if k = 0 then
            in_param:=in_param+stringdelim(escapefilename(s_path + sh_name + sh_ext + s_ext,desk_env))+' ';
         FindClose(r);
      until k <> 0;
      end;
   end;
end;
end;

function checklistextract(var nsel:integer; var strsel:ansistring):integer; //number of extracted objects, and formatted string with first 5 names
var
   rc,i:integer;
   s,s_ext:ansistring;
begin
checklistextract:=-1;
if FormPeach.StringGridExtract.Rowcount<2 then exit;
if FormPeach.StringGridExtract.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=FormPeach.StringGridExtract.Rowcount;
for i:=1 to rc-1 do
      begin
      nsel:=nsel+1;
      s:=FormPeach.StringGridExtract.Cells[1,i];
      s_ext := extractfileext(s);
      if s_ext = '.001' then s:=s+'/xxx';
      case nsel of
         1: strsel:=strsel+s+char($0D)+char($0A);
         2: strsel:=strsel+s+char($0D)+char($0A);
         3: strsel:=strsel+s+char($0D)+char($0A);
         4: strsel:=strsel+s+char($0D)+char($0A);
         5: strsel:=strsel+s+char($0D)+char($0A);
         6: strsel:=strsel+'...';
         end;
      end;
if length(strsel)>2 then
   if strsel[length(strsel)]=char($0A) then
      setlength(strsel,length(strsel)-2);
if nsel>0 then checklistextract:=0;
end;

procedure extraction_checkintermediatedir(var outname:ansistring; optype:ansistring);//needs waiting the extraction to complete
var
   oname,moutname,tmpoutname,rname,tmponame,uoutname,sf:ansistring;
begin
moutname:='';
if (btfun='unzpaq') and (zpaqabsolute=1) then exit;//moving to parent folder does not apply to this case (currently also will not open abs path anyway)
if setsequenceerror=0 then
begin
if (btfun='unquad') or (btfun='unbalz') or (btfun='unbcm') or (btfun='unbrotli') or (btfun='unzstd') or (btfun='unlpaq') then
   if (not(checkdirexists(outname))) and (fileexists(outname)) then outname:=extractfilepath(outname);
case optype of
'convert':
//if removeintdir=1 then force removal of redundant dir level for archive conversion
   if FormPeach.CheckBoxFolder.state=cbChecked then
      // check if the new folder contains a single output folder
      if checksingle_intdir(outname,oname)= true then
         begin
         // move content to parent output folder, remove intermediate folder if content is successfully moved
         tmponame:=STR_TMP+'dir'+inttohex(random(16000000),6);
         renamefile(outname+oname+directoryseparator, outname+tmponame+directoryseparator);
         movecontent_todir(outname+tmponame+directoryseparator,outname,1);
         end;
'extract':
   begin
   if removeintdir=1 then
   if (FormPeach.CheckBoxFolder.state=cbChecked) or (btfun='unzpaq') then
      // check if the new folder contains a single object
      begin
      if (FormPeach.CheckBoxrelative.Checked=true) and
         (FormPeach.CheckBoxrelative.enabled=true) and
         (FormPeach.CheckBoxFolder.Checked=false) and
         (pos(STR_TMPEXT,outname)<>0) then
         moutname:=extractfilepath(copy(outname,1,length(outname)-1))
      else
         moutname:=outname;
      if checksingle_obj(moutname,oname)= true then
         begin
         rname:=extractfiledir(copy(moutname,1,length(moutname)-1))+directoryseparator;
         tmpoutname:=rname+STR_TMP+'dir'+inttohex(random(16000000),6)+directoryseparator;
         renamefile(moutname, tmpoutname);
         if movecontent_todir(tmpoutname,rname,1)<>0 then
            begin
            renamefile(tmpoutname, moutname);
            end;
         end;
      {$IFDEF MSWINDOWS}
      uoutname:=extractfiledir(copy(moutname,1,length(moutname)-1))+directoryseparator;
      SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(uoutname),nil);
      {$ENDIF}
      end;
   end;
end;
end;
origoutmf:=moutname;
if autoopen=1 then
   if optype='extract' then //only for extraction events
      begin
      if checkdirexists(origout) then
         sf:=origout
      else
         sf:=extractfiledir(copy(origout,1,length(origout)-1))+directoryseparator;
      if checkdirexists(origoutnf) then sf:=origoutnf; //new folder
      if checkdirexists(origoutmf) then sf:=origoutmf; //moved folder
      UnitGwrap.explore_out(sf);
      {$IFDEF MSWINDOWS}
      SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(sf),nil);
      {$ENDIF}
      end;
end;

function checkaltdest(outname:ansistring):ansistring;
var
   taltdest:ansistring;
begin
result:='';
if forcenotwillbemoved=true then exit;
if (FormPeach.ComboBoxActionExtract.ItemIndex<2) and //extraction operations
   (FormPeach.CheckBoxrelative.checked=true) and//extract then move to relative paths
   (FormPeach.CheckBoxrelative.enabled=true) and
   (FormPeach.CheckBoxFolder.Checked=false) and
   (willbemoved=true) then
   if move_out_param<>'' then
      result:=move_out_param
   else
      begin
      taltdest:=outname;
      if taltdest[length(taltdest)]=DirectorySeparator then setlength(taltdest,length(taltdest)-1);
      taltdest:=extractfilepath(taltdest);
      result:=taltdest;
      end;
end;

procedure setaltdest(var outname, altdest:ansistring);
begin
altdest:=checkaltdest(outname);
end;

function nwmovecontent_todir(d1,d2:ansistring):integer;
var
   r: TSearchRec;
   namingconflicterror:integer;
   cl:AnsiString;
   P:TProcessUTF8;
begin
{$IFNDEF MSWINDOWS}
Result:=-1;
namingconflicterror:=0;
if (FindFirst(d1 + '*', faAnyFile, r) = 0) then
   try
      repeat
      if (r.Name <> '.') and (r.Name <> '..') then
         if FileExists(d2+r.name) or checkdirexists(d2+r.name) then
            begin
            namingconflicterror:=1;
            FindClose(r);
            break;
            end;
      until findnext(r) <> 0;
   except
      namingconflicterror:=1;
      FindClose(r);
   end;
FindClose(r);
if namingconflicterror=0 then //try rename (faster) instead of copy
   begin
   if movecontent_todir(d1,d2,0)=0 then
      begin
      Result:=0;
      exit;
      end
   else cl:='cp -p -r -f '+stringdelim(d1+'.')+' '+stringdelim(d2);
   end
else
   case pMessageNamingConflict(txt_7_8_destexistfile) of
      6: cl:='cp -p -r -f '+stringdelim(d1+'.')+' '+stringdelim(d2); //overwrite
      1: cl:='cp -p -r -u '+stringdelim(d1+'.')+' '+stringdelim(d2); //update (button is disabled on Darwin/macOS because its current implementation of cp does not support update switch)
      7: cl:='cp -p -r -n '+stringdelim(d1+'.')+' '+stringdelim(d2); //do not overwrite
      else exit; //cancel
      end;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];//workaround, ponewconsole is working properly with powaitonexit in Lazarus for Linux
peapexecute(P,cl);
P.Free;
Result:=0;
{$ENDIF}
end;

procedure moveafterextract(var outname:ansistring);
var
   relpath,altdest,outnameparent:ansistring;
begin
if forcenotwillbemoved=true then
   begin
   forcenotwillbemoved:=false;
   exit;
   end;

if (fileexists(peaziptmpdir+STR_TMPERRI)=true) then DeleteFile(peaziptmpdir+STR_TMPERRI)
else
if setsequenceerror<>0 then
   begin
   try
      setaltdest(outname,altdest);
      if (pos(STR_TMPEXT,outname)<>0) and (outname<>altdest) then
         begin
         cleardirsimple(outname);
         if FormPeach.CheckBoxFolder.State=cbChecked then
            begin
            outnameparent:=outname;
            if outnameparent[length(outnameparent)]=DirectorySeparator then setlength(outnameparent,length(outnameparent)-1);
            outnameparent:=extractfilepath(outnameparent);
            if checkempty_dir(outnameparent)=true then cleardirsimple(outnameparent);
            end;
         {$IFDEF MSWINDOWS}SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(altdest),nil);{$ENDIF}
         end;
   except
   end;
   willbemoved:=false;
   forcewillbemoved:=false;
   moverelpath:='';
   exit;
   end;

if (FormPeach.ComboBoxActionExtract.ItemIndex<2) and //extraction operations
   (FormPeach.CheckBoxrelative.checked=true) and //extract then move to relative paths
   (FormPeach.CheckBoxrelative.enabled=true) and
   (FormPeach.CheckBoxFolder.Checked=false) and
   (willbemoved=true) then//or (forcewillbemoved=true) then
   begin

   if moverelpath<>'' then relpath:=moverelpath
   else
      begin
      if (status0=txt_list_browsing) then
         begin
         relpath:=StringReplace(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row],':','_',[rfReplaceAll]);
         relpath:=extractfilepath(relpath);
         end
      else
         relpath:='';//in f6flat or search mode, use root
      if FormPeach.LabelGoExtract.Caption='' then relpath:=''; //for extract all use root
      if fun='FILEBROWSER' then relpath:=''; //for entire archives use root
      end;
   if moverelpath='*' then moverelpath:='';
   if relpath='*' then relpath:='';

   setaltdest(outname,altdest);

   {$IFDEF MSWINDOWS}
   if (pos(STR_TMPEXT,outname)<>0) and (outname<>altdest) then fileop_fromnamelist(outname+relpath+'*',altdest,1,0);
   {$ELSE}
   if (pos(STR_TMPEXT,outname)<>0) and (outname<>altdest) then nwmovecontent_todir(outname+relpath,altdest);
   {$ENDIF}
   try
      if (pos(STR_TMPEXT,outname)<>0) and (outname<>altdest) then cleardirsimple(outname);
      {$IFDEF MSWINDOWS}if tonewfolder=0 then SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(altdest),nil);{$ENDIF}
   except
   end;
   outname:=altdest;
   willbemoved:=false;
   forcewillbemoved:=false;
   moverelpath:='';
   end;
end;

procedure goextract;
var
   i,k,nsel,el:integer;
   isize,ksize:qword;
   cl,dummycl,jobcode,outname,strsel,s_in,s_ext,dummytitle:ansistring;
   goup:boolean;
begin
clearstopsequencefile;
setsequenceerror:=0;
UnitGwrap.perrors:=0;
psize:=0;
el:=0;
if check_extraction_input<>0 then exit;
   if length(FormPeach.EditOutExtract.Text)>16383 then
      begin
      FormPeach.EditOutExtract.Text:='';
      pMessageWarningOK(txt_3_1_pathexc);
      exit;
      end;
FormPeach.enabled:=false;
if fun='' then fun:='FILEBROWSER';
goup:=false;
if FormPeach.EditOutExtract.Text='' then
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
      FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
   else
      FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.EditOpenIn.Text);
if not(checkdirexists(FormPeach.EditOutExtract.Text)) then
   if build_path(FormPeach.EditOutExtract.Text)<>0 then
      begin
      FormPeach.enabled:=true;
      exit;
      end;

FormPeach.PanelProgressExtract.Color:=PGREEN;
FormPeach.PanelProgressExtract.Height:=pbarh;
FormPeach.PanelProgressExtract.Width:=0;
application.ProcessMessages;

if FormPeach.CheckBoxDeleteInputExt.Checked=true then needwaitupdating:=true; //need to execute jobs sequentially
if FormPeach.CheckBoxAutoHaltE.Checked=true then needwaitupdating:=true;

if removeintdir=1 then
   if FormPeach.CheckBoxFolder.state=cbChecked then needwaitupdating:=true;

try
FormPeach.visible:=False;
if fun='FILEBROWSER' then
   begin
   k:=FormPeach.StringGridExtract.RowCount;
   isize:=0;
   ksize:=0;
   for i:=1 to k-1 do ksize:=ksize+StrToInt64(FormPeach.StringGridExtract.Cells[12,i]);

   if k>2 then
      if FormPeach.CheckBoxParallelarchiving.State=cbUnChecked then needwaitupdating:=true; //execute jobs sequentially (wait job completion) if not requested elsewhere

   FormPeach.StringGridExtract.Row:=1;
   FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='1';
   for i:=1 to k-1 do
      begin
      FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='0';
      end;
   FormPeach.StringGridExtract.Repaint;
   dummytitle:=FormPeach.Caption;
   for i:=1 to k-1 do
      begin
      if checkstopsequencefile=true then
         begin
         clearstopsequencefile;
         break;
         end;
      try
      srcfilesize_multipart(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row],psize); //expressed in B
      except
      end;
      isize:=isize+strtoint64(FormPeach.StringGridExtract.Cells[12,FormPeach.StringGridExtract.Row]);
      if FormPeach.Width<>0 then UnitGwrap.pprogbarprev:=FormPeach.PanelProgressExtract.Width*FormGwrap.Width div FormPeach.Width;
      if ksize<>0 then FormPeach.PanelProgressExtract.Width:=(FormPeach.Width*(((isize*100)div ksize))) div 100;
      FormPeach.Caption:=dummytitle+' '+inttostr(i)+'/'+inttostr(k-1);
      application.ProcessMessages;
      if testencrypted_fromname(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row],'closed')=2 then
         begin
         el:=1;
         end
      else
         begin
         el:=extract_finalize_bytype(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row],'neutral',cl,jobcode,outname,extsel,true);
         if el=0 then launch_cl(cl,jobcode,outname);//'ext'
         end;
      fun:='FILEBROWSER';
      if i=k-1 then if stayopen=true then FormPeach.visible:=True;
      if el<>0 then
         begin
         FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='0';
         if FormPeach.StringGridExtract.Row<k then FormPeach.StringGridExtract.Row:=FormPeach.StringGridExtract.Row+1;
         FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='1';
         FormPeach.StringGridExtract.Repaint;
         continue;//exit; in case of error ignore the archive and move to the next one
         end;
      if i=k-1 then if stayopen=true then FormPeach.Enabled:=false;
      untarafter(outname,FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row],dummycl,true,'');
      if i=k-1 then if stayopen=true then FormPeach.Enabled:=true;
      moveafterextract(outname);
      extraction_checkintermediatedir(outname,'extract');
      FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='0';
      if FormPeach.StringGridExtract.Row<k then FormPeach.StringGridExtract.Row:=FormPeach.StringGridExtract.Row+1;
      FormPeach.StringGridExtract.Cells[11,FormPeach.StringGridExtract.Row]:='1';
      FormPeach.StringGridExtract.Repaint;
      if needwaitupdating=false then sleep(random(500)); //let some time between operations if launched in parallel
      end;
   FormPeach.Caption:=dummytitle;
   end
else
   begin
   FormPeach.PanelProgressExtract.Width:=(FormPeach.Width*50) div 100;
   application.ProcessMessages;
   //test if the file seem encrypted
   if (fun='UNARC') or (fun='UN7Z') then
      if testencrypted=0 then
         begin
         el:=extract_finalize_bytype(FormPeach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,true);
         if el=0 then launch_cl(cl,jobcode,outname);//'ext'
         end
      else
         begin
         if stayopen=false then exit_withsave
         else
            begin
            FormPeach.enabled:=true;
            tobrowser_fromextractor;
            exit;
            end;;
         end
   else
      begin
      el:=extract_finalize_bytype(FormPeach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,true);
      if el=0 then launch_cl(cl,jobcode,outname);//'ext'
      end;
   if stayopen=true then FormPeach.visible:=True;
   if el<>0 then exit;
   FormPeach.Enabled:=false;
   untarafter(outname,FormPeach.EditOpenIn.Text,dummycl,true,'');
   FormPeach.Enabled:=true;
   moveafterextract(outname);
   extraction_checkintermediatedir(outname,'extract');
   end;
finally
  if stayopen=true then FormPeach.visible:=True;
end;

FormPeach.PanelProgressExtract.Width:=FormPeach.Width;
application.ProcessMessages;

if FormPeach.CheckBoxDeleteInputExt.Checked=true then
if FormPeach.ComboBoxActionExtract.ItemIndex<2 then
   if fun='FILEBROWSER' then
   begin
   checklistextract(nsel, strsel);
   if (setsequenceerror<>0) or (UnitGwrap.perrors>0) then
      dosequerrmsg
   else
      if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletearchivesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 FormPeach.cbDeleteInputModeExt.Caption+' '+inttostr(nsel)+' '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromextraction(3,1,dummycl);
         1: erase_fromextraction(0,1,dummycl);
         2: erase_fromextraction(2,1,dummycl);
         3: erase_fromextraction(1,1,dummycl);
         end;
      {$ELSE}
      {$IFDEF DARWIN}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromextraction(3,1,dummycl);
         1: erase_fromextraction(0,1,dummycl);
         2: erase_fromextraction(2,1,dummycl);
         3: erase_fromextraction(1,1,dummycl);
         end;
      {$ELSE}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromextraction(0,1,dummycl);
         1: erase_fromextraction(2,1,dummycl);
         2: erase_fromextraction(1,1,dummycl);
         end;
      {$ENDIF}
      {$ENDIF}
      end;
   end
   else
   if FormPeach.LabelGoExtract.Caption='' then //on extractall
      begin
      s_in:=FormPeach.EditOpenIn.Text;
      s_ext := extractfileext(s_in);
      s_in := extractfilename(s_in);
      if s_ext = '.001' then s_in:=s_in+'/xxx';
      if (setsequenceerror<>0) or (UnitGwrap.perrors>0) then
         dosequerrmsg
      else
         if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletearchivesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 FormPeach.cbDeleteInputModeExt.Caption+' 1 '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+s_in)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromextractarc(3,1,dummycl);
         1: erase_fromextractarc(0,1,dummycl);
         2: erase_fromextractarc(2,1,dummycl);
         3: erase_fromextractarc(1,1,dummycl);
         end;
      {$ELSE}
      {$IFDEF DARWIN}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromextractarc(3,1,dummycl);
         1: erase_fromextractarc(0,1,dummycl);
         2: erase_fromextractarc(2,1,dummycl);
         3: erase_fromextractarc(1,1,dummycl);
         end;
      {$ELSE}
      case FormPeach.cbDeleteInputModeExt.ItemIndex of
         0: erase_fromextractarc(0,1,dummycl);
         1: erase_fromextractarc(2,1,dummycl);
         2: erase_fromextractarc(1,1,dummycl);
         end;
      {$ENDIF}
      {$ENDIF}
      goup:=true;
      end;
      end;
psize:=0;
application.ProcessMessages;
lastoutpath:=FormPeach.EditOutExtract.Text;
lastextractionpath:=FormPeach.EditOutExtract.Text;
FormPeach.enabled:=true;
if closeonsingleextract=1 then
   if singleextract=true then stayopen:=false; //auto close if directly extracting from archive (without browsing the filesystem)
if ((stayopen=false) or (autoclosepeazip=1)) then exit_withsave
else tobrowser_fromextractor;
if goup=true then navgoup;
end;

procedure on_buttonextokclick;
begin
FormPeach.Enabled:=false;
endmultimode;
if checkfreespace<>0 then FormPeach.StringGridExtract.RowCount:=1;
if FormPeach.StringGridExtract.RowCount=1 then
   begin
   FormPeach.ComboBoxActionExtract.ItemIndex:=0; on_radiogroupactionchange;
   if stayopen=false then exit_withsave
   else tobrowser_fromextractor;
   end
else
   begin
   goextract;
   FormPeach.ComboBoxActionExtract.ItemIndex:=0; on_radiogroupactionchange;
   checkhaltsystem_fromE;
   end;
FormPeach.Enabled:=true;
end;

function set_extractto_path:integer;
begin
set_extractto_path:=-1;
FormPeach.SelectDirectoryDialog1.InitialDir:=local_desktop;
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      begin
      FormPeach.EditOutExtract.Text:=FormPeach.SelectDirectoryDialog1.FileName;
      if FormPeach.EditOutExtract.Text<>'' then
         if FormPeach.EditOutExtract.Text[length(FormPeach.EditOutExtract.Text)] <> directoryseparator then FormPeach.EditOutExtract.Text:=FormPeach.EditOutExtract.Text+directoryseparator;
      end
   else exit
else exit;
set_extractto_path:=0;
end;

function set_extractto_pathto(s:ansistring):integer;
begin
set_extractto_pathto:=-1;
FormPeach.EditOutExtract.Text:=s;
if FormPeach.EditOutExtract.Text<>'' then
   if FormPeach.EditOutExtract.Text[length(FormPeach.EditOutExtract.Text)] <> directoryseparator then FormPeach.EditOutExtract.Text:=FormPeach.EditOutExtract.Text+directoryseparator;
set_extractto_pathto:=0;
end;

procedure setstatus5;
begin
FormPeach.LabelGoExtract.Caption:=txt_ext_all;
FormPeach.CheckBoxDeleteInputExt.Enabled:=false;
FormPeach.cbDeleteInputModeExt.Enabled:=false;
FormPeach.CheckBoxDeleteInputExt.Hint:=txt_7_3_clickextall;
end;

procedure setextpopupmenu(menutype:ansistring);
begin
with FormPeach do
begin
case menutype of
   '1': begin
      marchname.Visible:=false;
      marchname.Caption:='';
      pmAddFile.Visible:=true;
      pmAddFolder.Visible:=true;
      pmFoldersmenu.Visible:=true;
      Separator19.Visible:=true;
      pmSearchAdd.Visible:=true;
      pmExploremenu.Visible:=true;
      Separator18.Visible:=true;
      //set default path set separately
      //pmadvanced menu set visible items
      //MenuItemEnumerate not visible for extraction
      pmLoadList.Visible:=true;
      pmsavelist.Visible:=true;
      menuitem3.Visible:=true;
      menuitem1.Visible:=true;
      menuitem93.Visible:=true;
      menuitem27.Visible:=true;
      menuitem5b.Visible:=true;
      MenuItemTools.Visible:=true;
      mmisc.Visible:=true;
      mwebs.Visible:=true;
      pmexplorepath.Visible:=true;
      {$IFDEF MSWINDOWS}mProperties.Visible:=true;{$ENDIF}
      end;
   '2': begin
      marchname.Visible:=true;
      marchname.Caption:=ExtractFileName(FormPeach.EditOpenIn.Text);
      pmAddFile.Visible:=false;
      pmAddFolder.Visible:=false;
      pmFoldersmenu.Visible:=false;
      Separator19.Visible:=false;
      pmSearchAdd.Visible:=false;
      pmExploremenu.Visible:=false;
      Separator18.Visible:=false;
      //set default path set separately
      //pmadvanced menu set visible items
      //MenuItemEnumerate not visible for extraction
      pmLoadList.Visible:=false;
      pmsavelist.Visible:=false;
      menuitem3.Visible:=false;
      menuitem1.Visible:=false;
      menuitem93.Visible:=false;
      menuitem27.Visible:=false;
      menuitem5b.Visible:=false;
      MenuItemTools.Visible:=false;
      mmisc.Visible:=false;
      mwebs.Visible:=false;
      pmexplorepath.Visible:=false;
      {$IFDEF MSWINDOWS}mProperties.Visible:=false;{$ENDIF}
      end;
end;
end
end;

procedure list_toextractor(act,modeofuse:ansistring);
var
   i,j,rc,c,d,k:integer;
   okfile,checksel,allselected:boolean;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound,mpsize:qword;
begin
FormPeach.LabelGoExtract.Caption:='';
FormPeach.CheckBoxDeleteInputExt.Enabled:=true;
FormPeach.cbDeleteInputModeExt.Enabled:=true;
FormPeach.CheckBoxDeleteInputExt.Hint:='';
resetminimizedlauncher;
extselall:=false;
if (FormPeach.EditOpenIn.Caption=FormPeach.EditOpenInInteractive.Caption) and //no display filters
   (FormAdvf.CheckBoxAdvFilters.State=cbUnchecked) then //no advanced filters
   begin
   if act='selected' then
      if checklistanysel<>0 then act:='displayed';
   if act='selected' then
      begin
      allselected:=true;
      rc:=FormPeach.StringGridList.RowCount;
      for i:=1 to rc-1 do
         if FormPeach.StringGridList.Cells[16,i]='0' then
            begin
            allselected:=false;
            Break;
            end;
      if allselected=true then act:='displayed';
      end;
   if act='displayed' then
      if FormPeach.EditUn7zaFilterInteractive.Caption='*' then act:='all';
   end;
case act of
   'multi' :
   begin
   extsel:='all';
   setextpopupmenu('1');
   FormPeach.StringGridExtract.Hint:=txt_2_7_exthint;
   FormPeach.LabelStatusExtract.Caption:=txt_2_7_ext;
   FormPeach.LabelStatusExDetails.Hint:='';
   rc:=FormPeach.StringGridList.RowCount;
   k:=FormPeach.StringGridExtract.RowCount;
   for i:=1 to rc-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         if FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //files
            begin
            test_extfile(FormPeach.StringGridList.Cells[12,i],okfile);
            if okfile=true then
               begin
               if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
               FormPeach.StringGridExtract.RowCount:=k+1;
               for c:=1 to 13 do
                 begin
                 if c<6 then d:=c else d:=c+3;
                 if d>=9 then d:=d+1;
                 FormPeach.StringGridExtract.Cells[c,k]:=FormPeach.StringGridList.Cells[d,i];
                 end;
               FormPeach.StringGridExtract.Cells[12,k]:=FormPeach.StringGridList.Cells[3,i];
               if fun='FILEBROWSER' then //get correct size for multipart archives
                  begin
                  srcfilesize_multipart(FormPeach.StringGridList.Cells[12,i],mpsize);
                  FormPeach.StringGridExtract.Cells[12,k]:=IntToStr(mpsize);
                  end;
               FormPeach.StringGridExtract.Cells[3,k]:=nicenumber(FormPeach.StringGridExtract.Cells[12,k],filesizebase);
               if FormPeach.StringGridExtract.Cells[4,k]<>'' then FormPeach.StringGridExtract.Cells[4,k]:=nicenumber(FormPeach.StringGridExtract.Cells[4,k],filesizebase);
               k:=k+1;
               end;
            end
         else //folders (expand recursively)
            begin
            expand(FormPeach.StringGridList.Cells[12,i],exp_files,exp_fsizes,exp_ftimes,exp_fattr,exp_fattr_dec,nfound);
            for j:=0 to nfound-1 do
               if pos('D',exp_fattr_dec[j])=0 then
                  begin
                  test_extfile(exp_files[j],okfile);
                  if okfile=true then
                     begin
                     if checkfiledirname(exp_files[j])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+exp_files[j]); exit; end;
                     FormPeach.StringGridExtract.RowCount:=k+1;
                     FormPeach.StringGridExtract.Cells[8,k]:=exp_files[j];
                     FormPeach.StringGridExtract.Cells[1,k]:=extractfilename(exp_files[j]);
                     FormPeach.StringGridExtract.Cells[9,k]:=prefixf+FormPeach.StringGridExtract.Cells[1,k];
                     FormPeach.StringGridExtract.Cells[2,k]:=ExtractFileExt(exp_files[j]);
                     FormPeach.StringGridExtract.Cells[12,k]:=inttostr(exp_fsizes[j]);
                     if fun='FILEBROWSER' then //get correct size for multipart archives
                        begin
                        srcfilesize_multipart(exp_files[j],mpsize);
                        FormPeach.StringGridExtract.Cells[12,k]:=IntToStr(mpsize);
                        end;
                     FormPeach.StringGridExtract.Cells[3,k]:=nicenumber(FormPeach.StringGridExtract.Cells[12,k],filesizebase);
                     if testext((exp_files[j]))>=0 then
                        if (testext((exp_files[j]))>=500) and (testext((exp_files[j]))<=503) then
                           FormPeach.StringGridExtract.Cells[4,k]:='.'
                        else
                            FormPeach.StringGridExtract.Cells[4,k]:='+';
                     FormPeach.StringGridExtract.Cells[5,k]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(exp_ftimes[j]));
                     FormPeach.StringGridExtract.Cells[6,k]:=exp_fattr_dec[j];
                     FormPeach.StringGridExtract.Cells[10,k]:=inttostr(length(inttostr(length(FormPeach.StringGridExtract.Cells[3,k]))))+inttostr(length(FormPeach.StringGridExtract.Cells[3,k]))+FormPeach.StringGridExtract.Cells[3,k];
                     FormPeach.StringGridExtract.Cells[11,k]:=FormPeach.StringGridExtract.Cells[4,k];
                     k:=k+1;
                     end;
                  end;
            end;
   FormPeach.StringGridExtract.RowCount:=k;
   updatecontent_ext;
   end;
   'none' :
   begin
   extsel:='all';
   FormPeach.StringGridExtract.popupmenu:=FormPeach.popuplayout;
   FormPeach.StringGridExtract.Hint:=txt_2_7_exthint;
   FormPeach.LabelStatusExtract.Caption:=txt_2_7_ext;
   FormPeach.LabelStatusExDetails.Hint:='';
   updatecontent_ext;
   end;
   'all' :
   begin
   extsel:=act;
   extselall:=true;
   setextpopupmenu('2');
   FormPeach.StringGridExtract.Hint:='';
   FormPeach.LabelStatusExtract.Caption:=txt_2_7_extfrom+' '+FormPeach.EditOpenIn.Text;
   FormPeach.LabelStatusExDetails.Hint:='';
   FormPeach.StringGridExtract.RowCount:=1;//clean previous records
   FormPeach.StringGridExtract.RowCount:=2;
   FormPeach.StringGridExtract.Cells[1,1]:='('+txt_all+')';
   autosize_stringgrid2;
   updatecontent_ext;
   end;
   'displayed' :
   begin
   setstatus5;
   extsel:=act;
   setextpopupmenu('2');
   FormPeach.StringGridExtract.Hint:='';
   FormPeach.LabelStatusExtract.Caption:=txt_2_7_extfrom+' '+FormPeach.EditOpenIn.Text;
   FormPeach.LabelStatusExDetails.Hint:=txt_2_7_dirsize;
   rc:=FormPeach.StringGridList.RowCount;
   FormPeach.StringGridExtract.RowCount:=rc;
   k:=1;
   for i:=1 to rc-1 do
      begin
      if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
      FormPeach.StringGridExtract.RowCount:=k+1;
      for c:=1 to 13 do
        begin
        if c<6 then d:=c else d:=c+3;
        if d>=9 then d:=d+1;
        FormPeach.StringGridExtract.Cells[c,k]:=FormPeach.StringGridList.Cells[d,i];
        end;
      FormPeach.StringGridExtract.Cells[12,k]:=FormPeach.StringGridList.Cells[3,i];
      FormPeach.StringGridExtract.Cells[3,k]:=nicenumber(FormPeach.StringGridExtract.Cells[12,k],filesizebase);
      if FormPeach.StringGridExtract.Cells[4,k]<>'' then FormPeach.StringGridExtract.Cells[4,k]:=nicenumber(FormPeach.StringGridExtract.Cells[4,k],filesizebase);
      k:=k+1;
      end;
   FormPeach.StringGridExtract.RowCount:=k;
   updatecontent_ext;
   end;
   'selected' :
   begin
   setstatus5;
   extsel:=act;
   checksel:=false;
   setextpopupmenu('2');
   FormPeach.StringGridExtract.Hint:='';
   FormPeach.LabelStatusExtract.Caption:=txt_2_7_extfrom+' '+FormPeach.EditOpenIn.Text;
   FormPeach.LabelStatusExDetails.Hint:=txt_2_7_dirsize;
   rc:=FormPeach.StringGridList.RowCount;
   FormPeach.StringGridExtract.RowCount:=rc;
   k:=1;
   for i:=1 to rc-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
         FormPeach.StringGridExtract.RowCount:=k+1;
         for c:=1 to 13 do
            begin
            if c<6 then d:=c else d:=c+3;
            if d>=9 then d:=d+1;
            FormPeach.StringGridExtract.Cells[c,k]:=FormPeach.StringGridList.Cells[d,i];
            end;
         FormPeach.StringGridExtract.Cells[12,k]:=FormPeach.StringGridList.Cells[3,i];
         FormPeach.StringGridExtract.Cells[3,k]:=nicenumber(FormPeach.StringGridExtract.Cells[12,k],filesizebase);
         if FormPeach.StringGridExtract.Cells[4,k]<>'' then FormPeach.StringGridExtract.Cells[4,k]:=nicenumber(FormPeach.StringGridExtract.Cells[4,k],filesizebase);
         k:=k+1;
         checksel:=true;
         end;
   FormPeach.StringGridExtract.RowCount:=k;
   updatecontent_ext;
   if checksel=false then exit;
   end;
   end;
if FormPeach.StringGridExtract.RowCount>1 then
   begin
   FormPeach.StringGridExtract.Cells[11,1]:='1';
   FormPeach.StringGridExtract.Row:=1;
   end;
if modeofuse='full' then showpanel('extract');
end;

procedure do_extract;
begin
if prevpanel<>'open' then exit;
if FormPeach.StringGridList.RowCount<2 then exit;
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if FormPeach.StringGridList.Cells[1,1]='' then
   begin
   if fun='FILEBROWSER' then
      list_toextractor('none','full')
   else
      if intpw=1 then list_toextractor('all','full');
   exit;
   end;
if fun='FILEBROWSER' then list_toextractor('multi','full')
else
   if FormPeach.menuitemopen_extracthere.visible=false then list_toextractor('all','full') //if partial extraction is not supported, the selection is automatically overridden
   else
      if checklistanysel=0 then list_toextractor('selected','full')
      else list_toextractor('displayed','full'); //as in WinRar/7-Zip, if nothing is selected extract all currently displayed content
end;

procedure set_arcout;
var
   s:ansistring;
begin
with FormPeach do
begin
if mdefaultarchive.checked=false then
   begin
   if EditAddFilepath.Text='' then FormPeach.SelectDirectoryDialog1.InitialDir:=local_desktop
   else FormPeach.SelectDirectoryDialog1.InitialDir:=EditAddFilepath.Text;
   if SelectDirectoryDialog1.Execute then
      if SelectDirectoryDialog1.FileName<>'' then
         begin
         EditAddFilepath.Text:=SelectDirectoryDialog1.FileName;
         if EditAddFilepath.Text<>'' then
           if EditAddFilepath.Text[length(EditAddFilepath.Text)]<>directoryseparator then EditAddFilepath.Text:=EditAddFilepath.Text+directoryseparator;
         defaultarchivepath:=EditAddFilepath.Text;
         mdefaultarchive.checked:=true;
         mdefaultarchive.caption:=txt_archive+' > '+txt_2_8_usedefaultoutpath+' '+defaultarchivepath;
         suggest_outname(s,FormPeach.cbType.Text,0);
         FormPeach.EditAddFilepath.Text:=defaultarchivepath;
         FormPeach.EditAddFilename.Text:=extractfilename(s);
         FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
         end;
   end
else
   begin
   defaultarchivepath:='';
   mdefaultarchive.checked:=false;
   mdefaultarchive.caption:=txt_archive+' > '+txt_7_6_setdef;
   suggest_outname(s,FormPeach.cbType.Text,0);
   FormPeach.EditAddFilepath.Text:=extractfilepath(s);
   FormPeach.EditAddFilename.Text:=extractfilename(s);
   FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
   end;
lsetdefaultout_arc.caption:=mdefaultarchive.caption;
end;
end;

procedure set_arcout_current;
var
   s:ansistring;
begin
with FormPeach do
begin
if EditAddFilepath.Text='' then exit;
if EditAddFilepath.Text[length(EditAddFilepath.Text)]<>directoryseparator then EditAddFilepath.Text:=EditAddFilepath.Text+directoryseparator;
defaultarchivepath:=EditAddFilepath.Text;
mdefaultarchive.checked:=true;
mdefaultarchive.caption:=txt_archive+' > '+txt_2_8_usedefaultoutpath+' '+defaultarchivepath;
suggest_outname(s,FormPeach.cbType.Text,0);
FormPeach.EditAddFilepath.Text:=defaultarchivepath;
FormPeach.EditAddFilename.Text:=extractfilename(s);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
end;
end;

procedure set_extout;
begin
with FormPeach do
begin
if mdefaultextract.checked=false then
   begin
   if EditOutExtract.Text='' then FormPeach.SelectDirectoryDialog1.InitialDir:=local_desktop
   else FormPeach.SelectDirectoryDialog1.InitialDir:=EditOutExtract.Text;
   if SelectDirectoryDialog1.Execute then
      if SelectDirectoryDialog1.FileName<>'' then
         begin
         EditOutExtract.Text:=SelectDirectoryDialog1.FileName;
         if EditOutExtract.Text<>'' then
           if EditOutExtract.Text[length(EditOutExtract.Text)]<>directoryseparator then EditOutExtract.Text:=EditOutExtract.Text+directoryseparator;
         defaultextractpath:=EditOutExtract.Text;
         mdefaultextract.checked:=true;
         pmusedefault.checked:=true;
         mdefaultextract.caption:=txt_caption_extract+' > '+txt_2_8_usedefaultoutpath+' '+defaultextractpath;
         pmusedefault.caption:=txt_caption_extract+' > '+txt_2_8_usedefaultoutpath+' '+defaultextractpath;
         end;
   end
else
   begin
   defaultextractpath:='';
   mdefaultextract.checked:=false;
   pmusedefault.checked:=false;
   mdefaultextract.caption:=txt_caption_extract+' > '+txt_7_6_setdef;
   pmusedefault.caption:=txt_caption_extract+' > '+txt_7_6_setdef;
   end;
lsetdefaultout_ext.caption:=mdefaultextract.caption;
end;
end;

procedure set_extout_current;
begin
with FormPeach do
begin
if EditOutExtract.Text='' then exit;
if EditOutExtract.Text[length(EditOutExtract.Text)]<>directoryseparator then EditOutExtract.Text:=EditOutExtract.Text+directoryseparator;
defaultextractpath:=EditOutExtract.Text;
mdefaultextract.checked:=true;
pmusedefault.checked:=true;
mdefaultextract.caption:=txt_caption_extract+' > '+txt_2_8_usedefaultoutpath+' '+defaultextractpath;
pmusedefault.caption:=txt_caption_extract+' > '+txt_2_8_usedefaultoutpath+' '+defaultextractpath;
end;
end;

procedure doinfo;
begin
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('details')
else archive_funsel('details','all');
end;

procedure prev_hexpselected_list(previewfun,fname:ansistring);
var
   cl,in_param:ansistring;
   P:tprocessutf8;
begin
if checkfiledirname(FormPeach.EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.EditOpenIn.Text); exit; end;
if fname='*' then fname:=FormPeach.EditOpenIn.Text;
in_param:=stringdelim(escapefilename(fname,desk_env));
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' '+previewfun+' '+in_param;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
peapexecute(P,cl);
P.Free;
end;

procedure hexpselected_list(previewfun:ansistring);
var
   cl,in_param:ansistring;
   i:integer;
   P:tprocessutf8;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if fun<>'FILEBROWSER' then
   begin
   if (fun='UNPEA') or (fun='UNPAQ') or (fun='UNLPAQ') or (fun='UNACE') then //file manager preview not supported, apply to archive
      begin
      prev_hexpselected_list(previewfun,'*');
      end
   else
      begin
      if checklistanysel<>0 then //nothing selected, apply to archive
         prev_hexpselected_list(previewfun,'*')
      else
         if previewfun='HEXPREVIEW' then
            openwith_cust('preview','hexpselected',0)
         else
            openwith_cust('preview','hexpselected',1);
      end;
   exit;
   end;
if checklistanysel<>0 then exit;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      begin
      if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); exit; end;
      in_param:=stringdelim(escapefilename(FormPeach.StringGridList.Cells[12,i],desk_env));
      cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' '+previewfun+' '+in_param;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      peapexecute(P,cl);
      P.Free;
      end;
end;

procedure launchpjmulti(var s:ansistring);
var
   cl:ansistring;
   P:tprocessutf8;
   linedelim:ansistring;
begin
if s<>'' then
   if ord(s[length(s)])<>$0a then s:=s+char($0d)+char($0a);
{$IFDEF MSWINDOWS}
linedelim:=char($0d)+char($0a);
{$ELSE}
linedelim:=char($0a);
{$ENDIF}
repeat
if pos(linedelim,s)<>0 then
   begin
   cl:=copy(s,1,pos(linedelim,s));
   s:=copy(s,pos(linedelim,s)+2,length(s));
   end;
if length(cl)>3 then
   begin
   if ord(cl[length(cl)])=$0a then setlength(cl,length(cl)-2); //remove text feeds, which are illegal characters for the command line
   if ord(cl[length(cl)])=$0d then setlength(cl,length(cl)-1);
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit];
   peapexecute(P,cl);
   P.Free;
   end;
until length(s)<3;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection QUICK LAUNCH functions from file browser

///////////////////////////////////////////////////////////////////////////////}

function checkextinput:boolean;
var
   i,k,rc:integer;
   okfile:boolean;
begin
result:=false;
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
rc:=FormPeach.StringGridList.RowCount;
if rc=1 then exit;
if fun<>'FILEBROWSER' then
   begin
   result:=true;
   exit;//true if input is a valid archive
   end;
k:=0;
for i:=1 to rc-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      if FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //no folders
         begin
         test_extfile(FormPeach.StringGridList.Cells[12,i],okfile);
         if okfile=true then k:=k+1;
         end;
if k>0 then result:=true;
end;

function checkaddsepmenu:boolean;
var
   i,k,rc:integer;
   containfolder:boolean;
begin
result:=false;
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if fun<>'FILEBROWSER' then exit;
rc:=FormPeach.StringGridList.RowCount;
if rc=1 then exit;
k:=0;
for i:=1 to rc-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      begin
      k:=k+1;
      if k>1 then break;
      end;
if k>1 then result:=true else exit;
case FormPeach.cbType.Text of
   STR_GZIP, STR_BZIP2, STR_XZ,STR_QUAD,STR_BROTLI,STR_ZSTD: result:=false;
   STR_ZPAQ: if FormPeach.RadioGroupPaq.ItemIndex=0 then result:=false;
   end;
containfolder:=false;
if result=false then //allow single file input
   for i:=1 to rc-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then
            begin
            containfolder:=true;
            break;
            end;
if containfolder=false then result:=true;
end;

procedure do_extallto(sel:ansistring); //sel 'all', 'selected'
var s:ansistring;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then
   {$IFDEF MSWINDOWS}if FormPeach.PanelExtract.visible=false{$ELSE}if FormPeach.PanelExtract.top<>0{$ENDIF} then exit;
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then if checkextinput=false then exit;
if defaultextractpath='' then
   if length(lastoutpath)>1 then
      s:=ExtractFilePath(lastoutpath)
   {if length(FormPeach.EditOpenInInteractive.Caption)>1 then
      if FormPeach.EditOpenInInteractive.Caption[length(FormPeach.EditOpenInInteractive.Caption)] = directoryseparator then s:=FormPeach.EditOpenInInteractive.Caption
      else s:=extractfilepath(FormPeach.EditOpenInInteractive.Caption)}
   else s:=local_desktop
else s:=defaultextractpath;
if not(checkdirexists(s)) then s:=local_desktop;
FormPeach.SelectDirectoryDialog1.InitialDir:=s; //initial dir set to default extraction path, then last extraction path, then desktop
listingdir:=true; //temporarily stop updating file browser until file list is parsed (if a new dir is pmccreated from the dialog, the selection would be lost upon browser's update)
if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then
      begin
      lastoutpath:=FormPeach.SelectDirectoryDialog1.FileName;
      quickextract(FormPeach.SelectDirectoryDialog1.FileName,'*neutral',sel);
      end
   else begin end
else begin end;
listingdir:=false;
end;

procedure context_extall;
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then
   begin
   if fun='FILEBROWSER' then
      list_toextractor('none','full')
   else
      list_toextractor('all','full');
   exit;
   end;
if fun='FILEBROWSER' then list_toextractor('multi','full')
else list_toextractor('all','full');
end;

procedure context_extdisplayed;
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then
   begin
   if fun='FILEBROWSER' then
      list_toextractor('none','full');
   exit;
   end;
if fun='FILEBROWSER' then list_toextractor('multi','full')
else list_toextractor('displayed','full');
end;

procedure context_extselected;
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then
   begin
   if fun='FILEBROWSER' then
      list_toextractor('none','full');
   exit;
   end;
if fun='FILEBROWSER' then list_toextractor('multi','full')
else list_toextractor('selected','full');
end;

procedure extractdisplayedto;
var
   cl,jobcode,outname:ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if set_extractto_path<>0 then exit;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'neutral','displayed')=0 then launch_cl(cl,jobcode,outname); //'ext'
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'neutral','displayed')=0 then launch_cl(cl,jobcode,outname); //'ext'
end;

procedure extractselectedto;
var
   cl,jobcode,outname:ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if set_extractto_path<>0 then exit;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'neutral','selected')=0 then launch_cl(cl,jobcode,outname); //'ext'
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'neutral','selected')=0 then launch_cl(cl,jobcode,outname); //'ext'
end;

procedure do_join;
var
   fname:ansistring;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Row=0 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklistsel<>0 then exit;
if checkfiledirname(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]); exit; end;
fname:=FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row];
direct_join(fname);
end;

procedure quickextract(dest,fol,sel:ansistring);
var
   olddest,oldtitle:ansistring;
   tempextnew,tempextsmart,needresttemp:boolean;
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then
   {$IFDEF MSWINDOWS}if FormPeach.PanelExtract.visible=false{$ELSE}if FormPeach.PanelExtract.top<>0{$ENDIF} then exit;

{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then exit;
{$ENDIF}
if stayopen=true then
   begin
   if FormPeach.StringGridList.RowCount<2 then exit;
   if FormPeach.StringGridList.Cells[1,1]='' then exit;
   end;
mddtarget:='';
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then if checkextinput=false then exit;
olddest:=FormPeach.EditOutExtract.Text;
oldtitle:=FormPeach.Caption;

tempextnew:=FormPeach.pmqenewfolder.Checked;
tempextsmart:=FormPeach.pmqnointdir.Checked;
needresttemp:=false;

//folder policy, *neutral does not change defaults
if fol='*here' then
   begin
   needresttemp:=true;
   if FormPeach.pmqenewfolder.Checked=true then newextclick;
   if FormPeach.pmqnointdir.Checked=true then smartextclick;
   end;

if fol='*new' then
   begin
   needresttemp:=true;
   if FormPeach.pmqenewfolder.Checked=false then newextclick;
   if FormPeach.pmqnointdir.Checked=true then smartextclick;
   end;

if fol='*smart' then
   begin
   needresttemp:=true;
   if FormPeach.pmqenewfolder.Checked=false then newextclick;
   if FormPeach.pmqnointdir.Checked=false then smartextclick;
   end;

if dest='' then
   if (fun='FILEBROWSER') then FormPeach.EditOutExtract.Text:=FormPeach.EditOpenIn.Text
   else FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.EditOpenIn.Text)
else FormPeach.EditOutExtract.Text:=dest;
if FormPeach.EditOutExtract.Text<>'' then
   if FormPeach.EditOutExtract.Text[length(FormPeach.EditOutExtract.Text)] <> directoryseparator then FormPeach.EditOutExtract.Text:=FormPeach.EditOutExtract.Text+directoryseparator;
if dest<>'' then
   if dest[length(dest)] <> directoryseparator then dest:=dest+directoryseparator;

if fun='' then fun:='FILEBROWSER';

if fun='FILEBROWSER' then
   begin
   {$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=true{$ELSE}if FormPeach.PanelOpen.top=0{$ENDIF} then list_toextractor('multi','quick')
   else
   begin
      {$IFDEF MSWINDOWS}if FormPeach.PanelExtract.visible=true{$ELSE}if FormPeach.PanelExtract.top=0{$ENDIF} then
         begin
         goextract;
         lastoutpath:=dest;
         FormPeach.EditOutExtract.Text:=olddest;
         exit;
         end;
   end;
   end
else
   list_toextractor(sel,'quick');

goextract;
lastoutpath:=dest;
FormPeach.EditOutExtract.Text:=olddest;
FormPeach.Caption:=oldtitle;

if needresttemp=true then
   begin
   if FormPeach.pmqenewfolder.Checked<>tempextnew then newextclick;
   if FormPeach.pmqnointdir.Checked<>tempextsmart  then smartextclick;
   end;

end;

procedure checkcontextadd;
begin
if contextconvert_switch=true then archive_convert
else
   if fun='FILEBROWSER' then
      begin
      FormPeach.CheckBoxSameArc.State:=cbUnchecked;
      FormPeach.CheckBoxSeparate.State:=cbUnchecked;
      FormPeach.CheckBoxConvert.State:=cbUnchecked;
      FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
      FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
      addtoarchive_selected;
      end;
contextconvert_switch:=false;
end;

procedure do_split;
begin
checkcontextadd;
FormPeach.cbType.ItemIndex:=10;
archive_type_select(txt_split);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection DRAG TO APP

///////////////////////////////////////////////////////////////////////////////}

procedure drag_addtolayout(FileNames:array of string);
var
   i: integer;
   s: ansistring;
begin
s:=FormPeach.Caption;
for i := 0 to High(FileNames) do
   if testname(FileNames[i], FormPeach.StringGridAdd)=0 then
      begin
      FormPeach.Caption:=txt_2_4_adding+' '+FileNames[i];
      Application.ProcessMessages;
      deselectingrid(FormPeach.StringGridAdd);
      if (filegetattr(FileNames[i]) and faDirectory) <> 0 then addfolderstr(FormPeach.StringGridAdd,FileNames[i])
      else addfilestr(FormPeach.StringGridAdd,FileNames[i]);
      end;
FormPeach.StringGridAdd.AutoSizeColumns;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
FormPeach.Caption:=s;
application.ProcessMessages;
if enumd=1 then updatelayout('enum');
end;

procedure drag_addtolayoutext(FileNames:array of string);
var
   i,j: integer;
   s: ansistring;
   okfile:boolean;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound:qword;
begin
s:=FormPeach.Caption;
for i := 0 to High(FileNames) do
   begin
   if checkdirexists(FileNames[i]) then
      begin
      expand(FileNames[i],exp_files,exp_fsizes,exp_ftimes,exp_fattr,exp_fattr_dec,nfound);
      for j:=0 to nfound-1 do
         if pos('D',exp_fattr_dec[j])=0 then
            begin
            test_extfile(exp_files[j],okfile);
            if okfile=true then
               begin
               if checkfiledirname(exp_files[j])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+exp_files[j]); exit; end;
               deselectingrid(FormPeach.StringGridExtract);
               addfilestr(FormPeach.StringGridExtract,exp_files[j]);
               end;
            end;
      end
   else
      begin
      test_extfile(FileNames[i],okfile);
      if okfile=true then
         begin
         if checkfiledirname(FileNames[i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FileNames[i]); exit; end;
         FormPeach.Caption:=txt_2_4_adding+' '+FileNames[i];
         Application.ProcessMessages;
         deselectingrid(FormPeach.StringGridExtract);
         addfilestr(FormPeach.StringGridExtract,FileNames[i]);
         end;
      end;
   end;
updatecontent_ext;
FormPeach.Caption:=s;
end;

procedure setdragarchivename;
var
   s:ansistring;
begin
suggest_outname(s,FormPeach.cbType.Text,0);
if FormPeach.mdefaultarchive.Checked=true then FormPeach.EditAddFilepath.Text:=defaultarchivepath
else FormPeach.EditAddFilepath.Text:=extractfilepath(s);
FormPeach.EditAddFilename.Text:=extractfilename(s);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
end;

procedure TFormPeach.FormDropFiles(Sender: TObject;
  const FileNames: array of String);

procedure drag_addtoextlayout;
var
   i,j: integer;
   s: ansistring;
   okfile:boolean;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound:qword;
begin
if FormPeach.LabelStatusExtract.Caption<>txt_2_7_ext then exit;
s:=FormPeach.Caption;
for i := 0 to High(FileNames) do
   begin
   if checkdirexists(FileNames[i]) then
      begin
      expand(FileNames[i],exp_files,exp_fsizes,exp_ftimes,exp_fattr,exp_fattr_dec,nfound);
      for j:=0 to nfound-1 do
         if pos('D',exp_fattr_dec[j])=0 then
            begin
            test_extfile(exp_files[j],okfile);
            if okfile=true then
               begin
               if checkfiledirname(exp_files[j])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+exp_files[j]); exit; end;
               deselectingrid(FormPeach.StringGridExtract);
               addfilestr(FormPeach.StringGridExtract,exp_files[j]);
               end;
            end;
      end
   else
      begin
      test_extfile(FileNames[i],okfile);
      if okfile=true then
         begin
         if checkfiledirname(FileNames[i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+FileNames[i]); exit; end;
         FormPeach.Caption:=txt_2_4_adding+' '+FileNames[i];
         Application.ProcessMessages;
         deselectingrid(FormPeach.StringGridExtract);
         addfilestr(FormPeach.StringGridExtract,FileNames[i]);
         end;
      end;
   end;
updatecontent_ext;
FormPeach.Caption:=s;
end;

procedure drag_addtobookmarks;
var
   i: integer;
begin
for i := 0 to High(FileNames) do
   addtobookmarks(FileNames[i]);
end;

procedure drag_addtoarchive;
var
   dfn,s:ansistring;
   i:integer;
begin
if (status0<>txt_list_browsing) and (FormPeach.StringGridList.Cells[1,1]='') then exit;
addtoarchive_inarchive(true);
for i := 0 to High(FileNames) do
   begin
   dfn:=FileNames[i];
   if (filegetattr(dfn) and faDirectory) <> 0 then
      begin
      s:=FormPeach.Caption;
      if dfn<>'' then
         if testname(dfn, FormPeach.StringGridAdd)=0 then
            begin
            FormPeach.StringGridAdd.Cursor:=crHourGlass;
            FormPeach.Caption:=txt_2_4_adding+' '+dfn;
            Application.ProcessMessages;
            deselectingrid(FormPeach.StringGridAdd);
            addfolderstr(FormPeach.StringGridAdd,dfn);
            FormPeach.StringGridAdd.Cursor:=crDefault;
         end;
      FormPeach.Caption:=s;
      end
   else
      begin
      if dfn<>'' then
         begin
         FormPeach.StringGridAdd.Cursor:=crHourGlass;
         deselectingrid(FormPeach.StringGridAdd);
         if testname(dfn, FormPeach.StringGridAdd)=0 then
            begin
            //show names of items being added is not implemented here since adding files is very fast
            addfilestr(FormPeach.StringGridAdd,dfn);
            end;
         FormPeach.StringGridAdd.Cursor:=crDefault;
         end;
      end;
   end;
FormPeach.StringGridAdd.AutoSizeColumns;
updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
end;

function domenu:boolean;
begin
result:=false;
if (GetKeyShiftState=[ssShift]) then result:=true;
if (GetKeyShiftState=[ssCtrl]) then result:=true;
end;

var
   i:integer;
   lpPoint: TPoint;
begin
{$IFDEF MSWINDOWS}
if nativedrag=1 then
   if disdrag=true then exit;
{$ENDIF}
dfilenames:=@FileNames;
if FormPeach.visible=false then exit;
if (PanelArchive.Visible=true)  and (PanelArchive.Top<10000) then
   begin
   drag_addtolayout(FileNames);
   setdragarchivename;
   end;
if (PanelExtract.Visible=true)  and (PanelExtract.Top<10000) then
   begin
   drag_addtoextlayout;
   end;
if (PanelOpen.Visible=true)  and (PanelOpen.Top<10000) then
   begin
   lpPoint := SplitterBottom.ScreenToClient(Mouse.CursorPos);
   //drag to bookmarks
   if (lpPoint.y>0) and (stringgridbookmarks.visible=true) then
      begin
      if stringgridbookmarks.visible=false then showbar('bookmarks');
      drag_addtobookmarks;
      exit;
      end;
   //drag extract from peazip to another peazip instance: extract (if browsing archive, add into the archive)
   if pos(STR_TMPDD,filenames[0])<>0 then
         begin
         if fun='FILEBROWSER' then
            begin
            if domenu then pmsystoapp.popup()
            else
               begin
               mass_cp_copy_toapp(txt_cut);
               end;
            end
         else
            drag_addtoarchive;
         exit;
         end;
   //drag from peazip to another peazip instance: show menu consistently with internal drag and drop (if browsing archive, add into the archive)
   if FileExists(peaziptmpdir+'.pdd') then //some other peazip instance performing drag and drop
      begin
      if fun='FILEBROWSER' then
         pmsystoapp.popup()
      else
         drag_addtoarchive;
      exit;
      end;
   //drag from system to app
   if High(FileNames)=0 then
      begin //single item: check if it is suitable type to be opened, else add to archive (if browsing archive, add into the archive)
      {$IFDEF DARWIN}
      if darwinsimulatedrop=true then
         begin
         condopenaction(FileNames[0]);
         exit;
         end;
      {$ENDIF}
      i:=testext(FileNames[0]);
      if (i<0) //not a PeaZip supported filetype
         or (i=503)
         or (i=502)
         or (i=501) //file types usually not handled as archives
         or (i=500) //exe or msi Windows executable file
      then
         if fun='FILEBROWSER' then
            begin
            if domenu then pmsystoapp.popup()
            else
               begin
               showpanel('archive');
               FormPeach.CheckBoxSameArc.State:=cbUnchecked;
               FormPeach.CheckBoxSeparate.State:=cbUnchecked;
               drag_addtolayout(FileNames);
               setdragarchivename;
               end;
            end
         else
            drag_addtoarchive
      else
         if fun='FILEBROWSER' then
            begin
            if domenu then pmsystoapp.popup()
            else
               if (testinput(FileNames[0],true)>0) and (testinput(FileNames[0],true)<>1000) then
                  open_archive_fromname(FileNames[0])
               else
                  begin
                  showpanel('archive');
                  FormPeach.CheckBoxSameArc.State:=cbUnchecked;
                  FormPeach.CheckBoxSeparate.State:=cbUnchecked;
                  drag_addtolayout(FileNames);
                  setdragarchivename;
                  end;
            end
         else
            begin
            if (testinput(FileNames[0],true)>0) and (testinput(FileNames[0],true)<>1000) then
               case pMessageInfoYesNo(txt_dis+' '+txt_2_7_drag_archive) of //executed only when the form is visible
                  6: open_archive_fromname(FileNames[0]);
                  7: drag_addtoarchive;
               end
            else
               drag_addtoarchive;
            end;
      end
   else //multiple items: add to archive (if browsing archive, add into the archive)
      if fun='FILEBROWSER' then
         begin
         if domenu then pmsystoapp.popup()
         else
            begin
            showpanel('archive');
            FormPeach.CheckBoxSameArc.State:=cbUnchecked;
            FormPeach.CheckBoxSeparate.State:=cbUnchecked;
            drag_addtolayout(FileNames);
            setdragarchivename;
            end;
         end
      else
         drag_addtoarchive;
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection COPY copy/cut and paste routines

///////////////////////////////////////////////////////////////////////////////}

procedure update_clipboard;
var
   i:integer;
begin
FormPeach.StringGridClipboard.Rowcount:=length(clipcontent)+1;
for i:=0 to length(clipcontent)-1 do
   begin
   FormPeach.StringGridClipboard.Cells[0,i+1]:=clipcontent[i,3];
   FormPeach.StringGridClipboard.Cells[1,i+1]:=clipcontent[i,1];
   FormPeach.StringGridClipboard.Cells[2,i+1]:=clipcontent[i,2];
   FormPeach.StringGridClipboard.Cells[3,i+1]:=clipcontent[i,0];
   FormPeach.StringGridClipboard.Cells[4,i+1]:=clipcontent[i,4];
   FormPeach.StringGridClipboard.Cells[5,i+1]:=clipcontent[i,5];
   FormPeach.StringGridClipboard.Cells[6,i+1]:=clipcontent[i,6];
   end;
FormPeach.StringGridClipboard.AutosizeColumns;
end;

function test_clip(s:ansistring):integer;
var
   i:integer;
begin
test_clip:=0;
for i:=0 to length(clipcontent)-1 do
   begin
   if clipcontent[i,0]=s then
      begin
      test_clip:=1;
      exit;
      end;
   end;
end;

procedure list_copy;
var
   i,k:integer;
begin
   if (fun='FILEBROWSER') or (fun='UN7Z') then
      begin
      {$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
      if filecopying=true then
         begin
         pMessageInfoOK(txt_copy_wait);
         exit;
         end;
      prev_destdir:='';
      if clipmode=0 then setlength(clipcontent,0);
      k:=length(clipcontent);
      for i:=1 to FormPeach.StringGridList.RowCount-1 do
         if FormPeach.StringGridList.Cells[16,i]='1' then
            begin
            if clipmode=1 then
               if test_clip(FormPeach.StringGridList.Cells[12,i])=1 then
               else
                  begin
                  FormPeach.StringGridList.Cells[0,i]:='';
                  setlength(clipcontent,length(clipcontent)+1);
                  clipcontent[k,0]:=FormPeach.StringGridList.Cells[12,i];
                  clipcontent[k,1]:=FormPeach.StringGridList.Cells[1,i];
                  clipcontent[k,2]:=FormPeach.StringGridList.Cells[2,i];
                  if fun='UN7Z' then clipcontent[k,3]:=txt_caption_extract
                  else clipcontent[k,3]:=txt_copy;
                  if fun='UN7Z' then clipcontent[k,4]:=FormPeach.EditOpenIn.Caption
                  else clipcontent[k,4]:=txt_fs;
                  clipcontent[k,5]:=FormPeach.StringGridList.Cells[3,i];
                  clipcontent[k,6]:=FormPeach.StringGridList.Cells[5,i];
                  k:=k+1;
                  end
            else
               begin
               FormPeach.StringGridList.Cells[0,i]:='';
               setlength(clipcontent,length(clipcontent)+1);
               clipcontent[k,0]:=FormPeach.StringGridList.Cells[12,i];
               clipcontent[k,1]:=FormPeach.StringGridList.Cells[1,i];
               clipcontent[k,2]:=FormPeach.StringGridList.Cells[2,i];
               if fun='UN7Z' then clipcontent[k,3]:=txt_caption_extract
               else clipcontent[k,3]:=txt_copy;
               if fun='UN7Z' then clipcontent[k,4]:=FormPeach.EditOpenIn.Caption
               else clipcontent[k,4]:=txt_fs;
               clipcontent[k,5]:=FormPeach.StringGridList.Cells[3,i];
               clipcontent[k,6]:=FormPeach.StringGridList.Cells[5,i];
               k:=k+1;
               end;
            end
         else FormPeach.StringGridList.Cells[0,i]:='';
      update_clipboard;
      update_listview_sel;
      end;
end;

procedure list_cut;
var
   i,k:integer;
begin
   if fun='FILEBROWSER' then
      begin
      {$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
      if filecopying=true then
         begin
         pMessageInfoOK(txt_copy_wait);
         exit;
         end;
      prev_destdir:='';
      if clipmode=0 then setlength(clipcontent,0);
      k:=length(clipcontent);
      for i:=1 to FormPeach.StringGridList.RowCount-1 do
         if FormPeach.StringGridList.Cells[16,i]='1' then
            begin
            if clipmode=1 then
               if test_clip(FormPeach.StringGridList.Cells[12,i])=1 then
               else
                  begin
                  FormPeach.StringGridList.Cells[0,i]:=' ';
                  setlength(clipcontent,length(clipcontent)+1);
                  clipcontent[k,0]:=FormPeach.StringGridList.Cells[12,i];
                  clipcontent[k,1]:=FormPeach.StringGridList.Cells[1,i];
                  clipcontent[k,2]:=FormPeach.StringGridList.Cells[2,i];
                  if fun='UN7Z' then clipcontent[k,3]:=txt_caption_extract
                  else clipcontent[k,3]:=txt_cut;
                  if fun='UN7Z' then clipcontent[k,4]:=FormPeach.EditOpenIn.Caption
                  else clipcontent[k,4]:=txt_fs;
                  clipcontent[k,5]:=FormPeach.StringGridList.Cells[3,i];
                  clipcontent[k,6]:=FormPeach.StringGridList.Cells[5,i];
                  k:=k+1;
                  end
            else
               begin
               FormPeach.StringGridList.Cells[0,i]:=' ';
               setlength(clipcontent,length(clipcontent)+1);
               clipcontent[k,0]:=FormPeach.StringGridList.Cells[12,i];
               clipcontent[k,1]:=FormPeach.StringGridList.Cells[1,i];
               clipcontent[k,2]:=FormPeach.StringGridList.Cells[2,i];
               if fun='UN7Z' then clipcontent[k,3]:=txt_caption_extract
               else clipcontent[k,3]:=txt_cut;
               if fun='UN7Z' then clipcontent[k,4]:=FormPeach.EditOpenIn.Caption
               else clipcontent[k,4]:=txt_fs;
               clipcontent[k,5]:=FormPeach.StringGridList.Cells[3,i];
               clipcontent[k,6]:=FormPeach.StringGridList.Cells[5,i];
               k:=k+1;
               end;
            end
         else FormPeach.StringGridList.Cells[0,i]:='';
      update_clipboard;
      update_listview_sel;
      end;
end;

procedure list_paste;
var
   i:integer;
begin
i:=0;
if fun='FILEBROWSER' then
      begin
      if length(clipcontent)>0 then
         if clipcontent[0,0]<>'' then
            begin
            destdir:=FormPeach.EditOpenIn.Text;//always refer to currently browsed path
            i:=cp_copy_filedir(clipcontent,destdir);
            end;
      if filecopying=false then
         if length(clipcontent)>0 then
            if (clipcontent[0,3]=txt_cut) or (clipmode=1) then
               if i=0 then
                  begin
                  prev_destdir:='';
                  setlength(clipcontent,0);
                  FormPeach.StringGridClipboard.Rowcount:=1;
                  FormPeach.StringGridClipboard.Autosizecolumns;
                  end;
      end;
end;

procedure clickcopyto(var sdest:ansistring);
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
list_copy;
if FormPeach.StringGridClipboard.rowcount=1 then exit;
if sdest='' then
 if FormPeach.SelectDirectoryDialog1.Execute then
   if FormPeach.SelectDirectoryDialog1.FileName<>'' then sdest:=FormPeach.SelectDirectoryDialog1.FileName;
if sdest<>'' then
   begin
   listdir(sdest,false,false);
   addtohistory;
   list_paste;
   end;
end;

procedure cutsmove(var s:ansistring);
var
 i:integer;
 sok:boolean;
begin
if s='' then exit;
sok:=false;
repeat
i:=length(s);
if s[length(s)] = '*' then setlength(s,length(s)-1);
if s='' then exit;
if s[length(s)] = '\' then setlength(s,length(s)-1);
if s='' then exit;
if s[length(s)] = '/' then setlength(s,length(s)-1);
if s='' then exit;
if length(s)=i then sok:=true else sok:=false;
until sok=true;
if length(s)<3 then exit;
s:=StringReplace(s,'\',directoryseparator, [rfReplaceAll]);
s:=StringReplace(s,'/',directoryseparator, [rfReplaceAll]);
repeat
s:=StringReplace(s,directoryseparator+directoryseparator,directoryseparator, [rfReplaceAll]);
until pos(directoryseparator+directoryseparator,s)=0;
if length(s)<2 then exit;
if s[1] = DirectorySeparator then s:=copy(s,2,length(s)-1);
end;

procedure clickmoveto(var sdest:ansistring);
var
   s,s1:ansistring;
   rc,i,j:integer;
   namecollisionfound:boolean;
begin
if fun='FILEBROWSER' then
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
list_cut;
if FormPeach.StringGridClipboard.rowcount=1 then exit;
if sdest='' then
   if FormPeach.SelectDirectoryDialog1.Execute then
      if FormPeach.SelectDirectoryDialog1.FileName<>'' then sdest:=FormPeach.SelectDirectoryDialog1.FileName;
if sdest<>'' then
   begin
   listdir(sdest,false,false);
   addtohistory;
   list_paste;
   end;
end;
if fun='UN7Z' then
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then exit;
s:=FormPeach.EditUn7zaFilter.Caption;
cutsmove(s);
if not pInputQuery(txt_moveto, txt_name_provide, '', s, false) then exit;
cutsmove(s);
if s<>'' then
   if checkfiledirname_acceptblank(s)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatefn+' "'+s+'"');
   exit;
   end;
if s<>'' then s:=s+directoryseparator;
rc:=FormPeach.StringGridList.RowCount;

namecollisionfound:=false;
for i:=1 to FormPeach.StringGridArchive.Rowcount-1 do
   for j:=1 to rc-1 do
      if FormPeach.StringGridList.Cells[16,j]='1' then
         begin
         s1:=FormPeach.StringGridList.Cells[1,j];
         if s1[Length(s1)]='*' then SetLength(s1,length(s1)-2);
         if FormPeach.StringGridArchive.Cells[12,i]=s+s1 then
            begin
            namecollisionfound:=true;
            break;
            end;
         end;
if namecollisionfound=true then
   if pMessageInfoYesNo(txt_6_9_overarch)=7 then exit;

for i:=1 to rc-1 do
   begin
   if FormPeach.StringGridList.Cells[16,i]='1' then
      begin
      s1:=FormPeach.StringGridList.Cells[1,i];
      if s1[Length(s1)]='*' then SetLength(s1,length(s1)-2);
      renamefileinarchive(FormPeach.StringGridList.Cells[12,i],s+s1,true);
      Application.ProcessMessages;
      end;
   end;
reloadandbrowse;
end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection RENAME files

///////////////////////////////////////////////////////////////////////////////}

procedure setrenfilesonly(i:integer);
begin
renfilesonly:=i;
if i=0 then FormPeach.po_rename_filesonly.checked:=false
else FormPeach.po_rename_filesonly.checked:=true;
if i=0 then FormPeach.pmr_files.checked:=false
else FormPeach.pmr_files.checked:=true;
end;

procedure renamefileinarchive(nameold,namenew:ansistring; cleardestname:boolean);
var
   cl,bin_name,fextl,pw,pw_option,pw2_option,out_param:ansistring;
begin
fextl:=upcase(extractfileext(FormPeach.EditOpenIn.Caption));

if testeditable=false then exit;

{if isabspath(nameold)=true then
   begin
   pMessageWarningOK(txt_add_error);
   exit;
   end;

if isabspath(namenew)=true then
   begin
   pMessageWarningOK(txt_add_error);
   exit;
   end;}//disable editing in absolute paths, which is problematic for delete stage in 7z/p7zip frontent

//remove existing item with new destination name
if cleardestname=true then
if not ((upcase(namenew)=upcase(nameold)) and (fextl='.RAR') and (havewinrar=true) and (userar=1)) then
begin
if (fextl='.RAR') and (havewinrar=true) and (userar=1) then
   begin
   bin_name:=stringdelim(escapefilename(FormPeach.EditnameCustom.Text,desk_env))+' d -y';
   case FormPeach.cbRARlastmodtime.ItemIndex of
      1: bin_name:=bin_name+' -tk';
      2: bin_name:=bin_name+' -tl';
      end;
   end
else
   begin
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT)+' d -y -ssc';
   if sys7zlin>0 then bin_name:=alias7z+EXEEXT+' d -y -ssc';
   if stl7z=1 then bin_name:=bin_name+' -stl';
   case syntaxstring7z of
   '21','17','16': begin end;
   else if ssp7z=1 then bin_name:=bin_name+' -ssp';
   end;
   end;

if (fextl='.RAR') and (havewinrar=true) and (userar=1) then
   begin
   //mgotypeRAR encryption
   if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
      if FormPW.CheckBoxEncFn.State=cbChecked then pw_option:='-hp'
      else pw_option:='-p'
   else
      pw_option:='';
   pforceconsole:=0;
   pipepw:='';
   piperar:=true;
   if pw_option<>'' then
         begin
         pw:=FormPW.EditPWpass.Text;
         if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
            if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
               begin
               pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
               exit;
               end;
         if zaout=2 then pipepw:=pw;
         if pw4cl(pw_option,pw)<>0 then
            begin
            msg_pw_errorchar(pw);
            pforceconsole:=1;
            pw:=pw_option;
            //exit;
            end;
         end;
   if pw<>'' then
      if (pipepw<>'') and (consolecl=false) then bin_name:=bin_name+' '+pw_option else bin_name:=bin_name+' '+pw;
   end
else
   begin
   //encryption
   if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
      if (FormPW.CheckBoxEncFn.State= cbChecked) and (archive_type='7z') then
         begin
         pw_option:='-p';
         pw2_option:='-mhe=on';
         end
      else
         begin
         pw_option:='-p';
         pw2_option:='';
         end
   else
      begin
      pw_option:='';
      pw2_option:='';
      end;
   pforceconsole:=0;
   pipepw:='';
   piperar:=false;
   if pw_option<>'' then
      begin
      pw:=FormPW.EditPWpass.Text;
      if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
         if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
            begin
            pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
            exit;
            end;
      if zaout=2 then pipepw:=pw;
      if pw4cl('-p',pw)<>0 then
         begin
         msg_pw_errorchar(pw);
         pforceconsole:=1;
         pw:='-p';
         end;
      end;
   if pw<>'' then
      begin
      if (pipepw<>'') and (consolecl=false) then bin_name:=bin_name+' -p' else bin_name:=bin_name+' '+pw;
      if pw2_option<>'' then bin_name:=bin_name+' '+pw2_option;
      end;
   end;
out_param:=FormPeach.EditOpenIn.Caption;
{$IFDEF MSWINDOWS}if forcecanbechanged=1 then if ExtractFileExt(out_param)='' then out_param:=out_param+'.';{$ENDIF}
cl:=bin_name+' -- '+stringdelim(escapefilename(out_param,desk_env));

if isabspath(namenew)=true then
   cl:=cl+' '+stringdelim(escapefilename('*'+namenew,desk_env))//workaround for delete command on absolute paths
else
   cl:=cl+' '+stringdelim(escapefilename(namenew,desk_env));

if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
execute_cl_simple(cl);
end;

//rename item from old name to new name
if (fextl='.RAR') and (havewinrar=true) and (userar=1) then
   begin
   bin_name:=stringdelim(escapefilename(FormPeach.EditnameCustom.Text,desk_env))+' rn';
   case FormPeach.cbRARlastmodtime.ItemIndex of
      1: bin_name:=bin_name+' -tk';
      2: bin_name:=bin_name+' -tl';
      end;
   //mgotypeRAR encryption
   if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
      if FormPW.CheckBoxEncFn.State=cbChecked then pw_option:='-hp'
      else pw_option:='-p'
   else
      pw_option:='';
   pforceconsole:=0;
   pipepw:='';
   piperar:=true;
   if pw_option<>'' then
         begin
         pw:=FormPW.EditPWpass.Text;
         if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
            if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
               begin
               pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
               exit;
               end;
         if zaout=2 then pipepw:=pw;
         if pw4cl(pw_option,pw)<>0 then
            begin
            msg_pw_errorchar(pw);
            pforceconsole:=1;
            pw:=pw_option;
            //exit;
            end;
         end;
   if pw<>'' then
      if (pipepw<>'') and (consolecl=false) then bin_name:=bin_name+' '+pw_option else bin_name:=bin_name+' '+pw;
   end
else
   begin
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT)+' rn';
   if sys7zlin>0 then bin_name:=alias7z+EXEEXT+' rn';
   if stl7z=1 then bin_name:=bin_name+' -stl';
   case syntaxstring7z of
   '21','17','16': begin end;
   else if ssp7z=1 then bin_name:=bin_name+' -ssp';
   end;
   //encryption
   if (FormPW.EditPWpass.Text<>'') or (FormPW.EditPWkeyfile.Text<>'') then
      if (FormPW.CheckBoxEncFn.State= cbChecked) and (archive_type='7z') then
         begin
         pw_option:='-p';
         pw2_option:='-mhe=on';
         end
      else
         begin
         pw_option:='-p';
         pw2_option:='';
         end
   else
      begin
      pw_option:='';
      pw2_option:='';
      end;
   pforceconsole:=0;
   pipepw:='';
   piperar:=false;
   if pw_option<>'' then
      begin
      pw:=FormPW.EditPWpass.Text;
      if (disable_twofactor=false) and (FormPW.EditPWkeyfile.Text<>'') then
         if prepend_keyfile(pw,FormPW.EditPWkeyfile.Text,kflimit)<>0 then
            begin
            pMessageErrorOK(FormPW.EditPWkeyfile.Text+' '+txt_keyfile_not_found);
            exit;
            end;
      if zaout=2 then pipepw:=pw;
      if pw4cl('-p',pw)<>0 then
         begin
         msg_pw_errorchar(pw);
         pforceconsole:=1;
         pw:='-p';
         end;
      end;
   if pw<>'' then
      begin
      if (pipepw<>'') and (consolecl=false) then bin_name:=bin_name+' -p' else bin_name:=bin_name+' '+pw;
      if pw2_option<>'' then bin_name:=bin_name+' '+pw2_option;
      end;
   end;
out_param:=FormPeach.EditOpenIn.Caption;
{$IFDEF MSWINDOWS}if forcecanbechanged=1 then if ExtractFileExt(out_param)='' then out_param:=out_param+'.';{$ENDIF}

cl:=bin_name+' -- '+stringdelim(escapefilename(out_param,desk_env))+' '+stringdelim(escapefilename(nameold,desk_env))+' '+stringdelim(escapefilename(namenew,desk_env));
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
execute_cl_simple(cl);
end;

function numstrext(i,nsel:integer):ansistring;
begin
if nsel>99999 then
   if i <10 then result:='00000'+inttostr(i)
   else
      if i <100 then result:='0000'+inttostr(i)
      else
         if i<1000 then result:='000'+inttostr(i)
         else
            if i<10000 then result:='00'+inttostr(i)
            else
               if i<100000 then result:='0'+inttostr(i)
               else result:=inttostr(i);
if nsel>9999 then
   if i <10 then result:='0000'+inttostr(i)
   else
      if i <100 then result:='000'+inttostr(i)
      else
         if i<1000 then result:='00'+inttostr(i)
         else
            if i<10000 then result:='0'+inttostr(i)
            else result:=inttostr(i);
if nsel>999 then
   if i <10 then result:='000'+inttostr(i)
   else
      if i<100 then result:='00'+inttostr(i)
      else
         if i<1000 then result:='0'+inttostr(i)
         else result:=inttostr(i);
if nsel>99 then
   if i <10 then result:='00'+inttostr(i)
   else
      if i<100 then result:='0'+inttostr(i)
      else result:=inttostr(i);
if nsel>9 then
   if i <10 then result:='0'+inttostr(i)
   else result:=inttostr(i);
end;

function numstr(i,nsel:integer):ansistring;
begin
if nsel>99 then
   if i <10 then result:='00'+inttostr(i)
   else
      if i<100 then result:='0'+inttostr(i)
      else result:=inttostr(i)
else
   if nsel>9 then
      if i <10 then result:='0'+inttostr(i)
      else result:=inttostr(i)
   else result:=inttostr(i);
end;

procedure rename_files(mode:ansistring);
var
   s,s0,st0,st,str,sext,sextorig,sextchanged,strsel,s1,sadd,sold,snew,sti,snchar,snpos,fmode:ansistring;
   i,j,k,z,nsel,rc,nchar,npos:integer;
   namecollisionfound:boolean;
begin
if FormPeach.ListViewBrowser.ReadOnly=false then exit;
if (fun<>'FILEBROWSER') and (fun<>'UN7Z') then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if renselonly=1 then if checklisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}
s:=FormPeach.StringGridList.Cells[1,FormPeach.StringGridList.Row];
{$ELSE}
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   begin
   if FormPeach.StringGridList.Cells[16,i]='1' then s:=FormPeach.StringGridList.Cells[1,i];
   end;
{$ENDIF}
if s[Length(s)]='*' then SetLength(s,length(s)-2);
if mode='rename' then //replace entire file name string
begin
sextorig:='';
if not checkdirexists(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]) then
   sextorig:=extractfileext(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
FormInput.LabelMoveTo.Visible:=true;
FormInput.Labelinputspacer3.Visible:=true;
if not pInputQuery(txt_rename, txt_name_provide, '', s, false) then exit;
if checkfilename(s)<>0 then
   begin
   pMessageWarningOK('"'+s+'" '+txt_checkname_failed+char($0D)+char($0A)+txt_name_provide);
   exit;
   end;
if nsel>1 then
   begin
   if renfilesonly=1 then st:=txt_7_1_renfilesonly else st:=txt_rename;
   if pMessageWarningYesNo(st+char($0D)+char($0A)+char($0D)+char($0A)+s+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel)<>6 then exit;
   end;
k:=0;
s1:=FormPeach.EditOpenIn.Text;
s0:=s;
sextchanged:='';
if not checkdirexists(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]) then
   begin
   if sextorig<>extractfileext(s) then sextchanged:=extractfileext(s);
   cutextension(s0);
   end;
enter_busy_status;
rc:=FormPeach.StringGridList.RowCount;

namecollisionfound:=false;
if fun='UN7Z' then
   for i:=1 to FormPeach.StringGridArchive.Rowcount-1 do
     for j:=1 to rc-1 do
        if FormPeach.StringGridList.Cells[16,j]='1' then
            if FormPeach.StringGridArchive.Cells[12,i]=extractfilepath(FormPeach.StringGridList.Cells[12,j])+s then
               begin
               namecollisionfound:=true;
               break;
               end;
if namecollisionfound=true then
   if pMessageInfoYesNo(txt_6_9_overarch)=7 then
      begin
      exit_busy_status;
      exit;
      end;

for i:=1 to rc-1 do
   begin
   if (FormPeach.EditOpenIn.Text<>s1) or (endflag=true) then break;//break if no longer in the original directory
   if (FormPeach.StringGridList.Cells[16,i]='1') or (renselonly=0) then
      if (FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder) or (renfilesonly=0) then
      begin
      FormPeach.Caption:=txt_rename+' ('+inttostr(k+1)+'/'+inttostr(nsel)+') '+FormPeach.StringGridList.Cells[1,i]+'...';
      if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then begin exit_busy_status; pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]); navrefresh; exit; end;
      k:=k+1;
      sext:='';
      if not checkdirexists(FormPeach.StringGridList.Cells[12,i]) then
         if sextchanged<>'' then sext:=sextchanged //if original object was a file, and extension was changed, apply the new extension to all files scheduled to be renamed
         else sext:=extractfileext(FormPeach.StringGridList.Cells[12,i]);
      if nsel>1 then s:=s0+NAMEVARSTR+numstr(k,nsel)+sext;
      if s<>FormPeach.StringGridList.Cells[1,i] then
         begin
         if fun='FILEBROWSER' then renamefile(FormPeach.StringGridList.Cells[12,i],extractfilepath(FormPeach.StringGridList.Cells[12,i])+s);
         if fun='UN7Z' then renamefileinarchive(FormPeach.StringGridList.Cells[12,i],extractfilepath(FormPeach.StringGridList.Cells[12,i])+s,true);
         end;
      Application.ProcessMessages;
      end;
   end;
exit_busy_status;
end;
if (mode='uppercase') or (mode='lowercase') or (mode='add') or (mode='delete')
   or (mode='replace') or (mode='replacecase') or (mode='extension') or (mode='123')
   or (mode='timestamp') or (mode='dirappend') or (mode='dirprepend') or (mode='cutlen')
   or (mode='keepascii') then //special modes
begin
case mode of
   'cutlen':
   begin
   if not pInputQuery(txt_7_5_cutlen, '', txt_7_5_cutlenw, snpos, false) then exit;
   try
   npos:=strtoint(snpos);
   if npos<4 then npos:=4;
   if npos>255 then npos:=255;
   except
      pMessageWarningOK(txt_7_5_cutlen+char($0D)+char($0A)+txt_7_5_cutlenw);
      exit;
   end;
   snpos:=inttostr(npos);
   sti:=txt_7_5_cutlen+char($0D)+char($0A)+char($0D)+char($0A)+snpos;
   end;
   'keepascii':
   begin
   sti:=txt_7_5_repnascii;
   snew:='';
   if not pInputQuery(sti, txt_7_5_repnascii, txt_5_5_replaceneww, snew, false) then exit;
   if checkfilename_acceptblank(snew)<>0 then
      begin
      pMessageWarningOK('"'+snew+'" '+char($0D)+char($0A)+txt_name_provide);
      exit;
      end;
   if length(snew)>256 then snew:=copy(snew,1,256);
   if snew<>'' then sti:=sti+' -> '+snew;
   end;
   'add':
   begin
   if not pInputQuery(txt_5_5_string, txt_name_provide, '', sadd, false) then exit;
   if checkfilename(sadd)<>0 then
      begin
      pMessageWarningOK('"'+sadd+'" '+char($0D)+char($0A)+txt_name_provide);
      exit;
      end;
   if length(sadd)>256 then sadd:=copy(sadd,1,256);
   if not pInputQuery(txt_5_5_position, '', txt_5_5_positionw, snpos, false) then exit;
   try
      if (snpos='z') or (snpos='Z') or (snpos='"z"') or (snpos='"Z"') or (snpos='''z''') or (snpos='''Z''') or (snpos='end') or (snpos='END') or (snpos='End') then npos:=-1
      else
         begin
         npos:=strtoint(snpos);
         if npos<1 then npos:=1;
         if npos>256 then npos:=256;
         end;
   except
      pMessageWarningOK(txt_5_5_position+char($0D)+char($0A)+txt_5_5_positionw);
      exit;
   end;
   sti:=txt_5_5_add+char($0D)+char($0A)+char($0D)+char($0A)+sadd+' / '+snpos;
   end;
   'delete':
   begin
   if not pInputQuery(txt_5_5_n, '', '', snchar, false) then exit;
   try
      nchar:=strtoint(snchar);
      if nchar<1 then exit;
      if nchar>256 then nchar:=256;
   except
      exit;
   end;
   if not pInputQuery(txt_5_5_position, '', txt_5_5_positionwd, snpos, false) then exit;
   try
      if (snpos='z') or (snpos='Z') or (snpos='"z"') or (snpos='"Z"') or (snpos='''z''') or (snpos='''Z''') or (snpos='end') or (snpos='END') or (snpos='End') then npos:=-1
      else
         begin
         npos:=strtoint(snpos);
         if npos<1 then npos:=1;
         if npos>256 then npos:=256;
         end;
   except
      pMessageWarningOK(txt_5_5_position+char($0D)+char($0A)+txt_5_5_positionwd);
      exit;
   end;
   sti:=txt_5_5_delete+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nchar)+' / '+snpos;
   end;
   'replace', 'replacecase':
   begin
   if (mode='replace') then sti:=txt_5_5_old else sti:=txt_5_5_old+' '+txt_5_5_case;
   if not pInputQuery(sti, txt_name_provide, txt_5_5_replaceoldw, sold, false) then exit;
   if checkfilename(sold)<>0 then
      begin
      pMessageWarningOK('"'+sold+'" '+char($0D)+char($0A)+txt_name_provide);
      exit;
      end;
   if (mode='replace') then sti:=txt_5_5_new else sti:=txt_5_5_new+' '+txt_5_5_case;
   if not pInputQuery(sti, txt_name_provide, txt_5_5_replaceneww, snew, false) then exit;
   if checkfilename_acceptblank(snew)<>0 then
      begin
      pMessageWarningOK('"'+snew+'" '+char($0D)+char($0A)+txt_name_provide);
      exit;
      end;
   if length(sold)>256 then sold:=copy(sold,1,256);
   if length(snew)>256 then snew:=copy(snew,1,256);
   sti:=sti+char($0D)+char($0A)+char($0D)+char($0A)+sold+' -> '+snew;
   end;
   'extension':
   begin
   sti:=txt_5_5_newext;
   if not pInputQuery(sti, txt_name_provide, txt_5_5_extw, snew, false) then exit;
   if checkfilename_acceptblank(snew)<>0 then
      begin
      pMessageWarningOK('"'+snew+'" '+char($0D)+char($0A)+txt_name_provide);
      exit;
      end;
   if length(snew)>256 then snew:=copy(snew,1,256);
   if snew<>'' then
      if snew[1]='.' then snew:=copy(snew,2,length(snew)-1);
   sti:=sti+' ('+snew+')';
   end;
   'uppercase': sti:=UpperCase(txt_5_5_upper);
   'lowercase': sti:=lowercase(txt_5_5_lower);
   'timestamp': sti:=txt_timestamp;
   '123': sti:='1, 2, 3...';
   'dirappend':
   begin
   sti:=txt_6_4_appdirn;
   st0:=extractfilepath(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
   if length(st0)>3 then
      begin
      if st0[length(st0)]=directoryseparator then setlength(st0,length(st0)-1);
      st0:=extractfilename(st0);
      if length(st0)>128 then st0:=copy(st0,1,128);
      sti:=sti+char($0D)+char($0A)+char($0D)+char($0A)+'xxx - '+st0;
      end;
   end;
   'dirprepend':
   begin
   sti:=txt_6_4_prepdirn;
   st0:=extractfilepath(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row]);
   if length(st0)>3 then
      begin
      if st0[length(st0)]=directoryseparator then setlength(st0,length(st0)-1);
      st0:=extractfilename(st0);
      if length(st0)>128 then st0:=copy(st0,1,128);
      sti:=sti+char($0D)+char($0A)+char($0D)+char($0A)+st0+' - xxx';
      end;
   end;
end;
if nsel>1 then
   begin
   if renfilesonly=1 then st:=txt_7_1_renfilesonly else st:=txt_rename;
   if pMessageWarningYesNo(st+' | '+sti+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel)<>6 then exit;
   end;
s1:=FormPeach.EditOpenIn.Text;
enter_busy_status;
k:=0;
rc:=FormPeach.StringGridList.RowCount;
for i:=1 to rc-1 do
   begin
   if (FormPeach.EditOpenIn.Text<>s1) or (endflag=true) then break;//break if no longer in the original directory
   if (FormPeach.StringGridList.Cells[16,i]='1') or (renselonly=0) then
      if (FormPeach.StringGridList.Cells[2,i]<>txt_list_isfolder) or (renfilesonly=0) then
      begin
      if checkfiledirname(FormPeach.StringGridList.Cells[12,i])<>0 then
         begin
         exit_busy_status;
         pMessageWarningOK(txt_2_7_validatefn+' '+FormPeach.StringGridList.Cells[12,i]);
         navrefresh;
         exit;
         end;
      if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then fmode:='folder'
      else fmode:='file';
      FormPeach.Caption:=txt_rename+' '+sti+' ('+inttostr(k+1)+'/'+inttostr(nsel)+') '+FormPeach.StringGridList.Cells[1,i]+'...';
      if mode='uppercase' then
         s:=upcase(extractfilename(FormPeach.StringGridList.Cells[12,i]));
      if mode='lowercase' then
         s:=lowercase(extractfilename(FormPeach.StringGridList.Cells[12,i]));
      if mode='keepascii' then
         begin
         s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         str:='';
         for z:=1 to length(s) do
            if ord(s[z])<=127 then str:=str+char(s[z]) else str:=str+snew;
         if str='' then str:='1';
         s:=str;
         end;
      if mode='timestamp' then
         begin
         s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         apply_timestamptoname(s,0,1,fmode);
         end;
      if mode='123' then
         begin s:=numstrext(i,rc-1)+' '+extractfilename(FormPeach.StringGridList.Cells[12,i]); end;
      if mode='dirappend' then
         begin
         s:=FormPeach.StringGridList.Cells[12,i];
         apply_dirnametoname(s,'append',fmode);
         end;
      if mode='dirprepend' then
         begin
         s:=FormPeach.StringGridList.Cells[12,i];
         apply_dirnametoname(s,'prepend',fmode);
         end;
      if mode='cutlen' then
         begin
         s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         sext:='';
         if not checkdirexists(FormPeach.StringGridList.Cells[12,i]) then
            begin //it is a file
            sext:=extractfileext(s);
            cutextension(s);
            end;
         if length(s)>npos then s:=copy(s,1,npos);
         s:=s+sext;
         end;
      if mode='add' then
         begin
         s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         sext:='';
         if not checkdirexists(FormPeach.StringGridList.Cells[12,i]) then
            begin //it is a file
            sext:=extractfileext(s);
            cutextension(s);
            end;
         if npos=-1 then //append at the end of file name
            begin
            s:=s+sadd+sext;
            end
         else //append at specified position
            begin
            if length(s)<npos then //append at the end if file name is shorter
               begin
               s:=s+sadd+sext;
               end
            else
               begin
               s:=copy(s,1,npos-1)+sadd+copy(s,npos,length(s)-(npos-1));
               s:=s+sext;
               end;
            end;
         end;
      if mode='delete' then
         begin
         s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         sext:='';
         if not checkdirexists(FormPeach.StringGridList.Cells[12,i]) then
            begin //it is a file
            sext:=extractfileext(s);
            cutextension(s);
            end;
         if npos=-1 then //delete from end of file name
            begin
            if length(s)<=nchar then
               s:=''
            else s:=copy(s,1,length(s)-nchar);
            end
         else //delete from specified position
            begin
            if length(s)<npos then //if string is shorter than position, keep existing string
               begin
               end
            else
               begin
               if length(s)<(npos+nchar) then s:=copy(s,1,npos-1)
               else s:=copy(s,1,npos-1)+copy(s,npos+nchar,length(s)-npos-nchar+1);
               end;
            end;
         s:=s+sext;
         end;
      if (mode='replace') or (mode='replacecase') then
         begin
         s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         sext:='';
         if not checkdirexists(FormPeach.StringGridList.Cells[12,i]) then
            begin //it is a file
            sext:=extractfileext(s);
            cutextension(s);
            end;
         if mode='replace' then
            s:=StringReplace(s,sold,snew, [rfIgnoreCase, rfReplaceAll])
         else
            s:=StringReplace(s,sold,snew, [rfReplaceAll]);
         if s='' then s:=sold;
         s:=s+sext;
         end;
      if mode='extension' then
         begin
         s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         if not checkdirexists(FormPeach.StringGridList.Cells[12,i]) then
            begin //it is a file
            cutextension(s);
            if snew<>'' then s:=s+'.'+snew;
            end;
         if s='' then s:=extractfilename(FormPeach.StringGridList.Cells[12,i]);
         end;
      //check if name is unique
      if FormPeach.StringGridList.Cells[12,i]<>(extractfilepath(FormPeach.StringGridList.Cells[12,i])+s) then
         begin
         {$IFDEF MSWINDOWS}if (mode<>'uppercase') and (mode<>'lowercase') then{$ENDIF}
         if (fileexists(extractfilepath(FormPeach.StringGridList.Cells[12,i])+s)) or (checkdirexists(extractfilepath(FormPeach.StringGridList.Cells[12,i])+s)) then
            begin
            s:=extractfilepath(FormPeach.StringGridList.Cells[12,i])+s;
            get_new_archive_name(s);
            s:=extractfilename(s);
            end;
         k:=k+1;
         if fun='FILEBROWSER' then renamefile(FormPeach.StringGridList.Cells[12,i],extractfilepath(FormPeach.StringGridList.Cells[12,i])+s);
         if fun='UN7Z' then renamefileinarchive(FormPeach.StringGridList.Cells[12,i],extractfilepath(FormPeach.StringGridList.Cells[12,i])+s,true);
         end;
      Application.ProcessMessages;
      end;
   end;
exit_busy_status;
end;
if fun='UN7Z' then
   reloadandbrowse
else
   navrefresh;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection FUNCTIONS MENU in file browser

///////////////////////////////////////////////////////////////////////////////}

procedure populatefunmenu;
begin
with FormPeach do
begin
pmfun1.caption:=TreeViewTmp.Items[0].Text;
pmfun2.caption:=TreeViewTmp.Items[1].Text;
pmfun3.caption:=TreeViewTmp.Items[2].Text;
pmfun4.caption:=TreeViewTmp.Items[3].Text;
pmfun5.caption:=TreeViewTmp.Items[4].Text;
pmfun6.caption:=TreeViewTmp.Items[5].Text;
pmfun7.caption:=TreeViewTmp.Items[6].Text;
pmfun8.caption:=TreeViewTmp.Items[7].Text;
pmfun9.caption:=TreeViewTmp.Items[8].Text;
pmfun10.caption:=TreeViewTmp.Items[9].Text;
pmfun11.caption:=TreeViewTmp.Items[10].Text;
pmfun12.caption:=TreeViewTmp.Items[11].Text;
pmfun13.caption:=TreeViewTmp.Items[12].Text;
pmfun14.caption:=TreeViewTmp.Items[13].Text;
pmfun15.caption:=TreeViewTmp.Items[14].Text;
pmfun16.caption:=TreeViewTmp.Items[15].Text;
pmfun17.caption:=TreeViewTmp.Items[16].Text;
pmfun18.caption:=TreeViewTmp.Items[17].Text;
pmfun19.caption:=TreeViewTmp.Items[18].Text;
pmfun20.caption:=TreeViewTmp.Items[19].Text;
pmfun21.caption:=TreeViewTmp.Items[20].Text;
pmfun22.caption:=TreeViewTmp.Items[21].Text;
pmfun23.caption:=TreeViewTmp.Items[22].Text;
pmfun24.caption:=TreeViewTmp.Items[23].Text;
pmfun25.caption:=TreeViewTmp.Items[24].Text;
pmfun26.caption:=TreeViewTmp.Items[25].Text;
pmfun27.caption:=TreeViewTmp.Items[26].Text;
pmfun28.caption:=TreeViewTmp.Items[27].Text;
pmfun29.caption:=TreeViewTmp.Items[28].Text;
pmfun30.caption:=TreeViewTmp.Items[29].Text;
pmfun31.caption:=TreeViewTmp.Items[30].Text;
pmfun32.caption:=TreeViewTmp.Items[31].Text;
pmfun33.caption:=TreeViewTmp.Items[32].Text;
pmfun34.caption:=TreeViewTmp.Items[33].Text;
{$IFDEF MSWINDOWS}pmfun35.caption:=TreeViewTmp.Items[34].Text;{$ELSE}pmfun35.visible:=false;{$ENDIF}
CopyMenuItems(pmfunaz,po_functionsaz,0);
end;
end;

procedure do_pmfun(capt:ansistring);
var s:ansistring;
begin
if capt=txt_add then begin do_add; exit; end;
if capt=txt_2_5_help then
   begin
   showpanel('defaults');
   clicklabel_options(FormPeach.LabelTitleOptions7, FormPeach.ShapeOptions7);
   exit;
   end;
if capt=txt_settings then
   begin
   showpanel('defaults');
   clicklabel_options(FormPeach.LabelTitleOptions1, FormPeach.ShapeOptions1);
   exit;
   end;
if capt=txt_2_8_convert then begin archive_convert; exit; end;
if capt=txt_caption_extract then begin do_extract; exit; end;
if capt=txt_ext_allto+'...' then begin do_extallto('all'); exit; end;
if capt=txt_caption_test then begin do_test; exit; end;
if capt=txt_caption_list then begin FormPeach.pmmorefun_listClick(nil); exit; end;
if capt=txt_check then begin lcheck('check'); exit; end;
if capt=txt_rename+' (F2)' then begin rename_files('rename'); exit; end;
if capt=txt_cnewfolder then begin createnewfolder; exit; end;
if capt=txt_add_tobookmarks then begin addtobookmarks('*browsercontext'); exit; end;
if capt=txt_2_9_organize+' '+txt_bookmarks then begin do_organizebookmarks; exit; end;
if capt=txt_toggle_browseflat then begin FormPeach.f6flatExecute(nil); exit; end;
if capt=txt_4_7_pk then begin FormPeach.shiftF9Execute(nil); exit; end;
if capt=txt_8_7_verifybin then begin internalbincheck; exit; end;
if capt=FormPeach.mcomment.Caption then begin setcomment; exit; end;
if capt=txt_advfilters then begin FormPeach.shiftctrlF9Execute(nil); exit; end;
if capt=txt_4_1_duplicatesfind then begin findduplicate('neutral'); exit; end;
if capt=txt_copyto then begin s:=''; clickcopyto(s); exit; end;
if capt=txt_moveto then begin s:=''; clickmoveto(s); exit; end;
if capt=txt_joinfiles then begin do_join; exit; end;
if capt=txt_split_file then begin do_split; exit; end;
if capt=txt_controlpanel then begin open_cpl; exit; end;
if capt=txt_4_3_pwman then begin setpm(1); exit; end;
if capt=txt_2_7_setpw then begin ask_pwkeyfile; exit; end;
if capt=txt_searchfor then
   begin
   FormPeach.editun7zafilter.caption:='*';
   launch_rsearch;
   exit;
   end;
//if capt=txt_4_8_rl then begin frombrowser_imgrotate('left'); exit; end;
//if capt=txt_4_8_rr then begin frombrowser_imgrotate('right'); exit; end;
if capt=txt_cphere then begin browser_commandprompt(1,0,''); exit; end;
if capt=txt_5_0_ps then begin browser_commandprompt(1,1,''); exit; end;
if capt=txt_peazip_new then begin openwith_peazipnew(1,''); exit; end;
if capt=txt_explore_path then begin browser_explorepath(1); exit; end;
if capt=txt_4_5_properties then begin browser_fileproperties(''); exit; end;
if capt=txt_open_path then begin openpath; exit; end;
if capt=txt_openarchive then begin open_archive; exit; end;
if capt=txt_searchanddrag then begin cp_search(desk_env); exit; end;
if capt=txt_search_web then
   begin
   if checklistsel=0 then s:=FormPeach.StringGridList.Cells[1,FormPeach.StringGridList.Row];
   run_websearch(s);
   exit;
   end;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection APP STARTUP

///////////////////////////////////////////////////////////////////////////////}

procedure condopenaction(s:ansistring);
var
   j,sf:integer;
   s0:ansistring;
   okfile,dirpresent,nf:boolean;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound:qword;
begin
if restoretabbar=1 then
   case FormPeach.cbdefaultaction.ItemIndex of
   0,1:
   begin
   addptab;
   sortplustab;
   end;
   end;
case FormPeach.cbdefaultaction.ItemIndex of
               0: begin
                  open_noinput;
                  FormPeach.ListViewBrowser.Clear;
                  FormPeach.visible:=true;
                  finishlistview;
                  open_singleinput(s);//open
                  end;
               1://open as archive
                  begin
                  open_noinput;
                  FormPeach.ListViewBrowser.Clear;
                  FormPeach.visible:=true;
                  finishlistview;
                  forceopenasarchive:=true;
                  open_archive_fromname(s);
                  //forceopenasarchive:=false;
                  end;
               2,3,4,5://2 extract full ui, 3 extract here 4 extract here smart new folder, 5 extract here new folder
                  begin
                  FormPeach.EditOutExtract.Text:=local_desktop;
                  list_toextractor('none','full');
                  dirpresent:=false;
                  if checkdirexists(ExpandFileName(s)) then
                     begin
                     dirpresent:=true;
                     s0:=extractfilepath(ExpandFileName(s));
                     expand(ExpandFileName(s),exp_files,exp_fsizes,exp_ftimes,exp_fattr,exp_fattr_dec,nfound);
                     for j:=0 to nfound-1 do
                     if pos('D',exp_fattr_dec[j])=0 then
                        begin
                        test_extfile(exp_files[j],okfile);
                        if okfile=true then
                           begin
                           if checkfiledirname(exp_files[j])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+exp_files[j]); exit; end;
                           deselectingrid(FormPeach.StringGridExtract);
                           addfilestr(FormPeach.StringGridExtract,exp_files[j]);
                           end;
                        end;
                     end
                  else
                      begin
                      test_extfile(ExpandFileName(s),okfile);
                      if okfile=true then
                         begin
                         if checkfiledirname(ExpandFileName(s))<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+ExpandFileName(s)); exit; end;
                         FormPeach.Caption:=txt_2_4_adding+' '+ExpandFileName(s);
                         Application.ProcessMessages;
                         deselectingrid(FormPeach.StringGridExtract);
                         addfilestr(FormPeach.StringGridExtract,ExpandFileName(s));
                         end;
                      end;
                  if FormPeach.StringGridExtract.Rowcount>1 then
                     if dirpresent=false then
                        FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
                     else
                         FormPeach.EditOutExtract.Text:=s0//(last) directory's path
                  else
                     FormPeach.EditOutExtract.Text:=local_desktop;
                  updatecontent_ext;
                  stayopen:=false;
                  case FormPeach.cbdefaultaction.ItemIndex of
                     3:
                     begin
                     if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
                     FormPeach.CheckBoxFolder.State:=cbUnChecked;
                     on_buttonextokclick;
                     if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
                     save_conf;
                     end;
                     4:
                     begin
                     if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
                     sf:=removeintdir;
                     FormPeach.CheckBoxFolder.State:=cbChecked;
                     removeintdir:=1;
                     on_buttonextokclick;
                     if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
                     removeintdir:=sf;
                     save_conf;
                     end;
                     5:
                     begin
                     if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
                     sf:=removeintdir;
                     FormPeach.CheckBoxFolder.State:=cbChecked;
                     removeintdir:=0;
                     on_buttonextokclick;
                     if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
                     removeintdir:=sf;
                     save_conf;
                     end;
                  end;
                  exit;
                  end;
               end;
end;

procedure setarchiveaction(s:ansistring);
begin
with FormPeach do
begin
case s of
   '-add2arc': cbType.Text:=STR_ARC;
   '-add2sfxarc': cbType.Text:=txt_sfx+' '+STR_ARC;
   '-add2rar': cbType.Text:=txt_custom+'/RAR';
   '-add2brotli': cbType.Text:=STR_BROTLI;
   '-add2bzip2': cbType.Text:=STR_BZIP2;
   '-add2gzip': cbType.Text:=STR_GZIP;
   '-add2tar': cbType.Text:=STR_TAR;
   '-add2wim': cbType.Text:=STR_WIM;
   '-add2xz': cbType.Text:=STR_XZ;
   '-add2zstd': cbType.Text:=STR_ZSTD;
   '-add2zpaq': cbType.Text:=STR_ZPAQ;
   '-add2pea': cbType.Text:=STR_PEA;
   '-add2crypt': cbType.Text:=STR_PEA;
   '-add2peai': cbType.Text:=STR_PEA;
   '-add2crypti': cbType.Text:=STR_PEA;
   '-add27z': cbType.Text:=STR_7Z;
   '-add27zmail': cbType.Text:=STR_7Z;
   '-add2sfx7z': cbType.Text:=txt_sfx+' '+STR_7Z;
   '-add2sfx7zmail': cbType.Text:=txt_sfx+' '+STR_7Z;
   '-add2zip': cbType.Text:=STR_ZIP;
   '-add2zipmail': cbType.Text:=STR_ZIP;
   '-add27zi': cbType.Text:=STR_7Z;
   '-add27zmaili': cbType.Text:=STR_7Z;
   '-add2sfx7zi': cbType.Text:=txt_sfx+' '+STR_7Z;
   '-add2sfx7zmaili': cbType.Text:=txt_sfx+' '+STR_7Z;
   '-add2zipi': cbType.Text:=STR_ZIP;
   '-add2zipmaili': cbType.Text:=STR_ZIP;
   '-add2separate7z': cbType.Text:=STR_7Z;
   '-add2separatezip': cbType.Text:=STR_ZIP;
   '-add2separate7zi': cbType.Text:=STR_7Z;
   '-add2separatezipi': cbType.Text:=STR_ZIP;
end;
archive_type_select(cbType.Text);
case s of
   '-add2crypt': begin ComboBoxPEAStream.ItemIndex:=0; BtnPasswordArchiveClick(nil); end;
   '-add2peai': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; end;
   '-add2crypti': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; ComboBoxPEAStream.ItemIndex:=0; BtnPasswordArchiveClick(nil); end;
   '-add27zmail': CheckBoxMailAdd.Checked:=true;
   '-add2sfx7zmail': CheckBoxMailAdd.Checked:=true;
   '-add2zipmail': CheckBoxMailAdd.Checked:=true;
   '-add27zi': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; end;
   '-add27zmaili': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; CheckBoxMailAdd.Checked:=true; end;
   '-add2sfx7zi': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; end;
   '-add2sfx7zmaili': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; CheckBoxMailAdd.Checked:=true; end;
   '-add2zipi': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; end;
   '-add2zipmaili': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; CheckBoxMailAdd.Checked:=true; end;
   '-add2separate7z': begin CheckBoxSeparate.State:=cbChecked; on_checkboxseparateclick; end;
   '-add2separatezip': begin CheckBoxSeparate.State:=cbChecked; on_checkboxseparateclick; end;
   '-add2separate7zi': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; CheckBoxSeparate.State:=cbChecked; on_checkboxseparateclick; end;
   '-add2separatezipi': begin CheckBoxDeleteInputAdd.State:=cbUnchecked; on_CheckBoxDeleteInputAddClick; CheckBoxSeparate.State:=cbChecked; on_checkboxseparateclick; end;
end;
end;
end;

procedure openstart;
var
   i,j,p,q,lerr,sf:integer;
   s,s0,fun_neutral,cl,jobcode,outname,pparam1:ansistring;
   okfile,termfunopen,dirpresent,nf,cbignore:boolean;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound:qword;
begin
openstarted:=true;
stayopen:=true;
savetype:=false;
resetminimizedlauncher;
termfunopen:=true;

case privacy_mode of
   1:ask_pwkeyfile;
   2:
   repeat
   p:=ask_pwkeyfile;
   until (p=0) and ((FormPW.EditPWpass.Caption<>'') or (FormPW.EditPWkeyfile.Caption<>''));
end;

with FormPeach do
begin
//shell integration: if program is called with one of the following parameter as paramstr(1) use quick procedures without prompting PeaZip interface
case lowercase(paramstr(1)) of
   '-pdrop','-pdropp' :
   begin
   {$IFDEF MSWINDOWS}
   if paramstr(1) = '-pdropp' then
      begin
      AllocConsole;   //add console to app (win only)
      isconsole:=true;
      SysInitStdIO;
      readln(pipepw);
      Freeconsole;
      end;
   pipepw:=strsafedec(pipepw);
   {$ENDIF}
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   subfun:='extract';
   fun:=paramstr(2);
   try pforceconsole:=strtoint(paramstr(3)); except pforceconsole:=0; end;
   try tsize:=strtoqword(paramstr(4)); except tsize:=0; end;
   inputfile:=paramstr(5);
   outname:='';
   UnitGwrap.pfromnativedrag:=true;
   for i:=6 to paramcount do cl:=cl+stringdelim(paramstr(i))+' ';
   pdrop:=true;
   lerr:=launch_cl(cl,jobcode,outname);
   halt;
   end;
   //direct archive functions are moved to setarchiveaction procedure
   //direct extract functions are deprecated, replaced by new ext2here, ext2folder (ext2smart), ext2newfolder functions
   //duplicate deprecate legacy ext2 functions
   '-ext2here_' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','','complete');
   end;
   '-ext2smart_','-ext2folder_' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','smart','complete');
   end;
   '-ext2newfolder_' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','newfolder','complete');
   end;
   '-ext2herei' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','','ignore');
   end;
   '-ext2smarti','-ext2folderi' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','smart','ignore');
   end;
   '-ext2newfolderi' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','newfolder','ignore');
   end;
   //end of duplicate deprecate legacy ext2 functions
   //deprecated legacy ext2 functions
   '-ext2simple' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','','complete');
   end;
   '-ext2simplesmart','-ext2simplefolder' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','smart','complete');
   end;
   '-ext2simplenewfolder' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','newfolder','complete');
   end;
   '-ext2to' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2here('askto','','complete');
   end;
   '-ext2tosmart','-ext2tofolder' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('askto','smart','complete');
   end;
   '-ext2tonewfolder' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2here('askto','newfolder','complete');
   end;
   '-ext2simplei' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','','ignore');
   end;
   '-ext2simplesmarti','-ext2simplefolderi' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','smart','ignore');
   end;
   '-ext2simplenewfolderi' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','newfolder','ignore');
   end;
   '-ext2toi' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2here('askto','','ignore');
   end;
   '-ext2tosmarti','-ext2tofolderi' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('askto','smart','ignore');
   end;
   '-ext2tonewfolderi' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2here('askto','newfolder','ignore');
   end;
   //end of deprecated legacy ext2 functions
   //other
   '-add2wipe' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   add2wipe;
   end;
   '-add2compare' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   add2compare;
   end;
   '-ext2list' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2lt('l');
   end;
   '-ext2test' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2lt('t');
   end;
   '-ext2browse' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2browse;
   end;
   '-ext2browseasarchive' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2browseasarchive;
   end;
   '-ext2browsepath' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2browsepath;
   end;
   '-ext2commandprompt' :
   begin
   FormPeach.Windowstate:=wsMinimized;
   FormPeach.Visible:=false;
   ext2commandprompt;
   end;
   '-setcomment': //commentstring archive1..n
   begin
   setcommentcl;
   end;
   '-setcommentf': //commentfile archive1..n
   begin
   setcommentcl;
   end;
   '-removecomment': //archive1..n
   begin
   setcommentcl;
   end;
   '-peaziplanguage' :
   begin
   peaziplanguage(paramstr(2));
   end;
   '-peazipreset' :
   begin
   peazipreset;
   end;
   '-peaziptotalreset' :
   begin
   peaziptotalreset;
   end
   else termfunopen:=false;
   end;
if termfunopen=true then
   begin
   exit_nosave;
   end
else
begin
done_quickfunctions:=true;
//prepare_filebrowser;
fixbringtofront;
//set compression
fun_neutral:=fun;
if archive_type_selected=-1 then
   if df<18 then archive_type_select(FormPeach.cbType.Items[df])
   else archive_type_select(FormPeach.cbType.Items[pf])
else archive_type_select(FormPeach.cbType.Items[archive_type_selected]);
savestatus_archiver;
fun:=fun_neutral;
case lowercase(paramstr(1)) of
   '-add2preset' :
   begin
   add2custom('preset');
   exit;
   end;
   '-add2custom' :
   begin
   add2custom('custom');
   exit;
   end;
end;
//shell integration: if program is called with filename(s) as param(s) try to understand what functionality is likely to be requested otherwise start the requested user interface
if paramcount=0 then
   begin
   open_noinput;
   end
else
   if (paramcount=1) then //single input
      begin
      addtohistorypopup;
      case paramstr(1) of
         '-add2archive','-add2archive-add','-add2archive-update','-add2convert': //directly calling -add2archive shortcut open archive panel
         begin
         showpanel('archive');
         showpanel_trick;
         if paramstr(1)='-add2archive-add' then begin ComboBox7zFun.ItemIndex:=1; cbAct.Itemindex:=ComboBox7zFun.Itemindex; on_cbActChange; end;
         if paramstr(1)='-add2archive-update' then begin ComboBox7zFun.ItemIndex:=2; cbAct.Itemindex:=ComboBox7zFun.Itemindex; on_cbActChange; end;
         if paramstr(1)='-add2convert' then
            begin
            FormPeach.CheckBoxConvert.State:=cbChecked; FormPeach.CheckBoxConvertChange(nil);
            FormPeach.CheckBoxSeparate.State:=cbChecked;
            end;
         StringGridAdd.AutoSizeColumns;
         status1:='0 '+txt_dirs+' 0 '+txt_files+' 0 B';
         stayopen:=false;
         savetype:=true;
         exit;
         end;
         '-add2brotli','-add2bzip2','-add2gzip','-add2tar','-add2wim','-add2xz','-add2zstd','-add2zpaq',
         '-add2pea','-add2crypt','-add2peai','-add2crypti','-add2arc','-add2sfxarc','-add2rar',
         '-add27z','-add27zmail','-add2sfx7z','-add2sfx7zmail','-add2zip','-add2zipmail',
         '-add27zi','-add27zmaili','-add2sfx7zi','-add2sfx7zmaili','-add2zipi','-add2zipmaili',
         '-add2separate7z','-add2separatezip','-add2separate7zi','-add2separatezipi':
         begin
         showpanel('archive');
         showpanel_trick;
         setarchiveaction(paramstr(1));
         updatelayout('');
         cbSplit.ItemIndex:=0;//disable spanning when directly calling a specific format
         change_imagesplit;
         stayopen:=false;
         savetype:=false;
         exit;
         end;
         '-ext2main','-ext2full'://'-ext2here','-ext2smart','-ext2folder','-ext2newfolder':
         begin
         FormPeach.EditOutExtract.Text:=local_desktop;
         list_toextractor('none','full');
         stayopen:=false;
         end;
         '-ext2openasarchive':
         begin
         open_noinput;
         end;
         else
            begin
            //input is a single item
            condopenaction(paramstr(1));
            end;
         end;
      end
   else //multiple input
      begin
      addtohistorypopup;
      case paramstr(1) of
         '-ext2open' : //open a single file as archive, if type is supported
         begin
         if restoretabbar=1 then
            begin
            addptab;
            sortplustab;
            end;
         if (paramstr(2))<>'' then
            if (checkdirexists((paramstr(2)))) or ((paramstr(2))='Computer''s root') then
               begin
               fun:='FILEBROWSER';
               fun_status:=fun;
               s:=(paramstr(2));
               if s<>'' then
                  if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
               FormPeach.EditUn7zaFilter.Text:='*';
               showpanel('open');
               listdir(s,false,false);
               addtohistory;
               end
            else
               begin
               open_noinput; FormPeach.ListViewBrowser.Clear;
               FormPeach.visible:=true;
               open_archive_fromname((paramstr(2)));
               end;
         exit;
         end;
         '-ext2openasarchive' : //force to open a single file as archive
         begin
         if restoretabbar=1 then
            begin
            addptab;
            sortplustab;
            end;
         if (paramstr(2))<>'' then
            if checkdirexists((paramstr(2))) then
               begin
               fun:='FILEBROWSER';
               fun_status:=fun;
               s:=(paramstr(2));
               if s<>'' then
                  if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
               FormPeach.EditUn7zaFilter.Text:='*';
               showpanel('open');
               listdir(s,false,false);
               addtohistory;
               end
            else
               begin
               open_noinput; FormPeach.ListViewBrowser.Clear;
               FormPeach.visible:=true;
               forceopenasarchive:=true;
               open_archive_fromname((paramstr(2)));
               //forceopenasarchive:=false;
               end;
         exit;
         end;
         '-ext2main','-ext2full','-ext2here','-ext2smart','-ext2folder','-ext2newfolder','-ext2neutral',
         '-ext2downloads','-ext2desktop','-ext2documents',
         '-ext2bookmark1','-ext2bookmark2','-ext2bookmark3','-ext2bookmark4',
         '-ext2bookmark5','-ext2bookmark6','-ext2bookmark7','-ext2bookmark8':
         begin
         FormPeach.EditOutExtract.Text:=local_desktop;
         list_toextractor('none','full');
         dirpresent:=false;
         pparam1:=paramstr(1);
         q:=0;
         cbignore:=CheckBoxDeleteInputExt.Checked;
         for i:=2 to paramcount do
            begin
            if paramstr(i)='-i' then
               begin
               CheckBoxDeleteInputExt.Checked:=false;
               q:=q+1;
               end;
            if paramstr(i)='-o' then
               begin
               q:=q+2;
               end;
            if paramstr(i)='-p' then
               begin
               q:=q+2;
               FormPW.EditPWpass.Text:=paramstr(i+1);
               FormPW.EditPWconfirm.Text:=paramstr(i+1);
               end;
            end;

         for i:=q+2 to paramcount do
            if checkdirexists(ExpandFileName(paramstr(i))) then
               begin
               dirpresent:=true;
               s0:=extractfilepath(ExpandFileName(paramstr(i)));
               expand(ExpandFileName(paramstr(i)),exp_files,exp_fsizes,exp_ftimes,exp_fattr,exp_fattr_dec,nfound);
               for j:=0 to nfound-1 do
                  if pos('D',exp_fattr_dec[j])=0 then
                     begin
                     test_extfile(exp_files[j],okfile);
                     if okfile=true then
                        begin
                        if checkfiledirname(exp_files[j])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+exp_files[j]); exit; end;
                        deselectingrid(FormPeach.StringGridExtract);
                        addfilestr(FormPeach.StringGridExtract,exp_files[j]);
                        end;
                     end;
               end
            else
               begin
               test_extfile(ExpandFileName(paramstr(i)),okfile);
               if okfile=true then
                  begin
                  if checkfiledirname(ExpandFileName(paramstr(i)))<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+ExpandFileName(paramstr(i))); exit; end;
                  FormPeach.Caption:=txt_2_4_adding+' '+ExpandFileName(paramstr(i));
                  Application.ProcessMessages;
                  deselectingrid(FormPeach.StringGridExtract);
                  addfilestr(FormPeach.StringGridExtract,ExpandFileName(paramstr(i)));
                  end;
               end;
         if FormPeach.StringGridExtract.Rowcount>1 then
            if dirpresent=false then
               FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
            else
               FormPeach.EditOutExtract.Text:=s0//(last) directory's path
         else
            FormPeach.EditOutExtract.Text:=local_desktop;
         updatecontent_ext;
         stayopen:=false;

         for i:=2 to paramcount do
            begin
            if paramstr(i)='-o' then
               begin
               EditOutExtract.Text:=paramstr(i+1);
               end;
            end;

         if ParamStr(1)='-ext2downloads' then
            begin
            EditOutExtract.Text:=usr_downloads;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2desktop' then
            begin
            EditOutExtract.Text:=desktop_path;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2documents' then
            begin
            EditOutExtract.Text:=usr_documents;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark1' then
            begin
            EditOutExtract.Text:=mexttob1.caption;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark2' then
            begin
            EditOutExtract.Text:=mexttob2.caption;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark3' then
            begin
            EditOutExtract.Text:=mexttob3.caption;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark4' then
            begin
            EditOutExtract.Text:=mexttob4.caption;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark5' then
            begin
            EditOutExtract.Text:=mexttob5.caption;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark6' then
            begin
            EditOutExtract.Text:=mexttob6.caption;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark7' then
            begin
            EditOutExtract.Text:=mexttob7.caption;
            pparam1:='-ext2neutral';
            end;

         if ParamStr(1)='-ext2bookmark8' then
            begin
            EditOutExtract.Text:=mexttob8.caption;
            pparam1:='-ext2neutral';
            end;

         if pparam1='-ext2neutral' then
            begin
            if EditOutExtract.Text<>'' then
               if EditOutExtract.Text[length(EditOutExtract.Text)] <> directoryseparator then EditOutExtract.Text:=EditOutExtract.Text+directoryseparator;
            on_buttonextokclick;
            CheckBoxDeleteInputExt.Checked:=cbignore;
            save_conf;
            end;

         if pparam1='-ext2here' then
            begin
            if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
            FormPeach.CheckBoxFolder.State:=cbUnChecked;
            on_buttonextokclick;
            if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
            CheckBoxDeleteInputExt.Checked:=cbignore;
            save_conf;
            end;

         if (pparam1='-ext2smart') or (pparam1='-ext2folder') then
            begin
            if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
            sf:=removeintdir;
            FormPeach.CheckBoxFolder.State:=cbChecked;
            removeintdir:=1;
            on_buttonextokclick;
            if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
            removeintdir:=sf;
            CheckBoxDeleteInputExt.Checked:=cbignore;
            save_conf;
            end;

         if pparam1='-ext2newfolder' then
            begin
            if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
            sf:=removeintdir;
            FormPeach.CheckBoxFolder.State:=cbChecked;
            removeintdir:=0;
            on_buttonextokclick;
            if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
            removeintdir:=sf;
            CheckBoxDeleteInputExt.Checked:=cbignore;
            save_conf;
            end;

            {$IFDEF MSWINDOWS}
            SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(outpath),nil);
            {$ENDIF}
         CheckBoxDeleteInputExt.Checked:=cbignore;
         exit;
         end;
         '-add2archivemulti' :
         begin
         add2archivemulti;
         exit;
         end;
         '-add2archivemulticonvert' :
         begin
         add2archivemulticonvert;
         exit;
         end;
         '-add2archivemultiseparate' :
         begin
         add2archivemultiseparate;
         exit;
         end;
         '-add2archivemulti7z' :
         begin
         add2archivemulti7z;
         exit;
         end;
         '-add2archivemultigeneric' :
         begin
         add2archivemultigeneric;
         exit;
         end;
         '-add2archivemultizip' :
         begin
         add2archivemultizip;
         exit;
         end;
         '-add2archivemultisplit' :
         begin
         add2archivemultisplit;
         exit;
         end;
         '-add2archivemultisfx' :
         begin
         add2archivemultisfx;
         exit;
         end;
         '-ext2archivemultitest' :
         begin
         ext2archivemultitest;
         exit;
         end;
         '-ext2archivemulti' :
         begin
         ext2archivemulti;
         exit;
         end;
         '-ext2archivemultihere':
         begin
         ext2archivemultidir('here');
         exit;
         end;
         '-ext2archivemultismart' :
         begin
         ext2archivemultidir('smart');
         exit;
         end;
         '-ext2archivemultifolder' :
         begin
         ext2archivemultidir('folder');
         exit;
         end;
         '-ext2archivemultineutral' :
         begin
         ext2archivemultidir('neutral');
         exit;
         end;
         '-ext2archivemultidownloads' :
         begin
         ext2archivemultidir('downloads');
         exit;
         end;
         '-ext2archivemultidocuments' :
         begin
         ext2archivemultidir('documents');
         exit;
         end;
         '-ext2archivemultidesktop' :
         begin
         ext2archivemultidir('desktop');
         exit;
         end;
         '-ext2archivemultibookmark1' :
         begin
         ext2archivemultidir('bookmark1');
         exit;
         end;
         '-ext2archivemultibookmark2' :
         begin
         ext2archivemultidir('bookmark2');
         exit;
         end;
         '-ext2archivemultibookmark3' :
         begin
         ext2archivemultidir('bookmark3');
         exit;
         end;
         '-ext2archivemultibookmark4' :
         begin
         ext2archivemultidir('bookmark4');
         exit;
         end;
         '-ext2archivemultibookmark5' :
         begin
         ext2archivemultidir('bookmark5');
         exit;
         end;
         '-ext2archivemultibookmark6' :
         begin
         ext2archivemultidir('bookmark6');
         exit;
         end;
         '-ext2archivemultibookmark7' :
         begin
         ext2archivemultidir('bookmark7');
         exit;
         end;
         '-ext2archivemultibookmark8' :
         begin
         ext2archivemultidir('bookmark8');
         exit;
         end;
      end;
      showpanel('archive'); //otherwise, add to archive
      showpanel_trick;
      for i:=1 to paramcount do
         case paramstr(i) of
         '-add2archive','-add2split','-add2archive-add','-add2archive-update','-add2convert','-add2convimm',
         '-add2brotli','-add2bzip2','-add2gzip','-add2tar','-add2wim','-add2xz','-add2zstd','-add2zpaq',
         '-add2pea','-add2crypt','-add2peai','-add2crypti','-add2arc','-add2sfxarc','-add2rar',
         '-add27z','-add27zmail','-add2sfx7z','-add2sfx7zmail','-add2zip','-add2zipmail',
         '-add27zi','-add27zmaili','-add2sfx7zi','-add2sfx7zmaili','-add2zipi','-add2zipmaili',
         '-add2separate7z','-add2separatezip','-add2separate7zi','-add2separatezipi': begin end;
         else
            if testname(ExpandFileName(paramstr(i)), StringGridAdd)=0 then
               if filegetattr(ExpandFileName(paramstr(i))) > 0 then
                  if filegetattr(ExpandFileName(paramstr(i))) and faDirectory =0 then addfilestr(FormPeach.StringGridAdd,ExpandFileName(paramstr(i)))
                  else addfolderstr(FormPeach.StringGridAdd,ExpandFileName(paramstr(i)))
               else msg_not_accessible(i);
         end;
      case paramstr(1) of
         '-add2brotli','-add2bzip2','-add2gzip','-add2tar','-add2wim','-add2xz','-add2zstd','-add2zpaq',
         '-add2pea','-add2crypt','-add2peai','-add2crypti','-add2arc','-add2sfxarc','-add2rar',
         '-add27z','-add27zmail','-add2sfx7z','-add2sfx7zmail','-add2zip','-add2zipmail',
         '-add27zi','-add27zmaili','-add2sfx7zi','-add2sfx7zmaili','-add2zipi','-add2zipmaili',
         '-add2separate7z','-add2separatezip','-add2separate7zi','-add2separatezipi':
         begin
         setarchiveaction(paramstr(1));
         updatelayout('');
         cbSplit.ItemIndex:=0;//disable spanning when directly calling a specific format
         change_imagesplit;
         stayopen:=false;
         on_buttonarchiveclick;
         exit_nosave;
         exit;
         end;
      end;
      case paramstr(1) of
         '-add2archive-add':
         begin
         ComboBox7zFun.ItemIndex:=1;
         cbAct.Itemindex:=ComboBox7zFun.Itemindex;
         on_cbActChange;
         end;
         '-add2archive-update':
         begin
         ComboBox7zFun.ItemIndex:=2;
         cbAct.Itemindex:=ComboBox7zFun.Itemindex;
         on_cbActChange;
         end;
         '-add2convert':
         begin
         FormPeach.CheckBoxConvert.State:=cbChecked; FormPeach.CheckBoxConvertChange(nil);
         FormPeach.CheckBoxSeparate.State:=cbChecked;
         end;
         '-add2convimm':
         begin
         FormPeach.CheckBoxConvert.State:=cbChecked; FormPeach.CheckBoxConvertChange(nil);
         FormPeach.CheckBoxSeparate.State:=cbChecked;
         on_buttonarchiveclick;
         exit_nosave;
         exit;
         end;
         '-add2split':
         begin
         FormPeach.cbType.ItemIndex:=10;
         archive_type_select(txt_split);
         end;
      end;
      StringGridAdd.AutoSizeColumns;
      updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
      if completeshowpea=true then if enumd=1 then begin FormPeach.visible:=true; updatelayout(''); end;
      stayopen:=false;
      savetype:=true;
      end;
end;
end;
end;

procedure hideintro;
begin
{$IFDEF MSWINDOWS}
if FormPeach.PanelIntro.Visible=true then FormPeach.PanelIntro.Visible:=false;
{$ELSE}
if FormPeach.PanelIntro.Top=0 then FormPeach.PanelIntro.Top:=10000;
{$ENDIF}
FormPeach.Repaint;
end;

procedure finishlistview;
begin
if listviewcompleted=true then exit;
listviewcompleted:=true;

   {$IFDEF MSWINDOWS}
   if FormPeach.Visible=true then
      if FormPeach.StringgridList.Rowcount>1 then
         if FormPeach.StringgridList.Cells[1,1]<>'' then
            begin
            try
            FormPeach.ListViewBrowser.Items[FormPeach.StringGridList.Row-1].Focused:=true;
            FormPeach.ListViewBrowser.SetFocus;
            except
            end;
            end;
   {$ELSE}
   //Linux notes about TListView
   //GTK2 changing to vsIcon workaround is needed to correctly load small and large icons
   //Qt4 and Qt5 the workaround is disabled as with tested Lazarus/PFC versions it crashes chaging at runtime back to vsReport (which is default visual style), this bug also breaks changing visual style back to default vsReport at runtime for Qt versions
   {$IFDEF LCLQT}
   {$ELSE}
      {$IFDEF LCLQT5}
      {$ELSE}
      FormPeach.ListViewBrowser.ViewStyle:=vsIcon;
      {$ENDIF}
   {$ENDIF}
   loadsmallicons(smalliconsize);
   //loadlargeicons(largeiconsize);
   {$ENDIF}
   case browsertype of //note: currently needs to be called when the browser is rendered, or vsList style would not display right column size
   0: begin
      FormPeach.ListViewBrowser.ViewStyle:=vsReport;
      end;
   1: begin
      //FormPeach.ListViewBrowser.ViewStyle:=vsReport; //was needed to set correct size for list items
      FormPeach.ListViewBrowser.ViewStyle:=vsList;
      end;
   2: begin
      FormPeach.ListViewBrowser.ViewStyle:=vsIcon;
      end;
   end;
   FormPeach.mctype.checked:=ctype;
   FormPeach.mcsize.checked:=csize;
   FormPeach.mcpacked.checked:=cpacked;
   FormPeach.mcdate.checked:=cdate;
   FormPeach.mcatt.checked:=catt;
   FormPeach.mccrc.checked:=ccrc;
   FormPeach.mcfree.checked:=cfree;
   FormPeach.mcfs.checked:=cfs;
   FormPeach.pmctype.checked:=ctype;
   FormPeach.pmcsize.checked:=csize;
   FormPeach.pmcpacked.checked:=cpacked;
   FormPeach.pmcdate.checked:=cdate;
   FormPeach.pmcatt.checked:=catt;
   FormPeach.pmccrc.checked:=ccrc;
   FormPeach.pmcfree.checked:=cfree;
   FormPeach.pmcfs.checked:=cfs;
   FormPeach.mccreated.checked:=ccreated;
   FormPeach.mcaccessed.checked:=caccessed;
   FormPeach.mcmethod.checked:=cmethod;
   FormPeach.pmccreated.checked:=ccreated;
   FormPeach.pmcaccessed.checked:=caccessed;
   FormPeach.pmcmethod.checked:=cmethod;
   FormPeach.mccomment.checked:=ccomment;
   FormPeach.pmccomment.checked:=ccomment;
   set_rowselect;
   set_smartsortable;
   {$IFNDEF DARWIN}togglemenubar;{$ENDIF}
   setnav(navbar);
   setaddressbar(addressbar);
   settabbar(ptabbar);
   setfilterbrowser(filterbrowser);
   settoolbar;
   showtoolbar(-1);
   setbrowsersize(browsersize);
   set_swapbars;
   case lastbar of
      1: showbar('none');
      0: showbar('statusbar');
      2: showbar('bookmarks');
      3: showbar('recent');
      4: showbar('sessionrecent');
      5: showbar('clip');
   end;
   FormPeach.SplitterSide.Left:=(splitter2size*qscale) div 100;
   FormPeach.splitsearch.Left:=splitsearchsize;
   setshowthumbnails(showthumbnails);
   setbrowser_crchash(browserch);
   setsimplesearch(simplesearch);
   setrecsearch(recsearch);
   setrenfilesonly(renfilesonly);
   setusebreadcrumb(usebreadcrumb,0);
   set_listview_cnames;
   hideintro;
end;

{///////////////////////////////////////////////////////////////////////////////

subsection other form procedures

///////////////////////////////////////////////////////////////////////////////}

procedure TFormPeach.CheckBoxARCabsClick(Sender: TObject);
begin
on_CheckBoxARC3Click;
end;

procedure TFormPeach.CheckBoxMailAddClick(Sender: TObject);
begin
on_CheckBoxArchive4;
end;

procedure TFormPeach.CheckBoxAutoExtTarConvertClick(Sender: TObject);
begin
on_CheckBoxAutoExtTar1Click;
end;

procedure TFormPeach.CheckBoxAutoOpenTarClick(Sender: TObject);
begin
on_CheckBoxAutoOpenTarClick;
end;

procedure TFormPeach.CheckBoxAutoTestClick(Sender: TObject);
begin
on_CheckBoxAutoTestClick;
end;

procedure TFormPeach.CheckBoxBrotliClick(Sender: TObject);
begin
CheckBoxBrotli_onClick;
end;

procedure TFormPeach.CheckBoxConvertVerboseChange(Sender: TObject);
begin
on_checkboxconvertVerbose;
end;

procedure TFormPeach.CheckBoxConvertChange(Sender: TObject);
begin
if CheckBoxConvert.checked=true then
   begin
   LabelTitleAdd1.Caption:='      '+txt_2_8_convert+'      ';
   CheckBoxConvertPW.visible:=true;
   CheckBoxConvertVerbose.visible:=true;
   contextconvert_switch:=true;
   //SpeedButtonAdd.Enabled:=false;
   end
else
   begin
   LabelTitleAdd1.Caption:='      '+txt_archive+'      ';
   CheckBoxConvertPW.visible:=false;
   CheckBoxConvertVerbose.visible:=false;
   contextconvert_switch:=false;
   //SpeedButtonAdd.Enabled:=true;
   end;
end;

procedure TFormPeach.CheckBoxDateClick(Sender: TObject);
begin
if FormPeach.CheckBoxDate.State=cbChecked then addtstext:=1 else addtstext:=0;
end;

procedure TFormPeach.CheckBoxDeleteInputAddClick(Sender: TObject);
begin
on_CheckBoxDeleteInputAddClick;
end;

procedure TFormPeach.CheckBoxDeleteInputExtClick(Sender: TObject);
begin
on_CheckBoxDeleteInputClick;
end;

procedure TFormPeach.CheckBoxDragDropClick(Sender: TObject);
begin
on_CheckBoxDragDrop_click;
if nativedrag=1 then ignorepathdd:=0 else ignorepathdd:=1;
if nativedrag=1 then FormPeach.Timerdrag.Enabled:=true else FormPeach.Timerdrag.Enabled:=false;
end;

procedure TFormPeach.CheckBoxEditArchivesChange(Sender: TObject);
begin
on_CheckBoxEditArchives_click;
end;

procedure TFormPeach.CheckBoxMailKeepClick(Sender: TObject);
begin
on_CheckBoxMailKeepClick;
end;

procedure TFormPeach.CheckBoxSolidExtensionClick(Sender: TObject);
begin
CheckBoxMQS_onclick;
end;

procedure TFormPeach.CheckBoxBrowseNotVerboseClick(Sender: TObject);
begin
on_CheckBoxBrowseNotVerbose_click;
end;

procedure TFormPeach.CheckBoxCenteredToolbarClick(Sender: TObject);
begin
if CheckBoxCenteredToolbar.State=cbChecked then toolcentered:=1 else toolcentered:=0;
settoolbarw;
end;

procedure TFormPeach.CheckBoxClosePeaZipClick(Sender: TObject);
begin
if FormPeach.CheckBoxClosePeaZip.State=cbChecked then autoclosepeazip:=1 else autoclosepeazip:=0;
end;

procedure TFormPeach.CheckBoxConvertPWChange(Sender: TObject);
begin
on_checkboxconvertPW;
end;

procedure TFormPeach.ComboBoxLibreChange(Sender: TObject);
begin
on_ComboBoxLibreChange;
end;

procedure TFormPeach.ComboBoxprivacyChange(Sender: TObject);
begin
on_ComboBoxprivacyChange;
end;

procedure TFormPeach.ComboBoxSDChange(Sender: TObject);
begin
on_ComboBoxSDChange;
end;

procedure TFormPeach.comboRARdictChange(Sender: TObject);
begin
userardict:=comboRARdict.ItemIndex;
end;

procedure TFormPeach.ctrlarcClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ctrlarc.Left+ctrlarc.Width;
p.y:=ctrlarc.top+ctrlarc.Height;
p:=clienttoscreen(p);
PopupLayout.Alignment:=paRight;
PopupLayout.PopUp(p.x,p.y);
PopupLayout.Alignment:=paLeft;
end;

procedure TFormPeach.ctrlextClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ctrlext.Left+ctrlext.Width;
p.y:=ctrlext.top+ctrlext.Height;
p:=clienttoscreen(p);
FormPeach.StringGridExtract.popupmenu.Alignment:=paRight;
FormPeach.StringGridExtract.popupmenu.PopUp(p.x,p.y);
FormPeach.StringGridExtract.popupmenu.Alignment:=paLeft;
end;

procedure TFormPeach.CheckBox7zunrar5Click(Sender: TObject);
begin
on_CheckBox7zunrar5_click;
end;

procedure TFormPeach.cbAccentToolBarChange(Sender: TObject);
begin
accenttoolbar:=cbAccentToolBar.ItemIndex;
if openstarted=true then apply_theme;
end;

procedure TFormPeach.CheckBoxACClick(Sender: TObject);
begin
if FormPeach.CheckBoxAC.State=cbChecked then convint:=1 else convint:=0;
end;

procedure TFormPeach.cbAltBarChange(Sender: TObject);
begin
case cbAltBar.ItemIndex of
   1: altaddressstyle:=3;
   0: altaddressstyle:=0;
   2: altaddressstyle:=1;
   3: altaddressstyle:=2;
end;
if openstarted=true then apply_theme;
end;

procedure TFormPeach.cbAltTabStyleChange(Sender: TObject);
begin
alttabstyle:=cbAltTabStyle.ItemIndex;
if openstarted=true then
   begin
   apply_theme;
   settabs;
   end;
end;

procedure TFormPeach.cbAltTabsChange(Sender: TObject);
begin
highlighttabs:=cbAltTabs.ItemIndex;
settabaltcolor;
deselectlabels_options;
clicklabel_options(FormPeach.LabelTitleOptions6, FormPeach.ShapeOptions6);
end;

procedure TFormPeach.CheckBoxNoConfClick(Sender: TObject);
begin
on_CheckBoxNoConfClick;
end;

procedure TFormPeach.CheckBoxrelativeClick(Sender: TObject);
begin
on_checkboxrelativeclick;
end;

procedure TFormPeach.cbtimecreatedClick(Sender: TObject);
begin
cbtimecreated_onClick;
end;



procedure TFormPeach.mb0Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
showpanel('open');
addtobookmarks('*browser');
navrefresh;
end;

procedure TFormPeach.aowcustom1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(1, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(1, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom10Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(2, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(2, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.abc1Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc1.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.abc2Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc2.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.abc3Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc3.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.abc4Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc4.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.abc5Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc5.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.abc6Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc6.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.abc7Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc7.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.abc8Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abc8.Caption;
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.altF10Execute(Sender: TObject);
begin
winUACelevation;
end;

procedure TFormPeach.altF1Execute(Sender: TObject);
begin
cp_open(sharepath+'peazip_help.pdf',desk_env);
end;

procedure TFormPeach.ctrlalt0Execute(Sender: TObject);
begin
sortbrowser(13);
end;

procedure TFormPeach.ctrlalt1Execute(Sender: TObject);
begin
sortbrowser(2);
end;

procedure TFormPeach.ctrlalt2Execute(Sender: TObject);
begin
sortbrowser(14);
end;

procedure TFormPeach.ctrlalt3Execute(Sender: TObject);
begin
sortbrowser(15);
end;

procedure TFormPeach.ctrlalt4Execute(Sender: TObject);
begin
sortbrowser(5);
end;

procedure TFormPeach.ctrlalt5Execute(Sender: TObject);
begin
sortbrowser(6);
end;

procedure TFormPeach.ctrlalt6Execute(Sender: TObject);
begin
sortbrowser(7);
end;

procedure TFormPeach.ctrlalt7Execute(Sender: TObject);
begin
sortbrowser(8);
end;

procedure TFormPeach.ctrlalt8Execute(Sender: TObject);
begin
sortbrowser(10);
end;

procedure TFormPeach.ctrlalt9Execute(Sender: TObject);
begin
sortbrowser(11);
end;

procedure TFormPeach.ctrlaltenterExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then on_buttonarchiveclick
else
   {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.Top=0{$ENDIF} then on_buttonextokclick;
end;

procedure TFormPeach.ctrlaltN1Execute(Sender: TObject);
{$IFDEF MSWINDOWS}
var
H:HWND;
R: TRect;
fh:integer;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
movepform;
H:=GetActiveWindow();
GetWindowRect(H,R);
fh:=R.bottom-R.top;
FormPeach.Top:=Screen.Height-fh-tbh;
FormPeach.Left:=0;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltN2Execute(Sender: TObject);
{$IFDEF MSWINDOWS}
var
H:HWND;
R: TRect;
fw,fh:integer;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
movepform;
H:=GetActiveWindow();
GetWindowRect(H,R);
fh:=R.bottom-R.top;
fw:=R.right-R.left;
FormPeach.Top:=Screen.Height-fh-tbh;
FormPeach.Left:=0;
FormPeach.Width:=Screen.Width-fw+FormPeach.Width;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltN3Execute(Sender: TObject);
{$IFDEF MSWINDOWS}
var
H:HWND;
R: TRect;
fw,fh:integer;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
movepform;
H:=GetActiveWindow();
GetWindowRect(H,R);
fh:=R.bottom-R.top;
fw:=R.right-R.left;
FormPeach.Top:=Screen.Height-fh-tbh;
FormPeach.Left:=Screen.Width-fw;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltN4Execute(Sender: TObject);
{$IFDEF MSWINDOWS}
var
H:HWND;
R: TRect;
fh:integer;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
movepform;
H:=GetActiveWindow();
GetWindowRect(H,R);
fh:=R.bottom-R.top;
FormPeach.Top:=0;
FormPeach.Left:=0;
FormPeach.Height:=Screen.Height-fh+FormPeach.Height-tbh;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltN5Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
movepform;
FormPeach.Top:=64;
FormPeach.Left:=64;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltN6Execute(Sender: TObject);
{$IFDEF MSWINDOWS}
var
H:HWND;
R: TRect;
fh,fw:integer;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
movepform;
H:=GetActiveWindow();
GetWindowRect(H,R);
fh:=R.bottom-R.top;
fw:=R.right-R.left;
FormPeach.Top:=0;
FormPeach.Left:=Screen.Width-fw;
FormPeach.Height:=Screen.Height-fh+FormPeach.Height-tbh;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltN7Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
movepform;
FormPeach.Top:=0;
FormPeach.Left:=0;
{$ENDIF}
end;

procedure TFormPeach.alt0Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
case lasttoolbar of
1: showtoolbar(2);
2: showtoolbar(3);
3: showtoolbar(1);
end;
end;

procedure TFormPeach.alt1Execute(Sender: TObject);
begin
{$IFNDEF DARWIN}
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
showmenu:=not(showmenu);
togglemenubar;
showpanel('open');
{$ENDIF}
end;

procedure TFormPeach.alt2Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
ntoolstyle:=ntoolstyle+1;
if ntoolstyle>5 then ntoolstyle:=2;
settoolstyle(ntoolstyle);
end;

procedure TFormPeach.alt4Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
togglenavbar;
end;

procedure TFormPeach.alt5Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
case listcol of
1: sortbrowser(2);
12: sortbrowser(2);
2: sortbrowser(14);
3: sortbrowser(15);
13: sortbrowser(15);
4: sortbrowser(5);
14: sortbrowser(5);
5: sortbrowser(6);
6: sortbrowser(7);
7: sortbrowser(8);
8: sortbrowser(10);
9: sortbrowser(11);
10: sortbrowser(13);
end;
end;

procedure TFormPeach.alt6Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
tpreset:=tpreset+1;
if tpreset>3 then tpreset:=1;
settpreset(tpreset,browsersize,false);
end;

procedure TFormPeach.alt7Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
browsersize:=browsersize+1;
if browsersize>6 then browsersize:=0;
settpreset(tpreset,browsersize,false);
end;

procedure TFormPeach.alt8Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
togglestatusbar;
end;

procedure TFormPeach.altF3Execute(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TFormPeach.altF5Execute(Sender: TObject);
begin
select_all('0');
if open_archive<>1 then exit;
do_extract;
end;

procedure TFormPeach.altLEFTExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
navgoback;
end;

procedure TFormPeach.altRIGHTExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
navgofwd;
end;

procedure TFormPeach.altUPExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   {if (fun='UN7Z') or (fun='FILEBROWSER') then} navgoup;
end;

procedure TFormPeach.BKSPExecute(Sender: TObject);
begin
altUPExecute(nil);
end;

procedure TFormPeach.cbautobrowsetarChange(Sender: TObject);
begin
on_cbautobrowsetarChange;
end;

procedure TFormPeach.cbmiddlebuttonChange(Sender: TObject);
begin
on_cbmiddlebuttonClick;
end;

procedure TFormPeach.cbRARrvClick(Sender: TObject);
begin
if FormPeach.cbRARrv.State=cbChecked then userarrv:=1 else userarrv:=0;
end;

procedure TFormPeach.cbshowhiddenClick(Sender: TObject);
begin
on_cbshowhiddenclick;
end;

procedure TFormPeach.CheckBoxBackgroundClick(Sender: TObject);
begin
on_CheckBoxBackground_click;
end;

procedure TFormPeach.CheckBoxLimitKFSizeClick(Sender: TObject);
begin
on_CheckBoxLimitKFSize_click;
end;

procedure TFormPeach.CheckBoxLogClick(Sender: TObject);
begin
on_CheckBoxLog_click;
end;

procedure TFormPeach.CheckBoxParamsClick(Sender: TObject);
begin
on_CheckBoxParams_click;
end;

procedure TFormPeach.CheckBoxZstdErrPolicyClick(Sender: TObject);
begin
CheckBoxZstdErrPolicy_onclick;
end;

procedure TFormPeach.ComboBoxBrowserCloseUp(Sender: TObject);
begin
if openstarted=true then
   if FormPeach.Visible=true then
      if ComboBoxBrowser.ItemIndex>=4 then pMessageInfoOK(txt_11_1_pp);
on_CheckBoxPrebrowse_click;
end;

procedure TFormPeach.ComboBoxPAQThreadsChange(Sender: TObject);
begin
on_ComboBoxPAQ2Change;
end;

procedure TFormPeach.ComboBoxVirtualChange(Sender: TObject);
begin
on_comboboxvirtualchange;
end;

procedure TFormPeach.ctrl0Click(Sender: TObject);
begin
if (extractfilepath(pmqelast.Caption)<>'') then quickextract(lastextractionpath,'*neutral','all');
end;

procedure TFormPeach.ctrl1Click(Sender: TObject);
begin
if (extractfilepath(pnb1.Caption)<>'') then quickextract(extractfilepath(pnb1.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl2Click(Sender: TObject);
begin
if (extractfilepath(pnb2.Caption)<>'') then quickextract(extractfilepath(pnb2.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl3Click(Sender: TObject);
begin
if (extractfilepath(pnb3.Caption)<>'') then quickextract(extractfilepath(pnb3.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl4Click(Sender: TObject);
begin
if (extractfilepath(pnb4.Caption)<>'') then quickextract(extractfilepath(pnb4.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl5Click(Sender: TObject);
begin
if (extractfilepath(pnb5.Caption)<>'') then quickextract(extractfilepath(pnb5.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl6Click(Sender: TObject);
begin
if (extractfilepath(pnb6.Caption)<>'') then quickextract(extractfilepath(pnb6.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl7Click(Sender: TObject);
begin
if (extractfilepath(pnb7.Caption)<>'') then quickextract(extractfilepath(pnb7.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl8Click(Sender: TObject);
begin
if (extractfilepath(pnb8.Caption)<>'') then quickextract(extractfilepath(pnb8.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrl9Click(Sender: TObject);
begin
if (extractfilepath(pnb9.Caption)<>'') then quickextract(extractfilepath(pnb9.Caption),'*neutral','all');
end;

procedure TFormPeach.ctrlAExecute(Sender: TObject);
begin
select_all('1');
end;

procedure TFormPeach.ctrlaltN8Execute(Sender: TObject);
{$IFDEF MSWINDOWS}
var
H:HWND;
R: TRect;
fw:integer;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
movepform;
H:=GetActiveWindow();
GetWindowRect(H,R);
fw:=R.right-R.left;
FormPeach.Top:=0;
FormPeach.Left:=0;
FormPeach.Width:=Screen.Width-fw+FormPeach.Width;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltN9Execute(Sender: TObject);
{$IFDEF MSWINDOWS}
var
H:HWND;
R: TRect;
fw:integer;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
movepform;
H:=GetActiveWindow();
GetWindowRect(H,R);
fw:=R.right-R.left;
FormPeach.Top:=0;
FormPeach.Left:=Screen.Width-fw;
{$ENDIF}
end;

procedure TFormPeach.ctrlaltAExecute(Sender: TObject);
begin
ListViewBrowser.Column[0].AutoSize:=true;
ListViewBrowser.Column[1].AutoSize:=true;
ListViewBrowser.Column[2].AutoSize:=true;
ListViewBrowser.Column[3].AutoSize:=true;
ListViewBrowser.Column[4].AutoSize:=true;
ListViewBrowser.Column[5].AutoSize:=true;
ListViewBrowser.Column[6].AutoSize:=true;
ListViewBrowser.Column[7].AutoSize:=true;
ListViewBrowser.Column[8].AutoSize:=true;
ListViewBrowser.Column[9].AutoSize:=true;
ListViewBrowser.Column[10].AutoSize:=true;
ListViewBrowser.Column[11].AutoSize:=true;
ListViewBrowser.Column[0].AutoSize:=false;
ListViewBrowser.Column[1].AutoSize:=false;
ListViewBrowser.Column[2].AutoSize:=false;
ListViewBrowser.Column[3].AutoSize:=false;
ListViewBrowser.Column[4].AutoSize:=false;
ListViewBrowser.Column[5].AutoSize:=false;
ListViewBrowser.Column[6].AutoSize:=false;
ListViewBrowser.Column[7].AutoSize:=false;
ListViewBrowser.Column[8].AutoSize:=false;
ListViewBrowser.Column[9].AutoSize:=false;
ListViewBrowser.Column[10].AutoSize:=false;
ListViewBrowser.Column[11].AutoSize:=false;
if EditOpenIn.Text=txt_mypc then
   begin
   ListViewBrowser.Column[0].Width:=COL1D;
   ListViewBrowser.Column[1].Width:=COL7D;
   ListViewBrowser.Column[2].Width:=COL2D;
   ListViewBrowser.Column[3].Width:=COL2D;
   ListViewBrowser.Column[4].Width:=COL5D;
   ListViewBrowser.Column[5].Width:=0;
   ListViewBrowser.Column[6].Width:=0;
   ListViewBrowser.Column[7].Width:=0;
   ListViewBrowser.Column[8].Width:=0;
   ListViewBrowser.Column[9].Width:=0;
   ListViewBrowser.Column[10].Width:=0;
   ListViewBrowser.Column[11].Width:=0;
   end
else
   begin
   if fun<>'UN7Z' then
      begin
      ListViewBrowser.Column[0].Width:=COL1D;
      ListViewBrowser.Column[1].Width:=COL2D;
      ListViewBrowser.Column[2].Width:=COL3D;
      ListViewBrowser.Column[3].Width:=COL4D;
      ListViewBrowser.Column[4].Width:=COL5D;
      ListViewBrowser.Column[5].Width:=0;
      ListViewBrowser.Column[6].Width:=0;
      ListViewBrowser.Column[7].Width:=0;
      ListViewBrowser.Column[8].Width:=0;
      ListViewBrowser.Column[9].Width:=COL6D;
      ListViewBrowser.Column[10].Width:=COL7D;
      end
   else
      begin
      ListViewBrowser.Column[0].Width:=COL1D;
      ListViewBrowser.Column[1].Width:=COL2D;
      ListViewBrowser.Column[2].Width:=COL3D;
      ListViewBrowser.Column[3].Width:=COL4D;
      ListViewBrowser.Column[4].Width:=COL5D;
      ListViewBrowser.Column[5].Width:=COL5D;
      ListViewBrowser.Column[6].Width:=COL5D;
      ListViewBrowser.Column[7].Width:=COL7D;
      ListViewBrowser.Column[8].Width:=COL7D;
      ListViewBrowser.Column[9].Width:=COL6D;
      ListViewBrowser.Column[10].Width:=COL7D;
      end;
   {$IFDEF MSWINDOWS}
   if status0=txt_list_browsing then FormPeach.ListViewBrowser.Column[11].Width:=0
   else FormPeach.ListViewBrowser.Column[11].Width:=384;
   {$ELSE}
   if status0=txt_list_browsing then FormPeach.ListViewBrowser.Column[11].Visible:=false
   else begin FormPeach.ListViewBrowser.Column[11].Visible:=true; FormPeach.ListViewBrowser.Column[11].Width:=384; end;
   {$ENDIF}
   end;
col1size:=FormPeach.ListViewBrowser.Column[0].Width;
if ctype=true then col2size:=FormPeach.ListViewBrowser.Column[1].Width;
if csize=true then col3size:=FormPeach.ListViewBrowser.Column[2].Width;
if cpacked=true then col4size:=FormPeach.ListViewBrowser.Column[3].Width;
if cdate=true then col5size:=FormPeach.ListViewBrowser.Column[4].Width;
if cmethod=true then colmethodsize:=FormPeach.ListViewBrowser.Column[7].Width;
if ccomment=true then colcommentsize:=FormPeach.ListViewBrowser.Column[8].Width;
if catt=true then col6size:=FormPeach.ListViewBrowser.Column[9].Width;
if ccrc=true then col7size:=FormPeach.ListViewBrowser.Column[10].Width;
end;

procedure TFormPeach.ctrlaltDClick(Sender: TObject);
begin
quickextract(local_desktop,'*neutral','all');
end;

procedure TFormPeach.ctrlaltEClick(Sender: TObject);
begin
do_extallto('all');
end;

procedure TFormPeach.ctrlaltHExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if stringgridsessionhistory.visible=false then showbar('sessionrecent') else showbar('statusbar');
end;

procedure TFormPeach.ctrlarcMouseEnter(Sender: TObject);
begin
CopyMenu(MainMenu1,pmmain);
end;

procedure TFormPeach.ctrlBExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if StringGridSessionHistory.RowCount>2 then
   begin
   StringGridSessionHistory.Row:=StringGridSessionHistory.Row-1;
   browsehistory;
   end;
end;

procedure TFormPeach.ctrlDExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if stringgridbookmarks.visible=false then showbar('bookmarks') else showbar('statusbar');
end;

procedure TFormPeach.ctrldotExecute(Sender: TObject);
begin
FormPeach.cbshowhidden.Checked:=not(FormPeach.cbshowhidden.Checked);
on_cbshowhiddenclick;
end;

procedure TFormPeach.ctrlextMouseEnter(Sender: TObject);
begin
CopyMenu(MainMenu1,pmmain);
end;

procedure TFormPeach.ctrlF10Execute(Sender: TObject);
var
   P:tprocessutf8;
   cl,u:ansistring;
   r:boolean;
begin
{$IFDEF MSWINDOWS}
u:='Administrator';
r:=pInputQuery(txt_run_as, txt_user_name, '', u, false);
if not(r) then begin P.Free; exit; end;
if u='' then begin P.Free; exit; end;
cl:='runas /env /user:'+u+' "'+executable_path+'peazip.exe"';
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
{$ELSE}//system needs to support sudo
u:='root';
r:=pInputQuery(txt_run_as, txt_user_name, '', u, false);
if not(r) then begin P.Free; exit; end;
if u='' then begin P.Free; exit; end;
cl:='sudo -u '+u+' '''+executable_path+'peazip''';
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Options:=[poNewConsole];
{$ENDIF}
peapexecute(P,cl);
P.Free;
exit_withsave;
end;

procedure TFormPeach.ctrlF12Execute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if FormPeach.MenuItemOpen_preview.visible=true then
      openwith_cust('preview','run',0)
   else
      run_custom('');
end;

procedure TFormPeach.ctrlF1Execute(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help-faq.html',desk_env);
end;

procedure TFormPeach.ctrlF3Execute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then launch_nrsearch;
end;

procedure TFormPeach.ctrlF4Execute(Sender: TObject);
begin
jumpto('desktop');
end;

procedure TFormPeach.ctrlF5Execute(Sender: TObject);
begin
do_extract;
end;

procedure TFormPeach.ctrlF8Execute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then jumpto('bookmark2');
end;

procedure TFormPeach.ctrlF9Execute(Sender: TObject);
begin
get_fingerprint (fingerprint,false);
Whirl_Init(ment);
Whirl_Init(kent);
Whirl_Init(fent);
FormKF.Showmodal;
end;

procedure TFormPeach.ctrlFExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if StringGridSessionHistory.Row<StringGridSessionHistory.RowCount-1 then
   begin
   StringGridSessionHistory.Row:=StringGridSessionHistory.Row+1;
   browsehistory;
   end;
end;

procedure TFormPeach.ctrlHExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if stringgridrecent.visible=false then showbar('recent') else showbar('statusbar');
end;

procedure TFormPeach.ctrlNExecute(Sender: TObject);
begin
mtogglenew.checked:=not(mtogglenew.checked);
if mtogglenew.checked=true then tonewfolder:=1
else tonewfolder:=0;
updateconf_modified;
settonewfolder(tonewfolder);
end;

procedure TFormPeach.ctrlWExecute(Sender: TObject);
begin
exit_withsave;
end;

procedure TFormPeach.EditOptSearchEditingDone(Sender: TObject);
begin
//if those Settings items are moved the following code needs to be updated to match the new position of items
if EditOptSearch.Caption=txt_general then
   begin
   clicklabel_options(LabelTitleOptions1, ShapeOptions1);
   positem(PageOpt1,0);
   end;
if (EditOptSearch.Caption=txt_localization) or
   (EditOptSearch.Caption=txt_9_2_tfaq) or
   (EditOptSearch.Caption=txt_3_1_languagetools) or
   (EditOptSearch.Caption=txt_3_0_configure) or
   (EditOptSearch.Caption=txt_6_8_ndrop) or
   (EditOptSearch.Caption=txt_7_8_dd) then
   begin
   clicklabel_options(LabelTitleOptions1, ShapeOptions1);
   positem(PageOpt1,Labelogmisc.top);
   end;
if (EditOptSearch.Caption=txt_5_0_perf) or
   (EditOptSearch.Caption=txt_8_1_bo) or
   (EditOptSearch.Caption=txt_10_6_virtual) then
   begin
   clicklabel_options(LabelTitleOptions1, ShapeOptions1);
   positem(PageOpt1,Labelogperf.Top);
   end;
if (EditOptSearch.Caption=txt_6_5_privacy) or
   (EditOptSearch.Caption=txt_3_1_workingdir) or
   (EditOptSearch.Caption=txt_reset) then
   begin
   clicklabel_options(LabelTitleOptions1, ShapeOptions1);
   positem(PageOpt1,Labelogreset.Top);
   end;

if EditOptSearch.Caption=txt_2_6_advanced then
   begin
   clicklabel_options(LabelTitleOptions2, ShapeOptions2);
   positem(PageOpt2,0);
   end;
if (EditOptSearch.Caption=txt_2_5_encoding) or
   (EditOptSearch.Caption=txt_7_6_zipenc) or
   (EditOptSearch.Caption=txt_3_1_sccenc) then
   begin
   clicklabel_options(LabelTitleOptions2, ShapeOptions2);
   positem(PageOpt2,Labeloaenc.top);
   end;
if (EditOptSearch.Caption=txt_path) or
   (EditOptSearch.Caption=txt_3_2_conf) or
   (EditOptSearch.Caption=txt_3_3_apppath) or
   (EditOptSearch.Caption=txt_5_9_start) then
   begin
   clicklabel_options(LabelTitleOptions2, ShapeOptions2);
   positem(PageOpt2,Labelogpaths.top);
   end;
if (EditOptSearch.Caption=txt_backend) or
   (EditOptSearch.Caption=txt_9_5_sb) or
   (EditOptSearch.Caption=txt_9_1_7zs) or
   (EditOptSearch.Caption=txt_9_2_7za) or
   (EditOptSearch.Caption=txt_8_3_maxarg) then
   begin
   clicklabel_options(LabelTitleOptions2, ShapeOptions2);
   positem(PageOpt2,Labeloaui.top);
   end;

if EditOptSearch.Caption=txt_4_6_am then
   begin
   clicklabel_options(LabelTitleOptions3, ShapeOptions3);
   positem(PageOpt3,0);
   end;
if (EditOptSearch.Caption=txt_browser) or
   (EditOptSearch.Caption=txt_6_9_autou) or
   (EditOptSearch.Caption=txt_8_0_forcebrowse) or
   (EditOptSearch.Caption=txt_6_6_forcemodify) or
   (EditOptSearch.Caption=txt_6_5_force) or
   (EditOptSearch.Caption=txt_8_0_defaultaction) or
   (EditOptSearch.Caption=txt_2_9_tree) or
   (EditOptSearch.Caption=txt_8_0_setpwopt) then
   begin
   clicklabel_options(LabelTitleOptions3, ShapeOptions3);
   positem(PageOpt3,Labeloambrowser.top);
   end;
if (EditOptSearch.Caption='TAR') or
   (EditOptSearch.Caption=txt_7_0_autoopentar) or
   (EditOptSearch.Caption=txt_9_0_autoexttar) then
   begin
   clicklabel_options(LabelTitleOptions3, ShapeOptions3);
   positem(PageOpt3,Labeloamtar.top);
   end;
if (EditOptSearch.Caption=txt_8_7_after) or
   (EditOptSearch.Caption=txt_7_3_noconfdel) or
   (EditOptSearch.Caption=txt_2_7_oop) or
   (EditOptSearch.Caption=txt_8_8_autotest) then
   begin
   clicklabel_options(LabelTitleOptions3, ShapeOptions3);
   positem(PageOpt3,Labeloafter.top);
   end;
if (EditOptSearch.Caption=txt_archive) or
   (EditOptSearch.Caption=txt_default_format) or
   (EditOptSearch.Caption=txt_7_4_setarc)then
   begin
   clicklabel_options(LabelTitleOptions3, ShapeOptions3);
   positem(PageOpt3,Labeloamext1.top);
   end;
if (EditOptSearch.Caption=txt_caption_extract) or
   (EditOptSearch.Caption=txt_5_5_intdir) or
   (EditOptSearch.Caption=txt_7_5_ee) or
   (EditOptSearch.Caption=txt_7_4_setext)then
   begin
   clicklabel_options(LabelTitleOptions3, ShapeOptions3);
   positem(PageOpt3,Labeloamext.top);
   end;

if EditOptSearch.Caption=txt_4_6_fm then
   begin
   clicklabel_options(LabelTitleOptions4, ShapeOptions4);
   positem(PageOpt4,0);
   end;
if (EditOptSearch.Caption=txt_filebrowser) or
   (EditOptSearch.Caption=txt_10_5_sectype) then
   begin
   clicklabel_options(LabelTitleOptions4, ShapeOptions4);
   positem(PageOpt4,Labeloptsub8.top);
   end;
if (EditOptSearch.Caption=txt_filetools) or
   (EditOptSearch.Caption=txt_check_select) or
   (EditOptSearch.Caption=txt_securedelete) then
   begin
   clicklabel_options(LabelTitleOptions4, ShapeOptions4);
   positem(PageOpt4,Labeloptsub1.top);
   end;

if EditOptSearch.Caption=txt_3_3_apps then
   begin
   clicklabel_options(LabelTitleOptions5, ShapeOptions5);
   positem(PageOpt5,0);
   end;

if (EditOptSearch.Caption=txt_theme) or
   (EditOptSearch.Caption=txt_3_5_td) then
   begin
   clicklabel_options(LabelTitleOptions6, ShapeOptions6);
   positem(PageOpt6,0);
   end;
if (EditOptSearch.Caption=txt_7_9_zooming) or
   (EditOptSearch.Caption=txt_create_theme) then
   begin
   clicklabel_options(LabelTitleOptions6, ShapeOptions6);
   positem(PageOpt6,Labelzooming.top);
   end;

if EditOptSearch.Caption=txt_2_5_help then
   begin
   clicklabel_options(LabelTitleOptions7, ShapeOptions7);
   positem(PageOpt7,0);
   end;
if (EditOptSearch.Caption=txt_peazip_help) or
   (EditOptSearch.Caption='FAQ') or
   (EditOptSearch.Caption=txt_3_7_tracker) or
   (EditOptSearch.Caption=txt_9_2_changelog) or
   (EditOptSearch.Caption=txt_2_5_offline_help) then
   begin
   clicklabel_options(LabelTitleOptions7, ShapeOptions7);
   positem(PageOpt7,baboutfaq.top);
   end;

if EditOptSearch.Caption=txt_about then
   begin
   clicklabel_options(LabelTitleOptions8, ShapeOptions8);
   positem(PageOpt8,0);
   end;
if (EditOptSearch.Caption=txt_4_5_update) or
   (EditOptSearch.Caption=txt_7_8_update) or
   (EditOptSearch.Caption=txt_5_5_plugin) then
   begin
   clicklabel_options(LabelTitleOptions8, ShapeOptions8);
   positem(PageOpt8,baboutup.top);
   end;
if EditOptSearch.Caption=txt_8_7_verifybin then
   begin
   clicklabel_options(LabelTitleOptions8, ShapeOptions8);
   positem(PageOpt8,baboutbin.top);
   end;

if EditOptSearch.Caption=txt_4_3_pwman then setpm(1);

if EditOptSearch.Caption=txt_pw then f9pwpromptExecute(nil);

if (EditOptSearch.Caption=txt_4_7_pk) or
   (EditOptSearch.Caption=txt_keyfile) then shiftF9Execute(nil);

if EditOptSearch.Caption=txt_8_5_samplescripts then msamplescriptsClick(nil);

if EditOptSearch.Caption=txt_4_5_pj then mscriptsClick(nil);

EditOptSearch.Caption:='';
//PanelTitleOptions.SetFocus; //unfocus search filed, less usable
end;

procedure TFormPeach.escExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then gocancelarchive
else
   {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.Top=0{$ENDIF} then gocancelextract;
end;

procedure TFormPeach.f11fullscreenExecute(Sender: TObject);
begin
pimmersive:=0;
if FormPeach.WindowState<>wsMaximized then FormPeach.WindowState:=wsMaximized
else FormPeach.WindowState:=wsNormal;
if FormPeach.BorderStyle=bsNone then FormPeach.BorderStyle:=bsSizeable;
end;

procedure runfunctions;
var
   s:ansistring;
begin
if {$IFDEF MSWINDOWS}FormPeach.PanelOpen.Visible=false{$ELSE}FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
s:=FormPeach.pmfun1.Caption;
if not pInputQuery(txt_4_8_fun, txt_11_2_funexp, '', s, false) then exit;
if s='' then exit;
do_pmfun(s);
end;

procedure TFormPeach.F12Execute(Sender: TObject);
begin
runfunctions;
end;

procedure TFormPeach.F1Execute(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions7, ShapeOptions7);
end;

procedure TFormPeach.f9pwpromptExecute(Sender: TObject);
var
   i:integer;
begin
{$IFDEF MSWINDOWS}if PanelOpen.visible=true{$ELSE}if PanelOpen.top=0{$ENDIF} then ask_pwkeyfile
else
   repeat
   i:=ask_pwkeyfile_core;
   until i>=0;
end;

procedure TFormPeach.aowcustom11Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(3, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(3, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom12Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(4, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(4, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom13Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(5, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(5, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom14Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(6, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(6, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom15Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(7, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(7, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom16Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(8, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(8, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(2, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(2, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(3, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(3, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(4, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(4, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(5, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(5, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(6, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(6, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(7, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(7, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(8, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(8, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom9Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_advcustedit(1, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_advcustedit(1, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_10Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(10, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(10, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_11Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(11, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(11, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_12Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(12, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(12, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_13Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(13, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(13, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_14Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(14, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(14, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_15Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(15, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(15, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_16Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(16, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(16, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.aowcustom_9Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount>1 then open_custedit(9, StringGridAdd.Cells[8,StringGridAdd.Row])
   else
else
   if StringGridExtract.Rowcount>1 then open_custedit(9, StringGridExtract.Cells[8,StringGridExtract.Row]);
end;

procedure TFormPeach.baboutbinClick(Sender: TObject);
begin
internalbincheck;
end;

procedure TFormPeach.baboutchangelogClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'changelog.html',desk_env);
end;

procedure TFormPeach.baboutfaqClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help-faq.html',desk_env);
end;

procedure TFormPeach.baboutlocalhelpClick(Sender: TObject);
begin
cp_open(sharepath+'peazip_help.pdf',desk_env);
end;

procedure TFormPeach.baboutplugindirClick(Sender: TObject);
begin
cp_open(binpath,desk_env);
end;

procedure TFormPeach.baboutthemesClick(Sender: TObject);
begin
checkthemes;
end;

procedure TFormPeach.baboutpluginsClick(Sender: TObject);
begin
checkplugins;
end;

procedure TFormPeach.baboutremoveunaceClick(Sender: TObject);
var
   s:ansistring;
begin
s:=binpath+'unace'+DirectorySeparator;
cleardirsimple(s);
updatepluginstatus;
end;

procedure TFormPeach.baboutremoveunrarClick(Sender: TObject);
var
   s:ansistring;
begin
s:=binpath+'unrar'+DirectorySeparator;
cleardirsimple(s);
updatepluginstatus;
end;

procedure TFormPeach.baboutsupportClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help.html',desk_env);
end;

procedure TFormPeach.babouttosClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-tos-privacy.html',desk_env);
end;

procedure TFormPeach.babouttrackerClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-more.html',desk_env);
end;

procedure TFormPeach.babouttranslationsClick(Sender: TObject);
begin
checktranslations;
end;

procedure TFormPeach.baboutupClick(Sender: TObject);
begin
checkupdates;
end;

procedure TFormPeach.baboutwebClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'index.html',desk_env);
end;

procedure TFormPeach.BScheduleExtClick(Sender: TObject);
begin
schedule_create(1);
end;

procedure TFormPeach.BScheduleClick(Sender: TObject);
begin
schedule_create(0);
end;

procedure TFormPeach.ButtonOptOKClick(Sender: TObject);
begin
updateconf_modified;
set_custedit_fromtable;
set_custedit_menus;
save_custedit;
setspecialextensions;
setsecurityextensions;
activelabel_options:=LabelTitleOptions1;
clicklabel_options(LabelTitleoptions1,ShapeOptions1);
setzencoding;
showpanel(prevpanel);
Caption:=prevcaption;
if prevpanel='open' then FormPeach.f5refreshExecute(nil);
end;

procedure TFormPeach.ButtonArchiveCancelClick(Sender: TObject);
begin
if goarchiving=true then exit;
goarchiving:=true;
endmultimode;
gocancelarchive;
goarchiving:=false;
end;

procedure TFormPeach.ButtonDupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TFormPeach.ButtonOutAddClick(Sender: TObject);
var
   p:TPoint;
begin
populatepcmenu;
p.x:=PanelAddArchiveOut.Left+ButtonOutAdd.Left;
p.y:=OptionsAdd.top+PanelAddArchiveOut.Top+ButtonOutAdd.top+ButtonOutAdd.Height+PanelTitleExtract.Height;
p:=clienttoscreen(p);
setrecenticons_extract_archive;
mpathreset1.Caption:=txt_lastused+' '+lastoutpath;
PopupPathArchive.PopUp(p.x,p.y);
end;

procedure TFormPeach.LabelClickAddress1DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.LabelClickAddress2DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.LabelClickAddress3DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.LabelClickAddress4DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.LabelClickAddress5DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.LabelClickAddress6DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.LabelClickAddress7DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.LabelClickAddress8DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.MenuItemERBrowserClick(Sender: TObject);
begin
openwith_base('extandrun','browser');
end;

procedure TFormPeach.MenuItemForceThumbnailsClick(Sender: TObject);
begin
forcethumbnails;
end;

procedure TFormPeach.MenuItemPreBrowserClick(Sender: TObject);
begin
openwith_base('preview','browser');
end;

procedure TFormPeach.MenuItemCopypathsMenuClick(Sender: TObject);
begin
copypaths;
end;

procedure previewinternal; //if first selected item is a text use text preview, else use image preview, on the entire list of selected items
var
   i:integer;
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      if istexttype(FormPeach.StringGridList.Cells[2,i])=true then
         begin
         hexpselected_list('TEXTPREVIEW');
         exit;
         end;
viewimageloop;
end;

procedure TFormPeach.MenuItemViewImageClick(Sender: TObject);
begin
previewinternal;
end;

procedure qexpc(inname:AnsiString);
var
   s:ansistring;
begin
s:=inname;
s:=copy(s,2,2)+directoryseparator;
quickextract(extractfilepath(s),'*neutral','selected');
end;

procedure TFormPeach.mextto10Click(Sender: TObject);
begin
qexpc(mextto10.Caption);
end;

procedure TFormPeach.mextto11Click(Sender: TObject);
begin
qexpc(mextto11.Caption);
end;

procedure TFormPeach.mextto12Click(Sender: TObject);
begin
qexpc(mextto12.Caption);
end;

procedure TFormPeach.mextto13Click(Sender: TObject);
begin
qexpc(mextto13.Caption);
end;

procedure TFormPeach.mextto14Click(Sender: TObject);
begin
qexpc(mextto14.Caption);
end;

procedure TFormPeach.mextto15Click(Sender: TObject);
begin
qexpc(mextto15.Caption);
end;

procedure TFormPeach.mextto16Click(Sender: TObject);
begin
qexpc(mextto16.Caption);
end;

procedure TFormPeach.mextto17Click(Sender: TObject);
begin
qexpc(mextto17.Caption);
end;

procedure TFormPeach.mextto18Click(Sender: TObject);
begin
qexpc(mextto18.Caption);
end;

procedure TFormPeach.mextto19Click(Sender: TObject);
begin
qexpc(mextto19.Caption);
end;

procedure TFormPeach.mextto1Click(Sender: TObject);
begin
qexpc(mextto1.Caption);
end;

procedure TFormPeach.mextto20Click(Sender: TObject);
begin
qexpc(mextto20.Caption);
end;

procedure TFormPeach.mextto21Click(Sender: TObject);
begin
qexpc(mextto21.Caption);
end;

procedure TFormPeach.mextto22Click(Sender: TObject);
begin
qexpc(mextto22.Caption);
end;

procedure TFormPeach.mextto23Click(Sender: TObject);
begin
qexpc(mextto23.Caption);
end;

procedure TFormPeach.mextto24Click(Sender: TObject);
begin
qexpc(mextto24.Caption);
end;

procedure TFormPeach.mextto25Click(Sender: TObject);
begin
qexpc(mextto25.Caption);
end;

procedure TFormPeach.mextto26Click(Sender: TObject);
begin
qexpc(mextto26.Caption);
end;

procedure TFormPeach.mextto2Click(Sender: TObject);
begin
qexpc(mextto2.Caption);
end;

procedure TFormPeach.mextto3Click(Sender: TObject);
begin
qexpc(mextto3.Caption);
end;

procedure TFormPeach.mextto4Click(Sender: TObject);
begin
qexpc(mextto4.Caption);
end;

procedure TFormPeach.mextto5Click(Sender: TObject);
begin
qexpc(mextto5.Caption);
end;

procedure TFormPeach.mextto6Click(Sender: TObject);
begin
qexpc(mextto6.Caption);
end;

procedure TFormPeach.mextto7Click(Sender: TObject);
begin
qexpc(mextto7.Caption);
end;

procedure TFormPeach.mextto8Click(Sender: TObject);
begin
qexpc(mextto8.Caption);
end;

procedure TFormPeach.mextto9Click(Sender: TObject);
begin
qexpc(mextto9.Caption);
end;

procedure TFormPeach.mexttob10Click(Sender: TObject);
begin
if (extractfilepath(mexttob10.Caption)<>'') then quickextract(extractfilepath(mexttob10.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob11Click(Sender: TObject);
begin
if (extractfilepath(mexttob11.Caption)<>'') then quickextract(extractfilepath(mexttob11.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob12Click(Sender: TObject);
begin
if (extractfilepath(mexttob12.Caption)<>'') then quickextract(extractfilepath(mexttob12.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob13Click(Sender: TObject);
begin
if (extractfilepath(mexttob13.Caption)<>'') then quickextract(extractfilepath(mexttob13.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob14Click(Sender: TObject);
begin
if (extractfilepath(mexttob14.Caption)<>'') then quickextract(extractfilepath(mexttob14.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob15Click(Sender: TObject);
begin
if (extractfilepath(mexttob15.Caption)<>'') then quickextract(extractfilepath(mexttob15.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob16Click(Sender: TObject);
begin
if (extractfilepath(mexttob16.Caption)<>'') then quickextract(extractfilepath(mexttob16.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob17Click(Sender: TObject);
begin
if (extractfilepath(mexttob17.Caption)<>'') then quickextract(extractfilepath(mexttob17.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob18Click(Sender: TObject);
begin
if (extractfilepath(mexttob18.Caption)<>'') then quickextract(extractfilepath(mexttob18.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob19Click(Sender: TObject);
begin
if (extractfilepath(mexttob19.Caption)<>'') then quickextract(extractfilepath(mexttob19.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob20Click(Sender: TObject);
begin
if (extractfilepath(mexttob20.Caption)<>'') then quickextract(extractfilepath(mexttob20.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob21Click(Sender: TObject);
begin
if (extractfilepath(mexttob21.Caption)<>'') then quickextract(extractfilepath(mexttob21.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob22Click(Sender: TObject);
begin
if (extractfilepath(mexttob22.Caption)<>'') then quickextract(extractfilepath(mexttob22.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob23Click(Sender: TObject);
begin
if (extractfilepath(mexttob23.Caption)<>'') then quickextract(extractfilepath(mexttob23.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob9Click(Sender: TObject);
begin
if (extractfilepath(mexttob9.Caption)<>'') then quickextract(extractfilepath(mexttob9.Caption),'*neutral','selected');
end;

procedure TFormPeach.mextto_desktopClick(Sender: TObject);
begin
quickextract(extractfilepath(local_desktop),'*neutral','selected');
end;

procedure TFormPeach.mextto_documentsClick(Sender: TObject);
begin
quickextract(extractfilepath(usr_documents),'*neutral','selected');
end;

procedure TFormPeach.mextto_downloadsClick(Sender: TObject);
begin
quickextract(extractfilepath(usr_downloads),'*neutral','selected');
end;

procedure TFormPeach.mextto_dropboxClick(Sender: TObject);
begin
quickextract(extractfilepath(shared_dropbox),'*neutral','selected');
end;

procedure TFormPeach.mextto_googledriveClick(Sender: TObject);
begin
quickextract(extractfilepath(shared_googledrive),'*neutral','selected');
end;

procedure TFormPeach.mextto_hereClick(Sender: TObject);
begin
if checklistsel=0 then
   quickextract(extractfilepath(StringGridList.Cells[12,StringGridList.Row]),'*neutral','selected');
end;

procedure TFormPeach.mextto_homeClick(Sender: TObject);
begin
quickextract(extractfilepath(home_path),'*neutral','selected');
end;

procedure TFormPeach.mextto_LastClick(Sender: TObject);
begin
if lastoutpath='' then lastoutpath:=local_desktop;
mextto_Last.Caption:=txt_lastused+' '+extractfilepath(lastoutpath);
quickextract(extractfilepath(lastoutpath),'*neutral','selected');
end;

procedure TFormPeach.mextto_musicClick(Sender: TObject);
begin
quickextract(extractfilepath(usr_music),'*neutral','selected');
end;

procedure TFormPeach.mextto_onedriveClick(Sender: TObject);
begin
quickextract(extractfilepath(shared_onedrive),'*neutral','selected');
end;

procedure TFormPeach.mextto_picturesClick(Sender: TObject);
begin
quickextract(extractfilepath(usr_pictures),'*neutral','selected');
end;

procedure TFormPeach.mextto_pubdocClick(Sender: TObject);
begin
quickextract(extractfilepath(public_documents),'*neutral','selected');
end;

procedure TFormPeach.mextto_pubhomeClick(Sender: TObject);
begin
quickextract(extractfilepath(public_home),'*neutral','selected');
end;

procedure TFormPeach.mextto_shpClick(Sender: TObject);
begin
quickextract(extractfilepath(shared_sharepointwork),'*neutral','selected');
end;

procedure TFormPeach.mextto_yClick(Sender: TObject);
begin
quickextract(extractfilepath(shared_yandex),'*neutral','selected');
end;

procedure TFormPeach.mextto_videosClick(Sender: TObject);
begin
quickextract(extractfilepath(usr_videos),'*neutral','selected');
end;

procedure TFormPeach.mhrenamef2Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then rename_files('rename');
end;

procedure TFormPeach.mlogClick(Sender: TObject);
begin
FormPaths.MemoPaths.Clear;
FormPaths.MemoPaths.Lines:=list_utils.cllog;
FormPaths.Caption:=txt_10_8_log;
//FormPaths.Visible:=true;
FormPaths.ShowModal;
end;

procedure TFormPeach.pmbatchtestClick(Sender: TObject);
begin
filebrowser_funall('batchtest');
end;

procedure TFormPeach.pmextdeskClick(Sender: TObject);
begin
quickextract(local_desktop,'*neutral','all');
end;

procedure TFormPeach.pmextdocClick(Sender: TObject);
begin
quickextract(usr_documents,'*neutral','all');
end;

procedure TFormPeach.pmexttoClick(Sender: TObject);
begin
do_extallto('all');
end;

procedure TFormPeach.SpeedButtonAddClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=SpeedButtonAdd.Left;
p.y:=SpeedButtonAdd.top+PanelActAdd.top;
p:=clienttoscreen(p);
if contextconvert_switch = true then pmttitle.caption:=txt_2_8_convert
else pmttitle.caption:=txt_add;
popupmenutype.PopUp(p.x,p.y);
end;

procedure TFormPeach.CheckBoxARCsfxClick(Sender: TObject);
begin
on_CheckBoxARC2Click;
end;

procedure TFormPeach.CheckBoxAutoOpenClick(Sender: TObject);
begin
on_CheckBoxAutoOpenClick;
end;

procedure TFormPeach.CheckBoxEncodingClick(Sender: TObject);
begin
on_CheckBoxEncodingClick;
end;

procedure TFormPeach.CheckBoxFolderClick(Sender: TObject);
begin
on_CheckBoxFolderClick;
end;

procedure TFormPeach.CheckBoxParallelArchivingClick(Sender: TObject);
begin
on_CheckBoxParallelArchivingClick;
end;

procedure TFormPeach.CheckBoxSeparateClick(Sender: TObject);
begin
on_checkboxseparateclick;
end;

procedure TFormPeach.CheckBoxAltgridcolClick(Sender: TObject);
begin
if CheckBoxAltgridcol.State=cbChecked then usealtcolor:=1 else usealtcolor:=0;
setgridaltcolor;
end;

procedure TFormPeach.CheckBoxzcopyClick(Sender: TObject);
begin
on_CheckBoxzcopyClick;
end;

procedure TFormPeach.CheckBoxzipxswitchClick(Sender: TObject);
begin
if FormPeach.CheckBoxzipxswitch.State=cbChecked then swzipx:=1 else swzipx:=0;
end;

procedure TFormPeach.CheckBoxzpaqabsoluteClick(Sender: TObject);
begin
if CheckBoxzpaqabsolute.Checked=true then
   begin
   zpaqabsolute:=1;
   CheckBoxzpaqall.enabled:=false;
   CheckBoxzpaqfull.enabled:=false;
   end
else
   begin
   zpaqabsolute:=0;
   CheckBoxzpaqall.enabled:=true;
   CheckBoxzpaqfull.enabled:=true;
   end;
end;

procedure TFormPeach.CheckBoxzpaqallClick(Sender: TObject);
begin
if CheckBoxzpaqall.Checked=true then
   begin
   zpaqall:=1;
   CheckBoxzpaqabsolute.enabled:=false;
   end
else
   begin
   zpaqall:=0;
   CheckBoxzpaqabsolute.enabled:=true;
   end;
end;

procedure TFormPeach.CheckBoxzpaqforceClick(Sender: TObject);
begin
if CheckBoxzpaqforce.Checked=true then zpaqforce:=1 else zpaqforce:=0;
end;

procedure TFormPeach.CheckBoxzpaqfullClick(Sender: TObject);
begin
if CheckBoxzpaqfull.Checked=true then
   begin
   zpaqfull:=1;
   CheckBoxzpaqabsolute.enabled:=false;
   end
else
   begin
   zpaqfull:=0;
   CheckBoxzpaqabsolute.enabled:=true;
   end;
end;

procedure TFormPeach.CheckBoxZstdClick(Sender: TObject);
begin
CheckBoxZstd_onClick;
end;

procedure TFormPeach.CheckGroupM1ItemClick(Sender: TObject; Index: integer);
begin
checkmsched;
end;

procedure TFormPeach.CheckGroupMExtItemClick(Sender: TObject; Index: integer);
begin
checkmschedext;
end;

procedure TFormPeach.CheckGroupWItemClick(Sender: TObject; Index: integer);
begin
checkwsched;
end;

procedure TFormPeach.ColorButton2ColorChanged(Sender: TObject);
begin
color2:=ColorToString(ColorButton2.ButtonColor);
if openstarted=true then apply_theme;
end;

procedure TFormPeach.ColorButton3ColorChanged(Sender: TObject);
begin
color3:=ColorToString(ColorButton3.ButtonColor);
if openstarted=true then apply_theme;
end;

procedure TFormPeach.CheckGroupWExtItemClick(Sender: TObject; Index: integer);
begin
checkwschedext;
end;

procedure TFormPeach.ComboBoxConsoleEncodingChange(Sender: TObject);
begin
on_ComboBox1Change;
end;

procedure TFormPeach.ComboBoxSplitChange(Sender: TObject);
begin
spanunit:=ComboBoxSplit.ItemIndex;
end;

procedure TFormPeach.ComboBox7zMethodCloseUp(Sender: TObject);
begin
ComboBoxArchive3_onchange;
end;

procedure TFormPeach.ComboBox7zLevelCloseUp(Sender: TObject);
begin
on_ComboBoxArchiveCompressionLevelChange;
end;

procedure TFormPeach.ComboBoxDragChange(Sender: TObject);
begin
on_CheckBoxDrag_click;
end;

procedure TFormPeach.ComboBoxKiBChange(Sender: TObject);
begin
on_ComboBoxKiBChange;
end;

procedure TFormPeach.ComboBoxLanguageCloseUp(Sender: TObject);
var
   s:AnsiString;
begin
if openstarted=false then exit;
s:=ComboBoxLanguage.Caption;
if s=lang_file then exit;
if FileExists(sharepath+'lang'+directoryseparator+s) then
   begin
   {$IFDEF MSWINDOWS}
   peaziplanguage(s);
   restartclosepeaapp;
   {$ELSE}
   lang_file:=s;
   saverestartclosepeaapp;
   {$ENDIF}
   end;
end;

procedure TFormPeach.ComboBoxMaxArgChange(Sender: TObject);
begin
on_CheckBoxmaxarg_click;
end;

procedure TFormPeach.ComboBox7zMemuseChange(Sender: TObject);
begin
on_ComboBoxmemuseChange;
end;

procedure TFormPeach.ComboBoxPriorityChange(Sender: TObject);
begin
on_comboboxprioritychange;
end;

procedure TFormPeach.ComboBoxSysbinChange(Sender: TObject);
begin
on_cbsys7zlinchange;
end;

procedure TFormPeach.ComboBoxSyntaxLevelChange(Sender: TObject);
begin
on_ComboBoxSyntaxLevelChange;
end;

procedure TFormPeach.ComboBoxTARTSChange(Sender: TObject);
begin
tartime:=ComboBoxTARTS.ItemIndex;
end;

procedure TFormPeach.ComboBoxTARChange(Sender: TObject);
begin
tartype:=ComboBoxTAR.ItemIndex;
end;

procedure TFormPeach.ComboBoxWDChange(Sender: TObject);
begin
if openstarted=false then exit;
if pMessageInfoYesNo(txt_8_3_cw)=7 then begin FormPeach.ComboBoxWD.ItemIndex:=vopt12; exit; end;
reset_temp(1);
on_ComboBoxWDChange;
if work_dir=3 then
   if FormPeach.SelectDirectoryDialog1.Execute then
      if FormPeach.SelectDirectoryDialog1.FileName<>'' then
         begin
         custom_work_path:=FormPeach.SelectDirectoryDialog1.FileName;
         FormPeach.LabelCustomWorkPath.Caption:=custom_work_path;
         end
      else
         begin
         if custom_work_path='' then
            begin
            work_dir:=2;
            FormPeach.ComboBoxWD.ItemIndex:=2;
            custom_work_path:='';
            FormPeach.LabelCustomWorkPath.Caption:='';
            end
         end
   else
      begin
      if custom_work_path='' then
         begin
         work_dir:=2;
         FormPeach.ComboBoxWD.ItemIndex:=2;
         custom_work_path:='';
         FormPeach.LabelCustomWorkPath.Caption:='';
         end
      end
else
   begin
   custom_work_path:='';
   FormPeach.LabelCustomWorkPath.Caption:='';
   end;
saverestartclosepeaapp;
end;

procedure TFormPeach.ComboBoxARCFunChange(Sender: TObject);
begin
on_ComboBoxARC2Change;
end;

procedure TFormPeach.ComboBox7zFunChange(Sender: TObject);
begin
cbAct.ItemIndex:=ComboBox7zFun.ItemIndex;
ComboBoxArchiveActUpdate.ItemIndex:=ComboBox7zFun.ItemIndex;
on_cbActChange;
end;

procedure TFormPeach.ComboBox7zThreadsChange(Sender: TObject);
begin
on_ComboBoxArchive8Change;
end;

procedure TFormPeach.cbLevelCloseUp(Sender: TObject);
begin
on_cbLevelChange;
end;

procedure TFormPeach.ComboBoxArchiveActUpdateChange(Sender: TObject);
begin
ComboBox7zFun.ItemIndex:=ComboBoxArchiveActUpdate.ItemIndex;
cbAct.ItemIndex:=ComboBoxArchiveActUpdate.ItemIndex;
on_cbActChange;
end;

procedure TFormPeach.cbActChange(Sender: TObject);
begin
ComboBox7zFun.ItemIndex:=cbAct.ItemIndex;
ComboBoxArchiveActUpdate.ItemIndex:=cbAct.ItemIndex;
on_cbActChange;
end;

procedure TFormPeach.ctrlwarningClick(Sender: TObject);
begin
pMessageWarningOK(browserwarningmsg);
end;

procedure TFormPeach.DateEdit1Change(Sender: TObject);
begin
if DateEdit2.Date<DateEdit1.Date then DateEdit2.Date:=DateEdit1.Date;
end;

procedure TFormPeach.DateEdit2Change(Sender: TObject);
begin
if DateEdit2.Date<DateEdit1.Date then DateEdit2.Date:=DateEdit1.Date;
end;

procedure TFormPeach.DateEditExt1Change(Sender: TObject);
begin
if DateEditExt2.Date<DateEditExt1.Date then DateEditExt2.Date:=DateEditExt1.Date;
end;

procedure TFormPeach.DateEditExt2Change(Sender: TObject);
begin
if DateEditExt2.Date<DateEditExt1.Date then DateEditExt2.Date:=DateEditExt1.Date;
end;

procedure TFormPeach.EditAddNameChange(Sender: TObject);
var
   s,sext:ansistring;
begin
checkoutpath_archive;
if FormPeach.EditAddName.Text<>FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text) then
   begin
   s:=EditAddName.Text;
   sext:=lowercase(extractfileext(s));
   if (sext='.7z') or (sext='.arc') or (sext='.bz2') or (sext='.gz')
      or (sext='.pea') or (sext='.quad') or (sext='.balz') or (sext='.bcm') or (sext='.tar')
      or (sext='.wim') or (sext='.zip') or (sext='.zipx') or (sext='.paq8o') or (sext='.lpaq8')
      or (sext='.zpaq') or (sext='.zst') or (sext='.br') then
      begin
      cutextension(s);
      if lowercase(extractfileext(s))='.tar' then cutextension(s);
      end;
   EditAddFilepath.Text:=extractfilepath(s);
   if checkboxseparate.state=cbUnchecked then EditAddFilename.Text:=extractfilename(s);
   end;
get_statuss(FormPeach.EditAddName.Text);
FormPeach.labelstatusAr.Visible:=false;
FormPeach.labelstatusAr.Caption:=txt_3_1_workingdir+' '+FormPeach.ComboBoxWD.Caption+' '+FormPeach.LabelCustomWorkPath.Caption;
end;

procedure TFormPeach.EditOpenInInteractiveExit(Sender: TObject);
begin
exit_fromaddress(0);
end;

procedure TFormPeach.abc0Click(Sender: TObject);
begin
browsefiledir(FormPeach.EditOpenInInteractive.Text);
end;

procedure TFormPeach.EditOpenInInteractiveKeyPress(Sender: TObject; var Key: char);
begin
if Key=char(13) then browsefiledir(FormPeach.EditOpenInInteractive.Text);
if Key=char(27) then exit_fromaddress(1);
end;

procedure TFormPeach.EditOpenInInteractiveKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
filter_listaddress;
end;

procedure TFormPeach.EditOpenInChange(Sender: TObject);
begin
EditOpenInInteractive.Text:=EditOpenIn.Text;
end;

procedure TFormPeach.EditOutExtractChange(Sender: TObject);
begin
checkoutpath_extract;
end;

procedure TFormPeach.EditUn7zaFilterInteractiveKeyPress(Sender: TObject; var Key: char);
begin
if Key=char(13) then
   begin
   kp_EditUn7zaFilterInteractive;
   end;
end;

procedure TFormPeach.EditUn7zaFilterChange(Sender: TObject);
begin
EditUn7zaFilterInteractive.Text:=EditUn7zaFilter.Text;
end;

procedure TFormPeach.eowcustom10Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',2);
end;

procedure TFormPeach.eowcustom11Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',3);
end;

procedure TFormPeach.eowcustom12Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',4);
end;

procedure TFormPeach.eowcustom13Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',5);
end;

procedure TFormPeach.eowcustom14Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',6);
end;

procedure TFormPeach.eowcustom15Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',7);
end;

procedure TFormPeach.eowcustom16Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',8);
end;

procedure TFormPeach.eowcustom1Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',1);
end;

procedure TFormPeach.eowcustom2Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',2);
end;

procedure TFormPeach.eowcustom3Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',3);
end;

procedure TFormPeach.eowcustom4Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',4);
end;

procedure TFormPeach.eowcustom5Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',5);
end;

procedure TFormPeach.eowcustom6Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',6);
end;

procedure TFormPeach.eowcustom7Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',7);
end;

procedure TFormPeach.eowcustom8Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',8);
end;

procedure TFormPeach.eowcustom9Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',1);
end;

procedure TFormPeach.eowcustom_10Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',10);
end;

procedure TFormPeach.eowcustom_11Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',11);
end;

procedure TFormPeach.eowcustom_12Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',12);
end;

procedure TFormPeach.eowcustom_13Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',13);
end;

procedure TFormPeach.eowcustom_14Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',14);
end;

procedure TFormPeach.eowcustom_15Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',15);
end;

procedure TFormPeach.eowcustom_16Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',16);
end;

procedure TFormPeach.eowcustom_9Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',9);
end;

procedure TFormPeach.eowrunClick(Sender: TObject);
begin
openwith_cust('extandrun','run',0);
end;

procedure TFormPeach.f3searchExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then launch_rsearch
else cp_search(desk_env);
end;

procedure TFormPeach.f4menuExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then popuptabmenu;
end;

procedure TFormPeach.f5refreshExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
begin
if ((fun='UN7Z') and (EditUn7zaFilterInteractive.Caption='*')) or ((fun='UN7Z') and (EditUn7zaFilterInteractive.Caption=pspecbrowse+'*')) then
   begin
   if FormPeach.StringGridList.Cells[1,1]='' then
      begin
      FormPW.EditPWpass.Text:='';
      FormPW.EditPWconfirm.Text:='';
      FormPW.EditPWkeyfile.Text:='';
      setpwicons;
      end;//blank the password on refresh if the archive is not correctly displayed, triggering a new password request prompt if needed
   refresharchiveroot('reload');
   end
else
   do_forcerefresh;
populatepcmenu;
end
else
   begin
   if (prevpanel='archive') or (prevpanel='extract') then updatelayout('');
   end;
end;

procedure TFormPeach.f8openbook1Execute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then jumpto('bookmark1');
end;

procedure TFormPeach.f6flatExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if (fun='UN7Z') or (fun='FILEBROWSER') then toggle_view;
end;

procedure TFormPeach.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
if needsave=true then on_exit;
completeshowpea:=false;
end;

procedure TFormPeach.FormResize(Sender: TObject);
begin
if FormPeach.Width <> 0 then
   if PanelProgress.Visible=true then
      PanelProgress.Width:=(FormPeach.Width*pperc) div 100;
if altbread=1 then setfontsbreadcrumb;
end;

procedure TFormPeach.ImageInfoConsoleClick(Sender: TObject);
begin
pMessageInfoOK(ImageInfoConsole.Hint);
end;

procedure TFormPeach.ImageInfoConsoleExtClick(Sender: TObject);
begin
pMessageInfoOK(ImageInfoConsoleExt.Hint);
end;

procedure TFormPeach.ImageInfoSchedAddClick(Sender: TObject);
begin
pMessageInfoOK(ImageInfoSchedAdd.Hint);
end;

procedure TFormPeach.ImageInfoSchedExtClick(Sender: TObject);
begin
pMessageInfoOK(ImageInfoSchedExt.Hint);
end;

procedure TFormPeach.ImageInfoBinariesClick(Sender: TObject);
begin
pMessageInfoOK(txt_cl_hint);
end;

procedure TFormPeach.ImageInfoEncodingClick(Sender: TObject);
begin
pMessageInfoOK(txt_2_5_langhint);
end;

procedure TFormPeach.ImageListRootMouseEnter(Sender: TObject);
begin
  PanelListRoot.Color:=abactivecol;
  bctemp:=0;
end;

procedure TFormPeach.ImageListRootMouseLeave(Sender: TObject);
begin
  PanelListRoot.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageListResetSearchClick(Sender: TObject);
begin
do_resetsearch;
end;

procedure TFormPeach.ImageListResetSearchMouseEnter(Sender: TObject);
begin
if ImageListSearch.Enabled=true then PanelListResetSearch.Color:=abactivecol;
end;

procedure TFormPeach.ImageListResetSearchMouseLeave(Sender: TObject);
begin
PanelListResetSearch.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageListSearchDblClick(Sender: TObject);
begin
if PanelSearch.Visible then setsearchbar(0)
else setsearchbar(1);
end;

procedure TFormPeach.ImageListSearchMouseEnter(Sender: TObject);
begin
if ImageListSearch.Enabled=true then PanelListSearch.Color:=abactivecol;
end;

procedure TFormPeach.ImageListSearchMouseLeave(Sender: TObject);
begin
if altbread=1 then
   PanelListSearch.Color:=PanelListBar.Brush.Color
else
   PanelListSearch.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageExtractAdvfClick(Sender: TObject);
begin
pMessageInfoOK(txt_2_9_adv+char($0D)+char($0A)+txt_5_3_exc+char($0D)+char($0A)+char($0D)+char($0A)+'(Ctrl+Shift+F9)');
end;

procedure TFormPeach.ImageAddAdvfClick(Sender: TObject);
begin
pMessageInfoOK(txt_2_9_adv+char($0D)+char($0A)+txt_5_3_exc+char($0D)+char($0A)+char($0D)+char($0A)+'(Ctrl+Shift+F9)');
end;

procedure TFormPeach.ImageopenadvfClick(Sender: TObject);
begin
pMessageInfoOK(txt_2_9_adv+char($0D)+char($0A)+txt_5_3_exc+char($0D)+char($0A)+char($0D)+char($0A)+'(Ctrl+Shift+F9)');
end;

procedure TFormPeach.BtnPasswordArchiveClick(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
getarccaption(FormPeach.cbType.Text);
end;

procedure TFormPeach.ButtonOptCancelClick(Sender: TObject);
begin
restorestatus_defaults;
load_custedit;
showpanel(prevpanel);
Caption:=prevcaption;
end;

procedure TFormPeach.ButtonArchiveOKClick(Sender: TObject);
begin
on_buttonarchiveclick;
end;

procedure TFormPeach.ButtonEditNameAddClick(Sender: TObject);
var
   s:ansistring;
begin
if getoutname(s,archive_type,0)=0 then
   begin
   EditAddFilepath.Text:=extractfilepath(s);
   if checkboxseparate.state=cbUnchecked then EditAddFilename.Text:=extractfilename(s);
   s:=EditAddFilename.Text;
   if extractfileext(s)='.tar' then begin cutextension(s); EditAddFilename.Text:=s; end;
   FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
   end;
end;

procedure TFormPeach.ButtonCustomExtClick(Sender: TObject);
begin
patheditor:=EditNameCustomExt;
pcustom.popup();
end;

procedure TFormPeach.ButtonEditNameOutExtractClick(Sender: TObject);
begin
if EditOutExtract.Text='' then FormPeach.SelectDirectoryDialog1.InitialDir:=local_desktop
else FormPeach.SelectDirectoryDialog1.InitialDir:=EditOutExtract.Text;
if SelectDirectoryDialog1.Execute then
   if SelectDirectoryDialog1.FileName<>'' then
      begin
      EditOutExtract.Text:=SelectDirectoryDialog1.FileName;
      if EditOutExtract.Text<>'' then
         if EditOutExtract.Text[length(EditOutExtract.Text)]<>directoryseparator then EditOutExtract.Text:=EditOutExtract.Text+directoryseparator;
      end;
end;

procedure TFormPeach.ButtonOpenCustomClick(Sender: TObject);
begin
patheditor:=EditNameCustom;
pcustom.popup();
end;

procedure TFormPeach.ButtonEditNameCustomExtClick(Sender: TObject);
var
   s:ansistring;
begin
if FormPeach.OpenDialogCustom.Execute then
   if FormPeach.OpenDialogCustom.FileName<>'' then
      begin
      s:=FormPeach.OpenDialogCustom.FileName;
      addtocustomhistory(s);
      FormPeach.EditNameCustomExt.Text:=s;
      end
   else exit
else exit;
end;

procedure TFormPeach.ButtonExtCancelClick(Sender: TObject);
begin
cancelbuttonextract;
end;

procedure TFormPeach.ButtonOutExtractClick(Sender: TObject);
var
   p:TPoint;
begin
populatepcmenu;
p.x:=GroupExtract.left+ButtonOutExtract.Left;
p.y:=ButtonOutExtract.Height+ButtonOutExtract.top+GroupExtract.top+OptionsExtract.top+PanelTitleExtract.Height;
p:=clienttoscreen(p);
setrecenticons_extract_archive;
if lastoutpath='' then lastoutpath:=local_desktop;
MenuItemOpen_Last.Caption:=txt_lastused+' '+extractfilepath(lastoutpath);
mextto_Last.Caption:=txt_lastused+' '+extractfilepath(lastoutpath);
PopupPathExtract.PopUp(p.x,p.y);
end;

procedure TFormPeach.ButtonAddActionsClick(Sender: TObject);
var
   p:tpoint;
begin
p.x:=ButtonAddActions.left;
p.y:=ButtonAddActions.top+ButtonAddActions.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
if contextconvert_switch = true then pmttitle.caption:=txt_2_8_convert
else pmttitle.caption:=txt_add;
PopupMenuType.popup(p.x,p.y);
end;

procedure TFormPeach.ButtonAddActionsMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=false;
pmttitle.caption:=txt_add;
end;

procedure TFormPeach.ButtonUn7zaAddMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=false;
end;

procedure TFormPeach.ButtonPropertiesActionsClick(Sender: TObject);
begin
showfmmenu(1);
end;

procedure TFormPeach.ButtoncmtoClick(Sender: TObject);
begin
showfmmenu(2);
end;

procedure TFormPeach.ButtonExtractActionsClick(Sender: TObject);
var
   p:tpoint;
begin
p.x:=ButtonExtractActions.left;
p.y:=ButtonExtractActions.top+ButtonExtractActions.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
setquickextractmenu;
pmquickextract.popup(p.x,p.y);
end;

procedure TFormPeach.ButtonConvertActionsClick(Sender: TObject);
var
   p:tpoint;
begin
p.x:=ButtonConvertActions.left;
p.y:=ButtonConvertActions.top+ButtonConvertActions.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
if contextconvert_switch = true then pmttitle.caption:=txt_2_8_convert
else pmttitle.caption:=txt_add;
PopupMenuType.popup(p.x,p.y);
end;

procedure TFormPeach.ButtonConvertActionsMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=true;
pmttitle.caption:=txt_2_8_convert;
end;

procedure TFormPeach.ButtonTestActionsClick(Sender: TObject);
var
   p:tpoint;
begin
p.x:=ButtonTestActions.left;
p.y:=ButtonTestActions.top+ButtonTestActions.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
pmtestinfolist.popup(p.x,p.y);
end;

procedure TFormPeach.CheckBoxExtNotArchivesClick(Sender: TObject);
begin
on_CheckBox1Click;
end;

procedure TFormPeach.CheckBoxExtUnsupportedClick(Sender: TObject);
begin
on_CheckBox2Click;
end;

procedure TFormPeach.CheckBoxExtUnsupportedPeaZipClick(Sender: TObject);
begin
on_CheckBox3Click;
end;

procedure TFormPeach.CheckBoxNameAsParentFolderClick(Sender: TObject);
begin
on_CheckBoxnameasparentfolderclick;
end;

procedure on_checkboxnetworkinfoclick;
begin
if FormPeach.CheckBoxnetworkinfo.State=cbChecked then mappeddrivesinfo:=1 else mappeddrivesinfo:=0;
end;

procedure TFormPeach.CheckBoxnetworkinfoClick(Sender: TObject);
begin
  on_checkboxnetworkinfoclick;
end;

procedure on_checkboxsamearcclick;
begin
if FormPeach.CheckBoxSameArc.State=cbChecked then
   begin
   FormPeach.ButtonOutAdd.Enabled:=false;
   FormPeach.EditAddName.Enabled:=false;
   FormPeach.EditAddSame.Visible:=true;
   FormPeach.ButtonEditNameAdd.Enabled:=false;
   FormPeach.CheckBoxSeparate.State:=cbChecked;
   FormPeach.CheckBoxSeparate.Enabled:=false;
   end
else
   begin
   FormPeach.ButtonOutAdd.Enabled:=true;
   FormPeach.EditAddName.Enabled:=true;
   FormPeach.EditAddSame.Visible:=false;
   FormPeach.ButtonEditNameAdd.Enabled:=true;
   FormPeach.CheckBoxSeparate.State:=cbUnchecked;
   FormPeach.CheckBoxSeparate.Enabled:=true;
   end;
on_checkboxseparateclick;
end;

procedure TFormPeach.CheckBoxSameArcClick(Sender: TObject);
begin
on_checkboxsamearcclick;
end;

procedure on_CheckBoxSameExtclick;
begin
if FormPeach.CheckBoxSameExt.State=cbChecked then
   begin
   FormPeach.ButtonOutExtract.Enabled:=false;
   FormPeach.EditOutExtract.Enabled:=false;
   FormPeach.EditOutExtractSame.Visible:=true;
   FormPeach.ButtonEditNameOutExtract.Enabled:=false;
   end
else
   begin
   FormPeach.ButtonOutExtract.Enabled:=true;
   FormPeach.EditOutExtract.Enabled:=true;
   FormPeach.EditOutExtractSame.Visible:=false;
   FormPeach.ButtonEditNameOutExtract.Enabled:=true;
   end;
end;

procedure TFormPeach.CheckBoxSameExtClick(Sender: TObject);
begin
on_CheckBoxSameExtclick;
end;

procedure TFormPeach.CheckBoxShowVolatileClick(Sender: TObject);
begin
on_CheckBoxShowVolatileClick;
end;

procedure TFormPeach.CheckBoxSkipDelClick(Sender: TObject);
begin
on_CheckBoxSkipDel_click;
end;

procedure TFormPeach.CheckBoxSkipencClick(Sender: TObject);
begin
if FormPeach.CheckBoxSkipenc.State=cbChecked then skipenctest:=1 else skipenctest:=0;
end;

procedure TFormPeach.CheckBoxsnhClick(Sender: TObject);
begin
CheckBoxsnh_onclick;
end;

procedure TFormPeach.CheckBoxsniExtClick(Sender: TObject);
begin
CheckBoxsniExt_onclick;
end;

procedure TFormPeach.CheckBoxsniClick(Sender: TObject);
begin
CheckBoxsni_onclick;
end;

procedure TFormPeach.CheckBoxsnlClick(Sender: TObject);
begin
CheckBoxsnl_onclick;
end;

procedure TFormPeach.CheckBoxsnoiClick(Sender: TObject);
begin
CheckBoxsnoi_onclick;
end;

procedure TFormPeach.CheckBoxsnonClick(Sender: TObject);
begin
CheckBoxsnon_onclick;
end;

procedure TFormPeach.CheckBoxsnsExtClick(Sender: TObject);
begin
CheckBoxsnsExt_onclick;
end;

procedure TFormPeach.CheckBoxsnsClick(Sender: TObject);
begin
CheckBoxsns_onclick;
end;

procedure TFormPeach.CheckBoxsnzExtClick(Sender: TObject);
begin
CheckBoxsnzExt_onclick;
end;

procedure TFormPeach.cbSolidAddressChange(Sender: TObject);
begin
solidaddressstyle:=cbSolidAddress.ItemIndex;
if openstarted=true then apply_theme;
end;

procedure TFormPeach.CheckBoxsspClick(Sender: TObject);
begin
CheckBoxssp_onClick;
end;

procedure TFormPeach.CheckBoxstlClick(Sender: TObject);
begin
CheckBoxstl_onClick;
end;

procedure TFormPeach.ButtonEditNameCustomClick(Sender: TObject);
var
   s:ansistring;
begin
if FormPeach.OpenDialogCustom.Execute then
   if FormPeach.OpenDialogCustom.FileName<>'' then
      begin
      s:=FormPeach.OpenDialogCustom.FileName;
      addtocustomhistory(s);
      FormPeach.EditNameCustom.Text:=s;
      s:=extractfilename(s);
      cutextension(s);//default: extension = name of the executable
      FormPeach.EditExtensionCustom.Text:=s;
      end
   else exit
else exit;
end;

procedure TFormPeach.ButtonUn7zaTestClick(Sender: TObject);
begin
do_test;
end;

procedure TFormPeach.ButtonUn7zaAddClick(Sender: TObject);
begin
do_add;
end;

procedure TFormPeach.ButtonUn7zaConvertClick(Sender: TObject);
begin
archive_convert;
end;

procedure TFormPeach.ButtonUn7zaConvertMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=true;
end;

procedure TFormPeach.ButtonExtOkClick(Sender: TObject);
begin
on_buttonextokclick;
end;

procedure TFormPeach.Buttonfmactions1Click(Sender: TObject);
var
   p:tpoint;
begin
with FormPeach do
begin
p.x:=Buttonfmactions1.left;
p.y:=Buttonfmactions1.top+Buttonfmactions1.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
PopupMenuRename.popup(p.x,p.y);
end;
end;

procedure TFormPeach.ButtonfmactionsClick(Sender: TObject);
begin
showfmmenu(3);
end;

procedure TFormPeach.ButtonImgRClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ButtonImgR.left;
p.y:=ButtonImgR.top+ButtonImgR.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
pmImageRotate.popup(p.x,p.y);
end;

procedure TFormPeach.ButtonImgResClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ButtonImgRes.left;
p.y:=ButtonImgRes.top+ButtonImgRes.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
pmImageResize.popup(p.x,p.y);
end;

procedure TFormPeach.ButtonImgResizeClick(Sender: TObject);
begin
do_resize;
end;

procedure TFormPeach.ButtonImgCropClick(Sender: TObject);
begin
do_crop;
end;

procedure TFormPeach.ButtonImgRLClick(Sender: TObject);
begin
frombrowser_imgrotate('left');
end;

procedure TFormPeach.ButtonImgRRClick(Sender: TObject);
begin
frombrowser_imgrotate('right');
end;

procedure TFormPeach.ButtonImg6Click(Sender: TObject);
begin
showfmmenu(4);
end;

procedure setopenactions;
begin
with FormPeach do
begin
owcustom1t.visible:=owcustom1.visible;
owcustom2t.visible:=owcustom2.visible;
owcustom3t.visible:=owcustom3.visible;
owcustom4t.visible:=owcustom4.visible;
owcustom5t.visible:=owcustom5.visible;
owcustom6t.visible:=owcustom6.visible;
owcustom7t.visible:=owcustom7.visible;
owcustom8t.visible:=owcustom8.visible;
owcustom9t.visible:=owcustom9.visible;
owcustom10t.visible:=owcustom10.visible;
owcustom11t.visible:=owcustom11.visible;
owcustom12t.visible:=owcustom12.visible;
owcustom13t.visible:=owcustom13.visible;
owcustom14t.visible:=owcustom14.visible;
owcustom15t.visible:=owcustom15.visible;
owcustom16t.visible:=owcustom16.visible;
owcustom_9t.visible:=owcustom_9.visible;
owcustom_10t.visible:=owcustom_10.visible;
owcustom_11t.visible:=owcustom_11.visible;
owcustom_12t.visible:=owcustom_12.visible;
owcustom_13t.visible:=owcustom_13.visible;
owcustom_14t.visible:=owcustom_14.visible;
owcustom_15t.visible:=owcustom_15.visible;
owcustom_16t.visible:=owcustom_16.visible;
owcustom1t.caption:=owcustom1.caption;
owcustom2t.caption:=owcustom2.caption;
owcustom3t.caption:=owcustom3.caption;
owcustom4t.caption:=owcustom4.caption;
owcustom5t.caption:=owcustom5.caption;
owcustom6t.caption:=owcustom6.caption;
owcustom7t.caption:=owcustom7.caption;
owcustom8t.caption:=owcustom8.caption;
owcustom9t.caption:=owcustom9.caption;
owcustom10t.caption:=owcustom10.caption;
owcustom11t.caption:=owcustom11.caption;
owcustom12t.caption:=owcustom12.caption;
owcustom13t.caption:=owcustom13.caption;
owcustom14t.caption:=owcustom14.caption;
owcustom15t.caption:=owcustom15.caption;
owcustom16t.caption:=owcustom16.caption;
owcustom_9t.caption:=owcustom_9.caption;
owcustom_10t.caption:=owcustom_10.caption;
owcustom_11t.caption:=owcustom_11.caption;
owcustom_12t.caption:=owcustom_12.caption;
owcustom_13t.caption:=owcustom_13.caption;
owcustom_14t.caption:=owcustom_14.caption;
owcustom_15t.caption:=owcustom_15.caption;
owcustom_16t.caption:=owcustom_16.caption;
po_open_peazipt.caption:=po_open_peazip.caption;
po_open_associatedt.caption:=po_open_associated.caption;
po_open_customt.caption:=po_open_custom.caption;
end;
end;

procedure TFormPeach.ButtonopenactionsClick(Sender: TObject);
var
   p:tpoint;
begin
with FormPeach do
begin
p.x:=Buttonopenactions.left;
p.y:=Buttonopenactions.top+Buttonopenactions.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
setopenactions;
pmtopen.popup(p.x,p.y);
end;
end;

procedure TFormPeach.ButtonUn7zaToClick(Sender: TObject);
begin
do_extract;
end;

procedure TFormPeach.cbTypeChange(Sender: TObject);
begin
on_cbtypechange;
end;

procedure TFormPeach.ComboBox7zalgoChange(Sender: TObject);
begin
on_combobox7zalgochange;
end;

procedure TFormPeach.ComboBoxArchiveCustom1Change(Sender: TObject);
begin
customsyntax1:=ComboBoxCustomSyntaxExt.ItemIndex;
updateconf_modified;
end;

procedure TFormPeach.ComboBoxArchiveCustomChange(Sender: TObject);
begin
on_ComboBoxArchiveCustomChange;
end;

procedure TFormPeach.ComboBoxOverwriteARCChange(Sender: TObject);
begin
on_ComboBoxOverwriteARCChange;
end;

procedure TFormPeach.ComboBoxOverwriteChange(Sender: TObject);
begin
on_ComboBoxOverwriteChange;
end;

procedure TFormPeach.ComboBoxPassesChange(Sender: TObject);
begin
on_ComboBoxPassesChange;
end;

procedure TFormPeach.BtnPasswordExtractClick(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
end;

procedure TFormPeach.LabelAppPathClick(Sender: TObject);
begin
cp_open(executable_path,desk_env);
end;

procedure TFormPeach.LabelOpenDesktopClick(Sender: TObject);
begin
cp_open(EditDesk.Text,desk_env);
end;

procedure TFormPeach.LabelResetOpenWithClick(Sender: TObject);
begin
if pMessageInfoYesNo(txt_3_6_resetapps)=6 then
   begin
   reset_custedit;
   set_adveditcl(StringGridCustEditAdv.Row);
   set_custedit_fromtable;
   set_custedit_menus;
   save_custedit;
   end;
end;

procedure TFormPeach.LabelClickAdArchive1Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abcrs[1]+'*';
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.LabelClickAdArchive1MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive1.Caption<>'' then PanelLCAa1.Brush.Color:=abactivecol;
PanelLCAa1.Pen.Color:=PanelLCAa1.Brush.Color;
bctemp:=8;
end;

procedure TFormPeach.LabelClickAdArchive1MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive1.Caption<>'' then PanelLCAa1.Brush.Color:=abarchivecol;
PanelLCAa1.Pen.Color:=PanelLCAa1.Brush.Color;
end;

procedure TFormPeach.LabelClickAdArchive2Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abcrs[2]+'*';
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.LabelClickAdArchive2MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive2.Caption<>'' then PanelLCAa2.Brush.Color:=abactivecol;
PanelLCAa2.Pen.Color:=PanelLCAa2.Brush.Color;
bctemp:=8;
end;

procedure TFormPeach.LabelClickAdArchive2MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive2.Caption<>'' then PanelLCAa2.Brush.Color:=abarchivecol;
PanelLCAa2.Pen.Color:=PanelLCAa2.Brush.Color;
end;

procedure TFormPeach.LabelClickAdArchive3Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abcrs[3]+'*';
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.LabelClickAdArchive3MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive3.Caption<>'' then PanelLCAa3.Brush.Color:=abactivecol;
PanelLCAa3.Pen.Color:=PanelLCAa3.Brush.Color;
bctemp:=8;
end;

procedure TFormPeach.LabelClickAdArchive3MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive3.Caption<>'' then PanelLCAa3.Brush.Color:=abarchivecol;
PanelLCAa3.Pen.Color:=PanelLCAa3.Brush.Color;
end;

procedure TFormPeach.LabelClickAdArchive4Click(Sender: TObject);
begin
EditUn7zaFilterInteractive.Caption:=abcrs[4]+'*';
kp_EditUn7zaFilterInteractive_nonrecursive;
end;

procedure TFormPeach.LabelClickAdArchive4MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive4.Caption<>'' then PanelLCAa4.Brush.Color:=abactivecol;
PanelLCAa4.Pen.Color:=PanelLCAa4.Brush.Color;
bctemp:=8;
end;

procedure TFormPeach.LabelClickAdArchive4MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive4.Caption<>'' then PanelLCAa4.Brush.Color:=abarchivecol;
PanelLCAa4.Pen.Color:=PanelLCAa4.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress1Click(Sender: TObject);
begin
if LabelClickAddress1.Caption=' '+txt_mypc+' ' then jumpto('root')
else browsefiledir(pmbc8.caption);
end;

procedure TFormPeach.LabelClickAddress1MouseEnter(Sender: TObject);
begin
PanelLCA1.Brush.Color:=abactivecol;
PanelLCA1.Pen.Color:=PanelLCA1.Brush.Color;
bctemp:=1;
end;

procedure TFormPeach.LabelClickAddress1MouseLeave(Sender: TObject);
begin
PanelLCA1.Brush.Color:=Panelclickaddress.Color;
PanelLCA1.Pen.Color:=PanelLCA1.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress2Click(Sender: TObject);
begin
browsefiledir(pmbc7.caption);
end;

procedure TFormPeach.LabelClickAddress2MouseEnter(Sender: TObject);
begin
PanelLCA2.Brush.Color:=abactivecol;
PanelLCA2.Pen.Color:=PanelLCA2.Brush.Color;
bctemp:=2;
end;

procedure TFormPeach.LabelClickAddress2MouseLeave(Sender: TObject);
begin
PanelLCA2.Brush.Color:=Panelclickaddress.Color;
PanelLCA2.Pen.Color:=PanelLCA2.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress3Click(Sender: TObject);
begin
browsefiledir(pmbc6.caption);
end;

procedure TFormPeach.LabelClickAddress3MouseEnter(Sender: TObject);
begin
PanelLCA3.Brush.Color:=abactivecol;
PanelLCA3.Pen.Color:=PanelLCA3.Brush.Color;
bctemp:=3;
end;

procedure TFormPeach.LabelClickAddress3MouseLeave(Sender: TObject);
begin
PanelLCA3.Brush.Color:=Panelclickaddress.Color;
PanelLCA3.Pen.Color:=PanelLCA3.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress4Click(Sender: TObject);
begin
browsefiledir(pmbc5.caption);
end;

procedure TFormPeach.LabelClickAddress4MouseEnter(Sender: TObject);
begin
PanelLCA4.Brush.Color:=abactivecol;
PanelLCA4.Pen.Color:=PanelLCA4.Brush.Color;
bctemp:=4;
end;

procedure TFormPeach.LabelClickAddress4MouseLeave(Sender: TObject);
begin
PanelLCA4.Brush.Color:=Panelclickaddress.Color;
PanelLCA4.Pen.Color:=PanelLCA4.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress5Click(Sender: TObject);
begin
browsefiledir(pmbc4.caption);
end;

procedure TFormPeach.LabelClickAddress5MouseEnter(Sender: TObject);
begin
PanelLCA5.Brush.Color:=abactivecol;
PanelLCA5.Pen.Color:=PanelLCA5.Brush.Color;
bctemp:=5;
end;

procedure TFormPeach.LabelClickAddress5MouseLeave(Sender: TObject);
begin
PanelLCA5.Brush.Color:=Panelclickaddress.Color;
PanelLCA5.Pen.Color:=PanelLCA5.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress6Click(Sender: TObject);
begin
browsefiledir(pmbc3.caption);
end;

procedure TFormPeach.LabelClickAddress6MouseEnter(Sender: TObject);
begin
PanelLCA6.Brush.Color:=abactivecol;
PanelLCA6.Pen.Color:=PanelLCA6.Brush.Color;
bctemp:=6;
end;

procedure TFormPeach.LabelClickAddress6MouseLeave(Sender: TObject);
begin
PanelLCA6.Brush.Color:=Panelclickaddress.Color;
PanelLCA6.Pen.Color:=PanelLCA6.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress7Click(Sender: TObject);
begin
browsefiledir(pmbc2.caption);
end;

procedure TFormPeach.LabelClickAddress7MouseEnter(Sender: TObject);
begin
PanelLCA7.Brush.Color:=abactivecol;
PanelLCA7.Pen.Color:=PanelLCA7.Brush.Color;
bctemp:=7;
end;

procedure TFormPeach.LabelClickAddress7MouseLeave(Sender: TObject);
begin
PanelLCA7.Brush.Color:=Panelclickaddress.Color;
PanelLCA7.Pen.Color:=PanelLCA7.Brush.Color;
end;

procedure TFormPeach.LabelClickAddress8Click(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
   begin
   if browserstyle=0 then
      begin
      specbrowse:=pspecbrowse;
      refresharchiveroot('noreload');
      //list_root;
      {if pspecbrowse<>'' then
         begin
         specbrowse:=pspecbrowse;
         list_root;
         end
      else
         begin
         EditUn7zaFilterInteractive.Caption:='*';
         kp_EditUn7zaFilterInteractive_nonrecursive;
         end; }
      end
   else listun7z_expandall;
   end
else
   browsefiledir(pmbc1.caption);
end;

procedure TFormPeach.LabelClickAddress8MouseEnter(Sender: TObject);
begin
PanelLCA8.Brush.Color:=abactivecol;
PanelLCA8.Pen.Color:=PanelLCA8.Brush.Color;
bctemp:=8;
end;

procedure TFormPeach.LabelClickAddress8MouseLeave(Sender: TObject);
begin
if extractfilename(EditOpenIn.Text)<>'' then
   PanelLCA8.Brush.Color:=abarchivecol
else
   PanelLCA8.Brush.Color:=Panelclickaddress.Color;
PanelLCA8.Pen.Color:=PanelLCA8.Brush.Color;
end;

procedure TFormPeach.LabelOpenConfClick(Sender: TObject);
begin
cp_open(LabelConf.Caption,desk_env);
end;

procedure TFormPeach.LabelConfigurePeaZipClick(Sender: TObject);
begin
configure_systemintegration(true);
restartpeaapp;
exit_nosave;
end;

procedure TFormPeach.LabelConfigureSendToClick(Sender: TObject);
begin
cp_open(usr_sendto,desk_env);
end;

procedure TFormPeach.LabelLangClick(Sender: TObject);
begin
changelanguage;
end;

procedure TFormPeach.LabelLang4Click(Sender: TObject);
begin
pMessageInfoOK(txt_5_3_cmlmessage);
cp_open(sharepath+'lang-wincontext'+directoryseparator,desk_env);
end;

procedure TFormPeach.LabelPanelHintAddMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintadd;
end;

procedure TFormPeach.LabelPanelHintExtractMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintextract;
end;

procedure TFormPeach.LabelResetAppClick(Sender: TObject);
begin
if pMessageInfoYesNo(txt_3_6_resetapps)=6 then
   begin
   reset_custedit;
   set_adveditcl(StringGridCustEditAdv.Row);
   set_custedit_fromtable;
   set_custedit_menus;
   save_custedit;
   end;
end;

procedure TFormPeach.LabelResetBookmarksClick(Sender: TObject);
begin
resetbookmarks('reset');
end;

procedure TFormPeach.LabelResetHistoryClick(Sender: TObject);
begin
dohistoryreset;
end;

procedure TFormPeach.LabelResetPMClick(Sender: TObject);
begin
resetpmmain;
end;

procedure TFormPeach.LabelResetPtmpClick(Sender: TObject);
begin
reset_temp(1);
end;

procedure TFormPeach.LabelGoExtractClick(Sender: TObject);
var stitlestring:ansistring;
begin
stitlestring:=titlestring;
list_toextractor('all','full');
titlestring:=stitlestring;
end;

procedure TFormPeach.LabelTitleAdd1Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_add(LabelTitleAdd1,ShapeTitleAddb1) else clicklabel_add(LabelTitleAdd1,Shapelinkadd1);
end;

procedure TFormPeach.LabelTitleAdd1MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_add(LabelTitleAdd1,ShapeTitleAddb1) else enterlabel_add(LabelTitleAdd1,Shapelinkadd1);
end;

procedure TFormPeach.LabelTitleAdd1MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_add(LabelTitleAdd1,ShapeTitleAddb1) else exitlabel_add(LabelTitleAdd1,Shapelinkadd1);
end;

procedure TFormPeach.LabelTitleAdd2Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_add(LabelTitleAdd2,ShapeTitleAddb2) else clicklabel_add(LabelTitleAdd2,Shapelinkadd2);
end;

procedure TFormPeach.LabelTitleAdd2MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_add(LabelTitleAdd2,ShapeTitleAddb2) else enterlabel_add(LabelTitleAdd2,Shapelinkadd2);
end;

procedure TFormPeach.LabelTitleAdd2MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_add(LabelTitleAdd2,ShapeTitleAddb2) else exitlabel_add(LabelTitleAdd2,Shapelinkadd2);
end;

procedure TFormPeach.LabelTitleAdd3Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_add(LabelTitleAdd3,ShapeTitleAddb3) else clicklabel_add(LabelTitleAdd3,Shapelinkadd3);
end;

procedure TFormPeach.LabelTitleAdd3MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_add(LabelTitleAdd3,ShapeTitleAddb3) else enterlabel_add(LabelTitleAdd3,Shapelinkadd3);
end;

procedure TFormPeach.LabelTitleAdd3MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_add(LabelTitleAdd3,ShapeTitleAddb3) else exitlabel_add(LabelTitleAdd3,Shapelinkadd3);
end;

procedure TFormPeach.LabelTitleAdd4Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_add(LabelTitleAdd4,ShapeTitleAddb4) else clicklabel_add(LabelTitleAdd4,Shapelinkadd4);
end;

procedure TFormPeach.LabelTitleAdd4MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_add(LabelTitleAdd4,ShapeTitleAddb4) else enterlabel_add(LabelTitleAdd4,Shapelinkadd4);
end;

procedure TFormPeach.LabelTitleAdd4MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_add(LabelTitleAdd4,ShapeTitleAddb4) else exitlabel_add(LabelTitleAdd4,Shapelinkadd4);
end;

procedure TFormPeach.LabelTitleApps1Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_apps(LabelTitleApps1,ShapeTitleAppsb1) else clicklabel_apps(LabelTitleApps1,Shapelinkapps1);
end;

procedure TFormPeach.LabelTitleApps1MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_apps(LabelTitleApps1,ShapeTitleAppsb1) else enterlabel_apps(LabelTitleApps1,Shapelinkapps1);
end;

procedure TFormPeach.LabelTitleApps1MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_apps(LabelTitleApps1,ShapeTitleAppsb1) else exitlabel_apps(LabelTitleApps1,Shapelinkapps1);
end;

procedure TFormPeach.LabelTitleApps2Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_apps(LabelTitleApps2,ShapeTitleAppsb2) else clicklabel_apps(LabelTitleApps2,Shapelinkapps2);
end;

procedure TFormPeach.LabelTitleApps2MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_apps(LabelTitleApps2,ShapeTitleAppsb2) else enterlabel_apps(LabelTitleApps2,Shapelinkapps2);
end;

procedure TFormPeach.LabelTitleApps2MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_apps(LabelTitleApps2,ShapeTitleAppsb2) else exitlabel_apps(LabelTitleApps2,Shapelinkapps2);
end;

procedure TFormPeach.LabelTitleExtract1Click(Sender: TObject);
begin
if work_dir=5 then FormPeach.CheckBoxrelative.enabled:=false
else CheckBoxrelative.enabled:=true;
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_extract(LabelTitleExtract1,ShapeTitleExtractb1) else clicklabel_extract(LabelTitleExtract1,Shapelinkextract1);
end;

procedure TFormPeach.LabelTitleExtract1MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_extract(LabelTitleExtract1,ShapeTitleExtractb1) else enterlabel_extract(LabelTitleExtract1,Shapelinkextract1);
end;

procedure TFormPeach.LabelTitleExtract1MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_extract(LabelTitleExtract1,ShapeTitleExtractb1) else exitlabel_extract(LabelTitleExtract1,Shapelinkextract1);
end;

procedure TFormPeach.LabelTitleExtract2Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_extract(LabelTitleExtract2,ShapeTitleExtractb2) else clicklabel_extract(LabelTitleExtract2,Shapelinkextract2);
end;

procedure TFormPeach.LabelTitleExtract2MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_extract(LabelTitleExtract2,ShapeTitleExtractb2) else enterlabel_extract(LabelTitleExtract2,Shapelinkextract2);
end;

procedure TFormPeach.LabelTitleExtract2MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_extract(LabelTitleExtract2,ShapeTitleExtractb2) else exitlabel_extract(LabelTitleExtract2,Shapelinkextract2);
end;

procedure TFormPeach.LabelTitleExtract3Click(Sender: TObject);
begin
if disableintscript=1 then CheckBoxrelative.enabled:=false;
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_extract(LabelTitleExtract3,ShapeTitleExtractb3) else clicklabel_extract(LabelTitleExtract3,Shapelinkextract3);
end;

procedure TFormPeach.LabelTitleExtract3MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_extract(LabelTitleExtract3,ShapeTitleExtractb3) else enterlabel_extract(LabelTitleExtract3,Shapelinkextract3);
end;

procedure TFormPeach.LabelTitleExtract3MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_extract(LabelTitleExtract3,ShapeTitleExtractb3) else exitlabel_extract(LabelTitleExtract3,Shapelinkextract3);
end;

procedure TFormPeach.LabelTitleExtract4Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_extract(LabelTitleExtract4,ShapeTitleExtractb4) else clicklabel_extract(LabelTitleExtract4,Shapelinkextract4);
end;

procedure TFormPeach.LabelTitleExtract4MouseEnter(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then enterlabel_extract(LabelTitleExtract4,ShapeTitleExtractb4) else enterlabel_extract(LabelTitleExtract4,Shapelinkextract4);
end;

procedure TFormPeach.LabelTitleExtract4MouseLeave(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then exitlabel_extract(LabelTitleExtract4,ShapeTitleExtractb4) else exitlabel_extract(LabelTitleExtract4,Shapelinkextract4);
end;

procedure TFormPeach.LabelTitleOptions1Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions1, ShapeOptions1);
end;

procedure TFormPeach.LabelTitleOptions1MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions1, ShapeOptions1);
end;

procedure TFormPeach.LabelTitleOptions1MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions1, ShapeOptions1);
end;

procedure TFormPeach.LabelTitleOptions3Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions3, ShapeOptions3);
end;

procedure TFormPeach.LabelTitleOptions3MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions3, ShapeOptions3);
end;

procedure TFormPeach.LabelTitleOptions3MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions3, ShapeOptions3);
end;

procedure TFormPeach.LabelTitleOptions4Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions4, ShapeOptions4);
end;

procedure TFormPeach.LabelTitleOptions4MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions4, ShapeOptions4);
end;

procedure TFormPeach.LabelTitleOptions4MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions4, ShapeOptions4);
end;

procedure TFormPeach.LabelTitleOptions5Click(Sender: TObject);
begin
if (alttabstyle<>1) and (alttabstyle<>4) then clicklabel_apps(FormPeach.LabelTitleApps1,FormPeach.ShapeTitleAppsb1) else clicklabel_apps(FormPeach.LabelTitleApps1,FormPeach.Shapelinkapps1);
clicklabel_options(LabelTitleOptions5, ShapeOptions5);
end;

procedure TFormPeach.LabelTitleOptions5MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions5, ShapeOptions5);
end;

procedure TFormPeach.LabelTitleOptions5MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions5, ShapeOptions5);
end;

procedure TFormPeach.LabelTitleOptions6Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions6, ShapeOptions6);
end;

procedure TFormPeach.LabelTitleOptions6MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions6, ShapeOptions6);
end;

procedure TFormPeach.LabelTitleOptions6MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions6, ShapeOptions6);
end;

procedure TFormPeach.LabelTitleOptions7Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions7, ShapeOptions7);
end;

procedure TFormPeach.LabelTitleOptions7MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions7, ShapeOptions7);
end;

procedure TFormPeach.LabelTitleOptions7MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions7, ShapeOptions7);
end;

procedure TFormPeach.LabelTitleOptions8Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions8, ShapeOptions8);
end;

procedure TFormPeach.LabelTitleOptions8MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions8, ShapeOptions8);
end;

procedure TFormPeach.LabelTitleOptions8MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions8, ShapeOptions8);
end;

procedure TFormPeach.ListViewBrowserData(Sender: TObject; Item: TListItem);
//current limitations of listview in virtual mode:
//disable showing exe icons and images thubnails (Windows, browsing the filesystem) for performances reasons needs to run in separate threads which are implemented in non virtual mode.
//disable dynamic content filter typing in the address bar (the mirror listview item is not created when virtual mode is set).
//SelectItem needs to parse the entire listview, fast selection routine for Windows was disabled (other OSes does not support this routine and are faster at updating the selection using the slow routine).
//This leads to disable item rename with mouse click, rename is only reached from F2 or from menu (as the slow selection may be misleading for users at least on Windows)
//With virtual mode it is not easy to set focus to the last browsed item, even if selection is correct
{$IFDEF MSWINDOWS}
var
   abitmap,bbitmap:TBitmap;
   icon1:TIcon;
   eisize,p,x,y,k:integer;
   s,fs:ansistring;
   fileinfo: SHFILEINFO;
{$ENDIF}
begin
if Item.Index>=FormPeach.StringGridList.RowCount-1 then exit;
if updatingsel=true then exit;
updatingsel:=true;
//updatinglistview:=true;
Item.Caption:=FormPeach.StringGridList.Cells[1,Item.Index+1];
Item.SubItems.Add(FormPeach.StringGridList.Cells[2,Item.Index+1]);
Item.SubItems.Add(nicenumber(FormPeach.StringGridList.Cells[3,Item.Index+1],filesizebase));
Item.SubItems.Add(nicenumber(FormPeach.StringGridList.Cells[4,Item.Index+1],filesizebase));
Item.SubItems.Add(FormPeach.StringGridList.Cells[5,Item.Index+1]);
Item.SubItems.Add(FormPeach.StringGridList.Cells[6,Item.Index+1]);
Item.SubItems.Add(FormPeach.StringGridList.Cells[7,Item.Index+1]);
Item.SubItems.Add(FormPeach.StringGridList.Cells[8,Item.Index+1]);
Item.SubItems.Add(FormPeach.StringGridList.Cells[9,Item.Index+1]);
Item.SubItems.Add(FormPeach.StringGridList.Cells[10,Item.Index+1]);
Item.SubItems.Add(FormPeach.StringGridList.Cells[11,Item.Index+1]);
Item.SubItems.Add(FormPeach.StringGridList.Cells[12,Item.Index+1]);
if FormPeach.StringGridList.Cells[16,Item.Index+1]='1' then
   try
   Item.Selected:=true;
   except
   end;
Item.ImageIndex:=drawlisticon(Item.Index+1);
{
//loading exe icons and images thumbnails needs to be performed in separate threads for performances
//in this case treeview is set in non-virtual mode at runtime
{$IFDEF MSWINDOWS}
if fun='FILEBROWSER' then
   begin
   //load exe icons
   if FormPeach.StringGridList.Cells[2,Item.Index+1]='.exe' then
      if strtoint(FormPeach.StringGridList.Cells[3,Item.Index+1])<64000000 then //don't search for icons if exe is large, for performance reasons
      begin
      case browsertype of
         2: eisize:=largeiconsize;
         1: eisize:=smalliconsize;
         0: eisize:=smalliconsize;
      end;
      if eisize>0 then
         begin
         try
            abitmap:=Tbitmap.Create;
            bbitmap:=Tbitmap.Create;
            icon1:=TIcon.Create;
            s:=FormPeach.StringGridList.Cells[12,Item.Index+1];
            k:=0;
            if eisize=16 then k:=SHGetFileInfo(pchar(s), 0, fileinfo, sizeof(fileinfo), SHGFI_ICON or SHGFI_SMALLICON)
            else k:=SHGetFileInfo(pchar(s), 0, fileinfo, sizeof(fileinfo), SHGFI_ICON or SHGFI_LARGEICON);
            if k<>0 then
               begin
               icon1.Handle:=fileinfo.hIcon;
               abitmap.Height:=icon1.Height;
               abitmap.Width:=icon1.Width;
               abitmap.Canvas.draw(0,0,icon1);
               p:=0;
               for y:=0 to icon1.Height-1 do
                  for x:=0 to icon1.Width-1 do
                     if (icon1.Canvas.Pixels[x,y]<>$FFFFFF) and (icon1.Canvas.Pixels[x,y]<>$000000) then
                        begin
                        p:=p+1;
                        Break;
                        end;
               if p<>0 then
                  begin
                  abitmap.TransparentColor:=clBlack;
                  abitmap.Transparent:=true;
                  end;
               DestroyIcon(fileinfo.hIcon);
               end
            else
               begin
               abitmap:=Tbitmap.Create;
               abitmap.Assign(FormPeach.ListViewBrowser.Items[1]);
               end;
            if eisize=16 then
               begin
               setpbitmap(abitmap, (icon1.Width*pzoom) div 100);
               setsize_bitmap(abitmap, icon_sizeplus, DECO_NONE);
               il16.Add(abitmap,nil);
               Item.ImageIndex:=il16.Count-1;
               end
            else
               begin
               setpbitmap(abitmap,scalediconsize);
               loadlargeicon(abitmap,bbitmap,spacedscalediconsize);
               il96.Add(bbitmap,nil);
               Item.ImageIndex:=il96.Count-1;
               end;
         finally
            abitmap.free;
            bbitmap.free;
            icon1.Free;
         end;
         end;
      end;
   //load thumbnails of images
   if showthumbnails=1 then
   if supportedimgtype(FormPeach.StringGridList.Cells[2,Item.Index+1])=true then
      begin
      abitmap:=Tbitmap.Create;
      load_bitmap(abitmap, FormPeach.StringGridList.Cells[12,Item.Index+1], scalediconsize, deco_style, fs);
      setsize_bitmap(abitmap, spacedscalediconsize, DECO_NONE);
      case browsertype of
         2: eisize:=largeiconsize;
         1: eisize:=smalliconsize;
         0: eisize:=smalliconsize;
      end;
      if eisize=16 then
         begin
         il16.Add(abitmap,nil);
         Item.ImageIndex:=il16.Count-1;
         end
      else
         begin
         il96.Add(abitmap,nil);
         Item.ImageIndex:=il96.Count-1;
         end;
      FormPeach.StringGridList.Cells[4,Item.Index+1]:=fs;
      FormPeach.StringGridList.Cells[15,Item.Index+1]:=fs;
      abitmap.free;
      end;
   end;
{$ENDIF}
}
//updatinglistview:=false;
updatingsel:=false;
end;

procedure TFormPeach.ListViewBrowserColumnClick(Sender: TObject; Column: TListColumn
  );
var
   c:integer;
begin
   if refreshstatus<>0 then exit;
   savecol;
   c:=Column.Index+1;
   listcol:=c;
   if c=1 then c:=13;
   if c=3 then c:=14;
   if c=4 then c:=15;
   if c=17 then c:=12;

   if c=listsortcol then
      if StringGridlist.SortOrder=soAscending then StringGridlist.SortOrder:=soDescending
      else StringGridlist.SortOrder:=soAscending
   else StringGridlist.SortOrder:=soAscending;
   sort_az_stringgridlist(c);

   listsortcol:=c;
   update_listview;
   if fun='UN7Z' then generate_archive_breadcrumb;
   {$IFNDEF MSWINDOWS}
   if (showthumbnails=1) and (FormPeach.Visible=true) and (FormPeach.PanelIntro.Top<>0) and (openstarted=true) then
      if gofthumbs=true then forcethumbnails;
   {$ENDIF}
end;

procedure TFormPeach.mAboutClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions8, ShapeOptions8);
end;

procedure TFormPeach.pmtabsnewClick(Sender: TObject);
begin
addptab;
sortplustab;
end;

procedure TFormPeach.pmtabscloseClick(Sender: TObject);
begin
do_closetab;
end;

procedure TFormPeach.pmtabscloseotherClick(Sender: TObject);
begin
closeallothertabs;
end;

procedure TFormPeach.pmtabscloserightClick(Sender: TObject);
var
   i,selptab:integer;
begin
if TabBar.Sections.Count<=2 then exit;
for i:=0 to TabBar.Sections.Count-1 do
   if TabBar.Sections.Items[i].ID=ptabid then break;
selptab:=i;
i:=i+1;
repeat
   if TabBar.Sections.Items[i].ID<>0 then TabBar.Sections.Delete(i);
until i>=TabBar.Sections.Count-1;
if ptabid=atabid then //selected active tab, no further action needed
   begin
   end
else //selected inactive tab, make it active
   begin
   for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
   atabid:=TabBar.Sections.Items[selptab].ID;
   TabBar.Sections.Items[selptab].Text:='<'+TabBar.Sections.Items[selptab].Text+'>';
   StringGridSessionHistory.RowCount:=2;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[atabid];
   browsehistory;
   end;
end;

procedure TFormPeach.pmtabsbookmarkaddClick(Sender: TObject);
var
   i,selptab:integer;
begin
for i:=0 to TabBar.Sections.Count-1 do
   if TabBar.Sections.Items[i].ID=ptabid then break;
selptab:=i;
if ptabid=atabid then //selected active tab
   begin
   end
else //selected inactive tab, make it active
   begin
   for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
   atabid:=TabBar.Sections.Items[selptab].ID;
   TabBar.Sections.Items[selptab].Text:='<'+TabBar.Sections.Items[selptab].Text+'>';
   StringGridSessionHistory.RowCount:=2;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[atabid];
   browsehistory;
   end;
addtobookmarks('*history');
end;

procedure TFormPeach.pmtabsbookmarkorgClick(Sender: TObject);
begin
 do_organizebookmarks;
end;

procedure TFormPeach.pmtabscollapseClick(Sender: TObject);
var
   i:integer;
begin
for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections.Items[i].Width:=barheight+barheight div 2;
end;

procedure TFormPeach.pmtabsexpandClick(Sender: TObject);
var
   i:integer;
begin
for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections.Items[i].Width:=barheight*6;
end;

procedure TFormPeach.TabBarContextPopup(Sender: TObject;
  MousePos: TPoint; var Handled: Boolean);
var
   currentptab:integer;
begin
tabaddress.visible:=false;
currentptab:=TabBar.GetSectionAt(MousePos);
if currentptab<0 then begin ptabid:=atabid; exit; end;//no selection, select current active tab
if TabBar.Sections.Items[currentptab].ID<=0 then
   ptabid:=atabid//selected "add tab", select current active tab
else
   begin
   ptabid:=TabBar.Sections.Items[currentptab].ID; //selected inactive tab
   tabaddress.caption:=StringGridTabs.Cells[2,TabBar.Sections.Items[currentptab].ID];
   tabaddress.visible:=true;
   end;
end;

procedure TFormPeach.TabBarMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   currentptab:integer;
   p:TPoint;
begin
case button of
   mbMiddle:
   begin
   p.x:=X;
   p.y:=Y;
   currentptab:=TabBar.GetSectionAt(p);
   if currentptab<0 then begin ptabid:=atabid; exit; end;//no selection, select current active tab
   if TabBar.Sections.Items[currentptab].ID<=0 then
      ptabid:=atabid//selected "add tab", select current active tab
   else
      ptabid:=TabBar.Sections.Items[currentptab].ID; //selected inactive tab
   do_closetab;
   end;
end;
end;

procedure TFormPeach.TabBarMouseEnter(Sender: TObject);
begin
TabBar.Cursor:=crDefault;
end;

procedure TFormPeach.TabBarSectionClick(
  HeaderControl: TCustomHeaderControl; Section: THeaderSection);
var
   selptab,i:integer;
begin
if TabBar.Sections.Items[Section.Index].ID<>0 then
   begin
   for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
   StringGridSessionHistory.RowCount:=2;
   selptab:=Section.Index;
   atabid:=TabBar.Sections.Items[selptab].ID;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[Section.ID];
   StringGridSessionHistory.Row:=StringGridSessionHistory.RowCount-1;
   browsehistory;
   end
else
   begin
   ptabid:=atabid;
   addptab;
   end;
sortplustab;
end;

procedure TFormPeach.TabBarSectionEndDrag(Sender: TObject);
begin
sortplustab;
end;

procedure TFormPeach.maddconvertClick(Sender: TObject);
begin
archive_convert;
end;

procedure TFormPeach.maddexistingClick(Sender: TObject);
begin
if open_archive<>1 then exit;
do_add;
end;

procedure TFormPeach.mlayoutsClick(Sender: TObject);
begin
if not(checkdirexists(confpath+'Layouts'+DirectorySeparator)) then mkdir(confpath+'Layouts'+DirectorySeparator);
cp_open(confpath+'Layouts'+DirectorySeparator,desk_env);
end;

procedure TFormPeach.mCharCaseClick(Sender: TObject);
begin
select_by('charcase','neutralsel');
end;

procedure TFormPeach.mCharClick(Sender: TObject);
begin
select_by('char','neutralsel');
end;

procedure TFormPeach.mDateMonthClick(Sender: TObject);
begin
select_by('datemonth','neutralsel');
end;

procedure TFormPeach.mDateDayClick(Sender: TObject);
begin
select_by('dateday','neutralsel');
end;

procedure TFormPeach.mDateHourClick(Sender: TObject);
begin
select_by('datehour','neutralsel');
end;

procedure TFormPeach.mDateWeekClick(Sender: TObject);
begin
select_by('dateweek','neutralsel');
end;

procedure TFormPeach.mDateYearClick(Sender: TObject);
begin
select_by('dateyear','neutralsel');
end;

procedure TFormPeach.mpacked100kClick(Sender: TObject);
begin
select_by('packed100k','neutralsel');
end;

procedure TFormPeach.mpacked100mClick(Sender: TObject);
begin
select_by('packed100m','neutralsel');
end;

procedure TFormPeach.mpacked10mClick(Sender: TObject);
begin
select_by('packed10m','neutralsel');
end;

procedure TFormPeach.mpackedemptyClick(Sender: TObject);
begin
select_by('packedempty','neutralsel');
end;

procedure TFormPeach.mpackedoverClick(Sender: TObject);
begin
select_by('packedover','neutralsel');
end;

procedure TFormPeach.mpackedsimilar50Click(Sender: TObject);
begin
select_by('packedsimilar50','neutralsel');
end;

procedure TFormPeach.mpackedsimilarClick(Sender: TObject);
begin
select_by('packedsimilar10','neutralsel');
end;

procedure TFormPeach.cbAdvfAddClick(Sender: TObject);
begin
if settingadv=true then exit;
try
if FormPeach.cbAdvfAdd.state=cbchecked then
   begin
   set_advfilters;
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   setfiltericon(false);
   FormPeach.cbAdvfExt.state:=cbunchecked;
   advfiltersupdate;
   end;
except
end;
end;

procedure TFormPeach.cbAdvfExtClick(Sender: TObject);
begin
if settingadv=true then exit;
try
if FormPeach.cbAdvfExt.state=cbchecked then
   begin
   set_advfilters;
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   setfiltericon(false);
   FormPeach.cbAdvfAdd.state:=cbunchecked;
   advfiltersupdate;
   end;
except
end;
end;

procedure TFormPeach.cbautoclosesingleextractClick(Sender: TObject);
begin
on_cbautoclosesingleextract_click;
end;

procedure TFormPeach.cbCustomExtensionClick(Sender: TObject);
begin
if FormPeach.cbCustomExtension.State=cbChecked then repcustext:=1 else repcustext:=0;
end;

procedure TFormPeach.cbdefaultactionChange(Sender: TObject);
begin
on_cbdefaultactionchange;
end;

procedure TFormPeach.cbDeleteInputModeAddChange(Sender: TObject);
begin
on_cbdeleteinputmode1Change;
end;

procedure TFormPeach.cbDeleteInputModeExtChange(Sender: TObject);
begin
on_cbdeleteinputmodeChange;
end;

procedure TFormPeach.cbEncExtensionClick(Sender: TObject);
begin
if FormPeach.cbEncExtension.State=cbChecked then addencext:=1 else addencext:=0;
end;

procedure TFormPeach.cbEncodingChange(Sender: TObject);
begin
on_CBEncoding1Change;
end;

procedure TFormPeach.cbSmallIconSizeChange(Sender: TObject);
begin
ensmall:=cbSmallIconSize.ItemIndex;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.cbRAR5Click(Sender: TObject);
begin
if FormPeach.cbRAR5.State=cbChecked then
   begin
   userar5:=1;
   FormPeach.cbRARBLAKE2.enabled:=true;
   FormPeach.labelRARdict.enabled:=true;
   FormPeach.comboRARdict.enabled:=true;
   end
else
   begin
   userar5:=0;
   FormPeach.cbRARBLAKE2.enabled:=false;
   FormPeach.labelRARdict.enabled:=false;
   FormPeach.comboRARdict.enabled:=false;
   end;
end;

procedure TFormPeach.cbRARmanualClick(Sender: TObject);
begin
if FormPeach.cbRARmanual.State=cbChecked then setrarmanual:=1 else setrarmanual:=0;
if setrarmanual=1 then if openstarted=true then ButtonEditNameCustomClick(nil);
testwinrar;
end;

procedure TFormPeach.cbRARBLAKE2Click(Sender: TObject);
begin
if FormPeach.cbRARBLAKE2.State=cbChecked then userarblake2:=1 else userarblake2:=0;
end;

procedure TFormPeach.cbRARClick(Sender: TObject);
begin
if cbRAR.Checked=true then
   begin
   CompressionCustom.Visible:=false;
   PanelRar.Visible:=true;
   userar:=1;
   testwinrar;
   end
else
   begin
   CompressionCustom.Visible:=true;
   PanelRar.Visible:=false;
   userar:=0;
   setnonrarcust;
   end;
FormPeach.cbRAR5Click(nil);
end;

procedure TFormPeach.cbRARlastmodtimeChange(Sender: TObject);
begin
if cbRARlastmodtime.ItemIndex>=0 then userarlastmodtime:=cbRARlastmodtime.ItemIndex
else userarlastmodtime:=0;
end;

procedure TFormPeach.cbRARlockClick(Sender: TObject);
begin
if FormPeach.cbRARlock.State=cbChecked then userarlock:=1 else userarlock:=0;
end;

procedure TFormPeach.cbRARrrClick(Sender: TObject);
begin
if FormPeach.cbRARrr.State=cbChecked then userarrr:=1 else userarrr:=0;
end;

procedure TFormPeach.cbRARsaveopenClick(Sender: TObject);
begin
if FormPeach.cbRARsaveopen.State=cbChecked then userarsaveopen:=1 else userarsaveopen:=0;
end;

procedure TFormPeach.cbRARsavesecurityClick(Sender: TObject);
begin
if FormPeach.cbRARsavesecurity.State=cbChecked then userarsavesecurity:=1 else userarsavesecurity:=0;
end;

procedure TFormPeach.cbRARsavestreamsClick(Sender: TObject);
begin
if FormPeach.cbRARsavestreams.State=cbChecked then userarsavestreams:=1 else userarsavestreams:=0;
end;

procedure TFormPeach.cbRARsfxClick(Sender: TObject);
begin
if FormPeach.cbRARsfx.State=cbChecked then userarsfx:=1 else userarsfx:=0;
end;

procedure TFormPeach.cbRARsolidClick(Sender: TObject);
begin
if FormPeach.cbRARsolid.State=cbChecked then userarsolid:=1 else userarsolid:=0;
end;

procedure TFormPeach.cbtarpipeClick(Sender: TObject);
begin
if cbtarpipe.State=cbChecked then scripttarpipe:=1 else scripttarpipe:=0;
setscripttarpipe;
end;

procedure TFormPeach.cbuntarpipeClick(Sender: TObject);
begin
if cbuntarpipe.State=cbChecked then scriptuntarpipe:=1 else scriptuntarpipe:=0;
setscriptuntarpipe;
end;

procedure TFormPeach.cbBoxAltBarStyleChange(Sender: TObject);
begin
decostyle:=cbBoxAltBarStyle.ItemIndex;
if openstarted=true then apply_theme;
end;

procedure TFormPeach.CheckBoxUTCClick(Sender: TObject);
begin
on_checkboxutcclick;
end;

procedure TFormPeach.ComboBoxPEAKDFwChange(Sender: TObject);
begin
ComboBoxKDF1_onchange;
end;

procedure TFormPeach.ComboBoxPEAKDFChange(Sender: TObject);
begin
ComboBoxKDF_onchange;
end;

procedure TFormPeach.csbdeskClick(Sender: TObject);
begin
jumpto('desktop');
end;

procedure TFormPeach.csbdocClick(Sender: TObject);
begin
jumpto('usrdocuments');
end;

procedure TFormPeach.csbdownloadsClick(Sender: TObject);
begin
jumpto('sysdownloads');
end;

procedure TFormPeach.csbhomeClick(Sender: TObject);
begin
jumpto('home');
end;

procedure TFormPeach.csbmusicClick(Sender: TObject);
begin
jumpto('usrmusic');
end;

procedure TFormPeach.csbpicClick(Sender: TObject);
begin
jumpto('usrpictures');
end;

procedure TFormPeach.csbvidClick(Sender: TObject);
begin
jumpto('usrvideos');
end;

procedure TFormPeach.csbrootClick(Sender: TObject);
begin
jumpto('root');
end;

procedure TFormPeach.cbtreeChange(Sender: TObject);
begin
on_cbtreechange;
end;

procedure TFormPeach.cbspacingChange(Sender: TObject);
begin
case cbspacing.ItemIndex of
   0: pspacing:=6;
   1: pspacing:=12;
   2: pspacing:=18;
   3: pspacing:=24;
   end;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.cbzoomingChange(Sender: TObject);
begin
case cbzooming.ItemIndex of
   0: pzoom:=50;
   1: pzoom:=67;
   2: pzoom:=80;
   3: pzoom:=87;
   5: pzoom:=113;
   6: pzoom:=125;
   7: pzoom:=150;
   8: pzoom:=175;
   9: pzoom:=200
   else pzoom:=100;
   end;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mb10Click(Sender: TObject);
begin
browsebookmark(10);
end;

procedure TFormPeach.mb11Click(Sender: TObject);
begin
browsebookmark(11);
end;

procedure TFormPeach.mb12Click(Sender: TObject);
begin
browsebookmark(12);
end;

procedure TFormPeach.mb13Click(Sender: TObject);
begin
browsebookmark(13);
end;

procedure TFormPeach.mb14Click(Sender: TObject);
begin
browsebookmark(14);
end;

procedure TFormPeach.mb15Click(Sender: TObject);
begin
browsebookmark(15);
end;

procedure TFormPeach.mb16Click(Sender: TObject);
begin
browsebookmark(16);
end;

procedure TFormPeach.mb17Click(Sender: TObject);
begin
browsebookmark(17);
end;

procedure TFormPeach.mb18Click(Sender: TObject);
begin
browsebookmark(18);
end;

procedure TFormPeach.mb19Click(Sender: TObject);
begin
browsebookmark(19);
end;

procedure TFormPeach.mb1Click(Sender: TObject);
begin
browsebookmark(1);
end;

procedure TFormPeach.mb20Click(Sender: TObject);
begin
browsebookmark(20);
end;

procedure TFormPeach.mb21Click(Sender: TObject);
begin
browsebookmark(21);
end;

procedure TFormPeach.mb22Click(Sender: TObject);
begin
browsebookmark(22);
end;

procedure TFormPeach.mb23Click(Sender: TObject);
begin
browsebookmark(23);
end;

procedure TFormPeach.mb24Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelOpen.visible=false{$ELSE}if FormPeach.PanelOpen.top<>0{$ENDIF} then exit;
showpanel('open');
if stringgridbookmarks.visible=false then showbar('bookmarks');
navrefresh;
end;

procedure TFormPeach.mb2Click(Sender: TObject);
begin
browsebookmark(2);
end;

procedure TFormPeach.mb3Click(Sender: TObject);
begin
browsebookmark(3);
end;

procedure TFormPeach.mb4Click(Sender: TObject);
begin
browsebookmark(4);
end;

procedure TFormPeach.mb5Click(Sender: TObject);
begin
browsebookmark(5);
end;

procedure TFormPeach.mb6Click(Sender: TObject);
begin
browsebookmark(6);
end;

procedure TFormPeach.mb7Click(Sender: TObject);
begin
browsebookmark(7);
end;

procedure TFormPeach.mb8Click(Sender: TObject);
begin
browsebookmark(8);
end;

procedure TFormPeach.mb9Click(Sender: TObject);
begin
browsebookmark(9);
end;

procedure TFormPeach.mbAddArchiveClick(Sender: TObject);
begin
addarchive_tobookmarks;
end;

procedure TFormPeach.mbAddPathClick(Sender: TObject);
begin
addpath_tobookmarks;
end;

procedure TFormPeach.mbc1Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc1.caption);
end;

procedure TFormPeach.mbc2Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc2.caption);
end;

procedure TFormPeach.mbc3Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc3.caption);
end;

procedure TFormPeach.mbc4Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc4.caption);
end;

procedure TFormPeach.mbc5Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc5.caption);
end;

procedure TFormPeach.mbc6Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc6.caption);
end;

procedure TFormPeach.mbc7Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc7.caption);
end;

procedure TFormPeach.mbc8Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc8.caption);
end;

procedure TFormPeach.mbclClick(Sender: TObject);
var
   s:ansistring;
begin
if StringGridBookmarks.Rowcount<2 then exit;
s:=StringGridBookmarks.Cells[2,StringGridBookmarks.Row];
if s='' then exit;
if s=txt_mypc then exit;
if s<>'' then
   if s[length(s)]=directoryseparator then //folder
   else //get object's path
      s:=extractfilepath(s);
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
open_cp(s);
end;

procedure TFormPeach.mbDeleteClick(Sender: TObject);
begin
if StringGridBookmarks.Rowcount<2 then exit;
StringGridBookmarks.DeleteColRow(false,StringGridBookmarks.Row);
populatebookmarks;
end;

procedure TFormPeach.mbexploreClick(Sender: TObject);
var
   s:ansistring;
begin
if StringGridBookmarks.Rowcount<2 then exit;
s:=StringGridBookmarks.Cells[2,StringGridBookmarks.Row];
if s='' then exit;
if s=txt_mypc then exit;
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
cp_explorepath(s, desk_env);
end;

procedure TFormPeach.mbNotesClick(Sender: TObject);
begin
if StringGridBookmarks.Rowcount<2 then exit;
addnote_tobookmarks;
end;

procedure TFormPeach.mbpeaClick(Sender: TObject);//always open path in filebrowser
var
   s:ansistring;
begin
if StringGridBookmarks.Rowcount<2 then exit;
s:=StringGridBookmarks.Cells[2,StringGridBookmarks.Row];
if s='' then exit;
if s=txt_mypc then
   begin
   listpc;
   exit;
   end;
if s<>'' then
   if s[length(s)]=directoryseparator then //open folder
   else //go to object's path
      s:=extractfilepath(s);
fun:='FILEBROWSER';
fun_status:=fun;
FormPeach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure TFormPeach.mbresetClick(Sender: TObject);
begin
resetbookmarks('delete');
end;

procedure TFormPeach.mcattClick(Sender: TObject);
begin
catt:=not(catt);
mcatt.Checked:=catt;
pmcatt.Checked:=catt;
set_listview_col;
end;

procedure TFormPeach.mccrcClick(Sender: TObject);
begin
ccrc:=not(ccrc);
mccrc.Checked:=ccrc;
pmccrc.Checked:=ccrc;
set_listview_col;
end;

procedure TFormPeach.mcdateClick(Sender: TObject);
begin
cdate:=not(cdate);
mcdate.Checked:=cdate;
pmcdate.Checked:=cdate;
set_listview_col;
end;

procedure TFormPeach.mcfreeClick(Sender: TObject);
begin
cfree:=not(cfree);
mcfree.Checked:=cfree;
pmcfree.Checked:=cfree;
set_listview_col;
end;

procedure TFormPeach.mcfsClick(Sender: TObject);
begin
cfs:=not(cfs);
mcfs.Checked:=cfs;
pmcfs.Checked:=cfs;
set_listview_col;
end;

procedure TFormPeach.mcpackedClick(Sender: TObject);
begin
cpacked:=not(cpacked);
mcpacked.Checked:=cpacked;
pmcpacked.Checked:=cpacked;
set_listview_col;
end;

procedure TFormPeach.mcpClick(Sender: TObject);
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then sg:=StringGridAdd
else sg:=StringGridExtract;
if sg.Rowcount=1 then exit;
if sg.Cells[2,sg.Row]=txt_list_isfolder then s:=sg.Cells[8,sg.Row]
else s:=extractfilepath(sg.Cells[8,sg.Row]);
if s<>'' then open_cp(s);
end;

procedure TFormPeach.mcsizeClick(Sender: TObject);
begin
csize:=not(csize);
mcsize.Checked:=csize;
pmcsize.Checked:=csize;
set_listview_col;
end;

procedure TFormPeach.mdefaultarchiveClick(Sender: TObject);
begin
set_arcout;
end;

procedure TFormPeach.mdefaultextractClick(Sender: TObject);
begin
set_extout;
end;

procedure TFormPeach.mctypeClick(Sender: TObject);
begin
ctype:=not(ctype);
mctype.Checked:=ctype;
pmctype.Checked:=ctype;
set_listview_col;
end;

procedure TFormPeach.mpluginsClick(Sender: TObject);
begin
checkplugins;
end;

procedure TFormPeach.mPeaSiteMirrorClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'index.html',desk_env);
end;

procedure TFormPeach.MenuItemArchive_dropboxClick(Sender: TObject);
begin
archivemenu_name(shared_dropbox);
end;

procedure TFormPeach.MenuItemArchive_googledriveClick(Sender: TObject);
begin
archivemenu_name(shared_googledrive);
end;

procedure TFormPeach.MenuItemArchive_musicClick(Sender: TObject);
begin
archivemenu_name(usr_music);
end;

procedure TFormPeach.MenuItemArchive_picturesClick(Sender: TObject);
begin
archivemenu_name(usr_pictures);
end;

procedure TFormPeach.MenuItemArchive_shpClick(Sender: TObject);
begin
archivemenu_name(shared_sharepointwork);
end;

procedure TFormPeach.MenuItemArchive_onedriveClick(Sender: TObject);
begin
archivemenu_name(shared_onedrive);
end;

procedure TFormPeach.MenuItemArchive_yClick(Sender: TObject);
begin
archivemenu_name(shared_yandex);
end;

procedure TFormPeach.MenuItemArchive_videosClick(Sender: TObject);
begin
archivemenu_name(usr_videos);
end;

procedure TFormPeach.MenuItemOpen_dropboxClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(shared_dropbox);
end;

procedure TFormPeach.MenuItemOpen_googledriveClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(shared_googledrive);
end;

procedure TFormPeach.MenuItemOpen_musicClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(usr_music);
end;

procedure TFormPeach.MenuItemOpen_organizebookmarksClick(Sender: TObject);
begin
  do_organizebookmarks;
end;

procedure TFormPeach.MenuItemOpen_picturesClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(usr_pictures);
end;

procedure TFormPeach.MenuItemOpen_powershellClick(Sender: TObject);
begin
browser_commandprompt(1,1,'');
end;

procedure TFormPeach.MenuItemOpen_onedriveClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(shared_onedrive);
end;

procedure TFormPeach.MenuItemOpen_shpClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(shared_sharepointwork);
end;

procedure TFormPeach.MenuItemOpen_yClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(shared_yandex);
end;

procedure TFormPeach.MenuItemOpen_videosClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(usr_videos);
end;

procedure TFormPeach.MenuItemPowerShellClick(Sender: TObject);
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then sg:=StringGridAdd
else sg:=StringGridExtract;
if sg.Rowcount=1 then exit;
if sg.Cells[2,sg.Row]=txt_list_isfolder then s:=sg.Cells[8,sg.Row]
else s:=extractfilepath(sg.Cells[8,sg.Row]);
if s<>'' then open_ps(s);
end;

procedure TFormPeach.mpeautilsClick(Sender: TObject);
var
   cl:ansistring;
begin
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
execute_cl_process(cl);
end;

procedure TFormPeach.PanelInfoGeneralClick(Sender: TObject);
begin
lastbar:=1;
togglestatusbar;
end;

procedure TFormPeach.pmamr1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent1.Caption)
else addfile_ext_fromname(mRecent1.Caption);
end;

procedure TFormPeach.pmamr2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent2.Caption)
else addfile_ext_fromname(mRecent2.Caption);
end;

procedure TFormPeach.pmamr3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent3.Caption)
else addfile_ext_fromname(mRecent3.Caption);
end;

procedure TFormPeach.pmamr4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent4.Caption)
else addfile_ext_fromname(mRecent4.Caption);
end;

procedure TFormPeach.pmamr5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent5.Caption)
else addfile_ext_fromname(mRecent5.Caption);
end;

procedure TFormPeach.pmamr6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent6.Caption)
else addfile_ext_fromname(mRecent6.Caption);
end;

procedure TFormPeach.pmamr7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent7.Caption)
else addfile_ext_fromname(mRecent7.Caption);
end;

procedure TFormPeach.pmamr8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile_fromname(mRecent8.Caption)
else addfile_ext_fromname(mRecent8.Caption);
end;

procedure TFormPeach.pmabc0Click(Sender: TObject);
begin
browsefiledir(FormPeach.EditOpenInInteractive.Text);
end;

procedure TFormPeach.pmbcd0Click(Sender: TObject);
begin
do_click_breadmenu(0,FormPeach.pmbcd0.Caption);
end;

procedure TFormPeach.pmbcd10Click(Sender: TObject);
begin
do_click_breadmenu(10,FormPeach.pmbcd10.Caption);
end;

procedure TFormPeach.pmbcd11Click(Sender: TObject);
begin
do_click_breadmenu(11,FormPeach.pmbcd11.Caption);
end;

procedure TFormPeach.pmbcd12Click(Sender: TObject);
begin
do_click_breadmenu(12,FormPeach.pmbcd12.Caption);
end;

procedure TFormPeach.pmbcd13Click(Sender: TObject);
begin
do_click_breadmenu(13,FormPeach.pmbcd13.Caption);
end;

procedure TFormPeach.pmbcd14Click(Sender: TObject);
begin
do_click_breadmenu(14,FormPeach.pmbcd14.Caption);
end;

procedure TFormPeach.pmbcd15Click(Sender: TObject);
begin
do_click_breadmenu(15,FormPeach.pmbcd15.Caption);
end;

procedure TFormPeach.pmbcd16Click(Sender: TObject);
begin
do_click_breadmenu(16,FormPeach.pmbcd16.Caption);
end;

procedure TFormPeach.pmbcd17Click(Sender: TObject);
begin
do_click_breadmenu(17,FormPeach.pmbcd17.Caption);
end;

procedure TFormPeach.pmbcd18Click(Sender: TObject);
begin
do_click_breadmenu(18,FormPeach.pmbcd18.Caption);
end;

procedure TFormPeach.pmbcd19Click(Sender: TObject);
begin
do_click_breadmenu(19,FormPeach.pmbcd19.Caption);
end;

procedure TFormPeach.pmbcd1Click(Sender: TObject);
begin
do_click_breadmenu(1,FormPeach.pmbcd1.Caption);
end;

procedure TFormPeach.pmbcd2Click(Sender: TObject);
begin
do_click_breadmenu(2,FormPeach.pmbcd2.Caption);
end;

procedure TFormPeach.pmbcd3Click(Sender: TObject);
begin
do_click_breadmenu(3,FormPeach.pmbcd3.Caption);
end;

procedure TFormPeach.pmbcd4Click(Sender: TObject);
begin
do_click_breadmenu(4,FormPeach.pmbcd4.Caption);
end;

procedure TFormPeach.pmbcd5Click(Sender: TObject);
begin
do_click_breadmenu(5,FormPeach.pmbcd5.Caption);
end;

procedure TFormPeach.pmbcd6Click(Sender: TObject);
begin
do_click_breadmenu(6,FormPeach.pmbcd6.Caption);
end;

procedure TFormPeach.pmbcd7Click(Sender: TObject);
begin
do_click_breadmenu(7,FormPeach.pmbcd7.Caption);
end;

procedure TFormPeach.pmbcd8Click(Sender: TObject);
begin
do_click_breadmenu(8,FormPeach.pmbcd8.Caption);
end;

procedure TFormPeach.pmbcd9Click(Sender: TObject);
begin
do_click_breadmenu(9,FormPeach.pmbcd9.Caption);
end;

procedure TFormPeach.pmbcexpandClick(Sender: TObject);
begin
if fun='UN7Z' then
  if FormPeach.TreeViewNav.Items[0].Text=extractfilename(FormPeach.EditOpenInInteractive.Text) then
     begin
     FormPeach.TreeViewNav.Selected:=FormPeach.TreeViewNav.Items[0];
     if aisexpanded then FormPeach.TreeViewNav.Selected.Collapse(true)
     else FormPeach.TreeViewNav.Selected.Expand(true);
     aisexpanded:=not(aisexpanded);
     end;
end;

procedure TFormPeach.pmbcorganizebookmarksClick(Sender: TObject);
begin
do_organizebookmarks;
end;

{//legacy function procedures from dedicated menu items in breadcrumb context menu
procedure TFormPeach.pmbcexploreClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: begin browser_explorepath(0); exit; end;
1: if LabelClickAddress1.Caption=' '+txt_mypc+' ' then begin browser_explorepath(0); exit; end
   else s:=pmbc8.caption;
2: s:=pmbc7.caption;
3: s:=pmbc6.caption;
4: s:=pmbc5.caption;
5: s:=pmbc4.caption;
6: s:=pmbc3.caption;
7: s:=pmbc2.caption;
8: s:=pmbc1.caption;
end;
if fun='FILEBROWSER' then cp_open(s,desk_env)
else
   begin
   if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
   cp_explorepath(s, desk_env);
   end;
end;

procedure TFormPeach.pmbcpropertiesClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: s:=EditOpenInInteractive.Caption;
1: s:=pmbc8.caption;
2: s:=pmbc7.caption;
3: s:=pmbc6.caption;
4: s:=pmbc5.caption;
5: s:=pmbc4.caption;
6: s:=pmbc3.caption;
7: s:=pmbc2.caption;
8: s:=pmbc1.caption;
end;
if s='' then s:=txt_mypc;
browser_fileproperties(s);
end;

procedure TFormPeach.pmbcwebClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: getmainfiledirname(s);
1: if LabelClickAddress1.Caption=' '+txt_mypc+' ' then s:=''
   else s:=unpadaddress(LabelClickAddress1.caption);
2: s:=unpadaddress(LabelClickAddress2.caption);
3: s:=unpadaddress(LabelClickAddress3.caption);
4: s:=unpadaddress(LabelClickAddress4.caption);
5: s:=unpadaddress(LabelClickAddress5.caption);
6: s:=unpadaddress(LabelClickAddress6.caption);
7: s:=unpadaddress(LabelClickAddress7.caption);
8: s:=unpadaddress(LabelClickAddress8.caption);
   end;
run_websearch(s);
end;}

procedure TFormPeach.pmemb1Click(Sender: TObject);
begin
cp_open(pnb1.Caption,desk_env);
end;

procedure TFormPeach.pmemb2Click(Sender: TObject);
begin
cp_open(pnb2.Caption,desk_env);
end;

procedure TFormPeach.pmemb3Click(Sender: TObject);
begin
cp_open(pnb3.Caption,desk_env);
end;

procedure TFormPeach.pmemb4Click(Sender: TObject);
begin
cp_open(pnb4.Caption,desk_env);
end;

procedure TFormPeach.pmemb5Click(Sender: TObject);
begin
cp_open(pnb5.Caption,desk_env);
end;

procedure TFormPeach.pmemb6Click(Sender: TObject);
begin
cp_open(pnb6.Caption,desk_env);
end;

procedure TFormPeach.pmemb7Click(Sender: TObject);
begin
cp_open(pnb7.Caption,desk_env);
end;

procedure TFormPeach.pmemb8Click(Sender: TObject);
begin
cp_open(pnb8.Caption,desk_env);
end;

procedure TFormPeach.pmemr1Click(Sender: TObject);
begin
  cp_open(pnr1.Caption,desk_env);
end;

procedure TFormPeach.pmemr2Click(Sender: TObject);
begin
  cp_open(pnr2.Caption,desk_env);
end;

procedure TFormPeach.pmemr3Click(Sender: TObject);
begin
  cp_open(pnr3.Caption,desk_env);
end;

procedure TFormPeach.pmemr4Click(Sender: TObject);
begin
  cp_open(pnr4.Caption,desk_env);
end;

procedure TFormPeach.pmemr5Click(Sender: TObject);
begin
  cp_open(pnr5.Caption,desk_env);
end;

procedure TFormPeach.pmemr6Click(Sender: TObject);
begin
  cp_open(pnr6.Caption,desk_env);
end;

procedure TFormPeach.pmemr7Click(Sender: TObject);
begin
  cp_open(pnr7.Caption,desk_env);
end;

procedure TFormPeach.pmemr8Click(Sender: TObject);
begin
  cp_open(pnr8.Caption,desk_env);
end;

procedure TFormPeach.pmflatClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=true{$ELSE}if PanelOpen.top=0{$ENDIF} then
   if (fun='UN7Z') or (fun='FILEBROWSER') then toggle_view;
end;

procedure TFormPeach.pmfun10Click(Sender: TObject);
begin
do_pmfun(pmfun10.caption);
end;

procedure TFormPeach.pmfun11Click(Sender: TObject);
begin
do_pmfun(pmfun11.caption);
end;

procedure TFormPeach.pmfun12Click(Sender: TObject);
begin
do_pmfun(pmfun12.caption);
end;

procedure TFormPeach.pmfun13Click(Sender: TObject);
begin
do_pmfun(pmfun13.caption);
end;

procedure TFormPeach.pmfun14Click(Sender: TObject);
begin
do_pmfun(pmfun14.caption);
end;

procedure TFormPeach.pmfun15Click(Sender: TObject);
begin
do_pmfun(pmfun15.caption);
end;

procedure TFormPeach.pmfun16Click(Sender: TObject);
begin
do_pmfun(pmfun16.caption);
end;

procedure TFormPeach.pmfun17Click(Sender: TObject);
begin
do_pmfun(pmfun17.caption);
end;

procedure TFormPeach.pmfun18Click(Sender: TObject);
begin
do_pmfun(pmfun18.caption);
end;

procedure TFormPeach.pmfun19Click(Sender: TObject);
begin
do_pmfun(pmfun19.caption);
end;

procedure TFormPeach.pmfun1Click(Sender: TObject);
begin
do_pmfun(pmfun1.caption);
end;

procedure TFormPeach.pmfun20Click(Sender: TObject);
begin
do_pmfun(pmfun20.caption);
end;

procedure TFormPeach.pmfun21Click(Sender: TObject);
begin
do_pmfun(pmfun21.caption);
end;

procedure TFormPeach.pmfun22Click(Sender: TObject);
begin
do_pmfun(pmfun22.caption);
end;

procedure TFormPeach.pmfun23Click(Sender: TObject);
begin
do_pmfun(pmfun23.caption);
end;

procedure TFormPeach.pmfun24Click(Sender: TObject);
begin
do_pmfun(pmfun24.caption);
end;

procedure TFormPeach.pmfun25Click(Sender: TObject);
begin
do_pmfun(pmfun25.caption);
end;

procedure TFormPeach.pmfun26Click(Sender: TObject);
begin
do_pmfun(pmfun26.caption);
end;

procedure TFormPeach.pmfun27Click(Sender: TObject);
begin
do_pmfun(pmfun27.caption);
end;

procedure TFormPeach.pmfun28Click(Sender: TObject);
begin
do_pmfun(pmfun28.caption);
end;

procedure TFormPeach.pmfun29Click(Sender: TObject);
begin
do_pmfun(pmfun29.caption);
end;

procedure TFormPeach.pmfun30Click(Sender: TObject);
begin
do_pmfun(pmfun30.caption);
end;

procedure TFormPeach.pmfun31Click(Sender: TObject);
begin
do_pmfun(pmfun31.caption);
end;

procedure TFormPeach.pmfun32Click(Sender: TObject);
begin
do_pmfun(pmfun32.caption);
end;

procedure TFormPeach.pmfun33Click(Sender: TObject);
begin
do_pmfun(pmfun33.caption);
end;

procedure TFormPeach.pmfun34Click(Sender: TObject);
begin
do_pmfun(pmfun34.caption);
end;

procedure TFormPeach.pmfun35Click(Sender: TObject);
begin
do_pmfun(pmfun35.caption);
end;

procedure TFormPeach.pmh1Click(Sender: TObject);
begin
browsehistoryn(1);
end;

procedure TFormPeach.pmh2Click(Sender: TObject);
begin
browsehistoryn(2);
end;

procedure TFormPeach.pmh3Click(Sender: TObject);
begin
browsehistoryn(3);
end;

procedure TFormPeach.pmh4Click(Sender: TObject);
begin
browsehistoryn(4);
end;

procedure TFormPeach.pmh5Click(Sender: TObject);
begin
browsehistoryn(5);
end;

procedure TFormPeach.pmh6Click(Sender: TObject);
begin
browsehistoryn(6);
end;

procedure TFormPeach.pmh7Click(Sender: TObject);
begin
browsehistoryn(7);
end;

procedure TFormPeach.pmh8Click(Sender: TObject);
begin
browsehistoryn(8);
end;

procedure TFormPeach.pmintddaddClick(Sender: TObject);
begin
//works only from filesystem, does not extract then add
if fun<>'FILEBROWSER' then exit;
//internal drag and drop menu is triggered only if target is a directory, not a file/archive
FormPeach.EditAddFilepath.Text:=mddtarget;
//assume output path (set at previous step) is not changed
do_add;
end;

procedure TFormPeach.pmintddcopyClick(Sender: TObject);
var
   s:AnsiString;
begin
s:=FormPeach.EditOpenIn.Text;
clickcopyto(mddtarget);
if FormPeach.EditOpenIn.Text<>s then browsehistoryn(2);
end;

procedure TFormPeach.pmintddextractClick(Sender: TObject);
begin
//internal drag and drop menu is triggered only if target is a directory, not a file/archive
FormPeach.EditOutExtract.Text:=mddtarget;
//extract from archive (selected or all) or from filesystem (single or multiple archives), assume output path (set at previous step) is not changed
do_extract;
end;

procedure TFormPeach.pmintddmoveClick(Sender: TObject);
var
   s:AnsiString;
begin
s:=FormPeach.EditOpenIn.Text;
clickmoveto(mddtarget);
if FormPeach.EditOpenIn.Text<>s then browsehistoryn(2);
end;

procedure TFormPeach.pmjumpappleClick(Sender: TObject);
begin
jumpto('Apple');
end;

procedure TFormPeach.pmrendernativeClick(Sender: TObject);
begin
renderinterpolation:=0;
saverestartclosepeaapp;
end;

procedure TFormPeach.pmrendersharpClick(Sender: TObject);
begin
renderinterpolation:=1;
saverestartclosepeaapp;
end;

procedure TFormPeach.pmrendersoftClick(Sender: TObject);
begin
renderinterpolation:=2;
saverestartclosepeaapp;
end;

procedure TFormPeach.pmtabrefreshClick(Sender: TObject);
var
   i,selptab:integer;
begin
for i:=0 to TabBar.Sections.Count-1 do
   if TabBar.Sections.Items[i].ID=ptabid then break;
selptab:=i;
if ptabid=atabid then //selected active tab
   begin
   end
else //selected inactive tab, make it active
   begin
   for i:=0 to TabBar.Sections.Count-1 do TabBar.Sections[i].text:=cleartabname(TabBar.Sections[i].text);
   atabid:=TabBar.Sections.Items[selptab].ID;
   TabBar.Sections.Items[selptab].Text:='<'+TabBar.Sections.Items[selptab].Text+'>';
   StringGridSessionHistory.RowCount:=2;
   StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabs.Rows[atabid];
   browsehistory;
   end;
f5refreshExecute(nil);
end;

procedure TFormPeach.po_open_browserClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
  openwith_base('preview','browser')
else browser_explorepath(1);
end;

procedure TFormPeach.seRARrvChange(Sender: TObject);
begin
puserarrv:=seRARrv.Value;
end;

procedure TFormPeach.shiftaltF4Execute(Sender: TObject);
begin
jumpto('sysdownloads');
end;

procedure TFormPeach.shiftcrtlF4Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
jumpto('root');
end;

procedure TFormPeach.shiftctrl7Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=0;
   archive_type_select('7Z');
   end;
end;

procedure TFormPeach.shiftctrlaltDClick(Sender: TObject);
begin
quickextract(usr_documents,'*neutral','all');
end;

procedure TFormPeach.shiftctrlaltEClick(Sender: TObject);
begin
quickextract('','*here','all');
end;

procedure TFormPeach.shiftctrlaltF4Execute(Sender: TObject);
begin
jumpto('usrdocuments');
end;

procedure TFormPeach.shiftctrlaltNClick(Sender: TObject);
begin
quickextract('','*new','all');
end;

procedure TFormPeach.shiftctrlaltSClick(Sender: TObject);
begin
quickextract('','*smart','all');
end;

procedure TFormPeach.shiftctrlBExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=3;
   archive_type_select('BZip2');
   end;
end;

procedure TFormPeach.shiftctrlF11Execute(Sender: TObject);
begin
if FormPeach.BorderStyle<>bsNone then
   begin
   set_pimmersive;
   pimmersive:=1;
   end
else
   begin
   FormPeach.BorderStyle:=bsSizeable;
   FormPeach.WindowState:=wsMaximized;
   FormPeach.WindowState:=wsNormal;
   FormPeach.Left:=DLEFT;
   FormPeach.Top:=DTOP;
   FormPeach.Width:=DWIDTH;
   FormPeach.Height:=DHEIGTH;
   pimmersive:=0;
   end;
end;

procedure TFormPeach.shiftctrlF3Execute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=true{$ELSE}if PanelOpen.top=0{$ENDIF} then begin websearch_sel; exit; end;
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then begin addextwebsearch; exit; end;
{$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.Top=0{$ENDIF} then begin addextwebsearch; exit; end;
run_websearch('');
end;

procedure TFormPeach.shiftctrlF9Execute(Sender: TObject);
begin
try
if madvfilters.checked=false then
   begin
   set_advfilters;
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   setfiltericon(false);
   cbAdvfAdd.state:=cbunchecked;
   cbAdvfExt.state:=cbunchecked;
   advfiltersupdate;
   end;
pmadvf.Checked:=madvfilters.Checked;
except
end;
end;

procedure TFormPeach.shiftctrlGExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=5;
   archive_type_select(STR_GZIP);
   end;
end;

procedure TFormPeach.shiftctrlRExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=4;
   archive_type_select(txt_custom+'/RAR');
   end;
end;

procedure TFormPeach.shiftctrlSExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=8;
   archive_type_select(txt_sfx+' '+STR_7Z);
   end;
end;

procedure TFormPeach.shiftctrlTExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=11;
   archive_type_select(STR_TAR);
   end;
end;

procedure TFormPeach.shiftctrlXExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=14;
   archive_type_select(STR_XZ);
   end;
end;

procedure TFormPeach.shiftctrlZExecute(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=15;
   archive_type_select(STR_ZIP);
   end;
end;

procedure TFormPeach.shiftF1Execute(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help.html',desk_env);
end;

procedure TFormPeach.shiftF3Execute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then launch_rrsearch;
end;

procedure TFormPeach.shiftF4Execute(Sender: TObject);
begin
jumpto('home');
end;

procedure TFormPeach.shiftF5Execute(Sender: TObject);
begin
do_add;
end;

procedure TFormPeach.shiftF8Execute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then jumpto('bookmark3');
end;

procedure TFormPeach.shiftF9Execute(Sender: TObject);
begin
setpm(1);
end;

procedure TFormPeach.pmfun2Click(Sender: TObject);
begin
do_pmfun(pmfun2.caption);
end;

procedure TFormPeach.pmfun3Click(Sender: TObject);
begin
do_pmfun(pmfun3.caption);
end;

procedure TFormPeach.pmfun4Click(Sender: TObject);
begin
do_pmfun(pmfun4.caption);
end;

procedure TFormPeach.pmfun5Click(Sender: TObject);
begin
do_pmfun(pmfun5.caption);
end;

procedure TFormPeach.pmfun6Click(Sender: TObject);
begin
do_pmfun(pmfun6.caption);
end;

procedure TFormPeach.pmfun7Click(Sender: TObject);
begin
do_pmfun(pmfun7.caption);
end;

procedure TFormPeach.pmfun8Click(Sender: TObject);
begin
do_pmfun(pmfun8.caption);
end;

procedure TFormPeach.pmfun9Click(Sender: TObject);
begin
do_pmfun(pmfun9.caption);
end;

procedure TFormPeach.pmhr1fClick(Sender: TObject);
begin
opendir(pmhr1f.Caption);
end;

procedure TFormPeach.pmhr2fClick(Sender: TObject);
begin
opendir(pmhr2f.Caption);
end;

procedure TFormPeach.pmhr3fClick(Sender: TObject);
begin
opendir(pmhr3f.Caption);
end;

procedure TFormPeach.pmhr4fClick(Sender: TObject);
begin
opendir(pmhr4f.Caption);
end;

procedure TFormPeach.pmhr5fClick(Sender: TObject);
begin
opendir(pmhr5f.Caption);
end;

procedure TFormPeach.pmhr6fClick(Sender: TObject);
begin
opendir(pmhr6f.Caption);
end;

procedure TFormPeach.pmhr7fClick(Sender: TObject);
begin
opendir(pmhr7f.Caption);
end;

procedure TFormPeach.pmhr8fClick(Sender: TObject);
begin
opendir(pmhr8f.Caption);
end;

procedure TFormPeach.pmif1Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1024,768,2,'no',0);
end;

procedure TFormPeach.pmif2Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1280,800,2,'no',0);
end;

procedure TFormPeach.pmif3Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1080,2,'no',0);
end;

procedure TFormPeach.pmif4Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1200,2,'no',0);
end;

procedure TFormPeach.pmif5Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,2048,1536,2,'no',0);
end;

procedure TFormPeach.pmif6Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,3840,2160,2,'no',0);
end;

procedure TFormPeach.pmif7Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,4096,2160,2,'no',0);
end;

procedure TFormPeach.pmif8Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,7680,4320,2,'no',0);
end;

procedure TFormPeach.pmir180Click(Sender: TObject);
begin
frombrowser_imgrotate('180');
end;

procedure TFormPeach.pmiresize125Click(Sender: TObject);
begin
frombrowser_imgtransform(125,125,0,0,1,'no',0);
end;

procedure TFormPeach.pmiresize150Click(Sender: TObject);
begin
frombrowser_imgtransform(150,150,0,0,1,'no',0);
end;

procedure TFormPeach.pmiresize200Click(Sender: TObject);
begin
frombrowser_imgtransform(200,200,0,0,1,'no',0);
end;

procedure TFormPeach.pmiresize25Click(Sender: TObject);
begin
frombrowser_imgtransform(25,25,0,0,1,'no',0);
end;

procedure TFormPeach.pmiresize300Click(Sender: TObject);
begin
frombrowser_imgtransform(300,300,0,0,1,'no',80);
end;

procedure TFormPeach.pmiresize33Click(Sender: TObject);
begin
frombrowser_imgtransform(33,33,0,0,1,'no',0);
end;

procedure TFormPeach.pmiresize400Click(Sender: TObject);
begin
frombrowser_imgtransform(400,400,0,0,1,'no',0);
end;

procedure TFormPeach.pmiresize50Click(Sender: TObject);
begin
frombrowser_imgtransform(50,50,0,0,1,'no',0);
end;

procedure TFormPeach.pmiresize75Click(Sender: TObject);
begin
frombrowser_imgtransform(75,75,0,0,1,'no',0);
end;

procedure TFormPeach.pmirflipClick(Sender: TObject);
begin
frombrowser_imgrotate('flip');
end;

procedure TFormPeach.pmwsClick(Sender: TObject);
begin
websearch_sel;
end;

procedure TFormPeach.MenuItemPropertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure TFormPeach.ButtonPropertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure TFormPeach.mPropertiesClick(Sender: TObject);
begin
layout_fileproperties;
end;

procedure TFormPeach.mrecsearchClick(Sender: TObject);
begin
if recsearch=1 then setrecsearch(0) else setrecsearch(1);
end;

procedure TFormPeach.mscriptsClick(Sender: TObject);
begin
if not(checkdirexists(confpath+'Scripts'+DirectorySeparator)) then mkdir(confpath+'Scripts'+DirectorySeparator);
cp_open(confpath+'Scripts'+DirectorySeparator,desk_env);
end;

procedure TFormPeach.pmsrecClick(Sender: TObject);
begin
pmsrec.checked:=not(pmsrec.checked);
if pmsrec.checked=true then FormInput.CheckBoxInputRecoursive.State:=cbChecked else FormInput.CheckBoxInputRecoursive.State:=cbUnchecked;
end;

procedure TFormPeach.pmzerofileClick(Sender: TObject);
begin
if fun='FILEBROWSER' then eraseselected_list(2)
else
   begin
      erase_fromname_list(2,FormPeach.EditOpenIn.Text);
      browsefiledir(extractfilepath(FormPeach.EditOpenIn.Text));
   end;
end;

procedure TFormPeach.pmzerofreeClick(Sender: TObject);
begin
sanitizedisk(2);
end;

procedure TFormPeach.pnabc1Click(Sender: TObject);
begin
archivemenu_name(pnabc1.Caption);
end;

procedure TFormPeach.pnabc2Click(Sender: TObject);
begin
archivemenu_name(pnabc2.Caption);
end;

procedure TFormPeach.pnabc3Click(Sender: TObject);
begin
archivemenu_name(pnabc3.Caption);
end;

procedure TFormPeach.pnabc4Click(Sender: TObject);
begin
archivemenu_name(pnabc4.Caption);
end;

procedure TFormPeach.pnabc5Click(Sender: TObject);
begin
archivemenu_name(pnabc5.Caption);
end;

procedure TFormPeach.pnabc6Click(Sender: TObject);
begin
archivemenu_name(pnabc6.Caption);
end;

procedure TFormPeach.pnabc7Click(Sender: TObject);
begin
archivemenu_name(pnabc7.Caption);
end;

procedure TFormPeach.pnabc8Click(Sender: TObject);
begin
archivemenu_name(pnabc8.Caption);
end;

procedure TFormPeach.pnbc1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc1.Caption;
end;

procedure TFormPeach.pnbc2Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc2.Caption;
end;

procedure TFormPeach.pnbc3Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc3.Caption;
end;

procedure TFormPeach.pnbc4Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc4.Caption;
end;

procedure TFormPeach.pnbc5Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc5.Caption;
end;

procedure TFormPeach.pnbc6Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc6.Caption;
end;

procedure TFormPeach.pnbc7Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc7.Caption;
end;

procedure TFormPeach.pnbc8Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnbc8.Caption;
end;

procedure TFormPeach.pob_adlerClick(Sender: TObject);
begin
setbrowser_crchash(1);
end;

procedure TFormPeach.pob_crc16Click(Sender: TObject);
begin
setbrowser_crchash(2);
end;

procedure TFormPeach.pob_crc24Click(Sender: TObject);
begin
setbrowser_crchash(3);
end;

procedure TFormPeach.pob_crc32Click(Sender: TObject);
begin
setbrowser_crchash(4);
end;

procedure TFormPeach.pob_crc64Click(Sender: TObject);
begin
setbrowser_crchash(5);
end;

procedure TFormPeach.pob_edonkeyClick(Sender: TObject);
begin
setbrowser_crchash(6);
end;

procedure TFormPeach.pob_md4Click(Sender: TObject);
begin
setbrowser_crchash(7);
end;

procedure TFormPeach.pob_md5Click(Sender: TObject);
begin
setbrowser_crchash(8);
end;

procedure TFormPeach.pob_ripemdClick(Sender: TObject);
begin
setbrowser_crchash(9);
end;

procedure TFormPeach.pob_sha1Click(Sender: TObject);
begin
setbrowser_crchash(10);
end;

procedure TFormPeach.pob_blake2sClick(Sender: TObject);
begin
setbrowser_crchash(11);
end;

procedure TFormPeach.pob_sha256Click(Sender: TObject);
begin
setbrowser_crchash(12);
end;

procedure TFormPeach.pob_sha3256Click(Sender: TObject);
begin
setbrowser_crchash(13);
end;

procedure TFormPeach.pob_blake2bClick(Sender: TObject);
begin
setbrowser_crchash(14);
end;

procedure TFormPeach.pob_sha3512Click(Sender: TObject);
begin
setbrowser_crchash(16);
end;

procedure TFormPeach.pob_sha512Click(Sender: TObject);
begin
setbrowser_crchash(15);
end;

procedure TFormPeach.pob_whirlpoolClick(Sender: TObject);
begin
setbrowser_crchash(17);
end;

procedure TFormPeach.po_checksumClick(Sender: TObject);
begin
getcheck('neutral');
end;

procedure TFormPeach.pmCopyPathClick(Sender: TObject);
begin
copypaths;
end;

procedure TFormPeach.pmcpypathClick(Sender: TObject);
begin
copypaths;
end;

procedure TFormPeach.pmCustEditAdd1Click(Sender: TObject);
begin
if OpenDialogApps1.Execute then
   if OpenDialogApps1.Filename<>'' then
      begin
      StringGridCustEditAdv.Cells[2,StringGridCustEditAdv.Row]:=OpenDialogApps1.Filename;
      StringGridCustEditAdv.AutoSizeColumns;
      end
   else exit
else exit;
set_adveditcl(StringGridCustEditAdv.Row);
end;

procedure TFormPeach.pmCustEditAddClick(Sender: TObject);
begin
if OpenDialogApps1.Execute then
   if OpenDialogApps1.Filename<>'' then
      begin
      StringGridCustedit.Cells[2,StringGridCustedit.Row]:=OpenDialogApps1.Filename;
      StringGridCustedit.AutoSizeColumns;
      end
   else exit
else exit;
end;

procedure TFormPeach.pmCustEditDesc1Click(Sender: TObject);
begin
setdescription_advcustedit;
end;

procedure TFormPeach.pmCustEditDescClick(Sender: TObject);
begin
setdescription_custedit;
end;

procedure TFormPeach.pmCustEditEdit1afterClick(Sender: TObject);
begin
editstring2_advcustedit;
end;

procedure TFormPeach.pmCustEditEdit1Click(Sender: TObject);
begin
editstring1_advcustedit;
end;

procedure TFormPeach.pmCustEditEditClick(Sender: TObject);
begin
editapp_custedit;
end;

procedure TFormPeach.pmCustEditRemove1Click(Sender: TObject);
begin
StringGridCustEditAdv.Cells[1,StringGridCustEditAdv.Row]:='';
StringGridCustEditAdv.Cells[2,StringGridCustEditAdv.Row]:='';
StringGridCustEditAdv.Cells[3,StringGridCustEditAdv.Row]:='';
StringGridCustEditAdv.Cells[4,StringGridCustEditAdv.Row]:='';
StringGridCustEditAdv.AutoSizeColumns;
set_adveditcl(StringGridCustEditAdv.Row);
end;

procedure TFormPeach.pmCustEditRemoveClick(Sender: TObject);
begin
StringGridCustedit.Cells[1,StringGridCustedit.Row]:='';
StringGridCustedit.Cells[2,StringGridCustedit.Row]:='';
StringGridCustedit.AutoSizeColumns;
end;

procedure TFormPeach.po_copypathClick(Sender: TObject);
begin
copypaths;
end;



procedure TFormPeach.msimplesearchClick(Sender: TObject);
begin
if simplesearch=1 then setsimplesearch(0) else setsimplesearch(1);
end;

procedure TFormPeach.ListViewBrowserClick(Sender: TObject);
begin
wasselectedp:=wasselected;
wasselected:=-1;
pclicked:=true;
if (fun<>'FILEBROWSER') and (fun<>'UN7Z') then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if updatinglistview=true then exit;
if FormPeach.StringGridList.Rowcount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if FormPeach.ListViewBrowser.SelCount<>1 then exit;
if FormPeach.StringGridList.Cells[16,FormPeach.StringGridList.Row]<>'1' then exit;
try
   wasselected:=FormPeach.ListViewBrowser.ItemFocused.Index+1;
except
end;
if wasselectedp=wasselected then
   if FormPeach.ListViewBrowser.SelCount=1 then
      begin
      {
      //possible implementation for rename in place editing the listview
      {$IFDEF MSWINDOWS}
      enter_busy_status_special;//may be used a custom busy status to not trigger the refresh progress bar
      FormPeach.ListViewBrowser.ReadOnly:=false;
      FormPeach.ListViewBrowser.ItemFocused.EditCaption;
      renorig:=FormPeach.EditOpenIn.Text;
      {$ELSE}
      Timerrename.Enabled:=true;
      {$ENDIF}
      }
      if ListViewBrowser.OwnerData=false then Timerrename.Enabled:=true;
      end;
end;

procedure TFormPeach.mupdateClick(Sender: TObject);
begin
checkupdates;
end;

procedure TFormPeach.owcustom10tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',2)
  else
     openadvappn(2);
end;

procedure TFormPeach.owcustom11tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',3)
  else
     openadvappn(3);
end;

procedure TFormPeach.owcustom12tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',4)
  else
     openadvappn(4);
end;

procedure TFormPeach.owcustom13tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',5)
  else
     openadvappn(5);
end;

procedure TFormPeach.owcustom14tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',6)
  else
     openadvappn(6);
end;

procedure TFormPeach.owcustom15tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',7)
  else
     openadvappn(7);
end;

procedure TFormPeach.owcustom16tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',8)
  else
     openadvappn(8);
end;

procedure TFormPeach.owcustom1tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',1)
  else
     openappn(1);
end;

procedure TFormPeach.owcustom2tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',2)
  else
     openappn(2);
end;

procedure TFormPeach.owcustom3tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',3)
  else
     openappn(3);
end;

procedure TFormPeach.owcustom4tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',4)
  else
     openappn(4);
end;

procedure TFormPeach.owcustom5tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',5)
  else
     openappn(5);
end;

procedure TFormPeach.owcustom6tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',6)
  else
     openappn(6);
end;

procedure TFormPeach.owcustom7tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',7)
  else
     openappn(7);
end;

procedure TFormPeach.owcustom8tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',8)
  else
     openappn(8);
end;

procedure TFormPeach.owcustom9tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',1)
  else
     openadvappn(1);
end;

procedure TFormPeach.owcustom_10Click(Sender: TObject);
begin
openappn(10);
end;

procedure TFormPeach.owcustom_10tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',10)
  else
     openappn(10);
end;

procedure TFormPeach.owcustom_11Click(Sender: TObject);
begin
openappn(11);
end;

procedure TFormPeach.owcustom_11tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',11)
  else
     openappn(11);
end;

procedure TFormPeach.owcustom_12Click(Sender: TObject);
begin
openappn(12);
end;

procedure TFormPeach.owcustom_12tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',12)
  else
     openappn(12);
end;

procedure TFormPeach.owcustom_13Click(Sender: TObject);
begin
openappn(13);
end;

procedure TFormPeach.owcustom_13tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',13)
  else
     openappn(13);
end;

procedure TFormPeach.owcustom_14Click(Sender: TObject);
begin
openappn(14);
end;

procedure TFormPeach.owcustom_14tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',14)
  else
     openappn(14);
end;

procedure TFormPeach.owcustom_15Click(Sender: TObject);
begin
openappn(15);
end;

procedure TFormPeach.owcustom_15tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',15)
  else
     openappn(15);
end;

procedure TFormPeach.owcustom_16Click(Sender: TObject);
begin
openappn(16);
end;

procedure TFormPeach.owcustom_16tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',16)
  else
     openappn(16);
end;

procedure TFormPeach.owcustom_9Click(Sender: TObject);
begin
openappn(9);
end;

procedure TFormPeach.owcustom_9tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',9)
  else
     openappn(9);
end;

procedure TFormPeach.pmcheckClick(Sender: TObject);
begin
getcheck('neutral');
end;

procedure TFormPeach.pmpropertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure TFormPeach.mthumbimagesClick(Sender: TObject);
begin
do_showthumbs;
end;

procedure TFormPeach.pmpdupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TFormPeach.pmirmirrorClick(Sender: TObject);
begin
frombrowser_imgrotate('mirror');
end;

procedure TFormPeach.pmisBMPClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'BMP',0);
end;

procedure TFormPeach.pmisJPEG50Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',50);
end;

procedure TFormPeach.pmisJPEG75Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',75);
end;

procedure TFormPeach.pmisJPEGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',90);
end;

procedure TFormPeach.pmisPNGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'PNG',0);
end;

procedure TFormPeach.pmisTIFFClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'TIFF',0);
end;

procedure TFormPeach.pmjd10Click(Sender: TObject);
begin
opendevice(pmjd10.caption);
end;

procedure TFormPeach.pmjd11Click(Sender: TObject);
begin
opendevice(pmjd11.caption);
end;

procedure TFormPeach.pmjd12Click(Sender: TObject);
begin
opendevice(pmjd12.caption);
end;

procedure TFormPeach.pmjd13Click(Sender: TObject);
begin
opendevice(pmjd13.caption);
end;

procedure TFormPeach.pmjd14Click(Sender: TObject);
begin
opendevice(pmjd14.caption);
end;

procedure TFormPeach.pmjd15Click(Sender: TObject);
begin
opendevice(pmjd15.caption);
end;

procedure TFormPeach.pmjd16Click(Sender: TObject);
begin
opendevice(pmjd16.caption);
end;

procedure TFormPeach.pmjd17Click(Sender: TObject);
begin
opendevice(pmjd17.caption);
end;

procedure TFormPeach.pmjd18Click(Sender: TObject);
begin
opendevice(pmjd18.caption);
end;

procedure TFormPeach.pmjd19Click(Sender: TObject);
begin
opendevice(pmjd19.caption);
end;

procedure TFormPeach.pmjd1Click(Sender: TObject);
begin
opendevice(pmjd1.caption);
end;

procedure TFormPeach.pmjd20Click(Sender: TObject);
begin
opendevice(pmjd20.caption);
end;

procedure TFormPeach.pmjd21Click(Sender: TObject);
begin
opendevice(pmjd21.caption);
end;

procedure TFormPeach.pmjd22Click(Sender: TObject);
begin
opendevice(pmjd22.caption);
end;

procedure TFormPeach.pmjd23Click(Sender: TObject);
begin
opendevice(pmjd23.caption);
end;

procedure TFormPeach.pmjd24Click(Sender: TObject);
begin
opendevice(pmjd24.caption);
end;

procedure TFormPeach.pmjd25Click(Sender: TObject);
begin
opendevice(pmjd25.caption);
end;

procedure TFormPeach.pmjd26Click(Sender: TObject);
begin
opendevice(pmjd26.caption);
end;

procedure TFormPeach.pmjd2Click(Sender: TObject);
begin
opendevice(pmjd2.caption);
end;

procedure TFormPeach.pmjd3Click(Sender: TObject);
begin
opendevice(pmjd3.caption);
end;

procedure TFormPeach.pmjd4Click(Sender: TObject);
begin
opendevice(pmjd4.caption);
end;

procedure TFormPeach.pmjd5Click(Sender: TObject);
begin
opendevice(pmjd5.caption);
end;

procedure TFormPeach.pmjd6Click(Sender: TObject);
begin
opendevice(pmjd6.caption);
end;

procedure TFormPeach.pmjd7Click(Sender: TObject);
begin
opendevice(pmjd7.caption);
end;

procedure TFormPeach.pmjd8Click(Sender: TObject);
begin
opendevice(pmjd8.caption);
end;

procedure TFormPeach.pmjd9Click(Sender: TObject);
begin
opendevice(pmjd9.caption);
end;

procedure TFormPeach.MenuItemDonationsClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'donations.html',desk_env);
end;

procedure TFormPeach.MenuItemArchive_downloadsClick(Sender: TObject);
begin
archivemenu_name(usr_downloads)
end;

procedure TFormPeach.MenuItemExtAllHereClick(Sender: TObject);
begin
quickextract('','*here','selected');
end;

procedure TFormPeach.MenuItemExtAllToClick(Sender: TObject);
begin
do_extallto('selected');
end;

procedure TFormPeach.MenuItemArchive_pubdocClick(Sender: TObject);
begin
archivemenu_name(public_documents);
end;

procedure TFormPeach.MenuItemArchive_pubhomeClick(Sender: TObject);
begin
archivemenu_name(public_home);
end;

procedure TFormPeach.MenuItemOpen_pubdocClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(public_documents);
end;

procedure TFormPeach.MenuItemOpen_pubhomeClick(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(public_home);
end;

procedure TFormPeach.mhclClick(Sender: TObject);
var
   s:ansistring;
begin
case lastbar of
   3: begin
      if StringGridRecent.Rowcount<2 then exit;
      s:=StringGridRecent.Cells[1,StringGridRecent.Row];
      end;
   4: begin
      if StringGridSessionHistory.Rowcount<2 then exit;
      s:=StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row];
      end;
   end;
if s='' then exit;
if s=txt_mypc then exit;
if s<>'' then
   if s[length(s)]=directoryseparator then //folder
else //get object's path
   s:=extractfilepath(s);
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
open_cp(s);
end;

procedure TFormPeach.mhexploreClick(Sender: TObject);
var
   s:ansistring;
begin
case lastbar of
   3: begin
      if StringGridRecent.Rowcount<2 then exit;
      s:=StringGridRecent.Cells[1,StringGridRecent.Row];
      end;
   4: begin
      if StringGridSessionHistory.Rowcount<2 then exit;
      s:=StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row];
      end;
   end;
if s='' then exit;
if s=txt_mypc then exit;
if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
cp_explorepath(s, desk_env);
end;

procedure TFormPeach.mhistory1Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(1);
end;

procedure TFormPeach.mhistory2Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(2);
end;

procedure TFormPeach.mhistory3Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(3);
end;

procedure TFormPeach.mhistory4Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(4);
end;

procedure TFormPeach.mhistory5Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(5);
end;

procedure TFormPeach.mhistory6Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(6);
end;

procedure TFormPeach.mhistory7Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(7);
end;

procedure TFormPeach.mhistory8Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(8);
end;

procedure TFormPeach.mhpeaClick(Sender: TObject);
var
   s:ansistring;
begin
case lastbar of
   3: begin
      if StringGridRecent.Rowcount<2 then exit;
      s:=StringGridRecent.Cells[1,StringGridRecent.Row];
      end;
   4: begin
      if StringGridSessionHistory.Rowcount<2 then exit;
      s:=StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row];
      end;
   end;
if s='' then exit;
if s=txt_mypc then
   begin
   listpc;
   exit;
   end;
if s<>'' then
   if s[length(s)]=directoryseparator then //open folder
else //go to object's path
   s:=extractfilepath(s);
fun:='FILEBROWSER';
fun_status:=fun;
FormPeach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure TFormPeach.pmbcaddbookmarkClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: begin addtobookmarks('*browsercontext'); exit; end;
1: if LabelClickAddress1.Caption=' '+txt_mypc+' ' then s:=txt_mypc
   else s:=pmbc8.caption;
2: s:=pmbc7.caption;
3: s:=pmbc6.caption;
4: s:=pmbc5.caption;
5: s:=pmbc4.caption;
6: s:=pmbc3.caption;
7: s:=pmbc2.caption;
8: s:=pmbc1.caption;
end;
addtobookmarks(s);
end;

procedure TFormPeach.MenuItemOrganizeNavbarClick(Sender: TObject);
begin
if navbar=3 then navbar:=0
else navbar:=3;
setnav(navbar);
end;

procedure TFormPeach.MenuItemOrganizeStatusbarClick(Sender: TObject);
begin
if lastbar=1 then showbar('statusbar')
else showbar('none');
end;

procedure TFormPeach.mtoggleopClick(Sender: TObject);
begin
if autoopen=0 then autoopen:=1 else autoopen:=0;
updateconf_modified;
end;

procedure TFormPeach.mopenasarchiveClick(Sender: TObject);
begin
openunitasarchive;
end;

procedure TFormPeach.mgobrowserClick(Sender: TObject);
begin
stayopen:=true;
FormPeach.OpenDialogArchive.Filename:=EditOpenIn.Text;
showpanel('open');
open_inputselect;
end;

procedure TFormPeach.MenuItemArchive_documents1Click(Sender: TObject);
begin
archivemenu_name(usr_documents);
end;

procedure TFormPeach.MenuItemArchive_home1Click(Sender: TObject);
begin
archivemenu_name(home_path);
end;

procedure TFormPeach.MenuItemextexploreClick(Sender: TObject);
var
   s:ansistring;
begin
s:=EditOutExtract.Text;
if s='' then exit;
if s[1]='<' then exit;
cp_explorepath(s, desk_env);
end;

procedure TFormPeach.MenuItemOpen_LastClick(Sender: TObject);
begin
if lastoutpath='' then lastoutpath:=local_desktop;
FormPeach.EditOutExtract.Text:=extractfilepath(lastoutpath);
end;

procedure TFormPeach.mgoextlayoutClick(Sender: TObject);
begin
list_toextractor('none','full');
end;

procedure TFormPeach.mLangClick(Sender: TObject);
begin
showpanel('defaults');//changelanguage;
clicklabel_options(LabelTitleOptions1, ShapeOptions1);
end;

procedure TFormPeach.mpathdesk1Click(Sender: TObject);
begin
archivemenu_name(local_desktop);
end;

procedure TFormPeach.mpathexplore1Click(Sender: TObject);
var
   s:ansistring;
begin
s:=EditAddFilepath.Text+EditAddFilename.Text;
if s='' then exit;
if s=txt_mypc then exit;
if s[1]='<' then exit;
if ((archive_type='7z') and (FormPeach.CheckBox7zSFX.State=cbChecked)) or
   ((archive_type='arc') and (FormPeach.CheckBoxARCsfx.State=cbChecked))
then s:=s+'.exe'
else s:=s+'.'+archive_type;
cp_explorepath(s, desk_env);
end;

procedure TFormPeach.mpathreset1Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,FormPeach.cbType.Text,0);
FormPeach.EditAddFilepath.Text:=lastoutpath;
FormPeach.EditAddFilename.Text:=extractfilename(s);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
end;

procedure TFormPeach.mpathself1Click(Sender: TObject);
var
   s:ansistring;
begin
if StringGridAdd.Rowcount<2 then exit;
suggest_outname(s,FormPeach.cbType.Text,0);
FormPeach.EditAddFilepath.Text:=extractfilepath(s);
FormPeach.EditAddFilename.Text:=extractfilename(s);
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
end;

procedure TFormPeach.mPeaTrackerClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-more.html',desk_env);
end;

procedure TFormPeach.mr9Click(Sender: TObject);
begin
showpanel('open');
if stringgridrecent.visible=false then showbar('recent');
navrefresh;
end;

procedure TFormPeach.mrowselectClick(Sender: TObject);
begin
rowselect:=not(rowselect);
set_rowselect;
end;

procedure TFormPeach.MenuItemOpen_downloads1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(usr_downloads);
end;

procedure TFormPeach.MenuItemHistoryBookClick(Sender: TObject);
begin
case lastbar of
   3: addtobookmarks('*recent');
   4: addtobookmarks('*history');
   end;
end;

procedure TFormPeach.MenuItemNavigateClick(Sender: TObject);
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.Top=0{$ENDIF} then sg:=StringGridAdd
else sg:=StringGridExtract;
if sg.Rowcount=1 then exit;
if sg.Cells[2,sg.Row]=txt_list_isfolder then
   s:=sg.Cells[8,sg.Row]
else
   s:=extractfilepath(sg.Cells[8,sg.Row]);
fun:='FILEBROWSER';
fun_status:=fun;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
FormPeach.EditUn7zaFilter.Text:='*';
showpanel('open');
listdir(s,false,false);
addtohistory;
end;

procedure TFormPeach.MenuItemOpen_desktop1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(local_desktop);
end;

procedure TFormPeach.MenuItemOpen_documents1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(usr_documents);
end;

procedure TFormPeach.MenuItemOpen_hereClick(Sender: TObject);
begin
if StringGridExtract.Rowcount<2 then exit;
if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
   FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.StringGridExtract.Cells[8,FormPeach.StringGridExtract.Row])
else
   FormPeach.EditOutExtract.Text:=extractfilepath(FormPeach.EditOpenIn.Text);
end;

procedure TFormPeach.MenuItemOpen_home1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(home_path);
end;

procedure TFormPeach.MenuItemPWClick(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
end;

procedure TFormPeach.MenuItemToolhexpClick(Sender: TObject);
begin
hexpselected('HEXPREVIEW');
end;

procedure TFormPeach.MenuItemTooltextpClick(Sender: TObject);
begin
hexpselected('TEXTPREVIEW');
end;

procedure TFormPeach.mEnvstrClick(Sender: TObject);
begin
dispenv;
end;

procedure TFormPeach.MenuItemBookmarksClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.PanelArchive.Visible=true{$ELSE}if FormPeach.PanelArchive.Top=0{$ENDIF} then
   if StringGridAdd.Rowcount=1 then exit
   else
else
   if StringGridExtract.Rowcount=1 then exit;
addtobookmarks('*layout');
end;

procedure TFormPeach.MenuItemOpen_addtobookmarksClick(Sender: TObject);
begin
addtobookmarks('*browsercontext');
end;

procedure TFormPeach.pmjumpmusicClick(Sender: TObject);
begin
jumpto('usrmusic');
end;

procedure TFormPeach.pmjumppicturesClick(Sender: TObject);
begin
jumpto('usrpictures');
end;

procedure TFormPeach.pmjumpusersClick(Sender: TObject);
begin
  jumpto('users');
end;

procedure TFormPeach.pmjumpvideosClick(Sender: TObject);
begin
  jumpto('usrvideos');
end;

procedure TFormPeach.pmmore1Click(Sender: TObject);
begin
openadvappn(1);
end;

procedure TFormPeach.pmmore2Click(Sender: TObject);
begin
openadvappn(2);
end;

procedure TFormPeach.pmmore3Click(Sender: TObject);
begin
openadvappn(3);
end;

procedure TFormPeach.pmmore4Click(Sender: TObject);
begin
openadvappn(4);
end;

procedure TFormPeach.pmmore5Click(Sender: TObject);
begin
openadvappn(5);
end;

procedure TFormPeach.pmmore6Click(Sender: TObject);
begin
openadvappn(6);
end;

procedure TFormPeach.pmmore7Click(Sender: TObject);
begin
openadvappn(7);
end;

procedure TFormPeach.pmmore8Click(Sender: TObject);
begin
openadvappn(8);
end;

procedure TFormPeach.pmmorefun_detailsClick(Sender: TObject);
begin
doinfo;
end;

procedure TFormPeach.pmmorefun_propertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure TFormPeach.pmmstatus_bookmarksClick(Sender: TObject);
begin
  showbar('bookmarks');
end;

procedure TFormPeach.pmmstatus_clipboardClick(Sender: TObject);
begin
  showbar('clip');
end;

procedure TFormPeach.pmmstatus_raClick(Sender: TObject);
begin
  showbar('recent');
end;

procedure TFormPeach.pmmstatus_rClick(Sender: TObject);
begin
  showbar('sessionrecent');
end;

procedure TFormPeach.pmmstatus_statusClick(Sender: TObject);
begin
  showbar('statusbar');
end;

procedure TFormPeach.pmorganizebookmarksClick(Sender: TObject);
begin
  do_organizebookmarks;
end;

procedure TFormPeach.pmpowershellClick(Sender: TObject);
begin
  browser_commandprompt(1,1,'');
end;

procedure TFormPeach.pmqjdropboxClick(Sender: TObject);
begin
jumpto('dropbox');
end;

procedure TFormPeach.pmqjgoogledriveClick(Sender: TObject);
begin
jumpto('googledrive');
end;

procedure TFormPeach.pmqjonedriveClick(Sender: TObject);
begin
jumpto('onedrive');
end;

procedure TFormPeach.pmqjshpClick(Sender: TObject);
begin
jumpto('sharepoint');
end;

procedure TFormPeach.pmqjyClick(Sender: TObject);
begin
jumpto('yandexdisk');
end;

procedure TFormPeach.pmqnointdirClick(Sender: TObject);
begin
smartextclick;
end;

procedure TFormPeach.pmquickdeskClick(Sender: TObject);
begin
jumpto('desktop');
end;

procedure TFormPeach.pmquickhomeClick(Sender: TObject);
begin
jumpto('home');
end;

procedure TFormPeach.pmquickoaClick(Sender: TObject);
begin
open_archive;
end;

procedure TFormPeach.pmquickopClick(Sender: TObject);
begin
peazip_browse;
end;

procedure TFormPeach.pmquicksdClick(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TFormPeach.MenuItemOpen_commandpromptClick(Sender: TObject);
begin
browser_commandprompt(1,0,'');
end;

procedure TFormPeach.mswapbarsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
swapbars:=not(swapbars);
saverestartclosepeaapp;
end;

procedure TFormPeach.mSystemIntegrationClick(Sender: TObject);
begin
configure_systemintegration(true);
restartpeaapp;
exit_nosave;
end;

procedure TFormPeach.MenuItemOrganizeToolbarClick(Sender: TObject);
begin
if toolsize=7 then toolsize:=0
else toolsize:=7;
ptoolsize:=toolsize;
settoolbar;
end;

procedure TFormPeach.mthlClick(Sender: TObject);
begin
thighlight:=not(thighlight);
setthl;
end;

procedure TFormPeach.mTrayClick(Sender: TObject);
begin
TrayIconPZ.visible:=true;
FormPeach.visible:=false;
end;

procedure TFormPeach.mRecent1fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent1f.Caption);
end;

procedure TFormPeach.mRecent2fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent2f.Caption);
end;

procedure TFormPeach.mRecent3fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent3f.Caption);
end;

procedure TFormPeach.mRecent4fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent4f.Caption);
end;

procedure TFormPeach.mRecent5fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent5f.Caption);
end;

procedure TFormPeach.mRecent6fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent6f.Caption);
end;

procedure TFormPeach.mRecent7fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent7f.Caption);
end;

procedure TFormPeach.mRecent8fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent8f.Caption);
end;

procedure TFormPeach.msamedayClick(Sender: TObject);
begin
select_by('datesameday','neutralsel');
end;

procedure TFormPeach.msamemonthClick(Sender: TObject);
begin
select_by('datesamemonth','neutralsel');
end;

procedure TFormPeach.msameweekClick(Sender: TObject);
begin
select_by('datesameweek','neutralsel');
end;

procedure TFormPeach.msameyearClick(Sender: TObject);
begin
select_by('datesameyear','neutralsel');
end;

procedure TFormPeach.msamehourClick(Sender: TObject);
begin
select_by('datesamehour','neutralsel');
end;

procedure TFormPeach.mscheduledscriptsClick(Sender: TObject);
begin
if not(checkdirexists(confpath+'Scheduled scripts'+DirectorySeparator)) then mkdir(confpath+'Scheduled scripts'+DirectorySeparator);
cp_open(confpath+'Scheduled scripts'+DirectorySeparator,desk_env);
end;

procedure TFormPeach.mselectadvClick(Sender: TObject);
begin
advancedselect;
end;

procedure TFormPeach.msize0Click(Sender: TObject);
begin
select_by('sizeempty','neutralsel');
end;

procedure TFormPeach.msize100kClick(Sender: TObject);
begin
select_by('size100k','neutralsel');
end;

procedure TFormPeach.msize100mClick(Sender: TObject);
begin
select_by('size100m','neutralsel');
end;

procedure TFormPeach.msize10mClick(Sender: TObject);
begin
select_by('size10m','neutralsel');
end;

procedure TFormPeach.msizeoverClick(Sender: TObject);
begin
select_by('sizeover','neutralsel');
end;

procedure TFormPeach.msizesimilar50Click(Sender: TObject);
begin
select_by('sizesimilar50','neutralsel');
end;

procedure TFormPeach.msizesimilarClick(Sender: TObject);
begin
select_by('sizesimilar10','neutralsel');
end;

procedure TFormPeach.mtaskschedulerClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('taskschd.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.mwebsClick(Sender: TObject);
begin
addextwebsearch;
end;

procedure TFormPeach.PanelHintAddMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintadd;
end;

procedure TFormPeach.PanelHintExtractMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintextract;
end;

procedure TFormPeach.owcustom10Click(Sender: TObject);
begin
openadvappn(2);
end;

procedure TFormPeach.owcustom11Click(Sender: TObject);
begin
openadvappn(3);
end;

procedure TFormPeach.owcustom12Click(Sender: TObject);
begin
openadvappn(4);
end;

procedure TFormPeach.owcustom13Click(Sender: TObject);
begin
openadvappn(5);
end;

procedure TFormPeach.owcustom14Click(Sender: TObject);
begin
openadvappn(6);
end;

procedure TFormPeach.owcustom15Click(Sender: TObject);
begin
openadvappn(7);
end;

procedure TFormPeach.owcustom16Click(Sender: TObject);
begin
openadvappn(8);
end;

procedure TFormPeach.owcustom1Click(Sender: TObject);
begin
openappn(1);
end;

procedure TFormPeach.owcustom2Click(Sender: TObject);
begin
openappn(2);
end;

procedure TFormPeach.owcustom3Click(Sender: TObject);
begin
openappn(3);
end;

procedure TFormPeach.owcustom4Click(Sender: TObject);
begin
openappn(4);
end;

procedure TFormPeach.owcustom5Click(Sender: TObject);
begin
openappn(5);
end;

procedure TFormPeach.owcustom6Click(Sender: TObject);
begin
openappn(6);
end;

procedure TFormPeach.owcustom7Click(Sender: TObject);
begin
openappn(7);
end;

procedure TFormPeach.owcustom8Click(Sender: TObject);
begin
openappn(8);
end;

procedure TFormPeach.owcustom9Click(Sender: TObject);
begin
openadvappn(1);
end;

procedure addpc(inname:AnsiString);
var
   s:ansistring;
begin
suggest_outname(s,FormPeach.cbType.Text,0);
FormPeach.EditAddFilename.Text:=extractfilename(s);
s:=inname;
s:=copy(s,2,2)+directoryseparator;
FormPeach.EditAddFilepath.Text:=s;
FormPeach.EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
end;

procedure TFormPeach.pajdn10Click(Sender: TObject);
begin
addpc(pajdn10.Caption);
end;

procedure TFormPeach.pajdn11Click(Sender: TObject);
begin
addpc(pajdn11.Caption);
end;

procedure TFormPeach.pajdn12Click(Sender: TObject);
begin
addpc(pajdn12.Caption);
end;

procedure TFormPeach.pajdn13Click(Sender: TObject);
begin
addpc(pajdn13.Caption);
end;

procedure TFormPeach.pajdn14Click(Sender: TObject);
begin
addpc(pajdn14.Caption);
end;

procedure TFormPeach.pajdn15Click(Sender: TObject);
begin
addpc(pajdn15.Caption);
end;

procedure TFormPeach.pajdn16Click(Sender: TObject);
begin
addpc(pajdn16.Caption);
end;

procedure TFormPeach.pajdn17Click(Sender: TObject);
begin
addpc(pajdn17.Caption);
end;

procedure TFormPeach.pajdn18Click(Sender: TObject);
begin
addpc(pajdn18.Caption);
end;

procedure TFormPeach.pajdn19Click(Sender: TObject);
begin
addpc(pajdn19.Caption);
end;

procedure TFormPeach.pajdn1Click(Sender: TObject);
begin
addpc(pajdn1.Caption);
end;

procedure TFormPeach.pajdn20Click(Sender: TObject);
begin
addpc(pajdn20.Caption);
end;

procedure TFormPeach.pajdn21Click(Sender: TObject);
begin
addpc(pajdn21.Caption);
end;

procedure TFormPeach.pajdn22Click(Sender: TObject);
begin
addpc(pajdn22.Caption);
end;

procedure TFormPeach.pajdn23Click(Sender: TObject);
begin
addpc(pajdn23.Caption);
end;

procedure TFormPeach.pajdn24Click(Sender: TObject);
begin
addpc(pajdn24.Caption);
end;

procedure TFormPeach.pajdn25Click(Sender: TObject);
begin
addpc(pajdn25.Caption);
end;

procedure TFormPeach.pajdn26Click(Sender: TObject);
begin
addpc(pajdn26.Caption);
end;

procedure TFormPeach.pajdn2Click(Sender: TObject);
begin
addpc(pajdn2.Caption);
end;

procedure TFormPeach.pajdn3Click(Sender: TObject);
begin
addpc(pajdn3.Caption);
end;

procedure TFormPeach.pajdn4Click(Sender: TObject);
begin
addpc(pajdn4.Caption);
end;

procedure TFormPeach.pajdn5Click(Sender: TObject);
begin
addpc(pajdn5.Caption);
end;

procedure TFormPeach.pajdn6Click(Sender: TObject);
begin
addpc(pajdn6.Caption);
end;

procedure TFormPeach.pajdn7Click(Sender: TObject);
begin
addpc(pajdn7.Caption);
end;

procedure TFormPeach.pajdn8Click(Sender: TObject);
begin
addpc(pajdn8.Caption);
end;

procedure TFormPeach.pajdn9Click(Sender: TObject);
begin
addpc(pajdn9.Caption);
end;

procedure TFormPeach.PanelClickAddressClick(Sender: TObject);
begin
showaddresstextfield;
end;

procedure TFormPeach.CheckBoxClipClick(Sender: TObject);
begin
if CheckBoxClip.State=cbUnchecked then clipmode:=0
else clipmode:=1;
if clipmode=0 then clear_clipboard;
updateconf_modified;
end;

procedure TFormPeach.pclip_clearclipClick(Sender: TObject);
begin
clear_clipboard;
end;

procedure TFormPeach.pclip_removeitemClick(Sender: TObject);
var
   i:integer;
begin
if FormPeach.StringGridClipboard.Rowcount<2 then exit;
if FormPeach.StringGridClipboard.Row=0 then exit;
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[12,i]=FormPeach.StringGridClipboard.Cells[3,FormPeach.StringGridClipboard.Row] then
      begin
      FormPeach.StringGridList.Cells[0,i]:='';
      FormPeach.StringGridList.Cells[16,i]:='0';
      end;
FormPeach.Refresh;
//remove clipboard item
for i:=FormPeach.StringGridClipboard.Row-1 to length(clipcontent)-2 do
   begin
   clipcontent[i,0]:=clipcontent[i+1,0];
   clipcontent[i,1]:=clipcontent[i+1,1];
   clipcontent[i,2]:=clipcontent[i+1,2];
   clipcontent[i,3]:=clipcontent[i+1,3];
   clipcontent[i,4]:=clipcontent[i+1,4];
   clipcontent[i,5]:=clipcontent[i+1,5];
   clipcontent[i,6]:=clipcontent[i+1,6];
   end;
setlength(clipcontent,length(clipcontent)-1);
//update UI clipboard
FormPeach.StringGridClipboard.Rowcount:=FormPeach.StringGridClipboard.Rowcount-1;
if FormPeach.StringGridClipboard.Rowcount>1 then
   for i:=0 to length(clipcontent)-1 do
      begin
      FormPeach.StringGridClipboard.Cells[0,i+1]:=clipcontent[i,3];
      FormPeach.StringGridClipboard.Cells[1,i+1]:=clipcontent[i,1];
      FormPeach.StringGridClipboard.Cells[2,i+1]:=clipcontent[i,2];
      FormPeach.StringGridClipboard.Cells[3,i+1]:=clipcontent[i,0];
      FormPeach.StringGridClipboard.Cells[4,i+1]:=clipcontent[i,4];
      FormPeach.StringGridClipboard.Cells[5,i+1]:=clipcontent[i,5];
      FormPeach.StringGridClipboard.Cells[6,i+1]:=clipcontent[i,6];
      end;
FormPeach.StringGridClipboard.Autosizecolumns;
update_listview_sel;
end;

procedure TFormPeach.pcustompathexploreClick(Sender: TObject);
var
   s:ansistring;
begin
s:=extractfilepath(patheditor.Text);
cp_open(s,desk_env);
end;

procedure TFormPeach.pmbc1Click(Sender: TObject);
begin
browsefiledir(pmbc1.caption);
end;

procedure TFormPeach.pmbc2Click(Sender: TObject);
begin
browsefiledir(pmbc2.caption);
end;

procedure TFormPeach.pmbc3Click(Sender: TObject);
begin
browsefiledir(pmbc3.caption);
end;

procedure TFormPeach.pmbc4Click(Sender: TObject);
begin
browsefiledir(pmbc4.caption);
end;

procedure TFormPeach.pmbc5Click(Sender: TObject);
begin
browsefiledir(pmbc5.caption);
end;

procedure TFormPeach.pmbc6Click(Sender: TObject);
begin
browsefiledir(pmbc6.caption);
end;

procedure TFormPeach.pmbc7Click(Sender: TObject);
begin
browsefiledir(pmbc7.caption);
end;

procedure TFormPeach.pmbc8Click(Sender: TObject);
begin
browsefiledir(pmbc8.caption);
end;

procedure TFormPeach.po_cplClick(Sender: TObject);
begin
open_cpl;
end;

procedure TFormPeach.po_detailsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('details')
else archive_funsel('details','all');
end;

procedure TFormPeach.po_envstrClick(Sender: TObject);
begin
dispenv;
end;

procedure TFormPeach.po_hexpClick(Sender: TObject);
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
hexpselected_list('HEXPREVIEW');
end;

procedure TFormPeach.po_im_1024Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1024,768,2,'no',0);
end;

procedure TFormPeach.po_im_200Click(Sender: TObject);
begin
frombrowser_imgtransform(200,200,0,0,1,'no',0);
end;

procedure TFormPeach.po_im_4kcinemaClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,4096,2160,2,'no',0);
end;

procedure TFormPeach.po_im_4ktvClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,3840,2160,2,'no',0);
end;

procedure TFormPeach.po_im_50Click(Sender: TObject);
begin
frombrowser_imgtransform(50,50,0,0,1,'no',0);
end;

procedure TFormPeach.po_im_75Click(Sender: TObject);
begin
frombrowser_imgtransform(75,75,0,0,1,'no',0);
end;

procedure TFormPeach.po_im_BMPClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'BMP',0);
end;

procedure TFormPeach.po_im_cropClick(Sender: TObject);
begin
do_crop;
end;

procedure TFormPeach.po_im_hdClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1080,2,'no',0);
end;

procedure TFormPeach.po_im_JPEG50Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',50);
end;

procedure TFormPeach.po_im_JPEG75Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',75);
end;

procedure TFormPeach.po_im_JPEGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',90);
end;

procedure TFormPeach.po_im_modifyClick(Sender: TObject);
begin
do_resize;
end;

procedure TFormPeach.po_im_PNGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'PNG',0);
end;

procedure TFormPeach.po_im_rlClick(Sender: TObject);
begin
frombrowser_imgrotate('left');
end;

procedure TFormPeach.po_im_rrClick(Sender: TObject);
begin
frombrowser_imgrotate('right');
end;

procedure TFormPeach.po_im_TIFFClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'TIFF',0);
end;

procedure TFormPeach.po_im_wuxgaClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1080,2,'no',0);
end;

procedure TFormPeach.po_manageClick(Sender: TObject);
begin
open_diskmanagement;
end;

procedure TFormPeach.po_removeunitsClick(Sender: TObject);
begin
removeunits;
end;

procedure TFormPeach.po_rename_addClick(Sender: TObject);
begin
rename_files('add');
end;

procedure TFormPeach.po_rename_appenddirClick(Sender: TObject);
begin
rename_files('dirappend');
end;

procedure TFormPeach.po_rename_extClick(Sender: TObject);
begin
rename_files('extension');
end;

procedure TFormPeach.po_rename_lowercaseClick(Sender: TObject);
begin
rename_files('lowercase');
end;

procedure TFormPeach.po_rename_deleteClick(Sender: TObject);
begin
rename_files('delete');
end;

procedure TFormPeach.po_rename_prependdirClick(Sender: TObject);
begin
rename_files('dirprepend');
end;

procedure TFormPeach.po_rename_replaceClick(Sender: TObject);
begin
rename_files('replace');
end;

procedure TFormPeach.po_rename_replace_caseClick(Sender: TObject);
begin
rename_files('replacecase');
end;

procedure TFormPeach.po_rename_timestampClick(Sender: TObject);
begin
rename_files('timestamp');
end;

procedure TFormPeach.po_rename_uppercaseClick(Sender: TObject);
begin
rename_files('uppercase');
end;

procedure TFormPeach.po_securedeletefreeClick(Sender: TObject);
begin
sanitizedisk(1);
end;

procedure TFormPeach.po_selectadvClick(Sender: TObject);
begin
advancedselect;
end;

procedure TFormPeach.po_setpwClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TFormPeach.po_taskClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('taskschd.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure open_taskman;
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('taskmgr'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.po_taskmanClick(Sender: TObject);
begin
open_taskman;
end;

procedure TFormPeach.pmbookmarksClick(Sender: TObject);
begin
addtobookmarks('*browser');
end;

procedure TFormPeach.pmBrowserClick(Sender: TObject);
begin
stayopen:=true;
FormPeach.OpenDialogArchive.Filename:=EditOpenIn.Text;
showpanel('open');
open_inputselect;
end;

procedure TFormPeach.pmcommandClick(Sender: TObject);
begin
browser_commandprompt(1,0,'');
end;

procedure TFormPeach.pmexploreClick(Sender: TObject);
begin
browser_explorepath(1);
end;

procedure TFormPeach.pmh9Click(Sender: TObject);
begin
if StringGridSessionHistory.visible=false then showbar('history');
end;

procedure TFormPeach.pmhr1Click(Sender: TObject);
begin
open_archive_fromname(pmhr1.Caption);
end;

procedure TFormPeach.pmhr2Click(Sender: TObject);
begin
open_archive_fromname(pmhr2.Caption);
end;

procedure TFormPeach.pmhr3Click(Sender: TObject);
begin
open_archive_fromname(pmhr3.Caption);
end;

procedure TFormPeach.pmhr4Click(Sender: TObject);
begin
open_archive_fromname(pmhr4.Caption);
end;

procedure TFormPeach.pmhr5Click(Sender: TObject);
begin
open_archive_fromname(pmhr5.Caption);
end;

procedure TFormPeach.pmhr6Click(Sender: TObject);
begin
open_archive_fromname(pmhr6.Caption);
end;

procedure TFormPeach.pmhr7Click(Sender: TObject);
begin
open_archive_fromname(pmhr7.Caption);
end;

procedure TFormPeach.pmhr8Click(Sender: TObject);
begin
open_archive_fromname(pmhr8.Caption);
end;

procedure TFormPeach.pmhr9Click(Sender: TObject);
begin
if stringgridrecent.visible=false then showbar('recent');
end;

procedure TFormPeach.pmiresetClick(Sender: TObject);
begin
FormPeach.EditUn7zaFilter.Text:='*';
FormPeach.EditUn7zaFilterInteractive.Text:='*';
FormInput.CheckBoxInputRecoursive.state:=cbchecked;
resetsearch;
end;

procedure TFormPeach.pmjb10Click(Sender: TObject);
begin
browsebookmark(10);
end;

procedure TFormPeach.pmjb11Click(Sender: TObject);
begin
browsebookmark(11);
end;

procedure TFormPeach.pmjb12Click(Sender: TObject);
begin
browsebookmark(12);
end;

procedure TFormPeach.pmjb13Click(Sender: TObject);
begin
browsebookmark(13);
end;

procedure TFormPeach.pmjb14Click(Sender: TObject);
begin
browsebookmark(14);
end;

procedure TFormPeach.pmjb15Click(Sender: TObject);
begin
browsebookmark(15);
end;

procedure TFormPeach.pmjb16Click(Sender: TObject);
begin
browsebookmark(16);
end;

procedure TFormPeach.pmjb17Click(Sender: TObject);
begin
browsebookmark(17);
end;

procedure TFormPeach.pmjb18Click(Sender: TObject);
begin
browsebookmark(18);
end;

procedure TFormPeach.pmjb19Click(Sender: TObject);
begin
browsebookmark(19);
end;

procedure TFormPeach.pmjb1Click(Sender: TObject);
begin
browsebookmark(1);
end;

procedure TFormPeach.pmjb20Click(Sender: TObject);
begin
browsebookmark(20);
end;

procedure TFormPeach.pmjb21Click(Sender: TObject);
begin
browsebookmark(21);
end;

procedure TFormPeach.pmjb22Click(Sender: TObject);
begin
browsebookmark(22);
end;

procedure TFormPeach.pmjb23Click(Sender: TObject);
begin
browsebookmark(23);
end;

procedure TFormPeach.pmjb24Click(Sender: TObject);
begin
if stringgridbookmarks.visible=false then showbar('bookmarks');
end;

procedure TFormPeach.pmjb2Click(Sender: TObject);
begin
browsebookmark(2);
end;

procedure TFormPeach.pmjb3Click(Sender: TObject);
begin
browsebookmark(3);
end;

procedure TFormPeach.pmjb4Click(Sender: TObject);
begin
browsebookmark(4);
end;

procedure TFormPeach.pmjb5Click(Sender: TObject);
begin
browsebookmark(5);
end;

procedure TFormPeach.pmjb6Click(Sender: TObject);
begin
browsebookmark(6);
end;

procedure TFormPeach.pmjb7Click(Sender: TObject);
begin
browsebookmark(7);
end;

procedure TFormPeach.pmjb8Click(Sender: TObject);
begin
browsebookmark(8);
end;

procedure TFormPeach.pmjb9Click(Sender: TObject);
begin
browsebookmark(9);
end;

procedure TFormPeach.MenuItemOpen_archiveClick(Sender: TObject);
begin
open_archive;
end;

procedure TFormPeach.MenuItemOpen_exploreClick(Sender: TObject);
begin
browser_explorepath(1);
end;

procedure TFormPeach.MenuItemOpen_pathClick(Sender: TObject);
begin
openpath;
end;

procedure TFormPeach.MenuItemOpen_refreshClick(Sender: TObject);
begin
navrefresh;
end;

procedure TFormPeach.mgolayoutClick(Sender: TObject);
begin
showpanel('archive');
showpanel_trick;
end;

procedure refresharchiveroot(mode:AnsiString);
var
   isel: integer;
   iname: AnsiString;
begin
{try
isel:=FormPeach.ListViewBrowser.Selected.Index;
iname:=FormPeach.ListViewBrowser.Items[isel].Caption;
except
isel:=-1;
iname:='';
end;}
case mode of
   'reload': browsefiledir(FormPeach.pmbc1.caption);
   'noreload': list_root;
   end;
{if isel>=0 then
   try
   FormPeach.ListViewBrowser.Items[isel].MakeVisible(false);
   if FormPeach.ListViewBrowser.Items[isel].Caption=iname then
      begin
      FormPeach.ListViewBrowser.Items[isel].Selected:=true;
      FormPeach.StringGridList.Cells[16,isel+1]:='1';
      FormPeach.StringGridList.Row:=isel+1;
      FormPeach.LabelExtHere.visible:=checkextinput_noduplicatecheck;
      update_listview_sel;
      end;
   except
   end;}//possible implementation
end;

procedure TFormPeach.MenuItemOpenWebClick(Sender: TObject);
begin
websearch_sel;
end;

procedure TFormPeach.pnb10Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb10.Caption);
end;

procedure TFormPeach.pnb11Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb11.Caption);
end;

procedure TFormPeach.pnb12Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb12.Caption);
end;

procedure TFormPeach.pnb13Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb13.Caption);
end;

procedure TFormPeach.pnb14Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb14.Caption);
end;

procedure TFormPeach.pnb15Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb15.Caption);
end;

procedure TFormPeach.pnb16Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb16.Caption);
end;

procedure TFormPeach.pnb17Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb17.Caption);
end;

procedure TFormPeach.pnb18Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb18.Caption);
end;

procedure TFormPeach.pnb19Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb19.Caption);
end;

procedure TFormPeach.pnb1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb1.Caption);
end;

procedure TFormPeach.pnb20Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb20.Caption);
end;

procedure TFormPeach.pnb21Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb21.Caption);
end;

procedure TFormPeach.pnb22Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb22.Caption);
end;

procedure TFormPeach.pnb23Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb23.Caption);
end;

procedure TFormPeach.pnb2Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb2.Caption);
end;

procedure TFormPeach.pnb3Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb3.Caption);
end;

procedure TFormPeach.pnb4Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb4.Caption);
end;

procedure TFormPeach.pnb5Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb5.Caption);
end;

procedure TFormPeach.pnb6Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb6.Caption);
end;

procedure TFormPeach.pnb7Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb7.Caption);
end;

procedure TFormPeach.pnb8Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb8.Caption);
end;

procedure TFormPeach.pnb9Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnb9.Caption);
end;

procedure TFormPeach.pnba10Click(Sender: TObject);
begin
archivemenu_name(pnba10.Caption);
end;

procedure TFormPeach.pnba11Click(Sender: TObject);
begin
archivemenu_name(pnba11.Caption);
end;

procedure TFormPeach.pnba12Click(Sender: TObject);
begin
archivemenu_name(pnba12.Caption);
end;

procedure TFormPeach.pnba13Click(Sender: TObject);
begin
archivemenu_name(pnba13.Caption);
end;

procedure TFormPeach.pnba14Click(Sender: TObject);
begin
archivemenu_name(pnba14.Caption);
end;

procedure TFormPeach.pnba15Click(Sender: TObject);
begin
archivemenu_name(pnba15.Caption);
end;

procedure TFormPeach.pnba16Click(Sender: TObject);
begin
archivemenu_name(pnba16.Caption);
end;

procedure TFormPeach.pnba17Click(Sender: TObject);
begin
archivemenu_name(pnba17.Caption);
end;

procedure TFormPeach.pnba18Click(Sender: TObject);
begin
archivemenu_name(pnba18.Caption);
end;

procedure TFormPeach.pnba19Click(Sender: TObject);
begin
archivemenu_name(pnba19.Caption);
end;

procedure TFormPeach.pnba1Click(Sender: TObject);
begin
archivemenu_name(pnba1.Caption);
end;

procedure TFormPeach.pnba20Click(Sender: TObject);
begin
archivemenu_name(pnba20.Caption);
end;

procedure TFormPeach.pnba21Click(Sender: TObject);
begin
archivemenu_name(pnba21.Caption);
end;

procedure TFormPeach.pnba22Click(Sender: TObject);
begin
archivemenu_name(pnba22.Caption);
end;

procedure TFormPeach.pnba23Click(Sender: TObject);
begin
archivemenu_name(pnba23.Caption);
end;

procedure TFormPeach.pnba2Click(Sender: TObject);
begin
archivemenu_name(pnba2.Caption);
end;

procedure TFormPeach.pnba3Click(Sender: TObject);
begin
archivemenu_name(pnba3.Caption);
end;

procedure TFormPeach.pnba4Click(Sender: TObject);
begin
archivemenu_name(pnba4.Caption);
end;

procedure TFormPeach.pnba5Click(Sender: TObject);
begin
archivemenu_name(pnba5.Caption);
end;

procedure TFormPeach.pnba6Click(Sender: TObject);
begin
archivemenu_name(pnba6.Caption);
end;

procedure TFormPeach.pnba7Click(Sender: TObject);
begin
archivemenu_name(pnba7.Caption);
end;

procedure TFormPeach.pnba8Click(Sender: TObject);
begin
archivemenu_name(pnba8.Caption);
end;

procedure TFormPeach.pnba9Click(Sender: TObject);
begin
archivemenu_name(pnba9.Caption);
end;

procedure TFormPeach.pnh1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh1.Caption);
end;

procedure TFormPeach.pnh2Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh2.Caption);
end;

procedure TFormPeach.pnh3Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh3.Caption);
end;

procedure TFormPeach.pnh4Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh4.Caption);
end;

procedure TFormPeach.pnh5Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh5.Caption);
end;

procedure TFormPeach.pnh6Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh6.Caption);
end;

procedure TFormPeach.pnh7Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh7.Caption);
end;

procedure TFormPeach.pnh8Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=extractfilepath(pnh8.Caption);
end;

procedure TFormPeach.pnha1Click(Sender: TObject);
begin
archivemenu_name(pnha1.Caption);
end;

procedure TFormPeach.pnha2Click(Sender: TObject);
begin
archivemenu_name(pnha2.Caption);
end;

procedure TFormPeach.pnha3Click(Sender: TObject);
begin
archivemenu_name(pnha3.Caption);
end;

procedure TFormPeach.pnha4Click(Sender: TObject);
begin
archivemenu_name(pnha4.Caption);
end;

procedure TFormPeach.pnha5Click(Sender: TObject);
begin
archivemenu_name(pnha5.Caption);
end;

procedure TFormPeach.pnha6Click(Sender: TObject);
begin
archivemenu_name(pnha6.Caption);
end;

procedure TFormPeach.pnha7Click(Sender: TObject);
begin
archivemenu_name(pnha7.Caption);
end;

procedure TFormPeach.pnha8Click(Sender: TObject);
begin
archivemenu_name(pnha8.Caption);
end;

procedure TFormPeach.pnr1Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr1.Caption;
end;

procedure TFormPeach.pnr2Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr2.Caption;
end;

procedure TFormPeach.pnr3Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr3.Caption;
end;

procedure TFormPeach.pnr4Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr4.Caption;
end;

procedure TFormPeach.pnr5Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr5.Caption;
end;

procedure TFormPeach.pnr6Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr6.Caption;
end;

procedure TFormPeach.pnr7Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr7.Caption;
end;

procedure TFormPeach.pnr8Click(Sender: TObject);
begin
FormPeach.EditOutExtract.Text:=pnr8.Caption;
end;

procedure TFormPeach.pnra1Click(Sender: TObject);
begin
archivemenu_name(pnra1.Caption);
end;

procedure TFormPeach.pnra2Click(Sender: TObject);
begin
archivemenu_name(pnra2.Caption);
end;

procedure TFormPeach.pnra3Click(Sender: TObject);
begin
archivemenu_name(pnra3.Caption);
end;

procedure TFormPeach.pnra4Click(Sender: TObject);
begin
archivemenu_name(pnra4.Caption);
end;

procedure TFormPeach.pnra5Click(Sender: TObject);
begin
archivemenu_name(pnra5.Caption);
end;

procedure TFormPeach.pnra6Click(Sender: TObject);
begin
archivemenu_name(pnra6.Caption);
end;

procedure TFormPeach.pnra7Click(Sender: TObject);
begin
archivemenu_name(pnra7.Caption);
end;

procedure TFormPeach.pnra8Click(Sender: TObject);
begin
archivemenu_name(pnra8.Caption);
end;

procedure extpc(inname:AnsiString);
var
   s:ansistring;
begin
s:=inname;
s:=copy(s,2,2)+directoryseparator;
FormPeach.EditOutExtract.Text:=extractfilepath(s);
end;

procedure TFormPeach.pojdn10Click(Sender: TObject);
begin
extpc(pojdn10.Caption);
end;

procedure TFormPeach.pojdn11Click(Sender: TObject);
begin
extpc(pojdn11.Caption);
end;

procedure TFormPeach.pojdn12Click(Sender: TObject);
begin
extpc(pojdn12.Caption);
end;

procedure TFormPeach.pojdn13Click(Sender: TObject);
begin
extpc(pojdn13.Caption);
end;

procedure TFormPeach.pojdn14Click(Sender: TObject);
begin
extpc(pojdn14.Caption);
end;

procedure TFormPeach.pojdn15Click(Sender: TObject);
begin
extpc(pojdn15.Caption);
end;

procedure TFormPeach.pojdn16Click(Sender: TObject);
begin
extpc(pojdn16.Caption);
end;

procedure TFormPeach.pojdn17Click(Sender: TObject);
var
   s:ansistring;
begin
extpc(pojdn17.Caption);
end;

procedure TFormPeach.pojdn18Click(Sender: TObject);
begin
extpc(pojdn18.Caption);
end;

procedure TFormPeach.pojdn19Click(Sender: TObject);
begin
extpc(pojdn19.Caption);
end;

procedure TFormPeach.pojdn1Click(Sender: TObject);
begin
extpc(pojdn1.Caption);
end;

procedure TFormPeach.pojdn20Click(Sender: TObject);
begin
extpc(pojdn20.Caption);
end;

procedure TFormPeach.pojdn21Click(Sender: TObject);
begin
extpc(pojdn21.Caption);
end;

procedure TFormPeach.pojdn22Click(Sender: TObject);
begin
extpc(pojdn22.Caption);
end;

procedure TFormPeach.pojdn23Click(Sender: TObject);
begin
extpc(pojdn23.Caption);
end;

procedure TFormPeach.pojdn24Click(Sender: TObject);
begin
extpc(pojdn24.Caption);
end;

procedure TFormPeach.pojdn25Click(Sender: TObject);
begin
extpc(pojdn25.Caption);
end;

procedure TFormPeach.pojdn26Click(Sender: TObject);
begin
extpc(pojdn26.Caption);
end;

procedure TFormPeach.pojdn2Click(Sender: TObject);
begin
extpc(pojdn2.Caption);
end;

procedure TFormPeach.pojdn3Click(Sender: TObject);
begin
extpc(pojdn3.Caption);
end;

procedure TFormPeach.pojdn4Click(Sender: TObject);
begin
extpc(pojdn4.Caption);
end;

procedure TFormPeach.pojdn5Click(Sender: TObject);
begin
extpc(pojdn5.Caption);
end;

procedure TFormPeach.pojdn6Click(Sender: TObject);
begin
extpc(pojdn6.Caption);
end;

procedure TFormPeach.pojdn7Click(Sender: TObject);
begin
extpc(pojdn7.Caption);
end;

procedure TFormPeach.pojdn8Click(Sender: TObject);
begin
extpc(pojdn8.Caption);
end;

procedure TFormPeach.pojdn9Click(Sender: TObject);
begin
extpc(pojdn9.Caption);
end;

procedure TFormPeach.PopupOpenPopup(Sender: TObject);
begin
{$IFDEF MSWINDOWS}popupclosed:=true;{$ENDIF}
try
   shint:='';
   prevshint:='';
   h.hide;
except
end;
update_selstatus;
SeparatorDE.visible:=true;
mextto.visible:=true;
MenuItemExtAllTo.visible:=true;
MenuItemExtAllHere.visible:=true;
MenuItemExtAllHereSmart.visible:=true;
MenuItemExtAllHereNew.visible:=true;
if lastoutpath='' then lastoutpath:=local_desktop;
mextto_Last.Caption:=txt_lastused+' '+extractfilepath(lastoutpath);
if fun='FILEBROWSER' then
   begin
   if checkextinput_noduplicatecheck=false then
      begin
      SeparatorDE.visible:=false;
      mextto.visible:=false;
      MenuItemExtAllTo.visible:=false;
      MenuItemExtAllHere.visible:=false;
      MenuItemExtAllHereSmart.visible:=false;
      MenuItemExtAllHereNew.visible:=false;
      end;
   if checkaddsepmenu=false then po_addsep.visible:=false
   else po_addsep.visible:=true;
   end;
end;

procedure TFormPeach.powcustom10Click(Sender: TObject);
begin
openwith_cust('preview','adv',2);
end;

procedure TFormPeach.powcustom11Click(Sender: TObject);
begin
openwith_cust('preview','adv',3);
end;

procedure TFormPeach.powcustom12Click(Sender: TObject);
begin
openwith_cust('preview','adv',4);
end;

procedure TFormPeach.powcustom13Click(Sender: TObject);
begin
openwith_cust('preview','adv',5);
end;

procedure TFormPeach.powcustom14Click(Sender: TObject);
begin
openwith_cust('preview','adv',6);
end;

procedure TFormPeach.powcustom15Click(Sender: TObject);
begin
openwith_cust('preview','adv',7);
end;

procedure TFormPeach.powcustom16Click(Sender: TObject);
begin
openwith_cust('preview','adv',8);
end;

procedure TFormPeach.powcustom1Click(Sender: TObject);
begin
openwith_cust('preview','cust',1);
end;

procedure TFormPeach.powcustom2Click(Sender: TObject);
begin
openwith_cust('preview','cust',2);
end;

procedure TFormPeach.powcustom3Click(Sender: TObject);
begin
openwith_cust('preview','cust',3);
end;

procedure TFormPeach.powcustom4Click(Sender: TObject);
begin
openwith_cust('preview','cust',4);
end;

procedure TFormPeach.powcustom5Click(Sender: TObject);
begin
openwith_cust('preview','cust',5);
end;

procedure TFormPeach.powcustom6Click(Sender: TObject);
begin
openwith_cust('preview','cust',6);
end;

procedure TFormPeach.powcustom7Click(Sender: TObject);
begin
openwith_cust('preview','cust',7);
end;

procedure TFormPeach.powcustom8Click(Sender: TObject);
begin
openwith_cust('preview','cust',8);
end;

procedure TFormPeach.powcustom_10Click(Sender: TObject);
begin
openwith_cust('preview','cust',10);
end;

procedure TFormPeach.powcustom_11Click(Sender: TObject);
begin
openwith_cust('preview','cust',11);
end;

procedure TFormPeach.powcustom_12Click(Sender: TObject);
begin
openwith_cust('preview','cust',12);
end;

procedure TFormPeach.powcustom_13Click(Sender: TObject);
begin
openwith_cust('preview','cust',13);
end;

procedure TFormPeach.powcustom_14Click(Sender: TObject);
begin
openwith_cust('preview','cust',14);
end;

procedure TFormPeach.powcustom_15Click(Sender: TObject);
begin
openwith_cust('preview','cust',15);
end;

procedure TFormPeach.powcustom_16Click(Sender: TObject);
begin
openwith_cust('preview','cust',16);
end;

procedure TFormPeach.powcustom_9Click(Sender: TObject);
begin
openwith_cust('preview','cust',9);
end;

procedure TFormPeach.po_alltasksClick(Sender: TObject);
begin
do_alltasks;
end;

procedure TFormPeach.powcustom9Click(Sender: TObject);
begin
openwith_cust('preview','adv',1);
end;

procedure TFormPeach.po_computerClick(Sender: TObject);
begin
open_compmanagement;
end;

procedure TFormPeach.po_convertarchiveClick(Sender: TObject);
begin
archive_convert;
end;

procedure TFormPeach.po_convertClick(Sender: TObject);
begin
disk_convert;
end;

procedure TFormPeach.CheckBoxIgnorePathsClick(Sender: TObject);
begin
on_CheckBox4_click;
end;

procedure TFormPeach.CheckBoxARCrrClick(Sender: TObject);
begin
on_CheckBoxARC1Click;
end;

procedure TFormPeach.CheckBoxArchiveHistoryClick(Sender: TObject);
begin
on_CheckBoxArchiveHistory_click;
if updatingconf=true then exit;//workaround for Lazarus 3.0, the click action is triggered changing the value of the checkbox item unlike in previous versions of Lazarus
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.CheckBox7zOFClick(Sender: TObject);
begin
CheckBoxArchiveOF_onclick;
end;

procedure TFormPeach.CheckBoxIgnoreDispClick(Sender: TObject);
begin
on_CheckBoxIgnoreDisp_click;
end;

procedure TFormPeach.CheckBoxIgnoreSelClick(Sender: TObject);
begin
on_CheckBoxIgnoreSel_click;
end;

procedure TFormPeach.CheckBoxQuadMaxClick(Sender: TObject);
begin
on_CheckBoxQuadMax_click;
end;

procedure TFormPeach.CheckBoxShowHintsClick(Sender: TObject);
begin
on_CheckBoxShowHintsClick;
end;

procedure TFormPeach.CheckBoxTarBeforeClick(Sender: TObject);
var
   s:ansistring;
begin
if CheckBoxTarBefore.State=cbChecked then
   begin
   if CheckBoxSeparate.State=cbChecked then
      begin
      EditAddFilename.Enabled:=true;
      suggest_outname(s,FormPeach.cbType.Text,FormPeach.StringGridAdd.Row);
      EditAddFilename.Text:=extractfilename(s);
      EditAddName.Text:=FormPeach.EditAddFilepath.Text+addext(FormPeach.EditAddFilename.Text);
      end;
   CheckBoxSeparate.State:=cbUnChecked;
   CheckBoxSeparate.Enabled:=false;
   CheckBoxSameArc.State:=cbUnChecked;
   CheckBoxSameArc.Enabled:=false;
   CheckBoxConvert.State:=cbUnChecked;
   CheckBoxConvert.Enabled:=false;
   CheckBoxConvertPW.visible:=CheckBoxConvert.Checked;
   CheckBoxConvertVerbose.visible:=CheckBoxConvert.Checked;
   end
else
   begin
   CheckBoxSameArc.Enabled:=true;
   CheckBoxSeparate.Enabled:=true;
   CheckBoxConvert.Enabled:=true;
   end;
end;

procedure on_CheckBoxWindowStatus_click;
begin
if FormPeach.CheckBoxWindowStatus.State=cbChecked then ws:=1 else ws:=0;
end;

procedure TFormPeach.CheckBoxWindowStatusClick(Sender: TObject);
begin
on_CheckBoxWindowStatus_click;
end;

procedure TFormPeach.ColorButton1ColorChanged(Sender: TObject);
begin
color1:=ColorToString(ColorButton1.ButtonColor);
if openstarted=true then apply_theme;
end;

procedure TFormPeach.ComboBoxARCalgoChange(Sender: TObject);
begin
on_ComboBoxARCalgoChange;
getarccaption(FormPeach.cbType.Text);
end;

procedure TFormPeach.ComboBoxARCLevelChange(Sender: TObject);
begin
on_ComboBoxARCChange;
end;

procedure TFormPeach.cbSplitChange(Sender: TObject);
begin
cbSplit_onchange;
end;

procedure TFormPeach.ComboBoxArcSolidChange(Sender: TObject);
begin
on_ComboBoxArcSolidChange;
end;

procedure TFormPeach.ComboBoxPAQLevelChange(Sender: TObject);
begin
on_ComboBoxPAQ1Change;
end;

procedure TFormPeach.ComboBoxPEAStreamChange(Sender: TObject);
begin
ComboBoxPEA2_onchange;
getarccaption(FormPeach.cbType.Text);
end;

procedure TFormPeach.ComboBoxPEAObjChange(Sender: TObject);
begin
ComboBoxPEA3_onchange;
end;

procedure TFormPeach.ComboBoxPEAVolChange(Sender: TObject);
begin
ComboBoxPEA4_onchange;
end;

procedure TFormPeach.ComboBoxPEALevelChange(Sender: TObject);
begin
ComboBoxPEACompression1_onchange;
end;

procedure TFormPeach.ComboBoxSplitAlgoChange(Sender: TObject);
begin
ComboBoxSplit3_onchange;
end;

procedure TFormPeach.ComboBoxThemeChange(Sender: TObject);
begin
if openstarted=false then exit;
ComboBoxTheme_onchange;
setwindowsopacity;
settabs;
saverestartclosepeaapp;
end;

procedure TFormPeach.ComboBoxUPXChange(Sender: TObject);
begin
on_ComboBoxUPXChange;
end;

procedure TFormPeach.ctrlbackClick(Sender: TObject);
begin
navgoback;
end;

procedure TFormPeach.ctrlfwdClick(Sender: TObject);
begin
navgofwd;
end;

procedure TFormPeach.ctrlupClick(Sender: TObject);
begin
navgoup;
end;

procedure TFormPeach.FormCreate(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
getwinenvadv(wincomspec,winver,majmin);
{$ENDIF}
setbasevars;
get_usrtmp_path(peaziptmpdir);
if peaziptmpdir<>'' then
   if peaziptmpdir[length(peaziptmpdir)]<>DirectorySeparator then peaziptmpdir:=peaziptmpdir+DirectorySeparator;
peaziptmpdirroot:=peaziptmpdir;
peaziptmpdir:=peaziptmpdir+STR_PZWORKTMP+DirectorySeparator+STR_PEAZIPTMP+DirectorySeparator;
//if not(checkdirexists(peaziptmpdir)) then ForceDirectories(peaziptmpdir); //define temp work dir before loading actual one from conf; getmulti in Win context menu entries uses this path (forces dirs so it does not need to be created before)
peaziptmpdir_tmp:=peaziptmpdir;
TShellTreeViewOpener(ShellTreeViewNav).OnDragOver := @DragOverHandler; //will raise error for debugger verifying methods calls
{$IFNDEF MSWINDOWS}
ListViewBrowser.DragMode:=dmAutomatic;
ListViewBrowser.DragCursor:=crMultiDrag;
{$ENDIF}
{$IFDEF MSWINDOWS}
case paramstr(1) of
   '-add2multi' :
   begin
   add2multi;
   halt;
   end;
   '-add2multiconvert' :
   begin
   add2multiconvert;
   halt;
   end;
   '-add2multiseparate' :
   begin
   add2multiseparate;
   halt;
   end;
   '-add2multi7z' :
   begin
   add2multi7z('default');
   halt;
   end;
   '-add2multi7zfastest' :
   begin
   add2multi7z('fastest');
   halt;
   end;
   '-add2multi7znormal' :
   begin
   add2multi7z('normal');
   halt;
   end;
   '-add2multi7zultra' :
   begin
   add2multi7z('ultra');
   halt;
   end;
   '-add2multi7zmail' :
   begin
   add2multi7z('mail');
   halt;
   end;
   '-add2multi7zencrypt' :
   begin
   add2multi7z('7zencrypt');
   halt;
   end;
   //multigeneric
   '-add2multiarc' :
   begin
   add2multigeneric(STR_ARC);
   halt;
   end;
   '-add2multisfxarc' :
   begin
   add2multigeneric('sfx'+STR_ARC);//string patched in the destination procedure add2archivemultigeneric
   halt;
   end;
   '-add2multirar' :
   begin
   add2multigeneric('/RAR');//string patched in the destination procedure add2archivemultigeneric
   halt;
   end;
   '-add2multibrotli' :
   begin
   add2multigeneric(STR_BROTLI);
   halt;
   end;
   '-add2multibzip2' :
   begin
   add2multigeneric(STR_BZIP2);
   halt;
   end;
   '-add2multigzip' :
   begin
   add2multigeneric(STR_GZIP);
   halt;
   end;
   '-add2multipea' :
   begin
   add2multigeneric(STR_PEA);
   halt;
   end;
   '-add2multitar' :
   begin
   add2multigeneric(STR_TAR);
   halt;
   end;
   '-add2multiwim' :
   begin
   add2multigeneric(STR_WIM);
   halt;
   end;
   '-add2multixz' :
   begin
   add2multigeneric(STR_XZ);
   halt;
   end;
   '-add2multizstd' :
   begin
   add2multigeneric(STR_ZSTD);
   halt;
   end;
   '-add2multizpaq' :
   begin
   add2multigeneric(STR_ZPAQ);
   halt;
   end;
   //end multigeneric
   '-add2multizip' :
   begin
   add2multizip('default');
   halt;
   end;
   '-add2multizipfastest' :
   begin
   add2multizip('fastest');
   halt;
   end;
   '-add2multizipnormal' :
   begin
   add2multizip('normal');
   halt;
   end;
   '-add2multizipultra' :
   begin
   add2multizip('ultra');
   halt;
   end;
   '-add2multizipmail' :
   begin
   add2multizip('mail');
   halt;
   end;
   '-add2multisplit' :
   begin
   add2multisplit;
   halt;
   end;
   '-add2multisfx' :
   begin
   add2multisfx;
   halt;
   end;
   '-ext2multitest' :
   begin
   ext2multitest;
   halt;
   end;
   '-ext2multi' :
   begin
   ext2multi;
   halt;
   end;
   '-ext2multihere' :
   begin
   ext2multidirect('-ext2archivemultihere');
   halt;
   end;
   '-ext2multismart' :
   begin
   ext2multidirect('-ext2archivemultismart');
   halt;
   end;
   '-ext2multifolder' :
   begin
   ext2multidirect('-ext2archivemultifolder');
   halt;
   end;
   '-ext2multineutral' :
   begin
   ext2multidirect('-ext2archivemultineutral');
   halt;
   end;
   '-ext2multidownloads' :
   begin
   ext2multidirect('-ext2archivemultidownloads');
   halt;
   end;
   '-ext2multidocuments' :
   begin
   ext2multidirect('-ext2archivemultidocuments');
   halt;
   end;
   '-ext2multidesktop' :
   begin
   ext2multidirect('-ext2archivemultidesktop');
   halt;
   end;
   '-ext2multibookmark1' :
   begin
   ext2multidirect('-ext2archivemultibookmark1');
   halt;
   end;
   '-ext2multibookmark2' :
   begin
   ext2multidirect('-ext2archivemultibookmark2');
   halt;
   end;
   '-ext2multibookmark3' :
   begin
   ext2multidirect('-ext2archivemultibookmark3');
   halt;
   end;
   '-ext2multibookmark4' :
   begin
   ext2multidirect('-ext2archivemultibookmark4');
   halt;
   end;
   '-ext2multibookmark5' :
   begin
   ext2multidirect('-ext2archivemultibookmark5');
   halt;
   end;
   '-ext2multibookmark6' :
   begin
   ext2multidirect('-ext2archivemultibookmark6');
   halt;
   end;
   '-ext2multibookmark7' :
   begin
   ext2multidirect('-ext2archivemultibookmark7');
   halt;
   end;
   '-ext2multibookmark8' :
   begin
   ext2multidirect('-ext2archivemultibookmark8');
   halt;
   end;
   end;
{$ENDIF}
end;

procedure TFormPeach.FormShow(Sender: TObject);
begin
{
entropy is collected by the system state at application startup (fingerprint);
mouse, keyboard and file contexts are initialized at app startup and never
finalized: at each key file generation they are copied and the copies are
finalized, while the contexts remain opened for sampling utter entropy;
fingerprint is regenerated each time a key is pmccreated (however, it will introduce
less entropy than the first time since less system states will be changed)
}
if setbs=true then exit;//formshow contains initialization code; since the event can be invoked not only at startup (i.e. when changing borderstyle on Win32, Lazarus 0.9.30) this occurrence is checked to avoid repeating initialization
setbs:=true;
{$IFDEF MSWINDOWS}
FormPeach.visible:=false;
FixControlStyles(Self);
{$ENDIF}
completeshowpea:=true;
randomize;
//set_items_height; //moved in configuration
load_conf; //parse conf.txt in res folder for GUI theming and default operation parameters
load_presetsnames;
load_bookmarks;
load_tabs;
clearstopsequencefile;
prepare_apps_panel;
load_custedit;
apply_conf;
//app zoom set from scaleby does not resize graphic, as for Lazarus 2.x and 3.x implememtation of scaleby
//app graphic is loaded automatically scaled to system metric, plus scaled as specified by graphic zoom
//if the app zoom has to match graphic zooming (as in the current implementation), it must be set after graphic is loaded (scaled by system metrisc and graphic zoom)
//if the app zoom has to be independent from graphic zoom, it must be loaded first so graphic is loaded taking in accout also the app scaling (which modifies the system metrics)
if pzoom<>100 then
   begin
   FormPeach.scaleby(pzoom,100);
   FormGwrap.scaleby(pzoom,100);
   FormAdvf.scaleby(pzoom,100);
   FormComment.scaleby(pzoom,100);
   FormDlg.scaleby(pzoom,100);
   FormDrop.scaleby(pzoom,100);
   FormImgCrop.scaleby(pzoom,100);
   FormImgRes.scaleby(pzoom,100);
   FormImgViewer.scaleby(pzoom,100);
   FormInput.scaleby(pzoom,100);
   FormKF.scaleby(pzoom,100);
   FormPaths.scaleby(pzoom,100);
   FormPM.scaleby(pzoom,100);
   FormPW.scaleby(pzoom,100);
   FormSelect.scaleby(pzoom,100);
   Formweb.scaleby(pzoom,100);
   end;
//showpanel_prepare;
prepare_GUI; //give starting positions to panels (that in the RAD may be misplaced)
if pimmersive=1 then set_pimmersive;
prepare_FormComment;
prepare_FormPaths;
prepare_FormPW;
prepare_FormPM;
prepare_FormKF;
if spchar=1 then FormKF.CheckBoxSuggestPW.State:=cbChecked else FormKF.CheckBoxSuggestPW.State:=cbUnchecked;
prepare_FormAdvf;
prepare_FormWeb;
prepare_FormImgViewer;
prepare_FormAbout;
prepare_FormDlg;
prepare_Formgwrap;
prepare_FormSelect;
populatefunmenu;
h := THintWindow.Create(self);
po_systemtools.Visible:=false;
po_linsystemtools.Visible:=false;
pmqedocuments.Visible:=false;
MenuItem11.Visible:=false;
mAdmin.Visible:=false;
menuitemopen_powershell.Visible:=false;
MenuItemPowerShell.Visible:=false;
pmpowershell.Visible:=false;
//pmbcps.visible:=false;
setschedulevisible(false);
separator37.visible:=false;
po_zerofree.Visible:=false;
po_securedeletefree.Visible:=false;
MenuItem56.Visible:=false;
pmzerofree.Visible:=false;
pmsecuredeletefree.Visible:=false;
MenuItem91.Visible:=false;
w7contextlang.Visible:=false;
mlayouts.Visible:=false;
setwindowsopacity;
{$IFDEF MSWINDOWS}
po_checkmotw.Visible:=true;
po_motwfull.Visible:=true;
pmmoremotw.Visible:=true;
layoutmotw.Visible:=true;
layoutmotwfull.Visible:=true;
CheckBoxExtrac32.Visible:=true;
separator37.visible:=true;
po_zerofree.Visible:=true;
po_securedeletefree.Visible:=true;
MenuItem56.Visible:=true;
pmzerofree.Visible:=true;
pmsecuredeletefree.Visible:=true;
MenuItem91.Visible:=true;
po_systemtools.Visible:=true;
if winver='nt6+' then mAdmin.Visible:=true;
pmqedocuments.Visible:=true;
MenuItem11.Visible:=true;
openwithcustom.Visible:=true;
po_open_custom.Visible:=true;
MenuItemPreCustom.Visible:=true;
MenuItemERCustom.Visible:=true;
po_task.Visible:=false;
mscheduledscripts.Visible:=false;
mtaskscheduler.Visible:=false;
pcustmakecab.Visible:=true;
pcustmakecabsep.Visible:=true;
case winver of
   'nt5' :
   begin
   po_alltasks.Visible:=false;
   end;
   'nt6+' :
   begin
   //if majmin<>'6.0' then w7contextlang.Visible:=true;
   menuitemopen_powershell.Visible:=true;
   MenuItemPowerShell.Visible:=true;
   pmpowershell.Visible:=true;
   //pmbcps.visible:=true;
   po_task.Visible:=true;
   mscheduledscripts.Visible:=true;
   mtaskscheduler.Visible:=true;
   setschedulevisible(true);
   schedaddscheduleChange(nil);
   schedaddscheduleextChange(nil);
   end;
   end;
{$ELSE}
cbRARsavestreams.Visible:=false;
po_linsystemtools.Visible:=true;
MenuItem36.Visible:=false;
pmmorefun_properties.Visible:=false;
{$IFDEF DARWIN}
po_gnometm.visible:=false;
po_kdetm.visible:=false;
po_cinnamonsett.visible:=false;
po_gnomecc.visible:=false;
po_kdesyssett.visible:=false;
po_xfcesm.visible:=false;
po_gnomesw.visible:=false;
po_synaptic.visible:=false;
po_linhistory.visible:=false;
po_linid.visible:=false;
po_linipaddress.visible:=false;
po_lindfh.Caption:='df';
po_lindush.Caption:='du';
po_linpsef.Caption:='ps';
mshowmenu.Visible:=false;
pmshowmenu.Visible:=false;
MenuItemOrganizeMbar.Visible:=false;
Separator11.Visible:=false;
{$ELSE}
po_macsys.visible:=false;
po_macact.visible:=false;
po_macdisk.visible:=false;
po_maclaunch.visible:=false;
{$ENDIF}
LabelTitleExtract4.Visible:=false;
LabelTitleAdd4.Visible:=false;
po_alltasks.visible:=false;
po_cpl.visible:=false;
po_computer.visible:=false;
po_taskman.visible:=false;
po_task.Visible:=false;
mscheduledscripts.Visible:=false;
mtaskscheduler.Visible:=false;
po_removeunits.visible:=false;
po_sysmore.visible:=false;
//ListView1.Multiselect:=false;//multiselect seem now working properly
modock.Visible:=false;
MenuItem12.Visible:=false;
MenuItem78.Visible:=false;
{$IFDEF DARWIN}
//tray icon/menu currently not working on macOS
mTray.Visible:=false;
{$ENDIF}
mwebs.Visible:=false;
LabelConfigurePeaZip.Visible:=false;
LabelConfigureSendTo.Visible:=false;
msystemintegration.visible:=false;
pcustmakecab.Visible:=false;
pcustmakecabsep.Visible:=false;
{$ENDIF}
populatepcmenu;
populatebookmarks;
populaterecenticons;
populaterecenticonsf;
{$IFDEF MSWINDOWS}
try
internaldllcheck;
if winver='nt6+' then
   begin
   end
else
   begin //XP, ReactOS
   if not(checkdirexists(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk')) then
      ForceDirectories(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk');
   if FileExists(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'brotli.dll') then
      begin
      DeleteFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'brotli.dll');
      RenameFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'brotli.dll',
      binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'brotli.dll');
      end;
   if FileExists(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'flzma2.dll') then
      begin
      DeleteFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'flzma2.dll');
      RenameFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'flzma2.dll',
      binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'flzma2.dll');
      end;
   if FileExists(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lizard.dll') then
      begin
      DeleteFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lizard.dll');
      RenameFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lizard.dll',
      binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lizard.dll');
      end;
   if FileExists(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz4.dll') then
      begin
      DeleteFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz4.dll');
      RenameFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz4.dll',
      binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz4.dll');
      end;
   if FileExists(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz5.dll') then
      begin
      DeleteFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz5.dll');
      RenameFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz5.dll',
      binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz5.dll');
      end;
   if FileExists(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'zstd.dll') then
      begin
      DeleteFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'zstd.dll');
      RenameFile(binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'zstd.dll',
      binpath+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'zstd.dll');
      end;
   end;
except
end;
openstart;
if completeshowpea=true then FormPeach.visible:=true;
finishlistview;
//workaround to correctly display thumbnails on startup (Windows multithreaded implemenatation)
if showthumbnails=1 then do_forcerefresh;
imgshelltree;
{$ELSE}
openstart;
finishlistview;
imgshelltree;
{$IFDEF DARWIN}
//replace some keyboard shortcuts at runtime to better fit macOS conventions
mSelectAll.ShortCut := ($1000) + Ord('A');
po_copy.ShortCut := ($1000) + Ord('C');
mf3.ShortCut := ($1000) + Ord('F');
po_open_asarchive.ShortCut := ($1000) + Ord('O');
po_paste.ShortCut := ($1000) + Ord('V');
po_cut.ShortCut := ($1000) + Ord('X');
mshowhidden.ShortCut := ($1000) + Ord('.');
po_recycle.ShortCut := ($1000) + $8;
mback.ShortCut := ($1000) + 37;
mf4up.ShortCut := ($1000) + 38;
altLEFT.ShortCut := ($1000) + 39;
po_newfolder.ShortCut := ($3000) + Ord('N');
MenuItemOpen_root.ShortCut := ($3000) + Ord('C');
MenuItemopendesktop.ShortCut := ($3000) + Ord('D');
menuitemopenhome.ShortCut := ($3000) + Ord('H');
menuitemopendownloads.ShortCut := ($3000) + Ord('L');
menuitemopendocuments.ShortCut := ($3000) + Ord('O');
//simulate drop event to handle some events not supporting passing paramstr on macOS (double click, open with, and drag on app)
darwinsimulatedrop:=true;
if length(dfilenames)>0 then FormDropFiles(self,dfilenames);
darwinsimulatedrop:=false;
{$ENDIF}
{$ENDIF}
//display note if session is running as root/admin
{$IFDEF MSWINDOWS}
mroot.Caption:='<ADMIN>';
if IsUserAnAdmin=true then mroot.visible:=true else mroot.visible:=false;
{$ELSE}
mroot.Caption:='<ROOT>';
if FpGeteuid=0 then mroot.visible:=true else mroot.visible:=false;
{$ENDIF}
if mroot.Visible=false then mroot.Caption:='';
end;

procedure TFormPeach.ImageBCtextClick(Sender: TObject);
begin
showaddresstextfield;
end;

procedure TFormPeach.ImageBCtextMouseEnter(Sender: TObject);
begin
PanelAdArchive4.Color:=abactivecol;
ImageBCtext.Picture.Bitmap:=Btool_rename_small;
end;

procedure TFormPeach.ImageBCtextMouseLeave(Sender: TObject);
begin
PanelAdArchive4.Color:=Panelclickaddress.Color;
ImageBCtext.Picture.Bitmap:=nil;
end;

procedure TFormPeach.ImageFlatcropClick(Sender: TObject);
begin
do_crop;
end;

procedure TFormPeach.ImageFlatdupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TFormPeach.ImageFlatrenClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TFormPeach.ImageFlattestmoreClick(Sender: TObject);
var
   p:tpoint;
begin
p.x:=FormPeach.ImageFlattestmore.left;
p.y:=FormPeach.PanelListBar.height+FormPeach.PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then p.y:=p.y-FormPeach.PanelBarOpen.height;
if swaptab=true then p.y:=p.y-FormPeach.PanelTabBar.height;
p:=clienttoscreen(p);
pmtestinfolist.popup(p.x,p.y);
end;

procedure TFormPeach.ImageFlattransformClick(Sender: TObject);
begin
do_resize;
end;

procedure TFormPeach.Imagesp1Click(Sender: TObject);
begin
if SplitterOptions.Left=0 then SplitterOptions.left:=180 else SplitterOptions.left:=0;
end;

procedure TFormPeach.ImagespClick(Sender: TObject);
begin
if navbar=3 then setnav(0) else setnav(3);
end;

procedure TFormPeach.LabelCommentClick(Sender: TObject);
begin
setcomment;
end;

procedure TFormPeach.LabelExtHereClick(Sender: TObject);
begin
if LabelExtHere.Caption=txt_ext_here then quickextract('','*here','selected')
else
   if LabelExtHere.Caption=txt_9_8_fnew then quickextract('','*new','selected')
   else quickextract('','*smart','selected');
end;

procedure TFormPeach.LabelWDClick(Sender: TObject);
begin
if FormPeach.ComboBoxWD.ItemIndex=0 then exit;
cp_open(peaziptmpdirroot,desk_env);
end;

procedure TFormPeach.LabelAddFilesClick(Sender: TObject);
begin
addfile;
end;

procedure TFormPeach.LabelAddFolderClick(Sender: TObject);
begin
addfolder;
end;

procedure TFormPeach.LabelCustomDesktopClick(Sender: TObject);
begin
EditDesk.visible:=not(EditDesk.visible);
ButtonEditDesk.visible:=EditDesk.visible;
end;

procedure TFormPeach.LabelColPresetsClick(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=PageOpt6.Left+LabelColPresets.left;
pp.y:=LabelColPresets.top+LabelColPresets.Height;
pp:=clienttoscreen(pp);
PopupColPresets.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.LabelConfigurePwClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TFormPeach.LabelDefaultColor3Click(Sender: TObject);
begin
color3:=color3d;
if openstarted=true then apply_theme;
end;

procedure TFormPeach.LabellightpresetsClick(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=PageOpt6.Left+Labellightpresets.left;
pp.y:=Labellightpresets.top+Labellightpresets.Height;
pp:=clienttoscreen(pp);
PopupLightPresets.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.LabelErrorsClick(Sender: TObject);
begin
if LabelErrors.Caption=txt_7_3_archiveerrors then pMessageWarningOK(browserwarningmsg);
end;

procedure TFormPeach.LabelmoreoptExtClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions3, ShapeOptions3);
end;

procedure TFormPeach.cbqdupClick(Sender: TObject);
begin
on_cbqdupclick;
end;

procedure TFormPeach.LabelPMpwClick(Sender: TObject);
begin
setpm(2);
end;

procedure TFormPeach.LabelsetworkClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions1, ShapeOptions1);
positem(PageOpt1,Labelogreset.Top);
end;

procedure TFormPeach.LabelStatusArClick(Sender: TObject);
begin
do_calcstatusar;
pMessageInfoOK(statushintar);
end;

procedure TFormPeach.LabelStatusArMouseEnter(Sender: TObject);
begin
do_calcstatusar;
LabelStatusAr.Hint:=statushintar;
LabelStatusArDetails.Hint:=statushintar;
end;

procedure TFormPeach.LabelStatusExClick(Sender: TObject);
begin
do_calcstatusex;
pMessageInfoOK(statushintex);
end;

procedure TFormPeach.LabelStatusExMouseEnter(Sender: TObject);
begin
do_calcstatusex;
LabelStatusEx.Hint:=statushintex;
LabelStatusExDetails.Hint:=statushintex;
end;

procedure TFormPeach.LabelStatusClick(Sender: TObject);
begin
  do_showstatus;
end;

procedure TFormPeach.LabelStatusdisplayedClick(Sender: TObject);
begin
  do_showstatus;
end;

procedure TFormPeach.LabelStatusdisplayedMouseEnter(Sender: TObject);
begin
set_statuss_nav;
end;

procedure TFormPeach.LabelStatusMouseEnter(Sender: TObject);
begin
set_statuss_nav;
end;

procedure TFormPeach.LabelThemeClick(Sender: TObject);
begin
if not(checkdirexists(confpath+'themes')) then forcedirectories(confpath+'themes');
cp_open(confpath+'themes',desk_env);
end;

procedure TFormPeach.LabelTitleOptions2Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions2, ShapeOptions2);
end;

procedure TFormPeach.LabelTitleOptions2MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions2, ShapeOptions2);
end;

procedure TFormPeach.LabelTitleOptions2MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions2, ShapeOptions2);
end;

procedure TFormPeach.lightdimClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(stringtocolor(color2),-16,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TFormPeach.lightgraphiteClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(modcolor(stringtocolor(color2),0.88,0.90,0.90),0,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TFormPeach.lightmochaClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(modcolor(stringtocolor(color2),0.90,0.89,0.89),0,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TFormPeach.lightplumClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(modcolor(stringtocolor(color2),0.92,0.90,0.92),0,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TFormPeach.lightsenapeClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(modcolor(stringtocolor(color2),0.90,0.90,0.88),0,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TFormPeach.ListViewBrowserContextPopup(Sender: TObject; MousePos: TPoint;
  var Handled: Boolean);
begin
{$IFNDEF MSWINDOWS}
sleep(100); //avoid that the item under the cursor is, in some cases, automatically clicked as sson as the menu pops up
{$ENDIF}
case altmenu of
   1: ListViewBrowser.PopupMenu:=pmnavbreadcrumb;
   2: ListViewBrowser.PopupMenu:=pmnavhistory;
   3: ListViewBrowser.PopupMenu:=pmnavbooks;
   4: if Buttonopenactions.enabled=true then
         begin
         setopenactions;
         ListViewBrowser.PopupMenu:=pmtopen;
         end
      else
         ListViewBrowser.PopupMenu:=PopupOpen;
   5: if Buttonfmactions1.enabled=true then
         ListViewBrowser.PopupMenu:=PopupMenuRename
      else
         ListViewBrowser.PopupMenu:=PopupOpen;
   else ListViewBrowser.PopupMenu:=PopupOpen;
   end;
{$IFDEF MSWINDOWS}
if (ListViewBrowser.ViewStyle=vsReport) and (MousePos.y<25) then ListViewBrowser.PopupMenu:=PopupHeader;
{$ELSE}
if (ListViewBrowser.ViewStyle=vsReport) and (MousePos.y<3) then ListViewBrowser.PopupMenu:=PopupHeader;
try
   h.hide;
except
end;
{$ENDIF}
end;

{
//possible implementation rename in place by editing listview
procedure renameinplace(s:ansistring);
var
   i:integer;
   namecollisionfound:boolean;
begin
if (fun<>'FILEBROWSER') and (fun<>'UN7Z') then exit;
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
if checkfilename(s)<>0 then
   begin
   pMessageWarningOK('"'+s+'" '+txt_checkname_failed+char($0D)+char($0A)+txt_name_provide);
   exit;
   end;
enter_busy_status;
namecollisionfound:=false;
if fun='UN7Z' then
   for i:=1 to FormPeach.StringGridArchive.Rowcount-1 do
      if FormPeach.StringGridArchive.Cells[12,i]=extractfilepath(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])+s then
         begin
         namecollisionfound:=true;
         break;
         end;
if namecollisionfound=true then
   if pMessageInfoYesNo(txt_6_9_overarch)=7 then
      begin
      exit_busy_status;
      exit;
      end;
if fun='FILEBROWSER' then renamefile(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row],extractfilepath(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])+s);
if fun='UN7Z' then renamefileinarchive(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row],extractfilepath(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row])+s,true);
exit_busy_status;
end;
}

procedure TFormPeach.ListViewBrowserEdited(Sender: TObject; Item: TListItem;
  var AValue: string);
begin
{
//possible implementation rename in place by editing listview
{$IFDEF MSWINDOWS}
//does not fully work on all systems as for Lazarus 4.x (seem not working at least on macos)
FormPeach.ListViewBrowser.ReadOnly:=true;
if FormPeach.EditOpenIn.Text<>renorig then
   begin //crashes with access violation on some instances e.g. go up so browser needs to be in busy status
   FormPeach.ListViewBrowser.Selected:=nil;
   wasselected:=-1;
   exit_busy_status;
   exit;
   end;
if item.Caption=avalue then
   begin
   FormPeach.ListViewBrowser.Selected:=nil;
   wasselected:=-1;
   exit_busy_status;
   exit;
   end;
renameinplace(avalue);
//refresh needs to be trigger async as listview editing is fully completed (otherwise crashes refreshing in archives)
//mouse selection is triggered in error after the operation if editor is closed by clicking outside
Timerrename1.enabled:=true;
{$ENDIF}
}
end;

procedure TFormPeach.ListViewBrowserMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
{$IFNDEF MSWINDOWS}
set_grid;
intdd_do(Button);
{$ENDIF}
intdd:=false;
update_selstatus;
LabelExtHere.visible:=checkextinput_noduplicatecheck;
end;

procedure TFormPeach.lsetdefaultout_arcClick(Sender: TObject);
begin
set_arcout;
end;

procedure TFormPeach.lsetdefaultout_extClick(Sender: TObject);
begin
set_extout;
end;

procedure TFormPeach.mBenchpeaClick(Sender: TObject);
var
   cl:ansistring;
begin
if pMessageInfoYesNo('PEA'+char($0D)+char($0A)+char($0D)+char($0A)+txt_benchmark)=7 then exit;
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' bench';
execute_cl_process(cl);
end;

procedure TFormPeach.mbgnome4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
setusebreadcrumb(3,1);
end;

procedure TFormPeach.mbgnomeClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
setusebreadcrumb(2,1);
end;

procedure TFormPeach.mbkdeClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
setusebreadcrumb(1,1);
end;

procedure TFormPeach.mbmacClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
setusebreadcrumb(4,1);
end;

procedure TFormPeach.mbrowserccommentClick(Sender: TObject);
begin
sortbrowser(9);
end;

procedure TFormPeach.mbtextClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
setusebreadcrumb(0,1);
end;

procedure TFormPeach.mcaccessedClick(Sender: TObject);
begin
caccessed:=not(caccessed);
mcaccessed.Checked:=caccessed;
pmcaccessed.Checked:=caccessed;
set_listview_col;
end;

procedure TFormPeach.marcoptClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then navgoup;
selnone;
do_add;
end;

procedure TFormPeach.mccommentClick(Sender: TObject);
begin
ccomment:=not(ccomment);
mccomment.Checked:=ccomment;
pmccomment.Checked:=ccomment;
set_listview_col;
end;

procedure TFormPeach.mccreatedClick(Sender: TObject);
begin
ccreated:=not(ccreated);
mccreated.Checked:=ccreated;
pmccreated.Checked:=ccreated;
set_listview_col;
end;

procedure TFormPeach.mcommentClick(Sender: TObject);
begin
setcomment;
end;

procedure TFormPeach.mdefarcsetClick(Sender: TObject);
begin
set_arcout_current;
end;

procedure TFormPeach.mdefextsetClick(Sender: TObject);
begin
set_extout_current;
end;

procedure TFormPeach.mcmethodClick(Sender: TObject);
begin
cmethod:=not(cmethod);
mcmethod.Checked:=cmethod;
pmcmethod.Checked:=cmethod;
set_listview_col;
end;

procedure TFormPeach.lightlowClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(stringtocolor(color2),-72,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TFormPeach.mdirbeforefilesClick(Sender: TObject);
begin
if mdirbeforefiles.Checked=true then dirbeforefiles:=0
else dirbeforefiles:=1;
set_dirbeforefiles(dirbeforefiles);
f5refreshExecute(nil);
end;

procedure TFormPeach.mdownloadthemesClick(Sender: TObject);
begin
checkthemes;
end;

procedure TFormPeach.mexploretrashClick(Sender: TObject);
begin
browser_explorepath(2);
end;

procedure TFormPeach.munsavecopyClick(Sender: TObject);
begin
savecopy;
end;

procedure TFormPeach.mz100Click(Sender: TObject);
begin
scaleby(100,pzoom);
pzoom:=100;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz115Click(Sender: TObject);
begin
scaleby(113,pzoom);
pzoom:=113;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz125Click(Sender: TObject);
begin
scaleby(125,pzoom);
pzoom:=125;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz150Click(Sender: TObject);
begin
scaleby(150,pzoom);
pzoom:=150;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz175Click(Sender: TObject);
begin
scaleby(175,pzoom);
pzoom:=175;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz200Click(Sender: TObject);
begin
scaleby(200,pzoom);
pzoom:=200;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz50Click(Sender: TObject);
begin
scaleby(50,pzoom);
pzoom:=50;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz67Click(Sender: TObject);
begin
scaleby(67,pzoom);
pzoom:=67;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz80Click(Sender: TObject);
begin
scaleby(80,pzoom);
pzoom:=80;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.mz87Click(Sender: TObject);
begin
scaleby(87,pzoom);
pzoom:=87;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TFormPeach.pmextherehereClick(Sender: TObject);
begin
quickextract('','*here','selected');
end;

procedure TFormPeach.pmextherenewClick(Sender: TObject);
begin
quickextract('','*new','selected');
end;

procedure TFormPeach.pmextheresmartClick(Sender: TObject);
begin
quickextract('','*smart','selected');
end;

procedure TFormPeach.pmintddnewClick(Sender: TObject);
begin
quickextract(mddtarget,'*new','selected');
end;

procedure TFormPeach.pmintddhereClick(Sender: TObject);
begin
quickextract(mddtarget,'*here','selected');
end;

procedure TFormPeach.mexttob1Click(Sender: TObject);
begin
if (extractfilepath(mexttob1.Caption)<>'') then quickextract(extractfilepath(mexttob1.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob2Click(Sender: TObject);
begin
if (extractfilepath(mexttob2.Caption)<>'') then quickextract(extractfilepath(mexttob2.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob3Click(Sender: TObject);
begin
if (extractfilepath(mexttob3.Caption)<>'') then quickextract(extractfilepath(mexttob3.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob4Click(Sender: TObject);
begin
if (extractfilepath(mexttob4.Caption)<>'') then quickextract(extractfilepath(mexttob4.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob5Click(Sender: TObject);
begin
if (extractfilepath(mexttob5.Caption)<>'') then quickextract(extractfilepath(mexttob5.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob6Click(Sender: TObject);
begin
if (extractfilepath(mexttob6.Caption)<>'') then quickextract(extractfilepath(mexttob6.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob7Click(Sender: TObject);
begin
if (extractfilepath(mexttob7.Caption)<>'') then quickextract(extractfilepath(mexttob7.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttob8Click(Sender: TObject);
begin
if (extractfilepath(mexttob8.Caption)<>'') then quickextract(extractfilepath(mexttob8.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc1Click(Sender: TObject);
begin
if (extractfilepath(mexttoc1.Caption)<>'') then quickextract(extractfilepath(mexttoc1.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc2Click(Sender: TObject);
begin
if (extractfilepath(mexttoc2.Caption)<>'') then quickextract(extractfilepath(mexttoc2.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc3Click(Sender: TObject);
begin
if (extractfilepath(mexttoc3.Caption)<>'') then quickextract(extractfilepath(mexttoc3.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc4Click(Sender: TObject);
begin
if (extractfilepath(mexttoc4.Caption)<>'') then quickextract(extractfilepath(mexttoc4.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc5Click(Sender: TObject);
begin
if (extractfilepath(mexttoc5.Caption)<>'') then quickextract(extractfilepath(mexttoc5.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc6Click(Sender: TObject);
begin
if (extractfilepath(mexttoc6.Caption)<>'') then quickextract(extractfilepath(mexttoc6.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc7Click(Sender: TObject);
begin
if (extractfilepath(mexttoc7.Caption)<>'') then quickextract(extractfilepath(mexttoc7.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoc8Click(Sender: TObject);
begin
if (extractfilepath(mexttoc8.Caption)<>'') then quickextract(extractfilepath(mexttoc8.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh1Click(Sender: TObject);
begin
if (extractfilepath(mexttoh1.Caption)<>'') then quickextract(extractfilepath(mexttoh1.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh2Click(Sender: TObject);
begin
if (extractfilepath(mexttoh2.Caption)<>'') then quickextract(extractfilepath(mexttoh2.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh3Click(Sender: TObject);
begin
if (extractfilepath(mexttoh3.Caption)<>'') then quickextract(extractfilepath(mexttoh3.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh4Click(Sender: TObject);
begin
if (extractfilepath(mexttoh4.Caption)<>'') then quickextract(extractfilepath(mexttoh4.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh5Click(Sender: TObject);
begin
if (extractfilepath(mexttoh5.Caption)<>'') then quickextract(extractfilepath(mexttoh5.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh6Click(Sender: TObject);
begin
if (extractfilepath(mexttoh6.Caption)<>'') then quickextract(extractfilepath(mexttoh6.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh7Click(Sender: TObject);
begin
if (extractfilepath(mexttoh7.Caption)<>'') then quickextract(extractfilepath(mexttoh7.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttoh8Click(Sender: TObject);
begin
if (extractfilepath(mexttoh8.Caption)<>'') then quickextract(extractfilepath(mexttoh8.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos1Click(Sender: TObject);
begin
if (extractfilepath(mexttos1.Caption)<>'') then quickextract(extractfilepath(mexttos1.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos2Click(Sender: TObject);
begin
if (extractfilepath(mexttos2.Caption)<>'') then quickextract(extractfilepath(mexttos2.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos3Click(Sender: TObject);
begin
if (extractfilepath(mexttos3.Caption)<>'') then quickextract(extractfilepath(mexttos3.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos4Click(Sender: TObject);
begin
if (extractfilepath(mexttos4.Caption)<>'') then quickextract(extractfilepath(mexttos4.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos5Click(Sender: TObject);
begin
if (extractfilepath(mexttos5.Caption)<>'') then quickextract(extractfilepath(mexttos5.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos6Click(Sender: TObject);
begin
if (extractfilepath(mexttos6.Caption)<>'') then quickextract(extractfilepath(mexttos6.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos7Click(Sender: TObject);
begin
if (extractfilepath(mexttos7.Caption)<>'') then quickextract(extractfilepath(mexttos7.Caption),'*neutral','selected');
end;

procedure TFormPeach.mexttos8Click(Sender: TObject);
begin
if (extractfilepath(mexttos8.Caption)<>'') then quickextract(extractfilepath(mexttos8.Caption),'*neutral','selected');
end;

procedure TFormPeach.mloadprofileClick(Sender: TObject);
begin
load_profile;
end;

procedure TFormPeach.msaveprofileClick(Sender: TObject);
begin
save_profile;
end;

procedure TFormPeach.mshowsidebarClick(Sender: TObject);
begin
if psidebar=1 then setnav(0) else setnav(2);
end;

procedure TFormPeach.msidebarClick(Sender: TObject);
begin
if psidebar=1 then setnav(0) else setnav(2);
end;

procedure TFormPeach.msmartsortClick(Sender: TObject);
begin
smartsortenabled:=not(smartsortenabled);
set_smartsortable;
f5refreshExecute(nil);
end;

procedure TFormPeach.pmflatarchivesClick(Sender: TObject);
begin
if browserstyle=1 then on_mFlatArchivesClick(0) else on_mFlatArchivesClick(1);
f5refreshExecute(nil)
end;

procedure TFormPeach.pmintddsmartClick(Sender: TObject);
begin
quickextract(mddtarget,'*smart','selected');
end;

procedure TFormPeach.pmscommentClick(Sender: TObject);
begin
setcomment;
end;

procedure TFormPeach.pmsinfoClick(Sender: TObject);
begin
doinfo;
end;

procedure TFormPeach.pmsizelargeClick(Sender: TObject);
begin
settpreset(tpreset,2,false);
end;

procedure TFormPeach.pmsizelargepClick(Sender: TObject);
begin
settpreset(tpreset,3,false);
end;

procedure TFormPeach.pmsizelargeppClick(Sender: TObject);
begin
settpreset(tpreset,4,false);
end;

procedure TFormPeach.pmsizelargepppClick(Sender: TObject);
begin
settpreset(tpreset,5,false);
end;

procedure TFormPeach.pmsizelargeppppClick(Sender: TObject);
begin
settpreset(tpreset,6,false);
end;

procedure TFormPeach.pmsizemediumClick(Sender: TObject);
begin
settpreset(tpreset,1,false);
end;

procedure TFormPeach.pmsizesmallClick(Sender: TObject);
begin
settpreset(tpreset,0,false);
end;

procedure TFormPeach.pmsoparchClick(Sender: TObject);
begin
open_archive;
end;

procedure TFormPeach.pmsoppathClick(Sender: TObject);
begin
openpath;
end;

procedure TFormPeach.pmtabsreopenClick(Sender: TObject);
begin
if StringGridTabsLast.Cells[1,0]='' then exit;
addptab;
StringGridSessionHistory.RowCount:=2;
StringGridSessionHistory.Rows[StringGridSessionHistory.RowCount-1]:=StringGridTabsLast.Rows[0];
browsehistory;
sortplustab;
StringGridTabsLast.Cells[1,0]:='';
end;

procedure TFormPeach.layoutmotwfullClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then layoutcheckmotw(StringGridAdd,'full')
else layoutcheckmotw(StringGridExtract,'full');
end;

procedure TFormPeach.layoutmotwClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then layoutcheckmotw(StringGridAdd,'')
else layoutcheckmotw(StringGridExtract,'');
end;

procedure TFormPeach.po_lingdisksClick(Sender: TObject);
begin
linlaunch('gnome-disks');
end;

procedure TFormPeach.po_linglogsClick(Sender: TObject);
begin
linlaunch('gnome-logs');
end;

procedure TFormPeach.po_linlshwClick(Sender: TObject);
begin
linlaunchconsole('lshw');
end;

procedure TFormPeach.po_motwfullClick(Sender: TObject);
begin
listcheckmotw('full');
end;

procedure TFormPeach.po_checkmotwClick(Sender: TObject);
begin
listcheckmotw('');
end;

procedure TFormPeach.pmmoremotwClick(Sender: TObject);
begin
listcheckmotw('');
end;

procedure TFormPeach.po_ntfsadsClick(Sender: TObject);
begin
getntfsads('*');
end;

procedure TFormPeach.po_ntfsziClick(Sender: TObject);
begin
getntfsads('Zone.Identifier');
end;

procedure TFormPeach.po_savecopyClick(Sender: TObject);
begin
savecopy;
end;

procedure TFormPeach.pow10appsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('ms-settings:appsfeatures'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.pow10dappsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('ms-settings:defaultapps'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.pow10defenderClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('ms-settings:windowsdefender'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.pow10settingsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('ms-settings:'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.pow10storageClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('ms-settings:storagesense'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.po_gnometmClick(Sender: TObject);
begin
linlaunch('gnome-system-monitor');
end;

procedure TFormPeach.po_kdetmClick(Sender: TObject);
begin
linlaunch('KSysGuard');
end;

procedure TFormPeach.po_textpClick(Sender: TObject);
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
hexpselected_list('TEXTPREVIEW');
end;

procedure TFormPeach.ComboBoxsecChange(Sender: TObject);
begin
on_ComboBoxsecChange;
end;

procedure TFormPeach.StringGridBookmarksDragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.TabBarDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.Timerrename1Timer(Sender: TObject);
begin
{
//possible implementation rename in place by editing listview
{$IFDEF MSWINDOWS}
Timerrename1.Enabled:=false;
if fun='UN7Z' then
   reloadandbrowse
else
   navrefresh;
{$ENDIF}
}
end;

procedure TFormPeach.shiftEtogglearchivetreeExecute(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then
   if FormPeach.pmbcexpand.Visible=true then FormPeach.pmbcexpandClick(nil);
end;

procedure TFormPeach.TreeViewNavDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
//needs to be defined on the form to trigger correct drag & drop cursor
end;

procedure TFormPeach.DragOverHandler(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
//needs to be defined, currently empty
end;

procedure TFormPeach.zenc1250Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1250';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1251Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1251';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1252Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1252';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1253Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1253';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1254Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1254';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1255Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1255';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1256Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1256';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1257Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1257';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc1258Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='1258';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc20866Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='20866';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc21866Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='21866';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc65001Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='65001';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc850Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='850';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc852Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='852';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc858Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='858';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc866Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='866';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc874Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='874';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc932Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='932';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc936Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='936';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc949Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='949';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenc950Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='950';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenclocalClick(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=2;
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zenclocalutf8Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=0;
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zencmoreClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions2, ShapeOptions2);
end;

procedure TFormPeach.pmtabsaveClick(Sender: TObject);
begin
if restoretabbar=1 then restoretabbar:=0 else restoretabbar:=1;
if restoretabbar=1 then FormPeach.pmtabsave.Checked:=true else FormPeach.pmtabsave.Checked:=false;
end;

procedure TFormPeach.MenuItemShowColMenuClick(Sender: TObject);
var p:tpoint;
begin
p.x:=FormPeach.PanelListRoot.left;
p.y:=FormPeach.PanelListBar.height+FormPeach.PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then p.y:=p.y-FormPeach.PanelBarOpen.height;
if swaptab=true then p.y:=p.y-FormPeach.PanelTabBar.height;
p:=FormPeach.clienttoscreen(p);
FormPeach.PopupHeader.PopUp(p.x,p.y);
end;

procedure TFormPeach.MenuItemToggleNavClick(Sender: TObject);
begin
togglenavbar;
popuptabmenu;
end;

procedure TFormPeach.mpeachangelogClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'changelog.html',desk_env);
end;

procedure TFormPeach.mpeatosClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-tos-privacy.html',desk_env);
end;

procedure TFormPeach.mswaptabClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
swaptab:=not(swaptab);
saverestartclosepeaapp;
end;

procedure TFormPeach.mtranslationsfaqClick(Sender: TObject);
begin
checktranslations;
end;

procedure TFormPeach.BtnStyleClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=BtnStyle.Left+BtnStyle.Width;
p.y:=BtnStyle.top;//+BtnStyle.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
pmstyle.Alignment:=paRight;
pmstyle.PopUp(p.x,p.y);
pmstyle.Alignment:=paLeft;
end;

procedure TFormPeach.BtnStyleMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   p:TPoint;
begin
p.x:=BtnStyle.Left+BtnStyle.Width;
p.y:=BtnStyle.top;//+BtnStyle.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
case button of
   mbRight:
      begin
      CopyMenu(MainMenu1,pmmain);
      pmmain.Alignment:=paRight;
      pmmain.PopUp(p.x,p.y);
      pmmain.Alignment:=paLeft;
      end;
   end;
end;

procedure TFormPeach.pmbcnwClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: begin s:=EditOpenIn.Caption; end;
1: if LabelClickAddress1.Caption=' '+txt_mypc+' ' then s:=txt_mypc
   else s:=pmbc8.caption;
2: s:=pmbc7.caption;
3: s:=pmbc6.caption;
4: s:=pmbc5.caption;
5: s:=pmbc4.caption;
6: s:=pmbc3.caption;
7: s:=pmbc2.caption;
8: s:=pmbc1.caption;
end;
s:=extractfilepath(s); //from breadcrumb "new tab" and "new folder" always open parent directory of files
newwin(s);
end;

procedure TFormPeach.pmccommentClick(Sender: TObject);
begin
ccomment:=not(ccomment);
mccomment.Checked:=ccomment;
pmccomment.Checked:=ccomment;
set_listview_col;
end;

procedure TFormPeach.pmclipClick(Sender: TObject);
begin
toggleclip;
end;

procedure TFormPeach.pmembf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf1.Caption)
else addfilefolder_ext_fromname(pmembf1.Caption);
end;

procedure TFormPeach.pmembf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf2.Caption)
else addfilefolder_ext_fromname(pmembf2.Caption);
end;

procedure TFormPeach.pmembf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf3.Caption)
else addfilefolder_ext_fromname(pmembf3.Caption);
end;

procedure TFormPeach.pmembf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf4.Caption)
else addfilefolder_ext_fromname(pmembf4.Caption);
end;

procedure TFormPeach.pmembf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf5.Caption)
else addfilefolder_ext_fromname(pmembf5.Caption);
end;

procedure TFormPeach.pmembf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf6.Caption)
else addfilefolder_ext_fromname(pmembf6.Caption);
end;

procedure TFormPeach.pmembf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf7.Caption)
else addfilefolder_ext_fromname(pmembf7.Caption);
end;

procedure TFormPeach.pmembf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pmembf8.Caption)
else addfilefolder_ext_fromname(pmembf8.Caption);
end;

procedure TFormPeach.pmemrf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr1.Caption)
else addfilefolder_ext_fromname(pnr1.Caption);
end;

procedure TFormPeach.pmemrf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr2.Caption)
else addfilefolder_ext_fromname(pnr2.Caption);
end;

procedure TFormPeach.pmemrf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr3.Caption)
else addfilefolder_ext_fromname(pnr3.Caption);
end;

procedure TFormPeach.pmemrf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr4.Caption)
else addfilefolder_ext_fromname(pnr4.Caption);
end;

procedure TFormPeach.pmemrf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr5.Caption)
else addfilefolder_ext_fromname(pnr5.Caption);
end;

procedure TFormPeach.pmemrf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr6.Caption)
else addfilefolder_ext_fromname(pnr6.Caption);
end;

procedure TFormPeach.pmemrf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr7.Caption)
else addfilefolder_ext_fromname(pnr7.Caption);
end;

procedure TFormPeach.pmemrf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnr8.Caption)
else addfilefolder_ext_fromname(pnr8.Caption);
end;

procedure TFormPeach.pmmoreaddClick(Sender: TObject);
begin
do_add;
end;

procedure TFormPeach.pmmorecommentzipClick(Sender: TObject);
begin
setcomment;
end;

procedure TFormPeach.pmmoreconvertClick(Sender: TObject);
begin
archive_convert;
end;

procedure TFormPeach.pmmoreextractClick(Sender: TObject);
begin
do_extract;
end;

procedure TFormPeach.pmmoretestClick(Sender: TObject);
begin
do_test;
end;

procedure TFormPeach.pmshowstylemenuClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=BtnStyle.Left+BtnStyle.Width;
p.y:=BtnStyle.top;//+BtnStyle.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
pmstyle.Alignment:=paRight;
pmstyle.PopUp(p.x,p.y);
pmstyle.Alignment:=paLeft;
end;

procedure TFormPeach.pmtabscloseallClick(Sender: TObject);
var
   i:integer;
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
closeallothertabs;
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TFormPeach.pmtabsnewwindowClick(Sender: TObject);
begin
newwin(tabaddress.caption);
end;

procedure TFormPeach.pnbce1Click(Sender: TObject);
begin
cp_open(pnbce1.Caption,desk_env);
end;

procedure TFormPeach.pnbce2Click(Sender: TObject);
begin
cp_open(pnbce2.Caption,desk_env);
end;

procedure TFormPeach.pnbce3Click(Sender: TObject);
begin
cp_open(pnbce3.Caption,desk_env);
end;

procedure TFormPeach.pnbce4Click(Sender: TObject);
begin
cp_open(pnbce4.Caption,desk_env);
end;

procedure TFormPeach.pnbce5Click(Sender: TObject);
begin
cp_open(pnbce5.Caption,desk_env);
end;

procedure TFormPeach.pnbce6Click(Sender: TObject);
begin
cp_open(pnbce6.Caption,desk_env);
end;

procedure TFormPeach.pnbce7Click(Sender: TObject);
begin
cp_open(pnbce7.Caption,desk_env);
end;

procedure TFormPeach.pnbce8Click(Sender: TObject);
begin
cp_open(pnbce8.Caption,desk_env);
end;

procedure TFormPeach.pnbcf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf1.Caption)
else addfilefolder_ext_fromname(pnbcf1.Caption);
end;

procedure TFormPeach.pnbcf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf2.Caption)
else addfilefolder_ext_fromname(pnbcf2.Caption);
end;

procedure TFormPeach.pnbcf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf3.Caption)
else addfilefolder_ext_fromname(pnbcf3.Caption);
end;

procedure TFormPeach.pnbcf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf4.Caption)
else addfilefolder_ext_fromname(pnbcf4.Caption);
end;

procedure TFormPeach.pnbcf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf5.Caption)
else addfilefolder_ext_fromname(pnbcf5.Caption);
end;

procedure TFormPeach.pnbcf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf6.Caption)
else addfilefolder_ext_fromname(pnbcf6.Caption);
end;

procedure TFormPeach.pnbcf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf7.Caption)
else addfilefolder_ext_fromname(pnbcf7.Caption);
end;

procedure TFormPeach.pnbcf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnbcf8.Caption)
else addfilefolder_ext_fromname(pnbcf8.Caption);
end;

procedure TFormPeach.pnhe1Click(Sender: TObject);
begin
cp_open(pnh1.Caption,desk_env);
end;

procedure TFormPeach.pnhe2Click(Sender: TObject);
begin
cp_open(pnh2.Caption,desk_env);
end;

procedure TFormPeach.pnhe3Click(Sender: TObject);
begin
cp_open(pnh3.Caption,desk_env);
end;

procedure TFormPeach.pnhe4Click(Sender: TObject);
begin
cp_open(pnh4.Caption,desk_env);
end;

procedure TFormPeach.pnhe5Click(Sender: TObject);
begin
cp_open(pnh5.Caption,desk_env);
end;

procedure TFormPeach.pnhe6Click(Sender: TObject);
begin
cp_open(pnh6.Caption,desk_env);
end;

procedure TFormPeach.pnhe7Click(Sender: TObject);
begin
cp_open(pnh7.Caption,desk_env);
end;

procedure TFormPeach.pnhe8Click(Sender: TObject);
begin
cp_open(pnh8.Caption,desk_env);
end;

procedure TFormPeach.pnhf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf1.Caption)
else addfilefolder_ext_fromname(pnhf1.Caption);
end;

procedure TFormPeach.pnhf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf2.Caption)
else addfilefolder_ext_fromname(pnhf2.Caption);
end;

procedure TFormPeach.pnhf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf3.Caption)
else addfilefolder_ext_fromname(pnhf3.Caption);
end;

procedure TFormPeach.pnhf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf4.Caption)
else addfilefolder_ext_fromname(pnhf4.Caption);
end;

procedure TFormPeach.pnhf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf5.Caption)
else addfilefolder_ext_fromname(pnhf5.Caption);
end;

procedure TFormPeach.pnhf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf6.Caption)
else addfilefolder_ext_fromname(pnhf6.Caption);
end;

procedure TFormPeach.pnhf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf7.Caption)
else addfilefolder_ext_fromname(pnhf7.Caption);
end;

procedure TFormPeach.pnhf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfilefolder_fromname(pnhf8.Caption)
else addfilefolder_ext_fromname(pnhf8.Caption);
end;

procedure TFormPeach.po_addsepClick(Sender: TObject);
begin
if fun='FILEBROWSER' then
   begin
   FormPeach.CheckBoxSameArc.State:=cbUnchecked;
   FormPeach.CheckBoxSeparate.State:=cbChecked;
   FormPeach.CheckBoxConvert.State:=cbUnchecked;
   FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
   FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   on_checkboxseparateclick;
   end;
end;

procedure TFormPeach.MenuItemInfoClick(Sender: TObject);
begin
do_showstatus;
end;

procedure TFormPeach.MenuItemInfomenuClick(Sender: TObject);
begin
do_showstatus;
end;

procedure TFormPeach.msettingsClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions1, ShapeOptions1);
end;

procedure TFormPeach.mshownavbarClick(Sender: TObject);
begin
if navbar=3 then navbar:=0
else navbar:=3;
setnav(navbar);
end;

procedure TFormPeach.mshowstatusbarClick(Sender: TObject);
begin
if lastbar=1 then showbar('statusbar')
else showbar('none');
end;

procedure TFormPeach.mshowtoolbarClick(Sender: TObject);
begin
if toolsize=7 then toolsize:=0
else toolsize:=7;
ptoolsize:=toolsize;
settoolbar;
end;

procedure TFormPeach.pmquickdownloadsClick(Sender: TObject);
begin
  jumpto('sysdownloads');
end;

procedure TFormPeach.pmsnoClick(Sender: TObject);
begin
  showbar('none');
end;

procedure TFormPeach.pmsstatusClick(Sender: TObject);
begin
  showbar('statusbar');
end;

procedure TFormPeach.pmstatusnoneClick(Sender: TObject);
begin
showbar('none');
end;

procedure TFormPeach.pmtoollargeClick(Sender: TObject);
begin
settoolstyle(1);
end;

procedure TFormPeach.pmtoolmediumClick(Sender: TObject);
begin
settoolstyle(2);
end;

procedure TFormPeach.pmtoolsmallClick(Sender: TObject);
begin
settoolstyle(3);
end;

procedure TFormPeach.pmtoolcompactClick(Sender: TObject);
begin
settoolstyle(4);
end;

procedure TFormPeach.pmtoolnoneClick(Sender: TObject);
begin
settoolstyle(5);
end;

procedure TFormPeach.pmshowmainmenuClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=BtnStyle.Left+BtnStyle.Width;
p.y:=BtnStyle.top;//+BtnStyle.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
CopyMenu(MainMenu1,pmmain);
pmmain.Alignment:=paRight;
pmmain.PopUp(p.x,p.y);
pmmain.Alignment:=paLeft;
end;

procedure TFormPeach.mverifyselfClick(Sender: TObject);
begin
internalbincheck;
end;

procedure TFormPeach.pmhnewtabClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: begin s:=EditOpenIn.Caption; end;
1: if LabelClickAddress1.Caption=' '+txt_mypc+' ' then s:=txt_mypc
   else s:=pmbc8.caption;
2: s:=pmbc7.caption;
3: s:=pmbc6.caption;
4: s:=pmbc5.caption;
5: s:=pmbc4.caption;
6: s:=pmbc3.caption;
7: s:=pmbc2.caption;
8: s:=pmbc1.caption;
end;
settabbar(1);
ptabbar:=1;
ptabid:=atabid;
addptab;
sortplustab;
{$IFDEF MSWINDOWS}
if s=txt_mypc then
   begin
   fun:='FILEBROWSER';
   EditUn7zaFilter.Text:='*';
   listdir(s,false,false);
   addtohistory;
   exit;
   end;
{$ENDIF}
fun:='FILEBROWSER';
EditUn7zaFilter.Text:='*';
s:=extractfilepath(s);
listdir(s,false,false);
addtohistory;
end;

procedure TFormPeach.mfilterbrowserClick(Sender: TObject);
begin
if filterbrowser=1 then setfilterbrowser(0) else setfilterbrowser(1);
end;

procedure TFormPeach.pmadvfClick(Sender: TObject);
begin
shiftctrlF9Execute(Self);
end;

procedure TFormPeach.MenuItemColBeosClick(Sender: TObject);
begin
color1:=ColorToString($0000C0FF);
if evalcolor(clWindow)>128 then color3:=ColorToString($00005060)
else color3:=ColorToString($0000C0FF);
if openstarted=true then apply_theme;
end;

procedure TFormPeach.MenuItemColMintClick(Sender: TObject);
begin
color1:=ColorToString($0070B090);
if evalcolor(clWindow)>128 then color3:=ColorToString($00408068)
else color3:=ColorToString($0070B090);
if openstarted=true then apply_theme;
end;

procedure TFormPeach.MenuItemColUbuntuClick(Sender: TObject);
begin
color1:=ColorToString($001444DD);
if evalcolor(clWindow)>128 then color3:=ColorToString($00551466)
else color3:=ColorToString($001444DD);
if openstarted=true then apply_theme;
end;

procedure TFormPeach.MenuItemColWindowsClick(Sender: TObject);
begin
color1:=ColorToString(PAPPCOL);
if evalcolor(clWindow)>128 then color3:=ColorToString(PTACOL)
else color3:=ColorToString(PAPPCOL);
if openstarted=true then apply_theme;
end;

procedure TFormPeach.mloadlayoutClick(Sender: TObject);
var
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then sg:=StringGridAdd
 else
  {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.top=0{$ENDIF} then sg:=StringGridExtract
  else sg:=nil;
loadlist(sg,'');
end;

procedure TFormPeach.mprofileimmediateClick(Sender: TObject);
begin
if immediate_execution=1 then immediate_execution:=0 else immediate_execution:=1;
if immediate_execution=1 then FormPeach.mprofileimmediate.Checked:=true else FormPeach.mprofileimmediate.Checked:=false;
end;

procedure TFormPeach.msamplescriptsClick(Sender: TObject);
begin
cp_open(sharepath+'batch'+DirectorySeparator,desk_env);
end;

procedure TFormPeach.msavelayoutClick(Sender: TObject);
var
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then sg:=StringGridAdd
 else
  {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.top=0{$ENDIF} then sg:=StringGridExtract
  else sg:=nil;
savelist(sg);
end;

procedure TFormPeach.pmr_filesClick(Sender: TObject);
begin
if renfilesonly=1 then setrenfilesonly(0) else setrenfilesonly(1);
end;

procedure TFormPeach.pmr_renClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TFormPeach.pmsaveascsvClick(Sender: TObject);
begin
savecolreport('csv',',');
end;

procedure TFormPeach.pmshowsearchClick(Sender: TObject);
begin
if PanelSearch.Visible then setsearchbar(0)
else setsearchbar(1);
end;

procedure TFormPeach.po_browserccommentClick(Sender: TObject);
begin
sortbrowser(9);
end;

procedure TFormPeach.po_cinnamonsettClick(Sender: TObject);
begin
linlaunch('cinnamon-settings');
end;

procedure TFormPeach.po_clipClick(Sender: TObject);
begin
toggleclip;
end;

procedure TFormPeach.po_commentzipClick(Sender: TObject);
begin
setcomment;
end;

procedure TFormPeach.po_dedupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TFormPeach.po_gnomeccClick(Sender: TObject);
begin
linlaunch('gnome-control-center');
end;

procedure TFormPeach.po_gnomeswClick(Sender: TObject);
begin
linlaunch('gnome-software');
end;

procedure TFormPeach.po_kdesyssettClick(Sender: TObject);
begin
linlaunch('systemsettings5');
end;

procedure TFormPeach.po_lindfhClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/bin/df'{$ELSE}'df -h'{$ENDIF});
end;

procedure TFormPeach.po_lindushClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/bin/du'{$ELSE}'du -sh /'{$ENDIF});
end;

procedure TFormPeach.po_linhistoryClick(Sender: TObject);
begin
linlaunchconsole('history');
end;

procedure TFormPeach.po_linidClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/bin/id'{$ELSE}'id'{$ENDIF});
end;

procedure TFormPeach.po_linipaddressClick(Sender: TObject);
begin
linlaunchconsole('ipaddress');
end;

procedure TFormPeach.po_linnetstatClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/sbin/netstat'{$ELSE}'netstat'{$ENDIF});
end;

procedure TFormPeach.po_linpsefClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/bin/ps'{$ELSE}'ps -ef'{$ENDIF});
end;

procedure TFormPeach.po_lintopClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/bin/top'{$ELSE}'top'{$ENDIF});
end;

procedure TFormPeach.po_macactClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Utilities/Activity Monitor.app"');
end;

procedure TFormPeach.po_macdiskClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Utilities/Disk Utility.app"');
end;

procedure TFormPeach.po_maclaunchClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Launchpad.app"');
end;

procedure TFormPeach.po_macsysClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Utilities/System Preferences.app');
end;

procedure TFormPeach.po_openunitasarchivelinClick(Sender: TObject);
begin
openunitasarchive;
end;

procedure TFormPeach.po_dispenvstrlinClick(Sender: TObject);
begin
dispenv;
end;

procedure TFormPeach.pmcaccessedClick(Sender: TObject);
begin
caccessed:=not(caccessed);
mcaccessed.Checked:=caccessed;
pmcaccessed.Checked:=caccessed;
set_listview_col;
end;

procedure TFormPeach.pmccreatedClick(Sender: TObject);
begin
ccreated:=not(ccreated);
mccreated.Checked:=ccreated;
pmccreated.Checked:=ccreated;
set_listview_col;
end;

procedure TFormPeach.pmcmethodClick(Sender: TObject);
begin
cmethod:=not(cmethod);
mcmethod.Checked:=cmethod;
pmcmethod.Checked:=cmethod;
set_listview_col;
end;

procedure TFormPeach.po_ftpClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /c ftp';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_getmacClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k getmac';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.mtabClick(Sender: TObject);
begin
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TFormPeach.pmrowClick(Sender: TObject);
begin
rowselect:=not(rowselect);
set_rowselect;
end;

procedure TFormPeach.pmsnavClick(Sender: TObject);
begin
setnav(0);
end;

procedure TFormPeach.pmstreeClick(Sender: TObject);
begin
setnav(1);
end;

procedure TFormPeach.pmscompactClick(Sender: TObject);
begin
setnav(2);
end;

procedure TFormPeach.pmsnoneClick(Sender: TObject);
begin
setnav(3);
end;

procedure TFormPeach.MenuItemExtAllHereNewClick(Sender: TObject);
begin
quickextract('','*new','selected');
end;

procedure TFormPeach.MenuItemExtAllHereSmartClick(Sender: TObject);
begin
quickextract('','*smart','selected');
end;

procedure TFormPeach.mextoptClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then navgoup;
selnone;
do_extract;
end;

procedure TFormPeach.mForceSynceditsClick(Sender: TObject);
var
   s,fextl:ansistring;
begin
s:=FormPeach.EditOpenIn.Text;
fextl:=upcase(extractfileext(s));
if (fextl<>'.ARC') and (fextl<>'.WRC') then //not supported for arc
   syncedit_archive
else pMessageInfoOK(txt_6_9_opuns);
end;

procedure TFormPeach.mForceClearClick(Sender: TObject);
var
   s,fextl:ansistring;
begin
s:=FormPeach.EditOpenIn.Text;
fextl:=upcase(extractfileext(s));
if (fextl<>'.ARC') and (fextl<>'.WRC') then //not supported for arc
   begin
   do_discardpreview;
   tobrowser_fromarchiver;
   end
else pMessageInfoOK(txt_6_9_opuns);
end;

procedure TFormPeach.mForceSynceditsClearClick(Sender: TObject);
var
   s,fextl:ansistring;
begin
s:=FormPeach.EditOpenIn.Text;
fextl:=upcase(extractfileext(s));
if (fextl<>'.ARC') and (fextl<>'.WRC') then //not supported for arc
   begin
   syncedit_archive;
   do_discardpreview;
   end
else pMessageInfoOK(txt_6_9_opuns);
end;

procedure TFormPeach.mloadcompsettingsClick(Sender: TObject);
begin
load_presets_interactive;
end;

procedure TFormPeach.mprofile7zfastClick(Sender: TObject);
begin
applypreset('6.txt');
end;

procedure TFormPeach.mprofiletargzClick(Sender: TObject);
begin
applypreset('7.txt');
end;

procedure TFormPeach.mprofiletarxzClick(Sender: TObject);
begin
applypreset('5.txt');
end;

procedure TFormPeach.mprofiletarzstClick(Sender: TObject);
begin
applypreset('12.txt');
end;

procedure TFormPeach.mprofilezstdClick(Sender: TObject);
begin
applypreset('11.txt');
end;

procedure TFormPeach.mprofileextremezpaqClick(Sender: TObject);
begin
applypreset('1.txt');
end;

procedure TFormPeach.mprofile7zfastestClick(Sender: TObject);
begin
applypreset('9.txt');
end;

procedure TFormPeach.mprofileautoClick(Sender: TObject);
begin
applypreset('15.txt');
end;

procedure TFormPeach.mprofileencrypt7zClick(Sender: TObject);
begin
applypreset('13.txt');
end;

procedure TFormPeach.mprofilefastzipClick(Sender: TObject);
begin
applypreset('10.txt');
end;

procedure TFormPeach.mprofilenormal7zClick(Sender: TObject);
begin
applypreset('3.txt');
end;

procedure TFormPeach.mprofilenormalzipClick(Sender: TObject);
begin
applypreset('8.txt');
end;

procedure TFormPeach.mprofilesplitzipClick(Sender: TObject);
begin
applypreset('14.txt');
end;

procedure TFormPeach.mprofileultra7zClick(Sender: TObject);
begin
applypreset('2.txt');
end;

procedure TFormPeach.mprofileloadClick(Sender: TObject);
begin
load_presets_interactive;
end;

procedure TFormPeach.mprofilerarClick(Sender: TObject);
begin
applypreset('4.txt');
end;

procedure TFormPeach.mprofilesaveClick(Sender: TObject);
begin
save_presets_interactive;
end;

procedure TFormPeach.msavecompsettingsClick(Sender: TObject);
begin
save_presets_interactive;
end;

procedure TFormPeach.mtabsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TFormPeach.PanelClickAddressMouseEnter(Sender: TObject);
begin
bctemp:=0;
end;

procedure TFormPeach.pmhtabsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TFormPeach.mcommentrarClick(Sender: TObject);
begin
dospecfun('c');
end;

procedure TFormPeach.pmmorerecoverClick(Sender: TObject);
begin
dospecfun('r');
end;

procedure TFormPeach.pmmorerrClick(Sender: TObject);
begin
dospecfun('rr');
end;

procedure TFormPeach.pmpanalyzefoldersClick(Sender: TObject);
begin
analyzefolders('displayed');
end;

procedure TFormPeach.pmqeherenewClick(Sender: TObject);
begin
quickextract('','*new','all');
end;

procedure TFormPeach.pmqeheresmartClick(Sender: TObject);
begin
quickextract('','*smart','all');
end;

procedure TFormPeach.pmrshClick(Sender: TObject);
begin
FormPeach.pmshist1.Caption:='';
FormPeach.pmshist2.Caption:='';
FormPeach.pmshist3.Caption:='';
FormPeach.pmshist4.Caption:='';
FormPeach.pmshist5.Caption:='';
FormPeach.pmshist6.Caption:='';
FormPeach.pmshist7.Caption:='';
FormPeach.pmshist8.Caption:='';
setsearchhistorymenu;
end;

procedure TFormPeach.pmr_123Click(Sender: TObject);
begin
rename_files('123');
end;

procedure TFormPeach.pmr_appenddirnameClick(Sender: TObject);
begin
rename_files('dirappend');
end;

procedure TFormPeach.pmr_appendtsClick(Sender: TObject);
begin
rename_files('timestamp');
end;

procedure TFormPeach.pmr_asciiClick(Sender: TObject);
begin
rename_files('keepasci');
end;

procedure TFormPeach.pmr_cutClick(Sender: TObject);
begin
rename_files('cutlen');
end;

procedure TFormPeach.pmr_prependdirnameClick(Sender: TObject);
begin
rename_files('dirprepend');
end;

procedure TFormPeach.pms2a_extClick(Sender: TObject);
begin
list_toextractor('none','full');
drag_addtolayoutext(dfilenames);
end;

procedure TFormPeach.pmstyle1Click(Sender: TObject);
begin
settpreset(1,browsersize,false);
end;

procedure TFormPeach.pmstyle3Click(Sender: TObject);
begin
settpreset(2,browsersize,false);
end;

procedure TFormPeach.pmstyle5Click(Sender: TObject);
begin
settpreset(3,browsersize,false);
end;

procedure TFormPeach.pmtabClick(Sender: TObject);
begin
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TFormPeach.pmtabsmClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TFormPeach.pmtestcontextallClick(Sender: TObject);
begin
archive_funsel('test','all');
end;

procedure TFormPeach.pmtestcontextdisplayedClick(Sender: TObject);
begin
archive_funsel('test','displayed');
end;

procedure TFormPeach.pmtestcontextselectedClick(Sender: TObject);
begin
archive_funsel('test','selected');
end;

procedure TFormPeach.pmthemesClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions1, ShapeOptions1);
end;

procedure TFormPeach.pmtool1Click(Sender: TObject);
begin
showtoolbar(1);
if ntoolstyle=5 then settoolstyle(2);
end;

procedure TFormPeach.pmtool2Click(Sender: TObject);
begin
showtoolbar(2);
if ntoolstyle=5 then settoolstyle(2);
end;

procedure TFormPeach.pmtool3Click(Sender: TObject);
begin
showtoolbar(3);
if ntoolstyle=5 then settoolstyle(2);
end;

procedure TFormPeach.po_analyzefoldersClick(Sender: TObject);
begin
analyzefolders('displayed');
end;

procedure TFormPeach.po_hostnameClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k hostname';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_ipconfigClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k ipconfig';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_openfilesClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k openfiles';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_pdupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TFormPeach.po_quserClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k quser';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_qwinstaClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k qwinsta';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_recoverClick(Sender: TObject);
begin
dospecfun('r');
end;

procedure TFormPeach.po_rename_123Click(Sender: TObject);
begin
rename_files('123');
end;

procedure TFormPeach.po_rename_asciiClick(Sender: TObject);
begin
rename_files('keepascii');
end;

procedure TFormPeach.po_rename_cutlenClick(Sender: TObject);
begin
rename_files('cutlen');
end;

procedure TFormPeach.po_rename_filesonlyClick(Sender: TObject);
begin
if renfilesonly=1 then setrenfilesonly(0) else setrenfilesonly(1);
end;

procedure TFormPeach.po_rrClick(Sender: TObject);
begin
dospecfun('rr');
end;

procedure TFormPeach.po_setappstClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(FormPeach.LabelTitleOptions5, FormPeach.ShapeOptions5);
end;

procedure TFormPeach.po_showquicknavmenuClick(Sender: TObject);
begin
popuptabmenu;
end;

procedure TFormPeach.po_smartClick(Sender: TObject);
var
   cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then
   cl:='cmd /K wmic diskdrive get Status, DeviceID, InterfaceType, Model, Size'
else
   cl:='powershell.exe -NoExit Get-CimInstance -ClassName Win32_diskdrive | Select-Object Status, DeviceID, MediaType, InterfaceType, Model, @{n=''Size (GB)'';e={[math]::Round($_.Size/1GB,2)}}, LastErrorCode, ErrorDescription, ErrorCleared, NeedsCleaning';//fixed parameters
//(validation not needed, fixed string) if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
if FormPeach.Visible=true then Application.ProcessMessages;
peapexecute(P,cl);
P.Free;
{$ENDIF}
end;

procedure TFormPeach.po_synapticClick(Sender: TObject);
begin
linlaunch('gksudo synaptic');
end;

procedure TFormPeach.po_systeminfoClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k systeminfo';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.ImageInfoCustomExtClick(Sender: TObject);
begin
pMessageInfoOK(ImageInfoCustomExt.Hint);
end;

procedure TFormPeach.ImageAdArchive0Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.PanelAdArchive0.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(0);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAdArchive0MouseEnter(Sender: TObject);
begin
PanelAdArchive0.Color:=abactivecol;
bctemp:=8;
end;

procedure TFormPeach.ImageAdArchive0MouseLeave(Sender: TObject);
begin
PanelAdArchive0.Color:=abarchivecol;
end;

procedure TFormPeach.ImageAdArchive1Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.PanelAdArchive1.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(1);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAdArchive1MouseEnter(Sender: TObject);
begin
PanelAdArchive1.Color:=abactivecol;
bctemp:=8;
end;

procedure TFormPeach.ImageAdArchive1MouseLeave(Sender: TObject);
begin
PanelAdArchive1.Color:=abarchivecol;
end;

procedure TFormPeach.ImageAdArchive2Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.PanelAdArchive2.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(2);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAdArchive2MouseEnter(Sender: TObject);
begin
PanelAdArchive2.Color:=abactivecol;
bctemp:=8;
end;

procedure TFormPeach.ImageAdArchive2MouseLeave(Sender: TObject);
begin
PanelAdArchive2.Color:=abarchivecol;
end;

procedure TFormPeach.ImageAdArchive3Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.PanelAdArchive3.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(3);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAdArchive3MouseEnter(Sender: TObject);
begin
PanelAdArchive3.Color:=abactivecol;
bctemp:=8;
end;

procedure TFormPeach.ImageAdArchive3MouseLeave(Sender: TObject);
begin
PanelAdArchive3.Color:=abarchivecol;
end;

procedure TFormPeach.ImageAddress0Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress0.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
{$IFDEF MSWINDOWS}prepare_breadcrumbdir(txt_mypc);{$ELSE}prepare_breadcrumbdir(directoryseparator);{$ENDIF}
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress0MouseEnter(Sender: TObject);
begin
PanelAddress0.Color:=abactivecol;
bctemp:=1;
end;

procedure TFormPeach.ImageAddress0MouseLeave(Sender: TObject);
begin
PanelAddress0.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddress1Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress1.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(FormPeach.pmbc8.caption);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress1MouseEnter(Sender: TObject);
begin
PanelAddress1.Color:=abactivecol;
bctemp:=2;
end;

procedure TFormPeach.ImageAddress1MouseLeave(Sender: TObject);
begin
PanelAddress1.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddress2Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress2.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(FormPeach.pmbc7.caption);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress2MouseEnter(Sender: TObject);
begin
PanelAddress2.Color:=abactivecol;
bctemp:=3;
end;

procedure TFormPeach.ImageAddress2MouseLeave(Sender: TObject);
begin
PanelAddress2.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddress3Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress3.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(FormPeach.pmbc6.caption);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress3MouseEnter(Sender: TObject);
begin
PanelAddress3.Color:=abactivecol;
bctemp:=4;
end;

procedure TFormPeach.ImageAddress3MouseLeave(Sender: TObject);
begin
PanelAddress3.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddress4Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress4.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(FormPeach.pmbc5.caption);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress4MouseEnter(Sender: TObject);
begin
PanelAddress4.Color:=abactivecol;
bctemp:=5;
end;

procedure TFormPeach.ImageAddress4MouseLeave(Sender: TObject);
begin
PanelAddress4.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddress5Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress5.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(FormPeach.pmbc4.caption);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress5MouseEnter(Sender: TObject);
begin
PanelAddress5.Color:=abactivecol;
bctemp:=6;
end;

procedure TFormPeach.ImageAddress5MouseLeave(Sender: TObject);
begin
PanelAddress5.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddress6Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress6.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(FormPeach.pmbc3.caption);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress6MouseEnter(Sender: TObject);
begin
PanelAddress6.Color:=abactivecol;
bctemp:=7;
end;

procedure TFormPeach.ImageAddress6MouseLeave(Sender: TObject);
begin
PanelAddress6.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddress7Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=FormPeach.PanelClickAddress.Left+FormPeach.paneladdress7.left;
pp.y:=FormPeach.PanelListBar.height+PanelTabBar.height+FormPeach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-FormPeach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-FormPeach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(FormPeach.pmbc2.caption);
FormPeach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TFormPeach.ImageAddress7MouseEnter(Sender: TObject);
begin
PanelAddress7.Color:=abactivecol;
bctemp:=8;
end;

procedure TFormPeach.ImageAddress7MouseLeave(Sender: TObject);
begin
PanelAddress7.Color:=Panelclickaddress.Color;
end;

procedure TFormPeach.ImageAddressClick(Sender: TObject);
begin
jumpto('root');
end;

procedure TFormPeach.iConsoleCreateImportExtClick(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
importjobcl_extract(cl,jobcode,outname);
end;

procedure TFormPeach.iConsoleCreateImportClick(Sender: TObject);
var
cl,jobcode,outname:ansistring;
begin
importjobcl(cl,jobcode,outname);
end;

procedure TFormPeach.mJobClick(Sender: TObject);
begin
layout_savejob;
end;

procedure TFormPeach.BtnPjLaunchAddClick(Sender: TObject);
var
   s:ansistring;
begin
s:=mConsoleCreate.Text;
launchpjmulti(s);
end;

procedure TFormPeach.BtnPjLaunchExtClick(Sender: TObject);
var
   s:ansistring;
begin
s:=mConsoleCreateExt.Text;
launchpjmulti(s);
end;

procedure TFormPeach.BtnPjSaveAddClick(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
cl:=mConsoleCreate.Text;
if (cl<>'') and (length(cl)>3) then save_pj(cl)
else
   if importjobcl(cl,jobcode,outname)=1 then save_pj(cl);
end;

procedure TFormPeach.ButtonOptResetClick(Sender: TObject);
begin
peazipreset;
end;

procedure TFormPeach.MenuItemToggleStatusClick(Sender: TObject);
begin
togglestatusbar;
popuptabmenu;
end;

procedure TFormPeach.ImageListRootClick(Sender: TObject);
begin
popuptabmenu;
end;

procedure TFormPeach.ImageListSearchClick(Sender: TObject);
var
   p:TPoint;
begin
case refreshstatus of
   0: begin
      p.x:=PanelListSearch.Left+PanelListSearch.Width;
      p.y:=PanelListBar.height+PanelTabBar.height+PanelBarOpen.height-4;
      if swapbars=true then p.y:=p.y-PanelBarOpen.height;
      if swaptab=true then p.y:=p.y-FormPeach.PanelTabBar.height;
      p:=clienttoscreen(p);
      pmresetsearch.PopUp(p.x,p.y);
      end;
   //1 wait
   2: begin
      FormPeach.visible:=false;
      FormPeach.ShowInTaskBar:=stNever;
      restartclosepeaapp;
      end;//stop archive browsing upon user request; to prevent loss of time and user's focus a new instance of PeaZip is started in last directory, and the old instance is closed in background
   end;
end;

procedure TFormPeach.BtnPasswordClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TFormPeach.BtnPjSaveExtClick(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
cl:=mConsoleCreateExt.Text;
if (cl<>'') and (length(cl)>3) then save_pj(cl)
else
   if importjobcl_extract(cl,jobcode,outname)=1 then save_pj(cl);
end;

procedure TFormPeach.LabelDefaultColor1Click(Sender: TObject);
begin
color1:=color1d;
if openstarted=true then apply_theme;
end;

procedure TFormPeach.LabelDefaultColor2Click(Sender: TObject);
begin
color2:=color2d;
temperature:=0;
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TFormPeach.LabelDefaultOpacityClick(Sender: TObject);
begin
SpinEditOpacity.Value:=opacityd;
SpinEditOpacityChange(sender);
end;

procedure TFormPeach.mAttributesClick(Sender: TObject);
begin
select_by('attributes','neutralsel');
end;

procedure TFormPeach.mBenchClick(Sender: TObject);
var
   s,cl,jobcode:ansistring;
begin
if pMessageInfoYesNo('7Z / P7ZIP'+char($0D)+char($0A)+char($0D)+char($0A)+txt_benchmark)=7 then exit;
s:=fun;
cl:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT)+' b';
if sys7zlin>0 then cl:=alias7z+EXEEXT+' b';
fun:='7Z';
fun_status:=fun;
subfun:='bench';
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
launch_cl(cl,jobcode,'');
fun:=s;
fun_status:=fun;
end;

procedure TFormPeach.mDateEOlderClick(Sender: TObject);
begin
select_by('dateolderequal','neutralsel');
end;

procedure TFormPeach.mDateEqualClick(Sender: TObject);
begin
select_by('dateequal','neutralsel');
end;

procedure TFormPeach.mDateERecentClick(Sender: TObject);
begin
select_by('daterecentequal','neutralsel');
end;

procedure TFormPeach.mDateOlderClick(Sender: TObject);
begin
select_by('dateolder','neutralsel');
end;

procedure TFormPeach.mDateRecentClick(Sender: TObject);
begin
select_by('daterecent','neutralsel');
end;

procedure TFormPeach.mDefaultsClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions1, ShapeOptions1);
end;

procedure TFormPeach.ButtonDeleteClick(Sender: TObject);
begin
if fun='FILEBROWSER' then eraseselected_list(1)
else deleteselected_frombrowser;
end;

procedure TFormPeach.MenuItem1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then removeselected
else removeselected_ext;
end;

procedure TFormPeach.MenuItem3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then clearlist
else clearlist_ext;
end;

procedure TFormPeach.pmExplorepathClick(Sender: TObject);
var
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then sg:=StringGridAdd
else sg:=StringGridExtract;
if sg.Rowcount=1 then exit;
if sg.Cells[2,sg.Row]=txt_list_isfolder then
   cp_open(sg.Cells[8,sg.Row],desk_env) //open folder
else //go to object's path
   begin
   if checkfiledirname(sg.Cells[8,sg.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+sg.Cells[8,sg.Row]); exit; end;
   cp_explorepath(sg.Cells[8,sg.Row], desk_env);
   end;
end;

procedure TFormPeach.MenuItemERAssociatedClick(Sender: TObject);
begin
openwith_base('extandrun','associated');
end;

procedure TFormPeach.MenuItemERCustomClick(Sender: TObject);
begin
openwith_base('extandrun','custom');
end;

procedure TFormPeach.MenuItemERPeaZipClick(Sender: TObject);
begin
openwith_base('extandrun','peazip');
end;

procedure TFormPeach.pmextcontextallClick(Sender: TObject);
begin
context_extall;
end;

procedure TFormPeach.MenuItemOpen_ext_allClick(Sender: TObject);
begin
context_extall;
end;

procedure TFormPeach.pmqeallClick(Sender: TObject);
begin
context_extall;
end;

procedure TFormPeach.pmqedisplayedClick(Sender: TObject);
begin
context_extdisplayed;
end;

procedure TFormPeach.pmqeselectedClick(Sender: TObject);
begin
context_extselected;
end;

procedure TFormPeach.pmextcontextdisplayedClick(Sender: TObject);
begin
context_extdisplayed;
end;

procedure TFormPeach.pmextcontextselectedClick(Sender: TObject);
begin
context_extselected;
end;

procedure TFormPeach.MenuItemOpen_ext_displayedClick(Sender: TObject);
begin
context_extdisplayed;
end;

procedure TFormPeach.MenuItemOpen_ext_selectedClick(Sender: TObject);
begin
context_extselected;
end;

procedure TFormPeach.MenuItemOpen_FlatClick(Sender: TObject);
begin
toggle_view;
end;

procedure TFormPeach.MenuItemOpen_info_allClick(Sender: TObject);
begin
archive_funsel('info','all');
end;

procedure TFormPeach.MenuItemOpen_info_displayedClick(Sender: TObject);
begin
archive_funsel('info','displayed')
end;

procedure TFormPeach.MenuItemOpen_info_selectedClick(Sender: TObject);
begin
archive_funsel('info','selected')
end;

procedure TFormPeach.MenuItemOpen_jumpClick(Sender: TObject);
var
   s:ansistring;
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
listrow:=StringgridList.Row;
if ListRow=0 then exit;
if fun='FILEBROWSER' then
   begin
   if checklistsel<>0 then exit;
   FormPeach.EditUn7zaFilter.Text:='*';
   FormPeach.EditUn7zaFilterInteractive.Text:='*';
   if StringGridList.Cells[2,StringGridList.Row]=txt_list_isfolder then //open folder
      s:=StringGridList.Cells[12,StringGridList.Row]
   else //go to object's path
      s:=extractfilepath(StringGridList.Cells[12,StringGridList.Row]);
   listdir(s,false,false);
   addtohistory;
   end;
if fun='UN7Z' then
   begin
   if checklistsel<>0 then exit;
   if StringGridList.Cells[2,StringGridList.Row]=txt_list_isfolder then //open folder
      begin
      EditUn7zaFilter.Text:=StringGridList.Cells[12,StringGridList.Row]+directoryseparator+'*';
      EditUn7zaFilterExclude.Text:=StringGridList.Cells[12,StringGridList.Row]+directoryseparator+'*'+directoryseparator+'*';
      listun7z_go;
      end
   else //go to object's path
      begin
      EditUn7zaFilter.Text:=extractfilepath(StringGridList.Cells[12,StringGridList.Row])+'*';
      EditUn7zaFilterExclude.Text:=extractfilepath(StringGridList.Cells[12,StringGridList.Row])+'*'+directoryseparator+'*';
      listun7z_go;
      end;
   end;
end;

procedure TFormPeach.MenuItemOpen_list_allClick(Sender: TObject);
begin
archive_funsel('list','all');
end;

procedure TFormPeach.MenuItemOpen_list_displayedClick(Sender: TObject);
begin
archive_funsel('list','displayed');
end;

procedure TFormPeach.MenuItemOpen_list_selectedClick(Sender: TObject);
begin
archive_funsel('list','selected');
end;

procedure TFormPeach.MenuItemOpen_test_allClick(Sender: TObject);
begin
do_test;
//archive_funsel('test','all');
end;

procedure TFormPeach.MenuItemOpen_test_displayedClick(Sender: TObject);
begin
archive_funsel('test','displayed');
end;

procedure TFormPeach.MenuItemOpen_test_selectedClick(Sender: TObject);
begin
archive_funsel('test','selected');
end;

procedure TFormPeach.MenuItemOpen_upClick(Sender: TObject);
begin
navgoup;
end;

procedure TFormPeach.MenuItemPreAssociatedClick(Sender: TObject);
begin
openwith_base('preview','associated');
end;

procedure TFormPeach.MenuItemPreCustomClick(Sender: TObject);
begin
openwith_base('preview','custom');
end;

procedure TFormPeach.MenuItemPrePeaZipClick(Sender: TObject);
begin
openwith_base('preview','peazip');
end;

procedure TFormPeach.MenuItemToolsjClick(Sender: TObject);
begin
checkselected('SHA256J');
end;

procedure TFormPeach.pmmoreshajClick(Sender: TObject);
begin
lcheck('SHA256J');
end;

procedure TFormPeach.po_s256jClick(Sender: TObject);
begin
lcheck('SHA256J');
end;

procedure TFormPeach.po_sha1sumClick(Sender: TObject);
begin
lcheck('SHA1SAVE');
end;

procedure TFormPeach.po_b2sumClick(Sender: TObject);
begin
lcheck('BLAKE2BSAVE');
end;

procedure TFormPeach.po_cksumClick(Sender: TObject);
begin
lcheck('CRC32SAVE');
end;

procedure TFormPeach.po_md5sumClick(Sender: TObject);
begin
lcheck('MD5SAVE');
end;

procedure TFormPeach.po_s256gClick(Sender: TObject);
begin
lcheck('SHA256G');
end;

procedure TFormPeach.po_s256vClick(Sender: TObject);
begin
lcheck('SHA256V');
end;

procedure TFormPeach.po_sha256sumClick(Sender: TObject);
begin
lcheck('SHA256SAVE');
end;

procedure TFormPeach.pmmorecheckClick(Sender: TObject);
begin
lcheck('check');
end;

procedure TFormPeach.pmmoreshagClick(Sender: TObject);
begin
lcheck('SHA256G');
end;

procedure TFormPeach.pmmoreshasaveClick(Sender: TObject);
begin
lcheck('SHA256SAVE');
end;

procedure TFormPeach.pmmoreshavClick(Sender: TObject);
begin
lcheck('SHA256V');
end;

procedure TFormPeach.pmmoretextClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
hexpselected_list('TEXTPREVIEW');
end;

procedure TFormPeach.pmspclassicClick(Sender: TObject);
begin
showmenu:=true;
settoolstyle(2);
setnav(0);
settpreset(1,0,true);
showbar('statusbar');
setusebreadcrumb(1,1);
end;

procedure TFormPeach.pmspminimalClick(Sender: TObject);
begin
showmenu:=false;
settoolstyle(3);
setnav(3);
settpreset(1,0,true);
showbar('statusbar');
setusebreadcrumb(1,1);
end;

procedure TFormPeach.pmspmodernClick(Sender: TObject);
begin
showmenu:=false;
settoolstyle(4);
setnav(0);
settpreset(1,2,true);
showbar('none');
setusebreadcrumb(2,1);
end;

procedure TFormPeach.pmspoldClick(Sender: TObject);
begin
showmenu:=false;
settoolstyle(3);
setnav(1);
settpreset(1,0,true);
showbar('statusbar');
setusebreadcrumb(0,1);
end;

procedure TFormPeach.pmsppostmodernClick(Sender: TObject);
begin
showmenu:=false;
settoolstyle(4);
setnav(2);
settpreset(1,3,true); //non-details modes still not perfectly rendered on some non-Win32 widgetsets
showbar('none');
setusebreadcrumb(4,1);
end;

procedure TFormPeach.pmsaveascsvlClick(Sender: TObject);
begin
savecolreport('csv',';');
end;

procedure TFormPeach.pmsaveastsvClick(Sender: TObject);
begin
savecolreport('tsv','');
end;

procedure TFormPeach.pmsaveastxtClick(Sender: TObject);
begin
savecolreport('txt','');
end;

procedure TFormPeach.pmmoreblake2bsaveClick(Sender: TObject);
begin
lcheck('BLAKE2BSAVE');
end;

procedure TFormPeach.pmmorecksaveClick(Sender: TObject);
begin
lcheck('CRC32SAVE');
end;

procedure TFormPeach.pmmoremd5saveClick(Sender: TObject);
begin
lcheck('MD5SAVE');
end;

procedure TFormPeach.pmmoresha1saveClick(Sender: TObject);
begin
lcheck('SHA1SAVE');
end;

procedure TFormPeach.po_analyzeClick(Sender: TObject);
begin
lcheck('list');
end;

procedure TFormPeach.po_checkClick(Sender: TObject);
begin
lcheck('check');
end;

procedure TFormPeach.pmmorehexClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
hexpselected_list('HEXPREVIEW');
end;

procedure TFormPeach.pmmoreanalysisClick(Sender: TObject);
begin
lcheck('list');
end;

procedure TFormPeach.MenuItemToolCheckClick(Sender: TObject);
begin
checkselected('check');
end;

procedure TFormPeach.MenuItemToolAnalyzeClick(Sender: TObject);
begin
checkselected('list');
end;

procedure TFormPeach.MenuItemToolBlake2sClick(Sender: TObject);
begin
checkselected('BLAKE2BSAVE');
end;

procedure TFormPeach.MenuItemToolCrc32Click(Sender: TObject);
begin
checkselected('CRC32SAVE');
end;

procedure TFormPeach.MenuItemToolMD5Click(Sender: TObject);
begin
checkselected('MD5SAVE');
end;

procedure TFormPeach.MenuItemToolsgClick(Sender: TObject);
begin
checkselected('SHA256G');
end;

procedure TFormPeach.MenuItemToolSHA1Click(Sender: TObject);
begin
checkselected('SHA1SAVE');
end;

procedure TFormPeach.MenuItemToolSHA256Click(Sender: TObject);
begin
checkselected('SHA256SAVE');
end;

procedure TFormPeach.MenuItemToolsvClick(Sender: TObject);
begin
checkselected('SHA256V');
end;

procedure TFormPeach.MenuItemToolCompareClick(Sender: TObject);
begin
compareselected;
end;

procedure TFormPeach.pmsecuredeleteClick(Sender: TObject);
begin
if fun='FILEBROWSER' then eraseselected_list(1)
else
   begin
      erase_fromname_list(1,FormPeach.EditOpenIn.Text);
      browsefiledir(extractfilepath(FormPeach.EditOpenIn.Text));
   end;
end;

procedure TFormPeach.pmrecycleClick(Sender: TObject);
begin
if fun='FILEBROWSER' then recycleselected_list
else
   begin
   {$IFDEF MSWINDOWS}
   if FormPeach.visible=true then
      begin
      fileop_fromnamelist(FormPeach.EditOpenIn.Text,'',0,0);
      browsefiledir(extractfilepath(FormPeach.EditOpenIn.Text));
      end;
   {$ENDIF}
   {$IFDEF DARWIN}
   if FormPeach.visible=true then
      begin
      mac_movetotrash(FormPeach.EditOpenIn.Text);
      browsefiledir(extractfilepath(FormPeach.EditOpenIn.Text));
      end;
   {$ENDIF}
   end;
end;

procedure TFormPeach.pmrsearchClick(Sender: TObject);
begin
editun7zafilter.caption:='*';
launch_rsearch;
end;

procedure TFormPeach.pmr_addClick(Sender: TObject);
begin
rename_files('add');
end;

procedure TFormPeach.pmr_deleteClick(Sender: TObject);
begin
rename_files('delete');
end;

procedure TFormPeach.pmr_extClick(Sender: TObject);
begin
rename_files('extension');
end;

procedure TFormPeach.pmr_lowercaseClick(Sender: TObject);
begin
rename_files('lowercase');
end;

procedure TFormPeach.pmr_replacecaseClick(Sender: TObject);
begin
rename_files('replacecase');
end;

procedure TFormPeach.pmr_replaceClick(Sender: TObject);
begin
rename_files('replace');
end;

procedure TFormPeach.pmr_uppercaseClick(Sender: TObject);
begin
rename_files('uppercase');
end;

procedure TFormPeach.pmsearchdragClick(Sender: TObject);
begin
  cp_search(desk_env);
end;

procedure TFormPeach.pmsearchwebClick(Sender: TObject);
begin
  run_websearch(EditUn7zaFilterInteractive.Caption);
end;

procedure TFormPeach.pmsecuredeletefreeClick(Sender: TObject);
begin
sanitizedisk(1);
end;

procedure TFormPeach.pmselectadvClick(Sender: TObject);
begin
advancedselect;
end;

procedure TFormPeach.pmtypeswapClick(Sender: TObject);
begin
if CheckBoxConvert.State=cbChecked then CheckBoxConvert.State:=cbUnchecked
else CheckBoxConvert.State:=cbChecked;
CheckBoxConvertChange(nil);
end;

procedure TFormPeach.pmshist1Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist1.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmshist2Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist2.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmshist3Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist3.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmshist4Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist4.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmshist5Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist5.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmshist6Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist6.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmshist7Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist7.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmshist8Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist8.Caption;
launch_rsearch;
end;

procedure TFormPeach.pmusedefaultClick(Sender: TObject);
begin
set_extout;
end;

procedure TFormPeach.mInvertSelectionClick(Sender: TObject);
begin
select_invert;
end;

procedure TFormPeach.mOptionsClick(Sender: TObject);
begin
showpanel('options');
end;

procedure TFormPeach.mPSELargerClick(Sender: TObject);
begin
select_by('packedlargerequal','neutralsel');
end;

procedure TFormPeach.mPSEqualClick(Sender: TObject);
begin
select_by('packedequal','neutralsel');
end;

procedure TFormPeach.mPSESmallerClick(Sender: TObject);
begin
select_by('packedsmallerequal','neutralsel');
end;

procedure TFormPeach.mPSLargerClick(Sender: TObject);
begin
select_by('packedlarger','neutralsel');
end;

procedure TFormPeach.mPSSmallerClick(Sender: TObject);
begin
select_by('packedsmaller','neutralsel');
end;

procedure TFormPeach.mRecent1Click(Sender: TObject);
begin
open_archive_fromname(mRecent1.Caption);
end;

procedure TFormPeach.mRecent2Click(Sender: TObject);
begin
open_archive_fromname(mRecent2.Caption);
end;

procedure TFormPeach.mRecent3Click(Sender: TObject);
begin
open_archive_fromname(mRecent3.Caption);
end;

procedure TFormPeach.mRecent4Click(Sender: TObject);
begin
open_archive_fromname(mRecent4.Caption);
end;

procedure TFormPeach.mRecent5Click(Sender: TObject);
begin
open_archive_fromname(mRecent5.Caption);
end;

procedure TFormPeach.mRecent6Click(Sender: TObject);
begin
open_archive_fromname(mRecent6.Caption);
end;

procedure TFormPeach.mRecent7Click(Sender: TObject);
begin
open_archive_fromname(mRecent7.Caption);
end;

procedure TFormPeach.mRecent8Click(Sender: TObject);
begin
open_archive_fromname(mRecent8.Caption);
end;

procedure TFormPeach.mSizeELargerClick(Sender: TObject);
begin
select_by('sizelargerequal','neutralsel');
end;

procedure TFormPeach.mSizeEqualClick(Sender: TObject);
begin
select_by('sizeequal','neutralsel');
end;

procedure TFormPeach.mSizeESmallerClick(Sender: TObject);
begin
select_by('sizesmallerequal','neutralsel');
end;

procedure TFormPeach.mSizeLargerClick(Sender: TObject);
begin
select_by('sizelarger','neutralsel');
end;

procedure TFormPeach.mSizeSmallerClick(Sender: TObject);
begin
select_by('sizesmaller','neutralsel');
end;

procedure TFormPeach.CheckBoxEnumdClick(Sender: TObject);
begin
if FormPeach.CheckBoxEnumd.State=cbChecked then enumd:=1 else enumd:=0;
updatelayout('');
end;

procedure TFormPeach.CheckBoxExcludeEFClick(Sender: TObject);
begin
on_CheckBoxExcludeEFClick;
end;

procedure TFormPeach.CheckBoxExtAndClick(Sender: TObject);
begin
on_CheckBoxExtAnd_click;
end;

procedure TFormPeach.CheckBoxExtrac32Click(Sender: TObject);
begin
on_CheckBoxExtrac32_click;
end;

procedure TFormPeach.CheckBoxSmartFolderClick(Sender: TObject);
begin
on_CheckBoxFolder1_click;
end;

procedure TFormPeach.CheckBoxForceBrowseClick(Sender: TObject);
begin
on_CheckBoxForceBrowseClick;
end;

procedure TFormPeach.CheckBoxForceConvertClick(Sender: TObject);
begin
on_CheckBoxForceConvertClick;
end;

procedure TFormPeach.CheckBoxForceEditClick(Sender: TObject);
begin
on_CheckBoxForceEditClick;
end;

procedure TFormPeach.CheckBoxForceLayoutClick(Sender: TObject);
begin
on_CheckBoxForceLayoutClick;
if (FormPeach.Visible=true) and (forcelayout=1) then
   if FormPeach.LabelForceLayout.Caption='' then
      begin
      plistfile:='';
      loadlist(nil,'');
      FormPeach.LabelForceLayout.Caption:=plistfile;
      end;
end;

procedure TFormPeach.CheckBoxForceOpenClick(Sender: TObject);
begin
on_checkboxforceopenclick;
end;

procedure TFormPeach.CheckBoxIntDirClick(Sender: TObject);
begin
on_CheckBoxIntDir_click;
end;

procedure TFormPeach.MenuItemEnumerateClick(Sender: TObject);
begin
updatelayout('enum');
end;

procedure TFormPeach.mRecent9Click(Sender: TObject);
begin
showpanel('open');
if StringGridSessionHistory.visible=false then showbar('history');
navrefresh;
end;

procedure TFormPeach.mSortBySelectionClick(Sender: TObject);
begin
select_sortby;
end;

procedure TFormPeach.pmrselectClick(Sender: TObject);
begin
advancedselect;
end;

procedure TFormPeach.mTypeClick(Sender: TObject);
begin
select_by('ext','neutralsel');
end;

procedure TFormPeach.mUnPEAbrowseClick(Sender: TObject); //custom version of openpath procedure, adding showpanel('open') in proper place
begin
peazip_browse;
end;

procedure TFormPeach.mUnPEAClick(Sender: TObject);
begin
open_archive;
end;

procedure TFormPeach.openwithassociatedClick(Sender: TObject);
begin
open_associated;
end;

procedure TFormPeach.openwithcustomClick(Sender: TObject);
var
   i:integer;
   wname:widestring;
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then sg:=FormPeach.StringGridAdd
else sg:=FormPeach.StringGridExtract;
i:=sg.Row;
if i>0 then
{$IFDEF MSWINDOWS}
wname:=utf8decode(sg.Cells[8,i]);
s:=sg.Cells[8,i];
if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
shellexecutew(FormPeach.handle,PWideChar('open'),PWideChar('RUNDLL32.EXE'),PWideChar('shell32.dll,OpenAs_RunDLL '+wname),PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.openwithpeazipClick(Sender: TObject);
var
   i,j:integer;
   P:tprocessutf8;
   sg:TStringGrid;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then sg:=StringGridAdd
else sg:=StringGridExtract;
i:=sg.Row;
if i>0 then
   begin
   j:=testinput(sg.Cells[8,i],true);
   if (j>=0) then //and (j<>1000) then
      begin
      save_conf;
      save_bookmarks;
      cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -ext2open '+stringdelim(escapefilename(sg.Cells[8,i],desk_env));
      if FormPeach.Visible=true then Application.ProcessMessages;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      peapexecute(P,cl);
      P.Free;
      end;
   end;
end;

procedure TFormPeach.pcustom1Click(Sender: TObject);
begin
clickcustom(pcustom1.caption);
end;

procedure TFormPeach.pcustom2Click(Sender: TObject);
begin
clickcustom(pcustom2.caption);
end;

procedure TFormPeach.pcustom3Click(Sender: TObject);
begin
clickcustom(pcustom3.caption);
end;

procedure TFormPeach.pcustom4Click(Sender: TObject);
begin
clickcustom(pcustom4.caption);
end;

procedure TFormPeach.pcustom5Click(Sender: TObject);
begin
clickcustom(pcustom5.caption);
end;

procedure TFormPeach.pcustom6Click(Sender: TObject);
begin
clickcustom(pcustom6.caption);
end;

procedure TFormPeach.pcustom7Click(Sender: TObject);
begin
clickcustom(pcustom7.caption);
end;

procedure TFormPeach.pcustom8Click(Sender: TObject);
begin
clickcustom(pcustom8.caption);
end;

procedure TFormPeach.pmAddFileClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfile
else addfile_ext;
end;

procedure TFormPeach.pmAddFolderClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then addfolder
else addfolder_ext;
end;

procedure TFormPeach.pmJump3Click(Sender: TObject);
begin
jumpto('home');
end;

procedure TFormPeach.pmJumpDocumentsClick(Sender: TObject);
begin
jumpto('usrdocuments');
end;

procedure TFormPeach.pmjumpdownloadsClick(Sender: TObject);
begin
jumpto('sysdownloads');
end;

procedure TFormPeach.pmjumppubdocClick(Sender: TObject);
begin
jumpto('publicdocuments');
end;

procedure TFormPeach.pmjumppubhomeClick(Sender: TObject);
begin
jumpto('publichome');
end;

procedure TFormPeach.pmmorefun_infoClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('info')
else archive_funsel('info','all');
end;

procedure TFormPeach.pmmorefun_listClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('list')
else archive_funsel('list','all');
end;

procedure TFormPeach.pmJump2Click(Sender: TObject);
begin
jumpto('desktop');
end;


procedure TFormPeach.pmLoadListClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then loadlist(StringGridAdd,'')
else loadlist(StringGridExtract,'');
end;

procedure TFormPeach.pmOpenPJallClick(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
if fun='UN7Z' then
   if compose_un7z_cl(cl,jobcode,outname,false,'neutral','all')<>0 then exit;
if fun='UNARC' then
   if compose_unarc_cl(cl,jobcode,outname,false,'neutral','all')<>0 then exit;
zaout:=zaout1;
display_cl(cl,jobcode,outname);
end;

procedure TFormPeach.pmOpenPJdisplayedClick(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
if fun='UN7Z' then
   if compose_un7z_cl(cl,jobcode,outname,false,'neutral','displayed')<>0 then exit;
if fun='UNARC' then
   if compose_unarc_cl(cl,jobcode,outname,false,'neutral','displayed')<>0 then exit;
zaout:=zaout1;
display_cl(cl,jobcode,outname);
end;

procedure TFormPeach.pmOpenPJselectedClick(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
if fun='UN7Z' then
   if compose_un7z_cl(cl,jobcode,outname,false,'neutral','selected')<>0 then exit;
if fun='UNARC' then
   if compose_unarc_cl(cl,jobcode,outname,false,'neutral','selected')<>0 then exit;
zaout:=zaout1;
display_cl(cl,jobcode,outname);
end;

procedure TFormPeach.pmSaveListClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchive.Visible=true{$ELSE}if PanelArchive.top=0{$ENDIF} then savelist(StringGridAdd)
else savelist(StringGridExtract);
end;

procedure TFormPeach.pmSearchAddClick(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TFormPeach.po_addtoarchiveClick(Sender: TObject);
begin
if fun='FILEBROWSER' then
   begin
   FormPeach.CheckBoxSameArc.State:=cbUnchecked;
   FormPeach.CheckBoxSeparate.State:=cbUnchecked;
   FormPeach.CheckBoxConvert.State:=cbUnchecked;
   FormPeach.CheckBoxConvertPW.visible:=FormPeach.CheckBoxConvert.Checked;
   FormPeach.CheckBoxConvertVerbose.visible:=FormPeach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   end;
if FormPeach.StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
if fun='UN7Z' then addtoarchive_inarchive(true);
if fun='UNARC' then addtoarchive_inarchive(true);
if fun='UNZPAQ' then addtoarchive_inarchive(true);
end;

procedure TFormPeach.po_compareClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
compareselected_list;
end;

procedure TFormPeach.po_copyClick(Sender: TObject);
begin
list_copy;
end;

procedure TFormPeach.po_cutClick(Sender: TObject);
begin
list_cut;
end;

procedure TFormPeach.pmcutClick(Sender: TObject);
begin
list_cut;
end;

procedure TFormPeach.ButtonCopyClick(Sender: TObject);
begin
  list_copy;
end;

procedure TFormPeach.ButtonCutClick(Sender: TObject);
begin
  list_cut;
end;

procedure TFormPeach.ButtonEditDeskClick(Sender: TObject);
begin
   if FormPeach.SelectDirectoryDialog1.Execute then
      if FormPeach.SelectDirectoryDialog1.FileName<>'' then local_desktop:=FormPeach.SelectDirectoryDialog1.FileName;
   if local_desktop<>'' then
      if local_desktop[length(local_desktop)]<>directoryseparator then local_desktop:=local_desktop+directoryseparator;
   EditDesk.Text:=local_desktop;
end;

procedure TFormPeach.po_defragClick(Sender: TObject);
begin
open_defrag;
end;

procedure TFormPeach.po_deleteClick(Sender: TObject);
begin
deleteselected_frombrowser;
end;

procedure TFormPeach.po_diskcleanClick(Sender: TObject);
begin
open_diskclean;
end;

procedure TFormPeach.po_exthereClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then
   begin
   if fun='FILEBROWSER' then
      list_toextractor('none','full');
   exit;
   end;
if fun='FILEBROWSER' then list_toextractor('multi','full')
else list_toextractor('all','full');
end;

procedure TFormPeach.po_infoClick(Sender: TObject);
begin
filebrowser_funall('info');
end;

procedure TFormPeach.po_joinClick(Sender: TObject);
begin
do_join;
end;

procedure TFormPeach.po_listClick(Sender: TObject);
begin
filebrowser_funall('list');
end;

procedure TFormPeach.ImageFlatfolderClick(Sender: TObject);
begin
createnewfolder;
end;

procedure TFormPeach.po_newfolderClick(Sender: TObject);
begin
createnewfolder;
end;

procedure TFormPeach.pmnewfolderClick(Sender: TObject);
begin
createnewfolder;
end;

procedure TFormPeach.ButtonNFClick(Sender: TObject);
begin
createnewfolder;
end;

procedure TFormPeach.po_open_associatedClick(Sender: TObject);
begin
menu_openwith('associated');
end;

procedure TFormPeach.po_open_customClick(Sender: TObject);
begin
menu_openwith('custom');
end;

procedure TFormPeach.ButtonOpenWithClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
   openwith_base('preview','custom')
else
   menu_openwith('custom');
end;

procedure TFormPeach.po_open_peazipClick(Sender: TObject);
begin
openwith_peazipnew(1,'');
end;

procedure TFormPeach.pms2a_addClick(Sender: TObject);
begin
showpanel('archive');
drag_addtolayout(dfilenames);
setdragarchivename;
end;

procedure TFormPeach.pms2a_copyClick(Sender: TObject);
begin
mass_cp_copy_toapp(txt_copy);
end;

procedure TFormPeach.pms2a_moveClick(Sender: TObject);
begin
mass_cp_copy_toapp(txt_cut);
end;

procedure TFormPeach.pms2a_openClick(Sender: TObject);
begin
open_archive_fromname(dfilenames[0]);
end;

procedure TFormPeach.po_pasteClick(Sender: TObject);
begin
   if FormPeach.StringGridList.RowCount-1<length(clipcontent) then
      begin
      FormPeach.StringGridList.RowCount:=length(clipcontent)+1;
      end;
list_paste;
end;

procedure TFormPeach.ButtonPasteClick(Sender: TObject);
begin
     if FormPeach.StringGridList.RowCount-1<length(clipcontent) then
      begin
      FormPeach.StringGridList.RowCount:=length(clipcontent)+1;
      end;
list_paste;
end;

procedure TFormPeach.pmcpytoClick(Sender: TObject);
var
   s:ansistring;
begin
s:='';
clickcopyto(s);
end;

procedure TFormPeach.pmmvtoClick(Sender: TObject);
var
   s:ansistring;
begin
s:='';
clickmoveto(s);
end;

procedure TFormPeach.pmopenoutClick(Sender: TObject);
begin
if autoopen=0 then autoopen:=1 else autoopen:=0;
updateconf_modified;
save_conf; //requires saving configuration since it modifies pealauncher's directive for a parameter that is read from configuration rather than passed through command line
end;

procedure TFormPeach.pmqe1favClick(Sender: TObject);
begin
if (extractfilepath(pnb1.Caption)<>'') then quickextract(extractfilepath(pnb1.Caption),'*neutral','all');
end;

procedure TFormPeach.pmqe2favClick(Sender: TObject);
begin
if (extractfilepath(pnb2.Caption)<>'') then quickextract(extractfilepath(pnb2.Caption),'*neutral','all');
end;

procedure TFormPeach.pmqe3favClick(Sender: TObject);
begin
if (extractfilepath(pnb3.Caption)<>'') then quickextract(extractfilepath(pnb3.Caption),'*neutral','all');
end;

procedure TFormPeach.pmqedefaultClick(Sender: TObject);
begin
quickextract(defaultextractpath,'*neutral','all');
end;

procedure TFormPeach.pmqedeskClick(Sender: TObject);
begin
quickextract(local_desktop,'*neutral','all');
end;

procedure TFormPeach.pmqedocumentsClick(Sender: TObject);
begin
quickextract(usr_documents,'*neutral','all');
end;

procedure TFormPeach.pmqehereClick(Sender: TObject);
begin
quickextract('','*here','all');
end;

procedure TFormPeach.pmqelastClick(Sender: TObject);
begin
quickextract(lastextractionpath,'*neutral','all');
end;

procedure TFormPeach.pmqen1Click(Sender: TObject);
begin
extopt7z:=0;
updateconf_modified;
end;

procedure TFormPeach.pmqen2Click(Sender: TObject);
begin
extopt7z:=1;
updateconf_modified;
end;

procedure TFormPeach.pmqen3Click(Sender: TObject);
begin
extopt7z:=2;
updateconf_modified;
end;

procedure TFormPeach.pmqen4Click(Sender: TObject);
begin
extopt7z:=3;
updateconf_modified;
end;

procedure TFormPeach.pmqen5Click(Sender: TObject);
begin
extopt7z:=4;
updateconf_modified;
end;

procedure TFormPeach.pmqenewfolderClick(Sender: TObject);
begin
newextclick;
end;

procedure TFormPeach.pmqenopathClick(Sender: TObject);
begin
if extaction7z=1 then extaction7z:=0
else extaction7z:=1;
updateconf_modified;
end;

procedure TFormPeach.pmqesetpwClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TFormPeach.pmqetoClick(Sender: TObject);
begin
do_extallto('all');
end;

procedure TFormPeach.pmquickdeleteClick(Sender: TObject);
begin
if fun='FILEBROWSER' then deleteselected_frombrowser
else
   begin
   if pMessageWarningYesNo(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+FormPeach.EditOpenIn.Text)=6 then
      begin
      clearfile(FormPeach.EditOpenIn.Text);
      browsefiledir(extractfilepath(FormPeach.EditOpenIn.Text));
      end;
   end;
end;

procedure TFormPeach.po_copytoClick(Sender: TObject);
var
   s:ansistring;
begin
s:='';
clickcopyto(s);
end;

procedure TFormPeach.po_movetoClick(Sender: TObject);
var
   s:ansistring;
begin
s:='';
clickmoveto(s);
end;

procedure TFormPeach.po_mrtClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('mrt'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.po_msconfigClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('msconfig'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.po_msinfo32Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('msinfo32'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.po_open_asarchiveClick(Sender: TObject);
begin
do_openasarchive;
end;

procedure TFormPeach.po_open_asarchivetClick(Sender: TObject);
begin
do_openasarchive;
end;

procedure TFormPeach.po_open_associatedtClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
   openwith_base('preview','associated')
else menu_openwith('associated');
end;

procedure TFormPeach.po_open_peaziptClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
  openwith_base('preview','peazip')
else openwith_peazipnew(1,'');
end;

procedure TFormPeach.po_recycleClick(Sender: TObject);
begin
  recycleselected_list;
end;

procedure TFormPeach.po_regeditClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('regedit'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.po_renameClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TFormPeach.ButtonRenameClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TFormPeach.pmrenameClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TFormPeach.po_securedeleteClick(Sender: TObject);
begin
eraseselected_list(1);
end;

procedure TFormPeach.po_splitClick(Sender: TObject);
begin
do_split;
end;

procedure TFormPeach.po_testClick(Sender: TObject);
begin
filebrowser_funall('test');
end;

procedure TFormPeach.po_zerofileClick(Sender: TObject);
begin
eraseselected_list(2);
end;

procedure TFormPeach.po_zerofreeClick(Sender: TObject);
begin
sanitizedisk(2);
end;

procedure TFormPeach.cbDefaultFormatChange(Sender: TObject);
begin
on_RadioGroup0Change;
end;

procedure TFormPeach.cbExtEvForHowChange(Sender: TObject);
begin
on_cbExtEvForHowChange;
end;

procedure TFormPeach.cbExtEvForWhenChange(Sender: TObject);
begin
on_cbExtEvForWhenChange;
end;

procedure TFormPeach.cbforcetypeChange(Sender: TObject);
begin
on_cbforcetypeChange;
end;

procedure TFormPeach.cbHashFormatChange(Sender: TObject);
begin
on_RadioGroup1Click;
end;

procedure TFormPeach.cbBrowserHashChange(Sender: TObject);
begin
on_RadioGroup2Click;
end;

procedure TFormPeach.cbBinariesChange(Sender: TObject);
begin
on_RadioGroup4Change;
end;

procedure TFormPeach.cbBinariesStopChange(Sender: TObject);
begin
on_RadioGroup6Change;
end;

procedure TFormPeach.CheckBoxExtActionAdvChange(Sender: TObject);
begin
on_RadioGroupAction1Change;
end;

procedure TFormPeach.ComboBoxActionArcChange(Sender: TObject);
begin
on_RadioGroupActionArcChange;
end;

procedure TFormPeach.ComboBoxActionExtractChange(Sender: TObject);
begin
on_radiogroupactionchange;
end;

procedure TFormPeach.RadioGroupPaqClick(Sender: TObject);
begin
on_RadioGroupPaqClick;
end;

procedure TFormPeach.RadioGroupQuadClick(Sender: TObject);
begin
on_RadioGroupQuadClick;
end;

procedure TFormPeach.cbTimeStampChange(Sender: TObject);
begin
on_RadioGroupTSClick;
end;

procedure TFormPeach.SchedAddscheduleExtChange(Sender: TObject);
begin
DateEditExt1.Date:=Now;
PanelHDWExt.visible:=false;
PanelWeeklyExt.visible:=false;
PanelMonthlyExt.visible:=false;
lse3.Visible:=true;
schedulehhext.Visible:=true;
schedulemmext.Visible:=true;
scheduleNNext.value:=1;
BScheduleExt.Enabled:=true;
case SchedAddscheduleExt.itemindex of
   0: //hourly
   begin
   PanelHDWExt.visible:=true;
   LabelEveryUnitExt.Caption:=txt_5_1_hours;
   scheduleNNext.maxvalue:=24;
   end;
   1: //daily
   begin
   PanelHDWExt.visible:=true;
   LabelEveryUnitExt.Caption:=txt_5_1_days;
   scheduleNNext.maxvalue:=365;
   end;
   2: //weekly
   begin
   PanelHDWExt.visible:=true;
   PanelWeeklyExt.visible:=true;
   LabelEveryUnitExt.Caption:=txt_5_1_weeks;
   scheduleNNext.maxvalue:=52;
   checkwschedext;
   end;
   3: //monthly
   begin
   PanelMonthlyExt.visible:=true;
   checkmschedext;
   end;
   4: //once
   begin
   end;
   else //on start, on login
   begin
   lse3.Visible:=false;
   schedulehhext.Visible:=false;
   schedulemmext.Visible:=false;
   end;
   end;
end;

procedure TFormPeach.schedaddscheduleChange(Sender: TObject);
begin
//Dateedit1.Date:=Now;
panelHDW.visible:=false;
panelweekly.visible:=false;
panelmonthly.visible:=false;
lsa3.Visible:=true;
schedulehh.Visible:=true;
schedulemm.Visible:=true;
schedulenn.value:=1;
Bschedule.Enabled:=true;
case schedaddschedule.itemindex of
   0: //hourly
   begin
   panelHDW.visible:=true;
   LabelEveryUnit.Caption:=txt_5_1_hours;
   schedulenn.maxvalue:=24;
   end;
   1: //daily
   begin
   panelHDW.visible:=true;
   LabelEveryUnit.Caption:=txt_5_1_days;
   schedulenn.maxvalue:=365;
   end;
   2: //weekly
   begin
   panelHDW.visible:=true;
   panelweekly.visible:=true;
   LabelEveryUnit.Caption:=txt_5_1_weeks;
   schedulenn.maxvalue:=52;
   checkwsched;
   end;
   3: //monthly
   begin
   panelmonthly.visible:=true;
   checkmsched;
   end;
   4: //once
   begin
   end;
   else //on start, on login
   begin
   lsa3.Visible:=false;
   schedulehh.Visible:=false;
   schedulemm.Visible:=false;
   end;
   end;
end;

procedure TFormPeach.scheduleendextChange(Sender: TObject);
begin
DateEditExt2.Enabled:=scheduleendext.Checked;
end;

procedure TFormPeach.scheduleendChange(Sender: TObject);
begin
DateEdit2.Enabled:=scheduleend.Checked;
end;

procedure TFormPeach.schedulestartextChange(Sender: TObject);
begin
DateEditExt1.Enabled:=schedulestartext.Checked;
end;

procedure TFormPeach.schedulestartChange(Sender: TObject);
begin
DateEdit1.Enabled:=schedulestart.Checked;
end;

procedure TFormPeach.scheduleuserextChange(Sender: TObject);
begin
EditScheduleUserExt.Enabled:=scheduleuserext.Checked;
EditSchedulePasswordExt.Enabled:=scheduleuserext.Checked;
end;

procedure TFormPeach.scheduleuserChange(Sender: TObject);
begin
Editscheduleuser.Enabled:=scheduleuser.Checked;
Editschedulepassword.Enabled:=scheduleuser.Checked;
end;

procedure TFormPeach.ShellTreeViewNavCustomDraw(Sender: TCustomTreeView;
  const ARect: TRect; var DefaultDraw: Boolean);
begin
  imgshelltree;
end;

procedure TFormPeach.ShellTreeViewNavKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  fromtree:=true;
end;

procedure TFormPeach.ShellTreeViewNavMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  fromtree:=true;
end;

procedure TFormPeach.ShellTreeViewNavMouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
begin
  ShellTreeViewNav.ShowButtons:=true;
end;

procedure TFormPeach.ShellTreeViewNavMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
   s:ansistring;
begin
if fromtree=true then
   begin
   s:=ShellTreeViewNav.Path;
   if s='' then exit;
   fun:='FILEBROWSER';
   fun_status:=fun;
   FormPeach.EditUn7zaFilter.Text:='*';
   listdir(s,false,true);
   addtohistory;
   end;
end;

procedure TFormPeach.SpinEditOpacityChange(Sender: TObject);
begin
spinchanged:=true;
opacity:=SpinEditOpacity.Value;
setwindowsopacity;
end;

procedure TFormPeach.SplitterBottomMoved(Sender: TObject);
begin
splittersize:=PanelFilters.Height-SplitterBottom.top;
end;

procedure TFormPeach.SplitterSideMoved(Sender: TObject);
begin
splitter2size:=(SplitterSide.left*100) div qscale;
end;

procedure TFormPeach.SplitterOptionsMoved(Sender: TObject);
begin
splitter3size:=(SplitterOptions.left*100) div qscale;
end;

procedure TFormPeach.StringGridAddDblClick(Sender: TObject);
begin
if currow1=0 then
else open_associated;
end;

procedure TFormPeach.StringGridAddDrawCell(Sender: TObject; aCol, aRow: Integer;
  aRect: TRect; aState: TGridDrawState);
var
   rowcol:TColor;
begin
if (arow and 1)=0 then rowcol:=StringGridAdd.Color
else rowcol:=StringGridAdd.AlternateColor;
if (gdFixed in aState) then
   begin
   //if aCol=0 then StringGridAdd.Canvas.Draw(StringGridAdd.CellRect(0,arow).Left+2,StringGridAdd.CellRect(0,arow).Top+1,Brefresh_up);
   exit;
   end;
if aCol=0 then drawcellicon(StringGridAdd,arow);

{$IFDEF MSWINDOWS}
if aCol=9 then StringGridAdd.Canvas.Font.Color := rowcol;
if aCol=10 then StringGridAdd.Canvas.Font.Color := rowcol;
if aCol=11 then StringGridAdd.Canvas.Font.Color := rowcol;
{$ENDIF}
end;

procedure TFormPeach.StringGridAddHeaderClick(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
var
   Column:integer;
begin
if StringGridAdd.Rowcount<2 then exit;
Column:=Index;
   if (Column=0) then //force MenuItemRefresh of layout content (update number of files, folders and total size)
      begin
      updatelayout('');
      exit;
      end;
   if Column=1 then Column:=9;
   if Column=3 then Column:=10;
   if Column=13 then Column:=8;

   if Column=listsortcol1 then
      if StringGridAdd.SortOrder=soAscending then StringGridAdd.SortOrder:=soDescending
      else StringGridAdd.SortOrder:=soAscending
   else StringGridAdd.SortOrder:=soAscending;
   sort_az_stringgrid1(Column);

   listsortcol1:=Column;
   FormPeach.StringGridAdd.Repaint;
end;

procedure TFormPeach.StringGridAddHeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGridAdd.ColWidths[0]:=rowsize;
end;

procedure TFormPeach.StringGridAddKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
   i,j:integer;
begin
//patch for Ctrl+X behaviour
if (Key=ord(char(88))) and (shift=[ssCtrl]) then
   begin
   setlength(patchclip,FormPeach.StringGridAdd.RowCount-1);
   for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
      for j:=0 to StringGridAdd.ColCount-1 do patchclip[i-1,j]:=StringGridAdd.Cells[j,i];
   end;

//ensure Ctrl+V has enough rows to paste the content, since content could be pasted from clipboard it consider at excess 2048 rows
if (Key=ord(char(86))) and (shift=[ssCtrl]) then
   begin
   setlength(patchclip,FormPeach.StringGridAdd.RowCount-1);
   for i:=1 to FormPeach.StringGridAdd.RowCount-1 do
      for j:=0 to StringGridAdd.ColCount-1 do patchclip[i-1,j]:=StringGridAdd.Cells[j,i];
   FormPeach.StringGridAdd.RowCount:=2048;
   FormPeach.StringGridAdd.AutoSizeColumns;
   FormPeach.StringGridAdd.ColWidths[0]:=rowsize;
   FormPeach.StringGridAdd.ColWidths[1]:=COL1D;
   FormPeach.StringGridAdd.ColWidths[9]:=0;
   FormPeach.StringGridAdd.ColWidths[10]:=0;
   FormPeach.StringGridAdd.ColWidths[11]:=0;
   FormPeach.StringGridAdd.ColWidths[12]:=0;
   FormPeach.StringGridAdd.colwidths[13]:=0;
   FormPeach.StringGridAdd.colwidths[14]:=8;
   end;
end;

procedure TFormPeach.StringGridAddKeyPress(Sender: TObject; var Key: char);
var
   i:integer;
begin
//patch for Ctrl+X behaviour
if Key=char(24) then
   patch_stringgrid(StringGridAdd);

//patch Ctrl+V
if Key=char(22) then
   begin
   StringGridAdd.RowCount:=length(patchclip)+1;
   patch_stringgrid(StringGridAdd);
   end;

if Key=char(127) then removeselected;//ctrl+backspace

if Key=char(13) then open_associated;//enter

if key='?' then checkselected('check');//checksum/hash selected
if key='=' then compareselected;//compare selected

for i:=StringGridAdd.Row+1 to StringGridAdd.Rowcount-1 do
   if upcase(copy(StringGridAdd.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGridAdd.Row:=i;
      exit;
      end;
for i:=1 to StringGridAdd.Row do
   if upcase(copy(StringGridAdd.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGridAdd.Row:=i;
      exit;
      end;
end;

procedure TFormPeach.StringGridAddKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if Key=46 then //Cancel
   if shift=[] then removeselected;
end;

procedure TFormPeach.StringGridAddMouseDown(Sender: TOBject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  Column, Row,i: Integer;
begin
hide_panelhintadd;
if StringGridAdd.RowCount=1 then exit;
StringGridAdd.MouseToCell(X, Y, Column, Row);
currow1:=Row;
case Button of
   mbRight:
      begin
      FormPeach.StringGridAdd.Row:=Row;
      if FormPeach.StringGridAdd.Cells[11,Row]='0' then
         begin
         for i:=1 to FormPeach.StringGridAdd.Rowcount-1 do
            FormPeach.StringGridAdd.Cells[11,i]:='0';
         FormPeach.StringGridAdd.Cells[11,Row]:='1';
         FormPeach.StringGridAdd.Repaint;
         end;
      exit;
      end;
   end;
end;

procedure TFormPeach.StringGridAddMouseUp(Sender: TOBject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   i,Column,Row:integer;
begin
if StringGridAdd.Rowcount<2 then exit;
StringGridAdd.MouseToCell(X, Y, Column, Row);
if Row=0 then exit;
case Button of
   mbRight: exit; //moved to mousedown
   mbMiddle: exit;
   mbLeft:
      begin
         if Shift=[ssCtrl] then
            for i:=FormPeach.StringGridAdd.Selection.Top to FormPeach.StringGridAdd.Selection.Bottom do
               if FormPeach.StringGridAdd.Cells[11,i]='1' then FormPeach.StringGridAdd.Cells[11,i]:='0'
               else FormPeach.StringGridAdd.Cells[11,i]:='1'
         else
            begin
            for i:=1 to FormPeach.StringGridAdd.Rowcount-1 do
               FormPeach.StringGridAdd.Cells[11,i]:='0';
            for i:=FormPeach.StringGridAdd.Selection.Top to FormPeach.StringGridAdd.Selection.Bottom do
               FormPeach.StringGridAdd.Cells[11,i]:='1';
            end;
         FormPeach.StringGridAdd.Repaint;
      end;
   end;
end;

procedure TFormPeach.StringGridExtractDblClick(Sender: TObject);
begin
if currow1=0 then
else
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then open_associated;
end;

procedure TFormPeach.StringGridExtractDrawCell(Sender: TObject; aCol, aRow: Integer;
  aRect: TRect; aState: TGridDrawState);
var
   rowcol:TColor;
begin
if (arow and 1)=0 then rowcol:=StringGridExtract.Color
else rowcol:=StringGridExtract.AlternateColor;
if (gdFixed in aState) then
   begin
   //if aCol=0 then StringGridExtract.Canvas.Draw(StringGridExtract.CellRect(0,arow).Left+2,StringGridExtract.CellRect(0,arow).Top+1,Brefresh_up);
   exit;
   end;
if aCol=0 then drawcellicon(StringGridExtract,arow);
{$IFDEF MSWINDOWS}
if aCol=9 then StringGridExtract.Canvas.Font.Color := rowcol;
if aCol=10 then StringGridExtract.Canvas.Font.Color := rowcol;
if aCol=11 then StringGridExtract.Canvas.Font.Color := rowcol;
{$ENDIF}
end;

procedure TFormPeach.StringGridExtractHeaderClick(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
var
   Column:integer;
begin
if StringGridExtract.Rowcount<2 then exit;
Column:=Index;
if (Column=0) then //force MenuItemRefresh of layout content (update number of files, folders and total size)
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then
      begin
      updatelayout('');
      exit;
      end
   else exit;
if Column=1 then Column:=9;
if Column=3 then Column:=10;
if Column=13 then Column:=8;

if Column=listsortcol2 then
   if StringGridExtract.SortOrder=soAscending then StringGridExtract.SortOrder:=soDescending
   else StringGridExtract.SortOrder:=soAscending
else StringGridExtract.SortOrder:=soAscending;
sort_az_stringgrid2(Column);

listsortcol2:=Column;
FormPeach.StringGridExtract.Repaint;
end;

procedure TFormPeach.StringGridExtractHeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGridExtract.ColWidths[0]:=rowsize;
end;

procedure TFormPeach.StringGridExtractKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
   i,j:integer;
begin
//patch for Ctrl+X behaviour
if (Key=ord(char(88))) and (shift=[ssCtrl]) then
   begin
   setlength(patchclip,FormPeach.StringGridExtract.RowCount-1);
   for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
      for j:=0 to StringGridExtract.ColCount-1 do patchclip[i-1,j]:=StringGridExtract.Cells[j,i];
   end;

//ensure Ctrl+V has enough rows to paste the content, since content could be pasted from clipboard it consider at excess 2048 rows
if (Key=ord(char(86))) and (shift=[ssCtrl]) then
   begin
   setlength(patchclip,FormPeach.StringGridExtract.RowCount-1);
   for i:=1 to FormPeach.StringGridExtract.RowCount-1 do
      for j:=0 to StringGridExtract.ColCount-1 do patchclip[i-1,j]:=StringGridExtract.Cells[j,i];
   FormPeach.StringGridExtract.RowCount:=2048;
   autosize_stringgrid2;
   end;

end;

procedure TFormPeach.StringGridExtractKeyPress(Sender: TObject; var Key: char);
var
   i:integer;
begin
//patch for Ctrl+X behaviour
if Key=char(24) then
   patch_stringgrid(StringGridExtract);

//patch Ctrl+V
if Key=char(22) then
   begin
   StringGridExtract.RowCount:=length(patchclip)+1;
   patch_stringgrid(StringGridExtract);
   end;

if Key=char(127) then
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then removeselected_ext;//ctrl+backspace

if Key=char(13) then
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then open_associated;//enter

if key='?' then
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then checkselected('check');//checksum/hash selected
if key='=' then
   if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then compareselected;//compare selected

for i:=StringGridExtract.Row+1 to StringGridExtract.Rowcount-1 do
   if upcase(copy(StringGridExtract.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGridExtract.Row:=i;
      exit;
      end;
for i:=1 to StringGridExtract.Row do
   if upcase(copy(StringGridExtract.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGridExtract.Row:=i;
      exit;
      end;
end;

procedure TFormPeach.StringGridExtractKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if Key=46 then //Cancel
   if shift=[] then
      if FormPeach.LabelStatusExtract.Caption= txt_2_7_ext then removeselected_ext;
end;

procedure TFormPeach.StringGridExtractMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  Column, Row,i: Integer;
begin
hide_panelhintextract;
if StringGridExtract.RowCount=1 then exit;
StringGridExtract.MouseToCell(X, Y, Column, Row);
currow1:=Row;
case Button of
   mbRight:
      begin
      FormPeach.StringGridExtract.Row:=Row;
      if FormPeach.StringGridExtract.Cells[11,Row]='0' then
         begin
         for i:=1 to FormPeach.StringGridExtract.Rowcount-1 do
            FormPeach.StringGridExtract.Cells[11,i]:='0';
         FormPeach.StringGridExtract.Cells[11,Row]:='1';
         FormPeach.StringGridExtract.Repaint;
         end;
      exit;
      end;
   end;
end;

procedure TFormPeach.StringGridExtractMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   i,Column,Row:integer;
begin
if StringGridExtract.Rowcount<2 then exit;
StringGridExtract.MouseToCell(X, Y, Column, Row);
if Row=0 then exit;
case Button of
   mbRight: exit; //moved to mousedown
   mbMiddle: exit;
   mbLeft:
      begin

         if Shift=[ssCtrl] then
            for i:=FormPeach.StringGridExtract.Selection.Top to FormPeach.StringGridExtract.Selection.Bottom do
               if FormPeach.StringGridExtract.Cells[11,i]='1' then FormPeach.StringGridExtract.Cells[11,i]:='0'
               else FormPeach.StringGridExtract.Cells[11,i]:='1'
         else
            begin
            for i:=1 to FormPeach.StringGridExtract.Rowcount-1 do
               FormPeach.StringGridExtract.Cells[11,i]:='0';
            for i:=FormPeach.StringGridExtract.Selection.Top to FormPeach.StringGridExtract.Selection.Bottom do
               FormPeach.StringGridExtract.Cells[11,i]:='1';
            end;
         FormPeach.StringGridExtract.Repaint;

      end;
   end;
end;

procedure TFormPeach.StringGridBookmarksColRowMoved(Sender: TObject;
  IsColumn: Boolean; sIndex, tIndex: Integer);
begin
populatebookmarks;
end;

procedure TFormPeach.StringGridBookmarksDblClick(Sender: TObject);
begin
if StringGridBookmarks.Rowcount<2 then exit;
browsebookmark(StringGridBookmarks.Row);
end;

procedure TFormPeach.StringGridBookmarksDrawCell(Sender: TObject; aCol,
  aRow: Integer; aRect: TRect; aState: TGridDrawState);
begin
if arow=0 then exit;
if acol=0 then drawbarcellicon(StringGridBookmarks,aRow);
end;

procedure TFormPeach.StringGridBookmarksHeaderClick(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
var
   i,Column:integer;
begin
if StringGridBookmarks.RowCount<2 then exit;
Column:=Index;
if Column=0 then exit;
if Column>9 then exit;
if iscolumn=false then exit;
{if Column=listsortbook then
   if StringGridBookmarks.SortOrder=soAscending then begin if pMessageInfoYesNo(txt_3_7_sort+' > '+FormPeach.StringGridBookmarks.Cells[Column,0])<>6 then exit; end
   else begin if pMessageInfoYesNo(txt_3_7_sort+' < '+FormPeach.StringGridBookmarks.Cells[Column,0])<>6 then exit; end
else begin if pMessageInfoYesNo(txt_3_7_sort+' < '+FormPeach.StringGridBookmarks.Cells[Column,0])<>6 then exit; end;}

if Column=listsortbook then
   if StringGridBookmarks.SortOrder=soAscending then StringGridBookmarks.SortOrder:=soDescending
   else StringGridBookmarks.SortOrder:=soAscending
else StringGridBookmarks.SortOrder:=soAscending;
sort_az_stringgridbookmarks(Column);

for i:=1 to StringGridBookmarks.RowCount-1 do
   begin
   StringGridBookmarks.Cells[11,i]:='0';
   end;
StringGridBookmarks.Cells[11,1]:='1';
StringGridBookmarks.Row:=1;
StringGridBookmarks.Repaint;
listsortbook:=Column;
populatebookmarks;
end;

procedure TFormPeach.StringGridBookmarksHeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGridBookmarks.ColWidths[0]:=rowsize;
if index=10 then StringGridBookmarks.ColWidths[10]:=0;
if index=11 then StringGridBookmarks.ColWidths[11]:=0;
end;

procedure TFormPeach.StringGridBookmarksKeyPress(Sender: TObject; var Key: char
  );
var
   i:integer;
begin
if StringGridBookmarks.Rowcount<2 then exit;
//search char
for i:=StringGridBookmarks.Row+1 to StringGridBookmarks.Rowcount-1 do
   if upcase(copy(StringGridBookmarks.Cells[2,i],1,1))=upcase(Key) then
      begin
      StringGridBookmarks.Row:=i;
      exit;
      end;
for i:=1 to StringGridBookmarks.Row do
   if upcase(copy(StringGridBookmarks.Cells[2,i],1,1))=upcase(Key) then
      begin
      StringGridBookmarks.Row:=i;
      exit;
      end;
end;

procedure TFormPeach.StringGridBookmarksMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
   Column, Row,i: Integer;
begin
if StringGridBookmarks.Rowcount<2 then exit;
StringGridBookmarks.MouseToCell(X, Y, Column, Row);
StringGridBookmarks.Row:=Row;
if StringGridBookmarks.Cells[11,Row]='0' then
   begin
   for i:=1 to StringGridBookmarks.Rowcount-1 do
      StringGridBookmarks.Cells[11,i]:='0';
   StringGridBookmarks.Cells[11,Row]:='1';
   StringGridBookmarks.Repaint;
   end;
end;

procedure TFormPeach.StringGridClipboardDblClick(Sender: TObject);
begin
if StringGridClipboard.Row>0 then cp_open(StringGridClipboard.Cells[3,StringGridClipboard.Row],desk_env);
end;

procedure TFormPeach.StringGridClipboardKeyPress(Sender: TObject; var Key: char
  );
begin
   if Key=char(27) then //Esc to cancel copy/move operations clearing selection and cupy/cut clipboard; cancel also drag operations performed on the same keyboard event, if panelopen is visible, by TimerSync
      begin
      clear_clipboard;
      end;
end;

procedure TFormPeach.StringGridCustEditAdvColRowMoved(Sender: TObject;
  IsColumn: Boolean; sIndex, tIndex: Integer);
var
   i:integer;
begin
for i:=1 to 8 do StringGridCustEditAdv.Cells[0,i]:=inttostr(i);
end;

procedure TFormPeach.StringGridCustEditAdvDblClick(Sender: TObject);
begin
case StringGridCustEditAdv.Col of
   1: setdescription_advcustedit;
   2: editstring1_advcustedit;
   3: editstring2_advcustedit;
   4: editstring3_advcustedit;
   end;
end;

procedure TFormPeach.StringGridCustEditAdvMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
   Column,Row:integer;
begin
StringGridCustEditAdv.MouseToCell(X, Y, Column, Row);
StringGridCustEditAdv.Row:=Row;
set_adveditcl(Row);
end;

procedure TFormPeach.StringGridCustEditAdvSelectCell(Sender: TObject; aCol,
  aRow: Integer; var CanSelect: Boolean);
begin
set_adveditcl(aRow);
end;

procedure TFormPeach.StringGridCustEditColRowMoved(Sender: TObject;
  IsColumn: Boolean; sIndex, tIndex: Integer);
var
   i:integer;
begin
for i:=1 to 16 do StringGridCustedit.Cells[0,i]:=inttostr(i);
end;

procedure TFormPeach.StringGridCustEditDblClick(Sender: TObject);
begin
case StringGridCustedit.Col of
   1: setdescription_custedit;
   2: editapp_custedit;
   end;
end;

procedure TFormPeach.StringGridCustEditMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
   Column,Row:integer;
begin
StringGridCustedit.MouseToCell(X, Y, Column, Row);
StringGridCustedit.Row:=Row;
end;

procedure TFormPeach.StringGridSessionHistoryDrawCell(Sender: TObject; aCol,
  aRow: Integer; aRect: TRect; aState: TGridDrawState);
begin
if arow=0 then exit;
if acol=0 then drawbarcellicon(StringGridSessionHistory,aRow);
end;

procedure TFormPeach.StringGridSessionHistoryHeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGridSessionHistory.ColWidths[0]:=rowsize;
end;

procedure TFormPeach.StringGridRecentDblClick(Sender: TObject);
begin
if StringGridRecent.RowCount<2 then exit;
if StringGridRecent.Cells[0,StringGridRecent.Row]='' then opendir(StringGridRecent.Cells[1,StringGridRecent.Row])
else open_archive_fromname(StringGridRecent.Cells[1,StringGridRecent.Row]);
end;

procedure TFormPeach.StringGridRecentDrawCell(Sender: TObject; aCol,
  aRow: Integer; aRect: TRect; aState: TGridDrawState);
begin
if arow=0 then exit;
if acol=0 then drawbarcellicon(StringGridRecent,aRow);
end;

procedure TFormPeach.StringGridRecentHeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGridRecent.ColWidths[0]:=rowsize;
if index=2 then StringGridRecent.ColWidths[2]:=0;
if index=3 then StringGridRecent.ColWidths[3]:=0;
if index=4 then StringGridRecent.ColWidths[4]:=0;
end;

procedure TFormPeach.tbcontrastChange(Sender: TObject);
begin
if openstarted=true then
   begin
   contrast:=4+tbcontrast.Position;
   apply_theme;
   end;
end;

procedure TFormPeach.po_tabsopenClick(Sender: TObject);
begin
if FormPeach.StringGridList.RowCount<2 then exit;
if FormPeach.StringGridList.Cells[1,1]='' then exit;
settabbar(1);
ptabbar:=1;
ptabid:=atabid;
addptab;
sortplustab;
if checklistanysel<>0 then exit;
{$IFDEF MSWINDOWS}
if FormPeach.EditOpenIn.Text=txt_mypc then begin grid_dir_open; exit; end;
{$ENDIF}
if StringGridList.Cells[2,StringGridList.Row]=txt_list_isfolder then grid_dir_open
else
   if fun='FILEBROWSER' then do_openasarchive;
end;

procedure TFormPeach.po_verClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k ver';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_whoamiClick(Sender: TObject);
var
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /k whoami';
execute_cl_process(cl);
{$ENDIF}
end;

procedure TFormPeach.po_windowopenClick(Sender: TObject);
begin
if fun='FILEBROWSER' then
   begin
   if po_open.Visible=true then openwith_peazipnew(1,'')
   else openwith_base('preview','peazip');
   end
else newwin(EditOpenIn.caption);
end;

procedure TFormPeach.po_xfcesmClick(Sender: TObject);
begin
linlaunch('xfce4-settings-manager');
end;

procedure TFormPeach.cbHashChange(Sender: TObject);
begin
on_cbcheckallClick;
end;

procedure TFormPeach.seRARrrChange(Sender: TObject);
begin
puserarrr:=seRARrr.Value;
end;

procedure TFormPeach.ShellTreeViewNavMouseEnter(Sender: TObject);
begin
bctemp:=0;
end;

procedure TFormPeach.SpinEditSplitChange(Sender: TObject);
begin
spansize:=SpinEditSplit.Value;
end;

procedure TFormPeach.splitsearchMoved(Sender: TObject);
begin
splitsearchsize:=splitsearch.left;
end;

procedure TFormPeach.StringGridSessionHistoryDblClick(Sender: TObject);
begin
if StringGridSessionHistory.RowCount<2 then exit;
browsehistoryn(StringGridSessionHistory.RowCount-StringGridSessionHistory.Row);
end;

procedure TFormPeach.ListViewBrowserDblClick(Sender: TObject);
begin
wasselected:=-1;
ListViewBrowser.begindrag(false);
dragcancelled:=true;
if set_grid=false then exit;
//singleextract:=false;
listrow:=StringgridList.Row;
grid_obj_open;
end;

procedure TFormPeach.ListViewBrowserDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
wasselected:=-1;
Accept:=true;
end;

procedure TFormPeach.ListViewBrowserKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
   i,j,k:integer;
   sref:ansistring;
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then exit;
if Key=13 then
 if shift=[ssAlt] then //shift+alt properties
 begin
 browser_fileproperties('');
 end
 else
   if shift=[ssShift] then //shift+enter extract selected to new folder
      begin
      {$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
      CheckBoxFolder.State:=cbChecked;
      if fun='FILEBROWSER' then list_toextractor('multi','full')
      else list_toextractor('selected','full');
      end
   else
      if shift=[ssCtrl] then //ctrl+enter extract selected
         begin
         {$IFDEF MSWINDOWS}if FormPeach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
         CheckBoxFolder.State:=cbUnChecked;
         if fun='FILEBROWSER' then list_toextractor('multi','full')
         else list_toextractor('selected','full');
         end
      else
         begin
         {open the first dir/archive (if encountered) in PeaZip's GUI, since dir/archive is opened in program GUI (which can open only one of them at time)
         on other dir/archives, ignore them
         do grid_obj_open on selected objects of all other types}
         k:=0;
         sref:=FormPeach.EditOpenIn.Text;
         for i:=1 to FormPeach.StringGridList.RowCount-1 do
            begin
            if FormPeach.EditOpenIn.Text<>sref then begin k:=0; break; end;
            if FormPeach.StringGridList.Cells[16,i]='1' then
               begin
               if StringGridList.Cells[2,i]=txt_list_isfolder then
                  begin
                  if k=0 then k:=i;
                  end
               else
                  begin
                  j:=testext(StringGridList.Cells[12,i]);
                  if (j<0) //not a PeaZip supported filetype
                     or (j=503)
                     or (j=502)
                     or (j=501) //file types usually not handled as archives
                     or (j=500) //exe or msi Windows executable file
                     then
                        begin
                        FormPeach.StringGridList.Row:=i;
                        grid_obj_open;
                        end
                     else
                        begin
                        if k=0 then k:=i;
                        end;
                  end;
               end;
            end;
         if k>0 then
            begin
            FormPeach.StringGridList.Row:=k;
            grid_obj_open;
            end;
         end;
end;

procedure TFormPeach.ListViewBrowserKeyPress(Sender: TObject; var Key: char);
var
   i:integer;
   tsubfun:AnsiString;
begin

//Ctrl+X
if Key=char(24) then if checklistanysel=0 then list_cut;

//Ctrl+C
if Key=char(3) then if checklistanysel=0 then list_copy;

//Ctrl+V
if Key=char(22) then
   begin
   if fun='FILEBROWSER' then
      begin
      {$IFDEF MSWINDOWS}
      if FormPeach.EditOpenIn.Text=txt_mypc then exit;
      {$ENDIF}
      tsubfun:=subfun;
      subfun:='extract';
      list_paste;
      subfun:=tsubfun;
      end
   else //paste in archive
      if (fun='UNARC') or (fun='UN7Z') or (fun='UNZPAQ') then
         if FormPeach.StringGridList.Cells[1,1]<>'' then
            if length(clipcontent)>0 then
               begin
               addtoarchive_inarchive(true);
               FormPeach.StringGridAdd.Cursor:=crHourGlass;
               deselectingrid(FormPeach.StringGridAdd);
               for i:=0 to length(clipcontent)-1 do
                  begin
                  if clipcontent[i,3]<>txt_caption_extract then
                     if clipcontent[i,2]=txt_list_isfolder then addfolderstr(FormPeach.StringGridAdd,clipcontent[i,0])
                     else addfilestr(FormPeach.StringGridAdd,clipcontent[i,0]);
                  end;
               FormPeach.StringGridAdd.AutoSizeColumns;
               updatecontent(FormPeach.StringGridAdd,tvolumes,tdirs,tfiles,tsize,true);
               FormPeach.StringGridAdd.Cursor:=crDefault;
               end
            else open_archive_fromname(EditOpenIn.Text)
         else open_archive_fromname(EditOpenIn.Text)
      else open_archive_fromname(EditOpenIn.Text);
   end;

//filter functional standard keys

if Key=char(27) then //Esc to cancel copy/move operations clearing selection and cupy/cut clipboard; cancel also drag operations performed on the same keyboard event, if panelopen is visible, by TimerSync
      begin
      clear_clipboard;
      dragcancelled:=true;
      fthumbs:=false;
      end;

if (fun='UN7Z') or (fun='FILEBROWSER') then
   begin
   if Key=char('<') then if checklistsel=0 then grid_dir_open;
   if Key=char('*') then toggle_view;
   end;

   if Key=char('>') then navgoup;

if fun='FILEBROWSER' then
   begin
   if key='?' then //checksum/hash //in some cases it seems triggered also by ctrl+alt+E
   if checklistanysel=0 then
      begin
      if StringGridList.RowCount<2 then exit;
      if StringGridList.Cells[1,1]='' then exit;
      checkselected_list('check');
      end;
   if key='=' then //compare
   if checklistsel=0 then
      begin
      if StringGridList.RowCount<2 then exit;
      if StringGridList.Cells[1,1]='' then exit;
      compareselected_list;
      end;
   end;

//search char
for i:=StringGridList.Row+1 to StringGridList.Rowcount-1 do
   if upcase(copy(StringGridList.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGridList.Row:=i;
      if ListViewBrowser.OwnerData=true then
         begin
         ListViewBrowser.Items[i-1].Selected:=true;
         try
         ListViewBrowser.Items[i-1].Focused:=true;
         ListViewBrowser.ItemIndex:=i-1;
         ListViewBrowser.items[i-1].MakeVisible(true);
         except end;
         end;
      exit;
      end;
for i:=1 to StringGridList.Row do
   if upcase(copy(StringGridList.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGridList.Row:=i;
      if ListViewBrowser.OwnerData=true then
         begin
         ListViewBrowser.Items[i-1].Selected:=true;
         try
         ListViewBrowser.Items[i-1].Focused:=true;
         ListViewBrowser.ItemIndex:=i-1;
         ListViewBrowser.items[i-1].MakeVisible(true);
         except end;
         end;
      exit;
      end;
end;

procedure TFormPeach.ListViewBrowserKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
   i:integer;
begin
{ possible implementation for rename in place, clears busy status if edit operation is aborted with Esc key
if Key=char(27) then
   if ListViewBrowser.ReadOnly=false then
      begin
      ListViewBrowser.ReadOnly:=false;
      exit_busy_status;
      end;
}
update_selstatus;
wasselected:=-1;
if FormPeach.ListViewBrowser.Selected<>nil then
   begin
   i:=FormPeach.ListViewBrowser.Selected.Index;
   FormPeach.StringGridList.Row:=i+1;
   end;
if checklistanysel<>0 then exit;
if Key=46 then //Cancel
   begin
   if shift=[ssCtrl] then
      if fun='FILEBROWSER' then eraseselected_list(1);
   if shift=[ssShift] then
      deleteselected_frombrowser;
   if shift=[ssAlt] then
      if fun='FILEBROWSER' then eraseselected_list(2);
   if shift=[] then
      if fun='FILEBROWSER' then
         {$IFDEF MSWINDOWS}
         recycleselected_list
         {$ELSE}
         {$IFDEF DARWIN} //command+backspace is available as shortcut to recycle context menu item
         recycleselected_list
         {$Else}
         deleteselected_frombrowser
         {$ENDIF}
         {$ENDIF}
      else deleteselected_frombrowser;
   end;
LabelExtHere.visible:=checkextinput_noduplicatecheck;
end;

procedure TFormPeach.ListViewBrowserMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
{$IFDEF MSWINDOWS}
var
i,j: integer;
sarr: array of ansistring;
vpath:ansistring;
MyThreaddrop: TMyThreaddrop;
{$ENDIF}
begin
intdd:=true;
if FormPeach.ListViewBrowser.ItemIndex=-1 then wasselected:=-1;
case button of
   mbMiddle: case mbaction of
             0: navgoup;
             1: navgoback;
             2: rename_files('rename');
             3: po_tabsopenClick(nil);
             4: po_windowopenClick(nil);
             end;
   mbExtra1: navgoback;
   mbExtra2: navgofwd;
   end;
altmenu:=0;
if Shift=[ssRight,ssCtrl] then altmenu:=1
else
   if Shift=[ssRight,ssShift] then altmenu:=2
   else
      if Shift=[ssRight,ssCtrl,ssShift] then altmenu:=3
         else
         if Shift=[ssRight,ssCtrl,ssAlt] then altmenu:=4
            else
            if Shift=[ssRight,ssShift,ssAlt] then altmenu:=5;
if set_grid=false then exit;
{$IFDEF MSWINDOWS}
rightdropbutton:=false;
if nativedrag=1 then //native drag and drop
begin
if fun='FILEBROWSER' then
   begin
   setlength(sarr,0);
   j:=0;
   for i:=1 to FormPeach.StringGridList.RowCount-1 do
      if FormPeach.StringGridList.Cells[16,i]='1' then
         begin
         setlength(sarr,length(sarr)+1);
         sarr[j]:=FormPeach.StringGridList.Cells[12,i];
         j:=j+1;
         end;
   disdrag:=true;
   ForceDirectories(peaziptmpdir);
   fileclose(FileCreate(peaziptmpdir+'.pdd'));
   dodropfiles(ListViewBrowser, sarr, 2);
   DeleteFile(peaziptmpdir+'.pdd');
   end
else
   begin
   if pclicked=true then begin pclicked:=false; exit; end;
   //in separate thread wait for ondrop event from dll running in main thread, then extract, finally let the dll complete the drag and drop
   MyThreaddrop:=TMyThreaddrop.Create(True);
   if Assigned(MyThreaddrop.FatalException) then
      begin
      raise MyThreaddrop.FatalException;
      exit;
      end;
   vpathname:=STR_TMPDD+inttohex(random(16000000),6);
   vpath:=peaziptmpdir+vpathname+DirectorySeparator;
   vpath2:='';
   ForceDirectories(vpath);
   CreateDir(vpath+'virtual\');
   CreateDir(vpath+'source\');
   MyThreaddrop.vpath:=vpath;
   MyThreaddrop.Resume;
   disdrag:=true;
   dodropvfiles(FormPeach.ListViewBrowser, vpath, 2);
   //MyThreaddrop.Terminate;
   vpatha:=vpath;
   vpathb:=vpath2;
   if imdel=true then cleandragtmp;
   threadextracting:=false;
   if FormPeach.Enabled=false then FormPeach.Enabled:=true;
   //if FormPeach.Visible=false then FormPeach.Visible:=true;
   end;
//if dd fails this section is immediately reached, do not run if mouse button is still pressed
if GetSystemMetrics(SM_SWAPBUTTON)=0 then
   if GetAsyncKeyState(VK_LBUTTON)=1 then intdd_do(Button)
else
   if GetAsyncKeyState(VK_RBUTTON)=1 then intdd_do(Button);
intdd:=false;
end
else //custom drag and drop
   begin
   case button of
   mbleft:
      begin
      popupclosed:=false;
      if FormPeach.EditOpenIn.Caption<>txt_mypc then
         try
         if ListViewBrowser.GetItemAt(x,y)<>nil then
            if ListViewBrowser.GetItemAt(x,y).Caption<>'' then
               begin
               ListViewBrowser.begindrag(false);
               dragcancelled:=false;
               end;
         except
         end;
      end;
   mbright:
      begin
      popupclosed:=true; //custom right drag event temporarily disabled: it needs popup event to take place in advance, which do not longer happens in Lazarus 2.2.0
      if popupclosed=true then begin popupclosed:=false; exit; end;
      if FormPeach.EditOpenIn.Caption<>txt_mypc then
         try
         if ListViewBrowser.GetItemAt(x,y)<>nil then
            if ListViewBrowser.GetItemAt(x,y).Caption<>'' then
               begin
               ListViewBrowser.begindrag(false);
               dragcancelled:=false;
               rightdropbutton:=true;
               end;
         except
         end;
      end;
   end;
   end;
{$ENDIF}
end;

procedure TFormPeach.ListViewBrowserMouseEnter(Sender: TObject);
begin
ShellTreeViewNav.ShowButtons:=false;
TreeViewNav.ShowButtons:=false;
end;

procedure TFormPeach.ListViewBrowserMouseLeave(Sender: TObject);
begin
wasselected:=-1;
wasselectedp:=-1;
if checkboxshowhints.Checked=false then exit;
try
   shint:='';
   prevshint:='';
   h.hide;
except
end;
end;

procedure TFormPeach.ListViewBrowserMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
   p:TPoint;
   i:integer;
   s:ansistring;
begin
if shift=[ssLeft] then wasselected:=-1;
pclicked:=false;
{$IFDEF MSWINDOWS}
if nativedrag=1 then
   disdrag:=false;
{$ENDIF}
if openstarted=false then exit;
if checkboxshowhints.Checked=false then exit;

if ListViewBrowser.ViewStyle=vsReport then
   if x>=col1size then
      begin
      shint:='';
      prevshint:='';
      try
      h.hide;
      except
      end;
      exit;
      end;

s:='';
try
if ListViewBrowser.GetItemAt(x,y)<>nil then i:=ListViewBrowser.GetItemAt(x,y).Index else
   begin
   shint:=s;
   exit;
   end;
if i>-1 then
  begin
  if ListViewBrowser.Items[i].Caption<>'' then
     begin
     s:=ListViewBrowser.Items[i].Caption;
     if ListViewBrowser.Items[i].SubItems[0]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[1].Caption+' - '+ListViewBrowser.Items[i].SubItems[0];
     if ListViewBrowser.Items[i].SubItems[0]=txt_list_isfolder then
        begin
        if ListViewBrowser.Items[i].SubItems[9]<>'' then s:=s+char($0D)+char($0A)+txt_content+' - '+ListViewBrowser.Items[i].SubItems[9];
        end
     else
        begin
        if ListViewBrowser.Items[i].SubItems[1]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[2].Caption+' - '+ListViewBrowser.Items[i].SubItems[1];
        if ListViewBrowser.Items[i].SubItems[2]<>'' then
           case ListViewBrowser.Items[i].SubItems[2] of
           '.': s:=s+char($0D)+char($0A)+ListViewBrowser.Column[3].Caption+' - '+txt_6_2_container;
           '+': s:=s+char($0D)+char($0A)+ListViewBrowser.Column[3].Caption+' - '+txt_6_2_archive;
           else
              s:=s+char($0D)+char($0A)+ListViewBrowser.Column[3].Caption+' - '+ListViewBrowser.Items[i].SubItems[2];
           end;
        if ListViewBrowser.Items[i].SubItems[9]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[10].Caption+' - '+ListViewBrowser.Items[i].SubItems[9];
        end;
     if ListViewBrowser.Items[i].SubItems[6]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[7].Caption+' - '+ListViewBrowser.Items[i].SubItems[6];
     if ListViewBrowser.Items[i].SubItems[8]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[9].Caption+' - '+ListViewBrowser.Items[i].SubItems[8];
     if ListViewBrowser.Items[i].SubItems[3]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[4].Caption+' - '+ListViewBrowser.Items[i].SubItems[3];
     if ListViewBrowser.Items[i].SubItems[4]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[5].Caption+' - '+ListViewBrowser.Items[i].SubItems[4];
     if ListViewBrowser.Items[i].SubItems[5]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[6].Caption+' - '+ListViewBrowser.Items[i].SubItems[5];
     if ListViewBrowser.Items[i].SubItems[7]<>'' then s:=s+char($0D)+char($0A)+ListViewBrowser.Column[8].Caption+' - '+ListViewBrowser.Items[i].SubItems[7];
     if status0<>txt_list_browsing then
        if ListViewBrowser.Items[i].SubItems[10]<>'' then
           if extractfilepath(ListViewBrowser.Items[i].SubItems[10])<>'' then s:=s+char($0D)+char($0A)+txt_path+' - '+extractfilepath(ListViewBrowser.Items[i].SubItems[10]);
     end;
  end
else
   begin
   shint:=s;
   exit;
   end;
except
shint:=s;
exit;
end;
if s='' then
   begin
   shint:=s;
   exit;
   end;
if s<>shint then
try
   h.hide;
except
end;
p.x:=x;
p.y:=y;
p.x:=p.x+ListViewBrowser.left;//SplitterSide.left;
p.y:=p.y+panelfilters.top+19;
p:=clienttoscreen(p);
r.Left := p.x; //or the absolute left position of the control
r.Top := p.y; //or the absolute top position of the control
r.right:=r.left+h.CalcHintRect(320,s,nil).right;
r.bottom:=r.top+h.CalcHintRect(320,s,nil).bottom;
shint:=s;
end;

procedure TFormPeach.ListViewBrowserSelectItem(Sender: TObject; Item: TListItem;//on macOS (Laz 4.2) seems the listview selectitem event is not triggered if ownerdata is changed from true to flase at runtime (leaving virtual mode); runs ok on other widgetset
  Selected: Boolean);
var
   i,rc:integer;
begin //(Lazarus 4.x) the event is always triggered on macOS after content update; on some other widgetsets it is triggered if prebrowsing is enabled
if updatinglistview=true then exit;
if browserbusy=true then exit;
if updatingsel=true then exit;
updatingsel:=true;
{$IFDEF MSWINDOWS} //select item is raised to uncheck each selected object and check each new one, so for an iteration it is enough to ScheduleAdd one change of state in the underlying stringgrid
if ListViewBrowser.OwnerData=false then
   begin//good speed, does not work with listview in virtual mode
   i:=Item.index+1;
   if ListViewBrowser.Items[i-1].Selected<>true then StringGridList.Cells[16,i]:='0' else StringGridList.Cells[16,i]:='1';
   end
else
   begin//little slow, tested on Laz 4.2, event is repeated for each selected item incrementing each time the selected items count
   StringGridList.BeginUpdate;
   rc:=StringGridList.Rowcount;
   for i:=1 to rc-1 do
      if ListViewBrowser.Items[i-1].Selected<>true then
         StringGridList.Cells[16,i]:='0'
      else
         StringGridList.Cells[16,i]:='1';
   StringGridList.EndUpdate;
   end;
{$ELSE} //method based on selected item doesn't work on Qt, nor for virtual mode on some widgetsets, making necessary to update the entire grid
{$IFDEF LCLQT6}//very slow on Qt6, tested on Laz 4.2, event is repeated for each selected item for the same total of selected items count; following workaround stops after few cycles (new selection changes the selected items count)
curselcount:=FormPeach.ListViewBrowser.SelCount;
if curselcount>8 then
   if curselcount=prevselcount then
      begin
      wasselected:=-1;
      updatingsel:=false;
      exit;
      end;
{$ENDIF}
StringGridList.BeginUpdate;//acceptable speed on GTK2, tested on Laz 4.2, event is repeated for each selected item for the same total of selected items count
rc:=StringGridList.Rowcount;
for i:=1 to rc-1 do
   if ListViewBrowser.Items[i-1].Selected<>true then
      StringGridList.Cells[16,i]:='0'
   else
      StringGridList.Cells[16,i]:='1';
StringGridList.EndUpdate;
{$IFDEF LCLQT6}
prevselcount:=curselcount;
{$ENDIF}
{$ENDIF}
//set_grid; //Lazarus 0.9.30: no longer needed, selection is always updated before action is launched
//update_selstatus; //now associated to onmouseup and onkeyup
if FormPeach.ListViewBrowser.SelCount>1 then wasselected:=-1;
updatingsel:=false;
end;

procedure TFormPeach.ListViewBrowserStartDrag(Sender: TObject;
  var DragObject: TDragObject);
{$IFDEF MSWINDOWS}
var
  Pt: TPoint;
{$ENDIF}
begin
  {$IFDEF MSWINDOWS}
  if popupclosed=true then begin dragcancelled:=true; exit; end;
  update_selstatus;
  //Get cursor pos
  GetCursorPos(Pt);
  //Make cursor pos relative to button
  Pt := ButtonOptCancel.ScreenToClient(Pt);
  //Pass info to drag object
  FDragObject := TControlDragObject.CreateWithHotSpot(ButtonOptCancel, Pt.X, Pt.Y);
  //Modify the var parameter
  DragObject := FDragObject;
  {$ENDIF}
end;

procedure TFormPeach.Lmanageschedule1Click(Sender: TObject);
begin
if not(checkdirexists(confpath+'Scheduled scripts'+DirectorySeparator)) then mkdir(confpath+'Scheduled scripts'+DirectorySeparator);
cp_open(confpath+'Scheduled scripts'+DirectorySeparator,desk_env);
end;

procedure TFormPeach.Lmanageschedule2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(FormPeach.Handle, PWideChar ('open'), PWideChar('taskschd.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TFormPeach.pma2s_copyClick(Sender: TObject);
begin
mass_cp_copy_filedir(txt_copy,'');
end;

procedure TFormPeach.pma2s_extallnew1Click(Sender: TObject);
var
   nf:boolean;
   cl,jobcode,outname:ansistring;
begin
if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
FormPeach.CheckBoxFolder.State:=cbChecked;
FormPeach.EditOutExtract.Text:=destdir;
nffromdrag:=true;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'draganddrop','all')=0 then launch_cl(cl,jobcode,outname);
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'draganddrop','all')=0 then launch_cl(cl,jobcode,outname);
nffromdrag:=false;
if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TFormPeach.pma2s_extnew1Click(Sender: TObject);
var
   nf:boolean;
   cl,jobcode,outname:ansistring;
begin
if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
FormPeach.CheckBoxFolder.State:=cbChecked;
FormPeach.EditOutExtract.Text:=destdir;
nffromdrag:=true;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'draganddrop','selected')=0 then launch_cl(cl,jobcode,outname);
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'draganddrop','selected')=0 then launch_cl(cl,jobcode,outname);
nffromdrag:=false;
if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TFormPeach.pma2s_extnewClick(Sender: TObject);
var
   nf:boolean;
begin
if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
FormPeach.CheckBoxFolder.State:=cbChecked;
lastoutpath:=destdir;
quickextract(destdir,'*neutral','all');
if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TFormPeach.pma2s_extract1Click(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
FormPeach.EditOutExtract.Text:=destdir;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'draganddrop','selected')=0 then launch_cl(cl,jobcode,outname);
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'draganddrop','selected')=0 then launch_cl(cl,jobcode,outname);
end;

procedure TFormPeach.pma2s_extractall1Click(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
FormPeach.EditOutExtract.Text:=destdir;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'draganddrop','all')=0 then launch_cl(cl,jobcode,outname);
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'draganddrop','all')=0 then launch_cl(cl,jobcode,outname);
end;

procedure TFormPeach.pma2s_extractClick(Sender: TObject);
var
   nf:boolean;
begin
if FormPeach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
FormPeach.CheckBoxFolder.State:=cbUnChecked;
lastoutpath:=destdir;
quickextract(destdir,'*neutral','all');
if nf=true then FormPeach.CheckBoxFolder.State:=cbChecked else FormPeach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TFormPeach.pma2s_moveClick(Sender: TObject);
begin
mass_cp_copy_filedir(txt_cut,'');
end;

procedure TFormPeach.ThemeResetClick(Sender: TObject);
begin
reset_theme_btn;
end;

procedure TFormPeach.themesave_labelClick(Sender: TObject);
begin
if edit1.text='' then
   begin
   pMessageWarningOK(txt_no_theme_name);
   exit;
   end;
save_new_theme;
end;

procedure TFormPeach.TimerSyncTimer(Sender: TObject);
begin
doprogress;
{$IFDEF MSWINDOWS}
if PanelOpen.Visible=true then
   if (getkeystate(27)<>1) and (getkeystate(27)<>0) then
      begin
      dragcancelled:=true;
      end;
{$ENDIF}
if waitdrawok=false then waitdrawok:=true;
end;

procedure TFormPeach.TimerBrowserTimer(Sender: TObject);//optimized counting, skip if counting is in progress, flexible timing
var
   recmode:boolean;
   nfiles,ndirs,nunits,sc,tsize: qword;
   rc:integer;
   i:integer;
   ltime:longint;
   navrefreshed:boolean;
   fextl,sstr,sstrn:ansistring;
   {$IFDEF MSWINDOWS}MyThreadexe:TMyThreadexe;{$ENDIF}
begin
if FormPeach.StringGridList.RowCount<2 then exit;
{$IFDEF MSWINDOWS}if panelopen.visible=true then{$ELSE}if panelopen.top=0 then{$ENDIF}
   if fun='FILEBROWSER' then
      begin
      {$IFNDEF MSWINDOWS}
      {$IFNDEF DARWIN}//with GTK and Qt builds, updating the file browser results in stealing the focus (or notification if app is minimized) in most DE
      if Application.Active=false then exit;
      if FormPeach.WindowState=wsMinimized then exit;
      {$ENDIF}
      {$ENDIF}
      if listingdir=true then exit; //skip if a directory is being listed
      if EditOpenInInteractive.Caption<>EditOpenIn.Caption then exit;
      if control_listingdir=true then begin TimerBrowser.enabled:=false; exit; end;
      control_listingdir:=true;
      if StringGridSessionHistory.Cells[1,StringGridSessionHistory.Row]=txt_list_browsing then recmode:=false
      else recmode:=true;
      rc:=StringGridList.rowcount;
      TimerBrowser.Interval:=1000;
      if length(EditOpenInInteractive.Caption)>=2 then
         if EditOpenInInteractive.Caption[1]=DirectorySeparator then
            if EditOpenInInteractive.Caption[2]=DirectorySeparator then TimerBrowser.Interval:=4000;//remote unit
      if rc>4*1024 then TimerBrowser.Interval:=TimerBrowser.Interval*2;
      if rc>8*1024 then TimerBrowser.Interval:=TimerBrowser.Interval*4;
      if rc>16*1024 then begin TimerBrowser.enabled:=false; exit; end;
      if EditOpenIn.Text<>txt_mypc then
         begin
         if checkdirexists(EditOpenIn.Text) then
            begin
            nfiles:=0;
            ndirs:=0;
            tsize:=0;
            sstrn:='';
            if (simplesearch=1) then rcountsizen(EditOpenIn.Text,'*'+FormPeach.EditUn7zaFilter.Text+'*',faAnyFile,recmode,nfiles,ndirs,tsize,sstrn)
            else rcountsizen(EditOpenIn.Text,EditUn7zaFilter.Text,faAnyFile,recmode,nfiles,ndirs,tsize,sstrn);
            navrefreshed:=false;
            case nfiles of
               0: if StringGridList.Cells[1,1]<>'' then begin navrefresh; navrefreshed:=true; end;
               1: begin
                  if nfiles+1<>rc then begin navrefresh; navrefreshed:=true; end
                  else
                     if StringGridList.Cells[1,1]='' then begin navrefresh; navrefreshed:=true; end;
                  end;
               else if nfiles+1<>rc then begin navrefresh; navrefreshed:=true; end;
               end;
            if navrefreshed=false then
               begin
               sstr:='';
               for i:=1 to rc-1 do sstr:=sstr+StringGridList.Cells[1,i];
               if length(sstr)<>length(sstrn) then begin navrefresh; navrefreshed:=true; end; //use length as strings can have different sorting order
               end;
            if navrefreshed=false then
               begin
               sc:=0;
               try for i:=1 to rc-1 do sc:=sc+strtoqword(StringGridList.Cells[3,i]); except sc:=0; end;
               if sc<>0 then
                  if tsize<>sc then navrefresh;
               end;
            {$IFDEF MSWINDOWS}
            //if prevupdateid<>updateid then
            if done_listingexe=false then
               begin
               done_listingexe:=true;
               MyThreadexe := TMyThreadexe.Create(True);
               if Assigned(MyThreadexe.FatalException) then
                  raise MyThreadexe.FatalException;
               MyThreadexe.Resume;
               end;
            {$ENDIF}
            end;
         end
      else
         begin
         {$IFDEF MSWINDOWS}
         TimerBrowser.Interval:=2000;
         countunits(nunits);
         if nunits+1<>rc then
            begin
            populatepcmenu;
            navrefresh;
            end;
         {$ENDIF}
         end;
      control_listingdir:=false;
      end
   else
      if (autosync=1) and (browserbusy=false) then
      begin
      fextl:=upcase(extractfileext(FormPeach.EditOpenIn.Caption));
      //try only for unsupported file types, avoid knwon file types not supporting this operation
      if (fextl='.7Z') or (fextl='.TAR') or (fextl='.ZIP') or (fextl='.WIM') or (fextl='.RAR') or (test_forceeditunsupported(FormPeach.EditOpenIn.Caption)=1) then
         if (ptmpcode<>'') and (extractfilename(prevarchive)<>'') and (ptmpdir<>'') then
            begin
            if fextl='.ARC' then exit; //not fully work for arc
            if fextl='.RAR' then
               if (havewinrar<>true) or (userar<>1) then exit;
            if intpw=1 then
               begin
               DirSize(ptmpdir+directoryseparator,'*',FaAnyFile,true,true,nfiles,ndirs,tsize);
               if tsize<=0 then exit;
               end;
            TimerBrowser.enabled:=false;
            ltime:=0;
            rLast(ptmpdir+directoryseparator,'*',faAnyFile,true,ltime);
            if ltime>stime then
               case pMessagePreview(txt_6_9_uconf+char($0d)+char($0a)+txt_8_6_clear) of
                  7: tobrowser_fromarchiver; //no
                  6: syncedit_archive; //yes
                  1: begin //yes+clear temp edited files
                     syncedit_archive;
                     do_discardpreview;
                     end;
                  else
                     begin //no+clear temp edited files
                     do_discardpreview;
                     tobrowser_fromarchiver;
                     end;
               end;
            TimerBrowser.enabled:=true;
            end;
      end;
end;

procedure TFormPeach.TimerWinContextStartTimer(Sender: TObject);
begin
addmultiupdate;
end;

procedure TFormPeach.TimerWinContextTimer(Sender: TObject);
begin
addmultiupdate;
end;

procedure TFormPeach.TimerBusyTimer(Sender: TObject);
begin
if (browserbusy=true) then
   begin
   FormPeach.ListViewBrowser.Cursor:=crHourglass;
   end;
{$IFNDEF MSWINDOWS}
if (showthumbnails=1) and (FormPeach.Visible=true) and (FormPeach.PanelIntro.Top<>0) and (openstarted=true) then
   if gofthumbs=false then
      begin
      gofthumbs:=true;
      do_forcerefresh;
      end;
{$ENDIF}
end;

procedure TFormPeach.TimerHintStartTimer(Sender: TObject);
begin
if checkboxshowhints.Checked=false then exit;
{$IFDEF MSWINDOWS}if GetForegroundWindow <> Handle then exit;{$ENDIF}
if shint=prevshint then exit;
prevshint:=shint;
try
   h.hide;
except
end;
if shint='' then exit;
try
   h.ActivateHint(r, shint);
except
end
end;

procedure TFormPeach.TimerrenameTimer(Sender: TObject);
begin
Timerrename.Enabled:=false;
if FormPeach.ListViewBrowser.SelCount<>1 then exit;
//if GetKeyState(VK_LBUTTON) and $8000 <> 0 then begin wasselected:=-1; exit; end;
if (wasselectedp=wasselected) and (wasselectedp>0) then
   begin
   wasselected:=-1;
   rename_files('rename');
   end;
end;

procedure TFormPeach.tmconvertClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
fixbringtofront;
select_all('0');
archive_convert;
end;

procedure TFormPeach.tmcreateClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
fixbringtofront;
select_all('0');
do_add;
end;

procedure TFormPeach.tmextractClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
fixbringtofront;
select_all('0');
if open_archive<>1 then exit;
do_extract;
end;

procedure TFormPeach.tmopenarchiveClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
fixbringtofront;
open_archive;
end;

procedure TFormPeach.tmopenpathClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
fixbringtofront;
peazip_browse;
end;

procedure TFormPeach.tmpeazipClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
fixbringtofront;
end;

procedure TFormPeach.tmquitClick(Sender: TObject);
begin
FormPeach.visible:=true;
exit_withsave;
end;

procedure TFormPeach.tmupdateClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
fixbringtofront;
select_all('0');
if open_archive<>1 then exit;
do_add;
end;

procedure TFormPeach.tbtemperatureChange(Sender: TObject);
begin
if openstarted=true then
   begin
   temperature:=tbtemperature.Position;
   color2:=color2d;
   apply_theme;
   end;
end;

procedure TFormPeach.TrayIconPZClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
end;

procedure TFormPeach.TrayIconPZDblClick(Sender: TObject);
begin
TrayIconPZ.visible:=false;
FormPeach.visible:=true;
end;

procedure TFormPeach.TreeViewNavMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if button<>mbLeft then exit;
fromtree:=true;
if (TreeViewNav.GetHitTestInfoAt(X, Y) <= [htOnItem, htOnIcon, htOnLabel, htOnStateIcon, htOnButton]) then TargetNode := TreeViewNav.GetNodeAt(X,Y)
else TargetNode :=nil;
if (TreeViewNav.GetHitTestInfoAt(X, Y) <= [htOnItem, htOnIcon, htOnLabel, htOnStateIcon]) then treeonbutton:=true else treeonbutton:=false;
end;

procedure TFormPeach.TreeViewNavMouseEnter(Sender: TObject);
begin
TreeViewNav.ShowButtons:=true;
bctemp:=0;
end;

procedure TFormPeach.TreeViewNavMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if button<>mbLeft then exit;
dotreeviewstatus(TargetNode);
dotreeviewaction(TargetNode);
end;

procedure TFormPeach.w7contextlangClick(Sender: TObject);
begin
pMessageInfoOK(txt_5_3_cmlmessage);
cp_open(sharepath+'lang-wincontext'+directoryseparator,desk_env);
end;

procedure TFormPeach.zenc437Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=3;
editencoding.caption:='437';
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.zencutf8Click(Sender: TObject);
begin
FormPeach.cbEncoding.ItemIndex:=1;
on_CBEncoding1Change;
f5refreshExecute(nil);
end;

procedure TFormPeach.TimerdragTimer(Sender: TObject);
var
   lpPoint:TPoint;
   dragdest:ansistring;
begin
{$IFDEF MSWINDOWS}
if nativedrag=1 then
begin
{if GetKeyState(VK_LBUTTON)<0 then exit;
if GetKeyState(VK_RBUTTON)<0 then exit;
if GetKeyState(VK_MBUTTON)<0 then exit;
disdrag:=false;}
end
else
begin
GetCursorPos(lpPoint);
FormDrop.Top:=lpPoint.y+24;
FormDrop.left:=lpPoint.x+24;
if FormDrop.Visible=false then
   begin
   FormDrop.Visible:=true;
   FormDrop.BringToFront;
   end;
if (lpPoint.x<FormPeach.left-8) or (lpPoint.y<FormPeach.top-8) or (lpPoint.x>FormPeach.left+FormPeach.width+12) or (lpPoint.y>FormPeach.top+FormPeach.height+32) then
   if dragtowin(dragdest)=0 then
      if dragdest<>'<unsupported>' then
         begin
         if dragdest<>'' then
            if dragdest[length(dragdest)]=directoryseparator then setlength(dragdest,length(dragdest)-1);
         FormDrop.Labeldragtitle.Caption:=basedragtitle+' '+txt_to+' '+extractfilename(dragdest);
         end
      else FormDrop.Labeldragtitle.Caption:=basedragtitle
   else FormDrop.Labeldragtitle.Caption:=basedragtitle
else FormDrop.Labeldragtitle.Caption:=basedragtitle;
FormDrop.Height:=FormDrop.imagedragfile.top+56;
if FormDrop.Labeldragtitle.Caption=basedragtitle then
   FormDrop.AlphaBlendValue:=96
else
   FormDrop.AlphaBlendValue:=128;
end;
{$ENDIF}
end;

{///////////////////////////////////////////////////////////////////////////////

subsection (Windows) threaded image viewer and exe icon viewer

///////////////////////////////////////////////////////////////////////////////}

procedure TMyThreadimg.ReadStatus;
var
   MyThread1: TMyThread1;
   MyThread2: TMyThread2;
   MyThread3: TMyThread3;
   MyThread4: TMyThread4;
begin
MyThread1 := TMyThread1.Create(True);
if Assigned(MyThread1.FatalException) then
raise MyThread1.FatalException;
MyThread1.Resume;
MyThread2 := TMyThread2.Create(True);
if Assigned(MyThread2.FatalException) then
raise MyThread2.FatalException;
MyThread2.Resume;
MyThread3 := TMyThread3.Create(True);
if Assigned(MyThread3.FatalException) then
raise MyThread3.FatalException;
MyThread3.Resume;
MyThread4 := TMyThread4.Create(True);
if Assigned(MyThread4.FatalException) then
raise MyThread4.FatalException;
MyThread4.Resume;
end;

procedure TMyThreadimg.ShowStatus;
begin
end;

procedure TMyThreadimg.Execute;
begin
Synchronize(@Readstatus);
end;

constructor TMyThreadimg.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

procedure TMyThreadexe.ReadStatus;
var
   i,p,x,y,k,eisize:integer;
   abitmap,bbitmap:Tbitmap;
   icon:TIcon;
   s:AnsiString;
   {$IFDEF MSWINDOWS}fileinfo: SHFILEINFO;{$ENDIF}
begin
{$IFDEF MSWINDOWS}
for i:=1 to FormPeach.StringGridList.rowcount-1 do
   if lowercase(FormPeach.StringGridList.Cells[2,i])='.exe' then //SHGetFileInfo not threadsafe
   if strtoint(FormPeach.StringGridList.Cells[3,i])<64000000 then //don't search for icons if exe is large, for performance reasons
      begin
      Application.ProcessMessages;
      case browsertype of
         2: eisize:=largeiconsize;
         1: eisize:=smalliconsize;
         0: eisize:=smalliconsize;
      end;
      if eisize>0 then
         begin
         try
            abitmap:=Tbitmap.Create;
            bbitmap:=Tbitmap.Create;
            icon:=TIcon.Create;
            s:=FormPeach.StringGridList.Cells[12,i];
            k:=0;
            if eisize=16 then k:=SHGetFileInfo(pchar(s), 0, fileinfo, sizeof(fileinfo), SHGFI_ICON or SHGFI_SMALLICON)
            else k:=SHGetFileInfo(pchar(s), 0, fileinfo, sizeof(fileinfo), SHGFI_ICON or SHGFI_LARGEICON);
            if k<>0 then
               begin
               icon.Handle:=fileinfo.hIcon;
               abitmap.Height:=icon.Height;
               abitmap.Width:=icon.Width;
               abitmap.Canvas.draw(0,0,icon);
               p:=0;
               for y:=0 to icon.Height-1 do
                  for x:=0 to icon.Width-1 do
                     if (icon.Canvas.Pixels[x,y]<>$FFFFFF) and (icon.Canvas.Pixels[x,y]<>$000000) then
                        begin
                        p:=p+1;
                        Break;
                        end;
               if p<>0 then
                  begin
                  abitmap.TransparentColor:=clBlack;
                  abitmap.Transparent:=true;
                  end;
               DestroyIcon(fileinfo.hIcon);
               end
            else
               begin
               abitmap:=Tbitmap.Create;
               abitmap.Assign(FormPeach.ListViewBrowser.Items[1]);
               end;
            if eisize=16 then
               begin
               setpbitmap(abitmap, (icon.Width*pzoom) div 100);
               setsize_bitmap(abitmap, icon_sizeplus, DECO_NONE);
               il16.Add(abitmap,nil);
               FormPeach.ListViewBrowser.Items[i-1].ImageIndex:=il16.Count-1;
               end
            else
               begin
               setpbitmap(abitmap,scalediconsize);
               loadlargeicon(abitmap,bbitmap,spacedscalediconsize);
               il96.Add(bbitmap,nil);
               FormPeach.ListViewBrowser.Items[i-1].ImageIndex:=il96.Count-1;
               end;
         finally
            abitmap.free;
            bbitmap.free;
            icon.Free;
         end;
      end;
      end;
{$ENDIF}
end;

procedure TMyThreadexe.ShowStatus;
begin
end;

procedure TMyThreadexe.Execute;
begin
Synchronize(@Readstatus);
end;

constructor TMyThreadexe.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

procedure TMyThread1.ReadStatus;
begin
fread:=FormPeach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread1.ShowStatus;
begin
if prevupdateid<>updateid then
begin
if browsertype=2 then il96.Replace(50+fi,fbitmap,nil)
else
   if smalliconsize=16 then il16.Replace(50+fi,fbitmap,nil)
   else il96.Replace(50+fi,fbitmap,nil);
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
FormPeach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[18,imlistindex[fi]]:=inttostr(50+imtodo[fi]);
//for sorting for column of image details, it needs the threads to complete before having data to sort
   end
else
   begin
   FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=strtoint(FormPeach.StringGridList.Cells[18,imlistindex[fi]]);
   end;
end;

procedure TMyThread1.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid:integer;
begin
threadsyncid:=sync;
for i:=1 to imindex do
   begin
   if sync<>threadsyncid then exit; //at the beginning of the loop and before any sync operation check if a new cuncurrent set of threads has started; in this case free threads' resources (one at time, as soon as available - after each file) and terminate without updating shared resources that are now set to be used by the new set of threads
   if i and 3 = 1 then
   begin
   if prevupdateid<>updateid then
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   load_bitmap(abitmap, fread, scalediconsize, deco_style, s);
   setsize_bitmap(abitmap, spacedscalediconsize, DECO_NONE);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end
   else
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end;
   end;
   end;
end;

constructor TMyThread1.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

procedure TMyThread2.ReadStatus;
begin
fread:=FormPeach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread2.ShowStatus;
begin
if prevupdateid<>updateid then
begin
if browsertype=2 then il96.Replace(50+fi,fbitmap,nil)
else
   if smalliconsize=16 then il16.Replace(50+fi,fbitmap,nil)
   else il96.Replace(50+fi,fbitmap,nil);
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
FormPeach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[18,imlistindex[fi]]:=inttostr(50+imtodo[fi]);
//for sorting for column of image details, it needs the threads to complete before having data to sort
   end
else
   begin
   FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=strtoint(FormPeach.StringGridList.Cells[18,imlistindex[fi]]);
   end;
end;

procedure TMyThread2.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid:integer;
begin
threadsyncid:=sync;
for i:=1 to imindex do
   begin
   if sync<>threadsyncid then exit;
   if i and 3 = 2 then
   begin
   if prevupdateid<>updateid then
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   load_bitmap(abitmap, fread, scalediconsize, deco_style, s);
   setsize_bitmap(abitmap, spacedscalediconsize, DECO_NONE);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end
   else
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end;
   end;
   end;
end;

constructor TMyThread2.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

procedure TMyThread3.ReadStatus;
begin
fread:=FormPeach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread3.ShowStatus;
begin
if prevupdateid<>updateid then
begin
if browsertype=2 then il96.Replace(50+fi,fbitmap,nil)
else
   if smalliconsize=16 then il16.Replace(50+fi,fbitmap,nil)
   else il96.Replace(50+fi,fbitmap,nil);
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
FormPeach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[18,imlistindex[fi]]:=inttostr(50+imtodo[fi]);
//for sorting for column of image details, it needs the threads to complete before having data to sort
   end
else
   begin
   FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=strtoint(FormPeach.StringGridList.Cells[18,imlistindex[fi]]);
   end;
end;

procedure TMyThread3.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid:integer;
begin
threadsyncid:=sync;
for i:=1 to imindex do
   begin
   if sync<>threadsyncid then exit;
   if i and 3 = 3 then
   begin
   if prevupdateid<>updateid then
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   load_bitmap(abitmap, fread, scalediconsize, deco_style, s);
   setsize_bitmap(abitmap, spacedscalediconsize, DECO_NONE);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end
   else
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end;
   end;
   end;
end;

constructor TMyThread3.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

procedure TMyThread4.ReadStatus;
begin
fread:=FormPeach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread4.ShowStatus;
begin
if prevupdateid<>updateid then
begin
if browsertype=2 then il96.Replace(50+fi,fbitmap,nil)
else
   if smalliconsize=16 then il16.Replace(50+fi,fbitmap,nil)
   else il96.Replace(50+fi,fbitmap,nil);
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
FormPeach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
FormPeach.StringGridList.Cells[18,imlistindex[fi]]:=inttostr(50+imtodo[fi]);
//for sorting for column of image details, it needs the threads to complete before having data to sort
   end
else
   begin
   FormPeach.ListViewBrowser.Items[imlistindex[fi]-1].ImageIndex:=strtoint(FormPeach.StringGridList.Cells[18,imlistindex[fi]]);
   end;
end;

procedure TMyThread4.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid:integer;
begin
threadsyncid:=sync;
for i:=1 to imindex do
   begin
   if sync<>threadsyncid then exit;
   if i and 3 = 0 then
   begin
   if prevupdateid<>updateid then
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   load_bitmap(abitmap, fread, scalediconsize, deco_style, s);
   setsize_bitmap(abitmap, spacedscalediconsize, DECO_NONE);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end
   else
   begin
   fi:=i;
   abitmap:=Tbitmap.Create;
   if sync<>threadsyncid then begin abitmap.free; exit; end;
   Synchronize(@Readstatus);
   fs:=s;
   fbitmap:=Tbitmap.Create;
   fbitmap.Width:=abitmap.Width;
   fbitmap.Height:=abitmap.Height;
   fbitmap.Assign(abitmap);
   if sync<>threadsyncid then begin abitmap.free; fbitmap.free; exit; end;
   Synchronize(@Showstatus);
   abitmap.free;
   fbitmap.free;
   imtodo[i]:=0;
   end;
   end;
   end;
end;

constructor TMyThread4.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

{///////////////////////////////////////////////////////////////////////////////

subsection (Windows) native drag and drop extraction

///////////////////////////////////////////////////////////////////////////////}

function dragtowinh(lpPoint: TPoint):integer;
{$IFDEF MSWINDOWS}
var
   j:integer;
   s:array[0..256] of Char;
   st:ansistring;
   haddress:HWND;
   {$ENDIF}
begin
   {$IFDEF MSWINDOWS}
   //get main window handle from cursor point
   haddress:=WindowFromPoint(lpPoint);
   GetClassName(haddress,s,sizeof(s));
   //workaround for identifying desktop
   j := GetWindowTextLength(haddress)+1;
   SetLength(st, j-1);
   GetWindowText(haddress,@st[1],j);
   st:=s+st;
   if (s<>'CabinetWClass') and (s<>'ExploreWClass') then
      repeat
      haddress := getparent(haddress);
      GetClassName(haddress,s,sizeof(s));
      until (s='CabinetWClass') or (s='ExploreWClass') or (haddress=0);
   st:=s+st;
   result:=haddress;
   {$ENDIF}
end;

procedure cleandragtmp;
{$IFDEF MSWINDOWS}
var
   cldir:ansistring;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
try
if vpathb<>'' then
   if vpathb<>vpatha then
      begin
      cldir:=vpathb+'virtual\';
      cleardir(cldir,true,true);//if removedir(cldir)=false then cleardir(cldir,true,true);
      cldir:=vpathb+'source\';
      cleardir(cldir,true,true);//if removedir(cldir)=false then cleardir(cldir,true,true);
      cleardir(vpathb,true,true);//if removedir(vpathb)=false then cleardir(vpathb,true,true);
      SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(vpathb),nil);
      end;
cldir:=vpatha+'virtual\';
cleardir(cldir,true,true); //if removedir(cldir)=false then cleardir(cldir,true,true);
cldir:=vpatha+'source\';
cleardir(cldir,true,true); //if removedir(cldir)=false then cleardir(cldir,true,true);
cleardir(vpatha,true,true); //if removedir(vpatha)=false then cleardir(vpatha,true,true);
SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(vpatha),nil);
except
end;
{$ENDIF}
end;

procedure threadextract(vpath:ansistring);
{$IFDEF MSWINDOWS}
var
   fres,totrow,pend:integer;
   nfiles,ndirs,size:QWord;
   cl,jobcode,outname,dragdest,relpath,prevout,fun1,fun_status1,lparam,stsize,clthread:ansistring;
   P:tprocessutf8;
   lpPoint:TPoint;
   haddress:THandle;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
fres:=-1;
if threadextracting=true then exit;
threadextracting:=true;
FormPeach.Enabled:=false;
CreateDir(vpath);
CreateDir(vpath+'virtual\');
CreateDir(vpath+'source\');
vpath2:=vpath;
changevpath(vpath2);
imdel:=false;
case work_dir of
   //0,1: vpath2 changed later to output, if applicable
   //2,4: vpath2 is already in user temp
   //3: vpath2 is already in custom path
   5: exit;
   end;
prevout:=FormPeach.EditOutExtract.Text;
GetCursorPos(lpPoint);
if (lpPoint.x<FormPeach.left) or (lpPoint.y<FormPeach.top) or (lpPoint.x>FormPeach.left+FormPeach.width) or (lpPoint.y>FormPeach.top+FormPeach.height+52) then
   begin
   cleandragtmp;
   if dragtowin(dragdest)<>0 then begin FDragObject.Destroy; exit; end;
   if dragdest<>'' then
      if dragdest<>'<unsupported>' then
         begin
         if dragdest[length(dragdest)]<>DirectorySeparator then dragdest:=dragdest+DirectorySeparator;
         case work_dir of //set work dir, if variable (output)
           0: vpath2:=dragdest+vpathname+DirectorySeparator;
           1: vpath2:=dragdest+vpathname+DirectorySeparator;
           end;
         if CreateDir(vpath2)=false then vpath2:=vpath;//get writeable path
         CreateDir(vpath2+'virtual\');
         CreateDir(vpath2+'source\');
         filesetattr(vpath2, faHidden);
         changevpath(vpath2);
         haddress:=0;
         haddress:=dragtowinh(lpPoint);
         imdel:=true;
         end;
   end
else //drag on itself
   begin
   changevpath('');
   pclicked:=false;
   exit;
   end;
FormPeach.EditOutExtract.Text:=vpath2+'virtual\';
calcseltsize;
sizefreeint:=tsize;
get_statussdrag(dragdest);
if checkfreespace<>0 then exit;
totrow:=FormPeach.StringGridList.Rowcount;
if totrow<2 then exit;
if totrow>=3 then
   case fun of
      'RFJ', 'UNPEA', 'UNLPAQ', 'UNPAQ', 'UNZPAQ', 'UNQUAD', 'UNACE':
      begin
      pMessageWarningOK(txt_error_partial);
      exit;
      end;
   end;
fun1:=fun;
fun_status1:=fun_status;
if (useextrac32=1) and (libre_directive=0) then
   if lowercase(extractfileext(FormPeach.EditOpenIn.Text))='.cab' then
      begin
      fun:='UNCUSTOM';
      fun_status:=fun;
      FormPeach.EditNameCustomExt.Text:='Extrac32';
      FormPeach.ComboBoxCustomSyntaxExt.ItemIndex:=0;
      customsyntax1:=0;
      end;
case fun of
   'RFJ' : fres:=compose_unpea_cl(cl,jobcode,outname);
   'UNPEA' : fres:=compose_unpea_cl(cl,jobcode,outname);
   'UNLPAQ' : fres:=compose_unlpaq_cl(cl,jobcode,outname,true,'ext');
   'UNPAQ' : fres:=compose_unpaq_cl(cl,jobcode,outname,true,'ext');
   'UNZPAQ' : fres:=compose_unzpaq_cl(cl,jobcode,outname,true,'ext','single');
   'UNQUAD' : fres:=compose_unquad_cl(cl,jobcode,outname,true,'ext');
   'UNBROTLI' : fres:=compose_unbrotli_cl(cl,jobcode,outname,true,'ext','single');
   'UNZSTD' : fres:=compose_unzstd_cl(cl,jobcode,outname,true,'ext','single');
   'UNACE' :  fres:=compose_unace_cl(cl,jobcode,outname,true,'ext','single');
   'UNCUSTOM': fres:=compose_uncustom_cl(cl,jobcode,outname,true);
   end;
if testencrypted=0 then
   begin
   if (fun='UNARC') then
      fres:=compose_unarc_cl(cl,jobcode,outname,true,'draganddrop','selected');
   if (fun='UN7Z') then
      fres:= compose_un7z_cl(cl,jobcode,outname,true,'draganddrop','selected');
   end;
if fres=0 then
   begin
   if intpw=1 then FormPeach.Visible:=true else FormPeach.Visible:=false;
   save_conf;
   P:=tprocessutf8.Create(nil);
   P.Options := [poUsePipes];
   if pipepw<>'' then lparam:=' -pdropp ' else lparam:=' -pdrop ';
   try stsize:=inttostr(tsize); except stsize:='0'; end;
   clthread:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+
             lparam+fun+' '+inttostr(pforceconsole)+' '+stsize+' '+stringdelim(FormPeach.EditOpenIn.Text)+' '+cl;
   if (dragtargetprotect=1) or (dragtargetprotect=3) then if haddress<>0 then EnableWindow(haddress,false);
   if (dragtargetprotect=2) or (dragtargetprotect=3) then if haddress<>0 then ShowWindow(haddress,6);
   peapexecute(P,clthread);

   if pipepw<>'' then
      begin
      pipepw:=strsafeenc(pipepw);
      pipepw:=pipepw+lineending;
      P.Input.Write(pipepw[1], Length(pipepw));//passed only once to PeaZip in -pdropp mode
      pipepw:='';
      end;

   while P.Running do sleep(100);

   pend:=P.ExitCode;
   P.Free;
   if (fileexists(peaziptmpdir+STR_TMPDROPE)=true) then
   //(file can be deleted by another instance of the app) utter check to handle errors not correctly passed between processes and from the underlying process or console mode
      begin
      pend:=2;
      try DeleteFile(peaziptmpdir+STR_TMPDROPE); except end;
      end;

   if FormPeach.Visible=false then FormPeach.Visible:=true;

   if (fileexists(peaziptmpdir+STR_TMPERRI)=true) then DeleteFile(peaziptmpdir+STR_TMPERRI)
   else
   if pend<>0 then
      begin
      pclicked:=true;
      if haddress<>0 then EnableWindow(haddress,true);
      if haddress<>0 then ShowWindow(haddress,9);
      fun:=fun1;
      fun_status:=fun_status1;
      FormPeach.EditOutExtract.Text:=prevout;
      exit;
      end;
   if status0=txt_list_browsing then
      begin
      relpath:=StringReplace(FormPeach.StringGridList.Cells[12,FormPeach.StringGridList.Row],':','_',[rfReplaceAll]);
      relpath:=extractfilepath(relpath);
      end
   else
      relpath:='';//if in f6flat or search mode, use root
   if not checkdirexists(vpath2+'source\') then CreateDir(vpath2+'source\');
   if intpw=1 then
      begin
      DirSize(FormPeach.EditOutExtract.Text+relpath,'*',FaAnyFile,true,true,nfiles,ndirs,size);
      if size>0 then movecontent_todir(FormPeach.EditOutExtract.Text+relpath,vpath2+'source\',1);
      end
   else
      movecontent_todir(FormPeach.EditOutExtract.Text+relpath,vpath2+'source\',1);
   pclicked:=true;
   if haddress<>0 then EnableWindow(haddress,true);
   if haddress<>0 then ShowWindow(haddress,9);
   end;
fun:=fun1;
fun_status:=fun_status1;
FormPeach.EditOutExtract.Text:=prevout;
{$ENDIF}
end;

procedure TMyThreaddrop.ReadStatus;
begin
end;

procedure TMyThreaddrop.ShowStatus;
begin
{$IFDEF MSWINDOWS}
threadextract(vpath);
{$ENDIF}
end;

procedure TMyThreaddrop.Execute;
var
   vstat: ansistring;
begin
{$IFDEF MSWINDOWS}
//wait ondrag event from dll
while vstat<>'.preparedrop' do
  begin
  sleep(50);
  readvstatus(vstat);
  end;
Synchronize(@ShowStatus);
//dll can now complete drag and drop
setvstatus('.finalizedrop');
{$ENDIF}
end;

constructor TMyThreaddrop.Create(CreateSuspended: boolean);
begin
{$IFDEF MSWINDOWS}
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
{$ENDIF}
end;

{///////////////////////////////////////////////////////////////////////////////

subsection (Windows) custom drag and drop

///////////////////////////////////////////////////////////////////////////////}

function dragtowin(var dragdest:ansistring):integer;
{$IFDEF MSWINDOWS}
var
   j:integer;
   lpPoint: TPoint;
   TextLength: Integer;
   tw: PWideChar;
   tws: WideString;
   t:ansistring;
   s:array[0..256] of Char;
   st:ansistring;
   haddress,htest:HWND;
   {$ENDIF}
begin
   {$IFDEF MSWINDOWS}
   dragtowin:=-1;
   dragdest:='<unsupported>';
   GetCursorPos(lpPoint);
   s:='';
   //get main window handle from cursor point
   haddress:=WindowFromPoint(lpPoint);
   GetClassName(haddress,s,sizeof(s));
    //workaround for identifying desktop
    j := GetWindowTextLength(haddress)+1;
    SetLength(st, j-1);
    GetWindowText(haddress,@st[1],j);
    st:=s+st;
   if (s<>'CabinetWClass') and (s<>'ExploreWClass') then
      repeat
      haddress := getparent(haddress);
      GetClassName(haddress,s,sizeof(s));
      until (s='CabinetWClass') or (s='ExploreWClass') or (haddress=0);
    st:=s+st;
   if haddress<>0 then //get address from an explorer's window control (system specific)
      begin
      case winver of
         'nt5': //
         begin
         htest:= FindWindowEx(haddress, 0, 'ExploreWClass', nil);//test if using "Explore" window type
         if htest<>0 then haddress:=htest;
         haddress := FindWindowEx(haddress, 0, 'WorkerW', nil);
         haddress := FindWindowEx(haddress, 0, 'ReBarWindow32', nil);
         haddress := FindWindowEx(haddress, 0, 'ComboBoxEx32', nil);
         haddress := FindWindowEx(haddress, 0, 'ComboBox', nil);
         haddress := FindWindowEx(haddress, 0, 'Edit', nil);
         end;
         'nt6+':  //works on Vista and 7
         begin
         haddress := FindWindowEx(haddress, 0, 'WorkerW', nil);
         haddress := FindWindowEx(haddress, 0, 'ReBarWindow32', nil);
         haddress := FindWindowEx(haddress, 0, 'Address Band Root', nil);
         haddress := FindWindowEx(haddress, 0, 'msctls_progress32', nil);
         haddress := FindWindowEx(haddress, 0, 'Breadcrumb Parent', nil);
         haddress := FindWindowEx(haddress, 0, 'ToolbarWindow32', nil);
         end;
         end;
      if haddress=0 then t:='<unsupported>' //address bar is hidden, exporer's window cannot be queried for output path
      else
         begin
         TextLength := SendMessageW(haddress, WM_GETTEXTLENGTH, 0, 0);
         GetMem(tw, TextLength * 2 + 1);
         SendMessageW(haddress, WM_GETTEXT, TextLength + 1, Integer(tw));
         tws:=tw;
         t:=AnsiString(tws);
         if winver='nt6+' then if t<>'' then if length(t)>2 then t:=copy(t,pos(': ',t)+2,length(t)-pos(': ',t)); //removes the text string prepended to address string in Aero ToolbarWindow32
         if not(checkdirexists((t))) then //special folders with conventional name instead of path (documets etc)
            begin
            t:=home_path+t+'\';
            t:=(t);
            if not(checkdirexists((t))) then t:='<unsupported>'; //string is not a path, or the path don't exists (i.e. Control panel etc)
            end;
         FreeMem(tw);
         end;
      end
   else //recognize if it is desktop window, or unsupported application's window
      begin
      t:='<unsupported>'; //application cannot be queried for output path
      case winver of
         'nt5':
         if (st='ProgmanSysListView32FolderView') or //XP
            (st='ProgmanSysListView32') or //Win2k
            (st='ProgmanInternet Explorer_Server') then //activedesktop
            t:=local_desktop;
         'nt6+':
         if (st='ProgmanSysListView32FolderView') or
            (st='WorkerWSysListView32FolderView') then
            t:=local_desktop;
         end;
      t:=(t);
      end;
   dragdest:=(t);
   dragtowin:=0;
   {$ENDIF}
end;

procedure get_drag_information(var s_files:qword; var t_files,t_folders:integer; var name_file,name_folder:ansistring);
var
   i:integer;
begin
t_files:=0;
t_folders:=0;
s_files:=0;
name_file:='';
name_folder:='';
for i:=1 to FormPeach.StringGridList.RowCount-1 do
   if FormPeach.StringGridList.Cells[16,i]='1' then
      if FormPeach.StringGridList.Cells[2,i]=txt_list_isfolder then
         begin
         t_folders:=t_folders+1;
         if t_folders<4 then
            name_folder:=name_folder+FormPeach.StringGridList.Cells[1,i]+', ';
         end
      else
         begin
         t_files:=t_files+1;
         try s_files:=s_files+strtoqword(FormPeach.StringGridList.Cells[3,i]); except end;
         if t_files<4 then
            name_file:=name_file+FormPeach.StringGridList.Cells[1,i]+', ';
         end;
if t_folders>3 then name_folder:=name_folder+'...'
else setlength(name_folder,length(name_folder)-2);
if t_files>3 then name_file:=name_file+'...'
else setlength(name_file,length(name_file)-2);
end;

{$IFDEF MSWINDOWS}
procedure preparedragform;
var
   sfiles:qword;
   nfiles,nfolders:integer;
   name_file,name_folder,dragsrc,txt1_dirs:ansistring;
begin
basedragtitle:='';
get_drag_information(sfiles,nfiles,nfolders,name_file,name_folder);
if (name_file='') and (name_folder='') then exit;
txt1_dirs:=txt_dirs;
if txt1_dirs<>'' then
   if txt1_dirs[length(txt1_dirs)]=',' then setlength(txt1_dirs,length(txt1_dirs)-1);
FormDrop.Labeldragfolder.caption:=inttostr(nfolders);
if name_folder<>'' then
   FormDrop.Labeldragfolder.caption:=FormDrop.Labeldragfolder.caption+' '+txt_dirs+' '+name_folder
else
   FormDrop.Labeldragfolder.caption:=FormDrop.Labeldragfolder.caption+' '+txt1_dirs;
FormDrop.Labeldragfile.caption:=inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(sfiles),filesizebase);
if name_file<>'' then
   FormDrop.Labeldragfile.caption:=FormDrop.Labeldragfile.caption+', '+name_file;
FormDrop.imagedragfolder.picture.bitmap:=Bfolder;
FormDrop.Imagedragfile.picture.bitmap:=Bunsupported;
FormDrop.imagedragfolder.transparent:=true;
FormDrop.Imagedragfile.transparent:=true;
dragsrc:=FormPeach.EditOpenIn.Text;
if dragsrc<>'' then
   if dragsrc[length(dragsrc)]=directoryseparator then
      setlength(dragsrc,length(dragsrc)-1);
if fun='FILEBROWSER' then
   begin
   if extractfilename(dragsrc)<>'' then
      FormDrop.Labeldragtitle.Caption:=txt_2_4_copyfrom+' '+extractfilename(dragsrc)
   else
      FormDrop.Labeldragtitle.Caption:=txt_2_4_copyfrom+' '+copy(FormPeach.EditOpenIn.Caption,1,3);
   FormDrop.Imagedragop.picture.bitmap:=Btool_copy;
   FormDrop.Imagedragop.transparent:=true;
   end
else
   begin
   FormDrop.Labeldragtitle.Caption:=extractfilename(dragsrc)+' > '+getextcaption+' |';
   if tonewfolder=0 then
      FormDrop.Imagedragop.picture.bitmap:=Bextractall_big
   else
      FormDrop.Imagedragop.picture.bitmap:=Bextractalln_big;
   FormDrop.Imagedragop.transparent:=true;
   end;
basedragtitle:=FormDrop.Labeldragtitle.Caption;
FormPeach.Timerdrag.Enabled:=true;
end;

procedure FixControlStyles(Parent: TControl);
var
  I: Integer;
begin
Parent.ControlStyle := Parent.ControlStyle + [csDisplayDragImage];
if Parent is TWinControl then
   with TWinControl(Parent) do
      for I := 0 to ControlCount - 1 do
         FixControlStyles(Controls[I]);
end;

constructor TControlDragObject.CreateWithHotSpot(AControl: TWinControl; X, Y: Integer);
begin
inherited Create(AControl);
X:=-24;
Y:=-24;
FX := X;
FY := Y;
end;

destructor TControlDragObject.Destroy;
begin
FDragImages.Free;
inherited;
end;

function TControlDragObject.GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor;
begin
if Accepted=true then
   Result := crDefault
else
   Result := crDrag;
if FormPeach.Timerdrag.Enabled=false then
   preparedragform;
end;

procedure TControlDragObject.EndDrag(Target: TObject; X, Y: Integer);
var
   totrow,i,j:integer;
   cl,jobcode,outname,dragdest,olddest:ansistring;
   lpPoint:TPoint;
begin  //it is not triggered by right click in current build
if nativedrag=1 then exit;
FormPeach.Timerdrag.enabled:=false;
FormDrop.Visible:=false;
totrow:=FormPeach.StringGridList.Rowcount;
if totrow<2 then begin FDragObject.Destroy; exit; end;
{CUSTOM drag from application to system, Windows: get path of drop destination and use
as output path.
Does not rely on the undocumented CWM_GETPATH function since being unoffcial it
can be not supported on some MS systems.
Pros:
- don't need to use system's temp folder as by design does drag and drop, this means:
-- data doesn't need to be copied twice;
-- data goes directly to desired output location which has desired security policies
Cons:
- requires Address bar to be visible, as default (not an issue on Vista);
- does not show drag and drop cursor icon (but shows custom form with detailed drag and drop information);
- it is not able to open items on taskbar, to get path from folders on desktop or
  treewiews, or to get paths from open/save dialog windows.
}
if (getkeystate(27)<>1) and (getkeystate(27)<>0) then begin FDragObject.Destroy; exit; end;
if dragcancelled=true then begin FDragObject.Destroy; exit; end;
dragcancelled:=true;
FormPeach.ListViewBrowser.begindrag(false);
if FormPeach.EditOpenIn.Caption=txt_mypc then begin FDragObject.Destroy; exit; end;
GetCursorPos(lpPoint);
if (lpPoint.x<FormPeach.left-8) or (lpPoint.y<FormPeach.top-8) or (lpPoint.x>FormPeach.left+FormPeach.width+12) or (lpPoint.y>FormPeach.top+FormPeach.height+32) then
   begin
   if dragtowin(dragdest)<>0 then begin FDragObject.Destroy; exit; end;
   if dragdest='<unsupported>' then
      begin
      if set_extractto_path<>0 then begin FDragObject.Destroy; exit; end;
      dragdest:=FormPeach.EditOutExtract.Text;
      end;
   resetminimizedlauncher;
   olddest:=FormPeach.EditOutExtract.Text;
   FormPeach.EditOutExtract.Text:=dragdest;
   if FormPeach.EditOutExtract.Text<>'' then
      if FormPeach.EditOutExtract.Text[length(FormPeach.EditOutExtract.Text)] <> directoryseparator then FormPeach.EditOutExtract.Text:=FormPeach.EditOutExtract.Text+directoryseparator;
   calcseltsize;

   sizefreeint:=tsize;
   if checkfreespace<>0 then exit;
   FormPeach.Visible:=false;
   case fun of
      'RFJ' :
      if totrow<3 then
         if compose_unpea_cl(cl,jobcode,outname)=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial); //never happens since split file is a single object
      'UNPEA' :
      if totrow<3 then
         if compose_unpea_cl(cl,jobcode,outname)=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial); //never happens since PEA visualize content as a single object
      'UNLPAQ' :
      if totrow<3 then
         if compose_unlpaq_cl(cl,jobcode,outname,true,'ext')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial); //never happens since LPAQ supports single file Compression
      'UNPAQ' :
      if totrow<3 then //partial extraction not implemented, so this method is allowed only if a single object is contained (useful for .tar.*)
         if compose_unpaq_cl(cl,jobcode,outname,true,'ext')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial);
      'UNZPAQ' :
      if totrow<3 then //partial extraction not implemented, so this method is allowed only if a single object is contained (useful for .tar.*)
         if compose_unzpaq_cl(cl,jobcode,outname,true,'ext','single')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial);
      'UNQUAD' :
      if totrow<3 then
         if compose_unquad_cl(cl,jobcode,outname,true,'ext')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial); //never happens since QUAD/BALZ/BCM supports single file compression
      'UNBROTLI' :
      if totrow<3 then
         if compose_unbrotli_cl(cl,jobcode,outname,true,'ext','single')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial); //never happens since Brotli supports single file compression
      'UNZSTD' :
      if totrow<3 then
         if compose_unzstd_cl(cl,jobcode,outname,true,'ext','single')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial); //never happens since Zstd supports single file compression
      'UNACE' :
      if totrow<3 then //partial extraction not implemented, so this method is allowed only if a single object is contained (useful for .tar.*)
         if compose_unace_cl(cl,jobcode,outname,true,'ext','single')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         pMessageWarningOK(txt_error_partial);
      'FILEBROWSER':
      if (GetKeyShiftState=[ssCtrl]) or (rightdropbutton=true) then
         begin
         destdir:=FormPeach.EditOutExtract.Text;
         if FormPeach.Visible=true then FormPeach.SetFocus;
         FormPeach.pmapptosys.popup();
         end
      else mass_cp_copy_filedir(txt_copy,FormPeach.EditOutExtract.Text);
      end;
   if testencrypted=0 then
      begin
      if (fun='UNARC') then
         if (GetKeyShiftState=[ssCtrl]) or (rightdropbutton=true) then
            begin
            destdir:=FormPeach.EditOutExtract.Text;
            if FormPeach.Visible=true then FormPeach.SetFocus;
            FormPeach.pmapptosysextract.popup();
            end
         else
            if compose_unarc_cl(cl,jobcode,outname,true,'draganddrop','selected')=0 then launch_cl(cl,jobcode,outname); //'ext'
      if (fun='UN7Z') then
         if (GetKeyShiftState=[ssCtrl]) or (rightdropbutton=true) then
            begin
            destdir:=FormPeach.EditOutExtract.Text;
            if FormPeach.Visible=true then FormPeach.SetFocus;
            FormPeach.pmapptosysextract.popup();
            end
         else
            if compose_un7z_cl(cl,jobcode,outname,true,'draganddrop','selected')=0 then launch_cl(cl,jobcode,outname); //'ext'
      end;
   FormPeach.Visible:=true;
   if (fun<>'FILEBROWSER') then lastextractionpath:=FormPeach.EditOutExtract.Text;
   lastoutpath:=FormPeach.EditOutExtract.Text;
   FormPeach.EditOutExtract.Text:=olddest;
   end
else
begin
if rightdropbutton=false then intdd_do(mbleft)
else intdd_do(mbright);
end;
FDragObject.Destroy;
end;

{$ENDIF}

initialization
  {$I peach.lrs}

  {$IFDEF MSWINDOWS}
  OleInitialize(nil);
  {$ENDIF}

finalization
  {$IFDEF MSWINDOWS}
  OleUninitialize();
  {$ENDIF}

end.
